@managesome/eposmatic-toolkit 0.2.248 → 0.2.251
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/lib/constants/ENUMS.d.ts +36 -21
- package/lib/constants/ENUMS.js +48 -30
- package/lib/constants/SOCKET.d.ts +6 -0
- package/lib/constants/SOCKET.js +11 -2
- package/lib/helpers/store/cart-actions.d.ts +1 -0
- package/lib/helpers/utils/offers-helpers.d.ts +23 -3
- package/lib/helpers/utils/offers-helpers.js +1071 -389
- package/lib/schemas/models/customers.d.ts +9 -0
- package/lib/schemas/models/customers.js +14 -0
- package/lib/schemas/models/gift_cards.d.ts +113 -0
- package/lib/schemas/models/gift_cards.js +150 -0
- package/lib/schemas/models/index.d.ts +3 -0
- package/lib/schemas/models/index.js +3 -0
- package/lib/schemas/models/offers.d.ts +133 -66
- package/lib/schemas/models/offers.js +112 -12
- package/lib/schemas/models/order.d.ts +3 -0
- package/lib/schemas/models/order.js +5 -0
- package/lib/schemas/models/rewards_usage.d.ts +53 -0
- package/lib/schemas/models/rewards_usage.js +64 -0
- package/lib/schemas/models/vouchers.d.ts +68 -0
- package/lib/schemas/models/vouchers.js +85 -0
- package/lib/schemas/types/customers.d.ts +3 -0
- package/lib/schemas/types/gift_cards.d.ts +91 -0
- package/lib/schemas/types/gift_cards.js +2 -0
- package/lib/schemas/types/index.d.ts +3 -0
- package/lib/schemas/types/index.js +3 -0
- package/lib/schemas/types/offers.d.ts +139 -15
- package/lib/schemas/types/order.d.ts +1 -0
- package/lib/schemas/types/rewards_usage.d.ts +13 -0
- package/lib/schemas/types/rewards_usage.js +2 -0
- package/lib/schemas/types/vouchers.d.ts +17 -0
- package/lib/schemas/types/vouchers.js +2 -0
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { OFFER_REWARD_TYPE_ENUM, PATHWAY_TO_UNLOCK_TYPE_ENUM, PLATFORMS_ENUM } from '../../constants';
|
|
1
|
+
import { MYSTERY_GIFT_TYPE_ENUM, OFFER_REWARD_TYPE_ENUM, PATHWAY_TO_UNLOCK_TYPE_ENUM, PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPE_ENUM, PLATFORMS_ENUM } from '../../constants';
|
|
2
2
|
import { IItemSpecialHour } from './common';
|
|
3
3
|
export interface IPathwayToUnlockTypeOrders {
|
|
4
|
+
scope?: PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPE_ENUM;
|
|
4
5
|
min_num_of_orders: number;
|
|
5
6
|
max_num_of_orders: number | null;
|
|
6
7
|
total_amount: number;
|
|
@@ -8,16 +9,54 @@ export interface IPathwayToUnlockTypeOrders {
|
|
|
8
9
|
}
|
|
9
10
|
export interface IPathwayToUnlockTypeItems {
|
|
10
11
|
num_of_items: number;
|
|
12
|
+
max_claims: number | null;
|
|
13
|
+
max_same_item_quantity: number | null;
|
|
11
14
|
total_amount: number;
|
|
12
15
|
excluded_refs: string[];
|
|
13
16
|
exclusive_refs: string[];
|
|
14
17
|
item_ids: string[];
|
|
18
|
+
category_ids: string[];
|
|
15
19
|
}
|
|
16
20
|
export interface IPathwayToUnlockTypePoints {
|
|
17
21
|
num_of_points: number;
|
|
18
22
|
total_amount: number;
|
|
23
|
+
max_claims: number | null;
|
|
19
24
|
}
|
|
20
|
-
export interface
|
|
25
|
+
export interface IPathwayToUnlockTypeVouchers {
|
|
26
|
+
total_amount: number;
|
|
27
|
+
max_amount: number | null;
|
|
28
|
+
voucher_ids: string[];
|
|
29
|
+
}
|
|
30
|
+
type IOfferPathwayItems = {
|
|
31
|
+
pathway_to_unlock_type: PATHWAY_TO_UNLOCK_TYPE_ENUM.ITEMS;
|
|
32
|
+
pathway_to_unlock_type_items: IPathwayToUnlockTypeItems;
|
|
33
|
+
pathway_to_unlock_type_orders?: null;
|
|
34
|
+
pathway_to_unlock_type_points?: null;
|
|
35
|
+
pathway_to_unlock_type_vouchers?: null;
|
|
36
|
+
};
|
|
37
|
+
type IOfferPathwayOrders = {
|
|
38
|
+
pathway_to_unlock_type: PATHWAY_TO_UNLOCK_TYPE_ENUM.ORDERS;
|
|
39
|
+
pathway_to_unlock_type_items?: null;
|
|
40
|
+
pathway_to_unlock_type_orders: IPathwayToUnlockTypeOrders;
|
|
41
|
+
pathway_to_unlock_type_points?: null;
|
|
42
|
+
pathway_to_unlock_type_vouchers?: null;
|
|
43
|
+
};
|
|
44
|
+
type IOfferPathwayPoints = {
|
|
45
|
+
pathway_to_unlock_type: PATHWAY_TO_UNLOCK_TYPE_ENUM.POINTS;
|
|
46
|
+
pathway_to_unlock_type_items?: null;
|
|
47
|
+
pathway_to_unlock_type_orders?: null;
|
|
48
|
+
pathway_to_unlock_type_points: IPathwayToUnlockTypePoints;
|
|
49
|
+
pathway_to_unlock_type_vouchers?: null;
|
|
50
|
+
};
|
|
51
|
+
type IOfferPathwayVouchers = {
|
|
52
|
+
pathway_to_unlock_type: PATHWAY_TO_UNLOCK_TYPE_ENUM.VOUCHER;
|
|
53
|
+
pathway_to_unlock_type_items?: null;
|
|
54
|
+
pathway_to_unlock_type_orders?: null;
|
|
55
|
+
pathway_to_unlock_type_points?: null;
|
|
56
|
+
pathway_to_unlock_type_vouchers: IPathwayToUnlockTypeVouchers;
|
|
57
|
+
};
|
|
58
|
+
export type IOfferPathway = IOfferPathwayItems | IOfferPathwayOrders | IOfferPathwayPoints | IOfferPathwayVouchers;
|
|
59
|
+
export interface IRewardTypeItems {
|
|
21
60
|
num_of_items: number;
|
|
22
61
|
excluded_refs: string[];
|
|
23
62
|
exclusive_refs: string[];
|
|
@@ -27,7 +66,7 @@ export interface IOfferRewardTypeItems {
|
|
|
27
66
|
item_ids: string[];
|
|
28
67
|
}[] | null;
|
|
29
68
|
}
|
|
30
|
-
export interface
|
|
69
|
+
export interface IRewardTypeDiscount {
|
|
31
70
|
/**
|
|
32
71
|
* @public
|
|
33
72
|
* In case of reward_type is DISCOUNT
|
|
@@ -36,7 +75,7 @@ export interface IOfferRewardTypeDiscount {
|
|
|
36
75
|
is_discount_percentage: boolean;
|
|
37
76
|
excluded_refs: string[];
|
|
38
77
|
}
|
|
39
|
-
export interface
|
|
78
|
+
export interface IRewardTypeDiscountItems {
|
|
40
79
|
num_of_items: number;
|
|
41
80
|
excluded_refs: string[];
|
|
42
81
|
exclusive_refs: string[];
|
|
@@ -52,11 +91,103 @@ export interface IOfferRewardTypeDiscountItems {
|
|
|
52
91
|
item_ids: string[];
|
|
53
92
|
}[] | null;
|
|
54
93
|
}
|
|
55
|
-
export interface
|
|
94
|
+
export interface IRewardTypePoints {
|
|
56
95
|
num_of_points: number;
|
|
57
96
|
once_per_order: boolean;
|
|
58
97
|
}
|
|
59
|
-
export interface
|
|
98
|
+
export interface IRewardTypeCashback {
|
|
99
|
+
cashback_value: number;
|
|
100
|
+
is_cashback_percentage: boolean;
|
|
101
|
+
max_cashback_amount: number | null;
|
|
102
|
+
excluded_refs: string[];
|
|
103
|
+
}
|
|
104
|
+
export interface IRewardTypeGiftCards {
|
|
105
|
+
gift_card_ids: Record<string, number>;
|
|
106
|
+
}
|
|
107
|
+
export interface IRewardTypeVoucher {
|
|
108
|
+
voucher_ids: Record<string, number>;
|
|
109
|
+
}
|
|
110
|
+
export interface IRewardTypeMysteryGift {
|
|
111
|
+
choice_of_rewards: MYSTERY_GIFT_TYPE_ENUM[];
|
|
112
|
+
reward_discount?: IRewardTypeDiscount | null;
|
|
113
|
+
reward_discount_items?: IRewardTypeDiscountItems | null;
|
|
114
|
+
reward_points?: IRewardTypePoints | null;
|
|
115
|
+
reward_cashback?: IRewardTypeCashback | null;
|
|
116
|
+
reward_items?: IRewardTypeItems | null;
|
|
117
|
+
reward_voucher?: IRewardTypeVoucher | null;
|
|
118
|
+
}
|
|
119
|
+
type IOfferRewardItems = {
|
|
120
|
+
reward_type: OFFER_REWARD_TYPE_ENUM.ITEMS;
|
|
121
|
+
reward_items: IRewardTypeItems;
|
|
122
|
+
reward_discount?: null;
|
|
123
|
+
reward_discount_items?: null;
|
|
124
|
+
reward_points?: null;
|
|
125
|
+
reward_cashback?: null;
|
|
126
|
+
reward_gift_cards?: null;
|
|
127
|
+
reward_voucher?: null;
|
|
128
|
+
};
|
|
129
|
+
type IOfferRewardDiscount = {
|
|
130
|
+
reward_type: OFFER_REWARD_TYPE_ENUM.DISCOUNT;
|
|
131
|
+
reward_items?: null;
|
|
132
|
+
reward_discount: IRewardTypeDiscount;
|
|
133
|
+
reward_discount_items?: null;
|
|
134
|
+
reward_points?: null;
|
|
135
|
+
reward_cashback?: null;
|
|
136
|
+
reward_gift_cards?: null;
|
|
137
|
+
reward_voucher?: null;
|
|
138
|
+
};
|
|
139
|
+
type IOfferRewardDiscountItems = {
|
|
140
|
+
reward_type: OFFER_REWARD_TYPE_ENUM.DISCOUNT_ITEMS;
|
|
141
|
+
reward_items?: null;
|
|
142
|
+
reward_discount?: null;
|
|
143
|
+
reward_discount_items: IRewardTypeDiscountItems;
|
|
144
|
+
reward_points?: null;
|
|
145
|
+
reward_cashback?: null;
|
|
146
|
+
reward_gift_cards?: null;
|
|
147
|
+
reward_voucher?: null;
|
|
148
|
+
};
|
|
149
|
+
type IOfferRewardPoints = {
|
|
150
|
+
reward_type: OFFER_REWARD_TYPE_ENUM.POINTS;
|
|
151
|
+
reward_items?: null;
|
|
152
|
+
reward_discount?: null;
|
|
153
|
+
reward_discount_items?: null;
|
|
154
|
+
reward_points: IRewardTypePoints;
|
|
155
|
+
reward_cashback?: null;
|
|
156
|
+
reward_gift_cards?: null;
|
|
157
|
+
reward_voucher?: null;
|
|
158
|
+
};
|
|
159
|
+
type IOfferRewardCashback = {
|
|
160
|
+
reward_type: OFFER_REWARD_TYPE_ENUM.CASHBACK;
|
|
161
|
+
reward_items?: null;
|
|
162
|
+
reward_discount?: null;
|
|
163
|
+
reward_discount_items?: null;
|
|
164
|
+
reward_points?: null;
|
|
165
|
+
reward_cashback: IRewardTypeCashback;
|
|
166
|
+
reward_gift_cards?: null;
|
|
167
|
+
reward_voucher?: null;
|
|
168
|
+
};
|
|
169
|
+
type IOfferRewardGiftCards = {
|
|
170
|
+
reward_type: OFFER_REWARD_TYPE_ENUM.GIFT_CARDS;
|
|
171
|
+
reward_items?: null;
|
|
172
|
+
reward_discount?: null;
|
|
173
|
+
reward_discount_items?: null;
|
|
174
|
+
reward_points?: null;
|
|
175
|
+
reward_cashback?: null;
|
|
176
|
+
reward_gift_cards: IRewardTypeGiftCards;
|
|
177
|
+
reward_voucher?: null;
|
|
178
|
+
};
|
|
179
|
+
type IOfferRewardVoucher = {
|
|
180
|
+
reward_type: OFFER_REWARD_TYPE_ENUM.VOUCHER;
|
|
181
|
+
reward_items?: null;
|
|
182
|
+
reward_discount?: null;
|
|
183
|
+
reward_discount_items?: null;
|
|
184
|
+
reward_points?: null;
|
|
185
|
+
reward_cashback?: null;
|
|
186
|
+
reward_gift_cards?: null;
|
|
187
|
+
reward_voucher: IRewardTypeVoucher;
|
|
188
|
+
};
|
|
189
|
+
export type IOfferReward = IOfferRewardItems | IOfferRewardDiscount | IOfferRewardDiscountItems | IOfferRewardPoints | IOfferRewardCashback | IOfferRewardGiftCards | IOfferRewardVoucher;
|
|
190
|
+
export interface IOfferBase {
|
|
60
191
|
_id: string;
|
|
61
192
|
brand_id: string;
|
|
62
193
|
tenants: string[];
|
|
@@ -68,15 +199,8 @@ export interface IOffer {
|
|
|
68
199
|
sort_id: number;
|
|
69
200
|
offer_special_hours: IItemSpecialHour[] | null;
|
|
70
201
|
auto_apply: boolean;
|
|
71
|
-
pathway_to_unlock_type: PATHWAY_TO_UNLOCK_TYPE_ENUM;
|
|
72
|
-
pathway_to_unlock_type_items: IPathwayToUnlockTypeItems | null;
|
|
73
|
-
pathway_to_unlock_type_orders: IPathwayToUnlockTypeOrders | null;
|
|
74
|
-
pathway_to_unlock_type_points: IPathwayToUnlockTypePoints | null;
|
|
75
|
-
reward_type: OFFER_REWARD_TYPE_ENUM;
|
|
76
|
-
reward_items: IOfferRewardTypeItems | null;
|
|
77
|
-
reward_discount: IOfferRewardTypeDiscount | null;
|
|
78
|
-
reward_discount_items: IOfferRewardTypeDiscountItems | null;
|
|
79
|
-
reward_points: IOfferRewardTypePoints | null;
|
|
80
202
|
createdAt: Date;
|
|
81
203
|
updatedAt: Date;
|
|
82
204
|
}
|
|
205
|
+
export type IOffer = IOfferBase & IOfferPathway & IOfferReward;
|
|
206
|
+
export {};
|
|
@@ -222,6 +222,7 @@ export interface IOrder extends CommonOptionalFields {
|
|
|
222
222
|
deferred_settlement?: boolean;
|
|
223
223
|
payment_method_expected?: PAYMENT_METHOD_EXPECTED_ENUM;
|
|
224
224
|
order_taker_details?: IStaffDetails | null;
|
|
225
|
+
redeemed_offers?: Record<string, number> | null;
|
|
225
226
|
order_settled_at: Date;
|
|
226
227
|
order_settled_at_mins: number;
|
|
227
228
|
createdAt_mins: number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { REWARDS_USAGE_REF_TYPE_ENUM } from '../../constants';
|
|
2
|
+
export interface IRewardsUsage {
|
|
3
|
+
_id: string;
|
|
4
|
+
ref_id: string;
|
|
5
|
+
ref_type: REWARDS_USAGE_REF_TYPE_ENUM;
|
|
6
|
+
customer_phone: string;
|
|
7
|
+
assigned_count: number;
|
|
8
|
+
last_assigned_at: Date | null;
|
|
9
|
+
used_count: number;
|
|
10
|
+
last_used_at: Date | null;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface IVoucher {
|
|
2
|
+
_id: string;
|
|
3
|
+
code: string;
|
|
4
|
+
brand_id: string;
|
|
5
|
+
tenants: string[];
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
active: boolean;
|
|
9
|
+
is_public: boolean;
|
|
10
|
+
max_uses: number | null;
|
|
11
|
+
max_uses_per_customer: number | null;
|
|
12
|
+
used_count: number;
|
|
13
|
+
last_used_at: Date | null;
|
|
14
|
+
expire_at: Date | null;
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@managesome/eposmatic-toolkit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.251",
|
|
4
4
|
"description": "A Toolkit Library for Eposmatic",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"test": "jest --config jestconfig.json",
|
|
9
9
|
"build": "tsc",
|
|
10
10
|
"prepare": "npm run build",
|
|
11
|
-
"prepublishOnly": "npm
|
|
11
|
+
"prepublishOnly": "npm run lint",
|
|
12
12
|
"preversion": "npm run lint",
|
|
13
13
|
"version": "npm run format && git add -A src",
|
|
14
14
|
"postversion": "git push && git push --tags",
|