@medusajs/draft-order 3.0.0-preview-20251203060132 → 3.0.0-preview-20251211180557

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.
@@ -9762,74 +9762,6 @@ const BillingAddressForm = ({ order }) => {
9762
9762
  ) });
9763
9763
  };
9764
9764
  const schema$5 = addressSchema;
9765
- const Email = () => {
9766
- const { id } = reactRouterDom.useParams();
9767
- const { order, isPending, isError, error } = useOrder(id, {
9768
- fields: "+email"
9769
- });
9770
- if (isError) {
9771
- throw error;
9772
- }
9773
- const isReady = !isPending && !!order;
9774
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9775
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9776
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9777
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9778
- ] }),
9779
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9780
- ] });
9781
- };
9782
- const EmailForm = ({ order }) => {
9783
- const form = reactHookForm.useForm({
9784
- defaultValues: {
9785
- email: order.email ?? ""
9786
- },
9787
- resolver: zod.zodResolver(schema$4)
9788
- });
9789
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9790
- const { handleSuccess } = useRouteModal();
9791
- const onSubmit = form.handleSubmit(async (data) => {
9792
- await mutateAsync(
9793
- { email: data.email },
9794
- {
9795
- onSuccess: () => {
9796
- handleSuccess();
9797
- },
9798
- onError: (error) => {
9799
- ui.toast.error(error.message);
9800
- }
9801
- }
9802
- );
9803
- });
9804
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9805
- KeyboundForm,
9806
- {
9807
- className: "flex flex-1 flex-col overflow-hidden",
9808
- onSubmit,
9809
- children: [
9810
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9811
- Form$2.Field,
9812
- {
9813
- control: form.control,
9814
- name: "email",
9815
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9816
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9817
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9818
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9819
- ] })
9820
- }
9821
- ) }),
9822
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9823
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9824
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9825
- ] }) })
9826
- ]
9827
- }
9828
- ) });
9829
- };
9830
- const schema$4 = objectType({
9831
- email: stringType().email()
9832
- });
9833
9765
  const CustomItems = () => {
9834
9766
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9835
9767
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
@@ -9838,7 +9770,7 @@ const CustomItems = () => {
9838
9770
  };
9839
9771
  const CustomItemsForm = () => {
9840
9772
  const form = reactHookForm.useForm({
9841
- resolver: zod.zodResolver(schema$3)
9773
+ resolver: zod.zodResolver(schema$4)
9842
9774
  });
9843
9775
  return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9844
9776
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
@@ -9848,7 +9780,7 @@ const CustomItemsForm = () => {
9848
9780
  ] }) })
9849
9781
  ] }) });
9850
9782
  };
9851
- const schema$3 = objectType({
9783
+ const schema$4 = objectType({
9852
9784
  email: stringType().email()
9853
9785
  });
9854
9786
  const NumberInput = React.forwardRef(
@@ -11452,6 +11384,74 @@ function getPromotionIds(items, shippingMethods) {
11452
11384
  }
11453
11385
  return Array.from(promotionIds);
11454
11386
  }
11387
+ const Email = () => {
11388
+ const { id } = reactRouterDom.useParams();
11389
+ const { order, isPending, isError, error } = useOrder(id, {
11390
+ fields: "+email"
11391
+ });
11392
+ if (isError) {
11393
+ throw error;
11394
+ }
11395
+ const isReady = !isPending && !!order;
11396
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11397
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11398
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
11399
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
11400
+ ] }),
11401
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
11402
+ ] });
11403
+ };
11404
+ const EmailForm = ({ order }) => {
11405
+ const form = reactHookForm.useForm({
11406
+ defaultValues: {
11407
+ email: order.email ?? ""
11408
+ },
11409
+ resolver: zod.zodResolver(schema$3)
11410
+ });
11411
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11412
+ const { handleSuccess } = useRouteModal();
11413
+ const onSubmit = form.handleSubmit(async (data) => {
11414
+ await mutateAsync(
11415
+ { email: data.email },
11416
+ {
11417
+ onSuccess: () => {
11418
+ handleSuccess();
11419
+ },
11420
+ onError: (error) => {
11421
+ ui.toast.error(error.message);
11422
+ }
11423
+ }
11424
+ );
11425
+ });
11426
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11427
+ KeyboundForm,
11428
+ {
11429
+ className: "flex flex-1 flex-col overflow-hidden",
11430
+ onSubmit,
11431
+ children: [
11432
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
11433
+ Form$2.Field,
11434
+ {
11435
+ control: form.control,
11436
+ name: "email",
11437
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11438
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
11439
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11440
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11441
+ ] })
11442
+ }
11443
+ ) }),
11444
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11445
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11446
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11447
+ ] }) })
11448
+ ]
11449
+ }
11450
+ ) });
11451
+ };
11452
+ const schema$3 = objectType({
11453
+ email: stringType().email()
11454
+ });
11455
11455
  const SalesChannel = () => {
11456
11456
  const { id } = reactRouterDom.useParams();
11457
11457
  const { draft_order, isPending, isError, error } = useDraftOrder(
@@ -13068,10 +13068,6 @@ const routeModule = {
13068
13068
  Component: BillingAddress,
13069
13069
  path: "/draft-orders/:id/billing-address"
13070
13070
  },
13071
- {
13072
- Component: Email,
13073
- path: "/draft-orders/:id/email"
13074
- },
13075
13071
  {
13076
13072
  Component: CustomItems,
13077
13073
  path: "/draft-orders/:id/custom-items"
@@ -13088,6 +13084,10 @@ const routeModule = {
13088
13084
  Component: Promotions,
13089
13085
  path: "/draft-orders/:id/promotions"
13090
13086
  },
13087
+ {
13088
+ Component: Email,
13089
+ path: "/draft-orders/:id/email"
13090
+ },
13091
13091
  {
13092
13092
  Component: SalesChannel,
13093
13093
  path: "/draft-orders/:id/sales-channel"
@@ -9755,74 +9755,6 @@ const BillingAddressForm = ({ order }) => {
9755
9755
  ) });
9756
9756
  };
9757
9757
  const schema$5 = addressSchema;
9758
- const Email = () => {
9759
- const { id } = useParams();
9760
- const { order, isPending, isError, error } = useOrder(id, {
9761
- fields: "+email"
9762
- });
9763
- if (isError) {
9764
- throw error;
9765
- }
9766
- const isReady = !isPending && !!order;
9767
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9768
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9769
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9770
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9771
- ] }),
9772
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9773
- ] });
9774
- };
9775
- const EmailForm = ({ order }) => {
9776
- const form = useForm({
9777
- defaultValues: {
9778
- email: order.email ?? ""
9779
- },
9780
- resolver: zodResolver(schema$4)
9781
- });
9782
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9783
- const { handleSuccess } = useRouteModal();
9784
- const onSubmit = form.handleSubmit(async (data) => {
9785
- await mutateAsync(
9786
- { email: data.email },
9787
- {
9788
- onSuccess: () => {
9789
- handleSuccess();
9790
- },
9791
- onError: (error) => {
9792
- toast.error(error.message);
9793
- }
9794
- }
9795
- );
9796
- });
9797
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9798
- KeyboundForm,
9799
- {
9800
- className: "flex flex-1 flex-col overflow-hidden",
9801
- onSubmit,
9802
- children: [
9803
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9804
- Form$2.Field,
9805
- {
9806
- control: form.control,
9807
- name: "email",
9808
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9809
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9810
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9811
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9812
- ] })
9813
- }
9814
- ) }),
9815
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9816
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9817
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9818
- ] }) })
9819
- ]
9820
- }
9821
- ) });
9822
- };
9823
- const schema$4 = objectType({
9824
- email: stringType().email()
9825
- });
9826
9758
  const CustomItems = () => {
9827
9759
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9828
9760
  /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
@@ -9831,7 +9763,7 @@ const CustomItems = () => {
9831
9763
  };
9832
9764
  const CustomItemsForm = () => {
9833
9765
  const form = useForm({
9834
- resolver: zodResolver(schema$3)
9766
+ resolver: zodResolver(schema$4)
9835
9767
  });
9836
9768
  return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9837
9769
  /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
@@ -9841,7 +9773,7 @@ const CustomItemsForm = () => {
9841
9773
  ] }) })
9842
9774
  ] }) });
9843
9775
  };
9844
- const schema$3 = objectType({
9776
+ const schema$4 = objectType({
9845
9777
  email: stringType().email()
9846
9778
  });
9847
9779
  const NumberInput = forwardRef(
@@ -11445,6 +11377,74 @@ function getPromotionIds(items, shippingMethods) {
11445
11377
  }
11446
11378
  return Array.from(promotionIds);
11447
11379
  }
11380
+ const Email = () => {
11381
+ const { id } = useParams();
11382
+ const { order, isPending, isError, error } = useOrder(id, {
11383
+ fields: "+email"
11384
+ });
11385
+ if (isError) {
11386
+ throw error;
11387
+ }
11388
+ const isReady = !isPending && !!order;
11389
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11390
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11391
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
11392
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
11393
+ ] }),
11394
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
11395
+ ] });
11396
+ };
11397
+ const EmailForm = ({ order }) => {
11398
+ const form = useForm({
11399
+ defaultValues: {
11400
+ email: order.email ?? ""
11401
+ },
11402
+ resolver: zodResolver(schema$3)
11403
+ });
11404
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11405
+ const { handleSuccess } = useRouteModal();
11406
+ const onSubmit = form.handleSubmit(async (data) => {
11407
+ await mutateAsync(
11408
+ { email: data.email },
11409
+ {
11410
+ onSuccess: () => {
11411
+ handleSuccess();
11412
+ },
11413
+ onError: (error) => {
11414
+ toast.error(error.message);
11415
+ }
11416
+ }
11417
+ );
11418
+ });
11419
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11420
+ KeyboundForm,
11421
+ {
11422
+ className: "flex flex-1 flex-col overflow-hidden",
11423
+ onSubmit,
11424
+ children: [
11425
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
11426
+ Form$2.Field,
11427
+ {
11428
+ control: form.control,
11429
+ name: "email",
11430
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11431
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
11432
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11433
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11434
+ ] })
11435
+ }
11436
+ ) }),
11437
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11438
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11439
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11440
+ ] }) })
11441
+ ]
11442
+ }
11443
+ ) });
11444
+ };
11445
+ const schema$3 = objectType({
11446
+ email: stringType().email()
11447
+ });
11448
11448
  const SalesChannel = () => {
11449
11449
  const { id } = useParams();
11450
11450
  const { draft_order, isPending, isError, error } = useDraftOrder(
@@ -13061,10 +13061,6 @@ const routeModule = {
13061
13061
  Component: BillingAddress,
13062
13062
  path: "/draft-orders/:id/billing-address"
13063
13063
  },
13064
- {
13065
- Component: Email,
13066
- path: "/draft-orders/:id/email"
13067
- },
13068
13064
  {
13069
13065
  Component: CustomItems,
13070
13066
  path: "/draft-orders/:id/custom-items"
@@ -13081,6 +13077,10 @@ const routeModule = {
13081
13077
  Component: Promotions,
13082
13078
  path: "/draft-orders/:id/promotions"
13083
13079
  },
13080
+ {
13081
+ Component: Email,
13082
+ path: "/draft-orders/:id/email"
13083
+ },
13084
13084
  {
13085
13085
  Component: SalesChannel,
13086
13086
  path: "/draft-orders/:id/sales-channel"
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "3.0.0-preview-20251203060132",
4
- "description": "A starter for Medusa plugins.",
3
+ "version": "3.0.0-preview-20251211180557",
4
+ "description": "A draft order plugin for Medusa.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/medusajs/medusa",
10
+ "directory": "packages/plugins/draft-order"
11
+ },
7
12
  "files": [
8
13
  ".medusa/server"
9
14
  ],
@@ -37,7 +42,7 @@
37
42
  "@ariakit/react": "^0.4.15",
38
43
  "@babel/runtime": "^7.26.10",
39
44
  "@hookform/resolvers": "3.4.2",
40
- "@medusajs/js-sdk": "3.0.0-preview-20251203060132",
45
+ "@medusajs/js-sdk": "3.0.0-preview-20251211180557",
41
46
  "@tanstack/react-query": "5.64.2",
42
47
  "@uiw/react-json-view": "^2.0.0-alpha.17",
43
48
  "date-fns": "^3.6.0",
@@ -48,22 +53,22 @@
48
53
  "react-hook-form": "7.49.1"
49
54
  },
50
55
  "devDependencies": {
51
- "@medusajs/admin-sdk": "3.0.0-preview-20251203060132",
52
- "@medusajs/cli": "3.0.0-preview-20251203060132",
53
- "@medusajs/framework": "3.0.0-preview-20251203060132",
54
- "@medusajs/icons": "3.0.0-preview-20251203060132",
55
- "@medusajs/test-utils": "3.0.0-preview-20251203060132",
56
- "@medusajs/types": "3.0.0-preview-20251203060132",
57
- "@medusajs/ui": "4.0.29-preview-20251203060132",
58
- "@medusajs/ui-preset": "3.0.0-preview-20251203060132"
56
+ "@medusajs/admin-sdk": "3.0.0-preview-20251211180557",
57
+ "@medusajs/cli": "3.0.0-preview-20251211180557",
58
+ "@medusajs/framework": "3.0.0-preview-20251211180557",
59
+ "@medusajs/icons": "3.0.0-preview-20251211180557",
60
+ "@medusajs/test-utils": "3.0.0-preview-20251211180557",
61
+ "@medusajs/types": "3.0.0-preview-20251211180557",
62
+ "@medusajs/ui": "4.0.31-preview-20251211180557",
63
+ "@medusajs/ui-preset": "3.0.0-preview-20251211180557"
59
64
  },
60
65
  "peerDependencies": {
61
- "@medusajs/admin-sdk": "3.0.0-preview-20251203060132",
62
- "@medusajs/cli": "3.0.0-preview-20251203060132",
63
- "@medusajs/framework": "3.0.0-preview-20251203060132",
64
- "@medusajs/icons": "3.0.0-preview-20251203060132",
65
- "@medusajs/test-utils": "3.0.0-preview-20251203060132",
66
- "@medusajs/ui": "4.0.29-preview-20251203060132",
66
+ "@medusajs/admin-sdk": "3.0.0-preview-20251211180557",
67
+ "@medusajs/cli": "3.0.0-preview-20251211180557",
68
+ "@medusajs/framework": "3.0.0-preview-20251211180557",
69
+ "@medusajs/icons": "3.0.0-preview-20251211180557",
70
+ "@medusajs/test-utils": "3.0.0-preview-20251211180557",
71
+ "@medusajs/ui": "4.0.31-preview-20251211180557",
67
72
  "react": "^18.3.1",
68
73
  "react-dom": "^18.3.1",
69
74
  "react-router-dom": "6.20.1"