@voucherify/sdk 1.2.0 → 2.0.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/CHANGELOG.md +50 -0
- package/README.md +129 -129
- package/dist/AsyncActions.d.ts +2 -2
- package/dist/Balance.d.ts +1 -1
- package/dist/Campaigns.d.ts +9 -9
- package/dist/ClientSide.d.ts +8 -8
- package/dist/Consents.d.ts +1 -1
- package/dist/Customers.d.ts +6 -6
- package/dist/Distributions.d.ts +2 -2
- package/dist/Events.d.ts +3 -0
- package/dist/Exports.d.ts +3 -3
- package/dist/Loyalties.d.ts +19 -19
- package/dist/Orders.d.ts +4 -4
- package/dist/Products.d.ts +14 -14
- package/dist/PromotionTiers.d.ts +6 -6
- package/dist/Promotions.d.ts +2 -2
- package/dist/Redemptions.d.ts +5 -5
- package/dist/Rewards.d.ts +8 -8
- package/dist/Segments.d.ts +4 -4
- package/dist/ValidationRules.d.ts +8 -8
- package/dist/Validations.d.ts +1 -1
- package/dist/VoucherifyClientSide.d.ts +2 -2
- package/dist/VoucherifyServerSide.d.ts +3 -3
- package/dist/Vouchers.d.ts +14 -13
- package/dist/helpers.d.ts +0 -1
- package/dist/types/Campaigns.d.ts +3 -0
- package/dist/types/Products.d.ts +7 -9
- package/dist/types/Vouchers.d.ts +12 -15
- package/dist/voucherifysdk.esm.js +136 -160
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +136 -160
- package/dist/voucherifysdk.umd.development.js.map +1 -1
- package/dist/voucherifysdk.umd.production.min.js +1 -1
- package/dist/voucherifysdk.umd.production.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -66,10 +66,7 @@ class RequestController {
|
|
|
66
66
|
const response = await this.request.get(path, {
|
|
67
67
|
params,
|
|
68
68
|
paramsSerializer: function (params) {
|
|
69
|
-
return Qs.stringify(params
|
|
70
|
-
arrayFormat: 'brackets',
|
|
71
|
-
encode: false
|
|
72
|
-
});
|
|
69
|
+
return Qs.stringify(params);
|
|
73
70
|
}
|
|
74
71
|
});
|
|
75
72
|
return response.data;
|
|
@@ -131,34 +128,6 @@ function assert(condition, message) {
|
|
|
131
128
|
if (condition) return;
|
|
132
129
|
throw new Error(message);
|
|
133
130
|
}
|
|
134
|
-
function toQueryParams(obj) {
|
|
135
|
-
const entries = [];
|
|
136
|
-
|
|
137
|
-
function mapToEntries(prefix, record) {
|
|
138
|
-
Object.entries(record).map(([key, val]) => {
|
|
139
|
-
if (val == null) return void 0;
|
|
140
|
-
|
|
141
|
-
switch (typeof val) {
|
|
142
|
-
case 'string':
|
|
143
|
-
case 'number':
|
|
144
|
-
case 'boolean':
|
|
145
|
-
case 'bigint':
|
|
146
|
-
if (prefix) return entries.push([`${prefix}[${key}]`, encode(val.toString())]);
|
|
147
|
-
return entries.push([key, encode(val.toString())]);
|
|
148
|
-
|
|
149
|
-
case 'object':
|
|
150
|
-
if (prefix) return mapToEntries(`${prefix}[${key}]`, val);
|
|
151
|
-
return mapToEntries(key, val);
|
|
152
|
-
|
|
153
|
-
default:
|
|
154
|
-
return void 0;
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
mapToEntries(null, obj);
|
|
160
|
-
return Object.fromEntries(entries);
|
|
161
|
-
}
|
|
162
131
|
/**
|
|
163
132
|
* Return an object containing all properties of `obj` excluding the ones in `keys` array
|
|
164
133
|
* e.g:
|
|
@@ -179,7 +148,7 @@ class AsyncActions {
|
|
|
179
148
|
this.client = client;
|
|
180
149
|
}
|
|
181
150
|
/**
|
|
182
|
-
* @see https://docs.voucherify.io/reference
|
|
151
|
+
* @see https://docs.voucherify.io/reference/get-async-actions-1
|
|
183
152
|
*/
|
|
184
153
|
|
|
185
154
|
|
|
@@ -187,7 +156,7 @@ class AsyncActions {
|
|
|
187
156
|
return this.client.get(`/async-actions/${encode(asyncActionId)}`);
|
|
188
157
|
}
|
|
189
158
|
/**
|
|
190
|
-
* @see https://docs.voucherify.io/reference
|
|
159
|
+
* @see https://docs.voucherify.io/reference/list-async-actions
|
|
191
160
|
*/
|
|
192
161
|
|
|
193
162
|
|
|
@@ -217,7 +186,7 @@ class Campaigns {
|
|
|
217
186
|
this.qualifications = new CampaignsQualifications(this.client);
|
|
218
187
|
}
|
|
219
188
|
/**
|
|
220
|
-
* @see https://docs.voucherify.io/reference
|
|
189
|
+
* @see https://docs.voucherify.io/reference/create-campaign
|
|
221
190
|
*/
|
|
222
191
|
|
|
223
192
|
|
|
@@ -225,7 +194,7 @@ class Campaigns {
|
|
|
225
194
|
return this.client.post('/campaigns', campaign);
|
|
226
195
|
}
|
|
227
196
|
/**
|
|
228
|
-
* @see https://docs.voucherify.io/reference
|
|
197
|
+
* @see https://docs.voucherify.io/reference/update-campaign
|
|
229
198
|
*/
|
|
230
199
|
|
|
231
200
|
|
|
@@ -233,7 +202,7 @@ class Campaigns {
|
|
|
233
202
|
return this.client.put(`/campaigns/${encode(nameOrId)}`, campaign);
|
|
234
203
|
}
|
|
235
204
|
/**
|
|
236
|
-
* @see https://docs.voucherify.io/reference
|
|
205
|
+
* @see https://docs.voucherify.io/reference/get-campaign
|
|
237
206
|
*/
|
|
238
207
|
|
|
239
208
|
|
|
@@ -241,7 +210,7 @@ class Campaigns {
|
|
|
241
210
|
return this.client.get(`/campaigns/${encode(name)}`);
|
|
242
211
|
}
|
|
243
212
|
/**
|
|
244
|
-
* @see https://docs.voucherify.io/reference
|
|
213
|
+
* @see https://docs.voucherify.io/reference/delete-campaign
|
|
245
214
|
*/
|
|
246
215
|
|
|
247
216
|
|
|
@@ -249,7 +218,7 @@ class Campaigns {
|
|
|
249
218
|
return this.client.delete(`/campaigns/${encode(name)}`, params);
|
|
250
219
|
}
|
|
251
220
|
/**
|
|
252
|
-
* @see https://docs.voucherify.io/reference
|
|
221
|
+
* @see https://docs.voucherify.io/reference/add-voucher-to-campaign
|
|
253
222
|
*/
|
|
254
223
|
|
|
255
224
|
|
|
@@ -257,7 +226,7 @@ class Campaigns {
|
|
|
257
226
|
return this.client.post(`/campaigns/${encode(name)}/vouchers`, body, params);
|
|
258
227
|
}
|
|
259
228
|
/**
|
|
260
|
-
* @see https://docs.voucherify.io/reference
|
|
229
|
+
* @see https://docs.voucherify.io/reference/add-voucher-with-certain-code-to-campaign
|
|
261
230
|
*/
|
|
262
231
|
|
|
263
232
|
|
|
@@ -265,7 +234,7 @@ class Campaigns {
|
|
|
265
234
|
return this.client.post(`/campaigns/${encode(name)}/vouchers/${encode(code)}`, body);
|
|
266
235
|
}
|
|
267
236
|
/**
|
|
268
|
-
* @see https://docs.voucherify.io/reference
|
|
237
|
+
* @see https://docs.voucherify.io/reference/import-vouchers
|
|
269
238
|
*/
|
|
270
239
|
|
|
271
240
|
|
|
@@ -273,7 +242,7 @@ class Campaigns {
|
|
|
273
242
|
return this.client.post(`/campaigns/${encode(campaignName)}/import`, vouchers);
|
|
274
243
|
}
|
|
275
244
|
/**
|
|
276
|
-
* @see https://docs.voucherify.io/
|
|
245
|
+
* @see https://docs.voucherify.io/reference/list-campaigns
|
|
277
246
|
*/
|
|
278
247
|
|
|
279
248
|
|
|
@@ -289,7 +258,7 @@ class DistributionsPublications {
|
|
|
289
258
|
this.client = client;
|
|
290
259
|
}
|
|
291
260
|
/**
|
|
292
|
-
* @see https://docs.voucherify.io/reference
|
|
261
|
+
* @see https://docs.voucherify.io/reference/list-publications
|
|
293
262
|
*/
|
|
294
263
|
|
|
295
264
|
|
|
@@ -297,7 +266,7 @@ class DistributionsPublications {
|
|
|
297
266
|
return this.client.get('/publications', params);
|
|
298
267
|
}
|
|
299
268
|
/**
|
|
300
|
-
* @see https://docs.voucherify.io/reference
|
|
269
|
+
* @see https://docs.voucherify.io/reference/create-publication
|
|
301
270
|
*/
|
|
302
271
|
|
|
303
272
|
|
|
@@ -325,7 +294,7 @@ class Exports {
|
|
|
325
294
|
this.client = client;
|
|
326
295
|
}
|
|
327
296
|
/**
|
|
328
|
-
* @see https://docs.voucherify.io/reference
|
|
297
|
+
* @see https://docs.voucherify.io/reference/create-export
|
|
329
298
|
*/
|
|
330
299
|
|
|
331
300
|
|
|
@@ -333,7 +302,7 @@ class Exports {
|
|
|
333
302
|
return this.client.post('/exports', exportResource);
|
|
334
303
|
}
|
|
335
304
|
/**
|
|
336
|
-
* @see https://docs.voucherify.io/reference
|
|
305
|
+
* @see https://docs.voucherify.io/reference/get-export
|
|
337
306
|
*/
|
|
338
307
|
|
|
339
308
|
|
|
@@ -341,7 +310,7 @@ class Exports {
|
|
|
341
310
|
return this.client.get(`/exports/${encode(exportResourceId)}`);
|
|
342
311
|
}
|
|
343
312
|
/**
|
|
344
|
-
* @see https://docs.voucherify.io/reference
|
|
313
|
+
* @see https://docs.voucherify.io/reference/delete-export
|
|
345
314
|
*/
|
|
346
315
|
|
|
347
316
|
|
|
@@ -356,6 +325,10 @@ class Events {
|
|
|
356
325
|
this.client = void 0;
|
|
357
326
|
this.client = client;
|
|
358
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* @see https://docs.voucherify.io/reference/track-custom-event-client-side
|
|
330
|
+
*/
|
|
331
|
+
|
|
359
332
|
|
|
360
333
|
create(eventName, params) {
|
|
361
334
|
params = { ...params,
|
|
@@ -374,7 +347,7 @@ class Balance {
|
|
|
374
347
|
/**
|
|
375
348
|
* Add Gift Voucher Balance
|
|
376
349
|
* This method gives a possibility to add balance to an existing gift voucher.
|
|
377
|
-
* @see https://docs.voucherify.io/reference
|
|
350
|
+
* @see https://docs.voucherify.io/reference/add-gift-voucher-balance
|
|
378
351
|
*/
|
|
379
352
|
|
|
380
353
|
|
|
@@ -392,7 +365,8 @@ class VouchersQualification {
|
|
|
392
365
|
/**
|
|
393
366
|
* The method can be used for sending a request to display all vouchers qualified to the given customer and context (e.g., order, loyalty reward). A checking logic won't run among coupons from bulk unique codes campaigns. For campaigns with multiple unique codes, you should run a dedicated function for searching for qualified campaigns.
|
|
394
367
|
* As a sample use case, you can imagine a requirement of displaying below cart the coupons eligible to a customer. The customer can take and apply the proposed voucher.
|
|
395
|
-
*
|
|
368
|
+
*
|
|
369
|
+
* @see https://docs.voucherify.io/reference/push-qualification-request
|
|
396
370
|
*/
|
|
397
371
|
|
|
398
372
|
|
|
@@ -412,7 +386,7 @@ class Vouchers {
|
|
|
412
386
|
this.qualifications = new VouchersQualification(this.client);
|
|
413
387
|
}
|
|
414
388
|
/**
|
|
415
|
-
* @see https://docs.voucherify.io/reference
|
|
389
|
+
* @see https://docs.voucherify.io/reference/create-voucher
|
|
416
390
|
*/
|
|
417
391
|
|
|
418
392
|
|
|
@@ -420,7 +394,7 @@ class Vouchers {
|
|
|
420
394
|
return this.client.post(`/vouchers/${encode(voucher.code)}`, voucher);
|
|
421
395
|
}
|
|
422
396
|
/**
|
|
423
|
-
* @see https://docs.voucherify.io/reference
|
|
397
|
+
* @see https://docs.voucherify.io/reference/vouchers-get
|
|
424
398
|
*/
|
|
425
399
|
|
|
426
400
|
|
|
@@ -428,7 +402,7 @@ class Vouchers {
|
|
|
428
402
|
return this.client.get(`/vouchers/${encode(code)}`);
|
|
429
403
|
}
|
|
430
404
|
/**
|
|
431
|
-
* @see https://docs.voucherify.io/reference
|
|
405
|
+
* @see https://docs.voucherify.io/reference/update-voucher
|
|
432
406
|
*/
|
|
433
407
|
|
|
434
408
|
|
|
@@ -436,7 +410,7 @@ class Vouchers {
|
|
|
436
410
|
return this.client.put(`/vouchers/${encode(voucher.code)}`, voucher);
|
|
437
411
|
}
|
|
438
412
|
/**
|
|
439
|
-
* @see https://docs.voucherify.io/reference
|
|
413
|
+
* @see https://docs.voucherify.io/reference/delete-voucher
|
|
440
414
|
*/
|
|
441
415
|
|
|
442
416
|
|
|
@@ -444,7 +418,7 @@ class Vouchers {
|
|
|
444
418
|
return this.client.delete(`/vouchers/${encode(code)}`, params);
|
|
445
419
|
}
|
|
446
420
|
/**
|
|
447
|
-
* @see https://docs.voucherify.io/reference
|
|
421
|
+
* @see https://docs.voucherify.io/reference/list-vouchers
|
|
448
422
|
*/
|
|
449
423
|
|
|
450
424
|
|
|
@@ -452,7 +426,7 @@ class Vouchers {
|
|
|
452
426
|
return this.client.get('/vouchers', params);
|
|
453
427
|
}
|
|
454
428
|
/**
|
|
455
|
-
* @see https://docs.voucherify.io/reference
|
|
429
|
+
* @see https://docs.voucherify.io/reference/enable-voucher
|
|
456
430
|
*/
|
|
457
431
|
|
|
458
432
|
|
|
@@ -460,7 +434,7 @@ class Vouchers {
|
|
|
460
434
|
return this.client.post(`/vouchers/${encode(code)}/enable`, {});
|
|
461
435
|
}
|
|
462
436
|
/**
|
|
463
|
-
* @see https://docs.voucherify.io/reference
|
|
437
|
+
* @see https://docs.voucherify.io/reference/disable-voucher
|
|
464
438
|
*/
|
|
465
439
|
|
|
466
440
|
|
|
@@ -468,7 +442,7 @@ class Vouchers {
|
|
|
468
442
|
return this.client.post(`/vouchers/${encode(code)}/disable`, {});
|
|
469
443
|
}
|
|
470
444
|
/**
|
|
471
|
-
* @see https://docs.voucherify.io/reference
|
|
445
|
+
* @see https://docs.voucherify.io/reference/import-vouchers-1
|
|
472
446
|
*/
|
|
473
447
|
|
|
474
448
|
|
|
@@ -476,23 +450,23 @@ class Vouchers {
|
|
|
476
450
|
return this.client.post('/vouchers/import', vouchers);
|
|
477
451
|
}
|
|
478
452
|
/**
|
|
479
|
-
* @see https://docs.voucherify.io/reference
|
|
453
|
+
* @see https://docs.voucherify.io/reference/aaupdate-vouchers-metadata-in-bulk
|
|
480
454
|
*/
|
|
481
455
|
|
|
482
456
|
|
|
483
457
|
bulkUpdateMetadata(params) {
|
|
484
|
-
return this.client.post('/vouchers/metadata', params);
|
|
458
|
+
return this.client.post('/vouchers/metadata/async', params);
|
|
485
459
|
}
|
|
486
460
|
/**
|
|
487
|
-
* @see https://docs.voucherify.io/reference
|
|
461
|
+
* @see https://docs.voucherify.io/reference/aa-update-vouchers-in-bulk
|
|
488
462
|
*/
|
|
489
463
|
|
|
490
464
|
|
|
491
465
|
bulkUpdate(vouchers) {
|
|
492
|
-
return this.client.post('/vouchers/bulk', vouchers);
|
|
466
|
+
return this.client.post('/vouchers/bulk/async', vouchers);
|
|
493
467
|
}
|
|
494
468
|
/**
|
|
495
|
-
* @see https://docs.voucherify.io/reference
|
|
469
|
+
* @see https://docs.voucherify.io/reference/release-validation-session
|
|
496
470
|
*/
|
|
497
471
|
|
|
498
472
|
|
|
@@ -510,7 +484,7 @@ class Validations {
|
|
|
510
484
|
this.promotions = promotions;
|
|
511
485
|
}
|
|
512
486
|
/**
|
|
513
|
-
* @see https://docs.voucherify.io/reference
|
|
487
|
+
* @see https://docs.voucherify.io/reference/validate-voucher
|
|
514
488
|
*/
|
|
515
489
|
|
|
516
490
|
|
|
@@ -534,7 +508,7 @@ class Redemptions {
|
|
|
534
508
|
this.client = client;
|
|
535
509
|
}
|
|
536
510
|
/**
|
|
537
|
-
* @see https://docs.voucherify.io/reference
|
|
511
|
+
* @see https://docs.voucherify.io/reference/redeem-voucher
|
|
538
512
|
*/
|
|
539
513
|
|
|
540
514
|
|
|
@@ -542,7 +516,7 @@ class Redemptions {
|
|
|
542
516
|
return this.client.post(`/vouchers/${encode(code)}/redemption`, body);
|
|
543
517
|
}
|
|
544
518
|
/**
|
|
545
|
-
* @see https://docs.voucherify.io/reference
|
|
519
|
+
* @see https://docs.voucherify.io/reference/get-redemption
|
|
546
520
|
*/
|
|
547
521
|
|
|
548
522
|
|
|
@@ -550,7 +524,7 @@ class Redemptions {
|
|
|
550
524
|
return this.client.get(`/redemptions/${encode(redemptionId)}`);
|
|
551
525
|
}
|
|
552
526
|
/**
|
|
553
|
-
* @see https://docs.voucherify.io/reference
|
|
527
|
+
* @see https://docs.voucherify.io/reference/list-redemptions
|
|
554
528
|
*/
|
|
555
529
|
|
|
556
530
|
|
|
@@ -558,7 +532,7 @@ class Redemptions {
|
|
|
558
532
|
return this.client.get('/redemptions', params);
|
|
559
533
|
}
|
|
560
534
|
/**
|
|
561
|
-
* @see https://docs.voucherify.io/reference
|
|
535
|
+
* @see https://docs.voucherify.io/reference/vouchers-redemptions
|
|
562
536
|
*/
|
|
563
537
|
|
|
564
538
|
|
|
@@ -566,7 +540,7 @@ class Redemptions {
|
|
|
566
540
|
return this.client.get(`/vouchers/${encode(code)}/redemption`);
|
|
567
541
|
}
|
|
568
542
|
/**
|
|
569
|
-
* @see https://docs.voucherify.io/reference
|
|
543
|
+
* @see https://docs.voucherify.io/reference/rollback-redemption
|
|
570
544
|
*/
|
|
571
545
|
|
|
572
546
|
|
|
@@ -602,7 +576,7 @@ class PromotionTiers {
|
|
|
602
576
|
this.client = client;
|
|
603
577
|
}
|
|
604
578
|
/**
|
|
605
|
-
* @see
|
|
579
|
+
* @see https://docs.voucherify.io/reference/list-promotion-tiers
|
|
606
580
|
*/
|
|
607
581
|
|
|
608
582
|
|
|
@@ -610,7 +584,7 @@ class PromotionTiers {
|
|
|
610
584
|
return this.client.get('/promotions/tiers', params);
|
|
611
585
|
}
|
|
612
586
|
/**
|
|
613
|
-
* @see
|
|
587
|
+
* @see https://docs.voucherify.io/reference/get-promotions
|
|
614
588
|
*/
|
|
615
589
|
|
|
616
590
|
|
|
@@ -618,7 +592,7 @@ class PromotionTiers {
|
|
|
618
592
|
return this.client.get(`/promotions/${encode(promotionId)}/tiers`);
|
|
619
593
|
}
|
|
620
594
|
/**
|
|
621
|
-
* @see
|
|
595
|
+
* @see https://docs.voucherify.io/reference/add-promotion-tier-to-campaign
|
|
622
596
|
*/
|
|
623
597
|
|
|
624
598
|
|
|
@@ -626,7 +600,7 @@ class PromotionTiers {
|
|
|
626
600
|
return this.client.post(`/promotions/${encode(promotionId)}/tiers`, params);
|
|
627
601
|
}
|
|
628
602
|
/**
|
|
629
|
-
* @see
|
|
603
|
+
* @see https://docs.voucherify.io/reference/redeem-promotion
|
|
630
604
|
*/
|
|
631
605
|
|
|
632
606
|
|
|
@@ -634,7 +608,7 @@ class PromotionTiers {
|
|
|
634
608
|
return this.client.post(`/promotions/tiers/${encode(promotionsTierId)}/redemption`, params);
|
|
635
609
|
}
|
|
636
610
|
/**
|
|
637
|
-
* @see
|
|
611
|
+
* @see https://docs.voucherify.io/reference/update-promotion
|
|
638
612
|
*/
|
|
639
613
|
|
|
640
614
|
|
|
@@ -642,7 +616,7 @@ class PromotionTiers {
|
|
|
642
616
|
return this.client.put(`/promotions/tiers/${encode(params.id)}`, params);
|
|
643
617
|
}
|
|
644
618
|
/**
|
|
645
|
-
* @see
|
|
619
|
+
* @see https://docs.voucherify.io/reference/delete-promotion
|
|
646
620
|
*/
|
|
647
621
|
|
|
648
622
|
|
|
@@ -660,7 +634,7 @@ class Promotions {
|
|
|
660
634
|
this.tiers = tiers;
|
|
661
635
|
}
|
|
662
636
|
/**
|
|
663
|
-
* @see
|
|
637
|
+
* @see https://docs.voucherify.io/reference/create-promotion-campaign
|
|
664
638
|
*/
|
|
665
639
|
|
|
666
640
|
|
|
@@ -668,7 +642,7 @@ class Promotions {
|
|
|
668
642
|
return this.client.post('/campaigns', promotionCampaign);
|
|
669
643
|
}
|
|
670
644
|
/**
|
|
671
|
-
* @see
|
|
645
|
+
* @see https://docs.voucherify.io/reference/validate-promotions-1
|
|
672
646
|
*/
|
|
673
647
|
|
|
674
648
|
|
|
@@ -684,7 +658,7 @@ class Customers {
|
|
|
684
658
|
this.client = client;
|
|
685
659
|
}
|
|
686
660
|
/**
|
|
687
|
-
* @see https://docs.voucherify.io/reference
|
|
661
|
+
* @see https://docs.voucherify.io/reference/create-customer
|
|
688
662
|
*/
|
|
689
663
|
|
|
690
664
|
|
|
@@ -692,7 +666,7 @@ class Customers {
|
|
|
692
666
|
return this.client.post('/customers', customer);
|
|
693
667
|
}
|
|
694
668
|
/**
|
|
695
|
-
* @see https://docs.voucherify.io/reference
|
|
669
|
+
* @see https://docs.voucherify.io/reference/read-customer
|
|
696
670
|
*/
|
|
697
671
|
|
|
698
672
|
|
|
@@ -700,7 +674,7 @@ class Customers {
|
|
|
700
674
|
return this.client.get(`/customers/${encode(customerId)}`);
|
|
701
675
|
}
|
|
702
676
|
/**
|
|
703
|
-
* @see https://docs.voucherify.io/reference
|
|
677
|
+
* @see https://docs.voucherify.io/reference/list-customers
|
|
704
678
|
*/
|
|
705
679
|
|
|
706
680
|
|
|
@@ -748,7 +722,7 @@ class Customers {
|
|
|
748
722
|
}
|
|
749
723
|
}
|
|
750
724
|
/**
|
|
751
|
-
* @see https://docs.voucherify.io/reference
|
|
725
|
+
* @see https://docs.voucherify.io/reference/update-customer
|
|
752
726
|
*/
|
|
753
727
|
|
|
754
728
|
|
|
@@ -758,7 +732,7 @@ class Customers {
|
|
|
758
732
|
return this.client.put(`/customers/${encode(id)}`, customerWithoutId);
|
|
759
733
|
}
|
|
760
734
|
/**
|
|
761
|
-
* @see https://docs.voucherify.io/reference
|
|
735
|
+
* @see https://docs.voucherify.io/reference/delete-customer
|
|
762
736
|
*/
|
|
763
737
|
|
|
764
738
|
|
|
@@ -766,7 +740,7 @@ class Customers {
|
|
|
766
740
|
return this.client.delete(`/customers/${encode(customerId)}`);
|
|
767
741
|
}
|
|
768
742
|
/**
|
|
769
|
-
* @see https://docs.voucherify.io/reference
|
|
743
|
+
* @see https://docs.voucherify.io/reference/update-customers-consents
|
|
770
744
|
*/
|
|
771
745
|
|
|
772
746
|
|
|
@@ -782,7 +756,7 @@ class Consents {
|
|
|
782
756
|
this.client = client;
|
|
783
757
|
}
|
|
784
758
|
/**
|
|
785
|
-
* @see https://docs.voucherify.io/reference
|
|
759
|
+
* @see https://docs.voucherify.io/reference/get-consents
|
|
786
760
|
*/
|
|
787
761
|
|
|
788
762
|
|
|
@@ -798,7 +772,7 @@ class Orders {
|
|
|
798
772
|
this.client = client;
|
|
799
773
|
}
|
|
800
774
|
/**
|
|
801
|
-
* @see https://docs.voucherify.io/reference
|
|
775
|
+
* @see https://docs.voucherify.io/reference/create-order
|
|
802
776
|
*/
|
|
803
777
|
|
|
804
778
|
|
|
@@ -806,7 +780,7 @@ class Orders {
|
|
|
806
780
|
return this.client.post('/orders', order);
|
|
807
781
|
}
|
|
808
782
|
/**
|
|
809
|
-
* @see https://docs.voucherify.io/reference
|
|
783
|
+
* @see https://docs.voucherify.io/reference/get-order
|
|
810
784
|
*/
|
|
811
785
|
|
|
812
786
|
|
|
@@ -814,7 +788,7 @@ class Orders {
|
|
|
814
788
|
return this.client.get(`/orders/${encode(orderId)}`);
|
|
815
789
|
}
|
|
816
790
|
/**
|
|
817
|
-
* @see https://docs.voucherify.io/reference
|
|
791
|
+
* @see https://docs.voucherify.io/reference/update-order
|
|
818
792
|
*/
|
|
819
793
|
|
|
820
794
|
|
|
@@ -822,7 +796,7 @@ class Orders {
|
|
|
822
796
|
return this.client.put(`/orders/${encode(order.id || order.source_id)}`, omit(order, ['id']));
|
|
823
797
|
}
|
|
824
798
|
/**
|
|
825
|
-
* @see https://docs.voucherify.io/reference
|
|
799
|
+
* @see https://docs.voucherify.io/reference/list-orders
|
|
826
800
|
*/
|
|
827
801
|
|
|
828
802
|
|
|
@@ -838,7 +812,7 @@ class Products {
|
|
|
838
812
|
this.client = client;
|
|
839
813
|
}
|
|
840
814
|
/**
|
|
841
|
-
* @see https://docs.voucherify.io/reference
|
|
815
|
+
* @see https://docs.voucherify.io/reference/create-product
|
|
842
816
|
*/
|
|
843
817
|
|
|
844
818
|
|
|
@@ -846,7 +820,7 @@ class Products {
|
|
|
846
820
|
return this.client.post('/products', product);
|
|
847
821
|
}
|
|
848
822
|
/**
|
|
849
|
-
* @see https://docs.voucherify.io/reference
|
|
823
|
+
* @see https://docs.voucherify.io/reference/get-product
|
|
850
824
|
*/
|
|
851
825
|
|
|
852
826
|
|
|
@@ -854,7 +828,7 @@ class Products {
|
|
|
854
828
|
return this.client.get(`/products/${encode(productId)}`);
|
|
855
829
|
}
|
|
856
830
|
/**
|
|
857
|
-
* @see https://docs.voucherify.io/reference
|
|
831
|
+
* @see https://docs.voucherify.io/reference/update-product
|
|
858
832
|
*/
|
|
859
833
|
|
|
860
834
|
|
|
@@ -862,23 +836,23 @@ class Products {
|
|
|
862
836
|
return this.client.put(`/products/${encode(product.id || product.source_id)}`, omit(product, ['id']));
|
|
863
837
|
}
|
|
864
838
|
/**
|
|
865
|
-
* @see https://docs.voucherify.io/reference
|
|
839
|
+
* @see https://docs.voucherify.io/reference/async-update-products-metadata-in-bulk
|
|
866
840
|
*/
|
|
867
841
|
|
|
868
842
|
|
|
869
|
-
|
|
870
|
-
return this.client.post('/products/metadata', products);
|
|
843
|
+
bulkUpdateMetadata(products) {
|
|
844
|
+
return this.client.post('/products/metadata/async', products);
|
|
871
845
|
}
|
|
872
846
|
/**
|
|
873
|
-
* @see https://docs.voucherify.io/reference
|
|
847
|
+
* @see https://docs.voucherify.io/reference/post-products-in-bulk
|
|
874
848
|
*/
|
|
875
849
|
|
|
876
850
|
|
|
877
851
|
bulkUpdate(products) {
|
|
878
|
-
return this.client.post('/products/bulk', products);
|
|
852
|
+
return this.client.post('/products/bulk/async', products);
|
|
879
853
|
}
|
|
880
854
|
/**
|
|
881
|
-
* @see https://docs.voucherify.io/reference
|
|
855
|
+
* @see https://docs.voucherify.io/reference/delete-product
|
|
882
856
|
*/
|
|
883
857
|
|
|
884
858
|
|
|
@@ -886,7 +860,7 @@ class Products {
|
|
|
886
860
|
return this.client.delete(`/products/${encode(productId)}`, params);
|
|
887
861
|
}
|
|
888
862
|
/**
|
|
889
|
-
* @see https://docs.voucherify.io/reference
|
|
863
|
+
* @see https://docs.voucherify.io/reference/list-products
|
|
890
864
|
*/
|
|
891
865
|
|
|
892
866
|
|
|
@@ -894,7 +868,7 @@ class Products {
|
|
|
894
868
|
return this.client.get('/products', params);
|
|
895
869
|
}
|
|
896
870
|
/**
|
|
897
|
-
* @see https://docs.voucherify.io/reference
|
|
871
|
+
* @see https://docs.voucherify.io/reference/create-sku
|
|
898
872
|
*/
|
|
899
873
|
|
|
900
874
|
|
|
@@ -902,15 +876,15 @@ class Products {
|
|
|
902
876
|
return this.client.post(`/products/${encode(productId)}/skus`, sku);
|
|
903
877
|
}
|
|
904
878
|
/**
|
|
905
|
-
* @see https://docs.voucherify.io/reference
|
|
879
|
+
* @see https://docs.voucherify.io/reference/get-sku-v20210726
|
|
906
880
|
*/
|
|
907
881
|
|
|
908
882
|
|
|
909
|
-
getSku(
|
|
910
|
-
return this.client.get(`/
|
|
883
|
+
getSku(skuId) {
|
|
884
|
+
return this.client.get(`/skus/${encode(skuId)}`);
|
|
911
885
|
}
|
|
912
886
|
/**
|
|
913
|
-
* @see https://docs.voucherify.io/reference
|
|
887
|
+
* @see https://docs.voucherify.io/reference/update-sku
|
|
914
888
|
*/
|
|
915
889
|
|
|
916
890
|
|
|
@@ -918,7 +892,7 @@ class Products {
|
|
|
918
892
|
return this.client.put(`/products/${encode(productId)}/skus/${encode(sku.id || sku.source_id)}`, omit(sku, ['id']));
|
|
919
893
|
}
|
|
920
894
|
/**
|
|
921
|
-
* @see https://docs.voucherify.io/reference
|
|
895
|
+
* @see https://docs.voucherify.io/reference/delete-sku
|
|
922
896
|
*/
|
|
923
897
|
|
|
924
898
|
|
|
@@ -926,7 +900,7 @@ class Products {
|
|
|
926
900
|
return this.client.delete(`/products/${encode(productId)}/skus/${encode(skuId)}`, params);
|
|
927
901
|
}
|
|
928
902
|
/**
|
|
929
|
-
* @see https://docs.voucherify.io/reference
|
|
903
|
+
* @see https://docs.voucherify.io/reference/list-skus
|
|
930
904
|
*/
|
|
931
905
|
|
|
932
906
|
|
|
@@ -942,7 +916,7 @@ class Rewards {
|
|
|
942
916
|
this.client = client;
|
|
943
917
|
}
|
|
944
918
|
/**
|
|
945
|
-
* @see https://docs.voucherify.io/reference
|
|
919
|
+
* @see https://docs.voucherify.io/reference/list-rewards
|
|
946
920
|
*/
|
|
947
921
|
|
|
948
922
|
|
|
@@ -950,7 +924,7 @@ class Rewards {
|
|
|
950
924
|
return this.client.get('/rewards', params);
|
|
951
925
|
}
|
|
952
926
|
/**
|
|
953
|
-
* @see https://docs.voucherify.io/reference
|
|
927
|
+
* @see https://docs.voucherify.io/reference/create-reward
|
|
954
928
|
*/
|
|
955
929
|
|
|
956
930
|
|
|
@@ -958,7 +932,7 @@ class Rewards {
|
|
|
958
932
|
return this.client.post('/rewards', reward);
|
|
959
933
|
}
|
|
960
934
|
/**
|
|
961
|
-
* @see https://docs.voucherify.io/reference
|
|
935
|
+
* @see https://docs.voucherify.io/reference/get-reward
|
|
962
936
|
*/
|
|
963
937
|
|
|
964
938
|
|
|
@@ -966,7 +940,7 @@ class Rewards {
|
|
|
966
940
|
return this.client.get(`/rewards/${encode(rewardId)}`);
|
|
967
941
|
}
|
|
968
942
|
/**
|
|
969
|
-
* @see https://docs.voucherify.io/reference
|
|
943
|
+
* @see https://docs.voucherify.io/reference/update-reward
|
|
970
944
|
*/
|
|
971
945
|
|
|
972
946
|
|
|
@@ -974,7 +948,7 @@ class Rewards {
|
|
|
974
948
|
return this.client.put(`/rewards/${encode(reward.id)}`, omit(reward, ['id']));
|
|
975
949
|
}
|
|
976
950
|
/**
|
|
977
|
-
* @see https://docs.voucherify.io/reference
|
|
951
|
+
* @see https://docs.voucherify.io/reference/delete-reward
|
|
978
952
|
*/
|
|
979
953
|
|
|
980
954
|
|
|
@@ -982,7 +956,7 @@ class Rewards {
|
|
|
982
956
|
return this.client.delete(`/rewards/${encode(rewardId)}`);
|
|
983
957
|
}
|
|
984
958
|
/**
|
|
985
|
-
* @see https://docs.voucherify.io/reference
|
|
959
|
+
* @see https://docs.voucherify.io/reference/list-reward-assignments
|
|
986
960
|
*/
|
|
987
961
|
|
|
988
962
|
|
|
@@ -990,7 +964,7 @@ class Rewards {
|
|
|
990
964
|
return this.client.get(`/rewards/${encode(rewardId)}/assignments`, params);
|
|
991
965
|
}
|
|
992
966
|
/**
|
|
993
|
-
* @see https://docs.voucherify.io/reference
|
|
967
|
+
* @see https://docs.voucherify.io/reference/create-reward-assignment
|
|
994
968
|
*/
|
|
995
969
|
|
|
996
970
|
|
|
@@ -998,7 +972,7 @@ class Rewards {
|
|
|
998
972
|
return this.client.post(`/rewards/${encode(rewardId)}/assignments`, assignment);
|
|
999
973
|
}
|
|
1000
974
|
/**
|
|
1001
|
-
* @see https://docs.voucherify.io/reference
|
|
975
|
+
* @see https://docs.voucherify.io/reference/update-reward-assignment
|
|
1002
976
|
*/
|
|
1003
977
|
|
|
1004
978
|
|
|
@@ -1018,7 +992,7 @@ class Loyalties {
|
|
|
1018
992
|
this.client = client;
|
|
1019
993
|
}
|
|
1020
994
|
/**
|
|
1021
|
-
* @see https://docs.voucherify.io/reference
|
|
995
|
+
* @see https://docs.voucherify.io/reference/list-loyalty-programs
|
|
1022
996
|
*/
|
|
1023
997
|
|
|
1024
998
|
|
|
@@ -1026,7 +1000,7 @@ class Loyalties {
|
|
|
1026
1000
|
return this.client.get('/loyalties', params);
|
|
1027
1001
|
}
|
|
1028
1002
|
/**
|
|
1029
|
-
* @see https://docs.voucherify.io/reference
|
|
1003
|
+
* @see https://docs.voucherify.io/reference/create-loyalty-program
|
|
1030
1004
|
*/
|
|
1031
1005
|
|
|
1032
1006
|
|
|
@@ -1034,7 +1008,7 @@ class Loyalties {
|
|
|
1034
1008
|
return this.client.post('/loyalties', campaign);
|
|
1035
1009
|
}
|
|
1036
1010
|
/**
|
|
1037
|
-
* @see https://docs.voucherify.io/reference
|
|
1011
|
+
* @see https://docs.voucherify.io/reference/get-loyalty-program
|
|
1038
1012
|
*/
|
|
1039
1013
|
|
|
1040
1014
|
|
|
@@ -1042,7 +1016,7 @@ class Loyalties {
|
|
|
1042
1016
|
return this.client.get(`/loyalties/${encode(campaignId)}`);
|
|
1043
1017
|
}
|
|
1044
1018
|
/**
|
|
1045
|
-
* @see https://docs.voucherify.io/reference
|
|
1019
|
+
* @see https://docs.voucherify.io/reference/update-loyalty-program
|
|
1046
1020
|
*/
|
|
1047
1021
|
|
|
1048
1022
|
|
|
@@ -1050,7 +1024,7 @@ class Loyalties {
|
|
|
1050
1024
|
return this.client.put(`/loyalties/${encode(campaign.id)}`, omit(campaign, ['id']));
|
|
1051
1025
|
}
|
|
1052
1026
|
/**
|
|
1053
|
-
* @see https://docs.voucherify.io/reference
|
|
1027
|
+
* @see https://docs.voucherify.io/reference/delete-loyalty-program
|
|
1054
1028
|
*/
|
|
1055
1029
|
|
|
1056
1030
|
|
|
@@ -1058,7 +1032,7 @@ class Loyalties {
|
|
|
1058
1032
|
return this.client.delete(`/loyalties/${encode(campaignId)}`, params);
|
|
1059
1033
|
}
|
|
1060
1034
|
/**
|
|
1061
|
-
* @see https://docs.voucherify.io/reference
|
|
1035
|
+
* @see https://docs.voucherify.io/reference/list-reward-assignments-1
|
|
1062
1036
|
*/
|
|
1063
1037
|
|
|
1064
1038
|
|
|
@@ -1066,7 +1040,7 @@ class Loyalties {
|
|
|
1066
1040
|
return this.client.get(`/loyalties/${encode(campaignId)}/rewards`, params);
|
|
1067
1041
|
}
|
|
1068
1042
|
/**
|
|
1069
|
-
* @see https://docs.voucherify.io/reference
|
|
1043
|
+
* @see https://docs.voucherify.io/reference/create-reward-assignment-1
|
|
1070
1044
|
*/
|
|
1071
1045
|
|
|
1072
1046
|
|
|
@@ -1074,7 +1048,7 @@ class Loyalties {
|
|
|
1074
1048
|
return this.client.post(`/loyalties/${encode(campaignId)}/rewards`, assignment);
|
|
1075
1049
|
}
|
|
1076
1050
|
/**
|
|
1077
|
-
* @see https://docs.voucherify.io/reference
|
|
1051
|
+
* @see https://docs.voucherify.io/reference/update-reward-assignment-1
|
|
1078
1052
|
*/
|
|
1079
1053
|
|
|
1080
1054
|
|
|
@@ -1082,7 +1056,7 @@ class Loyalties {
|
|
|
1082
1056
|
return this.client.put(`/loyalties/${encode(campaignId)}/rewards/${assignment.id}`, omit(assignment, ['id']));
|
|
1083
1057
|
}
|
|
1084
1058
|
/**
|
|
1085
|
-
* @see https://docs.voucherify.io/reference
|
|
1059
|
+
* @see https://docs.voucherify.io/reference/delete-reward-assignment-1
|
|
1086
1060
|
*/
|
|
1087
1061
|
|
|
1088
1062
|
|
|
@@ -1090,7 +1064,7 @@ class Loyalties {
|
|
|
1090
1064
|
return this.client.delete(`/loyalties/${encode(campaignId)}/rewards/${assignmentId}`);
|
|
1091
1065
|
}
|
|
1092
1066
|
/**
|
|
1093
|
-
* @see https://docs.voucherify.io/reference
|
|
1067
|
+
* @see https://docs.voucherify.io/reference/list-earning-rules
|
|
1094
1068
|
*/
|
|
1095
1069
|
|
|
1096
1070
|
|
|
@@ -1098,7 +1072,7 @@ class Loyalties {
|
|
|
1098
1072
|
return this.client.get(`/loyalties/${encode(campaignId)}/earning-rules`, params);
|
|
1099
1073
|
}
|
|
1100
1074
|
/**
|
|
1101
|
-
* @see https://docs.voucherify.io/reference
|
|
1075
|
+
* @see https://docs.voucherify.io/reference/create-earning-rule
|
|
1102
1076
|
*/
|
|
1103
1077
|
|
|
1104
1078
|
|
|
@@ -1106,7 +1080,7 @@ class Loyalties {
|
|
|
1106
1080
|
return this.client.post(`/loyalties/${encode(campaignId)}/earning-rules`, earningRules);
|
|
1107
1081
|
}
|
|
1108
1082
|
/**
|
|
1109
|
-
* @see https://docs.voucherify.io/reference
|
|
1083
|
+
* @see https://docs.voucherify.io/reference/update-earning-rule
|
|
1110
1084
|
*/
|
|
1111
1085
|
|
|
1112
1086
|
|
|
@@ -1114,7 +1088,7 @@ class Loyalties {
|
|
|
1114
1088
|
return this.client.put(`/loyalties/${encode(campaignId)}/earning-rules/${earningRule.id}`, omit(earningRule, ['id']));
|
|
1115
1089
|
}
|
|
1116
1090
|
/**
|
|
1117
|
-
* @see https://docs.voucherify.io/reference
|
|
1091
|
+
* @see https://docs.voucherify.io/reference/delete-earning-rule
|
|
1118
1092
|
*/
|
|
1119
1093
|
|
|
1120
1094
|
|
|
@@ -1122,7 +1096,7 @@ class Loyalties {
|
|
|
1122
1096
|
return this.client.delete(`/loyalties/${encode(campaignId)}/earning-rules/${earningRuleId}`);
|
|
1123
1097
|
}
|
|
1124
1098
|
/**
|
|
1125
|
-
* @see https://docs.voucherify.io/reference
|
|
1099
|
+
* @see https://docs.voucherify.io/reference/list-members
|
|
1126
1100
|
*/
|
|
1127
1101
|
|
|
1128
1102
|
|
|
@@ -1130,7 +1104,7 @@ class Loyalties {
|
|
|
1130
1104
|
return this.client.get(`/loyalties/${encode(campaignId)}/members`, params);
|
|
1131
1105
|
}
|
|
1132
1106
|
/**
|
|
1133
|
-
* @see https://docs.voucherify.io/reference
|
|
1107
|
+
* @see https://docs.voucherify.io/reference/create-member
|
|
1134
1108
|
*/
|
|
1135
1109
|
|
|
1136
1110
|
|
|
@@ -1138,7 +1112,7 @@ class Loyalties {
|
|
|
1138
1112
|
return this.client.post(`/loyalties/${encode(campaignId)}/members`, member);
|
|
1139
1113
|
}
|
|
1140
1114
|
/**
|
|
1141
|
-
* @see https://docs.voucherify.io/reference
|
|
1115
|
+
* @see https://docs.voucherify.io/reference/get-member
|
|
1142
1116
|
*/
|
|
1143
1117
|
|
|
1144
1118
|
|
|
@@ -1146,7 +1120,7 @@ class Loyalties {
|
|
|
1146
1120
|
return this.client.get(`/loyalties/${encode(campaignId)}/members/${memberId}`);
|
|
1147
1121
|
}
|
|
1148
1122
|
/**
|
|
1149
|
-
* @see https://docs.voucherify.io/reference
|
|
1123
|
+
* @see https://docs.voucherify.io/reference/get-member-activities
|
|
1150
1124
|
*/
|
|
1151
1125
|
|
|
1152
1126
|
|
|
@@ -1154,7 +1128,7 @@ class Loyalties {
|
|
|
1154
1128
|
return this.client.get(`/loyalties/${encode(campaignId)}/members/${memberId}/activities`);
|
|
1155
1129
|
}
|
|
1156
1130
|
/**
|
|
1157
|
-
* @see https://docs.voucherify.io/reference
|
|
1131
|
+
* @see https://docs.voucherify.io/reference/add-loyalty-card-balance
|
|
1158
1132
|
*/
|
|
1159
1133
|
|
|
1160
1134
|
|
|
@@ -1162,7 +1136,7 @@ class Loyalties {
|
|
|
1162
1136
|
return this.client.post(`/loyalties/${encode(campaignId)}/members/${memberId}/balance`, balance);
|
|
1163
1137
|
}
|
|
1164
1138
|
/**
|
|
1165
|
-
* @see https://docs.voucherify.io/reference
|
|
1139
|
+
* @see https://docs.voucherify.io/reference/redeem-loyalty-card
|
|
1166
1140
|
*/
|
|
1167
1141
|
|
|
1168
1142
|
|
|
@@ -1178,7 +1152,7 @@ class ValidationRules {
|
|
|
1178
1152
|
this.client = client;
|
|
1179
1153
|
}
|
|
1180
1154
|
/**
|
|
1181
|
-
* @see https://docs.voucherify.io/reference
|
|
1155
|
+
* @see https://docs.voucherify.io/reference/create-validation-rules
|
|
1182
1156
|
*/
|
|
1183
1157
|
|
|
1184
1158
|
|
|
@@ -1186,7 +1160,7 @@ class ValidationRules {
|
|
|
1186
1160
|
return this.client.post('/validation-rules', validationRule);
|
|
1187
1161
|
}
|
|
1188
1162
|
/**
|
|
1189
|
-
* @see https://docs.voucherify.io/reference
|
|
1163
|
+
* @see https://docs.voucherify.io/reference/get-validation-rules
|
|
1190
1164
|
*/
|
|
1191
1165
|
|
|
1192
1166
|
|
|
@@ -1194,7 +1168,7 @@ class ValidationRules {
|
|
|
1194
1168
|
return this.client.get(`/validation-rules/${encode(validationRuleId)}`);
|
|
1195
1169
|
}
|
|
1196
1170
|
/**
|
|
1197
|
-
* @see https://docs.voucherify.io/reference
|
|
1171
|
+
* @see https://docs.voucherify.io/reference/update-validation-rules
|
|
1198
1172
|
*/
|
|
1199
1173
|
|
|
1200
1174
|
|
|
@@ -1202,7 +1176,7 @@ class ValidationRules {
|
|
|
1202
1176
|
return this.client.put(`/validation-rules/${encode(validationRule.id)}`, omit(validationRule, ['id']));
|
|
1203
1177
|
}
|
|
1204
1178
|
/**
|
|
1205
|
-
* @see https://docs.voucherify.io/reference
|
|
1179
|
+
* @see https://docs.voucherify.io/reference/delete-validation-rules
|
|
1206
1180
|
*/
|
|
1207
1181
|
|
|
1208
1182
|
|
|
@@ -1210,7 +1184,7 @@ class ValidationRules {
|
|
|
1210
1184
|
return this.client.delete(`/validation-rules/${encode(validationRuleId)}`);
|
|
1211
1185
|
}
|
|
1212
1186
|
/**
|
|
1213
|
-
* @see https://docs.voucherify.io/reference
|
|
1187
|
+
* @see https://docs.voucherify.io/reference/create-validation-rules-assignment
|
|
1214
1188
|
*/
|
|
1215
1189
|
|
|
1216
1190
|
|
|
@@ -1218,7 +1192,7 @@ class ValidationRules {
|
|
|
1218
1192
|
return this.client.post(`/validation-rules/${encode(validationRuleId)}/assignments`, assignment);
|
|
1219
1193
|
}
|
|
1220
1194
|
/**
|
|
1221
|
-
* @see https://docs.voucherify.io/reference
|
|
1195
|
+
* @see https://docs.voucherify.io/reference/delete-validation-rules-assignment
|
|
1222
1196
|
*/
|
|
1223
1197
|
|
|
1224
1198
|
|
|
@@ -1230,7 +1204,7 @@ class ValidationRules {
|
|
|
1230
1204
|
return this.client.post(`/validation-rules/${encode(validationRuleId)}/validation`, params);
|
|
1231
1205
|
}
|
|
1232
1206
|
/**
|
|
1233
|
-
* @see https://docs.voucherify.io/reference
|
|
1207
|
+
* @see https://docs.voucherify.io/reference/list-validation-rules
|
|
1234
1208
|
*/
|
|
1235
1209
|
|
|
1236
1210
|
|
|
@@ -1238,7 +1212,7 @@ class ValidationRules {
|
|
|
1238
1212
|
return this.client.get('/validation-rules', params);
|
|
1239
1213
|
}
|
|
1240
1214
|
/**
|
|
1241
|
-
* @see https://docs.voucherify.io/reference
|
|
1215
|
+
* @see https://docs.voucherify.io/reference/list-validation-rule-assignments
|
|
1242
1216
|
*/
|
|
1243
1217
|
|
|
1244
1218
|
|
|
@@ -1254,7 +1228,7 @@ class Segments {
|
|
|
1254
1228
|
this.client = client;
|
|
1255
1229
|
}
|
|
1256
1230
|
/**
|
|
1257
|
-
* @see https://docs.voucherify.io/reference
|
|
1231
|
+
* @see https://docs.voucherify.io/reference/create-segment
|
|
1258
1232
|
*/
|
|
1259
1233
|
|
|
1260
1234
|
|
|
@@ -1262,7 +1236,7 @@ class Segments {
|
|
|
1262
1236
|
return this.client.post('/segments', segment);
|
|
1263
1237
|
}
|
|
1264
1238
|
/**
|
|
1265
|
-
* @see https://docs.voucherify.io/reference
|
|
1239
|
+
* @see https://docs.voucherify.io/reference/get-segment
|
|
1266
1240
|
*/
|
|
1267
1241
|
|
|
1268
1242
|
|
|
@@ -1270,7 +1244,7 @@ class Segments {
|
|
|
1270
1244
|
return this.client.get(`/segments/${encode(segmentId)}`);
|
|
1271
1245
|
}
|
|
1272
1246
|
/**
|
|
1273
|
-
* @see https://docs.voucherify.io/reference
|
|
1247
|
+
* @see https://docs.voucherify.io/reference/delete-segment
|
|
1274
1248
|
*/
|
|
1275
1249
|
|
|
1276
1250
|
|
|
@@ -1278,7 +1252,7 @@ class Segments {
|
|
|
1278
1252
|
return this.client.delete(`/segments/${encode(segmentId)}`);
|
|
1279
1253
|
}
|
|
1280
1254
|
/**
|
|
1281
|
-
* @see https://docs.voucherify.io/reference
|
|
1255
|
+
* @see https://docs.voucherify.io/reference/list-segments
|
|
1282
1256
|
*/
|
|
1283
1257
|
|
|
1284
1258
|
|
|
@@ -1316,7 +1290,7 @@ function VoucherifyServerSide(options) {
|
|
|
1316
1290
|
let headers = {
|
|
1317
1291
|
'X-App-Id': options.applicationId,
|
|
1318
1292
|
'X-App-Token': options.secretKey,
|
|
1319
|
-
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"
|
|
1293
|
+
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.0.1"}`,
|
|
1320
1294
|
'Content-Type': 'application/json'
|
|
1321
1295
|
};
|
|
1322
1296
|
|
|
@@ -1394,7 +1368,7 @@ class ClientSide {
|
|
|
1394
1368
|
this.trackingId = identity;
|
|
1395
1369
|
}
|
|
1396
1370
|
/**
|
|
1397
|
-
* @see https://docs.voucherify.io/reference
|
|
1371
|
+
* @see https://docs.voucherify.io/reference/vouchers-validate
|
|
1398
1372
|
*/
|
|
1399
1373
|
|
|
1400
1374
|
|
|
@@ -1415,7 +1389,11 @@ class ClientSide {
|
|
|
1415
1389
|
metadata: params.orderMetadata
|
|
1416
1390
|
};
|
|
1417
1391
|
query.customer = params.customer;
|
|
1418
|
-
query.tracking_id = this.trackingId;
|
|
1392
|
+
query.tracking_id = params.tracking_id || this.trackingId;
|
|
1393
|
+
query.session_type = params.session_type;
|
|
1394
|
+
query.session_key = params.session_key;
|
|
1395
|
+
query.session_ttl = params.session_ttl;
|
|
1396
|
+
query.session_ttl_unit = params.session_ttl_unit;
|
|
1419
1397
|
}
|
|
1420
1398
|
|
|
1421
1399
|
if (!!query.code) {
|
|
@@ -1427,12 +1405,11 @@ class ClientSide {
|
|
|
1427
1405
|
|
|
1428
1406
|
assert(isOptionalObject(query == null ? void 0 : (_query$customer2 = query.customer) == null ? void 0 : _query$customer2.metadata), 'client.validate: expected "params.customer.metadata" to be an object'); // prettier-ignore
|
|
1429
1407
|
|
|
1430
|
-
const queryParams = toQueryParams(query);
|
|
1431
1408
|
const path = query.code ? '/validate' : '/promotions/validation';
|
|
1432
|
-
return this.client.get(path,
|
|
1409
|
+
return this.client.get(path, query);
|
|
1433
1410
|
}
|
|
1434
1411
|
/**
|
|
1435
|
-
* @see https://docs.voucherify.io/reference
|
|
1412
|
+
* @see https://docs.voucherify.io/reference/redeem-voucher-client-side
|
|
1436
1413
|
*/
|
|
1437
1414
|
|
|
1438
1415
|
|
|
@@ -1448,7 +1425,7 @@ class ClientSide {
|
|
|
1448
1425
|
});
|
|
1449
1426
|
}
|
|
1450
1427
|
/**
|
|
1451
|
-
* @see https://docs.voucherify.io/reference
|
|
1428
|
+
* @see https://docs.voucherify.io/reference/create-publication
|
|
1452
1429
|
*/
|
|
1453
1430
|
|
|
1454
1431
|
|
|
@@ -1466,7 +1443,7 @@ class ClientSide {
|
|
|
1466
1443
|
return this.client.post('/publish', preparedPayload, queryParams);
|
|
1467
1444
|
}
|
|
1468
1445
|
/**
|
|
1469
|
-
* @see https://docs.voucherify.io/reference
|
|
1446
|
+
* @see https://docs.voucherify.io/reference/track-custom-event-client-side
|
|
1470
1447
|
*/
|
|
1471
1448
|
|
|
1472
1449
|
|
|
@@ -1479,15 +1456,15 @@ class ClientSide {
|
|
|
1479
1456
|
event: event_name,
|
|
1480
1457
|
metadata: metadata != null ? metadata : {},
|
|
1481
1458
|
customer: customer,
|
|
1482
|
-
referral: referral != null ? referral :
|
|
1483
|
-
loyalty: loyalty != null ? loyalty :
|
|
1459
|
+
referral: referral != null ? referral : undefined,
|
|
1460
|
+
loyalty: loyalty != null ? loyalty : undefined
|
|
1484
1461
|
};
|
|
1485
1462
|
payload.customer.source_id = (_customer$source_id = customer.source_id) != null ? _customer$source_id : this.trackingId;
|
|
1486
1463
|
assert(isString((_payload$customer4 = payload.customer) == null ? void 0 : _payload$customer4.source_id), 'client.track - expected payload to contain customer source id or to have tracking id set up by Voucherify client');
|
|
1487
1464
|
return this.client.post('/events', payload);
|
|
1488
1465
|
}
|
|
1489
1466
|
/**
|
|
1490
|
-
* @see https://docs.voucherify.io/reference
|
|
1467
|
+
* @see https://docs.voucherify.io/reference/list-vouchers
|
|
1491
1468
|
*/
|
|
1492
1469
|
|
|
1493
1470
|
|
|
@@ -1500,11 +1477,10 @@ class ClientSide {
|
|
|
1500
1477
|
query.customer = params.customer;
|
|
1501
1478
|
query.created_at = params.created_at;
|
|
1502
1479
|
query.updated_at = params.updated_at;
|
|
1503
|
-
|
|
1504
|
-
return this.client.get('/vouchers', queryParams);
|
|
1480
|
+
return this.client.get('/vouchers', query);
|
|
1505
1481
|
}
|
|
1506
1482
|
/**
|
|
1507
|
-
* @see https://docs.voucherify.io/reference
|
|
1483
|
+
* @see https://docs.voucherify.io/reference/create-customer
|
|
1508
1484
|
*/
|
|
1509
1485
|
|
|
1510
1486
|
|
|
@@ -1514,7 +1490,7 @@ class ClientSide {
|
|
|
1514
1490
|
} : {});
|
|
1515
1491
|
}
|
|
1516
1492
|
/**
|
|
1517
|
-
* @see https://docs.voucherify.io/reference
|
|
1493
|
+
* @see https://docs.voucherify.io/reference/get-consent-client-side
|
|
1518
1494
|
*/
|
|
1519
1495
|
|
|
1520
1496
|
|
|
@@ -1522,7 +1498,7 @@ class ClientSide {
|
|
|
1522
1498
|
return this.client.get('/consents');
|
|
1523
1499
|
}
|
|
1524
1500
|
/**
|
|
1525
|
-
* @see https://docs.voucherify.io/reference
|
|
1501
|
+
* @see https://docs.voucherify.io/reference/update-customers-consents-client
|
|
1526
1502
|
*/
|
|
1527
1503
|
|
|
1528
1504
|
|
|
@@ -1543,7 +1519,7 @@ function VoucherifyClientSide(options) {
|
|
|
1543
1519
|
let headers = {
|
|
1544
1520
|
'X-Client-Application-Id': options.clientApplicationId,
|
|
1545
1521
|
'X-Client-Token': options.clientSecretKey,
|
|
1546
|
-
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"
|
|
1522
|
+
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.0.1"}`
|
|
1547
1523
|
};
|
|
1548
1524
|
|
|
1549
1525
|
if (environment().startsWith('Node')) {
|