@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
|
@@ -14,7 +14,7 @@ export interface VoucherifyClientSideOptions {
|
|
|
14
14
|
*/
|
|
15
15
|
apiUrl?: string;
|
|
16
16
|
/**
|
|
17
|
-
* [Log-in](
|
|
17
|
+
* [Log-in](https://app.voucherify.io/#/login) to Voucherify web interface and obtain your `Client-side Keys` from [Configuration](https://app.voucherify.io/#/app/core/projects/current/general):
|
|
18
18
|
*
|
|
19
19
|
* ```javascript
|
|
20
20
|
* const client = VoucherifyClientSide({
|
|
@@ -25,7 +25,7 @@ export interface VoucherifyClientSideOptions {
|
|
|
25
25
|
*/
|
|
26
26
|
clientApplicationId: string;
|
|
27
27
|
/**
|
|
28
|
-
* [Log-in](
|
|
28
|
+
* [Log-in](https://app.voucherify.io/#/login) to Voucherify web interface and obtain your `Client-side Keys` from [Configuration](https://app.voucherify.io/#/app/core/projects/current/general):
|
|
29
29
|
*
|
|
30
30
|
* ```javascript
|
|
31
31
|
* const client = VoucherifyClientSide({
|
|
@@ -28,7 +28,7 @@ export interface VoucherifyServerSideOptions {
|
|
|
28
28
|
*/
|
|
29
29
|
apiUrl?: string;
|
|
30
30
|
/**
|
|
31
|
-
* [Log-in](
|
|
31
|
+
* [Log-in](https://app.voucherify.io/#/login) to Voucherify web interface and obtain your `Application Keys` from [Configuration](https://app.voucherify.io/#/app/core/projects/current/general):
|
|
32
32
|
*
|
|
33
33
|
* ```javascript
|
|
34
34
|
* const voucherify = VoucherifyServerSide({
|
|
@@ -39,7 +39,7 @@ export interface VoucherifyServerSideOptions {
|
|
|
39
39
|
*/
|
|
40
40
|
applicationId: string;
|
|
41
41
|
/**
|
|
42
|
-
* [Log-in](
|
|
42
|
+
* [Log-in](https://app.voucherify.io/#/login) to Voucherify web interface and obtain your `Application Keys` from [Configuration](https://app.voucherify.io/#/app/core/projects/current/general):
|
|
43
43
|
*
|
|
44
44
|
* ```javascript
|
|
45
45
|
* const voucherify = VoucherifyServerSide({
|
|
@@ -50,7 +50,7 @@ export interface VoucherifyServerSideOptions {
|
|
|
50
50
|
*/
|
|
51
51
|
secretKey: string;
|
|
52
52
|
/**
|
|
53
|
-
* Optionally, you can add `apiVersion` to the client options if you want to use a [specific API version](
|
|
53
|
+
* Optionally, you can add `apiVersion` to the client options if you want to use a [specific API version](https://docs.voucherify.io/docs/api-version-upgrades).
|
|
54
54
|
*
|
|
55
55
|
* ```javascript
|
|
56
56
|
* const voucherify = VoucherifyServerSide({
|
package/dist/Vouchers.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ declare class VouchersQualification {
|
|
|
7
7
|
/**
|
|
8
8
|
* 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.
|
|
9
9
|
* 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.
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
|
+
* @see https://docs.voucherify.io/reference/push-qualification-request
|
|
11
12
|
*/
|
|
12
13
|
examine(body: T.VouchersQualificationExamineBody, params?: T.VouchersQualificationExamineParams): Promise<T.VouchersQualificationExamineResponse>;
|
|
13
14
|
}
|
|
@@ -17,47 +18,47 @@ export declare class Vouchers {
|
|
|
17
18
|
qualifications: VouchersQualification;
|
|
18
19
|
constructor(client: RequestController, balance: Balance);
|
|
19
20
|
/**
|
|
20
|
-
* @see https://docs.voucherify.io/reference
|
|
21
|
+
* @see https://docs.voucherify.io/reference/create-voucher
|
|
21
22
|
*/
|
|
22
23
|
create(voucher: T.VouchersCreate): Promise<Pick<T.VouchersResponse, "object" | "type" | "discount" | "gift" | "category" | "additional_info" | "start_date" | "expiration_date" | "metadata" | "id" | "code" | "campaign" | "loyalty_card" | "validity_timeframe" | "validity_day_of_week" | "publish" | "redemption" | "active" | "assets" | "is_referral_code" | "referrer_id" | "holder_id" | "updated_at">>;
|
|
23
24
|
/**
|
|
24
|
-
* @see https://docs.voucherify.io/reference
|
|
25
|
+
* @see https://docs.voucherify.io/reference/vouchers-get
|
|
25
26
|
*/
|
|
26
27
|
get(code: string): Promise<T.VouchersResponse>;
|
|
27
28
|
/**
|
|
28
|
-
* @see https://docs.voucherify.io/reference
|
|
29
|
+
* @see https://docs.voucherify.io/reference/update-voucher
|
|
29
30
|
*/
|
|
30
31
|
update(voucher: T.VouchersUpdate): Promise<T.VouchersResponse>;
|
|
31
32
|
/**
|
|
32
|
-
* @see https://docs.voucherify.io/reference
|
|
33
|
+
* @see https://docs.voucherify.io/reference/delete-voucher
|
|
33
34
|
*/
|
|
34
35
|
delete(code: string, params?: T.VouchersDeleteParams): Promise<unknown>;
|
|
35
36
|
/**
|
|
36
|
-
* @see https://docs.voucherify.io/reference
|
|
37
|
+
* @see https://docs.voucherify.io/reference/list-vouchers
|
|
37
38
|
*/
|
|
38
39
|
list(params?: T.VouchersListParams): Promise<T.VouchersListResponse>;
|
|
39
40
|
/**
|
|
40
|
-
* @see https://docs.voucherify.io/reference
|
|
41
|
+
* @see https://docs.voucherify.io/reference/enable-voucher
|
|
41
42
|
*/
|
|
42
43
|
enable(code: string): Promise<T.VouchersResponse>;
|
|
43
44
|
/**
|
|
44
|
-
* @see https://docs.voucherify.io/reference
|
|
45
|
+
* @see https://docs.voucherify.io/reference/disable-voucher
|
|
45
46
|
*/
|
|
46
47
|
disable(code: string): Promise<T.VouchersResponse>;
|
|
47
48
|
/**
|
|
48
|
-
* @see https://docs.voucherify.io/reference
|
|
49
|
+
* @see https://docs.voucherify.io/reference/import-vouchers-1
|
|
49
50
|
*/
|
|
50
|
-
import(vouchers: T.VouchersImport[]): Promise<
|
|
51
|
+
import(vouchers: T.VouchersImport[]): Promise<T.VouchersImportResponse>;
|
|
51
52
|
/**
|
|
52
|
-
* @see https://docs.voucherify.io/reference
|
|
53
|
+
* @see https://docs.voucherify.io/reference/aaupdate-vouchers-metadata-in-bulk
|
|
53
54
|
*/
|
|
54
55
|
bulkUpdateMetadata(params: T.VouchersBulkUpdateMetadata): Promise<T.VouchersBulkUpdateMetadataResponse>;
|
|
55
56
|
/**
|
|
56
|
-
* @see https://docs.voucherify.io/reference
|
|
57
|
+
* @see https://docs.voucherify.io/reference/aa-update-vouchers-in-bulk
|
|
57
58
|
*/
|
|
58
59
|
bulkUpdate(vouchers: T.VouchersBulkUpdate): Promise<T.VouchersBulkUpdateResponse>;
|
|
59
60
|
/**
|
|
60
|
-
* @see https://docs.voucherify.io/reference
|
|
61
|
+
* @see https://docs.voucherify.io/reference/release-validation-session
|
|
61
62
|
*/
|
|
62
63
|
releaseValidationSession(code: string, sessionKey: string): Promise<unknown>;
|
|
63
64
|
}
|
package/dist/helpers.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export declare function isFunction(value: any): value is Function;
|
|
|
8
8
|
export declare function exists<T extends any>(value: T): value is NonNullable<T>;
|
|
9
9
|
export declare function environment(): string;
|
|
10
10
|
export declare function assert(condition: any, message?: string): asserts condition;
|
|
11
|
-
export declare function toQueryParams(obj: Record<string, unknown>): Record<string, string>;
|
|
12
11
|
/**
|
|
13
12
|
* Return an object containing all properties of `obj` excluding the ones in `keys` array
|
|
14
13
|
* e.g:
|
|
@@ -111,6 +111,9 @@ export interface CampaignsListResponse {
|
|
|
111
111
|
data_ref: 'campaigns';
|
|
112
112
|
campaigns: CampaignResponse[];
|
|
113
113
|
}
|
|
114
|
+
export declare type CampaignsVouchersImportResponse = {
|
|
115
|
+
async_action_id: string;
|
|
116
|
+
};
|
|
114
117
|
export declare type CampaignsCreateCampaignResponse = CampaignResponse;
|
|
115
118
|
export declare type CampaignsUpdateCampaignResponse = CampaignResponse;
|
|
116
119
|
export declare type CampaignsGetCampaignResponse = CampaignResponse;
|
package/dist/types/Products.d.ts
CHANGED
|
@@ -34,18 +34,17 @@ export declare type ProductsUpdate = {
|
|
|
34
34
|
metadata?: Record<string, any>;
|
|
35
35
|
};
|
|
36
36
|
export declare type ProductsUpdateResponse = ProductsCreateResponse;
|
|
37
|
-
export interface
|
|
37
|
+
export interface ProductsBulkUpdateMetadata {
|
|
38
38
|
source_ids: string[];
|
|
39
39
|
metadata: Record<string, any>;
|
|
40
40
|
}
|
|
41
41
|
export declare type ProductsBulkUpdate = ProductsCreate[];
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export declare type ProductsBulkMetadataUpdateResponse = BulkUpdateResponse[];
|
|
42
|
+
export declare type ProductsBulkUpdateResponse = {
|
|
43
|
+
async_action_id: string;
|
|
44
|
+
};
|
|
45
|
+
export declare type ProductsBulkUpdateMetadataResponse = {
|
|
46
|
+
async_action_id: string;
|
|
47
|
+
};
|
|
49
48
|
export interface ProductsDeleteParams {
|
|
50
49
|
force?: boolean;
|
|
51
50
|
}
|
|
@@ -94,4 +93,3 @@ export interface ProductsListSkus {
|
|
|
94
93
|
total: number;
|
|
95
94
|
skus: ProductsGetSkuResponse[];
|
|
96
95
|
}
|
|
97
|
-
export {};
|
package/dist/types/Vouchers.d.ts
CHANGED
|
@@ -206,22 +206,19 @@ export interface VouchersImport {
|
|
|
206
206
|
}
|
|
207
207
|
export interface VouchersBulkUpdateObject {
|
|
208
208
|
code: string;
|
|
209
|
-
metadata
|
|
209
|
+
metadata: Record<string, any>;
|
|
210
210
|
}
|
|
211
211
|
export declare type VouchersBulkUpdate = VouchersBulkUpdateObject[];
|
|
212
212
|
export interface VouchersBulkUpdateMetadata {
|
|
213
213
|
codes: string[];
|
|
214
|
-
metadata
|
|
215
|
-
}
|
|
216
|
-
export
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
export
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
updated: boolean;
|
|
226
|
-
}
|
|
227
|
-
export declare type VouchersBulkUpdateResponse = VouchersBulkUpdateObjectResponse[];
|
|
214
|
+
metadata: Record<string, any>;
|
|
215
|
+
}
|
|
216
|
+
export declare type VouchersImportResponse = {
|
|
217
|
+
async_action_id: string;
|
|
218
|
+
};
|
|
219
|
+
export declare type VouchersBulkUpdateMetadataResponse = {
|
|
220
|
+
async_action_id: string;
|
|
221
|
+
};
|
|
222
|
+
export declare type VouchersBulkUpdateResponse = {
|
|
223
|
+
async_action_id: string;
|
|
224
|
+
};
|