@medusajs/draft-order 2.11.4-preview-20251120000304 → 2.11.4-preview-20251120032016

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.
@@ -9783,6 +9783,74 @@ const CustomItemsForm = () => {
9783
9783
  const schema$4 = objectType({
9784
9784
  email: stringType().email()
9785
9785
  });
9786
+ const Email = () => {
9787
+ const { id } = reactRouterDom.useParams();
9788
+ const { order, isPending, isError, error } = useOrder(id, {
9789
+ fields: "+email"
9790
+ });
9791
+ if (isError) {
9792
+ throw error;
9793
+ }
9794
+ const isReady = !isPending && !!order;
9795
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9796
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9797
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9798
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9799
+ ] }),
9800
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9801
+ ] });
9802
+ };
9803
+ const EmailForm = ({ order }) => {
9804
+ const form = reactHookForm.useForm({
9805
+ defaultValues: {
9806
+ email: order.email ?? ""
9807
+ },
9808
+ resolver: zod.zodResolver(schema$3)
9809
+ });
9810
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9811
+ const { handleSuccess } = useRouteModal();
9812
+ const onSubmit = form.handleSubmit(async (data) => {
9813
+ await mutateAsync(
9814
+ { email: data.email },
9815
+ {
9816
+ onSuccess: () => {
9817
+ handleSuccess();
9818
+ },
9819
+ onError: (error) => {
9820
+ ui.toast.error(error.message);
9821
+ }
9822
+ }
9823
+ );
9824
+ });
9825
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9826
+ KeyboundForm,
9827
+ {
9828
+ className: "flex flex-1 flex-col overflow-hidden",
9829
+ onSubmit,
9830
+ children: [
9831
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9832
+ Form$2.Field,
9833
+ {
9834
+ control: form.control,
9835
+ name: "email",
9836
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9837
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9838
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9839
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9840
+ ] })
9841
+ }
9842
+ ) }),
9843
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9844
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9845
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9846
+ ] }) })
9847
+ ]
9848
+ }
9849
+ ) });
9850
+ };
9851
+ const schema$3 = objectType({
9852
+ email: stringType().email()
9853
+ });
9786
9854
  const NumberInput = React.forwardRef(
9787
9855
  ({
9788
9856
  value,
@@ -11107,74 +11175,6 @@ function getHasUneditableRows(metadata) {
11107
11175
  (value) => !EDITABLE_TYPES.includes(typeof value)
11108
11176
  );
11109
11177
  }
11110
- const Email = () => {
11111
- const { id } = reactRouterDom.useParams();
11112
- const { order, isPending, isError, error } = useOrder(id, {
11113
- fields: "+email"
11114
- });
11115
- if (isError) {
11116
- throw error;
11117
- }
11118
- const isReady = !isPending && !!order;
11119
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11120
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11121
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
11122
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
11123
- ] }),
11124
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
11125
- ] });
11126
- };
11127
- const EmailForm = ({ order }) => {
11128
- const form = reactHookForm.useForm({
11129
- defaultValues: {
11130
- email: order.email ?? ""
11131
- },
11132
- resolver: zod.zodResolver(schema$3)
11133
- });
11134
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11135
- const { handleSuccess } = useRouteModal();
11136
- const onSubmit = form.handleSubmit(async (data) => {
11137
- await mutateAsync(
11138
- { email: data.email },
11139
- {
11140
- onSuccess: () => {
11141
- handleSuccess();
11142
- },
11143
- onError: (error) => {
11144
- ui.toast.error(error.message);
11145
- }
11146
- }
11147
- );
11148
- });
11149
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11150
- KeyboundForm,
11151
- {
11152
- className: "flex flex-1 flex-col overflow-hidden",
11153
- onSubmit,
11154
- children: [
11155
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
11156
- Form$2.Field,
11157
- {
11158
- control: form.control,
11159
- name: "email",
11160
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11161
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
11162
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11163
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11164
- ] })
11165
- }
11166
- ) }),
11167
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11168
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11169
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11170
- ] }) })
11171
- ]
11172
- }
11173
- ) });
11174
- };
11175
- const schema$3 = objectType({
11176
- email: stringType().email()
11177
- });
11178
11178
  const PROMOTION_QUERY_KEY = "promotions";
11179
11179
  const promotionsQueryKeys = {
11180
11180
  list: (query2) => [
@@ -13072,6 +13072,10 @@ const routeModule = {
13072
13072
  Component: CustomItems,
13073
13073
  path: "/draft-orders/:id/custom-items"
13074
13074
  },
13075
+ {
13076
+ Component: Email,
13077
+ path: "/draft-orders/:id/email"
13078
+ },
13075
13079
  {
13076
13080
  Component: Items,
13077
13081
  path: "/draft-orders/:id/items"
@@ -13080,10 +13084,6 @@ const routeModule = {
13080
13084
  Component: Metadata,
13081
13085
  path: "/draft-orders/:id/metadata"
13082
13086
  },
13083
- {
13084
- Component: Email,
13085
- path: "/draft-orders/:id/email"
13086
- },
13087
13087
  {
13088
13088
  Component: Promotions,
13089
13089
  path: "/draft-orders/:id/promotions"
@@ -9776,6 +9776,74 @@ const CustomItemsForm = () => {
9776
9776
  const schema$4 = objectType({
9777
9777
  email: stringType().email()
9778
9778
  });
9779
+ const Email = () => {
9780
+ const { id } = useParams();
9781
+ const { order, isPending, isError, error } = useOrder(id, {
9782
+ fields: "+email"
9783
+ });
9784
+ if (isError) {
9785
+ throw error;
9786
+ }
9787
+ const isReady = !isPending && !!order;
9788
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9789
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9790
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9791
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9792
+ ] }),
9793
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9794
+ ] });
9795
+ };
9796
+ const EmailForm = ({ order }) => {
9797
+ const form = useForm({
9798
+ defaultValues: {
9799
+ email: order.email ?? ""
9800
+ },
9801
+ resolver: zodResolver(schema$3)
9802
+ });
9803
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9804
+ const { handleSuccess } = useRouteModal();
9805
+ const onSubmit = form.handleSubmit(async (data) => {
9806
+ await mutateAsync(
9807
+ { email: data.email },
9808
+ {
9809
+ onSuccess: () => {
9810
+ handleSuccess();
9811
+ },
9812
+ onError: (error) => {
9813
+ toast.error(error.message);
9814
+ }
9815
+ }
9816
+ );
9817
+ });
9818
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9819
+ KeyboundForm,
9820
+ {
9821
+ className: "flex flex-1 flex-col overflow-hidden",
9822
+ onSubmit,
9823
+ children: [
9824
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9825
+ Form$2.Field,
9826
+ {
9827
+ control: form.control,
9828
+ name: "email",
9829
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9830
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9831
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9832
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9833
+ ] })
9834
+ }
9835
+ ) }),
9836
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9837
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9838
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9839
+ ] }) })
9840
+ ]
9841
+ }
9842
+ ) });
9843
+ };
9844
+ const schema$3 = objectType({
9845
+ email: stringType().email()
9846
+ });
9779
9847
  const NumberInput = forwardRef(
9780
9848
  ({
9781
9849
  value,
@@ -11100,74 +11168,6 @@ function getHasUneditableRows(metadata) {
11100
11168
  (value) => !EDITABLE_TYPES.includes(typeof value)
11101
11169
  );
11102
11170
  }
11103
- const Email = () => {
11104
- const { id } = useParams();
11105
- const { order, isPending, isError, error } = useOrder(id, {
11106
- fields: "+email"
11107
- });
11108
- if (isError) {
11109
- throw error;
11110
- }
11111
- const isReady = !isPending && !!order;
11112
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11113
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11114
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
11115
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
11116
- ] }),
11117
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
11118
- ] });
11119
- };
11120
- const EmailForm = ({ order }) => {
11121
- const form = useForm({
11122
- defaultValues: {
11123
- email: order.email ?? ""
11124
- },
11125
- resolver: zodResolver(schema$3)
11126
- });
11127
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11128
- const { handleSuccess } = useRouteModal();
11129
- const onSubmit = form.handleSubmit(async (data) => {
11130
- await mutateAsync(
11131
- { email: data.email },
11132
- {
11133
- onSuccess: () => {
11134
- handleSuccess();
11135
- },
11136
- onError: (error) => {
11137
- toast.error(error.message);
11138
- }
11139
- }
11140
- );
11141
- });
11142
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11143
- KeyboundForm,
11144
- {
11145
- className: "flex flex-1 flex-col overflow-hidden",
11146
- onSubmit,
11147
- children: [
11148
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
11149
- Form$2.Field,
11150
- {
11151
- control: form.control,
11152
- name: "email",
11153
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11154
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
11155
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11156
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11157
- ] })
11158
- }
11159
- ) }),
11160
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11161
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11162
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11163
- ] }) })
11164
- ]
11165
- }
11166
- ) });
11167
- };
11168
- const schema$3 = objectType({
11169
- email: stringType().email()
11170
- });
11171
11171
  const PROMOTION_QUERY_KEY = "promotions";
11172
11172
  const promotionsQueryKeys = {
11173
11173
  list: (query2) => [
@@ -13065,6 +13065,10 @@ const routeModule = {
13065
13065
  Component: CustomItems,
13066
13066
  path: "/draft-orders/:id/custom-items"
13067
13067
  },
13068
+ {
13069
+ Component: Email,
13070
+ path: "/draft-orders/:id/email"
13071
+ },
13068
13072
  {
13069
13073
  Component: Items,
13070
13074
  path: "/draft-orders/:id/items"
@@ -13073,10 +13077,6 @@ const routeModule = {
13073
13077
  Component: Metadata,
13074
13078
  path: "/draft-orders/:id/metadata"
13075
13079
  },
13076
- {
13077
- Component: Email,
13078
- path: "/draft-orders/:id/email"
13079
- },
13080
13080
  {
13081
13081
  Component: Promotions,
13082
13082
  path: "/draft-orders/:id/promotions"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.11.4-preview-20251120000304",
3
+ "version": "2.11.4-preview-20251120032016",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "@ariakit/react": "^0.4.15",
38
38
  "@babel/runtime": "^7.26.10",
39
39
  "@hookform/resolvers": "3.4.2",
40
- "@medusajs/js-sdk": "2.11.4-preview-20251120000304",
40
+ "@medusajs/js-sdk": "2.11.4-preview-20251120032016",
41
41
  "@tanstack/react-query": "5.64.2",
42
42
  "@uiw/react-json-view": "^2.0.0-alpha.17",
43
43
  "date-fns": "^3.6.0",
@@ -48,22 +48,22 @@
48
48
  "react-hook-form": "7.49.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@medusajs/admin-sdk": "2.11.4-preview-20251120000304",
52
- "@medusajs/cli": "2.11.4-preview-20251120000304",
53
- "@medusajs/framework": "2.11.4-preview-20251120000304",
54
- "@medusajs/icons": "2.11.4-preview-20251120000304",
55
- "@medusajs/test-utils": "2.11.4-preview-20251120000304",
56
- "@medusajs/types": "2.11.4-preview-20251120000304",
57
- "@medusajs/ui": "4.0.28-preview-20251120000304",
58
- "@medusajs/ui-preset": "2.11.4-preview-20251120000304"
51
+ "@medusajs/admin-sdk": "2.11.4-preview-20251120032016",
52
+ "@medusajs/cli": "2.11.4-preview-20251120032016",
53
+ "@medusajs/framework": "2.11.4-preview-20251120032016",
54
+ "@medusajs/icons": "2.11.4-preview-20251120032016",
55
+ "@medusajs/test-utils": "2.11.4-preview-20251120032016",
56
+ "@medusajs/types": "2.11.4-preview-20251120032016",
57
+ "@medusajs/ui": "4.0.28-preview-20251120032016",
58
+ "@medusajs/ui-preset": "2.11.4-preview-20251120032016"
59
59
  },
60
60
  "peerDependencies": {
61
- "@medusajs/admin-sdk": "2.11.4-preview-20251120000304",
62
- "@medusajs/cli": "2.11.4-preview-20251120000304",
63
- "@medusajs/framework": "2.11.4-preview-20251120000304",
64
- "@medusajs/icons": "2.11.4-preview-20251120000304",
65
- "@medusajs/test-utils": "2.11.4-preview-20251120000304",
66
- "@medusajs/ui": "4.0.28-preview-20251120000304",
61
+ "@medusajs/admin-sdk": "2.11.4-preview-20251120032016",
62
+ "@medusajs/cli": "2.11.4-preview-20251120032016",
63
+ "@medusajs/framework": "2.11.4-preview-20251120032016",
64
+ "@medusajs/icons": "2.11.4-preview-20251120032016",
65
+ "@medusajs/test-utils": "2.11.4-preview-20251120032016",
66
+ "@medusajs/ui": "4.0.28-preview-20251120032016",
67
67
  "react": "^18.3.1",
68
68
  "react-dom": "^18.3.1",
69
69
  "react-router-dom": "6.20.1"