@nok-integration/storefront-react 0.14.0 → 0.16.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 +17 -1
- package/dist/index.mjs +44 -6
- package/dist/standalone/storefront.mjs +44 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1830,6 +1830,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
1830
1830
|
reason: "checkout_handoff";
|
|
1831
1831
|
expires_at?: string | undefined;
|
|
1832
1832
|
} | undefined;
|
|
1833
|
+
hidden_lines?: ("shipping" | "tax")[] | undefined;
|
|
1833
1834
|
}>;
|
|
1834
1835
|
get: () => Promise<{
|
|
1835
1836
|
currency: string;
|
|
@@ -1873,6 +1874,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
1873
1874
|
reason: "checkout_handoff";
|
|
1874
1875
|
expires_at?: string | undefined;
|
|
1875
1876
|
} | undefined;
|
|
1877
|
+
hidden_lines?: ("shipping" | "tax")[] | undefined;
|
|
1876
1878
|
}>;
|
|
1877
1879
|
addItem: (body: AddCartItemRequest) => Promise<{
|
|
1878
1880
|
currency: string;
|
|
@@ -1916,6 +1918,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
1916
1918
|
reason: "checkout_handoff";
|
|
1917
1919
|
expires_at?: string | undefined;
|
|
1918
1920
|
} | undefined;
|
|
1921
|
+
hidden_lines?: ("shipping" | "tax")[] | undefined;
|
|
1919
1922
|
}>;
|
|
1920
1923
|
updateItem: (sku: string, body: UpdateCartItemRequest) => Promise<{
|
|
1921
1924
|
currency: string;
|
|
@@ -1959,6 +1962,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
1959
1962
|
reason: "checkout_handoff";
|
|
1960
1963
|
expires_at?: string | undefined;
|
|
1961
1964
|
} | undefined;
|
|
1965
|
+
hidden_lines?: ("shipping" | "tax")[] | undefined;
|
|
1962
1966
|
}>;
|
|
1963
1967
|
removeItem: (sku: string) => Promise<{
|
|
1964
1968
|
currency: string;
|
|
@@ -2002,6 +2006,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
2002
2006
|
reason: "checkout_handoff";
|
|
2003
2007
|
expires_at?: string | undefined;
|
|
2004
2008
|
} | undefined;
|
|
2009
|
+
hidden_lines?: ("shipping" | "tax")[] | undefined;
|
|
2005
2010
|
}>;
|
|
2006
2011
|
/**
|
|
2007
2012
|
* Hand the cart to DAZN checkout and get the URL to send the fan to.
|
|
@@ -2610,7 +2615,7 @@ export declare interface OrderStatusBadgeProps {
|
|
|
2610
2615
|
* The pricing breakdown. DISPLAY ONLY — every value is server-authoritative; the UI
|
|
2611
2616
|
* never sums or computes anything here.
|
|
2612
2617
|
*/
|
|
2613
|
-
export declare function OrderSummary({ pricing, deferred, rows }: OrderSummaryProps): JSX.Element;
|
|
2618
|
+
export declare function OrderSummary({ pricing, deferred, hidden, rows, }: OrderSummaryProps): JSX.Element;
|
|
2614
2619
|
|
|
2615
2620
|
export declare interface OrderSummaryProps {
|
|
2616
2621
|
pricing: Pricing;
|
|
@@ -2636,6 +2641,17 @@ export declare interface OrderSummaryProps {
|
|
|
2636
2641
|
* delivery is not a total. Subtotal carries the emphasis instead.
|
|
2637
2642
|
*/
|
|
2638
2643
|
deferred?: DeferredLine[];
|
|
2644
|
+
/**
|
|
2645
|
+
* Rows to leave undrawn entirely, as a merchandiser set them in the CMS.
|
|
2646
|
+
*
|
|
2647
|
+
* Different from `deferred`, which still draws the row and says the value is not ours to
|
|
2648
|
+
* state. This removes it: no label, no value, and no hairline above it, because the rule
|
|
2649
|
+
* that draws the separator is `.row + .row` and a filtered row takes its own with it.
|
|
2650
|
+
*
|
|
2651
|
+
* The figure is untouched in `pricing` either way. Hiding is presentation; a version of
|
|
2652
|
+
* this that zeroed the value would turn a CMS switch into a pricing change.
|
|
2653
|
+
*/
|
|
2654
|
+
hidden?: DeferredLine[];
|
|
2639
2655
|
}
|
|
2640
2656
|
|
|
2641
2657
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -4465,7 +4465,14 @@ function requireIds() {
|
|
|
4465
4465
|
ids.UserId = prefixedId("usr_");
|
|
4466
4466
|
ids.CartId = prefixedId("cart_");
|
|
4467
4467
|
ids.CheckoutId = prefixedId("chk_");
|
|
4468
|
-
ids.OrderRef =
|
|
4468
|
+
ids.OrderRef = zod_1.z.string().regex(
|
|
4469
|
+
// Deliberately unbounded in length. DAZN said six digits "for now", and a schema that
|
|
4470
|
+
// pinned six would reject the first order they place after widening the column — a
|
|
4471
|
+
// 400 at intake, which is an order we never receive and never fulfil. The rule we can
|
|
4472
|
+
// hold them to is "digits"; the count is theirs to change.
|
|
4473
|
+
/^(?:ord_[A-Za-z0-9._-]+|\d+)$/,
|
|
4474
|
+
"must be an 'ord_…' identifier or a numeric order reference"
|
|
4475
|
+
).brand();
|
|
4469
4476
|
ids.EventId = prefixedId("evt_");
|
|
4470
4477
|
ids.RequestId = prefixedId("req_");
|
|
4471
4478
|
return ids;
|
|
@@ -4476,7 +4483,7 @@ function requireCart() {
|
|
|
4476
4483
|
hasRequiredCart = 1;
|
|
4477
4484
|
(function(exports) {
|
|
4478
4485
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4479
|
-
exports.PartnerCart = exports.PartnerCartItem = exports.CartHandoffResponse = exports.UpdateCartItemRequest = exports.AddCartItemRequest = exports.Cart = exports.CartLock = exports.CartLockReason = exports.CartTotals = exports.CartItem = void 0;
|
|
4486
|
+
exports.PartnerCart = exports.PartnerCartItem = exports.CartHandoffResponse = exports.UpdateCartItemRequest = exports.AddCartItemRequest = exports.Cart = exports.HiddenSummaryLine = exports.CartLock = exports.CartLockReason = exports.CartTotals = exports.CartItem = void 0;
|
|
4480
4487
|
const zod_1 = /* @__PURE__ */ requireZod();
|
|
4481
4488
|
const money_1 = requireMoney();
|
|
4482
4489
|
const ids_1 = requireIds();
|
|
@@ -4539,6 +4546,7 @@ function requireCart() {
|
|
|
4539
4546
|
expires_at: zod_1.z.string().datetime().optional(),
|
|
4540
4547
|
reason: exports.CartLockReason
|
|
4541
4548
|
});
|
|
4549
|
+
exports.HiddenSummaryLine = zod_1.z.enum(["tax", "shipping"]);
|
|
4542
4550
|
exports.Cart = zod_1.z.object({
|
|
4543
4551
|
cart_id: ids_1.CartId,
|
|
4544
4552
|
currency: money_2.Currency,
|
|
@@ -4548,7 +4556,18 @@ function requireCart() {
|
|
|
4548
4556
|
* Absent means "not locked" — deliberately, so this is additive and an existing
|
|
4549
4557
|
* consumer that has never heard of locking is unaffected.
|
|
4550
4558
|
*/
|
|
4551
|
-
locked: exports.CartLock.optional()
|
|
4559
|
+
locked: exports.CartLock.optional(),
|
|
4560
|
+
/**
|
|
4561
|
+
* Summary rows to leave undrawn, resolved server-side from the CMS setting.
|
|
4562
|
+
*
|
|
4563
|
+
* Sent already decided rather than as the raw setting, so the rule lives in one place
|
|
4564
|
+
* and a consumer never has to reimplement it. That also means the day this becomes a
|
|
4565
|
+
* per-market decision, nothing on the wire or in any consumer changes.
|
|
4566
|
+
*
|
|
4567
|
+
* Absent and empty both mean "draw everything", so a consumer that has never heard of
|
|
4568
|
+
* this field behaves exactly as before.
|
|
4569
|
+
*/
|
|
4570
|
+
hidden_lines: zod_1.z.array(exports.HiddenSummaryLine).optional()
|
|
4552
4571
|
});
|
|
4553
4572
|
exports.AddCartItemRequest = zod_1.z.object({
|
|
4554
4573
|
sku: common_1.Sku,
|
|
@@ -5331,12 +5350,19 @@ function ShopLink({ to, children, ...rest }) {
|
|
|
5331
5350
|
}
|
|
5332
5351
|
event.preventDefault();
|
|
5333
5352
|
navigate(to);
|
|
5353
|
+
anchorToTop();
|
|
5334
5354
|
},
|
|
5335
5355
|
...rest,
|
|
5336
5356
|
children
|
|
5337
5357
|
}
|
|
5338
5358
|
);
|
|
5339
5359
|
}
|
|
5360
|
+
function anchorToTop() {
|
|
5361
|
+
if (typeof window === "undefined") return;
|
|
5362
|
+
const top = () => window.scrollTo(0, 0);
|
|
5363
|
+
top();
|
|
5364
|
+
if (typeof window.requestAnimationFrame === "function") window.requestAnimationFrame(top);
|
|
5365
|
+
}
|
|
5340
5366
|
function ShopImage({
|
|
5341
5367
|
src,
|
|
5342
5368
|
alt,
|
|
@@ -6130,11 +6156,16 @@ const CART_ROWS = [
|
|
|
6130
6156
|
{ label: "Tax", key: "tax" },
|
|
6131
6157
|
{ label: "Total", key: "total" }
|
|
6132
6158
|
];
|
|
6133
|
-
function OrderSummary({
|
|
6159
|
+
function OrderSummary({
|
|
6160
|
+
pricing,
|
|
6161
|
+
deferred = [],
|
|
6162
|
+
hidden = [],
|
|
6163
|
+
rows = CART_ROWS
|
|
6164
|
+
}) {
|
|
6134
6165
|
const { format } = useMoney();
|
|
6135
6166
|
const isDeferred = (key) => deferred.includes(key);
|
|
6136
6167
|
const anyDeferred = deferred.length > 0;
|
|
6137
|
-
const visible = rows.filter((row2) => row2.key !== "total" || !anyDeferred);
|
|
6168
|
+
const visible = rows.filter((row2) => !hidden.includes(row2.key)).filter((row2) => row2.key !== "total" || !anyDeferred);
|
|
6138
6169
|
return /* @__PURE__ */ jsx("dl", { className: styles$w.summary, children: visible.map(({ label: label2, key }) => {
|
|
6139
6170
|
const pending2 = key !== "total" && isDeferred(key);
|
|
6140
6171
|
return /* @__PURE__ */ jsxs("div", { className: styles$w.row, children: [
|
|
@@ -7338,7 +7369,14 @@ function CartViewContent({
|
|
|
7338
7369
|
) }, item2.sku)) })
|
|
7339
7370
|
] }),
|
|
7340
7371
|
/* @__PURE__ */ jsx(ShippingInfo, {}),
|
|
7341
|
-
/* @__PURE__ */ jsx(
|
|
7372
|
+
/* @__PURE__ */ jsx(
|
|
7373
|
+
OrderSummary,
|
|
7374
|
+
{
|
|
7375
|
+
pricing: cart2.totals,
|
|
7376
|
+
deferred: ["shipping", "tax"],
|
|
7377
|
+
hidden: cart2.hidden_lines
|
|
7378
|
+
}
|
|
7379
|
+
)
|
|
7342
7380
|
] }),
|
|
7343
7381
|
/* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(
|
|
7344
7382
|
Button,
|
|
@@ -4465,7 +4465,14 @@ function requireIds() {
|
|
|
4465
4465
|
ids.UserId = prefixedId("usr_");
|
|
4466
4466
|
ids.CartId = prefixedId("cart_");
|
|
4467
4467
|
ids.CheckoutId = prefixedId("chk_");
|
|
4468
|
-
ids.OrderRef =
|
|
4468
|
+
ids.OrderRef = zod_1.z.string().regex(
|
|
4469
|
+
// Deliberately unbounded in length. DAZN said six digits "for now", and a schema that
|
|
4470
|
+
// pinned six would reject the first order they place after widening the column — a
|
|
4471
|
+
// 400 at intake, which is an order we never receive and never fulfil. The rule we can
|
|
4472
|
+
// hold them to is "digits"; the count is theirs to change.
|
|
4473
|
+
/^(?:ord_[A-Za-z0-9._-]+|\d+)$/,
|
|
4474
|
+
"must be an 'ord_…' identifier or a numeric order reference"
|
|
4475
|
+
).brand();
|
|
4469
4476
|
ids.EventId = prefixedId("evt_");
|
|
4470
4477
|
ids.RequestId = prefixedId("req_");
|
|
4471
4478
|
return ids;
|
|
@@ -4476,7 +4483,7 @@ function requireCart() {
|
|
|
4476
4483
|
hasRequiredCart = 1;
|
|
4477
4484
|
(function(exports) {
|
|
4478
4485
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4479
|
-
exports.PartnerCart = exports.PartnerCartItem = exports.CartHandoffResponse = exports.UpdateCartItemRequest = exports.AddCartItemRequest = exports.Cart = exports.CartLock = exports.CartLockReason = exports.CartTotals = exports.CartItem = void 0;
|
|
4486
|
+
exports.PartnerCart = exports.PartnerCartItem = exports.CartHandoffResponse = exports.UpdateCartItemRequest = exports.AddCartItemRequest = exports.Cart = exports.HiddenSummaryLine = exports.CartLock = exports.CartLockReason = exports.CartTotals = exports.CartItem = void 0;
|
|
4480
4487
|
const zod_1 = /* @__PURE__ */ requireZod();
|
|
4481
4488
|
const money_1 = requireMoney();
|
|
4482
4489
|
const ids_1 = requireIds();
|
|
@@ -4539,6 +4546,7 @@ function requireCart() {
|
|
|
4539
4546
|
expires_at: zod_1.z.string().datetime().optional(),
|
|
4540
4547
|
reason: exports.CartLockReason
|
|
4541
4548
|
});
|
|
4549
|
+
exports.HiddenSummaryLine = zod_1.z.enum(["tax", "shipping"]);
|
|
4542
4550
|
exports.Cart = zod_1.z.object({
|
|
4543
4551
|
cart_id: ids_1.CartId,
|
|
4544
4552
|
currency: money_2.Currency,
|
|
@@ -4548,7 +4556,18 @@ function requireCart() {
|
|
|
4548
4556
|
* Absent means "not locked" — deliberately, so this is additive and an existing
|
|
4549
4557
|
* consumer that has never heard of locking is unaffected.
|
|
4550
4558
|
*/
|
|
4551
|
-
locked: exports.CartLock.optional()
|
|
4559
|
+
locked: exports.CartLock.optional(),
|
|
4560
|
+
/**
|
|
4561
|
+
* Summary rows to leave undrawn, resolved server-side from the CMS setting.
|
|
4562
|
+
*
|
|
4563
|
+
* Sent already decided rather than as the raw setting, so the rule lives in one place
|
|
4564
|
+
* and a consumer never has to reimplement it. That also means the day this becomes a
|
|
4565
|
+
* per-market decision, nothing on the wire or in any consumer changes.
|
|
4566
|
+
*
|
|
4567
|
+
* Absent and empty both mean "draw everything", so a consumer that has never heard of
|
|
4568
|
+
* this field behaves exactly as before.
|
|
4569
|
+
*/
|
|
4570
|
+
hidden_lines: zod_1.z.array(exports.HiddenSummaryLine).optional()
|
|
4552
4571
|
});
|
|
4553
4572
|
exports.AddCartItemRequest = zod_1.z.object({
|
|
4554
4573
|
sku: common_1.Sku,
|
|
@@ -5331,12 +5350,19 @@ function ShopLink({ to, children, ...rest }) {
|
|
|
5331
5350
|
}
|
|
5332
5351
|
event.preventDefault();
|
|
5333
5352
|
navigate(to);
|
|
5353
|
+
anchorToTop();
|
|
5334
5354
|
},
|
|
5335
5355
|
...rest,
|
|
5336
5356
|
children
|
|
5337
5357
|
}
|
|
5338
5358
|
);
|
|
5339
5359
|
}
|
|
5360
|
+
function anchorToTop() {
|
|
5361
|
+
if (typeof window === "undefined") return;
|
|
5362
|
+
const top = () => window.scrollTo(0, 0);
|
|
5363
|
+
top();
|
|
5364
|
+
if (typeof window.requestAnimationFrame === "function") window.requestAnimationFrame(top);
|
|
5365
|
+
}
|
|
5340
5366
|
function ShopImage({
|
|
5341
5367
|
src,
|
|
5342
5368
|
alt,
|
|
@@ -6130,11 +6156,16 @@ const CART_ROWS = [
|
|
|
6130
6156
|
{ label: "Tax", key: "tax" },
|
|
6131
6157
|
{ label: "Total", key: "total" }
|
|
6132
6158
|
];
|
|
6133
|
-
function OrderSummary({
|
|
6159
|
+
function OrderSummary({
|
|
6160
|
+
pricing,
|
|
6161
|
+
deferred = [],
|
|
6162
|
+
hidden = [],
|
|
6163
|
+
rows = CART_ROWS
|
|
6164
|
+
}) {
|
|
6134
6165
|
const { format } = useMoney();
|
|
6135
6166
|
const isDeferred = (key) => deferred.includes(key);
|
|
6136
6167
|
const anyDeferred = deferred.length > 0;
|
|
6137
|
-
const visible = rows.filter((row2) => row2.key !== "total" || !anyDeferred);
|
|
6168
|
+
const visible = rows.filter((row2) => !hidden.includes(row2.key)).filter((row2) => row2.key !== "total" || !anyDeferred);
|
|
6138
6169
|
return /* @__PURE__ */ jsx("dl", { className: styles$w.summary, children: visible.map(({ label: label2, key }) => {
|
|
6139
6170
|
const pending2 = key !== "total" && isDeferred(key);
|
|
6140
6171
|
return /* @__PURE__ */ jsxs("div", { className: styles$w.row, children: [
|
|
@@ -7338,7 +7369,14 @@ function CartViewContent({
|
|
|
7338
7369
|
) }, item2.sku)) })
|
|
7339
7370
|
] }),
|
|
7340
7371
|
/* @__PURE__ */ jsx(ShippingInfo, {}),
|
|
7341
|
-
/* @__PURE__ */ jsx(
|
|
7372
|
+
/* @__PURE__ */ jsx(
|
|
7373
|
+
OrderSummary,
|
|
7374
|
+
{
|
|
7375
|
+
pricing: cart2.totals,
|
|
7376
|
+
deferred: ["shipping", "tax"],
|
|
7377
|
+
hidden: cart2.hidden_lines
|
|
7378
|
+
}
|
|
7379
|
+
)
|
|
7342
7380
|
] }),
|
|
7343
7381
|
/* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(
|
|
7344
7382
|
Button,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nok-integration/storefront-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.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": {
|