@cimulate/copilot-widget 1.22.0 → 1.23.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.
@@ -101,6 +101,28 @@ declare interface CommonParams {
101
101
  pricebooks?: string[] | null;
102
102
  }
103
103
 
104
+ /**
105
+ * One flat map from override key to custom-element tag name.
106
+ *
107
+ * `ProductTile` and `ProductCarousel` are the only keys the widget consults for
108
+ * its built-in product UI: register one and the widget mounts your element in
109
+ * place of the default tile/carousel (leave it unset and the built-in renders).
110
+ * Every other key is matched against a `type:"tool_results"` block's top-level
111
+ * `output_name` (never a field inside the arbitrary `data` payload); an unmatched
112
+ * block renders nothing. All of them receive the same `OverrideProps`.
113
+ *
114
+ * { ProductTile: "cx-product-card", recentOrders: "cx-recent-orders" }
115
+ *
116
+ * Widget chrome (header, search bar, follow-up suggestions) is intentionally NOT
117
+ * overridable: those keys are accepted by the open index signature but have no
118
+ * render path, so they are silently ignored.
119
+ */
120
+ declare interface ComponentOverrides {
121
+ ProductTile?: OverrideTagName;
122
+ ProductCarousel?: OverrideTagName;
123
+ [key: string]: OverrideTagName | undefined;
124
+ }
125
+
104
126
  declare type ComponentType = "chat" | "dialog" | "modal";
105
127
 
106
128
  declare namespace copilot {
@@ -220,6 +242,9 @@ declare interface CopilotWidgetProps extends CimCopilotSdkConfig {
220
242
  * Configuration for messaging mode. Required when mode is 'messaging'.
221
243
  */
222
244
  messagingConfig?: MessagingModeConfig;
245
+ overrides?: ComponentOverrides;
246
+ overridesUrl?: string;
247
+ inlineOverrides?: ComponentOverrides;
223
248
  /**
224
249
  *
225
250
  * Enables features not yet released. They may require additional backend support and are subject to change.
@@ -347,12 +372,25 @@ declare interface MessagingModeConfig {
347
372
  /**
348
373
  * Shows a "Connect to a human agent" button in the messaging search bar that
349
374
  * asks the Agentforce agent to escalate the conversation to a human. Defaults
350
- * to true; set to false to hide it. Requires the org's Agentforce agent to be
375
+ * to false; set to true to show it. Requires the org's Agentforce agent to be
351
376
  * configured with an escalation path/topic, otherwise the button is a no-op.
352
377
  */
353
378
  enableEscalationToAgent?: boolean;
354
379
  }
355
380
 
381
+ /**
382
+ * A component override is the tag name of a pre-registered custom element
383
+ * (e.g. "product-card"). The widget creates the element via
384
+ * document.createElement(tagName) and assigns `OverrideProps` to its `props`
385
+ * setter. The element must be registered with customElements.define before the
386
+ * widget renders.
387
+ *
388
+ * The name must be a valid custom element name — it has to contain a hyphen and
389
+ * be all lowercase. Anything else (e.g. "ProductTile" or "div") is rejected with
390
+ * a console error and the slot renders blank.
391
+ */
392
+ declare type OverrideTagName = string;
393
+
356
394
  declare type PromptsDisplay = "input" | "buttons" | "both";
357
395
 
358
396
  declare type PromptsExtensionConfig = Omit<PromptsExtensionState, "isInitialized" | "activePromptsId" | "userPrompt" | "promptsMessage" | "responseMessage" | "isResponseLoading" | "placeholder" | "askElseButtonLabel" | "entryType" | "params" | "promptsDisplay" | "disableAskElseButton"> & Partial<Pick<PromptsExtensionState, "placeholder" | "askElseButtonLabel" | "entryType" | "params" | "promptsDisplay" | "disableAskElseButton">>;
@@ -6217,7 +6217,7 @@ const vk = {
6217
6217
  __features: se,
6218
6218
  routingAttributes: ce,
6219
6219
  enableDownloadTranscript: fe = !0,
6220
- enableEscalationToAgent: ne = !0,
6220
+ enableEscalationToAgent: ne = !1,
6221
6221
  children: be
6222
6222
  }) => {
6223
6223
  const ke = e === "messaging", oe = B.useMemo(() => {
@@ -33601,7 +33601,10 @@ const lB = 180, cB = (e) => {
33601
33601
  ariaLabel: d = "Product carousel",
33602
33602
  children: p
33603
33603
  }) => {
33604
- const m = Array.from(p), b = m.length, y = B.useRef(null), [_, A] = B.useState(0), { width: v } = qk();
33604
+ const m = Array.from(p).map((re, me) => ({
33605
+ node: re,
33606
+ key: B.isValidElement(re) && re.key != null ? re.key : `carousel-item-${me}`
33607
+ })), b = m.length, y = B.useRef(null), [_, A] = B.useState(0), { width: v } = qk();
33605
33608
  B.useLayoutEffect(() => {
33606
33609
  y.current && A(y.current.getBoundingClientRect().width);
33607
33610
  }, [v, b]);
@@ -33628,10 +33631,10 @@ const lB = 180, cB = (e) => {
33628
33631
  className: G(e, `${z}-carousel__item-group`, {
33629
33632
  "carousel-row-container": !Y
33630
33633
  }),
33631
- children: m.map((re, me) => /* @__PURE__ */ x.jsx(
33634
+ children: m.map(({ node: re, key: me }, V) => /* @__PURE__ */ x.jsx(
33632
33635
  ex,
33633
33636
  {
33634
- index: me,
33637
+ index: V,
33635
33638
  className: G(e, `${z}-carousel__item`),
33636
33639
  children: re
33637
33640
  },