@nok-integration/storefront-react 0.22.4 → 0.24.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 +49 -18
- package/dist/index.mjs +47 -32
- package/dist/standalone/storefront.mjs +47 -32
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3014,6 +3014,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
3014
3014
|
returned_qty?: number | undefined;
|
|
3015
3015
|
}[];
|
|
3016
3016
|
headline: string;
|
|
3017
|
+
order_ref: string;
|
|
3017
3018
|
totals: {
|
|
3018
3019
|
shipping: {
|
|
3019
3020
|
amount: number;
|
|
@@ -3036,7 +3037,6 @@ declare function createClient(options: ClientOptions): {
|
|
|
3036
3037
|
currency: string;
|
|
3037
3038
|
} | undefined;
|
|
3038
3039
|
};
|
|
3039
|
-
order_ref: string;
|
|
3040
3040
|
placed_at: string;
|
|
3041
3041
|
ship_to: {
|
|
3042
3042
|
country: string;
|
|
@@ -3111,6 +3111,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
3111
3111
|
returned_qty?: number | undefined;
|
|
3112
3112
|
}[];
|
|
3113
3113
|
headline: string;
|
|
3114
|
+
order_ref: string;
|
|
3114
3115
|
totals: {
|
|
3115
3116
|
shipping: {
|
|
3116
3117
|
amount: number;
|
|
@@ -3133,7 +3134,6 @@ declare function createClient(options: ClientOptions): {
|
|
|
3133
3134
|
currency: string;
|
|
3134
3135
|
} | undefined;
|
|
3135
3136
|
};
|
|
3136
|
-
order_ref: string;
|
|
3137
3137
|
placed_at: string;
|
|
3138
3138
|
ship_to: {
|
|
3139
3139
|
country: string;
|
|
@@ -3266,13 +3266,13 @@ declare function createClient(options: ClientOptions): {
|
|
|
3266
3266
|
}>;
|
|
3267
3267
|
};
|
|
3268
3268
|
vip: {
|
|
3269
|
-
resolve: (
|
|
3269
|
+
resolve: (locator: string | VipInviteResolveRequest, query?: CartMarketQuery) => Promise<{
|
|
3270
3270
|
items: {
|
|
3271
3271
|
product_sku: string;
|
|
3272
3272
|
quantity: number;
|
|
3273
3273
|
}[];
|
|
3274
|
-
state: "active";
|
|
3275
3274
|
invite_ref: string;
|
|
3275
|
+
state: "active";
|
|
3276
3276
|
recipient_name: string;
|
|
3277
3277
|
personal_message: string | null;
|
|
3278
3278
|
delivery_rule: "both_free" | "standard_free" | "both_paid";
|
|
@@ -3290,6 +3290,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
3290
3290
|
opens_at: string;
|
|
3291
3291
|
} | {
|
|
3292
3292
|
state: "claimed";
|
|
3293
|
+
order_ref?: string | undefined;
|
|
3293
3294
|
} | {
|
|
3294
3295
|
state: "expired";
|
|
3295
3296
|
} | {
|
|
@@ -4296,6 +4297,7 @@ declare const OrderDetail: z.ZodObject<{
|
|
|
4296
4297
|
attributes?: Record<string, string> | undefined;
|
|
4297
4298
|
returned_qty?: number | undefined;
|
|
4298
4299
|
}[];
|
|
4300
|
+
order_ref: string & z.BRAND<"OrderRef">;
|
|
4299
4301
|
totals: {
|
|
4300
4302
|
shipping: {
|
|
4301
4303
|
amount: number;
|
|
@@ -4318,7 +4320,6 @@ declare const OrderDetail: z.ZodObject<{
|
|
|
4318
4320
|
currency: string;
|
|
4319
4321
|
} | undefined;
|
|
4320
4322
|
};
|
|
4321
|
-
order_ref: string & z.BRAND<"OrderRef">;
|
|
4322
4323
|
placed_at: string;
|
|
4323
4324
|
ship_to: {
|
|
4324
4325
|
country: string;
|
|
@@ -4386,6 +4387,7 @@ declare const OrderDetail: z.ZodObject<{
|
|
|
4386
4387
|
attributes?: Record<string, string> | undefined;
|
|
4387
4388
|
returned_qty?: number | undefined;
|
|
4388
4389
|
}[];
|
|
4390
|
+
order_ref: string;
|
|
4389
4391
|
totals: {
|
|
4390
4392
|
shipping: {
|
|
4391
4393
|
amount: number;
|
|
@@ -4408,7 +4410,6 @@ declare const OrderDetail: z.ZodObject<{
|
|
|
4408
4410
|
currency: string;
|
|
4409
4411
|
} | undefined;
|
|
4410
4412
|
};
|
|
4411
|
-
order_ref: string;
|
|
4412
4413
|
placed_at: string;
|
|
4413
4414
|
ship_to: {
|
|
4414
4415
|
country: string;
|
|
@@ -5897,9 +5898,6 @@ export declare type ShopEvent = {
|
|
|
5897
5898
|
| {
|
|
5898
5899
|
type: 'support_requested';
|
|
5899
5900
|
orderRef: string;
|
|
5900
|
-
} | {
|
|
5901
|
-
type: 'help_requested';
|
|
5902
|
-
inviteRef: string;
|
|
5903
5901
|
}
|
|
5904
5902
|
/**
|
|
5905
5903
|
* The fan confirmed a cancellation and the engine accepted it.
|
|
@@ -6169,7 +6167,7 @@ export declare interface ShopMenuSheetProps {
|
|
|
6169
6167
|
* implementation detail — see the versioning policy in the component SDK specification.
|
|
6170
6168
|
*/
|
|
6171
6169
|
/** A storefront-relative identifier. NOT a URL expected to resolve on the host. */
|
|
6172
|
-
export declare type ShopRoute = '/' | `/category/${string}` | `/product/${string}` | '/cart'
|
|
6170
|
+
export declare type ShopRoute = '/' | `/category/${string}` | `/product/${string}` | '/cart' | `/vip/${string}`;
|
|
6173
6171
|
|
|
6174
6172
|
/**
|
|
6175
6173
|
* Request: the shopping session id and the one-time code, exactly as they arrive on the
|
|
@@ -6824,10 +6822,10 @@ export declare interface VariantSelectorProps {
|
|
|
6824
6822
|
labelAttribute?: string;
|
|
6825
6823
|
}
|
|
6826
6824
|
|
|
6827
|
-
declare const VipCartItemRequest: z.ZodObject<{
|
|
6828
|
-
token: z.ZodString;
|
|
6825
|
+
declare const VipCartItemRequest: z.ZodUnion<[z.ZodObject<{
|
|
6829
6826
|
sku: z.ZodString;
|
|
6830
6827
|
qty: z.ZodNumber;
|
|
6828
|
+
token: z.ZodString;
|
|
6831
6829
|
}, "strict", z.ZodTypeAny, {
|
|
6832
6830
|
sku: string;
|
|
6833
6831
|
token: string;
|
|
@@ -6836,7 +6834,19 @@ declare const VipCartItemRequest: z.ZodObject<{
|
|
|
6836
6834
|
sku: string;
|
|
6837
6835
|
token: string;
|
|
6838
6836
|
qty: number;
|
|
6839
|
-
}
|
|
6837
|
+
}>, z.ZodObject<{
|
|
6838
|
+
sku: z.ZodString;
|
|
6839
|
+
qty: z.ZodNumber;
|
|
6840
|
+
invite_ref: z.ZodBranded<z.ZodString, "VipInviteRef">;
|
|
6841
|
+
}, "strict", z.ZodTypeAny, {
|
|
6842
|
+
sku: string;
|
|
6843
|
+
invite_ref: string & z.BRAND<"VipInviteRef">;
|
|
6844
|
+
qty: number;
|
|
6845
|
+
}, {
|
|
6846
|
+
sku: string;
|
|
6847
|
+
invite_ref: string;
|
|
6848
|
+
qty: number;
|
|
6849
|
+
}>]>;
|
|
6840
6850
|
|
|
6841
6851
|
declare type VipCartItemRequest = z.infer<typeof VipCartItemRequest>;
|
|
6842
6852
|
|
|
@@ -6872,6 +6882,22 @@ export declare interface VipHeroProps {
|
|
|
6872
6882
|
onContinue: () => void;
|
|
6873
6883
|
}
|
|
6874
6884
|
|
|
6885
|
+
declare const VipInviteResolveRequest: z.ZodUnion<[z.ZodObject<{
|
|
6886
|
+
token: z.ZodString;
|
|
6887
|
+
}, "strict", z.ZodTypeAny, {
|
|
6888
|
+
token: string;
|
|
6889
|
+
}, {
|
|
6890
|
+
token: string;
|
|
6891
|
+
}>, z.ZodObject<{
|
|
6892
|
+
invite_ref: z.ZodBranded<z.ZodString, "VipInviteRef">;
|
|
6893
|
+
}, "strict", z.ZodTypeAny, {
|
|
6894
|
+
invite_ref: string & z.BRAND<"VipInviteRef">;
|
|
6895
|
+
}, {
|
|
6896
|
+
invite_ref: string;
|
|
6897
|
+
}>]>;
|
|
6898
|
+
|
|
6899
|
+
declare type VipInviteResolveRequest = z.infer<typeof VipInviteResolveRequest>;
|
|
6900
|
+
|
|
6875
6901
|
export declare type VipInviteUnavailableState = Exclude<VipInviteView['state'], 'active'>;
|
|
6876
6902
|
|
|
6877
6903
|
declare const VipInviteView: z.ZodDiscriminatedUnion<"state", [z.ZodObject<{
|
|
@@ -6914,8 +6940,8 @@ declare const VipInviteView: z.ZodDiscriminatedUnion<"state", [z.ZodObject<{
|
|
|
6914
6940
|
desktop_video?: string | null | undefined;
|
|
6915
6941
|
}>>>;
|
|
6916
6942
|
}, "strip", z.ZodTypeAny, {
|
|
6917
|
-
state: "active";
|
|
6918
6943
|
invite_ref: string & z.BRAND<"VipInviteRef">;
|
|
6944
|
+
state: "active";
|
|
6919
6945
|
recipient_name: string;
|
|
6920
6946
|
personal_message: string | null;
|
|
6921
6947
|
delivery_rule: "both_free" | "standard_free" | "both_paid";
|
|
@@ -6933,8 +6959,8 @@ declare const VipInviteView: z.ZodDiscriminatedUnion<"state", [z.ZodObject<{
|
|
|
6933
6959
|
desktop_video?: string | null | undefined;
|
|
6934
6960
|
} | null | undefined;
|
|
6935
6961
|
}, {
|
|
6936
|
-
state: "active";
|
|
6937
6962
|
invite_ref: string;
|
|
6963
|
+
state: "active";
|
|
6938
6964
|
recipient_name: string;
|
|
6939
6965
|
personal_message: string | null;
|
|
6940
6966
|
delivery_rule: "both_free" | "standard_free" | "both_paid";
|
|
@@ -6962,10 +6988,13 @@ declare const VipInviteView: z.ZodDiscriminatedUnion<"state", [z.ZodObject<{
|
|
|
6962
6988
|
opens_at: string;
|
|
6963
6989
|
}>, z.ZodObject<{
|
|
6964
6990
|
state: z.ZodLiteral<"claimed">;
|
|
6991
|
+
order_ref: z.ZodOptional<z.ZodBranded<z.ZodString, "OrderRef">>;
|
|
6965
6992
|
}, "strip", z.ZodTypeAny, {
|
|
6966
6993
|
state: "claimed";
|
|
6994
|
+
order_ref?: (string & z.BRAND<"OrderRef">) | undefined;
|
|
6967
6995
|
}, {
|
|
6968
6996
|
state: "claimed";
|
|
6997
|
+
order_ref?: string | undefined;
|
|
6969
6998
|
}>, z.ZodObject<{
|
|
6970
6999
|
state: z.ZodLiteral<"expired">;
|
|
6971
7000
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -6982,14 +7011,16 @@ declare const VipInviteView: z.ZodDiscriminatedUnion<"state", [z.ZodObject<{
|
|
|
6982
7011
|
|
|
6983
7012
|
declare type VipInviteView = z.infer<typeof VipInviteView>;
|
|
6984
7013
|
|
|
6985
|
-
export declare function VipLandingView({ token, onUnavailable
|
|
7014
|
+
export declare function VipLandingView({ token, onUnavailable }: VipLandingViewProps): JSX.Element;
|
|
6986
7015
|
|
|
6987
7016
|
export declare interface VipLandingViewProps {
|
|
6988
|
-
/**
|
|
7017
|
+
/**
|
|
7018
|
+
* The last path segment of the URL the recipient opened: the token from the invite link,
|
|
7019
|
+
* or the invite reference that Reorder on a cancelled VIP order navigates to.
|
|
7020
|
+
*/
|
|
6989
7021
|
token: string;
|
|
6990
7022
|
/** Replaces the built-in screen for an invite that cannot be claimed. */
|
|
6991
7023
|
onUnavailable?: (state: VipInviteUnavailableState) => ReactNode;
|
|
6992
|
-
onHelp?: () => void;
|
|
6993
7024
|
}
|
|
6994
7025
|
|
|
6995
7026
|
/** "Why shop with us" reassurance tiles. */
|
package/dist/index.mjs
CHANGED
|
@@ -4507,9 +4507,11 @@ function requireVip() {
|
|
|
4507
4507
|
exports.VipInviteRef = (0, ids_1.prefixedId)("vip_", "VipInviteRef");
|
|
4508
4508
|
exports.VIP_TOKEN_PATTERN = /^[A-Za-z0-9_-]{43}$/;
|
|
4509
4509
|
exports.VipDeliveryRule = zod_1.z.enum(["both_free", "standard_free", "both_paid"]);
|
|
4510
|
-
exports.VipInviteResolveRequest = zod_1.z.object({
|
|
4510
|
+
exports.VipInviteResolveRequest = zod_1.z.union([zod_1.z.object({
|
|
4511
4511
|
token: zod_1.z.string().regex(exports.VIP_TOKEN_PATTERN)
|
|
4512
|
-
}).strict()
|
|
4512
|
+
}).strict(), zod_1.z.object({
|
|
4513
|
+
invite_ref: exports.VipInviteRef
|
|
4514
|
+
}).strict()]);
|
|
4513
4515
|
exports.VipInviteOffer = zod_1.z.object({
|
|
4514
4516
|
product_sku: common_1.Sku,
|
|
4515
4517
|
quantity: zod_1.z.number().int().positive()
|
|
@@ -4535,17 +4537,24 @@ function requireVip() {
|
|
|
4535
4537
|
state: zod_1.z.literal("scheduled"),
|
|
4536
4538
|
opens_at: common_1.Timestamp
|
|
4537
4539
|
}), zod_1.z.object({
|
|
4538
|
-
state: zod_1.z.literal("claimed")
|
|
4540
|
+
state: zod_1.z.literal("claimed"),
|
|
4541
|
+
order_ref: ids_1.OrderRef.optional()
|
|
4539
4542
|
}), zod_1.z.object({
|
|
4540
4543
|
state: zod_1.z.literal("expired")
|
|
4541
4544
|
}), zod_1.z.object({
|
|
4542
4545
|
state: zod_1.z.literal("revoked")
|
|
4543
4546
|
})]);
|
|
4544
|
-
|
|
4545
|
-
token: zod_1.z.string().regex(exports.VIP_TOKEN_PATTERN),
|
|
4547
|
+
const VipCartLine = {
|
|
4546
4548
|
sku: common_1.Sku,
|
|
4547
4549
|
qty: zod_1.z.number().int().positive().max(99)
|
|
4548
|
-
}
|
|
4550
|
+
};
|
|
4551
|
+
exports.VipCartItemRequest = zod_1.z.union([zod_1.z.object({
|
|
4552
|
+
token: zod_1.z.string().regex(exports.VIP_TOKEN_PATTERN),
|
|
4553
|
+
...VipCartLine
|
|
4554
|
+
}).strict(), zod_1.z.object({
|
|
4555
|
+
invite_ref: exports.VipInviteRef,
|
|
4556
|
+
...VipCartLine
|
|
4557
|
+
}).strict()]);
|
|
4549
4558
|
exports.VipClaimLine = zod_1.z.object({
|
|
4550
4559
|
sku: common_1.Sku,
|
|
4551
4560
|
qty: zod_1.z.number().int().positive()
|
|
@@ -5262,12 +5271,12 @@ function requireClient() {
|
|
|
5262
5271
|
})
|
|
5263
5272
|
},
|
|
5264
5273
|
vip: {
|
|
5265
|
-
resolve: (
|
|
5274
|
+
resolve: (locator, query = {}) => request({
|
|
5266
5275
|
method: "POST",
|
|
5267
5276
|
path: "/vip/resolve",
|
|
5268
|
-
body: {
|
|
5269
|
-
token
|
|
5270
|
-
},
|
|
5277
|
+
body: typeof locator === "string" ? {
|
|
5278
|
+
token: locator
|
|
5279
|
+
} : locator,
|
|
5271
5280
|
query: market(query),
|
|
5272
5281
|
schema: vip_1.VipInviteView
|
|
5273
5282
|
}),
|
|
@@ -6402,7 +6411,6 @@ const ES = {
|
|
|
6402
6411
|
"Measurement unit": "Unidad de medida",
|
|
6403
6412
|
"Need help?": "¿Necesita ayuda?",
|
|
6404
6413
|
"Need help with your order?": "¿Necesita ayuda con su pedido?",
|
|
6405
|
-
Homepage: "Inicio",
|
|
6406
6414
|
Breadcrumb: "Ruta de navegación",
|
|
6407
6415
|
"Show image {0} of {1}": "Ver imagen {0} de {1}",
|
|
6408
6416
|
"Nothing left to return": "No queda nada por devolver",
|
|
@@ -8453,7 +8461,7 @@ function VipBreadcrumb({ title: title2, trail: trail2 = [], onHome }) {
|
|
|
8453
8461
|
type: "button",
|
|
8454
8462
|
className: styles$C.home,
|
|
8455
8463
|
onClick: onHome,
|
|
8456
|
-
children: t("
|
|
8464
|
+
children: t("DAZN Shop")
|
|
8457
8465
|
})
|
|
8458
8466
|
}), trail2.map((crumb, i) => jsxs(Fragment$1, {
|
|
8459
8467
|
children: [jsx("li", {
|
|
@@ -8820,6 +8828,7 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
|
|
|
8820
8828
|
const emit = useShopEvent();
|
|
8821
8829
|
const navigate = useNavigate();
|
|
8822
8830
|
const toast2 = useToast();
|
|
8831
|
+
useSetScreenTitle(order?.vip ? t("DAZN Shop") : void 0, "none");
|
|
8823
8832
|
const load = useCallback(async () => {
|
|
8824
8833
|
setState("loading");
|
|
8825
8834
|
try {
|
|
@@ -8899,6 +8908,10 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
|
|
|
8899
8908
|
onReorder();
|
|
8900
8909
|
return;
|
|
8901
8910
|
}
|
|
8911
|
+
if (current2.vip) {
|
|
8912
|
+
navigate?.(`/vip/${encodeURIComponent(current2.vip.invite_ref)}`);
|
|
8913
|
+
return;
|
|
8914
|
+
}
|
|
8902
8915
|
setReordering(true);
|
|
8903
8916
|
try {
|
|
8904
8917
|
let added = 0;
|
|
@@ -8934,7 +8947,7 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
|
|
|
8934
8947
|
className: styles$A.cancelledMeta,
|
|
8935
8948
|
children: t("Order #{0} · Placed {1}", shortRef$1(order.order_ref), placedOn(order.placed_at, locale))
|
|
8936
8949
|
})]
|
|
8937
|
-
}),
|
|
8950
|
+
}), jsx(Button, {
|
|
8938
8951
|
variant: "primary",
|
|
8939
8952
|
fullWidth: true,
|
|
8940
8953
|
loading: reordering,
|
|
@@ -9157,6 +9170,7 @@ function OrderConfirmationContent({ orderRef, locale: localeProp, onDone, onCont
|
|
|
9157
9170
|
const { api } = useShop();
|
|
9158
9171
|
const locale = useLocale(localeProp);
|
|
9159
9172
|
const [order, setOrder] = useState(null);
|
|
9173
|
+
useSetScreenTitle(order?.vip ? t("DAZN Shop") : void 0, "none");
|
|
9160
9174
|
const [state, setState] = useState("loading");
|
|
9161
9175
|
const [errorCode, setErrorCode] = useState(void 0);
|
|
9162
9176
|
const load = useCallback(async () => {
|
|
@@ -12478,7 +12492,15 @@ function VipHero({ hero: hero2, onContinue }) {
|
|
|
12478
12492
|
})
|
|
12479
12493
|
});
|
|
12480
12494
|
}
|
|
12481
|
-
|
|
12495
|
+
const INVITE_REF = /^vip_[A-Za-z0-9._-]+$/;
|
|
12496
|
+
function locatorOf(segment) {
|
|
12497
|
+
return INVITE_REF.test(segment) && segment.length !== 43 ? {
|
|
12498
|
+
invite_ref: segment
|
|
12499
|
+
} : {
|
|
12500
|
+
token: segment
|
|
12501
|
+
};
|
|
12502
|
+
}
|
|
12503
|
+
function VipLandingView({ token, onUnavailable }) {
|
|
12482
12504
|
const t = useT();
|
|
12483
12505
|
const { api, emit } = useShop();
|
|
12484
12506
|
const [load, setLoad] = useState({
|
|
@@ -12486,12 +12508,13 @@ function VipLandingView({ token, onUnavailable, onHelp }) {
|
|
|
12486
12508
|
});
|
|
12487
12509
|
const emitRef = useRef(emit);
|
|
12488
12510
|
emitRef.current = emit;
|
|
12511
|
+
useSetScreenTitle(t("DAZN Shop"), "none");
|
|
12489
12512
|
useEffect(() => {
|
|
12490
12513
|
let live = true;
|
|
12491
12514
|
setLoad({
|
|
12492
12515
|
status: "loading"
|
|
12493
12516
|
});
|
|
12494
|
-
api.vip.resolve(token).then((invite2) => {
|
|
12517
|
+
api.vip.resolve(locatorOf(token)).then((invite2) => {
|
|
12495
12518
|
if (live) setLoad({
|
|
12496
12519
|
status: "done",
|
|
12497
12520
|
invite: invite2
|
|
@@ -12526,6 +12549,11 @@ function VipLandingView({ token, onUnavailable, onHelp }) {
|
|
|
12526
12549
|
});
|
|
12527
12550
|
}
|
|
12528
12551
|
const { invite } = load;
|
|
12552
|
+
if (invite.state === "claimed" && invite.order_ref) {
|
|
12553
|
+
return jsx(OrderTrackingView, {
|
|
12554
|
+
orderRef: invite.order_ref
|
|
12555
|
+
});
|
|
12556
|
+
}
|
|
12529
12557
|
if (invite.state !== "active") {
|
|
12530
12558
|
if (onUnavailable) return jsx(Fragment, {
|
|
12531
12559
|
children: onUnavailable(invite.state)
|
|
@@ -12541,13 +12569,10 @@ function VipLandingView({ token, onUnavailable, onHelp }) {
|
|
|
12541
12569
|
}
|
|
12542
12570
|
return jsx(ActiveLanding, {
|
|
12543
12571
|
token,
|
|
12544
|
-
invite
|
|
12545
|
-
...onHelp ? {
|
|
12546
|
-
onHelp
|
|
12547
|
-
} : {}
|
|
12572
|
+
invite
|
|
12548
12573
|
});
|
|
12549
12574
|
}
|
|
12550
|
-
function ActiveLanding({ token, invite
|
|
12575
|
+
function ActiveLanding({ token, invite }) {
|
|
12551
12576
|
const t = useT();
|
|
12552
12577
|
const toast2 = useToast();
|
|
12553
12578
|
const { api, emit } = useShop();
|
|
@@ -12563,7 +12588,7 @@ function ActiveLanding({ token, invite, onHelp }) {
|
|
|
12563
12588
|
for (const line2 of current2.items) await api.cart.removeItem(line2.sku);
|
|
12564
12589
|
}
|
|
12565
12590
|
const cart2 = await api.vip.addToCart({
|
|
12566
|
-
token,
|
|
12591
|
+
...locatorOf(token),
|
|
12567
12592
|
sku: variantSku,
|
|
12568
12593
|
qty: 1
|
|
12569
12594
|
});
|
|
@@ -12612,16 +12637,7 @@ function ActiveLanding({ token, invite, onHelp }) {
|
|
|
12612
12637
|
title: loaded.product.title,
|
|
12613
12638
|
onHome: product.close
|
|
12614
12639
|
})
|
|
12615
|
-
} : {}
|
|
12616
|
-
help: jsx(VipHelpLink, {
|
|
12617
|
-
onHelp: () => {
|
|
12618
|
-
emit({
|
|
12619
|
-
type: "help_requested",
|
|
12620
|
-
inviteRef: invite.invite_ref
|
|
12621
|
-
});
|
|
12622
|
-
onHelp?.();
|
|
12623
|
-
}
|
|
12624
|
-
})
|
|
12640
|
+
} : {}
|
|
12625
12641
|
}, loaded.product.sku);
|
|
12626
12642
|
}
|
|
12627
12643
|
if (loaded.loading) return jsx(ScreenSkeleton, {
|
|
@@ -13498,7 +13514,6 @@ function toGa4Event(event) {
|
|
|
13498
13514
|
case "ready":
|
|
13499
13515
|
case "navigate":
|
|
13500
13516
|
case "support_requested":
|
|
13501
|
-
case "help_requested":
|
|
13502
13517
|
case "order_cancellation_requested":
|
|
13503
13518
|
case "reorder_requested":
|
|
13504
13519
|
case "session_required":
|
|
@@ -4507,9 +4507,11 @@ function requireVip() {
|
|
|
4507
4507
|
exports.VipInviteRef = (0, ids_1.prefixedId)("vip_", "VipInviteRef");
|
|
4508
4508
|
exports.VIP_TOKEN_PATTERN = /^[A-Za-z0-9_-]{43}$/;
|
|
4509
4509
|
exports.VipDeliveryRule = zod_1.z.enum(["both_free", "standard_free", "both_paid"]);
|
|
4510
|
-
exports.VipInviteResolveRequest = zod_1.z.object({
|
|
4510
|
+
exports.VipInviteResolveRequest = zod_1.z.union([zod_1.z.object({
|
|
4511
4511
|
token: zod_1.z.string().regex(exports.VIP_TOKEN_PATTERN)
|
|
4512
|
-
}).strict()
|
|
4512
|
+
}).strict(), zod_1.z.object({
|
|
4513
|
+
invite_ref: exports.VipInviteRef
|
|
4514
|
+
}).strict()]);
|
|
4513
4515
|
exports.VipInviteOffer = zod_1.z.object({
|
|
4514
4516
|
product_sku: common_1.Sku,
|
|
4515
4517
|
quantity: zod_1.z.number().int().positive()
|
|
@@ -4535,17 +4537,24 @@ function requireVip() {
|
|
|
4535
4537
|
state: zod_1.z.literal("scheduled"),
|
|
4536
4538
|
opens_at: common_1.Timestamp
|
|
4537
4539
|
}), zod_1.z.object({
|
|
4538
|
-
state: zod_1.z.literal("claimed")
|
|
4540
|
+
state: zod_1.z.literal("claimed"),
|
|
4541
|
+
order_ref: ids_1.OrderRef.optional()
|
|
4539
4542
|
}), zod_1.z.object({
|
|
4540
4543
|
state: zod_1.z.literal("expired")
|
|
4541
4544
|
}), zod_1.z.object({
|
|
4542
4545
|
state: zod_1.z.literal("revoked")
|
|
4543
4546
|
})]);
|
|
4544
|
-
|
|
4545
|
-
token: zod_1.z.string().regex(exports.VIP_TOKEN_PATTERN),
|
|
4547
|
+
const VipCartLine = {
|
|
4546
4548
|
sku: common_1.Sku,
|
|
4547
4549
|
qty: zod_1.z.number().int().positive().max(99)
|
|
4548
|
-
}
|
|
4550
|
+
};
|
|
4551
|
+
exports.VipCartItemRequest = zod_1.z.union([zod_1.z.object({
|
|
4552
|
+
token: zod_1.z.string().regex(exports.VIP_TOKEN_PATTERN),
|
|
4553
|
+
...VipCartLine
|
|
4554
|
+
}).strict(), zod_1.z.object({
|
|
4555
|
+
invite_ref: exports.VipInviteRef,
|
|
4556
|
+
...VipCartLine
|
|
4557
|
+
}).strict()]);
|
|
4549
4558
|
exports.VipClaimLine = zod_1.z.object({
|
|
4550
4559
|
sku: common_1.Sku,
|
|
4551
4560
|
qty: zod_1.z.number().int().positive()
|
|
@@ -5262,12 +5271,12 @@ function requireClient() {
|
|
|
5262
5271
|
})
|
|
5263
5272
|
},
|
|
5264
5273
|
vip: {
|
|
5265
|
-
resolve: (
|
|
5274
|
+
resolve: (locator, query = {}) => request({
|
|
5266
5275
|
method: "POST",
|
|
5267
5276
|
path: "/vip/resolve",
|
|
5268
|
-
body: {
|
|
5269
|
-
token
|
|
5270
|
-
},
|
|
5277
|
+
body: typeof locator === "string" ? {
|
|
5278
|
+
token: locator
|
|
5279
|
+
} : locator,
|
|
5271
5280
|
query: market(query),
|
|
5272
5281
|
schema: vip_1.VipInviteView
|
|
5273
5282
|
}),
|
|
@@ -6402,7 +6411,6 @@ const ES = {
|
|
|
6402
6411
|
"Measurement unit": "Unidad de medida",
|
|
6403
6412
|
"Need help?": "¿Necesita ayuda?",
|
|
6404
6413
|
"Need help with your order?": "¿Necesita ayuda con su pedido?",
|
|
6405
|
-
Homepage: "Inicio",
|
|
6406
6414
|
Breadcrumb: "Ruta de navegación",
|
|
6407
6415
|
"Show image {0} of {1}": "Ver imagen {0} de {1}",
|
|
6408
6416
|
"Nothing left to return": "No queda nada por devolver",
|
|
@@ -8453,7 +8461,7 @@ function VipBreadcrumb({ title: title2, trail: trail2 = [], onHome }) {
|
|
|
8453
8461
|
type: "button",
|
|
8454
8462
|
className: styles$C.home,
|
|
8455
8463
|
onClick: onHome,
|
|
8456
|
-
children: t("
|
|
8464
|
+
children: t("DAZN Shop")
|
|
8457
8465
|
})
|
|
8458
8466
|
}), trail2.map((crumb, i) => jsxs(Fragment$1, {
|
|
8459
8467
|
children: [jsx("li", {
|
|
@@ -8820,6 +8828,7 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
|
|
|
8820
8828
|
const emit = useShopEvent();
|
|
8821
8829
|
const navigate = useNavigate();
|
|
8822
8830
|
const toast2 = useToast();
|
|
8831
|
+
useSetScreenTitle(order?.vip ? t("DAZN Shop") : void 0, "none");
|
|
8823
8832
|
const load = useCallback(async () => {
|
|
8824
8833
|
setState("loading");
|
|
8825
8834
|
try {
|
|
@@ -8899,6 +8908,10 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
|
|
|
8899
8908
|
onReorder();
|
|
8900
8909
|
return;
|
|
8901
8910
|
}
|
|
8911
|
+
if (current2.vip) {
|
|
8912
|
+
navigate?.(`/vip/${encodeURIComponent(current2.vip.invite_ref)}`);
|
|
8913
|
+
return;
|
|
8914
|
+
}
|
|
8902
8915
|
setReordering(true);
|
|
8903
8916
|
try {
|
|
8904
8917
|
let added = 0;
|
|
@@ -8934,7 +8947,7 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
|
|
|
8934
8947
|
className: styles$A.cancelledMeta,
|
|
8935
8948
|
children: t("Order #{0} · Placed {1}", shortRef$1(order.order_ref), placedOn(order.placed_at, locale))
|
|
8936
8949
|
})]
|
|
8937
|
-
}),
|
|
8950
|
+
}), jsx(Button, {
|
|
8938
8951
|
variant: "primary",
|
|
8939
8952
|
fullWidth: true,
|
|
8940
8953
|
loading: reordering,
|
|
@@ -9157,6 +9170,7 @@ function OrderConfirmationContent({ orderRef, locale: localeProp, onDone, onCont
|
|
|
9157
9170
|
const { api } = useShop();
|
|
9158
9171
|
const locale = useLocale(localeProp);
|
|
9159
9172
|
const [order, setOrder] = useState(null);
|
|
9173
|
+
useSetScreenTitle(order?.vip ? t("DAZN Shop") : void 0, "none");
|
|
9160
9174
|
const [state, setState] = useState("loading");
|
|
9161
9175
|
const [errorCode, setErrorCode] = useState(void 0);
|
|
9162
9176
|
const load = useCallback(async () => {
|
|
@@ -12478,7 +12492,15 @@ function VipHero({ hero: hero2, onContinue }) {
|
|
|
12478
12492
|
})
|
|
12479
12493
|
});
|
|
12480
12494
|
}
|
|
12481
|
-
|
|
12495
|
+
const INVITE_REF = /^vip_[A-Za-z0-9._-]+$/;
|
|
12496
|
+
function locatorOf(segment) {
|
|
12497
|
+
return INVITE_REF.test(segment) && segment.length !== 43 ? {
|
|
12498
|
+
invite_ref: segment
|
|
12499
|
+
} : {
|
|
12500
|
+
token: segment
|
|
12501
|
+
};
|
|
12502
|
+
}
|
|
12503
|
+
function VipLandingView({ token, onUnavailable }) {
|
|
12482
12504
|
const t = useT();
|
|
12483
12505
|
const { api, emit } = useShop();
|
|
12484
12506
|
const [load, setLoad] = useState({
|
|
@@ -12486,12 +12508,13 @@ function VipLandingView({ token, onUnavailable, onHelp }) {
|
|
|
12486
12508
|
});
|
|
12487
12509
|
const emitRef = useRef(emit);
|
|
12488
12510
|
emitRef.current = emit;
|
|
12511
|
+
useSetScreenTitle(t("DAZN Shop"), "none");
|
|
12489
12512
|
useEffect(() => {
|
|
12490
12513
|
let live = true;
|
|
12491
12514
|
setLoad({
|
|
12492
12515
|
status: "loading"
|
|
12493
12516
|
});
|
|
12494
|
-
api.vip.resolve(token).then((invite2) => {
|
|
12517
|
+
api.vip.resolve(locatorOf(token)).then((invite2) => {
|
|
12495
12518
|
if (live) setLoad({
|
|
12496
12519
|
status: "done",
|
|
12497
12520
|
invite: invite2
|
|
@@ -12526,6 +12549,11 @@ function VipLandingView({ token, onUnavailable, onHelp }) {
|
|
|
12526
12549
|
});
|
|
12527
12550
|
}
|
|
12528
12551
|
const { invite } = load;
|
|
12552
|
+
if (invite.state === "claimed" && invite.order_ref) {
|
|
12553
|
+
return jsx(OrderTrackingView, {
|
|
12554
|
+
orderRef: invite.order_ref
|
|
12555
|
+
});
|
|
12556
|
+
}
|
|
12529
12557
|
if (invite.state !== "active") {
|
|
12530
12558
|
if (onUnavailable) return jsx(Fragment, {
|
|
12531
12559
|
children: onUnavailable(invite.state)
|
|
@@ -12541,13 +12569,10 @@ function VipLandingView({ token, onUnavailable, onHelp }) {
|
|
|
12541
12569
|
}
|
|
12542
12570
|
return jsx(ActiveLanding, {
|
|
12543
12571
|
token,
|
|
12544
|
-
invite
|
|
12545
|
-
...onHelp ? {
|
|
12546
|
-
onHelp
|
|
12547
|
-
} : {}
|
|
12572
|
+
invite
|
|
12548
12573
|
});
|
|
12549
12574
|
}
|
|
12550
|
-
function ActiveLanding({ token, invite
|
|
12575
|
+
function ActiveLanding({ token, invite }) {
|
|
12551
12576
|
const t = useT();
|
|
12552
12577
|
const toast2 = useToast();
|
|
12553
12578
|
const { api, emit } = useShop();
|
|
@@ -12563,7 +12588,7 @@ function ActiveLanding({ token, invite, onHelp }) {
|
|
|
12563
12588
|
for (const line2 of current2.items) await api.cart.removeItem(line2.sku);
|
|
12564
12589
|
}
|
|
12565
12590
|
const cart2 = await api.vip.addToCart({
|
|
12566
|
-
token,
|
|
12591
|
+
...locatorOf(token),
|
|
12567
12592
|
sku: variantSku,
|
|
12568
12593
|
qty: 1
|
|
12569
12594
|
});
|
|
@@ -12612,16 +12637,7 @@ function ActiveLanding({ token, invite, onHelp }) {
|
|
|
12612
12637
|
title: loaded.product.title,
|
|
12613
12638
|
onHome: product.close
|
|
12614
12639
|
})
|
|
12615
|
-
} : {}
|
|
12616
|
-
help: jsx(VipHelpLink, {
|
|
12617
|
-
onHelp: () => {
|
|
12618
|
-
emit({
|
|
12619
|
-
type: "help_requested",
|
|
12620
|
-
inviteRef: invite.invite_ref
|
|
12621
|
-
});
|
|
12622
|
-
onHelp?.();
|
|
12623
|
-
}
|
|
12624
|
-
})
|
|
12640
|
+
} : {}
|
|
12625
12641
|
}, loaded.product.sku);
|
|
12626
12642
|
}
|
|
12627
12643
|
if (loaded.loading) return jsx(ScreenSkeleton, {
|
|
@@ -13498,7 +13514,6 @@ function toGa4Event(event) {
|
|
|
13498
13514
|
case "ready":
|
|
13499
13515
|
case "navigate":
|
|
13500
13516
|
case "support_requested":
|
|
13501
|
-
case "help_requested":
|
|
13502
13517
|
case "order_cancellation_requested":
|
|
13503
13518
|
case "reorder_requested":
|
|
13504
13519
|
case "session_required":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nok-integration/storefront-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.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
|
"type": "module",
|