@medusajs/loyalty-plugin 0.0.9-preview.2.12.1 → 0.0.9-preview.2.12.2

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.
@@ -23690,73 +23690,6 @@ const KeyboundForm = React__namespace.default.forwardRef(({ onSubmit, onKeyDown,
23690
23690
  );
23691
23691
  });
23692
23692
  KeyboundForm.displayName = "KeyboundForm";
23693
- const Note$1 = () => {
23694
- const { id } = reactRouterDom.useParams();
23695
- const {
23696
- gift_card: giftCard,
23697
- isPending,
23698
- isError,
23699
- error
23700
- } = useGiftCard(id, {});
23701
- if (isError) {
23702
- throw error;
23703
- }
23704
- const isReady = !isPending && !!giftCard;
23705
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
23706
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
23707
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit note" }) }),
23708
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the note for the gift card" }) })
23709
- ] }),
23710
- isReady && /* @__PURE__ */ jsxRuntime.jsx(GiftCardNoteForm, { giftCard })
23711
- ] });
23712
- };
23713
- const GiftCardNoteForm = ({ giftCard }) => {
23714
- const form = useForm({
23715
- defaultValues: {
23716
- note: giftCard.note ?? ""
23717
- },
23718
- resolver: t(schema$2)
23719
- });
23720
- const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
23721
- const { handleSuccess } = useRouteModal();
23722
- const onSubmit = form.handleSubmit(async (data) => {
23723
- await mutateAsync(
23724
- { note: data.note },
23725
- {
23726
- onSuccess: () => handleSuccess(),
23727
- onError: (error) => ui.toast.error(error.message)
23728
- }
23729
- );
23730
- });
23731
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
23732
- KeyboundForm,
23733
- {
23734
- className: "flex flex-1 flex-col overflow-hidden",
23735
- onSubmit,
23736
- children: [
23737
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
23738
- Form$2.Field,
23739
- {
23740
- control: form.control,
23741
- name: "note",
23742
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
23743
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
23744
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
23745
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
23746
- ] })
23747
- }
23748
- ) }),
23749
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
23750
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
23751
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
23752
- ] }) })
23753
- ]
23754
- }
23755
- ) });
23756
- };
23757
- const schema$2 = objectType({
23758
- note: stringType().optional()
23759
- });
23760
23693
  const GiftCardExpiration = () => {
23761
23694
  const { id } = reactRouterDom.useParams();
23762
23695
  const {
@@ -23782,7 +23715,7 @@ const GiftCardExpirationForm = ({ giftCard }) => {
23782
23715
  defaultValues: {
23783
23716
  expires_at: giftCard.expires_at ? new Date(giftCard.expires_at) : null
23784
23717
  },
23785
- resolver: t(schema$1)
23718
+ resolver: t(schema$2)
23786
23719
  });
23787
23720
  const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
23788
23721
  const { handleSuccess } = useRouteModal();
@@ -23871,9 +23804,76 @@ const GiftCardExpirationForm = ({ giftCard }) => {
23871
23804
  }
23872
23805
  ) });
23873
23806
  };
23874
- const schema$1 = objectType({
23807
+ const schema$2 = objectType({
23875
23808
  expires_at: dateType().nullish()
23876
23809
  });
23810
+ const Note$1 = () => {
23811
+ const { id } = reactRouterDom.useParams();
23812
+ const {
23813
+ gift_card: giftCard,
23814
+ isPending,
23815
+ isError,
23816
+ error
23817
+ } = useGiftCard(id, {});
23818
+ if (isError) {
23819
+ throw error;
23820
+ }
23821
+ const isReady = !isPending && !!giftCard;
23822
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
23823
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
23824
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit note" }) }),
23825
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the note for the gift card" }) })
23826
+ ] }),
23827
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(GiftCardNoteForm, { giftCard })
23828
+ ] });
23829
+ };
23830
+ const GiftCardNoteForm = ({ giftCard }) => {
23831
+ const form = useForm({
23832
+ defaultValues: {
23833
+ note: giftCard.note ?? ""
23834
+ },
23835
+ resolver: t(schema$1)
23836
+ });
23837
+ const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
23838
+ const { handleSuccess } = useRouteModal();
23839
+ const onSubmit = form.handleSubmit(async (data) => {
23840
+ await mutateAsync(
23841
+ { note: data.note },
23842
+ {
23843
+ onSuccess: () => handleSuccess(),
23844
+ onError: (error) => ui.toast.error(error.message)
23845
+ }
23846
+ );
23847
+ });
23848
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
23849
+ KeyboundForm,
23850
+ {
23851
+ className: "flex flex-1 flex-col overflow-hidden",
23852
+ onSubmit,
23853
+ children: [
23854
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
23855
+ Form$2.Field,
23856
+ {
23857
+ control: form.control,
23858
+ name: "note",
23859
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
23860
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
23861
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
23862
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
23863
+ ] })
23864
+ }
23865
+ ) }),
23866
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
23867
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
23868
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
23869
+ ] }) })
23870
+ ]
23871
+ }
23872
+ ) });
23873
+ };
23874
+ const schema$1 = objectType({
23875
+ note: stringType().optional()
23876
+ });
23877
23877
  const columnHelper$7 = createColumnHelper();
23878
23878
  const useGiftCardProductsTableColumns = () => {
23879
23879
  return React.useMemo(
@@ -38657,13 +38657,13 @@ const routeModule = {
38657
38657
  Component: GiftCardDetailsPage,
38658
38658
  path: "/gift-cards/:id",
38659
38659
  children: [
38660
- {
38661
- Component: Note$1,
38662
- path: "/gift-cards/:id/note"
38663
- },
38664
38660
  {
38665
38661
  Component: GiftCardExpiration,
38666
38662
  path: "/gift-cards/:id/expiration"
38663
+ },
38664
+ {
38665
+ Component: Note$1,
38666
+ path: "/gift-cards/:id/note"
38667
38667
  }
38668
38668
  ]
38669
38669
  },
@@ -23667,73 +23667,6 @@ const KeyboundForm = React__default.forwardRef(({ onSubmit, onKeyDown, ...rest }
23667
23667
  );
23668
23668
  });
23669
23669
  KeyboundForm.displayName = "KeyboundForm";
23670
- const Note$1 = () => {
23671
- const { id } = useParams();
23672
- const {
23673
- gift_card: giftCard,
23674
- isPending,
23675
- isError,
23676
- error
23677
- } = useGiftCard(id, {});
23678
- if (isError) {
23679
- throw error;
23680
- }
23681
- const isReady = !isPending && !!giftCard;
23682
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
23683
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
23684
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit note" }) }),
23685
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the note for the gift card" }) })
23686
- ] }),
23687
- isReady && /* @__PURE__ */ jsx(GiftCardNoteForm, { giftCard })
23688
- ] });
23689
- };
23690
- const GiftCardNoteForm = ({ giftCard }) => {
23691
- const form = useForm({
23692
- defaultValues: {
23693
- note: giftCard.note ?? ""
23694
- },
23695
- resolver: t(schema$2)
23696
- });
23697
- const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
23698
- const { handleSuccess } = useRouteModal();
23699
- const onSubmit = form.handleSubmit(async (data) => {
23700
- await mutateAsync(
23701
- { note: data.note },
23702
- {
23703
- onSuccess: () => handleSuccess(),
23704
- onError: (error) => toast.error(error.message)
23705
- }
23706
- );
23707
- });
23708
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
23709
- KeyboundForm,
23710
- {
23711
- className: "flex flex-1 flex-col overflow-hidden",
23712
- onSubmit,
23713
- children: [
23714
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
23715
- Form$2.Field,
23716
- {
23717
- control: form.control,
23718
- name: "note",
23719
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
23720
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Note" }),
23721
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Textarea, { ...field }) }),
23722
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
23723
- ] })
23724
- }
23725
- ) }),
23726
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
23727
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
23728
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
23729
- ] }) })
23730
- ]
23731
- }
23732
- ) });
23733
- };
23734
- const schema$2 = objectType({
23735
- note: stringType().optional()
23736
- });
23737
23670
  const GiftCardExpiration = () => {
23738
23671
  const { id } = useParams();
23739
23672
  const {
@@ -23759,7 +23692,7 @@ const GiftCardExpirationForm = ({ giftCard }) => {
23759
23692
  defaultValues: {
23760
23693
  expires_at: giftCard.expires_at ? new Date(giftCard.expires_at) : null
23761
23694
  },
23762
- resolver: t(schema$1)
23695
+ resolver: t(schema$2)
23763
23696
  });
23764
23697
  const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
23765
23698
  const { handleSuccess } = useRouteModal();
@@ -23848,9 +23781,76 @@ const GiftCardExpirationForm = ({ giftCard }) => {
23848
23781
  }
23849
23782
  ) });
23850
23783
  };
23851
- const schema$1 = objectType({
23784
+ const schema$2 = objectType({
23852
23785
  expires_at: dateType().nullish()
23853
23786
  });
23787
+ const Note$1 = () => {
23788
+ const { id } = useParams();
23789
+ const {
23790
+ gift_card: giftCard,
23791
+ isPending,
23792
+ isError,
23793
+ error
23794
+ } = useGiftCard(id, {});
23795
+ if (isError) {
23796
+ throw error;
23797
+ }
23798
+ const isReady = !isPending && !!giftCard;
23799
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
23800
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
23801
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit note" }) }),
23802
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the note for the gift card" }) })
23803
+ ] }),
23804
+ isReady && /* @__PURE__ */ jsx(GiftCardNoteForm, { giftCard })
23805
+ ] });
23806
+ };
23807
+ const GiftCardNoteForm = ({ giftCard }) => {
23808
+ const form = useForm({
23809
+ defaultValues: {
23810
+ note: giftCard.note ?? ""
23811
+ },
23812
+ resolver: t(schema$1)
23813
+ });
23814
+ const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
23815
+ const { handleSuccess } = useRouteModal();
23816
+ const onSubmit = form.handleSubmit(async (data) => {
23817
+ await mutateAsync(
23818
+ { note: data.note },
23819
+ {
23820
+ onSuccess: () => handleSuccess(),
23821
+ onError: (error) => toast.error(error.message)
23822
+ }
23823
+ );
23824
+ });
23825
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
23826
+ KeyboundForm,
23827
+ {
23828
+ className: "flex flex-1 flex-col overflow-hidden",
23829
+ onSubmit,
23830
+ children: [
23831
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
23832
+ Form$2.Field,
23833
+ {
23834
+ control: form.control,
23835
+ name: "note",
23836
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
23837
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Note" }),
23838
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Textarea, { ...field }) }),
23839
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
23840
+ ] })
23841
+ }
23842
+ ) }),
23843
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
23844
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
23845
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
23846
+ ] }) })
23847
+ ]
23848
+ }
23849
+ ) });
23850
+ };
23851
+ const schema$1 = objectType({
23852
+ note: stringType().optional()
23853
+ });
23854
23854
  const columnHelper$7 = createColumnHelper();
23855
23855
  const useGiftCardProductsTableColumns = () => {
23856
23856
  return useMemo(
@@ -38634,13 +38634,13 @@ const routeModule = {
38634
38634
  Component: GiftCardDetailsPage,
38635
38635
  path: "/gift-cards/:id",
38636
38636
  children: [
38637
- {
38638
- Component: Note$1,
38639
- path: "/gift-cards/:id/note"
38640
- },
38641
38637
  {
38642
38638
  Component: GiftCardExpiration,
38643
38639
  path: "/gift-cards/:id/expiration"
38640
+ },
38641
+ {
38642
+ Component: Note$1,
38643
+ path: "/gift-cards/:id/note"
38644
38644
  }
38645
38645
  ]
38646
38646
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/loyalty-plugin",
3
- "version": "0.0.9-preview.2.12.1",
3
+ "version": "0.0.9-preview.2.12.2",
4
4
  "description": "Medusa Plugin: Loyalty - Gift Cards",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -45,13 +45,13 @@
45
45
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit --silent"
46
46
  },
47
47
  "devDependencies": {
48
- "@medusajs/admin-sdk": "2.12.1",
49
- "@medusajs/cli": "2.12.1",
50
- "@medusajs/framework": "2.12.1",
51
- "@medusajs/icons": "2.12.1",
52
- "@medusajs/js-sdk": "2.12.1",
53
- "@medusajs/medusa": "2.12.1",
54
- "@medusajs/test-utils": "2.12.1",
48
+ "@medusajs/admin-sdk": "2.12.2",
49
+ "@medusajs/cli": "2.12.2",
50
+ "@medusajs/framework": "2.12.2",
51
+ "@medusajs/icons": "2.12.2",
52
+ "@medusajs/js-sdk": "2.12.2",
53
+ "@medusajs/medusa": "2.12.2",
54
+ "@medusajs/test-utils": "2.12.2",
55
55
  "@medusajs/ui": "latest",
56
56
  "@swc/core": "1.5.7",
57
57
  "@swc/jest": "^0.2.37",