@medusajs/draft-order 2.10.4-snapshot-20251006181454 → 2.10.4-snapshot-20251007081528

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.
@@ -9588,10 +9588,10 @@ const CustomItemsForm = () => {
9588
9588
  const schema$5 = objectType({
9589
9589
  email: stringType().email()
9590
9590
  });
9591
- const BillingAddress = () => {
9591
+ const Email = () => {
9592
9592
  const { id } = useParams();
9593
9593
  const { order, isPending, isError, error } = useOrder(id, {
9594
- fields: "+billing_address"
9594
+ fields: "+email"
9595
9595
  });
9596
9596
  if (isError) {
9597
9597
  throw error;
@@ -9599,26 +9599,16 @@ const BillingAddress = () => {
9599
9599
  const isReady = !isPending && !!order;
9600
9600
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9601
9601
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9602
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9603
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9602
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9603
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9604
9604
  ] }),
9605
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9605
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9606
9606
  ] });
9607
9607
  };
9608
- const BillingAddressForm = ({ order }) => {
9609
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9608
+ const EmailForm = ({ order }) => {
9610
9609
  const form = useForm({
9611
9610
  defaultValues: {
9612
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9613
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9614
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9615
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9616
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9617
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9618
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9619
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9620
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9621
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9611
+ email: order.email ?? ""
9622
9612
  },
9623
9613
  resolver: zodResolver(schema$4)
9624
9614
  });
@@ -9626,7 +9616,7 @@ const BillingAddressForm = ({ order }) => {
9626
9616
  const { handleSuccess } = useRouteModal();
9627
9617
  const onSubmit = form.handleSubmit(async (data) => {
9628
9618
  await mutateAsync(
9629
- { billing_address: data },
9619
+ { email: data.email },
9630
9620
  {
9631
9621
  onSuccess: () => {
9632
9622
  handleSuccess();
@@ -9643,132 +9633,18 @@ const BillingAddressForm = ({ order }) => {
9643
9633
  className: "flex flex-1 flex-col overflow-hidden",
9644
9634
  onSubmit,
9645
9635
  children: [
9646
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
9647
- /* @__PURE__ */ jsx(
9648
- Form$2.Field,
9649
- {
9650
- control: form.control,
9651
- name: "country_code",
9652
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9653
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9654
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9655
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9656
- ] })
9657
- }
9658
- ),
9659
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9660
- /* @__PURE__ */ jsx(
9661
- Form$2.Field,
9662
- {
9663
- control: form.control,
9664
- name: "first_name",
9665
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9666
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9667
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9668
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9669
- ] })
9670
- }
9671
- ),
9672
- /* @__PURE__ */ jsx(
9673
- Form$2.Field,
9674
- {
9675
- control: form.control,
9676
- name: "last_name",
9677
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9678
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9679
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9680
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9681
- ] })
9682
- }
9683
- )
9684
- ] }),
9685
- /* @__PURE__ */ jsx(
9686
- Form$2.Field,
9687
- {
9688
- control: form.control,
9689
- name: "company",
9690
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9691
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9692
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9693
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9694
- ] })
9695
- }
9696
- ),
9697
- /* @__PURE__ */ jsx(
9698
- Form$2.Field,
9699
- {
9700
- control: form.control,
9701
- name: "address_1",
9702
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9703
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9704
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9705
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9706
- ] })
9707
- }
9708
- ),
9709
- /* @__PURE__ */ jsx(
9710
- Form$2.Field,
9711
- {
9712
- control: form.control,
9713
- name: "address_2",
9714
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9715
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9716
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9717
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9718
- ] })
9719
- }
9720
- ),
9721
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9722
- /* @__PURE__ */ jsx(
9723
- Form$2.Field,
9724
- {
9725
- control: form.control,
9726
- name: "postal_code",
9727
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9728
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9729
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9730
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9731
- ] })
9732
- }
9733
- ),
9734
- /* @__PURE__ */ jsx(
9735
- Form$2.Field,
9736
- {
9737
- control: form.control,
9738
- name: "city",
9739
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9740
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9741
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9742
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9743
- ] })
9744
- }
9745
- )
9746
- ] }),
9747
- /* @__PURE__ */ jsx(
9748
- Form$2.Field,
9749
- {
9750
- control: form.control,
9751
- name: "province",
9752
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9753
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9754
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9755
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9756
- ] })
9757
- }
9758
- ),
9759
- /* @__PURE__ */ jsx(
9760
- Form$2.Field,
9761
- {
9762
- control: form.control,
9763
- name: "phone",
9764
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9765
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9766
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9767
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9768
- ] })
9769
- }
9770
- )
9771
- ] }) }),
9636
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9637
+ Form$2.Field,
9638
+ {
9639
+ control: form.control,
9640
+ name: "email",
9641
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9642
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9643
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9644
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9645
+ ] })
9646
+ }
9647
+ ) }),
9772
9648
  /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9773
9649
  /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9774
9650
  /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -9777,7 +9653,9 @@ const BillingAddressForm = ({ order }) => {
9777
9653
  }
9778
9654
  ) });
9779
9655
  };
9780
- const schema$4 = addressSchema;
9656
+ const schema$4 = objectType({
9657
+ email: stringType().email()
9658
+ });
9781
9659
  const NumberInput = forwardRef(
9782
9660
  ({
9783
9661
  value,
@@ -10752,74 +10630,6 @@ const customItemSchema = objectType({
10752
10630
  quantity: numberType(),
10753
10631
  unit_price: unionType([numberType(), stringType()])
10754
10632
  });
10755
- const Email = () => {
10756
- const { id } = useParams();
10757
- const { order, isPending, isError, error } = useOrder(id, {
10758
- fields: "+email"
10759
- });
10760
- if (isError) {
10761
- throw error;
10762
- }
10763
- const isReady = !isPending && !!order;
10764
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10765
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10766
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
10767
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
10768
- ] }),
10769
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
10770
- ] });
10771
- };
10772
- const EmailForm = ({ order }) => {
10773
- const form = useForm({
10774
- defaultValues: {
10775
- email: order.email ?? ""
10776
- },
10777
- resolver: zodResolver(schema$3)
10778
- });
10779
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10780
- const { handleSuccess } = useRouteModal();
10781
- const onSubmit = form.handleSubmit(async (data) => {
10782
- await mutateAsync(
10783
- { email: data.email },
10784
- {
10785
- onSuccess: () => {
10786
- handleSuccess();
10787
- },
10788
- onError: (error) => {
10789
- toast.error(error.message);
10790
- }
10791
- }
10792
- );
10793
- });
10794
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
10795
- KeyboundForm,
10796
- {
10797
- className: "flex flex-1 flex-col overflow-hidden",
10798
- onSubmit,
10799
- children: [
10800
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
10801
- Form$2.Field,
10802
- {
10803
- control: form.control,
10804
- name: "email",
10805
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10806
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
10807
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10808
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10809
- ] })
10810
- }
10811
- ) }),
10812
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
10813
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10814
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10815
- ] }) })
10816
- ]
10817
- }
10818
- ) });
10819
- };
10820
- const schema$3 = objectType({
10821
- email: stringType().email()
10822
- });
10823
10633
  const InlineTip = forwardRef(
10824
10634
  ({ variant = "tip", label, className, children, ...props }, ref) => {
10825
10635
  const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
@@ -11475,7 +11285,7 @@ const SalesChannelForm = ({ order }) => {
11475
11285
  defaultValues: {
11476
11286
  sales_channel_id: order.sales_channel_id || ""
11477
11287
  },
11478
- resolver: zodResolver(schema$2)
11288
+ resolver: zodResolver(schema$3)
11479
11289
  });
11480
11290
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11481
11291
  const { handleSuccess } = useRouteModal();
@@ -11550,32 +11360,235 @@ const SalesChannelField = ({ control, order }) => {
11550
11360
  }
11551
11361
  );
11552
11362
  };
11553
- const schema$2 = objectType({
11363
+ const schema$3 = objectType({
11554
11364
  sales_channel_id: stringType().min(1)
11555
11365
  });
11556
- const STACKED_FOCUS_MODAL_ID = "shipping-form";
11557
- const Shipping = () => {
11558
- var _a;
11366
+ const ShippingAddress = () => {
11559
11367
  const { id } = useParams();
11560
11368
  const { order, isPending, isError, error } = useOrder(id, {
11561
- fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11369
+ fields: "+shipping_address"
11562
11370
  });
11563
- const {
11564
- order: preview,
11565
- isPending: isPreviewPending,
11566
- isError: isPreviewError,
11567
- error: previewError
11568
- } = useOrderPreview(id);
11569
- useInitiateOrderEdit({ preview });
11570
- const { onCancel } = useCancelOrderEdit({ preview });
11571
11371
  if (isError) {
11572
11372
  throw error;
11573
11373
  }
11574
- if (isPreviewError) {
11575
- throw previewError;
11576
- }
11577
- const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11578
- const isReady = preview && !isPreviewPending && order && !isPending;
11374
+ const isReady = !isPending && !!order;
11375
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11376
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11377
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
11378
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11379
+ ] }),
11380
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
11381
+ ] });
11382
+ };
11383
+ const ShippingAddressForm = ({ order }) => {
11384
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11385
+ const form = useForm({
11386
+ defaultValues: {
11387
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11388
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11389
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11390
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11391
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11392
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11393
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11394
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11395
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11396
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11397
+ },
11398
+ resolver: zodResolver(schema$2)
11399
+ });
11400
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11401
+ const { handleSuccess } = useRouteModal();
11402
+ const onSubmit = form.handleSubmit(async (data) => {
11403
+ await mutateAsync(
11404
+ {
11405
+ shipping_address: {
11406
+ first_name: data.first_name,
11407
+ last_name: data.last_name,
11408
+ company: data.company,
11409
+ address_1: data.address_1,
11410
+ address_2: data.address_2,
11411
+ city: data.city,
11412
+ province: data.province,
11413
+ country_code: data.country_code,
11414
+ postal_code: data.postal_code,
11415
+ phone: data.phone
11416
+ }
11417
+ },
11418
+ {
11419
+ onSuccess: () => {
11420
+ handleSuccess();
11421
+ },
11422
+ onError: (error) => {
11423
+ toast.error(error.message);
11424
+ }
11425
+ }
11426
+ );
11427
+ });
11428
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11429
+ KeyboundForm,
11430
+ {
11431
+ className: "flex flex-1 flex-col overflow-hidden",
11432
+ onSubmit,
11433
+ children: [
11434
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
11435
+ /* @__PURE__ */ jsx(
11436
+ Form$2.Field,
11437
+ {
11438
+ control: form.control,
11439
+ name: "country_code",
11440
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11441
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11442
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11443
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11444
+ ] })
11445
+ }
11446
+ ),
11447
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11448
+ /* @__PURE__ */ jsx(
11449
+ Form$2.Field,
11450
+ {
11451
+ control: form.control,
11452
+ name: "first_name",
11453
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11454
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11455
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11456
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11457
+ ] })
11458
+ }
11459
+ ),
11460
+ /* @__PURE__ */ jsx(
11461
+ Form$2.Field,
11462
+ {
11463
+ control: form.control,
11464
+ name: "last_name",
11465
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11466
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11467
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11468
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11469
+ ] })
11470
+ }
11471
+ )
11472
+ ] }),
11473
+ /* @__PURE__ */ jsx(
11474
+ Form$2.Field,
11475
+ {
11476
+ control: form.control,
11477
+ name: "company",
11478
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11479
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11480
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11481
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11482
+ ] })
11483
+ }
11484
+ ),
11485
+ /* @__PURE__ */ jsx(
11486
+ Form$2.Field,
11487
+ {
11488
+ control: form.control,
11489
+ name: "address_1",
11490
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11491
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11492
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11493
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11494
+ ] })
11495
+ }
11496
+ ),
11497
+ /* @__PURE__ */ jsx(
11498
+ Form$2.Field,
11499
+ {
11500
+ control: form.control,
11501
+ name: "address_2",
11502
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11503
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11504
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11505
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11506
+ ] })
11507
+ }
11508
+ ),
11509
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11510
+ /* @__PURE__ */ jsx(
11511
+ Form$2.Field,
11512
+ {
11513
+ control: form.control,
11514
+ name: "postal_code",
11515
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11516
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11517
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11518
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11519
+ ] })
11520
+ }
11521
+ ),
11522
+ /* @__PURE__ */ jsx(
11523
+ Form$2.Field,
11524
+ {
11525
+ control: form.control,
11526
+ name: "city",
11527
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11528
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11529
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11530
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11531
+ ] })
11532
+ }
11533
+ )
11534
+ ] }),
11535
+ /* @__PURE__ */ jsx(
11536
+ Form$2.Field,
11537
+ {
11538
+ control: form.control,
11539
+ name: "province",
11540
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11541
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11542
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11543
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11544
+ ] })
11545
+ }
11546
+ ),
11547
+ /* @__PURE__ */ jsx(
11548
+ Form$2.Field,
11549
+ {
11550
+ control: form.control,
11551
+ name: "phone",
11552
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11553
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11554
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11555
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11556
+ ] })
11557
+ }
11558
+ )
11559
+ ] }) }),
11560
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11561
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11562
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11563
+ ] }) })
11564
+ ]
11565
+ }
11566
+ ) });
11567
+ };
11568
+ const schema$2 = addressSchema;
11569
+ const STACKED_FOCUS_MODAL_ID = "shipping-form";
11570
+ const Shipping = () => {
11571
+ var _a;
11572
+ const { id } = useParams();
11573
+ const { order, isPending, isError, error } = useOrder(id, {
11574
+ fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11575
+ });
11576
+ const {
11577
+ order: preview,
11578
+ isPending: isPreviewPending,
11579
+ isError: isPreviewError,
11580
+ error: previewError
11581
+ } = useOrderPreview(id);
11582
+ useInitiateOrderEdit({ preview });
11583
+ const { onCancel } = useCancelOrderEdit({ preview });
11584
+ if (isError) {
11585
+ throw error;
11586
+ }
11587
+ if (isPreviewError) {
11588
+ throw previewError;
11589
+ }
11590
+ const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11591
+ const isReady = preview && !isPreviewPending && order && !isPending;
11579
11592
  return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11580
11593
  /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11581
11594
  /* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
@@ -12360,244 +12373,41 @@ const CustomAmountField = ({
12360
12373
  }
12361
12374
  );
12362
12375
  };
12363
- const ShippingAddress = () => {
12376
+ const TransferOwnership = () => {
12364
12377
  const { id } = useParams();
12365
- const { order, isPending, isError, error } = useOrder(id, {
12366
- fields: "+shipping_address"
12378
+ const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12379
+ fields: "id,customer_id,customer.*"
12367
12380
  });
12368
12381
  if (isError) {
12369
12382
  throw error;
12370
12383
  }
12371
- const isReady = !isPending && !!order;
12384
+ const isReady = !isPending && !!draft_order;
12372
12385
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12373
12386
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12374
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12375
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12387
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12388
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12376
12389
  ] }),
12377
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12390
+ isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12378
12391
  ] });
12379
12392
  };
12380
- const ShippingAddressForm = ({ order }) => {
12381
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12393
+ const TransferOwnershipForm = ({ order }) => {
12394
+ var _a, _b;
12382
12395
  const form = useForm({
12383
12396
  defaultValues: {
12384
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12385
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12386
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12387
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12388
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12389
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12390
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12391
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12392
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12393
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12397
+ customer_id: order.customer_id || ""
12394
12398
  },
12395
12399
  resolver: zodResolver(schema$1)
12396
12400
  });
12397
12401
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12398
12402
  const { handleSuccess } = useRouteModal();
12403
+ const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12404
+ const currentCustomer = order.customer ? {
12405
+ label: name ? `${name} (${order.customer.email})` : order.customer.email,
12406
+ value: order.customer.id
12407
+ } : null;
12399
12408
  const onSubmit = form.handleSubmit(async (data) => {
12400
12409
  await mutateAsync(
12401
- {
12402
- shipping_address: {
12403
- first_name: data.first_name,
12404
- last_name: data.last_name,
12405
- company: data.company,
12406
- address_1: data.address_1,
12407
- address_2: data.address_2,
12408
- city: data.city,
12409
- province: data.province,
12410
- country_code: data.country_code,
12411
- postal_code: data.postal_code,
12412
- phone: data.phone
12413
- }
12414
- },
12415
- {
12416
- onSuccess: () => {
12417
- handleSuccess();
12418
- },
12419
- onError: (error) => {
12420
- toast.error(error.message);
12421
- }
12422
- }
12423
- );
12424
- });
12425
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12426
- KeyboundForm,
12427
- {
12428
- className: "flex flex-1 flex-col overflow-hidden",
12429
- onSubmit,
12430
- children: [
12431
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
12432
- /* @__PURE__ */ jsx(
12433
- Form$2.Field,
12434
- {
12435
- control: form.control,
12436
- name: "country_code",
12437
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12438
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12439
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12440
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12441
- ] })
12442
- }
12443
- ),
12444
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12445
- /* @__PURE__ */ jsx(
12446
- Form$2.Field,
12447
- {
12448
- control: form.control,
12449
- name: "first_name",
12450
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12451
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12452
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12453
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12454
- ] })
12455
- }
12456
- ),
12457
- /* @__PURE__ */ jsx(
12458
- Form$2.Field,
12459
- {
12460
- control: form.control,
12461
- name: "last_name",
12462
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12463
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12464
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12465
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12466
- ] })
12467
- }
12468
- )
12469
- ] }),
12470
- /* @__PURE__ */ jsx(
12471
- Form$2.Field,
12472
- {
12473
- control: form.control,
12474
- name: "company",
12475
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12476
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12477
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12478
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12479
- ] })
12480
- }
12481
- ),
12482
- /* @__PURE__ */ jsx(
12483
- Form$2.Field,
12484
- {
12485
- control: form.control,
12486
- name: "address_1",
12487
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12488
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12489
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12490
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12491
- ] })
12492
- }
12493
- ),
12494
- /* @__PURE__ */ jsx(
12495
- Form$2.Field,
12496
- {
12497
- control: form.control,
12498
- name: "address_2",
12499
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12500
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12501
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12502
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12503
- ] })
12504
- }
12505
- ),
12506
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12507
- /* @__PURE__ */ jsx(
12508
- Form$2.Field,
12509
- {
12510
- control: form.control,
12511
- name: "postal_code",
12512
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12513
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12514
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12515
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12516
- ] })
12517
- }
12518
- ),
12519
- /* @__PURE__ */ jsx(
12520
- Form$2.Field,
12521
- {
12522
- control: form.control,
12523
- name: "city",
12524
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12525
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12526
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12527
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12528
- ] })
12529
- }
12530
- )
12531
- ] }),
12532
- /* @__PURE__ */ jsx(
12533
- Form$2.Field,
12534
- {
12535
- control: form.control,
12536
- name: "province",
12537
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12538
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12539
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12540
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12541
- ] })
12542
- }
12543
- ),
12544
- /* @__PURE__ */ jsx(
12545
- Form$2.Field,
12546
- {
12547
- control: form.control,
12548
- name: "phone",
12549
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12550
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12551
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12552
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12553
- ] })
12554
- }
12555
- )
12556
- ] }) }),
12557
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12558
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12559
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12560
- ] }) })
12561
- ]
12562
- }
12563
- ) });
12564
- };
12565
- const schema$1 = addressSchema;
12566
- const TransferOwnership = () => {
12567
- const { id } = useParams();
12568
- const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12569
- fields: "id,customer_id,customer.*"
12570
- });
12571
- if (isError) {
12572
- throw error;
12573
- }
12574
- const isReady = !isPending && !!draft_order;
12575
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12576
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12577
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12578
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12579
- ] }),
12580
- isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12581
- ] });
12582
- };
12583
- const TransferOwnershipForm = ({ order }) => {
12584
- var _a, _b;
12585
- const form = useForm({
12586
- defaultValues: {
12587
- customer_id: order.customer_id || ""
12588
- },
12589
- resolver: zodResolver(schema)
12590
- });
12591
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12592
- const { handleSuccess } = useRouteModal();
12593
- const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12594
- const currentCustomer = order.customer ? {
12595
- label: name ? `${name} (${order.customer.email})` : order.customer.email,
12596
- value: order.customer.id
12597
- } : null;
12598
- const onSubmit = form.handleSubmit(async (data) => {
12599
- await mutateAsync(
12600
- { customer_id: data.customer_id },
12410
+ { customer_id: data.customer_id },
12601
12411
  {
12602
12412
  onSuccess: () => {
12603
12413
  toast.success("Customer updated");
@@ -13036,9 +12846,199 @@ const Illustration = () => {
13036
12846
  }
13037
12847
  );
13038
12848
  };
13039
- const schema = objectType({
12849
+ const schema$1 = objectType({
13040
12850
  customer_id: stringType().min(1)
13041
12851
  });
12852
+ const BillingAddress = () => {
12853
+ const { id } = useParams();
12854
+ const { order, isPending, isError, error } = useOrder(id, {
12855
+ fields: "+billing_address"
12856
+ });
12857
+ if (isError) {
12858
+ throw error;
12859
+ }
12860
+ const isReady = !isPending && !!order;
12861
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12862
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12863
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
12864
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12865
+ ] }),
12866
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
12867
+ ] });
12868
+ };
12869
+ const BillingAddressForm = ({ order }) => {
12870
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12871
+ const form = useForm({
12872
+ defaultValues: {
12873
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12874
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12875
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12876
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12877
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12878
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12879
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12880
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12881
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12882
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12883
+ },
12884
+ resolver: zodResolver(schema)
12885
+ });
12886
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12887
+ const { handleSuccess } = useRouteModal();
12888
+ const onSubmit = form.handleSubmit(async (data) => {
12889
+ await mutateAsync(
12890
+ { billing_address: data },
12891
+ {
12892
+ onSuccess: () => {
12893
+ handleSuccess();
12894
+ },
12895
+ onError: (error) => {
12896
+ toast.error(error.message);
12897
+ }
12898
+ }
12899
+ );
12900
+ });
12901
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12902
+ KeyboundForm,
12903
+ {
12904
+ className: "flex flex-1 flex-col overflow-hidden",
12905
+ onSubmit,
12906
+ children: [
12907
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
12908
+ /* @__PURE__ */ jsx(
12909
+ Form$2.Field,
12910
+ {
12911
+ control: form.control,
12912
+ name: "country_code",
12913
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12914
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12915
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12916
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12917
+ ] })
12918
+ }
12919
+ ),
12920
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12921
+ /* @__PURE__ */ jsx(
12922
+ Form$2.Field,
12923
+ {
12924
+ control: form.control,
12925
+ name: "first_name",
12926
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12927
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12928
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12929
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12930
+ ] })
12931
+ }
12932
+ ),
12933
+ /* @__PURE__ */ jsx(
12934
+ Form$2.Field,
12935
+ {
12936
+ control: form.control,
12937
+ name: "last_name",
12938
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12939
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12940
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12941
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12942
+ ] })
12943
+ }
12944
+ )
12945
+ ] }),
12946
+ /* @__PURE__ */ jsx(
12947
+ Form$2.Field,
12948
+ {
12949
+ control: form.control,
12950
+ name: "company",
12951
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12952
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12953
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12954
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12955
+ ] })
12956
+ }
12957
+ ),
12958
+ /* @__PURE__ */ jsx(
12959
+ Form$2.Field,
12960
+ {
12961
+ control: form.control,
12962
+ name: "address_1",
12963
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12964
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12965
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12966
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12967
+ ] })
12968
+ }
12969
+ ),
12970
+ /* @__PURE__ */ jsx(
12971
+ Form$2.Field,
12972
+ {
12973
+ control: form.control,
12974
+ name: "address_2",
12975
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12976
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12977
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12978
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12979
+ ] })
12980
+ }
12981
+ ),
12982
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12983
+ /* @__PURE__ */ jsx(
12984
+ Form$2.Field,
12985
+ {
12986
+ control: form.control,
12987
+ name: "postal_code",
12988
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12989
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12990
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12991
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12992
+ ] })
12993
+ }
12994
+ ),
12995
+ /* @__PURE__ */ jsx(
12996
+ Form$2.Field,
12997
+ {
12998
+ control: form.control,
12999
+ name: "city",
13000
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13001
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
13002
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13003
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13004
+ ] })
13005
+ }
13006
+ )
13007
+ ] }),
13008
+ /* @__PURE__ */ jsx(
13009
+ Form$2.Field,
13010
+ {
13011
+ control: form.control,
13012
+ name: "province",
13013
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13014
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13015
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13016
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13017
+ ] })
13018
+ }
13019
+ ),
13020
+ /* @__PURE__ */ jsx(
13021
+ Form$2.Field,
13022
+ {
13023
+ control: form.control,
13024
+ name: "phone",
13025
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13026
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13027
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13028
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13029
+ ] })
13030
+ }
13031
+ )
13032
+ ] }) }),
13033
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13034
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13035
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13036
+ ] }) })
13037
+ ]
13038
+ }
13039
+ ) });
13040
+ };
13041
+ const schema = addressSchema;
13042
13042
  const widgetModule = { widgets: [] };
13043
13043
  const routeModule = {
13044
13044
  routes: [
@@ -13064,17 +13064,13 @@ const routeModule = {
13064
13064
  path: "/draft-orders/:id/custom-items"
13065
13065
  },
13066
13066
  {
13067
- Component: BillingAddress,
13068
- path: "/draft-orders/:id/billing-address"
13067
+ Component: Email,
13068
+ path: "/draft-orders/:id/email"
13069
13069
  },
13070
13070
  {
13071
13071
  Component: Items,
13072
13072
  path: "/draft-orders/:id/items"
13073
13073
  },
13074
- {
13075
- Component: Email,
13076
- path: "/draft-orders/:id/email"
13077
- },
13078
13074
  {
13079
13075
  Component: Metadata,
13080
13076
  path: "/draft-orders/:id/metadata"
@@ -13087,17 +13083,21 @@ const routeModule = {
13087
13083
  Component: SalesChannel,
13088
13084
  path: "/draft-orders/:id/sales-channel"
13089
13085
  },
13090
- {
13091
- Component: Shipping,
13092
- path: "/draft-orders/:id/shipping"
13093
- },
13094
13086
  {
13095
13087
  Component: ShippingAddress,
13096
13088
  path: "/draft-orders/:id/shipping-address"
13097
13089
  },
13090
+ {
13091
+ Component: Shipping,
13092
+ path: "/draft-orders/:id/shipping"
13093
+ },
13098
13094
  {
13099
13095
  Component: TransferOwnership,
13100
13096
  path: "/draft-orders/:id/transfer-ownership"
13097
+ },
13098
+ {
13099
+ Component: BillingAddress,
13100
+ path: "/draft-orders/:id/billing-address"
13101
13101
  }
13102
13102
  ]
13103
13103
  }