Track feature interactions (#2959)
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
export const ORCA_RUNTIME_RPC_FEATURE_INTERACTION_SOURCE_KEY = '__orcaFeatureInteractionSource'
|
||||
|
||||
export const ORCA_RUNTIME_RPC_BROWSER_UI_SOURCE = 'browser-pane-ui'
|
||||
|
||||
export function withBrowserPaneUiRuntimeRpcSource(value: unknown): unknown {
|
||||
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
|
||||
return {
|
||||
[ORCA_RUNTIME_RPC_FEATURE_INTERACTION_SOURCE_KEY]: ORCA_RUNTIME_RPC_BROWSER_UI_SOURCE
|
||||
}
|
||||
}
|
||||
return {
|
||||
...value,
|
||||
[ORCA_RUNTIME_RPC_FEATURE_INTERACTION_SOURCE_KEY]: ORCA_RUNTIME_RPC_BROWSER_UI_SOURCE
|
||||
}
|
||||
}
|
||||
|
||||
export function isBrowserPaneUiRuntimeRpcParams(value: unknown): boolean {
|
||||
return (
|
||||
value !== null &&
|
||||
typeof value === 'object' &&
|
||||
!Array.isArray(value) &&
|
||||
(value as Record<string, unknown>)[ORCA_RUNTIME_RPC_FEATURE_INTERACTION_SOURCE_KEY] ===
|
||||
ORCA_RUNTIME_RPC_BROWSER_UI_SOURCE
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user