@nok-integration/storefront-react 0.20.9 → 0.20.11
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 +3 -0
- package/dist/index.mjs +246 -70
- package/dist/standalone/storefront.mjs +246 -70
- package/package.json +1 -1
|
@@ -5713,16 +5713,21 @@ function withoutRestoration() {
|
|
|
5713
5713
|
history.scrollRestoration = previous;
|
|
5714
5714
|
};
|
|
5715
5715
|
}
|
|
5716
|
-
const RELEASES = ["
|
|
5717
|
-
function
|
|
5716
|
+
const RELEASES = ["touchmove", "wheel", "keydown", "pointerdown"];
|
|
5717
|
+
function movesThePage(event) {
|
|
5718
|
+
if (event.type === "pointerdown") return event.pointerType !== "touch";
|
|
5719
|
+
return true;
|
|
5720
|
+
}
|
|
5721
|
+
function anchorTop(onMoved = () => true) {
|
|
5718
5722
|
let released = false;
|
|
5719
5723
|
const top2 = () => {
|
|
5720
5724
|
if (released) return;
|
|
5721
5725
|
const scrolled2 = window.scrollY || document.documentElement.scrollTop || 0;
|
|
5722
|
-
if (scrolled2 > 0 &&
|
|
5726
|
+
if (scrolled2 > 0 && onMoved()) window.scrollTo(0, 0);
|
|
5723
5727
|
};
|
|
5724
|
-
const release = () => {
|
|
5728
|
+
const release = (event) => {
|
|
5725
5729
|
if (released) return;
|
|
5730
|
+
if (event && !movesThePage(event)) return;
|
|
5726
5731
|
released = true;
|
|
5727
5732
|
if (frame2 !== null && typeof cancelAnimationFrame === "function") cancelAnimationFrame(frame2);
|
|
5728
5733
|
clearTimeout(timer2);
|
|
@@ -5738,7 +5743,23 @@ function anchorTop(shouldHold = () => true) {
|
|
|
5738
5743
|
for (const type of RELEASES) window.addEventListener(type, release, {
|
|
5739
5744
|
passive: true
|
|
5740
5745
|
});
|
|
5741
|
-
return release;
|
|
5746
|
+
return () => release();
|
|
5747
|
+
}
|
|
5748
|
+
function onReveal(el, revealed) {
|
|
5749
|
+
if (typeof IntersectionObserver === "undefined") return () => {
|
|
5750
|
+
};
|
|
5751
|
+
let seen = false;
|
|
5752
|
+
let visible = true;
|
|
5753
|
+
const observer = new IntersectionObserver((entries) => {
|
|
5754
|
+
const entry = entries[entries.length - 1];
|
|
5755
|
+
if (!entry) return;
|
|
5756
|
+
const now = entry.isIntersecting;
|
|
5757
|
+
if (seen && now && !visible) revealed();
|
|
5758
|
+
seen = true;
|
|
5759
|
+
visible = now;
|
|
5760
|
+
});
|
|
5761
|
+
observer.observe(el);
|
|
5762
|
+
return () => observer.disconnect();
|
|
5742
5763
|
}
|
|
5743
5764
|
const useMountEffect$1 = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
5744
5765
|
function documentTop(el) {
|
|
@@ -5756,8 +5777,13 @@ function useScreenAnchor(ref, enabled = true) {
|
|
|
5756
5777
|
const el = ref.current;
|
|
5757
5778
|
if (!el || !enabled) return;
|
|
5758
5779
|
const restore = withoutRestoration();
|
|
5759
|
-
|
|
5780
|
+
let release = anchorTop(() => beginsOnTheFirstViewport(el));
|
|
5781
|
+
const unobserve = onReveal(el, () => {
|
|
5782
|
+
release();
|
|
5783
|
+
release = anchorTop(() => beginsOnTheFirstViewport(el));
|
|
5784
|
+
});
|
|
5760
5785
|
return () => {
|
|
5786
|
+
unobserve();
|
|
5761
5787
|
release();
|
|
5762
5788
|
restore();
|
|
5763
5789
|
};
|
|
@@ -5976,7 +6002,58 @@ const ES = {
|
|
|
5976
6002
|
Received: "Recibida",
|
|
5977
6003
|
Completed: "Completada",
|
|
5978
6004
|
item: "artículo",
|
|
5979
|
-
items: "artículos"
|
|
6005
|
+
items: "artículos",
|
|
6006
|
+
"(opens in a new tab)": "(se abre en nueva pestaña)",
|
|
6007
|
+
"Arrived too late": "Llegó demasiado tarde",
|
|
6008
|
+
"Cancel order": "Cancelar pedido",
|
|
6009
|
+
"Changed my mind": "Cambié de opinión",
|
|
6010
|
+
"Contact support": "Contactar atención al cliente",
|
|
6011
|
+
"Delivery takes too long": "Demora en la entrega",
|
|
6012
|
+
Discount: "Descuento",
|
|
6013
|
+
Done: "Listo",
|
|
6014
|
+
"Download return label": "Descargar etiqueta de devolución",
|
|
6015
|
+
"Download your return label": "Descargar tu etiqueta de devolución",
|
|
6016
|
+
"Drop it off at your local carrier or post office.": "Entréguelo en su transportista local o oficina de correos.",
|
|
6017
|
+
"Every item on this order has already been returned or cancelled.": "Todos los artículos de este pedido ya han sido devueltos o cancelados.",
|
|
6018
|
+
Fabric: "Tela",
|
|
6019
|
+
"Follow the instructions below to complete your return": "Siga las instrucciones a continuación para completar su devolución",
|
|
6020
|
+
"How to measure": "Cómo medir",
|
|
6021
|
+
"Item doesn't match description": "El artículo no coincide con la descripción",
|
|
6022
|
+
"Item is damaged": "El artículo está dañado",
|
|
6023
|
+
"Measurement unit": "Unidad de medida",
|
|
6024
|
+
"Need help?": "¿Necesita ayuda?",
|
|
6025
|
+
"Nothing left to return": "No queda nada por devolver",
|
|
6026
|
+
"Order #{0} · Placed {1}": "Pedido n.º {0} · Realizado el {1}",
|
|
6027
|
+
"Order cancelled": "Pedido cancelado",
|
|
6028
|
+
"Order confirmation": "Confirmación del pedido",
|
|
6029
|
+
"Ordered by mistake": "Pedido por error",
|
|
6030
|
+
"Pack and ship the item": "Empaque y envíe el artículo",
|
|
6031
|
+
"Reason for cancelling": "Motivo de la cancelación",
|
|
6032
|
+
"Reason for return": "Motivo de la devolución",
|
|
6033
|
+
Reorder: "Volver a pedir",
|
|
6034
|
+
"Repackage the item securely and attach the return label to the outside of the package.": "Vuelva a empaquetar el artículo de forma segura y pegue la etiqueta de devolución en el exterior del paquete.",
|
|
6035
|
+
"Request not found": "Solicitud no encontrada",
|
|
6036
|
+
"Return #{0} · Reported {1}": "Devolución n.º {0} · Notificada el {1}",
|
|
6037
|
+
"Return in progress": "Devolución en curso",
|
|
6038
|
+
"Return selected items": "Devolver artículos seleccionados",
|
|
6039
|
+
"Select items you want to return": "Seleccione los artículos que desea devolver",
|
|
6040
|
+
"Size guide unavailable": "Guía de tallas no disponible",
|
|
6041
|
+
"Size: {0}": "Talla: {0}",
|
|
6042
|
+
"Start a return": "Iniciar una devolución",
|
|
6043
|
+
"Tap the button below to download your pre-paid return label": "Toque el botón de abajo para descargar su etiqueta de devolución prepagada",
|
|
6044
|
+
"Too large": "Demasiado grande",
|
|
6045
|
+
"Too small": "Demasiado pequeño",
|
|
6046
|
+
Track: "Seguir envío",
|
|
6047
|
+
"We could not find that support request.": "No pudimos encontrar esa solicitud de ayuda.",
|
|
6048
|
+
"We could not load the size guide for this item.": "No pudimos cargar la guía de tallas de este artículo.",
|
|
6049
|
+
"We’ve generated your return label": "Hemos generado su etiqueta de devolución",
|
|
6050
|
+
"We’ve sent a confirmation to {0}": "Hemos enviado una confirmación a {0}",
|
|
6051
|
+
"What do you want to return?": "¿Qué desea devolver?",
|
|
6052
|
+
"Your order is confirmed": "Su pedido está confirmado",
|
|
6053
|
+
"You’ll receive a shipping label PDF to your email as well.": "Recibirá un PDF de la etiqueta de envío en su correo electrónico.",
|
|
6054
|
+
"{0} photographs": "{0} fotografías",
|
|
6055
|
+
"{0}, opens in a new tab": "{0}, se abre en una pestaña nueva",
|
|
6056
|
+
"Zip Ups": "Sudaderas con cremalleras"
|
|
5980
6057
|
};
|
|
5981
6058
|
const CATALOGUES = {
|
|
5982
6059
|
es: ES
|
|
@@ -6482,6 +6559,7 @@ const styles$I = {
|
|
|
6482
6559
|
};
|
|
6483
6560
|
function PriceBlock({ price: price2, compareAt: compareAt2, discountPct: discountPct$1, size = "md", variant = "strikethrough", align = "baseline" }) {
|
|
6484
6561
|
const { format } = useMoney();
|
|
6562
|
+
const t = useT();
|
|
6485
6563
|
const pct = discountPct$1 ?? discountPct(price2, compareAt2);
|
|
6486
6564
|
const hasCompare = compareAt2 && compareAt2.amount > price2.amount;
|
|
6487
6565
|
return jsxs("div", {
|
|
@@ -6493,7 +6571,7 @@ function PriceBlock({ price: price2, compareAt: compareAt2, discountPct: discoun
|
|
|
6493
6571
|
className: styles$I.compareAt,
|
|
6494
6572
|
children: [jsx("span", {
|
|
6495
6573
|
className: "visually-hidden",
|
|
6496
|
-
children:
|
|
6574
|
+
children: t("Was {0}", format(compareAt2))
|
|
6497
6575
|
}), jsx("span", {
|
|
6498
6576
|
"aria-hidden": "true",
|
|
6499
6577
|
children: format(compareAt2)
|
|
@@ -6503,6 +6581,50 @@ function PriceBlock({ price: price2, compareAt: compareAt2, discountPct: discoun
|
|
|
6503
6581
|
})]
|
|
6504
6582
|
});
|
|
6505
6583
|
}
|
|
6584
|
+
const STATE_KEY = "__daznShop";
|
|
6585
|
+
function current$1(name2) {
|
|
6586
|
+
if (typeof window === "undefined") return null;
|
|
6587
|
+
const state = window.history.state;
|
|
6588
|
+
const ours = state?.[STATE_KEY];
|
|
6589
|
+
if (!ours || ours.href !== window.location.href) return null;
|
|
6590
|
+
const value2 = ours[name2];
|
|
6591
|
+
return typeof value2 === "string" ? value2 : null;
|
|
6592
|
+
}
|
|
6593
|
+
function useInPlaceScreen(name2) {
|
|
6594
|
+
const [value2, setValue] = useState(() => current$1(name2));
|
|
6595
|
+
useEffect(() => {
|
|
6596
|
+
const onPop = () => setValue(current$1(name2));
|
|
6597
|
+
window.addEventListener("popstate", onPop);
|
|
6598
|
+
return () => window.removeEventListener("popstate", onPop);
|
|
6599
|
+
}, [name2]);
|
|
6600
|
+
const open = useCallback((next) => {
|
|
6601
|
+
const history = window.history;
|
|
6602
|
+
const state = history.state ?? {};
|
|
6603
|
+
const href = window.location.href;
|
|
6604
|
+
const ours = state[STATE_KEY]?.href === href ? state[STATE_KEY] : {};
|
|
6605
|
+
history.pushState({
|
|
6606
|
+
...state,
|
|
6607
|
+
[STATE_KEY]: {
|
|
6608
|
+
...ours,
|
|
6609
|
+
href,
|
|
6610
|
+
[name2]: next
|
|
6611
|
+
}
|
|
6612
|
+
}, "", href);
|
|
6613
|
+
setValue(next);
|
|
6614
|
+
}, [name2]);
|
|
6615
|
+
const close2 = useCallback(() => {
|
|
6616
|
+
if (current$1(name2) !== null) {
|
|
6617
|
+
window.history.back();
|
|
6618
|
+
return;
|
|
6619
|
+
}
|
|
6620
|
+
setValue(null);
|
|
6621
|
+
}, [name2]);
|
|
6622
|
+
return {
|
|
6623
|
+
value: value2,
|
|
6624
|
+
open,
|
|
6625
|
+
close: close2
|
|
6626
|
+
};
|
|
6627
|
+
}
|
|
6506
6628
|
const timeline = "_timeline_1cum7_7";
|
|
6507
6629
|
const row$8 = "_row_1cum7_15";
|
|
6508
6630
|
const line$3 = "_line_1cum7_20";
|
|
@@ -6891,7 +7013,7 @@ function OrderLine({ item: item2 }) {
|
|
|
6891
7013
|
className: styles$F.was,
|
|
6892
7014
|
children: [jsx("span", {
|
|
6893
7015
|
className: "visually-hidden",
|
|
6894
|
-
children:
|
|
7016
|
+
children: t("Was {0}", format(compareAt2))
|
|
6895
7017
|
}), jsx("span", {
|
|
6896
7018
|
"aria-hidden": "true",
|
|
6897
7019
|
children: format(compareAt2)
|
|
@@ -6955,7 +7077,7 @@ function OrderSummaryCard({ order }) {
|
|
|
6955
7077
|
"aria-label": t("Order summary"),
|
|
6956
7078
|
children: [jsx("h2", {
|
|
6957
7079
|
className: styles$F.cardTitle,
|
|
6958
|
-
children: "Order summary"
|
|
7080
|
+
children: t("Order summary")
|
|
6959
7081
|
}), jsx(OrderSummary, {
|
|
6960
7082
|
pricing: toPricing(order),
|
|
6961
7083
|
rows: rowsFor(order),
|
|
@@ -7106,6 +7228,7 @@ const styles$D = {
|
|
|
7106
7228
|
function ReasonSheet({ title: title2, options: options2, ctaLabel, selected: selected2, onConfirm, onClose, closeLabel, busy = false, error: error2 }) {
|
|
7107
7229
|
const sheetRef = useRef(null);
|
|
7108
7230
|
const [choice, setChoice] = useState(selected2);
|
|
7231
|
+
const t = useT();
|
|
7109
7232
|
useModalDialog(true, onClose, sheetRef);
|
|
7110
7233
|
return jsx("div", {
|
|
7111
7234
|
className: styles$D.scrim,
|
|
@@ -7126,7 +7249,7 @@ function ReasonSheet({ title: title2, options: options2, ctaLabel, selected: sel
|
|
|
7126
7249
|
children: [jsx("h2", {
|
|
7127
7250
|
id: "reason-sheet-title",
|
|
7128
7251
|
className: styles$D.title,
|
|
7129
|
-
children: title2
|
|
7252
|
+
children: t(title2)
|
|
7130
7253
|
}), jsx("div", {
|
|
7131
7254
|
className: styles$D.options,
|
|
7132
7255
|
role: "radiogroup",
|
|
@@ -7160,7 +7283,7 @@ function ReasonSheet({ title: title2, options: options2, ctaLabel, selected: sel
|
|
|
7160
7283
|
})
|
|
7161
7284
|
}), jsx("span", {
|
|
7162
7285
|
className: styles$D.label,
|
|
7163
|
-
children: o.label
|
|
7286
|
+
children: t(o.label)
|
|
7164
7287
|
})]
|
|
7165
7288
|
}, o.value))
|
|
7166
7289
|
})]
|
|
@@ -7176,7 +7299,7 @@ function ReasonSheet({ title: title2, options: options2, ctaLabel, selected: sel
|
|
|
7176
7299
|
disabled: !choice,
|
|
7177
7300
|
loading: busy,
|
|
7178
7301
|
onClick: () => choice && onConfirm(choice),
|
|
7179
|
-
children: ctaLabel
|
|
7302
|
+
children: t(ctaLabel)
|
|
7180
7303
|
})]
|
|
7181
7304
|
})]
|
|
7182
7305
|
})
|
|
@@ -7206,6 +7329,7 @@ const styles$C = {
|
|
|
7206
7329
|
};
|
|
7207
7330
|
function ReturnItemRow({ item: item2, className }) {
|
|
7208
7331
|
const { format } = useMoney();
|
|
7332
|
+
const t = useT();
|
|
7209
7333
|
return jsxs("div", {
|
|
7210
7334
|
className: [styles$C.line, className ?? ""].join(" ").trim(),
|
|
7211
7335
|
children: [jsx("div", {
|
|
@@ -7227,7 +7351,7 @@ function ReturnItemRow({ item: item2, className }) {
|
|
|
7227
7351
|
children: item2.title ?? item2.sku
|
|
7228
7352
|
}), item2.attributes?.size && jsx("p", {
|
|
7229
7353
|
className: styles$C.attrs,
|
|
7230
|
-
children:
|
|
7354
|
+
children: t("Size: {0}", item2.attributes.size)
|
|
7231
7355
|
})]
|
|
7232
7356
|
}), jsxs("div", {
|
|
7233
7357
|
className: styles$C.price,
|
|
@@ -7238,7 +7362,7 @@ function ReturnItemRow({ item: item2, className }) {
|
|
|
7238
7362
|
className: styles$C.was,
|
|
7239
7363
|
children: [jsx("span", {
|
|
7240
7364
|
className: "visually-hidden",
|
|
7241
|
-
children:
|
|
7365
|
+
children: t("Was {0}", format(item2.compare_at_unit_price))
|
|
7242
7366
|
}), jsx("span", {
|
|
7243
7367
|
"aria-hidden": "true",
|
|
7244
7368
|
children: format(item2.compare_at_unit_price)
|
|
@@ -7334,6 +7458,7 @@ function unitsLeft(item2) {
|
|
|
7334
7458
|
function ReturnItemsView({ order, onSubmit, busy = false }) {
|
|
7335
7459
|
const [chosen, setChosen] = useState({});
|
|
7336
7460
|
const [reasonFor, setReasonFor] = useState(null);
|
|
7461
|
+
const t = useT();
|
|
7337
7462
|
const returnable = useMemo(() => order.items.filter((i) => unitsLeft(i) > 0), [order.items]);
|
|
7338
7463
|
const selected2 = Object.entries(chosen).filter(([, reason2]) => reason2 !== void 0);
|
|
7339
7464
|
const canSubmit = selected2.length > 0;
|
|
@@ -7372,10 +7497,10 @@ function ReturnItemsView({ order, onSubmit, busy = false }) {
|
|
|
7372
7497
|
className: styles$B.titles,
|
|
7373
7498
|
children: [jsx("h1", {
|
|
7374
7499
|
className: styles$B.title,
|
|
7375
|
-
children: "Nothing left to return"
|
|
7500
|
+
children: t("Nothing left to return")
|
|
7376
7501
|
}), jsx("p", {
|
|
7377
7502
|
className: styles$B.subtitle,
|
|
7378
|
-
children: "Every item on this order has already been returned or cancelled."
|
|
7503
|
+
children: t("Every item on this order has already been returned or cancelled.")
|
|
7379
7504
|
})]
|
|
7380
7505
|
})
|
|
7381
7506
|
});
|
|
@@ -7386,10 +7511,10 @@ function ReturnItemsView({ order, onSubmit, busy = false }) {
|
|
|
7386
7511
|
className: styles$B.titles,
|
|
7387
7512
|
children: [jsx("h1", {
|
|
7388
7513
|
className: styles$B.title,
|
|
7389
|
-
children: "What do you want to return?"
|
|
7514
|
+
children: t("What do you want to return?")
|
|
7390
7515
|
}), jsx("p", {
|
|
7391
7516
|
className: styles$B.subtitle,
|
|
7392
|
-
children: "Select items you want to return"
|
|
7517
|
+
children: t("Select items you want to return")
|
|
7393
7518
|
})]
|
|
7394
7519
|
}), jsx("div", {
|
|
7395
7520
|
className: styles$B.list,
|
|
@@ -7419,7 +7544,7 @@ function ReturnItemsView({ order, onSubmit, busy = false }) {
|
|
|
7419
7544
|
onClick: () => setReasonFor(item2.line_ref),
|
|
7420
7545
|
"aria-haspopup": "dialog",
|
|
7421
7546
|
children: [jsx("span", {
|
|
7422
|
-
children: reason2 ? REASON_LABEL.get(reason2) : "Select reason"
|
|
7547
|
+
children: t(reason2 ? REASON_LABEL.get(reason2) ?? reason2 : "Select reason")
|
|
7423
7548
|
}), jsx(Chevron$1, {})]
|
|
7424
7549
|
})]
|
|
7425
7550
|
})]
|
|
@@ -7431,7 +7556,7 @@ function ReturnItemsView({ order, onSubmit, busy = false }) {
|
|
|
7431
7556
|
disabled: !canSubmit,
|
|
7432
7557
|
loading: busy,
|
|
7433
7558
|
onClick: submit,
|
|
7434
|
-
children: "Return selected items"
|
|
7559
|
+
children: t("Return selected items")
|
|
7435
7560
|
}), reasonFor && jsx(ReasonSheet, {
|
|
7436
7561
|
title: "Reason for return",
|
|
7437
7562
|
options: RETURN_REASONS,
|
|
@@ -7486,6 +7611,7 @@ const styles$A = {
|
|
|
7486
7611
|
note: note$1
|
|
7487
7612
|
};
|
|
7488
7613
|
function ReturnLabelView({ ret, onDone }) {
|
|
7614
|
+
const t = useT();
|
|
7489
7615
|
return jsxs("div", {
|
|
7490
7616
|
className: styles$A.page,
|
|
7491
7617
|
children: [jsxs("div", {
|
|
@@ -7499,10 +7625,10 @@ function ReturnLabelView({ ret, onDone }) {
|
|
|
7499
7625
|
className: styles$A.intro,
|
|
7500
7626
|
children: [jsx("h1", {
|
|
7501
7627
|
className: styles$A.title,
|
|
7502
|
-
children: "We’ve generated your return label"
|
|
7628
|
+
children: t("We’ve generated your return label")
|
|
7503
7629
|
}), jsx("p", {
|
|
7504
7630
|
className: styles$A.subtitle,
|
|
7505
|
-
children: "Follow the instructions below to complete your return"
|
|
7631
|
+
children: t("Follow the instructions below to complete your return")
|
|
7506
7632
|
})]
|
|
7507
7633
|
}), jsxs("div", {
|
|
7508
7634
|
className: styles$A.card,
|
|
@@ -7516,23 +7642,23 @@ function ReturnLabelView({ ret, onDone }) {
|
|
|
7516
7642
|
children: "1"
|
|
7517
7643
|
}), jsx("h2", {
|
|
7518
7644
|
className: styles$A.stepTitle,
|
|
7519
|
-
children: "Download your return label"
|
|
7645
|
+
children: t("Download your return label")
|
|
7520
7646
|
})]
|
|
7521
7647
|
}), jsx("p", {
|
|
7522
7648
|
className: styles$A.body,
|
|
7523
|
-
children: "Tap the button below to download your pre-paid return label"
|
|
7649
|
+
children: t("Tap the button below to download your pre-paid return label")
|
|
7524
7650
|
}), ret.label_url && jsxs("a", {
|
|
7525
7651
|
className: styles$A.download,
|
|
7526
7652
|
href: ret.label_url,
|
|
7527
7653
|
target: "_blank",
|
|
7528
7654
|
rel: "noopener noreferrer",
|
|
7529
|
-
children: ["Download return label", jsx("span", {
|
|
7655
|
+
children: [t("Download return label"), jsx("span", {
|
|
7530
7656
|
className: "visually-hidden",
|
|
7531
|
-
children:
|
|
7657
|
+
children: ` ${t("(opens in a new tab)")}`
|
|
7532
7658
|
})]
|
|
7533
7659
|
}), ret.label_email && jsxs("p", {
|
|
7534
7660
|
className: styles$A.note,
|
|
7535
|
-
children: ["You’ll receive a shipping label PDF to your email as well.", jsx("br", {}), ret.label_email]
|
|
7661
|
+
children: [t("You’ll receive a shipping label PDF to your email as well."), jsx("br", {}), ret.label_email]
|
|
7536
7662
|
})]
|
|
7537
7663
|
}), jsxs("section", {
|
|
7538
7664
|
className: styles$A.step2,
|
|
@@ -7544,11 +7670,11 @@ function ReturnLabelView({ ret, onDone }) {
|
|
|
7544
7670
|
children: "2"
|
|
7545
7671
|
}), jsx("h2", {
|
|
7546
7672
|
className: styles$A.stepTitle,
|
|
7547
|
-
children: "Pack and ship the item"
|
|
7673
|
+
children: t("Pack and ship the item")
|
|
7548
7674
|
})]
|
|
7549
7675
|
}), jsxs("p", {
|
|
7550
7676
|
className: styles$A.body2,
|
|
7551
|
-
children: ["Repackage the item securely and attach the return label to the outside of the package.", jsx("br", {}), "Drop it off at your local carrier or post office."]
|
|
7677
|
+
children: [t("Repackage the item securely and attach the return label to the outside of the package."), jsx("br", {}), t("Drop it off at your local carrier or post office.")]
|
|
7552
7678
|
})]
|
|
7553
7679
|
})]
|
|
7554
7680
|
})]
|
|
@@ -7556,7 +7682,7 @@ function ReturnLabelView({ ret, onDone }) {
|
|
|
7556
7682
|
variant: "primary",
|
|
7557
7683
|
fullWidth: true,
|
|
7558
7684
|
onClick: onDone,
|
|
7559
|
-
children: "Done"
|
|
7685
|
+
children: t("Done")
|
|
7560
7686
|
})]
|
|
7561
7687
|
});
|
|
7562
7688
|
}
|
|
@@ -7598,6 +7724,7 @@ function pctOff(item2) {
|
|
|
7598
7724
|
function ReturnTrackingView({ ret, locale: localeProp }) {
|
|
7599
7725
|
const locale = useLocale(localeProp);
|
|
7600
7726
|
const { format } = useMoney();
|
|
7727
|
+
const t = useT();
|
|
7601
7728
|
const reported = new Date(ret.reported_at).toLocaleDateString(locale, {
|
|
7602
7729
|
day: "numeric",
|
|
7603
7730
|
month: "short",
|
|
@@ -7613,10 +7740,10 @@ function ReturnTrackingView({ ret, locale: localeProp }) {
|
|
|
7613
7740
|
className: styles$z.titles,
|
|
7614
7741
|
children: [jsx("h1", {
|
|
7615
7742
|
className: styles$z.title,
|
|
7616
|
-
children: "Return in progress"
|
|
7743
|
+
children: t("Return in progress")
|
|
7617
7744
|
}), jsx("p", {
|
|
7618
7745
|
className: styles$z.subtitle,
|
|
7619
|
-
children:
|
|
7746
|
+
children: t("Return #{0} · Reported {1}", ret.return_ref, reported)
|
|
7620
7747
|
})]
|
|
7621
7748
|
}), jsx(OrderTimeline, {
|
|
7622
7749
|
progress: ret.progress,
|
|
@@ -7645,7 +7772,7 @@ function ReturnTrackingView({ ret, locale: localeProp }) {
|
|
|
7645
7772
|
}), (item2.attributes?.size || pctOff(item2)) && jsxs("p", {
|
|
7646
7773
|
className: styles$z.attrs,
|
|
7647
7774
|
children: [item2.attributes?.size && jsx("span", {
|
|
7648
|
-
children:
|
|
7775
|
+
children: t("Size: {0}", item2.attributes.size)
|
|
7649
7776
|
}), pctOff(item2) !== void 0 && jsx(SaleBadge, {
|
|
7650
7777
|
pct: pctOff(item2)
|
|
7651
7778
|
})]
|
|
@@ -7838,15 +7965,16 @@ function ChevronRight$1() {
|
|
|
7838
7965
|
})
|
|
7839
7966
|
});
|
|
7840
7967
|
}
|
|
7968
|
+
const useBrowserLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
7841
7969
|
function OrderTrackingView(props) {
|
|
7842
|
-
const
|
|
7843
|
-
if (flow !== null) {
|
|
7970
|
+
const flow = useInPlaceScreen("returnFlow");
|
|
7971
|
+
if (flow.value !== null) {
|
|
7844
7972
|
return jsx(ReturnFlowView, {
|
|
7845
7973
|
orderRef: props.orderRef,
|
|
7846
|
-
...flow ? {
|
|
7847
|
-
returnRef: flow
|
|
7974
|
+
...flow.value ? {
|
|
7975
|
+
returnRef: flow.value
|
|
7848
7976
|
} : {},
|
|
7849
|
-
onDone:
|
|
7977
|
+
onDone: flow.close
|
|
7850
7978
|
});
|
|
7851
7979
|
}
|
|
7852
7980
|
return jsx(ShopSurface, {
|
|
@@ -7854,8 +7982,8 @@ function OrderTrackingView(props) {
|
|
|
7854
7982
|
fill: true,
|
|
7855
7983
|
children: jsx(OrderTrackingContent, {
|
|
7856
7984
|
...props,
|
|
7857
|
-
onStartReturn: props.onStartReturn ?? (() =>
|
|
7858
|
-
onOpenReturn: props.onOpenReturn ??
|
|
7985
|
+
onStartReturn: props.onStartReturn ?? (() => flow.open("")),
|
|
7986
|
+
onOpenReturn: props.onOpenReturn ?? flow.open
|
|
7859
7987
|
})
|
|
7860
7988
|
});
|
|
7861
7989
|
}
|
|
@@ -7886,6 +8014,11 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
|
|
|
7886
8014
|
useEffect(() => {
|
|
7887
8015
|
void load();
|
|
7888
8016
|
}, [load]);
|
|
8017
|
+
const cancelled = order?.status === "cancelled";
|
|
8018
|
+
useBrowserLayoutEffect(() => {
|
|
8019
|
+
if (!cancelled) return;
|
|
8020
|
+
return anchorTop();
|
|
8021
|
+
}, [cancelled]);
|
|
7889
8022
|
if (state === "loading") {
|
|
7890
8023
|
return jsxs("div", {
|
|
7891
8024
|
className: styles$y.page,
|
|
@@ -7971,17 +8104,17 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
|
|
|
7971
8104
|
className: styles$y.cancelledHead,
|
|
7972
8105
|
children: [jsx("h1", {
|
|
7973
8106
|
className: styles$y.cancelledTitle,
|
|
7974
|
-
children: "Order cancelled"
|
|
8107
|
+
children: t("Order cancelled")
|
|
7975
8108
|
}), jsx("p", {
|
|
7976
8109
|
className: styles$y.cancelledMeta,
|
|
7977
|
-
children:
|
|
8110
|
+
children: t("Order #{0} · Placed {1}", shortRef$1(order.order_ref), placedOn(order.placed_at, locale))
|
|
7978
8111
|
})]
|
|
7979
8112
|
}), jsx(Button, {
|
|
7980
8113
|
variant: "primary",
|
|
7981
8114
|
fullWidth: true,
|
|
7982
8115
|
loading: reordering,
|
|
7983
8116
|
onClick: () => void reorder(order),
|
|
7984
|
-
children: "Reorder"
|
|
8117
|
+
children: t("Reorder")
|
|
7985
8118
|
}), jsx(OrderItemsCard, {
|
|
7986
8119
|
order
|
|
7987
8120
|
}), jsx(ShippingAddressCard, {
|
|
@@ -8000,15 +8133,15 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
|
|
|
8000
8133
|
className: styles$y.titleRow,
|
|
8001
8134
|
children: [jsx("h1", {
|
|
8002
8135
|
className: styles$y.headline,
|
|
8003
|
-
children:
|
|
8136
|
+
children: t("Order #{0}", shortRef$1(order.order_ref))
|
|
8004
8137
|
}), order.tracking?.url && inTransit && jsxs("a", {
|
|
8005
8138
|
className: styles$y.track,
|
|
8006
8139
|
href: order.tracking.url,
|
|
8007
8140
|
target: "_blank",
|
|
8008
8141
|
rel: "noopener noreferrer",
|
|
8009
|
-
children: ["Track", jsx("span", {
|
|
8142
|
+
children: [t("Track"), jsx("span", {
|
|
8010
8143
|
className: "visually-hidden",
|
|
8011
|
-
children: ` ${
|
|
8144
|
+
children: ` ${t("{0}, opens in a new tab", order.tracking.carrier)}`
|
|
8012
8145
|
}), jsx(RedirectLink, {})]
|
|
8013
8146
|
})]
|
|
8014
8147
|
}), jsx(OrderTimeline, {
|
|
@@ -8030,7 +8163,7 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
|
|
|
8030
8163
|
type: "button",
|
|
8031
8164
|
className: styles$y.cancel,
|
|
8032
8165
|
onClick: () => setCancelOpen(true),
|
|
8033
|
-
children: "Cancel order"
|
|
8166
|
+
children: t("Cancel order")
|
|
8034
8167
|
}), jsx(NeedHelp, {
|
|
8035
8168
|
order,
|
|
8036
8169
|
...onStartReturn ? {
|
|
@@ -8077,6 +8210,7 @@ function placedOn(iso, locale) {
|
|
|
8077
8210
|
}
|
|
8078
8211
|
function NeedHelp({ order, onStartReturn, onOpenReturn, onContactSupport }) {
|
|
8079
8212
|
const emit = useShopEvent();
|
|
8213
|
+
const t = useT();
|
|
8080
8214
|
if (order.status !== "delivered") return null;
|
|
8081
8215
|
const returns = order.returns ?? [];
|
|
8082
8216
|
return jsxs("section", {
|
|
@@ -8085,11 +8219,11 @@ function NeedHelp({ order, onStartReturn, onOpenReturn, onContactSupport }) {
|
|
|
8085
8219
|
children: [jsx("h2", {
|
|
8086
8220
|
className: styles$y.helpTitle,
|
|
8087
8221
|
id: "order-help",
|
|
8088
|
-
children: "Need help?"
|
|
8222
|
+
children: t("Need help?")
|
|
8089
8223
|
}), jsxs("div", {
|
|
8090
8224
|
className: styles$y.helpRows,
|
|
8091
8225
|
children: [returns.map((ret) => jsx(HelpRow, {
|
|
8092
|
-
label: returns.length > 1 ?
|
|
8226
|
+
label: returns.length > 1 ? t("Track return {0}", ret.return_ref) : "Track your return",
|
|
8093
8227
|
status: RETURN_STATUS[ret.status] ?? ret.status.replace(/_/g, " "),
|
|
8094
8228
|
onClick: () => onOpenReturn?.(ret.return_ref)
|
|
8095
8229
|
}, ret.return_ref)), order.can_return && onStartReturn && jsx(HelpRow, {
|
|
@@ -8120,7 +8254,7 @@ function HelpRow({ label: label2, status, onClick }) {
|
|
|
8120
8254
|
className: styles$y.helpRow,
|
|
8121
8255
|
onClick,
|
|
8122
8256
|
children: [jsx("span", {
|
|
8123
|
-
children: label2
|
|
8257
|
+
children: t(label2)
|
|
8124
8258
|
}), jsxs("span", {
|
|
8125
8259
|
className: styles$y.helpRowEnd,
|
|
8126
8260
|
children: [status && jsx("span", {
|
|
@@ -8173,6 +8307,7 @@ function confirmationProgress(progress2) {
|
|
|
8173
8307
|
});
|
|
8174
8308
|
}
|
|
8175
8309
|
function OrderConfirmationContent({ orderRef, locale: localeProp, onDone }) {
|
|
8310
|
+
const t = useT();
|
|
8176
8311
|
const { api } = useShop();
|
|
8177
8312
|
const locale = useLocale(localeProp);
|
|
8178
8313
|
const [order, setOrder] = useState(null);
|
|
@@ -8219,15 +8354,15 @@ function OrderConfirmationContent({ orderRef, locale: localeProp, onDone }) {
|
|
|
8219
8354
|
className: styles$x.page,
|
|
8220
8355
|
children: [jsxs("section", {
|
|
8221
8356
|
className: styles$x.confirmed,
|
|
8222
|
-
"aria-label": "Order confirmation",
|
|
8357
|
+
"aria-label": t("Order confirmation"),
|
|
8223
8358
|
children: [jsxs("div", {
|
|
8224
8359
|
className: styles$x.title,
|
|
8225
8360
|
children: [jsx("h1", {
|
|
8226
8361
|
className: styles$x.headline,
|
|
8227
|
-
children: "Your order is confirmed"
|
|
8362
|
+
children: t("Your order is confirmed")
|
|
8228
8363
|
}), order.email && jsx("p", {
|
|
8229
8364
|
className: styles$x.subtitle,
|
|
8230
|
-
children:
|
|
8365
|
+
children: t("We’ve sent a confirmation to {0}", order.email)
|
|
8231
8366
|
})]
|
|
8232
8367
|
}), jsx(OrderTimeline, {
|
|
8233
8368
|
progress: confirmationProgress(order.progress),
|
|
@@ -8249,7 +8384,7 @@ function OrderConfirmationContent({ orderRef, locale: localeProp, onDone }) {
|
|
|
8249
8384
|
fullWidth: true,
|
|
8250
8385
|
className: styles$x.done,
|
|
8251
8386
|
onClick: onDone,
|
|
8252
|
-
children: "Done"
|
|
8387
|
+
children: t("Done")
|
|
8253
8388
|
})]
|
|
8254
8389
|
});
|
|
8255
8390
|
}
|
|
@@ -8361,11 +8496,11 @@ function Chevron() {
|
|
|
8361
8496
|
});
|
|
8362
8497
|
}
|
|
8363
8498
|
function OrderListView(props) {
|
|
8364
|
-
const
|
|
8365
|
-
if (opened !== null) {
|
|
8499
|
+
const opened = useInPlaceScreen("return");
|
|
8500
|
+
if (opened.value !== null) {
|
|
8366
8501
|
return jsx(ReturnFlowView, {
|
|
8367
|
-
returnRef: opened,
|
|
8368
|
-
onDone:
|
|
8502
|
+
returnRef: opened.value,
|
|
8503
|
+
onDone: opened.close
|
|
8369
8504
|
});
|
|
8370
8505
|
}
|
|
8371
8506
|
return jsx(ShopSurface, {
|
|
@@ -8373,7 +8508,7 @@ function OrderListView(props) {
|
|
|
8373
8508
|
fill: true,
|
|
8374
8509
|
children: jsx(OrderListContent, {
|
|
8375
8510
|
...props,
|
|
8376
|
-
onOpenReturn: props.onOpenReturn ??
|
|
8511
|
+
onOpenReturn: props.onOpenReturn ?? opened.open
|
|
8377
8512
|
})
|
|
8378
8513
|
});
|
|
8379
8514
|
}
|
|
@@ -8779,6 +8914,7 @@ const styles$s = {
|
|
|
8779
8914
|
};
|
|
8780
8915
|
function ProductGallery({ title: title2, product }) {
|
|
8781
8916
|
const { format } = useMoney();
|
|
8917
|
+
const t = useT();
|
|
8782
8918
|
const pct = product.compare_at ? discountPct(product.price, product.compare_at) : void 0;
|
|
8783
8919
|
const inStock = product.variants.some((v) => v.in_stock);
|
|
8784
8920
|
const images = product.media.length > 0 ? product.media : [void 0];
|
|
@@ -8794,7 +8930,7 @@ function ProductGallery({ title: title2, product }) {
|
|
|
8794
8930
|
className: styles$s.link,
|
|
8795
8931
|
children: [jsx("ul", {
|
|
8796
8932
|
className: styles$s.track,
|
|
8797
|
-
"aria-label":
|
|
8933
|
+
"aria-label": t("{0} photographs", product.title),
|
|
8798
8934
|
children: images.map((src, i) => jsxs("li", {
|
|
8799
8935
|
className: styles$s.frame,
|
|
8800
8936
|
children: [src ? jsx(ShopImage, {
|
|
@@ -8833,7 +8969,7 @@ function ProductGallery({ title: title2, product }) {
|
|
|
8833
8969
|
className: styles$s.was,
|
|
8834
8970
|
children: [jsx("span", {
|
|
8835
8971
|
className: "visually-hidden",
|
|
8836
|
-
children:
|
|
8972
|
+
children: t("Was {0}", format(product.compare_at))
|
|
8837
8973
|
}), jsx("span", {
|
|
8838
8974
|
"aria-hidden": "true",
|
|
8839
8975
|
children: format(product.compare_at)
|
|
@@ -9946,7 +10082,7 @@ function SizeGuideSheet({ guide, onClose }) {
|
|
|
9946
10082
|
}), hasTable && authored && unit2 && jsx("div", {
|
|
9947
10083
|
className: styles$h.units,
|
|
9948
10084
|
role: "radiogroup",
|
|
9949
|
-
"aria-label": "Measurement unit",
|
|
10085
|
+
"aria-label": t("Measurement unit"),
|
|
9950
10086
|
children: [authored, otherUnit(authored)].map((u) => jsx("button", {
|
|
9951
10087
|
type: "button",
|
|
9952
10088
|
role: "radio",
|
|
@@ -9990,7 +10126,7 @@ function SizeGuideSheet({ guide, onClose }) {
|
|
|
9990
10126
|
children: [jsx("h3", {
|
|
9991
10127
|
id: "size-guide-how",
|
|
9992
10128
|
className: styles$h.howTitle,
|
|
9993
|
-
children: "How to measure"
|
|
10129
|
+
children: t("How to measure")
|
|
9994
10130
|
}), jsx("dl", {
|
|
9995
10131
|
className: styles$h.howList,
|
|
9996
10132
|
children: measurements.map((m) => jsxs("div", {
|
|
@@ -10008,7 +10144,7 @@ function SizeGuideSheet({ guide, onClose }) {
|
|
|
10008
10144
|
className: styles$h.fabric,
|
|
10009
10145
|
children: [jsx("p", {
|
|
10010
10146
|
className: styles$h.fabricLabel,
|
|
10011
|
-
children: "Fabric"
|
|
10147
|
+
children: t("Fabric")
|
|
10012
10148
|
}), jsx("p", {
|
|
10013
10149
|
className: styles$h.fabricText,
|
|
10014
10150
|
children: guide.fabric
|
|
@@ -11291,24 +11427,64 @@ function useDocumentSnap(ref, enabled = true) {
|
|
|
11291
11427
|
const root2 = document.documentElement;
|
|
11292
11428
|
const previousType = root2.style.scrollSnapType;
|
|
11293
11429
|
const previousPadding = root2.style.scrollPaddingTop;
|
|
11294
|
-
root2.style.scrollSnapType = "y mandatory";
|
|
11295
11430
|
root2.style.scrollPaddingTop = "0px";
|
|
11431
|
+
let snapping = false;
|
|
11432
|
+
let awaitingTouch = false;
|
|
11433
|
+
const snapOn = () => {
|
|
11434
|
+
root2.style.scrollSnapType = "y mandatory";
|
|
11435
|
+
snapping = true;
|
|
11436
|
+
};
|
|
11437
|
+
const snapOff = () => {
|
|
11438
|
+
root2.style.scrollSnapType = "none";
|
|
11439
|
+
snapping = false;
|
|
11440
|
+
};
|
|
11441
|
+
const snapOnAtTouch = () => {
|
|
11442
|
+
if (awaitingTouch) return;
|
|
11443
|
+
awaitingTouch = true;
|
|
11444
|
+
window.addEventListener("touchstart", snapOn, {
|
|
11445
|
+
once: true,
|
|
11446
|
+
passive: true
|
|
11447
|
+
});
|
|
11448
|
+
};
|
|
11296
11449
|
const top2 = () => window.scrollTo(0, 0);
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
|
|
11450
|
+
let frame2 = null;
|
|
11451
|
+
let release = () => {
|
|
11452
|
+
};
|
|
11453
|
+
const anchor2 = () => {
|
|
11454
|
+
release();
|
|
11455
|
+
if (frame2 !== null && typeof window.cancelAnimationFrame === "function") {
|
|
11456
|
+
window.cancelAnimationFrame(frame2);
|
|
11457
|
+
}
|
|
11458
|
+
snapOff();
|
|
11459
|
+
top2();
|
|
11460
|
+
frame2 = typeof window.requestAnimationFrame === "function" ? window.requestAnimationFrame(() => {
|
|
11461
|
+
top2();
|
|
11462
|
+
snapOn();
|
|
11463
|
+
}) : null;
|
|
11464
|
+
release = anchorTop(() => {
|
|
11465
|
+
if (snapping) {
|
|
11466
|
+
snapOff();
|
|
11467
|
+
snapOnAtTouch();
|
|
11468
|
+
}
|
|
11469
|
+
return true;
|
|
11470
|
+
});
|
|
11471
|
+
};
|
|
11472
|
+
anchor2();
|
|
11300
11473
|
const history = window.history;
|
|
11301
11474
|
const previousRestoration = history && "scrollRestoration" in history ? history.scrollRestoration : null;
|
|
11302
11475
|
if (previousRestoration !== null) history.scrollRestoration = "manual";
|
|
11303
11476
|
const onPageShow = (event) => {
|
|
11304
|
-
if (event.persisted)
|
|
11477
|
+
if (event.persisted) anchor2();
|
|
11305
11478
|
};
|
|
11306
11479
|
window.addEventListener("pageshow", onPageShow);
|
|
11480
|
+
const unobserve = onReveal(el, anchor2);
|
|
11307
11481
|
return () => {
|
|
11482
|
+
unobserve();
|
|
11308
11483
|
release();
|
|
11309
11484
|
if (frame2 !== null && typeof window.cancelAnimationFrame === "function") {
|
|
11310
11485
|
window.cancelAnimationFrame(frame2);
|
|
11311
11486
|
}
|
|
11487
|
+
window.removeEventListener("touchstart", snapOn);
|
|
11312
11488
|
window.removeEventListener("pageshow", onPageShow);
|
|
11313
11489
|
if (previousRestoration !== null) history.scrollRestoration = previousRestoration;
|
|
11314
11490
|
root2.style.scrollSnapType = previousType;
|