shuttlepro-shared 1.3.41 → 1.3.43

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.
Files changed (73) hide show
  1. package/common/repositories/customerProfile.repository.js +83 -14
  2. package/common/repositories/userRole.repository.js +5 -2
  3. package/config/redis.js +72 -73
  4. package/middlewares/checkPermission/index.js +36 -23
  5. package/models/Activity.js +28 -0
  6. package/models/ActivityLogs.js +1 -0
  7. package/models/AgentActivity.js +5 -4
  8. package/models/Attribute.js +130 -0
  9. package/models/Automation.js +231 -0
  10. package/models/BusinessRule.js +16 -0
  11. package/models/BusinessRuleHelper.js +13 -0
  12. package/models/Card.js +50 -1
  13. package/models/Catalogue.js +22 -0
  14. package/models/Category.js +129 -0
  15. package/models/ChatMemberSession.js +21 -0
  16. package/models/ChatMessage.js +43 -0
  17. package/models/Chatbot.js +1 -1
  18. package/models/Color.js +10 -0
  19. package/models/Column.js +6 -0
  20. package/models/Conversation.js +40 -0
  21. package/models/Customer.js +2 -1
  22. package/models/CustomerCheckpoint.js +21 -0
  23. package/models/DeviceInfo.js +13 -0
  24. package/models/Email.js +21 -0
  25. package/models/EmailMessage.js +30 -0
  26. package/models/EmailNotification.js +17 -0
  27. package/models/EscalationConfiguration.js +123 -0
  28. package/models/EscalationManager.js +50 -0
  29. package/models/Faq.js +29 -0
  30. package/models/FeedbackResponse.js +72 -0
  31. package/models/FormTemplate.js +27 -0
  32. package/models/Integration.js +8 -0
  33. package/models/InternalComments.js +27 -0
  34. package/models/InternalThreads.js +20 -0
  35. package/models/JobDesign.js +32 -0
  36. package/models/JobQueue.js +17 -0
  37. package/models/LabelsPdf.js +12 -0
  38. package/models/Layout.js +12 -0
  39. package/models/LoadSheet.js +31 -0
  40. package/models/Location.js +148 -0
  41. package/models/Logo.js +11 -0
  42. package/models/MailGroup.js +21 -0
  43. package/models/Notification.js +32 -0
  44. package/models/Order.js +11 -0
  45. package/models/OrderPdf.js +29 -0
  46. package/models/PostsAutomation.js +66 -0
  47. package/models/Product.js +337 -0
  48. package/models/ProductAttachment.js +158 -0
  49. package/models/ProductAttribute.js +140 -0
  50. package/models/ProductCategory.js +128 -0
  51. package/models/ProductLabels.js +11 -0
  52. package/models/ProductShopify.js +13 -0
  53. package/models/ProductTag.js +124 -0
  54. package/models/ProductVariant.js +157 -0
  55. package/models/Profile.js +3 -1
  56. package/models/ServiceUsage.js +26 -0
  57. package/models/ShipperSetting.js +24 -0
  58. package/models/SocialGroup.js +127 -0
  59. package/models/SocialPost.js +40 -0
  60. package/models/SocialProfile.js +56 -0
  61. package/models/Story.js +86 -0
  62. package/models/Tag.js +77 -0
  63. package/models/Template.js +76 -0
  64. package/models/TemplateFrame.js +55 -0
  65. package/models/TemplateTag.js +10 -0
  66. package/models/UserGuide.js +21 -0
  67. package/models/UserSession.js +47 -0
  68. package/models/VariantLocation.js +145 -0
  69. package/models/WhatsappFlow.js +29 -0
  70. package/models/Workflow.js +34 -0
  71. package/models/Workspace.js +78 -4
  72. package/models.js +168 -49
  73. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+
4
+ const EmailSchema = new Schema(
5
+ {
6
+ name: { type: String, default: "" },
7
+ address: { type: String, default: "" },
8
+ contact: { type: String, default: "" },
9
+ email: { type: String, default: "" },
10
+ reference: { type: String, default: "" },
11
+ city: { type: String, default: "" },
12
+ isBlackListed: { type: Boolean, default: false },
13
+ customerId: { type: String, default: "" },
14
+ workspaceId: { type: String, default: "" },
15
+ designation: { type: String, default: "" },
16
+ },
17
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
18
+ );
19
+
20
+ const Email = mongoose.model("Email", EmailSchema);
21
+ module.exports = Email;
@@ -0,0 +1,30 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+
4
+ const EmailMessageSchema = new Schema(
5
+ {
6
+ workspaceId: { type: String, default: "" },
7
+ threadId: { type: String, default: "" },
8
+ messageId: { type: String, default: "" },
9
+ message: { type: String, default: "" },
10
+ subject: { type: String, default: "" },
11
+ trackingId: { type: String, default: "" },
12
+ integratedEmail: { type: String, default: "" },
13
+ receiverEmail: { type: String, default: "" },
14
+ senderEmail: { type: String, default: "" },
15
+ agentId: { type: String, default: "" },
16
+ isRead: { type: Boolean, default: false },
17
+ type: { type: String, default: "email" },
18
+ attachmentArr: [
19
+ {
20
+ attachmentId: { type: String, default: "" },
21
+ attachemntName: { type: String, default: "" },
22
+ attachmentSize: { type: String, default: "" },
23
+ },
24
+ ],
25
+ right: { type: Boolean, default: true },
26
+ },
27
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
28
+ );
29
+
30
+ module.exports = EmailMessageSchema;
@@ -0,0 +1,17 @@
1
+ const mongoose = require("mongoose");
2
+
3
+ const emailNotificationSchema = new mongoose.Schema(
4
+ {
5
+ threadId: { type: String, default: "" },
6
+ messageId: { type: String, default: "" },
7
+ message: { type: String, default: "" },
8
+ subject: { type: String, default: "" },
9
+ trackingId: { type: String, default: "" },
10
+ integratedEmail: { type: String, default: "" },
11
+ receiverEmail: { type: String, default: "" },
12
+ senderEmail: { type: String, default: "" },
13
+ },
14
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
15
+ );
16
+
17
+ module.exports = mongoose.model("EmailNotification", emailNotificationSchema);
@@ -0,0 +1,123 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+
4
+ const EscalationLevelSchema = new Schema({
5
+ _id: false,
6
+ threshold: {
7
+ type: Number,
8
+ required: true,
9
+ },
10
+ actions: {
11
+ labels: [
12
+ {
13
+ type: Schema.Types.ObjectId,
14
+ ref: "Label",
15
+ },
16
+ ],
17
+ memberIds: [
18
+ {
19
+ type: Schema.Types.ObjectId,
20
+ ref: "User",
21
+ },
22
+ ],
23
+ ticketPriority: {
24
+ type: String,
25
+ enum: ["high", "medium", "low", ""],
26
+ default: "",
27
+ },
28
+ notification: {
29
+ action: {
30
+ type: String,
31
+ enum: ["email", "systemNotification", "both"],
32
+ default: "systemNotification",
33
+ },
34
+ integrationId: {
35
+ type: Schema.Types.ObjectId,
36
+ ref: "Integration",
37
+ },
38
+ templateId: {
39
+ type: Schema.Types.ObjectId,
40
+ ref: "DescriptionTemplate",
41
+ },
42
+ memberEmails: [
43
+ {
44
+ type: String,
45
+ },
46
+ ],
47
+ },
48
+ },
49
+ });
50
+
51
+ const EscalationGroupSchema = new Schema({
52
+ conditionalMatch: {
53
+ type: String,
54
+ enum: ["any", "all"],
55
+ default: "any",
56
+ },
57
+ contains: {
58
+ type: String,
59
+ enum: ["equalTo", "contains", "notEqualTo", "notContains", ""],
60
+ default: "",
61
+ },
62
+ conditions: [
63
+ {
64
+ _id: false,
65
+ type: {
66
+ type: String,
67
+ required: true,
68
+ enum: ["status", "label", "formBuilder"],
69
+ },
70
+ values: [
71
+ {
72
+ type: String,
73
+ },
74
+ ],
75
+ subValues: [
76
+ {
77
+ type: String,
78
+ },
79
+ ],
80
+ //open/processing/hold/close/isCritical,assignedChat
81
+ },
82
+ ],
83
+ levels: [EscalationLevelSchema], // Each group contains multiple escalation levels
84
+ });
85
+
86
+ const EscalationConfigurationSchema = new Schema(
87
+ {
88
+ title: {
89
+ type: String,
90
+ required: true,
91
+ },
92
+ isDeleted: {
93
+ type: Boolean,
94
+ default: false,
95
+ },
96
+ type: {
97
+ type: String,
98
+ enum: ["conversation", "ticket", "both"],
99
+ default: "conversation",
100
+ },
101
+ workspaceId: {
102
+ type: String,
103
+ default: "",
104
+ },
105
+ createdBy: {
106
+ type: Schema.Types.ObjectId,
107
+ ref: "User",
108
+ },
109
+ enabled: {
110
+ type: Boolean,
111
+ default: true,
112
+ },
113
+ group: [EscalationGroupSchema], // Array of groups, each containing multiple levels
114
+ },
115
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
116
+ );
117
+
118
+ const EscalationConfiguration = mongoose.model(
119
+ "EscalationConfiguration",
120
+ EscalationConfigurationSchema
121
+ );
122
+
123
+ module.exports = { EscalationConfiguration };
@@ -0,0 +1,50 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+
4
+ const EscalationManagerSchema = new Schema(
5
+ {
6
+ type: {
7
+ type: String,
8
+ required: true,
9
+ enum: ["conversation", "ticket"],
10
+ },
11
+ refId: {
12
+ type: String,
13
+ required: true,
14
+ },
15
+ escalationId: {
16
+ type: Schema.Types.ObjectId,
17
+ ref: "Escalation",
18
+ },
19
+ groupId: {
20
+ type: String,
21
+ },
22
+ status: {
23
+ type: String,
24
+ enum: ["pending", "processing", "close"],
25
+ },
26
+ managerStatus: [
27
+ {
28
+ escalationLevel: {
29
+ type: Number,
30
+ },
31
+ status: {
32
+ type: String,
33
+ enum: ["pending", "done", "failed"],
34
+ },
35
+ },
36
+ ],
37
+ workspaceId: {
38
+ type: Schema.Types.ObjectId,
39
+ ref: "Workspace",
40
+ },
41
+ },
42
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
43
+ );
44
+
45
+ const EscalationManager = mongoose.model(
46
+ "EscalationManager",
47
+ EscalationManagerSchema
48
+ );
49
+
50
+ module.exports = EscalationManager;
package/models/Faq.js ADDED
@@ -0,0 +1,29 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+
4
+ const FaqItemSchema = new Schema({
5
+ question: { type: String, required: true },
6
+ answer: { type: String, required: true },
7
+ });
8
+
9
+ const FaqSchema = new Schema(
10
+ {
11
+ name: {
12
+ type: String,
13
+ required: true,
14
+ },
15
+ list: {
16
+ type: [FaqItemSchema],
17
+ required: true,
18
+ },
19
+ workspaceId: {
20
+ type: Schema.Types.ObjectId,
21
+ ref: "Workspace",
22
+ },
23
+ },
24
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
25
+ );
26
+
27
+ const Faq = mongoose.model("Faq", FaqSchema);
28
+
29
+ module.exports = Faq;
@@ -0,0 +1,72 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+ const { v4: uuidv4 } = require("uuid");
4
+
5
+ const FeedbackResponseSchema = new Schema(
6
+ {
7
+ paramId: {
8
+ type: String,
9
+ default: uuidv4(),
10
+ },
11
+ type: {
12
+ type: String,
13
+ enum: ["conversation", "order"],
14
+ default: "conversation",
15
+ },
16
+ refId: {
17
+ type: String,
18
+ default: "",
19
+ },
20
+ workspaceId: {
21
+ type: String,
22
+ default: "",
23
+ },
24
+ agentId: {
25
+ type: String,
26
+ default: "",
27
+ },
28
+ feedbackFormId: {
29
+ type: String,
30
+ default: "",
31
+ },
32
+ data: {
33
+ type: Schema.Types.Mixed,
34
+ default: {},
35
+ },
36
+ responseAdded: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+ customerInfo: {
41
+ type: Schema.Types.Mixed,
42
+ default: {},
43
+ },
44
+ platformInfo: {
45
+ type: Schema.Types.Mixed,
46
+ default: {},
47
+ },
48
+ timeStamp: {
49
+ type: Date,
50
+ default: Date.now,
51
+ },
52
+
53
+ workspaceId: {
54
+ type: String,
55
+ default: "",
56
+ },
57
+ feedbackFormId: {
58
+ type: String,
59
+ default: "",
60
+ },
61
+ qr: {
62
+ link: {
63
+ type: String,
64
+ default: "",
65
+ trim: true,
66
+ },
67
+ },
68
+ },
69
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
70
+ );
71
+
72
+ module.exports = mongoose.model("FeedbackResponse", FeedbackResponseSchema);
@@ -0,0 +1,27 @@
1
+ const mongoose = require("mongoose");
2
+
3
+ const FormTemplateSchema = new mongoose.Schema(
4
+ {
5
+ type: {
6
+ type: String,
7
+ required: true,
8
+ enum: ["feedback", "ticket"],
9
+ },
10
+ subType: {
11
+ type: String,
12
+ enum: ["formBuilder","complaint", "order", "ticket", "product"],
13
+ },
14
+ workspaceId: {
15
+ type: String,
16
+ default: "",
17
+ },
18
+ body: {
19
+ type: mongoose.Schema.Types.Mixed,
20
+ default: {},
21
+ },
22
+ },
23
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
24
+ );
25
+
26
+ const FormTemplate = mongoose.model("FormTemplate", FormTemplateSchema);
27
+ module.exports = FormTemplate;
@@ -20,6 +20,8 @@ const IntegrationSchema = new mongoose.Schema(
20
20
  "smtp_gmail",
21
21
  "outlook",
22
22
  "business_central",
23
+ "ivr",
24
+ "sms",
23
25
  ],
24
26
  },
25
27
  chatbot: { type: Boolean, default: false },
@@ -48,4 +50,10 @@ const IntegrationSchema = new mongoose.Schema(
48
50
  { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
49
51
  );
50
52
 
53
+ IntegrationSchema.virtual("conversations", {
54
+ ref: "Conversation",
55
+ localField: "_id",
56
+ foreignField: "platformId",
57
+ });
58
+
51
59
  module.exports = mongoose.model("Integration", IntegrationSchema);
@@ -0,0 +1,27 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+ const InternalCommentSchema = new Schema(
4
+ {
5
+ comment: { type: String, default: "" },
6
+ item_id: { type: String, default: "" },
7
+ sender_profile_url: { type: String, default: "" },
8
+ workspace_id: { type: String, default: "" },
9
+ sender_name: { type: String, default: "" },
10
+ senderId: { type: String, default: "" },
11
+ commentType: { type: String, default: "" },
12
+ mention_id: [{ id: String, name: String }],
13
+ pageId: { type: String, default: "" },
14
+ attachments: [],
15
+ },
16
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
17
+ );
18
+ InternalCommentSchema.virtual("internalThreads", {
19
+ ref: "InternalThreads",
20
+ localField: "_id",
21
+ foreignField: "internalCommentId",
22
+ });
23
+ const InternalComment = mongoose.model(
24
+ "InternalComment",
25
+ InternalCommentSchema
26
+ );
27
+ module.exports = InternalComment;
@@ -0,0 +1,20 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+ const InternalThreadsSchema = new Schema(
4
+ {
5
+ internalCommentId: { type: Schema.Types.ObjectId, ref: "InternalComment" },
6
+ comment: { type: String, default: "" },
7
+ sender_name: { type: String, default: "" },
8
+ senderId: { type: String, default: "" },
9
+ sender_profile_url: { type: String, default: "" },
10
+ mention_id: [{ id: String, name: String }],
11
+ pageId: { type: String, default: "" },
12
+ attachments: [],
13
+ },
14
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
15
+ );
16
+ const InternalThreads = mongoose.model(
17
+ "InternalThreads",
18
+ InternalThreadsSchema
19
+ );
20
+ module.exports = InternalThreads;
@@ -0,0 +1,32 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+
4
+ const jobDesignSchema = new mongoose.Schema(
5
+ {
6
+ name: { type: String, default: "" },
7
+ products: { type: Number, default: 0 },
8
+ productIds: [],
9
+ status: { type: String, default: "processing" },
10
+ data: [
11
+ {
12
+ url: { type: String, default: "" },
13
+ bucket: { type: String, default: "" },
14
+ key: { type: String, default: "" },
15
+ },
16
+ ],
17
+ downloads: [],
18
+ tagName: { type: String, default: "" },
19
+ tagId: { type: String, default: "" },
20
+ userId: { type: Schema.Types.ObjectId, ref: "User" },
21
+ userName: { type: String, default: "" },
22
+ organizationId: { type: Number, default: 0 },
23
+ workspaceId: { type: Schema.Types.ObjectId, ref: "Workspace" },
24
+ templateId: {
25
+ type: Schema.Types.ObjectId,
26
+ ref: "Template",
27
+ },
28
+ },
29
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
30
+ );
31
+
32
+ module.exports = mongoose.model("JobDesign", jobDesignSchema);
@@ -0,0 +1,17 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+ const jobQueueSchema = new mongoose.Schema(
4
+ {
5
+ jobId: { type: String },
6
+ templateData: { type: Object },
7
+ imageUrl: { type: String },
8
+ imageId: { type: String, default: "" },
9
+ workspaceId: { type: Schema.Types.ObjectId, ref: "Product" },
10
+ status: { type: String, default: "Processing" },
11
+ message: { type: String, default: "" },
12
+ attempt: { type: Number, default: 0 },
13
+ },
14
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
15
+ );
16
+
17
+ module.exports = mongoose.model("JobQueue", jobQueueSchema);
@@ -0,0 +1,12 @@
1
+ const mongoose = require("mongoose");
2
+
3
+ const LabelsPdfSchema = new mongoose.Schema(
4
+ {
5
+ url: { type: String, default: "" },
6
+ organizationId: { type: Number, default: 0 },
7
+ storeId: { type: Number, default: 0 }
8
+ },
9
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
10
+ );
11
+
12
+ module.exports = mongoose.model("LabelsPdf", LabelsPdfSchema);
@@ -0,0 +1,12 @@
1
+ const mongoose = require("mongoose");
2
+
3
+ const layoutSchema = new mongoose.Schema(
4
+ {
5
+ name: { type: String, default: "" },
6
+ height: { type: Number, default: 0 },
7
+ width: { type: Number, default: 0 }
8
+ },
9
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
10
+ );
11
+
12
+ module.exports = mongoose.model("Layout", layoutSchema);
@@ -0,0 +1,31 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+
4
+ const loadSheetSchema = new mongoose.Schema(
5
+ {
6
+ uuid: { type: String, default: "" },
7
+ courierName: { type: String, default: "" },
8
+ courierId: { type: String, default: "" },
9
+ orders: [
10
+ {
11
+ orderId: {
12
+ type: Schema.Types.ObjectId,
13
+ ref: "Order",
14
+ default: null,
15
+ },
16
+ },
17
+ ],
18
+ workspaceId: {
19
+ type: Schema.Types.ObjectId,
20
+ ref: "Workspace",
21
+ default: null,
22
+ },
23
+ isDeleted: { type: Boolean, default: false },
24
+ generatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
25
+ createdBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
26
+ updatedBy: { type: Schema.Types.ObjectId, ref: "User", default: null },
27
+ },
28
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
29
+ );
30
+
31
+ module.exports = mongoose.model("LoadSheet", loadSheetSchema);