orbitx-core-models 11.77.0 → 11.78.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 +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/interfaces/company.interface.d.ts +10 -4
- package/dist/interfaces/company.interface.d.ts.map +1 -1
- package/dist/interfaces/companySettings.interface.d.ts +35 -0
- package/dist/interfaces/companySettings.interface.d.ts.map +1 -0
- package/dist/interfaces/companySettings.interface.js +2 -0
- package/dist/models/company.model.d.ts.map +1 -1
- package/dist/models/company.model.js +11 -101
- package/dist/models/companySettings.model.d.ts +9 -0
- package/dist/models/companySettings.model.d.ts.map +1 -0
- package/dist/models/companySettings.model.js +181 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { Vertical } from "./models/vertical.model";
|
|
|
5
5
|
import { Macro } from "./models/macro.model";
|
|
6
6
|
import { Partner } from "./models/partner.model";
|
|
7
7
|
import { Company } from "./models/company.model";
|
|
8
|
+
import { CompanySettings } from "./models/companySettings.model";
|
|
8
9
|
import { Review } from "./models/review.model";
|
|
9
10
|
import { Wallet } from "./models/wallet.model";
|
|
10
11
|
import { StripeLog } from "./models/stripeLog.model";
|
|
@@ -27,7 +28,8 @@ import { IVertical } from "./interfaces/vertical.interface";
|
|
|
27
28
|
import { IMessage } from "./interfaces/message.interface";
|
|
28
29
|
import { IUser } from "./interfaces/user.interface";
|
|
29
30
|
import { IPartner } from "./interfaces/partner.interface";
|
|
30
|
-
import { ICompany } from "./interfaces/company.interface";
|
|
31
|
+
import { ICompany, IOnboardingStep } from "./interfaces/company.interface";
|
|
32
|
+
import { ICompanySettings, ICallConnectSettings, ILeadConfig } from "./interfaces/companySettings.interface";
|
|
31
33
|
import { IReview } from "./interfaces/review.interface";
|
|
32
34
|
import { IWallet } from "./interfaces/wallet.interface";
|
|
33
35
|
import { IStripeLog } from "./interfaces/stripeLog.interface";
|
|
@@ -44,6 +46,6 @@ import { ISubscription } from "./interfaces/subscription.interface";
|
|
|
44
46
|
import { IVisitor } from "./interfaces/visitor.interface";
|
|
45
47
|
import { IGroup } from "./interfaces/group.interface";
|
|
46
48
|
import { IAgent } from "./interfaces/agent.interface";
|
|
47
|
-
export { Chat, Message, User, Vertical, Macro, Partner, Company, Review, Wallet, StripeLog, Transaction, Lead, TierConfig, TierProgress, MonthlyTierSnapshot, Product, Plan, PlanOption, Addon, Subscription, Visitor, Group, Agent };
|
|
48
|
-
export type { IChat, IMessage, IUser, IVertical, IMacro, IPartner, ICompany, IReview, IWallet, IStripeLog, ITransaction, ILead, ITierConfig, ITierProgress, IMonthlyTierSnapshot, IProduct, IPlan, IPlanOption, IAddon, ISubscription, IVisitor, IGroup, IAgent, };
|
|
49
|
+
export { Chat, Message, User, Vertical, Macro, Partner, Company, CompanySettings, Review, Wallet, StripeLog, Transaction, Lead, TierConfig, TierProgress, MonthlyTierSnapshot, Product, Plan, PlanOption, Addon, Subscription, Visitor, Group, Agent };
|
|
50
|
+
export type { IChat, IMessage, IUser, IVertical, IMacro, IPartner, ICompany, IOnboardingStep, ICompanySettings, ICallConnectSettings, ILeadConfig, IReview, IWallet, IStripeLog, ITransaction, ILead, ITierConfig, ITierProgress, IMonthlyTierSnapshot, IProduct, IPlan, IPlanOption, IAddon, ISubscription, IVisitor, IGroup, IAgent, };
|
|
49
51
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;A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,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,EACL,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,OAAO,EACP,OAAO,EACP,eAAe,EACf,MAAM,EACN,MAAM,EACN,SAAS,EACT,WAAW,EACX,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,KAAK,EACL,YAAY,EACZ,OAAO,EACP,KAAK,EACL,KAAK,EACN,CAAC;AACF,YAAY,EACV,KAAK,EACL,QAAQ,EACR,KAAK,EACL,SAAS,EACT,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,KAAK,EACL,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,KAAK,EACL,WAAW,EACX,MAAM,EACN,aAAa,EACb,QAAQ,EACR,MAAM,EACN,MAAM,GACP,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Agent = exports.Group = exports.Visitor = exports.Subscription = exports.Addon = exports.PlanOption = exports.Plan = exports.Product = exports.MonthlyTierSnapshot = exports.TierProgress = exports.TierConfig = exports.Lead = exports.Transaction = exports.StripeLog = exports.Wallet = exports.Review = exports.Company = exports.Partner = exports.Macro = exports.Vertical = exports.User = exports.Message = exports.Chat = void 0;
|
|
3
|
+
exports.Agent = exports.Group = exports.Visitor = exports.Subscription = exports.Addon = exports.PlanOption = exports.Plan = exports.Product = exports.MonthlyTierSnapshot = exports.TierProgress = exports.TierConfig = exports.Lead = exports.Transaction = exports.StripeLog = exports.Wallet = exports.Review = exports.CompanySettings = exports.Company = exports.Partner = exports.Macro = exports.Vertical = exports.User = exports.Message = exports.Chat = void 0;
|
|
4
4
|
// MODELS
|
|
5
5
|
const chat_model_1 = require("./models/chat.model");
|
|
6
6
|
Object.defineProperty(exports, "Chat", { enumerable: true, get: function () { return chat_model_1.Chat; } });
|
|
@@ -16,6 +16,8 @@ const partner_model_1 = require("./models/partner.model");
|
|
|
16
16
|
Object.defineProperty(exports, "Partner", { enumerable: true, get: function () { return partner_model_1.Partner; } });
|
|
17
17
|
const company_model_1 = require("./models/company.model");
|
|
18
18
|
Object.defineProperty(exports, "Company", { enumerable: true, get: function () { return company_model_1.Company; } });
|
|
19
|
+
const companySettings_model_1 = require("./models/companySettings.model");
|
|
20
|
+
Object.defineProperty(exports, "CompanySettings", { enumerable: true, get: function () { return companySettings_model_1.CompanySettings; } });
|
|
19
21
|
const review_model_1 = require("./models/review.model");
|
|
20
22
|
Object.defineProperty(exports, "Review", { enumerable: true, get: function () { return review_model_1.Review; } });
|
|
21
23
|
const wallet_model_1 = require("./models/wallet.model");
|
|
@@ -58,13 +58,15 @@ export interface IAvatar {
|
|
|
58
58
|
name?: string;
|
|
59
59
|
url?: string;
|
|
60
60
|
}
|
|
61
|
+
export interface IOnboardingStep {
|
|
62
|
+
step: string;
|
|
63
|
+
completed: boolean;
|
|
64
|
+
}
|
|
61
65
|
export interface ICompany extends mongoose.Document {
|
|
62
66
|
basicInfo: IBasicInfo;
|
|
63
67
|
contactInfo: IContactInfo;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
officeHours?: IHour[];
|
|
67
|
-
widgetConfig?: IWidgetConfig;
|
|
68
|
+
/** Reference to the CompanySettings document (1-to-1). */
|
|
69
|
+
settings?: Types.ObjectId;
|
|
68
70
|
stripeCustomerId?: string;
|
|
69
71
|
isSubscriptionActive?: boolean;
|
|
70
72
|
subscription?: Types.ObjectId;
|
|
@@ -76,6 +78,10 @@ export interface ICompany extends mongoose.Document {
|
|
|
76
78
|
slackIntegration?: ISlackIntegration;
|
|
77
79
|
googleChatIntegration?: IGoogleChatIntegration;
|
|
78
80
|
avatars?: IAvatar[];
|
|
81
|
+
/** Tracks which onboarding steps the company has completed. */
|
|
82
|
+
onboardingSteps?: IOnboardingStep[];
|
|
83
|
+
/** True once all required onboarding steps are done. */
|
|
84
|
+
isOnboarded?: boolean;
|
|
79
85
|
createdAt?: Date;
|
|
80
86
|
updatedAt?: Date;
|
|
81
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/company.interface.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,SAAS,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,IA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AAM,GAAG,UAAU,CAAC;IAC9C,QAAQ,CAAC,EAAE,CAAC,aAAa,GAAG,eAAe,GAAG,OAAO,GAAG,kBAAkB,CAAC,EAAE,CAAC;CAC/E;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"company.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/company.interface.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,SAAS,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,OAAO,EAAE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C;IACrB,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import mongoose, { Types } from "mongoose";
|
|
2
|
+
import { IHour, ICallSettings, IWidgetConfig } from "./company.interface";
|
|
3
|
+
export interface ICallConnectSettings {
|
|
4
|
+
/** The dedicated call-connect phone number. */
|
|
5
|
+
phoneNumber?: string;
|
|
6
|
+
/** Use the call-connect number as the caller ID shown to the visitor. */
|
|
7
|
+
useCallConnectNumberForCallerId?: boolean;
|
|
8
|
+
/** Dial the company's main number first before connecting the visitor. */
|
|
9
|
+
companyNumberFirst?: boolean;
|
|
10
|
+
/** Master toggle — whether call connect is active for this company. */
|
|
11
|
+
isCallConnectEnabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ILeadConfig {
|
|
14
|
+
/** List of email addresses that will receive lead notification emails. */
|
|
15
|
+
sentToEmails?: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface ICompanySettings extends mongoose.Document {
|
|
18
|
+
/** Reference to the owning Company document. */
|
|
19
|
+
company: Types.ObjectId;
|
|
20
|
+
/** General call / chat channel settings. */
|
|
21
|
+
callSettings?: ICallSettings;
|
|
22
|
+
/** Call-connect-specific settings. */
|
|
23
|
+
callConnectSettings?: ICallConnectSettings;
|
|
24
|
+
/** Per-day availability windows for call connect. */
|
|
25
|
+
callConnectHours?: IHour[];
|
|
26
|
+
/** Per-day office-hours windows. */
|
|
27
|
+
officeHours?: IHour[];
|
|
28
|
+
/** Chat widget appearance & feature config. */
|
|
29
|
+
widgetConfig?: IWidgetConfig;
|
|
30
|
+
/** Lead delivery configuration. */
|
|
31
|
+
leadConfig?: ILeadConfig;
|
|
32
|
+
createdAt?: Date;
|
|
33
|
+
updatedAt?: Date;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=companySettings.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companySettings.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/companySettings.interface.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EACL,KAAK,EACL,aAAa,EACb,aAAa,EACd,MAAM,qBAAqB,CAAC;AAM7B,MAAM,WAAW,oBAAoB;IACnC,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,+BAA+B,CAAC,EAAE,OAAO,CAAC;IAC1C,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAMD,MAAM,WAAW,WAAW;IAC1B,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAMD,MAAM,WAAW,gBAAiB,SAAQ,QAAQ,CAAC,QAAQ;IACzD,gDAAgD;IAChD,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC;IAExB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,aAAa,CAAC;IAE7B,sCAAsC;IACtC,mBAAmB,CAAC,EAAE,oBAAoB,CAAC;IAE3C,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC;IAE3B,oCAAoC;IACpC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;IAEtB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,aAAa,CAAC;IAE7B,mCAAmC;IACnC,UAAU,CAAC,EAAE,WAAW,CAAC;IAEzB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company.model.d.ts","sourceRoot":"","sources":["../../src/models/company.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAA2B,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"company.model.d.ts","sourceRoot":"","sources":["../../src/models/company.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAA2B,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AA2J3D,eAAO,MAAM,OAAO;;;;OAAqD,CAAC;AAC1E,eAAe,OAAO,CAAC"}
|
|
@@ -35,30 +35,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Company = void 0;
|
|
37
37
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
38
|
-
const daysOfWeek = [
|
|
39
|
-
"Sunday",
|
|
40
|
-
"Monday",
|
|
41
|
-
"Tuesday",
|
|
42
|
-
"Wednesday",
|
|
43
|
-
"Thursday",
|
|
44
|
-
"Friday",
|
|
45
|
-
"Saturday",
|
|
46
|
-
];
|
|
47
|
-
// Hour Schema
|
|
48
|
-
const hourSchema = new mongoose_1.Schema({
|
|
49
|
-
day: { type: String, enum: daysOfWeek, required: true },
|
|
50
|
-
startTime: {
|
|
51
|
-
type: String,
|
|
52
|
-
required: true,
|
|
53
|
-
match: [/^([01]\d|2[0-3]):([0-5]\d)$/, "Invalid time format. Use HH:mm."],
|
|
54
|
-
},
|
|
55
|
-
endTime: {
|
|
56
|
-
type: String,
|
|
57
|
-
required: true,
|
|
58
|
-
match: [/^([01]\d|2[0-3]):([0-5]\d)$/, "Invalid time format. Use HH:mm."],
|
|
59
|
-
},
|
|
60
|
-
active: { type: Boolean, default: false },
|
|
61
|
-
}, { _id: false });
|
|
62
38
|
// Company Schema
|
|
63
39
|
const companySchema = new mongoose_1.Schema({
|
|
64
40
|
basicInfo: {
|
|
@@ -119,41 +95,10 @@ const companySchema = new mongoose_1.Schema({
|
|
|
119
95
|
country: { type: String, trim: true },
|
|
120
96
|
coverageArea: { type: String, trim: true },
|
|
121
97
|
},
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
trim: true,
|
|
127
|
-
},
|
|
128
|
-
transcriptEmail: {
|
|
129
|
-
type: String,
|
|
130
|
-
trim: true,
|
|
131
|
-
lowercase: true,
|
|
132
|
-
match: [/^\S+@\S+\.\S+$/, "Invalid transcript email format"],
|
|
133
|
-
},
|
|
134
|
-
smsChatNumber: {
|
|
135
|
-
type: String,
|
|
136
|
-
trim: true,
|
|
137
|
-
},
|
|
138
|
-
visitorGreeting: { type: String, trim: true },
|
|
139
|
-
visitorGreetingDelay: { type: Number, min: 0, default: 0 },
|
|
140
|
-
businessGreeting: { type: String, trim: true },
|
|
141
|
-
businessGreetingDelay: { type: Number, min: 0, default: 0 },
|
|
142
|
-
transcriptOverride: { type: Boolean, default: false },
|
|
143
|
-
useCallConnectNumberForCallerId: { type: Boolean, default: false },
|
|
144
|
-
companyNumberFirst: { type: Boolean, default: false },
|
|
145
|
-
override: { type: Boolean, default: false },
|
|
146
|
-
officeHoursMonitoring: { type: Boolean, default: false },
|
|
147
|
-
},
|
|
148
|
-
callConnectHours: {
|
|
149
|
-
type: [hourSchema],
|
|
150
|
-
validate: {
|
|
151
|
-
validator: (arr) => {
|
|
152
|
-
const days = arr.map((h) => h.day);
|
|
153
|
-
return days.length === new Set(days).size;
|
|
154
|
-
},
|
|
155
|
-
message: "Duplicate days in call connect hours",
|
|
156
|
-
},
|
|
98
|
+
/** Reference to the CompanySettings document (1-to-1). */
|
|
99
|
+
settings: {
|
|
100
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
101
|
+
ref: "CompanySettings",
|
|
157
102
|
},
|
|
158
103
|
hubspotIntegration: {
|
|
159
104
|
isConnected: { type: Boolean, default: false },
|
|
@@ -197,48 +142,6 @@ const companySchema = new mongoose_1.Schema({
|
|
|
197
142
|
webhookUrl: String,
|
|
198
143
|
lastSyncedAt: Date,
|
|
199
144
|
},
|
|
200
|
-
officeHours: {
|
|
201
|
-
type: [hourSchema],
|
|
202
|
-
validate: {
|
|
203
|
-
validator: (arr) => {
|
|
204
|
-
const days = arr.map((h) => h.day);
|
|
205
|
-
return days.length === new Set(days).size;
|
|
206
|
-
},
|
|
207
|
-
message: "Duplicate days in office hours",
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
widgetConfig: {
|
|
211
|
-
position: {
|
|
212
|
-
type: String,
|
|
213
|
-
enum: ["bottom-left", "bottom-right"],
|
|
214
|
-
},
|
|
215
|
-
style: {
|
|
216
|
-
type: String,
|
|
217
|
-
enum: ["bubble", "bar"],
|
|
218
|
-
},
|
|
219
|
-
borderRadius: {
|
|
220
|
-
type: String,
|
|
221
|
-
enum: ["round", "rounded", "square"],
|
|
222
|
-
},
|
|
223
|
-
bgColor: {
|
|
224
|
-
type: String,
|
|
225
|
-
},
|
|
226
|
-
textColor: {
|
|
227
|
-
type: String,
|
|
228
|
-
},
|
|
229
|
-
size: {
|
|
230
|
-
type: String,
|
|
231
|
-
enum: ["small", "medium", "large"],
|
|
232
|
-
},
|
|
233
|
-
animation: {
|
|
234
|
-
type: String,
|
|
235
|
-
enum: ["bounce-in", "fade", "slide-up"],
|
|
236
|
-
},
|
|
237
|
-
features: {
|
|
238
|
-
type: [String],
|
|
239
|
-
enum: ["file-upload", "emoji-support", "sound", "email-transcript"],
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
145
|
stripeCustomerId: { type: String, trim: true },
|
|
243
146
|
isSubscriptionActive: { type: Boolean, default: false },
|
|
244
147
|
parentCompany: { type: mongoose_1.Schema.Types.ObjectId, ref: "Company" },
|
|
@@ -253,6 +156,13 @@ const companySchema = new mongoose_1.Schema({
|
|
|
253
156
|
url: { type: String, trim: true },
|
|
254
157
|
},
|
|
255
158
|
],
|
|
159
|
+
onboardingSteps: [
|
|
160
|
+
{
|
|
161
|
+
step: { type: String, required: true, trim: true },
|
|
162
|
+
completed: { type: Boolean, default: false },
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
isOnboarded: { type: Boolean, default: false },
|
|
256
166
|
}, {
|
|
257
167
|
timestamps: true,
|
|
258
168
|
toJSON: { virtuals: true },
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
import { ICompanySettings } from "../interfaces/companySettings.interface";
|
|
3
|
+
export declare const CompanySettings: mongoose.Model<ICompanySettings, {}, {}, {}, mongoose.Document<unknown, {}, ICompanySettings, {}, {}> & ICompanySettings & Required<{
|
|
4
|
+
_id: unknown;
|
|
5
|
+
}> & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>;
|
|
8
|
+
export default CompanySettings;
|
|
9
|
+
//# sourceMappingURL=companySettings.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companySettings.model.d.ts","sourceRoot":"","sources":["../../src/models/companySettings.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAA2B,MAAM,UAAU,CAAC;AACnD,OAAO,EACL,gBAAgB,EAGjB,MAAM,yCAAyC,CAAC;AAqLjD,eAAO,MAAM,eAAe;;;;OAG3B,CAAC;AACF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
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.CompanySettings = void 0;
|
|
37
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
38
|
+
const daysOfWeek = [
|
|
39
|
+
"Sunday",
|
|
40
|
+
"Monday",
|
|
41
|
+
"Tuesday",
|
|
42
|
+
"Wednesday",
|
|
43
|
+
"Thursday",
|
|
44
|
+
"Friday",
|
|
45
|
+
"Saturday",
|
|
46
|
+
];
|
|
47
|
+
// ─────────────────────────────────────────────
|
|
48
|
+
// HOUR SUB-SCHEMA (reused for callConnectHours & officeHours)
|
|
49
|
+
// ─────────────────────────────────────────────
|
|
50
|
+
const hourSchema = new mongoose_1.Schema({
|
|
51
|
+
day: { type: String, enum: daysOfWeek, required: true },
|
|
52
|
+
startTime: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: true,
|
|
55
|
+
match: [/^([01]\d|2[0-3]):([0-5]\d)$/, "Invalid time format. Use HH:mm."],
|
|
56
|
+
},
|
|
57
|
+
endTime: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: true,
|
|
60
|
+
match: [/^([01]\d|2[0-3]):([0-5]\d)$/, "Invalid time format. Use HH:mm."],
|
|
61
|
+
},
|
|
62
|
+
active: { type: Boolean, default: false },
|
|
63
|
+
}, { _id: false });
|
|
64
|
+
// ─────────────────────────────────────────────
|
|
65
|
+
// GENERAL CALL SETTINGS SUB-SCHEMA
|
|
66
|
+
// ─────────────────────────────────────────────
|
|
67
|
+
const callSettingsSchema = new mongoose_1.Schema({
|
|
68
|
+
timezone: { type: String, trim: true },
|
|
69
|
+
transcriptEmail: {
|
|
70
|
+
type: String,
|
|
71
|
+
trim: true,
|
|
72
|
+
lowercase: true,
|
|
73
|
+
match: [/^\S+@\S+\.\S+$/, "Invalid transcript email format"],
|
|
74
|
+
},
|
|
75
|
+
smsChatNumber: { type: String, trim: true },
|
|
76
|
+
visitorGreeting: { type: String, trim: true },
|
|
77
|
+
visitorGreetingDelay: { type: Number, min: 0, default: 0 },
|
|
78
|
+
businessGreeting: { type: String, trim: true },
|
|
79
|
+
businessGreetingDelay: { type: Number, min: 0, default: 0 },
|
|
80
|
+
transcriptOverride: { type: Boolean, default: false },
|
|
81
|
+
override: { type: Boolean, default: false },
|
|
82
|
+
officeHoursMonitoring: { type: Boolean, default: false },
|
|
83
|
+
}, { _id: false });
|
|
84
|
+
// ─────────────────────────────────────────────
|
|
85
|
+
// CALL CONNECT SETTINGS SUB-SCHEMA
|
|
86
|
+
// ─────────────────────────────────────────────
|
|
87
|
+
const callConnectSettingsSchema = new mongoose_1.Schema({
|
|
88
|
+
phoneNumber: { type: String, trim: true },
|
|
89
|
+
useCallConnectNumberForCallerId: { type: Boolean, default: false },
|
|
90
|
+
companyNumberFirst: { type: Boolean, default: false },
|
|
91
|
+
isCallConnectEnabled: { type: Boolean, default: false },
|
|
92
|
+
}, { _id: false });
|
|
93
|
+
// ─────────────────────────────────────────────
|
|
94
|
+
// WIDGET CONFIG SUB-SCHEMA
|
|
95
|
+
// ─────────────────────────────────────────────
|
|
96
|
+
const widgetConfigSchema = new mongoose_1.Schema({
|
|
97
|
+
position: {
|
|
98
|
+
type: String,
|
|
99
|
+
enum: ["bottom-left", "bottom-right"],
|
|
100
|
+
},
|
|
101
|
+
style: {
|
|
102
|
+
type: String,
|
|
103
|
+
enum: ["bubble", "bar"],
|
|
104
|
+
},
|
|
105
|
+
borderRadius: {
|
|
106
|
+
type: String,
|
|
107
|
+
enum: ["round", "rounded", "square"],
|
|
108
|
+
},
|
|
109
|
+
bgColor: { type: String },
|
|
110
|
+
textColor: { type: String },
|
|
111
|
+
size: {
|
|
112
|
+
type: String,
|
|
113
|
+
enum: ["small", "medium", "large"],
|
|
114
|
+
},
|
|
115
|
+
animation: {
|
|
116
|
+
type: String,
|
|
117
|
+
enum: ["bounce-in", "fade", "slide-up"],
|
|
118
|
+
},
|
|
119
|
+
features: {
|
|
120
|
+
type: [String],
|
|
121
|
+
enum: ["file-upload", "emoji-support", "sound", "email-transcript"],
|
|
122
|
+
},
|
|
123
|
+
}, { _id: false });
|
|
124
|
+
// ─────────────────────────────────────────────
|
|
125
|
+
// LEAD CONFIG SUB-SCHEMA
|
|
126
|
+
// ─────────────────────────────────────────────
|
|
127
|
+
const leadConfigSchema = new mongoose_1.Schema({
|
|
128
|
+
sentToEmails: {
|
|
129
|
+
type: [String],
|
|
130
|
+
default: [],
|
|
131
|
+
validate: {
|
|
132
|
+
validator: (arr) => arr.every((email) => /^\S+@\S+\.\S+$/.test(email)),
|
|
133
|
+
message: "One or more email addresses in sentToEmails are invalid",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
}, { _id: false });
|
|
137
|
+
// ─────────────────────────────────────────────
|
|
138
|
+
// COMPANY SETTINGS SCHEMA
|
|
139
|
+
// ─────────────────────────────────────────────
|
|
140
|
+
const companySettingsSchema = new mongoose_1.Schema({
|
|
141
|
+
company: {
|
|
142
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
143
|
+
ref: "Company",
|
|
144
|
+
required: true,
|
|
145
|
+
unique: true,
|
|
146
|
+
},
|
|
147
|
+
callSettings: callSettingsSchema,
|
|
148
|
+
callConnectSettings: callConnectSettingsSchema,
|
|
149
|
+
callConnectHours: {
|
|
150
|
+
type: [hourSchema],
|
|
151
|
+
validate: {
|
|
152
|
+
validator: (arr) => {
|
|
153
|
+
const days = arr.map((h) => h.day);
|
|
154
|
+
return days.length === new Set(days).size;
|
|
155
|
+
},
|
|
156
|
+
message: "Duplicate days in call connect hours",
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
officeHours: {
|
|
160
|
+
type: [hourSchema],
|
|
161
|
+
validate: {
|
|
162
|
+
validator: (arr) => {
|
|
163
|
+
const days = arr.map((h) => h.day);
|
|
164
|
+
return days.length === new Set(days).size;
|
|
165
|
+
},
|
|
166
|
+
message: "Duplicate days in office hours",
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
widgetConfig: widgetConfigSchema,
|
|
170
|
+
leadConfig: leadConfigSchema,
|
|
171
|
+
}, {
|
|
172
|
+
timestamps: true,
|
|
173
|
+
toJSON: { virtuals: true },
|
|
174
|
+
toObject: { virtuals: true },
|
|
175
|
+
});
|
|
176
|
+
// ─────────────────────────────────────────────
|
|
177
|
+
// INDEXES
|
|
178
|
+
// ─────────────────────────────────────────────
|
|
179
|
+
companySettingsSchema.index({ company: 1 }, { unique: true });
|
|
180
|
+
exports.CompanySettings = mongoose_1.default.model("CompanySettings", companySettingsSchema);
|
|
181
|
+
exports.default = exports.CompanySettings;
|