@nuskin/nextgen-header 1.25.0 → 1.27.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/package-dist/index.js +3613 -558
- package/package-dist/index.js.map +1 -1
- package/package-dist/index.mjs +3611 -558
- package/package-dist/index.mjs.map +1 -1
- package/package.json +1 -5
package/package-dist/index.js
CHANGED
|
@@ -1791,6 +1791,27 @@ var _default = exports["default"] = (0, _createSvgIcon.default)( /*#__PURE__*/(0
|
|
|
1791
1791
|
|
|
1792
1792
|
/***/ },
|
|
1793
1793
|
|
|
1794
|
+
/***/ 9781
|
|
1795
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
1796
|
+
|
|
1797
|
+
"use strict";
|
|
1798
|
+
var __webpack_unused_export__;
|
|
1799
|
+
|
|
1800
|
+
"use client";
|
|
1801
|
+
|
|
1802
|
+
var _interopRequireDefault = __webpack_require__(4994);
|
|
1803
|
+
__webpack_unused_export__ = ({
|
|
1804
|
+
value: true
|
|
1805
|
+
});
|
|
1806
|
+
exports.A = void 0;
|
|
1807
|
+
var _createSvgIcon = _interopRequireDefault(__webpack_require__(2032));
|
|
1808
|
+
var _jsxRuntime = __webpack_require__(8732);
|
|
1809
|
+
var _default = exports.A = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
1810
|
+
d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
|
1811
|
+
}), 'Close');
|
|
1812
|
+
|
|
1813
|
+
/***/ },
|
|
1814
|
+
|
|
1794
1815
|
/***/ 5273
|
|
1795
1816
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
1796
1817
|
|
|
@@ -1811,6 +1832,27 @@ var _default = exports["default"] = (0, _createSvgIcon.default)( /*#__PURE__*/(0
|
|
|
1811
1832
|
|
|
1812
1833
|
/***/ },
|
|
1813
1834
|
|
|
1835
|
+
/***/ 4745
|
|
1836
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
1837
|
+
|
|
1838
|
+
"use strict";
|
|
1839
|
+
var __webpack_unused_export__;
|
|
1840
|
+
|
|
1841
|
+
"use client";
|
|
1842
|
+
|
|
1843
|
+
var _interopRequireDefault = __webpack_require__(4994);
|
|
1844
|
+
__webpack_unused_export__ = ({
|
|
1845
|
+
value: true
|
|
1846
|
+
});
|
|
1847
|
+
exports.A = void 0;
|
|
1848
|
+
var _createSvgIcon = _interopRequireDefault(__webpack_require__(2032));
|
|
1849
|
+
var _jsxRuntime = __webpack_require__(8732);
|
|
1850
|
+
var _default = exports.A = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
1851
|
+
d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"
|
|
1852
|
+
}), 'Search');
|
|
1853
|
+
|
|
1854
|
+
/***/ },
|
|
1855
|
+
|
|
1814
1856
|
/***/ 2032
|
|
1815
1857
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
1816
1858
|
|
|
@@ -100560,6 +100602,7 @@ var colors = {
|
|
|
100560
100602
|
text: "#111827",
|
|
100561
100603
|
muted: "#6b7280",
|
|
100562
100604
|
navActive: "#111827",
|
|
100605
|
+
hover: "#f3f4f6",
|
|
100563
100606
|
accent: "#0f766e",
|
|
100564
100607
|
accentHover: "#0d9488"
|
|
100565
100608
|
};
|
|
@@ -100691,7 +100734,7 @@ var MobileMenuButton = /*#__PURE__*/createStyled("button", true ? {
|
|
|
100691
100734
|
} : 0)("display:flex;align-items:center;justify-content:center;margin:0;padding:0.5rem;border:none;background:transparent;color:", colors.text, ";cursor:pointer;transition:background 0.15s ease;&:hover{background:rgba(0, 0, 0, 0.05);}@media (min-width: 1025px){display:none;}" + ( true ? "" : 0));
|
|
100692
100735
|
var MobileUtilityBar = /*#__PURE__*/createStyled("div", true ? {
|
|
100693
100736
|
target: "e1607tyl11"
|
|
100694
|
-
} : 0)("display:flex;align-items:center;gap:1rem;margin-left:auto;font-size:1rem;@media (min-width: 1025px){display:none;}button{display:flex;align-items:center;padding:0;background:none;border:none;color:", colors.text, ";cursor:pointer;font-size:1rem;svg{width:24px;height:24px;}}" + ( true ? "" : 0));
|
|
100737
|
+
} : 0)("display:flex;align-items:center;gap:1rem;margin-left:auto;font-size:1rem;@media (min-width: 1025px){display:none;}[data-region=\"account\"] button,[data-region=\"cart\"] button{display:flex;align-items:center;padding:0;background:none;border:none;color:", colors.text, ";cursor:pointer;font-size:1rem;svg{width:24px;height:24px;}}" + ( true ? "" : 0));
|
|
100695
100738
|
var MobileDrawer = /*#__PURE__*/createStyled("div", true ? {
|
|
100696
100739
|
target: "e1607tyl10"
|
|
100697
100740
|
} : 0)( true ? {
|
|
@@ -100807,7 +100850,8 @@ var live_preview_utils_default = /*#__PURE__*/__webpack_require__.n(live_preview
|
|
|
100807
100850
|
const utils_namespaceObject = require("@contentstack/utils");
|
|
100808
100851
|
;// ./src/utils/constants.js
|
|
100809
100852
|
var HEADER_CONTENT_ENTRY_UID = "global_header";
|
|
100810
|
-
var
|
|
100853
|
+
var HEADER_ENTRY_URL = "/vb-header/root-header";
|
|
100854
|
+
var referenceFields = (/* unused pure expression or super */ null && (["top_navigation", "top_navigation.menu_items.menu_item", "top_navigation.menu_items.menu_item.sub_categories.category_section.items.product_category.category", "market_selector.regions.markets.languages", "utility_links", "utility_links.loyalty_menu", "product_search", "product_search", "market_selector.regions.markets.languages", "product_search"]));
|
|
100811
100855
|
var CONTENTSTACK_API_KEY = process.env.CONTENTSTACK_API_KEY;
|
|
100812
100856
|
var CONTENTSTACK_DELIVERY_TOKEN = process.env.CONTENTSTACK_DELIVERY_TOKEN;
|
|
100813
100857
|
var CONTENTSTACK_ENVIRONMENT = process.env.CONTENTSTACK_ENVIRONMENT;
|
|
@@ -101131,55 +101175,233 @@ Brand.defaultProps = {
|
|
|
101131
101175
|
size: "Large",
|
|
101132
101176
|
$: null
|
|
101133
101177
|
};
|
|
101134
|
-
;// ./src/components/
|
|
101135
|
-
|
|
101136
|
-
|
|
101137
|
-
|
|
101138
|
-
|
|
101139
|
-
|
|
101140
|
-
|
|
101141
|
-
|
|
101142
|
-
|
|
101143
|
-
|
|
101144
|
-
|
|
101145
|
-
|
|
101146
|
-
|
|
101147
|
-
|
|
101148
|
-
|
|
101149
|
-
|
|
101150
|
-
|
|
101151
|
-
|
|
101152
|
-
|
|
101153
|
-
|
|
101154
|
-
|
|
101155
|
-
|
|
101156
|
-
|
|
101157
|
-
|
|
101158
|
-
|
|
101159
|
-
|
|
101160
|
-
|
|
101161
|
-
|
|
101162
|
-
|
|
101163
|
-
|
|
101164
|
-
|
|
101165
|
-
|
|
101166
|
-
|
|
101167
|
-
|
|
101168
|
-
|
|
101169
|
-
|
|
101170
|
-
|
|
101171
|
-
|
|
101172
|
-
|
|
101173
|
-
}
|
|
101174
|
-
|
|
101175
|
-
|
|
101176
|
-
|
|
101177
|
-
|
|
101178
|
-
|
|
101179
|
-
|
|
101180
|
-
|
|
101181
|
-
|
|
101178
|
+
;// ./src/components/header/HeaderIcons.jsx
|
|
101179
|
+
/* unused harmony import specifier */ var _jsx;
|
|
101180
|
+
/* unused harmony import specifier */ var _jsxs;
|
|
101181
|
+
function HeaderIcons_typeof(o) { "@babel/helpers - typeof"; return HeaderIcons_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, HeaderIcons_typeof(o); }
|
|
101182
|
+
function HeaderIcons_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
101183
|
+
function HeaderIcons_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? HeaderIcons_ownKeys(Object(t), !0).forEach(function (r) { HeaderIcons_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : HeaderIcons_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
101184
|
+
function HeaderIcons_defineProperty(e, r, t) { return (r = HeaderIcons_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
101185
|
+
function HeaderIcons_toPropertyKey(t) { var i = HeaderIcons_toPrimitive(t, "string"); return "symbol" == HeaderIcons_typeof(i) ? i : i + ""; }
|
|
101186
|
+
function HeaderIcons_toPrimitive(t, r) { if ("object" != HeaderIcons_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != HeaderIcons_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
101187
|
+
|
|
101188
|
+
|
|
101189
|
+
/** 16–20px inline SVGs for header chrome (wireframe parity). */
|
|
101190
|
+
|
|
101191
|
+
function IconMenu(props) {
|
|
101192
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101193
|
+
width: "24",
|
|
101194
|
+
height: "24",
|
|
101195
|
+
viewBox: "0 0 24 24",
|
|
101196
|
+
fill: "none",
|
|
101197
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
101198
|
+
"aria-hidden": true
|
|
101199
|
+
}, props), {}, {
|
|
101200
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
101201
|
+
d: "M3 12h18M3 6h18M3 18h18",
|
|
101202
|
+
stroke: "currentColor",
|
|
101203
|
+
strokeWidth: "2",
|
|
101204
|
+
strokeLinecap: "round",
|
|
101205
|
+
strokeLinejoin: "round"
|
|
101206
|
+
})
|
|
101207
|
+
}));
|
|
101208
|
+
}
|
|
101209
|
+
function IconSearch(props) {
|
|
101210
|
+
return /*#__PURE__*/_jsx("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101211
|
+
width: "20",
|
|
101212
|
+
height: "20",
|
|
101213
|
+
viewBox: "0 0 24 24",
|
|
101214
|
+
fill: "none",
|
|
101215
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
101216
|
+
"aria-hidden": true
|
|
101217
|
+
}, props), {}, {
|
|
101218
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
101219
|
+
d: "M10.5 18a7.5 7.5 0 110-15 7.5 7.5 0 010 15zM16.5 16.5L21 21",
|
|
101220
|
+
stroke: "currentColor",
|
|
101221
|
+
strokeWidth: "2",
|
|
101222
|
+
strokeLinecap: "round"
|
|
101223
|
+
})
|
|
101224
|
+
}));
|
|
101225
|
+
}
|
|
101226
|
+
function IconChevronDown(props) {
|
|
101227
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101228
|
+
width: "12",
|
|
101229
|
+
height: "12",
|
|
101230
|
+
viewBox: "0 0 12 12",
|
|
101231
|
+
fill: "none",
|
|
101232
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
101233
|
+
"aria-hidden": true
|
|
101234
|
+
}, props), {}, {
|
|
101235
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
101236
|
+
d: "M2.5 4.5L6 8l3.5-3.5",
|
|
101237
|
+
stroke: "currentColor",
|
|
101238
|
+
strokeWidth: "1.5",
|
|
101239
|
+
strokeLinecap: "round",
|
|
101240
|
+
strokeLinejoin: "round"
|
|
101241
|
+
})
|
|
101242
|
+
}));
|
|
101243
|
+
}
|
|
101244
|
+
function IconUser(props) {
|
|
101245
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101246
|
+
width: "18",
|
|
101247
|
+
height: "18",
|
|
101248
|
+
viewBox: "0 0 24 24",
|
|
101249
|
+
fill: "none",
|
|
101250
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
101251
|
+
"aria-hidden": true
|
|
101252
|
+
}, props), {}, {
|
|
101253
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
101254
|
+
d: "M12 12a4 4 0 100-8 4 4 0 000 8zM4 20a8 8 0 0116 0",
|
|
101255
|
+
stroke: "currentColor",
|
|
101256
|
+
strokeWidth: "2",
|
|
101257
|
+
strokeLinecap: "round"
|
|
101258
|
+
})
|
|
101259
|
+
}));
|
|
101260
|
+
}
|
|
101261
|
+
function IconCart(props) {
|
|
101262
|
+
return /*#__PURE__*/_jsxs("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101263
|
+
width: "20",
|
|
101264
|
+
height: "20",
|
|
101265
|
+
viewBox: "0 0 24 24",
|
|
101266
|
+
fill: "none",
|
|
101267
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
101268
|
+
"aria-hidden": true
|
|
101269
|
+
}, props), {}, {
|
|
101270
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
101271
|
+
d: "M6 7h15l-2 10H8L6 7zm0 0L5 3H2",
|
|
101272
|
+
stroke: "currentColor",
|
|
101273
|
+
strokeWidth: "2",
|
|
101274
|
+
strokeLinecap: "round",
|
|
101275
|
+
strokeLinejoin: "round"
|
|
101276
|
+
}), /*#__PURE__*/_jsx("circle", {
|
|
101277
|
+
cx: "10",
|
|
101278
|
+
cy: "20",
|
|
101279
|
+
r: "1",
|
|
101280
|
+
fill: "currentColor"
|
|
101281
|
+
}), /*#__PURE__*/_jsx("circle", {
|
|
101282
|
+
cx: "18",
|
|
101283
|
+
cy: "20",
|
|
101284
|
+
r: "1",
|
|
101285
|
+
fill: "currentColor"
|
|
101286
|
+
})]
|
|
101287
|
+
}));
|
|
101288
|
+
}
|
|
101289
|
+
function IconArrowRight(props) {
|
|
101290
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101291
|
+
width: "14",
|
|
101292
|
+
height: "14",
|
|
101293
|
+
viewBox: "0 0 24 24",
|
|
101294
|
+
fill: "none",
|
|
101295
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
101296
|
+
"aria-hidden": true
|
|
101297
|
+
}, props), {}, {
|
|
101298
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
101299
|
+
d: "M5 12h14M13 5l7 7-7 7",
|
|
101300
|
+
stroke: "currentColor",
|
|
101301
|
+
strokeWidth: "2",
|
|
101302
|
+
strokeLinecap: "round",
|
|
101303
|
+
strokeLinejoin: "round"
|
|
101304
|
+
})
|
|
101305
|
+
}));
|
|
101182
101306
|
}
|
|
101307
|
+
;// ./src/components/header/MobileHeaderDrawer.jsx
|
|
101308
|
+
|
|
101309
|
+
|
|
101310
|
+
|
|
101311
|
+
|
|
101312
|
+
|
|
101313
|
+
|
|
101314
|
+
function MobileHeaderDrawer(_ref) {
|
|
101315
|
+
var _navigationData$topNa;
|
|
101316
|
+
var isOpen = _ref.isOpen,
|
|
101317
|
+
onClose = _ref.onClose,
|
|
101318
|
+
logoData = _ref.logoData,
|
|
101319
|
+
localeData = _ref.localeData,
|
|
101320
|
+
navigationData = _ref.navigationData,
|
|
101321
|
+
loyaltyData = _ref.loyaltyData,
|
|
101322
|
+
marketTriggerMountRef = _ref.marketTriggerMountRef;
|
|
101323
|
+
if (!isOpen) return null;
|
|
101324
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawer, {
|
|
101325
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerBackdrop, {
|
|
101326
|
+
onClick: onClose,
|
|
101327
|
+
"aria-label": "Close menu"
|
|
101328
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerContent, {
|
|
101329
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerHeader, {
|
|
101330
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerHeaderRow, {
|
|
101331
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerLogoSlot, {
|
|
101332
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Brand, {
|
|
101333
|
+
logo: logoData.logo,
|
|
101334
|
+
logoAlt: logoData.logoAlt,
|
|
101335
|
+
href: logoData.href,
|
|
101336
|
+
showLogo: logoData.showLogo,
|
|
101337
|
+
size: logoData.size || "Large",
|
|
101338
|
+
$: logoData.$
|
|
101339
|
+
})
|
|
101340
|
+
}), marketTriggerMountRef ? /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerMarketTriggerSlot, {
|
|
101341
|
+
ref: marketTriggerMountRef,
|
|
101342
|
+
"data-testid": "mobile-drawer-market-trigger-mount"
|
|
101343
|
+
}) : null]
|
|
101344
|
+
})
|
|
101345
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerNav, {
|
|
101346
|
+
children: [(_navigationData$topNa = navigationData.topNavItems) === null || _navigationData$topNa === void 0 ? void 0 : _navigationData$topNa.map(function (item) {
|
|
101347
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavItem, {
|
|
101348
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerNavButton, {
|
|
101349
|
+
children: [item.label, /*#__PURE__*/(0,jsx_runtime_.jsx)(IconChevronDown, {})]
|
|
101350
|
+
})
|
|
101351
|
+
}, item.id);
|
|
101352
|
+
}), (loyaltyData === null || loyaltyData === void 0 ? void 0 : loyaltyData.link_label) && /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavItem, {
|
|
101353
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavButton, {
|
|
101354
|
+
as: "a",
|
|
101355
|
+
href: loyaltyData.href,
|
|
101356
|
+
style: {
|
|
101357
|
+
justifyContent: 'flex-start'
|
|
101358
|
+
},
|
|
101359
|
+
children: loyaltyData.link_label
|
|
101360
|
+
})
|
|
101361
|
+
}), marketTriggerMountRef ? null : /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavItem, {
|
|
101362
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerLocaleButton, {
|
|
101363
|
+
children: [localeData.control_label, /*#__PURE__*/(0,jsx_runtime_.jsx)(IconChevronDown, {})]
|
|
101364
|
+
})
|
|
101365
|
+
})]
|
|
101366
|
+
})]
|
|
101367
|
+
})]
|
|
101368
|
+
});
|
|
101369
|
+
}
|
|
101370
|
+
MobileHeaderDrawer.propTypes = {
|
|
101371
|
+
isOpen: (external_prop_types_default()).bool.isRequired,
|
|
101372
|
+
onClose: (external_prop_types_default()).func.isRequired,
|
|
101373
|
+
logoData: (external_prop_types_default()).object.isRequired,
|
|
101374
|
+
localeData: (external_prop_types_default()).object.isRequired,
|
|
101375
|
+
navigationData: (external_prop_types_default()).object.isRequired,
|
|
101376
|
+
loyaltyData: (external_prop_types_default()).object,
|
|
101377
|
+
marketTriggerMountRef: external_prop_types_default().shape({
|
|
101378
|
+
current: (external_prop_types_default()).any
|
|
101379
|
+
})
|
|
101380
|
+
};
|
|
101381
|
+
;// ./src/components/header/regions/HeaderLogoRegion.jsx
|
|
101382
|
+
|
|
101383
|
+
|
|
101384
|
+
|
|
101385
|
+
|
|
101386
|
+
function HeaderLogoRegion(_ref) {
|
|
101387
|
+
var _data$aria_label;
|
|
101388
|
+
var data = _ref.data;
|
|
101389
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("div", {
|
|
101390
|
+
"data-region": "logo",
|
|
101391
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(WordmarkButton, {
|
|
101392
|
+
type: "button",
|
|
101393
|
+
"aria-label": (_data$aria_label = data.aria_label) !== null && _data$aria_label !== void 0 ? _data$aria_label : "Nu Skin home",
|
|
101394
|
+
children: data.wordmark
|
|
101395
|
+
})
|
|
101396
|
+
});
|
|
101397
|
+
}
|
|
101398
|
+
HeaderLogoRegion.propTypes = {
|
|
101399
|
+
data: external_prop_types_default().shape({
|
|
101400
|
+
wordmark: (external_prop_types_default()).string,
|
|
101401
|
+
home_href: (external_prop_types_default()).string,
|
|
101402
|
+
aria_label: (external_prop_types_default()).string
|
|
101403
|
+
})
|
|
101404
|
+
};
|
|
101183
101405
|
;// ./src/components/header/regions/HeaderLoyaltyRegion.jsx
|
|
101184
101406
|
function HeaderLoyaltyRegion_typeof(o) { "@babel/helpers - typeof"; return HeaderLoyaltyRegion_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, HeaderLoyaltyRegion_typeof(o); }
|
|
101185
101407
|
function HeaderLoyaltyRegion_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -101208,135 +101430,6 @@ HeaderLoyaltyRegion.propTypes = {
|
|
|
101208
101430
|
$: (external_prop_types_default()).object
|
|
101209
101431
|
}).isRequired
|
|
101210
101432
|
};
|
|
101211
|
-
;// ./src/components/header/HeaderIcons.jsx
|
|
101212
|
-
/* unused harmony import specifier */ var _jsxs;
|
|
101213
|
-
/* unused harmony import specifier */ var _jsx;
|
|
101214
|
-
function HeaderIcons_typeof(o) { "@babel/helpers - typeof"; return HeaderIcons_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, HeaderIcons_typeof(o); }
|
|
101215
|
-
function HeaderIcons_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
101216
|
-
function HeaderIcons_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? HeaderIcons_ownKeys(Object(t), !0).forEach(function (r) { HeaderIcons_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : HeaderIcons_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
101217
|
-
function HeaderIcons_defineProperty(e, r, t) { return (r = HeaderIcons_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
101218
|
-
function HeaderIcons_toPropertyKey(t) { var i = HeaderIcons_toPrimitive(t, "string"); return "symbol" == HeaderIcons_typeof(i) ? i : i + ""; }
|
|
101219
|
-
function HeaderIcons_toPrimitive(t, r) { if ("object" != HeaderIcons_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != HeaderIcons_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
101220
|
-
|
|
101221
|
-
|
|
101222
|
-
/** 16–20px inline SVGs for header chrome (wireframe parity). */
|
|
101223
|
-
|
|
101224
|
-
function IconMenu(props) {
|
|
101225
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101226
|
-
width: "24",
|
|
101227
|
-
height: "24",
|
|
101228
|
-
viewBox: "0 0 24 24",
|
|
101229
|
-
fill: "none",
|
|
101230
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
101231
|
-
"aria-hidden": true
|
|
101232
|
-
}, props), {}, {
|
|
101233
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
101234
|
-
d: "M3 12h18M3 6h18M3 18h18",
|
|
101235
|
-
stroke: "currentColor",
|
|
101236
|
-
strokeWidth: "2",
|
|
101237
|
-
strokeLinecap: "round",
|
|
101238
|
-
strokeLinejoin: "round"
|
|
101239
|
-
})
|
|
101240
|
-
}));
|
|
101241
|
-
}
|
|
101242
|
-
function IconSearch(props) {
|
|
101243
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101244
|
-
width: "20",
|
|
101245
|
-
height: "20",
|
|
101246
|
-
viewBox: "0 0 24 24",
|
|
101247
|
-
fill: "none",
|
|
101248
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
101249
|
-
"aria-hidden": true
|
|
101250
|
-
}, props), {}, {
|
|
101251
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
101252
|
-
d: "M10.5 18a7.5 7.5 0 110-15 7.5 7.5 0 010 15zM16.5 16.5L21 21",
|
|
101253
|
-
stroke: "currentColor",
|
|
101254
|
-
strokeWidth: "2",
|
|
101255
|
-
strokeLinecap: "round"
|
|
101256
|
-
})
|
|
101257
|
-
}));
|
|
101258
|
-
}
|
|
101259
|
-
function IconChevronDown(props) {
|
|
101260
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101261
|
-
width: "12",
|
|
101262
|
-
height: "12",
|
|
101263
|
-
viewBox: "0 0 12 12",
|
|
101264
|
-
fill: "none",
|
|
101265
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
101266
|
-
"aria-hidden": true
|
|
101267
|
-
}, props), {}, {
|
|
101268
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
101269
|
-
d: "M2.5 4.5L6 8l3.5-3.5",
|
|
101270
|
-
stroke: "currentColor",
|
|
101271
|
-
strokeWidth: "1.5",
|
|
101272
|
-
strokeLinecap: "round",
|
|
101273
|
-
strokeLinejoin: "round"
|
|
101274
|
-
})
|
|
101275
|
-
}));
|
|
101276
|
-
}
|
|
101277
|
-
function IconUser(props) {
|
|
101278
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101279
|
-
width: "18",
|
|
101280
|
-
height: "18",
|
|
101281
|
-
viewBox: "0 0 24 24",
|
|
101282
|
-
fill: "none",
|
|
101283
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
101284
|
-
"aria-hidden": true
|
|
101285
|
-
}, props), {}, {
|
|
101286
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
101287
|
-
d: "M12 12a4 4 0 100-8 4 4 0 000 8zM4 20a8 8 0 0116 0",
|
|
101288
|
-
stroke: "currentColor",
|
|
101289
|
-
strokeWidth: "2",
|
|
101290
|
-
strokeLinecap: "round"
|
|
101291
|
-
})
|
|
101292
|
-
}));
|
|
101293
|
-
}
|
|
101294
|
-
function IconCart(props) {
|
|
101295
|
-
return /*#__PURE__*/_jsxs("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101296
|
-
width: "20",
|
|
101297
|
-
height: "20",
|
|
101298
|
-
viewBox: "0 0 24 24",
|
|
101299
|
-
fill: "none",
|
|
101300
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
101301
|
-
"aria-hidden": true
|
|
101302
|
-
}, props), {}, {
|
|
101303
|
-
children: [/*#__PURE__*/_jsx("path", {
|
|
101304
|
-
d: "M6 7h15l-2 10H8L6 7zm0 0L5 3H2",
|
|
101305
|
-
stroke: "currentColor",
|
|
101306
|
-
strokeWidth: "2",
|
|
101307
|
-
strokeLinecap: "round",
|
|
101308
|
-
strokeLinejoin: "round"
|
|
101309
|
-
}), /*#__PURE__*/_jsx("circle", {
|
|
101310
|
-
cx: "10",
|
|
101311
|
-
cy: "20",
|
|
101312
|
-
r: "1",
|
|
101313
|
-
fill: "currentColor"
|
|
101314
|
-
}), /*#__PURE__*/_jsx("circle", {
|
|
101315
|
-
cx: "18",
|
|
101316
|
-
cy: "20",
|
|
101317
|
-
r: "1",
|
|
101318
|
-
fill: "currentColor"
|
|
101319
|
-
})]
|
|
101320
|
-
}));
|
|
101321
|
-
}
|
|
101322
|
-
function IconArrowRight(props) {
|
|
101323
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
101324
|
-
width: "14",
|
|
101325
|
-
height: "14",
|
|
101326
|
-
viewBox: "0 0 24 24",
|
|
101327
|
-
fill: "none",
|
|
101328
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
101329
|
-
"aria-hidden": true
|
|
101330
|
-
}, props), {}, {
|
|
101331
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
101332
|
-
d: "M5 12h14M13 5l7 7-7 7",
|
|
101333
|
-
stroke: "currentColor",
|
|
101334
|
-
strokeWidth: "2",
|
|
101335
|
-
strokeLinecap: "round",
|
|
101336
|
-
strokeLinejoin: "round"
|
|
101337
|
-
})
|
|
101338
|
-
}));
|
|
101339
|
-
}
|
|
101340
101433
|
;// ./src/components/header/regions/HeaderAccountRegion.jsx
|
|
101341
101434
|
|
|
101342
101435
|
|
|
@@ -101469,11 +101562,241 @@ HeaderCartRegion.defaultProps = {
|
|
|
101469
101562
|
data: null,
|
|
101470
101563
|
parent$: null
|
|
101471
101564
|
};
|
|
101472
|
-
|
|
101473
|
-
|
|
101565
|
+
// EXTERNAL MODULE: ./node_modules/@mui/icons-material/Close.js
|
|
101566
|
+
var Close = __webpack_require__(9781);
|
|
101567
|
+
// EXTERNAL MODULE: ./node_modules/@mui/icons-material/Search.js
|
|
101568
|
+
var Search = __webpack_require__(4745);
|
|
101569
|
+
;// ./src/components/input/Input.constants.js
|
|
101570
|
+
var INPUT_ICON_POSITIONS = {
|
|
101571
|
+
START: "start",
|
|
101572
|
+
END: "end"
|
|
101573
|
+
};
|
|
101574
|
+
var INPUT_SIZE_VARIANTS = {
|
|
101575
|
+
DEFAULT: "default",
|
|
101576
|
+
WIDE: "wide",
|
|
101577
|
+
FULL: "full"
|
|
101578
|
+
};
|
|
101579
|
+
var INPUT_SIZES = {
|
|
101580
|
+
SM: "sm",
|
|
101581
|
+
MD: "md",
|
|
101582
|
+
LG: "lg"
|
|
101583
|
+
};
|
|
101584
|
+
var DEFAULT_INPUT_ARIA_LABEL = "Search";
|
|
101585
|
+
var DEFAULT_INPUT_ICON_POSITION = INPUT_ICON_POSITIONS.START;
|
|
101586
|
+
var DEFAULT_INPUT_SIZE_VARIANT = INPUT_SIZE_VARIANTS.DEFAULT;
|
|
101587
|
+
var DEFAULT_INPUT_SIZE = INPUT_SIZES.MD;
|
|
101588
|
+
var INPUT_PLACEHOLDERS = {
|
|
101589
|
+
SHORT: "Search",
|
|
101590
|
+
LONG: "Search by product name, ingredient, benefits, or SKU"
|
|
101591
|
+
};
|
|
101592
|
+
var DEFAULT_INPUT_PLACEHOLDER_TEXT = INPUT_PLACEHOLDERS.SHORT;
|
|
101593
|
+
;// ./src/components/input/Input.utils.js
|
|
101594
|
+
|
|
101595
|
+
function normalizeInputIconPosition(icon_position) {
|
|
101596
|
+
if (icon_position === INPUT_ICON_POSITIONS.START || icon_position === INPUT_ICON_POSITIONS.END) {
|
|
101597
|
+
return icon_position;
|
|
101598
|
+
}
|
|
101599
|
+
return DEFAULT_INPUT_ICON_POSITION;
|
|
101600
|
+
}
|
|
101601
|
+
function normalizeInputSizeVariant(size_variant) {
|
|
101602
|
+
var allowed = Object.values(INPUT_SIZE_VARIANTS);
|
|
101603
|
+
if (allowed.includes(size_variant)) return size_variant;
|
|
101604
|
+
return DEFAULT_INPUT_SIZE_VARIANT;
|
|
101605
|
+
}
|
|
101606
|
+
function normalizeInputSize(size) {
|
|
101607
|
+
var allowed = Object.values(INPUT_SIZES);
|
|
101608
|
+
if (allowed.includes(size)) return size;
|
|
101609
|
+
return DEFAULT_INPUT_SIZE;
|
|
101610
|
+
}
|
|
101611
|
+
function normalizeInputPlaceholderText(placeholder_text) {
|
|
101612
|
+
if (typeof placeholder_text === "string" && placeholder_text.trim() !== "") {
|
|
101613
|
+
return placeholder_text;
|
|
101614
|
+
}
|
|
101615
|
+
return DEFAULT_INPUT_PLACEHOLDER_TEXT;
|
|
101616
|
+
}
|
|
101617
|
+
function normalizeInputValue(value) {
|
|
101618
|
+
if (typeof value === "string") return value;
|
|
101619
|
+
return "";
|
|
101620
|
+
}
|
|
101621
|
+
function focusInputEl(el) {
|
|
101622
|
+
if (!el) return;
|
|
101623
|
+
if (typeof el.focus !== "function") return;
|
|
101624
|
+
el.focus();
|
|
101625
|
+
}
|
|
101626
|
+
function blurInputEl(el) {
|
|
101627
|
+
if (!el) return;
|
|
101628
|
+
if (typeof el.blur !== "function") return;
|
|
101629
|
+
el.blur();
|
|
101630
|
+
}
|
|
101631
|
+
;// ./src/components/input/Input.theme.js
|
|
101632
|
+
var InputTheme = {
|
|
101633
|
+
colors: {
|
|
101634
|
+
background: "#ffffff",
|
|
101635
|
+
backgroundHover: "#f3f4f6",
|
|
101636
|
+
backgroundFocused: "#ffffff",
|
|
101637
|
+
border: "#BDBDBD",
|
|
101638
|
+
text: "#111827",
|
|
101639
|
+
placeholder: "#6B6B6B",
|
|
101640
|
+
icon: "#6B6B6B"
|
|
101641
|
+
},
|
|
101642
|
+
radii: {
|
|
101643
|
+
pill: "999px"
|
|
101644
|
+
},
|
|
101645
|
+
sizes: {
|
|
101646
|
+
bySize: {
|
|
101647
|
+
sm: {
|
|
101648
|
+
height: "36px",
|
|
101649
|
+
icon: "18px",
|
|
101650
|
+
fontSize: "14px",
|
|
101651
|
+
lineHeight: "20px"
|
|
101652
|
+
},
|
|
101653
|
+
md: {
|
|
101654
|
+
height: "44px",
|
|
101655
|
+
icon: "20px",
|
|
101656
|
+
fontSize: "16px",
|
|
101657
|
+
lineHeight: "24px"
|
|
101658
|
+
},
|
|
101659
|
+
lg: {
|
|
101660
|
+
height: "52px",
|
|
101661
|
+
icon: "22px",
|
|
101662
|
+
fontSize: "18px",
|
|
101663
|
+
lineHeight: "26px"
|
|
101664
|
+
}
|
|
101665
|
+
},
|
|
101666
|
+
widths: {
|
|
101667
|
+
"default": "240px",
|
|
101668
|
+
wide: "360px"
|
|
101669
|
+
}
|
|
101670
|
+
},
|
|
101671
|
+
spacing: {
|
|
101672
|
+
containerX: "12px",
|
|
101673
|
+
gap: "10px"
|
|
101674
|
+
},
|
|
101675
|
+
underline: {
|
|
101676
|
+
thickness: "1px",
|
|
101677
|
+
offset: "4px"
|
|
101678
|
+
}
|
|
101679
|
+
};
|
|
101680
|
+
;// ./src/components/input/Input.styled.js
|
|
101681
|
+
|
|
101682
|
+
|
|
101683
|
+
|
|
101684
|
+
function resolveWidth(size_variant) {
|
|
101685
|
+
if (size_variant === INPUT_SIZE_VARIANTS.FULL) return "100%";
|
|
101686
|
+
if (size_variant === INPUT_SIZE_VARIANTS.WIDE) {
|
|
101687
|
+
return InputTheme.sizes.widths.wide;
|
|
101688
|
+
}
|
|
101689
|
+
return InputTheme.sizes.widths["default"];
|
|
101690
|
+
}
|
|
101691
|
+
function resolveSizeTokens(size) {
|
|
101692
|
+
if (size === INPUT_SIZES.SM) return InputTheme.sizes.bySize.sm;
|
|
101693
|
+
if (size === INPUT_SIZES.LG) return InputTheme.sizes.bySize.lg;
|
|
101694
|
+
return InputTheme.sizes.bySize.md;
|
|
101695
|
+
}
|
|
101696
|
+
function underlineCss() {
|
|
101697
|
+
return "\n text-decoration: underline;\n text-decoration-thickness: ".concat(InputTheme.underline.thickness, ";\n text-underline-offset: ").concat(InputTheme.underline.offset, ";\n ");
|
|
101698
|
+
}
|
|
101699
|
+
var Root = /*#__PURE__*/createStyled("div", true ? {
|
|
101700
|
+
target: "ec07usz4"
|
|
101701
|
+
} : 0)("display:flex;align-items:center;box-sizing:border-box;position:relative;--input-icon-size:", function (_ref) {
|
|
101702
|
+
var $size = _ref.$size;
|
|
101703
|
+
return resolveSizeTokens($size).icon;
|
|
101704
|
+
}, ";--placeholder-left:calc(\n ", InputTheme.spacing.containerX, " + var(--input-icon-size) +\n ", InputTheme.spacing.gap, "\n );height:", function (_ref2) {
|
|
101705
|
+
var $size = _ref2.$size;
|
|
101706
|
+
return resolveSizeTokens($size).height;
|
|
101707
|
+
}, ";padding:0 ", InputTheme.spacing.containerX, ";gap:", InputTheme.spacing.gap, ";width:", function (_ref3) {
|
|
101708
|
+
var $sizeVariant = _ref3.$sizeVariant;
|
|
101709
|
+
return resolveWidth($sizeVariant);
|
|
101710
|
+
}, ";max-width:100%;border-radius:", InputTheme.radii.pill, ";background:", InputTheme.colors.background, ";border:1px solid ", InputTheme.colors.border, ";&[data-icon-position=\"end\"]{--placeholder-left:", InputTheme.spacing.containerX, ";}", function (_ref4) {
|
|
101711
|
+
var $disabled = _ref4.$disabled;
|
|
101712
|
+
if ($disabled) return "";
|
|
101713
|
+
return "\n &:focus-within {\n background: ".concat(InputTheme.colors.backgroundFocused, ";\n }\n\n &:focus-within input {\n ").concat(underlineCss(), "\n }\n\n &:focus-within [data-placeholder=\"true\"] {\n ").concat(underlineCss(), "\n }\n ");
|
|
101714
|
+
}, " ", function (_ref5) {
|
|
101715
|
+
var $focused = _ref5.$focused,
|
|
101716
|
+
$disabled = _ref5.$disabled;
|
|
101717
|
+
if (!$focused || $disabled) return "";
|
|
101718
|
+
return "\n background: ".concat(InputTheme.colors.backgroundFocused, ";\n ");
|
|
101719
|
+
}, " ", function (_ref6) {
|
|
101720
|
+
var $disabled = _ref6.$disabled;
|
|
101721
|
+
if ($disabled) return "";
|
|
101722
|
+
return "\n &:hover input {\n ".concat(underlineCss(), "\n }\n\n &:hover [data-placeholder=\"true\"] {\n ").concat(underlineCss(), "\n }\n ");
|
|
101723
|
+
}, " ", function (_ref7) {
|
|
101724
|
+
var $disabled = _ref7.$disabled;
|
|
101725
|
+
if ($disabled) return "";
|
|
101726
|
+
return "\n &:hover {\n background: ".concat(InputTheme.colors.backgroundHover, ";\n }\n ");
|
|
101727
|
+
}, " ", function (_ref8) {
|
|
101728
|
+
var $focused = _ref8.$focused,
|
|
101729
|
+
$disabled = _ref8.$disabled;
|
|
101730
|
+
return $focused && !$disabled ? "\n input {\n ".concat(underlineCss(), "\n }\n\n [data-placeholder=\"true\"] {\n ").concat(underlineCss(), "\n }\n ") : "";
|
|
101731
|
+
}, " ", function (_ref9) {
|
|
101732
|
+
var $disabled = _ref9.$disabled;
|
|
101733
|
+
return $disabled ? "\n opacity: 0.6;\n cursor: not-allowed;\n " : "\n cursor: text;\n ";
|
|
101734
|
+
}, "@media (max-width: 340px){width:100%;}" + ( true ? "" : 0));
|
|
101735
|
+
var IconWrap = /*#__PURE__*/createStyled("span", true ? {
|
|
101736
|
+
target: "ec07usz3"
|
|
101737
|
+
} : 0)("display:inline-flex;align-items:center;justify-content:center;width:", function (_ref0) {
|
|
101738
|
+
var $size = _ref0.$size;
|
|
101739
|
+
return resolveSizeTokens($size).icon;
|
|
101740
|
+
}, ";height:", function (_ref1) {
|
|
101741
|
+
var $size = _ref1.$size;
|
|
101742
|
+
return resolveSizeTokens($size).icon;
|
|
101743
|
+
}, ";font-size:", function (_ref10) {
|
|
101744
|
+
var $size = _ref10.$size;
|
|
101745
|
+
return resolveSizeTokens($size).icon;
|
|
101746
|
+
}, ";color:", InputTheme.colors.icon, ";flex:0 0 auto;" + ( true ? "" : 0));
|
|
101747
|
+
var IconButton = /*#__PURE__*/createStyled("button", true ? {
|
|
101748
|
+
target: "ec07usz2"
|
|
101749
|
+
} : 0)("display:inline-flex;align-items:center;justify-content:center;width:", function (_ref11) {
|
|
101750
|
+
var $size = _ref11.$size;
|
|
101751
|
+
return resolveSizeTokens($size).icon;
|
|
101752
|
+
}, ";height:", function (_ref12) {
|
|
101753
|
+
var $size = _ref12.$size;
|
|
101754
|
+
return resolveSizeTokens($size).icon;
|
|
101755
|
+
}, ";font-size:", function (_ref13) {
|
|
101756
|
+
var $size = _ref13.$size;
|
|
101757
|
+
return resolveSizeTokens($size).icon;
|
|
101758
|
+
}, ";padding:0;border:0;border-radius:999px;background:transparent;color:", InputTheme.colors.icon, ";cursor:pointer;flex:0 0 auto;&:disabled{cursor:not-allowed;}" + ( true ? "" : 0));
|
|
101759
|
+
var TextInput = /*#__PURE__*/createStyled("input", true ? {
|
|
101760
|
+
target: "ec07usz1"
|
|
101761
|
+
} : 0)("flex:1 1 auto;min-width:0;border:0;outline:0;position:relative;z-index:1;background:transparent;color:", InputTheme.colors.text, ";font-size:", function (_ref14) {
|
|
101762
|
+
var $size = _ref14.$size;
|
|
101763
|
+
return resolveSizeTokens($size).fontSize;
|
|
101764
|
+
}, ";line-height:", function (_ref15) {
|
|
101765
|
+
var $size = _ref15.$size;
|
|
101766
|
+
return resolveSizeTokens($size).lineHeight;
|
|
101767
|
+
}, ";&::placeholder{color:", InputTheme.colors.placeholder, ";}&:focus{text-decoration:underline;text-decoration-thickness:", InputTheme.underline.thickness, ";text-underline-offset:", InputTheme.underline.offset, ";}" + ( true ? "" : 0));
|
|
101768
|
+
var PlaceholderText = /*#__PURE__*/createStyled("span", true ? {
|
|
101769
|
+
target: "ec07usz0"
|
|
101770
|
+
} : 0)("position:absolute;left:var(--placeholder-left);top:50%;transform:translateY(-50%);z-index:2;color:", InputTheme.colors.placeholder, ";pointer-events:none;font-size:", function (_ref16) {
|
|
101771
|
+
var $size = _ref16.$size;
|
|
101772
|
+
return resolveSizeTokens($size).fontSize;
|
|
101773
|
+
}, ";line-height:", function (_ref17) {
|
|
101774
|
+
var $size = _ref17.$size;
|
|
101775
|
+
return resolveSizeTokens($size).lineHeight;
|
|
101776
|
+
}, ";white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 64px);" + ( true ? "" : 0));
|
|
101777
|
+
;// ./src/components/input/Input.propTypes.js
|
|
101778
|
+
|
|
101779
|
+
|
|
101780
|
+
var InputPropTypes = {
|
|
101781
|
+
icon_position: external_prop_types_default().oneOf([INPUT_ICON_POSITIONS.START, INPUT_ICON_POSITIONS.END]),
|
|
101782
|
+
size_variant: external_prop_types_default().oneOf([INPUT_SIZE_VARIANTS.DEFAULT, INPUT_SIZE_VARIANTS.WIDE, INPUT_SIZE_VARIANTS.FULL]),
|
|
101783
|
+
size: external_prop_types_default().oneOf([INPUT_SIZES.SM, INPUT_SIZES.MD, INPUT_SIZES.LG]),
|
|
101784
|
+
value: (external_prop_types_default()).string,
|
|
101785
|
+
onChange: (external_prop_types_default()).func,
|
|
101786
|
+
is_focused: (external_prop_types_default()).bool,
|
|
101787
|
+
onFocus: (external_prop_types_default()).func,
|
|
101788
|
+
onBlur: (external_prop_types_default()).func,
|
|
101789
|
+
disabled: (external_prop_types_default()).bool,
|
|
101790
|
+
placeholder_text: (external_prop_types_default()).string,
|
|
101791
|
+
aria_label: (external_prop_types_default()).string,
|
|
101792
|
+
'data-testid': (external_prop_types_default()).string,
|
|
101793
|
+
className: (external_prop_types_default()).string
|
|
101794
|
+
};
|
|
101795
|
+
;// ./src/components/input/Input.jsx
|
|
101796
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || Input_unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
101474
101797
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
101475
|
-
function
|
|
101476
|
-
function
|
|
101798
|
+
function Input_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return Input_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? Input_arrayLikeToArray(r, a) : void 0; } }
|
|
101799
|
+
function Input_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
101477
101800
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
101478
101801
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
101479
101802
|
|
|
@@ -101481,44 +101804,2885 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
101481
101804
|
|
|
101482
101805
|
|
|
101483
101806
|
|
|
101484
|
-
|
|
101485
|
-
|
|
101486
|
-
|
|
101807
|
+
|
|
101808
|
+
|
|
101809
|
+
|
|
101810
|
+
function coalesceBoolean(primary, fallback) {
|
|
101811
|
+
if (typeof primary === "boolean") return primary;
|
|
101812
|
+
return fallback;
|
|
101813
|
+
}
|
|
101814
|
+
function Input(props) {
|
|
101815
|
+
var icon_position = props.icon_position,
|
|
101816
|
+
size_variant = props.size_variant,
|
|
101817
|
+
size = props.size,
|
|
101818
|
+
value = props.value,
|
|
101819
|
+
_onChange = props.onChange,
|
|
101820
|
+
is_focused = props.is_focused,
|
|
101821
|
+
_onFocus = props.onFocus,
|
|
101822
|
+
_onBlur = props.onBlur,
|
|
101823
|
+
disabled = props.disabled,
|
|
101824
|
+
placeholder_text = props.placeholder_text,
|
|
101825
|
+
aria_label = props.aria_label,
|
|
101826
|
+
dataTestId = props['data-testid'],
|
|
101827
|
+
className = props.className;
|
|
101828
|
+
var inputRef = (0,external_react_.useRef)(null);
|
|
101829
|
+
var _useState = (0,external_react_.useState)(false),
|
|
101487
101830
|
_useState2 = _slicedToArray(_useState, 2),
|
|
101488
|
-
|
|
101489
|
-
|
|
101490
|
-
|
|
101831
|
+
internalFocused = _useState2[0],
|
|
101832
|
+
setInternalFocused = _useState2[1];
|
|
101833
|
+
var canRender = typeof _onChange === "function";
|
|
101834
|
+
var normalizedIconPosition = (0,external_react_.useMemo)(function () {
|
|
101835
|
+
return normalizeInputIconPosition(icon_position);
|
|
101836
|
+
}, [icon_position]);
|
|
101837
|
+
var normalizedSizeVariant = (0,external_react_.useMemo)(function () {
|
|
101838
|
+
return normalizeInputSizeVariant(size_variant);
|
|
101839
|
+
}, [size_variant]);
|
|
101840
|
+
var normalizedSize = (0,external_react_.useMemo)(function () {
|
|
101841
|
+
return normalizeInputSize(size);
|
|
101842
|
+
}, [size]);
|
|
101843
|
+
var normalizedValue = (0,external_react_.useMemo)(function () {
|
|
101844
|
+
return normalizeInputValue(value);
|
|
101845
|
+
}, [value]);
|
|
101846
|
+
var placeholderText = (0,external_react_.useMemo)(function () {
|
|
101847
|
+
return normalizeInputPlaceholderText(placeholder_text);
|
|
101848
|
+
}, [placeholder_text]);
|
|
101849
|
+
(0,external_react_.useEffect)(function () {
|
|
101850
|
+
if (typeof is_focused !== "boolean") return;
|
|
101851
|
+
if (is_focused) focusInputEl(inputRef.current);else blurInputEl(inputRef.current);
|
|
101852
|
+
}, [is_focused]);
|
|
101853
|
+
var effectiveFocused = coalesceBoolean(is_focused, internalFocused);
|
|
101854
|
+
var handleContainerMouseDown = function handleContainerMouseDown(e) {
|
|
101855
|
+
if (disabled) return;
|
|
101856
|
+
|
|
101857
|
+
// Allow native behaviors (caret placement, text selection) when interacting
|
|
101858
|
+
// with the actual input. Only "steal" clicks on the chrome/empty area to
|
|
101859
|
+
// focus the field.
|
|
101860
|
+
var target = e.target;
|
|
101861
|
+
if (target instanceof Element) {
|
|
101862
|
+
if (target === inputRef.current) return;
|
|
101863
|
+
if (target.closest("button")) return;
|
|
101864
|
+
}
|
|
101491
101865
|
e.preventDefault();
|
|
101492
|
-
|
|
101493
|
-
|
|
101866
|
+
focusInputEl(inputRef.current);
|
|
101867
|
+
};
|
|
101868
|
+
if (!canRender) return null;
|
|
101869
|
+
var label = aria_label || DEFAULT_INPUT_ARIA_LABEL;
|
|
101870
|
+
var rootTestId = dataTestId || "search-input";
|
|
101871
|
+
var inputTestId = "".concat(rootTestId, "-input");
|
|
101872
|
+
var iconTestId = "".concat(rootTestId, "-icon");
|
|
101873
|
+
var clearTestId = "".concat(rootTestId, "-clear");
|
|
101874
|
+
var iconEl = /*#__PURE__*/(0,jsx_runtime_.jsx)(IconWrap, {
|
|
101875
|
+
"aria-hidden": "true",
|
|
101876
|
+
"data-testid": iconTestId,
|
|
101877
|
+
$size: normalizedSize,
|
|
101878
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Search/* default */.A, {
|
|
101879
|
+
fontSize: "inherit"
|
|
101880
|
+
})
|
|
101881
|
+
});
|
|
101882
|
+
var inputEl = /*#__PURE__*/(0,jsx_runtime_.jsx)(TextInput, {
|
|
101883
|
+
ref: inputRef,
|
|
101884
|
+
type: "text",
|
|
101885
|
+
"aria-label": label,
|
|
101886
|
+
"data-testid": inputTestId,
|
|
101887
|
+
placeholder: "",
|
|
101888
|
+
disabled: disabled,
|
|
101889
|
+
value: normalizedValue,
|
|
101890
|
+
$size: normalizedSize,
|
|
101891
|
+
onFocus: function onFocus(e) {
|
|
101892
|
+
setInternalFocused(true);
|
|
101893
|
+
_onFocus === null || _onFocus === void 0 || _onFocus(e);
|
|
101894
|
+
},
|
|
101895
|
+
onBlur: function onBlur(e) {
|
|
101896
|
+
setInternalFocused(false);
|
|
101897
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(e);
|
|
101898
|
+
},
|
|
101899
|
+
onChange: function onChange(e) {
|
|
101900
|
+
return _onChange(e.target.value);
|
|
101901
|
+
}
|
|
101902
|
+
});
|
|
101903
|
+
var placeholderEl = normalizedValue === "" ? /*#__PURE__*/(0,jsx_runtime_.jsx)(PlaceholderText, {
|
|
101904
|
+
"data-placeholder": "true",
|
|
101905
|
+
$size: normalizedSize,
|
|
101906
|
+
children: placeholderText
|
|
101907
|
+
}) : null;
|
|
101908
|
+
var shouldShowClear = !disabled && normalizedValue !== "";
|
|
101909
|
+
var clearEl = shouldShowClear ? /*#__PURE__*/(0,jsx_runtime_.jsx)(IconButton, {
|
|
101910
|
+
type: "button",
|
|
101911
|
+
"aria-label": "Clear",
|
|
101912
|
+
"data-testid": clearTestId,
|
|
101913
|
+
$size: normalizedSize,
|
|
101914
|
+
onMouseDown: function onMouseDown(e) {
|
|
101915
|
+
e.preventDefault();
|
|
101916
|
+
},
|
|
101917
|
+
onClick: function onClick() {
|
|
101918
|
+
_onChange("");
|
|
101919
|
+
focusInputEl(inputRef.current);
|
|
101920
|
+
},
|
|
101921
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Close/* default */.A, {
|
|
101922
|
+
fontSize: "inherit",
|
|
101923
|
+
"aria-hidden": "true"
|
|
101924
|
+
})
|
|
101925
|
+
}) : null;
|
|
101926
|
+
var contentEls = normalizedIconPosition === "end" ? [placeholderEl, inputEl, clearEl, iconEl] : [iconEl, placeholderEl, inputEl, clearEl];
|
|
101927
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(Root, {
|
|
101928
|
+
className: className,
|
|
101929
|
+
$sizeVariant: normalizedSizeVariant,
|
|
101930
|
+
$size: normalizedSize,
|
|
101931
|
+
$focused: effectiveFocused,
|
|
101932
|
+
$disabled: disabled,
|
|
101933
|
+
"data-testid": rootTestId,
|
|
101934
|
+
"data-icon-position": normalizedIconPosition,
|
|
101935
|
+
"data-size-variant": normalizedSizeVariant,
|
|
101936
|
+
"data-size": normalizedSize,
|
|
101937
|
+
"data-focused": effectiveFocused ? "true" : "false",
|
|
101938
|
+
"data-disabled": disabled ? "true" : "false",
|
|
101939
|
+
onMouseDown: handleContainerMouseDown,
|
|
101940
|
+
children: contentEls
|
|
101941
|
+
});
|
|
101942
|
+
}
|
|
101943
|
+
Input.propTypes = InputPropTypes;
|
|
101944
|
+
Input.defaultProps = {
|
|
101945
|
+
icon_position: DEFAULT_INPUT_ICON_POSITION,
|
|
101946
|
+
size_variant: DEFAULT_INPUT_SIZE_VARIANT,
|
|
101947
|
+
size: DEFAULT_INPUT_SIZE,
|
|
101948
|
+
value: "",
|
|
101949
|
+
is_focused: undefined,
|
|
101950
|
+
onFocus: undefined,
|
|
101951
|
+
onBlur: undefined,
|
|
101952
|
+
disabled: false,
|
|
101953
|
+
placeholder_text: undefined,
|
|
101954
|
+
aria_label: undefined,
|
|
101955
|
+
'data-testid': undefined,
|
|
101956
|
+
className: undefined
|
|
101957
|
+
};
|
|
101958
|
+
;// ./src/components/auto-complete/utils/AutoCompleteConstants.js
|
|
101959
|
+
var DEBOUNCE_MS = 220;
|
|
101960
|
+
var MAX_VISIBLE_SUGGESTIONS = 6;
|
|
101961
|
+
;// ./src/components/auto-complete/utils/AutoCompleteSuggestionHelpers.js
|
|
101962
|
+
function AutoCompleteSuggestionHelpers_typeof(o) { "@babel/helpers - typeof"; return AutoCompleteSuggestionHelpers_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, AutoCompleteSuggestionHelpers_typeof(o); }
|
|
101963
|
+
function AutoCompleteSuggestionHelpers_toConsumableArray(r) { return AutoCompleteSuggestionHelpers_arrayWithoutHoles(r) || AutoCompleteSuggestionHelpers_iterableToArray(r) || AutoCompleteSuggestionHelpers_unsupportedIterableToArray(r) || AutoCompleteSuggestionHelpers_nonIterableSpread(); }
|
|
101964
|
+
function AutoCompleteSuggestionHelpers_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
101965
|
+
function AutoCompleteSuggestionHelpers_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return AutoCompleteSuggestionHelpers_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? AutoCompleteSuggestionHelpers_arrayLikeToArray(r, a) : void 0; } }
|
|
101966
|
+
function AutoCompleteSuggestionHelpers_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
101967
|
+
function AutoCompleteSuggestionHelpers_arrayWithoutHoles(r) { if (Array.isArray(r)) return AutoCompleteSuggestionHelpers_arrayLikeToArray(r); }
|
|
101968
|
+
function AutoCompleteSuggestionHelpers_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
101969
|
+
function getCopyValue(copy, snakeCaseKey, camelCaseKey) {
|
|
101970
|
+
var fallback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
|
|
101971
|
+
if ((copy === null || copy === void 0 ? void 0 : copy[snakeCaseKey]) != null) {
|
|
101972
|
+
return copy[snakeCaseKey];
|
|
101973
|
+
}
|
|
101974
|
+
if ((copy === null || copy === void 0 ? void 0 : copy[camelCaseKey]) != null) {
|
|
101975
|
+
return copy[camelCaseKey];
|
|
101976
|
+
}
|
|
101977
|
+
return fallback;
|
|
101978
|
+
}
|
|
101979
|
+
function safeParseJsonArray(value) {
|
|
101980
|
+
if (Array.isArray(value)) {
|
|
101981
|
+
return value;
|
|
101982
|
+
}
|
|
101983
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
101984
|
+
return [];
|
|
101985
|
+
}
|
|
101986
|
+
try {
|
|
101987
|
+
var parsedValue = JSON.parse(value);
|
|
101988
|
+
return Array.isArray(parsedValue) ? parsedValue : [];
|
|
101989
|
+
} catch (_unused) {
|
|
101990
|
+
return [];
|
|
101991
|
+
}
|
|
101992
|
+
}
|
|
101993
|
+
function getIngredientTerms(rawIngredients) {
|
|
101994
|
+
var ingredientGroups = safeParseJsonArray(rawIngredients);
|
|
101995
|
+
return ingredientGroups.flatMap(function (ingredientGroup) {
|
|
101996
|
+
var keyIngredients = Array.isArray(ingredientGroup === null || ingredientGroup === void 0 ? void 0 : ingredientGroup.keyIngredients) ? ingredientGroup.keyIngredients.map(function (ingredient) {
|
|
101997
|
+
return ingredient === null || ingredient === void 0 ? void 0 : ingredient.name;
|
|
101998
|
+
}) : [];
|
|
101999
|
+
return [ingredientGroup === null || ingredientGroup === void 0 ? void 0 : ingredientGroup.productName, ingredientGroup === null || ingredientGroup === void 0 ? void 0 : ingredientGroup.activeIngredients, ingredientGroup === null || ingredientGroup === void 0 ? void 0 : ingredientGroup.inactiveIngredients, ingredientGroup === null || ingredientGroup === void 0 ? void 0 : ingredientGroup.allIngredients, ingredientGroup === null || ingredientGroup === void 0 ? void 0 : ingredientGroup.otherIngredients].concat(AutoCompleteSuggestionHelpers_toConsumableArray(keyIngredients));
|
|
102000
|
+
}).filter(Boolean).map(function (term) {
|
|
102001
|
+
return String(term).trim();
|
|
102002
|
+
}).filter(Boolean);
|
|
102003
|
+
}
|
|
102004
|
+
function getSkuProperties(product) {
|
|
102005
|
+
var _ref, _skuList$find, _defaultSku$propertie;
|
|
102006
|
+
var skuList = Array.isArray(product.sku) ? product.sku : [];
|
|
102007
|
+
var defaultSku = (_ref = (_skuList$find = skuList.find(function (skuEntry) {
|
|
102008
|
+
return skuEntry === null || skuEntry === void 0 ? void 0 : skuEntry["default"];
|
|
102009
|
+
})) !== null && _skuList$find !== void 0 ? _skuList$find : skuList[0]) !== null && _ref !== void 0 ? _ref : null;
|
|
102010
|
+
return {
|
|
102011
|
+
defaultSku: defaultSku,
|
|
102012
|
+
skuProperties: (_defaultSku$propertie = defaultSku === null || defaultSku === void 0 ? void 0 : defaultSku.properties) !== null && _defaultSku$propertie !== void 0 ? _defaultSku$propertie : {}
|
|
102013
|
+
};
|
|
102014
|
+
}
|
|
102015
|
+
function getIdentifier(product, defaultSku, index) {
|
|
102016
|
+
var _ref2, _defaultSku$identifie;
|
|
102017
|
+
return String((_ref2 = (_defaultSku$identifie = defaultSku === null || defaultSku === void 0 ? void 0 : defaultSku.identifier) !== null && _defaultSku$identifie !== void 0 ? _defaultSku$identifie : product.identifier) !== null && _ref2 !== void 0 ? _ref2 : "catalog-product-".concat(index)).trim();
|
|
102018
|
+
}
|
|
102019
|
+
function getDisplayLabel(identifier, productProperties, skuProperties) {
|
|
102020
|
+
var _ref3, _ref4, _ref5, _skuProperties$title;
|
|
102021
|
+
return (_ref3 = (_ref4 = (_ref5 = (_skuProperties$title = skuProperties.title) !== null && _skuProperties$title !== void 0 ? _skuProperties$title : productProperties.name) !== null && _ref5 !== void 0 ? _ref5 : productProperties.title) !== null && _ref4 !== void 0 ? _ref4 : skuProperties.name) !== null && _ref3 !== void 0 ? _ref3 : identifier;
|
|
102022
|
+
}
|
|
102023
|
+
function getTypeData(product, productProperties, skuProperties) {
|
|
102024
|
+
var _ref6, _productProperties$cu, _ref7, _ref8, _product$type;
|
|
102025
|
+
var customProductType = String((_ref6 = (_productProperties$cu = productProperties.customProductType) !== null && _productProperties$cu !== void 0 ? _productProperties$cu : skuProperties.customProductType) !== null && _ref6 !== void 0 ? _ref6 : "").trim();
|
|
102026
|
+
var normalizedType = String((_ref7 = (_ref8 = (_product$type = product.type) !== null && _product$type !== void 0 ? _product$type : productProperties.producttype) !== null && _ref8 !== void 0 ? _ref8 : skuProperties.producttype) !== null && _ref7 !== void 0 ? _ref7 : "").trim().toLowerCase();
|
|
102027
|
+
return {
|
|
102028
|
+
customProductType: customProductType,
|
|
102029
|
+
isBundle: normalizedType === "bundle" || customProductType.toLowerCase().includes("bundle")
|
|
102030
|
+
};
|
|
102031
|
+
}
|
|
102032
|
+
function getNavigationUrls(productProperties, skuProperties) {
|
|
102033
|
+
var _ref9, _skuProperties$slug, _ref0, _ref1, _ref10, _skuProperties$url;
|
|
102034
|
+
var slug = (_ref9 = (_skuProperties$slug = skuProperties.slug) !== null && _skuProperties$slug !== void 0 ? _skuProperties$slug : productProperties.slug) !== null && _ref9 !== void 0 ? _ref9 : null;
|
|
102035
|
+
var navigableUrl = (_ref0 = (_ref1 = (_ref10 = (_skuProperties$url = skuProperties.url) !== null && _skuProperties$url !== void 0 ? _skuProperties$url : skuProperties.href) !== null && _ref10 !== void 0 ? _ref10 : productProperties.url) !== null && _ref1 !== void 0 ? _ref1 : productProperties.href) !== null && _ref0 !== void 0 ? _ref0 : null;
|
|
102036
|
+
return {
|
|
102037
|
+
navigableUrl: navigableUrl,
|
|
102038
|
+
slug: slug
|
|
102039
|
+
};
|
|
102040
|
+
}
|
|
102041
|
+
function getMappedProductType(isBundle) {
|
|
102042
|
+
return isBundle ? "bundle" : "single";
|
|
102043
|
+
}
|
|
102044
|
+
function isOutOfStock(inventoryStatus) {
|
|
102045
|
+
return String(inventoryStatus).toUpperCase() === "OUT OF STOCK";
|
|
102046
|
+
}
|
|
102047
|
+
function mapCatalogProductToSuggestion(product) {
|
|
102048
|
+
var _product$properties, _ref11, _skuProperties$invent, _ref12, _ref13, _ref14, _skuProperties$imageU, _ref15, _productProperties$ke, _skuProperties$ingred;
|
|
102049
|
+
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
102050
|
+
if (!product || AutoCompleteSuggestionHelpers_typeof(product) !== "object") {
|
|
102051
|
+
return null;
|
|
102052
|
+
}
|
|
102053
|
+
var productProperties = (_product$properties = product.properties) !== null && _product$properties !== void 0 ? _product$properties : {};
|
|
102054
|
+
var _getSkuProperties = getSkuProperties(product),
|
|
102055
|
+
defaultSku = _getSkuProperties.defaultSku,
|
|
102056
|
+
skuProperties = _getSkuProperties.skuProperties;
|
|
102057
|
+
var identifier = getIdentifier(product, defaultSku, index);
|
|
102058
|
+
var displayLabel = getDisplayLabel(identifier, productProperties, skuProperties);
|
|
102059
|
+
var inventoryStatus = (_ref11 = (_skuProperties$invent = skuProperties.inventoryStatus) !== null && _skuProperties$invent !== void 0 ? _skuProperties$invent : productProperties.inventoryStatus) !== null && _ref11 !== void 0 ? _ref11 : "";
|
|
102060
|
+
var _getTypeData = getTypeData(product, productProperties, skuProperties),
|
|
102061
|
+
customProductType = _getTypeData.customProductType,
|
|
102062
|
+
isBundle = _getTypeData.isBundle;
|
|
102063
|
+
var imageSrc = (_ref12 = (_ref13 = (_ref14 = (_skuProperties$imageU = skuProperties.imageURL) !== null && _skuProperties$imageU !== void 0 ? _skuProperties$imageU : productProperties.imageURL) !== null && _ref14 !== void 0 ? _ref14 : skuProperties.primaryimage) !== null && _ref13 !== void 0 ? _ref13 : productProperties.primaryimage) !== null && _ref12 !== void 0 ? _ref12 : null;
|
|
102064
|
+
var _getNavigationUrls = getNavigationUrls(productProperties, skuProperties),
|
|
102065
|
+
navigableUrl = _getNavigationUrls.navigableUrl,
|
|
102066
|
+
slug = _getNavigationUrls.slug;
|
|
102067
|
+
var mappedProductType = getMappedProductType(isBundle);
|
|
102068
|
+
return {
|
|
102069
|
+
id: identifier,
|
|
102070
|
+
identifier: identifier,
|
|
102071
|
+
sku: identifier,
|
|
102072
|
+
label: displayLabel,
|
|
102073
|
+
value: displayLabel,
|
|
102074
|
+
imageURL: imageSrc,
|
|
102075
|
+
thumbnail: imageSrc,
|
|
102076
|
+
productType: mappedProductType,
|
|
102077
|
+
product_type: mappedProductType,
|
|
102078
|
+
outOfStock: isOutOfStock(inventoryStatus),
|
|
102079
|
+
customProductType: customProductType,
|
|
102080
|
+
slug: slug,
|
|
102081
|
+
productSlug: slug,
|
|
102082
|
+
url: navigableUrl,
|
|
102083
|
+
href: navigableUrl,
|
|
102084
|
+
keywords: (_ref15 = (_productProperties$ke = productProperties.keyword) !== null && _productProperties$ke !== void 0 ? _productProperties$ke : skuProperties.keyword) !== null && _ref15 !== void 0 ? _ref15 : "",
|
|
102085
|
+
ingredientTerms: getIngredientTerms((_skuProperties$ingred = skuProperties.ingredients) !== null && _skuProperties$ingred !== void 0 ? _skuProperties$ingred : productProperties.ingredients)
|
|
102086
|
+
};
|
|
102087
|
+
}
|
|
102088
|
+
function getSuggestionDisplayData(suggestionOption) {
|
|
102089
|
+
var _suggestionOption$pro, _suggestionOption$out, _ref16, _ref17, _suggestionOption$ima, _ref18, _ref19, _ref20, _ref21, _suggestionOption$val;
|
|
102090
|
+
var isDidYouMean = suggestionOption.suggestionType === "did-you-mean";
|
|
102091
|
+
var productType = (_suggestionOption$pro = suggestionOption.product_type) !== null && _suggestionOption$pro !== void 0 ? _suggestionOption$pro : suggestionOption.productType;
|
|
102092
|
+
var outOfStock = (_suggestionOption$out = suggestionOption.out_of_stock) !== null && _suggestionOption$out !== void 0 ? _suggestionOption$out : suggestionOption.outOfStock;
|
|
102093
|
+
return {
|
|
102094
|
+
imageSrc: isDidYouMean ? null : (_ref16 = (_ref17 = (_suggestionOption$ima = suggestionOption.image) !== null && _suggestionOption$ima !== void 0 ? _suggestionOption$ima : suggestionOption.image_url) !== null && _ref17 !== void 0 ? _ref17 : suggestionOption.imageURL) !== null && _ref16 !== void 0 ? _ref16 : suggestionOption.thumbnail,
|
|
102095
|
+
displayLabel: (_ref18 = (_ref19 = (_ref20 = (_ref21 = (_suggestionOption$val = suggestionOption.value) !== null && _suggestionOption$val !== void 0 ? _suggestionOption$val : suggestionOption.label) !== null && _ref21 !== void 0 ? _ref21 : suggestionOption.title) !== null && _ref20 !== void 0 ? _ref20 : suggestionOption.name) !== null && _ref19 !== void 0 ? _ref19 : suggestionOption.identifier) !== null && _ref18 !== void 0 ? _ref18 : "",
|
|
102096
|
+
isBundle: !isDidYouMean && productType === "bundle",
|
|
102097
|
+
isDidYouMean: isDidYouMean,
|
|
102098
|
+
isOutOfStock: !isDidYouMean && Boolean(outOfStock)
|
|
102099
|
+
};
|
|
102100
|
+
}
|
|
102101
|
+
function getSeeMoreResultsPayload(query, totalResultsCount, suggestions) {
|
|
102102
|
+
return {
|
|
102103
|
+
query: query,
|
|
102104
|
+
source: "autocomplete-footer",
|
|
102105
|
+
totalResultsCount: totalResultsCount,
|
|
102106
|
+
visibleResultsCount: suggestions.length
|
|
102107
|
+
};
|
|
102108
|
+
}
|
|
102109
|
+
function getStatusMessage(_ref22) {
|
|
102110
|
+
var loading = _ref22.loading,
|
|
102111
|
+
emptyFetched = _ref22.emptyFetched,
|
|
102112
|
+
hasQuery = _ref22.hasQuery,
|
|
102113
|
+
noSuggestionsText = _ref22.noSuggestionsText,
|
|
102114
|
+
suggestions = _ref22.suggestions;
|
|
102115
|
+
if (loading) {
|
|
102116
|
+
return "Loading suggestions";
|
|
102117
|
+
}
|
|
102118
|
+
if (emptyFetched && hasQuery) {
|
|
102119
|
+
return noSuggestionsText;
|
|
102120
|
+
}
|
|
102121
|
+
if (suggestions.length > 0) {
|
|
102122
|
+
return "".concat(suggestions.length, " suggestions");
|
|
102123
|
+
}
|
|
102124
|
+
return "";
|
|
102125
|
+
}
|
|
102126
|
+
;// ./src/components/auto-complete/hooks/useAutoCompleteSuggestions.js
|
|
102127
|
+
function useAutoCompleteSuggestions_regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return useAutoCompleteSuggestions_regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (useAutoCompleteSuggestions_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, useAutoCompleteSuggestions_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, useAutoCompleteSuggestions_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), useAutoCompleteSuggestions_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", useAutoCompleteSuggestions_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), useAutoCompleteSuggestions_regeneratorDefine2(u), useAutoCompleteSuggestions_regeneratorDefine2(u, o, "Generator"), useAutoCompleteSuggestions_regeneratorDefine2(u, n, function () { return this; }), useAutoCompleteSuggestions_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (useAutoCompleteSuggestions_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
102128
|
+
function useAutoCompleteSuggestions_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } useAutoCompleteSuggestions_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { useAutoCompleteSuggestions_regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, useAutoCompleteSuggestions_regeneratorDefine2(e, r, n, t); }
|
|
102129
|
+
function useAutoCompleteSuggestions_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
102130
|
+
function useAutoCompleteSuggestions_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { useAutoCompleteSuggestions_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { useAutoCompleteSuggestions_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
102131
|
+
function useAutoCompleteSuggestions_slicedToArray(r, e) { return useAutoCompleteSuggestions_arrayWithHoles(r) || useAutoCompleteSuggestions_iterableToArrayLimit(r, e) || useAutoCompleteSuggestions_unsupportedIterableToArray(r, e) || useAutoCompleteSuggestions_nonIterableRest(); }
|
|
102132
|
+
function useAutoCompleteSuggestions_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
102133
|
+
function useAutoCompleteSuggestions_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return useAutoCompleteSuggestions_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? useAutoCompleteSuggestions_arrayLikeToArray(r, a) : void 0; } }
|
|
102134
|
+
function useAutoCompleteSuggestions_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
102135
|
+
function useAutoCompleteSuggestions_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
102136
|
+
function useAutoCompleteSuggestions_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
102137
|
+
function useAutoCompleteSuggestions_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
102138
|
+
function useAutoCompleteSuggestions_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? useAutoCompleteSuggestions_ownKeys(Object(t), !0).forEach(function (r) { useAutoCompleteSuggestions_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : useAutoCompleteSuggestions_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
102139
|
+
function useAutoCompleteSuggestions_defineProperty(e, r, t) { return (r = useAutoCompleteSuggestions_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
102140
|
+
function useAutoCompleteSuggestions_toPropertyKey(t) { var i = useAutoCompleteSuggestions_toPrimitive(t, "string"); return "symbol" == useAutoCompleteSuggestions_typeof(i) ? i : i + ""; }
|
|
102141
|
+
function useAutoCompleteSuggestions_toPrimitive(t, r) { if ("object" != useAutoCompleteSuggestions_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != useAutoCompleteSuggestions_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
102142
|
+
function useAutoCompleteSuggestions_typeof(o) { "@babel/helpers - typeof"; return useAutoCompleteSuggestions_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useAutoCompleteSuggestions_typeof(o); }
|
|
102143
|
+
|
|
102144
|
+
|
|
102145
|
+
|
|
102146
|
+
function normalizeDidYouMean(didYouMean) {
|
|
102147
|
+
if (!Array.isArray(didYouMean)) {
|
|
102148
|
+
return [];
|
|
102149
|
+
}
|
|
102150
|
+
return didYouMean.map(function (item, index) {
|
|
102151
|
+
if (typeof item === "string") {
|
|
102152
|
+
return {
|
|
102153
|
+
id: "did-you-mean-".concat(index, "-").concat(item),
|
|
102154
|
+
value: item,
|
|
102155
|
+
suggestionType: "did-you-mean"
|
|
102156
|
+
};
|
|
102157
|
+
}
|
|
102158
|
+
if (item && useAutoCompleteSuggestions_typeof(item) === "object") {
|
|
102159
|
+
var _item$id, _ref, _item$value;
|
|
102160
|
+
return useAutoCompleteSuggestions_objectSpread(useAutoCompleteSuggestions_objectSpread({}, item), {}, {
|
|
102161
|
+
id: (_item$id = item.id) !== null && _item$id !== void 0 ? _item$id : "did-you-mean-".concat(index, "-").concat((_ref = (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.label) !== null && _ref !== void 0 ? _ref : ""),
|
|
102162
|
+
suggestionType: "did-you-mean"
|
|
102163
|
+
});
|
|
102164
|
+
}
|
|
102165
|
+
return null;
|
|
102166
|
+
}).filter(Boolean);
|
|
102167
|
+
}
|
|
102168
|
+
function normalizeSuggestionsResponse(response) {
|
|
102169
|
+
if (Array.isArray(response)) {
|
|
102170
|
+
return {
|
|
102171
|
+
suggestions: response,
|
|
102172
|
+
didYouMean: []
|
|
102173
|
+
};
|
|
102174
|
+
}
|
|
102175
|
+
if (!response || useAutoCompleteSuggestions_typeof(response) !== "object") {
|
|
102176
|
+
return {
|
|
102177
|
+
suggestions: [],
|
|
102178
|
+
didYouMean: []
|
|
102179
|
+
};
|
|
102180
|
+
}
|
|
102181
|
+
if (Array.isArray(response.product)) {
|
|
102182
|
+
var _response$didYouMean;
|
|
102183
|
+
return {
|
|
102184
|
+
suggestions: response.product.map(function (product, index) {
|
|
102185
|
+
return mapCatalogProductToSuggestion(product, index);
|
|
102186
|
+
}).filter(Boolean),
|
|
102187
|
+
didYouMean: normalizeDidYouMean((_response$didYouMean = response.didYouMean) !== null && _response$didYouMean !== void 0 ? _response$didYouMean : response.did_you_mean)
|
|
102188
|
+
};
|
|
102189
|
+
}
|
|
102190
|
+
return {
|
|
102191
|
+
suggestions: Array.isArray(response.suggestions) ? response.suggestions : [],
|
|
102192
|
+
didYouMean: normalizeDidYouMean(response.didYouMean)
|
|
102193
|
+
};
|
|
102194
|
+
}
|
|
102195
|
+
function useAutoCompleteSuggestions(_ref2) {
|
|
102196
|
+
var headerSearchService = _ref2.headerSearchService,
|
|
102197
|
+
_ref2$enabled = _ref2.enabled,
|
|
102198
|
+
enabled = _ref2$enabled === void 0 ? true : _ref2$enabled;
|
|
102199
|
+
var _useState = (0,external_react_.useState)(""),
|
|
102200
|
+
_useState2 = useAutoCompleteSuggestions_slicedToArray(_useState, 2),
|
|
102201
|
+
query = _useState2[0],
|
|
102202
|
+
setQuery = _useState2[1];
|
|
102203
|
+
var _useState3 = (0,external_react_.useState)([]),
|
|
102204
|
+
_useState4 = useAutoCompleteSuggestions_slicedToArray(_useState3, 2),
|
|
102205
|
+
suggestions = _useState4[0],
|
|
102206
|
+
setSuggestions = _useState4[1];
|
|
102207
|
+
var _useState5 = (0,external_react_.useState)([]),
|
|
102208
|
+
_useState6 = useAutoCompleteSuggestions_slicedToArray(_useState5, 2),
|
|
102209
|
+
didYouMean = _useState6[0],
|
|
102210
|
+
setDidYouMean = _useState6[1];
|
|
102211
|
+
var _useState7 = (0,external_react_.useState)(false),
|
|
102212
|
+
_useState8 = useAutoCompleteSuggestions_slicedToArray(_useState7, 2),
|
|
102213
|
+
loading = _useState8[0],
|
|
102214
|
+
setLoading = _useState8[1];
|
|
102215
|
+
var _useState9 = (0,external_react_.useState)(false),
|
|
102216
|
+
_useState0 = useAutoCompleteSuggestions_slicedToArray(_useState9, 2),
|
|
102217
|
+
emptyFetched = _useState0[0],
|
|
102218
|
+
setEmptyFetched = _useState0[1];
|
|
102219
|
+
var _useState1 = (0,external_react_.useState)(false),
|
|
102220
|
+
_useState10 = useAutoCompleteSuggestions_slicedToArray(_useState1, 2),
|
|
102221
|
+
hasMoreResults = _useState10[0],
|
|
102222
|
+
setHasMoreResults = _useState10[1];
|
|
102223
|
+
var _useState11 = (0,external_react_.useState)(0),
|
|
102224
|
+
_useState12 = useAutoCompleteSuggestions_slicedToArray(_useState11, 2),
|
|
102225
|
+
totalResultsCount = _useState12[0],
|
|
102226
|
+
setTotalResultsCount = _useState12[1];
|
|
102227
|
+
var fetchDebounced = (0,external_react_.useRef)(null);
|
|
102228
|
+
var latestRequestId = (0,external_react_.useRef)(0);
|
|
102229
|
+
var resetSuggestionsState = (0,external_react_.useCallback)(function () {
|
|
102230
|
+
setSuggestions([]);
|
|
102231
|
+
setDidYouMean([]);
|
|
102232
|
+
setEmptyFetched(false);
|
|
102233
|
+
setHasMoreResults(false);
|
|
102234
|
+
setTotalResultsCount(0);
|
|
102235
|
+
setLoading(false);
|
|
102236
|
+
}, []);
|
|
102237
|
+
var updateQuery = (0,external_react_.useCallback)(function (nextQuery) {
|
|
102238
|
+
var hasNextQuery = Boolean(nextQuery.trim());
|
|
102239
|
+
// Keep currently visible results during typing to prevent panel flicker.
|
|
102240
|
+
setEmptyFetched(false);
|
|
102241
|
+
setLoading(enabled && hasNextQuery);
|
|
102242
|
+
setQuery(nextQuery);
|
|
102243
|
+
}, [enabled]);
|
|
102244
|
+
var clearQuery = (0,external_react_.useCallback)(function () {
|
|
102245
|
+
resetSuggestionsState();
|
|
102246
|
+
setQuery("");
|
|
102247
|
+
}, [resetSuggestionsState]);
|
|
102248
|
+
var runFetch = (0,external_react_.useCallback)(/*#__PURE__*/function () {
|
|
102249
|
+
var _ref3 = useAutoCompleteSuggestions_asyncToGenerator(/*#__PURE__*/useAutoCompleteSuggestions_regenerator().m(function _callee(nextQuery) {
|
|
102250
|
+
var trimmedQuery, requestId, _ref4, _fetchedSuggestions$t, _fetchedSuggestions$p, fetchedSuggestions, _normalizeSuggestions, allSuggestions, suggestedTerms, visibleSuggestions, hasDidYouMean, normalizedTotalResultsCount, effectiveTotalResultsCount, _t;
|
|
102251
|
+
return useAutoCompleteSuggestions_regenerator().w(function (_context) {
|
|
102252
|
+
while (1) switch (_context.p = _context.n) {
|
|
102253
|
+
case 0:
|
|
102254
|
+
trimmedQuery = nextQuery.trim();
|
|
102255
|
+
requestId = latestRequestId.current + 1;
|
|
102256
|
+
latestRequestId.current = requestId;
|
|
102257
|
+
if (trimmedQuery) {
|
|
102258
|
+
_context.n = 1;
|
|
102259
|
+
break;
|
|
102260
|
+
}
|
|
102261
|
+
resetSuggestionsState();
|
|
102262
|
+
return _context.a(2);
|
|
102263
|
+
case 1:
|
|
102264
|
+
if (enabled) {
|
|
102265
|
+
_context.n = 2;
|
|
102266
|
+
break;
|
|
102267
|
+
}
|
|
102268
|
+
resetSuggestionsState();
|
|
102269
|
+
return _context.a(2);
|
|
102270
|
+
case 2:
|
|
102271
|
+
setLoading(true);
|
|
102272
|
+
setEmptyFetched(false);
|
|
102273
|
+
_context.p = 3;
|
|
102274
|
+
_context.n = 4;
|
|
102275
|
+
return headerSearchService.fetchSuggestions(trimmedQuery);
|
|
102276
|
+
case 4:
|
|
102277
|
+
fetchedSuggestions = _context.v;
|
|
102278
|
+
if (!(requestId !== latestRequestId.current)) {
|
|
102279
|
+
_context.n = 5;
|
|
102280
|
+
break;
|
|
102281
|
+
}
|
|
102282
|
+
return _context.a(2);
|
|
102283
|
+
case 5:
|
|
102284
|
+
_normalizeSuggestions = normalizeSuggestionsResponse(fetchedSuggestions), allSuggestions = _normalizeSuggestions.suggestions, suggestedTerms = _normalizeSuggestions.didYouMean;
|
|
102285
|
+
visibleSuggestions = allSuggestions.slice(0, MAX_VISIBLE_SUGGESTIONS);
|
|
102286
|
+
hasDidYouMean = suggestedTerms.length > 0;
|
|
102287
|
+
normalizedTotalResultsCount = (_ref4 = (_fetchedSuggestions$t = fetchedSuggestions === null || fetchedSuggestions === void 0 ? void 0 : fetchedSuggestions.totalResultsCount) !== null && _fetchedSuggestions$t !== void 0 ? _fetchedSuggestions$t : fetchedSuggestions === null || fetchedSuggestions === void 0 || (_fetchedSuggestions$p = fetchedSuggestions.pageableInfo) === null || _fetchedSuggestions$p === void 0 ? void 0 : _fetchedSuggestions$p.totalCount) !== null && _ref4 !== void 0 ? _ref4 : allSuggestions.length;
|
|
102288
|
+
effectiveTotalResultsCount = hasDidYouMean ? suggestedTerms.length : Math.max(normalizedTotalResultsCount, allSuggestions.length);
|
|
102289
|
+
setDidYouMean(suggestedTerms);
|
|
102290
|
+
setSuggestions(hasDidYouMean ? [] : visibleSuggestions);
|
|
102291
|
+
setHasMoreResults(!hasDidYouMean && effectiveTotalResultsCount > MAX_VISIBLE_SUGGESTIONS);
|
|
102292
|
+
setTotalResultsCount(effectiveTotalResultsCount);
|
|
102293
|
+
setEmptyFetched(hasDidYouMean ? false : visibleSuggestions.length === 0 && suggestedTerms.length === 0);
|
|
102294
|
+
_context.n = 8;
|
|
102295
|
+
break;
|
|
102296
|
+
case 6:
|
|
102297
|
+
_context.p = 6;
|
|
102298
|
+
_t = _context.v;
|
|
102299
|
+
if (!(requestId !== latestRequestId.current)) {
|
|
102300
|
+
_context.n = 7;
|
|
102301
|
+
break;
|
|
102302
|
+
}
|
|
102303
|
+
return _context.a(2);
|
|
102304
|
+
case 7:
|
|
102305
|
+
setSuggestions([]);
|
|
102306
|
+
setDidYouMean([]);
|
|
102307
|
+
setEmptyFetched(true);
|
|
102308
|
+
setHasMoreResults(false);
|
|
102309
|
+
setTotalResultsCount(0);
|
|
102310
|
+
case 8:
|
|
102311
|
+
_context.p = 8;
|
|
102312
|
+
if (requestId === latestRequestId.current) {
|
|
102313
|
+
setLoading(false);
|
|
102314
|
+
}
|
|
102315
|
+
return _context.f(8);
|
|
102316
|
+
case 9:
|
|
102317
|
+
return _context.a(2);
|
|
102318
|
+
}
|
|
102319
|
+
}, _callee, null, [[3, 6, 8, 9]]);
|
|
102320
|
+
}));
|
|
102321
|
+
return function (_x) {
|
|
102322
|
+
return _ref3.apply(this, arguments);
|
|
102323
|
+
};
|
|
102324
|
+
}(), [enabled, headerSearchService, resetSuggestionsState]);
|
|
102325
|
+
(0,external_react_.useEffect)(function () {
|
|
102326
|
+
if (!enabled) {
|
|
102327
|
+
resetSuggestionsState();
|
|
102328
|
+
return undefined;
|
|
102329
|
+
}
|
|
102330
|
+
if (fetchDebounced.current) {
|
|
102331
|
+
clearTimeout(fetchDebounced.current);
|
|
101494
102332
|
}
|
|
102333
|
+
fetchDebounced.current = setTimeout(function () {
|
|
102334
|
+
runFetch(query);
|
|
102335
|
+
}, DEBOUNCE_MS);
|
|
102336
|
+
return function () {
|
|
102337
|
+
if (fetchDebounced.current) {
|
|
102338
|
+
clearTimeout(fetchDebounced.current);
|
|
102339
|
+
}
|
|
102340
|
+
};
|
|
102341
|
+
}, [enabled, query, resetSuggestionsState, runFetch]);
|
|
102342
|
+
return {
|
|
102343
|
+
clearQuery: clearQuery,
|
|
102344
|
+
emptyFetched: emptyFetched,
|
|
102345
|
+
hasMoreResults: hasMoreResults,
|
|
102346
|
+
hasQuery: Boolean(query.trim()),
|
|
102347
|
+
didYouMean: didYouMean,
|
|
102348
|
+
loading: loading,
|
|
102349
|
+
query: query,
|
|
102350
|
+
setQuery: setQuery,
|
|
102351
|
+
suggestions: suggestions,
|
|
102352
|
+
totalResultsCount: totalResultsCount,
|
|
102353
|
+
updateQuery: updateQuery
|
|
102354
|
+
};
|
|
102355
|
+
}
|
|
102356
|
+
;// ./src/components/auto-complete/AutoComplete.styled.js
|
|
102357
|
+
|
|
102358
|
+
function AutoComplete_styled_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
102359
|
+
|
|
102360
|
+
var SearchAutoCompleteRoot = /*#__PURE__*/createStyled("div", true ? {
|
|
102361
|
+
target: "eav54yv27"
|
|
102362
|
+
} : 0)( true ? {
|
|
102363
|
+
name: "pw7jst",
|
|
102364
|
+
styles: "position:relative;width:100%"
|
|
102365
|
+
} : 0);
|
|
102366
|
+
var SearchFieldToolbar = /*#__PURE__*/createStyled("div", true ? {
|
|
102367
|
+
target: "eav54yv26"
|
|
102368
|
+
} : 0)("display:flex;align-items:center;gap:12px;width:100%;min-width:0;box-sizing:border-box;", function (_ref) {
|
|
102369
|
+
var $modalLayout = _ref.$modalLayout;
|
|
102370
|
+
return $modalLayout ? "\n @media (max-width: 1023px) {\n padding: 0 20px 12px;\n }\n " : "";
|
|
102371
|
+
}, ";" + ( true ? "" : 0));
|
|
102372
|
+
var SearchFieldGrow = /*#__PURE__*/createStyled("div", true ? {
|
|
102373
|
+
target: "eav54yv25"
|
|
102374
|
+
} : 0)( true ? {
|
|
102375
|
+
name: "fxp7t8",
|
|
102376
|
+
styles: "flex:1;min-width:0"
|
|
102377
|
+
} : 0);
|
|
102378
|
+
var SearchSuggestionsStatus = /*#__PURE__*/createStyled("span", true ? {
|
|
102379
|
+
target: "eav54yv24"
|
|
102380
|
+
} : 0)( true ? {
|
|
102381
|
+
name: "1dja9su",
|
|
102382
|
+
styles: "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0"
|
|
102383
|
+
} : 0);
|
|
102384
|
+
var SearchSuggestionsPanel = /*#__PURE__*/createStyled("div", true ? {
|
|
102385
|
+
target: "eav54yv23"
|
|
102386
|
+
} : 0)( true ? {
|
|
102387
|
+
name: "177e0cn",
|
|
102388
|
+
styles: "position:relative;width:100%;margin-top:8px;padding:0"
|
|
102389
|
+
} : 0);
|
|
102390
|
+
var SearchSuggestionsList = /*#__PURE__*/createStyled("ul", true ? {
|
|
102391
|
+
target: "eav54yv22"
|
|
102392
|
+
} : 0)( true ? {
|
|
102393
|
+
name: "4jaldj",
|
|
102394
|
+
styles: "display:flex;flex-direction:column;list-style:none;margin:0;padding:0"
|
|
102395
|
+
} : 0);
|
|
102396
|
+
var SearchSuggestionOption = /*#__PURE__*/createStyled("li", true ? {
|
|
102397
|
+
target: "eav54yv21"
|
|
102398
|
+
} : 0)("display:flex;align-items:center;width:100%;min-height:58px;padding:4px 24px;box-sizing:border-box;color:", colors.text, ";" + ( true ? "" : 0));
|
|
102399
|
+
var AutoCompleteRoot = /*#__PURE__*/createStyled(SearchAutoCompleteRoot, true ? {
|
|
102400
|
+
target: "eav54yv20"
|
|
102401
|
+
} : 0)( true ? {
|
|
102402
|
+
name: "12ret95",
|
|
102403
|
+
styles: "max-width:936px;margin:0 auto"
|
|
102404
|
+
} : 0);
|
|
102405
|
+
var AutoCompletePillForm = /*#__PURE__*/createStyled(SearchPillForm, true ? {
|
|
102406
|
+
target: "eav54yv19"
|
|
102407
|
+
} : 0)("max-width:936px;min-height:50px;height:50px;margin:0 auto;padding:0 20px;border-radius:30px;box-sizing:border-box;background:", colors.surface, ";&:hover,&:focus{background:", colors.hover, ";}button[data-testid=\"autocomplete-search-button\"]{margin-right:6px;}input{font-size:16px;line-height:22px;width:100%;&[type=\"search\"]{&::-webkit-search-cancel-button{display:none;}}}@media (max-width: 980px){max-width:100%;min-height:48px;height:48px;padding:0 0.75rem;input{font-size:16px;line-height:22px;}}" + ( true ? "" : 0));
|
|
102408
|
+
var ClearSearchButton = /*#__PURE__*/createStyled("button", true ? {
|
|
102409
|
+
target: "eav54yv18"
|
|
102410
|
+
} : 0)("display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;margin-left:0.75rem;padding:0;border:none;border-radius:999px;background:#efefef;color:", colors.text, ";flex-shrink:0;&:hover{background:#e3e3e3;}&:focus-visible{outline:2px solid ", colors.text, ";outline-offset:2px;}svg{width:16px;height:16px;display:block;}" + ( true ? "" : 0));
|
|
102411
|
+
var SearchIconButton = /*#__PURE__*/createStyled("button", true ? {
|
|
102412
|
+
target: "eav54yv17"
|
|
102413
|
+
} : 0)("display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;margin-right:0.75rem;padding:0;border:none;border-radius:999px;background:transparent;color:", colors.muted, ";flex-shrink:0;&:focus-visible{outline:2px solid ", colors.text, ";outline-offset:2px;}svg{width:20px;height:20px;display:block;}" + ( true ? "" : 0));
|
|
102414
|
+
var PassiveSuggestionOption = /*#__PURE__*/createStyled(SearchSuggestionOption, true ? {
|
|
102415
|
+
target: "eav54yv16"
|
|
102416
|
+
} : 0)("cursor:default;color:var(--autocomplete-muted, ", colors.muted, ");" + ( true ? "" : 0));
|
|
102417
|
+
var SuggestionSectionHeading = /*#__PURE__*/createStyled("div", true ? {
|
|
102418
|
+
target: "eav54yv15"
|
|
102419
|
+
} : 0)("padding:12px 24px 8px;margin-bottom:4px;font-size:16px;font-weight:700;color:", colors.text, ";background:", colors.surface, ";border-bottom:1px solid ", colors.borderLight, ";" + ( true ? "" : 0));
|
|
102420
|
+
var SuggestionRow = /*#__PURE__*/createStyled(SearchSuggestionOption, true ? {
|
|
102421
|
+
target: "eav54yv14"
|
|
102422
|
+
} : 0)("display:grid;grid-template-columns:minmax(0, 1fr) 18px;align-items:center;column-gap:12px;width:100%;background:transparent;&[data-selected=\"true\"]{background:rgba(15, 118, 110, 0.08);box-shadow:inset 3px 0 0 ", colors.accent, ";}&[data-highlighted=\"true\"],&:hover{background:var(--autocomplete-row-hover-bg, #e9ecef);}&[data-highlighted=\"true\"][data-selected=\"true\"]{background:rgba(15, 118, 110, 0.12);box-shadow:inset 3px 0 0 ", colors.accent, ",inset 0 0 0 2px rgba(17, 24, 39, 0.12);}&[data-out-of-stock=\"true\"]{opacity:0.75;}&[data-suggestion-type=\"did-you-mean\"]{grid-template-columns:minmax(0, 1fr);}@media (max-width: 767px){padding:6px 24px;column-gap:8px;}" + ( true ? "" : 0));
|
|
102423
|
+
var SuggestionContentWrapper = /*#__PURE__*/createStyled("div", true ? {
|
|
102424
|
+
target: "eav54yv13"
|
|
102425
|
+
} : 0)("display:grid;grid-template-columns:24px minmax(0, 1fr);align-items:center;column-gap:10px;width:100%;min-width:0;padding:0;color:inherit;cursor:pointer;outline:none;border-radius:6px;&[data-out-of-stock=\"true\"]{cursor:default;}&:focus-visible{outline:2px solid ", colors.text, ";outline-offset:3px;}&[data-suggestion-type=\"did-you-mean\"]{grid-template-columns:minmax(0, 1fr);}" + ( true ? "" : 0));
|
|
102426
|
+
var SuggestionThumbnail = /*#__PURE__*/createStyled("img", true ? {
|
|
102427
|
+
target: "eav54yv12"
|
|
102428
|
+
} : 0)( true ? {
|
|
102429
|
+
name: "foo4t4",
|
|
102430
|
+
styles: "width:24px;height:24px;object-fit:contain;flex-shrink:0;align-self:center"
|
|
102431
|
+
} : 0);
|
|
102432
|
+
var SuggestionLabel = /*#__PURE__*/createStyled("span", true ? {
|
|
102433
|
+
target: "eav54yv11"
|
|
102434
|
+
} : 0)("display:block;min-width:0;line-height:24px;white-space:normal;overflow-wrap:anywhere;word-break:break-word;font-size:16px;color:", colors.text, ";@media (max-width: 767px){font-size:14px;line-height:20px;}" + ( true ? "" : 0));
|
|
102435
|
+
var SuggestionActionIcon = /*#__PURE__*/createStyled("span", true ? {
|
|
102436
|
+
target: "eav54yv10"
|
|
102437
|
+
} : 0)("display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;color:var(--autocomplete-icon-color, ", colors.text, ");flex-shrink:0;align-self:center;&[data-out-of-stock=\"true\"]{color:var(--autocomplete-muted, ", colors.muted, ");}svg{width:24px;height:24px;display:block;}" + ( true ? "" : 0));
|
|
102438
|
+
var SuggestionActionButton = /*#__PURE__*/createStyled("button", true ? {
|
|
102439
|
+
target: "eav54yv9"
|
|
102440
|
+
} : 0)("display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;margin:0;padding:0;border:none;background:transparent;color:var(--autocomplete-icon-color, ", colors.text, ");flex-shrink:0;align-self:center;cursor:pointer;&:hover{text-decoration:none;}&:focus-visible{outline:2px solid ", colors.text, ";outline-offset:3px;border-radius:4px;}svg{width:24px;height:24px;display:block;}" + ( true ? "" : 0));
|
|
102441
|
+
var SeeMoreLinkContainer = /*#__PURE__*/createStyled("div", true ? {
|
|
102442
|
+
target: "eav54yv8"
|
|
102443
|
+
} : 0)("position:relative;display:flex;align-items:center;justify-content:center;width:100%;min-height:48px;padding:0 16px;box-sizing:border-box;background:", colors.surface, ";&::before{content:\"\";position:absolute;top:0;left:50%;width:100vw;border-top:1px solid ", colors.borderLight, ";transform:translateX(-50%);pointer-events:none;}" + ( true ? "" : 0));
|
|
102444
|
+
var SeeMoreLinkText = /*#__PURE__*/createStyled("button", true ? {
|
|
102445
|
+
target: "eav54yv7"
|
|
102446
|
+
} : 0)("width:auto;height:auto;padding:8px 0;border:none;background:transparent;font-size:16px;font-weight:400;line-height:1.4;text-decoration:underline;text-underline-offset:2px;cursor:pointer;&:hover{opacity:0.8;}&[data-highlighted=\"true\"]{text-decoration-thickness:2px;}&:focus-visible{outline:2px solid ", colors.text, ";outline-offset:2px;border-radius:4px;}" + ( true ? "" : 0));
|
|
102447
|
+
var RecentSearchesSection = /*#__PURE__*/createStyled("section", true ? {
|
|
102448
|
+
target: "eav54yv6"
|
|
102449
|
+
} : 0)("padding:24px 35px 18px;background:", colors.surface, ";@media (max-width: 767px){padding:18px 20px 16px;}" + ( true ? "" : 0));
|
|
102450
|
+
var RecentSearchesHeader = /*#__PURE__*/createStyled("div", true ? {
|
|
102451
|
+
target: "eav54yv5"
|
|
102452
|
+
} : 0)( true ? {
|
|
102453
|
+
name: "1fei6vq",
|
|
102454
|
+
styles: "display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:13px"
|
|
102455
|
+
} : 0);
|
|
102456
|
+
var RecentSearchesTitle = /*#__PURE__*/createStyled("h3", true ? {
|
|
102457
|
+
target: "eav54yv4"
|
|
102458
|
+
} : 0)("margin:0;font-size:16px;font-weight:700;color:", colors.text, ";@media (max-width: 767px){font-size:15px;line-height:1.35;}" + ( true ? "" : 0));
|
|
102459
|
+
var RecentSearchesClearButton = /*#__PURE__*/createStyled("button", true ? {
|
|
102460
|
+
target: "eav54yv3"
|
|
102461
|
+
} : 0)("margin:0;padding:0;border:none;background:transparent;color:", colors.text, ";font-size:16px;&:focus-visible{outline:2px solid ", colors.text, ";outline-offset:2px;border-radius:4px;}@media (max-width: 767px){font-size:14px;}" + ( true ? "" : 0));
|
|
102462
|
+
var RecentSearchesList = /*#__PURE__*/createStyled("div", true ? {
|
|
102463
|
+
target: "eav54yv2"
|
|
102464
|
+
} : 0)( true ? {
|
|
102465
|
+
name: "wmzzp",
|
|
102466
|
+
styles: "display:flex;flex-wrap:wrap;gap:10px"
|
|
102467
|
+
} : 0);
|
|
102468
|
+
var RecentSearchChip = /*#__PURE__*/createStyled("button", true ? {
|
|
102469
|
+
target: "eav54yv1"
|
|
102470
|
+
} : 0)("display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:8px 16px;border:1px solid ", colors.borderLight, ";border-radius:999px;background:", colors.surface, ";color:", colors.text, ";font-size:16px;text-align:center;&:hover{background:", colors.hover, ";}&:focus-visible{outline:2px solid ", colors.text, ";outline-offset:2px;}@media (max-width: 767px){min-height:36px;padding:6px 14px;font-size:14px;line-height:1.3;border:1px solid ", colors.borderLight, ";border-radius:10px;}" + ( true ? "" : 0));
|
|
102471
|
+
var RecentSearchOverflowChip = /*#__PURE__*/createStyled(RecentSearchChip, true ? {
|
|
102472
|
+
target: "eav54yv0"
|
|
102473
|
+
} : 0)( true ? {
|
|
102474
|
+
name: "1rws4xn",
|
|
102475
|
+
styles: "cursor:pointer;&:hover{background:#f3f4f6;}"
|
|
102476
|
+
} : 0);
|
|
102477
|
+
;// ./src/components/auto-complete/utils/AutoCompleteIcons.jsx
|
|
102478
|
+
var _excluded = ["fillColor"],
|
|
102479
|
+
_excluded2 = ["fillColor"];
|
|
102480
|
+
function AutoCompleteIcons_typeof(o) { "@babel/helpers - typeof"; return AutoCompleteIcons_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, AutoCompleteIcons_typeof(o); }
|
|
102481
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
102482
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
102483
|
+
function AutoCompleteIcons_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
102484
|
+
function AutoCompleteIcons_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? AutoCompleteIcons_ownKeys(Object(t), !0).forEach(function (r) { AutoCompleteIcons_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : AutoCompleteIcons_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
102485
|
+
function AutoCompleteIcons_defineProperty(e, r, t) { return (r = AutoCompleteIcons_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
102486
|
+
function AutoCompleteIcons_toPropertyKey(t) { var i = AutoCompleteIcons_toPrimitive(t, "string"); return "symbol" == AutoCompleteIcons_typeof(i) ? i : i + ""; }
|
|
102487
|
+
function AutoCompleteIcons_toPrimitive(t, r) { if ("object" != AutoCompleteIcons_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != AutoCompleteIcons_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
102488
|
+
|
|
102489
|
+
|
|
102490
|
+
|
|
102491
|
+
function AutoCompleteCloseIcon(props) {
|
|
102492
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", AutoCompleteIcons_objectSpread(AutoCompleteIcons_objectSpread({}, props), {}, {
|
|
102493
|
+
width: "16",
|
|
102494
|
+
height: "16",
|
|
102495
|
+
viewBox: "0 0 16 16",
|
|
102496
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
102497
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
102498
|
+
d: "M4 4L12 12M12 4L4 12",
|
|
102499
|
+
stroke: "currentColor",
|
|
102500
|
+
strokeWidth: "1.8",
|
|
102501
|
+
strokeLinecap: "round"
|
|
102502
|
+
})
|
|
102503
|
+
}));
|
|
102504
|
+
}
|
|
102505
|
+
function AutoCompleteCartIcon(_ref) {
|
|
102506
|
+
var _ref$fillColor = _ref.fillColor,
|
|
102507
|
+
fillColor = _ref$fillColor === void 0 ? "currentColor" : _ref$fillColor,
|
|
102508
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
102509
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)("svg", AutoCompleteIcons_objectSpread(AutoCompleteIcons_objectSpread({}, props), {}, {
|
|
102510
|
+
width: "24",
|
|
102511
|
+
height: "24",
|
|
102512
|
+
viewBox: "0 0 24 24",
|
|
102513
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
102514
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
102515
|
+
fillRule: "evenodd",
|
|
102516
|
+
clipRule: "evenodd",
|
|
102517
|
+
d: "M24 6C24 7.18669 23.6481 8.34673 22.9888 9.33342C22.4032 10.2099 21.5984 10.9146 20.6575 11.3794L20.57 11.73C20.348 12.5898 19.8462 13.3513 19.1437 13.8944C18.4412 14.4376 17.578 14.7316 16.69 14.73H7.38L7.59 15.73H19C19.2652 15.73 19.5196 15.8354 19.7071 16.0229C19.8946 16.2104 20 16.4648 20 16.73C20 16.9952 19.8946 17.2496 19.7071 17.4371C19.5196 17.6246 19.2652 17.73 19 17.73H6.79C6.55745 17.7352 6.33038 17.6591 6.14786 17.5149C5.96534 17.3707 5.83879 17.1674 5.79 16.94L3.45 5.99999L3.19 4.79999H1C0.734784 4.79999 0.48043 4.69464 0.292893 4.5071C0.105357 4.31957 0 4.06521 0 3.79999C0 3.53478 0.105357 3.28042 0.292893 3.09289C0.48043 2.90535 0.734784 2.79999 1 2.79999H3.19C3.65509 2.78965 4.10925 2.94175 4.47429 3.23014C4.83933 3.51852 5.09242 3.92513 5.19 4.37999L5.28 4.79999H12.1212C12.1975 4.42653 12.3095 4.05943 12.4567 3.7039C12.9109 2.60754 13.6799 1.67047 14.6666 1.01118C15.6533 0.351894 16.8133 0 18 0C19.5913 0 21.1174 0.632141 22.2426 1.75736C23.3679 2.88258 24 4.4087 24 6ZM12.1153 7.17054C12.0908 7.04744 12.0702 6.92387 12.0536 6.79999H5.72L7 12.8H16.71C17.1553 12.8002 17.588 12.6518 17.9394 12.3783C18.0832 12.2663 18.21 12.1361 18.3172 11.9916C17.8214 12.0179 17.3216 11.9826 16.8295 11.8847C15.6656 11.6532 14.5965 11.0818 13.7574 10.2426C12.9182 9.40353 12.3468 8.33443 12.1153 7.17054ZM18.75 5.25H21C21.1989 5.25 21.3897 5.32902 21.5303 5.46967C21.671 5.61032 21.75 5.80109 21.75 6C21.75 6.19891 21.671 6.38968 21.5303 6.53033C21.3897 6.67098 21.1989 6.75 21 6.75H18.75V9C18.75 9.19891 18.671 9.38968 18.5303 9.53033C18.3897 9.67098 18.1989 9.75 18 9.75C17.8011 9.75 17.6103 9.67098 17.4697 9.53033C17.329 9.38968 17.25 9.19891 17.25 9V6.75H15C14.8011 6.75 14.6103 6.67098 14.4697 6.53033C14.329 6.38968 14.25 6.19891 14.25 6C14.25 5.80109 14.329 5.61032 14.4697 5.46967C14.6103 5.32902 14.8011 5.25 15 5.25H17.25V3C17.25 2.80109 17.329 2.61032 17.4697 2.46967C17.6103 2.32902 17.8011 2.25 18 2.25C18.1989 2.25 18.3897 2.32902 18.5303 2.46967C18.671 2.61032 18.75 2.80109 18.75 3V5.25Z",
|
|
102518
|
+
fill: fillColor
|
|
102519
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
102520
|
+
d: "M7.5 17.8C7.10444 17.8 6.71776 17.9173 6.38886 18.1371C6.05996 18.3568 5.80362 18.6692 5.65224 19.0346C5.50087 19.4001 5.46126 19.8022 5.53843 20.1902C5.6156 20.5781 5.80608 20.9345 6.08579 21.2142C6.36549 21.4939 6.72186 21.6844 7.10982 21.7616C7.49778 21.8387 7.89991 21.7991 8.26537 21.6478C8.63082 21.4964 8.94318 21.24 9.16294 20.9111C9.3827 20.5822 9.5 20.1956 9.5 19.8C9.5 19.2696 9.28929 18.7609 8.91421 18.3858C8.53914 18.0107 8.03043 17.8 7.5 17.8Z",
|
|
102521
|
+
fill: fillColor
|
|
102522
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
102523
|
+
d: "M18 17.8C17.6044 17.8 17.2178 17.9173 16.8889 18.1371C16.56 18.3568 16.3036 18.6692 16.1522 19.0346C16.0009 19.4001 15.9613 19.8022 16.0384 20.1902C16.1156 20.5781 16.3061 20.9345 16.5858 21.2142C16.8655 21.4939 17.2219 21.6844 17.6098 21.7616C17.9978 21.8387 18.3999 21.7991 18.7654 21.6478C19.1308 21.4964 19.4432 21.24 19.6629 20.9111C19.8827 20.5822 20 20.1956 20 19.8C20 19.2696 19.7893 18.7609 19.4142 18.3858C19.0391 18.0107 18.5304 17.8 18 17.8Z",
|
|
102524
|
+
fill: fillColor
|
|
102525
|
+
})]
|
|
102526
|
+
}));
|
|
102527
|
+
}
|
|
102528
|
+
AutoCompleteCartIcon.propTypes = {
|
|
102529
|
+
fillColor: (external_prop_types_default()).string
|
|
102530
|
+
};
|
|
102531
|
+
function AutoCompleteTaskIcon(_ref2) {
|
|
102532
|
+
var _ref2$fillColor = _ref2.fillColor,
|
|
102533
|
+
fillColor = _ref2$fillColor === void 0 ? "currentColor" : _ref2$fillColor,
|
|
102534
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
102535
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", AutoCompleteIcons_objectSpread(AutoCompleteIcons_objectSpread({}, props), {}, {
|
|
102536
|
+
width: "24",
|
|
102537
|
+
height: "24",
|
|
102538
|
+
viewBox: "0 0 24 24",
|
|
102539
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
102540
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
102541
|
+
fillRule: "evenodd",
|
|
102542
|
+
clipRule: "evenodd",
|
|
102543
|
+
d: "M2.89001 6.10999C2.89001 6.66227 2.4423 7.10999 1.89001 7.10999C1.33773 7.10999 0.890015 6.66227 0.890015 6.10999C0.890015 5.5577 1.33773 5.10999 1.89001 5.10999C2.4423 5.10999 2.89001 5.5577 2.89001 6.10999ZM5.67004 7.10999L22.11 7.10999C22.3753 7.10999 22.6296 7.00463 22.8172 6.81709C23.0047 6.62956 23.11 6.3752 23.11 6.10999C23.11 5.84477 23.0047 5.59041 22.8172 5.40288C22.6296 5.21534 22.3753 5.10999 22.11 5.10999L5.67004 5.10999C5.40483 5.10999 5.15047 5.21534 4.96294 5.40288C4.7754 5.59041 4.67004 5.84477 4.67004 6.10999C4.67004 6.3752 4.7754 6.62956 4.96294 6.81709C5.15047 7.00463 5.40483 7.10999 5.67004 7.10999ZM5.67004 13.11L22.11 13.11C22.3753 13.11 22.6296 13.0046 22.8172 12.8171C23.0047 12.6296 23.11 12.3752 23.11 12.11C23.11 11.8448 23.0047 11.5904 22.8172 11.4029C22.6296 11.2153 22.3753 11.11 22.11 11.11L5.67004 11.11C5.40483 11.11 5.15047 11.2153 4.96294 11.4029C4.7754 11.5904 4.67004 11.8448 4.67004 12.11C4.67004 12.3752 4.7754 12.6296 4.96294 12.8171C5.15047 13.0046 5.40483 13.11 5.67004 13.11ZM22.11 19.11L5.67004 19.11C5.40483 19.11 5.15047 19.0046 4.96294 18.8171C4.7754 18.6296 4.67004 18.3752 4.67004 18.11C4.67004 17.8448 4.7754 17.5904 4.96294 17.4029C5.15047 17.2153 5.40483 17.11 5.67004 17.11L22.11 17.11C22.3753 17.11 22.6296 17.2153 22.8172 17.4029C23.0047 17.5904 23.11 17.8448 23.11 18.11C23.11 18.3752 23.0047 18.6296 22.8172 18.8171C22.6296 19.0046 22.3753 19.11 22.11 19.11ZM1.89001 13.11C2.4423 13.11 2.89001 12.6623 2.89001 12.11C2.89001 11.5577 2.4423 11.11 1.89001 11.11C1.33773 11.11 0.890015 11.5577 0.890015 12.11C0.890015 12.6623 1.33773 13.11 1.89001 13.11ZM2.89001 18.11C2.89001 18.6623 2.4423 19.11 1.89001 19.11C1.33773 19.11 0.890015 18.6623 0.890015 18.11C0.890015 17.5577 1.33773 17.11 1.89001 17.11C2.4423 17.11 2.89001 17.5577 2.89001 18.11Z",
|
|
102544
|
+
fill: fillColor
|
|
102545
|
+
})
|
|
102546
|
+
}));
|
|
102547
|
+
}
|
|
102548
|
+
AutoCompleteTaskIcon.propTypes = {
|
|
102549
|
+
fillColor: (external_prop_types_default()).string
|
|
102550
|
+
};
|
|
102551
|
+
;// ./src/components/auto-complete/AutoCompleteSearchField.jsx
|
|
102552
|
+
function AutoCompleteSearchField_typeof(o) { "@babel/helpers - typeof"; return AutoCompleteSearchField_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, AutoCompleteSearchField_typeof(o); }
|
|
102553
|
+
function AutoCompleteSearchField_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
102554
|
+
function AutoCompleteSearchField_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? AutoCompleteSearchField_ownKeys(Object(t), !0).forEach(function (r) { AutoCompleteSearchField_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : AutoCompleteSearchField_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
102555
|
+
function AutoCompleteSearchField_defineProperty(e, r, t) { return (r = AutoCompleteSearchField_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
102556
|
+
function AutoCompleteSearchField_toPropertyKey(t) { var i = AutoCompleteSearchField_toPrimitive(t, "string"); return "symbol" == AutoCompleteSearchField_typeof(i) ? i : i + ""; }
|
|
102557
|
+
function AutoCompleteSearchField_toPrimitive(t, r) { if ("object" != AutoCompleteSearchField_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != AutoCompleteSearchField_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
102558
|
+
|
|
102559
|
+
|
|
102560
|
+
|
|
102561
|
+
|
|
102562
|
+
|
|
102563
|
+
|
|
102564
|
+
|
|
102565
|
+
|
|
102566
|
+
function AutoCompleteSearchField(_ref) {
|
|
102567
|
+
var _parent$$autoComplete;
|
|
102568
|
+
var activeDescendantId = _ref.activeDescendantId,
|
|
102569
|
+
clearSearch = _ref.clearSearch,
|
|
102570
|
+
copy = _ref.copy,
|
|
102571
|
+
inputRef = _ref.inputRef,
|
|
102572
|
+
listboxId = _ref.listboxId,
|
|
102573
|
+
onChange = _ref.onChange,
|
|
102574
|
+
onInputKeyDown = _ref.onInputKeyDown,
|
|
102575
|
+
onSubmit = _ref.onSubmit,
|
|
102576
|
+
query = _ref.query,
|
|
102577
|
+
showPanel = _ref.showPanel,
|
|
102578
|
+
statusId = _ref.statusId,
|
|
102579
|
+
parent$ = _ref.parent$;
|
|
102580
|
+
var formAriaLabel = getCopyValue(copy, "form_aria_label", "formAriaLabel", "Site search");
|
|
102581
|
+
var inputAriaLabel = getCopyValue(copy, "input_aria_label", "inputAriaLabel", "Product search");
|
|
102582
|
+
var hasQuery = Boolean(String(query !== null && query !== void 0 ? query : "").trim());
|
|
102583
|
+
var editing = isEditingMode();
|
|
102584
|
+
var autoCompleteTextboxTag = (_parent$$autoComplete = parent$ === null || parent$ === void 0 ? void 0 : parent$.autoCompleteTextbox) !== null && _parent$$autoComplete !== void 0 ? _parent$$autoComplete : parent$ === null || parent$ === void 0 ? void 0 : parent$.searchPlaceholder;
|
|
102585
|
+
var autoCompleteSearchIconTag = parent$ === null || parent$ === void 0 ? void 0 : parent$.autoCompleteSearchIcon;
|
|
102586
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(AutoCompletePillForm, {
|
|
102587
|
+
onSubmit: onSubmit,
|
|
102588
|
+
role: "search",
|
|
102589
|
+
"aria-label": formAriaLabel,
|
|
102590
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(SearchIconButton, AutoCompleteSearchField_objectSpread(AutoCompleteSearchField_objectSpread({
|
|
102591
|
+
type: "button",
|
|
102592
|
+
"aria-label": "Search",
|
|
102593
|
+
"data-testid": "autocomplete-search-button"
|
|
102594
|
+
}, autoCompleteSearchIconTag !== null && autoCompleteSearchIconTag !== void 0 ? autoCompleteSearchIconTag : {}), {}, {
|
|
102595
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Search/* default */.A, {
|
|
102596
|
+
fontSize: "inherit",
|
|
102597
|
+
"aria-hidden": true,
|
|
102598
|
+
"data-testid": "autocomplete-search-icon"
|
|
102599
|
+
})
|
|
102600
|
+
})), /*#__PURE__*/(0,jsx_runtime_.jsx)("input", AutoCompleteSearchField_objectSpread(AutoCompleteSearchField_objectSpread({
|
|
102601
|
+
ref: inputRef,
|
|
102602
|
+
type: "search",
|
|
102603
|
+
name: "header-product-search",
|
|
102604
|
+
"data-testid": "autocomplete-input",
|
|
102605
|
+
autoComplete: "off",
|
|
102606
|
+
autoCorrect: "off",
|
|
102607
|
+
spellCheck: "false",
|
|
102608
|
+
role: "combobox",
|
|
102609
|
+
"aria-label": inputAriaLabel,
|
|
102610
|
+
"aria-autocomplete": "list",
|
|
102611
|
+
"aria-expanded": showPanel,
|
|
102612
|
+
"aria-controls": listboxId
|
|
102613
|
+
}, activeDescendantId ? {
|
|
102614
|
+
"aria-activedescendant": activeDescendantId
|
|
102615
|
+
} : {}), {}, {
|
|
102616
|
+
"aria-describedby": statusId,
|
|
102617
|
+
placeholder: copy.placeholder,
|
|
102618
|
+
value: query,
|
|
102619
|
+
onChange: onChange,
|
|
102620
|
+
onKeyDown: onInputKeyDown
|
|
102621
|
+
}, editing ? autoCompleteTextboxTag : undefined)), hasQuery ? /*#__PURE__*/(0,jsx_runtime_.jsx)(ClearSearchButton, {
|
|
102622
|
+
type: "button",
|
|
102623
|
+
"data-testid": "autocomplete-clear-button",
|
|
102624
|
+
"aria-label": "Clear search",
|
|
102625
|
+
onClick: clearSearch,
|
|
102626
|
+
tabIndex: -1,
|
|
102627
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteCloseIcon, {
|
|
102628
|
+
"aria-hidden": true
|
|
102629
|
+
})
|
|
102630
|
+
}) : null]
|
|
102631
|
+
});
|
|
102632
|
+
}
|
|
102633
|
+
AutoCompleteSearchField.propTypes = {
|
|
102634
|
+
activeDescendantId: (external_prop_types_default()).string,
|
|
102635
|
+
clearSearch: (external_prop_types_default()).func.isRequired,
|
|
102636
|
+
copy: external_prop_types_default().shape({
|
|
102637
|
+
form_aria_label: (external_prop_types_default()).string,
|
|
102638
|
+
formAriaLabel: (external_prop_types_default()).string,
|
|
102639
|
+
input_aria_label: (external_prop_types_default()).string,
|
|
102640
|
+
inputAriaLabel: (external_prop_types_default()).string,
|
|
102641
|
+
placeholder: (external_prop_types_default()).string.isRequired
|
|
102642
|
+
}).isRequired,
|
|
102643
|
+
inputRef: external_prop_types_default().shape({
|
|
102644
|
+
current: (external_prop_types_default()).any
|
|
102645
|
+
}).isRequired,
|
|
102646
|
+
listboxId: (external_prop_types_default()).string.isRequired,
|
|
102647
|
+
onChange: (external_prop_types_default()).func.isRequired,
|
|
102648
|
+
onInputKeyDown: (external_prop_types_default()).func.isRequired,
|
|
102649
|
+
onSubmit: (external_prop_types_default()).func.isRequired,
|
|
102650
|
+
query: (external_prop_types_default()).string.isRequired,
|
|
102651
|
+
showPanel: (external_prop_types_default()).bool.isRequired,
|
|
102652
|
+
statusId: (external_prop_types_default()).string.isRequired,
|
|
102653
|
+
parent$: (external_prop_types_default()).object
|
|
102654
|
+
};
|
|
102655
|
+
;// ./src/components/auto-complete/AutoCompleteSuggestionRow.jsx
|
|
102656
|
+
|
|
102657
|
+
|
|
102658
|
+
|
|
102659
|
+
|
|
102660
|
+
|
|
102661
|
+
|
|
102662
|
+
function renderSuggestionAction(_ref) {
|
|
102663
|
+
var suggestionOption = _ref.suggestionOption,
|
|
102664
|
+
suggestionIndex = _ref.suggestionIndex,
|
|
102665
|
+
displayLabel = _ref.displayLabel,
|
|
102666
|
+
isBundle = _ref.isBundle,
|
|
102667
|
+
isOutOfStock = _ref.isOutOfStock,
|
|
102668
|
+
onHighlightSuggestion = _ref.onHighlightSuggestion,
|
|
102669
|
+
onRunSuggestionAction = _ref.onRunSuggestionAction;
|
|
102670
|
+
var actionTestId = "suggestion-icon-".concat(suggestionOption.id);
|
|
102671
|
+
var suggestionType = isBundle ? "bundle" : "single";
|
|
102672
|
+
if (isOutOfStock) {
|
|
102673
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(SuggestionActionIcon, {
|
|
102674
|
+
"data-testid": actionTestId,
|
|
102675
|
+
"data-suggestion-type": suggestionType,
|
|
102676
|
+
"data-out-of-stock": "true",
|
|
102677
|
+
children: isBundle ? /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteTaskIcon, {
|
|
102678
|
+
"aria-hidden": true,
|
|
102679
|
+
"data-testid": "suggestion-bundle-icon-".concat(suggestionOption.id),
|
|
102680
|
+
fillColor: "currentColor"
|
|
102681
|
+
}) : /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteCartIcon, {
|
|
102682
|
+
"aria-hidden": true,
|
|
102683
|
+
"data-testid": "suggestion-cart-icon-".concat(suggestionOption.id),
|
|
102684
|
+
fillColor: "currentColor"
|
|
102685
|
+
})
|
|
102686
|
+
});
|
|
101495
102687
|
}
|
|
102688
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(SuggestionActionButton, {
|
|
102689
|
+
type: "button",
|
|
102690
|
+
"data-testid": actionTestId,
|
|
102691
|
+
"data-suggestion-type": suggestionType,
|
|
102692
|
+
"aria-label": isBundle ? "Open bundle action for ".concat(displayLabel) : "Add ".concat(displayLabel, " to cart"),
|
|
102693
|
+
onFocus: function onFocus() {
|
|
102694
|
+
return onHighlightSuggestion(suggestionIndex);
|
|
102695
|
+
},
|
|
102696
|
+
onClick: function onClick(event) {
|
|
102697
|
+
event.stopPropagation();
|
|
102698
|
+
onRunSuggestionAction(suggestionOption);
|
|
102699
|
+
},
|
|
102700
|
+
children: isBundle ? /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteTaskIcon, {
|
|
102701
|
+
"aria-hidden": true,
|
|
102702
|
+
"data-testid": "suggestion-bundle-icon-".concat(suggestionOption.id),
|
|
102703
|
+
fillColor: "currentColor"
|
|
102704
|
+
}) : /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteCartIcon, {
|
|
102705
|
+
"aria-hidden": true,
|
|
102706
|
+
"data-testid": "suggestion-cart-icon-".concat(suggestionOption.id),
|
|
102707
|
+
fillColor: "currentColor"
|
|
102708
|
+
})
|
|
102709
|
+
});
|
|
102710
|
+
}
|
|
102711
|
+
function AutoCompleteSuggestionRow(_ref2) {
|
|
102712
|
+
var _suggestionOption$out, _ref3, _suggestionOption$sug;
|
|
102713
|
+
var inputRef = _ref2.inputRef,
|
|
102714
|
+
isHighlighted = _ref2.isHighlighted,
|
|
102715
|
+
isSelected = _ref2.isSelected,
|
|
102716
|
+
onHighlightSuggestion = _ref2.onHighlightSuggestion,
|
|
102717
|
+
onRunSuggestionAction = _ref2.onRunSuggestionAction,
|
|
102718
|
+
onSelectSuggestion = _ref2.onSelectSuggestion,
|
|
102719
|
+
registerSuggestionNode = _ref2.registerSuggestionNode,
|
|
102720
|
+
suggestionIndex = _ref2.suggestionIndex,
|
|
102721
|
+
suggestionOption = _ref2.suggestionOption,
|
|
102722
|
+
suggestionOptionId = _ref2.suggestionOptionId;
|
|
102723
|
+
var _getSuggestionDisplay = getSuggestionDisplayData(suggestionOption),
|
|
102724
|
+
imageSrc = _getSuggestionDisplay.imageSrc,
|
|
102725
|
+
displayLabel = _getSuggestionDisplay.displayLabel,
|
|
102726
|
+
isBundle = _getSuggestionDisplay.isBundle,
|
|
102727
|
+
isDidYouMean = _getSuggestionDisplay.isDidYouMean,
|
|
102728
|
+
isOutOfStock = _getSuggestionDisplay.isOutOfStock;
|
|
102729
|
+
var optionOutOfStock = (_suggestionOption$out = suggestionOption.out_of_stock) !== null && _suggestionOption$out !== void 0 ? _suggestionOption$out : suggestionOption.outOfStock;
|
|
102730
|
+
var suggestionType = (_ref3 = (_suggestionOption$sug = suggestionOption.suggestion_type) !== null && _suggestionOption$sug !== void 0 ? _suggestionOption$sug : suggestionOption.suggestionType) !== null && _ref3 !== void 0 ? _ref3 : "product";
|
|
102731
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(SuggestionRow, {
|
|
102732
|
+
id: suggestionOptionId,
|
|
102733
|
+
"data-testid": "suggestion-row-".concat(suggestionOption.id),
|
|
102734
|
+
"data-highlighted": isHighlighted ? "true" : "false",
|
|
102735
|
+
"data-selected": isSelected ? "true" : "false",
|
|
102736
|
+
"data-suggestion-type": suggestionType,
|
|
102737
|
+
onMouseEnter: function onMouseEnter() {
|
|
102738
|
+
return onHighlightSuggestion(suggestionIndex);
|
|
102739
|
+
},
|
|
102740
|
+
"data-out-of-stock": optionOutOfStock ? "true" : "false",
|
|
102741
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)(SuggestionContentWrapper, {
|
|
102742
|
+
ref: registerSuggestionNode,
|
|
102743
|
+
tabIndex: 0,
|
|
102744
|
+
"data-testid": "suggestion-content-".concat(suggestionOption.id),
|
|
102745
|
+
"data-suggestion-type": suggestionType,
|
|
102746
|
+
"data-out-of-stock": optionOutOfStock ? "true" : "false",
|
|
102747
|
+
onFocus: function onFocus() {
|
|
102748
|
+
return onHighlightSuggestion(suggestionIndex);
|
|
102749
|
+
},
|
|
102750
|
+
onClick: function onClick() {
|
|
102751
|
+
return onSelectSuggestion(suggestionOption);
|
|
102752
|
+
},
|
|
102753
|
+
onKeyDown: function onKeyDown(event) {
|
|
102754
|
+
if ((event.key === "Enter" || event.key === " ") && !optionOutOfStock) {
|
|
102755
|
+
event.preventDefault();
|
|
102756
|
+
onSelectSuggestion(suggestionOption);
|
|
102757
|
+
} else if (event.key === "Tab" && event.shiftKey) {
|
|
102758
|
+
var hasPreviousSuggestion = suggestionIndex > 0;
|
|
102759
|
+
if (!hasPreviousSuggestion) {
|
|
102760
|
+
var _inputRef$current;
|
|
102761
|
+
event.preventDefault();
|
|
102762
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
102763
|
+
}
|
|
102764
|
+
}
|
|
102765
|
+
},
|
|
102766
|
+
children: [imageSrc ? /*#__PURE__*/(0,jsx_runtime_.jsx)(SuggestionThumbnail, {
|
|
102767
|
+
src: imageSrc,
|
|
102768
|
+
alt: "",
|
|
102769
|
+
"aria-hidden": true,
|
|
102770
|
+
"data-testid": "suggestion-thumbnail-".concat(suggestionOption.id)
|
|
102771
|
+
}) : null, /*#__PURE__*/(0,jsx_runtime_.jsx)(SuggestionLabel, {
|
|
102772
|
+
children: displayLabel
|
|
102773
|
+
})]
|
|
102774
|
+
}), !isDidYouMean ? renderSuggestionAction({
|
|
102775
|
+
suggestionOption: suggestionOption,
|
|
102776
|
+
suggestionIndex: suggestionIndex,
|
|
102777
|
+
displayLabel: displayLabel,
|
|
102778
|
+
isBundle: isBundle,
|
|
102779
|
+
isOutOfStock: isOutOfStock,
|
|
102780
|
+
onHighlightSuggestion: onHighlightSuggestion,
|
|
102781
|
+
onRunSuggestionAction: onRunSuggestionAction
|
|
102782
|
+
}) : null]
|
|
102783
|
+
});
|
|
102784
|
+
}
|
|
102785
|
+
AutoCompleteSuggestionRow.propTypes = {
|
|
102786
|
+
inputRef: external_prop_types_default().shape({
|
|
102787
|
+
current: (external_prop_types_default()).any
|
|
102788
|
+
}).isRequired,
|
|
102789
|
+
isHighlighted: (external_prop_types_default()).bool.isRequired,
|
|
102790
|
+
isSelected: (external_prop_types_default()).bool.isRequired,
|
|
102791
|
+
onHighlightSuggestion: (external_prop_types_default()).func.isRequired,
|
|
102792
|
+
onRunSuggestionAction: (external_prop_types_default()).func.isRequired,
|
|
102793
|
+
onSelectSuggestion: (external_prop_types_default()).func.isRequired,
|
|
102794
|
+
registerSuggestionNode: (external_prop_types_default()).func.isRequired,
|
|
102795
|
+
suggestionIndex: (external_prop_types_default()).number.isRequired,
|
|
102796
|
+
suggestionOption: external_prop_types_default().shape({
|
|
102797
|
+
id: (external_prop_types_default()).string.isRequired,
|
|
102798
|
+
image: (external_prop_types_default()).string,
|
|
102799
|
+
image_url: (external_prop_types_default()).string,
|
|
102800
|
+
imageURL: (external_prop_types_default()).string,
|
|
102801
|
+
label: (external_prop_types_default()).string,
|
|
102802
|
+
out_of_stock: (external_prop_types_default()).bool,
|
|
102803
|
+
outOfStock: (external_prop_types_default()).bool,
|
|
102804
|
+
product_type: (external_prop_types_default()).string,
|
|
102805
|
+
productType: (external_prop_types_default()).string,
|
|
102806
|
+
suggestion_type: (external_prop_types_default()).string,
|
|
102807
|
+
thumbnail: (external_prop_types_default()).string,
|
|
102808
|
+
value: (external_prop_types_default()).string,
|
|
102809
|
+
suggestionType: (external_prop_types_default()).string
|
|
102810
|
+
}).isRequired,
|
|
102811
|
+
suggestionOptionId: (external_prop_types_default()).string.isRequired
|
|
102812
|
+
};
|
|
102813
|
+
;// ./src/components/auto-complete/AutoCompleteSeeMoreLink.jsx
|
|
102814
|
+
|
|
102815
|
+
|
|
102816
|
+
|
|
102817
|
+
|
|
102818
|
+
function AutoCompleteSeeMoreLink(_ref) {
|
|
102819
|
+
var seeMoreLinkRef = _ref.seeMoreLinkRef,
|
|
102820
|
+
seeMoreLinkFocused = _ref.seeMoreLinkFocused,
|
|
102821
|
+
inputRef = _ref.inputRef,
|
|
102822
|
+
onBlurSeeMoreLink = _ref.onBlurSeeMoreLink,
|
|
102823
|
+
onFocusSeeMoreLink = _ref.onFocusSeeMoreLink,
|
|
102824
|
+
onSeeMoreResults = _ref.onSeeMoreResults,
|
|
102825
|
+
resetSeeMoreLinkFocus = _ref.resetSeeMoreLinkFocus,
|
|
102826
|
+
restoreLastSuggestion = _ref.restoreLastSuggestion,
|
|
102827
|
+
seeMoreResultsText = _ref.seeMoreResultsText;
|
|
102828
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(SeeMoreLinkContainer, {
|
|
102829
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(SeeMoreLinkText, {
|
|
102830
|
+
ref: seeMoreLinkRef,
|
|
102831
|
+
type: "button",
|
|
102832
|
+
"data-testid": "autocomplete-see-more-button",
|
|
102833
|
+
"data-highlighted": seeMoreLinkFocused ? "true" : "false",
|
|
102834
|
+
onClick: onSeeMoreResults,
|
|
102835
|
+
onFocus: onFocusSeeMoreLink,
|
|
102836
|
+
onBlur: onBlurSeeMoreLink,
|
|
102837
|
+
onKeyDown: function onKeyDown(event) {
|
|
102838
|
+
if (event.key === "ArrowUp") {
|
|
102839
|
+
var _inputRef$current;
|
|
102840
|
+
event.preventDefault();
|
|
102841
|
+
resetSeeMoreLinkFocus();
|
|
102842
|
+
restoreLastSuggestion();
|
|
102843
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
102844
|
+
} else if (event.key === "Escape") {
|
|
102845
|
+
var _inputRef$current2;
|
|
102846
|
+
event.preventDefault();
|
|
102847
|
+
resetSeeMoreLinkFocus();
|
|
102848
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
|
|
102849
|
+
}
|
|
102850
|
+
},
|
|
102851
|
+
children: seeMoreResultsText
|
|
102852
|
+
})
|
|
102853
|
+
});
|
|
102854
|
+
}
|
|
102855
|
+
AutoCompleteSeeMoreLink.propTypes = {
|
|
102856
|
+
seeMoreLinkRef: external_prop_types_default().shape({
|
|
102857
|
+
current: (external_prop_types_default()).any
|
|
102858
|
+
}).isRequired,
|
|
102859
|
+
seeMoreLinkFocused: (external_prop_types_default()).bool.isRequired,
|
|
102860
|
+
inputRef: external_prop_types_default().shape({
|
|
102861
|
+
current: (external_prop_types_default()).any
|
|
102862
|
+
}).isRequired,
|
|
102863
|
+
onBlurSeeMoreLink: (external_prop_types_default()).func.isRequired,
|
|
102864
|
+
onFocusSeeMoreLink: (external_prop_types_default()).func.isRequired,
|
|
102865
|
+
onSeeMoreResults: (external_prop_types_default()).func.isRequired,
|
|
102866
|
+
resetSeeMoreLinkFocus: (external_prop_types_default()).func.isRequired,
|
|
102867
|
+
restoreLastSuggestion: (external_prop_types_default()).func.isRequired,
|
|
102868
|
+
seeMoreResultsText: (external_prop_types_default()).string.isRequired
|
|
102869
|
+
};
|
|
102870
|
+
;// ./src/components/auto-complete/AutoCompleteSuggestionsPanel.jsx
|
|
102871
|
+
function AutoCompleteSuggestionsPanel_typeof(o) { "@babel/helpers - typeof"; return AutoCompleteSuggestionsPanel_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, AutoCompleteSuggestionsPanel_typeof(o); }
|
|
102872
|
+
function AutoCompleteSuggestionsPanel_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
102873
|
+
function AutoCompleteSuggestionsPanel_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? AutoCompleteSuggestionsPanel_ownKeys(Object(t), !0).forEach(function (r) { AutoCompleteSuggestionsPanel_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : AutoCompleteSuggestionsPanel_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
102874
|
+
function AutoCompleteSuggestionsPanel_defineProperty(e, r, t) { return (r = AutoCompleteSuggestionsPanel_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
102875
|
+
function AutoCompleteSuggestionsPanel_toPropertyKey(t) { var i = AutoCompleteSuggestionsPanel_toPrimitive(t, "string"); return "symbol" == AutoCompleteSuggestionsPanel_typeof(i) ? i : i + ""; }
|
|
102876
|
+
function AutoCompleteSuggestionsPanel_toPrimitive(t, r) { if ("object" != AutoCompleteSuggestionsPanel_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != AutoCompleteSuggestionsPanel_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
102877
|
+
function AutoCompleteSuggestionsPanel_slicedToArray(r, e) { return AutoCompleteSuggestionsPanel_arrayWithHoles(r) || AutoCompleteSuggestionsPanel_iterableToArrayLimit(r, e) || AutoCompleteSuggestionsPanel_unsupportedIterableToArray(r, e) || AutoCompleteSuggestionsPanel_nonIterableRest(); }
|
|
102878
|
+
function AutoCompleteSuggestionsPanel_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
102879
|
+
function AutoCompleteSuggestionsPanel_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return AutoCompleteSuggestionsPanel_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? AutoCompleteSuggestionsPanel_arrayLikeToArray(r, a) : void 0; } }
|
|
102880
|
+
function AutoCompleteSuggestionsPanel_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
102881
|
+
function AutoCompleteSuggestionsPanel_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
102882
|
+
function AutoCompleteSuggestionsPanel_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
102883
|
+
|
|
102884
|
+
|
|
102885
|
+
|
|
102886
|
+
|
|
102887
|
+
|
|
102888
|
+
|
|
102889
|
+
var MAX_VISIBLE_RECENT_SEARCHES = 6;
|
|
102890
|
+
function AutoCompleteSuggestionsPanel(_ref) {
|
|
102891
|
+
var didYouMeanText = _ref.didYouMeanText,
|
|
102892
|
+
emptyFetched = _ref.emptyFetched,
|
|
102893
|
+
footerActionRef = _ref.footerActionRef,
|
|
102894
|
+
footerFocused = _ref.footerFocused,
|
|
102895
|
+
hasDidYouMean = _ref.hasDidYouMean,
|
|
102896
|
+
hasMoreResults = _ref.hasMoreResults,
|
|
102897
|
+
inputRef = _ref.inputRef,
|
|
102898
|
+
listboxId = _ref.listboxId,
|
|
102899
|
+
listboxLabel = _ref.listboxLabel,
|
|
102900
|
+
loading = _ref.loading,
|
|
102901
|
+
noSuggestionsText = _ref.noSuggestionsText,
|
|
102902
|
+
onBlurFooter = _ref.onBlurFooter,
|
|
102903
|
+
onFocusFooter = _ref.onFocusFooter,
|
|
102904
|
+
onRecentSearchSelect = _ref.onRecentSearchSelect,
|
|
102905
|
+
onSeeMoreResults = _ref.onSeeMoreResults,
|
|
102906
|
+
renderSuggestionRow = _ref.renderSuggestionRow,
|
|
102907
|
+
recentSearches = _ref.recentSearches,
|
|
102908
|
+
recentSearchesHeading = _ref.recentSearchesHeading,
|
|
102909
|
+
parent$ = _ref.parent$,
|
|
102910
|
+
resetFooterFocus = _ref.resetFooterFocus,
|
|
102911
|
+
restoreLastSuggestion = _ref.restoreLastSuggestion,
|
|
102912
|
+
clearAllLabel = _ref.clearAllLabel,
|
|
102913
|
+
onClearRecentSearches = _ref.onClearRecentSearches,
|
|
102914
|
+
seeMoreResultsText = _ref.seeMoreResultsText,
|
|
102915
|
+
visibleSuggestions = _ref.visibleSuggestions;
|
|
102916
|
+
var _useState = (0,external_react_.useState)(false),
|
|
102917
|
+
_useState2 = AutoCompleteSuggestionsPanel_slicedToArray(_useState, 2),
|
|
102918
|
+
showAllRecentSearches = _useState2[0],
|
|
102919
|
+
setShowAllRecentSearches = _useState2[1];
|
|
102920
|
+
var editing = isEditingMode();
|
|
102921
|
+
(0,external_react_.useEffect)(function () {
|
|
102922
|
+
setShowAllRecentSearches(false);
|
|
102923
|
+
}, [recentSearches]);
|
|
102924
|
+
var shouldRenderDidYouMean = !loading && hasDidYouMean;
|
|
102925
|
+
var shouldRenderNoSuggestions = !loading && emptyFetched && visibleSuggestions.length === 0;
|
|
102926
|
+
var shouldRenderSeeMore = !loading && hasMoreResults && !hasDidYouMean;
|
|
102927
|
+
var shouldRenderRecentSearches = !loading && visibleSuggestions.length === 0 && recentSearches.length > 0;
|
|
102928
|
+
var visibleRecentSearches = showAllRecentSearches ? recentSearches : recentSearches.slice(0, MAX_VISIBLE_RECENT_SEARCHES);
|
|
102929
|
+
var remainingRecentSearchesCount = Math.max(recentSearches.length - visibleRecentSearches.length, 0);
|
|
102930
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(SearchSuggestionsPanel, {
|
|
102931
|
+
"data-testid": "autocomplete-suggestions-panel",
|
|
102932
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)(SearchSuggestionsList, {
|
|
102933
|
+
id: listboxId,
|
|
102934
|
+
"data-testid": "autocomplete-results-list",
|
|
102935
|
+
"aria-label": listboxLabel,
|
|
102936
|
+
"aria-busy": loading,
|
|
102937
|
+
children: [loading && /*#__PURE__*/(0,jsx_runtime_.jsx)(PassiveSuggestionOption, {
|
|
102938
|
+
"data-highlighted": "false",
|
|
102939
|
+
children: "\u2026"
|
|
102940
|
+
}), shouldRenderDidYouMean && /*#__PURE__*/(0,jsx_runtime_.jsx)(SuggestionSectionHeading, {
|
|
102941
|
+
"data-testid": "autocomplete-did-you-mean-heading",
|
|
102942
|
+
children: didYouMeanText
|
|
102943
|
+
}), !loading && visibleSuggestions.map(renderSuggestionRow), shouldRenderNoSuggestions && /*#__PURE__*/(0,jsx_runtime_.jsx)(PassiveSuggestionOption, {
|
|
102944
|
+
"data-highlighted": "false",
|
|
102945
|
+
children: noSuggestionsText
|
|
102946
|
+
})]
|
|
102947
|
+
}), shouldRenderSeeMore && /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteSeeMoreLink, {
|
|
102948
|
+
seeMoreLinkRef: footerActionRef,
|
|
102949
|
+
seeMoreLinkFocused: footerFocused,
|
|
102950
|
+
inputRef: inputRef,
|
|
102951
|
+
onBlurSeeMoreLink: onBlurFooter,
|
|
102952
|
+
onFocusSeeMoreLink: onFocusFooter,
|
|
102953
|
+
onSeeMoreResults: onSeeMoreResults,
|
|
102954
|
+
resetSeeMoreLinkFocus: resetFooterFocus,
|
|
102955
|
+
restoreLastSuggestion: restoreLastSuggestion,
|
|
102956
|
+
seeMoreResultsText: seeMoreResultsText
|
|
102957
|
+
}), shouldRenderRecentSearches && /*#__PURE__*/(0,jsx_runtime_.jsxs)(RecentSearchesSection, {
|
|
102958
|
+
"data-testid": "autocomplete-recent-searches",
|
|
102959
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)(RecentSearchesHeader, {
|
|
102960
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(RecentSearchesTitle, AutoCompleteSuggestionsPanel_objectSpread(AutoCompleteSuggestionsPanel_objectSpread({}, editing ? parent$ === null || parent$ === void 0 ? void 0 : parent$.recentSearchesHeading : undefined), {}, {
|
|
102961
|
+
children: recentSearchesHeading
|
|
102962
|
+
})), /*#__PURE__*/(0,jsx_runtime_.jsx)(RecentSearchesClearButton, AutoCompleteSuggestionsPanel_objectSpread(AutoCompleteSuggestionsPanel_objectSpread({
|
|
102963
|
+
type: "button",
|
|
102964
|
+
onClick: onClearRecentSearches
|
|
102965
|
+
}, editing ? parent$ === null || parent$ === void 0 ? void 0 : parent$.clearAllLabel : undefined), {}, {
|
|
102966
|
+
children: clearAllLabel
|
|
102967
|
+
}))]
|
|
102968
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsxs)(RecentSearchesList, {
|
|
102969
|
+
children: [visibleRecentSearches.map(function (recentSearch) {
|
|
102970
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(RecentSearchChip, {
|
|
102971
|
+
type: "button",
|
|
102972
|
+
onClick: function onClick() {
|
|
102973
|
+
return onRecentSearchSelect(recentSearch);
|
|
102974
|
+
},
|
|
102975
|
+
children: recentSearch
|
|
102976
|
+
}, recentSearch);
|
|
102977
|
+
}), remainingRecentSearchesCount > 0 && !showAllRecentSearches ? /*#__PURE__*/(0,jsx_runtime_.jsxs)(RecentSearchOverflowChip, {
|
|
102978
|
+
type: "button",
|
|
102979
|
+
onClick: function onClick() {
|
|
102980
|
+
return setShowAllRecentSearches(true);
|
|
102981
|
+
},
|
|
102982
|
+
children: ["+", remainingRecentSearchesCount, " More"]
|
|
102983
|
+
}) : null]
|
|
102984
|
+
})]
|
|
102985
|
+
})]
|
|
102986
|
+
});
|
|
102987
|
+
}
|
|
102988
|
+
AutoCompleteSuggestionsPanel.propTypes = {
|
|
102989
|
+
didYouMeanText: (external_prop_types_default()).string.isRequired,
|
|
102990
|
+
emptyFetched: (external_prop_types_default()).bool.isRequired,
|
|
102991
|
+
footerActionRef: external_prop_types_default().shape({
|
|
102992
|
+
current: (external_prop_types_default()).any
|
|
102993
|
+
}).isRequired,
|
|
102994
|
+
footerFocused: (external_prop_types_default()).bool.isRequired,
|
|
102995
|
+
hasDidYouMean: (external_prop_types_default()).bool.isRequired,
|
|
102996
|
+
hasMoreResults: (external_prop_types_default()).bool.isRequired,
|
|
102997
|
+
inputRef: external_prop_types_default().shape({
|
|
102998
|
+
current: (external_prop_types_default()).any
|
|
102999
|
+
}).isRequired,
|
|
103000
|
+
listboxId: (external_prop_types_default()).string.isRequired,
|
|
103001
|
+
listboxLabel: (external_prop_types_default()).string.isRequired,
|
|
103002
|
+
loading: (external_prop_types_default()).bool.isRequired,
|
|
103003
|
+
noSuggestionsText: (external_prop_types_default()).string.isRequired,
|
|
103004
|
+
onBlurFooter: (external_prop_types_default()).func.isRequired,
|
|
103005
|
+
onFocusFooter: (external_prop_types_default()).func.isRequired,
|
|
103006
|
+
onRecentSearchSelect: (external_prop_types_default()).func.isRequired,
|
|
103007
|
+
onSeeMoreResults: (external_prop_types_default()).func.isRequired,
|
|
103008
|
+
recentSearches: external_prop_types_default().arrayOf((external_prop_types_default()).string).isRequired,
|
|
103009
|
+
recentSearchesHeading: (external_prop_types_default()).string.isRequired,
|
|
103010
|
+
parent$: (external_prop_types_default()).object,
|
|
103011
|
+
renderSuggestionRow: (external_prop_types_default()).func.isRequired,
|
|
103012
|
+
resetFooterFocus: (external_prop_types_default()).func.isRequired,
|
|
103013
|
+
restoreLastSuggestion: (external_prop_types_default()).func.isRequired,
|
|
103014
|
+
clearAllLabel: (external_prop_types_default()).string.isRequired,
|
|
103015
|
+
onClearRecentSearches: (external_prop_types_default()).func.isRequired,
|
|
103016
|
+
seeMoreResultsText: (external_prop_types_default()).string.isRequired,
|
|
103017
|
+
visibleSuggestions: external_prop_types_default().arrayOf((external_prop_types_default()).object).isRequired
|
|
103018
|
+
};
|
|
103019
|
+
;// ./src/components/auto-complete/AutoComplete.propTypes.js
|
|
103020
|
+
|
|
103021
|
+
var autoCompleteCopyShape = external_prop_types_default().shape({
|
|
103022
|
+
placeholder: (external_prop_types_default()).string.isRequired,
|
|
103023
|
+
input_aria_label: (external_prop_types_default()).string,
|
|
103024
|
+
inputAriaLabel: (external_prop_types_default()).string,
|
|
103025
|
+
listbox_aria_label: (external_prop_types_default()).string,
|
|
103026
|
+
listboxAriaLabel: (external_prop_types_default()).string,
|
|
103027
|
+
did_you_mean_text: (external_prop_types_default()).string,
|
|
103028
|
+
didYouMeanText: (external_prop_types_default()).string,
|
|
103029
|
+
no_suggestions_text: (external_prop_types_default()).string,
|
|
103030
|
+
noSuggestionsText: (external_prop_types_default()).string,
|
|
103031
|
+
see_more_results_text: (external_prop_types_default()).string,
|
|
103032
|
+
seeMoreResultsText: (external_prop_types_default()).string,
|
|
103033
|
+
form_aria_label: (external_prop_types_default()).string,
|
|
103034
|
+
formAriaLabel: (external_prop_types_default()).string
|
|
103035
|
+
});
|
|
103036
|
+
var autoCompleteHeaderSearchServiceShape = external_prop_types_default().shape({
|
|
103037
|
+
fetchSuggestions: (external_prop_types_default()).func.isRequired,
|
|
103038
|
+
submitProductSearch: (external_prop_types_default()).func.isRequired,
|
|
103039
|
+
activateSuggestionAction: (external_prop_types_default()).func,
|
|
103040
|
+
viewMoreResults: (external_prop_types_default()).func,
|
|
103041
|
+
getRecentSearches: (external_prop_types_default()).func,
|
|
103042
|
+
clearRecentSearches: (external_prop_types_default()).func
|
|
103043
|
+
});
|
|
103044
|
+
;// ./src/components/auto-complete/AutoComplete.helpers.js
|
|
103045
|
+
function isSuggestionDisabled(suggestionOption) {
|
|
103046
|
+
return Boolean(!suggestionOption || suggestionOption.out_of_stock || suggestionOption.outOfStock);
|
|
103047
|
+
}
|
|
103048
|
+
function handleSearchInputKeyDown(_ref) {
|
|
103049
|
+
var clearSearch = _ref.clearSearch,
|
|
103050
|
+
event = _ref.event,
|
|
103051
|
+
handleArrowDownKey = _ref.handleArrowDownKey,
|
|
103052
|
+
handleArrowUpKey = _ref.handleArrowUpKey,
|
|
103053
|
+
handleTabKey = _ref.handleTabKey;
|
|
103054
|
+
switch (event.key) {
|
|
103055
|
+
case "Tab":
|
|
103056
|
+
handleTabKey(event);
|
|
103057
|
+
break;
|
|
103058
|
+
case "ArrowDown":
|
|
103059
|
+
handleArrowDownKey(event);
|
|
103060
|
+
break;
|
|
103061
|
+
case "ArrowUp":
|
|
103062
|
+
handleArrowUpKey(event);
|
|
103063
|
+
break;
|
|
103064
|
+
case "Escape":
|
|
103065
|
+
event.preventDefault();
|
|
103066
|
+
clearSearch();
|
|
103067
|
+
break;
|
|
103068
|
+
default:
|
|
103069
|
+
break;
|
|
103070
|
+
}
|
|
103071
|
+
}
|
|
103072
|
+
function handleSearchSubmit(_ref2) {
|
|
103073
|
+
var highlightedIndex = _ref2.highlightedIndex,
|
|
103074
|
+
query = _ref2.query,
|
|
103075
|
+
setSelectedOptionId = _ref2.setSelectedOptionId,
|
|
103076
|
+
submitProductSearch = _ref2.submitProductSearch,
|
|
103077
|
+
visibleSuggestions = _ref2.visibleSuggestions,
|
|
103078
|
+
selectOption = _ref2.selectOption;
|
|
103079
|
+
var highlightedOption = visibleSuggestions[highlightedIndex];
|
|
103080
|
+
if (highlightedOption) {
|
|
103081
|
+
selectOption(highlightedOption);
|
|
103082
|
+
return;
|
|
103083
|
+
}
|
|
103084
|
+
setSelectedOptionId(null);
|
|
103085
|
+
submitProductSearch(query.trim());
|
|
103086
|
+
}
|
|
103087
|
+
function getVisibleSuggestions(_ref3) {
|
|
103088
|
+
var didYouMean = _ref3.didYouMean,
|
|
103089
|
+
suggestions = _ref3.suggestions;
|
|
103090
|
+
if (didYouMean.length > 0) {
|
|
103091
|
+
return didYouMean;
|
|
103092
|
+
}
|
|
103093
|
+
return suggestions;
|
|
103094
|
+
}
|
|
103095
|
+
function getFirstFocusableSuggestionIndex(hasSuggestions) {
|
|
103096
|
+
if (!hasSuggestions) {
|
|
103097
|
+
return -1;
|
|
103098
|
+
}
|
|
103099
|
+
return 0;
|
|
103100
|
+
}
|
|
103101
|
+
function getActiveDescendantId(_ref4) {
|
|
103102
|
+
var highlightedIndex = _ref4.highlightedIndex,
|
|
103103
|
+
listboxId = _ref4.listboxId,
|
|
103104
|
+
visibleSuggestions = _ref4.visibleSuggestions;
|
|
103105
|
+
var highlightedOption = visibleSuggestions[highlightedIndex];
|
|
103106
|
+
if (!highlightedOption || highlightedIndex < 0) {
|
|
103107
|
+
return undefined;
|
|
103108
|
+
}
|
|
103109
|
+
return "".concat(listboxId, "-opt-").concat(highlightedOption.id);
|
|
103110
|
+
}
|
|
103111
|
+
;// ./src/components/auto-complete/AutoComplete.jsx
|
|
103112
|
+
function AutoComplete_slicedToArray(r, e) { return AutoComplete_arrayWithHoles(r) || AutoComplete_iterableToArrayLimit(r, e) || AutoComplete_unsupportedIterableToArray(r, e) || AutoComplete_nonIterableRest(); }
|
|
103113
|
+
function AutoComplete_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
103114
|
+
function AutoComplete_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return AutoComplete_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? AutoComplete_arrayLikeToArray(r, a) : void 0; } }
|
|
103115
|
+
function AutoComplete_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
103116
|
+
function AutoComplete_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
103117
|
+
function AutoComplete_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
103118
|
+
|
|
103119
|
+
|
|
103120
|
+
|
|
103121
|
+
|
|
103122
|
+
|
|
103123
|
+
|
|
103124
|
+
|
|
103125
|
+
|
|
103126
|
+
|
|
103127
|
+
|
|
103128
|
+
|
|
103129
|
+
function AutoComplete(_ref) {
|
|
103130
|
+
var headerSearchService = _ref.headerSearchService,
|
|
103131
|
+
copy = _ref.copy,
|
|
103132
|
+
_ref$autoCompleteEnab = _ref.autoCompleteEnabled,
|
|
103133
|
+
autoCompleteEnabled = _ref$autoCompleteEnab === void 0 ? true : _ref$autoCompleteEnab,
|
|
103134
|
+
_ref$recentSearches = _ref.recentSearches,
|
|
103135
|
+
recentSearches = _ref$recentSearches === void 0 ? [] : _ref$recentSearches,
|
|
103136
|
+
_ref$recentSearchesHe = _ref.recentSearchesHeading,
|
|
103137
|
+
recentSearchesHeading = _ref$recentSearchesHe === void 0 ? "Recent searches" : _ref$recentSearchesHe,
|
|
103138
|
+
_ref$clearAllLabel = _ref.clearAllLabel,
|
|
103139
|
+
clearAllLabel = _ref$clearAllLabel === void 0 ? "Clear all" : _ref$clearAllLabel,
|
|
103140
|
+
onRecentSearchesChange = _ref.onRecentSearchesChange,
|
|
103141
|
+
parent$ = _ref.parent$,
|
|
103142
|
+
_ref$searchFieldEndSl = _ref.searchFieldEndSlot,
|
|
103143
|
+
searchFieldEndSlot = _ref$searchFieldEndSl === void 0 ? null : _ref$searchFieldEndSl,
|
|
103144
|
+
_ref$modalSearchLayou = _ref.modalSearchLayout,
|
|
103145
|
+
modalSearchLayout = _ref$modalSearchLayou === void 0 ? false : _ref$modalSearchLayou;
|
|
103146
|
+
var listboxId = (0,external_react_.useId)();
|
|
103147
|
+
var statusId = (0,external_react_.useId)();
|
|
103148
|
+
var rootRef = (0,external_react_.useRef)(null);
|
|
103149
|
+
var inputRef = (0,external_react_.useRef)(null);
|
|
103150
|
+
var footerActionRef = (0,external_react_.useRef)(null);
|
|
103151
|
+
var suggestionRowRefs = (0,external_react_.useRef)({});
|
|
103152
|
+
var _useState = (0,external_react_.useState)(-1),
|
|
103153
|
+
_useState2 = AutoComplete_slicedToArray(_useState, 2),
|
|
103154
|
+
highlightedIndex = _useState2[0],
|
|
103155
|
+
setHighlightedIndex = _useState2[1];
|
|
103156
|
+
var _useState3 = (0,external_react_.useState)(null),
|
|
103157
|
+
_useState4 = AutoComplete_slicedToArray(_useState3, 2),
|
|
103158
|
+
selectedOptionId = _useState4[0],
|
|
103159
|
+
setSelectedOptionId = _useState4[1];
|
|
103160
|
+
var _useState5 = (0,external_react_.useState)(false),
|
|
103161
|
+
_useState6 = AutoComplete_slicedToArray(_useState5, 2),
|
|
103162
|
+
footerFocused = _useState6[0],
|
|
103163
|
+
setFooterFocused = _useState6[1];
|
|
103164
|
+
var _useAutoCompleteSugge = useAutoCompleteSuggestions({
|
|
103165
|
+
headerSearchService: headerSearchService,
|
|
103166
|
+
enabled: autoCompleteEnabled
|
|
103167
|
+
}),
|
|
103168
|
+
clearQuery = _useAutoCompleteSugge.clearQuery,
|
|
103169
|
+
didYouMean = _useAutoCompleteSugge.didYouMean,
|
|
103170
|
+
emptyFetched = _useAutoCompleteSugge.emptyFetched,
|
|
103171
|
+
hasMoreResults = _useAutoCompleteSugge.hasMoreResults,
|
|
103172
|
+
hasQuery = _useAutoCompleteSugge.hasQuery,
|
|
103173
|
+
loading = _useAutoCompleteSugge.loading,
|
|
103174
|
+
query = _useAutoCompleteSugge.query,
|
|
103175
|
+
setQuery = _useAutoCompleteSugge.setQuery,
|
|
103176
|
+
suggestions = _useAutoCompleteSugge.suggestions,
|
|
103177
|
+
totalResultsCount = _useAutoCompleteSugge.totalResultsCount,
|
|
103178
|
+
updateQuery = _useAutoCompleteSugge.updateQuery;
|
|
103179
|
+
var showPanel = autoCompleteEnabled && hasQuery || recentSearches.length > 0;
|
|
103180
|
+
var listboxLabel = getCopyValue(copy, "listbox_aria_label", "listboxAriaLabel", "Search suggestions");
|
|
103181
|
+
var noSuggestionsText = getCopyValue(copy, "no_suggestions_text", "noSuggestionsText", "No suggestions");
|
|
103182
|
+
var seeMoreResultsText = getCopyValue(copy, "see_more_results_text", "seeMoreResultsText", "See More Results");
|
|
103183
|
+
var didYouMeanText = getCopyValue(copy, "did_you_mean_text", "didYouMeanText", "Did You Mean?");
|
|
103184
|
+
var visibleSuggestions = getVisibleSuggestions({
|
|
103185
|
+
didYouMean: didYouMean,
|
|
103186
|
+
suggestions: suggestions
|
|
103187
|
+
});
|
|
103188
|
+
var hasDidYouMean = didYouMean.length > 0;
|
|
103189
|
+
(0,external_react_.useEffect)(function () {
|
|
103190
|
+
function onDocMouseDown(event) {
|
|
103191
|
+
var _rootRef$current;
|
|
103192
|
+
if (!((_rootRef$current = rootRef.current) !== null && _rootRef$current !== void 0 && _rootRef$current.contains(event.target))) {
|
|
103193
|
+
setHighlightedIndex(-1);
|
|
103194
|
+
}
|
|
103195
|
+
}
|
|
103196
|
+
document.addEventListener("mousedown", onDocMouseDown);
|
|
103197
|
+
return function () {
|
|
103198
|
+
return document.removeEventListener("mousedown", onDocMouseDown);
|
|
103199
|
+
};
|
|
103200
|
+
}, []);
|
|
103201
|
+
(0,external_react_.useEffect)(function () {
|
|
103202
|
+
if (!hasQuery) {
|
|
103203
|
+
setHighlightedIndex(-1);
|
|
103204
|
+
setSelectedOptionId(null);
|
|
103205
|
+
setFooterFocused(false);
|
|
103206
|
+
return;
|
|
103207
|
+
}
|
|
103208
|
+
if (loading) {
|
|
103209
|
+
setFooterFocused(false);
|
|
103210
|
+
return;
|
|
103211
|
+
}
|
|
103212
|
+
setFooterFocused(false);
|
|
103213
|
+
var shouldHighlightFirstSuggestion = visibleSuggestions.length > 0 && !hasDidYouMean;
|
|
103214
|
+
setHighlightedIndex(shouldHighlightFirstSuggestion ? 0 : -1);
|
|
103215
|
+
setSelectedOptionId(function (currentSelectedOptionId) {
|
|
103216
|
+
return visibleSuggestions.some(function (suggestionOption) {
|
|
103217
|
+
return suggestionOption.id === currentSelectedOptionId;
|
|
103218
|
+
}) ? currentSelectedOptionId : null;
|
|
103219
|
+
});
|
|
103220
|
+
}, [hasDidYouMean, hasQuery, loading, visibleSuggestions]);
|
|
103221
|
+
var selectOption = (0,external_react_.useCallback)(function (option) {
|
|
103222
|
+
var _option$value, _option$id;
|
|
103223
|
+
if (isSuggestionDisabled(option)) return;
|
|
103224
|
+
var nextLabel = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.label;
|
|
103225
|
+
setQuery(nextLabel);
|
|
103226
|
+
setHighlightedIndex(-1);
|
|
103227
|
+
setSelectedOptionId((_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : null);
|
|
103228
|
+
setFooterFocused(false);
|
|
103229
|
+
headerSearchService.submitProductSearch(nextLabel, option);
|
|
103230
|
+
}, [headerSearchService]);
|
|
103231
|
+
var handleRecentSearchSelect = (0,external_react_.useCallback)(function (recentSearch) {
|
|
103232
|
+
var _headerSearchService$, _headerSearchService$2;
|
|
103233
|
+
var trimmedRecentSearch = String(recentSearch !== null && recentSearch !== void 0 ? recentSearch : "").trim();
|
|
103234
|
+
if (!trimmedRecentSearch) {
|
|
103235
|
+
return;
|
|
103236
|
+
}
|
|
103237
|
+
setQuery(trimmedRecentSearch);
|
|
103238
|
+
headerSearchService.submitProductSearch(trimmedRecentSearch);
|
|
103239
|
+
onRecentSearchesChange === null || onRecentSearchesChange === void 0 || onRecentSearchesChange((_headerSearchService$ = (_headerSearchService$2 = headerSearchService.getRecentSearches) === null || _headerSearchService$2 === void 0 ? void 0 : _headerSearchService$2.call(headerSearchService)) !== null && _headerSearchService$ !== void 0 ? _headerSearchService$ : []);
|
|
103240
|
+
}, [headerSearchService, onRecentSearchesChange, setQuery]);
|
|
103241
|
+
var handleClearRecentSearches = (0,external_react_.useCallback)(function () {
|
|
103242
|
+
var _headerSearchService$3;
|
|
103243
|
+
(_headerSearchService$3 = headerSearchService.clearRecentSearches) === null || _headerSearchService$3 === void 0 || _headerSearchService$3.call(headerSearchService);
|
|
103244
|
+
onRecentSearchesChange === null || onRecentSearchesChange === void 0 || onRecentSearchesChange([]);
|
|
103245
|
+
}, [headerSearchService, onRecentSearchesChange]);
|
|
103246
|
+
var hasSuggestions = visibleSuggestions.length > 0;
|
|
103247
|
+
var firstFocusableSuggestionIndex = getFirstFocusableSuggestionIndex(hasSuggestions);
|
|
103248
|
+
function focusSuggestionRowAt(index) {
|
|
103249
|
+
var _suggestionRowRefs$cu;
|
|
103250
|
+
var suggestionOption = visibleSuggestions[index];
|
|
103251
|
+
if (!suggestionOption) return;
|
|
103252
|
+
(_suggestionRowRefs$cu = suggestionRowRefs.current[suggestionOption.id]) === null || _suggestionRowRefs$cu === void 0 || _suggestionRowRefs$cu.focus();
|
|
103253
|
+
}
|
|
103254
|
+
function clearHighlightState() {
|
|
103255
|
+
setHighlightedIndex(-1);
|
|
103256
|
+
setFooterFocused(false);
|
|
103257
|
+
}
|
|
103258
|
+
function focusFooterAction() {
|
|
103259
|
+
var _footerActionRef$curr;
|
|
103260
|
+
clearHighlightState();
|
|
103261
|
+
setFooterFocused(true);
|
|
103262
|
+
(_footerActionRef$curr = footerActionRef.current) === null || _footerActionRef$curr === void 0 || _footerActionRef$curr.focus();
|
|
103263
|
+
}
|
|
103264
|
+
function focusLastSuggestionFromFooter() {
|
|
103265
|
+
var _inputRef$current;
|
|
103266
|
+
setFooterFocused(false);
|
|
103267
|
+
if (hasSuggestions) {
|
|
103268
|
+
setHighlightedIndex(visibleSuggestions.length - 1);
|
|
103269
|
+
}
|
|
103270
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
103271
|
+
}
|
|
103272
|
+
function runSuggestionAction(suggestionOption) {
|
|
103273
|
+
if (isSuggestionDisabled(suggestionOption)) return;
|
|
103274
|
+
if (typeof headerSearchService.activateSuggestionAction === "function") {
|
|
103275
|
+
headerSearchService.activateSuggestionAction(suggestionOption);
|
|
103276
|
+
return;
|
|
103277
|
+
}
|
|
103278
|
+
selectOption(suggestionOption);
|
|
103279
|
+
}
|
|
103280
|
+
function onSubmit(event) {
|
|
103281
|
+
event.preventDefault();
|
|
103282
|
+
var effectiveHighlightedIndex = hasDidYouMean && highlightedIndex < 0 && visibleSuggestions.length > 0 ? 0 : highlightedIndex;
|
|
103283
|
+
handleSearchSubmit({
|
|
103284
|
+
highlightedIndex: effectiveHighlightedIndex,
|
|
103285
|
+
query: query,
|
|
103286
|
+
selectOption: selectOption,
|
|
103287
|
+
setSelectedOptionId: setSelectedOptionId,
|
|
103288
|
+
submitProductSearch: headerSearchService.submitProductSearch,
|
|
103289
|
+
visibleSuggestions: visibleSuggestions
|
|
103290
|
+
});
|
|
103291
|
+
}
|
|
103292
|
+
function handleTabKey(event) {
|
|
103293
|
+
if (event.shiftKey || firstFocusableSuggestionIndex < 0) {
|
|
103294
|
+
return;
|
|
103295
|
+
}
|
|
103296
|
+
event.preventDefault();
|
|
103297
|
+
focusSuggestionRowAt(firstFocusableSuggestionIndex);
|
|
103298
|
+
}
|
|
103299
|
+
function handleArrowDownKey(event) {
|
|
103300
|
+
event.preventDefault();
|
|
103301
|
+
if (footerFocused) {
|
|
103302
|
+
var _footerActionRef$curr2;
|
|
103303
|
+
(_footerActionRef$curr2 = footerActionRef.current) === null || _footerActionRef$curr2 === void 0 || _footerActionRef$curr2.focus();
|
|
103304
|
+
return;
|
|
103305
|
+
}
|
|
103306
|
+
if (!hasSuggestions) {
|
|
103307
|
+
return;
|
|
103308
|
+
}
|
|
103309
|
+
if (hasMoreResults && highlightedIndex >= visibleSuggestions.length - 1) {
|
|
103310
|
+
focusFooterAction();
|
|
103311
|
+
return;
|
|
103312
|
+
}
|
|
103313
|
+
setFooterFocused(false);
|
|
103314
|
+
setHighlightedIndex(function (currentIndex) {
|
|
103315
|
+
return currentIndex < visibleSuggestions.length - 1 ? currentIndex + 1 : 0;
|
|
103316
|
+
});
|
|
103317
|
+
}
|
|
103318
|
+
function handleArrowUpKey(event) {
|
|
103319
|
+
event.preventDefault();
|
|
103320
|
+
if (footerFocused) {
|
|
103321
|
+
focusLastSuggestionFromFooter();
|
|
103322
|
+
return;
|
|
103323
|
+
}
|
|
103324
|
+
if (!hasSuggestions) {
|
|
103325
|
+
return;
|
|
103326
|
+
}
|
|
103327
|
+
setFooterFocused(false);
|
|
103328
|
+
setHighlightedIndex(function (currentIndex) {
|
|
103329
|
+
return currentIndex > 0 ? currentIndex - 1 : visibleSuggestions.length - 1;
|
|
103330
|
+
});
|
|
103331
|
+
}
|
|
103332
|
+
function onInputKeyDown(event) {
|
|
103333
|
+
handleSearchInputKeyDown({
|
|
103334
|
+
clearSearch: clearSearch,
|
|
103335
|
+
event: event,
|
|
103336
|
+
handleArrowDownKey: handleArrowDownKey,
|
|
103337
|
+
handleArrowUpKey: handleArrowUpKey,
|
|
103338
|
+
handleTabKey: handleTabKey
|
|
103339
|
+
});
|
|
103340
|
+
}
|
|
103341
|
+
function onSeeMoreResults() {
|
|
103342
|
+
var trimmedQuery = query.trim();
|
|
103343
|
+
if (!trimmedQuery) return;
|
|
103344
|
+
clearHighlightState();
|
|
103345
|
+
var payload = getSeeMoreResultsPayload(trimmedQuery, totalResultsCount, visibleSuggestions);
|
|
103346
|
+
if (typeof headerSearchService.viewMoreResults === "function") {
|
|
103347
|
+
headerSearchService.viewMoreResults(payload);
|
|
103348
|
+
return;
|
|
103349
|
+
}
|
|
103350
|
+
headerSearchService.submitProductSearch(trimmedQuery);
|
|
103351
|
+
}
|
|
103352
|
+
function clearSearch() {
|
|
103353
|
+
var _inputRef$current2;
|
|
103354
|
+
clearHighlightState();
|
|
103355
|
+
setSelectedOptionId(null);
|
|
103356
|
+
clearQuery();
|
|
103357
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
|
|
103358
|
+
}
|
|
103359
|
+
function onInputChange(event) {
|
|
103360
|
+
var nextValue = event.target.value;
|
|
103361
|
+
setSelectedOptionId(null);
|
|
103362
|
+
clearHighlightState();
|
|
103363
|
+
updateQuery(nextValue);
|
|
103364
|
+
}
|
|
103365
|
+
function renderSuggestionRow(suggestionOption, suggestionIndex) {
|
|
103366
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteSuggestionRow, {
|
|
103367
|
+
inputRef: inputRef,
|
|
103368
|
+
isHighlighted: suggestionIndex === highlightedIndex,
|
|
103369
|
+
isSelected: suggestionOption.id === selectedOptionId,
|
|
103370
|
+
onHighlightSuggestion: function onHighlightSuggestion(nextIndex) {
|
|
103371
|
+
setFooterFocused(false);
|
|
103372
|
+
setHighlightedIndex(nextIndex);
|
|
103373
|
+
},
|
|
103374
|
+
onRunSuggestionAction: runSuggestionAction,
|
|
103375
|
+
onSelectSuggestion: selectOption,
|
|
103376
|
+
registerSuggestionNode: function registerSuggestionNode(node) {
|
|
103377
|
+
if (node) {
|
|
103378
|
+
suggestionRowRefs.current[suggestionOption.id] = node;
|
|
103379
|
+
} else {
|
|
103380
|
+
delete suggestionRowRefs.current[suggestionOption.id];
|
|
103381
|
+
}
|
|
103382
|
+
},
|
|
103383
|
+
suggestionIndex: suggestionIndex,
|
|
103384
|
+
suggestionOption: suggestionOption,
|
|
103385
|
+
suggestionOptionId: "".concat(listboxId, "-opt-").concat(suggestionOption.id)
|
|
103386
|
+
}, suggestionOption.id);
|
|
103387
|
+
}
|
|
103388
|
+
var activeDescendantId = getActiveDescendantId({
|
|
103389
|
+
highlightedIndex: highlightedIndex,
|
|
103390
|
+
listboxId: listboxId,
|
|
103391
|
+
visibleSuggestions: visibleSuggestions
|
|
103392
|
+
});
|
|
103393
|
+
var statusMessage = getStatusMessage({
|
|
103394
|
+
loading: loading,
|
|
103395
|
+
emptyFetched: emptyFetched,
|
|
103396
|
+
hasQuery: hasQuery,
|
|
103397
|
+
noSuggestionsText: noSuggestionsText,
|
|
103398
|
+
suggestions: visibleSuggestions
|
|
103399
|
+
});
|
|
103400
|
+
function resetFooterFocus() {
|
|
103401
|
+
setFooterFocused(false);
|
|
103402
|
+
setHighlightedIndex(-1);
|
|
103403
|
+
}
|
|
103404
|
+
function restoreLastSuggestion() {
|
|
103405
|
+
if (visibleSuggestions.length > 0) {
|
|
103406
|
+
setHighlightedIndex(visibleSuggestions.length - 1);
|
|
103407
|
+
}
|
|
103408
|
+
}
|
|
103409
|
+
function handleFooterFocus() {
|
|
103410
|
+
setHighlightedIndex(-1);
|
|
103411
|
+
setFooterFocused(true);
|
|
103412
|
+
}
|
|
103413
|
+
function handleFooterBlur() {
|
|
103414
|
+
setFooterFocused(false);
|
|
103415
|
+
}
|
|
103416
|
+
var searchField = /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteSearchField, {
|
|
103417
|
+
activeDescendantId: activeDescendantId,
|
|
103418
|
+
clearSearch: clearSearch,
|
|
103419
|
+
copy: copy,
|
|
103420
|
+
inputRef: inputRef,
|
|
103421
|
+
listboxId: listboxId,
|
|
103422
|
+
onChange: onInputChange,
|
|
103423
|
+
onInputKeyDown: onInputKeyDown,
|
|
103424
|
+
onSubmit: onSubmit,
|
|
103425
|
+
query: query,
|
|
103426
|
+
showPanel: showPanel,
|
|
103427
|
+
statusId: statusId,
|
|
103428
|
+
parent$: parent$
|
|
103429
|
+
});
|
|
103430
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(AutoCompleteRoot, {
|
|
103431
|
+
ref: rootRef,
|
|
103432
|
+
children: [searchFieldEndSlot ? /*#__PURE__*/(0,jsx_runtime_.jsxs)(SearchFieldToolbar, {
|
|
103433
|
+
$modalLayout: modalSearchLayout,
|
|
103434
|
+
"data-testid": "autocomplete-search-toolbar",
|
|
103435
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(SearchFieldGrow, {
|
|
103436
|
+
children: searchField
|
|
103437
|
+
}), searchFieldEndSlot]
|
|
103438
|
+
}) : searchField, /*#__PURE__*/(0,jsx_runtime_.jsx)(SearchSuggestionsStatus, {
|
|
103439
|
+
id: statusId,
|
|
103440
|
+
"aria-live": "polite",
|
|
103441
|
+
children: statusMessage
|
|
103442
|
+
}), showPanel && /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteSuggestionsPanel, {
|
|
103443
|
+
clearAllLabel: clearAllLabel,
|
|
103444
|
+
didYouMeanText: didYouMeanText,
|
|
103445
|
+
emptyFetched: emptyFetched,
|
|
103446
|
+
footerActionRef: footerActionRef,
|
|
103447
|
+
footerFocused: footerFocused,
|
|
103448
|
+
hasDidYouMean: hasDidYouMean,
|
|
103449
|
+
hasMoreResults: hasMoreResults,
|
|
103450
|
+
inputRef: inputRef,
|
|
103451
|
+
listboxId: listboxId,
|
|
103452
|
+
listboxLabel: listboxLabel,
|
|
103453
|
+
loading: loading,
|
|
103454
|
+
noSuggestionsText: noSuggestionsText,
|
|
103455
|
+
onBlurFooter: handleFooterBlur,
|
|
103456
|
+
onClearRecentSearches: handleClearRecentSearches,
|
|
103457
|
+
onFocusFooter: handleFooterFocus,
|
|
103458
|
+
onRecentSearchSelect: handleRecentSearchSelect,
|
|
103459
|
+
onSeeMoreResults: onSeeMoreResults,
|
|
103460
|
+
recentSearches: recentSearches,
|
|
103461
|
+
recentSearchesHeading: recentSearchesHeading,
|
|
103462
|
+
parent$: parent$,
|
|
103463
|
+
renderSuggestionRow: renderSuggestionRow,
|
|
103464
|
+
resetFooterFocus: resetFooterFocus,
|
|
103465
|
+
restoreLastSuggestion: restoreLastSuggestion,
|
|
103466
|
+
seeMoreResultsText: seeMoreResultsText,
|
|
103467
|
+
visibleSuggestions: visibleSuggestions
|
|
103468
|
+
})]
|
|
103469
|
+
});
|
|
103470
|
+
}
|
|
103471
|
+
AutoComplete.propTypes = {
|
|
103472
|
+
headerSearchService: autoCompleteHeaderSearchServiceShape.isRequired,
|
|
103473
|
+
copy: autoCompleteCopyShape.isRequired,
|
|
103474
|
+
autoCompleteEnabled: (external_prop_types_default()).bool,
|
|
103475
|
+
recentSearches: external_prop_types_default().arrayOf((external_prop_types_default()).string),
|
|
103476
|
+
recentSearchesHeading: (external_prop_types_default()).string,
|
|
103477
|
+
clearAllLabel: (external_prop_types_default()).string,
|
|
103478
|
+
onRecentSearchesChange: (external_prop_types_default()).func,
|
|
103479
|
+
parent$: (external_prop_types_default()).object,
|
|
103480
|
+
searchFieldEndSlot: (external_prop_types_default()).node,
|
|
103481
|
+
modalSearchLayout: (external_prop_types_default()).bool
|
|
103482
|
+
};
|
|
103483
|
+
// EXTERNAL MODULE: ./node_modules/@mui/material/Button/Button.js
|
|
103484
|
+
var Button = __webpack_require__(1629);
|
|
103485
|
+
;// ./src/components/button/CancelButton.styled.jsx
|
|
103486
|
+
|
|
103487
|
+
|
|
103488
|
+
var CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX = 1025;
|
|
103489
|
+
var CancelButtonRoot = /*#__PURE__*/createStyled(Button/* default */.A, true ? {
|
|
103490
|
+
target: "e1rel7ar2"
|
|
103491
|
+
} : 0)("--close-btn-font-family:Lora,sans-serif;--close-btn-desktop-text:#252525;--close-btn-hover-bg:#ebebeb;--close-btn-active-bg:#dcdcdc;min-width:48px;min-height:20px;padding:0;border:0;border-radius:0;text-transform:none;display:inline-flex;align-items:center;justify-content:center;gap:8px;background:transparent;color:var(--close-btn-desktop-text);font-family:var(--close-btn-font-family);font-size:14px;font-weight:600;line-height:20px;letter-spacing:0;transition:background-color 300ms ease-out;&:hover{background:transparent;}&:focus-visible{outline:1px solid #007bff;outline-offset:1px;}@media (min-width: ", CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX, "px){min-width:115px;min-height:44px;padding:11px 17px;border-radius:22px;font-size:16px;font-weight:500;line-height:22px;&:hover{background:var(--close-btn-hover-bg);}&:active{background:var(--close-btn-active-bg);}}" + ( true ? "" : 0));
|
|
103492
|
+
var CancelButtonIconWrap = /*#__PURE__*/createStyled("span", true ? {
|
|
103493
|
+
target: "e1rel7ar1"
|
|
103494
|
+
} : 0)("width:20px;height:20px;display:none;align-items:center;justify-content:center;line-height:0;svg{width:20px;height:20px;display:block;}@media (min-width: ", CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX, "px){display:inline-flex;}" + ( true ? "" : 0));
|
|
103495
|
+
var CancelButtonText = /*#__PURE__*/createStyled("span", true ? {
|
|
103496
|
+
target: "e1rel7ar0"
|
|
103497
|
+
} : 0)("display:inline-block;min-width:48px;line-height:inherit;text-decoration:none;text-underline-offset:2px;text-decoration-thickness:1px;@media (min-width: ", CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX, "px){min-width:53px;}", CancelButtonRoot, ":hover &{@media (min-width: ", CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX, "px){text-decoration:underline;}}", CancelButtonRoot, ":active &{@media (min-width: ", CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX, "px){text-decoration:none;}}" + ( true ? "" : 0));
|
|
103498
|
+
;// ./src/components/button/CancelButton.jsx
|
|
103499
|
+
function CancelButton_typeof(o) { "@babel/helpers - typeof"; return CancelButton_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, CancelButton_typeof(o); }
|
|
103500
|
+
var CancelButton_excluded = ["label", "onClick", "ariaLabel", "className", "iconName", "iconColor", "showIcon", "parent$"];
|
|
103501
|
+
function CancelButton_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
103502
|
+
function CancelButton_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? CancelButton_ownKeys(Object(t), !0).forEach(function (r) { CancelButton_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : CancelButton_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
103503
|
+
function CancelButton_defineProperty(e, r, t) { return (r = CancelButton_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
103504
|
+
function CancelButton_toPropertyKey(t) { var i = CancelButton_toPrimitive(t, "string"); return "symbol" == CancelButton_typeof(i) ? i : i + ""; }
|
|
103505
|
+
function CancelButton_toPrimitive(t, r) { if ("object" != CancelButton_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != CancelButton_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
103506
|
+
function CancelButton_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = CancelButton_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
103507
|
+
function CancelButton_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
103508
|
+
|
|
103509
|
+
|
|
103510
|
+
|
|
103511
|
+
|
|
103512
|
+
|
|
103513
|
+
function CancelButton(_ref) {
|
|
103514
|
+
var _restProps$dataTesti;
|
|
103515
|
+
var _ref$label = _ref.label,
|
|
103516
|
+
label = _ref$label === void 0 ? "Cancel" : _ref$label,
|
|
103517
|
+
_ref$onClick = _ref.onClick,
|
|
103518
|
+
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
103519
|
+
ariaLabel = _ref.ariaLabel,
|
|
103520
|
+
className = _ref.className,
|
|
103521
|
+
_ref$iconName = _ref.iconName,
|
|
103522
|
+
iconName = _ref$iconName === void 0 ? "close" : _ref$iconName,
|
|
103523
|
+
_ref$iconColor = _ref.iconColor,
|
|
103524
|
+
iconColor = _ref$iconColor === void 0 ? "#252525" : _ref$iconColor,
|
|
103525
|
+
_ref$showIcon = _ref.showIcon,
|
|
103526
|
+
showIcon = _ref$showIcon === void 0 ? true : _ref$showIcon,
|
|
103527
|
+
_ref$parent$ = _ref.parent$,
|
|
103528
|
+
parent$ = _ref$parent$ === void 0 ? {} : _ref$parent$,
|
|
103529
|
+
restProps = CancelButton_objectWithoutProperties(_ref, CancelButton_excluded);
|
|
103530
|
+
var testId = (_restProps$dataTesti = restProps["data-testid"]) !== null && _restProps$dataTesti !== void 0 ? _restProps$dataTesti : "cancel-button";
|
|
103531
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(CancelButtonRoot, CancelButton_objectSpread(CancelButton_objectSpread({
|
|
103532
|
+
className: className,
|
|
103533
|
+
"aria-label": ariaLabel || label,
|
|
103534
|
+
"data-testid": testId,
|
|
103535
|
+
disableRipple: true,
|
|
103536
|
+
onClick: onClick,
|
|
103537
|
+
type: "button"
|
|
103538
|
+
}, restProps), {}, {
|
|
103539
|
+
children: [showIcon ? /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButtonIconWrap, {
|
|
103540
|
+
"aria-hidden": "true",
|
|
103541
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(dist.NsIcon, {
|
|
103542
|
+
name: iconName,
|
|
103543
|
+
size: "small",
|
|
103544
|
+
colorOverride: iconColor
|
|
103545
|
+
})
|
|
103546
|
+
}) : null, /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButtonText, CancelButton_objectSpread(CancelButton_objectSpread({}, parent$ !== null && parent$ !== void 0 ? parent$ : {}), {}, {
|
|
103547
|
+
children: label
|
|
103548
|
+
}))]
|
|
103549
|
+
}));
|
|
103550
|
+
}
|
|
103551
|
+
CancelButton.propTypes = {
|
|
103552
|
+
label: (external_prop_types_default()).string,
|
|
103553
|
+
onClick: (external_prop_types_default()).func,
|
|
103554
|
+
ariaLabel: (external_prop_types_default()).string,
|
|
103555
|
+
className: (external_prop_types_default()).string,
|
|
103556
|
+
iconName: (external_prop_types_default()).string,
|
|
103557
|
+
iconColor: (external_prop_types_default()).string,
|
|
103558
|
+
showIcon: (external_prop_types_default()).bool,
|
|
103559
|
+
parent$: (external_prop_types_default()).object
|
|
103560
|
+
};
|
|
103561
|
+
;// ./src/components/modal/SearchModal.styled.jsx
|
|
103562
|
+
|
|
103563
|
+
function SearchModal_styled_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
103564
|
+
var SearchModal_styled_colors = {
|
|
103565
|
+
surface: "#ffffff",
|
|
103566
|
+
border: "#d1d5db",
|
|
103567
|
+
text: "#111827",
|
|
103568
|
+
muted: "#6b7280"
|
|
103569
|
+
};
|
|
103570
|
+
var MobileSearchButton = /*#__PURE__*/createStyled("button", true ? {
|
|
103571
|
+
target: "etuykaq12"
|
|
103572
|
+
} : 0)( true ? {
|
|
103573
|
+
name: "1ff2nft",
|
|
103574
|
+
styles: "display:flex;align-items:center;justify-content:center;width:28px;height:28px;background:none;border:none;padding:0;cursor:pointer;color:inherit;svg{width:24px;height:24px;}@media (min-width: 1024px){display:none;}"
|
|
103575
|
+
} : 0);
|
|
103576
|
+
var DesktopSearchWrapper = /*#__PURE__*/createStyled("button", true ? {
|
|
103577
|
+
target: "etuykaq11"
|
|
103578
|
+
} : 0)("display:none;align-items:center;width:100%;border:1px solid ", SearchModal_styled_colors.border, ";border-radius:999px;background:", SearchModal_styled_colors.surface, ";min-height:46px;margin-left:auto;padding:0 5px 0 3px;box-sizing:border-box;overflow:hidden;&:focus{outline:none;}&:focus-visible{outline:2px solid currentColor;outline-offset:-2px;border-radius:4px;}@media (min-width: 1024px){display:flex;width:", function (_ref) {
|
|
103579
|
+
var $sizeVariant = _ref.$sizeVariant;
|
|
103580
|
+
return $sizeVariant === "full" ? "100%" : "min(100%, 320px)";
|
|
103581
|
+
}, ";cursor:pointer;transition:background-color 0.15s ease,border-color 0.15s ease,box-shadow 0.15s ease;min-height:32px;&:hover{background:#f3f4f6;}&:hover>[data-testid=\"search-trigger-input\"]{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px;}&:focus-visible{border-color:", SearchModal_styled_colors.muted, ";box-shadow:0 0 0 1px rgba(17, 24, 39, 0.08);}}" + ( true ? "" : 0));
|
|
103582
|
+
var DesktopTriggerInput = /*#__PURE__*/createStyled("span", true ? {
|
|
103583
|
+
target: "etuykaq10"
|
|
103584
|
+
} : 0)("flex:1;min-width:0;padding:8px 0;font-size:16px;line-height:22px;color:", SearchModal_styled_colors.muted, ";cursor:pointer;text-align:left;" + ( true ? "" : 0));
|
|
103585
|
+
var DesktopTriggerIconButton = /*#__PURE__*/createStyled("span", true ? {
|
|
103586
|
+
target: "etuykaq9"
|
|
103587
|
+
} : 0)( true ? {
|
|
103588
|
+
name: "1fbssp",
|
|
103589
|
+
styles: "flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:0 5px 0 16px;padding:0;color:#64686f;svg{width:22px;height:22px;}"
|
|
103590
|
+
} : 0);
|
|
103591
|
+
var ModalOverlay = /*#__PURE__*/createStyled("div", true ? {
|
|
103592
|
+
target: "etuykaq8"
|
|
103593
|
+
} : 0)( true ? {
|
|
103594
|
+
name: "15ant65",
|
|
103595
|
+
styles: "position:fixed;inset:0;z-index:1000;display:flex;flex-direction:column;align-items:stretch;overflow:hidden"
|
|
103596
|
+
} : 0);
|
|
103597
|
+
var ModalPanel = /*#__PURE__*/createStyled("dialog", true ? {
|
|
103598
|
+
target: "etuykaq7"
|
|
103599
|
+
} : 0)("box-sizing:border-box;background:", SearchModal_styled_colors.surface, ";width:100%;flex:1;min-height:100%;padding:12px 16px;display:flex;flex-direction:column;gap:12px;box-shadow:0 4px 24px rgba(0, 0, 0, 0.08);border:none;margin:0;max-width:none;max-height:none;@media (max-width: 767px){padding:12px 0;}@media (min-width: 768px) and (max-width: 1023px){padding:12px 0 35px;}@media (min-width: 1024px){flex:0 0 auto;min-height:unset;padding:12px clamp(12px, 4vw, 32px) 35px;}" + ( true ? "" : 0));
|
|
103600
|
+
var ModalTopBar = /*#__PURE__*/createStyled("div", true ? {
|
|
103601
|
+
target: "etuykaq6"
|
|
103602
|
+
} : 0)( true ? {
|
|
103603
|
+
name: "19ii5hn",
|
|
103604
|
+
styles: "display:none;align-items:center;justify-content:space-between;width:100%;@media (min-width: 1024px){display:flex;}"
|
|
103605
|
+
} : 0);
|
|
103606
|
+
var SearchModal_styled_LogoSlot = /*#__PURE__*/createStyled("div", true ? {
|
|
103607
|
+
target: "etuykaq5"
|
|
103608
|
+
} : 0)( true ? {
|
|
103609
|
+
name: "ou8xsw",
|
|
103610
|
+
styles: "flex:0 0 auto"
|
|
103611
|
+
} : 0);
|
|
103612
|
+
var SearchRow = /*#__PURE__*/createStyled("div", true ? {
|
|
103613
|
+
target: "etuykaq4"
|
|
103614
|
+
} : 0)( true ? {
|
|
103615
|
+
name: "vg66lk",
|
|
103616
|
+
styles: "display:flex;align-items:flex-start;gap:12px;width:100%;@media (max-width: 1023px){align-items:center;}"
|
|
103617
|
+
} : 0);
|
|
103618
|
+
var MobileCancelSlot = /*#__PURE__*/createStyled("div", true ? {
|
|
103619
|
+
target: "etuykaq3"
|
|
103620
|
+
} : 0)( true ? {
|
|
103621
|
+
name: "kob85u",
|
|
103622
|
+
styles: "flex-shrink:0;display:flex;align-items:center;@media (min-width: 1024px){display:none;}"
|
|
103623
|
+
} : 0);
|
|
103624
|
+
|
|
103625
|
+
/** Wraps the fallback search form so Cancel stays on the same row as the input (mobile). */
|
|
103626
|
+
var SearchFormGrow = /*#__PURE__*/createStyled("div", true ? {
|
|
103627
|
+
target: "etuykaq2"
|
|
103628
|
+
} : 0)( true ? {
|
|
103629
|
+
name: "fxp7t8",
|
|
103630
|
+
styles: "flex:1;min-width:0"
|
|
103631
|
+
} : 0);
|
|
103632
|
+
var AutoCompleteWrapper = /*#__PURE__*/createStyled("div", true ? {
|
|
103633
|
+
target: "etuykaq1"
|
|
103634
|
+
} : 0)( true ? {
|
|
103635
|
+
name: "fgvye",
|
|
103636
|
+
styles: "width:100%;min-width:0;@media (min-width: 1024px){max-width:860px;margin:0 auto;}ul li span{white-space:normal;word-break:break-word;overflow-wrap:anywhere;min-width:0;}form:hover input::placeholder{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px;}form:focus-within input{text-decoration:none;}"
|
|
103637
|
+
} : 0);
|
|
103638
|
+
var SearchForm = /*#__PURE__*/createStyled("form", true ? {
|
|
103639
|
+
target: "etuykaq0"
|
|
103640
|
+
} : 0)( true ? {
|
|
103641
|
+
name: "1lnhxsx",
|
|
103642
|
+
styles: "box-sizing:border-box;width:100%;min-width:0;@media (min-width: 1024px){max-width:860px;margin:0 auto;}& div:focus-within [data-placeholder=\"true\"],& div:focus-within input{text-decoration:none;}& div:hover [data-placeholder=\"true\"],& div:hover input{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px;}"
|
|
103643
|
+
} : 0);
|
|
103644
|
+
;// ./src/components/modal/SearchModal.constants.js
|
|
103645
|
+
var SEARCH_PLACEHOLDER = "Search by product name, ingredient, benefits, or SKU";
|
|
103646
|
+
var TRIGGER_PLACEHOLDER = "Product Search";
|
|
103647
|
+
var MODAL_TITLE = "Product Search";
|
|
103648
|
+
|
|
103649
|
+
;// ./src/components/modal/SearchModal.jsx
|
|
103650
|
+
function SearchModal_typeof(o) { "@babel/helpers - typeof"; return SearchModal_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, SearchModal_typeof(o); }
|
|
103651
|
+
function SearchModal_slicedToArray(r, e) { return SearchModal_arrayWithHoles(r) || SearchModal_iterableToArrayLimit(r, e) || SearchModal_unsupportedIterableToArray(r, e) || SearchModal_nonIterableRest(); }
|
|
103652
|
+
function SearchModal_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
103653
|
+
function SearchModal_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return SearchModal_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? SearchModal_arrayLikeToArray(r, a) : void 0; } }
|
|
103654
|
+
function SearchModal_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
103655
|
+
function SearchModal_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
103656
|
+
function SearchModal_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
103657
|
+
function SearchModal_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
103658
|
+
function SearchModal_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? SearchModal_ownKeys(Object(t), !0).forEach(function (r) { SearchModal_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : SearchModal_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
103659
|
+
function SearchModal_defineProperty(e, r, t) { return (r = SearchModal_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
103660
|
+
function SearchModal_toPropertyKey(t) { var i = SearchModal_toPrimitive(t, "string"); return "symbol" == SearchModal_typeof(i) ? i : i + ""; }
|
|
103661
|
+
function SearchModal_toPrimitive(t, r) { if ("object" != SearchModal_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != SearchModal_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
103662
|
+
|
|
103663
|
+
|
|
103664
|
+
|
|
103665
|
+
|
|
103666
|
+
|
|
103667
|
+
|
|
103668
|
+
|
|
103669
|
+
|
|
103670
|
+
|
|
103671
|
+
|
|
103672
|
+
|
|
103673
|
+
|
|
103674
|
+
|
|
103675
|
+
function getFocusableElementsInPanel(panel) {
|
|
103676
|
+
if (!panel) return [];
|
|
103677
|
+
return Array.from(panel.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(function (el) {
|
|
103678
|
+
return !el.disabled;
|
|
103679
|
+
});
|
|
103680
|
+
}
|
|
103681
|
+
function handleTabKeyForModal(event, panel) {
|
|
103682
|
+
var focusable = getFocusableElementsInPanel(panel);
|
|
103683
|
+
if (focusable.length === 0) return;
|
|
103684
|
+
var first = focusable[0];
|
|
103685
|
+
var last = focusable[focusable.length - 1];
|
|
103686
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
103687
|
+
event.preventDefault();
|
|
103688
|
+
last.focus();
|
|
103689
|
+
return;
|
|
103690
|
+
}
|
|
103691
|
+
if (!event.shiftKey && document.activeElement === last) {
|
|
103692
|
+
event.preventDefault();
|
|
103693
|
+
first.focus();
|
|
103694
|
+
}
|
|
103695
|
+
}
|
|
103696
|
+
function MobileCancelControl(_ref) {
|
|
103697
|
+
var _activeEditableTags$c;
|
|
103698
|
+
var cancelLabel = _ref.cancelLabel,
|
|
103699
|
+
closeModal = _ref.closeModal,
|
|
103700
|
+
cancelShowIcon = _ref.cancelShowIcon,
|
|
103701
|
+
activeEditableTags = _ref.activeEditableTags,
|
|
103702
|
+
isClosingRef = _ref.isClosingRef;
|
|
103703
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileCancelSlot, {
|
|
103704
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("span", SearchModal_objectSpread(SearchModal_objectSpread({
|
|
103705
|
+
onPointerDown: function onPointerDown() {
|
|
103706
|
+
isClosingRef.current = true;
|
|
103707
|
+
}
|
|
103708
|
+
}, (_activeEditableTags$c = activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.cancelLabel) !== null && _activeEditableTags$c !== void 0 ? _activeEditableTags$c : {}), {}, {
|
|
103709
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButton, {
|
|
103710
|
+
label: cancelLabel,
|
|
103711
|
+
onClick: closeModal,
|
|
103712
|
+
showIcon: cancelShowIcon,
|
|
103713
|
+
"data-testid": "search-modal-cancel-mobile",
|
|
103714
|
+
parent$: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.cancelLabel
|
|
103715
|
+
})
|
|
103716
|
+
}))
|
|
103717
|
+
});
|
|
103718
|
+
}
|
|
103719
|
+
function renderMobileTrigger(_ref2) {
|
|
103720
|
+
var showMobileTrigger = _ref2.showMobileTrigger,
|
|
103721
|
+
triggerPlaceholder = _ref2.triggerPlaceholder,
|
|
103722
|
+
isOpen = _ref2.isOpen,
|
|
103723
|
+
openModal = _ref2.openModal;
|
|
103724
|
+
if (!showMobileTrigger) return null;
|
|
103725
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileSearchButton, {
|
|
103726
|
+
type: "button",
|
|
103727
|
+
"aria-label": triggerPlaceholder,
|
|
103728
|
+
"aria-haspopup": "dialog",
|
|
103729
|
+
"aria-expanded": isOpen,
|
|
103730
|
+
onClick: openModal,
|
|
103731
|
+
"data-testid": "search-modal-trigger-mobile",
|
|
103732
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Search/* default */.A, {
|
|
103733
|
+
fontSize: "inherit",
|
|
103734
|
+
"aria-hidden": true,
|
|
103735
|
+
"data-testid": "search"
|
|
103736
|
+
})
|
|
103737
|
+
});
|
|
103738
|
+
}
|
|
103739
|
+
function renderDesktopTrigger(_ref3) {
|
|
103740
|
+
var _activeEditableTags$t, _activeEditableTags$t2;
|
|
103741
|
+
var showDesktopTrigger = _ref3.showDesktopTrigger,
|
|
103742
|
+
triggerRef = _ref3.triggerRef,
|
|
103743
|
+
triggerPlaceholder = _ref3.triggerPlaceholder,
|
|
103744
|
+
isOpen = _ref3.isOpen,
|
|
103745
|
+
inputSize = _ref3.inputSize,
|
|
103746
|
+
inputSizeVariant = _ref3.inputSizeVariant,
|
|
103747
|
+
openModal = _ref3.openModal,
|
|
103748
|
+
activeEditableTags = _ref3.activeEditableTags;
|
|
103749
|
+
if (!showDesktopTrigger) return null;
|
|
103750
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(DesktopSearchWrapper, {
|
|
103751
|
+
type: "button",
|
|
103752
|
+
"data-testid": "search-modal-trigger",
|
|
103753
|
+
ref: triggerRef,
|
|
103754
|
+
"aria-label": triggerPlaceholder || TRIGGER_PLACEHOLDER,
|
|
103755
|
+
"aria-haspopup": "dialog",
|
|
103756
|
+
"aria-expanded": isOpen,
|
|
103757
|
+
"data-size": inputSize,
|
|
103758
|
+
"data-size-variant": inputSizeVariant,
|
|
103759
|
+
$sizeVariant: inputSizeVariant,
|
|
103760
|
+
onClick: openModal,
|
|
103761
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(DesktopTriggerIconButton, SearchModal_objectSpread(SearchModal_objectSpread({
|
|
103762
|
+
"data-testid": "search-trigger-button"
|
|
103763
|
+
}, (_activeEditableTags$t = activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.triggerIcon) !== null && _activeEditableTags$t !== void 0 ? _activeEditableTags$t : {}), {}, {
|
|
103764
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Search/* default */.A, {
|
|
103765
|
+
fontSize: "inherit",
|
|
103766
|
+
"aria-hidden": true,
|
|
103767
|
+
"data-testid": "search"
|
|
103768
|
+
})
|
|
103769
|
+
})), /*#__PURE__*/(0,jsx_runtime_.jsx)(DesktopTriggerInput, SearchModal_objectSpread(SearchModal_objectSpread({
|
|
103770
|
+
"data-testid": "search-trigger-input"
|
|
103771
|
+
}, (_activeEditableTags$t2 = activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.triggerPlaceholder) !== null && _activeEditableTags$t2 !== void 0 ? _activeEditableTags$t2 : {}), {}, {
|
|
103772
|
+
children: triggerPlaceholder || TRIGGER_PLACEHOLDER
|
|
103773
|
+
}))]
|
|
103774
|
+
});
|
|
103775
|
+
}
|
|
103776
|
+
function SearchModal(_ref4) {
|
|
103777
|
+
var _activeEditableTags$s, _activeEditableTags$c2;
|
|
103778
|
+
var _ref4$triggerPlacehol = _ref4.triggerPlaceholder,
|
|
103779
|
+
triggerPlaceholder = _ref4$triggerPlacehol === void 0 ? TRIGGER_PLACEHOLDER : _ref4$triggerPlacehol,
|
|
103780
|
+
_ref4$searchPlacehold = _ref4.searchPlaceholder,
|
|
103781
|
+
searchPlaceholder = _ref4$searchPlacehold === void 0 ? SEARCH_PLACEHOLDER : _ref4$searchPlacehold,
|
|
103782
|
+
_ref4$onSearch = _ref4.onSearch,
|
|
103783
|
+
onSearch = _ref4$onSearch === void 0 ? function () {} : _ref4$onSearch,
|
|
103784
|
+
_ref4$modalTitle = _ref4.modalTitle,
|
|
103785
|
+
modalTitle = _ref4$modalTitle === void 0 ? MODAL_TITLE : _ref4$modalTitle,
|
|
103786
|
+
brandLogo = _ref4.brandLogo,
|
|
103787
|
+
brandLogoAlt = _ref4.brandLogoAlt,
|
|
103788
|
+
brandHref = _ref4.brandHref,
|
|
103789
|
+
_ref4$brandSize = _ref4.brandSize,
|
|
103790
|
+
brandSize = _ref4$brandSize === void 0 ? "Medium" : _ref4$brandSize,
|
|
103791
|
+
_ref4$showBrandLogo = _ref4.showBrandLogo,
|
|
103792
|
+
showBrandLogo = _ref4$showBrandLogo === void 0 ? true : _ref4$showBrandLogo,
|
|
103793
|
+
_ref4$cancelLabel = _ref4.cancelLabel,
|
|
103794
|
+
cancelLabel = _ref4$cancelLabel === void 0 ? "Cancel" : _ref4$cancelLabel,
|
|
103795
|
+
_ref4$cancelShowIcon = _ref4.cancelShowIcon,
|
|
103796
|
+
cancelShowIcon = _ref4$cancelShowIcon === void 0 ? true : _ref4$cancelShowIcon,
|
|
103797
|
+
_ref4$headerSearchSer = _ref4.headerSearchService,
|
|
103798
|
+
headerSearchService = _ref4$headerSearchSer === void 0 ? undefined : _ref4$headerSearchSer,
|
|
103799
|
+
_ref4$copy = _ref4.copy,
|
|
103800
|
+
copy = _ref4$copy === void 0 ? undefined : _ref4$copy,
|
|
103801
|
+
_ref4$showRecentSearc = _ref4.showRecentSearches,
|
|
103802
|
+
showRecentSearches = _ref4$showRecentSearc === void 0 ? true : _ref4$showRecentSearc,
|
|
103803
|
+
_ref4$autoCompleteEna = _ref4.autoCompleteEnabled,
|
|
103804
|
+
autoCompleteEnabled = _ref4$autoCompleteEna === void 0 ? true : _ref4$autoCompleteEna,
|
|
103805
|
+
_ref4$recentSearchesH = _ref4.recentSearchesHeading,
|
|
103806
|
+
recentSearchesHeading = _ref4$recentSearchesH === void 0 ? "Recent searches" : _ref4$recentSearchesH,
|
|
103807
|
+
_ref4$clearAllLabel = _ref4.clearAllLabel,
|
|
103808
|
+
clearAllLabel = _ref4$clearAllLabel === void 0 ? "Clear all" : _ref4$clearAllLabel,
|
|
103809
|
+
_ref4$parent$ = _ref4.parent$,
|
|
103810
|
+
parent$ = _ref4$parent$ === void 0 ? undefined : _ref4$parent$,
|
|
103811
|
+
_ref4$inputSize = _ref4.inputSize,
|
|
103812
|
+
inputSize = _ref4$inputSize === void 0 ? DEFAULT_INPUT_SIZE : _ref4$inputSize,
|
|
103813
|
+
_ref4$inputSizeVarian = _ref4.inputSizeVariant,
|
|
103814
|
+
inputSizeVariant = _ref4$inputSizeVarian === void 0 ? DEFAULT_INPUT_SIZE_VARIANT : _ref4$inputSizeVarian,
|
|
103815
|
+
_ref4$showMobileTrigg = _ref4.showMobileTrigger,
|
|
103816
|
+
showMobileTrigger = _ref4$showMobileTrigg === void 0 ? true : _ref4$showMobileTrigg,
|
|
103817
|
+
_ref4$showDesktopTrig = _ref4.showDesktopTrigger,
|
|
103818
|
+
showDesktopTrigger = _ref4$showDesktopTrig === void 0 ? true : _ref4$showDesktopTrig;
|
|
103819
|
+
var editing = isEditingMode();
|
|
103820
|
+
var activeEditableTags = parent$;
|
|
103821
|
+
var _useState = (0,external_react_.useState)(false),
|
|
103822
|
+
_useState2 = SearchModal_slicedToArray(_useState, 2),
|
|
103823
|
+
isOpen = _useState2[0],
|
|
103824
|
+
setIsOpen = _useState2[1];
|
|
103825
|
+
var _useState3 = (0,external_react_.useState)(""),
|
|
103826
|
+
_useState4 = SearchModal_slicedToArray(_useState3, 2),
|
|
103827
|
+
query = _useState4[0],
|
|
103828
|
+
setQuery = _useState4[1];
|
|
103829
|
+
var _useState5 = (0,external_react_.useState)(false),
|
|
103830
|
+
_useState6 = SearchModal_slicedToArray(_useState5, 2),
|
|
103831
|
+
isAutoCompleteInputFocused = _useState6[0],
|
|
103832
|
+
setIsAutoCompleteInputFocused = _useState6[1];
|
|
103833
|
+
var _useState7 = (0,external_react_.useState)([]),
|
|
103834
|
+
_useState8 = SearchModal_slicedToArray(_useState7, 2),
|
|
103835
|
+
recentSearches = _useState8[0],
|
|
103836
|
+
setRecentSearches = _useState8[1];
|
|
103837
|
+
var triggerRef = (0,external_react_.useRef)(null);
|
|
103838
|
+
var isClosingRef = (0,external_react_.useRef)(false);
|
|
103839
|
+
var hasAutoComplete = Boolean(headerSearchService && copy);
|
|
103840
|
+
var openModal = (0,external_react_.useCallback)(function () {
|
|
103841
|
+
setIsOpen(true);
|
|
103842
|
+
}, []);
|
|
103843
|
+
(0,external_react_.useEffect)(function () {
|
|
103844
|
+
if (!isOpen) return;
|
|
103845
|
+
requestAnimationFrame(function () {
|
|
103846
|
+
var input = document.querySelector('[data-testid="autocomplete-input"], [data-testid="search-modal-input"]');
|
|
103847
|
+
input === null || input === void 0 || input.focus();
|
|
103848
|
+
});
|
|
103849
|
+
}, [isOpen]);
|
|
103850
|
+
(0,external_react_.useEffect)(function () {
|
|
103851
|
+
var _headerSearchService$, _headerSearchService$2;
|
|
103852
|
+
if (!isOpen || !showRecentSearches) {
|
|
103853
|
+
return;
|
|
103854
|
+
}
|
|
103855
|
+
setRecentSearches((_headerSearchService$ = headerSearchService === null || headerSearchService === void 0 || (_headerSearchService$2 = headerSearchService.getRecentSearches) === null || _headerSearchService$2 === void 0 ? void 0 : _headerSearchService$2.call(headerSearchService)) !== null && _headerSearchService$ !== void 0 ? _headerSearchService$ : []);
|
|
103856
|
+
}, [headerSearchService, isOpen, showRecentSearches]);
|
|
103857
|
+
var closeModal = (0,external_react_.useCallback)(function () {
|
|
103858
|
+
isClosingRef.current = true;
|
|
103859
|
+
setIsOpen(false);
|
|
103860
|
+
setQuery("");
|
|
103861
|
+
setIsAutoCompleteInputFocused(false);
|
|
103862
|
+
requestAnimationFrame(function () {
|
|
103863
|
+
var _triggerRef$current;
|
|
103864
|
+
(_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 || _triggerRef$current.focus();
|
|
103865
|
+
isClosingRef.current = false;
|
|
103866
|
+
});
|
|
103867
|
+
}, []);
|
|
103868
|
+
(0,external_react_.useEffect)(function () {
|
|
103869
|
+
if (!isOpen) return undefined;
|
|
103870
|
+
function handleKeyDown(e) {
|
|
103871
|
+
if (e.key === "Escape") {
|
|
103872
|
+
closeModal();
|
|
103873
|
+
return;
|
|
103874
|
+
}
|
|
103875
|
+
if (e.key !== "Tab") return;
|
|
103876
|
+
handleTabKeyForModal(e, document.getElementById("search-modal-panel"));
|
|
103877
|
+
}
|
|
103878
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
103879
|
+
document.body.style.overflow = "hidden";
|
|
103880
|
+
return function () {
|
|
103881
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
103882
|
+
document.body.style.overflow = "";
|
|
103883
|
+
};
|
|
103884
|
+
}, [isOpen, closeModal]);
|
|
103885
|
+
function handleOverlayClick(e) {
|
|
103886
|
+
if (e.target === e.currentTarget) {
|
|
103887
|
+
closeModal();
|
|
103888
|
+
}
|
|
103889
|
+
}
|
|
103890
|
+
function handleSubmit(e) {
|
|
103891
|
+
e.preventDefault();
|
|
103892
|
+
if (query.trim()) {
|
|
103893
|
+
onSearch(query.trim());
|
|
103894
|
+
}
|
|
103895
|
+
}
|
|
103896
|
+
function isSearchInputActivationClick(clickTarget) {
|
|
103897
|
+
if (!(clickTarget instanceof Element)) {
|
|
103898
|
+
return false;
|
|
103899
|
+
}
|
|
103900
|
+
return clickTarget.closest('[data-testid="search-modal"]') !== null || clickTarget.closest('[data-testid^="search-modal-"]') !== null;
|
|
103901
|
+
}
|
|
103902
|
+
var mobileCancelControl = /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileCancelControl, {
|
|
103903
|
+
cancelLabel: cancelLabel,
|
|
103904
|
+
closeModal: closeModal,
|
|
103905
|
+
cancelShowIcon: cancelShowIcon,
|
|
103906
|
+
activeEditableTags: activeEditableTags,
|
|
103907
|
+
isClosingRef: isClosingRef
|
|
103908
|
+
});
|
|
103909
|
+
var searchBody = hasAutoComplete ? /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteWrapper, {
|
|
103910
|
+
onFocus: function onFocus() {
|
|
103911
|
+
return setIsAutoCompleteInputFocused(true);
|
|
103912
|
+
},
|
|
103913
|
+
onBlur: function onBlur(e) {
|
|
103914
|
+
if (!e.currentTarget.contains(e.relatedTarget) && !isClosingRef.current) {
|
|
103915
|
+
setIsAutoCompleteInputFocused(false);
|
|
103916
|
+
}
|
|
103917
|
+
},
|
|
103918
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoComplete, {
|
|
103919
|
+
headerSearchService: headerSearchService,
|
|
103920
|
+
autoCompleteEnabled: autoCompleteEnabled,
|
|
103921
|
+
modalSearchLayout: true,
|
|
103922
|
+
copy: SearchModal_objectSpread(SearchModal_objectSpread({}, copy), {}, {
|
|
103923
|
+
placeholder: isAutoCompleteInputFocused ? searchPlaceholder || SEARCH_PLACEHOLDER : triggerPlaceholder || TRIGGER_PLACEHOLDER
|
|
103924
|
+
}),
|
|
103925
|
+
recentSearches: showRecentSearches ? recentSearches : [],
|
|
103926
|
+
recentSearchesHeading: recentSearchesHeading,
|
|
103927
|
+
clearAllLabel: clearAllLabel,
|
|
103928
|
+
onRecentSearchesChange: setRecentSearches,
|
|
103929
|
+
parent$: activeEditableTags,
|
|
103930
|
+
searchFieldEndSlot: mobileCancelControl
|
|
103931
|
+
})
|
|
103932
|
+
}) : /*#__PURE__*/(0,jsx_runtime_.jsx)(SearchForm, SearchModal_objectSpread(SearchModal_objectSpread({
|
|
103933
|
+
onSubmit: handleSubmit,
|
|
103934
|
+
onClick: function onClick(e) {
|
|
103935
|
+
if (!isSearchInputActivationClick(e.target)) {
|
|
103936
|
+
return;
|
|
103937
|
+
}
|
|
103938
|
+
handleSubmit(e);
|
|
103939
|
+
},
|
|
103940
|
+
role: "search"
|
|
103941
|
+
}, (_activeEditableTags$s = activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.searchPlaceholder) !== null && _activeEditableTags$s !== void 0 ? _activeEditableTags$s : {}), {}, {
|
|
103942
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Input, {
|
|
103943
|
+
value: query,
|
|
103944
|
+
onChange: function onChange(val) {
|
|
103945
|
+
return setQuery(val);
|
|
103946
|
+
},
|
|
103947
|
+
placeholder_text: searchPlaceholder || SEARCH_PLACEHOLDER,
|
|
103948
|
+
aria_label: searchPlaceholder || SEARCH_PLACEHOLDER,
|
|
103949
|
+
"data-testid": "search-modal",
|
|
103950
|
+
size: inputSize,
|
|
103951
|
+
size_variant: inputSizeVariant
|
|
103952
|
+
})
|
|
103953
|
+
}));
|
|
103954
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
|
|
103955
|
+
children: [renderMobileTrigger({
|
|
103956
|
+
showMobileTrigger: showMobileTrigger,
|
|
103957
|
+
triggerPlaceholder: triggerPlaceholder,
|
|
103958
|
+
isOpen: isOpen,
|
|
103959
|
+
openModal: openModal
|
|
103960
|
+
}), renderDesktopTrigger({
|
|
103961
|
+
showDesktopTrigger: showDesktopTrigger,
|
|
103962
|
+
triggerRef: triggerRef,
|
|
103963
|
+
triggerPlaceholder: triggerPlaceholder,
|
|
103964
|
+
isOpen: isOpen,
|
|
103965
|
+
inputSize: inputSize,
|
|
103966
|
+
inputSizeVariant: inputSizeVariant,
|
|
103967
|
+
openModal: openModal,
|
|
103968
|
+
activeEditableTags: activeEditableTags
|
|
103969
|
+
}), isOpen && /*#__PURE__*/(0,jsx_runtime_.jsx)(ModalOverlay, {
|
|
103970
|
+
onPointerDown: function onPointerDown(e) {
|
|
103971
|
+
if (e.target === e.currentTarget) isClosingRef.current = true;
|
|
103972
|
+
},
|
|
103973
|
+
onClick: handleOverlayClick,
|
|
103974
|
+
"data-testid": "search-modal-overlay",
|
|
103975
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(ModalPanel, {
|
|
103976
|
+
id: "search-modal-panel",
|
|
103977
|
+
open: true,
|
|
103978
|
+
"aria-modal": "true",
|
|
103979
|
+
"aria-label": modalTitle || MODAL_TITLE,
|
|
103980
|
+
"data-testid": "search-modal-panel",
|
|
103981
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)(ModalTopBar, {
|
|
103982
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(SearchModal_styled_LogoSlot, {
|
|
103983
|
+
"data-testid": "search-modal-logo-slot",
|
|
103984
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Brand, {
|
|
103985
|
+
logo: brandLogo,
|
|
103986
|
+
logoAlt: brandLogoAlt,
|
|
103987
|
+
href: brandHref,
|
|
103988
|
+
size: brandSize,
|
|
103989
|
+
showLogo: showBrandLogo,
|
|
103990
|
+
$: {
|
|
103991
|
+
header_logo: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.logoAsset,
|
|
103992
|
+
logo_url: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.logoUrl,
|
|
103993
|
+
show_logo: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.showBrandLogo,
|
|
103994
|
+
logo_size: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.brandSize
|
|
103995
|
+
},
|
|
103996
|
+
isEditing: editing
|
|
103997
|
+
})
|
|
103998
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsx)("span", SearchModal_objectSpread(SearchModal_objectSpread({
|
|
103999
|
+
onPointerDown: function onPointerDown() {
|
|
104000
|
+
isClosingRef.current = true;
|
|
104001
|
+
}
|
|
104002
|
+
}, (_activeEditableTags$c2 = activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.cancelLabel) !== null && _activeEditableTags$c2 !== void 0 ? _activeEditableTags$c2 : {}), {}, {
|
|
104003
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButton, {
|
|
104004
|
+
label: cancelLabel,
|
|
104005
|
+
onClick: closeModal,
|
|
104006
|
+
showIcon: cancelShowIcon,
|
|
104007
|
+
"data-testid": "search-modal-cancel-desktop",
|
|
104008
|
+
parent$: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.cancelLabel
|
|
104009
|
+
})
|
|
104010
|
+
}))]
|
|
104011
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsxs)(SearchRow, {
|
|
104012
|
+
children: [searchBody, hasAutoComplete ? null : mobileCancelControl]
|
|
104013
|
+
})]
|
|
104014
|
+
})
|
|
104015
|
+
})]
|
|
104016
|
+
});
|
|
104017
|
+
}
|
|
104018
|
+
SearchModal.propTypes = {
|
|
104019
|
+
triggerPlaceholder: (external_prop_types_default()).string,
|
|
104020
|
+
searchPlaceholder: (external_prop_types_default()).string,
|
|
104021
|
+
onSearch: (external_prop_types_default()).func,
|
|
104022
|
+
modalTitle: (external_prop_types_default()).string,
|
|
104023
|
+
brandLogo: (external_prop_types_default()).string,
|
|
104024
|
+
brandLogoAlt: (external_prop_types_default()).string,
|
|
104025
|
+
brandHref: (external_prop_types_default()).string,
|
|
104026
|
+
brandSize: external_prop_types_default().oneOf(["Small", "Medium", "Large"]),
|
|
104027
|
+
showBrandLogo: (external_prop_types_default()).bool,
|
|
104028
|
+
cancelLabel: (external_prop_types_default()).string,
|
|
104029
|
+
cancelShowIcon: (external_prop_types_default()).bool,
|
|
104030
|
+
headerSearchService: autoCompleteHeaderSearchServiceShape,
|
|
104031
|
+
copy: autoCompleteCopyShape,
|
|
104032
|
+
showRecentSearches: (external_prop_types_default()).bool,
|
|
104033
|
+
autoCompleteEnabled: (external_prop_types_default()).bool,
|
|
104034
|
+
recentSearchesHeading: (external_prop_types_default()).string,
|
|
104035
|
+
clearAllLabel: (external_prop_types_default()).string,
|
|
104036
|
+
parent$: (external_prop_types_default()).object,
|
|
104037
|
+
inputSize: external_prop_types_default().oneOf([INPUT_SIZES.SM, INPUT_SIZES.MD, INPUT_SIZES.LG]),
|
|
104038
|
+
inputSizeVariant: external_prop_types_default().oneOf([INPUT_SIZE_VARIANTS.DEFAULT, INPUT_SIZE_VARIANTS.WIDE, INPUT_SIZE_VARIANTS.FULL]),
|
|
104039
|
+
showMobileTrigger: (external_prop_types_default()).bool,
|
|
104040
|
+
showDesktopTrigger: (external_prop_types_default()).bool
|
|
104041
|
+
};
|
|
104042
|
+
MobileCancelControl.propTypes = {
|
|
104043
|
+
cancelLabel: (external_prop_types_default()).string.isRequired,
|
|
104044
|
+
closeModal: (external_prop_types_default()).func.isRequired,
|
|
104045
|
+
cancelShowIcon: (external_prop_types_default()).bool.isRequired,
|
|
104046
|
+
activeEditableTags: (external_prop_types_default()).object,
|
|
104047
|
+
isClosingRef: external_prop_types_default().shape({
|
|
104048
|
+
current: (external_prop_types_default()).bool
|
|
104049
|
+
}).isRequired
|
|
104050
|
+
};
|
|
104051
|
+
;// ./src/utils/recentHeaderSearches.js
|
|
104052
|
+
function recentHeaderSearches_toConsumableArray(r) { return recentHeaderSearches_arrayWithoutHoles(r) || recentHeaderSearches_iterableToArray(r) || recentHeaderSearches_unsupportedIterableToArray(r) || recentHeaderSearches_nonIterableSpread(); }
|
|
104053
|
+
function recentHeaderSearches_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
104054
|
+
function recentHeaderSearches_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return recentHeaderSearches_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? recentHeaderSearches_arrayLikeToArray(r, a) : void 0; } }
|
|
104055
|
+
function recentHeaderSearches_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
104056
|
+
function recentHeaderSearches_arrayWithoutHoles(r) { if (Array.isArray(r)) return recentHeaderSearches_arrayLikeToArray(r); }
|
|
104057
|
+
function recentHeaderSearches_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
104058
|
+
var RECENT_SEARCHES_PREFIX = "nuskin:header:recentSearches";
|
|
104059
|
+
var DEFAULT_LIMIT = 10;
|
|
104060
|
+
function canUseStorage(storage) {
|
|
104061
|
+
return storage && typeof storage.getItem === "function";
|
|
104062
|
+
}
|
|
104063
|
+
function normalizeParts() {
|
|
104064
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
104065
|
+
country = _ref.country,
|
|
104066
|
+
language = _ref.language,
|
|
104067
|
+
locale = _ref.locale;
|
|
104068
|
+
var normalizedCountry = String(country !== null && country !== void 0 ? country : "").trim().toUpperCase();
|
|
104069
|
+
var normalizedLanguage = String(language !== null && language !== void 0 ? language : "").trim().toLowerCase();
|
|
104070
|
+
var normalizedLocale = String(locale !== null && locale !== void 0 ? locale : "").trim() || "UNKNOWN";
|
|
104071
|
+
return {
|
|
104072
|
+
country: normalizedCountry || "UNKNOWN",
|
|
104073
|
+
language: normalizedLanguage || "unknown",
|
|
104074
|
+
locale: normalizedLocale
|
|
104075
|
+
};
|
|
104076
|
+
}
|
|
104077
|
+
function getRecentHeaderSearchesStorageKey(localeParts) {
|
|
104078
|
+
var _normalizeParts = normalizeParts(localeParts),
|
|
104079
|
+
country = _normalizeParts.country,
|
|
104080
|
+
language = _normalizeParts.language,
|
|
104081
|
+
locale = _normalizeParts.locale;
|
|
104082
|
+
return "".concat(RECENT_SEARCHES_PREFIX, ":").concat(locale, ":").concat(country, ":").concat(language);
|
|
104083
|
+
}
|
|
104084
|
+
function getRecentHeaderSearches(localeParts, storage) {
|
|
104085
|
+
if (!canUseStorage(storage)) {
|
|
104086
|
+
return [];
|
|
104087
|
+
}
|
|
104088
|
+
try {
|
|
104089
|
+
var rawValue = storage.getItem(getRecentHeaderSearchesStorageKey(localeParts));
|
|
104090
|
+
if (!rawValue) {
|
|
104091
|
+
return [];
|
|
104092
|
+
}
|
|
104093
|
+
var parsedValue = JSON.parse(rawValue);
|
|
104094
|
+
if (!Array.isArray(parsedValue)) {
|
|
104095
|
+
return [];
|
|
104096
|
+
}
|
|
104097
|
+
return parsedValue.map(function (item) {
|
|
104098
|
+
return String(item !== null && item !== void 0 ? item : "").trim();
|
|
104099
|
+
}).filter(Boolean);
|
|
104100
|
+
} catch (_unused) {
|
|
104101
|
+
return [];
|
|
104102
|
+
}
|
|
104103
|
+
}
|
|
104104
|
+
function addRecentHeaderSearch(localeParts, query, storage) {
|
|
104105
|
+
var limit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_LIMIT;
|
|
104106
|
+
var normalizedQuery = String(query !== null && query !== void 0 ? query : "").trim();
|
|
104107
|
+
if (!normalizedQuery || !canUseStorage(storage)) {
|
|
104108
|
+
return [];
|
|
104109
|
+
}
|
|
104110
|
+
try {
|
|
104111
|
+
var existingValues = getRecentHeaderSearches(localeParts, storage).filter(function (item) {
|
|
104112
|
+
return item.toLowerCase() !== normalizedQuery.toLowerCase();
|
|
104113
|
+
});
|
|
104114
|
+
var nextValues = [normalizedQuery].concat(recentHeaderSearches_toConsumableArray(existingValues)).slice(0, limit);
|
|
104115
|
+
storage.setItem(getRecentHeaderSearchesStorageKey(localeParts), JSON.stringify(nextValues));
|
|
104116
|
+
return nextValues;
|
|
104117
|
+
} catch (_unused2) {
|
|
104118
|
+
return [];
|
|
104119
|
+
}
|
|
104120
|
+
}
|
|
104121
|
+
function clearRecentHeaderSearches(localeParts, storage) {
|
|
104122
|
+
if (!canUseStorage(storage)) {
|
|
104123
|
+
return;
|
|
104124
|
+
}
|
|
104125
|
+
try {
|
|
104126
|
+
storage.removeItem(getRecentHeaderSearchesStorageKey(localeParts));
|
|
104127
|
+
} catch (_unused3) {
|
|
104128
|
+
// intentionally quiet when storage is blocked/unavailable
|
|
104129
|
+
}
|
|
104130
|
+
}
|
|
104131
|
+
;// ./src/utils/locale.js
|
|
104132
|
+
/**
|
|
104133
|
+
* Extracts the locale code from the provided URL or the current URL.
|
|
104134
|
+
*
|
|
104135
|
+
* @param options - An object with the following properties:
|
|
104136
|
+
* @param options.url - The URL to extract the locale code from. If not provided, the current URL will be used.
|
|
104137
|
+
* @param options.defaultLocale - The default locale code to use if the locale cannot be extracted from the URL.
|
|
104138
|
+
* @returns The locale code in the format "language_COUNTRY".
|
|
104139
|
+
*/
|
|
104140
|
+
function getLocaleCodeFromUrl(options) {
|
|
104141
|
+
var _localeAsArr$;
|
|
104142
|
+
var _ref = options !== null && options !== void 0 ? options : {},
|
|
104143
|
+
_ref$url = _ref.url,
|
|
104144
|
+
url = _ref$url === void 0 ? "" : _ref$url,
|
|
104145
|
+
_ref$defaultLocale = _ref.defaultLocale,
|
|
104146
|
+
defaultLocale = _ref$defaultLocale === void 0 ? "" : _ref$defaultLocale;
|
|
104147
|
+
var localeAsArr = [];
|
|
104148
|
+
var tempUrl = url || typeof location != "undefined" && location.href;
|
|
104149
|
+
if (tempUrl) {
|
|
104150
|
+
var _tempUrl, _tempUrl2;
|
|
104151
|
+
/* adding dummy domain since express originalUrl will not have request domain */
|
|
104152
|
+
if (!((_tempUrl = tempUrl) !== null && _tempUrl !== void 0 && _tempUrl.includes("https://")) && !((_tempUrl2 = tempUrl) !== null && _tempUrl2 !== void 0 && _tempUrl2.includes("http://"))) {
|
|
104153
|
+
tempUrl = "https://domain.com".concat(tempUrl);
|
|
104154
|
+
}
|
|
104155
|
+
var updatedUrl = new URL(tempUrl);
|
|
104156
|
+
var pathParams = updatedUrl.pathname;
|
|
104157
|
+
if (pathParams) {
|
|
104158
|
+
var _pathParams$split;
|
|
104159
|
+
var pathList = pathParams === null || pathParams === void 0 || (_pathParams$split = pathParams.split("/")) === null || _pathParams$split === void 0 ? void 0 : _pathParams$split.filter(Boolean);
|
|
104160
|
+
if (pathList.length > 1) {
|
|
104161
|
+
localeAsArr = pathList;
|
|
104162
|
+
}
|
|
104163
|
+
}
|
|
104164
|
+
if (localeAsArr.length > 2) {
|
|
104165
|
+
localeAsArr = localeAsArr.slice(0, 2);
|
|
104166
|
+
}
|
|
104167
|
+
}
|
|
104168
|
+
localeAsArr = localeAsArr.reverse();
|
|
104169
|
+
if (localeAsArr.length === 0) {
|
|
104170
|
+
localeAsArr = defaultLocale.split("_");
|
|
104171
|
+
}
|
|
104172
|
+
return "".concat((_localeAsArr$ = localeAsArr[1]) === null || _localeAsArr$ === void 0 ? void 0 : _localeAsArr$.toUpperCase(), "-").concat(localeAsArr[0]);
|
|
104173
|
+
}
|
|
104174
|
+
function getLocale() {
|
|
104175
|
+
var _splitLocale$, _splitLocale$2;
|
|
104176
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
104177
|
+
url = _ref2.url;
|
|
104178
|
+
var currentLocale = getLocaleCodeFromUrl(url ? {
|
|
104179
|
+
url: url
|
|
104180
|
+
} : null);
|
|
104181
|
+
var splitLocale = currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.split("-");
|
|
104182
|
+
return {
|
|
104183
|
+
locale: currentLocale,
|
|
104184
|
+
language: splitLocale === null || splitLocale === void 0 || (_splitLocale$ = splitLocale[1]) === null || _splitLocale$ === void 0 ? void 0 : _splitLocale$.toLowerCase(),
|
|
104185
|
+
country: splitLocale === null || splitLocale === void 0 || (_splitLocale$2 = splitLocale[0]) === null || _splitLocale$2 === void 0 ? void 0 : _splitLocale$2.toUpperCase()
|
|
104186
|
+
};
|
|
104187
|
+
}
|
|
104188
|
+
function locale_isBrowser() {
|
|
104189
|
+
return typeof window !== "undefined" && window != null;
|
|
104190
|
+
}
|
|
104191
|
+
|
|
104192
|
+
/** Normalized `country`, `language`, and `locale` string from explicit market + language. */
|
|
104193
|
+
function buildLocaleData(market, language) {
|
|
104194
|
+
var country = String(market).trim().toUpperCase();
|
|
104195
|
+
var lang = String(language).trim().toLowerCase();
|
|
104196
|
+
if (!country || !lang) {
|
|
104197
|
+
throw new Error("@nuskin/nextgen-header: `market` and `language` must be non-empty when provided.");
|
|
104198
|
+
}
|
|
104199
|
+
return {
|
|
104200
|
+
country: country,
|
|
104201
|
+
language: lang,
|
|
104202
|
+
locale: "".concat(country, "-").concat(lang)
|
|
104203
|
+
};
|
|
104204
|
+
}
|
|
104205
|
+
|
|
104206
|
+
/**
|
|
104207
|
+
* Resolves locale data (`country`, `language`, `locale`) for the header shell.
|
|
104208
|
+
*
|
|
104209
|
+
* - **SSR (no `window`):** `market` and `language` are required (e.g. from the host or from `requestUrl` in `renderAndExtractContext`).
|
|
104210
|
+
* - **CSR:** `market` and `language` optional; if omitted, derived from the current URL via the same rules as `getLocale()`. Throws if `window` is missing or the path cannot be parsed.
|
|
104211
|
+
*/
|
|
104212
|
+
function resolveHeaderLocale() {
|
|
104213
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
104214
|
+
market = _ref3.market,
|
|
104215
|
+
language = _ref3.language;
|
|
104216
|
+
var explicit = market != null && language != null && String(market).trim() !== "" && String(language).trim() !== "";
|
|
104217
|
+
if (explicit) {
|
|
104218
|
+
return buildLocaleData(market, language);
|
|
104219
|
+
}
|
|
104220
|
+
if (!locale_isBrowser()) {
|
|
104221
|
+
return buildLocaleData("US", "en");
|
|
104222
|
+
}
|
|
104223
|
+
var fromUrl = getLocale();
|
|
104224
|
+
if (!fromUrl.country || !fromUrl.language || !fromUrl.locale || String(fromUrl.locale).includes("undefined")) {
|
|
104225
|
+
throw new Error("@nuskin/nextgen-header: could not derive `market` and `language` from the current URL (expected a path with at least two segments, e.g. /en/us/...). Pass `market` and `language` explicitly.");
|
|
104226
|
+
}
|
|
104227
|
+
return fromUrl;
|
|
104228
|
+
}
|
|
104229
|
+
|
|
104230
|
+
;// ./src/utils/createHeaderSearchService.js
|
|
104231
|
+
function createHeaderSearchService_typeof(o) { "@babel/helpers - typeof"; return createHeaderSearchService_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, createHeaderSearchService_typeof(o); }
|
|
104232
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = createHeaderSearchService_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
104233
|
+
function createHeaderSearchService_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return createHeaderSearchService_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? createHeaderSearchService_arrayLikeToArray(r, a) : void 0; } }
|
|
104234
|
+
function createHeaderSearchService_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
104235
|
+
function createHeaderSearchService_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
104236
|
+
function createHeaderSearchService_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? createHeaderSearchService_ownKeys(Object(t), !0).forEach(function (r) { createHeaderSearchService_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : createHeaderSearchService_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
104237
|
+
function createHeaderSearchService_defineProperty(e, r, t) { return (r = createHeaderSearchService_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
104238
|
+
function createHeaderSearchService_toPropertyKey(t) { var i = createHeaderSearchService_toPrimitive(t, "string"); return "symbol" == createHeaderSearchService_typeof(i) ? i : i + ""; }
|
|
104239
|
+
function createHeaderSearchService_toPrimitive(t, r) { if ("object" != createHeaderSearchService_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != createHeaderSearchService_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
104240
|
+
function createHeaderSearchService_regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return createHeaderSearchService_regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (createHeaderSearchService_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, createHeaderSearchService_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, createHeaderSearchService_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), createHeaderSearchService_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", createHeaderSearchService_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), createHeaderSearchService_regeneratorDefine2(u), createHeaderSearchService_regeneratorDefine2(u, o, "Generator"), createHeaderSearchService_regeneratorDefine2(u, n, function () { return this; }), createHeaderSearchService_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (createHeaderSearchService_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
104241
|
+
function createHeaderSearchService_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } createHeaderSearchService_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { createHeaderSearchService_regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, createHeaderSearchService_regeneratorDefine2(e, r, n, t); }
|
|
104242
|
+
function createHeaderSearchService_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
104243
|
+
function createHeaderSearchService_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { createHeaderSearchService_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { createHeaderSearchService_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
104244
|
+
|
|
104245
|
+
|
|
104246
|
+
var DEFAULT_SEARCH_PLACEHOLDER = "Product Search";
|
|
104247
|
+
var createHeaderSearchService_DEFAULT_INPUT_ARIA_LABEL = "Product search";
|
|
104248
|
+
var DEFAULT_SUGGESTION_PAGE = 1;
|
|
104249
|
+
/** Matches storefront catalog suggestions API defaults (prod/test). */
|
|
104250
|
+
var DEFAULT_SUGGESTION_SIZE = 6;
|
|
104251
|
+
var DEFAULT_SEARCH_PATH = "/search";
|
|
104252
|
+
var PROD_CATALOG_API_BASE = "https://apis.nuskin.com";
|
|
104253
|
+
var TEST_CATALOG_API_BASE = "https://apis.test.nuskin.com";
|
|
104254
|
+
var CATALOG_SUGGESTIONS_PATH = "/storefront/catalogs/search/suggestions";
|
|
104255
|
+
var PROD_DEFAULT_STORE_ID = "404";
|
|
104256
|
+
var TEST_DEFAULT_STORE_ID = "430";
|
|
104257
|
+
function getBrowserLocation(providedLocation) {
|
|
104258
|
+
if (providedLocation) return providedLocation;
|
|
104259
|
+
if (typeof window !== "undefined" && window.location) return window.location;
|
|
104260
|
+
return null;
|
|
104261
|
+
}
|
|
104262
|
+
function getHostname(locationLike) {
|
|
104263
|
+
var _window$location;
|
|
104264
|
+
if (locationLike !== null && locationLike !== void 0 && locationLike.hostname) {
|
|
104265
|
+
return String(locationLike.hostname).toLowerCase();
|
|
104266
|
+
}
|
|
104267
|
+
if (typeof window !== "undefined" && (_window$location = window.location) !== null && _window$location !== void 0 && _window$location.hostname) {
|
|
104268
|
+
return String(window.location.hostname).toLowerCase();
|
|
104269
|
+
}
|
|
104270
|
+
return "";
|
|
104271
|
+
}
|
|
104272
|
+
function isTestLikeCatalogHost(host) {
|
|
104273
|
+
return Boolean(host) && (host === "localhost" || host === "127.0.0.1" || host === "test.nuskin.com" || host.endsWith(".test.nuskin.com") || host === "local.nuskin.com" || host.endsWith(".local.nuskin.com"));
|
|
104274
|
+
}
|
|
104275
|
+
function resolveDefaultCatalogApiBaseUrl(locationLike) {
|
|
104276
|
+
return isTestLikeCatalogHost(getHostname(locationLike)) ? TEST_CATALOG_API_BASE : PROD_CATALOG_API_BASE;
|
|
104277
|
+
}
|
|
104278
|
+
function resolveDefaultCatalogStoreId(locationLike) {
|
|
104279
|
+
return isTestLikeCatalogHost(getHostname(locationLike)) ? TEST_DEFAULT_STORE_ID : PROD_DEFAULT_STORE_ID;
|
|
104280
|
+
}
|
|
104281
|
+
function getSessionStorage(providedStorage) {
|
|
104282
|
+
if (providedStorage) return providedStorage;
|
|
104283
|
+
if (typeof window !== "undefined") {
|
|
104284
|
+
try {
|
|
104285
|
+
return window.sessionStorage;
|
|
104286
|
+
} catch (_unused) {
|
|
104287
|
+
return null;
|
|
104288
|
+
}
|
|
104289
|
+
}
|
|
104290
|
+
return null;
|
|
104291
|
+
}
|
|
104292
|
+
function resolveLocaleParts(providedLocaleParts, locationLike) {
|
|
104293
|
+
if (providedLocaleParts !== null && providedLocaleParts !== void 0 && providedLocaleParts.country && providedLocaleParts !== null && providedLocaleParts !== void 0 && providedLocaleParts.language) {
|
|
104294
|
+
var _providedLocaleParts$;
|
|
104295
|
+
return {
|
|
104296
|
+
country: String(providedLocaleParts.country).trim().toUpperCase(),
|
|
104297
|
+
language: String(providedLocaleParts.language).trim().toLowerCase(),
|
|
104298
|
+
locale: String((_providedLocaleParts$ = providedLocaleParts.locale) !== null && _providedLocaleParts$ !== void 0 ? _providedLocaleParts$ : "").trim() || "".concat(String(providedLocaleParts.country).trim().toUpperCase(), "-").concat(String(providedLocaleParts.language).trim().toLowerCase())
|
|
104299
|
+
};
|
|
104300
|
+
}
|
|
104301
|
+
var pathSource = (locationLike === null || locationLike === void 0 ? void 0 : locationLike.pathname) || (locationLike === null || locationLike === void 0 ? void 0 : locationLike.href) || (typeof location !== "undefined" ? location.href : "");
|
|
104302
|
+
try {
|
|
104303
|
+
return getLocale({
|
|
104304
|
+
url: pathSource
|
|
104305
|
+
});
|
|
104306
|
+
} catch (_unused2) {
|
|
104307
|
+
return {
|
|
104308
|
+
country: "US",
|
|
104309
|
+
language: "en",
|
|
104310
|
+
locale: "US-en"
|
|
104311
|
+
};
|
|
104312
|
+
}
|
|
104313
|
+
}
|
|
104314
|
+
function buildSearchResultsPath(query, localeParts) {
|
|
104315
|
+
var trimmedQuery = String(query !== null && query !== void 0 ? query : "").trim();
|
|
104316
|
+
var hyphenatedQuery = trimmedQuery.replace(/\s+/g, "-");
|
|
104317
|
+
var encodedQuery = encodeURIComponent(hyphenatedQuery).replace(/%2D/gi, "-");
|
|
104318
|
+
var country = localeParts.country.toLowerCase();
|
|
104319
|
+
var language = localeParts.language.toLowerCase();
|
|
104320
|
+
return "/".concat(country, "/").concat(language).concat(DEFAULT_SEARCH_PATH, "/").concat(encodedQuery);
|
|
104321
|
+
}
|
|
104322
|
+
function toCatalogLocale(localeParts) {
|
|
104323
|
+
var _localeParts$language, _localeParts$country;
|
|
104324
|
+
var language = String((_localeParts$language = localeParts === null || localeParts === void 0 ? void 0 : localeParts.language) !== null && _localeParts$language !== void 0 ? _localeParts$language : "en").toLowerCase();
|
|
104325
|
+
var country = String((_localeParts$country = localeParts === null || localeParts === void 0 ? void 0 : localeParts.country) !== null && _localeParts$country !== void 0 ? _localeParts$country : "US").toUpperCase();
|
|
104326
|
+
return "".concat(language, "_").concat(country);
|
|
104327
|
+
}
|
|
104328
|
+
function resolveSuggestionsUrl(suggestionsApi, locationLike) {
|
|
104329
|
+
var _locationLike$origin;
|
|
104330
|
+
var normalizedValue = String(suggestionsApi !== null && suggestionsApi !== void 0 ? suggestionsApi : "").trim();
|
|
104331
|
+
var defaultAbsolute = "".concat(resolveDefaultCatalogApiBaseUrl(locationLike)).concat(CATALOG_SUGGESTIONS_PATH);
|
|
104332
|
+
var pathOrUrl = normalizedValue || defaultAbsolute;
|
|
104333
|
+
if (pathOrUrl.startsWith("http://") || pathOrUrl.startsWith("https://")) {
|
|
104334
|
+
return pathOrUrl;
|
|
104335
|
+
}
|
|
104336
|
+
var normalizedPath = pathOrUrl.startsWith("/") ? pathOrUrl : "/".concat(pathOrUrl);
|
|
104337
|
+
var origin = String((_locationLike$origin = locationLike === null || locationLike === void 0 ? void 0 : locationLike.origin) !== null && _locationLike$origin !== void 0 ? _locationLike$origin : "").trim();
|
|
104338
|
+
return origin ? "".concat(origin).concat(normalizedPath) : defaultAbsolute;
|
|
104339
|
+
}
|
|
104340
|
+
function normalizeOptionUrl(rawValue) {
|
|
104341
|
+
if (typeof rawValue !== "string") return "";
|
|
104342
|
+
return rawValue.trim();
|
|
104343
|
+
}
|
|
104344
|
+
function safeDecodeURIComponent(value) {
|
|
104345
|
+
try {
|
|
104346
|
+
return decodeURIComponent(value);
|
|
104347
|
+
} catch (_unused3) {
|
|
104348
|
+
return value;
|
|
104349
|
+
}
|
|
104350
|
+
}
|
|
104351
|
+
function trimEdgeHyphens(value) {
|
|
104352
|
+
var normalizedValue = value;
|
|
104353
|
+
while (normalizedValue.startsWith("-")) {
|
|
104354
|
+
normalizedValue = normalizedValue.slice(1);
|
|
104355
|
+
}
|
|
104356
|
+
while (normalizedValue.endsWith("-")) {
|
|
104357
|
+
normalizedValue = normalizedValue.slice(0, -1);
|
|
104358
|
+
}
|
|
104359
|
+
return normalizedValue;
|
|
104360
|
+
}
|
|
104361
|
+
function slugifyPathSegment(value) {
|
|
104362
|
+
var decoded = safeDecodeURIComponent(String(value !== null && value !== void 0 ? value : "")).replace(/\+/g, " ");
|
|
104363
|
+
var normalized = decoded.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-zA-Z0-9]+/g, "-").replace(/-{2,}/g, "-").toLowerCase();
|
|
104364
|
+
return trimEdgeHyphens(normalized);
|
|
104365
|
+
}
|
|
104366
|
+
function buildProductSlugPath(slugValue, localeParts) {
|
|
104367
|
+
var _localeParts$country2, _localeParts$language2;
|
|
104368
|
+
var slug = slugifyPathSegment(slugValue);
|
|
104369
|
+
if (!slug) return "";
|
|
104370
|
+
var country = String((_localeParts$country2 = localeParts === null || localeParts === void 0 ? void 0 : localeParts.country) !== null && _localeParts$country2 !== void 0 ? _localeParts$country2 : "US").toLowerCase();
|
|
104371
|
+
var language = String((_localeParts$language2 = localeParts === null || localeParts === void 0 ? void 0 : localeParts.language) !== null && _localeParts$language2 !== void 0 ? _localeParts$language2 : "en").toLowerCase();
|
|
104372
|
+
return "/".concat(country, "/").concat(language, "/product/").concat(slug);
|
|
104373
|
+
}
|
|
104374
|
+
function isNavigableUrl(value) {
|
|
104375
|
+
if (!value) return false;
|
|
104376
|
+
return value.startsWith("/") || /^https?:\/\//i.test(value);
|
|
104377
|
+
}
|
|
104378
|
+
function resolveOptionHref(option, localeParts) {
|
|
104379
|
+
var _ref, _option$slug, _option$href;
|
|
104380
|
+
var productSlugPath = buildProductSlugPath((_ref = (_option$slug = option === null || option === void 0 ? void 0 : option.slug) !== null && _option$slug !== void 0 ? _option$slug : option === null || option === void 0 ? void 0 : option.productSlug) !== null && _ref !== void 0 ? _ref : option === null || option === void 0 ? void 0 : option.product_slug, localeParts);
|
|
104381
|
+
if (productSlugPath) {
|
|
104382
|
+
return productSlugPath;
|
|
104383
|
+
}
|
|
104384
|
+
var directUrl = normalizeOptionUrl((_option$href = option === null || option === void 0 ? void 0 : option.href) !== null && _option$href !== void 0 ? _option$href : option === null || option === void 0 ? void 0 : option.url);
|
|
104385
|
+
if (isNavigableUrl(directUrl) && !directUrl.includes("/chr/")) return directUrl;
|
|
104386
|
+
return "";
|
|
104387
|
+
}
|
|
104388
|
+
function fetchJsonFromCandidates(_x, _x2) {
|
|
104389
|
+
return _fetchJsonFromCandidates.apply(this, arguments);
|
|
104390
|
+
}
|
|
104391
|
+
function _fetchJsonFromCandidates() {
|
|
104392
|
+
_fetchJsonFromCandidates = createHeaderSearchService_asyncToGenerator(/*#__PURE__*/createHeaderSearchService_regenerator().m(function _callee3(fetchImpl, requestUrls) {
|
|
104393
|
+
var lastError, _iterator, _step, requestUrl, response, _t, _t2;
|
|
104394
|
+
return createHeaderSearchService_regenerator().w(function (_context3) {
|
|
104395
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
104396
|
+
case 0:
|
|
104397
|
+
_iterator = _createForOfIteratorHelper(requestUrls);
|
|
104398
|
+
_context3.p = 1;
|
|
104399
|
+
_iterator.s();
|
|
104400
|
+
case 2:
|
|
104401
|
+
if ((_step = _iterator.n()).done) {
|
|
104402
|
+
_context3.n = 9;
|
|
104403
|
+
break;
|
|
104404
|
+
}
|
|
104405
|
+
requestUrl = _step.value;
|
|
104406
|
+
_context3.p = 3;
|
|
104407
|
+
_context3.n = 4;
|
|
104408
|
+
return fetchImpl(requestUrl, {
|
|
104409
|
+
method: "GET",
|
|
104410
|
+
credentials: "include",
|
|
104411
|
+
headers: {
|
|
104412
|
+
Accept: "application/json"
|
|
104413
|
+
}
|
|
104414
|
+
});
|
|
104415
|
+
case 4:
|
|
104416
|
+
response = _context3.v;
|
|
104417
|
+
if (response.ok) {
|
|
104418
|
+
_context3.n = 5;
|
|
104419
|
+
break;
|
|
104420
|
+
}
|
|
104421
|
+
lastError = new Error("Request failed with status ".concat(response.status));
|
|
104422
|
+
return _context3.a(3, 8);
|
|
104423
|
+
case 5:
|
|
104424
|
+
_context3.n = 6;
|
|
104425
|
+
return response.json();
|
|
104426
|
+
case 6:
|
|
104427
|
+
return _context3.a(2, _context3.v);
|
|
104428
|
+
case 7:
|
|
104429
|
+
_context3.p = 7;
|
|
104430
|
+
_t = _context3.v;
|
|
104431
|
+
lastError = _t;
|
|
104432
|
+
case 8:
|
|
104433
|
+
_context3.n = 2;
|
|
104434
|
+
break;
|
|
104435
|
+
case 9:
|
|
104436
|
+
_context3.n = 11;
|
|
104437
|
+
break;
|
|
104438
|
+
case 10:
|
|
104439
|
+
_context3.p = 10;
|
|
104440
|
+
_t2 = _context3.v;
|
|
104441
|
+
_iterator.e(_t2);
|
|
104442
|
+
case 11:
|
|
104443
|
+
_context3.p = 11;
|
|
104444
|
+
_iterator.f();
|
|
104445
|
+
return _context3.f(11);
|
|
104446
|
+
case 12:
|
|
104447
|
+
throw lastError !== null && lastError !== void 0 ? lastError : new Error("Unable to fetch header search data");
|
|
104448
|
+
case 13:
|
|
104449
|
+
return _context3.a(2);
|
|
104450
|
+
}
|
|
104451
|
+
}, _callee3, null, [[3, 7], [1, 10, 11, 12]]);
|
|
104452
|
+
}));
|
|
104453
|
+
return _fetchJsonFromCandidates.apply(this, arguments);
|
|
104454
|
+
}
|
|
104455
|
+
function createHeaderSearchService() {
|
|
104456
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
104457
|
+
var _options$fetchImpl = options.fetchImpl,
|
|
104458
|
+
fetchImpl = _options$fetchImpl === void 0 ? typeof fetch === "function" ? fetch.bind(globalThis) : null : _options$fetchImpl,
|
|
104459
|
+
providedLocation = options.location,
|
|
104460
|
+
providedStorage = options.storage,
|
|
104461
|
+
suggestionsApi = options.suggestionsApi,
|
|
104462
|
+
storeIdOption = options.storeId,
|
|
104463
|
+
country = options.country,
|
|
104464
|
+
language = options.language,
|
|
104465
|
+
locale = options.locale,
|
|
104466
|
+
_options$searchPlaceh = options.searchPlaceholder,
|
|
104467
|
+
searchPlaceholder = _options$searchPlaceh === void 0 ? DEFAULT_SEARCH_PLACEHOLDER : _options$searchPlaceh,
|
|
104468
|
+
_options$inputAriaLab = options.inputAriaLabel,
|
|
104469
|
+
inputAriaLabel = _options$inputAriaLab === void 0 ? createHeaderSearchService_DEFAULT_INPUT_ARIA_LABEL : _options$inputAriaLab;
|
|
104470
|
+
var locationLike = getBrowserLocation(providedLocation);
|
|
104471
|
+
var resolvedStoreId = storeIdOption !== undefined && storeIdOption !== null && String(storeIdOption).trim() !== "" ? String(storeIdOption).trim() : resolveDefaultCatalogStoreId(locationLike);
|
|
104472
|
+
var storage = getSessionStorage(providedStorage);
|
|
104473
|
+
var localeParts = resolveLocaleParts({
|
|
104474
|
+
country: country,
|
|
104475
|
+
language: language,
|
|
104476
|
+
locale: locale
|
|
104477
|
+
}, locationLike);
|
|
104478
|
+
var service = {
|
|
104479
|
+
getSearchChromeCopy: function getSearchChromeCopy() {
|
|
104480
|
+
return createHeaderSearchService_asyncToGenerator(/*#__PURE__*/createHeaderSearchService_regenerator().m(function _callee() {
|
|
104481
|
+
return createHeaderSearchService_regenerator().w(function (_context) {
|
|
104482
|
+
while (1) switch (_context.n) {
|
|
104483
|
+
case 0:
|
|
104484
|
+
return _context.a(2, {
|
|
104485
|
+
placeholder: searchPlaceholder || DEFAULT_SEARCH_PLACEHOLDER,
|
|
104486
|
+
inputAriaLabel: inputAriaLabel || createHeaderSearchService_DEFAULT_INPUT_ARIA_LABEL
|
|
104487
|
+
});
|
|
104488
|
+
}
|
|
104489
|
+
}, _callee);
|
|
104490
|
+
}))();
|
|
104491
|
+
},
|
|
104492
|
+
fetchSuggestions: function fetchSuggestions(searchTerm) {
|
|
104493
|
+
return createHeaderSearchService_asyncToGenerator(/*#__PURE__*/createHeaderSearchService_regenerator().m(function _callee2() {
|
|
104494
|
+
var _responsePayload$sugg, _ref2, _responsePayload$didY, _ref3, _ref4, _ref5, _responsePayload$tota, _responsePayload$page, _responsePayload$prod, _responsePayload$sugg2;
|
|
104495
|
+
var trimmedSearchTerm, queryParams, requestUrls, responsePayload;
|
|
104496
|
+
return createHeaderSearchService_regenerator().w(function (_context2) {
|
|
104497
|
+
while (1) switch (_context2.n) {
|
|
104498
|
+
case 0:
|
|
104499
|
+
trimmedSearchTerm = String(searchTerm !== null && searchTerm !== void 0 ? searchTerm : "").trim();
|
|
104500
|
+
if (!(!trimmedSearchTerm || !fetchImpl)) {
|
|
104501
|
+
_context2.n = 1;
|
|
104502
|
+
break;
|
|
104503
|
+
}
|
|
104504
|
+
return _context2.a(2, {
|
|
104505
|
+
suggestions: [],
|
|
104506
|
+
didYouMean: [],
|
|
104507
|
+
totalResultsCount: 0
|
|
104508
|
+
});
|
|
104509
|
+
case 1:
|
|
104510
|
+
queryParams = new URLSearchParams({
|
|
104511
|
+
searchTerm: trimmedSearchTerm,
|
|
104512
|
+
page: String(DEFAULT_SUGGESTION_PAGE),
|
|
104513
|
+
size: String(DEFAULT_SUGGESTION_SIZE),
|
|
104514
|
+
locale: toCatalogLocale(localeParts),
|
|
104515
|
+
storeId: String(resolvedStoreId)
|
|
104516
|
+
});
|
|
104517
|
+
requestUrls = ["".concat(resolveSuggestionsUrl(suggestionsApi, locationLike), "?").concat(queryParams.toString())];
|
|
104518
|
+
_context2.n = 2;
|
|
104519
|
+
return fetchJsonFromCandidates(fetchImpl, requestUrls);
|
|
104520
|
+
case 2:
|
|
104521
|
+
responsePayload = _context2.v;
|
|
104522
|
+
return _context2.a(2, createHeaderSearchService_objectSpread(createHeaderSearchService_objectSpread({}, responsePayload), {}, {
|
|
104523
|
+
suggestions: (_responsePayload$sugg = responsePayload === null || responsePayload === void 0 ? void 0 : responsePayload.suggestions) !== null && _responsePayload$sugg !== void 0 ? _responsePayload$sugg : [],
|
|
104524
|
+
didYouMean: (_ref2 = (_responsePayload$didY = responsePayload === null || responsePayload === void 0 ? void 0 : responsePayload.didYouMean) !== null && _responsePayload$didY !== void 0 ? _responsePayload$didY : responsePayload === null || responsePayload === void 0 ? void 0 : responsePayload.did_you_mean) !== null && _ref2 !== void 0 ? _ref2 : [],
|
|
104525
|
+
totalResultsCount: (_ref3 = (_ref4 = (_ref5 = (_responsePayload$tota = responsePayload === null || responsePayload === void 0 ? void 0 : responsePayload.totalResultsCount) !== null && _responsePayload$tota !== void 0 ? _responsePayload$tota : responsePayload === null || responsePayload === void 0 || (_responsePayload$page = responsePayload.pageableInfo) === null || _responsePayload$page === void 0 ? void 0 : _responsePayload$page.totalCount) !== null && _ref5 !== void 0 ? _ref5 : responsePayload === null || responsePayload === void 0 || (_responsePayload$prod = responsePayload.product) === null || _responsePayload$prod === void 0 ? void 0 : _responsePayload$prod.length) !== null && _ref4 !== void 0 ? _ref4 : responsePayload === null || responsePayload === void 0 || (_responsePayload$sugg2 = responsePayload.suggestions) === null || _responsePayload$sugg2 === void 0 ? void 0 : _responsePayload$sugg2.length) !== null && _ref3 !== void 0 ? _ref3 : 0
|
|
104526
|
+
}));
|
|
104527
|
+
}
|
|
104528
|
+
}, _callee2);
|
|
104529
|
+
}))();
|
|
104530
|
+
},
|
|
104531
|
+
submitProductSearch: function submitProductSearch(query, option) {
|
|
104532
|
+
var trimmedQuery = String(query !== null && query !== void 0 ? query : "").trim();
|
|
104533
|
+
if (!trimmedQuery) return undefined;
|
|
104534
|
+
addRecentHeaderSearch(localeParts, trimmedQuery, storage);
|
|
104535
|
+
var optionHref = resolveOptionHref(option, localeParts);
|
|
104536
|
+
if (optionHref && locationLike && typeof locationLike.assign === "function") {
|
|
104537
|
+
locationLike.assign(optionHref);
|
|
104538
|
+
return optionHref;
|
|
104539
|
+
}
|
|
104540
|
+
var targetPath = buildSearchResultsPath(trimmedQuery, localeParts);
|
|
104541
|
+
if (locationLike && typeof locationLike.assign === "function") {
|
|
104542
|
+
locationLike.assign(targetPath);
|
|
104543
|
+
}
|
|
104544
|
+
return targetPath;
|
|
104545
|
+
},
|
|
104546
|
+
activateSuggestionAction: function activateSuggestionAction(option) {
|
|
104547
|
+
var _ref6, _ref7, _option$value;
|
|
104548
|
+
var optionHref = resolveOptionHref(option, localeParts);
|
|
104549
|
+
if (optionHref && locationLike && typeof locationLike.assign === "function") {
|
|
104550
|
+
locationLike.assign(optionHref);
|
|
104551
|
+
return optionHref;
|
|
104552
|
+
}
|
|
104553
|
+
var optionQuery = (_ref6 = (_ref7 = (_option$value = option === null || option === void 0 ? void 0 : option.value) !== null && _option$value !== void 0 ? _option$value : option === null || option === void 0 ? void 0 : option.label) !== null && _ref7 !== void 0 ? _ref7 : option === null || option === void 0 ? void 0 : option.identifier) !== null && _ref6 !== void 0 ? _ref6 : "";
|
|
104554
|
+
return service.submitProductSearch(optionQuery);
|
|
104555
|
+
},
|
|
104556
|
+
viewMoreResults: function viewMoreResults(_ref8) {
|
|
104557
|
+
var query = _ref8.query;
|
|
104558
|
+
return service.submitProductSearch(query);
|
|
104559
|
+
},
|
|
104560
|
+
getRecentSearches: function getRecentSearches() {
|
|
104561
|
+
return getRecentHeaderSearches(localeParts, storage);
|
|
104562
|
+
},
|
|
104563
|
+
clearRecentSearches: function clearRecentSearches() {
|
|
104564
|
+
clearRecentHeaderSearches(localeParts, storage);
|
|
104565
|
+
}
|
|
104566
|
+
};
|
|
104567
|
+
return service;
|
|
104568
|
+
}
|
|
104569
|
+
;// ./src/components/header/regions/HeaderSearchRegion.jsx
|
|
104570
|
+
function HeaderSearchRegion_typeof(o) { "@babel/helpers - typeof"; return HeaderSearchRegion_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, HeaderSearchRegion_typeof(o); }
|
|
104571
|
+
function HeaderSearchRegion_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
104572
|
+
function HeaderSearchRegion_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? HeaderSearchRegion_ownKeys(Object(t), !0).forEach(function (r) { HeaderSearchRegion_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : HeaderSearchRegion_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
104573
|
+
function HeaderSearchRegion_defineProperty(e, r, t) { return (r = HeaderSearchRegion_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
104574
|
+
function HeaderSearchRegion_toPropertyKey(t) { var i = HeaderSearchRegion_toPrimitive(t, "string"); return "symbol" == HeaderSearchRegion_typeof(i) ? i : i + ""; }
|
|
104575
|
+
function HeaderSearchRegion_toPrimitive(t, r) { if ("object" != HeaderSearchRegion_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != HeaderSearchRegion_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
104576
|
+
function HeaderSearchRegion_regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return HeaderSearchRegion_regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (HeaderSearchRegion_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, HeaderSearchRegion_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, HeaderSearchRegion_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), HeaderSearchRegion_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", HeaderSearchRegion_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), HeaderSearchRegion_regeneratorDefine2(u), HeaderSearchRegion_regeneratorDefine2(u, o, "Generator"), HeaderSearchRegion_regeneratorDefine2(u, n, function () { return this; }), HeaderSearchRegion_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (HeaderSearchRegion_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
104577
|
+
function HeaderSearchRegion_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } HeaderSearchRegion_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { HeaderSearchRegion_regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, HeaderSearchRegion_regeneratorDefine2(e, r, n, t); }
|
|
104578
|
+
function HeaderSearchRegion_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
104579
|
+
function HeaderSearchRegion_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { HeaderSearchRegion_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { HeaderSearchRegion_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
104580
|
+
function HeaderSearchRegion_slicedToArray(r, e) { return HeaderSearchRegion_arrayWithHoles(r) || HeaderSearchRegion_iterableToArrayLimit(r, e) || HeaderSearchRegion_unsupportedIterableToArray(r, e) || HeaderSearchRegion_nonIterableRest(); }
|
|
104581
|
+
function HeaderSearchRegion_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
104582
|
+
function HeaderSearchRegion_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return HeaderSearchRegion_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? HeaderSearchRegion_arrayLikeToArray(r, a) : void 0; } }
|
|
104583
|
+
function HeaderSearchRegion_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
104584
|
+
function HeaderSearchRegion_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
104585
|
+
function HeaderSearchRegion_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
104586
|
+
|
|
104587
|
+
|
|
104588
|
+
|
|
104589
|
+
|
|
104590
|
+
|
|
104591
|
+
|
|
104592
|
+
function HeaderSearchRegion(_ref) {
|
|
104593
|
+
var _searchConfig$autoCom2, _searchConfig$autoCom3, _searchConfig$recentS;
|
|
104594
|
+
var country = _ref.country,
|
|
104595
|
+
language = _ref.language,
|
|
104596
|
+
locale = _ref.locale,
|
|
104597
|
+
searchConfig = _ref.searchConfig,
|
|
104598
|
+
showMobileTrigger = _ref.showMobileTrigger,
|
|
104599
|
+
showDesktopTrigger = _ref.showDesktopTrigger;
|
|
104600
|
+
var headerSearchService = (0,external_react_.useMemo)(function () {
|
|
104601
|
+
var _searchConfig$autoCom;
|
|
104602
|
+
return createHeaderSearchService({
|
|
104603
|
+
country: country,
|
|
104604
|
+
language: language,
|
|
104605
|
+
locale: locale,
|
|
104606
|
+
searchPlaceholder: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.searchPlaceholder,
|
|
104607
|
+
inputAriaLabel: (searchConfig === null || searchConfig === void 0 || (_searchConfig$autoCom = searchConfig.autoCompleteCopy) === null || _searchConfig$autoCom === void 0 ? void 0 : _searchConfig$autoCom.inputAriaLabel) || (searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.searchPlaceholder)
|
|
104608
|
+
});
|
|
104609
|
+
}, [country, language, locale, searchConfig === null || searchConfig === void 0 || (_searchConfig$autoCom2 = searchConfig.autoCompleteCopy) === null || _searchConfig$autoCom2 === void 0 ? void 0 : _searchConfig$autoCom2.inputAriaLabel, searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.searchPlaceholder]);
|
|
104610
|
+
var _useState = (0,external_react_.useState)(null),
|
|
104611
|
+
_useState2 = HeaderSearchRegion_slicedToArray(_useState, 2),
|
|
104612
|
+
copy = _useState2[0],
|
|
104613
|
+
setCopy = _useState2[1];
|
|
104614
|
+
(0,external_react_.useEffect)(function () {
|
|
104615
|
+
var canceled = false;
|
|
104616
|
+
HeaderSearchRegion_asyncToGenerator(/*#__PURE__*/HeaderSearchRegion_regenerator().m(function _callee() {
|
|
104617
|
+
var c, _t;
|
|
104618
|
+
return HeaderSearchRegion_regenerator().w(function (_context) {
|
|
104619
|
+
while (1) switch (_context.p = _context.n) {
|
|
104620
|
+
case 0:
|
|
104621
|
+
_context.p = 0;
|
|
104622
|
+
_context.n = 1;
|
|
104623
|
+
return headerSearchService.getSearchChromeCopy();
|
|
104624
|
+
case 1:
|
|
104625
|
+
c = _context.v;
|
|
104626
|
+
if (!canceled) setCopy(c);
|
|
104627
|
+
_context.n = 3;
|
|
104628
|
+
break;
|
|
104629
|
+
case 2:
|
|
104630
|
+
_context.p = 2;
|
|
104631
|
+
_t = _context.v;
|
|
104632
|
+
case 3:
|
|
104633
|
+
return _context.a(2);
|
|
104634
|
+
}
|
|
104635
|
+
}, _callee, null, [[0, 2]]);
|
|
104636
|
+
}))();
|
|
104637
|
+
return function () {
|
|
104638
|
+
canceled = true;
|
|
104639
|
+
};
|
|
104640
|
+
}, [headerSearchService]);
|
|
104641
|
+
var resolvedTriggerPlaceholder = (searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.triggerPlaceholder) || (copy === null || copy === void 0 ? void 0 : copy.placeholder) || TRIGGER_PLACEHOLDER;
|
|
104642
|
+
var resolvedSearchPlaceholder = (searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.searchPlaceholder) || (copy === null || copy === void 0 ? void 0 : copy.placeholder) || SEARCH_PLACEHOLDER;
|
|
104643
|
+
var autoCompleteEnabled = ((_searchConfig$autoCom3 = searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.autoCompleteEnabled) !== null && _searchConfig$autoCom3 !== void 0 ? _searchConfig$autoCom3 : true) && typeof (headerSearchService === null || headerSearchService === void 0 ? void 0 : headerSearchService.fetchSuggestions) === "function";
|
|
104644
|
+
var modalCopy = (0,external_react_.useMemo)(function () {
|
|
104645
|
+
var _searchConfig$autoCom4;
|
|
104646
|
+
return HeaderSearchRegion_objectSpread(HeaderSearchRegion_objectSpread({}, searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.autoCompleteCopy), {}, {
|
|
104647
|
+
placeholder: resolvedSearchPlaceholder || (searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.searchPlaceholder) || SEARCH_PLACEHOLDER,
|
|
104648
|
+
inputAriaLabel: (searchConfig === null || searchConfig === void 0 || (_searchConfig$autoCom4 = searchConfig.autoCompleteCopy) === null || _searchConfig$autoCom4 === void 0 ? void 0 : _searchConfig$autoCom4.inputAriaLabel) || (copy === null || copy === void 0 ? void 0 : copy.inputAriaLabel) || resolvedSearchPlaceholder || SEARCH_PLACEHOLDER
|
|
104649
|
+
});
|
|
104650
|
+
}, [copy === null || copy === void 0 ? void 0 : copy.inputAriaLabel, resolvedSearchPlaceholder, searchConfig]);
|
|
101496
104651
|
return /*#__PURE__*/(0,jsx_runtime_.jsx)("div", {
|
|
101497
104652
|
"data-region": "search",
|
|
101498
|
-
children: /*#__PURE__*/(0,jsx_runtime_.
|
|
101499
|
-
|
|
101500
|
-
|
|
101501
|
-
|
|
101502
|
-
|
|
101503
|
-
|
|
101504
|
-
|
|
101505
|
-
|
|
101506
|
-
|
|
101507
|
-
|
|
101508
|
-
|
|
101509
|
-
|
|
101510
|
-
|
|
101511
|
-
|
|
101512
|
-
|
|
101513
|
-
|
|
104653
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(SearchModal, {
|
|
104654
|
+
triggerPlaceholder: resolvedTriggerPlaceholder,
|
|
104655
|
+
searchPlaceholder: resolvedSearchPlaceholder,
|
|
104656
|
+
onSearch: function onSearch(query) {
|
|
104657
|
+
return headerSearchService.submitProductSearch(query);
|
|
104658
|
+
},
|
|
104659
|
+
modalTitle: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.modalTitle,
|
|
104660
|
+
brandLogo: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.brandLogo,
|
|
104661
|
+
brandLogoAlt: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.brandLogoAlt,
|
|
104662
|
+
brandHref: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.brandHref,
|
|
104663
|
+
brandSize: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.brandSize,
|
|
104664
|
+
showBrandLogo: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.showBrandLogo,
|
|
104665
|
+
cancelLabel: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.cancelLabel,
|
|
104666
|
+
cancelShowIcon: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.cancelShowIcon,
|
|
104667
|
+
showRecentSearches: (_searchConfig$recentS = searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.recentSearchesEnabled) !== null && _searchConfig$recentS !== void 0 ? _searchConfig$recentS : true,
|
|
104668
|
+
autoCompleteEnabled: autoCompleteEnabled,
|
|
104669
|
+
recentSearchesHeading: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.recentSearchesHeading,
|
|
104670
|
+
clearAllLabel: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.clearAllLabel,
|
|
104671
|
+
parent$: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.editableTags,
|
|
104672
|
+
headerSearchService: headerSearchService,
|
|
104673
|
+
copy: modalCopy,
|
|
104674
|
+
showMobileTrigger: showMobileTrigger,
|
|
104675
|
+
showDesktopTrigger: showDesktopTrigger
|
|
101514
104676
|
})
|
|
101515
104677
|
});
|
|
101516
104678
|
}
|
|
101517
104679
|
HeaderSearchRegion.propTypes = {
|
|
101518
|
-
|
|
101519
|
-
|
|
101520
|
-
|
|
101521
|
-
|
|
104680
|
+
country: (external_prop_types_default()).string.isRequired,
|
|
104681
|
+
language: (external_prop_types_default()).string.isRequired,
|
|
104682
|
+
locale: (external_prop_types_default()).string.isRequired,
|
|
104683
|
+
searchConfig: (external_prop_types_default()).object,
|
|
104684
|
+
showMobileTrigger: (external_prop_types_default()).bool,
|
|
104685
|
+
showDesktopTrigger: (external_prop_types_default()).bool
|
|
101522
104686
|
};
|
|
101523
104687
|
;// ./src/components/header/regions/HeaderNavigationRegion.jsx
|
|
101524
104688
|
function HeaderNavigationRegion_slicedToArray(r, e) { return HeaderNavigationRegion_arrayWithHoles(r) || HeaderNavigationRegion_iterableToArrayLimit(r, e) || HeaderNavigationRegion_unsupportedIterableToArray(r, e) || HeaderNavigationRegion_nonIterableRest(); }
|
|
@@ -101805,153 +104969,50 @@ var TopRibbon = function TopRibbon(_ref) {
|
|
|
101805
104969
|
};
|
|
101806
104970
|
TopRibbon.propTypes = TopRibbonPropTypes;
|
|
101807
104971
|
/* harmony default export */ const top_ribbon_TopRibbon = (TopRibbon);
|
|
101808
|
-
;// ./src/components/
|
|
101809
|
-
|
|
101810
|
-
|
|
101811
|
-
|
|
101812
|
-
|
|
101813
|
-
|
|
101814
|
-
|
|
101815
|
-
|
|
101816
|
-
|
|
101817
|
-
|
|
101818
|
-
|
|
101819
|
-
|
|
101820
|
-
|
|
101821
|
-
|
|
101822
|
-
|
|
101823
|
-
|
|
101824
|
-
|
|
101825
|
-
|
|
101826
|
-
|
|
101827
|
-
|
|
101828
|
-
|
|
101829
|
-
|
|
101830
|
-
|
|
101831
|
-
|
|
101832
|
-
|
|
101833
|
-
|
|
101834
|
-
|
|
101835
|
-
|
|
101836
|
-
|
|
101837
|
-
|
|
101838
|
-
|
|
101839
|
-
|
|
101840
|
-
|
|
101841
|
-
|
|
101842
|
-
|
|
101843
|
-
|
|
101844
|
-
|
|
101845
|
-
|
|
101846
|
-
|
|
101847
|
-
|
|
101848
|
-
|
|
101849
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerNavButton, {
|
|
101850
|
-
children: [item.label, /*#__PURE__*/(0,jsx_runtime_.jsx)(IconChevronDown, {})]
|
|
101851
|
-
})
|
|
101852
|
-
}, item.id);
|
|
101853
|
-
}), (loyaltyData === null || loyaltyData === void 0 ? void 0 : loyaltyData.link_label) && /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavItem, {
|
|
101854
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavButton, {
|
|
101855
|
-
as: "a",
|
|
101856
|
-
href: loyaltyData.href,
|
|
101857
|
-
style: {
|
|
101858
|
-
justifyContent: 'flex-start'
|
|
101859
|
-
},
|
|
101860
|
-
children: loyaltyData.link_label
|
|
101861
|
-
})
|
|
101862
|
-
}), marketTriggerMountRef ? null : /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavItem, {
|
|
101863
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerLocaleButton, {
|
|
101864
|
-
children: [localeData.control_label, /*#__PURE__*/(0,jsx_runtime_.jsx)(IconChevronDown, {})]
|
|
101865
|
-
})
|
|
101866
|
-
})]
|
|
101867
|
-
})]
|
|
101868
|
-
})]
|
|
101869
|
-
});
|
|
104972
|
+
;// ./src/components/brand/brand.helpers.js
|
|
104973
|
+
function parseLogoData(logoData) {
|
|
104974
|
+
if (!logoData) {
|
|
104975
|
+
return {
|
|
104976
|
+
logo: undefined,
|
|
104977
|
+
logoAlt: undefined,
|
|
104978
|
+
href: undefined,
|
|
104979
|
+
showLogo: true,
|
|
104980
|
+
size: "Large",
|
|
104981
|
+
$: null
|
|
104982
|
+
};
|
|
104983
|
+
}
|
|
104984
|
+
var _logoData$show = logoData.show,
|
|
104985
|
+
show = _logoData$show === void 0 ? true : _logoData$show,
|
|
104986
|
+
header_logo = logoData.header_logo,
|
|
104987
|
+
logo_alt = logoData.logo_alt,
|
|
104988
|
+
logo_url = logoData.logo_url,
|
|
104989
|
+
_logoData$logo_size = logoData.logo_size,
|
|
104990
|
+
logo_size = _logoData$logo_size === void 0 ? "Large" : _logoData$logo_size;
|
|
104991
|
+
var logoUrl;
|
|
104992
|
+
if (header_logo) {
|
|
104993
|
+
try {
|
|
104994
|
+
var parsed = JSON.parse(header_logo);
|
|
104995
|
+
var imageArray = parsed === null || parsed === void 0 ? void 0 : parsed.image;
|
|
104996
|
+
if (Array.isArray(imageArray) && imageArray.length > 0) {
|
|
104997
|
+
var _firstImage$selected, _firstImage$files, _firstImage$files2;
|
|
104998
|
+
var firstImage = imageArray[0];
|
|
104999
|
+
logoUrl = (firstImage === null || firstImage === void 0 || (_firstImage$selected = firstImage.selected) === null || _firstImage$selected === void 0 ? void 0 : _firstImage$selected.url) || (firstImage === null || firstImage === void 0 || (_firstImage$files = firstImage.files) === null || _firstImage$files === void 0 || (_firstImage$files = _firstImage$files.transformBaseUrl) === null || _firstImage$files === void 0 ? void 0 : _firstImage$files.url) || (firstImage === null || firstImage === void 0 || (_firstImage$files2 = firstImage.files) === null || _firstImage$files2 === void 0 || (_firstImage$files2 = _firstImage$files2.thumbnail) === null || _firstImage$files2 === void 0 ? void 0 : _firstImage$files2.url);
|
|
105000
|
+
}
|
|
105001
|
+
} catch (err) {
|
|
105002
|
+
console.warn("Failed to parse header_logo JSON:", err);
|
|
105003
|
+
}
|
|
105004
|
+
}
|
|
105005
|
+
return {
|
|
105006
|
+
logo: logoUrl,
|
|
105007
|
+
logoAlt: logo_alt,
|
|
105008
|
+
href: logo_url,
|
|
105009
|
+
showLogo: show,
|
|
105010
|
+
size: logo_size,
|
|
105011
|
+
$: logoData.$ || null
|
|
105012
|
+
};
|
|
101870
105013
|
}
|
|
101871
|
-
MobileHeaderDrawer.propTypes = {
|
|
101872
|
-
isOpen: (external_prop_types_default()).bool.isRequired,
|
|
101873
|
-
onClose: (external_prop_types_default()).func.isRequired,
|
|
101874
|
-
logoData: (external_prop_types_default()).object.isRequired,
|
|
101875
|
-
localeData: (external_prop_types_default()).object.isRequired,
|
|
101876
|
-
navigationData: (external_prop_types_default()).object.isRequired,
|
|
101877
|
-
loyaltyData: (external_prop_types_default()).object,
|
|
101878
|
-
marketTriggerMountRef: external_prop_types_default().shape({
|
|
101879
|
-
current: (external_prop_types_default()).any
|
|
101880
|
-
})
|
|
101881
|
-
};
|
|
101882
105014
|
// EXTERNAL MODULE: external "react-dom"
|
|
101883
105015
|
var external_react_dom_ = __webpack_require__(2326);
|
|
101884
|
-
// EXTERNAL MODULE: ./node_modules/@mui/material/Button/Button.js
|
|
101885
|
-
var Button = __webpack_require__(1629);
|
|
101886
|
-
;// ./src/components/button/CancelButton.styled.jsx
|
|
101887
|
-
|
|
101888
|
-
|
|
101889
|
-
var CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX = 1025;
|
|
101890
|
-
var CancelButtonRoot = /*#__PURE__*/createStyled(Button/* default */.A, true ? {
|
|
101891
|
-
target: "e1rel7ar2"
|
|
101892
|
-
} : 0)("--close-btn-font-family:Lora,sans-serif;--close-btn-desktop-text:#252525;--close-btn-hover-bg:#ebebeb;--close-btn-active-bg:#dcdcdc;min-width:48px;min-height:20px;padding:0;border:0;border-radius:0;text-transform:none;display:inline-flex;align-items:center;justify-content:center;gap:8px;background:transparent;color:var(--close-btn-desktop-text);font-family:var(--close-btn-font-family);font-size:14px;font-weight:600;line-height:20px;letter-spacing:0;transition:background-color 300ms ease-out;&:hover{background:transparent;}&:focus-visible{outline:1px solid #007bff;outline-offset:1px;}@media (min-width: ", CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX, "px){min-width:115px;min-height:44px;padding:11px 17px;border-radius:22px;font-size:16px;font-weight:500;line-height:22px;&:hover{background:var(--close-btn-hover-bg);}&:active{background:var(--close-btn-active-bg);}}" + ( true ? "" : 0));
|
|
101893
|
-
var CancelButtonIconWrap = /*#__PURE__*/createStyled("span", true ? {
|
|
101894
|
-
target: "e1rel7ar1"
|
|
101895
|
-
} : 0)("width:20px;height:20px;display:none;align-items:center;justify-content:center;line-height:0;svg{width:20px;height:20px;display:block;}@media (min-width: ", CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX, "px){display:inline-flex;}" + ( true ? "" : 0));
|
|
101896
|
-
var CancelButtonText = /*#__PURE__*/createStyled("span", true ? {
|
|
101897
|
-
target: "e1rel7ar0"
|
|
101898
|
-
} : 0)("display:inline-block;min-width:48px;line-height:inherit;text-decoration:none;text-underline-offset:2px;text-decoration-thickness:1px;@media (min-width: ", CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX, "px){min-width:53px;}", CancelButtonRoot, ":hover &{@media (min-width: ", CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX, "px){text-decoration:underline;}}", CancelButtonRoot, ":active &{@media (min-width: ", CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX, "px){text-decoration:none;}}" + ( true ? "" : 0));
|
|
101899
|
-
;// ./src/components/button/CancelButton.jsx
|
|
101900
|
-
function CancelButton_typeof(o) { "@babel/helpers - typeof"; return CancelButton_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, CancelButton_typeof(o); }
|
|
101901
|
-
function CancelButton_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
101902
|
-
function CancelButton_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? CancelButton_ownKeys(Object(t), !0).forEach(function (r) { CancelButton_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : CancelButton_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
101903
|
-
function CancelButton_defineProperty(e, r, t) { return (r = CancelButton_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
101904
|
-
function CancelButton_toPropertyKey(t) { var i = CancelButton_toPrimitive(t, "string"); return "symbol" == CancelButton_typeof(i) ? i : i + ""; }
|
|
101905
|
-
function CancelButton_toPrimitive(t, r) { if ("object" != CancelButton_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != CancelButton_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
101906
|
-
|
|
101907
|
-
|
|
101908
|
-
|
|
101909
|
-
|
|
101910
|
-
|
|
101911
|
-
function CancelButton(_ref) {
|
|
101912
|
-
var _ref$label = _ref.label,
|
|
101913
|
-
label = _ref$label === void 0 ? "Cancel" : _ref$label,
|
|
101914
|
-
_ref$onClick = _ref.onClick,
|
|
101915
|
-
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
101916
|
-
ariaLabel = _ref.ariaLabel,
|
|
101917
|
-
className = _ref.className,
|
|
101918
|
-
_ref$iconName = _ref.iconName,
|
|
101919
|
-
iconName = _ref$iconName === void 0 ? "close" : _ref$iconName,
|
|
101920
|
-
_ref$iconColor = _ref.iconColor,
|
|
101921
|
-
iconColor = _ref$iconColor === void 0 ? "#252525" : _ref$iconColor,
|
|
101922
|
-
_ref$showIcon = _ref.showIcon,
|
|
101923
|
-
showIcon = _ref$showIcon === void 0 ? true : _ref$showIcon,
|
|
101924
|
-
_ref$parent$ = _ref.parent$,
|
|
101925
|
-
parent$ = _ref$parent$ === void 0 ? {} : _ref$parent$;
|
|
101926
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(CancelButtonRoot, {
|
|
101927
|
-
className: className,
|
|
101928
|
-
"aria-label": ariaLabel || label,
|
|
101929
|
-
"data-testid": "cancel-button",
|
|
101930
|
-
disableRipple: true,
|
|
101931
|
-
onClick: onClick,
|
|
101932
|
-
type: "button",
|
|
101933
|
-
children: [showIcon ? /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButtonIconWrap, {
|
|
101934
|
-
"aria-hidden": "true",
|
|
101935
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(dist.NsIcon, {
|
|
101936
|
-
name: iconName,
|
|
101937
|
-
size: "small",
|
|
101938
|
-
colorOverride: iconColor
|
|
101939
|
-
})
|
|
101940
|
-
}) : null, /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButtonText, CancelButton_objectSpread(CancelButton_objectSpread({}, parent$ !== null && parent$ !== void 0 ? parent$ : {}), {}, {
|
|
101941
|
-
children: label
|
|
101942
|
-
}))]
|
|
101943
|
-
});
|
|
101944
|
-
}
|
|
101945
|
-
CancelButton.propTypes = {
|
|
101946
|
-
label: (external_prop_types_default()).string,
|
|
101947
|
-
onClick: (external_prop_types_default()).func,
|
|
101948
|
-
ariaLabel: (external_prop_types_default()).string,
|
|
101949
|
-
className: (external_prop_types_default()).string,
|
|
101950
|
-
iconName: (external_prop_types_default()).string,
|
|
101951
|
-
iconColor: (external_prop_types_default()).string,
|
|
101952
|
-
showIcon: (external_prop_types_default()).bool,
|
|
101953
|
-
parent$: (external_prop_types_default()).object
|
|
101954
|
-
};
|
|
101955
105016
|
;// ./src/components/tabs/constants.js
|
|
101956
105017
|
var TABS_TOP_NAV_MAX_WIDTH_PX = 1920;
|
|
101957
105018
|
var TABS_TOP_NAV_ROOT_PADDING = "32px 32px 16px";
|
|
@@ -102442,14 +105503,14 @@ var IconSlot = /*#__PURE__*/createStyled("span", true ? {
|
|
|
102442
105503
|
} : 0);
|
|
102443
105504
|
;// ./src/components/label-icon/LabelWithIcon.jsx
|
|
102444
105505
|
function LabelWithIcon_typeof(o) { "@babel/helpers - typeof"; return LabelWithIcon_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, LabelWithIcon_typeof(o); }
|
|
102445
|
-
var
|
|
105506
|
+
var LabelWithIcon_excluded = ["label", "label$", "icon", "iconPosition", "showIcon", "showDivider", "as", "href", "onClick", "disabled", "className", "tooltip", "aria-label"];
|
|
102446
105507
|
function LabelWithIcon_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
102447
105508
|
function LabelWithIcon_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? LabelWithIcon_ownKeys(Object(t), !0).forEach(function (r) { LabelWithIcon_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : LabelWithIcon_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
102448
105509
|
function LabelWithIcon_defineProperty(e, r, t) { return (r = LabelWithIcon_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
102449
105510
|
function LabelWithIcon_toPropertyKey(t) { var i = LabelWithIcon_toPrimitive(t, "string"); return "symbol" == LabelWithIcon_typeof(i) ? i : i + ""; }
|
|
102450
105511
|
function LabelWithIcon_toPrimitive(t, r) { if ("object" != LabelWithIcon_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != LabelWithIcon_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
102451
|
-
function
|
|
102452
|
-
function
|
|
105512
|
+
function LabelWithIcon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = LabelWithIcon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
105513
|
+
function LabelWithIcon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
102453
105514
|
|
|
102454
105515
|
|
|
102455
105516
|
|
|
@@ -102488,7 +105549,7 @@ function LabelWithIcon(_ref) {
|
|
|
102488
105549
|
className = _ref.className,
|
|
102489
105550
|
tooltip = _ref.tooltip,
|
|
102490
105551
|
ariaLabel = _ref["aria-label"],
|
|
102491
|
-
rest =
|
|
105552
|
+
rest = LabelWithIcon_objectWithoutProperties(_ref, LabelWithIcon_excluded);
|
|
102492
105553
|
var isInteractive = Tag === "a" || !!onClick;
|
|
102493
105554
|
var rootProps = LabelWithIcon_objectSpread(LabelWithIcon_objectSpread({
|
|
102494
105555
|
as: Tag,
|
|
@@ -102546,105 +105607,6 @@ LabelWithIcon.defaultProps = {
|
|
|
102546
105607
|
"aria-label": undefined,
|
|
102547
105608
|
tooltip: undefined
|
|
102548
105609
|
};
|
|
102549
|
-
;// ./src/utils/locale.js
|
|
102550
|
-
/**
|
|
102551
|
-
* Extracts the locale code from the provided URL or the current URL.
|
|
102552
|
-
*
|
|
102553
|
-
* @param options - An object with the following properties:
|
|
102554
|
-
* @param options.url - The URL to extract the locale code from. If not provided, the current URL will be used.
|
|
102555
|
-
* @param options.defaultLocale - The default locale code to use if the locale cannot be extracted from the URL.
|
|
102556
|
-
* @returns The locale code in the format "language_COUNTRY".
|
|
102557
|
-
*/
|
|
102558
|
-
function getLocaleCodeFromUrl(options) {
|
|
102559
|
-
var _localeAsArr$;
|
|
102560
|
-
var _ref = options !== null && options !== void 0 ? options : {},
|
|
102561
|
-
_ref$url = _ref.url,
|
|
102562
|
-
url = _ref$url === void 0 ? "" : _ref$url,
|
|
102563
|
-
_ref$defaultLocale = _ref.defaultLocale,
|
|
102564
|
-
defaultLocale = _ref$defaultLocale === void 0 ? "" : _ref$defaultLocale;
|
|
102565
|
-
var localeAsArr = [];
|
|
102566
|
-
var tempUrl = url || typeof location != "undefined" && location.href;
|
|
102567
|
-
if (tempUrl) {
|
|
102568
|
-
var _tempUrl, _tempUrl2;
|
|
102569
|
-
/* adding dummy domain since express originalUrl will not have request domain */
|
|
102570
|
-
if (!((_tempUrl = tempUrl) !== null && _tempUrl !== void 0 && _tempUrl.includes("https://")) && !((_tempUrl2 = tempUrl) !== null && _tempUrl2 !== void 0 && _tempUrl2.includes("http://"))) {
|
|
102571
|
-
tempUrl = "https://domain.com".concat(tempUrl);
|
|
102572
|
-
}
|
|
102573
|
-
var updatedUrl = new URL(tempUrl);
|
|
102574
|
-
var pathParams = updatedUrl.pathname;
|
|
102575
|
-
if (pathParams) {
|
|
102576
|
-
var _pathParams$split;
|
|
102577
|
-
var pathList = pathParams === null || pathParams === void 0 || (_pathParams$split = pathParams.split("/")) === null || _pathParams$split === void 0 ? void 0 : _pathParams$split.filter(Boolean);
|
|
102578
|
-
if (pathList.length > 1) {
|
|
102579
|
-
localeAsArr = pathList;
|
|
102580
|
-
}
|
|
102581
|
-
}
|
|
102582
|
-
if (localeAsArr.length > 2) {
|
|
102583
|
-
localeAsArr = localeAsArr.slice(0, 2);
|
|
102584
|
-
}
|
|
102585
|
-
}
|
|
102586
|
-
localeAsArr = localeAsArr.reverse();
|
|
102587
|
-
if (localeAsArr.length === 0) {
|
|
102588
|
-
localeAsArr = defaultLocale.split("_");
|
|
102589
|
-
}
|
|
102590
|
-
return "".concat((_localeAsArr$ = localeAsArr[1]) === null || _localeAsArr$ === void 0 ? void 0 : _localeAsArr$.toUpperCase(), "-").concat(localeAsArr[0]);
|
|
102591
|
-
}
|
|
102592
|
-
function getLocale() {
|
|
102593
|
-
var _splitLocale$, _splitLocale$2;
|
|
102594
|
-
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
102595
|
-
url = _ref2.url;
|
|
102596
|
-
var currentLocale = getLocaleCodeFromUrl(url ? {
|
|
102597
|
-
url: url
|
|
102598
|
-
} : null);
|
|
102599
|
-
var splitLocale = currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.split("-");
|
|
102600
|
-
return {
|
|
102601
|
-
locale: currentLocale,
|
|
102602
|
-
language: splitLocale === null || splitLocale === void 0 || (_splitLocale$ = splitLocale[1]) === null || _splitLocale$ === void 0 ? void 0 : _splitLocale$.toLowerCase(),
|
|
102603
|
-
country: splitLocale === null || splitLocale === void 0 || (_splitLocale$2 = splitLocale[0]) === null || _splitLocale$2 === void 0 ? void 0 : _splitLocale$2.toUpperCase()
|
|
102604
|
-
};
|
|
102605
|
-
}
|
|
102606
|
-
function locale_isBrowser() {
|
|
102607
|
-
return typeof window !== "undefined" && window != null;
|
|
102608
|
-
}
|
|
102609
|
-
|
|
102610
|
-
/** Normalized `country`, `language`, and `locale` string from explicit market + language. */
|
|
102611
|
-
function buildLocaleData(market, language) {
|
|
102612
|
-
var country = String(market).trim().toUpperCase();
|
|
102613
|
-
var lang = String(language).trim().toLowerCase();
|
|
102614
|
-
if (!country || !lang) {
|
|
102615
|
-
throw new Error("@nuskin/nextgen-header: `market` and `language` must be non-empty when provided.");
|
|
102616
|
-
}
|
|
102617
|
-
return {
|
|
102618
|
-
country: country,
|
|
102619
|
-
language: lang,
|
|
102620
|
-
locale: "".concat(country, "-").concat(lang)
|
|
102621
|
-
};
|
|
102622
|
-
}
|
|
102623
|
-
|
|
102624
|
-
/**
|
|
102625
|
-
* Resolves locale data (`country`, `language`, `locale`) for the header shell.
|
|
102626
|
-
*
|
|
102627
|
-
* - **SSR (no `window`):** `market` and `language` are required (e.g. from the host or from `requestUrl` in `renderAndExtractContext`).
|
|
102628
|
-
* - **CSR:** `market` and `language` optional; if omitted, derived from the current URL via the same rules as `getLocale()`. Throws if `window` is missing or the path cannot be parsed.
|
|
102629
|
-
*/
|
|
102630
|
-
function resolveHeaderLocale() {
|
|
102631
|
-
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
102632
|
-
market = _ref3.market,
|
|
102633
|
-
language = _ref3.language;
|
|
102634
|
-
var explicit = market != null && language != null && String(market).trim() !== "" && String(language).trim() !== "";
|
|
102635
|
-
if (explicit) {
|
|
102636
|
-
return buildLocaleData(market, language);
|
|
102637
|
-
}
|
|
102638
|
-
if (!locale_isBrowser()) {
|
|
102639
|
-
return buildLocaleData("US", "en");
|
|
102640
|
-
}
|
|
102641
|
-
var fromUrl = getLocale();
|
|
102642
|
-
if (!fromUrl.country || !fromUrl.language || !fromUrl.locale || String(fromUrl.locale).includes("undefined")) {
|
|
102643
|
-
throw new Error("@nuskin/nextgen-header: could not derive `market` and `language` from the current URL (expected a path with at least two segments, e.g. /en/us/...). Pass `market` and `language` explicitly.");
|
|
102644
|
-
}
|
|
102645
|
-
return fromUrl;
|
|
102646
|
-
}
|
|
102647
|
-
|
|
102648
105610
|
;// ./src/components/country-list-selector/CountryListSelector.constants.js
|
|
102649
105611
|
var COUNTRY_LIST_SELECTOR_BASE_URL = "";
|
|
102650
105612
|
;// ./src/components/country-list-selector/CountryListSelector.helpers.js
|
|
@@ -103830,6 +106792,7 @@ var RememberCheckbox = /*#__PURE__*/createStyled("input", true ? {
|
|
|
103830
106792
|
// EXTERNAL MODULE: ./node_modules/@nuskin/configuration-sdk/src/index.js
|
|
103831
106793
|
var src = __webpack_require__(4734);
|
|
103832
106794
|
;// ./src/services/HeaderMarketSelectorService.js
|
|
106795
|
+
function HeaderMarketSelectorService_typeof(o) { "@babel/helpers - typeof"; return HeaderMarketSelectorService_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, HeaderMarketSelectorService_typeof(o); }
|
|
103833
106796
|
function HeaderMarketSelectorService_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
103834
106797
|
function HeaderMarketSelectorService_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? HeaderMarketSelectorService_ownKeys(Object(t), !0).forEach(function (r) { HeaderMarketSelectorService_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : HeaderMarketSelectorService_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
103835
106798
|
function HeaderMarketSelectorService_defineProperty(e, r, t) { return (r = HeaderMarketSelectorService_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -103837,7 +106800,6 @@ function HeaderMarketSelectorService_toPropertyKey(t) { var i = HeaderMarketSele
|
|
|
103837
106800
|
function HeaderMarketSelectorService_toPrimitive(t, r) { if ("object" != HeaderMarketSelectorService_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != HeaderMarketSelectorService_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
103838
106801
|
function HeaderMarketSelectorService_regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return HeaderMarketSelectorService_regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (HeaderMarketSelectorService_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, HeaderMarketSelectorService_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, HeaderMarketSelectorService_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), HeaderMarketSelectorService_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", HeaderMarketSelectorService_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), HeaderMarketSelectorService_regeneratorDefine2(u), HeaderMarketSelectorService_regeneratorDefine2(u, o, "Generator"), HeaderMarketSelectorService_regeneratorDefine2(u, n, function () { return this; }), HeaderMarketSelectorService_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (HeaderMarketSelectorService_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
103839
106802
|
function HeaderMarketSelectorService_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } HeaderMarketSelectorService_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { HeaderMarketSelectorService_regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, HeaderMarketSelectorService_regeneratorDefine2(e, r, n, t); }
|
|
103840
|
-
function HeaderMarketSelectorService_typeof(o) { "@babel/helpers - typeof"; return HeaderMarketSelectorService_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, HeaderMarketSelectorService_typeof(o); }
|
|
103841
106803
|
function HeaderMarketSelectorService_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
103842
106804
|
function HeaderMarketSelectorService_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { HeaderMarketSelectorService_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { HeaderMarketSelectorService_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
103843
106805
|
|
|
@@ -103902,35 +106864,16 @@ function ensureTrailingSlash(url) {
|
|
|
103902
106864
|
if (!raw) return "";
|
|
103903
106865
|
return raw.endsWith("/") ? raw : "".concat(raw, "/");
|
|
103904
106866
|
}
|
|
103905
|
-
function shouldLogConfigDebug(browserWindow) {
|
|
103906
|
-
var _browserWindow$locati;
|
|
103907
|
-
return Boolean(browserWindow === null || browserWindow === void 0 || (_browserWindow$locati = browserWindow.location) === null || _browserWindow$locati === void 0 || (_browserWindow$locati = _browserWindow$locati.search) === null || _browserWindow$locati === void 0 ? void 0 : _browserWindow$locati.includes("debugMarketSelector=true"));
|
|
103908
|
-
}
|
|
103909
|
-
function logConfigFetchRequest(_ref3) {
|
|
103910
|
-
var configMapName = _ref3.configMapName,
|
|
103911
|
-
countryCodeUpper = _ref3.countryCodeUpper,
|
|
103912
|
-
environment = _ref3.environment,
|
|
103913
|
-
clientId = _ref3.clientId,
|
|
103914
|
-
shoppingContext = _ref3.shoppingContext;
|
|
103915
|
-
// eslint-disable-next-line no-console
|
|
103916
|
-
console.log("[HeaderMarketSelectorService] calling getConfiguration", {
|
|
103917
|
-
configMapName: configMapName,
|
|
103918
|
-
country: countryCodeUpper || "US",
|
|
103919
|
-
environment: environment,
|
|
103920
|
-
clientId: clientId,
|
|
103921
|
-
shoppingContext: shoppingContext !== null && shoppingContext !== void 0 ? shoppingContext : null
|
|
103922
|
-
});
|
|
103923
|
-
}
|
|
103924
106867
|
function fetchMarketConfig(_x) {
|
|
103925
106868
|
return _fetchMarketConfig.apply(this, arguments);
|
|
103926
106869
|
}
|
|
103927
106870
|
function _fetchMarketConfig() {
|
|
103928
|
-
_fetchMarketConfig = HeaderMarketSelectorService_asyncToGenerator(/*#__PURE__*/HeaderMarketSelectorService_regenerator().m(function _callee2(
|
|
106871
|
+
_fetchMarketConfig = HeaderMarketSelectorService_asyncToGenerator(/*#__PURE__*/HeaderMarketSelectorService_regenerator().m(function _callee2(_ref3) {
|
|
103929
106872
|
var configMapName, countryCodeUpper, environment, clientId, shoppingContext, config;
|
|
103930
106873
|
return HeaderMarketSelectorService_regenerator().w(function (_context2) {
|
|
103931
106874
|
while (1) switch (_context2.n) {
|
|
103932
106875
|
case 0:
|
|
103933
|
-
configMapName =
|
|
106876
|
+
configMapName = _ref3.configMapName, countryCodeUpper = _ref3.countryCodeUpper, environment = _ref3.environment, clientId = _ref3.clientId, shoppingContext = _ref3.shoppingContext;
|
|
103934
106877
|
_context2.n = 1;
|
|
103935
106878
|
return (0,src.getConfiguration)([configMapName], HeaderMarketSelectorService_objectSpread({
|
|
103936
106879
|
country: countryCodeUpper || "US",
|
|
@@ -103947,18 +106890,18 @@ function _fetchMarketConfig() {
|
|
|
103947
106890
|
}));
|
|
103948
106891
|
return _fetchMarketConfig.apply(this, arguments);
|
|
103949
106892
|
}
|
|
103950
|
-
function resolveTemplate(
|
|
103951
|
-
var shouldUseEqHomeUrl =
|
|
103952
|
-
eqTemplate =
|
|
103953
|
-
homeTemplate =
|
|
106893
|
+
function resolveTemplate(_ref4) {
|
|
106894
|
+
var shouldUseEqHomeUrl = _ref4.shouldUseEqHomeUrl,
|
|
106895
|
+
eqTemplate = _ref4.eqTemplate,
|
|
106896
|
+
homeTemplate = _ref4.homeTemplate;
|
|
103954
106897
|
return shouldUseEqHomeUrl && eqTemplate ? eqTemplate : homeTemplate || "/";
|
|
103955
106898
|
}
|
|
103956
106899
|
function createHeaderMarketSelectorService() {
|
|
103957
|
-
var
|
|
103958
|
-
|
|
103959
|
-
clientId =
|
|
103960
|
-
|
|
103961
|
-
configMapName =
|
|
106900
|
+
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
106901
|
+
_ref5$clientId = _ref5.clientId,
|
|
106902
|
+
clientId = _ref5$clientId === void 0 ? "63056848d7532f9923f3d08cb48c423b" : _ref5$clientId,
|
|
106903
|
+
_ref5$configMapName = _ref5.configMapName,
|
|
106904
|
+
configMapName = _ref5$configMapName === void 0 ? EQUINOX_MARKETS_MAP : _ref5$configMapName;
|
|
103962
106905
|
return {
|
|
103963
106906
|
/**
|
|
103964
106907
|
* Resolves the redirect URL after selecting a country + language.
|
|
@@ -103967,15 +106910,15 @@ function createHeaderMarketSelectorService() {
|
|
|
103967
106910
|
resolveRedirectUrl: function resolveRedirectUrl() {
|
|
103968
106911
|
var _arguments = arguments;
|
|
103969
106912
|
return HeaderMarketSelectorService_asyncToGenerator(/*#__PURE__*/HeaderMarketSelectorService_regenerator().m(function _callee() {
|
|
103970
|
-
var _browserWindow$
|
|
103971
|
-
var
|
|
106913
|
+
var _browserWindow$locati, _browserWindow$locati2;
|
|
106914
|
+
var _ref6, country, locale, pageLocale, shoppingContext, browserWindow, origin, hostname, environment, _extractCountryAndLan, countryCodeLower, countryCodeUpper, languageCodeLower, shouldUseEqHomeUrl, sdkBaseUrl, map, eqTemplate, homeTemplate, chosenTemplate, tokenResolved, resolvedPath, finalBase;
|
|
103972
106915
|
return HeaderMarketSelectorService_regenerator().w(function (_context) {
|
|
103973
|
-
while (1) switch (_context.
|
|
106916
|
+
while (1) switch (_context.n) {
|
|
103974
106917
|
case 0:
|
|
103975
|
-
|
|
106918
|
+
_ref6 = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {}, country = _ref6.country, locale = _ref6.locale, pageLocale = _ref6.pageLocale, shoppingContext = _ref6.shoppingContext;
|
|
103976
106919
|
browserWindow = globalThis.window;
|
|
103977
|
-
origin = (browserWindow === null || browserWindow === void 0 || (_browserWindow$
|
|
103978
|
-
hostname = (browserWindow === null || browserWindow === void 0 || (_browserWindow$
|
|
106920
|
+
origin = (browserWindow === null || browserWindow === void 0 || (_browserWindow$locati = browserWindow.location) === null || _browserWindow$locati === void 0 ? void 0 : _browserWindow$locati.origin) || "";
|
|
106921
|
+
hostname = (browserWindow === null || browserWindow === void 0 || (_browserWindow$locati2 = browserWindow.location) === null || _browserWindow$locati2 === void 0 ? void 0 : _browserWindow$locati2.hostname) || "";
|
|
103979
106922
|
environment = resolveEnvironmentFromHostname(hostname);
|
|
103980
106923
|
_extractCountryAndLan = extractCountryAndLanguageFromSelection({
|
|
103981
106924
|
country: country,
|
|
@@ -103984,15 +106927,7 @@ function createHeaderMarketSelectorService() {
|
|
|
103984
106927
|
}), countryCodeLower = _extractCountryAndLan.countryCodeLower, countryCodeUpper = _extractCountryAndLan.countryCodeUpper, languageCodeLower = _extractCountryAndLan.languageCodeLower; // Decide which template to use (eq_home_url vs home_url).
|
|
103985
106928
|
shouldUseEqHomeUrl = false;
|
|
103986
106929
|
sdkBaseUrl = "";
|
|
103987
|
-
_context.
|
|
103988
|
-
logConfigFetchRequest({
|
|
103989
|
-
configMapName: configMapName,
|
|
103990
|
-
countryCodeUpper: countryCodeUpper,
|
|
103991
|
-
environment: environment,
|
|
103992
|
-
clientId: clientId,
|
|
103993
|
-
shoppingContext: shoppingContext
|
|
103994
|
-
});
|
|
103995
|
-
_context.n = 2;
|
|
106930
|
+
_context.n = 1;
|
|
103996
106931
|
return fetchMarketConfig({
|
|
103997
106932
|
configMapName: configMapName,
|
|
103998
106933
|
countryCodeUpper: countryCodeUpper,
|
|
@@ -104000,39 +106935,11 @@ function createHeaderMarketSelectorService() {
|
|
|
104000
106935
|
clientId: clientId,
|
|
104001
106936
|
shoppingContext: shoppingContext
|
|
104002
106937
|
});
|
|
104003
|
-
case
|
|
106938
|
+
case 1:
|
|
104004
106939
|
map = _context.v;
|
|
104005
106940
|
// Use config map active field directly from SDK response.
|
|
104006
106941
|
shouldUseEqHomeUrl = Boolean(map === null || map === void 0 ? void 0 : map.active);
|
|
104007
106942
|
sdkBaseUrl = ensureTrailingSlash(map === null || map === void 0 ? void 0 : map["Webview_Base_URL"]);
|
|
104008
|
-
if (shouldLogConfigDebug(browserWindow)) {
|
|
104009
|
-
// Debug: confirm config map shape + decision field
|
|
104010
|
-
// eslint-disable-next-line no-console
|
|
104011
|
-
console.log("[HeaderMarketSelectorService] config map response", {
|
|
104012
|
-
configMapName: configMapName,
|
|
104013
|
-
country: countryCodeUpper || "US",
|
|
104014
|
-
environment: environment,
|
|
104015
|
-
activeRaw: map === null || map === void 0 ? void 0 : map.active,
|
|
104016
|
-
useEqHomeUrl: shouldUseEqHomeUrl,
|
|
104017
|
-
sdkBaseUrl: sdkBaseUrl,
|
|
104018
|
-
keys: map && HeaderMarketSelectorService_typeof(map) === "object" ? Object.keys(map) : [],
|
|
104019
|
-
sample: map
|
|
104020
|
-
});
|
|
104021
|
-
}
|
|
104022
|
-
_context.n = 4;
|
|
104023
|
-
break;
|
|
104024
|
-
case 3:
|
|
104025
|
-
_context.p = 3;
|
|
104026
|
-
_t = _context.v;
|
|
104027
|
-
// If config fetch fails, `shouldUseEqHomeUrl` stays false => prefer `home_url` when present.
|
|
104028
|
-
// eslint-disable-next-line no-console
|
|
104029
|
-
console.warn("[HeaderMarketSelectorService] getConfiguration failed", {
|
|
104030
|
-
configMapName: configMapName,
|
|
104031
|
-
country: countryCodeUpper || "US",
|
|
104032
|
-
environment: environment,
|
|
104033
|
-
error: (_error$message = _t === null || _t === void 0 ? void 0 : _t.message) !== null && _error$message !== void 0 ? _error$message : String(_t)
|
|
104034
|
-
});
|
|
104035
|
-
case 4:
|
|
104036
106943
|
eqTemplate = HeaderMarketSelectorService_firstNonEmptyString(country === null || country === void 0 ? void 0 : country.eq_home_url);
|
|
104037
106944
|
homeTemplate = HeaderMarketSelectorService_firstNonEmptyString(country === null || country === void 0 ? void 0 : country.home_url);
|
|
104038
106945
|
chosenTemplate = resolveTemplate({
|
|
@@ -104046,16 +106953,16 @@ function createHeaderMarketSelectorService() {
|
|
|
104046
106953
|
languageCodeLower: languageCodeLower
|
|
104047
106954
|
}); // If the template is already an absolute URL, do not prefix base/origin.
|
|
104048
106955
|
if (!HeaderMarketSelectorService_isAbsoluteUrl(tokenResolved)) {
|
|
104049
|
-
_context.n =
|
|
106956
|
+
_context.n = 2;
|
|
104050
106957
|
break;
|
|
104051
106958
|
}
|
|
104052
106959
|
return _context.a(2, tokenResolved);
|
|
104053
|
-
case
|
|
106960
|
+
case 2:
|
|
104054
106961
|
resolvedPath = HeaderMarketSelectorService_ensureLeadingSlash(tokenResolved); // Use base URL from SDK map when available; fallback to current origin.
|
|
104055
106962
|
finalBase = sdkBaseUrl || origin;
|
|
104056
106963
|
return _context.a(2, finalBase ? "".concat(finalBase.replace(/\/$/, "")).concat(resolvedPath) : resolvedPath);
|
|
104057
106964
|
}
|
|
104058
|
-
}, _callee
|
|
106965
|
+
}, _callee);
|
|
104059
106966
|
}))();
|
|
104060
106967
|
}
|
|
104061
106968
|
};
|
|
@@ -105137,10 +108044,6 @@ var DEFAULT_ACCOUNT = {
|
|
|
105137
108044
|
sign_in_label: "Sign In",
|
|
105138
108045
|
sign_up_label: "Sign Up"
|
|
105139
108046
|
};
|
|
105140
|
-
var DEFAULT_SEARCH = {
|
|
105141
|
-
placeholder: "Product Search",
|
|
105142
|
-
input_aria_label: "Product search"
|
|
105143
|
-
};
|
|
105144
108047
|
var DEFAULT_CART = {
|
|
105145
108048
|
show_cart_icon: false,
|
|
105146
108049
|
show_cart_count: false,
|
|
@@ -105198,11 +108101,12 @@ var DEFAULT_TOP_RIBBON_LINKS = [{
|
|
|
105198
108101
|
ariaLabel: "Shop Gifts"
|
|
105199
108102
|
}];
|
|
105200
108103
|
function HeaderView(_ref) {
|
|
105201
|
-
var _headerEntry$logo, _headerEntry$locale_s, _headerEntry$utility_, _headerEntry$utility_2, _headerEntry$account, _headerEntry$
|
|
108104
|
+
var _headerEntry$logo, _headerEntry$locale_s, _headerEntry$utility_, _headerEntry$utility_2, _headerEntry$account, _headerEntry$cart, _headerEntry$top_ribb, _headerEntry$navigati, _headerEntry$market_s, _headerEntry$$, _ref2, _headerEntry$locale, _headerEntry$$2, _headerEntry$$3;
|
|
105202
108105
|
var country = _ref.country,
|
|
105203
108106
|
language = _ref.language,
|
|
105204
108107
|
locale = _ref.locale,
|
|
105205
|
-
headerEntry = _ref.headerEntry
|
|
108108
|
+
headerEntry = _ref.headerEntry,
|
|
108109
|
+
searchConfig = _ref.searchConfig;
|
|
105206
108110
|
var _useState = (0,external_react_.useState)(false),
|
|
105207
108111
|
_useState2 = HeaderView_slicedToArray(_useState, 2),
|
|
105208
108112
|
isMobileMenuOpen = _useState2[0],
|
|
@@ -105214,12 +108118,10 @@ function HeaderView(_ref) {
|
|
|
105214
108118
|
return link === null || link === void 0 ? void 0 : link.loyalty_menu;
|
|
105215
108119
|
})) === null || _headerEntry$utility_2 === void 0 || (_headerEntry$utility_2 = _headerEntry$utility_2.loyalty_menu) === null || _headerEntry$utility_2 === void 0 ? void 0 : _headerEntry$utility_2[0]) !== null && _headerEntry$utility_ !== void 0 ? _headerEntry$utility_ : DEFAULT_LOYALTY;
|
|
105216
108120
|
var accountData = (_headerEntry$account = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.account) !== null && _headerEntry$account !== void 0 ? _headerEntry$account : DEFAULT_ACCOUNT;
|
|
105217
|
-
var searchData = (_headerEntry$search = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.search) !== null && _headerEntry$search !== void 0 ? _headerEntry$search : DEFAULT_SEARCH;
|
|
105218
108121
|
var cartData = (_headerEntry$cart = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.cart) !== null && _headerEntry$cart !== void 0 ? _headerEntry$cart : DEFAULT_CART;
|
|
105219
108122
|
var topRibbonLinks = (_headerEntry$top_ribb = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.top_ribbon_links) !== null && _headerEntry$top_ribb !== void 0 ? _headerEntry$top_ribb : DEFAULT_TOP_RIBBON_LINKS;
|
|
105220
108123
|
var navigationData = (_headerEntry$navigati = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.navigation) !== null && _headerEntry$navigati !== void 0 ? _headerEntry$navigati : DEFAULT_NAVIGATION;
|
|
105221
108124
|
var marketSelector = (_headerEntry$market_s = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.market_selector) !== null && _headerEntry$market_s !== void 0 ? _headerEntry$market_s : DEFAULT_MARKET_SELECTOR;
|
|
105222
|
-
console.log("HeaderView render", headerEntry); // Debug log to trace re-renders and data
|
|
105223
108125
|
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(HeaderRoot, {
|
|
105224
108126
|
"data-testid": "header-view",
|
|
105225
108127
|
"data-country": country,
|
|
@@ -105237,21 +108139,18 @@ function HeaderView(_ref) {
|
|
|
105237
108139
|
"aria-label": "Open menu",
|
|
105238
108140
|
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(IconMenu, {})
|
|
105239
108141
|
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(LogoSlot, {
|
|
105240
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(
|
|
105241
|
-
|
|
105242
|
-
logoAlt: logoData.logoAlt,
|
|
105243
|
-
href: logoData.href,
|
|
105244
|
-
showLogo: logoData.showLogo,
|
|
105245
|
-
size: logoData.size,
|
|
105246
|
-
$: logoData.$
|
|
108142
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderLogoRegion, {
|
|
108143
|
+
data: logoData
|
|
105247
108144
|
})
|
|
105248
108145
|
}), /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileUtilityBar, {
|
|
105249
108146
|
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderAccountRegion, {
|
|
105250
108147
|
data: accountData
|
|
105251
|
-
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(
|
|
105252
|
-
|
|
105253
|
-
|
|
105254
|
-
|
|
108148
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderSearchRegion, {
|
|
108149
|
+
country: country,
|
|
108150
|
+
language: language,
|
|
108151
|
+
locale: locale,
|
|
108152
|
+
searchConfig: searchConfig,
|
|
108153
|
+
showDesktopTrigger: false
|
|
105255
108154
|
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderCartRegion, {
|
|
105256
108155
|
data: cartData,
|
|
105257
108156
|
parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$ = headerEntry.$) === null || _headerEntry$$ === void 0 ? void 0 : _headerEntry$$.cart
|
|
@@ -105277,7 +108176,11 @@ function HeaderView(_ref) {
|
|
|
105277
108176
|
})]
|
|
105278
108177
|
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(SearchSlot, {
|
|
105279
108178
|
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderSearchRegion, {
|
|
105280
|
-
|
|
108179
|
+
country: country,
|
|
108180
|
+
language: language,
|
|
108181
|
+
locale: locale,
|
|
108182
|
+
searchConfig: searchConfig,
|
|
108183
|
+
showMobileTrigger: false
|
|
105281
108184
|
})
|
|
105282
108185
|
})]
|
|
105283
108186
|
})]
|
|
@@ -105302,7 +108205,8 @@ HeaderView.propTypes = {
|
|
|
105302
108205
|
country: (external_prop_types_default()).string.isRequired,
|
|
105303
108206
|
language: (external_prop_types_default()).string.isRequired,
|
|
105304
108207
|
locale: (external_prop_types_default()).string.isRequired,
|
|
105305
|
-
headerEntry: (external_prop_types_default()).object
|
|
108208
|
+
headerEntry: (external_prop_types_default()).object,
|
|
108209
|
+
searchConfig: (external_prop_types_default()).object
|
|
105306
108210
|
};
|
|
105307
108211
|
;// ./src/styles/Main.styled.js
|
|
105308
108212
|
|
|
@@ -105313,6 +108217,151 @@ var AppContainer = /*#__PURE__*/createStyled("div", true ? {
|
|
|
105313
108217
|
name: "1xncdb6",
|
|
105314
108218
|
styles: "font-family:\"Inter\",sans-serif"
|
|
105315
108219
|
} : 0);
|
|
108220
|
+
;// ./src/utils/mapProductSearchEntry.js
|
|
108221
|
+
function mapProductSearchEntry_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = mapProductSearchEntry_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
108222
|
+
function mapProductSearchEntry_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return mapProductSearchEntry_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? mapProductSearchEntry_arrayLikeToArray(r, a) : void 0; } }
|
|
108223
|
+
function mapProductSearchEntry_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
108224
|
+
function mapProductSearchEntry_typeof(o) { "@babel/helpers - typeof"; return mapProductSearchEntry_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, mapProductSearchEntry_typeof(o); }
|
|
108225
|
+
|
|
108226
|
+
|
|
108227
|
+
function asArray(value) {
|
|
108228
|
+
if (Array.isArray(value)) return value;
|
|
108229
|
+
return value == null ? [] : [value];
|
|
108230
|
+
}
|
|
108231
|
+
function firstResolvedEntry(productSearchModel) {
|
|
108232
|
+
return asArray(productSearchModel).find(function (entry) {
|
|
108233
|
+
return entry && mapProductSearchEntry_typeof(entry) === "object";
|
|
108234
|
+
});
|
|
108235
|
+
}
|
|
108236
|
+
function getGroup(entry) {
|
|
108237
|
+
for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
108238
|
+
keys[_key - 1] = arguments[_key];
|
|
108239
|
+
}
|
|
108240
|
+
return keys.map(function (key) {
|
|
108241
|
+
return entry === null || entry === void 0 ? void 0 : entry[key];
|
|
108242
|
+
}).find(function (value) {
|
|
108243
|
+
return value && mapProductSearchEntry_typeof(value) === "object";
|
|
108244
|
+
});
|
|
108245
|
+
}
|
|
108246
|
+
function getFirstValue(source, keys, fallback) {
|
|
108247
|
+
if (!source || mapProductSearchEntry_typeof(source) !== "object") {
|
|
108248
|
+
return fallback;
|
|
108249
|
+
}
|
|
108250
|
+
var _iterator = mapProductSearchEntry_createForOfIteratorHelper(keys),
|
|
108251
|
+
_step;
|
|
108252
|
+
try {
|
|
108253
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
108254
|
+
var key = _step.value;
|
|
108255
|
+
var value = source[key];
|
|
108256
|
+
if (value !== undefined && value !== null && value !== "") {
|
|
108257
|
+
return value;
|
|
108258
|
+
}
|
|
108259
|
+
}
|
|
108260
|
+
} catch (err) {
|
|
108261
|
+
_iterator.e(err);
|
|
108262
|
+
} finally {
|
|
108263
|
+
_iterator.f();
|
|
108264
|
+
}
|
|
108265
|
+
return fallback;
|
|
108266
|
+
}
|
|
108267
|
+
function getEditableProps(source, keys) {
|
|
108268
|
+
if (!source || mapProductSearchEntry_typeof(source) !== "object" || !source.$) {
|
|
108269
|
+
return undefined;
|
|
108270
|
+
}
|
|
108271
|
+
var _iterator2 = mapProductSearchEntry_createForOfIteratorHelper(keys),
|
|
108272
|
+
_step2;
|
|
108273
|
+
try {
|
|
108274
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
108275
|
+
var _source$$;
|
|
108276
|
+
var key = _step2.value;
|
|
108277
|
+
var tag = (_source$$ = source.$) === null || _source$$ === void 0 ? void 0 : _source$$[key];
|
|
108278
|
+
if (tag && mapProductSearchEntry_typeof(tag) === "object") {
|
|
108279
|
+
return tag;
|
|
108280
|
+
}
|
|
108281
|
+
if (typeof tag === "string" && tag.trim()) {
|
|
108282
|
+
return {
|
|
108283
|
+
"data-cslp": tag
|
|
108284
|
+
};
|
|
108285
|
+
}
|
|
108286
|
+
}
|
|
108287
|
+
} catch (err) {
|
|
108288
|
+
_iterator2.e(err);
|
|
108289
|
+
} finally {
|
|
108290
|
+
_iterator2.f();
|
|
108291
|
+
}
|
|
108292
|
+
return undefined;
|
|
108293
|
+
}
|
|
108294
|
+
function buildEditableTag(entry, path) {
|
|
108295
|
+
var _entry$uid, _entry$locale;
|
|
108296
|
+
var uid = String((_entry$uid = entry === null || entry === void 0 ? void 0 : entry.uid) !== null && _entry$uid !== void 0 ? _entry$uid : "").trim();
|
|
108297
|
+
var locale = String((_entry$locale = entry === null || entry === void 0 ? void 0 : entry.locale) !== null && _entry$locale !== void 0 ? _entry$locale : "").trim();
|
|
108298
|
+
if (!uid || !locale || !path) return undefined;
|
|
108299
|
+
return {
|
|
108300
|
+
"data-cslp": "product_search_model.".concat(uid, ".").concat(locale, ".").concat(path)
|
|
108301
|
+
};
|
|
108302
|
+
}
|
|
108303
|
+
function getBooleanValue(source, keys) {
|
|
108304
|
+
var fallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
108305
|
+
var value = getFirstValue(source, keys, fallback);
|
|
108306
|
+
return typeof value === "boolean" ? value : Boolean(value);
|
|
108307
|
+
}
|
|
108308
|
+
function mapProductSearchEntry(productSearchModel) {
|
|
108309
|
+
var entry = firstResolvedEntry(productSearchModel);
|
|
108310
|
+
if (!entry) {
|
|
108311
|
+
return null;
|
|
108312
|
+
}
|
|
108313
|
+
var searchBarGroup = getGroup(entry, "search_bar", "searchBar");
|
|
108314
|
+
var searchModalGroup = getGroup(entry, "search_modal", "searchModal");
|
|
108315
|
+
var logoGroup = getGroup(searchModalGroup, "logo", "modal_logo", "modalLogo");
|
|
108316
|
+
var brandData = parseLogoData(logoGroup);
|
|
108317
|
+
var cancelGroup = getGroup(searchModalGroup, "cancel", "cancel_button", "cancelButton");
|
|
108318
|
+
var searchAutoCompleteGroup = getGroup(searchModalGroup, "search_and_auto_complete", "search_and_autocomplete", "searchAndAutoComplete", "searchAndAutocomplete");
|
|
108319
|
+
var recentSearchesGroup = getGroup(searchModalGroup, "recent_searches", "recentSearches");
|
|
108320
|
+
var triggerPlaceholder = getFirstValue(searchBarGroup, ["search_bar_placeholder", "search_bar", "searchBarPlaceholder", "title"], TRIGGER_PLACEHOLDER);
|
|
108321
|
+
var searchPlaceholder = getFirstValue(searchAutoCompleteGroup, ["autocomplete_textbox_placeholder", "auto_complete_textbox", "autoCompleteTextbox", "search_placeholder", "searchPlaceholder"], SEARCH_PLACEHOLDER);
|
|
108322
|
+
return {
|
|
108323
|
+
triggerPlaceholder: triggerPlaceholder,
|
|
108324
|
+
searchPlaceholder: searchPlaceholder,
|
|
108325
|
+
modalTitle: getFirstValue(entry, ["title", "modal_title", "modalTitle"], MODAL_TITLE),
|
|
108326
|
+
brandLogo: brandData.logo,
|
|
108327
|
+
brandLogoAlt: brandData.logoAlt,
|
|
108328
|
+
brandHref: brandData.href,
|
|
108329
|
+
showBrandLogo: brandData.showLogo,
|
|
108330
|
+
brandSize: String(brandData.size || "medium").toLowerCase(),
|
|
108331
|
+
cancelLabel: getFirstValue(cancelGroup, ["nav_link_label", "label", "navLinkLabel"], "Cancel"),
|
|
108332
|
+
cancelShowIcon: getBooleanValue(cancelGroup, ["show_icon", "showIcon"], true),
|
|
108333
|
+
autoCompleteEnabled: getBooleanValue(searchAutoCompleteGroup, ["enable_auto_complete", "enable_autocomplete", "enableAutoComplete"], true),
|
|
108334
|
+
recentSearchesEnabled: getBooleanValue(recentSearchesGroup, ["enable_recent_searches", "enableRecentSearches"], true),
|
|
108335
|
+
recentSearchesHeading: getFirstValue(recentSearchesGroup, ["recent_searches", "recentSearches", "heading"], "Recent searches"),
|
|
108336
|
+
clearAllLabel: getFirstValue(recentSearchesGroup, ["clear_all", "clearAll"], "Clear all"),
|
|
108337
|
+
autoCompleteCopy: {
|
|
108338
|
+
placeholder: searchPlaceholder,
|
|
108339
|
+
inputAriaLabel: searchPlaceholder,
|
|
108340
|
+
listboxAriaLabel: "Search suggestions",
|
|
108341
|
+
noSuggestionsText: "No suggestions",
|
|
108342
|
+
seeMoreResultsText: "See More Results",
|
|
108343
|
+
didYouMeanText: "Did You Mean?",
|
|
108344
|
+
formAriaLabel: "Site search"
|
|
108345
|
+
},
|
|
108346
|
+
editableTags: {
|
|
108347
|
+
modalTitle: getEditableProps(entry, ["title", "modal_title", "modalTitle"]) || buildEditableTag(entry, "title"),
|
|
108348
|
+
triggerPlaceholder: getEditableProps(searchBarGroup, ["search_bar_placeholder", "search_bar", "searchBarPlaceholder", "title"]),
|
|
108349
|
+
triggerIcon: getEditableProps(searchBarGroup, ["search_icon", "icon", "searchIcon"]) || buildEditableTag(entry, "search_bar.search_icon"),
|
|
108350
|
+
searchPlaceholder: getEditableProps(searchAutoCompleteGroup, ["autocomplete_textbox_placeholder", "auto_complete_textbox", "autoCompleteTextbox", "search_placeholder", "searchPlaceholder"]) || buildEditableTag(entry, "search_modal.search_and_auto_complete.auto_complete_textbox"),
|
|
108351
|
+
autoCompleteTextbox: getEditableProps(searchAutoCompleteGroup, ["autocomplete_textbox_placeholder", "auto_complete_textbox", "autoCompleteTextbox"]) || buildEditableTag(entry, "search_modal.search_and_auto_complete.auto_complete_textbox"),
|
|
108352
|
+
autoCompleteSearchIcon: getEditableProps(searchAutoCompleteGroup, ["autocomplete_search_icon", "auto_complete_search_icon", "autoCompleteSearchIcon", "search_icon"]) || buildEditableTag(entry, "search_modal.search_and_auto_complete.autocomplete_search_icon"),
|
|
108353
|
+
logoAsset: getEditableProps(logoGroup, ["header_logo__0", "header_logo", "logo", "headerLogo"]),
|
|
108354
|
+
logoUrl: getEditableProps(logoGroup, ["logo_url", "logoUrl"]),
|
|
108355
|
+
showBrandLogo: getEditableProps(logoGroup, ["show_logo", "showLogo"]),
|
|
108356
|
+
brandSize: getEditableProps(logoGroup, ["logo_size", "logoSize"]),
|
|
108357
|
+
cancelLabel: getEditableProps(cancelGroup, ["nav_link_label", "label", "navLinkLabel"]) || buildEditableTag(entry, "search_modal.cancel.nav_link_label"),
|
|
108358
|
+
cancelShowIcon: getEditableProps(cancelGroup, ["show_icon", "showIcon"]) || buildEditableTag(entry, "search_modal.cancel.show_icon"),
|
|
108359
|
+
recentSearchesHeading: getEditableProps(recentSearchesGroup, ["recent_searches", "recentSearches", "heading"]),
|
|
108360
|
+
clearAllLabel: getEditableProps(recentSearchesGroup, ["clear_all", "clearAll"])
|
|
108361
|
+
}
|
|
108362
|
+
};
|
|
108363
|
+
}
|
|
108364
|
+
/* harmony default export */ const utils_mapProductSearchEntry = (mapProductSearchEntry);
|
|
105316
108365
|
;// ./src/components/header/HeaderContainer.jsx
|
|
105317
108366
|
|
|
105318
108367
|
|
|
@@ -105320,6 +108369,7 @@ var AppContainer = /*#__PURE__*/createStyled("div", true ? {
|
|
|
105320
108369
|
|
|
105321
108370
|
|
|
105322
108371
|
|
|
108372
|
+
|
|
105323
108373
|
function HeaderContainer(_ref) {
|
|
105324
108374
|
var market = _ref.market,
|
|
105325
108375
|
language = _ref.language,
|
|
@@ -105328,12 +108378,17 @@ function HeaderContainer(_ref) {
|
|
|
105328
108378
|
market: market,
|
|
105329
108379
|
language: language
|
|
105330
108380
|
});
|
|
108381
|
+
var searchConfig = (0,external_react_.useMemo)(function () {
|
|
108382
|
+
var _headerEntry$product_;
|
|
108383
|
+
return utils_mapProductSearchEntry((_headerEntry$product_ = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.product_search) !== null && _headerEntry$product_ !== void 0 ? _headerEntry$product_ : headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.product_search_model);
|
|
108384
|
+
}, [headerEntry]);
|
|
105331
108385
|
return /*#__PURE__*/(0,jsx_runtime_.jsx)(AppContainer, {
|
|
105332
108386
|
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderView, {
|
|
105333
108387
|
country: resolved.country,
|
|
105334
108388
|
language: resolved.language,
|
|
105335
108389
|
locale: resolved.locale,
|
|
105336
|
-
headerEntry: headerEntry
|
|
108390
|
+
headerEntry: headerEntry,
|
|
108391
|
+
searchConfig: searchConfig
|
|
105337
108392
|
})
|
|
105338
108393
|
});
|
|
105339
108394
|
}
|