@medusajs/draft-order 2.10.2-snapshot-20250904073034 → 2.10.2-snapshot-20250904141849

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.
@@ -9560,27 +9560,6 @@ const ID = () => {
9560
9560
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9561
9561
  ] });
9562
9562
  };
9563
- const CustomItems = () => {
9564
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9565
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9566
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9567
- ] });
9568
- };
9569
- const CustomItemsForm = () => {
9570
- const form = reactHookForm.useForm({
9571
- resolver: zod.zodResolver(schema$5)
9572
- });
9573
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9574
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9575
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9576
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9577
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9578
- ] }) })
9579
- ] }) });
9580
- };
9581
- const schema$5 = objectType({
9582
- email: stringType().email()
9583
- });
9584
9563
  const BillingAddress = () => {
9585
9564
  const { id } = reactRouterDom.useParams();
9586
9565
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9613,7 +9592,7 @@ const BillingAddressForm = ({ order }) => {
9613
9592
  postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9614
9593
  phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9615
9594
  },
9616
- resolver: zod.zodResolver(schema$4)
9595
+ resolver: zod.zodResolver(schema$5)
9617
9596
  });
9618
9597
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9619
9598
  const { handleSuccess } = useRouteModal();
@@ -9770,7 +9749,28 @@ const BillingAddressForm = ({ order }) => {
9770
9749
  }
9771
9750
  ) });
9772
9751
  };
9773
- const schema$4 = addressSchema;
9752
+ const schema$5 = addressSchema;
9753
+ const CustomItems = () => {
9754
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9755
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9756
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9757
+ ] });
9758
+ };
9759
+ const CustomItemsForm = () => {
9760
+ const form = reactHookForm.useForm({
9761
+ resolver: zod.zodResolver(schema$4)
9762
+ });
9763
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9764
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9765
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9766
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9767
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9768
+ ] }) })
9769
+ ] }) });
9770
+ };
9771
+ const schema$4 = objectType({
9772
+ email: stringType().email()
9773
+ });
9774
9774
  const Email = () => {
9775
9775
  const { id } = reactRouterDom.useParams();
9776
9776
  const { order, isPending, isError, error } = useOrder(id, {
@@ -12353,6 +12353,209 @@ const CustomAmountField = ({
12353
12353
  }
12354
12354
  );
12355
12355
  };
12356
+ const ShippingAddress = () => {
12357
+ const { id } = reactRouterDom.useParams();
12358
+ const { order, isPending, isError, error } = useOrder(id, {
12359
+ fields: "+shipping_address"
12360
+ });
12361
+ if (isError) {
12362
+ throw error;
12363
+ }
12364
+ const isReady = !isPending && !!order;
12365
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12366
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12367
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12368
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12369
+ ] }),
12370
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12371
+ ] });
12372
+ };
12373
+ const ShippingAddressForm = ({ order }) => {
12374
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12375
+ const form = reactHookForm.useForm({
12376
+ defaultValues: {
12377
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12378
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12379
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12380
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12381
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12382
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12383
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12384
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12385
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12386
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12387
+ },
12388
+ resolver: zod.zodResolver(schema$1)
12389
+ });
12390
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12391
+ const { handleSuccess } = useRouteModal();
12392
+ const onSubmit = form.handleSubmit(async (data) => {
12393
+ await mutateAsync(
12394
+ {
12395
+ shipping_address: {
12396
+ first_name: data.first_name,
12397
+ last_name: data.last_name,
12398
+ company: data.company,
12399
+ address_1: data.address_1,
12400
+ address_2: data.address_2,
12401
+ city: data.city,
12402
+ province: data.province,
12403
+ country_code: data.country_code,
12404
+ postal_code: data.postal_code,
12405
+ phone: data.phone
12406
+ }
12407
+ },
12408
+ {
12409
+ onSuccess: () => {
12410
+ handleSuccess();
12411
+ },
12412
+ onError: (error) => {
12413
+ ui.toast.error(error.message);
12414
+ }
12415
+ }
12416
+ );
12417
+ });
12418
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12419
+ KeyboundForm,
12420
+ {
12421
+ className: "flex flex-1 flex-col overflow-hidden",
12422
+ onSubmit,
12423
+ children: [
12424
+ /* @__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: [
12425
+ /* @__PURE__ */ jsxRuntime.jsx(
12426
+ Form$2.Field,
12427
+ {
12428
+ control: form.control,
12429
+ name: "country_code",
12430
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12431
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12432
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12433
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12434
+ ] })
12435
+ }
12436
+ ),
12437
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12438
+ /* @__PURE__ */ jsxRuntime.jsx(
12439
+ Form$2.Field,
12440
+ {
12441
+ control: form.control,
12442
+ name: "first_name",
12443
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12444
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12445
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12446
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12447
+ ] })
12448
+ }
12449
+ ),
12450
+ /* @__PURE__ */ jsxRuntime.jsx(
12451
+ Form$2.Field,
12452
+ {
12453
+ control: form.control,
12454
+ name: "last_name",
12455
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12456
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12457
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12458
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12459
+ ] })
12460
+ }
12461
+ )
12462
+ ] }),
12463
+ /* @__PURE__ */ jsxRuntime.jsx(
12464
+ Form$2.Field,
12465
+ {
12466
+ control: form.control,
12467
+ name: "company",
12468
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12469
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12470
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12471
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12472
+ ] })
12473
+ }
12474
+ ),
12475
+ /* @__PURE__ */ jsxRuntime.jsx(
12476
+ Form$2.Field,
12477
+ {
12478
+ control: form.control,
12479
+ name: "address_1",
12480
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12481
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12482
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12483
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12484
+ ] })
12485
+ }
12486
+ ),
12487
+ /* @__PURE__ */ jsxRuntime.jsx(
12488
+ Form$2.Field,
12489
+ {
12490
+ control: form.control,
12491
+ name: "address_2",
12492
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12493
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12494
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12495
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12496
+ ] })
12497
+ }
12498
+ ),
12499
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12500
+ /* @__PURE__ */ jsxRuntime.jsx(
12501
+ Form$2.Field,
12502
+ {
12503
+ control: form.control,
12504
+ name: "postal_code",
12505
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12506
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12507
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12508
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12509
+ ] })
12510
+ }
12511
+ ),
12512
+ /* @__PURE__ */ jsxRuntime.jsx(
12513
+ Form$2.Field,
12514
+ {
12515
+ control: form.control,
12516
+ name: "city",
12517
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12518
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12519
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12520
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12521
+ ] })
12522
+ }
12523
+ )
12524
+ ] }),
12525
+ /* @__PURE__ */ jsxRuntime.jsx(
12526
+ Form$2.Field,
12527
+ {
12528
+ control: form.control,
12529
+ name: "province",
12530
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12531
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12532
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12533
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12534
+ ] })
12535
+ }
12536
+ ),
12537
+ /* @__PURE__ */ jsxRuntime.jsx(
12538
+ Form$2.Field,
12539
+ {
12540
+ control: form.control,
12541
+ name: "phone",
12542
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12543
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12544
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12545
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12546
+ ] })
12547
+ }
12548
+ )
12549
+ ] }) }),
12550
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12551
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12552
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12553
+ ] }) })
12554
+ ]
12555
+ }
12556
+ ) });
12557
+ };
12558
+ const schema$1 = addressSchema;
12356
12559
  const TransferOwnership = () => {
12357
12560
  const { id } = reactRouterDom.useParams();
12358
12561
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12376,7 +12579,7 @@ const TransferOwnershipForm = ({ order }) => {
12376
12579
  defaultValues: {
12377
12580
  customer_id: order.customer_id || ""
12378
12581
  },
12379
- resolver: zod.zodResolver(schema$1)
12582
+ resolver: zod.zodResolver(schema)
12380
12583
  });
12381
12584
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12382
12585
  const { handleSuccess } = useRouteModal();
@@ -12826,212 +13029,9 @@ const Illustration = () => {
12826
13029
  }
12827
13030
  );
12828
13031
  };
12829
- const schema$1 = objectType({
13032
+ const schema = objectType({
12830
13033
  customer_id: stringType().min(1)
12831
13034
  });
12832
- const ShippingAddress = () => {
12833
- const { id } = reactRouterDom.useParams();
12834
- const { order, isPending, isError, error } = useOrder(id, {
12835
- fields: "+shipping_address"
12836
- });
12837
- if (isError) {
12838
- throw error;
12839
- }
12840
- const isReady = !isPending && !!order;
12841
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12842
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12843
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12844
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12845
- ] }),
12846
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12847
- ] });
12848
- };
12849
- const ShippingAddressForm = ({ order }) => {
12850
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12851
- const form = reactHookForm.useForm({
12852
- defaultValues: {
12853
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12854
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12855
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12856
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12857
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12858
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12859
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12860
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12861
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12862
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12863
- },
12864
- resolver: zod.zodResolver(schema)
12865
- });
12866
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12867
- const { handleSuccess } = useRouteModal();
12868
- const onSubmit = form.handleSubmit(async (data) => {
12869
- await mutateAsync(
12870
- {
12871
- shipping_address: {
12872
- first_name: data.first_name,
12873
- last_name: data.last_name,
12874
- company: data.company,
12875
- address_1: data.address_1,
12876
- address_2: data.address_2,
12877
- city: data.city,
12878
- province: data.province,
12879
- country_code: data.country_code,
12880
- postal_code: data.postal_code,
12881
- phone: data.phone
12882
- }
12883
- },
12884
- {
12885
- onSuccess: () => {
12886
- handleSuccess();
12887
- },
12888
- onError: (error) => {
12889
- ui.toast.error(error.message);
12890
- }
12891
- }
12892
- );
12893
- });
12894
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12895
- KeyboundForm,
12896
- {
12897
- className: "flex flex-1 flex-col overflow-hidden",
12898
- onSubmit,
12899
- children: [
12900
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
12901
- /* @__PURE__ */ jsxRuntime.jsx(
12902
- Form$2.Field,
12903
- {
12904
- control: form.control,
12905
- name: "country_code",
12906
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12907
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12908
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12909
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12910
- ] })
12911
- }
12912
- ),
12913
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12914
- /* @__PURE__ */ jsxRuntime.jsx(
12915
- Form$2.Field,
12916
- {
12917
- control: form.control,
12918
- name: "first_name",
12919
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12920
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12921
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12922
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12923
- ] })
12924
- }
12925
- ),
12926
- /* @__PURE__ */ jsxRuntime.jsx(
12927
- Form$2.Field,
12928
- {
12929
- control: form.control,
12930
- name: "last_name",
12931
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12932
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12933
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12934
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12935
- ] })
12936
- }
12937
- )
12938
- ] }),
12939
- /* @__PURE__ */ jsxRuntime.jsx(
12940
- Form$2.Field,
12941
- {
12942
- control: form.control,
12943
- name: "company",
12944
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12945
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12946
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12947
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12948
- ] })
12949
- }
12950
- ),
12951
- /* @__PURE__ */ jsxRuntime.jsx(
12952
- Form$2.Field,
12953
- {
12954
- control: form.control,
12955
- name: "address_1",
12956
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12957
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12958
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12959
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12960
- ] })
12961
- }
12962
- ),
12963
- /* @__PURE__ */ jsxRuntime.jsx(
12964
- Form$2.Field,
12965
- {
12966
- control: form.control,
12967
- name: "address_2",
12968
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12969
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12970
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12971
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12972
- ] })
12973
- }
12974
- ),
12975
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12976
- /* @__PURE__ */ jsxRuntime.jsx(
12977
- Form$2.Field,
12978
- {
12979
- control: form.control,
12980
- name: "postal_code",
12981
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12982
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12983
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12984
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12985
- ] })
12986
- }
12987
- ),
12988
- /* @__PURE__ */ jsxRuntime.jsx(
12989
- Form$2.Field,
12990
- {
12991
- control: form.control,
12992
- name: "city",
12993
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12994
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12995
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12996
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12997
- ] })
12998
- }
12999
- )
13000
- ] }),
13001
- /* @__PURE__ */ jsxRuntime.jsx(
13002
- Form$2.Field,
13003
- {
13004
- control: form.control,
13005
- name: "province",
13006
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13007
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13008
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13009
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13010
- ] })
13011
- }
13012
- ),
13013
- /* @__PURE__ */ jsxRuntime.jsx(
13014
- Form$2.Field,
13015
- {
13016
- control: form.control,
13017
- name: "phone",
13018
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13019
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13020
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13021
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13022
- ] })
13023
- }
13024
- )
13025
- ] }) }),
13026
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13027
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13028
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13029
- ] }) })
13030
- ]
13031
- }
13032
- ) });
13033
- };
13034
- const schema = addressSchema;
13035
13035
  const widgetModule = { widgets: [] };
13036
13036
  const routeModule = {
13037
13037
  routes: [
@@ -13052,14 +13052,14 @@ const routeModule = {
13052
13052
  handle,
13053
13053
  loader,
13054
13054
  children: [
13055
- {
13056
- Component: CustomItems,
13057
- path: "/draft-orders/:id/custom-items"
13058
- },
13059
13055
  {
13060
13056
  Component: BillingAddress,
13061
13057
  path: "/draft-orders/:id/billing-address"
13062
13058
  },
13059
+ {
13060
+ Component: CustomItems,
13061
+ path: "/draft-orders/:id/custom-items"
13062
+ },
13063
13063
  {
13064
13064
  Component: Email,
13065
13065
  path: "/draft-orders/:id/email"
@@ -13084,13 +13084,13 @@ const routeModule = {
13084
13084
  Component: Shipping,
13085
13085
  path: "/draft-orders/:id/shipping"
13086
13086
  },
13087
- {
13088
- Component: TransferOwnership,
13089
- path: "/draft-orders/:id/transfer-ownership"
13090
- },
13091
13087
  {
13092
13088
  Component: ShippingAddress,
13093
13089
  path: "/draft-orders/:id/shipping-address"
13090
+ },
13091
+ {
13092
+ Component: TransferOwnership,
13093
+ path: "/draft-orders/:id/transfer-ownership"
13094
13094
  }
13095
13095
  ]
13096
13096
  }
@@ -9554,27 +9554,6 @@ const ID = () => {
9554
9554
  /* @__PURE__ */ jsx(Outlet, {})
9555
9555
  ] });
9556
9556
  };
9557
- const CustomItems = () => {
9558
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9559
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9560
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9561
- ] });
9562
- };
9563
- const CustomItemsForm = () => {
9564
- const form = useForm({
9565
- resolver: zodResolver(schema$5)
9566
- });
9567
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9568
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9569
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9570
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9571
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9572
- ] }) })
9573
- ] }) });
9574
- };
9575
- const schema$5 = objectType({
9576
- email: stringType().email()
9577
- });
9578
9557
  const BillingAddress = () => {
9579
9558
  const { id } = useParams();
9580
9559
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9607,7 +9586,7 @@ const BillingAddressForm = ({ order }) => {
9607
9586
  postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9608
9587
  phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9609
9588
  },
9610
- resolver: zodResolver(schema$4)
9589
+ resolver: zodResolver(schema$5)
9611
9590
  });
9612
9591
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9613
9592
  const { handleSuccess } = useRouteModal();
@@ -9764,7 +9743,28 @@ const BillingAddressForm = ({ order }) => {
9764
9743
  }
9765
9744
  ) });
9766
9745
  };
9767
- const schema$4 = addressSchema;
9746
+ const schema$5 = addressSchema;
9747
+ const CustomItems = () => {
9748
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9749
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9750
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
9751
+ ] });
9752
+ };
9753
+ const CustomItemsForm = () => {
9754
+ const form = useForm({
9755
+ resolver: zodResolver(schema$4)
9756
+ });
9757
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9758
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9759
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9760
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9761
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9762
+ ] }) })
9763
+ ] }) });
9764
+ };
9765
+ const schema$4 = objectType({
9766
+ email: stringType().email()
9767
+ });
9768
9768
  const Email = () => {
9769
9769
  const { id } = useParams();
9770
9770
  const { order, isPending, isError, error } = useOrder(id, {
@@ -12347,6 +12347,209 @@ const CustomAmountField = ({
12347
12347
  }
12348
12348
  );
12349
12349
  };
12350
+ const ShippingAddress = () => {
12351
+ const { id } = useParams();
12352
+ const { order, isPending, isError, error } = useOrder(id, {
12353
+ fields: "+shipping_address"
12354
+ });
12355
+ if (isError) {
12356
+ throw error;
12357
+ }
12358
+ const isReady = !isPending && !!order;
12359
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12360
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12361
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12362
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12363
+ ] }),
12364
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12365
+ ] });
12366
+ };
12367
+ const ShippingAddressForm = ({ order }) => {
12368
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12369
+ const form = useForm({
12370
+ defaultValues: {
12371
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12372
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12373
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12374
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12375
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12376
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12377
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12378
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12379
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12380
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12381
+ },
12382
+ resolver: zodResolver(schema$1)
12383
+ });
12384
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12385
+ const { handleSuccess } = useRouteModal();
12386
+ const onSubmit = form.handleSubmit(async (data) => {
12387
+ await mutateAsync(
12388
+ {
12389
+ shipping_address: {
12390
+ first_name: data.first_name,
12391
+ last_name: data.last_name,
12392
+ company: data.company,
12393
+ address_1: data.address_1,
12394
+ address_2: data.address_2,
12395
+ city: data.city,
12396
+ province: data.province,
12397
+ country_code: data.country_code,
12398
+ postal_code: data.postal_code,
12399
+ phone: data.phone
12400
+ }
12401
+ },
12402
+ {
12403
+ onSuccess: () => {
12404
+ handleSuccess();
12405
+ },
12406
+ onError: (error) => {
12407
+ toast.error(error.message);
12408
+ }
12409
+ }
12410
+ );
12411
+ });
12412
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12413
+ KeyboundForm,
12414
+ {
12415
+ className: "flex flex-1 flex-col overflow-hidden",
12416
+ onSubmit,
12417
+ children: [
12418
+ /* @__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: [
12419
+ /* @__PURE__ */ jsx(
12420
+ Form$2.Field,
12421
+ {
12422
+ control: form.control,
12423
+ name: "country_code",
12424
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12425
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12426
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12427
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12428
+ ] })
12429
+ }
12430
+ ),
12431
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12432
+ /* @__PURE__ */ jsx(
12433
+ Form$2.Field,
12434
+ {
12435
+ control: form.control,
12436
+ name: "first_name",
12437
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12438
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12439
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12440
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12441
+ ] })
12442
+ }
12443
+ ),
12444
+ /* @__PURE__ */ jsx(
12445
+ Form$2.Field,
12446
+ {
12447
+ control: form.control,
12448
+ name: "last_name",
12449
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12450
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12451
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12452
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12453
+ ] })
12454
+ }
12455
+ )
12456
+ ] }),
12457
+ /* @__PURE__ */ jsx(
12458
+ Form$2.Field,
12459
+ {
12460
+ control: form.control,
12461
+ name: "company",
12462
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12463
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12464
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12465
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12466
+ ] })
12467
+ }
12468
+ ),
12469
+ /* @__PURE__ */ jsx(
12470
+ Form$2.Field,
12471
+ {
12472
+ control: form.control,
12473
+ name: "address_1",
12474
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12475
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12476
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12477
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12478
+ ] })
12479
+ }
12480
+ ),
12481
+ /* @__PURE__ */ jsx(
12482
+ Form$2.Field,
12483
+ {
12484
+ control: form.control,
12485
+ name: "address_2",
12486
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12487
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12488
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12489
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12490
+ ] })
12491
+ }
12492
+ ),
12493
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12494
+ /* @__PURE__ */ jsx(
12495
+ Form$2.Field,
12496
+ {
12497
+ control: form.control,
12498
+ name: "postal_code",
12499
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12500
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12501
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12502
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12503
+ ] })
12504
+ }
12505
+ ),
12506
+ /* @__PURE__ */ jsx(
12507
+ Form$2.Field,
12508
+ {
12509
+ control: form.control,
12510
+ name: "city",
12511
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12512
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12513
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12514
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12515
+ ] })
12516
+ }
12517
+ )
12518
+ ] }),
12519
+ /* @__PURE__ */ jsx(
12520
+ Form$2.Field,
12521
+ {
12522
+ control: form.control,
12523
+ name: "province",
12524
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12525
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12526
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12527
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12528
+ ] })
12529
+ }
12530
+ ),
12531
+ /* @__PURE__ */ jsx(
12532
+ Form$2.Field,
12533
+ {
12534
+ control: form.control,
12535
+ name: "phone",
12536
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12537
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12538
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12539
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12540
+ ] })
12541
+ }
12542
+ )
12543
+ ] }) }),
12544
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12545
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12546
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12547
+ ] }) })
12548
+ ]
12549
+ }
12550
+ ) });
12551
+ };
12552
+ const schema$1 = addressSchema;
12350
12553
  const TransferOwnership = () => {
12351
12554
  const { id } = useParams();
12352
12555
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12370,7 +12573,7 @@ const TransferOwnershipForm = ({ order }) => {
12370
12573
  defaultValues: {
12371
12574
  customer_id: order.customer_id || ""
12372
12575
  },
12373
- resolver: zodResolver(schema$1)
12576
+ resolver: zodResolver(schema)
12374
12577
  });
12375
12578
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12376
12579
  const { handleSuccess } = useRouteModal();
@@ -12820,212 +13023,9 @@ const Illustration = () => {
12820
13023
  }
12821
13024
  );
12822
13025
  };
12823
- const schema$1 = objectType({
13026
+ const schema = objectType({
12824
13027
  customer_id: stringType().min(1)
12825
13028
  });
12826
- const ShippingAddress = () => {
12827
- const { id } = useParams();
12828
- const { order, isPending, isError, error } = useOrder(id, {
12829
- fields: "+shipping_address"
12830
- });
12831
- if (isError) {
12832
- throw error;
12833
- }
12834
- const isReady = !isPending && !!order;
12835
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12836
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12837
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12838
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12839
- ] }),
12840
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12841
- ] });
12842
- };
12843
- const ShippingAddressForm = ({ order }) => {
12844
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12845
- const form = useForm({
12846
- defaultValues: {
12847
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12848
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12849
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12850
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12851
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12852
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12853
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12854
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12855
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12856
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12857
- },
12858
- resolver: zodResolver(schema)
12859
- });
12860
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12861
- const { handleSuccess } = useRouteModal();
12862
- const onSubmit = form.handleSubmit(async (data) => {
12863
- await mutateAsync(
12864
- {
12865
- shipping_address: {
12866
- first_name: data.first_name,
12867
- last_name: data.last_name,
12868
- company: data.company,
12869
- address_1: data.address_1,
12870
- address_2: data.address_2,
12871
- city: data.city,
12872
- province: data.province,
12873
- country_code: data.country_code,
12874
- postal_code: data.postal_code,
12875
- phone: data.phone
12876
- }
12877
- },
12878
- {
12879
- onSuccess: () => {
12880
- handleSuccess();
12881
- },
12882
- onError: (error) => {
12883
- toast.error(error.message);
12884
- }
12885
- }
12886
- );
12887
- });
12888
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12889
- KeyboundForm,
12890
- {
12891
- className: "flex flex-1 flex-col overflow-hidden",
12892
- onSubmit,
12893
- children: [
12894
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
12895
- /* @__PURE__ */ jsx(
12896
- Form$2.Field,
12897
- {
12898
- control: form.control,
12899
- name: "country_code",
12900
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12901
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12902
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12903
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12904
- ] })
12905
- }
12906
- ),
12907
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12908
- /* @__PURE__ */ jsx(
12909
- Form$2.Field,
12910
- {
12911
- control: form.control,
12912
- name: "first_name",
12913
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12914
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12915
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12916
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12917
- ] })
12918
- }
12919
- ),
12920
- /* @__PURE__ */ jsx(
12921
- Form$2.Field,
12922
- {
12923
- control: form.control,
12924
- name: "last_name",
12925
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12926
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12927
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12928
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12929
- ] })
12930
- }
12931
- )
12932
- ] }),
12933
- /* @__PURE__ */ jsx(
12934
- Form$2.Field,
12935
- {
12936
- control: form.control,
12937
- name: "company",
12938
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12939
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12940
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12941
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12942
- ] })
12943
- }
12944
- ),
12945
- /* @__PURE__ */ jsx(
12946
- Form$2.Field,
12947
- {
12948
- control: form.control,
12949
- name: "address_1",
12950
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12951
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12952
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12953
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12954
- ] })
12955
- }
12956
- ),
12957
- /* @__PURE__ */ jsx(
12958
- Form$2.Field,
12959
- {
12960
- control: form.control,
12961
- name: "address_2",
12962
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12963
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12964
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12965
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12966
- ] })
12967
- }
12968
- ),
12969
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12970
- /* @__PURE__ */ jsx(
12971
- Form$2.Field,
12972
- {
12973
- control: form.control,
12974
- name: "postal_code",
12975
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12976
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12977
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12978
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12979
- ] })
12980
- }
12981
- ),
12982
- /* @__PURE__ */ jsx(
12983
- Form$2.Field,
12984
- {
12985
- control: form.control,
12986
- name: "city",
12987
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12988
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12989
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12990
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12991
- ] })
12992
- }
12993
- )
12994
- ] }),
12995
- /* @__PURE__ */ jsx(
12996
- Form$2.Field,
12997
- {
12998
- control: form.control,
12999
- name: "province",
13000
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13001
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13002
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13003
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13004
- ] })
13005
- }
13006
- ),
13007
- /* @__PURE__ */ jsx(
13008
- Form$2.Field,
13009
- {
13010
- control: form.control,
13011
- name: "phone",
13012
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13013
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13014
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13015
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13016
- ] })
13017
- }
13018
- )
13019
- ] }) }),
13020
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13021
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13022
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13023
- ] }) })
13024
- ]
13025
- }
13026
- ) });
13027
- };
13028
- const schema = addressSchema;
13029
13029
  const widgetModule = { widgets: [] };
13030
13030
  const routeModule = {
13031
13031
  routes: [
@@ -13046,14 +13046,14 @@ const routeModule = {
13046
13046
  handle,
13047
13047
  loader,
13048
13048
  children: [
13049
- {
13050
- Component: CustomItems,
13051
- path: "/draft-orders/:id/custom-items"
13052
- },
13053
13049
  {
13054
13050
  Component: BillingAddress,
13055
13051
  path: "/draft-orders/:id/billing-address"
13056
13052
  },
13053
+ {
13054
+ Component: CustomItems,
13055
+ path: "/draft-orders/:id/custom-items"
13056
+ },
13057
13057
  {
13058
13058
  Component: Email,
13059
13059
  path: "/draft-orders/:id/email"
@@ -13078,13 +13078,13 @@ const routeModule = {
13078
13078
  Component: Shipping,
13079
13079
  path: "/draft-orders/:id/shipping"
13080
13080
  },
13081
- {
13082
- Component: TransferOwnership,
13083
- path: "/draft-orders/:id/transfer-ownership"
13084
- },
13085
13081
  {
13086
13082
  Component: ShippingAddress,
13087
13083
  path: "/draft-orders/:id/shipping-address"
13084
+ },
13085
+ {
13086
+ Component: TransferOwnership,
13087
+ path: "/draft-orders/:id/transfer-ownership"
13088
13088
  }
13089
13089
  ]
13090
13090
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.10.2-snapshot-20250904073034",
3
+ "version": "2.10.2-snapshot-20250904141849",
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.2-snapshot-20250904073034",
39
+ "@medusajs/js-sdk": "2.10.2-snapshot-20250904141849",
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,19 +45,19 @@
45
45
  "react-hook-form": "7.49.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@medusajs/admin-sdk": "2.10.2-snapshot-20250904073034",
49
- "@medusajs/cli": "2.10.2-snapshot-20250904073034",
50
- "@medusajs/framework": "2.10.2-snapshot-20250904073034",
51
- "@medusajs/icons": "2.10.2-snapshot-20250904073034",
52
- "@medusajs/test-utils": "2.10.2-snapshot-20250904073034",
53
- "@medusajs/types": "2.10.2-snapshot-20250904073034",
54
- "@medusajs/ui": "4.0.22-snapshot-20250904073034",
55
- "@medusajs/ui-preset": "2.10.2-snapshot-20250904073034",
56
- "@mikro-orm/cli": "6.5.2",
57
- "@mikro-orm/core": "6.5.2",
58
- "@mikro-orm/knex": "6.5.2",
59
- "@mikro-orm/migrations": "6.5.2",
60
- "@mikro-orm/postgresql": "6.5.2",
48
+ "@medusajs/admin-sdk": "2.10.2-snapshot-20250904141849",
49
+ "@medusajs/cli": "2.10.2-snapshot-20250904141849",
50
+ "@medusajs/framework": "2.10.2-snapshot-20250904141849",
51
+ "@medusajs/icons": "2.10.2-snapshot-20250904141849",
52
+ "@medusajs/test-utils": "2.10.2-snapshot-20250904141849",
53
+ "@medusajs/types": "2.10.2-snapshot-20250904141849",
54
+ "@medusajs/ui": "4.0.22-snapshot-20250904141849",
55
+ "@medusajs/ui-preset": "2.10.2-snapshot-20250904141849",
56
+ "@mikro-orm/cli": "6.4.3",
57
+ "@mikro-orm/core": "6.4.3",
58
+ "@mikro-orm/knex": "6.4.3",
59
+ "@mikro-orm/migrations": "6.4.3",
60
+ "@mikro-orm/postgresql": "6.4.3",
61
61
  "@swc/core": "1.5.7",
62
62
  "@types/lodash": "^4.17.15",
63
63
  "@types/node": "^20.0.0",
@@ -65,7 +65,7 @@
65
65
  "@types/react-dom": "^18.2.25",
66
66
  "awilix": "^8.0.1",
67
67
  "lodash": "^4.17.21",
68
- "pg": "^8.16.3",
68
+ "pg": "^8.13.0",
69
69
  "react": "^18.2.0",
70
70
  "react-dom": "^18.2.0",
71
71
  "react-router-dom": "6.20.1",
@@ -76,20 +76,20 @@
76
76
  "yalc": "^1.0.0-pre.53"
77
77
  },
78
78
  "peerDependencies": {
79
- "@medusajs/admin-sdk": "2.10.2-snapshot-20250904073034",
80
- "@medusajs/cli": "2.10.2-snapshot-20250904073034",
81
- "@medusajs/framework": "2.10.2-snapshot-20250904073034",
82
- "@medusajs/icons": "2.10.2-snapshot-20250904073034",
83
- "@medusajs/test-utils": "2.10.2-snapshot-20250904073034",
84
- "@medusajs/ui": "4.0.22-snapshot-20250904073034",
85
- "@mikro-orm/cli": "6.5.2",
86
- "@mikro-orm/core": "6.5.2",
87
- "@mikro-orm/knex": "6.5.2",
88
- "@mikro-orm/migrations": "6.5.2",
89
- "@mikro-orm/postgresql": "6.5.2",
79
+ "@medusajs/admin-sdk": "2.10.2-snapshot-20250904141849",
80
+ "@medusajs/cli": "2.10.2-snapshot-20250904141849",
81
+ "@medusajs/framework": "2.10.2-snapshot-20250904141849",
82
+ "@medusajs/icons": "2.10.2-snapshot-20250904141849",
83
+ "@medusajs/test-utils": "2.10.2-snapshot-20250904141849",
84
+ "@medusajs/ui": "4.0.22-snapshot-20250904141849",
85
+ "@mikro-orm/cli": "6.4.3",
86
+ "@mikro-orm/core": "6.4.3",
87
+ "@mikro-orm/knex": "6.4.3",
88
+ "@mikro-orm/migrations": "6.4.3",
89
+ "@mikro-orm/postgresql": "6.4.3",
90
90
  "awilix": "^8.0.1",
91
91
  "lodash": "^4.17.21",
92
- "pg": "^8.16.3",
92
+ "pg": "^8.13.0",
93
93
  "react-router-dom": "6.20.1"
94
94
  },
95
95
  "engines": {