@medusajs/draft-order 2.10.4-preview-20250925000313 → 2.10.4-preview-20250925031439

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(
@@ -12260,209 +12239,6 @@ const CustomAmountField = ({
12260
12239
  }
12261
12240
  );
12262
12241
  };
12263
- const ShippingAddress = () => {
12264
- const { id } = reactRouterDom.useParams();
12265
- const { order, isPending, isError, error } = useOrder(id, {
12266
- fields: "+shipping_address"
12267
- });
12268
- if (isError) {
12269
- throw error;
12270
- }
12271
- const isReady = !isPending && !!order;
12272
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12273
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12274
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12275
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12276
- ] }),
12277
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12278
- ] });
12279
- };
12280
- const ShippingAddressForm = ({ order }) => {
12281
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12282
- const form = reactHookForm.useForm({
12283
- defaultValues: {
12284
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12285
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12286
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12287
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12288
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12289
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12290
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12291
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12292
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12293
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12294
- },
12295
- resolver: zod.zodResolver(schema$2)
12296
- });
12297
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12298
- const { handleSuccess } = useRouteModal();
12299
- const onSubmit = form.handleSubmit(async (data) => {
12300
- await mutateAsync(
12301
- {
12302
- shipping_address: {
12303
- first_name: data.first_name,
12304
- last_name: data.last_name,
12305
- company: data.company,
12306
- address_1: data.address_1,
12307
- address_2: data.address_2,
12308
- city: data.city,
12309
- province: data.province,
12310
- country_code: data.country_code,
12311
- postal_code: data.postal_code,
12312
- phone: data.phone
12313
- }
12314
- },
12315
- {
12316
- onSuccess: () => {
12317
- handleSuccess();
12318
- },
12319
- onError: (error) => {
12320
- ui.toast.error(error.message);
12321
- }
12322
- }
12323
- );
12324
- });
12325
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12326
- KeyboundForm,
12327
- {
12328
- className: "flex flex-1 flex-col overflow-hidden",
12329
- onSubmit,
12330
- children: [
12331
- /* @__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: [
12332
- /* @__PURE__ */ jsxRuntime.jsx(
12333
- Form$2.Field,
12334
- {
12335
- control: form.control,
12336
- name: "country_code",
12337
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12338
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12339
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12340
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12341
- ] })
12342
- }
12343
- ),
12344
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12345
- /* @__PURE__ */ jsxRuntime.jsx(
12346
- Form$2.Field,
12347
- {
12348
- control: form.control,
12349
- name: "first_name",
12350
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12351
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12352
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12353
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12354
- ] })
12355
- }
12356
- ),
12357
- /* @__PURE__ */ jsxRuntime.jsx(
12358
- Form$2.Field,
12359
- {
12360
- control: form.control,
12361
- name: "last_name",
12362
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12363
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12364
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12365
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12366
- ] })
12367
- }
12368
- )
12369
- ] }),
12370
- /* @__PURE__ */ jsxRuntime.jsx(
12371
- Form$2.Field,
12372
- {
12373
- control: form.control,
12374
- name: "company",
12375
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12376
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12377
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12378
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12379
- ] })
12380
- }
12381
- ),
12382
- /* @__PURE__ */ jsxRuntime.jsx(
12383
- Form$2.Field,
12384
- {
12385
- control: form.control,
12386
- name: "address_1",
12387
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12388
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12389
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12390
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12391
- ] })
12392
- }
12393
- ),
12394
- /* @__PURE__ */ jsxRuntime.jsx(
12395
- Form$2.Field,
12396
- {
12397
- control: form.control,
12398
- name: "address_2",
12399
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12400
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12401
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12402
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12403
- ] })
12404
- }
12405
- ),
12406
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12407
- /* @__PURE__ */ jsxRuntime.jsx(
12408
- Form$2.Field,
12409
- {
12410
- control: form.control,
12411
- name: "postal_code",
12412
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12413
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12414
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12415
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12416
- ] })
12417
- }
12418
- ),
12419
- /* @__PURE__ */ jsxRuntime.jsx(
12420
- Form$2.Field,
12421
- {
12422
- control: form.control,
12423
- name: "city",
12424
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12425
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12426
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12427
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12428
- ] })
12429
- }
12430
- )
12431
- ] }),
12432
- /* @__PURE__ */ jsxRuntime.jsx(
12433
- Form$2.Field,
12434
- {
12435
- control: form.control,
12436
- name: "province",
12437
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12438
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12439
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12440
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12441
- ] })
12442
- }
12443
- ),
12444
- /* @__PURE__ */ jsxRuntime.jsx(
12445
- Form$2.Field,
12446
- {
12447
- control: form.control,
12448
- name: "phone",
12449
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12450
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12451
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12452
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12453
- ] })
12454
- }
12455
- )
12456
- ] }) }),
12457
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12458
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12459
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12460
- ] }) })
12461
- ]
12462
- }
12463
- ) });
12464
- };
12465
- const schema$2 = addressSchema;
12466
12242
  const TransferOwnership = () => {
12467
12243
  const { id } = reactRouterDom.useParams();
12468
12244
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12486,7 +12262,7 @@ const TransferOwnershipForm = ({ order }) => {
12486
12262
  defaultValues: {
12487
12263
  customer_id: order.customer_id || ""
12488
12264
  },
12489
- resolver: zod.zodResolver(schema$1)
12265
+ resolver: zod.zodResolver(schema$3)
12490
12266
  });
12491
12267
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12492
12268
  const { handleSuccess } = useRouteModal();
@@ -12936,7 +12712,7 @@ const Illustration = () => {
12936
12712
  }
12937
12713
  );
12938
12714
  };
12939
- const schema$1 = objectType({
12715
+ const schema$3 = objectType({
12940
12716
  customer_id: stringType().min(1)
12941
12717
  });
12942
12718
  const SalesChannel = () => {
@@ -12967,7 +12743,7 @@ const SalesChannelForm = ({ order }) => {
12967
12743
  defaultValues: {
12968
12744
  sales_channel_id: order.sales_channel_id || ""
12969
12745
  },
12970
- resolver: zod.zodResolver(schema)
12746
+ resolver: zod.zodResolver(schema$2)
12971
12747
  });
12972
12748
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12973
12749
  const { handleSuccess } = useRouteModal();
@@ -13042,9 +12818,233 @@ const SalesChannelField = ({ control, order }) => {
13042
12818
  }
13043
12819
  );
13044
12820
  };
13045
- const schema = objectType({
12821
+ const schema$2 = objectType({
13046
12822
  sales_channel_id: stringType().min(1)
13047
12823
  });
12824
+ const ShippingAddress = () => {
12825
+ const { id } = reactRouterDom.useParams();
12826
+ const { order, isPending, isError, error } = useOrder(id, {
12827
+ fields: "+shipping_address"
12828
+ });
12829
+ if (isError) {
12830
+ throw error;
12831
+ }
12832
+ const isReady = !isPending && !!order;
12833
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12834
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12835
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12836
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12837
+ ] }),
12838
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12839
+ ] });
12840
+ };
12841
+ const ShippingAddressForm = ({ order }) => {
12842
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12843
+ const form = reactHookForm.useForm({
12844
+ defaultValues: {
12845
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12846
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12847
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12848
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12849
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12850
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12851
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12852
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12853
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12854
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12855
+ },
12856
+ resolver: zod.zodResolver(schema$1)
12857
+ });
12858
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12859
+ const { handleSuccess } = useRouteModal();
12860
+ const onSubmit = form.handleSubmit(async (data) => {
12861
+ await mutateAsync(
12862
+ {
12863
+ shipping_address: {
12864
+ first_name: data.first_name,
12865
+ last_name: data.last_name,
12866
+ company: data.company,
12867
+ address_1: data.address_1,
12868
+ address_2: data.address_2,
12869
+ city: data.city,
12870
+ province: data.province,
12871
+ country_code: data.country_code,
12872
+ postal_code: data.postal_code,
12873
+ phone: data.phone
12874
+ }
12875
+ },
12876
+ {
12877
+ onSuccess: () => {
12878
+ handleSuccess();
12879
+ },
12880
+ onError: (error) => {
12881
+ ui.toast.error(error.message);
12882
+ }
12883
+ }
12884
+ );
12885
+ });
12886
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12887
+ KeyboundForm,
12888
+ {
12889
+ className: "flex flex-1 flex-col overflow-hidden",
12890
+ onSubmit,
12891
+ children: [
12892
+ /* @__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: [
12893
+ /* @__PURE__ */ jsxRuntime.jsx(
12894
+ Form$2.Field,
12895
+ {
12896
+ control: form.control,
12897
+ name: "country_code",
12898
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12899
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12900
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12901
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12902
+ ] })
12903
+ }
12904
+ ),
12905
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12906
+ /* @__PURE__ */ jsxRuntime.jsx(
12907
+ Form$2.Field,
12908
+ {
12909
+ control: form.control,
12910
+ name: "first_name",
12911
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12912
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12913
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12914
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12915
+ ] })
12916
+ }
12917
+ ),
12918
+ /* @__PURE__ */ jsxRuntime.jsx(
12919
+ Form$2.Field,
12920
+ {
12921
+ control: form.control,
12922
+ name: "last_name",
12923
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12924
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12925
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12926
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12927
+ ] })
12928
+ }
12929
+ )
12930
+ ] }),
12931
+ /* @__PURE__ */ jsxRuntime.jsx(
12932
+ Form$2.Field,
12933
+ {
12934
+ control: form.control,
12935
+ name: "company",
12936
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12937
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12938
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12939
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12940
+ ] })
12941
+ }
12942
+ ),
12943
+ /* @__PURE__ */ jsxRuntime.jsx(
12944
+ Form$2.Field,
12945
+ {
12946
+ control: form.control,
12947
+ name: "address_1",
12948
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12949
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12950
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12951
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12952
+ ] })
12953
+ }
12954
+ ),
12955
+ /* @__PURE__ */ jsxRuntime.jsx(
12956
+ Form$2.Field,
12957
+ {
12958
+ control: form.control,
12959
+ name: "address_2",
12960
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12961
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12962
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12963
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12964
+ ] })
12965
+ }
12966
+ ),
12967
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12968
+ /* @__PURE__ */ jsxRuntime.jsx(
12969
+ Form$2.Field,
12970
+ {
12971
+ control: form.control,
12972
+ name: "postal_code",
12973
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12974
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12975
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12976
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12977
+ ] })
12978
+ }
12979
+ ),
12980
+ /* @__PURE__ */ jsxRuntime.jsx(
12981
+ Form$2.Field,
12982
+ {
12983
+ control: form.control,
12984
+ name: "city",
12985
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12986
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12987
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12988
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12989
+ ] })
12990
+ }
12991
+ )
12992
+ ] }),
12993
+ /* @__PURE__ */ jsxRuntime.jsx(
12994
+ Form$2.Field,
12995
+ {
12996
+ control: form.control,
12997
+ name: "province",
12998
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12999
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13000
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13001
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13002
+ ] })
13003
+ }
13004
+ ),
13005
+ /* @__PURE__ */ jsxRuntime.jsx(
13006
+ Form$2.Field,
13007
+ {
13008
+ control: form.control,
13009
+ name: "phone",
13010
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13011
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13012
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13013
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13014
+ ] })
13015
+ }
13016
+ )
13017
+ ] }) }),
13018
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13019
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13020
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13021
+ ] }) })
13022
+ ]
13023
+ }
13024
+ ) });
13025
+ };
13026
+ const schema$1 = addressSchema;
13027
+ const CustomItems = () => {
13028
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
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, {})
13031
+ ] });
13032
+ };
13033
+ const CustomItemsForm = () => {
13034
+ const form = reactHookForm.useForm({
13035
+ resolver: zod.zodResolver(schema)
13036
+ });
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
+ ] }) });
13044
+ };
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"
@@ -13093,10 +13089,6 @@ const routeModule = {
13093
13089
  Component: Shipping,
13094
13090
  path: "/draft-orders/:id/shipping"
13095
13091
  },
13096
- {
13097
- Component: ShippingAddress,
13098
- path: "/draft-orders/:id/shipping-address"
13099
- },
13100
13092
  {
13101
13093
  Component: TransferOwnership,
13102
13094
  path: "/draft-orders/:id/transfer-ownership"
@@ -13104,6 +13096,14 @@ const routeModule = {
13104
13096
  {
13105
13097
  Component: SalesChannel,
13106
13098
  path: "/draft-orders/:id/sales-channel"
13099
+ },
13100
+ {
13101
+ Component: ShippingAddress,
13102
+ path: "/draft-orders/:id/shipping-address"
13103
+ },
13104
+ {
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(
@@ -12254,209 +12233,6 @@ const CustomAmountField = ({
12254
12233
  }
12255
12234
  );
12256
12235
  };
12257
- const ShippingAddress = () => {
12258
- const { id } = useParams();
12259
- const { order, isPending, isError, error } = useOrder(id, {
12260
- fields: "+shipping_address"
12261
- });
12262
- if (isError) {
12263
- throw error;
12264
- }
12265
- const isReady = !isPending && !!order;
12266
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12267
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12268
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12269
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12270
- ] }),
12271
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12272
- ] });
12273
- };
12274
- const ShippingAddressForm = ({ order }) => {
12275
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12276
- const form = useForm({
12277
- defaultValues: {
12278
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12279
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12280
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12281
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12282
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12283
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12284
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12285
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12286
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12287
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12288
- },
12289
- resolver: zodResolver(schema$2)
12290
- });
12291
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12292
- const { handleSuccess } = useRouteModal();
12293
- const onSubmit = form.handleSubmit(async (data) => {
12294
- await mutateAsync(
12295
- {
12296
- shipping_address: {
12297
- first_name: data.first_name,
12298
- last_name: data.last_name,
12299
- company: data.company,
12300
- address_1: data.address_1,
12301
- address_2: data.address_2,
12302
- city: data.city,
12303
- province: data.province,
12304
- country_code: data.country_code,
12305
- postal_code: data.postal_code,
12306
- phone: data.phone
12307
- }
12308
- },
12309
- {
12310
- onSuccess: () => {
12311
- handleSuccess();
12312
- },
12313
- onError: (error) => {
12314
- toast.error(error.message);
12315
- }
12316
- }
12317
- );
12318
- });
12319
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12320
- KeyboundForm,
12321
- {
12322
- className: "flex flex-1 flex-col overflow-hidden",
12323
- onSubmit,
12324
- children: [
12325
- /* @__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: [
12326
- /* @__PURE__ */ jsx(
12327
- Form$2.Field,
12328
- {
12329
- control: form.control,
12330
- name: "country_code",
12331
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12332
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12333
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12334
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12335
- ] })
12336
- }
12337
- ),
12338
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12339
- /* @__PURE__ */ jsx(
12340
- Form$2.Field,
12341
- {
12342
- control: form.control,
12343
- name: "first_name",
12344
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12345
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12346
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12347
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12348
- ] })
12349
- }
12350
- ),
12351
- /* @__PURE__ */ jsx(
12352
- Form$2.Field,
12353
- {
12354
- control: form.control,
12355
- name: "last_name",
12356
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12357
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12358
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12359
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12360
- ] })
12361
- }
12362
- )
12363
- ] }),
12364
- /* @__PURE__ */ jsx(
12365
- Form$2.Field,
12366
- {
12367
- control: form.control,
12368
- name: "company",
12369
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12370
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12371
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12372
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12373
- ] })
12374
- }
12375
- ),
12376
- /* @__PURE__ */ jsx(
12377
- Form$2.Field,
12378
- {
12379
- control: form.control,
12380
- name: "address_1",
12381
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12382
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12383
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12384
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12385
- ] })
12386
- }
12387
- ),
12388
- /* @__PURE__ */ jsx(
12389
- Form$2.Field,
12390
- {
12391
- control: form.control,
12392
- name: "address_2",
12393
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12394
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12395
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12396
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12397
- ] })
12398
- }
12399
- ),
12400
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12401
- /* @__PURE__ */ jsx(
12402
- Form$2.Field,
12403
- {
12404
- control: form.control,
12405
- name: "postal_code",
12406
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12407
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12408
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12409
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12410
- ] })
12411
- }
12412
- ),
12413
- /* @__PURE__ */ jsx(
12414
- Form$2.Field,
12415
- {
12416
- control: form.control,
12417
- name: "city",
12418
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12419
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12420
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12421
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12422
- ] })
12423
- }
12424
- )
12425
- ] }),
12426
- /* @__PURE__ */ jsx(
12427
- Form$2.Field,
12428
- {
12429
- control: form.control,
12430
- name: "province",
12431
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12432
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12433
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12434
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12435
- ] })
12436
- }
12437
- ),
12438
- /* @__PURE__ */ jsx(
12439
- Form$2.Field,
12440
- {
12441
- control: form.control,
12442
- name: "phone",
12443
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12444
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12445
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12446
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12447
- ] })
12448
- }
12449
- )
12450
- ] }) }),
12451
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12452
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12453
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12454
- ] }) })
12455
- ]
12456
- }
12457
- ) });
12458
- };
12459
- const schema$2 = addressSchema;
12460
12236
  const TransferOwnership = () => {
12461
12237
  const { id } = useParams();
12462
12238
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12480,7 +12256,7 @@ const TransferOwnershipForm = ({ order }) => {
12480
12256
  defaultValues: {
12481
12257
  customer_id: order.customer_id || ""
12482
12258
  },
12483
- resolver: zodResolver(schema$1)
12259
+ resolver: zodResolver(schema$3)
12484
12260
  });
12485
12261
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12486
12262
  const { handleSuccess } = useRouteModal();
@@ -12930,7 +12706,7 @@ const Illustration = () => {
12930
12706
  }
12931
12707
  );
12932
12708
  };
12933
- const schema$1 = objectType({
12709
+ const schema$3 = objectType({
12934
12710
  customer_id: stringType().min(1)
12935
12711
  });
12936
12712
  const SalesChannel = () => {
@@ -12961,7 +12737,7 @@ const SalesChannelForm = ({ order }) => {
12961
12737
  defaultValues: {
12962
12738
  sales_channel_id: order.sales_channel_id || ""
12963
12739
  },
12964
- resolver: zodResolver(schema)
12740
+ resolver: zodResolver(schema$2)
12965
12741
  });
12966
12742
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12967
12743
  const { handleSuccess } = useRouteModal();
@@ -13036,9 +12812,233 @@ const SalesChannelField = ({ control, order }) => {
13036
12812
  }
13037
12813
  );
13038
12814
  };
13039
- const schema = objectType({
12815
+ const schema$2 = objectType({
13040
12816
  sales_channel_id: stringType().min(1)
13041
12817
  });
12818
+ const ShippingAddress = () => {
12819
+ const { id } = useParams();
12820
+ const { order, isPending, isError, error } = useOrder(id, {
12821
+ fields: "+shipping_address"
12822
+ });
12823
+ if (isError) {
12824
+ throw error;
12825
+ }
12826
+ const isReady = !isPending && !!order;
12827
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12828
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12829
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12830
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12831
+ ] }),
12832
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12833
+ ] });
12834
+ };
12835
+ const ShippingAddressForm = ({ order }) => {
12836
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12837
+ const form = useForm({
12838
+ defaultValues: {
12839
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12840
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12841
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12842
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12843
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12844
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12845
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12846
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12847
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12848
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12849
+ },
12850
+ resolver: zodResolver(schema$1)
12851
+ });
12852
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12853
+ const { handleSuccess } = useRouteModal();
12854
+ const onSubmit = form.handleSubmit(async (data) => {
12855
+ await mutateAsync(
12856
+ {
12857
+ shipping_address: {
12858
+ first_name: data.first_name,
12859
+ last_name: data.last_name,
12860
+ company: data.company,
12861
+ address_1: data.address_1,
12862
+ address_2: data.address_2,
12863
+ city: data.city,
12864
+ province: data.province,
12865
+ country_code: data.country_code,
12866
+ postal_code: data.postal_code,
12867
+ phone: data.phone
12868
+ }
12869
+ },
12870
+ {
12871
+ onSuccess: () => {
12872
+ handleSuccess();
12873
+ },
12874
+ onError: (error) => {
12875
+ toast.error(error.message);
12876
+ }
12877
+ }
12878
+ );
12879
+ });
12880
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12881
+ KeyboundForm,
12882
+ {
12883
+ className: "flex flex-1 flex-col overflow-hidden",
12884
+ onSubmit,
12885
+ children: [
12886
+ /* @__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: [
12887
+ /* @__PURE__ */ jsx(
12888
+ Form$2.Field,
12889
+ {
12890
+ control: form.control,
12891
+ name: "country_code",
12892
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12893
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12894
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12895
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12896
+ ] })
12897
+ }
12898
+ ),
12899
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12900
+ /* @__PURE__ */ jsx(
12901
+ Form$2.Field,
12902
+ {
12903
+ control: form.control,
12904
+ name: "first_name",
12905
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12906
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12907
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12908
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12909
+ ] })
12910
+ }
12911
+ ),
12912
+ /* @__PURE__ */ jsx(
12913
+ Form$2.Field,
12914
+ {
12915
+ control: form.control,
12916
+ name: "last_name",
12917
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12918
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12919
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12920
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12921
+ ] })
12922
+ }
12923
+ )
12924
+ ] }),
12925
+ /* @__PURE__ */ jsx(
12926
+ Form$2.Field,
12927
+ {
12928
+ control: form.control,
12929
+ name: "company",
12930
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12931
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12932
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12933
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12934
+ ] })
12935
+ }
12936
+ ),
12937
+ /* @__PURE__ */ jsx(
12938
+ Form$2.Field,
12939
+ {
12940
+ control: form.control,
12941
+ name: "address_1",
12942
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12943
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12944
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12945
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12946
+ ] })
12947
+ }
12948
+ ),
12949
+ /* @__PURE__ */ jsx(
12950
+ Form$2.Field,
12951
+ {
12952
+ control: form.control,
12953
+ name: "address_2",
12954
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12955
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12956
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12957
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12958
+ ] })
12959
+ }
12960
+ ),
12961
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12962
+ /* @__PURE__ */ jsx(
12963
+ Form$2.Field,
12964
+ {
12965
+ control: form.control,
12966
+ name: "postal_code",
12967
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12968
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12969
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12970
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12971
+ ] })
12972
+ }
12973
+ ),
12974
+ /* @__PURE__ */ jsx(
12975
+ Form$2.Field,
12976
+ {
12977
+ control: form.control,
12978
+ name: "city",
12979
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12980
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12981
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12982
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12983
+ ] })
12984
+ }
12985
+ )
12986
+ ] }),
12987
+ /* @__PURE__ */ jsx(
12988
+ Form$2.Field,
12989
+ {
12990
+ control: form.control,
12991
+ name: "province",
12992
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12993
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12994
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12995
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12996
+ ] })
12997
+ }
12998
+ ),
12999
+ /* @__PURE__ */ jsx(
13000
+ Form$2.Field,
13001
+ {
13002
+ control: form.control,
13003
+ name: "phone",
13004
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13005
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13006
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13007
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13008
+ ] })
13009
+ }
13010
+ )
13011
+ ] }) }),
13012
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13013
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13014
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13015
+ ] }) })
13016
+ ]
13017
+ }
13018
+ ) });
13019
+ };
13020
+ const schema$1 = addressSchema;
13021
+ const CustomItems = () => {
13022
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
13023
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
13024
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
13025
+ ] });
13026
+ };
13027
+ const CustomItemsForm = () => {
13028
+ const form = useForm({
13029
+ resolver: zodResolver(schema)
13030
+ });
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
+ ] }) });
13038
+ };
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"
@@ -13087,10 +13083,6 @@ const routeModule = {
13087
13083
  Component: Shipping,
13088
13084
  path: "/draft-orders/:id/shipping"
13089
13085
  },
13090
- {
13091
- Component: ShippingAddress,
13092
- path: "/draft-orders/:id/shipping-address"
13093
- },
13094
13086
  {
13095
13087
  Component: TransferOwnership,
13096
13088
  path: "/draft-orders/:id/transfer-ownership"
@@ -13098,6 +13090,14 @@ const routeModule = {
13098
13090
  {
13099
13091
  Component: SalesChannel,
13100
13092
  path: "/draft-orders/:id/sales-channel"
13093
+ },
13094
+ {
13095
+ Component: ShippingAddress,
13096
+ path: "/draft-orders/:id/shipping-address"
13097
+ },
13098
+ {
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-preview-20250925000313",
3
+ "version": "2.10.4-preview-20250925031439",
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-preview-20250925000313",
39
+ "@medusajs/js-sdk": "2.10.4-preview-20250925031439",
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-preview-20250925000313",
49
- "@medusajs/cli": "2.10.4-preview-20250925000313",
50
- "@medusajs/framework": "2.10.4-preview-20250925000313",
51
- "@medusajs/icons": "2.10.4-preview-20250925000313",
52
- "@medusajs/test-utils": "2.10.4-preview-20250925000313",
53
- "@medusajs/types": "2.10.4-preview-20250925000313",
54
- "@medusajs/ui": "4.0.24-preview-20250925000313",
55
- "@medusajs/ui-preset": "2.10.4-preview-20250925000313",
48
+ "@medusajs/admin-sdk": "2.10.4-preview-20250925031439",
49
+ "@medusajs/cli": "2.10.4-preview-20250925031439",
50
+ "@medusajs/framework": "2.10.4-preview-20250925031439",
51
+ "@medusajs/icons": "2.10.4-preview-20250925031439",
52
+ "@medusajs/test-utils": "2.10.4-preview-20250925031439",
53
+ "@medusajs/types": "2.10.4-preview-20250925031439",
54
+ "@medusajs/ui": "4.0.24-preview-20250925031439",
55
+ "@medusajs/ui-preset": "2.10.4-preview-20250925031439",
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-preview-20250925000313",
73
- "@medusajs/cli": "2.10.4-preview-20250925000313",
74
- "@medusajs/framework": "2.10.4-preview-20250925000313",
75
- "@medusajs/icons": "2.10.4-preview-20250925000313",
76
- "@medusajs/test-utils": "2.10.4-preview-20250925000313",
77
- "@medusajs/ui": "4.0.24-preview-20250925000313",
72
+ "@medusajs/admin-sdk": "2.10.4-preview-20250925031439",
73
+ "@medusajs/cli": "2.10.4-preview-20250925031439",
74
+ "@medusajs/framework": "2.10.4-preview-20250925031439",
75
+ "@medusajs/icons": "2.10.4-preview-20250925031439",
76
+ "@medusajs/test-utils": "2.10.4-preview-20250925031439",
77
+ "@medusajs/ui": "4.0.24-preview-20250925031439",
78
78
  "lodash": "^4.17.21",
79
79
  "react-router-dom": "6.20.1"
80
80
  },