@carbon/ibmdotcom-web-components 2.45.0 → 2.47.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.
Files changed (37) hide show
  1. package/custom-elements.json +6 -0
  2. package/dist/dotcom-shell.js +3 -3
  3. package/dist/dotcom-shell.min.js +2 -2
  4. package/dist/ibmdotcom-web-components-dotcom-shell.js +3 -3
  5. package/dist/ibmdotcom-web-components-dotcom-shell.min.js +2 -2
  6. package/dist/{index-8f9fbd8b.js → index-2afb6b83.js} +72 -20
  7. package/dist/{index-e67dc377.js → index-d71fad5e.js} +5 -5
  8. package/dist/{left-nav-menu-895134d1.js → left-nav-menu-c200cfbf.js} +2 -2
  9. package/dist/{left-nav-menu-category-heading-af399ad7.js → left-nav-menu-category-heading-5e03be50.js} +2 -2
  10. package/dist/{left-nav-menu-category-heading-0a43846a.js → left-nav-menu-category-heading-920e6a4d.js} +3 -3
  11. package/dist/{left-nav-menu-b28a0e98.js → left-nav-menu-fd372a33.js} +3 -3
  12. package/dist/{left-nav-menu-item-4712394b.js → left-nav-menu-item-4f1e5c31.js} +2 -2
  13. package/dist/{left-nav-menu-item-9a498b0b.js → left-nav-menu-item-7fdb8ccb.js} +3 -3
  14. package/dist/{left-nav-menu-section-1c64a81d.js → left-nav-menu-section-030cb39a.js} +3 -3
  15. package/dist/{left-nav-menu-section-7de71eee.js → left-nav-menu-section-6b023c26.js} +2 -2
  16. package/dist/{left-nav-overlay-f0a862ea.js → left-nav-overlay-08587d78.js} +2 -2
  17. package/dist/{left-nav-overlay-74b7a919.js → left-nav-overlay-889c0a90.js} +3 -3
  18. package/dist/{megamenu-category-group-7a57911e.js → megamenu-category-group-26bd14a7.js} +3 -3
  19. package/dist/{megamenu-category-group-copy-fd864f59.js → megamenu-category-group-copy-3b2207e3.js} +3 -3
  20. package/dist/{megamenu-category-group-copy-b3b92568.js → megamenu-category-group-copy-6164fd89.js} +2 -2
  21. package/dist/{megamenu-category-group-b607dea5.js → megamenu-category-group-dd55d8cd.js} +2 -2
  22. package/dist/{megamenu-category-heading-bb5993d0.js → megamenu-category-heading-1916b04a.js} +3 -3
  23. package/dist/{megamenu-category-heading-9292d71a.js → megamenu-category-heading-7d136716.js} +2 -2
  24. package/dist/{megamenu-category-link-b36cd7e6.js → megamenu-category-link-5b9838a2.js} +2 -2
  25. package/dist/{megamenu-category-link-ee2e5258.js → megamenu-category-link-d47b8f6a.js} +3 -3
  26. package/dist/{megamenu-category-link-group-d1da04ca.js → megamenu-category-link-group-97e7fb8f.js} +2 -2
  27. package/dist/{megamenu-category-link-group-52858f7c.js → megamenu-category-link-group-c112da07.js} +3 -3
  28. package/dist/{megamenu-left-navigation-7afdc0cb.js → megamenu-left-navigation-68bc901a.js} +3 -3
  29. package/dist/{megamenu-left-navigation-e57cd9a4.js → megamenu-left-navigation-8bbb4f4b.js} +2 -2
  30. package/dist/{megamenu-overlay-3f97003c.js → megamenu-overlay-1e5cbcc8.js} +2 -2
  31. package/dist/{megamenu-overlay-5ef478f4.js → megamenu-overlay-a191f87b.js} +3 -3
  32. package/dist/{megamenu-tab-872dd2ce.js → megamenu-tab-15ccf09c.js} +2 -2
  33. package/dist/{megamenu-tab-b1d421b3.js → megamenu-tab-70d5982a.js} +3 -3
  34. package/es/components/masthead/masthead-cart.d.ts +14 -2
  35. package/es/components/masthead/masthead-cart.js +70 -18
  36. package/es/components/masthead/masthead-cart.js.map +1 -1
  37. package/package.json +5 -5
@@ -17789,6 +17789,12 @@
17789
17789
  "type": "{ lc: string; cc: string; }",
17790
17790
  "default": "{\"lc\":\"en\",\"cc\":\"us\"}"
17791
17791
  },
17792
+ {
17793
+ "name": "updateCart",
17794
+ "description": "Updates cart state",
17795
+ "type": "() => void",
17796
+ "default": "\"() => {\\n const hasCart = SAPCommerceAPI.hasActiveCart();\\n this.hasActiveCart = hasCart;\\n }\""
17797
+ },
17792
17798
  {
17793
17799
  "name": "styles",
17794
17800
  "default": "\"styles\""
@@ -29,7 +29,7 @@
29
29
  * lit-html:
30
30
  *
31
31
  * @license
32
- * Copyright 2017 Google LLC
32
+ * Copyright 2022 Google LLC
33
33
  * SPDX-License-Identifier: BSD-3-Clause
34
34
  *
35
35
  * @lit/reactive-element:
@@ -80,12 +80,12 @@
80
80
  * https://www.npmjs.com/package/redux
81
81
  * https://www.npmjs.com/package/lodash-es
82
82
  * https://www.npmjs.com/package/window-or-global
83
- * https://www.npmjs.com/package/redux-logger
84
83
  * https://www.npmjs.com/package/redux-thunk
84
+ * https://www.npmjs.com/package/redux-logger
85
85
  * https://www.npmjs.com/package/axios
86
86
  * https://www.npmjs.com/package/isomorphic-dompurify
87
87
  * https://www.npmjs.com/package/striptags
88
88
  */
89
89
 
90
90
  let process = { env: {} };
91
- import './index-8f9fbd8b.js';
91
+ import './index-2afb6b83.js';
@@ -80,11 +80,11 @@
80
80
  * https://www.npmjs.com/package/redux
81
81
  * https://www.npmjs.com/package/lodash-es
82
82
  * https://www.npmjs.com/package/window-or-global
83
- * https://www.npmjs.com/package/redux-logger
84
83
  * https://www.npmjs.com/package/redux-thunk
84
+ * https://www.npmjs.com/package/redux-logger
85
85
  * https://www.npmjs.com/package/axios
86
86
  * https://www.npmjs.com/package/isomorphic-dompurify
87
87
  * https://www.npmjs.com/package/striptags
88
88
  */
89
89
 
90
- import"./index-e67dc377.js";
90
+ import"./index-d71fad5e.js";
@@ -29,7 +29,7 @@
29
29
  * lit-html:
30
30
  *
31
31
  * @license
32
- * Copyright 2017 Google LLC
32
+ * Copyright 2022 Google LLC
33
33
  * SPDX-License-Identifier: BSD-3-Clause
34
34
  *
35
35
  * @lit/reactive-element:
@@ -80,12 +80,12 @@
80
80
  * https://www.npmjs.com/package/redux
81
81
  * https://www.npmjs.com/package/lodash-es
82
82
  * https://www.npmjs.com/package/window-or-global
83
- * https://www.npmjs.com/package/redux-logger
84
83
  * https://www.npmjs.com/package/redux-thunk
84
+ * https://www.npmjs.com/package/redux-logger
85
85
  * https://www.npmjs.com/package/axios
86
86
  * https://www.npmjs.com/package/isomorphic-dompurify
87
87
  * https://www.npmjs.com/package/striptags
88
88
  */
89
89
 
90
90
  let process = { env: {} };
91
- import './index-8f9fbd8b.js';
91
+ import './index-2afb6b83.js';
@@ -80,11 +80,11 @@
80
80
  * https://www.npmjs.com/package/redux
81
81
  * https://www.npmjs.com/package/lodash-es
82
82
  * https://www.npmjs.com/package/window-or-global
83
- * https://www.npmjs.com/package/redux-logger
84
83
  * https://www.npmjs.com/package/redux-thunk
84
+ * https://www.npmjs.com/package/redux-logger
85
85
  * https://www.npmjs.com/package/axios
86
86
  * https://www.npmjs.com/package/isomorphic-dompurify
87
87
  * https://www.npmjs.com/package/striptags
88
88
  */
89
89
 
90
- import"./index-e67dc377.js";
90
+ import"./index-d71fad5e.js";
@@ -29,7 +29,7 @@
29
29
  * lit-html:
30
30
  *
31
31
  * @license
32
- * Copyright 2017 Google LLC
32
+ * Copyright 2022 Google LLC
33
33
  * SPDX-License-Identifier: BSD-3-Clause
34
34
  *
35
35
  * @lit/reactive-element:
@@ -80,8 +80,8 @@
80
80
  * https://www.npmjs.com/package/redux
81
81
  * https://www.npmjs.com/package/lodash-es
82
82
  * https://www.npmjs.com/package/window-or-global
83
- * https://www.npmjs.com/package/redux-logger
84
83
  * https://www.npmjs.com/package/redux-thunk
84
+ * https://www.npmjs.com/package/redux-logger
85
85
  * https://www.npmjs.com/package/axios
86
86
  * https://www.npmjs.com/package/isomorphic-dompurify
87
87
  * https://www.npmjs.com/package/striptags
@@ -33015,7 +33015,7 @@ let C4DMegaMenuTopNavMenu = _decorate$s([carbonElement(`${c4dPrefix$s}-megamenu-
33015
33015
  var _this$parentElement;
33016
33016
  // Import needed subcomponents on first expansion
33017
33017
  if (!((_this$parentElement = this.parentElement) !== null && _this$parentElement !== void 0 && _this$parentElement.importedMegamenu)) {
33018
- await Promise.all([import('./megamenu-left-navigation-7afdc0cb.js'), import('./megamenu-category-link-ee2e5258.js'), import('./megamenu-category-link-group-52858f7c.js'), import('./megamenu-category-group-7a57911e.js'), import('./megamenu-category-group-copy-fd864f59.js'), import('./megamenu-category-heading-bb5993d0.js'), Promise.resolve().then(function () { return megamenuLinkWithIcon; }), import('./megamenu-overlay-5ef478f4.js'), import('./megamenu-tab-b1d421b3.js'), Promise.resolve().then(function () { return megamenuTabs; })]);
33018
+ await Promise.all([import('./megamenu-left-navigation-68bc901a.js'), import('./megamenu-category-link-d47b8f6a.js'), import('./megamenu-category-link-group-c112da07.js'), import('./megamenu-category-group-26bd14a7.js'), import('./megamenu-category-group-copy-3b2207e3.js'), import('./megamenu-category-heading-1916b04a.js'), Promise.resolve().then(function () { return megamenuLinkWithIcon; }), import('./megamenu-overlay-a191f87b.js'), import('./megamenu-tab-70d5982a.js'), Promise.resolve().then(function () { return megamenuTabs; })]);
33019
33019
  this.parentElement.importedMegamenu = true;
33020
33020
  }
33021
33021
 
@@ -36661,25 +36661,66 @@ _decorate$i([carbonElement(`${c4dPrefix$i}-masthead-cart`)], function (_initiali
36661
36661
 
36662
36662
  function connectedCallback() {
36663
36663
  _superPropGet$c(C4DMastheadCart, "connectedCallback", this, 3)([]);
36664
- // Check the relevant cookie for whether the user has an active cart.
36665
- this.hasActiveCart = SAPCommerceAPI.hasActiveCart();
36666
- // Fetch the locale for the page.
36664
+
36665
+ // Initial check
36666
+ this.updateCart();
36667
+
36668
+ // Fallback retry
36669
+ this.checkCartWithRetry();
36670
+
36671
+ // Listen for cross-tab updates
36672
+ window.addEventListener('storage', this.updateCart);
36673
+
36674
+ // Fetch locale
36667
36675
  LocaleAPI.getLocale().then(locale => {
36668
36676
  this.locale = locale;
36669
36677
  });
36670
36678
  }
36671
36679
  }, {
36672
36680
  kind: "method",
36673
- key: "updated",
36674
- value: function updated(changedProperties) {
36675
- _superPropGet$c(C4DMastheadCart, "updated", this, 3)([changedProperties]);
36676
- const {
36677
- hasActiveCart
36678
- } = this;
36679
- if (changedProperties.has('hasActiveCart')) {
36680
- this.hidden = !hasActiveCart;
36681
- }
36681
+ key: "disconnectedCallback",
36682
+ value: function disconnectedCallback() {
36683
+ _superPropGet$c(C4DMastheadCart, "disconnectedCallback", this, 3)([]);
36684
+ window.removeEventListener('storage', this.updateCart);
36685
+ }
36686
+
36687
+ /**
36688
+ * Updates cart state
36689
+ */
36690
+ }, {
36691
+ kind: "field",
36692
+ key: "updateCart",
36693
+ value() {
36694
+ return () => {
36695
+ const hasCart = SAPCommerceAPI.hasActiveCart();
36696
+ this.hasActiveCart = hasCart;
36697
+ };
36698
+ }
36699
+ }, {
36700
+ kind: "method",
36701
+ key: "checkCartWithRetry",
36702
+ value:
36703
+ /**
36704
+ * Checks if the user has an active cart and retries a few times if the cart cookie is not available yet.
36705
+ */
36706
+ function checkCartWithRetry(retries = 5, delay = 200) {
36707
+ const check = () => {
36708
+ const hasCart = SAPCommerceAPI.hasActiveCart();
36709
+ if (hasCart) {
36710
+ this.hasActiveCart = true;
36711
+ return;
36712
+ }
36713
+ if (retries > 0) {
36714
+ retries--;
36715
+ setTimeout(check, delay);
36716
+ }
36717
+ };
36718
+ check();
36682
36719
  }
36720
+
36721
+ /**
36722
+ * Filter the correct checkout URL based on locale and country code.
36723
+ */
36683
36724
  }, {
36684
36725
  kind: "method",
36685
36726
  key: "handleURL",
@@ -36695,17 +36736,28 @@ _decorate$i([carbonElement(`${c4dPrefix$i}-masthead-cart`)], function (_initiali
36695
36736
  return `/store/${lc}/${cc}/checkout`;
36696
36737
  }
36697
36738
  }
36739
+ }, {
36740
+ kind: "method",
36741
+ key: "updated",
36742
+ value: function updated(changedProperties) {
36743
+ _superPropGet$c(C4DMastheadCart, "updated", this, 3)([changedProperties]);
36744
+ const {
36745
+ hasActiveCart
36746
+ } = this;
36747
+ if (changedProperties.has('hasActiveCart')) {
36748
+ this.hidden = !hasActiveCart;
36749
+ }
36750
+ }
36698
36751
  }, {
36699
36752
  kind: "method",
36700
36753
  key: "render",
36701
36754
  value: function render() {
36702
36755
  const {
36756
+ linkLabel,
36703
36757
  locale: {
36704
36758
  cc,
36705
36759
  lc
36706
- },
36707
- linkLabel,
36708
- handleURL
36760
+ }
36709
36761
  } = this;
36710
36762
  return x(_t$f || (_t$f = _$f`
36711
36763
  <a
@@ -36715,7 +36767,7 @@ _decorate$i([carbonElement(`${c4dPrefix$i}-masthead-cart`)], function (_initiali
36715
36767
  aria-label="${0}"
36716
36768
  >${0}</a
36717
36769
  >
36718
- `), handleURL(cc, lc), prefix$9, prefix$9, linkLabel, svgResultCarbonIcon$3());
36770
+ `), this.handleURL(cc, lc), prefix$9, prefix$9, linkLabel, svgResultCarbonIcon$3());
36719
36771
  }
36720
36772
  }, {
36721
36773
  kind: "get",
@@ -39094,7 +39146,7 @@ let C4DLeftNav = _decorate$b([carbonElement(`${c4dPrefix$b}-left-nav`)], functio
39094
39146
  value() {
39095
39147
  return async event => {
39096
39148
  if (!this._importedSideNav) {
39097
- await Promise.all([Promise.resolve().then(function () { return leftNavName; }), import('./left-nav-menu-b28a0e98.js'), import('./left-nav-menu-section-1c64a81d.js'), import('./left-nav-menu-item-9a498b0b.js'), import('./left-nav-menu-category-heading-0a43846a.js'), import('./left-nav-overlay-74b7a919.js')]);
39149
+ await Promise.all([Promise.resolve().then(function () { return leftNavName; }), import('./left-nav-menu-fd372a33.js'), import('./left-nav-menu-section-030cb39a.js'), import('./left-nav-menu-item-7fdb8ccb.js'), import('./left-nav-menu-category-heading-920e6a4d.js'), import('./left-nav-overlay-889c0a90.js')]);
39098
39150
  this._importedSideNav = true;
39099
39151
  }
39100
39152
  this.expanded = event.detail.active;