@nuskin/nextgen-header 1.31.0 → 1.32.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 +213 -84
- package/package-dist/index.js.map +1 -1
- package/package-dist/index.mjs +213 -84
- package/package-dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/package-dist/index.mjs
CHANGED
|
@@ -100437,7 +100437,7 @@ var HEIGHT_MAP = {
|
|
|
100437
100437
|
var HEADER_CONTENT_ENTRY_UID = "global_header";
|
|
100438
100438
|
var HEADER_ENTRY_URL = "/vb-header/root-header";
|
|
100439
100439
|
var VB_EMPTY_BLOCK_PARENT_CLASS = "visual-builder__empty-block-parent";
|
|
100440
|
-
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", "utility_links.sign_up_sign_in_component", "product_search", "translations"]));
|
|
100440
|
+
var referenceFields = (/* unused pure expression or super */ null && (["top_ribbon", "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", "utility_links.sign_up_sign_in_component", "product_search", "translations"]));
|
|
100441
100441
|
var CONTENTSTACK_API_KEY = process.env.CONTENTSTACK_API_KEY;
|
|
100442
100442
|
var CONTENTSTACK_DELIVERY_TOKEN = process.env.CONTENTSTACK_DELIVERY_TOKEN;
|
|
100443
100443
|
var CONTENTSTACK_ENVIRONMENT = process.env.CONTENTSTACK_ENVIRONMENT;
|
|
@@ -107336,43 +107336,179 @@ HeaderNavigationRegion.propTypes = {
|
|
|
107336
107336
|
translations: external_prop_types_["default"].object
|
|
107337
107337
|
};
|
|
107338
107338
|
;// ./src/utils/common.js
|
|
107339
|
-
|
|
107340
|
-
|
|
107341
|
-
|
|
107342
|
-
|
|
107343
|
-
|
|
107344
|
-
|
|
107345
|
-
|
|
107346
|
-
|
|
107347
|
-
|
|
107348
|
-
|
|
107349
|
-
|
|
107350
|
-
|
|
107339
|
+
function common_slicedToArray(r, e) { return common_arrayWithHoles(r) || common_iterableToArrayLimit(r, e) || common_unsupportedIterableToArray(r, e) || common_nonIterableRest(); }
|
|
107340
|
+
function common_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."); }
|
|
107341
|
+
function common_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return common_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) ? common_arrayLikeToArray(r, a) : void 0; } }
|
|
107342
|
+
function common_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; }
|
|
107343
|
+
function common_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; } }
|
|
107344
|
+
function common_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
107345
|
+
var isServer = typeof window === "undefined";
|
|
107346
|
+
var hasLocalePrefix = function hasLocalePrefix(path) {
|
|
107347
|
+
return /^\/[a-z]{2}\/[a-z]{2}(\/|$)/i.test(path);
|
|
107348
|
+
};
|
|
107349
|
+
var isProtocolRelativeUrl = function isProtocolRelativeUrl(value) {
|
|
107350
|
+
return /^\/\/[^/]/.test(value);
|
|
107351
|
+
};
|
|
107352
|
+
var isAbsoluteHttpUrl = function isAbsoluteHttpUrl(value) {
|
|
107353
|
+
return /^https?:\/\//i.test(value);
|
|
107354
|
+
};
|
|
107355
|
+
var isPlainDomain = function isPlainDomain(value) {
|
|
107356
|
+
return /^(?:www\.)?[a-z0-9-]+\.[a-z]{2,}(\/.*)?$/i.test(value) && !value.startsWith("/");
|
|
107357
|
+
};
|
|
107358
|
+
function replaceLocalePlaceholders(value, country, language) {
|
|
107359
|
+
return value.replaceAll(/\{%\s*region\s*}/gi, country).replaceAll(/\{%\s*language\s*}/gi, language).replaceAll(/%7B%\s*region\s*%7D/gi, country).replaceAll(/%7B%\s*language\s*%7D/gi, language);
|
|
107360
|
+
}
|
|
107361
|
+
function buildNuSkinUrl(params) {
|
|
107362
|
+
var url = params.url,
|
|
107363
|
+
current = params.current,
|
|
107364
|
+
localizedBase = params.localizedBase,
|
|
107365
|
+
country = params.country,
|
|
107366
|
+
language = params.language;
|
|
107367
|
+
var normalizedOrigin = "".concat(current.protocol, "//").concat(current.host);
|
|
107368
|
+
var pathname = replaceLocalePlaceholders(url.pathname, country, language);
|
|
107369
|
+
if (hasLocalePrefix(pathname)) {
|
|
107370
|
+
return "".concat(normalizedOrigin).concat(pathname).concat(url.search).concat(url.hash);
|
|
107371
|
+
}
|
|
107372
|
+
return "".concat(localizedBase).concat(pathname).concat(url.search).concat(url.hash);
|
|
107373
|
+
}
|
|
107374
|
+
function needsLocaleRewrite(url) {
|
|
107375
|
+
var isMainWebsiteHost = url.host === "nuskin.com" || url.host === "www.nuskin.com";
|
|
107376
|
+
var hasPlaceholders = /\{%\s*(region|language)\s*\}/i.test(url.pathname);
|
|
107377
|
+
return isMainWebsiteHost || hasLocalePrefix(url.pathname) || hasPlaceholders;
|
|
107378
|
+
}
|
|
107379
|
+
function resolveNuSkinUrl(params) {
|
|
107380
|
+
var url = params.url,
|
|
107381
|
+
fallback = params.fallback,
|
|
107382
|
+
current = params.current,
|
|
107383
|
+
localizedBase = params.localizedBase,
|
|
107384
|
+
country = params.country,
|
|
107385
|
+
language = params.language;
|
|
107386
|
+
return needsLocaleRewrite(url) ? buildNuSkinUrl({
|
|
107387
|
+
url: url,
|
|
107388
|
+
current: current,
|
|
107389
|
+
localizedBase: localizedBase,
|
|
107390
|
+
country: country,
|
|
107391
|
+
language: language
|
|
107392
|
+
}) : fallback;
|
|
107393
|
+
}
|
|
107394
|
+
function resolveExternalOrAbsoluteUrl(params) {
|
|
107395
|
+
var trimmedUrl = params.trimmedUrl,
|
|
107396
|
+
current = params.current,
|
|
107397
|
+
localizedBase = params.localizedBase,
|
|
107398
|
+
country = params.country,
|
|
107399
|
+
language = params.language,
|
|
107400
|
+
isNuSkinDomain = params.isNuSkinDomain;
|
|
107401
|
+
if (isProtocolRelativeUrl(trimmedUrl)) {
|
|
107402
|
+
var url = new URL("https:".concat(trimmedUrl));
|
|
107403
|
+
var fallback = "https:".concat(trimmedUrl);
|
|
107404
|
+
return isNuSkinDomain(url.host) ? resolveNuSkinUrl({
|
|
107405
|
+
url: url,
|
|
107406
|
+
fallback: fallback,
|
|
107407
|
+
current: current,
|
|
107408
|
+
localizedBase: localizedBase,
|
|
107409
|
+
country: country,
|
|
107410
|
+
language: language
|
|
107411
|
+
}) : fallback;
|
|
107412
|
+
}
|
|
107413
|
+
if (isAbsoluteHttpUrl(trimmedUrl)) {
|
|
107414
|
+
var _url = new URL(trimmedUrl);
|
|
107415
|
+
return isNuSkinDomain(_url.host) ? resolveNuSkinUrl({
|
|
107416
|
+
url: _url,
|
|
107417
|
+
fallback: trimmedUrl,
|
|
107418
|
+
current: current,
|
|
107419
|
+
localizedBase: localizedBase,
|
|
107420
|
+
country: country,
|
|
107421
|
+
language: language
|
|
107422
|
+
}) : trimmedUrl;
|
|
107351
107423
|
}
|
|
107352
|
-
|
|
107424
|
+
if (isPlainDomain(trimmedUrl)) {
|
|
107425
|
+
return "https://".concat(trimmedUrl);
|
|
107426
|
+
}
|
|
107427
|
+
return undefined;
|
|
107428
|
+
}
|
|
107429
|
+
function buildLocalizedRelativeUrl(params) {
|
|
107430
|
+
var trimmedUrl = params.trimmedUrl,
|
|
107431
|
+
country = params.country,
|
|
107432
|
+
language = params.language,
|
|
107433
|
+
localizedBase = params.localizedBase;
|
|
107434
|
+
var hadTrailingSlash = trimmedUrl.endsWith("/");
|
|
107435
|
+
var relativeUrl = trimmedUrl.replace(/^\.[a-z]{2,}/i, "");
|
|
107436
|
+
relativeUrl = replaceLocalePlaceholders(relativeUrl, country, language);
|
|
107437
|
+
if (hasLocalePrefix(relativeUrl)) {
|
|
107438
|
+
relativeUrl = relativeUrl.replace(/^\/[a-z]{2}\/[a-z]{2}/i, "");
|
|
107439
|
+
}
|
|
107440
|
+
relativeUrl = relativeUrl.replace(/^\/+/, "/");
|
|
107441
|
+
if (!relativeUrl.startsWith("/")) {
|
|
107442
|
+
relativeUrl = "/".concat(relativeUrl);
|
|
107443
|
+
}
|
|
107444
|
+
if (relativeUrl === "/" || relativeUrl === "") {
|
|
107445
|
+
return hadTrailingSlash ? "".concat(localizedBase, "/") : localizedBase;
|
|
107446
|
+
}
|
|
107447
|
+
return "".concat(localizedBase).concat(relativeUrl);
|
|
107448
|
+
}
|
|
107449
|
+
var convertToLocalizedUrl = function convertToLocalizedUrl(inputUrl) {
|
|
107450
|
+
var _globalThis$window$lo, _globalThis$window;
|
|
107451
|
+
if (!inputUrl) return inputUrl;
|
|
107452
|
+
var trimmedUrl = inputUrl.trim();
|
|
107453
|
+
|
|
107454
|
+
// During SSR, window is undefined. renderAndExtractContext sets __ssrLocationHref__
|
|
107455
|
+
// (synchronously, no race condition) so we can still produce fully-qualified URLs.
|
|
107456
|
+
var locationHref = (_globalThis$window$lo = (_globalThis$window = globalThis.window) === null || _globalThis$window === void 0 || (_globalThis$window = _globalThis$window.location) === null || _globalThis$window === void 0 ? void 0 : _globalThis$window.href) !== null && _globalThis$window$lo !== void 0 ? _globalThis$window$lo : globalThis.__ssrLocationHref__;
|
|
107457
|
+
if (locationHref == null) {
|
|
107458
|
+
return trimmedUrl;
|
|
107459
|
+
}
|
|
107460
|
+
var current = new URL(locationHref);
|
|
107461
|
+
var _current$pathname$spl = current.pathname.split("/"),
|
|
107462
|
+
_current$pathname$spl2 = common_slicedToArray(_current$pathname$spl, 3),
|
|
107463
|
+
country = _current$pathname$spl2[1],
|
|
107464
|
+
language = _current$pathname$spl2[2];
|
|
107465
|
+
if (!country || !language) return trimmedUrl;
|
|
107466
|
+
var localizedBase = "".concat(current.protocol, "//").concat(current.host, "/").concat(country, "/").concat(language);
|
|
107467
|
+
var isNuSkinDomain = function isNuSkinDomain(host) {
|
|
107468
|
+
return host === current.host || host.endsWith(".nuskin.com") || host === "nuskin.com";
|
|
107469
|
+
};
|
|
107470
|
+
var resolvedUrl = resolveExternalOrAbsoluteUrl({
|
|
107471
|
+
trimmedUrl: trimmedUrl,
|
|
107472
|
+
current: current,
|
|
107473
|
+
localizedBase: localizedBase,
|
|
107474
|
+
country: country,
|
|
107475
|
+
language: language,
|
|
107476
|
+
isNuSkinDomain: isNuSkinDomain
|
|
107477
|
+
});
|
|
107478
|
+
if (resolvedUrl !== undefined) {
|
|
107479
|
+
return resolvedUrl;
|
|
107480
|
+
}
|
|
107481
|
+
return buildLocalizedRelativeUrl({
|
|
107482
|
+
trimmedUrl: trimmedUrl,
|
|
107483
|
+
country: country,
|
|
107484
|
+
language: language,
|
|
107485
|
+
localizedBase: localizedBase
|
|
107486
|
+
});
|
|
107353
107487
|
};
|
|
107354
|
-
var isServer = typeof window === "undefined";
|
|
107355
107488
|
;// ./src/components/top-ribbon/types.js
|
|
107356
107489
|
|
|
107357
107490
|
var NavigationLinkPropTypes = external_prop_types_["default"].shape({
|
|
107358
107491
|
label: external_prop_types_["default"].string.isRequired,
|
|
107359
107492
|
url: external_prop_types_["default"].string.isRequired,
|
|
107360
|
-
|
|
107361
|
-
dataTestId: external_prop_types_["default"].string,
|
|
107493
|
+
show: external_prop_types_["default"].bool,
|
|
107362
107494
|
gtmEvent: external_prop_types_["default"].object
|
|
107363
107495
|
});
|
|
107496
|
+
var TopRibbonEntryPropTypes = external_prop_types_["default"].shape({
|
|
107497
|
+
show_top_ribbon: external_prop_types_["default"].bool.isRequired,
|
|
107498
|
+
links: external_prop_types_["default"].arrayOf(NavigationLinkPropTypes)
|
|
107499
|
+
});
|
|
107364
107500
|
var TopRibbonPropTypes = {
|
|
107365
|
-
links: external_prop_types_["default"].arrayOf(
|
|
107501
|
+
links: external_prop_types_["default"].arrayOf(TopRibbonEntryPropTypes).isRequired,
|
|
107366
107502
|
className: external_prop_types_["default"].string,
|
|
107367
107503
|
ariaLabel: external_prop_types_["default"].string,
|
|
107368
107504
|
dataTestId: external_prop_types_["default"].string
|
|
107369
107505
|
};
|
|
107370
|
-
;// ./src/components/top-ribbon/TopRibbon.styled.
|
|
107506
|
+
;// ./src/components/top-ribbon/TopRibbon.styled.js
|
|
107371
107507
|
|
|
107372
107508
|
function TopRibbon_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)."; }
|
|
107373
107509
|
// Main container for the top ribbon navigation
|
|
107374
107510
|
var StyledTopRibbon = /*#__PURE__*/createStyled("header", true ? {
|
|
107375
|
-
target: "
|
|
107511
|
+
target: "ec2gm7w3"
|
|
107376
107512
|
} : 0)( true ? {
|
|
107377
107513
|
name: "ah54qx",
|
|
107378
107514
|
styles: "background-color:#000000;width:100%;position:relative;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;&::-webkit-scrollbar{display:none;}&:focus-within{outline:none;}"
|
|
@@ -107380,7 +107516,7 @@ var StyledTopRibbon = /*#__PURE__*/createStyled("header", true ? {
|
|
|
107380
107516
|
|
|
107381
107517
|
// Navigation list container
|
|
107382
107518
|
var StyledNavigationList = /*#__PURE__*/createStyled("ul", true ? {
|
|
107383
|
-
target: "
|
|
107519
|
+
target: "ec2gm7w2"
|
|
107384
107520
|
} : 0)( true ? {
|
|
107385
107521
|
name: "m78rlq",
|
|
107386
107522
|
styles: "margin:0 auto;padding:0;list-style:none;display:flex;align-items:center;justify-content:center;gap:24px;padding:10px 24px;min-width:100%;width:max-content;box-sizing:border-box"
|
|
@@ -107388,15 +107524,15 @@ var StyledNavigationList = /*#__PURE__*/createStyled("ul", true ? {
|
|
|
107388
107524
|
|
|
107389
107525
|
// Individual navigation item container
|
|
107390
107526
|
var StyledNavigationItem = /*#__PURE__*/createStyled("li", true ? {
|
|
107391
|
-
target: "
|
|
107392
|
-
} : 0)(
|
|
107393
|
-
|
|
107394
|
-
|
|
107395
|
-
} : 0);
|
|
107527
|
+
target: "ec2gm7w1"
|
|
107528
|
+
} : 0)("margin:0;padding:0;flex-shrink:0;position:relative;", function (_ref) {
|
|
107529
|
+
var $editing = _ref.$editing;
|
|
107530
|
+
return $editing && "\n padding-right: 24px;\n padding-left: 24px;\n ";
|
|
107531
|
+
}, ";" + ( true ? "" : 0));
|
|
107396
107532
|
|
|
107397
107533
|
// Navigation link with hover effects
|
|
107398
107534
|
var StyledNavigationLink = /*#__PURE__*/createStyled("a", true ? {
|
|
107399
|
-
target: "
|
|
107535
|
+
target: "ec2gm7w0"
|
|
107400
107536
|
} : 0)( true ? {
|
|
107401
107537
|
name: "1pvnuug",
|
|
107402
107538
|
styles: "display:inline-block;padding:0;cursor:pointer;color:#ffffff;font-family:\"Inter\",-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,sans-serif;font-size:14px;font-weight:400;line-height:20px;text-align:center;white-space:nowrap;text-decoration:underline;text-decoration-style:solid;text-decoration-color:transparent;transition:text-decoration-color 0.2s ease,background-color 0.2s ease;position:relative;&:hover{color:#ffffff;text-decoration-color:#ffffff;}&:focus-visible{outline:2px solid #ffffff;outline-offset:2px;background-color:rgba(255, 255, 255, 0.1);text-decoration-color:#ffffff;}&:focus:not(:focus-visible){outline:none;background-color:transparent;}&:active{background-color:rgba(255, 255, 255, 0.05);}@media (prefers-contrast: high){&:focus-visible{outline-color:currentColor;}}"
|
|
@@ -107413,6 +107549,7 @@ function TopRibbon_toPrimitive(t, r) { if ("object" != TopRibbon_typeof(t) || !t
|
|
|
107413
107549
|
|
|
107414
107550
|
|
|
107415
107551
|
|
|
107552
|
+
|
|
107416
107553
|
/**
|
|
107417
107554
|
* TopRibbon Navigation Component
|
|
107418
107555
|
*
|
|
@@ -107430,17 +107567,27 @@ function TopRibbon_toPrimitive(t, r) { if ("object" != TopRibbon_typeof(t) || !t
|
|
|
107430
107567
|
*/
|
|
107431
107568
|
|
|
107432
107569
|
var TopRibbon = function TopRibbon(_ref) {
|
|
107570
|
+
var _ribbonData$$;
|
|
107433
107571
|
var links = _ref.links,
|
|
107434
107572
|
_ref$className = _ref.className,
|
|
107435
|
-
className = _ref$className === void 0 ?
|
|
107573
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
107436
107574
|
_ref$ariaLabel = _ref.ariaLabel,
|
|
107437
|
-
ariaLabel = _ref$ariaLabel === void 0 ?
|
|
107575
|
+
ariaLabel = _ref$ariaLabel === void 0 ? "Top navigation" : _ref$ariaLabel,
|
|
107438
107576
|
_ref$dataTestId = _ref.dataTestId,
|
|
107439
|
-
dataTestId = _ref$dataTestId === void 0 ?
|
|
107577
|
+
dataTestId = _ref$dataTestId === void 0 ? "top-ribbon-nav" : _ref$dataTestId;
|
|
107440
107578
|
// Validate required props — safe to call in SSR
|
|
107441
107579
|
if (!links || !Array.isArray(links) || links.length === 0) {
|
|
107442
107580
|
return null;
|
|
107443
107581
|
}
|
|
107582
|
+
var ribbonData = links[0];
|
|
107583
|
+
if (!(ribbonData !== null && ribbonData !== void 0 && ribbonData.show_top_ribbon)) {
|
|
107584
|
+
return null;
|
|
107585
|
+
}
|
|
107586
|
+
var navLinks = ribbonData.links;
|
|
107587
|
+
if (!navLinks || !Array.isArray(navLinks) || navLinks.length === 0) {
|
|
107588
|
+
return null;
|
|
107589
|
+
}
|
|
107590
|
+
var editing = isEditingMode();
|
|
107444
107591
|
|
|
107445
107592
|
/**
|
|
107446
107593
|
* Fires a GTM dataLayer event when a link is clicked.
|
|
@@ -107450,9 +107597,9 @@ var TopRibbon = function TopRibbon(_ref) {
|
|
|
107450
107597
|
* @param {Object} item - The navigation item that was clicked
|
|
107451
107598
|
*/
|
|
107452
107599
|
var handleClick = function handleClick(item) {
|
|
107453
|
-
if (typeof window ===
|
|
107600
|
+
if (typeof window === "undefined" || !Array.isArray(window.dataLayer)) return;
|
|
107454
107601
|
window.dataLayer.push(TopRibbon_objectSpread({
|
|
107455
|
-
event:
|
|
107602
|
+
event: "top_ribbon_click",
|
|
107456
107603
|
link_text: item.label,
|
|
107457
107604
|
link_url: item.url
|
|
107458
107605
|
}, item.gtmEvent));
|
|
@@ -107464,20 +107611,26 @@ var TopRibbon = function TopRibbon(_ref) {
|
|
|
107464
107611
|
"aria-label": ariaLabel,
|
|
107465
107612
|
role: "navigation",
|
|
107466
107613
|
"data-testid": "".concat(dataTestId, "-nav"),
|
|
107467
|
-
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(StyledNavigationList, {
|
|
107468
|
-
"data-testid": "".concat(dataTestId, "-list")
|
|
107469
|
-
|
|
107470
|
-
|
|
107614
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(StyledNavigationList, TopRibbon_objectSpread(TopRibbon_objectSpread({
|
|
107615
|
+
"data-testid": "".concat(dataTestId, "-list")
|
|
107616
|
+
}, editing ? TopRibbon_objectSpread(TopRibbon_objectSpread({}, (_ribbonData$$ = ribbonData.$) === null || _ribbonData$$ === void 0 ? void 0 : _ribbonData$$.links), {}, {
|
|
107617
|
+
"data-add-direction": "horizontal"
|
|
107618
|
+
}) : null), {}, {
|
|
107619
|
+
children: navLinks.map(function (item, index) {
|
|
107620
|
+
var _ribbonData$top_ribbo, _ribbonData$$2, _item$$;
|
|
107621
|
+
if (!item || TopRibbon_typeof(item) !== "object") return null;
|
|
107471
107622
|
var label = item.label,
|
|
107472
107623
|
url = item.url,
|
|
107473
|
-
|
|
107474
|
-
|
|
107624
|
+
show = item.show;
|
|
107625
|
+
if (show === false) return null;
|
|
107475
107626
|
if (!label || !url) return null;
|
|
107476
|
-
var linkHref =
|
|
107477
|
-
var linkAriaLabel =
|
|
107478
|
-
var linkTestId =
|
|
107479
|
-
return /*#__PURE__*/(0,jsx_runtime_.jsx)(StyledNavigationItem, {
|
|
107627
|
+
var linkHref = convertToLocalizedUrl(url);
|
|
107628
|
+
var linkAriaLabel = "".concat((_ribbonData$top_ribbo = ribbonData.top_ribbon_item_aria_label) !== null && _ribbonData$top_ribbo !== void 0 ? _ribbonData$top_ribbo : "Navigate to", " ").concat(label);
|
|
107629
|
+
var linkTestId = "".concat(dataTestId, "-item-").concat(index);
|
|
107630
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsx)(StyledNavigationItem, TopRibbon_objectSpread(TopRibbon_objectSpread({
|
|
107480
107631
|
"data-testid": "".concat(linkTestId, "-container"),
|
|
107632
|
+
$editing: editing
|
|
107633
|
+
}, editing ? (_ribbonData$$2 = ribbonData.$) === null || _ribbonData$$2 === void 0 ? void 0 : _ribbonData$$2["links__".concat(index)] : null), {}, {
|
|
107481
107634
|
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(StyledNavigationLink, {
|
|
107482
107635
|
href: linkHref,
|
|
107483
107636
|
target: "_blank",
|
|
@@ -107487,11 +107640,13 @@ var TopRibbon = function TopRibbon(_ref) {
|
|
|
107487
107640
|
},
|
|
107488
107641
|
"aria-label": linkAriaLabel,
|
|
107489
107642
|
"data-testid": linkTestId,
|
|
107490
|
-
children: label
|
|
107643
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)("span", TopRibbon_objectSpread(TopRibbon_objectSpread({}, editing ? (_item$$ = item.$) === null || _item$$ === void 0 ? void 0 : _item$$.label : null), {}, {
|
|
107644
|
+
children: label
|
|
107645
|
+
}))
|
|
107491
107646
|
})
|
|
107492
|
-
}, "nav-item-".concat(index, "-").concat(label));
|
|
107647
|
+
}), "nav-item-".concat(index, "-").concat(label));
|
|
107493
107648
|
})
|
|
107494
|
-
})
|
|
107649
|
+
}))
|
|
107495
107650
|
})
|
|
107496
107651
|
});
|
|
107497
107652
|
};
|
|
@@ -110027,35 +110182,6 @@ var DEFAULT_CART = {
|
|
|
110027
110182
|
aria_label: "Shopping cart",
|
|
110028
110183
|
count: 0
|
|
110029
110184
|
};
|
|
110030
|
-
var DEFAULT_TOP_RIBBON_LINKS = [{
|
|
110031
|
-
label: "Hair",
|
|
110032
|
-
url: "/hair",
|
|
110033
|
-
ariaLabel: "Shop Hair"
|
|
110034
|
-
}, {
|
|
110035
|
-
label: "Skin",
|
|
110036
|
-
url: "/skin",
|
|
110037
|
-
ariaLabel: "Shop Skin"
|
|
110038
|
-
}, {
|
|
110039
|
-
label: "Body",
|
|
110040
|
-
url: "/body",
|
|
110041
|
-
ariaLabel: "Shop Body"
|
|
110042
|
-
}, {
|
|
110043
|
-
label: "Fragrance",
|
|
110044
|
-
url: "/fragrance",
|
|
110045
|
-
ariaLabel: "Shop Fragrance"
|
|
110046
|
-
}, {
|
|
110047
|
-
label: "Beauty Bio",
|
|
110048
|
-
url: "/beauty-bio",
|
|
110049
|
-
ariaLabel: "Shop Beauty Bio"
|
|
110050
|
-
}, {
|
|
110051
|
-
label: "Accessories",
|
|
110052
|
-
url: "/accessories",
|
|
110053
|
-
ariaLabel: "Shop Accessories"
|
|
110054
|
-
}, {
|
|
110055
|
-
label: "Gifts",
|
|
110056
|
-
url: "/gifts",
|
|
110057
|
-
ariaLabel: "Shop Gifts"
|
|
110058
|
-
}];
|
|
110059
110185
|
function firstDefined() {
|
|
110060
110186
|
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
110061
110187
|
values[_key] = arguments[_key];
|
|
@@ -110133,7 +110259,7 @@ function buildAccountParentTags(_ref2) {
|
|
|
110133
110259
|
};
|
|
110134
110260
|
}
|
|
110135
110261
|
function HeaderView(_ref3) {
|
|
110136
|
-
var _headerEntry$logo, _headerEntry$locale_s, _utilityLinksEntry$lo, _utilityLinksEntry$lo2, _headerEntry$cart, _storefrontParams$car, _headerEntry$top_ribb, _headerEntry$market_s, _headerEntry$translat, _headerEntry$translat2, _headerEntry
|
|
110262
|
+
var _headerEntry$logo, _headerEntry$locale_s, _utilityLinksEntry$lo, _utilityLinksEntry$lo2, _headerEntry$cart, _storefrontParams$car, _headerEntry$$, _headerEntry$top_ribb, _headerEntry$market_s, _headerEntry$translat, _headerEntry$translat2, _topRibbon$top_ribbon, _headerEntry$$2, _ref4, _headerEntry$locale, _headerEntry$$3, _headerEntry$$4;
|
|
110137
110263
|
var country = _ref3.country,
|
|
110138
110264
|
language = _ref3.language,
|
|
110139
110265
|
locale = _ref3.locale,
|
|
@@ -110166,7 +110292,8 @@ function HeaderView(_ref3) {
|
|
|
110166
110292
|
var cartData = HeaderView_objectSpread(HeaderView_objectSpread({}, (_headerEntry$cart = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.cart) !== null && _headerEntry$cart !== void 0 ? _headerEntry$cart : DEFAULT_CART), {}, {
|
|
110167
110293
|
item_count: (_storefrontParams$car = storefrontParams === null || storefrontParams === void 0 ? void 0 : storefrontParams.cartCount) !== null && _storefrontParams$car !== void 0 ? _storefrontParams$car : 0
|
|
110168
110294
|
});
|
|
110169
|
-
var
|
|
110295
|
+
var $ = (_headerEntry$$ = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.$) !== null && _headerEntry$$ !== void 0 ? _headerEntry$$ : {};
|
|
110296
|
+
var topRibbon = (_headerEntry$top_ribb = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.top_ribbon) !== null && _headerEntry$top_ribb !== void 0 ? _headerEntry$top_ribb : null;
|
|
110170
110297
|
var navigationData = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.top_navigation;
|
|
110171
110298
|
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;
|
|
110172
110299
|
var translations = (_headerEntry$translat = headerEntry === null || headerEntry === void 0 || (_headerEntry$translat2 = headerEntry.translations) === null || _headerEntry$translat2 === void 0 ? void 0 : _headerEntry$translat2[0]) !== null && _headerEntry$translat !== void 0 ? _headerEntry$translat : null;
|
|
@@ -110175,11 +110302,13 @@ function HeaderView(_ref3) {
|
|
|
110175
110302
|
"data-country": country,
|
|
110176
110303
|
"data-language": language,
|
|
110177
110304
|
"data-locale": locale,
|
|
110178
|
-
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(
|
|
110179
|
-
|
|
110180
|
-
|
|
110181
|
-
|
|
110182
|
-
|
|
110305
|
+
children: [(topRibbon === null || topRibbon === void 0 ? void 0 : topRibbon.show_top_ribbon) && /*#__PURE__*/(0,jsx_runtime_.jsx)("div", HeaderView_objectSpread(HeaderView_objectSpread(HeaderView_objectSpread({}, ($ === null || $ === void 0 ? void 0 : $.top_ribbon) || {}), ($ === null || $ === void 0 ? void 0 : $.top_ribbon__parent) || {}), {}, {
|
|
110306
|
+
children: /*#__PURE__*/(0,jsx_runtime_.jsx)(top_ribbon_TopRibbon, {
|
|
110307
|
+
links: [topRibbon],
|
|
110308
|
+
ariaLabel: (_topRibbon$top_ribbon = topRibbon.top_ribbon_aria_label) !== null && _topRibbon$top_ribbon !== void 0 ? _topRibbon$top_ribbon : "Top Ribbon",
|
|
110309
|
+
dataTestId: "header-top-ribbon"
|
|
110310
|
+
})
|
|
110311
|
+
})), /*#__PURE__*/(0,jsx_runtime_.jsxs)(TopHeaderRow, {
|
|
110183
110312
|
children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(MobileMenuButton, {
|
|
110184
110313
|
onClick: function onClick() {
|
|
110185
110314
|
return setIsMobileMenuOpen(true);
|
|
@@ -110208,7 +110337,7 @@ function HeaderView(_ref3) {
|
|
|
110208
110337
|
showDesktopTrigger: false
|
|
110209
110338
|
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderCartRegion, {
|
|
110210
110339
|
data: cartData,
|
|
110211
|
-
parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$ = headerEntry.$) === null || _headerEntry$$ === void 0 ? void 0 : _headerEntry
|
|
110340
|
+
parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$2 = headerEntry.$) === null || _headerEntry$$2 === void 0 ? void 0 : _headerEntry$$2.cart
|
|
110212
110341
|
})]
|
|
110213
110342
|
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(RightHeaderCluster, {
|
|
110214
110343
|
children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(UtilityBar, {
|
|
@@ -110217,7 +110346,7 @@ function HeaderView(_ref3) {
|
|
|
110217
110346
|
data: marketSelector,
|
|
110218
110347
|
logo: logoData,
|
|
110219
110348
|
locale: String((_ref4 = (_headerEntry$locale = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.locale) !== null && _headerEntry$locale !== void 0 ? _headerEntry$locale : locale) !== null && _ref4 !== void 0 ? _ref4 : "").trim(),
|
|
110220
|
-
parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$
|
|
110349
|
+
parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$3 = headerEntry.$) === null || _headerEntry$$3 === void 0 ? void 0 : _headerEntry$$3.market_selector__0,
|
|
110221
110350
|
mobileTriggerMode: "drawerPortal",
|
|
110222
110351
|
drawerOpen: isMobileMenuOpen,
|
|
110223
110352
|
drawerTriggerMountRef: mobileMarketTriggerMountRef
|
|
@@ -110228,7 +110357,7 @@ function HeaderView(_ref3) {
|
|
|
110228
110357
|
parent$: accountParentTags
|
|
110229
110358
|
}), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderCartRegion, {
|
|
110230
110359
|
data: cartData,
|
|
110231
|
-
parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$
|
|
110360
|
+
parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$4 = headerEntry.$) === null || _headerEntry$$4 === void 0 ? void 0 : _headerEntry$$4.cart
|
|
110232
110361
|
})]
|
|
110233
110362
|
})
|
|
110234
110363
|
})]
|