@medusajs/loyalty-plugin 0.0.7-snapshot.1 → 0.0.7-snapshot.3
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.
- package/.medusa/server/src/admin/index.js +230 -230
- package/.medusa/server/src/admin/index.mjs +230 -230
- package/.medusa/server/src/workflows/carts/steps/validate-gift-card-balances.js +2 -3
- package/.medusa/server/src/workflows/carts/workflows/add-gift-card-to-cart.d.ts +3 -0
- package/.medusa/server/src/workflows/carts/workflows/add-gift-card-to-cart.js +13 -4
- package/.medusa/server/src/workflows/carts/workflows/remove-gift-cart-from-cart.d.ts +4 -0
- package/.medusa/server/src/workflows/carts/workflows/remove-gift-cart-from-cart.js +9 -2
- package/package.json +6 -2
|
@@ -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$
|
|
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$
|
|
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(
|
|
@@ -37420,6 +37420,153 @@ const ProductDetail = () => {
|
|
|
37420
37420
|
] });
|
|
37421
37421
|
};
|
|
37422
37422
|
const EditProductSchema$1 = objectType({
|
|
37423
|
+
denominations: arrayType(
|
|
37424
|
+
objectType({
|
|
37425
|
+
id: stringType().optional(),
|
|
37426
|
+
value: stringType().min(1),
|
|
37427
|
+
prices: recordType(stringType(), optionalFloat).optional()
|
|
37428
|
+
})
|
|
37429
|
+
).min(1)
|
|
37430
|
+
});
|
|
37431
|
+
const GiftCardProductEditDenominationsForm = ({
|
|
37432
|
+
product
|
|
37433
|
+
}) => {
|
|
37434
|
+
var _a;
|
|
37435
|
+
const { handleSuccess } = useRouteModal();
|
|
37436
|
+
const form = useForm({
|
|
37437
|
+
defaultValues: {
|
|
37438
|
+
denominations: (_a = product.variants) == null ? void 0 : _a.map((variant) => ({
|
|
37439
|
+
id: variant.id,
|
|
37440
|
+
value: variant.title
|
|
37441
|
+
}))
|
|
37442
|
+
},
|
|
37443
|
+
resolver: t(EditProductSchema$1)
|
|
37444
|
+
});
|
|
37445
|
+
const { mutateAsync, isPending } = useUpdateProduct(product.id);
|
|
37446
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
37447
|
+
const optionValues = data.denominations.map(
|
|
37448
|
+
(denomination) => denomination.value
|
|
37449
|
+
);
|
|
37450
|
+
const options = [
|
|
37451
|
+
{
|
|
37452
|
+
title: "denomination",
|
|
37453
|
+
values: optionValues
|
|
37454
|
+
}
|
|
37455
|
+
];
|
|
37456
|
+
await mutateAsync(
|
|
37457
|
+
{
|
|
37458
|
+
options,
|
|
37459
|
+
variants: data.denominations.map((denomination) => ({
|
|
37460
|
+
id: denomination.id,
|
|
37461
|
+
title: denomination.value,
|
|
37462
|
+
manage_inventory: false,
|
|
37463
|
+
options: {
|
|
37464
|
+
denomination: denomination.value
|
|
37465
|
+
}
|
|
37466
|
+
}))
|
|
37467
|
+
},
|
|
37468
|
+
{
|
|
37469
|
+
onSuccess: () => {
|
|
37470
|
+
ui.toast.success(`Denominations updated successfully`);
|
|
37471
|
+
handleSuccess();
|
|
37472
|
+
},
|
|
37473
|
+
onError: (e2) => {
|
|
37474
|
+
ui.toast.error(e2.message);
|
|
37475
|
+
}
|
|
37476
|
+
}
|
|
37477
|
+
);
|
|
37478
|
+
});
|
|
37479
|
+
const {
|
|
37480
|
+
fields: denominationsFields,
|
|
37481
|
+
append: addDenomination,
|
|
37482
|
+
remove: removeDenomination
|
|
37483
|
+
} = useFieldArray({
|
|
37484
|
+
name: "denominations",
|
|
37485
|
+
control: form.control
|
|
37486
|
+
});
|
|
37487
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37488
|
+
KeyboundForm,
|
|
37489
|
+
{
|
|
37490
|
+
onSubmit: handleSubmit,
|
|
37491
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
37492
|
+
children: [
|
|
37493
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
37494
|
+
denominationsFields.map((denominationField, index) => {
|
|
37495
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37496
|
+
"div",
|
|
37497
|
+
{
|
|
37498
|
+
className: "flex items-center justify-between shadow-elevation-card-rest bg-ui-bg-component transition-fg rounded-md px-4 py-2",
|
|
37499
|
+
children: [
|
|
37500
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37501
|
+
Form$2.Field,
|
|
37502
|
+
{
|
|
37503
|
+
control: form.control,
|
|
37504
|
+
name: `denominations.${index}.value`,
|
|
37505
|
+
render: ({ field }) => {
|
|
37506
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
37507
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field, placeholder: "100" }) }),
|
|
37508
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
37509
|
+
] });
|
|
37510
|
+
}
|
|
37511
|
+
},
|
|
37512
|
+
denominationField.id
|
|
37513
|
+
),
|
|
37514
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center rounded-xl", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
37515
|
+
ui.Button,
|
|
37516
|
+
{
|
|
37517
|
+
size: "small",
|
|
37518
|
+
variant: "secondary",
|
|
37519
|
+
type: "button",
|
|
37520
|
+
className: "rounded-full p-0 ml-4",
|
|
37521
|
+
onClick: () => {
|
|
37522
|
+
removeDenomination(index);
|
|
37523
|
+
},
|
|
37524
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.XCircleSolid, { className: "rounded-full" })
|
|
37525
|
+
}
|
|
37526
|
+
) })
|
|
37527
|
+
]
|
|
37528
|
+
},
|
|
37529
|
+
denominationField.id
|
|
37530
|
+
);
|
|
37531
|
+
}),
|
|
37532
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37533
|
+
ui.Button,
|
|
37534
|
+
{
|
|
37535
|
+
size: "small",
|
|
37536
|
+
variant: "secondary",
|
|
37537
|
+
type: "button",
|
|
37538
|
+
className: "w-full",
|
|
37539
|
+
onClick: () => {
|
|
37540
|
+
addDenomination({ value: "", prices: {} });
|
|
37541
|
+
},
|
|
37542
|
+
children: "Add denomination"
|
|
37543
|
+
}
|
|
37544
|
+
),
|
|
37545
|
+
form.formState.errors.denominations && /* @__PURE__ */ jsxRuntime.jsx(ui.Alert, { variant: "error", children: "Please add at least one denomination." })
|
|
37546
|
+
] }) }) }) }),
|
|
37547
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
37548
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
37549
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
37550
|
+
] }) })
|
|
37551
|
+
]
|
|
37552
|
+
}
|
|
37553
|
+
) });
|
|
37554
|
+
};
|
|
37555
|
+
const GiftCardProductEdit$1 = () => {
|
|
37556
|
+
const { id } = reactRouterDom.useParams();
|
|
37557
|
+
const { product, isLoading, isError, error } = useProduct(id, {});
|
|
37558
|
+
if (isError) {
|
|
37559
|
+
throw error;
|
|
37560
|
+
}
|
|
37561
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
37562
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
37563
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit gift cards denominations" }) }),
|
|
37564
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { className: "sr-only", children: "Edit the gift card denominations" })
|
|
37565
|
+
] }),
|
|
37566
|
+
!isLoading && product && /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductEditDenominationsForm, { product })
|
|
37567
|
+
] });
|
|
37568
|
+
};
|
|
37569
|
+
const EditProductSchema = objectType({
|
|
37423
37570
|
status: enumType(["draft", "published", "proposed", "rejected"]),
|
|
37424
37571
|
title: stringType().min(1),
|
|
37425
37572
|
subtitle: stringType().optional(),
|
|
@@ -37438,7 +37585,7 @@ const GiftCardProductEditForm = ({
|
|
|
37438
37585
|
handle: product.handle || "",
|
|
37439
37586
|
description: product.description || ""
|
|
37440
37587
|
},
|
|
37441
|
-
resolver: t(EditProductSchema
|
|
37588
|
+
resolver: t(EditProductSchema)
|
|
37442
37589
|
});
|
|
37443
37590
|
const { mutateAsync, isPending } = useUpdateProduct(product.id);
|
|
37444
37591
|
const handleSubmit = form.handleSubmit(async (data) => {
|
|
@@ -37579,7 +37726,7 @@ const GiftCardProductEditForm = ({
|
|
|
37579
37726
|
}
|
|
37580
37727
|
) });
|
|
37581
37728
|
};
|
|
37582
|
-
const GiftCardProductEdit
|
|
37729
|
+
const GiftCardProductEdit = () => {
|
|
37583
37730
|
const { id } = reactRouterDom.useParams();
|
|
37584
37731
|
const { product, isLoading, isError, error } = useProduct(id, {});
|
|
37585
37732
|
if (isError) {
|
|
@@ -37593,153 +37740,6 @@ const GiftCardProductEdit$1 = () => {
|
|
|
37593
37740
|
!isLoading && product && /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductEditForm, { product })
|
|
37594
37741
|
] });
|
|
37595
37742
|
};
|
|
37596
|
-
const EditProductSchema = objectType({
|
|
37597
|
-
denominations: arrayType(
|
|
37598
|
-
objectType({
|
|
37599
|
-
id: stringType().optional(),
|
|
37600
|
-
value: stringType().min(1),
|
|
37601
|
-
prices: recordType(stringType(), optionalFloat).optional()
|
|
37602
|
-
})
|
|
37603
|
-
).min(1)
|
|
37604
|
-
});
|
|
37605
|
-
const GiftCardProductEditDenominationsForm = ({
|
|
37606
|
-
product
|
|
37607
|
-
}) => {
|
|
37608
|
-
var _a;
|
|
37609
|
-
const { handleSuccess } = useRouteModal();
|
|
37610
|
-
const form = useForm({
|
|
37611
|
-
defaultValues: {
|
|
37612
|
-
denominations: (_a = product.variants) == null ? void 0 : _a.map((variant) => ({
|
|
37613
|
-
id: variant.id,
|
|
37614
|
-
value: variant.title
|
|
37615
|
-
}))
|
|
37616
|
-
},
|
|
37617
|
-
resolver: t(EditProductSchema)
|
|
37618
|
-
});
|
|
37619
|
-
const { mutateAsync, isPending } = useUpdateProduct(product.id);
|
|
37620
|
-
const handleSubmit = form.handleSubmit(async (data) => {
|
|
37621
|
-
const optionValues = data.denominations.map(
|
|
37622
|
-
(denomination) => denomination.value
|
|
37623
|
-
);
|
|
37624
|
-
const options = [
|
|
37625
|
-
{
|
|
37626
|
-
title: "denomination",
|
|
37627
|
-
values: optionValues
|
|
37628
|
-
}
|
|
37629
|
-
];
|
|
37630
|
-
await mutateAsync(
|
|
37631
|
-
{
|
|
37632
|
-
options,
|
|
37633
|
-
variants: data.denominations.map((denomination) => ({
|
|
37634
|
-
id: denomination.id,
|
|
37635
|
-
title: denomination.value,
|
|
37636
|
-
manage_inventory: false,
|
|
37637
|
-
options: {
|
|
37638
|
-
denomination: denomination.value
|
|
37639
|
-
}
|
|
37640
|
-
}))
|
|
37641
|
-
},
|
|
37642
|
-
{
|
|
37643
|
-
onSuccess: () => {
|
|
37644
|
-
ui.toast.success(`Denominations updated successfully`);
|
|
37645
|
-
handleSuccess();
|
|
37646
|
-
},
|
|
37647
|
-
onError: (e2) => {
|
|
37648
|
-
ui.toast.error(e2.message);
|
|
37649
|
-
}
|
|
37650
|
-
}
|
|
37651
|
-
);
|
|
37652
|
-
});
|
|
37653
|
-
const {
|
|
37654
|
-
fields: denominationsFields,
|
|
37655
|
-
append: addDenomination,
|
|
37656
|
-
remove: removeDenomination
|
|
37657
|
-
} = useFieldArray({
|
|
37658
|
-
name: "denominations",
|
|
37659
|
-
control: form.control
|
|
37660
|
-
});
|
|
37661
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37662
|
-
KeyboundForm,
|
|
37663
|
-
{
|
|
37664
|
-
onSubmit: handleSubmit,
|
|
37665
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
37666
|
-
children: [
|
|
37667
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
37668
|
-
denominationsFields.map((denominationField, index) => {
|
|
37669
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37670
|
-
"div",
|
|
37671
|
-
{
|
|
37672
|
-
className: "flex items-center justify-between shadow-elevation-card-rest bg-ui-bg-component transition-fg rounded-md px-4 py-2",
|
|
37673
|
-
children: [
|
|
37674
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37675
|
-
Form$2.Field,
|
|
37676
|
-
{
|
|
37677
|
-
control: form.control,
|
|
37678
|
-
name: `denominations.${index}.value`,
|
|
37679
|
-
render: ({ field }) => {
|
|
37680
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
37681
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field, placeholder: "100" }) }),
|
|
37682
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
37683
|
-
] });
|
|
37684
|
-
}
|
|
37685
|
-
},
|
|
37686
|
-
denominationField.id
|
|
37687
|
-
),
|
|
37688
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center rounded-xl", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
37689
|
-
ui.Button,
|
|
37690
|
-
{
|
|
37691
|
-
size: "small",
|
|
37692
|
-
variant: "secondary",
|
|
37693
|
-
type: "button",
|
|
37694
|
-
className: "rounded-full p-0 ml-4",
|
|
37695
|
-
onClick: () => {
|
|
37696
|
-
removeDenomination(index);
|
|
37697
|
-
},
|
|
37698
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.XCircleSolid, { className: "rounded-full" })
|
|
37699
|
-
}
|
|
37700
|
-
) })
|
|
37701
|
-
]
|
|
37702
|
-
},
|
|
37703
|
-
denominationField.id
|
|
37704
|
-
);
|
|
37705
|
-
}),
|
|
37706
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37707
|
-
ui.Button,
|
|
37708
|
-
{
|
|
37709
|
-
size: "small",
|
|
37710
|
-
variant: "secondary",
|
|
37711
|
-
type: "button",
|
|
37712
|
-
className: "w-full",
|
|
37713
|
-
onClick: () => {
|
|
37714
|
-
addDenomination({ value: "", prices: {} });
|
|
37715
|
-
},
|
|
37716
|
-
children: "Add denomination"
|
|
37717
|
-
}
|
|
37718
|
-
),
|
|
37719
|
-
form.formState.errors.denominations && /* @__PURE__ */ jsxRuntime.jsx(ui.Alert, { variant: "error", children: "Please add at least one denomination." })
|
|
37720
|
-
] }) }) }) }),
|
|
37721
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
37722
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
37723
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
37724
|
-
] }) })
|
|
37725
|
-
]
|
|
37726
|
-
}
|
|
37727
|
-
) });
|
|
37728
|
-
};
|
|
37729
|
-
const GiftCardProductEdit = () => {
|
|
37730
|
-
const { id } = reactRouterDom.useParams();
|
|
37731
|
-
const { product, isLoading, isError, error } = useProduct(id, {});
|
|
37732
|
-
if (isError) {
|
|
37733
|
-
throw error;
|
|
37734
|
-
}
|
|
37735
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
37736
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
37737
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit gift cards denominations" }) }),
|
|
37738
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { className: "sr-only", children: "Edit the gift card denominations" })
|
|
37739
|
-
] }),
|
|
37740
|
-
!isLoading && product && /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductEditDenominationsForm, { product })
|
|
37741
|
-
] });
|
|
37742
|
-
};
|
|
37743
37743
|
const EditProductMediaForm = ({ product }) => {
|
|
37744
37744
|
const [selection, setSelection] = React.useState({});
|
|
37745
37745
|
const { handleSuccess } = useRouteModal();
|
|
@@ -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
|
},
|
|
@@ -38693,11 +38693,11 @@ const routeModule = {
|
|
|
38693
38693
|
children: [
|
|
38694
38694
|
{
|
|
38695
38695
|
Component: GiftCardProductEdit$1,
|
|
38696
|
-
path: "/gift-cards/gift-card-products/:id/
|
|
38696
|
+
path: "/gift-cards/gift-card-products/:id/denominations"
|
|
38697
38697
|
},
|
|
38698
38698
|
{
|
|
38699
38699
|
Component: GiftCardProductEdit,
|
|
38700
|
-
path: "/gift-cards/gift-card-products/:id/
|
|
38700
|
+
path: "/gift-cards/gift-card-products/:id/edit"
|
|
38701
38701
|
}
|
|
38702
38702
|
]
|
|
38703
38703
|
},
|
|
@@ -38717,18 +38717,18 @@ const routeModule = {
|
|
|
38717
38717
|
};
|
|
38718
38718
|
const menuItemModule = {
|
|
38719
38719
|
menuItems: [
|
|
38720
|
-
{
|
|
38721
|
-
label: config$2.label,
|
|
38722
|
-
icon: config$2.icon,
|
|
38723
|
-
path: "/gift-cards",
|
|
38724
|
-
nested: void 0
|
|
38725
|
-
},
|
|
38726
38720
|
{
|
|
38727
38721
|
label: config$1.label,
|
|
38728
38722
|
icon: config$1.icon,
|
|
38729
38723
|
path: "/store-credit-accounts",
|
|
38730
38724
|
nested: void 0
|
|
38731
38725
|
},
|
|
38726
|
+
{
|
|
38727
|
+
label: config$2.label,
|
|
38728
|
+
icon: config$2.icon,
|
|
38729
|
+
path: "/gift-cards",
|
|
38730
|
+
nested: void 0
|
|
38731
|
+
},
|
|
38732
38732
|
{
|
|
38733
38733
|
label: config.label,
|
|
38734
38734
|
icon: void 0,
|
|
@@ -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$
|
|
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$
|
|
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(
|
|
@@ -37397,6 +37397,153 @@ const ProductDetail = () => {
|
|
|
37397
37397
|
] });
|
|
37398
37398
|
};
|
|
37399
37399
|
const EditProductSchema$1 = objectType({
|
|
37400
|
+
denominations: arrayType(
|
|
37401
|
+
objectType({
|
|
37402
|
+
id: stringType().optional(),
|
|
37403
|
+
value: stringType().min(1),
|
|
37404
|
+
prices: recordType(stringType(), optionalFloat).optional()
|
|
37405
|
+
})
|
|
37406
|
+
).min(1)
|
|
37407
|
+
});
|
|
37408
|
+
const GiftCardProductEditDenominationsForm = ({
|
|
37409
|
+
product
|
|
37410
|
+
}) => {
|
|
37411
|
+
var _a;
|
|
37412
|
+
const { handleSuccess } = useRouteModal();
|
|
37413
|
+
const form = useForm({
|
|
37414
|
+
defaultValues: {
|
|
37415
|
+
denominations: (_a = product.variants) == null ? void 0 : _a.map((variant) => ({
|
|
37416
|
+
id: variant.id,
|
|
37417
|
+
value: variant.title
|
|
37418
|
+
}))
|
|
37419
|
+
},
|
|
37420
|
+
resolver: t(EditProductSchema$1)
|
|
37421
|
+
});
|
|
37422
|
+
const { mutateAsync, isPending } = useUpdateProduct(product.id);
|
|
37423
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
37424
|
+
const optionValues = data.denominations.map(
|
|
37425
|
+
(denomination) => denomination.value
|
|
37426
|
+
);
|
|
37427
|
+
const options = [
|
|
37428
|
+
{
|
|
37429
|
+
title: "denomination",
|
|
37430
|
+
values: optionValues
|
|
37431
|
+
}
|
|
37432
|
+
];
|
|
37433
|
+
await mutateAsync(
|
|
37434
|
+
{
|
|
37435
|
+
options,
|
|
37436
|
+
variants: data.denominations.map((denomination) => ({
|
|
37437
|
+
id: denomination.id,
|
|
37438
|
+
title: denomination.value,
|
|
37439
|
+
manage_inventory: false,
|
|
37440
|
+
options: {
|
|
37441
|
+
denomination: denomination.value
|
|
37442
|
+
}
|
|
37443
|
+
}))
|
|
37444
|
+
},
|
|
37445
|
+
{
|
|
37446
|
+
onSuccess: () => {
|
|
37447
|
+
toast.success(`Denominations updated successfully`);
|
|
37448
|
+
handleSuccess();
|
|
37449
|
+
},
|
|
37450
|
+
onError: (e2) => {
|
|
37451
|
+
toast.error(e2.message);
|
|
37452
|
+
}
|
|
37453
|
+
}
|
|
37454
|
+
);
|
|
37455
|
+
});
|
|
37456
|
+
const {
|
|
37457
|
+
fields: denominationsFields,
|
|
37458
|
+
append: addDenomination,
|
|
37459
|
+
remove: removeDenomination
|
|
37460
|
+
} = useFieldArray({
|
|
37461
|
+
name: "denominations",
|
|
37462
|
+
control: form.control
|
|
37463
|
+
});
|
|
37464
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
37465
|
+
KeyboundForm,
|
|
37466
|
+
{
|
|
37467
|
+
onSubmit: handleSubmit,
|
|
37468
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
37469
|
+
children: [
|
|
37470
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
37471
|
+
denominationsFields.map((denominationField, index) => {
|
|
37472
|
+
return /* @__PURE__ */ jsxs(
|
|
37473
|
+
"div",
|
|
37474
|
+
{
|
|
37475
|
+
className: "flex items-center justify-between shadow-elevation-card-rest bg-ui-bg-component transition-fg rounded-md px-4 py-2",
|
|
37476
|
+
children: [
|
|
37477
|
+
/* @__PURE__ */ jsx(
|
|
37478
|
+
Form$2.Field,
|
|
37479
|
+
{
|
|
37480
|
+
control: form.control,
|
|
37481
|
+
name: `denominations.${index}.value`,
|
|
37482
|
+
render: ({ field }) => {
|
|
37483
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { className: "w-full", children: [
|
|
37484
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field, placeholder: "100" }) }),
|
|
37485
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
37486
|
+
] });
|
|
37487
|
+
}
|
|
37488
|
+
},
|
|
37489
|
+
denominationField.id
|
|
37490
|
+
),
|
|
37491
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center rounded-xl", children: /* @__PURE__ */ jsx(
|
|
37492
|
+
Button,
|
|
37493
|
+
{
|
|
37494
|
+
size: "small",
|
|
37495
|
+
variant: "secondary",
|
|
37496
|
+
type: "button",
|
|
37497
|
+
className: "rounded-full p-0 ml-4",
|
|
37498
|
+
onClick: () => {
|
|
37499
|
+
removeDenomination(index);
|
|
37500
|
+
},
|
|
37501
|
+
children: /* @__PURE__ */ jsx(XCircleSolid, { className: "rounded-full" })
|
|
37502
|
+
}
|
|
37503
|
+
) })
|
|
37504
|
+
]
|
|
37505
|
+
},
|
|
37506
|
+
denominationField.id
|
|
37507
|
+
);
|
|
37508
|
+
}),
|
|
37509
|
+
/* @__PURE__ */ jsx(
|
|
37510
|
+
Button,
|
|
37511
|
+
{
|
|
37512
|
+
size: "small",
|
|
37513
|
+
variant: "secondary",
|
|
37514
|
+
type: "button",
|
|
37515
|
+
className: "w-full",
|
|
37516
|
+
onClick: () => {
|
|
37517
|
+
addDenomination({ value: "", prices: {} });
|
|
37518
|
+
},
|
|
37519
|
+
children: "Add denomination"
|
|
37520
|
+
}
|
|
37521
|
+
),
|
|
37522
|
+
form.formState.errors.denominations && /* @__PURE__ */ jsx(Alert, { variant: "error", children: "Please add at least one denomination." })
|
|
37523
|
+
] }) }) }) }),
|
|
37524
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
37525
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
37526
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
37527
|
+
] }) })
|
|
37528
|
+
]
|
|
37529
|
+
}
|
|
37530
|
+
) });
|
|
37531
|
+
};
|
|
37532
|
+
const GiftCardProductEdit$1 = () => {
|
|
37533
|
+
const { id } = useParams();
|
|
37534
|
+
const { product, isLoading, isError, error } = useProduct(id, {});
|
|
37535
|
+
if (isError) {
|
|
37536
|
+
throw error;
|
|
37537
|
+
}
|
|
37538
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
37539
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
37540
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit gift cards denominations" }) }),
|
|
37541
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { className: "sr-only", children: "Edit the gift card denominations" })
|
|
37542
|
+
] }),
|
|
37543
|
+
!isLoading && product && /* @__PURE__ */ jsx(GiftCardProductEditDenominationsForm, { product })
|
|
37544
|
+
] });
|
|
37545
|
+
};
|
|
37546
|
+
const EditProductSchema = objectType({
|
|
37400
37547
|
status: enumType(["draft", "published", "proposed", "rejected"]),
|
|
37401
37548
|
title: stringType().min(1),
|
|
37402
37549
|
subtitle: stringType().optional(),
|
|
@@ -37415,7 +37562,7 @@ const GiftCardProductEditForm = ({
|
|
|
37415
37562
|
handle: product.handle || "",
|
|
37416
37563
|
description: product.description || ""
|
|
37417
37564
|
},
|
|
37418
|
-
resolver: t(EditProductSchema
|
|
37565
|
+
resolver: t(EditProductSchema)
|
|
37419
37566
|
});
|
|
37420
37567
|
const { mutateAsync, isPending } = useUpdateProduct(product.id);
|
|
37421
37568
|
const handleSubmit = form.handleSubmit(async (data) => {
|
|
@@ -37556,7 +37703,7 @@ const GiftCardProductEditForm = ({
|
|
|
37556
37703
|
}
|
|
37557
37704
|
) });
|
|
37558
37705
|
};
|
|
37559
|
-
const GiftCardProductEdit
|
|
37706
|
+
const GiftCardProductEdit = () => {
|
|
37560
37707
|
const { id } = useParams();
|
|
37561
37708
|
const { product, isLoading, isError, error } = useProduct(id, {});
|
|
37562
37709
|
if (isError) {
|
|
@@ -37570,153 +37717,6 @@ const GiftCardProductEdit$1 = () => {
|
|
|
37570
37717
|
!isLoading && product && /* @__PURE__ */ jsx(GiftCardProductEditForm, { product })
|
|
37571
37718
|
] });
|
|
37572
37719
|
};
|
|
37573
|
-
const EditProductSchema = objectType({
|
|
37574
|
-
denominations: arrayType(
|
|
37575
|
-
objectType({
|
|
37576
|
-
id: stringType().optional(),
|
|
37577
|
-
value: stringType().min(1),
|
|
37578
|
-
prices: recordType(stringType(), optionalFloat).optional()
|
|
37579
|
-
})
|
|
37580
|
-
).min(1)
|
|
37581
|
-
});
|
|
37582
|
-
const GiftCardProductEditDenominationsForm = ({
|
|
37583
|
-
product
|
|
37584
|
-
}) => {
|
|
37585
|
-
var _a;
|
|
37586
|
-
const { handleSuccess } = useRouteModal();
|
|
37587
|
-
const form = useForm({
|
|
37588
|
-
defaultValues: {
|
|
37589
|
-
denominations: (_a = product.variants) == null ? void 0 : _a.map((variant) => ({
|
|
37590
|
-
id: variant.id,
|
|
37591
|
-
value: variant.title
|
|
37592
|
-
}))
|
|
37593
|
-
},
|
|
37594
|
-
resolver: t(EditProductSchema)
|
|
37595
|
-
});
|
|
37596
|
-
const { mutateAsync, isPending } = useUpdateProduct(product.id);
|
|
37597
|
-
const handleSubmit = form.handleSubmit(async (data) => {
|
|
37598
|
-
const optionValues = data.denominations.map(
|
|
37599
|
-
(denomination) => denomination.value
|
|
37600
|
-
);
|
|
37601
|
-
const options = [
|
|
37602
|
-
{
|
|
37603
|
-
title: "denomination",
|
|
37604
|
-
values: optionValues
|
|
37605
|
-
}
|
|
37606
|
-
];
|
|
37607
|
-
await mutateAsync(
|
|
37608
|
-
{
|
|
37609
|
-
options,
|
|
37610
|
-
variants: data.denominations.map((denomination) => ({
|
|
37611
|
-
id: denomination.id,
|
|
37612
|
-
title: denomination.value,
|
|
37613
|
-
manage_inventory: false,
|
|
37614
|
-
options: {
|
|
37615
|
-
denomination: denomination.value
|
|
37616
|
-
}
|
|
37617
|
-
}))
|
|
37618
|
-
},
|
|
37619
|
-
{
|
|
37620
|
-
onSuccess: () => {
|
|
37621
|
-
toast.success(`Denominations updated successfully`);
|
|
37622
|
-
handleSuccess();
|
|
37623
|
-
},
|
|
37624
|
-
onError: (e2) => {
|
|
37625
|
-
toast.error(e2.message);
|
|
37626
|
-
}
|
|
37627
|
-
}
|
|
37628
|
-
);
|
|
37629
|
-
});
|
|
37630
|
-
const {
|
|
37631
|
-
fields: denominationsFields,
|
|
37632
|
-
append: addDenomination,
|
|
37633
|
-
remove: removeDenomination
|
|
37634
|
-
} = useFieldArray({
|
|
37635
|
-
name: "denominations",
|
|
37636
|
-
control: form.control
|
|
37637
|
-
});
|
|
37638
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
37639
|
-
KeyboundForm,
|
|
37640
|
-
{
|
|
37641
|
-
onSubmit: handleSubmit,
|
|
37642
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
37643
|
-
children: [
|
|
37644
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
37645
|
-
denominationsFields.map((denominationField, index) => {
|
|
37646
|
-
return /* @__PURE__ */ jsxs(
|
|
37647
|
-
"div",
|
|
37648
|
-
{
|
|
37649
|
-
className: "flex items-center justify-between shadow-elevation-card-rest bg-ui-bg-component transition-fg rounded-md px-4 py-2",
|
|
37650
|
-
children: [
|
|
37651
|
-
/* @__PURE__ */ jsx(
|
|
37652
|
-
Form$2.Field,
|
|
37653
|
-
{
|
|
37654
|
-
control: form.control,
|
|
37655
|
-
name: `denominations.${index}.value`,
|
|
37656
|
-
render: ({ field }) => {
|
|
37657
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { className: "w-full", children: [
|
|
37658
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field, placeholder: "100" }) }),
|
|
37659
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
37660
|
-
] });
|
|
37661
|
-
}
|
|
37662
|
-
},
|
|
37663
|
-
denominationField.id
|
|
37664
|
-
),
|
|
37665
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center rounded-xl", children: /* @__PURE__ */ jsx(
|
|
37666
|
-
Button,
|
|
37667
|
-
{
|
|
37668
|
-
size: "small",
|
|
37669
|
-
variant: "secondary",
|
|
37670
|
-
type: "button",
|
|
37671
|
-
className: "rounded-full p-0 ml-4",
|
|
37672
|
-
onClick: () => {
|
|
37673
|
-
removeDenomination(index);
|
|
37674
|
-
},
|
|
37675
|
-
children: /* @__PURE__ */ jsx(XCircleSolid, { className: "rounded-full" })
|
|
37676
|
-
}
|
|
37677
|
-
) })
|
|
37678
|
-
]
|
|
37679
|
-
},
|
|
37680
|
-
denominationField.id
|
|
37681
|
-
);
|
|
37682
|
-
}),
|
|
37683
|
-
/* @__PURE__ */ jsx(
|
|
37684
|
-
Button,
|
|
37685
|
-
{
|
|
37686
|
-
size: "small",
|
|
37687
|
-
variant: "secondary",
|
|
37688
|
-
type: "button",
|
|
37689
|
-
className: "w-full",
|
|
37690
|
-
onClick: () => {
|
|
37691
|
-
addDenomination({ value: "", prices: {} });
|
|
37692
|
-
},
|
|
37693
|
-
children: "Add denomination"
|
|
37694
|
-
}
|
|
37695
|
-
),
|
|
37696
|
-
form.formState.errors.denominations && /* @__PURE__ */ jsx(Alert, { variant: "error", children: "Please add at least one denomination." })
|
|
37697
|
-
] }) }) }) }),
|
|
37698
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
37699
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
37700
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
37701
|
-
] }) })
|
|
37702
|
-
]
|
|
37703
|
-
}
|
|
37704
|
-
) });
|
|
37705
|
-
};
|
|
37706
|
-
const GiftCardProductEdit = () => {
|
|
37707
|
-
const { id } = useParams();
|
|
37708
|
-
const { product, isLoading, isError, error } = useProduct(id, {});
|
|
37709
|
-
if (isError) {
|
|
37710
|
-
throw error;
|
|
37711
|
-
}
|
|
37712
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
37713
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
37714
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit gift cards denominations" }) }),
|
|
37715
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { className: "sr-only", children: "Edit the gift card denominations" })
|
|
37716
|
-
] }),
|
|
37717
|
-
!isLoading && product && /* @__PURE__ */ jsx(GiftCardProductEditDenominationsForm, { product })
|
|
37718
|
-
] });
|
|
37719
|
-
};
|
|
37720
37720
|
const EditProductMediaForm = ({ product }) => {
|
|
37721
37721
|
const [selection, setSelection] = useState({});
|
|
37722
37722
|
const { handleSuccess } = useRouteModal();
|
|
@@ -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
|
},
|
|
@@ -38670,11 +38670,11 @@ const routeModule = {
|
|
|
38670
38670
|
children: [
|
|
38671
38671
|
{
|
|
38672
38672
|
Component: GiftCardProductEdit$1,
|
|
38673
|
-
path: "/gift-cards/gift-card-products/:id/
|
|
38673
|
+
path: "/gift-cards/gift-card-products/:id/denominations"
|
|
38674
38674
|
},
|
|
38675
38675
|
{
|
|
38676
38676
|
Component: GiftCardProductEdit,
|
|
38677
|
-
path: "/gift-cards/gift-card-products/:id/
|
|
38677
|
+
path: "/gift-cards/gift-card-products/:id/edit"
|
|
38678
38678
|
}
|
|
38679
38679
|
]
|
|
38680
38680
|
},
|
|
@@ -38694,18 +38694,18 @@ const routeModule = {
|
|
|
38694
38694
|
};
|
|
38695
38695
|
const menuItemModule = {
|
|
38696
38696
|
menuItems: [
|
|
38697
|
-
{
|
|
38698
|
-
label: config$2.label,
|
|
38699
|
-
icon: config$2.icon,
|
|
38700
|
-
path: "/gift-cards",
|
|
38701
|
-
nested: void 0
|
|
38702
|
-
},
|
|
38703
38697
|
{
|
|
38704
38698
|
label: config$1.label,
|
|
38705
38699
|
icon: config$1.icon,
|
|
38706
38700
|
path: "/store-credit-accounts",
|
|
38707
38701
|
nested: void 0
|
|
38708
38702
|
},
|
|
38703
|
+
{
|
|
38704
|
+
label: config$2.label,
|
|
38705
|
+
icon: config$2.icon,
|
|
38706
|
+
path: "/gift-cards",
|
|
38707
|
+
nested: void 0
|
|
38708
|
+
},
|
|
38709
38709
|
{
|
|
38710
38710
|
label: config.label,
|
|
38711
38711
|
icon: void 0,
|
|
@@ -3,13 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.validateGiftCardBalancesStep = void 0;
|
|
4
4
|
const utils_1 = require("@medusajs/framework/utils");
|
|
5
5
|
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
6
|
-
const math_1 = require("node_modules/@medusajs/utils/dist/totals/math");
|
|
7
6
|
exports.validateGiftCardBalancesStep = (0, workflows_sdk_1.createStep)("validate-gift-card-balances", async function ({ giftCards, giftCardsBalanceMap, }) {
|
|
8
7
|
for (const giftCard of giftCards) {
|
|
9
8
|
const stats = giftCardsBalanceMap[giftCard.code];
|
|
10
|
-
if (
|
|
9
|
+
if (utils_1.MathBN.convert(stats.balance).lte(0)) {
|
|
11
10
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Gift card (${giftCard.code}) has no balance`);
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
});
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGUtZ2lmdC1jYXJkLWJhbGFuY2VzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL3dvcmtmbG93cy9jYXJ0cy9zdGVwcy92YWxpZGF0ZS1naWZ0LWNhcmQtYmFsYW5jZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEscURBQWdFO0FBQ2hFLDJEQUFxRDtBQUd4QyxRQUFBLDRCQUE0QixHQUFHLElBQUEsMEJBQVUsRUFDcEQsNkJBQTZCLEVBQzdCLEtBQUssV0FBVyxFQUNkLFNBQVMsRUFDVCxtQkFBbUIsR0FJcEI7SUFDQyxLQUFLLE1BQU0sUUFBUSxJQUFJLFNBQVMsRUFBRSxDQUFDO1FBQ2pDLE1BQU0sS0FBSyxHQUFHLG1CQUFtQixDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUVqRCxJQUFJLGNBQU0sQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDO1lBQ3pDLE1BQU0sSUFBSSxtQkFBVyxDQUNuQixtQkFBVyxDQUFDLEtBQUssQ0FBQyxZQUFZLEVBQzlCLGNBQWMsUUFBUSxDQUFDLElBQUksa0JBQWtCLENBQzlDLENBQUM7UUFDSixDQUFDO0lBQ0gsQ0FBQztBQUNILENBQUMsQ0FDRixDQUFDIn0=
|
|
@@ -5,6 +5,9 @@ export declare const retrieveGiftCardBalanceStep: import("@medusajs/workflows-sd
|
|
|
5
5
|
storeCreditAccount: ModuleStoreCreditAccount;
|
|
6
6
|
giftCard: ModuleGiftCard;
|
|
7
7
|
}, Record<string, ModuleAccountStats>>;
|
|
8
|
+
/**
|
|
9
|
+
* Validate if the gift card can be added to the cart
|
|
10
|
+
*/
|
|
8
11
|
export declare const validateCartGiftCardStep: import("@medusajs/workflows-sdk").StepFunction<{
|
|
9
12
|
cart: PluginCartDTO;
|
|
10
13
|
giftCards: ModuleGiftCard[];
|
|
@@ -15,12 +15,20 @@ exports.retrieveGiftCardBalanceStep = (0, workflows_sdk_1.createStep)("retrieve-
|
|
|
15
15
|
accountBalanceMap[giftCard.code] = giftCardBalance;
|
|
16
16
|
return new workflows_sdk_1.StepResponse(accountBalanceMap);
|
|
17
17
|
});
|
|
18
|
+
/**
|
|
19
|
+
* Validate if the gift card exists.
|
|
20
|
+
*/
|
|
21
|
+
const validateGiftCardStep = (0, workflows_sdk_1.createStep)("validate-gift-card", async function ({ giftCard, input, }) {
|
|
22
|
+
if (!giftCard) {
|
|
23
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Gift card (${input.code}) not found`);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Validate if the gift card can be added to the cart
|
|
28
|
+
*/
|
|
18
29
|
exports.validateCartGiftCardStep = (0, workflows_sdk_1.createStep)("validate-cart-gift-card", async function ({ cart, giftCards, }) {
|
|
19
30
|
for (const giftCard of giftCards) {
|
|
20
31
|
const cartGiftCard = cart.gift_cards.find((gc) => gc.code.includes(giftCard.code));
|
|
21
|
-
if (!cartGiftCard) {
|
|
22
|
-
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Gift card (${giftCard.code}) not found`);
|
|
23
|
-
}
|
|
24
32
|
if (cartGiftCard) {
|
|
25
33
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Gift card (${giftCard.code}) already applied to cart`);
|
|
26
34
|
}
|
|
@@ -49,6 +57,7 @@ exports.addGiftCardToCartWorkflow = (0, workflows_sdk_1.createWorkflow)("add-gif
|
|
|
49
57
|
const giftCard = (0, workflows_sdk_1.transform)({ giftCardQuery }, ({ giftCardQuery }) => {
|
|
50
58
|
return giftCardQuery.data[0];
|
|
51
59
|
});
|
|
60
|
+
validateGiftCardStep({ giftCard, input });
|
|
52
61
|
const giftCards = (0, workflows_sdk_1.transform)({ giftCardQuery }, ({ giftCardQuery }) => {
|
|
53
62
|
return giftCardQuery.data;
|
|
54
63
|
});
|
|
@@ -115,4 +124,4 @@ exports.addGiftCardToCartWorkflow = (0, workflows_sdk_1.createWorkflow)("add-gif
|
|
|
115
124
|
});
|
|
116
125
|
return new workflows_sdk_1.WorkflowResponse(creditLines);
|
|
117
126
|
});
|
|
118
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
127
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkLWdpZnQtY2FyZC10by1jYXJ0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL3dvcmtmbG93cy9jYXJ0cy93b3JrZmxvd3MvYWRkLWdpZnQtY2FyZC10by1jYXJ0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLHFEQUF5RTtBQUN6RSw0REFLcUM7QUFDckMsMkRBTWlDO0FBQ2pDLDBDQUE4QztBQVE5QyxzRkFBb0Y7QUFFdkUsUUFBQSwyQkFBMk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BQUMsQ0FDRixDQUFDIn0=
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { PluginCartDTO } from "../../../types/cart";
|
|
2
2
|
import { ModuleGiftCard } from "../../../types/loyalty";
|
|
3
|
+
export declare const validateGiftCardInCartStep: import("@medusajs/workflows-sdk").StepFunction<{
|
|
4
|
+
cart: PluginCartDTO;
|
|
5
|
+
giftCard: ModuleGiftCard;
|
|
6
|
+
}, unknown>;
|
|
3
7
|
export declare const validateGiftCardStep: import("@medusajs/workflows-sdk").StepFunction<{
|
|
4
8
|
cart: PluginCartDTO;
|
|
5
9
|
giftCard: ModuleGiftCard;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeGiftCardFromCartWorkflow = exports.validateGiftCardStep = void 0;
|
|
3
|
+
exports.removeGiftCardFromCartWorkflow = exports.validateGiftCardStep = exports.validateGiftCardInCartStep = void 0;
|
|
4
4
|
const utils_1 = require("@medusajs/framework/utils");
|
|
5
5
|
const core_flows_1 = require("@medusajs/medusa/core-flows");
|
|
6
6
|
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
7
7
|
const types_1 = require("../../../types");
|
|
8
|
+
exports.validateGiftCardInCartStep = (0, workflows_sdk_1.createStep)("validate-gift-card-in-cart", async function ({ cart, giftCard, }) {
|
|
9
|
+
const cartGiftCard = cart.gift_cards.find((gc) => gc.code.includes(giftCard.code));
|
|
10
|
+
if (!(0, utils_1.isPresent)(cartGiftCard)) {
|
|
11
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Gift card (${giftCard.code}) not found in cart`);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
8
14
|
exports.validateGiftCardStep = (0, workflows_sdk_1.createStep)("validate-gift-card", async function ({ cart, giftCard, input, }) {
|
|
9
15
|
const cartGiftCards = cart.gift_cards || [];
|
|
10
16
|
if (!cartGiftCards.find((gc) => gc.code === input.code)) {
|
|
@@ -43,6 +49,7 @@ exports.removeGiftCardFromCartWorkflow = (0, workflows_sdk_1.createWorkflow)("re
|
|
|
43
49
|
return giftCardQuery.data[0];
|
|
44
50
|
});
|
|
45
51
|
(0, exports.validateGiftCardStep)({ cart, giftCard, input });
|
|
52
|
+
(0, exports.validateGiftCardInCartStep)({ cart, giftCard });
|
|
46
53
|
const creditLineIds = (0, workflows_sdk_1.transform)({ cart, giftCard }, ({ cart, giftCard }) => {
|
|
47
54
|
return cart.credit_lines
|
|
48
55
|
.filter((creditLine) => creditLine.reference === "gift-card" &&
|
|
@@ -64,4 +71,4 @@ exports.removeGiftCardFromCartWorkflow = (0, workflows_sdk_1.createWorkflow)("re
|
|
|
64
71
|
input: { cart_id: input.cart_id },
|
|
65
72
|
});
|
|
66
73
|
});
|
|
67
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
74
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVtb3ZlLWdpZnQtY2FydC1mcm9tLWNhcnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvd29ya2Zsb3dzL2NhcnRzL3dvcmtmbG93cy9yZW1vdmUtZ2lmdC1jYXJ0LWZyb20tY2FydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxxREFBNEU7QUFDNUUsNERBS3FDO0FBQ3JDLDJEQUFnRjtBQUNoRiwwQ0FBOEM7QUFJakMsUUFBQSwwQkFBMEIsR0FBRyxJQUFBLDBCQUFVLEVBQ2xELDRCQUE0QixFQUM1QixLQUFLLFdBQVcsRUFDZCxJQUFJLEVBQ0osUUFBUSxHQUlUO0lBQ0MsTUFBTSxZQUFZLEdBQUcsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQUUsRUFBRSxDQUMvQyxFQUFFLENBQUMsSU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sQ0FBQyxFQUFFLEVBQUUsWUFBWSxFQUFFLFFBQVEsQ0FBQyxFQUFFLEVBQUU7YUFDdEQ7U0FDRjtLQUNGLENBQUMsQ0FBQztJQUVILHFDQUF3QixDQUFDLFNBQVMsQ0FBQztRQUNqQyxLQUFLLEVBQUUsRUFBRSxPQUFPLEVBQUUsS0FBSyxDQUFDLE9BQU8sRUFBRTtLQUNsQyxDQUFDLENBQUM7QUFDTCxDQUFDLENBQ0YsQ0FBQyJ9
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/loyalty-plugin",
|
|
3
|
-
"version": "0.0.7-snapshot.
|
|
3
|
+
"version": "0.0.7-snapshot.3",
|
|
4
4
|
"description": "Medusa Plugin: Loyalty - Gift Cards",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"import": "./.medusa/server/src/workflows/index.js",
|
|
18
18
|
"types": "./.medusa/server/src/workflows/index.d.ts"
|
|
19
19
|
},
|
|
20
|
+
"./types": {
|
|
21
|
+
"import": "./.medusa/server/src/types/index.js",
|
|
22
|
+
"types": "./.medusa/server/src/types/index.d.ts"
|
|
23
|
+
},
|
|
20
24
|
"./admin": {
|
|
21
25
|
"import": "./.medusa/server/src/admin/index.mjs",
|
|
22
26
|
"require": "./.medusa/server/src/admin/index.js",
|
|
@@ -36,7 +40,7 @@
|
|
|
36
40
|
"build": "medusa plugin:build",
|
|
37
41
|
"dev": "medusa plugin:develop",
|
|
38
42
|
"prepublishOnly": "medusa plugin:build",
|
|
39
|
-
"test": "NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit"
|
|
43
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit --silent"
|
|
40
44
|
},
|
|
41
45
|
"devDependencies": {
|
|
42
46
|
"@medusajs/admin-sdk": "2.8.8",
|