@voucherify/sdk 2.4.0 → 2.6.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 +145 -0
- package/README.md +239 -5
- package/dist/Categories.d.ts +1 -1
- package/dist/Exports.d.ts +4 -0
- package/dist/Loyalties.d.ts +65 -4
- package/dist/ProductCollections.d.ts +26 -0
- package/dist/Promotions.d.ts +3 -1
- package/dist/PromotionsStacks.d.ts +30 -0
- package/dist/Rewards.d.ts +7 -3
- package/dist/ValidationRules.d.ts +4 -0
- package/dist/VoucherifyServerSide.d.ts +2 -0
- package/dist/Vouchers.d.ts +8 -0
- package/dist/types/Categories.d.ts +13 -0
- package/dist/types/Exports.d.ts +119 -0
- package/dist/types/Loyalties.d.ts +436 -4
- package/dist/types/ProductCollections.d.ts +95 -0
- package/dist/types/PromotionsStacks.d.ts +71 -0
- package/dist/types/Rewards.d.ts +101 -1
- package/dist/types/UtilityTypes.d.ts +3 -0
- package/dist/types/ValidationRules.d.ts +21 -0
- package/dist/types/Vouchers.d.ts +138 -0
- package/dist/voucherifysdk.esm.js +275 -9
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +275 -9
- package/dist/voucherifysdk.umd.development.js.map +1 -1
- package/dist/voucherifysdk.umd.production.min.js +1 -1
- package/dist/voucherifysdk.umd.production.min.js.map +1 -1
- package/package.json +1 -1
package/dist/Promotions.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as T from './types/Promotions';
|
|
2
2
|
import type { RequestController } from './RequestController';
|
|
3
3
|
import type { PromotionTiers } from './PromotionTiers';
|
|
4
|
+
import { PromotionsStacks } from './PromotionsStacks';
|
|
4
5
|
export declare class Promotions {
|
|
5
6
|
private client;
|
|
6
7
|
tiers: PromotionTiers;
|
|
7
|
-
|
|
8
|
+
stack: PromotionsStacks;
|
|
9
|
+
constructor(client: RequestController, tiers: PromotionTiers, stack: PromotionsStacks);
|
|
8
10
|
/**
|
|
9
11
|
* @see https://docs.voucherify.io/reference/create-promotion-campaign
|
|
10
12
|
*/
|
|
@@ -0,0 +1,30 @@
|
|
|
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/Rewards.d.ts
CHANGED
|
@@ -23,17 +23,21 @@ export declare class Rewards {
|
|
|
23
23
|
* @see https://docs.voucherify.io/reference/delete-reward
|
|
24
24
|
*/
|
|
25
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>;
|
|
26
30
|
/**
|
|
27
31
|
* @see https://docs.voucherify.io/reference/list-reward-assignments
|
|
28
32
|
*/
|
|
29
|
-
listAssignments(rewardId: string, params?: T.
|
|
33
|
+
listAssignments(rewardId: string, params?: T.RewardsListAssignmentsRequestQuery): Promise<T.RewardsListAssignmentsResponseBody>;
|
|
30
34
|
/**
|
|
31
35
|
* @see https://docs.voucherify.io/reference/create-reward-assignment
|
|
32
36
|
*/
|
|
33
|
-
createAssignment(rewardId: string, assignment: T.
|
|
37
|
+
createAssignment(rewardId: string, assignment: T.RewardsCreateAssignmentRequestBody): Promise<T.RewardAssignment>;
|
|
34
38
|
/**
|
|
35
39
|
* @see https://docs.voucherify.io/reference/update-reward-assignment
|
|
36
40
|
*/
|
|
37
|
-
updateAssignment(rewardId: string, assignment: T.
|
|
41
|
+
updateAssignment(rewardId: string, assignment: T.RewardsUpdateAssignmentRequestBody): Promise<T.RewardAssignment>;
|
|
38
42
|
deleteAssignment(rewardId: string, assignmentId: string): Promise<unknown>;
|
|
39
43
|
}
|
|
@@ -32,6 +32,10 @@ export declare class ValidationRules {
|
|
|
32
32
|
* @see https://docs.voucherify.io/reference/list-validation-rules
|
|
33
33
|
*/
|
|
34
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>;
|
|
35
39
|
/**
|
|
36
40
|
* @see https://docs.voucherify.io/reference/list-validation-rule-assignments
|
|
37
41
|
*/
|
|
@@ -17,6 +17,7 @@ import { Segments } from './Segments';
|
|
|
17
17
|
import { ApiLimitsHandler } from './ApiLimitsHandler';
|
|
18
18
|
import { MetadataSchemas } from './MetadataSchemas';
|
|
19
19
|
import { Categories } from './Categories';
|
|
20
|
+
import { ProductCollections } from './ProductCollections';
|
|
20
21
|
export interface VoucherifyServerSideOptions {
|
|
21
22
|
/**
|
|
22
23
|
* Optionally, you can add `apiUrl` to the client options if you want to use Voucherify running in a specific region.
|
|
@@ -116,6 +117,7 @@ export declare function VoucherifyServerSide(options: VoucherifyServerSideOption
|
|
|
116
117
|
consents: Consents;
|
|
117
118
|
orders: Orders;
|
|
118
119
|
products: Products;
|
|
120
|
+
productCollections: ProductCollections;
|
|
119
121
|
rewards: Rewards;
|
|
120
122
|
loyalties: Loyalties;
|
|
121
123
|
segments: Segments;
|
package/dist/Vouchers.d.ts
CHANGED
|
@@ -66,5 +66,13 @@ export declare class Vouchers {
|
|
|
66
66
|
* @see https://docs.voucherify.io/reference/import-vouchers-using-csv
|
|
67
67
|
*/
|
|
68
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>;
|
|
69
77
|
}
|
|
70
78
|
export {};
|
|
@@ -3,6 +3,7 @@ export interface ListCategories {
|
|
|
3
3
|
data_ref: 'data';
|
|
4
4
|
data: CategoryObject[];
|
|
5
5
|
total: number;
|
|
6
|
+
has_more: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare type CategoryObject = ResponseCreateCategory & {
|
|
8
9
|
updated_at?: string;
|
|
@@ -22,3 +23,15 @@ export declare type ResponseUpdateCategory = ResponseCreateCategory & {
|
|
|
22
23
|
updated_at: string;
|
|
23
24
|
};
|
|
24
25
|
export declare type UpdateCategoryRequest = CreateCategory;
|
|
26
|
+
export declare type Category = {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
hierarchy: number;
|
|
30
|
+
created_at: string;
|
|
31
|
+
updated_at?: string;
|
|
32
|
+
object: 'category';
|
|
33
|
+
};
|
|
34
|
+
export declare type CategoriesListRequestQuery = {
|
|
35
|
+
limit?: number;
|
|
36
|
+
starting_after_id?: number;
|
|
37
|
+
};
|
package/dist/types/Exports.d.ts
CHANGED
|
@@ -28,3 +28,122 @@ export interface ExportsCreateResponse {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
export declare type ExportsGetResponse = ExportsCreateResponse;
|
|
31
|
+
export interface ExportsListRequestQuery {
|
|
32
|
+
limit?: number;
|
|
33
|
+
order?: 'created_at' | '-created_at' | 'status' | '-status';
|
|
34
|
+
page?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ExportsListResponseBody {
|
|
37
|
+
object: 'list';
|
|
38
|
+
data_ref: 'exports';
|
|
39
|
+
exports: Export[];
|
|
40
|
+
total: number;
|
|
41
|
+
}
|
|
42
|
+
export interface ExportBase {
|
|
43
|
+
id: string;
|
|
44
|
+
object: 'export';
|
|
45
|
+
created_at: string;
|
|
46
|
+
status: 'SCHEDULED' | 'IN_PROGRESS' | 'DONE' | 'ERROR';
|
|
47
|
+
channel?: string;
|
|
48
|
+
result: {
|
|
49
|
+
url: string;
|
|
50
|
+
} | null;
|
|
51
|
+
user_id: string | null;
|
|
52
|
+
}
|
|
53
|
+
export declare type Export = ExportBase & (ExportVoucher | ExportRedemption | ExportCustomer | ExportPublication | ExportOrder | ExportPointsExpiration | ExportVoucherTransactionsExpiration);
|
|
54
|
+
export declare type FieldConditions = {
|
|
55
|
+
conditions?: Partial<Record<FiltersCondition, unknown>>;
|
|
56
|
+
};
|
|
57
|
+
export interface ExportVoucher {
|
|
58
|
+
exported_object: 'voucher';
|
|
59
|
+
parameters: {
|
|
60
|
+
order?: ExportVoucherOrder;
|
|
61
|
+
fields?: ExportVoucherFields[];
|
|
62
|
+
filters?: ExportVoucherFilters;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export declare type ExportVoucherFilters = {
|
|
66
|
+
junction?: Junction;
|
|
67
|
+
} & Partial<Record<ExportVoucherFields, FieldConditions>>;
|
|
68
|
+
export interface ExportRedemption {
|
|
69
|
+
exported_object: 'redemption';
|
|
70
|
+
parameters: {
|
|
71
|
+
order?: ExportRedemptionOrder;
|
|
72
|
+
fields?: ExportRedemptionFields[];
|
|
73
|
+
filters?: ExportRedemptionFilters;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export declare type ExportRedemptionFilters = {
|
|
77
|
+
junction?: Junction;
|
|
78
|
+
} & Partial<Record<ExportRedemptionFields, FieldConditions>>;
|
|
79
|
+
export interface ExportCustomer {
|
|
80
|
+
exported_object: 'customer';
|
|
81
|
+
parameters: {
|
|
82
|
+
order?: ExportCustomerOrder;
|
|
83
|
+
fields?: ExportCustomerFields[];
|
|
84
|
+
filters?: ExportCustomerFilters;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export declare type ExportCustomerFilters = {
|
|
88
|
+
junction?: Junction;
|
|
89
|
+
} & Partial<Record<ExportCustomerFields, FieldConditions>>;
|
|
90
|
+
export interface ExportPublication {
|
|
91
|
+
exported_object: 'publication';
|
|
92
|
+
parameters: {
|
|
93
|
+
order?: ExportPublicationOrder;
|
|
94
|
+
fields?: ExportPublicationFields[];
|
|
95
|
+
filters?: ExportPublicationFilters;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export declare type ExportPublicationFilters = {
|
|
99
|
+
junction?: Junction;
|
|
100
|
+
} & Partial<Record<ExportPublicationFields, FieldConditions>>;
|
|
101
|
+
export interface ExportOrder {
|
|
102
|
+
exported_object: 'order';
|
|
103
|
+
parameters: {
|
|
104
|
+
order?: ExportOrderOrder;
|
|
105
|
+
fields?: ExportOrderFields[];
|
|
106
|
+
filters?: ExportOrderFilters;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export declare type ExportOrderFilters = {
|
|
110
|
+
junction?: Junction;
|
|
111
|
+
} & Partial<Record<ExportOrderFields, FieldConditions>>;
|
|
112
|
+
export interface ExportPointsExpiration {
|
|
113
|
+
exported_object: 'points_expiration';
|
|
114
|
+
parameters: {
|
|
115
|
+
order?: ExportPointsExpirationOrder;
|
|
116
|
+
fields?: ExportPointsExpirationFields[];
|
|
117
|
+
filters?: ExportPointsExpirationFilters;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export declare type ExportPointsExpirationFilters = {
|
|
121
|
+
junction?: Junction;
|
|
122
|
+
} & Partial<Record<ExportPointsExpirationFields, FieldConditions>>;
|
|
123
|
+
export interface ExportVoucherTransactionsExpiration {
|
|
124
|
+
exported_object: 'voucher_transactions';
|
|
125
|
+
parameters: {
|
|
126
|
+
order?: ExportVoucherTransactionsOrder;
|
|
127
|
+
fields?: ExportVoucherTransactionsFields[];
|
|
128
|
+
filters?: ExportVoucherTransactionsFilters;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
export declare type ExportVoucherTransactionsFilters = {
|
|
132
|
+
junction?: Junction;
|
|
133
|
+
} & Partial<Record<ExportVoucherTransactionsFields, FieldConditions>>;
|
|
134
|
+
export declare type Junction = 'and' | 'AND' | 'or' | 'OR';
|
|
135
|
+
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';
|
|
136
|
+
export declare type ExportCustomerFields = 'name' | 'id' | 'description' | 'email' | 'source_id' | 'created_at' | 'address_city' | 'address_state' | 'address_line_1' | 'address_line_2' | 'address_country' | 'address_postal_code' | 'redemptions_total_redeemed' | 'redemptions_total_failed' | 'redemptions_total_succeeded' | 'redemptions_total_rolled_back' | 'redemptions_total_rollback_failed' | 'redemptions_total_rollback_succeeded' | 'orders_total_amount' | 'orders_total_count' | 'orders_average_amount' | 'orders_last_order_amount' | 'orders_last_order_date' | 'loyalty_points' | 'loyalty_referred_customers' | 'updated_at' | 'phone' | 'birthday' | 'metadata' | 'birthdate';
|
|
137
|
+
export declare type ExportCustomerOrder = ExportCustomerFields | '-name' | '-id' | '-description' | '-email' | '-source_id' | '-created_at' | '-address_city' | '-address_state' | '-address_line_1' | '-address_line_2' | '-address_country' | '-address_postal_code' | '-redemptions_total_redeemed' | '-redemptions_total_failed' | '-redemptions_total_succeeded' | '-redemptions_total_rolled_back' | '-redemptions_total_rollback_failed' | '-redemptions_total_rollback_succeeded' | '-orders_total_amount' | '-orders_total_count' | '-orders_average_amount' | '-orders_last_order_amount' | '-orders_last_order_date' | '-loyalty_points' | '-loyalty_referred_customers' | '-updated_at' | '-phone' | '-birthday' | '-metadata' | '-birthdate';
|
|
138
|
+
export declare type ExportPublicationFields = 'voucher_code' | 'customer_id' | 'customer_source_id' | 'date' | 'channel' | 'campaign' | 'is_winner' | 'metadata';
|
|
139
|
+
export declare type ExportPublicationOrder = ExportPublicationFields | '-voucher_code' | '-customer_id' | '-customer_source_id' | '-date' | '-channel' | '-campaign' | '-is_winner' | '-metadata';
|
|
140
|
+
export declare type ExportRedemptionFields = 'id' | 'object' | 'date' | 'voucher_code' | 'campaign' | 'promotion_tier_id' | 'customer_id' | 'customer_source_id' | 'customer_name' | 'tracking_id' | 'order_amount' | 'gift_amount' | 'loyalty_points' | 'result' | 'failure_code' | 'failure_message' | 'metadata';
|
|
141
|
+
export declare type ExportRedemptionOrder = ExportRedemptionFields | '-id' | '-object' | '-date' | '-voucher_code' | '-campaign' | '-promotion_tier_id' | '-customer_id' | '-customer_source_id' | '-customer_name' | '-tracking_id' | '-order_amount' | '-gift_amount' | '-loyalty_points' | '-result' | '-failure_code' | '-failure_message' | '-metadata';
|
|
142
|
+
export declare type ExportVoucherFields = 'code' | 'voucher_type' | 'value' | 'discount_type' | 'campaign' | 'category' | 'start_date' | 'expiration_date' | 'gift_balance' | 'loyalty_balance' | 'redemption_quantity' | 'redemption_count' | 'active' | 'qr_code' | 'bar_code' | 'metadata' | 'id' | 'is_referral_code' | 'created_at' | 'updated_at' | 'validity_timeframe_interval' | 'validity_timeframe_duration' | 'validity_day_of_week' | 'discount_amount_limit' | 'campaign_id' | 'additional_info' | 'customer_id' | 'discount_unit_type' | 'discount_unit_effect' | 'customer_source_id';
|
|
143
|
+
export declare type ExportVoucherOrder = ExportVoucherFields | '-code' | '-voucher_type' | '-value' | '-discount_type' | '-campaign' | '-category' | '-start_date' | '-expiration_date' | '-gift_balance' | '-loyalty_balance' | '-redemption_quantity' | '-redemption_count' | '-active' | '-qr_code' | '-bar_code' | '-metadata' | '-id' | '-is_referral_code' | '-created_at' | '-updated_at' | '-validity_timeframe_interval' | '-validity_timeframe_duration' | '-validity_day_of_week' | '-discount_amount_limit' | '-campaign_id' | '-additional_info' | '-customer_id' | '-discount_unit_type' | '-discount_unit_effect' | '-customer_source_id';
|
|
144
|
+
export declare type ExportOrderFields = 'id' | 'source_id' | 'created_at' | 'updated_at' | 'status' | 'amount' | 'discount_amount' | 'items_discount_amount' | 'total_discount_amount' | 'total_amount' | 'customer_id' | 'referrer_id' | 'metadata';
|
|
145
|
+
export declare type ExportOrderOrder = ExportOrderFields | '-id' | '-source_id' | '-created_at' | '-updated_at' | '-status' | '-amount' | '-discount_amount' | '-items_discount_amount' | '-total_discount_amount' | '-total_amount' | '-customer_id' | '-referrer_id' | '-metadata';
|
|
146
|
+
export declare type ExportPointsExpirationFields = 'id' | 'campaign_id' | 'voucher_id' | 'points' | 'status' | 'expires_at';
|
|
147
|
+
export declare type ExportPointsExpirationOrder = ExportPointsExpirationFields | '-id' | '-campaign_id' | '-voucher_id' | '-points' | '-status' | '-expires_at';
|
|
148
|
+
export declare type ExportVoucherTransactionsFields = 'id' | 'campaign_id' | 'voucher_id' | 'type' | 'source_id' | 'reason' | 'source' | 'balance' | 'amount' | 'related_transaction_id' | 'created_at' | 'details';
|
|
149
|
+
export declare type ExportVoucherTransactionsOrder = ExportVoucherTransactionsFields | '-id' | '-campaign_id' | '-voucher_id' | '-type' | '-source_id' | '-reason' | '-source' | '-balance' | '-amount' | '-related_transaction_id' | '-created_at' | '-details';
|