@tell-rs/react 0.1.0 → 0.2.0
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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +14 -4
package/dist/index.cjs
CHANGED
|
@@ -54,7 +54,7 @@ function TellProvider({ apiKey, options, children }) {
|
|
|
54
54
|
import_browser.default.close();
|
|
55
55
|
};
|
|
56
56
|
}, []);
|
|
57
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TellContext, { value: import_browser.default, children });
|
|
57
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TellContext.Provider, { value: import_browser.default, children });
|
|
58
58
|
}
|
|
59
59
|
function useTell() {
|
|
60
60
|
return (0, import_react.useContext)(TellContext);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n useContext,\n useEffect,\n useCallback,\n useRef,\n type ReactNode,\n} from \"react\";\nimport tell from \"@tell-rs/browser\";\nimport type { TellBrowserConfig, TellInstance, Properties } from \"@tell-rs/browser\";\n\n// Re-export everything from @tell-rs/browser for convenience\nexport { tell } from \"@tell-rs/browser\";\nexport type { TellBrowserConfig, TellInstance, Properties } from \"@tell-rs/browser\";\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst TellContext = createContext<TellInstance>(tell);\n\nexport interface TellProviderProps {\n apiKey: string;\n options?: TellBrowserConfig;\n children: ReactNode;\n}\n\n/**\n * Initializes the Tell SDK and provides it to the React tree.\n * Call once at the root of your app.\n */\nexport function TellProvider({ apiKey, options, children }: TellProviderProps) {\n const initialized = useRef(false);\n\n useEffect(() => {\n if (!initialized.current) {\n tell.configure(apiKey, options);\n initialized.current = true;\n }\n return () => {\n tell.close();\n };\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n return <TellContext value={tell}>{children}</TellContext>;\n}\n\n// ---------------------------------------------------------------------------\n// Hooks\n// ---------------------------------------------------------------------------\n\n/** Access the Tell singleton instance. */\nexport function useTell(): TellInstance {\n return useContext(TellContext);\n}\n\n/** Returns a stable `track` function. */\nexport function useTrack() {\n const t = useTell();\n return useCallback(\n (eventName: string, properties?: Properties) => {\n t.track(eventName, properties);\n },\n [t]\n );\n}\n\n/** Returns a stable `identify` function. */\nexport function useIdentify() {\n const t = useTell();\n return useCallback(\n (userId: string, traits?: Properties) => {\n t.identify(userId, traits);\n },\n [t]\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAOO;AACP,qBAAiB;AAIjB,IAAAA,kBAAqB;AAgCZ;AAzBT,IAAM,kBAAc,4BAA4B,eAAAC,OAAI;AAY7C,SAAS,aAAa,EAAE,QAAQ,SAAS,SAAS,GAAsB;AAC7E,QAAM,kBAAc,qBAAO,KAAK;AAEhC,8BAAU,MAAM;AACd,QAAI,CAAC,YAAY,SAAS;AACxB,qBAAAA,QAAK,UAAU,QAAQ,OAAO;AAC9B,kBAAY,UAAU;AAAA,IACxB;AACA,WAAO,MAAM;AACX,qBAAAA,QAAK,MAAM;AAAA,IACb;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO,4CAAC,
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n useContext,\n useEffect,\n useCallback,\n useRef,\n type ReactNode,\n} from \"react\";\nimport tell from \"@tell-rs/browser\";\nimport type { TellBrowserConfig, TellInstance, Properties } from \"@tell-rs/browser\";\n\n// Re-export everything from @tell-rs/browser for convenience\nexport { tell } from \"@tell-rs/browser\";\nexport type { TellBrowserConfig, TellInstance, Properties } from \"@tell-rs/browser\";\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst TellContext = createContext<TellInstance>(tell);\n\nexport interface TellProviderProps {\n apiKey: string;\n options?: TellBrowserConfig;\n children: ReactNode;\n}\n\n/**\n * Initializes the Tell SDK and provides it to the React tree.\n * Call once at the root of your app.\n */\nexport function TellProvider({ apiKey, options, children }: TellProviderProps) {\n const initialized = useRef(false);\n\n useEffect(() => {\n if (!initialized.current) {\n tell.configure(apiKey, options);\n initialized.current = true;\n }\n return () => {\n tell.close();\n };\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n return <TellContext.Provider value={tell}>{children}</TellContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hooks\n// ---------------------------------------------------------------------------\n\n/** Access the Tell singleton instance. */\nexport function useTell(): TellInstance {\n return useContext(TellContext);\n}\n\n/** Returns a stable `track` function. */\nexport function useTrack() {\n const t = useTell();\n return useCallback(\n (eventName: string, properties?: Properties) => {\n t.track(eventName, properties);\n },\n [t]\n );\n}\n\n/** Returns a stable `identify` function. */\nexport function useIdentify() {\n const t = useTell();\n return useCallback(\n (userId: string, traits?: Properties) => {\n t.identify(userId, traits);\n },\n [t]\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAOO;AACP,qBAAiB;AAIjB,IAAAA,kBAAqB;AAgCZ;AAzBT,IAAM,kBAAc,4BAA4B,eAAAC,OAAI;AAY7C,SAAS,aAAa,EAAE,QAAQ,SAAS,SAAS,GAAsB;AAC7E,QAAM,kBAAc,qBAAO,KAAK;AAEhC,8BAAU,MAAM;AACd,QAAI,CAAC,YAAY,SAAS;AACxB,qBAAAA,QAAK,UAAU,QAAQ,OAAO;AAC9B,kBAAY,UAAU;AAAA,IACxB;AACA,WAAO,MAAM;AACX,qBAAAA,QAAK,MAAM;AAAA,IACb;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO,4CAAC,YAAY,UAAZ,EAAqB,OAAO,eAAAA,SAAO,UAAS;AACtD;AAOO,SAAS,UAAwB;AACtC,aAAO,yBAAW,WAAW;AAC/B;AAGO,SAAS,WAAW;AACzB,QAAM,IAAI,QAAQ;AAClB,aAAO;AAAA,IACL,CAAC,WAAmB,eAA4B;AAC9C,QAAE,MAAM,WAAW,UAAU;AAAA,IAC/B;AAAA,IACA,CAAC,CAAC;AAAA,EACJ;AACF;AAGO,SAAS,cAAc;AAC5B,QAAM,IAAI,QAAQ;AAClB,aAAO;AAAA,IACL,CAAC,QAAgB,WAAwB;AACvC,QAAE,SAAS,QAAQ,MAAM;AAAA,IAC3B;AAAA,IACA,CAAC,CAAC;AAAA,EACJ;AACF;","names":["import_browser","tell"]}
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ function TellProvider({ apiKey, options, children }) {
|
|
|
23
23
|
tell.close();
|
|
24
24
|
};
|
|
25
25
|
}, []);
|
|
26
|
-
return /* @__PURE__ */ jsx(TellContext, { value: tell, children });
|
|
26
|
+
return /* @__PURE__ */ jsx(TellContext.Provider, { value: tell, children });
|
|
27
27
|
}
|
|
28
28
|
function useTell() {
|
|
29
29
|
return useContext(TellContext);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n useContext,\n useEffect,\n useCallback,\n useRef,\n type ReactNode,\n} from \"react\";\nimport tell from \"@tell-rs/browser\";\nimport type { TellBrowserConfig, TellInstance, Properties } from \"@tell-rs/browser\";\n\n// Re-export everything from @tell-rs/browser for convenience\nexport { tell } from \"@tell-rs/browser\";\nexport type { TellBrowserConfig, TellInstance, Properties } from \"@tell-rs/browser\";\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst TellContext = createContext<TellInstance>(tell);\n\nexport interface TellProviderProps {\n apiKey: string;\n options?: TellBrowserConfig;\n children: ReactNode;\n}\n\n/**\n * Initializes the Tell SDK and provides it to the React tree.\n * Call once at the root of your app.\n */\nexport function TellProvider({ apiKey, options, children }: TellProviderProps) {\n const initialized = useRef(false);\n\n useEffect(() => {\n if (!initialized.current) {\n tell.configure(apiKey, options);\n initialized.current = true;\n }\n return () => {\n tell.close();\n };\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n return <TellContext value={tell}>{children}</TellContext>;\n}\n\n// ---------------------------------------------------------------------------\n// Hooks\n// ---------------------------------------------------------------------------\n\n/** Access the Tell singleton instance. */\nexport function useTell(): TellInstance {\n return useContext(TellContext);\n}\n\n/** Returns a stable `track` function. */\nexport function useTrack() {\n const t = useTell();\n return useCallback(\n (eventName: string, properties?: Properties) => {\n t.track(eventName, properties);\n },\n [t]\n );\n}\n\n/** Returns a stable `identify` function. */\nexport function useIdentify() {\n const t = useTell();\n return useCallback(\n (userId: string, traits?: Properties) => {\n t.identify(userId, traits);\n },\n [t]\n );\n}\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,OAAO,UAAU;AAIjB,SAAS,QAAAA,aAAY;AAgCZ;AAzBT,IAAM,cAAc,cAA4B,IAAI;AAY7C,SAAS,aAAa,EAAE,QAAQ,SAAS,SAAS,GAAsB;AAC7E,QAAM,cAAc,OAAO,KAAK;AAEhC,YAAU,MAAM;AACd,QAAI,CAAC,YAAY,SAAS;AACxB,WAAK,UAAU,QAAQ,OAAO;AAC9B,kBAAY,UAAU;AAAA,IACxB;AACA,WAAO,MAAM;AACX,WAAK,MAAM;AAAA,IACb;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO,oBAAC,
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n useContext,\n useEffect,\n useCallback,\n useRef,\n type ReactNode,\n} from \"react\";\nimport tell from \"@tell-rs/browser\";\nimport type { TellBrowserConfig, TellInstance, Properties } from \"@tell-rs/browser\";\n\n// Re-export everything from @tell-rs/browser for convenience\nexport { tell } from \"@tell-rs/browser\";\nexport type { TellBrowserConfig, TellInstance, Properties } from \"@tell-rs/browser\";\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst TellContext = createContext<TellInstance>(tell);\n\nexport interface TellProviderProps {\n apiKey: string;\n options?: TellBrowserConfig;\n children: ReactNode;\n}\n\n/**\n * Initializes the Tell SDK and provides it to the React tree.\n * Call once at the root of your app.\n */\nexport function TellProvider({ apiKey, options, children }: TellProviderProps) {\n const initialized = useRef(false);\n\n useEffect(() => {\n if (!initialized.current) {\n tell.configure(apiKey, options);\n initialized.current = true;\n }\n return () => {\n tell.close();\n };\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n return <TellContext.Provider value={tell}>{children}</TellContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hooks\n// ---------------------------------------------------------------------------\n\n/** Access the Tell singleton instance. */\nexport function useTell(): TellInstance {\n return useContext(TellContext);\n}\n\n/** Returns a stable `track` function. */\nexport function useTrack() {\n const t = useTell();\n return useCallback(\n (eventName: string, properties?: Properties) => {\n t.track(eventName, properties);\n },\n [t]\n );\n}\n\n/** Returns a stable `identify` function. */\nexport function useIdentify() {\n const t = useTell();\n return useCallback(\n (userId: string, traits?: Properties) => {\n t.identify(userId, traits);\n },\n [t]\n );\n}\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,OAAO,UAAU;AAIjB,SAAS,QAAAA,aAAY;AAgCZ;AAzBT,IAAM,cAAc,cAA4B,IAAI;AAY7C,SAAS,aAAa,EAAE,QAAQ,SAAS,SAAS,GAAsB;AAC7E,QAAM,cAAc,OAAO,KAAK;AAEhC,YAAU,MAAM;AACd,QAAI,CAAC,YAAY,SAAS;AACxB,WAAK,UAAU,QAAQ,OAAO;AAC9B,kBAAY,UAAU;AAAA,IACxB;AACA,WAAO,MAAM;AACX,WAAK,MAAM;AAAA,IACb;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,MAAO,UAAS;AACtD;AAOO,SAAS,UAAwB;AACtC,SAAO,WAAW,WAAW;AAC/B;AAGO,SAAS,WAAW;AACzB,QAAM,IAAI,QAAQ;AAClB,SAAO;AAAA,IACL,CAAC,WAAmB,eAA4B;AAC9C,QAAE,MAAM,WAAW,UAAU;AAAA,IAC/B;AAAA,IACA,CAAC,CAAC;AAAA,EACJ;AACF;AAGO,SAAS,cAAc;AAC5B,QAAM,IAAI,QAAQ;AAClB,SAAO;AAAA,IACL,CAAC,QAAgB,WAAwB;AACvC,QAAE,SAAS,QAAQ,MAAM;AAAA,IAC3B;AAAA,IACA,CAAC,CAAC;AAAA,EACJ;AACF;","names":["tell"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tell-rs/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Tell SDK React bindings — provider, hooks, and components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"files": [
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
17
19
|
"scripts": {
|
|
18
20
|
"build": "tsup",
|
|
19
|
-
"test": "
|
|
21
|
+
"test": "node --import tsx --test test/*.test.tsx",
|
|
20
22
|
"typecheck": "tsc --noEmit",
|
|
21
23
|
"clean": "rm -rf dist"
|
|
22
24
|
},
|
|
@@ -26,9 +28,12 @@
|
|
|
26
28
|
},
|
|
27
29
|
"devDependencies": {
|
|
28
30
|
"@types/react": "^19.0.0",
|
|
31
|
+
"@types/react-dom": "^19.0.0",
|
|
29
32
|
"react": "^19.0.0",
|
|
33
|
+
"react-dom": "^19.0.0",
|
|
30
34
|
"@tell-rs/browser": "*",
|
|
31
35
|
"tsup": "^8.0.0",
|
|
36
|
+
"tsx": "^4.0.0",
|
|
32
37
|
"typescript": "^5.5.0"
|
|
33
38
|
},
|
|
34
39
|
"repository": {
|
|
@@ -37,7 +42,12 @@
|
|
|
37
42
|
"directory": "packages/react"
|
|
38
43
|
},
|
|
39
44
|
"homepage": "https://tell.rs",
|
|
40
|
-
"keywords": [
|
|
45
|
+
"keywords": [
|
|
46
|
+
"analytics",
|
|
47
|
+
"react",
|
|
48
|
+
"hooks",
|
|
49
|
+
"tell"
|
|
50
|
+
],
|
|
41
51
|
"license": "MIT",
|
|
42
52
|
"author": "Arcade Labs Inc."
|
|
43
53
|
}
|