@nuskin/react-search-components 1.0.0-comx-3067.7 → 1.0.0-widget-integration.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/dist/index.d.mts +90 -163
- package/dist/index.d.ts +90 -163
- package/dist/index.js +419 -1375
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +419 -1367
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
3
|
-
import { CatalogSuggestionItem, SearchService, SearchGtmContext } from '@nuskin/react-search-sdk';
|
|
4
|
-
export { CatalogSuggestionItem, DidYouMeanItem, SearchService, createSearchService } from '@nuskin/react-search-sdk';
|
|
5
|
-
import { Environment } from '@ns/ns-contentstack-lib';
|
|
6
3
|
|
|
7
4
|
declare const SEARCH_MESSAGE_SENDERS: {
|
|
8
5
|
readonly AGENT: "agent";
|
|
@@ -54,48 +51,48 @@ interface SearchPanelProps extends Omit<ComponentPropsWithoutRef<'section'>, 'ar
|
|
|
54
51
|
logoSlot?: ReactNode;
|
|
55
52
|
/** When true: content scrolls, input fixed at bottom (AI chat layout) */
|
|
56
53
|
chatMode?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* When true: the panel hosts an embedded agent. Children fill the space below the header
|
|
56
|
+
* and bring their own scrolling and input, so no input, input slot or initial prompt renders.
|
|
57
|
+
*/
|
|
58
|
+
agentMode?: boolean;
|
|
57
59
|
}
|
|
58
|
-
declare function SearchPanel({ 'aria-label': ariaLabel, children, chatMode, closeLabel, initialPrompt, inputSlot, logoSlot, messageInputProps, onClose, ...props }: Readonly<SearchPanelProps>): React.JSX.Element;
|
|
60
|
+
declare function SearchPanel({ 'aria-label': ariaLabel, agentMode, children, chatMode, closeLabel, initialPrompt, inputSlot, logoSlot, messageInputProps, onClose, ...props }: Readonly<SearchPanelProps>): React.JSX.Element;
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
salesAiAppKey?: string;
|
|
69
|
-
/** X-Sales-AI-Parent-Origin header value (from CS configurations). */
|
|
70
|
-
salesAiParentOrigin?: string;
|
|
71
|
-
}
|
|
72
|
-
/** Raw product shape returned by the AI chat SSE stream */
|
|
73
|
-
interface AIChatProduct {
|
|
62
|
+
type ProductType = 'bundle' | 'single';
|
|
63
|
+
/**
|
|
64
|
+
* A product suggestion row. Structurally the shape the search SDK's catalog mapping produces;
|
|
65
|
+
* defined here so this library stays presentational and imports nothing from the SDK.
|
|
66
|
+
*/
|
|
67
|
+
interface CatalogSuggestionItem {
|
|
68
|
+
id: string;
|
|
69
|
+
identifier: string;
|
|
74
70
|
sku: string;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
label: string;
|
|
72
|
+
value: string;
|
|
73
|
+
imageURL: string;
|
|
74
|
+
thumbnail: string;
|
|
75
|
+
productType: ProductType;
|
|
76
|
+
product_type: ProductType;
|
|
77
|
+
outOfStock: boolean;
|
|
78
|
+
productStatus: string | undefined;
|
|
79
|
+
status: string | undefined;
|
|
80
|
+
cartActionDisabled: boolean;
|
|
81
|
+
customProductType: string;
|
|
82
|
+
slug: string | null;
|
|
83
|
+
productSlug: string | null;
|
|
84
|
+
url: string | null;
|
|
85
|
+
href: string | null;
|
|
86
|
+
keywords: string;
|
|
87
|
+
ingredientTerms: string[];
|
|
88
|
+
}
|
|
89
|
+
/** A "Did You Mean?" row. Extra fields from the API are preserved via the index signature. */
|
|
90
|
+
interface DidYouMeanItem {
|
|
91
|
+
id: string;
|
|
92
|
+
value: string;
|
|
93
|
+
suggestionType: 'did-you-mean';
|
|
78
94
|
[key: string]: unknown;
|
|
79
95
|
}
|
|
80
|
-
/** Parsed result from the AI commerce chat SSE stream */
|
|
81
|
-
interface AIChatParsedResponse {
|
|
82
|
-
products: AIChatProduct[];
|
|
83
|
-
summary: string;
|
|
84
|
-
}
|
|
85
|
-
/** @deprecated Use AIChatParsedResponse */
|
|
86
|
-
type AIChatResponse = AIChatParsedResponse;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* AI Commerce Chat API client.
|
|
90
|
-
* Delegates all HTTP + SSE logic to the SDK's ChatService.
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Calls the NuSkin AI Commerce Chat API via the SDK's ChatService.
|
|
95
|
-
* Reuses the tab-scoped conversation id stored in sessionStorage.
|
|
96
|
-
*/
|
|
97
|
-
declare function callAICommerceChat(config: AIChatConfig): Promise<AIChatParsedResponse>;
|
|
98
|
-
|
|
99
96
|
interface SuggestionDisplayData {
|
|
100
97
|
imageSrc: string;
|
|
101
98
|
displayLabel: string;
|
|
@@ -126,141 +123,71 @@ interface SuggestionRowProps {
|
|
|
126
123
|
fallbackImageUrl?: string;
|
|
127
124
|
}
|
|
128
125
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
interface
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
messagesUrl?: string;
|
|
167
|
-
salesAiAppKey?: string;
|
|
168
|
-
salesAiParentOrigin?: string;
|
|
169
|
-
aiAutoTriggerDelayMs?: number;
|
|
170
|
-
productBasePath?: string;
|
|
171
|
-
}
|
|
172
|
-
interface SearchModalAIChatHeaderContent {
|
|
173
|
-
configurations?: {
|
|
174
|
-
enablepricingpvsv?: string;
|
|
175
|
-
[key: string]: unknown;
|
|
176
|
-
};
|
|
177
|
-
[key: string]: unknown;
|
|
126
|
+
/** Copy shown by the modal. Every key falls back to an English default. */
|
|
127
|
+
interface SearchModalCopy {
|
|
128
|
+
extended_search_textbox_desktop?: string;
|
|
129
|
+
extended_search_box_aria_label?: string;
|
|
130
|
+
clear_all_label?: string;
|
|
131
|
+
no_suggestions_text?: string;
|
|
132
|
+
see_more_results_text?: string;
|
|
133
|
+
did_you_mean_text?: string;
|
|
134
|
+
recent_searches_label?: string;
|
|
135
|
+
}
|
|
136
|
+
/** The search box, controlled by the host. */
|
|
137
|
+
interface SearchModalInputProps {
|
|
138
|
+
value: string;
|
|
139
|
+
onChange: (value: string) => void;
|
|
140
|
+
onSubmit: (value: string) => void;
|
|
141
|
+
}
|
|
142
|
+
/** The suggestions the host has already fetched and filtered. */
|
|
143
|
+
interface SearchModalSuggestionsProps {
|
|
144
|
+
items: ReadonlyArray<SuggestionOptionWithTracking>;
|
|
145
|
+
loading: boolean;
|
|
146
|
+
/** Show the "no suggestions" row (the host decides when a fetch came back empty). */
|
|
147
|
+
showNoResults: boolean;
|
|
148
|
+
/** The items are "did you mean" terms, so show the heading and hide "see more". */
|
|
149
|
+
showDidYouMean: boolean;
|
|
150
|
+
/** More matches exist than are shown. */
|
|
151
|
+
hasMore: boolean;
|
|
152
|
+
/** The query the suggestions belong to (passed to the "see more" link). */
|
|
153
|
+
query: string;
|
|
154
|
+
onSelect: (option: SuggestionOptionWithTracking) => void;
|
|
155
|
+
onRunAction: (option: SuggestionOptionWithTracking) => void;
|
|
156
|
+
onSeeMore: () => void;
|
|
157
|
+
}
|
|
158
|
+
/** Recent searches, shown while the search box is empty. */
|
|
159
|
+
interface SearchModalRecentSearches {
|
|
160
|
+
items: ReadonlyArray<string>;
|
|
161
|
+
onSelect: (query: string) => void;
|
|
162
|
+
onClear: () => void;
|
|
178
163
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Consumer-supplied context for the COMX-3277 AI chat GTM events.
|
|
181
|
-
*
|
|
182
|
-
* `chatId` is derived internally from the AI chat conversation id, so it is
|
|
183
|
-
* intentionally omitted here — callers only provide what the host app knows
|
|
184
|
-
* (page type, user status, user id, etc.).
|
|
185
|
-
*/
|
|
186
|
-
type SearchModalGtmContext = Omit<SearchGtmContext, 'chatId'>;
|
|
187
164
|
interface SearchModalProps {
|
|
188
165
|
isOpen: boolean;
|
|
189
166
|
onClose: () => void;
|
|
190
|
-
service: SearchService;
|
|
191
|
-
copy?: Partial<{
|
|
192
|
-
extended_search_textbox_desktop?: string;
|
|
193
|
-
extended_search_box_aria_label?: string;
|
|
194
|
-
clear_all_label?: string;
|
|
195
|
-
no_suggestions_text?: string;
|
|
196
|
-
see_more_results_text?: string;
|
|
197
|
-
did_you_mean_text?: string;
|
|
198
|
-
analyzing_label?: string;
|
|
199
|
-
pulling_label?: string;
|
|
200
|
-
routing_label?: string;
|
|
201
|
-
thinking_label?: string;
|
|
202
|
-
listening_label?: string;
|
|
203
|
-
}>;
|
|
204
167
|
logo?: React__default.ReactNode;
|
|
205
168
|
cancelLabel?: string;
|
|
206
169
|
fallbackImageUrl?: string;
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
/** Full CS singleton payload fetched by the consuming app. */
|
|
212
|
-
aiChatHeaderContent?: SearchModalAIChatHeaderContent | null;
|
|
213
|
-
/** API configuration for AI Commerce Chat. Required when enableAIChat is true. */
|
|
214
|
-
aiChatConfig?: SearchModalAIChatConfig;
|
|
170
|
+
copy?: SearchModalCopy;
|
|
171
|
+
input: SearchModalInputProps;
|
|
172
|
+
suggestions: SearchModalSuggestionsProps;
|
|
173
|
+
recentSearches?: SearchModalRecentSearches;
|
|
215
174
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* When omitted, blank-string placeholders are pushed to the dataLayer so the
|
|
219
|
-
* event schema stays stable.
|
|
175
|
+
* An embedded agent (the NUi widget). When set, the panel switches to its agent layout: the
|
|
176
|
+
* search box, suggestions and recent searches are replaced by this content.
|
|
220
177
|
*/
|
|
221
|
-
|
|
222
|
-
history?: {
|
|
223
|
-
push: (path: string) => void;
|
|
224
|
-
} | null;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
declare function SearchModal({ isOpen, onClose, service, history, copy, logo, cancelLabel, fallbackImageUrl, enableAIChat, aiChatConfig, gtmContext, showPricing, aiChatHeaderContent, }: Readonly<SearchModalProps>): React__default.ReactElement | null;
|
|
228
|
-
|
|
229
|
-
interface AIChatHeaderContentConfig {
|
|
230
|
-
/** Contentstack environment consumed by getStack, e.g. prod/test/stage */
|
|
231
|
-
environment?: Environment;
|
|
232
|
-
/** Market country code, e.g. US */
|
|
233
|
-
country: string;
|
|
234
|
-
/** Language code, e.g. en */
|
|
235
|
-
language: string;
|
|
178
|
+
agentPanel?: React__default.ReactNode;
|
|
236
179
|
}
|
|
237
|
-
interface AIChatHeaderContent {
|
|
238
|
-
[key: string]: unknown;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Fetches `ai_chat_nuskin_header` singleton content from Contentstack.
|
|
242
|
-
* Mirrors the pattern used in personal-offer-mfe for singleton lookups.
|
|
243
|
-
*/
|
|
244
|
-
declare function fetchAIChatHeaderContent(config: AIChatHeaderContentConfig): Promise<AIChatHeaderContent | null>;
|
|
245
180
|
|
|
246
|
-
interface UseAIChatHeaderContentResult {
|
|
247
|
-
content: AIChatHeaderContent | null;
|
|
248
|
-
loading: boolean;
|
|
249
|
-
error: Error | null;
|
|
250
|
-
}
|
|
251
181
|
/**
|
|
252
|
-
*
|
|
253
|
-
* when
|
|
182
|
+
* The search panel: a full-width overlay with a search box, suggestions and recent searches, or,
|
|
183
|
+
* when `agentPanel` is set, a header over an embedded agent.
|
|
184
|
+
*
|
|
185
|
+
* Presentational: it holds only UI state (highlighted row, expanded recent searches). Modal
|
|
186
|
+
* behaviour (portal, backdrop, Escape, focus trap, returning focus to the opener, scroll lock,
|
|
187
|
+
* hiding the page from assistive technology) comes from MUI's `Modal`. Fetching, routing and
|
|
188
|
+
* navigation belong to the host.
|
|
254
189
|
*/
|
|
255
|
-
declare function
|
|
256
|
-
|
|
257
|
-
declare function SearchChatResult({ result, showPricing, history, productsAriaLabel, }: Readonly<SearchChatResultProps>): React__default.JSX.Element;
|
|
258
|
-
|
|
259
|
-
interface ChatLoadingProps extends ComponentPropsWithoutRef<'div'> {
|
|
260
|
-
/** Accessible label for screen readers */
|
|
261
|
-
label?: string;
|
|
262
|
-
}
|
|
263
|
-
declare function ChatLoading({ label, ...props }: Readonly<ChatLoadingProps>): React.JSX.Element;
|
|
190
|
+
declare function SearchModal({ isOpen, onClose, logo, cancelLabel, fallbackImageUrl, copy, input, suggestions, recentSearches, agentPanel, }: Readonly<SearchModalProps>): React__default.ReactElement | null;
|
|
264
191
|
|
|
265
192
|
declare function SuggestionRow({ inputRef, isHighlighted, isSelected, onHighlightSuggestion, onRunSuggestionAction, onSelectSuggestion, registerSuggestionNode, suggestionIndex, suggestionOption, suggestionOptionId, fallbackImageUrl, }: Readonly<SuggestionRowProps>): React__default.ReactElement;
|
|
266
193
|
|
|
@@ -281,4 +208,4 @@ interface SeeMoreLinkProps {
|
|
|
281
208
|
|
|
282
209
|
declare function SeeMoreLink({ seeMoreLinkRef, seeMoreLinkFocused, inputRef, onBlurSeeMoreLink, onFocusSeeMoreLink, onSeeMoreResults, resetSeeMoreLinkFocus, restoreLastSuggestion, seeMoreResultsText, searchQuery, }: Readonly<SeeMoreLinkProps>): React__default.ReactElement;
|
|
283
210
|
|
|
284
|
-
export { type
|
|
211
|
+
export { type CatalogSuggestionItem, type DidYouMeanItem, SEARCH_MESSAGE_SENDERS, SearchMessage, SearchMessageInput, type SearchMessageInputProps, type SearchMessageProps, type SearchMessageSender, SearchModal, type SearchModalCopy, type SearchModalInputProps, type SearchModalProps, type SearchModalRecentSearches, type SearchModalSuggestionsProps, SearchPanel, type SearchPanelProps, SeeMoreLink, type SeeMoreLinkProps, type SuggestionDisplayData, type SuggestionOptionWithTracking, SuggestionRow, type SuggestionRowProps, getSuggestionDisplayData };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
3
|
-
import { CatalogSuggestionItem, SearchService, SearchGtmContext } from '@nuskin/react-search-sdk';
|
|
4
|
-
export { CatalogSuggestionItem, DidYouMeanItem, SearchService, createSearchService } from '@nuskin/react-search-sdk';
|
|
5
|
-
import { Environment } from '@ns/ns-contentstack-lib';
|
|
6
3
|
|
|
7
4
|
declare const SEARCH_MESSAGE_SENDERS: {
|
|
8
5
|
readonly AGENT: "agent";
|
|
@@ -54,48 +51,48 @@ interface SearchPanelProps extends Omit<ComponentPropsWithoutRef<'section'>, 'ar
|
|
|
54
51
|
logoSlot?: ReactNode;
|
|
55
52
|
/** When true: content scrolls, input fixed at bottom (AI chat layout) */
|
|
56
53
|
chatMode?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* When true: the panel hosts an embedded agent. Children fill the space below the header
|
|
56
|
+
* and bring their own scrolling and input, so no input, input slot or initial prompt renders.
|
|
57
|
+
*/
|
|
58
|
+
agentMode?: boolean;
|
|
57
59
|
}
|
|
58
|
-
declare function SearchPanel({ 'aria-label': ariaLabel, children, chatMode, closeLabel, initialPrompt, inputSlot, logoSlot, messageInputProps, onClose, ...props }: Readonly<SearchPanelProps>): React.JSX.Element;
|
|
60
|
+
declare function SearchPanel({ 'aria-label': ariaLabel, agentMode, children, chatMode, closeLabel, initialPrompt, inputSlot, logoSlot, messageInputProps, onClose, ...props }: Readonly<SearchPanelProps>): React.JSX.Element;
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
salesAiAppKey?: string;
|
|
69
|
-
/** X-Sales-AI-Parent-Origin header value (from CS configurations). */
|
|
70
|
-
salesAiParentOrigin?: string;
|
|
71
|
-
}
|
|
72
|
-
/** Raw product shape returned by the AI chat SSE stream */
|
|
73
|
-
interface AIChatProduct {
|
|
62
|
+
type ProductType = 'bundle' | 'single';
|
|
63
|
+
/**
|
|
64
|
+
* A product suggestion row. Structurally the shape the search SDK's catalog mapping produces;
|
|
65
|
+
* defined here so this library stays presentational and imports nothing from the SDK.
|
|
66
|
+
*/
|
|
67
|
+
interface CatalogSuggestionItem {
|
|
68
|
+
id: string;
|
|
69
|
+
identifier: string;
|
|
74
70
|
sku: string;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
label: string;
|
|
72
|
+
value: string;
|
|
73
|
+
imageURL: string;
|
|
74
|
+
thumbnail: string;
|
|
75
|
+
productType: ProductType;
|
|
76
|
+
product_type: ProductType;
|
|
77
|
+
outOfStock: boolean;
|
|
78
|
+
productStatus: string | undefined;
|
|
79
|
+
status: string | undefined;
|
|
80
|
+
cartActionDisabled: boolean;
|
|
81
|
+
customProductType: string;
|
|
82
|
+
slug: string | null;
|
|
83
|
+
productSlug: string | null;
|
|
84
|
+
url: string | null;
|
|
85
|
+
href: string | null;
|
|
86
|
+
keywords: string;
|
|
87
|
+
ingredientTerms: string[];
|
|
88
|
+
}
|
|
89
|
+
/** A "Did You Mean?" row. Extra fields from the API are preserved via the index signature. */
|
|
90
|
+
interface DidYouMeanItem {
|
|
91
|
+
id: string;
|
|
92
|
+
value: string;
|
|
93
|
+
suggestionType: 'did-you-mean';
|
|
78
94
|
[key: string]: unknown;
|
|
79
95
|
}
|
|
80
|
-
/** Parsed result from the AI commerce chat SSE stream */
|
|
81
|
-
interface AIChatParsedResponse {
|
|
82
|
-
products: AIChatProduct[];
|
|
83
|
-
summary: string;
|
|
84
|
-
}
|
|
85
|
-
/** @deprecated Use AIChatParsedResponse */
|
|
86
|
-
type AIChatResponse = AIChatParsedResponse;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* AI Commerce Chat API client.
|
|
90
|
-
* Delegates all HTTP + SSE logic to the SDK's ChatService.
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Calls the NuSkin AI Commerce Chat API via the SDK's ChatService.
|
|
95
|
-
* Reuses the tab-scoped conversation id stored in sessionStorage.
|
|
96
|
-
*/
|
|
97
|
-
declare function callAICommerceChat(config: AIChatConfig): Promise<AIChatParsedResponse>;
|
|
98
|
-
|
|
99
96
|
interface SuggestionDisplayData {
|
|
100
97
|
imageSrc: string;
|
|
101
98
|
displayLabel: string;
|
|
@@ -126,141 +123,71 @@ interface SuggestionRowProps {
|
|
|
126
123
|
fallbackImageUrl?: string;
|
|
127
124
|
}
|
|
128
125
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
interface
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
messagesUrl?: string;
|
|
167
|
-
salesAiAppKey?: string;
|
|
168
|
-
salesAiParentOrigin?: string;
|
|
169
|
-
aiAutoTriggerDelayMs?: number;
|
|
170
|
-
productBasePath?: string;
|
|
171
|
-
}
|
|
172
|
-
interface SearchModalAIChatHeaderContent {
|
|
173
|
-
configurations?: {
|
|
174
|
-
enablepricingpvsv?: string;
|
|
175
|
-
[key: string]: unknown;
|
|
176
|
-
};
|
|
177
|
-
[key: string]: unknown;
|
|
126
|
+
/** Copy shown by the modal. Every key falls back to an English default. */
|
|
127
|
+
interface SearchModalCopy {
|
|
128
|
+
extended_search_textbox_desktop?: string;
|
|
129
|
+
extended_search_box_aria_label?: string;
|
|
130
|
+
clear_all_label?: string;
|
|
131
|
+
no_suggestions_text?: string;
|
|
132
|
+
see_more_results_text?: string;
|
|
133
|
+
did_you_mean_text?: string;
|
|
134
|
+
recent_searches_label?: string;
|
|
135
|
+
}
|
|
136
|
+
/** The search box, controlled by the host. */
|
|
137
|
+
interface SearchModalInputProps {
|
|
138
|
+
value: string;
|
|
139
|
+
onChange: (value: string) => void;
|
|
140
|
+
onSubmit: (value: string) => void;
|
|
141
|
+
}
|
|
142
|
+
/** The suggestions the host has already fetched and filtered. */
|
|
143
|
+
interface SearchModalSuggestionsProps {
|
|
144
|
+
items: ReadonlyArray<SuggestionOptionWithTracking>;
|
|
145
|
+
loading: boolean;
|
|
146
|
+
/** Show the "no suggestions" row (the host decides when a fetch came back empty). */
|
|
147
|
+
showNoResults: boolean;
|
|
148
|
+
/** The items are "did you mean" terms, so show the heading and hide "see more". */
|
|
149
|
+
showDidYouMean: boolean;
|
|
150
|
+
/** More matches exist than are shown. */
|
|
151
|
+
hasMore: boolean;
|
|
152
|
+
/** The query the suggestions belong to (passed to the "see more" link). */
|
|
153
|
+
query: string;
|
|
154
|
+
onSelect: (option: SuggestionOptionWithTracking) => void;
|
|
155
|
+
onRunAction: (option: SuggestionOptionWithTracking) => void;
|
|
156
|
+
onSeeMore: () => void;
|
|
157
|
+
}
|
|
158
|
+
/** Recent searches, shown while the search box is empty. */
|
|
159
|
+
interface SearchModalRecentSearches {
|
|
160
|
+
items: ReadonlyArray<string>;
|
|
161
|
+
onSelect: (query: string) => void;
|
|
162
|
+
onClear: () => void;
|
|
178
163
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Consumer-supplied context for the COMX-3277 AI chat GTM events.
|
|
181
|
-
*
|
|
182
|
-
* `chatId` is derived internally from the AI chat conversation id, so it is
|
|
183
|
-
* intentionally omitted here — callers only provide what the host app knows
|
|
184
|
-
* (page type, user status, user id, etc.).
|
|
185
|
-
*/
|
|
186
|
-
type SearchModalGtmContext = Omit<SearchGtmContext, 'chatId'>;
|
|
187
164
|
interface SearchModalProps {
|
|
188
165
|
isOpen: boolean;
|
|
189
166
|
onClose: () => void;
|
|
190
|
-
service: SearchService;
|
|
191
|
-
copy?: Partial<{
|
|
192
|
-
extended_search_textbox_desktop?: string;
|
|
193
|
-
extended_search_box_aria_label?: string;
|
|
194
|
-
clear_all_label?: string;
|
|
195
|
-
no_suggestions_text?: string;
|
|
196
|
-
see_more_results_text?: string;
|
|
197
|
-
did_you_mean_text?: string;
|
|
198
|
-
analyzing_label?: string;
|
|
199
|
-
pulling_label?: string;
|
|
200
|
-
routing_label?: string;
|
|
201
|
-
thinking_label?: string;
|
|
202
|
-
listening_label?: string;
|
|
203
|
-
}>;
|
|
204
167
|
logo?: React__default.ReactNode;
|
|
205
168
|
cancelLabel?: string;
|
|
206
169
|
fallbackImageUrl?: string;
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
/** Full CS singleton payload fetched by the consuming app. */
|
|
212
|
-
aiChatHeaderContent?: SearchModalAIChatHeaderContent | null;
|
|
213
|
-
/** API configuration for AI Commerce Chat. Required when enableAIChat is true. */
|
|
214
|
-
aiChatConfig?: SearchModalAIChatConfig;
|
|
170
|
+
copy?: SearchModalCopy;
|
|
171
|
+
input: SearchModalInputProps;
|
|
172
|
+
suggestions: SearchModalSuggestionsProps;
|
|
173
|
+
recentSearches?: SearchModalRecentSearches;
|
|
215
174
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* When omitted, blank-string placeholders are pushed to the dataLayer so the
|
|
219
|
-
* event schema stays stable.
|
|
175
|
+
* An embedded agent (the NUi widget). When set, the panel switches to its agent layout: the
|
|
176
|
+
* search box, suggestions and recent searches are replaced by this content.
|
|
220
177
|
*/
|
|
221
|
-
|
|
222
|
-
history?: {
|
|
223
|
-
push: (path: string) => void;
|
|
224
|
-
} | null;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
declare function SearchModal({ isOpen, onClose, service, history, copy, logo, cancelLabel, fallbackImageUrl, enableAIChat, aiChatConfig, gtmContext, showPricing, aiChatHeaderContent, }: Readonly<SearchModalProps>): React__default.ReactElement | null;
|
|
228
|
-
|
|
229
|
-
interface AIChatHeaderContentConfig {
|
|
230
|
-
/** Contentstack environment consumed by getStack, e.g. prod/test/stage */
|
|
231
|
-
environment?: Environment;
|
|
232
|
-
/** Market country code, e.g. US */
|
|
233
|
-
country: string;
|
|
234
|
-
/** Language code, e.g. en */
|
|
235
|
-
language: string;
|
|
178
|
+
agentPanel?: React__default.ReactNode;
|
|
236
179
|
}
|
|
237
|
-
interface AIChatHeaderContent {
|
|
238
|
-
[key: string]: unknown;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Fetches `ai_chat_nuskin_header` singleton content from Contentstack.
|
|
242
|
-
* Mirrors the pattern used in personal-offer-mfe for singleton lookups.
|
|
243
|
-
*/
|
|
244
|
-
declare function fetchAIChatHeaderContent(config: AIChatHeaderContentConfig): Promise<AIChatHeaderContent | null>;
|
|
245
180
|
|
|
246
|
-
interface UseAIChatHeaderContentResult {
|
|
247
|
-
content: AIChatHeaderContent | null;
|
|
248
|
-
loading: boolean;
|
|
249
|
-
error: Error | null;
|
|
250
|
-
}
|
|
251
181
|
/**
|
|
252
|
-
*
|
|
253
|
-
* when
|
|
182
|
+
* The search panel: a full-width overlay with a search box, suggestions and recent searches, or,
|
|
183
|
+
* when `agentPanel` is set, a header over an embedded agent.
|
|
184
|
+
*
|
|
185
|
+
* Presentational: it holds only UI state (highlighted row, expanded recent searches). Modal
|
|
186
|
+
* behaviour (portal, backdrop, Escape, focus trap, returning focus to the opener, scroll lock,
|
|
187
|
+
* hiding the page from assistive technology) comes from MUI's `Modal`. Fetching, routing and
|
|
188
|
+
* navigation belong to the host.
|
|
254
189
|
*/
|
|
255
|
-
declare function
|
|
256
|
-
|
|
257
|
-
declare function SearchChatResult({ result, showPricing, history, productsAriaLabel, }: Readonly<SearchChatResultProps>): React__default.JSX.Element;
|
|
258
|
-
|
|
259
|
-
interface ChatLoadingProps extends ComponentPropsWithoutRef<'div'> {
|
|
260
|
-
/** Accessible label for screen readers */
|
|
261
|
-
label?: string;
|
|
262
|
-
}
|
|
263
|
-
declare function ChatLoading({ label, ...props }: Readonly<ChatLoadingProps>): React.JSX.Element;
|
|
190
|
+
declare function SearchModal({ isOpen, onClose, logo, cancelLabel, fallbackImageUrl, copy, input, suggestions, recentSearches, agentPanel, }: Readonly<SearchModalProps>): React__default.ReactElement | null;
|
|
264
191
|
|
|
265
192
|
declare function SuggestionRow({ inputRef, isHighlighted, isSelected, onHighlightSuggestion, onRunSuggestionAction, onSelectSuggestion, registerSuggestionNode, suggestionIndex, suggestionOption, suggestionOptionId, fallbackImageUrl, }: Readonly<SuggestionRowProps>): React__default.ReactElement;
|
|
266
193
|
|
|
@@ -281,4 +208,4 @@ interface SeeMoreLinkProps {
|
|
|
281
208
|
|
|
282
209
|
declare function SeeMoreLink({ seeMoreLinkRef, seeMoreLinkFocused, inputRef, onBlurSeeMoreLink, onFocusSeeMoreLink, onSeeMoreResults, resetSeeMoreLinkFocus, restoreLastSuggestion, seeMoreResultsText, searchQuery, }: Readonly<SeeMoreLinkProps>): React__default.ReactElement;
|
|
283
210
|
|
|
284
|
-
export { type
|
|
211
|
+
export { type CatalogSuggestionItem, type DidYouMeanItem, SEARCH_MESSAGE_SENDERS, SearchMessage, SearchMessageInput, type SearchMessageInputProps, type SearchMessageProps, type SearchMessageSender, SearchModal, type SearchModalCopy, type SearchModalInputProps, type SearchModalProps, type SearchModalRecentSearches, type SearchModalSuggestionsProps, SearchPanel, type SearchPanelProps, SeeMoreLink, type SeeMoreLinkProps, type SuggestionDisplayData, type SuggestionOptionWithTracking, SuggestionRow, type SuggestionRowProps, getSuggestionDisplayData };
|