@servicetitan/titan-chatbot-api 7.1.2 → 8.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/CHANGELOG.md +13 -0
- package/dist/api-client/__mocks__/chatbot-api-client.mock.js +21 -47
- package/dist/api-client/__mocks__/chatbot-api-client.mock.js.map +1 -1
- package/dist/api-client/base/chatbot-api-client.js +3 -4
- package/dist/api-client/base/chatbot-api-client.js.map +1 -1
- package/dist/api-client/help-center/__tests__/converter-from-models.test.js +48 -15
- package/dist/api-client/help-center/__tests__/converter-from-models.test.js.map +1 -1
- package/dist/api-client/help-center/__tests__/converter-to-models.test.js +23 -22
- package/dist/api-client/help-center/__tests__/converter-to-models.test.js.map +1 -1
- package/dist/api-client/help-center/chatbot-api-client.js +51 -52
- package/dist/api-client/help-center/chatbot-api-client.js.map +1 -1
- package/dist/api-client/help-center/converter-from-models.js +15 -12
- package/dist/api-client/help-center/converter-from-models.js.map +1 -1
- package/dist/api-client/help-center/converter-to-models.js +29 -26
- package/dist/api-client/help-center/converter-to-models.js.map +1 -1
- package/dist/api-client/help-center/index.d.ts +2 -1
- package/dist/api-client/help-center/index.d.ts.map +1 -1
- package/dist/api-client/help-center/index.js +1 -0
- package/dist/api-client/help-center/index.js.map +1 -1
- package/dist/api-client/help-center/native-client.js +1192 -2884
- package/dist/api-client/help-center/native-client.js.map +1 -1
- package/dist/api-client/index.d.ts +2 -1
- package/dist/api-client/index.d.ts.map +1 -1
- package/dist/api-client/index.js +14 -7
- package/dist/api-client/index.js.map +1 -1
- package/dist/api-client/models/__mocks__/models.mock.js +154 -124
- package/dist/api-client/models/__mocks__/models.mock.js.map +1 -1
- package/dist/api-client/models/index.d.ts +2 -1
- package/dist/api-client/models/index.d.ts.map +1 -1
- package/dist/api-client/models/index.js +8 -7
- package/dist/api-client/models/index.js.map +1 -1
- package/dist/api-client/titan-chat/__tests__/native-client.test.js +6 -6
- package/dist/api-client/titan-chat/__tests__/native-client.test.js.map +1 -1
- package/dist/api-client/titan-chat/chatbot-api-client.js +40 -35
- package/dist/api-client/titan-chat/chatbot-api-client.js.map +1 -1
- package/dist/api-client/titan-chat/index.d.ts +2 -1
- package/dist/api-client/titan-chat/index.d.ts.map +1 -1
- package/dist/api-client/titan-chat/index.js +1 -0
- package/dist/api-client/titan-chat/index.js.map +1 -1
- package/dist/api-client/titan-chat/native-client.js +359 -812
- package/dist/api-client/titan-chat/native-client.js.map +1 -1
- package/dist/api-client/utils/__tests__/model-utils.test.js +454 -191
- package/dist/api-client/utils/__tests__/model-utils.test.js.map +1 -1
- package/dist/api-client/utils/model-utils.d.ts.map +1 -1
- package/dist/api-client/utils/model-utils.js +28 -25
- package/dist/api-client/utils/model-utils.js.map +1 -1
- package/dist/hooks/use-customization-chatbot.js +2 -1
- package/dist/hooks/use-customization-chatbot.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/models/chatbot-customizations.js +2 -1
- package/dist/models/chatbot-customizations.js.map +1 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +2 -1
- package/dist/models/index.js.map +1 -1
- package/dist/stores/__tests__/chatbot-ui-backend.store.test.js +267 -172
- package/dist/stores/__tests__/chatbot-ui-backend.store.test.js.map +1 -1
- package/dist/stores/__tests__/chatbot-ui.store.test.js +61 -64
- package/dist/stores/__tests__/chatbot-ui.store.test.js.map +1 -1
- package/dist/stores/__tests__/filter.store.test.js +243 -116
- package/dist/stores/__tests__/filter.store.test.js.map +1 -1
- package/dist/stores/__tests__/initialize.store.test.js +9 -8
- package/dist/stores/__tests__/initialize.store.test.js.map +1 -1
- package/dist/stores/__tests__/message-feedback-guardrail.store.test.js +8 -7
- package/dist/stores/__tests__/message-feedback-guardrail.store.test.js.map +1 -1
- package/dist/stores/__tests__/message-feedback.store.test.js +34 -27
- package/dist/stores/__tests__/message-feedback.store.test.js.map +1 -1
- package/dist/stores/__tests__/session-feedback.store.test.js +9 -8
- package/dist/stores/__tests__/session-feedback.store.test.js.map +1 -1
- package/dist/stores/chatbot-ui-backend.store.js +171 -240
- package/dist/stores/chatbot-ui-backend.store.js.map +1 -1
- package/dist/stores/chatbot-ui.store.js +73 -46
- package/dist/stores/chatbot-ui.store.js.map +1 -1
- package/dist/stores/filter.store.js +298 -378
- package/dist/stores/filter.store.js.map +1 -1
- package/dist/stores/index.d.ts +5 -3
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +3 -2
- package/dist/stores/index.js.map +1 -1
- package/dist/stores/initialize.store.js +55 -51
- package/dist/stores/initialize.store.js.map +1 -1
- package/dist/stores/message-feedback-base.store.js +2 -1
- package/dist/stores/message-feedback-base.store.js.map +1 -1
- package/dist/stores/message-feedback-guardrail.store.js +50 -47
- package/dist/stores/message-feedback-guardrail.store.js.map +1 -1
- package/dist/stores/message-feedback.store.js +84 -89
- package/dist/stores/message-feedback.store.js.map +1 -1
- package/dist/stores/session-feedback.store.js +46 -39
- package/dist/stores/session-feedback.store.js.map +1 -1
- package/dist/utils/__tests__/axios-utils.test.js +8 -7
- package/dist/utils/__tests__/axios-utils.test.js.map +1 -1
- package/dist/utils/axios-utils.js +9 -7
- package/dist/utils/axios-utils.js.map +1 -1
- package/dist/utils/test-utils.js +5 -5
- package/dist/utils/test-utils.js.map +1 -1
- package/package.json +3 -3
- package/src/api-client/help-center/index.ts +2 -1
- package/src/api-client/help-center/native-client.ts +4 -4
- package/src/api-client/index.ts +2 -6
- package/src/api-client/models/index.ts +15 -13
- package/src/api-client/titan-chat/index.ts +2 -1
- package/src/api-client/utils/model-utils.ts +4 -8
- package/src/index.ts +1 -1
- package/src/models/index.ts +1 -1
- package/src/stores/index.ts +5 -12
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,46 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
2
15
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
16
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for
|
|
17
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
18
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
}
|
|
7
|
-
|
|
19
|
+
}
|
|
20
|
+
function _ts_metadata(k, v) {
|
|
8
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return function
|
|
12
|
-
|
|
22
|
+
}
|
|
23
|
+
function _ts_param(paramIndex, decorator) {
|
|
24
|
+
return function(target, key) {
|
|
25
|
+
decorator(target, key, paramIndex);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
13
28
|
import { inject, injectable } from '@servicetitan/react-ioc';
|
|
14
|
-
import { CHATBOT_CLIENT_SETTINGS
|
|
29
|
+
import { CHATBOT_CLIENT_SETTINGS } from '../base/chatbot-api-client';
|
|
15
30
|
// eslint-disable-next-line no-restricted-imports
|
|
16
31
|
import { Client } from './native-client';
|
|
17
|
-
|
|
18
|
-
* Client adapter adopts the generated titan chatbot client to the generic IChatbotApiClient interface.
|
|
19
|
-
* Contains client-specific methods for interacting with the titan chatbot API.
|
|
20
|
-
*/
|
|
21
|
-
let ChatbotApiClient = class ChatbotApiClient {
|
|
32
|
+
export class ChatbotApiClient {
|
|
22
33
|
get version() {
|
|
23
34
|
return this.chatbotApiClientSettings.version;
|
|
24
35
|
}
|
|
25
36
|
get clientId() {
|
|
26
37
|
return this.chatbotApiClientSettings.clientId;
|
|
27
38
|
}
|
|
28
|
-
constructor(chatbotApiClientSettings) {
|
|
29
|
-
Object.defineProperty(this, "chatbotApiClientSettings", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true,
|
|
33
|
-
value: chatbotApiClientSettings
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(this, "client", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: void 0
|
|
40
|
-
});
|
|
41
|
-
const { baseUrl, httpClient } = this.chatbotApiClientSettings.constructorParametersFactory();
|
|
42
|
-
this.client = new Client(baseUrl, httpClient);
|
|
43
|
-
}
|
|
44
39
|
postFeedback(body, abortSignal) {
|
|
45
40
|
return this.client.feedback(this.version, this.clientId, body, abortSignal);
|
|
46
41
|
}
|
|
@@ -65,11 +60,21 @@ let ChatbotApiClient = class ChatbotApiClient {
|
|
|
65
60
|
getTranscripts(start, end, signal) {
|
|
66
61
|
return this.client.transcripts(start, end, this.version, this.clientId, signal);
|
|
67
62
|
}
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
constructor(chatbotApiClientSettings){
|
|
64
|
+
_define_property(this, "chatbotApiClientSettings", void 0);
|
|
65
|
+
_define_property(this, "client", void 0);
|
|
66
|
+
this.chatbotApiClientSettings = chatbotApiClientSettings;
|
|
67
|
+
const { baseUrl, httpClient } = this.chatbotApiClientSettings.constructorParametersFactory();
|
|
68
|
+
this.client = new Client(baseUrl, httpClient);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
ChatbotApiClient = _ts_decorate([
|
|
70
72
|
injectable(),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
_ts_param(0, inject(CHATBOT_CLIENT_SETTINGS)),
|
|
74
|
+
_ts_metadata("design:type", Function),
|
|
75
|
+
_ts_metadata("design:paramtypes", [
|
|
76
|
+
typeof IChatbotClientSettingsTitanChat === "undefined" ? Object : IChatbotClientSettingsTitanChat
|
|
77
|
+
])
|
|
73
78
|
], ChatbotApiClient);
|
|
74
|
-
|
|
79
|
+
|
|
75
80
|
//# sourceMappingURL=chatbot-api-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/api-client/titan-chat/chatbot-api-client.ts"],"sourcesContent":["import { inject, injectable } from '@servicetitan/react-ioc';\nimport { Models } from '..';\nimport {\n CHATBOT_CLIENT_SETTINGS,\n FirstParameterType,\n IChatbotApiClient,\n IChatbotClientSettings,\n SecondParameterType,\n} from '../base/chatbot-api-client';\n// eslint-disable-next-line no-restricted-imports\nimport { Client } from './native-client';\n\n/**\n * Settings for the chatbot client, which includes a factory for constructor parameters, and additional settings\n * like version and clientId which are used in the API calls.\n */\nexport interface IChatbotClientSettingsTitanChat extends IChatbotClientSettings {\n constructorParametersFactory: () => {\n baseUrl?: FirstParameterType<typeof Client>;\n httpClient?: SecondParameterType<typeof Client>;\n };\n version: string;\n clientId: string;\n}\n\n/**\n * Client adapter adopts the generated titan chatbot client to the generic IChatbotApiClient interface.\n * Contains client-specific methods for interacting with the titan chatbot API.\n */\n@injectable()\nexport class ChatbotApiClient implements IChatbotApiClient {\n private readonly client: Client;\n\n get version(): string {\n return this.chatbotApiClientSettings.version;\n }\n\n get clientId(): string {\n return this.chatbotApiClientSettings.clientId;\n }\n\n constructor(\n @inject(CHATBOT_CLIENT_SETTINGS)\n private readonly chatbotApiClientSettings: IChatbotClientSettingsTitanChat\n ) {\n const { baseUrl, httpClient } =\n this.chatbotApiClientSettings.constructorParametersFactory();\n this.client = new Client(baseUrl, httpClient);\n }\n\n postFeedback(body: Models.Feedback, abortSignal?: AbortSignal) {\n return this.client.feedback(this.version, this.clientId, body, abortSignal);\n }\n\n postMessage(body: Models.UserMessage, abortSignal?: AbortSignal) {\n return this.client.message(this.version, this.clientId, body, abortSignal);\n }\n\n postFollowUpEmail(body: Models.UserMessage, abortSignal?: AbortSignal) {\n return this.client.followUpEmail(this.version, this.clientId, body, abortSignal);\n }\n\n getOptions(abortSignal?: AbortSignal): Promise<Models.FrontendModel> {\n return this.client.options(this.version, this.clientId, abortSignal);\n }\n\n async postSession(body: Models.Session, abortSignal?: AbortSignal) {\n return this.client.sessionPOST(this.version, this.clientId, body, abortSignal);\n }\n\n patchSession(body: Models.Session, abortSignal?: AbortSignal) {\n return this.client.sessionPATCH(this.version, this.clientId, body, abortSignal);\n }\n\n deleteSession(body: Models.Session, abortSignal?: AbortSignal) {\n return this.client.sessionDELETE(this.version, this.clientId, body, abortSignal);\n }\n\n getTranscripts(start?: Date, end?: Date, signal?: AbortSignal) {\n return this.client.transcripts(start, end, this.version, this.clientId, signal);\n }\n}\n"],"names":["inject","injectable","CHATBOT_CLIENT_SETTINGS","Client","ChatbotApiClient","version","chatbotApiClientSettings","clientId","postFeedback","body","abortSignal","client","feedback","postMessage","message","postFollowUpEmail","followUpEmail","getOptions","options","postSession","sessionPOST","patchSession","sessionPATCH","deleteSession","sessionDELETE","getTranscripts","start","end","signal","transcripts","baseUrl","httpClient","constructorParametersFactory"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAM,EAAEC,UAAU,QAAQ,0BAA0B;AAE7D,SACIC,uBAAuB,QAKpB,6BAA6B;AACpC,iDAAiD;AACjD,SAASC,MAAM,QAAQ,kBAAkB;AAoBzC,OAAO,MAAMC;IAGT,IAAIC,UAAkB;QAClB,OAAO,IAAI,CAACC,wBAAwB,CAACD,OAAO;IAChD;IAEA,IAAIE,WAAmB;QACnB,OAAO,IAAI,CAACD,wBAAwB,CAACC,QAAQ;IACjD;IAWAC,aAAaC,IAAqB,EAAEC,WAAyB,EAA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ACiBtB,wBAAyD,CAC5E;;QAbF,uBAAiBK,UAAjB,KAAA;aAYqBL,2BAAAA;QAEjB,MAAM,EAAEwB,OAAO,EAAEC,UAAU,EAAE,GACzB,IAAI,CAACzB,wBAAwB,CAAC0B,4BAA4B;QAC9D,IAAI,CAACrB,MAAM,GAAG,IAAIR,OAAO2B,SAASC;IACtC;AAiCJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api-client/titan-chat/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api-client/titan-chat/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/api-client/titan-chat/index.ts"],"sourcesContent":["export type { IChatbotClientSettingsTitanChat } from './chatbot-api-client';\nexport { ChatbotApiClient } from './chatbot-api-client';\n"],"names":["ChatbotApiClient"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,uBAAuB"}
|