@depsmith/depsmith-sdk-react 0.9.3 → 0.9.5

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## 0.9.4
4
+
5
+ Lockstep release with `@depsmith/depsmith-sdk` 0.9.4 (cross-tab and consent fixes, per-project `device_id`). No React API change.
6
+
7
+ Earlier versions: see the git tags (`react-v*`) and RELEASING.md.
@@ -1 +1 @@
1
- {"version":3,"sources":["/mnt/windows/devspace/depsmith-dev/rel-0.9.3/react/dist/chunk-O5EMHONO.cjs","../src/provider.tsx","../src/page-view.ts"],"names":["useRef","useEffect"],"mappings":"AAAA,6rBAAY;AACZ;AACA;ACFA;AACE;AACA;AACA;AACA;AACA;AAAA,8BAGK;AACP,qDAA4E;AA6FnE,+CAAA;AA3ET,IAAM,gBAAA,EAAkB,kCAAA,IAA+C,CAAA;AAwChE,SAAS,gBAAA,CAAiB,KAAA,EAA4C;AAC3E,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,EAAA,EAAI,6BAAA,CAA+B,EAAA,GAAM;AAC7D,IAAA,GAAA,CAAI,CAAC,KAAA,CAAM,MAAA,EAAQ,OAAO,WAAA,kBAAY,KAAA,CAAM,MAAA,UAAU,KAAA,GAAS,CAAA;AAC/D,IAAA,MAAM,OAAA,EAAS,KAAA,CAAM,MAAA;AACrB,IAAA,GAAA,CAAI,OAAO,OAAA,IAAW,WAAA,EAAa,wBAAA,CAAY,IAAA,CAAK,MAAM,CAAA;AAC1D,IAAA,OAAO;AAAA,MACL,GAAA,EAAK,wBAAA;AAAA,MACL,qBAAA,EAAuB,qBAAA,CAAsB,MAAM,CAAA;AAAA,MACnD,KAAA,mBAAO,MAAA,CAAO,KAAA,UAAS;AAAA,IACzB,CAAA;AAAA,EACF,CAAC,CAAA;AAMD,EAAA,MAAM,OAAA,EAAS,KAAA,CAAM,OAAA,EAAS,K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,CAAI,IAAA,CAAK,IAAA,EAAM,UAAA,EAAY,EAAE,KAAK,CAAC,CAAA;AAAA,EAC1C,CAAA,EAAG,CAAC,GAAA,EAAK,GAAA,EAAK,qBAAA,EAAuB,KAAK,CAAC,CAAA;AAC7C;AFqEA;AACA;AACE;AACA;AACA;AACF,kHAAC","file":"/mnt/windows/devspace/depsmith-dev/rel-0.9.3/react/dist/chunk-O5EMHONO.cjs","sourcesContent":[null,"import {\n createContext,\n useContext,\n useEffect,\n useRef,\n useState,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { DepsmithSdk, type DepsmithSdkClient, type DepsmithSdkConfig } from '@depsmith/depsmith-sdk';\n\n/** Every tracking call the singleton facade offers, minus its lifecycle (init/shutdown). */\nexport type DepsmithApi = Omit<typeof DepsmithSdk, 'init' | 'shutdown'>;\n\ninterface DepsmithContextValue {\n api: DepsmithApi;\n /**\n * True when the SDK's own autocapture already emits `$page_view` on every History navigation.\n * Router-driven page views must then stand down, or each route change is counted twice: the\n * SDK's pushState patch fires first, and an explicit `page()` always emits.\n */\n pageViewsAutocaptured: boolean;\n debug: boolean;\n /** The supplied client the provider adopted, if any. */\n client?: DepsmithSdkClient;\n}\n\nconst DepsmithContext = createContext<DepsmithContextValue | null>(null);\n\nexport type DepsmithProviderProps = {\n children?: ReactNode;\n} & (\n | {\n /** Passed to `DepsmithSdk.init()`. Read once, on first render — later changes are ignored. */\n config: DepsmithSdkConfig;\n client?: never;\n }\n | {\n /**\n * A client you constructed yourself, e.g. a second instance alongside the singleton.\n *\n * Construct it ONCE, outside any component — at module scope, guarded for the server:\n * `typeof window !== 'undefined' ? new DepsmithSdkClient(config) : undefined`. A client\n * built in render (`client={new DepsmithSdkClient(config)}`) is a fully armed instance per\n * render. The first non-null client is adopted — on first render, or later if the first\n * renders passed `undefined` / `null` (the server, or a client created in an effect) —\n * and every call is a silent no-op until then. A different instance passed after that is\n * never used, so the provider shuts it down and warns.\n */\n client: DepsmithSdkClient | null | undefined;\n config?: never;\n }\n);\n\n/**\n * Initialises the SDK and makes it available to `useDepsmith()` and the page-view hooks.\n *\n * Initialises during the first render, not in an effect. Child effects run before their\n * parent's, so an effect-time init would drop every event a descendant tracks on mount. Render-time\n * is safe to repeat: `DepsmithSdk.init` is a no-op for the same apiKey, which also covers\n * StrictMode's double render and hot reload. On the server (no `window`) it does nothing, and\n * every call through the hooks is a silent no-op until the browser renders.\n *\n * The client is never shut down on unmount: it owns the persisted queue and the `pagehide` flush,\n * which must outlive any one component tree. A supplied `client` is likewise adopted once (the\n * first non-null one); see the prop's documentation for why it must be built outside render.\n */\nexport function DepsmithProvider(props: DepsmithProviderProps): ReactElement {\n const [value, setValue] = useState<DepsmithContextValue>(() => {\n if (!props.config) return clientValue(props.client ?? undefined);\n const config = props.config;\n if (typeof window !== 'undefined') DepsmithSdk.init(config);\n return {\n api: DepsmithSdk,\n pageViewsAutocaptured: autocapturesPageViews(config),\n debug: config.debug ?? false,\n };\n });\n\n // A client built in render — `client={new DepsmithSdkClient(config)}` — is a new, fully armed\n // instance (flush timer, listeners, autocapture, History and fetch patches) on every render of\n // the parent, all on the same storage keys, each capturing every click and navigation. Only\n // the first is used; shut the others down instead of leaving them running for the page's life.\n const passed = props.config ? undefined : props.client;\n // No client on the first render (SSR, or one created in a parent's effect): adopt the first\n // that arrives. Set during render, so this pass already hands it to the children — React\n // re-runs this component with the new state before committing anything.\n if (passed && !value.client) setValue(clientValue(passed));\n const warned = useRef(false);\n useEffect(() => {\n if (!passed || !value.client || passed === value.client) return;\n if (!warned.current) {\n warned.current = true;\n console.warn(\n '[depsmith-sdk-react] <DepsmithProvider client> received a different client after the ' +\n 'first render. Only the first is used; the new one has been shut down. Construct the ' +\n 'client once, outside render (module scope).'\n );\n }\n passed.shutdown();\n }, [passed, value.client]);\n\n return <DepsmithContext.Provider value={value}>{props.children}</DepsmithContext.Provider>;\n}\n\n/** The SDK, from the nearest `<DepsmithProvider>`. Every method is safe to call during SSR. */\nexport function useDepsmith(): DepsmithApi {\n return useDepsmithContext().api;\n}\n\nexport function useDepsmithContext(): DepsmithContextValue {\n const ctx = useContext(DepsmithContext);\n if (!ctx) throw new Error('useDepsmith must be used inside <DepsmithProvider>');\n return ctx;\n}\n\n/**\n * Mirrors the web SDK's resolveConfig: `true` means all defaults, which include pageviews.\n * `pageviews` is `'path' | 'all' | boolean` from SDK 0.8.0: `'path'`, `'all'` and `true` all\n * autocapture, an absent key keeps the default (`'path'`), and only a falsy value turns it off.\n */\nfunction autocapturesPageViews(config: DepsmithSdkConfig): boolean {\n const ac = config.autocapture;\n if (ac === true) return true;\n if (ac && typeof ac === 'object') {\n // Widened: the published SDK's types may still declare a boolean here.\n const pageviews: unknown = ac.pageviews;\n return pageviews === undefined || Boolean(pageviews);\n }\n return false;\n}\n\n/**\n * Whether a supplied client autocaptures page views, so the router hooks stand down for it as\n * they do for `config`. Read from the client's resolved config: the published SDK has no public\n * accessor for it. If that shape ever changes this answers false — the old behaviour.\n */\nfunction clientAutocapturesPageViews(c: DepsmithSdkClient): boolean {\n try {\n const ac = (c as unknown as { config?: { autocapture?: unknown } }).config?.autocapture;\n return !!ac && typeof ac === 'object' && !!(ac as { pageviews?: unknown }).pageviews;\n } catch {\n return false;\n }\n}\n\nfunction clientValue(client: DepsmithSdkClient | undefined): DepsmithContextValue {\n return {\n api: bindClient(client),\n pageViewsAutocaptured: !!client && clientAutocapturesPageViews(client),\n debug: false,\n client,\n };\n}\n\n/** Routes the hooks to `c`; with no client (the server) every call is a no-op. */\nfunction bindClient(c: DepsmithSdkClient | undefined): DepsmithApi {\n return {\n track: (name, properties) => c?.track(name, properties),\n // Spread, so the `{ type }` options argument reaches the client.\n page: (...args: Parameters<DepsmithSdkClient['page']>) => c?.page(...args),\n screen: (...args: Parameters<DepsmithSdkClient['screen']>) => c?.screen(...args),\n identify: (userId, traits) => c?.identify(userId, traits),\n alias: (aliasId) => c?.alias(aliasId),\n reset: () => c?.reset(),\n group: (groupId, traits) => c?.group(groupId, traits),\n setGroupTraits: (traits) => c?.setGroupTraits(traits),\n setProperty: (key, value) => c?.setProperty(key, value),\n setOnceProperty: (key, value) => c?.setOnceProperty(key, value),\n unsetProperty: (key) => c?.unsetProperty(key),\n setUserProperties: (ops) => c?.setUserProperties(ops),\n register: (properties) => c?.register(properties),\n registerOnce: (properties) => c?.registerOnce(properties),\n unregister: (key) => c?.unregister(key),\n optIn: () => c?.optIn(),\n optOut: () => c?.optOut(),\n flush: () => c?.flush() ?? Promise.resolve(),\n getAnonymousId: () => c?.getAnonymousId(),\n getSessionId: () => c?.getSessionId(),\n setSessionId: (sessionId, startedAt) => c?.setSessionId(sessionId, startedAt),\n };\n}\n","import { useEffect, useRef } from 'react';\nimport type { Properties } from '@depsmith/depsmith-sdk';\nimport { useDepsmithContext } from './provider';\n\nexport interface PageViewOptions {\n /**\n * Page name. Defaults to the SDK's `pageNames` match for the location, else `document.title`\n * at the time the view is recorded.\n */\n name?: string;\n properties?: Properties;\n /** Page type, sent as `$page_type` (`product`, `collection`, `cart`, …). */\n type?: string;\n}\n\n/**\n * Emits one `$page_view` per distinct `key` — pass whatever identifies a page in your router:\n * the pathname, or pathname + search if query changes are separate pages for you (the\n * equivalent of `pageviews: 'all'`). Router-agnostic; `@depsmith/depsmith-sdk-react/react-router`\n * wraps it for React Router.\n *\n * Does nothing when the provider's config autocaptures page views (`autocapture: true`, or an\n * object without `pageviews: false`): the SDK already emits on every History navigation, and an\n * explicit `page()` on top would count each route twice. Set `autocapture.pageviews: false` to\n * let the router drive page views instead.\n *\n * `key === undefined` skips — useful while a router is still resolving. A repeated key is ignored,\n * which also absorbs StrictMode's mount → unmount → mount effect replay.\n */\nexport function usePageView(key: string | undefined, options: PageViewOptions = {}): void {\n const { api, pageViewsAutocaptured, debug } = useDepsmithContext();\n const lastKey = useRef<string | undefined>(undefined);\n // Read through a ref so inline `{ properties: {...} }` literals don't re-fire the effect.\n const latest = useRef(options);\n latest.current = options;\n\n useEffect(() => {\n if (key === undefined || key === lastKey.current) return;\n lastKey.current = key;\n if (pageViewsAutocaptured) {\n if (debug) {\n console.warn(\n '[depsmith-sdk-react] usePageView ignored: autocapture already emits page views. ' +\n 'Set autocapture.pageviews: false to drive them from the router.'\n );\n }\n return;\n }\n const { name, properties, type } = latest.current;\n // The options argument only when there is a type, so a call without one is unchanged.\n if (type === undefined) api.page(name, properties);\n else api.page(name, properties, { type });\n }, [key, api, pageViewsAutocaptured, debug]);\n}\n"]}
1
+ {"version":3,"sources":["/mnt/windows/devspace/depsmith-dev/depsmith-sdk-tag095/react/dist/chunk-O5EMHONO.cjs","../src/provider.tsx","../src/page-view.ts"],"names":["useRef","useEffect"],"mappings":"AAAA,6rBAAY;AACZ;AACA;ACFA;AACE;AACA;AACA;AACA;AACA;AAAA,8BAGK;AACP,qDAA4E;AA6FnE,+CAAA;AA3ET,IAAM,gBAAA,EAAkB,kCAAA,IAA+C,CAAA;AAwChE,SAAS,gBAAA,CAAiB,KAAA,EAA4C;AAC3E,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,EAAA,EAAI,6BAAA,CAA+B,EAAA,GAAM;AAC7D,IAAA,GAAA,CAAI,CAAC,KAAA,CAAM,MAAA,EAAQ,OAAO,WAAA,kBAAY,KAAA,CAAM,MAAA,UAAU,KAAA,GAAS,CAAA;AAC/D,IAAA,MAAM,OAAA,EAAS,KAAA,CAAM,MAAA;AACrB,IAAA,GAAA,CAAI,OAAO,OAAA,IAAW,WAAA,EAAa,wBAAA,CAAY,IAAA,CAAK,MAAM,CAAA;AAC1D,IAAA,OAAO;AAAA,MACL,GAAA,EAAK,wBAAA;AAAA,MACL,qBAAA,EAAuB,qBAAA,CAAsB,MAAM,CAAA;AAAA,MACnD,KAAA,mBAAO,MAAA,CAAO,KAAA,UAAS;AAAA,IACzB,CAAA;AAAA,EACF,CAAC,CAAA;AAMD,EAAA,MAAM,OAAA,EAAS,KAAA,CAAM,OAAA,EAAS,KAAA,EAAA,EAAY,KAAA,CAAM,MAAA;AAIhD,EAAA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E,KAAK,CAAC,CAAA;AAAA,EAC1C,CAAA,EAAG,CAAC,GAAA,EAAK,GAAA,EAAK,qBAAA,EAAuB,KAAK,CAAC,CAAA;AAC7C;AFqEA;AACA;AACE;AACA;AACA;AACF,kHAAC","file":"/mnt/windows/devspace/depsmith-dev/depsmith-sdk-tag095/react/dist/chunk-O5EMHONO.cjs","sourcesContent":[null,"import {\n createContext,\n useContext,\n useEffect,\n useRef,\n useState,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { DepsmithSdk, type DepsmithSdkClient, type DepsmithSdkConfig } from '@depsmith/depsmith-sdk';\n\n/** Every tracking call the singleton facade offers, minus its lifecycle (init/shutdown). */\nexport type DepsmithApi = Omit<typeof DepsmithSdk, 'init' | 'shutdown'>;\n\ninterface DepsmithContextValue {\n api: DepsmithApi;\n /**\n * True when the SDK's own autocapture already emits `$page_view` on every History navigation.\n * Router-driven page views must then stand down, or each route change is counted twice: the\n * SDK's pushState patch fires first, and an explicit `page()` always emits.\n */\n pageViewsAutocaptured: boolean;\n debug: boolean;\n /** The supplied client the provider adopted, if any. */\n client?: DepsmithSdkClient;\n}\n\nconst DepsmithContext = createContext<DepsmithContextValue | null>(null);\n\nexport type DepsmithProviderProps = {\n children?: ReactNode;\n} & (\n | {\n /** Passed to `DepsmithSdk.init()`. Read once, on first render — later changes are ignored. */\n config: DepsmithSdkConfig;\n client?: never;\n }\n | {\n /**\n * A client you constructed yourself, e.g. a second instance alongside the singleton.\n *\n * Construct it ONCE, outside any component — at module scope, guarded for the server:\n * `typeof window !== 'undefined' ? new DepsmithSdkClient(config) : undefined`. A client\n * built in render (`client={new DepsmithSdkClient(config)}`) is a fully armed instance per\n * render. The first non-null client is adopted — on first render, or later if the first\n * renders passed `undefined` / `null` (the server, or a client created in an effect) —\n * and every call is a silent no-op until then. A different instance passed after that is\n * never used, so the provider shuts it down and warns.\n */\n client: DepsmithSdkClient | null | undefined;\n config?: never;\n }\n);\n\n/**\n * Initialises the SDK and makes it available to `useDepsmith()` and the page-view hooks.\n *\n * Initialises during the first render, not in an effect. Child effects run before their\n * parent's, so an effect-time init would drop every event a descendant tracks on mount. Render-time\n * is safe to repeat: `DepsmithSdk.init` is a no-op for the same apiKey, which also covers\n * StrictMode's double render and hot reload. On the server (no `window`) it does nothing, and\n * every call through the hooks is a silent no-op until the browser renders.\n *\n * The client is never shut down on unmount: it owns the persisted queue and the `pagehide` flush,\n * which must outlive any one component tree. A supplied `client` is likewise adopted once (the\n * first non-null one); see the prop's documentation for why it must be built outside render.\n */\nexport function DepsmithProvider(props: DepsmithProviderProps): ReactElement {\n const [value, setValue] = useState<DepsmithContextValue>(() => {\n if (!props.config) return clientValue(props.client ?? undefined);\n const config = props.config;\n if (typeof window !== 'undefined') DepsmithSdk.init(config);\n return {\n api: DepsmithSdk,\n pageViewsAutocaptured: autocapturesPageViews(config),\n debug: config.debug ?? false,\n };\n });\n\n // A client built in render — `client={new DepsmithSdkClient(config)}` — is a new, fully armed\n // instance (flush timer, listeners, autocapture, History and fetch patches) on every render of\n // the parent, all on the same storage keys, each capturing every click and navigation. Only\n // the first is used; shut the others down instead of leaving them running for the page's life.\n const passed = props.config ? undefined : props.client;\n // No client on the first render (SSR, or one created in a parent's effect): adopt the first\n // that arrives. Set during render, so this pass already hands it to the children — React\n // re-runs this component with the new state before committing anything.\n if (passed && !value.client) setValue(clientValue(passed));\n const warned = useRef(false);\n useEffect(() => {\n if (!passed || !value.client || passed === value.client) return;\n if (!warned.current) {\n warned.current = true;\n console.warn(\n '[depsmith-sdk-react] <DepsmithProvider client> received a different client after the ' +\n 'first render. Only the first is used; the new one has been shut down. Construct the ' +\n 'client once, outside render (module scope).'\n );\n }\n passed.shutdown();\n }, [passed, value.client]);\n\n return <DepsmithContext.Provider value={value}>{props.children}</DepsmithContext.Provider>;\n}\n\n/** The SDK, from the nearest `<DepsmithProvider>`. Every method is safe to call during SSR. */\nexport function useDepsmith(): DepsmithApi {\n return useDepsmithContext().api;\n}\n\nexport function useDepsmithContext(): DepsmithContextValue {\n const ctx = useContext(DepsmithContext);\n if (!ctx) throw new Error('useDepsmith must be used inside <DepsmithProvider>');\n return ctx;\n}\n\n/**\n * Mirrors the web SDK's resolveConfig: `true` means all defaults, which include pageviews.\n * `pageviews` is `'path' | 'all' | boolean` from SDK 0.8.0: `'path'`, `'all'` and `true` all\n * autocapture, an absent key keeps the default (`'path'`), and only a falsy value turns it off.\n */\nfunction autocapturesPageViews(config: DepsmithSdkConfig): boolean {\n const ac = config.autocapture;\n if (ac === true) return true;\n if (ac && typeof ac === 'object') {\n // Widened: the published SDK's types may still declare a boolean here.\n const pageviews: unknown = ac.pageviews;\n return pageviews === undefined || Boolean(pageviews);\n }\n return false;\n}\n\n/**\n * Whether a supplied client autocaptures page views, so the router hooks stand down for it as\n * they do for `config`. Read from the client's resolved config: the published SDK has no public\n * accessor for it. If that shape ever changes this answers false — the old behaviour.\n */\nfunction clientAutocapturesPageViews(c: DepsmithSdkClient): boolean {\n try {\n const ac = (c as unknown as { config?: { autocapture?: unknown } }).config?.autocapture;\n return !!ac && typeof ac === 'object' && !!(ac as { pageviews?: unknown }).pageviews;\n } catch {\n return false;\n }\n}\n\nfunction clientValue(client: DepsmithSdkClient | undefined): DepsmithContextValue {\n return {\n api: bindClient(client),\n pageViewsAutocaptured: !!client && clientAutocapturesPageViews(client),\n debug: false,\n client,\n };\n}\n\n/** Routes the hooks to `c`; with no client (the server) every call is a no-op. */\nfunction bindClient(c: DepsmithSdkClient | undefined): DepsmithApi {\n return {\n track: (name, properties) => c?.track(name, properties),\n // Spread, so the `{ type }` options argument reaches the client.\n page: (...args: Parameters<DepsmithSdkClient['page']>) => c?.page(...args),\n screen: (...args: Parameters<DepsmithSdkClient['screen']>) => c?.screen(...args),\n identify: (userId, traits) => c?.identify(userId, traits),\n alias: (aliasId) => c?.alias(aliasId),\n reset: () => c?.reset(),\n group: (groupId, traits) => c?.group(groupId, traits),\n setGroupTraits: (traits) => c?.setGroupTraits(traits),\n setProperty: (key, value) => c?.setProperty(key, value),\n setOnceProperty: (key, value) => c?.setOnceProperty(key, value),\n unsetProperty: (key) => c?.unsetProperty(key),\n setUserProperties: (ops) => c?.setUserProperties(ops),\n register: (properties) => c?.register(properties),\n registerOnce: (properties) => c?.registerOnce(properties),\n unregister: (key) => c?.unregister(key),\n optIn: () => c?.optIn(),\n optOut: () => c?.optOut(),\n flush: () => c?.flush() ?? Promise.resolve(),\n getAnonymousId: () => c?.getAnonymousId(),\n getSessionId: () => c?.getSessionId(),\n setSessionId: (sessionId, startedAt) => c?.setSessionId(sessionId, startedAt),\n };\n}\n","import { useEffect, useRef } from 'react';\nimport type { Properties } from '@depsmith/depsmith-sdk';\nimport { useDepsmithContext } from './provider';\n\nexport interface PageViewOptions {\n /**\n * Page name. Defaults to the SDK's `pageNames` match for the location, else `document.title`\n * at the time the view is recorded.\n */\n name?: string;\n properties?: Properties;\n /** Page type, sent as `$page_type` (`product`, `collection`, `cart`, …). */\n type?: string;\n}\n\n/**\n * Emits one `$page_view` per distinct `key` — pass whatever identifies a page in your router:\n * the pathname, or pathname + search if query changes are separate pages for you (the\n * equivalent of `pageviews: 'all'`). Router-agnostic; `@depsmith/depsmith-sdk-react/react-router`\n * wraps it for React Router.\n *\n * Does nothing when the provider's config autocaptures page views (`autocapture: true`, or an\n * object without `pageviews: false`): the SDK already emits on every History navigation, and an\n * explicit `page()` on top would count each route twice. Set `autocapture.pageviews: false` to\n * let the router drive page views instead.\n *\n * `key === undefined` skips — useful while a router is still resolving. A repeated key is ignored,\n * which also absorbs StrictMode's mount → unmount → mount effect replay.\n */\nexport function usePageView(key: string | undefined, options: PageViewOptions = {}): void {\n const { api, pageViewsAutocaptured, debug } = useDepsmithContext();\n const lastKey = useRef<string | undefined>(undefined);\n // Read through a ref so inline `{ properties: {...} }` literals don't re-fire the effect.\n const latest = useRef(options);\n latest.current = options;\n\n useEffect(() => {\n if (key === undefined || key === lastKey.current) return;\n lastKey.current = key;\n if (pageViewsAutocaptured) {\n if (debug) {\n console.warn(\n '[depsmith-sdk-react] usePageView ignored: autocapture already emits page views. ' +\n 'Set autocapture.pageviews: false to drive them from the router.'\n );\n }\n return;\n }\n const { name, properties, type } = latest.current;\n // The options argument only when there is a type, so a call without one is unchanged.\n if (type === undefined) api.page(name, properties);\n else api.page(name, properties, { type });\n }, [key, api, pageViewsAutocaptured, debug]);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/mnt/windows/devspace/depsmith-dev/rel-0.9.3/react/dist/index.cjs"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wKAAC","file":"/mnt/windows/devspace/depsmith-dev/rel-0.9.3/react/dist/index.cjs"}
1
+ {"version":3,"sources":["/mnt/windows/devspace/depsmith-dev/depsmith-sdk-tag095/react/dist/index.cjs"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wKAAC","file":"/mnt/windows/devspace/depsmith-dev/depsmith-sdk-tag095/react/dist/index.cjs"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/mnt/windows/devspace/depsmith-dev/rel-0.9.3/react/dist/react-router.cjs","../src/react-router.ts"],"names":[],"mappings":"AAAA,ylBAAY;AACZ;AACE;AACF,wDAA6B;AAC7B;AACA;ACLA,2CAA2C;AAoBpC,SAAS,kBAAA,CAAmB,QAAA,EAAiC,CAAC,CAAA,EAAS;AAC5E,EAAA,MAAM,SAAA,EAAW,sCAAA,CAAY;AAC7B,EAAA,MAAM,IAAA,EACJ,OAAA,CAAQ,cAAA,IAAkB,MAAA,EAAQ,QAAA,CAAS,SAAA,EAAW,QAAA,CAAS,SAAA,EAAW,QAAA,CAAS,MAAA;AACrF,EAAA,2CAAA,GAAY,EAAK;AAAA,IACf,IAAA,kBAAM,OAAA,mBAAQ,OAAA,0BAAA,CAAU,QAAQ,GAAA;AAAA,IAChC,UAAA,kBAAY,OAAA,qBAAQ,aAAA,0BAAA,CAAgB,QAAQ,GAAA;AAAA,IAC5C,IAAA,kBAAM,OAAA,qBAAQ,OAAA,0BAAA,CAAU,QAAQ;AAAA,EAClC,CAAC,CAAA;AACH;AAGO,SAAS,uBAAA,CAAwB,KAAA,EAAoC;AAC1E,EAAA,kBAAA,CAAmB,KAAK,CAAA;AACxB,EAAA,OAAO,IAAA;AACT;ADfA;AACE;AACA;AACF,2GAAC","file":"/mnt/windows/devspace/depsmith-dev/rel-0.9.3/react/dist/react-router.cjs","sourcesContent":[null,"import { useLocation, type Location } from 'react-router';\nimport type { Properties } from '@depsmith/depsmith-sdk';\nimport { usePageView } from './page-view';\n\nexport interface RouterPageViewOptions {\n /** Count a change in `?query` as a new page. Default true. The `#hash` never is. */\n includeSearch?: boolean;\n /** Page name for a location. Default: `document.title`. */\n getName?: (location: Location) => string | undefined;\n /** Page type for a location, sent as `$page_type`. */\n getType?: (location: Location) => string | undefined;\n /** Extra properties for a location's `$page_view`. */\n getProperties?: (location: Location) => Properties | undefined;\n}\n\n/**\n * One `$page_view` per React Router navigation. Must render inside the router and the\n * `<DepsmithProvider>`. Same autocapture rule as `usePageView`: with `autocapture.pageviews`\n * on, this stands down.\n */\nexport function useRouterPageViews(options: RouterPageViewOptions = {}): void {\n const location = useLocation();\n const key =\n options.includeSearch === false ? location.pathname : location.pathname + location.search;\n usePageView(key, {\n name: options.getName?.(location),\n properties: options.getProperties?.(location),\n type: options.getType?.(location),\n });\n}\n\n/** Component form of `useRouterPageViews`, for dropping into a layout route. Renders nothing. */\nexport function DepsmithRouterPageViews(props: RouterPageViewOptions): null {\n useRouterPageViews(props);\n return null;\n}\n"]}
1
+ {"version":3,"sources":["/mnt/windows/devspace/depsmith-dev/depsmith-sdk-tag095/react/dist/react-router.cjs","../src/react-router.ts"],"names":[],"mappings":"AAAA,ylBAAY;AACZ;AACE;AACF,wDAA6B;AAC7B;AACA;ACLA,2CAA2C;AAoBpC,SAAS,kBAAA,CAAmB,QAAA,EAAiC,CAAC,CAAA,EAAS;AAC5E,EAAA,MAAM,SAAA,EAAW,sCAAA,CAAY;AAC7B,EAAA,MAAM,IAAA,EACJ,OAAA,CAAQ,cAAA,IAAkB,MAAA,EAAQ,QAAA,CAAS,SAAA,EAAW,QAAA,CAAS,SAAA,EAAW,QAAA,CAAS,MAAA;AACrF,EAAA,2CAAA,GAAY,EAAK;AAAA,IACf,IAAA,kBAAM,OAAA,mBAAQ,OAAA,0BAAA,CAAU,QAAQ,GAAA;AAAA,IAChC,UAAA,kBAAY,OAAA,qBAAQ,aAAA,0BAAA,CAAgB,QAAQ,GAAA;AAAA,IAC5C,IAAA,kBAAM,OAAA,qBAAQ,OAAA,0BAAA,CAAU,QAAQ;AAAA,EAClC,CAAC,CAAA;AACH;AAGO,SAAS,uBAAA,CAAwB,KAAA,EAAoC;AAC1E,EAAA,kBAAA,CAAmB,KAAK,CAAA;AACxB,EAAA,OAAO,IAAA;AACT;ADfA;AACE;AACA;AACF,2GAAC","file":"/mnt/windows/devspace/depsmith-dev/depsmith-sdk-tag095/react/dist/react-router.cjs","sourcesContent":[null,"import { useLocation, type Location } from 'react-router';\nimport type { Properties } from '@depsmith/depsmith-sdk';\nimport { usePageView } from './page-view';\n\nexport interface RouterPageViewOptions {\n /** Count a change in `?query` as a new page. Default true. The `#hash` never is. */\n includeSearch?: boolean;\n /** Page name for a location. Default: `document.title`. */\n getName?: (location: Location) => string | undefined;\n /** Page type for a location, sent as `$page_type`. */\n getType?: (location: Location) => string | undefined;\n /** Extra properties for a location's `$page_view`. */\n getProperties?: (location: Location) => Properties | undefined;\n}\n\n/**\n * One `$page_view` per React Router navigation. Must render inside the router and the\n * `<DepsmithProvider>`. Same autocapture rule as `usePageView`: with `autocapture.pageviews`\n * on, this stands down.\n */\nexport function useRouterPageViews(options: RouterPageViewOptions = {}): void {\n const location = useLocation();\n const key =\n options.includeSearch === false ? location.pathname : location.pathname + location.search;\n usePageView(key, {\n name: options.getName?.(location),\n properties: options.getProperties?.(location),\n type: options.getType?.(location),\n });\n}\n\n/** Component form of `useRouterPageViews`, for dropping into a layout route. Renders nothing. */\nexport function DepsmithRouterPageViews(props: RouterPageViewOptions): null {\n useRouterPageViews(props);\n return null;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depsmith/depsmith-sdk-react",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "description": "DepSmith SDK — React bindings (provider, hooks, router page views) over @depsmith/depsmith-sdk",
5
5
  "license": "MIT",
6
6
  "homepage": "https://depsmith.com",
@@ -29,6 +29,7 @@
29
29
  }
30
30
  },
31
31
  "files": [
32
+ "CHANGELOG.md",
32
33
  "dist"
33
34
  ],
34
35
  "scripts": {