@kshon/loyalty-plugin 2.14.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.
- package/.medusa/server/src/admin/index.js +69052 -0
- package/.medusa/server/src/admin/index.mjs +69034 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/orders/route.d.ts +2 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/orders/route.js +28 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/route.d.ts +4 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/route.js +41 -0
- package/.medusa/server/src/api/admin/gift-cards/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/admin/gift-cards/middlewares.js +46 -0
- package/.medusa/server/src/api/admin/gift-cards/query-config.d.ts +14 -0
- package/.medusa/server/src/api/admin/gift-cards/query-config.js +32 -0
- package/.medusa/server/src/api/admin/gift-cards/route.d.ts +4 -0
- package/.medusa/server/src/api/admin/gift-cards/route.js +42 -0
- package/.medusa/server/src/api/admin/gift-cards/validators.d.ts +139 -0
- package/.medusa/server/src/api/admin/gift-cards/validators.js +56 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/credit/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/credit/route.js +30 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/route.js +19 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/transactions/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/transactions/route.js +23 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/middlewares.js +46 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/query-config.d.ts +18 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/query-config.js +44 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/route.d.ts +4 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/route.js +52 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/validators.d.ts +142 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/validators.js +45 -0
- package/.medusa/server/src/api/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/middlewares.js +18 -0
- package/.medusa/server/src/api/store/carts/[id]/gift-cards/route.d.ts +5 -0
- package/.medusa/server/src/api/store/carts/[id]/gift-cards/route.js +43 -0
- package/.medusa/server/src/api/store/carts/[id]/store-credits/route.d.ts +4 -0
- package/.medusa/server/src/api/store/carts/[id]/store-credits/route.js +24 -0
- package/.medusa/server/src/api/store/carts/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/store/carts/middlewares.js +35 -0
- package/.medusa/server/src/api/store/carts/query-config.d.ts +4 -0
- package/.medusa/server/src/api/store/carts/query-config.js +9 -0
- package/.medusa/server/src/api/store/carts/validators.d.ts +13 -0
- package/.medusa/server/src/api/store/carts/validators.js +14 -0
- package/.medusa/server/src/api/store/gift-cards/[idOrCode]/route.d.ts +3 -0
- package/.medusa/server/src/api/store/gift-cards/[idOrCode]/route.js +24 -0
- package/.medusa/server/src/api/store/gift-cards/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/store/gift-cards/middlewares.js +16 -0
- package/.medusa/server/src/api/store/gift-cards/query-config.d.ts +9 -0
- package/.medusa/server/src/api/store/gift-cards/query-config.js +23 -0
- package/.medusa/server/src/api/store/gift-cards/validators.d.ts +7 -0
- package/.medusa/server/src/api/store/gift-cards/validators.js +8 -0
- package/.medusa/server/src/api/store/store-credit-accounts/[id]/route.d.ts +3 -0
- package/.medusa/server/src/api/store/store-credit-accounts/[id]/route.js +31 -0
- package/.medusa/server/src/api/store/store-credit-accounts/claim/route.d.ts +3 -0
- package/.medusa/server/src/api/store/store-credit-accounts/claim/route.js +25 -0
- package/.medusa/server/src/api/store/store-credit-accounts/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/store/store-credit-accounts/middlewares.js +36 -0
- package/.medusa/server/src/api/store/store-credit-accounts/query-config.d.ts +9 -0
- package/.medusa/server/src/api/store/store-credit-accounts/query-config.js +24 -0
- package/.medusa/server/src/api/store/store-credit-accounts/route.d.ts +3 -0
- package/.medusa/server/src/api/store/store-credit-accounts/route.js +40 -0
- package/.medusa/server/src/api/store/store-credit-accounts/validators.d.ts +44 -0
- package/.medusa/server/src/api/store/store-credit-accounts/validators.js +19 -0
- package/.medusa/server/src/links/cart-gift-cards-link.d.ts +2 -0
- package/.medusa/server/src/links/cart-gift-cards-link.js +13 -0
- package/.medusa/server/src/links/customer-store-credit-account-link.d.ts +1 -0
- package/.medusa/server/src/links/customer-store-credit-account-link.js +13 -0
- package/.medusa/server/src/links/gift-card-store-credit.d.ts +2 -0
- package/.medusa/server/src/links/gift-card-store-credit.js +10 -0
- package/.medusa/server/src/links/order-gift-cards-link.d.ts +2 -0
- package/.medusa/server/src/links/order-gift-cards-link.js +13 -0
- package/.medusa/server/src/links/order-line-item-gift-card-link.d.ts +1 -0
- package/.medusa/server/src/links/order-line-item-gift-card-link.js +19 -0
- package/.medusa/server/src/modules/loyalty/index.d.ts +21 -0
- package/.medusa/server/src/modules/loyalty/index.js +12 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250123130553.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250123130553.js +17 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250127174331.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250127174331.js +19 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141026.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141026.js +19 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141429.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141429.js +14 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206144714.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206144714.js +14 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250326095923.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250326095923.js +16 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250617080328.d.ts +5 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250617080328.js +20 -0
- package/.medusa/server/src/modules/loyalty/models/gift-card.d.ts +18 -0
- package/.medusa/server/src/modules/loyalty/models/gift-card.js +18 -0
- package/.medusa/server/src/modules/loyalty/models/index.d.ts +1 -0
- package/.medusa/server/src/modules/loyalty/models/index.js +9 -0
- package/.medusa/server/src/modules/loyalty/service.d.ts +21 -0
- package/.medusa/server/src/modules/loyalty/service.js +13 -0
- package/.medusa/server/src/modules/store-credit/index.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/index.js +12 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250129115518.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250129115518.js +16 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130213237.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130213237.js +18 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130220640.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130220640.js +19 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250131205753.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250131205753.js +14 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250520081315.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250520081315.js +16 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250626081315.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250626081315.js +16 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250722080351.d.ts +5 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250722080351.js +27 -0
- package/.medusa/server/src/modules/store-credit/models/account-transaction.d.ts +28 -0
- package/.medusa/server/src/modules/store-credit/models/account-transaction.js +21 -0
- package/.medusa/server/src/modules/store-credit/models/index.d.ts +2 -0
- package/.medusa/server/src/modules/store-credit/models/index.js +11 -0
- package/.medusa/server/src/modules/store-credit/models/store-credit-account.d.ts +27 -0
- package/.medusa/server/src/modules/store-credit/models/store-credit-account.js +27 -0
- package/.medusa/server/src/modules/store-credit/service.d.ts +29 -0
- package/.medusa/server/src/modules/store-credit/service.js +253 -0
- package/.medusa/server/src/subscribers/create-gift-card.d.ts +5 -0
- package/.medusa/server/src/subscribers/create-gift-card.js +53 -0
- package/.medusa/server/src/types/cart/index.d.ts +12 -0
- package/.medusa/server/src/types/cart/index.js +3 -0
- package/.medusa/server/src/types/http/gift-card.d.ts +42 -0
- package/.medusa/server/src/types/http/gift-card.js +3 -0
- package/.medusa/server/src/types/http/index.d.ts +3 -0
- package/.medusa/server/src/types/http/index.js +20 -0
- package/.medusa/server/src/types/http/store-credit-account.d.ts +60 -0
- package/.medusa/server/src/types/http/store-credit-account.js +3 -0
- package/.medusa/server/src/types/http/transaction.d.ts +19 -0
- package/.medusa/server/src/types/http/transaction.js +3 -0
- package/.medusa/server/src/types/index.d.ts +4 -0
- package/.medusa/server/src/types/index.js +21 -0
- package/.medusa/server/src/types/loyalty/index.d.ts +3 -0
- package/.medusa/server/src/types/loyalty/index.js +20 -0
- package/.medusa/server/src/types/loyalty/module.d.ts +151 -0
- package/.medusa/server/src/types/loyalty/module.js +12 -0
- package/.medusa/server/src/types/loyalty/service.d.ts +168 -0
- package/.medusa/server/src/types/loyalty/service.js +3 -0
- package/.medusa/server/src/types/loyalty/workflows.d.ts +3 -0
- package/.medusa/server/src/types/loyalty/workflows.js +3 -0
- package/.medusa/server/src/types/modules.d.ts +6 -0
- package/.medusa/server/src/types/modules.js +12 -0
- package/.medusa/server/src/types/store-credit/index.d.ts +2 -0
- package/.medusa/server/src/types/store-credit/index.js +19 -0
- package/.medusa/server/src/types/store-credit/module.d.ts +290 -0
- package/.medusa/server/src/types/store-credit/module.js +13 -0
- package/.medusa/server/src/types/store-credit/service.d.ts +325 -0
- package/.medusa/server/src/types/store-credit/service.js +3 -0
- package/.medusa/server/src/utils/code-generator.d.ts +1 -0
- package/.medusa/server/src/utils/code-generator.js +32 -0
- package/.medusa/server/src/workflows/carts/index.d.ts +5 -0
- package/.medusa/server/src/workflows/carts/index.js +22 -0
- package/.medusa/server/src/workflows/carts/steps/validate-gift-card-balances.d.ts +37 -0
- package/.medusa/server/src/workflows/carts/steps/validate-gift-card-balances.js +36 -0
- package/.medusa/server/src/workflows/carts/workflows/add-gift-card-to-cart.d.ts +118 -0
- package/.medusa/server/src/workflows/carts/workflows/add-gift-card-to-cart.js +179 -0
- package/.medusa/server/src/workflows/carts/workflows/add-store-credits-to-cart.d.ts +88 -0
- package/.medusa/server/src/workflows/carts/workflows/add-store-credits-to-cart.js +134 -0
- package/.medusa/server/src/workflows/carts/workflows/confirm-cart-credit-lines.d.ts +68 -0
- package/.medusa/server/src/workflows/carts/workflows/confirm-cart-credit-lines.js +110 -0
- package/.medusa/server/src/workflows/carts/workflows/refresh-cart-gift-cards.d.ts +30 -0
- package/.medusa/server/src/workflows/carts/workflows/refresh-cart-gift-cards.js +154 -0
- package/.medusa/server/src/workflows/carts/workflows/remove-gift-cart-from-cart.d.ts +103 -0
- package/.medusa/server/src/workflows/carts/workflows/remove-gift-cart-from-cart.js +124 -0
- package/.medusa/server/src/workflows/common/steps/validate-presence-of.d.ts +29 -0
- package/.medusa/server/src/workflows/common/steps/validate-presence-of.js +22 -0
- package/.medusa/server/src/workflows/gift-cards/index.d.ts +9 -0
- package/.medusa/server/src/workflows/gift-cards/index.js +26 -0
- package/.medusa/server/src/workflows/gift-cards/steps/create-gift-cards.d.ts +20 -0
- package/.medusa/server/src/workflows/gift-cards/steps/create-gift-cards.js +38 -0
- package/.medusa/server/src/workflows/gift-cards/steps/delete-gift-cards.d.ts +17 -0
- package/.medusa/server/src/workflows/gift-cards/steps/delete-gift-cards.js +24 -0
- package/.medusa/server/src/workflows/gift-cards/steps/retrieve-gift-card-balance.d.ts +32 -0
- package/.medusa/server/src/workflows/gift-cards/steps/retrieve-gift-card-balance.js +34 -0
- package/.medusa/server/src/workflows/gift-cards/steps/update-gift-cards.d.ts +19 -0
- package/.medusa/server/src/workflows/gift-cards/steps/update-gift-cards.js +41 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/claim-gift-card.d.ts +65 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/claim-gift-card.js +101 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/create-gift-cards.d.ts +36 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/create-gift-cards.js +88 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/delete-gift-card.d.ts +28 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/delete-gift-card.js +34 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/redeem-gift-card.d.ts +60 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/redeem-gift-card.js +129 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/update-gift-cards.d.ts +28 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/update-gift-cards.js +31 -0
- package/.medusa/server/src/workflows/hooks/after-order-created.d.ts +1 -0
- package/.medusa/server/src/workflows/hooks/after-order-created.js +31 -0
- package/.medusa/server/src/workflows/hooks/after-order-credit-lines-created.d.ts +1 -0
- package/.medusa/server/src/workflows/hooks/after-order-credit-lines-created.js +32 -0
- package/.medusa/server/src/workflows/hooks/before-payment-collection-refresh.d.ts +1 -0
- package/.medusa/server/src/workflows/hooks/before-payment-collection-refresh.js +26 -0
- package/.medusa/server/src/workflows/hooks/complete-cart-before-payment-authorization.d.ts +1 -0
- package/.medusa/server/src/workflows/hooks/complete-cart-before-payment-authorization.js +27 -0
- package/.medusa/server/src/workflows/index.d.ts +3 -0
- package/.medusa/server/src/workflows/index.js +20 -0
- package/.medusa/server/src/workflows/orders/index.d.ts +2 -0
- package/.medusa/server/src/workflows/orders/index.js +19 -0
- package/.medusa/server/src/workflows/orders/workflows/link-gift-cards-to-order.d.ts +34 -0
- package/.medusa/server/src/workflows/orders/workflows/link-gift-cards-to-order.js +75 -0
- package/.medusa/server/src/workflows/orders/workflows/refund-credit-lines.d.ts +88 -0
- package/.medusa/server/src/workflows/orders/workflows/refund-credit-lines.js +131 -0
- package/.medusa/server/src/workflows/store-credit/index.d.ts +8 -0
- package/.medusa/server/src/workflows/store-credit/index.js +25 -0
- package/.medusa/server/src/workflows/store-credit/steps/create-store-credit-accounts.d.ts +19 -0
- package/.medusa/server/src/workflows/store-credit/steps/create-store-credit-accounts.js +37 -0
- package/.medusa/server/src/workflows/store-credit/steps/credit-account.d.ts +20 -0
- package/.medusa/server/src/workflows/store-credit/steps/credit-account.js +31 -0
- package/.medusa/server/src/workflows/store-credit/steps/debit-account.d.ts +20 -0
- package/.medusa/server/src/workflows/store-credit/steps/debit-account.js +31 -0
- package/.medusa/server/src/workflows/store-credit/workflows/claim-store-credit-account.d.ts +91 -0
- package/.medusa/server/src/workflows/store-credit/workflows/claim-store-credit-account.js +170 -0
- package/.medusa/server/src/workflows/store-credit/workflows/create-store-credit-accounts.d.ts +50 -0
- package/.medusa/server/src/workflows/store-credit/workflows/create-store-credit-accounts.js +50 -0
- package/.medusa/server/src/workflows/store-credit/workflows/credit-accounts.d.ts +29 -0
- package/.medusa/server/src/workflows/store-credit/workflows/credit-accounts.js +32 -0
- package/.medusa/server/src/workflows/store-credit/workflows/credit-store-credit-account.d.ts +29 -0
- package/.medusa/server/src/workflows/store-credit/workflows/credit-store-credit-account.js +67 -0
- package/.medusa/server/src/workflows/store-credit/workflows/debit-accounts.d.ts +29 -0
- package/.medusa/server/src/workflows/store-credit/workflows/debit-accounts.js +32 -0
- package/.medusa/server/tailwind.config.d.ts +3 -0
- package/.medusa/server/tailwind.config.js +12 -0
- package/README.md +62 -0
- package/package.json +107 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.creditStoreCreditAccountWorkflow = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
const core_flows_1 = require("@medusajs/medusa/core-flows");
|
|
6
|
+
const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
|
|
7
|
+
const credit_account_1 = require("../steps/credit-account");
|
|
8
|
+
const validateStoreCreditAccountInputStep = (0, workflows_sdk_1.createStep)("validate-store-credit-account-input", async function (input) {
|
|
9
|
+
if (input.amount <= 0) {
|
|
10
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Amount must be greater than 0");
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* This workflow credits a specific store credit account with an amount. It validates
|
|
15
|
+
* that the amount is greater than zero and that the account exists before crediting.
|
|
16
|
+
*
|
|
17
|
+
* You can use this workflow within your own customizations or custom workflows,
|
|
18
|
+
* allowing you to wrap custom logic around crediting a store credit account.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* await creditStoreCreditAccountWorkflow(container)
|
|
22
|
+
* .run({
|
|
23
|
+
* input: {
|
|
24
|
+
* account_id: "sca_123",
|
|
25
|
+
* amount: 100,
|
|
26
|
+
* note: "Loyalty reward",
|
|
27
|
+
* reference: "order",
|
|
28
|
+
* reference_id: "order_123",
|
|
29
|
+
* },
|
|
30
|
+
* })
|
|
31
|
+
*
|
|
32
|
+
* @summary
|
|
33
|
+
*
|
|
34
|
+
* Credit a store credit account.
|
|
35
|
+
*/
|
|
36
|
+
exports.creditStoreCreditAccountWorkflow = (0, workflows_sdk_1.createWorkflow)("credit-store-credit-account", function (input) {
|
|
37
|
+
validateStoreCreditAccountInputStep(input);
|
|
38
|
+
const storeCreditAccountData = (0, core_flows_1.useQueryGraphStep)({
|
|
39
|
+
entity: "store_credit_account",
|
|
40
|
+
fields: ["id", "code", "customer_id", "currency_code", "balance"],
|
|
41
|
+
filters: { id: input.account_id },
|
|
42
|
+
options: { throwIfKeyNotFound: true },
|
|
43
|
+
});
|
|
44
|
+
const storeCreditAccount = (0, workflows_sdk_1.transform)({ storeCreditAccountData }, ({ storeCreditAccountData }) => {
|
|
45
|
+
return storeCreditAccountData.data[0];
|
|
46
|
+
});
|
|
47
|
+
const amount = (0, workflows_sdk_1.transform)({ input }, ({ input }) => {
|
|
48
|
+
return utils_1.MathBN.convert(input.amount);
|
|
49
|
+
});
|
|
50
|
+
const transactionInfo = (0, workflows_sdk_1.transform)({ input }, ({ input }) => {
|
|
51
|
+
return {
|
|
52
|
+
note: input.note || "",
|
|
53
|
+
reference: input.reference || "",
|
|
54
|
+
reference_id: input.reference_id || "",
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
(0, credit_account_1.creditAccountStep)([
|
|
58
|
+
{
|
|
59
|
+
account_id: storeCreditAccount.id,
|
|
60
|
+
amount: amount,
|
|
61
|
+
note: transactionInfo.note,
|
|
62
|
+
reference: transactionInfo.reference,
|
|
63
|
+
reference_id: transactionInfo.reference_id,
|
|
64
|
+
},
|
|
65
|
+
]);
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlZGl0LXN0b3JlLWNyZWRpdC1hY2NvdW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL3dvcmtmbG93cy9zdG9yZS1jcmVkaXQvd29ya2Zsb3dzL2NyZWRpdC1zdG9yZS1jcmVkaXQtYWNjb3VudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxxREFBZ0U7QUFDaEUsNERBQWdFO0FBQ2hFLHFFQUEwRjtBQUcxRiw0REFBNEQ7QUFPNUQsTUFBTSxtQ0FBbUMsR0FBRyxJQUFBLDBCQUFVLEVBQ3BELHFDQUFxQyxFQUNyQyxLQUFLLFdBQVcsS0FBcUM7SUFDbkQsSUFBSSxLQUFLLENBQUMsTUFBTSxJQUFJLENBQUMsRUFBRSxDQUFDO1FBQ3RCLE1BQU0sSUFBSSxtQkFBVyxDQUNuQixtQkFBVyxDQUFDLEtBQUssQ0FBQyxZQUFZLEVBQzlCLCtCQUErQixDQUNoQyxDQUFDO0lBQ0osQ0FBQztBQUNILENBQUMsQ0FDRixDQUFDO0FBRUY7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FzQkc7QUFDVSxRQUFBLGdDQUFnQyxHQUFHLElBQUEsOEJBQWMsRUFDNUQsNkJBQTZCLEVBQzdCLFVBQVUsS0FBNEM7SUFDcEQsbUNBQW1DLENBQUMsS0FBSyxDQUFDLENBQUM7SUFFM0MsTUFBTSxzQkFBc0IsR0FBRyxJQUFBLDhCQUFpQixFQUFDO1FBQy9DLE1BQU0sRUFBRSxzQkFBc0I7UUFDOUIsTUFBTSxFQUFFLENBQUMsSUFBSSxFQUFFLE1BQU0sRUFBRSxhQUFhLEVBQUUsZUFBZSxFQUFFLFNBQVMsQ0FBQztRQUNqRSxPQUFPLEVBQUUsRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLFVBQVUsRUFBRTtRQUNqQyxPQUFPLEVBQUUsRUFBRSxrQkFBa0IsRUFBRSxJQUFJLEVBQUU7S0FDdEMsQ0FBQyxDQUFDO0lBRUgsTUFBTSxrQkFBa0IsR0FBRyxJQUFBLHlCQUFTLEVBQ2xDLEVBQUUsc0JBQXNCLEVBQUUsRUFDMUIsQ0FBQyxFQUFFLHNCQUFzQixFQUFFLEVBQUUsRUFBRTtRQUM3QixPQUFPLHNCQUFzQixDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUN4QyxDQUFDLENBQ0YsQ0FBQztJQUVGLE1BQU0sTUFBTSxHQUFHLElBQUEseUJBQVMsRUFBQyxFQUFFLEtBQUssRUFBRSxFQUFFLENBQUMsRUFBRSxLQUFLLEVBQUUsRUFBRSxFQUFFO1FBQ2hELE9BQU8sY0FBTSxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQyxDQUFDLENBQUM7SUFFSCxNQUFNLGVBQWUsR0FBRyxJQUFBLHlCQUFTLEVBQUMsRUFBRSxLQUFLLEVBQUUsRUFBRSxDQUFDLEVBQUUsS0FBSyxFQUFFLEVBQUUsRUFBRTtRQUN6RCxPQUFPO1lBQ0wsSUFBSSxFQUFFLEtBQUssQ0FBQyxJQUFJLElBQUksRUFBRTtZQUN0QixTQUFTLEVBQUUsS0FBSyxDQUFDLFNBQVMsSUFBSSxFQUFFO1lBQ2hDLFlBQVksRUFBRSxLQUFLLENBQUMsWUFBWSxJQUFJLEVBQUU7U0FDdkMsQ0FBQztJQUNKLENBQUMsQ0FBQyxDQUFDO0lBRUgsSUFBQSxrQ0FBaUIsRUFBQztRQUNoQjtZQUNFLFVBQVUsRUFBRSxrQkFBa0IsQ0FBQyxFQUFFO1lBQ2pDLE1BQU0sRUFBRSxNQUFNO1lBQ2QsSUFBSSxFQUFFLGVBQWUsQ0FBQyxJQUFJO1lBQzFCLFNBQVMsRUFBRSxlQUFlLENBQUMsU0FBUztZQUNwQyxZQUFZLEVBQUUsZUFBZSxDQUFDLFlBQVk7U0FDM0M7S0FDRixDQUFDLENBQUM7QUFDTCxDQUFDLENBQ0YsQ0FBQyJ9
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ModuleDebitAccount } from "../../../types/store-credit";
|
|
2
|
+
/**
|
|
3
|
+
* Data for debiting one or more store credit accounts.
|
|
4
|
+
*/
|
|
5
|
+
export type DebitAccountsWorkflowInput = ModuleDebitAccount[];
|
|
6
|
+
/**
|
|
7
|
+
* This workflow debits one or more store credit accounts by creating debit transactions.
|
|
8
|
+
*
|
|
9
|
+
* You can use this workflow within your own customizations or custom workflows,
|
|
10
|
+
* allowing you to wrap custom logic around debiting store credit accounts.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const { result } = await debitAccountsWorkflow(container)
|
|
14
|
+
* .run({
|
|
15
|
+
* input: [
|
|
16
|
+
* {
|
|
17
|
+
* account_id: "sca_123",
|
|
18
|
+
* amount: 50,
|
|
19
|
+
* reference: "cart",
|
|
20
|
+
* reference_id: "cart_123",
|
|
21
|
+
* },
|
|
22
|
+
* ],
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* @summary
|
|
26
|
+
*
|
|
27
|
+
* Debit one or more store credit accounts.
|
|
28
|
+
*/
|
|
29
|
+
export declare const debitAccountsWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<DebitAccountsWorkflowInput, import("../../../types/store-credit").ModuleAccountTransaction[], []>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.debitAccountsWorkflow = void 0;
|
|
4
|
+
const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
|
|
5
|
+
const debit_account_1 = require("../steps/debit-account");
|
|
6
|
+
/**
|
|
7
|
+
* This workflow debits one or more store credit accounts by creating debit transactions.
|
|
8
|
+
*
|
|
9
|
+
* You can use this workflow within your own customizations or custom workflows,
|
|
10
|
+
* allowing you to wrap custom logic around debiting store credit accounts.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const { result } = await debitAccountsWorkflow(container)
|
|
14
|
+
* .run({
|
|
15
|
+
* input: [
|
|
16
|
+
* {
|
|
17
|
+
* account_id: "sca_123",
|
|
18
|
+
* amount: 50,
|
|
19
|
+
* reference: "cart",
|
|
20
|
+
* reference_id: "cart_123",
|
|
21
|
+
* },
|
|
22
|
+
* ],
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* @summary
|
|
26
|
+
*
|
|
27
|
+
* Debit one or more store credit accounts.
|
|
28
|
+
*/
|
|
29
|
+
exports.debitAccountsWorkflow = (0, workflows_sdk_1.createWorkflow)("debit-accounts", function (input) {
|
|
30
|
+
return new workflows_sdk_1.WorkflowResponse((0, debit_account_1.debitAccountStep)(input));
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGViaXQtYWNjb3VudHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvd29ya2Zsb3dzL3N0b3JlLWNyZWRpdC93b3JrZmxvd3MvZGViaXQtYWNjb3VudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEscUVBQXFGO0FBRXJGLDBEQUEwRDtBQU8xRDs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQXNCRztBQUNVLFFBQUEscUJBQXFCLEdBQUcsSUFBQSw4QkFBYyxFQUNqRCxnQkFBZ0IsRUFDaEIsVUFBVSxLQUFpQztJQUN6QyxPQUFPLElBQUksZ0NBQWdCLENBQUMsSUFBQSxnQ0FBZ0IsRUFBQyxLQUFLLENBQUMsQ0FBQyxDQUFDO0FBQ3ZELENBQUMsQ0FDRixDQUFDIn0=
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const ui_preset_1 = __importDefault(require("@medusajs/ui-preset"));
|
|
7
|
+
const config = {
|
|
8
|
+
content: ["./src/admin/**/*.{ts,tsx}"],
|
|
9
|
+
presets: [ui_preset_1.default],
|
|
10
|
+
};
|
|
11
|
+
exports.default = config;
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFpbHdpbmQuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdGFpbHdpbmQuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsb0VBQXdDO0FBR3hDLE1BQU0sTUFBTSxHQUFXO0lBQ3JCLE9BQU8sRUFBRSxDQUFDLDJCQUEyQixDQUFDO0lBQ3RDLE9BQU8sRUFBRSxDQUFDLG1CQUFNLENBQUM7Q0FDbEIsQ0FBQTtBQUVELGtCQUFlLE1BQU0sQ0FBQSJ9
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://www.medusajs.com">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/59018053/229103275-b5e482bb-4601-46e6-8142-244f531cebdb.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
|
|
6
|
+
<img alt="Medusa logo" src="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
<h1 align="center">
|
|
11
|
+
Medusa
|
|
12
|
+
</h1>
|
|
13
|
+
|
|
14
|
+
<h4 align="center">
|
|
15
|
+
<a href="https://docs.medusajs.com">Documentation</a> |
|
|
16
|
+
<a href="https://www.medusajs.com">Website</a>
|
|
17
|
+
</h4>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
Building blocks for digital commerce
|
|
21
|
+
</p>
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="https://github.com/medusajs/medusa/blob/master/CONTRIBUTING.md">
|
|
24
|
+
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" alt="PRs welcome!" />
|
|
25
|
+
</a>
|
|
26
|
+
<a href="https://www.producthunt.com/posts/medusa"><img src="https://img.shields.io/badge/Product%20Hunt-%231%20Product%20of%20the%20Day-%23DA552E" alt="Product Hunt"></a>
|
|
27
|
+
<a href="https://discord.gg/xpCwq3Kfn8">
|
|
28
|
+
<img src="https://img.shields.io/badge/chat-on%20discord-7289DA.svg" alt="Discord Chat" />
|
|
29
|
+
</a>
|
|
30
|
+
<a href="https://twitter.com/intent/follow?screen_name=medusajs">
|
|
31
|
+
<img src="https://img.shields.io/twitter/follow/medusajs.svg?label=Follow%20@medusajs" alt="Follow @medusajs" />
|
|
32
|
+
</a>
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
## Compatibility
|
|
36
|
+
|
|
37
|
+
This starter is compatible with versions >= 2.0.0 of `@medusajs/medusa`.
|
|
38
|
+
|
|
39
|
+
## Getting Started
|
|
40
|
+
|
|
41
|
+
Visit the [Quickstart Guide](https://docs.medusajs.com/learn) to set up a server.
|
|
42
|
+
|
|
43
|
+
Visit the [Docs](https://docs.medusajs.com/learn#get-started) to learn more about our system requirements.
|
|
44
|
+
|
|
45
|
+
## What is Medusa
|
|
46
|
+
|
|
47
|
+
Medusa is a set of commerce modules and tools that allow you to build rich, reliable, and performant commerce applications without reinventing core commerce logic. The modules can be customized and used to build advanced ecommerce stores, marketplaces, or any product that needs foundational commerce primitives. All modules are open-source and freely available on npm.
|
|
48
|
+
|
|
49
|
+
Learn more about [Medusa’s architecture](https://docs.medusajs.com/learn/advanced-development/architecture/overview) and [commerce modules](https://docs.medusajs.com/learn/basics/commerce-modules) in the Docs.
|
|
50
|
+
|
|
51
|
+
## Community & Contributions
|
|
52
|
+
|
|
53
|
+
The community and core team are available in [GitHub Discussions](https://github.com/medusajs/medusa/discussions), where you can ask for support, discuss roadmap, and share ideas.
|
|
54
|
+
|
|
55
|
+
Join our [Discord server](https://discord.com/invite/medusajs) to meet other community members.
|
|
56
|
+
|
|
57
|
+
## Other channels
|
|
58
|
+
|
|
59
|
+
- [GitHub Issues](https://github.com/medusajs/medusa/issues)
|
|
60
|
+
- [Twitter](https://twitter.com/medusajs)
|
|
61
|
+
- [LinkedIn](https://www.linkedin.com/company/medusajs)
|
|
62
|
+
- [Medusa Blog](https://medusajs.com/blog/)
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kshon/loyalty-plugin",
|
|
3
|
+
"version": "2.14.2",
|
|
4
|
+
"description": "Medusa Plugin: Loyalty - Gift Cards",
|
|
5
|
+
"author": "Medusa (https://medusajs.com)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/medusajs/medusa",
|
|
10
|
+
"directory": "packages/plugins/loyalty"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
".medusa/server"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": "./package.json",
|
|
17
|
+
"./modules/loyalty/*": "./.medusa/server/src/modules/loyalty/index.js",
|
|
18
|
+
"./.medusa/server/src/modules/loyalty": "./.medusa/server/src/modules/loyalty/index.js",
|
|
19
|
+
"./.medusa/server/src/modules/store-credit": "./.medusa/server/src/modules/store-credit/index.js",
|
|
20
|
+
"./.medusa/server/src/*": "./.medusa/server/src/**/*.js",
|
|
21
|
+
"./workflows": {
|
|
22
|
+
"import": "./.medusa/server/src/workflows/index.js",
|
|
23
|
+
"types": "./.medusa/server/src/workflows/index.d.ts",
|
|
24
|
+
"require": "./.medusa/server/src/workflows/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./types": {
|
|
27
|
+
"import": "./.medusa/server/src/types/index.js",
|
|
28
|
+
"types": "./.medusa/server/src/types/index.d.ts",
|
|
29
|
+
"require": "./.medusa/server/src/types/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./admin": {
|
|
32
|
+
"import": "./.medusa/server/src/admin/index.mjs",
|
|
33
|
+
"require": "./.medusa/server/src/admin/index.js",
|
|
34
|
+
"default": "./.medusa/server/src/admin/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"sqlite",
|
|
39
|
+
"postgres",
|
|
40
|
+
"typescript",
|
|
41
|
+
"ecommerce",
|
|
42
|
+
"headless",
|
|
43
|
+
"medusa",
|
|
44
|
+
"plugin"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "medusa plugin:build",
|
|
48
|
+
"dev": "medusa plugin:develop",
|
|
49
|
+
"prepare": "cross-env NODE_ENV=production yarn run build"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@kshon/admin-sdk": "2.14.2",
|
|
53
|
+
"@kshon/cli": "2.14.2",
|
|
54
|
+
"@kshon/framework": "2.14.2",
|
|
55
|
+
"@kshon/icons": "2.14.2",
|
|
56
|
+
"@kshon/test-utils": "2.14.2",
|
|
57
|
+
"@kshon/types": "2.14.2",
|
|
58
|
+
"@kshon/ui": "4.1.9",
|
|
59
|
+
"@kshon/ui-preset": "2.14.2",
|
|
60
|
+
"@swc/core": "1.5.7",
|
|
61
|
+
"@types/node": "^20.0.0",
|
|
62
|
+
"cross-env": "^7.0.3",
|
|
63
|
+
"ts-node": "^10.9.2",
|
|
64
|
+
"typescript": "^5.7.3"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"@kshon/admin-sdk": "2.14.2",
|
|
68
|
+
"@kshon/cli": "2.14.2",
|
|
69
|
+
"@kshon/framework": "2.14.2",
|
|
70
|
+
"@kshon/icons": "2.14.2",
|
|
71
|
+
"@kshon/test-utils": "2.14.2",
|
|
72
|
+
"@kshon/ui": "4.1.9",
|
|
73
|
+
"react": "^18.3.1",
|
|
74
|
+
"react-dom": "^18.3.1",
|
|
75
|
+
"react-router-dom": "6.30.3"
|
|
76
|
+
},
|
|
77
|
+
"peerDependenciesMeta": {
|
|
78
|
+
"@kshon/admin-sdk": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"@kshon/cli": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"@kshon/icons": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
87
|
+
"@kshon/test-utils": {
|
|
88
|
+
"optional": true
|
|
89
|
+
},
|
|
90
|
+
"@kshon/ui": {
|
|
91
|
+
"optional": true
|
|
92
|
+
},
|
|
93
|
+
"react": {
|
|
94
|
+
"optional": true
|
|
95
|
+
},
|
|
96
|
+
"react-dom": {
|
|
97
|
+
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"react-router-dom": {
|
|
100
|
+
"optional": true
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"engines": {
|
|
104
|
+
"node": ">=20"
|
|
105
|
+
},
|
|
106
|
+
"packageManager": "yarn@3.2.1"
|
|
107
|
+
}
|