@nok-integration/storefront-react 0.19.30 → 0.19.31

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
@@ -4341,6 +4341,15 @@ export declare interface OrderTrackingViewProps {
4341
4341
  * "Start a return" row is there for a fan whether you route it or not.
4342
4342
  */
4343
4343
  onStartReturn?: () => void;
4344
+ /**
4345
+ * Open an EXISTING return's progress on a route of your own.
4346
+ *
4347
+ * Optional, and optional in the way every handler here is: it customises where the row
4348
+ * goes, it does not decide whether the row is drawn. The rows follow `order.returns`
4349
+ * from the engine and nothing else. Omit this and the return opens in place, exactly as
4350
+ * starting one does.
4351
+ */
4352
+ onOpenReturn?: (returnRef: string) => void;
4344
4353
  /**
4345
4354
  * Called once the fan has confirmed a cancellation and the engine has accepted it,
4346
4355
  * with the order as it now stands. The screen redraws itself either way; this is for a
package/dist/index.mjs CHANGED
@@ -7564,11 +7564,14 @@ function ChevronRight$1() {
7564
7564
  });
7565
7565
  }
7566
7566
  function OrderTrackingView(props) {
7567
- const [returning, setReturning] = useState(false);
7568
- if (returning) {
7567
+ const [flow, setFlow] = useState(null);
7568
+ if (flow !== null) {
7569
7569
  return jsx(ReturnFlowView, {
7570
7570
  orderRef: props.orderRef,
7571
- onDone: () => setReturning(false)
7571
+ ...flow ? {
7572
+ returnRef: flow
7573
+ } : {},
7574
+ onDone: () => setFlow(null)
7572
7575
  });
7573
7576
  }
7574
7577
  return jsx(ShopSurface, {
@@ -7576,11 +7579,12 @@ function OrderTrackingView(props) {
7576
7579
  fill: true,
7577
7580
  children: jsx(OrderTrackingContent, {
7578
7581
  ...props,
7579
- onStartReturn: props.onStartReturn ?? (() => setReturning(true))
7582
+ onStartReturn: props.onStartReturn ?? (() => setFlow("")),
7583
+ onOpenReturn: props.onOpenReturn ?? ((returnRef) => setFlow(returnRef))
7580
7584
  })
7581
7585
  });
7582
7586
  }
7583
- function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onContactSupport, onCancelled, onReorder }) {
7587
+ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onOpenReturn, onContactSupport, onCancelled, onReorder }) {
7584
7588
  const t = useT();
7585
7589
  const { api } = useShop();
7586
7590
  const locale = useLocale(localeProp);
@@ -7757,6 +7761,9 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onC
7757
7761
  ...onStartReturn ? {
7758
7762
  onStartReturn
7759
7763
  } : {},
7764
+ ...onOpenReturn ? {
7765
+ onOpenReturn
7766
+ } : {},
7760
7767
  ...onContactSupport ? {
7761
7768
  onContactSupport
7762
7769
  } : {}
@@ -7793,9 +7800,10 @@ function placedOn(iso, locale) {
7793
7800
  }).format(d);
7794
7801
  return `${day} ${month}, ${d.getUTCFullYear()}`;
7795
7802
  }
7796
- function NeedHelp({ order, onStartReturn, onContactSupport }) {
7803
+ function NeedHelp({ order, onStartReturn, onOpenReturn, onContactSupport }) {
7797
7804
  const emit = useShopEvent();
7798
7805
  if (order.status !== "delivered") return null;
7806
+ const returns = order.returns ?? [];
7799
7807
  return jsxs("section", {
7800
7808
  className: styles$y.help,
7801
7809
  "aria-labelledby": "order-help",
@@ -7805,7 +7813,10 @@ function NeedHelp({ order, onStartReturn, onContactSupport }) {
7805
7813
  children: "Need help?"
7806
7814
  }), jsxs("div", {
7807
7815
  className: styles$y.helpRows,
7808
- children: [order.can_return && onStartReturn && jsx(HelpRow, {
7816
+ children: [returns.map((ret) => jsx(HelpRow, {
7817
+ label: returns.length > 1 ? `Track return ${ret.return_ref}` : "Track your return",
7818
+ onClick: () => onOpenReturn?.(ret.return_ref)
7819
+ }, ret.return_ref)), order.can_return && onStartReturn && jsx(HelpRow, {
7809
7820
  label: "Start a return",
7810
7821
  onClick: onStartReturn
7811
7822
  }), jsx(HelpRow, {
@@ -11573,4 +11584,4 @@ export {
11573
11584
  useToast,
11574
11585
  variantLabel
11575
11586
  };
11576
-
11587
+ //# sourceMappingURL=index.mjs.map
@@ -7564,11 +7564,14 @@ function ChevronRight$1() {
7564
7564
  });
7565
7565
  }
7566
7566
  function OrderTrackingView(props) {
7567
- const [returning, setReturning] = useState(false);
7568
- if (returning) {
7567
+ const [flow, setFlow] = useState(null);
7568
+ if (flow !== null) {
7569
7569
  return jsx(ReturnFlowView, {
7570
7570
  orderRef: props.orderRef,
7571
- onDone: () => setReturning(false)
7571
+ ...flow ? {
7572
+ returnRef: flow
7573
+ } : {},
7574
+ onDone: () => setFlow(null)
7572
7575
  });
7573
7576
  }
7574
7577
  return jsx(ShopSurface, {
@@ -7576,11 +7579,12 @@ function OrderTrackingView(props) {
7576
7579
  fill: true,
7577
7580
  children: jsx(OrderTrackingContent, {
7578
7581
  ...props,
7579
- onStartReturn: props.onStartReturn ?? (() => setReturning(true))
7582
+ onStartReturn: props.onStartReturn ?? (() => setFlow("")),
7583
+ onOpenReturn: props.onOpenReturn ?? ((returnRef) => setFlow(returnRef))
7580
7584
  })
7581
7585
  });
7582
7586
  }
7583
- function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onContactSupport, onCancelled, onReorder }) {
7587
+ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onOpenReturn, onContactSupport, onCancelled, onReorder }) {
7584
7588
  const t = useT();
7585
7589
  const { api } = useShop();
7586
7590
  const locale = useLocale(localeProp);
@@ -7757,6 +7761,9 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onC
7757
7761
  ...onStartReturn ? {
7758
7762
  onStartReturn
7759
7763
  } : {},
7764
+ ...onOpenReturn ? {
7765
+ onOpenReturn
7766
+ } : {},
7760
7767
  ...onContactSupport ? {
7761
7768
  onContactSupport
7762
7769
  } : {}
@@ -7793,9 +7800,10 @@ function placedOn(iso, locale) {
7793
7800
  }).format(d);
7794
7801
  return `${day} ${month}, ${d.getUTCFullYear()}`;
7795
7802
  }
7796
- function NeedHelp({ order, onStartReturn, onContactSupport }) {
7803
+ function NeedHelp({ order, onStartReturn, onOpenReturn, onContactSupport }) {
7797
7804
  const emit = useShopEvent();
7798
7805
  if (order.status !== "delivered") return null;
7806
+ const returns = order.returns ?? [];
7799
7807
  return jsxs("section", {
7800
7808
  className: styles$y.help,
7801
7809
  "aria-labelledby": "order-help",
@@ -7805,7 +7813,10 @@ function NeedHelp({ order, onStartReturn, onContactSupport }) {
7805
7813
  children: "Need help?"
7806
7814
  }), jsxs("div", {
7807
7815
  className: styles$y.helpRows,
7808
- children: [order.can_return && onStartReturn && jsx(HelpRow, {
7816
+ children: [returns.map((ret) => jsx(HelpRow, {
7817
+ label: returns.length > 1 ? `Track return ${ret.return_ref}` : "Track your return",
7818
+ onClick: () => onOpenReturn?.(ret.return_ref)
7819
+ }, ret.return_ref)), order.can_return && onStartReturn && jsx(HelpRow, {
7809
7820
  label: "Start a return",
7810
7821
  onClick: onStartReturn
7811
7822
  }), jsx(HelpRow, {
@@ -11573,4 +11584,4 @@ export {
11573
11584
  useToast,
11574
11585
  variantLabel
11575
11586
  };
11576
-
11587
+ //# sourceMappingURL=storefront.mjs.map
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@nok-integration/storefront-react",
3
- "version": "0.19.30",
3
+ "version": "0.19.31",
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
+ "publishConfig": {
7
+ "access": "public",
8
+ "registry": "https://registry.npmjs.org/"
9
+ },
6
10
  "type": "module",
7
11
  "main": "./dist/index.mjs",
8
- "module": "./dist/index.mjs",
9
12
  "types": "./dist/index.d.ts",
10
13
  "exports": {
11
14
  ".": {
@@ -20,18 +23,34 @@
20
23
  "dist",
21
24
  "!dist/**/*.map"
22
25
  ],
23
- "sideEffects": [
24
- "*.css"
25
- ],
26
+ "scripts": {
27
+ "build": "pnpm build:package && pnpm build:standalone",
28
+ "build:package": "vite build",
29
+ "build:standalone": "BUILD_TARGET=standalone vite build",
30
+ "typecheck": "tsc --noEmit",
31
+ "build:partner": "PARTNER_DROP=1 pnpm build && pnpm pack"
32
+ },
26
33
  "peerDependencies": {
27
34
  "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
28
35
  "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
29
36
  },
37
+ "devDependencies": {
38
+ "@microsoft/api-extractor": "^7.58.12",
39
+ "@raqmix/contracts": "^2.0.0",
40
+ "@types/react": "^19.1.0",
41
+ "@types/react-dom": "^19.1.0",
42
+ "@vitejs/plugin-react": "^4.3.4",
43
+ "esbuild": "^0.28.1",
44
+ "terser": "^5.50.0",
45
+ "typescript": "^5.7.3",
46
+ "vite": "^7.0.0",
47
+ "vite-plugin-dts": "^5.0.3"
48
+ },
49
+ "module": "./dist/index.mjs",
50
+ "sideEffects": [
51
+ "*.css"
52
+ ],
30
53
  "dependencies": {
31
54
  "zod": "^3.24.1"
32
- },
33
- "publishConfig": {
34
- "access": "public",
35
- "registry": "https://registry.npmjs.org/"
36
55
  }
37
56
  }