@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 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
- - βœ… **Commission Rules** – **Required.** At least one rule per program. Each rule has **Referrer Reward** (partner commission) and **Referee Reward** (customer discount) inside it, plus appliesTo (all products / categories / products).
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 // Enable/disable the plugin (default: true)
448
- enableReferrals?: boolean // Enable referral system (default: false)
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 // Currency code (default: 'USD')
451
- autoIntegrate?: boolean // Auto-extend carts/orders (default: true)
452
-
470
+ defaultCurrency?: string // Currency code (default: 'USD')
471
+ autoIntegrate?: boolean // Auto-extend carts/orders (default: true)
472
+
453
473
  collections?: {
454
- couponsSlug?: string // Default: 'coupons'
455
- referralProgramsSlug?: string // Default: 'referral-programs'
456
- referralCodesSlug?: string // Default: 'referral-codes'
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 // Default: '/coupons/apply'
470
- validateCoupon?: string // Default: '/coupons/validate'
471
- partnerStats?: string // Default: '/referrals/partner-stats'
472
- recordOrderUsage?: string // Default: '/coupons/record-order-usage'
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 // Who can use coupons
477
- canUseReferrals?: Access // Who can use referrals
478
- isAdmin?: Access // Who can manage codes/programs
479
- isPartner?: Access // Who has partner 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 // Allow coupons + referrals (default: false)
484
- singleCodePerCart?: boolean // One code per order (default: true)
485
- defaultPartnerSplit?: number // Default partner % (default: 70)
486
- defaultCustomerSplit?: number // Default customer % (default: 30)
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 // Admin group for coupons (default: 'Coupons')
491
- referralsGroup?: string // Admin group for referrals (default: 'Referrals')
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 // Enable dashboard (default: true)
496
- showEarningsSummary?: boolean // Show earnings widget (default: true)
497
- showReferralPerformance?: boolean // Show performance widget (default: true)
498
- showRecentReferrals?: boolean // Show recent referrals (default: true)
499
- showCommissionBreakdown?: boolean // Show breakdown (default: true)
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 // Default: 'orders'
505
- orderCustomerEmailField?: string // Default: 'customerEmail'
506
- orderPaymentStatusField?: string // Default: 'paymentStatus'
507
- orderPaidStatusValue?: string // Default: 'paid'
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 | Status | Description |
680
- |---------|--------|-------------|
681
- | Multi-tier commissions | πŸ”œ Planned | Support for tiered commission rates based on performance |
682
- | Automatic payouts | πŸ”œ Planned | Integration with payment providers for automatic partner payouts |
683
- | Referral analytics | πŸ”œ Planned | Advanced analytics and reporting dashboard |
684
- | Email notifications | πŸ”œ Planned | Automated emails for referral events |
685
- | Custom code generation | πŸ”œ Planned | Allow partners to create custom branded codes |
686
- | Fraud detection | πŸ”œ Planned | Automatic detection of suspicious referral patterns |
687
- | Bulk code import | πŸ”œ Planned | Import coupons/codes from CSV |
688
- | A/B testing | πŸ”œ Planned | Test different commission structures |
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 | This Plugin | ReferralCandy | Refersion | Custom Build |
693
- |---------|-------------|---------------|-----------|--------------|
694
- | Payload CMS Integration | βœ… Native | ❌ | ❌ | ⚠️ Manual |
695
- | Coupon System | βœ… | ❌ | ❌ | ⚠️ Manual |
696
- | Referral System | βœ… | βœ… | βœ… | ⚠️ Manual |
697
- | Partner Dashboard | βœ… | βœ… | βœ… | ⚠️ Manual |
698
- | Commission Rules | βœ… | ⚠️ Limited | βœ… | ⚠️ Manual |
699
- | Single Code Enforcement | βœ… | ❌ | ❌ | ⚠️ Manual |
700
- | TypeScript Support | βœ… | ❌ | ❌ | ⚠️ Varies |
701
- | Self-Hosted | βœ… | ❌ | ❌ | βœ… |
702
- | Monthly Cost | Free | $49+ | $89+ | Dev Time |
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;AAEvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAG5D,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAA;CAC3C,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC5B,kBAAkB,IAAI,KAAG,cAsFzB,CAAA;AA8aH,eAAO,MAAM,mBAAmB,GAAI,kBAAkB,IAAI,KAAG,QAI3D,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;AAkRH,eAAO,MAAM,sBAAsB,GAAI,kBAAkB,IAAI,KAAG,QAI9D,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"}