@develemit/commerce-admin 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +7 -4
  3. package/dist/client/admin-client.d.ts +1 -0
  4. package/dist/client/errors.d.ts +4 -0
  5. package/dist/client/index.js +1 -1
  6. package/dist/{client-DCL5DSHP.js → client-ClTCzt-p.js} +34 -28
  7. package/dist/client-ClTCzt-p.js.map +1 -0
  8. package/dist/components/admin-layout/admin-layout.d.ts +2 -1
  9. package/dist/components/admin-layout/current-item.d.ts +1 -0
  10. package/dist/components/admin-layout/nav-items.d.ts +3 -0
  11. package/dist/components/admin-layout/use-current-href.d.ts +1 -0
  12. package/dist/components/empty-state/empty-state.d.ts +1 -1
  13. package/dist/index.js +1255 -912
  14. package/dist/index.js.map +1 -1
  15. package/dist/lib/admin-labels.d.ts +3 -0
  16. package/dist/lib/currency-symbol.d.ts +1 -0
  17. package/dist/lib/order-action-labels.d.ts +2 -0
  18. package/dist/lib/order-labels.d.ts +1 -1
  19. package/dist/lib/product-draft.d.ts +3 -0
  20. package/dist/lib/product-flow-labels.d.ts +9 -0
  21. package/dist/lib/product-labels.d.ts +8 -0
  22. package/dist/lib/provider.d.ts +2 -0
  23. package/dist/lib/stock-labels.d.ts +2 -0
  24. package/dist/lib/use-batch-upload.d.ts +1 -0
  25. package/dist/lib/use-product-autosave.d.ts +4 -0
  26. package/dist/lib/use-product-pages.d.ts +1 -0
  27. package/dist/styles.css +470 -29
  28. package/dist/views/orders/admin-order-detail.d.ts +2 -1
  29. package/dist/views/orders/order-actions.d.ts +2 -1
  30. package/dist/views/orders/resolve-button.d.ts +3 -1
  31. package/dist/views/orders/ship-form.d.ts +4 -1
  32. package/dist/views/products/add-several/photo-picker.d.ts +3 -1
  33. package/dist/views/products/admin-product-images.d.ts +2 -0
  34. package/dist/views/products/finish-drafts/piece-summary.d.ts +2 -1
  35. package/dist/views/products/finish-drafts/use-publish-pieces.d.ts +2 -0
  36. package/dist/views/products/product-flow/flow-actions.d.ts +3 -0
  37. package/dist/views/products/product-flow/flow-frame.d.ts +4 -2
  38. package/dist/views/products/product-flow/materials-field.d.ts +6 -0
  39. package/dist/views/products/product-flow/use-product-flow.d.ts +5 -0
  40. package/dist/views/products/product-sheet/delete-draft-button.d.ts +9 -0
  41. package/dist/views/shipping/shipping-rate-row.d.ts +2 -1
  42. package/package.json +2 -2
  43. package/dist/client-DCL5DSHP.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use client";
2
- import { a as e, c as t, d as n, f as r, g as i, h as a, i as o, l as s, m as c, o as l, p as u, r as d, s as f, u as p } from "./client-DCL5DSHP.js";
2
+ import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, o as l, p as u, r as d, s as f, u as p } from "./client-ClTCzt-p.js";
3
3
  import { createContext as m, useCallback as h, useContext as g, useEffect as _, useId as v, useRef as y, useState as b, useSyncExternalStore as x } from "react";
4
4
  import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
5
- import { shippingRatesInputSchema as T } from "@develemit/commerce-contracts";
5
+ import { formatOrderRef as T, shippingRatesInputSchema as E } from "@develemit/commerce-contracts";
6
6
  // src/lib/order-labels.ts
7
- var E = {
7
+ var D = {
8
8
  title: "Orders",
9
9
  searchLabel: "Search orders",
10
- searchPlaceholder: "Search by email or order id",
10
+ searchPlaceholder: "Search orders",
11
11
  tabs: {
12
12
  paid: "To ship",
13
13
  shipped: "Shipped",
@@ -87,6 +87,8 @@ var E = {
87
87
  trackingUrl: "Tracking URL",
88
88
  trackingUrlInvalid: "Enter a full link starting with http:// or https://.",
89
89
  shipped: "Shipping details saved.",
90
+ shipWithoutTracking: "Ship without tracking",
91
+ trackingRequired: "Add a carrier and tracking number, or choose Ship without tracking.",
90
92
  refund: "Refund…",
91
93
  refundTitle: "Refund order",
92
94
  refundAmount: "Amount",
@@ -105,7 +107,7 @@ var E = {
105
107
  resolved: "Order resolved.",
106
108
  restockThenResolve: "Restock, then resolve"
107
109
  }
108
- }, D = {
110
+ }, O = {
109
111
  title: "Shipping rates",
110
112
  loading: "Loading shipping rates…",
111
113
  emptyTitle: "No shipping options yet",
@@ -138,7 +140,7 @@ var E = {
138
140
  daysInvalid: "Use a whole number of days, or leave blank.",
139
141
  daysOrder: "Fastest cannot be more than slowest.",
140
142
  rowInvalid: "These details are not valid."
141
- }, O = {
143
+ }, k = {
142
144
  title: "Discounts",
143
145
  newDiscount: "New discount",
144
146
  searchLabel: "Search discounts",
@@ -202,12 +204,13 @@ var E = {
202
204
  invalid: "This value is not valid."
203
205
  },
204
206
  orderRow: "Discount"
205
- }, k = {
207
+ }, A = {
206
208
  addSeveral: {
207
209
  title: "Add several pieces",
208
210
  introTitle: "One photo, one piece",
209
211
  introBody: "Choose a stack of photos from your camera roll. Each one becomes a draft, and you name and price them one at a time next.",
210
212
  choose: "Choose photos",
213
+ dropHint: "Pick as many as you like. Each photo becomes its own piece.",
211
214
  progress: "Adding {done} of {total}…",
212
215
  failedTitle: "{count} did not upload",
213
216
  retry: "Try again",
@@ -233,6 +236,7 @@ var E = {
233
236
  title: "Ready for the shop?",
234
237
  lede: "Pieces with their details can go in the shop now. The rest stay as drafts.",
235
238
  needsDetails: "Needs details",
239
+ openPiece: "Finish {name}",
236
240
  untitled: "Untitled piece",
237
241
  publish: "Put {count} in the shop",
238
242
  keepDrafts: "Keep as drafts",
@@ -241,7 +245,7 @@ var E = {
241
245
  publishedBody: "Customers can see them now.",
242
246
  allSkipped: "None of these are ready yet."
243
247
  }
244
- }, A = {
248
+ }, j = {
245
249
  title: "Photos",
246
250
  empty: "Add a photo so this can go live.",
247
251
  add: "Add photos",
@@ -266,12 +270,12 @@ var E = {
266
270
  wrongType: "{name} must be a JPEG, PNG, WebP or HEIC image.",
267
271
  reorderFailed: "The photos could not be reordered. The old order is back.",
268
272
  dismiss: "Dismiss"
269
- }, j = [
273
+ }, M = [
270
274
  "photos",
271
275
  "basics",
272
276
  "story",
273
277
  "preview"
274
- ], M = {
278
+ ], N = {
275
279
  title: "Products",
276
280
  newProduct: "New product",
277
281
  searchLabel: "Search products",
@@ -291,6 +295,10 @@ var E = {
291
295
  archived: "No archived products."
292
296
  },
293
297
  noMatches: "No products match that search.",
298
+ emptyActions: {
299
+ start: "Start a piece",
300
+ clearSearch: "Clear search"
301
+ },
294
302
  loadMore: "Load more",
295
303
  welcome: {
296
304
  title: "Your shop is ready for its first piece",
@@ -328,11 +336,15 @@ var E = {
328
336
  edit: "Edit details",
329
337
  photos: "Photos ({count})",
330
338
  featureOn: "Feature on home",
331
- featureOff: "Remove from home",
332
- hide: "Hide from shop",
339
+ featureOff: "Take off the home page",
340
+ hide: "Hide from the shop",
333
341
  copyLink: "Copy shop link",
334
342
  linkCopied: "Link copied.",
335
343
  archive: "Archive",
344
+ deleteDraft: "Delete draft",
345
+ deleteTitle: "Delete this draft?",
346
+ deleteBody: "This removes the draft and its photos for good. There is no undo.",
347
+ deleteConfirm: "Delete draft",
336
348
  undo: "Undo",
337
349
  missingTitle: "Before it can go in the shop, it needs:",
338
350
  missing: {
@@ -391,7 +403,7 @@ var E = {
391
403
  status: "Status",
392
404
  featured: "Feature this product on the home page"
393
405
  },
394
- images: A,
406
+ images: j,
395
407
  flow: {
396
408
  newTitle: "New product",
397
409
  editTitle: "Edit product",
@@ -412,7 +424,7 @@ var E = {
412
424
  },
413
425
  ledes: {
414
426
  photos: "The first photo is the one customers see in the shop. Tap any photo to make it the cover.",
415
- basics: "That is all a product needs to go in the shop.",
427
+ basics: "That is all it needs to go in the shop.",
416
428
  story: "Optional, but it helps it sell. You can add this later.",
417
429
  preview: "This is how customers will see it."
418
430
  },
@@ -426,15 +438,24 @@ var E = {
426
438
  removePhoto: "Remove photo {n}",
427
439
  uploading: "Uploading {name}…",
428
440
  pricePlaceholder: "0.00",
429
- otherCategory: "Other…",
441
+ otherCategory: "New category…",
430
442
  newCategory: "New category",
431
443
  oneOfAKind: "One of a kind",
432
444
  howMany: "How many do you have?",
433
445
  descriptionPrompts: [],
446
+ descriptionPlaceholder: "",
447
+ sizePlaceholder: "",
448
+ altPlaceholder: "",
449
+ previewHeadingLive: "Your changes",
450
+ saveChanges: "Save changes",
451
+ seeInShop: "See it in the shop",
452
+ continueNeeds: "Add {things} to continue",
453
+ addPhotoTile: "Add photo",
454
+ stepCount: "Step {n} of {total}",
434
455
  materialsOther: "Or type your own",
435
456
  size: "Size",
436
457
  altTitle: "Describe each photo",
437
- altHelp: "Read aloud for customers who use screen readers. Left blank, it uses the name.",
458
+ altHelp: "Describe the photo for shoppers who can’t see it. Left blank, it uses the name.",
438
459
  altFallback: "{name}, photo {n}",
439
460
  inTheShop: "In the shop",
440
461
  untitled: "Untitled product",
@@ -448,17 +469,17 @@ var E = {
448
469
  publish: "Put it in the shop",
449
470
  done: "Done",
450
471
  saving: "Saving…",
451
- savedNew: "Saved as a draft as you go",
472
+ savedNew: "Saved as you go",
452
473
  savedEdit: "Saved",
453
474
  saveFailed: "Your changes have not been saved yet.",
454
475
  retry: "Try again",
455
476
  savedAsDraft: "Saved as a draft",
456
477
  success: "It’s in the shop!",
457
- successFirst: "Your first product is in the shop!",
478
+ successFirst: "Your first one is in the shop!",
458
479
  addAnother: "Add another",
459
- backToList: "Back to products"
480
+ backToList: "Back to the list"
460
481
  },
461
- stock: k,
482
+ stock: A,
462
483
  statusHelp: "Draft is hidden. Active is live in the shop. Archived is hidden and kept. Mark a piece sold from the product list.",
463
484
  priceHelp: "In dollars, for example 48.00.",
464
485
  validation: {
@@ -466,7 +487,7 @@ var E = {
466
487
  price: "Enter a price like 48 or 48.50.",
467
488
  quantity: "Enter a whole number, zero or more."
468
489
  }
469
- }, N = {
490
+ }, P = {
470
491
  loading: "Loading…",
471
492
  empty: "Nothing here yet.",
472
493
  save: "Save",
@@ -479,7 +500,10 @@ var E = {
479
500
  orders: "Orders",
480
501
  shippingRates: "Shipping rates",
481
502
  more: "More",
482
- closeMore: "Close menu"
503
+ closeMore: "Close menu",
504
+ viewShop: "View shop",
505
+ badge: (e) => `${e} waiting`,
506
+ productsBadge: (e) => `${e} drafts`
483
507
  },
484
508
  statuses: {
485
509
  draft: "Draft",
@@ -511,14 +535,14 @@ var E = {
511
535
  imageTooLarge: "That image is too large. Choose a smaller one.",
512
536
  generic: "Something went wrong. Try again."
513
537
  },
514
- products: M,
515
- orders: E,
516
- shipping: D,
517
- discounts: O
538
+ products: N,
539
+ orders: D,
540
+ shipping: O,
541
+ discounts: k
518
542
  };
519
543
  // src/lib/merge-labels.ts
520
544
  function ee(e) {
521
- let t = E;
545
+ let t = D;
522
546
  return {
523
547
  ...t,
524
548
  ...e,
@@ -556,8 +580,8 @@ function ee(e) {
556
580
  }
557
581
  };
558
582
  }
559
- function P(e) {
560
- let t = M;
583
+ function te(e) {
584
+ let t = N;
561
585
  return {
562
586
  ...t,
563
587
  ...e,
@@ -581,6 +605,10 @@ function P(e) {
581
605
  ...t.welcome,
582
606
  ...e?.welcome
583
607
  },
608
+ emptyActions: {
609
+ ...t.emptyActions,
610
+ ...e?.emptyActions
611
+ },
584
612
  card: {
585
613
  ...t.card,
586
614
  ...e?.card
@@ -649,8 +677,8 @@ function P(e) {
649
677
  }
650
678
  };
651
679
  }
652
- function te(e) {
653
- let t = O;
680
+ function ne(e) {
681
+ let t = k;
654
682
  return {
655
683
  ...t,
656
684
  ...e,
@@ -680,8 +708,8 @@ function te(e) {
680
708
  }
681
709
  };
682
710
  }
683
- function ne(e) {
684
- let t = N;
711
+ function re(e) {
712
+ let t = P;
685
713
  return {
686
714
  ...t,
687
715
  ...e,
@@ -697,20 +725,21 @@ function ne(e) {
697
725
  ...t.errors,
698
726
  ...e?.errors
699
727
  },
700
- products: P(e?.products),
728
+ products: te(e?.products),
701
729
  orders: ee(e?.orders),
702
730
  shipping: {
703
- ...D,
731
+ ...O,
704
732
  ...e?.shipping
705
733
  },
706
- discounts: te(e?.discounts)
734
+ discounts: ne(e?.discounts)
707
735
  };
708
736
  }
709
737
  // src/lib/provider.tsx
710
- var re = {
711
- renderLink: ({ href: e, children: t, className: n }) => /* @__PURE__ */ C("a", {
738
+ var ie = {
739
+ renderLink: ({ href: e, children: t, className: n, "aria-current": r }) => /* @__PURE__ */ C("a", {
712
740
  href: e,
713
741
  className: n,
742
+ "aria-current": r,
714
743
  children: t
715
744
  }),
716
745
  renderImage: ({ src: e, alt: t, sizes: n, className: r, priority: i }) => /* @__PURE__ */ C("img", {
@@ -736,25 +765,25 @@ var re = {
736
765
  newDiscount: "/admin/discounts/new"
737
766
  },
738
767
  client: null,
739
- labels: N
740
- }, ie = m(re);
741
- function ae({ children: e, hrefs: t, labels: n, ...r }) {
768
+ labels: P
769
+ }, ae = m(ie);
770
+ function oe({ children: e, hrefs: t, labels: n, ...r }) {
742
771
  let i = {
743
- ...re,
772
+ ...ie,
744
773
  ...r,
745
774
  hrefs: {
746
- ...re.hrefs,
775
+ ...ie.hrefs,
747
776
  ...t
748
777
  },
749
- labels: ne(n)
778
+ labels: re(n)
750
779
  };
751
- return /* @__PURE__ */ C(ie.Provider, {
780
+ return /* @__PURE__ */ C(ae.Provider, {
752
781
  value: i,
753
782
  children: e
754
783
  });
755
784
  }
756
785
  function F() {
757
- return g(ie);
786
+ return g(ae);
758
787
  }
759
788
  function I() {
760
789
  let { client: e } = F();
@@ -884,16 +913,17 @@ var B = {
884
913
  r: "3"
885
914
  }))
886
915
  };
887
- function oe(e) {
916
+ function se(e) {
888
917
  return e !== void 0 && e !== "" && e !== 0;
889
918
  }
890
- function se(e, t, n, r) {
919
+ function ce(e, t, n, r) {
891
920
  let i = [
892
921
  {
893
922
  href: e.products,
894
923
  label: t.products,
895
924
  icon: B.products,
896
- badge: r.products
925
+ badge: r.products,
926
+ badgeLabel: se(r.products) ? t.productsBadge(r.products) : void 0
897
927
  },
898
928
  {
899
929
  href: e.orders,
@@ -919,10 +949,13 @@ function se(e, t, n, r) {
919
949
  ...n.filter((e) => e.position !== "start").map(a)
920
950
  ].map((e) => ({
921
951
  ...e,
922
- badge: oe(e.badge) ? e.badge : void 0
952
+ badge: se(e.badge) ? e.badge : void 0
953
+ })).map((e) => ({
954
+ ...e,
955
+ badgeLabel: e.badge === void 0 ? void 0 : e.badgeLabel ?? t.badge(e.badge)
923
956
  }));
924
957
  }
925
- function ce(e) {
958
+ function le(e) {
926
959
  return e.length <= 5 ? {
927
960
  bar: e,
928
961
  overflow: []
@@ -931,8 +964,31 @@ function ce(e) {
931
964
  overflow: e.slice(4)
932
965
  };
933
966
  }
967
+ // src/components/admin-layout/current-item.ts
968
+ function ue(e) {
969
+ let t = e.split(/[?#]/)[0] ?? "";
970
+ return t.length > 1 ? t.replace(/\/+$/, "") : t;
971
+ }
972
+ function de(e, t) {
973
+ if (!t) return;
974
+ let n = ue(t), r, i = -1;
975
+ for (let t of e) {
976
+ let e = ue(t);
977
+ (n === e || e !== "/" && n.startsWith(`${e}/`)) && e.length > i && (r = t, i = e.length);
978
+ }
979
+ return r;
980
+ }
981
+ // src/components/admin-layout/use-current-href.ts
982
+ function fe(e) {
983
+ let [t, n] = b();
984
+ return _(() => {
985
+ if (e !== void 0) return;
986
+ let t = () => n(window.location.pathname);
987
+ return t(), window.addEventListener("popstate", t), () => window.removeEventListener("popstate", t);
988
+ }, [e]), e ?? t;
989
+ }
934
990
  // src/components/admin-layout/use-more-sheet.ts
935
- function le() {
991
+ function pe() {
936
992
  let [e, t] = b(!1), n = h(() => t(!1), []), r = h(() => t((e) => !e), []);
937
993
  return _(() => {
938
994
  if (!e) return;
@@ -947,10 +1003,11 @@ function le() {
947
1003
  };
948
1004
  }
949
1005
  // src/components/admin-layout/admin-layout.tsx
950
- function ue({ children: e, extraNav: t = [], navBadges: n = {}, header: r, footer: i }) {
951
- let { hrefs: a, labels: o, renderLink: s } = F(), c = v(), l = le(), u = se(a, o.nav, t, n), { bar: d, overflow: f } = ce(u), p = (e, t) => s({
1006
+ function me({ children: e, extraNav: t = [], navBadges: n = {}, header: r, footer: i, currentHref: a }) {
1007
+ let { hrefs: o, labels: s, renderLink: c } = F(), l = v(), u = pe(), d = ce(o, s.nav, t, n), { bar: f, overflow: p } = le(d), m = de(d.map((e) => e.href), fe(a)), h = (e, t) => c({
952
1008
  href: e.href,
953
- className: t,
1009
+ className: e.href === m ? `${t} is-current` : t,
1010
+ "aria-current": e.href === m ? "page" : void 0,
954
1011
  children: /* @__PURE__ */ w(S, { children: [
955
1012
  /* @__PURE__ */ C("span", {
956
1013
  className: "sfa-nav__icon",
@@ -962,6 +1019,9 @@ function ue({ children: e, extraNav: t = [], navBadges: n = {}, header: r, foote
962
1019
  }),
963
1020
  e.badge === void 0 ? null : /* @__PURE__ */ C("span", {
964
1021
  className: "sfa-nav__badge",
1022
+ role: "img",
1023
+ "aria-label": e.badgeLabel,
1024
+ title: e.badgeLabel,
965
1025
  children: e.badge
966
1026
  })
967
1027
  ] })
@@ -978,8 +1038,8 @@ function ue({ children: e, extraNav: t = [], navBadges: n = {}, header: r, foote
978
1038
  }) : null,
979
1039
  /* @__PURE__ */ C("nav", {
980
1040
  className: "sfa-nav",
981
- "aria-label": o.navLabel,
982
- children: /* @__PURE__ */ C("ul", { children: u.map((e) => /* @__PURE__ */ C("li", { children: p(e, "sfa-nav__link") }, e.href)) })
1041
+ "aria-label": s.navLabel,
1042
+ children: /* @__PURE__ */ C("ul", { children: d.map((e) => /* @__PURE__ */ C("li", { children: h(e, "sfa-nav__link") }, e.href)) })
983
1043
  }),
984
1044
  i ? /* @__PURE__ */ C("div", {
985
1045
  className: "sfa-layout__footer",
@@ -993,13 +1053,13 @@ function ue({ children: e, extraNav: t = [], navBadges: n = {}, header: r, foote
993
1053
  }),
994
1054
  /* @__PURE__ */ C("nav", {
995
1055
  className: "sfa-tabbar",
996
- "aria-label": o.navLabel,
997
- children: /* @__PURE__ */ w("ul", { children: [d.map((e) => /* @__PURE__ */ C("li", { children: p(e, "sfa-tabbar__item") }, e.href)), f.length > 0 || r || i ? /* @__PURE__ */ C("li", { children: /* @__PURE__ */ w("button", {
1056
+ "aria-label": s.navLabel,
1057
+ children: /* @__PURE__ */ w("ul", { children: [f.map((e) => /* @__PURE__ */ C("li", { children: h(e, "sfa-tabbar__item") }, e.href)), p.length > 0 || o.storefront || r || i ? /* @__PURE__ */ C("li", { children: /* @__PURE__ */ w("button", {
998
1058
  type: "button",
999
1059
  className: "sfa-tabbar__item",
1000
- "aria-expanded": l.open,
1001
- "aria-controls": c,
1002
- onClick: l.toggle,
1060
+ "aria-expanded": u.open,
1061
+ "aria-controls": l,
1062
+ onClick: u.toggle,
1003
1063
  children: [
1004
1064
  /* @__PURE__ */ C("span", {
1005
1065
  className: "sfa-nav__icon",
@@ -1007,33 +1067,43 @@ function ue({ children: e, extraNav: t = [], navBadges: n = {}, header: r, foote
1007
1067
  }),
1008
1068
  /* @__PURE__ */ C("span", {
1009
1069
  className: "sfa-nav__label",
1010
- children: o.nav.more
1070
+ children: s.nav.more
1011
1071
  }),
1012
- f.some((e) => e.badge !== void 0) ? /* @__PURE__ */ C("span", { className: "sfa-nav__badge sfa-nav__badge--dot" }) : null
1072
+ p.some((e) => e.badge !== void 0) ? /* @__PURE__ */ C("span", { className: "sfa-nav__badge sfa-nav__badge--dot" }) : null
1013
1073
  ]
1014
1074
  }) }) : null] })
1015
1075
  }),
1016
- l.open ? /* @__PURE__ */ C("button", {
1076
+ u.open ? /* @__PURE__ */ C("button", {
1017
1077
  type: "button",
1018
1078
  className: "sfa-more__backdrop",
1019
- "aria-label": o.nav.closeMore,
1020
- onClick: l.close
1079
+ "aria-label": s.nav.closeMore,
1080
+ onClick: u.close
1021
1081
  }) : null,
1022
1082
  /* @__PURE__ */ w("div", {
1023
- id: c,
1083
+ id: l,
1024
1084
  className: "sfa-more",
1025
- hidden: !l.open,
1085
+ hidden: !u.open,
1026
1086
  onClick: (e) => {
1027
- e.target.closest("a") && l.close();
1087
+ e.target.closest("a") && u.close();
1028
1088
  },
1029
1089
  children: [
1090
+ /* @__PURE__ */ C("button", {
1091
+ type: "button",
1092
+ className: "sfa-btn sfa-btn--ghost sfa-more__close",
1093
+ onClick: u.close,
1094
+ children: s.nav.closeMore
1095
+ }),
1030
1096
  r ? /* @__PURE__ */ C("div", {
1031
1097
  className: "sfa-layout__header",
1032
1098
  children: r
1033
1099
  }) : null,
1034
- f.length > 0 ? /* @__PURE__ */ C("ul", {
1100
+ p.length > 0 || o.storefront ? /* @__PURE__ */ w("ul", {
1035
1101
  className: "sfa-more__list",
1036
- children: f.map((e) => /* @__PURE__ */ C("li", { children: p(e, "sfa-nav__link") }, e.href))
1102
+ children: [p.map((e) => /* @__PURE__ */ C("li", { children: h(e, "sfa-nav__link") }, e.href)), o.storefront ? /* @__PURE__ */ C("li", { children: c({
1103
+ href: o.storefront,
1104
+ className: "sfa-nav__link",
1105
+ children: s.nav.viewShop
1106
+ }) }) : null]
1037
1107
  }) : null,
1038
1108
  i ? /* @__PURE__ */ C("div", {
1039
1109
  className: "sfa-layout__footer",
@@ -1079,6 +1149,7 @@ function H({ columns: e, rows: t, rowKey: n, caption: r }) {
1079
1149
  }, e.key)) }) }),
1080
1150
  /* @__PURE__ */ C("tbody", { children: t.map((t) => /* @__PURE__ */ C("tr", { children: e.map((e) => /* @__PURE__ */ C("td", {
1081
1151
  "data-label": e.header,
1152
+ "data-col": e.key,
1082
1153
  children: e.render(t)
1083
1154
  }, e.key)) }, n(t))) })
1084
1155
  ]
@@ -1104,12 +1175,12 @@ function W({ cents: e, currency: t }) {
1104
1175
  });
1105
1176
  }
1106
1177
  // src/lib/use-focus-trap.ts
1107
- var de = "button:not([disabled]), [href], input:not([disabled]), select, textarea, [tabindex]:not([tabindex=\"-1\"])";
1108
- function fe(e, t, n) {
1178
+ var he = "button:not([disabled]), [href], input:not([disabled]), select, textarea, [tabindex]:not([tabindex=\"-1\"])";
1179
+ function ge(e, t, n) {
1109
1180
  return _(() => {
1110
1181
  if (!t) return;
1111
1182
  let n = document.activeElement;
1112
- return e.current?.querySelector(de)?.focus(), () => n?.focus();
1183
+ return e.current?.querySelector(he)?.focus({ focusVisible: !0 }), () => n?.focus();
1113
1184
  }, [t, e]), _(() => {
1114
1185
  if (!t) return;
1115
1186
  let e = (e) => {
@@ -1122,7 +1193,7 @@ function fe(e, t, n) {
1122
1193
  return;
1123
1194
  }
1124
1195
  if (t.key !== "Tab") return;
1125
- let r = Array.from(e.current?.querySelectorAll(de) ?? []);
1196
+ let r = Array.from(e.current?.querySelectorAll(he) ?? []);
1126
1197
  if (r.length === 0) return;
1127
1198
  let i = r[0], a = r[r.length - 1];
1128
1199
  t.shiftKey && document.activeElement === i ? (t.preventDefault(), a.focus()) : !t.shiftKey && document.activeElement === a && (t.preventDefault(), i.focus());
@@ -1130,7 +1201,7 @@ function fe(e, t, n) {
1130
1201
  }
1131
1202
  // src/components/confirm-dialog/confirm-dialog.tsx
1132
1203
  function G({ open: e, title: t, children: n, confirmLabel: r, destructive: i = !1, pending: a = !1, onConfirm: o, onCancel: s }) {
1133
- let { labels: c } = F(), l = y(null), u = fe(l, e, s);
1204
+ let { labels: c } = F(), l = y(null), u = ge(l, e, s);
1134
1205
  return e ? /* @__PURE__ */ C("div", {
1135
1206
  className: "sfa-dialog-backdrop",
1136
1207
  onKeyDown: u,
@@ -1167,8 +1238,11 @@ function G({ open: e, title: t, children: n, confirmLabel: r, destructive: i = !
1167
1238
  }
1168
1239
  // src/components/notice/notice.tsx
1169
1240
  function K({ variant: e, children: t, toast: n = !1, duration: r = 4e3, onDismiss: i, action: a }) {
1170
- let { labels: o } = F();
1241
+ let { labels: o } = F(), s = y(null);
1171
1242
  _(() => {
1243
+ let e = s.current;
1244
+ !n && e && "scrollIntoView" in e && e.scrollIntoView({ block: "nearest" });
1245
+ }, [n]), _(() => {
1172
1246
  if (!n || !i) return;
1173
1247
  let e = setTimeout(i, r);
1174
1248
  return () => clearTimeout(e);
@@ -1177,10 +1251,11 @@ function K({ variant: e, children: t, toast: n = !1, duration: r = 4e3, onDismis
1177
1251
  r,
1178
1252
  i
1179
1253
  ]);
1180
- let s = e === "error" ? "alert" : "status", c = `sfa-notice sfa-notice--${e}${n ? " sfa-notice--toast" : ""}`;
1254
+ let c = e === "error" ? "alert" : "status", l = `sfa-notice sfa-notice--${e}${n ? " sfa-notice--toast" : ""}`;
1181
1255
  return /* @__PURE__ */ w("div", {
1182
- role: s,
1183
- className: c,
1256
+ ref: s,
1257
+ role: c,
1258
+ className: l,
1184
1259
  children: [
1185
1260
  /* @__PURE__ */ C("span", {
1186
1261
  className: "sfa-notice__body",
@@ -1202,77 +1277,130 @@ function K({ variant: e, children: t, toast: n = !1, duration: r = 4e3, onDismis
1202
1277
  });
1203
1278
  }
1204
1279
  // src/components/error-message/error-message.tsx
1205
- var pe = [
1206
- [e, "unauthorized"],
1207
- [o, "notFound"],
1280
+ var _e = [
1281
+ [t, "unauthorized"],
1282
+ [s, "notFound"],
1208
1283
  [d, "invalidInput"],
1209
- [n, "invalidOrderState"],
1210
- [s, "insufficientStock"],
1211
- [c, "refundExceedsBalance"],
1284
+ [r, "invalidOrderState"],
1285
+ [c, "insufficientStock"],
1286
+ [o, "refundExceedsBalance"],
1212
1287
  [a, "refundGateway"],
1213
- [i, "refundOutcomeUnknown"],
1288
+ [e, "refundOutcomeUnknown"],
1214
1289
  [l, "discountCodeTaken"],
1215
1290
  [f, "discountInUse"],
1216
- [t, "imageTooLarge"],
1291
+ [n, "imageTooLarge"],
1217
1292
  [p, "imageInvalid"]
1218
1293
  ];
1219
- function me(e) {
1220
- return pe.find(([t]) => e instanceof t)?.[1] ?? "generic";
1294
+ function ve(e) {
1295
+ return _e.find(([t]) => e instanceof t)?.[1] ?? "generic";
1221
1296
  }
1222
1297
  function q({ error: e }) {
1223
1298
  let { labels: t } = F();
1224
1299
  return e ? /* @__PURE__ */ C(K, {
1225
1300
  variant: "error",
1226
- children: t.errors[me(e)]
1301
+ children: t.errors[ve(e)]
1227
1302
  }) : null;
1228
1303
  }
1304
+ // src/components/empty-state/empty-state.tsx
1305
+ var ye = {
1306
+ orders: "M4 8l8-4 8 4v8l-8 4-8-4V8zm0 0l8 4m0 0l8-4m-8 4v8",
1307
+ discounts: "M3 12V4h8l10 10-8 8L3 12zm5-5h.01",
1308
+ shipping: "M2 6h11v9H2V6zm11 3h4l3 3v3h-7V9zM6 18.5h.01M17 18.5h.01",
1309
+ products: "M4 7h16v13H4V7zm0 0l2-3h12l2 3M9 12h6",
1310
+ search: "M11 4a7 7 0 100 14 7 7 0 000-14zm9 16l-4-4"
1311
+ };
1312
+ function be({ icon: e, title: t, body: n, action: r, children: i }) {
1313
+ return /* @__PURE__ */ w("div", {
1314
+ className: "sfa-empty-state",
1315
+ children: [
1316
+ /* @__PURE__ */ C("svg", {
1317
+ className: "sfa-empty-state__icon",
1318
+ viewBox: "0 0 24 24",
1319
+ width: "48",
1320
+ height: "48",
1321
+ fill: "none",
1322
+ stroke: "currentColor",
1323
+ strokeWidth: "1.5",
1324
+ strokeLinecap: "round",
1325
+ strokeLinejoin: "round",
1326
+ "aria-hidden": "true",
1327
+ focusable: "false",
1328
+ children: /* @__PURE__ */ C("path", { d: ye[e] })
1329
+ }),
1330
+ /* @__PURE__ */ C("h2", {
1331
+ className: "sfa-empty-state__title",
1332
+ children: t
1333
+ }),
1334
+ n ? /* @__PURE__ */ C("p", {
1335
+ className: "sfa-empty-state__body",
1336
+ children: n
1337
+ }) : null,
1338
+ i,
1339
+ r ? /* @__PURE__ */ C("div", {
1340
+ className: "sfa-empty-state__action",
1341
+ children: r
1342
+ }) : null
1343
+ ]
1344
+ });
1345
+ }
1229
1346
  // src/lib/product-missing.ts
1230
- function he(e, t) {
1347
+ function xe(e, t) {
1231
1348
  return e.status === "draft" ? e.priceCents === null ? t.needsPrice : e.category ? e.images.length === 0 ? t.needsPhoto : null : t.needsCategory : null;
1232
1349
  }
1233
1350
  function J(e, t) {
1234
1351
  return e.replace(/\{(\w+)\}/g, (e, n) => String(t[n] ?? ""));
1235
1352
  }
1236
1353
  // src/components/setup-checklist/setup-checklist.tsx
1237
- function ge({ step: e }) {
1354
+ function Se({ step: e }) {
1238
1355
  let t = e.locked ? e.lockedDetail : e.detail;
1239
- return /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("span", {
1240
- className: "sfa-setup__mark",
1241
- "aria-hidden": "true",
1242
- children: e.done ? "✓" : ""
1243
- }), /* @__PURE__ */ w("span", {
1244
- className: "sfa-setup__text",
1245
- children: [/* @__PURE__ */ C("span", {
1246
- className: "sfa-setup__name",
1247
- children: e.title
1248
- }), t ? /* @__PURE__ */ C("span", {
1249
- className: "sfa-setup__detail",
1250
- children: t
1251
- }) : null]
1252
- })] });
1356
+ return /* @__PURE__ */ w(S, { children: [
1357
+ /* @__PURE__ */ C("span", {
1358
+ className: "sfa-setup__mark",
1359
+ "aria-hidden": "true",
1360
+ children: e.done ? "✓" : ""
1361
+ }),
1362
+ /* @__PURE__ */ w("span", {
1363
+ className: "sfa-setup__text",
1364
+ children: [/* @__PURE__ */ C("span", {
1365
+ className: "sfa-setup__name",
1366
+ children: e.title
1367
+ }), t ? /* @__PURE__ */ C("span", {
1368
+ className: "sfa-setup__detail",
1369
+ children: t
1370
+ }) : null]
1371
+ }),
1372
+ Ce(e) ? /* @__PURE__ */ C("span", {
1373
+ className: "sfa-setup__chevron",
1374
+ "aria-hidden": "true",
1375
+ children: "›"
1376
+ }) : null
1377
+ ] });
1378
+ }
1379
+ function Ce(e) {
1380
+ return !e.done && !e.locked && !!(e.href || e.onSelect);
1253
1381
  }
1254
- function _e({ step: e }) {
1382
+ function we({ step: e }) {
1255
1383
  let { renderLink: t } = F(), n = `sfa-setup__step${e.done ? " is-done" : ""}${e.locked ? " is-locked" : ""}`, r = !e.done && !e.locked, i;
1256
1384
  return i = r && e.href ? t({
1257
1385
  href: e.href,
1258
- children: /* @__PURE__ */ C(ge, { step: e }),
1386
+ children: /* @__PURE__ */ C(Se, { step: e }),
1259
1387
  className: "sfa-setup__action"
1260
1388
  }) : r && e.onSelect ? /* @__PURE__ */ C("button", {
1261
1389
  type: "button",
1262
1390
  className: "sfa-setup__action",
1263
1391
  onClick: e.onSelect,
1264
- children: /* @__PURE__ */ C(ge, { step: e })
1392
+ children: /* @__PURE__ */ C(Se, { step: e })
1265
1393
  }) : /* @__PURE__ */ C("span", {
1266
1394
  className: "sfa-setup__action",
1267
- children: /* @__PURE__ */ C(ge, { step: e })
1395
+ children: /* @__PURE__ */ C(Se, { step: e })
1268
1396
  }), /* @__PURE__ */ C("li", {
1269
1397
  className: n,
1270
1398
  "data-step": e.id,
1271
1399
  children: i
1272
1400
  });
1273
1401
  }
1274
- function ve({ steps: e, compact: t = !1 }) {
1275
- let { labels: n } = F(), r = n.products.setup, [i, a] = b(!1), o = e.filter((e) => e.done).length;
1402
+ function Te({ steps: e, compact: t = !1 }) {
1403
+ let { labels: n } = F(), r = n.products.setup, [i, a] = b(!0), o = e.filter((e) => e.done).length;
1276
1404
  if (e.length === 0 || o === e.length) return null;
1277
1405
  let s = J(r.progress, {
1278
1406
  done: o,
@@ -1313,19 +1441,19 @@ function ve({ steps: e, compact: t = !1 }) {
1313
1441
  }),
1314
1442
  c ? /* @__PURE__ */ C("ul", {
1315
1443
  className: "sfa-setup__list",
1316
- children: e.map((e) => /* @__PURE__ */ C(_e, { step: e }, e.id))
1444
+ children: e.map((e) => /* @__PURE__ */ C(we, { step: e }, e.id))
1317
1445
  }) : null
1318
1446
  ]
1319
1447
  });
1320
1448
  }
1321
1449
  // src/lib/product-filter.ts
1322
- function ye(e) {
1450
+ function Ee(e) {
1323
1451
  return e.status === "active" && e.quantity === 0;
1324
1452
  }
1325
- function be(e) {
1326
- return ye(e) ? "sold" : e.status;
1453
+ function De(e) {
1454
+ return Ee(e) ? "sold" : e.status;
1327
1455
  }
1328
- function xe(e) {
1456
+ function Oe(e) {
1329
1457
  switch (e) {
1330
1458
  case "live":
1331
1459
  case "sold": return "active";
@@ -1334,12 +1462,12 @@ function xe(e) {
1334
1462
  case "all": return;
1335
1463
  }
1336
1464
  }
1337
- function Se(e) {
1465
+ function ke(e) {
1338
1466
  if (e === "live") return "in";
1339
1467
  if (e === "sold") return "sold";
1340
1468
  }
1341
1469
  // src/lib/use-debounced.ts
1342
- function Ce(e, t) {
1470
+ function Ae(e, t) {
1343
1471
  let [n, r] = b(e);
1344
1472
  return _(() => {
1345
1473
  let n = setTimeout(() => r(e), t);
@@ -1347,7 +1475,7 @@ function Ce(e, t) {
1347
1475
  }, [e, t]), n;
1348
1476
  }
1349
1477
  // src/lib/use-paged-list.ts
1350
- function we(e, t) {
1478
+ function je(e, t) {
1351
1479
  let n = L(e, () => t()), [r, i] = b(null), a = R(async (e, n) => {
1352
1480
  let r = await t(e);
1353
1481
  i((e) => ({
@@ -1370,21 +1498,21 @@ function we(e, t) {
1370
1498
  };
1371
1499
  }
1372
1500
  // src/lib/use-product-pages.ts
1373
- function Te(e) {
1501
+ function Me(e) {
1374
1502
  let t = I();
1375
- return we(["admin-products", e], (n) => t.listProducts(n ? {
1503
+ return je(["admin-products", e], (n) => t.listProducts(n ? {
1376
1504
  ...e,
1377
1505
  cursor: n
1378
1506
  } : e));
1379
1507
  }
1380
1508
  // src/lib/product-sheet-actions.ts
1381
- function Ee(e) {
1509
+ function Ne(e) {
1382
1510
  return e.name.trim() !== "" && e.priceCents !== null && !!e.category && e.images.length > 0;
1383
1511
  }
1384
- function De(e) {
1385
- return e.status === "draft" ? Ee(e) ? "publish" : "finish" : e.status === "archived" ? "restore" : e.quantity > 0 ? "sold" : "restock";
1512
+ function Pe(e) {
1513
+ return e.status === "draft" ? Ne(e) ? "publish" : "finish" : e.status === "archived" ? "restore" : e.quantity > 0 ? "sold" : "restock";
1386
1514
  }
1387
- function Oe(e, t) {
1515
+ function Fe(e, t) {
1388
1516
  switch (t) {
1389
1517
  case "publish": return {
1390
1518
  patch: { status: "active" },
@@ -1405,25 +1533,52 @@ function Oe(e, t) {
1405
1533
  case "finish": return null;
1406
1534
  }
1407
1535
  }
1408
- var ke = {
1536
+ var Ie = {
1409
1537
  patch: { status: "draft" },
1410
1538
  undo: { status: "active" }
1411
1539
  };
1412
- function Ae(e) {
1540
+ function Le(e) {
1413
1541
  return {
1414
1542
  patch: { status: "archived" },
1415
1543
  undo: { status: e.status }
1416
1544
  };
1417
1545
  }
1418
- function je(e) {
1546
+ function Re(e) {
1419
1547
  return {
1420
1548
  patch: { featured: !e.featured },
1421
1549
  undo: { featured: e.featured }
1422
1550
  };
1423
1551
  }
1424
- var Me = (e) => e.status === "active";
1552
+ var ze = (e) => e.status === "active";
1553
+ // src/views/products/product-sheet/delete-draft-button.tsx
1554
+ function Be(e) {
1555
+ return e.status === "draft" && !e.everPublished;
1556
+ }
1557
+ function Ve({ product: e, disabled: t, onDeleted: n }) {
1558
+ let r = F().labels.products.sheet, i = I(), [a, o] = b(!1), s = R(async () => (await i.deleteProduct(e.id), !0));
1559
+ return /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("button", {
1560
+ type: "button",
1561
+ className: "sfa-btn",
1562
+ disabled: t,
1563
+ onClick: () => {
1564
+ s.reset(), o(!0);
1565
+ },
1566
+ children: r.deleteDraft
1567
+ }), /* @__PURE__ */ w(G, {
1568
+ open: a,
1569
+ title: r.deleteTitle,
1570
+ destructive: !0,
1571
+ confirmLabel: r.deleteConfirm,
1572
+ pending: s.pending,
1573
+ onConfirm: async () => {
1574
+ await s.run() && (o(!1), n());
1575
+ },
1576
+ onCancel: () => o(!1),
1577
+ children: [/* @__PURE__ */ C("p", { children: r.deleteBody }), /* @__PURE__ */ C(q, { error: s.error })]
1578
+ })] });
1579
+ }
1425
1580
  // src/views/products/product-sheet/sheet-carousel.tsx
1426
- function Ne({ product: e }) {
1581
+ function He({ product: e }) {
1427
1582
  let { labels: t, renderImage: n } = F(), r = t.products.sheet, [i, a] = b(0), o = e.images.length, s = e.images[Math.min(i, Math.max(o - 1, 0))];
1428
1583
  if (!s) return /* @__PURE__ */ C("div", {
1429
1584
  className: "sfa-sheet__photo",
@@ -1457,7 +1612,7 @@ function Ne({ product: e }) {
1457
1612
  });
1458
1613
  }
1459
1614
  // src/views/products/product-sheet/use-product-change.ts
1460
- function Pe(e, t, n) {
1615
+ function Ue(e, t, n) {
1461
1616
  let r = I(), [i, a] = b(null), o = R((t) => r.updateProduct(e.id, t)), s = async (e, r) => {
1462
1617
  a(null);
1463
1618
  let i = await o.run(e.patch);
@@ -1482,13 +1637,13 @@ function Pe(e, t, n) {
1482
1637
  };
1483
1638
  }
1484
1639
  // src/views/products/product-sheet/sheet-edit-link.tsx
1485
- function Fe(e, t) {
1640
+ function We(e, t) {
1486
1641
  return `${e}${e.includes("?") ? "&" : "?"}step=${t}`;
1487
1642
  }
1488
- function Ie(e) {
1643
+ function Ge(e) {
1489
1644
  return !e.name || e.priceCents === null || !e.category || e.images.length > 0 ? "basics" : "photos";
1490
1645
  }
1491
- function Le({ product: e, step: t, onEdit: n, className: r, children: i }) {
1646
+ function Ke({ product: e, step: t, onEdit: n, className: r, children: i }) {
1492
1647
  let { hrefs: a, renderLink: o } = F();
1493
1648
  return n ? /* @__PURE__ */ C("button", {
1494
1649
  type: "button",
@@ -1496,30 +1651,31 @@ function Le({ product: e, step: t, onEdit: n, className: r, children: i }) {
1496
1651
  onClick: () => n(e, t),
1497
1652
  children: i
1498
1653
  }) : o({
1499
- href: Fe(a.product(e.id), t),
1654
+ href: We(a.product(e.id), t),
1500
1655
  children: i,
1501
1656
  className: r
1502
1657
  });
1503
1658
  }
1504
1659
  // src/views/products/product-sheet/admin-product-sheet.tsx
1505
- function Re({ productId: e, onClose: t, onEdit: n, onChanged: r }) {
1660
+ function qe({ productId: e, onClose: t, onEdit: n, onChanged: r }) {
1506
1661
  let i = I(), a = L(["admin-product", e], () => i.getProduct(e)), [o, s] = b(null), c = o && o.id === e ? o : a.data;
1507
- return /* @__PURE__ */ C(Be, {
1662
+ return /* @__PURE__ */ C(Ye, {
1508
1663
  onClose: t,
1509
- children: c ? /* @__PURE__ */ C(Ve, {
1664
+ children: c ? /* @__PURE__ */ C(Xe, {
1510
1665
  product: c,
1511
1666
  setProduct: s,
1512
1667
  onEdit: n,
1513
- onChanged: r ?? (() => void 0)
1514
- }) : /* @__PURE__ */ C(ze, { error: a.error })
1668
+ onChanged: r ?? (() => void 0),
1669
+ onClose: t
1670
+ }) : /* @__PURE__ */ C(Je, { error: a.error })
1515
1671
  });
1516
1672
  }
1517
- function ze({ error: e }) {
1673
+ function Je({ error: e }) {
1518
1674
  let { labels: t } = F();
1519
1675
  return e ? /* @__PURE__ */ C(q, { error: e }) : /* @__PURE__ */ C("p", { children: t.loading });
1520
1676
  }
1521
- function Be({ onClose: e, children: t }) {
1522
- let { labels: n } = F(), r = y(null), i = fe(r, !0, e);
1677
+ function Ye({ onClose: e, children: t }) {
1678
+ let { labels: n } = F(), r = y(null), i = ge(r, !0, e);
1523
1679
  return /* @__PURE__ */ w("div", {
1524
1680
  className: "sfa-sheet-layer",
1525
1681
  onKeyDown: i,
@@ -1550,17 +1706,17 @@ function Be({ onClose: e, children: t }) {
1550
1706
  })]
1551
1707
  });
1552
1708
  }
1553
- function Ve({ product: e, setProduct: t, onEdit: n, onChanged: r }) {
1554
- let { labels: i, hrefs: a } = F(), o = i.products.sheet, s = Pe(e, t, r), c = De(e), l = Oe(e, c), u = a.storefrontProduct?.(e.slug), d = {
1709
+ function Xe({ product: e, setProduct: t, onEdit: n, onChanged: r, onClose: i }) {
1710
+ let { labels: a, hrefs: o } = F(), s = a.products.sheet, c = Ue(e, t, r), l = Pe(e), u = Fe(e, l), d = o.storefrontProduct?.(e.slug), f = {
1555
1711
  product: e,
1556
1712
  onEdit: n
1557
- }, f = async () => {
1558
- u && (await navigator.clipboard.writeText(new URL(u, window.location.href).href), s.announce(o.linkCopied));
1713
+ }, p = async () => {
1714
+ d && (await navigator.clipboard.writeText(new URL(d, window.location.href).href), c.announce(s.linkCopied));
1559
1715
  };
1560
1716
  return /* @__PURE__ */ w("div", {
1561
1717
  className: "sfa-sheet__body",
1562
1718
  children: [
1563
- /* @__PURE__ */ C(Ne, { product: e }),
1719
+ /* @__PURE__ */ C(He, { product: e }),
1564
1720
  /* @__PURE__ */ C("h2", {
1565
1721
  className: "sfa-sheet__name",
1566
1722
  children: e.name
@@ -1568,99 +1724,105 @@ function Ve({ product: e, setProduct: t, onEdit: n, onChanged: r }) {
1568
1724
  /* @__PURE__ */ w("p", {
1569
1725
  className: "sfa-sheet__meta",
1570
1726
  children: [
1571
- /* @__PURE__ */ C(U, { status: be(e) }),
1727
+ /* @__PURE__ */ C(U, { status: De(e) }),
1572
1728
  /* @__PURE__ */ C("span", { children: e.priceCents === null ? "—" : /* @__PURE__ */ C(W, {
1573
1729
  cents: e.priceCents,
1574
1730
  currency: e.currency
1575
1731
  }) }),
1576
- /* @__PURE__ */ C("span", { children: e.category ?? o.noCategory })
1732
+ /* @__PURE__ */ C("span", { children: e.category ?? s.noCategory })
1577
1733
  ]
1578
1734
  }),
1579
- s.missing ? /* @__PURE__ */ w(K, {
1735
+ c.missing ? /* @__PURE__ */ w(K, {
1580
1736
  variant: "warning",
1581
1737
  children: [
1582
- o.missingTitle,
1738
+ s.missingTitle,
1583
1739
  " ",
1584
- s.missing.map((e) => o.missing[e] ?? e).join(", ")
1740
+ c.missing.map((e) => s.missing[e] ?? e).join(", ")
1585
1741
  ]
1586
1742
  }) : null,
1587
- /* @__PURE__ */ C(q, { error: s.error }),
1588
- l ? /* @__PURE__ */ C("button", {
1743
+ /* @__PURE__ */ C(q, { error: c.error }),
1744
+ u ? /* @__PURE__ */ C("button", {
1589
1745
  type: "button",
1590
1746
  className: "sfa-btn sfa-btn--primary sfa-sheet__primary",
1591
- disabled: s.pending,
1592
- onClick: () => s.apply(l, o.done[c]),
1593
- children: o.primary[c]
1747
+ disabled: c.pending,
1748
+ onClick: () => c.apply(u, s.done[l]),
1749
+ children: s.primary[l]
1594
1750
  }) : /* @__PURE__ */ C("span", {
1595
1751
  className: "sfa-sheet__primary",
1596
- children: /* @__PURE__ */ C(Le, {
1597
- ...d,
1598
- step: Ie(e),
1752
+ children: /* @__PURE__ */ C(Ke, {
1753
+ ...f,
1754
+ step: Ge(e),
1599
1755
  className: "sfa-btn sfa-btn--primary",
1600
- children: o.primary.finish
1756
+ children: s.primary.finish
1601
1757
  })
1602
1758
  }),
1603
1759
  /* @__PURE__ */ w("div", {
1604
1760
  className: "sfa-sheet__actions",
1605
1761
  children: [
1606
- /* @__PURE__ */ C(Le, {
1607
- ...d,
1762
+ /* @__PURE__ */ C(Ke, {
1763
+ ...f,
1608
1764
  step: "basics",
1609
1765
  className: "sfa-btn",
1610
- children: o.edit
1766
+ children: s.edit
1611
1767
  }),
1612
- /* @__PURE__ */ C(Le, {
1613
- ...d,
1768
+ /* @__PURE__ */ C(Ke, {
1769
+ ...f,
1614
1770
  step: "photos",
1615
1771
  className: "sfa-btn",
1616
- children: J(o.photos, { count: e.images.length })
1772
+ children: J(s.photos, { count: e.images.length })
1617
1773
  }),
1618
- Me(e) ? /* @__PURE__ */ C("button", {
1774
+ ze(e) ? /* @__PURE__ */ C("button", {
1619
1775
  type: "button",
1620
1776
  className: "sfa-btn",
1621
- disabled: s.pending,
1622
- onClick: () => s.apply(je(e), o.done.feature),
1623
- children: e.featured ? o.featureOff : o.featureOn
1777
+ disabled: c.pending,
1778
+ onClick: () => c.apply(Re(e), s.done.feature),
1779
+ children: e.featured ? s.featureOff : s.featureOn
1624
1780
  }) : null,
1625
1781
  e.status === "active" ? /* @__PURE__ */ C("button", {
1626
1782
  type: "button",
1627
1783
  className: "sfa-btn",
1628
- disabled: s.pending,
1629
- onClick: () => s.apply(ke, o.done.hide),
1630
- children: o.hide
1784
+ disabled: c.pending,
1785
+ onClick: () => c.apply(Ie, s.done.hide),
1786
+ children: s.hide
1631
1787
  }) : null,
1632
- u ? /* @__PURE__ */ C("button", {
1788
+ d ? /* @__PURE__ */ C("button", {
1633
1789
  type: "button",
1634
1790
  className: "sfa-btn",
1635
- onClick: f,
1636
- children: o.copyLink
1791
+ onClick: p,
1792
+ children: s.copyLink
1637
1793
  }) : null,
1638
- e.status === "archived" ? null : /* @__PURE__ */ C("button", {
1794
+ Be(e) ? /* @__PURE__ */ C(Ve, {
1795
+ product: e,
1796
+ disabled: c.pending,
1797
+ onDeleted: () => {
1798
+ r(), i();
1799
+ }
1800
+ }) : e.status === "archived" ? null : /* @__PURE__ */ C("button", {
1639
1801
  type: "button",
1640
1802
  className: "sfa-btn",
1641
- disabled: s.pending,
1642
- onClick: () => s.apply(Ae(e), o.done.archive),
1643
- children: o.archive
1803
+ disabled: c.pending,
1804
+ onClick: () => c.apply(Le(e), s.done.archive),
1805
+ children: s.archive
1644
1806
  })
1645
1807
  ]
1646
1808
  }),
1647
- s.notice ? /* @__PURE__ */ C(K, {
1809
+ c.notice ? /* @__PURE__ */ C(K, {
1648
1810
  variant: "success",
1649
1811
  toast: !0,
1650
1812
  duration: 8e3,
1651
- onDismiss: s.dismiss,
1652
- action: s.notice.undo ? {
1653
- label: o.undo,
1654
- onAction: s.undo
1813
+ onDismiss: c.dismiss,
1814
+ action: c.notice.undo ? {
1815
+ label: s.undo,
1816
+ onAction: c.undo
1655
1817
  } : void 0,
1656
- children: s.notice.text
1818
+ children: c.notice.text
1657
1819
  }) : null
1658
1820
  ]
1659
1821
  });
1660
1822
  }
1661
1823
  // src/views/products/product-card.tsx
1662
- function He({ product: e, onOpen: t }) {
1663
- let { labels: n, renderImage: r } = F(), i = n.products, a = be(e), o = he(e, i.card), s = e.images[0], c = /* @__PURE__ */ C("button", {
1824
+ function Ze({ product: e, onOpen: t }) {
1825
+ let { labels: n, renderImage: r } = F(), i = n.products, a = De(e), o = xe(e, i.card), s = e.images[0], c = /* @__PURE__ */ C("button", {
1664
1826
  type: "button",
1665
1827
  className: "sfa-card__name sfa-link--tap",
1666
1828
  onClick: t,
@@ -1708,17 +1870,17 @@ function He({ product: e, onOpen: t }) {
1708
1870
  });
1709
1871
  }
1710
1872
  // src/views/products/product-toolbar.tsx
1711
- var Ue = [
1873
+ var Qe = [
1712
1874
  "all",
1713
1875
  "live",
1714
1876
  "sold",
1715
1877
  "draft",
1716
1878
  "archived"
1717
1879
  ];
1718
- function We(e, t) {
1880
+ function $e(e, t) {
1719
1881
  return t === "all" ? e.all : e[t];
1720
1882
  }
1721
- function Ge({ filter: e, onFilter: t, search: n, onSearch: r, counts: i }) {
1883
+ function et({ filter: e, onFilter: t, search: n, onSearch: r, counts: i }) {
1722
1884
  let { labels: a } = F(), o = a.products, [s, c] = b(!1);
1723
1885
  return /* @__PURE__ */ w("div", {
1724
1886
  className: "sfa-products__toolbar",
@@ -1727,14 +1889,14 @@ function Ge({ filter: e, onFilter: t, search: n, onSearch: r, counts: i }) {
1727
1889
  role: "group",
1728
1890
  "aria-label": o.columns.status,
1729
1891
  className: "sfa-filter-group",
1730
- children: Ue.map((n) => /* @__PURE__ */ w("button", {
1892
+ children: Qe.map((n) => /* @__PURE__ */ w("button", {
1731
1893
  type: "button",
1732
1894
  className: "sfa-chip",
1733
1895
  "aria-pressed": e === n,
1734
1896
  onClick: () => t(n),
1735
1897
  children: [o.filters[n], i ? /* @__PURE__ */ C("span", {
1736
1898
  className: "sfa-chip__count",
1737
- children: We(i, n)
1899
+ children: $e(i, n)
1738
1900
  }) : null]
1739
1901
  }, n))
1740
1902
  }),
@@ -1757,7 +1919,7 @@ function Ge({ filter: e, onFilter: t, search: n, onSearch: r, counts: i }) {
1757
1919
  });
1758
1920
  }
1759
1921
  // src/views/products/product-welcome.tsx
1760
- function Ke() {
1922
+ function tt() {
1761
1923
  return /* @__PURE__ */ w("svg", {
1762
1924
  className: "sfa-welcome__art",
1763
1925
  viewBox: "0 0 120 120",
@@ -1794,14 +1956,14 @@ function Ke() {
1794
1956
  ]
1795
1957
  });
1796
1958
  }
1797
- function qe({ art: e, steps: t, onAddMany: n }) {
1959
+ function nt({ art: e, steps: t, onAddMany: n }) {
1798
1960
  let { labels: r, hrefs: i, renderLink: a } = F(), o = r.products.welcome;
1799
1961
  return /* @__PURE__ */ w("div", {
1800
1962
  className: "sfa-welcome",
1801
1963
  children: [/* @__PURE__ */ w("div", {
1802
1964
  className: "sfa-welcome__hero",
1803
1965
  children: [
1804
- e ?? /* @__PURE__ */ C(Ke, {}),
1966
+ e ?? /* @__PURE__ */ C(tt, {}),
1805
1967
  /* @__PURE__ */ C("h2", {
1806
1968
  className: "sfa-welcome__title",
1807
1969
  children: o.title
@@ -1824,12 +1986,12 @@ function qe({ art: e, steps: t, onAddMany: n }) {
1824
1986
  }) : null]
1825
1987
  })
1826
1988
  ]
1827
- }), t ? /* @__PURE__ */ C(ve, { steps: t }) : null]
1989
+ }), t ? /* @__PURE__ */ C(Te, { steps: t }) : null]
1828
1990
  });
1829
1991
  }
1830
1992
  // src/views/products/admin-product-list.tsx
1831
- function Je({ welcome: e, setup: t, onAddMany: n, onFinishDrafts: r, onOpenProduct: i, onEditProduct: a } = {}) {
1832
- let o = I(), { labels: s, hrefs: c, renderLink: l } = F(), u = s.products, [d, f] = b("all"), [p, m] = b(""), h = Ce(p.trim(), 300), g = xe(d), _ = Se(d), v = Te({
1993
+ function rt({ welcome: e, setup: t, onAddMany: n, onFinishDrafts: r, onOpenProduct: i, onEditProduct: a } = {}) {
1994
+ let o = I(), { labels: s, hrefs: c, renderLink: l } = F(), u = s.products, [d, f] = b("all"), [p, m] = b(""), h = Ae(p.trim(), 300), g = Oe(d), _ = ke(d), v = Me({
1833
1995
  ...g ? { status: g } : {},
1834
1996
  ...d === "all" ? { excludeArchived: "true" } : {},
1835
1997
  ..._ ? { stock: _ } : {},
@@ -1849,12 +2011,12 @@ function Je({ welcome: e, setup: t, onAddMany: n, onFinishDrafts: r, onOpenProdu
1849
2011
  floatingAction: O ? void 0 : N
1850
2012
  }),
1851
2013
  /* @__PURE__ */ C(q, { error: v.error ?? y.error }),
1852
- k || v.loading && !v.loaded && !O ? /* @__PURE__ */ C("p", { children: s.loading }) : O ? /* @__PURE__ */ C(qe, {
2014
+ k || v.loading && !v.loaded && !O ? /* @__PURE__ */ C("p", { children: s.loading }) : O ? /* @__PURE__ */ C(nt, {
1853
2015
  art: e,
1854
2016
  steps: t,
1855
2017
  onAddMany: n
1856
2018
  }) : /* @__PURE__ */ w(S, { children: [
1857
- t ? /* @__PURE__ */ C(ve, {
2019
+ t ? /* @__PURE__ */ C(Te, {
1858
2020
  steps: t,
1859
2021
  compact: !0
1860
2022
  }) : null,
@@ -1868,19 +2030,34 @@ function Je({ welcome: e, setup: t, onAddMany: n, onFinishDrafts: r, onOpenProdu
1868
2030
  children: u.draftsBanner.finish
1869
2031
  }) : null]
1870
2032
  }) : null,
1871
- /* @__PURE__ */ C(Ge, {
2033
+ /* @__PURE__ */ C(et, {
1872
2034
  filter: d,
1873
2035
  onFilter: f,
1874
2036
  search: p,
1875
2037
  onSearch: m,
1876
2038
  counts: D
1877
2039
  }),
1878
- A.length === 0 ? /* @__PURE__ */ C("p", {
1879
- className: "sfa-empty",
1880
- children: j
2040
+ A.length === 0 ? /* @__PURE__ */ C(be, {
2041
+ icon: h ? "search" : "products",
2042
+ title: j,
2043
+ action: h ? /* @__PURE__ */ C("button", {
2044
+ type: "button",
2045
+ className: "sfa-btn",
2046
+ onClick: () => m(""),
2047
+ children: u.emptyActions.clearSearch
2048
+ }) : /* @__PURE__ */ w(S, { children: [l({
2049
+ href: c.newProduct,
2050
+ children: u.emptyActions.start,
2051
+ className: "sfa-btn sfa-btn--primary"
2052
+ }), n ? /* @__PURE__ */ C("button", {
2053
+ type: "button",
2054
+ className: "sfa-btn",
2055
+ onClick: n,
2056
+ children: u.welcome.addMany
2057
+ }) : null] })
1881
2058
  }) : /* @__PURE__ */ C("ul", {
1882
2059
  className: "sfa-grid",
1883
- children: A.map((e) => /* @__PURE__ */ C(He, {
2060
+ children: A.map((e) => /* @__PURE__ */ C(Ze, {
1884
2061
  product: e,
1885
2062
  onOpen: () => i ? i(e) : T(e.id)
1886
2063
  }, e.id))
@@ -1893,7 +2070,7 @@ function Je({ welcome: e, setup: t, onAddMany: n, onFinishDrafts: r, onOpenProdu
1893
2070
  children: u.loadMore
1894
2071
  }) : null
1895
2072
  ] }),
1896
- x ? /* @__PURE__ */ C(Re, {
2073
+ x ? /* @__PURE__ */ C(qe, {
1897
2074
  productId: x,
1898
2075
  onClose: () => T(null),
1899
2076
  onEdit: a,
@@ -1903,7 +2080,7 @@ function Je({ welcome: e, setup: t, onAddMany: n, onFinishDrafts: r, onOpenProdu
1903
2080
  });
1904
2081
  }
1905
2082
  // src/components/switch/switch.tsx
1906
- function Ye({ id: e, label: t, checked: n, onChange: r }) {
2083
+ function it({ id: e, label: t, checked: n, onChange: r }) {
1907
2084
  return /* @__PURE__ */ w("label", {
1908
2085
  className: "sfa-switch",
1909
2086
  htmlFor: e,
@@ -1917,9 +2094,9 @@ function Ye({ id: e, label: t, checked: n, onChange: r }) {
1917
2094
  });
1918
2095
  }
1919
2096
  // src/lib/money-input.ts
1920
- var Xe = /^\$?\s*(\d+|\d{1,3}(?:,\d{3})+)?(?:\.(\d{1,2}))?$/;
2097
+ var at = /^\$?\s*(\d+|\d{1,3}(?:,\d{3})+)?(?:\.(\d{1,2}))?$/;
1921
2098
  function Y(e) {
1922
- let t = e.trim(), n = Xe.exec(t);
2099
+ let t = e.trim(), n = at.exec(t);
1923
2100
  if (!n || !n[1] && !n[2]) return null;
1924
2101
  let r = Number((n[1] ?? "0").replace(/,/g, "")), i = Number((n[2] ?? "").padEnd(2, "0")), a = r * 100 + i;
1925
2102
  return Number.isSafeInteger(a) ? a : null;
@@ -1928,56 +2105,62 @@ function X(e) {
1928
2105
  return `${Math.floor(e / 100)}.${String(e % 100).padStart(2, "0")}`;
1929
2106
  }
1930
2107
  // src/lib/product-draft.ts
1931
- function Ze(e) {
2108
+ function ot(e) {
1932
2109
  let t = e.trim();
1933
2110
  return t === "" ? null : t;
1934
2111
  }
1935
- function Qe(e) {
2112
+ function st(e) {
1936
2113
  return /^\d+$/.test(e.trim()) ? Number(e.trim()) : null;
1937
2114
  }
1938
- function $e(e) {
1939
- let t = e.name.trim(), n = e.category.trim(), r = Y(e.price), i = Qe(e.quantity);
2115
+ function ct(e) {
2116
+ let t = e.name.trim(), n = e.category.trim(), r = Y(e.price), i = st(e.quantity);
1940
2117
  return {
1941
2118
  ...t ? { name: t } : {},
1942
2119
  ...n ? { category: n } : {},
1943
2120
  ...r === null ? {} : { priceCents: r },
1944
2121
  ...i === null ? {} : { quantity: i },
1945
2122
  description: e.description,
1946
- materials: Ze(e.materials),
1947
- dimensions: Ze(e.dimensions),
2123
+ materials: ot(e.materials),
2124
+ dimensions: ot(e.dimensions),
1948
2125
  featured: e.featured
1949
2126
  };
1950
2127
  }
1951
- function et(e) {
2128
+ function lt(e) {
1952
2129
  return e.name.trim() !== "";
1953
2130
  }
1954
- function tt(e, t) {
2131
+ function ut(e, t) {
1955
2132
  return {
1956
- ...$e(e),
2133
+ ...ct(e),
1957
2134
  ...t ? { currency: t } : {},
1958
2135
  status: "draft"
1959
2136
  };
1960
2137
  }
1961
- function nt(e, t) {
2138
+ function dt(e, t) {
1962
2139
  let n = {};
1963
- for (let [r, i] of Object.entries($e(t))) i !== e[r] && (n[r] = i);
2140
+ for (let [r, i] of Object.entries(ct(t))) i !== e[r] && (n[r] = i);
1964
2141
  return n;
1965
2142
  }
1966
- function rt(e) {
2143
+ function ft(e) {
1967
2144
  return e.name.trim() !== "" && e.category.trim() !== "" && Y(e.price) !== null;
1968
2145
  }
1969
- function it(e) {
2146
+ function pt(e) {
2147
+ let t = [];
2148
+ return e.name.trim() === "" && t.push("name"), Y(e.price) === null && t.push("price"), e.category.trim() === "" && t.push("category"), t;
2149
+ }
2150
+ function mt(e) {
2151
+ return e.replace(/(^|[\s-])(\p{L})/gu, (e, t, n) => t + n.toUpperCase());
2152
+ }
2153
+ function ht(e) {
1970
2154
  return e.split(",").map((e) => e.trim()).filter(Boolean);
1971
2155
  }
1972
- function at(e, t) {
1973
- let n = it(e);
1974
- return (n.includes(t) ? n.filter((e) => e !== t) : [...n, t]).join(", ");
2156
+ function gt(e, t) {
2157
+ return [...e, ...ht(t)].join(", ");
1975
2158
  }
1976
- function ot(e, t) {
2159
+ function _t(e, t) {
1977
2160
  let n = e.trimEnd();
1978
2161
  return n ? `${n}\n${t}` : t;
1979
2162
  }
1980
- function st(e, t) {
2163
+ function vt(e, t) {
1981
2164
  return new Intl.NumberFormat(e, {
1982
2165
  style: "currency",
1983
2166
  currency: t
@@ -1987,12 +2170,12 @@ function Z(e, t) {
1987
2170
  return e.replace(/\{(\w+)\}/g, (e, n) => t[n] ?? "");
1988
2171
  }
1989
2172
  // src/views/products/product-flow/basics-section.tsx
1990
- function ct(e, t) {
1991
- let n = [...e ?? []], r = t.trim();
1992
- return r && !n.includes(r) && n.push(r), n;
2173
+ function yt(e, t, n) {
2174
+ let r = t.trim();
2175
+ return n || !r || e.includes(r) ? e : [...e, r];
1993
2176
  }
1994
- function lt({ form: e, update: t, categories: n, currency: r }) {
1995
- let { labels: i, locale: a } = F(), o = i.products.flow, s = i.products.fields, c = ct(n, e.category), [l, u] = b(!1), [d, f] = b(e.quantity.trim() === "1");
2177
+ function bt({ form: e, update: t, categories: n, currency: r }) {
2178
+ let { labels: i, locale: a } = F(), o = i.products.flow, s = i.products.fields, c = n ?? [], [l, u] = b(!1), d = yt(c, e.category, l), f = d.some((e) => e.trim().toLowerCase() === "other"), [p, m] = b(e.quantity.trim() === "1");
1996
2179
  return /* @__PURE__ */ w(S, { children: [
1997
2180
  /* @__PURE__ */ w("div", {
1998
2181
  className: "sfa-field",
@@ -2018,7 +2201,7 @@ function lt({ form: e, update: t, categories: n, currency: r }) {
2018
2201
  className: "sfa-flow__price",
2019
2202
  children: [/* @__PURE__ */ C("span", {
2020
2203
  "aria-hidden": "true",
2021
- children: st(a, r)
2204
+ children: vt(a, r)
2022
2205
  }), /* @__PURE__ */ C("input", {
2023
2206
  id: "sfa-flow-price",
2024
2207
  type: "text",
@@ -2041,15 +2224,15 @@ function lt({ form: e, update: t, categories: n, currency: r }) {
2041
2224
  }),
2042
2225
  /* @__PURE__ */ w("div", {
2043
2226
  className: "sfa-flow__chips",
2044
- children: [c.map((n) => /* @__PURE__ */ C("button", {
2227
+ children: [d.map((n) => /* @__PURE__ */ C("button", {
2045
2228
  type: "button",
2046
2229
  className: "sfa-chip",
2047
2230
  "aria-pressed": !l && e.category.trim() === n,
2048
2231
  onClick: () => {
2049
2232
  u(!1), t("category", n);
2050
2233
  },
2051
- children: n
2052
- }, n)), /* @__PURE__ */ C("button", {
2234
+ children: mt(n)
2235
+ }, n)), f ? null : /* @__PURE__ */ C("button", {
2053
2236
  type: "button",
2054
2237
  className: "sfa-chip",
2055
2238
  "aria-pressed": l,
@@ -2079,15 +2262,15 @@ function lt({ form: e, update: t, categories: n, currency: r }) {
2079
2262
  onChange: (e) => t("category", e.target.value)
2080
2263
  })]
2081
2264
  }),
2082
- /* @__PURE__ */ C(Ye, {
2265
+ /* @__PURE__ */ C(it, {
2083
2266
  id: "sfa-flow-one-of-a-kind",
2084
2267
  label: o.oneOfAKind,
2085
- checked: d,
2268
+ checked: p,
2086
2269
  onChange: (n) => {
2087
- f(n), n ? t("quantity", "1") : e.quantity.trim() === "1" && t("quantity", "2");
2270
+ m(n), n ? t("quantity", "1") : e.quantity.trim() === "1" && t("quantity", "2");
2088
2271
  }
2089
2272
  }),
2090
- d ? null : /* @__PURE__ */ w("div", {
2273
+ p ? null : /* @__PURE__ */ w("div", {
2091
2274
  className: "sfa-field",
2092
2275
  children: [/* @__PURE__ */ C("label", {
2093
2276
  className: "sfa-field__label",
@@ -2104,15 +2287,15 @@ function lt({ form: e, update: t, categories: n, currency: r }) {
2104
2287
  ] });
2105
2288
  }
2106
2289
  // src/views/products/product-flow/flow-actions.tsx
2107
- function ut(e) {
2108
- let t = j.indexOf(e);
2109
- return j[Math.min(t + 1, j.length - 1)];
2290
+ function xt(e) {
2291
+ let t = M.indexOf(e);
2292
+ return M[Math.min(t + 1, M.length - 1)];
2110
2293
  }
2111
- function dt(e) {
2112
- let t = j.indexOf(e);
2113
- return t > 0 ? j[t - 1] : null;
2294
+ function St(e) {
2295
+ let t = M.indexOf(e);
2296
+ return t > 0 ? M[t - 1] : null;
2114
2297
  }
2115
- function ft({ flow: e }) {
2298
+ function Ct({ flow: e }) {
2116
2299
  let { labels: t } = F(), n = t.products.flow;
2117
2300
  return (e.product?.status ?? "draft") === "draft" ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("button", {
2118
2301
  type: "button",
@@ -2131,11 +2314,11 @@ function ft({ flow: e }) {
2131
2314
  className: "sfa-btn sfa-btn--primary",
2132
2315
  disabled: e.pending,
2133
2316
  onClick: e.saveDraft,
2134
- children: n.done
2317
+ children: n.saveChanges
2135
2318
  });
2136
2319
  }
2137
- function pt({ flow: e }) {
2138
- let { labels: t } = F(), n = t.products.flow, r = () => e.goTo(ut(e.step));
2320
+ function wt({ flow: e }) {
2321
+ let { labels: t } = F(), n = t.products.flow, r = () => e.goTo(xt(e.step));
2139
2322
  if (e.step === "photos") {
2140
2323
  let t = (e.product?.images.length ?? 0) > 0;
2141
2324
  return /* @__PURE__ */ C("button", {
@@ -2148,7 +2331,8 @@ function pt({ flow: e }) {
2148
2331
  return e.step === "basics" ? /* @__PURE__ */ C("button", {
2149
2332
  type: "button",
2150
2333
  className: "sfa-btn sfa-btn--primary",
2151
- disabled: !rt(e.form),
2334
+ disabled: !ft(e.form),
2335
+ "aria-describedby": "sfa-flow-continue-hint",
2152
2336
  onClick: r,
2153
2337
  children: n.continue
2154
2338
  }) : e.step === "story" ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("button", {
@@ -2161,36 +2345,69 @@ function pt({ flow: e }) {
2161
2345
  className: "sfa-btn sfa-btn--primary",
2162
2346
  onClick: r,
2163
2347
  children: n.continue
2164
- })] }) : /* @__PURE__ */ C(ft, { flow: e });
2348
+ })] }) : /* @__PURE__ */ C(Ct, { flow: e });
2349
+ }
2350
+ function Tt({ flow: e }) {
2351
+ let { labels: t, locale: n } = F(), r = t.products.flow;
2352
+ if (e.step !== "basics") return null;
2353
+ let i = pt(e.form);
2354
+ if (!i.length) return null;
2355
+ let a = new Intl.ListFormat(n, {
2356
+ style: "long",
2357
+ type: "conjunction"
2358
+ }).format(i.map((e) => t.products.fields[e].toLowerCase()));
2359
+ return /* @__PURE__ */ C("p", {
2360
+ id: "sfa-flow-continue-hint",
2361
+ className: "sfa-flow__hint",
2362
+ children: Z(r.continueNeeds, { things: a })
2363
+ });
2165
2364
  }
2166
2365
  // src/views/products/product-flow/flow-frame.tsx
2167
- function mt({ title: e, onBack: t, canGoBack: n, close: r }) {
2168
- let { labels: i } = F();
2366
+ function Et({ title: e, step: t, onBack: n, canGoBack: r, close: i }) {
2367
+ let { labels: a } = F(), o = a.products.flow;
2169
2368
  return /* @__PURE__ */ w("div", {
2170
2369
  className: "sfa-flow__head",
2171
2370
  children: [
2172
- /* @__PURE__ */ C("button", {
2371
+ /* @__PURE__ */ w("button", {
2173
2372
  type: "button",
2174
2373
  className: "sfa-btn sfa-btn--ghost sfa-flow__back",
2175
- "aria-label": i.products.flow.back,
2176
- disabled: !n,
2177
- onClick: t,
2178
- children: "‹"
2374
+ "aria-label": o.back,
2375
+ disabled: !r,
2376
+ onClick: n,
2377
+ children: [/* @__PURE__ */ C("span", {
2378
+ "aria-hidden": "true",
2379
+ children: "‹"
2380
+ }), /* @__PURE__ */ C("span", {
2381
+ className: "sfa-flow__btn-text",
2382
+ "aria-hidden": "true",
2383
+ children: o.back
2384
+ })]
2179
2385
  }),
2180
2386
  /* @__PURE__ */ C("h1", {
2181
2387
  className: "sfa-flow__title",
2182
2388
  children: e
2183
2389
  }),
2184
- r
2390
+ /* @__PURE__ */ w("p", {
2391
+ className: "sfa-flow__step-count",
2392
+ children: [
2393
+ Z(o.stepCount, {
2394
+ n: String(M.indexOf(t) + 1),
2395
+ total: String(M.length)
2396
+ }),
2397
+ " · ",
2398
+ o.steps[t]
2399
+ ]
2400
+ }),
2401
+ i
2185
2402
  ]
2186
2403
  });
2187
2404
  }
2188
- function ht({ step: e, allOpen: t, onStep: n }) {
2189
- let { labels: r } = F(), i = r.products.flow, a = j.indexOf(e);
2405
+ function Dt({ step: e, allOpen: t, onStep: n }) {
2406
+ let { labels: r } = F(), i = r.products.flow, a = M.indexOf(e);
2190
2407
  return /* @__PURE__ */ C("nav", {
2191
2408
  className: "sfa-flow__steps",
2192
2409
  "aria-label": i.stepsLabel,
2193
- children: /* @__PURE__ */ C("ol", { children: j.map((e, r) => /* @__PURE__ */ C("li", { children: /* @__PURE__ */ C("button", {
2410
+ children: /* @__PURE__ */ C("ol", { children: M.map((e, r) => /* @__PURE__ */ C("li", { children: /* @__PURE__ */ C("button", {
2194
2411
  type: "button",
2195
2412
  "aria-current": r === a ? "step" : void 0,
2196
2413
  "data-state": r < a ? "done" : void 0,
@@ -2200,7 +2417,7 @@ function ht({ step: e, allOpen: t, onStep: n }) {
2200
2417
  }) }, e)) })
2201
2418
  });
2202
2419
  }
2203
- function gt({ state: e, isNew: t, onRetry: n }) {
2420
+ function Ot({ state: e, isNew: t, onRetry: n }) {
2204
2421
  let { labels: r } = F(), i = r.products.flow;
2205
2422
  return e === "idle" ? null : e === "error" ? /* @__PURE__ */ w("div", {
2206
2423
  className: "sfa-flow__saved is-error",
@@ -2211,14 +2428,18 @@ function gt({ state: e, isNew: t, onRetry: n }) {
2211
2428
  onClick: n,
2212
2429
  children: i.retry
2213
2430
  })]
2214
- }) : /* @__PURE__ */ C("p", {
2215
- className: "sfa-flow__saved",
2431
+ }) : /* @__PURE__ */ w("p", {
2432
+ className: `sfa-flow__saved${e === "saving" ? " is-saving" : " is-saved"}`,
2216
2433
  role: "status",
2217
- children: e === "saving" ? i.saving : t ? i.savedNew : i.savedEdit
2434
+ children: [e === "saving" ? null : /* @__PURE__ */ C("span", {
2435
+ className: "sfa-flow__saved-check",
2436
+ "aria-hidden": "true",
2437
+ children: "✓"
2438
+ }), e === "saving" ? i.saving : t ? i.savedNew : i.savedEdit]
2218
2439
  });
2219
2440
  }
2220
- function _t({ step: e, active: t, children: n }) {
2221
- let { labels: r } = F(), i = r.products.flow;
2441
+ function kt({ step: e, active: t, live: n, children: r }) {
2442
+ let { labels: i } = F(), a = i.products.flow;
2222
2443
  return /* @__PURE__ */ w("section", {
2223
2444
  id: `sfa-flow-${e}`,
2224
2445
  className: `sfa-flow__section sfa-flow__section--${e}`,
@@ -2227,13 +2448,13 @@ function _t({ step: e, active: t, children: n }) {
2227
2448
  children: [
2228
2449
  /* @__PURE__ */ C("h2", {
2229
2450
  id: `sfa-flow-${e}-title`,
2230
- children: i.headings[e]
2451
+ children: n && e === "preview" ? a.previewHeadingLive : a.headings[e]
2231
2452
  }),
2232
2453
  /* @__PURE__ */ C("p", {
2233
2454
  className: "sfa-flow__lede",
2234
- children: i.ledes[e]
2455
+ children: a.ledes[e]
2235
2456
  }),
2236
- n
2457
+ r
2237
2458
  ]
2238
2459
  });
2239
2460
  }
@@ -2242,8 +2463,8 @@ function Q(e) {
2242
2463
  return [...e?.images ?? []].sort((e, t) => e.position - t.position);
2243
2464
  }
2244
2465
  // src/views/products/product-flow/flow-success.tsx
2245
- function vt({ success: e, onAddAnother: t, onDone: n }) {
2246
- let { labels: r, hrefs: i, renderImage: a, renderLink: o } = F(), s = r.products.flow, { product: c, first: l } = e, u = Q(c)[0];
2466
+ function At({ success: e, onAddAnother: t, onDone: n }) {
2467
+ let { labels: r, hrefs: i, renderImage: a, renderLink: o } = F(), s = r.products.flow, { product: c, first: l } = e, u = Q(c)[0], d = i.storefrontProduct?.(c.slug);
2247
2468
  return /* @__PURE__ */ w("section", {
2248
2469
  className: "sfa-flow-success",
2249
2470
  "aria-labelledby": "sfa-flow-success",
@@ -2271,6 +2492,11 @@ function vt({ success: e, onAddAnother: t, onDone: n }) {
2271
2492
  onClick: t,
2272
2493
  children: s.addAnother
2273
2494
  }),
2495
+ d ? o({
2496
+ href: d,
2497
+ children: s.seeInShop,
2498
+ className: "sfa-btn"
2499
+ }) : null,
2274
2500
  n ? /* @__PURE__ */ C("button", {
2275
2501
  type: "button",
2276
2502
  className: "sfa-btn",
@@ -2284,20 +2510,20 @@ function vt({ success: e, onAddAnother: t, onDone: n }) {
2284
2510
  ]
2285
2511
  });
2286
2512
  }
2287
- var yt = [
2513
+ var jt = [
2288
2514
  "image/jpeg",
2289
2515
  "image/png",
2290
2516
  "image/webp",
2291
2517
  "image/heic"
2292
2518
  ];
2293
- function $(e, t) {
2519
+ function Mt(e, t) {
2294
2520
  return e.replace(/\{(\w+)\}/g, (e, n) => t[n] ?? "");
2295
2521
  }
2296
- function bt(e, t) {
2297
- return yt.includes(e.type) ? e.size > 8388608 ? $(t.tooLarge, { name: e.name }) : null : $(t.wrongType, { name: e.name });
2522
+ function Nt(e, t) {
2523
+ return jt.includes(e.type) ? e.size > 8388608 ? Mt(t.tooLarge, { name: e.name }) : null : Mt(t.wrongType, { name: e.name });
2298
2524
  }
2299
2525
  // src/lib/use-image-upload.ts
2300
- function xt({ productId: e, resolveProductId: t, onUploaded: n }) {
2526
+ function Pt({ productId: e, resolveProductId: t, onUploaded: n }) {
2301
2527
  let r = I(), { labels: i } = F(), [a, o] = b([]), s = y(0), c = y(Promise.resolve()), l = y(n), u = y({
2302
2528
  productId: e,
2303
2529
  resolveProductId: t
@@ -2334,7 +2560,7 @@ function xt({ productId: e, resolveProductId: t, onUploaded: n }) {
2334
2560
  let n = e.map((e) => ({
2335
2561
  id: s.current++,
2336
2562
  file: e,
2337
- reason: bt(e, i.products.images)
2563
+ reason: Nt(e, i.products.images)
2338
2564
  }));
2339
2565
  o((e) => [...e, ...n.map(({ id: e, file: t, reason: n }) => ({
2340
2566
  id: e,
@@ -2348,16 +2574,16 @@ function xt({ productId: e, resolveProductId: t, onUploaded: n }) {
2348
2574
  };
2349
2575
  }
2350
2576
  // src/views/products/product-flow/photos-section.tsx
2351
- function St({ product: e, ensureProduct: t, setProduct: n, imagesSlot: r }) {
2352
- let i = I(), { labels: a, renderImage: o } = F(), s = a.products.flow, [c, l] = b(void 0), [u, d] = b(!1), f = Q(e), { entries: p, upload: m, dismiss: h } = xt({
2577
+ function Ft({ product: e, ensureProduct: t, setProduct: n, imagesSlot: r }) {
2578
+ let i = I(), { labels: a, renderImage: o } = F(), s = a.products.flow, [c, l] = b(void 0), [u, d] = b(!1), f = Q(e), { entries: p, upload: m, dismiss: h } = Pt({
2353
2579
  productId: e?.id,
2354
2580
  resolveProductId: async () => (await t()).id,
2355
2581
  onUploaded: n
2356
2582
  });
2357
2583
  if (r) return r;
2358
- let g = (e) => {
2584
+ let g = f.length > 0 || p.length > 0, _ = (e) => {
2359
2585
  m(Array.from(e.target.files ?? []), ""), e.target.value = "";
2360
- }, _ = async (t) => {
2586
+ }, v = async (t) => {
2361
2587
  if (e && !u) {
2362
2588
  d(!0), l(void 0);
2363
2589
  try {
@@ -2368,62 +2594,69 @@ function St({ product: e, ensureProduct: t, setProduct: n, imagesSlot: r }) {
2368
2594
  d(!1);
2369
2595
  }
2370
2596
  }
2371
- }, v = (e) => _((t) => i.reorderProductImages(t, [e, ...f.filter((t) => t.id !== e).map((e) => e.id)]));
2597
+ }, y = (e) => v((t) => i.reorderProductImages(t, [e, ...f.filter((t) => t.id !== e).map((e) => e.id)])), x = /* @__PURE__ */ w("label", {
2598
+ className: `sfa-flow__dropzone${g ? " sfa-flow__dropzone--tile" : ""}`,
2599
+ children: [
2600
+ /* @__PURE__ */ C("span", {
2601
+ className: "sfa-flow__dropzone-icon",
2602
+ "aria-hidden": "true",
2603
+ children: "+"
2604
+ }),
2605
+ /* @__PURE__ */ C("strong", { children: g ? s.addPhotoTile : s.addPhotos }),
2606
+ g ? null : /* @__PURE__ */ C("small", { children: s.photoHint }),
2607
+ /* @__PURE__ */ C("input", {
2608
+ type: "file",
2609
+ accept: "image/*",
2610
+ multiple: !0,
2611
+ className: "sfa-sr-only",
2612
+ onChange: _
2613
+ })
2614
+ ]
2615
+ });
2372
2616
  return /* @__PURE__ */ w(S, { children: [
2373
- /* @__PURE__ */ w("label", {
2374
- className: "sfa-flow__dropzone",
2617
+ f.length || p.length ? null : x,
2618
+ /* @__PURE__ */ C(q, { error: c }),
2619
+ f.length || p.length ? /* @__PURE__ */ w("ul", {
2620
+ className: "sfa-flow__thumbs",
2375
2621
  children: [
2376
- /* @__PURE__ */ C("span", {
2377
- className: "sfa-flow__dropzone-icon",
2378
- "aria-hidden": "true",
2379
- children: "+"
2622
+ f.map((e, t) => {
2623
+ let n = String(t + 1);
2624
+ return /* @__PURE__ */ w("li", {
2625
+ className: `sfa-flow__thumb${t === 0 ? " is-cover" : ""}`,
2626
+ children: [/* @__PURE__ */ w("button", {
2627
+ type: "button",
2628
+ className: "sfa-flow__thumb-pick",
2629
+ "aria-label": t === 0 ? `${Z(s.photoN, { n })}, ${s.cover}` : Z(s.makeCover, { n }),
2630
+ "aria-pressed": t === 0,
2631
+ disabled: u,
2632
+ onClick: () => t === 0 ? void 0 : y(e.id),
2633
+ children: [o({
2634
+ src: e.url,
2635
+ alt: "",
2636
+ sizes: "120px"
2637
+ }), t === 0 ? /* @__PURE__ */ C("span", {
2638
+ className: "sfa-flow__badge",
2639
+ children: s.cover
2640
+ }) : null]
2641
+ }), /* @__PURE__ */ C("button", {
2642
+ type: "button",
2643
+ className: "sfa-flow__thumb-remove",
2644
+ "aria-label": Z(s.removePhoto, { n }),
2645
+ disabled: u,
2646
+ onClick: () => v((t) => i.deleteProductImage(t, e.id)),
2647
+ children: "✕"
2648
+ })]
2649
+ }, e.id);
2380
2650
  }),
2381
- /* @__PURE__ */ C("strong", { children: f.length ? s.addMorePhotos : s.addPhotos }),
2382
- /* @__PURE__ */ C("small", { children: s.photoHint }),
2383
- /* @__PURE__ */ C("input", {
2384
- type: "file",
2385
- accept: "image/*",
2386
- multiple: !0,
2387
- className: "sfa-sr-only",
2388
- onChange: g
2651
+ p.map((e) => /* @__PURE__ */ C(It, {
2652
+ entry: e,
2653
+ onDismiss: h
2654
+ }, e.id)),
2655
+ /* @__PURE__ */ C("li", {
2656
+ className: "sfa-flow__thumb sfa-flow__thumb--add",
2657
+ children: x
2389
2658
  })
2390
2659
  ]
2391
- }),
2392
- /* @__PURE__ */ C(q, { error: c }),
2393
- f.length || p.length ? /* @__PURE__ */ w("ul", {
2394
- className: "sfa-flow__thumbs",
2395
- children: [f.map((e, t) => {
2396
- let n = String(t + 1);
2397
- return /* @__PURE__ */ w("li", {
2398
- className: `sfa-flow__thumb${t === 0 ? " is-cover" : ""}`,
2399
- children: [/* @__PURE__ */ w("button", {
2400
- type: "button",
2401
- className: "sfa-flow__thumb-pick",
2402
- "aria-label": t === 0 ? `${Z(s.photoN, { n })}, ${s.cover}` : Z(s.makeCover, { n }),
2403
- "aria-pressed": t === 0,
2404
- disabled: u,
2405
- onClick: () => t === 0 ? void 0 : v(e.id),
2406
- children: [o({
2407
- src: e.url,
2408
- alt: "",
2409
- sizes: "120px"
2410
- }), t === 0 ? /* @__PURE__ */ C("span", {
2411
- className: "sfa-flow__badge",
2412
- children: s.cover
2413
- }) : null]
2414
- }), /* @__PURE__ */ C("button", {
2415
- type: "button",
2416
- className: "sfa-flow__thumb-remove",
2417
- "aria-label": Z(s.removePhoto, { n }),
2418
- disabled: u,
2419
- onClick: () => _((t) => i.deleteProductImage(t, e.id)),
2420
- children: "✕"
2421
- })]
2422
- }, e.id);
2423
- }), p.map((e) => /* @__PURE__ */ C(Ct, {
2424
- entry: e,
2425
- onDismiss: h
2426
- }, e.id))]
2427
2660
  }) : null,
2428
2661
  /* @__PURE__ */ C("p", {
2429
2662
  className: "sfa-flow__tip",
@@ -2431,7 +2664,7 @@ function St({ product: e, ensureProduct: t, setProduct: n, imagesSlot: r }) {
2431
2664
  })
2432
2665
  ] });
2433
2666
  }
2434
- function Ct({ entry: e, onDismiss: t }) {
2667
+ function It({ entry: e, onDismiss: t }) {
2435
2668
  let { labels: n } = F();
2436
2669
  return e.status === "error" ? /* @__PURE__ */ w("li", {
2437
2670
  className: "sfa-flow__thumb is-failed",
@@ -2455,7 +2688,7 @@ function Ct({ entry: e, onDismiss: t }) {
2455
2688
  });
2456
2689
  }
2457
2690
  // src/views/products/product-flow/preview-section.tsx
2458
- function wt({ form: e, update: t, product: n, currency: r, missing: i, actions: a }) {
2691
+ function Lt({ form: e, update: t, product: n, currency: r, missing: i, actions: a }) {
2459
2692
  let { labels: o, renderImage: s } = F(), c = o.products.flow, l = o.products.sheet.missing, u = Q(n)[0], d = Y(e.price);
2460
2693
  return /* @__PURE__ */ w(S, { children: [
2461
2694
  /* @__PURE__ */ w("div", {
@@ -2498,7 +2731,7 @@ function wt({ form: e, update: t, product: n, currency: r, missing: i, actions:
2498
2731
  }) : null
2499
2732
  ]
2500
2733
  }),
2501
- /* @__PURE__ */ C(Ye, {
2734
+ /* @__PURE__ */ C(it, {
2502
2735
  id: "sfa-flow-featured",
2503
2736
  label: c.featured,
2504
2737
  checked: e.featured,
@@ -2518,9 +2751,52 @@ function wt({ form: e, update: t, product: n, currency: r, missing: i, actions:
2518
2751
  })
2519
2752
  ] });
2520
2753
  }
2754
+ // src/views/products/product-flow/materials-field.tsx
2755
+ function Rt(e, t) {
2756
+ let n = ht(e);
2757
+ return {
2758
+ picked: n.filter((e) => t.includes(e)),
2759
+ custom: n.filter((e) => !t.includes(e)).join(", ")
2760
+ };
2761
+ }
2762
+ function zt({ value: e, suggestions: t = [], onChange: n }) {
2763
+ let { labels: r } = F(), i = Rt(e, t), [a, o] = b(i.picked), [s, c] = b(i.custom), l = (e) => {
2764
+ let t = a.includes(e) ? a.filter((t) => t !== e) : [...a, e];
2765
+ o(t), n(gt(t, s));
2766
+ }, u = (e) => {
2767
+ c(e), n(gt(a, e));
2768
+ };
2769
+ return /* @__PURE__ */ w("div", {
2770
+ className: "sfa-field",
2771
+ children: [
2772
+ /* @__PURE__ */ C("label", {
2773
+ className: "sfa-field__label",
2774
+ htmlFor: "sfa-flow-materials",
2775
+ children: r.products.fields.materials
2776
+ }),
2777
+ t.length ? /* @__PURE__ */ C("div", {
2778
+ className: "sfa-flow__chips",
2779
+ children: t.map((e) => /* @__PURE__ */ C("button", {
2780
+ type: "button",
2781
+ className: "sfa-chip",
2782
+ "aria-pressed": a.includes(e),
2783
+ onClick: () => l(e),
2784
+ children: e
2785
+ }, e))
2786
+ }) : null,
2787
+ /* @__PURE__ */ C("input", {
2788
+ id: "sfa-flow-materials",
2789
+ type: "text",
2790
+ placeholder: t.length ? r.products.flow.materialsOther : "",
2791
+ value: s,
2792
+ onChange: (e) => u(e.target.value)
2793
+ })
2794
+ ]
2795
+ });
2796
+ }
2521
2797
  // src/views/products/product-flow/story-section.tsx
2522
- function Tt({ form: e, update: t, product: n, setProduct: r, materialSuggestions: i }) {
2523
- let { labels: a } = F(), o = a.products.flow, s = a.products.fields, c = o.descriptionPrompts, l = it(e.materials), u = Q(n);
2798
+ function Bt({ form: e, update: t, product: n, setProduct: r, materialSuggestions: i }) {
2799
+ let { labels: a } = F(), o = a.products.flow, s = a.products.fields, c = o.descriptionPrompts, l = Q(n);
2524
2800
  return /* @__PURE__ */ w(S, { children: [
2525
2801
  /* @__PURE__ */ w("div", {
2526
2802
  className: "sfa-field",
@@ -2533,6 +2809,7 @@ function Tt({ form: e, update: t, product: n, setProduct: r, materialSuggestions
2533
2809
  /* @__PURE__ */ C("textarea", {
2534
2810
  id: "sfa-flow-description",
2535
2811
  rows: 5,
2812
+ placeholder: o.descriptionPlaceholder,
2536
2813
  value: e.description,
2537
2814
  onChange: (e) => t("description", e.target.value)
2538
2815
  }),
@@ -2541,38 +2818,16 @@ function Tt({ form: e, update: t, product: n, setProduct: r, materialSuggestions
2541
2818
  children: c.map((n) => /* @__PURE__ */ w("button", {
2542
2819
  type: "button",
2543
2820
  className: "sfa-chip",
2544
- onClick: () => t("description", ot(e.description, n)),
2821
+ onClick: () => t("description", _t(e.description, n)),
2545
2822
  children: ["+ ", n]
2546
2823
  }, n))
2547
2824
  }) : null
2548
2825
  ]
2549
2826
  }),
2550
- /* @__PURE__ */ w("div", {
2551
- className: "sfa-field",
2552
- children: [
2553
- /* @__PURE__ */ C("label", {
2554
- className: "sfa-field__label",
2555
- htmlFor: "sfa-flow-materials",
2556
- children: s.materials
2557
- }),
2558
- i?.length ? /* @__PURE__ */ C("div", {
2559
- className: "sfa-flow__chips",
2560
- children: i.map((n) => /* @__PURE__ */ C("button", {
2561
- type: "button",
2562
- className: "sfa-chip",
2563
- "aria-pressed": l.includes(n),
2564
- onClick: () => t("materials", at(e.materials, n)),
2565
- children: n
2566
- }, n))
2567
- }) : null,
2568
- /* @__PURE__ */ C("input", {
2569
- id: "sfa-flow-materials",
2570
- type: "text",
2571
- placeholder: i?.length ? o.materialsOther : "",
2572
- value: e.materials,
2573
- onChange: (e) => t("materials", e.target.value)
2574
- })
2575
- ]
2827
+ /* @__PURE__ */ C(zt, {
2828
+ value: e.materials,
2829
+ suggestions: i,
2830
+ onChange: (e) => t("materials", e)
2576
2831
  }),
2577
2832
  /* @__PURE__ */ w("div", {
2578
2833
  className: "sfa-field",
@@ -2583,11 +2838,12 @@ function Tt({ form: e, update: t, product: n, setProduct: r, materialSuggestions
2583
2838
  }), /* @__PURE__ */ C("input", {
2584
2839
  id: "sfa-flow-size",
2585
2840
  type: "text",
2841
+ placeholder: o.sizePlaceholder,
2586
2842
  value: e.dimensions,
2587
2843
  onChange: (e) => t("dimensions", e.target.value)
2588
2844
  })]
2589
2845
  }),
2590
- n && u.length ? /* @__PURE__ */ w("fieldset", {
2846
+ n && l.length ? /* @__PURE__ */ w("fieldset", {
2591
2847
  className: "sfa-flow__alts",
2592
2848
  children: [
2593
2849
  /* @__PURE__ */ C("legend", {
@@ -2598,11 +2854,11 @@ function Tt({ form: e, update: t, product: n, setProduct: r, materialSuggestions
2598
2854
  className: "sfa-field__help",
2599
2855
  children: o.altHelp
2600
2856
  }),
2601
- u.map((t, i) => /* @__PURE__ */ C(Et, {
2857
+ l.map((t, i) => /* @__PURE__ */ C(Vt, {
2602
2858
  productId: n.id,
2603
2859
  image: t,
2604
2860
  label: Z(o.photoN, { n: String(i + 1) }),
2605
- placeholder: Z(o.altFallback, {
2861
+ placeholder: o.altPlaceholder || Z(o.altFallback, {
2606
2862
  name: e.name.trim() || o.untitled,
2607
2863
  n: String(i + 1)
2608
2864
  }),
@@ -2612,7 +2868,7 @@ function Tt({ form: e, update: t, product: n, setProduct: r, materialSuggestions
2612
2868
  }) : null
2613
2869
  ] });
2614
2870
  }
2615
- function Et({ productId: e, image: t, label: n, placeholder: r, onSaved: i }) {
2871
+ function Vt({ productId: e, image: t, label: n, placeholder: r, onSaved: i }) {
2616
2872
  let a = I(), [o, s] = b(t.alt), [c, l] = b(void 0), u = `sfa-flow-alt-${t.id}`;
2617
2873
  return /* @__PURE__ */ w("div", {
2618
2874
  className: "sfa-field",
@@ -2644,7 +2900,7 @@ function Et({ productId: e, image: t, label: n, placeholder: r, onSaved: i }) {
2644
2900
  });
2645
2901
  }
2646
2902
  // src/lib/product-form.ts
2647
- var Dt = {
2903
+ var Ht = {
2648
2904
  name: "",
2649
2905
  category: "",
2650
2906
  description: "",
@@ -2655,7 +2911,7 @@ var Dt = {
2655
2911
  status: "draft",
2656
2912
  featured: !1
2657
2913
  };
2658
- function Ot(e) {
2914
+ function Ut(e) {
2659
2915
  return {
2660
2916
  name: e.name,
2661
2917
  category: e.category ?? "",
@@ -2669,18 +2925,21 @@ function Ot(e) {
2669
2925
  };
2670
2926
  }
2671
2927
  // src/lib/use-product-autosave.ts
2672
- function kt({ initial: e, form: t, currency: n, delayMs: r = 600 }) {
2928
+ function Wt({ initial: e, form: t, currency: n, delayMs: r = 600 }) {
2673
2929
  let i = I(), [a, o] = b(e), [s, c] = b(e ? "saved" : "idle"), [l, u] = b(void 0), d = y(e), f = y(t), p = y(t), m = y(Promise.resolve()), g = h((e) => {
2674
2930
  d.current = e, o(e);
2675
2931
  }, []), v = h(async (e) => {
2676
2932
  let t = d.current, r = f.current;
2677
- if (!t && !e && !et(r)) return null;
2678
- let a = t ? nt(t, r) : null;
2933
+ if (!t && !e && !lt(r)) return null;
2934
+ let a = t ? dt(t, r) : null;
2679
2935
  if (t && a && Object.keys(a).length === 0) return t;
2680
2936
  c("saving");
2681
2937
  try {
2682
- let e = t ? await i.updateProduct(t.id, a) : await i.createProduct(tt(r, n));
2683
- return g(e), u(void 0), c("saved"), e;
2938
+ let e = t ? await i.updateProduct(t.id, a) : await i.createProduct(ut(r, n)), o = d.current;
2939
+ return g(t && o && o !== t ? {
2940
+ ...e,
2941
+ images: o.images
2942
+ } : e), u(void 0), c("saved"), d.current ?? e;
2684
2943
  } catch (e) {
2685
2944
  return u(e), c("error"), null;
2686
2945
  }
@@ -2715,8 +2974,8 @@ function kt({ initial: e, form: t, currency: n, delayMs: r = 600 }) {
2715
2974
  };
2716
2975
  }
2717
2976
  // src/views/products/product-flow/use-product-flow.ts
2718
- function At({ initial: e, initialStep: t, isFirstProduct: n, onDone: r, onClose: i }) {
2719
- let a = I(), { labels: o } = F(), s = o.products.flow, [c, l] = b(e ? Ot(e) : Dt), [d, f] = b(t ?? "photos"), p = kt({
2977
+ function Gt({ initial: e, initialStep: t, isFirstProduct: n, onDone: r, onClose: i }) {
2978
+ let a = I(), { labels: o } = F(), s = o.products.flow, [c, l] = b(e ? Ut(e) : Ht), [d, f] = b(t ?? "photos"), p = Wt({
2720
2979
  initial: e,
2721
2980
  form: c
2722
2981
  }), [m, h] = b(null), [g, _] = b(void 0), [v, y] = b(!1), [x, S] = b(null), [C, w] = b(null), [T, E] = b(!1), D = p.product, O = e === null, k = (e, t) => {
@@ -2750,8 +3009,8 @@ function At({ initial: e, initialStep: t, isFirstProduct: n, onDone: r, onClose:
2750
3009
  r ? r(e) : w(o.products.saved);
2751
3010
  }, N = () => j(async () => {
2752
3011
  let e = await p.flush();
2753
- e ? M(await A(e)) : et(c) || await P();
2754
- }), ee = () => j(async () => {
3012
+ e ? M(await A(e)) : lt(c) || await ee();
3013
+ }), P = () => j(async () => {
2755
3014
  let e = (D?.status ?? "draft") === "draft", t = await A(await p.ensureProduct()), r = t.status === "active" ? t : await a.updateProduct(t.id, { status: "active" });
2756
3015
  if (p.setProduct(r), !e) return M(r);
2757
3016
  let i = n ?? (await a.getProductCounts()).live === 1;
@@ -2759,7 +3018,7 @@ function At({ initial: e, initialStep: t, isFirstProduct: n, onDone: r, onClose:
2759
3018
  product: r,
2760
3019
  first: i
2761
3020
  });
2762
- }), P = async () => {
3021
+ }), ee = async () => {
2763
3022
  let e = await p.flush() ?? p.product;
2764
3023
  O && e && e.status === "draft" && !x ? E(!0) : i?.(e);
2765
3024
  };
@@ -2782,12 +3041,12 @@ function At({ initial: e, initialStep: t, isFirstProduct: n, onDone: r, onClose:
2782
3041
  E(!1), i?.(p.product);
2783
3042
  },
2784
3043
  saveDraft: N,
2785
- publish: ee,
2786
- close: P
3044
+ publish: P,
3045
+ close: ee
2787
3046
  };
2788
3047
  }
2789
3048
  // src/views/products/product-flow/admin-product-flow.tsx
2790
- function jt(e) {
3049
+ function Kt(e) {
2791
3050
  let [t, n] = b({
2792
3051
  key: 0,
2793
3052
  productId: e.productId
@@ -2795,11 +3054,11 @@ function jt(e) {
2795
3054
  key: e.key + 1,
2796
3055
  productId: void 0
2797
3056
  }));
2798
- return t.productId ? /* @__PURE__ */ C(Mt, {
3057
+ return t.productId ? /* @__PURE__ */ C(qt, {
2799
3058
  ...e,
2800
3059
  productId: t.productId,
2801
3060
  onAddAnother: r
2802
- }, t.key) : /* @__PURE__ */ C(Nt, {
3061
+ }, t.key) : /* @__PURE__ */ C(Jt, {
2803
3062
  ...e,
2804
3063
  initial: null,
2805
3064
  initialStep: void 0,
@@ -2807,15 +3066,15 @@ function jt(e) {
2807
3066
  onAddAnother: r
2808
3067
  }, t.key);
2809
3068
  }
2810
- function Mt({ productId: e, ...t }) {
3069
+ function qt({ productId: e, ...t }) {
2811
3070
  let n = I(), { labels: r } = F(), i = L(["admin-product", e], () => n.getProduct(e));
2812
- return i.error ? /* @__PURE__ */ C(q, { error: i.error }) : i.data ? /* @__PURE__ */ C(Nt, {
3071
+ return i.error ? /* @__PURE__ */ C(q, { error: i.error }) : i.data ? /* @__PURE__ */ C(Jt, {
2813
3072
  ...t,
2814
3073
  initial: i.data
2815
3074
  }, i.data.id) : /* @__PURE__ */ C("p", { children: r.loading });
2816
3075
  }
2817
- function Nt({ initial: e, initialStep: t, onDone: n, onClose: r, categories: i, materialSuggestions: a, isFirstProduct: o, imagesSlot: s, onAddAnother: c }) {
2818
- let { labels: l, hrefs: u, renderLink: d, currency: f } = F(), p = l.products.flow, m = At({
3076
+ function Jt({ initial: e, initialStep: t, onDone: n, onClose: r, categories: i, materialSuggestions: a, isFirstProduct: o, imagesSlot: s, onAddAnother: c }) {
3077
+ let { labels: l, hrefs: u, renderLink: d, currency: f } = F(), p = l.products.flow, m = Gt({
2819
3078
  initial: e,
2820
3079
  initialStep: t,
2821
3080
  isFirstProduct: o,
@@ -2830,44 +3089,60 @@ function Nt({ initial: e, initialStep: t, onDone: n, onClose: r, categories: i,
2830
3089
  b.current = !1, e && v.current?.querySelector(`#sfa-flow-${m.step}`)?.scrollIntoView?.({ block: "start" });
2831
3090
  }, [m.step, t]), m.success) return /* @__PURE__ */ C("div", {
2832
3091
  className: "sfa-flow sfa-flow--done",
2833
- children: /* @__PURE__ */ C(vt, {
3092
+ children: /* @__PURE__ */ C(At, {
2834
3093
  success: m.success,
2835
3094
  onAddAnother: c,
2836
3095
  onDone: n
2837
3096
  })
2838
3097
  });
2839
3098
  let x = () => {
2840
- let e = dt(m.step);
3099
+ let e = St(m.step);
2841
3100
  e ? m.goTo(e) : r && m.close();
2842
- }, T = r ? /* @__PURE__ */ C("button", {
3101
+ }, T = r ? /* @__PURE__ */ w("button", {
2843
3102
  type: "button",
2844
3103
  className: "sfa-btn sfa-btn--ghost",
2845
3104
  "aria-label": p.close,
2846
3105
  onClick: () => void m.close(),
2847
- children: "✕"
2848
- }) : d({
2849
- href: u.products,
2850
- className: "sfa-btn sfa-btn--ghost",
2851
- children: /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("span", {
3106
+ children: [/* @__PURE__ */ C("span", {
2852
3107
  "aria-hidden": "true",
2853
3108
  children: "✕"
2854
3109
  }), /* @__PURE__ */ C("span", {
2855
- className: "sfa-sr-only",
3110
+ className: "sfa-flow__btn-text",
3111
+ "aria-hidden": "true",
2856
3112
  children: p.close
2857
- })] })
3113
+ })]
3114
+ }) : d({
3115
+ href: u.products,
3116
+ className: "sfa-btn sfa-btn--ghost",
3117
+ children: /* @__PURE__ */ w(S, { children: [
3118
+ /* @__PURE__ */ C("span", {
3119
+ "aria-hidden": "true",
3120
+ children: "✕"
3121
+ }),
3122
+ /* @__PURE__ */ C("span", {
3123
+ className: "sfa-sr-only",
3124
+ children: p.close
3125
+ }),
3126
+ /* @__PURE__ */ C("span", {
3127
+ className: "sfa-flow__btn-text",
3128
+ "aria-hidden": "true",
3129
+ children: p.close
3130
+ })
3131
+ ] })
2858
3132
  }), E = (e) => m.step === e;
2859
3133
  return /* @__PURE__ */ w("div", {
2860
3134
  ref: v,
2861
3135
  className: "sfa-flow",
2862
3136
  "data-step": m.step,
2863
3137
  children: [
2864
- /* @__PURE__ */ C(mt, {
3138
+ /* @__PURE__ */ C(Et, {
2865
3139
  title: m.isNew ? p.newTitle : p.editTitle,
3140
+ step: m.step,
2866
3141
  onBack: x,
2867
3142
  canGoBack: !!r || m.step !== "photos",
2868
3143
  close: T
2869
3144
  }),
2870
- /* @__PURE__ */ C(ht, {
3145
+ /* @__PURE__ */ C(Dt, {
2871
3146
  step: m.step,
2872
3147
  allOpen: !m.isNew,
2873
3148
  onStep: m.goTo
@@ -2877,29 +3152,29 @@ function Nt({ initial: e, initialStep: t, onDone: n, onClose: r, categories: i,
2877
3152
  children: [/* @__PURE__ */ w("div", {
2878
3153
  className: "sfa-flow__main",
2879
3154
  children: [
2880
- /* @__PURE__ */ C(_t, {
3155
+ /* @__PURE__ */ C(kt, {
2881
3156
  step: "photos",
2882
3157
  active: E("photos"),
2883
- children: /* @__PURE__ */ C(St, {
3158
+ children: /* @__PURE__ */ C(Ft, {
2884
3159
  product: m.product,
2885
3160
  ensureProduct: m.autosave.ensureProduct,
2886
3161
  setProduct: m.autosave.setProduct,
2887
3162
  imagesSlot: s
2888
3163
  })
2889
3164
  }),
2890
- /* @__PURE__ */ C(_t, {
3165
+ /* @__PURE__ */ C(kt, {
2891
3166
  step: "basics",
2892
3167
  active: E("basics"),
2893
- children: /* @__PURE__ */ C(lt, {
3168
+ children: /* @__PURE__ */ C(bt, {
2894
3169
  ...g,
2895
3170
  categories: i,
2896
3171
  currency: h
2897
3172
  })
2898
3173
  }),
2899
- /* @__PURE__ */ C(_t, {
3174
+ /* @__PURE__ */ C(kt, {
2900
3175
  step: "story",
2901
3176
  active: E("story"),
2902
- children: /* @__PURE__ */ C(Tt, {
3177
+ children: /* @__PURE__ */ C(Bt, {
2903
3178
  ...g,
2904
3179
  product: m.product,
2905
3180
  setProduct: m.autosave.setProduct,
@@ -2909,30 +3184,34 @@ function Nt({ initial: e, initialStep: t, onDone: n, onClose: r, categories: i,
2909
3184
  ]
2910
3185
  }), /* @__PURE__ */ w("aside", {
2911
3186
  className: "sfa-flow__aside",
2912
- children: [
2913
- /* @__PURE__ */ C(_t, {
2914
- step: "preview",
2915
- active: E("preview"),
2916
- children: /* @__PURE__ */ C(wt, {
2917
- ...g,
2918
- product: m.product,
2919
- currency: h,
2920
- missing: m.missing,
2921
- actions: /* @__PURE__ */ C(ft, { flow: m })
2922
- })
2923
- }),
2924
- /* @__PURE__ */ C(q, { error: m.failure }),
2925
- /* @__PURE__ */ C(gt, {
2926
- state: m.autosave.state,
2927
- isNew: m.isNew,
2928
- onRetry: () => void m.autosave.retry()
3187
+ children: [/* @__PURE__ */ C(kt, {
3188
+ step: "preview",
3189
+ active: E("preview"),
3190
+ live: (m.product?.status ?? "draft") !== "draft",
3191
+ children: /* @__PURE__ */ C(Lt, {
3192
+ ...g,
3193
+ product: m.product,
3194
+ currency: h,
3195
+ missing: m.missing,
3196
+ actions: /* @__PURE__ */ C(Ct, { flow: m })
2929
3197
  })
2930
- ]
3198
+ }), /* @__PURE__ */ C(q, { error: m.failure })]
2931
3199
  })]
2932
3200
  }),
2933
- /* @__PURE__ */ C("div", {
3201
+ /* @__PURE__ */ w("div", {
2934
3202
  className: "sfa-flow__foot",
2935
- children: /* @__PURE__ */ C(pt, { flow: m })
3203
+ children: [
3204
+ /* @__PURE__ */ C(Tt, { flow: m }),
3205
+ /* @__PURE__ */ C(Ot, {
3206
+ state: m.autosave.state,
3207
+ isNew: m.isNew,
3208
+ onRetry: () => void m.autosave.retry()
3209
+ }),
3210
+ /* @__PURE__ */ C("div", {
3211
+ className: "sfa-flow__foot-actions",
3212
+ children: /* @__PURE__ */ C(wt, { flow: m })
3213
+ })
3214
+ ]
2936
3215
  }),
2937
3216
  m.notice ? /* @__PURE__ */ C(K, {
2938
3217
  variant: "success",
@@ -2951,14 +3230,14 @@ function Nt({ initial: e, initialStep: t, onDone: n, onClose: r, categories: i,
2951
3230
  });
2952
3231
  }
2953
3232
  // src/views/products/admin-product-editor.tsx
2954
- function Pt() {
3233
+ function Yt() {
2955
3234
  let e = new URLSearchParams(window.location.search).get("step");
2956
- return j.find((t) => t === e);
3235
+ return M.find((t) => t === e);
2957
3236
  }
2958
- var Ft = () => () => void 0;
2959
- function It({ productId: e, onSaved: t, imagesSlot: n, categories: r, initialStep: i }) {
2960
- let a = x(Ft, Pt, () => void 0);
2961
- return /* @__PURE__ */ C(jt, {
3237
+ var Xt = () => () => void 0;
3238
+ function Zt({ productId: e, onSaved: t, imagesSlot: n, categories: r, initialStep: i }) {
3239
+ let a = x(Xt, Yt, () => void 0);
3240
+ return /* @__PURE__ */ C(Kt, {
2962
3241
  productId: e,
2963
3242
  initialStep: i ?? a,
2964
3243
  onDone: t,
@@ -2967,7 +3246,7 @@ function It({ productId: e, onSaved: t, imagesSlot: n, categories: r, initialSte
2967
3246
  });
2968
3247
  }
2969
3248
  // src/views/products/image-alt-editor.tsx
2970
- function Lt({ imageId: e, alt: t, name: n, labels: r, onSave: i }) {
3249
+ function Qt({ imageId: e, alt: t, name: n, labels: r, onSave: i }) {
2971
3250
  let [a, o] = b(null), [s, c] = b(!1), [l, u] = b(void 0), d = () => {
2972
3251
  o(null), u(void 0);
2973
3252
  };
@@ -3021,8 +3300,8 @@ function Lt({ imageId: e, alt: t, name: n, labels: r, onSave: i }) {
3021
3300
  });
3022
3301
  }
3023
3302
  // src/views/products/image-tile.tsx
3024
- function Rt({ image: e, index: t, total: n, busy: r, labels: i, onMove: a, onRemove: o, onSaveAlt: s }) {
3025
- let { renderImage: c } = F(), l = e.alt || $(i.photoName, { n: String(t + 1) }), u = (t, n, r) => /* @__PURE__ */ C("button", {
3303
+ function $t({ image: e, index: t, total: n, busy: r, labels: i, onMove: a, onRemove: o, onSaveAlt: s }) {
3304
+ let { renderImage: c } = F(), l = e.alt || Mt(i.photoName, { n: String(t + 1) }), u = (t, n, r) => /* @__PURE__ */ C("button", {
3026
3305
  type: "button",
3027
3306
  className: "sfa-btn",
3028
3307
  "data-image-id": e.id,
@@ -3057,7 +3336,7 @@ function Rt({ image: e, index: t, total: n, busy: r, labels: i, onMove: a, onRem
3057
3336
  children: [
3058
3337
  u("earlier", i.moveEarlier, t === 0),
3059
3338
  u("later", i.moveLater, t === n - 1),
3060
- /* @__PURE__ */ C(Lt, {
3339
+ /* @__PURE__ */ C(Qt, {
3061
3340
  imageId: e.id,
3062
3341
  alt: e.alt,
3063
3342
  name: l,
@@ -3077,7 +3356,7 @@ function Rt({ image: e, index: t, total: n, busy: r, labels: i, onMove: a, onRem
3077
3356
  });
3078
3357
  }
3079
3358
  // src/views/products/upload-picker.tsx
3080
- function zt({ labels: e, onFiles: t }) {
3359
+ function en({ labels: e, onFiles: t }) {
3081
3360
  let n = (e) => {
3082
3361
  t(Array.from(e.target.files ?? [])), e.target.value = "";
3083
3362
  };
@@ -3105,11 +3384,11 @@ function zt({ labels: e, onFiles: t }) {
3105
3384
  });
3106
3385
  }
3107
3386
  // src/views/products/admin-product-images.tsx
3108
- var Bt = (e) => [...e].sort((e, t) => e.position - t.position);
3109
- function Vt({ productId: e, images: t }) {
3110
- let n = I(), { labels: r } = F(), i = r.products.images, [a, o] = b(() => Bt(t)), [s, c] = b(null), [l, u] = b(!1), [d, f] = b(""), [p, m] = b(void 0), [h, g] = b(!1), [v, x] = b(null), T = y(null), E = y(null), { entries: D, upload: O, dismiss: k } = xt({
3387
+ var $ = (e) => [...e].sort((e, t) => e.position - t.position);
3388
+ function tn({ productId: e, images: t }) {
3389
+ let n = I(), { labels: r } = F(), i = r.products.images, [a, o] = b(() => $(t)), [s, c] = b(null), [l, u] = b(!1), [d, f] = b(""), [p, m] = b(void 0), [h, g] = b(!1), [v, x] = b(null), T = y(null), E = y(null), { entries: D, upload: O, dismiss: k } = Pt({
3111
3390
  productId: e,
3112
- onUploaded: (e) => o(Bt(e.images))
3391
+ onUploaded: (e) => o($(e.images))
3113
3392
  });
3114
3393
  _(() => {
3115
3394
  let e = T.current;
@@ -3128,7 +3407,7 @@ function Vt({ productId: e, images: t }) {
3128
3407
  }, o(d), u(!0), c(a[t].id), m(void 0), g(!1);
3129
3408
  try {
3130
3409
  let t = await n.reorderProductImages(e, d.map((e) => e.id));
3131
- o(Bt(t.images));
3410
+ o($(t.images));
3132
3411
  } catch (e) {
3133
3412
  T.current = {
3134
3413
  id: a[t].id,
@@ -3143,7 +3422,7 @@ function Vt({ productId: e, images: t }) {
3143
3422
  x(null), c(t.id), m(void 0), g(!1);
3144
3423
  try {
3145
3424
  let r = await n.deleteProductImage(e, t.id);
3146
- o(Bt(r.images));
3425
+ o($(r.images));
3147
3426
  } catch (e) {
3148
3427
  m(e);
3149
3428
  } finally {
@@ -3151,7 +3430,7 @@ function Vt({ productId: e, images: t }) {
3151
3430
  }
3152
3431
  }, M = async (t, r) => {
3153
3432
  let i = await n.updateProductImage(e, t, { alt: r });
3154
- o(Bt(i.images));
3433
+ o($(i.images));
3155
3434
  };
3156
3435
  return /* @__PURE__ */ w("div", {
3157
3436
  className: "sfa-images",
@@ -3192,7 +3471,7 @@ function Vt({ productId: e, images: t }) {
3192
3471
  }) : null
3193
3472
  ]
3194
3473
  }),
3195
- /* @__PURE__ */ C(zt, {
3474
+ /* @__PURE__ */ C(en, {
3196
3475
  labels: i,
3197
3476
  onFiles: (e) => O(e, d)
3198
3477
  }),
@@ -3204,7 +3483,7 @@ function Vt({ productId: e, images: t }) {
3204
3483
  /* @__PURE__ */ w("ul", {
3205
3484
  ref: E,
3206
3485
  className: "sfa-image-grid",
3207
- children: [a.map((e, t) => /* @__PURE__ */ C(Rt, {
3486
+ children: [a.map((e, t) => /* @__PURE__ */ C($t, {
3208
3487
  image: e,
3209
3488
  index: t,
3210
3489
  total: a.length,
@@ -3243,69 +3522,28 @@ function Vt({ productId: e, images: t }) {
3243
3522
  ]
3244
3523
  });
3245
3524
  }
3246
- // src/components/empty-state/empty-state.tsx
3247
- var Ht = {
3248
- orders: "M4 8l8-4 8 4v8l-8 4-8-4V8zm0 0l8 4m0 0l8-4m-8 4v8",
3249
- discounts: "M3 12V4h8l10 10-8 8L3 12zm5-5h.01",
3250
- shipping: "M2 6h11v9H2V6zm11 3h4l3 3v3h-7V9zM6 18.5h.01M17 18.5h.01",
3251
- search: "M11 4a7 7 0 100 14 7 7 0 000-14zm9 16l-4-4"
3252
- };
3253
- function Ut({ icon: e, title: t, body: n, action: r, children: i }) {
3254
- return /* @__PURE__ */ w("div", {
3255
- className: "sfa-empty-state",
3256
- children: [
3257
- /* @__PURE__ */ C("svg", {
3258
- className: "sfa-empty-state__icon",
3259
- viewBox: "0 0 24 24",
3260
- width: "48",
3261
- height: "48",
3262
- fill: "none",
3263
- stroke: "currentColor",
3264
- strokeWidth: "1.5",
3265
- strokeLinecap: "round",
3266
- strokeLinejoin: "round",
3267
- "aria-hidden": "true",
3268
- focusable: "false",
3269
- children: /* @__PURE__ */ C("path", { d: Ht[e] })
3270
- }),
3271
- /* @__PURE__ */ C("h2", {
3272
- className: "sfa-empty-state__title",
3273
- children: t
3274
- }),
3275
- n ? /* @__PURE__ */ C("p", {
3276
- className: "sfa-empty-state__body",
3277
- children: n
3278
- }) : null,
3279
- i,
3280
- r ? /* @__PURE__ */ C("div", {
3281
- className: "sfa-empty-state__action",
3282
- children: r
3283
- }) : null
3284
- ]
3285
- });
3286
- }
3287
3525
  // src/lib/use-order-pages.ts
3288
- function Wt(e) {
3526
+ function nn(e) {
3289
3527
  let t = I();
3290
- return we(["admin-orders", e], (n) => t.listOrders(n ? {
3528
+ return je(["admin-orders", e], (n) => t.listOrders(n ? {
3291
3529
  ...e,
3292
3530
  cursor: n
3293
3531
  } : e));
3294
3532
  }
3295
3533
  // src/views/orders/admin-order-list.tsx
3296
- var Gt = [
3534
+ var rn = [
3297
3535
  "paid",
3298
3536
  "shipped",
3299
3537
  "needs_attention",
3300
3538
  "pending_refund",
3301
3539
  "all"
3302
3540
  ];
3303
- function Kt(e) {
3541
+ function an(e) {
3304
3542
  return e === "pending_refund" ? { hasPendingRefund: !0 } : e === "all" ? {} : { status: e };
3305
3543
  }
3306
- function qt() {
3307
- let { labels: e, locale: t, hrefs: n, renderLink: r } = F(), i = e.orders, [a, o] = b("paid"), [s, c] = b(""), l = Ce(s.trim(), 300), u = Wt({
3308
- ...Kt(a),
3544
+ function on() {
3545
+ let { labels: e, locale: t, hrefs: n, renderLink: r } = F(), i = e.orders, [a, o] = b("paid"), [s, c] = b(""), l = Ae(s.trim(), 300), u = nn({
3546
+ ...an(a),
3309
3547
  ...l ? { q: l } : {}
3310
3548
  }), d = new Intl.DateTimeFormat(t), f = [
3311
3549
  {
@@ -3313,7 +3551,7 @@ function qt() {
3313
3551
  header: i.columns.order,
3314
3552
  render: (e) => r({
3315
3553
  href: n.order(e.id),
3316
- children: e.id,
3554
+ children: T(e.id),
3317
3555
  className: "sfa-link--tap"
3318
3556
  })
3319
3557
  },
@@ -3356,7 +3594,7 @@ function qt() {
3356
3594
  role: "group",
3357
3595
  "aria-label": i.columns.status,
3358
3596
  className: "sfa-filter-group",
3359
- children: Gt.map((e) => /* @__PURE__ */ C("button", {
3597
+ children: rn.map((e) => /* @__PURE__ */ C("button", {
3360
3598
  type: "button",
3361
3599
  className: "sfa-chip",
3362
3600
  "aria-pressed": a === e,
@@ -3372,10 +3610,10 @@ function qt() {
3372
3610
  })]
3373
3611
  }),
3374
3612
  /* @__PURE__ */ C(q, { error: u.error }),
3375
- u.loading ? /* @__PURE__ */ C("p", { children: e.loading }) : u.items.length === 0 ? /* @__PURE__ */ C(Ut, {
3613
+ u.loading ? /* @__PURE__ */ C("p", { children: e.loading }) : u.items.length === 0 ? /* @__PURE__ */ C(be, {
3376
3614
  icon: l ? "search" : "orders",
3377
3615
  title: l ? i.noMatches : i.empty[a],
3378
- body: l ? void 0 : i.emptyHint
3616
+ body: !l && a === "all" ? i.emptyHint : void 0
3379
3617
  }) : /* @__PURE__ */ C(H, {
3380
3618
  columns: f,
3381
3619
  rows: u.items,
@@ -3392,27 +3630,27 @@ function qt() {
3392
3630
  });
3393
3631
  }
3394
3632
  // src/lib/refund-rules.ts
3395
- function Jt(e) {
3633
+ function sn(e) {
3396
3634
  return e.refunds.filter((e) => e.status === "pending").reduce((e, t) => e + t.amountCents, 0);
3397
3635
  }
3398
- function Yt(e) {
3399
- return e.totalCents - e.refundedCents - Jt(e);
3636
+ function cn(e) {
3637
+ return e.totalCents - e.refundedCents - sn(e);
3400
3638
  }
3401
- function Xt(e) {
3639
+ function ln(e) {
3402
3640
  return e.refunds.some((e) => e.status === "pending");
3403
3641
  }
3404
- function Zt(e, t) {
3405
- return e.status !== "needs_attention" && t !== null && t === Yt(e);
3642
+ function un(e, t) {
3643
+ return e.status !== "needs_attention" && t !== null && t === cn(e);
3406
3644
  }
3407
- function Qt(e) {
3645
+ function dn(e) {
3408
3646
  return e.status === "paid" || e.status === "shipped";
3409
3647
  }
3410
- function $t(e) {
3411
- return (Qt(e) || e.status === "needs_attention") && Yt(e) > 0;
3648
+ function fn(e) {
3649
+ return (dn(e) || e.status === "needs_attention") && cn(e) > 0;
3412
3650
  }
3413
3651
  // src/views/orders/refund-dialog.tsx
3414
- function en({ order: e, onClose: t, onDone: n }) {
3415
- let r = I(), o = F().labels.orders.actions, s = y(crypto.randomUUID()), c = Yt(e), [l, u] = b(X(c)), [d, f] = b(""), [p, m] = b(!1), [h, g] = b(!1), _ = R(r.refundOrder), v = Y(l), x = v !== null && v > 0 && v <= c, S = Zt(e, v), T = _.error instanceof a || _.error instanceof i;
3652
+ function pn({ order: t, onClose: n, onDone: r }) {
3653
+ let i = I(), o = F().labels.orders.actions, s = y(crypto.randomUUID()), c = cn(t), [l, u] = b(X(c)), [d, f] = b(""), [p, m] = b(!1), [h, g] = b(!1), _ = R(i.refundOrder), v = Y(l), x = v !== null && v > 0 && v <= c, S = un(t, v), T = _.error instanceof a || _.error instanceof e;
3416
3654
  return /* @__PURE__ */ w(G, {
3417
3655
  open: !0,
3418
3656
  title: o.refundTitle,
@@ -3420,15 +3658,15 @@ function en({ order: e, onClose: t, onDone: n }) {
3420
3658
  destructive: !0,
3421
3659
  pending: _.pending,
3422
3660
  onConfirm: async () => {
3423
- x ? (g(!1), await _.run(e.id, {
3661
+ x ? (g(!1), await _.run(t.id, {
3424
3662
  amountCents: v,
3425
3663
  reason: d.trim() || void 0,
3426
3664
  restock: p && S
3427
- }, { idempotencyKey: s.current }) && n(o.refundDone)) : g(!0);
3665
+ }, { idempotencyKey: s.current }) && r(o.refundDone)) : g(!0);
3428
3666
  },
3429
- onCancel: t,
3667
+ onCancel: n,
3430
3668
  children: [
3431
- Xt(e) ? /* @__PURE__ */ C(K, {
3669
+ ln(t) ? /* @__PURE__ */ C(K, {
3432
3670
  variant: "warning",
3433
3671
  children: o.refundPending
3434
3672
  }) : null,
@@ -3470,21 +3708,20 @@ function en({ order: e, onClose: t, onDone: n }) {
3470
3708
  }),
3471
3709
  S ? /* @__PURE__ */ w("div", {
3472
3710
  className: "sfa-field",
3473
- children: [/* @__PURE__ */ w("label", { children: [
3474
- /* @__PURE__ */ C("input", {
3711
+ children: [/* @__PURE__ */ w("label", {
3712
+ className: "sfa-check",
3713
+ children: [/* @__PURE__ */ C("input", {
3475
3714
  type: "checkbox",
3476
3715
  checked: p,
3477
3716
  disabled: T,
3478
3717
  onChange: (e) => m(e.target.checked)
3479
- }),
3480
- " ",
3481
- o.restock
3482
- ] }), /* @__PURE__ */ C("p", {
3718
+ }), o.restock]
3719
+ }), /* @__PURE__ */ C("p", {
3483
3720
  className: "sfa-field__help",
3484
3721
  children: o.restockWarning
3485
3722
  })]
3486
3723
  }) : null,
3487
- _.error instanceof i ? /* @__PURE__ */ C(K, {
3724
+ _.error instanceof e ? /* @__PURE__ */ C(K, {
3488
3725
  variant: "warning",
3489
3726
  children: o.refundUnknown
3490
3727
  }) : _.error instanceof a ? /* @__PURE__ */ C(K, {
@@ -3495,34 +3732,35 @@ function en({ order: e, onClose: t, onDone: n }) {
3495
3732
  });
3496
3733
  }
3497
3734
  // src/views/orders/resolve-button.tsx
3498
- function tn({ order: e, onDone: t }) {
3499
- let n = I(), { labels: r, hrefs: i, renderLink: a } = F(), o = r.orders.actions, c = R(n.resolveOrder), l = async () => {
3500
- await c.run(e.id) && t(o.resolved);
3501
- }, u = c.error instanceof s ? c.error : null, d = new Map(e.items.map((e) => [e.productId, e.name]));
3735
+ function mn({ order: e, onDone: t, notice: n }) {
3736
+ let r = I(), { labels: i, hrefs: a, renderLink: o } = F(), s = i.orders.actions, l = R(r.resolveOrder), u = async () => {
3737
+ await l.run(e.id) && t(s.resolved);
3738
+ }, d = l.error instanceof c ? l.error : null, f = new Map(e.items.map((e) => [e.productId, e.name]));
3502
3739
  return /* @__PURE__ */ w("div", {
3503
3740
  className: "sfa-order__action",
3504
3741
  children: [
3505
- /* @__PURE__ */ C("p", { children: o.resolveHelp }),
3506
- u ? /* @__PURE__ */ w(K, {
3742
+ /* @__PURE__ */ C("p", { children: s.resolveHelp }),
3743
+ d ? /* @__PURE__ */ w(K, {
3507
3744
  variant: "error",
3508
- children: [r.errors.insufficientStock, /* @__PURE__ */ C("ul", { children: u.productIds.map((e) => /* @__PURE__ */ C("li", { children: a({
3509
- href: i.product(e),
3510
- children: `${o.restockThenResolve}: ${d.get(e) ?? e}`,
3745
+ children: [i.errors.insufficientStock, /* @__PURE__ */ C("ul", { children: d.productIds.map((e) => /* @__PURE__ */ C("li", { children: o({
3746
+ href: a.product(e),
3747
+ children: `${s.restockThenResolve}: ${f.get(e) ?? e}`,
3511
3748
  className: "sfa-link--tap"
3512
3749
  }) }, e)) })]
3513
- }) : /* @__PURE__ */ C(q, { error: c.error }),
3750
+ }) : /* @__PURE__ */ C(q, { error: l.error }),
3514
3751
  /* @__PURE__ */ C("button", {
3515
3752
  type: "button",
3516
3753
  className: "sfa-btn sfa-btn--primary",
3517
- disabled: c.pending,
3518
- onClick: l,
3519
- children: o.resolve
3520
- })
3754
+ disabled: l.pending,
3755
+ onClick: u,
3756
+ children: s.resolve
3757
+ }),
3758
+ n
3521
3759
  ]
3522
3760
  });
3523
3761
  }
3524
3762
  // src/views/orders/ship-form.tsx
3525
- function nn(e) {
3763
+ function hn(e) {
3526
3764
  try {
3527
3765
  let { protocol: t } = new URL(e);
3528
3766
  return t === "http:" || t === "https:";
@@ -3530,31 +3768,39 @@ function nn(e) {
3530
3768
  return !1;
3531
3769
  }
3532
3770
  }
3533
- function rn({ order: e, onDone: t }) {
3534
- let n = I(), r = F().labels.orders.actions, i = e.fulfillment, [a, o] = b(i?.carrier ?? ""), [s, c] = b(i?.trackingNumber ?? ""), [l, u] = b(i?.trackingUrl ?? ""), [d, f] = b(!1), p = R(n.shipOrder), m = e.status === "shipped";
3771
+ function gn({ order: e, onDone: t, requireTracking: n = !0, notice: r }) {
3772
+ let i = I(), a = F().labels.orders.actions, o = e.fulfillment, [s, c] = b(o?.carrier ?? ""), [l, u] = b(o?.trackingNumber ?? ""), [d, f] = b(o?.trackingUrl ?? ""), [p, m] = b(!1), [h, g] = b(!1), _ = R(i.shipOrder), v = e.status === "shipped", y = async () => {
3773
+ let n = d.trim();
3774
+ n && !hn(n) ? m(!0) : (m(!1), await _.run(e.id, {
3775
+ carrier: s.trim() || void 0,
3776
+ trackingNumber: l.trim() || void 0,
3777
+ trackingUrl: n || void 0
3778
+ }) && t(a.shipped));
3779
+ };
3535
3780
  return /* @__PURE__ */ w("form", {
3536
3781
  className: "sfa-order__action",
3537
- onSubmit: async (n) => {
3538
- n.preventDefault();
3539
- let i = l.trim();
3540
- i && !nn(i) ? f(!0) : (f(!1), await p.run(e.id, {
3541
- carrier: a.trim() || void 0,
3542
- trackingNumber: s.trim() || void 0,
3543
- trackingUrl: i || void 0
3544
- }) && t(r.shipped));
3782
+ onSubmit: async (e) => {
3783
+ e.preventDefault();
3784
+ let t = d.trim();
3785
+ if (t && !hn(t)) {
3786
+ m(!0);
3787
+ return;
3788
+ }
3789
+ let r = !s.trim() || !l.trim();
3790
+ g(n && r), !(n && r) && await y();
3545
3791
  },
3546
3792
  children: [
3547
- /* @__PURE__ */ C("h3", { children: r.shipHeading }),
3793
+ /* @__PURE__ */ C("h3", { children: a.shipHeading }),
3548
3794
  /* @__PURE__ */ w("div", {
3549
3795
  className: "sfa-field",
3550
3796
  children: [/* @__PURE__ */ C("label", {
3551
3797
  htmlFor: "sfa-ship-carrier",
3552
3798
  className: "sfa-field__label",
3553
- children: r.carrier
3799
+ children: a.carrier
3554
3800
  }), /* @__PURE__ */ C("input", {
3555
3801
  id: "sfa-ship-carrier",
3556
- value: a,
3557
- onChange: (e) => o(e.target.value)
3802
+ value: s,
3803
+ onChange: (e) => c(e.target.value)
3558
3804
  })]
3559
3805
  }),
3560
3806
  /* @__PURE__ */ w("div", {
@@ -3562,11 +3808,11 @@ function rn({ order: e, onDone: t }) {
3562
3808
  children: [/* @__PURE__ */ C("label", {
3563
3809
  htmlFor: "sfa-ship-number",
3564
3810
  className: "sfa-field__label",
3565
- children: r.trackingNumber
3811
+ children: a.trackingNumber
3566
3812
  }), /* @__PURE__ */ C("input", {
3567
3813
  id: "sfa-ship-number",
3568
- value: s,
3569
- onChange: (e) => c(e.target.value)
3814
+ value: l,
3815
+ onChange: (e) => u(e.target.value)
3570
3816
  })]
3571
3817
  }),
3572
3818
  /* @__PURE__ */ w("div", {
@@ -3575,71 +3821,91 @@ function rn({ order: e, onDone: t }) {
3575
3821
  /* @__PURE__ */ C("label", {
3576
3822
  htmlFor: "sfa-ship-url",
3577
3823
  className: "sfa-field__label",
3578
- children: r.trackingUrl
3824
+ children: a.trackingUrl
3579
3825
  }),
3580
3826
  /* @__PURE__ */ C("input", {
3581
3827
  id: "sfa-ship-url",
3582
- value: l,
3583
- "aria-invalid": d,
3584
- "aria-describedby": d ? "sfa-ship-url-error" : void 0,
3585
- onChange: (e) => u(e.target.value)
3828
+ value: d,
3829
+ "aria-invalid": p,
3830
+ "aria-describedby": p ? "sfa-ship-url-error" : void 0,
3831
+ onChange: (e) => f(e.target.value)
3586
3832
  }),
3587
- d ? /* @__PURE__ */ C("p", {
3833
+ p ? /* @__PURE__ */ C("p", {
3588
3834
  id: "sfa-ship-url-error",
3589
3835
  className: "sfa-field__error",
3590
- children: r.trackingUrlInvalid
3836
+ children: a.trackingUrlInvalid
3591
3837
  }) : null
3592
3838
  ]
3593
3839
  }),
3594
- /* @__PURE__ */ C(q, { error: p.error }),
3595
- /* @__PURE__ */ C("button", {
3596
- type: "submit",
3597
- className: "sfa-btn sfa-btn--primary",
3598
- disabled: p.pending,
3599
- children: m ? r.reship : r.ship
3600
- })
3840
+ h ? /* @__PURE__ */ C(K, {
3841
+ variant: "error",
3842
+ children: a.trackingRequired
3843
+ }) : null,
3844
+ /* @__PURE__ */ w("div", {
3845
+ className: "sfa-order__buttons",
3846
+ children: [/* @__PURE__ */ C("button", {
3847
+ type: "submit",
3848
+ className: "sfa-btn sfa-btn--primary",
3849
+ disabled: _.pending,
3850
+ children: v ? a.reship : a.ship
3851
+ }), n ? /* @__PURE__ */ C("button", {
3852
+ type: "button",
3853
+ className: "sfa-btn",
3854
+ disabled: _.pending,
3855
+ onClick: () => (g(!1), y()),
3856
+ children: a.shipWithoutTracking
3857
+ }) : null]
3858
+ }),
3859
+ /* @__PURE__ */ C(q, { error: _.error }),
3860
+ r
3601
3861
  ]
3602
3862
  });
3603
3863
  }
3604
3864
  // src/views/orders/order-actions.tsx
3605
- function an({ order: e, reload: t }) {
3606
- let n = F().labels.orders.actions, [r, i] = b(!1), [a, o] = b(null), s = (e) => {
3607
- i(!1), o(e), t();
3608
- };
3865
+ function _n({ order: e, reload: t, requireTracking: n = !0 }) {
3866
+ let r = F().labels.orders.actions, [i, a] = b(!1), [o, s] = b(null), c = (e) => (n) => {
3867
+ a(!1), s({
3868
+ source: e,
3869
+ text: n
3870
+ }), t();
3871
+ }, l = (e) => o?.source === e ? /* @__PURE__ */ C(K, {
3872
+ variant: "success",
3873
+ onDismiss: () => s(null),
3874
+ children: o.text
3875
+ }) : null;
3609
3876
  return /* @__PURE__ */ w("div", {
3610
3877
  className: "sfa-order__actions",
3611
3878
  children: [
3612
- a ? /* @__PURE__ */ C(K, {
3613
- variant: "success",
3614
- onDismiss: () => o(null),
3615
- children: a
3616
- }) : null,
3617
- Qt(e) ? /* @__PURE__ */ C(rn, {
3879
+ dn(e) ? /* @__PURE__ */ C(gn, {
3618
3880
  order: e,
3619
- onDone: s
3881
+ requireTracking: n,
3882
+ onDone: c("ship"),
3883
+ notice: l("ship")
3620
3884
  }) : null,
3621
- e.status === "needs_attention" ? /* @__PURE__ */ C(tn, {
3885
+ e.status === "needs_attention" ? /* @__PURE__ */ C(mn, {
3622
3886
  order: e,
3623
- onDone: s
3887
+ onDone: c("resolve"),
3888
+ notice: l("resolve")
3624
3889
  }) : null,
3625
- $t(e) ? /* @__PURE__ */ C("button", {
3890
+ fn(e) ? /* @__PURE__ */ C("button", {
3626
3891
  type: "button",
3627
- className: "sfa-btn sfa-btn--danger",
3628
- onClick: () => i(!0),
3629
- children: n.refund
3892
+ className: "sfa-btn sfa-btn--quiet-danger sfa-order__refund-btn",
3893
+ onClick: () => a(!0),
3894
+ children: r.refund
3630
3895
  }) : null,
3631
- r ? /* @__PURE__ */ C(en, {
3896
+ l("refund"),
3897
+ i ? /* @__PURE__ */ C(pn, {
3632
3898
  order: e,
3633
3899
  onClose: () => {
3634
- i(!1), t();
3900
+ a(!1), t();
3635
3901
  },
3636
- onDone: s
3902
+ onDone: c("refund")
3637
3903
  }) : null
3638
3904
  ]
3639
3905
  });
3640
3906
  }
3641
3907
  // src/views/orders/order-fulfillment.tsx
3642
- function on({ order: e }) {
3908
+ function vn({ order: e }) {
3643
3909
  let { labels: t, locale: n, renderLink: r } = F(), i = t.orders, a = e.fulfillment;
3644
3910
  return /* @__PURE__ */ w("section", {
3645
3911
  className: "sfa-order__section",
@@ -3651,13 +3917,13 @@ function on({ order: e }) {
3651
3917
  a.trackingUrl ? /* @__PURE__ */ C("dd", { children: r({
3652
3918
  href: a.trackingUrl,
3653
3919
  children: i.trackShipment,
3654
- className: "sfa-link--tap"
3920
+ className: "sfa-link--tap sfa-link--external"
3655
3921
  }) }) : null
3656
3922
  ] }) : /* @__PURE__ */ C("p", { children: i.notShipped })]
3657
3923
  });
3658
3924
  }
3659
3925
  // src/views/orders/order-items.tsx
3660
- function sn({ order: e }) {
3926
+ function yn({ order: e }) {
3661
3927
  let { labels: t } = F(), n = t.orders, { currency: r } = e, i = [
3662
3928
  {
3663
3929
  key: "name",
@@ -3723,7 +3989,7 @@ function sn({ order: e }) {
3723
3989
  });
3724
3990
  }
3725
3991
  // src/views/orders/order-refunds.tsx
3726
- function cn({ order: e }) {
3992
+ function bn({ order: e }) {
3727
3993
  let { labels: t, locale: n } = F(), r = t.orders, { currency: i } = e, a = new Intl.DateTimeFormat(n), o = [
3728
3994
  {
3729
3995
  key: "amount",
@@ -3787,7 +4053,7 @@ function cn({ order: e }) {
3787
4053
  });
3788
4054
  }
3789
4055
  // src/views/orders/admin-order-detail.tsx
3790
- function ln(e) {
4056
+ function xn(e) {
3791
4057
  let t = e.shippingAddress;
3792
4058
  if (!t) return [];
3793
4059
  let n = [
@@ -3803,70 +4069,83 @@ function ln(e) {
3803
4069
  t.country
3804
4070
  ].filter((e) => !!e);
3805
4071
  }
3806
- function un({ orderId: e, actions: t }) {
3807
- let n = I(), { labels: r, locale: i, hrefs: a, renderLink: o } = F(), s = r.orders, c = L(["admin-order", e], () => n.getOrder(e));
3808
- if (c.error) return /* @__PURE__ */ C(q, { error: c.error });
3809
- let l = c.data;
3810
- if (!l) return /* @__PURE__ */ C("p", { children: r.loading });
3811
- let u = ln(l);
4072
+ function Sn({ orderId: e, actions: t, requireTracking: n = !0 }) {
4073
+ let r = I(), { labels: i, locale: a, hrefs: o, renderLink: s } = F(), c = i.orders, l = L(["admin-order", e], () => r.getOrder(e));
4074
+ if (l.error) return /* @__PURE__ */ C(q, { error: l.error });
4075
+ let u = l.data;
4076
+ if (!u) return /* @__PURE__ */ C("p", { children: i.loading });
4077
+ let d = xn(u);
3812
4078
  return /* @__PURE__ */ w("article", {
3813
4079
  className: "sfa-order",
3814
4080
  children: [
3815
- o({
3816
- href: a.orders,
3817
- children: s.back,
4081
+ s({
4082
+ href: o.orders,
4083
+ children: c.back,
3818
4084
  className: "sfa-link--tap"
3819
4085
  }),
3820
4086
  /* @__PURE__ */ C(V, {
3821
- title: `${s.detailTitle} ${l.id}`,
4087
+ title: `${c.detailTitle} ${T(u.id)}`,
3822
4088
  children: /* @__PURE__ */ w("div", {
3823
4089
  className: "sfa-order__header",
3824
4090
  children: [
3825
- /* @__PURE__ */ C(U, { status: l.status }),
4091
+ /* @__PURE__ */ C(U, { status: u.status }),
3826
4092
  /* @__PURE__ */ w("span", { children: [
3827
- s.placed,
4093
+ c.placed,
3828
4094
  " ",
3829
- new Intl.DateTimeFormat(i).format(new Date(l.createdAt))
4095
+ new Intl.DateTimeFormat(a).format(new Date(u.createdAt))
3830
4096
  ] }),
3831
4097
  /* @__PURE__ */ C(W, {
3832
- cents: l.totalCents,
3833
- currency: l.currency
4098
+ cents: u.totalCents,
4099
+ currency: u.currency
3834
4100
  })
3835
4101
  ]
3836
4102
  })
3837
4103
  }),
3838
- /* @__PURE__ */ w("section", {
3839
- className: "sfa-order__section",
3840
- children: [/* @__PURE__ */ C("h2", { children: s.buyer }), /* @__PURE__ */ C("p", { children: l.email ?? r.orders.noEmail })]
3841
- }),
3842
- /* @__PURE__ */ C(sn, { order: l }),
3843
- /* @__PURE__ */ w("section", {
3844
- className: "sfa-order__section",
3845
- children: [/* @__PURE__ */ C("h2", { children: s.shippingAddress }), u.length === 0 ? /* @__PURE__ */ C("p", { children: s.noAddress }) : /* @__PURE__ */ C("address", {
3846
- className: "sfa-order__address",
3847
- children: u.map((e) => /* @__PURE__ */ C("div", { children: e }, e))
4104
+ /* @__PURE__ */ w("div", {
4105
+ className: "sfa-order__columns",
4106
+ children: [/* @__PURE__ */ w("div", {
4107
+ className: "sfa-order__main",
4108
+ children: [
4109
+ /* @__PURE__ */ w("section", {
4110
+ className: "sfa-order__section",
4111
+ children: [/* @__PURE__ */ C("h2", { children: c.buyer }), /* @__PURE__ */ C("p", { children: u.email ?? i.orders.noEmail })]
4112
+ }),
4113
+ /* @__PURE__ */ C(yn, { order: u }),
4114
+ /* @__PURE__ */ w("section", {
4115
+ className: "sfa-order__section",
4116
+ children: [/* @__PURE__ */ C("h2", { children: c.shippingAddress }), d.length === 0 ? /* @__PURE__ */ C("p", { children: c.noAddress }) : /* @__PURE__ */ C("address", {
4117
+ className: "sfa-order__address",
4118
+ children: d.map((e) => /* @__PURE__ */ C("div", { children: e }, e))
4119
+ })]
4120
+ })
4121
+ ]
4122
+ }), /* @__PURE__ */ w("div", {
4123
+ className: "sfa-order__side",
4124
+ children: [
4125
+ /* @__PURE__ */ C(vn, { order: u }),
4126
+ /* @__PURE__ */ C(bn, { order: u }),
4127
+ /* @__PURE__ */ C("section", {
4128
+ className: "sfa-order__section",
4129
+ children: t ? t({
4130
+ order: u,
4131
+ reload: l.reload
4132
+ }) : /* @__PURE__ */ C(_n, {
4133
+ order: u,
4134
+ reload: l.reload,
4135
+ requireTracking: n
4136
+ })
4137
+ })
4138
+ ]
3848
4139
  })]
3849
- }),
3850
- /* @__PURE__ */ C(on, { order: l }),
3851
- /* @__PURE__ */ C(cn, { order: l }),
3852
- /* @__PURE__ */ C("section", {
3853
- className: "sfa-order__section",
3854
- children: t ? t({
3855
- order: l,
3856
- reload: c.reload
3857
- }) : /* @__PURE__ */ C(an, {
3858
- order: l,
3859
- reload: c.reload
3860
- })
3861
4140
  })
3862
4141
  ]
3863
4142
  });
3864
4143
  }
3865
4144
  // src/lib/shipping-rates.ts
3866
- var dn = 0, fn = () => `rate-${++dn}`;
3867
- function pn(e) {
4145
+ var Cn = 0, wn = () => `rate-${++Cn}`;
4146
+ function Tn(e) {
3868
4147
  return [...e].sort((e, t) => e.sort - t.sort).map((e) => ({
3869
- key: fn(),
4148
+ key: wn(),
3870
4149
  label: e.label,
3871
4150
  amount: X(e.amountCents),
3872
4151
  currency: e.currency,
@@ -3875,9 +4154,9 @@ function pn(e) {
3875
4154
  active: e.active
3876
4155
  }));
3877
4156
  }
3878
- function mn(e, t) {
4157
+ function En(e, t) {
3879
4158
  return {
3880
- key: fn(),
4159
+ key: wn(),
3881
4160
  label: t,
3882
4161
  amount: "",
3883
4162
  currency: e,
@@ -3886,18 +4165,18 @@ function mn(e, t) {
3886
4165
  active: !0
3887
4166
  };
3888
4167
  }
3889
- var hn = (e) => JSON.stringify(e.map(({ key: e, ...t }) => t));
3890
- function gn(e) {
4168
+ var Dn = (e) => JSON.stringify(e.map(({ key: e, ...t }) => t));
4169
+ function On(e) {
3891
4170
  let t = e.trim();
3892
4171
  return t === "" ? null : /^\d+$/.test(t) ? Number(t) : void 0;
3893
4172
  }
3894
- function _n(e, t) {
4173
+ function kn(e, t) {
3895
4174
  let n = {}, r = [], i = /* @__PURE__ */ new Map();
3896
4175
  if (e.forEach((e) => {
3897
4176
  let t = e.label.trim();
3898
4177
  i.set(t, (i.get(t) ?? 0) + 1);
3899
4178
  }), e.forEach((e, a) => {
3900
- let o = {}, s = e.label.trim(), c = Y(e.amount), l = gn(e.minDays), u = gn(e.maxDays);
4179
+ let o = {}, s = e.label.trim(), c = Y(e.amount), l = On(e.minDays), u = On(e.maxDays);
3901
4180
  s === "" ? o.label = t.labelRequired : (i.get(s) ?? 0) > 1 && (o.label = t.labelDuplicate), /^[A-Z]{3}$/.test(e.currency) || (o.currency = t.currencyInvalid), c === null && (o.amount = t.amountInvalid), l === void 0 && (o.minDays = t.daysInvalid), u === void 0 && (o.maxDays = t.daysInvalid), typeof l == "number" && typeof u == "number" && l > u && (o.minDays = t.daysOrder), Object.keys(o).length > 0 && (n[e.key] = o), r.push({
3902
4181
  label: s,
3903
4182
  amountCents: c ?? 0,
@@ -3908,7 +4187,7 @@ function _n(e, t) {
3908
4187
  sort: a
3909
4188
  });
3910
4189
  }), Object.keys(n).length === 0) {
3911
- let i = T.safeParse(r);
4190
+ let i = E.safeParse(r);
3912
4191
  if (!i.success) for (let r of i.error.issues) {
3913
4192
  let i = typeof r.path[0] == "number" ? e[r.path[0]]?.key : void 0;
3914
4193
  i && (n[i] = { row: t.rowInvalid });
@@ -3922,19 +4201,19 @@ function _n(e, t) {
3922
4201
  valid: Object.keys(n).length === 0 && !a
3923
4202
  };
3924
4203
  }
3925
- var vn = {
4204
+ var An = {
3926
4205
  label: "label",
3927
4206
  amountCents: "amount",
3928
4207
  currency: "currency",
3929
4208
  minDays: "minDays",
3930
4209
  maxDays: "maxDays"
3931
4210
  };
3932
- function yn(e, t, n) {
4211
+ function jn(e, t, n) {
3933
4212
  let r = {};
3934
4213
  for (let i of e) {
3935
4214
  let e = i?.path ?? [], a = e.findIndex((e) => typeof e == "number"), o = a >= 0 ? t[e[a]]?.key : void 0;
3936
4215
  if (!o) continue;
3937
- let s = e[e.length - 1], c = e.length - 1 > a && typeof s == "string" ? vn[s] : void 0;
4216
+ let s = e[e.length - 1], c = e.length - 1 > a && typeof s == "string" ? An[s] : void 0;
3938
4217
  r[o] = {
3939
4218
  ...r[o],
3940
4219
  [c ?? "row"]: n.rowInvalid
@@ -3942,31 +4221,50 @@ function yn(e, t, n) {
3942
4221
  }
3943
4222
  return r;
3944
4223
  }
4224
+ // src/lib/currency-symbol.ts
4225
+ function Mn(e, t) {
4226
+ try {
4227
+ return new Intl.NumberFormat(t, {
4228
+ style: "currency",
4229
+ currency: e,
4230
+ currencyDisplay: "narrowSymbol"
4231
+ }).formatToParts(0).find((e) => e.type === "currency")?.value ?? e;
4232
+ } catch {
4233
+ return e;
4234
+ }
4235
+ }
3945
4236
  // src/views/shipping/shipping-rate-row.tsx
3946
- function bn({ draft: e, index: t, total: n, errors: r, disabled: i, labels: a, onChange: o, onMove: s, onRemove: c }) {
3947
- let l = e.label.trim() || $(a.rowName, { n: String(t + 1) }), u = (t, n, a, s, c) => {
3948
- let l = r[s], u = `${e.key}-${t}`;
4237
+ function Nn({ draft: e, index: t, total: n, errors: r, disabled: i, labels: a, locale: o, onChange: s, onMove: c, onRemove: l }) {
4238
+ let u = e.label.trim() || Mt(a.rowName, { n: String(t + 1) }), d = Mn(e.currency, o), f = (t, n, a, o, c, l) => {
4239
+ let u = r[o], d = `${e.key}-${t}`, f = /* @__PURE__ */ C("input", {
4240
+ id: d,
4241
+ value: a,
4242
+ inputMode: c,
4243
+ disabled: i,
4244
+ "aria-invalid": !!u,
4245
+ "aria-describedby": u ? `${d}-error` : void 0,
4246
+ onChange: (e) => s({ [o]: e.target.value })
4247
+ });
3949
4248
  return /* @__PURE__ */ w("div", {
3950
4249
  className: "sfa-field",
3951
4250
  children: [
3952
4251
  /* @__PURE__ */ C("label", {
3953
4252
  className: "sfa-field__label",
3954
- htmlFor: u,
4253
+ htmlFor: d,
3955
4254
  children: n
3956
4255
  }),
3957
- /* @__PURE__ */ C("input", {
3958
- id: u,
3959
- value: a,
3960
- inputMode: c,
3961
- disabled: i,
3962
- "aria-invalid": !!l,
3963
- "aria-describedby": l ? `${u}-error` : void 0,
3964
- onChange: (e) => o({ [s]: e.target.value })
3965
- }),
3966
- l ? /* @__PURE__ */ C("p", {
3967
- id: `${u}-error`,
4256
+ l ? /* @__PURE__ */ w("div", {
4257
+ className: "sfa-rate__money",
4258
+ children: [/* @__PURE__ */ C("span", {
4259
+ className: "sfa-rate__prefix",
4260
+ "aria-hidden": "true",
4261
+ children: l
4262
+ }), f]
4263
+ }) : f,
4264
+ u ? /* @__PURE__ */ C("p", {
4265
+ id: `${d}-error`,
3968
4266
  className: "sfa-field__error",
3969
- children: l
4267
+ children: u
3970
4268
  }) : null
3971
4269
  ]
3972
4270
  });
@@ -3975,35 +4273,21 @@ function bn({ draft: e, index: t, total: n, errors: r, disabled: i, labels: a, o
3975
4273
  className: "sfa-rate",
3976
4274
  "data-rate-key": e.key,
3977
4275
  children: [
3978
- u("label", a.label, e.label, "label"),
3979
- u("amount", a.amount, e.amount, "amount", "decimal"),
3980
- /* @__PURE__ */ w("div", {
3981
- className: "sfa-field",
3982
- children: [
3983
- /* @__PURE__ */ C("span", {
3984
- className: "sfa-field__label",
3985
- children: a.currency
3986
- }),
3987
- /* @__PURE__ */ C("span", {
3988
- className: "sfa-rate__currency",
3989
- "aria-invalid": !!r.currency,
3990
- children: e.currency
3991
- }),
3992
- r.currency ? /* @__PURE__ */ C("p", {
3993
- className: "sfa-field__error",
3994
- children: r.currency
3995
- }) : null
3996
- ]
3997
- }),
3998
- u("min", a.minDays, e.minDays, "minDays", "numeric"),
3999
- u("max", a.maxDays, e.maxDays, "maxDays", "numeric"),
4276
+ f("label", a.label, e.label, "label"),
4277
+ f("amount", a.amount, e.amount, "amount", "decimal", d),
4278
+ r.currency ? /* @__PURE__ */ C("p", {
4279
+ className: "sfa-field__error",
4280
+ children: r.currency
4281
+ }) : null,
4282
+ f("min", a.minDays, e.minDays, "minDays", "numeric"),
4283
+ f("max", a.maxDays, e.maxDays, "maxDays", "numeric"),
4000
4284
  /* @__PURE__ */ w("label", {
4001
4285
  className: "sfa-rate__active",
4002
4286
  children: [/* @__PURE__ */ C("input", {
4003
4287
  type: "checkbox",
4004
4288
  checked: e.active,
4005
4289
  disabled: i,
4006
- onChange: (e) => o({ active: e.target.checked })
4290
+ onChange: (e) => s({ active: e.target.checked })
4007
4291
  }), a.active]
4008
4292
  }),
4009
4293
  r.row ? /* @__PURE__ */ C("p", {
@@ -4015,27 +4299,39 @@ function bn({ draft: e, index: t, total: n, errors: r, disabled: i, labels: a, o
4015
4299
  children: [
4016
4300
  /* @__PURE__ */ C("button", {
4017
4301
  type: "button",
4018
- className: "sfa-btn",
4019
- "aria-label": `${a.moveEarlier}: ${l}`,
4302
+ className: "sfa-btn sfa-btn--icon",
4303
+ "aria-label": `${a.moveEarlier}: ${u}`,
4304
+ title: a.moveEarlier,
4020
4305
  disabled: i || t === 0,
4021
- onClick: () => s("earlier"),
4022
- children: a.moveEarlier
4306
+ onClick: () => c("earlier"),
4307
+ children: /* @__PURE__ */ C("span", {
4308
+ "aria-hidden": "true",
4309
+ children: "↑"
4310
+ })
4023
4311
  }),
4024
4312
  /* @__PURE__ */ C("button", {
4025
4313
  type: "button",
4026
- className: "sfa-btn",
4027
- "aria-label": `${a.moveLater}: ${l}`,
4314
+ className: "sfa-btn sfa-btn--icon",
4315
+ "aria-label": `${a.moveLater}: ${u}`,
4316
+ title: a.moveLater,
4028
4317
  disabled: i || t === n - 1,
4029
- onClick: () => s("later"),
4030
- children: a.moveLater
4318
+ onClick: () => c("later"),
4319
+ children: /* @__PURE__ */ C("span", {
4320
+ "aria-hidden": "true",
4321
+ children: "↓"
4322
+ })
4031
4323
  }),
4032
4324
  /* @__PURE__ */ C("button", {
4033
4325
  type: "button",
4034
- className: "sfa-btn sfa-btn--danger",
4035
- "aria-label": `${a.remove}: ${l}`,
4326
+ className: "sfa-btn sfa-btn--icon sfa-btn--quiet-danger",
4327
+ "aria-label": `${a.remove}: ${u}`,
4328
+ title: a.remove,
4036
4329
  disabled: i,
4037
- onClick: c,
4038
- children: a.remove
4330
+ onClick: l,
4331
+ children: /* @__PURE__ */ C("span", {
4332
+ "aria-hidden": "true",
4333
+ children: "✕"
4334
+ })
4039
4335
  })
4040
4336
  ]
4041
4337
  })
@@ -4043,164 +4339,175 @@ function bn({ draft: e, index: t, total: n, errors: r, disabled: i, labels: a, o
4043
4339
  });
4044
4340
  }
4045
4341
  // src/views/shipping/admin-shipping-rates.tsx
4046
- function xn({ onDirtyChange: e, suggestedRates: t = [] }) {
4047
- let n = I(), { labels: r, currency: i } = F(), a = r.shipping, o = L(["shipping-rates"], () => n.listShippingRates()), [s, c] = b([]), [l, u] = b("[]"), [f, p] = b(void 0), [m, h] = b(null), [g, v] = b({}), [x, S] = b(!1), [T, E] = b(!1), [D, O] = b(!1), k = R((e) => n.replaceShippingRates(e)), A = y(void 0);
4048
- if (o.data && o.data !== f) {
4049
- let e = pn(o.data);
4050
- p(o.data), c(e), u(hn(e));
4342
+ function Pn({ onDirtyChange: e, suggestedRates: t = [] }) {
4343
+ let n = I(), { labels: r, currency: i, locale: a } = F(), o = r.shipping, s = L(["shipping-rates"], () => n.listShippingRates()), [c, l] = b([]), [u, f] = b("[]"), [p, m] = b(void 0), [h, g] = b(null), [v, x] = b({}), [S, T] = b(!1), [E, D] = b(!1), [O, k] = b(!1), A = R((e) => n.replaceShippingRates(e)), j = y(void 0), M = y(null);
4344
+ if (s.data && s.data !== p) {
4345
+ let e = Tn(s.data);
4346
+ m(s.data), l(e), f(Dn(e));
4051
4347
  }
4052
- let j = f !== void 0 && hn(s) !== l;
4348
+ let N = p !== void 0 && Dn(c) !== u;
4053
4349
  _(() => {
4054
- A.current !== j && (A.current = j, e?.(j));
4055
- }, [j, e]);
4056
- let M = (e) => {
4057
- c(e), E(!1), S(!1);
4058
- }, N = (e, t) => {
4059
- M(s.map((n) => n.key === e ? {
4350
+ j.current !== N && (j.current = N, e?.(N));
4351
+ }, [N, e]), _(() => {
4352
+ if (Object.keys(v).length === 0) return;
4353
+ let e = M.current?.querySelector("[aria-invalid=\"true\"]");
4354
+ e && "scrollIntoView" in e && e.scrollIntoView({ block: "center" });
4355
+ }, [v]);
4356
+ let P = (e) => {
4357
+ l(e), D(!1), T(!1);
4358
+ }, ee = (e, t) => {
4359
+ P(c.map((n) => n.key === e ? {
4060
4360
  ...n,
4061
4361
  ...t
4062
- } : n)), v(({ [e]: t, ...n }) => n);
4063
- }, ee = (e, t) => {
4362
+ } : n)), x(({ [e]: t, ...n }) => n);
4363
+ }, te = (e, t) => {
4064
4364
  let n = t === "earlier" ? e - 1 : e + 1;
4065
- if (n < 0 || n >= s.length) return;
4066
- let r = [...s];
4067
- [r[e], r[n]] = [r[n], r[e]], M(r);
4068
- }, P = () => M([...s, mn(i, a.newRateLabel)]), te = (e) => M([...s, {
4069
- ...mn(i, e.label),
4365
+ if (n < 0 || n >= c.length) return;
4366
+ let r = [...c];
4367
+ [r[e], r[n]] = [r[n], r[e]], P(r);
4368
+ }, ne = () => P([...c, En(i, o.newRateLabel)]), re = (e) => P([...c, {
4369
+ ...En(i, e.label),
4070
4370
  amount: X(e.amountCents)
4071
- }]), ne = () => {
4072
- m && (M(s.filter((e) => e.key !== m.key)), O(!0), h(null));
4073
- }, re = async () => {
4074
- let e = _n(s, a);
4075
- if (v(e.rowErrors), S(e.noActive), !e.valid) return;
4076
- let t = await k.run(e.rates);
4371
+ }]), ie = () => {
4372
+ h && (P(c.filter((e) => e.key !== h.key)), k(!0), g(null));
4373
+ }, ae = async () => {
4374
+ let e = kn(c, o);
4375
+ if (x(e.rowErrors), T(e.noActive), !e.valid) return;
4376
+ let t = await A.run(e.rates);
4077
4377
  if (!t) return;
4078
- let n = pn(t);
4079
- c(n), u(hn(n)), v({}), O(!1), E(!0);
4080
- }, ie = s.some((e) => e.currency !== i), ae = k.error instanceof d ? yn(k.error.issues, s, a) : {};
4081
- return o.loading && !o.data ? /* @__PURE__ */ C("p", {
4378
+ let n = Tn(t);
4379
+ l(n), f(Dn(n)), x({}), k(!1), D(!0);
4380
+ }, oe = c.some((e) => e.currency !== i), z = A.error instanceof d ? jn(A.error.issues, c, o) : {};
4381
+ return s.loading && !s.data ? /* @__PURE__ */ C("p", {
4082
4382
  role: "status",
4083
- children: a.loading
4084
- }) : o.data ? /* @__PURE__ */ w("div", {
4383
+ children: o.loading
4384
+ }) : s.data ? /* @__PURE__ */ w("div", {
4085
4385
  className: "sfa-shipping",
4386
+ ref: M,
4086
4387
  children: [
4087
- /* @__PURE__ */ C(V, { title: a.title }),
4088
- D ? /* @__PURE__ */ C(K, {
4388
+ /* @__PURE__ */ C(V, { title: o.title }),
4389
+ O ? /* @__PURE__ */ C(K, {
4089
4390
  variant: "warning",
4090
- children: a.removalWarning
4391
+ children: o.removalWarning
4091
4392
  }) : null,
4092
- ie ? /* @__PURE__ */ C(K, {
4393
+ oe ? /* @__PURE__ */ C(K, {
4093
4394
  variant: "warning",
4094
- children: $(a.mixedCurrency, { currency: i })
4395
+ children: Mt(o.mixedCurrency, { currency: i })
4095
4396
  }) : null,
4096
- x ? /* @__PURE__ */ C(K, {
4097
- variant: "error",
4098
- children: a.noActive
4099
- }) : null,
4100
- /* @__PURE__ */ C(q, { error: k.error }),
4101
- T ? /* @__PURE__ */ C(K, {
4102
- variant: "success",
4103
- children: a.saved
4104
- }) : null,
4105
- j ? /* @__PURE__ */ C("p", {
4397
+ N ? /* @__PURE__ */ C("p", {
4106
4398
  className: "sfa-field__help",
4107
- children: a.unsaved
4399
+ children: o.unsaved
4108
4400
  }) : null,
4109
- s.length === 0 ? /* @__PURE__ */ C(Ut, {
4401
+ c.length === 0 ? /* @__PURE__ */ C(be, {
4110
4402
  icon: "shipping",
4111
- title: a.emptyTitle,
4112
- body: a.empty,
4403
+ title: o.emptyTitle,
4404
+ body: o.empty,
4113
4405
  action: /* @__PURE__ */ C("button", {
4114
4406
  type: "button",
4115
4407
  className: "sfa-btn sfa-btn--primary",
4116
- onClick: P,
4117
- children: a.addOption
4408
+ onClick: ne,
4409
+ children: o.addOption
4118
4410
  }),
4119
4411
  children: t.length ? /* @__PURE__ */ C("ul", {
4120
4412
  className: "sfa-empty-state__chips",
4121
4413
  children: t.map((e) => /* @__PURE__ */ C("li", { children: /* @__PURE__ */ C("button", {
4122
4414
  type: "button",
4123
4415
  className: "sfa-chip",
4124
- onClick: () => te(e),
4416
+ onClick: () => re(e),
4125
4417
  children: e.label
4126
4418
  }) }, e.label))
4127
4419
  }) : null
4128
4420
  }) : null,
4129
4421
  /* @__PURE__ */ C("ul", {
4130
4422
  className: "sfa-rates",
4131
- children: s.map((e, t) => /* @__PURE__ */ C(bn, {
4423
+ children: c.map((e, t) => /* @__PURE__ */ C(Nn, {
4132
4424
  draft: e,
4133
4425
  index: t,
4134
- total: s.length,
4426
+ total: c.length,
4135
4427
  errors: {
4136
- ...ae[e.key],
4137
- ...g[e.key]
4428
+ ...z[e.key],
4429
+ ...v[e.key]
4138
4430
  },
4139
- disabled: k.pending,
4140
- labels: a,
4141
- onChange: (t) => N(e.key, t),
4142
- onMove: (e) => ee(t, e),
4143
- onRemove: () => h(e)
4431
+ disabled: A.pending,
4432
+ labels: o,
4433
+ locale: a,
4434
+ onChange: (t) => ee(e.key, t),
4435
+ onMove: (e) => te(t, e),
4436
+ onRemove: () => g(e)
4144
4437
  }, e.key))
4145
4438
  }),
4146
4439
  /* @__PURE__ */ w("div", {
4147
4440
  className: "sfa-shipping__actions",
4148
- children: [s.length > 0 ? /* @__PURE__ */ C("button", {
4441
+ children: [c.length > 0 ? /* @__PURE__ */ C("button", {
4149
4442
  type: "button",
4150
4443
  className: "sfa-btn",
4151
- onClick: P,
4152
- children: a.add
4444
+ onClick: ne,
4445
+ children: o.add
4153
4446
  }) : null, /* @__PURE__ */ C("button", {
4154
4447
  type: "button",
4155
4448
  className: "sfa-btn sfa-btn--primary",
4156
- disabled: k.pending,
4157
- onClick: re,
4158
- children: a.save
4449
+ disabled: A.pending,
4450
+ onClick: ae,
4451
+ children: o.save
4159
4452
  })]
4160
4453
  }),
4454
+ /* @__PURE__ */ w("div", {
4455
+ className: "sfa-shipping__feedback",
4456
+ children: [
4457
+ S ? /* @__PURE__ */ C(K, {
4458
+ variant: "error",
4459
+ children: o.noActive
4460
+ }) : null,
4461
+ /* @__PURE__ */ C(q, { error: A.error }),
4462
+ E ? /* @__PURE__ */ C(K, {
4463
+ variant: "success",
4464
+ children: o.saved
4465
+ }) : null
4466
+ ]
4467
+ }),
4161
4468
  /* @__PURE__ */ C(G, {
4162
- open: m !== null,
4163
- title: a.removeTitle,
4469
+ open: h !== null,
4470
+ title: o.removeTitle,
4164
4471
  destructive: !0,
4165
- confirmLabel: a.remove,
4166
- onConfirm: ne,
4167
- onCancel: () => h(null),
4168
- children: /* @__PURE__ */ C("p", { children: a.removeBody })
4472
+ confirmLabel: o.remove,
4473
+ onConfirm: ie,
4474
+ onCancel: () => g(null),
4475
+ children: /* @__PURE__ */ C("p", { children: o.removeBody })
4169
4476
  })
4170
4477
  ]
4171
- }) : /* @__PURE__ */ C(q, { error: o.error });
4478
+ }) : /* @__PURE__ */ C(q, { error: s.error });
4172
4479
  }
4173
4480
  // src/lib/discount-status.ts
4174
- function Sn(e, t = /* @__PURE__ */ new Date()) {
4481
+ function Fn(e, t = /* @__PURE__ */ new Date()) {
4175
4482
  return e.active ? e.startsAt && new Date(e.startsAt) > t ? "scheduled" : e.endsAt && new Date(e.endsAt) <= t ? "expired" : "active" : "inactive";
4176
4483
  }
4177
- function Cn(e, t) {
4484
+ function In(e, t) {
4178
4485
  return e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e);
4179
4486
  }
4180
4487
  // src/lib/use-discount-pages.ts
4181
- function wn(e) {
4488
+ function Ln(e) {
4182
4489
  let t = I();
4183
- return we(["admin-discounts", e], (n) => t.listDiscounts(n ? {
4490
+ return je(["admin-discounts", e], (n) => t.listDiscounts(n ? {
4184
4491
  ...e,
4185
4492
  cursor: n
4186
4493
  } : e));
4187
4494
  }
4188
4495
  // src/views/discounts/discount-value.tsx
4189
- function Tn({ discount: e }) {
4496
+ function Rn({ discount: e }) {
4190
4497
  return e.type === "percent" ? /* @__PURE__ */ w("span", { children: [e.percentOff, "%"] }) : /* @__PURE__ */ C(W, {
4191
4498
  cents: e.amountOffCents ?? 0,
4192
4499
  currency: e.currency ?? "USD"
4193
4500
  });
4194
4501
  }
4195
4502
  // src/views/discounts/admin-discount-list.tsx
4196
- var En = [
4503
+ var zn = [
4197
4504
  "active",
4198
4505
  "scheduled",
4199
4506
  "expired",
4200
4507
  "inactive"
4201
4508
  ];
4202
- function Dn() {
4203
- let { labels: e, hrefs: t, renderLink: n } = F(), r = e.discounts, [i, a] = b("active"), [o, s] = b(""), c = Ce(o.trim(), 300), l = wn({
4509
+ function Bn() {
4510
+ let { labels: e, hrefs: t, renderLink: n } = F(), r = e.discounts, [i, a] = b("active"), [o, s] = b(""), c = Ae(o.trim(), 300), l = Ln({
4204
4511
  status: i,
4205
4512
  ...c ? { q: c } : {}
4206
4513
  }), u = [
@@ -4216,22 +4523,22 @@ function Dn() {
4216
4523
  {
4217
4524
  key: "value",
4218
4525
  header: r.columns.value,
4219
- render: (e) => /* @__PURE__ */ C(Tn, { discount: e })
4526
+ render: (e) => /* @__PURE__ */ C(Rn, { discount: e })
4220
4527
  },
4221
4528
  {
4222
4529
  key: "status",
4223
4530
  header: r.columns.status,
4224
- render: (e) => /* @__PURE__ */ C(U, { status: Sn(e) })
4531
+ render: (e) => /* @__PURE__ */ C(U, { status: Fn(e) })
4225
4532
  },
4226
4533
  {
4227
4534
  key: "usage",
4228
4535
  header: r.columns.usage,
4229
4536
  render: (e) => {
4230
4537
  let t = e.redeemedCount + e.reservedCount;
4231
- return e.maxRedemptions ? Cn(r.usage, {
4538
+ return e.maxRedemptions ? In(r.usage, {
4232
4539
  used: t,
4233
4540
  max: e.maxRedemptions
4234
- }) : Cn(r.usageUnlimited, { used: t });
4541
+ }) : In(r.usageUnlimited, { used: t });
4235
4542
  }
4236
4543
  }
4237
4544
  ];
@@ -4252,7 +4559,7 @@ function Dn() {
4252
4559
  role: "group",
4253
4560
  "aria-label": r.columns.status,
4254
4561
  className: "sfa-filter-group",
4255
- children: En.map((e) => /* @__PURE__ */ C("button", {
4562
+ children: zn.map((e) => /* @__PURE__ */ C("button", {
4256
4563
  type: "button",
4257
4564
  className: "sfa-chip",
4258
4565
  "aria-pressed": i === e,
@@ -4268,7 +4575,7 @@ function Dn() {
4268
4575
  })]
4269
4576
  }),
4270
4577
  /* @__PURE__ */ C(q, { error: l.error }),
4271
- l.loading && !l.loaded ? /* @__PURE__ */ C("p", { children: e.loading }) : l.items.length === 0 ? /* @__PURE__ */ C(Ut, {
4578
+ l.loading && !l.loaded ? /* @__PURE__ */ C("p", { children: e.loading }) : l.items.length === 0 ? /* @__PURE__ */ C(be, {
4272
4579
  icon: c ? "search" : "discounts",
4273
4580
  title: c ? r.noMatches : r.empty[i],
4274
4581
  body: c ? void 0 : r.emptyHint
@@ -4288,7 +4595,7 @@ function Dn() {
4288
4595
  });
4289
4596
  }
4290
4597
  // src/lib/discount-form.ts
4291
- var On = {
4598
+ var Vn = {
4292
4599
  code: "",
4293
4600
  type: "percent",
4294
4601
  percentOff: "",
@@ -4297,43 +4604,43 @@ var On = {
4297
4604
  startsAt: "",
4298
4605
  endsAt: "",
4299
4606
  maxRedemptions: ""
4300
- }, kn = (e) => String(e).padStart(2, "0");
4301
- function An(e) {
4607
+ }, Hn = (e) => String(e).padStart(2, "0");
4608
+ function Un(e) {
4302
4609
  if (!e) return "";
4303
4610
  let t = new Date(e);
4304
- return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${kn(t.getMonth() + 1)}-${kn(t.getDate())}T${kn(t.getHours())}:${kn(t.getMinutes())}`;
4611
+ return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${Hn(t.getMonth() + 1)}-${Hn(t.getDate())}T${Hn(t.getHours())}:${Hn(t.getMinutes())}`;
4305
4612
  }
4306
- function jn(e) {
4613
+ function Wn(e) {
4307
4614
  if (e.trim() === "") return null;
4308
4615
  let t = new Date(e);
4309
4616
  return Number.isNaN(t.getTime()) ? null : t.toISOString();
4310
4617
  }
4311
- function Mn(e) {
4618
+ function Gn(e) {
4312
4619
  return {
4313
4620
  code: e.code,
4314
4621
  type: e.type,
4315
4622
  percentOff: e.percentOff ? String(e.percentOff) : "",
4316
4623
  amountOff: e.amountOffCents ? X(e.amountOffCents) : "",
4317
4624
  minSubtotal: e.minSubtotalCents ? X(e.minSubtotalCents) : "",
4318
- startsAt: An(e.startsAt),
4319
- endsAt: An(e.endsAt),
4625
+ startsAt: Un(e.startsAt),
4626
+ endsAt: Un(e.endsAt),
4320
4627
  maxRedemptions: e.maxRedemptions ? String(e.maxRedemptions) : ""
4321
4628
  };
4322
4629
  }
4323
- function Nn(e) {
4630
+ function Kn(e) {
4324
4631
  return !!(e && e.redeemedCount + e.reservedCount > 0);
4325
4632
  }
4326
- var Pn = (e) => /^\d+$/.test(e.trim()) && Number(e) > 0 ? Number(e) : null;
4327
- function Fn(e, t, n, r = 0) {
4633
+ var qn = (e) => /^\d+$/.test(e.trim()) && Number(e) > 0 ? Number(e) : null;
4634
+ function Jn(e, t, n, r = 0) {
4328
4635
  let i = t.validation, a = {}, o = e.code.trim().toUpperCase();
4329
4636
  /^[A-Z0-9_-]{1,40}$/.test(o) || (a.code = i.code);
4330
- let s = Pn(e.percentOff), c = Y(e.amountOff);
4637
+ let s = qn(e.percentOff), c = Y(e.amountOff);
4331
4638
  e.type === "percent" && (s === null || s > 100) && (a.percentOff = i.percentOff), e.type === "fixed" && !c && (a.amountOff = i.amountOff);
4332
4639
  let l = e.minSubtotal.trim(), u = l === "" ? null : Y(l);
4333
4640
  l !== "" && !u && (a.minSubtotal = i.minSubtotal);
4334
- let d = e.maxRedemptions.trim(), f = d === "" ? null : Pn(d);
4641
+ let d = e.maxRedemptions.trim(), f = d === "" ? null : qn(d);
4335
4642
  d !== "" && f === null ? a.maxRedemptions = i.maxRedemptions : f !== null && f < r && (a.maxRedemptions = i.maxRedemptionsBelowUsage);
4336
- let p = jn(e.startsAt), m = jn(e.endsAt);
4643
+ let p = Wn(e.startsAt), m = Wn(e.endsAt);
4337
4644
  return e.startsAt.trim() !== "" && !p && (a.startsAt = i.date), e.endsAt.trim() !== "" && !m && (a.endsAt = i.date), p && m && new Date(m) <= new Date(p) && (a.endsAt = i.endsBeforeStart), Object.keys(a).length > 0 ? {
4338
4645
  ok: !1,
4339
4646
  errors: a
@@ -4353,25 +4660,25 @@ function Fn(e, t, n, r = 0) {
4353
4660
  }
4354
4661
  };
4355
4662
  }
4356
- var In = [
4663
+ var Yn = [
4357
4664
  "type",
4358
4665
  "percentOff",
4359
4666
  "amountOffCents",
4360
4667
  "currency"
4361
- ], Ln = [
4668
+ ], Xn = [
4362
4669
  "minSubtotalCents",
4363
4670
  "startsAt",
4364
4671
  "endsAt",
4365
4672
  "maxRedemptions"
4366
4673
  ];
4367
- function Rn(e, t, n) {
4674
+ function Zn(e, t, n) {
4368
4675
  let r = {}, i = t, a = e, o = (e) => (i[e] ?? null) !== (a[e] ?? null);
4369
- for (let e of Ln) o(e) && (r[e] = i[e]);
4676
+ for (let e of Xn) o(e) && (r[e] = i[e]);
4370
4677
  if (n) return r;
4371
- if (o("code") && (r.code = t.code), In.some(o)) for (let e of In) r[e] = i[e];
4678
+ if (o("code") && (r.code = t.code), Yn.some(o)) for (let e of Yn) r[e] = i[e];
4372
4679
  return r;
4373
4680
  }
4374
- function zn(e, t) {
4681
+ function Qn(e, t) {
4375
4682
  let n = {
4376
4683
  code: "code",
4377
4684
  percentOff: "percentOff",
@@ -4388,7 +4695,7 @@ function zn(e, t) {
4388
4695
  return r;
4389
4696
  }
4390
4697
  // src/views/discounts/discount-fields.tsx
4391
- function Bn({ name: e, label: t, error: n, help: r, disabled: i, children: a }) {
4698
+ function $n({ name: e, label: t, error: n, help: r, disabled: i, children: a }) {
4392
4699
  let o = `sfa-field-${e}`, s = [r ? `${o}-help` : "", n ? `${o}-error` : ""].filter(Boolean).join(" ");
4393
4700
  return /* @__PURE__ */ w("div", {
4394
4701
  className: "sfa-field",
@@ -4418,9 +4725,9 @@ function Bn({ name: e, label: t, error: n, help: r, disabled: i, children: a })
4418
4725
  ]
4419
4726
  });
4420
4727
  }
4421
- var Vn = ["percent", "fixed"];
4422
- function Hn({ form: e, errors: t, labels: n, usedCount: r, onChange: i }) {
4423
- let a = r > 0, o = a ? Cn(n.lockedHelp, { count: r }) : void 0, s = (n, r, a = {}) => /* @__PURE__ */ C(Bn, {
4728
+ var er = ["percent", "fixed"];
4729
+ function tr({ form: e, errors: t, labels: n, usedCount: r, onChange: i }) {
4730
+ let a = r > 0, o = a ? In(n.lockedHelp, { count: r }) : void 0, s = (n, r, a = {}) => /* @__PURE__ */ C($n, {
4424
4731
  name: n,
4425
4732
  label: r,
4426
4733
  error: t[n],
@@ -4433,7 +4740,7 @@ function Hn({ form: e, errors: t, labels: n, usedCount: r, onChange: i }) {
4433
4740
  value: e[n],
4434
4741
  onChange: (e) => i(n, e.target.value)
4435
4742
  })
4436
- }), c = (r) => /* @__PURE__ */ C(Bn, {
4743
+ }), c = (r) => /* @__PURE__ */ C($n, {
4437
4744
  name: r,
4438
4745
  label: n.fields[r],
4439
4746
  error: t[r],
@@ -4450,7 +4757,7 @@ function Hn({ form: e, errors: t, labels: n, usedCount: r, onChange: i }) {
4450
4757
  help: o,
4451
4758
  locked: a
4452
4759
  }),
4453
- /* @__PURE__ */ C(Bn, {
4760
+ /* @__PURE__ */ C($n, {
4454
4761
  name: "type",
4455
4762
  label: n.fields.type,
4456
4763
  disabled: a,
@@ -4458,7 +4765,7 @@ function Hn({ form: e, errors: t, labels: n, usedCount: r, onChange: i }) {
4458
4765
  ...t,
4459
4766
  value: e.type,
4460
4767
  onChange: (e) => i("type", e.target.value),
4461
- children: Vn.map((e) => /* @__PURE__ */ C("option", {
4768
+ children: er.map((e) => /* @__PURE__ */ C("option", {
4462
4769
  value: e,
4463
4770
  children: n.types[e]
4464
4771
  }, e))
@@ -4484,52 +4791,52 @@ function Hn({ form: e, errors: t, labels: n, usedCount: r, onChange: i }) {
4484
4791
  ] });
4485
4792
  }
4486
4793
  // src/views/discounts/admin-discount-editor.tsx
4487
- function Un({ discountId: e, onSaved: t }) {
4488
- return e ? /* @__PURE__ */ C(Wn, {
4794
+ function nr({ discountId: e, onSaved: t }) {
4795
+ return e ? /* @__PURE__ */ C(rr, {
4489
4796
  discountId: e,
4490
4797
  onSaved: t
4491
- }) : /* @__PURE__ */ C(Gn, {
4798
+ }) : /* @__PURE__ */ C(ir, {
4492
4799
  discount: void 0,
4493
4800
  onSaved: t
4494
4801
  });
4495
4802
  }
4496
- function Wn({ discountId: e, onSaved: t }) {
4803
+ function rr({ discountId: e, onSaved: t }) {
4497
4804
  let n = I(), { labels: r } = F(), i = L(["admin-discount", e], () => n.getDiscount(e));
4498
- return i.error ? /* @__PURE__ */ C(q, { error: i.error }) : i.data ? /* @__PURE__ */ C(Gn, {
4805
+ return i.error ? /* @__PURE__ */ C(q, { error: i.error }) : i.data ? /* @__PURE__ */ C(ir, {
4499
4806
  discount: i.data,
4500
4807
  onSaved: t
4501
4808
  }, i.data.id) : /* @__PURE__ */ C("p", { children: r.loading });
4502
4809
  }
4503
- function Gn({ discount: e, onSaved: t }) {
4504
- let n = I(), { labels: i, currency: a } = F(), o = i.discounts, [s, c] = b(e), [u, f] = b(e ? Mn(e) : On), [p, m] = b({}), [h, g] = b(!1), [_, v] = b(!1), y = s ? s.redeemedCount + s.reservedCount : 0, x = Nn(s), S = (e, t) => {
4810
+ function ir({ discount: e, onSaved: t }) {
4811
+ let n = I(), { labels: r, currency: a } = F(), o = r.discounts, [s, c] = b(e), [u, f] = b(e ? Gn(e) : Vn), [p, m] = b({}), [h, g] = b(!1), [_, v] = b(!1), y = s ? s.redeemedCount + s.reservedCount : 0, x = Kn(s), S = (e, t) => {
4505
4812
  m(t);
4506
4813
  let n = Object.keys(t)[0];
4507
4814
  n && e.elements.namedItem(n)?.focus();
4508
4815
  }, T = R(async (e) => {
4509
- let t = Fn(u, o, s?.currency ?? a, y);
4816
+ let t = Jn(u, o, s?.currency ?? a, y);
4510
4817
  if (!t.ok) S(e, t.errors);
4511
4818
  else try {
4512
4819
  if (!s) return await n.createDiscount(t.input);
4513
- let e = Rn(s, t.input, x);
4820
+ let e = Zn(s, t.input, x);
4514
4821
  return Object.keys(e).length === 0 ? s : await n.updateDiscount(s.id, e);
4515
4822
  } catch (t) {
4516
4823
  if (t instanceof l) {
4517
4824
  S(e, { code: o.validation.codeTaken });
4518
4825
  return;
4519
4826
  }
4520
- if (t instanceof r) {
4827
+ if (t instanceof i) {
4521
4828
  S(e, { maxRedemptions: o.validation.maxRedemptionsBelowUsage });
4522
4829
  return;
4523
4830
  }
4524
4831
  if (!(t instanceof d)) throw t;
4525
- S(e, zn(t.issues, o.validation.invalid));
4832
+ S(e, Qn(t.issues, o.validation.invalid));
4526
4833
  return;
4527
4834
  }
4528
4835
  }), E = R((e) => {
4529
4836
  if (!s) throw Error("Discount has not been created yet.");
4530
4837
  return n.updateDiscount(s.id, { active: e });
4531
4838
  }), D = (e) => {
4532
- c(e), f(Mn(e)), g(!0), t?.(e);
4839
+ c(e), f(Gn(e)), g(!0), t?.(e);
4533
4840
  }, O = (e, t) => {
4534
4841
  f((n) => ({
4535
4842
  ...n,
@@ -4554,7 +4861,7 @@ function Gn({ discount: e, onSaved: t }) {
4554
4861
  children: [
4555
4862
  /* @__PURE__ */ C(V, { title: s ? o.editTitle : o.createTitle }),
4556
4863
  /* @__PURE__ */ C(q, { error: T.error ?? E.error }),
4557
- /* @__PURE__ */ C(Hn, {
4864
+ /* @__PURE__ */ C(tr, {
4558
4865
  form: u,
4559
4866
  errors: p,
4560
4867
  labels: o,
@@ -4568,7 +4875,7 @@ function Gn({ discount: e, onSaved: t }) {
4568
4875
  type: "submit",
4569
4876
  className: "sfa-btn sfa-btn--primary",
4570
4877
  disabled: T.pending,
4571
- children: i.save
4878
+ children: r.save
4572
4879
  }),
4573
4880
  s?.active ? /* @__PURE__ */ C("button", {
4574
4881
  type: "button",
@@ -4605,7 +4912,7 @@ function Gn({ discount: e, onSaved: t }) {
4605
4912
  });
4606
4913
  }
4607
4914
  // src/lib/use-batch-upload.ts
4608
- function Kn() {
4915
+ function ar() {
4609
4916
  let e = I(), { labels: t, currency: n } = F(), [r, i] = b([]), a = y(0), o = y(Promise.resolve()), s = (e, t) => i((n) => n.map((n) => n.id === e ? {
4610
4917
  ...n,
4611
4918
  ...t
@@ -4616,7 +4923,7 @@ function Kn() {
4616
4923
  });
4617
4924
  let r = t.productId;
4618
4925
  try {
4619
- r || (r = (await e.createProduct(tt(Dt, n))).id, s(t.id, { productId: r }));
4926
+ r || (r = (await e.createProduct(ut(Ht, n))).id, s(t.id, { productId: r }));
4620
4927
  let i = await e.uploadProductImage(r, t.file, "");
4621
4928
  s(t.id, {
4622
4929
  status: "done",
@@ -4632,7 +4939,7 @@ function Kn() {
4632
4939
  for (let t of e) o.current = o.current.then(() => c(t));
4633
4940
  }, u = h((e) => {
4634
4941
  let n = e.map((e) => {
4635
- let n = bt(e, t.products.images);
4942
+ let n = Nt(e, t.products.images);
4636
4943
  return {
4637
4944
  id: a.current++,
4638
4945
  file: e,
@@ -4663,22 +4970,37 @@ function Kn() {
4663
4970
  };
4664
4971
  }
4665
4972
  // src/views/products/add-several/photo-picker.tsx
4666
- function qn({ label: e, onFiles: t, multiple: n = !0, primary: r = !1 }) {
4973
+ function or({ label: e, onFiles: t, multiple: n = !0, primary: r = !1, zone: i = !1, hint: a }) {
4667
4974
  return /* @__PURE__ */ w("label", {
4668
- className: `sfa-btn${r ? " sfa-btn--primary" : ""}`,
4669
- children: [e, /* @__PURE__ */ C("input", {
4670
- type: "file",
4671
- accept: "image/*",
4672
- multiple: n,
4673
- className: "sfa-sr-only",
4674
- onChange: (e) => {
4675
- t(Array.from(e.target.files ?? [])), e.target.value = "";
4676
- }
4677
- })]
4975
+ className: i ? "sfa-dropzone" : `sfa-btn${r ? " sfa-btn--primary" : ""}`,
4976
+ children: [
4977
+ i ? /* @__PURE__ */ C("span", {
4978
+ className: "sfa-dropzone__icon",
4979
+ "aria-hidden": "true",
4980
+ children: "+"
4981
+ }) : null,
4982
+ /* @__PURE__ */ C("span", {
4983
+ className: i ? "sfa-dropzone__label" : void 0,
4984
+ children: e
4985
+ }),
4986
+ i && a ? /* @__PURE__ */ C("span", {
4987
+ className: "sfa-dropzone__hint",
4988
+ children: a
4989
+ }) : null,
4990
+ /* @__PURE__ */ C("input", {
4991
+ type: "file",
4992
+ accept: "image/*",
4993
+ multiple: n,
4994
+ className: "sfa-sr-only",
4995
+ onChange: (e) => {
4996
+ t(Array.from(e.target.files ?? [])), e.target.value = "";
4997
+ }
4998
+ })
4999
+ ]
4678
5000
  });
4679
5001
  }
4680
5002
  // src/views/products/add-several/admin-add-several.tsx
4681
- function Jn({ failed: e }) {
5003
+ function sr({ failed: e }) {
4682
5004
  return /* @__PURE__ */ C("ul", {
4683
5005
  className: "sfa-batch__failed",
4684
5006
  children: e.map((e) => /* @__PURE__ */ w("li", { children: [/* @__PURE__ */ C("strong", { children: e.file.name }), e.reason ? /* @__PURE__ */ C(K, {
@@ -4687,8 +5009,8 @@ function Jn({ failed: e }) {
4687
5009
  }) : /* @__PURE__ */ C(q, { error: e.error })] }, e.id))
4688
5010
  });
4689
5011
  }
4690
- function Yn({ onDone: e }) {
4691
- let { labels: t } = F(), n = t.products.stock.addSeveral, r = Kn(), i = r.items.length, a = r.failed.some((e) => !e.reason), o = r.done.length + r.failed.length;
5012
+ function cr({ onDone: e }) {
5013
+ let { labels: t } = F(), n = t.products.stock.addSeveral, r = ar(), i = r.items.length, a = r.failed.some((e) => !e.reason), o = r.done.length + r.failed.length;
4692
5014
  return /* @__PURE__ */ w("section", {
4693
5015
  className: "sfa-batch",
4694
5016
  children: [/* @__PURE__ */ C(V, { title: n.title }), /* @__PURE__ */ C("div", {
@@ -4698,10 +5020,11 @@ function Yn({ onDone: e }) {
4698
5020
  children: [
4699
5021
  /* @__PURE__ */ C("h2", { children: n.introTitle }),
4700
5022
  /* @__PURE__ */ C("p", { children: n.introBody }),
4701
- /* @__PURE__ */ C(qn, {
5023
+ /* @__PURE__ */ C(or, {
4702
5024
  label: n.choose,
5025
+ hint: n.dropHint,
4703
5026
  onFiles: r.add,
4704
- primary: !0
5027
+ zone: !0
4705
5028
  })
4706
5029
  ]
4707
5030
  }) : r.settled ? r.failed.length === 0 ? /* @__PURE__ */ w("div", {
@@ -4720,7 +5043,7 @@ function Yn({ onDone: e }) {
4720
5043
  className: "sfa-batch__result",
4721
5044
  children: [
4722
5045
  /* @__PURE__ */ C("h2", { children: J(n.failedTitle, { count: r.failed.length }) }),
4723
- /* @__PURE__ */ C(Jn, { failed: r.failed }),
5046
+ /* @__PURE__ */ C(sr, { failed: r.failed }),
4724
5047
  /* @__PURE__ */ w("div", {
4725
5048
  className: "sfa-batch__actions",
4726
5049
  children: [a ? /* @__PURE__ */ C("button", {
@@ -4733,7 +5056,7 @@ function Yn({ onDone: e }) {
4733
5056
  className: "sfa-btn",
4734
5057
  onClick: () => e(r.products),
4735
5058
  children: n.continueWithout
4736
- }) : /* @__PURE__ */ C(qn, {
5059
+ }) : /* @__PURE__ */ C(or, {
4737
5060
  label: n.choose,
4738
5061
  onFiles: r.add
4739
5062
  })]
@@ -4754,7 +5077,7 @@ function Yn({ onDone: e }) {
4754
5077
  });
4755
5078
  }
4756
5079
  // src/views/products/finish-drafts/piece-fields.tsx
4757
- function Xn({ form: e, update: t, categories: n }) {
5080
+ function lr({ form: e, update: t, categories: n }) {
4758
5081
  let { labels: r, locale: i, currency: a } = F(), o = r.products.fields, s = r.products.flow, c = [...n ?? []], l = e.category.trim();
4759
5082
  return l && !c.includes(l) && c.push(l), /* @__PURE__ */ w("div", {
4760
5083
  className: "sfa-piece__fields",
@@ -4783,7 +5106,7 @@ function Xn({ form: e, update: t, categories: n }) {
4783
5106
  className: "sfa-flow__price",
4784
5107
  children: [/* @__PURE__ */ C("span", {
4785
5108
  "aria-hidden": "true",
4786
- children: st(i, a)
5109
+ children: vt(i, a)
4787
5110
  }), /* @__PURE__ */ C("input", {
4788
5111
  id: "sfa-piece-price",
4789
5112
  type: "text",
@@ -4829,11 +5152,11 @@ function Xn({ form: e, update: t, categories: n }) {
4829
5152
  });
4830
5153
  }
4831
5154
  // src/views/products/finish-drafts/piece-card.tsx
4832
- function Zn({ product: e, index: t, total: n, categories: r, onAdvance: i, onBack: a }) {
4833
- let { labels: o, renderImage: s } = F(), c = o.products.stock.queue, [l, u] = b(() => Ot(e)), d = kt({
5155
+ function ur({ product: e, index: t, total: n, categories: r, onAdvance: i, onBack: a }) {
5156
+ let { labels: o, renderImage: s } = F(), c = o.products.stock.queue, [l, u] = b(() => Ut(e)), d = Wt({
4834
5157
  initial: e,
4835
5158
  form: l
4836
- }), f = xt({
5159
+ }), f = Pt({
4837
5160
  productId: e.id,
4838
5161
  onUploaded: d.setProduct
4839
5162
  }), p = Q(d.product)[0], m = t === n - 1, h = String(t + 1), g = (e, t) => u((n) => ({
@@ -4868,7 +5191,7 @@ function Zn({ product: e, index: t, total: n, categories: r, onAdvance: i, onBac
4868
5191
  src: p.url,
4869
5192
  alt: p.alt || Z(c.coverAlt, { n: h }),
4870
5193
  sizes: "320px"
4871
- }) : /* @__PURE__ */ C(qn, {
5194
+ }) : /* @__PURE__ */ C(or, {
4872
5195
  label: c.addPhoto,
4873
5196
  multiple: !1,
4874
5197
  onFiles: (e) => f.upload(e, "")
@@ -4876,7 +5199,7 @@ function Zn({ product: e, index: t, total: n, categories: r, onAdvance: i, onBac
4876
5199
  variant: "error",
4877
5200
  children: e.reason ?? /* @__PURE__ */ C(q, { error: e.error })
4878
5201
  }, e.id) : null)]
4879
- }), /* @__PURE__ */ C(Xn, {
5202
+ }), /* @__PURE__ */ C(lr, {
4880
5203
  form: l,
4881
5204
  update: g,
4882
5205
  categories: r
@@ -4884,7 +5207,7 @@ function Zn({ product: e, index: t, total: n, categories: r, onAdvance: i, onBac
4884
5207
  }),
4885
5208
  /* @__PURE__ */ C(q, { error: d.error }),
4886
5209
  /* @__PURE__ */ w("div", {
4887
- className: "sfa-piece__actions",
5210
+ className: "sfa-piece__foot",
4888
5211
  children: [
4889
5212
  a ? /* @__PURE__ */ C("button", {
4890
5213
  type: "button",
@@ -4902,7 +5225,7 @@ function Zn({ product: e, index: t, total: n, categories: r, onAdvance: i, onBac
4902
5225
  /* @__PURE__ */ C("button", {
4903
5226
  type: "button",
4904
5227
  className: "sfa-btn sfa-btn--primary",
4905
- disabled: !rt(l) || d.state === "saving",
5228
+ disabled: !ft(l) || d.state === "saving",
4906
5229
  onClick: _,
4907
5230
  children: m ? c.review : c.next
4908
5231
  })
@@ -4912,72 +5235,83 @@ function Zn({ product: e, index: t, total: n, categories: r, onAdvance: i, onBac
4912
5235
  });
4913
5236
  }
4914
5237
  // src/views/products/finish-drafts/piece-summary.tsx
4915
- function Qn(e) {
4916
- return rt(Ot(e));
5238
+ function dr(e) {
5239
+ return ft(Ut(e));
4917
5240
  }
4918
- function $n({ pieces: e, pending: t, failure: n, onPublish: r, onKeepDrafts: i }) {
4919
- let { labels: a, renderImage: o } = F(), s = a.products.stock.summary, c = e.filter(Qn), l = e.filter((e) => !Qn(e));
5241
+ function fr({ pieces: e, pending: t, failure: n, onPublish: r, onOpenPiece: i, onKeepDrafts: a }) {
5242
+ let { labels: o, renderImage: s } = F(), c = o.products.stock.summary, l = e.filter(dr), u = e.filter((e) => !dr(e));
4920
5243
  return /* @__PURE__ */ w("section", {
4921
5244
  className: "sfa-piece",
4922
5245
  "aria-labelledby": "sfa-summary-title",
4923
5246
  children: [
4924
5247
  /* @__PURE__ */ C("h2", {
4925
5248
  id: "sfa-summary-title",
4926
- children: s.title
5249
+ className: "sfa-piece__heading",
5250
+ children: c.title
4927
5251
  }),
4928
- /* @__PURE__ */ C("p", { children: c.length ? s.lede : s.allSkipped }),
5252
+ /* @__PURE__ */ C("p", { children: l.length ? c.lede : c.allSkipped }),
4929
5253
  /* @__PURE__ */ C("ul", {
4930
5254
  className: "sfa-summary__list",
4931
- children: e.map((e) => {
4932
- let t = Q(e)[0];
4933
- return /* @__PURE__ */ w("li", {
5255
+ children: e.map((e, t) => {
5256
+ let n = Q(e)[0], r = dr(e), a = e.name || c.untitled, o = /* @__PURE__ */ w(S, { children: [
5257
+ /* @__PURE__ */ C("span", {
5258
+ className: "sfa-summary__photo",
5259
+ children: n ? s({
5260
+ src: n.url,
5261
+ alt: "",
5262
+ sizes: "56px"
5263
+ }) : null
5264
+ }),
5265
+ /* @__PURE__ */ C("span", {
5266
+ className: "sfa-summary__name",
5267
+ children: a
5268
+ }),
5269
+ /* @__PURE__ */ C("span", {
5270
+ className: "sfa-summary__price",
5271
+ children: r && e.priceCents !== null ? /* @__PURE__ */ C(W, {
5272
+ cents: e.priceCents,
5273
+ currency: e.currency
5274
+ }) : c.needsDetails
5275
+ })
5276
+ ] });
5277
+ return /* @__PURE__ */ C("li", { children: r ? /* @__PURE__ */ C("div", {
4934
5278
  className: "sfa-summary__row",
4935
- children: [
4936
- /* @__PURE__ */ C("span", {
4937
- className: "sfa-summary__photo",
4938
- children: t ? o({
4939
- src: t.url,
4940
- alt: "",
4941
- sizes: "56px"
4942
- }) : null
4943
- }),
4944
- /* @__PURE__ */ C("span", {
4945
- className: "sfa-summary__name",
4946
- children: e.name || s.untitled
4947
- }),
4948
- /* @__PURE__ */ C("span", {
4949
- className: "sfa-summary__price",
4950
- children: Qn(e) && e.priceCents !== null ? /* @__PURE__ */ C(W, {
4951
- cents: e.priceCents,
4952
- currency: e.currency
4953
- }) : s.needsDetails
4954
- })
4955
- ]
4956
- }, e.id);
5279
+ children: o
5280
+ }) : /* @__PURE__ */ w("button", {
5281
+ type: "button",
5282
+ className: "sfa-summary__row sfa-summary__row--open",
5283
+ "aria-label": Z(c.openPiece, { name: a }),
5284
+ onClick: () => i(t),
5285
+ children: [o, /* @__PURE__ */ C("span", {
5286
+ className: "sfa-summary__chevron",
5287
+ "aria-hidden": "true",
5288
+ children: "›"
5289
+ })]
5290
+ }) }, e.id);
4957
5291
  })
4958
5292
  }),
4959
5293
  /* @__PURE__ */ C(q, { error: n }),
4960
5294
  /* @__PURE__ */ w("div", {
4961
- className: "sfa-piece__actions",
5295
+ className: "sfa-piece__foot",
4962
5296
  children: [/* @__PURE__ */ C("button", {
4963
5297
  type: "button",
4964
5298
  className: "sfa-btn",
4965
5299
  disabled: t,
4966
- onClick: i,
4967
- children: s.keepDrafts
4968
- }), c.length ? /* @__PURE__ */ C("button", {
5300
+ onClick: a,
5301
+ children: c.keepDrafts
5302
+ }), l.length ? /* @__PURE__ */ C("button", {
4969
5303
  type: "button",
4970
5304
  className: "sfa-btn sfa-btn--primary",
4971
5305
  disabled: t,
4972
- onClick: () => r(c, l),
4973
- children: J(s.publish, { count: c.length })
5306
+ onClick: () => r(l, u),
5307
+ children: J(c.publish, { count: l.length })
4974
5308
  }) : null]
4975
5309
  })
4976
5310
  ]
4977
5311
  });
4978
5312
  }
4979
5313
  // src/lib/fill-alts.ts
4980
- async function er(e, t, n) {
5314
+ async function pr(e, t, n) {
4981
5315
  let r = t.name.trim();
4982
5316
  if (!r) return t;
4983
5317
  let i = t, a = [...t.images].sort((e, t) => e.position - t.position);
@@ -4992,14 +5326,14 @@ async function er(e, t, n) {
4992
5326
  return i;
4993
5327
  }
4994
5328
  // src/views/products/finish-drafts/use-publish-pieces.ts
4995
- function tr() {
5329
+ function mr() {
4996
5330
  let e = I(), { labels: t } = F(), [n, r] = b(!1), [i, a] = b(void 0), [o, s] = b(null);
4997
5331
  return {
4998
5332
  publish: async (n, i) => {
4999
5333
  r(!0), a(void 0);
5000
5334
  let o = [], c = [...i];
5001
5335
  for (let r of n) try {
5002
- await er(e, r, t.products.flow.altFallback), o.push(await e.updateProduct(r.id, { status: "active" }));
5336
+ await pr(e, r, t.products.flow.altFallback), o.push(await e.updateProduct(r.id, { status: "active" }));
5003
5337
  } catch (e) {
5004
5338
  c.push(r), e instanceof u || a(e);
5005
5339
  }
@@ -5016,18 +5350,26 @@ function tr() {
5016
5350
  };
5017
5351
  }
5018
5352
  // src/views/products/finish-drafts/admin-finish-drafts.tsx
5019
- function nr({ initial: e, categories: t, onDone: n }) {
5020
- let { labels: r } = F(), i = r.products.stock, [a, o] = b(e), [s, c] = b(0), l = tr();
5353
+ function hr({ initial: e, categories: t, onDone: n }) {
5354
+ let { labels: r } = F(), i = r.products.stock, [a, o] = b(e), [s, c] = b(0), l = mr();
5021
5355
  if (l.outcome) {
5022
5356
  let { published: e, drafts: t } = l.outcome;
5023
5357
  return /* @__PURE__ */ w("section", {
5024
- className: "sfa-piece",
5358
+ className: "sfa-piece sfa-piece--celebrate",
5025
5359
  children: [
5026
- /* @__PURE__ */ C("h2", { children: J(i.summary.publishedTitle, { count: e.length }) }),
5360
+ /* @__PURE__ */ C("span", {
5361
+ className: "sfa-piece__badge",
5362
+ "aria-hidden": "true",
5363
+ children: "✓"
5364
+ }),
5365
+ /* @__PURE__ */ C("h2", {
5366
+ className: "sfa-piece__heading",
5367
+ children: J(i.summary.publishedTitle, { count: e.length })
5368
+ }),
5027
5369
  /* @__PURE__ */ C("p", { children: i.summary.publishedBody }),
5028
5370
  t.length ? /* @__PURE__ */ C("p", { children: J(i.summary.stillIncomplete, { count: t.length }) }) : null,
5029
5371
  /* @__PURE__ */ C("div", {
5030
- className: "sfa-piece__actions",
5372
+ className: "sfa-piece__actions sfa-piece__actions--center",
5031
5373
  children: /* @__PURE__ */ C("button", {
5032
5374
  type: "button",
5033
5375
  className: "sfa-btn sfa-btn--primary",
@@ -5038,16 +5380,17 @@ function nr({ initial: e, categories: t, onDone: n }) {
5038
5380
  ]
5039
5381
  });
5040
5382
  }
5041
- return s >= a.length ? /* @__PURE__ */ C($n, {
5383
+ return s >= a.length ? /* @__PURE__ */ C(fr, {
5042
5384
  pieces: a,
5043
5385
  pending: l.pending,
5044
5386
  failure: l.failure,
5045
5387
  onPublish: l.publish,
5388
+ onOpenPiece: c,
5046
5389
  onKeepDrafts: () => n({
5047
5390
  published: [],
5048
5391
  drafts: a
5049
5392
  })
5050
- }) : /* @__PURE__ */ C(Zn, {
5393
+ }) : /* @__PURE__ */ C(ur, {
5051
5394
  product: a[s],
5052
5395
  index: s,
5053
5396
  total: a.length,
@@ -5058,7 +5401,7 @@ function nr({ initial: e, categories: t, onDone: n }) {
5058
5401
  onBack: s > 0 ? () => c(s - 1) : void 0
5059
5402
  }, a[s].id);
5060
5403
  }
5061
- function rr({ productIds: e, categories: t, onDone: n }) {
5404
+ function gr({ productIds: e, categories: t, onDone: n }) {
5062
5405
  let r = I(), { labels: i } = F(), a = i.products.stock.queue, o = L(["finish-drafts", e ?? null], () => e ? Promise.all(e.map((e) => r.getProduct(e))) : r.listProducts({
5063
5406
  incomplete: "true",
5064
5407
  limit: 100
@@ -5076,7 +5419,7 @@ function rr({ productIds: e, categories: t, onDone: n }) {
5076
5419
  }),
5077
5420
  children: a.done
5078
5421
  })]
5079
- }) : /* @__PURE__ */ C(nr, {
5422
+ }) : /* @__PURE__ */ C(hr, {
5080
5423
  initial: o.data,
5081
5424
  categories: t,
5082
5425
  onDone: n
@@ -5086,6 +5429,6 @@ function rr({ productIds: e, categories: t, onDone: n }) {
5086
5429
  })]
5087
5430
  });
5088
5431
  }
5089
- export { Yn as AdminAddSeveral, Un as AdminDiscountEditor, Dn as AdminDiscountList, rr as AdminFinishDrafts, ue as AdminLayout, un as AdminOrderDetail, qt as AdminOrderList, V as AdminPageHeader, It as AdminProductEditor, jt as AdminProductFlow, Vt as AdminProductImages, Je as AdminProductList, Re as AdminProductSheet, ae as AdminProvider, ve as AdminSetupChecklist, xn as AdminShippingRates, H as AdminTable, G as ConfirmDialog, Ut as EmptyState, q as ErrorMessage, W as Money, K as Notice, an as OrderActions, U as StatusBadge, Ye as Switch, B as adminNavIcons, me as errorKey, X as formatMoneyInput, Y as parseMoneyInput, F as useAdmin, I as useAdminClient, R as useAdminMutation, L as useAdminQuery };
5432
+ export { cr as AdminAddSeveral, nr as AdminDiscountEditor, Bn as AdminDiscountList, gr as AdminFinishDrafts, me as AdminLayout, Sn as AdminOrderDetail, on as AdminOrderList, V as AdminPageHeader, Zt as AdminProductEditor, Kt as AdminProductFlow, tn as AdminProductImages, rt as AdminProductList, qe as AdminProductSheet, oe as AdminProvider, Te as AdminSetupChecklist, Pn as AdminShippingRates, H as AdminTable, G as ConfirmDialog, be as EmptyState, q as ErrorMessage, W as Money, K as Notice, _n as OrderActions, U as StatusBadge, it as Switch, B as adminNavIcons, ve as errorKey, X as formatMoneyInput, Y as parseMoneyInput, F as useAdmin, I as useAdminClient, R as useAdminMutation, L as useAdminQuery };
5090
5433
 
5091
5434
  //# sourceMappingURL=index.js.map