@voucherify/sdk 2.3.0 → 2.5.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 +69 -0
- package/README.md +237 -5
- package/dist/Customers.d.ts +12 -0
- package/dist/Exports.d.ts +4 -0
- package/dist/Loyalties.d.ts +72 -3
- package/dist/ProductCollections.d.ts +26 -0
- package/dist/VoucherifyServerSide.d.ts +2 -0
- package/dist/types/Categories.d.ts +8 -0
- package/dist/types/Customers.d.ts +42 -0
- package/dist/types/Exports.d.ts +119 -0
- package/dist/types/Loyalties.d.ts +630 -0
- package/dist/types/ProductCollections.d.ts +95 -0
- package/dist/types/Rewards.d.ts +57 -1
- package/dist/types/UtilityTypes.d.ts +3 -0
- package/dist/voucherifysdk.esm.js +220 -5
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +220 -5
- 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
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { WithRequiredProperty } from './UtilityTypes';
|
|
2
|
+
export interface ProductIdentity {
|
|
3
|
+
id?: string;
|
|
4
|
+
object?: 'product';
|
|
5
|
+
}
|
|
6
|
+
export interface SkuIdentity {
|
|
7
|
+
id?: string;
|
|
8
|
+
product_id?: string;
|
|
9
|
+
object?: 'sku';
|
|
10
|
+
}
|
|
11
|
+
export interface ProductBase {
|
|
12
|
+
name?: string | null;
|
|
13
|
+
price?: number | null;
|
|
14
|
+
attributes?: string[];
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface SkuBase {
|
|
18
|
+
sku?: string | null;
|
|
19
|
+
price?: number | null;
|
|
20
|
+
attributes?: Record<string, unknown>;
|
|
21
|
+
metadata?: Record<string, unknown>;
|
|
22
|
+
product?: Required<ProductIdentity> & Required<ProductBase> & {
|
|
23
|
+
source_id: string | null;
|
|
24
|
+
object: 'product';
|
|
25
|
+
};
|
|
26
|
+
image_url?: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface ProductSaved {
|
|
29
|
+
created_at?: string;
|
|
30
|
+
updated_at?: string | null;
|
|
31
|
+
image_url?: string | null;
|
|
32
|
+
object?: 'product';
|
|
33
|
+
}
|
|
34
|
+
export interface SkuSaved {
|
|
35
|
+
created_at?: string;
|
|
36
|
+
updated_at?: string | null;
|
|
37
|
+
image_url?: string | null;
|
|
38
|
+
object?: 'sku';
|
|
39
|
+
}
|
|
40
|
+
export declare type ProductOrSkuIdentity = Required<SkuIdentity> | Required<ProductIdentity>;
|
|
41
|
+
export interface ProductCollectionIdentity {
|
|
42
|
+
id?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ProductCollectionSaved {
|
|
45
|
+
created_at?: string;
|
|
46
|
+
object?: 'products_collection';
|
|
47
|
+
}
|
|
48
|
+
export declare type ProductCollectionBase = StaticProductCollectionBase | DynamicProductCollectionBase;
|
|
49
|
+
export interface StaticProductCollectionBase {
|
|
50
|
+
name?: string;
|
|
51
|
+
type?: 'STATIC';
|
|
52
|
+
products?: ProductOrSkuIdentity[];
|
|
53
|
+
}
|
|
54
|
+
export interface DynamicProductCollectionBase {
|
|
55
|
+
name?: string;
|
|
56
|
+
type?: 'AUTO_UPDATE';
|
|
57
|
+
filter?: Filter;
|
|
58
|
+
}
|
|
59
|
+
export declare type ProductCollection = ProductCollectionBase & ProductCollectionIdentity & ProductCollectionSaved;
|
|
60
|
+
export declare type Filter = {
|
|
61
|
+
junction: Junction;
|
|
62
|
+
} & Partial<Record<AllowedFiltersKeys, {
|
|
63
|
+
conditions: Partial<Record<FiltersCondition, unknown>>;
|
|
64
|
+
}>>;
|
|
65
|
+
export declare type Junction = 'and' | 'AND' | 'or' | 'OR';
|
|
66
|
+
export declare type AllowedFiltersKeys = 'id' | 'name' | 'attributes' | 'source_id' | 'price' | 'image_url' | 'product_id' | 'skus' | 'created_at' | 'updated_at' | 'object' | `metadata.${string}`;
|
|
67
|
+
export declare type FiltersCondition = '$in' | '$not_in' | '$is' | '$is_days_ago' | '$is_days_in_future' | '$is_not' | '$has_value' | '$is_unknown' | '$contains' | '$not_contain' | '$starts_with' | '$ends_with' | '$more_than' | '$less_than' | '$more_than_ago' | '$less_than_ago' | '$more_than_future' | '$less_than_future' | '$more_than_equal' | '$less_than_equal' | '$after' | '$before' | '$count' | '$count_less' | '$count_more';
|
|
68
|
+
export declare type ProductCollectionsCreateRequestBody = WithRequiredProperty<StaticProductCollectionBase, 'name' | 'type'> | Required<DynamicProductCollectionBase>;
|
|
69
|
+
export declare type ProductCollectionsCreateResponseBody = Required<ProductCollectionBase> & Required<ProductCollectionIdentity> & Required<ProductCollectionSaved>;
|
|
70
|
+
export interface ProductCollectionsListRequestQuery {
|
|
71
|
+
limit?: number;
|
|
72
|
+
page?: number;
|
|
73
|
+
order?: 'created_at' | '-created_at';
|
|
74
|
+
}
|
|
75
|
+
export interface ProductCollectionsListResponseBody {
|
|
76
|
+
object: 'list';
|
|
77
|
+
data_ref: 'data';
|
|
78
|
+
data: Required<ProductCollection>[];
|
|
79
|
+
total: number;
|
|
80
|
+
}
|
|
81
|
+
export declare type ProductCollectionsGetResponseBody = Required<ProductCollection>;
|
|
82
|
+
export interface ProductCollectionsListProductsRequestQuery {
|
|
83
|
+
limit?: number;
|
|
84
|
+
page?: number;
|
|
85
|
+
}
|
|
86
|
+
export interface ProductCollectionsListProductsResponseBody {
|
|
87
|
+
object: 'list';
|
|
88
|
+
data_ref: 'data';
|
|
89
|
+
data: ((Required<SkuIdentity> & Required<SkuSaved> & Required<SkuBase> & {
|
|
90
|
+
source_id: string | null;
|
|
91
|
+
}) | (Required<ProductIdentity> & Required<ProductSaved> & Required<ProductBase> & {
|
|
92
|
+
source_id: string | null;
|
|
93
|
+
}))[];
|
|
94
|
+
total: number;
|
|
95
|
+
}
|
package/dist/types/Rewards.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface RewardsResponse {
|
|
|
16
16
|
object: 'reward';
|
|
17
17
|
}
|
|
18
18
|
export declare type RewardsCreateResponse = RewardsResponse & RewardsTypeResponse;
|
|
19
|
+
export declare type RewardsGetResponse = RewardsResponse & RewardsTypeResponse;
|
|
19
20
|
export interface RewardsListResponse {
|
|
20
21
|
object: 'list';
|
|
21
22
|
total: number;
|
|
@@ -69,7 +70,6 @@ interface RewardsTypeCoin {
|
|
|
69
70
|
export declare type RewardsType = RewardsTypeCampaign | RewardsTypeCoin | RewardsTypeMaterial;
|
|
70
71
|
export declare type RewardsTypeResponse = Required<RewardsTypeCampaignResponse> | Required<RewardsTypeCoin> | Required<RewardsTypeMaterial>;
|
|
71
72
|
export declare type RewardsCreate = Rewards & RewardsType;
|
|
72
|
-
export declare type RewardsGetResponse = RewardsCreateResponse;
|
|
73
73
|
export declare type RewardsUpdate = Omit<RewardsCreate, 'type'> & {
|
|
74
74
|
id: string;
|
|
75
75
|
};
|
|
@@ -116,4 +116,60 @@ export interface RewardRedemptionParams {
|
|
|
116
116
|
assignment_id?: string;
|
|
117
117
|
id?: string;
|
|
118
118
|
}
|
|
119
|
+
export declare type Reward = {
|
|
120
|
+
id: string;
|
|
121
|
+
name?: string;
|
|
122
|
+
stock?: string;
|
|
123
|
+
redeemed?: string;
|
|
124
|
+
attributes?: {
|
|
125
|
+
image_url?: string;
|
|
126
|
+
description?: string;
|
|
127
|
+
};
|
|
128
|
+
created_at: string;
|
|
129
|
+
updated_at?: string;
|
|
130
|
+
object: 'reward';
|
|
131
|
+
} & RewardType;
|
|
132
|
+
export interface RewardTypeCampaign {
|
|
133
|
+
type: 'CAMPAIGN';
|
|
134
|
+
parameters: {
|
|
135
|
+
campaign: {
|
|
136
|
+
id: string;
|
|
137
|
+
balance?: number;
|
|
138
|
+
type: 'DISCOUNT_COUPONS' | 'PROMOTION' | 'GIFT_VOUCHERS' | 'REFERRAL_PROGRAM';
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export interface RewardTypeCoin {
|
|
143
|
+
type: 'COIN';
|
|
144
|
+
parameters: {
|
|
145
|
+
coin: {
|
|
146
|
+
exchange_ratio: number;
|
|
147
|
+
points_ratio?: number;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export interface RewardTypeMaterial {
|
|
152
|
+
type: 'MATERIAL';
|
|
153
|
+
parameters: {
|
|
154
|
+
product: {
|
|
155
|
+
id: string;
|
|
156
|
+
sku: string | null;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
export declare type RewardType = RewardTypeCampaign | RewardTypeCoin | RewardTypeMaterial;
|
|
161
|
+
export interface RewardAssignment {
|
|
162
|
+
id: string;
|
|
163
|
+
reward_id: string;
|
|
164
|
+
related_object_id?: string;
|
|
165
|
+
related_object_type?: string;
|
|
166
|
+
parameters?: {
|
|
167
|
+
loyalty?: {
|
|
168
|
+
points: number;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
created_at: string;
|
|
172
|
+
updated_at?: string;
|
|
173
|
+
object: 'reward_assignment';
|
|
174
|
+
}
|
|
119
175
|
export {};
|
|
@@ -393,6 +393,14 @@ class Exports {
|
|
|
393
393
|
create(exportResource) {
|
|
394
394
|
return this.client.post('/exports', exportResource);
|
|
395
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* @see https://docs.voucherify.io/reference/list-exports
|
|
398
|
+
*/
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
list(query = {}) {
|
|
402
|
+
return this.client.get('/exports', query);
|
|
403
|
+
}
|
|
396
404
|
/**
|
|
397
405
|
* @see https://docs.voucherify.io/reference/get-export
|
|
398
406
|
*/
|
|
@@ -869,6 +877,22 @@ class Customers {
|
|
|
869
877
|
const customerWithoutId = omit(customer, ['id']);
|
|
870
878
|
return this.client.put(`/customers/${encode(id)}`, customerWithoutId);
|
|
871
879
|
}
|
|
880
|
+
/**
|
|
881
|
+
* @see https://docs.voucherify.io/reference/update-customers-in-bulk
|
|
882
|
+
*/
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
updateInBulk(customers) {
|
|
886
|
+
return this.client.post(`/customers/bulk/async`, customers);
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* @see https://docs.voucherify.io/reference/update-customers-metadata-in-bulk
|
|
890
|
+
*/
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
updateMetadataInBulk(sourceIdsAndMetadata) {
|
|
894
|
+
return this.client.post(`/customers/metadata/async`, sourceIdsAndMetadata);
|
|
895
|
+
}
|
|
872
896
|
/**
|
|
873
897
|
* @see https://docs.voucherify.io/reference/delete-customer
|
|
874
898
|
*/
|
|
@@ -877,6 +901,14 @@ class Customers {
|
|
|
877
901
|
delete(customerId) {
|
|
878
902
|
return this.client.delete(`/customers/${encode(customerId)}`);
|
|
879
903
|
}
|
|
904
|
+
/**
|
|
905
|
+
* @see https://docs.voucherify.io/reference/delete-customer-permanently
|
|
906
|
+
*/
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
deletePermanently(customerId) {
|
|
910
|
+
return this.client.post(`/customers/${encode(customerId)}/permanent-deletion`, {});
|
|
911
|
+
}
|
|
880
912
|
/**
|
|
881
913
|
* @see https://docs.voucherify.io/reference/update-customers-consents
|
|
882
914
|
*/
|
|
@@ -1288,6 +1320,30 @@ class Loyalties {
|
|
|
1288
1320
|
deleteEarningRule(campaignId, earningRuleId) {
|
|
1289
1321
|
return this.client.delete(`/loyalties/${encode(campaignId)}/earning-rules/${earningRuleId}`);
|
|
1290
1322
|
}
|
|
1323
|
+
/**
|
|
1324
|
+
* @see https://docs.voucherify.io/reference/get-earning-rule
|
|
1325
|
+
*/
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
getEarningRule(campaignId, earningRuleId) {
|
|
1329
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/earning-rules/${encode(earningRuleId)}`);
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* @see https://docs.voucherify.io/reference/enable-earning-rule
|
|
1333
|
+
*/
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
enableEarningRule(campaignId, earningRuleId) {
|
|
1337
|
+
return this.client.post(`/loyalties/${encode(campaignId)}/earning-rules/${earningRuleId}/enable`, {});
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* @see https://docs.voucherify.io/reference/disable-earning-rule
|
|
1341
|
+
*/
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
disableEarningRule(campaignId, earningRuleId) {
|
|
1345
|
+
return this.client.post(`/loyalties/${encode(campaignId)}/earning-rules/${earningRuleId}/disable`, {});
|
|
1346
|
+
}
|
|
1291
1347
|
/**
|
|
1292
1348
|
* @see https://docs.voucherify.io/reference/list-members
|
|
1293
1349
|
*/
|
|
@@ -1306,28 +1362,63 @@ class Loyalties {
|
|
|
1306
1362
|
}
|
|
1307
1363
|
/**
|
|
1308
1364
|
* @see https://docs.voucherify.io/reference/get-member
|
|
1365
|
+
* @see https://docs.voucherify.io/reference/get-member-1
|
|
1309
1366
|
*/
|
|
1310
1367
|
|
|
1311
1368
|
|
|
1312
1369
|
getMember(campaignId, memberId) {
|
|
1313
|
-
return this.client.get(`/loyalties/${encode(campaignId)}/members/${memberId}`);
|
|
1370
|
+
return this.client.get(campaignId ? `/loyalties/${encode(campaignId)}/members/${memberId}` : `/loyalties/members/${memberId}`);
|
|
1314
1371
|
}
|
|
1315
1372
|
/**
|
|
1316
1373
|
* @see https://docs.voucherify.io/reference/get-member-activities
|
|
1374
|
+
* @see https://docs.voucherify.io/reference/get-member-activities-1
|
|
1317
1375
|
*/
|
|
1318
1376
|
|
|
1319
1377
|
|
|
1320
1378
|
getMemberActivities(campaignId, memberId) {
|
|
1321
|
-
return this.client.get(`/loyalties/${encode(campaignId)}/members/${memberId}/activities`);
|
|
1379
|
+
return this.client.get(campaignId ? `/loyalties/${encode(campaignId)}/members/${memberId}/activities` : `/loyalties/members/${memberId}/activities`);
|
|
1322
1380
|
}
|
|
1323
1381
|
/**
|
|
1324
|
-
* @see https://docs.voucherify.io/reference/
|
|
1382
|
+
* @see https://docs.voucherify.io/reference/list-member-rewards
|
|
1383
|
+
*/
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
listMemberRewards(memberId, params) {
|
|
1387
|
+
return this.client.get(`/loyalties/members/${encode(memberId)}/rewards`, params);
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* @see https://docs.voucherify.io/reference/add-remove-loyalty-card-balance
|
|
1391
|
+
* @see https://docs.voucherify.io/reference/add-remove-loyalty-card-balance-1
|
|
1392
|
+
*/
|
|
1393
|
+
|
|
1394
|
+
|
|
1395
|
+
addOrRemoveCardBalance(memberId, balance, campaignId) {
|
|
1396
|
+
return this.client.post(campaignId ? `/loyalties/${encode(campaignId)}/members/${memberId}/balance` : `/loyalties/members/${memberId}/balance`, balance);
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* @see https://docs.voucherify.io/reference/add-remove-loyalty-card-balance-1
|
|
1325
1400
|
*/
|
|
1326
1401
|
|
|
1327
1402
|
|
|
1328
1403
|
addPoints(campaignId, memberId, balance) {
|
|
1329
1404
|
return this.client.post(`/loyalties/${encode(campaignId)}/members/${memberId}/balance`, balance);
|
|
1330
1405
|
}
|
|
1406
|
+
/**
|
|
1407
|
+
* @see https://docs.voucherify.io/reference/transfer-points
|
|
1408
|
+
*/
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
transferPoints(campaignId, memberId, loyaltiesTransferPoints) {
|
|
1412
|
+
return this.client.post(`/loyalties/${encode(campaignId)}/members/${encode(memberId)}/transfers`, loyaltiesTransferPoints);
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* @see https://docs.voucherify.io/reference/get-points-expiration
|
|
1416
|
+
*/
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
getPointsExpiration(campaignId, memberId, params) {
|
|
1420
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/members/${memberId}/points-expiration`, params);
|
|
1421
|
+
}
|
|
1331
1422
|
/**
|
|
1332
1423
|
* @see https://docs.voucherify.io/reference/redeem-loyalty-card
|
|
1333
1424
|
*/
|
|
@@ -1336,6 +1427,80 @@ class Loyalties {
|
|
|
1336
1427
|
redeemReward(campaignId, memberId, params) {
|
|
1337
1428
|
return this.client.post(`/loyalties/${encode(campaignId)}/members/${encode(memberId)}/redemption`, params);
|
|
1338
1429
|
}
|
|
1430
|
+
/**
|
|
1431
|
+
* @see https://docs.voucherify.io/reference/list-loyalty-card-transactions
|
|
1432
|
+
* @see https://docs.voucherify.io/reference/list-loyalty-card-transactions-1
|
|
1433
|
+
*/
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
listCardTransactions(memberId, campaignId, params) {
|
|
1437
|
+
return this.client.get(campaignId ? `/loyalties/${encode(campaignId)}/members/${encode(memberId)}/transactions` : `/loyalties/members/${encode(memberId)}/transactions`, params);
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* @see https://docs.voucherify.io/reference/export-loyalty-card-transactions
|
|
1441
|
+
* @see https://docs.voucherify.io/reference/export-loyalty-card-transactions-1
|
|
1442
|
+
*/
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
exportCardTransactions(memberId, campaignId, params = {}) {
|
|
1446
|
+
return this.client.post(campaignId ? `/loyalties/${encode(campaignId)}/members/${encode(memberId)}/transactions/export` : `/loyalties/members/${encode(memberId)}/transactions/export`, params);
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* @see https://docs.voucherify.io/reference/get-reward-assignment-1
|
|
1450
|
+
*/
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
getRewardAssignment(campaignId, assignmentId) {
|
|
1454
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/reward-assignments/${encode(assignmentId)}`);
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* @see https://docs.voucherify.io/reference/get-reward-details
|
|
1458
|
+
*/
|
|
1459
|
+
|
|
1460
|
+
|
|
1461
|
+
getRewardDetails(campaignId, assignmentId) {
|
|
1462
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/reward-assignments/${encode(assignmentId)}/reward`);
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* @see https://docs.voucherify.io/reference/list-loyalty-tiers
|
|
1466
|
+
*/
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
listTiers(campaignId, params) {
|
|
1470
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/tiers`, params);
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* @see https://docs.voucherify.io/reference/get-loyalty-tier
|
|
1474
|
+
*/
|
|
1475
|
+
|
|
1476
|
+
|
|
1477
|
+
getTier(campaignId, tierId) {
|
|
1478
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/tiers/${encode(tierId)}`);
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* @see https://docs.voucherify.io/reference/create-loyalty-tiers
|
|
1482
|
+
*/
|
|
1483
|
+
|
|
1484
|
+
|
|
1485
|
+
createTiers(campaignId, tiers) {
|
|
1486
|
+
return this.client.post(`/loyalties/${encode(campaignId)}/tiers`, tiers);
|
|
1487
|
+
}
|
|
1488
|
+
/**
|
|
1489
|
+
* @see https://docs.voucherify.io/reference/list-loyalty-tier-earning-rules
|
|
1490
|
+
*/
|
|
1491
|
+
|
|
1492
|
+
|
|
1493
|
+
listLoyaltyTierEarningRules(campaignId, tierId, params) {
|
|
1494
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/tiers/${encode(tierId)}/earning-rules`, params);
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* @see https://docs.voucherify.io/reference/get-member-loyalty-tier
|
|
1498
|
+
*/
|
|
1499
|
+
|
|
1500
|
+
|
|
1501
|
+
listMemberLoyaltyTiers(memberId) {
|
|
1502
|
+
return this.client.get(`/loyalties/members/${encode(memberId)}/tiers`);
|
|
1503
|
+
}
|
|
1339
1504
|
|
|
1340
1505
|
}
|
|
1341
1506
|
|
|
@@ -1564,6 +1729,54 @@ class Categories {
|
|
|
1564
1729
|
|
|
1565
1730
|
}
|
|
1566
1731
|
|
|
1732
|
+
class ProductCollections {
|
|
1733
|
+
constructor(client) {
|
|
1734
|
+
this.client = void 0;
|
|
1735
|
+
this.client = client;
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* @see https://docs.voucherify.io/reference/create-product-collection
|
|
1739
|
+
*/
|
|
1740
|
+
|
|
1741
|
+
|
|
1742
|
+
create(productCollection) {
|
|
1743
|
+
return this.client.post(`/product-collections`, productCollection);
|
|
1744
|
+
}
|
|
1745
|
+
/**
|
|
1746
|
+
* @see https://docs.voucherify.io/reference/list-product-collections
|
|
1747
|
+
*/
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
list(params) {
|
|
1751
|
+
return this.client.get(`/product-collections`, params);
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* @see https://docs.voucherify.io/reference/delete-product-collection
|
|
1755
|
+
*/
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
delete(productCollectionId) {
|
|
1759
|
+
return this.client.delete(`/product-collections/${encode(productCollectionId)}`);
|
|
1760
|
+
}
|
|
1761
|
+
/**
|
|
1762
|
+
* @see https://docs.voucherify.io/reference/get-product-collection
|
|
1763
|
+
*/
|
|
1764
|
+
|
|
1765
|
+
|
|
1766
|
+
get(productCollectionId) {
|
|
1767
|
+
return this.client.get(`/product-collections/${encode(productCollectionId)}`);
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* @see https://docs.voucherify.io/reference/list-products-in-collection
|
|
1771
|
+
*/
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
listProducts(productCollectionId, params) {
|
|
1775
|
+
return this.client.get(`/product-collections/${encode(productCollectionId)}/products`, params);
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1567
1780
|
// apiLimitsHandler: ApiLimitsHandler
|
|
1568
1781
|
// campaigns: Campaigns
|
|
1569
1782
|
// consents: Consents
|
|
@@ -1594,7 +1807,7 @@ function VoucherifyServerSide(options) {
|
|
|
1594
1807
|
let headers = {
|
|
1595
1808
|
'X-App-Id': options.applicationId,
|
|
1596
1809
|
'X-App-Token': options.secretKey,
|
|
1597
|
-
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.
|
|
1810
|
+
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.5.0"}`,
|
|
1598
1811
|
'Content-Type': 'application/json'
|
|
1599
1812
|
};
|
|
1600
1813
|
|
|
@@ -1639,6 +1852,7 @@ function VoucherifyServerSide(options) {
|
|
|
1639
1852
|
const consents = new Consents(client);
|
|
1640
1853
|
const orders = new Orders(client);
|
|
1641
1854
|
const products = new Products(client);
|
|
1855
|
+
const productCollections = new ProductCollections(client);
|
|
1642
1856
|
const rewards = new Rewards(client);
|
|
1643
1857
|
const loyalties = new Loyalties(client);
|
|
1644
1858
|
const segments = new Segments(client);
|
|
@@ -1657,6 +1871,7 @@ function VoucherifyServerSide(options) {
|
|
|
1657
1871
|
consents,
|
|
1658
1872
|
orders,
|
|
1659
1873
|
products,
|
|
1874
|
+
productCollections,
|
|
1660
1875
|
rewards,
|
|
1661
1876
|
loyalties,
|
|
1662
1877
|
segments,
|
|
@@ -1847,7 +2062,7 @@ function VoucherifyClientSide(options) {
|
|
|
1847
2062
|
let headers = {
|
|
1848
2063
|
'X-Client-Application-Id': options.clientApplicationId,
|
|
1849
2064
|
'X-Client-Token': options.clientSecretKey,
|
|
1850
|
-
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.
|
|
2065
|
+
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.5.0"}`
|
|
1851
2066
|
};
|
|
1852
2067
|
|
|
1853
2068
|
if (environment().startsWith('Node')) {
|