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