@voucherify/sdk 2.9.3 → 2.9.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/dist/ApiLimitsHandler.d.ts +13 -0
- package/dist/AsyncActions.d.ts +17 -0
- package/dist/Balance.d.ts +15 -0
- package/dist/Campaigns.d.ts +66 -0
- package/dist/Categories.d.ts +29 -0
- package/dist/ClientSide.d.ts +77 -0
- package/dist/Consents.d.ts +13 -0
- package/dist/Customers.d.ts +75 -0
- package/dist/Distributions.d.ts +29 -0
- package/dist/Events.d.ts +15 -0
- package/dist/Exports.d.ts +25 -0
- package/dist/Loyalties.d.ts +171 -0
- package/dist/MetadataSchemas.d.ts +17 -0
- package/dist/Orders.d.ts +32 -0
- package/dist/ProductCollections.d.ts +30 -0
- package/dist/Products.d.ts +66 -0
- package/dist/PromotionTiers.d.ts +43 -0
- package/dist/Promotions.d.ts +30 -0
- package/dist/PromotionsStacks.d.ts +34 -0
- package/dist/Qualifications.d.ts +24 -0
- package/dist/Redemptions.d.ts +53 -0
- package/dist/RequestController.d.ts +31 -0
- package/dist/Rewards.d.ts +46 -0
- package/dist/Segments.d.ts +25 -0
- package/dist/ValidationRules.d.ts +47 -0
- package/dist/Validations.d.ts +39 -0
- package/dist/VoucherifyClientSide.d.ts +112 -0
- package/dist/VoucherifyError.d.ts +23 -0
- package/dist/VoucherifyServerSide.d.ts +170 -0
- package/dist/Vouchers.d.ts +84 -0
- package/dist/helpers.d.ts +20 -0
- package/dist/index.d.ts +63 -0
- package/dist/types/ApplicableTo.d.ts +32 -0
- package/dist/types/AsyncActions.d.ts +23 -0
- package/dist/types/Balance.d.ts +18 -0
- package/dist/types/Campaigns.d.ts +124 -0
- package/dist/types/Categories.d.ts +40 -0
- package/dist/types/ClientSide.d.ts +145 -0
- package/dist/types/Consents.d.ts +34 -0
- package/dist/types/Customers.d.ts +363 -0
- package/dist/types/DiscountVoucher.d.ts +94 -0
- package/dist/types/Distributions.d.ts +148 -0
- package/dist/types/Events.d.ts +21 -0
- package/dist/types/Exports.d.ts +151 -0
- package/dist/types/Gift.d.ts +5 -0
- package/dist/types/Loyalties.d.ts +1061 -0
- package/dist/types/MetadataSchemas.d.ts +34 -0
- package/dist/types/Orders.d.ts +199 -0
- package/dist/types/ProductCollections.d.ts +99 -0
- package/dist/types/Products.d.ts +108 -0
- package/dist/types/PromotionTiers.d.ts +131 -0
- package/dist/types/Promotions.d.ts +113 -0
- package/dist/types/PromotionsStacks.d.ts +74 -0
- package/dist/types/Qualifications.d.ts +92 -0
- package/dist/types/Redemptions.d.ts +215 -0
- package/dist/types/Rewards.d.ts +220 -0
- package/dist/types/Segments.d.ts +34 -0
- package/dist/types/Stackable.d.ts +106 -0
- package/dist/types/UtilityTypes.d.ts +5 -0
- package/dist/types/ValidateSession.d.ts +19 -0
- package/dist/types/ValidationError.d.ts +9 -0
- package/dist/types/ValidationRules.d.ts +96 -0
- package/dist/types/Validations.d.ts +109 -0
- package/dist/types/Vouchers.d.ts +452 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/voucherifysdk.cjs +2022 -1
- package/dist/voucherifysdk.cjs.map +1 -1
- package/dist/voucherifysdk.esm.js +1985 -1
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/voucherifysdk.d.mts +0 -5252
- package/dist/voucherifysdk.d.ts +0 -5252
|
@@ -0,0 +1,1061 @@
|
|
|
1
|
+
import { OrdersItem, OrdersCreateResponse } from './Orders.js';
|
|
2
|
+
import { ProductsCreateResponse, ProductsCreateSkuResponse } from './Products.js';
|
|
3
|
+
import { SimpleCustomer } from './Customers.js';
|
|
4
|
+
import { ValidationRulesCreateAssignmentResponse } from './ValidationRules.js';
|
|
5
|
+
import { VouchersResponse, VouchersExportTransactionsRequestBody, VouchersExportTransactionsResponseBody } from './Vouchers.js';
|
|
6
|
+
import { Reward, RewardAssignment } from './Rewards.js';
|
|
7
|
+
import { Category } from './Categories.js';
|
|
8
|
+
import './DiscountVoucher.js';
|
|
9
|
+
import './ApplicableTo.js';
|
|
10
|
+
|
|
11
|
+
interface LoyaltiesVoucher {
|
|
12
|
+
code_config?: {
|
|
13
|
+
length?: number;
|
|
14
|
+
charset?: string;
|
|
15
|
+
pattern?: string;
|
|
16
|
+
prefix?: string;
|
|
17
|
+
suffix?: string;
|
|
18
|
+
};
|
|
19
|
+
type?: string;
|
|
20
|
+
is_referral_code?: boolean;
|
|
21
|
+
loyalty_card?: {
|
|
22
|
+
points: number;
|
|
23
|
+
balance: number;
|
|
24
|
+
};
|
|
25
|
+
redemption?: {
|
|
26
|
+
quantity?: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface LoyaltiesListParams {
|
|
30
|
+
limit?: number;
|
|
31
|
+
page?: number;
|
|
32
|
+
}
|
|
33
|
+
interface LoyaltiesListResponse {
|
|
34
|
+
object: 'list';
|
|
35
|
+
total: number;
|
|
36
|
+
data_ref: 'campaigns';
|
|
37
|
+
campaigns?: LoyaltiesCreateCampaignResponse[];
|
|
38
|
+
}
|
|
39
|
+
interface LoyaltiesCreateCampaign {
|
|
40
|
+
name: string;
|
|
41
|
+
start_date?: string;
|
|
42
|
+
expiration_date?: string;
|
|
43
|
+
type?: 'AUTO_UPDATE' | 'STATIC';
|
|
44
|
+
vouchers_count?: number;
|
|
45
|
+
voucher: {
|
|
46
|
+
type: 'LOYALTY_CARD';
|
|
47
|
+
redemption?: {
|
|
48
|
+
quantity: number;
|
|
49
|
+
};
|
|
50
|
+
loyalty_card: {
|
|
51
|
+
points: number;
|
|
52
|
+
balance?: number;
|
|
53
|
+
};
|
|
54
|
+
code_config?: {
|
|
55
|
+
length?: number;
|
|
56
|
+
charset?: string;
|
|
57
|
+
pattern?: string;
|
|
58
|
+
prefix?: string;
|
|
59
|
+
suffix?: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
metadata?: Record<string, any>;
|
|
63
|
+
}
|
|
64
|
+
interface LoyaltiesCreateCampaignResponse {
|
|
65
|
+
id: string;
|
|
66
|
+
name: string;
|
|
67
|
+
campaign_type?: 'LOYALTY_PROGRAM';
|
|
68
|
+
type: 'AUTO_UPDATE' | 'STATIC';
|
|
69
|
+
category?: string;
|
|
70
|
+
auto_join?: boolean;
|
|
71
|
+
join_once?: boolean;
|
|
72
|
+
description?: string;
|
|
73
|
+
start_date?: string;
|
|
74
|
+
validation_rules_assignments?: {
|
|
75
|
+
data?: ValidationRulesCreateAssignmentResponse[];
|
|
76
|
+
object: 'list';
|
|
77
|
+
total: number;
|
|
78
|
+
data_ref: 'data';
|
|
79
|
+
};
|
|
80
|
+
expiration_date?: string;
|
|
81
|
+
activity_duration_after_publishing?: string;
|
|
82
|
+
validity_timeframe?: {
|
|
83
|
+
interval?: string;
|
|
84
|
+
duration?: string;
|
|
85
|
+
};
|
|
86
|
+
validity_day_of_week?: number[];
|
|
87
|
+
metadata?: Record<string, any>;
|
|
88
|
+
created_at: string;
|
|
89
|
+
vouchers_generation_status: 'IN_PROGRESS' | 'DONE' | 'FAILED' | 'DRAFT';
|
|
90
|
+
active: boolean;
|
|
91
|
+
voucher?: LoyaltiesVoucher;
|
|
92
|
+
referral_program?: boolean;
|
|
93
|
+
use_voucher_metadata_schema?: boolean;
|
|
94
|
+
protected?: boolean;
|
|
95
|
+
vouchers_count?: number;
|
|
96
|
+
object: 'campaign';
|
|
97
|
+
}
|
|
98
|
+
type LoyaltiesGetCampaignResponse = LoyaltiesCreateCampaignResponse;
|
|
99
|
+
interface LoyaltiesUpdateCampaign {
|
|
100
|
+
id: string;
|
|
101
|
+
start_date?: string;
|
|
102
|
+
expiration_date?: string;
|
|
103
|
+
metadata?: Record<string, any>;
|
|
104
|
+
description?: string;
|
|
105
|
+
type?: 'AUTO_UPDATE' | 'STATIC';
|
|
106
|
+
}
|
|
107
|
+
type LoyaltiesUpdateCampaignResponse = LoyaltiesCreateCampaignResponse;
|
|
108
|
+
interface LoyaltiesDeleteCampaignParams {
|
|
109
|
+
force?: boolean;
|
|
110
|
+
}
|
|
111
|
+
interface LoyaltiesListRewardAssignmentsParams {
|
|
112
|
+
limit?: number;
|
|
113
|
+
page?: number;
|
|
114
|
+
}
|
|
115
|
+
interface LoyaltiesListRewardAssignmentsResponse {
|
|
116
|
+
object: 'list';
|
|
117
|
+
total: number;
|
|
118
|
+
data_ref: 'data';
|
|
119
|
+
data: LoyaltiesCreateRewardAssignmentResponse[];
|
|
120
|
+
}
|
|
121
|
+
interface LoyaltiesCreateRewardAssignments {
|
|
122
|
+
reward: string;
|
|
123
|
+
parameters: {
|
|
124
|
+
loyalty: {
|
|
125
|
+
points: number;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
interface LoyaltiesCreateRewardAssignmentResponse {
|
|
130
|
+
id: string;
|
|
131
|
+
reward_id: string;
|
|
132
|
+
related_object_id?: string;
|
|
133
|
+
related_object_type?: string;
|
|
134
|
+
parameters?: {
|
|
135
|
+
loyalty: {
|
|
136
|
+
points: number;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
created_at: string;
|
|
140
|
+
updated_at?: string;
|
|
141
|
+
object: 'reward_assignment';
|
|
142
|
+
}
|
|
143
|
+
interface LoyaltiesUpdateRewardAssignment {
|
|
144
|
+
id: string;
|
|
145
|
+
parameters: {
|
|
146
|
+
loyalty: {
|
|
147
|
+
points: number;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
type LoyaltiesUpdateRewardAssignmentResponse = LoyaltiesCreateRewardAssignmentResponse;
|
|
152
|
+
interface LoyaltiesListEarningRulesParams {
|
|
153
|
+
limit?: number;
|
|
154
|
+
page?: number;
|
|
155
|
+
}
|
|
156
|
+
interface LoyaltyFixed {
|
|
157
|
+
type: 'FIXED';
|
|
158
|
+
points: number;
|
|
159
|
+
}
|
|
160
|
+
interface LoyaltyProportional {
|
|
161
|
+
type: 'PROPORTIONAL';
|
|
162
|
+
calculation_type?: 'ORDER_AMOUNT' | 'ORDER_TOTAL_AMOUNT' | 'ORDER_METADATA' | 'ORDER_ITEMS_QUANTITY' | 'ORDER_ITEMS_AMOUNT' | 'ORDER_ITEMS_SUBTOTAL_AMOUNT' | 'CUSTOMER_METADATA' | 'CUSTOM_EVENT_METADATA';
|
|
163
|
+
order?: {
|
|
164
|
+
amount: {
|
|
165
|
+
every: number;
|
|
166
|
+
points: number;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
interface LoyaltiesEarningRulesResponse {
|
|
171
|
+
id: string;
|
|
172
|
+
created_at: string;
|
|
173
|
+
updated_at?: string;
|
|
174
|
+
validation_rule_id?: string;
|
|
175
|
+
loyalty: LoyaltyFixed | LoyaltyProportional;
|
|
176
|
+
segment?: {
|
|
177
|
+
id: string;
|
|
178
|
+
};
|
|
179
|
+
event: 'customer.segment.entered' | 'order.paid' | string;
|
|
180
|
+
source?: {
|
|
181
|
+
banner?: string;
|
|
182
|
+
object_id?: string;
|
|
183
|
+
object_type?: string;
|
|
184
|
+
};
|
|
185
|
+
object: 'earning_rule';
|
|
186
|
+
automation_id: string;
|
|
187
|
+
}
|
|
188
|
+
interface LoyaltiesListEarningRulesResponse {
|
|
189
|
+
object: 'list';
|
|
190
|
+
total: number;
|
|
191
|
+
data_ref: string;
|
|
192
|
+
data: LoyaltiesEarningRulesResponse[];
|
|
193
|
+
}
|
|
194
|
+
interface LoyaltiesCreateEarningRule {
|
|
195
|
+
event: 'order.paid' | 'customer.segment.entered' | string;
|
|
196
|
+
validation_rule_id?: string;
|
|
197
|
+
loyalty: LoyaltyProportional | LoyaltyFixed;
|
|
198
|
+
source?: {
|
|
199
|
+
banner?: string;
|
|
200
|
+
};
|
|
201
|
+
custom_event?: {
|
|
202
|
+
schema_id?: string;
|
|
203
|
+
};
|
|
204
|
+
segment?: {
|
|
205
|
+
id?: string;
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
type LoyaltiesCreateEarningRuleResponse = LoyaltiesEarningRulesResponse;
|
|
209
|
+
interface LoyaltiesUpdateEarningRule {
|
|
210
|
+
id: string;
|
|
211
|
+
validation_rule_id?: string;
|
|
212
|
+
source?: {
|
|
213
|
+
banner: string;
|
|
214
|
+
};
|
|
215
|
+
loyalty?: {
|
|
216
|
+
points: number;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
type LoyaltiesUpdateEarningRuleResponse = LoyaltiesEarningRulesResponse;
|
|
220
|
+
interface LoyaltiesListMembersParams {
|
|
221
|
+
limit?: number;
|
|
222
|
+
page?: number;
|
|
223
|
+
created_at?: {
|
|
224
|
+
before?: string;
|
|
225
|
+
after?: string;
|
|
226
|
+
};
|
|
227
|
+
updated_at?: {
|
|
228
|
+
before?: string;
|
|
229
|
+
after?: string;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
interface LoyaltiesVoucherResponse {
|
|
233
|
+
id: string;
|
|
234
|
+
code: string;
|
|
235
|
+
campaign: string;
|
|
236
|
+
campaign_id: string;
|
|
237
|
+
category?: string;
|
|
238
|
+
type: 'LOYALTY_CARD';
|
|
239
|
+
loyalty_card: {
|
|
240
|
+
points: number;
|
|
241
|
+
balance: number;
|
|
242
|
+
next_expiration_date?: string;
|
|
243
|
+
next_expiration_points?: number;
|
|
244
|
+
};
|
|
245
|
+
start_date?: string;
|
|
246
|
+
expiration_date?: string;
|
|
247
|
+
validity_timeframe?: {
|
|
248
|
+
interval?: string;
|
|
249
|
+
duration?: string;
|
|
250
|
+
};
|
|
251
|
+
validity_day_of_week?: number[];
|
|
252
|
+
publish?: {
|
|
253
|
+
count?: number;
|
|
254
|
+
entries?: string[];
|
|
255
|
+
};
|
|
256
|
+
redemption?: {
|
|
257
|
+
quantity?: number;
|
|
258
|
+
redeemed_points?: number;
|
|
259
|
+
redeemed_quantity?: number;
|
|
260
|
+
redemption_entries?: string[];
|
|
261
|
+
};
|
|
262
|
+
active?: boolean;
|
|
263
|
+
additional_info?: string;
|
|
264
|
+
metadata?: Record<string, any>;
|
|
265
|
+
is_referral_code?: boolean;
|
|
266
|
+
holder_id?: string;
|
|
267
|
+
updated_at?: string;
|
|
268
|
+
}
|
|
269
|
+
interface LoyaltiesListMembersResponse {
|
|
270
|
+
object: 'list';
|
|
271
|
+
total: number;
|
|
272
|
+
data_ref: 'vouchers';
|
|
273
|
+
vouchers: LoyaltiesVoucherResponse[];
|
|
274
|
+
}
|
|
275
|
+
interface LoyaltiesCreateMember {
|
|
276
|
+
voucher?: string;
|
|
277
|
+
channel?: string;
|
|
278
|
+
customer: {
|
|
279
|
+
id?: string;
|
|
280
|
+
name?: string;
|
|
281
|
+
email?: string;
|
|
282
|
+
metadata?: Record<string, any>;
|
|
283
|
+
description?: string;
|
|
284
|
+
source_id?: string;
|
|
285
|
+
};
|
|
286
|
+
metadata?: Record<string, any>;
|
|
287
|
+
}
|
|
288
|
+
type LoyaltiesCreateMemberResponse = LoyaltiesVoucherResponse;
|
|
289
|
+
type LoyaltiesGetMemberResponse = LoyaltiesCreateMemberResponse;
|
|
290
|
+
type LoyaltiesListMemberActivityParams = {
|
|
291
|
+
order?: 'created_at' | '-created_at';
|
|
292
|
+
starting_after_id?: string;
|
|
293
|
+
limit?: number;
|
|
294
|
+
};
|
|
295
|
+
type LoyaltiesListMemberActivityResponse = {
|
|
296
|
+
object: 'list';
|
|
297
|
+
data_ref: 'data';
|
|
298
|
+
data: {
|
|
299
|
+
id: string;
|
|
300
|
+
type: string;
|
|
301
|
+
data: any;
|
|
302
|
+
created_at: string;
|
|
303
|
+
group_id: string;
|
|
304
|
+
}[];
|
|
305
|
+
has_more: boolean;
|
|
306
|
+
more_starting_after?: string;
|
|
307
|
+
};
|
|
308
|
+
interface LoyaltiesGetMemberActivitiesResponse {
|
|
309
|
+
object: 'list';
|
|
310
|
+
data_ref: 'activities';
|
|
311
|
+
total: number;
|
|
312
|
+
activities: {
|
|
313
|
+
id: string;
|
|
314
|
+
type: string;
|
|
315
|
+
object: string;
|
|
316
|
+
created_at: string;
|
|
317
|
+
data: any;
|
|
318
|
+
}[];
|
|
319
|
+
}
|
|
320
|
+
interface LoyaltiesAddPoints {
|
|
321
|
+
points: number;
|
|
322
|
+
}
|
|
323
|
+
interface LoyaltiesAddPointsResponse {
|
|
324
|
+
points: number;
|
|
325
|
+
total: number;
|
|
326
|
+
balance: number;
|
|
327
|
+
type: string;
|
|
328
|
+
object: 'balance';
|
|
329
|
+
related_object?: {
|
|
330
|
+
type?: string;
|
|
331
|
+
id?: string;
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
interface LoyaltiesRedeemRewardParams {
|
|
335
|
+
reward: {
|
|
336
|
+
id: string;
|
|
337
|
+
};
|
|
338
|
+
order?: {
|
|
339
|
+
id?: string;
|
|
340
|
+
source_id?: string;
|
|
341
|
+
amount: number;
|
|
342
|
+
items?: OrdersItem[];
|
|
343
|
+
metadata?: Record<string, any>;
|
|
344
|
+
};
|
|
345
|
+
metadata?: Record<string, any>;
|
|
346
|
+
}
|
|
347
|
+
interface CoinReward {
|
|
348
|
+
assignment_id: string;
|
|
349
|
+
loyalty_tier_id: string;
|
|
350
|
+
id: string;
|
|
351
|
+
name: string;
|
|
352
|
+
created_at: string;
|
|
353
|
+
updated_at?: string;
|
|
354
|
+
parameters: {
|
|
355
|
+
automation_id?: string;
|
|
356
|
+
coin: {
|
|
357
|
+
exchange_ratio: number;
|
|
358
|
+
points_ratio: number;
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
type: 'COIN';
|
|
362
|
+
object: 'reward';
|
|
363
|
+
}
|
|
364
|
+
interface MaterialReward {
|
|
365
|
+
assignment_id: string;
|
|
366
|
+
loyalty_tier_id: string;
|
|
367
|
+
product: ProductsCreateResponse & ProductsCreateSkuResponse;
|
|
368
|
+
id: string;
|
|
369
|
+
name: string;
|
|
370
|
+
created_at: string;
|
|
371
|
+
updated_at?: string;
|
|
372
|
+
parameters: {
|
|
373
|
+
automation_id?: string;
|
|
374
|
+
product?: {
|
|
375
|
+
id: string;
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
type: 'MATERIAL';
|
|
379
|
+
object: 'reward';
|
|
380
|
+
}
|
|
381
|
+
interface CampaignReward {
|
|
382
|
+
assignment_id: string;
|
|
383
|
+
loyalty_tier_id: string;
|
|
384
|
+
voucher: VouchersResponse;
|
|
385
|
+
id: string;
|
|
386
|
+
name: string;
|
|
387
|
+
created_at: string;
|
|
388
|
+
updated_at?: string;
|
|
389
|
+
parameters: {
|
|
390
|
+
automation_id?: string;
|
|
391
|
+
campaign?: {
|
|
392
|
+
id: string;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
type: 'CAMPAIGN';
|
|
396
|
+
object: 'reward';
|
|
397
|
+
}
|
|
398
|
+
interface LoyaltiesRedeemRewardResponse {
|
|
399
|
+
id: string;
|
|
400
|
+
object: 'redemption';
|
|
401
|
+
date: string;
|
|
402
|
+
customer_id: string;
|
|
403
|
+
amount: number;
|
|
404
|
+
order?: Omit<OrdersCreateResponse, 'customer'> & {
|
|
405
|
+
total_discount_amount: number;
|
|
406
|
+
total_amount: number;
|
|
407
|
+
customer: {
|
|
408
|
+
id: string;
|
|
409
|
+
object: 'customer';
|
|
410
|
+
referrals: {
|
|
411
|
+
campaigns: any[];
|
|
412
|
+
total: number;
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
customer: SimpleCustomer;
|
|
417
|
+
reward: MaterialReward | CampaignReward | CoinReward;
|
|
418
|
+
result: 'SUCCESS' | 'FAILURE';
|
|
419
|
+
tracking_id?: string;
|
|
420
|
+
voucher: {
|
|
421
|
+
id: string;
|
|
422
|
+
code?: string;
|
|
423
|
+
campaign?: string;
|
|
424
|
+
campaign_id?: string;
|
|
425
|
+
category?: string;
|
|
426
|
+
type: 'LOYALTY_CARD';
|
|
427
|
+
loyalty_card?: {
|
|
428
|
+
points: number;
|
|
429
|
+
balance: number;
|
|
430
|
+
};
|
|
431
|
+
start_date?: string;
|
|
432
|
+
expiration_date?: string;
|
|
433
|
+
validity_timeframe?: {
|
|
434
|
+
interval?: string;
|
|
435
|
+
duration?: string;
|
|
436
|
+
};
|
|
437
|
+
validity_day_of_week?: number[];
|
|
438
|
+
publish: {
|
|
439
|
+
object: 'list';
|
|
440
|
+
count: number;
|
|
441
|
+
url: string;
|
|
442
|
+
};
|
|
443
|
+
redemption: {
|
|
444
|
+
object: 'list';
|
|
445
|
+
quantity: number;
|
|
446
|
+
redeemed_quantity: number;
|
|
447
|
+
url: string;
|
|
448
|
+
redeemed_points: number;
|
|
449
|
+
};
|
|
450
|
+
active: true;
|
|
451
|
+
additional_info?: string;
|
|
452
|
+
assets?: {
|
|
453
|
+
qr?: {
|
|
454
|
+
id: string;
|
|
455
|
+
url: string;
|
|
456
|
+
};
|
|
457
|
+
barcode?: {
|
|
458
|
+
id: string;
|
|
459
|
+
url: string;
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
is_referral_code: boolean;
|
|
463
|
+
referrer_id: string;
|
|
464
|
+
holder_id: string;
|
|
465
|
+
created_at: string;
|
|
466
|
+
updated_at: string;
|
|
467
|
+
holder: {
|
|
468
|
+
id: string;
|
|
469
|
+
source_id: string;
|
|
470
|
+
metadata?: Record<string, any>;
|
|
471
|
+
object: 'customer';
|
|
472
|
+
};
|
|
473
|
+
object?: 'voucher';
|
|
474
|
+
validation_rules_assignments: {
|
|
475
|
+
object: 'list';
|
|
476
|
+
total: number;
|
|
477
|
+
data_ref: 'data';
|
|
478
|
+
data?: {
|
|
479
|
+
id: string;
|
|
480
|
+
rule_id?: string;
|
|
481
|
+
related_object_id?: string;
|
|
482
|
+
related_object_type?: string;
|
|
483
|
+
created_at: string;
|
|
484
|
+
object: 'validation_rules_assignment';
|
|
485
|
+
}[];
|
|
486
|
+
};
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
interface LoyaltyPointsTransfer {
|
|
490
|
+
code: string;
|
|
491
|
+
points: number;
|
|
492
|
+
}
|
|
493
|
+
type LoyaltiesTransferPointsResponseBody = {
|
|
494
|
+
id: string;
|
|
495
|
+
code: string;
|
|
496
|
+
campaign: string;
|
|
497
|
+
campaign_id: string;
|
|
498
|
+
category: string | null;
|
|
499
|
+
category_id: string | null;
|
|
500
|
+
categories: Category[];
|
|
501
|
+
type: 'LOYALTY_CARD';
|
|
502
|
+
loyalty_card: {
|
|
503
|
+
points: number;
|
|
504
|
+
balance: number;
|
|
505
|
+
next_expiration_date?: string;
|
|
506
|
+
next_expiration_points?: number;
|
|
507
|
+
};
|
|
508
|
+
start_date: string | null;
|
|
509
|
+
expiration_date: string | null;
|
|
510
|
+
validity_timeframe: {
|
|
511
|
+
interval?: string;
|
|
512
|
+
duration?: string;
|
|
513
|
+
} | null;
|
|
514
|
+
validity_day_of_week: number[] | null;
|
|
515
|
+
publish?: {
|
|
516
|
+
object: 'list';
|
|
517
|
+
count?: number;
|
|
518
|
+
entries?: string[];
|
|
519
|
+
url?: string;
|
|
520
|
+
};
|
|
521
|
+
redemption?: {
|
|
522
|
+
quantity: number | null;
|
|
523
|
+
redeemed_points?: number;
|
|
524
|
+
redeemed_quantity?: number;
|
|
525
|
+
redemption_entries?: string[];
|
|
526
|
+
object?: 'list';
|
|
527
|
+
url?: string;
|
|
528
|
+
};
|
|
529
|
+
active: boolean;
|
|
530
|
+
additional_info: string | null;
|
|
531
|
+
metadata: Record<string, unknown>;
|
|
532
|
+
is_referral_code: boolean;
|
|
533
|
+
holder_id?: string;
|
|
534
|
+
updated_at?: string;
|
|
535
|
+
created_at: string;
|
|
536
|
+
};
|
|
537
|
+
type LoyaltiesTransferPointsRequestBody = LoyaltiesTransferPoints[];
|
|
538
|
+
interface LoyaltiesListCardTransactionsRequestQuery {
|
|
539
|
+
limit?: number;
|
|
540
|
+
starting_after_id?: string;
|
|
541
|
+
order?: 'id' | '-id';
|
|
542
|
+
/**
|
|
543
|
+
* @deprecated Use starting_after_id
|
|
544
|
+
*/
|
|
545
|
+
page?: number;
|
|
546
|
+
}
|
|
547
|
+
interface LoyaltiesListCardTransactionsResponseBody {
|
|
548
|
+
object: 'list';
|
|
549
|
+
data_ref: 'data';
|
|
550
|
+
data: LoyaltyCardTransaction[];
|
|
551
|
+
has_more: boolean;
|
|
552
|
+
more_starting_after?: string;
|
|
553
|
+
}
|
|
554
|
+
type LoyaltiesExportCardTransactionsRequestBody = VouchersExportTransactionsRequestBody;
|
|
555
|
+
type LoyaltiesCreateTiersRequestBody = (LoyaltyTierBase & {
|
|
556
|
+
metadata?: Record<string, unknown>;
|
|
557
|
+
})[];
|
|
558
|
+
type LoyaltiesCreateTiersResponseBody = LoyaltyTier[];
|
|
559
|
+
type LoyaltiesGetRewardDetailsResponseBody = Reward;
|
|
560
|
+
interface LoyaltiesListTiersRequestQuery {
|
|
561
|
+
limit?: number;
|
|
562
|
+
page?: number;
|
|
563
|
+
order?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at';
|
|
564
|
+
}
|
|
565
|
+
interface LoyaltiesListLoyaltyTierEarningRulesRequestQuery {
|
|
566
|
+
limit?: number;
|
|
567
|
+
page?: number;
|
|
568
|
+
}
|
|
569
|
+
type LoyaltiesGetTierResponseBody = LoyaltyTier;
|
|
570
|
+
interface LoyaltiesListTiersResponseBody {
|
|
571
|
+
object: 'list';
|
|
572
|
+
data_ref: 'data';
|
|
573
|
+
data: LoyaltyTier[];
|
|
574
|
+
total: number;
|
|
575
|
+
}
|
|
576
|
+
interface LoyaltiesListMemberLoyaltyTiersResponseBody {
|
|
577
|
+
object: 'list';
|
|
578
|
+
data_ref: 'data';
|
|
579
|
+
data: LoyaltyTier[];
|
|
580
|
+
total: number;
|
|
581
|
+
}
|
|
582
|
+
interface LoyaltiesListMemberRewardsRequestQuery {
|
|
583
|
+
affordable_only?: boolean;
|
|
584
|
+
limit?: number;
|
|
585
|
+
page?: number;
|
|
586
|
+
}
|
|
587
|
+
interface LoyaltiesListMemberRewardsRequestQuery {
|
|
588
|
+
affordable_only?: boolean;
|
|
589
|
+
limit?: number;
|
|
590
|
+
page?: number;
|
|
591
|
+
}
|
|
592
|
+
interface LoyaltiesListMemberRewardsResponseBody {
|
|
593
|
+
object: 'list';
|
|
594
|
+
data_ref: 'data';
|
|
595
|
+
data: {
|
|
596
|
+
reward: Reward;
|
|
597
|
+
assignment: RewardAssignment;
|
|
598
|
+
object: 'loyalty_reward';
|
|
599
|
+
}[];
|
|
600
|
+
total: number;
|
|
601
|
+
}
|
|
602
|
+
interface LoyaltiesListMemberRewardsResponseBody {
|
|
603
|
+
object: 'list';
|
|
604
|
+
data_ref: 'data';
|
|
605
|
+
data: {
|
|
606
|
+
reward: Reward;
|
|
607
|
+
assignment: RewardAssignment;
|
|
608
|
+
object: 'loyalty_reward';
|
|
609
|
+
}[];
|
|
610
|
+
total: number;
|
|
611
|
+
}
|
|
612
|
+
interface LoyaltiesGetPointsExpirationRequestQuery {
|
|
613
|
+
limit?: number;
|
|
614
|
+
page?: number;
|
|
615
|
+
}
|
|
616
|
+
interface LoyaltiesGetPointsExpirationRequestQuery {
|
|
617
|
+
limit?: number;
|
|
618
|
+
page?: number;
|
|
619
|
+
}
|
|
620
|
+
interface LoyaltiesGetPointsExpirationResponseBody {
|
|
621
|
+
object: 'list';
|
|
622
|
+
data_ref: 'data';
|
|
623
|
+
data: {
|
|
624
|
+
id: string;
|
|
625
|
+
voucher_id: string;
|
|
626
|
+
campaign_id: string;
|
|
627
|
+
bucket: {
|
|
628
|
+
total_points: number;
|
|
629
|
+
};
|
|
630
|
+
created_at: string;
|
|
631
|
+
status: string;
|
|
632
|
+
expires_at: string;
|
|
633
|
+
updated_at?: string;
|
|
634
|
+
object: 'loyalty_points_bucket';
|
|
635
|
+
}[];
|
|
636
|
+
total: number;
|
|
637
|
+
}
|
|
638
|
+
interface LoyaltiesGetPointsExpirationResponseBody {
|
|
639
|
+
object: 'list';
|
|
640
|
+
data_ref: 'data';
|
|
641
|
+
data: {
|
|
642
|
+
id: string;
|
|
643
|
+
voucher_id: string;
|
|
644
|
+
campaign_id: string;
|
|
645
|
+
bucket: {
|
|
646
|
+
total_points: number;
|
|
647
|
+
};
|
|
648
|
+
created_at: string;
|
|
649
|
+
status: string;
|
|
650
|
+
expires_at: string;
|
|
651
|
+
updated_at?: string;
|
|
652
|
+
object: 'loyalty_points_bucket';
|
|
653
|
+
}[];
|
|
654
|
+
total: number;
|
|
655
|
+
}
|
|
656
|
+
type LoyaltiesExportCardTransactionsResponseBody = VouchersExportTransactionsResponseBody;
|
|
657
|
+
interface LoyaltiesAddOrRemoveCardBalanceRequestBody {
|
|
658
|
+
points: number;
|
|
659
|
+
expiration_date?: string;
|
|
660
|
+
expiration_type?: PointsExpirationTypes;
|
|
661
|
+
reason?: string;
|
|
662
|
+
source_id?: string;
|
|
663
|
+
}
|
|
664
|
+
interface LoyaltiesAddOrRemoveCardBalanceRequestBody {
|
|
665
|
+
points: number;
|
|
666
|
+
expiration_date?: string;
|
|
667
|
+
expiration_type?: PointsExpirationTypes;
|
|
668
|
+
reason?: string;
|
|
669
|
+
source_id?: string;
|
|
670
|
+
}
|
|
671
|
+
interface LoyaltiesAddOrRemoveCardBalanceResponseBody {
|
|
672
|
+
points?: number;
|
|
673
|
+
amount?: number;
|
|
674
|
+
total: number;
|
|
675
|
+
balance: number;
|
|
676
|
+
type: 'LOYALTY_CARD' | 'GIFT_VOUCHER';
|
|
677
|
+
object: 'balance';
|
|
678
|
+
related_object: {
|
|
679
|
+
type: 'voucher';
|
|
680
|
+
id: string;
|
|
681
|
+
};
|
|
682
|
+
operation_type?: 'MANUAL' | 'AUTOMATIC';
|
|
683
|
+
}
|
|
684
|
+
interface LoyaltiesAddOrRemoveCardBalanceResponseBody {
|
|
685
|
+
points?: number;
|
|
686
|
+
amount?: number;
|
|
687
|
+
total: number;
|
|
688
|
+
balance: number;
|
|
689
|
+
type: 'LOYALTY_CARD' | 'GIFT_VOUCHER';
|
|
690
|
+
object: 'balance';
|
|
691
|
+
related_object: {
|
|
692
|
+
type: 'voucher';
|
|
693
|
+
id: string;
|
|
694
|
+
};
|
|
695
|
+
operation_type?: 'MANUAL' | 'AUTOMATIC';
|
|
696
|
+
}
|
|
697
|
+
type LoyaltiesGetEarningRuleResponseBody = EarningRule;
|
|
698
|
+
type LoyaltiesEnableEarningRulesResponseBody = EarningRuleBase & {
|
|
699
|
+
updated_at: string | null;
|
|
700
|
+
active: true;
|
|
701
|
+
};
|
|
702
|
+
type LoyaltiesDisableEarningRulesResponseBody = EarningRuleBase & {
|
|
703
|
+
updated_at: string | null;
|
|
704
|
+
active: false;
|
|
705
|
+
};
|
|
706
|
+
type LoyaltiesListLoyaltyTierEarningRulesResponseBody = {
|
|
707
|
+
object: 'list';
|
|
708
|
+
data_ref: 'data';
|
|
709
|
+
data: EarningRule[];
|
|
710
|
+
total: number;
|
|
711
|
+
};
|
|
712
|
+
type LoyaltiesGetRewardAssignmentResponseBody = RewardAssignment;
|
|
713
|
+
interface LoyaltiesListLoyaltyTierRewardsResponseBody {
|
|
714
|
+
object: 'list';
|
|
715
|
+
data_ref: 'data';
|
|
716
|
+
total: number;
|
|
717
|
+
data: {
|
|
718
|
+
reward: {
|
|
719
|
+
id: string;
|
|
720
|
+
name: string;
|
|
721
|
+
stock: number | null;
|
|
722
|
+
redeemed: number | null;
|
|
723
|
+
attributes?: {
|
|
724
|
+
image_url?: string;
|
|
725
|
+
description?: string;
|
|
726
|
+
};
|
|
727
|
+
metadata: Record<string, undefined>;
|
|
728
|
+
created_at: string;
|
|
729
|
+
updated_at: string | null;
|
|
730
|
+
object: 'reward';
|
|
731
|
+
} & LoyaltyTierRewardItemParameters;
|
|
732
|
+
assignment: RewardAssignment;
|
|
733
|
+
object: 'loyalty_tier_reward';
|
|
734
|
+
}[];
|
|
735
|
+
}
|
|
736
|
+
interface LoyaltyTierBase {
|
|
737
|
+
name: string;
|
|
738
|
+
earning_rules?: Record<string, MappingMultiply | MappingFixed>;
|
|
739
|
+
rewards?: Record<string, MappingMultiply | MappingFixed>;
|
|
740
|
+
points: {
|
|
741
|
+
from?: number;
|
|
742
|
+
to?: number;
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
type LoyaltyTier = LoyaltyTierBase & {
|
|
746
|
+
id: string;
|
|
747
|
+
campaign_id: string;
|
|
748
|
+
metadata: Record<string, unknown> | null;
|
|
749
|
+
created_at: string;
|
|
750
|
+
updated_at?: string | null;
|
|
751
|
+
config: {
|
|
752
|
+
points: {
|
|
753
|
+
from?: number;
|
|
754
|
+
to?: number;
|
|
755
|
+
};
|
|
756
|
+
};
|
|
757
|
+
expiration?: {
|
|
758
|
+
customer_id: string;
|
|
759
|
+
campaign_id: string;
|
|
760
|
+
tier_id: string;
|
|
761
|
+
start_date?: string;
|
|
762
|
+
expiration_date?: string;
|
|
763
|
+
created_at: string;
|
|
764
|
+
updated_at?: string;
|
|
765
|
+
};
|
|
766
|
+
object: 'loyalty_tier';
|
|
767
|
+
};
|
|
768
|
+
interface MappingMultiply {
|
|
769
|
+
type: 'MULTIPLY';
|
|
770
|
+
multiplier: number;
|
|
771
|
+
}
|
|
772
|
+
interface MappingFixed {
|
|
773
|
+
type: 'CUSTOM';
|
|
774
|
+
points: number;
|
|
775
|
+
}
|
|
776
|
+
type LoyaltyCardTransactionsFields = 'id' | 'campaign_id' | 'voucher_id' | 'type' | 'source_id' | 'reason' | 'source' | 'balance' | 'amount' | 'related_transaction_id' | 'created_at' | 'details';
|
|
777
|
+
type LoyaltyCardTransactionsType = 'POINTS_ACCRUAL' | 'POINTS_CANCELLATION' | 'POINTS_REDEMPTION' | 'POINTS_REFUND' | 'POINTS_ADDITION' | 'POINTS_REMOVAL' | 'POINTS_EXPIRATION' | 'POINTS_TRANSFER_IN' | 'POINTS_TRANSFER_OUT';
|
|
778
|
+
type EarningRule = EarningRuleBase & {
|
|
779
|
+
validation_rule_id: string | null;
|
|
780
|
+
updated_at: string | null;
|
|
781
|
+
active: boolean;
|
|
782
|
+
};
|
|
783
|
+
type PointsExpirationTypes = 'PROGRAM_RULES' | 'CUSTOM_DATE' | 'NON_EXPIRING';
|
|
784
|
+
interface LoyaltyCardTransaction {
|
|
785
|
+
id: string;
|
|
786
|
+
source_id: string | null;
|
|
787
|
+
voucher_id: string;
|
|
788
|
+
campaign_id: string;
|
|
789
|
+
source: string | null;
|
|
790
|
+
reason: string | null;
|
|
791
|
+
type: LoyaltyCardTransactionsType;
|
|
792
|
+
details: {
|
|
793
|
+
balance: {
|
|
794
|
+
type: 'loyalty_card';
|
|
795
|
+
total: number;
|
|
796
|
+
object: 'balance';
|
|
797
|
+
operation_type: 'MANUAL' | 'AUTOMATIC';
|
|
798
|
+
points: number;
|
|
799
|
+
balance: number;
|
|
800
|
+
related_object: {
|
|
801
|
+
id: string;
|
|
802
|
+
type: 'voucher';
|
|
803
|
+
};
|
|
804
|
+
};
|
|
805
|
+
order?: {
|
|
806
|
+
id: string;
|
|
807
|
+
source_id: string;
|
|
808
|
+
};
|
|
809
|
+
event?: {
|
|
810
|
+
id: string;
|
|
811
|
+
type: string;
|
|
812
|
+
};
|
|
813
|
+
earning_rule?: {
|
|
814
|
+
id: string;
|
|
815
|
+
source: {
|
|
816
|
+
banner: string;
|
|
817
|
+
};
|
|
818
|
+
};
|
|
819
|
+
segment?: {
|
|
820
|
+
id: string;
|
|
821
|
+
name: string;
|
|
822
|
+
};
|
|
823
|
+
loyalty_tier?: {
|
|
824
|
+
id: string;
|
|
825
|
+
name: string;
|
|
826
|
+
};
|
|
827
|
+
redemption?: {
|
|
828
|
+
id: string;
|
|
829
|
+
};
|
|
830
|
+
rollback?: {
|
|
831
|
+
id: string;
|
|
832
|
+
};
|
|
833
|
+
reward?: {
|
|
834
|
+
id: string;
|
|
835
|
+
name: string;
|
|
836
|
+
};
|
|
837
|
+
custom_event?: {
|
|
838
|
+
id: string;
|
|
839
|
+
type: string;
|
|
840
|
+
};
|
|
841
|
+
event_schema?: {
|
|
842
|
+
id: string;
|
|
843
|
+
name: string;
|
|
844
|
+
};
|
|
845
|
+
source_voucher?: SimpleLoyaltyVoucher;
|
|
846
|
+
destination_voucher?: SimpleLoyaltyVoucher;
|
|
847
|
+
};
|
|
848
|
+
related_transaction_id: string | null;
|
|
849
|
+
created_at: string;
|
|
850
|
+
}
|
|
851
|
+
interface SimpleLoyaltyVoucher {
|
|
852
|
+
id: string;
|
|
853
|
+
code: string;
|
|
854
|
+
loyalty_card: {
|
|
855
|
+
points: number;
|
|
856
|
+
balance: number;
|
|
857
|
+
next_expiration_date?: string;
|
|
858
|
+
next_expiration_points?: string;
|
|
859
|
+
};
|
|
860
|
+
type: 'LOYALTY_CARD';
|
|
861
|
+
campaign: string;
|
|
862
|
+
campaign_id: string;
|
|
863
|
+
is_referral_code?: boolean;
|
|
864
|
+
holder_id?: string;
|
|
865
|
+
referrer_id?: string;
|
|
866
|
+
created_at?: string;
|
|
867
|
+
object: 'voucher';
|
|
868
|
+
}
|
|
869
|
+
interface SimpleLoyaltyVoucher {
|
|
870
|
+
id: string;
|
|
871
|
+
code: string;
|
|
872
|
+
loyalty_card: {
|
|
873
|
+
points: number;
|
|
874
|
+
balance: number;
|
|
875
|
+
next_expiration_date?: string;
|
|
876
|
+
next_expiration_points?: string;
|
|
877
|
+
};
|
|
878
|
+
type: 'LOYALTY_CARD';
|
|
879
|
+
campaign: string;
|
|
880
|
+
campaign_id: string;
|
|
881
|
+
is_referral_code?: boolean;
|
|
882
|
+
holder_id?: string;
|
|
883
|
+
referrer_id?: string;
|
|
884
|
+
created_at?: string;
|
|
885
|
+
object: 'voucher';
|
|
886
|
+
}
|
|
887
|
+
interface LoyaltiesTransferPoints {
|
|
888
|
+
code: string;
|
|
889
|
+
points: number;
|
|
890
|
+
reason?: string;
|
|
891
|
+
source_id: string;
|
|
892
|
+
}
|
|
893
|
+
interface LoyaltiesTransferPoints {
|
|
894
|
+
code: string;
|
|
895
|
+
points: number;
|
|
896
|
+
reason?: string;
|
|
897
|
+
source_id: string;
|
|
898
|
+
}
|
|
899
|
+
interface EarningRuleBase {
|
|
900
|
+
id: string;
|
|
901
|
+
created_at: string;
|
|
902
|
+
loyalty: EarningRuleFixed | EarningRuleProportional;
|
|
903
|
+
event?: EarningRuleEvent;
|
|
904
|
+
custom_event?: {
|
|
905
|
+
schema_id: string;
|
|
906
|
+
};
|
|
907
|
+
segment?: {
|
|
908
|
+
id: string;
|
|
909
|
+
};
|
|
910
|
+
source: {
|
|
911
|
+
banner?: string;
|
|
912
|
+
object_id: string;
|
|
913
|
+
object_type: 'campaign';
|
|
914
|
+
};
|
|
915
|
+
loyalty_tier?: {
|
|
916
|
+
id: string;
|
|
917
|
+
};
|
|
918
|
+
object: 'earning_rule';
|
|
919
|
+
automation_id: string;
|
|
920
|
+
start_date?: string;
|
|
921
|
+
expiration_date?: string;
|
|
922
|
+
validity_timeframe?: {
|
|
923
|
+
duration: string;
|
|
924
|
+
interval: string;
|
|
925
|
+
};
|
|
926
|
+
validity_day_of_week?: number[];
|
|
927
|
+
metadata: Record<string, unknown>;
|
|
928
|
+
}
|
|
929
|
+
type EarningRuleEvent = 'order.paid' | 'customer.segment.entered' | 'custom_event' | 'customer.loyalty.tier.upgraded' | 'customer.loyalty.tier.downgraded' | 'customer.loyalty.tier.prolonged' | 'customer.loyalty.tier.joined' | 'customer.loyalty.tier.left';
|
|
930
|
+
interface EarningRuleFixed {
|
|
931
|
+
type: 'FIXED';
|
|
932
|
+
points: number;
|
|
933
|
+
}
|
|
934
|
+
type EarningRuleProportionalOrder = EarningRuleProportionalOrderAmount | EarningRuleProportionalOrderTotalAmount | EarningRuleProportionalOrderMetadata;
|
|
935
|
+
interface EarningRuleProportionalOrderAmount {
|
|
936
|
+
type: 'PROPORTIONAL';
|
|
937
|
+
calculation_type: 'ORDER_AMOUNT';
|
|
938
|
+
order: {
|
|
939
|
+
amount: {
|
|
940
|
+
every: number;
|
|
941
|
+
points: number;
|
|
942
|
+
};
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
interface EarningRuleProportionalOrderTotalAmount {
|
|
946
|
+
type: 'PROPORTIONAL';
|
|
947
|
+
calculation_type: 'ORDER_TOTAL_AMOUNT';
|
|
948
|
+
order: {
|
|
949
|
+
total_amount: {
|
|
950
|
+
every: number;
|
|
951
|
+
points: number;
|
|
952
|
+
};
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
interface EarningRuleProportionalOrderMetadata {
|
|
956
|
+
type: 'PROPORTIONAL';
|
|
957
|
+
calculation_type: 'ORDER_METADATA';
|
|
958
|
+
order: {
|
|
959
|
+
metadata: {
|
|
960
|
+
every: number;
|
|
961
|
+
points: number;
|
|
962
|
+
property: string;
|
|
963
|
+
};
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
type EarningRuleProportional = EarningRuleProportionalOrder | EarningRuleProportionalOrderItems | EarningRuleProportionalCustomerMetadata | EarningRuleProportionalCustomEvent;
|
|
967
|
+
type EarningRuleProportionalOrderItems = EarningRuleProportionalOrderItemsQuantity | EarningRuleProportionalOrderItemsAmount | EarningRuleProportionalOrderItemsSubtotalAmount;
|
|
968
|
+
interface EarningRuleProportionalOrderItemsQuantity {
|
|
969
|
+
type: 'PROPORTIONAL';
|
|
970
|
+
calculation_type: 'ORDER_ITEMS_QUANTITY';
|
|
971
|
+
order_items: {
|
|
972
|
+
quantity: {
|
|
973
|
+
every: number;
|
|
974
|
+
points: number;
|
|
975
|
+
object: `products_collection` | `product` | `sku`;
|
|
976
|
+
id: string;
|
|
977
|
+
};
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
interface EarningRuleProportionalOrderItemsAmount {
|
|
981
|
+
type: 'PROPORTIONAL';
|
|
982
|
+
calculation_type: 'ORDER_ITEMS_AMOUNT';
|
|
983
|
+
order_items: {
|
|
984
|
+
amount: {
|
|
985
|
+
every: number;
|
|
986
|
+
points: number;
|
|
987
|
+
object: `products_collection` | `product` | `sku`;
|
|
988
|
+
id: string;
|
|
989
|
+
};
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
interface EarningRuleProportionalOrderItemsSubtotalAmount {
|
|
993
|
+
type: 'PROPORTIONAL';
|
|
994
|
+
calculation_type: 'ORDER_ITEMS_SUBTOTAL_AMOUNT';
|
|
995
|
+
order_items: {
|
|
996
|
+
subtotal_amount: {
|
|
997
|
+
every: number;
|
|
998
|
+
points: number;
|
|
999
|
+
object: `products_collection` | `product` | `sku`;
|
|
1000
|
+
id: string;
|
|
1001
|
+
};
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
interface EarningRuleProportionalCustomerMetadata {
|
|
1005
|
+
type: 'PROPORTIONAL';
|
|
1006
|
+
calculation_type: 'CUSTOMER_METADATA';
|
|
1007
|
+
customer: {
|
|
1008
|
+
metadata: {
|
|
1009
|
+
every: number;
|
|
1010
|
+
points: number;
|
|
1011
|
+
property: string;
|
|
1012
|
+
};
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
interface EarningRuleProportionalCustomEvent {
|
|
1016
|
+
type: 'PROPORTIONAL';
|
|
1017
|
+
calculation_type: 'CUSTOM_EVENT_METADATA';
|
|
1018
|
+
custom_event: {
|
|
1019
|
+
metadata: {
|
|
1020
|
+
every: number;
|
|
1021
|
+
points: number;
|
|
1022
|
+
property: string;
|
|
1023
|
+
};
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
type LoyaltyTierRewardItemParameters = LoyaltyTierRewardItemCampaignParameters | LoyaltyTierRewardItemCoinParameters | LoyaltyTierRewardItemMaterialParameters;
|
|
1027
|
+
interface LoyaltyTierRewardItemCampaignParameters {
|
|
1028
|
+
type: 'CAMPAIGN';
|
|
1029
|
+
parameters: {
|
|
1030
|
+
campaign: LoyaltyTierRewardItemCampaignDiscountCoupons | LoyaltyTierRewardItemCampaignGiftVouchersAndLoyaltyProgram;
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
interface LoyaltyTierRewardItemCoinParameters {
|
|
1034
|
+
type: 'COIN';
|
|
1035
|
+
parameters: {
|
|
1036
|
+
coin: {
|
|
1037
|
+
exchange_ratio: number;
|
|
1038
|
+
points_ratio: number;
|
|
1039
|
+
};
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
interface LoyaltyTierRewardItemMaterialParameters {
|
|
1043
|
+
type: 'MATERIAL';
|
|
1044
|
+
parameters: {
|
|
1045
|
+
product: {
|
|
1046
|
+
id: string;
|
|
1047
|
+
sku_id: string | null;
|
|
1048
|
+
};
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
interface LoyaltyTierRewardItemCampaignDiscountCoupons {
|
|
1052
|
+
id: string;
|
|
1053
|
+
type: string;
|
|
1054
|
+
}
|
|
1055
|
+
interface LoyaltyTierRewardItemCampaignGiftVouchersAndLoyaltyProgram {
|
|
1056
|
+
id: string;
|
|
1057
|
+
balance: number;
|
|
1058
|
+
type: string;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
export type { EarningRule, EarningRuleBase, EarningRuleEvent, EarningRuleFixed, EarningRuleProportional, EarningRuleProportionalCustomEvent, EarningRuleProportionalCustomerMetadata, EarningRuleProportionalOrder, EarningRuleProportionalOrderAmount, EarningRuleProportionalOrderItems, EarningRuleProportionalOrderItemsAmount, EarningRuleProportionalOrderItemsQuantity, EarningRuleProportionalOrderItemsSubtotalAmount, EarningRuleProportionalOrderMetadata, EarningRuleProportionalOrderTotalAmount, LoyaltiesAddOrRemoveCardBalanceRequestBody, LoyaltiesAddOrRemoveCardBalanceResponseBody, LoyaltiesAddPoints, LoyaltiesAddPointsResponse, LoyaltiesCreateCampaign, LoyaltiesCreateCampaignResponse, LoyaltiesCreateEarningRule, LoyaltiesCreateEarningRuleResponse, LoyaltiesCreateMember, LoyaltiesCreateMemberResponse, LoyaltiesCreateRewardAssignmentResponse, LoyaltiesCreateRewardAssignments, LoyaltiesCreateTiersRequestBody, LoyaltiesCreateTiersResponseBody, LoyaltiesDeleteCampaignParams, LoyaltiesDisableEarningRulesResponseBody, LoyaltiesEarningRulesResponse, LoyaltiesEnableEarningRulesResponseBody, LoyaltiesExportCardTransactionsRequestBody, LoyaltiesExportCardTransactionsResponseBody, LoyaltiesGetCampaignResponse, LoyaltiesGetEarningRuleResponseBody, LoyaltiesGetMemberActivitiesResponse, LoyaltiesGetMemberResponse, LoyaltiesGetPointsExpirationRequestQuery, LoyaltiesGetPointsExpirationResponseBody, LoyaltiesGetRewardAssignmentResponseBody, LoyaltiesGetRewardDetailsResponseBody, LoyaltiesGetTierResponseBody, LoyaltiesListCardTransactionsRequestQuery, LoyaltiesListCardTransactionsResponseBody, LoyaltiesListEarningRulesParams, LoyaltiesListEarningRulesResponse, LoyaltiesListLoyaltyTierEarningRulesRequestQuery, LoyaltiesListLoyaltyTierEarningRulesResponseBody, LoyaltiesListLoyaltyTierRewardsResponseBody, LoyaltiesListMemberActivityParams, LoyaltiesListMemberActivityResponse, LoyaltiesListMemberLoyaltyTiersResponseBody, LoyaltiesListMemberRewardsRequestQuery, LoyaltiesListMemberRewardsResponseBody, LoyaltiesListMembersParams, LoyaltiesListMembersResponse, LoyaltiesListParams, LoyaltiesListResponse, LoyaltiesListRewardAssignmentsParams, LoyaltiesListRewardAssignmentsResponse, LoyaltiesListTiersRequestQuery, LoyaltiesListTiersResponseBody, LoyaltiesRedeemRewardParams, LoyaltiesRedeemRewardResponse, LoyaltiesTransferPoints, LoyaltiesTransferPointsRequestBody, LoyaltiesTransferPointsResponseBody, LoyaltiesUpdateCampaign, LoyaltiesUpdateCampaignResponse, LoyaltiesUpdateEarningRule, LoyaltiesUpdateEarningRuleResponse, LoyaltiesUpdateRewardAssignment, LoyaltiesUpdateRewardAssignmentResponse, LoyaltiesVoucherResponse, LoyaltyCardTransaction, LoyaltyCardTransactionsFields, LoyaltyCardTransactionsType, LoyaltyFixed, LoyaltyPointsTransfer, LoyaltyProportional, LoyaltyTier, LoyaltyTierBase, LoyaltyTierRewardItemCampaignDiscountCoupons, LoyaltyTierRewardItemCampaignGiftVouchersAndLoyaltyProgram, LoyaltyTierRewardItemCampaignParameters, LoyaltyTierRewardItemCoinParameters, LoyaltyTierRewardItemMaterialParameters, LoyaltyTierRewardItemParameters, PointsExpirationTypes, SimpleLoyaltyVoucher };
|