@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Schema } from 'mongoose';
|
|
2
|
+
import { PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPE_ENUM } from '../../constants';
|
|
2
3
|
export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
3
4
|
timestamps: true;
|
|
4
5
|
versionKey: false;
|
|
@@ -18,7 +19,10 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
18
19
|
active: boolean;
|
|
19
20
|
sort_id: number;
|
|
20
21
|
included_platforms: import("../../constants").PLATFORMS_ENUM[];
|
|
21
|
-
|
|
22
|
+
auto_apply: boolean;
|
|
23
|
+
pathway_to_unlock_type: import("../../constants").PATHWAY_TO_UNLOCK_TYPE_ENUM;
|
|
24
|
+
reward_type: import("../../constants").OFFER_REWARD_TYPE_ENUM;
|
|
25
|
+
offer_special_hours?: import("mongoose").Types.DocumentArray<{
|
|
22
26
|
days_index: import("../../constants").DAY_INDEX_ENUM[];
|
|
23
27
|
disabled_outside_date_range: boolean;
|
|
24
28
|
start_time: number;
|
|
@@ -303,28 +307,35 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
303
307
|
KEETA_DELIVERY: number;
|
|
304
308
|
BASE_PRICE: number;
|
|
305
309
|
} | null | undefined;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
pathway_to_unlock_type: import("../../constants").PATHWAY_TO_UNLOCK_TYPE_ENUM;
|
|
309
|
-
pathway_to_unlock_type_items: {
|
|
310
|
-
item_ids: import("mongoose").Types.ObjectId[];
|
|
310
|
+
}> | null | undefined;
|
|
311
|
+
pathway_to_unlock_type_items?: {
|
|
311
312
|
excluded_refs: string[];
|
|
312
313
|
exclusive_refs: string[];
|
|
313
314
|
num_of_items: number;
|
|
314
315
|
total_amount: number;
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
item_ids?: import("mongoose").Types.ObjectId[] | null | undefined;
|
|
317
|
+
max_claims?: number | null | undefined;
|
|
318
|
+
max_same_item_quantity?: number | null | undefined;
|
|
319
|
+
category_ids?: import("mongoose").Types.ObjectId[] | null | undefined;
|
|
320
|
+
} | null | undefined;
|
|
321
|
+
pathway_to_unlock_type_orders?: {
|
|
318
322
|
total_amount: number;
|
|
319
323
|
min_num_of_orders: number;
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
324
|
+
max_amount?: number | null | undefined;
|
|
325
|
+
scope?: PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPE_ENUM | null | undefined;
|
|
326
|
+
max_num_of_orders?: number | null | undefined;
|
|
327
|
+
} | null | undefined;
|
|
328
|
+
pathway_to_unlock_type_points?: {
|
|
323
329
|
total_amount: number;
|
|
324
330
|
num_of_points: number;
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
331
|
+
max_claims?: number | null | undefined;
|
|
332
|
+
} | null | undefined;
|
|
333
|
+
pathway_to_unlock_type_vouchers?: {
|
|
334
|
+
total_amount: number;
|
|
335
|
+
voucher_ids: import("mongoose").Types.ObjectId[];
|
|
336
|
+
max_amount?: number | null | undefined;
|
|
337
|
+
} | null | undefined;
|
|
338
|
+
reward_items?: {
|
|
328
339
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
329
340
|
excluded_refs: string[];
|
|
330
341
|
exclusive_refs: string[];
|
|
@@ -339,13 +350,13 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
339
350
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
340
351
|
quantity: number;
|
|
341
352
|
}> | null | undefined;
|
|
342
|
-
};
|
|
343
|
-
reward_discount
|
|
353
|
+
} | null | undefined;
|
|
354
|
+
reward_discount?: {
|
|
344
355
|
is_discount_percentage: boolean;
|
|
345
356
|
excluded_refs: string[];
|
|
346
357
|
discount_value: number;
|
|
347
|
-
};
|
|
348
|
-
reward_discount_items
|
|
358
|
+
} | null | undefined;
|
|
359
|
+
reward_discount_items?: {
|
|
349
360
|
is_discount_percentage: boolean;
|
|
350
361
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
351
362
|
excluded_refs: string[];
|
|
@@ -362,11 +373,23 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
362
373
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
363
374
|
quantity: number;
|
|
364
375
|
}> | null | undefined;
|
|
365
|
-
};
|
|
366
|
-
reward_points
|
|
376
|
+
} | null | undefined;
|
|
377
|
+
reward_points?: {
|
|
367
378
|
num_of_points: number;
|
|
368
379
|
once_per_order: boolean;
|
|
369
|
-
};
|
|
380
|
+
} | null | undefined;
|
|
381
|
+
reward_cashback?: {
|
|
382
|
+
excluded_refs: string[];
|
|
383
|
+
cashback_value: number;
|
|
384
|
+
is_cashback_percentage: boolean;
|
|
385
|
+
max_cashback_amount?: number | null | undefined;
|
|
386
|
+
} | null | undefined;
|
|
387
|
+
reward_gift_cards?: {
|
|
388
|
+
gift_card_ids: Map<string, number>;
|
|
389
|
+
} | null | undefined;
|
|
390
|
+
reward_voucher?: {
|
|
391
|
+
voucher_ids: Map<string, number>;
|
|
392
|
+
} | null | undefined;
|
|
370
393
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
371
394
|
createdAt: NativeDate;
|
|
372
395
|
updatedAt: NativeDate;
|
|
@@ -382,7 +405,10 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
382
405
|
active: boolean;
|
|
383
406
|
sort_id: number;
|
|
384
407
|
included_platforms: import("../../constants").PLATFORMS_ENUM[];
|
|
385
|
-
|
|
408
|
+
auto_apply: boolean;
|
|
409
|
+
pathway_to_unlock_type: import("../../constants").PATHWAY_TO_UNLOCK_TYPE_ENUM;
|
|
410
|
+
reward_type: import("../../constants").OFFER_REWARD_TYPE_ENUM;
|
|
411
|
+
offer_special_hours?: import("mongoose").Types.DocumentArray<{
|
|
386
412
|
days_index: import("../../constants").DAY_INDEX_ENUM[];
|
|
387
413
|
disabled_outside_date_range: boolean;
|
|
388
414
|
start_time: number;
|
|
@@ -667,28 +693,35 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
667
693
|
KEETA_DELIVERY: number;
|
|
668
694
|
BASE_PRICE: number;
|
|
669
695
|
} | null | undefined;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
pathway_to_unlock_type: import("../../constants").PATHWAY_TO_UNLOCK_TYPE_ENUM;
|
|
673
|
-
pathway_to_unlock_type_items: {
|
|
674
|
-
item_ids: import("mongoose").Types.ObjectId[];
|
|
696
|
+
}> | null | undefined;
|
|
697
|
+
pathway_to_unlock_type_items?: {
|
|
675
698
|
excluded_refs: string[];
|
|
676
699
|
exclusive_refs: string[];
|
|
677
700
|
num_of_items: number;
|
|
678
701
|
total_amount: number;
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
702
|
+
item_ids?: import("mongoose").Types.ObjectId[] | null | undefined;
|
|
703
|
+
max_claims?: number | null | undefined;
|
|
704
|
+
max_same_item_quantity?: number | null | undefined;
|
|
705
|
+
category_ids?: import("mongoose").Types.ObjectId[] | null | undefined;
|
|
706
|
+
} | null | undefined;
|
|
707
|
+
pathway_to_unlock_type_orders?: {
|
|
682
708
|
total_amount: number;
|
|
683
709
|
min_num_of_orders: number;
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
710
|
+
max_amount?: number | null | undefined;
|
|
711
|
+
scope?: PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPE_ENUM | null | undefined;
|
|
712
|
+
max_num_of_orders?: number | null | undefined;
|
|
713
|
+
} | null | undefined;
|
|
714
|
+
pathway_to_unlock_type_points?: {
|
|
687
715
|
total_amount: number;
|
|
688
716
|
num_of_points: number;
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
717
|
+
max_claims?: number | null | undefined;
|
|
718
|
+
} | null | undefined;
|
|
719
|
+
pathway_to_unlock_type_vouchers?: {
|
|
720
|
+
total_amount: number;
|
|
721
|
+
voucher_ids: import("mongoose").Types.ObjectId[];
|
|
722
|
+
max_amount?: number | null | undefined;
|
|
723
|
+
} | null | undefined;
|
|
724
|
+
reward_items?: {
|
|
692
725
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
693
726
|
excluded_refs: string[];
|
|
694
727
|
exclusive_refs: string[];
|
|
@@ -703,13 +736,13 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
703
736
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
704
737
|
quantity: number;
|
|
705
738
|
}> | null | undefined;
|
|
706
|
-
};
|
|
707
|
-
reward_discount
|
|
739
|
+
} | null | undefined;
|
|
740
|
+
reward_discount?: {
|
|
708
741
|
is_discount_percentage: boolean;
|
|
709
742
|
excluded_refs: string[];
|
|
710
743
|
discount_value: number;
|
|
711
|
-
};
|
|
712
|
-
reward_discount_items
|
|
744
|
+
} | null | undefined;
|
|
745
|
+
reward_discount_items?: {
|
|
713
746
|
is_discount_percentage: boolean;
|
|
714
747
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
715
748
|
excluded_refs: string[];
|
|
@@ -726,11 +759,23 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
726
759
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
727
760
|
quantity: number;
|
|
728
761
|
}> | null | undefined;
|
|
729
|
-
};
|
|
730
|
-
reward_points
|
|
762
|
+
} | null | undefined;
|
|
763
|
+
reward_points?: {
|
|
731
764
|
num_of_points: number;
|
|
732
765
|
once_per_order: boolean;
|
|
733
|
-
};
|
|
766
|
+
} | null | undefined;
|
|
767
|
+
reward_cashback?: {
|
|
768
|
+
excluded_refs: string[];
|
|
769
|
+
cashback_value: number;
|
|
770
|
+
is_cashback_percentage: boolean;
|
|
771
|
+
max_cashback_amount?: number | null | undefined;
|
|
772
|
+
} | null | undefined;
|
|
773
|
+
reward_gift_cards?: {
|
|
774
|
+
gift_card_ids: Map<string, number>;
|
|
775
|
+
} | null | undefined;
|
|
776
|
+
reward_voucher?: {
|
|
777
|
+
voucher_ids: Map<string, number>;
|
|
778
|
+
} | null | undefined;
|
|
734
779
|
}>> & import("mongoose").FlatRecord<{
|
|
735
780
|
createdAt: NativeDate;
|
|
736
781
|
updatedAt: NativeDate;
|
|
@@ -746,7 +791,10 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
746
791
|
active: boolean;
|
|
747
792
|
sort_id: number;
|
|
748
793
|
included_platforms: import("../../constants").PLATFORMS_ENUM[];
|
|
749
|
-
|
|
794
|
+
auto_apply: boolean;
|
|
795
|
+
pathway_to_unlock_type: import("../../constants").PATHWAY_TO_UNLOCK_TYPE_ENUM;
|
|
796
|
+
reward_type: import("../../constants").OFFER_REWARD_TYPE_ENUM;
|
|
797
|
+
offer_special_hours?: import("mongoose").Types.DocumentArray<{
|
|
750
798
|
days_index: import("../../constants").DAY_INDEX_ENUM[];
|
|
751
799
|
disabled_outside_date_range: boolean;
|
|
752
800
|
start_time: number;
|
|
@@ -1031,28 +1079,35 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
1031
1079
|
KEETA_DELIVERY: number;
|
|
1032
1080
|
BASE_PRICE: number;
|
|
1033
1081
|
} | null | undefined;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
pathway_to_unlock_type: import("../../constants").PATHWAY_TO_UNLOCK_TYPE_ENUM;
|
|
1037
|
-
pathway_to_unlock_type_items: {
|
|
1038
|
-
item_ids: import("mongoose").Types.ObjectId[];
|
|
1082
|
+
}> | null | undefined;
|
|
1083
|
+
pathway_to_unlock_type_items?: {
|
|
1039
1084
|
excluded_refs: string[];
|
|
1040
1085
|
exclusive_refs: string[];
|
|
1041
1086
|
num_of_items: number;
|
|
1042
1087
|
total_amount: number;
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1088
|
+
item_ids?: import("mongoose").Types.ObjectId[] | null | undefined;
|
|
1089
|
+
max_claims?: number | null | undefined;
|
|
1090
|
+
max_same_item_quantity?: number | null | undefined;
|
|
1091
|
+
category_ids?: import("mongoose").Types.ObjectId[] | null | undefined;
|
|
1092
|
+
} | null | undefined;
|
|
1093
|
+
pathway_to_unlock_type_orders?: {
|
|
1046
1094
|
total_amount: number;
|
|
1047
1095
|
min_num_of_orders: number;
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1096
|
+
max_amount?: number | null | undefined;
|
|
1097
|
+
scope?: PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPE_ENUM | null | undefined;
|
|
1098
|
+
max_num_of_orders?: number | null | undefined;
|
|
1099
|
+
} | null | undefined;
|
|
1100
|
+
pathway_to_unlock_type_points?: {
|
|
1051
1101
|
total_amount: number;
|
|
1052
1102
|
num_of_points: number;
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1103
|
+
max_claims?: number | null | undefined;
|
|
1104
|
+
} | null | undefined;
|
|
1105
|
+
pathway_to_unlock_type_vouchers?: {
|
|
1106
|
+
total_amount: number;
|
|
1107
|
+
voucher_ids: import("mongoose").Types.ObjectId[];
|
|
1108
|
+
max_amount?: number | null | undefined;
|
|
1109
|
+
} | null | undefined;
|
|
1110
|
+
reward_items?: {
|
|
1056
1111
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
1057
1112
|
excluded_refs: string[];
|
|
1058
1113
|
exclusive_refs: string[];
|
|
@@ -1067,13 +1122,13 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
1067
1122
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
1068
1123
|
quantity: number;
|
|
1069
1124
|
}> | null | undefined;
|
|
1070
|
-
};
|
|
1071
|
-
reward_discount
|
|
1125
|
+
} | null | undefined;
|
|
1126
|
+
reward_discount?: {
|
|
1072
1127
|
is_discount_percentage: boolean;
|
|
1073
1128
|
excluded_refs: string[];
|
|
1074
1129
|
discount_value: number;
|
|
1075
|
-
};
|
|
1076
|
-
reward_discount_items
|
|
1130
|
+
} | null | undefined;
|
|
1131
|
+
reward_discount_items?: {
|
|
1077
1132
|
is_discount_percentage: boolean;
|
|
1078
1133
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
1079
1134
|
excluded_refs: string[];
|
|
@@ -1090,11 +1145,23 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
1090
1145
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
1091
1146
|
quantity: number;
|
|
1092
1147
|
}> | null | undefined;
|
|
1093
|
-
};
|
|
1094
|
-
reward_points
|
|
1148
|
+
} | null | undefined;
|
|
1149
|
+
reward_points?: {
|
|
1095
1150
|
num_of_points: number;
|
|
1096
1151
|
once_per_order: boolean;
|
|
1097
|
-
};
|
|
1152
|
+
} | null | undefined;
|
|
1153
|
+
reward_cashback?: {
|
|
1154
|
+
excluded_refs: string[];
|
|
1155
|
+
cashback_value: number;
|
|
1156
|
+
is_cashback_percentage: boolean;
|
|
1157
|
+
max_cashback_amount?: number | null | undefined;
|
|
1158
|
+
} | null | undefined;
|
|
1159
|
+
reward_gift_cards?: {
|
|
1160
|
+
gift_card_ids: Map<string, number>;
|
|
1161
|
+
} | null | undefined;
|
|
1162
|
+
reward_voucher?: {
|
|
1163
|
+
voucher_ids: Map<string, number>;
|
|
1164
|
+
} | null | undefined;
|
|
1098
1165
|
}> & Required<{
|
|
1099
1166
|
_id: import("mongoose").Types.ObjectId;
|
|
1100
1167
|
}> & {
|
|
@@ -9,6 +9,16 @@ const PathwayToUnlockTypeItemsSchema = new mongoose_1.Schema({
|
|
|
9
9
|
type: Number,
|
|
10
10
|
required: true,
|
|
11
11
|
},
|
|
12
|
+
max_claims: {
|
|
13
|
+
type: Number,
|
|
14
|
+
required: false,
|
|
15
|
+
default: 1,
|
|
16
|
+
},
|
|
17
|
+
max_same_item_quantity: {
|
|
18
|
+
type: Number,
|
|
19
|
+
required: false,
|
|
20
|
+
default: null,
|
|
21
|
+
},
|
|
12
22
|
total_amount: {
|
|
13
23
|
type: Number,
|
|
14
24
|
required: true,
|
|
@@ -23,21 +33,32 @@ const PathwayToUnlockTypeItemsSchema = new mongoose_1.Schema({
|
|
|
23
33
|
},
|
|
24
34
|
item_ids: {
|
|
25
35
|
type: [mongoose_1.Schema.Types.ObjectId],
|
|
26
|
-
required:
|
|
27
|
-
|
|
36
|
+
required: false,
|
|
37
|
+
default: [],
|
|
38
|
+
},
|
|
39
|
+
category_ids: {
|
|
40
|
+
type: [mongoose_1.Schema.Types.ObjectId],
|
|
41
|
+
required: false,
|
|
42
|
+
default: [],
|
|
28
43
|
},
|
|
29
44
|
}, {
|
|
30
45
|
_id: false,
|
|
31
46
|
minimize: false,
|
|
32
47
|
});
|
|
33
48
|
const PathwayToUnlockTypeOrdersSchema = new mongoose_1.Schema({
|
|
49
|
+
scope: {
|
|
50
|
+
type: String,
|
|
51
|
+
enum: constants_1.ALL_PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPES,
|
|
52
|
+
required: false,
|
|
53
|
+
default: constants_1.PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPE_ENUM.OVERALL,
|
|
54
|
+
},
|
|
34
55
|
min_num_of_orders: {
|
|
35
56
|
type: Number,
|
|
36
57
|
required: true,
|
|
37
58
|
},
|
|
38
59
|
max_num_of_orders: {
|
|
39
60
|
type: Number,
|
|
40
|
-
|
|
61
|
+
required: false,
|
|
41
62
|
},
|
|
42
63
|
total_amount: {
|
|
43
64
|
type: Number,
|
|
@@ -45,7 +66,7 @@ const PathwayToUnlockTypeOrdersSchema = new mongoose_1.Schema({
|
|
|
45
66
|
},
|
|
46
67
|
max_amount: {
|
|
47
68
|
type: Number,
|
|
48
|
-
|
|
69
|
+
required: false,
|
|
49
70
|
},
|
|
50
71
|
}, {
|
|
51
72
|
_id: false,
|
|
@@ -60,6 +81,28 @@ const PathwayToUnlockTypePointsSchema = new mongoose_1.Schema({
|
|
|
60
81
|
type: Number,
|
|
61
82
|
required: true,
|
|
62
83
|
},
|
|
84
|
+
max_claims: {
|
|
85
|
+
type: Number,
|
|
86
|
+
required: false,
|
|
87
|
+
},
|
|
88
|
+
}, {
|
|
89
|
+
_id: false,
|
|
90
|
+
minimize: false,
|
|
91
|
+
});
|
|
92
|
+
const PathwayToUnlockTypeVouchersSchema = new mongoose_1.Schema({
|
|
93
|
+
total_amount: {
|
|
94
|
+
type: Number,
|
|
95
|
+
required: true,
|
|
96
|
+
},
|
|
97
|
+
max_amount: {
|
|
98
|
+
type: Number,
|
|
99
|
+
required: false,
|
|
100
|
+
},
|
|
101
|
+
voucher_ids: {
|
|
102
|
+
type: [mongoose_1.Schema.Types.ObjectId],
|
|
103
|
+
required: true,
|
|
104
|
+
min: 1,
|
|
105
|
+
},
|
|
63
106
|
}, {
|
|
64
107
|
_id: false,
|
|
65
108
|
minimize: false,
|
|
@@ -179,6 +222,47 @@ const RewardPointsSchema = new mongoose_1.Schema({
|
|
|
179
222
|
_id: false,
|
|
180
223
|
minimize: false,
|
|
181
224
|
});
|
|
225
|
+
const RewardCashbackSchema = new mongoose_1.Schema({
|
|
226
|
+
cashback_value: {
|
|
227
|
+
type: Number,
|
|
228
|
+
required: true,
|
|
229
|
+
},
|
|
230
|
+
is_cashback_percentage: {
|
|
231
|
+
type: Boolean,
|
|
232
|
+
default: false,
|
|
233
|
+
},
|
|
234
|
+
max_cashback_amount: {
|
|
235
|
+
type: Number,
|
|
236
|
+
required: false,
|
|
237
|
+
},
|
|
238
|
+
excluded_refs: {
|
|
239
|
+
type: [String],
|
|
240
|
+
default: [],
|
|
241
|
+
},
|
|
242
|
+
}, {
|
|
243
|
+
_id: false,
|
|
244
|
+
minimize: false,
|
|
245
|
+
});
|
|
246
|
+
const RewardGiftCardsSchema = new mongoose_1.Schema({
|
|
247
|
+
gift_card_ids: {
|
|
248
|
+
type: Map,
|
|
249
|
+
of: Number,
|
|
250
|
+
required: true,
|
|
251
|
+
},
|
|
252
|
+
}, {
|
|
253
|
+
_id: false,
|
|
254
|
+
minimize: false,
|
|
255
|
+
});
|
|
256
|
+
const RewardVoucherSchema = new mongoose_1.Schema({
|
|
257
|
+
voucher_ids: {
|
|
258
|
+
type: Map,
|
|
259
|
+
of: Number,
|
|
260
|
+
required: true,
|
|
261
|
+
},
|
|
262
|
+
}, {
|
|
263
|
+
_id: false,
|
|
264
|
+
minimize: false,
|
|
265
|
+
});
|
|
182
266
|
// ================== ==================
|
|
183
267
|
exports.OfferSchema = new mongoose_1.Schema({
|
|
184
268
|
_id: {
|
|
@@ -223,7 +307,7 @@ exports.OfferSchema = new mongoose_1.Schema({
|
|
|
223
307
|
},
|
|
224
308
|
offer_special_hours: {
|
|
225
309
|
type: [item_1.SpecialHoursSchema],
|
|
226
|
-
|
|
310
|
+
required: false,
|
|
227
311
|
},
|
|
228
312
|
auto_apply: {
|
|
229
313
|
type: Boolean,
|
|
@@ -236,15 +320,19 @@ exports.OfferSchema = new mongoose_1.Schema({
|
|
|
236
320
|
},
|
|
237
321
|
pathway_to_unlock_type_items: {
|
|
238
322
|
type: PathwayToUnlockTypeItemsSchema,
|
|
239
|
-
|
|
323
|
+
required: false,
|
|
240
324
|
},
|
|
241
325
|
pathway_to_unlock_type_orders: {
|
|
242
326
|
type: PathwayToUnlockTypeOrdersSchema,
|
|
243
|
-
|
|
327
|
+
required: false,
|
|
244
328
|
},
|
|
245
329
|
pathway_to_unlock_type_points: {
|
|
246
330
|
type: PathwayToUnlockTypePointsSchema,
|
|
247
|
-
|
|
331
|
+
required: false,
|
|
332
|
+
},
|
|
333
|
+
pathway_to_unlock_type_vouchers: {
|
|
334
|
+
type: PathwayToUnlockTypeVouchersSchema,
|
|
335
|
+
required: false,
|
|
248
336
|
},
|
|
249
337
|
reward_type: {
|
|
250
338
|
type: String,
|
|
@@ -253,19 +341,31 @@ exports.OfferSchema = new mongoose_1.Schema({
|
|
|
253
341
|
},
|
|
254
342
|
reward_items: {
|
|
255
343
|
type: RewardItemsSchema,
|
|
256
|
-
|
|
344
|
+
required: false,
|
|
257
345
|
},
|
|
258
346
|
reward_discount: {
|
|
259
347
|
type: RewardDiscountSchema,
|
|
260
|
-
|
|
348
|
+
required: false,
|
|
261
349
|
},
|
|
262
350
|
reward_discount_items: {
|
|
263
351
|
type: RewardDiscountItemsSchema,
|
|
264
|
-
|
|
352
|
+
required: false,
|
|
265
353
|
},
|
|
266
354
|
reward_points: {
|
|
267
355
|
type: RewardPointsSchema,
|
|
268
|
-
|
|
356
|
+
required: false,
|
|
357
|
+
},
|
|
358
|
+
reward_cashback: {
|
|
359
|
+
type: RewardCashbackSchema,
|
|
360
|
+
required: false,
|
|
361
|
+
},
|
|
362
|
+
reward_gift_cards: {
|
|
363
|
+
type: RewardGiftCardsSchema,
|
|
364
|
+
required: false,
|
|
365
|
+
},
|
|
366
|
+
reward_voucher: {
|
|
367
|
+
type: RewardVoucherSchema,
|
|
368
|
+
required: false,
|
|
269
369
|
},
|
|
270
370
|
createdAt: {
|
|
271
371
|
type: mongoose_1.Schema.Types.Date,
|
|
@@ -5184,6 +5184,7 @@ export declare const OrderSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
5184
5184
|
is_reopened?: boolean | null | undefined;
|
|
5185
5185
|
deferred_settlement?: boolean | null | undefined;
|
|
5186
5186
|
payment_method_expected?: import("../../constants").PAYMENT_METHOD_EXPECTED_ENUM | null | undefined;
|
|
5187
|
+
redeemed_offers?: Map<string, number> | null | undefined;
|
|
5187
5188
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
5188
5189
|
createdAt: NativeDate;
|
|
5189
5190
|
updatedAt: NativeDate;
|
|
@@ -10281,6 +10282,7 @@ export declare const OrderSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
10281
10282
|
is_reopened?: boolean | null | undefined;
|
|
10282
10283
|
deferred_settlement?: boolean | null | undefined;
|
|
10283
10284
|
payment_method_expected?: import("../../constants").PAYMENT_METHOD_EXPECTED_ENUM | null | undefined;
|
|
10285
|
+
redeemed_offers?: Map<string, number> | null | undefined;
|
|
10284
10286
|
}>> & import("mongoose").FlatRecord<{
|
|
10285
10287
|
createdAt: NativeDate;
|
|
10286
10288
|
updatedAt: NativeDate;
|
|
@@ -15378,6 +15380,7 @@ export declare const OrderSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
15378
15380
|
is_reopened?: boolean | null | undefined;
|
|
15379
15381
|
deferred_settlement?: boolean | null | undefined;
|
|
15380
15382
|
payment_method_expected?: import("../../constants").PAYMENT_METHOD_EXPECTED_ENUM | null | undefined;
|
|
15383
|
+
redeemed_offers?: Map<string, number> | null | undefined;
|
|
15381
15384
|
}> & Required<{
|
|
15382
15385
|
_id: import("mongoose").Types.ObjectId;
|
|
15383
15386
|
}> & {
|
|
@@ -808,6 +808,11 @@ exports.OrderSchema = new mongoose_1.Schema({
|
|
|
808
808
|
type: StaffDetailsSchema,
|
|
809
809
|
required: false,
|
|
810
810
|
},
|
|
811
|
+
redeemed_offers: {
|
|
812
|
+
type: Map,
|
|
813
|
+
of: Number,
|
|
814
|
+
required: false,
|
|
815
|
+
},
|
|
811
816
|
order_settled_at: {
|
|
812
817
|
type: mongoose_1.Schema.Types.Date,
|
|
813
818
|
required: true,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
export declare const RewardsUsageSchema: 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
|
+
createdAt: NativeDate;
|
|
12
|
+
updatedAt: NativeDate;
|
|
13
|
+
ref_id: import("mongoose").Types.ObjectId;
|
|
14
|
+
customer_phone: string;
|
|
15
|
+
ref_type: import("../../constants").REWARDS_USAGE_REF_TYPE_ENUM;
|
|
16
|
+
used_count: number;
|
|
17
|
+
last_used_at: NativeDate;
|
|
18
|
+
assigned_count: number;
|
|
19
|
+
last_assigned_at: NativeDate;
|
|
20
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
21
|
+
createdAt: NativeDate;
|
|
22
|
+
updatedAt: NativeDate;
|
|
23
|
+
} & {
|
|
24
|
+
_id: import("mongoose").Types.ObjectId;
|
|
25
|
+
createdAt: NativeDate;
|
|
26
|
+
updatedAt: NativeDate;
|
|
27
|
+
ref_id: import("mongoose").Types.ObjectId;
|
|
28
|
+
customer_phone: string;
|
|
29
|
+
ref_type: import("../../constants").REWARDS_USAGE_REF_TYPE_ENUM;
|
|
30
|
+
used_count: number;
|
|
31
|
+
last_used_at: NativeDate;
|
|
32
|
+
assigned_count: number;
|
|
33
|
+
last_assigned_at: NativeDate;
|
|
34
|
+
}>> & import("mongoose").FlatRecord<{
|
|
35
|
+
createdAt: NativeDate;
|
|
36
|
+
updatedAt: NativeDate;
|
|
37
|
+
} & {
|
|
38
|
+
_id: import("mongoose").Types.ObjectId;
|
|
39
|
+
createdAt: NativeDate;
|
|
40
|
+
updatedAt: NativeDate;
|
|
41
|
+
ref_id: import("mongoose").Types.ObjectId;
|
|
42
|
+
customer_phone: string;
|
|
43
|
+
ref_type: import("../../constants").REWARDS_USAGE_REF_TYPE_ENUM;
|
|
44
|
+
used_count: number;
|
|
45
|
+
last_used_at: NativeDate;
|
|
46
|
+
assigned_count: number;
|
|
47
|
+
last_assigned_at: NativeDate;
|
|
48
|
+
}> & Required<{
|
|
49
|
+
_id: import("mongoose").Types.ObjectId;
|
|
50
|
+
}> & {
|
|
51
|
+
__v: number;
|
|
52
|
+
}>;
|
|
53
|
+
export declare const REWARDS_USAGE_COLLECTION_NAME = "rewards_usage";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REWARDS_USAGE_COLLECTION_NAME = exports.RewardsUsageSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
exports.RewardsUsageSchema = new mongoose_1.Schema({
|
|
7
|
+
_id: {
|
|
8
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
9
|
+
required: true,
|
|
10
|
+
immutable: true,
|
|
11
|
+
},
|
|
12
|
+
ref_id: {
|
|
13
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
14
|
+
required: true,
|
|
15
|
+
immutable: true,
|
|
16
|
+
},
|
|
17
|
+
ref_type: {
|
|
18
|
+
type: String,
|
|
19
|
+
enum: constants_1.ALL_REWARDS_USAGE_REF_TYPES,
|
|
20
|
+
required: true,
|
|
21
|
+
immutable: true,
|
|
22
|
+
},
|
|
23
|
+
customer_phone: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: true,
|
|
26
|
+
immutable: true,
|
|
27
|
+
},
|
|
28
|
+
assigned_count: {
|
|
29
|
+
type: Number,
|
|
30
|
+
required: true,
|
|
31
|
+
default: 0,
|
|
32
|
+
},
|
|
33
|
+
last_assigned_at: {
|
|
34
|
+
type: mongoose_1.Schema.Types.Date,
|
|
35
|
+
required: true,
|
|
36
|
+
default: null,
|
|
37
|
+
},
|
|
38
|
+
used_count: {
|
|
39
|
+
type: Number,
|
|
40
|
+
required: true,
|
|
41
|
+
default: 0,
|
|
42
|
+
},
|
|
43
|
+
last_used_at: {
|
|
44
|
+
type: mongoose_1.Schema.Types.Date,
|
|
45
|
+
required: true,
|
|
46
|
+
default: null,
|
|
47
|
+
},
|
|
48
|
+
createdAt: {
|
|
49
|
+
type: mongoose_1.Schema.Types.Date,
|
|
50
|
+
required: true,
|
|
51
|
+
default: () => new Date(),
|
|
52
|
+
immutable: true,
|
|
53
|
+
},
|
|
54
|
+
updatedAt: {
|
|
55
|
+
type: mongoose_1.Schema.Types.Date,
|
|
56
|
+
required: true,
|
|
57
|
+
default: () => new Date(),
|
|
58
|
+
},
|
|
59
|
+
}, {
|
|
60
|
+
timestamps: true,
|
|
61
|
+
versionKey: false,
|
|
62
|
+
minimize: false,
|
|
63
|
+
});
|
|
64
|
+
exports.REWARDS_USAGE_COLLECTION_NAME = 'rewards_usage';
|