@wtree/payload-ecommerce-coupon 3.72.2 β 3.76.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -75
- package/dist/endpoints/applyCoupon.d.ts.map +1 -1
- package/dist/endpoints/validateCoupon.d.ts.map +1 -1
- package/dist/hooks/recalculateCart.d.ts +4 -0
- package/dist/hooks/recalculateCart.d.ts.map +1 -0
- package/dist/index.js +289 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +288 -101
- package/dist/index.mjs.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/utilities/calculateValues.d.ts +13 -0
- package/dist/utilities/calculateValues.d.ts.map +1 -0
- package/dist/utilities/pricing.d.ts +19 -0
- package/dist/utilities/pricing.d.ts.map +1 -0
- package/package.json +15 -18
package/README.md
CHANGED
|
@@ -9,11 +9,13 @@ Production-ready coupon and referral system plugin for **Payload CMS** with seam
|
|
|
9
9
|
## π Features
|
|
10
10
|
|
|
11
11
|
### **System Modes**
|
|
12
|
+
|
|
12
13
|
- **Coupon Mode** (`enableReferrals: false`) β Traditional discount codes
|
|
13
14
|
- **Referral Mode** (`enableReferrals: true`) β Partner commissions + customer discounts
|
|
14
15
|
- **Hybrid Mode** (`enableReferrals: true` + `referralConfig.allowBothSystems: true`) β Both systems active
|
|
15
16
|
|
|
16
17
|
### **Coupon Mode Features**
|
|
18
|
+
|
|
17
19
|
- β
**Flexible Discounts** β Percentage or fixed amount discounts (all amounts rounded to 2 decimals)
|
|
18
20
|
- β
**Usage Controls** β Global usage limit; usage is counted when an **order is placed** (not on apply)
|
|
19
21
|
- β
**Per-customer limit** β Optional limit per customer (requires `customerEmail` when applying)
|
|
@@ -21,7 +23,10 @@ Production-ready coupon and referral system plugin for **Payload CMS** with seam
|
|
|
21
23
|
- β
**Auto-Application** β Seamless cart integration; cart total is reduced when a code is applied
|
|
22
24
|
|
|
23
25
|
### **Referral Mode Features**
|
|
24
|
-
|
|
26
|
+
|
|
27
|
+
- β
**Commission Rules** β **Required.** At least one rule per program. Each rule supports:
|
|
28
|
+
- **Direct Basis**: Separate Reward (Partner) and Referee Reward (Customer).
|
|
29
|
+
- **Shared Basis**: Define a total "pot" (e.g., 20% of order) and split it (e.g., 50/50) between partner and customer.
|
|
25
30
|
- β
**Referrer/Referee inside each rule** β Partner gets commission, customer gets discount; type (percentage/fixed), value, and optional max cap per rule.
|
|
26
31
|
- β
**Partner Tracking** β Commission earnings and referral performance (credited when order is placed)
|
|
27
32
|
- β
**Auto-Generated Codes** β Unique referral codes for each partner
|
|
@@ -29,11 +34,13 @@ Production-ready coupon and referral system plugin for **Payload CMS** with seam
|
|
|
29
34
|
- β
**Single Code Per Cart** β Enforce one code (coupon or referral) per order
|
|
30
35
|
|
|
31
36
|
### **Core Features**
|
|
37
|
+
|
|
32
38
|
- β
**REST API** β Validate, apply, and record usage when order is placed
|
|
33
39
|
- β
**Frontend Hooks** β `useCouponCode()`, `usePartnerStats()`, `validateCouponCode()` for React/Next.js
|
|
34
40
|
- β
**Auto-Integration** β Extends carts/orders automatically
|
|
35
41
|
- β
**Usage on Order** β Coupon/referral usage and partner earnings are recorded when an order is placed (not when code is applied)
|
|
36
42
|
- β
**Cart total helper** β `getCartTotalWithDiscounts(cart)` for host app cart hooks so totals respect discounts
|
|
43
|
+
- β
**Automatic Cart Recalculation** β Hook ensures commissions and discounts are recalculated whenever cart items change
|
|
37
44
|
- β
**Type-Safe** β Full TypeScript support
|
|
38
45
|
- β
**Access Control** β Role-based permissions with partner role support
|
|
39
46
|
- β
**Custom Admin Groups** β Separate "Coupons" and "Referrals" categories
|
|
@@ -71,7 +78,7 @@ export default buildConfig({
|
|
|
71
78
|
enabled: true,
|
|
72
79
|
enableReferrals: true, // Enable referral system
|
|
73
80
|
defaultCurrency: 'USD',
|
|
74
|
-
|
|
81
|
+
|
|
75
82
|
// Referral-specific configuration
|
|
76
83
|
referralConfig: {
|
|
77
84
|
allowBothSystems: false, // Set true to allow both coupons and referrals
|
|
@@ -79,13 +86,13 @@ export default buildConfig({
|
|
|
79
86
|
defaultPartnerSplit: 70, // 70% to partner
|
|
80
87
|
defaultCustomerSplit: 30, // 30% discount to customer
|
|
81
88
|
},
|
|
82
|
-
|
|
89
|
+
|
|
83
90
|
// Custom admin panel groups
|
|
84
91
|
adminGroups: {
|
|
85
92
|
couponsGroup: 'Coupons',
|
|
86
93
|
referralsGroup: 'Referrals',
|
|
87
94
|
},
|
|
88
|
-
|
|
95
|
+
|
|
89
96
|
// Partner dashboard configuration
|
|
90
97
|
partnerDashboard: {
|
|
91
98
|
enabled: true,
|
|
@@ -94,7 +101,7 @@ export default buildConfig({
|
|
|
94
101
|
showRecentReferrals: true,
|
|
95
102
|
showCommissionBreakdown: true,
|
|
96
103
|
},
|
|
97
|
-
|
|
104
|
+
|
|
98
105
|
// Access control
|
|
99
106
|
access: {
|
|
100
107
|
canUseCoupons: () => true,
|
|
@@ -124,6 +131,7 @@ npm run payload migrate
|
|
|
124
131
|
```
|
|
125
132
|
|
|
126
133
|
This will create collections for:
|
|
134
|
+
|
|
127
135
|
- **Coupons** β Manage discount codes (in "Coupons" group)
|
|
128
136
|
- **Referral Programs** β Set up partner commission structures (in "Referrals" group)
|
|
129
137
|
- **Referral Codes** β Track generated referral links (in "Referrals" group)
|
|
@@ -196,13 +204,16 @@ if (doc.paymentStatus === 'paid' && (doc.appliedCoupon || doc.appliedReferralCod
|
|
|
196
204
|
### 4.5 Coupon usage rules and cart total
|
|
197
205
|
|
|
198
206
|
**Usage rule**
|
|
207
|
+
|
|
199
208
|
- A customer can use a coupon until the couponβs **global usage limit** or **expiry date** (usage is counted when the order is placed, not when the code is applied).
|
|
200
209
|
- **Optional per-customer limit:** If you set **Per customer limit** on a coupon, the customer must provide their email when applying (e.g. `customerEmail` in the apply request). The coupon is rejected once they have that many **paid** orders with that coupon. You can pass `customerEmail` when validating so the UI can show βlimit reachedβ before apply.
|
|
201
210
|
|
|
202
211
|
**Monetary values**
|
|
212
|
+
|
|
203
213
|
- All discount, commission, and total values are rounded to **2 decimal places**.
|
|
204
214
|
|
|
205
215
|
**Cart total in your app**
|
|
216
|
+
|
|
206
217
|
- The plugin writes the reduced `total` when a code is applied. If your host app recalculates the cart total (e.g. in a `beforeChange` hook when items change), use the formula **total = subtotal β discountAmount β customerDiscount** so the discount is not overwritten. Use the provided helper in your Carts collection:
|
|
207
218
|
|
|
208
219
|
```typescript
|
|
@@ -274,7 +285,7 @@ import { usePartnerStats } from '@wtree/payload-ecommerce-coupon'
|
|
|
274
285
|
// Build custom dashboard with the hook
|
|
275
286
|
function CustomPartnerDashboard() {
|
|
276
287
|
const [data, setData] = useState(null)
|
|
277
|
-
|
|
288
|
+
|
|
278
289
|
useEffect(() => {
|
|
279
290
|
const fetchStats = async () => {
|
|
280
291
|
const result = await usePartnerStats()
|
|
@@ -293,7 +304,7 @@ function CustomPartnerDashboard() {
|
|
|
293
304
|
<p>Total: ${data.stats.totalEarnings}</p>
|
|
294
305
|
<p>Pending: ${data.stats.pendingEarnings}</p>
|
|
295
306
|
<p>Paid: ${data.stats.paidEarnings}</p>
|
|
296
|
-
|
|
307
|
+
|
|
297
308
|
<h2>Your Referral Codes</h2>
|
|
298
309
|
{data.referralCodes.map(code => (
|
|
299
310
|
<div key={code.id}>
|
|
@@ -311,12 +322,15 @@ function CustomPartnerDashboard() {
|
|
|
311
322
|
### **Choosing Your Mode**
|
|
312
323
|
|
|
313
324
|
#### **Coupon Mode** (`enableReferrals: false`)
|
|
325
|
+
|
|
314
326
|
Best for traditional discount campaigns, seasonal sales, and customer loyalty programs.
|
|
315
327
|
|
|
316
328
|
#### **Referral Mode** (`enableReferrals: true`)
|
|
329
|
+
|
|
317
330
|
Best for affiliate marketing, partner programs, and customer acquisition through referrals.
|
|
318
331
|
|
|
319
332
|
#### **Hybrid Mode** (`enableReferrals: true` + `allowBothSystems: true`)
|
|
333
|
+
|
|
320
334
|
Best when you need both traditional coupons AND partner referrals, but want to enforce only one code per order.
|
|
321
335
|
|
|
322
336
|
### **Setting Up Coupon Mode**
|
|
@@ -349,6 +363,7 @@ Best when you need both traditional coupons AND partner referrals, but want to e
|
|
|
349
363
|
- **Referee (customer)** receives a **discount** β applied to the order; stored on cart/order as `customerDiscount`.
|
|
350
364
|
|
|
351
365
|
#### **Example: Commission Rules with Split**
|
|
366
|
+
|
|
352
367
|
- **Order Total**: $100 (Electronics category)
|
|
353
368
|
- **Total Commission**: 15% = $15
|
|
354
369
|
- **Partner Share**: 70% of $15 = $10.50 (commission to referrer)
|
|
@@ -366,6 +381,7 @@ Best when you need both traditional coupons AND partner referrals, but want to e
|
|
|
366
381
|
### **Coupon/Referral Endpoints**
|
|
367
382
|
|
|
368
383
|
#### POST /api/coupons/validate
|
|
384
|
+
|
|
369
385
|
Validate a code without applying it. Optionally pass `customerEmail` to check per-customer limit for coupons that have one.
|
|
370
386
|
|
|
371
387
|
```bash
|
|
@@ -378,6 +394,7 @@ curl -X POST http://localhost:3000/api/coupons/validate \
|
|
|
378
394
|
```
|
|
379
395
|
|
|
380
396
|
#### POST /api/coupons/apply
|
|
397
|
+
|
|
381
398
|
Apply a code to a cart. **Does not** increment usage; usage is recorded when you call the record-order-usage endpoint for a placed order. For coupons with **per-customer limit**, include `customerEmail` so the limit can be enforced.
|
|
382
399
|
|
|
383
400
|
```bash
|
|
@@ -390,6 +407,7 @@ curl -X POST http://localhost:3000/api/coupons/apply \
|
|
|
390
407
|
```
|
|
391
408
|
|
|
392
409
|
#### POST /api/coupons/record-order-usage
|
|
410
|
+
|
|
393
411
|
Record coupon and referral usage for a successfully placed order. Call this once per order when the order is paid/completed (e.g. from your Orders `afterChange` hook).
|
|
394
412
|
|
|
395
413
|
**Request body:** `{ "orderId": "string" }`
|
|
@@ -405,6 +423,7 @@ curl -X POST http://localhost:3000/api/coupons/record-order-usage \
|
|
|
405
423
|
### **Partner Stats Endpoint**
|
|
406
424
|
|
|
407
425
|
#### GET /api/referrals/partner-stats
|
|
426
|
+
|
|
408
427
|
Get partner dashboard data (requires authentication).
|
|
409
428
|
|
|
410
429
|
```bash
|
|
@@ -413,6 +432,7 @@ curl -X GET http://localhost:3000/api/referrals/partner-stats \
|
|
|
413
432
|
```
|
|
414
433
|
|
|
415
434
|
**Response:**
|
|
435
|
+
|
|
416
436
|
```json
|
|
417
437
|
{
|
|
418
438
|
"success": true,
|
|
@@ -444,67 +464,67 @@ curl -X GET http://localhost:3000/api/referrals/partner-stats \
|
|
|
444
464
|
|
|
445
465
|
```typescript
|
|
446
466
|
export type CouponPluginOptions = {
|
|
447
|
-
enabled?: boolean
|
|
448
|
-
enableReferrals?: boolean
|
|
467
|
+
enabled?: boolean // Enable/disable the plugin (default: true)
|
|
468
|
+
enableReferrals?: boolean // Enable referral system (default: false)
|
|
449
469
|
allowStackWithOtherCoupons?: boolean // Allow multiple coupons (default: false)
|
|
450
|
-
defaultCurrency?: string
|
|
451
|
-
autoIntegrate?: boolean
|
|
452
|
-
|
|
470
|
+
defaultCurrency?: string // Currency code (default: 'USD')
|
|
471
|
+
autoIntegrate?: boolean // Auto-extend carts/orders (default: true)
|
|
472
|
+
|
|
453
473
|
collections?: {
|
|
454
|
-
couponsSlug?: string
|
|
455
|
-
referralProgramsSlug?: string
|
|
456
|
-
referralCodesSlug?: string
|
|
457
|
-
|
|
474
|
+
couponsSlug?: string // Default: 'coupons'
|
|
475
|
+
referralProgramsSlug?: string // Default: 'referral-programs'
|
|
476
|
+
referralCodesSlug?: string // Default: 'referral-codes'
|
|
477
|
+
|
|
458
478
|
/** Override the default coupons collection configuration */
|
|
459
479
|
couponsCollectionOverride?: (params: { defaultCollection: any }) => any | Promise<any>
|
|
460
|
-
|
|
480
|
+
|
|
461
481
|
/** Override the default referral programs collection configuration */
|
|
462
482
|
referralProgramsCollectionOverride?: (params: { defaultCollection: any }) => any | Promise<any>
|
|
463
|
-
|
|
483
|
+
|
|
464
484
|
/** Override the default referral codes collection configuration */
|
|
465
485
|
referralCodesCollectionOverride?: (params: { defaultCollection: any }) => any | Promise<any>
|
|
466
486
|
}
|
|
467
|
-
|
|
487
|
+
|
|
468
488
|
endpoints?: {
|
|
469
|
-
applyCoupon?: string
|
|
470
|
-
validateCoupon?: string
|
|
471
|
-
partnerStats?: string
|
|
472
|
-
recordOrderUsage?: string
|
|
489
|
+
applyCoupon?: string // Default: '/coupons/apply'
|
|
490
|
+
validateCoupon?: string // Default: '/coupons/validate'
|
|
491
|
+
partnerStats?: string // Default: '/referrals/partner-stats'
|
|
492
|
+
recordOrderUsage?: string // Default: '/coupons/record-order-usage'
|
|
473
493
|
}
|
|
474
|
-
|
|
494
|
+
|
|
475
495
|
access?: {
|
|
476
|
-
canUseCoupons?: Access
|
|
477
|
-
canUseReferrals?: Access
|
|
478
|
-
isAdmin?: Access
|
|
479
|
-
isPartner?: Access
|
|
496
|
+
canUseCoupons?: Access // Who can use coupons
|
|
497
|
+
canUseReferrals?: Access // Who can use referrals
|
|
498
|
+
isAdmin?: Access // Who can manage codes/programs
|
|
499
|
+
isPartner?: Access // Who has partner access
|
|
480
500
|
}
|
|
481
|
-
|
|
501
|
+
|
|
482
502
|
referralConfig?: {
|
|
483
|
-
allowBothSystems?: boolean
|
|
484
|
-
singleCodePerCart?: boolean
|
|
485
|
-
defaultPartnerSplit?: number
|
|
486
|
-
defaultCustomerSplit?: number
|
|
503
|
+
allowBothSystems?: boolean // Allow coupons + referrals (default: false)
|
|
504
|
+
singleCodePerCart?: boolean // One code per order (default: true)
|
|
505
|
+
defaultPartnerSplit?: number // Default partner % (default: 70)
|
|
506
|
+
defaultCustomerSplit?: number // Default customer % (default: 30)
|
|
487
507
|
}
|
|
488
|
-
|
|
508
|
+
|
|
489
509
|
adminGroups?: {
|
|
490
|
-
couponsGroup?: string
|
|
491
|
-
referralsGroup?: string
|
|
510
|
+
couponsGroup?: string // Admin group for coupons (default: 'Coupons')
|
|
511
|
+
referralsGroup?: string // Admin group for referrals (default: 'Referrals')
|
|
492
512
|
}
|
|
493
|
-
|
|
513
|
+
|
|
494
514
|
partnerDashboard?: {
|
|
495
|
-
enabled?: boolean
|
|
496
|
-
showEarningsSummary?: boolean
|
|
497
|
-
showReferralPerformance?: boolean
|
|
498
|
-
showRecentReferrals?: boolean
|
|
499
|
-
showCommissionBreakdown?: boolean
|
|
515
|
+
enabled?: boolean // Enable dashboard (default: true)
|
|
516
|
+
showEarningsSummary?: boolean // Show earnings widget (default: true)
|
|
517
|
+
showReferralPerformance?: boolean // Show performance widget (default: true)
|
|
518
|
+
showRecentReferrals?: boolean // Show recent referrals (default: true)
|
|
519
|
+
showCommissionBreakdown?: boolean // Show breakdown (default: true)
|
|
500
520
|
}
|
|
501
521
|
|
|
502
522
|
/** Optional: for per-customer coupon limit (query paid orders by customer) */
|
|
503
523
|
orderIntegration?: {
|
|
504
|
-
ordersSlug?: string
|
|
505
|
-
orderCustomerEmailField?: string
|
|
506
|
-
orderPaymentStatusField?: string
|
|
507
|
-
orderPaidStatusValue?: string
|
|
524
|
+
ordersSlug?: string // Default: 'orders'
|
|
525
|
+
orderCustomerEmailField?: string // Default: 'customerEmail'
|
|
526
|
+
orderPaymentStatusField?: string // Default: 'paymentStatus'
|
|
527
|
+
orderPaidStatusValue?: string // Default: 'paid'
|
|
508
528
|
}
|
|
509
529
|
}
|
|
510
530
|
```
|
|
@@ -542,7 +562,7 @@ payloadEcommerceCoupon({
|
|
|
542
562
|
},
|
|
543
563
|
}
|
|
544
564
|
},
|
|
545
|
-
|
|
565
|
+
|
|
546
566
|
// Override referral programs collection
|
|
547
567
|
referralProgramsCollectionOverride: ({ defaultCollection }) => {
|
|
548
568
|
return {
|
|
@@ -553,7 +573,7 @@ payloadEcommerceCoupon({
|
|
|
553
573
|
},
|
|
554
574
|
}
|
|
555
575
|
},
|
|
556
|
-
|
|
576
|
+
|
|
557
577
|
// Override referral codes collection
|
|
558
578
|
referralCodesCollectionOverride: async ({ defaultCollection }) => {
|
|
559
579
|
return {
|
|
@@ -581,13 +601,13 @@ payloadEcommerceCoupon({
|
|
|
581
601
|
access: {
|
|
582
602
|
// Anyone can use coupons
|
|
583
603
|
canUseCoupons: () => true,
|
|
584
|
-
|
|
604
|
+
|
|
585
605
|
// Only authenticated users can use referrals
|
|
586
606
|
canUseReferrals: ({ req }) => Boolean(req.user),
|
|
587
|
-
|
|
607
|
+
|
|
588
608
|
// Only admins can manage
|
|
589
609
|
isAdmin: ({ req }) => req.user?.role === 'admin',
|
|
590
|
-
|
|
610
|
+
|
|
591
611
|
// Partner role check (supports both single role and array)
|
|
592
612
|
isPartner: ({ req }) => {
|
|
593
613
|
const user = req.user
|
|
@@ -607,17 +627,17 @@ payloadEcommerceCoupon({
|
|
|
607
627
|
```typescript
|
|
608
628
|
import {
|
|
609
629
|
payloadEcommerceCoupon,
|
|
610
|
-
|
|
630
|
+
|
|
611
631
|
// Collection creation functions
|
|
612
632
|
createCouponsCollection,
|
|
613
633
|
createReferralCodesCollection,
|
|
614
634
|
createReferralProgramsCollection,
|
|
615
|
-
|
|
635
|
+
|
|
616
636
|
// Frontend hooks
|
|
617
637
|
useCouponCode,
|
|
618
638
|
validateCouponCode,
|
|
619
639
|
usePartnerStats,
|
|
620
|
-
|
|
640
|
+
|
|
621
641
|
// Server-only: record usage when order is placed
|
|
622
642
|
recordCouponUsageForOrder,
|
|
623
643
|
} from '@wtree/payload-ecommerce-coupon'
|
|
@@ -658,17 +678,22 @@ The plugin provides hooks and (when using the source) React components for partn
|
|
|
658
678
|
### **Common Issues**
|
|
659
679
|
|
|
660
680
|
#### **"A code has already been applied to this cart"**
|
|
681
|
+
|
|
661
682
|
This occurs when `singleCodePerCart: true` and a code is already applied.
|
|
683
|
+
|
|
662
684
|
- Solution: Remove the existing code before applying a new one, or set `singleCodePerCart: false`
|
|
663
685
|
|
|
664
686
|
#### **Partner can't see their referral codes**
|
|
687
|
+
|
|
665
688
|
- Ensure the user has `role: 'partner'` or `roles: ['partner']`
|
|
666
689
|
- Check the `isPartner` access control function
|
|
667
690
|
|
|
668
691
|
#### **Usage count or partner earnings not updating**
|
|
692
|
+
|
|
669
693
|
- Usage is **not** incremented when a code is applied to the cart. Call **record-order-usage** (or `recordCouponUsageForOrder`) when an order is placed/paid. See [Record usage when order is placed](#4-record-usage-when-order-is-placed).
|
|
670
694
|
|
|
671
695
|
#### **Commission not calculating correctly**
|
|
696
|
+
|
|
672
697
|
- Ensure at least one **Commission Rule** exists and each rule has **Referrer Reward** and **Referee Reward** set
|
|
673
698
|
- Verify cart has valid `subtotal` or `total` and items match ruleβs appliesTo (all / categories / products)
|
|
674
699
|
|
|
@@ -676,30 +701,30 @@ This occurs when `singleCodePerCart: true` and a code is already applied.
|
|
|
676
701
|
|
|
677
702
|
The following features are planned for future releases:
|
|
678
703
|
|
|
679
|
-
| Feature
|
|
680
|
-
|
|
681
|
-
| Multi-tier commissions | π Planned | Support for tiered commission rates based on performance
|
|
682
|
-
| Automatic payouts
|
|
683
|
-
| Referral analytics
|
|
684
|
-
| Email notifications
|
|
685
|
-
| Custom code generation | π Planned | Allow partners to create custom branded codes
|
|
686
|
-
| Fraud detection
|
|
687
|
-
| Bulk code import
|
|
688
|
-
| A/B testing
|
|
704
|
+
| Feature | Status | Description |
|
|
705
|
+
| ---------------------- | ---------- | ---------------------------------------------------------------- |
|
|
706
|
+
| Multi-tier commissions | π Planned | Support for tiered commission rates based on performance |
|
|
707
|
+
| Automatic payouts | π Planned | Integration with payment providers for automatic partner payouts |
|
|
708
|
+
| Referral analytics | π Planned | Advanced analytics and reporting dashboard |
|
|
709
|
+
| Email notifications | π Planned | Automated emails for referral events |
|
|
710
|
+
| Custom code generation | π Planned | Allow partners to create custom branded codes |
|
|
711
|
+
| Fraud detection | π Planned | Automatic detection of suspicious referral patterns |
|
|
712
|
+
| Bulk code import | π Planned | Import coupons/codes from CSV |
|
|
713
|
+
| A/B testing | π Planned | Test different commission structures |
|
|
689
714
|
|
|
690
715
|
### **Comparison with Other Solutions**
|
|
691
716
|
|
|
692
|
-
| Feature
|
|
693
|
-
|
|
694
|
-
| Payload CMS Integration | β
Native
|
|
695
|
-
| Coupon System
|
|
696
|
-
| Referral System
|
|
697
|
-
| Partner Dashboard
|
|
698
|
-
| Commission Rules
|
|
699
|
-
| Single Code Enforcement | β
|
|
700
|
-
| TypeScript Support
|
|
701
|
-
| Self-Hosted
|
|
702
|
-
| Monthly Cost
|
|
717
|
+
| Feature | This Plugin | ReferralCandy | Refersion | Custom Build |
|
|
718
|
+
| ----------------------- | ----------- | ------------- | --------- | ------------ |
|
|
719
|
+
| Payload CMS Integration | β
Native | β | β | β οΈ Manual |
|
|
720
|
+
| Coupon System | β
| β | β | β οΈ Manual |
|
|
721
|
+
| Referral System | β
| β
| β
| β οΈ Manual |
|
|
722
|
+
| Partner Dashboard | β
| β
| β
| β οΈ Manual |
|
|
723
|
+
| Commission Rules | β
| β οΈ Limited | β
| β οΈ Manual |
|
|
724
|
+
| Single Code Enforcement | β
| β | β | β οΈ Manual |
|
|
725
|
+
| TypeScript Support | β
| β | β | β οΈ Varies |
|
|
726
|
+
| Self-Hosted | β
| β | β | β
|
|
|
727
|
+
| Monthly Cost | Free | $49+ | $89+ | Dev Time |
|
|
703
728
|
|
|
704
729
|
## π§ͺ Testing
|
|
705
730
|
|
|
@@ -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,CAAA;
|
|
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,CAAA;AACvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAO5D,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAA;CAC3C,CAAA;AAKD,eAAO,MAAM,kBAAkB,GAC5B,kBAAkB,IAAI,KAAG,cAwFzB,CAAA;AAmUH,eAAO,MAAM,mBAAmB,GAAI,kBAAkB,IAAI,KAAG,QAI3D,CAAA"}
|
|
@@ -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,CAAA;AAEvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAG5D,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAA;CAC3C,CAAA;AAED,eAAO,MAAM,qBAAqB,GAC/B,kBAAkB,IAAI,KAAG,cAiCzB,CAAA;
|
|
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,CAAA;AAEvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAG5D,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAA;CAC3C,CAAA;AAED,eAAO,MAAM,qBAAqB,GAC/B,kBAAkB,IAAI,KAAG,cAiCzB,CAAA;AA4TH,eAAO,MAAM,sBAAsB,GAAI,kBAAkB,IAAI,KAAG,QAI9D,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CollectionBeforeChangeHook } from 'payload';
|
|
2
|
+
import type { SanitizedCouponPluginOptions } from '../types';
|
|
3
|
+
export declare const recalculateCartHook: (pluginConfig: SanitizedCouponPluginOptions) => CollectionBeforeChangeHook;
|
|
4
|
+
//# sourceMappingURL=recalculateCart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recalculateCart.d.ts","sourceRoot":"","sources":["../../src/hooks/recalculateCart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAQ5D,eAAO,MAAM,mBAAmB,GAC7B,cAAc,4BAA4B,KAAG,0BAyL7C,CAAA"}
|