@opencx/widget-react-headless 5.14.1 → 5.15.1

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,7 +1,7 @@
1
1
  declare const _default: {
2
2
  "name": "@opencx/widget-react-headless",
3
3
  "private": false,
4
- "version": "5.14.1",
4
+ "version": "5.15.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "rm -rf node_modules dist .turbo",
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetProvider.d.ts","sourceRoot":"","sources":["../../src/WidgetProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EAEjB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,UAAU,mBAAmB;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACnC,cAAc,EAAE,iBAAiB,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CACrE;AAID,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EAAE,MAAM,EACf,QAAQ,EACR,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,cAAc,GACf,EAAE;IACD,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACnC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,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AC,YAAY,GAAG,IAAI,CAmL5B;AAED,wBAAgB,SAAS,wBAMxB"}
@@ -1,10 +1,19 @@
1
1
  /**
2
- * Renewal of a host-supplied expiring user token. `ended` is true once the
3
- * token expired or was rejected and `user.refreshToken` produced no
4
- * replacement: the visitor can read the chat but not send until the host sets
5
- * a new `user.token`.
2
+ * Renewal of a host-supplied expiring user token. `sessionEnded` is true once
3
+ * the token expired or was rejected and no replacement arrived: the visitor
4
+ * can read the chat but not send until the host supplies a new token.
5
+ *
6
+ * `renewUserToken` hands the widget a replacement for the signed-in visitor on
7
+ * the host's own schedule, instead of (or as well as) answering
8
+ * `user.refreshToken`. It keeps the open session and brings an ended one back.
9
+ * A token for another visitor, an expired one, or anything that isn't a user
10
+ * token is refused with a reason and a console error; switch visitors by
11
+ * setting `user.token`. Rendering again with the same `user.token` keeps the
12
+ * token handed over here; a different one replaces it. The function stays
13
+ * stable for the life of the widget.
6
14
  */
7
15
  export declare function useTokenRenewal(): {
8
16
  sessionEnded: boolean;
17
+ renewUserToken: (token: string) => import('@opencx/widget-core').RenewUserTokenResult;
9
18
  };
10
19
  //# sourceMappingURL=useTokenRenewal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTokenRenewal.d.ts","sourceRoot":"","sources":["../../../src/hooks/useTokenRenewal.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,eAAe;;EAI9B"}
1
+ {"version":3,"file":"useTokenRenewal.d.ts","sourceRoot":"","sources":["../../../src/hooks/useTokenRenewal.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe;;;EAO9B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opencx/widget-react-headless",
3
3
  "private": false,
4
- "version": "5.14.1",
4
+ "version": "5.15.1",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "uuid": "^11.0.4",
18
18
  "zod": "^4.6.7",
19
- "@opencx/widget-core": "5.14.1"
19
+ "@opencx/widget-core": "5.15.1"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "@types/react": ">=18 <20",