@nok-integration/storefront-react 0.11.3 → 0.13.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/dist/index.d.ts CHANGED
@@ -293,8 +293,9 @@ export declare interface CartViewProps {
293
293
  *
294
294
  * DAZN's checkout is the next step and DAZN name it; a host whose own wording is
295
295
  * "Continue" or "Go to checkout" should not have to accept ours. The locked-cart label
296
- * is deliberately NOT configurable — it states a condition rather than an action, and a
297
- * host renaming it could imply the button still works.
296
+ * is deliberately NOT configurable — it takes the fan back to a checkout that already
297
+ * exists, which is a different action from starting one, and a host renaming it could
298
+ * imply a second checkout is being created.
298
299
  */
299
300
  checkoutLabel?: string;
300
301
  }
package/dist/index.mjs CHANGED
@@ -5564,7 +5564,9 @@ const TREATMENTS = {
5564
5564
  },
5565
5565
  cart_locked: {
5566
5566
  title: "Checkout in progress",
5567
- body: "Your basket is locked while checkout completes. Finish or cancel checkout to make changes.",
5567
+ // Says what to do, not what we have done to their basket. "Locked" is our word for
5568
+ // our mechanism; the fan only needs the next step, which is the CTA on this screen.
5569
+ body: "Your checkout is still open. Return to it to finish or cancel your order.",
5568
5570
  // Not retriable: repeating the same edit fails identically until the lock clears,
5569
5571
  // and a "try again" affordance here would teach the fan to hammer a button that
5570
5572
  // cannot work. The lock lifts on its own or on DAZN's signal, not on a retry.
@@ -6952,15 +6954,14 @@ function StickyCtaBar({ children, info: info2, variant = "floating" }) {
6952
6954
  /* @__PURE__ */ jsx("div", { className: styles$j.actions, children })
6953
6955
  ] });
6954
6956
  }
6955
- const surface = "_surface_1t90m_15";
6956
- const screen = "_screen_1t90m_20";
6957
- const body$2 = "_body_1t90m_12";
6958
- const items = "_items_1t90m_34";
6959
- const sectionHeader = "_sectionHeader_1t90m_40";
6960
- const sectionTitle = "_sectionTitle_1t90m_46";
6961
- const count = "_count_1t90m_53";
6962
- const lines = "_lines_1t90m_73";
6963
- const lockNotice = "_lockNotice_1t90m_82";
6957
+ const surface = "_surface_1wfue_15";
6958
+ const screen = "_screen_1wfue_20";
6959
+ const body$2 = "_body_1wfue_12";
6960
+ const items = "_items_1wfue_34";
6961
+ const sectionHeader = "_sectionHeader_1wfue_40";
6962
+ const sectionTitle = "_sectionTitle_1wfue_46";
6963
+ const count = "_count_1wfue_53";
6964
+ const lines = "_lines_1wfue_73";
6964
6965
  const styles$i = {
6965
6966
  surface,
6966
6967
  screen,
@@ -6969,8 +6970,7 @@ const styles$i = {
6969
6970
  sectionHeader,
6970
6971
  sectionTitle,
6971
6972
  count,
6972
- lines,
6973
- lockNotice
6973
+ lines
6974
6974
  };
6975
6975
  function CartView(props = {}) {
6976
6976
  return /* @__PURE__ */ jsx(ShopSurface, { tone: "light", fill: true, className: styles$i.surface, children: /* @__PURE__ */ jsx(CartViewContent, { ...props }) });
@@ -7000,6 +7000,16 @@ function CartViewContent({
7000
7000
  useEffect(() => {
7001
7001
  void load();
7002
7002
  }, [load]);
7003
+ useEffect(() => {
7004
+ if (typeof window === "undefined") return;
7005
+ const onPageShow = (event) => {
7006
+ if (!event.persisted) return;
7007
+ setHandingOff(false);
7008
+ void load();
7009
+ };
7010
+ window.addEventListener("pageshow", onPageShow);
7011
+ return () => window.removeEventListener("pageshow", onPageShow);
7012
+ }, [load]);
7003
7013
  async function mutate(sku, action2, optimistic) {
7004
7014
  if (!cart2) return false;
7005
7015
  const snapshot = cart2;
@@ -7103,7 +7113,6 @@ function CartViewContent({
7103
7113
  const locked = cart2.locked !== void 0;
7104
7114
  const itemCount = cart2.items.reduce((n, i) => n + i.qty, 0);
7105
7115
  return /* @__PURE__ */ jsxs("div", { className: styles$i.screen, children: [
7106
- locked && /* @__PURE__ */ jsx("p", { role: "status", className: styles$i.lockNotice, children: "Checkout is in progress, so your basket is locked. Finish or cancel checkout to make changes." }),
7107
7116
  /* @__PURE__ */ jsxs("div", { className: styles$i.body, children: [
7108
7117
  /* @__PURE__ */ jsxs("section", { className: styles$i.items, children: [
7109
7118
  /* @__PURE__ */ jsxs("div", { className: styles$i.sectionHeader, children: [
@@ -7124,7 +7133,15 @@ function CartViewContent({
7124
7133
  /* @__PURE__ */ jsx(ShippingInfo, {}),
7125
7134
  /* @__PURE__ */ jsx(OrderSummary, { pricing: cart2.totals, deferred: ["shipping", "tax"] })
7126
7135
  ] }),
7127
- /* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => void handOff(cart2), disabled: locked || handingOff, children: locked ? "Checkout in progress" : checkoutLabel }) })
7136
+ /* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(
7137
+ Button,
7138
+ {
7139
+ variant: "primary",
7140
+ onClick: () => void handOff(cart2),
7141
+ disabled: handingOff,
7142
+ children: locked ? "Return to checkout" : checkoutLabel
7143
+ }
7144
+ ) })
7128
7145
  ] });
7129
7146
  }
7130
7147
  const CartSheetContext = createContext(null);
@@ -5564,7 +5564,9 @@ const TREATMENTS = {
5564
5564
  },
5565
5565
  cart_locked: {
5566
5566
  title: "Checkout in progress",
5567
- body: "Your basket is locked while checkout completes. Finish or cancel checkout to make changes.",
5567
+ // Says what to do, not what we have done to their basket. "Locked" is our word for
5568
+ // our mechanism; the fan only needs the next step, which is the CTA on this screen.
5569
+ body: "Your checkout is still open. Return to it to finish or cancel your order.",
5568
5570
  // Not retriable: repeating the same edit fails identically until the lock clears,
5569
5571
  // and a "try again" affordance here would teach the fan to hammer a button that
5570
5572
  // cannot work. The lock lifts on its own or on DAZN's signal, not on a retry.
@@ -6952,15 +6954,14 @@ function StickyCtaBar({ children, info: info2, variant = "floating" }) {
6952
6954
  /* @__PURE__ */ jsx("div", { className: styles$j.actions, children })
6953
6955
  ] });
6954
6956
  }
6955
- const surface = "_surface_1t90m_15";
6956
- const screen = "_screen_1t90m_20";
6957
- const body$2 = "_body_1t90m_12";
6958
- const items = "_items_1t90m_34";
6959
- const sectionHeader = "_sectionHeader_1t90m_40";
6960
- const sectionTitle = "_sectionTitle_1t90m_46";
6961
- const count = "_count_1t90m_53";
6962
- const lines = "_lines_1t90m_73";
6963
- const lockNotice = "_lockNotice_1t90m_82";
6957
+ const surface = "_surface_1wfue_15";
6958
+ const screen = "_screen_1wfue_20";
6959
+ const body$2 = "_body_1wfue_12";
6960
+ const items = "_items_1wfue_34";
6961
+ const sectionHeader = "_sectionHeader_1wfue_40";
6962
+ const sectionTitle = "_sectionTitle_1wfue_46";
6963
+ const count = "_count_1wfue_53";
6964
+ const lines = "_lines_1wfue_73";
6964
6965
  const styles$i = {
6965
6966
  surface,
6966
6967
  screen,
@@ -6969,8 +6970,7 @@ const styles$i = {
6969
6970
  sectionHeader,
6970
6971
  sectionTitle,
6971
6972
  count,
6972
- lines,
6973
- lockNotice
6973
+ lines
6974
6974
  };
6975
6975
  function CartView(props = {}) {
6976
6976
  return /* @__PURE__ */ jsx(ShopSurface, { tone: "light", fill: true, className: styles$i.surface, children: /* @__PURE__ */ jsx(CartViewContent, { ...props }) });
@@ -7000,6 +7000,16 @@ function CartViewContent({
7000
7000
  useEffect(() => {
7001
7001
  void load();
7002
7002
  }, [load]);
7003
+ useEffect(() => {
7004
+ if (typeof window === "undefined") return;
7005
+ const onPageShow = (event) => {
7006
+ if (!event.persisted) return;
7007
+ setHandingOff(false);
7008
+ void load();
7009
+ };
7010
+ window.addEventListener("pageshow", onPageShow);
7011
+ return () => window.removeEventListener("pageshow", onPageShow);
7012
+ }, [load]);
7003
7013
  async function mutate(sku, action2, optimistic) {
7004
7014
  if (!cart2) return false;
7005
7015
  const snapshot = cart2;
@@ -7103,7 +7113,6 @@ function CartViewContent({
7103
7113
  const locked = cart2.locked !== void 0;
7104
7114
  const itemCount = cart2.items.reduce((n, i) => n + i.qty, 0);
7105
7115
  return /* @__PURE__ */ jsxs("div", { className: styles$i.screen, children: [
7106
- locked && /* @__PURE__ */ jsx("p", { role: "status", className: styles$i.lockNotice, children: "Checkout is in progress, so your basket is locked. Finish or cancel checkout to make changes." }),
7107
7116
  /* @__PURE__ */ jsxs("div", { className: styles$i.body, children: [
7108
7117
  /* @__PURE__ */ jsxs("section", { className: styles$i.items, children: [
7109
7118
  /* @__PURE__ */ jsxs("div", { className: styles$i.sectionHeader, children: [
@@ -7124,7 +7133,15 @@ function CartViewContent({
7124
7133
  /* @__PURE__ */ jsx(ShippingInfo, {}),
7125
7134
  /* @__PURE__ */ jsx(OrderSummary, { pricing: cart2.totals, deferred: ["shipping", "tax"] })
7126
7135
  ] }),
7127
- /* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => void handOff(cart2), disabled: locked || handingOff, children: locked ? "Checkout in progress" : checkoutLabel }) })
7136
+ /* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(
7137
+ Button,
7138
+ {
7139
+ variant: "primary",
7140
+ onClick: () => void handOff(cart2),
7141
+ disabled: handingOff,
7142
+ children: locked ? "Return to checkout" : checkoutLabel
7143
+ }
7144
+ ) })
7128
7145
  ] });
7129
7146
  }
7130
7147
  const CartSheetContext = createContext(null);
@@ -1830,18 +1830,18 @@
1830
1830
  * left, and `.body` absorbs the slack so the bar is pushed onto the bottom edge on a short
1831
1831
  * cart and still sticks on a long one.
1832
1832
  */
1833
- ._surface_1t90m_15 {
1833
+ ._surface_1wfue_15 {
1834
1834
  display: flex;
1835
1835
  flex-direction: column;
1836
1836
  }
1837
1837
 
1838
- ._screen_1t90m_20 {
1838
+ ._screen_1wfue_20 {
1839
1839
  display: flex;
1840
1840
  flex-direction: column;
1841
1841
  flex: 1 1 auto;
1842
1842
  }
1843
1843
 
1844
- ._body_1t90m_12 {
1844
+ ._body_1wfue_12 {
1845
1845
  display: flex;
1846
1846
  flex-direction: column;
1847
1847
  gap: var(--space-20);
@@ -1849,26 +1849,26 @@
1849
1849
  flex: 1 1 auto;
1850
1850
  }
1851
1851
 
1852
- ._items_1t90m_34 {
1852
+ ._items_1wfue_34 {
1853
1853
  display: flex;
1854
1854
  flex-direction: column;
1855
1855
  gap: var(--space-20);
1856
1856
  }
1857
1857
 
1858
- ._sectionHeader_1t90m_40 {
1858
+ ._sectionHeader_1wfue_40 {
1859
1859
  display: flex;
1860
1860
  align-items: center;
1861
1861
  gap: var(--space-12);
1862
1862
  }
1863
1863
 
1864
- ._sectionTitle_1t90m_46 {
1864
+ ._sectionTitle_1wfue_46 {
1865
1865
  margin: 0;
1866
1866
  font-size: var(--type-heading-md-size);
1867
1867
  line-height: 1.38;
1868
1868
  font-weight: var(--font-weight-bold);
1869
1869
  }
1870
1870
 
1871
- ._count_1t90m_53 {
1871
+ ._count_1wfue_53 {
1872
1872
  display: inline-flex;
1873
1873
  align-items: center;
1874
1874
  justify-content: center;
@@ -1888,7 +1888,7 @@
1888
1888
  * every line, so the space under "Items" and the space between two lines are the same
1889
1889
  * measurement — 148 → 268 → 388, on 100px lines.
1890
1890
  */
1891
- ._lines_1t90m_73 {
1891
+ ._lines_1wfue_73 {
1892
1892
  list-style: none;
1893
1893
  margin: 0;
1894
1894
  padding: 0;
@@ -1897,15 +1897,6 @@
1897
1897
  gap: var(--space-20);
1898
1898
  }
1899
1899
 
1900
- ._lockNotice_1t90m_82 {
1901
- margin: 0;
1902
- padding: var(--space-12) var(--space-16);
1903
- background: var(--color-state-surface-warning-soft);
1904
- color: var(--color-text-default);
1905
- border-bottom: 1px solid var(--color-border-subtle);
1906
- font-size: 14px;
1907
- line-height: 1.4;
1908
- }
1909
1900
  ._gallery_h8m00_1 {
1910
1901
  position: relative;
1911
1902
  display: flex;
package/dist/styles.css CHANGED
@@ -1830,18 +1830,18 @@
1830
1830
  * left, and `.body` absorbs the slack so the bar is pushed onto the bottom edge on a short
1831
1831
  * cart and still sticks on a long one.
1832
1832
  */
1833
- ._surface_1t90m_15 {
1833
+ ._surface_1wfue_15 {
1834
1834
  display: flex;
1835
1835
  flex-direction: column;
1836
1836
  }
1837
1837
 
1838
- ._screen_1t90m_20 {
1838
+ ._screen_1wfue_20 {
1839
1839
  display: flex;
1840
1840
  flex-direction: column;
1841
1841
  flex: 1 1 auto;
1842
1842
  }
1843
1843
 
1844
- ._body_1t90m_12 {
1844
+ ._body_1wfue_12 {
1845
1845
  display: flex;
1846
1846
  flex-direction: column;
1847
1847
  gap: var(--space-20);
@@ -1849,26 +1849,26 @@
1849
1849
  flex: 1 1 auto;
1850
1850
  }
1851
1851
 
1852
- ._items_1t90m_34 {
1852
+ ._items_1wfue_34 {
1853
1853
  display: flex;
1854
1854
  flex-direction: column;
1855
1855
  gap: var(--space-20);
1856
1856
  }
1857
1857
 
1858
- ._sectionHeader_1t90m_40 {
1858
+ ._sectionHeader_1wfue_40 {
1859
1859
  display: flex;
1860
1860
  align-items: center;
1861
1861
  gap: var(--space-12);
1862
1862
  }
1863
1863
 
1864
- ._sectionTitle_1t90m_46 {
1864
+ ._sectionTitle_1wfue_46 {
1865
1865
  margin: 0;
1866
1866
  font-size: var(--type-heading-md-size);
1867
1867
  line-height: 1.38;
1868
1868
  font-weight: var(--font-weight-bold);
1869
1869
  }
1870
1870
 
1871
- ._count_1t90m_53 {
1871
+ ._count_1wfue_53 {
1872
1872
  display: inline-flex;
1873
1873
  align-items: center;
1874
1874
  justify-content: center;
@@ -1888,7 +1888,7 @@
1888
1888
  * every line, so the space under "Items" and the space between two lines are the same
1889
1889
  * measurement — 148 → 268 → 388, on 100px lines.
1890
1890
  */
1891
- ._lines_1t90m_73 {
1891
+ ._lines_1wfue_73 {
1892
1892
  list-style: none;
1893
1893
  margin: 0;
1894
1894
  padding: 0;
@@ -1897,15 +1897,6 @@
1897
1897
  gap: var(--space-20);
1898
1898
  }
1899
1899
 
1900
- ._lockNotice_1t90m_82 {
1901
- margin: 0;
1902
- padding: var(--space-12) var(--space-16);
1903
- background: var(--color-state-surface-warning-soft);
1904
- color: var(--color-text-default);
1905
- border-bottom: 1px solid var(--color-border-subtle);
1906
- font-size: 14px;
1907
- line-height: 1.4;
1908
- }
1909
1900
  ._gallery_h8m00_1 {
1910
1901
  position: relative;
1911
1902
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nok-integration/storefront-react",
3
- "version": "0.11.3",
3
+ "version": "0.13.0",
4
4
  "description": "Mountable React storefront components: catalogue, product detail and cart, mounted directly into a host DOM tree. No iframe.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {