@medusajs/draft-order 2.10.2-preview-20250905060154 → 2.10.2-preview-20250905120200

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.
@@ -7573,12 +7573,12 @@ const addressSchema = objectType({
7573
7573
  first_name: stringType().min(1),
7574
7574
  last_name: stringType().min(1),
7575
7575
  address_1: stringType().min(1),
7576
- address_2: stringType().optional(),
7577
- company: stringType().optional(),
7576
+ address_2: stringType().nullish(),
7577
+ company: stringType().nullish(),
7578
7578
  city: stringType().min(1),
7579
- province: stringType().optional(),
7579
+ province: stringType().nullish(),
7580
7580
  postal_code: stringType().min(1),
7581
- phone: stringType().optional()
7581
+ phone: stringType().nullish()
7582
7582
  });
7583
7583
  const Create = () => {
7584
7584
  return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { children: /* @__PURE__ */ jsxRuntime.jsx(CreateForm, {}) });
@@ -8328,7 +8328,7 @@ const ActivitySection = ({ order, changes }) => {
8328
8328
  () => getActivityItems(order, changes),
8329
8329
  [order, changes]
8330
8330
  );
8331
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0 overflow-hidden", children: [
8331
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "overflow-hidden p-0", children: [
8332
8332
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Activity" }) }),
8333
8333
  /* @__PURE__ */ jsxRuntime.jsx(ActivityItemList, { items: activityItems })
8334
8334
  ] });
@@ -8359,8 +8359,8 @@ const CollapsibleActivityItemList = ({
8359
8359
  const [open, setOpen] = React.useState(false);
8360
8360
  return /* @__PURE__ */ jsxRuntime.jsxs(radixUi.Collapsible.Root, { open, onOpenChange: setOpen, children: [
8361
8361
  !open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[20px_1fr] items-start gap-2", children: [
8362
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-ui-border-strong w-px flex-1 bg-[linear-gradient(var(--border-strong)_33%,rgba(255,255,255,0)_0%)] bg-[length:1px_3px] bg-right bg-repeat-y bg-clip-content" }) }),
8363
- /* @__PURE__ */ jsxRuntime.jsx(radixUi.Collapsible.Trigger, { className: "text-left p-0 m-0 pb-4 text-ui-fg-muted hover:text-ui-fg-base focus:text-ui-fg-base outline-none transition-colors", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", weight: "plus", children: `Show ${items.length} more ${items.length === 1 ? "activity" : "activities"}` }) })
8362
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-ui-border-strong w-px flex-1 bg-[linear-gradient(var(--border-strong)_33%,rgba(255,255,255,0)_0%)] bg-[length:1px_3px] bg-clip-content bg-right bg-repeat-y" }) }),
8363
+ /* @__PURE__ */ jsxRuntime.jsx(radixUi.Collapsible.Trigger, { className: "text-ui-fg-muted hover:text-ui-fg-base focus:text-ui-fg-base m-0 p-0 pb-4 text-left outline-none transition-colors", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", weight: "plus", children: `Show ${items.length} more ${items.length === 1 ? "activity" : "activities"}` }) })
8364
8364
  ] }),
8365
8365
  /* @__PURE__ */ jsxRuntime.jsx(radixUi.Collapsible.Content, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-0.5", children: items.map((item, idx) => {
8366
8366
  return /* @__PURE__ */ jsxRuntime.jsx(ActivityItem, { item }, idx);
@@ -8378,14 +8378,14 @@ const ActivityItem = ({ item, isFirst = false }) => {
8378
8378
  return /* @__PURE__ */ jsxRuntime.jsxs(
8379
8379
  "div",
8380
8380
  {
8381
- className: ui.clx("grid grid-cols-[20px_1fr] items-start gap-x-2 w-full"),
8381
+ className: ui.clx("grid w-full grid-cols-[20px_1fr] items-start gap-x-2"),
8382
8382
  children: [
8383
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-0.5 h-full", children: [
8384
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-5 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-2.5 rounded-full shadow-borders-base flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-1.5 rounded-full bg-ui-tag-neutral-icon" }) }) }),
8385
- !isFirst && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-px bg-ui-border-base" }) })
8383
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col items-center gap-0.5", children: [
8384
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shadow-borders-base flex size-2.5 items-center justify-center rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-tag-neutral-icon size-1.5 rounded-full" }) }) }),
8385
+ !isFirst && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-border-base h-full w-px" }) })
8386
8386
  ] }),
8387
8387
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.clx("flex flex-col", !isFirst && "pb-4"), children: [
8388
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2 justify-between", children: [
8388
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
8389
8389
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: item.label }),
8390
8390
  /* @__PURE__ */ jsxRuntime.jsx(
8391
8391
  ui.Tooltip,
@@ -8396,7 +8396,7 @@ const ActivityItem = ({ item, isFirst = false }) => {
8396
8396
  )
8397
8397
  ] }),
8398
8398
  item.content && renderContent(item.content),
8399
- item.userId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-2 text-ui-fg-muted", children: isUserLoaded ? /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/settings/users/${user.id}`, className: "w-fit", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-1.5 w-fit", children: [
8399
+ item.userId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-muted pt-2", children: isUserLoaded ? /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/settings/users/${user.id}`, className: "w-fit", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-fit items-center gap-x-1.5", children: [
8400
8400
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "By" }),
8401
8401
  /* @__PURE__ */ jsxRuntime.jsx(
8402
8402
  ui.Avatar,
@@ -8412,8 +8412,8 @@ const ActivityItem = ({ item, isFirst = false }) => {
8412
8412
  ] })
8413
8413
  ] }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-1.5", children: [
8414
8414
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "By" }),
8415
- /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "rounded-full w-5 h-5" }),
8416
- /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "w-[75px] h-4" })
8415
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-5 w-5 rounded-full" }),
8416
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-4 w-[75px]" })
8417
8417
  ] }) })
8418
8418
  ] })
8419
8419
  ]
@@ -8436,7 +8436,12 @@ function getEditActivityItems(change) {
8436
8436
  promotionsAdded: 0,
8437
8437
  promotionsRemoved: 0
8438
8438
  };
8439
- for (const action of change.actions) {
8439
+ const orderedActions = change.actions.sort((a, b) => {
8440
+ return a.ordering - b.ordering;
8441
+ });
8442
+ const addedPromotionMap = /* @__PURE__ */ new Map();
8443
+ const removedPromotionMap = /* @__PURE__ */ new Map();
8444
+ for (const action of orderedActions) {
8440
8445
  if (!action.details) {
8441
8446
  continue;
8442
8447
  }
@@ -8454,13 +8459,21 @@ function getEditActivityItems(change) {
8454
8459
  case "SHIPPING_REMOVE":
8455
8460
  counts.shippingMethodsRemoved += 1;
8456
8461
  break;
8457
- case "PROMOTION_ADD":
8458
- counts.promotionsAdded += 1;
8462
+ case "PROMOTION_ADD": {
8463
+ addedPromotionMap.set(action.reference_id, true);
8459
8464
  break;
8460
- case "PROMOTION_REMOVE":
8461
- counts.promotionsRemoved += 1;
8465
+ }
8466
+ case "PROMOTION_REMOVE": {
8467
+ if (addedPromotionMap.has(action.reference_id)) {
8468
+ addedPromotionMap.delete(action.reference_id);
8469
+ } else {
8470
+ removedPromotionMap.set(action.reference_id, true);
8471
+ }
8462
8472
  break;
8473
+ }
8463
8474
  }
8475
+ counts.promotionsAdded = addedPromotionMap.size;
8476
+ counts.promotionsRemoved = removedPromotionMap.size;
8464
8477
  }
8465
8478
  const createActivityItem = (type, added, removed) => {
8466
8479
  if (added === 0 && removed === 0) return;
@@ -9560,6 +9573,217 @@ const ID = () => {
9560
9573
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9561
9574
  ] });
9562
9575
  };
9576
+ const BillingAddress = () => {
9577
+ const { id } = reactRouterDom.useParams();
9578
+ const { order, isPending, isError, error } = useOrder(id, {
9579
+ fields: "+billing_address"
9580
+ });
9581
+ if (isError) {
9582
+ throw error;
9583
+ }
9584
+ const isReady = !isPending && !!order;
9585
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9586
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9587
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
9588
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9589
+ ] }),
9590
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9591
+ ] });
9592
+ };
9593
+ const BillingAddressForm = ({ order }) => {
9594
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9595
+ const form = reactHookForm.useForm({
9596
+ defaultValues: {
9597
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9598
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9599
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9600
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9601
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9602
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9603
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9604
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9605
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9606
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9607
+ },
9608
+ resolver: zod.zodResolver(schema$5)
9609
+ });
9610
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9611
+ const { handleSuccess } = useRouteModal();
9612
+ const onSubmit = form.handleSubmit(async (data) => {
9613
+ await mutateAsync(
9614
+ { billing_address: data },
9615
+ {
9616
+ onSuccess: () => {
9617
+ handleSuccess();
9618
+ },
9619
+ onError: (error) => {
9620
+ ui.toast.error(error.message);
9621
+ }
9622
+ }
9623
+ );
9624
+ });
9625
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9626
+ KeyboundForm,
9627
+ {
9628
+ className: "flex flex-1 flex-col overflow-hidden",
9629
+ onSubmit,
9630
+ children: [
9631
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
9632
+ /* @__PURE__ */ jsxRuntime.jsx(
9633
+ Form$2.Field,
9634
+ {
9635
+ control: form.control,
9636
+ name: "country_code",
9637
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9638
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
9639
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
9640
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9641
+ ] })
9642
+ }
9643
+ ),
9644
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9645
+ /* @__PURE__ */ jsxRuntime.jsx(
9646
+ Form$2.Field,
9647
+ {
9648
+ control: form.control,
9649
+ name: "first_name",
9650
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9651
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
9652
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9653
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9654
+ ] })
9655
+ }
9656
+ ),
9657
+ /* @__PURE__ */ jsxRuntime.jsx(
9658
+ Form$2.Field,
9659
+ {
9660
+ control: form.control,
9661
+ name: "last_name",
9662
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9663
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
9664
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9665
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9666
+ ] })
9667
+ }
9668
+ )
9669
+ ] }),
9670
+ /* @__PURE__ */ jsxRuntime.jsx(
9671
+ Form$2.Field,
9672
+ {
9673
+ control: form.control,
9674
+ name: "company",
9675
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9676
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
9677
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9678
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9679
+ ] })
9680
+ }
9681
+ ),
9682
+ /* @__PURE__ */ jsxRuntime.jsx(
9683
+ Form$2.Field,
9684
+ {
9685
+ control: form.control,
9686
+ name: "address_1",
9687
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9688
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
9689
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9690
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9691
+ ] })
9692
+ }
9693
+ ),
9694
+ /* @__PURE__ */ jsxRuntime.jsx(
9695
+ Form$2.Field,
9696
+ {
9697
+ control: form.control,
9698
+ name: "address_2",
9699
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9700
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9701
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9702
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9703
+ ] })
9704
+ }
9705
+ ),
9706
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9707
+ /* @__PURE__ */ jsxRuntime.jsx(
9708
+ Form$2.Field,
9709
+ {
9710
+ control: form.control,
9711
+ name: "postal_code",
9712
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9713
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
9714
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9715
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9716
+ ] })
9717
+ }
9718
+ ),
9719
+ /* @__PURE__ */ jsxRuntime.jsx(
9720
+ Form$2.Field,
9721
+ {
9722
+ control: form.control,
9723
+ name: "city",
9724
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9725
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
9726
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9727
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9728
+ ] })
9729
+ }
9730
+ )
9731
+ ] }),
9732
+ /* @__PURE__ */ jsxRuntime.jsx(
9733
+ Form$2.Field,
9734
+ {
9735
+ control: form.control,
9736
+ name: "province",
9737
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9738
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9739
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9740
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9741
+ ] })
9742
+ }
9743
+ ),
9744
+ /* @__PURE__ */ jsxRuntime.jsx(
9745
+ Form$2.Field,
9746
+ {
9747
+ control: form.control,
9748
+ name: "phone",
9749
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9750
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
9751
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9752
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9753
+ ] })
9754
+ }
9755
+ )
9756
+ ] }) }),
9757
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9758
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9759
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9760
+ ] }) })
9761
+ ]
9762
+ }
9763
+ ) });
9764
+ };
9765
+ const schema$5 = addressSchema;
9766
+ const CustomItems = () => {
9767
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9768
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9769
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9770
+ ] });
9771
+ };
9772
+ const CustomItemsForm = () => {
9773
+ const form = reactHookForm.useForm({
9774
+ resolver: zod.zodResolver(schema$4)
9775
+ });
9776
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9777
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9778
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9779
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9780
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9781
+ ] }) })
9782
+ ] }) });
9783
+ };
9784
+ const schema$4 = objectType({
9785
+ email: stringType().email()
9786
+ });
9563
9787
  const Email = () => {
9564
9788
  const { id } = reactRouterDom.useParams();
9565
9789
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9582,7 +9806,7 @@ const EmailForm = ({ order }) => {
9582
9806
  defaultValues: {
9583
9807
  email: order.email ?? ""
9584
9808
  },
9585
- resolver: zod.zodResolver(schema$5)
9809
+ resolver: zod.zodResolver(schema$3)
9586
9810
  });
9587
9811
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9588
9812
  const { handleSuccess } = useRouteModal();
@@ -9625,7 +9849,7 @@ const EmailForm = ({ order }) => {
9625
9849
  }
9626
9850
  ) });
9627
9851
  };
9628
- const schema$5 = objectType({
9852
+ const schema$3 = objectType({
9629
9853
  email: stringType().email()
9630
9854
  });
9631
9855
  const NumberInput = React.forwardRef(
@@ -9911,7 +10135,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
9911
10135
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-6 py-16", children: [
9912
10136
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
9913
10137
  /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Items" }) }),
9914
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Edit the items in the draft order." }) })
10138
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Edit the items in the draft order" }) })
9915
10139
  ] }),
9916
10140
  /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
9917
10141
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-6", children: [
@@ -9952,13 +10176,13 @@ const ItemsForm = ({ preview, currencyCode }) => {
9952
10176
  ] })
9953
10177
  ] }),
9954
10178
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest rounded-xl", children: [
9955
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-[5px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[1fr_1fr_1fr_28px] gap-3 px-4 py-2 text-ui-fg-muted", children: [
10179
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-[5px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-muted grid grid-cols-[2fr_1fr_2fr_28px] gap-3 px-4 py-2", children: [
9956
10180
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Item" }) }),
9957
10181
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Quantity" }) }),
9958
10182
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Price" }) }),
9959
10183
  /* @__PURE__ */ jsxRuntime.jsx("div", {})
9960
10184
  ] }) }),
9961
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: itemCount <= 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-x-3 bg-ui-bg-base rounded-lg p-4 shadow-elevation-card-rest flex-col gap-1", children: [
10185
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: itemCount <= 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest flex flex-col items-center justify-center gap-1 gap-x-3 rounded-lg p-4", children: [
9962
10186
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: "There are no items in this order" }),
9963
10187
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Add items to the order to get started." })
9964
10188
  ] }) : matches.length > 0 ? matches == null ? void 0 : matches.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -9969,7 +10193,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
9969
10193
  currencyCode
9970
10194
  },
9971
10195
  item.id
9972
- )) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-x-3 bg-ui-bg-base rounded-lg p-4 shadow-elevation-card-rest flex-col gap-1", children: [
10196
+ )) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest flex flex-col items-center justify-center gap-1 gap-x-3 rounded-lg p-4", children: [
9973
10197
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: "No items found" }),
9974
10198
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: [
9975
10199
  'No items found for "',
@@ -10008,7 +10232,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
10008
10232
  ]
10009
10233
  }
10010
10234
  ) }),
10011
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2 justify-end", children: [
10235
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10012
10236
  /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10013
10237
  /* @__PURE__ */ jsxRuntime.jsx(
10014
10238
  ui.Button,
@@ -10084,8 +10308,8 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10084
10308
  }
10085
10309
  );
10086
10310
  });
10087
- return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_28px] gap-3 px-4 py-2 bg-ui-bg-base shadow-elevation-card-rest rounded-lg items-center", children: [
10088
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3 w-full", children: [
10311
+ return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,2fr)_28px] items-center gap-3 rounded-lg px-4 py-2", children: [
10312
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-x-3", children: [
10089
10313
  /* @__PURE__ */ jsxRuntime.jsx(
10090
10314
  Thumbnail,
10091
10315
  {
@@ -10121,7 +10345,7 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10121
10345
  )
10122
10346
  ] })
10123
10347
  ] }),
10124
- editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
10348
+ editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
10125
10349
  Form$2.Field,
10126
10350
  {
10127
10351
  control: form.control,
@@ -10130,8 +10354,8 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10130
10354
  return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(NumberInput, { ...field }) }) });
10131
10355
  }
10132
10356
  }
10133
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: item.quantity }) }),
10134
- editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
10357
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: item.quantity }) }),
10358
+ editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
10135
10359
  Form$2.Field,
10136
10360
  {
10137
10361
  control: form.control,
@@ -10148,7 +10372,7 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10148
10372
  ) }) });
10149
10373
  }
10150
10374
  }
10151
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-end w-full", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10375
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-1 items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10152
10376
  /* @__PURE__ */ jsxRuntime.jsx(
10153
10377
  ui.IconButton,
10154
10378
  {
@@ -10243,7 +10467,7 @@ const CustomItem = ({ item, preview, currencyCode }) => {
10243
10467
  }
10244
10468
  );
10245
10469
  });
10246
- return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_28px] gap-3 px-4 py-2 bg-ui-bg-base shadow-elevation-card-rest rounded-lg items-center", children: [
10470
+ return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,2fr)_28px] items-center gap-3 rounded-lg px-4 py-2", children: [
10247
10471
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3", children: [
10248
10472
  /* @__PURE__ */ jsxRuntime.jsx(
10249
10473
  Thumbnail,
@@ -10290,7 +10514,7 @@ const CustomItem = ({ item, preview, currencyCode }) => {
10290
10514
  ) }) });
10291
10515
  }
10292
10516
  }
10293
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10517
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10294
10518
  /* @__PURE__ */ jsxRuntime.jsx(
10295
10519
  ui.IconButton,
10296
10520
  {
@@ -10415,7 +10639,7 @@ const ExistingItemsForm = ({ orderId, items }) => {
10415
10639
  autoFocusSearch: true
10416
10640
  }
10417
10641
  ) }),
10418
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2 justify-end", children: [
10642
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10419
10643
  /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10420
10644
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "button", onClick: onSubmit, children: "Update items" })
10421
10645
  ] }) })
@@ -10583,15 +10807,15 @@ const CustomItemForm = ({ orderId, currencyCode }) => {
10583
10807
  /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Quantity" }),
10584
10808
  /* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Enter the quantity of the item" })
10585
10809
  ] }),
10586
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 w-full", children: [
10587
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(NumberInput, { ...field, className: "w-full" }) }) }),
10810
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex-1", children: [
10811
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(NumberInput, { ...field, className: "w-full" }) }) }),
10588
10812
  /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10589
10813
  ] })
10590
10814
  ] }) })
10591
10815
  }
10592
10816
  )
10593
10817
  ] }) }) }),
10594
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2 justify-end", children: [
10818
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10595
10819
  /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10596
10820
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
10597
10821
  ] }) })
@@ -10996,22 +11220,22 @@ const PromotionForm = ({ preview }) => {
10996
11220
  const [comboboxValue, setComboboxValue] = React.useState("");
10997
11221
  const { handleSuccess } = useRouteModal();
10998
11222
  const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
10999
- const promoCodes = getPromotionCodes(items, shipping_methods);
11223
+ const promoIds = getPromotionIds(items, shipping_methods);
11000
11224
  const { promotions, isPending, isError, error } = usePromotions(
11001
11225
  {
11002
- code: promoCodes
11226
+ id: promoIds
11003
11227
  },
11004
11228
  {
11005
- enabled: !!promoCodes.length
11229
+ enabled: !!promoIds.length
11006
11230
  }
11007
11231
  );
11008
11232
  const comboboxData = useComboboxData({
11009
- queryKey: ["promotions", "combobox", promoCodes],
11233
+ queryKey: ["promotions", "combobox", promoIds],
11010
11234
  queryFn: async (params) => {
11011
11235
  return await sdk.admin.promotion.list({
11012
11236
  ...params,
11013
- code: {
11014
- $nin: promoCodes
11237
+ id: {
11238
+ $nin: promoIds
11015
11239
  }
11016
11240
  });
11017
11241
  },
@@ -11147,7 +11371,7 @@ const PromotionItem = ({
11147
11371
  "div",
11148
11372
  {
11149
11373
  className: ui.clx(
11150
- "px-3 py-2 rounded-lg bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between",
11374
+ "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
11151
11375
  {
11152
11376
  "animate-pulse": isLoading
11153
11377
  }
@@ -11155,7 +11379,7 @@ const PromotionItem = ({
11155
11379
  children: [
11156
11380
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11157
11381
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
11158
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 text-ui-fg-subtle", children: [
11382
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
11159
11383
  displayValue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
11160
11384
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: displayValue }),
11161
11385
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: "·" })
@@ -11207,13 +11431,13 @@ const formatPercentage = (value, isPercentageValue = false) => {
11207
11431
  }
11208
11432
  return formatter.format(val);
11209
11433
  };
11210
- function getPromotionCodes(items, shippingMethods) {
11211
- const codes = /* @__PURE__ */ new Set();
11434
+ function getPromotionIds(items, shippingMethods) {
11435
+ const promotionIds = /* @__PURE__ */ new Set();
11212
11436
  for (const item of items) {
11213
11437
  if (item.adjustments) {
11214
11438
  for (const adjustment of item.adjustments) {
11215
- if (adjustment.code) {
11216
- codes.add(adjustment.code);
11439
+ if (adjustment.promotion_id) {
11440
+ promotionIds.add(adjustment.promotion_id);
11217
11441
  }
11218
11442
  }
11219
11443
  }
@@ -11221,135 +11445,29 @@ function getPromotionCodes(items, shippingMethods) {
11221
11445
  for (const shippingMethod of shippingMethods) {
11222
11446
  if (shippingMethod.adjustments) {
11223
11447
  for (const adjustment of shippingMethod.adjustments) {
11224
- if (adjustment.code) {
11225
- codes.add(adjustment.code);
11448
+ if (adjustment.promotion_id) {
11449
+ promotionIds.add(adjustment.promotion_id);
11226
11450
  }
11227
11451
  }
11228
11452
  }
11229
11453
  }
11230
- return Array.from(codes);
11454
+ return Array.from(promotionIds);
11231
11455
  }
11232
- const SalesChannel = () => {
11456
+ const STACKED_FOCUS_MODAL_ID = "shipping-form";
11457
+ const Shipping = () => {
11458
+ var _a;
11233
11459
  const { id } = reactRouterDom.useParams();
11234
- const { draft_order, isPending, isError, error } = useDraftOrder(
11235
- id,
11236
- {
11237
- fields: "+sales_channel_id"
11238
- },
11239
- {
11240
- enabled: !!id
11241
- }
11242
- );
11243
- if (isError) {
11244
- throw error;
11245
- }
11246
- const ISrEADY = !!draft_order && !isPending;
11247
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11248
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11249
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
11250
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
11251
- ] }),
11252
- ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
11253
- ] });
11254
- };
11255
- const SalesChannelForm = ({ order }) => {
11256
- const form = reactHookForm.useForm({
11257
- defaultValues: {
11258
- sales_channel_id: order.sales_channel_id || ""
11259
- },
11260
- resolver: zod.zodResolver(schema$4)
11261
- });
11262
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11263
- const { handleSuccess } = useRouteModal();
11264
- const onSubmit = form.handleSubmit(async (data) => {
11265
- await mutateAsync(
11266
- {
11267
- sales_channel_id: data.sales_channel_id
11268
- },
11269
- {
11270
- onSuccess: () => {
11271
- ui.toast.success("Sales channel updated");
11272
- handleSuccess();
11273
- },
11274
- onError: (error) => {
11275
- ui.toast.error(error.message);
11276
- }
11277
- }
11278
- );
11279
- });
11280
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11281
- KeyboundForm,
11282
- {
11283
- className: "flex flex-1 flex-col overflow-hidden",
11284
- onSubmit,
11285
- children: [
11286
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
11287
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11288
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11289
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11290
- ] }) })
11291
- ]
11292
- }
11293
- ) });
11294
- };
11295
- const SalesChannelField = ({ control, order }) => {
11296
- const salesChannels = useComboboxData({
11297
- queryFn: async (params) => {
11298
- return await sdk.admin.salesChannel.list(params);
11299
- },
11300
- queryKey: ["sales-channels"],
11301
- getOptions: (data) => {
11302
- return data.sales_channels.map((salesChannel) => ({
11303
- label: salesChannel.name,
11304
- value: salesChannel.id
11305
- }));
11306
- },
11307
- defaultValue: order.sales_channel_id || void 0
11308
- });
11309
- return /* @__PURE__ */ jsxRuntime.jsx(
11310
- Form$2.Field,
11311
- {
11312
- control,
11313
- name: "sales_channel_id",
11314
- render: ({ field }) => {
11315
- return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11316
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
11317
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
11318
- Combobox,
11319
- {
11320
- options: salesChannels.options,
11321
- fetchNextPage: salesChannels.fetchNextPage,
11322
- isFetchingNextPage: salesChannels.isFetchingNextPage,
11323
- searchValue: salesChannels.searchValue,
11324
- onSearchValueChange: salesChannels.onSearchValueChange,
11325
- placeholder: "Select sales channel",
11326
- ...field
11327
- }
11328
- ) }),
11329
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11330
- ] });
11331
- }
11332
- }
11333
- );
11334
- };
11335
- const schema$4 = objectType({
11336
- sales_channel_id: stringType().min(1)
11337
- });
11338
- const STACKED_FOCUS_MODAL_ID = "shipping-form";
11339
- const Shipping = () => {
11340
- var _a;
11341
- const { id } = reactRouterDom.useParams();
11342
- const { order, isPending, isError, error } = useOrder(id, {
11343
- fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11344
- });
11345
- const {
11346
- order: preview,
11347
- isPending: isPreviewPending,
11348
- isError: isPreviewError,
11349
- error: previewError
11350
- } = useOrderPreview(id);
11351
- useInitiateOrderEdit({ preview });
11352
- const { onCancel } = useCancelOrderEdit({ preview });
11460
+ const { order, isPending, isError, error } = useOrder(id, {
11461
+ fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11462
+ });
11463
+ const {
11464
+ order: preview,
11465
+ isPending: isPreviewPending,
11466
+ isError: isPreviewError,
11467
+ error: previewError
11468
+ } = useOrderPreview(id);
11469
+ useInitiateOrderEdit({ preview });
11470
+ const { onCancel } = useCancelOrderEdit({ preview });
11353
11471
  if (isError) {
11354
11472
  throw error;
11355
11473
  }
@@ -12142,6 +12260,112 @@ const CustomAmountField = ({
12142
12260
  }
12143
12261
  );
12144
12262
  };
12263
+ const SalesChannel = () => {
12264
+ const { id } = reactRouterDom.useParams();
12265
+ const { draft_order, isPending, isError, error } = useDraftOrder(
12266
+ id,
12267
+ {
12268
+ fields: "+sales_channel_id"
12269
+ },
12270
+ {
12271
+ enabled: !!id
12272
+ }
12273
+ );
12274
+ if (isError) {
12275
+ throw error;
12276
+ }
12277
+ const ISrEADY = !!draft_order && !isPending;
12278
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12279
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12280
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
12281
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
12282
+ ] }),
12283
+ ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
12284
+ ] });
12285
+ };
12286
+ const SalesChannelForm = ({ order }) => {
12287
+ const form = reactHookForm.useForm({
12288
+ defaultValues: {
12289
+ sales_channel_id: order.sales_channel_id || ""
12290
+ },
12291
+ resolver: zod.zodResolver(schema$2)
12292
+ });
12293
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12294
+ const { handleSuccess } = useRouteModal();
12295
+ const onSubmit = form.handleSubmit(async (data) => {
12296
+ await mutateAsync(
12297
+ {
12298
+ sales_channel_id: data.sales_channel_id
12299
+ },
12300
+ {
12301
+ onSuccess: () => {
12302
+ ui.toast.success("Sales channel updated");
12303
+ handleSuccess();
12304
+ },
12305
+ onError: (error) => {
12306
+ ui.toast.error(error.message);
12307
+ }
12308
+ }
12309
+ );
12310
+ });
12311
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12312
+ KeyboundForm,
12313
+ {
12314
+ className: "flex flex-1 flex-col overflow-hidden",
12315
+ onSubmit,
12316
+ children: [
12317
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
12318
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12319
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12320
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12321
+ ] }) })
12322
+ ]
12323
+ }
12324
+ ) });
12325
+ };
12326
+ const SalesChannelField = ({ control, order }) => {
12327
+ const salesChannels = useComboboxData({
12328
+ queryFn: async (params) => {
12329
+ return await sdk.admin.salesChannel.list(params);
12330
+ },
12331
+ queryKey: ["sales-channels"],
12332
+ getOptions: (data) => {
12333
+ return data.sales_channels.map((salesChannel) => ({
12334
+ label: salesChannel.name,
12335
+ value: salesChannel.id
12336
+ }));
12337
+ },
12338
+ defaultValue: order.sales_channel_id || void 0
12339
+ });
12340
+ return /* @__PURE__ */ jsxRuntime.jsx(
12341
+ Form$2.Field,
12342
+ {
12343
+ control,
12344
+ name: "sales_channel_id",
12345
+ render: ({ field }) => {
12346
+ return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12347
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
12348
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12349
+ Combobox,
12350
+ {
12351
+ options: salesChannels.options,
12352
+ fetchNextPage: salesChannels.fetchNextPage,
12353
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
12354
+ searchValue: salesChannels.searchValue,
12355
+ onSearchValueChange: salesChannels.onSearchValueChange,
12356
+ placeholder: "Select sales channel",
12357
+ ...field
12358
+ }
12359
+ ) }),
12360
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12361
+ ] });
12362
+ }
12363
+ }
12364
+ );
12365
+ };
12366
+ const schema$2 = objectType({
12367
+ sales_channel_id: stringType().min(1)
12368
+ });
12145
12369
  const ShippingAddress = () => {
12146
12370
  const { id } = reactRouterDom.useParams();
12147
12371
  const { order, isPending, isError, error } = useOrder(id, {
@@ -12174,7 +12398,7 @@ const ShippingAddressForm = ({ order }) => {
12174
12398
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12175
12399
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12176
12400
  },
12177
- resolver: zod.zodResolver(schema$3)
12401
+ resolver: zod.zodResolver(schema$1)
12178
12402
  });
12179
12403
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12180
12404
  const { handleSuccess } = useRouteModal();
@@ -12344,7 +12568,7 @@ const ShippingAddressForm = ({ order }) => {
12344
12568
  }
12345
12569
  ) });
12346
12570
  };
12347
- const schema$3 = addressSchema;
12571
+ const schema$1 = addressSchema;
12348
12572
  const TransferOwnership = () => {
12349
12573
  const { id } = reactRouterDom.useParams();
12350
12574
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12368,7 +12592,7 @@ const TransferOwnershipForm = ({ order }) => {
12368
12592
  defaultValues: {
12369
12593
  customer_id: order.customer_id || ""
12370
12594
  },
12371
- resolver: zod.zodResolver(schema$2)
12595
+ resolver: zod.zodResolver(schema)
12372
12596
  });
12373
12597
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12374
12598
  const { handleSuccess } = useRouteModal();
@@ -12818,220 +13042,9 @@ const Illustration = () => {
12818
13042
  }
12819
13043
  );
12820
13044
  };
12821
- const schema$2 = objectType({
13045
+ const schema = objectType({
12822
13046
  customer_id: stringType().min(1)
12823
13047
  });
12824
- const CustomItems = () => {
12825
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12826
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
12827
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
12828
- ] });
12829
- };
12830
- const CustomItemsForm = () => {
12831
- const form = reactHookForm.useForm({
12832
- resolver: zod.zodResolver(schema$1)
12833
- });
12834
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
12835
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
12836
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12837
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12838
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
12839
- ] }) })
12840
- ] }) });
12841
- };
12842
- const schema$1 = objectType({
12843
- email: stringType().email()
12844
- });
12845
- const BillingAddress = () => {
12846
- const { id } = reactRouterDom.useParams();
12847
- const { order, isPending, isError, error } = useOrder(id, {
12848
- fields: "+billing_address"
12849
- });
12850
- if (isError) {
12851
- throw error;
12852
- }
12853
- const isReady = !isPending && !!order;
12854
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12855
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12856
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
12857
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12858
- ] }),
12859
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
12860
- ] });
12861
- };
12862
- const BillingAddressForm = ({ order }) => {
12863
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12864
- const form = reactHookForm.useForm({
12865
- defaultValues: {
12866
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12867
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12868
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12869
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12870
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12871
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12872
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12873
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12874
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12875
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12876
- },
12877
- resolver: zod.zodResolver(schema)
12878
- });
12879
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12880
- const { handleSuccess } = useRouteModal();
12881
- const onSubmit = form.handleSubmit(async (data) => {
12882
- await mutateAsync(
12883
- { billing_address: data },
12884
- {
12885
- onSuccess: () => {
12886
- handleSuccess();
12887
- },
12888
- onError: (error) => {
12889
- ui.toast.error(error.message);
12890
- }
12891
- }
12892
- );
12893
- });
12894
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12895
- KeyboundForm,
12896
- {
12897
- className: "flex flex-1 flex-col overflow-hidden",
12898
- onSubmit,
12899
- children: [
12900
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
12901
- /* @__PURE__ */ jsxRuntime.jsx(
12902
- Form$2.Field,
12903
- {
12904
- control: form.control,
12905
- name: "country_code",
12906
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12907
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12908
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12909
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12910
- ] })
12911
- }
12912
- ),
12913
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12914
- /* @__PURE__ */ jsxRuntime.jsx(
12915
- Form$2.Field,
12916
- {
12917
- control: form.control,
12918
- name: "first_name",
12919
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12920
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12921
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12922
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12923
- ] })
12924
- }
12925
- ),
12926
- /* @__PURE__ */ jsxRuntime.jsx(
12927
- Form$2.Field,
12928
- {
12929
- control: form.control,
12930
- name: "last_name",
12931
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12932
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12933
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12934
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12935
- ] })
12936
- }
12937
- )
12938
- ] }),
12939
- /* @__PURE__ */ jsxRuntime.jsx(
12940
- Form$2.Field,
12941
- {
12942
- control: form.control,
12943
- name: "company",
12944
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12945
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12946
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12947
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12948
- ] })
12949
- }
12950
- ),
12951
- /* @__PURE__ */ jsxRuntime.jsx(
12952
- Form$2.Field,
12953
- {
12954
- control: form.control,
12955
- name: "address_1",
12956
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12957
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12958
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12959
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12960
- ] })
12961
- }
12962
- ),
12963
- /* @__PURE__ */ jsxRuntime.jsx(
12964
- Form$2.Field,
12965
- {
12966
- control: form.control,
12967
- name: "address_2",
12968
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12969
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12970
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12971
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12972
- ] })
12973
- }
12974
- ),
12975
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12976
- /* @__PURE__ */ jsxRuntime.jsx(
12977
- Form$2.Field,
12978
- {
12979
- control: form.control,
12980
- name: "postal_code",
12981
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12982
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12983
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12984
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12985
- ] })
12986
- }
12987
- ),
12988
- /* @__PURE__ */ jsxRuntime.jsx(
12989
- Form$2.Field,
12990
- {
12991
- control: form.control,
12992
- name: "city",
12993
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12994
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12995
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12996
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12997
- ] })
12998
- }
12999
- )
13000
- ] }),
13001
- /* @__PURE__ */ jsxRuntime.jsx(
13002
- Form$2.Field,
13003
- {
13004
- control: form.control,
13005
- name: "province",
13006
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13007
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13008
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13009
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13010
- ] })
13011
- }
13012
- ),
13013
- /* @__PURE__ */ jsxRuntime.jsx(
13014
- Form$2.Field,
13015
- {
13016
- control: form.control,
13017
- name: "phone",
13018
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13019
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13020
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13021
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13022
- ] })
13023
- }
13024
- )
13025
- ] }) }),
13026
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13027
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13028
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13029
- ] }) })
13030
- ]
13031
- }
13032
- ) });
13033
- };
13034
- const schema = addressSchema;
13035
13048
  const widgetModule = { widgets: [] };
13036
13049
  const routeModule = {
13037
13050
  routes: [
@@ -13052,6 +13065,14 @@ const routeModule = {
13052
13065
  handle,
13053
13066
  loader,
13054
13067
  children: [
13068
+ {
13069
+ Component: BillingAddress,
13070
+ path: "/draft-orders/:id/billing-address"
13071
+ },
13072
+ {
13073
+ Component: CustomItems,
13074
+ path: "/draft-orders/:id/custom-items"
13075
+ },
13055
13076
  {
13056
13077
  Component: Email,
13057
13078
  path: "/draft-orders/:id/email"
@@ -13068,14 +13089,14 @@ const routeModule = {
13068
13089
  Component: Promotions,
13069
13090
  path: "/draft-orders/:id/promotions"
13070
13091
  },
13071
- {
13072
- Component: SalesChannel,
13073
- path: "/draft-orders/:id/sales-channel"
13074
- },
13075
13092
  {
13076
13093
  Component: Shipping,
13077
13094
  path: "/draft-orders/:id/shipping"
13078
13095
  },
13096
+ {
13097
+ Component: SalesChannel,
13098
+ path: "/draft-orders/:id/sales-channel"
13099
+ },
13079
13100
  {
13080
13101
  Component: ShippingAddress,
13081
13102
  path: "/draft-orders/:id/shipping-address"
@@ -13083,14 +13104,6 @@ const routeModule = {
13083
13104
  {
13084
13105
  Component: TransferOwnership,
13085
13106
  path: "/draft-orders/:id/transfer-ownership"
13086
- },
13087
- {
13088
- Component: CustomItems,
13089
- path: "/draft-orders/:id/custom-items"
13090
- },
13091
- {
13092
- Component: BillingAddress,
13093
- path: "/draft-orders/:id/billing-address"
13094
13107
  }
13095
13108
  ]
13096
13109
  }