@medusajs/draft-order 2.13.0 → 2.13.1-preview-20260122210258

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.
@@ -9764,27 +9764,6 @@ const BillingAddressForm = ({ order }) => {
9764
9764
  ) });
9765
9765
  };
9766
9766
  const schema$5 = addressSchema;
9767
- const CustomItems = () => {
9768
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9769
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9770
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9771
- ] });
9772
- };
9773
- const CustomItemsForm = () => {
9774
- const form = reactHookForm.useForm({
9775
- resolver: zod.zodResolver(schema$4)
9776
- });
9777
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9778
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9779
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9780
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9781
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9782
- ] }) })
9783
- ] }) });
9784
- };
9785
- const schema$4 = objectType({
9786
- email: stringType().email()
9787
- });
9788
9767
  const NumberInput = React.forwardRef(
9789
9768
  ({
9790
9769
  value,
@@ -11109,6 +11088,74 @@ function getHasUneditableRows(metadata) {
11109
11088
  (value) => !EDITABLE_TYPES.includes(typeof value)
11110
11089
  );
11111
11090
  }
11091
+ const Email = () => {
11092
+ const { id } = reactRouterDom.useParams();
11093
+ const { order, isPending, isError, error } = useOrder(id, {
11094
+ fields: "+email"
11095
+ });
11096
+ if (isError) {
11097
+ throw error;
11098
+ }
11099
+ const isReady = !isPending && !!order;
11100
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11101
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11102
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
11103
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
11104
+ ] }),
11105
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
11106
+ ] });
11107
+ };
11108
+ const EmailForm = ({ order }) => {
11109
+ const form = reactHookForm.useForm({
11110
+ defaultValues: {
11111
+ email: order.email ?? ""
11112
+ },
11113
+ resolver: zod.zodResolver(schema$4)
11114
+ });
11115
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11116
+ const { handleSuccess } = useRouteModal();
11117
+ const onSubmit = form.handleSubmit(async (data) => {
11118
+ await mutateAsync(
11119
+ { email: data.email },
11120
+ {
11121
+ onSuccess: () => {
11122
+ handleSuccess();
11123
+ },
11124
+ onError: (error) => {
11125
+ ui.toast.error(error.message);
11126
+ }
11127
+ }
11128
+ );
11129
+ });
11130
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11131
+ KeyboundForm,
11132
+ {
11133
+ className: "flex flex-1 flex-col overflow-hidden",
11134
+ onSubmit,
11135
+ children: [
11136
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
11137
+ Form$2.Field,
11138
+ {
11139
+ control: form.control,
11140
+ name: "email",
11141
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11142
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
11143
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11144
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11145
+ ] })
11146
+ }
11147
+ ) }),
11148
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11149
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11150
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11151
+ ] }) })
11152
+ ]
11153
+ }
11154
+ ) });
11155
+ };
11156
+ const schema$4 = objectType({
11157
+ email: stringType().email()
11158
+ });
11112
11159
  const PROMOTION_QUERY_KEY = "promotions";
11113
11160
  const promotionsQueryKeys = {
11114
11161
  list: (query2) => [
@@ -11386,6 +11433,27 @@ function getPromotionIds(items, shippingMethods) {
11386
11433
  }
11387
11434
  return Array.from(promotionIds);
11388
11435
  }
11436
+ const CustomItems = () => {
11437
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11438
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
11439
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
11440
+ ] });
11441
+ };
11442
+ const CustomItemsForm = () => {
11443
+ const form = reactHookForm.useForm({
11444
+ resolver: zod.zodResolver(schema$3)
11445
+ });
11446
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
11447
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
11448
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11449
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11450
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
11451
+ ] }) })
11452
+ ] }) });
11453
+ };
11454
+ const schema$3 = objectType({
11455
+ email: stringType().email()
11456
+ });
11389
11457
  const SalesChannel = () => {
11390
11458
  const { id } = reactRouterDom.useParams();
11391
11459
  const { draft_order, isPending, isError, error } = useDraftOrder(
@@ -11414,7 +11482,7 @@ const SalesChannelForm = ({ order }) => {
11414
11482
  defaultValues: {
11415
11483
  sales_channel_id: order.sales_channel_id || ""
11416
11484
  },
11417
- resolver: zod.zodResolver(schema$3)
11485
+ resolver: zod.zodResolver(schema$2)
11418
11486
  });
11419
11487
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11420
11488
  const { handleSuccess } = useRouteModal();
@@ -11489,7 +11557,7 @@ const SalesChannelField = ({ control, order }) => {
11489
11557
  }
11490
11558
  );
11491
11559
  };
11492
- const schema$3 = objectType({
11560
+ const schema$2 = objectType({
11493
11561
  sales_channel_id: stringType().min(1)
11494
11562
  });
11495
11563
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12331,7 +12399,7 @@ const ShippingAddressForm = ({ order }) => {
12331
12399
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12332
12400
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12333
12401
  },
12334
- resolver: zod.zodResolver(schema$2)
12402
+ resolver: zod.zodResolver(schema$1)
12335
12403
  });
12336
12404
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12337
12405
  const { handleSuccess } = useRouteModal();
@@ -12501,7 +12569,7 @@ const ShippingAddressForm = ({ order }) => {
12501
12569
  }
12502
12570
  ) });
12503
12571
  };
12504
- const schema$2 = addressSchema;
12572
+ const schema$1 = addressSchema;
12505
12573
  const TransferOwnership = () => {
12506
12574
  const { id } = reactRouterDom.useParams();
12507
12575
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12525,7 +12593,7 @@ const TransferOwnershipForm = ({ order }) => {
12525
12593
  defaultValues: {
12526
12594
  customer_id: order.customer_id || ""
12527
12595
  },
12528
- resolver: zod.zodResolver(schema$1)
12596
+ resolver: zod.zodResolver(schema)
12529
12597
  });
12530
12598
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12531
12599
  const { handleSuccess } = useRouteModal();
@@ -12975,76 +13043,8 @@ const Illustration = () => {
12975
13043
  }
12976
13044
  );
12977
13045
  };
12978
- const schema$1 = objectType({
12979
- customer_id: stringType().min(1)
12980
- });
12981
- const Email = () => {
12982
- const { id } = reactRouterDom.useParams();
12983
- const { order, isPending, isError, error } = useOrder(id, {
12984
- fields: "+email"
12985
- });
12986
- if (isError) {
12987
- throw error;
12988
- }
12989
- const isReady = !isPending && !!order;
12990
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12991
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12992
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
12993
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12994
- ] }),
12995
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
12996
- ] });
12997
- };
12998
- const EmailForm = ({ order }) => {
12999
- const form = reactHookForm.useForm({
13000
- defaultValues: {
13001
- email: order.email ?? ""
13002
- },
13003
- resolver: zod.zodResolver(schema)
13004
- });
13005
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
13006
- const { handleSuccess } = useRouteModal();
13007
- const onSubmit = form.handleSubmit(async (data) => {
13008
- await mutateAsync(
13009
- { email: data.email },
13010
- {
13011
- onSuccess: () => {
13012
- handleSuccess();
13013
- },
13014
- onError: (error) => {
13015
- ui.toast.error(error.message);
13016
- }
13017
- }
13018
- );
13019
- });
13020
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
13021
- KeyboundForm,
13022
- {
13023
- className: "flex flex-1 flex-col overflow-hidden",
13024
- onSubmit,
13025
- children: [
13026
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
13027
- Form$2.Field,
13028
- {
13029
- control: form.control,
13030
- name: "email",
13031
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13032
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
13033
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13034
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13035
- ] })
13036
- }
13037
- ) }),
13038
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13039
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13040
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13041
- ] }) })
13042
- ]
13043
- }
13044
- ) });
13045
- };
13046
13046
  const schema = objectType({
13047
- email: stringType().email()
13047
+ customer_id: stringType().min(1)
13048
13048
  });
13049
13049
  const widgetModule = { widgets: [] };
13050
13050
  const routeModule = {
@@ -13070,10 +13070,6 @@ const routeModule = {
13070
13070
  Component: BillingAddress,
13071
13071
  path: "/draft-orders/:id/billing-address"
13072
13072
  },
13073
- {
13074
- Component: CustomItems,
13075
- path: "/draft-orders/:id/custom-items"
13076
- },
13077
13073
  {
13078
13074
  Component: Items,
13079
13075
  path: "/draft-orders/:id/items"
@@ -13082,10 +13078,18 @@ const routeModule = {
13082
13078
  Component: Metadata,
13083
13079
  path: "/draft-orders/:id/metadata"
13084
13080
  },
13081
+ {
13082
+ Component: Email,
13083
+ path: "/draft-orders/:id/email"
13084
+ },
13085
13085
  {
13086
13086
  Component: Promotions,
13087
13087
  path: "/draft-orders/:id/promotions"
13088
13088
  },
13089
+ {
13090
+ Component: CustomItems,
13091
+ path: "/draft-orders/:id/custom-items"
13092
+ },
13089
13093
  {
13090
13094
  Component: SalesChannel,
13091
13095
  path: "/draft-orders/:id/sales-channel"
@@ -13101,10 +13105,6 @@ const routeModule = {
13101
13105
  {
13102
13106
  Component: TransferOwnership,
13103
13107
  path: "/draft-orders/:id/transfer-ownership"
13104
- },
13105
- {
13106
- Component: Email,
13107
- path: "/draft-orders/:id/email"
13108
13108
  }
13109
13109
  ]
13110
13110
  }
@@ -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 NumberInput = forwardRef(
9782
9761
  ({
9783
9762
  value,
@@ -11102,6 +11081,74 @@ function getHasUneditableRows(metadata) {
11102
11081
  (value) => !EDITABLE_TYPES.includes(typeof value)
11103
11082
  );
11104
11083
  }
11084
+ const Email = () => {
11085
+ const { id } = useParams();
11086
+ const { order, isPending, isError, error } = useOrder(id, {
11087
+ fields: "+email"
11088
+ });
11089
+ if (isError) {
11090
+ throw error;
11091
+ }
11092
+ const isReady = !isPending && !!order;
11093
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11094
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11095
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
11096
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
11097
+ ] }),
11098
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
11099
+ ] });
11100
+ };
11101
+ const EmailForm = ({ order }) => {
11102
+ const form = useForm({
11103
+ defaultValues: {
11104
+ email: order.email ?? ""
11105
+ },
11106
+ resolver: zodResolver(schema$4)
11107
+ });
11108
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11109
+ const { handleSuccess } = useRouteModal();
11110
+ const onSubmit = form.handleSubmit(async (data) => {
11111
+ await mutateAsync(
11112
+ { email: data.email },
11113
+ {
11114
+ onSuccess: () => {
11115
+ handleSuccess();
11116
+ },
11117
+ onError: (error) => {
11118
+ toast.error(error.message);
11119
+ }
11120
+ }
11121
+ );
11122
+ });
11123
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11124
+ KeyboundForm,
11125
+ {
11126
+ className: "flex flex-1 flex-col overflow-hidden",
11127
+ onSubmit,
11128
+ children: [
11129
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
11130
+ Form$2.Field,
11131
+ {
11132
+ control: form.control,
11133
+ name: "email",
11134
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11135
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
11136
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11137
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11138
+ ] })
11139
+ }
11140
+ ) }),
11141
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11142
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11143
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11144
+ ] }) })
11145
+ ]
11146
+ }
11147
+ ) });
11148
+ };
11149
+ const schema$4 = objectType({
11150
+ email: stringType().email()
11151
+ });
11105
11152
  const PROMOTION_QUERY_KEY = "promotions";
11106
11153
  const promotionsQueryKeys = {
11107
11154
  list: (query2) => [
@@ -11379,6 +11426,27 @@ function getPromotionIds(items, shippingMethods) {
11379
11426
  }
11380
11427
  return Array.from(promotionIds);
11381
11428
  }
11429
+ const CustomItems = () => {
11430
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11431
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
11432
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
11433
+ ] });
11434
+ };
11435
+ const CustomItemsForm = () => {
11436
+ const form = useForm({
11437
+ resolver: zodResolver(schema$3)
11438
+ });
11439
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
11440
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
11441
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11442
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11443
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
11444
+ ] }) })
11445
+ ] }) });
11446
+ };
11447
+ const schema$3 = objectType({
11448
+ email: stringType().email()
11449
+ });
11382
11450
  const SalesChannel = () => {
11383
11451
  const { id } = useParams();
11384
11452
  const { draft_order, isPending, isError, error } = useDraftOrder(
@@ -11407,7 +11475,7 @@ const SalesChannelForm = ({ order }) => {
11407
11475
  defaultValues: {
11408
11476
  sales_channel_id: order.sales_channel_id || ""
11409
11477
  },
11410
- resolver: zodResolver(schema$3)
11478
+ resolver: zodResolver(schema$2)
11411
11479
  });
11412
11480
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11413
11481
  const { handleSuccess } = useRouteModal();
@@ -11482,7 +11550,7 @@ const SalesChannelField = ({ control, order }) => {
11482
11550
  }
11483
11551
  );
11484
11552
  };
11485
- const schema$3 = objectType({
11553
+ const schema$2 = objectType({
11486
11554
  sales_channel_id: stringType().min(1)
11487
11555
  });
11488
11556
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12324,7 +12392,7 @@ const ShippingAddressForm = ({ order }) => {
12324
12392
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12325
12393
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12326
12394
  },
12327
- resolver: zodResolver(schema$2)
12395
+ resolver: zodResolver(schema$1)
12328
12396
  });
12329
12397
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12330
12398
  const { handleSuccess } = useRouteModal();
@@ -12494,7 +12562,7 @@ const ShippingAddressForm = ({ order }) => {
12494
12562
  }
12495
12563
  ) });
12496
12564
  };
12497
- const schema$2 = addressSchema;
12565
+ const schema$1 = addressSchema;
12498
12566
  const TransferOwnership = () => {
12499
12567
  const { id } = useParams();
12500
12568
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12518,7 +12586,7 @@ const TransferOwnershipForm = ({ order }) => {
12518
12586
  defaultValues: {
12519
12587
  customer_id: order.customer_id || ""
12520
12588
  },
12521
- resolver: zodResolver(schema$1)
12589
+ resolver: zodResolver(schema)
12522
12590
  });
12523
12591
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12524
12592
  const { handleSuccess } = useRouteModal();
@@ -12968,76 +13036,8 @@ const Illustration = () => {
12968
13036
  }
12969
13037
  );
12970
13038
  };
12971
- const schema$1 = objectType({
12972
- customer_id: stringType().min(1)
12973
- });
12974
- const Email = () => {
12975
- const { id } = useParams();
12976
- const { order, isPending, isError, error } = useOrder(id, {
12977
- fields: "+email"
12978
- });
12979
- if (isError) {
12980
- throw error;
12981
- }
12982
- const isReady = !isPending && !!order;
12983
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12984
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12985
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
12986
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12987
- ] }),
12988
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
12989
- ] });
12990
- };
12991
- const EmailForm = ({ order }) => {
12992
- const form = useForm({
12993
- defaultValues: {
12994
- email: order.email ?? ""
12995
- },
12996
- resolver: zodResolver(schema)
12997
- });
12998
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12999
- const { handleSuccess } = useRouteModal();
13000
- const onSubmit = form.handleSubmit(async (data) => {
13001
- await mutateAsync(
13002
- { email: data.email },
13003
- {
13004
- onSuccess: () => {
13005
- handleSuccess();
13006
- },
13007
- onError: (error) => {
13008
- toast.error(error.message);
13009
- }
13010
- }
13011
- );
13012
- });
13013
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
13014
- KeyboundForm,
13015
- {
13016
- className: "flex flex-1 flex-col overflow-hidden",
13017
- onSubmit,
13018
- children: [
13019
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
13020
- Form$2.Field,
13021
- {
13022
- control: form.control,
13023
- name: "email",
13024
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13025
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
13026
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13027
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13028
- ] })
13029
- }
13030
- ) }),
13031
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13032
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13033
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13034
- ] }) })
13035
- ]
13036
- }
13037
- ) });
13038
- };
13039
13039
  const schema = objectType({
13040
- email: stringType().email()
13040
+ customer_id: stringType().min(1)
13041
13041
  });
13042
13042
  const widgetModule = { widgets: [] };
13043
13043
  const routeModule = {
@@ -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: Items,
13072
13068
  path: "/draft-orders/:id/items"
@@ -13075,10 +13071,18 @@ const routeModule = {
13075
13071
  Component: Metadata,
13076
13072
  path: "/draft-orders/:id/metadata"
13077
13073
  },
13074
+ {
13075
+ Component: Email,
13076
+ path: "/draft-orders/:id/email"
13077
+ },
13078
13078
  {
13079
13079
  Component: Promotions,
13080
13080
  path: "/draft-orders/:id/promotions"
13081
13081
  },
13082
+ {
13083
+ Component: CustomItems,
13084
+ path: "/draft-orders/:id/custom-items"
13085
+ },
13082
13086
  {
13083
13087
  Component: SalesChannel,
13084
13088
  path: "/draft-orders/:id/sales-channel"
@@ -13094,10 +13098,6 @@ const routeModule = {
13094
13098
  {
13095
13099
  Component: TransferOwnership,
13096
13100
  path: "/draft-orders/:id/transfer-ownership"
13097
- },
13098
- {
13099
- Component: Email,
13100
- path: "/draft-orders/:id/email"
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.13.0",
3
+ "version": "2.13.1-preview-20260122210258",
4
4
  "description": "A draft order plugin for Medusa.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -42,7 +42,7 @@
42
42
  "@ariakit/react": "^0.4.15",
43
43
  "@babel/runtime": "^7.26.10",
44
44
  "@hookform/resolvers": "3.4.2",
45
- "@medusajs/js-sdk": "2.13.0",
45
+ "@medusajs/js-sdk": "2.13.1-preview-20260122210258",
46
46
  "@tanstack/react-query": "5.64.2",
47
47
  "@uiw/react-json-view": "^2.0.0-alpha.17",
48
48
  "date-fns": "^3.6.0",
@@ -53,22 +53,22 @@
53
53
  "react-hook-form": "7.49.1"
54
54
  },
55
55
  "devDependencies": {
56
- "@medusajs/admin-sdk": "2.13.0",
57
- "@medusajs/cli": "2.13.0",
58
- "@medusajs/framework": "2.13.0",
59
- "@medusajs/icons": "2.13.0",
60
- "@medusajs/test-utils": "2.13.0",
61
- "@medusajs/types": "2.13.0",
62
- "@medusajs/ui": "4.1.0",
63
- "@medusajs/ui-preset": "2.13.0"
56
+ "@medusajs/admin-sdk": "2.13.1-preview-20260122210258",
57
+ "@medusajs/cli": "2.13.1-preview-20260122210258",
58
+ "@medusajs/framework": "2.13.1-preview-20260122210258",
59
+ "@medusajs/icons": "2.13.1-preview-20260122210258",
60
+ "@medusajs/test-utils": "2.13.1-preview-20260122210258",
61
+ "@medusajs/types": "2.13.1-preview-20260122210258",
62
+ "@medusajs/ui": "4.1.1-preview-20260122210258",
63
+ "@medusajs/ui-preset": "2.13.1-preview-20260122210258"
64
64
  },
65
65
  "peerDependencies": {
66
- "@medusajs/admin-sdk": "2.13.0",
67
- "@medusajs/cli": "2.13.0",
68
- "@medusajs/framework": "2.13.0",
69
- "@medusajs/icons": "2.13.0",
70
- "@medusajs/test-utils": "2.13.0",
71
- "@medusajs/ui": "4.1.0",
66
+ "@medusajs/admin-sdk": "2.13.1-preview-20260122210258",
67
+ "@medusajs/cli": "2.13.1-preview-20260122210258",
68
+ "@medusajs/framework": "2.13.1-preview-20260122210258",
69
+ "@medusajs/icons": "2.13.1-preview-20260122210258",
70
+ "@medusajs/test-utils": "2.13.1-preview-20260122210258",
71
+ "@medusajs/ui": "4.1.1-preview-20260122210258",
72
72
  "react": "^18.3.1",
73
73
  "react-dom": "^18.3.1",
74
74
  "react-router-dom": "6.30.3"