@nuskin/react-search-sdk 1.0.0-trying-again.6 → 1.0.0-trying-again.7
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/README.md +1 -13
- package/dist/index.js +23 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -7,19 +7,7 @@ A host renders one component, `CommerceSearch`, and gives it the market, who the
|
|
|
7
7
|
navigate, and its logo. The package works out the rest itself: the market's catalog lookup, the
|
|
8
8
|
minimum search length, which NUi app to use, the panel's text and the analytics events. The panel UI
|
|
9
9
|
comes from [`@nuskin/react-search-components`](../react-search-components) and the agent from
|
|
10
|
-
`@nuskin/react-nui-chat-sdk
|
|
11
|
-
`sales-ai-platform` to npmjs (see [Installing](#installing)).
|
|
12
|
-
|
|
13
|
-
## Installing
|
|
14
|
-
|
|
15
|
-
Every dependency, the chat widget included, resolves from the public npm registry, so
|
|
16
|
-
`yarn install` needs no registry credential and no `.npmrc`.
|
|
17
|
-
|
|
18
|
-
The widget is pinned to an exact version on purpose: the platform hides experiences whose
|
|
19
|
-
`min_sdk_version` is above the installed one, so the version is part of the contract. Versions
|
|
20
|
-
1.1.0 to 1.3.0 were served from AWS CodeArtifact under the name `@nu-skin-enterprises/chat-widget`;
|
|
21
|
-
from 1.4.0 the package is `@nuskin/react-nui-chat-sdk` on npmjs, and the CodeArtifact routing and
|
|
22
|
-
`CODEARTIFACT_AUTH_TOKEN` step are gone from this repository.
|
|
10
|
+
`@nuskin/react-nui-chat-sdk`.
|
|
23
11
|
|
|
24
12
|
## Requirements
|
|
25
13
|
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
var react = require('react');
|
|
4
4
|
var configurationSdk = require('@nuskin/configuration-sdk');
|
|
5
5
|
var reactSearchComponents = require('@nuskin/react-search-components');
|
|
6
|
+
var reactNuiChatSdk = require('@nuskin/react-nui-chat-sdk');
|
|
7
|
+
require('@nuskin/react-nui-chat-sdk/styles.css');
|
|
6
8
|
var reactProductSdk = require('@nuskin/react-product-sdk');
|
|
7
9
|
var styled = require('@emotion/styled');
|
|
8
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -1081,12 +1083,6 @@ var AgentProductSlot = styled__default.default.div`
|
|
|
1081
1083
|
width: 240px;
|
|
1082
1084
|
}
|
|
1083
1085
|
`;
|
|
1084
|
-
var SalesAIChatWidget = react.lazy(
|
|
1085
|
-
() => Promise.all([
|
|
1086
|
-
import('@nuskin/react-nui-chat-sdk'),
|
|
1087
|
-
import('@nuskin/react-nui-chat-sdk/styles.css')
|
|
1088
|
-
]).then(([mod]) => ({ default: mod.SalesAIChatWidget }))
|
|
1089
|
-
);
|
|
1090
1086
|
var HANDLE_POLL_MS = 50;
|
|
1091
1087
|
var HANDLE_TIMEOUT_MS = 15e3;
|
|
1092
1088
|
function AgentProductCard({ sku }) {
|
|
@@ -1111,15 +1107,15 @@ function AgentWidget({
|
|
|
1111
1107
|
[environment, market, language]
|
|
1112
1108
|
);
|
|
1113
1109
|
if (!client) {
|
|
1114
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1110
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNuiChatSdk.SalesAIChatWidget, { ...widgetProps });
|
|
1115
1111
|
}
|
|
1116
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactProductSdk.ProductProvider, { client, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1117
|
-
SalesAIChatWidget,
|
|
1112
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactProductSdk.ProductProvider, { client, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1113
|
+
reactNuiChatSdk.SalesAIChatWidget,
|
|
1118
1114
|
{
|
|
1119
1115
|
renderProduct: renderAgentProduct,
|
|
1120
1116
|
...widgetProps
|
|
1121
1117
|
}
|
|
1122
|
-
) })
|
|
1118
|
+
) });
|
|
1123
1119
|
}
|
|
1124
1120
|
function getSalesAIHandle() {
|
|
1125
1121
|
return window.SalesAI;
|
|
@@ -1420,22 +1416,24 @@ function CommerceSearchView({
|
|
|
1420
1416
|
if (agentQuery !== null)
|
|
1421
1417
|
navigateTo(service.submitProductSearch(agentQuery));
|
|
1422
1418
|
}, [agentQuery, navigateTo, service]);
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
handoffContext: {
|
|
1430
|
-
source: "storefront_search",
|
|
1431
|
-
trigger: "zero_results",
|
|
1419
|
+
let agentPanel;
|
|
1420
|
+
if (handoff !== null && agent !== void 0) {
|
|
1421
|
+
agentPanel = /* @__PURE__ */ jsxRuntime.jsx(
|
|
1422
|
+
NuiAgentPanel,
|
|
1423
|
+
{
|
|
1424
|
+
agent,
|
|
1432
1425
|
query: handoff.query,
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1426
|
+
handoffContext: {
|
|
1427
|
+
source: "storefront_search",
|
|
1428
|
+
trigger: "zero_results",
|
|
1429
|
+
query: handoff.query,
|
|
1430
|
+
did_you_mean: handoff.didYouMean
|
|
1431
|
+
},
|
|
1432
|
+
...agentProducts ? { products: agentProducts } : {},
|
|
1433
|
+
onUnavailable: handleAgentUnavailable
|
|
1434
|
+
}
|
|
1435
|
+
);
|
|
1436
|
+
}
|
|
1439
1437
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1440
1438
|
reactSearchComponents.SearchModal,
|
|
1441
1439
|
{
|