@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
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# v8.0.0 (Wed Jun 03 2026)
|
|
2
|
+
|
|
3
|
+
#### 💥 Breaking Change
|
|
4
|
+
|
|
5
|
+
- SPA-8584: Upgrade Platform Packages in Titan Chatbot UI [#90](https://github.com/servicetitan/titan-chatbot-client/pull/90) ([@AlexYarmolchuk](https://github.com/AlexYarmolchuk) [@Copilot](https://github.com/Copilot))
|
|
6
|
+
|
|
7
|
+
#### Authors: 2
|
|
8
|
+
|
|
9
|
+
- [@Copilot](https://github.com/Copilot)
|
|
10
|
+
- Alexandr Yarmolchuk ([@AlexYarmolchuk](https://github.com/AlexYarmolchuk))
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
1
14
|
# v7.1.2 (Thu May 21 2026)
|
|
2
15
|
|
|
3
16
|
#### 🐛 Bug Fix
|
|
@@ -1,53 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(
|
|
4
|
-
|
|
5
|
-
configurable: true,
|
|
6
|
-
writable: true,
|
|
7
|
-
value: jest.fn()
|
|
8
|
-
});
|
|
9
|
-
Object.defineProperty(this, "postMessage", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: jest.fn()
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(this, "postFollowUpEmail", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: jest.fn()
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(this, "getOptions", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
configurable: true,
|
|
24
|
-
writable: true,
|
|
25
|
-
value: jest.fn()
|
|
26
|
-
});
|
|
27
|
-
Object.defineProperty(this, "postSession", {
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
28
5
|
enumerable: true,
|
|
29
6
|
configurable: true,
|
|
30
|
-
writable: true
|
|
31
|
-
value: jest.fn()
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(this, "patchSession", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true,
|
|
37
|
-
value: jest.fn()
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(this, "deleteSession", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true,
|
|
43
|
-
value: jest.fn()
|
|
44
|
-
});
|
|
45
|
-
Object.defineProperty(this, "getTranscripts", {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
configurable: true,
|
|
48
|
-
writable: true,
|
|
49
|
-
value: jest.fn()
|
|
7
|
+
writable: true
|
|
50
8
|
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
export class ChatbotApiClientMock {
|
|
15
|
+
constructor(){
|
|
16
|
+
_define_property(this, "postFeedback", jest.fn());
|
|
17
|
+
_define_property(this, "postMessage", jest.fn());
|
|
18
|
+
_define_property(this, "postFollowUpEmail", jest.fn());
|
|
19
|
+
_define_property(this, "getOptions", jest.fn());
|
|
20
|
+
_define_property(this, "postSession", jest.fn());
|
|
21
|
+
_define_property(this, "patchSession", jest.fn());
|
|
22
|
+
_define_property(this, "deleteSession", jest.fn());
|
|
23
|
+
_define_property(this, "getTranscripts", jest.fn());
|
|
51
24
|
}
|
|
52
25
|
}
|
|
26
|
+
|
|
53
27
|
//# sourceMappingURL=chatbot-api-client.mock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/api-client/__mocks__/chatbot-api-client.mock.ts"],"sourcesContent":["import { IChatbotApiClient } from '..';\n\nexport class ChatbotApiClientMock implements IChatbotApiClient {\n postFeedback = jest.fn();\n postMessage = jest.fn();\n postFollowUpEmail = jest.fn();\n getOptions = jest.fn();\n postSession = jest.fn();\n patchSession = jest.fn();\n deleteSession = jest.fn();\n getTranscripts = jest.fn();\n}\n"],"names":["ChatbotApiClientMock","postFeedback","jest","fn","postMessage","postFollowUpEmail","getOptions","postSession","patchSession","deleteSession","getTranscripts"],"mappings":";;;;;;;;;;;;;AAEA,OAAO,MAAMA;;QACTC,uBAAAA,gBAAeC,KAAKC,EAAE;QACtBC,uBAAAA,eAAcF,KAAKC,EAAE;QACrBE,uBAAAA,qBAAoBH,KAAKC,EAAE;QAC3BG,uBAAAA,cAAaJ,KAAKC,EAAE;QACpBI,uBAAAA,eAAcL,KAAKC,EAAE;QACrBK,uBAAAA,gBAAeN,KAAKC,EAAE;QACtBM,uBAAAA,iBAAgBP,KAAKC,EAAE;QACvBO,uBAAAA,kBAAiBR,KAAKC,EAAE;;AAC5B"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { symbolToken } from '@servicetitan/react-ioc';
|
|
2
2
|
/**
|
|
3
3
|
* Token for injecting the chatbot client settings for proper initialization of the client.
|
|
4
|
-
*/
|
|
5
|
-
export const CHATBOT_CLIENT_SETTINGS = symbolToken('CHATBOT_CLIENT_SETTINGS');
|
|
4
|
+
*/ export const CHATBOT_CLIENT_SETTINGS = symbolToken('CHATBOT_CLIENT_SETTINGS');
|
|
6
5
|
/**
|
|
7
6
|
* Token for injecting the chatbot API client.
|
|
8
|
-
*/
|
|
9
|
-
|
|
7
|
+
*/ export const CHATBOT_API_CLIENT = symbolToken('CHATBOT_API_CLIENT');
|
|
8
|
+
|
|
10
9
|
//# sourceMappingURL=chatbot-api-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/api-client/base/chatbot-api-client.ts"],"sourcesContent":["import { symbolToken } from '@servicetitan/react-ioc';\nimport { Models } from '..';\n\n/**\n * Token for injecting the chatbot client settings for proper initialization of the client.\n */\nexport const CHATBOT_CLIENT_SETTINGS =\n symbolToken<IChatbotClientSettings>('CHATBOT_CLIENT_SETTINGS');\n\n/**\n * Token for injecting the chatbot API client.\n */\nexport const CHATBOT_API_CLIENT = symbolToken<IChatbotApiClient>('CHATBOT_API_CLIENT');\n\ntype Constructor = abstract new (...args: any) => any;\ntype ConstructorParametersFactory<T extends Constructor> = () => Required<ConstructorParameters<T>>;\ntype ParametersFromFactory<T extends Constructor> = ReturnType<ConstructorParametersFactory<T>>;\nexport type FirstParameterType<T extends Constructor> =\n ParametersFromFactory<T> extends [infer P1, ...any[]] ? Exclude<P1, undefined> : undefined;\nexport type SecondParameterType<T extends Constructor> =\n ParametersFromFactory<T> extends [any, infer P2, ...any[]] ? Exclude<P2, undefined> : undefined;\n\nexport interface IChatbotClientSettings {}\n\nexport interface IChatbotApiClient {\n postFeedback(body: Models.IFeedback, abortSignal?: AbortSignal): Promise<Models.Feedback>;\n postMessage(body: Models.IUserMessage, abortSignal?: AbortSignal): Promise<Models.BotMessage>;\n postFollowUpEmail(\n body: Models.IUserMessage,\n abortSignal?: AbortSignal\n ): Promise<Models.BotMessage>;\n getOptions(abortSignal?: AbortSignal): Promise<Models.FrontendModel>;\n postSession(body: Models.ISession, abortSignal?: AbortSignal): Promise<Models.Session>;\n patchSession(body: Models.ISession, abortSignal?: AbortSignal): Promise<Models.Session>;\n deleteSession(body: Models.ISession, abortSignal?: AbortSignal): Promise<Models.Session>;\n getTranscripts(\n start?: Date,\n end?: Date,\n signal?: AbortSignal\n ): Promise<Models.ExportHistoryMessage[]>;\n}\n"],"names":["symbolToken","CHATBOT_CLIENT_SETTINGS","CHATBOT_API_CLIENT"],"mappings":"AAAA,SAASA,WAAW,QAAQ,0BAA0B;AAGtD;;CAEC,GACD,OAAO,MAAMC,0BACTD,YAAoC,2BAA2B;AAEnE;;CAEC,GACD,OAAO,MAAME,qBAAqBF,YAA+B,sBAAsB"}
|
|
@@ -1,34 +1,67 @@
|
|
|
1
1
|
import { expect } from '@jest/globals';
|
|
2
2
|
import { ConverterFromModels } from '../converter-from-models';
|
|
3
|
-
describe('ConverterFromModels', ()
|
|
4
|
-
test('convertFilters', ()
|
|
3
|
+
describe('ConverterFromModels', ()=>{
|
|
4
|
+
test('convertFilters', ()=>{
|
|
5
5
|
expect(ConverterFromModels.convertFilters()).toBeUndefined();
|
|
6
6
|
expect(ConverterFromModels.convertFilters({})).toBeUndefined();
|
|
7
7
|
expect(ConverterFromModels.convertFilters({
|
|
8
8
|
subOptions: {
|
|
9
|
-
ProductAreas: {
|
|
10
|
-
|
|
9
|
+
ProductAreas: {
|
|
10
|
+
values: []
|
|
11
|
+
}
|
|
12
|
+
}
|
|
11
13
|
})).toEqual({
|
|
12
|
-
productAreas: []
|
|
14
|
+
productAreas: []
|
|
13
15
|
});
|
|
14
16
|
expect(ConverterFromModels.convertFilters({
|
|
15
17
|
subOptions: {
|
|
16
|
-
ProductAreas: {
|
|
17
|
-
|
|
18
|
+
ProductAreas: {
|
|
19
|
+
values: [
|
|
20
|
+
'area1',
|
|
21
|
+
'area2'
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
18
25
|
})).toEqual({
|
|
19
|
-
productAreas: [
|
|
26
|
+
productAreas: [
|
|
27
|
+
'area1',
|
|
28
|
+
'area2'
|
|
29
|
+
]
|
|
20
30
|
});
|
|
21
31
|
expect(ConverterFromModels.convertFilters({
|
|
22
32
|
subOptions: {
|
|
23
|
-
Sources: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
Sources: {
|
|
34
|
+
values: [
|
|
35
|
+
'source1',
|
|
36
|
+
'source2'
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
ContentTypes: {
|
|
40
|
+
values: [
|
|
41
|
+
'type1'
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
ProductAreas: {
|
|
45
|
+
values: [
|
|
46
|
+
'area1',
|
|
47
|
+
'area2'
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
27
51
|
})).toEqual({
|
|
28
|
-
sources: [
|
|
29
|
-
|
|
30
|
-
|
|
52
|
+
sources: [
|
|
53
|
+
'source1',
|
|
54
|
+
'source2'
|
|
55
|
+
],
|
|
56
|
+
contentTypes: [
|
|
57
|
+
'type1'
|
|
58
|
+
],
|
|
59
|
+
productAreas: [
|
|
60
|
+
'area1',
|
|
61
|
+
'area2'
|
|
62
|
+
]
|
|
31
63
|
});
|
|
32
64
|
});
|
|
33
65
|
});
|
|
66
|
+
|
|
34
67
|
//# sourceMappingURL=converter-from-models.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../../src/api-client/help-center/__tests__/converter-from-models.test.ts"],"sourcesContent":["import { expect } from '@jest/globals';\nimport { Models } from '../..';\nimport { ConverterFromModels } from '../converter-from-models';\n\ndescribe('ConverterFromModels', () => {\n test('convertFilters', () => {\n expect(ConverterFromModels.convertFilters()).toBeUndefined();\n expect(ConverterFromModels.convertFilters({})).toBeUndefined();\n expect(\n ConverterFromModels.convertFilters({\n subOptions: {\n ProductAreas: { values: [] },\n },\n } as unknown as Models.ISelections)\n ).toEqual({\n productAreas: [],\n });\n expect(\n ConverterFromModels.convertFilters({\n subOptions: {\n ProductAreas: { values: ['area1', 'area2'] },\n },\n } as unknown as Models.ISelections)\n ).toEqual({\n productAreas: ['area1', 'area2'],\n });\n expect(\n ConverterFromModels.convertFilters({\n subOptions: {\n Sources: { values: ['source1', 'source2'] },\n ContentTypes: { values: ['type1'] },\n ProductAreas: { values: ['area1', 'area2'] },\n },\n } as unknown as Models.ISelections)\n ).toEqual({\n sources: ['source1', 'source2'],\n contentTypes: ['type1'],\n productAreas: ['area1', 'area2'],\n });\n });\n});\n"],"names":["expect","ConverterFromModels","describe","test","convertFilters","toBeUndefined","subOptions","ProductAreas","values","toEqual","productAreas","Sources","ContentTypes","sources","contentTypes"],"mappings":"AAAA,SAASA,MAAM,QAAQ,gBAAgB;AAEvC,SAASC,mBAAmB,QAAQ,2BAA2B;AAE/DC,SAAS,uBAAuB;IAC5BC,KAAK,kBAAkB;QACnBH,OAAOC,oBAAoBG,cAAc,IAAIC,aAAa;QAC1DL,OAAOC,oBAAoBG,cAAc,CAAC,CAAC,IAAIC,aAAa;QAC5DL,OACIC,oBAAoBG,cAAc,CAAC;YAC/BE,YAAY;gBACRC,cAAc;oBAAEC,QAAQ,EAAE;gBAAC;YAC/B;QACJ,IACFC,OAAO,CAAC;YACNC,cAAc,EAAE;QACpB;QACAV,OACIC,oBAAoBG,cAAc,CAAC;YAC/BE,YAAY;gBACRC,cAAc;oBAAEC,QAAQ;wBAAC;wBAAS;qBAAQ;gBAAC;YAC/C;QACJ,IACFC,OAAO,CAAC;YACNC,cAAc;gBAAC;gBAAS;aAAQ;QACpC;QACAV,OACIC,oBAAoBG,cAAc,CAAC;YAC/BE,YAAY;gBACRK,SAAS;oBAAEH,QAAQ;wBAAC;wBAAW;qBAAU;gBAAC;gBAC1CI,cAAc;oBAAEJ,QAAQ;wBAAC;qBAAQ;gBAAC;gBAClCD,cAAc;oBAAEC,QAAQ;wBAAC;wBAAS;qBAAQ;gBAAC;YAC/C;QACJ,IACFC,OAAO,CAAC;YACNI,SAAS;gBAAC;gBAAW;aAAU;YAC/BC,cAAc;gBAAC;aAAQ;YACvBJ,cAAc;gBAAC;gBAAS;aAAQ;QACpC;IACJ;AACJ"}
|
|
@@ -3,37 +3,37 @@ import { Models } from '../..';
|
|
|
3
3
|
import { ConverterToModels } from '../converter-to-models';
|
|
4
4
|
// eslint-disable-next-line no-restricted-imports
|
|
5
5
|
import * as HelpCenterClient from '../native-client';
|
|
6
|
-
describe('ConverterToModels', ()
|
|
7
|
-
test('convertFilterOptions', ()
|
|
6
|
+
describe('ConverterToModels', ()=>{
|
|
7
|
+
test('convertFilterOptions', ()=>{
|
|
8
8
|
expect(ConverterToModels.convertFilterOptions({})).toEqual(new Models.FrontendModel({
|
|
9
9
|
options: new Models.Option({
|
|
10
10
|
key: 'help-center-filters-root',
|
|
11
11
|
displayName: 'help-center-filters-root',
|
|
12
12
|
type: Models.OptionType.Group,
|
|
13
|
-
subOptions: []
|
|
14
|
-
})
|
|
13
|
+
subOptions: []
|
|
14
|
+
})
|
|
15
15
|
}));
|
|
16
16
|
expect(ConverterToModels.convertFilterOptions({
|
|
17
17
|
sources: [
|
|
18
18
|
new HelpCenterClient.FilterOption({
|
|
19
19
|
id: 'source1',
|
|
20
|
-
displayName: 'Source 1'
|
|
20
|
+
displayName: 'Source 1'
|
|
21
21
|
}),
|
|
22
22
|
new HelpCenterClient.FilterOption({
|
|
23
23
|
id: 'source2',
|
|
24
|
-
displayName: 'Source 2'
|
|
25
|
-
})
|
|
24
|
+
displayName: 'Source 2'
|
|
25
|
+
})
|
|
26
26
|
],
|
|
27
27
|
productAreas: [
|
|
28
28
|
new HelpCenterClient.FilterOption({
|
|
29
29
|
id: 'area1',
|
|
30
|
-
displayName: 'Area 1'
|
|
30
|
+
displayName: 'Area 1'
|
|
31
31
|
}),
|
|
32
32
|
new HelpCenterClient.FilterOption({
|
|
33
33
|
id: 'area2',
|
|
34
|
-
displayName: 'Area 2'
|
|
35
|
-
})
|
|
36
|
-
]
|
|
34
|
+
displayName: 'Area 2'
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
37
|
})).toEqual(new Models.FrontendModel({
|
|
38
38
|
options: new Models.Option({
|
|
39
39
|
key: 'help-center-filters-root',
|
|
@@ -48,14 +48,14 @@ describe('ConverterToModels', () => {
|
|
|
48
48
|
new Models.Option({
|
|
49
49
|
key: 'source1',
|
|
50
50
|
displayName: 'Source 1',
|
|
51
|
-
type: Models.OptionType.Selectable
|
|
51
|
+
type: Models.OptionType.Selectable
|
|
52
52
|
}),
|
|
53
53
|
new Models.Option({
|
|
54
54
|
key: 'source2',
|
|
55
55
|
displayName: 'Source 2',
|
|
56
|
-
type: Models.OptionType.Selectable
|
|
57
|
-
})
|
|
58
|
-
]
|
|
56
|
+
type: Models.OptionType.Selectable
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
59
|
}),
|
|
60
60
|
new Models.Option({
|
|
61
61
|
key: 'ProductAreas',
|
|
@@ -65,18 +65,19 @@ describe('ConverterToModels', () => {
|
|
|
65
65
|
new Models.Option({
|
|
66
66
|
key: 'area1',
|
|
67
67
|
displayName: 'Area 1',
|
|
68
|
-
type: Models.OptionType.Selectable
|
|
68
|
+
type: Models.OptionType.Selectable
|
|
69
69
|
}),
|
|
70
70
|
new Models.Option({
|
|
71
71
|
key: 'area2',
|
|
72
72
|
displayName: 'Area 2',
|
|
73
|
-
type: Models.OptionType.Selectable
|
|
74
|
-
})
|
|
75
|
-
]
|
|
76
|
-
})
|
|
77
|
-
]
|
|
78
|
-
})
|
|
73
|
+
type: Models.OptionType.Selectable
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
})
|
|
79
79
|
}));
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
|
+
|
|
82
83
|
//# sourceMappingURL=converter-to-models.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../../src/api-client/help-center/__tests__/converter-to-models.test.ts"],"sourcesContent":["import { expect } from '@jest/globals';\nimport { Models } from '../..';\nimport { ConverterToModels } from '../converter-to-models';\n// eslint-disable-next-line no-restricted-imports\nimport * as HelpCenterClient from '../native-client';\n\ndescribe('ConverterToModels', () => {\n test('convertFilterOptions', () => {\n expect(ConverterToModels.convertFilterOptions({})).toEqual(\n new Models.FrontendModel({\n options: new Models.Option({\n key: 'help-center-filters-root',\n displayName: 'help-center-filters-root',\n type: Models.OptionType.Group,\n subOptions: [],\n }),\n })\n );\n\n expect(\n ConverterToModels.convertFilterOptions({\n sources: [\n new HelpCenterClient.FilterOption({\n id: 'source1',\n displayName: 'Source 1',\n }),\n new HelpCenterClient.FilterOption({\n id: 'source2',\n displayName: 'Source 2',\n }),\n ],\n productAreas: [\n new HelpCenterClient.FilterOption({\n id: 'area1',\n displayName: 'Area 1',\n }),\n new HelpCenterClient.FilterOption({\n id: 'area2',\n displayName: 'Area 2',\n }),\n ],\n })\n ).toEqual(\n new Models.FrontendModel({\n options: new Models.Option({\n key: 'help-center-filters-root',\n displayName: 'help-center-filters-root',\n type: Models.OptionType.Group,\n subOptions: [\n new Models.Option({\n key: 'Sources',\n displayName: 'Sources',\n type: Models.OptionType.Group,\n subOptions: [\n new Models.Option({\n key: 'source1',\n displayName: 'Source 1',\n type: Models.OptionType.Selectable,\n }),\n new Models.Option({\n key: 'source2',\n displayName: 'Source 2',\n type: Models.OptionType.Selectable,\n }),\n ],\n }),\n new Models.Option({\n key: 'ProductAreas',\n displayName: 'Product Areas',\n type: Models.OptionType.Group,\n subOptions: [\n new Models.Option({\n key: 'area1',\n displayName: 'Area 1',\n type: Models.OptionType.Selectable,\n }),\n new Models.Option({\n key: 'area2',\n displayName: 'Area 2',\n type: Models.OptionType.Selectable,\n }),\n ],\n }),\n ],\n }),\n })\n );\n });\n});\n"],"names":["expect","Models","ConverterToModels","HelpCenterClient","describe","test","convertFilterOptions","toEqual","FrontendModel","options","Option","key","displayName","type","OptionType","Group","subOptions","sources","FilterOption","id","productAreas","Selectable"],"mappings":"AAAA,SAASA,MAAM,QAAQ,gBAAgB;AACvC,SAASC,MAAM,QAAQ,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,iDAAiD;AACjD,YAAYC,sBAAsB,mBAAmB;AAErDC,SAAS,qBAAqB;IAC1BC,KAAK,wBAAwB;QACzBL,OAAOE,kBAAkBI,oBAAoB,CAAC,CAAC,IAAIC,OAAO,CACtD,IAAIN,OAAOO,aAAa,CAAC;YACrBC,SAAS,IAAIR,OAAOS,MAAM,CAAC;gBACvBC,KAAK;gBACLC,aAAa;gBACbC,MAAMZ,OAAOa,UAAU,CAACC,KAAK;gBAC7BC,YAAY,EAAE;YAClB;QACJ;QAGJhB,OACIE,kBAAkBI,oBAAoB,CAAC;YACnCW,SAAS;gBACL,IAAId,iBAAiBe,YAAY,CAAC;oBAC9BC,IAAI;oBACJP,aAAa;gBACjB;gBACA,IAAIT,iBAAiBe,YAAY,CAAC;oBAC9BC,IAAI;oBACJP,aAAa;gBACjB;aACH;YACDQ,cAAc;gBACV,IAAIjB,iBAAiBe,YAAY,CAAC;oBAC9BC,IAAI;oBACJP,aAAa;gBACjB;gBACA,IAAIT,iBAAiBe,YAAY,CAAC;oBAC9BC,IAAI;oBACJP,aAAa;gBACjB;aACH;QACL,IACFL,OAAO,CACL,IAAIN,OAAOO,aAAa,CAAC;YACrBC,SAAS,IAAIR,OAAOS,MAAM,CAAC;gBACvBC,KAAK;gBACLC,aAAa;gBACbC,MAAMZ,OAAOa,UAAU,CAACC,KAAK;gBAC7BC,YAAY;oBACR,IAAIf,OAAOS,MAAM,CAAC;wBACdC,KAAK;wBACLC,aAAa;wBACbC,MAAMZ,OAAOa,UAAU,CAACC,KAAK;wBAC7BC,YAAY;4BACR,IAAIf,OAAOS,MAAM,CAAC;gCACdC,KAAK;gCACLC,aAAa;gCACbC,MAAMZ,OAAOa,UAAU,CAACO,UAAU;4BACtC;4BACA,IAAIpB,OAAOS,MAAM,CAAC;gCACdC,KAAK;gCACLC,aAAa;gCACbC,MAAMZ,OAAOa,UAAU,CAACO,UAAU;4BACtC;yBACH;oBACL;oBACA,IAAIpB,OAAOS,MAAM,CAAC;wBACdC,KAAK;wBACLC,aAAa;wBACbC,MAAMZ,OAAOa,UAAU,CAACC,KAAK;wBAC7BC,YAAY;4BACR,IAAIf,OAAOS,MAAM,CAAC;gCACdC,KAAK;gCACLC,aAAa;gCACbC,MAAMZ,OAAOa,UAAU,CAACO,UAAU;4BACtC;4BACA,IAAIpB,OAAOS,MAAM,CAAC;gCACdC,KAAK;gCACLC,aAAa;gCACbC,MAAMZ,OAAOa,UAAU,CAACO,UAAU;4BACtC;yBACH;oBACL;iBACH;YACL;QACJ;IAER;AACJ"}
|
|
@@ -1,47 +1,42 @@
|
|
|
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
|
import { ConverterFromModels } from './converter-from-models';
|
|
16
31
|
import { ConverterToModels } from './converter-to-models';
|
|
17
32
|
// eslint-disable-next-line no-restricted-imports
|
|
18
33
|
import { ChatClient } from './native-client';
|
|
19
|
-
|
|
20
|
-
* Client adapter adopts the generated titan chatbot client to the generic IChatbotApiClient interface.
|
|
21
|
-
*/
|
|
22
|
-
let ChatbotApiClient = class ChatbotApiClient {
|
|
23
|
-
constructor(chatbotApiClientSettings) {
|
|
24
|
-
Object.defineProperty(this, "chatbotApiClientSettings", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: chatbotApiClientSettings
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(this, "client", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true,
|
|
34
|
-
value: void 0
|
|
35
|
-
});
|
|
36
|
-
const { axiosInstance, baseUrl } = this.chatbotApiClientSettings.constructorParametersFactory();
|
|
37
|
-
this.client = new ChatClient(baseUrl, axiosInstance);
|
|
38
|
-
}
|
|
34
|
+
export class ChatbotApiClient {
|
|
39
35
|
async postFeedback(body, abortSignal) {
|
|
40
36
|
if (body === null || body === void 0 ? void 0 : body.messageId) {
|
|
41
37
|
await this.client.sendBotMessageFeedback(body.sessionId, body.messageId, ConverterFromModels.convertMessageFeedback(body), abortSignal);
|
|
42
38
|
return body;
|
|
43
|
-
}
|
|
44
|
-
else if (body === null || body === void 0 ? void 0 : body.sessionId) {
|
|
39
|
+
} else if (body === null || body === void 0 ? void 0 : body.sessionId) {
|
|
45
40
|
await this.client.sendSessionFeedback(body.sessionId, ConverterFromModels.convertSessionFeedback(body), abortSignal);
|
|
46
41
|
return body;
|
|
47
42
|
}
|
|
@@ -52,10 +47,8 @@ let ChatbotApiClient = class ChatbotApiClient {
|
|
|
52
47
|
const botMessage = await this.client.sendUserMessage(hcMessage, abortSignal);
|
|
53
48
|
return ConverterToModels.convertBotMessage(botMessage);
|
|
54
49
|
}
|
|
55
|
-
postFollowUpEmail(
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
57
|
-
body,
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
50
|
+
postFollowUpEmail(// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
51
|
+
body, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
59
52
|
abortSignal) {
|
|
60
53
|
throw new Error('Method not implemented for Help Center chatbot API.');
|
|
61
54
|
}
|
|
@@ -64,18 +57,17 @@ let ChatbotApiClient = class ChatbotApiClient {
|
|
|
64
57
|
return ConverterToModels.convertFilterOptions(filterOptions);
|
|
65
58
|
}
|
|
66
59
|
async postSession(body, abortSignal) {
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
(_b = (_c = body.data).instance) !== null && _b !== void 0 ? _b : (_c.instance = this.chatbotApiClientSettings.instance);
|
|
60
|
+
var _body_data, _body_data1, _instance;
|
|
61
|
+
body.data = (_body_data = body.data) !== null && _body_data !== void 0 ? _body_data : {};
|
|
62
|
+
(_instance = (_body_data1 = body.data).instance) !== null && _instance !== void 0 ? _instance : _body_data1.instance = this.chatbotApiClientSettings.instance;
|
|
71
63
|
const hcSession = ConverterFromModels.convertSession(body);
|
|
72
64
|
const newSession = await this.client.createSession(hcSession.source, abortSignal);
|
|
73
65
|
return ConverterToModels.convertSession(newSession);
|
|
74
66
|
}
|
|
75
67
|
async patchSession(body, abortSignal) {
|
|
76
|
-
var
|
|
68
|
+
var _session_source, _session_source1;
|
|
77
69
|
const session = ConverterFromModels.convertSession(body);
|
|
78
|
-
await this.client.updateSessionCategory((
|
|
70
|
+
await this.client.updateSessionCategory((_session_source = session.source) === null || _session_source === void 0 ? void 0 : _session_source.category, (_session_source1 = session.source) === null || _session_source1 === void 0 ? void 0 : _session_source1.subCategory, session.id, abortSignal);
|
|
79
71
|
return body;
|
|
80
72
|
}
|
|
81
73
|
async deleteSession(body, abortSignal) {
|
|
@@ -83,20 +75,27 @@ let ChatbotApiClient = class ChatbotApiClient {
|
|
|
83
75
|
await this.client.closeSession(session.id, abortSignal);
|
|
84
76
|
return body;
|
|
85
77
|
}
|
|
86
|
-
getTranscripts(
|
|
87
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
88
|
-
|
|
89
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
90
|
-
end,
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
78
|
+
getTranscripts(// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
79
|
+
start, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
80
|
+
end, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
92
81
|
signal) {
|
|
93
82
|
throw new Error('Method not implemented for Help Center chatbot API.');
|
|
94
83
|
}
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
constructor(chatbotApiClientSettings){
|
|
85
|
+
_define_property(this, "chatbotApiClientSettings", void 0);
|
|
86
|
+
_define_property(this, "client", void 0);
|
|
87
|
+
this.chatbotApiClientSettings = chatbotApiClientSettings;
|
|
88
|
+
const { axiosInstance, baseUrl } = this.chatbotApiClientSettings.constructorParametersFactory();
|
|
89
|
+
this.client = new ChatClient(baseUrl, axiosInstance);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
ChatbotApiClient = _ts_decorate([
|
|
97
93
|
injectable(),
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
_ts_param(0, inject(CHATBOT_CLIENT_SETTINGS)),
|
|
95
|
+
_ts_metadata("design:type", Function),
|
|
96
|
+
_ts_metadata("design:paramtypes", [
|
|
97
|
+
typeof IChatbotClientSettingsHelpCenter === "undefined" ? Object : IChatbotClientSettingsHelpCenter
|
|
98
|
+
])
|
|
100
99
|
], ChatbotApiClient);
|
|
101
|
-
|
|
100
|
+
|
|
102
101
|
//# sourceMappingURL=chatbot-api-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/api-client/help-center/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';\nimport { ConverterFromModels } from './converter-from-models';\nimport { ConverterToModels } from './converter-to-models';\n// eslint-disable-next-line no-restricted-imports\nimport { ChatClient } from './native-client';\n\n/**\n * Settings for the chatbot client, which includes a factory for constructor parameters, and additional settings\n * like instance and area which are used in the API calls.\n */\nexport interface IChatbotClientSettingsHelpCenter extends IChatbotClientSettings {\n constructorParametersFactory: () => {\n baseUrl?: FirstParameterType<typeof ChatClient>;\n axiosInstance?: SecondParameterType<typeof ChatClient>;\n };\n instance: string;\n area: string;\n}\n\n/**\n * Client adapter adopts the generated titan chatbot client to the generic IChatbotApiClient interface.\n */\n@injectable()\nexport class ChatbotApiClient implements IChatbotApiClient {\n private readonly client: ChatClient;\n\n constructor(\n @inject(CHATBOT_CLIENT_SETTINGS)\n private readonly chatbotApiClientSettings: IChatbotClientSettingsHelpCenter\n ) {\n const { axiosInstance, baseUrl } =\n this.chatbotApiClientSettings.constructorParametersFactory();\n this.client = new ChatClient(baseUrl, axiosInstance);\n }\n\n async postFeedback(body: Models.Feedback, abortSignal?: AbortSignal) {\n if (body?.messageId) {\n await this.client.sendBotMessageFeedback(\n body.sessionId,\n body.messageId,\n ConverterFromModels.convertMessageFeedback(body),\n abortSignal\n );\n return body;\n } else if (body?.sessionId) {\n await this.client.sendSessionFeedback(\n body.sessionId,\n ConverterFromModels.convertSessionFeedback(body),\n abortSignal\n );\n return body;\n }\n throw new Error('Feedback must contain either messageId or sessionId');\n }\n\n async postMessage(body: Models.UserMessage, abortSignal?: AbortSignal) {\n const hcMessage = ConverterFromModels.convertUserMessage(\n body,\n this.chatbotApiClientSettings.area\n );\n const botMessage = await this.client.sendUserMessage(hcMessage, abortSignal);\n return ConverterToModels.convertBotMessage(botMessage);\n }\n\n postFollowUpEmail(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n body: Models.UserMessage,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n abortSignal?: AbortSignal\n ): Promise<Models.BotMessage> {\n throw new Error('Method not implemented for Help Center chatbot API.');\n }\n\n async getOptions(abortSignal?: AbortSignal): Promise<Models.FrontendModel> {\n const filterOptions = await this.client.getFilterOptions(abortSignal);\n return ConverterToModels.convertFilterOptions(filterOptions);\n }\n\n async postSession(body: Models.Session, abortSignal?: AbortSignal) {\n body.data = body.data ?? {};\n body.data.instance ??= this.chatbotApiClientSettings.instance;\n const hcSession = ConverterFromModels.convertSession(body);\n const newSession = await this.client.createSession(hcSession.source!, abortSignal);\n return ConverterToModels.convertSession(newSession);\n }\n\n async patchSession(body: Models.Session, abortSignal?: AbortSignal) {\n const session = ConverterFromModels.convertSession(body);\n await this.client.updateSessionCategory(\n session.source?.category,\n session.source?.subCategory,\n session.id,\n abortSignal\n );\n return body;\n }\n\n async deleteSession(body: Models.Session, abortSignal?: AbortSignal) {\n const session = ConverterFromModels.convertSession(body);\n await this.client.closeSession(session.id, abortSignal);\n return body;\n }\n\n getTranscripts(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n start?: Date,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n end?: Date,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n signal?: AbortSignal\n ): Promise<Models.ExportHistoryMessage[]> {\n throw new Error('Method not implemented for Help Center chatbot API.');\n }\n}\n"],"names":["inject","injectable","CHATBOT_CLIENT_SETTINGS","ConverterFromModels","ConverterToModels","ChatClient","ChatbotApiClient","postFeedback","body","abortSignal","messageId","client","sendBotMessageFeedback","sessionId","convertMessageFeedback","sendSessionFeedback","convertSessionFeedback","Error","postMessage","hcMessage","convertUserMessage","chatbotApiClientSettings","area","botMessage","sendUserMessage","convertBotMessage","postFollowUpEmail","getOptions","filterOptions","getFilterOptions","convertFilterOptions","postSession","data","instance","hcSession","convertSession","newSession","createSession","source","patchSession","session","updateSessionCategory","category","subCategory","id","deleteSession","closeSession","getTranscripts","start","end","signal","axiosInstance","baseUrl","constructorParametersFactory"],"mappings":"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"}
|
|
@@ -13,20 +13,22 @@ export class ConverterFromModels {
|
|
|
13
13
|
instance: data === null || data === void 0 ? void 0 : data.instance,
|
|
14
14
|
category: data === null || data === void 0 ? void 0 : data.category,
|
|
15
15
|
subCategory: data === null || data === void 0 ? void 0 : data.subCategory,
|
|
16
|
-
fullstorySessionId: data === null || data === void 0 ? void 0 : data.fullstorySessionId
|
|
17
|
-
})
|
|
16
|
+
fullstorySessionId: data === null || data === void 0 ? void 0 : data.fullstorySessionId
|
|
17
|
+
})
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
static convertUserMessage(userMessage, area) {
|
|
21
|
-
var
|
|
22
|
-
const filters = (
|
|
21
|
+
var _ConverterFromModels_convertFilters;
|
|
22
|
+
const filters = (_ConverterFromModels_convertFilters = ConverterFromModels.convertFilters(userMessage.selections)) !== null && _ConverterFromModels_convertFilters !== void 0 ? _ConverterFromModels_convertFilters : new HelpCenterModels.FilterSelections({});
|
|
23
23
|
const data = {
|
|
24
24
|
sessionId: userMessage.sessionId,
|
|
25
25
|
text: userMessage.question,
|
|
26
26
|
source: new HelpCenterModels.MessageSource({
|
|
27
|
-
area
|
|
27
|
+
area
|
|
28
28
|
}),
|
|
29
|
-
...
|
|
29
|
+
...filters ? {
|
|
30
|
+
filters
|
|
31
|
+
} : undefined
|
|
30
32
|
};
|
|
31
33
|
return HelpCenterModels.UserMessage.fromJS(data);
|
|
32
34
|
}
|
|
@@ -52,7 +54,7 @@ export class ConverterFromModels {
|
|
|
52
54
|
static convertSessionFeedback(feedback) {
|
|
53
55
|
return new HelpCenterModels.SessionFeedback({
|
|
54
56
|
description: feedback.description,
|
|
55
|
-
rating: ConverterFromModels.convertSessionFeedbackRating(feedback.rating)
|
|
57
|
+
rating: ConverterFromModels.convertSessionFeedbackRating(feedback.rating)
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
static convertMessageFeedback(feedback) {
|
|
@@ -60,15 +62,15 @@ export class ConverterFromModels {
|
|
|
60
62
|
linkUrl: feedback.linkUrl,
|
|
61
63
|
description: feedback.description,
|
|
62
64
|
rating: ConverterFromModels.convertMessageFeedbackRating(feedback.rating),
|
|
63
|
-
options: ConverterFromModels.convertFeedbackOptions(feedback.options)
|
|
65
|
+
options: ConverterFromModels.convertFeedbackOptions(feedback.options)
|
|
64
66
|
});
|
|
65
67
|
}
|
|
66
68
|
static convertFeedbackOptions(feedbackOptions) {
|
|
67
69
|
if (feedbackOptions === undefined) {
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
|
-
return feedbackOptions.map(feedbackOption
|
|
71
|
-
switch
|
|
72
|
+
return feedbackOptions.map((feedbackOption)=>{
|
|
73
|
+
switch(feedbackOption){
|
|
72
74
|
case Models.FeedbackOptions.Incomplete:
|
|
73
75
|
return HelpCenterModels.FeedbackOptions.Incomplete;
|
|
74
76
|
case Models.FeedbackOptions.Incorrect:
|
|
@@ -88,7 +90,7 @@ export class ConverterFromModels {
|
|
|
88
90
|
if (feedbackRatings === undefined) {
|
|
89
91
|
return;
|
|
90
92
|
}
|
|
91
|
-
switch
|
|
93
|
+
switch(feedbackRatings){
|
|
92
94
|
case Models.FeedbackRatings.ThumbsDown:
|
|
93
95
|
return HelpCenterModels.MessageFeedbackRatings.ThumbsDown;
|
|
94
96
|
case Models.FeedbackRatings.GuardrailFeedback:
|
|
@@ -101,7 +103,7 @@ export class ConverterFromModels {
|
|
|
101
103
|
if (feedbackRatings === undefined) {
|
|
102
104
|
return;
|
|
103
105
|
}
|
|
104
|
-
switch
|
|
106
|
+
switch(feedbackRatings){
|
|
105
107
|
case Models.FeedbackRatings.ThumbsDown:
|
|
106
108
|
return HelpCenterModels.SessionFeedbackRatings.ThumbsDown;
|
|
107
109
|
case Models.FeedbackRatings.ThumbsUp:
|
|
@@ -111,4 +113,5 @@ export class ConverterFromModels {
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
}
|
|
116
|
+
|
|
114
117
|
//# sourceMappingURL=converter-from-models.js.map
|