@voucherify/sdk 2.9.3 → 2.9.4
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/ApiLimitsHandler.d.ts +13 -0
- package/dist/AsyncActions.d.ts +17 -0
- package/dist/Balance.d.ts +15 -0
- package/dist/Campaigns.d.ts +66 -0
- package/dist/Categories.d.ts +29 -0
- package/dist/ClientSide.d.ts +77 -0
- package/dist/Consents.d.ts +13 -0
- package/dist/Customers.d.ts +75 -0
- package/dist/Distributions.d.ts +29 -0
- package/dist/Events.d.ts +15 -0
- package/dist/Exports.d.ts +25 -0
- package/dist/Loyalties.d.ts +171 -0
- package/dist/MetadataSchemas.d.ts +17 -0
- package/dist/Orders.d.ts +32 -0
- package/dist/ProductCollections.d.ts +30 -0
- package/dist/Products.d.ts +66 -0
- package/dist/PromotionTiers.d.ts +43 -0
- package/dist/Promotions.d.ts +30 -0
- package/dist/PromotionsStacks.d.ts +34 -0
- package/dist/Qualifications.d.ts +24 -0
- package/dist/Redemptions.d.ts +53 -0
- package/dist/RequestController.d.ts +31 -0
- package/dist/Rewards.d.ts +46 -0
- package/dist/Segments.d.ts +25 -0
- package/dist/ValidationRules.d.ts +47 -0
- package/dist/Validations.d.ts +39 -0
- package/dist/VoucherifyClientSide.d.ts +112 -0
- package/dist/VoucherifyError.d.ts +23 -0
- package/dist/VoucherifyServerSide.d.ts +170 -0
- package/dist/Vouchers.d.ts +84 -0
- package/dist/helpers.d.ts +20 -0
- package/dist/index.d.ts +63 -0
- package/dist/types/ApplicableTo.d.ts +32 -0
- package/dist/types/AsyncActions.d.ts +23 -0
- package/dist/types/Balance.d.ts +18 -0
- package/dist/types/Campaigns.d.ts +124 -0
- package/dist/types/Categories.d.ts +40 -0
- package/dist/types/ClientSide.d.ts +145 -0
- package/dist/types/Consents.d.ts +34 -0
- package/dist/types/Customers.d.ts +363 -0
- package/dist/types/DiscountVoucher.d.ts +94 -0
- package/dist/types/Distributions.d.ts +148 -0
- package/dist/types/Events.d.ts +21 -0
- package/dist/types/Exports.d.ts +151 -0
- package/dist/types/Gift.d.ts +5 -0
- package/dist/types/Loyalties.d.ts +1061 -0
- package/dist/types/MetadataSchemas.d.ts +34 -0
- package/dist/types/Orders.d.ts +199 -0
- package/dist/types/ProductCollections.d.ts +99 -0
- package/dist/types/Products.d.ts +108 -0
- package/dist/types/PromotionTiers.d.ts +131 -0
- package/dist/types/Promotions.d.ts +113 -0
- package/dist/types/PromotionsStacks.d.ts +74 -0
- package/dist/types/Qualifications.d.ts +92 -0
- package/dist/types/Redemptions.d.ts +215 -0
- package/dist/types/Rewards.d.ts +220 -0
- package/dist/types/Segments.d.ts +34 -0
- package/dist/types/Stackable.d.ts +106 -0
- package/dist/types/UtilityTypes.d.ts +5 -0
- package/dist/types/ValidateSession.d.ts +19 -0
- package/dist/types/ValidationError.d.ts +9 -0
- package/dist/types/ValidationRules.d.ts +96 -0
- package/dist/types/Validations.d.ts +109 -0
- package/dist/types/Vouchers.d.ts +452 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/voucherifysdk.cjs +2022 -1
- package/dist/voucherifysdk.cjs.map +1 -1
- package/dist/voucherifysdk.esm.js +1985 -1
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/voucherifysdk.d.mts +0 -5252
- package/dist/voucherifysdk.d.ts +0 -5252
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ProductsCreate, ProductsCreateResponse, ProductsGetResponse, ProductsUpdate, ProductsBulkUpdateMetadata, ProductsBulkUpdateMetadataResponse, ProductsBulkUpdate, ProductsBulkUpdateResponse, ProductsDeleteParams, ProductsListParams, ProductsListResponse, ProductsCreateSku, ProductsCreateSkuResponse, ProductsUpdateSku, ProductsDeleteSkuParams, ProductsListSkus } from './types/Products.js';
|
|
2
|
+
import { AsyncActionCreateResponse } from './types/AsyncActions.js';
|
|
3
|
+
import { RequestController } from './RequestController.js';
|
|
4
|
+
|
|
5
|
+
declare class Products {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: RequestController);
|
|
8
|
+
/**
|
|
9
|
+
* @see https://docs.voucherify.io/reference/create-product
|
|
10
|
+
*/
|
|
11
|
+
create(product: ProductsCreate): Promise<ProductsCreateResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* @see https://docs.voucherify.io/reference/get-product
|
|
14
|
+
*/
|
|
15
|
+
get(productId: string): Promise<ProductsGetResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* @see https://docs.voucherify.io/reference/update-product
|
|
18
|
+
*/
|
|
19
|
+
update(product: ProductsUpdate): Promise<ProductsCreateResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* @see https://docs.voucherify.io/reference/async-update-products-metadata-in-bulk
|
|
22
|
+
*/
|
|
23
|
+
bulkUpdateMetadata(products: ProductsBulkUpdateMetadata): Promise<ProductsBulkUpdateMetadataResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* @see https://docs.voucherify.io/reference/post-products-in-bulk
|
|
26
|
+
*/
|
|
27
|
+
bulkUpdate(products: ProductsBulkUpdate): Promise<ProductsBulkUpdateResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* @see https://docs.voucherify.io/reference/delete-product
|
|
30
|
+
*/
|
|
31
|
+
delete(productId: string, params?: ProductsDeleteParams): Promise<unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* @see https://docs.voucherify.io/reference/list-products
|
|
34
|
+
*/
|
|
35
|
+
list(params?: ProductsListParams): Promise<ProductsListResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* @see https://docs.voucherify.io/reference/create-sku
|
|
38
|
+
*/
|
|
39
|
+
createSku(productId: string, sku: ProductsCreateSku): Promise<ProductsCreateSkuResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* @see https://docs.voucherify.io/reference/get-sku-v20210726
|
|
42
|
+
*/
|
|
43
|
+
getSku(skuId: string): Promise<ProductsCreateSkuResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* @see https://docs.voucherify.io/reference/update-sku
|
|
46
|
+
*/
|
|
47
|
+
updateSku(productId: string, sku: ProductsUpdateSku): Promise<ProductsCreateSkuResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* @see https://docs.voucherify.io/reference/delete-sku
|
|
50
|
+
*/
|
|
51
|
+
deleteSku(productId: string, skuId: string, params?: ProductsDeleteSkuParams): Promise<unknown>;
|
|
52
|
+
/**
|
|
53
|
+
* @see https://docs.voucherify.io/reference/list-skus
|
|
54
|
+
*/
|
|
55
|
+
listSkus(productId: string): Promise<ProductsListSkus>;
|
|
56
|
+
/**
|
|
57
|
+
* @see https://docs.voucherify.io/reference/import-skus-using-csv
|
|
58
|
+
*/
|
|
59
|
+
importSkusCSV(filePath: string): Promise<AsyncActionCreateResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* @see https://docs.voucherify.io/reference/import-products-using-csv
|
|
62
|
+
*/
|
|
63
|
+
importCSV(filePath: string): Promise<AsyncActionCreateResponse>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { Products };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { PromotionTiersListAllParams, PromotionTiersListAllResponse, PromotionTier, PromotionTiersCreateParams, PromotionTiersRedeemParams, PromotionTiersRedeemResponse, PromotionTiersUpdateParams } from './types/PromotionTiers.js';
|
|
2
|
+
import { RequestController } from './RequestController.js';
|
|
3
|
+
import './types/DiscountVoucher.js';
|
|
4
|
+
import './types/Orders.js';
|
|
5
|
+
import './types/Customers.js';
|
|
6
|
+
import './types/ValidationRules.js';
|
|
7
|
+
import './types/ApplicableTo.js';
|
|
8
|
+
import './types/ValidateSession.js';
|
|
9
|
+
|
|
10
|
+
declare class PromotionTiers {
|
|
11
|
+
private client;
|
|
12
|
+
constructor(client: RequestController);
|
|
13
|
+
/**
|
|
14
|
+
* @see https://docs.voucherify.io/reference/list-promotion-tiers
|
|
15
|
+
*/
|
|
16
|
+
listAll(params?: PromotionTiersListAllParams): Promise<PromotionTiersListAllResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* @see https://docs.voucherify.io/reference/get-promotions
|
|
19
|
+
*/
|
|
20
|
+
list(promotionId: string): Promise<PromotionTiersListAllResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* @see https://docs.voucherify.io/reference/get-promotion-tier
|
|
23
|
+
*/
|
|
24
|
+
get(tierId: string): Promise<PromotionTier>;
|
|
25
|
+
/**
|
|
26
|
+
* @see https://docs.voucherify.io/reference/add-promotion-tier-to-campaign
|
|
27
|
+
*/
|
|
28
|
+
create(promotionId: string, params: PromotionTiersCreateParams): Promise<PromotionTier>;
|
|
29
|
+
/**
|
|
30
|
+
* @see https://docs.voucherify.io/reference/redeem-promotion
|
|
31
|
+
*/
|
|
32
|
+
redeem(promotionsTierId: string, params: PromotionTiersRedeemParams): Promise<PromotionTiersRedeemResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* @see https://docs.voucherify.io/reference/update-promotion
|
|
35
|
+
*/
|
|
36
|
+
update(params: PromotionTiersUpdateParams): Promise<PromotionTier>;
|
|
37
|
+
/**
|
|
38
|
+
* @see https://docs.voucherify.io/reference/delete-promotion
|
|
39
|
+
*/
|
|
40
|
+
delete(promotionsTierId: string): Promise<unknown>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { PromotionTiers };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PromotionsCreate, PromotionsCreateResponse, PromotionsValidateParams, PromotionsValidateQueryParams, PromotionsValidateResponse } from './types/Promotions.js';
|
|
2
|
+
import { RequestController } from './RequestController.js';
|
|
3
|
+
import { PromotionTiers } from './PromotionTiers.js';
|
|
4
|
+
import { PromotionsStacks } from './PromotionsStacks.js';
|
|
5
|
+
import './types/DiscountVoucher.js';
|
|
6
|
+
import './types/Orders.js';
|
|
7
|
+
import './types/Customers.js';
|
|
8
|
+
import './types/PromotionTiers.js';
|
|
9
|
+
import './types/ValidationRules.js';
|
|
10
|
+
import './types/ApplicableTo.js';
|
|
11
|
+
import './types/ValidateSession.js';
|
|
12
|
+
import './types/PromotionsStacks.js';
|
|
13
|
+
import './types/Categories.js';
|
|
14
|
+
|
|
15
|
+
declare class Promotions {
|
|
16
|
+
private client;
|
|
17
|
+
tiers: PromotionTiers;
|
|
18
|
+
stack: PromotionsStacks;
|
|
19
|
+
constructor(client: RequestController, tiers: PromotionTiers, stack: PromotionsStacks);
|
|
20
|
+
/**
|
|
21
|
+
* @see https://docs.voucherify.io/reference/create-promotion-campaign
|
|
22
|
+
*/
|
|
23
|
+
create(promotionCampaign: PromotionsCreate): Promise<PromotionsCreateResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* @see https://docs.voucherify.io/reference/validate-promotions-1
|
|
26
|
+
*/
|
|
27
|
+
validate(body: PromotionsValidateParams, params?: PromotionsValidateQueryParams): Promise<PromotionsValidateResponse>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Promotions };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PromotionsStacksListInCampaignResponseBody, PromotionsStacksCreateInCampaignRequestBody, PromotionsStacksCreateInCampaignResponseBody, PromotionStack, PromotionsStacksUpdateRequestBody, PromotionsStacksUpdateResponseBody, PromotionsStacksListRequestQuery, PromotionsStacksListResponseBody } from './types/PromotionsStacks.js';
|
|
2
|
+
import { RequestController } from './RequestController.js';
|
|
3
|
+
import './types/Categories.js';
|
|
4
|
+
|
|
5
|
+
declare class PromotionsStacks {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: RequestController);
|
|
8
|
+
/**
|
|
9
|
+
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
10
|
+
*/
|
|
11
|
+
listInCampaign(campaignId: string): Promise<PromotionsStacksListInCampaignResponseBody>;
|
|
12
|
+
/**
|
|
13
|
+
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
14
|
+
*/
|
|
15
|
+
createInCampaign(campaignId: string, body: PromotionsStacksCreateInCampaignRequestBody): Promise<PromotionsStacksCreateInCampaignResponseBody>;
|
|
16
|
+
/**
|
|
17
|
+
* @see https://docs.voucherify.io/reference/delete-promotion-stack
|
|
18
|
+
*/
|
|
19
|
+
delete(campaignId: string, stackId: string): Promise<{}>;
|
|
20
|
+
/**
|
|
21
|
+
* @see https://docs.voucherify.io/reference/get-promotion-stack
|
|
22
|
+
*/
|
|
23
|
+
get(campaignId: string, stackId: string): Promise<PromotionStack>;
|
|
24
|
+
/**
|
|
25
|
+
* @see https://docs.voucherify.io/reference/update-promotion-stack
|
|
26
|
+
*/
|
|
27
|
+
update(campaignId: string, stackId: string, body: PromotionsStacksUpdateRequestBody): Promise<PromotionsStacksUpdateResponseBody>;
|
|
28
|
+
/**
|
|
29
|
+
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
30
|
+
*/
|
|
31
|
+
list(params?: PromotionsStacksListRequestQuery): Promise<PromotionsStacksListResponseBody>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { PromotionsStacks };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { QualificationsCheckEligibilityRequestBody, QualificationsCheckEligibilityResponseBody } from './types/Qualifications.js';
|
|
2
|
+
import { RequestController } from './RequestController.js';
|
|
3
|
+
import './types/Customers.js';
|
|
4
|
+
import './types/DiscountVoucher.js';
|
|
5
|
+
import './types/Exports.js';
|
|
6
|
+
import './types/Orders.js';
|
|
7
|
+
import './types/ApplicableTo.js';
|
|
8
|
+
import './types/Categories.js';
|
|
9
|
+
import './types/Loyalties.js';
|
|
10
|
+
import './types/Products.js';
|
|
11
|
+
import './types/ValidationRules.js';
|
|
12
|
+
import './types/Vouchers.js';
|
|
13
|
+
import './types/Rewards.js';
|
|
14
|
+
|
|
15
|
+
declare class Qualifications {
|
|
16
|
+
private client;
|
|
17
|
+
constructor(client: RequestController);
|
|
18
|
+
/**
|
|
19
|
+
* @see https://docs.voucherify.io/reference/check-eligibility
|
|
20
|
+
*/
|
|
21
|
+
checkEligibility(body: QualificationsCheckEligibilityRequestBody): Promise<QualificationsCheckEligibilityResponseBody>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { Qualifications };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { RedemptionsRedeemBody, RedemptionsRedeemResponse, RedemptionsRedeemStackableParams, RedemptionsRedeemStackableResponse, Redemption, RedemptionsListParams, RedemptionsListResponse, RedemptionsGetForVoucherResponse, RedemptionsRollbackParams, RedemptionsRollbackResponse, RedemptionsRollbackStackableResponse } from './types/Redemptions.js';
|
|
2
|
+
import { RequestController } from './RequestController.js';
|
|
3
|
+
import './types/Orders.js';
|
|
4
|
+
import './types/Customers.js';
|
|
5
|
+
import './types/DiscountVoucher.js';
|
|
6
|
+
import './types/Rewards.js';
|
|
7
|
+
import './types/Vouchers.js';
|
|
8
|
+
import './types/Gift.js';
|
|
9
|
+
import './types/ValidateSession.js';
|
|
10
|
+
import './types/Stackable.js';
|
|
11
|
+
import './types/ApplicableTo.js';
|
|
12
|
+
import './types/Products.js';
|
|
13
|
+
import './types/Loyalties.js';
|
|
14
|
+
import './types/ValidationRules.js';
|
|
15
|
+
import './types/Categories.js';
|
|
16
|
+
import './types/ValidationError.js';
|
|
17
|
+
import './types/PromotionTiers.js';
|
|
18
|
+
|
|
19
|
+
declare class Redemptions {
|
|
20
|
+
private client;
|
|
21
|
+
constructor(client: RequestController);
|
|
22
|
+
/**
|
|
23
|
+
* @see https://docs.voucherify.io/reference/redeem-voucher
|
|
24
|
+
*/
|
|
25
|
+
redeem(code: string, body?: RedemptionsRedeemBody): Promise<RedemptionsRedeemResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* @see https://docs.voucherify.io/reference/redeem-stacked-discounts
|
|
28
|
+
*/
|
|
29
|
+
redeemStackable(params: RedemptionsRedeemStackableParams): Promise<RedemptionsRedeemStackableResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* @see https://docs.voucherify.io/reference/get-redemption
|
|
32
|
+
*/
|
|
33
|
+
get(redemptionId: string): Promise<Redemption>;
|
|
34
|
+
/**
|
|
35
|
+
* @see https://docs.voucherify.io/reference/list-redemptions
|
|
36
|
+
*/
|
|
37
|
+
list(params?: RedemptionsListParams): Promise<RedemptionsListResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* @see https://docs.voucherify.io/reference/vouchers-redemptions
|
|
40
|
+
*/
|
|
41
|
+
getForVoucher(code: string): Promise<RedemptionsGetForVoucherResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* @see https://docs.voucherify.io/reference/rollback-redemption
|
|
44
|
+
*/
|
|
45
|
+
rollback(redemptionId: string, params?: RedemptionsRollbackParams): Promise<RedemptionsRollbackResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* @see https://docs.voucherify.io/reference/rollback-stackable-redemptions
|
|
48
|
+
* Types of params and queryParams WILL be changed in future - please do not depend on it!
|
|
49
|
+
*/
|
|
50
|
+
rollbackStackable(parentRedemptionId: string, params?: any, queryParams?: any): Promise<RedemptionsRollbackStackableResponse>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { Redemptions };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
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
|
+
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
|
+
}
|
|
30
|
+
|
|
31
|
+
export { RequestController, type RequestControllerOptions };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RewardsListParams, RewardsListResponse, RewardsCreate, RewardsCreateResponse, RewardsGetResponse, RewardsUpdate, RewardAssignment, RewardsListAssignmentsRequestQuery, RewardsListAssignmentsResponseBody, RewardsCreateAssignmentRequestBody, RewardsUpdateAssignmentRequestBody } from './types/Rewards.js';
|
|
2
|
+
import { RequestController } from './RequestController.js';
|
|
3
|
+
|
|
4
|
+
declare class Rewards {
|
|
5
|
+
private client;
|
|
6
|
+
constructor(client: RequestController);
|
|
7
|
+
/**
|
|
8
|
+
* @see https://docs.voucherify.io/reference/list-rewards
|
|
9
|
+
*/
|
|
10
|
+
list(params?: RewardsListParams): Promise<RewardsListResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* @see https://docs.voucherify.io/reference/create-reward
|
|
13
|
+
*/
|
|
14
|
+
create(reward: RewardsCreate): Promise<RewardsCreateResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* @see https://docs.voucherify.io/reference/get-reward
|
|
17
|
+
*/
|
|
18
|
+
get(rewardId: string): Promise<RewardsGetResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* @see https://docs.voucherify.io/reference/update-reward
|
|
21
|
+
*/
|
|
22
|
+
update(reward: RewardsUpdate): Promise<RewardsCreateResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* @see https://docs.voucherify.io/reference/delete-reward
|
|
25
|
+
*/
|
|
26
|
+
delete(rewardId: string): Promise<unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* @see https://docs.voucherify.io/reference/get-reward-assignment
|
|
29
|
+
*/
|
|
30
|
+
getAssignment(rewardId: string, assignmentId: string): Promise<RewardAssignment>;
|
|
31
|
+
/**
|
|
32
|
+
* @see https://docs.voucherify.io/reference/list-reward-assignments
|
|
33
|
+
*/
|
|
34
|
+
listAssignments(rewardId: string, params?: RewardsListAssignmentsRequestQuery): Promise<RewardsListAssignmentsResponseBody>;
|
|
35
|
+
/**
|
|
36
|
+
* @see https://docs.voucherify.io/reference/create-reward-assignment
|
|
37
|
+
*/
|
|
38
|
+
createAssignment(rewardId: string, assignment: RewardsCreateAssignmentRequestBody): Promise<RewardAssignment>;
|
|
39
|
+
/**
|
|
40
|
+
* @see https://docs.voucherify.io/reference/update-reward-assignment
|
|
41
|
+
*/
|
|
42
|
+
updateAssignment(rewardId: string, assignment: RewardsUpdateAssignmentRequestBody): Promise<RewardAssignment>;
|
|
43
|
+
deleteAssignment(rewardId: string, assignmentId: string): Promise<unknown>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { Rewards };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SegmentsCreate, SegmentsCreateResponse, SegmentsListResponse } from './types/Segments.js';
|
|
2
|
+
import { RequestController } from './RequestController.js';
|
|
3
|
+
|
|
4
|
+
declare class Segments {
|
|
5
|
+
private client;
|
|
6
|
+
constructor(client: RequestController);
|
|
7
|
+
/**
|
|
8
|
+
* @see https://docs.voucherify.io/reference/create-segment
|
|
9
|
+
*/
|
|
10
|
+
create(segment: SegmentsCreate): Promise<SegmentsCreateResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* @see https://docs.voucherify.io/reference/get-segment
|
|
13
|
+
*/
|
|
14
|
+
get(segmentId: string): Promise<SegmentsCreateResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* @see https://docs.voucherify.io/reference/delete-segment
|
|
17
|
+
*/
|
|
18
|
+
delete(segmentId: string): Promise<unknown>;
|
|
19
|
+
/**
|
|
20
|
+
* @see https://docs.voucherify.io/reference/list-segments
|
|
21
|
+
*/
|
|
22
|
+
list(customerId: string): Promise<SegmentsListResponse>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { Segments };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ValidationRulesCreate, ValidationRulesCreateResponse, ValidationRulesGetResponse, ValidationRulesUpdate, ValidationRulesCreateAssignment, ValidationRulesCreateAssignmentResponse, ValidationRulesValidateResponse, ValidationRulesListParams, ValidationRulesListResponse, ValidationRulesListRulesAssignmentsRequestQuery, ValidationRulesListRulesAssignmentsResponseBody, ValidationRulesListAssignmentsParams, ValidationRulesListAssignmentsResponse } from './types/ValidationRules.js';
|
|
2
|
+
import { RequestController } from './RequestController.js';
|
|
3
|
+
import './types/ApplicableTo.js';
|
|
4
|
+
|
|
5
|
+
declare class ValidationRules {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: RequestController);
|
|
8
|
+
/**
|
|
9
|
+
* @see https://docs.voucherify.io/reference/create-validation-rules
|
|
10
|
+
*/
|
|
11
|
+
create(validationRule: ValidationRulesCreate): Promise<ValidationRulesCreateResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* @see https://docs.voucherify.io/reference/get-validation-rules
|
|
14
|
+
*/
|
|
15
|
+
get(validationRuleId: string): Promise<ValidationRulesGetResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* @see https://docs.voucherify.io/reference/update-validation-rules
|
|
18
|
+
*/
|
|
19
|
+
update(validationRule: ValidationRulesUpdate): Promise<ValidationRulesCreateResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* @see https://docs.voucherify.io/reference/delete-validation-rules
|
|
22
|
+
*/
|
|
23
|
+
delete(validationRuleId: string): Promise<unknown>;
|
|
24
|
+
/**
|
|
25
|
+
* @see https://docs.voucherify.io/reference/create-validation-rules-assignment
|
|
26
|
+
*/
|
|
27
|
+
createAssignment(validationRuleId: string, assignment: ValidationRulesCreateAssignment): Promise<ValidationRulesCreateAssignmentResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* @see https://docs.voucherify.io/reference/delete-validation-rules-assignment
|
|
30
|
+
*/
|
|
31
|
+
deleteAssignment(validationRuleId: string, assignmentId: string): Promise<unknown>;
|
|
32
|
+
validate(validationRuleId: string, params?: any): Promise<ValidationRulesValidateResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* @see https://docs.voucherify.io/reference/list-validation-rules
|
|
35
|
+
*/
|
|
36
|
+
list(params?: ValidationRulesListParams): Promise<ValidationRulesListResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* @see https://docs.voucherify.io/reference/list-validation-rules-assignments
|
|
39
|
+
*/
|
|
40
|
+
listRulesAssignments(params?: ValidationRulesListRulesAssignmentsRequestQuery): Promise<ValidationRulesListRulesAssignmentsResponseBody>;
|
|
41
|
+
/**
|
|
42
|
+
* @see https://docs.voucherify.io/reference/list-validation-rule-assignments
|
|
43
|
+
*/
|
|
44
|
+
listAssignments(validationRuleId: string, params?: ValidationRulesListAssignmentsParams): Promise<ValidationRulesListAssignmentsResponse>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { ValidationRules };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ValidationsValidateVoucherParams, ValidationsValidateVoucherResponse, ValidationsValidateCode, ValidationsValidateContext, ValidationsValidateStackableParams, ValidationValidateStackableResponse } from './types/Validations.js';
|
|
2
|
+
import { PromotionsValidateResponse } from './types/Promotions.js';
|
|
3
|
+
import { RequestController } from './RequestController.js';
|
|
4
|
+
import { Promotions } from './Promotions.js';
|
|
5
|
+
import './types/DiscountVoucher.js';
|
|
6
|
+
import './types/Customers.js';
|
|
7
|
+
import './types/Stackable.js';
|
|
8
|
+
import './types/Rewards.js';
|
|
9
|
+
import './types/Gift.js';
|
|
10
|
+
import './types/Orders.js';
|
|
11
|
+
import './types/ApplicableTo.js';
|
|
12
|
+
import './types/Products.js';
|
|
13
|
+
import './types/Loyalties.js';
|
|
14
|
+
import './types/ValidationRules.js';
|
|
15
|
+
import './types/Vouchers.js';
|
|
16
|
+
import './types/Categories.js';
|
|
17
|
+
import './types/ValidationError.js';
|
|
18
|
+
import './types/ValidateSession.js';
|
|
19
|
+
import './types/PromotionTiers.js';
|
|
20
|
+
import './PromotionTiers.js';
|
|
21
|
+
import './PromotionsStacks.js';
|
|
22
|
+
import './types/PromotionsStacks.js';
|
|
23
|
+
|
|
24
|
+
declare class Validations {
|
|
25
|
+
private client;
|
|
26
|
+
private promotions;
|
|
27
|
+
constructor(client: RequestController, promotions: Promotions);
|
|
28
|
+
/**
|
|
29
|
+
* @see https://docs.voucherify.io/reference/validate-voucher
|
|
30
|
+
*/
|
|
31
|
+
validateVoucher(code: string, params?: ValidationsValidateVoucherParams): Promise<ValidationsValidateVoucherResponse>;
|
|
32
|
+
validate(code: string | ValidationsValidateCode, context?: ValidationsValidateContext): Promise<PromotionsValidateResponse> | Promise<ValidationsValidateVoucherResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* @see https://docs.voucherify.io/reference/validate-stacked-discounts-1
|
|
35
|
+
*/
|
|
36
|
+
validateStackable(params: ValidationsValidateStackableParams): Promise<ValidationValidateStackableResponse>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { Validations };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ClientSide } from './ClientSide.js';
|
|
2
|
+
import './types/Customers.js';
|
|
3
|
+
import './types/DiscountVoucher.js';
|
|
4
|
+
import './types/ClientSide.js';
|
|
5
|
+
import './types/Vouchers.js';
|
|
6
|
+
import './types/Orders.js';
|
|
7
|
+
import './types/Consents.js';
|
|
8
|
+
import './types/Distributions.js';
|
|
9
|
+
import './types/PromotionTiers.js';
|
|
10
|
+
import './types/ValidationRules.js';
|
|
11
|
+
import './types/ApplicableTo.js';
|
|
12
|
+
import './types/ValidateSession.js';
|
|
13
|
+
import './types/Validations.js';
|
|
14
|
+
import './types/Stackable.js';
|
|
15
|
+
import './types/Rewards.js';
|
|
16
|
+
import './types/Gift.js';
|
|
17
|
+
import './types/Products.js';
|
|
18
|
+
import './types/Loyalties.js';
|
|
19
|
+
import './types/Categories.js';
|
|
20
|
+
import './types/ValidationError.js';
|
|
21
|
+
import './types/Promotions.js';
|
|
22
|
+
import './types/Redemptions.js';
|
|
23
|
+
import './types/Qualifications.js';
|
|
24
|
+
import './types/Exports.js';
|
|
25
|
+
import './RequestController.js';
|
|
26
|
+
|
|
27
|
+
interface VoucherifyClientSideOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Optionally, you can add `apiUrl` to the client options if you want to use Voucherify running in a specific region.
|
|
30
|
+
*
|
|
31
|
+
* ```javascript
|
|
32
|
+
* const client = VoucherifyClientSide({
|
|
33
|
+
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
34
|
+
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
|
|
35
|
+
* apiUrl: 'https://<region>.api.voucherify.io'
|
|
36
|
+
* })
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
apiUrl?: string;
|
|
40
|
+
/**
|
|
41
|
+
* [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):
|
|
42
|
+
*
|
|
43
|
+
* ```javascript
|
|
44
|
+
* const client = VoucherifyClientSide({
|
|
45
|
+
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
46
|
+
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY'
|
|
47
|
+
* })
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
clientApplicationId: string;
|
|
51
|
+
/**
|
|
52
|
+
* [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):
|
|
53
|
+
*
|
|
54
|
+
* ```javascript
|
|
55
|
+
* const client = VoucherifyClientSide({
|
|
56
|
+
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
57
|
+
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY'
|
|
58
|
+
* })
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
clientSecretKey: string;
|
|
62
|
+
/**
|
|
63
|
+
* Set customer identity when using React Widget. In other situations, use `setIdentity` method:
|
|
64
|
+
*
|
|
65
|
+
* ```javascript
|
|
66
|
+
* client.setIdentity('gustav@purpleson.com')
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
trackingId?: string;
|
|
70
|
+
/**
|
|
71
|
+
* **(Required in Node.js)** Set the origin from where the requests are made.
|
|
72
|
+
*
|
|
73
|
+
* ```javascript
|
|
74
|
+
* const client = VoucherifyClientSide({
|
|
75
|
+
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
76
|
+
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
|
|
77
|
+
* origin: 'your-domain.com'
|
|
78
|
+
* })
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @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.
|
|
82
|
+
*/
|
|
83
|
+
origin?: string;
|
|
84
|
+
/**
|
|
85
|
+
* You can pass additional headers to requests made by the API Client.
|
|
86
|
+
* It can prove to be useful when debugging various scenarios.
|
|
87
|
+
* ```javascript
|
|
88
|
+
* const voucherify = VoucherifyServerSide({
|
|
89
|
+
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
90
|
+
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
|
|
91
|
+
* customHeaders: {
|
|
92
|
+
* "DEBUG-HEADER": "my_value",
|
|
93
|
+
* "TEST-HEADER": "another_value"
|
|
94
|
+
* }
|
|
95
|
+
* })
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
customHeaders?: Record<string, string>;
|
|
99
|
+
/**
|
|
100
|
+
* If you wish to include original Axios error in VoucherifyError instance set this to true
|
|
101
|
+
* It can prove to be useful when debugging various scenarios.
|
|
102
|
+
* The original Axios error will be included in cause property of VoucherifyError
|
|
103
|
+
*/
|
|
104
|
+
exposeErrorCause?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* 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.
|
|
107
|
+
*/
|
|
108
|
+
timeoutMs?: number;
|
|
109
|
+
}
|
|
110
|
+
declare function VoucherifyClientSide(options: VoucherifyClientSideOptions): ClientSide;
|
|
111
|
+
|
|
112
|
+
export { ClientSide, VoucherifyClientSide, type VoucherifyClientSideOptions };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
declare class VoucherifyError extends Error {
|
|
7
|
+
code: number;
|
|
8
|
+
key: string;
|
|
9
|
+
details?: string;
|
|
10
|
+
request_id?: string;
|
|
11
|
+
resource_id?: string;
|
|
12
|
+
resource_type?: string;
|
|
13
|
+
related_object_ids?: string[];
|
|
14
|
+
related_object_type?: string;
|
|
15
|
+
related_object_total?: number;
|
|
16
|
+
error?: {
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
cause?: AxiosError;
|
|
20
|
+
constructor(statusCode: number, body?: unknown, axiosError?: AxiosError);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { VoucherifyError };
|