@faststore/core 2.0.85-alpha.0 → 2.0.88-alpha.0
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +26 -28
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/eslint/.cache_1gneedd +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +2 -3
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/312.js +232 -260
- package/.next/server/chunks/{849.js → 777.js} +46 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/[...slug].js +1 -1
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js +123 -218
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/_app.js +1009 -643
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/api/graphql.js.nft.json +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/account.html +2 -2
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US.html +2 -2
- package/.next/server/pages/en-US.json +1 -1
- package/.next/server/pages/index.js +1 -1
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/static/NEdGK5jp2ohL_vvU4f2Bi/_buildManifest.js +1 -0
- package/.next/static/chunks/291.78e3aea4a7f45595.js +1 -0
- package/.next/static/chunks/781-7df372b5b56e3f96.js +1 -0
- package/.next/static/chunks/855-05313b1877eceff8.js +1 -0
- package/.next/static/chunks/897-97b54479ad1b57d9.js +1 -0
- package/.next/static/chunks/pages/[...slug]-a947020e62f4ac94.js +1 -0
- package/.next/static/chunks/pages/[slug]/p-0a0c4a0e23758fd1.js +1 -0
- package/.next/static/chunks/pages/_app-256a3d53cde1dece.js +1 -0
- package/.next/static/chunks/pages/{index-912d65fde37706bb.js → index-d7b3fd29a591657a.js} +1 -1
- package/.next/static/chunks/pages/s-56181f57d448f67c.js +1 -0
- package/.next/static/chunks/webpack-432485347f98ee3c.js +1 -0
- package/.next/static/css/{2caa85943bafc7b1.css → 4ac2b0d468ca74dc.css} +1 -1
- package/.next/static/css/{9e7c9877b9f78c63.css → a3aac8b785a9dfe2.css} +1 -1
- package/.next/trace +64 -64
- package/.turbo/turbo-build.log +16 -17
- package/CHANGELOG.md +12 -0
- package/package.json +4 -4
- package/src/components/common/Navbar/navbar.module.scss +6 -5
- package/src/components/regionalization/RegionalizationBar/regionalization-bar.module.scss +4 -0
- package/src/components/search/SearchDropdown/SearchDropdown.tsx +44 -33
- package/src/components/search/SearchDropdown/index.ts +0 -1
- package/src/components/search/SearchHistory/SearchHistory.tsx +5 -3
- package/src/components/search/SearchInput/SearchInput.tsx +55 -61
- package/src/components/search/SearchProductItem/SearchProductItem.tsx +5 -3
- package/src/components/search/SearchTop/SearchTop.tsx +8 -8
- package/src/components/sections/ProductDetails/ProductDetails.tsx +7 -5
- package/src/components/sections/ProductDetails/product-details.module.scss +0 -5
- package/src/components/ui/SkuSelector/Selectors.stories.mdx +5 -1
- package/src/components/ui/SkuSelector/Selectors.tsx +40 -54
- package/src/components/ui/SkuSelector/index.ts +0 -2
- package/src/sdk/cart/index.ts +2 -2
- package/src/sdk/search/formatSearchPath.ts +12 -0
- package/.next/server/chunks/732.js +0 -51
- package/.next/static/U30CqXXD1GphxOr478qYE/_buildManifest.js +0 -1
- package/.next/static/chunks/153-a20e3f2da180607e.js +0 -1
- package/.next/static/chunks/29.8b3dad75b915d222.js +0 -1
- package/.next/static/chunks/337-cf283e91e431869b.js +0 -1
- package/.next/static/chunks/380-efd3541ef85300d5.js +0 -1
- package/.next/static/chunks/817-58eb9d4b3ee3be23.js +0 -1
- package/.next/static/chunks/909.787de82e0ed9eea3.js +0 -1
- package/.next/static/chunks/pages/[...slug]-51896262f6760bf1.js +0 -1
- package/.next/static/chunks/pages/[slug]/p-08c1f443f7d84d0d.js +0 -1
- package/.next/static/chunks/pages/_app-0effc9759a3900cf.js +0 -1
- package/.next/static/chunks/pages/s-86fe1e3303388123.js +0 -1
- package/.next/static/chunks/webpack-dbb0d4f8be2c2abe.js +0 -1
- package/src/components/search/Search.stories.mdx +0 -173
- package/src/components/search/SearchDropdown/SearchDropdown.stories.mdx +0 -61
- package/src/components/search/SearchInput/SearchInput.stories.mdx +0 -200
- package/src/components/search/SearchInput/search-input.module.scss +0 -138
- package/src/components/search/SearchSharedTokenTable.mdx +0 -98
- package/src/components/search/SearchSuggestions/SearchSuggestions.tsx +0 -84
- package/src/components/search/SearchSuggestions/index.ts +0 -2
- package/src/components/search/search.module.scss +0 -19
- package/src/components/ui/SkuSelector/SkuSelector.stories.mdx +0 -345
- package/src/components/ui/SkuSelector/SkuSelector.tsx +0 -46
- package/src/components/ui/SkuSelector/sku-selector.module.scss +0 -172
- package/src/components/ui/SkuSelector/skuVariants.ts +0 -59
- package/src/sdk/search/useSearchInput.tsx +0 -43
- /package/.next/static/{U30CqXXD1GphxOr478qYE → NEdGK5jp2ohL_vvU4f2Bi}/_ssgManifest.js +0 -0
|
@@ -3,6 +3,148 @@ exports.id = 312;
|
|
|
3
3
|
exports.ids = [312];
|
|
4
4
|
exports.modules = {
|
|
5
5
|
|
|
6
|
+
/***/ 2155:
|
|
7
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
/* harmony export */ "R": () => (/* binding */ useSearch)
|
|
11
|
+
/* harmony export */ });
|
|
12
|
+
/* harmony import */ var _molecules_SearchProvider_SearchProvider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8907);
|
|
13
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
14
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const useSearch = () => {
|
|
18
|
+
const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_molecules_SearchProvider_SearchProvider__WEBPACK_IMPORTED_MODULE_1__/* .SearchContext */ .c);
|
|
19
|
+
if (!context) {
|
|
20
|
+
return { inContext: false };
|
|
21
|
+
}
|
|
22
|
+
return { inContext: true, values: context };
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=useSearch.js.map
|
|
25
|
+
|
|
26
|
+
/***/ }),
|
|
27
|
+
|
|
28
|
+
/***/ 6395:
|
|
29
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
30
|
+
|
|
31
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
32
|
+
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
33
|
+
/* harmony export */ });
|
|
34
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
35
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
36
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2155);
|
|
37
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1329);
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const SearchAutoComplete = ({ testId = 'fs-search-auto-complete', children, ...otherProps }) => {
|
|
41
|
+
const { inContext, values } = (0,___WEBPACK_IMPORTED_MODULE_1__/* .useSearch */ .R)();
|
|
42
|
+
if (inContext && (values.terms.length <= 0 || values.term.length <= 0)) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("section", { "data-testid": testId, "data-fs-search-auto-complete": true, ...otherProps },
|
|
46
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { as: "ol" }, children)));
|
|
47
|
+
};
|
|
48
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchAutoComplete);
|
|
49
|
+
//# sourceMappingURL=SearchAutoComplete.js.map
|
|
50
|
+
|
|
51
|
+
/***/ }),
|
|
52
|
+
|
|
53
|
+
/***/ 6254:
|
|
54
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
55
|
+
|
|
56
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
57
|
+
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
58
|
+
/* harmony export */ });
|
|
59
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
60
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
61
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6389);
|
|
62
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7865);
|
|
63
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5045);
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
function formatSearchTerm(indexSubstring, searchTerm, suggestion) {
|
|
67
|
+
if (indexSubstring === 0) {
|
|
68
|
+
return searchTerm
|
|
69
|
+
.split('')
|
|
70
|
+
.map((char, idx) => idx === 0 && suggestion.indexOf(char.toUpperCase()) === 0
|
|
71
|
+
? char.toUpperCase()
|
|
72
|
+
: char.toLowerCase())
|
|
73
|
+
.join('');
|
|
74
|
+
}
|
|
75
|
+
return searchTerm.toLowerCase();
|
|
76
|
+
}
|
|
77
|
+
const SearchAutoCompleteTerm = ({ testId = 'fs-search-auto-complete-term', suggestion, term, linkProps, icon, }) => {
|
|
78
|
+
const autoCompleteIcon = icon ? icon : react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, null);
|
|
79
|
+
const suggestionSubstring = suggestion.toLowerCase().split(term.toLowerCase());
|
|
80
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", { "data-fs-search-auto-complete-item": true, "data-testid": testId },
|
|
81
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { ...linkProps, "data-fs-search-auto-complete-item-link": true, variant: "display" },
|
|
82
|
+
autoCompleteIcon && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { component: autoCompleteIcon, "data-fs-search-auto-complete-item-icon": true })),
|
|
83
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, suggestionSubstring.map((substring, indexSubstring) => (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, { key: [substring, indexSubstring].join() },
|
|
84
|
+
substring.length > 0 && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("strong", { "data-fs-search-auto-complete-item-suggestion": true }, indexSubstring === 0
|
|
85
|
+
? substring.charAt(0).toUpperCase() + substring.slice(1)
|
|
86
|
+
: substring)),
|
|
87
|
+
indexSubstring !== suggestionSubstring.length - 1 &&
|
|
88
|
+
formatSearchTerm(indexSubstring, term, suggestion))))))));
|
|
89
|
+
};
|
|
90
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchAutoCompleteTerm);
|
|
91
|
+
//# sourceMappingURL=SearchAutoCompleteTerm.js.map
|
|
92
|
+
|
|
93
|
+
/***/ }),
|
|
94
|
+
|
|
95
|
+
/***/ 6780:
|
|
96
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
97
|
+
|
|
98
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
99
|
+
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
100
|
+
/* harmony export */ });
|
|
101
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
102
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
103
|
+
/* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2155);
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
const SearchLoading = () => {
|
|
107
|
+
const { inContext, values } = (0,_hooks__WEBPACK_IMPORTED_MODULE_1__/* .useSearch */ .R)();
|
|
108
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, (inContext && values.isLoading) && react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", { "data-fs-search-dropdown-loading-text": true }, "Loading...")));
|
|
109
|
+
};
|
|
110
|
+
const SearchDropdown = (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function SearchDropdown({ testId = 'fs-search-dropdown', children, ...otherProps }, ref) {
|
|
111
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { ref: ref, "data-fs-search-dropdown": true, "data-testid": testId, ...otherProps },
|
|
112
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement("section", null,
|
|
113
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(SearchLoading, null),
|
|
114
|
+
children)));
|
|
115
|
+
});
|
|
116
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchDropdown);
|
|
117
|
+
//# sourceMappingURL=SearchDropdown.js.map
|
|
118
|
+
|
|
119
|
+
/***/ }),
|
|
120
|
+
|
|
121
|
+
/***/ 7510:
|
|
122
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
123
|
+
|
|
124
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
125
|
+
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
126
|
+
/* harmony export */ });
|
|
127
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
128
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
129
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2155);
|
|
130
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1329);
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
const SearchProductsProps = ({ testId = 'fs-search-products', title = 'Suggested Products', children, ...otherProps }) => {
|
|
134
|
+
const { inContext, values } = (0,___WEBPACK_IMPORTED_MODULE_1__/* .useSearch */ .R)();
|
|
135
|
+
if (inContext && (values.products.length <= 0)) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("section", { "data-testid": testId, "data-fs-search-products": true, ...otherProps },
|
|
139
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement("header", { "data-fs-search-products-header": true },
|
|
140
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", { "data-fs-search-products-title": true }, title)),
|
|
141
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { as: "ol" }, children)));
|
|
142
|
+
};
|
|
143
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchProductsProps);
|
|
144
|
+
//# sourceMappingURL=SearchProducts.js.map
|
|
145
|
+
|
|
146
|
+
/***/ }),
|
|
147
|
+
|
|
6
148
|
/***/ 2727:
|
|
7
149
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
150
|
|
|
@@ -11,15 +153,20 @@ exports.modules = {
|
|
|
11
153
|
/* harmony export */ });
|
|
12
154
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
13
155
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
14
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
156
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2155);
|
|
157
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1329);
|
|
15
158
|
|
|
16
159
|
|
|
17
160
|
|
|
18
|
-
const SearchTop = (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function SearchTop({ testId = 'fs-top-search', title = 'Top Search',
|
|
19
|
-
|
|
161
|
+
const SearchTop = (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function SearchTop({ testId = 'fs-top-search', title = 'Top Search', children, ...otherProps }, ref) {
|
|
162
|
+
const { inContext, values } = (0,___WEBPACK_IMPORTED_MODULE_1__/* .useSearch */ .R)();
|
|
163
|
+
if (inContext && (values.term.length !== 0 || values.isLoading)) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("section", { ref: ref, "data-testid": testId, "data-fs-search-top": true, ...otherProps },
|
|
20
167
|
react__WEBPACK_IMPORTED_MODULE_0___default().createElement("header", { "data-fs-search-top-header": true },
|
|
21
168
|
react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", { "data-fs-search-top-title": true }, title)),
|
|
22
|
-
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(
|
|
169
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { as: "ol" }, children)));
|
|
23
170
|
});
|
|
24
171
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchTop);
|
|
25
172
|
//# sourceMappingURL=SearchTop.js.map
|
|
@@ -56,26 +203,25 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
56
203
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
57
204
|
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
58
205
|
/* harmony export */ });
|
|
59
|
-
/* harmony import */ var
|
|
60
|
-
/* harmony import */ var
|
|
61
|
-
/* harmony import */ var
|
|
62
|
-
/* harmony import */ var
|
|
63
|
-
/* harmony import */ var
|
|
64
|
-
/* harmony import */ var
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
206
|
+
/* harmony import */ var _faststore_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2155);
|
|
207
|
+
/* harmony import */ var _faststore_ui__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6780);
|
|
208
|
+
/* harmony import */ var _faststore_ui__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6395);
|
|
209
|
+
/* harmony import */ var _faststore_ui__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6254);
|
|
210
|
+
/* harmony import */ var _faststore_ui__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(7510);
|
|
211
|
+
/* harmony import */ var _SearchHistory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7840);
|
|
212
|
+
/* harmony import */ var _SearchTop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(107);
|
|
213
|
+
/* harmony import */ var src_components_search_SearchProductItem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2387);
|
|
214
|
+
/* harmony import */ var src_sdk_search_formatSearchPath__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(5882);
|
|
215
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(997);
|
|
216
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__);
|
|
217
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_SearchTop__WEBPACK_IMPORTED_MODULE_1__]);
|
|
218
|
+
_SearchTop__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
69
219
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
70
220
|
|
|
71
221
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
72
222
|
|
|
73
223
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
74
224
|
|
|
75
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
76
|
-
|
|
77
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
78
|
-
|
|
79
225
|
|
|
80
226
|
|
|
81
227
|
|
|
@@ -85,44 +231,37 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
85
231
|
|
|
86
232
|
|
|
87
233
|
function SearchDropdown(_ref) {
|
|
88
|
-
let {
|
|
89
|
-
term = '',
|
|
90
|
-
style
|
|
91
|
-
} = _ref,
|
|
92
|
-
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
93
|
-
|
|
234
|
+
let otherProps = Object.assign({}, _ref);
|
|
94
235
|
const {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
})]
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
products: products
|
|
125
|
-
}, otherProps));
|
|
236
|
+
values: {
|
|
237
|
+
onSearchSelection,
|
|
238
|
+
products,
|
|
239
|
+
term,
|
|
240
|
+
terms
|
|
241
|
+
}
|
|
242
|
+
} = (0,_faststore_ui__WEBPACK_IMPORTED_MODULE_4__/* .useSearch */ .R)();
|
|
243
|
+
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_faststore_ui__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
244
|
+
children: [/*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx(_SearchHistory__WEBPACK_IMPORTED_MODULE_0__/* .SearchHistory */ .Z, {}), /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx(_SearchTop__WEBPACK_IMPORTED_MODULE_1__/* .SearchTop */ .S, {}), /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx(_faststore_ui__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
|
|
245
|
+
children: terms?.map(({
|
|
246
|
+
value: suggestion
|
|
247
|
+
}) => /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx(_faststore_ui__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
|
|
248
|
+
term: term,
|
|
249
|
+
suggestion: suggestion,
|
|
250
|
+
linkProps: {
|
|
251
|
+
href: (0,src_sdk_search_formatSearchPath__WEBPACK_IMPORTED_MODULE_8__/* .formatSearchPath */ .u)(suggestion),
|
|
252
|
+
onClick: () => onSearchSelection?.(suggestion, (0,src_sdk_search_formatSearchPath__WEBPACK_IMPORTED_MODULE_8__/* .formatSearchPath */ .u)(suggestion))
|
|
253
|
+
}
|
|
254
|
+
}, suggestion))
|
|
255
|
+
}), /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx(_faststore_ui__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
256
|
+
children: products.map((product, index) => {
|
|
257
|
+
const productParsed = product;
|
|
258
|
+
return /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx(src_components_search_SearchProductItem__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
|
|
259
|
+
product: productParsed,
|
|
260
|
+
index: index
|
|
261
|
+
}, productParsed.id);
|
|
262
|
+
})
|
|
263
|
+
})]
|
|
264
|
+
}));
|
|
126
265
|
}
|
|
127
266
|
|
|
128
267
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchDropdown);
|
|
@@ -157,6 +296,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
157
296
|
"Z": () => (/* reexport */ search_SearchHistory_SearchHistory)
|
|
158
297
|
});
|
|
159
298
|
|
|
299
|
+
// EXTERNAL MODULE: ../components/dist/hooks/useSearch.js
|
|
300
|
+
var useSearch = __webpack_require__(2155);
|
|
160
301
|
// EXTERNAL MODULE: external "react"
|
|
161
302
|
var external_react_ = __webpack_require__(6689);
|
|
162
303
|
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
@@ -168,6 +309,10 @@ var List = __webpack_require__(1329);
|
|
|
168
309
|
|
|
169
310
|
|
|
170
311
|
const SearchHistory = ({ testId = 'fs-search-history', title = 'History', clearLabel = 'Clear History', onClear, children, ...otherProps }) => {
|
|
312
|
+
const { inContext, values } = (0,useSearch/* useSearch */.R)();
|
|
313
|
+
if (inContext && (values.term.length !== 0 || values.isLoading)) {
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
171
316
|
return (external_react_default().createElement("section", { "data-testid": testId, "data-fs-search-history": true, ...otherProps },
|
|
172
317
|
external_react_default().createElement("header", { "data-fs-search-history-header": true },
|
|
173
318
|
external_react_default().createElement("p", { "data-fs-search-history-title": true }, title),
|
|
@@ -205,8 +350,6 @@ const SearchHistoryTerm = ({ testId = 'fs-search-history-term', value, linkProps
|
|
|
205
350
|
//# sourceMappingURL=SearchHistoryTerm.js.map
|
|
206
351
|
// EXTERNAL MODULE: ./src/sdk/search/useSearchHistory.ts
|
|
207
352
|
var useSearchHistory = __webpack_require__(5098);
|
|
208
|
-
// EXTERNAL MODULE: ./src/sdk/search/useSearchInput.tsx
|
|
209
|
-
var useSearchInput = __webpack_require__(3588);
|
|
210
353
|
// EXTERNAL MODULE: external "react/jsx-runtime"
|
|
211
354
|
var jsx_runtime_ = __webpack_require__(997);
|
|
212
355
|
;// CONCATENATED MODULE: ./src/components/search/SearchHistory/SearchHistory.tsx
|
|
@@ -220,12 +363,13 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
220
363
|
|
|
221
364
|
|
|
222
365
|
|
|
223
|
-
|
|
224
366
|
const SearchHistory_SearchHistory_SearchHistory = _ref => {
|
|
225
367
|
let props = Object.assign({}, _ref);
|
|
226
368
|
const {
|
|
227
|
-
|
|
228
|
-
|
|
369
|
+
values: {
|
|
370
|
+
onSearchSelection
|
|
371
|
+
}
|
|
372
|
+
} = (0,useSearch/* useSearch */.R)();
|
|
229
373
|
const {
|
|
230
374
|
searchHistory,
|
|
231
375
|
clearSearchHistory
|
|
@@ -243,7 +387,7 @@ const SearchHistory_SearchHistory_SearchHistory = _ref => {
|
|
|
243
387
|
value: item.term,
|
|
244
388
|
linkProps: {
|
|
245
389
|
href: item.path,
|
|
246
|
-
onClick: () =>
|
|
390
|
+
onClick: () => onSearchSelection?.(item.term, item.path)
|
|
247
391
|
}
|
|
248
392
|
}, item.term))
|
|
249
393
|
}));
|
|
@@ -255,82 +399,22 @@ const SearchHistory_SearchHistory_SearchHistory = _ref => {
|
|
|
255
399
|
|
|
256
400
|
/***/ }),
|
|
257
401
|
|
|
258
|
-
/***/
|
|
402
|
+
/***/ 2387:
|
|
259
403
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
260
404
|
|
|
261
405
|
|
|
262
406
|
// EXPORTS
|
|
263
407
|
__webpack_require__.d(__webpack_exports__, {
|
|
264
|
-
"Z": () => (/* reexport */
|
|
408
|
+
"Z": () => (/* reexport */ search_SearchProductItem_SearchProductItem)
|
|
265
409
|
});
|
|
266
410
|
|
|
411
|
+
// EXTERNAL MODULE: ../components/dist/hooks/useSearch.js
|
|
412
|
+
var useSearch = __webpack_require__(2155);
|
|
267
413
|
// EXTERNAL MODULE: external "react"
|
|
268
414
|
var external_react_ = __webpack_require__(6689);
|
|
269
415
|
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
270
|
-
// EXTERNAL MODULE: ../components/dist/atoms/List/List.js
|
|
271
|
-
var List = __webpack_require__(1329);
|
|
272
|
-
;// CONCATENATED MODULE: ../components/dist/molecules/SearchAutoComplete/SearchAutoComplete.js
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
const SearchAutoComplete = ({ testId = 'fs-search-auto-complete', children, ...otherProps }) => {
|
|
276
|
-
return (external_react_default().createElement("section", { "data-testid": testId, "data-fs-search-auto-complete": true, ...otherProps },
|
|
277
|
-
external_react_default().createElement(List/* default */.Z, { as: "ol" }, children)));
|
|
278
|
-
};
|
|
279
|
-
/* harmony default export */ const SearchAutoComplete_SearchAutoComplete = (SearchAutoComplete);
|
|
280
|
-
//# sourceMappingURL=SearchAutoComplete.js.map
|
|
281
|
-
;// CONCATENATED MODULE: ../components/dist/assets/MagnifyingGlass.js
|
|
282
|
-
|
|
283
|
-
// Icon from Phosphor Icons
|
|
284
|
-
const MagnifyingGlass = () => (external_react_default().createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 256 256", strokeWidth: "16", width: 24, height: 24 },
|
|
285
|
-
external_react_default().createElement("rect", { width: "256", height: "256", fill: "none" }),
|
|
286
|
-
external_react_default().createElement("circle", { cx: "116", cy: "116", r: "84", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "16" }),
|
|
287
|
-
external_react_default().createElement("line", { x1: "175.4", y1: "175.4", x2: "224", y2: "224", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "16" })));
|
|
288
|
-
/* harmony default export */ const assets_MagnifyingGlass = (MagnifyingGlass);
|
|
289
|
-
//# sourceMappingURL=MagnifyingGlass.js.map
|
|
290
416
|
// EXTERNAL MODULE: ../components/dist/atoms/Link/Link.js
|
|
291
417
|
var Link = __webpack_require__(7865);
|
|
292
|
-
// EXTERNAL MODULE: ../components/dist/atoms/Icon/Icon.js
|
|
293
|
-
var Icon = __webpack_require__(5045);
|
|
294
|
-
;// CONCATENATED MODULE: ../components/dist/molecules/SearchAutoComplete/SearchAutoCompleteTerm.js
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
function formatSearchTerm(indexSubstring, searchTerm, suggestion) {
|
|
298
|
-
if (indexSubstring === 0) {
|
|
299
|
-
return searchTerm
|
|
300
|
-
.split('')
|
|
301
|
-
.map((char, idx) => idx === 0 && suggestion.indexOf(char.toUpperCase()) === 0
|
|
302
|
-
? char.toUpperCase()
|
|
303
|
-
: char.toLowerCase())
|
|
304
|
-
.join('');
|
|
305
|
-
}
|
|
306
|
-
return searchTerm.toLowerCase();
|
|
307
|
-
}
|
|
308
|
-
const SearchAutoCompleteTerm = ({ testId = 'fs-search-auto-complete-term', suggestion, term, linkProps, icon, }) => {
|
|
309
|
-
const autoCompleteIcon = icon ? icon : external_react_default().createElement(assets_MagnifyingGlass, null);
|
|
310
|
-
const suggestionSubstring = suggestion.toLowerCase().split(term.toLowerCase());
|
|
311
|
-
return (external_react_default().createElement("li", { "data-fs-search-auto-complete-item": true, "data-testid": testId },
|
|
312
|
-
external_react_default().createElement(Link/* default */.Z, { ...linkProps, "data-fs-search-auto-complete-item-link": true, variant: "display" },
|
|
313
|
-
autoCompleteIcon && (external_react_default().createElement(Icon/* default */.Z, { component: autoCompleteIcon, "data-fs-search-auto-complete-item-icon": true })),
|
|
314
|
-
external_react_default().createElement("p", null, suggestionSubstring.map((substring, indexSubstring) => (external_react_default().createElement(external_react_.Fragment, { key: [substring, indexSubstring].join() },
|
|
315
|
-
substring.length > 0 && (external_react_default().createElement("strong", { "data-fs-search-auto-complete-item-suggestion": true }, indexSubstring === 0
|
|
316
|
-
? substring.charAt(0).toUpperCase() + substring.slice(1)
|
|
317
|
-
: substring)),
|
|
318
|
-
indexSubstring !== suggestionSubstring.length - 1 &&
|
|
319
|
-
formatSearchTerm(indexSubstring, term, suggestion))))))));
|
|
320
|
-
};
|
|
321
|
-
/* harmony default export */ const SearchAutoComplete_SearchAutoCompleteTerm = (SearchAutoCompleteTerm);
|
|
322
|
-
//# sourceMappingURL=SearchAutoCompleteTerm.js.map
|
|
323
|
-
;// CONCATENATED MODULE: ../components/dist/molecules/SearchProducts/SearchProducts.js
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
const SearchProductsProps = ({ testId = 'fs-search-products', title = 'Suggested Products', children, ...otherProps }) => {
|
|
327
|
-
return (external_react_default().createElement("section", { "data-testid": testId, "data-fs-search-products": true, ...otherProps },
|
|
328
|
-
external_react_default().createElement("header", { "data-fs-search-products-header": true },
|
|
329
|
-
external_react_default().createElement("p", { "data-fs-search-products-title": true }, title)),
|
|
330
|
-
external_react_default().createElement(List/* default */.Z, { as: "ol" }, children)));
|
|
331
|
-
};
|
|
332
|
-
/* harmony default export */ const SearchProducts = (SearchProductsProps);
|
|
333
|
-
//# sourceMappingURL=SearchProducts.js.map
|
|
334
418
|
;// CONCATENATED MODULE: ../components/dist/molecules/SearchProducts/SearchProductItem.js
|
|
335
419
|
|
|
336
420
|
|
|
@@ -367,8 +451,6 @@ var Image = __webpack_require__(2154);
|
|
|
367
451
|
var useFormattedPrice = __webpack_require__(5346);
|
|
368
452
|
// EXTERNAL MODULE: ./src/sdk/product/useProductLink.ts
|
|
369
453
|
var useProductLink = __webpack_require__(9854);
|
|
370
|
-
// EXTERNAL MODULE: ./src/sdk/search/useSearchInput.tsx
|
|
371
|
-
var useSearchInput = __webpack_require__(3588);
|
|
372
454
|
// EXTERNAL MODULE: external "react/jsx-runtime"
|
|
373
455
|
var jsx_runtime_ = __webpack_require__(997);
|
|
374
456
|
;// CONCATENATED MODULE: ./src/components/search/SearchProductItem/SearchProductItem.tsx
|
|
@@ -392,7 +474,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
392
474
|
|
|
393
475
|
|
|
394
476
|
|
|
395
|
-
|
|
396
477
|
function SearchProductItem_SearchProductItem(_ref) {
|
|
397
478
|
let {
|
|
398
479
|
product,
|
|
@@ -401,8 +482,10 @@ function SearchProductItem_SearchProductItem(_ref) {
|
|
|
401
482
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
402
483
|
|
|
403
484
|
const {
|
|
404
|
-
|
|
405
|
-
|
|
485
|
+
values: {
|
|
486
|
+
onSearchSelection
|
|
487
|
+
}
|
|
488
|
+
} = (0,useSearch/* useSearch */.R)();
|
|
406
489
|
|
|
407
490
|
const _useProductLink = (0,useProductLink/* useProductLink */.w)({
|
|
408
491
|
product,
|
|
@@ -432,7 +515,7 @@ function SearchProductItem_SearchProductItem(_ref) {
|
|
|
432
515
|
href,
|
|
433
516
|
onClick: () => {
|
|
434
517
|
onClick();
|
|
435
|
-
|
|
518
|
+
onSearchSelection?.(name, href);
|
|
436
519
|
}
|
|
437
520
|
}, baseLinkProps);
|
|
438
521
|
|
|
@@ -460,71 +543,6 @@ function SearchProductItem_SearchProductItem(_ref) {
|
|
|
460
543
|
/* harmony default export */ const search_SearchProductItem_SearchProductItem = (SearchProductItem_SearchProductItem);
|
|
461
544
|
;// CONCATENATED MODULE: ./src/components/search/SearchProductItem/index.ts
|
|
462
545
|
|
|
463
|
-
// EXTERNAL MODULE: ./src/components/search/search.module.scss
|
|
464
|
-
var search_module = __webpack_require__(4850);
|
|
465
|
-
var search_module_default = /*#__PURE__*/__webpack_require__.n(search_module);
|
|
466
|
-
;// CONCATENATED MODULE: ./src/components/search/SearchSuggestions/SearchSuggestions.tsx
|
|
467
|
-
const SearchSuggestions_excluded = ["testId", "term", "terms", "products"];
|
|
468
|
-
|
|
469
|
-
function SearchSuggestions_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
470
|
-
|
|
471
|
-
function SearchSuggestions_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? SearchSuggestions_ownKeys(Object(source), !0).forEach(function (key) { SearchSuggestions_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : SearchSuggestions_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
472
|
-
|
|
473
|
-
function SearchSuggestions_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
474
|
-
|
|
475
|
-
function SearchSuggestions_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = SearchSuggestions_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
476
|
-
|
|
477
|
-
function SearchSuggestions_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
function SearchSuggestions(_ref) {
|
|
487
|
-
let {
|
|
488
|
-
testId = 'suggestions',
|
|
489
|
-
term = '',
|
|
490
|
-
terms = [],
|
|
491
|
-
products = []
|
|
492
|
-
} = _ref,
|
|
493
|
-
otherProps = SearchSuggestions_objectWithoutProperties(_ref, SearchSuggestions_excluded);
|
|
494
|
-
|
|
495
|
-
const {
|
|
496
|
-
onSearchInputSelection
|
|
497
|
-
} = (0,useSearchInput/* default */.ZP)();
|
|
498
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsxs)("section", SearchSuggestions_objectSpread(SearchSuggestions_objectSpread({
|
|
499
|
-
"data-testid": testId,
|
|
500
|
-
"data-fs-search": true,
|
|
501
|
-
className: (search_module_default()).fsSearch
|
|
502
|
-
}, otherProps), {}, {
|
|
503
|
-
children: [terms.length > 0 && /*#__PURE__*/jsx_runtime_.jsx(SearchAutoComplete_SearchAutoComplete, {
|
|
504
|
-
"data-fs-search-section": true,
|
|
505
|
-
children: terms?.map(({
|
|
506
|
-
value: suggestion
|
|
507
|
-
}) => /*#__PURE__*/jsx_runtime_.jsx(SearchAutoComplete_SearchAutoCompleteTerm, {
|
|
508
|
-
term: term,
|
|
509
|
-
suggestion: suggestion,
|
|
510
|
-
linkProps: {
|
|
511
|
-
href: (0,useSearchInput/* formatSearchPath */.uc)(suggestion),
|
|
512
|
-
onClick: () => onSearchInputSelection?.(suggestion, (0,useSearchInput/* formatSearchPath */.uc)(suggestion))
|
|
513
|
-
}
|
|
514
|
-
}, suggestion))
|
|
515
|
-
}), products.length > 0 && /*#__PURE__*/jsx_runtime_.jsx(SearchProducts, {
|
|
516
|
-
"data-fs-search-section": true,
|
|
517
|
-
children: products.map((product, index) => /*#__PURE__*/jsx_runtime_.jsx(search_SearchProductItem_SearchProductItem, {
|
|
518
|
-
product: product,
|
|
519
|
-
index: index
|
|
520
|
-
}, product.id))
|
|
521
|
-
})]
|
|
522
|
-
}));
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
/* harmony default export */ const SearchSuggestions_SearchSuggestions = (SearchSuggestions);
|
|
526
|
-
;// CONCATENATED MODULE: ./src/components/search/SearchSuggestions/index.ts
|
|
527
|
-
|
|
528
546
|
|
|
529
547
|
/***/ }),
|
|
530
548
|
|
|
@@ -535,14 +553,15 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
535
553
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
536
554
|
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
537
555
|
/* harmony export */ });
|
|
556
|
+
/* harmony import */ var _faststore_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2155);
|
|
538
557
|
/* harmony import */ var _faststore_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2727);
|
|
539
558
|
/* harmony import */ var _faststore_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5629);
|
|
540
|
-
/* harmony import */ var
|
|
541
|
-
/* harmony import */ var
|
|
542
|
-
/* harmony import */ var
|
|
543
|
-
/* harmony import */ var
|
|
544
|
-
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
545
|
-
|
|
559
|
+
/* harmony import */ var src_sdk_search_formatSearchPath__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5882);
|
|
560
|
+
/* harmony import */ var src_sdk_search_useTopSearch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1363);
|
|
561
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(997);
|
|
562
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
|
|
563
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([src_sdk_search_useTopSearch__WEBPACK_IMPORTED_MODULE_0__]);
|
|
564
|
+
src_sdk_search_useTopSearch__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
546
565
|
const _excluded = ["topTerms"];
|
|
547
566
|
|
|
548
567
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -567,27 +586,27 @@ function SearchTop(_ref) {
|
|
|
567
586
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
568
587
|
|
|
569
588
|
const {
|
|
570
|
-
|
|
571
|
-
|
|
589
|
+
values: {
|
|
590
|
+
onSearchSelection
|
|
591
|
+
}
|
|
592
|
+
} = (0,_faststore_ui__WEBPACK_IMPORTED_MODULE_2__/* .useSearch */ .R)();
|
|
572
593
|
const {
|
|
573
|
-
terms
|
|
574
|
-
|
|
575
|
-
} = (0,src_sdk_search_useTopSearch__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(topTerms);
|
|
594
|
+
terms
|
|
595
|
+
} = (0,src_sdk_search_useTopSearch__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(topTerms);
|
|
576
596
|
|
|
577
597
|
if (terms.length === 0) {
|
|
578
598
|
return null;
|
|
579
599
|
}
|
|
580
600
|
|
|
581
|
-
return /*#__PURE__*/
|
|
582
|
-
title: "Top Search"
|
|
583
|
-
isLoading: isLoading
|
|
601
|
+
return /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx(_faststore_ui__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, _objectSpread(_objectSpread({
|
|
602
|
+
title: "Top Search"
|
|
584
603
|
}, otherProps), {}, {
|
|
585
|
-
children: terms.map((term, index) => /*#__PURE__*/
|
|
604
|
+
children: terms.map((term, index) => /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx(_faststore_ui__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
|
|
586
605
|
value: term.value,
|
|
587
606
|
index: index,
|
|
588
607
|
linkProps: {
|
|
589
|
-
href: (0,
|
|
590
|
-
onClick: () =>
|
|
608
|
+
href: (0,src_sdk_search_formatSearchPath__WEBPACK_IMPORTED_MODULE_5__/* .formatSearchPath */ .u)(term.value),
|
|
609
|
+
onClick: () => onSearchSelection?.(term.value, (0,src_sdk_search_formatSearchPath__WEBPACK_IMPORTED_MODULE_5__/* .formatSearchPath */ .u)(term.value))
|
|
591
610
|
}
|
|
592
611
|
}, index))
|
|
593
612
|
}));
|
|
@@ -615,53 +634,6 @@ __webpack_async_result__();
|
|
|
615
634
|
|
|
616
635
|
/***/ }),
|
|
617
636
|
|
|
618
|
-
/***/ 6344:
|
|
619
|
-
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
620
|
-
|
|
621
|
-
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
|
|
622
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
623
|
-
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
624
|
-
/* harmony export */ });
|
|
625
|
-
/* harmony import */ var src_sdk_graphql_useQuery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7732);
|
|
626
|
-
/* harmony import */ var _session__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5971);
|
|
627
|
-
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([src_sdk_graphql_useQuery__WEBPACK_IMPORTED_MODULE_0__]);
|
|
628
|
-
src_sdk_graphql_useQuery__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
const MAX_SUGGESTIONS = 5;
|
|
632
|
-
const query = "SearchSuggestionsQuery";
|
|
633
|
-
|
|
634
|
-
function useSuggestions(term, limit = MAX_SUGGESTIONS) {
|
|
635
|
-
const {
|
|
636
|
-
channel,
|
|
637
|
-
locale
|
|
638
|
-
} = (0,_session__WEBPACK_IMPORTED_MODULE_1__/* .useSession */ .kP)();
|
|
639
|
-
const {
|
|
640
|
-
data,
|
|
641
|
-
error
|
|
642
|
-
} = (0,src_sdk_graphql_useQuery__WEBPACK_IMPORTED_MODULE_0__/* .useQuery */ .aM)(query, {
|
|
643
|
-
term,
|
|
644
|
-
selectedFacets: [{
|
|
645
|
-
key: 'channel',
|
|
646
|
-
value: channel ?? ''
|
|
647
|
-
}, {
|
|
648
|
-
key: 'locale',
|
|
649
|
-
value: locale
|
|
650
|
-
}]
|
|
651
|
-
});
|
|
652
|
-
return {
|
|
653
|
-
terms: (data?.search.suggestions.terms ?? []).slice(0, limit),
|
|
654
|
-
products: (data?.search.suggestions.products ?? []).slice(0, limit),
|
|
655
|
-
isLoading: !error && !data
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useSuggestions);
|
|
660
|
-
__webpack_async_result__();
|
|
661
|
-
} catch(e) { __webpack_async_result__(e); } });
|
|
662
|
-
|
|
663
|
-
/***/ }),
|
|
664
|
-
|
|
665
637
|
/***/ 1363:
|
|
666
638
|
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
667
639
|
|