@nuskin/nextgen-header 1.23.0 → 1.24.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.
@@ -101132,6 +101132,7 @@ Brand.defaultProps = {
101132
101132
  $: null
101133
101133
  };
101134
101134
  ;// ./src/components/brand/brand.helpers.js
101135
+ function brand_helpers_typeof(o) { "@babel/helpers - typeof"; return brand_helpers_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; }, brand_helpers_typeof(o); }
101135
101136
  function parseLogoData(logoData) {
101136
101137
  if (!logoData) {
101137
101138
  return {
@@ -101153,8 +101154,14 @@ function parseLogoData(logoData) {
101153
101154
  var logoUrl;
101154
101155
  if (header_logo) {
101155
101156
  try {
101156
- var parsed = JSON.parse(header_logo);
101157
- var imageArray = parsed === null || parsed === void 0 ? void 0 : parsed.image;
101157
+ var _parsed;
101158
+ var parsed;
101159
+ if (typeof header_logo === "string") {
101160
+ parsed = JSON.parse(header_logo);
101161
+ } else if (brand_helpers_typeof(header_logo) === "object") {
101162
+ parsed = header_logo;
101163
+ }
101164
+ var imageArray = (_parsed = parsed) === null || _parsed === void 0 ? void 0 : _parsed.image;
101158
101165
  if (Array.isArray(imageArray) && imageArray.length > 0) {
101159
101166
  var _firstImage$selected, _firstImage$files, _firstImage$files2;
101160
101167
  var firstImage = imageArray[0];
@@ -101202,6 +101209,8 @@ HeaderLoyaltyRegion.propTypes = {
101202
101209
  }).isRequired
101203
101210
  };
101204
101211
  ;// ./src/components/header/HeaderIcons.jsx
101212
+ /* unused harmony import specifier */ var _jsxs;
101213
+ /* unused harmony import specifier */ var _jsx;
101205
101214
  function HeaderIcons_typeof(o) { "@babel/helpers - typeof"; return HeaderIcons_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, HeaderIcons_typeof(o); }
101206
101215
  function HeaderIcons_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
101207
101216
  function HeaderIcons_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? HeaderIcons_ownKeys(Object(t), !0).forEach(function (r) { HeaderIcons_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : HeaderIcons_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -101283,7 +101292,7 @@ function IconUser(props) {
101283
101292
  }));
101284
101293
  }
101285
101294
  function IconCart(props) {
101286
- return /*#__PURE__*/(0,jsx_runtime_.jsxs)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
101295
+ return /*#__PURE__*/_jsxs("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
101287
101296
  width: "20",
101288
101297
  height: "20",
101289
101298
  viewBox: "0 0 24 24",
@@ -101291,18 +101300,18 @@ function IconCart(props) {
101291
101300
  xmlns: "http://www.w3.org/2000/svg",
101292
101301
  "aria-hidden": true
101293
101302
  }, props), {}, {
101294
- children: [/*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
101303
+ children: [/*#__PURE__*/_jsx("path", {
101295
101304
  d: "M6 7h15l-2 10H8L6 7zm0 0L5 3H2",
101296
101305
  stroke: "currentColor",
101297
101306
  strokeWidth: "2",
101298
101307
  strokeLinecap: "round",
101299
101308
  strokeLinejoin: "round"
101300
- }), /*#__PURE__*/(0,jsx_runtime_.jsx)("circle", {
101309
+ }), /*#__PURE__*/_jsx("circle", {
101301
101310
  cx: "10",
101302
101311
  cy: "20",
101303
101312
  r: "1",
101304
101313
  fill: "currentColor"
101305
- }), /*#__PURE__*/(0,jsx_runtime_.jsx)("circle", {
101314
+ }), /*#__PURE__*/_jsx("circle", {
101306
101315
  cx: "18",
101307
101316
  cy: "20",
101308
101317
  r: "1",
@@ -101361,30 +101370,104 @@ HeaderAccountRegion.propTypes = {
101361
101370
  sign_up_label: (external_prop_types_default()).string.isRequired
101362
101371
  }).isRequired
101363
101372
  };
101364
- ;// ./src/components/header/regions/HeaderCartRegion.jsx
101373
+ ;// ./src/components/cart/Cart.styled.jsx
101365
101374
 
101375
+ var CartIconWrapper = /*#__PURE__*/createStyled("div", true ? {
101376
+ target: "ein8udj0"
101377
+ } : 0)("display:flex;align-items:center;position:relative;", function (_ref) {
101378
+ var isEditing = _ref.isEditing;
101379
+ return isEditing && "\n & > * {\n pointer-events: none;\n }\n ";
101380
+ }, " & .MuiBadge-badge{background-color:#5b81a5;color:#fff;min-width:10px;height:17px;font-size:10px;font-weight:400;line-height:1;border-radius:10rem;", function (_ref2) {
101381
+ var showCartCount = _ref2.showCartCount;
101382
+ return !showCartCount && "\n display: none;\n ";
101383
+ }, ";}" + ( true ? "" : 0));
101384
+ ;// ./src/components/cart/Cart.constants.js
101385
+ var DEFAULT_ITEM_COUNT = 0;
101386
+ var DEFAULT_ARIA_LABEL = "Shopping cart";
101387
+ var DEFAULT_SHOW_CART_ICON = false;
101388
+ var DEFAULT_SHOW_CART_COUNT = false;
101389
+ ;// ./src/components/cart/Cart.jsx
101390
+ function Cart_typeof(o) { "@babel/helpers - typeof"; return Cart_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; }, Cart_typeof(o); }
101391
+ function Cart_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; }
101392
+ function Cart_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Cart_ownKeys(Object(t), !0).forEach(function (r) { Cart_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Cart_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
101393
+ function Cart_defineProperty(e, r, t) { return (r = Cart_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
101394
+ function Cart_toPropertyKey(t) { var i = Cart_toPrimitive(t, "string"); return "symbol" == Cart_typeof(i) ? i : i + ""; }
101395
+ function Cart_toPrimitive(t, r) { if ("object" != Cart_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != Cart_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
101366
101396
 
101367
101397
 
101368
101398
 
101369
101399
 
101370
- function HeaderCartRegion(_ref) {
101371
- var _data$aria_label, _data$count;
101372
- var data = _ref.data;
101373
- return /*#__PURE__*/(0,jsx_runtime_.jsx)(UtilityButton, {
101374
- type: "button",
101375
- "aria-label": (_data$aria_label = data.aria_label) !== null && _data$aria_label !== void 0 ? _data$aria_label : "Shopping cart",
101376
- children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(CartButtonInner, {
101377
- children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(IconCart, {}), /*#__PURE__*/(0,jsx_runtime_.jsx)(CartBadge, {
101378
- children: (_data$count = data.count) !== null && _data$count !== void 0 ? _data$count : 0
101379
- })]
101400
+
101401
+
101402
+
101403
+ function Cart(_ref) {
101404
+ var itemCount = _ref.itemCount,
101405
+ ariaLabel = _ref.ariaLabel,
101406
+ showCartIcon = _ref.showCartIcon,
101407
+ showCartCount = _ref.showCartCount,
101408
+ $ = _ref.$;
101409
+ var editing = isEditingMode();
101410
+ if (!showCartIcon) {
101411
+ return null;
101412
+ }
101413
+ return /*#__PURE__*/(0,jsx_runtime_.jsx)(CartIconWrapper, Cart_objectSpread(Cart_objectSpread({
101414
+ "data-testid": "cart",
101415
+ "aria-label": ariaLabel,
101416
+ showCartCount: showCartCount,
101417
+ isEditing: editing
101418
+ }, $ || {}), {}, {
101419
+ children: /*#__PURE__*/(0,jsx_runtime_.jsx)(dist.NsCartIcon, {
101420
+ itemCount: showCartCount ? itemCount : 0,
101421
+ size: "large",
101422
+ color: "slate"
101380
101423
  })
101424
+ }));
101425
+ }
101426
+ Cart.propTypes = {
101427
+ itemCount: (external_prop_types_default()).number,
101428
+ ariaLabel: (external_prop_types_default()).string,
101429
+ showCartIcon: (external_prop_types_default()).bool,
101430
+ showCartCount: (external_prop_types_default()).bool,
101431
+ $: (external_prop_types_default()).object
101432
+ };
101433
+ Cart.defaultProps = {
101434
+ itemCount: DEFAULT_ITEM_COUNT,
101435
+ ariaLabel: DEFAULT_ARIA_LABEL,
101436
+ showCartIcon: DEFAULT_SHOW_CART_ICON,
101437
+ showCartCount: DEFAULT_SHOW_CART_COUNT,
101438
+ $: null
101439
+ };
101440
+ ;// ./src/components/header/regions/HeaderCartRegion.jsx
101441
+
101442
+
101443
+
101444
+
101445
+ function HeaderCartRegion(_ref) {
101446
+ var _data$show_cart_icon, _data$show_cart_count, _data$item_count;
101447
+ var data = _ref.data,
101448
+ parent$ = _ref.parent$;
101449
+ var showCartIcon = (_data$show_cart_icon = data === null || data === void 0 ? void 0 : data.show_cart_icon) !== null && _data$show_cart_icon !== void 0 ? _data$show_cart_icon : false;
101450
+ var showCartCount = (_data$show_cart_count = data === null || data === void 0 ? void 0 : data.show_cart_count) !== null && _data$show_cart_count !== void 0 ? _data$show_cart_count : false;
101451
+ var itemCount = (_data$item_count = data === null || data === void 0 ? void 0 : data.item_count) !== null && _data$item_count !== void 0 ? _data$item_count : 0;
101452
+ return /*#__PURE__*/(0,jsx_runtime_.jsx)(Cart, {
101453
+ itemCount: itemCount,
101454
+ "aria-label": "Shopping cart",
101455
+ showCartIcon: showCartIcon,
101456
+ showCartCount: showCartCount,
101457
+ $: parent$
101381
101458
  });
101382
101459
  }
101383
101460
  HeaderCartRegion.propTypes = {
101384
101461
  data: external_prop_types_default().shape({
101385
- aria_label: (external_prop_types_default()).string,
101386
- count: (external_prop_types_default()).number
101387
- }).isRequired
101462
+ show_cart_icon: (external_prop_types_default()).bool,
101463
+ show_cart_count: (external_prop_types_default()).bool,
101464
+ item_count: (external_prop_types_default()).number
101465
+ }),
101466
+ parent$: (external_prop_types_default()).object
101467
+ };
101468
+ HeaderCartRegion.defaultProps = {
101469
+ data: null,
101470
+ parent$: null
101388
101471
  };
101389
101472
  ;// ./src/components/header/regions/HeaderSearchRegion.jsx
101390
101473
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || HeaderSearchRegion_unsupportedIterableToArray(r, e) || _nonIterableRest(); }
@@ -105044,14 +105127,15 @@ var DEFAULT_ACCOUNT = {
105044
105127
  sign_in_label: "Sign In",
105045
105128
  sign_up_label: "Sign Up"
105046
105129
  };
105047
- var DEFAULT_CART = {
105048
- aria_label: "Shopping cart",
105049
- count: 0
105050
- };
105051
105130
  var DEFAULT_SEARCH = {
105052
105131
  placeholder: "Product Search",
105053
105132
  input_aria_label: "Product search"
105054
105133
  };
105134
+ var DEFAULT_CART = {
105135
+ show_cart_icon: false,
105136
+ show_cart_count: false,
105137
+ item_count: 0
105138
+ };
105055
105139
  var DEFAULT_NAVIGATION = {
105056
105140
  topNavItems: [{
105057
105141
  id: "devices",
@@ -105104,7 +105188,7 @@ var DEFAULT_TOP_RIBBON_LINKS = [{
105104
105188
  ariaLabel: "Shop Gifts"
105105
105189
  }];
105106
105190
  function HeaderView(_ref) {
105107
- var _headerEntry$logo, _headerEntry$locale_s, _headerEntry$utility_, _headerEntry$utility_2, _headerEntry$account, _headerEntry$cart, _headerEntry$search, _headerEntry$top_ribb, _headerEntry$navigati, _headerEntry$market_s, _ref2, _headerEntry$locale, _headerEntry$$;
105191
+ var _headerEntry$logo, _headerEntry$locale_s, _headerEntry$utility_, _headerEntry$utility_2, _headerEntry$account, _headerEntry$search, _headerEntry$cart, _headerEntry$top_ribb, _headerEntry$navigati, _headerEntry$market_s, _headerEntry$$, _ref2, _headerEntry$locale, _headerEntry$$2, _headerEntry$$3;
105108
105192
  var country = _ref.country,
105109
105193
  language = _ref.language,
105110
105194
  locale = _ref.locale,
@@ -105120,11 +105204,12 @@ function HeaderView(_ref) {
105120
105204
  return link === null || link === void 0 ? void 0 : link.loyalty_menu;
105121
105205
  })) === 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;
105122
105206
  var accountData = (_headerEntry$account = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.account) !== null && _headerEntry$account !== void 0 ? _headerEntry$account : DEFAULT_ACCOUNT;
105123
- var cartData = (_headerEntry$cart = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.cart) !== null && _headerEntry$cart !== void 0 ? _headerEntry$cart : DEFAULT_CART;
105124
105207
  var searchData = (_headerEntry$search = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.search) !== null && _headerEntry$search !== void 0 ? _headerEntry$search : DEFAULT_SEARCH;
105208
+ var cartData = (_headerEntry$cart = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.cart) !== null && _headerEntry$cart !== void 0 ? _headerEntry$cart : DEFAULT_CART;
105125
105209
  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;
105126
105210
  var navigationData = (_headerEntry$navigati = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.navigation) !== null && _headerEntry$navigati !== void 0 ? _headerEntry$navigati : DEFAULT_NAVIGATION;
105127
105211
  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;
105212
+ console.log("HeaderView render", headerEntry); // Debug log to trace re-renders and data
105128
105213
  return /*#__PURE__*/(0,jsx_runtime_.jsxs)(HeaderRoot, {
105129
105214
  "data-testid": "header-view",
105130
105215
  "data-country": country,
@@ -105158,7 +105243,8 @@ function HeaderView(_ref) {
105158
105243
  "aria-label": searchData.input_aria_label,
105159
105244
  children: /*#__PURE__*/(0,jsx_runtime_.jsx)(IconSearch, {})
105160
105245
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderCartRegion, {
105161
- data: cartData
105246
+ data: cartData,
105247
+ parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$ = headerEntry.$) === null || _headerEntry$$ === void 0 ? void 0 : _headerEntry$$.cart
105162
105248
  })]
105163
105249
  }), /*#__PURE__*/(0,jsx_runtime_.jsxs)(RightHeaderCluster, {
105164
105250
  children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)(UtilityBar, {
@@ -105167,7 +105253,7 @@ function HeaderView(_ref) {
105167
105253
  data: marketSelector,
105168
105254
  logo: logoData,
105169
105255
  locale: String((_ref2 = (_headerEntry$locale = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.locale) !== null && _headerEntry$locale !== void 0 ? _headerEntry$locale : locale) !== null && _ref2 !== void 0 ? _ref2 : "").trim(),
105170
- parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$ = headerEntry.$) === null || _headerEntry$$ === void 0 ? void 0 : _headerEntry$$.market_selector__0,
105256
+ parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$2 = headerEntry.$) === null || _headerEntry$$2 === void 0 ? void 0 : _headerEntry$$2.market_selector__0,
105171
105257
  mobileTriggerMode: "drawerPortal",
105172
105258
  drawerOpen: isMobileMenuOpen,
105173
105259
  drawerTriggerMountRef: mobileMarketTriggerMountRef
@@ -105176,7 +105262,8 @@ function HeaderView(_ref) {
105176
105262
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderAccountRegion, {
105177
105263
  data: accountData
105178
105264
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderCartRegion, {
105179
- data: cartData
105265
+ data: cartData,
105266
+ parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$3 = headerEntry.$) === null || _headerEntry$$3 === void 0 ? void 0 : _headerEntry$$3.cart
105180
105267
  })]
105181
105268
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(SearchSlot, {
105182
105269
  children: /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderSearchRegion, {