@medusajs/draft-order 2.10.4-snapshot-20251009094748 → 2.10.4-snapshot-20251009122659

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.
@@ -9763,27 +9763,6 @@ const BillingAddressForm = ({ order }) => {
9763
9763
  ) });
9764
9764
  };
9765
9765
  const schema$5 = addressSchema;
9766
- const CustomItems = () => {
9767
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9768
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9769
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9770
- ] });
9771
- };
9772
- const CustomItemsForm = () => {
9773
- const form = reactHookForm.useForm({
9774
- resolver: zod.zodResolver(schema$4)
9775
- });
9776
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9777
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9778
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9779
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9780
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9781
- ] }) })
9782
- ] }) });
9783
- };
9784
- const schema$4 = objectType({
9785
- email: stringType().email()
9786
- });
9787
9766
  const Email = () => {
9788
9767
  const { id } = reactRouterDom.useParams();
9789
9768
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9806,7 +9785,7 @@ const EmailForm = ({ order }) => {
9806
9785
  defaultValues: {
9807
9786
  email: order.email ?? ""
9808
9787
  },
9809
- resolver: zod.zodResolver(schema$3)
9788
+ resolver: zod.zodResolver(schema$4)
9810
9789
  });
9811
9790
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9812
9791
  const { handleSuccess } = useRouteModal();
@@ -9849,7 +9828,7 @@ const EmailForm = ({ order }) => {
9849
9828
  }
9850
9829
  ) });
9851
9830
  };
9852
- const schema$3 = objectType({
9831
+ const schema$4 = objectType({
9853
9832
  email: stringType().email()
9854
9833
  });
9855
9834
  const NumberInput = React.forwardRef(
@@ -11481,7 +11460,7 @@ const SalesChannelForm = ({ order }) => {
11481
11460
  defaultValues: {
11482
11461
  sales_channel_id: order.sales_channel_id || ""
11483
11462
  },
11484
- resolver: zod.zodResolver(schema$2)
11463
+ resolver: zod.zodResolver(schema$3)
11485
11464
  });
11486
11465
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11487
11466
  const { handleSuccess } = useRouteModal();
@@ -11556,7 +11535,7 @@ const SalesChannelField = ({ control, order }) => {
11556
11535
  }
11557
11536
  );
11558
11537
  };
11559
- const schema$2 = objectType({
11538
+ const schema$3 = objectType({
11560
11539
  sales_channel_id: stringType().min(1)
11561
11540
  });
11562
11541
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12366,6 +12345,209 @@ const CustomAmountField = ({
12366
12345
  }
12367
12346
  );
12368
12347
  };
12348
+ const ShippingAddress = () => {
12349
+ const { id } = reactRouterDom.useParams();
12350
+ const { order, isPending, isError, error } = useOrder(id, {
12351
+ fields: "+shipping_address"
12352
+ });
12353
+ if (isError) {
12354
+ throw error;
12355
+ }
12356
+ const isReady = !isPending && !!order;
12357
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12358
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12359
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12360
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12361
+ ] }),
12362
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12363
+ ] });
12364
+ };
12365
+ const ShippingAddressForm = ({ order }) => {
12366
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12367
+ const form = reactHookForm.useForm({
12368
+ defaultValues: {
12369
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12370
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12371
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12372
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12373
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12374
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12375
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12376
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12377
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12378
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12379
+ },
12380
+ resolver: zod.zodResolver(schema$2)
12381
+ });
12382
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12383
+ const { handleSuccess } = useRouteModal();
12384
+ const onSubmit = form.handleSubmit(async (data) => {
12385
+ await mutateAsync(
12386
+ {
12387
+ shipping_address: {
12388
+ first_name: data.first_name,
12389
+ last_name: data.last_name,
12390
+ company: data.company,
12391
+ address_1: data.address_1,
12392
+ address_2: data.address_2,
12393
+ city: data.city,
12394
+ province: data.province,
12395
+ country_code: data.country_code,
12396
+ postal_code: data.postal_code,
12397
+ phone: data.phone
12398
+ }
12399
+ },
12400
+ {
12401
+ onSuccess: () => {
12402
+ handleSuccess();
12403
+ },
12404
+ onError: (error) => {
12405
+ ui.toast.error(error.message);
12406
+ }
12407
+ }
12408
+ );
12409
+ });
12410
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12411
+ KeyboundForm,
12412
+ {
12413
+ className: "flex flex-1 flex-col overflow-hidden",
12414
+ onSubmit,
12415
+ children: [
12416
+ /* @__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: [
12417
+ /* @__PURE__ */ jsxRuntime.jsx(
12418
+ Form$2.Field,
12419
+ {
12420
+ control: form.control,
12421
+ name: "country_code",
12422
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12423
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12424
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12425
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12426
+ ] })
12427
+ }
12428
+ ),
12429
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12430
+ /* @__PURE__ */ jsxRuntime.jsx(
12431
+ Form$2.Field,
12432
+ {
12433
+ control: form.control,
12434
+ name: "first_name",
12435
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12436
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12437
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12438
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12439
+ ] })
12440
+ }
12441
+ ),
12442
+ /* @__PURE__ */ jsxRuntime.jsx(
12443
+ Form$2.Field,
12444
+ {
12445
+ control: form.control,
12446
+ name: "last_name",
12447
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12448
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
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
+ ] }),
12455
+ /* @__PURE__ */ jsxRuntime.jsx(
12456
+ Form$2.Field,
12457
+ {
12458
+ control: form.control,
12459
+ name: "company",
12460
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12461
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12462
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12463
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12464
+ ] })
12465
+ }
12466
+ ),
12467
+ /* @__PURE__ */ jsxRuntime.jsx(
12468
+ Form$2.Field,
12469
+ {
12470
+ control: form.control,
12471
+ name: "address_1",
12472
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12473
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12474
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12475
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12476
+ ] })
12477
+ }
12478
+ ),
12479
+ /* @__PURE__ */ jsxRuntime.jsx(
12480
+ Form$2.Field,
12481
+ {
12482
+ control: form.control,
12483
+ name: "address_2",
12484
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12485
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
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.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12492
+ /* @__PURE__ */ jsxRuntime.jsx(
12493
+ Form$2.Field,
12494
+ {
12495
+ control: form.control,
12496
+ name: "postal_code",
12497
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12498
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12499
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12500
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12501
+ ] })
12502
+ }
12503
+ ),
12504
+ /* @__PURE__ */ jsxRuntime.jsx(
12505
+ Form$2.Field,
12506
+ {
12507
+ control: form.control,
12508
+ name: "city",
12509
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12510
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
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
+ ] }),
12517
+ /* @__PURE__ */ jsxRuntime.jsx(
12518
+ Form$2.Field,
12519
+ {
12520
+ control: form.control,
12521
+ name: "province",
12522
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12523
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12524
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12525
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12526
+ ] })
12527
+ }
12528
+ ),
12529
+ /* @__PURE__ */ jsxRuntime.jsx(
12530
+ Form$2.Field,
12531
+ {
12532
+ control: form.control,
12533
+ name: "phone",
12534
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12535
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12536
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12537
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12538
+ ] })
12539
+ }
12540
+ )
12541
+ ] }) }),
12542
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12543
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12544
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12545
+ ] }) })
12546
+ ]
12547
+ }
12548
+ ) });
12549
+ };
12550
+ const schema$2 = addressSchema;
12369
12551
  const TransferOwnership = () => {
12370
12552
  const { id } = reactRouterDom.useParams();
12371
12553
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12842,209 +13024,27 @@ const Illustration = () => {
12842
13024
  const schema$1 = objectType({
12843
13025
  customer_id: stringType().min(1)
12844
13026
  });
12845
- const ShippingAddress = () => {
12846
- const { id } = reactRouterDom.useParams();
12847
- const { order, isPending, isError, error } = useOrder(id, {
12848
- fields: "+shipping_address"
12849
- });
12850
- if (isError) {
12851
- throw error;
12852
- }
12853
- const isReady = !isPending && !!order;
13027
+ const CustomItems = () => {
12854
13028
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12855
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12856
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12857
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12858
- ] }),
12859
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
13029
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
13030
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
12860
13031
  ] });
12861
13032
  };
12862
- const ShippingAddressForm = ({ order }) => {
12863
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
13033
+ const CustomItemsForm = () => {
12864
13034
  const form = reactHookForm.useForm({
12865
- defaultValues: {
12866
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12867
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12868
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12869
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12870
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12871
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12872
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12873
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12874
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12875
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12876
- },
12877
13035
  resolver: zod.zodResolver(schema)
12878
13036
  });
12879
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12880
- const { handleSuccess } = useRouteModal();
12881
- const onSubmit = form.handleSubmit(async (data) => {
12882
- await mutateAsync(
12883
- {
12884
- shipping_address: {
12885
- first_name: data.first_name,
12886
- last_name: data.last_name,
12887
- company: data.company,
12888
- address_1: data.address_1,
12889
- address_2: data.address_2,
12890
- city: data.city,
12891
- province: data.province,
12892
- country_code: data.country_code,
12893
- postal_code: data.postal_code,
12894
- phone: data.phone
12895
- }
12896
- },
12897
- {
12898
- onSuccess: () => {
12899
- handleSuccess();
12900
- },
12901
- onError: (error) => {
12902
- ui.toast.error(error.message);
12903
- }
12904
- }
12905
- );
12906
- });
12907
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12908
- KeyboundForm,
12909
- {
12910
- className: "flex flex-1 flex-col overflow-hidden",
12911
- onSubmit,
12912
- children: [
12913
- /* @__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: [
12914
- /* @__PURE__ */ jsxRuntime.jsx(
12915
- Form$2.Field,
12916
- {
12917
- control: form.control,
12918
- name: "country_code",
12919
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12920
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12921
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12922
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12923
- ] })
12924
- }
12925
- ),
12926
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12927
- /* @__PURE__ */ jsxRuntime.jsx(
12928
- Form$2.Field,
12929
- {
12930
- control: form.control,
12931
- name: "first_name",
12932
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12933
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12934
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12935
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12936
- ] })
12937
- }
12938
- ),
12939
- /* @__PURE__ */ jsxRuntime.jsx(
12940
- Form$2.Field,
12941
- {
12942
- control: form.control,
12943
- name: "last_name",
12944
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12945
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
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
- ] }),
12952
- /* @__PURE__ */ jsxRuntime.jsx(
12953
- Form$2.Field,
12954
- {
12955
- control: form.control,
12956
- name: "company",
12957
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12958
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12959
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12960
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12961
- ] })
12962
- }
12963
- ),
12964
- /* @__PURE__ */ jsxRuntime.jsx(
12965
- Form$2.Field,
12966
- {
12967
- control: form.control,
12968
- name: "address_1",
12969
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12970
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12971
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12972
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12973
- ] })
12974
- }
12975
- ),
12976
- /* @__PURE__ */ jsxRuntime.jsx(
12977
- Form$2.Field,
12978
- {
12979
- control: form.control,
12980
- name: "address_2",
12981
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12982
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
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.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12989
- /* @__PURE__ */ jsxRuntime.jsx(
12990
- Form$2.Field,
12991
- {
12992
- control: form.control,
12993
- name: "postal_code",
12994
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12995
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12996
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12997
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12998
- ] })
12999
- }
13000
- ),
13001
- /* @__PURE__ */ jsxRuntime.jsx(
13002
- Form$2.Field,
13003
- {
13004
- control: form.control,
13005
- name: "city",
13006
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13007
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
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
- ] }),
13014
- /* @__PURE__ */ jsxRuntime.jsx(
13015
- Form$2.Field,
13016
- {
13017
- control: form.control,
13018
- name: "province",
13019
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13020
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13021
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13022
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13023
- ] })
13024
- }
13025
- ),
13026
- /* @__PURE__ */ jsxRuntime.jsx(
13027
- Form$2.Field,
13028
- {
13029
- control: form.control,
13030
- name: "phone",
13031
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13032
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13033
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13034
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13035
- ] })
13036
- }
13037
- )
13038
- ] }) }),
13039
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13040
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13041
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13042
- ] }) })
13043
- ]
13044
- }
13045
- ) });
13037
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13038
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
13039
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13040
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13041
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
13042
+ ] }) })
13043
+ ] }) });
13046
13044
  };
13047
- const schema = addressSchema;
13045
+ const schema = objectType({
13046
+ email: stringType().email()
13047
+ });
13048
13048
  const widgetModule = { widgets: [] };
13049
13049
  const routeModule = {
13050
13050
  routes: [
@@ -13069,10 +13069,6 @@ const routeModule = {
13069
13069
  Component: BillingAddress,
13070
13070
  path: "/draft-orders/:id/billing-address"
13071
13071
  },
13072
- {
13073
- Component: CustomItems,
13074
- path: "/draft-orders/:id/custom-items"
13075
- },
13076
13072
  {
13077
13073
  Component: Email,
13078
13074
  path: "/draft-orders/:id/email"
@@ -13097,13 +13093,17 @@ const routeModule = {
13097
13093
  Component: Shipping,
13098
13094
  path: "/draft-orders/:id/shipping"
13099
13095
  },
13096
+ {
13097
+ Component: ShippingAddress,
13098
+ path: "/draft-orders/:id/shipping-address"
13099
+ },
13100
13100
  {
13101
13101
  Component: TransferOwnership,
13102
13102
  path: "/draft-orders/:id/transfer-ownership"
13103
13103
  },
13104
13104
  {
13105
- Component: ShippingAddress,
13106
- path: "/draft-orders/:id/shipping-address"
13105
+ Component: CustomItems,
13106
+ path: "/draft-orders/:id/custom-items"
13107
13107
  }
13108
13108
  ]
13109
13109
  }
@@ -9757,27 +9757,6 @@ const BillingAddressForm = ({ order }) => {
9757
9757
  ) });
9758
9758
  };
9759
9759
  const schema$5 = addressSchema;
9760
- const CustomItems = () => {
9761
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9762
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9763
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9764
- ] });
9765
- };
9766
- const CustomItemsForm = () => {
9767
- const form = useForm({
9768
- resolver: zodResolver(schema$4)
9769
- });
9770
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9771
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9772
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9773
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9774
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9775
- ] }) })
9776
- ] }) });
9777
- };
9778
- const schema$4 = objectType({
9779
- email: stringType().email()
9780
- });
9781
9760
  const Email = () => {
9782
9761
  const { id } = useParams();
9783
9762
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9800,7 +9779,7 @@ const EmailForm = ({ order }) => {
9800
9779
  defaultValues: {
9801
9780
  email: order.email ?? ""
9802
9781
  },
9803
- resolver: zodResolver(schema$3)
9782
+ resolver: zodResolver(schema$4)
9804
9783
  });
9805
9784
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9806
9785
  const { handleSuccess } = useRouteModal();
@@ -9843,7 +9822,7 @@ const EmailForm = ({ order }) => {
9843
9822
  }
9844
9823
  ) });
9845
9824
  };
9846
- const schema$3 = objectType({
9825
+ const schema$4 = objectType({
9847
9826
  email: stringType().email()
9848
9827
  });
9849
9828
  const NumberInput = forwardRef(
@@ -11475,7 +11454,7 @@ const SalesChannelForm = ({ order }) => {
11475
11454
  defaultValues: {
11476
11455
  sales_channel_id: order.sales_channel_id || ""
11477
11456
  },
11478
- resolver: zodResolver(schema$2)
11457
+ resolver: zodResolver(schema$3)
11479
11458
  });
11480
11459
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11481
11460
  const { handleSuccess } = useRouteModal();
@@ -11550,7 +11529,7 @@ const SalesChannelField = ({ control, order }) => {
11550
11529
  }
11551
11530
  );
11552
11531
  };
11553
- const schema$2 = objectType({
11532
+ const schema$3 = objectType({
11554
11533
  sales_channel_id: stringType().min(1)
11555
11534
  });
11556
11535
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12360,6 +12339,209 @@ const CustomAmountField = ({
12360
12339
  }
12361
12340
  );
12362
12341
  };
12342
+ const ShippingAddress = () => {
12343
+ const { id } = useParams();
12344
+ const { order, isPending, isError, error } = useOrder(id, {
12345
+ fields: "+shipping_address"
12346
+ });
12347
+ if (isError) {
12348
+ throw error;
12349
+ }
12350
+ const isReady = !isPending && !!order;
12351
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12352
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12353
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12354
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12355
+ ] }),
12356
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12357
+ ] });
12358
+ };
12359
+ const ShippingAddressForm = ({ order }) => {
12360
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12361
+ const form = useForm({
12362
+ defaultValues: {
12363
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12364
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12365
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12366
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12367
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12368
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12369
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12370
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12371
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12372
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12373
+ },
12374
+ resolver: zodResolver(schema$2)
12375
+ });
12376
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12377
+ const { handleSuccess } = useRouteModal();
12378
+ const onSubmit = form.handleSubmit(async (data) => {
12379
+ await mutateAsync(
12380
+ {
12381
+ shipping_address: {
12382
+ first_name: data.first_name,
12383
+ last_name: data.last_name,
12384
+ company: data.company,
12385
+ address_1: data.address_1,
12386
+ address_2: data.address_2,
12387
+ city: data.city,
12388
+ province: data.province,
12389
+ country_code: data.country_code,
12390
+ postal_code: data.postal_code,
12391
+ phone: data.phone
12392
+ }
12393
+ },
12394
+ {
12395
+ onSuccess: () => {
12396
+ handleSuccess();
12397
+ },
12398
+ onError: (error) => {
12399
+ toast.error(error.message);
12400
+ }
12401
+ }
12402
+ );
12403
+ });
12404
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12405
+ KeyboundForm,
12406
+ {
12407
+ className: "flex flex-1 flex-col overflow-hidden",
12408
+ onSubmit,
12409
+ children: [
12410
+ /* @__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: [
12411
+ /* @__PURE__ */ jsx(
12412
+ Form$2.Field,
12413
+ {
12414
+ control: form.control,
12415
+ name: "country_code",
12416
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12417
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12418
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12419
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12420
+ ] })
12421
+ }
12422
+ ),
12423
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12424
+ /* @__PURE__ */ jsx(
12425
+ Form$2.Field,
12426
+ {
12427
+ control: form.control,
12428
+ name: "first_name",
12429
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12430
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12431
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12432
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12433
+ ] })
12434
+ }
12435
+ ),
12436
+ /* @__PURE__ */ jsx(
12437
+ Form$2.Field,
12438
+ {
12439
+ control: form.control,
12440
+ name: "last_name",
12441
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12442
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12443
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12444
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12445
+ ] })
12446
+ }
12447
+ )
12448
+ ] }),
12449
+ /* @__PURE__ */ jsx(
12450
+ Form$2.Field,
12451
+ {
12452
+ control: form.control,
12453
+ name: "company",
12454
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12455
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12456
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12457
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12458
+ ] })
12459
+ }
12460
+ ),
12461
+ /* @__PURE__ */ jsx(
12462
+ Form$2.Field,
12463
+ {
12464
+ control: form.control,
12465
+ name: "address_1",
12466
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12467
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12468
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12469
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12470
+ ] })
12471
+ }
12472
+ ),
12473
+ /* @__PURE__ */ jsx(
12474
+ Form$2.Field,
12475
+ {
12476
+ control: form.control,
12477
+ name: "address_2",
12478
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12479
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12480
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12481
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12482
+ ] })
12483
+ }
12484
+ ),
12485
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12486
+ /* @__PURE__ */ jsx(
12487
+ Form$2.Field,
12488
+ {
12489
+ control: form.control,
12490
+ name: "postal_code",
12491
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12492
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12493
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12494
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12495
+ ] })
12496
+ }
12497
+ ),
12498
+ /* @__PURE__ */ jsx(
12499
+ Form$2.Field,
12500
+ {
12501
+ control: form.control,
12502
+ name: "city",
12503
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12504
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12505
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12506
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12507
+ ] })
12508
+ }
12509
+ )
12510
+ ] }),
12511
+ /* @__PURE__ */ jsx(
12512
+ Form$2.Field,
12513
+ {
12514
+ control: form.control,
12515
+ name: "province",
12516
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12517
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12518
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12519
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12520
+ ] })
12521
+ }
12522
+ ),
12523
+ /* @__PURE__ */ jsx(
12524
+ Form$2.Field,
12525
+ {
12526
+ control: form.control,
12527
+ name: "phone",
12528
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12529
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12530
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12531
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12532
+ ] })
12533
+ }
12534
+ )
12535
+ ] }) }),
12536
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12537
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12538
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12539
+ ] }) })
12540
+ ]
12541
+ }
12542
+ ) });
12543
+ };
12544
+ const schema$2 = addressSchema;
12363
12545
  const TransferOwnership = () => {
12364
12546
  const { id } = useParams();
12365
12547
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12836,209 +13018,27 @@ const Illustration = () => {
12836
13018
  const schema$1 = objectType({
12837
13019
  customer_id: stringType().min(1)
12838
13020
  });
12839
- const ShippingAddress = () => {
12840
- const { id } = useParams();
12841
- const { order, isPending, isError, error } = useOrder(id, {
12842
- fields: "+shipping_address"
12843
- });
12844
- if (isError) {
12845
- throw error;
12846
- }
12847
- const isReady = !isPending && !!order;
13021
+ const CustomItems = () => {
12848
13022
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12849
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12850
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12851
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12852
- ] }),
12853
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
13023
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
13024
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
12854
13025
  ] });
12855
13026
  };
12856
- const ShippingAddressForm = ({ order }) => {
12857
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
13027
+ const CustomItemsForm = () => {
12858
13028
  const form = useForm({
12859
- defaultValues: {
12860
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12861
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12862
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12863
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12864
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12865
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12866
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12867
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12868
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12869
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12870
- },
12871
13029
  resolver: zodResolver(schema)
12872
13030
  });
12873
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12874
- const { handleSuccess } = useRouteModal();
12875
- const onSubmit = form.handleSubmit(async (data) => {
12876
- await mutateAsync(
12877
- {
12878
- shipping_address: {
12879
- first_name: data.first_name,
12880
- last_name: data.last_name,
12881
- company: data.company,
12882
- address_1: data.address_1,
12883
- address_2: data.address_2,
12884
- city: data.city,
12885
- province: data.province,
12886
- country_code: data.country_code,
12887
- postal_code: data.postal_code,
12888
- phone: data.phone
12889
- }
12890
- },
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
- ) });
13031
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13032
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
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", children: "Save" })
13036
+ ] }) })
13037
+ ] }) });
13040
13038
  };
13041
- const schema = addressSchema;
13039
+ const schema = objectType({
13040
+ email: stringType().email()
13041
+ });
13042
13042
  const widgetModule = { widgets: [] };
13043
13043
  const routeModule = {
13044
13044
  routes: [
@@ -13063,10 +13063,6 @@ const routeModule = {
13063
13063
  Component: BillingAddress,
13064
13064
  path: "/draft-orders/:id/billing-address"
13065
13065
  },
13066
- {
13067
- Component: CustomItems,
13068
- path: "/draft-orders/:id/custom-items"
13069
- },
13070
13066
  {
13071
13067
  Component: Email,
13072
13068
  path: "/draft-orders/:id/email"
@@ -13091,13 +13087,17 @@ const routeModule = {
13091
13087
  Component: Shipping,
13092
13088
  path: "/draft-orders/:id/shipping"
13093
13089
  },
13090
+ {
13091
+ Component: ShippingAddress,
13092
+ path: "/draft-orders/:id/shipping-address"
13093
+ },
13094
13094
  {
13095
13095
  Component: TransferOwnership,
13096
13096
  path: "/draft-orders/:id/transfer-ownership"
13097
13097
  },
13098
13098
  {
13099
- Component: ShippingAddress,
13100
- path: "/draft-orders/:id/shipping-address"
13099
+ Component: CustomItems,
13100
+ path: "/draft-orders/:id/custom-items"
13101
13101
  }
13102
13102
  ]
13103
13103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.10.4-snapshot-20251009094748",
3
+ "version": "2.10.4-snapshot-20251009122659",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@ariakit/react": "^0.4.15",
38
38
  "@hookform/resolvers": "3.4.2",
39
- "@medusajs/js-sdk": "2.10.4-snapshot-20251009094748",
39
+ "@medusajs/js-sdk": "2.10.4-snapshot-20251009122659",
40
40
  "@tanstack/react-query": "5.64.2",
41
41
  "@uiw/react-json-view": "^2.0.0-alpha.17",
42
42
  "date-fns": "^3.6.0",
@@ -45,14 +45,14 @@
45
45
  "react-hook-form": "7.49.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@medusajs/admin-sdk": "2.10.4-snapshot-20251009094748",
49
- "@medusajs/cli": "2.10.4-snapshot-20251009094748",
50
- "@medusajs/framework": "2.10.4-snapshot-20251009094748",
51
- "@medusajs/icons": "2.10.4-snapshot-20251009094748",
52
- "@medusajs/test-utils": "2.10.4-snapshot-20251009094748",
53
- "@medusajs/types": "2.10.4-snapshot-20251009094748",
54
- "@medusajs/ui": "4.0.24-snapshot-20251009094748",
55
- "@medusajs/ui-preset": "2.10.4-snapshot-20251009094748",
48
+ "@medusajs/admin-sdk": "2.10.4-snapshot-20251009122659",
49
+ "@medusajs/cli": "2.10.4-snapshot-20251009122659",
50
+ "@medusajs/framework": "2.10.4-snapshot-20251009122659",
51
+ "@medusajs/icons": "2.10.4-snapshot-20251009122659",
52
+ "@medusajs/test-utils": "2.10.4-snapshot-20251009122659",
53
+ "@medusajs/types": "2.10.4-snapshot-20251009122659",
54
+ "@medusajs/ui": "4.0.24-snapshot-20251009122659",
55
+ "@medusajs/ui-preset": "2.10.4-snapshot-20251009122659",
56
56
  "@swc/core": "1.5.7",
57
57
  "@types/lodash": "^4.17.15",
58
58
  "@types/node": "^20.0.0",
@@ -69,12 +69,12 @@
69
69
  "yalc": "^1.0.0-pre.53"
70
70
  },
71
71
  "peerDependencies": {
72
- "@medusajs/admin-sdk": "2.10.4-snapshot-20251009094748",
73
- "@medusajs/cli": "2.10.4-snapshot-20251009094748",
74
- "@medusajs/framework": "2.10.4-snapshot-20251009094748",
75
- "@medusajs/icons": "2.10.4-snapshot-20251009094748",
76
- "@medusajs/test-utils": "2.10.4-snapshot-20251009094748",
77
- "@medusajs/ui": "4.0.24-snapshot-20251009094748",
72
+ "@medusajs/admin-sdk": "2.10.4-snapshot-20251009122659",
73
+ "@medusajs/cli": "2.10.4-snapshot-20251009122659",
74
+ "@medusajs/framework": "2.10.4-snapshot-20251009122659",
75
+ "@medusajs/icons": "2.10.4-snapshot-20251009122659",
76
+ "@medusajs/test-utils": "2.10.4-snapshot-20251009122659",
77
+ "@medusajs/ui": "4.0.24-snapshot-20251009122659",
78
78
  "lodash": "^4.17.21",
79
79
  "react-router-dom": "6.20.1"
80
80
  },