@nok-integration/storefront-react 0.11.3 → 0.12.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,10 @@ 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
+ // Points at the CTA, which returns to the open checkout. The previous wording told
5568
+ // the fan to "finish or cancel checkout" while both of those controls were on DAZN's
5569
+ // page and nothing on this screen could reach it.
5570
+ body: "Your basket is locked while checkout completes. Return to checkout to finish or cancel it.",
5568
5571
  // Not retriable: repeating the same edit fails identically until the lock clears,
5569
5572
  // and a "try again" affordance here would teach the fan to hammer a button that
5570
5573
  // cannot work. The lock lifts on its own or on DAZN's signal, not on a retry.
@@ -7000,6 +7003,16 @@ function CartViewContent({
7000
7003
  useEffect(() => {
7001
7004
  void load();
7002
7005
  }, [load]);
7006
+ useEffect(() => {
7007
+ if (typeof window === "undefined") return;
7008
+ const onPageShow = (event) => {
7009
+ if (!event.persisted) return;
7010
+ setHandingOff(false);
7011
+ void load();
7012
+ };
7013
+ window.addEventListener("pageshow", onPageShow);
7014
+ return () => window.removeEventListener("pageshow", onPageShow);
7015
+ }, [load]);
7003
7016
  async function mutate(sku, action2, optimistic) {
7004
7017
  if (!cart2) return false;
7005
7018
  const snapshot = cart2;
@@ -7103,7 +7116,7 @@ function CartViewContent({
7103
7116
  const locked = cart2.locked !== void 0;
7104
7117
  const itemCount = cart2.items.reduce((n, i) => n + i.qty, 0);
7105
7118
  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." }),
7119
+ locked && /* @__PURE__ */ jsx("p", { role: "status", className: styles$i.lockNotice, children: "Checkout is in progress, so your basket is locked. Return to checkout to finish or cancel it." }),
7107
7120
  /* @__PURE__ */ jsxs("div", { className: styles$i.body, children: [
7108
7121
  /* @__PURE__ */ jsxs("section", { className: styles$i.items, children: [
7109
7122
  /* @__PURE__ */ jsxs("div", { className: styles$i.sectionHeader, children: [
@@ -7124,7 +7137,15 @@ function CartViewContent({
7124
7137
  /* @__PURE__ */ jsx(ShippingInfo, {}),
7125
7138
  /* @__PURE__ */ jsx(OrderSummary, { pricing: cart2.totals, deferred: ["shipping", "tax"] })
7126
7139
  ] }),
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 }) })
7140
+ /* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(
7141
+ Button,
7142
+ {
7143
+ variant: "primary",
7144
+ onClick: () => void handOff(cart2),
7145
+ disabled: handingOff,
7146
+ children: locked ? "Return to checkout" : checkoutLabel
7147
+ }
7148
+ ) })
7128
7149
  ] });
7129
7150
  }
7130
7151
  const CartSheetContext = createContext(null);
@@ -5564,7 +5564,10 @@ 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
+ // Points at the CTA, which returns to the open checkout. The previous wording told
5568
+ // the fan to "finish or cancel checkout" while both of those controls were on DAZN's
5569
+ // page and nothing on this screen could reach it.
5570
+ body: "Your basket is locked while checkout completes. Return to checkout to finish or cancel it.",
5568
5571
  // Not retriable: repeating the same edit fails identically until the lock clears,
5569
5572
  // and a "try again" affordance here would teach the fan to hammer a button that
5570
5573
  // cannot work. The lock lifts on its own or on DAZN's signal, not on a retry.
@@ -7000,6 +7003,16 @@ function CartViewContent({
7000
7003
  useEffect(() => {
7001
7004
  void load();
7002
7005
  }, [load]);
7006
+ useEffect(() => {
7007
+ if (typeof window === "undefined") return;
7008
+ const onPageShow = (event) => {
7009
+ if (!event.persisted) return;
7010
+ setHandingOff(false);
7011
+ void load();
7012
+ };
7013
+ window.addEventListener("pageshow", onPageShow);
7014
+ return () => window.removeEventListener("pageshow", onPageShow);
7015
+ }, [load]);
7003
7016
  async function mutate(sku, action2, optimistic) {
7004
7017
  if (!cart2) return false;
7005
7018
  const snapshot = cart2;
@@ -7103,7 +7116,7 @@ function CartViewContent({
7103
7116
  const locked = cart2.locked !== void 0;
7104
7117
  const itemCount = cart2.items.reduce((n, i) => n + i.qty, 0);
7105
7118
  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." }),
7119
+ locked && /* @__PURE__ */ jsx("p", { role: "status", className: styles$i.lockNotice, children: "Checkout is in progress, so your basket is locked. Return to checkout to finish or cancel it." }),
7107
7120
  /* @__PURE__ */ jsxs("div", { className: styles$i.body, children: [
7108
7121
  /* @__PURE__ */ jsxs("section", { className: styles$i.items, children: [
7109
7122
  /* @__PURE__ */ jsxs("div", { className: styles$i.sectionHeader, children: [
@@ -7124,7 +7137,15 @@ function CartViewContent({
7124
7137
  /* @__PURE__ */ jsx(ShippingInfo, {}),
7125
7138
  /* @__PURE__ */ jsx(OrderSummary, { pricing: cart2.totals, deferred: ["shipping", "tax"] })
7126
7139
  ] }),
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 }) })
7140
+ /* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(
7141
+ Button,
7142
+ {
7143
+ variant: "primary",
7144
+ onClick: () => void handOff(cart2),
7145
+ disabled: handingOff,
7146
+ children: locked ? "Return to checkout" : checkoutLabel
7147
+ }
7148
+ ) })
7128
7149
  ] });
7129
7150
  }
7130
7151
  const CartSheetContext = createContext(null);
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.12.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": {