@voucherify/sdk 1.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 +110 -0
- package/README.md +1258 -0
- package/dist/AsyncActions.d.ts +15 -0
- package/dist/Balance.d.ts +12 -0
- package/dist/Campaigns.d.ts +45 -0
- package/dist/ClientSide.d.ts +40 -0
- package/dist/Consents.d.ts +10 -0
- package/dist/Customers.d.ts +43 -0
- package/dist/Distributions.d.ts +22 -0
- package/dist/Events.d.ts +7 -0
- package/dist/Exports.d.ts +18 -0
- package/dist/Loyalties.d.ts +82 -0
- package/dist/Orders.d.ts +22 -0
- package/dist/Products.d.ts +54 -0
- package/dist/PromotionTiers.d.ts +30 -0
- package/dist/Promotions.d.ts +16 -0
- package/dist/Redemptions.d.ts +26 -0
- package/dist/RequestController.d.ts +20 -0
- package/dist/Rewards.d.ts +39 -0
- package/dist/Segments.d.ts +22 -0
- package/dist/ValidationRules.d.ts +39 -0
- package/dist/Validations.d.ts +13 -0
- package/dist/VoucherifyClientSide.d.ts +76 -0
- package/dist/VoucherifyError.d.ts +6 -0
- package/dist/VoucherifyServerSide.d.ts +111 -0
- package/dist/Vouchers.d.ts +64 -0
- package/dist/helpers.d.ts +19 -0
- package/dist/index.d.ts +24 -0
- package/dist/types/AsyncActions.d.ts +18 -0
- package/dist/types/Balance.d.ts +14 -0
- package/dist/types/Campaigns.d.ts +117 -0
- package/dist/types/ClientSide.d.ts +135 -0
- package/dist/types/Consents.d.ts +33 -0
- package/dist/types/Customers.d.ts +113 -0
- package/dist/types/Distributions.d.ts +141 -0
- package/dist/types/Events.d.ts +17 -0
- package/dist/types/Exports.d.ts +30 -0
- package/dist/types/Loyalties.d.ts +462 -0
- package/dist/types/Orders.d.ts +61 -0
- package/dist/types/Products.d.ts +97 -0
- package/dist/types/PromotionTiers.d.ts +107 -0
- package/dist/types/Promotions.d.ts +90 -0
- package/dist/types/Redemptions.d.ts +150 -0
- package/dist/types/Rewards.d.ts +114 -0
- package/dist/types/Segments.d.ts +32 -0
- package/dist/types/ValidationRules.d.ts +74 -0
- package/dist/types/Validations.d.ts +66 -0
- package/dist/types/Vouchers.d.ts +227 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/voucherifysdk.esm.js +1567 -0
- package/dist/voucherifysdk.esm.js.map +1 -0
- package/dist/voucherifysdk.umd.development.js +1578 -0
- package/dist/voucherifysdk.umd.development.js.map +1 -0
- package/dist/voucherifysdk.umd.production.min.js +2 -0
- package/dist/voucherifysdk.umd.production.min.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { OrdersCreateResponse, OrdersItem } from './Orders';
|
|
2
|
+
import { ProductsCreateResponse, ProductsCreateSkuResponse } from './Products';
|
|
3
|
+
import { SimpleCustomer } from './Customers';
|
|
4
|
+
import { ValidationRulesCreateAssignmentResponse } from './ValidationRules';
|
|
5
|
+
import { VouchersResponse } from './Vouchers';
|
|
6
|
+
interface LoyaltiesVoucher {
|
|
7
|
+
code_config?: {
|
|
8
|
+
length?: number;
|
|
9
|
+
charset?: string;
|
|
10
|
+
pattern?: string;
|
|
11
|
+
prefix?: string;
|
|
12
|
+
suffix?: string;
|
|
13
|
+
};
|
|
14
|
+
type?: string;
|
|
15
|
+
is_referral_code?: boolean;
|
|
16
|
+
loyalty_card?: {
|
|
17
|
+
points: number;
|
|
18
|
+
balance: number;
|
|
19
|
+
};
|
|
20
|
+
redemption?: {
|
|
21
|
+
quantity?: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface LoyaltiesListParams {
|
|
25
|
+
limit?: number;
|
|
26
|
+
page?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface LoyaltiesListResponse {
|
|
29
|
+
object: 'list';
|
|
30
|
+
total: number;
|
|
31
|
+
data_ref: 'campaigns';
|
|
32
|
+
campaigns?: LoyaltiesCreateCampaignResponse[];
|
|
33
|
+
}
|
|
34
|
+
export interface LoyaltiesCreateCampaign {
|
|
35
|
+
name: string;
|
|
36
|
+
start_date?: string;
|
|
37
|
+
expiration_date?: string;
|
|
38
|
+
type?: 'AUTO_UPDATE' | 'STATIC';
|
|
39
|
+
vouchers_count?: number;
|
|
40
|
+
voucher: {
|
|
41
|
+
type: 'LOYALTY_CARD';
|
|
42
|
+
redemption?: {
|
|
43
|
+
quantity: number;
|
|
44
|
+
};
|
|
45
|
+
loyalty_card: {
|
|
46
|
+
points: number;
|
|
47
|
+
balance?: number;
|
|
48
|
+
};
|
|
49
|
+
code_config?: {
|
|
50
|
+
length?: number;
|
|
51
|
+
charset?: string;
|
|
52
|
+
pattern?: string;
|
|
53
|
+
prefix?: string;
|
|
54
|
+
suffix?: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
metadata?: Record<string, any>;
|
|
58
|
+
}
|
|
59
|
+
export interface LoyaltiesCreateCampaignResponse {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
campaign_type?: 'LOYALTY_PROGRAM';
|
|
63
|
+
type: 'AUTO_UPDATE' | 'STATIC';
|
|
64
|
+
category?: string;
|
|
65
|
+
auto_join?: boolean;
|
|
66
|
+
join_once?: boolean;
|
|
67
|
+
description?: string;
|
|
68
|
+
start_date?: string;
|
|
69
|
+
validation_rules_assignments?: {
|
|
70
|
+
data?: ValidationRulesCreateAssignmentResponse[];
|
|
71
|
+
object: 'list';
|
|
72
|
+
total: number;
|
|
73
|
+
data_ref: 'data';
|
|
74
|
+
};
|
|
75
|
+
expiration_date?: string;
|
|
76
|
+
activity_duration_after_publishing?: string;
|
|
77
|
+
validity_timeframe?: {
|
|
78
|
+
interval?: string;
|
|
79
|
+
duration?: string;
|
|
80
|
+
};
|
|
81
|
+
validity_day_of_week?: number[];
|
|
82
|
+
metadata?: Record<string, any>;
|
|
83
|
+
created_at: string;
|
|
84
|
+
vouchers_generation_status: 'IN_PROGRESS' | 'DONE' | 'FAILED' | 'DRAFT';
|
|
85
|
+
active: boolean;
|
|
86
|
+
voucher?: LoyaltiesVoucher;
|
|
87
|
+
referral_program?: boolean;
|
|
88
|
+
use_voucher_metadata_schema?: boolean;
|
|
89
|
+
protected?: boolean;
|
|
90
|
+
vouchers_count?: number;
|
|
91
|
+
object: 'campaign';
|
|
92
|
+
}
|
|
93
|
+
export declare type LoyaltiesGetCampaignResponse = LoyaltiesCreateCampaignResponse;
|
|
94
|
+
export interface LoyaltiesUpdateCampaign {
|
|
95
|
+
id: string;
|
|
96
|
+
start_date?: string;
|
|
97
|
+
expiration_date?: string;
|
|
98
|
+
metadata?: Record<string, any>;
|
|
99
|
+
description?: string;
|
|
100
|
+
type?: 'AUTO_UPDATE' | 'STATIC';
|
|
101
|
+
}
|
|
102
|
+
export declare type LoyaltiesUpdateCampaignResponse = LoyaltiesCreateCampaignResponse;
|
|
103
|
+
export interface LoyaltiesDeleteCampaignParams {
|
|
104
|
+
force?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export interface LoyaltiesListRewardAssignmentsParams {
|
|
107
|
+
limit?: number;
|
|
108
|
+
page?: number;
|
|
109
|
+
}
|
|
110
|
+
export interface LoyaltiesListRewardAssignmentsResponse {
|
|
111
|
+
object: 'list';
|
|
112
|
+
total: number;
|
|
113
|
+
data_ref: 'data';
|
|
114
|
+
data: LoyaltiesCreateRewardAssignmentResponse[];
|
|
115
|
+
}
|
|
116
|
+
export interface LoyaltiesCreateRewardAssignments {
|
|
117
|
+
reward: string;
|
|
118
|
+
parameters: {
|
|
119
|
+
loyalty: {
|
|
120
|
+
points: number;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export interface LoyaltiesCreateRewardAssignmentResponse {
|
|
125
|
+
id: string;
|
|
126
|
+
reward_id: string;
|
|
127
|
+
related_object_id?: string;
|
|
128
|
+
related_object_type?: string;
|
|
129
|
+
parameters?: {
|
|
130
|
+
loyalty: {
|
|
131
|
+
points: number;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
created_at: string;
|
|
135
|
+
updated_at?: string;
|
|
136
|
+
object: 'reward_assignment';
|
|
137
|
+
}
|
|
138
|
+
export interface LoyaltiesUpdateRewardAssignment {
|
|
139
|
+
id: string;
|
|
140
|
+
parameters: {
|
|
141
|
+
loyalty: {
|
|
142
|
+
points: number;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
export declare type LoyaltiesUpdateRewardAssignmentResponse = LoyaltiesCreateRewardAssignmentResponse;
|
|
147
|
+
export interface LoyaltiesListEarningRulesParams {
|
|
148
|
+
limit?: number;
|
|
149
|
+
page?: number;
|
|
150
|
+
}
|
|
151
|
+
export interface LoyaltyFixed {
|
|
152
|
+
type: 'FIXED';
|
|
153
|
+
points: number;
|
|
154
|
+
}
|
|
155
|
+
export interface LoyaltyProportional {
|
|
156
|
+
type: 'PROPORTIONAL';
|
|
157
|
+
order?: {
|
|
158
|
+
amount: {
|
|
159
|
+
every: number;
|
|
160
|
+
points: number;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export interface LoyaltiesEarningRulesResponse {
|
|
165
|
+
id: string;
|
|
166
|
+
created_at: string;
|
|
167
|
+
updated_at?: string;
|
|
168
|
+
validation_rule_id?: string;
|
|
169
|
+
loyalty: LoyaltyFixed | LoyaltyProportional;
|
|
170
|
+
segment?: {
|
|
171
|
+
id: string;
|
|
172
|
+
};
|
|
173
|
+
event: 'customer.segment.entered' | 'order.paid' | string;
|
|
174
|
+
source?: {
|
|
175
|
+
banner?: string;
|
|
176
|
+
object_id?: string;
|
|
177
|
+
object_type?: string;
|
|
178
|
+
};
|
|
179
|
+
object: 'earning_rule';
|
|
180
|
+
automation_id: string;
|
|
181
|
+
}
|
|
182
|
+
export interface LoyaltiesListEarningRulesResponse {
|
|
183
|
+
object: 'list';
|
|
184
|
+
total: number;
|
|
185
|
+
data_ref: string;
|
|
186
|
+
data: LoyaltiesEarningRulesResponse[];
|
|
187
|
+
}
|
|
188
|
+
export interface LoyaltiesCreateEarningRule {
|
|
189
|
+
event: 'order.paid' | 'customer.segment.entered' | string;
|
|
190
|
+
validation_rule_id?: string;
|
|
191
|
+
loyalty: LoyaltyProportional | LoyaltyFixed;
|
|
192
|
+
source?: {
|
|
193
|
+
banner?: string;
|
|
194
|
+
};
|
|
195
|
+
custom_event?: {
|
|
196
|
+
schema_id?: string;
|
|
197
|
+
};
|
|
198
|
+
segment?: {
|
|
199
|
+
id?: string;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export declare type LoyaltiesCreateEarningRuleResponse = LoyaltiesEarningRulesResponse;
|
|
203
|
+
export interface LoyaltiesUpdateEarningRule {
|
|
204
|
+
id: string;
|
|
205
|
+
validation_rule_id?: string;
|
|
206
|
+
source?: {
|
|
207
|
+
banner: string;
|
|
208
|
+
};
|
|
209
|
+
loyalty?: {
|
|
210
|
+
points: number;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
export declare type LoyaltiesUpdateEarningRuleResponse = LoyaltiesEarningRulesResponse;
|
|
214
|
+
export interface LoyaltiesListMembersParams {
|
|
215
|
+
limit?: number;
|
|
216
|
+
page?: number;
|
|
217
|
+
created_at?: {
|
|
218
|
+
before?: string;
|
|
219
|
+
after?: string;
|
|
220
|
+
};
|
|
221
|
+
updated_at?: {
|
|
222
|
+
before?: string;
|
|
223
|
+
after?: string;
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
export interface LoyaltiesVoucherResponse {
|
|
227
|
+
id: string;
|
|
228
|
+
code: string;
|
|
229
|
+
campaign: string;
|
|
230
|
+
campaign_id: string;
|
|
231
|
+
category?: string;
|
|
232
|
+
type: 'LOYALTY_CARD';
|
|
233
|
+
loyalty_card: {
|
|
234
|
+
points: number;
|
|
235
|
+
balance: number;
|
|
236
|
+
};
|
|
237
|
+
start_date?: string;
|
|
238
|
+
expiration_date?: string;
|
|
239
|
+
validity_timeframe?: {
|
|
240
|
+
interval?: string;
|
|
241
|
+
duration?: string;
|
|
242
|
+
};
|
|
243
|
+
validity_day_of_week?: number[];
|
|
244
|
+
publish?: {
|
|
245
|
+
count?: number;
|
|
246
|
+
entries?: string[];
|
|
247
|
+
};
|
|
248
|
+
redemption?: {
|
|
249
|
+
quantity?: number;
|
|
250
|
+
redeemed_points?: number;
|
|
251
|
+
redeemed_quantity?: number;
|
|
252
|
+
redemption_entries?: string[];
|
|
253
|
+
};
|
|
254
|
+
active?: boolean;
|
|
255
|
+
additional_info?: string;
|
|
256
|
+
metadata?: Record<string, any>;
|
|
257
|
+
is_referral_code?: boolean;
|
|
258
|
+
holder_id?: string;
|
|
259
|
+
updated_at?: string;
|
|
260
|
+
}
|
|
261
|
+
export interface LoyaltiesListMembersResponse {
|
|
262
|
+
object: 'list';
|
|
263
|
+
total: number;
|
|
264
|
+
data_ref: 'vouchers';
|
|
265
|
+
vouchers: LoyaltiesVoucherResponse[];
|
|
266
|
+
}
|
|
267
|
+
export interface LoyaltiesCreateMember {
|
|
268
|
+
voucher?: string;
|
|
269
|
+
channel?: string;
|
|
270
|
+
customer: {
|
|
271
|
+
id?: string;
|
|
272
|
+
name?: string;
|
|
273
|
+
email?: string;
|
|
274
|
+
metadata?: Record<string, any>;
|
|
275
|
+
description?: string;
|
|
276
|
+
source_id?: string;
|
|
277
|
+
};
|
|
278
|
+
metadata?: Record<string, any>;
|
|
279
|
+
}
|
|
280
|
+
export declare type LoyaltiesCreateMemberResponse = LoyaltiesVoucherResponse;
|
|
281
|
+
export declare type LoyaltiesGetMemberResponse = LoyaltiesCreateMemberResponse;
|
|
282
|
+
export interface LoyaltiesGetMemberActivitiesResponse {
|
|
283
|
+
object: 'list';
|
|
284
|
+
data_ref: 'activities';
|
|
285
|
+
total: number;
|
|
286
|
+
activities: {
|
|
287
|
+
id: string;
|
|
288
|
+
type: string;
|
|
289
|
+
object: string;
|
|
290
|
+
created_at: string;
|
|
291
|
+
data: any;
|
|
292
|
+
}[];
|
|
293
|
+
}
|
|
294
|
+
export interface LoyaltiesAddPoints {
|
|
295
|
+
points: number;
|
|
296
|
+
}
|
|
297
|
+
export interface LoyaltiesAddPointsResponse {
|
|
298
|
+
points: number;
|
|
299
|
+
total: number;
|
|
300
|
+
balance: number;
|
|
301
|
+
type: string;
|
|
302
|
+
object: 'balance';
|
|
303
|
+
related_object?: {
|
|
304
|
+
type?: string;
|
|
305
|
+
id?: string;
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
export interface LoyaltiesRedeemRewardParams {
|
|
309
|
+
reward: {
|
|
310
|
+
id: string;
|
|
311
|
+
};
|
|
312
|
+
order?: {
|
|
313
|
+
id?: string;
|
|
314
|
+
source_id?: string;
|
|
315
|
+
amount: number;
|
|
316
|
+
items?: OrdersItem[];
|
|
317
|
+
metadata?: Record<string, any>;
|
|
318
|
+
};
|
|
319
|
+
metadata?: Record<string, any>;
|
|
320
|
+
}
|
|
321
|
+
interface CoinReward {
|
|
322
|
+
assignment_id: string;
|
|
323
|
+
loyalty_tier_id: string;
|
|
324
|
+
id: string;
|
|
325
|
+
name: string;
|
|
326
|
+
created_at: string;
|
|
327
|
+
updated_at?: string;
|
|
328
|
+
parameters: {
|
|
329
|
+
automation_id?: string;
|
|
330
|
+
coin: {
|
|
331
|
+
exchange_ratio: number;
|
|
332
|
+
points_ratio: number;
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
type: 'COIN';
|
|
336
|
+
object: 'reward';
|
|
337
|
+
}
|
|
338
|
+
interface MaterialReward {
|
|
339
|
+
assignment_id: string;
|
|
340
|
+
loyalty_tier_id: string;
|
|
341
|
+
product: ProductsCreateResponse & ProductsCreateSkuResponse;
|
|
342
|
+
id: string;
|
|
343
|
+
name: string;
|
|
344
|
+
created_at: string;
|
|
345
|
+
updated_at?: string;
|
|
346
|
+
parameters: {
|
|
347
|
+
automation_id?: string;
|
|
348
|
+
product?: {
|
|
349
|
+
id: string;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
type: 'MATERIAL';
|
|
353
|
+
object: 'reward';
|
|
354
|
+
}
|
|
355
|
+
interface CampaignReward {
|
|
356
|
+
assignment_id: string;
|
|
357
|
+
loyalty_tier_id: string;
|
|
358
|
+
voucher: VouchersResponse;
|
|
359
|
+
id: string;
|
|
360
|
+
name: string;
|
|
361
|
+
created_at: string;
|
|
362
|
+
updated_at?: string;
|
|
363
|
+
parameters: {
|
|
364
|
+
automation_id?: string;
|
|
365
|
+
campaign?: {
|
|
366
|
+
id: string;
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
type: 'CAMPAIGN';
|
|
370
|
+
object: 'reward';
|
|
371
|
+
}
|
|
372
|
+
export interface LoyaltiesRedeemRewardResponse {
|
|
373
|
+
id: string;
|
|
374
|
+
object: 'redemption';
|
|
375
|
+
date: string;
|
|
376
|
+
customer_id: string;
|
|
377
|
+
amount: number;
|
|
378
|
+
order?: Omit<OrdersCreateResponse, 'customer'> & {
|
|
379
|
+
total_discount_amount: number;
|
|
380
|
+
total_amount: number;
|
|
381
|
+
customer: {
|
|
382
|
+
id: string;
|
|
383
|
+
object: 'customer';
|
|
384
|
+
referrals: {
|
|
385
|
+
campaigns: any[];
|
|
386
|
+
total: number;
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
customer: SimpleCustomer;
|
|
391
|
+
reward: MaterialReward | CampaignReward | CoinReward;
|
|
392
|
+
result: 'SUCCESS' | 'FAILURE';
|
|
393
|
+
tracking_id?: string;
|
|
394
|
+
voucher: {
|
|
395
|
+
id: string;
|
|
396
|
+
code?: string;
|
|
397
|
+
campaign?: string;
|
|
398
|
+
campaign_id?: string;
|
|
399
|
+
category?: string;
|
|
400
|
+
type: 'LOYALTY_CARD';
|
|
401
|
+
loyalty_card?: {
|
|
402
|
+
points: number;
|
|
403
|
+
balance: number;
|
|
404
|
+
};
|
|
405
|
+
start_date?: string;
|
|
406
|
+
expiration_date?: string;
|
|
407
|
+
validity_timeframe?: {
|
|
408
|
+
interval?: string;
|
|
409
|
+
duration?: string;
|
|
410
|
+
};
|
|
411
|
+
validity_day_of_week?: number[];
|
|
412
|
+
publish: {
|
|
413
|
+
object: 'list';
|
|
414
|
+
count: number;
|
|
415
|
+
url: string;
|
|
416
|
+
};
|
|
417
|
+
redemption: {
|
|
418
|
+
object: 'list';
|
|
419
|
+
quantity: number;
|
|
420
|
+
redeemed_quantity: number;
|
|
421
|
+
url: string;
|
|
422
|
+
redeemed_points: number;
|
|
423
|
+
};
|
|
424
|
+
active: true;
|
|
425
|
+
additional_info?: string;
|
|
426
|
+
assets?: {
|
|
427
|
+
qr?: {
|
|
428
|
+
id: string;
|
|
429
|
+
url: string;
|
|
430
|
+
};
|
|
431
|
+
barcode?: {
|
|
432
|
+
id: string;
|
|
433
|
+
url: string;
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
is_referral_code: boolean;
|
|
437
|
+
referrer_id: string;
|
|
438
|
+
holder_id: string;
|
|
439
|
+
updated_at: string;
|
|
440
|
+
holder: {
|
|
441
|
+
id: string;
|
|
442
|
+
source_id: string;
|
|
443
|
+
metadata?: Record<string, any>;
|
|
444
|
+
object: 'customer';
|
|
445
|
+
};
|
|
446
|
+
object?: 'voucher';
|
|
447
|
+
validation_rules_assignments: {
|
|
448
|
+
object: 'list';
|
|
449
|
+
total: number;
|
|
450
|
+
data_ref: 'data';
|
|
451
|
+
data?: {
|
|
452
|
+
id: string;
|
|
453
|
+
rule_id?: string;
|
|
454
|
+
related_object_id?: string;
|
|
455
|
+
related_object_type?: string;
|
|
456
|
+
created_at: string;
|
|
457
|
+
object: 'validation_rules_assignment';
|
|
458
|
+
}[];
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { CustomerRequest } from './Customers';
|
|
2
|
+
export interface OrdersItem {
|
|
3
|
+
sku_id?: string;
|
|
4
|
+
product_id?: string;
|
|
5
|
+
related_object?: 'product' | 'sku';
|
|
6
|
+
source_id?: string;
|
|
7
|
+
quantity?: number;
|
|
8
|
+
price?: number;
|
|
9
|
+
amount?: number;
|
|
10
|
+
product?: {
|
|
11
|
+
override?: boolean;
|
|
12
|
+
name?: string;
|
|
13
|
+
metadata?: Record<string, any>;
|
|
14
|
+
};
|
|
15
|
+
sku?: {
|
|
16
|
+
override?: boolean;
|
|
17
|
+
sku?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface OrdersCreate {
|
|
21
|
+
customer?: CustomerRequest;
|
|
22
|
+
amount?: number;
|
|
23
|
+
items?: OrdersItem[];
|
|
24
|
+
metadata?: Record<string, any>;
|
|
25
|
+
}
|
|
26
|
+
export interface OrdersCreateResponse {
|
|
27
|
+
id: string;
|
|
28
|
+
source_id?: string;
|
|
29
|
+
created_at: string;
|
|
30
|
+
updated_at?: string;
|
|
31
|
+
status?: 'CREATED' | 'PAID' | 'PROCESSING' | 'CANCELED' | 'FULFILLED';
|
|
32
|
+
amount?: number;
|
|
33
|
+
discount_amount?: number;
|
|
34
|
+
items?: OrdersItem[];
|
|
35
|
+
metadata?: Record<string, any>;
|
|
36
|
+
customer?: CustomerRequest;
|
|
37
|
+
object: 'order';
|
|
38
|
+
}
|
|
39
|
+
export declare type OrdersGetResponse = OrdersCreateResponse;
|
|
40
|
+
export interface OrdersUpdate {
|
|
41
|
+
id: string;
|
|
42
|
+
source_id?: string;
|
|
43
|
+
status?: 'CREATED' | 'PAID' | 'CANCELLED' | 'FULFILLED';
|
|
44
|
+
items?: OrdersItem[];
|
|
45
|
+
amount?: number;
|
|
46
|
+
metadata?: Record<string, any>;
|
|
47
|
+
customer?: {
|
|
48
|
+
id: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export declare type OrdersUpdateResponse = OrdersGetResponse;
|
|
52
|
+
export interface OrdersListParams {
|
|
53
|
+
limit?: number;
|
|
54
|
+
page?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface OrdersListResponse {
|
|
57
|
+
object: 'list';
|
|
58
|
+
total: number;
|
|
59
|
+
data_ref: 'orders';
|
|
60
|
+
orders: OrdersGetResponse[];
|
|
61
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export interface ProductsCreate {
|
|
2
|
+
name?: string;
|
|
3
|
+
source_id?: string;
|
|
4
|
+
price?: number;
|
|
5
|
+
attributes?: string[];
|
|
6
|
+
metadata?: Record<string, any>;
|
|
7
|
+
image_url?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ProductsGetResponseSkus {
|
|
10
|
+
skus?: {
|
|
11
|
+
object: 'list';
|
|
12
|
+
total: number;
|
|
13
|
+
data?: ProductsGetSkuResponse[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface ProductsCreateResponse {
|
|
17
|
+
id: string;
|
|
18
|
+
source_id?: string;
|
|
19
|
+
object: 'product';
|
|
20
|
+
name?: string;
|
|
21
|
+
price?: number;
|
|
22
|
+
attributes?: string[];
|
|
23
|
+
created_at: string;
|
|
24
|
+
image_url?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare type ProductsGetResponse = ProductsCreateResponse & ProductsGetResponseSkus;
|
|
27
|
+
export declare type ProductsUpdate = {
|
|
28
|
+
name?: string;
|
|
29
|
+
id?: string;
|
|
30
|
+
source_id?: string;
|
|
31
|
+
attributes?: string[];
|
|
32
|
+
price?: number;
|
|
33
|
+
image_url?: string;
|
|
34
|
+
metadata?: Record<string, any>;
|
|
35
|
+
};
|
|
36
|
+
export declare type ProductsUpdateResponse = ProductsCreateResponse;
|
|
37
|
+
export interface ProductsBulkMetadataUpdate {
|
|
38
|
+
source_ids: string[];
|
|
39
|
+
metadata: Record<string, any>;
|
|
40
|
+
}
|
|
41
|
+
export declare type ProductsBulkUpdate = ProductsCreate[];
|
|
42
|
+
interface BulkUpdateResponse {
|
|
43
|
+
source_id?: string;
|
|
44
|
+
found: boolean;
|
|
45
|
+
updated: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare type ProductsBulkUpdateResponse = BulkUpdateResponse[];
|
|
48
|
+
export declare type ProductsBulkMetadataUpdateResponse = BulkUpdateResponse[];
|
|
49
|
+
export interface ProductsDeleteParams {
|
|
50
|
+
force?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface ProductsListParams {
|
|
53
|
+
page?: number;
|
|
54
|
+
limit?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface ProductsListResponse {
|
|
57
|
+
object: 'list';
|
|
58
|
+
total: number;
|
|
59
|
+
data_ref: 'products';
|
|
60
|
+
products: ProductsGetResponse[];
|
|
61
|
+
}
|
|
62
|
+
export interface ProductsCreateSku {
|
|
63
|
+
sku: string;
|
|
64
|
+
source_id?: string;
|
|
65
|
+
attributes?: Record<string, string>;
|
|
66
|
+
metadata?: Record<string, any>;
|
|
67
|
+
price?: number;
|
|
68
|
+
image_url?: string;
|
|
69
|
+
currency?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface ProductsCreateSkuResponse {
|
|
72
|
+
id: string;
|
|
73
|
+
source_id?: string;
|
|
74
|
+
sku?: string;
|
|
75
|
+
price?: number;
|
|
76
|
+
attributes?: Record<string, string>;
|
|
77
|
+
metadata?: Record<string, any>;
|
|
78
|
+
updated_at?: string;
|
|
79
|
+
currency?: string;
|
|
80
|
+
created_at: string;
|
|
81
|
+
object: 'sku';
|
|
82
|
+
}
|
|
83
|
+
export declare type ProductsGetSkuResponse = ProductsCreateSkuResponse;
|
|
84
|
+
export declare type ProductsUpdateSku = ProductsCreateSku & {
|
|
85
|
+
id?: string;
|
|
86
|
+
source_id?: string;
|
|
87
|
+
};
|
|
88
|
+
export declare type ProductsUpdateSkuResponse = ProductsGetSkuResponse;
|
|
89
|
+
export interface ProductsDeleteSkuParams {
|
|
90
|
+
force?: boolean;
|
|
91
|
+
}
|
|
92
|
+
export interface ProductsListSkus {
|
|
93
|
+
object: 'list';
|
|
94
|
+
total: number;
|
|
95
|
+
skus: ProductsGetSkuResponse[];
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { DiscountAmount, DiscountPercent, DiscountUnit } from './Vouchers';
|
|
2
|
+
import { OrdersCreateResponse, OrdersItem } from './Orders';
|
|
3
|
+
import { SimpleCustomer } from './Customers';
|
|
4
|
+
import { ValidationRulesListAssignmentsResponse } from './ValidationRules';
|
|
5
|
+
export interface SimplePromotionTier {
|
|
6
|
+
tracking_id: string;
|
|
7
|
+
metadata?: Record<string, any>;
|
|
8
|
+
valid: boolean;
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
banner?: string;
|
|
12
|
+
discount: DiscountUnit | DiscountPercent | DiscountAmount;
|
|
13
|
+
hierarchy: number;
|
|
14
|
+
object: 'promotion_tier';
|
|
15
|
+
}
|
|
16
|
+
export interface PromotionTier {
|
|
17
|
+
id: string;
|
|
18
|
+
object: 'promotion_tier';
|
|
19
|
+
name: string;
|
|
20
|
+
banner?: string;
|
|
21
|
+
campaign: {
|
|
22
|
+
id: string;
|
|
23
|
+
object: 'campaign';
|
|
24
|
+
start_date?: string;
|
|
25
|
+
expiration_date?: string;
|
|
26
|
+
active: boolean;
|
|
27
|
+
};
|
|
28
|
+
validation_rule_assignments: ValidationRulesListAssignmentsResponse;
|
|
29
|
+
action: {
|
|
30
|
+
discount: DiscountUnit | DiscountPercent | DiscountAmount;
|
|
31
|
+
};
|
|
32
|
+
hierarchy: number;
|
|
33
|
+
metadata?: Record<string, any>;
|
|
34
|
+
}
|
|
35
|
+
export interface PromotionTiersListAllParams {
|
|
36
|
+
is_available?: boolean;
|
|
37
|
+
limit?: number;
|
|
38
|
+
page?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface PromotionTiersListAllResponse {
|
|
41
|
+
object: 'list';
|
|
42
|
+
data_ref: 'tiers';
|
|
43
|
+
tiers: PromotionTier[];
|
|
44
|
+
has_more: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare type PromotionTiersListResponse = PromotionTiersListAllResponse;
|
|
47
|
+
export interface PromotionTiersCreateParams {
|
|
48
|
+
name?: string;
|
|
49
|
+
banner?: string;
|
|
50
|
+
action?: {
|
|
51
|
+
discount?: DiscountUnit | DiscountPercent | DiscountAmount;
|
|
52
|
+
};
|
|
53
|
+
metadata?: Record<string, any>;
|
|
54
|
+
}
|
|
55
|
+
export declare type PromotionTiersCreateResponse = PromotionTier;
|
|
56
|
+
export interface PromotionTiersRedeemParams {
|
|
57
|
+
customer?: Omit<SimpleCustomer, 'object'> & {
|
|
58
|
+
description?: string;
|
|
59
|
+
};
|
|
60
|
+
order?: {
|
|
61
|
+
id?: string;
|
|
62
|
+
source_id?: string;
|
|
63
|
+
amount?: number;
|
|
64
|
+
items?: OrdersItem[];
|
|
65
|
+
status?: 'CREATED' | 'PAID' | 'CANCELLED' | 'FULFILLED';
|
|
66
|
+
metadata?: Record<string, any>;
|
|
67
|
+
};
|
|
68
|
+
metadata?: Record<string, any>;
|
|
69
|
+
session?: {
|
|
70
|
+
key: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface PromotionTiersRedeemResponse {
|
|
74
|
+
id: string;
|
|
75
|
+
object: 'redemption';
|
|
76
|
+
date: string;
|
|
77
|
+
customer_id?: string;
|
|
78
|
+
tracking_id?: string;
|
|
79
|
+
order: Omit<OrdersCreateResponse, 'object' | 'customer'> & {
|
|
80
|
+
customer: {
|
|
81
|
+
id: string;
|
|
82
|
+
object: 'customer';
|
|
83
|
+
referrals: {
|
|
84
|
+
campaigns: any[];
|
|
85
|
+
total: number;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
total_discount_amount?: number;
|
|
89
|
+
total_amount?: number;
|
|
90
|
+
};
|
|
91
|
+
result?: string;
|
|
92
|
+
promotion_tier: PromotionTier & {
|
|
93
|
+
summary: {
|
|
94
|
+
redemptions: {
|
|
95
|
+
total_redeemed: number;
|
|
96
|
+
};
|
|
97
|
+
orders: {
|
|
98
|
+
total_amount: number;
|
|
99
|
+
total_discount_amount: number;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export declare type PromotionTiersUpdateParams = PromotionTiersCreateParams & {
|
|
105
|
+
id: string;
|
|
106
|
+
};
|
|
107
|
+
export declare type PromotionTiersUpdateResponse = PromotionTier;
|