@nuskin/react-search-components 1.0.0-comx-3067.8 → 1.0.0-widget-integration.2

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 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";
@@ -22,7 +19,6 @@ interface SearchMessageInputBaseProps extends Omit<ComponentPropsWithoutRef<'for
22
19
  onChange?: (value: string) => void;
23
20
  onSubmit: (message: string) => void;
24
21
  placeholder: string;
25
- submitLabel: string;
26
22
  /** When false, input value is preserved after submit (search mode). Defaults to true (chat mode). */
27
23
  clearOnSubmit?: boolean;
28
24
  value?: string;
@@ -41,7 +37,10 @@ type SearchMessageInputVoiceProps = {
41
37
  voiceListeningLabel?: never;
42
38
  };
43
39
  type SearchMessageInputProps = SearchMessageInputBaseProps & SearchMessageInputVoiceProps;
44
- declare function SearchMessageInput({ clearOnSubmit, inputLabel, onChange, onSubmit, onVoiceInput, placeholder, showVoiceInput, submitLabel, value, voiceInputLabel, voiceListening, voiceListeningLabel, ...props }: SearchMessageInputProps): React.JSX.Element;
40
+ /**
41
+ * The search box. There is no submit button: pressing Enter submits, as in master's search.
42
+ */
43
+ declare function SearchMessageInput({ clearOnSubmit, inputLabel, onChange, onSubmit, onVoiceInput, placeholder, showVoiceInput, value, voiceInputLabel, voiceListening, voiceListeningLabel, ...props }: SearchMessageInputProps): React.JSX.Element;
45
44
 
46
45
  interface SearchPanelProps extends Omit<ComponentPropsWithoutRef<'section'>, 'aria-label' | 'children'> {
47
46
  'aria-label': string;
@@ -54,48 +53,48 @@ interface SearchPanelProps extends Omit<ComponentPropsWithoutRef<'section'>, 'ar
54
53
  logoSlot?: ReactNode;
55
54
  /** When true: content scrolls, input fixed at bottom (AI chat layout) */
56
55
  chatMode?: boolean;
56
+ /**
57
+ * When true: the panel hosts an embedded agent. Children fill the space below the header
58
+ * and bring their own scrolling and input, so no input, input slot or initial prompt renders.
59
+ */
60
+ agentMode?: boolean;
57
61
  }
58
- declare function SearchPanel({ 'aria-label': ariaLabel, children, chatMode, closeLabel, initialPrompt, inputSlot, logoSlot, messageInputProps, onClose, ...props }: Readonly<SearchPanelProps>): React.JSX.Element;
62
+ declare function SearchPanel({ 'aria-label': ariaLabel, agentMode, children, chatMode, closeLabel, initialPrompt, inputSlot, logoSlot, messageInputProps, onClose, ...props }: Readonly<SearchPanelProps>): React.JSX.Element;
59
63
 
60
- interface AIChatConfig {
61
- /** The user's search term */
62
- searchTerm: string;
63
- /** Market code (e.g., "US", "JP") for scope_context in message requests. */
64
- market?: string;
65
- /** Language code (e.g., "en", "ja") for scope_context in message requests. */
66
- language?: string;
67
- /** X-Sales-AI-App-Key header value (from CS configurations). */
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 {
64
+ type ProductType = 'bundle' | 'single';
65
+ /**
66
+ * A product suggestion row. Structurally the shape the search SDK's catalog mapping produces;
67
+ * defined here so this library stays presentational and imports nothing from the SDK.
68
+ */
69
+ interface CatalogSuggestionItem {
70
+ id: string;
71
+ identifier: string;
74
72
  sku: string;
75
- name?: string;
76
- image_url?: string;
77
- pv?: number;
73
+ label: string;
74
+ value: string;
75
+ imageURL: string;
76
+ thumbnail: string;
77
+ productType: ProductType;
78
+ product_type: ProductType;
79
+ outOfStock: boolean;
80
+ productStatus: string | undefined;
81
+ status: string | undefined;
82
+ cartActionDisabled: boolean;
83
+ customProductType: string;
84
+ slug: string | null;
85
+ productSlug: string | null;
86
+ url: string | null;
87
+ href: string | null;
88
+ keywords: string;
89
+ ingredientTerms: string[];
90
+ }
91
+ /** A "Did You Mean?" row. Extra fields from the API are preserved via the index signature. */
92
+ interface DidYouMeanItem {
93
+ id: string;
94
+ value: string;
95
+ suggestionType: 'did-you-mean';
78
96
  [key: string]: unknown;
79
97
  }
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
98
  interface SuggestionDisplayData {
100
99
  imageSrc: string;
101
100
  displayLabel: string;
@@ -126,141 +125,71 @@ interface SuggestionRowProps {
126
125
  fallbackImageUrl?: string;
127
126
  }
128
127
 
129
- interface AISearchProduct {
130
- id: string;
131
- sku?: string;
132
- name: string;
133
- imageUrl?: string;
134
- image_url?: string;
135
- price?: string;
136
- pv?: number;
137
- retail_price?: number;
138
- description?: string;
139
- badge?: string;
140
- url?: string;
141
- routeUrl?: string;
142
- category?: string;
143
- }
144
- interface AISearchResult {
145
- userQuery: string;
146
- aiResponseText: string;
147
- products?: AISearchProduct[];
148
- }
149
- interface SearchChatResultProps {
150
- result: AISearchResult;
151
- /**
152
- * When false, pricing and PV/SV values are hidden in cards and stripped from summary.
153
- * Controlled by the CS ai_chat_nuskin_header configurations.enablepricingpvsv flag.
154
- */
155
- showPricing?: boolean;
156
- productsAriaLabel?: string;
157
- history?: {
158
- push: (path: string) => void;
159
- } | null;
160
- }
161
-
162
- interface SearchModalAIChatConfig {
163
- market: string;
164
- language: string;
165
- conversationsUrl?: string;
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;
128
+ /** Copy shown by the modal. Every key falls back to an English default. */
129
+ interface SearchModalCopy {
130
+ extended_search_textbox_desktop?: string;
131
+ extended_search_box_aria_label?: string;
132
+ clear_all_label?: string;
133
+ no_suggestions_text?: string;
134
+ see_more_results_text?: string;
135
+ did_you_mean_text?: string;
136
+ recent_searches_label?: string;
137
+ }
138
+ /** The search box, controlled by the host. */
139
+ interface SearchModalInputProps {
140
+ value: string;
141
+ onChange: (value: string) => void;
142
+ onSubmit: (value: string) => void;
143
+ }
144
+ /** The suggestions the host has already fetched and filtered. */
145
+ interface SearchModalSuggestionsProps {
146
+ items: ReadonlyArray<SuggestionOptionWithTracking>;
147
+ loading: boolean;
148
+ /** Show the "no suggestions" row (the host decides when a fetch came back empty). */
149
+ showNoResults: boolean;
150
+ /** The items are "did you mean" terms, so show the heading and hide "see more". */
151
+ showDidYouMean: boolean;
152
+ /** More matches exist than are shown. */
153
+ hasMore: boolean;
154
+ /** The query the suggestions belong to (passed to the "see more" link). */
155
+ query: string;
156
+ onSelect: (option: SuggestionOptionWithTracking) => void;
157
+ onRunAction: (option: SuggestionOptionWithTracking) => void;
158
+ onSeeMore: () => void;
159
+ }
160
+ /** Recent searches, shown while the search box is empty. */
161
+ interface SearchModalRecentSearches {
162
+ items: ReadonlyArray<string>;
163
+ onSelect: (query: string) => void;
164
+ onClear: () => void;
178
165
  }
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
166
  interface SearchModalProps {
188
167
  isOpen: boolean;
189
168
  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
169
  logo?: React__default.ReactNode;
205
170
  cancelLabel?: string;
206
171
  fallbackImageUrl?: string;
207
- /** When true, the modal triggers AI Commerce Chat after search. */
208
- enableAIChat?: boolean;
209
- /** When false, pricing/PV/SV is hidden in AI chat results. Driven by CS enablepricingpvsv flag. */
210
- showPricing?: boolean;
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;
172
+ copy?: SearchModalCopy;
173
+ input: SearchModalInputProps;
174
+ suggestions: SearchModalSuggestionsProps;
175
+ recentSearches?: SearchModalRecentSearches;
215
176
  /**
216
- * Optional host-supplied context for the AI chat GTM (dataLayer) events
217
- * defined in COMX-3277 (page type, country code, language, user status, user id).
218
- * When omitted, blank-string placeholders are pushed to the dataLayer so the
219
- * event schema stays stable.
177
+ * An embedded agent (the NUi widget). When set, the panel switches to its agent layout: the
178
+ * search box, suggestions and recent searches are replaced by this content.
220
179
  */
221
- gtmContext?: SearchModalGtmContext;
222
- history?: {
223
- push: (path: string) => void;
224
- } | null;
180
+ agentPanel?: React__default.ReactNode;
225
181
  }
226
182
 
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;
236
- }
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
-
246
- interface UseAIChatHeaderContentResult {
247
- content: AIChatHeaderContent | null;
248
- loading: boolean;
249
- error: Error | null;
250
- }
251
183
  /**
252
- * Fetches `ai_chat_nuskin_header` singleton content from Contentstack
253
- * when a valid config is supplied. Returns null content when config is absent.
184
+ * The search panel: a full-width overlay with a search box, suggestions and recent searches, or,
185
+ * when `agentPanel` is set, a header over an embedded agent.
186
+ *
187
+ * Presentational: it holds only UI state (highlighted row, expanded recent searches). Modal
188
+ * behaviour (portal, backdrop, Escape, focus trap, returning focus to the opener, scroll lock,
189
+ * hiding the page from assistive technology) comes from MUI's `Modal`. Fetching, routing and
190
+ * navigation belong to the host.
254
191
  */
255
- declare function useAIChatHeaderContent(config: AIChatHeaderContentConfig | null | undefined): UseAIChatHeaderContentResult;
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;
192
+ declare function SearchModal({ isOpen, onClose, logo, cancelLabel, fallbackImageUrl, copy, input, suggestions, recentSearches, agentPanel, }: Readonly<SearchModalProps>): React__default.ReactElement | null;
264
193
 
265
194
  declare function SuggestionRow({ inputRef, isHighlighted, isSelected, onHighlightSuggestion, onRunSuggestionAction, onSelectSuggestion, registerSuggestionNode, suggestionIndex, suggestionOption, suggestionOptionId, fallbackImageUrl, }: Readonly<SuggestionRowProps>): React__default.ReactElement;
266
195
 
@@ -281,4 +210,4 @@ interface SeeMoreLinkProps {
281
210
 
282
211
  declare function SeeMoreLink({ seeMoreLinkRef, seeMoreLinkFocused, inputRef, onBlurSeeMoreLink, onFocusSeeMoreLink, onSeeMoreResults, resetSeeMoreLinkFocus, restoreLastSuggestion, seeMoreResultsText, searchQuery, }: Readonly<SeeMoreLinkProps>): React__default.ReactElement;
283
212
 
284
- export { type AIChatConfig, type AIChatHeaderContent, type AIChatHeaderContentConfig, type AIChatProduct, type AIChatResponse, type AISearchProduct, type AISearchResult, ChatLoading, type ChatLoadingProps, SEARCH_MESSAGE_SENDERS, SearchChatResult, SearchMessage, SearchMessageInput, type SearchMessageInputProps, type SearchMessageProps, type SearchMessageSender, SearchModal, type SearchModalAIChatConfig, type SearchModalProps, SearchPanel, type SearchPanelProps, SeeMoreLink, type SeeMoreLinkProps, type SuggestionDisplayData, type SuggestionOptionWithTracking, SuggestionRow, type SuggestionRowProps, type UseAIChatHeaderContentResult, callAICommerceChat, fetchAIChatHeaderContent, getSuggestionDisplayData, useAIChatHeaderContent };
213
+ 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";
@@ -22,7 +19,6 @@ interface SearchMessageInputBaseProps extends Omit<ComponentPropsWithoutRef<'for
22
19
  onChange?: (value: string) => void;
23
20
  onSubmit: (message: string) => void;
24
21
  placeholder: string;
25
- submitLabel: string;
26
22
  /** When false, input value is preserved after submit (search mode). Defaults to true (chat mode). */
27
23
  clearOnSubmit?: boolean;
28
24
  value?: string;
@@ -41,7 +37,10 @@ type SearchMessageInputVoiceProps = {
41
37
  voiceListeningLabel?: never;
42
38
  };
43
39
  type SearchMessageInputProps = SearchMessageInputBaseProps & SearchMessageInputVoiceProps;
44
- declare function SearchMessageInput({ clearOnSubmit, inputLabel, onChange, onSubmit, onVoiceInput, placeholder, showVoiceInput, submitLabel, value, voiceInputLabel, voiceListening, voiceListeningLabel, ...props }: SearchMessageInputProps): React.JSX.Element;
40
+ /**
41
+ * The search box. There is no submit button: pressing Enter submits, as in master's search.
42
+ */
43
+ declare function SearchMessageInput({ clearOnSubmit, inputLabel, onChange, onSubmit, onVoiceInput, placeholder, showVoiceInput, value, voiceInputLabel, voiceListening, voiceListeningLabel, ...props }: SearchMessageInputProps): React.JSX.Element;
45
44
 
46
45
  interface SearchPanelProps extends Omit<ComponentPropsWithoutRef<'section'>, 'aria-label' | 'children'> {
47
46
  'aria-label': string;
@@ -54,48 +53,48 @@ interface SearchPanelProps extends Omit<ComponentPropsWithoutRef<'section'>, 'ar
54
53
  logoSlot?: ReactNode;
55
54
  /** When true: content scrolls, input fixed at bottom (AI chat layout) */
56
55
  chatMode?: boolean;
56
+ /**
57
+ * When true: the panel hosts an embedded agent. Children fill the space below the header
58
+ * and bring their own scrolling and input, so no input, input slot or initial prompt renders.
59
+ */
60
+ agentMode?: boolean;
57
61
  }
58
- declare function SearchPanel({ 'aria-label': ariaLabel, children, chatMode, closeLabel, initialPrompt, inputSlot, logoSlot, messageInputProps, onClose, ...props }: Readonly<SearchPanelProps>): React.JSX.Element;
62
+ declare function SearchPanel({ 'aria-label': ariaLabel, agentMode, children, chatMode, closeLabel, initialPrompt, inputSlot, logoSlot, messageInputProps, onClose, ...props }: Readonly<SearchPanelProps>): React.JSX.Element;
59
63
 
60
- interface AIChatConfig {
61
- /** The user's search term */
62
- searchTerm: string;
63
- /** Market code (e.g., "US", "JP") for scope_context in message requests. */
64
- market?: string;
65
- /** Language code (e.g., "en", "ja") for scope_context in message requests. */
66
- language?: string;
67
- /** X-Sales-AI-App-Key header value (from CS configurations). */
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 {
64
+ type ProductType = 'bundle' | 'single';
65
+ /**
66
+ * A product suggestion row. Structurally the shape the search SDK's catalog mapping produces;
67
+ * defined here so this library stays presentational and imports nothing from the SDK.
68
+ */
69
+ interface CatalogSuggestionItem {
70
+ id: string;
71
+ identifier: string;
74
72
  sku: string;
75
- name?: string;
76
- image_url?: string;
77
- pv?: number;
73
+ label: string;
74
+ value: string;
75
+ imageURL: string;
76
+ thumbnail: string;
77
+ productType: ProductType;
78
+ product_type: ProductType;
79
+ outOfStock: boolean;
80
+ productStatus: string | undefined;
81
+ status: string | undefined;
82
+ cartActionDisabled: boolean;
83
+ customProductType: string;
84
+ slug: string | null;
85
+ productSlug: string | null;
86
+ url: string | null;
87
+ href: string | null;
88
+ keywords: string;
89
+ ingredientTerms: string[];
90
+ }
91
+ /** A "Did You Mean?" row. Extra fields from the API are preserved via the index signature. */
92
+ interface DidYouMeanItem {
93
+ id: string;
94
+ value: string;
95
+ suggestionType: 'did-you-mean';
78
96
  [key: string]: unknown;
79
97
  }
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
98
  interface SuggestionDisplayData {
100
99
  imageSrc: string;
101
100
  displayLabel: string;
@@ -126,141 +125,71 @@ interface SuggestionRowProps {
126
125
  fallbackImageUrl?: string;
127
126
  }
128
127
 
129
- interface AISearchProduct {
130
- id: string;
131
- sku?: string;
132
- name: string;
133
- imageUrl?: string;
134
- image_url?: string;
135
- price?: string;
136
- pv?: number;
137
- retail_price?: number;
138
- description?: string;
139
- badge?: string;
140
- url?: string;
141
- routeUrl?: string;
142
- category?: string;
143
- }
144
- interface AISearchResult {
145
- userQuery: string;
146
- aiResponseText: string;
147
- products?: AISearchProduct[];
148
- }
149
- interface SearchChatResultProps {
150
- result: AISearchResult;
151
- /**
152
- * When false, pricing and PV/SV values are hidden in cards and stripped from summary.
153
- * Controlled by the CS ai_chat_nuskin_header configurations.enablepricingpvsv flag.
154
- */
155
- showPricing?: boolean;
156
- productsAriaLabel?: string;
157
- history?: {
158
- push: (path: string) => void;
159
- } | null;
160
- }
161
-
162
- interface SearchModalAIChatConfig {
163
- market: string;
164
- language: string;
165
- conversationsUrl?: string;
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;
128
+ /** Copy shown by the modal. Every key falls back to an English default. */
129
+ interface SearchModalCopy {
130
+ extended_search_textbox_desktop?: string;
131
+ extended_search_box_aria_label?: string;
132
+ clear_all_label?: string;
133
+ no_suggestions_text?: string;
134
+ see_more_results_text?: string;
135
+ did_you_mean_text?: string;
136
+ recent_searches_label?: string;
137
+ }
138
+ /** The search box, controlled by the host. */
139
+ interface SearchModalInputProps {
140
+ value: string;
141
+ onChange: (value: string) => void;
142
+ onSubmit: (value: string) => void;
143
+ }
144
+ /** The suggestions the host has already fetched and filtered. */
145
+ interface SearchModalSuggestionsProps {
146
+ items: ReadonlyArray<SuggestionOptionWithTracking>;
147
+ loading: boolean;
148
+ /** Show the "no suggestions" row (the host decides when a fetch came back empty). */
149
+ showNoResults: boolean;
150
+ /** The items are "did you mean" terms, so show the heading and hide "see more". */
151
+ showDidYouMean: boolean;
152
+ /** More matches exist than are shown. */
153
+ hasMore: boolean;
154
+ /** The query the suggestions belong to (passed to the "see more" link). */
155
+ query: string;
156
+ onSelect: (option: SuggestionOptionWithTracking) => void;
157
+ onRunAction: (option: SuggestionOptionWithTracking) => void;
158
+ onSeeMore: () => void;
159
+ }
160
+ /** Recent searches, shown while the search box is empty. */
161
+ interface SearchModalRecentSearches {
162
+ items: ReadonlyArray<string>;
163
+ onSelect: (query: string) => void;
164
+ onClear: () => void;
178
165
  }
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
166
  interface SearchModalProps {
188
167
  isOpen: boolean;
189
168
  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
169
  logo?: React__default.ReactNode;
205
170
  cancelLabel?: string;
206
171
  fallbackImageUrl?: string;
207
- /** When true, the modal triggers AI Commerce Chat after search. */
208
- enableAIChat?: boolean;
209
- /** When false, pricing/PV/SV is hidden in AI chat results. Driven by CS enablepricingpvsv flag. */
210
- showPricing?: boolean;
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;
172
+ copy?: SearchModalCopy;
173
+ input: SearchModalInputProps;
174
+ suggestions: SearchModalSuggestionsProps;
175
+ recentSearches?: SearchModalRecentSearches;
215
176
  /**
216
- * Optional host-supplied context for the AI chat GTM (dataLayer) events
217
- * defined in COMX-3277 (page type, country code, language, user status, user id).
218
- * When omitted, blank-string placeholders are pushed to the dataLayer so the
219
- * event schema stays stable.
177
+ * An embedded agent (the NUi widget). When set, the panel switches to its agent layout: the
178
+ * search box, suggestions and recent searches are replaced by this content.
220
179
  */
221
- gtmContext?: SearchModalGtmContext;
222
- history?: {
223
- push: (path: string) => void;
224
- } | null;
180
+ agentPanel?: React__default.ReactNode;
225
181
  }
226
182
 
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;
236
- }
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
-
246
- interface UseAIChatHeaderContentResult {
247
- content: AIChatHeaderContent | null;
248
- loading: boolean;
249
- error: Error | null;
250
- }
251
183
  /**
252
- * Fetches `ai_chat_nuskin_header` singleton content from Contentstack
253
- * when a valid config is supplied. Returns null content when config is absent.
184
+ * The search panel: a full-width overlay with a search box, suggestions and recent searches, or,
185
+ * when `agentPanel` is set, a header over an embedded agent.
186
+ *
187
+ * Presentational: it holds only UI state (highlighted row, expanded recent searches). Modal
188
+ * behaviour (portal, backdrop, Escape, focus trap, returning focus to the opener, scroll lock,
189
+ * hiding the page from assistive technology) comes from MUI's `Modal`. Fetching, routing and
190
+ * navigation belong to the host.
254
191
  */
255
- declare function useAIChatHeaderContent(config: AIChatHeaderContentConfig | null | undefined): UseAIChatHeaderContentResult;
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;
192
+ declare function SearchModal({ isOpen, onClose, logo, cancelLabel, fallbackImageUrl, copy, input, suggestions, recentSearches, agentPanel, }: Readonly<SearchModalProps>): React__default.ReactElement | null;
264
193
 
265
194
  declare function SuggestionRow({ inputRef, isHighlighted, isSelected, onHighlightSuggestion, onRunSuggestionAction, onSelectSuggestion, registerSuggestionNode, suggestionIndex, suggestionOption, suggestionOptionId, fallbackImageUrl, }: Readonly<SuggestionRowProps>): React__default.ReactElement;
266
195
 
@@ -281,4 +210,4 @@ interface SeeMoreLinkProps {
281
210
 
282
211
  declare function SeeMoreLink({ seeMoreLinkRef, seeMoreLinkFocused, inputRef, onBlurSeeMoreLink, onFocusSeeMoreLink, onSeeMoreResults, resetSeeMoreLinkFocus, restoreLastSuggestion, seeMoreResultsText, searchQuery, }: Readonly<SeeMoreLinkProps>): React__default.ReactElement;
283
212
 
284
- export { type AIChatConfig, type AIChatHeaderContent, type AIChatHeaderContentConfig, type AIChatProduct, type AIChatResponse, type AISearchProduct, type AISearchResult, ChatLoading, type ChatLoadingProps, SEARCH_MESSAGE_SENDERS, SearchChatResult, SearchMessage, SearchMessageInput, type SearchMessageInputProps, type SearchMessageProps, type SearchMessageSender, SearchModal, type SearchModalAIChatConfig, type SearchModalProps, SearchPanel, type SearchPanelProps, SeeMoreLink, type SeeMoreLinkProps, type SuggestionDisplayData, type SuggestionOptionWithTracking, SuggestionRow, type SuggestionRowProps, type UseAIChatHeaderContentResult, callAICommerceChat, fetchAIChatHeaderContent, getSuggestionDisplayData, useAIChatHeaderContent };
213
+ 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 };