shuttlepro-shared 1.4.82 → 1.4.83

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/dump.rdb ADDED
Binary file
package/models/Chatbot.js CHANGED
@@ -77,6 +77,17 @@ const ChatbotSchema = new Schema(
77
77
  type: String,
78
78
  default: null,
79
79
  },
80
+ systemUrl: {
81
+ type: String,
82
+ default: null,
83
+ },
84
+ buttons: [
85
+ {
86
+ id: { type: String, default: "" },
87
+ label: { type: String, default: "" },
88
+ emoji: { type: String, default: "" },
89
+ },
90
+ ],
80
91
  },
81
92
  },
82
93
  { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
@@ -0,0 +1,115 @@
1
+ const { Schema } = require("mongoose");
2
+
3
+ const EmailFeedbackReportSchema = new Schema(
4
+ {
5
+ workspaceId: {
6
+ type: Schema.Types.ObjectId,
7
+ ref: "Workspace",
8
+ required: true,
9
+ },
10
+ chatbotId: {
11
+ type: Schema.Types.ObjectId,
12
+ ref: "Chatbot",
13
+ required: true,
14
+ },
15
+ conversationId: {
16
+ type: Schema.Types.ObjectId,
17
+ ref: "Conversation",
18
+ required: true,
19
+ },
20
+ email: {
21
+ type: String,
22
+ required: true,
23
+ },
24
+ status: {
25
+ type: String,
26
+ enum: ["pending", "responded", "completed"],
27
+ default: "pending",
28
+ },
29
+ // Store the initial button click (good/bad)
30
+ initialResponse: {
31
+ buttonId: {
32
+ type: String, // "good" or "bad"
33
+ required: false,
34
+ },
35
+ buttonLabel: {
36
+ type: String,
37
+ required: false,
38
+ },
39
+ respondedAt: {
40
+ type: Date,
41
+ default: null,
42
+ },
43
+ },
44
+ // Store all answers if chatbot has follow-up questions
45
+ answers: [
46
+ {
47
+ question: {
48
+ type: String,
49
+ required: true,
50
+ },
51
+ answer: {
52
+ type: String,
53
+ required: true,
54
+ },
55
+ optionIndex: {
56
+ type: Number,
57
+ default: 0,
58
+ },
59
+ options: {
60
+ type: [String],
61
+ default: [],
62
+ },
63
+ answeredAt: {
64
+ type: Date,
65
+ default: Date.now,
66
+ },
67
+ },
68
+ ],
69
+ totalQuestions: {
70
+ type: Number,
71
+ default: 0,
72
+ },
73
+ completedQuestions: {
74
+ type: Number,
75
+ default: 0,
76
+ },
77
+ startedAt: {
78
+ type: Date,
79
+ default: Date.now,
80
+ },
81
+ completedAt: {
82
+ type: Date,
83
+ default: null,
84
+ },
85
+ // Store email message details
86
+ emailMessageId: {
87
+ type: String,
88
+ default: null,
89
+ },
90
+ emailSubject: {
91
+ type: String,
92
+ default: null,
93
+ },
94
+ // Store reference to order/workflow if applicable
95
+ orderId: {
96
+ type: String,
97
+ default: null,
98
+ },
99
+ workflowId: {
100
+ type: Schema.Types.ObjectId,
101
+ ref: "SocialWorkflow",
102
+ default: null,
103
+ },
104
+ },
105
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
106
+ );
107
+
108
+ // Index for faster queries
109
+ EmailFeedbackReportSchema.index({ workspaceId: 1, email: 1, createdAt: -1 });
110
+ EmailFeedbackReportSchema.index({ conversationId: 1 });
111
+ EmailFeedbackReportSchema.index({ chatbotId: 1 });
112
+ EmailFeedbackReportSchema.index({ status: 1 });
113
+ EmailFeedbackReportSchema.index({ workspaceId: 1, email: 1, orderId: 1 });
114
+
115
+ module.exports = EmailFeedbackReportSchema;
@@ -12,6 +12,17 @@ const EscalationLevelSchema = new Schema({
12
12
  type: Boolean,
13
13
  default: false,
14
14
  },
15
+ emailFeedbackChatbot: {
16
+ enabled: {
17
+ type: Boolean,
18
+ default: false,
19
+ },
20
+ chatbotId: {
21
+ type: Schema.Types.ObjectId,
22
+ ref: "Chatbot",
23
+ default: null,
24
+ },
25
+ },
15
26
  labels: [
16
27
  {
17
28
  type: Schema.Types.ObjectId,
package/models.js CHANGED
@@ -36,6 +36,7 @@ const DeviceInfo = require("./models/DeviceInfo");
36
36
  const Email = require("./models/Email");
37
37
  const EmailMessage = require("./models/EmailMessage");
38
38
  const EmailNotification = require("./models/EmailNotification");
39
+ const EmailFeedbackReport = require("./models/EmailFeedbackReport");
39
40
  const EscalationConfiguration = require("./models/EscalationConfiguration");
40
41
  const EscalationManager = require("./models/EscalationManager");
41
42
  const Faq = require("./models/Faq");
@@ -151,6 +152,7 @@ module.exports = {
151
152
  Email,
152
153
  EmailMessage,
153
154
  EmailNotification,
155
+ EmailFeedbackReport,
154
156
  EscalationConfiguration,
155
157
  EscalationManager,
156
158
  Faq,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.4.82",
3
+ "version": "1.4.83",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {