@medusajs/draft-order 2.11.0-preview-20251019120202 → 2.11.0-preview-20251019150150

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.
@@ -9565,27 +9565,6 @@ const ID = () => {
9565
9565
  /* @__PURE__ */ jsx(Outlet, {})
9566
9566
  ] });
9567
9567
  };
9568
- const CustomItems = () => {
9569
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9570
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9571
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9572
- ] });
9573
- };
9574
- const CustomItemsForm = () => {
9575
- const form = useForm({
9576
- resolver: zodResolver(schema$5)
9577
- });
9578
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9579
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9580
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9581
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9582
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9583
- ] }) })
9584
- ] }) });
9585
- };
9586
- const schema$5 = objectType({
9587
- email: stringType().email()
9588
- });
9589
9568
  const Email = () => {
9590
9569
  const { id } = useParams();
9591
9570
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9608,7 +9587,7 @@ const EmailForm = ({ order }) => {
9608
9587
  defaultValues: {
9609
9588
  email: order.email ?? ""
9610
9589
  },
9611
- resolver: zodResolver(schema$4)
9590
+ resolver: zodResolver(schema$5)
9612
9591
  });
9613
9592
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9614
9593
  const { handleSuccess } = useRouteModal();
@@ -9651,199 +9630,9 @@ const EmailForm = ({ order }) => {
9651
9630
  }
9652
9631
  ) });
9653
9632
  };
9654
- const schema$4 = objectType({
9633
+ const schema$5 = objectType({
9655
9634
  email: stringType().email()
9656
9635
  });
9657
- const BillingAddress = () => {
9658
- const { id } = useParams();
9659
- const { order, isPending, isError, error } = useOrder(id, {
9660
- fields: "+billing_address"
9661
- });
9662
- if (isError) {
9663
- throw error;
9664
- }
9665
- const isReady = !isPending && !!order;
9666
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9667
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9668
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9669
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9670
- ] }),
9671
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9672
- ] });
9673
- };
9674
- const BillingAddressForm = ({ order }) => {
9675
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9676
- const form = useForm({
9677
- defaultValues: {
9678
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9679
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9680
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9681
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9682
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9683
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9684
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9685
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9686
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9687
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9688
- },
9689
- resolver: zodResolver(schema$3)
9690
- });
9691
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9692
- const { handleSuccess } = useRouteModal();
9693
- const onSubmit = form.handleSubmit(async (data) => {
9694
- await mutateAsync(
9695
- { billing_address: data },
9696
- {
9697
- onSuccess: () => {
9698
- handleSuccess();
9699
- },
9700
- onError: (error) => {
9701
- toast.error(error.message);
9702
- }
9703
- }
9704
- );
9705
- });
9706
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9707
- KeyboundForm,
9708
- {
9709
- className: "flex flex-1 flex-col overflow-hidden",
9710
- onSubmit,
9711
- children: [
9712
- /* @__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: [
9713
- /* @__PURE__ */ jsx(
9714
- Form$2.Field,
9715
- {
9716
- control: form.control,
9717
- name: "country_code",
9718
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9719
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9720
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9721
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9722
- ] })
9723
- }
9724
- ),
9725
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9726
- /* @__PURE__ */ jsx(
9727
- Form$2.Field,
9728
- {
9729
- control: form.control,
9730
- name: "first_name",
9731
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9732
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9733
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9734
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9735
- ] })
9736
- }
9737
- ),
9738
- /* @__PURE__ */ jsx(
9739
- Form$2.Field,
9740
- {
9741
- control: form.control,
9742
- name: "last_name",
9743
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9744
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9745
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9746
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9747
- ] })
9748
- }
9749
- )
9750
- ] }),
9751
- /* @__PURE__ */ jsx(
9752
- Form$2.Field,
9753
- {
9754
- control: form.control,
9755
- name: "company",
9756
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9757
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9758
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9759
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9760
- ] })
9761
- }
9762
- ),
9763
- /* @__PURE__ */ jsx(
9764
- Form$2.Field,
9765
- {
9766
- control: form.control,
9767
- name: "address_1",
9768
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9769
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9770
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9771
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9772
- ] })
9773
- }
9774
- ),
9775
- /* @__PURE__ */ jsx(
9776
- Form$2.Field,
9777
- {
9778
- control: form.control,
9779
- name: "address_2",
9780
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9781
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9782
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9783
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9784
- ] })
9785
- }
9786
- ),
9787
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9788
- /* @__PURE__ */ jsx(
9789
- Form$2.Field,
9790
- {
9791
- control: form.control,
9792
- name: "postal_code",
9793
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9794
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9795
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9796
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9797
- ] })
9798
- }
9799
- ),
9800
- /* @__PURE__ */ jsx(
9801
- Form$2.Field,
9802
- {
9803
- control: form.control,
9804
- name: "city",
9805
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9806
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9807
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9808
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9809
- ] })
9810
- }
9811
- )
9812
- ] }),
9813
- /* @__PURE__ */ jsx(
9814
- Form$2.Field,
9815
- {
9816
- control: form.control,
9817
- name: "province",
9818
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9819
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9820
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9821
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9822
- ] })
9823
- }
9824
- ),
9825
- /* @__PURE__ */ jsx(
9826
- Form$2.Field,
9827
- {
9828
- control: form.control,
9829
- name: "phone",
9830
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9831
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9832
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9833
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9834
- ] })
9835
- }
9836
- )
9837
- ] }) }),
9838
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9839
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9840
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9841
- ] }) })
9842
- ]
9843
- }
9844
- ) });
9845
- };
9846
- const schema$3 = addressSchema;
9847
9636
  const NumberInput = forwardRef(
9848
9637
  ({
9849
9638
  value,
@@ -11473,7 +11262,7 @@ const SalesChannelForm = ({ order }) => {
11473
11262
  defaultValues: {
11474
11263
  sales_channel_id: order.sales_channel_id || ""
11475
11264
  },
11476
- resolver: zodResolver(schema$2)
11265
+ resolver: zodResolver(schema$4)
11477
11266
  });
11478
11267
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11479
11268
  const { handleSuccess } = useRouteModal();
@@ -11548,7 +11337,7 @@ const SalesChannelField = ({ control, order }) => {
11548
11337
  }
11549
11338
  );
11550
11339
  };
11551
- const schema$2 = objectType({
11340
+ const schema$4 = objectType({
11552
11341
  sales_channel_id: stringType().min(1)
11553
11342
  });
11554
11343
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12358,244 +12147,41 @@ const CustomAmountField = ({
12358
12147
  }
12359
12148
  );
12360
12149
  };
12361
- const ShippingAddress = () => {
12150
+ const TransferOwnership = () => {
12362
12151
  const { id } = useParams();
12363
- const { order, isPending, isError, error } = useOrder(id, {
12364
- fields: "+shipping_address"
12152
+ const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12153
+ fields: "id,customer_id,customer.*"
12365
12154
  });
12366
12155
  if (isError) {
12367
12156
  throw error;
12368
12157
  }
12369
- const isReady = !isPending && !!order;
12158
+ const isReady = !isPending && !!draft_order;
12370
12159
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12371
12160
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12372
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12373
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12161
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12162
+ /* @__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" }) })
12374
12163
  ] }),
12375
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12164
+ isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12376
12165
  ] });
12377
12166
  };
12378
- const ShippingAddressForm = ({ order }) => {
12379
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12167
+ const TransferOwnershipForm = ({ order }) => {
12168
+ var _a, _b;
12380
12169
  const form = useForm({
12381
12170
  defaultValues: {
12382
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12383
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12384
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12385
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12386
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12387
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12388
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12389
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12390
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12391
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12171
+ customer_id: order.customer_id || ""
12392
12172
  },
12393
- resolver: zodResolver(schema$1)
12173
+ resolver: zodResolver(schema$3)
12394
12174
  });
12395
12175
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12396
12176
  const { handleSuccess } = useRouteModal();
12177
+ const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12178
+ const currentCustomer = order.customer ? {
12179
+ label: name ? `${name} (${order.customer.email})` : order.customer.email,
12180
+ value: order.customer.id
12181
+ } : null;
12397
12182
  const onSubmit = form.handleSubmit(async (data) => {
12398
12183
  await mutateAsync(
12399
- {
12400
- shipping_address: {
12401
- first_name: data.first_name,
12402
- last_name: data.last_name,
12403
- company: data.company,
12404
- address_1: data.address_1,
12405
- address_2: data.address_2,
12406
- city: data.city,
12407
- province: data.province,
12408
- country_code: data.country_code,
12409
- postal_code: data.postal_code,
12410
- phone: data.phone
12411
- }
12412
- },
12413
- {
12414
- onSuccess: () => {
12415
- handleSuccess();
12416
- },
12417
- onError: (error) => {
12418
- toast.error(error.message);
12419
- }
12420
- }
12421
- );
12422
- });
12423
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12424
- KeyboundForm,
12425
- {
12426
- className: "flex flex-1 flex-col overflow-hidden",
12427
- onSubmit,
12428
- children: [
12429
- /* @__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: [
12430
- /* @__PURE__ */ jsx(
12431
- Form$2.Field,
12432
- {
12433
- control: form.control,
12434
- name: "country_code",
12435
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12436
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12437
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12438
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12439
- ] })
12440
- }
12441
- ),
12442
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12443
- /* @__PURE__ */ jsx(
12444
- Form$2.Field,
12445
- {
12446
- control: form.control,
12447
- name: "first_name",
12448
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12449
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12450
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12451
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12452
- ] })
12453
- }
12454
- ),
12455
- /* @__PURE__ */ jsx(
12456
- Form$2.Field,
12457
- {
12458
- control: form.control,
12459
- name: "last_name",
12460
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12461
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12462
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12463
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12464
- ] })
12465
- }
12466
- )
12467
- ] }),
12468
- /* @__PURE__ */ jsx(
12469
- Form$2.Field,
12470
- {
12471
- control: form.control,
12472
- name: "company",
12473
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12474
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12475
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12476
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12477
- ] })
12478
- }
12479
- ),
12480
- /* @__PURE__ */ jsx(
12481
- Form$2.Field,
12482
- {
12483
- control: form.control,
12484
- name: "address_1",
12485
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12486
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12487
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12488
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12489
- ] })
12490
- }
12491
- ),
12492
- /* @__PURE__ */ jsx(
12493
- Form$2.Field,
12494
- {
12495
- control: form.control,
12496
- name: "address_2",
12497
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12498
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12499
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12500
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12501
- ] })
12502
- }
12503
- ),
12504
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12505
- /* @__PURE__ */ jsx(
12506
- Form$2.Field,
12507
- {
12508
- control: form.control,
12509
- name: "postal_code",
12510
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12511
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12512
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12513
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12514
- ] })
12515
- }
12516
- ),
12517
- /* @__PURE__ */ jsx(
12518
- Form$2.Field,
12519
- {
12520
- control: form.control,
12521
- name: "city",
12522
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12523
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12524
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12525
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12526
- ] })
12527
- }
12528
- )
12529
- ] }),
12530
- /* @__PURE__ */ jsx(
12531
- Form$2.Field,
12532
- {
12533
- control: form.control,
12534
- name: "province",
12535
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12536
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12537
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12538
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12539
- ] })
12540
- }
12541
- ),
12542
- /* @__PURE__ */ jsx(
12543
- Form$2.Field,
12544
- {
12545
- control: form.control,
12546
- name: "phone",
12547
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12548
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12549
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12550
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12551
- ] })
12552
- }
12553
- )
12554
- ] }) }),
12555
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12556
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12557
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12558
- ] }) })
12559
- ]
12560
- }
12561
- ) });
12562
- };
12563
- const schema$1 = addressSchema;
12564
- const TransferOwnership = () => {
12565
- const { id } = useParams();
12566
- const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12567
- fields: "id,customer_id,customer.*"
12568
- });
12569
- if (isError) {
12570
- throw error;
12571
- }
12572
- const isReady = !isPending && !!draft_order;
12573
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12574
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12575
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12576
- /* @__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" }) })
12577
- ] }),
12578
- isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12579
- ] });
12580
- };
12581
- const TransferOwnershipForm = ({ order }) => {
12582
- var _a, _b;
12583
- const form = useForm({
12584
- defaultValues: {
12585
- customer_id: order.customer_id || ""
12586
- },
12587
- resolver: zodResolver(schema)
12588
- });
12589
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12590
- const { handleSuccess } = useRouteModal();
12591
- const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12592
- const currentCustomer = order.customer ? {
12593
- label: name ? `${name} (${order.customer.email})` : order.customer.email,
12594
- value: order.customer.id
12595
- } : null;
12596
- const onSubmit = form.handleSubmit(async (data) => {
12597
- await mutateAsync(
12598
- { customer_id: data.customer_id },
12184
+ { customer_id: data.customer_id },
12599
12185
  {
12600
12186
  onSuccess: () => {
12601
12187
  toast.success("Customer updated");
@@ -13034,40 +12620,446 @@ const Illustration = () => {
13034
12620
  }
13035
12621
  );
13036
12622
  };
13037
- const schema = objectType({
12623
+ const schema$3 = objectType({
13038
12624
  customer_id: stringType().min(1)
13039
12625
  });
13040
- const widgetModule = { widgets: [] };
13041
- const routeModule = {
13042
- routes: [
13043
- {
13044
- Component: List,
13045
- path: "/draft-orders",
13046
- handle: handle$1,
13047
- children: [
13048
- {
13049
- Component: Create,
13050
- path: "/draft-orders/create"
13051
- }
13052
- ]
12626
+ const ShippingAddress = () => {
12627
+ const { id } = useParams();
12628
+ const { order, isPending, isError, error } = useOrder(id, {
12629
+ fields: "+shipping_address"
12630
+ });
12631
+ if (isError) {
12632
+ throw error;
12633
+ }
12634
+ const isReady = !isPending && !!order;
12635
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12636
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12637
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12638
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12639
+ ] }),
12640
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12641
+ ] });
12642
+ };
12643
+ const ShippingAddressForm = ({ order }) => {
12644
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12645
+ const form = useForm({
12646
+ defaultValues: {
12647
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12648
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12649
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12650
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12651
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12652
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12653
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12654
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12655
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12656
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
13053
12657
  },
13054
- {
13055
- Component: ID,
13056
- path: "/draft-orders/:id",
13057
- handle,
13058
- loader,
13059
- children: [
13060
- {
13061
- Component: CustomItems,
13062
- path: "/draft-orders/:id/custom-items"
13063
- },
13064
- {
13065
- Component: Email,
13066
- path: "/draft-orders/:id/email"
13067
- },
13068
- {
13069
- Component: BillingAddress,
13070
- path: "/draft-orders/:id/billing-address"
12658
+ resolver: zodResolver(schema$2)
12659
+ });
12660
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12661
+ const { handleSuccess } = useRouteModal();
12662
+ const onSubmit = form.handleSubmit(async (data) => {
12663
+ await mutateAsync(
12664
+ {
12665
+ shipping_address: {
12666
+ first_name: data.first_name,
12667
+ last_name: data.last_name,
12668
+ company: data.company,
12669
+ address_1: data.address_1,
12670
+ address_2: data.address_2,
12671
+ city: data.city,
12672
+ province: data.province,
12673
+ country_code: data.country_code,
12674
+ postal_code: data.postal_code,
12675
+ phone: data.phone
12676
+ }
12677
+ },
12678
+ {
12679
+ onSuccess: () => {
12680
+ handleSuccess();
12681
+ },
12682
+ onError: (error) => {
12683
+ toast.error(error.message);
12684
+ }
12685
+ }
12686
+ );
12687
+ });
12688
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12689
+ KeyboundForm,
12690
+ {
12691
+ className: "flex flex-1 flex-col overflow-hidden",
12692
+ onSubmit,
12693
+ children: [
12694
+ /* @__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: [
12695
+ /* @__PURE__ */ jsx(
12696
+ Form$2.Field,
12697
+ {
12698
+ control: form.control,
12699
+ name: "country_code",
12700
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12701
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12702
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12703
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12704
+ ] })
12705
+ }
12706
+ ),
12707
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12708
+ /* @__PURE__ */ jsx(
12709
+ Form$2.Field,
12710
+ {
12711
+ control: form.control,
12712
+ name: "first_name",
12713
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12714
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12715
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12716
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12717
+ ] })
12718
+ }
12719
+ ),
12720
+ /* @__PURE__ */ jsx(
12721
+ Form$2.Field,
12722
+ {
12723
+ control: form.control,
12724
+ name: "last_name",
12725
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12726
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12727
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12728
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12729
+ ] })
12730
+ }
12731
+ )
12732
+ ] }),
12733
+ /* @__PURE__ */ jsx(
12734
+ Form$2.Field,
12735
+ {
12736
+ control: form.control,
12737
+ name: "company",
12738
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12739
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12740
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12741
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12742
+ ] })
12743
+ }
12744
+ ),
12745
+ /* @__PURE__ */ jsx(
12746
+ Form$2.Field,
12747
+ {
12748
+ control: form.control,
12749
+ name: "address_1",
12750
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12751
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12752
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12753
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12754
+ ] })
12755
+ }
12756
+ ),
12757
+ /* @__PURE__ */ jsx(
12758
+ Form$2.Field,
12759
+ {
12760
+ control: form.control,
12761
+ name: "address_2",
12762
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12763
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12764
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12765
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12766
+ ] })
12767
+ }
12768
+ ),
12769
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12770
+ /* @__PURE__ */ jsx(
12771
+ Form$2.Field,
12772
+ {
12773
+ control: form.control,
12774
+ name: "postal_code",
12775
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12776
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12777
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12778
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12779
+ ] })
12780
+ }
12781
+ ),
12782
+ /* @__PURE__ */ jsx(
12783
+ Form$2.Field,
12784
+ {
12785
+ control: form.control,
12786
+ name: "city",
12787
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12788
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12789
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12790
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12791
+ ] })
12792
+ }
12793
+ )
12794
+ ] }),
12795
+ /* @__PURE__ */ jsx(
12796
+ Form$2.Field,
12797
+ {
12798
+ control: form.control,
12799
+ name: "province",
12800
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12801
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12802
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12803
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12804
+ ] })
12805
+ }
12806
+ ),
12807
+ /* @__PURE__ */ jsx(
12808
+ Form$2.Field,
12809
+ {
12810
+ control: form.control,
12811
+ name: "phone",
12812
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12813
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12814
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12815
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12816
+ ] })
12817
+ }
12818
+ )
12819
+ ] }) }),
12820
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12821
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12822
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12823
+ ] }) })
12824
+ ]
12825
+ }
12826
+ ) });
12827
+ };
12828
+ const schema$2 = addressSchema;
12829
+ const CustomItems = () => {
12830
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12831
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
12832
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
12833
+ ] });
12834
+ };
12835
+ const CustomItemsForm = () => {
12836
+ const form = useForm({
12837
+ resolver: zodResolver(schema$1)
12838
+ });
12839
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
12840
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
12841
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12842
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12843
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
12844
+ ] }) })
12845
+ ] }) });
12846
+ };
12847
+ const schema$1 = objectType({
12848
+ email: stringType().email()
12849
+ });
12850
+ const BillingAddress = () => {
12851
+ const { id } = useParams();
12852
+ const { order, isPending, isError, error } = useOrder(id, {
12853
+ fields: "+billing_address"
12854
+ });
12855
+ if (isError) {
12856
+ throw error;
12857
+ }
12858
+ const isReady = !isPending && !!order;
12859
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12860
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12861
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
12862
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12863
+ ] }),
12864
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
12865
+ ] });
12866
+ };
12867
+ const BillingAddressForm = ({ order }) => {
12868
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12869
+ const form = useForm({
12870
+ defaultValues: {
12871
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12872
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12873
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12874
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12875
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12876
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12877
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12878
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12879
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12880
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12881
+ },
12882
+ resolver: zodResolver(schema)
12883
+ });
12884
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12885
+ const { handleSuccess } = useRouteModal();
12886
+ const onSubmit = form.handleSubmit(async (data) => {
12887
+ await mutateAsync(
12888
+ { billing_address: data },
12889
+ {
12890
+ onSuccess: () => {
12891
+ handleSuccess();
12892
+ },
12893
+ onError: (error) => {
12894
+ toast.error(error.message);
12895
+ }
12896
+ }
12897
+ );
12898
+ });
12899
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12900
+ KeyboundForm,
12901
+ {
12902
+ className: "flex flex-1 flex-col overflow-hidden",
12903
+ onSubmit,
12904
+ children: [
12905
+ /* @__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: [
12906
+ /* @__PURE__ */ jsx(
12907
+ Form$2.Field,
12908
+ {
12909
+ control: form.control,
12910
+ name: "country_code",
12911
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12912
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12913
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12914
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12915
+ ] })
12916
+ }
12917
+ ),
12918
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12919
+ /* @__PURE__ */ jsx(
12920
+ Form$2.Field,
12921
+ {
12922
+ control: form.control,
12923
+ name: "first_name",
12924
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12925
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12926
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12927
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12928
+ ] })
12929
+ }
12930
+ ),
12931
+ /* @__PURE__ */ jsx(
12932
+ Form$2.Field,
12933
+ {
12934
+ control: form.control,
12935
+ name: "last_name",
12936
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12937
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12938
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12939
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12940
+ ] })
12941
+ }
12942
+ )
12943
+ ] }),
12944
+ /* @__PURE__ */ jsx(
12945
+ Form$2.Field,
12946
+ {
12947
+ control: form.control,
12948
+ name: "company",
12949
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12950
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12951
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12952
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12953
+ ] })
12954
+ }
12955
+ ),
12956
+ /* @__PURE__ */ jsx(
12957
+ Form$2.Field,
12958
+ {
12959
+ control: form.control,
12960
+ name: "address_1",
12961
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12962
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12963
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12964
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12965
+ ] })
12966
+ }
12967
+ ),
12968
+ /* @__PURE__ */ jsx(
12969
+ Form$2.Field,
12970
+ {
12971
+ control: form.control,
12972
+ name: "address_2",
12973
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12974
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12975
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12976
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12977
+ ] })
12978
+ }
12979
+ ),
12980
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12981
+ /* @__PURE__ */ jsx(
12982
+ Form$2.Field,
12983
+ {
12984
+ control: form.control,
12985
+ name: "postal_code",
12986
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12987
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12988
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12989
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12990
+ ] })
12991
+ }
12992
+ ),
12993
+ /* @__PURE__ */ jsx(
12994
+ Form$2.Field,
12995
+ {
12996
+ control: form.control,
12997
+ name: "city",
12998
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12999
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
13000
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13001
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13002
+ ] })
13003
+ }
13004
+ )
13005
+ ] }),
13006
+ /* @__PURE__ */ jsx(
13007
+ Form$2.Field,
13008
+ {
13009
+ control: form.control,
13010
+ name: "province",
13011
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13012
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13013
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13014
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13015
+ ] })
13016
+ }
13017
+ ),
13018
+ /* @__PURE__ */ jsx(
13019
+ Form$2.Field,
13020
+ {
13021
+ control: form.control,
13022
+ name: "phone",
13023
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13024
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13025
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13026
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13027
+ ] })
13028
+ }
13029
+ )
13030
+ ] }) }),
13031
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13032
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13033
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13034
+ ] }) })
13035
+ ]
13036
+ }
13037
+ ) });
13038
+ };
13039
+ const schema = addressSchema;
13040
+ const widgetModule = { widgets: [] };
13041
+ const routeModule = {
13042
+ routes: [
13043
+ {
13044
+ Component: List,
13045
+ path: "/draft-orders",
13046
+ handle: handle$1,
13047
+ children: [
13048
+ {
13049
+ Component: Create,
13050
+ path: "/draft-orders/create"
13051
+ }
13052
+ ]
13053
+ },
13054
+ {
13055
+ Component: ID,
13056
+ path: "/draft-orders/:id",
13057
+ handle,
13058
+ loader,
13059
+ children: [
13060
+ {
13061
+ Component: Email,
13062
+ path: "/draft-orders/:id/email"
13071
13063
  },
13072
13064
  {
13073
13065
  Component: Items,
@@ -13089,13 +13081,21 @@ const routeModule = {
13089
13081
  Component: Shipping,
13090
13082
  path: "/draft-orders/:id/shipping"
13091
13083
  },
13084
+ {
13085
+ Component: TransferOwnership,
13086
+ path: "/draft-orders/:id/transfer-ownership"
13087
+ },
13092
13088
  {
13093
13089
  Component: ShippingAddress,
13094
13090
  path: "/draft-orders/:id/shipping-address"
13095
13091
  },
13096
13092
  {
13097
- Component: TransferOwnership,
13098
- path: "/draft-orders/:id/transfer-ownership"
13093
+ Component: CustomItems,
13094
+ path: "/draft-orders/:id/custom-items"
13095
+ },
13096
+ {
13097
+ Component: BillingAddress,
13098
+ path: "/draft-orders/:id/billing-address"
13099
13099
  }
13100
13100
  ]
13101
13101
  }