@ably/ui 15.7.0-dev.39da77a7 → 15.7.0-dev.682c4555

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/insights/command-queue.ts"],"sourcesContent":["import {\n AnalyticsService,\n Command,\n InsightsConfig,\n InsightsIdentity,\n} from \"./types\";\nimport { InsightsService } from \"./service\";\nimport * as logger from \"./logger\";\n\n// Queue handler that will collect commands before initialization\nexport class InsightsCommandQueue implements AnalyticsService {\n private isInitialized: boolean = false;\n private queue: Command[] = [];\n private debugMode: boolean = false;\n private realImplementation: InsightsService | null = null;\n\n constructor() {\n // Create a proxy that will either queue commands or execute them directly\n return new Proxy(this, {\n get: (target: InsightsCommandQueue, prop: string) => {\n // Return actual properties of the queue\n if (\n prop in target &&\n typeof (target as InsightsCommandQueue)[prop] !== \"function\"\n ) {\n return (target as InsightsCommandQueue)[\n prop as keyof InsightsCommandQueue\n ];\n }\n\n // Return a function that either queues or executes the method call\n return (...args: unknown[]) => {\n if (!target.isInitialized || !target.realImplementation) {\n // Queue the command for later execution\n if (prop === \"initInsights\") {\n // Special handling for initInsights - execute it right away\n target.executeInitInsights(args[0] as InsightsConfig);\n return;\n }\n\n // For debug logging\n if (target.debugMode) {\n logger.debug(`Queuing method call: ${String(prop)}`, args);\n }\n\n target.queue.push({\n methodName: prop as keyof AnalyticsService,\n args,\n });\n return;\n }\n\n // Execute the command immediately on the real implementation\n if (\n typeof (target.realImplementation as AnalyticsService)[prop] ===\n \"function\"\n ) {\n return (target.realImplementation as AnalyticsService)[prop](\n ...args,\n );\n }\n };\n },\n });\n }\n\n // Special handling for init since it needs to happen right away\n private executeInitInsights(config: InsightsConfig): void {\n this.debugMode = !!config.debug;\n\n if (this.debugMode) {\n logger.debug(\"Initializing insights\");\n }\n\n // Create and initialize the real implementation\n this.realImplementation = new InsightsService();\n this.realImplementation.initInsights(config);\n\n // Mark as initialized and process the queue\n this.isInitialized = true;\n this.processQueue();\n }\n\n // Process all queued commands\n private processQueue(): void {\n if (this.debugMode) {\n logger.debug(`Processing ${this.queue.length} queued commands`);\n }\n\n while (this.queue.length > 0) {\n const cmd = this.queue.shift();\n if (\n cmd &&\n this.realImplementation &&\n typeof this.realImplementation[cmd.methodName] === \"function\"\n ) {\n try {\n if (this.debugMode) {\n logger.debug(\n `Executing queued command: ${cmd.methodName}`,\n cmd.args,\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n (this.realImplementation[cmd.methodName] as Function)(\n ...(cmd.args as unknown[]),\n );\n } catch (e) {\n if (this.debugMode) {\n logger.error(\n `Error executing queued command: ${cmd.methodName}`,\n e,\n );\n }\n }\n }\n }\n }\n\n // Implement all methods required by AnalyticsService to satisfy TypeScript\n // (These won't be called directly due to the proxy)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n initInsights(config: InsightsConfig): void {}\n enableDebugMode(): void {}\n disableDebugMode(): void {}\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n identify(identity: InsightsIdentity): void {}\n trackPageView(): void {}\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n track(event: string, properties?: Record<string, unknown>): void {}\n startSessionRecording(): void {}\n stopSessionRecording(): void {}\n setupObserver(): () => void {\n return () => {};\n }\n}\n"],"names":["InsightsService","logger","InsightsCommandQueue","executeInitInsights","config","debugMode","debug","realImplementation","initInsights","isInitialized","processQueue","queue","length","cmd","shift","methodName","args","e","error","enableDebugMode","disableDebugMode","identify","identity","trackPageView","track","event","properties","startSessionRecording","stopSessionRecording","setupObserver","constructor","Proxy","get","target","prop","String","push"],"mappings":"oLAMA,OAASA,eAAe,KAAQ,WAAY,AAC5C,WAAYC,WAAY,UAAW,AAGnC,QAAO,MAAMC,qBAyDX,AAAQC,oBAAoBC,MAAsB,CAAQ,CACxD,IAAI,CAACC,SAAS,CAAG,CAAC,CAACD,OAAOE,KAAK,CAE/B,GAAI,IAAI,CAACD,SAA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,CAChB,CAtHAC,aAAc,CALd,sBAAQrB,gBAAyB,OACjC,sBAAQE,QAAmB,EAAE,EAC7B,sBAAQN,YAAqB,OAC7B,sBAAQE,qBAA6C,MAInD,OAAO,IAAIwB,MAAM,IAAI,CAAE,CACrBC,IAAK,CAACC,OAA8BC,QAElC,GACEA,QAAQD,QACR,OAAO,AAACA,MAA+B,CAACC,KAAK,GAAK,WAClD,CACA,OAAO,AAACD,MAA+B,CACrCC,KACD,AACH,CAGA,MAAO,CAAC,GAAGlB,QACT,GAAI,CAACiB,OAAOxB,aAAa,EAAI,CAACwB,OAAO1B,kBAAkB,CAAE,CAEvD,GAAI2B,OAAS,eAAgB,CAE3BD,OAAO9B,mBAAmB,CAACa,IAAI,CAAC,EAAE,EAClC,MACF,CAGA,GAAIiB,OAAO5B,SAAS,CAAE,CACpBJ,OAAOK,KAAK,CAAC,CAAC,qBAAqB,EAAE6B,OAAOD,MAAM,CAAC,CAAElB,KACvD,CAEAiB,OAAOtB,KAAK,CAACyB,IAAI,CAAC,CAChBrB,WAAYmB,KACZlB,IACF,GACA,MACF,CAGA,GACE,OAAO,AAACiB,OAAO1B,kBAAkB,AAAqB,CAAC2B,KAAK,GAC5D,WACA,CACA,OAAO,AAACD,OAAO1B,kBAAkB,AAAqB,CAAC2B,KAAK,IACvDlB,KAEP,CACF,CACF,CACF,EACF,CAuEF"}
1
+ {"version":3,"sources":["../../../src/core/insights/command-queue.ts"],"sourcesContent":["import {\n AnalyticsService,\n Command,\n InsightsConfig,\n InsightsIdentity,\n} from \"./types\";\nimport { InsightsService } from \"./service\";\nimport * as logger from \"./logger\";\n\n// Queue handler that will collect commands before initialization\nexport class InsightsCommandQueue implements AnalyticsService {\n private isInitialized: boolean = false;\n private queue: Command[] = [];\n private debugMode: boolean = false;\n private realImplementation: InsightsService | null = null;\n\n constructor() {\n // Create a proxy that will either queue commands or execute them directly\n return new Proxy(this, {\n get: (target: InsightsCommandQueue, prop: string) => {\n // Return actual properties of the queue\n if (\n prop in target &&\n typeof (target as InsightsCommandQueue)[prop] !== \"function\"\n ) {\n return (target as InsightsCommandQueue)[\n prop as keyof InsightsCommandQueue\n ];\n }\n\n // Return a function that either queues or executes the method call\n return (...args: unknown[]) => {\n if (!target.isInitialized || !target.realImplementation) {\n // Queue the command for later execution\n if (prop === \"initInsights\") {\n // Special handling for initInsights - execute it right away\n target.executeInitInsights(args[0] as InsightsConfig);\n return;\n }\n\n // For debug logging\n if (target.debugMode) {\n logger.debug(`Queuing method call: ${String(prop)}`, args);\n }\n\n target.queue.push({\n methodName: prop as keyof AnalyticsService,\n args,\n });\n return;\n }\n\n // Execute the command immediately on the real implementation\n if (\n typeof (target.realImplementation as AnalyticsService)[prop] ===\n \"function\"\n ) {\n return (target.realImplementation as AnalyticsService)[prop](\n ...args,\n );\n }\n };\n },\n });\n }\n\n // Special handling for init since it needs to happen right away\n private executeInitInsights(config: InsightsConfig): void {\n this.debugMode = !!config.debug;\n\n if (this.debugMode) {\n logger.debug(\"Initializing insights\");\n }\n\n // Create and initialize the real implementation\n this.realImplementation = new InsightsService();\n this.realImplementation.initInsights(config);\n\n // Mark as initialized and process the queue\n this.isInitialized = true;\n this.processQueue();\n }\n\n // Process all queued commands\n private processQueue(): void {\n if (this.debugMode) {\n logger.debug(`Processing ${this.queue.length} queued commands`);\n }\n\n while (this.queue.length > 0) {\n const cmd = this.queue.shift();\n if (\n cmd &&\n this.realImplementation &&\n typeof this.realImplementation[cmd.methodName] === \"function\"\n ) {\n try {\n if (this.debugMode) {\n logger.debug(\n `Executing queued command: ${cmd.methodName}`,\n cmd.args,\n );\n }\n (this.realImplementation[cmd.methodName] as (...args: unknown[]) => unknown)(\n ...(cmd.args as unknown[]),\n );\n } catch (e) {\n if (this.debugMode) {\n logger.error(\n `Error executing queued command: ${cmd.methodName}`,\n e,\n );\n }\n }\n }\n }\n }\n\n // Implement all methods required by AnalyticsService to satisfy TypeScript\n // (These won't be called directly due to the proxy)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n initInsights(config: InsightsConfig): void {}\n enableDebugMode(): void {}\n disableDebugMode(): void {}\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n identify(identity: InsightsIdentity): void {}\n trackPageView(): void {}\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n track(event: string, properties?: Record<string, unknown>): void {}\n startSessionRecording(): void {}\n stopSessionRecording(): void {}\n setupObserver(): () => void {\n return () => {};\n }\n}\n"],"names":["InsightsService","logger","InsightsCommandQueue","executeInitInsights","config","debugMode","debug","realImplementation","initInsights","isInitialized","processQueue","queue","length","cmd","shift","methodName","args","e","error","enableDebugMode","disableDebugMode","identify","identity","trackPageView","track","event","properties","startSessionRecording","stopSessionRecording","setupObserver","constructor","Proxy","get","target","prop","String","push"],"mappings":"oLAMA,OAASA,eAAe,KAAQ,WAAY,AAC5C,WAAYC,WAAY,UAAW,AAGnC,QAAO,MAAMC,qBAyDX,AAAQC,oBAAoBC,MAAsB,CAAQ,CACxD,IAAI,CAACC,SAAS,CAAG,CAAC,CAACD,OAAOE,KAAK,CAE/B,GAAI,IAAI,CAACD,SAAS,CAAE,CAClBJ,OAAOK,KAAK,CAAC,wBACf,CAGA,IAAI,CAACC,kBAAkB,CAAG,IAAIP,gBAC9B,IAAI,CAACO,kBAAkB,CAACC,YAAY,CAACJ,OAGrC,CAAA,IAAI,CAACK,aAAa,CAAG,KACrB,IAAI,CAACC,YAAY,EACnB,CAGA,AAAQA,cAAqB,CAC3B,GAAI,IAAI,CAACL,SAAS,CAAE,CAClBJ,OAAOK,KAAK,CAAC,CAAC,WAAW,EAAE,IAAI,CAACK,KAAK,CAACC,MAAM,CAAC,gBAAgB,CAAC,CAChE,CAEA,MAAO,IAAI,CAACD,KAAK,CAACC,MAAM,CAAG,EAAG,CAC5B,MAAMC,IAAM,IAAI,CAACF,KAAK,CAACG,KAAK,GAC5B,GACED,KACA,IAAI,CAACN,kBAAkB,EACvB,OAAO,IAAI,CAACA,kBAAkB,CAACM,IAAIE,UAA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qB,EAAE6B,OAAOD,MAAM,CAAC,CAAElB,KACvD,CAEAiB,OAAOtB,KAAK,CAACyB,IAAI,CAAC,CAChBrB,WAAYmB,KACZlB,IACF,GACA,MACF,CAGA,GACE,OAAO,AAACiB,OAAO1B,kBAAkB,AAAqB,CAAC2B,KAAK,GAC5D,WACA,CACA,OAAO,AAACD,OAAO1B,kBAAkB,AAAqB,CAAC2B,KAAK,IACvDlB,KAEP,CACF,CACF,CACF,EACF,CAsEF"}
@@ -1,2 +1,2 @@
1
- import mixpanel from"mixpanel-browser";export const initMixpanel=(token,autoCapture=false,debug=false,recordSessionsPercent=1)=>{const blockSelectors=["[ph-no-capture]",'[data-sl="mask"]'];if(!token){console.warn("Mixpanel token not provided, skipping initialization");return}mixpanel.init(token,{debug:debug,persistence:"localStorage",autocapture:autoCapture?{block_selectors:blockSelectors,capture_text_content:true}:false,track_pageview:false,record_sessions_percent:recordSessionsPercent})};export const enableDebugMode=()=>{mixpanel.set_config({debug:true})};export const disableDebugMode=()=>{mixpanel.set_config({debug:false})};export const identify=({userId,accountId,organisationId,email,name})=>{if(!userId){return}mixpanel.identify(userId.toString());if(email||name){mixpanel.people.set({$email:email,$name:name})}if(accountId){mixpanel.people.union({accounts:[accountId.toString()]})}if(organisationId){mixpanel.people.set({organization_id:[organisationId.toString()]})}};const redactUrlSegments=()=>{const pathSegments=window.location.pathname.split("/");const redactedSegments=pathSegments.map(segment=>{return/^\d+$/.test(segment)?"{redacted}":segment});const url=new URL(window.location.href);url.pathname=redactedSegments.join("/");return decodeURI(url.toString()).toLowerCase()};export const trackPageView=()=>{mixpanel.track_pageview({redacted_path:redactUrlSegments()})};export const track=mixpanel.track;export const startSessionRecording=mixpanel.start_session_recording;export const stopSessionRecording=mixpanel.stop_session_recording;
1
+ import mixpanel from"mixpanel-browser";export const initMixpanel=(token,autoCapture=false,debug=false,recordSessionsPercent=1)=>{const blockSelectors=["[ph-no-capture]",'[data-sl="mask"]'];if(!token){console.warn("Mixpanel token not provided, skipping initialization");return}mixpanel.init(token,{debug:debug,persistence:"localStorage",autocapture:autoCapture?{block_selectors:blockSelectors,capture_text_content:true}:false,track_pageview:false,record_sessions_percent:recordSessionsPercent})};export const enableDebugMode=()=>{mixpanel.set_config({debug:true})};export const disableDebugMode=()=>{mixpanel.set_config({debug:false})};export const identify=({userId,accountId,organisationId,email,name})=>{if(!userId){return}mixpanel.identify(userId.toString());if(email||name){mixpanel.people.set({$email:email,$name:name})}if(accountId){mixpanel.people.union({accounts:[accountId.toString()]})}if(organisationId){mixpanel.people.set({organization_id:[organisationId.toString()]})}};const redactUrlSegments=()=>{const pathSegments=window.location.pathname.split("/");const redactedSegments=pathSegments.map(segment=>{return/^\d+$/.test(segment)?"{redacted}":segment});const url=new URL(window.location.href);url.pathname=redactedSegments.join("/");return decodeURI(url.toString()).toLowerCase()};export const trackPageView=()=>{mixpanel.track_pageview({redacted_path:redactUrlSegments()})};export const track=(event,properties)=>{mixpanel.track(event,properties)};export const startSessionRecording=()=>{mixpanel.start_session_recording()};export const stopSessionRecording=()=>{mixpanel.stop_session_recording()};
2
2
  //# sourceMappingURL=mixpanel.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/insights/mixpanel.ts"],"sourcesContent":["import mixpanel from \"mixpanel-browser\";\n\nimport { InsightsIdentity } from \"./types\";\n\nexport const initMixpanel = (\n token: string,\n autoCapture: boolean = false,\n debug: boolean = false,\n recordSessionsPercent: number = 1,\n) => {\n const blockSelectors = [\"[ph-no-capture]\", '[data-sl=\"mask\"]'];\n if (!token) {\n console.warn(\"Mixpanel token not provided, skipping initialization\");\n return;\n }\n\n mixpanel.init(token, {\n debug: debug,\n persistence: \"localStorage\",\n autocapture: autoCapture\n ? {\n block_selectors: blockSelectors,\n capture_text_content: true,\n }\n : false,\n track_pageview: false, // We'll track page views manually\n record_sessions_percent: recordSessionsPercent,\n });\n};\n\nexport const enableDebugMode = () => {\n mixpanel.set_config({ debug: true });\n};\n\nexport const disableDebugMode = () => {\n mixpanel.set_config({ debug: false });\n};\n\nexport const identify = ({\n userId,\n accountId,\n organisationId,\n email,\n name,\n}: InsightsIdentity) => {\n // In very rare cases we might have a user without an account, so we'll\n // let null/undefined/blank strings through on that one\n if (!userId) {\n return;\n }\n\n mixpanel.identify(userId.toString());\n\n if (email || name) {\n mixpanel.people.set({ $email: email, $name: name });\n }\n\n if (accountId) {\n mixpanel.people.union({ accounts: [accountId.toString()] });\n }\n\n if (organisationId) {\n mixpanel.people.set({ organization_id: [organisationId.toString()] });\n }\n};\n\n// Simple function to replace all digits in a URL path with {redacted},\n// purely to make reporting based on aggregates easier\nconst redactUrlSegments = () => {\n const pathSegments = window.location.pathname.split(\"/\");\n\n const redactedSegments = pathSegments.map((segment) => {\n // Check if the segment contains only digits\n return /^\\d+$/.test(segment) ? \"{redacted}\" : segment;\n });\n\n // Join the segments back together\n const url = new URL(window.location.href);\n url.pathname = redactedSegments.join(\"/\");\n\n return decodeURI(url.toString()).toLowerCase();\n};\n\nexport const trackPageView = () => {\n // Add the redacted URL to the page view event for reporting\n mixpanel.track_pageview({\n redacted_path: redactUrlSegments(),\n });\n};\n\nexport const track = mixpanel.track;\n\nexport const startSessionRecording = mixpanel.start_session_recording;\n\nexport const stopSessionRecording = mixpanel.stop_session_recording;\n"],"names":["mixpanel","initMixpanel","token","autoCapture","debug","recordSessionsPercent","blockSelectors","console","warn","init","persistence","autocapture","block_selectors","capture_text_content","track_pageview","record_sessions_percent","enableDebugMode","set_config","disableDebugMode","identify","userId","accountId","organisationId","email","name","toString","people","set","$email","$name","union","accounts","organization_id","redactUrlSegments","pathSegments","window","location","pathname","split","redactedSegments","map","segment","test","url","URL","href","join","decodeURI","toLowerCase","trackPageView","redacted_path","track","startSessionRecording","start_session_recording","stopSessionRecording","stop_session_recording"],"mappings":"AAAA,OAAOA,aAAc,kBAAmB,AAIxC,QAAO,MAAMC,aAAe,CAC1BC,MACAC,YAAuB,KAAK,CAC5BC,MAAiB,KAAK,CACtBC,sBAA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ACxCF,CAAAA,IAAIN,QAAQ,CAAGE,iBAAiBO,IAAI,CAAC,KAErC,OAAOC,UAAUJ,IAAIlB,QAAQ,IAAIuB,WAAW,EAC9C,CAEA,QAAO,MAAMC,cAAgB,KAE3BjD,SAASc,cAAc,CAAC,CACtBoC,cAAejB,mBACjB,EACF,CAAE,AAEF,QAAO,MAAMkB,MAAQnD,SAASmD,KAAK,AAAC,AAEpC,QAAO,MAAMC,sBAAwBpD,SAASqD,uBAAuB,AAAC,AAEtE,QAAO,MAAMC,qBAAuBtD,SAASuD,sBAAsB,AAAC"}
1
+ {"version":3,"sources":["../../../src/core/insights/mixpanel.ts"],"sourcesContent":["import mixpanel from \"mixpanel-browser\";\n\nimport { InsightsIdentity } from \"./types\";\n\nexport const initMixpanel = (\n token: string,\n autoCapture: boolean = false,\n debug: boolean = false,\n recordSessionsPercent: number = 1,\n) => {\n const blockSelectors = [\"[ph-no-capture]\", '[data-sl=\"mask\"]'];\n if (!token) {\n console.warn(\"Mixpanel token not provided, skipping initialization\");\n return;\n }\n\n mixpanel.init(token, {\n debug: debug,\n persistence: \"localStorage\",\n autocapture: autoCapture\n ? {\n block_selectors: blockSelectors,\n capture_text_content: true,\n }\n : false,\n track_pageview: false, // We'll track page views manually\n record_sessions_percent: recordSessionsPercent,\n });\n};\n\nexport const enableDebugMode = () => {\n mixpanel.set_config({ debug: true });\n};\n\nexport const disableDebugMode = () => {\n mixpanel.set_config({ debug: false });\n};\n\nexport const identify = ({\n userId,\n accountId,\n organisationId,\n email,\n name,\n}: InsightsIdentity) => {\n // In very rare cases we might have a user without an account, so we'll\n // let null/undefined/blank strings through on that one\n if (!userId) {\n return;\n }\n\n mixpanel.identify(userId.toString());\n\n if (email || name) {\n mixpanel.people.set({ $email: email, $name: name });\n }\n\n if (accountId) {\n mixpanel.people.union({ accounts: [accountId.toString()] });\n }\n\n if (organisationId) {\n mixpanel.people.set({ organization_id: [organisationId.toString()] });\n }\n};\n\n// Simple function to replace all digits in a URL path with {redacted},\n// purely to make reporting based on aggregates easier\nconst redactUrlSegments = () => {\n const pathSegments = window.location.pathname.split(\"/\");\n\n const redactedSegments = pathSegments.map((segment) => {\n // Check if the segment contains only digits\n return /^\\d+$/.test(segment) ? \"{redacted}\" : segment;\n });\n\n // Join the segments back together\n const url = new URL(window.location.href);\n url.pathname = redactedSegments.join(\"/\");\n\n return decodeURI(url.toString()).toLowerCase();\n};\n\nexport const trackPageView = () => {\n // Add the redacted URL to the page view event for reporting\n mixpanel.track_pageview({\n redacted_path: redactUrlSegments(),\n });\n};\n\nexport const track = (event: string, properties?: Record<string, unknown>) => {\n mixpanel.track(event, properties);\n};\n\nexport const startSessionRecording = () => {\n mixpanel.start_session_recording();\n};\n\nexport const stopSessionRecording = () => {\n mixpanel.stop_session_recording();\n};\n"],"names":["mixpanel","initMixpanel","token","autoCapture","debug","recordSessionsPercent","blockSelectors","console","warn","init","persistence","autocapture","block_selectors","capture_text_content","track_pageview","record_sessions_percent","enableDebugMode","set_config","disableDebugMode","identify","userId","accountId","organisationId","email","name","toString","people","set","$email","$name","union","accounts","organization_id","redactUrlSegments","pathSegments","window","location","pathname","split","redactedSegments","map","segment","test","url","URL","href","join","decodeURI","toLowerCase","trackPageView","redacted_path","track","event","properties","startSessionRecording","start_session_recording","stopSessionRecording","stop_session_recording"],"mappings":"AAAA,OAAOA,aAAc,kBAAmB,AAIxC,QAAO,MAAMC,aAAe,CAC1BC,MACAC,YAAuB,KAAK,CAC5BC,MAAiB,KAAK,CACtBC,sBAAgC,CAAC,IAEjC,MAAMC,eAAiB,CAAC,kBAAmB,mBAAmB,CAC9D,GAAI,CAACJ,MAAO,CACVK,QAAQC,IAAI,CAAC,wDACb,MACF,CAEAR,SAASS,IAAI,CAACP,MAAO,CACnBE,MAAOA,MACPM,YAAa,eACbC,YAAaR,YACT,CACES,gBAAiBN,eACjBO,qBAAsB,IACxB,EACA,MACJC,eAAgB,MAChBC,wBAAyBV,qBAC3B,EACF,CAAE,AAEF,QAAO,M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,QAAO,MAAMC,sBAAwB,KACnCtD,SAASuD,uBAAuB,EAClC,CAAE,AAEF,QAAO,MAAMC,qBAAuB,KAClCxD,SAASyD,sBAAsB,EACjC,CAAE"}
@@ -1,2 +1,2 @@
1
- import posthog from"posthog-js";export const initPosthog=(apiKey,apiHost)=>{posthog.init(apiKey,{api_host:apiHost,capture_pageview:false})};export const enableDebugMode=()=>{posthog.debug()};export const disableDebugMode=()=>{posthog.debug(false)};export const identify=({userId,accountId,organisationId,email,name})=>{if(!userId){return}if(userId!==posthog.get_distinct_id()){posthog.identify(userId,{email,name})}if(accountId){posthog.group("account",accountId)}if(organisationId){posthog.group("organisation",organisationId)}};export const trackPageView=()=>{posthog.capture("$pageview")};export const track=(event,properties)=>{posthog.capture(event,properties)};export const startSessionRecording=posthog.startSessionRecording;export const stopSessionRecording=posthog.stopSessionRecording;
1
+ import posthog from"posthog-js";export const initPosthog=(apiKey,apiHost)=>{posthog.init(apiKey,{api_host:apiHost,capture_pageview:false})};export const enableDebugMode=()=>{posthog.debug()};export const disableDebugMode=()=>{posthog.debug(false)};export const identify=({userId,accountId,organisationId,email,name})=>{if(!userId){return}if(userId!==posthog.get_distinct_id()){posthog.identify(userId,{email,name})}if(accountId){posthog.group("account",accountId)}if(organisationId){posthog.group("organisation",organisationId)}};export const trackPageView=()=>{posthog.capture("$pageview")};export const track=(event,properties)=>{posthog.capture(event,properties)};export const startSessionRecording=()=>{posthog.startSessionRecording()};export const stopSessionRecording=()=>{posthog.stopSessionRecording()};
2
2
  //# sourceMappingURL=posthog.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/insights/posthog.ts"],"sourcesContent":["import posthog from \"posthog-js\";\n\nimport { InsightsIdentity } from \"./types\";\n\nexport const initPosthog = (apiKey: string, apiHost: string) => {\n posthog.init(apiKey, {\n api_host: apiHost,\n capture_pageview: false,\n });\n};\n\nexport const enableDebugMode = () => {\n posthog.debug();\n};\n\nexport const disableDebugMode = () => {\n posthog.debug(false);\n};\n\nexport const identify = ({\n userId,\n accountId,\n organisationId,\n email,\n name,\n}: InsightsIdentity) => {\n // In very rare cases we might have a user without an account, so we'll\n // let null/undefined/blank strings through on that one\n if (!userId) {\n return;\n }\n\n if (userId !== posthog.get_distinct_id()) {\n posthog.identify(userId, { email, name });\n }\n\n // Associate all events in this session with this account\n if (accountId) {\n posthog.group(\"account\", accountId);\n }\n\n // Associate all events in this session with this organisation (if available)\n if (organisationId) {\n posthog.group(\"organisation\", organisationId);\n }\n};\n\nexport const trackPageView = () => {\n posthog.capture(\"$pageview\");\n};\n\nexport const track = (event: string, properties?: Record<string, unknown>) => {\n posthog.capture(event, properties);\n};\n\nexport const startSessionRecording = posthog.startSessionRecording;\n\nexport const stopSessionRecording = posthog.stopSessionRecording;\n"],"names":["posthog","initPosthog","apiKey","apiHost","init","api_host","capture_pageview","enableDebugMode","debug","disableDebugMode","identify","userId","accountId","organisationId","email","name","get_distinct_id","group","trackPageView","capture","track","event","properties","startSessionRecording","stopSessionRecording"],"mappings":"AAAA,OAAOA,YAAa,YAAa,AAIjC,QAAO,MAAMC,YAAc,CAACC,OAAgBC,WAC1CH,QAAQI,IAAI,CAACF,OAAQ,CACnBG,SAAUF,QACVG,iBAAkB,KACpB,EACF,CAAE,AAEF,QAAO,MAAMC,gBAAkB,KAC7BP,QAAQQ,KAAK,EACf,CAAE,AAEF,QAAO,MAAMC,iBAAmB,KAC9BT,QAAQQ,KAAK,CAAC,MAChB,CAAE,AAEF,QAAO,MAAME,SAAW,CAAC,CACvBC,MAAM,CACNC,SAAS,CACTC,cAAc,CACdC,KAAK,CACLC,IAAI,CACa,IAGjB,GAAI,CAACJ,OAAQ,CACX,MACF,CAEA,GAAIA,SAAWX,QAAQgB,eAAe,GAAI,CACxChB,QAAQU,QAAQ,CAACC,OAAQ,CAAEG,MAAOC,IAAK,EACzC,CAGA,GAAIH,UAAW,CACbZ,QAAQiB,KAAK,CAAC,UAAWL,UAC3B,CAGA,GAAIC,eAAgB,CAClBb,QAAQiB,KAAK,CAAC,eAAgBJ,eAChC,CACF,CAAE,AAEF,QAAO,MAAMK,cAAgB,KAC3BlB,QAAQmB,OAAO,CAAC,YAClB,CAAE,AAEF,QAAO,MAAMC,MAAQ,CAACC,MAAeC,cACnCtB,QAAQmB,OAAO,CAACE,MAAOC,WACzB,CAAE,AAEF,QAAO,MAAMC,sBAAwBvB,QAAQuB,qBAAqB,AAAC,AAEnE,QAAO,MAAMC,qBAAuBxB,QAAQwB,oBAAoB,AAAC"}
1
+ {"version":3,"sources":["../../../src/core/insights/posthog.ts"],"sourcesContent":["import posthog from \"posthog-js\";\n\nimport { InsightsIdentity } from \"./types\";\n\nexport const initPosthog = (apiKey: string, apiHost: string) => {\n posthog.init(apiKey, {\n api_host: apiHost,\n capture_pageview: false,\n });\n};\n\nexport const enableDebugMode = () => {\n posthog.debug();\n};\n\nexport const disableDebugMode = () => {\n posthog.debug(false);\n};\n\nexport const identify = ({\n userId,\n accountId,\n organisationId,\n email,\n name,\n}: InsightsIdentity) => {\n // In very rare cases we might have a user without an account, so we'll\n // let null/undefined/blank strings through on that one\n if (!userId) {\n return;\n }\n\n if (userId !== posthog.get_distinct_id()) {\n posthog.identify(userId, { email, name });\n }\n\n // Associate all events in this session with this account\n if (accountId) {\n posthog.group(\"account\", accountId);\n }\n\n // Associate all events in this session with this organisation (if available)\n if (organisationId) {\n posthog.group(\"organisation\", organisationId);\n }\n};\n\nexport const trackPageView = () => {\n posthog.capture(\"$pageview\");\n};\n\nexport const track = (event: string, properties?: Record<string, unknown>) => {\n posthog.capture(event, properties);\n};\n\nexport const startSessionRecording = () => {\n posthog.startSessionRecording();\n};\n\nexport const stopSessionRecording = () => {\n posthog.stopSessionRecording();\n};\n"],"names":["posthog","initPosthog","apiKey","apiHost","init","api_host","capture_pageview","enableDebugMode","debug","disableDebugMode","identify","userId","accountId","organisationId","email","name","get_distinct_id","group","trackPageView","capture","track","event","properties","startSessionRecording","stopSessionRecording"],"mappings":"AAAA,OAAOA,YAAa,YAAa,AAIjC,QAAO,MAAMC,YAAc,CAACC,OAAgBC,WAC1CH,QAAQI,IAAI,CAACF,OAAQ,CACnBG,SAAUF,QACVG,iBAAkB,KACpB,EACF,CAAE,AAEF,QAAO,MAAMC,gBAAkB,KAC7BP,QAAQQ,KAAK,EACf,CAAE,AAEF,QAAO,MAAMC,iBAAmB,KAC9BT,QAAQQ,KAAK,CAAC,MAChB,CAAE,AAEF,QAAO,MAAME,SAAW,CAAC,CACvBC,MAAM,CACNC,SAAS,CACTC,cAAc,CACdC,KAAK,CACLC,IAAI,CACa,IAGjB,GAAI,CAACJ,OAAQ,CACX,MACF,CAEA,GAAIA,SAAWX,QAAQgB,eAAe,GAAI,CACxChB,QAAQU,QAAQ,CAACC,OAAQ,CAAEG,MAAOC,IAAK,EACzC,CAGA,GAAIH,UAAW,CACbZ,QAAQiB,KAAK,CAAC,UAAWL,UAC3B,CAGA,GAAIC,eAAgB,CAClBb,QAAQiB,KAAK,CAAC,eAAgBJ,eAChC,CACF,CAAE,AAEF,QAAO,MAAMK,cAAgB,KAC3BlB,QAAQmB,OAAO,CAAC,YAClB,CAAE,AAEF,QAAO,MAAMC,MAAQ,CAACC,MAAeC,cACnCtB,QAAQmB,OAAO,CAACE,MAAOC,WACzB,CAAE,AAEF,QAAO,MAAMC,sBAAwB,KACnCvB,QAAQuB,qBAAqB,EAC/B,CAAE,AAEF,QAAO,MAAMC,qBAAuB,KAClCxB,QAAQwB,oBAAoB,EAC9B,CAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ably/ui",
3
- "version": "15.7.0-dev.39da77a7",
3
+ "version": "15.7.0-dev.682c4555",
4
4
  "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.",
5
5
  "repository": {
6
6
  "type": "git",