@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,106 @@
|
|
|
1
|
+
import { RewardRedemptionParams } from './Rewards.js';
|
|
2
|
+
import { GiftRedemptionParams } from './Gift.js';
|
|
3
|
+
import { OrdersCreateResponse } from './Orders.js';
|
|
4
|
+
import { ApplicableToResultList } from './ApplicableTo.js';
|
|
5
|
+
import { DiscountVouchersTypes, DiscountVouchersEffectTypes, DiscountUnitVouchersEffectTypes } from './DiscountVoucher.js';
|
|
6
|
+
import { SimpleSku, SimpleProduct } from './Products.js';
|
|
7
|
+
import { LoyaltyPointsTransfer } from './Loyalties.js';
|
|
8
|
+
import { ValidationError } from './ValidationError.js';
|
|
9
|
+
import { Category } from './Categories.js';
|
|
10
|
+
import './Customers.js';
|
|
11
|
+
import './ValidationRules.js';
|
|
12
|
+
import './Vouchers.js';
|
|
13
|
+
|
|
14
|
+
type ExpandOption = 'order' | 'redeemable' | 'redemption';
|
|
15
|
+
interface StackableOptions {
|
|
16
|
+
expand: ExpandOption[];
|
|
17
|
+
}
|
|
18
|
+
type StackableRedeemableObject = 'promotion_stack' | 'promotion_tier' | 'voucher';
|
|
19
|
+
interface StackableRedeemableParams {
|
|
20
|
+
object: StackableRedeemableObject;
|
|
21
|
+
id: string;
|
|
22
|
+
reward?: RewardRedemptionParams;
|
|
23
|
+
gift?: GiftRedemptionParams;
|
|
24
|
+
}
|
|
25
|
+
type StackableRedeemableResponseStatus = 'APPLICABLE' | 'INAPPLICABLE' | 'SKIPPED';
|
|
26
|
+
interface StackableRedeemableResultDiscountUnit {
|
|
27
|
+
effect: DiscountUnitVouchersEffectTypes;
|
|
28
|
+
unit_off: number;
|
|
29
|
+
unit_type: string;
|
|
30
|
+
sku?: SimpleSku;
|
|
31
|
+
product?: SimpleProduct;
|
|
32
|
+
}
|
|
33
|
+
interface StackableRedeemableResultDiscount {
|
|
34
|
+
type: DiscountVouchersTypes;
|
|
35
|
+
effect: DiscountVouchersEffectTypes;
|
|
36
|
+
amount_off?: number;
|
|
37
|
+
amount_off_formula?: string;
|
|
38
|
+
percent_off?: number;
|
|
39
|
+
percent_off_formula?: string;
|
|
40
|
+
amount_limit?: number;
|
|
41
|
+
fixed_amount?: number;
|
|
42
|
+
fixed_amount_formula?: string;
|
|
43
|
+
unit_off?: number;
|
|
44
|
+
unit_off_formula?: string;
|
|
45
|
+
unit_type?: string;
|
|
46
|
+
sku?: SimpleSku;
|
|
47
|
+
product?: SimpleProduct;
|
|
48
|
+
units?: StackableRedeemableResultDiscountUnit[];
|
|
49
|
+
}
|
|
50
|
+
interface StackableRedeemableResultGift {
|
|
51
|
+
credits?: number;
|
|
52
|
+
}
|
|
53
|
+
interface StackableRedeemableResultLoyaltyCard {
|
|
54
|
+
points?: number;
|
|
55
|
+
transfers?: LoyaltyPointsTransfer[];
|
|
56
|
+
}
|
|
57
|
+
interface StackableRedeemableResultResponse {
|
|
58
|
+
discount?: StackableRedeemableResultDiscount;
|
|
59
|
+
gift?: StackableRedeemableResultGift;
|
|
60
|
+
loyalty_card?: StackableRedeemableResultLoyaltyCard;
|
|
61
|
+
error?: ValidationError;
|
|
62
|
+
details?: {
|
|
63
|
+
key?: string;
|
|
64
|
+
message?: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
interface StackableRedeemableResponse {
|
|
68
|
+
status: StackableRedeemableResponseStatus;
|
|
69
|
+
id: string;
|
|
70
|
+
object: StackableRedeemableObject;
|
|
71
|
+
order?: OrdersCreateResponse;
|
|
72
|
+
applicable_to?: ApplicableToResultList;
|
|
73
|
+
inapplicable_to?: ApplicableToResultList;
|
|
74
|
+
result?: StackableRedeemableResultResponse;
|
|
75
|
+
metadata?: Record<string, any>;
|
|
76
|
+
categories?: Category[];
|
|
77
|
+
}
|
|
78
|
+
type StackableRedeemableInapplicableResponse = {
|
|
79
|
+
status: 'INAPPLICABLE';
|
|
80
|
+
id: string;
|
|
81
|
+
object: 'voucher' | 'promotion_tier';
|
|
82
|
+
result: {
|
|
83
|
+
error?: ValidationError;
|
|
84
|
+
details?: {
|
|
85
|
+
key?: string;
|
|
86
|
+
message?: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
metadata?: Record<string, unknown>;
|
|
90
|
+
categories?: Category[];
|
|
91
|
+
};
|
|
92
|
+
type StackableRedeemableSkippedResponse = {
|
|
93
|
+
status: 'SKIPPED';
|
|
94
|
+
id: string;
|
|
95
|
+
object: 'voucher' | 'promotion_tier';
|
|
96
|
+
result: {
|
|
97
|
+
details?: {
|
|
98
|
+
key?: string;
|
|
99
|
+
message?: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
metadata?: Record<string, unknown>;
|
|
103
|
+
categories?: Category[];
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type { StackableOptions, StackableRedeemableInapplicableResponse, StackableRedeemableObject, StackableRedeemableParams, StackableRedeemableResponse, StackableRedeemableResponseStatus, StackableRedeemableResultDiscount, StackableRedeemableResultDiscountUnit, StackableRedeemableResultGift, StackableRedeemableResultLoyaltyCard, StackableRedeemableResultResponse, StackableRedeemableSkippedResponse };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type ValidationSessionType = 'LOCK';
|
|
2
|
+
type ValidationSessionTTLUnit = 'DAYS' | 'HOURS' | 'MICROSECONDS' | 'MILLISECONDS' | 'MINUTES' | 'NANOSECONDS' | 'SECONDS';
|
|
3
|
+
interface ValidationSessionParams {
|
|
4
|
+
key?: string;
|
|
5
|
+
type?: ValidationSessionType;
|
|
6
|
+
ttl?: number;
|
|
7
|
+
ttl_unit?: ValidationSessionTTLUnit;
|
|
8
|
+
}
|
|
9
|
+
interface ValidationSessionResponse {
|
|
10
|
+
key: string;
|
|
11
|
+
type: ValidationSessionType;
|
|
12
|
+
ttl: number;
|
|
13
|
+
ttl_unit: ValidationSessionTTLUnit;
|
|
14
|
+
}
|
|
15
|
+
interface ValidationSessionReleaseParams {
|
|
16
|
+
key: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type { ValidationSessionParams, ValidationSessionReleaseParams, ValidationSessionResponse, ValidationSessionTTLUnit, ValidationSessionType };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ApplicableToResultList } from './ApplicableTo.js';
|
|
2
|
+
|
|
3
|
+
interface ValidationRulesCreate {
|
|
4
|
+
name: string;
|
|
5
|
+
error?: {
|
|
6
|
+
message?: string;
|
|
7
|
+
};
|
|
8
|
+
rules?: {
|
|
9
|
+
logic?: string;
|
|
10
|
+
[rule: string]: any;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface ValidationRulesCreateResponse {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
error?: {
|
|
17
|
+
message?: string;
|
|
18
|
+
};
|
|
19
|
+
rules?: {
|
|
20
|
+
logic?: string;
|
|
21
|
+
[rule: string]: any;
|
|
22
|
+
};
|
|
23
|
+
created_at: string;
|
|
24
|
+
updated_at?: string;
|
|
25
|
+
object: 'validation_rules';
|
|
26
|
+
}
|
|
27
|
+
interface ValidationRulesValidateResponse {
|
|
28
|
+
valid: boolean;
|
|
29
|
+
rule_id: string;
|
|
30
|
+
applicable_to: ApplicableToResultList;
|
|
31
|
+
}
|
|
32
|
+
type ValidationRulesGetResponse = ValidationRulesCreateResponse & {
|
|
33
|
+
assignments_count?: string;
|
|
34
|
+
};
|
|
35
|
+
type ValidationRulesUpdate = Partial<ValidationRulesCreate> & {
|
|
36
|
+
id: string;
|
|
37
|
+
};
|
|
38
|
+
type ValidationRulesUpdateResponse = ValidationRulesCreateResponse;
|
|
39
|
+
interface ValidationRulesCreateAssignment {
|
|
40
|
+
voucher?: string;
|
|
41
|
+
campaign?: string;
|
|
42
|
+
promotion_tier?: string;
|
|
43
|
+
}
|
|
44
|
+
interface ValidationRulesCreateAssignmentResponse {
|
|
45
|
+
id: string;
|
|
46
|
+
rule_id: string;
|
|
47
|
+
related_object_id?: string;
|
|
48
|
+
related_object_type?: string;
|
|
49
|
+
created_at?: string;
|
|
50
|
+
updated_at: string;
|
|
51
|
+
object: 'validation_rules_assignment';
|
|
52
|
+
}
|
|
53
|
+
interface ValidationRulesListParams {
|
|
54
|
+
limit?: number;
|
|
55
|
+
page?: number;
|
|
56
|
+
}
|
|
57
|
+
interface ValidationRulesListResponse {
|
|
58
|
+
object: 'list';
|
|
59
|
+
total: number;
|
|
60
|
+
data_ref: 'data';
|
|
61
|
+
data: ValidationRulesGetResponse[];
|
|
62
|
+
}
|
|
63
|
+
interface ValidationRulesListAssignmentsParams {
|
|
64
|
+
limit?: number;
|
|
65
|
+
page?: number;
|
|
66
|
+
}
|
|
67
|
+
interface ValidationRulesListAssignmentsResponse {
|
|
68
|
+
object: 'list';
|
|
69
|
+
total: number;
|
|
70
|
+
data_ref: 'data';
|
|
71
|
+
data: ValidationRulesCreateAssignmentResponse[];
|
|
72
|
+
}
|
|
73
|
+
type ValidationRulesAssignmentsList = ValidationRulesListResponse;
|
|
74
|
+
interface ValidationRulesAssignment {
|
|
75
|
+
id: string;
|
|
76
|
+
rule_id: string;
|
|
77
|
+
related_object_id: string;
|
|
78
|
+
related_object_type: string;
|
|
79
|
+
created_at: string;
|
|
80
|
+
object: 'validation_rules_assignment';
|
|
81
|
+
}
|
|
82
|
+
interface ValidationRulesListRulesAssignmentsRequestQuery {
|
|
83
|
+
related_object_id?: string;
|
|
84
|
+
rule?: string;
|
|
85
|
+
page?: number;
|
|
86
|
+
limit?: number;
|
|
87
|
+
order?: 'created_at' | '-created_at';
|
|
88
|
+
}
|
|
89
|
+
interface ValidationRulesListRulesAssignmentsResponseBody {
|
|
90
|
+
object: 'list';
|
|
91
|
+
data_ref: 'data';
|
|
92
|
+
total: number;
|
|
93
|
+
data: ValidationRulesAssignment[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type { ValidationRulesAssignment, ValidationRulesAssignmentsList, ValidationRulesCreate, ValidationRulesCreateAssignment, ValidationRulesCreateAssignmentResponse, ValidationRulesCreateResponse, ValidationRulesGetResponse, ValidationRulesListAssignmentsParams, ValidationRulesListAssignmentsResponse, ValidationRulesListParams, ValidationRulesListResponse, ValidationRulesListRulesAssignmentsRequestQuery, ValidationRulesListRulesAssignmentsResponseBody, ValidationRulesUpdate, ValidationRulesUpdateResponse, ValidationRulesValidateResponse };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { DiscountAmount, DiscountUnit, DiscountPercent, DiscountFixed } from './DiscountVoucher.js';
|
|
2
|
+
import { CustomersCreateBody } from './Customers.js';
|
|
3
|
+
import { StackableOptions, StackableRedeemableParams, StackableRedeemableResponse, StackableRedeemableSkippedResponse, StackableRedeemableInapplicableResponse } from './Stackable.js';
|
|
4
|
+
import { ValidationSessionParams, ValidationSessionResponse } from './ValidateSession.js';
|
|
5
|
+
import { ApplicableToResultList } from './ApplicableTo.js';
|
|
6
|
+
import { ValidationError } from './ValidationError.js';
|
|
7
|
+
import { OrdersCreate, OrdersCreateResponse, OrdersItem } from './Orders.js';
|
|
8
|
+
import { PromotionsValidateParams } from './Promotions.js';
|
|
9
|
+
import './Rewards.js';
|
|
10
|
+
import './Gift.js';
|
|
11
|
+
import './Products.js';
|
|
12
|
+
import './Loyalties.js';
|
|
13
|
+
import './ValidationRules.js';
|
|
14
|
+
import './Vouchers.js';
|
|
15
|
+
import './Categories.js';
|
|
16
|
+
import './PromotionTiers.js';
|
|
17
|
+
|
|
18
|
+
interface ValidationsValidateVoucherParams {
|
|
19
|
+
customer?: {
|
|
20
|
+
id?: string;
|
|
21
|
+
source_id?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
email?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
metadata?: Record<string, any>;
|
|
26
|
+
};
|
|
27
|
+
order?: {
|
|
28
|
+
id?: string;
|
|
29
|
+
source_id?: string;
|
|
30
|
+
amount?: number;
|
|
31
|
+
items?: OrdersItem[];
|
|
32
|
+
metadata?: Record<string, any>;
|
|
33
|
+
};
|
|
34
|
+
gift?: {
|
|
35
|
+
credits: number;
|
|
36
|
+
};
|
|
37
|
+
reward?: {
|
|
38
|
+
id: string;
|
|
39
|
+
};
|
|
40
|
+
session?: ValidationSessionParams;
|
|
41
|
+
}
|
|
42
|
+
interface ValidationsValidateVoucherResponse {
|
|
43
|
+
applicable_to?: ApplicableToResultList;
|
|
44
|
+
inapplicable_to?: ApplicableToResultList;
|
|
45
|
+
campaign?: string;
|
|
46
|
+
campaign_id?: string;
|
|
47
|
+
metadata?: Record<string, any>;
|
|
48
|
+
code?: string;
|
|
49
|
+
valid?: boolean;
|
|
50
|
+
discount?: DiscountAmount | DiscountUnit | DiscountPercent | DiscountFixed;
|
|
51
|
+
gift?: {
|
|
52
|
+
amount: number;
|
|
53
|
+
balance: number;
|
|
54
|
+
};
|
|
55
|
+
loyalty?: {
|
|
56
|
+
points_cost: number;
|
|
57
|
+
};
|
|
58
|
+
order?: {
|
|
59
|
+
amount: number;
|
|
60
|
+
discount_amount: number;
|
|
61
|
+
total_discount_amount: number;
|
|
62
|
+
total_amount: number;
|
|
63
|
+
applied_discount_amount?: number;
|
|
64
|
+
total_applied_discount_amount?: number;
|
|
65
|
+
items?: OrdersItem[];
|
|
66
|
+
initial_amount?: number;
|
|
67
|
+
items_discount_amount?: number;
|
|
68
|
+
items_applied_discount_amount?: number;
|
|
69
|
+
metadata?: Record<string, any>;
|
|
70
|
+
};
|
|
71
|
+
session?: ValidationSessionParams;
|
|
72
|
+
start_date?: string;
|
|
73
|
+
expiration_date?: string;
|
|
74
|
+
tracking_id: string;
|
|
75
|
+
error?: ValidationError;
|
|
76
|
+
}
|
|
77
|
+
interface ValidationsValidateStackableParams {
|
|
78
|
+
options?: StackableOptions;
|
|
79
|
+
redeemables: StackableRedeemableParams[];
|
|
80
|
+
session?: ValidationSessionParams;
|
|
81
|
+
order?: OrdersCreate;
|
|
82
|
+
customer?: CustomersCreateBody;
|
|
83
|
+
metadata?: Record<string, any>;
|
|
84
|
+
}
|
|
85
|
+
interface ValidationValidateStackableResponse {
|
|
86
|
+
valid: boolean;
|
|
87
|
+
tracking_id?: string;
|
|
88
|
+
session?: ValidationSessionResponse;
|
|
89
|
+
order?: OrdersCreateResponse;
|
|
90
|
+
redeemables?: StackableRedeemableResponse[];
|
|
91
|
+
skipped_redeemables?: StackableRedeemableSkippedResponse[];
|
|
92
|
+
inapplicable_redeemables?: StackableRedeemableInapplicableResponse[];
|
|
93
|
+
stacking_rules: ValidationsStackingRules;
|
|
94
|
+
}
|
|
95
|
+
type ValidationsStackingRules = {
|
|
96
|
+
redeemables_limit: number;
|
|
97
|
+
applicable_redeemables_limit: number;
|
|
98
|
+
applicable_redeemables_per_category_limit?: number;
|
|
99
|
+
applicable_exclusive_redeemables_limit: number;
|
|
100
|
+
applicable_exclusive_redeemables_per_category_limit?: number;
|
|
101
|
+
exclusive_categories: string[];
|
|
102
|
+
joint_categories: string[];
|
|
103
|
+
redeemables_application_mode: 'ALL' | 'PARTIAL';
|
|
104
|
+
redeemables_sorting_rule: 'CATEGORY_HIERARCHY' | 'REQUESTED_ORDER';
|
|
105
|
+
};
|
|
106
|
+
type ValidationsValidateCode = PromotionsValidateParams;
|
|
107
|
+
type ValidationsValidateContext = ValidationsValidateVoucherParams;
|
|
108
|
+
|
|
109
|
+
export type { ValidationValidateStackableResponse, ValidationsStackingRules, ValidationsValidateCode, ValidationsValidateContext, ValidationsValidateStackableParams, ValidationsValidateVoucherParams, ValidationsValidateVoucherResponse };
|