@nuskin/react-search-sdk 1.0.0-trying-again.6 → 1.0.0-trying-again.8

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
@@ -1,6 +1,8 @@
1
- import { lazy, useState, useEffect, useRef, useMemo, useCallback, Component, Suspense } from 'react';
1
+ import { useState, useEffect, useRef, useMemo, useCallback, Component } from 'react';
2
2
  import configurationSdk from '@nuskin/configuration-sdk';
3
3
  import { SearchModal } from '@nuskin/react-search-components';
4
+ import { SalesAIChatWidget } from '@nuskin/react-nui-chat-sdk';
5
+ import '@nuskin/react-nui-chat-sdk/styles.css';
4
6
  import { createProductClient, ProductProvider, useProductById, ProductCard } from '@nuskin/react-product-sdk';
5
7
  import styled from '@emotion/styled';
6
8
  import { jsx } from 'react/jsx-runtime';
@@ -1074,12 +1076,6 @@ var AgentProductSlot = styled.div`
1074
1076
  width: 240px;
1075
1077
  }
1076
1078
  `;
1077
- var SalesAIChatWidget = lazy(
1078
- () => Promise.all([
1079
- import('@nuskin/react-nui-chat-sdk'),
1080
- import('@nuskin/react-nui-chat-sdk/styles.css')
1081
- ]).then(([mod]) => ({ default: mod.SalesAIChatWidget }))
1082
- );
1083
1079
  var HANDLE_POLL_MS = 50;
1084
1080
  var HANDLE_TIMEOUT_MS = 15e3;
1085
1081
  function AgentProductCard({ sku }) {
@@ -1104,15 +1100,15 @@ function AgentWidget({
1104
1100
  [environment, market, language]
1105
1101
  );
1106
1102
  if (!client) {
1107
- return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(SalesAIChatWidget, { ...widgetProps }) });
1103
+ return /* @__PURE__ */ jsx(SalesAIChatWidget, { ...widgetProps });
1108
1104
  }
1109
- return /* @__PURE__ */ jsx(ProductProvider, { client, children: /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
1105
+ return /* @__PURE__ */ jsx(ProductProvider, { client, children: /* @__PURE__ */ jsx(
1110
1106
  SalesAIChatWidget,
1111
1107
  {
1112
1108
  renderProduct: renderAgentProduct,
1113
1109
  ...widgetProps
1114
1110
  }
1115
- ) }) });
1111
+ ) });
1116
1112
  }
1117
1113
  function getSalesAIHandle() {
1118
1114
  return window.SalesAI;
@@ -1413,22 +1409,24 @@ function CommerceSearchView({
1413
1409
  if (agentQuery !== null)
1414
1410
  navigateTo(service.submitProductSearch(agentQuery));
1415
1411
  }, [agentQuery, navigateTo, service]);
1416
- const agentProductsProps = agentProducts ? { products: agentProducts } : {};
1417
- const agentPanel = handoff === null || agent === void 0 ? void 0 : /* @__PURE__ */ jsx(
1418
- NuiAgentPanel,
1419
- {
1420
- agent,
1421
- query: handoff.query,
1422
- handoffContext: {
1423
- source: "storefront_search",
1424
- trigger: "zero_results",
1412
+ let agentPanel;
1413
+ if (handoff !== null && agent !== void 0) {
1414
+ agentPanel = /* @__PURE__ */ jsx(
1415
+ NuiAgentPanel,
1416
+ {
1417
+ agent,
1425
1418
  query: handoff.query,
1426
- did_you_mean: handoff.didYouMean
1427
- },
1428
- ...agentProductsProps,
1429
- onUnavailable: handleAgentUnavailable
1430
- }
1431
- );
1419
+ handoffContext: {
1420
+ source: "storefront_search",
1421
+ trigger: "zero_results",
1422
+ query: handoff.query,
1423
+ did_you_mean: handoff.didYouMean
1424
+ },
1425
+ ...agentProducts ? { products: agentProducts } : {},
1426
+ onUnavailable: handleAgentUnavailable
1427
+ }
1428
+ );
1429
+ }
1432
1430
  return /* @__PURE__ */ jsx(
1433
1431
  SearchModal,
1434
1432
  {