@voucherify/sdk 2.5.0 → 2.7.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 +111 -0
- package/README.md +67 -2
- package/dist/Categories.d.ts +1 -1
- package/dist/ClientSide.d.ts +5 -0
- package/dist/Loyalties.d.ts +9 -5
- package/dist/Promotions.d.ts +3 -1
- package/dist/PromotionsStacks.d.ts +30 -0
- package/dist/Qualifications.d.ts +10 -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/index.d.ts +1 -0
- package/dist/types/ApplicableTo.d.ts +15 -0
- package/dist/types/Categories.d.ts +5 -0
- package/dist/types/Customers.d.ts +88 -3
- package/dist/types/DiscountVoucher.d.ts +44 -2
- package/dist/types/Loyalties.d.ts +61 -118
- package/dist/types/Orders.d.ts +110 -1
- package/dist/types/PromotionsStacks.d.ts +71 -0
- package/dist/types/Qualifications.d.ts +86 -0
- package/dist/types/Rewards.d.ts +51 -7
- package/dist/types/ValidationRules.d.ts +22 -0
- package/dist/types/Vouchers.d.ts +138 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/voucherifysdk.esm.js +166 -20
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +166 -20
- package/dist/voucherifysdk.umd.development.js.map +1 -1
- package/dist/voucherifysdk.umd.production.min.js +1 -1
- package/dist/voucherifysdk.umd.production.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,9 +5,9 @@ export declare enum DiscountVouchersTypesEnum {
|
|
|
5
5
|
UNIT = "UNIT",
|
|
6
6
|
FIXED = "FIXED"
|
|
7
7
|
}
|
|
8
|
-
export declare type DiscountVouchersEffectTypes = 'ADD_MISSING_ITEMS' | 'ADD_NEW_ITEMS' | 'ADD_MANY_ITEMS' | 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS' | 'APPLY_TO_ITEMS_PROPORTIONALLY' | 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY';
|
|
8
|
+
export declare type DiscountVouchersEffectTypes = 'ADD_MISSING_ITEMS' | 'ADD_NEW_ITEMS' | 'ADD_MANY_ITEMS' | 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS' | 'APPLY_TO_ITEMS_PROPORTIONALLY' | 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY' | 'APPLY_TO_ITEMS_BY_QUANTITY';
|
|
9
9
|
export declare type DiscountUnitVouchersEffectTypes = 'ADD_MISSING_ITEMS' | 'ADD_NEW_ITEMS' | 'ADD_MANY_ITEMS';
|
|
10
|
-
export declare type DiscountAmountVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS' | 'APPLY_TO_ITEMS_PROPORTIONALLY' | 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY';
|
|
10
|
+
export declare type DiscountAmountVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS' | 'APPLY_TO_ITEMS_PROPORTIONALLY' | 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY' | 'APPLY_TO_ITEMS_BY_QUANTITY';
|
|
11
11
|
export declare type DiscountPercentVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS';
|
|
12
12
|
export declare type DiscountFixedVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS';
|
|
13
13
|
interface SimpleSkuDiscountUnit {
|
|
@@ -48,4 +48,46 @@ export interface DiscountFixed {
|
|
|
48
48
|
fixed_amount_formula?: string;
|
|
49
49
|
effect?: DiscountFixedVouchersEffectTypes;
|
|
50
50
|
}
|
|
51
|
+
export declare type Discount = DiscountAmount_ | DiscountUnit_ | DiscountUnitMultiple_ | DiscountPercent_ | DiscountFixed_;
|
|
52
|
+
export declare type DiscountAmount_ = {
|
|
53
|
+
type: 'AMOUNT';
|
|
54
|
+
amount_off?: number;
|
|
55
|
+
amount_off_formula?: string;
|
|
56
|
+
aggregated_amount_limit?: number;
|
|
57
|
+
effect?: DiscountAmountVouchersEffectTypes;
|
|
58
|
+
is_dynamic?: boolean;
|
|
59
|
+
};
|
|
60
|
+
export declare type DiscountUnit_ = {
|
|
61
|
+
type: 'UNIT';
|
|
62
|
+
} & DiscountUnitBase_;
|
|
63
|
+
export declare type DiscountUnitBase_ = {
|
|
64
|
+
unit_off?: number;
|
|
65
|
+
unit_off_formula?: string;
|
|
66
|
+
unit_type: string;
|
|
67
|
+
product?: SimpleProductDiscountUnit;
|
|
68
|
+
sku?: SimpleSkuDiscountUnit;
|
|
69
|
+
effect?: 'ADD_MISSING_ITEMS' | 'ADD_NEW_ITEMS';
|
|
70
|
+
is_dynamic?: boolean;
|
|
71
|
+
};
|
|
72
|
+
export declare type DiscountUnitMultiple_ = {
|
|
73
|
+
type: 'UNIT';
|
|
74
|
+
effect: 'ADD_MANY_ITEMS';
|
|
75
|
+
units: DiscountUnitBase_[];
|
|
76
|
+
};
|
|
77
|
+
export declare type DiscountPercent_ = {
|
|
78
|
+
type: 'PERCENT';
|
|
79
|
+
percent_off?: number;
|
|
80
|
+
percent_off_formula?: string;
|
|
81
|
+
amount_limit?: number;
|
|
82
|
+
aggregated_amount_limit?: number;
|
|
83
|
+
effect?: DiscountPercentVouchersEffectTypes;
|
|
84
|
+
is_dynamic?: boolean;
|
|
85
|
+
};
|
|
86
|
+
export declare type DiscountFixed_ = {
|
|
87
|
+
type: 'FIXED';
|
|
88
|
+
fixed_amount?: number;
|
|
89
|
+
fixed_amount_formula?: string;
|
|
90
|
+
effect?: DiscountFixedVouchersEffectTypes;
|
|
91
|
+
is_dynamic?: boolean;
|
|
92
|
+
};
|
|
51
93
|
export {};
|
|
@@ -2,7 +2,7 @@ import { OrdersCreateResponse, OrdersItem } from './Orders';
|
|
|
2
2
|
import { ProductsCreateResponse, ProductsCreateSkuResponse } from './Products';
|
|
3
3
|
import { SimpleCustomer } from './Customers';
|
|
4
4
|
import { ValidationRulesCreateAssignmentResponse } from './ValidationRules';
|
|
5
|
-
import { VouchersResponse } from './Vouchers';
|
|
5
|
+
import { VouchersExportTransactionsRequestBody, VouchersExportTransactionsResponseBody, VouchersResponse } from './Vouchers';
|
|
6
6
|
import { Reward, RewardAssignment } from './Rewards';
|
|
7
7
|
import { Category } from './Categories';
|
|
8
8
|
interface LoyaltiesVoucher {
|
|
@@ -559,31 +559,7 @@ export interface LoyaltiesListCardTransactionsResponseBody {
|
|
|
559
559
|
data: LoyaltyCardTransaction[];
|
|
560
560
|
has_more: boolean;
|
|
561
561
|
}
|
|
562
|
-
export
|
|
563
|
-
order?: 'created_at' | '-created_at';
|
|
564
|
-
fields?: LoyaltyCardTransactionsFields[];
|
|
565
|
-
}
|
|
566
|
-
export interface LoyaltiesExportCardTransactionsResponseBody {
|
|
567
|
-
id: string;
|
|
568
|
-
object: 'export';
|
|
569
|
-
created_at: string;
|
|
570
|
-
status: 'SCHEDULED';
|
|
571
|
-
channel: string;
|
|
572
|
-
exported_object: 'voucher_transactions';
|
|
573
|
-
parameters: {
|
|
574
|
-
order?: string;
|
|
575
|
-
fields?: LoyaltyCardTransactionsFields[];
|
|
576
|
-
filters: {
|
|
577
|
-
voucher_id: {
|
|
578
|
-
conditions: {
|
|
579
|
-
$in: [string];
|
|
580
|
-
};
|
|
581
|
-
};
|
|
582
|
-
};
|
|
583
|
-
};
|
|
584
|
-
result: null;
|
|
585
|
-
user_id: null | string;
|
|
586
|
-
}
|
|
562
|
+
export declare type LoyaltiesExportCardTransactionsRequestBody = VouchersExportTransactionsRequestBody;
|
|
587
563
|
export interface LoyaltiesAddOrRemoveCardBalanceRequestBody {
|
|
588
564
|
points: number;
|
|
589
565
|
expiration_date?: string;
|
|
@@ -608,7 +584,6 @@ export declare type LoyaltiesCreateTiersRequestBody = (LoyaltyTierBase & {
|
|
|
608
584
|
metadata?: Record<string, unknown>;
|
|
609
585
|
})[];
|
|
610
586
|
export declare type LoyaltiesCreateTiersResponseBody = LoyaltyTier[];
|
|
611
|
-
export declare type LoyaltiesGetRewardAssignmentResponseBody = RewardAssignment;
|
|
612
587
|
export declare type LoyaltiesGetRewardDetailsResponseBody = Reward;
|
|
613
588
|
export interface LoyaltiesListTiersRequestQuery {
|
|
614
589
|
limit?: number;
|
|
@@ -679,31 +654,7 @@ export interface LoyaltiesListCardTransactionsResponseBody {
|
|
|
679
654
|
data: LoyaltyCardTransaction[];
|
|
680
655
|
has_more: boolean;
|
|
681
656
|
}
|
|
682
|
-
export
|
|
683
|
-
order?: 'created_at' | '-created_at';
|
|
684
|
-
fields?: LoyaltyCardTransactionsFields[];
|
|
685
|
-
}
|
|
686
|
-
export interface LoyaltiesExportCardTransactionsResponseBody {
|
|
687
|
-
id: string;
|
|
688
|
-
object: 'export';
|
|
689
|
-
created_at: string;
|
|
690
|
-
status: 'SCHEDULED';
|
|
691
|
-
channel: string;
|
|
692
|
-
exported_object: 'voucher_transactions';
|
|
693
|
-
parameters: {
|
|
694
|
-
order?: string;
|
|
695
|
-
fields?: LoyaltyCardTransactionsFields[];
|
|
696
|
-
filters: {
|
|
697
|
-
voucher_id: {
|
|
698
|
-
conditions: {
|
|
699
|
-
$in: [string];
|
|
700
|
-
};
|
|
701
|
-
};
|
|
702
|
-
};
|
|
703
|
-
};
|
|
704
|
-
result: null;
|
|
705
|
-
user_id: null | string;
|
|
706
|
-
}
|
|
657
|
+
export declare type LoyaltiesExportCardTransactionsResponseBody = VouchersExportTransactionsResponseBody;
|
|
707
658
|
export interface LoyaltiesAddOrRemoveCardBalanceRequestBody {
|
|
708
659
|
points: number;
|
|
709
660
|
expiration_date?: string;
|
|
@@ -739,6 +690,30 @@ export declare type LoyaltiesListLoyaltyTierEarningRulesResponseBody = {
|
|
|
739
690
|
data: EarningRule[];
|
|
740
691
|
total: number;
|
|
741
692
|
};
|
|
693
|
+
export declare type LoyaltiesGetRewardAssignmentResponseBody = RewardAssignment;
|
|
694
|
+
export interface LoyaltiesListLoyaltyTierRewardsResponseBody {
|
|
695
|
+
object: 'list';
|
|
696
|
+
data_ref: 'data';
|
|
697
|
+
total: number;
|
|
698
|
+
data: {
|
|
699
|
+
reward: {
|
|
700
|
+
id: string;
|
|
701
|
+
name: string;
|
|
702
|
+
stock: number | null;
|
|
703
|
+
redeemed: number | null;
|
|
704
|
+
attributes?: {
|
|
705
|
+
image_url?: string;
|
|
706
|
+
description?: string;
|
|
707
|
+
};
|
|
708
|
+
metadata: Record<string, undefined>;
|
|
709
|
+
created_at: string;
|
|
710
|
+
updated_at: string | null;
|
|
711
|
+
object: 'reward';
|
|
712
|
+
} & LoyaltyTierRewardItemParameters;
|
|
713
|
+
assignment: RewardAssignment;
|
|
714
|
+
object: 'loyalty_tier_reward';
|
|
715
|
+
}[];
|
|
716
|
+
}
|
|
742
717
|
export interface LoyaltyTierBase {
|
|
743
718
|
name: string;
|
|
744
719
|
earning_rules?: Record<string, MappingMultiply | MappingFixed>;
|
|
@@ -779,72 +754,6 @@ interface MappingFixed {
|
|
|
779
754
|
type: 'CUSTOM';
|
|
780
755
|
points: number;
|
|
781
756
|
}
|
|
782
|
-
export interface LoyaltyCardTransaction {
|
|
783
|
-
id: string;
|
|
784
|
-
source_id: string | null;
|
|
785
|
-
voucher_id: string;
|
|
786
|
-
campaign_id: string;
|
|
787
|
-
source: string | null;
|
|
788
|
-
reason: string | null;
|
|
789
|
-
type: LoyaltyCardTransactionsType;
|
|
790
|
-
details: {
|
|
791
|
-
balance: {
|
|
792
|
-
type: 'loyalty_card';
|
|
793
|
-
total: number;
|
|
794
|
-
object: 'balance';
|
|
795
|
-
points: number;
|
|
796
|
-
balance: number;
|
|
797
|
-
related_object: {
|
|
798
|
-
id: string;
|
|
799
|
-
type: 'voucher';
|
|
800
|
-
};
|
|
801
|
-
};
|
|
802
|
-
order?: {
|
|
803
|
-
id: string;
|
|
804
|
-
source_id: string;
|
|
805
|
-
};
|
|
806
|
-
event?: {
|
|
807
|
-
id: string;
|
|
808
|
-
type: string;
|
|
809
|
-
};
|
|
810
|
-
earning_rule?: {
|
|
811
|
-
id: string;
|
|
812
|
-
source: {
|
|
813
|
-
banner: string;
|
|
814
|
-
};
|
|
815
|
-
};
|
|
816
|
-
segment?: {
|
|
817
|
-
id: string;
|
|
818
|
-
name: string;
|
|
819
|
-
};
|
|
820
|
-
loyalty_tier?: {
|
|
821
|
-
id: string;
|
|
822
|
-
name: string;
|
|
823
|
-
};
|
|
824
|
-
redemption?: {
|
|
825
|
-
id: string;
|
|
826
|
-
};
|
|
827
|
-
rollback?: {
|
|
828
|
-
id: string;
|
|
829
|
-
};
|
|
830
|
-
reward?: {
|
|
831
|
-
id: string;
|
|
832
|
-
name: string;
|
|
833
|
-
};
|
|
834
|
-
custom_event?: {
|
|
835
|
-
id: string;
|
|
836
|
-
type: string;
|
|
837
|
-
};
|
|
838
|
-
event_schema?: {
|
|
839
|
-
id: string;
|
|
840
|
-
name: string;
|
|
841
|
-
};
|
|
842
|
-
source_voucher?: SimpleLoyaltyVoucher;
|
|
843
|
-
destination_voucher?: SimpleLoyaltyVoucher;
|
|
844
|
-
};
|
|
845
|
-
related_transaction_id: string | null;
|
|
846
|
-
created_at: string;
|
|
847
|
-
}
|
|
848
757
|
export interface SimpleLoyaltyVoucher {
|
|
849
758
|
id: string;
|
|
850
759
|
code: string;
|
|
@@ -1094,4 +1003,38 @@ export interface EarningRuleProportionalCustomEvent {
|
|
|
1094
1003
|
};
|
|
1095
1004
|
};
|
|
1096
1005
|
}
|
|
1006
|
+
export declare type LoyaltyTierRewardItemParameters = LoyaltyTierRewardItemCampaignParameters | LoyaltyTierRewardItemCoinParameters | LoyaltyTierRewardItemMaterialParameters;
|
|
1007
|
+
export interface LoyaltyTierRewardItemCampaignParameters {
|
|
1008
|
+
type: 'CAMPAIGN';
|
|
1009
|
+
parameters: {
|
|
1010
|
+
campaign: LoyaltyTierRewardItemCampaignDiscountCoupons | LoyaltyTierRewardItemCampaignGiftVouchersAndLoyaltyProgram;
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
export interface LoyaltyTierRewardItemCoinParameters {
|
|
1014
|
+
type: 'COIN';
|
|
1015
|
+
parameters: {
|
|
1016
|
+
coin: {
|
|
1017
|
+
exchange_ratio: number;
|
|
1018
|
+
points_ratio: number;
|
|
1019
|
+
};
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
export interface LoyaltyTierRewardItemMaterialParameters {
|
|
1023
|
+
type: 'MATERIAL';
|
|
1024
|
+
parameters: {
|
|
1025
|
+
product: {
|
|
1026
|
+
id: string;
|
|
1027
|
+
sku_id: string | null;
|
|
1028
|
+
};
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
export interface LoyaltyTierRewardItemCampaignDiscountCoupons {
|
|
1032
|
+
id: string;
|
|
1033
|
+
type: string;
|
|
1034
|
+
}
|
|
1035
|
+
export interface LoyaltyTierRewardItemCampaignGiftVouchersAndLoyaltyProgram {
|
|
1036
|
+
id: string;
|
|
1037
|
+
balance: number;
|
|
1038
|
+
type: string;
|
|
1039
|
+
}
|
|
1097
1040
|
export {};
|
package/dist/types/Orders.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomerRequest } from './Customers';
|
|
1
|
+
import { Customer, CustomerId, CustomerRequest, CustomerWithSummaryLoyaltyReferrals, Referrer, ReferrerId, ReferrerWithSummaryLoyaltyReferrals } from './Customers';
|
|
2
2
|
export interface OrdersItem {
|
|
3
3
|
sku_id?: string;
|
|
4
4
|
product_id?: string;
|
|
@@ -84,3 +84,112 @@ export interface OrdersListResponse {
|
|
|
84
84
|
data_ref: 'orders';
|
|
85
85
|
orders: OrdersGetResponse[];
|
|
86
86
|
}
|
|
87
|
+
export declare type Order = {
|
|
88
|
+
id?: string;
|
|
89
|
+
source_id?: string;
|
|
90
|
+
status?: 'CREATED' | 'PAID' | 'CANCELED' | 'FULFILLED';
|
|
91
|
+
amount?: number;
|
|
92
|
+
discount_amount?: number;
|
|
93
|
+
initial_amount?: number;
|
|
94
|
+
items?: OrderItem[];
|
|
95
|
+
customer?: Customer;
|
|
96
|
+
customer_id?: string;
|
|
97
|
+
referrer?: Referrer;
|
|
98
|
+
referrer_id?: string;
|
|
99
|
+
metadata?: Record<string, any>;
|
|
100
|
+
};
|
|
101
|
+
export declare type OrderItem = {
|
|
102
|
+
sku_id?: string;
|
|
103
|
+
product_id?: string;
|
|
104
|
+
related_object?: 'product' | 'sku';
|
|
105
|
+
source_id?: string;
|
|
106
|
+
quantity?: number;
|
|
107
|
+
discount_quantity?: number;
|
|
108
|
+
initial_quantity?: number;
|
|
109
|
+
amount?: number;
|
|
110
|
+
discount_amount?: number;
|
|
111
|
+
initial_amount?: number;
|
|
112
|
+
price?: number;
|
|
113
|
+
product?: {
|
|
114
|
+
id?: string;
|
|
115
|
+
source_id?: string;
|
|
116
|
+
override?: boolean;
|
|
117
|
+
name?: string;
|
|
118
|
+
metadata?: Record<string, any>;
|
|
119
|
+
price?: number;
|
|
120
|
+
};
|
|
121
|
+
sku?: {
|
|
122
|
+
id?: string;
|
|
123
|
+
source_id?: string;
|
|
124
|
+
override?: boolean;
|
|
125
|
+
sku?: string;
|
|
126
|
+
price?: number;
|
|
127
|
+
};
|
|
128
|
+
metadata?: Record<string, any>;
|
|
129
|
+
};
|
|
130
|
+
export declare type OrderCalculated = {
|
|
131
|
+
id?: string;
|
|
132
|
+
source_id?: string | null;
|
|
133
|
+
created_at?: string;
|
|
134
|
+
updated_at?: string | null;
|
|
135
|
+
status?: 'CREATED' | 'PAID' | 'CANCELED' | 'FULFILLED';
|
|
136
|
+
amount?: number;
|
|
137
|
+
initial_amount?: number;
|
|
138
|
+
discount_amount?: number;
|
|
139
|
+
items_discount_amount?: number;
|
|
140
|
+
total_discount_amount?: number;
|
|
141
|
+
total_amount?: number;
|
|
142
|
+
applied_discount_amount?: number;
|
|
143
|
+
items_applied_discount_amount?: number;
|
|
144
|
+
total_applied_discount_amount?: number;
|
|
145
|
+
items?: OrderItemCalculated[];
|
|
146
|
+
metadata: Record<string, unknown>;
|
|
147
|
+
customer?: CustomerId | CustomerWithSummaryLoyaltyReferrals;
|
|
148
|
+
customer_id: string | null;
|
|
149
|
+
referrer?: ReferrerId | ReferrerWithSummaryLoyaltyReferrals;
|
|
150
|
+
referrer_id: string | null;
|
|
151
|
+
object: 'order';
|
|
152
|
+
redemptions?: Record<string, OrderRedemptions>;
|
|
153
|
+
};
|
|
154
|
+
export declare type OrderRedemptions = {
|
|
155
|
+
date?: string;
|
|
156
|
+
rollback_id?: string;
|
|
157
|
+
rollback_date?: string;
|
|
158
|
+
related_object_type?: string;
|
|
159
|
+
related_object_id?: string;
|
|
160
|
+
related_object_parent_id?: string;
|
|
161
|
+
stacked?: string[];
|
|
162
|
+
rollback_stacked?: string[];
|
|
163
|
+
};
|
|
164
|
+
export declare type OrderItemCalculated = {
|
|
165
|
+
sku_id?: string;
|
|
166
|
+
product_id?: string;
|
|
167
|
+
related_object?: 'product' | 'sku';
|
|
168
|
+
source_id?: string;
|
|
169
|
+
quantity?: number;
|
|
170
|
+
discount_quantity?: number;
|
|
171
|
+
initial_quantity?: number;
|
|
172
|
+
amount?: number;
|
|
173
|
+
discount_amount?: number;
|
|
174
|
+
initial_amount?: number;
|
|
175
|
+
total_applied_discount_amount?: number;
|
|
176
|
+
price?: number;
|
|
177
|
+
subtotal_amount?: number;
|
|
178
|
+
product?: {
|
|
179
|
+
id?: string;
|
|
180
|
+
source_id?: string;
|
|
181
|
+
override?: boolean;
|
|
182
|
+
name?: string;
|
|
183
|
+
metadata?: Record<string, any>;
|
|
184
|
+
price?: number;
|
|
185
|
+
};
|
|
186
|
+
sku?: {
|
|
187
|
+
id?: string;
|
|
188
|
+
source_id?: string;
|
|
189
|
+
override?: boolean;
|
|
190
|
+
sku?: string;
|
|
191
|
+
price?: number;
|
|
192
|
+
};
|
|
193
|
+
object: 'order_item';
|
|
194
|
+
metadata?: Record<string, any>;
|
|
195
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Category } from './Categories';
|
|
2
|
+
export interface PromotionsStacksListInCampaignResponseBody {
|
|
3
|
+
object: 'list';
|
|
4
|
+
data_ref: 'data';
|
|
5
|
+
data: PromotionStack[];
|
|
6
|
+
total: number;
|
|
7
|
+
}
|
|
8
|
+
export interface PromotionsStacksListResponseBody {
|
|
9
|
+
object: 'list';
|
|
10
|
+
data_ref: 'data';
|
|
11
|
+
data: PromotionStack[];
|
|
12
|
+
total: number;
|
|
13
|
+
}
|
|
14
|
+
export interface PromotionsStacksListRequestQuery {
|
|
15
|
+
limit?: number;
|
|
16
|
+
page?: number;
|
|
17
|
+
order?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at' | 'name' | '-name';
|
|
18
|
+
created_at?: {
|
|
19
|
+
before?: string;
|
|
20
|
+
after?: string;
|
|
21
|
+
};
|
|
22
|
+
updated_at?: {
|
|
23
|
+
before?: string;
|
|
24
|
+
after?: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare type PromotionsStacksGetResponseBody = PromotionStack;
|
|
28
|
+
export declare type PromotionsStacksUpdateRequestBody = {
|
|
29
|
+
name: string;
|
|
30
|
+
tiers?: {
|
|
31
|
+
ids?: string[];
|
|
32
|
+
hierarchy_mode?: 'MANUAL';
|
|
33
|
+
};
|
|
34
|
+
category_id?: string;
|
|
35
|
+
};
|
|
36
|
+
export declare type PromotionsStacksUpdateResponseBody = PromotionStackBase & {
|
|
37
|
+
id: string;
|
|
38
|
+
created_at: string;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
campaign_id: string;
|
|
41
|
+
object: 'promotion_stack';
|
|
42
|
+
category_id: string | null;
|
|
43
|
+
categories: Category[];
|
|
44
|
+
};
|
|
45
|
+
export declare type PromotionsStacksCreateInCampaignRequestBody = PromotionStackBase & {
|
|
46
|
+
category_id?: string;
|
|
47
|
+
};
|
|
48
|
+
export declare type PromotionsStacksCreateInCampaignResponseBody = PromotionStackBase & {
|
|
49
|
+
id: string;
|
|
50
|
+
created_at: string;
|
|
51
|
+
campaign_id: string;
|
|
52
|
+
object: 'promotion_stack';
|
|
53
|
+
category_id: string | null;
|
|
54
|
+
categories: Category[];
|
|
55
|
+
};
|
|
56
|
+
export interface PromotionStackBase {
|
|
57
|
+
name: string;
|
|
58
|
+
tiers: {
|
|
59
|
+
ids: string[];
|
|
60
|
+
hierarchy_mode?: 'MANUAL';
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export declare type PromotionStack = PromotionStackBase & {
|
|
64
|
+
id: string;
|
|
65
|
+
created_at: string;
|
|
66
|
+
updated_at?: string;
|
|
67
|
+
campaign_id: string;
|
|
68
|
+
object: 'promotion_stack';
|
|
69
|
+
category_id: string | null;
|
|
70
|
+
categories: Category[];
|
|
71
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { CustomerRequest } from './Customers';
|
|
2
|
+
import { Junction } from './Exports';
|
|
3
|
+
import { Order, OrderCalculated } from './Orders';
|
|
4
|
+
import { ApplicableToResultList, InapplicableToResultList } from './ApplicableTo';
|
|
5
|
+
import { Category } from './Categories';
|
|
6
|
+
import { Discount } from './DiscountVoucher';
|
|
7
|
+
import { LoyaltiesTransferPoints } from './Loyalties';
|
|
8
|
+
import { ValidationRulesAssignmentsList } from './ValidationRules';
|
|
9
|
+
export declare type QualificationsCheckEligibilityRequestBody = {
|
|
10
|
+
customer?: CustomerRequest;
|
|
11
|
+
order?: Order;
|
|
12
|
+
mode?: 'BASIC' | 'ADVANCED';
|
|
13
|
+
tracking_id?: string;
|
|
14
|
+
scenario?: 'ALL' | 'CUSTOMER_WALLET' | 'AUDIENCE_ONLY' | 'PRODUCTS' | 'PRODUCTS_DISCOUNT' | 'PROMOTION_STACKS' | 'PRODUCTS_BY_CUSTOMER' | 'PRODUCTS_DISCOUNT_BY_CUSTOMER';
|
|
15
|
+
options?: {
|
|
16
|
+
limit?: number;
|
|
17
|
+
starting_after?: string;
|
|
18
|
+
filters?: {
|
|
19
|
+
junction?: Junction;
|
|
20
|
+
} & Partial<Record<QualificationsFiltersFields, QualificationsFieldConditions>>;
|
|
21
|
+
expand?: ('redeemable' | 'category' | 'validation_rules')[];
|
|
22
|
+
sorting_rule?: 'BEST_DEAL' | 'LEAST_DEAL' | 'DEFAULT';
|
|
23
|
+
};
|
|
24
|
+
metadata?: Record<string, any>;
|
|
25
|
+
};
|
|
26
|
+
export declare type QualificationsCheckEligibilityResponseBody = {
|
|
27
|
+
redeemables: QualificationsRedeemableList;
|
|
28
|
+
tracking_id?: string;
|
|
29
|
+
order?: OrderCalculated;
|
|
30
|
+
stacking_rules: QualificationsStackingRules;
|
|
31
|
+
};
|
|
32
|
+
export declare type QualificationsFiltersFields = 'category_id' | 'campaign_id' | 'resource_id' | 'resource_type' | 'voucher_type' | 'code';
|
|
33
|
+
export declare type QualificationsFiltersCondition = '$in' | '$not_in' | '$is' | '$is_not' | '$has_value' | '$is_unknown';
|
|
34
|
+
export declare type QualificationsFieldConditions = {
|
|
35
|
+
conditions?: Partial<Record<QualificationsFiltersCondition, any>>;
|
|
36
|
+
};
|
|
37
|
+
export declare type QualificationsRedeemableList = {
|
|
38
|
+
object: 'list';
|
|
39
|
+
data_ref: 'data';
|
|
40
|
+
data: QualificationsRedeemable[];
|
|
41
|
+
total: number;
|
|
42
|
+
has_more: boolean;
|
|
43
|
+
more_starting_after?: string;
|
|
44
|
+
};
|
|
45
|
+
export declare type QualificationsStackingRules = {
|
|
46
|
+
redeemables_limit: number;
|
|
47
|
+
applicable_redeemables_limit: number;
|
|
48
|
+
applicable_exclusive_redeemables_limit: number;
|
|
49
|
+
exclusive_categories: string[];
|
|
50
|
+
joint_categories: string[];
|
|
51
|
+
};
|
|
52
|
+
export declare type QualificationsRedeemable = QualificationsRedeemableBase & {
|
|
53
|
+
redeemables?: QualificationsRedeemableBase[];
|
|
54
|
+
};
|
|
55
|
+
export declare type QualificationsRedeemableBase = {
|
|
56
|
+
id: string;
|
|
57
|
+
object: 'campaign' | 'promotion_tier' | 'promotion_stack' | 'voucher';
|
|
58
|
+
created_at: string;
|
|
59
|
+
result: RedeemableResult;
|
|
60
|
+
order?: OrderCalculated;
|
|
61
|
+
validation_rule_id?: string;
|
|
62
|
+
applicable_to: ApplicableToResultList;
|
|
63
|
+
inapplicable_to: InapplicableToResultList;
|
|
64
|
+
metadata: Record<string, unknown> | null;
|
|
65
|
+
categories: Category[];
|
|
66
|
+
banner?: string;
|
|
67
|
+
name?: string;
|
|
68
|
+
campaign_name?: string;
|
|
69
|
+
campaign_id?: string;
|
|
70
|
+
validation_rules_assignments?: ValidationRulesAssignmentsList;
|
|
71
|
+
};
|
|
72
|
+
export declare type RedeemableResult = {
|
|
73
|
+
discount?: Discount;
|
|
74
|
+
gift?: {
|
|
75
|
+
balance: number;
|
|
76
|
+
credits: number;
|
|
77
|
+
};
|
|
78
|
+
loyalty_card?: {
|
|
79
|
+
points?: number;
|
|
80
|
+
balance?: number;
|
|
81
|
+
exchange_ratio?: number;
|
|
82
|
+
points_ratio?: number;
|
|
83
|
+
transfers?: LoyaltiesTransferPoints[];
|
|
84
|
+
};
|
|
85
|
+
error?: Error;
|
|
86
|
+
};
|
package/dist/types/Rewards.d.ts
CHANGED
|
@@ -158,18 +158,62 @@ export interface RewardTypeMaterial {
|
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
export declare type RewardType = RewardTypeCampaign | RewardTypeCoin | RewardTypeMaterial;
|
|
161
|
-
export
|
|
161
|
+
export declare type RewardAssignment = RewardsAssignmentCoinReward | RewardsAssignmentCampaignOrMaterialReward;
|
|
162
|
+
export interface RewardsAssignmentCoinReward {
|
|
162
163
|
id: string;
|
|
163
164
|
reward_id: string;
|
|
164
|
-
related_object_id
|
|
165
|
-
related_object_type
|
|
165
|
+
related_object_id: string;
|
|
166
|
+
related_object_type: 'campaign';
|
|
167
|
+
created_at: string;
|
|
168
|
+
updated_at: string | null;
|
|
169
|
+
object: 'reward-assignment';
|
|
170
|
+
}
|
|
171
|
+
export interface RewardsAssignmentCampaignOrMaterialReward {
|
|
172
|
+
id: string;
|
|
173
|
+
reward_id: string;
|
|
174
|
+
related_object_id: string;
|
|
175
|
+
related_object_type: 'campaign';
|
|
176
|
+
created_at: string;
|
|
177
|
+
updated_at: string | null;
|
|
178
|
+
object: 'reward-assignment';
|
|
179
|
+
parameters: {
|
|
180
|
+
loyalty: {
|
|
181
|
+
points?: number;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
export declare type RewardsGetAssignmentResponseBody = RewardAssignment;
|
|
186
|
+
export interface RewardsListAssignmentsRequestQuery {
|
|
187
|
+
limit?: number;
|
|
188
|
+
page?: number;
|
|
189
|
+
}
|
|
190
|
+
export interface RewardsListAssignmentsResponseBody {
|
|
191
|
+
object: 'list';
|
|
192
|
+
data_ref: 'data';
|
|
193
|
+
data: RewardAssignment[];
|
|
194
|
+
total: number;
|
|
195
|
+
}
|
|
196
|
+
export declare type RewardsCreateAssignmentRequestBody = RewardsCreateAssignmentCoinRewardRequestBody | RewardsCreateAssignmentCampaignOrMaterialRewardRequestBody;
|
|
197
|
+
export interface RewardsCreateAssignmentCoinRewardRequestBody {
|
|
198
|
+
campaign: string;
|
|
199
|
+
validation_rules?: string[];
|
|
200
|
+
}
|
|
201
|
+
export interface RewardsCreateAssignmentCampaignOrMaterialRewardRequestBody {
|
|
202
|
+
campaign: string;
|
|
203
|
+
parameters: {
|
|
204
|
+
loyalty: {
|
|
205
|
+
points?: number;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
export declare type RewardsCreateAssignmentResponseBody = RewardAssignment;
|
|
210
|
+
export interface RewardsUpdateAssignmentRequestBody {
|
|
166
211
|
parameters?: {
|
|
167
212
|
loyalty?: {
|
|
168
|
-
points
|
|
213
|
+
points?: number;
|
|
169
214
|
};
|
|
170
215
|
};
|
|
171
|
-
|
|
172
|
-
updated_at?: string;
|
|
173
|
-
object: 'reward_assignment';
|
|
216
|
+
id: string;
|
|
174
217
|
}
|
|
218
|
+
export declare type RewardsUpdateAssignmentResponseBody = RewardAssignment;
|
|
175
219
|
export {};
|
|
@@ -69,3 +69,25 @@ export interface ValidationRulesListAssignmentsResponse {
|
|
|
69
69
|
data_ref: 'data';
|
|
70
70
|
data: ValidationRulesCreateAssignmentResponse[];
|
|
71
71
|
}
|
|
72
|
+
export declare type ValidationRulesAssignmentsList = ValidationRulesListResponse;
|
|
73
|
+
export interface ValidationRulesAssignment {
|
|
74
|
+
id: string;
|
|
75
|
+
rule_id: string;
|
|
76
|
+
related_object_id: string;
|
|
77
|
+
related_object_type: string;
|
|
78
|
+
created_at: string;
|
|
79
|
+
object: 'validation_rules_assignment';
|
|
80
|
+
}
|
|
81
|
+
export interface ValidationRulesListRulesAssignmentsRequestQuery {
|
|
82
|
+
related_object_id?: string;
|
|
83
|
+
rule?: string;
|
|
84
|
+
page?: number;
|
|
85
|
+
limit?: number;
|
|
86
|
+
order?: 'created_at' | '-created_at';
|
|
87
|
+
}
|
|
88
|
+
export interface ValidationRulesListRulesAssignmentsResponseBody {
|
|
89
|
+
object: 'list';
|
|
90
|
+
data_ref: 'data';
|
|
91
|
+
total: number;
|
|
92
|
+
data: ValidationRulesAssignment[];
|
|
93
|
+
}
|