@voucherify/sdk 2.3.0 → 2.4.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 +22 -0
- package/README.md +44 -2
- package/dist/Customers.d.ts +12 -0
- package/dist/Loyalties.d.ts +12 -0
- package/dist/types/Customers.d.ts +42 -0
- package/dist/types/Loyalties.d.ts +141 -0
- package/dist/voucherifysdk.esm.js +50 -2
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +50 -2
- 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 +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @voucherify/sdk
|
|
2
2
|
|
|
3
|
+
## 2.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`b11ce2c`](https://github.com/voucherifyio/voucherify-js-sdk/commit/b11ce2c6410c7441bd48fbbf33377b98c77af072) [#241](https://github.com/voucherifyio/voucherify-js-sdk/pull/241) Thanks [@p-zielinski](https://github.com/p-zielinski)! - Add support for 3 missing endpoints in loyalties api. Corrected a typo in one of loyalties api method.
|
|
8
|
+
- Added support for new endpoints: `GET /loyalties/{campaignId}/earning-rules/{earningRuleId}`, `POST /loyalties/{campaignId}/earning-rules/{earningRuleId}/enable` and `POST /loyalties/{campaignId}/earning-rules/{earningRuleId}/disable` [(examples available in readme.md)](..%2F..%2Fpackages%2Fsdk%2FREADME.md)
|
|
9
|
+
- New exported types/interfaces: `LoyaltiesGetEarningRuleResponseBody`, `LoyaltiesEnableEarningRulesResponseBody`, `LoyaltiesDisableEarningRulesResponseBody`, `EarningRuleEvent`, `EarningRuleBase`, `EarningRuleFixed`, `EarningRuleProportionalOrder`, `EarningRuleProportionalOrderAmount`, `EarningRuleProportionalOrderTotalAmount`, `EarningRuleProportionalOrderMetadata`, `EarningRuleProportionalOrderItems`, `EarningRuleProportionalOrderItemsQuantity`, `EarningRuleProportionalOrderItemsAmount`, `EarningRuleProportionalOrderItemsSubtotalAmount`, `EarningRuleProportionalCustomerMetadata`, `EarningRuleProportionalCustomEvent`, `EarningRuleProportional`
|
|
10
|
+
- Added optional parameter `calculation_type` to `LoyaltyProportional`
|
|
11
|
+
|
|
12
|
+
* [`5bb69da`](https://github.com/voucherifyio/voucherify-js-sdk/commit/5bb69daf95c1e16c48eb5070149b88f11bfe1a30) [#229](https://github.com/voucherifyio/voucherify-js-sdk/pull/229) Thanks [@marcin-slezak](https://github.com/marcin-slezak)! - Add missing methods covering Customers API.
|
|
13
|
+
- Added support for new endpoints:
|
|
14
|
+
- `POST /customers/{customerId}/permanent-deletion`,
|
|
15
|
+
- `POST /customers/bulk/async`,
|
|
16
|
+
- `POST /customers/metadata/async` [(examples of usage available in readme.md)](..%2F..%2Fpackages%2Fsdk%2FREADME.md)
|
|
17
|
+
- New domain types:
|
|
18
|
+
- `CustomerBase`
|
|
19
|
+
- `CustomerAddress`
|
|
20
|
+
- New exported types/interfaces:
|
|
21
|
+
- `CustomersUpdateInBulkRequestBody`,
|
|
22
|
+
- `CustomersUpdateMetadataInBulkRequestBody`,
|
|
23
|
+
- `CustomersDeletePermanentlyResponseBody`
|
|
24
|
+
|
|
3
25
|
## 2.3.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -130,7 +130,7 @@ const client = VoucherifyServerSide({
|
|
|
130
130
|
apiUrl: 'https://<region>.api.voucherify.io', // optional
|
|
131
131
|
apiVersion: 'v2018-08-01', // optional
|
|
132
132
|
channel: 'e-commerce', // optional
|
|
133
|
-
customHeaders: { "MY_CUSTOM_HEADER": "my_value" } // optional
|
|
133
|
+
customHeaders: { "MY_CUSTOM_HEADER": "my_value" }, // optional
|
|
134
134
|
timeoutMs: 10000 // optional
|
|
135
135
|
})
|
|
136
136
|
```
|
|
@@ -574,7 +574,7 @@ Check [promotion's tier object](https://docs.voucherify.io/reference/the-promoti
|
|
|
574
574
|
|
|
575
575
|
```javascript
|
|
576
576
|
client.promotions.tiers.listAll()
|
|
577
|
-
client.promotions.tiers.listAll(params
|
|
577
|
+
client.promotions.tiers.listAll(params)
|
|
578
578
|
```
|
|
579
579
|
|
|
580
580
|
#### [Add Promotion Tier to Campaign](https://docs.voucherify.io/reference/add-promotion-tier-to-campaign)
|
|
@@ -611,9 +611,12 @@ Methods are provided within `client.customers.*` namespace.
|
|
|
611
611
|
- [Get Customer](#get-customer)
|
|
612
612
|
- [Update Customer](#update-customer)
|
|
613
613
|
- [Delete Customer](#delete-customer)
|
|
614
|
+
- [Delete Customer Permanently](#delete-customer-permanently)
|
|
614
615
|
- [List Customers](#list-customers)
|
|
615
616
|
- [Update Customer's Consents](#update-customers-consents)
|
|
616
617
|
- [List Customer's Activities](#list-customers-activities)
|
|
618
|
+
- [Update Customers in bulk](#update-customers-in-bulk)
|
|
619
|
+
- [Update Customers' Metadata in bulk](#update-customers-metadata-in-bulk)
|
|
617
620
|
- [Import and Update Customers using CSV](#import-and-update-customers-using-csv)
|
|
618
621
|
|
|
619
622
|
#### [Create Customer](https://docs.voucherify.io/reference/create-customer)
|
|
@@ -644,6 +647,12 @@ client.customers.update(customer)
|
|
|
644
647
|
client.customers.delete(customerId)
|
|
645
648
|
```
|
|
646
649
|
|
|
650
|
+
#### [Delete Customer Permanently](https://docs.voucherify.io/reference/delete-customer-permanently)
|
|
651
|
+
|
|
652
|
+
```javascript
|
|
653
|
+
client.customers.deletePermanently(customerId)
|
|
654
|
+
```
|
|
655
|
+
|
|
647
656
|
#### [List Customers](https://docs.voucherify.io/reference/list-customers)
|
|
648
657
|
|
|
649
658
|
```javascript
|
|
@@ -702,6 +711,18 @@ client.customers.listActivities(customerId, params)
|
|
|
702
711
|
client.customers.importCSV(filePath)
|
|
703
712
|
```
|
|
704
713
|
|
|
714
|
+
#### [Update Customers in bulk](https://docs.voucherify.io/reference/update-customers-in-bulk)
|
|
715
|
+
|
|
716
|
+
```javascript
|
|
717
|
+
client.customers.updateInBulk(customers)
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
#### [Update Customers' Metadata in bulk](https://docs.voucherify.io/reference/update-customers-metadata-in-bulk)
|
|
721
|
+
|
|
722
|
+
```javascript
|
|
723
|
+
client.customers.updateMetadataInBulk(sourceIdsAndMetadata)
|
|
724
|
+
```
|
|
725
|
+
|
|
705
726
|
---
|
|
706
727
|
|
|
707
728
|
### Consents
|
|
@@ -963,6 +984,9 @@ Methods are provided within `client.loyalties.*` namespace.
|
|
|
963
984
|
- [Create Loyalty Program Earning Rules](#create-loyalty-program-earning-rules)
|
|
964
985
|
- [Update Loyalty Program Earning Rule](#update-loyalty-program-earning-rule)
|
|
965
986
|
- [Delete Loyalty Program Earning Rule](#delete-loyalty-program-earning-rule)
|
|
987
|
+
- [Get Loyalty Program Earning Rule](#get-loyalty-program-earning-rule)
|
|
988
|
+
- [Enable Loyalty Program Earning Rule](#enable-loyalty-program-earning-rule)
|
|
989
|
+
- [Disable Loyalty Program Earning Rule](#disable-loyalty-program-earning-rule)
|
|
966
990
|
- [List Loyalty Program Earning Rules](#list-loyalty-program-earning-rules)
|
|
967
991
|
- [Create Loyalty Program Member](#create-loyalty-program-member)
|
|
968
992
|
- [Get Loyalty Program Member](#get-loyalty-program-member)
|
|
@@ -1045,6 +1069,24 @@ client.loyalties.updateEarningRule(campaignId, earningRule)
|
|
|
1045
1069
|
client.loyalties.deleteEarningRule(campaignId, earningRuleId)
|
|
1046
1070
|
```
|
|
1047
1071
|
|
|
1072
|
+
#### [Get Loyalty Program Earning Rule](https://docs.voucherify.io/reference/get-earning-rule)
|
|
1073
|
+
|
|
1074
|
+
```javascript
|
|
1075
|
+
client.loyalties.getEarningRule(campaignId, earningRuleId)
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
#### [Enable Loyalty Program Earning Rule](https://docs.voucherify.io/reference/enable-earning-rule)
|
|
1079
|
+
|
|
1080
|
+
```javascript
|
|
1081
|
+
client.loyalties.enableEarningRule(campaignId, earningRuleId)
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
#### [Disable Loyalty Program Earning Rule](https://docs.voucherify.io/reference/disable-earning-rule)
|
|
1085
|
+
|
|
1086
|
+
```javascript
|
|
1087
|
+
client.loyalties.disableEarningRule(campaignId, earningRuleId)
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1048
1090
|
#### [List Loyalty Program Earning Rules](https://docs.voucherify.io/reference/list-earning-rules)
|
|
1049
1091
|
|
|
1050
1092
|
```javascript
|
package/dist/Customers.d.ts
CHANGED
|
@@ -32,10 +32,22 @@ declare class Customers {
|
|
|
32
32
|
* @see https://docs.voucherify.io/reference/update-customer
|
|
33
33
|
*/
|
|
34
34
|
update(customer: T.CustomersUpdateParams): Promise<T.CustomersCreateResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* @see https://docs.voucherify.io/reference/update-customers-in-bulk
|
|
37
|
+
*/
|
|
38
|
+
updateInBulk(customers: T.CustomersUpdateInBulkRequestBody): Promise<AAT.AsyncActionCreateResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* @see https://docs.voucherify.io/reference/update-customers-metadata-in-bulk
|
|
41
|
+
*/
|
|
42
|
+
updateMetadataInBulk(sourceIdsAndMetadata: T.CustomersUpdateMetadataInBulkRequestBody): Promise<AAT.AsyncActionCreateResponse>;
|
|
35
43
|
/**
|
|
36
44
|
* @see https://docs.voucherify.io/reference/delete-customer
|
|
37
45
|
*/
|
|
38
46
|
delete(customerId: string): Promise<undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* @see https://docs.voucherify.io/reference/delete-customer-permanently
|
|
49
|
+
*/
|
|
50
|
+
deletePermanently(customerId: string): Promise<T.CustomersDeletePermanentlyResponseBody>;
|
|
39
51
|
/**
|
|
40
52
|
* @see https://docs.voucherify.io/reference/update-customers-consents
|
|
41
53
|
*/
|
package/dist/Loyalties.d.ts
CHANGED
|
@@ -55,6 +55,18 @@ export declare class Loyalties {
|
|
|
55
55
|
* @see https://docs.voucherify.io/reference/delete-earning-rule
|
|
56
56
|
*/
|
|
57
57
|
deleteEarningRule(campaignId: string, earningRuleId: string): Promise<unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* @see https://docs.voucherify.io/reference/get-earning-rule
|
|
60
|
+
*/
|
|
61
|
+
getEarningRule(campaignId: string, earningRuleId: string): Promise<T.LoyaltiesGetEarningRuleResponseBody>;
|
|
62
|
+
/**
|
|
63
|
+
* @see https://docs.voucherify.io/reference/enable-earning-rule
|
|
64
|
+
*/
|
|
65
|
+
enableEarningRule(campaignId: string, earningRuleId: string): Promise<T.LoyaltiesEnableEarningRulesResponseBody>;
|
|
66
|
+
/**
|
|
67
|
+
* @see https://docs.voucherify.io/reference/disable-earning-rule
|
|
68
|
+
*/
|
|
69
|
+
disableEarningRule(campaignId: string, earningRuleId: string): Promise<T.LoyaltiesDisableEarningRulesResponseBody>;
|
|
58
70
|
/**
|
|
59
71
|
* @see https://docs.voucherify.io/reference/list-members
|
|
60
72
|
*/
|
|
@@ -124,4 +124,46 @@ declare type IdOrSourceId = {
|
|
|
124
124
|
export declare type CustomersUpdateParams = CustomerRequest & IdOrSourceId;
|
|
125
125
|
export declare type CustomersUpdateResponse = CustomerObject | CustomerUnconfirmed;
|
|
126
126
|
export declare type CustomersUpdateConsentsBody = Record<string, boolean>;
|
|
127
|
+
declare type CustomerBase = {
|
|
128
|
+
name?: string | null;
|
|
129
|
+
description?: string | null;
|
|
130
|
+
email?: string | null;
|
|
131
|
+
phone?: string | null;
|
|
132
|
+
birthdate?: string | null;
|
|
133
|
+
metadata?: Record<string, unknown> | null;
|
|
134
|
+
};
|
|
135
|
+
declare type CustomerAddress = {
|
|
136
|
+
address?: {
|
|
137
|
+
city?: string | null;
|
|
138
|
+
state?: string | null;
|
|
139
|
+
line_1?: string | null;
|
|
140
|
+
line_2?: string | null;
|
|
141
|
+
country?: string | null;
|
|
142
|
+
postal_code?: string | null;
|
|
143
|
+
} | null;
|
|
144
|
+
};
|
|
145
|
+
export declare type CustomersUpdateInBulkRequestBody = (CustomerBase & CustomerAddress & {
|
|
146
|
+
source_id: string | null;
|
|
147
|
+
})[];
|
|
148
|
+
export interface CustomersUpdateMetadataInBulkRequestBody {
|
|
149
|
+
source_ids: string[];
|
|
150
|
+
metadata: Record<string, unknown>;
|
|
151
|
+
}
|
|
152
|
+
export interface CustomersDeletePermanentlyResponseBody {
|
|
153
|
+
id: string;
|
|
154
|
+
created_at: string;
|
|
155
|
+
related_object_id: string;
|
|
156
|
+
related_object: 'customer';
|
|
157
|
+
status: 'DONE';
|
|
158
|
+
data_json: {
|
|
159
|
+
events: number;
|
|
160
|
+
customer_events: number;
|
|
161
|
+
daily_events: number;
|
|
162
|
+
segments: number;
|
|
163
|
+
orders: number;
|
|
164
|
+
order_events: number;
|
|
165
|
+
customer: 1;
|
|
166
|
+
};
|
|
167
|
+
object: 'pernament_deletion';
|
|
168
|
+
}
|
|
127
169
|
export {};
|
|
@@ -154,6 +154,7 @@ export interface LoyaltyFixed {
|
|
|
154
154
|
}
|
|
155
155
|
export interface LoyaltyProportional {
|
|
156
156
|
type: 'PROPORTIONAL';
|
|
157
|
+
calculation_type?: 'ORDER_AMOUNT' | 'ORDER_TOTAL_AMOUNT' | 'ORDER_METADATA' | 'ORDER_ITEMS_QUANTITY' | 'ORDER_ITEMS_AMOUNT' | 'ORDER_ITEMS_SUBTOTAL_AMOUNT' | 'CUSTOMER_METADATA' | 'CUSTOM_EVENT_METADATA';
|
|
157
158
|
order?: {
|
|
158
159
|
amount: {
|
|
159
160
|
every: number;
|
|
@@ -464,4 +465,144 @@ export interface LoyaltyPointsTransfer {
|
|
|
464
465
|
code: string;
|
|
465
466
|
points: number;
|
|
466
467
|
}
|
|
468
|
+
export declare type LoyaltiesGetEarningRuleResponseBody = EarningRuleBase & {
|
|
469
|
+
validation_rule_id: string | null;
|
|
470
|
+
updated_at: string | null;
|
|
471
|
+
active: boolean;
|
|
472
|
+
};
|
|
473
|
+
export declare type LoyaltiesEnableEarningRulesResponseBody = EarningRuleBase & {
|
|
474
|
+
updated_at: string | null;
|
|
475
|
+
active: true;
|
|
476
|
+
};
|
|
477
|
+
export declare type LoyaltiesDisableEarningRulesResponseBody = EarningRuleBase & {
|
|
478
|
+
updated_at: string | null;
|
|
479
|
+
active: false;
|
|
480
|
+
};
|
|
481
|
+
export interface EarningRuleBase {
|
|
482
|
+
id: string;
|
|
483
|
+
created_at: string;
|
|
484
|
+
loyalty: EarningRuleFixed | EarningRuleProportional;
|
|
485
|
+
event?: EarningRuleEvent;
|
|
486
|
+
custom_event?: {
|
|
487
|
+
schema_id: string;
|
|
488
|
+
};
|
|
489
|
+
segment?: {
|
|
490
|
+
id: string;
|
|
491
|
+
};
|
|
492
|
+
source: {
|
|
493
|
+
banner?: string;
|
|
494
|
+
object_id: string;
|
|
495
|
+
object_type: 'campaign';
|
|
496
|
+
};
|
|
497
|
+
loyalty_tier?: {
|
|
498
|
+
id: string;
|
|
499
|
+
};
|
|
500
|
+
object: 'earning_rule';
|
|
501
|
+
automation_id: string;
|
|
502
|
+
start_date?: string;
|
|
503
|
+
expiration_date?: string;
|
|
504
|
+
validity_timeframe?: {
|
|
505
|
+
duration: string;
|
|
506
|
+
interval: string;
|
|
507
|
+
};
|
|
508
|
+
validity_day_of_week?: number[];
|
|
509
|
+
metadata: Record<string, unknown>;
|
|
510
|
+
}
|
|
511
|
+
export declare 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';
|
|
512
|
+
export interface EarningRuleFixed {
|
|
513
|
+
type: 'FIXED';
|
|
514
|
+
points: number;
|
|
515
|
+
}
|
|
516
|
+
export declare type EarningRuleProportionalOrder = EarningRuleProportionalOrderAmount | EarningRuleProportionalOrderTotalAmount | EarningRuleProportionalOrderMetadata;
|
|
517
|
+
export interface EarningRuleProportionalOrderAmount {
|
|
518
|
+
type: 'PROPORTIONAL';
|
|
519
|
+
calculation_type: 'ORDER_AMOUNT';
|
|
520
|
+
order: {
|
|
521
|
+
amount: {
|
|
522
|
+
every: number;
|
|
523
|
+
points: number;
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
export interface EarningRuleProportionalOrderTotalAmount {
|
|
528
|
+
type: 'PROPORTIONAL';
|
|
529
|
+
calculation_type: 'ORDER_TOTAL_AMOUNT';
|
|
530
|
+
order: {
|
|
531
|
+
total_amount: {
|
|
532
|
+
every: number;
|
|
533
|
+
points: number;
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
export interface EarningRuleProportionalOrderMetadata {
|
|
538
|
+
type: 'PROPORTIONAL';
|
|
539
|
+
calculation_type: 'ORDER_METADATA';
|
|
540
|
+
order: {
|
|
541
|
+
metadata: {
|
|
542
|
+
every: number;
|
|
543
|
+
points: number;
|
|
544
|
+
property: string;
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
export declare type EarningRuleProportional = EarningRuleProportionalOrder | EarningRuleProportionalOrderItems | EarningRuleProportionalCustomerMetadata | EarningRuleProportionalCustomEvent;
|
|
549
|
+
export declare type EarningRuleProportionalOrderItems = EarningRuleProportionalOrderItemsQuantity | EarningRuleProportionalOrderItemsAmount | EarningRuleProportionalOrderItemsSubtotalAmount;
|
|
550
|
+
export interface EarningRuleProportionalOrderItemsQuantity {
|
|
551
|
+
type: 'PROPORTIONAL';
|
|
552
|
+
calculation_type: 'ORDER_ITEMS_QUANTITY';
|
|
553
|
+
order_items: {
|
|
554
|
+
quantity: {
|
|
555
|
+
every: number;
|
|
556
|
+
points: number;
|
|
557
|
+
object: `products_collection` | `product` | `sku`;
|
|
558
|
+
id: string;
|
|
559
|
+
};
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
export interface EarningRuleProportionalOrderItemsAmount {
|
|
563
|
+
type: 'PROPORTIONAL';
|
|
564
|
+
calculation_type: 'ORDER_ITEMS_AMOUNT';
|
|
565
|
+
order_items: {
|
|
566
|
+
amount: {
|
|
567
|
+
every: number;
|
|
568
|
+
points: number;
|
|
569
|
+
object: `products_collection` | `product` | `sku`;
|
|
570
|
+
id: string;
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
export interface EarningRuleProportionalOrderItemsSubtotalAmount {
|
|
575
|
+
type: 'PROPORTIONAL';
|
|
576
|
+
calculation_type: 'ORDER_ITEMS_SUBTOTAL_AMOUNT';
|
|
577
|
+
order_items: {
|
|
578
|
+
subtotal_amount: {
|
|
579
|
+
every: number;
|
|
580
|
+
points: number;
|
|
581
|
+
object: `products_collection` | `product` | `sku`;
|
|
582
|
+
id: string;
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
export interface EarningRuleProportionalCustomerMetadata {
|
|
587
|
+
type: 'PROPORTIONAL';
|
|
588
|
+
calculation_type: 'CUSTOMER_METADATA';
|
|
589
|
+
customer: {
|
|
590
|
+
metadata: {
|
|
591
|
+
every: number;
|
|
592
|
+
points: number;
|
|
593
|
+
property: string;
|
|
594
|
+
};
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
export interface EarningRuleProportionalCustomEvent {
|
|
598
|
+
type: 'PROPORTIONAL';
|
|
599
|
+
calculation_type: 'CUSTOM_EVENT_METADATA';
|
|
600
|
+
custom_event: {
|
|
601
|
+
metadata: {
|
|
602
|
+
every: number;
|
|
603
|
+
points: number;
|
|
604
|
+
property: string;
|
|
605
|
+
};
|
|
606
|
+
};
|
|
607
|
+
}
|
|
467
608
|
export {};
|
|
@@ -869,6 +869,22 @@ class Customers {
|
|
|
869
869
|
const customerWithoutId = omit(customer, ['id']);
|
|
870
870
|
return this.client.put(`/customers/${encode(id)}`, customerWithoutId);
|
|
871
871
|
}
|
|
872
|
+
/**
|
|
873
|
+
* @see https://docs.voucherify.io/reference/update-customers-in-bulk
|
|
874
|
+
*/
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
updateInBulk(customers) {
|
|
878
|
+
return this.client.post(`/customers/bulk/async`, customers);
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* @see https://docs.voucherify.io/reference/update-customers-metadata-in-bulk
|
|
882
|
+
*/
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
updateMetadataInBulk(sourceIdsAndMetadata) {
|
|
886
|
+
return this.client.post(`/customers/metadata/async`, sourceIdsAndMetadata);
|
|
887
|
+
}
|
|
872
888
|
/**
|
|
873
889
|
* @see https://docs.voucherify.io/reference/delete-customer
|
|
874
890
|
*/
|
|
@@ -877,6 +893,14 @@ class Customers {
|
|
|
877
893
|
delete(customerId) {
|
|
878
894
|
return this.client.delete(`/customers/${encode(customerId)}`);
|
|
879
895
|
}
|
|
896
|
+
/**
|
|
897
|
+
* @see https://docs.voucherify.io/reference/delete-customer-permanently
|
|
898
|
+
*/
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
deletePermanently(customerId) {
|
|
902
|
+
return this.client.post(`/customers/${encode(customerId)}/permanent-deletion`, {});
|
|
903
|
+
}
|
|
880
904
|
/**
|
|
881
905
|
* @see https://docs.voucherify.io/reference/update-customers-consents
|
|
882
906
|
*/
|
|
@@ -1288,6 +1312,30 @@ class Loyalties {
|
|
|
1288
1312
|
deleteEarningRule(campaignId, earningRuleId) {
|
|
1289
1313
|
return this.client.delete(`/loyalties/${encode(campaignId)}/earning-rules/${earningRuleId}`);
|
|
1290
1314
|
}
|
|
1315
|
+
/**
|
|
1316
|
+
* @see https://docs.voucherify.io/reference/get-earning-rule
|
|
1317
|
+
*/
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
getEarningRule(campaignId, earningRuleId) {
|
|
1321
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/earning-rules/${encode(earningRuleId)}`);
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* @see https://docs.voucherify.io/reference/enable-earning-rule
|
|
1325
|
+
*/
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
enableEarningRule(campaignId, earningRuleId) {
|
|
1329
|
+
return this.client.post(`/loyalties/${encode(campaignId)}/earning-rules/${earningRuleId}/enable`, {});
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* @see https://docs.voucherify.io/reference/disable-earning-rule
|
|
1333
|
+
*/
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
disableEarningRule(campaignId, earningRuleId) {
|
|
1337
|
+
return this.client.post(`/loyalties/${encode(campaignId)}/earning-rules/${earningRuleId}/disable`, {});
|
|
1338
|
+
}
|
|
1291
1339
|
/**
|
|
1292
1340
|
* @see https://docs.voucherify.io/reference/list-members
|
|
1293
1341
|
*/
|
|
@@ -1594,7 +1642,7 @@ function VoucherifyServerSide(options) {
|
|
|
1594
1642
|
let headers = {
|
|
1595
1643
|
'X-App-Id': options.applicationId,
|
|
1596
1644
|
'X-App-Token': options.secretKey,
|
|
1597
|
-
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.
|
|
1645
|
+
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.4.0"}`,
|
|
1598
1646
|
'Content-Type': 'application/json'
|
|
1599
1647
|
};
|
|
1600
1648
|
|
|
@@ -1847,7 +1895,7 @@ function VoucherifyClientSide(options) {
|
|
|
1847
1895
|
let headers = {
|
|
1848
1896
|
'X-Client-Application-Id': options.clientApplicationId,
|
|
1849
1897
|
'X-Client-Token': options.clientSecretKey,
|
|
1850
|
-
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.
|
|
1898
|
+
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.4.0"}`
|
|
1851
1899
|
};
|
|
1852
1900
|
|
|
1853
1901
|
if (environment().startsWith('Node')) {
|