@nuskin/nextgen-header 1.25.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package-dist/index.js +3613 -558
- package/package-dist/index.js.map +1 -1
- package/package-dist/index.mjs +3611 -558
- package/package-dist/index.mjs.map +1 -1
- package/package.json +1 -5
package/package-dist/index.mjs
CHANGED
|
@@ -1794,6 +1794,26 @@ var _default = exports["default"] = (0, _createSvgIcon.default)( /*#__PURE__*/(0
|
|
|
1794
1794
|
|
|
1795
1795
|
/***/ },
|
|
1796
1796
|
|
|
1797
|
+
/***/ 9781
|
|
1798
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
1799
|
+
|
|
1800
|
+
var __webpack_unused_export__;
|
|
1801
|
+
|
|
1802
|
+
"use client";
|
|
1803
|
+
|
|
1804
|
+
var _interopRequireDefault = __webpack_require__(4994);
|
|
1805
|
+
__webpack_unused_export__ = ({
|
|
1806
|
+
value: true
|
|
1807
|
+
});
|
|
1808
|
+
exports.A = void 0;
|
|
1809
|
+
var _createSvgIcon = _interopRequireDefault(__webpack_require__(2032));
|
|
1810
|
+
var _jsxRuntime = __webpack_require__(1178);
|
|
1811
|
+
var _default = exports.A = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
1812
|
+
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"
|
|
1813
|
+
}), 'Close');
|
|
1814
|
+
|
|
1815
|
+
/***/ },
|
|
1816
|
+
|
|
1797
1817
|
/***/ 5273
|
|
1798
1818
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
1799
1819
|
|
|
@@ -1813,6 +1833,26 @@ var _default = exports["default"] = (0, _createSvgIcon.default)( /*#__PURE__*/(0
|
|
|
1813
1833
|
|
|
1814
1834
|
/***/ },
|
|
1815
1835
|
|
|
1836
|
+
/***/ 4745
|
|
1837
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
1838
|
+
|
|
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__(1178);
|
|
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
|
+
|
|
1816
1856
|
/***/ 2032
|
|
1817
1857
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
1818
1858
|
|
|
@@ -100138,6 +100178,7 @@ var colors = {
|
|
|
100138
100178
|
text: "#111827",
|
|
100139
100179
|
muted: "#6b7280",
|
|
100140
100180
|
navActive: "#111827",
|
|
100181
|
+
hover: "#f3f4f6",
|
|
100141
100182
|
accent: "#0f766e",
|
|
100142
100183
|
accentHover: "#0d9488"
|
|
100143
100184
|
};
|
|
@@ -100269,7 +100310,7 @@ var MobileMenuButton = /*#__PURE__*/createStyled("button", true ? {
|
|
|
100269
100310
|
} : 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));
|
|
100270
100311
|
var MobileUtilityBar = /*#__PURE__*/createStyled("div", true ? {
|
|
100271
100312
|
target: "e1607tyl11"
|
|
100272
|
-
} : 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));
|
|
100313
|
+
} : 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));
|
|
100273
100314
|
var MobileDrawer = /*#__PURE__*/createStyled("div", true ? {
|
|
100274
100315
|
target: "e1607tyl10"
|
|
100275
100316
|
} : 0)( true ? {
|
|
@@ -100383,7 +100424,8 @@ var HEIGHT_MAP = {
|
|
|
100383
100424
|
|
|
100384
100425
|
;// ./src/utils/constants.js
|
|
100385
100426
|
var HEADER_CONTENT_ENTRY_UID = "global_header";
|
|
100386
|
-
var
|
|
100427
|
+
var HEADER_ENTRY_URL = "/vb-header/root-header";
|
|
100428
|
+
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"]));
|
|
100387
100429
|
var CONTENTSTACK_API_KEY = process.env.CONTENTSTACK_API_KEY;
|
|
100388
100430
|
var CONTENTSTACK_DELIVERY_TOKEN = process.env.CONTENTSTACK_DELIVERY_TOKEN;
|
|
100389
100431
|
var CONTENTSTACK_ENVIRONMENT = process.env.CONTENTSTACK_ENVIRONMENT;
|
|
@@ -100707,55 +100749,233 @@ Brand.defaultProps = {
|
|
|
100707
100749
|
size: "Large",
|
|
100708
100750
|
$: null
|
|
100709
100751
|
};
|
|
100710
|
-
;// ./src/components/
|
|
100711
|
-
|
|
100712
|
-
|
|
100713
|
-
|
|
100714
|
-
|
|
100715
|
-
|
|
100716
|
-
|
|
100717
|
-
|
|
100718
|
-
|
|
100719
|
-
|
|
100720
|
-
|
|
100721
|
-
|
|
100722
|
-
|
|
100723
|
-
|
|
100724
|
-
|
|
100725
|
-
|
|
100726
|
-
|
|
100727
|
-
|
|
100728
|
-
|
|
100729
|
-
|
|
100730
|
-
|
|
100731
|
-
|
|
100732
|
-
|
|
100733
|
-
|
|
100734
|
-
|
|
100735
|
-
|
|
100736
|
-
|
|
100737
|
-
|
|
100738
|
-
|
|
100739
|
-
|
|
100740
|
-
|
|
100741
|
-
|
|
100742
|
-
|
|
100743
|
-
|
|
100744
|
-
|
|
100745
|
-
|
|
100746
|
-
|
|
100747
|
-
|
|
100748
|
-
|
|
100749
|
-
}
|
|
100750
|
-
|
|
100751
|
-
|
|
100752
|
-
|
|
100753
|
-
|
|
100754
|
-
|
|
100755
|
-
|
|
100756
|
-
|
|
100757
|
-
|
|
100752
|
+
;// ./src/components/header/HeaderIcons.jsx
|
|
100753
|
+
/* unused harmony import specifier */ var _jsx;
|
|
100754
|
+
/* unused harmony import specifier */ var _jsxs;
|
|
100755
|
+
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); }
|
|
100756
|
+
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; }
|
|
100757
|
+
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; }
|
|
100758
|
+
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; }
|
|
100759
|
+
function HeaderIcons_toPropertyKey(t) { var i = HeaderIcons_toPrimitive(t, "string"); return "symbol" == HeaderIcons_typeof(i) ? i : i + ""; }
|
|
100760
|
+
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); }
|
|
100761
|
+
|
|
100762
|
+
|
|
100763
|
+
/** 16–20px inline SVGs for header chrome (wireframe parity). */
|
|
100764
|
+
|
|
100765
|
+
function IconMenu(props) {
|
|
100766
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100767
|
+
width: "24",
|
|
100768
|
+
height: "24",
|
|
100769
|
+
viewBox: "0 0 24 24",
|
|
100770
|
+
fill: "none",
|
|
100771
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
100772
|
+
"aria-hidden": true
|
|
100773
|
+
}, props), {}, {
|
|
100774
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
100775
|
+
d: "M3 12h18M3 6h18M3 18h18",
|
|
100776
|
+
stroke: "currentColor",
|
|
100777
|
+
strokeWidth: "2",
|
|
100778
|
+
strokeLinecap: "round",
|
|
100779
|
+
strokeLinejoin: "round"
|
|
100780
|
+
})
|
|
100781
|
+
}));
|
|
100782
|
+
}
|
|
100783
|
+
function IconSearch(props) {
|
|
100784
|
+
return /*#__PURE__*/_jsx("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100785
|
+
width: "20",
|
|
100786
|
+
height: "20",
|
|
100787
|
+
viewBox: "0 0 24 24",
|
|
100788
|
+
fill: "none",
|
|
100789
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
100790
|
+
"aria-hidden": true
|
|
100791
|
+
}, props), {}, {
|
|
100792
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
100793
|
+
d: "M10.5 18a7.5 7.5 0 110-15 7.5 7.5 0 010 15zM16.5 16.5L21 21",
|
|
100794
|
+
stroke: "currentColor",
|
|
100795
|
+
strokeWidth: "2",
|
|
100796
|
+
strokeLinecap: "round"
|
|
100797
|
+
})
|
|
100798
|
+
}));
|
|
100799
|
+
}
|
|
100800
|
+
function IconChevronDown(props) {
|
|
100801
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100802
|
+
width: "12",
|
|
100803
|
+
height: "12",
|
|
100804
|
+
viewBox: "0 0 12 12",
|
|
100805
|
+
fill: "none",
|
|
100806
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
100807
|
+
"aria-hidden": true
|
|
100808
|
+
}, props), {}, {
|
|
100809
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
100810
|
+
d: "M2.5 4.5L6 8l3.5-3.5",
|
|
100811
|
+
stroke: "currentColor",
|
|
100812
|
+
strokeWidth: "1.5",
|
|
100813
|
+
strokeLinecap: "round",
|
|
100814
|
+
strokeLinejoin: "round"
|
|
100815
|
+
})
|
|
100816
|
+
}));
|
|
100817
|
+
}
|
|
100818
|
+
function IconUser(props) {
|
|
100819
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100820
|
+
width: "18",
|
|
100821
|
+
height: "18",
|
|
100822
|
+
viewBox: "0 0 24 24",
|
|
100823
|
+
fill: "none",
|
|
100824
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
100825
|
+
"aria-hidden": true
|
|
100826
|
+
}, props), {}, {
|
|
100827
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
100828
|
+
d: "M12 12a4 4 0 100-8 4 4 0 000 8zM4 20a8 8 0 0116 0",
|
|
100829
|
+
stroke: "currentColor",
|
|
100830
|
+
strokeWidth: "2",
|
|
100831
|
+
strokeLinecap: "round"
|
|
100832
|
+
})
|
|
100833
|
+
}));
|
|
100834
|
+
}
|
|
100835
|
+
function IconCart(props) {
|
|
100836
|
+
return /*#__PURE__*/_jsxs("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100837
|
+
width: "20",
|
|
100838
|
+
height: "20",
|
|
100839
|
+
viewBox: "0 0 24 24",
|
|
100840
|
+
fill: "none",
|
|
100841
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
100842
|
+
"aria-hidden": true
|
|
100843
|
+
}, props), {}, {
|
|
100844
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
100845
|
+
d: "M6 7h15l-2 10H8L6 7zm0 0L5 3H2",
|
|
100846
|
+
stroke: "currentColor",
|
|
100847
|
+
strokeWidth: "2",
|
|
100848
|
+
strokeLinecap: "round",
|
|
100849
|
+
strokeLinejoin: "round"
|
|
100850
|
+
}), /*#__PURE__*/_jsx("circle", {
|
|
100851
|
+
cx: "10",
|
|
100852
|
+
cy: "20",
|
|
100853
|
+
r: "1",
|
|
100854
|
+
fill: "currentColor"
|
|
100855
|
+
}), /*#__PURE__*/_jsx("circle", {
|
|
100856
|
+
cx: "18",
|
|
100857
|
+
cy: "20",
|
|
100858
|
+
r: "1",
|
|
100859
|
+
fill: "currentColor"
|
|
100860
|
+
})]
|
|
100861
|
+
}));
|
|
100862
|
+
}
|
|
100863
|
+
function IconArrowRight(props) {
|
|
100864
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100865
|
+
width: "14",
|
|
100866
|
+
height: "14",
|
|
100867
|
+
viewBox: "0 0 24 24",
|
|
100868
|
+
fill: "none",
|
|
100869
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
100870
|
+
"aria-hidden": true
|
|
100871
|
+
}, props), {}, {
|
|
100872
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
100873
|
+
d: "M5 12h14M13 5l7 7-7 7",
|
|
100874
|
+
stroke: "currentColor",
|
|
100875
|
+
strokeWidth: "2",
|
|
100876
|
+
strokeLinecap: "round",
|
|
100877
|
+
strokeLinejoin: "round"
|
|
100878
|
+
})
|
|
100879
|
+
}));
|
|
100880
|
+
}
|
|
100881
|
+
;// ./src/components/header/MobileHeaderDrawer.jsx
|
|
100882
|
+
|
|
100883
|
+
|
|
100884
|
+
|
|
100885
|
+
|
|
100886
|
+
|
|
100887
|
+
|
|
100888
|
+
function MobileHeaderDrawer(_ref) {
|
|
100889
|
+
var _navigationData$topNa;
|
|
100890
|
+
var isOpen = _ref.isOpen,
|
|
100891
|
+
onClose = _ref.onClose,
|
|
100892
|
+
logoData = _ref.logoData,
|
|
100893
|
+
localeData = _ref.localeData,
|
|
100894
|
+
navigationData = _ref.navigationData,
|
|
100895
|
+
loyaltyData = _ref.loyaltyData,
|
|
100896
|
+
marketTriggerMountRef = _ref.marketTriggerMountRef;
|
|
100897
|
+
if (!isOpen) return null;
|
|
100898
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawer, {
|
|
100899
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerBackdrop, {
|
|
100900
|
+
onClick: onClose,
|
|
100901
|
+
"aria-label": "Close menu"
|
|
100902
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerContent, {
|
|
100903
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerHeader, {
|
|
100904
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerHeaderRow, {
|
|
100905
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerLogoSlot, {
|
|
100906
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Brand, {
|
|
100907
|
+
logo: logoData.logo,
|
|
100908
|
+
logoAlt: logoData.logoAlt,
|
|
100909
|
+
href: logoData.href,
|
|
100910
|
+
showLogo: logoData.showLogo,
|
|
100911
|
+
size: logoData.size || "Large",
|
|
100912
|
+
$: logoData.$
|
|
100913
|
+
})
|
|
100914
|
+
}), marketTriggerMountRef ? /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerMarketTriggerSlot, {
|
|
100915
|
+
ref: marketTriggerMountRef,
|
|
100916
|
+
"data-testid": "mobile-drawer-market-trigger-mount"
|
|
100917
|
+
}) : null]
|
|
100918
|
+
})
|
|
100919
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerNav, {
|
|
100920
|
+
children: [(_navigationData$topNa = navigationData.topNavItems) === null || _navigationData$topNa === void 0 ? void 0 : _navigationData$topNa.map(function (item) {
|
|
100921
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavItem, {
|
|
100922
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerNavButton, {
|
|
100923
|
+
children: [item.label, /*#__PURE__*/(0,jsx_runtime_.jsx)(IconChevronDown, {})]
|
|
100924
|
+
})
|
|
100925
|
+
}, item.id);
|
|
100926
|
+
}), (loyaltyData === null || loyaltyData === void 0 ? void 0 : loyaltyData.link_label) && /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavItem, {
|
|
100927
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavButton, {
|
|
100928
|
+
as: "a",
|
|
100929
|
+
href: loyaltyData.href,
|
|
100930
|
+
style: {
|
|
100931
|
+
justifyContent: 'flex-start'
|
|
100932
|
+
},
|
|
100933
|
+
children: loyaltyData.link_label
|
|
100934
|
+
})
|
|
100935
|
+
}), marketTriggerMountRef ? null : /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavItem, {
|
|
100936
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerLocaleButton, {
|
|
100937
|
+
children: [localeData.control_label, /*#__PURE__*/(0,jsx_runtime_.jsx)(IconChevronDown, {})]
|
|
100938
|
+
})
|
|
100939
|
+
})]
|
|
100940
|
+
})]
|
|
100941
|
+
})]
|
|
100942
|
+
});
|
|
100758
100943
|
}
|
|
100944
|
+
MobileHeaderDrawer.propTypes = {
|
|
100945
|
+
isOpen: external_prop_types_["default"].bool.isRequired,
|
|
100946
|
+
onClose: external_prop_types_["default"].func.isRequired,
|
|
100947
|
+
logoData: external_prop_types_["default"].object.isRequired,
|
|
100948
|
+
localeData: external_prop_types_["default"].object.isRequired,
|
|
100949
|
+
navigationData: external_prop_types_["default"].object.isRequired,
|
|
100950
|
+
loyaltyData: external_prop_types_["default"].object,
|
|
100951
|
+
marketTriggerMountRef: external_prop_types_["default"].shape({
|
|
100952
|
+
current: external_prop_types_["default"].any
|
|
100953
|
+
})
|
|
100954
|
+
};
|
|
100955
|
+
;// ./src/components/header/regions/HeaderLogoRegion.jsx
|
|
100956
|
+
|
|
100957
|
+
|
|
100958
|
+
|
|
100959
|
+
|
|
100960
|
+
function HeaderLogoRegion(_ref) {
|
|
100961
|
+
var _data$aria_label;
|
|
100962
|
+
var data = _ref.data;
|
|
100963
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("div", {
|
|
100964
|
+
"data-region": "logo",
|
|
100965
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(WordmarkButton, {
|
|
100966
|
+
type: "button",
|
|
100967
|
+
"aria-label": (_data$aria_label = data.aria_label) !== null && _data$aria_label !== void 0 ? _data$aria_label : "Nu Skin home",
|
|
100968
|
+
children: data.wordmark
|
|
100969
|
+
})
|
|
100970
|
+
});
|
|
100971
|
+
}
|
|
100972
|
+
HeaderLogoRegion.propTypes = {
|
|
100973
|
+
data: external_prop_types_["default"].shape({
|
|
100974
|
+
wordmark: external_prop_types_["default"].string,
|
|
100975
|
+
home_href: external_prop_types_["default"].string,
|
|
100976
|
+
aria_label: external_prop_types_["default"].string
|
|
100977
|
+
})
|
|
100978
|
+
};
|
|
100759
100979
|
;// ./src/components/header/regions/HeaderLoyaltyRegion.jsx
|
|
100760
100980
|
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); }
|
|
100761
100981
|
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; }
|
|
@@ -100784,135 +101004,6 @@ HeaderLoyaltyRegion.propTypes = {
|
|
|
100784
101004
|
$: external_prop_types_["default"].object
|
|
100785
101005
|
}).isRequired
|
|
100786
101006
|
};
|
|
100787
|
-
;// ./src/components/header/HeaderIcons.jsx
|
|
100788
|
-
/* unused harmony import specifier */ var _jsxs;
|
|
100789
|
-
/* unused harmony import specifier */ var _jsx;
|
|
100790
|
-
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); }
|
|
100791
|
-
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; }
|
|
100792
|
-
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; }
|
|
100793
|
-
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; }
|
|
100794
|
-
function HeaderIcons_toPropertyKey(t) { var i = HeaderIcons_toPrimitive(t, "string"); return "symbol" == HeaderIcons_typeof(i) ? i : i + ""; }
|
|
100795
|
-
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); }
|
|
100796
|
-
|
|
100797
|
-
|
|
100798
|
-
/** 16–20px inline SVGs for header chrome (wireframe parity). */
|
|
100799
|
-
|
|
100800
|
-
function IconMenu(props) {
|
|
100801
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100802
|
-
width: "24",
|
|
100803
|
-
height: "24",
|
|
100804
|
-
viewBox: "0 0 24 24",
|
|
100805
|
-
fill: "none",
|
|
100806
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
100807
|
-
"aria-hidden": true
|
|
100808
|
-
}, props), {}, {
|
|
100809
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
100810
|
-
d: "M3 12h18M3 6h18M3 18h18",
|
|
100811
|
-
stroke: "currentColor",
|
|
100812
|
-
strokeWidth: "2",
|
|
100813
|
-
strokeLinecap: "round",
|
|
100814
|
-
strokeLinejoin: "round"
|
|
100815
|
-
})
|
|
100816
|
-
}));
|
|
100817
|
-
}
|
|
100818
|
-
function IconSearch(props) {
|
|
100819
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100820
|
-
width: "20",
|
|
100821
|
-
height: "20",
|
|
100822
|
-
viewBox: "0 0 24 24",
|
|
100823
|
-
fill: "none",
|
|
100824
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
100825
|
-
"aria-hidden": true
|
|
100826
|
-
}, props), {}, {
|
|
100827
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
100828
|
-
d: "M10.5 18a7.5 7.5 0 110-15 7.5 7.5 0 010 15zM16.5 16.5L21 21",
|
|
100829
|
-
stroke: "currentColor",
|
|
100830
|
-
strokeWidth: "2",
|
|
100831
|
-
strokeLinecap: "round"
|
|
100832
|
-
})
|
|
100833
|
-
}));
|
|
100834
|
-
}
|
|
100835
|
-
function IconChevronDown(props) {
|
|
100836
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100837
|
-
width: "12",
|
|
100838
|
-
height: "12",
|
|
100839
|
-
viewBox: "0 0 12 12",
|
|
100840
|
-
fill: "none",
|
|
100841
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
100842
|
-
"aria-hidden": true
|
|
100843
|
-
}, props), {}, {
|
|
100844
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
100845
|
-
d: "M2.5 4.5L6 8l3.5-3.5",
|
|
100846
|
-
stroke: "currentColor",
|
|
100847
|
-
strokeWidth: "1.5",
|
|
100848
|
-
strokeLinecap: "round",
|
|
100849
|
-
strokeLinejoin: "round"
|
|
100850
|
-
})
|
|
100851
|
-
}));
|
|
100852
|
-
}
|
|
100853
|
-
function IconUser(props) {
|
|
100854
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100855
|
-
width: "18",
|
|
100856
|
-
height: "18",
|
|
100857
|
-
viewBox: "0 0 24 24",
|
|
100858
|
-
fill: "none",
|
|
100859
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
100860
|
-
"aria-hidden": true
|
|
100861
|
-
}, props), {}, {
|
|
100862
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
100863
|
-
d: "M12 12a4 4 0 100-8 4 4 0 000 8zM4 20a8 8 0 0116 0",
|
|
100864
|
-
stroke: "currentColor",
|
|
100865
|
-
strokeWidth: "2",
|
|
100866
|
-
strokeLinecap: "round"
|
|
100867
|
-
})
|
|
100868
|
-
}));
|
|
100869
|
-
}
|
|
100870
|
-
function IconCart(props) {
|
|
100871
|
-
return /*#__PURE__*/_jsxs("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100872
|
-
width: "20",
|
|
100873
|
-
height: "20",
|
|
100874
|
-
viewBox: "0 0 24 24",
|
|
100875
|
-
fill: "none",
|
|
100876
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
100877
|
-
"aria-hidden": true
|
|
100878
|
-
}, props), {}, {
|
|
100879
|
-
children: [/*#__PURE__*/_jsx("path", {
|
|
100880
|
-
d: "M6 7h15l-2 10H8L6 7zm0 0L5 3H2",
|
|
100881
|
-
stroke: "currentColor",
|
|
100882
|
-
strokeWidth: "2",
|
|
100883
|
-
strokeLinecap: "round",
|
|
100884
|
-
strokeLinejoin: "round"
|
|
100885
|
-
}), /*#__PURE__*/_jsx("circle", {
|
|
100886
|
-
cx: "10",
|
|
100887
|
-
cy: "20",
|
|
100888
|
-
r: "1",
|
|
100889
|
-
fill: "currentColor"
|
|
100890
|
-
}), /*#__PURE__*/_jsx("circle", {
|
|
100891
|
-
cx: "18",
|
|
100892
|
-
cy: "20",
|
|
100893
|
-
r: "1",
|
|
100894
|
-
fill: "currentColor"
|
|
100895
|
-
})]
|
|
100896
|
-
}));
|
|
100897
|
-
}
|
|
100898
|
-
function IconArrowRight(props) {
|
|
100899
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
|
|
100900
|
-
width: "14",
|
|
100901
|
-
height: "14",
|
|
100902
|
-
viewBox: "0 0 24 24",
|
|
100903
|
-
fill: "none",
|
|
100904
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
100905
|
-
"aria-hidden": true
|
|
100906
|
-
}, props), {}, {
|
|
100907
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
100908
|
-
d: "M5 12h14M13 5l7 7-7 7",
|
|
100909
|
-
stroke: "currentColor",
|
|
100910
|
-
strokeWidth: "2",
|
|
100911
|
-
strokeLinecap: "round",
|
|
100912
|
-
strokeLinejoin: "round"
|
|
100913
|
-
})
|
|
100914
|
-
}));
|
|
100915
|
-
}
|
|
100916
101007
|
;// ./src/components/header/regions/HeaderAccountRegion.jsx
|
|
100917
101008
|
|
|
100918
101009
|
|
|
@@ -101045,11 +101136,241 @@ HeaderCartRegion.defaultProps = {
|
|
|
101045
101136
|
data: null,
|
|
101046
101137
|
parent$: null
|
|
101047
101138
|
};
|
|
101048
|
-
|
|
101049
|
-
|
|
101139
|
+
// EXTERNAL MODULE: ./node_modules/@mui/icons-material/Close.js
|
|
101140
|
+
var Close = __webpack_require__(9781);
|
|
101141
|
+
// EXTERNAL MODULE: ./node_modules/@mui/icons-material/Search.js
|
|
101142
|
+
var Search = __webpack_require__(4745);
|
|
101143
|
+
;// ./src/components/input/Input.constants.js
|
|
101144
|
+
var INPUT_ICON_POSITIONS = {
|
|
101145
|
+
START: "start",
|
|
101146
|
+
END: "end"
|
|
101147
|
+
};
|
|
101148
|
+
var INPUT_SIZE_VARIANTS = {
|
|
101149
|
+
DEFAULT: "default",
|
|
101150
|
+
WIDE: "wide",
|
|
101151
|
+
FULL: "full"
|
|
101152
|
+
};
|
|
101153
|
+
var INPUT_SIZES = {
|
|
101154
|
+
SM: "sm",
|
|
101155
|
+
MD: "md",
|
|
101156
|
+
LG: "lg"
|
|
101157
|
+
};
|
|
101158
|
+
var DEFAULT_INPUT_ARIA_LABEL = "Search";
|
|
101159
|
+
var DEFAULT_INPUT_ICON_POSITION = INPUT_ICON_POSITIONS.START;
|
|
101160
|
+
var DEFAULT_INPUT_SIZE_VARIANT = INPUT_SIZE_VARIANTS.DEFAULT;
|
|
101161
|
+
var DEFAULT_INPUT_SIZE = INPUT_SIZES.MD;
|
|
101162
|
+
var INPUT_PLACEHOLDERS = {
|
|
101163
|
+
SHORT: "Search",
|
|
101164
|
+
LONG: "Search by product name, ingredient, benefits, or SKU"
|
|
101165
|
+
};
|
|
101166
|
+
var DEFAULT_INPUT_PLACEHOLDER_TEXT = INPUT_PLACEHOLDERS.SHORT;
|
|
101167
|
+
;// ./src/components/input/Input.utils.js
|
|
101168
|
+
|
|
101169
|
+
function normalizeInputIconPosition(icon_position) {
|
|
101170
|
+
if (icon_position === INPUT_ICON_POSITIONS.START || icon_position === INPUT_ICON_POSITIONS.END) {
|
|
101171
|
+
return icon_position;
|
|
101172
|
+
}
|
|
101173
|
+
return DEFAULT_INPUT_ICON_POSITION;
|
|
101174
|
+
}
|
|
101175
|
+
function normalizeInputSizeVariant(size_variant) {
|
|
101176
|
+
var allowed = Object.values(INPUT_SIZE_VARIANTS);
|
|
101177
|
+
if (allowed.includes(size_variant)) return size_variant;
|
|
101178
|
+
return DEFAULT_INPUT_SIZE_VARIANT;
|
|
101179
|
+
}
|
|
101180
|
+
function normalizeInputSize(size) {
|
|
101181
|
+
var allowed = Object.values(INPUT_SIZES);
|
|
101182
|
+
if (allowed.includes(size)) return size;
|
|
101183
|
+
return DEFAULT_INPUT_SIZE;
|
|
101184
|
+
}
|
|
101185
|
+
function normalizeInputPlaceholderText(placeholder_text) {
|
|
101186
|
+
if (typeof placeholder_text === "string" && placeholder_text.trim() !== "") {
|
|
101187
|
+
return placeholder_text;
|
|
101188
|
+
}
|
|
101189
|
+
return DEFAULT_INPUT_PLACEHOLDER_TEXT;
|
|
101190
|
+
}
|
|
101191
|
+
function normalizeInputValue(value) {
|
|
101192
|
+
if (typeof value === "string") return value;
|
|
101193
|
+
return "";
|
|
101194
|
+
}
|
|
101195
|
+
function focusInputEl(el) {
|
|
101196
|
+
if (!el) return;
|
|
101197
|
+
if (typeof el.focus !== "function") return;
|
|
101198
|
+
el.focus();
|
|
101199
|
+
}
|
|
101200
|
+
function blurInputEl(el) {
|
|
101201
|
+
if (!el) return;
|
|
101202
|
+
if (typeof el.blur !== "function") return;
|
|
101203
|
+
el.blur();
|
|
101204
|
+
}
|
|
101205
|
+
;// ./src/components/input/Input.theme.js
|
|
101206
|
+
var InputTheme = {
|
|
101207
|
+
colors: {
|
|
101208
|
+
background: "#ffffff",
|
|
101209
|
+
backgroundHover: "#f3f4f6",
|
|
101210
|
+
backgroundFocused: "#ffffff",
|
|
101211
|
+
border: "#BDBDBD",
|
|
101212
|
+
text: "#111827",
|
|
101213
|
+
placeholder: "#6B6B6B",
|
|
101214
|
+
icon: "#6B6B6B"
|
|
101215
|
+
},
|
|
101216
|
+
radii: {
|
|
101217
|
+
pill: "999px"
|
|
101218
|
+
},
|
|
101219
|
+
sizes: {
|
|
101220
|
+
bySize: {
|
|
101221
|
+
sm: {
|
|
101222
|
+
height: "36px",
|
|
101223
|
+
icon: "18px",
|
|
101224
|
+
fontSize: "14px",
|
|
101225
|
+
lineHeight: "20px"
|
|
101226
|
+
},
|
|
101227
|
+
md: {
|
|
101228
|
+
height: "44px",
|
|
101229
|
+
icon: "20px",
|
|
101230
|
+
fontSize: "16px",
|
|
101231
|
+
lineHeight: "24px"
|
|
101232
|
+
},
|
|
101233
|
+
lg: {
|
|
101234
|
+
height: "52px",
|
|
101235
|
+
icon: "22px",
|
|
101236
|
+
fontSize: "18px",
|
|
101237
|
+
lineHeight: "26px"
|
|
101238
|
+
}
|
|
101239
|
+
},
|
|
101240
|
+
widths: {
|
|
101241
|
+
"default": "240px",
|
|
101242
|
+
wide: "360px"
|
|
101243
|
+
}
|
|
101244
|
+
},
|
|
101245
|
+
spacing: {
|
|
101246
|
+
containerX: "12px",
|
|
101247
|
+
gap: "10px"
|
|
101248
|
+
},
|
|
101249
|
+
underline: {
|
|
101250
|
+
thickness: "1px",
|
|
101251
|
+
offset: "4px"
|
|
101252
|
+
}
|
|
101253
|
+
};
|
|
101254
|
+
;// ./src/components/input/Input.styled.js
|
|
101255
|
+
|
|
101256
|
+
|
|
101257
|
+
|
|
101258
|
+
function resolveWidth(size_variant) {
|
|
101259
|
+
if (size_variant === INPUT_SIZE_VARIANTS.FULL) return "100%";
|
|
101260
|
+
if (size_variant === INPUT_SIZE_VARIANTS.WIDE) {
|
|
101261
|
+
return InputTheme.sizes.widths.wide;
|
|
101262
|
+
}
|
|
101263
|
+
return InputTheme.sizes.widths["default"];
|
|
101264
|
+
}
|
|
101265
|
+
function resolveSizeTokens(size) {
|
|
101266
|
+
if (size === INPUT_SIZES.SM) return InputTheme.sizes.bySize.sm;
|
|
101267
|
+
if (size === INPUT_SIZES.LG) return InputTheme.sizes.bySize.lg;
|
|
101268
|
+
return InputTheme.sizes.bySize.md;
|
|
101269
|
+
}
|
|
101270
|
+
function underlineCss() {
|
|
101271
|
+
return "\n text-decoration: underline;\n text-decoration-thickness: ".concat(InputTheme.underline.thickness, ";\n text-underline-offset: ").concat(InputTheme.underline.offset, ";\n ");
|
|
101272
|
+
}
|
|
101273
|
+
var Root = /*#__PURE__*/createStyled("div", true ? {
|
|
101274
|
+
target: "ec07usz4"
|
|
101275
|
+
} : 0)("display:flex;align-items:center;box-sizing:border-box;position:relative;--input-icon-size:", function (_ref) {
|
|
101276
|
+
var $size = _ref.$size;
|
|
101277
|
+
return resolveSizeTokens($size).icon;
|
|
101278
|
+
}, ";--placeholder-left:calc(\n ", InputTheme.spacing.containerX, " + var(--input-icon-size) +\n ", InputTheme.spacing.gap, "\n );height:", function (_ref2) {
|
|
101279
|
+
var $size = _ref2.$size;
|
|
101280
|
+
return resolveSizeTokens($size).height;
|
|
101281
|
+
}, ";padding:0 ", InputTheme.spacing.containerX, ";gap:", InputTheme.spacing.gap, ";width:", function (_ref3) {
|
|
101282
|
+
var $sizeVariant = _ref3.$sizeVariant;
|
|
101283
|
+
return resolveWidth($sizeVariant);
|
|
101284
|
+
}, ";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) {
|
|
101285
|
+
var $disabled = _ref4.$disabled;
|
|
101286
|
+
if ($disabled) return "";
|
|
101287
|
+
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 ");
|
|
101288
|
+
}, " ", function (_ref5) {
|
|
101289
|
+
var $focused = _ref5.$focused,
|
|
101290
|
+
$disabled = _ref5.$disabled;
|
|
101291
|
+
if (!$focused || $disabled) return "";
|
|
101292
|
+
return "\n background: ".concat(InputTheme.colors.backgroundFocused, ";\n ");
|
|
101293
|
+
}, " ", function (_ref6) {
|
|
101294
|
+
var $disabled = _ref6.$disabled;
|
|
101295
|
+
if ($disabled) return "";
|
|
101296
|
+
return "\n &:hover input {\n ".concat(underlineCss(), "\n }\n\n &:hover [data-placeholder=\"true\"] {\n ").concat(underlineCss(), "\n }\n ");
|
|
101297
|
+
}, " ", function (_ref7) {
|
|
101298
|
+
var $disabled = _ref7.$disabled;
|
|
101299
|
+
if ($disabled) return "";
|
|
101300
|
+
return "\n &:hover {\n background: ".concat(InputTheme.colors.backgroundHover, ";\n }\n ");
|
|
101301
|
+
}, " ", function (_ref8) {
|
|
101302
|
+
var $focused = _ref8.$focused,
|
|
101303
|
+
$disabled = _ref8.$disabled;
|
|
101304
|
+
return $focused && !$disabled ? "\n input {\n ".concat(underlineCss(), "\n }\n\n [data-placeholder=\"true\"] {\n ").concat(underlineCss(), "\n }\n ") : "";
|
|
101305
|
+
}, " ", function (_ref9) {
|
|
101306
|
+
var $disabled = _ref9.$disabled;
|
|
101307
|
+
return $disabled ? "\n opacity: 0.6;\n cursor: not-allowed;\n " : "\n cursor: text;\n ";
|
|
101308
|
+
}, "@media (max-width: 340px){width:100%;}" + ( true ? "" : 0));
|
|
101309
|
+
var IconWrap = /*#__PURE__*/createStyled("span", true ? {
|
|
101310
|
+
target: "ec07usz3"
|
|
101311
|
+
} : 0)("display:inline-flex;align-items:center;justify-content:center;width:", function (_ref0) {
|
|
101312
|
+
var $size = _ref0.$size;
|
|
101313
|
+
return resolveSizeTokens($size).icon;
|
|
101314
|
+
}, ";height:", function (_ref1) {
|
|
101315
|
+
var $size = _ref1.$size;
|
|
101316
|
+
return resolveSizeTokens($size).icon;
|
|
101317
|
+
}, ";font-size:", function (_ref10) {
|
|
101318
|
+
var $size = _ref10.$size;
|
|
101319
|
+
return resolveSizeTokens($size).icon;
|
|
101320
|
+
}, ";color:", InputTheme.colors.icon, ";flex:0 0 auto;" + ( true ? "" : 0));
|
|
101321
|
+
var IconButton = /*#__PURE__*/createStyled("button", true ? {
|
|
101322
|
+
target: "ec07usz2"
|
|
101323
|
+
} : 0)("display:inline-flex;align-items:center;justify-content:center;width:", function (_ref11) {
|
|
101324
|
+
var $size = _ref11.$size;
|
|
101325
|
+
return resolveSizeTokens($size).icon;
|
|
101326
|
+
}, ";height:", function (_ref12) {
|
|
101327
|
+
var $size = _ref12.$size;
|
|
101328
|
+
return resolveSizeTokens($size).icon;
|
|
101329
|
+
}, ";font-size:", function (_ref13) {
|
|
101330
|
+
var $size = _ref13.$size;
|
|
101331
|
+
return resolveSizeTokens($size).icon;
|
|
101332
|
+
}, ";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));
|
|
101333
|
+
var TextInput = /*#__PURE__*/createStyled("input", true ? {
|
|
101334
|
+
target: "ec07usz1"
|
|
101335
|
+
} : 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) {
|
|
101336
|
+
var $size = _ref14.$size;
|
|
101337
|
+
return resolveSizeTokens($size).fontSize;
|
|
101338
|
+
}, ";line-height:", function (_ref15) {
|
|
101339
|
+
var $size = _ref15.$size;
|
|
101340
|
+
return resolveSizeTokens($size).lineHeight;
|
|
101341
|
+
}, ";&::placeholder{color:", InputTheme.colors.placeholder, ";}&:focus{text-decoration:underline;text-decoration-thickness:", InputTheme.underline.thickness, ";text-underline-offset:", InputTheme.underline.offset, ";}" + ( true ? "" : 0));
|
|
101342
|
+
var PlaceholderText = /*#__PURE__*/createStyled("span", true ? {
|
|
101343
|
+
target: "ec07usz0"
|
|
101344
|
+
} : 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) {
|
|
101345
|
+
var $size = _ref16.$size;
|
|
101346
|
+
return resolveSizeTokens($size).fontSize;
|
|
101347
|
+
}, ";line-height:", function (_ref17) {
|
|
101348
|
+
var $size = _ref17.$size;
|
|
101349
|
+
return resolveSizeTokens($size).lineHeight;
|
|
101350
|
+
}, ";white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 64px);" + ( true ? "" : 0));
|
|
101351
|
+
;// ./src/components/input/Input.propTypes.js
|
|
101352
|
+
|
|
101353
|
+
|
|
101354
|
+
var InputPropTypes = {
|
|
101355
|
+
icon_position: external_prop_types_["default"].oneOf([INPUT_ICON_POSITIONS.START, INPUT_ICON_POSITIONS.END]),
|
|
101356
|
+
size_variant: external_prop_types_["default"].oneOf([INPUT_SIZE_VARIANTS.DEFAULT, INPUT_SIZE_VARIANTS.WIDE, INPUT_SIZE_VARIANTS.FULL]),
|
|
101357
|
+
size: external_prop_types_["default"].oneOf([INPUT_SIZES.SM, INPUT_SIZES.MD, INPUT_SIZES.LG]),
|
|
101358
|
+
value: external_prop_types_["default"].string,
|
|
101359
|
+
onChange: external_prop_types_["default"].func,
|
|
101360
|
+
is_focused: external_prop_types_["default"].bool,
|
|
101361
|
+
onFocus: external_prop_types_["default"].func,
|
|
101362
|
+
onBlur: external_prop_types_["default"].func,
|
|
101363
|
+
disabled: external_prop_types_["default"].bool,
|
|
101364
|
+
placeholder_text: external_prop_types_["default"].string,
|
|
101365
|
+
aria_label: external_prop_types_["default"].string,
|
|
101366
|
+
'data-testid': external_prop_types_["default"].string,
|
|
101367
|
+
className: external_prop_types_["default"].string
|
|
101368
|
+
};
|
|
101369
|
+
;// ./src/components/input/Input.jsx
|
|
101370
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || Input_unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
101050
101371
|
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."); }
|
|
101051
|
-
function
|
|
101052
|
-
function
|
|
101372
|
+
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; } }
|
|
101373
|
+
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; }
|
|
101053
101374
|
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; } }
|
|
101054
101375
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
101055
101376
|
|
|
@@ -101057,44 +101378,2885 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
101057
101378
|
|
|
101058
101379
|
|
|
101059
101380
|
|
|
101060
|
-
|
|
101061
|
-
|
|
101062
|
-
|
|
101381
|
+
|
|
101382
|
+
|
|
101383
|
+
|
|
101384
|
+
function coalesceBoolean(primary, fallback) {
|
|
101385
|
+
if (typeof primary === "boolean") return primary;
|
|
101386
|
+
return fallback;
|
|
101387
|
+
}
|
|
101388
|
+
function Input(props) {
|
|
101389
|
+
var icon_position = props.icon_position,
|
|
101390
|
+
size_variant = props.size_variant,
|
|
101391
|
+
size = props.size,
|
|
101392
|
+
value = props.value,
|
|
101393
|
+
_onChange = props.onChange,
|
|
101394
|
+
is_focused = props.is_focused,
|
|
101395
|
+
_onFocus = props.onFocus,
|
|
101396
|
+
_onBlur = props.onBlur,
|
|
101397
|
+
disabled = props.disabled,
|
|
101398
|
+
placeholder_text = props.placeholder_text,
|
|
101399
|
+
aria_label = props.aria_label,
|
|
101400
|
+
dataTestId = props['data-testid'],
|
|
101401
|
+
className = props.className;
|
|
101402
|
+
var inputRef = (0,external_react_.useRef)(null);
|
|
101403
|
+
var _useState = (0,external_react_.useState)(false),
|
|
101063
101404
|
_useState2 = _slicedToArray(_useState, 2),
|
|
101064
|
-
|
|
101065
|
-
|
|
101066
|
-
|
|
101405
|
+
internalFocused = _useState2[0],
|
|
101406
|
+
setInternalFocused = _useState2[1];
|
|
101407
|
+
var canRender = typeof _onChange === "function";
|
|
101408
|
+
var normalizedIconPosition = (0,external_react_.useMemo)(function () {
|
|
101409
|
+
return normalizeInputIconPosition(icon_position);
|
|
101410
|
+
}, [icon_position]);
|
|
101411
|
+
var normalizedSizeVariant = (0,external_react_.useMemo)(function () {
|
|
101412
|
+
return normalizeInputSizeVariant(size_variant);
|
|
101413
|
+
}, [size_variant]);
|
|
101414
|
+
var normalizedSize = (0,external_react_.useMemo)(function () {
|
|
101415
|
+
return normalizeInputSize(size);
|
|
101416
|
+
}, [size]);
|
|
101417
|
+
var normalizedValue = (0,external_react_.useMemo)(function () {
|
|
101418
|
+
return normalizeInputValue(value);
|
|
101419
|
+
}, [value]);
|
|
101420
|
+
var placeholderText = (0,external_react_.useMemo)(function () {
|
|
101421
|
+
return normalizeInputPlaceholderText(placeholder_text);
|
|
101422
|
+
}, [placeholder_text]);
|
|
101423
|
+
(0,external_react_.useEffect)(function () {
|
|
101424
|
+
if (typeof is_focused !== "boolean") return;
|
|
101425
|
+
if (is_focused) focusInputEl(inputRef.current);else blurInputEl(inputRef.current);
|
|
101426
|
+
}, [is_focused]);
|
|
101427
|
+
var effectiveFocused = coalesceBoolean(is_focused, internalFocused);
|
|
101428
|
+
var handleContainerMouseDown = function handleContainerMouseDown(e) {
|
|
101429
|
+
if (disabled) return;
|
|
101430
|
+
|
|
101431
|
+
// Allow native behaviors (caret placement, text selection) when interacting
|
|
101432
|
+
// with the actual input. Only "steal" clicks on the chrome/empty area to
|
|
101433
|
+
// focus the field.
|
|
101434
|
+
var target = e.target;
|
|
101435
|
+
if (target instanceof Element) {
|
|
101436
|
+
if (target === inputRef.current) return;
|
|
101437
|
+
if (target.closest("button")) return;
|
|
101438
|
+
}
|
|
101067
101439
|
e.preventDefault();
|
|
101068
|
-
|
|
101069
|
-
|
|
101440
|
+
focusInputEl(inputRef.current);
|
|
101441
|
+
};
|
|
101442
|
+
if (!canRender) return null;
|
|
101443
|
+
var label = aria_label || DEFAULT_INPUT_ARIA_LABEL;
|
|
101444
|
+
var rootTestId = dataTestId || "search-input";
|
|
101445
|
+
var inputTestId = "".concat(rootTestId, "-input");
|
|
101446
|
+
var iconTestId = "".concat(rootTestId, "-icon");
|
|
101447
|
+
var clearTestId = "".concat(rootTestId, "-clear");
|
|
101448
|
+
var iconEl = /*#__PURE__*/(0,jsx_runtime_.jsx)(IconWrap, {
|
|
101449
|
+
"aria-hidden": "true",
|
|
101450
|
+
"data-testid": iconTestId,
|
|
101451
|
+
$size: normalizedSize,
|
|
101452
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Search/* default */.A, {
|
|
101453
|
+
fontSize: "inherit"
|
|
101454
|
+
})
|
|
101455
|
+
});
|
|
101456
|
+
var inputEl = /*#__PURE__*/(0,jsx_runtime_.jsx)(TextInput, {
|
|
101457
|
+
ref: inputRef,
|
|
101458
|
+
type: "text",
|
|
101459
|
+
"aria-label": label,
|
|
101460
|
+
"data-testid": inputTestId,
|
|
101461
|
+
placeholder: "",
|
|
101462
|
+
disabled: disabled,
|
|
101463
|
+
value: normalizedValue,
|
|
101464
|
+
$size: normalizedSize,
|
|
101465
|
+
onFocus: function onFocus(e) {
|
|
101466
|
+
setInternalFocused(true);
|
|
101467
|
+
_onFocus === null || _onFocus === void 0 || _onFocus(e);
|
|
101468
|
+
},
|
|
101469
|
+
onBlur: function onBlur(e) {
|
|
101470
|
+
setInternalFocused(false);
|
|
101471
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(e);
|
|
101472
|
+
},
|
|
101473
|
+
onChange: function onChange(e) {
|
|
101474
|
+
return _onChange(e.target.value);
|
|
101475
|
+
}
|
|
101476
|
+
});
|
|
101477
|
+
var placeholderEl = normalizedValue === "" ? /*#__PURE__*/(0,jsx_runtime_.jsx)(PlaceholderText, {
|
|
101478
|
+
"data-placeholder": "true",
|
|
101479
|
+
$size: normalizedSize,
|
|
101480
|
+
children: placeholderText
|
|
101481
|
+
}) : null;
|
|
101482
|
+
var shouldShowClear = !disabled && normalizedValue !== "";
|
|
101483
|
+
var clearEl = shouldShowClear ? /*#__PURE__*/(0,jsx_runtime_.jsx)(IconButton, {
|
|
101484
|
+
type: "button",
|
|
101485
|
+
"aria-label": "Clear",
|
|
101486
|
+
"data-testid": clearTestId,
|
|
101487
|
+
$size: normalizedSize,
|
|
101488
|
+
onMouseDown: function onMouseDown(e) {
|
|
101489
|
+
e.preventDefault();
|
|
101490
|
+
},
|
|
101491
|
+
onClick: function onClick() {
|
|
101492
|
+
_onChange("");
|
|
101493
|
+
focusInputEl(inputRef.current);
|
|
101494
|
+
},
|
|
101495
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Close/* default */.A, {
|
|
101496
|
+
fontSize: "inherit",
|
|
101497
|
+
"aria-hidden": "true"
|
|
101498
|
+
})
|
|
101499
|
+
}) : null;
|
|
101500
|
+
var contentEls = normalizedIconPosition === "end" ? [placeholderEl, inputEl, clearEl, iconEl] : [iconEl, placeholderEl, inputEl, clearEl];
|
|
101501
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(Root, {
|
|
101502
|
+
className: className,
|
|
101503
|
+
$sizeVariant: normalizedSizeVariant,
|
|
101504
|
+
$size: normalizedSize,
|
|
101505
|
+
$focused: effectiveFocused,
|
|
101506
|
+
$disabled: disabled,
|
|
101507
|
+
"data-testid": rootTestId,
|
|
101508
|
+
"data-icon-position": normalizedIconPosition,
|
|
101509
|
+
"data-size-variant": normalizedSizeVariant,
|
|
101510
|
+
"data-size": normalizedSize,
|
|
101511
|
+
"data-focused": effectiveFocused ? "true" : "false",
|
|
101512
|
+
"data-disabled": disabled ? "true" : "false",
|
|
101513
|
+
onMouseDown: handleContainerMouseDown,
|
|
101514
|
+
children: contentEls
|
|
101515
|
+
});
|
|
101516
|
+
}
|
|
101517
|
+
Input.propTypes = InputPropTypes;
|
|
101518
|
+
Input.defaultProps = {
|
|
101519
|
+
icon_position: DEFAULT_INPUT_ICON_POSITION,
|
|
101520
|
+
size_variant: DEFAULT_INPUT_SIZE_VARIANT,
|
|
101521
|
+
size: DEFAULT_INPUT_SIZE,
|
|
101522
|
+
value: "",
|
|
101523
|
+
is_focused: undefined,
|
|
101524
|
+
onFocus: undefined,
|
|
101525
|
+
onBlur: undefined,
|
|
101526
|
+
disabled: false,
|
|
101527
|
+
placeholder_text: undefined,
|
|
101528
|
+
aria_label: undefined,
|
|
101529
|
+
'data-testid': undefined,
|
|
101530
|
+
className: undefined
|
|
101531
|
+
};
|
|
101532
|
+
;// ./src/components/auto-complete/utils/AutoCompleteConstants.js
|
|
101533
|
+
var DEBOUNCE_MS = 220;
|
|
101534
|
+
var MAX_VISIBLE_SUGGESTIONS = 6;
|
|
101535
|
+
;// ./src/components/auto-complete/utils/AutoCompleteSuggestionHelpers.js
|
|
101536
|
+
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); }
|
|
101537
|
+
function AutoCompleteSuggestionHelpers_toConsumableArray(r) { return AutoCompleteSuggestionHelpers_arrayWithoutHoles(r) || AutoCompleteSuggestionHelpers_iterableToArray(r) || AutoCompleteSuggestionHelpers_unsupportedIterableToArray(r) || AutoCompleteSuggestionHelpers_nonIterableSpread(); }
|
|
101538
|
+
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."); }
|
|
101539
|
+
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; } }
|
|
101540
|
+
function AutoCompleteSuggestionHelpers_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
101541
|
+
function AutoCompleteSuggestionHelpers_arrayWithoutHoles(r) { if (Array.isArray(r)) return AutoCompleteSuggestionHelpers_arrayLikeToArray(r); }
|
|
101542
|
+
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; }
|
|
101543
|
+
function getCopyValue(copy, snakeCaseKey, camelCaseKey) {
|
|
101544
|
+
var fallback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
|
|
101545
|
+
if ((copy === null || copy === void 0 ? void 0 : copy[snakeCaseKey]) != null) {
|
|
101546
|
+
return copy[snakeCaseKey];
|
|
101547
|
+
}
|
|
101548
|
+
if ((copy === null || copy === void 0 ? void 0 : copy[camelCaseKey]) != null) {
|
|
101549
|
+
return copy[camelCaseKey];
|
|
101550
|
+
}
|
|
101551
|
+
return fallback;
|
|
101552
|
+
}
|
|
101553
|
+
function safeParseJsonArray(value) {
|
|
101554
|
+
if (Array.isArray(value)) {
|
|
101555
|
+
return value;
|
|
101556
|
+
}
|
|
101557
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
101558
|
+
return [];
|
|
101559
|
+
}
|
|
101560
|
+
try {
|
|
101561
|
+
var parsedValue = JSON.parse(value);
|
|
101562
|
+
return Array.isArray(parsedValue) ? parsedValue : [];
|
|
101563
|
+
} catch (_unused) {
|
|
101564
|
+
return [];
|
|
101565
|
+
}
|
|
101566
|
+
}
|
|
101567
|
+
function getIngredientTerms(rawIngredients) {
|
|
101568
|
+
var ingredientGroups = safeParseJsonArray(rawIngredients);
|
|
101569
|
+
return ingredientGroups.flatMap(function (ingredientGroup) {
|
|
101570
|
+
var keyIngredients = Array.isArray(ingredientGroup === null || ingredientGroup === void 0 ? void 0 : ingredientGroup.keyIngredients) ? ingredientGroup.keyIngredients.map(function (ingredient) {
|
|
101571
|
+
return ingredient === null || ingredient === void 0 ? void 0 : ingredient.name;
|
|
101572
|
+
}) : [];
|
|
101573
|
+
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));
|
|
101574
|
+
}).filter(Boolean).map(function (term) {
|
|
101575
|
+
return String(term).trim();
|
|
101576
|
+
}).filter(Boolean);
|
|
101577
|
+
}
|
|
101578
|
+
function getSkuProperties(product) {
|
|
101579
|
+
var _ref, _skuList$find, _defaultSku$propertie;
|
|
101580
|
+
var skuList = Array.isArray(product.sku) ? product.sku : [];
|
|
101581
|
+
var defaultSku = (_ref = (_skuList$find = skuList.find(function (skuEntry) {
|
|
101582
|
+
return skuEntry === null || skuEntry === void 0 ? void 0 : skuEntry["default"];
|
|
101583
|
+
})) !== null && _skuList$find !== void 0 ? _skuList$find : skuList[0]) !== null && _ref !== void 0 ? _ref : null;
|
|
101584
|
+
return {
|
|
101585
|
+
defaultSku: defaultSku,
|
|
101586
|
+
skuProperties: (_defaultSku$propertie = defaultSku === null || defaultSku === void 0 ? void 0 : defaultSku.properties) !== null && _defaultSku$propertie !== void 0 ? _defaultSku$propertie : {}
|
|
101587
|
+
};
|
|
101588
|
+
}
|
|
101589
|
+
function getIdentifier(product, defaultSku, index) {
|
|
101590
|
+
var _ref2, _defaultSku$identifie;
|
|
101591
|
+
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();
|
|
101592
|
+
}
|
|
101593
|
+
function getDisplayLabel(identifier, productProperties, skuProperties) {
|
|
101594
|
+
var _ref3, _ref4, _ref5, _skuProperties$title;
|
|
101595
|
+
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;
|
|
101596
|
+
}
|
|
101597
|
+
function getTypeData(product, productProperties, skuProperties) {
|
|
101598
|
+
var _ref6, _productProperties$cu, _ref7, _ref8, _product$type;
|
|
101599
|
+
var customProductType = String((_ref6 = (_productProperties$cu = productProperties.customProductType) !== null && _productProperties$cu !== void 0 ? _productProperties$cu : skuProperties.customProductType) !== null && _ref6 !== void 0 ? _ref6 : "").trim();
|
|
101600
|
+
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();
|
|
101601
|
+
return {
|
|
101602
|
+
customProductType: customProductType,
|
|
101603
|
+
isBundle: normalizedType === "bundle" || customProductType.toLowerCase().includes("bundle")
|
|
101604
|
+
};
|
|
101605
|
+
}
|
|
101606
|
+
function getNavigationUrls(productProperties, skuProperties) {
|
|
101607
|
+
var _ref9, _skuProperties$slug, _ref0, _ref1, _ref10, _skuProperties$url;
|
|
101608
|
+
var slug = (_ref9 = (_skuProperties$slug = skuProperties.slug) !== null && _skuProperties$slug !== void 0 ? _skuProperties$slug : productProperties.slug) !== null && _ref9 !== void 0 ? _ref9 : null;
|
|
101609
|
+
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;
|
|
101610
|
+
return {
|
|
101611
|
+
navigableUrl: navigableUrl,
|
|
101612
|
+
slug: slug
|
|
101613
|
+
};
|
|
101614
|
+
}
|
|
101615
|
+
function getMappedProductType(isBundle) {
|
|
101616
|
+
return isBundle ? "bundle" : "single";
|
|
101617
|
+
}
|
|
101618
|
+
function isOutOfStock(inventoryStatus) {
|
|
101619
|
+
return String(inventoryStatus).toUpperCase() === "OUT OF STOCK";
|
|
101620
|
+
}
|
|
101621
|
+
function mapCatalogProductToSuggestion(product) {
|
|
101622
|
+
var _product$properties, _ref11, _skuProperties$invent, _ref12, _ref13, _ref14, _skuProperties$imageU, _ref15, _productProperties$ke, _skuProperties$ingred;
|
|
101623
|
+
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
101624
|
+
if (!product || AutoCompleteSuggestionHelpers_typeof(product) !== "object") {
|
|
101625
|
+
return null;
|
|
101626
|
+
}
|
|
101627
|
+
var productProperties = (_product$properties = product.properties) !== null && _product$properties !== void 0 ? _product$properties : {};
|
|
101628
|
+
var _getSkuProperties = getSkuProperties(product),
|
|
101629
|
+
defaultSku = _getSkuProperties.defaultSku,
|
|
101630
|
+
skuProperties = _getSkuProperties.skuProperties;
|
|
101631
|
+
var identifier = getIdentifier(product, defaultSku, index);
|
|
101632
|
+
var displayLabel = getDisplayLabel(identifier, productProperties, skuProperties);
|
|
101633
|
+
var inventoryStatus = (_ref11 = (_skuProperties$invent = skuProperties.inventoryStatus) !== null && _skuProperties$invent !== void 0 ? _skuProperties$invent : productProperties.inventoryStatus) !== null && _ref11 !== void 0 ? _ref11 : "";
|
|
101634
|
+
var _getTypeData = getTypeData(product, productProperties, skuProperties),
|
|
101635
|
+
customProductType = _getTypeData.customProductType,
|
|
101636
|
+
isBundle = _getTypeData.isBundle;
|
|
101637
|
+
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;
|
|
101638
|
+
var _getNavigationUrls = getNavigationUrls(productProperties, skuProperties),
|
|
101639
|
+
navigableUrl = _getNavigationUrls.navigableUrl,
|
|
101640
|
+
slug = _getNavigationUrls.slug;
|
|
101641
|
+
var mappedProductType = getMappedProductType(isBundle);
|
|
101642
|
+
return {
|
|
101643
|
+
id: identifier,
|
|
101644
|
+
identifier: identifier,
|
|
101645
|
+
sku: identifier,
|
|
101646
|
+
label: displayLabel,
|
|
101647
|
+
value: displayLabel,
|
|
101648
|
+
imageURL: imageSrc,
|
|
101649
|
+
thumbnail: imageSrc,
|
|
101650
|
+
productType: mappedProductType,
|
|
101651
|
+
product_type: mappedProductType,
|
|
101652
|
+
outOfStock: isOutOfStock(inventoryStatus),
|
|
101653
|
+
customProductType: customProductType,
|
|
101654
|
+
slug: slug,
|
|
101655
|
+
productSlug: slug,
|
|
101656
|
+
url: navigableUrl,
|
|
101657
|
+
href: navigableUrl,
|
|
101658
|
+
keywords: (_ref15 = (_productProperties$ke = productProperties.keyword) !== null && _productProperties$ke !== void 0 ? _productProperties$ke : skuProperties.keyword) !== null && _ref15 !== void 0 ? _ref15 : "",
|
|
101659
|
+
ingredientTerms: getIngredientTerms((_skuProperties$ingred = skuProperties.ingredients) !== null && _skuProperties$ingred !== void 0 ? _skuProperties$ingred : productProperties.ingredients)
|
|
101660
|
+
};
|
|
101661
|
+
}
|
|
101662
|
+
function getSuggestionDisplayData(suggestionOption) {
|
|
101663
|
+
var _suggestionOption$pro, _suggestionOption$out, _ref16, _ref17, _suggestionOption$ima, _ref18, _ref19, _ref20, _ref21, _suggestionOption$val;
|
|
101664
|
+
var isDidYouMean = suggestionOption.suggestionType === "did-you-mean";
|
|
101665
|
+
var productType = (_suggestionOption$pro = suggestionOption.product_type) !== null && _suggestionOption$pro !== void 0 ? _suggestionOption$pro : suggestionOption.productType;
|
|
101666
|
+
var outOfStock = (_suggestionOption$out = suggestionOption.out_of_stock) !== null && _suggestionOption$out !== void 0 ? _suggestionOption$out : suggestionOption.outOfStock;
|
|
101667
|
+
return {
|
|
101668
|
+
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,
|
|
101669
|
+
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 : "",
|
|
101670
|
+
isBundle: !isDidYouMean && productType === "bundle",
|
|
101671
|
+
isDidYouMean: isDidYouMean,
|
|
101672
|
+
isOutOfStock: !isDidYouMean && Boolean(outOfStock)
|
|
101673
|
+
};
|
|
101674
|
+
}
|
|
101675
|
+
function getSeeMoreResultsPayload(query, totalResultsCount, suggestions) {
|
|
101676
|
+
return {
|
|
101677
|
+
query: query,
|
|
101678
|
+
source: "autocomplete-footer",
|
|
101679
|
+
totalResultsCount: totalResultsCount,
|
|
101680
|
+
visibleResultsCount: suggestions.length
|
|
101681
|
+
};
|
|
101682
|
+
}
|
|
101683
|
+
function getStatusMessage(_ref22) {
|
|
101684
|
+
var loading = _ref22.loading,
|
|
101685
|
+
emptyFetched = _ref22.emptyFetched,
|
|
101686
|
+
hasQuery = _ref22.hasQuery,
|
|
101687
|
+
noSuggestionsText = _ref22.noSuggestionsText,
|
|
101688
|
+
suggestions = _ref22.suggestions;
|
|
101689
|
+
if (loading) {
|
|
101690
|
+
return "Loading suggestions";
|
|
101691
|
+
}
|
|
101692
|
+
if (emptyFetched && hasQuery) {
|
|
101693
|
+
return noSuggestionsText;
|
|
101694
|
+
}
|
|
101695
|
+
if (suggestions.length > 0) {
|
|
101696
|
+
return "".concat(suggestions.length, " suggestions");
|
|
101697
|
+
}
|
|
101698
|
+
return "";
|
|
101699
|
+
}
|
|
101700
|
+
;// ./src/components/auto-complete/hooks/useAutoCompleteSuggestions.js
|
|
101701
|
+
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 }; })(); }
|
|
101702
|
+
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); }
|
|
101703
|
+
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); }
|
|
101704
|
+
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); }); }; }
|
|
101705
|
+
function useAutoCompleteSuggestions_slicedToArray(r, e) { return useAutoCompleteSuggestions_arrayWithHoles(r) || useAutoCompleteSuggestions_iterableToArrayLimit(r, e) || useAutoCompleteSuggestions_unsupportedIterableToArray(r, e) || useAutoCompleteSuggestions_nonIterableRest(); }
|
|
101706
|
+
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."); }
|
|
101707
|
+
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; } }
|
|
101708
|
+
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; }
|
|
101709
|
+
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; } }
|
|
101710
|
+
function useAutoCompleteSuggestions_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
101711
|
+
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; }
|
|
101712
|
+
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; }
|
|
101713
|
+
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; }
|
|
101714
|
+
function useAutoCompleteSuggestions_toPropertyKey(t) { var i = useAutoCompleteSuggestions_toPrimitive(t, "string"); return "symbol" == useAutoCompleteSuggestions_typeof(i) ? i : i + ""; }
|
|
101715
|
+
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); }
|
|
101716
|
+
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); }
|
|
101717
|
+
|
|
101718
|
+
|
|
101719
|
+
|
|
101720
|
+
function normalizeDidYouMean(didYouMean) {
|
|
101721
|
+
if (!Array.isArray(didYouMean)) {
|
|
101722
|
+
return [];
|
|
101723
|
+
}
|
|
101724
|
+
return didYouMean.map(function (item, index) {
|
|
101725
|
+
if (typeof item === "string") {
|
|
101726
|
+
return {
|
|
101727
|
+
id: "did-you-mean-".concat(index, "-").concat(item),
|
|
101728
|
+
value: item,
|
|
101729
|
+
suggestionType: "did-you-mean"
|
|
101730
|
+
};
|
|
101731
|
+
}
|
|
101732
|
+
if (item && useAutoCompleteSuggestions_typeof(item) === "object") {
|
|
101733
|
+
var _item$id, _ref, _item$value;
|
|
101734
|
+
return useAutoCompleteSuggestions_objectSpread(useAutoCompleteSuggestions_objectSpread({}, item), {}, {
|
|
101735
|
+
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 : ""),
|
|
101736
|
+
suggestionType: "did-you-mean"
|
|
101737
|
+
});
|
|
101738
|
+
}
|
|
101739
|
+
return null;
|
|
101740
|
+
}).filter(Boolean);
|
|
101741
|
+
}
|
|
101742
|
+
function normalizeSuggestionsResponse(response) {
|
|
101743
|
+
if (Array.isArray(response)) {
|
|
101744
|
+
return {
|
|
101745
|
+
suggestions: response,
|
|
101746
|
+
didYouMean: []
|
|
101747
|
+
};
|
|
101748
|
+
}
|
|
101749
|
+
if (!response || useAutoCompleteSuggestions_typeof(response) !== "object") {
|
|
101750
|
+
return {
|
|
101751
|
+
suggestions: [],
|
|
101752
|
+
didYouMean: []
|
|
101753
|
+
};
|
|
101754
|
+
}
|
|
101755
|
+
if (Array.isArray(response.product)) {
|
|
101756
|
+
var _response$didYouMean;
|
|
101757
|
+
return {
|
|
101758
|
+
suggestions: response.product.map(function (product, index) {
|
|
101759
|
+
return mapCatalogProductToSuggestion(product, index);
|
|
101760
|
+
}).filter(Boolean),
|
|
101761
|
+
didYouMean: normalizeDidYouMean((_response$didYouMean = response.didYouMean) !== null && _response$didYouMean !== void 0 ? _response$didYouMean : response.did_you_mean)
|
|
101762
|
+
};
|
|
101763
|
+
}
|
|
101764
|
+
return {
|
|
101765
|
+
suggestions: Array.isArray(response.suggestions) ? response.suggestions : [],
|
|
101766
|
+
didYouMean: normalizeDidYouMean(response.didYouMean)
|
|
101767
|
+
};
|
|
101768
|
+
}
|
|
101769
|
+
function useAutoCompleteSuggestions(_ref2) {
|
|
101770
|
+
var headerSearchService = _ref2.headerSearchService,
|
|
101771
|
+
_ref2$enabled = _ref2.enabled,
|
|
101772
|
+
enabled = _ref2$enabled === void 0 ? true : _ref2$enabled;
|
|
101773
|
+
var _useState = (0,external_react_.useState)(""),
|
|
101774
|
+
_useState2 = useAutoCompleteSuggestions_slicedToArray(_useState, 2),
|
|
101775
|
+
query = _useState2[0],
|
|
101776
|
+
setQuery = _useState2[1];
|
|
101777
|
+
var _useState3 = (0,external_react_.useState)([]),
|
|
101778
|
+
_useState4 = useAutoCompleteSuggestions_slicedToArray(_useState3, 2),
|
|
101779
|
+
suggestions = _useState4[0],
|
|
101780
|
+
setSuggestions = _useState4[1];
|
|
101781
|
+
var _useState5 = (0,external_react_.useState)([]),
|
|
101782
|
+
_useState6 = useAutoCompleteSuggestions_slicedToArray(_useState5, 2),
|
|
101783
|
+
didYouMean = _useState6[0],
|
|
101784
|
+
setDidYouMean = _useState6[1];
|
|
101785
|
+
var _useState7 = (0,external_react_.useState)(false),
|
|
101786
|
+
_useState8 = useAutoCompleteSuggestions_slicedToArray(_useState7, 2),
|
|
101787
|
+
loading = _useState8[0],
|
|
101788
|
+
setLoading = _useState8[1];
|
|
101789
|
+
var _useState9 = (0,external_react_.useState)(false),
|
|
101790
|
+
_useState0 = useAutoCompleteSuggestions_slicedToArray(_useState9, 2),
|
|
101791
|
+
emptyFetched = _useState0[0],
|
|
101792
|
+
setEmptyFetched = _useState0[1];
|
|
101793
|
+
var _useState1 = (0,external_react_.useState)(false),
|
|
101794
|
+
_useState10 = useAutoCompleteSuggestions_slicedToArray(_useState1, 2),
|
|
101795
|
+
hasMoreResults = _useState10[0],
|
|
101796
|
+
setHasMoreResults = _useState10[1];
|
|
101797
|
+
var _useState11 = (0,external_react_.useState)(0),
|
|
101798
|
+
_useState12 = useAutoCompleteSuggestions_slicedToArray(_useState11, 2),
|
|
101799
|
+
totalResultsCount = _useState12[0],
|
|
101800
|
+
setTotalResultsCount = _useState12[1];
|
|
101801
|
+
var fetchDebounced = (0,external_react_.useRef)(null);
|
|
101802
|
+
var latestRequestId = (0,external_react_.useRef)(0);
|
|
101803
|
+
var resetSuggestionsState = (0,external_react_.useCallback)(function () {
|
|
101804
|
+
setSuggestions([]);
|
|
101805
|
+
setDidYouMean([]);
|
|
101806
|
+
setEmptyFetched(false);
|
|
101807
|
+
setHasMoreResults(false);
|
|
101808
|
+
setTotalResultsCount(0);
|
|
101809
|
+
setLoading(false);
|
|
101810
|
+
}, []);
|
|
101811
|
+
var updateQuery = (0,external_react_.useCallback)(function (nextQuery) {
|
|
101812
|
+
var hasNextQuery = Boolean(nextQuery.trim());
|
|
101813
|
+
// Keep currently visible results during typing to prevent panel flicker.
|
|
101814
|
+
setEmptyFetched(false);
|
|
101815
|
+
setLoading(enabled && hasNextQuery);
|
|
101816
|
+
setQuery(nextQuery);
|
|
101817
|
+
}, [enabled]);
|
|
101818
|
+
var clearQuery = (0,external_react_.useCallback)(function () {
|
|
101819
|
+
resetSuggestionsState();
|
|
101820
|
+
setQuery("");
|
|
101821
|
+
}, [resetSuggestionsState]);
|
|
101822
|
+
var runFetch = (0,external_react_.useCallback)(/*#__PURE__*/function () {
|
|
101823
|
+
var _ref3 = useAutoCompleteSuggestions_asyncToGenerator(/*#__PURE__*/useAutoCompleteSuggestions_regenerator().m(function _callee(nextQuery) {
|
|
101824
|
+
var trimmedQuery, requestId, _ref4, _fetchedSuggestions$t, _fetchedSuggestions$p, fetchedSuggestions, _normalizeSuggestions, allSuggestions, suggestedTerms, visibleSuggestions, hasDidYouMean, normalizedTotalResultsCount, effectiveTotalResultsCount, _t;
|
|
101825
|
+
return useAutoCompleteSuggestions_regenerator().w(function (_context) {
|
|
101826
|
+
while (1) switch (_context.p = _context.n) {
|
|
101827
|
+
case 0:
|
|
101828
|
+
trimmedQuery = nextQuery.trim();
|
|
101829
|
+
requestId = latestRequestId.current + 1;
|
|
101830
|
+
latestRequestId.current = requestId;
|
|
101831
|
+
if (trimmedQuery) {
|
|
101832
|
+
_context.n = 1;
|
|
101833
|
+
break;
|
|
101834
|
+
}
|
|
101835
|
+
resetSuggestionsState();
|
|
101836
|
+
return _context.a(2);
|
|
101837
|
+
case 1:
|
|
101838
|
+
if (enabled) {
|
|
101839
|
+
_context.n = 2;
|
|
101840
|
+
break;
|
|
101841
|
+
}
|
|
101842
|
+
resetSuggestionsState();
|
|
101843
|
+
return _context.a(2);
|
|
101844
|
+
case 2:
|
|
101845
|
+
setLoading(true);
|
|
101846
|
+
setEmptyFetched(false);
|
|
101847
|
+
_context.p = 3;
|
|
101848
|
+
_context.n = 4;
|
|
101849
|
+
return headerSearchService.fetchSuggestions(trimmedQuery);
|
|
101850
|
+
case 4:
|
|
101851
|
+
fetchedSuggestions = _context.v;
|
|
101852
|
+
if (!(requestId !== latestRequestId.current)) {
|
|
101853
|
+
_context.n = 5;
|
|
101854
|
+
break;
|
|
101855
|
+
}
|
|
101856
|
+
return _context.a(2);
|
|
101857
|
+
case 5:
|
|
101858
|
+
_normalizeSuggestions = normalizeSuggestionsResponse(fetchedSuggestions), allSuggestions = _normalizeSuggestions.suggestions, suggestedTerms = _normalizeSuggestions.didYouMean;
|
|
101859
|
+
visibleSuggestions = allSuggestions.slice(0, MAX_VISIBLE_SUGGESTIONS);
|
|
101860
|
+
hasDidYouMean = suggestedTerms.length > 0;
|
|
101861
|
+
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;
|
|
101862
|
+
effectiveTotalResultsCount = hasDidYouMean ? suggestedTerms.length : Math.max(normalizedTotalResultsCount, allSuggestions.length);
|
|
101863
|
+
setDidYouMean(suggestedTerms);
|
|
101864
|
+
setSuggestions(hasDidYouMean ? [] : visibleSuggestions);
|
|
101865
|
+
setHasMoreResults(!hasDidYouMean && effectiveTotalResultsCount > MAX_VISIBLE_SUGGESTIONS);
|
|
101866
|
+
setTotalResultsCount(effectiveTotalResultsCount);
|
|
101867
|
+
setEmptyFetched(hasDidYouMean ? false : visibleSuggestions.length === 0 && suggestedTerms.length === 0);
|
|
101868
|
+
_context.n = 8;
|
|
101869
|
+
break;
|
|
101870
|
+
case 6:
|
|
101871
|
+
_context.p = 6;
|
|
101872
|
+
_t = _context.v;
|
|
101873
|
+
if (!(requestId !== latestRequestId.current)) {
|
|
101874
|
+
_context.n = 7;
|
|
101875
|
+
break;
|
|
101876
|
+
}
|
|
101877
|
+
return _context.a(2);
|
|
101878
|
+
case 7:
|
|
101879
|
+
setSuggestions([]);
|
|
101880
|
+
setDidYouMean([]);
|
|
101881
|
+
setEmptyFetched(true);
|
|
101882
|
+
setHasMoreResults(false);
|
|
101883
|
+
setTotalResultsCount(0);
|
|
101884
|
+
case 8:
|
|
101885
|
+
_context.p = 8;
|
|
101886
|
+
if (requestId === latestRequestId.current) {
|
|
101887
|
+
setLoading(false);
|
|
101888
|
+
}
|
|
101889
|
+
return _context.f(8);
|
|
101890
|
+
case 9:
|
|
101891
|
+
return _context.a(2);
|
|
101892
|
+
}
|
|
101893
|
+
}, _callee, null, [[3, 6, 8, 9]]);
|
|
101894
|
+
}));
|
|
101895
|
+
return function (_x) {
|
|
101896
|
+
return _ref3.apply(this, arguments);
|
|
101897
|
+
};
|
|
101898
|
+
}(), [enabled, headerSearchService, resetSuggestionsState]);
|
|
101899
|
+
(0,external_react_.useEffect)(function () {
|
|
101900
|
+
if (!enabled) {
|
|
101901
|
+
resetSuggestionsState();
|
|
101902
|
+
return undefined;
|
|
101903
|
+
}
|
|
101904
|
+
if (fetchDebounced.current) {
|
|
101905
|
+
clearTimeout(fetchDebounced.current);
|
|
101070
101906
|
}
|
|
101907
|
+
fetchDebounced.current = setTimeout(function () {
|
|
101908
|
+
runFetch(query);
|
|
101909
|
+
}, DEBOUNCE_MS);
|
|
101910
|
+
return function () {
|
|
101911
|
+
if (fetchDebounced.current) {
|
|
101912
|
+
clearTimeout(fetchDebounced.current);
|
|
101913
|
+
}
|
|
101914
|
+
};
|
|
101915
|
+
}, [enabled, query, resetSuggestionsState, runFetch]);
|
|
101916
|
+
return {
|
|
101917
|
+
clearQuery: clearQuery,
|
|
101918
|
+
emptyFetched: emptyFetched,
|
|
101919
|
+
hasMoreResults: hasMoreResults,
|
|
101920
|
+
hasQuery: Boolean(query.trim()),
|
|
101921
|
+
didYouMean: didYouMean,
|
|
101922
|
+
loading: loading,
|
|
101923
|
+
query: query,
|
|
101924
|
+
setQuery: setQuery,
|
|
101925
|
+
suggestions: suggestions,
|
|
101926
|
+
totalResultsCount: totalResultsCount,
|
|
101927
|
+
updateQuery: updateQuery
|
|
101928
|
+
};
|
|
101929
|
+
}
|
|
101930
|
+
;// ./src/components/auto-complete/AutoComplete.styled.js
|
|
101931
|
+
|
|
101932
|
+
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)."; }
|
|
101933
|
+
|
|
101934
|
+
var SearchAutoCompleteRoot = /*#__PURE__*/createStyled("div", true ? {
|
|
101935
|
+
target: "eav54yv27"
|
|
101936
|
+
} : 0)( true ? {
|
|
101937
|
+
name: "pw7jst",
|
|
101938
|
+
styles: "position:relative;width:100%"
|
|
101939
|
+
} : 0);
|
|
101940
|
+
var SearchFieldToolbar = /*#__PURE__*/createStyled("div", true ? {
|
|
101941
|
+
target: "eav54yv26"
|
|
101942
|
+
} : 0)("display:flex;align-items:center;gap:12px;width:100%;min-width:0;box-sizing:border-box;", function (_ref) {
|
|
101943
|
+
var $modalLayout = _ref.$modalLayout;
|
|
101944
|
+
return $modalLayout ? "\n @media (max-width: 1023px) {\n padding: 0 20px 12px;\n }\n " : "";
|
|
101945
|
+
}, ";" + ( true ? "" : 0));
|
|
101946
|
+
var SearchFieldGrow = /*#__PURE__*/createStyled("div", true ? {
|
|
101947
|
+
target: "eav54yv25"
|
|
101948
|
+
} : 0)( true ? {
|
|
101949
|
+
name: "fxp7t8",
|
|
101950
|
+
styles: "flex:1;min-width:0"
|
|
101951
|
+
} : 0);
|
|
101952
|
+
var SearchSuggestionsStatus = /*#__PURE__*/createStyled("span", true ? {
|
|
101953
|
+
target: "eav54yv24"
|
|
101954
|
+
} : 0)( true ? {
|
|
101955
|
+
name: "1dja9su",
|
|
101956
|
+
styles: "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0"
|
|
101957
|
+
} : 0);
|
|
101958
|
+
var SearchSuggestionsPanel = /*#__PURE__*/createStyled("div", true ? {
|
|
101959
|
+
target: "eav54yv23"
|
|
101960
|
+
} : 0)( true ? {
|
|
101961
|
+
name: "177e0cn",
|
|
101962
|
+
styles: "position:relative;width:100%;margin-top:8px;padding:0"
|
|
101963
|
+
} : 0);
|
|
101964
|
+
var SearchSuggestionsList = /*#__PURE__*/createStyled("ul", true ? {
|
|
101965
|
+
target: "eav54yv22"
|
|
101966
|
+
} : 0)( true ? {
|
|
101967
|
+
name: "4jaldj",
|
|
101968
|
+
styles: "display:flex;flex-direction:column;list-style:none;margin:0;padding:0"
|
|
101969
|
+
} : 0);
|
|
101970
|
+
var SearchSuggestionOption = /*#__PURE__*/createStyled("li", true ? {
|
|
101971
|
+
target: "eav54yv21"
|
|
101972
|
+
} : 0)("display:flex;align-items:center;width:100%;min-height:58px;padding:4px 24px;box-sizing:border-box;color:", colors.text, ";" + ( true ? "" : 0));
|
|
101973
|
+
var AutoCompleteRoot = /*#__PURE__*/createStyled(SearchAutoCompleteRoot, true ? {
|
|
101974
|
+
target: "eav54yv20"
|
|
101975
|
+
} : 0)( true ? {
|
|
101976
|
+
name: "12ret95",
|
|
101977
|
+
styles: "max-width:936px;margin:0 auto"
|
|
101978
|
+
} : 0);
|
|
101979
|
+
var AutoCompletePillForm = /*#__PURE__*/createStyled(SearchPillForm, true ? {
|
|
101980
|
+
target: "eav54yv19"
|
|
101981
|
+
} : 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));
|
|
101982
|
+
var ClearSearchButton = /*#__PURE__*/createStyled("button", true ? {
|
|
101983
|
+
target: "eav54yv18"
|
|
101984
|
+
} : 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));
|
|
101985
|
+
var SearchIconButton = /*#__PURE__*/createStyled("button", true ? {
|
|
101986
|
+
target: "eav54yv17"
|
|
101987
|
+
} : 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));
|
|
101988
|
+
var PassiveSuggestionOption = /*#__PURE__*/createStyled(SearchSuggestionOption, true ? {
|
|
101989
|
+
target: "eav54yv16"
|
|
101990
|
+
} : 0)("cursor:default;color:var(--autocomplete-muted, ", colors.muted, ");" + ( true ? "" : 0));
|
|
101991
|
+
var SuggestionSectionHeading = /*#__PURE__*/createStyled("div", true ? {
|
|
101992
|
+
target: "eav54yv15"
|
|
101993
|
+
} : 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));
|
|
101994
|
+
var SuggestionRow = /*#__PURE__*/createStyled(SearchSuggestionOption, true ? {
|
|
101995
|
+
target: "eav54yv14"
|
|
101996
|
+
} : 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));
|
|
101997
|
+
var SuggestionContentWrapper = /*#__PURE__*/createStyled("div", true ? {
|
|
101998
|
+
target: "eav54yv13"
|
|
101999
|
+
} : 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));
|
|
102000
|
+
var SuggestionThumbnail = /*#__PURE__*/createStyled("img", true ? {
|
|
102001
|
+
target: "eav54yv12"
|
|
102002
|
+
} : 0)( true ? {
|
|
102003
|
+
name: "foo4t4",
|
|
102004
|
+
styles: "width:24px;height:24px;object-fit:contain;flex-shrink:0;align-self:center"
|
|
102005
|
+
} : 0);
|
|
102006
|
+
var SuggestionLabel = /*#__PURE__*/createStyled("span", true ? {
|
|
102007
|
+
target: "eav54yv11"
|
|
102008
|
+
} : 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));
|
|
102009
|
+
var SuggestionActionIcon = /*#__PURE__*/createStyled("span", true ? {
|
|
102010
|
+
target: "eav54yv10"
|
|
102011
|
+
} : 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));
|
|
102012
|
+
var SuggestionActionButton = /*#__PURE__*/createStyled("button", true ? {
|
|
102013
|
+
target: "eav54yv9"
|
|
102014
|
+
} : 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));
|
|
102015
|
+
var SeeMoreLinkContainer = /*#__PURE__*/createStyled("div", true ? {
|
|
102016
|
+
target: "eav54yv8"
|
|
102017
|
+
} : 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));
|
|
102018
|
+
var SeeMoreLinkText = /*#__PURE__*/createStyled("button", true ? {
|
|
102019
|
+
target: "eav54yv7"
|
|
102020
|
+
} : 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));
|
|
102021
|
+
var RecentSearchesSection = /*#__PURE__*/createStyled("section", true ? {
|
|
102022
|
+
target: "eav54yv6"
|
|
102023
|
+
} : 0)("padding:24px 35px 18px;background:", colors.surface, ";@media (max-width: 767px){padding:18px 20px 16px;}" + ( true ? "" : 0));
|
|
102024
|
+
var RecentSearchesHeader = /*#__PURE__*/createStyled("div", true ? {
|
|
102025
|
+
target: "eav54yv5"
|
|
102026
|
+
} : 0)( true ? {
|
|
102027
|
+
name: "1fei6vq",
|
|
102028
|
+
styles: "display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:13px"
|
|
102029
|
+
} : 0);
|
|
102030
|
+
var RecentSearchesTitle = /*#__PURE__*/createStyled("h3", true ? {
|
|
102031
|
+
target: "eav54yv4"
|
|
102032
|
+
} : 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));
|
|
102033
|
+
var RecentSearchesClearButton = /*#__PURE__*/createStyled("button", true ? {
|
|
102034
|
+
target: "eav54yv3"
|
|
102035
|
+
} : 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));
|
|
102036
|
+
var RecentSearchesList = /*#__PURE__*/createStyled("div", true ? {
|
|
102037
|
+
target: "eav54yv2"
|
|
102038
|
+
} : 0)( true ? {
|
|
102039
|
+
name: "wmzzp",
|
|
102040
|
+
styles: "display:flex;flex-wrap:wrap;gap:10px"
|
|
102041
|
+
} : 0);
|
|
102042
|
+
var RecentSearchChip = /*#__PURE__*/createStyled("button", true ? {
|
|
102043
|
+
target: "eav54yv1"
|
|
102044
|
+
} : 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));
|
|
102045
|
+
var RecentSearchOverflowChip = /*#__PURE__*/createStyled(RecentSearchChip, true ? {
|
|
102046
|
+
target: "eav54yv0"
|
|
102047
|
+
} : 0)( true ? {
|
|
102048
|
+
name: "1rws4xn",
|
|
102049
|
+
styles: "cursor:pointer;&:hover{background:#f3f4f6;}"
|
|
102050
|
+
} : 0);
|
|
102051
|
+
;// ./src/components/auto-complete/utils/AutoCompleteIcons.jsx
|
|
102052
|
+
var _excluded = ["fillColor"],
|
|
102053
|
+
_excluded2 = ["fillColor"];
|
|
102054
|
+
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); }
|
|
102055
|
+
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; }
|
|
102056
|
+
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; }
|
|
102057
|
+
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; }
|
|
102058
|
+
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; }
|
|
102059
|
+
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; }
|
|
102060
|
+
function AutoCompleteIcons_toPropertyKey(t) { var i = AutoCompleteIcons_toPrimitive(t, "string"); return "symbol" == AutoCompleteIcons_typeof(i) ? i : i + ""; }
|
|
102061
|
+
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); }
|
|
102062
|
+
|
|
102063
|
+
|
|
102064
|
+
|
|
102065
|
+
function AutoCompleteCloseIcon(props) {
|
|
102066
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", AutoCompleteIcons_objectSpread(AutoCompleteIcons_objectSpread({}, props), {}, {
|
|
102067
|
+
width: "16",
|
|
102068
|
+
height: "16",
|
|
102069
|
+
viewBox: "0 0 16 16",
|
|
102070
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
102071
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
102072
|
+
d: "M4 4L12 12M12 4L4 12",
|
|
102073
|
+
stroke: "currentColor",
|
|
102074
|
+
strokeWidth: "1.8",
|
|
102075
|
+
strokeLinecap: "round"
|
|
102076
|
+
})
|
|
102077
|
+
}));
|
|
102078
|
+
}
|
|
102079
|
+
function AutoCompleteCartIcon(_ref) {
|
|
102080
|
+
var _ref$fillColor = _ref.fillColor,
|
|
102081
|
+
fillColor = _ref$fillColor === void 0 ? "currentColor" : _ref$fillColor,
|
|
102082
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
102083
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)("svg", AutoCompleteIcons_objectSpread(AutoCompleteIcons_objectSpread({}, props), {}, {
|
|
102084
|
+
width: "24",
|
|
102085
|
+
height: "24",
|
|
102086
|
+
viewBox: "0 0 24 24",
|
|
102087
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
102088
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
102089
|
+
fillRule: "evenodd",
|
|
102090
|
+
clipRule: "evenodd",
|
|
102091
|
+
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",
|
|
102092
|
+
fill: fillColor
|
|
102093
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
102094
|
+
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",
|
|
102095
|
+
fill: fillColor
|
|
102096
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
102097
|
+
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",
|
|
102098
|
+
fill: fillColor
|
|
102099
|
+
})]
|
|
102100
|
+
}));
|
|
102101
|
+
}
|
|
102102
|
+
AutoCompleteCartIcon.propTypes = {
|
|
102103
|
+
fillColor: external_prop_types_["default"].string
|
|
102104
|
+
};
|
|
102105
|
+
function AutoCompleteTaskIcon(_ref2) {
|
|
102106
|
+
var _ref2$fillColor = _ref2.fillColor,
|
|
102107
|
+
fillColor = _ref2$fillColor === void 0 ? "currentColor" : _ref2$fillColor,
|
|
102108
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
102109
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)("svg", AutoCompleteIcons_objectSpread(AutoCompleteIcons_objectSpread({}, props), {}, {
|
|
102110
|
+
width: "24",
|
|
102111
|
+
height: "24",
|
|
102112
|
+
viewBox: "0 0 24 24",
|
|
102113
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
102114
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
|
|
102115
|
+
fillRule: "evenodd",
|
|
102116
|
+
clipRule: "evenodd",
|
|
102117
|
+
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",
|
|
102118
|
+
fill: fillColor
|
|
102119
|
+
})
|
|
102120
|
+
}));
|
|
102121
|
+
}
|
|
102122
|
+
AutoCompleteTaskIcon.propTypes = {
|
|
102123
|
+
fillColor: external_prop_types_["default"].string
|
|
102124
|
+
};
|
|
102125
|
+
;// ./src/components/auto-complete/AutoCompleteSearchField.jsx
|
|
102126
|
+
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); }
|
|
102127
|
+
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; }
|
|
102128
|
+
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; }
|
|
102129
|
+
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; }
|
|
102130
|
+
function AutoCompleteSearchField_toPropertyKey(t) { var i = AutoCompleteSearchField_toPrimitive(t, "string"); return "symbol" == AutoCompleteSearchField_typeof(i) ? i : i + ""; }
|
|
102131
|
+
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); }
|
|
102132
|
+
|
|
102133
|
+
|
|
102134
|
+
|
|
102135
|
+
|
|
102136
|
+
|
|
102137
|
+
|
|
102138
|
+
|
|
102139
|
+
|
|
102140
|
+
function AutoCompleteSearchField(_ref) {
|
|
102141
|
+
var _parent$$autoComplete;
|
|
102142
|
+
var activeDescendantId = _ref.activeDescendantId,
|
|
102143
|
+
clearSearch = _ref.clearSearch,
|
|
102144
|
+
copy = _ref.copy,
|
|
102145
|
+
inputRef = _ref.inputRef,
|
|
102146
|
+
listboxId = _ref.listboxId,
|
|
102147
|
+
onChange = _ref.onChange,
|
|
102148
|
+
onInputKeyDown = _ref.onInputKeyDown,
|
|
102149
|
+
onSubmit = _ref.onSubmit,
|
|
102150
|
+
query = _ref.query,
|
|
102151
|
+
showPanel = _ref.showPanel,
|
|
102152
|
+
statusId = _ref.statusId,
|
|
102153
|
+
parent$ = _ref.parent$;
|
|
102154
|
+
var formAriaLabel = getCopyValue(copy, "form_aria_label", "formAriaLabel", "Site search");
|
|
102155
|
+
var inputAriaLabel = getCopyValue(copy, "input_aria_label", "inputAriaLabel", "Product search");
|
|
102156
|
+
var hasQuery = Boolean(String(query !== null && query !== void 0 ? query : "").trim());
|
|
102157
|
+
var editing = isEditingMode();
|
|
102158
|
+
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;
|
|
102159
|
+
var autoCompleteSearchIconTag = parent$ === null || parent$ === void 0 ? void 0 : parent$.autoCompleteSearchIcon;
|
|
102160
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(AutoCompletePillForm, {
|
|
102161
|
+
onSubmit: onSubmit,
|
|
102162
|
+
role: "search",
|
|
102163
|
+
"aria-label": formAriaLabel,
|
|
102164
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(SearchIconButton, AutoCompleteSearchField_objectSpread(AutoCompleteSearchField_objectSpread({
|
|
102165
|
+
type: "button",
|
|
102166
|
+
"aria-label": "Search",
|
|
102167
|
+
"data-testid": "autocomplete-search-button"
|
|
102168
|
+
}, autoCompleteSearchIconTag !== null && autoCompleteSearchIconTag !== void 0 ? autoCompleteSearchIconTag : {}), {}, {
|
|
102169
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Search/* default */.A, {
|
|
102170
|
+
fontSize: "inherit",
|
|
102171
|
+
"aria-hidden": true,
|
|
102172
|
+
"data-testid": "autocomplete-search-icon"
|
|
102173
|
+
})
|
|
102174
|
+
})), /*#__PURE__*/(0,jsx_runtime_.jsx)("input", AutoCompleteSearchField_objectSpread(AutoCompleteSearchField_objectSpread({
|
|
102175
|
+
ref: inputRef,
|
|
102176
|
+
type: "search",
|
|
102177
|
+
name: "header-product-search",
|
|
102178
|
+
"data-testid": "autocomplete-input",
|
|
102179
|
+
autoComplete: "off",
|
|
102180
|
+
autoCorrect: "off",
|
|
102181
|
+
spellCheck: "false",
|
|
102182
|
+
role: "combobox",
|
|
102183
|
+
"aria-label": inputAriaLabel,
|
|
102184
|
+
"aria-autocomplete": "list",
|
|
102185
|
+
"aria-expanded": showPanel,
|
|
102186
|
+
"aria-controls": listboxId
|
|
102187
|
+
}, activeDescendantId ? {
|
|
102188
|
+
"aria-activedescendant": activeDescendantId
|
|
102189
|
+
} : {}), {}, {
|
|
102190
|
+
"aria-describedby": statusId,
|
|
102191
|
+
placeholder: copy.placeholder,
|
|
102192
|
+
value: query,
|
|
102193
|
+
onChange: onChange,
|
|
102194
|
+
onKeyDown: onInputKeyDown
|
|
102195
|
+
}, editing ? autoCompleteTextboxTag : undefined)), hasQuery ? /*#__PURE__*/(0,jsx_runtime_.jsx)(ClearSearchButton, {
|
|
102196
|
+
type: "button",
|
|
102197
|
+
"data-testid": "autocomplete-clear-button",
|
|
102198
|
+
"aria-label": "Clear search",
|
|
102199
|
+
onClick: clearSearch,
|
|
102200
|
+
tabIndex: -1,
|
|
102201
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteCloseIcon, {
|
|
102202
|
+
"aria-hidden": true
|
|
102203
|
+
})
|
|
102204
|
+
}) : null]
|
|
102205
|
+
});
|
|
102206
|
+
}
|
|
102207
|
+
AutoCompleteSearchField.propTypes = {
|
|
102208
|
+
activeDescendantId: external_prop_types_["default"].string,
|
|
102209
|
+
clearSearch: external_prop_types_["default"].func.isRequired,
|
|
102210
|
+
copy: external_prop_types_["default"].shape({
|
|
102211
|
+
form_aria_label: external_prop_types_["default"].string,
|
|
102212
|
+
formAriaLabel: external_prop_types_["default"].string,
|
|
102213
|
+
input_aria_label: external_prop_types_["default"].string,
|
|
102214
|
+
inputAriaLabel: external_prop_types_["default"].string,
|
|
102215
|
+
placeholder: external_prop_types_["default"].string.isRequired
|
|
102216
|
+
}).isRequired,
|
|
102217
|
+
inputRef: external_prop_types_["default"].shape({
|
|
102218
|
+
current: external_prop_types_["default"].any
|
|
102219
|
+
}).isRequired,
|
|
102220
|
+
listboxId: external_prop_types_["default"].string.isRequired,
|
|
102221
|
+
onChange: external_prop_types_["default"].func.isRequired,
|
|
102222
|
+
onInputKeyDown: external_prop_types_["default"].func.isRequired,
|
|
102223
|
+
onSubmit: external_prop_types_["default"].func.isRequired,
|
|
102224
|
+
query: external_prop_types_["default"].string.isRequired,
|
|
102225
|
+
showPanel: external_prop_types_["default"].bool.isRequired,
|
|
102226
|
+
statusId: external_prop_types_["default"].string.isRequired,
|
|
102227
|
+
parent$: external_prop_types_["default"].object
|
|
102228
|
+
};
|
|
102229
|
+
;// ./src/components/auto-complete/AutoCompleteSuggestionRow.jsx
|
|
102230
|
+
|
|
102231
|
+
|
|
102232
|
+
|
|
102233
|
+
|
|
102234
|
+
|
|
102235
|
+
|
|
102236
|
+
function renderSuggestionAction(_ref) {
|
|
102237
|
+
var suggestionOption = _ref.suggestionOption,
|
|
102238
|
+
suggestionIndex = _ref.suggestionIndex,
|
|
102239
|
+
displayLabel = _ref.displayLabel,
|
|
102240
|
+
isBundle = _ref.isBundle,
|
|
102241
|
+
isOutOfStock = _ref.isOutOfStock,
|
|
102242
|
+
onHighlightSuggestion = _ref.onHighlightSuggestion,
|
|
102243
|
+
onRunSuggestionAction = _ref.onRunSuggestionAction;
|
|
102244
|
+
var actionTestId = "suggestion-icon-".concat(suggestionOption.id);
|
|
102245
|
+
var suggestionType = isBundle ? "bundle" : "single";
|
|
102246
|
+
if (isOutOfStock) {
|
|
102247
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(SuggestionActionIcon, {
|
|
102248
|
+
"data-testid": actionTestId,
|
|
102249
|
+
"data-suggestion-type": suggestionType,
|
|
102250
|
+
"data-out-of-stock": "true",
|
|
102251
|
+
children: isBundle ? /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteTaskIcon, {
|
|
102252
|
+
"aria-hidden": true,
|
|
102253
|
+
"data-testid": "suggestion-bundle-icon-".concat(suggestionOption.id),
|
|
102254
|
+
fillColor: "currentColor"
|
|
102255
|
+
}) : /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteCartIcon, {
|
|
102256
|
+
"aria-hidden": true,
|
|
102257
|
+
"data-testid": "suggestion-cart-icon-".concat(suggestionOption.id),
|
|
102258
|
+
fillColor: "currentColor"
|
|
102259
|
+
})
|
|
102260
|
+
});
|
|
101071
102261
|
}
|
|
102262
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(SuggestionActionButton, {
|
|
102263
|
+
type: "button",
|
|
102264
|
+
"data-testid": actionTestId,
|
|
102265
|
+
"data-suggestion-type": suggestionType,
|
|
102266
|
+
"aria-label": isBundle ? "Open bundle action for ".concat(displayLabel) : "Add ".concat(displayLabel, " to cart"),
|
|
102267
|
+
onFocus: function onFocus() {
|
|
102268
|
+
return onHighlightSuggestion(suggestionIndex);
|
|
102269
|
+
},
|
|
102270
|
+
onClick: function onClick(event) {
|
|
102271
|
+
event.stopPropagation();
|
|
102272
|
+
onRunSuggestionAction(suggestionOption);
|
|
102273
|
+
},
|
|
102274
|
+
children: isBundle ? /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteTaskIcon, {
|
|
102275
|
+
"aria-hidden": true,
|
|
102276
|
+
"data-testid": "suggestion-bundle-icon-".concat(suggestionOption.id),
|
|
102277
|
+
fillColor: "currentColor"
|
|
102278
|
+
}) : /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteCartIcon, {
|
|
102279
|
+
"aria-hidden": true,
|
|
102280
|
+
"data-testid": "suggestion-cart-icon-".concat(suggestionOption.id),
|
|
102281
|
+
fillColor: "currentColor"
|
|
102282
|
+
})
|
|
102283
|
+
});
|
|
102284
|
+
}
|
|
102285
|
+
function AutoCompleteSuggestionRow(_ref2) {
|
|
102286
|
+
var _suggestionOption$out, _ref3, _suggestionOption$sug;
|
|
102287
|
+
var inputRef = _ref2.inputRef,
|
|
102288
|
+
isHighlighted = _ref2.isHighlighted,
|
|
102289
|
+
isSelected = _ref2.isSelected,
|
|
102290
|
+
onHighlightSuggestion = _ref2.onHighlightSuggestion,
|
|
102291
|
+
onRunSuggestionAction = _ref2.onRunSuggestionAction,
|
|
102292
|
+
onSelectSuggestion = _ref2.onSelectSuggestion,
|
|
102293
|
+
registerSuggestionNode = _ref2.registerSuggestionNode,
|
|
102294
|
+
suggestionIndex = _ref2.suggestionIndex,
|
|
102295
|
+
suggestionOption = _ref2.suggestionOption,
|
|
102296
|
+
suggestionOptionId = _ref2.suggestionOptionId;
|
|
102297
|
+
var _getSuggestionDisplay = getSuggestionDisplayData(suggestionOption),
|
|
102298
|
+
imageSrc = _getSuggestionDisplay.imageSrc,
|
|
102299
|
+
displayLabel = _getSuggestionDisplay.displayLabel,
|
|
102300
|
+
isBundle = _getSuggestionDisplay.isBundle,
|
|
102301
|
+
isDidYouMean = _getSuggestionDisplay.isDidYouMean,
|
|
102302
|
+
isOutOfStock = _getSuggestionDisplay.isOutOfStock;
|
|
102303
|
+
var optionOutOfStock = (_suggestionOption$out = suggestionOption.out_of_stock) !== null && _suggestionOption$out !== void 0 ? _suggestionOption$out : suggestionOption.outOfStock;
|
|
102304
|
+
var suggestionType = (_ref3 = (_suggestionOption$sug = suggestionOption.suggestion_type) !== null && _suggestionOption$sug !== void 0 ? _suggestionOption$sug : suggestionOption.suggestionType) !== null && _ref3 !== void 0 ? _ref3 : "product";
|
|
102305
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(SuggestionRow, {
|
|
102306
|
+
id: suggestionOptionId,
|
|
102307
|
+
"data-testid": "suggestion-row-".concat(suggestionOption.id),
|
|
102308
|
+
"data-highlighted": isHighlighted ? "true" : "false",
|
|
102309
|
+
"data-selected": isSelected ? "true" : "false",
|
|
102310
|
+
"data-suggestion-type": suggestionType,
|
|
102311
|
+
onMouseEnter: function onMouseEnter() {
|
|
102312
|
+
return onHighlightSuggestion(suggestionIndex);
|
|
102313
|
+
},
|
|
102314
|
+
"data-out-of-stock": optionOutOfStock ? "true" : "false",
|
|
102315
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)(SuggestionContentWrapper, {
|
|
102316
|
+
ref: registerSuggestionNode,
|
|
102317
|
+
tabIndex: 0,
|
|
102318
|
+
"data-testid": "suggestion-content-".concat(suggestionOption.id),
|
|
102319
|
+
"data-suggestion-type": suggestionType,
|
|
102320
|
+
"data-out-of-stock": optionOutOfStock ? "true" : "false",
|
|
102321
|
+
onFocus: function onFocus() {
|
|
102322
|
+
return onHighlightSuggestion(suggestionIndex);
|
|
102323
|
+
},
|
|
102324
|
+
onClick: function onClick() {
|
|
102325
|
+
return onSelectSuggestion(suggestionOption);
|
|
102326
|
+
},
|
|
102327
|
+
onKeyDown: function onKeyDown(event) {
|
|
102328
|
+
if ((event.key === "Enter" || event.key === " ") && !optionOutOfStock) {
|
|
102329
|
+
event.preventDefault();
|
|
102330
|
+
onSelectSuggestion(suggestionOption);
|
|
102331
|
+
} else if (event.key === "Tab" && event.shiftKey) {
|
|
102332
|
+
var hasPreviousSuggestion = suggestionIndex > 0;
|
|
102333
|
+
if (!hasPreviousSuggestion) {
|
|
102334
|
+
var _inputRef$current;
|
|
102335
|
+
event.preventDefault();
|
|
102336
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
102337
|
+
}
|
|
102338
|
+
}
|
|
102339
|
+
},
|
|
102340
|
+
children: [imageSrc ? /*#__PURE__*/(0,jsx_runtime_.jsx)(SuggestionThumbnail, {
|
|
102341
|
+
src: imageSrc,
|
|
102342
|
+
alt: "",
|
|
102343
|
+
"aria-hidden": true,
|
|
102344
|
+
"data-testid": "suggestion-thumbnail-".concat(suggestionOption.id)
|
|
102345
|
+
}) : null, /*#__PURE__*/(0,jsx_runtime_.jsx)(SuggestionLabel, {
|
|
102346
|
+
children: displayLabel
|
|
102347
|
+
})]
|
|
102348
|
+
}), !isDidYouMean ? renderSuggestionAction({
|
|
102349
|
+
suggestionOption: suggestionOption,
|
|
102350
|
+
suggestionIndex: suggestionIndex,
|
|
102351
|
+
displayLabel: displayLabel,
|
|
102352
|
+
isBundle: isBundle,
|
|
102353
|
+
isOutOfStock: isOutOfStock,
|
|
102354
|
+
onHighlightSuggestion: onHighlightSuggestion,
|
|
102355
|
+
onRunSuggestionAction: onRunSuggestionAction
|
|
102356
|
+
}) : null]
|
|
102357
|
+
});
|
|
102358
|
+
}
|
|
102359
|
+
AutoCompleteSuggestionRow.propTypes = {
|
|
102360
|
+
inputRef: external_prop_types_["default"].shape({
|
|
102361
|
+
current: external_prop_types_["default"].any
|
|
102362
|
+
}).isRequired,
|
|
102363
|
+
isHighlighted: external_prop_types_["default"].bool.isRequired,
|
|
102364
|
+
isSelected: external_prop_types_["default"].bool.isRequired,
|
|
102365
|
+
onHighlightSuggestion: external_prop_types_["default"].func.isRequired,
|
|
102366
|
+
onRunSuggestionAction: external_prop_types_["default"].func.isRequired,
|
|
102367
|
+
onSelectSuggestion: external_prop_types_["default"].func.isRequired,
|
|
102368
|
+
registerSuggestionNode: external_prop_types_["default"].func.isRequired,
|
|
102369
|
+
suggestionIndex: external_prop_types_["default"].number.isRequired,
|
|
102370
|
+
suggestionOption: external_prop_types_["default"].shape({
|
|
102371
|
+
id: external_prop_types_["default"].string.isRequired,
|
|
102372
|
+
image: external_prop_types_["default"].string,
|
|
102373
|
+
image_url: external_prop_types_["default"].string,
|
|
102374
|
+
imageURL: external_prop_types_["default"].string,
|
|
102375
|
+
label: external_prop_types_["default"].string,
|
|
102376
|
+
out_of_stock: external_prop_types_["default"].bool,
|
|
102377
|
+
outOfStock: external_prop_types_["default"].bool,
|
|
102378
|
+
product_type: external_prop_types_["default"].string,
|
|
102379
|
+
productType: external_prop_types_["default"].string,
|
|
102380
|
+
suggestion_type: external_prop_types_["default"].string,
|
|
102381
|
+
thumbnail: external_prop_types_["default"].string,
|
|
102382
|
+
value: external_prop_types_["default"].string,
|
|
102383
|
+
suggestionType: external_prop_types_["default"].string
|
|
102384
|
+
}).isRequired,
|
|
102385
|
+
suggestionOptionId: external_prop_types_["default"].string.isRequired
|
|
102386
|
+
};
|
|
102387
|
+
;// ./src/components/auto-complete/AutoCompleteSeeMoreLink.jsx
|
|
102388
|
+
|
|
102389
|
+
|
|
102390
|
+
|
|
102391
|
+
|
|
102392
|
+
function AutoCompleteSeeMoreLink(_ref) {
|
|
102393
|
+
var seeMoreLinkRef = _ref.seeMoreLinkRef,
|
|
102394
|
+
seeMoreLinkFocused = _ref.seeMoreLinkFocused,
|
|
102395
|
+
inputRef = _ref.inputRef,
|
|
102396
|
+
onBlurSeeMoreLink = _ref.onBlurSeeMoreLink,
|
|
102397
|
+
onFocusSeeMoreLink = _ref.onFocusSeeMoreLink,
|
|
102398
|
+
onSeeMoreResults = _ref.onSeeMoreResults,
|
|
102399
|
+
resetSeeMoreLinkFocus = _ref.resetSeeMoreLinkFocus,
|
|
102400
|
+
restoreLastSuggestion = _ref.restoreLastSuggestion,
|
|
102401
|
+
seeMoreResultsText = _ref.seeMoreResultsText;
|
|
102402
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(SeeMoreLinkContainer, {
|
|
102403
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(SeeMoreLinkText, {
|
|
102404
|
+
ref: seeMoreLinkRef,
|
|
102405
|
+
type: "button",
|
|
102406
|
+
"data-testid": "autocomplete-see-more-button",
|
|
102407
|
+
"data-highlighted": seeMoreLinkFocused ? "true" : "false",
|
|
102408
|
+
onClick: onSeeMoreResults,
|
|
102409
|
+
onFocus: onFocusSeeMoreLink,
|
|
102410
|
+
onBlur: onBlurSeeMoreLink,
|
|
102411
|
+
onKeyDown: function onKeyDown(event) {
|
|
102412
|
+
if (event.key === "ArrowUp") {
|
|
102413
|
+
var _inputRef$current;
|
|
102414
|
+
event.preventDefault();
|
|
102415
|
+
resetSeeMoreLinkFocus();
|
|
102416
|
+
restoreLastSuggestion();
|
|
102417
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
102418
|
+
} else if (event.key === "Escape") {
|
|
102419
|
+
var _inputRef$current2;
|
|
102420
|
+
event.preventDefault();
|
|
102421
|
+
resetSeeMoreLinkFocus();
|
|
102422
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
|
|
102423
|
+
}
|
|
102424
|
+
},
|
|
102425
|
+
children: seeMoreResultsText
|
|
102426
|
+
})
|
|
102427
|
+
});
|
|
102428
|
+
}
|
|
102429
|
+
AutoCompleteSeeMoreLink.propTypes = {
|
|
102430
|
+
seeMoreLinkRef: external_prop_types_["default"].shape({
|
|
102431
|
+
current: external_prop_types_["default"].any
|
|
102432
|
+
}).isRequired,
|
|
102433
|
+
seeMoreLinkFocused: external_prop_types_["default"].bool.isRequired,
|
|
102434
|
+
inputRef: external_prop_types_["default"].shape({
|
|
102435
|
+
current: external_prop_types_["default"].any
|
|
102436
|
+
}).isRequired,
|
|
102437
|
+
onBlurSeeMoreLink: external_prop_types_["default"].func.isRequired,
|
|
102438
|
+
onFocusSeeMoreLink: external_prop_types_["default"].func.isRequired,
|
|
102439
|
+
onSeeMoreResults: external_prop_types_["default"].func.isRequired,
|
|
102440
|
+
resetSeeMoreLinkFocus: external_prop_types_["default"].func.isRequired,
|
|
102441
|
+
restoreLastSuggestion: external_prop_types_["default"].func.isRequired,
|
|
102442
|
+
seeMoreResultsText: external_prop_types_["default"].string.isRequired
|
|
102443
|
+
};
|
|
102444
|
+
;// ./src/components/auto-complete/AutoCompleteSuggestionsPanel.jsx
|
|
102445
|
+
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); }
|
|
102446
|
+
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; }
|
|
102447
|
+
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; }
|
|
102448
|
+
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; }
|
|
102449
|
+
function AutoCompleteSuggestionsPanel_toPropertyKey(t) { var i = AutoCompleteSuggestionsPanel_toPrimitive(t, "string"); return "symbol" == AutoCompleteSuggestionsPanel_typeof(i) ? i : i + ""; }
|
|
102450
|
+
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); }
|
|
102451
|
+
function AutoCompleteSuggestionsPanel_slicedToArray(r, e) { return AutoCompleteSuggestionsPanel_arrayWithHoles(r) || AutoCompleteSuggestionsPanel_iterableToArrayLimit(r, e) || AutoCompleteSuggestionsPanel_unsupportedIterableToArray(r, e) || AutoCompleteSuggestionsPanel_nonIterableRest(); }
|
|
102452
|
+
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."); }
|
|
102453
|
+
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; } }
|
|
102454
|
+
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; }
|
|
102455
|
+
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; } }
|
|
102456
|
+
function AutoCompleteSuggestionsPanel_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
102457
|
+
|
|
102458
|
+
|
|
102459
|
+
|
|
102460
|
+
|
|
102461
|
+
|
|
102462
|
+
|
|
102463
|
+
var MAX_VISIBLE_RECENT_SEARCHES = 6;
|
|
102464
|
+
function AutoCompleteSuggestionsPanel(_ref) {
|
|
102465
|
+
var didYouMeanText = _ref.didYouMeanText,
|
|
102466
|
+
emptyFetched = _ref.emptyFetched,
|
|
102467
|
+
footerActionRef = _ref.footerActionRef,
|
|
102468
|
+
footerFocused = _ref.footerFocused,
|
|
102469
|
+
hasDidYouMean = _ref.hasDidYouMean,
|
|
102470
|
+
hasMoreResults = _ref.hasMoreResults,
|
|
102471
|
+
inputRef = _ref.inputRef,
|
|
102472
|
+
listboxId = _ref.listboxId,
|
|
102473
|
+
listboxLabel = _ref.listboxLabel,
|
|
102474
|
+
loading = _ref.loading,
|
|
102475
|
+
noSuggestionsText = _ref.noSuggestionsText,
|
|
102476
|
+
onBlurFooter = _ref.onBlurFooter,
|
|
102477
|
+
onFocusFooter = _ref.onFocusFooter,
|
|
102478
|
+
onRecentSearchSelect = _ref.onRecentSearchSelect,
|
|
102479
|
+
onSeeMoreResults = _ref.onSeeMoreResults,
|
|
102480
|
+
renderSuggestionRow = _ref.renderSuggestionRow,
|
|
102481
|
+
recentSearches = _ref.recentSearches,
|
|
102482
|
+
recentSearchesHeading = _ref.recentSearchesHeading,
|
|
102483
|
+
parent$ = _ref.parent$,
|
|
102484
|
+
resetFooterFocus = _ref.resetFooterFocus,
|
|
102485
|
+
restoreLastSuggestion = _ref.restoreLastSuggestion,
|
|
102486
|
+
clearAllLabel = _ref.clearAllLabel,
|
|
102487
|
+
onClearRecentSearches = _ref.onClearRecentSearches,
|
|
102488
|
+
seeMoreResultsText = _ref.seeMoreResultsText,
|
|
102489
|
+
visibleSuggestions = _ref.visibleSuggestions;
|
|
102490
|
+
var _useState = (0,external_react_.useState)(false),
|
|
102491
|
+
_useState2 = AutoCompleteSuggestionsPanel_slicedToArray(_useState, 2),
|
|
102492
|
+
showAllRecentSearches = _useState2[0],
|
|
102493
|
+
setShowAllRecentSearches = _useState2[1];
|
|
102494
|
+
var editing = isEditingMode();
|
|
102495
|
+
(0,external_react_.useEffect)(function () {
|
|
102496
|
+
setShowAllRecentSearches(false);
|
|
102497
|
+
}, [recentSearches]);
|
|
102498
|
+
var shouldRenderDidYouMean = !loading && hasDidYouMean;
|
|
102499
|
+
var shouldRenderNoSuggestions = !loading && emptyFetched && visibleSuggestions.length === 0;
|
|
102500
|
+
var shouldRenderSeeMore = !loading && hasMoreResults && !hasDidYouMean;
|
|
102501
|
+
var shouldRenderRecentSearches = !loading && visibleSuggestions.length === 0 && recentSearches.length > 0;
|
|
102502
|
+
var visibleRecentSearches = showAllRecentSearches ? recentSearches : recentSearches.slice(0, MAX_VISIBLE_RECENT_SEARCHES);
|
|
102503
|
+
var remainingRecentSearchesCount = Math.max(recentSearches.length - visibleRecentSearches.length, 0);
|
|
102504
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(SearchSuggestionsPanel, {
|
|
102505
|
+
"data-testid": "autocomplete-suggestions-panel",
|
|
102506
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)(SearchSuggestionsList, {
|
|
102507
|
+
id: listboxId,
|
|
102508
|
+
"data-testid": "autocomplete-results-list",
|
|
102509
|
+
"aria-label": listboxLabel,
|
|
102510
|
+
"aria-busy": loading,
|
|
102511
|
+
children: [loading && /*#__PURE__*/(0,jsx_runtime_.jsx)(PassiveSuggestionOption, {
|
|
102512
|
+
"data-highlighted": "false",
|
|
102513
|
+
children: "\u2026"
|
|
102514
|
+
}), shouldRenderDidYouMean && /*#__PURE__*/(0,jsx_runtime_.jsx)(SuggestionSectionHeading, {
|
|
102515
|
+
"data-testid": "autocomplete-did-you-mean-heading",
|
|
102516
|
+
children: didYouMeanText
|
|
102517
|
+
}), !loading && visibleSuggestions.map(renderSuggestionRow), shouldRenderNoSuggestions && /*#__PURE__*/(0,jsx_runtime_.jsx)(PassiveSuggestionOption, {
|
|
102518
|
+
"data-highlighted": "false",
|
|
102519
|
+
children: noSuggestionsText
|
|
102520
|
+
})]
|
|
102521
|
+
}), shouldRenderSeeMore && /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteSeeMoreLink, {
|
|
102522
|
+
seeMoreLinkRef: footerActionRef,
|
|
102523
|
+
seeMoreLinkFocused: footerFocused,
|
|
102524
|
+
inputRef: inputRef,
|
|
102525
|
+
onBlurSeeMoreLink: onBlurFooter,
|
|
102526
|
+
onFocusSeeMoreLink: onFocusFooter,
|
|
102527
|
+
onSeeMoreResults: onSeeMoreResults,
|
|
102528
|
+
resetSeeMoreLinkFocus: resetFooterFocus,
|
|
102529
|
+
restoreLastSuggestion: restoreLastSuggestion,
|
|
102530
|
+
seeMoreResultsText: seeMoreResultsText
|
|
102531
|
+
}), shouldRenderRecentSearches && /*#__PURE__*/(0,jsx_runtime_.jsxs)(RecentSearchesSection, {
|
|
102532
|
+
"data-testid": "autocomplete-recent-searches",
|
|
102533
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)(RecentSearchesHeader, {
|
|
102534
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(RecentSearchesTitle, AutoCompleteSuggestionsPanel_objectSpread(AutoCompleteSuggestionsPanel_objectSpread({}, editing ? parent$ === null || parent$ === void 0 ? void 0 : parent$.recentSearchesHeading : undefined), {}, {
|
|
102535
|
+
children: recentSearchesHeading
|
|
102536
|
+
})), /*#__PURE__*/(0,jsx_runtime_.jsx)(RecentSearchesClearButton, AutoCompleteSuggestionsPanel_objectSpread(AutoCompleteSuggestionsPanel_objectSpread({
|
|
102537
|
+
type: "button",
|
|
102538
|
+
onClick: onClearRecentSearches
|
|
102539
|
+
}, editing ? parent$ === null || parent$ === void 0 ? void 0 : parent$.clearAllLabel : undefined), {}, {
|
|
102540
|
+
children: clearAllLabel
|
|
102541
|
+
}))]
|
|
102542
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsxs)(RecentSearchesList, {
|
|
102543
|
+
children: [visibleRecentSearches.map(function (recentSearch) {
|
|
102544
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(RecentSearchChip, {
|
|
102545
|
+
type: "button",
|
|
102546
|
+
onClick: function onClick() {
|
|
102547
|
+
return onRecentSearchSelect(recentSearch);
|
|
102548
|
+
},
|
|
102549
|
+
children: recentSearch
|
|
102550
|
+
}, recentSearch);
|
|
102551
|
+
}), remainingRecentSearchesCount > 0 && !showAllRecentSearches ? /*#__PURE__*/(0,jsx_runtime_.jsxs)(RecentSearchOverflowChip, {
|
|
102552
|
+
type: "button",
|
|
102553
|
+
onClick: function onClick() {
|
|
102554
|
+
return setShowAllRecentSearches(true);
|
|
102555
|
+
},
|
|
102556
|
+
children: ["+", remainingRecentSearchesCount, " More"]
|
|
102557
|
+
}) : null]
|
|
102558
|
+
})]
|
|
102559
|
+
})]
|
|
102560
|
+
});
|
|
102561
|
+
}
|
|
102562
|
+
AutoCompleteSuggestionsPanel.propTypes = {
|
|
102563
|
+
didYouMeanText: external_prop_types_["default"].string.isRequired,
|
|
102564
|
+
emptyFetched: external_prop_types_["default"].bool.isRequired,
|
|
102565
|
+
footerActionRef: external_prop_types_["default"].shape({
|
|
102566
|
+
current: external_prop_types_["default"].any
|
|
102567
|
+
}).isRequired,
|
|
102568
|
+
footerFocused: external_prop_types_["default"].bool.isRequired,
|
|
102569
|
+
hasDidYouMean: external_prop_types_["default"].bool.isRequired,
|
|
102570
|
+
hasMoreResults: external_prop_types_["default"].bool.isRequired,
|
|
102571
|
+
inputRef: external_prop_types_["default"].shape({
|
|
102572
|
+
current: external_prop_types_["default"].any
|
|
102573
|
+
}).isRequired,
|
|
102574
|
+
listboxId: external_prop_types_["default"].string.isRequired,
|
|
102575
|
+
listboxLabel: external_prop_types_["default"].string.isRequired,
|
|
102576
|
+
loading: external_prop_types_["default"].bool.isRequired,
|
|
102577
|
+
noSuggestionsText: external_prop_types_["default"].string.isRequired,
|
|
102578
|
+
onBlurFooter: external_prop_types_["default"].func.isRequired,
|
|
102579
|
+
onFocusFooter: external_prop_types_["default"].func.isRequired,
|
|
102580
|
+
onRecentSearchSelect: external_prop_types_["default"].func.isRequired,
|
|
102581
|
+
onSeeMoreResults: external_prop_types_["default"].func.isRequired,
|
|
102582
|
+
recentSearches: external_prop_types_["default"].arrayOf(external_prop_types_["default"].string).isRequired,
|
|
102583
|
+
recentSearchesHeading: external_prop_types_["default"].string.isRequired,
|
|
102584
|
+
parent$: external_prop_types_["default"].object,
|
|
102585
|
+
renderSuggestionRow: external_prop_types_["default"].func.isRequired,
|
|
102586
|
+
resetFooterFocus: external_prop_types_["default"].func.isRequired,
|
|
102587
|
+
restoreLastSuggestion: external_prop_types_["default"].func.isRequired,
|
|
102588
|
+
clearAllLabel: external_prop_types_["default"].string.isRequired,
|
|
102589
|
+
onClearRecentSearches: external_prop_types_["default"].func.isRequired,
|
|
102590
|
+
seeMoreResultsText: external_prop_types_["default"].string.isRequired,
|
|
102591
|
+
visibleSuggestions: external_prop_types_["default"].arrayOf(external_prop_types_["default"].object).isRequired
|
|
102592
|
+
};
|
|
102593
|
+
;// ./src/components/auto-complete/AutoComplete.propTypes.js
|
|
102594
|
+
|
|
102595
|
+
var autoCompleteCopyShape = external_prop_types_["default"].shape({
|
|
102596
|
+
placeholder: external_prop_types_["default"].string.isRequired,
|
|
102597
|
+
input_aria_label: external_prop_types_["default"].string,
|
|
102598
|
+
inputAriaLabel: external_prop_types_["default"].string,
|
|
102599
|
+
listbox_aria_label: external_prop_types_["default"].string,
|
|
102600
|
+
listboxAriaLabel: external_prop_types_["default"].string,
|
|
102601
|
+
did_you_mean_text: external_prop_types_["default"].string,
|
|
102602
|
+
didYouMeanText: external_prop_types_["default"].string,
|
|
102603
|
+
no_suggestions_text: external_prop_types_["default"].string,
|
|
102604
|
+
noSuggestionsText: external_prop_types_["default"].string,
|
|
102605
|
+
see_more_results_text: external_prop_types_["default"].string,
|
|
102606
|
+
seeMoreResultsText: external_prop_types_["default"].string,
|
|
102607
|
+
form_aria_label: external_prop_types_["default"].string,
|
|
102608
|
+
formAriaLabel: external_prop_types_["default"].string
|
|
102609
|
+
});
|
|
102610
|
+
var autoCompleteHeaderSearchServiceShape = external_prop_types_["default"].shape({
|
|
102611
|
+
fetchSuggestions: external_prop_types_["default"].func.isRequired,
|
|
102612
|
+
submitProductSearch: external_prop_types_["default"].func.isRequired,
|
|
102613
|
+
activateSuggestionAction: external_prop_types_["default"].func,
|
|
102614
|
+
viewMoreResults: external_prop_types_["default"].func,
|
|
102615
|
+
getRecentSearches: external_prop_types_["default"].func,
|
|
102616
|
+
clearRecentSearches: external_prop_types_["default"].func
|
|
102617
|
+
});
|
|
102618
|
+
;// ./src/components/auto-complete/AutoComplete.helpers.js
|
|
102619
|
+
function isSuggestionDisabled(suggestionOption) {
|
|
102620
|
+
return Boolean(!suggestionOption || suggestionOption.out_of_stock || suggestionOption.outOfStock);
|
|
102621
|
+
}
|
|
102622
|
+
function handleSearchInputKeyDown(_ref) {
|
|
102623
|
+
var clearSearch = _ref.clearSearch,
|
|
102624
|
+
event = _ref.event,
|
|
102625
|
+
handleArrowDownKey = _ref.handleArrowDownKey,
|
|
102626
|
+
handleArrowUpKey = _ref.handleArrowUpKey,
|
|
102627
|
+
handleTabKey = _ref.handleTabKey;
|
|
102628
|
+
switch (event.key) {
|
|
102629
|
+
case "Tab":
|
|
102630
|
+
handleTabKey(event);
|
|
102631
|
+
break;
|
|
102632
|
+
case "ArrowDown":
|
|
102633
|
+
handleArrowDownKey(event);
|
|
102634
|
+
break;
|
|
102635
|
+
case "ArrowUp":
|
|
102636
|
+
handleArrowUpKey(event);
|
|
102637
|
+
break;
|
|
102638
|
+
case "Escape":
|
|
102639
|
+
event.preventDefault();
|
|
102640
|
+
clearSearch();
|
|
102641
|
+
break;
|
|
102642
|
+
default:
|
|
102643
|
+
break;
|
|
102644
|
+
}
|
|
102645
|
+
}
|
|
102646
|
+
function handleSearchSubmit(_ref2) {
|
|
102647
|
+
var highlightedIndex = _ref2.highlightedIndex,
|
|
102648
|
+
query = _ref2.query,
|
|
102649
|
+
setSelectedOptionId = _ref2.setSelectedOptionId,
|
|
102650
|
+
submitProductSearch = _ref2.submitProductSearch,
|
|
102651
|
+
visibleSuggestions = _ref2.visibleSuggestions,
|
|
102652
|
+
selectOption = _ref2.selectOption;
|
|
102653
|
+
var highlightedOption = visibleSuggestions[highlightedIndex];
|
|
102654
|
+
if (highlightedOption) {
|
|
102655
|
+
selectOption(highlightedOption);
|
|
102656
|
+
return;
|
|
102657
|
+
}
|
|
102658
|
+
setSelectedOptionId(null);
|
|
102659
|
+
submitProductSearch(query.trim());
|
|
102660
|
+
}
|
|
102661
|
+
function getVisibleSuggestions(_ref3) {
|
|
102662
|
+
var didYouMean = _ref3.didYouMean,
|
|
102663
|
+
suggestions = _ref3.suggestions;
|
|
102664
|
+
if (didYouMean.length > 0) {
|
|
102665
|
+
return didYouMean;
|
|
102666
|
+
}
|
|
102667
|
+
return suggestions;
|
|
102668
|
+
}
|
|
102669
|
+
function getFirstFocusableSuggestionIndex(hasSuggestions) {
|
|
102670
|
+
if (!hasSuggestions) {
|
|
102671
|
+
return -1;
|
|
102672
|
+
}
|
|
102673
|
+
return 0;
|
|
102674
|
+
}
|
|
102675
|
+
function getActiveDescendantId(_ref4) {
|
|
102676
|
+
var highlightedIndex = _ref4.highlightedIndex,
|
|
102677
|
+
listboxId = _ref4.listboxId,
|
|
102678
|
+
visibleSuggestions = _ref4.visibleSuggestions;
|
|
102679
|
+
var highlightedOption = visibleSuggestions[highlightedIndex];
|
|
102680
|
+
if (!highlightedOption || highlightedIndex < 0) {
|
|
102681
|
+
return undefined;
|
|
102682
|
+
}
|
|
102683
|
+
return "".concat(listboxId, "-opt-").concat(highlightedOption.id);
|
|
102684
|
+
}
|
|
102685
|
+
;// ./src/components/auto-complete/AutoComplete.jsx
|
|
102686
|
+
function AutoComplete_slicedToArray(r, e) { return AutoComplete_arrayWithHoles(r) || AutoComplete_iterableToArrayLimit(r, e) || AutoComplete_unsupportedIterableToArray(r, e) || AutoComplete_nonIterableRest(); }
|
|
102687
|
+
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."); }
|
|
102688
|
+
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; } }
|
|
102689
|
+
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; }
|
|
102690
|
+
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; } }
|
|
102691
|
+
function AutoComplete_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
102692
|
+
|
|
102693
|
+
|
|
102694
|
+
|
|
102695
|
+
|
|
102696
|
+
|
|
102697
|
+
|
|
102698
|
+
|
|
102699
|
+
|
|
102700
|
+
|
|
102701
|
+
|
|
102702
|
+
|
|
102703
|
+
function AutoComplete(_ref) {
|
|
102704
|
+
var headerSearchService = _ref.headerSearchService,
|
|
102705
|
+
copy = _ref.copy,
|
|
102706
|
+
_ref$autoCompleteEnab = _ref.autoCompleteEnabled,
|
|
102707
|
+
autoCompleteEnabled = _ref$autoCompleteEnab === void 0 ? true : _ref$autoCompleteEnab,
|
|
102708
|
+
_ref$recentSearches = _ref.recentSearches,
|
|
102709
|
+
recentSearches = _ref$recentSearches === void 0 ? [] : _ref$recentSearches,
|
|
102710
|
+
_ref$recentSearchesHe = _ref.recentSearchesHeading,
|
|
102711
|
+
recentSearchesHeading = _ref$recentSearchesHe === void 0 ? "Recent searches" : _ref$recentSearchesHe,
|
|
102712
|
+
_ref$clearAllLabel = _ref.clearAllLabel,
|
|
102713
|
+
clearAllLabel = _ref$clearAllLabel === void 0 ? "Clear all" : _ref$clearAllLabel,
|
|
102714
|
+
onRecentSearchesChange = _ref.onRecentSearchesChange,
|
|
102715
|
+
parent$ = _ref.parent$,
|
|
102716
|
+
_ref$searchFieldEndSl = _ref.searchFieldEndSlot,
|
|
102717
|
+
searchFieldEndSlot = _ref$searchFieldEndSl === void 0 ? null : _ref$searchFieldEndSl,
|
|
102718
|
+
_ref$modalSearchLayou = _ref.modalSearchLayout,
|
|
102719
|
+
modalSearchLayout = _ref$modalSearchLayou === void 0 ? false : _ref$modalSearchLayou;
|
|
102720
|
+
var listboxId = (0,external_react_.useId)();
|
|
102721
|
+
var statusId = (0,external_react_.useId)();
|
|
102722
|
+
var rootRef = (0,external_react_.useRef)(null);
|
|
102723
|
+
var inputRef = (0,external_react_.useRef)(null);
|
|
102724
|
+
var footerActionRef = (0,external_react_.useRef)(null);
|
|
102725
|
+
var suggestionRowRefs = (0,external_react_.useRef)({});
|
|
102726
|
+
var _useState = (0,external_react_.useState)(-1),
|
|
102727
|
+
_useState2 = AutoComplete_slicedToArray(_useState, 2),
|
|
102728
|
+
highlightedIndex = _useState2[0],
|
|
102729
|
+
setHighlightedIndex = _useState2[1];
|
|
102730
|
+
var _useState3 = (0,external_react_.useState)(null),
|
|
102731
|
+
_useState4 = AutoComplete_slicedToArray(_useState3, 2),
|
|
102732
|
+
selectedOptionId = _useState4[0],
|
|
102733
|
+
setSelectedOptionId = _useState4[1];
|
|
102734
|
+
var _useState5 = (0,external_react_.useState)(false),
|
|
102735
|
+
_useState6 = AutoComplete_slicedToArray(_useState5, 2),
|
|
102736
|
+
footerFocused = _useState6[0],
|
|
102737
|
+
setFooterFocused = _useState6[1];
|
|
102738
|
+
var _useAutoCompleteSugge = useAutoCompleteSuggestions({
|
|
102739
|
+
headerSearchService: headerSearchService,
|
|
102740
|
+
enabled: autoCompleteEnabled
|
|
102741
|
+
}),
|
|
102742
|
+
clearQuery = _useAutoCompleteSugge.clearQuery,
|
|
102743
|
+
didYouMean = _useAutoCompleteSugge.didYouMean,
|
|
102744
|
+
emptyFetched = _useAutoCompleteSugge.emptyFetched,
|
|
102745
|
+
hasMoreResults = _useAutoCompleteSugge.hasMoreResults,
|
|
102746
|
+
hasQuery = _useAutoCompleteSugge.hasQuery,
|
|
102747
|
+
loading = _useAutoCompleteSugge.loading,
|
|
102748
|
+
query = _useAutoCompleteSugge.query,
|
|
102749
|
+
setQuery = _useAutoCompleteSugge.setQuery,
|
|
102750
|
+
suggestions = _useAutoCompleteSugge.suggestions,
|
|
102751
|
+
totalResultsCount = _useAutoCompleteSugge.totalResultsCount,
|
|
102752
|
+
updateQuery = _useAutoCompleteSugge.updateQuery;
|
|
102753
|
+
var showPanel = autoCompleteEnabled && hasQuery || recentSearches.length > 0;
|
|
102754
|
+
var listboxLabel = getCopyValue(copy, "listbox_aria_label", "listboxAriaLabel", "Search suggestions");
|
|
102755
|
+
var noSuggestionsText = getCopyValue(copy, "no_suggestions_text", "noSuggestionsText", "No suggestions");
|
|
102756
|
+
var seeMoreResultsText = getCopyValue(copy, "see_more_results_text", "seeMoreResultsText", "See More Results");
|
|
102757
|
+
var didYouMeanText = getCopyValue(copy, "did_you_mean_text", "didYouMeanText", "Did You Mean?");
|
|
102758
|
+
var visibleSuggestions = getVisibleSuggestions({
|
|
102759
|
+
didYouMean: didYouMean,
|
|
102760
|
+
suggestions: suggestions
|
|
102761
|
+
});
|
|
102762
|
+
var hasDidYouMean = didYouMean.length > 0;
|
|
102763
|
+
(0,external_react_.useEffect)(function () {
|
|
102764
|
+
function onDocMouseDown(event) {
|
|
102765
|
+
var _rootRef$current;
|
|
102766
|
+
if (!((_rootRef$current = rootRef.current) !== null && _rootRef$current !== void 0 && _rootRef$current.contains(event.target))) {
|
|
102767
|
+
setHighlightedIndex(-1);
|
|
102768
|
+
}
|
|
102769
|
+
}
|
|
102770
|
+
document.addEventListener("mousedown", onDocMouseDown);
|
|
102771
|
+
return function () {
|
|
102772
|
+
return document.removeEventListener("mousedown", onDocMouseDown);
|
|
102773
|
+
};
|
|
102774
|
+
}, []);
|
|
102775
|
+
(0,external_react_.useEffect)(function () {
|
|
102776
|
+
if (!hasQuery) {
|
|
102777
|
+
setHighlightedIndex(-1);
|
|
102778
|
+
setSelectedOptionId(null);
|
|
102779
|
+
setFooterFocused(false);
|
|
102780
|
+
return;
|
|
102781
|
+
}
|
|
102782
|
+
if (loading) {
|
|
102783
|
+
setFooterFocused(false);
|
|
102784
|
+
return;
|
|
102785
|
+
}
|
|
102786
|
+
setFooterFocused(false);
|
|
102787
|
+
var shouldHighlightFirstSuggestion = visibleSuggestions.length > 0 && !hasDidYouMean;
|
|
102788
|
+
setHighlightedIndex(shouldHighlightFirstSuggestion ? 0 : -1);
|
|
102789
|
+
setSelectedOptionId(function (currentSelectedOptionId) {
|
|
102790
|
+
return visibleSuggestions.some(function (suggestionOption) {
|
|
102791
|
+
return suggestionOption.id === currentSelectedOptionId;
|
|
102792
|
+
}) ? currentSelectedOptionId : null;
|
|
102793
|
+
});
|
|
102794
|
+
}, [hasDidYouMean, hasQuery, loading, visibleSuggestions]);
|
|
102795
|
+
var selectOption = (0,external_react_.useCallback)(function (option) {
|
|
102796
|
+
var _option$value, _option$id;
|
|
102797
|
+
if (isSuggestionDisabled(option)) return;
|
|
102798
|
+
var nextLabel = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.label;
|
|
102799
|
+
setQuery(nextLabel);
|
|
102800
|
+
setHighlightedIndex(-1);
|
|
102801
|
+
setSelectedOptionId((_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : null);
|
|
102802
|
+
setFooterFocused(false);
|
|
102803
|
+
headerSearchService.submitProductSearch(nextLabel, option);
|
|
102804
|
+
}, [headerSearchService]);
|
|
102805
|
+
var handleRecentSearchSelect = (0,external_react_.useCallback)(function (recentSearch) {
|
|
102806
|
+
var _headerSearchService$, _headerSearchService$2;
|
|
102807
|
+
var trimmedRecentSearch = String(recentSearch !== null && recentSearch !== void 0 ? recentSearch : "").trim();
|
|
102808
|
+
if (!trimmedRecentSearch) {
|
|
102809
|
+
return;
|
|
102810
|
+
}
|
|
102811
|
+
setQuery(trimmedRecentSearch);
|
|
102812
|
+
headerSearchService.submitProductSearch(trimmedRecentSearch);
|
|
102813
|
+
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$ : []);
|
|
102814
|
+
}, [headerSearchService, onRecentSearchesChange, setQuery]);
|
|
102815
|
+
var handleClearRecentSearches = (0,external_react_.useCallback)(function () {
|
|
102816
|
+
var _headerSearchService$3;
|
|
102817
|
+
(_headerSearchService$3 = headerSearchService.clearRecentSearches) === null || _headerSearchService$3 === void 0 || _headerSearchService$3.call(headerSearchService);
|
|
102818
|
+
onRecentSearchesChange === null || onRecentSearchesChange === void 0 || onRecentSearchesChange([]);
|
|
102819
|
+
}, [headerSearchService, onRecentSearchesChange]);
|
|
102820
|
+
var hasSuggestions = visibleSuggestions.length > 0;
|
|
102821
|
+
var firstFocusableSuggestionIndex = getFirstFocusableSuggestionIndex(hasSuggestions);
|
|
102822
|
+
function focusSuggestionRowAt(index) {
|
|
102823
|
+
var _suggestionRowRefs$cu;
|
|
102824
|
+
var suggestionOption = visibleSuggestions[index];
|
|
102825
|
+
if (!suggestionOption) return;
|
|
102826
|
+
(_suggestionRowRefs$cu = suggestionRowRefs.current[suggestionOption.id]) === null || _suggestionRowRefs$cu === void 0 || _suggestionRowRefs$cu.focus();
|
|
102827
|
+
}
|
|
102828
|
+
function clearHighlightState() {
|
|
102829
|
+
setHighlightedIndex(-1);
|
|
102830
|
+
setFooterFocused(false);
|
|
102831
|
+
}
|
|
102832
|
+
function focusFooterAction() {
|
|
102833
|
+
var _footerActionRef$curr;
|
|
102834
|
+
clearHighlightState();
|
|
102835
|
+
setFooterFocused(true);
|
|
102836
|
+
(_footerActionRef$curr = footerActionRef.current) === null || _footerActionRef$curr === void 0 || _footerActionRef$curr.focus();
|
|
102837
|
+
}
|
|
102838
|
+
function focusLastSuggestionFromFooter() {
|
|
102839
|
+
var _inputRef$current;
|
|
102840
|
+
setFooterFocused(false);
|
|
102841
|
+
if (hasSuggestions) {
|
|
102842
|
+
setHighlightedIndex(visibleSuggestions.length - 1);
|
|
102843
|
+
}
|
|
102844
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
102845
|
+
}
|
|
102846
|
+
function runSuggestionAction(suggestionOption) {
|
|
102847
|
+
if (isSuggestionDisabled(suggestionOption)) return;
|
|
102848
|
+
if (typeof headerSearchService.activateSuggestionAction === "function") {
|
|
102849
|
+
headerSearchService.activateSuggestionAction(suggestionOption);
|
|
102850
|
+
return;
|
|
102851
|
+
}
|
|
102852
|
+
selectOption(suggestionOption);
|
|
102853
|
+
}
|
|
102854
|
+
function onSubmit(event) {
|
|
102855
|
+
event.preventDefault();
|
|
102856
|
+
var effectiveHighlightedIndex = hasDidYouMean && highlightedIndex < 0 && visibleSuggestions.length > 0 ? 0 : highlightedIndex;
|
|
102857
|
+
handleSearchSubmit({
|
|
102858
|
+
highlightedIndex: effectiveHighlightedIndex,
|
|
102859
|
+
query: query,
|
|
102860
|
+
selectOption: selectOption,
|
|
102861
|
+
setSelectedOptionId: setSelectedOptionId,
|
|
102862
|
+
submitProductSearch: headerSearchService.submitProductSearch,
|
|
102863
|
+
visibleSuggestions: visibleSuggestions
|
|
102864
|
+
});
|
|
102865
|
+
}
|
|
102866
|
+
function handleTabKey(event) {
|
|
102867
|
+
if (event.shiftKey || firstFocusableSuggestionIndex < 0) {
|
|
102868
|
+
return;
|
|
102869
|
+
}
|
|
102870
|
+
event.preventDefault();
|
|
102871
|
+
focusSuggestionRowAt(firstFocusableSuggestionIndex);
|
|
102872
|
+
}
|
|
102873
|
+
function handleArrowDownKey(event) {
|
|
102874
|
+
event.preventDefault();
|
|
102875
|
+
if (footerFocused) {
|
|
102876
|
+
var _footerActionRef$curr2;
|
|
102877
|
+
(_footerActionRef$curr2 = footerActionRef.current) === null || _footerActionRef$curr2 === void 0 || _footerActionRef$curr2.focus();
|
|
102878
|
+
return;
|
|
102879
|
+
}
|
|
102880
|
+
if (!hasSuggestions) {
|
|
102881
|
+
return;
|
|
102882
|
+
}
|
|
102883
|
+
if (hasMoreResults && highlightedIndex >= visibleSuggestions.length - 1) {
|
|
102884
|
+
focusFooterAction();
|
|
102885
|
+
return;
|
|
102886
|
+
}
|
|
102887
|
+
setFooterFocused(false);
|
|
102888
|
+
setHighlightedIndex(function (currentIndex) {
|
|
102889
|
+
return currentIndex < visibleSuggestions.length - 1 ? currentIndex + 1 : 0;
|
|
102890
|
+
});
|
|
102891
|
+
}
|
|
102892
|
+
function handleArrowUpKey(event) {
|
|
102893
|
+
event.preventDefault();
|
|
102894
|
+
if (footerFocused) {
|
|
102895
|
+
focusLastSuggestionFromFooter();
|
|
102896
|
+
return;
|
|
102897
|
+
}
|
|
102898
|
+
if (!hasSuggestions) {
|
|
102899
|
+
return;
|
|
102900
|
+
}
|
|
102901
|
+
setFooterFocused(false);
|
|
102902
|
+
setHighlightedIndex(function (currentIndex) {
|
|
102903
|
+
return currentIndex > 0 ? currentIndex - 1 : visibleSuggestions.length - 1;
|
|
102904
|
+
});
|
|
102905
|
+
}
|
|
102906
|
+
function onInputKeyDown(event) {
|
|
102907
|
+
handleSearchInputKeyDown({
|
|
102908
|
+
clearSearch: clearSearch,
|
|
102909
|
+
event: event,
|
|
102910
|
+
handleArrowDownKey: handleArrowDownKey,
|
|
102911
|
+
handleArrowUpKey: handleArrowUpKey,
|
|
102912
|
+
handleTabKey: handleTabKey
|
|
102913
|
+
});
|
|
102914
|
+
}
|
|
102915
|
+
function onSeeMoreResults() {
|
|
102916
|
+
var trimmedQuery = query.trim();
|
|
102917
|
+
if (!trimmedQuery) return;
|
|
102918
|
+
clearHighlightState();
|
|
102919
|
+
var payload = getSeeMoreResultsPayload(trimmedQuery, totalResultsCount, visibleSuggestions);
|
|
102920
|
+
if (typeof headerSearchService.viewMoreResults === "function") {
|
|
102921
|
+
headerSearchService.viewMoreResults(payload);
|
|
102922
|
+
return;
|
|
102923
|
+
}
|
|
102924
|
+
headerSearchService.submitProductSearch(trimmedQuery);
|
|
102925
|
+
}
|
|
102926
|
+
function clearSearch() {
|
|
102927
|
+
var _inputRef$current2;
|
|
102928
|
+
clearHighlightState();
|
|
102929
|
+
setSelectedOptionId(null);
|
|
102930
|
+
clearQuery();
|
|
102931
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
|
|
102932
|
+
}
|
|
102933
|
+
function onInputChange(event) {
|
|
102934
|
+
var nextValue = event.target.value;
|
|
102935
|
+
setSelectedOptionId(null);
|
|
102936
|
+
clearHighlightState();
|
|
102937
|
+
updateQuery(nextValue);
|
|
102938
|
+
}
|
|
102939
|
+
function renderSuggestionRow(suggestionOption, suggestionIndex) {
|
|
102940
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteSuggestionRow, {
|
|
102941
|
+
inputRef: inputRef,
|
|
102942
|
+
isHighlighted: suggestionIndex === highlightedIndex,
|
|
102943
|
+
isSelected: suggestionOption.id === selectedOptionId,
|
|
102944
|
+
onHighlightSuggestion: function onHighlightSuggestion(nextIndex) {
|
|
102945
|
+
setFooterFocused(false);
|
|
102946
|
+
setHighlightedIndex(nextIndex);
|
|
102947
|
+
},
|
|
102948
|
+
onRunSuggestionAction: runSuggestionAction,
|
|
102949
|
+
onSelectSuggestion: selectOption,
|
|
102950
|
+
registerSuggestionNode: function registerSuggestionNode(node) {
|
|
102951
|
+
if (node) {
|
|
102952
|
+
suggestionRowRefs.current[suggestionOption.id] = node;
|
|
102953
|
+
} else {
|
|
102954
|
+
delete suggestionRowRefs.current[suggestionOption.id];
|
|
102955
|
+
}
|
|
102956
|
+
},
|
|
102957
|
+
suggestionIndex: suggestionIndex,
|
|
102958
|
+
suggestionOption: suggestionOption,
|
|
102959
|
+
suggestionOptionId: "".concat(listboxId, "-opt-").concat(suggestionOption.id)
|
|
102960
|
+
}, suggestionOption.id);
|
|
102961
|
+
}
|
|
102962
|
+
var activeDescendantId = getActiveDescendantId({
|
|
102963
|
+
highlightedIndex: highlightedIndex,
|
|
102964
|
+
listboxId: listboxId,
|
|
102965
|
+
visibleSuggestions: visibleSuggestions
|
|
102966
|
+
});
|
|
102967
|
+
var statusMessage = getStatusMessage({
|
|
102968
|
+
loading: loading,
|
|
102969
|
+
emptyFetched: emptyFetched,
|
|
102970
|
+
hasQuery: hasQuery,
|
|
102971
|
+
noSuggestionsText: noSuggestionsText,
|
|
102972
|
+
suggestions: visibleSuggestions
|
|
102973
|
+
});
|
|
102974
|
+
function resetFooterFocus() {
|
|
102975
|
+
setFooterFocused(false);
|
|
102976
|
+
setHighlightedIndex(-1);
|
|
102977
|
+
}
|
|
102978
|
+
function restoreLastSuggestion() {
|
|
102979
|
+
if (visibleSuggestions.length > 0) {
|
|
102980
|
+
setHighlightedIndex(visibleSuggestions.length - 1);
|
|
102981
|
+
}
|
|
102982
|
+
}
|
|
102983
|
+
function handleFooterFocus() {
|
|
102984
|
+
setHighlightedIndex(-1);
|
|
102985
|
+
setFooterFocused(true);
|
|
102986
|
+
}
|
|
102987
|
+
function handleFooterBlur() {
|
|
102988
|
+
setFooterFocused(false);
|
|
102989
|
+
}
|
|
102990
|
+
var searchField = /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteSearchField, {
|
|
102991
|
+
activeDescendantId: activeDescendantId,
|
|
102992
|
+
clearSearch: clearSearch,
|
|
102993
|
+
copy: copy,
|
|
102994
|
+
inputRef: inputRef,
|
|
102995
|
+
listboxId: listboxId,
|
|
102996
|
+
onChange: onInputChange,
|
|
102997
|
+
onInputKeyDown: onInputKeyDown,
|
|
102998
|
+
onSubmit: onSubmit,
|
|
102999
|
+
query: query,
|
|
103000
|
+
showPanel: showPanel,
|
|
103001
|
+
statusId: statusId,
|
|
103002
|
+
parent$: parent$
|
|
103003
|
+
});
|
|
103004
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(AutoCompleteRoot, {
|
|
103005
|
+
ref: rootRef,
|
|
103006
|
+
children: [searchFieldEndSlot ? /*#__PURE__*/(0,jsx_runtime_.jsxs)(SearchFieldToolbar, {
|
|
103007
|
+
$modalLayout: modalSearchLayout,
|
|
103008
|
+
"data-testid": "autocomplete-search-toolbar",
|
|
103009
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(SearchFieldGrow, {
|
|
103010
|
+
children: searchField
|
|
103011
|
+
}), searchFieldEndSlot]
|
|
103012
|
+
}) : searchField, /*#__PURE__*/(0,jsx_runtime_.jsx)(SearchSuggestionsStatus, {
|
|
103013
|
+
id: statusId,
|
|
103014
|
+
"aria-live": "polite",
|
|
103015
|
+
children: statusMessage
|
|
103016
|
+
}), showPanel && /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteSuggestionsPanel, {
|
|
103017
|
+
clearAllLabel: clearAllLabel,
|
|
103018
|
+
didYouMeanText: didYouMeanText,
|
|
103019
|
+
emptyFetched: emptyFetched,
|
|
103020
|
+
footerActionRef: footerActionRef,
|
|
103021
|
+
footerFocused: footerFocused,
|
|
103022
|
+
hasDidYouMean: hasDidYouMean,
|
|
103023
|
+
hasMoreResults: hasMoreResults,
|
|
103024
|
+
inputRef: inputRef,
|
|
103025
|
+
listboxId: listboxId,
|
|
103026
|
+
listboxLabel: listboxLabel,
|
|
103027
|
+
loading: loading,
|
|
103028
|
+
noSuggestionsText: noSuggestionsText,
|
|
103029
|
+
onBlurFooter: handleFooterBlur,
|
|
103030
|
+
onClearRecentSearches: handleClearRecentSearches,
|
|
103031
|
+
onFocusFooter: handleFooterFocus,
|
|
103032
|
+
onRecentSearchSelect: handleRecentSearchSelect,
|
|
103033
|
+
onSeeMoreResults: onSeeMoreResults,
|
|
103034
|
+
recentSearches: recentSearches,
|
|
103035
|
+
recentSearchesHeading: recentSearchesHeading,
|
|
103036
|
+
parent$: parent$,
|
|
103037
|
+
renderSuggestionRow: renderSuggestionRow,
|
|
103038
|
+
resetFooterFocus: resetFooterFocus,
|
|
103039
|
+
restoreLastSuggestion: restoreLastSuggestion,
|
|
103040
|
+
seeMoreResultsText: seeMoreResultsText,
|
|
103041
|
+
visibleSuggestions: visibleSuggestions
|
|
103042
|
+
})]
|
|
103043
|
+
});
|
|
103044
|
+
}
|
|
103045
|
+
AutoComplete.propTypes = {
|
|
103046
|
+
headerSearchService: autoCompleteHeaderSearchServiceShape.isRequired,
|
|
103047
|
+
copy: autoCompleteCopyShape.isRequired,
|
|
103048
|
+
autoCompleteEnabled: external_prop_types_["default"].bool,
|
|
103049
|
+
recentSearches: external_prop_types_["default"].arrayOf(external_prop_types_["default"].string),
|
|
103050
|
+
recentSearchesHeading: external_prop_types_["default"].string,
|
|
103051
|
+
clearAllLabel: external_prop_types_["default"].string,
|
|
103052
|
+
onRecentSearchesChange: external_prop_types_["default"].func,
|
|
103053
|
+
parent$: external_prop_types_["default"].object,
|
|
103054
|
+
searchFieldEndSlot: external_prop_types_["default"].node,
|
|
103055
|
+
modalSearchLayout: external_prop_types_["default"].bool
|
|
103056
|
+
};
|
|
103057
|
+
// EXTERNAL MODULE: ./node_modules/@mui/material/Button/Button.js
|
|
103058
|
+
var Button = __webpack_require__(1629);
|
|
103059
|
+
;// ./src/components/button/CancelButton.styled.jsx
|
|
103060
|
+
|
|
103061
|
+
|
|
103062
|
+
var CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX = 1025;
|
|
103063
|
+
var CancelButtonRoot = /*#__PURE__*/createStyled(Button/* default */.A, true ? {
|
|
103064
|
+
target: "e1rel7ar2"
|
|
103065
|
+
} : 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));
|
|
103066
|
+
var CancelButtonIconWrap = /*#__PURE__*/createStyled("span", true ? {
|
|
103067
|
+
target: "e1rel7ar1"
|
|
103068
|
+
} : 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));
|
|
103069
|
+
var CancelButtonText = /*#__PURE__*/createStyled("span", true ? {
|
|
103070
|
+
target: "e1rel7ar0"
|
|
103071
|
+
} : 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));
|
|
103072
|
+
;// ./src/components/button/CancelButton.jsx
|
|
103073
|
+
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); }
|
|
103074
|
+
var CancelButton_excluded = ["label", "onClick", "ariaLabel", "className", "iconName", "iconColor", "showIcon", "parent$"];
|
|
103075
|
+
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; }
|
|
103076
|
+
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; }
|
|
103077
|
+
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; }
|
|
103078
|
+
function CancelButton_toPropertyKey(t) { var i = CancelButton_toPrimitive(t, "string"); return "symbol" == CancelButton_typeof(i) ? i : i + ""; }
|
|
103079
|
+
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); }
|
|
103080
|
+
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; }
|
|
103081
|
+
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; }
|
|
103082
|
+
|
|
103083
|
+
|
|
103084
|
+
|
|
103085
|
+
|
|
103086
|
+
|
|
103087
|
+
function CancelButton(_ref) {
|
|
103088
|
+
var _restProps$dataTesti;
|
|
103089
|
+
var _ref$label = _ref.label,
|
|
103090
|
+
label = _ref$label === void 0 ? "Cancel" : _ref$label,
|
|
103091
|
+
_ref$onClick = _ref.onClick,
|
|
103092
|
+
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
103093
|
+
ariaLabel = _ref.ariaLabel,
|
|
103094
|
+
className = _ref.className,
|
|
103095
|
+
_ref$iconName = _ref.iconName,
|
|
103096
|
+
iconName = _ref$iconName === void 0 ? "close" : _ref$iconName,
|
|
103097
|
+
_ref$iconColor = _ref.iconColor,
|
|
103098
|
+
iconColor = _ref$iconColor === void 0 ? "#252525" : _ref$iconColor,
|
|
103099
|
+
_ref$showIcon = _ref.showIcon,
|
|
103100
|
+
showIcon = _ref$showIcon === void 0 ? true : _ref$showIcon,
|
|
103101
|
+
_ref$parent$ = _ref.parent$,
|
|
103102
|
+
parent$ = _ref$parent$ === void 0 ? {} : _ref$parent$,
|
|
103103
|
+
restProps = CancelButton_objectWithoutProperties(_ref, CancelButton_excluded);
|
|
103104
|
+
var testId = (_restProps$dataTesti = restProps["data-testid"]) !== null && _restProps$dataTesti !== void 0 ? _restProps$dataTesti : "cancel-button";
|
|
103105
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(CancelButtonRoot, CancelButton_objectSpread(CancelButton_objectSpread({
|
|
103106
|
+
className: className,
|
|
103107
|
+
"aria-label": ariaLabel || label,
|
|
103108
|
+
"data-testid": testId,
|
|
103109
|
+
disableRipple: true,
|
|
103110
|
+
onClick: onClick,
|
|
103111
|
+
type: "button"
|
|
103112
|
+
}, restProps), {}, {
|
|
103113
|
+
children: [showIcon ? /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButtonIconWrap, {
|
|
103114
|
+
"aria-hidden": "true",
|
|
103115
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(dist.NsIcon, {
|
|
103116
|
+
name: iconName,
|
|
103117
|
+
size: "small",
|
|
103118
|
+
colorOverride: iconColor
|
|
103119
|
+
})
|
|
103120
|
+
}) : null, /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButtonText, CancelButton_objectSpread(CancelButton_objectSpread({}, parent$ !== null && parent$ !== void 0 ? parent$ : {}), {}, {
|
|
103121
|
+
children: label
|
|
103122
|
+
}))]
|
|
103123
|
+
}));
|
|
103124
|
+
}
|
|
103125
|
+
CancelButton.propTypes = {
|
|
103126
|
+
label: external_prop_types_["default"].string,
|
|
103127
|
+
onClick: external_prop_types_["default"].func,
|
|
103128
|
+
ariaLabel: external_prop_types_["default"].string,
|
|
103129
|
+
className: external_prop_types_["default"].string,
|
|
103130
|
+
iconName: external_prop_types_["default"].string,
|
|
103131
|
+
iconColor: external_prop_types_["default"].string,
|
|
103132
|
+
showIcon: external_prop_types_["default"].bool,
|
|
103133
|
+
parent$: external_prop_types_["default"].object
|
|
103134
|
+
};
|
|
103135
|
+
;// ./src/components/modal/SearchModal.styled.jsx
|
|
103136
|
+
|
|
103137
|
+
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)."; }
|
|
103138
|
+
var SearchModal_styled_colors = {
|
|
103139
|
+
surface: "#ffffff",
|
|
103140
|
+
border: "#d1d5db",
|
|
103141
|
+
text: "#111827",
|
|
103142
|
+
muted: "#6b7280"
|
|
103143
|
+
};
|
|
103144
|
+
var MobileSearchButton = /*#__PURE__*/createStyled("button", true ? {
|
|
103145
|
+
target: "etuykaq12"
|
|
103146
|
+
} : 0)( true ? {
|
|
103147
|
+
name: "1ff2nft",
|
|
103148
|
+
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;}"
|
|
103149
|
+
} : 0);
|
|
103150
|
+
var DesktopSearchWrapper = /*#__PURE__*/createStyled("button", true ? {
|
|
103151
|
+
target: "etuykaq11"
|
|
103152
|
+
} : 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) {
|
|
103153
|
+
var $sizeVariant = _ref.$sizeVariant;
|
|
103154
|
+
return $sizeVariant === "full" ? "100%" : "min(100%, 320px)";
|
|
103155
|
+
}, ";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));
|
|
103156
|
+
var DesktopTriggerInput = /*#__PURE__*/createStyled("span", true ? {
|
|
103157
|
+
target: "etuykaq10"
|
|
103158
|
+
} : 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));
|
|
103159
|
+
var DesktopTriggerIconButton = /*#__PURE__*/createStyled("span", true ? {
|
|
103160
|
+
target: "etuykaq9"
|
|
103161
|
+
} : 0)( true ? {
|
|
103162
|
+
name: "1fbssp",
|
|
103163
|
+
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;}"
|
|
103164
|
+
} : 0);
|
|
103165
|
+
var ModalOverlay = /*#__PURE__*/createStyled("div", true ? {
|
|
103166
|
+
target: "etuykaq8"
|
|
103167
|
+
} : 0)( true ? {
|
|
103168
|
+
name: "15ant65",
|
|
103169
|
+
styles: "position:fixed;inset:0;z-index:1000;display:flex;flex-direction:column;align-items:stretch;overflow:hidden"
|
|
103170
|
+
} : 0);
|
|
103171
|
+
var ModalPanel = /*#__PURE__*/createStyled("dialog", true ? {
|
|
103172
|
+
target: "etuykaq7"
|
|
103173
|
+
} : 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));
|
|
103174
|
+
var ModalTopBar = /*#__PURE__*/createStyled("div", true ? {
|
|
103175
|
+
target: "etuykaq6"
|
|
103176
|
+
} : 0)( true ? {
|
|
103177
|
+
name: "19ii5hn",
|
|
103178
|
+
styles: "display:none;align-items:center;justify-content:space-between;width:100%;@media (min-width: 1024px){display:flex;}"
|
|
103179
|
+
} : 0);
|
|
103180
|
+
var SearchModal_styled_LogoSlot = /*#__PURE__*/createStyled("div", true ? {
|
|
103181
|
+
target: "etuykaq5"
|
|
103182
|
+
} : 0)( true ? {
|
|
103183
|
+
name: "ou8xsw",
|
|
103184
|
+
styles: "flex:0 0 auto"
|
|
103185
|
+
} : 0);
|
|
103186
|
+
var SearchRow = /*#__PURE__*/createStyled("div", true ? {
|
|
103187
|
+
target: "etuykaq4"
|
|
103188
|
+
} : 0)( true ? {
|
|
103189
|
+
name: "vg66lk",
|
|
103190
|
+
styles: "display:flex;align-items:flex-start;gap:12px;width:100%;@media (max-width: 1023px){align-items:center;}"
|
|
103191
|
+
} : 0);
|
|
103192
|
+
var MobileCancelSlot = /*#__PURE__*/createStyled("div", true ? {
|
|
103193
|
+
target: "etuykaq3"
|
|
103194
|
+
} : 0)( true ? {
|
|
103195
|
+
name: "kob85u",
|
|
103196
|
+
styles: "flex-shrink:0;display:flex;align-items:center;@media (min-width: 1024px){display:none;}"
|
|
103197
|
+
} : 0);
|
|
103198
|
+
|
|
103199
|
+
/** Wraps the fallback search form so Cancel stays on the same row as the input (mobile). */
|
|
103200
|
+
var SearchFormGrow = /*#__PURE__*/createStyled("div", true ? {
|
|
103201
|
+
target: "etuykaq2"
|
|
103202
|
+
} : 0)( true ? {
|
|
103203
|
+
name: "fxp7t8",
|
|
103204
|
+
styles: "flex:1;min-width:0"
|
|
103205
|
+
} : 0);
|
|
103206
|
+
var AutoCompleteWrapper = /*#__PURE__*/createStyled("div", true ? {
|
|
103207
|
+
target: "etuykaq1"
|
|
103208
|
+
} : 0)( true ? {
|
|
103209
|
+
name: "fgvye",
|
|
103210
|
+
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;}"
|
|
103211
|
+
} : 0);
|
|
103212
|
+
var SearchForm = /*#__PURE__*/createStyled("form", true ? {
|
|
103213
|
+
target: "etuykaq0"
|
|
103214
|
+
} : 0)( true ? {
|
|
103215
|
+
name: "1lnhxsx",
|
|
103216
|
+
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;}"
|
|
103217
|
+
} : 0);
|
|
103218
|
+
;// ./src/components/modal/SearchModal.constants.js
|
|
103219
|
+
var SEARCH_PLACEHOLDER = "Search by product name, ingredient, benefits, or SKU";
|
|
103220
|
+
var TRIGGER_PLACEHOLDER = "Product Search";
|
|
103221
|
+
var MODAL_TITLE = "Product Search";
|
|
103222
|
+
|
|
103223
|
+
;// ./src/components/modal/SearchModal.jsx
|
|
103224
|
+
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); }
|
|
103225
|
+
function SearchModal_slicedToArray(r, e) { return SearchModal_arrayWithHoles(r) || SearchModal_iterableToArrayLimit(r, e) || SearchModal_unsupportedIterableToArray(r, e) || SearchModal_nonIterableRest(); }
|
|
103226
|
+
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."); }
|
|
103227
|
+
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; } }
|
|
103228
|
+
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; }
|
|
103229
|
+
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; } }
|
|
103230
|
+
function SearchModal_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
103231
|
+
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; }
|
|
103232
|
+
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; }
|
|
103233
|
+
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; }
|
|
103234
|
+
function SearchModal_toPropertyKey(t) { var i = SearchModal_toPrimitive(t, "string"); return "symbol" == SearchModal_typeof(i) ? i : i + ""; }
|
|
103235
|
+
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); }
|
|
103236
|
+
|
|
103237
|
+
|
|
103238
|
+
|
|
103239
|
+
|
|
103240
|
+
|
|
103241
|
+
|
|
103242
|
+
|
|
103243
|
+
|
|
103244
|
+
|
|
103245
|
+
|
|
103246
|
+
|
|
103247
|
+
|
|
103248
|
+
|
|
103249
|
+
function getFocusableElementsInPanel(panel) {
|
|
103250
|
+
if (!panel) return [];
|
|
103251
|
+
return Array.from(panel.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(function (el) {
|
|
103252
|
+
return !el.disabled;
|
|
103253
|
+
});
|
|
103254
|
+
}
|
|
103255
|
+
function handleTabKeyForModal(event, panel) {
|
|
103256
|
+
var focusable = getFocusableElementsInPanel(panel);
|
|
103257
|
+
if (focusable.length === 0) return;
|
|
103258
|
+
var first = focusable[0];
|
|
103259
|
+
var last = focusable[focusable.length - 1];
|
|
103260
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
103261
|
+
event.preventDefault();
|
|
103262
|
+
last.focus();
|
|
103263
|
+
return;
|
|
103264
|
+
}
|
|
103265
|
+
if (!event.shiftKey && document.activeElement === last) {
|
|
103266
|
+
event.preventDefault();
|
|
103267
|
+
first.focus();
|
|
103268
|
+
}
|
|
103269
|
+
}
|
|
103270
|
+
function MobileCancelControl(_ref) {
|
|
103271
|
+
var _activeEditableTags$c;
|
|
103272
|
+
var cancelLabel = _ref.cancelLabel,
|
|
103273
|
+
closeModal = _ref.closeModal,
|
|
103274
|
+
cancelShowIcon = _ref.cancelShowIcon,
|
|
103275
|
+
activeEditableTags = _ref.activeEditableTags,
|
|
103276
|
+
isClosingRef = _ref.isClosingRef;
|
|
103277
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileCancelSlot, {
|
|
103278
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("span", SearchModal_objectSpread(SearchModal_objectSpread({
|
|
103279
|
+
onPointerDown: function onPointerDown() {
|
|
103280
|
+
isClosingRef.current = true;
|
|
103281
|
+
}
|
|
103282
|
+
}, (_activeEditableTags$c = activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.cancelLabel) !== null && _activeEditableTags$c !== void 0 ? _activeEditableTags$c : {}), {}, {
|
|
103283
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButton, {
|
|
103284
|
+
label: cancelLabel,
|
|
103285
|
+
onClick: closeModal,
|
|
103286
|
+
showIcon: cancelShowIcon,
|
|
103287
|
+
"data-testid": "search-modal-cancel-mobile",
|
|
103288
|
+
parent$: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.cancelLabel
|
|
103289
|
+
})
|
|
103290
|
+
}))
|
|
103291
|
+
});
|
|
103292
|
+
}
|
|
103293
|
+
function renderMobileTrigger(_ref2) {
|
|
103294
|
+
var showMobileTrigger = _ref2.showMobileTrigger,
|
|
103295
|
+
triggerPlaceholder = _ref2.triggerPlaceholder,
|
|
103296
|
+
isOpen = _ref2.isOpen,
|
|
103297
|
+
openModal = _ref2.openModal;
|
|
103298
|
+
if (!showMobileTrigger) return null;
|
|
103299
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileSearchButton, {
|
|
103300
|
+
type: "button",
|
|
103301
|
+
"aria-label": triggerPlaceholder,
|
|
103302
|
+
"aria-haspopup": "dialog",
|
|
103303
|
+
"aria-expanded": isOpen,
|
|
103304
|
+
onClick: openModal,
|
|
103305
|
+
"data-testid": "search-modal-trigger-mobile",
|
|
103306
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Search/* default */.A, {
|
|
103307
|
+
fontSize: "inherit",
|
|
103308
|
+
"aria-hidden": true,
|
|
103309
|
+
"data-testid": "search"
|
|
103310
|
+
})
|
|
103311
|
+
});
|
|
103312
|
+
}
|
|
103313
|
+
function renderDesktopTrigger(_ref3) {
|
|
103314
|
+
var _activeEditableTags$t, _activeEditableTags$t2;
|
|
103315
|
+
var showDesktopTrigger = _ref3.showDesktopTrigger,
|
|
103316
|
+
triggerRef = _ref3.triggerRef,
|
|
103317
|
+
triggerPlaceholder = _ref3.triggerPlaceholder,
|
|
103318
|
+
isOpen = _ref3.isOpen,
|
|
103319
|
+
inputSize = _ref3.inputSize,
|
|
103320
|
+
inputSizeVariant = _ref3.inputSizeVariant,
|
|
103321
|
+
openModal = _ref3.openModal,
|
|
103322
|
+
activeEditableTags = _ref3.activeEditableTags;
|
|
103323
|
+
if (!showDesktopTrigger) return null;
|
|
103324
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(DesktopSearchWrapper, {
|
|
103325
|
+
type: "button",
|
|
103326
|
+
"data-testid": "search-modal-trigger",
|
|
103327
|
+
ref: triggerRef,
|
|
103328
|
+
"aria-label": triggerPlaceholder || TRIGGER_PLACEHOLDER,
|
|
103329
|
+
"aria-haspopup": "dialog",
|
|
103330
|
+
"aria-expanded": isOpen,
|
|
103331
|
+
"data-size": inputSize,
|
|
103332
|
+
"data-size-variant": inputSizeVariant,
|
|
103333
|
+
$sizeVariant: inputSizeVariant,
|
|
103334
|
+
onClick: openModal,
|
|
103335
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(DesktopTriggerIconButton, SearchModal_objectSpread(SearchModal_objectSpread({
|
|
103336
|
+
"data-testid": "search-trigger-button"
|
|
103337
|
+
}, (_activeEditableTags$t = activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.triggerIcon) !== null && _activeEditableTags$t !== void 0 ? _activeEditableTags$t : {}), {}, {
|
|
103338
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Search/* default */.A, {
|
|
103339
|
+
fontSize: "inherit",
|
|
103340
|
+
"aria-hidden": true,
|
|
103341
|
+
"data-testid": "search"
|
|
103342
|
+
})
|
|
103343
|
+
})), /*#__PURE__*/(0,jsx_runtime_.jsx)(DesktopTriggerInput, SearchModal_objectSpread(SearchModal_objectSpread({
|
|
103344
|
+
"data-testid": "search-trigger-input"
|
|
103345
|
+
}, (_activeEditableTags$t2 = activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.triggerPlaceholder) !== null && _activeEditableTags$t2 !== void 0 ? _activeEditableTags$t2 : {}), {}, {
|
|
103346
|
+
children: triggerPlaceholder || TRIGGER_PLACEHOLDER
|
|
103347
|
+
}))]
|
|
103348
|
+
});
|
|
103349
|
+
}
|
|
103350
|
+
function SearchModal(_ref4) {
|
|
103351
|
+
var _activeEditableTags$s, _activeEditableTags$c2;
|
|
103352
|
+
var _ref4$triggerPlacehol = _ref4.triggerPlaceholder,
|
|
103353
|
+
triggerPlaceholder = _ref4$triggerPlacehol === void 0 ? TRIGGER_PLACEHOLDER : _ref4$triggerPlacehol,
|
|
103354
|
+
_ref4$searchPlacehold = _ref4.searchPlaceholder,
|
|
103355
|
+
searchPlaceholder = _ref4$searchPlacehold === void 0 ? SEARCH_PLACEHOLDER : _ref4$searchPlacehold,
|
|
103356
|
+
_ref4$onSearch = _ref4.onSearch,
|
|
103357
|
+
onSearch = _ref4$onSearch === void 0 ? function () {} : _ref4$onSearch,
|
|
103358
|
+
_ref4$modalTitle = _ref4.modalTitle,
|
|
103359
|
+
modalTitle = _ref4$modalTitle === void 0 ? MODAL_TITLE : _ref4$modalTitle,
|
|
103360
|
+
brandLogo = _ref4.brandLogo,
|
|
103361
|
+
brandLogoAlt = _ref4.brandLogoAlt,
|
|
103362
|
+
brandHref = _ref4.brandHref,
|
|
103363
|
+
_ref4$brandSize = _ref4.brandSize,
|
|
103364
|
+
brandSize = _ref4$brandSize === void 0 ? "Medium" : _ref4$brandSize,
|
|
103365
|
+
_ref4$showBrandLogo = _ref4.showBrandLogo,
|
|
103366
|
+
showBrandLogo = _ref4$showBrandLogo === void 0 ? true : _ref4$showBrandLogo,
|
|
103367
|
+
_ref4$cancelLabel = _ref4.cancelLabel,
|
|
103368
|
+
cancelLabel = _ref4$cancelLabel === void 0 ? "Cancel" : _ref4$cancelLabel,
|
|
103369
|
+
_ref4$cancelShowIcon = _ref4.cancelShowIcon,
|
|
103370
|
+
cancelShowIcon = _ref4$cancelShowIcon === void 0 ? true : _ref4$cancelShowIcon,
|
|
103371
|
+
_ref4$headerSearchSer = _ref4.headerSearchService,
|
|
103372
|
+
headerSearchService = _ref4$headerSearchSer === void 0 ? undefined : _ref4$headerSearchSer,
|
|
103373
|
+
_ref4$copy = _ref4.copy,
|
|
103374
|
+
copy = _ref4$copy === void 0 ? undefined : _ref4$copy,
|
|
103375
|
+
_ref4$showRecentSearc = _ref4.showRecentSearches,
|
|
103376
|
+
showRecentSearches = _ref4$showRecentSearc === void 0 ? true : _ref4$showRecentSearc,
|
|
103377
|
+
_ref4$autoCompleteEna = _ref4.autoCompleteEnabled,
|
|
103378
|
+
autoCompleteEnabled = _ref4$autoCompleteEna === void 0 ? true : _ref4$autoCompleteEna,
|
|
103379
|
+
_ref4$recentSearchesH = _ref4.recentSearchesHeading,
|
|
103380
|
+
recentSearchesHeading = _ref4$recentSearchesH === void 0 ? "Recent searches" : _ref4$recentSearchesH,
|
|
103381
|
+
_ref4$clearAllLabel = _ref4.clearAllLabel,
|
|
103382
|
+
clearAllLabel = _ref4$clearAllLabel === void 0 ? "Clear all" : _ref4$clearAllLabel,
|
|
103383
|
+
_ref4$parent$ = _ref4.parent$,
|
|
103384
|
+
parent$ = _ref4$parent$ === void 0 ? undefined : _ref4$parent$,
|
|
103385
|
+
_ref4$inputSize = _ref4.inputSize,
|
|
103386
|
+
inputSize = _ref4$inputSize === void 0 ? DEFAULT_INPUT_SIZE : _ref4$inputSize,
|
|
103387
|
+
_ref4$inputSizeVarian = _ref4.inputSizeVariant,
|
|
103388
|
+
inputSizeVariant = _ref4$inputSizeVarian === void 0 ? DEFAULT_INPUT_SIZE_VARIANT : _ref4$inputSizeVarian,
|
|
103389
|
+
_ref4$showMobileTrigg = _ref4.showMobileTrigger,
|
|
103390
|
+
showMobileTrigger = _ref4$showMobileTrigg === void 0 ? true : _ref4$showMobileTrigg,
|
|
103391
|
+
_ref4$showDesktopTrig = _ref4.showDesktopTrigger,
|
|
103392
|
+
showDesktopTrigger = _ref4$showDesktopTrig === void 0 ? true : _ref4$showDesktopTrig;
|
|
103393
|
+
var editing = isEditingMode();
|
|
103394
|
+
var activeEditableTags = parent$;
|
|
103395
|
+
var _useState = (0,external_react_.useState)(false),
|
|
103396
|
+
_useState2 = SearchModal_slicedToArray(_useState, 2),
|
|
103397
|
+
isOpen = _useState2[0],
|
|
103398
|
+
setIsOpen = _useState2[1];
|
|
103399
|
+
var _useState3 = (0,external_react_.useState)(""),
|
|
103400
|
+
_useState4 = SearchModal_slicedToArray(_useState3, 2),
|
|
103401
|
+
query = _useState4[0],
|
|
103402
|
+
setQuery = _useState4[1];
|
|
103403
|
+
var _useState5 = (0,external_react_.useState)(false),
|
|
103404
|
+
_useState6 = SearchModal_slicedToArray(_useState5, 2),
|
|
103405
|
+
isAutoCompleteInputFocused = _useState6[0],
|
|
103406
|
+
setIsAutoCompleteInputFocused = _useState6[1];
|
|
103407
|
+
var _useState7 = (0,external_react_.useState)([]),
|
|
103408
|
+
_useState8 = SearchModal_slicedToArray(_useState7, 2),
|
|
103409
|
+
recentSearches = _useState8[0],
|
|
103410
|
+
setRecentSearches = _useState8[1];
|
|
103411
|
+
var triggerRef = (0,external_react_.useRef)(null);
|
|
103412
|
+
var isClosingRef = (0,external_react_.useRef)(false);
|
|
103413
|
+
var hasAutoComplete = Boolean(headerSearchService && copy);
|
|
103414
|
+
var openModal = (0,external_react_.useCallback)(function () {
|
|
103415
|
+
setIsOpen(true);
|
|
103416
|
+
}, []);
|
|
103417
|
+
(0,external_react_.useEffect)(function () {
|
|
103418
|
+
if (!isOpen) return;
|
|
103419
|
+
requestAnimationFrame(function () {
|
|
103420
|
+
var input = document.querySelector('[data-testid="autocomplete-input"], [data-testid="search-modal-input"]');
|
|
103421
|
+
input === null || input === void 0 || input.focus();
|
|
103422
|
+
});
|
|
103423
|
+
}, [isOpen]);
|
|
103424
|
+
(0,external_react_.useEffect)(function () {
|
|
103425
|
+
var _headerSearchService$, _headerSearchService$2;
|
|
103426
|
+
if (!isOpen || !showRecentSearches) {
|
|
103427
|
+
return;
|
|
103428
|
+
}
|
|
103429
|
+
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$ : []);
|
|
103430
|
+
}, [headerSearchService, isOpen, showRecentSearches]);
|
|
103431
|
+
var closeModal = (0,external_react_.useCallback)(function () {
|
|
103432
|
+
isClosingRef.current = true;
|
|
103433
|
+
setIsOpen(false);
|
|
103434
|
+
setQuery("");
|
|
103435
|
+
setIsAutoCompleteInputFocused(false);
|
|
103436
|
+
requestAnimationFrame(function () {
|
|
103437
|
+
var _triggerRef$current;
|
|
103438
|
+
(_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 || _triggerRef$current.focus();
|
|
103439
|
+
isClosingRef.current = false;
|
|
103440
|
+
});
|
|
103441
|
+
}, []);
|
|
103442
|
+
(0,external_react_.useEffect)(function () {
|
|
103443
|
+
if (!isOpen) return undefined;
|
|
103444
|
+
function handleKeyDown(e) {
|
|
103445
|
+
if (e.key === "Escape") {
|
|
103446
|
+
closeModal();
|
|
103447
|
+
return;
|
|
103448
|
+
}
|
|
103449
|
+
if (e.key !== "Tab") return;
|
|
103450
|
+
handleTabKeyForModal(e, document.getElementById("search-modal-panel"));
|
|
103451
|
+
}
|
|
103452
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
103453
|
+
document.body.style.overflow = "hidden";
|
|
103454
|
+
return function () {
|
|
103455
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
103456
|
+
document.body.style.overflow = "";
|
|
103457
|
+
};
|
|
103458
|
+
}, [isOpen, closeModal]);
|
|
103459
|
+
function handleOverlayClick(e) {
|
|
103460
|
+
if (e.target === e.currentTarget) {
|
|
103461
|
+
closeModal();
|
|
103462
|
+
}
|
|
103463
|
+
}
|
|
103464
|
+
function handleSubmit(e) {
|
|
103465
|
+
e.preventDefault();
|
|
103466
|
+
if (query.trim()) {
|
|
103467
|
+
onSearch(query.trim());
|
|
103468
|
+
}
|
|
103469
|
+
}
|
|
103470
|
+
function isSearchInputActivationClick(clickTarget) {
|
|
103471
|
+
if (!(clickTarget instanceof Element)) {
|
|
103472
|
+
return false;
|
|
103473
|
+
}
|
|
103474
|
+
return clickTarget.closest('[data-testid="search-modal"]') !== null || clickTarget.closest('[data-testid^="search-modal-"]') !== null;
|
|
103475
|
+
}
|
|
103476
|
+
var mobileCancelControl = /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileCancelControl, {
|
|
103477
|
+
cancelLabel: cancelLabel,
|
|
103478
|
+
closeModal: closeModal,
|
|
103479
|
+
cancelShowIcon: cancelShowIcon,
|
|
103480
|
+
activeEditableTags: activeEditableTags,
|
|
103481
|
+
isClosingRef: isClosingRef
|
|
103482
|
+
});
|
|
103483
|
+
var searchBody = hasAutoComplete ? /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoCompleteWrapper, {
|
|
103484
|
+
onFocus: function onFocus() {
|
|
103485
|
+
return setIsAutoCompleteInputFocused(true);
|
|
103486
|
+
},
|
|
103487
|
+
onBlur: function onBlur(e) {
|
|
103488
|
+
if (!e.currentTarget.contains(e.relatedTarget) && !isClosingRef.current) {
|
|
103489
|
+
setIsAutoCompleteInputFocused(false);
|
|
103490
|
+
}
|
|
103491
|
+
},
|
|
103492
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(AutoComplete, {
|
|
103493
|
+
headerSearchService: headerSearchService,
|
|
103494
|
+
autoCompleteEnabled: autoCompleteEnabled,
|
|
103495
|
+
modalSearchLayout: true,
|
|
103496
|
+
copy: SearchModal_objectSpread(SearchModal_objectSpread({}, copy), {}, {
|
|
103497
|
+
placeholder: isAutoCompleteInputFocused ? searchPlaceholder || SEARCH_PLACEHOLDER : triggerPlaceholder || TRIGGER_PLACEHOLDER
|
|
103498
|
+
}),
|
|
103499
|
+
recentSearches: showRecentSearches ? recentSearches : [],
|
|
103500
|
+
recentSearchesHeading: recentSearchesHeading,
|
|
103501
|
+
clearAllLabel: clearAllLabel,
|
|
103502
|
+
onRecentSearchesChange: setRecentSearches,
|
|
103503
|
+
parent$: activeEditableTags,
|
|
103504
|
+
searchFieldEndSlot: mobileCancelControl
|
|
103505
|
+
})
|
|
103506
|
+
}) : /*#__PURE__*/(0,jsx_runtime_.jsx)(SearchForm, SearchModal_objectSpread(SearchModal_objectSpread({
|
|
103507
|
+
onSubmit: handleSubmit,
|
|
103508
|
+
onClick: function onClick(e) {
|
|
103509
|
+
if (!isSearchInputActivationClick(e.target)) {
|
|
103510
|
+
return;
|
|
103511
|
+
}
|
|
103512
|
+
handleSubmit(e);
|
|
103513
|
+
},
|
|
103514
|
+
role: "search"
|
|
103515
|
+
}, (_activeEditableTags$s = activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.searchPlaceholder) !== null && _activeEditableTags$s !== void 0 ? _activeEditableTags$s : {}), {}, {
|
|
103516
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Input, {
|
|
103517
|
+
value: query,
|
|
103518
|
+
onChange: function onChange(val) {
|
|
103519
|
+
return setQuery(val);
|
|
103520
|
+
},
|
|
103521
|
+
placeholder_text: searchPlaceholder || SEARCH_PLACEHOLDER,
|
|
103522
|
+
aria_label: searchPlaceholder || SEARCH_PLACEHOLDER,
|
|
103523
|
+
"data-testid": "search-modal",
|
|
103524
|
+
size: inputSize,
|
|
103525
|
+
size_variant: inputSizeVariant
|
|
103526
|
+
})
|
|
103527
|
+
}));
|
|
103528
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
|
|
103529
|
+
children: [renderMobileTrigger({
|
|
103530
|
+
showMobileTrigger: showMobileTrigger,
|
|
103531
|
+
triggerPlaceholder: triggerPlaceholder,
|
|
103532
|
+
isOpen: isOpen,
|
|
103533
|
+
openModal: openModal
|
|
103534
|
+
}), renderDesktopTrigger({
|
|
103535
|
+
showDesktopTrigger: showDesktopTrigger,
|
|
103536
|
+
triggerRef: triggerRef,
|
|
103537
|
+
triggerPlaceholder: triggerPlaceholder,
|
|
103538
|
+
isOpen: isOpen,
|
|
103539
|
+
inputSize: inputSize,
|
|
103540
|
+
inputSizeVariant: inputSizeVariant,
|
|
103541
|
+
openModal: openModal,
|
|
103542
|
+
activeEditableTags: activeEditableTags
|
|
103543
|
+
}), isOpen && /*#__PURE__*/(0,jsx_runtime_.jsx)(ModalOverlay, {
|
|
103544
|
+
onPointerDown: function onPointerDown(e) {
|
|
103545
|
+
if (e.target === e.currentTarget) isClosingRef.current = true;
|
|
103546
|
+
},
|
|
103547
|
+
onClick: handleOverlayClick,
|
|
103548
|
+
"data-testid": "search-modal-overlay",
|
|
103549
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(ModalPanel, {
|
|
103550
|
+
id: "search-modal-panel",
|
|
103551
|
+
open: true,
|
|
103552
|
+
"aria-modal": "true",
|
|
103553
|
+
"aria-label": modalTitle || MODAL_TITLE,
|
|
103554
|
+
"data-testid": "search-modal-panel",
|
|
103555
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)(ModalTopBar, {
|
|
103556
|
+
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(SearchModal_styled_LogoSlot, {
|
|
103557
|
+
"data-testid": "search-modal-logo-slot",
|
|
103558
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(Brand, {
|
|
103559
|
+
logo: brandLogo,
|
|
103560
|
+
logoAlt: brandLogoAlt,
|
|
103561
|
+
href: brandHref,
|
|
103562
|
+
size: brandSize,
|
|
103563
|
+
showLogo: showBrandLogo,
|
|
103564
|
+
$: {
|
|
103565
|
+
header_logo: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.logoAsset,
|
|
103566
|
+
logo_url: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.logoUrl,
|
|
103567
|
+
show_logo: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.showBrandLogo,
|
|
103568
|
+
logo_size: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.brandSize
|
|
103569
|
+
},
|
|
103570
|
+
isEditing: editing
|
|
103571
|
+
})
|
|
103572
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsx)("span", SearchModal_objectSpread(SearchModal_objectSpread({
|
|
103573
|
+
onPointerDown: function onPointerDown() {
|
|
103574
|
+
isClosingRef.current = true;
|
|
103575
|
+
}
|
|
103576
|
+
}, (_activeEditableTags$c2 = activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.cancelLabel) !== null && _activeEditableTags$c2 !== void 0 ? _activeEditableTags$c2 : {}), {}, {
|
|
103577
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButton, {
|
|
103578
|
+
label: cancelLabel,
|
|
103579
|
+
onClick: closeModal,
|
|
103580
|
+
showIcon: cancelShowIcon,
|
|
103581
|
+
"data-testid": "search-modal-cancel-desktop",
|
|
103582
|
+
parent$: activeEditableTags === null || activeEditableTags === void 0 ? void 0 : activeEditableTags.cancelLabel
|
|
103583
|
+
})
|
|
103584
|
+
}))]
|
|
103585
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsxs)(SearchRow, {
|
|
103586
|
+
children: [searchBody, hasAutoComplete ? null : mobileCancelControl]
|
|
103587
|
+
})]
|
|
103588
|
+
})
|
|
103589
|
+
})]
|
|
103590
|
+
});
|
|
103591
|
+
}
|
|
103592
|
+
SearchModal.propTypes = {
|
|
103593
|
+
triggerPlaceholder: external_prop_types_["default"].string,
|
|
103594
|
+
searchPlaceholder: external_prop_types_["default"].string,
|
|
103595
|
+
onSearch: external_prop_types_["default"].func,
|
|
103596
|
+
modalTitle: external_prop_types_["default"].string,
|
|
103597
|
+
brandLogo: external_prop_types_["default"].string,
|
|
103598
|
+
brandLogoAlt: external_prop_types_["default"].string,
|
|
103599
|
+
brandHref: external_prop_types_["default"].string,
|
|
103600
|
+
brandSize: external_prop_types_["default"].oneOf(["Small", "Medium", "Large"]),
|
|
103601
|
+
showBrandLogo: external_prop_types_["default"].bool,
|
|
103602
|
+
cancelLabel: external_prop_types_["default"].string,
|
|
103603
|
+
cancelShowIcon: external_prop_types_["default"].bool,
|
|
103604
|
+
headerSearchService: autoCompleteHeaderSearchServiceShape,
|
|
103605
|
+
copy: autoCompleteCopyShape,
|
|
103606
|
+
showRecentSearches: external_prop_types_["default"].bool,
|
|
103607
|
+
autoCompleteEnabled: external_prop_types_["default"].bool,
|
|
103608
|
+
recentSearchesHeading: external_prop_types_["default"].string,
|
|
103609
|
+
clearAllLabel: external_prop_types_["default"].string,
|
|
103610
|
+
parent$: external_prop_types_["default"].object,
|
|
103611
|
+
inputSize: external_prop_types_["default"].oneOf([INPUT_SIZES.SM, INPUT_SIZES.MD, INPUT_SIZES.LG]),
|
|
103612
|
+
inputSizeVariant: external_prop_types_["default"].oneOf([INPUT_SIZE_VARIANTS.DEFAULT, INPUT_SIZE_VARIANTS.WIDE, INPUT_SIZE_VARIANTS.FULL]),
|
|
103613
|
+
showMobileTrigger: external_prop_types_["default"].bool,
|
|
103614
|
+
showDesktopTrigger: external_prop_types_["default"].bool
|
|
103615
|
+
};
|
|
103616
|
+
MobileCancelControl.propTypes = {
|
|
103617
|
+
cancelLabel: external_prop_types_["default"].string.isRequired,
|
|
103618
|
+
closeModal: external_prop_types_["default"].func.isRequired,
|
|
103619
|
+
cancelShowIcon: external_prop_types_["default"].bool.isRequired,
|
|
103620
|
+
activeEditableTags: external_prop_types_["default"].object,
|
|
103621
|
+
isClosingRef: external_prop_types_["default"].shape({
|
|
103622
|
+
current: external_prop_types_["default"].bool
|
|
103623
|
+
}).isRequired
|
|
103624
|
+
};
|
|
103625
|
+
;// ./src/utils/recentHeaderSearches.js
|
|
103626
|
+
function recentHeaderSearches_toConsumableArray(r) { return recentHeaderSearches_arrayWithoutHoles(r) || recentHeaderSearches_iterableToArray(r) || recentHeaderSearches_unsupportedIterableToArray(r) || recentHeaderSearches_nonIterableSpread(); }
|
|
103627
|
+
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."); }
|
|
103628
|
+
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; } }
|
|
103629
|
+
function recentHeaderSearches_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
103630
|
+
function recentHeaderSearches_arrayWithoutHoles(r) { if (Array.isArray(r)) return recentHeaderSearches_arrayLikeToArray(r); }
|
|
103631
|
+
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; }
|
|
103632
|
+
var RECENT_SEARCHES_PREFIX = "nuskin:header:recentSearches";
|
|
103633
|
+
var DEFAULT_LIMIT = 10;
|
|
103634
|
+
function canUseStorage(storage) {
|
|
103635
|
+
return storage && typeof storage.getItem === "function";
|
|
103636
|
+
}
|
|
103637
|
+
function normalizeParts() {
|
|
103638
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
103639
|
+
country = _ref.country,
|
|
103640
|
+
language = _ref.language,
|
|
103641
|
+
locale = _ref.locale;
|
|
103642
|
+
var normalizedCountry = String(country !== null && country !== void 0 ? country : "").trim().toUpperCase();
|
|
103643
|
+
var normalizedLanguage = String(language !== null && language !== void 0 ? language : "").trim().toLowerCase();
|
|
103644
|
+
var normalizedLocale = String(locale !== null && locale !== void 0 ? locale : "").trim() || "UNKNOWN";
|
|
103645
|
+
return {
|
|
103646
|
+
country: normalizedCountry || "UNKNOWN",
|
|
103647
|
+
language: normalizedLanguage || "unknown",
|
|
103648
|
+
locale: normalizedLocale
|
|
103649
|
+
};
|
|
103650
|
+
}
|
|
103651
|
+
function getRecentHeaderSearchesStorageKey(localeParts) {
|
|
103652
|
+
var _normalizeParts = normalizeParts(localeParts),
|
|
103653
|
+
country = _normalizeParts.country,
|
|
103654
|
+
language = _normalizeParts.language,
|
|
103655
|
+
locale = _normalizeParts.locale;
|
|
103656
|
+
return "".concat(RECENT_SEARCHES_PREFIX, ":").concat(locale, ":").concat(country, ":").concat(language);
|
|
103657
|
+
}
|
|
103658
|
+
function getRecentHeaderSearches(localeParts, storage) {
|
|
103659
|
+
if (!canUseStorage(storage)) {
|
|
103660
|
+
return [];
|
|
103661
|
+
}
|
|
103662
|
+
try {
|
|
103663
|
+
var rawValue = storage.getItem(getRecentHeaderSearchesStorageKey(localeParts));
|
|
103664
|
+
if (!rawValue) {
|
|
103665
|
+
return [];
|
|
103666
|
+
}
|
|
103667
|
+
var parsedValue = JSON.parse(rawValue);
|
|
103668
|
+
if (!Array.isArray(parsedValue)) {
|
|
103669
|
+
return [];
|
|
103670
|
+
}
|
|
103671
|
+
return parsedValue.map(function (item) {
|
|
103672
|
+
return String(item !== null && item !== void 0 ? item : "").trim();
|
|
103673
|
+
}).filter(Boolean);
|
|
103674
|
+
} catch (_unused) {
|
|
103675
|
+
return [];
|
|
103676
|
+
}
|
|
103677
|
+
}
|
|
103678
|
+
function addRecentHeaderSearch(localeParts, query, storage) {
|
|
103679
|
+
var limit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_LIMIT;
|
|
103680
|
+
var normalizedQuery = String(query !== null && query !== void 0 ? query : "").trim();
|
|
103681
|
+
if (!normalizedQuery || !canUseStorage(storage)) {
|
|
103682
|
+
return [];
|
|
103683
|
+
}
|
|
103684
|
+
try {
|
|
103685
|
+
var existingValues = getRecentHeaderSearches(localeParts, storage).filter(function (item) {
|
|
103686
|
+
return item.toLowerCase() !== normalizedQuery.toLowerCase();
|
|
103687
|
+
});
|
|
103688
|
+
var nextValues = [normalizedQuery].concat(recentHeaderSearches_toConsumableArray(existingValues)).slice(0, limit);
|
|
103689
|
+
storage.setItem(getRecentHeaderSearchesStorageKey(localeParts), JSON.stringify(nextValues));
|
|
103690
|
+
return nextValues;
|
|
103691
|
+
} catch (_unused2) {
|
|
103692
|
+
return [];
|
|
103693
|
+
}
|
|
103694
|
+
}
|
|
103695
|
+
function clearRecentHeaderSearches(localeParts, storage) {
|
|
103696
|
+
if (!canUseStorage(storage)) {
|
|
103697
|
+
return;
|
|
103698
|
+
}
|
|
103699
|
+
try {
|
|
103700
|
+
storage.removeItem(getRecentHeaderSearchesStorageKey(localeParts));
|
|
103701
|
+
} catch (_unused3) {
|
|
103702
|
+
// intentionally quiet when storage is blocked/unavailable
|
|
103703
|
+
}
|
|
103704
|
+
}
|
|
103705
|
+
;// ./src/utils/locale.js
|
|
103706
|
+
/**
|
|
103707
|
+
* Extracts the locale code from the provided URL or the current URL.
|
|
103708
|
+
*
|
|
103709
|
+
* @param options - An object with the following properties:
|
|
103710
|
+
* @param options.url - The URL to extract the locale code from. If not provided, the current URL will be used.
|
|
103711
|
+
* @param options.defaultLocale - The default locale code to use if the locale cannot be extracted from the URL.
|
|
103712
|
+
* @returns The locale code in the format "language_COUNTRY".
|
|
103713
|
+
*/
|
|
103714
|
+
function getLocaleCodeFromUrl(options) {
|
|
103715
|
+
var _localeAsArr$;
|
|
103716
|
+
var _ref = options !== null && options !== void 0 ? options : {},
|
|
103717
|
+
_ref$url = _ref.url,
|
|
103718
|
+
url = _ref$url === void 0 ? "" : _ref$url,
|
|
103719
|
+
_ref$defaultLocale = _ref.defaultLocale,
|
|
103720
|
+
defaultLocale = _ref$defaultLocale === void 0 ? "" : _ref$defaultLocale;
|
|
103721
|
+
var localeAsArr = [];
|
|
103722
|
+
var tempUrl = url || typeof location != "undefined" && location.href;
|
|
103723
|
+
if (tempUrl) {
|
|
103724
|
+
var _tempUrl, _tempUrl2;
|
|
103725
|
+
/* adding dummy domain since express originalUrl will not have request domain */
|
|
103726
|
+
if (!((_tempUrl = tempUrl) !== null && _tempUrl !== void 0 && _tempUrl.includes("https://")) && !((_tempUrl2 = tempUrl) !== null && _tempUrl2 !== void 0 && _tempUrl2.includes("http://"))) {
|
|
103727
|
+
tempUrl = "https://domain.com".concat(tempUrl);
|
|
103728
|
+
}
|
|
103729
|
+
var updatedUrl = new URL(tempUrl);
|
|
103730
|
+
var pathParams = updatedUrl.pathname;
|
|
103731
|
+
if (pathParams) {
|
|
103732
|
+
var _pathParams$split;
|
|
103733
|
+
var pathList = pathParams === null || pathParams === void 0 || (_pathParams$split = pathParams.split("/")) === null || _pathParams$split === void 0 ? void 0 : _pathParams$split.filter(Boolean);
|
|
103734
|
+
if (pathList.length > 1) {
|
|
103735
|
+
localeAsArr = pathList;
|
|
103736
|
+
}
|
|
103737
|
+
}
|
|
103738
|
+
if (localeAsArr.length > 2) {
|
|
103739
|
+
localeAsArr = localeAsArr.slice(0, 2);
|
|
103740
|
+
}
|
|
103741
|
+
}
|
|
103742
|
+
localeAsArr = localeAsArr.reverse();
|
|
103743
|
+
if (localeAsArr.length === 0) {
|
|
103744
|
+
localeAsArr = defaultLocale.split("_");
|
|
103745
|
+
}
|
|
103746
|
+
return "".concat((_localeAsArr$ = localeAsArr[1]) === null || _localeAsArr$ === void 0 ? void 0 : _localeAsArr$.toUpperCase(), "-").concat(localeAsArr[0]);
|
|
103747
|
+
}
|
|
103748
|
+
function getLocale() {
|
|
103749
|
+
var _splitLocale$, _splitLocale$2;
|
|
103750
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
103751
|
+
url = _ref2.url;
|
|
103752
|
+
var currentLocale = getLocaleCodeFromUrl(url ? {
|
|
103753
|
+
url: url
|
|
103754
|
+
} : null);
|
|
103755
|
+
var splitLocale = currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.split("-");
|
|
103756
|
+
return {
|
|
103757
|
+
locale: currentLocale,
|
|
103758
|
+
language: splitLocale === null || splitLocale === void 0 || (_splitLocale$ = splitLocale[1]) === null || _splitLocale$ === void 0 ? void 0 : _splitLocale$.toLowerCase(),
|
|
103759
|
+
country: splitLocale === null || splitLocale === void 0 || (_splitLocale$2 = splitLocale[0]) === null || _splitLocale$2 === void 0 ? void 0 : _splitLocale$2.toUpperCase()
|
|
103760
|
+
};
|
|
103761
|
+
}
|
|
103762
|
+
function locale_isBrowser() {
|
|
103763
|
+
return typeof window !== "undefined" && window != null;
|
|
103764
|
+
}
|
|
103765
|
+
|
|
103766
|
+
/** Normalized `country`, `language`, and `locale` string from explicit market + language. */
|
|
103767
|
+
function buildLocaleData(market, language) {
|
|
103768
|
+
var country = String(market).trim().toUpperCase();
|
|
103769
|
+
var lang = String(language).trim().toLowerCase();
|
|
103770
|
+
if (!country || !lang) {
|
|
103771
|
+
throw new Error("@nuskin/nextgen-header: `market` and `language` must be non-empty when provided.");
|
|
103772
|
+
}
|
|
103773
|
+
return {
|
|
103774
|
+
country: country,
|
|
103775
|
+
language: lang,
|
|
103776
|
+
locale: "".concat(country, "-").concat(lang)
|
|
103777
|
+
};
|
|
103778
|
+
}
|
|
103779
|
+
|
|
103780
|
+
/**
|
|
103781
|
+
* Resolves locale data (`country`, `language`, `locale`) for the header shell.
|
|
103782
|
+
*
|
|
103783
|
+
* - **SSR (no `window`):** `market` and `language` are required (e.g. from the host or from `requestUrl` in `renderAndExtractContext`).
|
|
103784
|
+
* - **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.
|
|
103785
|
+
*/
|
|
103786
|
+
function resolveHeaderLocale() {
|
|
103787
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
103788
|
+
market = _ref3.market,
|
|
103789
|
+
language = _ref3.language;
|
|
103790
|
+
var explicit = market != null && language != null && String(market).trim() !== "" && String(language).trim() !== "";
|
|
103791
|
+
if (explicit) {
|
|
103792
|
+
return buildLocaleData(market, language);
|
|
103793
|
+
}
|
|
103794
|
+
if (!locale_isBrowser()) {
|
|
103795
|
+
return buildLocaleData("US", "en");
|
|
103796
|
+
}
|
|
103797
|
+
var fromUrl = getLocale();
|
|
103798
|
+
if (!fromUrl.country || !fromUrl.language || !fromUrl.locale || String(fromUrl.locale).includes("undefined")) {
|
|
103799
|
+
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.");
|
|
103800
|
+
}
|
|
103801
|
+
return fromUrl;
|
|
103802
|
+
}
|
|
103803
|
+
|
|
103804
|
+
;// ./src/utils/createHeaderSearchService.js
|
|
103805
|
+
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); }
|
|
103806
|
+
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; } } }; }
|
|
103807
|
+
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; } }
|
|
103808
|
+
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; }
|
|
103809
|
+
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; }
|
|
103810
|
+
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; }
|
|
103811
|
+
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; }
|
|
103812
|
+
function createHeaderSearchService_toPropertyKey(t) { var i = createHeaderSearchService_toPrimitive(t, "string"); return "symbol" == createHeaderSearchService_typeof(i) ? i : i + ""; }
|
|
103813
|
+
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); }
|
|
103814
|
+
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 }; })(); }
|
|
103815
|
+
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); }
|
|
103816
|
+
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); }
|
|
103817
|
+
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); }); }; }
|
|
103818
|
+
|
|
103819
|
+
|
|
103820
|
+
var DEFAULT_SEARCH_PLACEHOLDER = "Product Search";
|
|
103821
|
+
var createHeaderSearchService_DEFAULT_INPUT_ARIA_LABEL = "Product search";
|
|
103822
|
+
var DEFAULT_SUGGESTION_PAGE = 1;
|
|
103823
|
+
/** Matches storefront catalog suggestions API defaults (prod/test). */
|
|
103824
|
+
var DEFAULT_SUGGESTION_SIZE = 6;
|
|
103825
|
+
var DEFAULT_SEARCH_PATH = "/search";
|
|
103826
|
+
var PROD_CATALOG_API_BASE = "https://apis.nuskin.com";
|
|
103827
|
+
var TEST_CATALOG_API_BASE = "https://apis.test.nuskin.com";
|
|
103828
|
+
var CATALOG_SUGGESTIONS_PATH = "/storefront/catalogs/search/suggestions";
|
|
103829
|
+
var PROD_DEFAULT_STORE_ID = "404";
|
|
103830
|
+
var TEST_DEFAULT_STORE_ID = "430";
|
|
103831
|
+
function getBrowserLocation(providedLocation) {
|
|
103832
|
+
if (providedLocation) return providedLocation;
|
|
103833
|
+
if (typeof window !== "undefined" && window.location) return window.location;
|
|
103834
|
+
return null;
|
|
103835
|
+
}
|
|
103836
|
+
function getHostname(locationLike) {
|
|
103837
|
+
var _window$location;
|
|
103838
|
+
if (locationLike !== null && locationLike !== void 0 && locationLike.hostname) {
|
|
103839
|
+
return String(locationLike.hostname).toLowerCase();
|
|
103840
|
+
}
|
|
103841
|
+
if (typeof window !== "undefined" && (_window$location = window.location) !== null && _window$location !== void 0 && _window$location.hostname) {
|
|
103842
|
+
return String(window.location.hostname).toLowerCase();
|
|
103843
|
+
}
|
|
103844
|
+
return "";
|
|
103845
|
+
}
|
|
103846
|
+
function isTestLikeCatalogHost(host) {
|
|
103847
|
+
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"));
|
|
103848
|
+
}
|
|
103849
|
+
function resolveDefaultCatalogApiBaseUrl(locationLike) {
|
|
103850
|
+
return isTestLikeCatalogHost(getHostname(locationLike)) ? TEST_CATALOG_API_BASE : PROD_CATALOG_API_BASE;
|
|
103851
|
+
}
|
|
103852
|
+
function resolveDefaultCatalogStoreId(locationLike) {
|
|
103853
|
+
return isTestLikeCatalogHost(getHostname(locationLike)) ? TEST_DEFAULT_STORE_ID : PROD_DEFAULT_STORE_ID;
|
|
103854
|
+
}
|
|
103855
|
+
function getSessionStorage(providedStorage) {
|
|
103856
|
+
if (providedStorage) return providedStorage;
|
|
103857
|
+
if (typeof window !== "undefined") {
|
|
103858
|
+
try {
|
|
103859
|
+
return window.sessionStorage;
|
|
103860
|
+
} catch (_unused) {
|
|
103861
|
+
return null;
|
|
103862
|
+
}
|
|
103863
|
+
}
|
|
103864
|
+
return null;
|
|
103865
|
+
}
|
|
103866
|
+
function resolveLocaleParts(providedLocaleParts, locationLike) {
|
|
103867
|
+
if (providedLocaleParts !== null && providedLocaleParts !== void 0 && providedLocaleParts.country && providedLocaleParts !== null && providedLocaleParts !== void 0 && providedLocaleParts.language) {
|
|
103868
|
+
var _providedLocaleParts$;
|
|
103869
|
+
return {
|
|
103870
|
+
country: String(providedLocaleParts.country).trim().toUpperCase(),
|
|
103871
|
+
language: String(providedLocaleParts.language).trim().toLowerCase(),
|
|
103872
|
+
locale: String((_providedLocaleParts$ = providedLocaleParts.locale) !== null && _providedLocaleParts$ !== void 0 ? _providedLocaleParts$ : "").trim() || "".concat(String(providedLocaleParts.country).trim().toUpperCase(), "-").concat(String(providedLocaleParts.language).trim().toLowerCase())
|
|
103873
|
+
};
|
|
103874
|
+
}
|
|
103875
|
+
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 : "");
|
|
103876
|
+
try {
|
|
103877
|
+
return getLocale({
|
|
103878
|
+
url: pathSource
|
|
103879
|
+
});
|
|
103880
|
+
} catch (_unused2) {
|
|
103881
|
+
return {
|
|
103882
|
+
country: "US",
|
|
103883
|
+
language: "en",
|
|
103884
|
+
locale: "US-en"
|
|
103885
|
+
};
|
|
103886
|
+
}
|
|
103887
|
+
}
|
|
103888
|
+
function buildSearchResultsPath(query, localeParts) {
|
|
103889
|
+
var trimmedQuery = String(query !== null && query !== void 0 ? query : "").trim();
|
|
103890
|
+
var hyphenatedQuery = trimmedQuery.replace(/\s+/g, "-");
|
|
103891
|
+
var encodedQuery = encodeURIComponent(hyphenatedQuery).replace(/%2D/gi, "-");
|
|
103892
|
+
var country = localeParts.country.toLowerCase();
|
|
103893
|
+
var language = localeParts.language.toLowerCase();
|
|
103894
|
+
return "/".concat(country, "/").concat(language).concat(DEFAULT_SEARCH_PATH, "/").concat(encodedQuery);
|
|
103895
|
+
}
|
|
103896
|
+
function toCatalogLocale(localeParts) {
|
|
103897
|
+
var _localeParts$language, _localeParts$country;
|
|
103898
|
+
var language = String((_localeParts$language = localeParts === null || localeParts === void 0 ? void 0 : localeParts.language) !== null && _localeParts$language !== void 0 ? _localeParts$language : "en").toLowerCase();
|
|
103899
|
+
var country = String((_localeParts$country = localeParts === null || localeParts === void 0 ? void 0 : localeParts.country) !== null && _localeParts$country !== void 0 ? _localeParts$country : "US").toUpperCase();
|
|
103900
|
+
return "".concat(language, "_").concat(country);
|
|
103901
|
+
}
|
|
103902
|
+
function resolveSuggestionsUrl(suggestionsApi, locationLike) {
|
|
103903
|
+
var _locationLike$origin;
|
|
103904
|
+
var normalizedValue = String(suggestionsApi !== null && suggestionsApi !== void 0 ? suggestionsApi : "").trim();
|
|
103905
|
+
var defaultAbsolute = "".concat(resolveDefaultCatalogApiBaseUrl(locationLike)).concat(CATALOG_SUGGESTIONS_PATH);
|
|
103906
|
+
var pathOrUrl = normalizedValue || defaultAbsolute;
|
|
103907
|
+
if (pathOrUrl.startsWith("http://") || pathOrUrl.startsWith("https://")) {
|
|
103908
|
+
return pathOrUrl;
|
|
103909
|
+
}
|
|
103910
|
+
var normalizedPath = pathOrUrl.startsWith("/") ? pathOrUrl : "/".concat(pathOrUrl);
|
|
103911
|
+
var origin = String((_locationLike$origin = locationLike === null || locationLike === void 0 ? void 0 : locationLike.origin) !== null && _locationLike$origin !== void 0 ? _locationLike$origin : "").trim();
|
|
103912
|
+
return origin ? "".concat(origin).concat(normalizedPath) : defaultAbsolute;
|
|
103913
|
+
}
|
|
103914
|
+
function normalizeOptionUrl(rawValue) {
|
|
103915
|
+
if (typeof rawValue !== "string") return "";
|
|
103916
|
+
return rawValue.trim();
|
|
103917
|
+
}
|
|
103918
|
+
function safeDecodeURIComponent(value) {
|
|
103919
|
+
try {
|
|
103920
|
+
return decodeURIComponent(value);
|
|
103921
|
+
} catch (_unused3) {
|
|
103922
|
+
return value;
|
|
103923
|
+
}
|
|
103924
|
+
}
|
|
103925
|
+
function trimEdgeHyphens(value) {
|
|
103926
|
+
var normalizedValue = value;
|
|
103927
|
+
while (normalizedValue.startsWith("-")) {
|
|
103928
|
+
normalizedValue = normalizedValue.slice(1);
|
|
103929
|
+
}
|
|
103930
|
+
while (normalizedValue.endsWith("-")) {
|
|
103931
|
+
normalizedValue = normalizedValue.slice(0, -1);
|
|
103932
|
+
}
|
|
103933
|
+
return normalizedValue;
|
|
103934
|
+
}
|
|
103935
|
+
function slugifyPathSegment(value) {
|
|
103936
|
+
var decoded = safeDecodeURIComponent(String(value !== null && value !== void 0 ? value : "")).replace(/\+/g, " ");
|
|
103937
|
+
var normalized = decoded.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-zA-Z0-9]+/g, "-").replace(/-{2,}/g, "-").toLowerCase();
|
|
103938
|
+
return trimEdgeHyphens(normalized);
|
|
103939
|
+
}
|
|
103940
|
+
function buildProductSlugPath(slugValue, localeParts) {
|
|
103941
|
+
var _localeParts$country2, _localeParts$language2;
|
|
103942
|
+
var slug = slugifyPathSegment(slugValue);
|
|
103943
|
+
if (!slug) return "";
|
|
103944
|
+
var country = String((_localeParts$country2 = localeParts === null || localeParts === void 0 ? void 0 : localeParts.country) !== null && _localeParts$country2 !== void 0 ? _localeParts$country2 : "US").toLowerCase();
|
|
103945
|
+
var language = String((_localeParts$language2 = localeParts === null || localeParts === void 0 ? void 0 : localeParts.language) !== null && _localeParts$language2 !== void 0 ? _localeParts$language2 : "en").toLowerCase();
|
|
103946
|
+
return "/".concat(country, "/").concat(language, "/product/").concat(slug);
|
|
103947
|
+
}
|
|
103948
|
+
function isNavigableUrl(value) {
|
|
103949
|
+
if (!value) return false;
|
|
103950
|
+
return value.startsWith("/") || /^https?:\/\//i.test(value);
|
|
103951
|
+
}
|
|
103952
|
+
function resolveOptionHref(option, localeParts) {
|
|
103953
|
+
var _ref, _option$slug, _option$href;
|
|
103954
|
+
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);
|
|
103955
|
+
if (productSlugPath) {
|
|
103956
|
+
return productSlugPath;
|
|
103957
|
+
}
|
|
103958
|
+
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);
|
|
103959
|
+
if (isNavigableUrl(directUrl) && !directUrl.includes("/chr/")) return directUrl;
|
|
103960
|
+
return "";
|
|
103961
|
+
}
|
|
103962
|
+
function fetchJsonFromCandidates(_x, _x2) {
|
|
103963
|
+
return _fetchJsonFromCandidates.apply(this, arguments);
|
|
103964
|
+
}
|
|
103965
|
+
function _fetchJsonFromCandidates() {
|
|
103966
|
+
_fetchJsonFromCandidates = createHeaderSearchService_asyncToGenerator(/*#__PURE__*/createHeaderSearchService_regenerator().m(function _callee3(fetchImpl, requestUrls) {
|
|
103967
|
+
var lastError, _iterator, _step, requestUrl, response, _t, _t2;
|
|
103968
|
+
return createHeaderSearchService_regenerator().w(function (_context3) {
|
|
103969
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
103970
|
+
case 0:
|
|
103971
|
+
_iterator = _createForOfIteratorHelper(requestUrls);
|
|
103972
|
+
_context3.p = 1;
|
|
103973
|
+
_iterator.s();
|
|
103974
|
+
case 2:
|
|
103975
|
+
if ((_step = _iterator.n()).done) {
|
|
103976
|
+
_context3.n = 9;
|
|
103977
|
+
break;
|
|
103978
|
+
}
|
|
103979
|
+
requestUrl = _step.value;
|
|
103980
|
+
_context3.p = 3;
|
|
103981
|
+
_context3.n = 4;
|
|
103982
|
+
return fetchImpl(requestUrl, {
|
|
103983
|
+
method: "GET",
|
|
103984
|
+
credentials: "include",
|
|
103985
|
+
headers: {
|
|
103986
|
+
Accept: "application/json"
|
|
103987
|
+
}
|
|
103988
|
+
});
|
|
103989
|
+
case 4:
|
|
103990
|
+
response = _context3.v;
|
|
103991
|
+
if (response.ok) {
|
|
103992
|
+
_context3.n = 5;
|
|
103993
|
+
break;
|
|
103994
|
+
}
|
|
103995
|
+
lastError = new Error("Request failed with status ".concat(response.status));
|
|
103996
|
+
return _context3.a(3, 8);
|
|
103997
|
+
case 5:
|
|
103998
|
+
_context3.n = 6;
|
|
103999
|
+
return response.json();
|
|
104000
|
+
case 6:
|
|
104001
|
+
return _context3.a(2, _context3.v);
|
|
104002
|
+
case 7:
|
|
104003
|
+
_context3.p = 7;
|
|
104004
|
+
_t = _context3.v;
|
|
104005
|
+
lastError = _t;
|
|
104006
|
+
case 8:
|
|
104007
|
+
_context3.n = 2;
|
|
104008
|
+
break;
|
|
104009
|
+
case 9:
|
|
104010
|
+
_context3.n = 11;
|
|
104011
|
+
break;
|
|
104012
|
+
case 10:
|
|
104013
|
+
_context3.p = 10;
|
|
104014
|
+
_t2 = _context3.v;
|
|
104015
|
+
_iterator.e(_t2);
|
|
104016
|
+
case 11:
|
|
104017
|
+
_context3.p = 11;
|
|
104018
|
+
_iterator.f();
|
|
104019
|
+
return _context3.f(11);
|
|
104020
|
+
case 12:
|
|
104021
|
+
throw lastError !== null && lastError !== void 0 ? lastError : new Error("Unable to fetch header search data");
|
|
104022
|
+
case 13:
|
|
104023
|
+
return _context3.a(2);
|
|
104024
|
+
}
|
|
104025
|
+
}, _callee3, null, [[3, 7], [1, 10, 11, 12]]);
|
|
104026
|
+
}));
|
|
104027
|
+
return _fetchJsonFromCandidates.apply(this, arguments);
|
|
104028
|
+
}
|
|
104029
|
+
function createHeaderSearchService() {
|
|
104030
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
104031
|
+
var _options$fetchImpl = options.fetchImpl,
|
|
104032
|
+
fetchImpl = _options$fetchImpl === void 0 ? typeof fetch === "function" ? fetch.bind(globalThis) : null : _options$fetchImpl,
|
|
104033
|
+
providedLocation = options.location,
|
|
104034
|
+
providedStorage = options.storage,
|
|
104035
|
+
suggestionsApi = options.suggestionsApi,
|
|
104036
|
+
storeIdOption = options.storeId,
|
|
104037
|
+
country = options.country,
|
|
104038
|
+
language = options.language,
|
|
104039
|
+
locale = options.locale,
|
|
104040
|
+
_options$searchPlaceh = options.searchPlaceholder,
|
|
104041
|
+
searchPlaceholder = _options$searchPlaceh === void 0 ? DEFAULT_SEARCH_PLACEHOLDER : _options$searchPlaceh,
|
|
104042
|
+
_options$inputAriaLab = options.inputAriaLabel,
|
|
104043
|
+
inputAriaLabel = _options$inputAriaLab === void 0 ? createHeaderSearchService_DEFAULT_INPUT_ARIA_LABEL : _options$inputAriaLab;
|
|
104044
|
+
var locationLike = getBrowserLocation(providedLocation);
|
|
104045
|
+
var resolvedStoreId = storeIdOption !== undefined && storeIdOption !== null && String(storeIdOption).trim() !== "" ? String(storeIdOption).trim() : resolveDefaultCatalogStoreId(locationLike);
|
|
104046
|
+
var storage = getSessionStorage(providedStorage);
|
|
104047
|
+
var localeParts = resolveLocaleParts({
|
|
104048
|
+
country: country,
|
|
104049
|
+
language: language,
|
|
104050
|
+
locale: locale
|
|
104051
|
+
}, locationLike);
|
|
104052
|
+
var service = {
|
|
104053
|
+
getSearchChromeCopy: function getSearchChromeCopy() {
|
|
104054
|
+
return createHeaderSearchService_asyncToGenerator(/*#__PURE__*/createHeaderSearchService_regenerator().m(function _callee() {
|
|
104055
|
+
return createHeaderSearchService_regenerator().w(function (_context) {
|
|
104056
|
+
while (1) switch (_context.n) {
|
|
104057
|
+
case 0:
|
|
104058
|
+
return _context.a(2, {
|
|
104059
|
+
placeholder: searchPlaceholder || DEFAULT_SEARCH_PLACEHOLDER,
|
|
104060
|
+
inputAriaLabel: inputAriaLabel || createHeaderSearchService_DEFAULT_INPUT_ARIA_LABEL
|
|
104061
|
+
});
|
|
104062
|
+
}
|
|
104063
|
+
}, _callee);
|
|
104064
|
+
}))();
|
|
104065
|
+
},
|
|
104066
|
+
fetchSuggestions: function fetchSuggestions(searchTerm) {
|
|
104067
|
+
return createHeaderSearchService_asyncToGenerator(/*#__PURE__*/createHeaderSearchService_regenerator().m(function _callee2() {
|
|
104068
|
+
var _responsePayload$sugg, _ref2, _responsePayload$didY, _ref3, _ref4, _ref5, _responsePayload$tota, _responsePayload$page, _responsePayload$prod, _responsePayload$sugg2;
|
|
104069
|
+
var trimmedSearchTerm, queryParams, requestUrls, responsePayload;
|
|
104070
|
+
return createHeaderSearchService_regenerator().w(function (_context2) {
|
|
104071
|
+
while (1) switch (_context2.n) {
|
|
104072
|
+
case 0:
|
|
104073
|
+
trimmedSearchTerm = String(searchTerm !== null && searchTerm !== void 0 ? searchTerm : "").trim();
|
|
104074
|
+
if (!(!trimmedSearchTerm || !fetchImpl)) {
|
|
104075
|
+
_context2.n = 1;
|
|
104076
|
+
break;
|
|
104077
|
+
}
|
|
104078
|
+
return _context2.a(2, {
|
|
104079
|
+
suggestions: [],
|
|
104080
|
+
didYouMean: [],
|
|
104081
|
+
totalResultsCount: 0
|
|
104082
|
+
});
|
|
104083
|
+
case 1:
|
|
104084
|
+
queryParams = new URLSearchParams({
|
|
104085
|
+
searchTerm: trimmedSearchTerm,
|
|
104086
|
+
page: String(DEFAULT_SUGGESTION_PAGE),
|
|
104087
|
+
size: String(DEFAULT_SUGGESTION_SIZE),
|
|
104088
|
+
locale: toCatalogLocale(localeParts),
|
|
104089
|
+
storeId: String(resolvedStoreId)
|
|
104090
|
+
});
|
|
104091
|
+
requestUrls = ["".concat(resolveSuggestionsUrl(suggestionsApi, locationLike), "?").concat(queryParams.toString())];
|
|
104092
|
+
_context2.n = 2;
|
|
104093
|
+
return fetchJsonFromCandidates(fetchImpl, requestUrls);
|
|
104094
|
+
case 2:
|
|
104095
|
+
responsePayload = _context2.v;
|
|
104096
|
+
return _context2.a(2, createHeaderSearchService_objectSpread(createHeaderSearchService_objectSpread({}, responsePayload), {}, {
|
|
104097
|
+
suggestions: (_responsePayload$sugg = responsePayload === null || responsePayload === void 0 ? void 0 : responsePayload.suggestions) !== null && _responsePayload$sugg !== void 0 ? _responsePayload$sugg : [],
|
|
104098
|
+
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 : [],
|
|
104099
|
+
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
|
|
104100
|
+
}));
|
|
104101
|
+
}
|
|
104102
|
+
}, _callee2);
|
|
104103
|
+
}))();
|
|
104104
|
+
},
|
|
104105
|
+
submitProductSearch: function submitProductSearch(query, option) {
|
|
104106
|
+
var trimmedQuery = String(query !== null && query !== void 0 ? query : "").trim();
|
|
104107
|
+
if (!trimmedQuery) return undefined;
|
|
104108
|
+
addRecentHeaderSearch(localeParts, trimmedQuery, storage);
|
|
104109
|
+
var optionHref = resolveOptionHref(option, localeParts);
|
|
104110
|
+
if (optionHref && locationLike && typeof locationLike.assign === "function") {
|
|
104111
|
+
locationLike.assign(optionHref);
|
|
104112
|
+
return optionHref;
|
|
104113
|
+
}
|
|
104114
|
+
var targetPath = buildSearchResultsPath(trimmedQuery, localeParts);
|
|
104115
|
+
if (locationLike && typeof locationLike.assign === "function") {
|
|
104116
|
+
locationLike.assign(targetPath);
|
|
104117
|
+
}
|
|
104118
|
+
return targetPath;
|
|
104119
|
+
},
|
|
104120
|
+
activateSuggestionAction: function activateSuggestionAction(option) {
|
|
104121
|
+
var _ref6, _ref7, _option$value;
|
|
104122
|
+
var optionHref = resolveOptionHref(option, localeParts);
|
|
104123
|
+
if (optionHref && locationLike && typeof locationLike.assign === "function") {
|
|
104124
|
+
locationLike.assign(optionHref);
|
|
104125
|
+
return optionHref;
|
|
104126
|
+
}
|
|
104127
|
+
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 : "";
|
|
104128
|
+
return service.submitProductSearch(optionQuery);
|
|
104129
|
+
},
|
|
104130
|
+
viewMoreResults: function viewMoreResults(_ref8) {
|
|
104131
|
+
var query = _ref8.query;
|
|
104132
|
+
return service.submitProductSearch(query);
|
|
104133
|
+
},
|
|
104134
|
+
getRecentSearches: function getRecentSearches() {
|
|
104135
|
+
return getRecentHeaderSearches(localeParts, storage);
|
|
104136
|
+
},
|
|
104137
|
+
clearRecentSearches: function clearRecentSearches() {
|
|
104138
|
+
clearRecentHeaderSearches(localeParts, storage);
|
|
104139
|
+
}
|
|
104140
|
+
};
|
|
104141
|
+
return service;
|
|
104142
|
+
}
|
|
104143
|
+
;// ./src/components/header/regions/HeaderSearchRegion.jsx
|
|
104144
|
+
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); }
|
|
104145
|
+
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; }
|
|
104146
|
+
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; }
|
|
104147
|
+
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; }
|
|
104148
|
+
function HeaderSearchRegion_toPropertyKey(t) { var i = HeaderSearchRegion_toPrimitive(t, "string"); return "symbol" == HeaderSearchRegion_typeof(i) ? i : i + ""; }
|
|
104149
|
+
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); }
|
|
104150
|
+
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 }; })(); }
|
|
104151
|
+
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); }
|
|
104152
|
+
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); }
|
|
104153
|
+
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); }); }; }
|
|
104154
|
+
function HeaderSearchRegion_slicedToArray(r, e) { return HeaderSearchRegion_arrayWithHoles(r) || HeaderSearchRegion_iterableToArrayLimit(r, e) || HeaderSearchRegion_unsupportedIterableToArray(r, e) || HeaderSearchRegion_nonIterableRest(); }
|
|
104155
|
+
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."); }
|
|
104156
|
+
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; } }
|
|
104157
|
+
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; }
|
|
104158
|
+
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; } }
|
|
104159
|
+
function HeaderSearchRegion_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
104160
|
+
|
|
104161
|
+
|
|
104162
|
+
|
|
104163
|
+
|
|
104164
|
+
|
|
104165
|
+
|
|
104166
|
+
function HeaderSearchRegion(_ref) {
|
|
104167
|
+
var _searchConfig$autoCom2, _searchConfig$autoCom3, _searchConfig$recentS;
|
|
104168
|
+
var country = _ref.country,
|
|
104169
|
+
language = _ref.language,
|
|
104170
|
+
locale = _ref.locale,
|
|
104171
|
+
searchConfig = _ref.searchConfig,
|
|
104172
|
+
showMobileTrigger = _ref.showMobileTrigger,
|
|
104173
|
+
showDesktopTrigger = _ref.showDesktopTrigger;
|
|
104174
|
+
var headerSearchService = (0,external_react_.useMemo)(function () {
|
|
104175
|
+
var _searchConfig$autoCom;
|
|
104176
|
+
return createHeaderSearchService({
|
|
104177
|
+
country: country,
|
|
104178
|
+
language: language,
|
|
104179
|
+
locale: locale,
|
|
104180
|
+
searchPlaceholder: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.searchPlaceholder,
|
|
104181
|
+
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)
|
|
104182
|
+
});
|
|
104183
|
+
}, [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]);
|
|
104184
|
+
var _useState = (0,external_react_.useState)(null),
|
|
104185
|
+
_useState2 = HeaderSearchRegion_slicedToArray(_useState, 2),
|
|
104186
|
+
copy = _useState2[0],
|
|
104187
|
+
setCopy = _useState2[1];
|
|
104188
|
+
(0,external_react_.useEffect)(function () {
|
|
104189
|
+
var canceled = false;
|
|
104190
|
+
HeaderSearchRegion_asyncToGenerator(/*#__PURE__*/HeaderSearchRegion_regenerator().m(function _callee() {
|
|
104191
|
+
var c, _t;
|
|
104192
|
+
return HeaderSearchRegion_regenerator().w(function (_context) {
|
|
104193
|
+
while (1) switch (_context.p = _context.n) {
|
|
104194
|
+
case 0:
|
|
104195
|
+
_context.p = 0;
|
|
104196
|
+
_context.n = 1;
|
|
104197
|
+
return headerSearchService.getSearchChromeCopy();
|
|
104198
|
+
case 1:
|
|
104199
|
+
c = _context.v;
|
|
104200
|
+
if (!canceled) setCopy(c);
|
|
104201
|
+
_context.n = 3;
|
|
104202
|
+
break;
|
|
104203
|
+
case 2:
|
|
104204
|
+
_context.p = 2;
|
|
104205
|
+
_t = _context.v;
|
|
104206
|
+
case 3:
|
|
104207
|
+
return _context.a(2);
|
|
104208
|
+
}
|
|
104209
|
+
}, _callee, null, [[0, 2]]);
|
|
104210
|
+
}))();
|
|
104211
|
+
return function () {
|
|
104212
|
+
canceled = true;
|
|
104213
|
+
};
|
|
104214
|
+
}, [headerSearchService]);
|
|
104215
|
+
var resolvedTriggerPlaceholder = (searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.triggerPlaceholder) || (copy === null || copy === void 0 ? void 0 : copy.placeholder) || TRIGGER_PLACEHOLDER;
|
|
104216
|
+
var resolvedSearchPlaceholder = (searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.searchPlaceholder) || (copy === null || copy === void 0 ? void 0 : copy.placeholder) || SEARCH_PLACEHOLDER;
|
|
104217
|
+
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";
|
|
104218
|
+
var modalCopy = (0,external_react_.useMemo)(function () {
|
|
104219
|
+
var _searchConfig$autoCom4;
|
|
104220
|
+
return HeaderSearchRegion_objectSpread(HeaderSearchRegion_objectSpread({}, searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.autoCompleteCopy), {}, {
|
|
104221
|
+
placeholder: resolvedSearchPlaceholder || (searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.searchPlaceholder) || SEARCH_PLACEHOLDER,
|
|
104222
|
+
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
|
|
104223
|
+
});
|
|
104224
|
+
}, [copy === null || copy === void 0 ? void 0 : copy.inputAriaLabel, resolvedSearchPlaceholder, searchConfig]);
|
|
101072
104225
|
return /*#__PURE__*/(0,jsx_runtime_.jsx)("div", {
|
|
101073
104226
|
"data-region": "search",
|
|
101074
|
-
children: /*#__PURE__*/(0,jsx_runtime_.
|
|
101075
|
-
|
|
101076
|
-
|
|
101077
|
-
|
|
101078
|
-
|
|
101079
|
-
|
|
101080
|
-
|
|
101081
|
-
|
|
101082
|
-
|
|
101083
|
-
|
|
101084
|
-
|
|
101085
|
-
|
|
101086
|
-
|
|
101087
|
-
|
|
101088
|
-
|
|
101089
|
-
|
|
104227
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(SearchModal, {
|
|
104228
|
+
triggerPlaceholder: resolvedTriggerPlaceholder,
|
|
104229
|
+
searchPlaceholder: resolvedSearchPlaceholder,
|
|
104230
|
+
onSearch: function onSearch(query) {
|
|
104231
|
+
return headerSearchService.submitProductSearch(query);
|
|
104232
|
+
},
|
|
104233
|
+
modalTitle: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.modalTitle,
|
|
104234
|
+
brandLogo: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.brandLogo,
|
|
104235
|
+
brandLogoAlt: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.brandLogoAlt,
|
|
104236
|
+
brandHref: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.brandHref,
|
|
104237
|
+
brandSize: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.brandSize,
|
|
104238
|
+
showBrandLogo: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.showBrandLogo,
|
|
104239
|
+
cancelLabel: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.cancelLabel,
|
|
104240
|
+
cancelShowIcon: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.cancelShowIcon,
|
|
104241
|
+
showRecentSearches: (_searchConfig$recentS = searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.recentSearchesEnabled) !== null && _searchConfig$recentS !== void 0 ? _searchConfig$recentS : true,
|
|
104242
|
+
autoCompleteEnabled: autoCompleteEnabled,
|
|
104243
|
+
recentSearchesHeading: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.recentSearchesHeading,
|
|
104244
|
+
clearAllLabel: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.clearAllLabel,
|
|
104245
|
+
parent$: searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.editableTags,
|
|
104246
|
+
headerSearchService: headerSearchService,
|
|
104247
|
+
copy: modalCopy,
|
|
104248
|
+
showMobileTrigger: showMobileTrigger,
|
|
104249
|
+
showDesktopTrigger: showDesktopTrigger
|
|
101090
104250
|
})
|
|
101091
104251
|
});
|
|
101092
104252
|
}
|
|
101093
104253
|
HeaderSearchRegion.propTypes = {
|
|
101094
|
-
|
|
101095
|
-
|
|
101096
|
-
|
|
101097
|
-
|
|
104254
|
+
country: external_prop_types_["default"].string.isRequired,
|
|
104255
|
+
language: external_prop_types_["default"].string.isRequired,
|
|
104256
|
+
locale: external_prop_types_["default"].string.isRequired,
|
|
104257
|
+
searchConfig: external_prop_types_["default"].object,
|
|
104258
|
+
showMobileTrigger: external_prop_types_["default"].bool,
|
|
104259
|
+
showDesktopTrigger: external_prop_types_["default"].bool
|
|
101098
104260
|
};
|
|
101099
104261
|
;// ./src/components/header/regions/HeaderNavigationRegion.jsx
|
|
101100
104262
|
function HeaderNavigationRegion_slicedToArray(r, e) { return HeaderNavigationRegion_arrayWithHoles(r) || HeaderNavigationRegion_iterableToArrayLimit(r, e) || HeaderNavigationRegion_unsupportedIterableToArray(r, e) || HeaderNavigationRegion_nonIterableRest(); }
|
|
@@ -101381,153 +104543,50 @@ var TopRibbon = function TopRibbon(_ref) {
|
|
|
101381
104543
|
};
|
|
101382
104544
|
TopRibbon.propTypes = TopRibbonPropTypes;
|
|
101383
104545
|
/* harmony default export */ const top_ribbon_TopRibbon = (TopRibbon);
|
|
101384
|
-
;// ./src/components/
|
|
101385
|
-
|
|
101386
|
-
|
|
101387
|
-
|
|
101388
|
-
|
|
101389
|
-
|
|
101390
|
-
|
|
101391
|
-
|
|
101392
|
-
|
|
101393
|
-
|
|
101394
|
-
|
|
101395
|
-
|
|
101396
|
-
|
|
101397
|
-
|
|
101398
|
-
|
|
101399
|
-
|
|
101400
|
-
|
|
101401
|
-
|
|
101402
|
-
|
|
101403
|
-
|
|
101404
|
-
|
|
101405
|
-
|
|
101406
|
-
|
|
101407
|
-
|
|
101408
|
-
|
|
101409
|
-
|
|
101410
|
-
|
|
101411
|
-
|
|
101412
|
-
|
|
101413
|
-
|
|
101414
|
-
|
|
101415
|
-
|
|
101416
|
-
|
|
101417
|
-
|
|
101418
|
-
|
|
101419
|
-
|
|
101420
|
-
|
|
101421
|
-
|
|
101422
|
-
|
|
101423
|
-
|
|
101424
|
-
|
|
101425
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerNavButton, {
|
|
101426
|
-
children: [item.label, /*#__PURE__*/(0,jsx_runtime_.jsx)(IconChevronDown, {})]
|
|
101427
|
-
})
|
|
101428
|
-
}, item.id);
|
|
101429
|
-
}), (loyaltyData === null || loyaltyData === void 0 ? void 0 : loyaltyData.link_label) && /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavItem, {
|
|
101430
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavButton, {
|
|
101431
|
-
as: "a",
|
|
101432
|
-
href: loyaltyData.href,
|
|
101433
|
-
style: {
|
|
101434
|
-
justifyContent: 'flex-start'
|
|
101435
|
-
},
|
|
101436
|
-
children: loyaltyData.link_label
|
|
101437
|
-
})
|
|
101438
|
-
}), marketTriggerMountRef ? null : /*#__PURE__*/(0,jsx_runtime_.jsx)(MobileDrawerNavItem, {
|
|
101439
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileDrawerLocaleButton, {
|
|
101440
|
-
children: [localeData.control_label, /*#__PURE__*/(0,jsx_runtime_.jsx)(IconChevronDown, {})]
|
|
101441
|
-
})
|
|
101442
|
-
})]
|
|
101443
|
-
})]
|
|
101444
|
-
})]
|
|
101445
|
-
});
|
|
104546
|
+
;// ./src/components/brand/brand.helpers.js
|
|
104547
|
+
function parseLogoData(logoData) {
|
|
104548
|
+
if (!logoData) {
|
|
104549
|
+
return {
|
|
104550
|
+
logo: undefined,
|
|
104551
|
+
logoAlt: undefined,
|
|
104552
|
+
href: undefined,
|
|
104553
|
+
showLogo: true,
|
|
104554
|
+
size: "Large",
|
|
104555
|
+
$: null
|
|
104556
|
+
};
|
|
104557
|
+
}
|
|
104558
|
+
var _logoData$show = logoData.show,
|
|
104559
|
+
show = _logoData$show === void 0 ? true : _logoData$show,
|
|
104560
|
+
header_logo = logoData.header_logo,
|
|
104561
|
+
logo_alt = logoData.logo_alt,
|
|
104562
|
+
logo_url = logoData.logo_url,
|
|
104563
|
+
_logoData$logo_size = logoData.logo_size,
|
|
104564
|
+
logo_size = _logoData$logo_size === void 0 ? "Large" : _logoData$logo_size;
|
|
104565
|
+
var logoUrl;
|
|
104566
|
+
if (header_logo) {
|
|
104567
|
+
try {
|
|
104568
|
+
var parsed = JSON.parse(header_logo);
|
|
104569
|
+
var imageArray = parsed === null || parsed === void 0 ? void 0 : parsed.image;
|
|
104570
|
+
if (Array.isArray(imageArray) && imageArray.length > 0) {
|
|
104571
|
+
var _firstImage$selected, _firstImage$files, _firstImage$files2;
|
|
104572
|
+
var firstImage = imageArray[0];
|
|
104573
|
+
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);
|
|
104574
|
+
}
|
|
104575
|
+
} catch (err) {
|
|
104576
|
+
console.warn("Failed to parse header_logo JSON:", err);
|
|
104577
|
+
}
|
|
104578
|
+
}
|
|
104579
|
+
return {
|
|
104580
|
+
logo: logoUrl,
|
|
104581
|
+
logoAlt: logo_alt,
|
|
104582
|
+
href: logo_url,
|
|
104583
|
+
showLogo: show,
|
|
104584
|
+
size: logo_size,
|
|
104585
|
+
$: logoData.$ || null
|
|
104586
|
+
};
|
|
101446
104587
|
}
|
|
101447
|
-
MobileHeaderDrawer.propTypes = {
|
|
101448
|
-
isOpen: external_prop_types_["default"].bool.isRequired,
|
|
101449
|
-
onClose: external_prop_types_["default"].func.isRequired,
|
|
101450
|
-
logoData: external_prop_types_["default"].object.isRequired,
|
|
101451
|
-
localeData: external_prop_types_["default"].object.isRequired,
|
|
101452
|
-
navigationData: external_prop_types_["default"].object.isRequired,
|
|
101453
|
-
loyaltyData: external_prop_types_["default"].object,
|
|
101454
|
-
marketTriggerMountRef: external_prop_types_["default"].shape({
|
|
101455
|
-
current: external_prop_types_["default"].any
|
|
101456
|
-
})
|
|
101457
|
-
};
|
|
101458
104588
|
// EXTERNAL MODULE: external "react-dom"
|
|
101459
104589
|
var external_react_dom_ = __webpack_require__(7516);
|
|
101460
|
-
// EXTERNAL MODULE: ./node_modules/@mui/material/Button/Button.js
|
|
101461
|
-
var Button = __webpack_require__(1629);
|
|
101462
|
-
;// ./src/components/button/CancelButton.styled.jsx
|
|
101463
|
-
|
|
101464
|
-
|
|
101465
|
-
var CLOSE_BUTTON_DESKTOP_MIN_WIDTH_PX = 1025;
|
|
101466
|
-
var CancelButtonRoot = /*#__PURE__*/createStyled(Button/* default */.A, true ? {
|
|
101467
|
-
target: "e1rel7ar2"
|
|
101468
|
-
} : 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));
|
|
101469
|
-
var CancelButtonIconWrap = /*#__PURE__*/createStyled("span", true ? {
|
|
101470
|
-
target: "e1rel7ar1"
|
|
101471
|
-
} : 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));
|
|
101472
|
-
var CancelButtonText = /*#__PURE__*/createStyled("span", true ? {
|
|
101473
|
-
target: "e1rel7ar0"
|
|
101474
|
-
} : 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));
|
|
101475
|
-
;// ./src/components/button/CancelButton.jsx
|
|
101476
|
-
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); }
|
|
101477
|
-
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; }
|
|
101478
|
-
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; }
|
|
101479
|
-
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; }
|
|
101480
|
-
function CancelButton_toPropertyKey(t) { var i = CancelButton_toPrimitive(t, "string"); return "symbol" == CancelButton_typeof(i) ? i : i + ""; }
|
|
101481
|
-
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); }
|
|
101482
|
-
|
|
101483
|
-
|
|
101484
|
-
|
|
101485
|
-
|
|
101486
|
-
|
|
101487
|
-
function CancelButton(_ref) {
|
|
101488
|
-
var _ref$label = _ref.label,
|
|
101489
|
-
label = _ref$label === void 0 ? "Cancel" : _ref$label,
|
|
101490
|
-
_ref$onClick = _ref.onClick,
|
|
101491
|
-
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
101492
|
-
ariaLabel = _ref.ariaLabel,
|
|
101493
|
-
className = _ref.className,
|
|
101494
|
-
_ref$iconName = _ref.iconName,
|
|
101495
|
-
iconName = _ref$iconName === void 0 ? "close" : _ref$iconName,
|
|
101496
|
-
_ref$iconColor = _ref.iconColor,
|
|
101497
|
-
iconColor = _ref$iconColor === void 0 ? "#252525" : _ref$iconColor,
|
|
101498
|
-
_ref$showIcon = _ref.showIcon,
|
|
101499
|
-
showIcon = _ref$showIcon === void 0 ? true : _ref$showIcon,
|
|
101500
|
-
_ref$parent$ = _ref.parent$,
|
|
101501
|
-
parent$ = _ref$parent$ === void 0 ? {} : _ref$parent$;
|
|
101502
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(CancelButtonRoot, {
|
|
101503
|
-
className: className,
|
|
101504
|
-
"aria-label": ariaLabel || label,
|
|
101505
|
-
"data-testid": "cancel-button",
|
|
101506
|
-
disableRipple: true,
|
|
101507
|
-
onClick: onClick,
|
|
101508
|
-
type: "button",
|
|
101509
|
-
children: [showIcon ? /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButtonIconWrap, {
|
|
101510
|
-
"aria-hidden": "true",
|
|
101511
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(dist.NsIcon, {
|
|
101512
|
-
name: iconName,
|
|
101513
|
-
size: "small",
|
|
101514
|
-
colorOverride: iconColor
|
|
101515
|
-
})
|
|
101516
|
-
}) : null, /*#__PURE__*/(0,jsx_runtime_.jsx)(CancelButtonText, CancelButton_objectSpread(CancelButton_objectSpread({}, parent$ !== null && parent$ !== void 0 ? parent$ : {}), {}, {
|
|
101517
|
-
children: label
|
|
101518
|
-
}))]
|
|
101519
|
-
});
|
|
101520
|
-
}
|
|
101521
|
-
CancelButton.propTypes = {
|
|
101522
|
-
label: external_prop_types_["default"].string,
|
|
101523
|
-
onClick: external_prop_types_["default"].func,
|
|
101524
|
-
ariaLabel: external_prop_types_["default"].string,
|
|
101525
|
-
className: external_prop_types_["default"].string,
|
|
101526
|
-
iconName: external_prop_types_["default"].string,
|
|
101527
|
-
iconColor: external_prop_types_["default"].string,
|
|
101528
|
-
showIcon: external_prop_types_["default"].bool,
|
|
101529
|
-
parent$: external_prop_types_["default"].object
|
|
101530
|
-
};
|
|
101531
104590
|
;// ./src/components/tabs/constants.js
|
|
101532
104591
|
var TABS_TOP_NAV_MAX_WIDTH_PX = 1920;
|
|
101533
104592
|
var TABS_TOP_NAV_ROOT_PADDING = "32px 32px 16px";
|
|
@@ -102018,14 +105077,14 @@ var IconSlot = /*#__PURE__*/createStyled("span", true ? {
|
|
|
102018
105077
|
} : 0);
|
|
102019
105078
|
;// ./src/components/label-icon/LabelWithIcon.jsx
|
|
102020
105079
|
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); }
|
|
102021
|
-
var
|
|
105080
|
+
var LabelWithIcon_excluded = ["label", "label$", "icon", "iconPosition", "showIcon", "showDivider", "as", "href", "onClick", "disabled", "className", "tooltip", "aria-label"];
|
|
102022
105081
|
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; }
|
|
102023
105082
|
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; }
|
|
102024
105083
|
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; }
|
|
102025
105084
|
function LabelWithIcon_toPropertyKey(t) { var i = LabelWithIcon_toPrimitive(t, "string"); return "symbol" == LabelWithIcon_typeof(i) ? i : i + ""; }
|
|
102026
105085
|
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); }
|
|
102027
|
-
function
|
|
102028
|
-
function
|
|
105086
|
+
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; }
|
|
105087
|
+
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; }
|
|
102029
105088
|
|
|
102030
105089
|
|
|
102031
105090
|
|
|
@@ -102064,7 +105123,7 @@ function LabelWithIcon(_ref) {
|
|
|
102064
105123
|
className = _ref.className,
|
|
102065
105124
|
tooltip = _ref.tooltip,
|
|
102066
105125
|
ariaLabel = _ref["aria-label"],
|
|
102067
|
-
rest =
|
|
105126
|
+
rest = LabelWithIcon_objectWithoutProperties(_ref, LabelWithIcon_excluded);
|
|
102068
105127
|
var isInteractive = Tag === "a" || !!onClick;
|
|
102069
105128
|
var rootProps = LabelWithIcon_objectSpread(LabelWithIcon_objectSpread({
|
|
102070
105129
|
as: Tag,
|
|
@@ -102122,105 +105181,6 @@ LabelWithIcon.defaultProps = {
|
|
|
102122
105181
|
"aria-label": undefined,
|
|
102123
105182
|
tooltip: undefined
|
|
102124
105183
|
};
|
|
102125
|
-
;// ./src/utils/locale.js
|
|
102126
|
-
/**
|
|
102127
|
-
* Extracts the locale code from the provided URL or the current URL.
|
|
102128
|
-
*
|
|
102129
|
-
* @param options - An object with the following properties:
|
|
102130
|
-
* @param options.url - The URL to extract the locale code from. If not provided, the current URL will be used.
|
|
102131
|
-
* @param options.defaultLocale - The default locale code to use if the locale cannot be extracted from the URL.
|
|
102132
|
-
* @returns The locale code in the format "language_COUNTRY".
|
|
102133
|
-
*/
|
|
102134
|
-
function getLocaleCodeFromUrl(options) {
|
|
102135
|
-
var _localeAsArr$;
|
|
102136
|
-
var _ref = options !== null && options !== void 0 ? options : {},
|
|
102137
|
-
_ref$url = _ref.url,
|
|
102138
|
-
url = _ref$url === void 0 ? "" : _ref$url,
|
|
102139
|
-
_ref$defaultLocale = _ref.defaultLocale,
|
|
102140
|
-
defaultLocale = _ref$defaultLocale === void 0 ? "" : _ref$defaultLocale;
|
|
102141
|
-
var localeAsArr = [];
|
|
102142
|
-
var tempUrl = url || typeof location != "undefined" && location.href;
|
|
102143
|
-
if (tempUrl) {
|
|
102144
|
-
var _tempUrl, _tempUrl2;
|
|
102145
|
-
/* adding dummy domain since express originalUrl will not have request domain */
|
|
102146
|
-
if (!((_tempUrl = tempUrl) !== null && _tempUrl !== void 0 && _tempUrl.includes("https://")) && !((_tempUrl2 = tempUrl) !== null && _tempUrl2 !== void 0 && _tempUrl2.includes("http://"))) {
|
|
102147
|
-
tempUrl = "https://domain.com".concat(tempUrl);
|
|
102148
|
-
}
|
|
102149
|
-
var updatedUrl = new URL(tempUrl);
|
|
102150
|
-
var pathParams = updatedUrl.pathname;
|
|
102151
|
-
if (pathParams) {
|
|
102152
|
-
var _pathParams$split;
|
|
102153
|
-
var pathList = pathParams === null || pathParams === void 0 || (_pathParams$split = pathParams.split("/")) === null || _pathParams$split === void 0 ? void 0 : _pathParams$split.filter(Boolean);
|
|
102154
|
-
if (pathList.length > 1) {
|
|
102155
|
-
localeAsArr = pathList;
|
|
102156
|
-
}
|
|
102157
|
-
}
|
|
102158
|
-
if (localeAsArr.length > 2) {
|
|
102159
|
-
localeAsArr = localeAsArr.slice(0, 2);
|
|
102160
|
-
}
|
|
102161
|
-
}
|
|
102162
|
-
localeAsArr = localeAsArr.reverse();
|
|
102163
|
-
if (localeAsArr.length === 0) {
|
|
102164
|
-
localeAsArr = defaultLocale.split("_");
|
|
102165
|
-
}
|
|
102166
|
-
return "".concat((_localeAsArr$ = localeAsArr[1]) === null || _localeAsArr$ === void 0 ? void 0 : _localeAsArr$.toUpperCase(), "-").concat(localeAsArr[0]);
|
|
102167
|
-
}
|
|
102168
|
-
function getLocale() {
|
|
102169
|
-
var _splitLocale$, _splitLocale$2;
|
|
102170
|
-
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
102171
|
-
url = _ref2.url;
|
|
102172
|
-
var currentLocale = getLocaleCodeFromUrl(url ? {
|
|
102173
|
-
url: url
|
|
102174
|
-
} : null);
|
|
102175
|
-
var splitLocale = currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.split("-");
|
|
102176
|
-
return {
|
|
102177
|
-
locale: currentLocale,
|
|
102178
|
-
language: splitLocale === null || splitLocale === void 0 || (_splitLocale$ = splitLocale[1]) === null || _splitLocale$ === void 0 ? void 0 : _splitLocale$.toLowerCase(),
|
|
102179
|
-
country: splitLocale === null || splitLocale === void 0 || (_splitLocale$2 = splitLocale[0]) === null || _splitLocale$2 === void 0 ? void 0 : _splitLocale$2.toUpperCase()
|
|
102180
|
-
};
|
|
102181
|
-
}
|
|
102182
|
-
function locale_isBrowser() {
|
|
102183
|
-
return typeof window !== "undefined" && window != null;
|
|
102184
|
-
}
|
|
102185
|
-
|
|
102186
|
-
/** Normalized `country`, `language`, and `locale` string from explicit market + language. */
|
|
102187
|
-
function buildLocaleData(market, language) {
|
|
102188
|
-
var country = String(market).trim().toUpperCase();
|
|
102189
|
-
var lang = String(language).trim().toLowerCase();
|
|
102190
|
-
if (!country || !lang) {
|
|
102191
|
-
throw new Error("@nuskin/nextgen-header: `market` and `language` must be non-empty when provided.");
|
|
102192
|
-
}
|
|
102193
|
-
return {
|
|
102194
|
-
country: country,
|
|
102195
|
-
language: lang,
|
|
102196
|
-
locale: "".concat(country, "-").concat(lang)
|
|
102197
|
-
};
|
|
102198
|
-
}
|
|
102199
|
-
|
|
102200
|
-
/**
|
|
102201
|
-
* Resolves locale data (`country`, `language`, `locale`) for the header shell.
|
|
102202
|
-
*
|
|
102203
|
-
* - **SSR (no `window`):** `market` and `language` are required (e.g. from the host or from `requestUrl` in `renderAndExtractContext`).
|
|
102204
|
-
* - **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.
|
|
102205
|
-
*/
|
|
102206
|
-
function resolveHeaderLocale() {
|
|
102207
|
-
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
102208
|
-
market = _ref3.market,
|
|
102209
|
-
language = _ref3.language;
|
|
102210
|
-
var explicit = market != null && language != null && String(market).trim() !== "" && String(language).trim() !== "";
|
|
102211
|
-
if (explicit) {
|
|
102212
|
-
return buildLocaleData(market, language);
|
|
102213
|
-
}
|
|
102214
|
-
if (!locale_isBrowser()) {
|
|
102215
|
-
return buildLocaleData("US", "en");
|
|
102216
|
-
}
|
|
102217
|
-
var fromUrl = getLocale();
|
|
102218
|
-
if (!fromUrl.country || !fromUrl.language || !fromUrl.locale || String(fromUrl.locale).includes("undefined")) {
|
|
102219
|
-
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.");
|
|
102220
|
-
}
|
|
102221
|
-
return fromUrl;
|
|
102222
|
-
}
|
|
102223
|
-
|
|
102224
105184
|
;// ./src/components/country-list-selector/CountryListSelector.constants.js
|
|
102225
105185
|
var COUNTRY_LIST_SELECTOR_BASE_URL = "";
|
|
102226
105186
|
;// ./src/components/country-list-selector/CountryListSelector.helpers.js
|
|
@@ -103406,6 +106366,7 @@ var RememberCheckbox = /*#__PURE__*/createStyled("input", true ? {
|
|
|
103406
106366
|
// EXTERNAL MODULE: ./node_modules/@nuskin/configuration-sdk/src/index.js
|
|
103407
106367
|
var src = __webpack_require__(4734);
|
|
103408
106368
|
;// ./src/services/HeaderMarketSelectorService.js
|
|
106369
|
+
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); }
|
|
103409
106370
|
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; }
|
|
103410
106371
|
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; }
|
|
103411
106372
|
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; }
|
|
@@ -103413,7 +106374,6 @@ function HeaderMarketSelectorService_toPropertyKey(t) { var i = HeaderMarketSele
|
|
|
103413
106374
|
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); }
|
|
103414
106375
|
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 }; })(); }
|
|
103415
106376
|
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); }
|
|
103416
|
-
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); }
|
|
103417
106377
|
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); }
|
|
103418
106378
|
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); }); }; }
|
|
103419
106379
|
|
|
@@ -103478,35 +106438,16 @@ function ensureTrailingSlash(url) {
|
|
|
103478
106438
|
if (!raw) return "";
|
|
103479
106439
|
return raw.endsWith("/") ? raw : "".concat(raw, "/");
|
|
103480
106440
|
}
|
|
103481
|
-
function shouldLogConfigDebug(browserWindow) {
|
|
103482
|
-
var _browserWindow$locati;
|
|
103483
|
-
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"));
|
|
103484
|
-
}
|
|
103485
|
-
function logConfigFetchRequest(_ref3) {
|
|
103486
|
-
var configMapName = _ref3.configMapName,
|
|
103487
|
-
countryCodeUpper = _ref3.countryCodeUpper,
|
|
103488
|
-
environment = _ref3.environment,
|
|
103489
|
-
clientId = _ref3.clientId,
|
|
103490
|
-
shoppingContext = _ref3.shoppingContext;
|
|
103491
|
-
// eslint-disable-next-line no-console
|
|
103492
|
-
console.log("[HeaderMarketSelectorService] calling getConfiguration", {
|
|
103493
|
-
configMapName: configMapName,
|
|
103494
|
-
country: countryCodeUpper || "US",
|
|
103495
|
-
environment: environment,
|
|
103496
|
-
clientId: clientId,
|
|
103497
|
-
shoppingContext: shoppingContext !== null && shoppingContext !== void 0 ? shoppingContext : null
|
|
103498
|
-
});
|
|
103499
|
-
}
|
|
103500
106441
|
function fetchMarketConfig(_x) {
|
|
103501
106442
|
return _fetchMarketConfig.apply(this, arguments);
|
|
103502
106443
|
}
|
|
103503
106444
|
function _fetchMarketConfig() {
|
|
103504
|
-
_fetchMarketConfig = HeaderMarketSelectorService_asyncToGenerator(/*#__PURE__*/HeaderMarketSelectorService_regenerator().m(function _callee2(
|
|
106445
|
+
_fetchMarketConfig = HeaderMarketSelectorService_asyncToGenerator(/*#__PURE__*/HeaderMarketSelectorService_regenerator().m(function _callee2(_ref3) {
|
|
103505
106446
|
var configMapName, countryCodeUpper, environment, clientId, shoppingContext, config;
|
|
103506
106447
|
return HeaderMarketSelectorService_regenerator().w(function (_context2) {
|
|
103507
106448
|
while (1) switch (_context2.n) {
|
|
103508
106449
|
case 0:
|
|
103509
|
-
configMapName =
|
|
106450
|
+
configMapName = _ref3.configMapName, countryCodeUpper = _ref3.countryCodeUpper, environment = _ref3.environment, clientId = _ref3.clientId, shoppingContext = _ref3.shoppingContext;
|
|
103510
106451
|
_context2.n = 1;
|
|
103511
106452
|
return (0,src.getConfiguration)([configMapName], HeaderMarketSelectorService_objectSpread({
|
|
103512
106453
|
country: countryCodeUpper || "US",
|
|
@@ -103523,18 +106464,18 @@ function _fetchMarketConfig() {
|
|
|
103523
106464
|
}));
|
|
103524
106465
|
return _fetchMarketConfig.apply(this, arguments);
|
|
103525
106466
|
}
|
|
103526
|
-
function resolveTemplate(
|
|
103527
|
-
var shouldUseEqHomeUrl =
|
|
103528
|
-
eqTemplate =
|
|
103529
|
-
homeTemplate =
|
|
106467
|
+
function resolveTemplate(_ref4) {
|
|
106468
|
+
var shouldUseEqHomeUrl = _ref4.shouldUseEqHomeUrl,
|
|
106469
|
+
eqTemplate = _ref4.eqTemplate,
|
|
106470
|
+
homeTemplate = _ref4.homeTemplate;
|
|
103530
106471
|
return shouldUseEqHomeUrl && eqTemplate ? eqTemplate : homeTemplate || "/";
|
|
103531
106472
|
}
|
|
103532
106473
|
function createHeaderMarketSelectorService() {
|
|
103533
|
-
var
|
|
103534
|
-
|
|
103535
|
-
clientId =
|
|
103536
|
-
|
|
103537
|
-
configMapName =
|
|
106474
|
+
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
106475
|
+
_ref5$clientId = _ref5.clientId,
|
|
106476
|
+
clientId = _ref5$clientId === void 0 ? "63056848d7532f9923f3d08cb48c423b" : _ref5$clientId,
|
|
106477
|
+
_ref5$configMapName = _ref5.configMapName,
|
|
106478
|
+
configMapName = _ref5$configMapName === void 0 ? EQUINOX_MARKETS_MAP : _ref5$configMapName;
|
|
103538
106479
|
return {
|
|
103539
106480
|
/**
|
|
103540
106481
|
* Resolves the redirect URL after selecting a country + language.
|
|
@@ -103543,15 +106484,15 @@ function createHeaderMarketSelectorService() {
|
|
|
103543
106484
|
resolveRedirectUrl: function resolveRedirectUrl() {
|
|
103544
106485
|
var _arguments = arguments;
|
|
103545
106486
|
return HeaderMarketSelectorService_asyncToGenerator(/*#__PURE__*/HeaderMarketSelectorService_regenerator().m(function _callee() {
|
|
103546
|
-
var _browserWindow$
|
|
103547
|
-
var
|
|
106487
|
+
var _browserWindow$locati, _browserWindow$locati2;
|
|
106488
|
+
var _ref6, country, locale, pageLocale, shoppingContext, browserWindow, origin, hostname, environment, _extractCountryAndLan, countryCodeLower, countryCodeUpper, languageCodeLower, shouldUseEqHomeUrl, sdkBaseUrl, map, eqTemplate, homeTemplate, chosenTemplate, tokenResolved, resolvedPath, finalBase;
|
|
103548
106489
|
return HeaderMarketSelectorService_regenerator().w(function (_context) {
|
|
103549
|
-
while (1) switch (_context.
|
|
106490
|
+
while (1) switch (_context.n) {
|
|
103550
106491
|
case 0:
|
|
103551
|
-
|
|
106492
|
+
_ref6 = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {}, country = _ref6.country, locale = _ref6.locale, pageLocale = _ref6.pageLocale, shoppingContext = _ref6.shoppingContext;
|
|
103552
106493
|
browserWindow = globalThis.window;
|
|
103553
|
-
origin = (browserWindow === null || browserWindow === void 0 || (_browserWindow$
|
|
103554
|
-
hostname = (browserWindow === null || browserWindow === void 0 || (_browserWindow$
|
|
106494
|
+
origin = (browserWindow === null || browserWindow === void 0 || (_browserWindow$locati = browserWindow.location) === null || _browserWindow$locati === void 0 ? void 0 : _browserWindow$locati.origin) || "";
|
|
106495
|
+
hostname = (browserWindow === null || browserWindow === void 0 || (_browserWindow$locati2 = browserWindow.location) === null || _browserWindow$locati2 === void 0 ? void 0 : _browserWindow$locati2.hostname) || "";
|
|
103555
106496
|
environment = resolveEnvironmentFromHostname(hostname);
|
|
103556
106497
|
_extractCountryAndLan = extractCountryAndLanguageFromSelection({
|
|
103557
106498
|
country: country,
|
|
@@ -103560,15 +106501,7 @@ function createHeaderMarketSelectorService() {
|
|
|
103560
106501
|
}), countryCodeLower = _extractCountryAndLan.countryCodeLower, countryCodeUpper = _extractCountryAndLan.countryCodeUpper, languageCodeLower = _extractCountryAndLan.languageCodeLower; // Decide which template to use (eq_home_url vs home_url).
|
|
103561
106502
|
shouldUseEqHomeUrl = false;
|
|
103562
106503
|
sdkBaseUrl = "";
|
|
103563
|
-
_context.
|
|
103564
|
-
logConfigFetchRequest({
|
|
103565
|
-
configMapName: configMapName,
|
|
103566
|
-
countryCodeUpper: countryCodeUpper,
|
|
103567
|
-
environment: environment,
|
|
103568
|
-
clientId: clientId,
|
|
103569
|
-
shoppingContext: shoppingContext
|
|
103570
|
-
});
|
|
103571
|
-
_context.n = 2;
|
|
106504
|
+
_context.n = 1;
|
|
103572
106505
|
return fetchMarketConfig({
|
|
103573
106506
|
configMapName: configMapName,
|
|
103574
106507
|
countryCodeUpper: countryCodeUpper,
|
|
@@ -103576,39 +106509,11 @@ function createHeaderMarketSelectorService() {
|
|
|
103576
106509
|
clientId: clientId,
|
|
103577
106510
|
shoppingContext: shoppingContext
|
|
103578
106511
|
});
|
|
103579
|
-
case
|
|
106512
|
+
case 1:
|
|
103580
106513
|
map = _context.v;
|
|
103581
106514
|
// Use config map active field directly from SDK response.
|
|
103582
106515
|
shouldUseEqHomeUrl = Boolean(map === null || map === void 0 ? void 0 : map.active);
|
|
103583
106516
|
sdkBaseUrl = ensureTrailingSlash(map === null || map === void 0 ? void 0 : map["Webview_Base_URL"]);
|
|
103584
|
-
if (shouldLogConfigDebug(browserWindow)) {
|
|
103585
|
-
// Debug: confirm config map shape + decision field
|
|
103586
|
-
// eslint-disable-next-line no-console
|
|
103587
|
-
console.log("[HeaderMarketSelectorService] config map response", {
|
|
103588
|
-
configMapName: configMapName,
|
|
103589
|
-
country: countryCodeUpper || "US",
|
|
103590
|
-
environment: environment,
|
|
103591
|
-
activeRaw: map === null || map === void 0 ? void 0 : map.active,
|
|
103592
|
-
useEqHomeUrl: shouldUseEqHomeUrl,
|
|
103593
|
-
sdkBaseUrl: sdkBaseUrl,
|
|
103594
|
-
keys: map && HeaderMarketSelectorService_typeof(map) === "object" ? Object.keys(map) : [],
|
|
103595
|
-
sample: map
|
|
103596
|
-
});
|
|
103597
|
-
}
|
|
103598
|
-
_context.n = 4;
|
|
103599
|
-
break;
|
|
103600
|
-
case 3:
|
|
103601
|
-
_context.p = 3;
|
|
103602
|
-
_t = _context.v;
|
|
103603
|
-
// If config fetch fails, `shouldUseEqHomeUrl` stays false => prefer `home_url` when present.
|
|
103604
|
-
// eslint-disable-next-line no-console
|
|
103605
|
-
console.warn("[HeaderMarketSelectorService] getConfiguration failed", {
|
|
103606
|
-
configMapName: configMapName,
|
|
103607
|
-
country: countryCodeUpper || "US",
|
|
103608
|
-
environment: environment,
|
|
103609
|
-
error: (_error$message = _t === null || _t === void 0 ? void 0 : _t.message) !== null && _error$message !== void 0 ? _error$message : String(_t)
|
|
103610
|
-
});
|
|
103611
|
-
case 4:
|
|
103612
106517
|
eqTemplate = HeaderMarketSelectorService_firstNonEmptyString(country === null || country === void 0 ? void 0 : country.eq_home_url);
|
|
103613
106518
|
homeTemplate = HeaderMarketSelectorService_firstNonEmptyString(country === null || country === void 0 ? void 0 : country.home_url);
|
|
103614
106519
|
chosenTemplate = resolveTemplate({
|
|
@@ -103622,16 +106527,16 @@ function createHeaderMarketSelectorService() {
|
|
|
103622
106527
|
languageCodeLower: languageCodeLower
|
|
103623
106528
|
}); // If the template is already an absolute URL, do not prefix base/origin.
|
|
103624
106529
|
if (!HeaderMarketSelectorService_isAbsoluteUrl(tokenResolved)) {
|
|
103625
|
-
_context.n =
|
|
106530
|
+
_context.n = 2;
|
|
103626
106531
|
break;
|
|
103627
106532
|
}
|
|
103628
106533
|
return _context.a(2, tokenResolved);
|
|
103629
|
-
case
|
|
106534
|
+
case 2:
|
|
103630
106535
|
resolvedPath = HeaderMarketSelectorService_ensureLeadingSlash(tokenResolved); // Use base URL from SDK map when available; fallback to current origin.
|
|
103631
106536
|
finalBase = sdkBaseUrl || origin;
|
|
103632
106537
|
return _context.a(2, finalBase ? "".concat(finalBase.replace(/\/$/, "")).concat(resolvedPath) : resolvedPath);
|
|
103633
106538
|
}
|
|
103634
|
-
}, _callee
|
|
106539
|
+
}, _callee);
|
|
103635
106540
|
}))();
|
|
103636
106541
|
}
|
|
103637
106542
|
};
|
|
@@ -104713,10 +107618,6 @@ var DEFAULT_ACCOUNT = {
|
|
|
104713
107618
|
sign_in_label: "Sign In",
|
|
104714
107619
|
sign_up_label: "Sign Up"
|
|
104715
107620
|
};
|
|
104716
|
-
var DEFAULT_SEARCH = {
|
|
104717
|
-
placeholder: "Product Search",
|
|
104718
|
-
input_aria_label: "Product search"
|
|
104719
|
-
};
|
|
104720
107621
|
var DEFAULT_CART = {
|
|
104721
107622
|
show_cart_icon: false,
|
|
104722
107623
|
show_cart_count: false,
|
|
@@ -104774,11 +107675,12 @@ var DEFAULT_TOP_RIBBON_LINKS = [{
|
|
|
104774
107675
|
ariaLabel: "Shop Gifts"
|
|
104775
107676
|
}];
|
|
104776
107677
|
function HeaderView(_ref) {
|
|
104777
|
-
var _headerEntry$logo, _headerEntry$locale_s, _headerEntry$utility_, _headerEntry$utility_2, _headerEntry$account, _headerEntry$
|
|
107678
|
+
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;
|
|
104778
107679
|
var country = _ref.country,
|
|
104779
107680
|
language = _ref.language,
|
|
104780
107681
|
locale = _ref.locale,
|
|
104781
|
-
headerEntry = _ref.headerEntry
|
|
107682
|
+
headerEntry = _ref.headerEntry,
|
|
107683
|
+
searchConfig = _ref.searchConfig;
|
|
104782
107684
|
var _useState = (0,external_react_.useState)(false),
|
|
104783
107685
|
_useState2 = HeaderView_slicedToArray(_useState, 2),
|
|
104784
107686
|
isMobileMenuOpen = _useState2[0],
|
|
@@ -104790,12 +107692,10 @@ function HeaderView(_ref) {
|
|
|
104790
107692
|
return link === null || link === void 0 ? void 0 : link.loyalty_menu;
|
|
104791
107693
|
})) === 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;
|
|
104792
107694
|
var accountData = (_headerEntry$account = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.account) !== null && _headerEntry$account !== void 0 ? _headerEntry$account : DEFAULT_ACCOUNT;
|
|
104793
|
-
var searchData = (_headerEntry$search = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.search) !== null && _headerEntry$search !== void 0 ? _headerEntry$search : DEFAULT_SEARCH;
|
|
104794
107695
|
var cartData = (_headerEntry$cart = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.cart) !== null && _headerEntry$cart !== void 0 ? _headerEntry$cart : DEFAULT_CART;
|
|
104795
107696
|
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;
|
|
104796
107697
|
var navigationData = (_headerEntry$navigati = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.navigation) !== null && _headerEntry$navigati !== void 0 ? _headerEntry$navigati : DEFAULT_NAVIGATION;
|
|
104797
107698
|
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;
|
|
104798
|
-
console.log("HeaderView render", headerEntry); // Debug log to trace re-renders and data
|
|
104799
107699
|
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(HeaderRoot, {
|
|
104800
107700
|
"data-testid": "header-view",
|
|
104801
107701
|
"data-country": country,
|
|
@@ -104813,21 +107713,18 @@ function HeaderView(_ref) {
|
|
|
104813
107713
|
"aria-label": "Open menu",
|
|
104814
107714
|
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(IconMenu, {})
|
|
104815
107715
|
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(LogoSlot, {
|
|
104816
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(
|
|
104817
|
-
|
|
104818
|
-
logoAlt: logoData.logoAlt,
|
|
104819
|
-
href: logoData.href,
|
|
104820
|
-
showLogo: logoData.showLogo,
|
|
104821
|
-
size: logoData.size,
|
|
104822
|
-
$: logoData.$
|
|
107716
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderLogoRegion, {
|
|
107717
|
+
data: logoData
|
|
104823
107718
|
})
|
|
104824
107719
|
}), /*#__PURE__*/(0,jsx_runtime_.jsxs)(MobileUtilityBar, {
|
|
104825
107720
|
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderAccountRegion, {
|
|
104826
107721
|
data: accountData
|
|
104827
|
-
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(
|
|
104828
|
-
|
|
104829
|
-
|
|
104830
|
-
|
|
107722
|
+
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderSearchRegion, {
|
|
107723
|
+
country: country,
|
|
107724
|
+
language: language,
|
|
107725
|
+
locale: locale,
|
|
107726
|
+
searchConfig: searchConfig,
|
|
107727
|
+
showDesktopTrigger: false
|
|
104831
107728
|
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderCartRegion, {
|
|
104832
107729
|
data: cartData,
|
|
104833
107730
|
parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$ = headerEntry.$) === null || _headerEntry$$ === void 0 ? void 0 : _headerEntry$$.cart
|
|
@@ -104853,7 +107750,11 @@ function HeaderView(_ref) {
|
|
|
104853
107750
|
})]
|
|
104854
107751
|
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(SearchSlot, {
|
|
104855
107752
|
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderSearchRegion, {
|
|
104856
|
-
|
|
107753
|
+
country: country,
|
|
107754
|
+
language: language,
|
|
107755
|
+
locale: locale,
|
|
107756
|
+
searchConfig: searchConfig,
|
|
107757
|
+
showMobileTrigger: false
|
|
104857
107758
|
})
|
|
104858
107759
|
})]
|
|
104859
107760
|
})]
|
|
@@ -104878,7 +107779,8 @@ HeaderView.propTypes = {
|
|
|
104878
107779
|
country: external_prop_types_["default"].string.isRequired,
|
|
104879
107780
|
language: external_prop_types_["default"].string.isRequired,
|
|
104880
107781
|
locale: external_prop_types_["default"].string.isRequired,
|
|
104881
|
-
headerEntry: external_prop_types_["default"].object
|
|
107782
|
+
headerEntry: external_prop_types_["default"].object,
|
|
107783
|
+
searchConfig: external_prop_types_["default"].object
|
|
104882
107784
|
};
|
|
104883
107785
|
;// ./src/styles/Main.styled.js
|
|
104884
107786
|
|
|
@@ -104889,6 +107791,151 @@ var AppContainer = /*#__PURE__*/createStyled("div", true ? {
|
|
|
104889
107791
|
name: "1xncdb6",
|
|
104890
107792
|
styles: "font-family:\"Inter\",sans-serif"
|
|
104891
107793
|
} : 0);
|
|
107794
|
+
;// ./src/utils/mapProductSearchEntry.js
|
|
107795
|
+
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; } } }; }
|
|
107796
|
+
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; } }
|
|
107797
|
+
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; }
|
|
107798
|
+
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); }
|
|
107799
|
+
|
|
107800
|
+
|
|
107801
|
+
function asArray(value) {
|
|
107802
|
+
if (Array.isArray(value)) return value;
|
|
107803
|
+
return value == null ? [] : [value];
|
|
107804
|
+
}
|
|
107805
|
+
function firstResolvedEntry(productSearchModel) {
|
|
107806
|
+
return asArray(productSearchModel).find(function (entry) {
|
|
107807
|
+
return entry && mapProductSearchEntry_typeof(entry) === "object";
|
|
107808
|
+
});
|
|
107809
|
+
}
|
|
107810
|
+
function getGroup(entry) {
|
|
107811
|
+
for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
107812
|
+
keys[_key - 1] = arguments[_key];
|
|
107813
|
+
}
|
|
107814
|
+
return keys.map(function (key) {
|
|
107815
|
+
return entry === null || entry === void 0 ? void 0 : entry[key];
|
|
107816
|
+
}).find(function (value) {
|
|
107817
|
+
return value && mapProductSearchEntry_typeof(value) === "object";
|
|
107818
|
+
});
|
|
107819
|
+
}
|
|
107820
|
+
function getFirstValue(source, keys, fallback) {
|
|
107821
|
+
if (!source || mapProductSearchEntry_typeof(source) !== "object") {
|
|
107822
|
+
return fallback;
|
|
107823
|
+
}
|
|
107824
|
+
var _iterator = mapProductSearchEntry_createForOfIteratorHelper(keys),
|
|
107825
|
+
_step;
|
|
107826
|
+
try {
|
|
107827
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
107828
|
+
var key = _step.value;
|
|
107829
|
+
var value = source[key];
|
|
107830
|
+
if (value !== undefined && value !== null && value !== "") {
|
|
107831
|
+
return value;
|
|
107832
|
+
}
|
|
107833
|
+
}
|
|
107834
|
+
} catch (err) {
|
|
107835
|
+
_iterator.e(err);
|
|
107836
|
+
} finally {
|
|
107837
|
+
_iterator.f();
|
|
107838
|
+
}
|
|
107839
|
+
return fallback;
|
|
107840
|
+
}
|
|
107841
|
+
function getEditableProps(source, keys) {
|
|
107842
|
+
if (!source || mapProductSearchEntry_typeof(source) !== "object" || !source.$) {
|
|
107843
|
+
return undefined;
|
|
107844
|
+
}
|
|
107845
|
+
var _iterator2 = mapProductSearchEntry_createForOfIteratorHelper(keys),
|
|
107846
|
+
_step2;
|
|
107847
|
+
try {
|
|
107848
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
107849
|
+
var _source$$;
|
|
107850
|
+
var key = _step2.value;
|
|
107851
|
+
var tag = (_source$$ = source.$) === null || _source$$ === void 0 ? void 0 : _source$$[key];
|
|
107852
|
+
if (tag && mapProductSearchEntry_typeof(tag) === "object") {
|
|
107853
|
+
return tag;
|
|
107854
|
+
}
|
|
107855
|
+
if (typeof tag === "string" && tag.trim()) {
|
|
107856
|
+
return {
|
|
107857
|
+
"data-cslp": tag
|
|
107858
|
+
};
|
|
107859
|
+
}
|
|
107860
|
+
}
|
|
107861
|
+
} catch (err) {
|
|
107862
|
+
_iterator2.e(err);
|
|
107863
|
+
} finally {
|
|
107864
|
+
_iterator2.f();
|
|
107865
|
+
}
|
|
107866
|
+
return undefined;
|
|
107867
|
+
}
|
|
107868
|
+
function buildEditableTag(entry, path) {
|
|
107869
|
+
var _entry$uid, _entry$locale;
|
|
107870
|
+
var uid = String((_entry$uid = entry === null || entry === void 0 ? void 0 : entry.uid) !== null && _entry$uid !== void 0 ? _entry$uid : "").trim();
|
|
107871
|
+
var locale = String((_entry$locale = entry === null || entry === void 0 ? void 0 : entry.locale) !== null && _entry$locale !== void 0 ? _entry$locale : "").trim();
|
|
107872
|
+
if (!uid || !locale || !path) return undefined;
|
|
107873
|
+
return {
|
|
107874
|
+
"data-cslp": "product_search_model.".concat(uid, ".").concat(locale, ".").concat(path)
|
|
107875
|
+
};
|
|
107876
|
+
}
|
|
107877
|
+
function getBooleanValue(source, keys) {
|
|
107878
|
+
var fallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
107879
|
+
var value = getFirstValue(source, keys, fallback);
|
|
107880
|
+
return typeof value === "boolean" ? value : Boolean(value);
|
|
107881
|
+
}
|
|
107882
|
+
function mapProductSearchEntry(productSearchModel) {
|
|
107883
|
+
var entry = firstResolvedEntry(productSearchModel);
|
|
107884
|
+
if (!entry) {
|
|
107885
|
+
return null;
|
|
107886
|
+
}
|
|
107887
|
+
var searchBarGroup = getGroup(entry, "search_bar", "searchBar");
|
|
107888
|
+
var searchModalGroup = getGroup(entry, "search_modal", "searchModal");
|
|
107889
|
+
var logoGroup = getGroup(searchModalGroup, "logo", "modal_logo", "modalLogo");
|
|
107890
|
+
var brandData = parseLogoData(logoGroup);
|
|
107891
|
+
var cancelGroup = getGroup(searchModalGroup, "cancel", "cancel_button", "cancelButton");
|
|
107892
|
+
var searchAutoCompleteGroup = getGroup(searchModalGroup, "search_and_auto_complete", "search_and_autocomplete", "searchAndAutoComplete", "searchAndAutocomplete");
|
|
107893
|
+
var recentSearchesGroup = getGroup(searchModalGroup, "recent_searches", "recentSearches");
|
|
107894
|
+
var triggerPlaceholder = getFirstValue(searchBarGroup, ["search_bar_placeholder", "search_bar", "searchBarPlaceholder", "title"], TRIGGER_PLACEHOLDER);
|
|
107895
|
+
var searchPlaceholder = getFirstValue(searchAutoCompleteGroup, ["autocomplete_textbox_placeholder", "auto_complete_textbox", "autoCompleteTextbox", "search_placeholder", "searchPlaceholder"], SEARCH_PLACEHOLDER);
|
|
107896
|
+
return {
|
|
107897
|
+
triggerPlaceholder: triggerPlaceholder,
|
|
107898
|
+
searchPlaceholder: searchPlaceholder,
|
|
107899
|
+
modalTitle: getFirstValue(entry, ["title", "modal_title", "modalTitle"], MODAL_TITLE),
|
|
107900
|
+
brandLogo: brandData.logo,
|
|
107901
|
+
brandLogoAlt: brandData.logoAlt,
|
|
107902
|
+
brandHref: brandData.href,
|
|
107903
|
+
showBrandLogo: brandData.showLogo,
|
|
107904
|
+
brandSize: String(brandData.size || "medium").toLowerCase(),
|
|
107905
|
+
cancelLabel: getFirstValue(cancelGroup, ["nav_link_label", "label", "navLinkLabel"], "Cancel"),
|
|
107906
|
+
cancelShowIcon: getBooleanValue(cancelGroup, ["show_icon", "showIcon"], true),
|
|
107907
|
+
autoCompleteEnabled: getBooleanValue(searchAutoCompleteGroup, ["enable_auto_complete", "enable_autocomplete", "enableAutoComplete"], true),
|
|
107908
|
+
recentSearchesEnabled: getBooleanValue(recentSearchesGroup, ["enable_recent_searches", "enableRecentSearches"], true),
|
|
107909
|
+
recentSearchesHeading: getFirstValue(recentSearchesGroup, ["recent_searches", "recentSearches", "heading"], "Recent searches"),
|
|
107910
|
+
clearAllLabel: getFirstValue(recentSearchesGroup, ["clear_all", "clearAll"], "Clear all"),
|
|
107911
|
+
autoCompleteCopy: {
|
|
107912
|
+
placeholder: searchPlaceholder,
|
|
107913
|
+
inputAriaLabel: searchPlaceholder,
|
|
107914
|
+
listboxAriaLabel: "Search suggestions",
|
|
107915
|
+
noSuggestionsText: "No suggestions",
|
|
107916
|
+
seeMoreResultsText: "See More Results",
|
|
107917
|
+
didYouMeanText: "Did You Mean?",
|
|
107918
|
+
formAriaLabel: "Site search"
|
|
107919
|
+
},
|
|
107920
|
+
editableTags: {
|
|
107921
|
+
modalTitle: getEditableProps(entry, ["title", "modal_title", "modalTitle"]) || buildEditableTag(entry, "title"),
|
|
107922
|
+
triggerPlaceholder: getEditableProps(searchBarGroup, ["search_bar_placeholder", "search_bar", "searchBarPlaceholder", "title"]),
|
|
107923
|
+
triggerIcon: getEditableProps(searchBarGroup, ["search_icon", "icon", "searchIcon"]) || buildEditableTag(entry, "search_bar.search_icon"),
|
|
107924
|
+
searchPlaceholder: getEditableProps(searchAutoCompleteGroup, ["autocomplete_textbox_placeholder", "auto_complete_textbox", "autoCompleteTextbox", "search_placeholder", "searchPlaceholder"]) || buildEditableTag(entry, "search_modal.search_and_auto_complete.auto_complete_textbox"),
|
|
107925
|
+
autoCompleteTextbox: getEditableProps(searchAutoCompleteGroup, ["autocomplete_textbox_placeholder", "auto_complete_textbox", "autoCompleteTextbox"]) || buildEditableTag(entry, "search_modal.search_and_auto_complete.auto_complete_textbox"),
|
|
107926
|
+
autoCompleteSearchIcon: getEditableProps(searchAutoCompleteGroup, ["autocomplete_search_icon", "auto_complete_search_icon", "autoCompleteSearchIcon", "search_icon"]) || buildEditableTag(entry, "search_modal.search_and_auto_complete.autocomplete_search_icon"),
|
|
107927
|
+
logoAsset: getEditableProps(logoGroup, ["header_logo__0", "header_logo", "logo", "headerLogo"]),
|
|
107928
|
+
logoUrl: getEditableProps(logoGroup, ["logo_url", "logoUrl"]),
|
|
107929
|
+
showBrandLogo: getEditableProps(logoGroup, ["show_logo", "showLogo"]),
|
|
107930
|
+
brandSize: getEditableProps(logoGroup, ["logo_size", "logoSize"]),
|
|
107931
|
+
cancelLabel: getEditableProps(cancelGroup, ["nav_link_label", "label", "navLinkLabel"]) || buildEditableTag(entry, "search_modal.cancel.nav_link_label"),
|
|
107932
|
+
cancelShowIcon: getEditableProps(cancelGroup, ["show_icon", "showIcon"]) || buildEditableTag(entry, "search_modal.cancel.show_icon"),
|
|
107933
|
+
recentSearchesHeading: getEditableProps(recentSearchesGroup, ["recent_searches", "recentSearches", "heading"]),
|
|
107934
|
+
clearAllLabel: getEditableProps(recentSearchesGroup, ["clear_all", "clearAll"])
|
|
107935
|
+
}
|
|
107936
|
+
};
|
|
107937
|
+
}
|
|
107938
|
+
/* harmony default export */ const utils_mapProductSearchEntry = (mapProductSearchEntry);
|
|
104892
107939
|
;// ./src/components/header/HeaderContainer.jsx
|
|
104893
107940
|
|
|
104894
107941
|
|
|
@@ -104896,6 +107943,7 @@ var AppContainer = /*#__PURE__*/createStyled("div", true ? {
|
|
|
104896
107943
|
|
|
104897
107944
|
|
|
104898
107945
|
|
|
107946
|
+
|
|
104899
107947
|
function HeaderContainer(_ref) {
|
|
104900
107948
|
var market = _ref.market,
|
|
104901
107949
|
language = _ref.language,
|
|
@@ -104904,12 +107952,17 @@ function HeaderContainer(_ref) {
|
|
|
104904
107952
|
market: market,
|
|
104905
107953
|
language: language
|
|
104906
107954
|
});
|
|
107955
|
+
var searchConfig = (0,external_react_.useMemo)(function () {
|
|
107956
|
+
var _headerEntry$product_;
|
|
107957
|
+
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);
|
|
107958
|
+
}, [headerEntry]);
|
|
104907
107959
|
return /*#__PURE__*/(0,jsx_runtime_.jsx)(AppContainer, {
|
|
104908
107960
|
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderView, {
|
|
104909
107961
|
country: resolved.country,
|
|
104910
107962
|
language: resolved.language,
|
|
104911
107963
|
locale: resolved.locale,
|
|
104912
|
-
headerEntry: headerEntry
|
|
107964
|
+
headerEntry: headerEntry,
|
|
107965
|
+
searchConfig: searchConfig
|
|
104913
107966
|
})
|
|
104914
107967
|
});
|
|
104915
107968
|
}
|