@wtree/payload-ecommerce-coupon 3.77.2 → 3.77.4
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/README.md +22 -1
- package/dist/client/hooks.d.ts +1 -1
- package/dist/client/hooks.d.ts.map +1 -1
- package/dist/client/index.d.ts +6 -6
- package/dist/client/index.d.ts.map +1 -1
- package/dist/collections/createCouponsCollection.d.ts +2 -2
- package/dist/collections/createCouponsCollection.d.ts.map +1 -1
- package/dist/collections/createReferralCodesCollection.d.ts +2 -2
- package/dist/collections/createReferralCodesCollection.d.ts.map +1 -1
- package/dist/collections/createReferralProgramsCollection.d.ts +2 -2
- package/dist/collections/createReferralProgramsCollection.d.ts.map +1 -1
- package/dist/components/PartnerDashboard/EarningsSummary.d.ts +2 -2
- package/dist/components/PartnerDashboard/EarningsSummary.d.ts.map +1 -1
- package/dist/components/PartnerDashboard/RecentReferrals.d.ts +3 -3
- package/dist/components/PartnerDashboard/RecentReferrals.d.ts.map +1 -1
- package/dist/components/PartnerDashboard/ReferralCodes.d.ts +3 -3
- package/dist/components/PartnerDashboard/ReferralCodes.d.ts.map +1 -1
- package/dist/components/PartnerDashboard/ReferralPerformance.d.ts +2 -2
- package/dist/components/PartnerDashboard/ReferralPerformance.d.ts.map +1 -1
- package/dist/components/PartnerDashboard/index.d.ts +2 -2
- package/dist/components/PartnerDashboard/index.d.ts.map +1 -1
- package/dist/endpoints/applyCoupon.d.ts +2 -2
- package/dist/endpoints/applyCoupon.d.ts.map +1 -1
- package/dist/endpoints/partnerStats.d.ts +2 -2
- package/dist/endpoints/partnerStats.d.ts.map +1 -1
- package/dist/endpoints/validateCoupon.d.ts +2 -2
- package/dist/endpoints/validateCoupon.d.ts.map +1 -1
- package/dist/hooks/recalculateCart.d.ts +2 -2
- package/dist/hooks/recalculateCart.d.ts.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +228 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +228 -83
- package/dist/index.mjs.map +1 -1
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.d.ts.map +1 -1
- package/dist/types.d.ts +23 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utilities/calculateValues.d.ts +7 -1
- package/dist/utilities/calculateValues.d.ts.map +1 -1
- package/dist/utilities/getCartTotalWithDiscounts.d.ts.map +1 -1
- package/dist/utilities/migrateReferralRulesV2.d.ts.map +1 -1
- package/dist/utilities/pricing.d.ts.map +1 -1
- package/dist/utilities/pushTypeScriptProperties.d.ts +1 -1
- package/dist/utilities/pushTypeScriptProperties.d.ts.map +1 -1
- package/dist/utilities/recordCouponUsageForOrder.d.ts +2 -2
- package/dist/utilities/recordCouponUsageForOrder.d.ts.map +1 -1
- package/dist/utilities/sanitizePluginConfig.d.ts +1 -1
- package/dist/utilities/sanitizePluginConfig.d.ts.map +1 -1
- package/dist/utilities/userRoles.d.ts +25 -0
- package/dist/utilities/userRoles.d.ts.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,6 +27,8 @@ Production-ready coupon and referral system plugin for **Payload CMS** with seam
|
|
|
27
27
|
- ✅ **Commission Rules** – **Required.** At least one rule per program. Each rule supports:
|
|
28
28
|
- **Direct Basis**: Separate Reward (Partner) and Referee Reward (Customer).
|
|
29
29
|
- **Shared Basis**: Define a total "pot" (e.g., 20% of order) and split it (e.g., 50/50) between partner and customer.
|
|
30
|
+
- ✅ **Rule-level Minimum Order** – Optional `minOrderAmount` per commission rule, validated on apply/validate/recalculate
|
|
31
|
+
- ✅ **Fixed-only Mode** – Restrict `totalCommission.type` to fixed only via `referralConfig.allowedTotalCommissionTypes: ['fixed']`
|
|
30
32
|
- ✅ **Referrer/Referee inside each rule** – Partner gets commission, customer gets discount; type (percentage/fixed), value, and optional max cap per rule.
|
|
31
33
|
- ✅ **Partner Tracking** – Commission earnings and referral performance (credited when order is placed)
|
|
32
34
|
- ✅ **Auto-Generated Codes** – Unique referral codes for each partner
|
|
@@ -85,6 +87,8 @@ export default buildConfig({
|
|
|
85
87
|
singleCodePerCart: true, // Only one code per order
|
|
86
88
|
defaultPartnerSplit: 70, // 70% to partner
|
|
87
89
|
defaultCustomerSplit: 30, // 30% discount to customer
|
|
90
|
+
// Set fixed-only mode for production partner programs
|
|
91
|
+
allowedTotalCommissionTypes: ["fixed"], // Default: ["fixed", "percentage"]
|
|
88
92
|
},
|
|
89
93
|
|
|
90
94
|
// Custom admin panel groups
|
|
@@ -110,6 +114,13 @@ export default buildConfig({
|
|
|
110
114
|
isPartner: ({ req }) => req.user?.role === "partner",
|
|
111
115
|
},
|
|
112
116
|
|
|
117
|
+
// Optional: role resolver for custom user schemas
|
|
118
|
+
// roleConfig: {
|
|
119
|
+
// roleFieldPaths: ["role", "roles", "account.roles"],
|
|
120
|
+
// adminRoleValues: ["admin"],
|
|
121
|
+
// partnerRoleValues: ["partner", "affiliate"],
|
|
122
|
+
// },
|
|
123
|
+
|
|
113
124
|
// Optional: for per-customer coupon limit (defaults shown)
|
|
114
125
|
// orderIntegration: {
|
|
115
126
|
// ordersSlug: 'orders',
|
|
@@ -138,7 +149,7 @@ This will create collections for:
|
|
|
138
149
|
|
|
139
150
|
### 3. Setting Up Partner Role
|
|
140
151
|
|
|
141
|
-
To enable the partner dashboard and role-based access, add a `role` field to your Users collection:
|
|
152
|
+
To enable the partner dashboard and role-based access, add a `role` or `roles` field to your Users collection (or configure custom paths with `roleConfig`):
|
|
142
153
|
|
|
143
154
|
```typescript
|
|
144
155
|
// collections/Users.ts
|
|
@@ -175,6 +186,16 @@ export const Users: CollectionConfig = {
|
|
|
175
186
|
};
|
|
176
187
|
```
|
|
177
188
|
|
|
189
|
+
If your user schema stores roles in a custom structure, configure:
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
roleConfig: {
|
|
193
|
+
roleFieldPaths: ["role", "roles", "profile.accountRoles"],
|
|
194
|
+
adminRoleValues: ["admin"],
|
|
195
|
+
partnerRoleValues: ["partner", "affiliate"],
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
178
199
|
### 4. Record Usage When Order Is Placed
|
|
179
200
|
|
|
180
201
|
Coupon and referral **usage is not counted when a code is applied** to the cart. It is counted only when an **order is placed successfully** (e.g. paid). You must call the plugin when converting cart to order:
|
package/dist/client/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApplyCouponHook, ApplyCouponResponse, PartnerDashboardData } from
|
|
1
|
+
import type { ApplyCouponHook, ApplyCouponResponse, PartnerDashboardData } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Apply a coupon code to a cart
|
|
4
4
|
* @param options - Coupon code, cart ID, and customer email
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/client/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/client/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE3F;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAsD1F;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,CAAC,CAqD9B;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,WAAW,GAAE,MAAuC,GACnD,OAAO,CAAC,oBAAoB,CAAC,CA0B/B"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { PartnerDashboard } from
|
|
2
|
-
export { EarningsSummary } from
|
|
3
|
-
export { RecentReferrals } from
|
|
4
|
-
export { ReferralCodes } from
|
|
5
|
-
export { ReferralPerformance } from
|
|
6
|
-
export { useCouponCode, usePartnerStats, validateCouponCode } from
|
|
1
|
+
export { PartnerDashboard } from "../components/PartnerDashboard";
|
|
2
|
+
export { EarningsSummary } from "../components/PartnerDashboard/EarningsSummary";
|
|
3
|
+
export { RecentReferrals } from "../components/PartnerDashboard/RecentReferrals";
|
|
4
|
+
export { ReferralCodes } from "../components/PartnerDashboard/ReferralCodes";
|
|
5
|
+
export { ReferralPerformance } from "../components/PartnerDashboard/ReferralPerformance";
|
|
6
|
+
export { useCouponCode, usePartnerStats, validateCouponCode } from "./hooks";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CollectionConfig } from
|
|
2
|
-
import type { SanitizedCouponPluginOptions } from
|
|
1
|
+
import type { CollectionConfig } from "payload";
|
|
2
|
+
import type { SanitizedCouponPluginOptions } from "../types";
|
|
3
3
|
export declare const createCouponsCollection: (pluginConfig: SanitizedCouponPluginOptions) => CollectionConfig;
|
|
4
4
|
//# sourceMappingURL=createCouponsCollection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCouponsCollection.d.ts","sourceRoot":"","sources":["../../src/collections/createCouponsCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"createCouponsCollection.d.ts","sourceRoot":"","sources":["../../src/collections/createCouponsCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAE7D,eAAO,MAAM,uBAAuB,GAClC,cAAc,4BAA4B,KACzC,gBAyIF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CollectionConfig } from
|
|
2
|
-
import type { SanitizedCouponPluginOptions } from
|
|
1
|
+
import type { CollectionConfig } from "payload";
|
|
2
|
+
import type { SanitizedCouponPluginOptions } from "../types";
|
|
3
3
|
export declare const createReferralCodesCollection: (pluginConfig: SanitizedCouponPluginOptions) => CollectionConfig;
|
|
4
4
|
//# sourceMappingURL=createReferralCodesCollection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createReferralCodesCollection.d.ts","sourceRoot":"","sources":["../../src/collections/createReferralCodesCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"createReferralCodesCollection.d.ts","sourceRoot":"","sources":["../../src/collections/createReferralCodesCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAG7D,eAAO,MAAM,6BAA6B,GACxC,cAAc,4BAA4B,KACzC,gBA0LF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CollectionConfig } from
|
|
2
|
-
import type { SanitizedCouponPluginOptions } from
|
|
1
|
+
import type { CollectionConfig } from "payload";
|
|
2
|
+
import type { SanitizedCouponPluginOptions } from "../types";
|
|
3
3
|
export declare const createReferralProgramsCollection: (pluginConfig: SanitizedCouponPluginOptions) => CollectionConfig;
|
|
4
4
|
//# sourceMappingURL=createReferralProgramsCollection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createReferralProgramsCollection.d.ts","sourceRoot":"","sources":["../../src/collections/createReferralProgramsCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"createReferralProgramsCollection.d.ts","sourceRoot":"","sources":["../../src/collections/createReferralProgramsCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAwC7D,eAAO,MAAM,gCAAgC,GAC3C,cAAc,4BAA4B,KACzC,gBAiUF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EarningsSummary.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/EarningsSummary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"EarningsSummary.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/EarningsSummary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAUF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA4B1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import type { PartnerStats } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { PartnerStats } from "../../types";
|
|
3
3
|
export type RecentReferralsProps = {
|
|
4
|
-
referrals: PartnerStats[
|
|
4
|
+
referrals: PartnerStats["recentReferrals"];
|
|
5
5
|
currency: string;
|
|
6
6
|
};
|
|
7
7
|
export declare const RecentReferrals: React.FC<RecentReferralsProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecentReferrals.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/RecentReferrals.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"RecentReferrals.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/RecentReferrals.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAkBF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAoC1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import type { PartnerDashboardData } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { PartnerDashboardData } from "../../types";
|
|
3
3
|
export type ReferralCodesProps = {
|
|
4
|
-
codes: PartnerDashboardData[
|
|
4
|
+
codes: PartnerDashboardData["referralCodes"];
|
|
5
5
|
currency: string;
|
|
6
6
|
};
|
|
7
7
|
export declare const ReferralCodes: React.FC<ReferralCodesProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReferralCodes.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/ReferralCodes.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"ReferralCodes.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/ReferralCodes.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC;IAC7C,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAUF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA+DtD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReferralPerformance.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/ReferralPerformance.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"ReferralPerformance.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/ReferralPerformance.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA6ClE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AASnD,OAAO,cAAc,CAAC;AAEtB,MAAM,MAAM,qBAAqB,GAAG;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAqH5D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Endpoint, PayloadHandler } from
|
|
2
|
-
import type { SanitizedCouponPluginOptions } from
|
|
1
|
+
import type { Endpoint, PayloadHandler } from "payload";
|
|
2
|
+
import type { SanitizedCouponPluginOptions } from "../types";
|
|
3
3
|
type Args = {
|
|
4
4
|
pluginConfig: SanitizedCouponPluginOptions;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyCoupon.d.ts","sourceRoot":"","sources":["../../src/endpoints/applyCoupon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"applyCoupon.d.ts","sourceRoot":"","sources":["../../src/endpoints/applyCoupon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAQ7D,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAC;CAC5C,CAAC;AAcF,eAAO,MAAM,kBAAkB,GAC5B,kBAAkB,IAAI,KAAG,cAyFzB,CAAC;AA4TJ,eAAO,MAAM,mBAAmB,GAAI,kBAAkB,IAAI,KAAG,QAI3D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Endpoint, PayloadHandler } from
|
|
2
|
-
import type { SanitizedCouponPluginOptions } from
|
|
1
|
+
import type { Endpoint, PayloadHandler } from "payload";
|
|
2
|
+
import type { SanitizedCouponPluginOptions } from "../types";
|
|
3
3
|
type Args = {
|
|
4
4
|
pluginConfig: SanitizedCouponPluginOptions;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partnerStats.d.ts","sourceRoot":"","sources":["../../src/endpoints/partnerStats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"partnerStats.d.ts","sourceRoot":"","sources":["../../src/endpoints/partnerStats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,KAAK,EAAsC,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAGjG,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC7B,kBAAkB,IAAI,KAAG,cA6KzB,CAAC;AAEJ,eAAO,MAAM,oBAAoB,GAAI,kBAAkB,IAAI,KAAG,QAI5D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Endpoint, PayloadHandler } from
|
|
2
|
-
import type { SanitizedCouponPluginOptions } from
|
|
1
|
+
import type { Endpoint, PayloadHandler } from "payload";
|
|
2
|
+
import type { SanitizedCouponPluginOptions } from "../types";
|
|
3
3
|
type Args = {
|
|
4
4
|
pluginConfig: SanitizedCouponPluginOptions;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateCoupon.d.ts","sourceRoot":"","sources":["../../src/endpoints/validateCoupon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"validateCoupon.d.ts","sourceRoot":"","sources":["../../src/endpoints/validateCoupon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAO7D,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAC/B,kBAAkB,IAAI,KAAG,cAkCzB,CAAC;AA4RJ,eAAO,MAAM,sBAAsB,GAAI,kBAAkB,IAAI,KAAG,QAI9D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CollectionBeforeChangeHook } from
|
|
2
|
-
import type { SanitizedCouponPluginOptions } from
|
|
1
|
+
import type { CollectionBeforeChangeHook } from "payload";
|
|
2
|
+
import type { SanitizedCouponPluginOptions } from "../types";
|
|
3
3
|
export declare const recalculateCartHook: (pluginConfig: SanitizedCouponPluginOptions) => CollectionBeforeChangeHook;
|
|
4
4
|
//# sourceMappingURL=recalculateCart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recalculateCart.d.ts","sourceRoot":"","sources":["../../src/hooks/recalculateCart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"recalculateCart.d.ts","sourceRoot":"","sources":["../../src/hooks/recalculateCart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAS7D,eAAO,MAAM,mBAAmB,GAC7B,cAAc,4BAA4B,KAAG,0BA6N7C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { createCouponsCollection } from
|
|
2
|
-
import { createReferralCodesCollection } from
|
|
3
|
-
import { createReferralProgramsCollection } from
|
|
4
|
-
import { payloadEcommerceCouponPlugin } from
|
|
5
|
-
export { useCouponCode, usePartnerStats, validateCouponCode } from
|
|
6
|
-
export { calculateCommissionAndDiscount } from
|
|
7
|
-
export { getCartTotalWithDiscounts } from
|
|
8
|
-
export { recordCouponUsageForOrder } from
|
|
1
|
+
import { createCouponsCollection } from "./collections/createCouponsCollection";
|
|
2
|
+
import { createReferralCodesCollection } from "./collections/createReferralCodesCollection";
|
|
3
|
+
import { createReferralProgramsCollection } from "./collections/createReferralProgramsCollection";
|
|
4
|
+
import { payloadEcommerceCouponPlugin } from "./plugin";
|
|
5
|
+
export { useCouponCode, usePartnerStats, validateCouponCode } from "./client/hooks";
|
|
6
|
+
export { calculateCommissionAndDiscount, getProgramMinimumOrderAmount, } from "./utilities/calculateValues";
|
|
7
|
+
export { getCartTotalWithDiscounts } from "./utilities/getCartTotalWithDiscounts";
|
|
8
|
+
export { recordCouponUsageForOrder } from "./utilities/recordCouponUsageForOrder";
|
|
9
9
|
export { createCouponsCollection, createReferralCodesCollection, createReferralProgramsCollection, payloadEcommerceCouponPlugin as payloadEcommerceCoupon, };
|
|
10
|
-
export type { AdminGroupConfig, ApplyCouponHook, ApplyCouponResponse, CouponPluginAccess, CouponPluginCollections, CouponPluginOptions, OrderIntegrationConfig, PartnerDashboardConfig, PartnerDashboardData, PartnerStats, ReferralProgramConfig, } from
|
|
11
|
-
export type { CartLike } from
|
|
10
|
+
export type { AdminGroupConfig, ApplyCouponHook, ApplyCouponResponse, CouponPluginAccess, CouponPluginCollections, CouponPluginOptions, OrderIntegrationConfig, PartnerDashboardConfig, PartnerDashboardData, PartnerStats, ReferralProgramConfig, RoleConfig, } from "./types";
|
|
11
|
+
export type { CartLike } from "./utilities/getCartTotalWithDiscounts";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AAClG,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,IAAI,sBAAsB,GACvD,CAAC;AAEF,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,EACrB,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC"}
|