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

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.
@@ -7817,12 +7817,10 @@ const CustomerField$1 = ({ control, setValue }) => {
7817
7817
  (option) => option.value === value
7818
7818
  )) == null ? void 0 : _a.label;
7819
7819
  const customerEmail = ((_b = label == null ? void 0 : label.match(/\((.*@.*)\)$/)) == null ? void 0 : _b[1]) || label;
7820
- if (!email && customerEmail) {
7821
- setValue("email", customerEmail, {
7822
- shouldDirty: true,
7823
- shouldTouch: true
7824
- });
7825
- }
7820
+ setValue("email", customerEmail || "", {
7821
+ shouldDirty: true,
7822
+ shouldTouch: true
7823
+ });
7826
7824
  },
7827
7825
  [email, setValue, customers.options]
7828
7826
  );
@@ -9656,6 +9654,196 @@ const EmailForm = ({ order }) => {
9656
9654
  const schema$4 = objectType({
9657
9655
  email: stringType().email()
9658
9656
  });
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;
9659
9847
  const NumberInput = forwardRef(
9660
9848
  ({
9661
9849
  value,
@@ -11285,7 +11473,7 @@ const SalesChannelForm = ({ order }) => {
11285
11473
  defaultValues: {
11286
11474
  sales_channel_id: order.sales_channel_id || ""
11287
11475
  },
11288
- resolver: zodResolver(schema$3)
11476
+ resolver: zodResolver(schema$2)
11289
11477
  });
11290
11478
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11291
11479
  const { handleSuccess } = useRouteModal();
@@ -11360,7 +11548,7 @@ const SalesChannelField = ({ control, order }) => {
11360
11548
  }
11361
11549
  );
11362
11550
  };
11363
- const schema$3 = objectType({
11551
+ const schema$2 = objectType({
11364
11552
  sales_channel_id: stringType().min(1)
11365
11553
  });
11366
11554
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12170,44 +12358,60 @@ const CustomAmountField = ({
12170
12358
  }
12171
12359
  );
12172
12360
  };
12173
- const TransferOwnership = () => {
12361
+ const ShippingAddress = () => {
12174
12362
  const { id } = useParams();
12175
- const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12176
- fields: "id,customer_id,customer.*"
12363
+ const { order, isPending, isError, error } = useOrder(id, {
12364
+ fields: "+shipping_address"
12177
12365
  });
12178
12366
  if (isError) {
12179
12367
  throw error;
12180
12368
  }
12181
- const isReady = !isPending && !!draft_order;
12369
+ const isReady = !isPending && !!order;
12182
12370
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12183
12371
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12184
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12185
- /* @__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" }) })
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" }) })
12186
12374
  ] }),
12187
- isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12375
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12188
12376
  ] });
12189
12377
  };
12190
- const TransferOwnershipForm = ({ order }) => {
12191
- var _a, _b;
12378
+ const ShippingAddressForm = ({ order }) => {
12379
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12192
12380
  const form = useForm({
12193
12381
  defaultValues: {
12194
- customer_id: order.customer_id || ""
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) ?? ""
12195
12392
  },
12196
- resolver: zodResolver(schema$2)
12393
+ resolver: zodResolver(schema$1)
12197
12394
  });
12198
12395
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12199
12396
  const { handleSuccess } = useRouteModal();
12200
- const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12201
- const currentCustomer = order.customer ? {
12202
- label: name ? `${name} (${order.customer.email})` : order.customer.email,
12203
- value: order.customer.id
12204
- } : null;
12205
12397
  const onSubmit = form.handleSubmit(async (data) => {
12206
12398
  await mutateAsync(
12207
- { customer_id: data.customer_id },
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
+ },
12208
12413
  {
12209
12414
  onSuccess: () => {
12210
- toast.success("Customer updated");
12211
12415
  handleSuccess();
12212
12416
  },
12213
12417
  onError: (error) => {
@@ -12222,15 +12426,202 @@ const TransferOwnershipForm = ({ order }) => {
12222
12426
  className: "flex flex-1 flex-col overflow-hidden",
12223
12427
  onSubmit,
12224
12428
  children: [
12225
- /* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
12226
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center bg-ui-bg-component rounded-md border", children: /* @__PURE__ */ jsx(Illustration, {}) }),
12227
- currentCustomer && /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-3", children: [
12228
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
12229
- /* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "current-customer", children: "Current owner" }),
12230
- /* @__PURE__ */ jsx(Hint$1, { children: "The customer that is currently associated with this draft order." })
12231
- ] }),
12232
- /* @__PURE__ */ jsxs(Select, { disabled: true, value: currentCustomer.value, children: [
12233
- /* @__PURE__ */ jsx(Select.Trigger, { id: "current-customer", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
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 },
12599
+ {
12600
+ onSuccess: () => {
12601
+ toast.success("Customer updated");
12602
+ handleSuccess();
12603
+ },
12604
+ onError: (error) => {
12605
+ toast.error(error.message);
12606
+ }
12607
+ }
12608
+ );
12609
+ });
12610
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12611
+ KeyboundForm,
12612
+ {
12613
+ className: "flex flex-1 flex-col overflow-hidden",
12614
+ onSubmit,
12615
+ children: [
12616
+ /* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
12617
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center bg-ui-bg-component rounded-md border", children: /* @__PURE__ */ jsx(Illustration, {}) }),
12618
+ currentCustomer && /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-3", children: [
12619
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
12620
+ /* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "current-customer", children: "Current owner" }),
12621
+ /* @__PURE__ */ jsx(Hint$1, { children: "The customer that is currently associated with this draft order." })
12622
+ ] }),
12623
+ /* @__PURE__ */ jsxs(Select, { disabled: true, value: currentCustomer.value, children: [
12624
+ /* @__PURE__ */ jsx(Select.Trigger, { id: "current-customer", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
12234
12625
  /* @__PURE__ */ jsx(Select.Content, { children: /* @__PURE__ */ jsx(Select.Item, { value: currentCustomer.value, children: currentCustomer.label }) })
12235
12626
  ] })
12236
12627
  ] }),
@@ -12643,415 +13034,22 @@ const Illustration = () => {
12643
13034
  }
12644
13035
  );
12645
13036
  };
12646
- const schema$2 = objectType({
13037
+ const schema = objectType({
12647
13038
  customer_id: stringType().min(1)
12648
13039
  });
12649
- const ShippingAddress = () => {
12650
- const { id } = useParams();
12651
- const { order, isPending, isError, error } = useOrder(id, {
12652
- fields: "+shipping_address"
12653
- });
12654
- if (isError) {
12655
- throw error;
12656
- }
12657
- const isReady = !isPending && !!order;
12658
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12659
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12660
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12661
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12662
- ] }),
12663
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12664
- ] });
12665
- };
12666
- const ShippingAddressForm = ({ order }) => {
12667
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12668
- const form = useForm({
12669
- defaultValues: {
12670
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12671
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12672
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12673
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12674
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12675
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12676
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12677
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12678
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12679
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12680
- },
12681
- resolver: zodResolver(schema$1)
12682
- });
12683
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12684
- const { handleSuccess } = useRouteModal();
12685
- const onSubmit = form.handleSubmit(async (data) => {
12686
- await mutateAsync(
12687
- {
12688
- shipping_address: {
12689
- first_name: data.first_name,
12690
- last_name: data.last_name,
12691
- company: data.company,
12692
- address_1: data.address_1,
12693
- address_2: data.address_2,
12694
- city: data.city,
12695
- province: data.province,
12696
- country_code: data.country_code,
12697
- postal_code: data.postal_code,
12698
- phone: data.phone
12699
- }
12700
- },
12701
- {
12702
- onSuccess: () => {
12703
- handleSuccess();
12704
- },
12705
- onError: (error) => {
12706
- toast.error(error.message);
12707
- }
12708
- }
12709
- );
12710
- });
12711
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12712
- KeyboundForm,
12713
- {
12714
- className: "flex flex-1 flex-col overflow-hidden",
12715
- onSubmit,
12716
- children: [
12717
- /* @__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: [
12718
- /* @__PURE__ */ jsx(
12719
- Form$2.Field,
12720
- {
12721
- control: form.control,
12722
- name: "country_code",
12723
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12724
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12725
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12726
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12727
- ] })
12728
- }
12729
- ),
12730
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12731
- /* @__PURE__ */ jsx(
12732
- Form$2.Field,
12733
- {
12734
- control: form.control,
12735
- name: "first_name",
12736
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12737
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12738
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12739
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12740
- ] })
12741
- }
12742
- ),
12743
- /* @__PURE__ */ jsx(
12744
- Form$2.Field,
12745
- {
12746
- control: form.control,
12747
- name: "last_name",
12748
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12749
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12750
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12751
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12752
- ] })
12753
- }
12754
- )
12755
- ] }),
12756
- /* @__PURE__ */ jsx(
12757
- Form$2.Field,
12758
- {
12759
- control: form.control,
12760
- name: "company",
12761
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12762
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12763
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12764
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12765
- ] })
12766
- }
12767
- ),
12768
- /* @__PURE__ */ jsx(
12769
- Form$2.Field,
12770
- {
12771
- control: form.control,
12772
- name: "address_1",
12773
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12774
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12775
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12776
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12777
- ] })
12778
- }
12779
- ),
12780
- /* @__PURE__ */ jsx(
12781
- Form$2.Field,
12782
- {
12783
- control: form.control,
12784
- name: "address_2",
12785
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12786
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12787
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12788
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12789
- ] })
12790
- }
12791
- ),
12792
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12793
- /* @__PURE__ */ jsx(
12794
- Form$2.Field,
12795
- {
12796
- control: form.control,
12797
- name: "postal_code",
12798
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12799
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12800
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12801
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12802
- ] })
12803
- }
12804
- ),
12805
- /* @__PURE__ */ jsx(
12806
- Form$2.Field,
12807
- {
12808
- control: form.control,
12809
- name: "city",
12810
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12811
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12812
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12813
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12814
- ] })
12815
- }
12816
- )
12817
- ] }),
12818
- /* @__PURE__ */ jsx(
12819
- Form$2.Field,
12820
- {
12821
- control: form.control,
12822
- name: "province",
12823
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12824
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12825
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12826
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12827
- ] })
12828
- }
12829
- ),
12830
- /* @__PURE__ */ jsx(
12831
- Form$2.Field,
12832
- {
12833
- control: form.control,
12834
- name: "phone",
12835
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12836
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12837
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12838
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12839
- ] })
12840
- }
12841
- )
12842
- ] }) }),
12843
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12844
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12845
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12846
- ] }) })
12847
- ]
12848
- }
12849
- ) });
12850
- };
12851
- const schema$1 = addressSchema;
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
- const widgetModule = { widgets: [] };
13043
- const routeModule = {
13044
- routes: [
13045
- {
13046
- Component: List,
13047
- path: "/draft-orders",
13048
- handle: handle$1,
13049
- children: [
13050
- {
13051
- Component: Create,
13052
- path: "/draft-orders/create"
13053
- }
13054
- ]
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
+ ]
13055
13053
  },
13056
13054
  {
13057
13055
  Component: ID,
@@ -13067,6 +13065,10 @@ const routeModule = {
13067
13065
  Component: Email,
13068
13066
  path: "/draft-orders/:id/email"
13069
13067
  },
13068
+ {
13069
+ Component: BillingAddress,
13070
+ path: "/draft-orders/:id/billing-address"
13071
+ },
13070
13072
  {
13071
13073
  Component: Items,
13072
13074
  path: "/draft-orders/:id/items"
@@ -13087,17 +13089,13 @@ const routeModule = {
13087
13089
  Component: Shipping,
13088
13090
  path: "/draft-orders/:id/shipping"
13089
13091
  },
13090
- {
13091
- Component: TransferOwnership,
13092
- path: "/draft-orders/:id/transfer-ownership"
13093
- },
13094
13092
  {
13095
13093
  Component: ShippingAddress,
13096
13094
  path: "/draft-orders/:id/shipping-address"
13097
13095
  },
13098
13096
  {
13099
- Component: BillingAddress,
13100
- path: "/draft-orders/:id/billing-address"
13097
+ Component: TransferOwnership,
13098
+ path: "/draft-orders/:id/transfer-ownership"
13101
13099
  }
13102
13100
  ]
13103
13101
  }