orbitx-core-models 1.0.4 → 2.0.0

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/index.d.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  import { Chat } from "./models/chat.model";
2
2
  import { Message } from "./models/message.model";
3
3
  import { User } from "./models/user.model";
4
+ import { Vertical } from "./models/vertical.model";
5
+ import { Macro } from "./models/macro.model";
4
6
  import { IChat } from "./interfaces/chat.interface";
7
+ import { IMacro } from "./interfaces/macro.interface";
8
+ import { IVertical } from "./interfaces/vertical.interface";
5
9
  import { IMessage } from "./interfaces/message.interface";
6
10
  import { IUser } from "./interfaces/user.interface";
7
- export { Chat, Message, User };
8
- export type { IChat, IMessage, IUser };
11
+ export { Chat, Message, User, Vertical, Macro };
12
+ export type { IChat, IMessage, IUser, IVertical, IMacro };
9
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC/B,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAChD,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.User = exports.Message = exports.Chat = void 0;
3
+ exports.Macro = exports.Vertical = exports.User = exports.Message = exports.Chat = void 0;
4
+ // MODELS
4
5
  const chat_model_1 = require("./models/chat.model");
5
6
  Object.defineProperty(exports, "Chat", { enumerable: true, get: function () { return chat_model_1.Chat; } });
6
7
  const message_model_1 = require("./models/message.model");
7
8
  Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return message_model_1.Message; } });
8
9
  const user_model_1 = require("./models/user.model");
9
10
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return user_model_1.User; } });
11
+ const vertical_model_1 = require("./models/vertical.model");
12
+ Object.defineProperty(exports, "Vertical", { enumerable: true, get: function () { return vertical_model_1.Vertical; } });
13
+ const macro_model_1 = require("./models/macro.model");
14
+ Object.defineProperty(exports, "Macro", { enumerable: true, get: function () { return macro_model_1.Macro; } });
@@ -0,0 +1,24 @@
1
+ import { Types } from "mongoose";
2
+ export type MacroAction = "None" | "TransferToLiveAgent" | "CallConnect" | "EndChat" | "GoToNextMacro" | "SendLead";
3
+ export type MacroType = "Text" | "Consent" | "Calendar";
4
+ export interface IOption {
5
+ text: string;
6
+ action: MacroAction;
7
+ mapping?: Types.ObjectId | null;
8
+ }
9
+ export interface IMacro {
10
+ _id?: Types.ObjectId;
11
+ heading: string;
12
+ text: string;
13
+ type: MacroType;
14
+ action: MacroAction;
15
+ markAsCTA?: boolean;
16
+ visibleOnChatDashboard?: boolean;
17
+ options?: IOption[];
18
+ vertical?: Types.ObjectId;
19
+ isDeleted?: boolean;
20
+ isPublished?: boolean;
21
+ createdAt?: Date;
22
+ updatedAt?: Date;
23
+ }
24
+ //# sourceMappingURL=macro.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macro.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/macro.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,qBAAqB,GACrB,aAAa,GACb,SAAS,GACT,eAAe,GACf,UAAU,CAAC;AAEf,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AAExD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ import { Types } from "mongoose";
2
+ export type VerticalType = "General" | "IndustrySpecific" | "ClientSpecific";
3
+ export interface IVertical {
4
+ _id?: Types.ObjectId;
5
+ name: string;
6
+ type: VerticalType;
7
+ host: string;
8
+ industry?: string;
9
+ companyName?: string;
10
+ companyKey?: string;
11
+ accountKey?: string;
12
+ macros?: Types.ObjectId[];
13
+ createdBy: string;
14
+ lastEditedBy: string;
15
+ isDeleted?: boolean;
16
+ createdAt?: Date;
17
+ updatedAt?: Date;
18
+ }
19
+ //# sourceMappingURL=vertical.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vertical.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/vertical.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AAE7E,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import mongoose from "mongoose";
2
+ import { IMacro } from "../interfaces/macro.interface";
3
+ export declare const Macro: mongoose.Model<IMacro, {}, {}, {}, mongoose.Document<unknown, {}, IMacro, {}, {}> & IMacro & Required<{
4
+ _id: mongoose.Types.ObjectId;
5
+ }> & {
6
+ __v: number;
7
+ }, any>;
8
+ export default Macro;
9
+ //# sourceMappingURL=macro.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macro.model.d.ts","sourceRoot":"","sources":["../../src/models/macro.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAW,MAAM,+BAA+B,CAAC;AAkFhE,eAAO,MAAM,KAAK;;;;OAA+C,CAAC;AAClE,eAAe,KAAK,CAAC"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Macro = void 0;
37
+ const mongoose_1 = __importStar(require("mongoose"));
38
+ const optionSchema = new mongoose_1.Schema({
39
+ text: {
40
+ type: String,
41
+ required: [true, "Option text is required"],
42
+ trim: true,
43
+ },
44
+ action: {
45
+ type: String,
46
+ enum: [
47
+ "None",
48
+ "TransferToLiveAgent",
49
+ "CallConnect",
50
+ "EndChat",
51
+ "GoToNextMacro",
52
+ "SendLead",
53
+ ],
54
+ default: "None",
55
+ },
56
+ mapping: {
57
+ type: mongoose_1.Schema.Types.ObjectId,
58
+ ref: "Macro",
59
+ default: null,
60
+ },
61
+ });
62
+ const macroSchema = new mongoose_1.Schema({
63
+ heading: {
64
+ type: String,
65
+ required: [true, "Macro heading is required"],
66
+ trim: true,
67
+ },
68
+ text: {
69
+ type: String,
70
+ required: [true, "Macro text is required"],
71
+ },
72
+ type: {
73
+ type: String,
74
+ enum: ["Text", "Consent", "Calendar"],
75
+ required: [true, "Macro type is required"],
76
+ default: "Text",
77
+ },
78
+ action: {
79
+ type: String,
80
+ enum: [
81
+ "None",
82
+ "TransferToLiveAgent",
83
+ "CallConnect",
84
+ "EndChat",
85
+ "GoToNextMacro",
86
+ "SendLead",
87
+ ],
88
+ required: [true, "Macro action is required"],
89
+ default: "None",
90
+ },
91
+ markAsCTA: {
92
+ type: Boolean,
93
+ default: false,
94
+ },
95
+ visibleOnChatDashboard: {
96
+ type: Boolean,
97
+ default: false,
98
+ },
99
+ options: [optionSchema],
100
+ vertical: {
101
+ type: mongoose_1.Schema.Types.ObjectId,
102
+ ref: "Vertical",
103
+ },
104
+ isDeleted: {
105
+ type: Boolean,
106
+ default: false,
107
+ },
108
+ isPublished: {
109
+ type: Boolean,
110
+ default: false,
111
+ },
112
+ }, { timestamps: true });
113
+ exports.Macro = mongoose_1.default.model("Macro", macroSchema);
114
+ exports.default = exports.Macro;
@@ -0,0 +1,9 @@
1
+ import mongoose from "mongoose";
2
+ import { IVertical } from "../interfaces/vertical.interface";
3
+ export declare const Vertical: mongoose.Model<IVertical, {}, {}, {}, mongoose.Document<unknown, {}, IVertical, {}, {}> & IVertical & Required<{
4
+ _id: mongoose.Types.ObjectId;
5
+ }> & {
6
+ __v: number;
7
+ }, any>;
8
+ export default Vertical;
9
+ //# sourceMappingURL=vertical.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vertical.model.d.ts","sourceRoot":"","sources":["../../src/models/vertical.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAgE7D,eAAO,MAAM,QAAQ;;;;OAAwD,CAAC;AAC9E,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Vertical = void 0;
37
+ const mongoose_1 = __importStar(require("mongoose"));
38
+ const verticalSchema = new mongoose_1.Schema({
39
+ name: {
40
+ type: String,
41
+ required: [true, "Vertical name is required"],
42
+ trim: true,
43
+ },
44
+ type: {
45
+ type: String,
46
+ enum: ["General", "IndustrySpecific", "ClientSpecific"],
47
+ required: [true, "Vertical type is required"],
48
+ },
49
+ host: {
50
+ type: String,
51
+ required: [true, "Host (creator/owner) is required"],
52
+ },
53
+ industry: {
54
+ type: String,
55
+ trim: true,
56
+ },
57
+ companyName: {
58
+ type: String,
59
+ required: function () {
60
+ return this.type === "ClientSpecific";
61
+ },
62
+ trim: true,
63
+ },
64
+ companyKey: {
65
+ type: String,
66
+ required: function () {
67
+ return this.type === "ClientSpecific";
68
+ },
69
+ trim: true,
70
+ },
71
+ accountKey: {
72
+ type: String,
73
+ trim: true,
74
+ },
75
+ macros: [
76
+ {
77
+ type: mongoose_1.Schema.Types.ObjectId,
78
+ ref: "Macro",
79
+ },
80
+ ],
81
+ createdBy: {
82
+ type: String,
83
+ required: true,
84
+ },
85
+ lastEditedBy: {
86
+ type: String,
87
+ required: true,
88
+ },
89
+ isDeleted: {
90
+ type: Boolean,
91
+ default: false,
92
+ },
93
+ }, { timestamps: true });
94
+ verticalSchema.index({ name: 1, type: 1, companyName: 1 });
95
+ exports.Vertical = mongoose_1.default.model("Vertical", verticalSchema);
96
+ exports.default = exports.Vertical;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orbitx-core-models",
3
- "version": "1.0.4",
3
+ "version": "2.0.0",
4
4
  "description": "Shared Mongoose models and interfaces for OrbitX services",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",