@classytic/promo 0.1.0 → 0.2.0
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/CHANGELOG.md +128 -0
- package/README.md +226 -22
- package/dist/{index-J5BC20DN.d.mts → constants-CrbSSQG5.d.mts} +1 -3
- package/dist/{constants-BVajdyL3.mjs → constants-D0Rntp2f.mjs} +1 -3
- package/dist/index.d.mts +763 -10
- package/dist/index.mjs +1721 -34
- package/dist/schemas/index.d.mts +253 -0
- package/dist/schemas/index.mjs +135 -0
- package/package.json +20 -35
- package/dist/config-iZjn_8pp.d.mts +0 -71
- package/dist/domain/enums/index.d.mts +0 -2
- package/dist/domain/enums/index.mjs +0 -2
- package/dist/domain/index.d.mts +0 -61
- package/dist/domain/index.mjs +0 -4
- package/dist/domain-errors-BEkXvy5O.mjs +0 -80
- package/dist/event-emitter.port-DaodlJSG.d.mts +0 -8
- package/dist/event-types-CsTV1FKX.mjs +0 -25
- package/dist/events/index.d.mts +0 -2
- package/dist/events/index.mjs +0 -3
- package/dist/events-CprEWlN7.mjs +0 -25
- package/dist/index-B7lLH19a.d.mts +0 -13
- package/dist/index-C52zSBkI.d.mts +0 -96
- package/dist/index-Cu9iwy4v.d.mts +0 -99
- package/dist/index-l09KqnlE.d.mts +0 -81
- package/dist/models/index.d.mts +0 -2
- package/dist/models/index.mjs +0 -2
- package/dist/models-DdBNae7h.mjs +0 -277
- package/dist/repositories/index.d.mts +0 -2
- package/dist/repositories/index.mjs +0 -2
- package/dist/repositories-DgZIY9wD.mjs +0 -295
- package/dist/results-Ca5ZCNbN.d.mts +0 -218
- package/dist/services/index.d.mts +0 -2
- package/dist/services/index.mjs +0 -2
- package/dist/services-Cz0gHrmX.mjs +0 -815
- package/dist/types/index.d.mts +0 -3
- package/dist/types/index.mjs +0 -1
- package/dist/unit-of-work.port-DaMW8WZK.d.mts +0 -7
- package/dist/voucher.port-yxfb3MHJ.d.mts +0 -146
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { a as RewardType, i as ProgramType, n as DiscountScope, o as StackingMode, s as TriggerMode, t as DiscountMode } from "./index-J5BC20DN.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/types/inputs.d.ts
|
|
4
|
-
interface PromoContext {
|
|
5
|
-
actorId?: string;
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
}
|
|
8
|
-
interface CreateProgramInput {
|
|
9
|
-
name: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
programType: ProgramType;
|
|
12
|
-
triggerMode: TriggerMode;
|
|
13
|
-
stackingMode?: StackingMode;
|
|
14
|
-
priority?: number;
|
|
15
|
-
startsAt?: Date;
|
|
16
|
-
endsAt?: Date;
|
|
17
|
-
maxUsageTotal?: number;
|
|
18
|
-
maxUsagePerCustomer?: number;
|
|
19
|
-
applicableCustomerIds?: string[];
|
|
20
|
-
applicableCustomerTags?: string[];
|
|
21
|
-
metadata?: Record<string, unknown>;
|
|
22
|
-
}
|
|
23
|
-
interface UpdateProgramInput {
|
|
24
|
-
name?: string;
|
|
25
|
-
description?: string;
|
|
26
|
-
stackingMode?: StackingMode;
|
|
27
|
-
priority?: number;
|
|
28
|
-
startsAt?: Date;
|
|
29
|
-
endsAt?: Date;
|
|
30
|
-
maxUsageTotal?: number;
|
|
31
|
-
maxUsagePerCustomer?: number;
|
|
32
|
-
applicableCustomerIds?: string[];
|
|
33
|
-
applicableCustomerTags?: string[];
|
|
34
|
-
metadata?: Record<string, unknown>;
|
|
35
|
-
}
|
|
36
|
-
interface CreateRuleInput {
|
|
37
|
-
name?: string;
|
|
38
|
-
minimumAmount?: number;
|
|
39
|
-
minimumQuantity?: number;
|
|
40
|
-
applicableProductIds?: string[];
|
|
41
|
-
applicableCategories?: string[];
|
|
42
|
-
applicableSkus?: string[];
|
|
43
|
-
buyQuantity?: number;
|
|
44
|
-
code?: string;
|
|
45
|
-
startsAt?: Date;
|
|
46
|
-
endsAt?: Date;
|
|
47
|
-
metadata?: Record<string, unknown>;
|
|
48
|
-
}
|
|
49
|
-
interface UpdateRuleInput {
|
|
50
|
-
name?: string;
|
|
51
|
-
minimumAmount?: number;
|
|
52
|
-
minimumQuantity?: number;
|
|
53
|
-
applicableProductIds?: string[];
|
|
54
|
-
applicableCategories?: string[];
|
|
55
|
-
applicableSkus?: string[];
|
|
56
|
-
buyQuantity?: number;
|
|
57
|
-
code?: string;
|
|
58
|
-
startsAt?: Date;
|
|
59
|
-
endsAt?: Date;
|
|
60
|
-
metadata?: Record<string, unknown>;
|
|
61
|
-
}
|
|
62
|
-
interface CreateRewardInput {
|
|
63
|
-
ruleId?: string;
|
|
64
|
-
rewardType: RewardType;
|
|
65
|
-
discountMode?: DiscountMode;
|
|
66
|
-
discountAmount?: number;
|
|
67
|
-
maxDiscountAmount?: number;
|
|
68
|
-
discountScope?: DiscountScope;
|
|
69
|
-
applicableProductIds?: string[];
|
|
70
|
-
freeProductId?: string;
|
|
71
|
-
freeProductSku?: string;
|
|
72
|
-
freeQuantity?: number;
|
|
73
|
-
giftCardAmount?: number;
|
|
74
|
-
metadata?: Record<string, unknown>;
|
|
75
|
-
}
|
|
76
|
-
interface UpdateRewardInput {
|
|
77
|
-
discountMode?: DiscountMode;
|
|
78
|
-
discountAmount?: number;
|
|
79
|
-
maxDiscountAmount?: number;
|
|
80
|
-
discountScope?: DiscountScope;
|
|
81
|
-
applicableProductIds?: string[];
|
|
82
|
-
freeProductId?: string;
|
|
83
|
-
freeProductSku?: string;
|
|
84
|
-
freeQuantity?: number;
|
|
85
|
-
giftCardAmount?: number;
|
|
86
|
-
metadata?: Record<string, unknown>;
|
|
87
|
-
}
|
|
88
|
-
interface GenerateCodesInput {
|
|
89
|
-
programId: string;
|
|
90
|
-
count: number;
|
|
91
|
-
customerId?: string;
|
|
92
|
-
expiresAt?: Date;
|
|
93
|
-
metadata?: Record<string, unknown>;
|
|
94
|
-
}
|
|
95
|
-
interface GenerateSingleCodeInput {
|
|
96
|
-
programId: string;
|
|
97
|
-
code?: string;
|
|
98
|
-
customerId?: string;
|
|
99
|
-
expiresAt?: Date;
|
|
100
|
-
initialBalance?: number;
|
|
101
|
-
metadata?: Record<string, unknown>;
|
|
102
|
-
}
|
|
103
|
-
interface RedeemVoucherInput {
|
|
104
|
-
code: string;
|
|
105
|
-
orderId: string;
|
|
106
|
-
customerId?: string;
|
|
107
|
-
discountAmount: number;
|
|
108
|
-
idempotencyKey?: string;
|
|
109
|
-
}
|
|
110
|
-
interface GiftCardSpendInput {
|
|
111
|
-
code: string;
|
|
112
|
-
amount: number;
|
|
113
|
-
orderId: string;
|
|
114
|
-
description?: string;
|
|
115
|
-
idempotencyKey?: string;
|
|
116
|
-
}
|
|
117
|
-
interface GiftCardTopUpInput {
|
|
118
|
-
code: string;
|
|
119
|
-
amount: number;
|
|
120
|
-
description?: string;
|
|
121
|
-
idempotencyKey?: string;
|
|
122
|
-
}
|
|
123
|
-
interface CartItem {
|
|
124
|
-
productId: string;
|
|
125
|
-
sku?: string;
|
|
126
|
-
categoryId?: string;
|
|
127
|
-
quantity: number;
|
|
128
|
-
unitPrice: number;
|
|
129
|
-
lineTotal?: number;
|
|
130
|
-
}
|
|
131
|
-
interface EvaluateInput {
|
|
132
|
-
items: CartItem[];
|
|
133
|
-
subtotal: number;
|
|
134
|
-
codes?: string[];
|
|
135
|
-
customerId?: string;
|
|
136
|
-
customerTags?: string[];
|
|
137
|
-
}
|
|
138
|
-
interface ListQuery {
|
|
139
|
-
page?: number;
|
|
140
|
-
limit?: number;
|
|
141
|
-
sort?: string;
|
|
142
|
-
filters?: Record<string, unknown>;
|
|
143
|
-
}
|
|
144
|
-
//#endregion
|
|
145
|
-
//#region src/types/results.d.ts
|
|
146
|
-
interface DiscountLine {
|
|
147
|
-
programId: string;
|
|
148
|
-
programName: string;
|
|
149
|
-
rewardId: string;
|
|
150
|
-
type: 'percentage' | 'fixed';
|
|
151
|
-
scope: 'order' | 'cheapest' | 'specific_products';
|
|
152
|
-
amount: number;
|
|
153
|
-
description: string;
|
|
154
|
-
voucherCode?: string;
|
|
155
|
-
}
|
|
156
|
-
interface FreeProductLine {
|
|
157
|
-
programId: string;
|
|
158
|
-
programName: string;
|
|
159
|
-
rewardId: string;
|
|
160
|
-
productId?: string;
|
|
161
|
-
productSku?: string;
|
|
162
|
-
quantity: number;
|
|
163
|
-
description: string;
|
|
164
|
-
}
|
|
165
|
-
interface RejectedCode {
|
|
166
|
-
code: string;
|
|
167
|
-
reason: string;
|
|
168
|
-
}
|
|
169
|
-
interface EvaluationResult {
|
|
170
|
-
evaluationId: string;
|
|
171
|
-
appliedDiscounts: DiscountLine[];
|
|
172
|
-
freeProducts: FreeProductLine[];
|
|
173
|
-
totalDiscount: number;
|
|
174
|
-
subtotalAfterDiscount: number;
|
|
175
|
-
appliedCodes: string[];
|
|
176
|
-
rejectedCodes: RejectedCode[];
|
|
177
|
-
warnings: string[];
|
|
178
|
-
isPreview: boolean;
|
|
179
|
-
programsApplied: string[];
|
|
180
|
-
}
|
|
181
|
-
interface CommitResult {
|
|
182
|
-
evaluationId: string;
|
|
183
|
-
orderId: string;
|
|
184
|
-
totalDiscount: number;
|
|
185
|
-
programsCommitted: number;
|
|
186
|
-
vouchersUsed: number;
|
|
187
|
-
}
|
|
188
|
-
interface VoucherValidation {
|
|
189
|
-
valid: boolean;
|
|
190
|
-
voucher?: {
|
|
191
|
-
code: string;
|
|
192
|
-
programId: string;
|
|
193
|
-
programType: string;
|
|
194
|
-
status: string;
|
|
195
|
-
remainingUses: number;
|
|
196
|
-
currentBalance?: number;
|
|
197
|
-
expiresAt?: Date;
|
|
198
|
-
};
|
|
199
|
-
error?: string;
|
|
200
|
-
}
|
|
201
|
-
interface GiftCardBalance {
|
|
202
|
-
code: string;
|
|
203
|
-
initialBalance: number;
|
|
204
|
-
currentBalance: number;
|
|
205
|
-
spent: number;
|
|
206
|
-
voucherId: string;
|
|
207
|
-
}
|
|
208
|
-
interface PaginatedResult<T> {
|
|
209
|
-
docs: T[];
|
|
210
|
-
page: number;
|
|
211
|
-
limit: number;
|
|
212
|
-
total: number;
|
|
213
|
-
pages: number;
|
|
214
|
-
hasNext: boolean;
|
|
215
|
-
hasPrev: boolean;
|
|
216
|
-
}
|
|
217
|
-
//#endregion
|
|
218
|
-
export { UpdateRuleInput as C, UpdateRewardInput as S, GiftCardTopUpInput as _, GiftCardBalance as a, RedeemVoucherInput as b, VoucherValidation as c, CreateRewardInput as d, CreateRuleInput as f, GiftCardSpendInput as g, GenerateSingleCodeInput as h, FreeProductLine as i, CartItem as l, GenerateCodesInput as m, DiscountLine as n, PaginatedResult as o, EvaluateInput as p, EvaluationResult as r, RejectedCode as s, CommitResult as t, CreateProgramInput as u, ListQuery as v, UpdateProgramInput as x, PromoContext as y };
|
package/dist/services/index.mjs
DELETED