@wtree/payload-ecommerce-coupon 3.70.5 → 3.71.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 +82 -116
- package/dist/client/index.d.ts +6 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/collections/createReferralProgramsCollection.d.ts.map +1 -1
- package/dist/components/PartnerDashboard/EarningsSummary.d.ts +9 -0
- package/dist/components/PartnerDashboard/EarningsSummary.d.ts.map +1 -0
- package/dist/components/PartnerDashboard/RecentReferrals.d.ts +9 -0
- package/dist/components/PartnerDashboard/RecentReferrals.d.ts.map +1 -0
- package/dist/components/PartnerDashboard/ReferralCodes.d.ts +9 -0
- package/dist/components/PartnerDashboard/ReferralCodes.d.ts.map +1 -0
- package/dist/components/PartnerDashboard/ReferralPerformance.d.ts +8 -0
- package/dist/components/PartnerDashboard/ReferralPerformance.d.ts.map +1 -0
- package/dist/components/PartnerDashboard/index.d.ts +12 -0
- package/dist/components/PartnerDashboard/index.d.ts.map +1 -0
- package/dist/endpoints/applyCoupon.d.ts.map +1 -1
- package/dist/endpoints/partnerStats.d.ts.map +1 -1
- package/dist/endpoints/validateCoupon.d.ts.map +1 -1
- package/dist/index.d.ts +4 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +142 -198
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +142 -198
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utilities/pushTypeScriptProperties.d.ts.map +1 -1
- package/dist/utilities/recordCouponUsageForOrder.d.ts +29 -0
- package/dist/utilities/recordCouponUsageForOrder.d.ts.map +1 -0
- package/dist/utilities/sanitizePluginConfig.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,22 +15,23 @@ Production-ready coupon and referral system plugin for **Payload CMS** with seam
|
|
|
15
15
|
|
|
16
16
|
### **Coupon Mode Features**
|
|
17
17
|
- ✅ **Flexible Discounts** – Percentage or fixed amount discounts
|
|
18
|
-
- ✅ **Usage Controls** –
|
|
19
|
-
- ✅ **Conditions** – Minimum/maximum order values, product restrictions
|
|
18
|
+
- ✅ **Usage Controls** – Usage limits; usage is counted when an **order is placed** (not on apply)
|
|
19
|
+
- ✅ **Conditions** – Minimum/maximum order values (top-level fields), product restrictions
|
|
20
20
|
- ✅ **Auto-Application** – Seamless cart integration
|
|
21
21
|
|
|
22
22
|
### **Referral Mode Features**
|
|
23
|
-
- ✅ **Commission Rules** –
|
|
24
|
-
- ✅ **
|
|
25
|
-
- ✅ **Partner Tracking** – Commission earnings and referral performance
|
|
23
|
+
- ✅ **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).
|
|
24
|
+
- ✅ **Referrer/Referee inside each rule** – Partner gets commission, customer gets discount; type (percentage/fixed), value, and optional max cap per rule.
|
|
25
|
+
- ✅ **Partner Tracking** – Commission earnings and referral performance (credited when order is placed)
|
|
26
26
|
- ✅ **Auto-Generated Codes** – Unique referral codes for each partner
|
|
27
27
|
- ✅ **Partner Dashboard** – Ready-to-use React components for partner stats
|
|
28
28
|
- ✅ **Single Code Per Cart** – Enforce one code (coupon or referral) per order
|
|
29
29
|
|
|
30
30
|
### **Core Features**
|
|
31
|
-
- ✅ **REST API** – Validate, apply, and
|
|
32
|
-
- ✅ **Frontend Hooks** – `useCouponCode()`, `usePartnerStats()` for React/Next.js
|
|
31
|
+
- ✅ **REST API** – Validate, apply, and record usage when order is placed
|
|
32
|
+
- ✅ **Frontend Hooks** – `useCouponCode()`, `usePartnerStats()`, `validateCouponCode()` for React/Next.js
|
|
33
33
|
- ✅ **Auto-Integration** – Extends carts/orders automatically
|
|
34
|
+
- ✅ **Usage on Order** – Coupon/referral usage and partner earnings are recorded when an order is placed (not when code is applied)
|
|
34
35
|
- ✅ **Type-Safe** – Full TypeScript support
|
|
35
36
|
- ✅ **Access Control** – Role-based permissions with partner role support
|
|
36
37
|
- ✅ **Custom Admin Groups** – Separate "Coupons" and "Referrals" categories
|
|
@@ -156,7 +157,33 @@ export const Users: CollectionConfig = {
|
|
|
156
157
|
}
|
|
157
158
|
```
|
|
158
159
|
|
|
159
|
-
### 4.
|
|
160
|
+
### 4. Record Usage When Order Is Placed
|
|
161
|
+
|
|
162
|
+
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:
|
|
163
|
+
|
|
164
|
+
**Option A – Call the API** (e.g. from your Orders collection `afterChange` hook when `paymentStatus === 'paid'`):
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
POST /api/coupons/record-order-usage
|
|
168
|
+
Content-Type: application/json
|
|
169
|
+
{ "orderId": "your-order-id" }
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Option B – Use the server utility** (in your Payload config or Orders hook):
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
import { recordCouponUsageForOrder } from '@wtree/payload-ecommerce-coupon'
|
|
176
|
+
|
|
177
|
+
// In your Orders collection afterChange hook, when order is paid/completed:
|
|
178
|
+
if (doc.paymentStatus === 'paid' && (doc.appliedCoupon || doc.appliedReferralCode)) {
|
|
179
|
+
await recordCouponUsageForOrder(payload, doc, pluginConfig)
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
- **Coupon:** increments the coupon’s `usageCount`.
|
|
184
|
+
- **Referral:** increments the referral code’s `usageCount` and `successfulReferralsCount`, and adds `order.partnerCommission` to the referral code’s `totalEarnings` and `pendingEarnings` (referrer gets commission; referee discount is already on the order).
|
|
185
|
+
|
|
186
|
+
### 5. Frontend Integration
|
|
160
187
|
|
|
161
188
|
#### Apply Coupon/Referral Code
|
|
162
189
|
|
|
@@ -201,23 +228,12 @@ function CheckoutComponent() {
|
|
|
201
228
|
|
|
202
229
|
#### Partner Dashboard
|
|
203
230
|
|
|
204
|
-
|
|
205
|
-
import { PartnerDashboard, usePartnerStats } from '@wtree/payload-ecommerce-coupon'
|
|
231
|
+
Use the `usePartnerStats` hook to build a custom dashboard, or use the pre-built dashboard components when available from the package. See [Partner Dashboard docs](./docs/partner-dashboard.md).
|
|
206
232
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
<PartnerDashboard
|
|
211
|
-
showEarningsSummary={true}
|
|
212
|
-
showReferralPerformance={true}
|
|
213
|
-
showRecentReferrals={true}
|
|
214
|
-
showReferralCodes={true}
|
|
215
|
-
apiEndpoint="/api/referrals/partner-stats"
|
|
216
|
-
/>
|
|
217
|
-
)
|
|
218
|
-
}
|
|
233
|
+
```typescript
|
|
234
|
+
import { usePartnerStats } from '@wtree/payload-ecommerce-coupon'
|
|
219
235
|
|
|
220
|
-
//
|
|
236
|
+
// Build custom dashboard with the hook
|
|
221
237
|
function CustomPartnerDashboard() {
|
|
222
238
|
const [data, setData] = useState(null)
|
|
223
239
|
|
|
@@ -281,48 +297,24 @@ Best when you need both traditional coupons AND partner referrals, but want to e
|
|
|
281
297
|
### **Setting Up Referral Mode**
|
|
282
298
|
|
|
283
299
|
1. **Navigate to Admin Panel** → Go to "Referral Programs" (under "Referrals" group)
|
|
284
|
-
2. **Create Referral Program
|
|
285
|
-
- **Name**: "
|
|
286
|
-
- **
|
|
287
|
-
- **
|
|
288
|
-
- **
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
"type": "percentage",
|
|
299
|
-
"value": 15
|
|
300
|
-
},
|
|
301
|
-
"split": {
|
|
302
|
-
"partnerPercentage": 70,
|
|
303
|
-
"customerPercentage": 30
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
### **Commission Calculation Examples**
|
|
309
|
-
|
|
310
|
-
#### **Example 1: Simple Percentage Split**
|
|
311
|
-
- **Order Total**: $100
|
|
312
|
-
- **Referrer Reward**: 10% (percentage)
|
|
313
|
-
- **Referee Reward**: 5% (percentage)
|
|
314
|
-
- **Result**: Partner earns $10, Customer saves $5
|
|
315
|
-
|
|
316
|
-
#### **Example 2: Commission Rules with Split**
|
|
300
|
+
2. **Create Referral Program** with **Commission Rules** (required – at least one). Each rule has:
|
|
301
|
+
- **Name**: e.g. "Default" or "Electronics"
|
|
302
|
+
- **Applies To**: All Products, Specific Categories, or Specific Products
|
|
303
|
+
- **Referrer Reward** (inside the rule): Commission for the partner. Type: Percentage of Order or Fixed Amount. Value: e.g. 65 = 65% of order value. Optional Max Reward.
|
|
304
|
+
- **Referee Reward** (inside the rule): Discount for the customer. Type: Percentage Discount or Fixed Amount. Value: e.g. 30 = 30% off. Optional Max Reward.
|
|
305
|
+
|
|
306
|
+
There are no outer Referrer Reward / Referee Reward fields – only **Commission Rules**, and each rule contains its own Referrer Reward and Referee Reward.
|
|
307
|
+
|
|
308
|
+
### **Commission and Discount (Referrer / Referee)**
|
|
309
|
+
|
|
310
|
+
- **Referrer (partner)** receives **commission** – credited to the referral code’s `totalEarnings` and `pendingEarnings` when the order is placed (via record-order-usage).
|
|
311
|
+
- **Referee (customer)** receives a **discount** – applied to the order; stored on cart/order as `customerDiscount`.
|
|
312
|
+
|
|
313
|
+
#### **Example: Commission Rules with Split**
|
|
317
314
|
- **Order Total**: $100 (Electronics category)
|
|
318
315
|
- **Total Commission**: 15% = $15
|
|
319
|
-
- **Partner Share**: 70% of $15 = $10.50
|
|
320
|
-
- **Customer Discount**: 30% of $15 = $4.50
|
|
321
|
-
|
|
322
|
-
#### **Example 3: Fixed Commission**
|
|
323
|
-
- **Referrer Reward**: $20 (fixed)
|
|
324
|
-
- **Referee Reward**: $10 (fixed)
|
|
325
|
-
- **Result**: Partner earns $20, Customer saves $10 (regardless of order value)
|
|
316
|
+
- **Partner Share**: 70% of $15 = $10.50 (commission to referrer)
|
|
317
|
+
- **Customer Discount**: 30% of $15 = $4.50 (discount to referee)
|
|
326
318
|
|
|
327
319
|
### **Managing Partners**
|
|
328
320
|
|
|
@@ -345,7 +337,7 @@ curl -X POST http://localhost:3000/api/coupons/validate \
|
|
|
345
337
|
```
|
|
346
338
|
|
|
347
339
|
#### POST /api/coupons/apply
|
|
348
|
-
Apply a code to a cart.
|
|
340
|
+
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.
|
|
349
341
|
|
|
350
342
|
```bash
|
|
351
343
|
curl -X POST http://localhost:3000/api/coupons/apply \
|
|
@@ -353,6 +345,19 @@ curl -X POST http://localhost:3000/api/coupons/apply \
|
|
|
353
345
|
-d '{"code": "WELCOME10", "cartID": "cart-123"}'
|
|
354
346
|
```
|
|
355
347
|
|
|
348
|
+
#### POST /api/coupons/record-order-usage
|
|
349
|
+
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).
|
|
350
|
+
|
|
351
|
+
**Request body:** `{ "orderId": "string" }`
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
curl -X POST http://localhost:3000/api/coupons/record-order-usage \
|
|
355
|
+
-H "Content-Type: application/json" \
|
|
356
|
+
-d '{"orderId": "order-123"}'
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
**Response:** `{ "success": true, "recordedCoupon": boolean, "recordedReferral": boolean }`
|
|
360
|
+
|
|
356
361
|
### **Partner Stats Endpoint**
|
|
357
362
|
|
|
358
363
|
#### GET /api/referrals/partner-stats
|
|
@@ -420,6 +425,7 @@ export type CouponPluginOptions = {
|
|
|
420
425
|
applyCoupon?: string // Default: '/coupons/apply'
|
|
421
426
|
validateCoupon?: string // Default: '/coupons/validate'
|
|
422
427
|
partnerStats?: string // Default: '/referrals/partner-stats'
|
|
428
|
+
recordOrderUsage?: string // Default: '/coupons/record-order-usage'
|
|
423
429
|
}
|
|
424
430
|
|
|
425
431
|
access?: {
|
|
@@ -560,15 +566,13 @@ import {
|
|
|
560
566
|
validateCouponCode,
|
|
561
567
|
usePartnerStats,
|
|
562
568
|
|
|
563
|
-
//
|
|
564
|
-
|
|
565
|
-
EarningsSummary,
|
|
566
|
-
ReferralPerformance,
|
|
567
|
-
RecentReferrals,
|
|
568
|
-
ReferralCodes,
|
|
569
|
+
// Server-only: record usage when order is placed
|
|
570
|
+
recordCouponUsageForOrder,
|
|
569
571
|
} from '@wtree/payload-ecommerce-coupon'
|
|
570
572
|
```
|
|
571
573
|
|
|
574
|
+
Dashboard components (`PartnerDashboard`, `EarningsSummary`, `ReferralPerformance`, `RecentReferrals`, `ReferralCodes`) are available from the package source; see [Partner Dashboard docs](./docs/partner-dashboard.md) for usage.
|
|
575
|
+
|
|
572
576
|
### **Collection Creation Functions**
|
|
573
577
|
|
|
574
578
|
You can use the collection creation functions directly in your Payload config to customize collections before they're added to the config.
|
|
@@ -588,54 +592,14 @@ export default buildConfig({
|
|
|
588
592
|
}),
|
|
589
593
|
],
|
|
590
594
|
collections: [
|
|
591
|
-
//
|
|
592
|
-
createCouponsCollection({
|
|
593
|
-
enabled: true,
|
|
594
|
-
defaultCurrency: 'USD',
|
|
595
|
-
}),
|
|
595
|
+
// The plugin adds collections automatically; use overrides in plugin config to customize
|
|
596
596
|
],
|
|
597
597
|
})
|
|
598
598
|
```
|
|
599
599
|
|
|
600
|
-
## 🎨 Partner Dashboard
|
|
601
|
-
|
|
602
|
-
The plugin provides ready-to-use React components for building partner dashboards:
|
|
603
|
-
|
|
604
|
-
```typescript
|
|
605
|
-
import {
|
|
606
|
-
PartnerDashboard, // Complete dashboard
|
|
607
|
-
EarningsSummary, // Earnings widget
|
|
608
|
-
ReferralPerformance, // Performance metrics
|
|
609
|
-
RecentReferrals, // Recent referrals table
|
|
610
|
-
ReferralCodes, // Referral codes list
|
|
611
|
-
} from '@wtree/payload-ecommerce-coupon'
|
|
612
|
-
|
|
613
|
-
// Use individual components
|
|
614
|
-
function CustomDashboard({ stats, currency }) {
|
|
615
|
-
return (
|
|
616
|
-
<div>
|
|
617
|
-
<EarningsSummary stats={stats} currency={currency} />
|
|
618
|
-
<ReferralPerformance stats={stats} />
|
|
619
|
-
</div>
|
|
620
|
-
)
|
|
621
|
-
}
|
|
622
|
-
```
|
|
623
|
-
|
|
624
|
-
### **Styling**
|
|
625
|
-
|
|
626
|
-
Import the default styles or customize:
|
|
627
|
-
|
|
628
|
-
```css
|
|
629
|
-
/* Import default styles */
|
|
630
|
-
@import '@wtree/payload-ecommerce-coupon/styles.css';
|
|
600
|
+
## 🎨 Partner Dashboard
|
|
631
601
|
|
|
632
|
-
|
|
633
|
-
.partner-dashboard {
|
|
634
|
-
--primary-color: #3b82f6;
|
|
635
|
-
--success-color: #059669;
|
|
636
|
-
--warning-color: #d97706;
|
|
637
|
-
}
|
|
638
|
-
```
|
|
602
|
+
The plugin provides hooks and (when using the source) React components for partner dashboards. Use `usePartnerStats()` to fetch stats; for pre-built dashboard components and styling, see [Partner Dashboard documentation](./docs/partner-dashboard.md).
|
|
639
603
|
|
|
640
604
|
## 🔧 Troubleshooting
|
|
641
605
|
|
|
@@ -649,10 +613,12 @@ This occurs when `singleCodePerCart: true` and a code is already applied.
|
|
|
649
613
|
- Ensure the user has `role: 'partner'` or `roles: ['partner']`
|
|
650
614
|
- Check the `isPartner` access control function
|
|
651
615
|
|
|
616
|
+
#### **Usage count or partner earnings not updating**
|
|
617
|
+
- 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).
|
|
618
|
+
|
|
652
619
|
#### **Commission not calculating correctly**
|
|
653
|
-
-
|
|
654
|
-
-
|
|
655
|
-
- Ensure cart has valid `subtotal` or `total` field
|
|
620
|
+
- Ensure at least one **Commission Rule** exists and each rule has **Referrer Reward** and **Referee Reward** set
|
|
621
|
+
- Verify cart has valid `subtotal` or `total` and items match rule’s appliesTo (all / categories / products)
|
|
656
622
|
|
|
657
623
|
## 📋 Future Features (Roadmap)
|
|
658
624
|
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export {
|
|
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';
|
|
2
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,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AACxF,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -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,CAAA;AAE/C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAE5D,eAAO,MAAM,gCAAgC,GAC3C,cAAc,4BAA4B,KACzC,
|
|
1
|
+
{"version":3,"file":"createReferralProgramsCollection.d.ts","sourceRoot":"","sources":["../../src/collections/createReferralProgramsCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAE5D,eAAO,MAAM,gCAAgC,GAC3C,cAAc,4BAA4B,KACzC,gBA4PF,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PartnerStats } from '../../types';
|
|
3
|
+
export type EarningsSummaryProps = {
|
|
4
|
+
stats: PartnerStats;
|
|
5
|
+
currency: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const EarningsSummary: React.FC<EarningsSummaryProps>;
|
|
8
|
+
export default EarningsSummary;
|
|
9
|
+
//# sourceMappingURL=EarningsSummary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EarningsSummary.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/EarningsSummary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,YAAY,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAUD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA4B1D,CAAA;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PartnerStats } from '../../types';
|
|
3
|
+
export type RecentReferralsProps = {
|
|
4
|
+
referrals: PartnerStats['recentReferrals'];
|
|
5
|
+
currency: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const RecentReferrals: React.FC<RecentReferralsProps>;
|
|
8
|
+
export default RecentReferrals;
|
|
9
|
+
//# sourceMappingURL=RecentReferrals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecentReferrals.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/RecentReferrals.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAA;IAC1C,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAkBD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAkC1D,CAAA;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PartnerDashboardData } from '../../types';
|
|
3
|
+
export type ReferralCodesProps = {
|
|
4
|
+
codes: PartnerDashboardData['referralCodes'];
|
|
5
|
+
currency: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const ReferralCodes: React.FC<ReferralCodesProps>;
|
|
8
|
+
export default ReferralCodes;
|
|
9
|
+
//# sourceMappingURL=ReferralCodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferralCodes.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/ReferralCodes.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAA;IAC5C,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAUD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA+DtD,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PartnerStats } from '../../types';
|
|
3
|
+
export type ReferralPerformanceProps = {
|
|
4
|
+
stats: PartnerStats;
|
|
5
|
+
};
|
|
6
|
+
export declare const ReferralPerformance: React.FC<ReferralPerformanceProps>;
|
|
7
|
+
export default ReferralPerformance;
|
|
8
|
+
//# sourceMappingURL=ReferralPerformance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferralPerformance.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/ReferralPerformance.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA6ClE,CAAA;AAED,eAAe,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './styles.css';
|
|
3
|
+
export type PartnerDashboardProps = {
|
|
4
|
+
showEarningsSummary?: boolean;
|
|
5
|
+
showReferralPerformance?: boolean;
|
|
6
|
+
showRecentReferrals?: boolean;
|
|
7
|
+
showReferralCodes?: boolean;
|
|
8
|
+
apiEndpoint?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const PartnerDashboard: React.FC<PartnerDashboardProps>;
|
|
11
|
+
export default PartnerDashboard;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PartnerDashboard/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAA;AASlD,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,qBAAqB,GAAG;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAyH5D,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -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;AAE5D,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAA;CAC3C,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC5B,kBAAkB,IAAI,KAAG,cAsFzB,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;AAEvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAE5D,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAA;CAC3C,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC5B,kBAAkB,IAAI,KAAG,cAsFzB,CAAA;AAsVH,eAAO,MAAM,mBAAmB,GAAI,kBAAkB,IAAI,KAAG,QAI3D,CAAA"}
|
|
@@ -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,CAAA;AAEvD,OAAO,KAAK,EAAsC,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAEhG,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAA;CAC3C,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC7B,kBAAkB,IAAI,KAAG,
|
|
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,CAAA;AAEvD,OAAO,KAAK,EAAsC,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAEhG,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAA;CAC3C,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC7B,kBAAkB,IAAI,KAAG,cAqKzB,CAAA;AAEH,eAAO,MAAM,oBAAoB,GAAI,kBAAkB,IAAI,KAAG,QAI5D,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;AAE5D,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAA;CAC3C,CAAA;AAED,eAAO,MAAM,qBAAqB,GAC/B,kBAAkB,IAAI,KAAG,cA2BzB,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;AAE5D,KAAK,IAAI,GAAG;IACV,YAAY,EAAE,4BAA4B,CAAA;CAC3C,CAAA;AAED,eAAO,MAAM,qBAAqB,GAC/B,kBAAkB,IAAI,KAAG,cA2BzB,CAAA;AA8OH,eAAO,MAAM,sBAAsB,GAAI,kBAAkB,IAAI,KAAG,QAI9D,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { payloadEcommerceCouponPlugin } from './plugin';
|
|
2
1
|
import { createCouponsCollection } from './collections/createCouponsCollection';
|
|
3
2
|
import { createReferralCodesCollection } from './collections/createReferralCodesCollection';
|
|
4
3
|
import { createReferralProgramsCollection } from './collections/createReferralProgramsCollection';
|
|
5
|
-
|
|
6
|
-
export { useCouponCode,
|
|
7
|
-
export { createCouponsCollection };
|
|
8
|
-
export {
|
|
9
|
-
export { createReferralProgramsCollection };
|
|
10
|
-
export type { CouponPluginOptions, CouponPluginCollections, CouponPluginAccess, ApplyCouponResponse, ApplyCouponHook, PartnerStats, PartnerDashboardData, ReferralProgramConfig, AdminGroupConfig, PartnerDashboardConfig, } from './types';
|
|
4
|
+
import { payloadEcommerceCouponPlugin } from './plugin';
|
|
5
|
+
export { useCouponCode, usePartnerStats, validateCouponCode } from './client/hooks';
|
|
6
|
+
export { createCouponsCollection, createReferralCodesCollection, createReferralProgramsCollection, payloadEcommerceCouponPlugin as payloadEcommerceCoupon, };
|
|
7
|
+
export type { AdminGroupConfig, ApplyCouponHook, ApplyCouponResponse, CouponPluginAccess, CouponPluginCollections, CouponPluginOptions, PartnerDashboardConfig, PartnerDashboardData, PartnerStats, ReferralProgramConfig, } from './types';
|
|
11
8
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAA;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAA;AAC3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAA;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnF,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,IAAI,sBAAsB,GACvD,CAAA;AAED,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,GACtB,MAAM,SAAS,CAAA"}
|