@nok-integration/storefront-react 0.15.0 → 0.16.1
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 +36 -5
- package/dist/standalone/storefront.mjs +36 -5
- package/dist/standalone/styles.css +17 -0
- package/dist/styles.css +17 -0
- 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
|
@@ -4483,7 +4483,7 @@ function requireCart() {
|
|
|
4483
4483
|
hasRequiredCart = 1;
|
|
4484
4484
|
(function(exports) {
|
|
4485
4485
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4486
|
-
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;
|
|
4487
4487
|
const zod_1 = /* @__PURE__ */ requireZod();
|
|
4488
4488
|
const money_1 = requireMoney();
|
|
4489
4489
|
const ids_1 = requireIds();
|
|
@@ -4546,6 +4546,7 @@ function requireCart() {
|
|
|
4546
4546
|
expires_at: zod_1.z.string().datetime().optional(),
|
|
4547
4547
|
reason: exports.CartLockReason
|
|
4548
4548
|
});
|
|
4549
|
+
exports.HiddenSummaryLine = zod_1.z.enum(["tax", "shipping"]);
|
|
4549
4550
|
exports.Cart = zod_1.z.object({
|
|
4550
4551
|
cart_id: ids_1.CartId,
|
|
4551
4552
|
currency: money_2.Currency,
|
|
@@ -4555,7 +4556,18 @@ function requireCart() {
|
|
|
4555
4556
|
* Absent means "not locked" — deliberately, so this is additive and an existing
|
|
4556
4557
|
* consumer that has never heard of locking is unaffected.
|
|
4557
4558
|
*/
|
|
4558
|
-
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()
|
|
4559
4571
|
});
|
|
4560
4572
|
exports.AddCartItemRequest = zod_1.z.object({
|
|
4561
4573
|
sku: common_1.Sku,
|
|
@@ -5338,12 +5350,19 @@ function ShopLink({ to, children, ...rest }) {
|
|
|
5338
5350
|
}
|
|
5339
5351
|
event.preventDefault();
|
|
5340
5352
|
navigate(to);
|
|
5353
|
+
anchorToTop();
|
|
5341
5354
|
},
|
|
5342
5355
|
...rest,
|
|
5343
5356
|
children
|
|
5344
5357
|
}
|
|
5345
5358
|
);
|
|
5346
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
|
+
}
|
|
5347
5366
|
function ShopImage({
|
|
5348
5367
|
src,
|
|
5349
5368
|
alt,
|
|
@@ -6137,11 +6156,16 @@ const CART_ROWS = [
|
|
|
6137
6156
|
{ label: "Tax", key: "tax" },
|
|
6138
6157
|
{ label: "Total", key: "total" }
|
|
6139
6158
|
];
|
|
6140
|
-
function OrderSummary({
|
|
6159
|
+
function OrderSummary({
|
|
6160
|
+
pricing,
|
|
6161
|
+
deferred = [],
|
|
6162
|
+
hidden = [],
|
|
6163
|
+
rows = CART_ROWS
|
|
6164
|
+
}) {
|
|
6141
6165
|
const { format } = useMoney();
|
|
6142
6166
|
const isDeferred = (key) => deferred.includes(key);
|
|
6143
6167
|
const anyDeferred = deferred.length > 0;
|
|
6144
|
-
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);
|
|
6145
6169
|
return /* @__PURE__ */ jsx("dl", { className: styles$w.summary, children: visible.map(({ label: label2, key }) => {
|
|
6146
6170
|
const pending2 = key !== "total" && isDeferred(key);
|
|
6147
6171
|
return /* @__PURE__ */ jsxs("div", { className: styles$w.row, children: [
|
|
@@ -7345,7 +7369,14 @@ function CartViewContent({
|
|
|
7345
7369
|
) }, item2.sku)) })
|
|
7346
7370
|
] }),
|
|
7347
7371
|
/* @__PURE__ */ jsx(ShippingInfo, {}),
|
|
7348
|
-
/* @__PURE__ */ jsx(
|
|
7372
|
+
/* @__PURE__ */ jsx(
|
|
7373
|
+
OrderSummary,
|
|
7374
|
+
{
|
|
7375
|
+
pricing: cart2.totals,
|
|
7376
|
+
deferred: ["shipping", "tax"],
|
|
7377
|
+
hidden: cart2.hidden_lines
|
|
7378
|
+
}
|
|
7379
|
+
)
|
|
7349
7380
|
] }),
|
|
7350
7381
|
/* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(
|
|
7351
7382
|
Button,
|
|
@@ -4483,7 +4483,7 @@ function requireCart() {
|
|
|
4483
4483
|
hasRequiredCart = 1;
|
|
4484
4484
|
(function(exports) {
|
|
4485
4485
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4486
|
-
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;
|
|
4487
4487
|
const zod_1 = /* @__PURE__ */ requireZod();
|
|
4488
4488
|
const money_1 = requireMoney();
|
|
4489
4489
|
const ids_1 = requireIds();
|
|
@@ -4546,6 +4546,7 @@ function requireCart() {
|
|
|
4546
4546
|
expires_at: zod_1.z.string().datetime().optional(),
|
|
4547
4547
|
reason: exports.CartLockReason
|
|
4548
4548
|
});
|
|
4549
|
+
exports.HiddenSummaryLine = zod_1.z.enum(["tax", "shipping"]);
|
|
4549
4550
|
exports.Cart = zod_1.z.object({
|
|
4550
4551
|
cart_id: ids_1.CartId,
|
|
4551
4552
|
currency: money_2.Currency,
|
|
@@ -4555,7 +4556,18 @@ function requireCart() {
|
|
|
4555
4556
|
* Absent means "not locked" — deliberately, so this is additive and an existing
|
|
4556
4557
|
* consumer that has never heard of locking is unaffected.
|
|
4557
4558
|
*/
|
|
4558
|
-
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()
|
|
4559
4571
|
});
|
|
4560
4572
|
exports.AddCartItemRequest = zod_1.z.object({
|
|
4561
4573
|
sku: common_1.Sku,
|
|
@@ -5338,12 +5350,19 @@ function ShopLink({ to, children, ...rest }) {
|
|
|
5338
5350
|
}
|
|
5339
5351
|
event.preventDefault();
|
|
5340
5352
|
navigate(to);
|
|
5353
|
+
anchorToTop();
|
|
5341
5354
|
},
|
|
5342
5355
|
...rest,
|
|
5343
5356
|
children
|
|
5344
5357
|
}
|
|
5345
5358
|
);
|
|
5346
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
|
+
}
|
|
5347
5366
|
function ShopImage({
|
|
5348
5367
|
src,
|
|
5349
5368
|
alt,
|
|
@@ -6137,11 +6156,16 @@ const CART_ROWS = [
|
|
|
6137
6156
|
{ label: "Tax", key: "tax" },
|
|
6138
6157
|
{ label: "Total", key: "total" }
|
|
6139
6158
|
];
|
|
6140
|
-
function OrderSummary({
|
|
6159
|
+
function OrderSummary({
|
|
6160
|
+
pricing,
|
|
6161
|
+
deferred = [],
|
|
6162
|
+
hidden = [],
|
|
6163
|
+
rows = CART_ROWS
|
|
6164
|
+
}) {
|
|
6141
6165
|
const { format } = useMoney();
|
|
6142
6166
|
const isDeferred = (key) => deferred.includes(key);
|
|
6143
6167
|
const anyDeferred = deferred.length > 0;
|
|
6144
|
-
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);
|
|
6145
6169
|
return /* @__PURE__ */ jsx("dl", { className: styles$w.summary, children: visible.map(({ label: label2, key }) => {
|
|
6146
6170
|
const pending2 = key !== "total" && isDeferred(key);
|
|
6147
6171
|
return /* @__PURE__ */ jsxs("div", { className: styles$w.row, children: [
|
|
@@ -7345,7 +7369,14 @@ function CartViewContent({
|
|
|
7345
7369
|
) }, item2.sku)) })
|
|
7346
7370
|
] }),
|
|
7347
7371
|
/* @__PURE__ */ jsx(ShippingInfo, {}),
|
|
7348
|
-
/* @__PURE__ */ jsx(
|
|
7372
|
+
/* @__PURE__ */ jsx(
|
|
7373
|
+
OrderSummary,
|
|
7374
|
+
{
|
|
7375
|
+
pricing: cart2.totals,
|
|
7376
|
+
deferred: ["shipping", "tax"],
|
|
7377
|
+
hidden: cart2.hidden_lines
|
|
7378
|
+
}
|
|
7379
|
+
)
|
|
7349
7380
|
] }),
|
|
7350
7381
|
/* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(
|
|
7351
7382
|
Button,
|
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
* as CSS custom properties. Mobile-first, 375pt base width, embedded in the DAZN app.
|
|
4
4
|
* Values are display tokens only; money is always server-authoritative.
|
|
5
5
|
*/
|
|
6
|
+
/*
|
|
7
|
+
* THE HOST PROVIDES THE TYPEFACE. There is deliberately no `@font-face` here.
|
|
8
|
+
*
|
|
9
|
+
* The name below is the one inside DAZN's own font files (`name` ID 1 = "DAZN Oscine"),
|
|
10
|
+
* so a host that already serves the face — as DAZN do on their pages — is matched exactly
|
|
11
|
+
* and the mounted components inherit it. Nothing to configure.
|
|
12
|
+
*
|
|
13
|
+
* Two reasons not to ship it in the package. A `url()` here resolves against the
|
|
14
|
+
* CONSUMER's origin, so any path we picked would 404 in every host but the one we guessed;
|
|
15
|
+
* and inlining the two faces as data URIs adds ~120 kB to a bundle that is 67 kB gzipped,
|
|
16
|
+
* which is most of a tripling to deliver something the host almost certainly already has.
|
|
17
|
+
*
|
|
18
|
+
* A host WITHOUT the face falls through to the system stack and renders correctly but not
|
|
19
|
+
* on-brand. If that is ever the situation, the fix belongs in the host, not here.
|
|
20
|
+
*
|
|
21
|
+
* Our own storefront is such a host and serves them from `app/theme.css`.
|
|
22
|
+
*/
|
|
6
23
|
:root {
|
|
7
24
|
/* ── Typeface ─────────────────────────────────────────────────────────── */
|
|
8
25
|
--font-family-base:
|
package/dist/styles.css
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
* as CSS custom properties. Mobile-first, 375pt base width, embedded in the DAZN app.
|
|
4
4
|
* Values are display tokens only; money is always server-authoritative.
|
|
5
5
|
*/
|
|
6
|
+
/*
|
|
7
|
+
* THE HOST PROVIDES THE TYPEFACE. There is deliberately no `@font-face` here.
|
|
8
|
+
*
|
|
9
|
+
* The name below is the one inside DAZN's own font files (`name` ID 1 = "DAZN Oscine"),
|
|
10
|
+
* so a host that already serves the face — as DAZN do on their pages — is matched exactly
|
|
11
|
+
* and the mounted components inherit it. Nothing to configure.
|
|
12
|
+
*
|
|
13
|
+
* Two reasons not to ship it in the package. A `url()` here resolves against the
|
|
14
|
+
* CONSUMER's origin, so any path we picked would 404 in every host but the one we guessed;
|
|
15
|
+
* and inlining the two faces as data URIs adds ~120 kB to a bundle that is 67 kB gzipped,
|
|
16
|
+
* which is most of a tripling to deliver something the host almost certainly already has.
|
|
17
|
+
*
|
|
18
|
+
* A host WITHOUT the face falls through to the system stack and renders correctly but not
|
|
19
|
+
* on-brand. If that is ever the situation, the fix belongs in the host, not here.
|
|
20
|
+
*
|
|
21
|
+
* Our own storefront is such a host and serves them from `app/theme.css`.
|
|
22
|
+
*/
|
|
6
23
|
:root {
|
|
7
24
|
/* ── Typeface ─────────────────────────────────────────────────────────── */
|
|
8
25
|
--font-family-base:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nok-integration/storefront-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
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": {
|