@voucherify/sdk 2.9.1 → 2.9.3
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/dist/voucherifysdk.cjs +2 -0
- package/dist/voucherifysdk.cjs.map +1 -0
- package/dist/voucherifysdk.d.mts +5252 -0
- package/dist/voucherifysdk.d.ts +5252 -0
- package/dist/voucherifysdk.esm.js +2 -2261
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/package.json +12 -8
- package/CHANGELOG.md +0 -657
- package/dist/ApiLimitsHandler.d.ts +0 -10
- package/dist/AsyncActions.d.ts +0 -15
- package/dist/Balance.d.ts +0 -12
- package/dist/Campaigns.d.ts +0 -58
- package/dist/Categories.d.ts +0 -26
- package/dist/ClientSide.d.ts +0 -53
- package/dist/Consents.d.ts +0 -10
- package/dist/Customers.d.ts +0 -72
- package/dist/Distributions.d.ts +0 -22
- package/dist/Events.d.ts +0 -10
- package/dist/Exports.d.ts +0 -22
- package/dist/Loyalties.d.ts +0 -159
- package/dist/MetadataSchemas.d.ts +0 -14
- package/dist/Orders.d.ts +0 -27
- package/dist/ProductCollections.d.ts +0 -26
- package/dist/Products.d.ts +0 -63
- package/dist/PromotionTiers.d.ts +0 -34
- package/dist/Promotions.d.ts +0 -18
- package/dist/PromotionsStacks.d.ts +0 -30
- package/dist/Qualifications.d.ts +0 -10
- package/dist/Redemptions.d.ts +0 -35
- package/dist/RequestController.d.ts +0 -29
- package/dist/Rewards.d.ts +0 -43
- package/dist/Segments.d.ts +0 -22
- package/dist/ValidationRules.d.ts +0 -43
- package/dist/Validations.d.ts +0 -17
- package/dist/VoucherifyClientSide.d.ts +0 -86
- package/dist/VoucherifyError.d.ts +0 -20
- package/dist/VoucherifyServerSide.d.ts +0 -131
- package/dist/Vouchers.d.ts +0 -78
- package/dist/helpers.d.ts +0 -18
- package/dist/index.d.ts +0 -25
- package/dist/types/ApplicableTo.d.ts +0 -30
- package/dist/types/AsyncActions.d.ts +0 -21
- package/dist/types/Balance.d.ts +0 -14
- package/dist/types/Campaigns.d.ts +0 -120
- package/dist/types/Categories.d.ts +0 -38
- package/dist/types/ClientSide.d.ts +0 -134
- package/dist/types/Consents.d.ts +0 -33
- package/dist/types/Customers.d.ts +0 -361
- package/dist/types/DiscountVoucher.d.ts +0 -93
- package/dist/types/Distributions.d.ts +0 -144
- package/dist/types/Events.d.ts +0 -17
- package/dist/types/Exports.d.ts +0 -149
- package/dist/types/Gift.d.ts +0 -3
- package/dist/types/Loyalties.d.ts +0 -1057
- package/dist/types/MetadataSchemas.d.ts +0 -33
- package/dist/types/Orders.d.ts +0 -195
- package/dist/types/ProductCollections.d.ts +0 -96
- package/dist/types/Products.d.ts +0 -106
- package/dist/types/PromotionTiers.d.ts +0 -127
- package/dist/types/Promotions.d.ts +0 -108
- package/dist/types/PromotionsStacks.d.ts +0 -71
- package/dist/types/Qualifications.d.ts +0 -86
- package/dist/types/Redemptions.d.ts +0 -205
- package/dist/types/Rewards.d.ts +0 -219
- package/dist/types/Segments.d.ts +0 -32
- package/dist/types/Stackable.d.ts +0 -101
- package/dist/types/UtilityTypes.d.ts +0 -3
- package/dist/types/ValidateSession.d.ts +0 -17
- package/dist/types/ValidationError.d.ts +0 -7
- package/dist/types/ValidationRules.d.ts +0 -93
- package/dist/types/Validations.d.ts +0 -98
- package/dist/types/Vouchers.d.ts +0 -364
- package/dist/types/index.d.ts +0 -25
- package/dist/voucherifysdk.umd.development.js +0 -2270
- package/dist/voucherifysdk.umd.development.js.map +0 -1
- package/dist/voucherifysdk.umd.production.min.js +0 -2
- package/dist/voucherifysdk.umd.production.min.js.map +0 -1
package/dist/Promotions.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as T from './types/Promotions';
|
|
2
|
-
import type { RequestController } from './RequestController';
|
|
3
|
-
import type { PromotionTiers } from './PromotionTiers';
|
|
4
|
-
import { PromotionsStacks } from './PromotionsStacks';
|
|
5
|
-
export declare class Promotions {
|
|
6
|
-
private client;
|
|
7
|
-
tiers: PromotionTiers;
|
|
8
|
-
stack: PromotionsStacks;
|
|
9
|
-
constructor(client: RequestController, tiers: PromotionTiers, stack: PromotionsStacks);
|
|
10
|
-
/**
|
|
11
|
-
* @see https://docs.voucherify.io/reference/create-promotion-campaign
|
|
12
|
-
*/
|
|
13
|
-
create(promotionCampaign: T.PromotionsCreate): Promise<T.PromotionsCreateResponse>;
|
|
14
|
-
/**
|
|
15
|
-
* @see https://docs.voucherify.io/reference/validate-promotions-1
|
|
16
|
-
*/
|
|
17
|
-
validate(body: T.PromotionsValidateParams, params?: T.PromotionsValidateQueryParams): Promise<T.PromotionsValidateResponse>;
|
|
18
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as T from './types/PromotionsStacks';
|
|
2
|
-
import type { RequestController } from './RequestController';
|
|
3
|
-
export declare class PromotionsStacks {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: RequestController);
|
|
6
|
-
/**
|
|
7
|
-
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
8
|
-
*/
|
|
9
|
-
listInCampaign(campaignId: string): Promise<T.PromotionsStacksListInCampaignResponseBody>;
|
|
10
|
-
/**
|
|
11
|
-
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
12
|
-
*/
|
|
13
|
-
createInCampaign(campaignId: string, body: T.PromotionsStacksCreateInCampaignRequestBody): Promise<T.PromotionsStacksCreateInCampaignResponseBody>;
|
|
14
|
-
/**
|
|
15
|
-
* @see https://docs.voucherify.io/reference/delete-promotion-stack
|
|
16
|
-
*/
|
|
17
|
-
delete(campaignId: string, stackId: string): Promise<{}>;
|
|
18
|
-
/**
|
|
19
|
-
* @see https://docs.voucherify.io/reference/get-promotion-stack
|
|
20
|
-
*/
|
|
21
|
-
get(campaignId: string, stackId: string): Promise<T.PromotionStack>;
|
|
22
|
-
/**
|
|
23
|
-
* @see https://docs.voucherify.io/reference/update-promotion-stack
|
|
24
|
-
*/
|
|
25
|
-
update(campaignId: string, stackId: string, body: T.PromotionsStacksUpdateRequestBody): Promise<T.PromotionsStacksUpdateResponseBody>;
|
|
26
|
-
/**
|
|
27
|
-
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
28
|
-
*/
|
|
29
|
-
list(params?: T.PromotionsStacksListRequestQuery): Promise<T.PromotionsStacksListResponseBody>;
|
|
30
|
-
}
|
package/dist/Qualifications.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as T from './types/Qualifications';
|
|
2
|
-
import type { RequestController } from './RequestController';
|
|
3
|
-
export declare class Qualifications {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: RequestController);
|
|
6
|
-
/**
|
|
7
|
-
* @see https://docs.voucherify.io/reference/check-eligibility
|
|
8
|
-
*/
|
|
9
|
-
checkEligibility(body: T.QualificationsCheckEligibilityRequestBody): Promise<T.QualificationsCheckEligibilityResponseBody>;
|
|
10
|
-
}
|
package/dist/Redemptions.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as T from './types/Redemptions';
|
|
2
|
-
import type { RequestController } from './RequestController';
|
|
3
|
-
export declare class Redemptions {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: RequestController);
|
|
6
|
-
/**
|
|
7
|
-
* @see https://docs.voucherify.io/reference/redeem-voucher
|
|
8
|
-
*/
|
|
9
|
-
redeem(code: string, body?: T.RedemptionsRedeemBody): Promise<T.RedemptionsRedeemResponse>;
|
|
10
|
-
/**
|
|
11
|
-
* @see https://docs.voucherify.io/reference/redeem-stacked-discounts
|
|
12
|
-
*/
|
|
13
|
-
redeemStackable(params: T.RedemptionsRedeemStackableParams): Promise<T.RedemptionsRedeemStackableResponse>;
|
|
14
|
-
/**
|
|
15
|
-
* @see https://docs.voucherify.io/reference/get-redemption
|
|
16
|
-
*/
|
|
17
|
-
get(redemptionId: string): Promise<T.Redemption>;
|
|
18
|
-
/**
|
|
19
|
-
* @see https://docs.voucherify.io/reference/list-redemptions
|
|
20
|
-
*/
|
|
21
|
-
list(params?: T.RedemptionsListParams): Promise<T.RedemptionsListResponse>;
|
|
22
|
-
/**
|
|
23
|
-
* @see https://docs.voucherify.io/reference/vouchers-redemptions
|
|
24
|
-
*/
|
|
25
|
-
getForVoucher(code: string): Promise<T.RedemptionsGetForVoucherResponse>;
|
|
26
|
-
/**
|
|
27
|
-
* @see https://docs.voucherify.io/reference/rollback-redemption
|
|
28
|
-
*/
|
|
29
|
-
rollback(redemptionId: string, params?: T.RedemptionsRollbackParams): Promise<T.RedemptionsRollbackResponse>;
|
|
30
|
-
/**
|
|
31
|
-
* @see https://docs.voucherify.io/reference/rollback-stackable-redemptions
|
|
32
|
-
* Types of params and queryParams WILL be changed in future - please do not depend on it!
|
|
33
|
-
*/
|
|
34
|
-
rollbackStackable(parentRedemptionId: string, params?: any, queryParams?: any): Promise<T.RedemptionsRollbackStackableResponse>;
|
|
35
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export interface RequestControllerOptions {
|
|
2
|
-
baseURL: string;
|
|
3
|
-
basePath: string;
|
|
4
|
-
headers: Record<string, any>;
|
|
5
|
-
exposeErrorCause: boolean;
|
|
6
|
-
timeoutMs: number;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export declare class RequestController {
|
|
12
|
-
private baseURL;
|
|
13
|
-
private basePath;
|
|
14
|
-
private headers;
|
|
15
|
-
private request;
|
|
16
|
-
private lastResponseHeaders;
|
|
17
|
-
private isLastResponseHeadersSet;
|
|
18
|
-
private exposeErrorCause;
|
|
19
|
-
private timeoutMs;
|
|
20
|
-
constructor({ basePath, baseURL, headers, exposeErrorCause, timeoutMs }: RequestControllerOptions);
|
|
21
|
-
isLastReponseHeadersSet(): boolean;
|
|
22
|
-
getLastResponseHeaders(): Record<string, string>;
|
|
23
|
-
private setLastResponseHeaders;
|
|
24
|
-
setBaseUrl(baseURL: string): void;
|
|
25
|
-
get<T>(path: string, params?: Record<string, any>): Promise<T>;
|
|
26
|
-
post<T>(path: string, body: Record<string, any>, params?: Record<string, any>, headers?: Record<string, any>): Promise<T>;
|
|
27
|
-
put<T>(path: string, body: Record<string, any>, params?: Record<string, any>): Promise<T>;
|
|
28
|
-
delete<T>(path: string, params?: Record<string, any>): Promise<T>;
|
|
29
|
-
}
|
package/dist/Rewards.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as T from './types/Rewards';
|
|
2
|
-
import type { RequestController } from './RequestController';
|
|
3
|
-
export declare class Rewards {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: RequestController);
|
|
6
|
-
/**
|
|
7
|
-
* @see https://docs.voucherify.io/reference/list-rewards
|
|
8
|
-
*/
|
|
9
|
-
list(params?: T.RewardsListParams): Promise<T.RewardsListResponse>;
|
|
10
|
-
/**
|
|
11
|
-
* @see https://docs.voucherify.io/reference/create-reward
|
|
12
|
-
*/
|
|
13
|
-
create(reward: T.RewardsCreate): Promise<T.RewardsCreateResponse>;
|
|
14
|
-
/**
|
|
15
|
-
* @see https://docs.voucherify.io/reference/get-reward
|
|
16
|
-
*/
|
|
17
|
-
get(rewardId: string): Promise<T.RewardsCreateResponse>;
|
|
18
|
-
/**
|
|
19
|
-
* @see https://docs.voucherify.io/reference/update-reward
|
|
20
|
-
*/
|
|
21
|
-
update(reward: T.RewardsUpdate): Promise<T.RewardsCreateResponse>;
|
|
22
|
-
/**
|
|
23
|
-
* @see https://docs.voucherify.io/reference/delete-reward
|
|
24
|
-
*/
|
|
25
|
-
delete(rewardId: string): Promise<unknown>;
|
|
26
|
-
/**
|
|
27
|
-
* @see https://docs.voucherify.io/reference/get-reward-assignment
|
|
28
|
-
*/
|
|
29
|
-
getAssignment(rewardId: string, assignmentId: string): Promise<T.RewardAssignment>;
|
|
30
|
-
/**
|
|
31
|
-
* @see https://docs.voucherify.io/reference/list-reward-assignments
|
|
32
|
-
*/
|
|
33
|
-
listAssignments(rewardId: string, params?: T.RewardsListAssignmentsRequestQuery): Promise<T.RewardsListAssignmentsResponseBody>;
|
|
34
|
-
/**
|
|
35
|
-
* @see https://docs.voucherify.io/reference/create-reward-assignment
|
|
36
|
-
*/
|
|
37
|
-
createAssignment(rewardId: string, assignment: T.RewardsCreateAssignmentRequestBody): Promise<T.RewardAssignment>;
|
|
38
|
-
/**
|
|
39
|
-
* @see https://docs.voucherify.io/reference/update-reward-assignment
|
|
40
|
-
*/
|
|
41
|
-
updateAssignment(rewardId: string, assignment: T.RewardsUpdateAssignmentRequestBody): Promise<T.RewardAssignment>;
|
|
42
|
-
deleteAssignment(rewardId: string, assignmentId: string): Promise<unknown>;
|
|
43
|
-
}
|
package/dist/Segments.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as T from './types/Segments';
|
|
2
|
-
import type { RequestController } from './RequestController';
|
|
3
|
-
export declare class Segments {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: RequestController);
|
|
6
|
-
/**
|
|
7
|
-
* @see https://docs.voucherify.io/reference/create-segment
|
|
8
|
-
*/
|
|
9
|
-
create(segment: T.SegmentsCreate): Promise<T.SegmentsCreateResponse>;
|
|
10
|
-
/**
|
|
11
|
-
* @see https://docs.voucherify.io/reference/get-segment
|
|
12
|
-
*/
|
|
13
|
-
get(segmentId: string): Promise<T.SegmentsCreateResponse>;
|
|
14
|
-
/**
|
|
15
|
-
* @see https://docs.voucherify.io/reference/delete-segment
|
|
16
|
-
*/
|
|
17
|
-
delete(segmentId: string): Promise<unknown>;
|
|
18
|
-
/**
|
|
19
|
-
* @see https://docs.voucherify.io/reference/list-segments
|
|
20
|
-
*/
|
|
21
|
-
list(customerId: string): Promise<T.SegmentsListResponse>;
|
|
22
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as T from './types/ValidationRules';
|
|
2
|
-
import type { RequestController } from './RequestController';
|
|
3
|
-
export declare class ValidationRules {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: RequestController);
|
|
6
|
-
/**
|
|
7
|
-
* @see https://docs.voucherify.io/reference/create-validation-rules
|
|
8
|
-
*/
|
|
9
|
-
create(validationRule: T.ValidationRulesCreate): Promise<T.ValidationRulesCreateResponse>;
|
|
10
|
-
/**
|
|
11
|
-
* @see https://docs.voucherify.io/reference/get-validation-rules
|
|
12
|
-
*/
|
|
13
|
-
get(validationRuleId: string): Promise<T.ValidationRulesGetResponse>;
|
|
14
|
-
/**
|
|
15
|
-
* @see https://docs.voucherify.io/reference/update-validation-rules
|
|
16
|
-
*/
|
|
17
|
-
update(validationRule: T.ValidationRulesUpdate): Promise<T.ValidationRulesCreateResponse>;
|
|
18
|
-
/**
|
|
19
|
-
* @see https://docs.voucherify.io/reference/delete-validation-rules
|
|
20
|
-
*/
|
|
21
|
-
delete(validationRuleId: string): Promise<unknown>;
|
|
22
|
-
/**
|
|
23
|
-
* @see https://docs.voucherify.io/reference/create-validation-rules-assignment
|
|
24
|
-
*/
|
|
25
|
-
createAssignment(validationRuleId: string, assignment: T.ValidationRulesCreateAssignment): Promise<T.ValidationRulesCreateAssignmentResponse>;
|
|
26
|
-
/**
|
|
27
|
-
* @see https://docs.voucherify.io/reference/delete-validation-rules-assignment
|
|
28
|
-
*/
|
|
29
|
-
deleteAssignment(validationRuleId: string, assignmentId: string): Promise<unknown>;
|
|
30
|
-
validate(validationRuleId: string, params?: any): Promise<T.ValidationRulesValidateResponse>;
|
|
31
|
-
/**
|
|
32
|
-
* @see https://docs.voucherify.io/reference/list-validation-rules
|
|
33
|
-
*/
|
|
34
|
-
list(params?: T.ValidationRulesListParams): Promise<T.ValidationRulesListResponse>;
|
|
35
|
-
/**
|
|
36
|
-
* @see https://docs.voucherify.io/reference/list-validation-rules-assignments
|
|
37
|
-
*/
|
|
38
|
-
listRulesAssignments(params?: T.ValidationRulesListRulesAssignmentsRequestQuery): Promise<T.ValidationRulesListRulesAssignmentsResponseBody>;
|
|
39
|
-
/**
|
|
40
|
-
* @see https://docs.voucherify.io/reference/list-validation-rule-assignments
|
|
41
|
-
*/
|
|
42
|
-
listAssignments(validationRuleId: string, params?: T.ValidationRulesListAssignmentsParams): Promise<T.ValidationRulesListAssignmentsResponse>;
|
|
43
|
-
}
|
package/dist/Validations.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as T from './types/Validations';
|
|
2
|
-
import type { RequestController } from './RequestController';
|
|
3
|
-
import type { Promotions } from './Promotions';
|
|
4
|
-
export declare class Validations {
|
|
5
|
-
private client;
|
|
6
|
-
private promotions;
|
|
7
|
-
constructor(client: RequestController, promotions: Promotions);
|
|
8
|
-
/**
|
|
9
|
-
* @see https://docs.voucherify.io/reference/validate-voucher
|
|
10
|
-
*/
|
|
11
|
-
validateVoucher(code: string, params?: T.ValidationsValidateVoucherParams): Promise<T.ValidationsValidateVoucherResponse>;
|
|
12
|
-
validate(code: string | T.ValidationsValidateCode, context?: T.ValidationsValidateContext): Promise<T.ValidationsValidateVoucherResponse> | Promise<import("./types").PromotionsValidateResponse>;
|
|
13
|
-
/**
|
|
14
|
-
* @see https://docs.voucherify.io/reference/validate-stacked-discounts-1
|
|
15
|
-
*/
|
|
16
|
-
validateStackable(params: T.ValidationsValidateStackableParams): Promise<T.ValidationValidateStackableResponse>;
|
|
17
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { ClientSide } from './ClientSide';
|
|
2
|
-
export type { ClientSide };
|
|
3
|
-
export interface VoucherifyClientSideOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Optionally, you can add `apiUrl` to the client options if you want to use Voucherify running in a specific region.
|
|
6
|
-
*
|
|
7
|
-
* ```javascript
|
|
8
|
-
* const client = VoucherifyClientSide({
|
|
9
|
-
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
10
|
-
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
|
|
11
|
-
* apiUrl: 'https://<region>.api.voucherify.io'
|
|
12
|
-
* })
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
apiUrl?: string;
|
|
16
|
-
/**
|
|
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
|
-
*
|
|
19
|
-
* ```javascript
|
|
20
|
-
* const client = VoucherifyClientSide({
|
|
21
|
-
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
22
|
-
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY'
|
|
23
|
-
* })
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
clientApplicationId: string;
|
|
27
|
-
/**
|
|
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
|
-
*
|
|
30
|
-
* ```javascript
|
|
31
|
-
* const client = VoucherifyClientSide({
|
|
32
|
-
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
33
|
-
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY'
|
|
34
|
-
* })
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
clientSecretKey: string;
|
|
38
|
-
/**
|
|
39
|
-
* Set customer identity when using React Widget. In other situations, use `setIdentity` method:
|
|
40
|
-
*
|
|
41
|
-
* ```javascript
|
|
42
|
-
* client.setIdentity('gustav@purpleson.com')
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
trackingId?: string;
|
|
46
|
-
/**
|
|
47
|
-
* **(Required in Node.js)** Set the origin from where the requests are made.
|
|
48
|
-
*
|
|
49
|
-
* ```javascript
|
|
50
|
-
* const client = VoucherifyClientSide({
|
|
51
|
-
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
52
|
-
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
|
|
53
|
-
* origin: 'your-domain.com'
|
|
54
|
-
* })
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* @note in the browser, this option will be ignored. The `origin` header is a [forbidden header name](https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name) and it'll be automatically set by the browser for every request.
|
|
58
|
-
*/
|
|
59
|
-
origin?: string;
|
|
60
|
-
/**
|
|
61
|
-
* You can pass additional headers to requests made by the API Client.
|
|
62
|
-
* It can prove to be useful when debugging various scenarios.
|
|
63
|
-
* ```javascript
|
|
64
|
-
* const voucherify = VoucherifyServerSide({
|
|
65
|
-
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
66
|
-
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
|
|
67
|
-
* customHeaders: {
|
|
68
|
-
* "DEBUG-HEADER": "my_value",
|
|
69
|
-
* "TEST-HEADER": "another_value"
|
|
70
|
-
* }
|
|
71
|
-
* })
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
customHeaders?: Record<string, string>;
|
|
75
|
-
/**
|
|
76
|
-
* If you wish to include original Axios error in VoucherifyError instance set this to true
|
|
77
|
-
* It can prove to be useful when debugging various scenarios.
|
|
78
|
-
* The original Axios error will be included in cause property of VoucherifyError
|
|
79
|
-
*/
|
|
80
|
-
exposeErrorCause?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Optionally, you can set timeout in miliseconds. After this time request will be aborted. By default Voucherify's API has timeout value of 3 minutes.
|
|
83
|
-
*/
|
|
84
|
-
timeoutMs?: number;
|
|
85
|
-
}
|
|
86
|
-
export declare function VoucherifyClientSide(options: VoucherifyClientSideOptions): ClientSide;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AxiosError } from 'axios';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export declare class VoucherifyError extends Error {
|
|
6
|
-
code: number;
|
|
7
|
-
key: string;
|
|
8
|
-
details?: string;
|
|
9
|
-
request_id?: string;
|
|
10
|
-
resource_id?: string;
|
|
11
|
-
resource_type?: string;
|
|
12
|
-
related_object_ids?: string[];
|
|
13
|
-
related_object_type?: string;
|
|
14
|
-
related_object_total?: number;
|
|
15
|
-
error?: {
|
|
16
|
-
message: string;
|
|
17
|
-
};
|
|
18
|
-
cause?: AxiosError;
|
|
19
|
-
constructor(statusCode: number, body?: unknown, axiosError?: AxiosError);
|
|
20
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { AsyncActions } from './AsyncActions';
|
|
2
|
-
import { Campaigns } from './Campaigns';
|
|
3
|
-
import { Distributions } from './Distributions';
|
|
4
|
-
import { Events } from './Events';
|
|
5
|
-
import { Vouchers } from './Vouchers';
|
|
6
|
-
import { Validations } from './Validations';
|
|
7
|
-
import { Redemptions } from './Redemptions';
|
|
8
|
-
import { Promotions } from './Promotions';
|
|
9
|
-
import { Customers } from './Customers';
|
|
10
|
-
import { Consents } from './Consents';
|
|
11
|
-
import { Orders } from './Orders';
|
|
12
|
-
import { Products } from './Products';
|
|
13
|
-
import { Rewards } from './Rewards';
|
|
14
|
-
import { Loyalties } from './Loyalties';
|
|
15
|
-
import { ValidationRules } from './ValidationRules';
|
|
16
|
-
import { Segments } from './Segments';
|
|
17
|
-
import { ApiLimitsHandler } from './ApiLimitsHandler';
|
|
18
|
-
import { MetadataSchemas } from './MetadataSchemas';
|
|
19
|
-
import { Categories } from './Categories';
|
|
20
|
-
import { ProductCollections } from './ProductCollections';
|
|
21
|
-
import { Qualifications } from './Qualifications';
|
|
22
|
-
export interface VoucherifyServerSideOptions {
|
|
23
|
-
/**
|
|
24
|
-
* Optionally, you can add `apiUrl` to the client options if you want to use Voucherify running in a specific region.
|
|
25
|
-
*
|
|
26
|
-
* ```javascript
|
|
27
|
-
* const voucherify = VoucherifyServerSide({
|
|
28
|
-
* applicationId: 'YOUR-APPLICATION-ID',
|
|
29
|
-
* secretKey: 'YOUR-SECRET-KEY',
|
|
30
|
-
* apiUrl: 'https://<region>.api.voucherify.io'
|
|
31
|
-
* })
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
apiUrl?: string;
|
|
35
|
-
/**
|
|
36
|
-
* [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):
|
|
37
|
-
*
|
|
38
|
-
* ```javascript
|
|
39
|
-
* const voucherify = VoucherifyServerSide({
|
|
40
|
-
* applicationId: 'YOUR-APPLICATION-ID',
|
|
41
|
-
* secretKey: 'YOUR-SECRET-KEY'
|
|
42
|
-
* })
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
applicationId: string;
|
|
46
|
-
/**
|
|
47
|
-
* [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):
|
|
48
|
-
*
|
|
49
|
-
* ```javascript
|
|
50
|
-
* const voucherify = VoucherifyServerSide({
|
|
51
|
-
* applicationId: 'YOUR-APPLICATION-ID',
|
|
52
|
-
* secretKey: 'YOUR-SECRET-KEY'
|
|
53
|
-
* })
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
secretKey: string;
|
|
57
|
-
/**
|
|
58
|
-
* 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).
|
|
59
|
-
*
|
|
60
|
-
* ```javascript
|
|
61
|
-
* const voucherify = VoucherifyServerSide({
|
|
62
|
-
* applicationId: 'YOUR-APPLICATION-ID',
|
|
63
|
-
* secretKey: 'YOUR-SECRET-KEY',
|
|
64
|
-
* apiVersion: 'v2017-04-20'
|
|
65
|
-
* })
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
apiVersion?: string;
|
|
69
|
-
channel?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Set this option to disable displaying the warning about exposing your `secretKey` if you're using VoucherifyServerSide in a browser environment.
|
|
72
|
-
* By setting this option to `true`, you acknowledge that you understand the risks of exposing your `secretKey` to a browser environment.
|
|
73
|
-
*
|
|
74
|
-
* ```javascript
|
|
75
|
-
* const voucherify = VoucherifyServerSide({
|
|
76
|
-
* applicationId: 'YOUR-APPLICATION-ID',
|
|
77
|
-
* secretKey: 'YOUR-SECRET-KEY',
|
|
78
|
-
* dangerouslySetSecretKeyInBrowser: true
|
|
79
|
-
* })
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
dangerouslySetSecretKeyInBrowser?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* You can pass additional headers to requests made by the API Client.
|
|
85
|
-
* It can prove to be useful when debugging various scenarios.
|
|
86
|
-
* ```javascript
|
|
87
|
-
* const voucherify = VoucherifyServerSide({
|
|
88
|
-
* applicationId: 'YOUR-APPLICATION-ID',
|
|
89
|
-
* secretKey: 'YOUR-SECRET-KEY',
|
|
90
|
-
* customHeaders: {
|
|
91
|
-
* "DEBUG-HEADER": "my_value",
|
|
92
|
-
* "TEST-HEADER": "another_value"
|
|
93
|
-
* }
|
|
94
|
-
* })
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
customHeaders?: Record<string, string>;
|
|
98
|
-
/**
|
|
99
|
-
* If you wish to include original Axios error in VoucherifyError instance set this to true
|
|
100
|
-
* It can prove to be useful when debugging various scenarios.
|
|
101
|
-
* The original Axios error will be included in cause property of VoucherifyError
|
|
102
|
-
*/
|
|
103
|
-
exposeErrorCause?: boolean;
|
|
104
|
-
/**
|
|
105
|
-
* Optionally, you can set timeout in miliseconds. After this time request will be aborted. By default Voucherify's API has timeout value of 3 minutes.
|
|
106
|
-
*/
|
|
107
|
-
timeoutMs?: number;
|
|
108
|
-
}
|
|
109
|
-
export declare function VoucherifyServerSide(options: VoucherifyServerSideOptions): {
|
|
110
|
-
vouchers: Vouchers;
|
|
111
|
-
campaigns: Campaigns;
|
|
112
|
-
categories: Categories;
|
|
113
|
-
distributions: Distributions;
|
|
114
|
-
validations: Validations;
|
|
115
|
-
redemptions: Redemptions;
|
|
116
|
-
promotions: Promotions;
|
|
117
|
-
customers: Customers;
|
|
118
|
-
consents: Consents;
|
|
119
|
-
orders: Orders;
|
|
120
|
-
products: Products;
|
|
121
|
-
productCollections: ProductCollections;
|
|
122
|
-
qualifications: Qualifications;
|
|
123
|
-
rewards: Rewards;
|
|
124
|
-
loyalties: Loyalties;
|
|
125
|
-
segments: Segments;
|
|
126
|
-
validationRules: ValidationRules;
|
|
127
|
-
events: Events;
|
|
128
|
-
asyncActions: AsyncActions;
|
|
129
|
-
apiLimitsHandler: ApiLimitsHandler;
|
|
130
|
-
metadataSchemas: MetadataSchemas;
|
|
131
|
-
};
|
package/dist/Vouchers.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as T from './types/Vouchers';
|
|
2
|
-
import * as AAT from './types/AsyncActions';
|
|
3
|
-
import type { RequestController } from './RequestController';
|
|
4
|
-
import type { Balance } from './Balance';
|
|
5
|
-
declare class VouchersQualification {
|
|
6
|
-
private client;
|
|
7
|
-
constructor(client: RequestController);
|
|
8
|
-
/**
|
|
9
|
-
* 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.
|
|
10
|
-
* 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.
|
|
11
|
-
*
|
|
12
|
-
* @see https://docs.voucherify.io/reference/push-qualification-request
|
|
13
|
-
*/
|
|
14
|
-
examine(body: T.VouchersQualificationExamineBody, params?: T.VouchersQualificationExamineParams): Promise<T.VouchersQualificationExamineResponse>;
|
|
15
|
-
}
|
|
16
|
-
export declare class Vouchers {
|
|
17
|
-
private client;
|
|
18
|
-
balance: Balance;
|
|
19
|
-
qualifications: VouchersQualification;
|
|
20
|
-
constructor(client: RequestController, balance: Balance);
|
|
21
|
-
/**
|
|
22
|
-
* @see https://docs.voucherify.io/reference/create-voucher
|
|
23
|
-
*/
|
|
24
|
-
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" | "created_at">>;
|
|
25
|
-
/**
|
|
26
|
-
* @see https://docs.voucherify.io/reference/vouchers-get
|
|
27
|
-
*/
|
|
28
|
-
get(code: string): Promise<T.VouchersResponse>;
|
|
29
|
-
/**
|
|
30
|
-
* @see https://docs.voucherify.io/reference/update-voucher
|
|
31
|
-
*/
|
|
32
|
-
update(voucher: T.VouchersUpdate): Promise<T.VouchersResponse>;
|
|
33
|
-
/**
|
|
34
|
-
* @see https://docs.voucherify.io/reference/delete-voucher
|
|
35
|
-
*/
|
|
36
|
-
delete(code: string, params?: T.VouchersDeleteParams): Promise<unknown>;
|
|
37
|
-
/**
|
|
38
|
-
* @see https://docs.voucherify.io/reference/list-vouchers
|
|
39
|
-
*/
|
|
40
|
-
list(params?: T.VouchersListParams): Promise<T.VouchersListResponse>;
|
|
41
|
-
/**
|
|
42
|
-
* @see https://docs.voucherify.io/reference/enable-voucher
|
|
43
|
-
*/
|
|
44
|
-
enable(code: string): Promise<T.VouchersResponse>;
|
|
45
|
-
/**
|
|
46
|
-
* @see https://docs.voucherify.io/reference/disable-voucher
|
|
47
|
-
*/
|
|
48
|
-
disable(code: string): Promise<T.VouchersResponse>;
|
|
49
|
-
/**
|
|
50
|
-
* @see https://docs.voucherify.io/reference/import-vouchers-1
|
|
51
|
-
*/
|
|
52
|
-
import(vouchers: T.VouchersImport[]): Promise<T.VouchersImportResponse>;
|
|
53
|
-
/**
|
|
54
|
-
* @see https://docs.voucherify.io/reference/aaupdate-vouchers-metadata-in-bulk
|
|
55
|
-
*/
|
|
56
|
-
bulkUpdateMetadata(params: T.VouchersBulkUpdateMetadata): Promise<T.VouchersBulkUpdateMetadataResponse>;
|
|
57
|
-
/**
|
|
58
|
-
* @see https://docs.voucherify.io/reference/aa-update-vouchers-in-bulk
|
|
59
|
-
*/
|
|
60
|
-
bulkUpdate(vouchers: T.VouchersBulkUpdate): Promise<T.VouchersBulkUpdateResponse>;
|
|
61
|
-
/**
|
|
62
|
-
* @see https://docs.voucherify.io/reference/release-validation-session
|
|
63
|
-
*/
|
|
64
|
-
releaseValidationSession(code: string, sessionKey: string): Promise<unknown>;
|
|
65
|
-
/**
|
|
66
|
-
* @see https://docs.voucherify.io/reference/import-vouchers-using-csv
|
|
67
|
-
*/
|
|
68
|
-
importCSV(filePath: string): Promise<AAT.AsyncActionCreateResponse>;
|
|
69
|
-
/**
|
|
70
|
-
* @see https://docs.voucherify.io/reference/list-voucher-transactions
|
|
71
|
-
*/
|
|
72
|
-
listTransactions(code: string, params?: T.VouchersListTransactionsRequestQuery): Promise<T.VouchersListTransactionsResponseBody>;
|
|
73
|
-
/**
|
|
74
|
-
* @see https://docs.voucherify.io/reference/export-voucher-transactions
|
|
75
|
-
*/
|
|
76
|
-
exportTransactions(code: string, body: T.VouchersExportTransactionsRequestBody): Promise<T.VouchersExportTransactionsResponseBody>;
|
|
77
|
-
}
|
|
78
|
-
export {};
|
package/dist/helpers.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare function encode(value?: string): string;
|
|
2
|
-
export declare function isNumber(value: any): value is number;
|
|
3
|
-
export declare function isString(value: any): value is string;
|
|
4
|
-
export declare function isOptionalString(value: any): value is string | undefined;
|
|
5
|
-
export declare function isObject<T extends Record<string, any> = Record<string, any>>(value: any): value is T;
|
|
6
|
-
export declare function isOptionalObject<T extends Record<string, any> = Record<string, any>>(value: any): value is T | null | undefined;
|
|
7
|
-
export declare function isFunction(value: any): value is Function;
|
|
8
|
-
export declare function exists<T extends any>(value: T): value is NonNullable<T>;
|
|
9
|
-
export declare function environment(): string;
|
|
10
|
-
export declare function assert(condition: any, message?: string): asserts condition;
|
|
11
|
-
/**
|
|
12
|
-
* Return an object containing all properties of `obj` excluding the ones in `keys` array
|
|
13
|
-
* e.g:
|
|
14
|
-
* ```javascript
|
|
15
|
-
* omit({ a: 1, b: 2, c: 3, d: 4 }, ['b', 'd']) // output: { a: 1, c: 3 }
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare function omit<T extends {}, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
package/dist/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './VoucherifyServerSide';
|
|
3
|
-
export * from './VoucherifyClientSide';
|
|
4
|
-
export type { Balance } from './Balance';
|
|
5
|
-
export type { Campaigns } from './Campaigns';
|
|
6
|
-
export type { ClientSide } from './ClientSide';
|
|
7
|
-
export type { Consents } from './Consents';
|
|
8
|
-
export type { Customers } from './Customers';
|
|
9
|
-
export type { Distributions } from './Distributions';
|
|
10
|
-
export type { Events } from './Events';
|
|
11
|
-
export type { Exports } from './Exports';
|
|
12
|
-
export type { Loyalties } from './Loyalties';
|
|
13
|
-
export type { Orders } from './Orders';
|
|
14
|
-
export type { Products } from './Products';
|
|
15
|
-
export type { Promotions } from './Promotions';
|
|
16
|
-
export type { PromotionTiers } from './PromotionTiers';
|
|
17
|
-
export type { Redemptions } from './Redemptions';
|
|
18
|
-
export type { RequestController } from './RequestController';
|
|
19
|
-
export type { Rewards } from './Rewards';
|
|
20
|
-
export type { Segments } from './Segments';
|
|
21
|
-
export type { ValidationRules } from './ValidationRules';
|
|
22
|
-
export type { Validations } from './Validations';
|
|
23
|
-
export type { VoucherifyError } from './VoucherifyError';
|
|
24
|
-
export type { Vouchers } from './Vouchers';
|
|
25
|
-
export type { Qualifications } from './Qualifications';
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare type ApplicableToEffect = 'APPLY_TO_EVERY' | 'APPLY_TO_CHEAPEST' | 'APPLY_TO_MOST_EXPENSIVE';
|
|
2
|
-
export interface ApplicableTo {
|
|
3
|
-
object: 'product' | 'sku' | 'products_collection';
|
|
4
|
-
id: string;
|
|
5
|
-
source_id?: string;
|
|
6
|
-
product_id?: string;
|
|
7
|
-
product_source_id?: string;
|
|
8
|
-
strict: boolean;
|
|
9
|
-
price?: number;
|
|
10
|
-
price_formula?: number;
|
|
11
|
-
effect: ApplicableToEffect;
|
|
12
|
-
quantity_limit?: number;
|
|
13
|
-
aggregated_quantity_limit?: number;
|
|
14
|
-
amount_limit?: number;
|
|
15
|
-
aggregated_amount_limit?: number;
|
|
16
|
-
order_item_indices?: number[];
|
|
17
|
-
}
|
|
18
|
-
export interface ApplicableToResultList {
|
|
19
|
-
object: 'list';
|
|
20
|
-
total: number;
|
|
21
|
-
data: ApplicableTo[];
|
|
22
|
-
data_ref: 'data';
|
|
23
|
-
}
|
|
24
|
-
export declare type InapplicableToResultList = {
|
|
25
|
-
data: InapplicableTo[];
|
|
26
|
-
total: number;
|
|
27
|
-
object: 'list';
|
|
28
|
-
data_ref: string;
|
|
29
|
-
};
|
|
30
|
-
export declare type InapplicableTo = ApplicableTo;
|