@medusajs/draft-order 2.10.0-snapshot-20250828113245 → 2.10.0-snapshot-20250828114928

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.
@@ -9750,6 +9750,27 @@ const BillingAddressForm = ({ order }) => {
9750
9750
  ) });
9751
9751
  };
9752
9752
  const schema$5 = addressSchema;
9753
+ const CustomItems = () => {
9754
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9755
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9756
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9757
+ ] });
9758
+ };
9759
+ const CustomItemsForm = () => {
9760
+ const form = reactHookForm.useForm({
9761
+ resolver: zod.zodResolver(schema$4)
9762
+ });
9763
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9764
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9765
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9766
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9767
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9768
+ ] }) })
9769
+ ] }) });
9770
+ };
9771
+ const schema$4 = objectType({
9772
+ email: stringType().email()
9773
+ });
9753
9774
  const Email = () => {
9754
9775
  const { id } = reactRouterDom.useParams();
9755
9776
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9772,7 +9793,7 @@ const EmailForm = ({ order }) => {
9772
9793
  defaultValues: {
9773
9794
  email: order.email ?? ""
9774
9795
  },
9775
- resolver: zod.zodResolver(schema$4)
9796
+ resolver: zod.zodResolver(schema$3)
9776
9797
  });
9777
9798
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9778
9799
  const { handleSuccess } = useRouteModal();
@@ -9815,7 +9836,7 @@ const EmailForm = ({ order }) => {
9815
9836
  }
9816
9837
  ) });
9817
9838
  };
9818
- const schema$4 = objectType({
9839
+ const schema$3 = objectType({
9819
9840
  email: stringType().email()
9820
9841
  });
9821
9842
  const NumberInput = React.forwardRef(
@@ -11447,7 +11468,7 @@ const SalesChannelForm = ({ order }) => {
11447
11468
  defaultValues: {
11448
11469
  sales_channel_id: order.sales_channel_id || ""
11449
11470
  },
11450
- resolver: zod.zodResolver(schema$3)
11471
+ resolver: zod.zodResolver(schema$2)
11451
11472
  });
11452
11473
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11453
11474
  const { handleSuccess } = useRouteModal();
@@ -11522,7 +11543,7 @@ const SalesChannelField = ({ control, order }) => {
11522
11543
  }
11523
11544
  );
11524
11545
  };
11525
- const schema$3 = objectType({
11546
+ const schema$2 = objectType({
11526
11547
  sales_channel_id: stringType().min(1)
11527
11548
  });
11528
11549
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12332,209 +12353,6 @@ const CustomAmountField = ({
12332
12353
  }
12333
12354
  );
12334
12355
  };
12335
- const ShippingAddress = () => {
12336
- const { id } = reactRouterDom.useParams();
12337
- const { order, isPending, isError, error } = useOrder(id, {
12338
- fields: "+shipping_address"
12339
- });
12340
- if (isError) {
12341
- throw error;
12342
- }
12343
- const isReady = !isPending && !!order;
12344
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12345
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12346
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12347
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12348
- ] }),
12349
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12350
- ] });
12351
- };
12352
- const ShippingAddressForm = ({ order }) => {
12353
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12354
- const form = reactHookForm.useForm({
12355
- defaultValues: {
12356
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12357
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12358
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12359
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12360
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12361
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12362
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12363
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12364
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12365
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12366
- },
12367
- resolver: zod.zodResolver(schema$2)
12368
- });
12369
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12370
- const { handleSuccess } = useRouteModal();
12371
- const onSubmit = form.handleSubmit(async (data) => {
12372
- await mutateAsync(
12373
- {
12374
- shipping_address: {
12375
- first_name: data.first_name,
12376
- last_name: data.last_name,
12377
- company: data.company,
12378
- address_1: data.address_1,
12379
- address_2: data.address_2,
12380
- city: data.city,
12381
- province: data.province,
12382
- country_code: data.country_code,
12383
- postal_code: data.postal_code,
12384
- phone: data.phone
12385
- }
12386
- },
12387
- {
12388
- onSuccess: () => {
12389
- handleSuccess();
12390
- },
12391
- onError: (error) => {
12392
- ui.toast.error(error.message);
12393
- }
12394
- }
12395
- );
12396
- });
12397
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12398
- KeyboundForm,
12399
- {
12400
- className: "flex flex-1 flex-col overflow-hidden",
12401
- onSubmit,
12402
- children: [
12403
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
12404
- /* @__PURE__ */ jsxRuntime.jsx(
12405
- Form$2.Field,
12406
- {
12407
- control: form.control,
12408
- name: "country_code",
12409
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12410
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12411
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12412
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12413
- ] })
12414
- }
12415
- ),
12416
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12417
- /* @__PURE__ */ jsxRuntime.jsx(
12418
- Form$2.Field,
12419
- {
12420
- control: form.control,
12421
- name: "first_name",
12422
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12423
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12424
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12425
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12426
- ] })
12427
- }
12428
- ),
12429
- /* @__PURE__ */ jsxRuntime.jsx(
12430
- Form$2.Field,
12431
- {
12432
- control: form.control,
12433
- name: "last_name",
12434
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12435
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12436
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12437
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12438
- ] })
12439
- }
12440
- )
12441
- ] }),
12442
- /* @__PURE__ */ jsxRuntime.jsx(
12443
- Form$2.Field,
12444
- {
12445
- control: form.control,
12446
- name: "company",
12447
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12448
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12449
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12450
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12451
- ] })
12452
- }
12453
- ),
12454
- /* @__PURE__ */ jsxRuntime.jsx(
12455
- Form$2.Field,
12456
- {
12457
- control: form.control,
12458
- name: "address_1",
12459
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12460
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12461
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12462
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12463
- ] })
12464
- }
12465
- ),
12466
- /* @__PURE__ */ jsxRuntime.jsx(
12467
- Form$2.Field,
12468
- {
12469
- control: form.control,
12470
- name: "address_2",
12471
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12472
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12473
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12474
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12475
- ] })
12476
- }
12477
- ),
12478
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12479
- /* @__PURE__ */ jsxRuntime.jsx(
12480
- Form$2.Field,
12481
- {
12482
- control: form.control,
12483
- name: "postal_code",
12484
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12485
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12486
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12487
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12488
- ] })
12489
- }
12490
- ),
12491
- /* @__PURE__ */ jsxRuntime.jsx(
12492
- Form$2.Field,
12493
- {
12494
- control: form.control,
12495
- name: "city",
12496
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12497
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12498
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12499
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12500
- ] })
12501
- }
12502
- )
12503
- ] }),
12504
- /* @__PURE__ */ jsxRuntime.jsx(
12505
- Form$2.Field,
12506
- {
12507
- control: form.control,
12508
- name: "province",
12509
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12510
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12511
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12512
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12513
- ] })
12514
- }
12515
- ),
12516
- /* @__PURE__ */ jsxRuntime.jsx(
12517
- Form$2.Field,
12518
- {
12519
- control: form.control,
12520
- name: "phone",
12521
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12522
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12523
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12524
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12525
- ] })
12526
- }
12527
- )
12528
- ] }) }),
12529
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12530
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12531
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12532
- ] }) })
12533
- ]
12534
- }
12535
- ) });
12536
- };
12537
- const schema$2 = addressSchema;
12538
12356
  const TransferOwnership = () => {
12539
12357
  const { id } = reactRouterDom.useParams();
12540
12358
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -13011,27 +12829,209 @@ const Illustration = () => {
13011
12829
  const schema$1 = objectType({
13012
12830
  customer_id: stringType().min(1)
13013
12831
  });
13014
- const CustomItems = () => {
12832
+ const ShippingAddress = () => {
12833
+ const { id } = reactRouterDom.useParams();
12834
+ const { order, isPending, isError, error } = useOrder(id, {
12835
+ fields: "+shipping_address"
12836
+ });
12837
+ if (isError) {
12838
+ throw error;
12839
+ }
12840
+ const isReady = !isPending && !!order;
13015
12841
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
13016
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
13017
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
12842
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12843
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12844
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12845
+ ] }),
12846
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
13018
12847
  ] });
13019
12848
  };
13020
- const CustomItemsForm = () => {
12849
+ const ShippingAddressForm = ({ order }) => {
12850
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
13021
12851
  const form = reactHookForm.useForm({
12852
+ defaultValues: {
12853
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12854
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12855
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12856
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12857
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12858
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12859
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12860
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12861
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12862
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12863
+ },
13022
12864
  resolver: zod.zodResolver(schema)
13023
12865
  });
13024
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13025
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
13026
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13027
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13028
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
13029
- ] }) })
13030
- ] }) });
12866
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12867
+ const { handleSuccess } = useRouteModal();
12868
+ const onSubmit = form.handleSubmit(async (data) => {
12869
+ await mutateAsync(
12870
+ {
12871
+ shipping_address: {
12872
+ first_name: data.first_name,
12873
+ last_name: data.last_name,
12874
+ company: data.company,
12875
+ address_1: data.address_1,
12876
+ address_2: data.address_2,
12877
+ city: data.city,
12878
+ province: data.province,
12879
+ country_code: data.country_code,
12880
+ postal_code: data.postal_code,
12881
+ phone: data.phone
12882
+ }
12883
+ },
12884
+ {
12885
+ onSuccess: () => {
12886
+ handleSuccess();
12887
+ },
12888
+ onError: (error) => {
12889
+ ui.toast.error(error.message);
12890
+ }
12891
+ }
12892
+ );
12893
+ });
12894
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12895
+ KeyboundForm,
12896
+ {
12897
+ className: "flex flex-1 flex-col overflow-hidden",
12898
+ onSubmit,
12899
+ children: [
12900
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
12901
+ /* @__PURE__ */ jsxRuntime.jsx(
12902
+ Form$2.Field,
12903
+ {
12904
+ control: form.control,
12905
+ name: "country_code",
12906
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12907
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12908
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12909
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12910
+ ] })
12911
+ }
12912
+ ),
12913
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12914
+ /* @__PURE__ */ jsxRuntime.jsx(
12915
+ Form$2.Field,
12916
+ {
12917
+ control: form.control,
12918
+ name: "first_name",
12919
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12920
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12921
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12922
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12923
+ ] })
12924
+ }
12925
+ ),
12926
+ /* @__PURE__ */ jsxRuntime.jsx(
12927
+ Form$2.Field,
12928
+ {
12929
+ control: form.control,
12930
+ name: "last_name",
12931
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12932
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12933
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12934
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12935
+ ] })
12936
+ }
12937
+ )
12938
+ ] }),
12939
+ /* @__PURE__ */ jsxRuntime.jsx(
12940
+ Form$2.Field,
12941
+ {
12942
+ control: form.control,
12943
+ name: "company",
12944
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12945
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12946
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12947
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12948
+ ] })
12949
+ }
12950
+ ),
12951
+ /* @__PURE__ */ jsxRuntime.jsx(
12952
+ Form$2.Field,
12953
+ {
12954
+ control: form.control,
12955
+ name: "address_1",
12956
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12957
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12958
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12959
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12960
+ ] })
12961
+ }
12962
+ ),
12963
+ /* @__PURE__ */ jsxRuntime.jsx(
12964
+ Form$2.Field,
12965
+ {
12966
+ control: form.control,
12967
+ name: "address_2",
12968
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12969
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12970
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12971
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12972
+ ] })
12973
+ }
12974
+ ),
12975
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12976
+ /* @__PURE__ */ jsxRuntime.jsx(
12977
+ Form$2.Field,
12978
+ {
12979
+ control: form.control,
12980
+ name: "postal_code",
12981
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12982
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12983
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12984
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12985
+ ] })
12986
+ }
12987
+ ),
12988
+ /* @__PURE__ */ jsxRuntime.jsx(
12989
+ Form$2.Field,
12990
+ {
12991
+ control: form.control,
12992
+ name: "city",
12993
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12994
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12995
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12996
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12997
+ ] })
12998
+ }
12999
+ )
13000
+ ] }),
13001
+ /* @__PURE__ */ jsxRuntime.jsx(
13002
+ Form$2.Field,
13003
+ {
13004
+ control: form.control,
13005
+ name: "province",
13006
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13007
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13008
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13009
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13010
+ ] })
13011
+ }
13012
+ ),
13013
+ /* @__PURE__ */ jsxRuntime.jsx(
13014
+ Form$2.Field,
13015
+ {
13016
+ control: form.control,
13017
+ name: "phone",
13018
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13019
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13020
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13021
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13022
+ ] })
13023
+ }
13024
+ )
13025
+ ] }) }),
13026
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13027
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13028
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13029
+ ] }) })
13030
+ ]
13031
+ }
13032
+ ) });
13031
13033
  };
13032
- const schema = objectType({
13033
- email: stringType().email()
13034
- });
13034
+ const schema = addressSchema;
13035
13035
  const widgetModule = { widgets: [] };
13036
13036
  const routeModule = {
13037
13037
  routes: [
@@ -13056,6 +13056,10 @@ const routeModule = {
13056
13056
  Component: BillingAddress,
13057
13057
  path: "/draft-orders/:id/billing-address"
13058
13058
  },
13059
+ {
13060
+ Component: CustomItems,
13061
+ path: "/draft-orders/:id/custom-items"
13062
+ },
13059
13063
  {
13060
13064
  Component: Email,
13061
13065
  path: "/draft-orders/:id/email"
@@ -13080,17 +13084,13 @@ const routeModule = {
13080
13084
  Component: Shipping,
13081
13085
  path: "/draft-orders/:id/shipping"
13082
13086
  },
13083
- {
13084
- Component: ShippingAddress,
13085
- path: "/draft-orders/:id/shipping-address"
13086
- },
13087
13087
  {
13088
13088
  Component: TransferOwnership,
13089
13089
  path: "/draft-orders/:id/transfer-ownership"
13090
13090
  },
13091
13091
  {
13092
- Component: CustomItems,
13093
- path: "/draft-orders/:id/custom-items"
13092
+ Component: ShippingAddress,
13093
+ path: "/draft-orders/:id/shipping-address"
13094
13094
  }
13095
13095
  ]
13096
13096
  }
@@ -9744,6 +9744,27 @@ const BillingAddressForm = ({ order }) => {
9744
9744
  ) });
9745
9745
  };
9746
9746
  const schema$5 = addressSchema;
9747
+ const CustomItems = () => {
9748
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9749
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9750
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
9751
+ ] });
9752
+ };
9753
+ const CustomItemsForm = () => {
9754
+ const form = useForm({
9755
+ resolver: zodResolver(schema$4)
9756
+ });
9757
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9758
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9759
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9760
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9761
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9762
+ ] }) })
9763
+ ] }) });
9764
+ };
9765
+ const schema$4 = objectType({
9766
+ email: stringType().email()
9767
+ });
9747
9768
  const Email = () => {
9748
9769
  const { id } = useParams();
9749
9770
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9766,7 +9787,7 @@ const EmailForm = ({ order }) => {
9766
9787
  defaultValues: {
9767
9788
  email: order.email ?? ""
9768
9789
  },
9769
- resolver: zodResolver(schema$4)
9790
+ resolver: zodResolver(schema$3)
9770
9791
  });
9771
9792
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9772
9793
  const { handleSuccess } = useRouteModal();
@@ -9809,7 +9830,7 @@ const EmailForm = ({ order }) => {
9809
9830
  }
9810
9831
  ) });
9811
9832
  };
9812
- const schema$4 = objectType({
9833
+ const schema$3 = objectType({
9813
9834
  email: stringType().email()
9814
9835
  });
9815
9836
  const NumberInput = forwardRef(
@@ -11441,7 +11462,7 @@ const SalesChannelForm = ({ order }) => {
11441
11462
  defaultValues: {
11442
11463
  sales_channel_id: order.sales_channel_id || ""
11443
11464
  },
11444
- resolver: zodResolver(schema$3)
11465
+ resolver: zodResolver(schema$2)
11445
11466
  });
11446
11467
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11447
11468
  const { handleSuccess } = useRouteModal();
@@ -11516,7 +11537,7 @@ const SalesChannelField = ({ control, order }) => {
11516
11537
  }
11517
11538
  );
11518
11539
  };
11519
- const schema$3 = objectType({
11540
+ const schema$2 = objectType({
11520
11541
  sales_channel_id: stringType().min(1)
11521
11542
  });
11522
11543
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12326,209 +12347,6 @@ const CustomAmountField = ({
12326
12347
  }
12327
12348
  );
12328
12349
  };
12329
- const ShippingAddress = () => {
12330
- const { id } = useParams();
12331
- const { order, isPending, isError, error } = useOrder(id, {
12332
- fields: "+shipping_address"
12333
- });
12334
- if (isError) {
12335
- throw error;
12336
- }
12337
- const isReady = !isPending && !!order;
12338
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12339
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12340
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12341
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12342
- ] }),
12343
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12344
- ] });
12345
- };
12346
- const ShippingAddressForm = ({ order }) => {
12347
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12348
- const form = useForm({
12349
- defaultValues: {
12350
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12351
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12352
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12353
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12354
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12355
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12356
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12357
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12358
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12359
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12360
- },
12361
- resolver: zodResolver(schema$2)
12362
- });
12363
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12364
- const { handleSuccess } = useRouteModal();
12365
- const onSubmit = form.handleSubmit(async (data) => {
12366
- await mutateAsync(
12367
- {
12368
- shipping_address: {
12369
- first_name: data.first_name,
12370
- last_name: data.last_name,
12371
- company: data.company,
12372
- address_1: data.address_1,
12373
- address_2: data.address_2,
12374
- city: data.city,
12375
- province: data.province,
12376
- country_code: data.country_code,
12377
- postal_code: data.postal_code,
12378
- phone: data.phone
12379
- }
12380
- },
12381
- {
12382
- onSuccess: () => {
12383
- handleSuccess();
12384
- },
12385
- onError: (error) => {
12386
- toast.error(error.message);
12387
- }
12388
- }
12389
- );
12390
- });
12391
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12392
- KeyboundForm,
12393
- {
12394
- className: "flex flex-1 flex-col overflow-hidden",
12395
- onSubmit,
12396
- children: [
12397
- /* @__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: [
12398
- /* @__PURE__ */ jsx(
12399
- Form$2.Field,
12400
- {
12401
- control: form.control,
12402
- name: "country_code",
12403
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12404
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12405
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12406
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12407
- ] })
12408
- }
12409
- ),
12410
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12411
- /* @__PURE__ */ jsx(
12412
- Form$2.Field,
12413
- {
12414
- control: form.control,
12415
- name: "first_name",
12416
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12417
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12418
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12419
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12420
- ] })
12421
- }
12422
- ),
12423
- /* @__PURE__ */ jsx(
12424
- Form$2.Field,
12425
- {
12426
- control: form.control,
12427
- name: "last_name",
12428
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12429
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12430
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12431
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12432
- ] })
12433
- }
12434
- )
12435
- ] }),
12436
- /* @__PURE__ */ jsx(
12437
- Form$2.Field,
12438
- {
12439
- control: form.control,
12440
- name: "company",
12441
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12442
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12443
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12444
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12445
- ] })
12446
- }
12447
- ),
12448
- /* @__PURE__ */ jsx(
12449
- Form$2.Field,
12450
- {
12451
- control: form.control,
12452
- name: "address_1",
12453
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12454
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12455
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12456
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12457
- ] })
12458
- }
12459
- ),
12460
- /* @__PURE__ */ jsx(
12461
- Form$2.Field,
12462
- {
12463
- control: form.control,
12464
- name: "address_2",
12465
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12466
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12467
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12468
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12469
- ] })
12470
- }
12471
- ),
12472
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12473
- /* @__PURE__ */ jsx(
12474
- Form$2.Field,
12475
- {
12476
- control: form.control,
12477
- name: "postal_code",
12478
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12479
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12480
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12481
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12482
- ] })
12483
- }
12484
- ),
12485
- /* @__PURE__ */ jsx(
12486
- Form$2.Field,
12487
- {
12488
- control: form.control,
12489
- name: "city",
12490
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12491
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12492
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12493
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12494
- ] })
12495
- }
12496
- )
12497
- ] }),
12498
- /* @__PURE__ */ jsx(
12499
- Form$2.Field,
12500
- {
12501
- control: form.control,
12502
- name: "province",
12503
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12504
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12505
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12506
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12507
- ] })
12508
- }
12509
- ),
12510
- /* @__PURE__ */ jsx(
12511
- Form$2.Field,
12512
- {
12513
- control: form.control,
12514
- name: "phone",
12515
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12516
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12517
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12518
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12519
- ] })
12520
- }
12521
- )
12522
- ] }) }),
12523
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12524
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12525
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12526
- ] }) })
12527
- ]
12528
- }
12529
- ) });
12530
- };
12531
- const schema$2 = addressSchema;
12532
12350
  const TransferOwnership = () => {
12533
12351
  const { id } = useParams();
12534
12352
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -13005,27 +12823,209 @@ const Illustration = () => {
13005
12823
  const schema$1 = objectType({
13006
12824
  customer_id: stringType().min(1)
13007
12825
  });
13008
- const CustomItems = () => {
12826
+ const ShippingAddress = () => {
12827
+ const { id } = useParams();
12828
+ const { order, isPending, isError, error } = useOrder(id, {
12829
+ fields: "+shipping_address"
12830
+ });
12831
+ if (isError) {
12832
+ throw error;
12833
+ }
12834
+ const isReady = !isPending && !!order;
13009
12835
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
13010
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
13011
- /* @__PURE__ */ jsx(CustomItemsForm, {})
12836
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12837
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12838
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12839
+ ] }),
12840
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
13012
12841
  ] });
13013
12842
  };
13014
- const CustomItemsForm = () => {
12843
+ const ShippingAddressForm = ({ order }) => {
12844
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
13015
12845
  const form = useForm({
12846
+ defaultValues: {
12847
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12848
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12849
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12850
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12851
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12852
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12853
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12854
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12855
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12856
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12857
+ },
13016
12858
  resolver: zodResolver(schema)
13017
12859
  });
13018
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13019
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
13020
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13021
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13022
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
13023
- ] }) })
13024
- ] }) });
12860
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12861
+ const { handleSuccess } = useRouteModal();
12862
+ const onSubmit = form.handleSubmit(async (data) => {
12863
+ await mutateAsync(
12864
+ {
12865
+ shipping_address: {
12866
+ first_name: data.first_name,
12867
+ last_name: data.last_name,
12868
+ company: data.company,
12869
+ address_1: data.address_1,
12870
+ address_2: data.address_2,
12871
+ city: data.city,
12872
+ province: data.province,
12873
+ country_code: data.country_code,
12874
+ postal_code: data.postal_code,
12875
+ phone: data.phone
12876
+ }
12877
+ },
12878
+ {
12879
+ onSuccess: () => {
12880
+ handleSuccess();
12881
+ },
12882
+ onError: (error) => {
12883
+ toast.error(error.message);
12884
+ }
12885
+ }
12886
+ );
12887
+ });
12888
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12889
+ KeyboundForm,
12890
+ {
12891
+ className: "flex flex-1 flex-col overflow-hidden",
12892
+ onSubmit,
12893
+ children: [
12894
+ /* @__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: [
12895
+ /* @__PURE__ */ jsx(
12896
+ Form$2.Field,
12897
+ {
12898
+ control: form.control,
12899
+ name: "country_code",
12900
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12901
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12902
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12903
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12904
+ ] })
12905
+ }
12906
+ ),
12907
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12908
+ /* @__PURE__ */ jsx(
12909
+ Form$2.Field,
12910
+ {
12911
+ control: form.control,
12912
+ name: "first_name",
12913
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12914
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12915
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12916
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12917
+ ] })
12918
+ }
12919
+ ),
12920
+ /* @__PURE__ */ jsx(
12921
+ Form$2.Field,
12922
+ {
12923
+ control: form.control,
12924
+ name: "last_name",
12925
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12926
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12927
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12928
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12929
+ ] })
12930
+ }
12931
+ )
12932
+ ] }),
12933
+ /* @__PURE__ */ jsx(
12934
+ Form$2.Field,
12935
+ {
12936
+ control: form.control,
12937
+ name: "company",
12938
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12939
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12940
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12941
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12942
+ ] })
12943
+ }
12944
+ ),
12945
+ /* @__PURE__ */ jsx(
12946
+ Form$2.Field,
12947
+ {
12948
+ control: form.control,
12949
+ name: "address_1",
12950
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12951
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12952
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12953
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12954
+ ] })
12955
+ }
12956
+ ),
12957
+ /* @__PURE__ */ jsx(
12958
+ Form$2.Field,
12959
+ {
12960
+ control: form.control,
12961
+ name: "address_2",
12962
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12963
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12964
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12965
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12966
+ ] })
12967
+ }
12968
+ ),
12969
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12970
+ /* @__PURE__ */ jsx(
12971
+ Form$2.Field,
12972
+ {
12973
+ control: form.control,
12974
+ name: "postal_code",
12975
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12976
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12977
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12978
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12979
+ ] })
12980
+ }
12981
+ ),
12982
+ /* @__PURE__ */ jsx(
12983
+ Form$2.Field,
12984
+ {
12985
+ control: form.control,
12986
+ name: "city",
12987
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12988
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12989
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12990
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12991
+ ] })
12992
+ }
12993
+ )
12994
+ ] }),
12995
+ /* @__PURE__ */ jsx(
12996
+ Form$2.Field,
12997
+ {
12998
+ control: form.control,
12999
+ name: "province",
13000
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13001
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13002
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13003
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13004
+ ] })
13005
+ }
13006
+ ),
13007
+ /* @__PURE__ */ jsx(
13008
+ Form$2.Field,
13009
+ {
13010
+ control: form.control,
13011
+ name: "phone",
13012
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13013
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13014
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13015
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13016
+ ] })
13017
+ }
13018
+ )
13019
+ ] }) }),
13020
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13021
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13022
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13023
+ ] }) })
13024
+ ]
13025
+ }
13026
+ ) });
13025
13027
  };
13026
- const schema = objectType({
13027
- email: stringType().email()
13028
- });
13028
+ const schema = addressSchema;
13029
13029
  const widgetModule = { widgets: [] };
13030
13030
  const routeModule = {
13031
13031
  routes: [
@@ -13050,6 +13050,10 @@ const routeModule = {
13050
13050
  Component: BillingAddress,
13051
13051
  path: "/draft-orders/:id/billing-address"
13052
13052
  },
13053
+ {
13054
+ Component: CustomItems,
13055
+ path: "/draft-orders/:id/custom-items"
13056
+ },
13053
13057
  {
13054
13058
  Component: Email,
13055
13059
  path: "/draft-orders/:id/email"
@@ -13074,17 +13078,13 @@ const routeModule = {
13074
13078
  Component: Shipping,
13075
13079
  path: "/draft-orders/:id/shipping"
13076
13080
  },
13077
- {
13078
- Component: ShippingAddress,
13079
- path: "/draft-orders/:id/shipping-address"
13080
- },
13081
13081
  {
13082
13082
  Component: TransferOwnership,
13083
13083
  path: "/draft-orders/:id/transfer-ownership"
13084
13084
  },
13085
13085
  {
13086
- Component: CustomItems,
13087
- path: "/draft-orders/:id/custom-items"
13086
+ Component: ShippingAddress,
13087
+ path: "/draft-orders/:id/shipping-address"
13088
13088
  }
13089
13089
  ]
13090
13090
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.10.0-snapshot-20250828113245",
3
+ "version": "2.10.0-snapshot-20250828114928",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -27,16 +27,10 @@
27
27
  "medusa-plugin",
28
28
  "medusa-v2"
29
29
  ],
30
- "scripts": {
31
- "build": "medusa plugin:build",
32
- "dev": "medusa plugin:develop",
33
- "prepare": "cross-env NODE_ENV=production yarn run build",
34
- "link:watch": "medusa plugin:publish && medusa plugin:develop"
35
- },
36
30
  "dependencies": {
37
31
  "@ariakit/react": "^0.4.15",
38
32
  "@hookform/resolvers": "3.4.2",
39
- "@medusajs/js-sdk": "2.10.0-snapshot-20250828113245",
33
+ "@medusajs/js-sdk": "2.10.0-snapshot-20250828114928",
40
34
  "@tanstack/react-query": "5.64.2",
41
35
  "@uiw/react-json-view": "^2.0.0-alpha.17",
42
36
  "date-fns": "^3.6.0",
@@ -45,15 +39,14 @@
45
39
  "react-hook-form": "7.49.1"
46
40
  },
47
41
  "devDependencies": {
48
- "@medusajs/admin-sdk": "2.10.0-snapshot-20250828113245",
49
- "@medusajs/cli": "2.10.0-snapshot-20250828113245",
50
- "@medusajs/framework": "2.10.0-snapshot-20250828113245",
51
- "@medusajs/icons": "2.10.0-snapshot-20250828113245",
52
- "@medusajs/medusa": "2.10.0-snapshot-20250828113245",
53
- "@medusajs/test-utils": "2.10.0-snapshot-20250828113245",
54
- "@medusajs/types": "2.10.0-snapshot-20250828113245",
55
- "@medusajs/ui": "4.0.20-snapshot-20250828113245",
56
- "@medusajs/ui-preset": "2.10.0-snapshot-20250828113245",
42
+ "@medusajs/admin-sdk": "2.10.0-snapshot-20250828114928",
43
+ "@medusajs/cli": "2.10.0-snapshot-20250828114928",
44
+ "@medusajs/framework": "2.10.0-snapshot-20250828114928",
45
+ "@medusajs/icons": "2.10.0-snapshot-20250828114928",
46
+ "@medusajs/test-utils": "2.10.0-snapshot-20250828114928",
47
+ "@medusajs/types": "2.10.0-snapshot-20250828114928",
48
+ "@medusajs/ui": "4.0.20-snapshot-20250828114928",
49
+ "@medusajs/ui-preset": "2.10.0-snapshot-20250828114928",
57
50
  "@mikro-orm/cli": "6.4.3",
58
51
  "@mikro-orm/core": "6.4.3",
59
52
  "@mikro-orm/knex": "6.4.3",
@@ -77,13 +70,12 @@
77
70
  "yalc": "^1.0.0-pre.53"
78
71
  },
79
72
  "peerDependencies": {
80
- "@medusajs/admin-sdk": "2.10.0-snapshot-20250828113245",
81
- "@medusajs/cli": "2.10.0-snapshot-20250828113245",
82
- "@medusajs/framework": "2.10.0-snapshot-20250828113245",
83
- "@medusajs/icons": "2.10.0-snapshot-20250828113245",
84
- "@medusajs/medusa": "2.10.0-snapshot-20250828113245",
85
- "@medusajs/test-utils": "2.10.0-snapshot-20250828113245",
86
- "@medusajs/ui": "4.0.20-snapshot-20250828113245",
73
+ "@medusajs/admin-sdk": "2.10.0-snapshot-20250828114928",
74
+ "@medusajs/cli": "2.10.0-snapshot-20250828114928",
75
+ "@medusajs/framework": "2.10.0-snapshot-20250828114928",
76
+ "@medusajs/icons": "2.10.0-snapshot-20250828114928",
77
+ "@medusajs/test-utils": "2.10.0-snapshot-20250828114928",
78
+ "@medusajs/ui": "4.0.20-snapshot-20250828114928",
87
79
  "@mikro-orm/cli": "6.4.3",
88
80
  "@mikro-orm/core": "6.4.3",
89
81
  "@mikro-orm/knex": "6.4.3",
@@ -97,5 +89,10 @@
97
89
  "engines": {
98
90
  "node": ">=20"
99
91
  },
100
- "packageManager": "yarn@3.2.1"
101
- }
92
+ "packageManager": "yarn@3.2.1",
93
+ "scripts": {
94
+ "build": "medusa plugin:build",
95
+ "dev": "medusa plugin:develop",
96
+ "link:watch": "medusa plugin:publish && medusa plugin:develop"
97
+ }
98
+ }