@knocklabs/react 0.9.2 → 0.9.3

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 79d7608: [guide] add KnockGuideLocationSensor helper component for Tanstack Router
8
+
3
9
  ## 0.9.2
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@knocklabs/react-core"),r=require("@tanstack/react-router"),i=require("react"),u=require("../modules/core/utils.js"),s=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},n=s(i),a=()=>{const{href:e}=r.useLocation(),{client:t}=c.useGuideContext();return n.default.useEffect(()=>{t.removeLocationChangeEventListeners()},[t]),n.default.useEffect(()=>{const o=u.checkForWindow();o&&t.setLocation(o.location.origin+e)},[t,e]),null};exports.KnockGuideLocationSensor=a;
2
+ //# sourceMappingURL=KnockGuideLocationSensor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnockGuideLocationSensor.js","sources":["../../../src/tanstack/KnockGuideLocationSensor.tsx"],"sourcesContent":["import { useGuideContext } from \"@knocklabs/react-core\";\nimport { useLocation } from \"@tanstack/react-router\";\nimport React from \"react\";\n\nimport { checkForWindow } from \"../modules/core/utils\";\n\nexport const KnockGuideLocationSensor: React.FC = () => {\n const { href } = useLocation();\n const { client } = useGuideContext();\n\n React.useEffect(() => {\n client.removeLocationChangeEventListeners();\n }, [client]);\n\n React.useEffect(() => {\n const win = checkForWindow();\n if (!win) return;\n\n // href here is the full path of the location, including pathname, search,\n // and hash but does not include the origin.\n client.setLocation(win.location.origin + href);\n }, [client, href]);\n\n return null;\n};\n"],"names":["KnockGuideLocationSensor","href","useLocation","client","useGuideContext","React","useEffect","removeLocationChangeEventListeners","win","checkForWindow","setLocation","location","origin"],"mappings":"qRAMaA,EAAqCA,IAAM,CAChD,KAAA,CAAEC,KAAAA,GAASC,cAAY,EACvB,CAAEC,OAAAA,GAAWC,kBAAgB,EAEnCC,OAAAA,EAAAA,QAAMC,UAAU,IAAM,CACpBH,EAAOI,mCAAmC,CAAA,EACzC,CAACJ,CAAM,CAAC,EAEXE,EAAAA,QAAMC,UAAU,IAAM,CACpB,MAAME,EAAMC,EAAAA,eAAe,EACtBD,GAILL,EAAOO,YAAYF,EAAIG,SAASC,OAASX,CAAI,CAAA,EAC5C,CAACE,EAAQF,CAAI,CAAC,EAEV,IACT"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./tanstack/KnockGuideLocationSensor.js");exports.KnockGuideLocationSensor=o.KnockGuideLocationSensor;
2
+ //# sourceMappingURL=tanstack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tanstack.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import { useGuideContext as r } from "@knocklabs/react-core";
2
+ import { useLocation as i } from "@tanstack/react-router";
3
+ import n from "react";
4
+ import { checkForWindow as c } from "../modules/core/utils.mjs";
5
+ const a = () => {
6
+ const {
7
+ href: t
8
+ } = i(), {
9
+ client: o
10
+ } = r();
11
+ return n.useEffect(() => {
12
+ o.removeLocationChangeEventListeners();
13
+ }, [o]), n.useEffect(() => {
14
+ const e = c();
15
+ e && o.setLocation(e.location.origin + t);
16
+ }, [o, t]), null;
17
+ };
18
+ export {
19
+ a as KnockGuideLocationSensor
20
+ };
21
+ //# sourceMappingURL=KnockGuideLocationSensor.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnockGuideLocationSensor.mjs","sources":["../../../src/tanstack/KnockGuideLocationSensor.tsx"],"sourcesContent":["import { useGuideContext } from \"@knocklabs/react-core\";\nimport { useLocation } from \"@tanstack/react-router\";\nimport React from \"react\";\n\nimport { checkForWindow } from \"../modules/core/utils\";\n\nexport const KnockGuideLocationSensor: React.FC = () => {\n const { href } = useLocation();\n const { client } = useGuideContext();\n\n React.useEffect(() => {\n client.removeLocationChangeEventListeners();\n }, [client]);\n\n React.useEffect(() => {\n const win = checkForWindow();\n if (!win) return;\n\n // href here is the full path of the location, including pathname, search,\n // and hash but does not include the origin.\n client.setLocation(win.location.origin + href);\n }, [client, href]);\n\n return null;\n};\n"],"names":["KnockGuideLocationSensor","href","useLocation","client","useGuideContext","React","useEffect","removeLocationChangeEventListeners","win","checkForWindow","setLocation","location","origin"],"mappings":";;;;AAMO,MAAMA,IAAqCA,MAAM;AAChD,QAAA;AAAA,IAAEC,MAAAA;AAAAA,MAASC,EAAY,GACvB;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB;AAEnCC,SAAAA,EAAMC,UAAU,MAAM;AACpBH,IAAAA,EAAOI,mCAAmC;AAAA,EAAA,GACzC,CAACJ,CAAM,CAAC,GAEXE,EAAMC,UAAU,MAAM;AACpB,UAAME,IAAMC,EAAe;AAC3B,IAAKD,KAILL,EAAOO,YAAYF,EAAIG,SAASC,SAASX,CAAI;AAAA,EAAA,GAC5C,CAACE,GAAQF,CAAI,CAAC,GAEV;AACT;"}
@@ -0,0 +1,5 @@
1
+ import { KnockGuideLocationSensor as n } from "./tanstack/KnockGuideLocationSensor.mjs";
2
+ export {
3
+ n as KnockGuideLocationSensor
4
+ };
5
+ //# sourceMappingURL=tanstack.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tanstack.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ export declare const KnockGuideLocationSensor: React.FC;
3
+ //# sourceMappingURL=KnockGuideLocationSensor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnockGuideLocationSensor.d.ts","sourceRoot":"","sources":["../../../src/tanstack/KnockGuideLocationSensor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAkB5C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { KnockGuideLocationSensor } from './KnockGuideLocationSensor';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tanstack/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@knocklabs/react",
3
3
  "description": "A set of React components to build notification experiences powered by Knock",
4
4
  "author": "@knocklabs",
5
- "version": "0.9.2",
5
+ "version": "0.9.3",
6
6
  "license": "MIT",
7
7
  "main": "dist/cjs/index.js",
8
8
  "module": "dist/esm/index.mjs",
@@ -22,6 +22,12 @@
22
22
  "types": "./dist/types/next/index.d.ts",
23
23
  "import": "./dist/esm/next.mjs",
24
24
  "default": "./dist/cjs/next.js"
25
+ },
26
+ "./tanstack": {
27
+ "require": "./dist/cjs/tanstack.js",
28
+ "types": "./dist/types/tanstack/index.d.ts",
29
+ "import": "./dist/esm/tanstack.mjs",
30
+ "default": "./dist/cjs/tanstack.js"
25
31
  }
26
32
  },
27
33
  "files": [
@@ -52,11 +58,15 @@
52
58
  "url": "https://github.com/knocklabs/javascript/issues"
53
59
  },
54
60
  "peerDependencies": {
61
+ "@tanstack/react-router": "^1.0.0",
55
62
  "next": "^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
56
63
  "react": "^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
57
64
  "react-dom": "^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
58
65
  },
59
66
  "peerDependenciesMeta": {
67
+ "@tanstack/react-router": {
68
+ "optional": true
69
+ },
60
70
  "next": {
61
71
  "optional": true
62
72
  }
@@ -76,7 +86,8 @@
76
86
  },
77
87
  "devDependencies": {
78
88
  "@codecov/vite-plugin": "^1.9.1",
79
- "@testing-library/dom": "^10.4.0",
89
+ "@tanstack/react-router": "1.134.12",
90
+ "@testing-library/dom": "^10.4.1",
80
91
  "@testing-library/react": "^16.3.0",
81
92
  "@types/eslint-plugin-jsx-a11y": "^6",
82
93
  "@types/lodash.debounce": "^4.0.9",
@@ -90,7 +101,7 @@
90
101
  "eslint-plugin-jsx-a11y": "^6.10.2",
91
102
  "eslint-plugin-react-hooks": "^5.2.0",
92
103
  "eslint-plugin-react-refresh": "^0.4.14",
93
- "jsdom": "^27.0.0",
104
+ "jsdom": "^27.1.0",
94
105
  "next": "15.3.3",
95
106
  "react": "^19.0.0",
96
107
  "react-dom": "^19.0.0",