@opencx/widget-react 5.14.1 → 5.15.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 CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("@radix-ui/react-popover");require("framer-motion");require("react");require("@opencx/widget-react-headless");const e=require("./index-C0iV9yZX.cjs");exports.HostedSpecRenderer=e.HostedSpecRenderer;exports.Widget=e.Widget;exports.segmentContent=e.segmentContent;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("@radix-ui/react-popover");require("framer-motion");require("react");require("@opencx/widget-react-headless");const e=require("./index-zggs8o0o.cjs");exports.HostedSpecRenderer=e.HostedSpecRenderer;exports.Widget=e.Widget;exports.segmentContent=e.segmentContent;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import "@radix-ui/react-popover";
3
3
  import "framer-motion";
4
4
  import "react";
5
5
  import "@opencx/widget-react-headless";
6
- import { H as s, W as n, s as a } from "./index-DkV3KG39.js";
6
+ import { H as s, W as n, s as a } from "./index-BDJTS5VH.js";
7
7
  export {
8
8
  s as HostedSpecRenderer,
9
9
  n as Widget,
@@ -1,7 +1,7 @@
1
1
  declare const _default: {
2
2
  "name": "@opencx/widget-react",
3
3
  "private": false,
4
- "version": "5.14.1",
4
+ "version": "5.15.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "rm -rf node_modules dist .turbo",
@@ -1,9 +1,21 @@
1
+ import { RenewUserTokenResult } from '@opencx/widget-core';
1
2
  import { default as React } from 'react';
2
3
  export type WidgetRef = {
3
4
  /** Open the widget on a fresh conversation, optionally sending its first message. */
4
5
  newChat: (options?: {
5
6
  message?: string;
6
7
  }) => Promise<void>;
8
+ /**
9
+ * Hand the widget a renewed `user.token` for the signed-in visitor, on your
10
+ * own schedule, instead of (or as well as) answering `user.refreshToken`.
11
+ * The open session is kept and an ended one comes back. A token for another
12
+ * visitor, an expired one, or anything that isn't a user token is refused
13
+ * with a reason and a console error: switch visitors through
14
+ * `options.user.token`. Rendering again with the same `options.user.token`
15
+ * keeps the token handed over here; a different one replaces it, and a
16
+ * remounted widget starts from `options.user.token` again.
17
+ */
18
+ renewUserToken: (token: string) => RenewUserTokenResult;
7
19
  };
8
20
  export declare function WidgetImperativeHandler({ widgetRef, }: {
9
21
  widgetRef: React.Ref<WidgetRef>;
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetImperativeHandler.d.ts","sourceRoot":"","sources":["../../src/WidgetImperativeHandler.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,MAAM,SAAS,GAAG;IACtB,qFAAqF;IACrF,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;CACjC,QA4BA"}
1
+ {"version":3,"file":"WidgetImperativeHandler.d.ts","sourceRoot":"","sources":["../../src/WidgetImperativeHandler.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,MAAM,SAAS,GAAG;IACtB,qFAAqF;IACrF,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D;;;;;;;;;OASG;IACH,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,oBAAoB,CAAC;CACzD,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;CACjC,QA8BA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opencx/widget-react",
3
3
  "private": false,
4
- "version": "5.14.1",
4
+ "version": "5.15.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -36,8 +36,8 @@
36
36
  "tailwind-merge": "^2.4.0",
37
37
  "tinycolor2": "^1.6.0",
38
38
  "zod": "^4.6.7",
39
- "@opencx/widget-core": "5.14.1",
40
- "@opencx/widget-react-headless": "5.14.1"
39
+ "@opencx/widget-core": "5.15.0",
40
+ "@opencx/widget-react-headless": "5.15.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@types/react": ">=18 <20",