@managesome/eposmatic-toolkit 0.2.247 → 0.2.250
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/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 +12 -0
- package/lib/schemas/models/customers.js +18 -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/models/warehouse_staff.d.ts +3 -3
- package/lib/schemas/types/customers.d.ts +4 -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
|
@@ -110,6 +110,9 @@ export declare const CustomersSchema: Schema<any, import("mongoose").Model<any,
|
|
|
110
110
|
last_order_at: NativeDate;
|
|
111
111
|
last_order_id: import("mongoose").Types.ObjectId;
|
|
112
112
|
loyalty_points: number;
|
|
113
|
+
cashback_balance: number;
|
|
114
|
+
gift_cards: Map<string, number>;
|
|
115
|
+
voucher_codes: Map<string, number>;
|
|
113
116
|
address_details: {
|
|
114
117
|
city: string;
|
|
115
118
|
address_instructions: string;
|
|
@@ -151,6 +154,7 @@ export declare const CustomersSchema: Schema<any, import("mongoose").Model<any,
|
|
|
151
154
|
card_id: string;
|
|
152
155
|
}>;
|
|
153
156
|
order_ids: import("mongoose").Types.ObjectId[];
|
|
157
|
+
is_disabled?: boolean | null | undefined;
|
|
154
158
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
155
159
|
createdAt: NativeDate;
|
|
156
160
|
updatedAt: NativeDate;
|
|
@@ -258,6 +262,9 @@ export declare const CustomersSchema: Schema<any, import("mongoose").Model<any,
|
|
|
258
262
|
last_order_at: NativeDate;
|
|
259
263
|
last_order_id: import("mongoose").Types.ObjectId;
|
|
260
264
|
loyalty_points: number;
|
|
265
|
+
cashback_balance: number;
|
|
266
|
+
gift_cards: Map<string, number>;
|
|
267
|
+
voucher_codes: Map<string, number>;
|
|
261
268
|
address_details: {
|
|
262
269
|
city: string;
|
|
263
270
|
address_instructions: string;
|
|
@@ -299,6 +306,7 @@ export declare const CustomersSchema: Schema<any, import("mongoose").Model<any,
|
|
|
299
306
|
card_id: string;
|
|
300
307
|
}>;
|
|
301
308
|
order_ids: import("mongoose").Types.ObjectId[];
|
|
309
|
+
is_disabled?: boolean | null | undefined;
|
|
302
310
|
}>> & import("mongoose").FlatRecord<{
|
|
303
311
|
createdAt: NativeDate;
|
|
304
312
|
updatedAt: NativeDate;
|
|
@@ -406,6 +414,9 @@ export declare const CustomersSchema: Schema<any, import("mongoose").Model<any,
|
|
|
406
414
|
last_order_at: NativeDate;
|
|
407
415
|
last_order_id: import("mongoose").Types.ObjectId;
|
|
408
416
|
loyalty_points: number;
|
|
417
|
+
cashback_balance: number;
|
|
418
|
+
gift_cards: Map<string, number>;
|
|
419
|
+
voucher_codes: Map<string, number>;
|
|
409
420
|
address_details: {
|
|
410
421
|
city: string;
|
|
411
422
|
address_instructions: string;
|
|
@@ -447,6 +458,7 @@ export declare const CustomersSchema: Schema<any, import("mongoose").Model<any,
|
|
|
447
458
|
card_id: string;
|
|
448
459
|
}>;
|
|
449
460
|
order_ids: import("mongoose").Types.ObjectId[];
|
|
461
|
+
is_disabled?: boolean | null | undefined;
|
|
450
462
|
}> & Required<{
|
|
451
463
|
_id: import("mongoose").Types.ObjectId;
|
|
452
464
|
}> & {
|
|
@@ -134,6 +134,10 @@ exports.CustomersSchema = new mongoose_1.Schema({
|
|
|
134
134
|
type: Boolean,
|
|
135
135
|
default: true,
|
|
136
136
|
},
|
|
137
|
+
is_disabled: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
required: false,
|
|
140
|
+
},
|
|
137
141
|
gender: {
|
|
138
142
|
type: String,
|
|
139
143
|
default: null,
|
|
@@ -166,6 +170,20 @@ exports.CustomersSchema = new mongoose_1.Schema({
|
|
|
166
170
|
type: Number,
|
|
167
171
|
default: 0,
|
|
168
172
|
},
|
|
173
|
+
cashback_balance: {
|
|
174
|
+
type: Number,
|
|
175
|
+
default: 0,
|
|
176
|
+
},
|
|
177
|
+
gift_cards: {
|
|
178
|
+
type: Map,
|
|
179
|
+
of: Number,
|
|
180
|
+
default: {},
|
|
181
|
+
},
|
|
182
|
+
voucher_codes: {
|
|
183
|
+
type: Map,
|
|
184
|
+
of: Number,
|
|
185
|
+
default: {},
|
|
186
|
+
},
|
|
169
187
|
address_details: {
|
|
170
188
|
type: CustomerAddressDetailsSchema,
|
|
171
189
|
default: null,
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
3
|
+
timestamps: true;
|
|
4
|
+
versionKey: false;
|
|
5
|
+
minimize: false;
|
|
6
|
+
}, {
|
|
7
|
+
createdAt: NativeDate;
|
|
8
|
+
updatedAt: NativeDate;
|
|
9
|
+
} & {
|
|
10
|
+
_id: import("mongoose").Types.ObjectId;
|
|
11
|
+
name: string;
|
|
12
|
+
tenants: string[];
|
|
13
|
+
createdAt: NativeDate;
|
|
14
|
+
updatedAt: NativeDate;
|
|
15
|
+
description: string;
|
|
16
|
+
brand_id: string;
|
|
17
|
+
active: boolean;
|
|
18
|
+
code: string;
|
|
19
|
+
reward_type: import("../../constants").GIFT_CARD_REWARD_TYPE_ENUM;
|
|
20
|
+
used_count: number;
|
|
21
|
+
reward_items?: any;
|
|
22
|
+
reward_discount?: any;
|
|
23
|
+
reward_discount_items?: any;
|
|
24
|
+
reward_points?: any;
|
|
25
|
+
reward_cashback?: any;
|
|
26
|
+
reward_voucher?: any;
|
|
27
|
+
max_uses?: number | null | undefined;
|
|
28
|
+
max_uses_per_customer?: number | null | undefined;
|
|
29
|
+
last_used_at?: NativeDate | null | undefined;
|
|
30
|
+
expire_at?: NativeDate | null | undefined;
|
|
31
|
+
reward_mystery_gift?: {
|
|
32
|
+
choice_of_rewards: string[];
|
|
33
|
+
reward_items?: any;
|
|
34
|
+
reward_discount?: any;
|
|
35
|
+
reward_discount_items?: any;
|
|
36
|
+
reward_points?: any;
|
|
37
|
+
reward_cashback?: any;
|
|
38
|
+
reward_voucher?: any;
|
|
39
|
+
} | null | undefined;
|
|
40
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
41
|
+
createdAt: NativeDate;
|
|
42
|
+
updatedAt: NativeDate;
|
|
43
|
+
} & {
|
|
44
|
+
_id: import("mongoose").Types.ObjectId;
|
|
45
|
+
name: string;
|
|
46
|
+
tenants: string[];
|
|
47
|
+
createdAt: NativeDate;
|
|
48
|
+
updatedAt: NativeDate;
|
|
49
|
+
description: string;
|
|
50
|
+
brand_id: string;
|
|
51
|
+
active: boolean;
|
|
52
|
+
code: string;
|
|
53
|
+
reward_type: import("../../constants").GIFT_CARD_REWARD_TYPE_ENUM;
|
|
54
|
+
used_count: number;
|
|
55
|
+
reward_items?: any;
|
|
56
|
+
reward_discount?: any;
|
|
57
|
+
reward_discount_items?: any;
|
|
58
|
+
reward_points?: any;
|
|
59
|
+
reward_cashback?: any;
|
|
60
|
+
reward_voucher?: any;
|
|
61
|
+
max_uses?: number | null | undefined;
|
|
62
|
+
max_uses_per_customer?: number | null | undefined;
|
|
63
|
+
last_used_at?: NativeDate | null | undefined;
|
|
64
|
+
expire_at?: NativeDate | null | undefined;
|
|
65
|
+
reward_mystery_gift?: {
|
|
66
|
+
choice_of_rewards: string[];
|
|
67
|
+
reward_items?: any;
|
|
68
|
+
reward_discount?: any;
|
|
69
|
+
reward_discount_items?: any;
|
|
70
|
+
reward_points?: any;
|
|
71
|
+
reward_cashback?: any;
|
|
72
|
+
reward_voucher?: any;
|
|
73
|
+
} | null | undefined;
|
|
74
|
+
}>> & import("mongoose").FlatRecord<{
|
|
75
|
+
createdAt: NativeDate;
|
|
76
|
+
updatedAt: NativeDate;
|
|
77
|
+
} & {
|
|
78
|
+
_id: import("mongoose").Types.ObjectId;
|
|
79
|
+
name: string;
|
|
80
|
+
tenants: string[];
|
|
81
|
+
createdAt: NativeDate;
|
|
82
|
+
updatedAt: NativeDate;
|
|
83
|
+
description: string;
|
|
84
|
+
brand_id: string;
|
|
85
|
+
active: boolean;
|
|
86
|
+
code: string;
|
|
87
|
+
reward_type: import("../../constants").GIFT_CARD_REWARD_TYPE_ENUM;
|
|
88
|
+
used_count: number;
|
|
89
|
+
reward_items?: any;
|
|
90
|
+
reward_discount?: any;
|
|
91
|
+
reward_discount_items?: any;
|
|
92
|
+
reward_points?: any;
|
|
93
|
+
reward_cashback?: any;
|
|
94
|
+
reward_voucher?: any;
|
|
95
|
+
max_uses?: number | null | undefined;
|
|
96
|
+
max_uses_per_customer?: number | null | undefined;
|
|
97
|
+
last_used_at?: NativeDate | null | undefined;
|
|
98
|
+
expire_at?: NativeDate | null | undefined;
|
|
99
|
+
reward_mystery_gift?: {
|
|
100
|
+
choice_of_rewards: string[];
|
|
101
|
+
reward_items?: any;
|
|
102
|
+
reward_discount?: any;
|
|
103
|
+
reward_discount_items?: any;
|
|
104
|
+
reward_points?: any;
|
|
105
|
+
reward_cashback?: any;
|
|
106
|
+
reward_voucher?: any;
|
|
107
|
+
} | null | undefined;
|
|
108
|
+
}> & Required<{
|
|
109
|
+
_id: import("mongoose").Types.ObjectId;
|
|
110
|
+
}> & {
|
|
111
|
+
__v: number;
|
|
112
|
+
}>;
|
|
113
|
+
export declare const GIFT_CARDS_COLLECTION_NAME = "gift_cards";
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GIFT_CARDS_COLLECTION_NAME = exports.GiftCardsSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const RewardMysteryGiftSchema = new mongoose_1.Schema({
|
|
7
|
+
choice_of_rewards: {
|
|
8
|
+
type: [String],
|
|
9
|
+
enum: constants_1.ALL_MYSTERY_GIFT_TYPES,
|
|
10
|
+
required: true,
|
|
11
|
+
min: 1,
|
|
12
|
+
},
|
|
13
|
+
reward_discount: {
|
|
14
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
15
|
+
required: false,
|
|
16
|
+
},
|
|
17
|
+
reward_discount_items: {
|
|
18
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
19
|
+
required: false,
|
|
20
|
+
},
|
|
21
|
+
reward_points: {
|
|
22
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
23
|
+
required: false,
|
|
24
|
+
},
|
|
25
|
+
reward_cashback: {
|
|
26
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
27
|
+
required: false,
|
|
28
|
+
},
|
|
29
|
+
reward_items: {
|
|
30
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
31
|
+
required: false,
|
|
32
|
+
},
|
|
33
|
+
reward_voucher: {
|
|
34
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
35
|
+
required: false,
|
|
36
|
+
},
|
|
37
|
+
}, {
|
|
38
|
+
_id: false,
|
|
39
|
+
minimize: false,
|
|
40
|
+
});
|
|
41
|
+
exports.GiftCardsSchema = new mongoose_1.Schema({
|
|
42
|
+
_id: {
|
|
43
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
44
|
+
required: true,
|
|
45
|
+
immutable: true,
|
|
46
|
+
},
|
|
47
|
+
code: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: true,
|
|
50
|
+
trim: true,
|
|
51
|
+
uppercase: true,
|
|
52
|
+
},
|
|
53
|
+
brand_id: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: true,
|
|
56
|
+
immutable: true,
|
|
57
|
+
ref: 'brands',
|
|
58
|
+
},
|
|
59
|
+
tenants: {
|
|
60
|
+
type: [{ type: String, ref: 'tenants' }],
|
|
61
|
+
required: true,
|
|
62
|
+
},
|
|
63
|
+
name: {
|
|
64
|
+
type: String,
|
|
65
|
+
required: true,
|
|
66
|
+
},
|
|
67
|
+
description: {
|
|
68
|
+
type: String,
|
|
69
|
+
required: true,
|
|
70
|
+
},
|
|
71
|
+
active: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: true,
|
|
74
|
+
},
|
|
75
|
+
max_uses: {
|
|
76
|
+
type: Number,
|
|
77
|
+
required: false,
|
|
78
|
+
default: null,
|
|
79
|
+
},
|
|
80
|
+
max_uses_per_customer: {
|
|
81
|
+
type: Number,
|
|
82
|
+
required: false,
|
|
83
|
+
default: null,
|
|
84
|
+
},
|
|
85
|
+
used_count: {
|
|
86
|
+
type: Number,
|
|
87
|
+
required: true,
|
|
88
|
+
default: 0,
|
|
89
|
+
},
|
|
90
|
+
last_used_at: {
|
|
91
|
+
type: mongoose_1.Schema.Types.Date,
|
|
92
|
+
required: false,
|
|
93
|
+
default: null,
|
|
94
|
+
},
|
|
95
|
+
reward_type: {
|
|
96
|
+
type: String,
|
|
97
|
+
enum: constants_1.ALL_GIFT_CARD_REWARD_TYPES,
|
|
98
|
+
required: true,
|
|
99
|
+
},
|
|
100
|
+
reward_items: {
|
|
101
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
102
|
+
required: false,
|
|
103
|
+
},
|
|
104
|
+
reward_discount: {
|
|
105
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
106
|
+
required: false,
|
|
107
|
+
},
|
|
108
|
+
reward_discount_items: {
|
|
109
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
110
|
+
required: false,
|
|
111
|
+
},
|
|
112
|
+
reward_points: {
|
|
113
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
114
|
+
required: false,
|
|
115
|
+
},
|
|
116
|
+
reward_cashback: {
|
|
117
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
118
|
+
required: false,
|
|
119
|
+
},
|
|
120
|
+
reward_voucher: {
|
|
121
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
122
|
+
required: false,
|
|
123
|
+
},
|
|
124
|
+
reward_mystery_gift: {
|
|
125
|
+
type: RewardMysteryGiftSchema,
|
|
126
|
+
required: false,
|
|
127
|
+
},
|
|
128
|
+
expire_at: {
|
|
129
|
+
type: mongoose_1.Schema.Types.Date,
|
|
130
|
+
required: false,
|
|
131
|
+
default: null,
|
|
132
|
+
},
|
|
133
|
+
createdAt: {
|
|
134
|
+
type: mongoose_1.Schema.Types.Date,
|
|
135
|
+
required: true,
|
|
136
|
+
default: () => new Date(),
|
|
137
|
+
immutable: true,
|
|
138
|
+
},
|
|
139
|
+
updatedAt: {
|
|
140
|
+
type: mongoose_1.Schema.Types.Date,
|
|
141
|
+
required: true,
|
|
142
|
+
default: () => new Date(),
|
|
143
|
+
},
|
|
144
|
+
}, {
|
|
145
|
+
timestamps: true,
|
|
146
|
+
versionKey: false,
|
|
147
|
+
minimize: false,
|
|
148
|
+
});
|
|
149
|
+
exports.GiftCardsSchema.index({ brand_id: 1, code: 1 }, { unique: true });
|
|
150
|
+
exports.GIFT_CARDS_COLLECTION_NAME = 'gift_cards';
|
|
@@ -50,6 +50,7 @@ export * from './tenant_staff';
|
|
|
50
50
|
export * from './terminal_devices';
|
|
51
51
|
export * from './tokens';
|
|
52
52
|
export * from './track_order_number';
|
|
53
|
+
export * from './vouchers';
|
|
53
54
|
export * from './void_order_items';
|
|
54
55
|
export * from './wallet';
|
|
55
56
|
export * from './wallet_transactions';
|
|
@@ -64,3 +65,5 @@ export * from './warehouse_operational_roles';
|
|
|
64
65
|
export * from './warehouse_staff';
|
|
65
66
|
export * from './warehouse_track_order_number';
|
|
66
67
|
export * from './warehouse_vendors';
|
|
68
|
+
export * from './gift_cards';
|
|
69
|
+
export * from './rewards_usage';
|
|
@@ -66,6 +66,7 @@ __exportStar(require("./tenant_staff"), exports);
|
|
|
66
66
|
__exportStar(require("./terminal_devices"), exports);
|
|
67
67
|
__exportStar(require("./tokens"), exports);
|
|
68
68
|
__exportStar(require("./track_order_number"), exports);
|
|
69
|
+
__exportStar(require("./vouchers"), exports);
|
|
69
70
|
__exportStar(require("./void_order_items"), exports);
|
|
70
71
|
__exportStar(require("./wallet"), exports);
|
|
71
72
|
__exportStar(require("./wallet_transactions"), exports);
|
|
@@ -80,3 +81,5 @@ __exportStar(require("./warehouse_operational_roles"), exports);
|
|
|
80
81
|
__exportStar(require("./warehouse_staff"), exports);
|
|
81
82
|
__exportStar(require("./warehouse_track_order_number"), exports);
|
|
82
83
|
__exportStar(require("./warehouse_vendors"), exports);
|
|
84
|
+
__exportStar(require("./gift_cards"), exports);
|
|
85
|
+
__exportStar(require("./rewards_usage"), exports);
|