@nuskin/react-search-sdk 1.0.1-code-cleanup.1 → 1.1.0-pa-1255.1
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 +3 -3
- package/dist/index.d.mts +15 -8
- package/dist/index.d.ts +15 -8
- package/dist/index.js +282 -119
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +283 -120
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
# @nuskin/react-search-sdk
|
|
2
2
|
|
|
3
|
-
The search experience for the
|
|
3
|
+
The search experience for the Nu Skin storefront: typeahead and recent searches over the Equinox
|
|
4
4
|
catalog, and the NUi agent when a signed-in shopper searches for something with no products.
|
|
5
5
|
|
|
6
6
|
A host renders one component, `CommerceSearch`, and gives it the market, who the customer is, how to
|
|
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
|
-
comes from
|
|
9
|
+
comes from `@nuskin/react-search-components` and the agent from
|
|
10
10
|
`@nuskin/react-nui-chat-sdk`.
|
|
11
11
|
|
|
12
12
|
## Requirements
|
package/dist/index.d.mts
CHANGED
|
@@ -16,8 +16,8 @@ type NavigationTarget = {
|
|
|
16
16
|
/**
|
|
17
17
|
* The account types the suggestions API distinguishes, sent as `X-Customer-Type`.
|
|
18
18
|
*
|
|
19
|
-
* TODO: this set is a best guess from the values the storefront sends
|
|
20
|
-
*
|
|
19
|
+
* TODO: PA-1254 validates this set, which is a best guess from the values the storefront sends,
|
|
20
|
+
* against the storefront's customer types and what the suggestions API accepts.
|
|
21
21
|
*/
|
|
22
22
|
type CustomerAccountType = 'guest' | 'Brand Affiliate' | 'Retail Customer' | 'Preferred Customer/Member';
|
|
23
23
|
/** Who is searching. */
|
|
@@ -46,18 +46,25 @@ interface CommerceSearchProps {
|
|
|
46
46
|
country: string;
|
|
47
47
|
/** ISO 639-1 language, for example `en`. */
|
|
48
48
|
language: string;
|
|
49
|
+
/**
|
|
50
|
+
* The client id the configuration service knows the host by. Without one the Configuration
|
|
51
|
+
* SDK uses its own (the run config's), and the search's plain suggestions fail where there is
|
|
52
|
+
* none, so a host that cannot rely on the run config should pass it.
|
|
53
|
+
*/
|
|
54
|
+
clientId?: string;
|
|
49
55
|
/** Shown at the top of the panel, for example the brand logo. */
|
|
50
56
|
logo?: ReactNode;
|
|
51
57
|
}
|
|
52
58
|
/**
|
|
53
59
|
* The commerce website's single search entry point: typeahead and recent searches over the
|
|
54
|
-
* product catalog today, with the NUi agent taking over in the same panel when a
|
|
55
|
-
*
|
|
56
|
-
* products — it is the commerce site's search, not a product-only search box.
|
|
60
|
+
* product catalog today, with the NUi agent taking over in the same panel when a shopper the
|
|
61
|
+
* configuration enables it for searches for something with no products. What it can answer is not
|
|
62
|
+
* limited to products — it is the commerce site's search, not a product-only search box.
|
|
57
63
|
*
|
|
58
|
-
* The package works out the rest itself: the market's catalog lookup, the minimum search length
|
|
59
|
-
* which NUi app to use, the panel's text and the
|
|
64
|
+
* The package works out the rest itself: the market's catalog lookup, the minimum search length
|
|
65
|
+
* and the number of suggestions, which NUi app to use and for whom, the panel's text and the
|
|
66
|
+
* analytics fields.
|
|
60
67
|
*/
|
|
61
|
-
declare function CommerceSearch(
|
|
68
|
+
declare function CommerceSearch(props: Readonly<CommerceSearchProps>): ReactElement | null;
|
|
62
69
|
|
|
63
70
|
export { CommerceSearch, type CommerceSearchCustomer, type CommerceSearchProps, type CustomerAccountType, type NavigationTarget };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ type NavigationTarget = {
|
|
|
16
16
|
/**
|
|
17
17
|
* The account types the suggestions API distinguishes, sent as `X-Customer-Type`.
|
|
18
18
|
*
|
|
19
|
-
* TODO: this set is a best guess from the values the storefront sends
|
|
20
|
-
*
|
|
19
|
+
* TODO: PA-1254 validates this set, which is a best guess from the values the storefront sends,
|
|
20
|
+
* against the storefront's customer types and what the suggestions API accepts.
|
|
21
21
|
*/
|
|
22
22
|
type CustomerAccountType = 'guest' | 'Brand Affiliate' | 'Retail Customer' | 'Preferred Customer/Member';
|
|
23
23
|
/** Who is searching. */
|
|
@@ -46,18 +46,25 @@ interface CommerceSearchProps {
|
|
|
46
46
|
country: string;
|
|
47
47
|
/** ISO 639-1 language, for example `en`. */
|
|
48
48
|
language: string;
|
|
49
|
+
/**
|
|
50
|
+
* The client id the configuration service knows the host by. Without one the Configuration
|
|
51
|
+
* SDK uses its own (the run config's), and the search's plain suggestions fail where there is
|
|
52
|
+
* none, so a host that cannot rely on the run config should pass it.
|
|
53
|
+
*/
|
|
54
|
+
clientId?: string;
|
|
49
55
|
/** Shown at the top of the panel, for example the brand logo. */
|
|
50
56
|
logo?: ReactNode;
|
|
51
57
|
}
|
|
52
58
|
/**
|
|
53
59
|
* The commerce website's single search entry point: typeahead and recent searches over the
|
|
54
|
-
* product catalog today, with the NUi agent taking over in the same panel when a
|
|
55
|
-
*
|
|
56
|
-
* products — it is the commerce site's search, not a product-only search box.
|
|
60
|
+
* product catalog today, with the NUi agent taking over in the same panel when a shopper the
|
|
61
|
+
* configuration enables it for searches for something with no products. What it can answer is not
|
|
62
|
+
* limited to products — it is the commerce site's search, not a product-only search box.
|
|
57
63
|
*
|
|
58
|
-
* The package works out the rest itself: the market's catalog lookup, the minimum search length
|
|
59
|
-
* which NUi app to use, the panel's text and the
|
|
64
|
+
* The package works out the rest itself: the market's catalog lookup, the minimum search length
|
|
65
|
+
* and the number of suggestions, which NUi app to use and for whom, the panel's text and the
|
|
66
|
+
* analytics fields.
|
|
60
67
|
*/
|
|
61
|
-
declare function CommerceSearch(
|
|
68
|
+
declare function CommerceSearch(props: Readonly<CommerceSearchProps>): ReactElement | null;
|
|
62
69
|
|
|
63
70
|
export { CommerceSearch, type CommerceSearchCustomer, type CommerceSearchProps, type CustomerAccountType, type NavigationTarget };
|