@nuskin/react-search-sdk 1.0.0-trying-again.5 → 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 -22
- 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 +5 -4
package/README.md
CHANGED
|
@@ -7,28 +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
|
-
`@
|
|
11
|
-
`sales-ai-platform` to AWS CodeArtifact (see [Installing](#installing)).
|
|
12
|
-
|
|
13
|
-
## Installing
|
|
14
|
-
|
|
15
|
-
`@nu-skin-enterprises/chat-widget` is not on npmjs. `.npmrc` routes only that scope to the
|
|
16
|
-
`npm-sdks` repository of the `ai-spr-sdk` CodeArtifact domain (account 105371274045, us-west-2) and
|
|
17
|
-
reads a token from `CODEARTIFACT_AUTH_TOKEN`. CI mints it in `.gitlab-ci.yml`; locally, with an AWS
|
|
18
|
-
identity that may read the domain (the `nse-dev` and `nse-nnp` developer permission sets can):
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
export CODEARTIFACT_AUTH_TOKEN="$(aws codeartifact get-authorization-token \
|
|
22
|
-
--domain ai-spr-sdk --domain-owner 105371274045 --region us-west-2 \
|
|
23
|
-
--query authorizationToken --output text)" # valid 12 hours
|
|
24
|
-
yarn install
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
The domain owner matters: the dev account has an unrelated domain of the same name.
|
|
28
|
-
|
|
29
|
-
The variable must exist for yarn to start at all, even with the package already installed: yarn
|
|
30
|
-
refuses an `.npmrc` that references an unset variable. An empty value is enough for commands that
|
|
31
|
-
do not fetch (`export CODEARTIFACT_AUTH_TOKEN=`).
|
|
10
|
+
`@nuskin/react-nui-chat-sdk`.
|
|
32
11
|
|
|
33
12
|
## Requirements
|
|
34
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('@nu-skin-enterprises/chat-widget'),
|
|
1087
|
-
import('@nu-skin-enterprises/chat-widget/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
|
{
|