@burdenoff/website-sdk 2026.1024.1 → 2026.1027.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.
- package/README.md +77 -1
- package/dist/components/explore-cta.d.mts +10 -1
- package/dist/components/explore-cta.d.ts +10 -1
- package/dist/components/explore-cta.js +82 -74
- package/dist/components/explore-cta.js.map +1 -1
- package/dist/components/explore-cta.mjs +83 -75
- package/dist/components/explore-cta.mjs.map +1 -1
- package/dist/components/explore.d.mts +2 -2
- package/dist/components/explore.d.ts +2 -2
- package/dist/components/explore.js +876 -510
- package/dist/components/explore.js.map +1 -1
- package/dist/components/explore.mjs +877 -511
- package/dist/components/explore.mjs.map +1 -1
- package/dist/{explore-POqE7J8r.d.mts → explore-BEgq1_0O.d.mts} +65 -3
- package/dist/{explore-D6kon7uz.d.ts → explore-CHiP9u-4.d.ts} +65 -3
- package/dist/{explore-types-BB8HNFzX.d.mts → explore-types-_9UJu6EA.d.mts} +1 -1
- package/dist/{explore-types-BB8HNFzX.d.ts → explore-types-_9UJu6EA.d.ts} +1 -1
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +15 -9
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +15 -9
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +177 -6
- package/dist/index.d.ts +177 -6
- package/dist/index.js +1236 -152
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1236 -155
- package/dist/index.mjs.map +1 -1
- package/dist/{use-progressive-reveal-Kr6DwGXG.d.mts → use-progressive-reveal-BFPWbEXy.d.mts} +25 -2
- package/dist/{use-progressive-reveal-BVJn9NIr.d.ts → use-progressive-reveal-C0hkdu_i.d.ts} +25 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { E as ExploreProduct, a as ExploreReference } from './explore-types-
|
|
2
|
+
import { E as ExploreProduct, a as ExploreReference } from './explore-types-_9UJu6EA.mjs';
|
|
3
3
|
import { Components } from 'react-markdown';
|
|
4
4
|
|
|
5
5
|
/** The words the player needs. `AnswerRendererStrings`, and so `ExploreStrings`, carry them. */
|
|
@@ -176,6 +176,9 @@ interface ExploreAnswerBodyProps {
|
|
|
176
176
|
*/
|
|
177
177
|
declare function ExploreAnswerBody({ children, strings, imageOrigins, videoOrigins, productSlugs, enabled, components, className, }: ExploreAnswerBodyProps): react.JSX.Element;
|
|
178
178
|
|
|
179
|
+
/** Whose assistant this is: the portfolio's (the default, on every site), or one product's own. */
|
|
180
|
+
type ExploreScope = "portfolio" | "product";
|
|
181
|
+
|
|
179
182
|
interface ExplorePageProps {
|
|
180
183
|
/**
|
|
181
184
|
* SEO metadata. Every field is optional and each one falls back to a default
|
|
@@ -200,6 +203,12 @@ interface ExplorePageProps {
|
|
|
200
203
|
/**
|
|
201
204
|
* Example prompts shown when `exploreCatalog` supplies none. Resolution
|
|
202
205
|
* order: catalog → this prop → the SDK's built-in list.
|
|
206
|
+
*
|
|
207
|
+
* BOFF-9796: with `scope="product"` these are the ONLY prompts shown (each once, blanks dropped), whatever the
|
|
208
|
+
* catalog has, under an `ExploreChatProvider` too. Only when none are passed does the view fall back to the
|
|
209
|
+
* catalog's, less any that name another product and the SDK's "Which of your products fits a problem like mine?".
|
|
210
|
+
* A product-scoped site should pass its own: the catalog's are written for every site at once, and even those that
|
|
211
|
+
* name no product describe other sites' problems.
|
|
203
212
|
*/
|
|
204
213
|
examplePrompts?: string[];
|
|
205
214
|
/** Extra classes for the page root. */
|
|
@@ -237,6 +246,55 @@ interface ExplorePageProps {
|
|
|
237
246
|
* falls back to English.
|
|
238
247
|
*/
|
|
239
248
|
locale?: string;
|
|
249
|
+
/**
|
|
250
|
+
* BOFF-9697. `page` (default) is the dedicated `/explore` route, exactly as before: it owns the document head
|
|
251
|
+
* (PageHead), the `<h1>`, the baked catalog and, in `viewport` mode, the page's scrolling. `panel` is the same
|
|
252
|
+
* conversation inside the site-wide assistant panel (`ExplorePanel`): it is a guest on whatever page is showing,
|
|
253
|
+
* so it writes nothing to the head, uses an `<h2>`, bakes nothing, fills its container and leaves the page's
|
|
254
|
+
* scrolling alone. Share links point at `/explore` (`explorePath`), not at the page the panel is on.
|
|
255
|
+
*/
|
|
256
|
+
presentation?: "page" | "panel";
|
|
257
|
+
/**
|
|
258
|
+
* BOFF-9697. Whether the view is showing (default `true`). The panel passes `false` while it is closed or on its
|
|
259
|
+
* Avatar tab: dictation and read-aloud stop then, and the conversation itself is untouched.
|
|
260
|
+
*/
|
|
261
|
+
active?: boolean;
|
|
262
|
+
/** BOFF-9697. The site's Explore route, for share links made from the panel. Default `/explore`. */
|
|
263
|
+
explorePath?: string;
|
|
264
|
+
/**
|
|
265
|
+
* BOFF-9796. Whose assistant this is. `portfolio` (default) is the assistant every site has had, unchanged: every
|
|
266
|
+
* product in a "Focus on a product" picker, every product's concept illustrations, the catalog's welcome copy.
|
|
267
|
+
*
|
|
268
|
+
* `product` makes it ONE product's own, for a product site that wants no other product in it. It needs
|
|
269
|
+
* `productSlug` (without one it stays `portfolio`, and a development build warns once). Then:
|
|
270
|
+
*
|
|
271
|
+
* - the focus is pinned to `productSlug`: there is no product picker, and every new question is asked about this
|
|
272
|
+
* product (`productSlug` on the request, as always), also in a conversation stored or shared with another focus;
|
|
273
|
+
* - only this product's concept illustrations show, and no strip at all when it has none;
|
|
274
|
+
* - the example prompts are `examplePrompts` alone; only without any, the catalog's, less any that name another
|
|
275
|
+
* product and the SDK's built-in "Which of your products fits a problem like mine?";
|
|
276
|
+
* - the welcome body, unless `welcomeBody` is passed, invites a problem or a question about this product, never
|
|
277
|
+
* the catalog's invitation to compare it with other products; a catalog title naming another product is
|
|
278
|
+
* replaced by the built-in one;
|
|
279
|
+
* - the welcome has no capability tile that invites other products ("Compare across the ecosystem");
|
|
280
|
+
* - the composer's placeholder, a shorter "Ask about {product}…", and the conversation's header name this product.
|
|
281
|
+
* The composer itself is the published one, unchanged (its classes, and its fit to the draft alone), so on a phone
|
|
282
|
+
* its field stays one line tall: the English placeholder fits that line at 320px and wider, and a longer
|
|
283
|
+
* locale's (Spanish, Tamil) may still wrap at 320px and narrower and lose its second line;
|
|
284
|
+
* - the page head's description promises this product's answers alone, never "and every other product we build";
|
|
285
|
+
* - a question that needs more searches than a turn allows (`TOOL_BUDGET`) is asked to be narrowed to one part of
|
|
286
|
+
* it, not to "two or three specific products".
|
|
287
|
+
*
|
|
288
|
+
* Answers come from the backend and are shown as they come: an answer, and the sources under it, can still name
|
|
289
|
+
* another product when the visitor asks about one.
|
|
290
|
+
*/
|
|
291
|
+
scope?: ExploreScope;
|
|
292
|
+
/**
|
|
293
|
+
* BOFF-9796. The product's display name in the `product` scope ("Healthy Bowl"): the welcome body, the placeholder
|
|
294
|
+
* and, on `ExplorePanel`, the title. Default: the catalog's name for `productSlug`. Pass it to show the name the way
|
|
295
|
+
* the site writes it, before the catalog has loaded too. Unused in the `portfolio` scope.
|
|
296
|
+
*/
|
|
297
|
+
productName?: string;
|
|
240
298
|
}
|
|
241
299
|
/**
|
|
242
300
|
* The product's own logo, derived from the reference's origin.
|
|
@@ -304,6 +362,10 @@ declare const EXPLORE_PREFILL_MAX_LENGTH = 500;
|
|
|
304
362
|
* `base` is the explore page's path or absolute URL.
|
|
305
363
|
*/
|
|
306
364
|
declare function exploreQuestionHref(question: string, base?: string): string;
|
|
307
|
-
|
|
365
|
+
/**
|
|
366
|
+
* The Explore page. Under an `ExploreChatProvider` it shows the provider's conversation (one for the whole site, shared
|
|
367
|
+
* with `ExplorePanel`); otherwise it sets up its own, exactly as it always has (BOFF-9697).
|
|
368
|
+
*/
|
|
369
|
+
declare function ExplorePage(props: ExplorePageProps): react.JSX.Element;
|
|
308
370
|
|
|
309
|
-
export { type AnswerRendererStrings as A,
|
|
371
|
+
export { type AnswerRendererStrings as A, type ExploreScope as E, EXPLORE_PREFILL_MAX_LENGTH as a, ExploreAnswerBody as b, type ExploreAnswerBodyProps as c, ExploreAnswerStyles as d, ExplorePage as e, type ExplorePageProps as f, answerPlainText as g, answerSpeechText as h, exploreQuestionHref as i, inlineImageOrigins as j, isInlineImageAllowed as k, isInlineVideoAllowed as l, type ExploreProvenance as m, type ExploreReferenceKind as n, logoUrlOf as o, productSlugsByOrigin as p, productNamesByOrigin as q, referenceKindOf as r, summariseReferences as s };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { E as ExploreProduct, a as ExploreReference } from './explore-types-
|
|
2
|
+
import { E as ExploreProduct, a as ExploreReference } from './explore-types-_9UJu6EA.js';
|
|
3
3
|
import { Components } from 'react-markdown';
|
|
4
4
|
|
|
5
5
|
/** The words the player needs. `AnswerRendererStrings`, and so `ExploreStrings`, carry them. */
|
|
@@ -176,6 +176,9 @@ interface ExploreAnswerBodyProps {
|
|
|
176
176
|
*/
|
|
177
177
|
declare function ExploreAnswerBody({ children, strings, imageOrigins, videoOrigins, productSlugs, enabled, components, className, }: ExploreAnswerBodyProps): react.JSX.Element;
|
|
178
178
|
|
|
179
|
+
/** Whose assistant this is: the portfolio's (the default, on every site), or one product's own. */
|
|
180
|
+
type ExploreScope = "portfolio" | "product";
|
|
181
|
+
|
|
179
182
|
interface ExplorePageProps {
|
|
180
183
|
/**
|
|
181
184
|
* SEO metadata. Every field is optional and each one falls back to a default
|
|
@@ -200,6 +203,12 @@ interface ExplorePageProps {
|
|
|
200
203
|
/**
|
|
201
204
|
* Example prompts shown when `exploreCatalog` supplies none. Resolution
|
|
202
205
|
* order: catalog → this prop → the SDK's built-in list.
|
|
206
|
+
*
|
|
207
|
+
* BOFF-9796: with `scope="product"` these are the ONLY prompts shown (each once, blanks dropped), whatever the
|
|
208
|
+
* catalog has, under an `ExploreChatProvider` too. Only when none are passed does the view fall back to the
|
|
209
|
+
* catalog's, less any that name another product and the SDK's "Which of your products fits a problem like mine?".
|
|
210
|
+
* A product-scoped site should pass its own: the catalog's are written for every site at once, and even those that
|
|
211
|
+
* name no product describe other sites' problems.
|
|
203
212
|
*/
|
|
204
213
|
examplePrompts?: string[];
|
|
205
214
|
/** Extra classes for the page root. */
|
|
@@ -237,6 +246,55 @@ interface ExplorePageProps {
|
|
|
237
246
|
* falls back to English.
|
|
238
247
|
*/
|
|
239
248
|
locale?: string;
|
|
249
|
+
/**
|
|
250
|
+
* BOFF-9697. `page` (default) is the dedicated `/explore` route, exactly as before: it owns the document head
|
|
251
|
+
* (PageHead), the `<h1>`, the baked catalog and, in `viewport` mode, the page's scrolling. `panel` is the same
|
|
252
|
+
* conversation inside the site-wide assistant panel (`ExplorePanel`): it is a guest on whatever page is showing,
|
|
253
|
+
* so it writes nothing to the head, uses an `<h2>`, bakes nothing, fills its container and leaves the page's
|
|
254
|
+
* scrolling alone. Share links point at `/explore` (`explorePath`), not at the page the panel is on.
|
|
255
|
+
*/
|
|
256
|
+
presentation?: "page" | "panel";
|
|
257
|
+
/**
|
|
258
|
+
* BOFF-9697. Whether the view is showing (default `true`). The panel passes `false` while it is closed or on its
|
|
259
|
+
* Avatar tab: dictation and read-aloud stop then, and the conversation itself is untouched.
|
|
260
|
+
*/
|
|
261
|
+
active?: boolean;
|
|
262
|
+
/** BOFF-9697. The site's Explore route, for share links made from the panel. Default `/explore`. */
|
|
263
|
+
explorePath?: string;
|
|
264
|
+
/**
|
|
265
|
+
* BOFF-9796. Whose assistant this is. `portfolio` (default) is the assistant every site has had, unchanged: every
|
|
266
|
+
* product in a "Focus on a product" picker, every product's concept illustrations, the catalog's welcome copy.
|
|
267
|
+
*
|
|
268
|
+
* `product` makes it ONE product's own, for a product site that wants no other product in it. It needs
|
|
269
|
+
* `productSlug` (without one it stays `portfolio`, and a development build warns once). Then:
|
|
270
|
+
*
|
|
271
|
+
* - the focus is pinned to `productSlug`: there is no product picker, and every new question is asked about this
|
|
272
|
+
* product (`productSlug` on the request, as always), also in a conversation stored or shared with another focus;
|
|
273
|
+
* - only this product's concept illustrations show, and no strip at all when it has none;
|
|
274
|
+
* - the example prompts are `examplePrompts` alone; only without any, the catalog's, less any that name another
|
|
275
|
+
* product and the SDK's built-in "Which of your products fits a problem like mine?";
|
|
276
|
+
* - the welcome body, unless `welcomeBody` is passed, invites a problem or a question about this product, never
|
|
277
|
+
* the catalog's invitation to compare it with other products; a catalog title naming another product is
|
|
278
|
+
* replaced by the built-in one;
|
|
279
|
+
* - the welcome has no capability tile that invites other products ("Compare across the ecosystem");
|
|
280
|
+
* - the composer's placeholder, a shorter "Ask about {product}…", and the conversation's header name this product.
|
|
281
|
+
* The composer itself is the published one, unchanged (its classes, and its fit to the draft alone), so on a phone
|
|
282
|
+
* its field stays one line tall: the English placeholder fits that line at 320px and wider, and a longer
|
|
283
|
+
* locale's (Spanish, Tamil) may still wrap at 320px and narrower and lose its second line;
|
|
284
|
+
* - the page head's description promises this product's answers alone, never "and every other product we build";
|
|
285
|
+
* - a question that needs more searches than a turn allows (`TOOL_BUDGET`) is asked to be narrowed to one part of
|
|
286
|
+
* it, not to "two or three specific products".
|
|
287
|
+
*
|
|
288
|
+
* Answers come from the backend and are shown as they come: an answer, and the sources under it, can still name
|
|
289
|
+
* another product when the visitor asks about one.
|
|
290
|
+
*/
|
|
291
|
+
scope?: ExploreScope;
|
|
292
|
+
/**
|
|
293
|
+
* BOFF-9796. The product's display name in the `product` scope ("Healthy Bowl"): the welcome body, the placeholder
|
|
294
|
+
* and, on `ExplorePanel`, the title. Default: the catalog's name for `productSlug`. Pass it to show the name the way
|
|
295
|
+
* the site writes it, before the catalog has loaded too. Unused in the `portfolio` scope.
|
|
296
|
+
*/
|
|
297
|
+
productName?: string;
|
|
240
298
|
}
|
|
241
299
|
/**
|
|
242
300
|
* The product's own logo, derived from the reference's origin.
|
|
@@ -304,6 +362,10 @@ declare const EXPLORE_PREFILL_MAX_LENGTH = 500;
|
|
|
304
362
|
* `base` is the explore page's path or absolute URL.
|
|
305
363
|
*/
|
|
306
364
|
declare function exploreQuestionHref(question: string, base?: string): string;
|
|
307
|
-
|
|
365
|
+
/**
|
|
366
|
+
* The Explore page. Under an `ExploreChatProvider` it shows the provider's conversation (one for the whole site, shared
|
|
367
|
+
* with `ExplorePanel`); otherwise it sets up its own, exactly as it always has (BOFF-9697).
|
|
368
|
+
*/
|
|
369
|
+
declare function ExplorePage(props: ExplorePageProps): react.JSX.Element;
|
|
308
370
|
|
|
309
|
-
export { type AnswerRendererStrings as A,
|
|
371
|
+
export { type AnswerRendererStrings as A, type ExploreScope as E, EXPLORE_PREFILL_MAX_LENGTH as a, ExploreAnswerBody as b, type ExploreAnswerBodyProps as c, ExploreAnswerStyles as d, ExplorePage as e, type ExplorePageProps as f, answerPlainText as g, answerSpeechText as h, exploreQuestionHref as i, inlineImageOrigins as j, isInlineImageAllowed as k, isInlineVideoAllowed as l, type ExploreProvenance as m, type ExploreReferenceKind as n, logoUrlOf as o, productSlugsByOrigin as p, productNamesByOrigin as q, referenceKindOf as r, summariseReferences as s };
|
|
@@ -350,4 +350,4 @@ declare const EXPLORE_ESCALATION_NOTE_SOFT_MAX = 2000;
|
|
|
350
350
|
*/
|
|
351
351
|
declare function looksLikeDeliverableEmail(value: string): boolean;
|
|
352
352
|
|
|
353
|
-
export { looksLikeDeliverableEmail as A, type ExploreProduct as E, SEND_EXPLORE_MESSAGE_MUTATION as S, type ExploreReference as a, type
|
|
353
|
+
export { looksLikeDeliverableEmail as A, type ExploreProduct as E, SEND_EXPLORE_MESSAGE_MUTATION as S, type ExploreReference as a, type ExploreCatalog as b, type ExploreMessage as c, type ExploreFeedbackRating as d, type ExploreFeedbackReason as e, type ExploreLimits as f, ESCALATE_EXPLORE_CONVERSATION_MUTATION as g, EXPLORE_CATALOG_QUERY as h, EXPLORE_CATALOG_QUERY_WITHOUT_HIGHLIGHTS as i, EXPLORE_ESCALATION_NOTE_SOFT_MAX as j, EXPLORE_MESSAGE_QUERY as k, type EscalateExploreConversationInput as l, type EscalateExploreConversationResult as m, type ExploreCatalogQueryData as n, type ExploreConceptHighlight as o, type ExploreConversation as p, type ExploreCtaKind as q, type ExploreCtaLink as r, type ExploreErrorCode as s, type ExploreEscalation as t, type ExploreMessageQueryData as u, type ExploreMessageRole as v, type ExploreMessageStatus as w, type SendExploreMessageInput as x, type SendExploreMessageMutationData as y, type SendExploreMessageResult as z };
|
|
@@ -350,4 +350,4 @@ declare const EXPLORE_ESCALATION_NOTE_SOFT_MAX = 2000;
|
|
|
350
350
|
*/
|
|
351
351
|
declare function looksLikeDeliverableEmail(value: string): boolean;
|
|
352
352
|
|
|
353
|
-
export { looksLikeDeliverableEmail as A, type ExploreProduct as E, SEND_EXPLORE_MESSAGE_MUTATION as S, type ExploreReference as a, type
|
|
353
|
+
export { looksLikeDeliverableEmail as A, type ExploreProduct as E, SEND_EXPLORE_MESSAGE_MUTATION as S, type ExploreReference as a, type ExploreCatalog as b, type ExploreMessage as c, type ExploreFeedbackRating as d, type ExploreFeedbackReason as e, type ExploreLimits as f, ESCALATE_EXPLORE_CONVERSATION_MUTATION as g, EXPLORE_CATALOG_QUERY as h, EXPLORE_CATALOG_QUERY_WITHOUT_HIGHLIGHTS as i, EXPLORE_ESCALATION_NOTE_SOFT_MAX as j, EXPLORE_MESSAGE_QUERY as k, type EscalateExploreConversationInput as l, type EscalateExploreConversationResult as m, type ExploreCatalogQueryData as n, type ExploreConceptHighlight as o, type ExploreConversation as p, type ExploreCtaKind as q, type ExploreCtaLink as r, type ExploreErrorCode as s, type ExploreEscalation as t, type ExploreMessageQueryData as u, type ExploreMessageRole as v, type ExploreMessageStatus as w, type SendExploreMessageInput as x, type SendExploreMessageMutationData as y, type SendExploreMessageResult as z };
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { D as DEFAULT_EXPLORE_EXAMPLE_PROMPTS, E as ExploreChatError, a as ExploreChatErrorKind, b as ExploreChatPhase, c as ExploreEscalateOutcome, d as ExploreEscalateResult, F as FALLBACK_EXPLORE_LIMITS, U as UseExploreChatOptions, e as UseExploreChatResult, f as UseSpeechOutputOptions, g as UseSpeechOutputResult, h as classifyExploreError, s as stopSpeaking, u as useExploreChat, i as useProgressiveReveal, j as useSpeechOutput } from '../use-progressive-reveal-
|
|
2
|
-
import '../explore-types-
|
|
1
|
+
export { D as DEFAULT_EXPLORE_EXAMPLE_PROMPTS, E as ExploreChatError, a as ExploreChatErrorKind, b as ExploreChatPhase, c as ExploreEscalateOutcome, d as ExploreEscalateResult, F as FALLBACK_EXPLORE_LIMITS, U as UseExploreChatOptions, e as UseExploreChatResult, f as UseSpeechOutputOptions, g as UseSpeechOutputResult, h as classifyExploreError, s as stopSpeaking, u as useExploreChat, i as useProgressiveReveal, j as useSpeechOutput } from '../use-progressive-reveal-BFPWbEXy.mjs';
|
|
2
|
+
import '../explore-types-_9UJu6EA.mjs';
|
|
3
3
|
|
|
4
4
|
interface UseSpeechInputOptions {
|
|
5
5
|
/** Receives settled text as it is recognised. Append it to the draft. */
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { D as DEFAULT_EXPLORE_EXAMPLE_PROMPTS, E as ExploreChatError, a as ExploreChatErrorKind, b as ExploreChatPhase, c as ExploreEscalateOutcome, d as ExploreEscalateResult, F as FALLBACK_EXPLORE_LIMITS, U as UseExploreChatOptions, e as UseExploreChatResult, f as UseSpeechOutputOptions, g as UseSpeechOutputResult, h as classifyExploreError, s as stopSpeaking, u as useExploreChat, i as useProgressiveReveal, j as useSpeechOutput } from '../use-progressive-reveal-
|
|
2
|
-
import '../explore-types-
|
|
1
|
+
export { D as DEFAULT_EXPLORE_EXAMPLE_PROMPTS, E as ExploreChatError, a as ExploreChatErrorKind, b as ExploreChatPhase, c as ExploreEscalateOutcome, d as ExploreEscalateResult, F as FALLBACK_EXPLORE_LIMITS, U as UseExploreChatOptions, e as UseExploreChatResult, f as UseSpeechOutputOptions, g as UseSpeechOutputResult, h as classifyExploreError, s as stopSpeaking, u as useExploreChat, i as useProgressiveReveal, j as useSpeechOutput } from '../use-progressive-reveal-C0hkdu_i.js';
|
|
2
|
+
import '../explore-types-_9UJu6EA.js';
|
|
3
3
|
|
|
4
4
|
interface UseSpeechInputOptions {
|
|
5
5
|
/** Receives settled text as it is recognised. Append it to the draft. */
|
package/dist/hooks/index.js
CHANGED
|
@@ -1019,7 +1019,9 @@ function useExploreChat(options = {}) {
|
|
|
1019
1019
|
pollTimeoutMs = DEFAULT_POLL_TIMEOUT_MS,
|
|
1020
1020
|
storageKey = DEFAULT_STORAGE_KEY,
|
|
1021
1021
|
persist = true,
|
|
1022
|
-
onSend
|
|
1022
|
+
onSend,
|
|
1023
|
+
enabled = true,
|
|
1024
|
+
shareToken: shareTokenOption
|
|
1023
1025
|
} = options;
|
|
1024
1026
|
const client = useWebSDK();
|
|
1025
1027
|
const { productId } = useWebSDKConfig();
|
|
@@ -1057,7 +1059,7 @@ function useExploreChat(options = {}) {
|
|
|
1057
1059
|
const [hasConversation, setHasConversation] = react.useState(false);
|
|
1058
1060
|
const shareTokenRef = react.useRef(void 0);
|
|
1059
1061
|
if (shareTokenRef.current === void 0) {
|
|
1060
|
-
shareTokenRef.current = readShareToken();
|
|
1062
|
+
shareTokenRef.current = shareTokenOption === void 0 ? readShareToken() : shareTokenOption;
|
|
1061
1063
|
}
|
|
1062
1064
|
const isSharedView = shareTokenRef.current !== null;
|
|
1063
1065
|
const catalogRef = react.useRef(catalog);
|
|
@@ -1095,6 +1097,7 @@ function useExploreChat(options = {}) {
|
|
|
1095
1097
|
};
|
|
1096
1098
|
}, []);
|
|
1097
1099
|
react.useEffect(() => {
|
|
1100
|
+
if (!enabled) return;
|
|
1098
1101
|
const shareToken = shareTokenRef.current;
|
|
1099
1102
|
if (!shareToken) return;
|
|
1100
1103
|
let cancelled = false;
|
|
@@ -1129,8 +1132,9 @@ function useExploreChat(options = {}) {
|
|
|
1129
1132
|
return () => {
|
|
1130
1133
|
cancelled = true;
|
|
1131
1134
|
};
|
|
1132
|
-
}, [client]);
|
|
1135
|
+
}, [client, enabled]);
|
|
1133
1136
|
react.useEffect(() => {
|
|
1137
|
+
if (!enabled) return;
|
|
1134
1138
|
if (shareTokenRef.current !== null) return;
|
|
1135
1139
|
if (!persist) {
|
|
1136
1140
|
setHydrated(true);
|
|
@@ -1155,9 +1159,10 @@ function useExploreChat(options = {}) {
|
|
|
1155
1159
|
setTurnCount(turns);
|
|
1156
1160
|
}
|
|
1157
1161
|
setHydrated(true);
|
|
1158
|
-
}, [persist, rememberConversationToken, storageKey]);
|
|
1162
|
+
}, [persist, rememberConversationToken, storageKey, enabled]);
|
|
1159
1163
|
react.useEffect(() => {
|
|
1160
|
-
if (!persist || !hydrated || typeof window === "undefined")
|
|
1164
|
+
if (!persist || !hydrated || isSharedView || typeof window === "undefined")
|
|
1165
|
+
return;
|
|
1161
1166
|
try {
|
|
1162
1167
|
const payload = {
|
|
1163
1168
|
conversationToken: conversationTokenRef.current,
|
|
@@ -1171,10 +1176,10 @@ function useExploreChat(options = {}) {
|
|
|
1171
1176
|
window.localStorage.setItem(storageKey, JSON.stringify(payload));
|
|
1172
1177
|
} catch {
|
|
1173
1178
|
}
|
|
1174
|
-
}, [persist, hydrated, storageKey, messages, focusProduct]);
|
|
1179
|
+
}, [persist, hydrated, isSharedView, storageKey, messages, focusProduct]);
|
|
1175
1180
|
react.useEffect(() => {
|
|
1176
1181
|
messagesRef.current = messages;
|
|
1177
|
-
if (!persist || !hydrated) return;
|
|
1182
|
+
if (!persist || !hydrated || isSharedView) return;
|
|
1178
1183
|
const settled = messages.some(
|
|
1179
1184
|
(m) => m.role === "ASSISTANT" && (m.status === "COMPLETED" || m.status === "FAILED")
|
|
1180
1185
|
);
|
|
@@ -1186,8 +1191,9 @@ function useExploreChat(options = {}) {
|
|
|
1186
1191
|
focusProduct: focusProductRef.current
|
|
1187
1192
|
})
|
|
1188
1193
|
);
|
|
1189
|
-
}, [messages, persist, hydrated, storageKey]);
|
|
1194
|
+
}, [messages, persist, hydrated, isSharedView, storageKey]);
|
|
1190
1195
|
react.useEffect(() => {
|
|
1196
|
+
if (!enabled) return;
|
|
1191
1197
|
let cancelled = false;
|
|
1192
1198
|
const load = async () => {
|
|
1193
1199
|
const variables = { productSlug: productSlug ?? null };
|
|
@@ -1228,7 +1234,7 @@ function useExploreChat(options = {}) {
|
|
|
1228
1234
|
return () => {
|
|
1229
1235
|
cancelled = true;
|
|
1230
1236
|
};
|
|
1231
|
-
}, [client, productSlug, fallbackCatalog, bakedRaw]);
|
|
1237
|
+
}, [client, productSlug, fallbackCatalog, bakedRaw, enabled]);
|
|
1232
1238
|
const startPolling = react.useCallback(
|
|
1233
1239
|
(conversationToken, messageId) => {
|
|
1234
1240
|
pollGenerationRef.current += 1;
|