@medusajs/loyalty-plugin 2.20.0 → 2.20.1

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.
@@ -26836,73 +26836,6 @@ const KeyboundForm = React__namespace.default.forwardRef(({ onSubmit, onKeyDown,
26836
26836
  );
26837
26837
  });
26838
26838
  KeyboundForm.displayName = "KeyboundForm";
26839
- const Note$1 = () => {
26840
- const { id } = reactRouterDom.useParams();
26841
- const {
26842
- gift_card: giftCard,
26843
- isPending,
26844
- isError,
26845
- error
26846
- } = useGiftCard(id, {});
26847
- if (isError) {
26848
- throw error;
26849
- }
26850
- const isReady = !isPending && !!giftCard;
26851
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
26852
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
26853
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit note" }) }),
26854
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the note for the gift card" }) })
26855
- ] }),
26856
- isReady && /* @__PURE__ */ jsxRuntime.jsx(GiftCardNoteForm, { giftCard })
26857
- ] });
26858
- };
26859
- const GiftCardNoteForm = ({ giftCard }) => {
26860
- const form = useForm({
26861
- defaultValues: {
26862
- note: giftCard.note ?? ""
26863
- },
26864
- resolver: u(schema$2)
26865
- });
26866
- const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
26867
- const { handleSuccess } = useRouteModal();
26868
- const onSubmit = form.handleSubmit(async (data) => {
26869
- await mutateAsync(
26870
- { note: data.note },
26871
- {
26872
- onSuccess: () => handleSuccess(),
26873
- onError: (error) => ui.toast.error(error.message)
26874
- }
26875
- );
26876
- });
26877
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
26878
- KeyboundForm,
26879
- {
26880
- className: "flex flex-1 flex-col overflow-hidden",
26881
- onSubmit,
26882
- children: [
26883
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
26884
- Form$2.Field,
26885
- {
26886
- control: form.control,
26887
- name: "note",
26888
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
26889
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
26890
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
26891
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
26892
- ] })
26893
- }
26894
- ) }),
26895
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
26896
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
26897
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
26898
- ] }) })
26899
- ]
26900
- }
26901
- ) });
26902
- };
26903
- const schema$2 = zod.z.object({
26904
- note: zod.z.string().optional()
26905
- });
26906
26839
  const GiftCardExpiration = () => {
26907
26840
  const { id } = reactRouterDom.useParams();
26908
26841
  const { gift_card: giftCard, isPending, isError, error } = useGiftCard(id);
@@ -26923,7 +26856,7 @@ const GiftCardExpirationForm = ({ giftCard }) => {
26923
26856
  defaultValues: {
26924
26857
  expires_at: giftCard.expires_at ? new Date(giftCard.expires_at) : null
26925
26858
  },
26926
- resolver: u(schema$1)
26859
+ resolver: u(schema$2)
26927
26860
  });
26928
26861
  const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
26929
26862
  const { handleSuccess } = useRouteModal();
@@ -27018,9 +26951,76 @@ const GiftCardExpirationForm = ({ giftCard }) => {
27018
26951
  }
27019
26952
  ) });
27020
26953
  };
27021
- const schema$1 = zod.z.object({
26954
+ const schema$2 = zod.z.object({
27022
26955
  expires_at: zod.z.date().nullish()
27023
26956
  });
26957
+ const Note$1 = () => {
26958
+ const { id } = reactRouterDom.useParams();
26959
+ const {
26960
+ gift_card: giftCard,
26961
+ isPending,
26962
+ isError,
26963
+ error
26964
+ } = useGiftCard(id, {});
26965
+ if (isError) {
26966
+ throw error;
26967
+ }
26968
+ const isReady = !isPending && !!giftCard;
26969
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
26970
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
26971
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit note" }) }),
26972
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the note for the gift card" }) })
26973
+ ] }),
26974
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(GiftCardNoteForm, { giftCard })
26975
+ ] });
26976
+ };
26977
+ const GiftCardNoteForm = ({ giftCard }) => {
26978
+ const form = useForm({
26979
+ defaultValues: {
26980
+ note: giftCard.note ?? ""
26981
+ },
26982
+ resolver: u(schema$1)
26983
+ });
26984
+ const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
26985
+ const { handleSuccess } = useRouteModal();
26986
+ const onSubmit = form.handleSubmit(async (data) => {
26987
+ await mutateAsync(
26988
+ { note: data.note },
26989
+ {
26990
+ onSuccess: () => handleSuccess(),
26991
+ onError: (error) => ui.toast.error(error.message)
26992
+ }
26993
+ );
26994
+ });
26995
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
26996
+ KeyboundForm,
26997
+ {
26998
+ className: "flex flex-1 flex-col overflow-hidden",
26999
+ onSubmit,
27000
+ children: [
27001
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
27002
+ Form$2.Field,
27003
+ {
27004
+ control: form.control,
27005
+ name: "note",
27006
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
27007
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
27008
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
27009
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
27010
+ ] })
27011
+ }
27012
+ ) }),
27013
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
27014
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
27015
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
27016
+ ] }) })
27017
+ ]
27018
+ }
27019
+ ) });
27020
+ };
27021
+ const schema$1 = zod.z.object({
27022
+ note: zod.z.string().optional()
27023
+ });
27024
27024
  const columnHelper$7 = createColumnHelper();
27025
27025
  const useGiftCardProductsTableColumns = () => {
27026
27026
  return React.useMemo(
@@ -42733,13 +42733,13 @@ const routeModule = {
42733
42733
  Component: GiftCardDetailsPage,
42734
42734
  path: "/gift-cards/:id",
42735
42735
  children: [
42736
- {
42737
- Component: Note$1,
42738
- path: "/gift-cards/:id/note"
42739
- },
42740
42736
  {
42741
42737
  Component: GiftCardExpiration,
42742
42738
  path: "/gift-cards/:id/expiration"
42739
+ },
42740
+ {
42741
+ Component: Note$1,
42742
+ path: "/gift-cards/:id/note"
42743
42743
  }
42744
42744
  ]
42745
42745
  },
@@ -26816,73 +26816,6 @@ const KeyboundForm = React__default.forwardRef(({ onSubmit, onKeyDown, ...rest }
26816
26816
  );
26817
26817
  });
26818
26818
  KeyboundForm.displayName = "KeyboundForm";
26819
- const Note$1 = () => {
26820
- const { id } = useParams();
26821
- const {
26822
- gift_card: giftCard,
26823
- isPending,
26824
- isError,
26825
- error
26826
- } = useGiftCard(id, {});
26827
- if (isError) {
26828
- throw error;
26829
- }
26830
- const isReady = !isPending && !!giftCard;
26831
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
26832
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
26833
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit note" }) }),
26834
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the note for the gift card" }) })
26835
- ] }),
26836
- isReady && /* @__PURE__ */ jsx(GiftCardNoteForm, { giftCard })
26837
- ] });
26838
- };
26839
- const GiftCardNoteForm = ({ giftCard }) => {
26840
- const form = useForm({
26841
- defaultValues: {
26842
- note: giftCard.note ?? ""
26843
- },
26844
- resolver: u(schema$2)
26845
- });
26846
- const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
26847
- const { handleSuccess } = useRouteModal();
26848
- const onSubmit = form.handleSubmit(async (data) => {
26849
- await mutateAsync(
26850
- { note: data.note },
26851
- {
26852
- onSuccess: () => handleSuccess(),
26853
- onError: (error) => toast.error(error.message)
26854
- }
26855
- );
26856
- });
26857
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
26858
- KeyboundForm,
26859
- {
26860
- className: "flex flex-1 flex-col overflow-hidden",
26861
- onSubmit,
26862
- children: [
26863
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
26864
- Form$2.Field,
26865
- {
26866
- control: form.control,
26867
- name: "note",
26868
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
26869
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Note" }),
26870
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Textarea, { ...field }) }),
26871
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
26872
- ] })
26873
- }
26874
- ) }),
26875
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
26876
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
26877
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
26878
- ] }) })
26879
- ]
26880
- }
26881
- ) });
26882
- };
26883
- const schema$2 = z.object({
26884
- note: z.string().optional()
26885
- });
26886
26819
  const GiftCardExpiration = () => {
26887
26820
  const { id } = useParams();
26888
26821
  const { gift_card: giftCard, isPending, isError, error } = useGiftCard(id);
@@ -26903,7 +26836,7 @@ const GiftCardExpirationForm = ({ giftCard }) => {
26903
26836
  defaultValues: {
26904
26837
  expires_at: giftCard.expires_at ? new Date(giftCard.expires_at) : null
26905
26838
  },
26906
- resolver: u(schema$1)
26839
+ resolver: u(schema$2)
26907
26840
  });
26908
26841
  const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
26909
26842
  const { handleSuccess } = useRouteModal();
@@ -26998,9 +26931,76 @@ const GiftCardExpirationForm = ({ giftCard }) => {
26998
26931
  }
26999
26932
  ) });
27000
26933
  };
27001
- const schema$1 = z.object({
26934
+ const schema$2 = z.object({
27002
26935
  expires_at: z.date().nullish()
27003
26936
  });
26937
+ const Note$1 = () => {
26938
+ const { id } = useParams();
26939
+ const {
26940
+ gift_card: giftCard,
26941
+ isPending,
26942
+ isError,
26943
+ error
26944
+ } = useGiftCard(id, {});
26945
+ if (isError) {
26946
+ throw error;
26947
+ }
26948
+ const isReady = !isPending && !!giftCard;
26949
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
26950
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
26951
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit note" }) }),
26952
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the note for the gift card" }) })
26953
+ ] }),
26954
+ isReady && /* @__PURE__ */ jsx(GiftCardNoteForm, { giftCard })
26955
+ ] });
26956
+ };
26957
+ const GiftCardNoteForm = ({ giftCard }) => {
26958
+ const form = useForm({
26959
+ defaultValues: {
26960
+ note: giftCard.note ?? ""
26961
+ },
26962
+ resolver: u(schema$1)
26963
+ });
26964
+ const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
26965
+ const { handleSuccess } = useRouteModal();
26966
+ const onSubmit = form.handleSubmit(async (data) => {
26967
+ await mutateAsync(
26968
+ { note: data.note },
26969
+ {
26970
+ onSuccess: () => handleSuccess(),
26971
+ onError: (error) => toast.error(error.message)
26972
+ }
26973
+ );
26974
+ });
26975
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
26976
+ KeyboundForm,
26977
+ {
26978
+ className: "flex flex-1 flex-col overflow-hidden",
26979
+ onSubmit,
26980
+ children: [
26981
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
26982
+ Form$2.Field,
26983
+ {
26984
+ control: form.control,
26985
+ name: "note",
26986
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
26987
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Note" }),
26988
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Textarea, { ...field }) }),
26989
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
26990
+ ] })
26991
+ }
26992
+ ) }),
26993
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
26994
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
26995
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
26996
+ ] }) })
26997
+ ]
26998
+ }
26999
+ ) });
27000
+ };
27001
+ const schema$1 = z.object({
27002
+ note: z.string().optional()
27003
+ });
27004
27004
  const columnHelper$7 = createColumnHelper();
27005
27005
  const useGiftCardProductsTableColumns = () => {
27006
27006
  return useMemo(
@@ -42713,13 +42713,13 @@ const routeModule = {
42713
42713
  Component: GiftCardDetailsPage,
42714
42714
  path: "/gift-cards/:id",
42715
42715
  children: [
42716
- {
42717
- Component: Note$1,
42718
- path: "/gift-cards/:id/note"
42719
- },
42720
42716
  {
42721
42717
  Component: GiftCardExpiration,
42722
42718
  path: "/gift-cards/:id/expiration"
42719
+ },
42720
+ {
42721
+ Component: Note$1,
42722
+ path: "/gift-cards/:id/note"
42723
42723
  }
42724
42724
  ]
42725
42725
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/loyalty-plugin",
3
- "version": "2.20.0",
3
+ "version": "2.20.1",
4
4
  "description": "Medusa Plugin: Loyalty - Gift Cards",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -55,16 +55,16 @@
55
55
  "watch": "medusa plugin:develop"
56
56
  },
57
57
  "devDependencies": {
58
- "@medusajs/admin-sdk": "2.20.0",
59
- "@medusajs/cli": "2.20.0",
60
- "@medusajs/dashboard": "2.20.0",
61
- "@medusajs/framework": "2.20.0",
62
- "@medusajs/icons": "2.20.0",
63
- "@medusajs/medusa": "2.20.0",
64
- "@medusajs/test-utils": "2.20.0",
65
- "@medusajs/types": "2.20.0",
66
- "@medusajs/ui": "4.2.2",
67
- "@medusajs/ui-preset": "2.20.0",
58
+ "@medusajs/admin-sdk": "2.20.1",
59
+ "@medusajs/cli": "2.20.1",
60
+ "@medusajs/dashboard": "2.20.1",
61
+ "@medusajs/framework": "2.20.1",
62
+ "@medusajs/icons": "2.20.1",
63
+ "@medusajs/medusa": "2.20.1",
64
+ "@medusajs/test-utils": "2.20.1",
65
+ "@medusajs/types": "2.20.1",
66
+ "@medusajs/ui": "4.2.3",
67
+ "@medusajs/ui-preset": "2.20.1",
68
68
  "@swc/core": "1.5.7",
69
69
  "@types/node": "^20.0.0",
70
70
  "cross-env": "^7.0.3",
@@ -72,14 +72,14 @@
72
72
  "typescript": "^5.7.3"
73
73
  },
74
74
  "peerDependencies": {
75
- "@medusajs/admin-sdk": "2.20.0",
76
- "@medusajs/cli": "2.20.0",
77
- "@medusajs/dashboard": "2.20.0",
78
- "@medusajs/framework": "2.20.0",
79
- "@medusajs/icons": "2.20.0",
80
- "@medusajs/medusa": "2.20.0",
81
- "@medusajs/test-utils": "2.20.0",
82
- "@medusajs/ui": "4.2.2",
75
+ "@medusajs/admin-sdk": "2.20.1",
76
+ "@medusajs/cli": "2.20.1",
77
+ "@medusajs/dashboard": "2.20.1",
78
+ "@medusajs/framework": "2.20.1",
79
+ "@medusajs/icons": "2.20.1",
80
+ "@medusajs/medusa": "2.20.1",
81
+ "@medusajs/test-utils": "2.20.1",
82
+ "@medusajs/ui": "4.2.3",
83
83
  "react": "^18.3.1",
84
84
  "react-dom": "^18.3.1",
85
85
  "react-router-dom": "^6.30.4 || ^7.0.0"