@nok-integration/storefront-react 0.20.13 → 0.20.15
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 +53 -7
- package/dist/index.mjs +64 -13
- package/dist/standalone/storefront.mjs +64 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { ReactNode } from 'react';
|
|
|
8
8
|
import { RefAttributes } from 'react';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
|
|
11
|
-
/** `POST /v1/cart/items` — add an item. */
|
|
12
11
|
declare const AddCartItemRequest: z.ZodObject<{
|
|
13
12
|
sku: z.ZodString;
|
|
14
13
|
qty: z.ZodNumber;
|
|
@@ -268,6 +267,37 @@ export declare interface CartLineItemProps {
|
|
|
268
267
|
pending?: boolean;
|
|
269
268
|
}
|
|
270
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Market context for a cart call. Extends {@link MarketQuery}, so `country` and `lang`
|
|
272
|
+
* mean exactly what they mean on a catalogue read.
|
|
273
|
+
*
|
|
274
|
+
* A cart is priced for one market, and it has to be the same market the fan browsed in.
|
|
275
|
+
* Without this the engine can only price a basket for the deployment's default market,
|
|
276
|
+
* so an instance serving more than one prices every basket in the default's currency
|
|
277
|
+
* while the product pages beside it render another — the fan reads euros on the product
|
|
278
|
+
* and sterling at the till.
|
|
279
|
+
*
|
|
280
|
+
* Both fields stay optional, so this is additive: a caller that sends neither gets the
|
|
281
|
+
* configured default exactly as before. A caller that sends `country` on catalogue reads
|
|
282
|
+
* should send it here too — the pair is what keeps the two surfaces agreeing.
|
|
283
|
+
*
|
|
284
|
+
* The market belongs on the validated shopping session rather than on the query string,
|
|
285
|
+
* and moves there when that contract exists. This is the interim source,
|
|
286
|
+
* not the intended one.
|
|
287
|
+
*/
|
|
288
|
+
declare const CartMarketQuery: z.ZodObject<{
|
|
289
|
+
country: z.ZodOptional<z.ZodString>;
|
|
290
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
291
|
+
}, "strip", z.ZodTypeAny, {
|
|
292
|
+
country?: string | undefined;
|
|
293
|
+
lang?: string | undefined;
|
|
294
|
+
}, {
|
|
295
|
+
country?: string | undefined;
|
|
296
|
+
lang?: string | undefined;
|
|
297
|
+
}>;
|
|
298
|
+
|
|
299
|
+
declare type CartMarketQuery = z.infer<typeof CartMarketQuery>;
|
|
300
|
+
|
|
271
301
|
declare interface CartSheetApi {
|
|
272
302
|
open: () => void;
|
|
273
303
|
close: () => void;
|
|
@@ -2130,6 +2160,17 @@ declare interface ClientOptions {
|
|
|
2130
2160
|
defaultHeaders?: Record<string, string>;
|
|
2131
2161
|
/** Credentials mode (browser); defaults to `include` so the session cookie is sent. */
|
|
2132
2162
|
credentials?: RequestCredentials;
|
|
2163
|
+
/**
|
|
2164
|
+
* The market every cart call is made for, when the call does not name one itself.
|
|
2165
|
+
*
|
|
2166
|
+
* Set it to whatever is sent on catalogue reads. A cart is priced for one market, and a
|
|
2167
|
+
* client that prices its catalogue for Spain while its basket resolves the engine's
|
|
2168
|
+
* default market shows euros on the product and sterling at the till.
|
|
2169
|
+
*
|
|
2170
|
+
* Catalogue reads are unaffected — they already take the market per call, because a
|
|
2171
|
+
* consumer may legitimately read one market's catalogue while shopping in another.
|
|
2172
|
+
*/
|
|
2173
|
+
market?: CartMarketQuery;
|
|
2133
2174
|
}
|
|
2134
2175
|
|
|
2135
2176
|
/** Extract the API error `code` from a thrown value, if present. */
|
|
@@ -2591,8 +2632,13 @@ declare function createClient(options: ClientOptions): {
|
|
|
2591
2632
|
available: number;
|
|
2592
2633
|
}>;
|
|
2593
2634
|
};
|
|
2635
|
+
/**
|
|
2636
|
+
* The session cart. Every call takes the same optional market context as a catalogue
|
|
2637
|
+
* read — send the country you are browsing in, or the basket is priced for the
|
|
2638
|
+
* deployment's default market while the product pages render another.
|
|
2639
|
+
*/
|
|
2594
2640
|
cart: {
|
|
2595
|
-
create: () => Promise<{
|
|
2641
|
+
create: (query?: CartMarketQuery) => Promise<{
|
|
2596
2642
|
currency: string;
|
|
2597
2643
|
items: {
|
|
2598
2644
|
sku: string;
|
|
@@ -2648,7 +2694,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
2648
2694
|
} | undefined;
|
|
2649
2695
|
hidden_lines?: ("shipping" | "tax")[] | undefined;
|
|
2650
2696
|
}>;
|
|
2651
|
-
get: () => Promise<{
|
|
2697
|
+
get: (query?: CartMarketQuery) => Promise<{
|
|
2652
2698
|
currency: string;
|
|
2653
2699
|
items: {
|
|
2654
2700
|
sku: string;
|
|
@@ -2704,7 +2750,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
2704
2750
|
} | undefined;
|
|
2705
2751
|
hidden_lines?: ("shipping" | "tax")[] | undefined;
|
|
2706
2752
|
}>;
|
|
2707
|
-
addItem: (body: AddCartItemRequest) => Promise<{
|
|
2753
|
+
addItem: (body: AddCartItemRequest, query?: CartMarketQuery) => Promise<{
|
|
2708
2754
|
currency: string;
|
|
2709
2755
|
items: {
|
|
2710
2756
|
sku: string;
|
|
@@ -2760,7 +2806,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
2760
2806
|
} | undefined;
|
|
2761
2807
|
hidden_lines?: ("shipping" | "tax")[] | undefined;
|
|
2762
2808
|
}>;
|
|
2763
|
-
updateItem: (sku: string, body: UpdateCartItemRequest) => Promise<{
|
|
2809
|
+
updateItem: (sku: string, body: UpdateCartItemRequest, query?: CartMarketQuery) => Promise<{
|
|
2764
2810
|
currency: string;
|
|
2765
2811
|
items: {
|
|
2766
2812
|
sku: string;
|
|
@@ -2816,7 +2862,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
2816
2862
|
} | undefined;
|
|
2817
2863
|
hidden_lines?: ("shipping" | "tax")[] | undefined;
|
|
2818
2864
|
}>;
|
|
2819
|
-
removeItem: (sku: string) => Promise<{
|
|
2865
|
+
removeItem: (sku: string, query?: CartMarketQuery) => Promise<{
|
|
2820
2866
|
currency: string;
|
|
2821
2867
|
items: {
|
|
2822
2868
|
sku: string;
|
|
@@ -2878,7 +2924,7 @@ declare function createClient(options: ClientOptions): {
|
|
|
2878
2924
|
* The URL is opaque — redirect to it, never parse it. This is the last call in our
|
|
2879
2925
|
* journey; payment, order and confirmation all happen on DAZN.
|
|
2880
2926
|
*/
|
|
2881
|
-
handoff: () => Promise<{
|
|
2927
|
+
handoff: (query?: CartMarketQuery) => Promise<{
|
|
2882
2928
|
checkout_url: string;
|
|
2883
2929
|
}>;
|
|
2884
2930
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -4499,7 +4499,7 @@ function requireCart() {
|
|
|
4499
4499
|
Object.defineProperty(exports, "__esModule", {
|
|
4500
4500
|
value: true
|
|
4501
4501
|
});
|
|
4502
|
-
exports.PartnerCart = exports.PartnerCartItem = exports.CartHandoffResponse = exports.UpdateCartItemRequest = exports.AddCartItemRequest = exports.Cart = exports.HiddenSummaryLine = exports.CartHold = exports.CartLock = exports.CartLockReason = exports.CartTotals = exports.CartItem = void 0;
|
|
4502
|
+
exports.PartnerCart = exports.PartnerCartItem = exports.CartHandoffResponse = exports.UpdateCartItemRequest = exports.AddCartItemRequest = exports.CartMarketQuery = exports.Cart = exports.HiddenSummaryLine = exports.CartHold = exports.CartLock = exports.CartLockReason = exports.CartTotals = exports.CartItem = void 0;
|
|
4503
4503
|
const zod_1 = requireZod();
|
|
4504
4504
|
const money_1 = requireMoney();
|
|
4505
4505
|
const ids_1 = requireIds();
|
|
@@ -4539,6 +4539,7 @@ function requireCart() {
|
|
|
4539
4539
|
hold: exports.CartHold.optional(),
|
|
4540
4540
|
hidden_lines: zod_1.z.array(exports.HiddenSummaryLine).optional()
|
|
4541
4541
|
});
|
|
4542
|
+
exports.CartMarketQuery = common_1.MarketQuery;
|
|
4542
4543
|
exports.AddCartItemRequest = zod_1.z.object({
|
|
4543
4544
|
sku: common_1.Sku,
|
|
4544
4545
|
qty: zod_1.z.number().int().positive()
|
|
@@ -4970,6 +4971,12 @@ function requireClient() {
|
|
|
4970
4971
|
throw new Error("No fetch implementation available; pass options.fetch");
|
|
4971
4972
|
}
|
|
4972
4973
|
const base = options2.baseUrl.replace(/\/$/, "");
|
|
4974
|
+
function market(query) {
|
|
4975
|
+
return {
|
|
4976
|
+
...options2.market,
|
|
4977
|
+
...query
|
|
4978
|
+
};
|
|
4979
|
+
}
|
|
4973
4980
|
async function request(config) {
|
|
4974
4981
|
const token = await options2.getToken?.();
|
|
4975
4982
|
const headers = {
|
|
@@ -5075,34 +5082,40 @@ function requireClient() {
|
|
|
5075
5082
|
})
|
|
5076
5083
|
},
|
|
5077
5084
|
cart: {
|
|
5078
|
-
create: () => request({
|
|
5085
|
+
create: (query = {}) => request({
|
|
5079
5086
|
method: "POST",
|
|
5080
5087
|
path: "/cart",
|
|
5088
|
+
query: market(query),
|
|
5081
5089
|
schema: cart_1.Cart
|
|
5082
5090
|
}),
|
|
5083
|
-
get: () => request({
|
|
5091
|
+
get: (query = {}) => request({
|
|
5084
5092
|
method: "GET",
|
|
5085
5093
|
path: "/cart",
|
|
5094
|
+
query: market(query),
|
|
5086
5095
|
schema: cart_1.Cart
|
|
5087
5096
|
}),
|
|
5088
|
-
addItem: (body3) => request({
|
|
5097
|
+
addItem: (body3, query = {}) => request({
|
|
5089
5098
|
method: "POST",
|
|
5090
5099
|
path: "/cart/items",
|
|
5091
5100
|
body: body3,
|
|
5101
|
+
query: market(query),
|
|
5092
5102
|
schema: cart_1.Cart
|
|
5093
5103
|
}),
|
|
5094
|
-
updateItem: (sku, body3) => request({
|
|
5104
|
+
updateItem: (sku, body3, query = {}) => request({
|
|
5095
5105
|
method: "PATCH",
|
|
5096
5106
|
path: `/cart/items/${encodeURIComponent(sku)}`,
|
|
5097
5107
|
body: body3,
|
|
5108
|
+
query: market(query),
|
|
5098
5109
|
schema: cart_1.Cart
|
|
5099
5110
|
}),
|
|
5100
|
-
removeItem: (sku) => request({
|
|
5111
|
+
removeItem: (sku, query = {}) => request({
|
|
5101
5112
|
method: "DELETE",
|
|
5102
5113
|
path: `/cart/items/${encodeURIComponent(sku)}`,
|
|
5114
|
+
query: market(query),
|
|
5103
5115
|
schema: cart_1.Cart
|
|
5104
5116
|
}),
|
|
5105
|
-
handoff: () => request({
|
|
5117
|
+
handoff: (query = {}) => request({
|
|
5118
|
+
query: market(query),
|
|
5106
5119
|
method: "POST",
|
|
5107
5120
|
path: "/cart/handoff",
|
|
5108
5121
|
schema: cart_1.CartHandoffResponse
|
|
@@ -5211,14 +5224,17 @@ function movesThePage(event) {
|
|
|
5211
5224
|
if (event.type === "pointerdown") return event.pointerType !== "touch";
|
|
5212
5225
|
return true;
|
|
5213
5226
|
}
|
|
5227
|
+
const TOUCH_DOWN = ["touchstart", "pointerdown"];
|
|
5228
|
+
const TOUCH_UP = ["touchend", "touchcancel", "pointerup", "pointercancel"];
|
|
5214
5229
|
const holds = /* @__PURE__ */ new Set();
|
|
5215
5230
|
function releaseHolds() {
|
|
5216
5231
|
for (const end2 of Array.from(holds)) end2();
|
|
5217
5232
|
}
|
|
5218
5233
|
function anchorTop(onMoved = () => true, onEnd, box2 = null) {
|
|
5219
5234
|
let released = false;
|
|
5235
|
+
let touching = false;
|
|
5220
5236
|
const top2 = () => {
|
|
5221
|
-
if (released) return;
|
|
5237
|
+
if (released || touching) return;
|
|
5222
5238
|
const document_ = window.scrollY || document.documentElement.scrollTop || 0;
|
|
5223
5239
|
const pane = box2 ? box2.scrollTop : 0;
|
|
5224
5240
|
if (document_ <= 0 && pane <= 0) return;
|
|
@@ -5226,6 +5242,15 @@ function anchorTop(onMoved = () => true, onEnd, box2 = null) {
|
|
|
5226
5242
|
if (document_ > 0) scrollToTop();
|
|
5227
5243
|
if (box2 && pane > 0) scrollToTop(box2);
|
|
5228
5244
|
};
|
|
5245
|
+
const down = (event) => {
|
|
5246
|
+
if (event.type !== "pointerdown" || event.pointerType === "touch") {
|
|
5247
|
+
touching = true;
|
|
5248
|
+
}
|
|
5249
|
+
};
|
|
5250
|
+
const up = () => {
|
|
5251
|
+
touching = false;
|
|
5252
|
+
top2();
|
|
5253
|
+
};
|
|
5229
5254
|
const end2 = (how2) => {
|
|
5230
5255
|
if (released) return;
|
|
5231
5256
|
released = true;
|
|
@@ -5235,6 +5260,8 @@ function anchorTop(onMoved = () => true, onEnd, box2 = null) {
|
|
|
5235
5260
|
window.removeEventListener("scroll", top2);
|
|
5236
5261
|
box2?.removeEventListener("scroll", top2);
|
|
5237
5262
|
for (const type of RELEASES) window.removeEventListener(type, release);
|
|
5263
|
+
for (const type of TOUCH_DOWN) window.removeEventListener(type, down);
|
|
5264
|
+
for (const type of TOUCH_UP) window.removeEventListener(type, up);
|
|
5238
5265
|
onEnd?.(how2);
|
|
5239
5266
|
};
|
|
5240
5267
|
const release = (event) => {
|
|
@@ -5243,7 +5270,13 @@ function anchorTop(onMoved = () => true, onEnd, box2 = null) {
|
|
|
5243
5270
|
const moved = () => end2("moved");
|
|
5244
5271
|
top2();
|
|
5245
5272
|
const frame2 = typeof requestAnimationFrame === "function" ? requestAnimationFrame(top2) : null;
|
|
5246
|
-
|
|
5273
|
+
let timer2 = setTimeout(function lapse() {
|
|
5274
|
+
if (touching) {
|
|
5275
|
+
timer2 = setTimeout(lapse, 100);
|
|
5276
|
+
return;
|
|
5277
|
+
}
|
|
5278
|
+
end2("lapsed");
|
|
5279
|
+
}, HOLD_MS);
|
|
5247
5280
|
window.addEventListener("scroll", top2, {
|
|
5248
5281
|
passive: true
|
|
5249
5282
|
});
|
|
@@ -5253,6 +5286,12 @@ function anchorTop(onMoved = () => true, onEnd, box2 = null) {
|
|
|
5253
5286
|
for (const type of RELEASES) window.addEventListener(type, release, {
|
|
5254
5287
|
passive: true
|
|
5255
5288
|
});
|
|
5289
|
+
for (const type of TOUCH_DOWN) window.addEventListener(type, down, {
|
|
5290
|
+
passive: true
|
|
5291
|
+
});
|
|
5292
|
+
for (const type of TOUCH_UP) window.addEventListener(type, up, {
|
|
5293
|
+
passive: true
|
|
5294
|
+
});
|
|
5256
5295
|
holds.add(moved);
|
|
5257
5296
|
return () => end2("released");
|
|
5258
5297
|
}
|
|
@@ -5470,8 +5509,9 @@ function DaznShopProvider({ children, ...config }) {
|
|
|
5470
5509
|
onEvent: emit,
|
|
5471
5510
|
sessionTransport
|
|
5472
5511
|
}),
|
|
5473
|
-
credentials: sessionTransport === "cookie" ? "include" : "omit"
|
|
5474
|
-
|
|
5512
|
+
credentials: sessionTransport === "cookie" ? "include" : "omit",
|
|
5513
|
+
market
|
|
5514
|
+
}), [apiBaseUrl, stableGetToken, emit, sessionTransport, market]);
|
|
5475
5515
|
const navigate = useCallback((to) => {
|
|
5476
5516
|
emit({
|
|
5477
5517
|
type: "navigate",
|
|
@@ -6123,7 +6163,18 @@ const ES = {
|
|
|
6123
6163
|
"We'll let you know": "Le avisaremos",
|
|
6124
6164
|
"{0} — as soon as it is back": "{0} — en cuanto vuelva a estar disponible",
|
|
6125
6165
|
"Size {0}": "Talla {0}",
|
|
6126
|
-
"On the way": "En camino"
|
|
6166
|
+
"On the way": "En camino",
|
|
6167
|
+
"Adding to cart": "Añadiendo a la cesta",
|
|
6168
|
+
"Go to cart": "Ir a la cesta",
|
|
6169
|
+
"Track your return": "Seguir tu devolución",
|
|
6170
|
+
"Track return {0}": "Seguir la devolución {0}",
|
|
6171
|
+
"Return requested": "Devolución solicitada",
|
|
6172
|
+
"Package received": "Paquete recibido",
|
|
6173
|
+
"Return complete": "Devolución completada",
|
|
6174
|
+
Less: "Menos",
|
|
6175
|
+
more: "más",
|
|
6176
|
+
"Close reasons": "Cerrar motivos",
|
|
6177
|
+
Select: "Seleccionar"
|
|
6127
6178
|
};
|
|
6128
6179
|
const CATALOGUES = {
|
|
6129
6180
|
es: ES
|
|
@@ -10554,7 +10605,7 @@ function ProductDetails({ description: description2 }) {
|
|
|
10554
10605
|
className: styles$d.toggle,
|
|
10555
10606
|
"aria-expanded": expanded,
|
|
10556
10607
|
onClick: () => setExpanded((v) => !v),
|
|
10557
|
-
children: expanded ? "Less" : "more"
|
|
10608
|
+
children: expanded ? t("Less") : t("more")
|
|
10558
10609
|
}) : null]
|
|
10559
10610
|
});
|
|
10560
10611
|
}
|
|
@@ -4499,7 +4499,7 @@ function requireCart() {
|
|
|
4499
4499
|
Object.defineProperty(exports, "__esModule", {
|
|
4500
4500
|
value: true
|
|
4501
4501
|
});
|
|
4502
|
-
exports.PartnerCart = exports.PartnerCartItem = exports.CartHandoffResponse = exports.UpdateCartItemRequest = exports.AddCartItemRequest = exports.Cart = exports.HiddenSummaryLine = exports.CartHold = exports.CartLock = exports.CartLockReason = exports.CartTotals = exports.CartItem = void 0;
|
|
4502
|
+
exports.PartnerCart = exports.PartnerCartItem = exports.CartHandoffResponse = exports.UpdateCartItemRequest = exports.AddCartItemRequest = exports.CartMarketQuery = exports.Cart = exports.HiddenSummaryLine = exports.CartHold = exports.CartLock = exports.CartLockReason = exports.CartTotals = exports.CartItem = void 0;
|
|
4503
4503
|
const zod_1 = requireZod();
|
|
4504
4504
|
const money_1 = requireMoney();
|
|
4505
4505
|
const ids_1 = requireIds();
|
|
@@ -4539,6 +4539,7 @@ function requireCart() {
|
|
|
4539
4539
|
hold: exports.CartHold.optional(),
|
|
4540
4540
|
hidden_lines: zod_1.z.array(exports.HiddenSummaryLine).optional()
|
|
4541
4541
|
});
|
|
4542
|
+
exports.CartMarketQuery = common_1.MarketQuery;
|
|
4542
4543
|
exports.AddCartItemRequest = zod_1.z.object({
|
|
4543
4544
|
sku: common_1.Sku,
|
|
4544
4545
|
qty: zod_1.z.number().int().positive()
|
|
@@ -4970,6 +4971,12 @@ function requireClient() {
|
|
|
4970
4971
|
throw new Error("No fetch implementation available; pass options.fetch");
|
|
4971
4972
|
}
|
|
4972
4973
|
const base = options2.baseUrl.replace(/\/$/, "");
|
|
4974
|
+
function market(query) {
|
|
4975
|
+
return {
|
|
4976
|
+
...options2.market,
|
|
4977
|
+
...query
|
|
4978
|
+
};
|
|
4979
|
+
}
|
|
4973
4980
|
async function request(config) {
|
|
4974
4981
|
const token = await options2.getToken?.();
|
|
4975
4982
|
const headers = {
|
|
@@ -5075,34 +5082,40 @@ function requireClient() {
|
|
|
5075
5082
|
})
|
|
5076
5083
|
},
|
|
5077
5084
|
cart: {
|
|
5078
|
-
create: () => request({
|
|
5085
|
+
create: (query = {}) => request({
|
|
5079
5086
|
method: "POST",
|
|
5080
5087
|
path: "/cart",
|
|
5088
|
+
query: market(query),
|
|
5081
5089
|
schema: cart_1.Cart
|
|
5082
5090
|
}),
|
|
5083
|
-
get: () => request({
|
|
5091
|
+
get: (query = {}) => request({
|
|
5084
5092
|
method: "GET",
|
|
5085
5093
|
path: "/cart",
|
|
5094
|
+
query: market(query),
|
|
5086
5095
|
schema: cart_1.Cart
|
|
5087
5096
|
}),
|
|
5088
|
-
addItem: (body3) => request({
|
|
5097
|
+
addItem: (body3, query = {}) => request({
|
|
5089
5098
|
method: "POST",
|
|
5090
5099
|
path: "/cart/items",
|
|
5091
5100
|
body: body3,
|
|
5101
|
+
query: market(query),
|
|
5092
5102
|
schema: cart_1.Cart
|
|
5093
5103
|
}),
|
|
5094
|
-
updateItem: (sku, body3) => request({
|
|
5104
|
+
updateItem: (sku, body3, query = {}) => request({
|
|
5095
5105
|
method: "PATCH",
|
|
5096
5106
|
path: `/cart/items/${encodeURIComponent(sku)}`,
|
|
5097
5107
|
body: body3,
|
|
5108
|
+
query: market(query),
|
|
5098
5109
|
schema: cart_1.Cart
|
|
5099
5110
|
}),
|
|
5100
|
-
removeItem: (sku) => request({
|
|
5111
|
+
removeItem: (sku, query = {}) => request({
|
|
5101
5112
|
method: "DELETE",
|
|
5102
5113
|
path: `/cart/items/${encodeURIComponent(sku)}`,
|
|
5114
|
+
query: market(query),
|
|
5103
5115
|
schema: cart_1.Cart
|
|
5104
5116
|
}),
|
|
5105
|
-
handoff: () => request({
|
|
5117
|
+
handoff: (query = {}) => request({
|
|
5118
|
+
query: market(query),
|
|
5106
5119
|
method: "POST",
|
|
5107
5120
|
path: "/cart/handoff",
|
|
5108
5121
|
schema: cart_1.CartHandoffResponse
|
|
@@ -5211,14 +5224,17 @@ function movesThePage(event) {
|
|
|
5211
5224
|
if (event.type === "pointerdown") return event.pointerType !== "touch";
|
|
5212
5225
|
return true;
|
|
5213
5226
|
}
|
|
5227
|
+
const TOUCH_DOWN = ["touchstart", "pointerdown"];
|
|
5228
|
+
const TOUCH_UP = ["touchend", "touchcancel", "pointerup", "pointercancel"];
|
|
5214
5229
|
const holds = /* @__PURE__ */ new Set();
|
|
5215
5230
|
function releaseHolds() {
|
|
5216
5231
|
for (const end2 of Array.from(holds)) end2();
|
|
5217
5232
|
}
|
|
5218
5233
|
function anchorTop(onMoved = () => true, onEnd, box2 = null) {
|
|
5219
5234
|
let released = false;
|
|
5235
|
+
let touching = false;
|
|
5220
5236
|
const top2 = () => {
|
|
5221
|
-
if (released) return;
|
|
5237
|
+
if (released || touching) return;
|
|
5222
5238
|
const document_ = window.scrollY || document.documentElement.scrollTop || 0;
|
|
5223
5239
|
const pane = box2 ? box2.scrollTop : 0;
|
|
5224
5240
|
if (document_ <= 0 && pane <= 0) return;
|
|
@@ -5226,6 +5242,15 @@ function anchorTop(onMoved = () => true, onEnd, box2 = null) {
|
|
|
5226
5242
|
if (document_ > 0) scrollToTop();
|
|
5227
5243
|
if (box2 && pane > 0) scrollToTop(box2);
|
|
5228
5244
|
};
|
|
5245
|
+
const down = (event) => {
|
|
5246
|
+
if (event.type !== "pointerdown" || event.pointerType === "touch") {
|
|
5247
|
+
touching = true;
|
|
5248
|
+
}
|
|
5249
|
+
};
|
|
5250
|
+
const up = () => {
|
|
5251
|
+
touching = false;
|
|
5252
|
+
top2();
|
|
5253
|
+
};
|
|
5229
5254
|
const end2 = (how2) => {
|
|
5230
5255
|
if (released) return;
|
|
5231
5256
|
released = true;
|
|
@@ -5235,6 +5260,8 @@ function anchorTop(onMoved = () => true, onEnd, box2 = null) {
|
|
|
5235
5260
|
window.removeEventListener("scroll", top2);
|
|
5236
5261
|
box2?.removeEventListener("scroll", top2);
|
|
5237
5262
|
for (const type of RELEASES) window.removeEventListener(type, release);
|
|
5263
|
+
for (const type of TOUCH_DOWN) window.removeEventListener(type, down);
|
|
5264
|
+
for (const type of TOUCH_UP) window.removeEventListener(type, up);
|
|
5238
5265
|
onEnd?.(how2);
|
|
5239
5266
|
};
|
|
5240
5267
|
const release = (event) => {
|
|
@@ -5243,7 +5270,13 @@ function anchorTop(onMoved = () => true, onEnd, box2 = null) {
|
|
|
5243
5270
|
const moved = () => end2("moved");
|
|
5244
5271
|
top2();
|
|
5245
5272
|
const frame2 = typeof requestAnimationFrame === "function" ? requestAnimationFrame(top2) : null;
|
|
5246
|
-
|
|
5273
|
+
let timer2 = setTimeout(function lapse() {
|
|
5274
|
+
if (touching) {
|
|
5275
|
+
timer2 = setTimeout(lapse, 100);
|
|
5276
|
+
return;
|
|
5277
|
+
}
|
|
5278
|
+
end2("lapsed");
|
|
5279
|
+
}, HOLD_MS);
|
|
5247
5280
|
window.addEventListener("scroll", top2, {
|
|
5248
5281
|
passive: true
|
|
5249
5282
|
});
|
|
@@ -5253,6 +5286,12 @@ function anchorTop(onMoved = () => true, onEnd, box2 = null) {
|
|
|
5253
5286
|
for (const type of RELEASES) window.addEventListener(type, release, {
|
|
5254
5287
|
passive: true
|
|
5255
5288
|
});
|
|
5289
|
+
for (const type of TOUCH_DOWN) window.addEventListener(type, down, {
|
|
5290
|
+
passive: true
|
|
5291
|
+
});
|
|
5292
|
+
for (const type of TOUCH_UP) window.addEventListener(type, up, {
|
|
5293
|
+
passive: true
|
|
5294
|
+
});
|
|
5256
5295
|
holds.add(moved);
|
|
5257
5296
|
return () => end2("released");
|
|
5258
5297
|
}
|
|
@@ -5470,8 +5509,9 @@ function DaznShopProvider({ children, ...config }) {
|
|
|
5470
5509
|
onEvent: emit,
|
|
5471
5510
|
sessionTransport
|
|
5472
5511
|
}),
|
|
5473
|
-
credentials: sessionTransport === "cookie" ? "include" : "omit"
|
|
5474
|
-
|
|
5512
|
+
credentials: sessionTransport === "cookie" ? "include" : "omit",
|
|
5513
|
+
market
|
|
5514
|
+
}), [apiBaseUrl, stableGetToken, emit, sessionTransport, market]);
|
|
5475
5515
|
const navigate = useCallback((to) => {
|
|
5476
5516
|
emit({
|
|
5477
5517
|
type: "navigate",
|
|
@@ -6123,7 +6163,18 @@ const ES = {
|
|
|
6123
6163
|
"We'll let you know": "Le avisaremos",
|
|
6124
6164
|
"{0} — as soon as it is back": "{0} — en cuanto vuelva a estar disponible",
|
|
6125
6165
|
"Size {0}": "Talla {0}",
|
|
6126
|
-
"On the way": "En camino"
|
|
6166
|
+
"On the way": "En camino",
|
|
6167
|
+
"Adding to cart": "Añadiendo a la cesta",
|
|
6168
|
+
"Go to cart": "Ir a la cesta",
|
|
6169
|
+
"Track your return": "Seguir tu devolución",
|
|
6170
|
+
"Track return {0}": "Seguir la devolución {0}",
|
|
6171
|
+
"Return requested": "Devolución solicitada",
|
|
6172
|
+
"Package received": "Paquete recibido",
|
|
6173
|
+
"Return complete": "Devolución completada",
|
|
6174
|
+
Less: "Menos",
|
|
6175
|
+
more: "más",
|
|
6176
|
+
"Close reasons": "Cerrar motivos",
|
|
6177
|
+
Select: "Seleccionar"
|
|
6127
6178
|
};
|
|
6128
6179
|
const CATALOGUES = {
|
|
6129
6180
|
es: ES
|
|
@@ -10554,7 +10605,7 @@ function ProductDetails({ description: description2 }) {
|
|
|
10554
10605
|
className: styles$d.toggle,
|
|
10555
10606
|
"aria-expanded": expanded,
|
|
10556
10607
|
onClick: () => setExpanded((v) => !v),
|
|
10557
|
-
children: expanded ? "Less" : "more"
|
|
10608
|
+
children: expanded ? t("Less") : t("more")
|
|
10558
10609
|
}) : null]
|
|
10559
10610
|
});
|
|
10560
10611
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nok-integration/storefront-react",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.15",
|
|
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",
|