@nok-integration/storefront-react 0.19.9 → 0.19.14

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.
@@ -5587,6 +5587,7 @@ const ES = {
5587
5587
  "One moment": "Un momento",
5588
5588
  "One or more items just sold out. Adjust your cart to continue.": "Uno o más artículos se han agotado. Ajusta tu carrito para continuar.",
5589
5589
  "Only {0} left": "Solo quedan {0}",
5590
+ "Only {0} left in {1} size": "Solo quedan {0} en talla {1}",
5590
5591
  "Order #{0}": "Pedido n.º {0}",
5591
5592
  "Order already placed": "Pedido ya realizado",
5592
5593
  "Order not found": "Pedido no encontrado",
@@ -6835,306 +6836,7 @@ function ReasonSheet({ title: title2, options: options2, ctaLabel, selected: sel
6835
6836
  })
6836
6837
  });
6837
6838
  }
6838
- const page$6 = "_page_1v9my_8";
6839
- const widget = "_widget_1v9my_18";
6840
- const titleRow = "_titleRow_1v9my_26";
6841
- const headline$1 = "_headline_1v9my_42";
6842
- const track$5 = "_track_1v9my_74";
6843
- const rule$1 = "_rule_1v9my_99";
6844
- const help = "_help_1v9my_109";
6845
- const helpTitle = "_helpTitle_1v9my_115";
6846
- const helpRows = "_helpRows_1v9my_122";
6847
- const helpRow = "_helpRow_1v9my_122";
6848
- const cancel = "_cancel_1v9my_180";
6849
- const cancelledHead = "_cancelledHead_1v9my_204";
6850
- const cancelledTitle = "_cancelledTitle_1v9my_210";
6851
- const cancelledMeta = "_cancelledMeta_1v9my_219";
6852
- const styles$A = {
6853
- page: page$6,
6854
- widget,
6855
- titleRow,
6856
- headline: headline$1,
6857
- track: track$5,
6858
- rule: rule$1,
6859
- help,
6860
- helpTitle,
6861
- helpRows,
6862
- helpRow,
6863
- cancel,
6864
- cancelledHead,
6865
- cancelledTitle,
6866
- cancelledMeta
6867
- };
6868
- function RedirectLink() {
6869
- return jsxs("svg", {
6870
- width: "14",
6871
- height: "14",
6872
- viewBox: "0 0 14 14",
6873
- fill: "none",
6874
- "aria-hidden": "true",
6875
- children: [jsx("path", {
6876
- d: "M3.37413 1.63539C2.84882 1.63539 2.39164 1.90422 2.08646 2.29534C1.78479 2.68228 1.63445 3.17776 1.63445 3.66795V3.67088L1.66569 10.3328C1.66636 10.8221 1.81652 11.3164 2.1177 11.7025C2.42287 12.0935 2.8802 12.3615 3.40537 12.3615L3.4044 12.3625L10.6248 12.3654C11.1499 12.3653 11.6063 12.0965 11.9115 11.7054C12.2134 11.3185 12.3644 10.8232 12.3645 10.3328V8.33347C12.3645 7.94707 12.0508 7.63363 11.6645 7.63349C11.278 7.63349 10.9645 7.94699 10.9645 8.33347V10.3328C10.9644 10.5489 10.8962 10.7317 10.8083 10.8444C10.7238 10.9526 10.6512 10.9654 10.6248 10.9654L3.40537 10.9625C3.37921 10.9625 3.30653 10.9498 3.22184 10.8415C3.13389 10.7287 3.06474 10.5461 3.06466 10.3299V10.327L3.03342 3.66405C3.03416 3.44927 3.10311 3.26759 3.1906 3.15542C3.27527 3.04709 3.34796 3.03436 3.37413 3.03436H5.44477C5.83092 3.03423 6.14439 2.72147 6.14474 2.33537C6.14474 1.94897 5.83113 1.63553 5.44477 1.63539H3.37413Z",
6877
- fill: "currentColor"
6878
- }), jsx("path", {
6879
- d: "M8.683 1.63442C8.29663 1.63442 7.9832 1.94806 7.98303 2.33439C7.98303 2.72087 8.29652 3.03436 8.683 3.03436H9.97458L6.504 6.50495C6.23093 6.77819 6.23093 7.22163 6.504 7.49487C6.77724 7.76794 7.22068 7.76794 7.49392 7.49487L10.9645 4.02331V5.31587C10.9645 5.70233 11.278 6.01582 11.6645 6.01584C12.0508 6.01571 12.3645 5.70226 12.3645 5.31587V2.33439C12.3643 2.04478 12.1878 1.79638 11.9369 1.69006L11.9271 1.68616C11.9116 1.67987 11.8951 1.67664 11.8793 1.67152C11.8526 1.66289 11.8261 1.6535 11.7982 1.64809C11.7924 1.64696 11.7865 1.64711 11.7807 1.64613C11.7428 1.63977 11.7042 1.63443 11.6645 1.63442H8.683Z",
6880
- fill: "currentColor"
6881
- })]
6882
- });
6883
- }
6884
- function ChevronRight$1() {
6885
- return jsx("svg", {
6886
- width: "16",
6887
- height: "16",
6888
- viewBox: "0 0 16 16",
6889
- fill: "none",
6890
- "aria-hidden": "true",
6891
- children: jsx("g", {
6892
- transform: "translate(4.28 1.96)",
6893
- children: jsx("path", {
6894
- d: "M7.42763 6.03763C7.42763 5.83763 7.33763 5.64763 7.18763 5.51763L1.15763 0.177629C0.867628 -0.0823714 0.427629 -0.0523713 0.177629 0.237629C-0.0823713 0.527629 -0.0523714 0.967629 0.237629 1.22763L5.67763 6.04763L0.237629 10.8576C-0.0523709 11.1176 -0.0823709 11.5576 0.177629 11.8476C0.437629 12.1376 0.877629 12.1676 1.16763 11.9076L7.19763 6.56763C7.34763 6.43763 7.43763 6.24763 7.43763 6.04763L7.42763 6.03763Z",
6895
- fill: "currentColor"
6896
- })
6897
- })
6898
- });
6899
- }
6900
- function OrderTrackingView(props) {
6901
- return jsx(ShopSurface, {
6902
- tone: "light",
6903
- fill: true,
6904
- children: jsx(OrderTrackingContent, {
6905
- ...props
6906
- })
6907
- });
6908
- }
6909
- function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onContactSupport, onCancelled, onReorder }) {
6910
- const t = useT();
6911
- const { api } = useShop();
6912
- const locale = useLocale(localeProp);
6913
- const [order, setOrder] = useState(null);
6914
- const [state, setState] = useState("loading");
6915
- const [errorCode, setErrorCode] = useState(void 0);
6916
- const [cancelOpen, setCancelOpen] = useState(false);
6917
- const [cancelling, setCancelling] = useState(false);
6918
- const [cancelError, setCancelError] = useState(null);
6919
- const emit = useShopEvent();
6920
- const load = useCallback(async () => {
6921
- setState("loading");
6922
- try {
6923
- setOrder(await api.orders.get(orderRef));
6924
- setState("ready");
6925
- } catch (err) {
6926
- setErrorCode(codeOf(err));
6927
- setState("error");
6928
- }
6929
- }, [api, orderRef]);
6930
- useEffect(() => {
6931
- void load();
6932
- }, [load]);
6933
- if (state === "loading") {
6934
- return jsxs("div", {
6935
- className: styles$A.page,
6936
- children: [jsx(Skeleton, {
6937
- height: 206,
6938
- radius: 8
6939
- }), jsx(Skeleton, {
6940
- height: 48,
6941
- radius: 8
6942
- }), jsx(Skeleton, {
6943
- height: 113,
6944
- radius: 18
6945
- }), jsx(Skeleton, {
6946
- height: 240,
6947
- radius: 18
6948
- })]
6949
- });
6950
- }
6951
- if (state === "error" || !order) {
6952
- return jsx(ErrorState, {
6953
- code: errorCode,
6954
- onRetry: () => void load()
6955
- });
6956
- }
6957
- async function confirmCancellation(reason2) {
6958
- setCancelling(true);
6959
- setCancelError(null);
6960
- try {
6961
- const updated = await api.orders.requestCancellation(orderRef, {
6962
- reason: reason2
6963
- });
6964
- setOrder(updated);
6965
- setCancelOpen(false);
6966
- emit({
6967
- type: "order_cancellation_requested",
6968
- orderRef,
6969
- reason: reason2
6970
- });
6971
- onCancelled?.(updated);
6972
- } catch (err) {
6973
- setCancelError(t(treatmentFor(codeOf(err)).body));
6974
- } finally {
6975
- setCancelling(false);
6976
- }
6977
- }
6978
- if (order.status === "cancelled") {
6979
- return jsxs("div", {
6980
- className: styles$A.page,
6981
- children: [jsxs("div", {
6982
- className: styles$A.cancelledHead,
6983
- children: [jsx("h1", {
6984
- className: styles$A.cancelledTitle,
6985
- children: "Order cancelled"
6986
- }), jsx("p", {
6987
- className: styles$A.cancelledMeta,
6988
- children: `Order #${shortRef$1(order.order_ref)} · Placed ${placedOn(order.placed_at, locale)}`
6989
- })]
6990
- }), onReorder && jsx(Button, {
6991
- variant: "primary",
6992
- fullWidth: true,
6993
- onClick: () => {
6994
- emit({
6995
- type: "reorder_requested",
6996
- orderRef: order.order_ref
6997
- });
6998
- onReorder();
6999
- },
7000
- children: "Reorder"
7001
- }), jsx(OrderLines, {
7002
- order
7003
- }), jsx(ShippingAddressCard, {
7004
- order
7005
- }), jsx(OrderSummaryCard, {
7006
- order
7007
- })]
7008
- });
7009
- }
7010
- return jsxs("div", {
7011
- className: styles$A.page,
7012
- children: [jsxs("section", {
7013
- className: styles$A.widget,
7014
- "aria-label": t("Delivery status"),
7015
- children: [jsxs("div", {
7016
- className: styles$A.titleRow,
7017
- children: [jsx("h1", {
7018
- className: styles$A.headline,
7019
- children: `Order #${shortRef$1(order.order_ref)}`
7020
- }), order.tracking?.url && jsxs("a", {
7021
- className: styles$A.track,
7022
- href: order.tracking.url,
7023
- target: "_blank",
7024
- rel: "noopener noreferrer",
7025
- children: ["Track", jsx("span", {
7026
- className: "visually-hidden",
7027
- children: ` ${order.tracking.carrier}, opens in a new tab`
7028
- }), jsx(RedirectLink, {})]
7029
- })]
7030
- }), jsx(OrderTimeline, {
7031
- progress: order.progress,
7032
- ...order.estimated_delivery ? {
7033
- estimatedDelivery: order.estimated_delivery
7034
- } : {},
7035
- locale
7036
- }), order.can_return && onStartReturn && jsx(Button, {
7037
- variant: "secondary",
7038
- fullWidth: true,
7039
- onClick: onStartReturn,
7040
- children: "Return items"
7041
- })]
7042
- }), jsx("hr", {
7043
- className: styles$A.rule
7044
- }), jsx(OrderLines, {
7045
- order
7046
- }), jsx(ShippingAddressCard, {
7047
- order
7048
- }), jsx(OrderSummaryCard, {
7049
- order
7050
- }), order.can_cancel && jsx("button", {
7051
- type: "button",
7052
- className: styles$A.cancel,
7053
- onClick: () => setCancelOpen(true),
7054
- children: "Cancel order"
7055
- }), jsx(NeedHelp, {
7056
- order,
7057
- ...onStartReturn ? {
7058
- onStartReturn
7059
- } : {},
7060
- ...onContactSupport ? {
7061
- onContactSupport
7062
- } : {}
7063
- }), cancelOpen && jsx(ReasonSheet, {
7064
- title: "Reason for cancelling",
7065
- options: CANCEL_REASONS,
7066
- ctaLabel: "Cancel order",
7067
- closeLabel: "Close reasons",
7068
- busy: cancelling,
7069
- onClose: () => setCancelOpen(false),
7070
- onConfirm: (reason2) => void confirmCancellation(reason2),
7071
- ...cancelError ? {
7072
- error: cancelError
7073
- } : {}
7074
- })]
7075
- });
7076
- }
7077
- const CANCEL_REASONS = [{
7078
- value: "changed_my_mind",
7079
- label: "Changed my mind"
7080
- }, {
7081
- value: "ordered_by_mistake",
7082
- label: "Ordered by mistake"
7083
- }, {
7084
- value: "delivery_too_long",
7085
- label: "Delivery takes too long"
7086
- }];
7087
- function placedOn(iso, locale) {
7088
- const d = new Date(iso);
7089
- const day = d.getUTCDate();
7090
- const month = new Intl.DateTimeFormat(locale, {
7091
- month: "short",
7092
- timeZone: "UTC"
7093
- }).format(d);
7094
- return `${day} ${month}, ${d.getUTCFullYear()}`;
7095
- }
7096
- function NeedHelp({ order, onStartReturn, onContactSupport }) {
7097
- const emit = useShopEvent();
7098
- if (order.status !== "delivered") return null;
7099
- return jsxs("section", {
7100
- className: styles$A.help,
7101
- "aria-labelledby": "order-help",
7102
- children: [jsx("h2", {
7103
- className: styles$A.helpTitle,
7104
- id: "order-help",
7105
- children: "Need help?"
7106
- }), jsxs("div", {
7107
- className: styles$A.helpRows,
7108
- children: [onStartReturn && jsx(HelpRow, {
7109
- label: "Start a return",
7110
- onClick: onStartReturn
7111
- }), jsx(HelpRow, {
7112
- label: "Contact support",
7113
- onClick: () => {
7114
- emit({
7115
- type: "support_requested",
7116
- orderRef: order.order_ref
7117
- });
7118
- onContactSupport?.();
7119
- }
7120
- })]
7121
- })]
7122
- });
7123
- }
7124
- function HelpRow({ label: label2, onClick }) {
7125
- return jsxs("button", {
7126
- type: "button",
7127
- className: styles$A.helpRow,
7128
- onClick,
7129
- children: [jsx("span", {
7130
- children: label2
7131
- }), jsx(ChevronRight$1, {})]
7132
- });
7133
- }
7134
- function shortRef$1(orderRef) {
7135
- return orderRef.replace(/^ord_/, "");
7136
- }
7137
- const page$5 = "_page_1c7ro_7";
6839
+ const page$6 = "_page_1c7ro_7";
7138
6840
  const titles$2 = "_titles_1c7ro_15";
7139
6841
  const title$k = "_title_1c7ro_15";
7140
6842
  const subtitle$7 = "_subtitle_1c7ro_30";
@@ -7155,8 +6857,8 @@ const paid$2 = "_paid_1c7ro_176";
7155
6857
  const was$3 = "_was_1c7ro_184";
7156
6858
  const reason = "_reason_1c7ro_199";
7157
6859
  const reasonSet = "_reasonSet_1c7ro_217";
7158
- const styles$z = {
7159
- page: page$5,
6860
+ const styles$A = {
6861
+ page: page$6,
7160
6862
  titles: titles$2,
7161
6863
  title: title$k,
7162
6864
  subtitle: subtitle$7,
@@ -7271,72 +6973,72 @@ function ReturnItemsView({ order, onSubmit, busy = false }) {
7271
6973
  if (items2.length > 0) onSubmit(items2);
7272
6974
  }
7273
6975
  return jsxs("div", {
7274
- className: styles$z.page,
6976
+ className: styles$A.page,
7275
6977
  children: [jsxs("div", {
7276
- className: styles$z.titles,
6978
+ className: styles$A.titles,
7277
6979
  children: [jsx("h1", {
7278
- className: styles$z.title,
6980
+ className: styles$A.title,
7279
6981
  children: "What do you want to return?"
7280
6982
  }), jsx("p", {
7281
- className: styles$z.subtitle,
6983
+ className: styles$A.subtitle,
7282
6984
  children: "Select items you want to return"
7283
6985
  })]
7284
6986
  }), jsx("div", {
7285
- className: styles$z.list,
6987
+ className: styles$A.list,
7286
6988
  children: returnable.map((item2) => {
7287
6989
  const picked = item2.line_ref in chosen;
7288
6990
  const reason2 = chosen[item2.line_ref];
7289
6991
  return jsxs("div", {
7290
- className: styles$z.card,
6992
+ className: styles$A.card,
7291
6993
  children: [jsx("button", {
7292
6994
  type: "button",
7293
6995
  role: "checkbox",
7294
6996
  "aria-checked": picked,
7295
6997
  "aria-label": item2.title ?? item2.sku,
7296
- className: styles$z.checkSlot,
6998
+ className: styles$A.checkSlot,
7297
6999
  onClick: () => toggle2(item2.line_ref),
7298
7000
  children: jsx("span", {
7299
- className: styles$z.check,
7001
+ className: styles$A.check,
7300
7002
  children: picked ? jsx(Tick, {}) : null
7301
7003
  })
7302
7004
  }), jsxs("div", {
7303
- className: styles$z.row,
7005
+ className: styles$A.row,
7304
7006
  children: [jsxs("div", {
7305
- className: styles$z.line,
7007
+ className: styles$A.line,
7306
7008
  children: [jsx("div", {
7307
- className: styles$z.thumb,
7009
+ className: styles$A.thumb,
7308
7010
  children: item2.image ? jsx(ShopImage, {
7309
7011
  src: item2.image,
7310
7012
  alt: "",
7311
7013
  fill: true,
7312
7014
  sizes: "48px",
7313
- className: styles$z.img
7015
+ className: styles$A.img
7314
7016
  }) : jsx("div", {
7315
- className: styles$z.placeholder,
7017
+ className: styles$A.placeholder,
7316
7018
  "aria-hidden": "true"
7317
7019
  })
7318
7020
  }), jsxs("div", {
7319
- className: styles$z.meta,
7021
+ className: styles$A.meta,
7320
7022
  children: [jsx("p", {
7321
- className: styles$z.name,
7023
+ className: styles$A.name,
7322
7024
  children: item2.title ?? item2.sku
7323
7025
  }), item2.attributes?.size && jsx("p", {
7324
- className: styles$z.attrs,
7026
+ className: styles$A.attrs,
7325
7027
  children: `Size: ${item2.attributes.size}`
7326
7028
  })]
7327
7029
  }), jsxs("div", {
7328
- className: styles$z.price,
7030
+ className: styles$A.price,
7329
7031
  children: [jsx("span", {
7330
- className: styles$z.paid,
7032
+ className: styles$A.paid,
7331
7033
  children: format(item2.unit_price)
7332
7034
  }), item2.compare_at_unit_price && jsx("span", {
7333
- className: styles$z.was,
7035
+ className: styles$A.was,
7334
7036
  children: format(item2.compare_at_unit_price)
7335
7037
  })]
7336
7038
  })]
7337
7039
  }), jsxs("button", {
7338
7040
  type: "button",
7339
- className: `${styles$z.reason} ${reason2 ? styles$z.reasonSet : ""}`,
7041
+ className: `${styles$A.reason} ${reason2 ? styles$A.reasonSet : ""}`,
7340
7042
  onClick: () => setReasonFor(item2.line_ref),
7341
7043
  "aria-haspopup": "dialog",
7342
7044
  children: [jsx("span", {
@@ -7372,7 +7074,7 @@ function ReturnItemsView({ order, onSubmit, busy = false }) {
7372
7074
  })]
7373
7075
  });
7374
7076
  }
7375
- const page$4 = "_page_1r0ea_7";
7077
+ const page$5 = "_page_1r0ea_7";
7376
7078
  const intro$1 = "_intro_1r0ea_15";
7377
7079
  const title$j = "_title_1r0ea_22";
7378
7080
  const subtitle$6 = "_subtitle_1r0ea_31";
@@ -7386,8 +7088,8 @@ const body$5 = "_body_1r0ea_95";
7386
7088
  const body2 = "_body2_1r0ea_103";
7387
7089
  const download = "_download_1r0ea_121";
7388
7090
  const note$1 = "_note_1r0ea_143";
7389
- const styles$y = {
7390
- page: page$4,
7091
+ const styles$z = {
7092
+ page: page$5,
7391
7093
  intro: intro$1,
7392
7094
  title: title$j,
7393
7095
  subtitle: subtitle$6,
@@ -7404,35 +7106,35 @@ const styles$y = {
7404
7106
  };
7405
7107
  function ReturnLabelView({ ret, onDone }) {
7406
7108
  return jsxs("div", {
7407
- className: styles$y.page,
7109
+ className: styles$z.page,
7408
7110
  children: [jsxs("div", {
7409
- className: styles$y.intro,
7111
+ className: styles$z.intro,
7410
7112
  children: [jsx("h1", {
7411
- className: styles$y.title,
7113
+ className: styles$z.title,
7412
7114
  children: "We’ve generated your return label"
7413
7115
  }), jsx("p", {
7414
- className: styles$y.subtitle,
7116
+ className: styles$z.subtitle,
7415
7117
  children: "Follow the instructions below to complete your return"
7416
7118
  })]
7417
7119
  }), jsxs("div", {
7418
- className: styles$y.card,
7120
+ className: styles$z.card,
7419
7121
  children: [jsxs("section", {
7420
- className: styles$y.step,
7122
+ className: styles$z.step,
7421
7123
  children: [jsxs("div", {
7422
- className: styles$y.stepHead,
7124
+ className: styles$z.stepHead,
7423
7125
  children: [jsx("span", {
7424
- className: styles$y.number,
7126
+ className: styles$z.number,
7425
7127
  "aria-hidden": "true",
7426
7128
  children: "1"
7427
7129
  }), jsx("h2", {
7428
- className: styles$y.stepTitle,
7130
+ className: styles$z.stepTitle,
7429
7131
  children: "Download your return label"
7430
7132
  })]
7431
7133
  }), jsx("p", {
7432
- className: styles$y.body,
7134
+ className: styles$z.body,
7433
7135
  children: "Tap the button below to download your pre-paid return label"
7434
7136
  }), ret.label_url && jsxs("a", {
7435
- className: styles$y.download,
7137
+ className: styles$z.download,
7436
7138
  href: ret.label_url,
7437
7139
  target: "_blank",
7438
7140
  rel: "noopener noreferrer",
@@ -7441,23 +7143,23 @@ function ReturnLabelView({ ret, onDone }) {
7441
7143
  children: " (opens in a new tab)"
7442
7144
  })]
7443
7145
  }), ret.label_email && jsxs("p", {
7444
- className: styles$y.note,
7146
+ className: styles$z.note,
7445
7147
  children: ["You’ll receive a shipping label PDF to your email as well.", jsx("br", {}), ret.label_email]
7446
7148
  })]
7447
7149
  }), jsxs("section", {
7448
- className: styles$y.step2,
7150
+ className: styles$z.step2,
7449
7151
  children: [jsxs("div", {
7450
- className: styles$y.stepHead,
7152
+ className: styles$z.stepHead,
7451
7153
  children: [jsx("span", {
7452
- className: styles$y.number,
7154
+ className: styles$z.number,
7453
7155
  "aria-hidden": "true",
7454
7156
  children: "2"
7455
7157
  }), jsx("h2", {
7456
- className: styles$y.stepTitle,
7158
+ className: styles$z.stepTitle,
7457
7159
  children: "Pack and ship the item"
7458
7160
  })]
7459
7161
  }), jsxs("p", {
7460
- className: styles$y.body2,
7162
+ className: styles$z.body2,
7461
7163
  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."]
7462
7164
  })]
7463
7165
  })]
@@ -7469,7 +7171,7 @@ function ReturnLabelView({ ret, onDone }) {
7469
7171
  })]
7470
7172
  });
7471
7173
  }
7472
- const page$3 = "_page_o44fl_8";
7174
+ const page$4 = "_page_o44fl_8";
7473
7175
  const titles$1 = "_titles_o44fl_15";
7474
7176
  const title$i = "_title_o44fl_15";
7475
7177
  const subtitle$5 = "_subtitle_o44fl_30";
@@ -7484,8 +7186,8 @@ const attrs = "_attrs_o44fl_100";
7484
7186
  const price$2 = "_price_o44fl_115";
7485
7187
  const paid$1 = "_paid_o44fl_124";
7486
7188
  const was$2 = "_was_o44fl_132";
7487
- const styles$x = {
7488
- page: page$3,
7189
+ const styles$y = {
7190
+ page: page$4,
7489
7191
  titles: titles$1,
7490
7192
  title: title$i,
7491
7193
  subtitle: subtitle$5,
@@ -7517,42 +7219,42 @@ function ReturnTrackingView({ ret, locale: localeProp }) {
7517
7219
  tone: "light",
7518
7220
  fill: true,
7519
7221
  children: jsxs("div", {
7520
- className: styles$x.page,
7222
+ className: styles$y.page,
7521
7223
  children: [jsxs("div", {
7522
- className: styles$x.titles,
7224
+ className: styles$y.titles,
7523
7225
  children: [jsx("h1", {
7524
- className: styles$x.title,
7226
+ className: styles$y.title,
7525
7227
  children: "Return in progress"
7526
7228
  }), jsx("p", {
7527
- className: styles$x.subtitle,
7229
+ className: styles$y.subtitle,
7528
7230
  children: `Return #${ret.return_ref} · Reported ${reported}`
7529
7231
  })]
7530
7232
  }), jsx(OrderTimeline, {
7531
7233
  progress: ret.progress,
7532
7234
  locale
7533
7235
  }), jsx("ul", {
7534
- className: styles$x.items,
7236
+ className: styles$y.items,
7535
7237
  children: ret.items.map((item2) => jsxs("li", {
7536
- className: styles$x.item,
7238
+ className: styles$y.item,
7537
7239
  children: [jsx("div", {
7538
- className: styles$x.thumb,
7240
+ className: styles$y.thumb,
7539
7241
  children: item2.image ? jsx(ShopImage, {
7540
7242
  src: item2.image,
7541
7243
  alt: "",
7542
7244
  fill: true,
7543
7245
  sizes: "48px",
7544
- className: styles$x.img
7246
+ className: styles$y.img
7545
7247
  }) : jsx("div", {
7546
- className: styles$x.placeholder,
7248
+ className: styles$y.placeholder,
7547
7249
  "aria-hidden": "true"
7548
7250
  })
7549
7251
  }), jsxs("div", {
7550
- className: styles$x.meta,
7252
+ className: styles$y.meta,
7551
7253
  children: [jsx("p", {
7552
- className: styles$x.name,
7254
+ className: styles$y.name,
7553
7255
  children: item2.title ?? item2.sku
7554
7256
  }), (item2.attributes?.size || pctOff(item2)) && jsxs("p", {
7555
- className: styles$x.attrs,
7257
+ className: styles$y.attrs,
7556
7258
  children: [item2.attributes?.size && jsx("span", {
7557
7259
  children: `Size: ${item2.attributes.size}`
7558
7260
  }), pctOff(item2) !== void 0 && jsx(SaleBadge, {
@@ -7560,12 +7262,12 @@ function ReturnTrackingView({ ret, locale: localeProp }) {
7560
7262
  })]
7561
7263
  })]
7562
7264
  }), jsxs("div", {
7563
- className: styles$x.price,
7265
+ className: styles$y.price,
7564
7266
  children: [jsx("span", {
7565
- className: styles$x.paid,
7267
+ className: styles$y.paid,
7566
7268
  children: format(item2.unit_price)
7567
7269
  }), item2.compare_at_unit_price && jsx("span", {
7568
- className: styles$x.was,
7270
+ className: styles$y.was,
7569
7271
  children: format(item2.compare_at_unit_price)
7570
7272
  })]
7571
7273
  })]
@@ -7612,72 +7314,376 @@ function ReturnFlowContent({ orderRef, returnRef, onDone, locale }) {
7612
7314
  if (!orderRef) return;
7613
7315
  setBusy(true);
7614
7316
  try {
7615
- const created = await api.orders.createReturn(orderRef, {
7616
- items: items2
7617
- });
7618
- setRet(created);
7619
- emit({
7620
- type: "return_requested",
7621
- orderRef,
7622
- returnRef: created.return_ref
7623
- });
7317
+ const created = await api.orders.createReturn(orderRef, {
7318
+ items: items2
7319
+ });
7320
+ setRet(created);
7321
+ emit({
7322
+ type: "return_requested",
7323
+ orderRef,
7324
+ returnRef: created.return_ref
7325
+ });
7326
+ } catch (err) {
7327
+ setErrorCode(codeOf(err));
7328
+ setState("error");
7329
+ setBusy(false);
7330
+ }
7331
+ }
7332
+ if (state === "loading") {
7333
+ return jsx("div", {
7334
+ style: {
7335
+ padding: "var(--space-16)",
7336
+ display: "flex",
7337
+ flexDirection: "column",
7338
+ gap: "var(--space-16)"
7339
+ },
7340
+ children: [0, 1, 2].map((i) => jsx(Skeleton, {
7341
+ height: 88,
7342
+ radius: 8
7343
+ }, i))
7344
+ });
7345
+ }
7346
+ if (state === "error") {
7347
+ return jsx(ErrorState, {
7348
+ code: errorCode,
7349
+ onRetry: () => void load()
7350
+ });
7351
+ }
7352
+ if (ret) {
7353
+ return ret.status === "reported" ? jsx(ReturnLabelView, {
7354
+ ret,
7355
+ ...onDone ? {
7356
+ onDone
7357
+ } : {}
7358
+ }) : jsx(ReturnTrackingView, {
7359
+ ret,
7360
+ ...locale ? {
7361
+ locale
7362
+ } : {}
7363
+ });
7364
+ }
7365
+ if (!order) {
7366
+ return jsx(ErrorState, {
7367
+ code: errorCode,
7368
+ onRetry: () => void load()
7369
+ });
7370
+ }
7371
+ if (!order.can_return) {
7372
+ return jsx(ErrorState, {
7373
+ code: "order_not_cancellable",
7374
+ onRetry: () => void load()
7375
+ });
7376
+ }
7377
+ return jsx(ReturnItemsView, {
7378
+ order,
7379
+ onSubmit: (items2) => void submit(items2),
7380
+ busy
7381
+ });
7382
+ }
7383
+ const page$3 = "_page_1v9my_8";
7384
+ const widget = "_widget_1v9my_18";
7385
+ const titleRow = "_titleRow_1v9my_26";
7386
+ const headline$1 = "_headline_1v9my_42";
7387
+ const track$5 = "_track_1v9my_74";
7388
+ const rule$1 = "_rule_1v9my_99";
7389
+ const help = "_help_1v9my_109";
7390
+ const helpTitle = "_helpTitle_1v9my_115";
7391
+ const helpRows = "_helpRows_1v9my_122";
7392
+ const helpRow = "_helpRow_1v9my_122";
7393
+ const cancel = "_cancel_1v9my_180";
7394
+ const cancelledHead = "_cancelledHead_1v9my_204";
7395
+ const cancelledTitle = "_cancelledTitle_1v9my_210";
7396
+ const cancelledMeta = "_cancelledMeta_1v9my_219";
7397
+ const styles$x = {
7398
+ page: page$3,
7399
+ widget,
7400
+ titleRow,
7401
+ headline: headline$1,
7402
+ track: track$5,
7403
+ rule: rule$1,
7404
+ help,
7405
+ helpTitle,
7406
+ helpRows,
7407
+ helpRow,
7408
+ cancel,
7409
+ cancelledHead,
7410
+ cancelledTitle,
7411
+ cancelledMeta
7412
+ };
7413
+ function RedirectLink() {
7414
+ return jsxs("svg", {
7415
+ width: "14",
7416
+ height: "14",
7417
+ viewBox: "0 0 14 14",
7418
+ fill: "none",
7419
+ "aria-hidden": "true",
7420
+ children: [jsx("path", {
7421
+ d: "M3.37413 1.63539C2.84882 1.63539 2.39164 1.90422 2.08646 2.29534C1.78479 2.68228 1.63445 3.17776 1.63445 3.66795V3.67088L1.66569 10.3328C1.66636 10.8221 1.81652 11.3164 2.1177 11.7025C2.42287 12.0935 2.8802 12.3615 3.40537 12.3615L3.4044 12.3625L10.6248 12.3654C11.1499 12.3653 11.6063 12.0965 11.9115 11.7054C12.2134 11.3185 12.3644 10.8232 12.3645 10.3328V8.33347C12.3645 7.94707 12.0508 7.63363 11.6645 7.63349C11.278 7.63349 10.9645 7.94699 10.9645 8.33347V10.3328C10.9644 10.5489 10.8962 10.7317 10.8083 10.8444C10.7238 10.9526 10.6512 10.9654 10.6248 10.9654L3.40537 10.9625C3.37921 10.9625 3.30653 10.9498 3.22184 10.8415C3.13389 10.7287 3.06474 10.5461 3.06466 10.3299V10.327L3.03342 3.66405C3.03416 3.44927 3.10311 3.26759 3.1906 3.15542C3.27527 3.04709 3.34796 3.03436 3.37413 3.03436H5.44477C5.83092 3.03423 6.14439 2.72147 6.14474 2.33537C6.14474 1.94897 5.83113 1.63553 5.44477 1.63539H3.37413Z",
7422
+ fill: "currentColor"
7423
+ }), jsx("path", {
7424
+ d: "M8.683 1.63442C8.29663 1.63442 7.9832 1.94806 7.98303 2.33439C7.98303 2.72087 8.29652 3.03436 8.683 3.03436H9.97458L6.504 6.50495C6.23093 6.77819 6.23093 7.22163 6.504 7.49487C6.77724 7.76794 7.22068 7.76794 7.49392 7.49487L10.9645 4.02331V5.31587C10.9645 5.70233 11.278 6.01582 11.6645 6.01584C12.0508 6.01571 12.3645 5.70226 12.3645 5.31587V2.33439C12.3643 2.04478 12.1878 1.79638 11.9369 1.69006L11.9271 1.68616C11.9116 1.67987 11.8951 1.67664 11.8793 1.67152C11.8526 1.66289 11.8261 1.6535 11.7982 1.64809C11.7924 1.64696 11.7865 1.64711 11.7807 1.64613C11.7428 1.63977 11.7042 1.63443 11.6645 1.63442H8.683Z",
7425
+ fill: "currentColor"
7426
+ })]
7427
+ });
7428
+ }
7429
+ function ChevronRight$1() {
7430
+ return jsx("svg", {
7431
+ width: "16",
7432
+ height: "16",
7433
+ viewBox: "0 0 16 16",
7434
+ fill: "none",
7435
+ "aria-hidden": "true",
7436
+ children: jsx("g", {
7437
+ transform: "translate(4.28 1.96)",
7438
+ children: jsx("path", {
7439
+ d: "M7.42763 6.03763C7.42763 5.83763 7.33763 5.64763 7.18763 5.51763L1.15763 0.177629C0.867628 -0.0823714 0.427629 -0.0523713 0.177629 0.237629C-0.0823713 0.527629 -0.0523714 0.967629 0.237629 1.22763L5.67763 6.04763L0.237629 10.8576C-0.0523709 11.1176 -0.0823709 11.5576 0.177629 11.8476C0.437629 12.1376 0.877629 12.1676 1.16763 11.9076L7.19763 6.56763C7.34763 6.43763 7.43763 6.24763 7.43763 6.04763L7.42763 6.03763Z",
7440
+ fill: "currentColor"
7441
+ })
7442
+ })
7443
+ });
7444
+ }
7445
+ function OrderTrackingView(props) {
7446
+ const [returning, setReturning] = useState(false);
7447
+ if (returning) {
7448
+ return jsx(ReturnFlowView, {
7449
+ orderRef: props.orderRef,
7450
+ onDone: () => setReturning(false)
7451
+ });
7452
+ }
7453
+ return jsx(ShopSurface, {
7454
+ tone: "light",
7455
+ fill: true,
7456
+ children: jsx(OrderTrackingContent, {
7457
+ ...props,
7458
+ onStartReturn: props.onStartReturn ?? (() => setReturning(true))
7459
+ })
7460
+ });
7461
+ }
7462
+ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onContactSupport, onCancelled, onReorder }) {
7463
+ const t = useT();
7464
+ const { api } = useShop();
7465
+ const locale = useLocale(localeProp);
7466
+ const [order, setOrder] = useState(null);
7467
+ const [state, setState] = useState("loading");
7468
+ const [errorCode, setErrorCode] = useState(void 0);
7469
+ const [cancelOpen, setCancelOpen] = useState(false);
7470
+ const [cancelling, setCancelling] = useState(false);
7471
+ const [cancelError, setCancelError] = useState(null);
7472
+ const emit = useShopEvent();
7473
+ const load = useCallback(async () => {
7474
+ setState("loading");
7475
+ try {
7476
+ setOrder(await api.orders.get(orderRef));
7477
+ setState("ready");
7624
7478
  } catch (err) {
7625
7479
  setErrorCode(codeOf(err));
7626
7480
  setState("error");
7627
- setBusy(false);
7628
7481
  }
7629
- }
7482
+ }, [api, orderRef]);
7483
+ useEffect(() => {
7484
+ void load();
7485
+ }, [load]);
7630
7486
  if (state === "loading") {
7631
- return jsx("div", {
7632
- style: {
7633
- padding: "var(--space-16)",
7634
- display: "flex",
7635
- flexDirection: "column",
7636
- gap: "var(--space-16)"
7637
- },
7638
- children: [0, 1, 2].map((i) => jsx(Skeleton, {
7639
- height: 88,
7487
+ return jsxs("div", {
7488
+ className: styles$x.page,
7489
+ children: [jsx(Skeleton, {
7490
+ height: 206,
7640
7491
  radius: 8
7641
- }, i))
7492
+ }), jsx(Skeleton, {
7493
+ height: 48,
7494
+ radius: 8
7495
+ }), jsx(Skeleton, {
7496
+ height: 113,
7497
+ radius: 18
7498
+ }), jsx(Skeleton, {
7499
+ height: 240,
7500
+ radius: 18
7501
+ })]
7642
7502
  });
7643
7503
  }
7644
- if (state === "error") {
7504
+ if (state === "error" || !order) {
7645
7505
  return jsx(ErrorState, {
7646
7506
  code: errorCode,
7647
7507
  onRetry: () => void load()
7648
7508
  });
7649
7509
  }
7650
- if (ret) {
7651
- return ret.status === "reported" ? jsx(ReturnLabelView, {
7652
- ret,
7653
- ...onDone ? {
7654
- onDone
7655
- } : {}
7656
- }) : jsx(ReturnTrackingView, {
7657
- ret,
7658
- ...locale ? {
7659
- locale
7660
- } : {}
7661
- });
7662
- }
7663
- if (!order) {
7664
- return jsx(ErrorState, {
7665
- code: errorCode,
7666
- onRetry: () => void load()
7667
- });
7510
+ const currentStep = order.progress.find((entry) => entry.current)?.step;
7511
+ const inTransit = currentStep === "on_its_way" || currentStep === "out_for_delivery";
7512
+ async function confirmCancellation(reason2) {
7513
+ setCancelling(true);
7514
+ setCancelError(null);
7515
+ try {
7516
+ const updated = await api.orders.requestCancellation(orderRef, {
7517
+ reason: reason2
7518
+ });
7519
+ setOrder(updated);
7520
+ setCancelOpen(false);
7521
+ emit({
7522
+ type: "order_cancellation_requested",
7523
+ orderRef,
7524
+ reason: reason2
7525
+ });
7526
+ onCancelled?.(updated);
7527
+ } catch (err) {
7528
+ setCancelError(t(treatmentFor(codeOf(err)).body));
7529
+ } finally {
7530
+ setCancelling(false);
7531
+ }
7668
7532
  }
7669
- if (!order.can_return) {
7670
- return jsx(ErrorState, {
7671
- code: "order_not_cancellable",
7672
- onRetry: () => void load()
7533
+ if (order.status === "cancelled") {
7534
+ return jsxs("div", {
7535
+ className: styles$x.page,
7536
+ children: [jsxs("div", {
7537
+ className: styles$x.cancelledHead,
7538
+ children: [jsx("h1", {
7539
+ className: styles$x.cancelledTitle,
7540
+ children: "Order cancelled"
7541
+ }), jsx("p", {
7542
+ className: styles$x.cancelledMeta,
7543
+ children: `Order #${shortRef$1(order.order_ref)} · Placed ${placedOn(order.placed_at, locale)}`
7544
+ })]
7545
+ }), onReorder && jsx(Button, {
7546
+ variant: "primary",
7547
+ fullWidth: true,
7548
+ onClick: () => {
7549
+ emit({
7550
+ type: "reorder_requested",
7551
+ orderRef: order.order_ref
7552
+ });
7553
+ onReorder();
7554
+ },
7555
+ children: "Reorder"
7556
+ }), jsx(OrderLines, {
7557
+ order
7558
+ }), jsx(ShippingAddressCard, {
7559
+ order
7560
+ }), jsx(OrderSummaryCard, {
7561
+ order
7562
+ })]
7673
7563
  });
7674
7564
  }
7675
- return jsx(ReturnItemsView, {
7676
- order,
7677
- onSubmit: (items2) => void submit(items2),
7678
- busy
7565
+ return jsxs("div", {
7566
+ className: styles$x.page,
7567
+ children: [jsxs("section", {
7568
+ className: styles$x.widget,
7569
+ "aria-label": t("Delivery status"),
7570
+ children: [jsxs("div", {
7571
+ className: styles$x.titleRow,
7572
+ children: [jsx("h1", {
7573
+ className: styles$x.headline,
7574
+ children: `Order #${shortRef$1(order.order_ref)}`
7575
+ }), order.tracking?.url && inTransit && jsxs("a", {
7576
+ className: styles$x.track,
7577
+ href: order.tracking.url,
7578
+ target: "_blank",
7579
+ rel: "noopener noreferrer",
7580
+ children: ["Track", jsx("span", {
7581
+ className: "visually-hidden",
7582
+ children: ` ${order.tracking.carrier}, opens in a new tab`
7583
+ }), jsx(RedirectLink, {})]
7584
+ })]
7585
+ }), jsx(OrderTimeline, {
7586
+ progress: order.progress,
7587
+ ...order.estimated_delivery ? {
7588
+ estimatedDelivery: order.estimated_delivery
7589
+ } : {},
7590
+ locale
7591
+ })]
7592
+ }), jsx("hr", {
7593
+ className: styles$x.rule
7594
+ }), jsx(OrderLines, {
7595
+ order
7596
+ }), jsx(ShippingAddressCard, {
7597
+ order
7598
+ }), jsx(OrderSummaryCard, {
7599
+ order
7600
+ }), order.can_cancel && jsx("button", {
7601
+ type: "button",
7602
+ className: styles$x.cancel,
7603
+ onClick: () => setCancelOpen(true),
7604
+ children: "Cancel order"
7605
+ }), jsx(NeedHelp, {
7606
+ order,
7607
+ ...onStartReturn ? {
7608
+ onStartReturn
7609
+ } : {},
7610
+ ...onContactSupport ? {
7611
+ onContactSupport
7612
+ } : {}
7613
+ }), cancelOpen && jsx(ReasonSheet, {
7614
+ title: "Reason for cancelling",
7615
+ options: CANCEL_REASONS,
7616
+ ctaLabel: "Cancel order",
7617
+ closeLabel: "Close reasons",
7618
+ busy: cancelling,
7619
+ onClose: () => setCancelOpen(false),
7620
+ onConfirm: (reason2) => void confirmCancellation(reason2),
7621
+ ...cancelError ? {
7622
+ error: cancelError
7623
+ } : {}
7624
+ })]
7625
+ });
7626
+ }
7627
+ const CANCEL_REASONS = [{
7628
+ value: "changed_my_mind",
7629
+ label: "Changed my mind"
7630
+ }, {
7631
+ value: "ordered_by_mistake",
7632
+ label: "Ordered by mistake"
7633
+ }, {
7634
+ value: "delivery_too_long",
7635
+ label: "Delivery takes too long"
7636
+ }];
7637
+ function placedOn(iso, locale) {
7638
+ const d = new Date(iso);
7639
+ const day = d.getUTCDate();
7640
+ const month = new Intl.DateTimeFormat(locale, {
7641
+ month: "short",
7642
+ timeZone: "UTC"
7643
+ }).format(d);
7644
+ return `${day} ${month}, ${d.getUTCFullYear()}`;
7645
+ }
7646
+ function NeedHelp({ order, onStartReturn, onContactSupport }) {
7647
+ const emit = useShopEvent();
7648
+ if (order.status !== "delivered") return null;
7649
+ return jsxs("section", {
7650
+ className: styles$x.help,
7651
+ "aria-labelledby": "order-help",
7652
+ children: [jsx("h2", {
7653
+ className: styles$x.helpTitle,
7654
+ id: "order-help",
7655
+ children: "Need help?"
7656
+ }), jsxs("div", {
7657
+ className: styles$x.helpRows,
7658
+ children: [order.can_return && onStartReturn && jsx(HelpRow, {
7659
+ label: "Start a return",
7660
+ onClick: onStartReturn
7661
+ }), jsx(HelpRow, {
7662
+ label: "Contact support",
7663
+ onClick: () => {
7664
+ emit({
7665
+ type: "support_requested",
7666
+ orderRef: order.order_ref
7667
+ });
7668
+ onContactSupport?.();
7669
+ }
7670
+ })]
7671
+ })]
7672
+ });
7673
+ }
7674
+ function HelpRow({ label: label2, onClick }) {
7675
+ return jsxs("button", {
7676
+ type: "button",
7677
+ className: styles$x.helpRow,
7678
+ onClick,
7679
+ children: [jsx("span", {
7680
+ children: label2
7681
+ }), jsx(ChevronRight$1, {})]
7679
7682
  });
7680
7683
  }
7684
+ function shortRef$1(orderRef) {
7685
+ return orderRef.replace(/^ord_/, "");
7686
+ }
7681
7687
  const page$2 = "_page_2uqhz_6";
7682
7688
  const confirmed = "_confirmed_2uqhz_16";
7683
7689
  const title$h = "_title_2uqhz_22";
@@ -7846,7 +7852,7 @@ const tile$2 = "_tile_6xodo_133";
7846
7852
  const image$8 = "_image_6xodo_143";
7847
7853
  const placeholder$5 = "_placeholder_6xodo_147";
7848
7854
  const more = "_more_6xodo_154";
7849
- const chevron$3 = "_chevron_6xodo_167";
7855
+ const chevron$2 = "_chevron_6xodo_167";
7850
7856
  const styles$u = {
7851
7857
  page: page$1,
7852
7858
  empty,
@@ -7863,7 +7869,7 @@ const styles$u = {
7863
7869
  image: image$8,
7864
7870
  placeholder: placeholder$5,
7865
7871
  more,
7866
- chevron: chevron$3
7872
+ chevron: chevron$2
7867
7873
  };
7868
7874
  const TILES = 3;
7869
7875
  function Chevron() {
@@ -8652,13 +8658,13 @@ const line = "_line_1s2s6_6";
8652
8658
  const row$5 = "_row_1s2s6_12";
8653
8659
  const pending = "_pending_1s2s6_18";
8654
8660
  const labels = "_labels_1s2s6_24";
8655
- const lowStock = "_lowStock_1s2s6_39";
8661
+ const lowStock$1 = "_lowStock_1s2s6_39";
8656
8662
  const media$1 = "_media_1s2s6_49";
8657
8663
  const image$5 = "_image_1s2s6_59";
8658
8664
  const placeholder$2 = "_placeholder_1s2s6_63";
8659
8665
  const saleBadge = "_saleBadge_1s2s6_76";
8660
8666
  const oos$1 = "_oos_1s2s6_91";
8661
- const info$1 = "_info_1s2s6_104";
8667
+ const info$2 = "_info_1s2s6_104";
8662
8668
  const head = "_head_1s2s6_112";
8663
8669
  const meta = "_meta_1s2s6_119";
8664
8670
  const title$b = "_title_1s2s6_134";
@@ -8672,13 +8678,13 @@ const styles$m = {
8672
8678
  row: row$5,
8673
8679
  pending,
8674
8680
  labels,
8675
- lowStock,
8681
+ lowStock: lowStock$1,
8676
8682
  media: media$1,
8677
8683
  image: image$5,
8678
8684
  placeholder: placeholder$2,
8679
8685
  saleBadge,
8680
8686
  oos: oos$1,
8681
- info: info$1,
8687
+ info: info$2,
8682
8688
  head,
8683
8689
  meta,
8684
8690
  title: title$b,
@@ -8854,13 +8860,13 @@ function ShippingInfo() {
8854
8860
  const bar = "_bar_xqpxa_1";
8855
8861
  const floating$1 = "_floating_xqpxa_31";
8856
8862
  const divider = "_divider_xqpxa_37";
8857
- const info = "_info_xqpxa_41";
8863
+ const info$1 = "_info_xqpxa_41";
8858
8864
  const actions = "_actions_xqpxa_49";
8859
8865
  const styles$k = {
8860
8866
  bar,
8861
8867
  floating: floating$1,
8862
8868
  divider,
8863
- info,
8869
+ info: info$1,
8864
8870
  actions
8865
8871
  };
8866
8872
  function StickyCtaBar({ children, info: info2, variant = "floating" }) {
@@ -9444,16 +9450,17 @@ function SizeGuideSheet({ guide, onClose }) {
9444
9450
  })
9445
9451
  });
9446
9452
  }
9447
- const root$2 = "_root_6sbl9_1";
9448
- const header$3 = "_header_6sbl9_7";
9449
- const title$9 = "_title_6sbl9_12";
9450
- const chips = "_chips_6sbl9_20";
9451
- const chip = "_chip_6sbl9_20";
9452
- const selected$2 = "_selected_6sbl9_44";
9453
- const disabled$1 = "_disabled_6sbl9_56";
9454
- const error = "_error_6sbl9_64";
9455
- const sizeGuide = "_sizeGuide_6sbl9_71";
9456
- const chevron$2 = "_chevron_6sbl9_87";
9453
+ const root$2 = "_root_1q3xe_1";
9454
+ const header$3 = "_header_1q3xe_11";
9455
+ const title$9 = "_title_1q3xe_18";
9456
+ const chips = "_chips_1q3xe_26";
9457
+ const chip = "_chip_1q3xe_26";
9458
+ const selected$2 = "_selected_1q3xe_50";
9459
+ const disabled$1 = "_disabled_1q3xe_62";
9460
+ const lowStock = "_lowStock_1q3xe_74";
9461
+ const error = "_error_1q3xe_84";
9462
+ const sizeGuide = "_sizeGuide_1q3xe_91";
9463
+ const info = "_info_1q3xe_115";
9457
9464
  const styles$g = {
9458
9465
  root: root$2,
9459
9466
  header: header$3,
@@ -9462,23 +9469,55 @@ const styles$g = {
9462
9469
  chip,
9463
9470
  selected: selected$2,
9464
9471
  disabled: disabled$1,
9472
+ lowStock,
9465
9473
  error,
9466
9474
  sizeGuide,
9467
- chevron: chevron$2
9475
+ info
9468
9476
  };
9469
- function SizeSelector({ sizes, selected: selected2, onSelect, error: error2 = false, guide }) {
9477
+ function SizeSelector({ sizes, selected: selected2, onSelect, error: error2 = false, lowStock: lowStock2, guide }) {
9470
9478
  const t = useT();
9471
9479
  const [guideOpen, setGuideOpen] = useState(false);
9472
9480
  return jsxs("section", {
9473
9481
  className: styles$g.root,
9474
9482
  "aria-labelledby": "size-heading",
9475
- children: [jsx("div", {
9483
+ children: [jsxs("div", {
9476
9484
  className: styles$g.header,
9477
- children: jsx("h2", {
9485
+ children: [jsx("h2", {
9478
9486
  id: "size-heading",
9479
9487
  className: styles$g.title,
9480
9488
  children: "Size"
9481
- })
9489
+ }), guide && jsxs("button", {
9490
+ type: "button",
9491
+ className: styles$g.sizeGuide,
9492
+ onClick: () => setGuideOpen(true),
9493
+ "aria-haspopup": "dialog",
9494
+ "aria-expanded": guideOpen,
9495
+ children: ["Size guide", jsxs("svg", {
9496
+ className: styles$g.info,
9497
+ width: "12",
9498
+ height: "12",
9499
+ viewBox: "0 0 12 12",
9500
+ fill: "none",
9501
+ "aria-hidden": "true",
9502
+ children: [jsx("circle", {
9503
+ cx: "6",
9504
+ cy: "6",
9505
+ r: "5",
9506
+ stroke: "currentColor",
9507
+ strokeWidth: "1.2"
9508
+ }), jsx("path", {
9509
+ d: "M6 5.6v2.6",
9510
+ stroke: "currentColor",
9511
+ strokeWidth: "1.2",
9512
+ strokeLinecap: "round"
9513
+ }), jsx("circle", {
9514
+ cx: "6",
9515
+ cy: "3.7",
9516
+ r: "0.7",
9517
+ fill: "currentColor"
9518
+ })]
9519
+ })]
9520
+ })]
9482
9521
  }), jsx("div", {
9483
9522
  className: styles$g.chips,
9484
9523
  role: "radiogroup",
@@ -9505,27 +9544,10 @@ function SizeSelector({ sizes, selected: selected2, onSelect, error: error2 = fa
9505
9544
  className: styles$g.error,
9506
9545
  role: "alert",
9507
9546
  children: "Please select a size"
9508
- }), guide && jsxs("button", {
9509
- type: "button",
9510
- className: styles$g.sizeGuide,
9511
- onClick: () => setGuideOpen(true),
9512
- "aria-haspopup": "dialog",
9513
- "aria-expanded": guideOpen,
9514
- children: ["Size guide", jsx("svg", {
9515
- className: styles$g.chevron,
9516
- width: "12",
9517
- height: "12",
9518
- viewBox: "0 0 12 12",
9519
- fill: "none",
9520
- "aria-hidden": "true",
9521
- children: jsx("path", {
9522
- d: "m4.6 2.6 3.4 3.4-3.4 3.4",
9523
- stroke: "currentColor",
9524
- strokeWidth: "1.2",
9525
- strokeLinecap: "round",
9526
- strokeLinejoin: "round"
9527
- })
9528
- })]
9547
+ }), lowStock2 && !error2 && jsx("p", {
9548
+ className: styles$g.lowStock,
9549
+ role: "status",
9550
+ children: lowStock2
9529
9551
  }), guide && guideOpen && jsx(SizeGuideSheet, {
9530
9552
  guide,
9531
9553
  onClose: () => setGuideOpen(false)
@@ -10019,7 +10041,8 @@ function ProductDetail({ product, inventory: inventory2, recommendations = [] })
10019
10041
  const selectedVariant = hasVariants ? variants.find((v) => v.sku === selectedSku) : void 0;
10020
10042
  const available = selectedVariant?.available ?? inventory2?.available ?? 0;
10021
10043
  const lowStock2 = isLowStock(available);
10022
- const stockNotice = !purchasable || lowStock2;
10044
+ const sizeLowStock = lowStock2 && hasSizes && selectedSize ? t("Only {0} left in {1} size", available, selectedSize) : void 0;
10045
+ const stockNotice = !purchasable || lowStock2 && !sizeLowStock;
10023
10046
  const availabilityLabel = !purchasable ? t("Out of stock") : lowStock2 ? t("Only {0} left", available) : "";
10024
10047
  const cta2 = purchasable ? jsx(Button, {
10025
10048
  variant: "primary",
@@ -10083,6 +10106,9 @@ function ProductDetail({ product, inventory: inventory2, recommendations = [] })
10083
10106
  selected: selectedSize,
10084
10107
  onSelect: selectSize,
10085
10108
  error: sizeError,
10109
+ ...sizeLowStock ? {
10110
+ lowStock: sizeLowStock
10111
+ } : {},
10086
10112
  guide: product.size_guide
10087
10113
  })
10088
10114
  }), hasVariants && !structured && jsx(VariantSelector, {
@@ -10101,24 +10127,29 @@ function ProductDetail({ product, inventory: inventory2, recommendations = [] })
10101
10127
  })]
10102
10128
  });
10103
10129
  }
10104
- const hero$1 = "_hero_pi6qp_10";
10105
- const image$2 = "_image_pi6qp_37";
10106
- const scrim$1 = "_scrim_pi6qp_51";
10107
- const text$2 = "_text_pi6qp_57";
10108
- const title$5 = "_title_pi6qp_79";
10109
- const subtitle$2 = "_subtitle_pi6qp_90";
10110
- const noImage = "_noImage_pi6qp_105";
10130
+ const hero$1 = "_hero_1glho_10";
10131
+ const image$2 = "_image_1glho_42";
10132
+ const scrim$1 = "_scrim_1glho_70";
10133
+ const fade = "_fade_1glho_94";
10134
+ const text$2 = "_text_1glho_108";
10135
+ const title$5 = "_title_1glho_146";
10136
+ const subtitle$2 = "_subtitle_1glho_157";
10137
+ const noImage = "_noImage_1glho_172";
10111
10138
  const styles$9 = {
10112
10139
  hero: hero$1,
10113
10140
  image: image$2,
10114
10141
  scrim: scrim$1,
10142
+ fade,
10115
10143
  text: text$2,
10116
10144
  title: title$5,
10117
10145
  subtitle: subtitle$2,
10118
10146
  noImage
10119
10147
  };
10120
10148
  function PcpHero({ hero: hero2 }) {
10149
+ const heroRef = useRef(null);
10150
+ useTopOffset(heroRef, "--hero-top");
10121
10151
  return jsxs("section", {
10152
+ ref: heroRef,
10122
10153
  className: [styles$9.hero, hero2.image ? "" : styles$9.noImage].join(" "),
10123
10154
  children: [hero2.image && jsxs(Fragment, {
10124
10155
  children: [jsx("div", {
@@ -10133,6 +10164,9 @@ function PcpHero({ hero: hero2 }) {
10133
10164
  }), jsx("div", {
10134
10165
  className: styles$9.scrim,
10135
10166
  "aria-hidden": "true"
10167
+ }), jsx("div", {
10168
+ className: styles$9.fade,
10169
+ "aria-hidden": "true"
10136
10170
  })]
10137
10171
  }), jsxs("div", {
10138
10172
  className: styles$9.text,
@@ -10567,24 +10601,24 @@ function ProductView({ sku, initialData, showRecommendations = true, onNotFound
10567
10601
  }
10568
10602
  return unavailable;
10569
10603
  }
10570
- const showcase = "_showcase_1y51o_40";
10571
- const panel = "_panel_1y51o_59";
10572
- const image = "_image_1y51o_88";
10573
- const heroImageBox = "_heroImageBox_1y51o_136";
10574
- const hero = "_hero_1y51o_136";
10575
- const heroContent = "_heroContent_1y51o_207";
10576
- const heroText = "_heroText_1y51o_224";
10577
- const logo = "_logo_1y51o_233";
10578
- const heroTitle = "_heroTitle_1y51o_253";
10579
- const heroSub = "_heroSub_1y51o_277";
10580
- const swipe = "_swipe_1y51o_290";
10581
- const swipeLabel = "_swipeLabel_1y51o_298";
10582
- const chevron$1 = "_chevron_1y51o_304";
10583
- const overlay$1 = "_overlay_1y51o_321";
10584
- const copy = "_copy_1y51o_332";
10585
- const title$2 = "_title_1y51o_337";
10586
- const subtitle$1 = "_subtitle_1y51o_344";
10587
- const cta = "_cta_1y51o_350";
10604
+ const showcase = "_showcase_a0wva_39";
10605
+ const panel = "_panel_a0wva_43";
10606
+ const image = "_image_a0wva_71";
10607
+ const heroImageBox = "_heroImageBox_a0wva_119";
10608
+ const hero = "_hero_a0wva_119";
10609
+ const heroContent = "_heroContent_a0wva_190";
10610
+ const heroText = "_heroText_a0wva_207";
10611
+ const logo = "_logo_a0wva_216";
10612
+ const heroTitle = "_heroTitle_a0wva_236";
10613
+ const heroSub = "_heroSub_a0wva_260";
10614
+ const swipe = "_swipe_a0wva_273";
10615
+ const swipeLabel = "_swipeLabel_a0wva_281";
10616
+ const chevron$1 = "_chevron_a0wva_287";
10617
+ const overlay$1 = "_overlay_a0wva_304";
10618
+ const copy = "_copy_a0wva_315";
10619
+ const title$2 = "_title_a0wva_320";
10620
+ const subtitle$1 = "_subtitle_a0wva_327";
10621
+ const cta = "_cta_a0wva_333";
10588
10622
  const styles$2 = {
10589
10623
  showcase,
10590
10624
  panel,
@@ -10605,41 +10639,35 @@ const styles$2 = {
10605
10639
  subtitle: subtitle$1,
10606
10640
  cta
10607
10641
  };
10608
- const SETTLE_MS = 250;
10609
- function useViewportHeight(ref, property, enabled = true) {
10642
+ const SETTLE_MS = 150;
10643
+ function useDocumentSnap(ref, enabled = true) {
10610
10644
  useEffect(() => {
10611
10645
  const el = ref.current;
10612
- if (!el || !enabled) return;
10646
+ if (!el || !enabled || typeof document === "undefined") return;
10647
+ const root2 = document.documentElement;
10648
+ const previousType = root2.style.scrollSnapType;
10649
+ const previousPadding = root2.style.scrollPaddingTop;
10613
10650
  let timer2;
10614
- const read = () => Math.round(window.visualViewport?.height ?? window.innerHeight);
10615
- const apply = () => {
10616
- const height = read();
10617
- if (height > 0) el.style.setProperty(property, `${height}px`);
10618
- };
10619
- const applySettled = () => {
10620
- const previous = el.clientHeight;
10621
- const index = previous > 0 ? Math.round(el.scrollTop / previous) : 0;
10622
- apply();
10623
- if (el.clientHeight > 0) el.scrollTo({
10624
- top: index * el.clientHeight,
10625
- behavior: "auto"
10626
- });
10651
+ const syncPadding = () => {
10652
+ const top = getComputedStyle(el).getPropertyValue("--showcase-top").trim();
10653
+ root2.style.scrollPaddingTop = top === "" ? "0px" : top;
10627
10654
  };
10628
10655
  const schedule = () => {
10629
10656
  if (timer2) clearTimeout(timer2);
10630
- timer2 = setTimeout(applySettled, SETTLE_MS);
10657
+ timer2 = setTimeout(syncPadding, SETTLE_MS);
10631
10658
  };
10632
- apply();
10659
+ root2.style.scrollSnapType = "y mandatory";
10660
+ syncPadding();
10633
10661
  window.addEventListener("resize", schedule);
10634
10662
  window.addEventListener("orientationchange", schedule);
10635
- window.visualViewport?.addEventListener("resize", schedule);
10636
10663
  return () => {
10637
10664
  if (timer2) clearTimeout(timer2);
10638
10665
  window.removeEventListener("resize", schedule);
10639
10666
  window.removeEventListener("orientationchange", schedule);
10640
- window.visualViewport?.removeEventListener("resize", schedule);
10667
+ root2.style.scrollSnapType = previousType;
10668
+ root2.style.scrollPaddingTop = previousPadding;
10641
10669
  };
10642
- }, [ref, property, enabled]);
10670
+ }, [ref, enabled]);
10643
10671
  }
10644
10672
  const FALLBACK_PANELS = [{
10645
10673
  key: "all-items",
@@ -10753,7 +10781,7 @@ function HomeShowcase() {
10753
10781
  const panels = useSlides();
10754
10782
  const showcaseRef = useRef(null);
10755
10783
  useTopOffset(showcaseRef, "--showcase-top");
10756
- useViewportHeight(showcaseRef, "--showcase-vh");
10784
+ useDocumentSnap(showcaseRef);
10757
10785
  return jsx(ShopSurface, {
10758
10786
  tone: "dark",
10759
10787
  children: jsxs("div", {
@@ -11360,4 +11388,4 @@ export {
11360
11388
  useToast,
11361
11389
  variantLabel
11362
11390
  };
11363
- //# sourceMappingURL=storefront.mjs.map
11391
+