shuttlepro-shared 1.4.66 → 1.4.68
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/models/Chatbot.js +2 -14
- package/models/FeedbackBot.js +89 -0
- package/models.js +2 -0
- package/package.json +1 -1
package/models/Chatbot.js
CHANGED
|
@@ -20,7 +20,7 @@ const ChatbotSchema = new Schema(
|
|
|
20
20
|
},
|
|
21
21
|
type: {
|
|
22
22
|
type: String,
|
|
23
|
-
enum: ["chatbot", "agent", "interactive"
|
|
23
|
+
enum: ["chatbot", "agent", "interactive"],
|
|
24
24
|
default: "chatbot",
|
|
25
25
|
},
|
|
26
26
|
interactiveId: {
|
|
@@ -62,19 +62,7 @@ const ChatbotSchema = new Schema(
|
|
|
62
62
|
],
|
|
63
63
|
},
|
|
64
64
|
],
|
|
65
|
-
feedbackConfig: {
|
|
66
|
-
templateId: {
|
|
67
|
-
type: Schema.Types.Mixed,
|
|
68
|
-
default: null,
|
|
69
|
-
},
|
|
70
|
-
questions: [
|
|
71
|
-
{
|
|
72
|
-
question: { type: String, default: "" },
|
|
73
|
-
options: [{ type: String, default: "" }],
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
65
|
},
|
|
78
66
|
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
79
67
|
);
|
|
80
|
-
module.exports = ChatbotSchema;
|
|
68
|
+
module.exports = ChatbotSchema;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const { Schema } = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const FeedbackBotSchema = 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
|
+
phoneNumber: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
status: {
|
|
25
|
+
type: String,
|
|
26
|
+
enum: ["active", "completed", "abandoned"],
|
|
27
|
+
default: "active",
|
|
28
|
+
},
|
|
29
|
+
answers: [
|
|
30
|
+
{
|
|
31
|
+
question: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
answer: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
optionIndex: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 0,
|
|
42
|
+
},
|
|
43
|
+
options: {
|
|
44
|
+
type: [String],
|
|
45
|
+
default: [],
|
|
46
|
+
},
|
|
47
|
+
answeredAt: {
|
|
48
|
+
type: Date,
|
|
49
|
+
default: Date.now,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
totalQuestions: {
|
|
54
|
+
type: Number,
|
|
55
|
+
default: 0,
|
|
56
|
+
},
|
|
57
|
+
completedQuestions: {
|
|
58
|
+
type: Number,
|
|
59
|
+
default: 0,
|
|
60
|
+
},
|
|
61
|
+
startedAt: {
|
|
62
|
+
type: Date,
|
|
63
|
+
default: Date.now,
|
|
64
|
+
},
|
|
65
|
+
completedAt: {
|
|
66
|
+
type: Date,
|
|
67
|
+
default: null,
|
|
68
|
+
},
|
|
69
|
+
// Store reference to order/workflow if applicable
|
|
70
|
+
orderId: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: null,
|
|
73
|
+
},
|
|
74
|
+
workflowId: {
|
|
75
|
+
type: Schema.Types.ObjectId,
|
|
76
|
+
ref: "SocialWorkflow",
|
|
77
|
+
default: null,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{ timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
// Index for faster queries
|
|
84
|
+
FeedbackBotSchema.index({ workspaceId: 1, phoneNumber: 1, createdAt: -1 });
|
|
85
|
+
FeedbackBotSchema.index({ conversationId: 1 });
|
|
86
|
+
FeedbackBotSchema.index({ chatbotId: 1 });
|
|
87
|
+
FeedbackBotSchema.index({ status: 1 });
|
|
88
|
+
|
|
89
|
+
module.exports = FeedbackBotSchema;
|
package/models.js
CHANGED
|
@@ -39,6 +39,7 @@ const EmailNotification = require("./models/EmailNotification");
|
|
|
39
39
|
const EscalationConfiguration = require("./models/EscalationConfiguration");
|
|
40
40
|
const EscalationManager = require("./models/EscalationManager");
|
|
41
41
|
const Faq = require("./models/Faq");
|
|
42
|
+
const FeedbackBot = require("./models/FeedbackBot");
|
|
42
43
|
const FeedbackResponse = require("./models/FeedbackResponse");
|
|
43
44
|
const FormTemplate = require("./models/FormTemplate");
|
|
44
45
|
const GoogleClientInfo = require("./models/GoogleClientInfo");
|
|
@@ -151,6 +152,7 @@ module.exports = {
|
|
|
151
152
|
EscalationConfiguration,
|
|
152
153
|
EscalationManager,
|
|
153
154
|
Faq,
|
|
155
|
+
FeedbackBot,
|
|
154
156
|
FeedbackResponse,
|
|
155
157
|
FormTemplate,
|
|
156
158
|
GoogleClientInfo,
|