@opencx/widget-react 5.11.0 → 5.13.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-CcE7410P.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-C7c2PcLS.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-BdjYf3YD.js";
6
+ import { H as s, W as n, s as a } from "./index-r9mdGf42.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.11.0",
4
+ "version": "5.13.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "rm -rf node_modules dist .turbo",
@@ -0,0 +1,19 @@
1
+ import { WidgetMessageU } from '@opencx/widget-core';
2
+ /** How long after the AI's latest reply sticky questions come back. */
3
+ export declare const STICKY_QUESTIONS_DELAY_MS = 5000;
4
+ /**
5
+ * The configured `stickyQuestions` to show above the composer right now, or
6
+ * an empty list. They come back {@link STICKY_QUESTIONS_DELAY_MS} after the
7
+ * AI's latest reply (system checkpoints after it don't count as a reply, and a
8
+ * failed reply's error bubble doesn't start the timer), and
9
+ * yield while a reply streams, while the visitor is typing, and while another
10
+ * row of suggestions is up.
11
+ */
12
+ export declare function useStickyQuestions({ stickyQuestions, messages, isStreaming, isTyping, otherSuggestionsShowing, }: {
13
+ stickyQuestions: string[] | undefined;
14
+ messages: WidgetMessageU[];
15
+ isStreaming: boolean;
16
+ isTyping: boolean;
17
+ otherSuggestionsShowing: boolean;
18
+ }): string[];
19
+ //# sourceMappingURL=useStickyQuestions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStickyQuestions.d.ts","sourceRoot":"","sources":["../../../src/hooks/useStickyQuestions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,uEAAuE;AACvE,eAAO,MAAM,yBAAyB,OAAQ,CAAC;AAE/C;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,eAAe,EACf,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,uBAAuB,GACxB,EAAE;IACD,eAAe,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACtC,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,uBAAuB,EAAE,OAAO,CAAC;CAClC,GAAG,MAAM,EAAE,CA6BX"}
@@ -12,12 +12,11 @@ import { MarkDraft, MarkHover } from './usePageMarking';
12
12
  * on the host document (see `usePageMarking`), and an overlay that swallowed
13
13
  * pointer events would blind them.
14
14
  */
15
- export declare function PageMarkOverlay({ isActive, draft, hover, onShapeChange, onAttach, onDiscard, }: {
15
+ export declare function PageMarkOverlay({ isActive, draft, hover, onShapeChange, onAttach, }: {
16
16
  isActive: boolean;
17
17
  draft: MarkDraft | null;
18
18
  hover: MarkHover | null;
19
19
  onShapeChange: (shape: MarkShape) => void;
20
20
  onAttach: (note: string) => void;
21
- onDiscard: () => void;
22
21
  }): React.ReactPortal | null;
23
22
  //# sourceMappingURL=PageMarkOverlay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageMarkOverlay.d.ts","sourceRoot":"","sources":["../../../src/page-marks/PageMarkOverlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAK3D,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,KAAK,EACL,KAAK,EACL,aAAa,EACb,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,aAAa,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAC1C,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,4BA+IA"}
1
+ {"version":3,"file":"PageMarkOverlay.d.ts","sourceRoot":"","sources":["../../../src/page-marks/PageMarkOverlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAK3D,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,KAAK,EACL,KAAK,EACL,aAAa,EACb,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,aAAa,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAC1C,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,4BA8IA"}
@@ -19,7 +19,7 @@ import { MarkedElement, Rect } from './page-element';
19
19
  * element — the one type that writes `position`/`z-index` onto its target
20
20
  * can only ever write them onto ours.
21
21
  */
22
- export declare const MARK_SHAPES: readonly ["box", "circle", "arrow", "bracket", "underline", "highlight", "strike-through", "crossed-off"];
22
+ export declare const MARK_SHAPES: readonly ["box", "circle", "crossed-off", "arrow", "bracket", "underline", "highlight", "strike-through"];
23
23
  export type MarkShape = (typeof MARK_SHAPES)[number];
24
24
  /**
25
25
  * Serialized as `clientContext.page_marks` on the send payload — every field
@@ -1,3 +1,4 @@
1
+ import { RefObject } from 'react';
1
2
  import { Rect } from './page-element';
2
3
  import { MarkShape, PageMark } from './page-mark';
3
4
  /** The live, editable mark — everything the overlay renders. */
@@ -24,11 +25,16 @@ export type MarkHover = {
24
25
  * All pointer listeners are capture-phase on the HOST document (the widget's
25
26
  * React code runs in the host realm), widget-owned nodes are exempt so the
26
27
  * editor card stays usable, and the complete pointer/click sequence is
27
- * swallowed so marking a button never activates it.
28
+ * swallowed so marking a button never activates it. Escape is claimed at
29
+ * WINDOW capture, the earliest point a page script can reach, on the host
30
+ * and on the composer's own window (the widget iframe), so it never also
31
+ * dismisses a host popover or the widget panel.
28
32
  */
29
- export declare function usePageMarking({ enabled, onAttach, accentColor, zIndex, }: {
33
+ export declare function usePageMarking({ enabled, composerRef, onAttach, accentColor, zIndex, }: {
30
34
  /** Whether this composer currently exposes page marking. */
31
35
  enabled: boolean;
36
+ /** The composer input; Escape is also claimed in the window it lives in. */
37
+ composerRef?: RefObject<Element | null>;
32
38
  /** Notification only — the provider owns the mark either way. */
33
39
  onAttach?: (mark: PageMark) => void;
34
40
  accentColor: string;
@@ -1 +1 @@
1
- {"version":3,"file":"usePageMarking.d.ts","sourceRoot":"","sources":["../../../src/page-marks/usePageMarking.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,IAAI,EACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,aAAa,CAAC;AAwBrB,gEAAgE;AAChE,MAAM,MAAM,SAAS,GAAG;IACtB,uEAAuE;IACvE,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAQF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,QAAQ,EACR,WAAW,EACX,MAAM,GACP,EAAE;IACD,4DAA4D;IAC5D,OAAO,EAAE,OAAO,CAAC;IACjB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;CAChB;;;;sBA8BsC,SAAS;mBAoSrC,MAAM;IAyCb,+DAA+D;;;;EAKlE"}
1
+ {"version":3,"file":"usePageMarking.d.ts","sourceRoot":"","sources":["../../../src/page-marks/usePageMarking.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAOL,KAAK,IAAI,EACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,aAAa,CAAC;AAwBrB,gEAAgE;AAChE,MAAM,MAAM,SAAS,GAAG;IACtB,uEAAuE;IACvE,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAQF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,WAAW,EACX,QAAQ,EACR,WAAW,EACX,MAAM,GACP,EAAE;IACD,4DAA4D;IAC5D,OAAO,EAAE,OAAO,CAAC;IACjB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IACxC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;CAChB;;;;sBA8BsC,SAAS;mBA2SrC,MAAM;IAyCb,+DAA+D;;;;EAKlE"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChatFooter.d.ts","sourceRoot":"","sources":["../../../../src/screens/chat/ChatFooter.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,MAAM,OAAO,CAAC;AAoE1B,wBAAgB,UAAU,sBAyDzB"}
1
+ {"version":3,"file":"ChatFooter.d.ts","sourceRoot":"","sources":["../../../../src/screens/chat/ChatFooter.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,MAAM,OAAO,CAAC;AAoE1B,wBAAgB,UAAU,sBA6FzB"}
@@ -4,7 +4,7 @@ import { default as React } from 'react';
4
4
  * Exported so companion's quick-ask state renders the exact same composer
5
5
  * (not a bespoke bar), inheriting every customization automatically.
6
6
  */
7
- export declare function ChatInput({ trailingActions, placeholder, hideAttachTools, disabled: disabledByParent, }?: {
7
+ type ChatInputProps = {
8
8
  /** Keep the composer visible while a required starter must be chosen. */
9
9
  disabled?: boolean;
10
10
  /**
@@ -25,5 +25,12 @@ export declare function ChatInput({ trailingActions, placeholder, hideAttachTool
25
25
  * the full tool row lives in the expanded chat panel.
26
26
  */
27
27
  hideAttachTools?: boolean;
28
- }): React.JSX.Element;
28
+ };
29
+ /**
30
+ * The composer, or, once a host-supplied user token expired with no
31
+ * replacement, a notice in its place: the transcript stays readable and
32
+ * nothing can be sent until the host sets a new `user.token`.
33
+ */
34
+ export declare function ChatInput(props?: ChatInputProps): React.JSX.Element;
35
+ export {};
29
36
  //# sourceMappingURL=ChatInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatInput.d.ts","sourceRoot":"","sources":["../../../../src/screens/chat/ChatInput.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAoD5E;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EACxB,eAAe,EACf,WAAW,EACX,eAAe,EACf,QAAQ,EAAE,gBAAwB,GACnC,GAAE;IACD,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CACtB,qBAyvBL"}
1
+ {"version":3,"file":"ChatInput.d.ts","sourceRoot":"","sources":["../../../../src/screens/chat/ChatInput.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAoD5E;;;;GAIG;AACH,KAAK,cAAc,GAAG;IACpB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,GAAE,cAAmB,qBAGnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"usePageMarkComposer.d.ts","sourceRoot":"","sources":["../../../../src/screens/chat/usePageMarkComposer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMpD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;CACjD;;;;;;;;;;;;;2BAcgB,IAAI,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;EAyB7C"}
1
+ {"version":3,"file":"usePageMarkComposer.d.ts","sourceRoot":"","sources":["../../../../src/screens/chat/usePageMarkComposer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMpD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;CACjD;;;;;;;;;;;;;2BAcgB,IAAI,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;EA0B7C"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opencx/widget-react",
3
3
  "private": false,
4
- "version": "5.11.0",
4
+ "version": "5.13.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.11.0",
40
- "@opencx/widget-react-headless": "5.11.0"
39
+ "@opencx/widget-core": "5.13.0",
40
+ "@opencx/widget-react-headless": "5.13.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@types/react": ">=18 <20",