@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.46 → 0.0.1-alpha.49
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/LICENSE.txt +5 -5
- package/README.md +12 -12
- package/{lib-esm → dist}/client/chat.client.d.ts +16 -16
- package/{lib → dist}/client/contact-method.client.d.ts +34 -34
- package/{lib → dist}/client/http.client.d.ts +26 -26
- package/{lib → dist}/client/middleware.client.d.ts +14 -14
- package/dist/components/feedback-list.d.ts +8 -0
- package/dist/components/no-good-alternative.d.ts +6 -0
- package/dist/contact-method.js +102 -0
- package/dist/contact-method.js.map +1 -0
- package/{lib-esm → dist}/contract/custom-component/contact-method-item.d.ts +9 -9
- package/{lib-esm → dist}/contract/custom-component/contact-method-list.d.ts +7 -7
- package/{lib-esm → dist}/contract/custom-component/contact-method.d.ts +3 -3
- package/{lib-esm → dist}/contract/custom-component/entry-context.d.ts +5 -5
- package/{lib → dist}/contract/enum/server-entry-type.enum.d.ts +7 -7
- package/{lib → dist}/contract/model/conversation-api-model/list.model.d.ts +5 -5
- package/{lib-esm → dist}/contract/model/conversation-api-model/message.model.d.ts +7 -7
- package/{lib → dist}/contract/model/http/action.model.d.ts +3 -3
- package/{lib → dist}/contract/model/http/client-action.model.d.ts +4 -4
- package/{lib → dist}/contract/model/http/client-envelope.model.d.ts +9 -9
- package/{lib-esm → dist}/contract/model/http/connect-options.model.d.ts +5 -5
- package/{lib-esm → dist}/contract/model/http/global-state.model.d.ts +8 -8
- package/{lib-esm → dist}/contract/model/http/http-client-options.model.d.ts +5 -5
- package/{lib-esm → dist}/contract/model/http/server-entry.model.d.ts +11 -11
- package/{lib-esm → dist}/contract/model/http/server-envelope.model.d.ts +10 -10
- package/{lib-esm → dist}/contract/model/middleware/aggregator-state.model.d.ts +4 -4
- package/{lib → dist}/contract/model/shared/loose-object.model.d.ts +3 -3
- package/dist/feedback-list.js +104 -0
- package/dist/feedback-list.js.map +1 -0
- package/{lib-esm → dist}/helper/chat.helper.d.ts +8 -8
- package/{lib-esm → dist}/helper/http.helper.d.ts +13 -13
- package/{lib-esm → dist}/helper/middleware.helper.d.ts +12 -12
- package/{lib → dist}/helper/store.helper.d.ts +23 -23
- package/{lib-esm → dist}/index.d.ts +2 -2
- package/dist/index.js +1152 -0
- package/dist/index.js.map +1 -0
- package/{lib-esm → dist}/interface/entry.interface.d.ts +20 -20
- package/{lib-esm → dist}/interface/middleware/paging.interface.d.ts +4 -4
- package/{lib-esm → dist}/interface/middleware/processor.interface.d.ts +10 -10
- package/dist/no-good-alternative.js +33 -0
- package/dist/no-good-alternative.js.map +1 -0
- package/{lib-esm → dist}/plugin.d.ts +3 -3
- package/dist/ui/feedback-list.d.ts +8 -0
- package/dist/ui/no-good-alternative.d.ts +6 -0
- package/{lib-esm → dist}/utils.d.ts +2 -2
- package/package.json +14 -15
- package/lib/client/chat.client.d.ts +0 -16
- package/lib/client/chat.client.js +0 -145
- package/lib/client/contact-method.client.js +0 -337
- package/lib/client/http.client.js +0 -211
- package/lib/client/middleware.client.js +0 -125
- package/lib/contract/custom-component/contact-method-item.d.ts +0 -9
- package/lib/contract/custom-component/contact-method-item.js +0 -34
- package/lib/contract/custom-component/contact-method-list.d.ts +0 -7
- package/lib/contract/custom-component/contact-method-list.js +0 -13
- package/lib/contract/custom-component/contact-method.d.ts +0 -3
- package/lib/contract/custom-component/contact-method.js +0 -35
- package/lib/contract/custom-component/entry-context.d.ts +0 -5
- package/lib/contract/custom-component/entry-context.js +0 -4
- package/lib/contract/enum/server-entry-type.enum.js +0 -8
- package/lib/contract/model/conversation-api-model/list.model.js +0 -1
- package/lib/contract/model/conversation-api-model/message.model.d.ts +0 -7
- package/lib/contract/model/conversation-api-model/message.model.js +0 -1
- package/lib/contract/model/http/action.model.js +0 -1
- package/lib/contract/model/http/client-action.model.js +0 -2
- package/lib/contract/model/http/client-envelope.model.js +0 -1
- package/lib/contract/model/http/connect-options.model.d.ts +0 -5
- package/lib/contract/model/http/connect-options.model.js +0 -1
- package/lib/contract/model/http/global-state.model.d.ts +0 -8
- package/lib/contract/model/http/global-state.model.js +0 -1
- package/lib/contract/model/http/http-client-options.model.d.ts +0 -5
- package/lib/contract/model/http/http-client-options.model.js +0 -1
- package/lib/contract/model/http/server-entry.model.d.ts +0 -11
- package/lib/contract/model/http/server-entry.model.js +0 -1
- package/lib/contract/model/http/server-envelope.model.d.ts +0 -10
- package/lib/contract/model/http/server-envelope.model.js +0 -1
- package/lib/contract/model/middleware/aggregator-state.model.d.ts +0 -4
- package/lib/contract/model/middleware/aggregator-state.model.js +0 -2
- package/lib/contract/model/shared/loose-object.model.js +0 -1
- package/lib/helper/chat.helper.d.ts +0 -8
- package/lib/helper/chat.helper.js +0 -18
- package/lib/helper/http.helper.d.ts +0 -13
- package/lib/helper/http.helper.js +0 -28
- package/lib/helper/middleware.helper.d.ts +0 -12
- package/lib/helper/middleware.helper.js +0 -68
- package/lib/helper/store.helper.js +0 -169
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -2
- package/lib/interface/entry.interface.d.ts +0 -20
- package/lib/interface/entry.interface.js +0 -306
- package/lib/interface/middleware/paging.interface.d.ts +0 -4
- package/lib/interface/middleware/paging.interface.js +0 -53
- package/lib/interface/middleware/processor.interface.d.ts +0 -10
- package/lib/interface/middleware/processor.interface.js +0 -118
- package/lib/plugin.d.ts +0 -3
- package/lib/plugin.js +0 -154
- package/lib/utils.d.ts +0 -2
- package/lib/utils.js +0 -79
- package/lib-esm/client/chat.client.js +0 -145
- package/lib-esm/client/contact-method.client.d.ts +0 -34
- package/lib-esm/client/contact-method.client.js +0 -337
- package/lib-esm/client/http.client.d.ts +0 -26
- package/lib-esm/client/http.client.js +0 -211
- package/lib-esm/client/middleware.client.d.ts +0 -14
- package/lib-esm/client/middleware.client.js +0 -125
- package/lib-esm/contract/custom-component/contact-method-item.js +0 -34
- package/lib-esm/contract/custom-component/contact-method-list.js +0 -13
- package/lib-esm/contract/custom-component/contact-method.js +0 -35
- package/lib-esm/contract/custom-component/entry-context.js +0 -4
- package/lib-esm/contract/enum/server-entry-type.enum.d.ts +0 -7
- package/lib-esm/contract/enum/server-entry-type.enum.js +0 -8
- package/lib-esm/contract/model/conversation-api-model/list.model.d.ts +0 -5
- package/lib-esm/contract/model/conversation-api-model/list.model.js +0 -1
- package/lib-esm/contract/model/conversation-api-model/message.model.js +0 -1
- package/lib-esm/contract/model/http/action.model.d.ts +0 -3
- package/lib-esm/contract/model/http/action.model.js +0 -1
- package/lib-esm/contract/model/http/client-action.model.d.ts +0 -4
- package/lib-esm/contract/model/http/client-action.model.js +0 -2
- package/lib-esm/contract/model/http/client-envelope.model.d.ts +0 -9
- package/lib-esm/contract/model/http/client-envelope.model.js +0 -1
- package/lib-esm/contract/model/http/connect-options.model.js +0 -1
- package/lib-esm/contract/model/http/global-state.model.js +0 -1
- package/lib-esm/contract/model/http/http-client-options.model.js +0 -1
- package/lib-esm/contract/model/http/server-entry.model.js +0 -1
- package/lib-esm/contract/model/http/server-envelope.model.js +0 -1
- package/lib-esm/contract/model/middleware/aggregator-state.model.js +0 -2
- package/lib-esm/contract/model/shared/loose-object.model.d.ts +0 -3
- package/lib-esm/contract/model/shared/loose-object.model.js +0 -1
- package/lib-esm/helper/chat.helper.js +0 -18
- package/lib-esm/helper/http.helper.js +0 -28
- package/lib-esm/helper/middleware.helper.js +0 -68
- package/lib-esm/helper/store.helper.d.ts +0 -23
- package/lib-esm/helper/store.helper.js +0 -169
- package/lib-esm/index.js +0 -2
- package/lib-esm/interface/entry.interface.js +0 -306
- package/lib-esm/interface/middleware/paging.interface.js +0 -53
- package/lib-esm/interface/middleware/processor.interface.js +0 -118
- package/lib-esm/plugin.js +0 -154
- package/lib-esm/utils.js +0 -79
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/contract/enum/server-entry-type.enum.ts","../src/helper/chat.helper.ts","../src/helper/middleware.helper.ts","../src/helper/store.helper.ts","../src/client/contact-method.client.ts","../src/utils.ts","../src/interface/entry.interface.ts","../src/client/chat.client.ts","../src/helper/http.helper.ts","../src/interface/middleware/paging.interface.ts","../src/interface/middleware/processor.interface.ts","../src/client/middleware.client.ts","../src/client/http.client.ts","../src/plugin.ts"],"sourcesContent":["export enum ServerEntryTypeEnum {\n Widget,\n Text,\n Contact,\n List,\n Error,\n}\n","export class ChatHelper {\n private static user: any;\n private static agent: any;\n\n static setUser(user: any) {\n this.user = user;\n }\n\n static setAgent(agent: any) {\n this.agent = agent;\n }\n \n static getUser(): any {\n return this.user;\n }\n \n static getAgent(): any {\n return this.agent;\n }\n}\n","import { createStorageWriter, readStorage, StorageCategory } from '@telia-ace/widget-services';\nimport { Message } from '../contract/model/conversation-api-model/message.model';\n\nexport class MiddlewareHelper {\n private static sessionMessageStorageVariable: string = 'conversation-plugin-messages';\n private static container: any;\n private static widget: any;\n\n static setContainer(container: any) {\n MiddlewareHelper.container = container;\n }\n\n static setWidget(widget: any) {\n this.widget = widget;\n }\n\n static getContainer(): any {\n return this.container;\n }\n\n static getWidget(): any {\n return this.widget;\n }\n\n static setEntrySessionStorage = async (messages: Message[]) => {\n return createStorageWriter(\n MiddlewareHelper.container,\n MiddlewareHelper.sessionMessageStorageVariable,\n StorageCategory.Necessary\n ).then((write) => {\n return write(messages);\n });\n };\n\n static getEntrySessionStorage(): Promise<any> {\n return readStorage(this.container, this.sessionMessageStorageVariable);\n }\n}\n","import { createStorageWriter, readStorage, StorageCategory } from '@telia-ace/widget-services';\nimport { Message } from '../contract/model/conversation-api-model/message.model';\nimport { ClientAction } from '../contract/model/http/client-action.model';\nimport { GlobalState } from '../contract/model/http/global-state.model';\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\nimport { LooseObject } from '../contract/model/shared/loose-object.model';\nimport { MiddlewareHelper } from './middleware.helper';\n\nconst botProviderGlobalStateSessionKey = 'bot-provider-global-state';\n\nexport class StoreHelper {\n private static messageStore: Message[] = [];\n private static globalState: GlobalState;\n\n constructor() {\n StoreHelper.globalState = {\n completedInteractionsCount: 0,\n lastBotGuide: 0,\n site: '',\n invincibleParameters: {},\n };\n }\n\n static async insertOrUpdateMessageArrayStore(messageArray: Message[], entry?: any) {\n for (const message of messageArray.filter((o) => !!o)) {\n if (!this.messageStore.find((o) => o.id == message.id)) {\n this.insertMessageToStore(message);\n } else {\n this.updateMessageInStore(message, entry);\n }\n }\n\n await MiddlewareHelper.setEntrySessionStorage(this.messageStore);\n }\n\n static insertMessageToStore(message: Message) {\n this.messageStore.push(message);\n }\n\n private static updateMessageInStore(message: Message, entry?: any) {\n message.conversationEntry = entry;\n let index = this.messageStore.findIndex((o) => o.id == message.id);\n this.messageStore[index] = message;\n }\n\n static checkIdInMessageStore(id: string): boolean {\n return this.messageStore.find((o) => o.id == id) === undefined;\n }\n\n static getLocalState(action: string): LooseObject | undefined {\n const entry: ServerEntry | undefined = this.getEntry(action);\n return entry?.localState;\n }\n\n static getGlobalState(): GlobalState {\n return StoreHelper.globalState;\n }\n\n static setGlobalState(state: GlobalState) {\n StoreHelper.globalState = state;\n\n return createStorageWriter(\n MiddlewareHelper.getContainer(),\n botProviderGlobalStateSessionKey,\n StorageCategory.Necessary\n ).then((write) => {\n return write(state);\n });\n }\n\n static getAction(action: string): ClientAction {\n const entry: ServerEntry | undefined = this.getEntry(action);\n\n return {\n key: action,\n content: entry?.actions[action],\n };\n }\n\n static getCommand(text: string): LooseObject {\n return { phrase: text };\n }\n\n static getEntry(action: string): ServerEntry | undefined {\n let entry: ServerEntry | undefined = undefined;\n this.getEntryStore().forEach((o) => {\n if (o.actions[action]) {\n entry = o;\n }\n });\n return entry;\n }\n\n static getMessage(id: string): Message | undefined {\n return this.messageStore.find((o) => o.id == id);\n }\n\n static getEntryStore(): ServerEntry[] {\n return this.messageStore\n .filter((o) => !!o.entry)\n .map((o) => {\n return o.entry;\n });\n }\n\n static async rehydrateState() {\n const state: GlobalState | undefined = await readStorage(\n MiddlewareHelper.getContainer(),\n botProviderGlobalStateSessionKey\n );\n if (state) {\n this.setGlobalState(state);\n }\n }\n}\n","import { ContactMethodPlatform } from '@telia-ace/knowledge-widget-adapters';\nimport { DataClient, DataType } from '@telia-ace/knowledge-widget-types-grid';\nimport { FormBuilder, submitButton } from '@telia-ace/widget-forms';\nimport { Container } from '@webprovisions/platform';\nimport { v4 as uuidv4 } from 'uuid';\nimport { StoreHelper } from '../helper/store.helper';\nimport ChatClient from './chat.client';\n\nexport class ContactMethodClient {\n private static dataClient: DataClient;\n private static contactMethodPlatform: ContactMethodPlatform;\n private static contactMessageEntryArray: any[] = [];\n private static agent: any;\n private chatClient: ChatClient;\n private static container: any;\n\n constructor(container: Container) {\n this.chatClient = new ChatClient(container);\n }\n\n static initialize(\n container: any,\n dataClient: DataClient,\n contactMethodPlatform: ContactMethodPlatform,\n agent: any\n ) {\n this.dataClient = dataClient;\n this.contactMethodPlatform = contactMethodPlatform;\n this.agent = agent;\n this.container = container;\n }\n\n // function for handling forms as contact methods\n handleNewForm = async (errors: any, entry: any) => {\n this.updateForm(entry.contactMethods, {\n submit: 'Submit',\n errors: errors,\n });\n entry.entry.update({\n contactMethods: entry.contactMethods,\n type: 'ace-knowledge-contact-method',\n noPadding: true,\n });\n };\n\n // function for receiving the contact method based on the input\n handleContactMethod = async (input: string = '') => {\n if (input == 'contact') {\n await this.handleContactCategoryList(input);\n } else {\n let contactMethods = await this.loadContactMethods(\n input.split('/')[1], // type\n input.split('/')[0] // id\n );\n\n if (!!contactMethods.body?.form) {\n this.handleForm(input, contactMethods);\n } else if (!contactMethods.expanded && contactMethods.inline) {\n this.handleSingleContactMethod(contactMethods);\n } else if (!!contactMethods.contactMethods) {\n this.handleContactMethodList(input, contactMethods);\n }\n }\n };\n\n // validation of the form provided\n validate(form: any) {\n let entry = ContactMethodClient.contactMessageEntryArray.find(\n (o) => o.id == form.schema.id\n );\n ContactMethodClient.contactMethodPlatform.validate(entry.contactMethods).then((result) => {\n this.handleNewForm(result.errors, entry);\n if (result.valid) {\n this.submit(entry);\n this.removeForm(entry);\n }\n });\n }\n\n private handleContactCategoryList = async (input: string) => {\n let newGuid = uuidv4();\n let type = DataType.ContactMethodCategories;\n let contactMethods = await this.loadContactMethods(type);\n this.chatClient.printUserMessageAndStoreIt(input);\n this.printMessage(newGuid, contactMethods);\n };\n\n private handleForm(input: string, contactMethods: any) {\n let title = input.split('/')[2];\n contactMethods.expanded = true;\n this.updateForm(contactMethods, {\n submit: 'Submit',\n errors: undefined,\n });\n this.printMessage(contactMethods.id, contactMethods, title);\n }\n\n addContactMethod(contactMethod: any) {\n contactMethod.expanded = true;\n this.updateForm(contactMethod, {\n submit: 'Submit',\n errors: undefined,\n });\n return this.printMessage(contactMethod.id, contactMethod);\n }\n\n expandContactMethod(input: { entryId: string; contactMethodId: string }) {\n const message = StoreHelper.getMessage(input.entryId);\n\n if (message?.conversationEntry && Array.isArray(message.message)) {\n const messageItemIndex = message.message.findIndex(\n ([listType]: any[]) => listType === 'ace-knowledge-contact-method'\n );\n if (messageItemIndex > -1) {\n const [messageItemType, messageItemContent] = message.message[messageItemIndex];\n const updatedMessageItemContent = {\n ...messageItemContent,\n contactMethods: messageItemContent.contactMethods.map((cm: any) => {\n cm.expanded = true;\n return cm;\n }),\n };\n const updatedMessageItems = [\n ...message.message.slice(0, messageItemIndex),\n [messageItemType, updatedMessageItemContent],\n ...message.message.slice(messageItemIndex + 1),\n ];\n\n message.conversationEntry.writer({ items: updatedMessageItems });\n }\n }\n }\n\n private handleContactMethodList(input: string, contactMethods: any) {\n let title = input.split('/')[2];\n let newGuid = uuidv4();\n this.printMessage(newGuid, contactMethods, title);\n }\n\n private handleSingleContactMethod(contactMethods: any) {\n let entry = ContactMethodClient.contactMessageEntryArray.find((o) =>\n o.contactMethods.contactMethods.find((t: any) => t.id == contactMethods.id)\n );\n let curCM = entry.contactMethods.contactMethods.find((t: any) => t.id == contactMethods.id);\n curCM.expanded = true;\n let message = {\n contactMethods: entry.contactMethods,\n type: 'ace-knowledge-contact-method',\n noPadding: true,\n };\n StoreHelper.insertOrUpdateMessageArrayStore([\n {\n id: entry.id,\n message: message,\n isUser: false,\n },\n ]);\n entry.entry.update(message);\n }\n\n private submit(entry: any) {\n ContactMethodClient.contactMethodPlatform.submit(entry.contactMethods).then((result) => {\n if (!!result) ContactMethodClient.agent.print(result);\n });\n }\n\n private removeForm(entry: any) {\n entry.entry.remove();\n ContactMethodClient.contactMessageEntryArray.splice(\n ContactMethodClient.contactMessageEntryArray.indexOf(entry),\n 1\n );\n }\n\n private printMessage(\n newGuid: string,\n contactMethods: any,\n title: string | undefined = undefined\n ) {\n if (ContactMethodClient.contactMessageEntryArray.find((o) => o.id == contactMethods.id)) {\n let entry = ContactMethodClient.contactMessageEntryArray.find(\n (o) => o.id == contactMethods.id\n );\n let message = {\n contactMethods: contactMethods,\n type: 'ace-knowledge-contact-method',\n noPadding: true,\n };\n entry.entry.update(message);\n StoreHelper.insertOrUpdateMessageArrayStore([\n {\n id: entry.guid,\n message: message,\n isUser: false,\n },\n ]);\n return message;\n } else {\n if (title) this.chatClient.printUserMessageAndStoreIt(title);\n let message = {\n contactMethods: contactMethods,\n type: 'ace-knowledge-contact-method',\n noPadding: true,\n };\n let entry = ContactMethodClient.agent.print(message);\n StoreHelper.insertOrUpdateMessageArrayStore([\n {\n id: newGuid,\n message: message,\n isUser: false,\n },\n ]);\n ContactMethodClient.contactMessageEntryArray.push({\n id: newGuid,\n contactMethods: contactMethods,\n entry: entry,\n });\n return message;\n }\n }\n\n private loadContactMethods(dataType: string, id: string | undefined = undefined): Promise<any> {\n switch (dataType) {\n case DataType.ContactMethodCategories: {\n return ContactMethodClient.container\n .getAsync('matchingClient')\n .then((matchingClient: any) => {\n return matchingClient.customRequest('/contactmethods', 'GET', {});\n })\n .then((contactMethods: any) => {\n return contactMethods;\n });\n // return ContactMethodClient.dataClient\n // .fetch(DataType.ContactMethods, { contactMethodCategoryId: id })\n // .then((contactMethods) => contactMethods);\n }\n case DataType.ContactMethods: {\n if (!!id) {\n return ContactMethodClient.dataClient\n .fetch(DataType.ContactMethod, { contactMethodId: id })\n .then((contactMethods) => contactMethods);\n } else {\n return ContactMethodClient.dataClient\n .fetch(DataType.ContactMethods, {})\n .then((contactMethods) => contactMethods);\n }\n }\n case DataType.ContactMethodCategories: {\n return ContactMethodClient.dataClient\n .fetch(DataType.ContactMethods, { contactMethodCategoryId: id })\n .then((contactMethods) => contactMethods);\n }\n default: {\n return Promise.resolve(undefined);\n }\n }\n }\n\n private updateForm = (contactMethod: any, properties: any) => {\n if (contactMethod?.body?.form) {\n const { body } = contactMethod;\n const builder = new FormBuilder(body.form);\n\n if (!body.form.layout || !body.form.layout.submit) {\n builder.createComponent(submitButton(properties.submit, 'submit'));\n }\n\n if (properties.errors) {\n builder.setValidationErrors(properties.errors);\n }\n\n return {\n ...body,\n form: builder.get(),\n };\n }\n return contactMethod?.body || {};\n };\n}\n","import { FormBuilder } from '@telia-ace/widget-forms';\nimport { Symbol } from '@telia-ace/widget-ui';\nimport { StoreHelper } from './helper/store.helper';\n\nexport const getContactMethodEntry = (contactMethodId: string) => {\n const entries = StoreHelper.getEntryStore();\n\n return entries.find((e) => e.content.id === +contactMethodId);\n};\n\nconst convertLegacySymbol = (symbol?: { type: string; content: string }): Symbol | undefined => {\n if (symbol) {\n const { type, content } = symbol;\n if (type && content) {\n return { type, content };\n }\n }\n};\n\nexport const contactMethodFromLegacy = (\n {\n id,\n title,\n defaultIcon,\n exits: [exit],\n exitType,\n confirmationText,\n expandFormAutomatically,\n form,\n description,\n }: any,\n validation?: any\n): any => {\n const { adapter } = exit || { Adapter: {} };\n const { clientName = '', settings: adapterSettings = {}, customClientName = '' } = adapter;\n\n const settings: any = {\n id: id.toString(),\n title: title,\n description: description,\n symbol: convertLegacySymbol(defaultIcon),\n clientName: clientName === 'custom.adapter' ? customClientName : clientName,\n expanded: true,\n inline: true,\n body: {},\n };\n\n if (clientName.indexOf('phone') > -1 || clientName.indexOf('freetext') > -1) {\n const { displayTextBeforeClick, textBeforeClick } = adapterSettings;\n if (displayTextBeforeClick === 'true') {\n settings.expanded = false;\n settings.title = textBeforeClick;\n }\n\n if (clientName.indexOf('phone.text') > -1) {\n settings.body.phoneNumber = adapterSettings.phoneNumber;\n } else {\n settings.body.freetext = adapterSettings.freetext;\n }\n }\n\n if (\n clientName.indexOf('chat.popup') > -1 ||\n clientName.indexOf('link') > -1 ||\n (clientName === 'custom.adapter' && exitType === 'custom')\n ) {\n settings.body = adapterSettings;\n settings.body.confirmationFallback = confirmationText;\n }\n\n if (clientName.indexOf('ace') > -1) {\n settings.body = adapterSettings;\n }\n\n if (form && form.hasValueComponents) {\n if (validation) {\n settings.body.form = FormBuilder.fromLegacyForm(id.toString(), form, validation).get();\n } else {\n settings.body.form = FormBuilder.fromLegacyForm(id.toString(), form).get();\n }\n if (!expandFormAutomatically) {\n settings.expanded = settings.inline = false;\n }\n }\n\n return settings;\n};\n","import { DataClient, DataType } from '@telia-ace/knowledge-widget-types-grid';\nimport { Symbol } from '@telia-ace/knowledge-widget-ui';\nimport {\n ConversationMessageListItemType,\n ConverstationMessageItem,\n} from '@telia-ace/widget-conversation';\nimport { Container } from '@webprovisions/platform';\nimport { ContactMethodClient } from '../client/contact-method.client';\nimport { ServerEntryTypeEnum } from '../contract/enum/server-entry-type.enum';\nimport { Message } from '../contract/model/conversation-api-model/message.model';\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\nimport { StoreHelper } from '../helper/store.helper';\nimport { contactMethodFromLegacy } from '../utils';\n\nexport default class EntryInterface {\n private helpActionKey = 'help';\n private nextActionKey = 'next';\n\n constructor(private container: Container) {}\n\n // transform the entry based on its type\n async transform(entry: ServerEntry, feedbackEntry?: ServerEntry): Promise<Message | undefined> {\n const entryType = (<any>ServerEntryTypeEnum)[entry.type];\n switch (entryType) {\n case ServerEntryTypeEnum.List:\n return {\n id: entry.id,\n message: this.listTransform(entry, feedbackEntry),\n entry: entry,\n isUser: false,\n };\n case ServerEntryTypeEnum.Text:\n return {\n id: entry.id,\n message: this.textTransform(entry, feedbackEntry),\n entry: entry,\n isUser: false,\n };\n case ServerEntryTypeEnum.Contact:\n return {\n id: entry.id,\n message: await this.transformContactMethod(entry),\n entry: entry,\n isUser: false,\n };\n }\n }\n\n async transformContactMethod(entry: ServerEntry): Promise<any> {\n const dataClient: DataClient = await this.container.getAsync('dataClient');\n\n const contactMethod = await dataClient.fetch(DataType.ContactMethod, {\n contactMethodId: entry.content.id,\n });\n\n const cmClient = new ContactMethodClient(this.container);\n cmClient.addContactMethod(contactMethod);\n }\n\n // transform an array of entries\n async transformArray(entryArray: ServerEntry[]): Promise<Message[]> {\n let feedbackEntry = entryArray.find((o) =>\n o.tags.find((t) => t == 'gentle' || t == 'feedback')\n );\n let returnArray: Message[] = [];\n for (const o of entryArray.filter((t) => t !== feedbackEntry)) {\n let x = await this.transform(o, feedbackEntry);\n if (!!x) returnArray.push(x);\n }\n return returnArray;\n }\n\n // gets the text that should be printed as a user message on action\n getUserMessage(action: string) {\n let entry = StoreHelper.getEntry(action);\n\n return this.getTitleFromEntry(entry, action);\n }\n\n private listTransform(entry: ServerEntry, feedbackEntry?: ServerEntry): any {\n if (entry.type === 'Contact') {\n return;\n }\n\n if (!entry.content) return;\n\n let object = this.getListActions(\n entry.content.items,\n this.getContentText(entry),\n entry.actions,\n entry.localState\n );\n\n if (!!feedbackEntry) {\n let feedbackObject = this.getListActions(\n feedbackEntry.content.items,\n this.getContentText(feedbackEntry),\n feedbackEntry.actions,\n feedbackEntry.localState\n );\n //TODO this will be remade\n StoreHelper.insertMessageToStore({\n id: feedbackEntry.id,\n message: undefined,\n entry: feedbackEntry,\n isUser: false,\n });\n\n return object.concat(feedbackObject);\n }\n\n return object;\n }\n\n private getContentText(entry: ServerEntry): object | undefined {\n if (entry.content.html) return { body: entry.content.html };\n if (entry.content.header) return { title: entry.content.header };\n }\n\n private textTransform(entry: ServerEntry, feedbackEntry?: ServerEntry): any {\n //TODO this will be remade with the embeded contact methods\n\n if (!!entry.content.items) return this.listTransform(entry, feedbackEntry);\n\n let returnObj: ConverstationMessageItem<any> = [\n ConversationMessageListItemType.HTML,\n { body: entry.content.html.replace('\\n', '') },\n ];\n\n if (!!feedbackEntry) {\n let feedbackObject = this.getListActions(\n feedbackEntry.content.items,\n this.getContentText(feedbackEntry),\n feedbackEntry.actions,\n feedbackEntry.localState\n );\n StoreHelper.insertMessageToStore({\n id: feedbackEntry.id,\n message: undefined,\n entry: feedbackEntry,\n isUser: false,\n });\n\n feedbackObject.unshift(returnObj);\n return feedbackObject;\n }\n\n return returnObj;\n }\n\n private getListActions(\n items: any[],\n text: any,\n actions: any,\n state: any\n ): ConverstationMessageItem<any>[] {\n let list: any[] = [];\n const mainListType = this.getListType(state);\n\n const createMainList = (\n type: ConversationMessageListItemType | string\n ): { [key: string]: string } | { actionKey: string; label: string; symbol?: Symbol }[] => {\n if (type === ConversationMessageListItemType.ButtonList) {\n return [];\n }\n return {};\n };\n\n let mainListContent = createMainList(mainListType);\n let mainList: any = [mainListType, { actions: mainListContent }];\n\n if (mainListType === 'ace-knowledge-contact-method') {\n mainList[1] = {\n ...mainList[1],\n contactMethods: items.map((item) => {\n const formatted = contactMethodFromLegacy(item.data);\n return formatted;\n }),\n entry: {\n entryId: state.entryId,\n },\n };\n }\n\n if (text && text.title) {\n list.push([ConversationMessageListItemType.Header, text.title]);\n }\n if (text && text.body) {\n list.push([ConversationMessageListItemType.HTML, { body: text.body }]);\n }\n list.push(mainList);\n items.forEach((o) => {\n switch (o.actionKey) {\n case this.helpActionKey: {\n list.push([ConversationMessageListItemType.Separator, undefined]);\n list.push(['no-good-alternative', { body: o.title }]);\n break;\n }\n case this.nextActionKey: {\n if (\n !!actions['next'] &&\n actions['next'].take ===\n items.filter((o) => o.actionKey !== 'help').length + 2\n ) {\n if (Array.isArray(mainListContent)) {\n mainListContent.push({\n label: o.title,\n actionKey: o.actionKey,\n });\n } else {\n mainListContent[o.actionKey] = o.title;\n }\n }\n break;\n }\n default: {\n if (Array.isArray(mainListContent)) {\n mainListContent.push({\n label: o.title,\n actionKey: o.actionKey,\n symbol: o.symbol,\n });\n } else {\n mainListContent[o.actionKey] = o.title;\n }\n }\n }\n });\n return list;\n }\n\n private getListType(state: any) {\n if (state?.$type === 'Humany.Matching.Bots.Conversations.GuideListState, Humany.Matching') {\n return ConversationMessageListItemType.LinkList;\n } else if (\n state?.$type ===\n 'Humany.Matching.Bots.Conversations.States.GuideFeedbackState, Humany.Matching'\n ) {\n return 'feedback-list';\n } else if (\n state?.$type ===\n 'Humany.Matching.Bots.Conversations.States.ContactState, Humany.Matching'\n ) {\n return 'ace-knowledge-contact-method';\n } else return ConversationMessageListItemType.ButtonList;\n }\n\n private getTitleFromEntry(entry: ServerEntry | undefined, action: string): string | undefined {\n if (!!entry) {\n const entryType = (<any>ServerEntryTypeEnum)[entry.type];\n switch (entryType) {\n case ServerEntryTypeEnum.List:\n return this.getTitleFromList(entry, action);\n case ServerEntryTypeEnum.Text:\n return this.textTransform(entry);\n }\n }\n }\n\n private getTitleFromList(entry: ServerEntry, action: string): string {\n return (<Array<any>>entry.content.items).find((o) => o.actionKey == action).title;\n }\n}\n","import { Container } from '@webprovisions/platform';\nimport { v4 as newGuid } from 'uuid';\nimport { ServerEntryTypeEnum } from '../contract/enum/server-entry-type.enum';\nimport { Message } from '../contract/model/conversation-api-model/message.model';\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\nimport { ChatHelper } from '../helper/chat.helper';\nimport { StoreHelper } from '../helper/store.helper';\nimport EntryInterface from '../interface/entry.interface';\n\nexport default class ChatClient {\n entryInterface: EntryInterface;\n constructor(container: Container) {\n this.entryInterface = new EntryInterface(container);\n }\n\n // Initialize from setting the user and agent for the Helper\n static initialize(user: any, agent: any) {\n ChatHelper.setUser(user);\n ChatHelper.setAgent(agent);\n }\n\n // function for posting the messages\n async processMessageArrayAndStoreIt(messages: Message[]) {\n for (const message of messages.filter((o) => o && o != null && !!o.message)) {\n if (message.isUser) this.postUserMessage(message);\n else this.postAgentMessage(message);\n }\n\n await StoreHelper.insertOrUpdateMessageArrayStore(messages);\n }\n\n // function for updating current messages\n updateMessageArrayAndStoreIt(messages: Message[]) {\n let conversationEntry = undefined;\n messages.forEach((o) => {\n let message = StoreHelper.getMessage(o.id);\n message?.conversationEntry.update(o.message);\n conversationEntry = message?.conversationEntry;\n });\n\n StoreHelper.insertOrUpdateMessageArrayStore(messages, conversationEntry);\n }\n\n // function for posting a message for the user actions, such as button clicks\n printUserMessageAndStoreIt(action: string) {\n if (action == 'next' || action == 'help') return;\n\n let entry = StoreHelper.getEntry(action);\n\n let message = {\n id: newGuid(),\n message: !entry ? action : this.getTitleFromEntry(entry, action),\n isUser: true,\n };\n\n this.postUserMessage(message);\n StoreHelper.insertOrUpdateMessageArrayStore([message]);\n }\n\n private postUserMessage(message: Message) {\n ChatHelper.getUser().print(message.message);\n }\n\n private postAgentMessage(message: Message) {\n message.conversationEntry = ChatHelper.getAgent().print(message.message);\n }\n\n private getTitleFromEntry(entry: ServerEntry, action: string): string {\n const entryType = (<any>ServerEntryTypeEnum)[entry.type];\n switch (entryType) {\n case ServerEntryTypeEnum.List:\n return this.getTitleFromList(entry, action);\n case ServerEntryTypeEnum.Text:\n return this.getTitleFromText(entry, action);\n default:\n return '';\n }\n }\n\n private getTitleFromText(entry: ServerEntry, action: string): any {\n if (!!entry.content.items) return this.getTitleFromList(entry, action);\n else return entry.content.html;\n }\n\n private getTitleFromList(entry: ServerEntry, action: string): string {\n return (<Array<any>>entry.content.items).find((o) => o.actionKey == action).title;\n }\n}\n","export class HttpHelper {\n static fetchOptions = {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n };\n\n static combineUrl(basePath: string, path: string) {\n return basePath + path;\n }\n\n static managedSubdomainSuffixes = ['stage', 'alpha', 'beta', 'gamma'];\n\n static parseSubdomain = (input: string) => {\n const index = input.lastIndexOf('-');\n const lastPart = input.substr(index + 1);\n if (HttpHelper.managedSubdomainSuffixes.indexOf(lastPart) > -1) {\n return input.substr(0, index);\n }\n return input;\n };\n\n static getCredentials(): string | undefined {\n return 'same-origin';\n }\n}\n","import { ServerEntry } from \"../../contract/model/http/server-entry.model\";\nimport { StoreHelper } from \"../../helper/store.helper\";\n\nexport default class PagingInterface {\n process(entries: ServerEntry[]): ServerEntry[] {\n const pagingEntry = entries.find((e) => e.tags.indexOf(\"paging\") > -1);\n\n if (pagingEntry) {\n const stream = StoreHelper.getEntryStore().filter(\n (e) => e.tags.indexOf(\"paging\") > -1 && e.id === pagingEntry.id\n );\n\n if (stream.length > 0) {\n // Get the paging entry with the highest take count\n const last = stream.reduce((acc, entry) => {\n if (\n entry.actions.next &&\n entry.actions.next.take >= acc.actions.next.take\n ) {\n return entry;\n }\n return acc;\n }, stream[0]); // tslint:disable-line:align\n\n // If there is a paging entry with higher take count than the entry to be written,\n // it should be updated to use the paging data from the highest take count entry\n if (last.actions.next.take > pagingEntry.actions.next.take) {\n entries.forEach((entry) => {\n if (entry.id === pagingEntry.id) {\n entry.actions.next = {\n ...entry.actions.next,\n take: last.actions.next.take,\n skip: last.actions.next.skip,\n };\n }\n });\n }\n }\n\n // if items is null or undefined it should\n // overwrite with an empty array\n entries.forEach((entry) => {\n if (\n entry.id === pagingEntry.id &&\n entry.content &&\n entry.content.timestamp\n ) {\n entry.content = {\n ...entry.content,\n items: (entry.content && entry.content.items) || [],\n };\n }\n });\n }\n\n return entries;\n }\n}\n","import { Action } from '../../contract/model/http/action.model';\nimport { ServerEntry } from '../../contract/model/http/server-entry.model';\n\nexport default class ProcessorInterface {\n process(entries: ServerEntry[]): ServerEntry[] {\n let processedEntries = entries;\n\n processedEntries = this.deletePaging(processedEntries);\n processedEntries = this.delete(processedEntries);\n processedEntries = this.merge(processedEntries);\n processedEntries = this.moveLoader(processedEntries);\n\n return processedEntries;\n }\n\n processUpdate(entry: ServerEntry | undefined, updateEntryArray: ServerEntry[]): ServerEntry[] {\n updateEntryArray\n .filter((t) => t.type == 'List')\n .forEach((o) => {\n o.content?.items.forEach((t: any) => {\n if (!entry?.content.items.find((p: any) => p.actionKey == t.actionKey))\n entry?.content.items.push(t);\n });\n Object.keys(o.actions).forEach((t) => {\n this.handleActionUpdateOrInsert(entry?.actions, t, o.actions);\n });\n });\n\n //moves the show more and if it helped to the end if it is needed\n var itemArray: any[] = entry?.content.items;\n\n if (itemArray.find((o) => o.actionKey == 'next')) {\n itemArray.push(\n itemArray.splice(\n itemArray.indexOf(itemArray.find((o) => o.actionKey == 'next')),\n 1\n )[0]\n );\n }\n\n if (itemArray.find((o) => o.actionKey == 'help')) {\n itemArray.push(\n itemArray.splice(\n itemArray.indexOf(itemArray.find((o) => o.actionKey == 'help')),\n 1\n )[0]\n );\n }\n\n return entry ? [entry] : [];\n }\n\n private handleActionUpdateOrInsert(\n currentArray: Action | undefined,\n actionKey: string,\n action: Action\n ) {\n if (!!currentArray) currentArray[actionKey] = action[actionKey];\n }\n\n private deletePaging(entries: ServerEntry[]): ServerEntry[] {\n return entries.filter((entry) => {\n const isEmptyPaging =\n entry.type === 'List' &&\n entry.tags &&\n entry.tags.indexOf('paging') > -1 &&\n typeof entry.content === 'undefined';\n return !isEmptyPaging;\n });\n }\n\n private delete(entries: ServerEntry[]): ServerEntry[] {\n return entries.filter((entry) => entry.content !== null);\n }\n\n private merge(entries: ServerEntry[]): ServerEntry[] {\n const output: ServerEntry[] = [];\n\n const merge = (source: any, target: any = {}): any => {\n const content: any = {};\n if (source == null) {\n return null;\n }\n\n if (target) {\n Object.keys(target).forEach((key) => {\n content[key] = target[key];\n });\n }\n\n Object.keys(source).forEach((key) => {\n if (key == 'items') {\n if (!content[key]) content[key] = [];\n content[key] = content[key].concat(source[key]);\n } else if (key == 'html') content[key] = content[key] + source[key];\n else content[key] = source[key];\n });\n\n return content;\n };\n\n const mergeLocalState = (source: any, target: any): any => {\n if (source == null) return null;\n\n if (Object.keys(source.actions).length === 0) return target.localState;\n\n if (Object.keys(target.actions).length === 0) return source.localState;\n\n return target.localState;\n };\n\n entries.forEach((entry) => {\n if (entry.relation && !entry.tags.find((o) => o == 'gentle' || o == 'feedback')) {\n let existingEntry = entries.find((o) => o.id == entry.relation);\n\n if (existingEntry) {\n const existingIndex = output.indexOf(existingEntry);\n existingEntry.localState = mergeLocalState(entry, existingEntry);\n existingEntry.content = merge(entry.content, existingEntry.content);\n existingEntry.actions = merge(entry.actions, existingEntry.actions);\n output[existingIndex] = existingEntry;\n }\n } else {\n output.push(entry);\n }\n });\n\n return output;\n }\n\n private moveLoader(entries: ServerEntry[]): ServerEntry[] {\n // Moves the loader component to last position in stream\n const loaderEntry = entries.find((e) => e.id === 'loader');\n\n if (!loaderEntry) {\n return entries;\n }\n\n const loaderIndex = entries.indexOf(loaderEntry);\n if (loaderIndex > -1) {\n entries.splice(entries.length - 1, 0, entries.splice(loaderIndex, 1)[0]);\n }\n return entries;\n }\n}\n","import { createStorageWriter, StorageCategory } from '@telia-ace/widget-services';\nimport { Container } from '@webprovisions/platform';\nimport { ServerEntry } from '../contract/model/http/server-entry.model';\nimport { ChatHelper } from '../helper/chat.helper';\nimport { MiddlewareHelper } from '../helper/middleware.helper';\nimport { StoreHelper } from '../helper/store.helper';\nimport EntryInterface from '../interface/entry.interface';\nimport PagingInterface from '../interface/middleware/paging.interface';\nimport ProcessorInterface from '../interface/middleware/processor.interface';\nimport ChatClient from './chat.client';\n\nexport default class MiddlewareClient {\n private paging: PagingInterface;\n private processor: ProcessorInterface;\n private entryInterface: EntryInterface;\n private chatClient: ChatClient;\n\n constructor(container: Container) {\n this.paging = new PagingInterface();\n this.processor = new ProcessorInterface();\n this.entryInterface = new EntryInterface(container);\n this.chatClient = new ChatClient(container);\n }\n\n static initialize(container: any, widget: any) {\n MiddlewareHelper.setContainer(container);\n MiddlewareHelper.setWidget(widget);\n }\n\n // called on all standard scenarios like actions and user messages\n async handleEntries(entries: ServerEntry[], action?: string) {\n const widgetEntry = (entries || []).find((e) => e.type === 'Widget');\n\n if (widgetEntry) {\n const agent = ChatHelper.getAgent();\n\n if (agent) {\n agent.update({\n name: widgetEntry.content.agent.name,\n avatar: widgetEntry.content.agent.avatar,\n });\n\n const write = await createStorageWriter(\n MiddlewareHelper.getContainer(),\n 'bot-provider-conversation-meta',\n StorageCategory.Necessary\n );\n write({\n agent: {\n name: widgetEntry.content.agent.name,\n avatar: widgetEntry.content.agent.avatar,\n },\n });\n }\n }\n\n let o = this.executeMiddlewares(entries, false, action);\n let messageArray = await this.entryInterface.transformArray(o);\n this.chatClient.processMessageArrayAndStoreIt(messageArray);\n }\n\n // called on situations such as paging changes\n // when no new entries will be printed\n async handleUpdate(entries: ServerEntry[], action?: string) {\n let o = this.executeMiddlewares(entries, true, action);\n let messageArray = await this.entryInterface.transformArray(o);\n this.chatClient.updateMessageArrayAndStoreIt(messageArray);\n }\n\n // checks whether the action was of an update type\n checkForUpdate(input: string) {\n return input === 'next';\n }\n\n private executeMiddlewares(\n entries: ServerEntry[],\n isUpdate: boolean,\n action?: string\n ): ServerEntry[] {\n if (isUpdate && action)\n entries = this.processor.processUpdate(StoreHelper.getEntry(action), entries);\n else {\n entries = this.processor.process(entries);\n }\n entries = this.paging.process(entries);\n\n return entries;\n }\n}\n","import { readStorage } from '@telia-ace/widget-services';\nimport { Container } from '@webprovisions/platform';\nimport { v4 as newGuid } from 'uuid';\nimport { Message } from '../contract/model/conversation-api-model/message.model';\nimport { ClientEnvelope } from '../contract/model/http/client-envelope.model';\nimport { HttpClientOptions } from '../contract/model/http/http-client-options.model';\nimport { ServerEnvelope } from '../contract/model/http/server-envelope.model';\nimport { ChatHelper } from '../helper/chat.helper';\nimport { HttpHelper } from '../helper/http.helper';\nimport { MiddlewareHelper } from '../helper/middleware.helper';\nimport { StoreHelper } from '../helper/store.helper';\nimport ChatClient from './chat.client';\nimport MiddlewareClient from './middleware.client';\n\nexport class HttpClient {\n private endpointUrl: string;\n private clientId: string | undefined;\n private projectionPath: string;\n private apiEndpoint: string;\n private options: HttpClientOptions;\n private middlewareClient: MiddlewareClient;\n private chatClient: ChatClient;\n private container: Container;\n\n constructor(endpoint: string, clientId: string, container: Container) {\n this.options = {\n credentials: HttpHelper.getCredentials(),\n clientId: clientId,\n };\n this.apiEndpoint = endpoint;\n this.projectionPath = window.location.href;\n this.endpointUrl = HttpHelper.combineUrl(this.projectionPath, 'conversations');\n this.clientId = this.options.clientId;\n this.middlewareClient = new MiddlewareClient(container);\n this.chatClient = new ChatClient(container);\n this.container = container;\n }\n\n async firstHit() {\n // On first hit if there are entries stored in the storage, use them\n // Otherwise start a new session\n const entries = (await MiddlewareHelper.getEntrySessionStorage()) as Message[];\n\n if (entries && entries.length > 0) {\n await StoreHelper.rehydrateState();\n\n const meta: any = await readStorage(this.container, 'bot-provider-conversation-meta');\n\n if (meta?.agent) {\n const agent = ChatHelper.getAgent();\n agent.update({\n name: meta.agent.name,\n avatar: meta.agent.avatar,\n });\n }\n\n await this.chatClient.processMessageArrayAndStoreIt(entries);\n } else {\n let envelope = this.constructFirstHitEnvelope();\n await this.postAndHandleTheData(envelope);\n }\n }\n\n // for updates, such as paging changes\n handleUpdate(action: string) {\n let envelope = this.constructInputEnvelope(action);\n return this.postAndHandleTheUpdateData(envelope, action);\n }\n\n // for action clicks\n handleInput(action: string) {\n let envelope = this.constructInputEnvelope(action);\n return this.postAndHandleTheData(envelope, action);\n }\n\n // for category burger\n handleCategories() {\n let envelope = this.constructCategoriesEnvelope();\n return this.postAndHandleTheData(envelope);\n }\n\n // for text entries by user\n handlePhrase(phrase: string) {\n const envelope = this.constructPhraseEnvelope(phrase);\n\n const id = newGuid();\n const entry = {\n id,\n type: 'Text',\n timestamp: new Date(),\n content: {\n $type: 'Humany.Matching.Bots.Conversations.Content.Text, Humany.Matching',\n html: `${phrase}`,\n },\n actions: {},\n tags: {},\n };\n\n const message = {\n id,\n message: ['html', { body: `<p>${phrase}</p>` }],\n entry,\n isUser: true,\n conversationEntry: {},\n };\n\n StoreHelper.insertMessageToStore(message);\n\n return this.postAndHandleTheData(envelope);\n }\n\n private postAndHandleTheData(envelope: ClientEnvelope, action?: string) {\n return fetch(this.apiEndpoint, this.getHttpOptions(envelope))\n .then((response) => {\n if (response.ok) return response.json();\n throw response;\n })\n .then((data) => {\n this.handleResponseData(data, action);\n })\n .catch((err) => console.log(err));\n }\n\n private postAndHandleTheUpdateData(envelope: ClientEnvelope, action?: string): Promise<any> {\n return fetch(this.apiEndpoint, this.getHttpOptions(envelope))\n .then((response) => {\n if (response.ok) return response.json();\n throw response;\n })\n .then((data) => {\n this.handleUpdateResponseData(data, action);\n })\n .catch((err) => console.log(err));\n }\n\n private getHttpOptions(envelope: ClientEnvelope) {\n return Object.assign({}, HttpHelper.fetchOptions, {\n body: JSON.stringify(envelope),\n credentials: <RequestCredentials>this.options.credentials,\n });\n }\n\n private constructInputEnvelope(action: string): ClientEnvelope {\n return {\n action: StoreHelper.getAction(action),\n localState: StoreHelper.getLocalState(action),\n globalState: StoreHelper.getGlobalState(),\n clientId: this.clientId,\n };\n }\n\n private constructCategoriesEnvelope(): ClientEnvelope {\n return {\n action: {\n content: {\n $type: 'Humany.Matching.Bots.Conversations.Actions.BrowseCategories, Humany.Matching',\n },\n key: 'browseCategories',\n },\n globalState: StoreHelper.getGlobalState(),\n clientId: this.clientId,\n };\n }\n\n private constructPhraseEnvelope(phrase: string): ClientEnvelope {\n return {\n command: { phrase: phrase },\n globalState: StoreHelper.getGlobalState(),\n clientId: this.clientId,\n };\n }\n\n private constructFirstHitEnvelope(): ClientEnvelope {\n return {\n command: { site: this.endpointUrl },\n clientId: this.clientId,\n globalState: {},\n };\n }\n\n private handleResponseData(envelope: ServerEnvelope, action?: string) {\n StoreHelper.setGlobalState(envelope.globalState);\n return this.middlewareClient.handleEntries(envelope.entries, action);\n }\n\n private handleUpdateResponseData(envelope: ServerEnvelope, action?: string) {\n return this.middlewareClient.handleUpdate(envelope.entries, action);\n }\n}\n","import { ContactMethodPlatform } from '@telia-ace/knowledge-widget-adapters';\nimport { DataClient } from '@telia-ace/knowledge-widget-types-grid';\nimport { ConversationPlatform } from '@telia-ace/widget-conversation';\nimport { Container } from '@webprovisions/platform';\nimport { v4 } from 'uuid';\nimport ChatClient from './client/chat.client';\nimport { ContactMethodClient } from './client/contact-method.client';\nimport { HttpClient } from './client/http.client';\nimport MiddlewareClient from './client/middleware.client';\nimport { getContactMethodEntry } from './utils';\n\nconst getKnowledgeBotEndpoint = (\n container: Container,\n component: any /*: ComponentNodeController */\n // ComponentNodeController type differs from component passed into registerProvider\n) => {\n const { knowledgeBotEndpoint } = component.properties();\n\n if (knowledgeBotEndpoint) {\n return `${knowledgeBotEndpoint}/conversations`;\n }\n\n const { data } = container.get('$settings');\n\n if (!data || !data.projection) throw new Error('Missing Knowledge Bot endpoint');\n\n return `${data.projection}/conversations`;\n};\n\nconst KnowledgeBotProviderPlugin = async (container: Container) => {\n const dataClient = await DataClient.getInstance(container);\n const platform = await ConversationPlatform.getInstance(container);\n const contactMethodPlatform = await ContactMethodPlatform.getInstance(container);\n\n platform.registerConversationItem(\n 'ace-knowledge-contact-method',\n import('./contract/custom-component/contact-method')\n );\n\n platform.registerConversationItem('no-good-alternative', import('./ui/no-good-alternative'));\n\n platform.registerConversationItem('feedback-list', import('./ui/feedback-list'));\n\n platform.registerProvider('chat.bot', (conversation, component) => {\n const endpoint = getKnowledgeBotEndpoint(container, component);\n\n const clientId = v4();\n\n const agent = conversation.createAgent({\n name: '',\n avatar: undefined,\n });\n\n // passes the user and the agent to the Chat Helper\n ChatClient.initialize(conversation.user, agent);\n\n // passes the conversation provider to the Contact Method Client\n ContactMethodClient.initialize(container, dataClient, contactMethodPlatform, agent);\n\n // passes the container and the widget to the Middleware Store\n MiddlewareClient.initialize(container, container.get('$widget'));\n\n // executes to decide on what to do on first load\n const httpClient = new HttpClient(endpoint, clientId, container);\n\n const firstLoader = conversation.loading();\n httpClient.firstHit().then(firstLoader);\n\n component.actions.create(\n 'expand',\n (input: { entryId: string; contactMethodId: string }) => {\n const cmClient = new ContactMethodClient(container);\n cmClient.expandContactMethod(input);\n }\n );\n\n component.actions.create('evaluate', (input) => {\n const cmClient = new ContactMethodClient(container);\n cmClient.handleNewForm(input.form, input.form.id);\n });\n component.actions.create('validate', (input) => {\n const cmClient = new ContactMethodClient(container);\n cmClient.validate(input.form);\n });\n component.actions.create('submit', (input) => {\n if (input?.form?.schema.id) {\n const contactMethodEntry = getContactMethodEntry(input.form.schema.id);\n }\n const cmClient = new ContactMethodClient(container);\n cmClient.validate(input.form);\n });\n\n component.actions.watch('conversation.user-typing', (input, next) => {\n return next(input);\n });\n\n component.actions.watch('conversation.user-submit', (input, next) => {\n const httpClient = new HttpClient(endpoint, clientId, container);\n const loader = conversation.loading();\n httpClient.handlePhrase(input.text).then(loader);\n return next(input);\n });\n\n component.actions.watch('conversation.form', (input, next) => {\n return next(input);\n });\n\n component.actions.watch('conversation.action', (input, next) => {\n const chatClient = new ChatClient(container);\n const cmClient = new ContactMethodClient(container);\n // if (input === 'contact' || input.split('/').length > 1) {\n // cmClient.handleContactMethod(input);\n // return next(input);\n // }\n const loader = conversation.loading();\n\n if (input.split('/').length > 1) {\n cmClient.handleContactMethod(input).then(loader);\n return next(input);\n }\n\n const httpClient = new HttpClient(endpoint, clientId, container);\n\n if (input == 'burger-clicked') {\n httpClient.handleCategories().then(loader);\n return next(input);\n }\n\n const middlewareClient = new MiddlewareClient(container);\n // this is an update check, as it requires\n // a lot different logic and no user message\n if (middlewareClient.checkForUpdate(input)) {\n httpClient.handleUpdate(input).then(loader);\n\n return next(input);\n }\n\n chatClient.printUserMessageAndStoreIt(input);\n\n httpClient.handleInput(input).then(loader);\n\n return next(input);\n });\n });\n};\n\nexport default KnowledgeBotProviderPlugin;\n"],"names":["uuidv4","newGuid"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAY,IAAA,wCAAA,yBAAL;AACH,uBAAA,qBAAA,YAAA,KAAA;AACA,uBAAA,qBAAA,UAAA,KAAA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L;;"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
3
|
-
import { ServerEntry } from '../contract/model/http/server-entry.model';
|
|
4
|
-
export default class EntryInterface {
|
|
5
|
-
private container;
|
|
6
|
-
private helpActionKey;
|
|
7
|
-
private nextActionKey;
|
|
8
|
-
constructor(container: Container);
|
|
9
|
-
transform(entry: ServerEntry, feedbackEntry?: ServerEntry): Promise<Message | undefined>;
|
|
10
|
-
transformContactMethod(entry: ServerEntry): Promise<any>;
|
|
11
|
-
transformArray(entryArray: ServerEntry[]): Promise<Message[]>;
|
|
12
|
-
getUserMessage(action: string): string | undefined;
|
|
13
|
-
private listTransform;
|
|
14
|
-
private getContentText;
|
|
15
|
-
private textTransform;
|
|
16
|
-
private getListActions;
|
|
17
|
-
private getListType;
|
|
18
|
-
private getTitleFromEntry;
|
|
19
|
-
private getTitleFromList;
|
|
20
|
-
}
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
3
|
+
import { ServerEntry } from '../contract/model/http/server-entry.model';
|
|
4
|
+
export default class EntryInterface {
|
|
5
|
+
private container;
|
|
6
|
+
private helpActionKey;
|
|
7
|
+
private nextActionKey;
|
|
8
|
+
constructor(container: Container);
|
|
9
|
+
transform(entry: ServerEntry, feedbackEntry?: ServerEntry): Promise<Message | undefined>;
|
|
10
|
+
transformContactMethod(entry: ServerEntry): Promise<any>;
|
|
11
|
+
transformArray(entryArray: ServerEntry[]): Promise<Message[]>;
|
|
12
|
+
getUserMessage(action: string): string | undefined;
|
|
13
|
+
private listTransform;
|
|
14
|
+
private getContentText;
|
|
15
|
+
private textTransform;
|
|
16
|
+
private getListActions;
|
|
17
|
+
private getListType;
|
|
18
|
+
private getTitleFromEntry;
|
|
19
|
+
private getTitleFromList;
|
|
20
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerEntry } from "../../contract/model/http/server-entry.model";
|
|
2
|
-
export default class PagingInterface {
|
|
3
|
-
process(entries: ServerEntry[]): ServerEntry[];
|
|
4
|
-
}
|
|
1
|
+
import { ServerEntry } from "../../contract/model/http/server-entry.model";
|
|
2
|
+
export default class PagingInterface {
|
|
3
|
+
process(entries: ServerEntry[]): ServerEntry[];
|
|
4
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ServerEntry } from '../../contract/model/http/server-entry.model';
|
|
2
|
-
export default class ProcessorInterface {
|
|
3
|
-
process(entries: ServerEntry[]): ServerEntry[];
|
|
4
|
-
processUpdate(entry: ServerEntry | undefined, updateEntryArray: ServerEntry[]): ServerEntry[];
|
|
5
|
-
private handleActionUpdateOrInsert;
|
|
6
|
-
private deletePaging;
|
|
7
|
-
private delete;
|
|
8
|
-
private merge;
|
|
9
|
-
private moveLoader;
|
|
10
|
-
}
|
|
1
|
+
import { ServerEntry } from '../../contract/model/http/server-entry.model';
|
|
2
|
+
export default class ProcessorInterface {
|
|
3
|
+
process(entries: ServerEntry[]): ServerEntry[];
|
|
4
|
+
processUpdate(entry: ServerEntry | undefined, updateEntryArray: ServerEntry[]): ServerEntry[];
|
|
5
|
+
private handleActionUpdateOrInsert;
|
|
6
|
+
private deletePaging;
|
|
7
|
+
private delete;
|
|
8
|
+
private merge;
|
|
9
|
+
private moveLoader;
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useDispatch, SymbolBadge } from "@telia-ace/knowledge-widget-ui";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
const NoGoodAlternative = ({ body }) => {
|
|
5
|
+
const dispatch = useDispatch();
|
|
6
|
+
return /* @__PURE__ */ React.createElement(Wrapper, {
|
|
7
|
+
onClick: () => {
|
|
8
|
+
dispatch("action", "help");
|
|
9
|
+
}
|
|
10
|
+
}, /* @__PURE__ */ React.createElement(SymbolBadge, {
|
|
11
|
+
size: 14,
|
|
12
|
+
symbol: {
|
|
13
|
+
type: "FontAwesome",
|
|
14
|
+
content: "meh-o"
|
|
15
|
+
}
|
|
16
|
+
}), /* @__PURE__ */ React.createElement("span", null, body));
|
|
17
|
+
};
|
|
18
|
+
const Wrapper = styled.div`
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
|
|
24
|
+
> i,
|
|
25
|
+
svg {
|
|
26
|
+
margin-right: ${(p) => {
|
|
27
|
+
var _a;
|
|
28
|
+
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
29
|
+
}};
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
export { NoGoodAlternative as default };
|
|
33
|
+
//# sourceMappingURL=no-good-alternative.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-good-alternative.js","sources":["../src/ui/no-good-alternative.tsx"],"sourcesContent":["import { SymbolBadge, useDispatch } from '@telia-ace/knowledge-widget-ui';\nimport React from 'react';\nimport styled from 'styled-components';\n\ntype Props = {\n body: string;\n};\nconst NoGoodAlternative: React.FC<Props> = ({ body }) => {\n const dispatch = useDispatch();\n return (\n <Wrapper\n onClick={() => {\n dispatch('action', 'help');\n }}\n >\n <SymbolBadge\n size={14}\n symbol={{\n type: 'FontAwesome',\n content: 'meh-o',\n }}\n />\n <span>{body}</span>\n </Wrapper>\n );\n};\n\nexport default NoGoodAlternative;\n\nconst Wrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n\n > i,\n svg {\n margin-right: ${(p) => p.theme.sizes?.small};\n }\n`;\n"],"names":[],"mappings":";;;AAOM,MAAA,oBAAqC,CAAC,EAAE,WAAW;AACrD,QAAM,WAAW;AACjB,SACK,sBAAA,cAAA,SAAA;AAAA,IACG,SAAS,MAAM;AACX,eAAS,UAAU,MAAM;AAAA,IAC7B;AAAA,EAAA,GAEC,sBAAA,cAAA,aAAA;AAAA,IACG,MAAM;AAAA,IACN,QAAQ;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,IACb;AAAA,EAAA,CACJ,GACA,sBAAA,cAAC,QAAM,MAAA,IAAK,CAChB;AAER;AAIA,MAAM,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAQC,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;AAAA;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
declare const KnowledgeBotProviderPlugin: (container: Container) => Promise<void>;
|
|
3
|
-
export default KnowledgeBotProviderPlugin;
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
declare const KnowledgeBotProviderPlugin: (container: Container) => Promise<void>;
|
|
3
|
+
export default KnowledgeBotProviderPlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const getContactMethodEntry: (contactMethodId: string) => import("./contract/model/http/server-entry.model").ServerEntry | undefined;
|
|
2
|
-
export declare const contactMethodFromLegacy: ({ id, title, defaultIcon, exits: [exit], exitType, confirmationText, expandFormAutomatically, form, description, }: any, validation?: any) => any;
|
|
1
|
+
export declare const getContactMethodEntry: (contactMethodId: string) => import("./contract/model/http/server-entry.model").ServerEntry | undefined;
|
|
2
|
+
export declare const contactMethodFromLegacy: ({ id, title, defaultIcon, exits: [exit], exitType, confirmationText, expandFormAutomatically, form, description, }: any, validation?: any) => any;
|
package/package.json
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-bot-provider",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.49",
|
|
4
4
|
"description": "Bot Provider Plugin ACE Knowledge Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"telia"
|
|
9
9
|
],
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"module": "dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
12
|
"files": [
|
|
13
13
|
"LICENSE.txt",
|
|
14
14
|
"README.md",
|
|
15
|
-
"
|
|
16
|
-
"lib-esm/"
|
|
15
|
+
"dist/"
|
|
17
16
|
],
|
|
18
17
|
"publishConfig": {
|
|
19
18
|
"access": "public"
|
|
20
19
|
},
|
|
21
20
|
"scripts": {
|
|
22
|
-
"clean": "
|
|
23
|
-
"
|
|
21
|
+
"clean": "rimraf ./dist",
|
|
22
|
+
"precompile": "tsc -emitDeclarationOnly",
|
|
23
|
+
"compile": "vite build"
|
|
24
24
|
},
|
|
25
25
|
"sideEffects": false,
|
|
26
|
-
"typings": "lib/index.d.ts",
|
|
27
26
|
"dependencies": {
|
|
28
|
-
"@telia-ace/knowledge-widget-adapters": "^1.0.
|
|
29
|
-
"@telia-ace/knowledge-widget-types-grid": "^1.0.
|
|
30
|
-
"@telia-ace/knowledge-widget-ui": "^1.0.
|
|
31
|
-
"@telia-ace/widget-conversation": "^1.0.
|
|
32
|
-
"@telia-ace/widget-forms": "^1.0.
|
|
33
|
-
"@telia-ace/widget-services": "^1.0.
|
|
27
|
+
"@telia-ace/knowledge-widget-adapters": "^1.0.16",
|
|
28
|
+
"@telia-ace/knowledge-widget-types-grid": "^1.0.16",
|
|
29
|
+
"@telia-ace/knowledge-widget-ui": "^1.0.13",
|
|
30
|
+
"@telia-ace/widget-conversation": "^1.0.15",
|
|
31
|
+
"@telia-ace/widget-forms": "^1.0.11",
|
|
32
|
+
"@telia-ace/widget-services": "^1.0.7",
|
|
34
33
|
"@webprovisions/bootstrapping": "^1.0.12",
|
|
35
34
|
"uuid": "^8.3.2"
|
|
36
35
|
},
|
|
@@ -41,5 +40,5 @@
|
|
|
41
40
|
"devDependencies": {
|
|
42
41
|
"@types/uuid": "^8.3.4"
|
|
43
42
|
},
|
|
44
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "a8bf8e5c1ca56a4749cd8ec47f756b13431394b4"
|
|
45
44
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
import { Message } from '../contract/model/conversation-api-model/message.model';
|
|
3
|
-
import EntryInterface from '../interface/entry.interface';
|
|
4
|
-
export default class ChatClient {
|
|
5
|
-
entryInterface: EntryInterface;
|
|
6
|
-
constructor(container: Container);
|
|
7
|
-
static initialize(user: any, agent: any): void;
|
|
8
|
-
processMessageArrayAndStoreIt(messages: Message[]): Promise<void>;
|
|
9
|
-
updateMessageArrayAndStoreIt(messages: Message[]): void;
|
|
10
|
-
printUserMessageAndStoreIt(action: string): void;
|
|
11
|
-
private postUserMessage;
|
|
12
|
-
private postAgentMessage;
|
|
13
|
-
private getTitleFromEntry;
|
|
14
|
-
private getTitleFromText;
|
|
15
|
-
private getTitleFromList;
|
|
16
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (_) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var __values = (this && this.__values) || function(o) {
|
|
38
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
39
|
-
if (m) return m.call(o);
|
|
40
|
-
if (o && typeof o.length === "number") return {
|
|
41
|
-
next: function () {
|
|
42
|
-
if (o && i >= o.length) o = void 0;
|
|
43
|
-
return { value: o && o[i++], done: !o };
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
47
|
-
};
|
|
48
|
-
import { v4 as newGuid } from 'uuid';
|
|
49
|
-
import { ServerEntryTypeEnum } from '../contract/enum/server-entry-type.enum';
|
|
50
|
-
import { ChatHelper } from '../helper/chat.helper';
|
|
51
|
-
import { StoreHelper } from '../helper/store.helper';
|
|
52
|
-
import EntryInterface from '../interface/entry.interface';
|
|
53
|
-
var ChatClient = /** @class */ (function () {
|
|
54
|
-
function ChatClient(container) {
|
|
55
|
-
this.entryInterface = new EntryInterface(container);
|
|
56
|
-
}
|
|
57
|
-
// Initialize from setting the user and agent for the Helper
|
|
58
|
-
ChatClient.initialize = function (user, agent) {
|
|
59
|
-
ChatHelper.setUser(user);
|
|
60
|
-
ChatHelper.setAgent(agent);
|
|
61
|
-
};
|
|
62
|
-
// function for posting the messages
|
|
63
|
-
ChatClient.prototype.processMessageArrayAndStoreIt = function (messages) {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
-
var _a, _b, message;
|
|
66
|
-
var e_1, _c;
|
|
67
|
-
return __generator(this, function (_d) {
|
|
68
|
-
switch (_d.label) {
|
|
69
|
-
case 0:
|
|
70
|
-
try {
|
|
71
|
-
for (_a = __values(messages.filter(function (o) { return o && o != null && !!o.message; })), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
72
|
-
message = _b.value;
|
|
73
|
-
if (message.isUser)
|
|
74
|
-
this.postUserMessage(message);
|
|
75
|
-
else
|
|
76
|
-
this.postAgentMessage(message);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
80
|
-
finally {
|
|
81
|
-
try {
|
|
82
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
83
|
-
}
|
|
84
|
-
finally { if (e_1) throw e_1.error; }
|
|
85
|
-
}
|
|
86
|
-
return [4 /*yield*/, StoreHelper.insertOrUpdateMessageArrayStore(messages)];
|
|
87
|
-
case 1:
|
|
88
|
-
_d.sent();
|
|
89
|
-
return [2 /*return*/];
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
// function for updating current messages
|
|
95
|
-
ChatClient.prototype.updateMessageArrayAndStoreIt = function (messages) {
|
|
96
|
-
var conversationEntry = undefined;
|
|
97
|
-
messages.forEach(function (o) {
|
|
98
|
-
var message = StoreHelper.getMessage(o.id);
|
|
99
|
-
message === null || message === void 0 ? void 0 : message.conversationEntry.update(o.message);
|
|
100
|
-
conversationEntry = message === null || message === void 0 ? void 0 : message.conversationEntry;
|
|
101
|
-
});
|
|
102
|
-
StoreHelper.insertOrUpdateMessageArrayStore(messages, conversationEntry);
|
|
103
|
-
};
|
|
104
|
-
// function for posting a message for the user actions, such as button clicks
|
|
105
|
-
ChatClient.prototype.printUserMessageAndStoreIt = function (action) {
|
|
106
|
-
if (action == 'next' || action == 'help')
|
|
107
|
-
return;
|
|
108
|
-
var entry = StoreHelper.getEntry(action);
|
|
109
|
-
var message = {
|
|
110
|
-
id: newGuid(),
|
|
111
|
-
message: !entry ? action : this.getTitleFromEntry(entry, action),
|
|
112
|
-
isUser: true,
|
|
113
|
-
};
|
|
114
|
-
this.postUserMessage(message);
|
|
115
|
-
StoreHelper.insertOrUpdateMessageArrayStore([message]);
|
|
116
|
-
};
|
|
117
|
-
ChatClient.prototype.postUserMessage = function (message) {
|
|
118
|
-
ChatHelper.getUser().print(message.message);
|
|
119
|
-
};
|
|
120
|
-
ChatClient.prototype.postAgentMessage = function (message) {
|
|
121
|
-
message.conversationEntry = ChatHelper.getAgent().print(message.message);
|
|
122
|
-
};
|
|
123
|
-
ChatClient.prototype.getTitleFromEntry = function (entry, action) {
|
|
124
|
-
var entryType = ServerEntryTypeEnum[entry.type];
|
|
125
|
-
switch (entryType) {
|
|
126
|
-
case ServerEntryTypeEnum.List:
|
|
127
|
-
return this.getTitleFromList(entry, action);
|
|
128
|
-
case ServerEntryTypeEnum.Text:
|
|
129
|
-
return this.getTitleFromText(entry, action);
|
|
130
|
-
default:
|
|
131
|
-
return '';
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
ChatClient.prototype.getTitleFromText = function (entry, action) {
|
|
135
|
-
if (!!entry.content.items)
|
|
136
|
-
return this.getTitleFromList(entry, action);
|
|
137
|
-
else
|
|
138
|
-
return entry.content.html;
|
|
139
|
-
};
|
|
140
|
-
ChatClient.prototype.getTitleFromList = function (entry, action) {
|
|
141
|
-
return entry.content.items.find(function (o) { return o.actionKey == action; }).title;
|
|
142
|
-
};
|
|
143
|
-
return ChatClient;
|
|
144
|
-
}());
|
|
145
|
-
export default ChatClient;
|