@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.
@@ -100785,6 +100785,8 @@ HeaderLoyaltyRegion.propTypes = {
100785
100785
  }).isRequired
100786
100786
  };
100787
100787
  ;// ./src/components/header/HeaderIcons.jsx
100788
+ /* unused harmony import specifier */ var _jsxs;
100789
+ /* unused harmony import specifier */ var _jsx;
100788
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); }
100789
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; }
100790
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; }
@@ -100866,7 +100868,7 @@ function IconUser(props) {
100866
100868
  }));
100867
100869
  }
100868
100870
  function IconCart(props) {
100869
- return /*#__PURE__*/(0,jsx_runtime_.jsxs)("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
100871
+ return /*#__PURE__*/_jsxs("svg", HeaderIcons_objectSpread(HeaderIcons_objectSpread({
100870
100872
  width: "20",
100871
100873
  height: "20",
100872
100874
  viewBox: "0 0 24 24",
@@ -100874,18 +100876,18 @@ function IconCart(props) {
100874
100876
  xmlns: "http://www.w3.org/2000/svg",
100875
100877
  "aria-hidden": true
100876
100878
  }, props), {}, {
100877
- children: [/*#__PURE__*/(0,jsx_runtime_.jsx)("path", {
100879
+ children: [/*#__PURE__*/_jsx("path", {
100878
100880
  d: "M6 7h15l-2 10H8L6 7zm0 0L5 3H2",
100879
100881
  stroke: "currentColor",
100880
100882
  strokeWidth: "2",
100881
100883
  strokeLinecap: "round",
100882
100884
  strokeLinejoin: "round"
100883
- }), /*#__PURE__*/(0,jsx_runtime_.jsx)("circle", {
100885
+ }), /*#__PURE__*/_jsx("circle", {
100884
100886
  cx: "10",
100885
100887
  cy: "20",
100886
100888
  r: "1",
100887
100889
  fill: "currentColor"
100888
- }), /*#__PURE__*/(0,jsx_runtime_.jsx)("circle", {
100890
+ }), /*#__PURE__*/_jsx("circle", {
100889
100891
  cx: "18",
100890
100892
  cy: "20",
100891
100893
  r: "1",
@@ -100944,30 +100946,104 @@ HeaderAccountRegion.propTypes = {
100944
100946
  sign_up_label: external_prop_types_["default"].string.isRequired
100945
100947
  }).isRequired
100946
100948
  };
100947
- ;// ./src/components/header/regions/HeaderCartRegion.jsx
100949
+ ;// ./src/components/cart/Cart.styled.jsx
100948
100950
 
100951
+ var CartIconWrapper = /*#__PURE__*/createStyled("div", true ? {
100952
+ target: "ein8udj0"
100953
+ } : 0)("display:flex;align-items:center;position:relative;", function (_ref) {
100954
+ var isEditing = _ref.isEditing;
100955
+ return isEditing && "\n & > * {\n pointer-events: none;\n }\n ";
100956
+ }, " & .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) {
100957
+ var showCartCount = _ref2.showCartCount;
100958
+ return !showCartCount && "\n display: none;\n ";
100959
+ }, ";}" + ( true ? "" : 0));
100960
+ ;// ./src/components/cart/Cart.constants.js
100961
+ var DEFAULT_ITEM_COUNT = 0;
100962
+ var DEFAULT_ARIA_LABEL = "Shopping cart";
100963
+ var DEFAULT_SHOW_CART_ICON = false;
100964
+ var DEFAULT_SHOW_CART_COUNT = false;
100965
+ ;// ./src/components/cart/Cart.jsx
100966
+ 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); }
100967
+ 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; }
100968
+ 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; }
100969
+ 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; }
100970
+ function Cart_toPropertyKey(t) { var i = Cart_toPrimitive(t, "string"); return "symbol" == Cart_typeof(i) ? i : i + ""; }
100971
+ 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); }
100949
100972
 
100950
100973
 
100951
100974
 
100952
100975
 
100953
- function HeaderCartRegion(_ref) {
100954
- var _data$aria_label, _data$count;
100955
- var data = _ref.data;
100956
- return /*#__PURE__*/(0,jsx_runtime_.jsx)(UtilityButton, {
100957
- type: "button",
100958
- "aria-label": (_data$aria_label = data.aria_label) !== null && _data$aria_label !== void 0 ? _data$aria_label : "Shopping cart",
100959
- children: /*#__PURE__*/(0,jsx_runtime_.jsxs)(CartButtonInner, {
100960
- children: [/*#__PURE__*/(0,jsx_runtime_.jsx)(IconCart, {}), /*#__PURE__*/(0,jsx_runtime_.jsx)(CartBadge, {
100961
- children: (_data$count = data.count) !== null && _data$count !== void 0 ? _data$count : 0
100962
- })]
100976
+
100977
+
100978
+
100979
+ function Cart(_ref) {
100980
+ var itemCount = _ref.itemCount,
100981
+ ariaLabel = _ref.ariaLabel,
100982
+ showCartIcon = _ref.showCartIcon,
100983
+ showCartCount = _ref.showCartCount,
100984
+ $ = _ref.$;
100985
+ var editing = isEditingMode();
100986
+ if (!showCartIcon) {
100987
+ return null;
100988
+ }
100989
+ return /*#__PURE__*/(0,jsx_runtime_.jsx)(CartIconWrapper, Cart_objectSpread(Cart_objectSpread({
100990
+ "data-testid": "cart",
100991
+ "aria-label": ariaLabel,
100992
+ showCartCount: showCartCount,
100993
+ isEditing: editing
100994
+ }, $ || {}), {}, {
100995
+ children: /*#__PURE__*/(0,jsx_runtime_.jsx)(dist.NsCartIcon, {
100996
+ itemCount: showCartCount ? itemCount : 0,
100997
+ size: "large",
100998
+ color: "slate"
100963
100999
  })
101000
+ }));
101001
+ }
101002
+ Cart.propTypes = {
101003
+ itemCount: external_prop_types_["default"].number,
101004
+ ariaLabel: external_prop_types_["default"].string,
101005
+ showCartIcon: external_prop_types_["default"].bool,
101006
+ showCartCount: external_prop_types_["default"].bool,
101007
+ $: external_prop_types_["default"].object
101008
+ };
101009
+ Cart.defaultProps = {
101010
+ itemCount: DEFAULT_ITEM_COUNT,
101011
+ ariaLabel: DEFAULT_ARIA_LABEL,
101012
+ showCartIcon: DEFAULT_SHOW_CART_ICON,
101013
+ showCartCount: DEFAULT_SHOW_CART_COUNT,
101014
+ $: null
101015
+ };
101016
+ ;// ./src/components/header/regions/HeaderCartRegion.jsx
101017
+
101018
+
101019
+
101020
+
101021
+ function HeaderCartRegion(_ref) {
101022
+ var _data$show_cart_icon, _data$show_cart_count, _data$item_count;
101023
+ var data = _ref.data,
101024
+ parent$ = _ref.parent$;
101025
+ 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;
101026
+ 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;
101027
+ 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;
101028
+ return /*#__PURE__*/(0,jsx_runtime_.jsx)(Cart, {
101029
+ itemCount: itemCount,
101030
+ "aria-label": "Shopping cart",
101031
+ showCartIcon: showCartIcon,
101032
+ showCartCount: showCartCount,
101033
+ $: parent$
100964
101034
  });
100965
101035
  }
100966
101036
  HeaderCartRegion.propTypes = {
100967
101037
  data: external_prop_types_["default"].shape({
100968
- aria_label: external_prop_types_["default"].string,
100969
- count: external_prop_types_["default"].number
100970
- }).isRequired
101038
+ show_cart_icon: external_prop_types_["default"].bool,
101039
+ show_cart_count: external_prop_types_["default"].bool,
101040
+ item_count: external_prop_types_["default"].number
101041
+ }),
101042
+ parent$: external_prop_types_["default"].object
101043
+ };
101044
+ HeaderCartRegion.defaultProps = {
101045
+ data: null,
101046
+ parent$: null
100971
101047
  };
100972
101048
  ;// ./src/components/header/regions/HeaderSearchRegion.jsx
100973
101049
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || HeaderSearchRegion_unsupportedIterableToArray(r, e) || _nonIterableRest(); }
@@ -104627,14 +104703,15 @@ var DEFAULT_ACCOUNT = {
104627
104703
  sign_in_label: "Sign In",
104628
104704
  sign_up_label: "Sign Up"
104629
104705
  };
104630
- var DEFAULT_CART = {
104631
- aria_label: "Shopping cart",
104632
- count: 0
104633
- };
104634
104706
  var DEFAULT_SEARCH = {
104635
104707
  placeholder: "Product Search",
104636
104708
  input_aria_label: "Product search"
104637
104709
  };
104710
+ var DEFAULT_CART = {
104711
+ show_cart_icon: false,
104712
+ show_cart_count: false,
104713
+ item_count: 0
104714
+ };
104638
104715
  var DEFAULT_NAVIGATION = {
104639
104716
  topNavItems: [{
104640
104717
  id: "devices",
@@ -104687,7 +104764,7 @@ var DEFAULT_TOP_RIBBON_LINKS = [{
104687
104764
  ariaLabel: "Shop Gifts"
104688
104765
  }];
104689
104766
  function HeaderView(_ref) {
104690
- 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$$;
104767
+ 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;
104691
104768
  var country = _ref.country,
104692
104769
  language = _ref.language,
104693
104770
  locale = _ref.locale,
@@ -104703,11 +104780,12 @@ function HeaderView(_ref) {
104703
104780
  return link === null || link === void 0 ? void 0 : link.loyalty_menu;
104704
104781
  })) === 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;
104705
104782
  var accountData = (_headerEntry$account = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.account) !== null && _headerEntry$account !== void 0 ? _headerEntry$account : DEFAULT_ACCOUNT;
104706
- var cartData = (_headerEntry$cart = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.cart) !== null && _headerEntry$cart !== void 0 ? _headerEntry$cart : DEFAULT_CART;
104707
104783
  var searchData = (_headerEntry$search = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.search) !== null && _headerEntry$search !== void 0 ? _headerEntry$search : DEFAULT_SEARCH;
104784
+ var cartData = (_headerEntry$cart = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.cart) !== null && _headerEntry$cart !== void 0 ? _headerEntry$cart : DEFAULT_CART;
104708
104785
  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;
104709
104786
  var navigationData = (_headerEntry$navigati = headerEntry === null || headerEntry === void 0 ? void 0 : headerEntry.navigation) !== null && _headerEntry$navigati !== void 0 ? _headerEntry$navigati : DEFAULT_NAVIGATION;
104710
104787
  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;
104788
+ console.log("HeaderView render", headerEntry); // Debug log to trace re-renders and data
104711
104789
  return /*#__PURE__*/(0,jsx_runtime_.jsxs)(HeaderRoot, {
104712
104790
  "data-testid": "header-view",
104713
104791
  "data-country": country,
@@ -104741,7 +104819,8 @@ function HeaderView(_ref) {
104741
104819
  "aria-label": searchData.input_aria_label,
104742
104820
  children: /*#__PURE__*/(0,jsx_runtime_.jsx)(IconSearch, {})
104743
104821
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderCartRegion, {
104744
- data: cartData
104822
+ data: cartData,
104823
+ parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$ = headerEntry.$) === null || _headerEntry$$ === void 0 ? void 0 : _headerEntry$$.cart
104745
104824
  })]
104746
104825
  }), /*#__PURE__*/(0,jsx_runtime_.jsxs)(RightHeaderCluster, {
104747
104826
  children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)(UtilityBar, {
@@ -104750,7 +104829,7 @@ function HeaderView(_ref) {
104750
104829
  data: marketSelector,
104751
104830
  logo: logoData,
104752
104831
  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(),
104753
- parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$ = headerEntry.$) === null || _headerEntry$$ === void 0 ? void 0 : _headerEntry$$.market_selector__0,
104832
+ parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$2 = headerEntry.$) === null || _headerEntry$$2 === void 0 ? void 0 : _headerEntry$$2.market_selector__0,
104754
104833
  mobileTriggerMode: "drawerPortal",
104755
104834
  drawerOpen: isMobileMenuOpen,
104756
104835
  drawerTriggerMountRef: mobileMarketTriggerMountRef
@@ -104759,7 +104838,8 @@ function HeaderView(_ref) {
104759
104838
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderAccountRegion, {
104760
104839
  data: accountData
104761
104840
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderCartRegion, {
104762
- data: cartData
104841
+ data: cartData,
104842
+ parent$: headerEntry === null || headerEntry === void 0 || (_headerEntry$$3 = headerEntry.$) === null || _headerEntry$$3 === void 0 ? void 0 : _headerEntry$$3.cart
104763
104843
  })]
104764
104844
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)(SearchSlot, {
104765
104845
  children: /*#__PURE__*/(0,jsx_runtime_.jsx)(HeaderSearchRegion, {