biz-slide-core 1.2.105 → 1.2.107
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/dist/entity/customer.entity.d.ts +1 -0
- package/dist/entity/customer.entity.d.ts.map +1 -1
- package/dist/entity/customer.entity.js +2 -1
- package/dist/entity/ppt-email-queue.entity.d.ts +5 -0
- package/dist/entity/ppt-email-queue.entity.d.ts.map +1 -1
- package/dist/entity/ppt-email-queue.entity.js +9 -1
- package/dist/middleware/authentication.d.ts.map +1 -1
- package/dist/middleware/authentication.js +10 -5
- package/package.json +1 -1
@@ -31,6 +31,7 @@ export interface ICustomerSchema {
|
|
31
31
|
userId: string;
|
32
32
|
emailId: string;
|
33
33
|
emailTemplateStatus: Record<string, IEmailTemplateStatus>;
|
34
|
+
country: string;
|
34
35
|
}
|
35
36
|
export declare const CustomerModel: import("mongoose").Model<ICustomerSchema, {}, {}, {}, import("mongoose").Document<unknown, {}, ICustomerSchema> & Omit<ICustomerSchema & {
|
36
37
|
_id: import("mongoose").Types.ObjectId;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"customer.entity.d.ts","sourceRoot":"","sources":["../../src/entity/customer.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAC;CACf;AAGD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,
|
1
|
+
{"version":3,"file":"customer.entity.d.ts","sourceRoot":"","sources":["../../src/entity/customer.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAC;CACf;AAGD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC1D,OAAO,EAAE,MAAM,CAAC;CACjB;AA4BD,eAAO,MAAM,aAAa;;eAAqD,CAAC"}
|
@@ -12,7 +12,8 @@ const CustomerSchema = new mongoose_1.Schema({
|
|
12
12
|
appName: { type: String, required: true },
|
13
13
|
userId: { type: String, required: true },
|
14
14
|
emailId: { type: String, default: "" },
|
15
|
-
emailTemplateStatus: { type: Map, of: EmailTemplateStatusSchema }
|
15
|
+
emailTemplateStatus: { type: Map, of: EmailTemplateStatusSchema },
|
16
|
+
country: { type: String, default: "" }
|
16
17
|
}, {
|
17
18
|
timestamps: true,
|
18
19
|
});
|
@@ -27,6 +27,11 @@ export interface IPPTEmailQueueSchema {
|
|
27
27
|
pptRef: Types.ObjectId;
|
28
28
|
emailType: string;
|
29
29
|
sent: boolean;
|
30
|
+
tracking: IPPTEmailTracking;
|
31
|
+
}
|
32
|
+
export interface IPPTEmailTracking {
|
33
|
+
isOpened: boolean;
|
34
|
+
ipAddress: string;
|
30
35
|
}
|
31
36
|
export declare const PPTEmailQueueModel: import("mongoose").Model<IPPTEmailQueueSchema, {}, {}, {}, import("mongoose").Document<unknown, {}, IPPTEmailQueueSchema> & Omit<IPPTEmailQueueSchema & {
|
32
37
|
_id: Types.ObjectId;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ppt-email-queue.entity.d.ts","sourceRoot":"","sources":["../../src/entity/ppt-email-queue.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"ppt-email-queue.entity.d.ts","sourceRoot":"","sources":["../../src/entity/ppt-email-queue.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,iBAAiB,CAAA;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AA2BD,eAAO,MAAM,kBAAkB;;eAAsE,CAAC"}
|
@@ -2,10 +2,18 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PPTEmailQueueModel = void 0;
|
4
4
|
const mongoose_1 = require("mongoose");
|
5
|
+
const EmailTemplateTrackingSchema = new mongoose_1.Schema({
|
6
|
+
isOpened: { type: Boolean, default: false },
|
7
|
+
ipAddress: { type: String, default: "" },
|
8
|
+
}, {
|
9
|
+
timestamps: false,
|
10
|
+
_id: false
|
11
|
+
});
|
5
12
|
const PPTEmailQueueSchema = new mongoose_1.Schema({
|
6
13
|
pptRef: { type: mongoose_1.Schema.Types.ObjectId, ref: 'ppt' },
|
7
14
|
emailType: { type: String, required: true },
|
8
|
-
sent: { type: Boolean, default: false }
|
15
|
+
sent: { type: Boolean, default: false },
|
16
|
+
tracking: EmailTemplateTrackingSchema
|
9
17
|
}, {
|
10
18
|
timestamps: true,
|
11
19
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middleware/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIpC,QAAA,MAAM,SAAS,UAAW,MAAM,EAAE,WACJ,QAAQ,OAAO,QAAQ,QAAQ,YAAY,4DA+BxE,CAAA;
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middleware/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIpC,QAAA,MAAM,SAAS,UAAW,MAAM,EAAE,WACJ,QAAQ,OAAO,QAAQ,QAAQ,YAAY,4DA+BxE,CAAA;AAgBD,QAAA,MAAM,qBAAqB,cACG,QAAQ,OAAO,QAAQ,QAAQ,YAAY,4DAoCxE,CAAA;AAED,QAAA,MAAM,wBAAwB,cACA,QAAQ,OAAO,QAAQ,QAAQ,YAAY,4DAqCxE,CAAA;AAGD,QAAA,MAAM,gBAAgB,cACQ,QAAQ,OAAO,QAAQ,QAAQ,YAAY,4DAmBxE,CAAA;AAED,OAAO,EAAC,SAAS,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,gBAAgB,EAAC,CAAC"}
|
@@ -42,14 +42,15 @@ const authorize = (roles) => {
|
|
42
42
|
};
|
43
43
|
};
|
44
44
|
exports.authorize = authorize;
|
45
|
-
const createUser = async (emailId, userId, appName) => {
|
45
|
+
const createUser = async (emailId, userId, country, appName) => {
|
46
46
|
const customer = await entity_1.CustomerModel.findOne({ userId });
|
47
47
|
if (!customer) {
|
48
48
|
const newCustomer = new entity_1.CustomerModel({
|
49
49
|
appName: appName || "default",
|
50
50
|
emailId,
|
51
51
|
emailTemplateStatus: {},
|
52
|
-
userId
|
52
|
+
userId,
|
53
|
+
country
|
53
54
|
});
|
54
55
|
await newCustomer.save();
|
55
56
|
}
|
@@ -68,6 +69,7 @@ const authorizeWithSlideApp = () => {
|
|
68
69
|
return res.status(401).json({ message: 'Session Expired' });
|
69
70
|
}
|
70
71
|
const userId = (token === null || token === void 0 ? void 0 : token.customer_id) || ((_a = token === null || token === void 0 ? void 0 : token.value) === null || _a === void 0 ? void 0 : _a.email);
|
72
|
+
const country = (token === null || token === void 0 ? void 0 : token.country_name) || "";
|
71
73
|
if (!userId) {
|
72
74
|
return res.status(401).json({ message: 'userId not found' });
|
73
75
|
}
|
@@ -76,9 +78,10 @@ const authorizeWithSlideApp = () => {
|
|
76
78
|
sessionId,
|
77
79
|
ipAddress,
|
78
80
|
appName: req.headers['x-app-name'],
|
79
|
-
email: (token === null || token === void 0 ? void 0 : token.customer_email) || ""
|
81
|
+
email: (token === null || token === void 0 ? void 0 : token.customer_email) || "",
|
82
|
+
country
|
80
83
|
};
|
81
|
-
await createUser(req.user.email, req.user.userId, req.user.appName);
|
84
|
+
await createUser(req.user.email, req.user.userId, req.user.country, req.user.appName);
|
82
85
|
next();
|
83
86
|
}
|
84
87
|
};
|
@@ -91,6 +94,7 @@ const nonAuthorizeWithSlideApp = () => {
|
|
91
94
|
const sessionId = req.headers['x-fingerprint-key'];
|
92
95
|
let userId = "guest";
|
93
96
|
let email = "";
|
97
|
+
let country = "";
|
94
98
|
if (req.headers.authorization) {
|
95
99
|
const token = await (0, utilities_1.verifyUid)(req.headers.authorization);
|
96
100
|
if (!token) {
|
@@ -98,10 +102,11 @@ const nonAuthorizeWithSlideApp = () => {
|
|
98
102
|
}
|
99
103
|
userId = (token === null || token === void 0 ? void 0 : token.customer_id) || ((_a = token === null || token === void 0 ? void 0 : token.value) === null || _a === void 0 ? void 0 : _a.email);
|
100
104
|
email = (token === null || token === void 0 ? void 0 : token.customer_email) || "";
|
105
|
+
country = (token === null || token === void 0 ? void 0 : token.country_name) || "";
|
101
106
|
if (!userId) {
|
102
107
|
return res.status(401).json({ message: 'userId not found' });
|
103
108
|
}
|
104
|
-
await createUser(email, userId, req.headers['x-app-name']);
|
109
|
+
await createUser(email, userId, country, req.headers['x-app-name']);
|
105
110
|
}
|
106
111
|
else {
|
107
112
|
if (!ipAddress || !sessionId) {
|