@medusajs/draft-order 2.11.4-snapshot-20251106122834 → 2.11.4-snapshot-20251107094001

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.
@@ -9758,27 +9758,6 @@ const BillingAddressForm = ({ order }) => {
9758
9758
  ) });
9759
9759
  };
9760
9760
  const schema$5 = addressSchema;
9761
- const CustomItems = () => {
9762
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9763
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9764
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9765
- ] });
9766
- };
9767
- const CustomItemsForm = () => {
9768
- const form = reactHookForm.useForm({
9769
- resolver: zod.zodResolver(schema$4)
9770
- });
9771
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9772
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9773
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9774
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9775
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9776
- ] }) })
9777
- ] }) });
9778
- };
9779
- const schema$4 = objectType({
9780
- email: stringType().email()
9781
- });
9782
9761
  const Email = () => {
9783
9762
  const { id } = reactRouterDom.useParams();
9784
9763
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9801,7 +9780,7 @@ const EmailForm = ({ order }) => {
9801
9780
  defaultValues: {
9802
9781
  email: order.email ?? ""
9803
9782
  },
9804
- resolver: zod.zodResolver(schema$3)
9783
+ resolver: zod.zodResolver(schema$4)
9805
9784
  });
9806
9785
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9807
9786
  const { handleSuccess } = useRouteModal();
@@ -9844,6 +9823,27 @@ const EmailForm = ({ order }) => {
9844
9823
  }
9845
9824
  ) });
9846
9825
  };
9826
+ const schema$4 = objectType({
9827
+ email: stringType().email()
9828
+ });
9829
+ const CustomItems = () => {
9830
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9831
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9832
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9833
+ ] });
9834
+ };
9835
+ const CustomItemsForm = () => {
9836
+ const form = reactHookForm.useForm({
9837
+ resolver: zod.zodResolver(schema$3)
9838
+ });
9839
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9840
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9841
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9842
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9843
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9844
+ ] }) })
9845
+ ] }) });
9846
+ };
9847
9847
  const schema$3 = objectType({
9848
9848
  email: stringType().email()
9849
9849
  });
@@ -12361,209 +12361,6 @@ const CustomAmountField = ({
12361
12361
  }
12362
12362
  );
12363
12363
  };
12364
- const ShippingAddress = () => {
12365
- const { id } = reactRouterDom.useParams();
12366
- const { order, isPending, isError, error } = useOrder(id, {
12367
- fields: "+shipping_address"
12368
- });
12369
- if (isError) {
12370
- throw error;
12371
- }
12372
- const isReady = !isPending && !!order;
12373
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12374
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12375
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12376
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12377
- ] }),
12378
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12379
- ] });
12380
- };
12381
- const ShippingAddressForm = ({ order }) => {
12382
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12383
- const form = reactHookForm.useForm({
12384
- defaultValues: {
12385
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12386
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12387
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12388
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12389
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12390
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12391
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12392
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12393
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12394
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12395
- },
12396
- resolver: zod.zodResolver(schema$1)
12397
- });
12398
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12399
- const { handleSuccess } = useRouteModal();
12400
- const onSubmit = form.handleSubmit(async (data) => {
12401
- await mutateAsync(
12402
- {
12403
- shipping_address: {
12404
- first_name: data.first_name,
12405
- last_name: data.last_name,
12406
- company: data.company,
12407
- address_1: data.address_1,
12408
- address_2: data.address_2,
12409
- city: data.city,
12410
- province: data.province,
12411
- country_code: data.country_code,
12412
- postal_code: data.postal_code,
12413
- phone: data.phone
12414
- }
12415
- },
12416
- {
12417
- onSuccess: () => {
12418
- handleSuccess();
12419
- },
12420
- onError: (error) => {
12421
- ui.toast.error(error.message);
12422
- }
12423
- }
12424
- );
12425
- });
12426
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12427
- KeyboundForm,
12428
- {
12429
- className: "flex flex-1 flex-col overflow-hidden",
12430
- onSubmit,
12431
- children: [
12432
- /* @__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: [
12433
- /* @__PURE__ */ jsxRuntime.jsx(
12434
- Form$2.Field,
12435
- {
12436
- control: form.control,
12437
- name: "country_code",
12438
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12439
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12440
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12441
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12442
- ] })
12443
- }
12444
- ),
12445
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12446
- /* @__PURE__ */ jsxRuntime.jsx(
12447
- Form$2.Field,
12448
- {
12449
- control: form.control,
12450
- name: "first_name",
12451
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12452
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12453
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12454
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12455
- ] })
12456
- }
12457
- ),
12458
- /* @__PURE__ */ jsxRuntime.jsx(
12459
- Form$2.Field,
12460
- {
12461
- control: form.control,
12462
- name: "last_name",
12463
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12464
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12465
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12466
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12467
- ] })
12468
- }
12469
- )
12470
- ] }),
12471
- /* @__PURE__ */ jsxRuntime.jsx(
12472
- Form$2.Field,
12473
- {
12474
- control: form.control,
12475
- name: "company",
12476
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12477
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12478
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12479
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12480
- ] })
12481
- }
12482
- ),
12483
- /* @__PURE__ */ jsxRuntime.jsx(
12484
- Form$2.Field,
12485
- {
12486
- control: form.control,
12487
- name: "address_1",
12488
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12489
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12490
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12491
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12492
- ] })
12493
- }
12494
- ),
12495
- /* @__PURE__ */ jsxRuntime.jsx(
12496
- Form$2.Field,
12497
- {
12498
- control: form.control,
12499
- name: "address_2",
12500
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12501
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12502
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12503
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12504
- ] })
12505
- }
12506
- ),
12507
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12508
- /* @__PURE__ */ jsxRuntime.jsx(
12509
- Form$2.Field,
12510
- {
12511
- control: form.control,
12512
- name: "postal_code",
12513
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12514
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12515
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12516
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12517
- ] })
12518
- }
12519
- ),
12520
- /* @__PURE__ */ jsxRuntime.jsx(
12521
- Form$2.Field,
12522
- {
12523
- control: form.control,
12524
- name: "city",
12525
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12526
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12527
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12528
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12529
- ] })
12530
- }
12531
- )
12532
- ] }),
12533
- /* @__PURE__ */ jsxRuntime.jsx(
12534
- Form$2.Field,
12535
- {
12536
- control: form.control,
12537
- name: "province",
12538
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12539
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12540
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12541
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12542
- ] })
12543
- }
12544
- ),
12545
- /* @__PURE__ */ jsxRuntime.jsx(
12546
- Form$2.Field,
12547
- {
12548
- control: form.control,
12549
- name: "phone",
12550
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12551
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12552
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12553
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12554
- ] })
12555
- }
12556
- )
12557
- ] }) }),
12558
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12559
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12560
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12561
- ] }) })
12562
- ]
12563
- }
12564
- ) });
12565
- };
12566
- const schema$1 = addressSchema;
12567
12364
  const TransferOwnership = () => {
12568
12365
  const { id } = reactRouterDom.useParams();
12569
12366
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12587,7 +12384,7 @@ const TransferOwnershipForm = ({ order }) => {
12587
12384
  defaultValues: {
12588
12385
  customer_id: order.customer_id || ""
12589
12386
  },
12590
- resolver: zod.zodResolver(schema)
12387
+ resolver: zod.zodResolver(schema$1)
12591
12388
  });
12592
12389
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12593
12390
  const { handleSuccess } = useRouteModal();
@@ -13037,9 +12834,212 @@ const Illustration = () => {
13037
12834
  }
13038
12835
  );
13039
12836
  };
13040
- const schema = objectType({
12837
+ const schema$1 = objectType({
13041
12838
  customer_id: stringType().min(1)
13042
12839
  });
12840
+ const ShippingAddress = () => {
12841
+ const { id } = reactRouterDom.useParams();
12842
+ const { order, isPending, isError, error } = useOrder(id, {
12843
+ fields: "+shipping_address"
12844
+ });
12845
+ if (isError) {
12846
+ throw error;
12847
+ }
12848
+ const isReady = !isPending && !!order;
12849
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12850
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12851
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12852
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12853
+ ] }),
12854
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12855
+ ] });
12856
+ };
12857
+ const ShippingAddressForm = ({ order }) => {
12858
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12859
+ const form = reactHookForm.useForm({
12860
+ defaultValues: {
12861
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12862
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12863
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12864
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12865
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12866
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12867
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12868
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12869
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12870
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12871
+ },
12872
+ resolver: zod.zodResolver(schema)
12873
+ });
12874
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12875
+ const { handleSuccess } = useRouteModal();
12876
+ const onSubmit = form.handleSubmit(async (data) => {
12877
+ await mutateAsync(
12878
+ {
12879
+ shipping_address: {
12880
+ first_name: data.first_name,
12881
+ last_name: data.last_name,
12882
+ company: data.company,
12883
+ address_1: data.address_1,
12884
+ address_2: data.address_2,
12885
+ city: data.city,
12886
+ province: data.province,
12887
+ country_code: data.country_code,
12888
+ postal_code: data.postal_code,
12889
+ phone: data.phone
12890
+ }
12891
+ },
12892
+ {
12893
+ onSuccess: () => {
12894
+ handleSuccess();
12895
+ },
12896
+ onError: (error) => {
12897
+ ui.toast.error(error.message);
12898
+ }
12899
+ }
12900
+ );
12901
+ });
12902
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12903
+ KeyboundForm,
12904
+ {
12905
+ className: "flex flex-1 flex-col overflow-hidden",
12906
+ onSubmit,
12907
+ children: [
12908
+ /* @__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: [
12909
+ /* @__PURE__ */ jsxRuntime.jsx(
12910
+ Form$2.Field,
12911
+ {
12912
+ control: form.control,
12913
+ name: "country_code",
12914
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12915
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12916
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12917
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12918
+ ] })
12919
+ }
12920
+ ),
12921
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12922
+ /* @__PURE__ */ jsxRuntime.jsx(
12923
+ Form$2.Field,
12924
+ {
12925
+ control: form.control,
12926
+ name: "first_name",
12927
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12928
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12929
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12930
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12931
+ ] })
12932
+ }
12933
+ ),
12934
+ /* @__PURE__ */ jsxRuntime.jsx(
12935
+ Form$2.Field,
12936
+ {
12937
+ control: form.control,
12938
+ name: "last_name",
12939
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12940
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12941
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12942
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12943
+ ] })
12944
+ }
12945
+ )
12946
+ ] }),
12947
+ /* @__PURE__ */ jsxRuntime.jsx(
12948
+ Form$2.Field,
12949
+ {
12950
+ control: form.control,
12951
+ name: "company",
12952
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12953
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12954
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12955
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12956
+ ] })
12957
+ }
12958
+ ),
12959
+ /* @__PURE__ */ jsxRuntime.jsx(
12960
+ Form$2.Field,
12961
+ {
12962
+ control: form.control,
12963
+ name: "address_1",
12964
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12965
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12966
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12967
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12968
+ ] })
12969
+ }
12970
+ ),
12971
+ /* @__PURE__ */ jsxRuntime.jsx(
12972
+ Form$2.Field,
12973
+ {
12974
+ control: form.control,
12975
+ name: "address_2",
12976
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12977
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12978
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12979
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12980
+ ] })
12981
+ }
12982
+ ),
12983
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12984
+ /* @__PURE__ */ jsxRuntime.jsx(
12985
+ Form$2.Field,
12986
+ {
12987
+ control: form.control,
12988
+ name: "postal_code",
12989
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12990
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12991
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12992
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12993
+ ] })
12994
+ }
12995
+ ),
12996
+ /* @__PURE__ */ jsxRuntime.jsx(
12997
+ Form$2.Field,
12998
+ {
12999
+ control: form.control,
13000
+ name: "city",
13001
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13002
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
13003
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13004
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13005
+ ] })
13006
+ }
13007
+ )
13008
+ ] }),
13009
+ /* @__PURE__ */ jsxRuntime.jsx(
13010
+ Form$2.Field,
13011
+ {
13012
+ control: form.control,
13013
+ name: "province",
13014
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13015
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13016
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13017
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13018
+ ] })
13019
+ }
13020
+ ),
13021
+ /* @__PURE__ */ jsxRuntime.jsx(
13022
+ Form$2.Field,
13023
+ {
13024
+ control: form.control,
13025
+ name: "phone",
13026
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13027
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13028
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13029
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13030
+ ] })
13031
+ }
13032
+ )
13033
+ ] }) }),
13034
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13035
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13036
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13037
+ ] }) })
13038
+ ]
13039
+ }
13040
+ ) });
13041
+ };
13042
+ const schema = addressSchema;
13043
13043
  const widgetModule = { widgets: [] };
13044
13044
  const routeModule = {
13045
13045
  routes: [
@@ -13064,14 +13064,14 @@ const routeModule = {
13064
13064
  Component: BillingAddress,
13065
13065
  path: "/draft-orders/:id/billing-address"
13066
13066
  },
13067
- {
13068
- Component: CustomItems,
13069
- path: "/draft-orders/:id/custom-items"
13070
- },
13071
13067
  {
13072
13068
  Component: Email,
13073
13069
  path: "/draft-orders/:id/email"
13074
13070
  },
13071
+ {
13072
+ Component: CustomItems,
13073
+ path: "/draft-orders/:id/custom-items"
13074
+ },
13075
13075
  {
13076
13076
  Component: Items,
13077
13077
  path: "/draft-orders/:id/items"
@@ -13092,13 +13092,13 @@ const routeModule = {
13092
13092
  Component: Shipping,
13093
13093
  path: "/draft-orders/:id/shipping"
13094
13094
  },
13095
- {
13096
- Component: ShippingAddress,
13097
- path: "/draft-orders/:id/shipping-address"
13098
- },
13099
13095
  {
13100
13096
  Component: TransferOwnership,
13101
13097
  path: "/draft-orders/:id/transfer-ownership"
13098
+ },
13099
+ {
13100
+ Component: ShippingAddress,
13101
+ path: "/draft-orders/:id/shipping-address"
13102
13102
  }
13103
13103
  ]
13104
13104
  }
@@ -13110,7 +13110,8 @@ const menuItemModule = {
13110
13110
  label: config.label,
13111
13111
  icon: void 0,
13112
13112
  path: "/draft-orders",
13113
- nested: "/orders"
13113
+ nested: "/orders",
13114
+ translationNs: void 0
13114
13115
  }
13115
13116
  ]
13116
13117
  };
@@ -9751,27 +9751,6 @@ const BillingAddressForm = ({ order }) => {
9751
9751
  ) });
9752
9752
  };
9753
9753
  const schema$5 = addressSchema;
9754
- const CustomItems = () => {
9755
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9756
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9757
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9758
- ] });
9759
- };
9760
- const CustomItemsForm = () => {
9761
- const form = useForm({
9762
- resolver: zodResolver(schema$4)
9763
- });
9764
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9765
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9766
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9767
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9768
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9769
- ] }) })
9770
- ] }) });
9771
- };
9772
- const schema$4 = objectType({
9773
- email: stringType().email()
9774
- });
9775
9754
  const Email = () => {
9776
9755
  const { id } = useParams();
9777
9756
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9794,7 +9773,7 @@ const EmailForm = ({ order }) => {
9794
9773
  defaultValues: {
9795
9774
  email: order.email ?? ""
9796
9775
  },
9797
- resolver: zodResolver(schema$3)
9776
+ resolver: zodResolver(schema$4)
9798
9777
  });
9799
9778
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9800
9779
  const { handleSuccess } = useRouteModal();
@@ -9837,6 +9816,27 @@ const EmailForm = ({ order }) => {
9837
9816
  }
9838
9817
  ) });
9839
9818
  };
9819
+ const schema$4 = objectType({
9820
+ email: stringType().email()
9821
+ });
9822
+ const CustomItems = () => {
9823
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9824
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9825
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
9826
+ ] });
9827
+ };
9828
+ const CustomItemsForm = () => {
9829
+ const form = useForm({
9830
+ resolver: zodResolver(schema$3)
9831
+ });
9832
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9833
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9834
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9835
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9836
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9837
+ ] }) })
9838
+ ] }) });
9839
+ };
9840
9840
  const schema$3 = objectType({
9841
9841
  email: stringType().email()
9842
9842
  });
@@ -12354,209 +12354,6 @@ const CustomAmountField = ({
12354
12354
  }
12355
12355
  );
12356
12356
  };
12357
- const ShippingAddress = () => {
12358
- const { id } = useParams();
12359
- const { order, isPending, isError, error } = useOrder(id, {
12360
- fields: "+shipping_address"
12361
- });
12362
- if (isError) {
12363
- throw error;
12364
- }
12365
- const isReady = !isPending && !!order;
12366
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12367
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12368
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12369
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12370
- ] }),
12371
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12372
- ] });
12373
- };
12374
- const ShippingAddressForm = ({ order }) => {
12375
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12376
- const form = useForm({
12377
- defaultValues: {
12378
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12379
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12380
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12381
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12382
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12383
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12384
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12385
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12386
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12387
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12388
- },
12389
- resolver: zodResolver(schema$1)
12390
- });
12391
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12392
- const { handleSuccess } = useRouteModal();
12393
- const onSubmit = form.handleSubmit(async (data) => {
12394
- await mutateAsync(
12395
- {
12396
- shipping_address: {
12397
- first_name: data.first_name,
12398
- last_name: data.last_name,
12399
- company: data.company,
12400
- address_1: data.address_1,
12401
- address_2: data.address_2,
12402
- city: data.city,
12403
- province: data.province,
12404
- country_code: data.country_code,
12405
- postal_code: data.postal_code,
12406
- phone: data.phone
12407
- }
12408
- },
12409
- {
12410
- onSuccess: () => {
12411
- handleSuccess();
12412
- },
12413
- onError: (error) => {
12414
- toast.error(error.message);
12415
- }
12416
- }
12417
- );
12418
- });
12419
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12420
- KeyboundForm,
12421
- {
12422
- className: "flex flex-1 flex-col overflow-hidden",
12423
- onSubmit,
12424
- children: [
12425
- /* @__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: [
12426
- /* @__PURE__ */ jsx(
12427
- Form$2.Field,
12428
- {
12429
- control: form.control,
12430
- name: "country_code",
12431
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12432
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12433
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12434
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12435
- ] })
12436
- }
12437
- ),
12438
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12439
- /* @__PURE__ */ jsx(
12440
- Form$2.Field,
12441
- {
12442
- control: form.control,
12443
- name: "first_name",
12444
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12445
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12446
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12447
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12448
- ] })
12449
- }
12450
- ),
12451
- /* @__PURE__ */ jsx(
12452
- Form$2.Field,
12453
- {
12454
- control: form.control,
12455
- name: "last_name",
12456
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12457
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12458
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12459
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12460
- ] })
12461
- }
12462
- )
12463
- ] }),
12464
- /* @__PURE__ */ jsx(
12465
- Form$2.Field,
12466
- {
12467
- control: form.control,
12468
- name: "company",
12469
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12470
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12471
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12472
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12473
- ] })
12474
- }
12475
- ),
12476
- /* @__PURE__ */ jsx(
12477
- Form$2.Field,
12478
- {
12479
- control: form.control,
12480
- name: "address_1",
12481
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12482
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12483
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12484
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12485
- ] })
12486
- }
12487
- ),
12488
- /* @__PURE__ */ jsx(
12489
- Form$2.Field,
12490
- {
12491
- control: form.control,
12492
- name: "address_2",
12493
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12494
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12495
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12496
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12497
- ] })
12498
- }
12499
- ),
12500
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12501
- /* @__PURE__ */ jsx(
12502
- Form$2.Field,
12503
- {
12504
- control: form.control,
12505
- name: "postal_code",
12506
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12507
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12508
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12509
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12510
- ] })
12511
- }
12512
- ),
12513
- /* @__PURE__ */ jsx(
12514
- Form$2.Field,
12515
- {
12516
- control: form.control,
12517
- name: "city",
12518
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12519
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12520
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12521
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12522
- ] })
12523
- }
12524
- )
12525
- ] }),
12526
- /* @__PURE__ */ jsx(
12527
- Form$2.Field,
12528
- {
12529
- control: form.control,
12530
- name: "province",
12531
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12532
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12533
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12534
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12535
- ] })
12536
- }
12537
- ),
12538
- /* @__PURE__ */ jsx(
12539
- Form$2.Field,
12540
- {
12541
- control: form.control,
12542
- name: "phone",
12543
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12544
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12545
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12546
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12547
- ] })
12548
- }
12549
- )
12550
- ] }) }),
12551
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12552
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12553
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12554
- ] }) })
12555
- ]
12556
- }
12557
- ) });
12558
- };
12559
- const schema$1 = addressSchema;
12560
12357
  const TransferOwnership = () => {
12561
12358
  const { id } = useParams();
12562
12359
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12580,7 +12377,7 @@ const TransferOwnershipForm = ({ order }) => {
12580
12377
  defaultValues: {
12581
12378
  customer_id: order.customer_id || ""
12582
12379
  },
12583
- resolver: zodResolver(schema)
12380
+ resolver: zodResolver(schema$1)
12584
12381
  });
12585
12382
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12586
12383
  const { handleSuccess } = useRouteModal();
@@ -13030,9 +12827,212 @@ const Illustration = () => {
13030
12827
  }
13031
12828
  );
13032
12829
  };
13033
- const schema = objectType({
12830
+ const schema$1 = objectType({
13034
12831
  customer_id: stringType().min(1)
13035
12832
  });
12833
+ const ShippingAddress = () => {
12834
+ const { id } = useParams();
12835
+ const { order, isPending, isError, error } = useOrder(id, {
12836
+ fields: "+shipping_address"
12837
+ });
12838
+ if (isError) {
12839
+ throw error;
12840
+ }
12841
+ const isReady = !isPending && !!order;
12842
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12843
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12844
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12845
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12846
+ ] }),
12847
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12848
+ ] });
12849
+ };
12850
+ const ShippingAddressForm = ({ order }) => {
12851
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12852
+ const form = useForm({
12853
+ defaultValues: {
12854
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12855
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12856
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12857
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12858
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12859
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12860
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12861
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12862
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12863
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12864
+ },
12865
+ resolver: zodResolver(schema)
12866
+ });
12867
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12868
+ const { handleSuccess } = useRouteModal();
12869
+ const onSubmit = form.handleSubmit(async (data) => {
12870
+ await mutateAsync(
12871
+ {
12872
+ shipping_address: {
12873
+ first_name: data.first_name,
12874
+ last_name: data.last_name,
12875
+ company: data.company,
12876
+ address_1: data.address_1,
12877
+ address_2: data.address_2,
12878
+ city: data.city,
12879
+ province: data.province,
12880
+ country_code: data.country_code,
12881
+ postal_code: data.postal_code,
12882
+ phone: data.phone
12883
+ }
12884
+ },
12885
+ {
12886
+ onSuccess: () => {
12887
+ handleSuccess();
12888
+ },
12889
+ onError: (error) => {
12890
+ toast.error(error.message);
12891
+ }
12892
+ }
12893
+ );
12894
+ });
12895
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12896
+ KeyboundForm,
12897
+ {
12898
+ className: "flex flex-1 flex-col overflow-hidden",
12899
+ onSubmit,
12900
+ children: [
12901
+ /* @__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: [
12902
+ /* @__PURE__ */ jsx(
12903
+ Form$2.Field,
12904
+ {
12905
+ control: form.control,
12906
+ name: "country_code",
12907
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12908
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12909
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12910
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12911
+ ] })
12912
+ }
12913
+ ),
12914
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12915
+ /* @__PURE__ */ jsx(
12916
+ Form$2.Field,
12917
+ {
12918
+ control: form.control,
12919
+ name: "first_name",
12920
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12921
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12922
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12923
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12924
+ ] })
12925
+ }
12926
+ ),
12927
+ /* @__PURE__ */ jsx(
12928
+ Form$2.Field,
12929
+ {
12930
+ control: form.control,
12931
+ name: "last_name",
12932
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12933
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12934
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12935
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12936
+ ] })
12937
+ }
12938
+ )
12939
+ ] }),
12940
+ /* @__PURE__ */ jsx(
12941
+ Form$2.Field,
12942
+ {
12943
+ control: form.control,
12944
+ name: "company",
12945
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12946
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12947
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12948
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12949
+ ] })
12950
+ }
12951
+ ),
12952
+ /* @__PURE__ */ jsx(
12953
+ Form$2.Field,
12954
+ {
12955
+ control: form.control,
12956
+ name: "address_1",
12957
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12958
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12959
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12960
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12961
+ ] })
12962
+ }
12963
+ ),
12964
+ /* @__PURE__ */ jsx(
12965
+ Form$2.Field,
12966
+ {
12967
+ control: form.control,
12968
+ name: "address_2",
12969
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12970
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12971
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12972
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12973
+ ] })
12974
+ }
12975
+ ),
12976
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12977
+ /* @__PURE__ */ jsx(
12978
+ Form$2.Field,
12979
+ {
12980
+ control: form.control,
12981
+ name: "postal_code",
12982
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12983
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12984
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12985
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12986
+ ] })
12987
+ }
12988
+ ),
12989
+ /* @__PURE__ */ jsx(
12990
+ Form$2.Field,
12991
+ {
12992
+ control: form.control,
12993
+ name: "city",
12994
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12995
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12996
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12997
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12998
+ ] })
12999
+ }
13000
+ )
13001
+ ] }),
13002
+ /* @__PURE__ */ jsx(
13003
+ Form$2.Field,
13004
+ {
13005
+ control: form.control,
13006
+ name: "province",
13007
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13008
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13009
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13010
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13011
+ ] })
13012
+ }
13013
+ ),
13014
+ /* @__PURE__ */ jsx(
13015
+ Form$2.Field,
13016
+ {
13017
+ control: form.control,
13018
+ name: "phone",
13019
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13020
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13021
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13022
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13023
+ ] })
13024
+ }
13025
+ )
13026
+ ] }) }),
13027
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13028
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13029
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13030
+ ] }) })
13031
+ ]
13032
+ }
13033
+ ) });
13034
+ };
13035
+ const schema = addressSchema;
13036
13036
  const widgetModule = { widgets: [] };
13037
13037
  const routeModule = {
13038
13038
  routes: [
@@ -13057,14 +13057,14 @@ const routeModule = {
13057
13057
  Component: BillingAddress,
13058
13058
  path: "/draft-orders/:id/billing-address"
13059
13059
  },
13060
- {
13061
- Component: CustomItems,
13062
- path: "/draft-orders/:id/custom-items"
13063
- },
13064
13060
  {
13065
13061
  Component: Email,
13066
13062
  path: "/draft-orders/:id/email"
13067
13063
  },
13064
+ {
13065
+ Component: CustomItems,
13066
+ path: "/draft-orders/:id/custom-items"
13067
+ },
13068
13068
  {
13069
13069
  Component: Items,
13070
13070
  path: "/draft-orders/:id/items"
@@ -13085,13 +13085,13 @@ const routeModule = {
13085
13085
  Component: Shipping,
13086
13086
  path: "/draft-orders/:id/shipping"
13087
13087
  },
13088
- {
13089
- Component: ShippingAddress,
13090
- path: "/draft-orders/:id/shipping-address"
13091
- },
13092
13088
  {
13093
13089
  Component: TransferOwnership,
13094
13090
  path: "/draft-orders/:id/transfer-ownership"
13091
+ },
13092
+ {
13093
+ Component: ShippingAddress,
13094
+ path: "/draft-orders/:id/shipping-address"
13095
13095
  }
13096
13096
  ]
13097
13097
  }
@@ -13103,7 +13103,8 @@ const menuItemModule = {
13103
13103
  label: config.label,
13104
13104
  icon: void 0,
13105
13105
  path: "/draft-orders",
13106
- nested: "/orders"
13106
+ nested: "/orders",
13107
+ translationNs: void 0
13107
13108
  }
13108
13109
  ]
13109
13110
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.11.4-snapshot-20251106122834",
3
+ "version": "2.11.4-snapshot-20251107094001",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "@ariakit/react": "^0.4.15",
38
38
  "@babel/runtime": "^7.26.10",
39
39
  "@hookform/resolvers": "3.4.2",
40
- "@medusajs/js-sdk": "2.11.4-snapshot-20251106122834",
40
+ "@medusajs/js-sdk": "2.11.4-snapshot-20251107094001",
41
41
  "@tanstack/react-query": "5.64.2",
42
42
  "@uiw/react-json-view": "^2.0.0-alpha.17",
43
43
  "date-fns": "^3.6.0",
@@ -48,22 +48,22 @@
48
48
  "react-hook-form": "7.49.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@medusajs/admin-sdk": "2.11.4-snapshot-20251106122834",
52
- "@medusajs/cli": "2.11.4-snapshot-20251106122834",
53
- "@medusajs/framework": "2.11.4-snapshot-20251106122834",
54
- "@medusajs/icons": "2.11.4-snapshot-20251106122834",
55
- "@medusajs/test-utils": "2.11.4-snapshot-20251106122834",
56
- "@medusajs/types": "2.11.4-snapshot-20251106122834",
57
- "@medusajs/ui": "4.0.28-snapshot-20251106122834",
58
- "@medusajs/ui-preset": "2.11.4-snapshot-20251106122834"
51
+ "@medusajs/admin-sdk": "2.11.4-snapshot-20251107094001",
52
+ "@medusajs/cli": "2.11.4-snapshot-20251107094001",
53
+ "@medusajs/framework": "2.11.4-snapshot-20251107094001",
54
+ "@medusajs/icons": "2.11.4-snapshot-20251107094001",
55
+ "@medusajs/test-utils": "2.11.4-snapshot-20251107094001",
56
+ "@medusajs/types": "2.11.4-snapshot-20251107094001",
57
+ "@medusajs/ui": "4.0.28-snapshot-20251107094001",
58
+ "@medusajs/ui-preset": "2.11.4-snapshot-20251107094001"
59
59
  },
60
60
  "peerDependencies": {
61
- "@medusajs/admin-sdk": "2.11.4-snapshot-20251106122834",
62
- "@medusajs/cli": "2.11.4-snapshot-20251106122834",
63
- "@medusajs/framework": "2.11.4-snapshot-20251106122834",
64
- "@medusajs/icons": "2.11.4-snapshot-20251106122834",
65
- "@medusajs/test-utils": "2.11.4-snapshot-20251106122834",
66
- "@medusajs/ui": "4.0.28-snapshot-20251106122834",
61
+ "@medusajs/admin-sdk": "2.11.4-snapshot-20251107094001",
62
+ "@medusajs/cli": "2.11.4-snapshot-20251107094001",
63
+ "@medusajs/framework": "2.11.4-snapshot-20251107094001",
64
+ "@medusajs/icons": "2.11.4-snapshot-20251107094001",
65
+ "@medusajs/test-utils": "2.11.4-snapshot-20251107094001",
66
+ "@medusajs/ui": "4.0.28-snapshot-20251107094001",
67
67
  "react": "^18.3.1",
68
68
  "react-dom": "^18.3.1",
69
69
  "react-router-dom": "6.20.1"