@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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
export declare const VouchersSchema: 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
|
+
is_public: boolean;
|
|
20
|
+
used_count: number;
|
|
21
|
+
max_uses?: number | null | undefined;
|
|
22
|
+
max_uses_per_customer?: number | null | undefined;
|
|
23
|
+
last_used_at?: NativeDate | null | undefined;
|
|
24
|
+
expire_at?: NativeDate | null | undefined;
|
|
25
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
26
|
+
createdAt: NativeDate;
|
|
27
|
+
updatedAt: NativeDate;
|
|
28
|
+
} & {
|
|
29
|
+
_id: import("mongoose").Types.ObjectId;
|
|
30
|
+
name: string;
|
|
31
|
+
tenants: string[];
|
|
32
|
+
createdAt: NativeDate;
|
|
33
|
+
updatedAt: NativeDate;
|
|
34
|
+
description: string;
|
|
35
|
+
brand_id: string;
|
|
36
|
+
active: boolean;
|
|
37
|
+
code: string;
|
|
38
|
+
is_public: boolean;
|
|
39
|
+
used_count: number;
|
|
40
|
+
max_uses?: number | null | undefined;
|
|
41
|
+
max_uses_per_customer?: number | null | undefined;
|
|
42
|
+
last_used_at?: NativeDate | null | undefined;
|
|
43
|
+
expire_at?: NativeDate | null | undefined;
|
|
44
|
+
}>> & import("mongoose").FlatRecord<{
|
|
45
|
+
createdAt: NativeDate;
|
|
46
|
+
updatedAt: NativeDate;
|
|
47
|
+
} & {
|
|
48
|
+
_id: import("mongoose").Types.ObjectId;
|
|
49
|
+
name: string;
|
|
50
|
+
tenants: string[];
|
|
51
|
+
createdAt: NativeDate;
|
|
52
|
+
updatedAt: NativeDate;
|
|
53
|
+
description: string;
|
|
54
|
+
brand_id: string;
|
|
55
|
+
active: boolean;
|
|
56
|
+
code: string;
|
|
57
|
+
is_public: boolean;
|
|
58
|
+
used_count: number;
|
|
59
|
+
max_uses?: number | null | undefined;
|
|
60
|
+
max_uses_per_customer?: number | null | undefined;
|
|
61
|
+
last_used_at?: NativeDate | null | undefined;
|
|
62
|
+
expire_at?: NativeDate | null | undefined;
|
|
63
|
+
}> & Required<{
|
|
64
|
+
_id: import("mongoose").Types.ObjectId;
|
|
65
|
+
}> & {
|
|
66
|
+
__v: number;
|
|
67
|
+
}>;
|
|
68
|
+
export declare const VOUCHERS_COLLECTION_NAME = "vouchers";
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VOUCHERS_COLLECTION_NAME = exports.VouchersSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
exports.VouchersSchema = new mongoose_1.Schema({
|
|
6
|
+
_id: {
|
|
7
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
8
|
+
required: true,
|
|
9
|
+
immutable: true,
|
|
10
|
+
},
|
|
11
|
+
code: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true,
|
|
14
|
+
trim: true,
|
|
15
|
+
uppercase: true,
|
|
16
|
+
},
|
|
17
|
+
brand_id: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true,
|
|
20
|
+
immutable: true,
|
|
21
|
+
ref: 'brands',
|
|
22
|
+
},
|
|
23
|
+
tenants: {
|
|
24
|
+
type: [{ type: String, ref: 'tenants' }],
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
name: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
description: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
active: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: true,
|
|
38
|
+
},
|
|
39
|
+
is_public: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
max_uses: {
|
|
44
|
+
type: Number,
|
|
45
|
+
required: false,
|
|
46
|
+
default: null,
|
|
47
|
+
},
|
|
48
|
+
max_uses_per_customer: {
|
|
49
|
+
type: Number,
|
|
50
|
+
required: false,
|
|
51
|
+
default: null,
|
|
52
|
+
},
|
|
53
|
+
used_count: {
|
|
54
|
+
type: Number,
|
|
55
|
+
required: true,
|
|
56
|
+
default: 0,
|
|
57
|
+
},
|
|
58
|
+
last_used_at: {
|
|
59
|
+
type: mongoose_1.Schema.Types.Date,
|
|
60
|
+
required: false,
|
|
61
|
+
default: null,
|
|
62
|
+
},
|
|
63
|
+
expire_at: {
|
|
64
|
+
type: mongoose_1.Schema.Types.Date,
|
|
65
|
+
required: false,
|
|
66
|
+
default: null,
|
|
67
|
+
},
|
|
68
|
+
createdAt: {
|
|
69
|
+
type: mongoose_1.Schema.Types.Date,
|
|
70
|
+
required: true,
|
|
71
|
+
default: () => new Date(),
|
|
72
|
+
immutable: true,
|
|
73
|
+
},
|
|
74
|
+
updatedAt: {
|
|
75
|
+
type: mongoose_1.Schema.Types.Date,
|
|
76
|
+
required: true,
|
|
77
|
+
default: () => new Date(),
|
|
78
|
+
},
|
|
79
|
+
}, {
|
|
80
|
+
timestamps: true,
|
|
81
|
+
versionKey: false,
|
|
82
|
+
minimize: false,
|
|
83
|
+
});
|
|
84
|
+
exports.VouchersSchema.index({ brand_id: 1, code: 1 }, { unique: true });
|
|
85
|
+
exports.VOUCHERS_COLLECTION_NAME = 'vouchers';
|
|
@@ -17,8 +17,8 @@ export declare const WarehouseStaffSchema: Schema<any, import("mongoose").Model<
|
|
|
17
17
|
email: string;
|
|
18
18
|
email_verified: boolean;
|
|
19
19
|
phone_number_verified: boolean;
|
|
20
|
-
warehouse_id: string;
|
|
21
20
|
is_disabled: boolean;
|
|
21
|
+
warehouse_id: string;
|
|
22
22
|
staff_auth_code: string;
|
|
23
23
|
role: import("../../constants").USER_ROLES_ENUM;
|
|
24
24
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
@@ -35,8 +35,8 @@ export declare const WarehouseStaffSchema: Schema<any, import("mongoose").Model<
|
|
|
35
35
|
email: string;
|
|
36
36
|
email_verified: boolean;
|
|
37
37
|
phone_number_verified: boolean;
|
|
38
|
-
warehouse_id: string;
|
|
39
38
|
is_disabled: boolean;
|
|
39
|
+
warehouse_id: string;
|
|
40
40
|
staff_auth_code: string;
|
|
41
41
|
role: import("../../constants").USER_ROLES_ENUM;
|
|
42
42
|
}>> & import("mongoose").FlatRecord<{
|
|
@@ -53,8 +53,8 @@ export declare const WarehouseStaffSchema: Schema<any, import("mongoose").Model<
|
|
|
53
53
|
email: string;
|
|
54
54
|
email_verified: boolean;
|
|
55
55
|
phone_number_verified: boolean;
|
|
56
|
-
warehouse_id: string;
|
|
57
56
|
is_disabled: boolean;
|
|
57
|
+
warehouse_id: string;
|
|
58
58
|
staff_auth_code: string;
|
|
59
59
|
role: import("../../constants").USER_ROLES_ENUM;
|
|
60
60
|
}> & Required<{
|
|
@@ -34,6 +34,7 @@ export interface ICustomer {
|
|
|
34
34
|
phone_number_verified: boolean;
|
|
35
35
|
image_url: string | null;
|
|
36
36
|
active: boolean;
|
|
37
|
+
is_disabled?: boolean;
|
|
37
38
|
gender: string | null;
|
|
38
39
|
total_orders_per_platform_type: Partial<IPlatformNumber>;
|
|
39
40
|
total_spent_per_platform_type: Partial<IPlatformNumber>;
|
|
@@ -42,6 +43,9 @@ export interface ICustomer {
|
|
|
42
43
|
last_order_at: Date | null;
|
|
43
44
|
last_order_id: string | null;
|
|
44
45
|
loyalty_points: number;
|
|
46
|
+
cashback_balance: number;
|
|
47
|
+
gift_cards: Record<string, number>;
|
|
48
|
+
voucher_codes: Record<string, number>;
|
|
45
49
|
address_details: ICustomerAddressDetails | null;
|
|
46
50
|
cards: ICustomerCard[];
|
|
47
51
|
order_ids: string[];
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { GIFT_CARD_REWARD_TYPE_ENUM } from '../../constants';
|
|
2
|
+
import { IRewardTypeCashback, IRewardTypeDiscount, IRewardTypeDiscountItems, IRewardTypeItems, IRewardTypeMysteryGift, IRewardTypePoints, IRewardTypeVoucher } from './offers';
|
|
3
|
+
type IGiftCardRewardItems = {
|
|
4
|
+
reward_type: GIFT_CARD_REWARD_TYPE_ENUM.ITEMS;
|
|
5
|
+
reward_items: IRewardTypeItems;
|
|
6
|
+
reward_discount?: null;
|
|
7
|
+
reward_discount_items?: null;
|
|
8
|
+
reward_points?: null;
|
|
9
|
+
reward_cashback?: null;
|
|
10
|
+
reward_voucher?: null;
|
|
11
|
+
reward_mystery_gift?: null;
|
|
12
|
+
};
|
|
13
|
+
type IGiftCardRewardDiscount = {
|
|
14
|
+
reward_type: GIFT_CARD_REWARD_TYPE_ENUM.DISCOUNT;
|
|
15
|
+
reward_items?: null;
|
|
16
|
+
reward_discount: IRewardTypeDiscount;
|
|
17
|
+
reward_discount_items?: null;
|
|
18
|
+
reward_points?: null;
|
|
19
|
+
reward_cashback?: null;
|
|
20
|
+
reward_voucher?: null;
|
|
21
|
+
reward_mystery_gift?: null;
|
|
22
|
+
};
|
|
23
|
+
type IGiftCardRewardDiscountItems = {
|
|
24
|
+
reward_type: GIFT_CARD_REWARD_TYPE_ENUM.DISCOUNT_ITEMS;
|
|
25
|
+
reward_items?: null;
|
|
26
|
+
reward_discount?: null;
|
|
27
|
+
reward_discount_items: IRewardTypeDiscountItems;
|
|
28
|
+
reward_points?: null;
|
|
29
|
+
reward_cashback?: null;
|
|
30
|
+
reward_voucher?: null;
|
|
31
|
+
reward_mystery_gift?: null;
|
|
32
|
+
};
|
|
33
|
+
type IGiftCardRewardPoints = {
|
|
34
|
+
reward_type: GIFT_CARD_REWARD_TYPE_ENUM.POINTS;
|
|
35
|
+
reward_items?: null;
|
|
36
|
+
reward_discount?: null;
|
|
37
|
+
reward_discount_items?: null;
|
|
38
|
+
reward_points: IRewardTypePoints;
|
|
39
|
+
reward_cashback?: null;
|
|
40
|
+
reward_voucher?: null;
|
|
41
|
+
reward_mystery_gift?: null;
|
|
42
|
+
};
|
|
43
|
+
type IGiftCardRewardCashback = {
|
|
44
|
+
reward_type: GIFT_CARD_REWARD_TYPE_ENUM.CASHBACK;
|
|
45
|
+
reward_items?: null;
|
|
46
|
+
reward_discount?: null;
|
|
47
|
+
reward_discount_items?: null;
|
|
48
|
+
reward_points?: null;
|
|
49
|
+
reward_cashback: IRewardTypeCashback;
|
|
50
|
+
reward_voucher?: null;
|
|
51
|
+
reward_mystery_gift?: null;
|
|
52
|
+
};
|
|
53
|
+
type IGiftCardRewardVoucher = {
|
|
54
|
+
reward_type: GIFT_CARD_REWARD_TYPE_ENUM.VOUCHER;
|
|
55
|
+
reward_items?: null;
|
|
56
|
+
reward_discount?: null;
|
|
57
|
+
reward_discount_items?: null;
|
|
58
|
+
reward_points?: null;
|
|
59
|
+
reward_cashback?: null;
|
|
60
|
+
reward_voucher: IRewardTypeVoucher;
|
|
61
|
+
reward_mystery_gift?: null;
|
|
62
|
+
};
|
|
63
|
+
type IGiftCardRewardMysteryGift = {
|
|
64
|
+
reward_type: GIFT_CARD_REWARD_TYPE_ENUM.MYSTERY_GIFT;
|
|
65
|
+
reward_items?: null;
|
|
66
|
+
reward_discount?: null;
|
|
67
|
+
reward_discount_items?: null;
|
|
68
|
+
reward_points?: null;
|
|
69
|
+
reward_cashback?: null;
|
|
70
|
+
reward_voucher?: null;
|
|
71
|
+
reward_mystery_gift: IRewardTypeMysteryGift;
|
|
72
|
+
};
|
|
73
|
+
export type IGiftCardReward = IGiftCardRewardItems | IGiftCardRewardDiscount | IGiftCardRewardDiscountItems | IGiftCardRewardPoints | IGiftCardRewardCashback | IGiftCardRewardVoucher | IGiftCardRewardMysteryGift;
|
|
74
|
+
interface IBaseGiftCard {
|
|
75
|
+
_id: string;
|
|
76
|
+
code: string;
|
|
77
|
+
brand_id: string;
|
|
78
|
+
tenants: string[];
|
|
79
|
+
name: string;
|
|
80
|
+
description: string;
|
|
81
|
+
active: boolean;
|
|
82
|
+
max_uses: number | null;
|
|
83
|
+
max_uses_per_customer: number | null;
|
|
84
|
+
used_count: number;
|
|
85
|
+
last_used_at: Date | null;
|
|
86
|
+
expire_at: Date | null;
|
|
87
|
+
updatedAt: Date;
|
|
88
|
+
createdAt: Date;
|
|
89
|
+
}
|
|
90
|
+
export type IGiftCard = IBaseGiftCard & IGiftCardReward;
|
|
91
|
+
export {};
|
|
@@ -52,6 +52,7 @@ export * from './tenant_staff';
|
|
|
52
52
|
export * from './terminal_devices';
|
|
53
53
|
export * from './tokens';
|
|
54
54
|
export * from './track_order_number';
|
|
55
|
+
export * from './vouchers';
|
|
55
56
|
export * from './void_order_items';
|
|
56
57
|
export * from './wallet';
|
|
57
58
|
export * from './wallet_transactions';
|
|
@@ -66,3 +67,5 @@ export * from './warehouse_operational_roles';
|
|
|
66
67
|
export * from './warehouse_staff';
|
|
67
68
|
export * from './warehouse_track_order_number';
|
|
68
69
|
export * from './warehouse_vendors';
|
|
70
|
+
export * from './gift_cards';
|
|
71
|
+
export * from './rewards_usage';
|
|
@@ -68,6 +68,7 @@ __exportStar(require("./tenant_staff"), exports);
|
|
|
68
68
|
__exportStar(require("./terminal_devices"), exports);
|
|
69
69
|
__exportStar(require("./tokens"), exports);
|
|
70
70
|
__exportStar(require("./track_order_number"), exports);
|
|
71
|
+
__exportStar(require("./vouchers"), exports);
|
|
71
72
|
__exportStar(require("./void_order_items"), exports);
|
|
72
73
|
__exportStar(require("./wallet"), exports);
|
|
73
74
|
__exportStar(require("./wallet_transactions"), exports);
|
|
@@ -82,3 +83,5 @@ __exportStar(require("./warehouse_operational_roles"), exports);
|
|
|
82
83
|
__exportStar(require("./warehouse_staff"), exports);
|
|
83
84
|
__exportStar(require("./warehouse_track_order_number"), exports);
|
|
84
85
|
__exportStar(require("./warehouse_vendors"), exports);
|
|
86
|
+
__exportStar(require("./gift_cards"), exports);
|
|
87
|
+
__exportStar(require("./rewards_usage"), exports);
|
|
@@ -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.250",
|
|
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",
|