@medusajs/draft-order 2.12.2-preview-20251205060136 → 2.12.2-preview-20251205120130

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,6 +9762,74 @@ 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
+ });
9765
9833
  const CustomItems = () => {
9766
9834
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9767
9835
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
@@ -9770,7 +9838,7 @@ const CustomItems = () => {
9770
9838
  };
9771
9839
  const CustomItemsForm = () => {
9772
9840
  const form = reactHookForm.useForm({
9773
- resolver: zod.zodResolver(schema$4)
9841
+ resolver: zod.zodResolver(schema$3)
9774
9842
  });
9775
9843
  return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9776
9844
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
@@ -9780,7 +9848,7 @@ const CustomItemsForm = () => {
9780
9848
  ] }) })
9781
9849
  ] }) });
9782
9850
  };
9783
- const schema$4 = objectType({
9851
+ const schema$3 = objectType({
9784
9852
  email: stringType().email()
9785
9853
  });
9786
9854
  const NumberInput = React.forwardRef(
@@ -11384,74 +11452,6 @@ function getPromotionIds(items, shippingMethods) {
11384
11452
  }
11385
11453
  return Array.from(promotionIds);
11386
11454
  }
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,6 +13068,10 @@ 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
+ },
13071
13075
  {
13072
13076
  Component: CustomItems,
13073
13077
  path: "/draft-orders/:id/custom-items"
@@ -13084,10 +13088,6 @@ const routeModule = {
13084
13088
  Component: Promotions,
13085
13089
  path: "/draft-orders/:id/promotions"
13086
13090
  },
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,6 +9755,74 @@ 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
+ });
9758
9826
  const CustomItems = () => {
9759
9827
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9760
9828
  /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
@@ -9763,7 +9831,7 @@ const CustomItems = () => {
9763
9831
  };
9764
9832
  const CustomItemsForm = () => {
9765
9833
  const form = useForm({
9766
- resolver: zodResolver(schema$4)
9834
+ resolver: zodResolver(schema$3)
9767
9835
  });
9768
9836
  return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9769
9837
  /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
@@ -9773,7 +9841,7 @@ const CustomItemsForm = () => {
9773
9841
  ] }) })
9774
9842
  ] }) });
9775
9843
  };
9776
- const schema$4 = objectType({
9844
+ const schema$3 = objectType({
9777
9845
  email: stringType().email()
9778
9846
  });
9779
9847
  const NumberInput = forwardRef(
@@ -11377,74 +11445,6 @@ function getPromotionIds(items, shippingMethods) {
11377
11445
  }
11378
11446
  return Array.from(promotionIds);
11379
11447
  }
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,6 +13061,10 @@ 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
+ },
13064
13068
  {
13065
13069
  Component: CustomItems,
13066
13070
  path: "/draft-orders/:id/custom-items"
@@ -13077,10 +13081,6 @@ const routeModule = {
13077
13081
  Component: Promotions,
13078
13082
  path: "/draft-orders/:id/promotions"
13079
13083
  },
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.12.2-preview-20251205060136",
3
+ "version": "2.12.2-preview-20251205120130",
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.12.2-preview-20251205060136",
40
+ "@medusajs/js-sdk": "2.12.2-preview-20251205120130",
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.12.2-preview-20251205060136",
52
- "@medusajs/cli": "2.12.2-preview-20251205060136",
53
- "@medusajs/framework": "2.12.2-preview-20251205060136",
54
- "@medusajs/icons": "2.12.2-preview-20251205060136",
55
- "@medusajs/test-utils": "2.12.2-preview-20251205060136",
56
- "@medusajs/types": "2.12.2-preview-20251205060136",
57
- "@medusajs/ui": "4.0.30-preview-20251205060136",
58
- "@medusajs/ui-preset": "2.12.2-preview-20251205060136"
51
+ "@medusajs/admin-sdk": "2.12.2-preview-20251205120130",
52
+ "@medusajs/cli": "2.12.2-preview-20251205120130",
53
+ "@medusajs/framework": "2.12.2-preview-20251205120130",
54
+ "@medusajs/icons": "2.12.2-preview-20251205120130",
55
+ "@medusajs/test-utils": "2.12.2-preview-20251205120130",
56
+ "@medusajs/types": "2.12.2-preview-20251205120130",
57
+ "@medusajs/ui": "4.0.30-preview-20251205120130",
58
+ "@medusajs/ui-preset": "2.12.2-preview-20251205120130"
59
59
  },
60
60
  "peerDependencies": {
61
- "@medusajs/admin-sdk": "2.12.2-preview-20251205060136",
62
- "@medusajs/cli": "2.12.2-preview-20251205060136",
63
- "@medusajs/framework": "2.12.2-preview-20251205060136",
64
- "@medusajs/icons": "2.12.2-preview-20251205060136",
65
- "@medusajs/test-utils": "2.12.2-preview-20251205060136",
66
- "@medusajs/ui": "4.0.30-preview-20251205060136",
61
+ "@medusajs/admin-sdk": "2.12.2-preview-20251205120130",
62
+ "@medusajs/cli": "2.12.2-preview-20251205120130",
63
+ "@medusajs/framework": "2.12.2-preview-20251205120130",
64
+ "@medusajs/icons": "2.12.2-preview-20251205120130",
65
+ "@medusajs/test-utils": "2.12.2-preview-20251205120130",
66
+ "@medusajs/ui": "4.0.30-preview-20251205120130",
67
67
  "react": "^18.3.1",
68
68
  "react-dom": "^18.3.1",
69
69
  "react-router-dom": "6.20.1"