@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.js CHANGED
@@ -12675,7 +12675,7 @@ var SearchPanelRoot = styled6__default.default.section`
12675
12675
  ${({ $chatMode }) => $chatMode && `
12676
12676
  display: flex;
12677
12677
  flex-direction: column;
12678
- max-block-size: 92dvh;
12678
+ height: 805px;
12679
12679
  overflow: hidden;
12680
12680
  `}
12681
12681
  `;
@@ -13627,10 +13627,6 @@ function toCarouselItem(product, index2, showPricing, history) {
13627
13627
  if (href === "#") return;
13628
13628
  if (history && typeof history.push === "function") {
13629
13629
  history.push(href);
13630
- return;
13631
- }
13632
- if (typeof window !== "undefined") {
13633
- window.location.href = href;
13634
13630
  }
13635
13631
  }
13636
13632
  }
@@ -13808,6 +13804,11 @@ function SearchModalChatContent({
13808
13804
  /* @__PURE__ */ jsxRuntime.jsx("div", { ref: chatEndRef })
13809
13805
  ] });
13810
13806
  }
13807
+ function pushSearchPath(history, path2) {
13808
+ if (path2 && path2 !== "action-handled" && path2 !== "action-pending" && history && typeof history.push === "function") {
13809
+ history.push(path2);
13810
+ }
13811
+ }
13811
13812
  function SearchModalSuggestionsContent({
13812
13813
  listboxId,
13813
13814
  ariaLabel,
@@ -14193,7 +14194,7 @@ function SearchModal({
14193
14194
  setPendingQuery(queryText.trim());
14194
14195
  setAiStatus(aiStatusLabels.analyzing);
14195
14196
  const requestId = aiRequestCounterRef.current;
14196
- const basePath = (_a2 = config.productBasePath) != null ? _a2 : `/${config.market.toLowerCase()}/${config.language.toLowerCase()}/product`;
14197
+ const basePath = (_a2 = config.productBasePath) != null ? _a2 : "/product";
14197
14198
  const chatService = reactSearchSdk.createChatService({
14198
14199
  conversationsUrl: config.conversationsUrl,
14199
14200
  messagesUrl: config.messagesUrl,
@@ -14265,7 +14266,10 @@ function SearchModal({
14265
14266
  onClose();
14266
14267
  return;
14267
14268
  }
14268
- service.submitProductSearch(term, option);
14269
+ pushSearchPath(
14270
+ history,
14271
+ service.submitProductSearch(term, option)
14272
+ );
14269
14273
  if (!enableAIChat) setLegacyRecentSearches((_d2 = (_c2 = service.getRecentSearches) == null ? void 0 : _c2.call(service)) != null ? _d2 : []);
14270
14274
  onClose();
14271
14275
  },
@@ -14274,9 +14278,11 @@ function SearchModal({
14274
14278
  const runSuggestionAction = React.useCallback(
14275
14279
  (option) => {
14276
14280
  if (reactSearchSdk.isSuggestionDisabled(option)) return;
14277
- service.activateSuggestionAction(option);
14281
+ const result = service.activateSuggestionAction(option);
14282
+ void Promise.resolve(result).then((path2) => pushSearchPath(history, path2)).catch(() => {
14283
+ });
14278
14284
  },
14279
- [service]
14285
+ [history, service]
14280
14286
  );
14281
14287
  const handleRecentSearchSelect = React.useCallback(
14282
14288
  (entry) => {
@@ -14301,16 +14307,16 @@ function SearchModal({
14301
14307
  clearRecentSearches();
14302
14308
  }, [clearRecentSearches]);
14303
14309
  const handleSeeMore = React.useCallback(() => {
14304
- if (query.trim()) service.viewMoreResults({ query: query.trim() });
14305
- }, [service, query]);
14310
+ if (query.trim()) {
14311
+ pushSearchPath(history, service.viewMoreResults({ query: query.trim() }));
14312
+ }
14313
+ }, [history, service, query]);
14306
14314
  const handleSearchSubmit = React.useCallback(
14307
14315
  (value) => {
14308
14316
  var _a2, _b2;
14309
14317
  historyAddEntry({ query: value, isAI: false });
14310
14318
  const url = service.submitProductSearch(value);
14311
- if (url && history && typeof history.push === "function") {
14312
- history.push(url);
14313
- }
14319
+ pushSearchPath(history, url);
14314
14320
  if (!enableAIChat) setLegacyRecentSearches((_b2 = (_a2 = service.getRecentSearches) == null ? void 0 : _a2.call(service)) != null ? _b2 : []);
14315
14321
  onClose();
14316
14322
  },