@nuskin/nextgen-header 1.23.1 → 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.
@@ -101209,6 +101209,8 @@ HeaderLoyaltyRegion.propTypes = {
101209
101209
  }).isRequired
101210
101210
  };
101211
101211
  ;// ./src/components/header/HeaderIcons.jsx
101212
+ /* unused harmony import specifier */ var _jsxs;
101213
+ /* unused harmony import specifier */ var _jsx;
101212
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); }
101213
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; }
101214
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; }
@@ -101290,7 +101292,7 @@ function IconUser(props) {
101290
101292
  }));
101291
101293
  }
101292
101294
  function IconCart(props) {
101293
- return /*#__PURE__*/(0,jsx_runtime_.jsxs)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
101295
+ return /*#__PURE__*/_jsxs("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
101294
101296
  width: "20",
101295
101297
  height: "20",
101296
101298
  viewBox: "0 0 24 24",
@@ -101298,18 +101300,18 @@ function IconCart(props) {
101298
101300
  xmlns: "http://www.w3.org/2000/svg",
101299
101301
  "aria-hidden": true
101300
101302
  }, props), {}, {
101301
- children: [/*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
101303
+ children: [/*#__PURE__*/_jsx("path", {
101302
101304
  d: "M6 7h15l-2 10H8L6 7zm0 0L5 3H2",
101303
101305
  stroke: "currentColor",
101304
101306
  strokeWidth: "2",
101305
101307
  strokeLinecap: "round",
101306
101308
  strokeLinejoin: "round"
101307
- }), /*#__PURE__*/(0,jsx_runtime_.jsx)("circle", {
101309
+ }), /*#__PURE__*/_jsx("circle", {
101308
101310
  cx: "10",
101309
101311
  cy: "20",
101310
101312
  r: "1",
101311
101313
  fill: "currentColor"
101312
- }), /*#__PURE__*/(0,jsx_runtime_.jsx)("circle", {
101314
+ }), /*#__PURE__*/_jsx("circle", {
101313
101315
  cx: "18",
101314
101316
  cy: "20",
101315
101317
  r: "1",
@@ -101368,30 +101370,104 @@ HeaderAccountRegion.propTypes = {
101368
101370
  sign_up_label: (external_prop_types_default()).string.isRequired
101369
101371
  }).isRequired
101370
101372
  };
101371
- ;// ./src/components/header/regions/HeaderCartRegion.jsx
101373
+ ;// ./src/components/cart/Cart.styled.jsx
101372
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); }
101373
101396
 
101374
101397
 
101375
101398
 
101376
101399
 
101377
- function HeaderCartRegion(_ref) {
101378
- var _data$aria_label, _data$count;
101379
- var data = _ref.data;
101380
- return /*#__PURE__*/(0,jsx_runtime_.jsx)(UtilityButton, {
101381
- type: "button",
101382
- "aria-label": (_data$aria_label = data.aria_label) !== null && _data$aria_label !== void 0 ? _data$aria_label : "Shopping cart",
101383
- children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(CartButtonInner, {
101384
- children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(IconCart, {}), /*#__PURE__*/(0,jsx_runtime_.jsx)(CartBadge, {
101385
- children: (_data$count = data.count) !== null && _data$count !== void 0 ? _data$count : 0
101386
- })]
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"
101387
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$
101388
101458
  });
101389
101459
  }
101390
101460
  HeaderCartRegion.propTypes = {
101391
101461
  data: external_prop_types_default().shape({
101392
- aria_label: (external_prop_types_default()).string,
101393
- count: (external_prop_types_default()).number
101394
- }).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
101395
101471
  };
101396
101472
  ;// ./src/components/header/regions/HeaderSearchRegion.jsx
101397
101473
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || HeaderSearchRegion_unsupportedIterableToArray(r, e) || _nonIterableRest(); }
@@ -105051,14 +105127,15 @@ var DEFAULT_ACCOUNT = {
105051
105127
  sign_in_label: "Sign In",
105052
105128
  sign_up_label: "Sign Up"
105053
105129
  };
105054
- var DEFAULT_CART = {
105055
- aria_label: "Shopping cart",
105056
- count: 0
105057
- };
105058
105130
  var DEFAULT_SEARCH = {
105059
105131
  placeholder: "Product Search",
105060
105132
  input_aria_label: "Product search"
105061
105133
  };
105134
+ var DEFAULT_CART = {
105135
+ show_cart_icon: false,
105136
+ show_cart_count: false,
105137
+ item_count: 0
105138
+ };
105062
105139
  var DEFAULT_NAVIGATION = {
105063
105140
  topNavItems: [{
105064
105141
  id: "devices",
@@ -105111,7 +105188,7 @@ var DEFAULT_TOP_RIBBON_LINKS = [{
105111
105188
  ariaLabel: "Shop Gifts"
105112
105189
  }];
105113
105190
  function HeaderView(_ref) {
105114
- 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;
105115
105192
  var country = _ref.country,
105116
105193
  language = _ref.language,
105117
105194
  locale = _ref.locale,
@@ -105127,11 +105204,12 @@ function HeaderView(_ref) {
105127
105204
  return link === null || link === void 0 ? void 0 : link.loyalty_menu;
105128
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;
105129
105206
  var accountData = (_headerEntry$account = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.account) !== null && _headerEntry$account !== void 0 ? _headerEntry$account : DEFAULT_ACCOUNT;
105130
- var cartData = (_headerEntry$cart = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.cart) !== null && _headerEntry$cart !== void 0 ? _headerEntry$cart : DEFAULT_CART;
105131
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;
105132
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;
105133
105210
  var navigationData = (_headerEntry$navigati = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.navigation) !== null && _headerEntry$navigati !== void 0 ? _headerEntry$navigati : DEFAULT_NAVIGATION;
105134
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
105135
105213
  return /*#__PURE__*/(0,jsx_runtime_.jsxs)(HeaderRoot, {
105136
105214
  "data-testid": "header-view",
105137
105215
  "data-country": country,
@@ -105165,7 +105243,8 @@ function HeaderView(_ref) {
105165
105243
  "aria-label": searchData.input_aria_label,
105166
105244
  children: /*#__PURE__*/(0,jsx_runtime_.jsx)(IconSearch, {})
105167
105245
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderCartRegion, {
105168
- data: cartData
105246
+ data: cartData,
105247
+ parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$ = headerEntry.$) === null || _headerEntry$$ === void 0 ? void 0 : _headerEntry$$.cart
105169
105248
  })]
105170
105249
  }), /*#__PURE__*/(0,jsx_runtime_.jsxs)(RightHeaderCluster, {
105171
105250
  children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)(UtilityBar, {
@@ -105174,7 +105253,7 @@ function HeaderView(_ref) {
105174
105253
  data: marketSelector,
105175
105254
  logo: logoData,
105176
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(),
105177
- 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,
105178
105257
  mobileTriggerMode: "drawerPortal",
105179
105258
  drawerOpen: isMobileMenuOpen,
105180
105259
  drawerTriggerMountRef: mobileMarketTriggerMountRef
@@ -105183,7 +105262,8 @@ function HeaderView(_ref) {
105183
105262
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderAccountRegion, {
105184
105263
  data: accountData
105185
105264
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderCartRegion, {
105186
- 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
105187
105267
  })]
105188
105268
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(SearchSlot, {
105189
105269
  children: /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderSearchRegion, {