@nuskin/react-search-components 1.0.0-comx-3067.4 → 1.0.0-comx-3067.5

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.mjs CHANGED
@@ -12669,7 +12669,7 @@ var SearchPanelRoot = styled6.section`
12669
12669
  ${({ $chatMode }) => $chatMode && `
12670
12670
  display: flex;
12671
12671
  flex-direction: column;
12672
- max-block-size: 92dvh;
12672
+ height: 805px;
12673
12673
  overflow: hidden;
12674
12674
  `}
12675
12675
  `;
@@ -13621,10 +13621,6 @@ function toCarouselItem(product, index2, showPricing, history) {
13621
13621
  if (href === "#") return;
13622
13622
  if (history && typeof history.push === "function") {
13623
13623
  history.push(href);
13624
- return;
13625
- }
13626
- if (typeof window !== "undefined") {
13627
- window.location.href = href;
13628
13624
  }
13629
13625
  }
13630
13626
  }
@@ -13802,6 +13798,11 @@ function SearchModalChatContent({
13802
13798
  /* @__PURE__ */ jsx("div", { ref: chatEndRef })
13803
13799
  ] });
13804
13800
  }
13801
+ function pushSearchPath(history, path2) {
13802
+ if (path2 && path2 !== "action-handled" && path2 !== "action-pending" && history && typeof history.push === "function") {
13803
+ history.push(path2);
13804
+ }
13805
+ }
13805
13806
  function SearchModalSuggestionsContent({
13806
13807
  listboxId,
13807
13808
  ariaLabel,
@@ -14187,7 +14188,7 @@ function SearchModal({
14187
14188
  setPendingQuery(queryText.trim());
14188
14189
  setAiStatus(aiStatusLabels.analyzing);
14189
14190
  const requestId = aiRequestCounterRef.current;
14190
- const basePath = (_a2 = config.productBasePath) != null ? _a2 : `/${config.market.toLowerCase()}/${config.language.toLowerCase()}/product`;
14191
+ const basePath = (_a2 = config.productBasePath) != null ? _a2 : "/product";
14191
14192
  const chatService = createChatService({
14192
14193
  conversationsUrl: config.conversationsUrl,
14193
14194
  messagesUrl: config.messagesUrl,
@@ -14259,7 +14260,10 @@ function SearchModal({
14259
14260
  onClose();
14260
14261
  return;
14261
14262
  }
14262
- service.submitProductSearch(term, option);
14263
+ pushSearchPath(
14264
+ history,
14265
+ service.submitProductSearch(term, option)
14266
+ );
14263
14267
  if (!enableAIChat) setLegacyRecentSearches((_d2 = (_c2 = service.getRecentSearches) == null ? void 0 : _c2.call(service)) != null ? _d2 : []);
14264
14268
  onClose();
14265
14269
  },
@@ -14268,9 +14272,11 @@ function SearchModal({
14268
14272
  const runSuggestionAction = useCallback(
14269
14273
  (option) => {
14270
14274
  if (isSuggestionDisabled(option)) return;
14271
- service.activateSuggestionAction(option);
14275
+ const result = service.activateSuggestionAction(option);
14276
+ void Promise.resolve(result).then((path2) => pushSearchPath(history, path2)).catch(() => {
14277
+ });
14272
14278
  },
14273
- [service]
14279
+ [history, service]
14274
14280
  );
14275
14281
  const handleRecentSearchSelect = useCallback(
14276
14282
  (entry) => {
@@ -14295,16 +14301,16 @@ function SearchModal({
14295
14301
  clearRecentSearches();
14296
14302
  }, [clearRecentSearches]);
14297
14303
  const handleSeeMore = useCallback(() => {
14298
- if (query.trim()) service.viewMoreResults({ query: query.trim() });
14299
- }, [service, query]);
14304
+ if (query.trim()) {
14305
+ pushSearchPath(history, service.viewMoreResults({ query: query.trim() }));
14306
+ }
14307
+ }, [history, service, query]);
14300
14308
  const handleSearchSubmit = useCallback(
14301
14309
  (value) => {
14302
14310
  var _a2, _b2;
14303
14311
  historyAddEntry({ query: value, isAI: false });
14304
14312
  const url = service.submitProductSearch(value);
14305
- if (url && history && typeof history.push === "function") {
14306
- history.push(url);
14307
- }
14313
+ pushSearchPath(history, url);
14308
14314
  if (!enableAIChat) setLegacyRecentSearches((_b2 = (_a2 = service.getRecentSearches) == null ? void 0 : _a2.call(service)) != null ? _b2 : []);
14309
14315
  onClose();
14310
14316
  },