@cognigy/rest-api-client 0.11.0 → 0.13.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/.eslintignore +15 -0
- package/.eslintrc.json +28 -0
- package/.prettierrc.json +7 -0
- package/.snyk +1 -1
- package/build/GenericAPIFn.js +3 -3
- package/build/GenericUploadFn.js +8 -5
- package/build/PluginBase.js +1 -1
- package/build/RestAPIClient.js +15 -1
- package/build/apigroups/AdministrationAPIGroup_2_0.js +68 -40
- package/build/apigroups/AnalyticsAPIGroup_2_0.js +12 -0
- package/build/apigroups/ExternalAPIGroup_2_0.js +5 -5
- package/build/apigroups/InsightsAPIGroup_2_0.js +58 -0
- package/build/apigroups/ManagementAPIGroup_2_0.js +19 -15
- package/build/apigroups/MetricsAPIGroup_2_0.js +29 -29
- package/build/apigroups/ResourcesAPIGroup_2_0.js +250 -177
- package/build/apigroups/SessionsAPIGroup_2_0.js +7 -7
- package/build/apigroups/index.js +5 -1
- package/build/authentication/ApiKey/ApiKeyAuthentication.js +1 -1
- package/build/authentication/AuthenticationAPI.js +2 -2
- package/build/authentication/BasicAuthentication/BasicAuthentication.js +9 -2
- package/build/authentication/OAuth2/ILoginByClientCredentialsParameters.js +3 -0
- package/build/authentication/OAuth2/IOAuth2ClientCredentialsGrantAccessTokenRequest.js +11 -0
- package/build/authentication/OAuth2/IOAuth2ErrorResponse.js +1 -1
- package/build/authentication/OAuth2/OAuth2Authentication.js +67 -34
- package/build/connector/AxiosAdapter.js +28 -24
- package/build/connector/isRetryAllowed.js +0 -1
- package/build/connector/retryAfterDelay.js +3 -3
- package/build/shared/{interfaces/restAPI/administration/user/v2.0/IDeleteUserMeRest_2_0.js → api/liveAgent/liveAgentInterfaces.js} +1 -1
- package/build/shared/charts/createNodeDescriptor.js +1 -1
- package/build/shared/charts/descriptors/allFields.js +1 -1
- package/build/shared/charts/descriptors/{profile → analytics}/activateProfile.js +2 -2
- package/build/shared/charts/descriptors/{profile → analytics}/blindMode.js +11 -4
- package/build/shared/charts/descriptors/{profile → analytics}/completeGoal.js +2 -2
- package/build/shared/charts/descriptors/{profile → analytics}/deactivateProfile.js +2 -2
- package/build/shared/charts/descriptors/{profile → analytics}/deleteProfile.js +2 -2
- package/build/shared/charts/descriptors/{profile → analytics}/index.js +5 -1
- package/build/shared/charts/descriptors/{profile → analytics}/mergeProfile.js +2 -2
- package/build/shared/charts/descriptors/{profile → analytics}/overwriteAnalytics.js +59 -4
- package/build/shared/charts/descriptors/analytics/requestRating.js +57 -0
- package/build/shared/charts/descriptors/analytics/setRating.js +39 -0
- package/build/shared/charts/descriptors/{profile → analytics}/updateProfile.js +2 -2
- package/build/shared/charts/descriptors/apps/getAppSessionPin.js +46 -0
- package/build/shared/charts/descriptors/apps/index.js +14 -0
- package/build/shared/charts/descriptors/apps/initAppSession.js +488 -0
- package/build/shared/charts/descriptors/apps/setAdaptiveCardAppState.js +79 -0
- package/build/shared/charts/descriptors/apps/setAppState.js +44 -0
- package/build/shared/charts/descriptors/apps/setHtmlAppState.js +108 -0
- package/build/shared/charts/descriptors/connectionNodes/internalStorageProviders/amazonStorageProviderConnection.js +14 -0
- package/build/shared/charts/descriptors/connectionNodes/internalStorageProviders/azureBlobStorageProviderConnection.js +13 -0
- package/build/shared/charts/descriptors/connectionNodes/internalStorageProviders/googleCloudStorageProviderConnection.js +13 -0
- package/build/shared/charts/descriptors/connectionNodes/internalStorageProviders/index.js +23 -0
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/aggregate.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/find.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/findOne.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/index.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/insert.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/remove.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/updateMany.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/mongoDB/updateOne.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/smtp/emailNotification.js +8 -6
- package/build/shared/charts/descriptors/connectionNodes/smtp/index.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/smtp/sendEmail.js +4 -4
- package/build/shared/charts/descriptors/connectionNodes/sql/index.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/sql/runQuery.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/sql/runStoredProcedure.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/sql/runTransaction.js +1 -1
- package/build/shared/charts/descriptors/data/addToContext.js +1 -1
- package/build/shared/charts/descriptors/data/code.js +1 -1
- package/build/shared/charts/descriptors/data/copyDataToContext.js +1 -1
- package/build/shared/charts/descriptors/data/copySlotsToContext.js +1 -1
- package/build/shared/charts/descriptors/data/log.js +1 -1
- package/build/shared/charts/descriptors/data/removeFromContext.js +1 -1
- package/build/shared/charts/descriptors/data/resetContext.js +1 -1
- package/build/shared/charts/descriptors/end.js +2 -1
- package/build/shared/charts/descriptors/index.js +98 -70
- package/build/shared/charts/descriptors/liveAgent/assistInfo.js +195 -0
- package/build/shared/charts/descriptors/liveAgent/index.js +6 -0
- package/build/shared/charts/descriptors/liveAgent/utils/buildCognigyWhisperAssistResponse.js +135 -0
- package/build/shared/charts/descriptors/liveAgent/utils/index.js +6 -0
- package/build/shared/charts/descriptors/logic/disableSlotFillers.js +1 -1
- package/build/shared/charts/descriptors/logic/enableSlotFillers.js +1 -1
- package/build/shared/charts/descriptors/logic/executeFlow.js +1 -1
- package/build/shared/charts/descriptors/logic/goTo.js +2 -1
- package/build/shared/charts/descriptors/logic/if/else.js +3 -1
- package/build/shared/charts/descriptors/logic/if/if.js +3 -2
- package/build/shared/charts/descriptors/logic/if/then.js +3 -1
- package/build/shared/charts/descriptors/logic/index.js +5 -3
- package/build/shared/charts/descriptors/logic/interval/elseInterval.js +2 -1
- package/build/shared/charts/descriptors/logic/interval/interval.js +1 -1
- package/build/shared/charts/descriptors/logic/interval/onInterval.js +2 -1
- package/build/shared/charts/descriptors/logic/once/afterwards.js +2 -1
- package/build/shared/charts/descriptors/logic/once/onFirstExecution.js +2 -1
- package/build/shared/charts/descriptors/logic/once/once.js +1 -1
- package/build/shared/charts/descriptors/logic/resetState.js +1 -1
- package/build/shared/charts/descriptors/logic/setState.js +1 -1
- package/build/shared/charts/descriptors/logic/setTranslation.js +88 -0
- package/build/shared/charts/descriptors/logic/sleep.js +1 -1
- package/build/shared/charts/descriptors/logic/stop.js +1 -1
- package/build/shared/charts/descriptors/logic/switch/case.js +3 -1
- package/build/shared/charts/descriptors/logic/switch/default.js +3 -1
- package/build/shared/charts/descriptors/logic/switch/switch.js +74 -12
- package/build/shared/charts/descriptors/logic/switchLocale.js +31 -3
- package/build/shared/charts/descriptors/logic/think.js +8 -4
- package/build/shared/charts/descriptors/logic/thinkV2.js +104 -0
- package/build/shared/charts/descriptors/logic/wait.js +3 -10
- package/build/shared/charts/descriptors/message/checkChannelChange/checkChannelChange.js +2 -1
- package/build/shared/charts/descriptors/message/checkChannelChange/onNo.js +4 -2
- package/build/shared/charts/descriptors/message/checkChannelChange/onYes.js +4 -2
- package/build/shared/charts/descriptors/message/checkChannelChange/unchanged.js +4 -2
- package/build/shared/charts/descriptors/message/datePicker.js +5 -5
- package/build/shared/charts/descriptors/message/question/onAnswer.js +4 -2
- package/build/shared/charts/descriptors/message/question/onQuestion.js +4 -2
- package/build/shared/charts/descriptors/message/question/optionalQuestion.js +2 -2
- package/build/shared/charts/descriptors/message/question/question.js +655 -60
- package/build/shared/charts/descriptors/message/question/utils/datepickerUtils.js +32 -2
- package/build/shared/charts/descriptors/message/question/utils/evaluateQuestionAnswer.js +12 -3
- package/build/shared/charts/descriptors/message/question/utils/generateAnswerShortForm.js +37 -0
- package/build/shared/charts/descriptors/message/question/utils/getQuestionText.js +36 -0
- package/build/shared/charts/descriptors/message/question/utils/questionHandover.js +13 -0
- package/build/shared/charts/descriptors/message/question/utils/resetNodeState.js +12 -0
- package/build/shared/charts/descriptors/message/question/utils/storeQuestionAnswer.js +30 -0
- package/build/shared/charts/descriptors/message/question/utils/validateQuestionAnswer.js +22 -0
- package/build/shared/charts/descriptors/message/say.js +10 -4
- package/build/shared/charts/descriptors/message/sendImage.js +1 -1
- package/build/shared/charts/descriptors/message/sendText.js +1 -1
- package/build/shared/charts/descriptors/microsoft/getToken.js +34 -0
- package/build/shared/charts/descriptors/microsoft/index.js +22 -0
- package/build/shared/charts/descriptors/microsoft/invalidateToken.js +29 -0
- package/build/shared/charts/descriptors/microsoft/tokenStatus/index.js +51 -0
- package/build/shared/charts/descriptors/microsoft/tokenStatus/tokenGranted.js +24 -0
- package/build/shared/charts/descriptors/microsoft/tokenStatus/tokenNotGranted.js +24 -0
- package/build/shared/charts/descriptors/microsoft/utils/design.js +5 -0
- package/build/shared/charts/descriptors/nlu/addLexiconKeyphrase.js +1 -1
- package/build/shared/charts/descriptors/nlu/executeCognigyNLU.js +23 -3
- package/build/shared/charts/descriptors/nlu/extractAnswer.js +115 -0
- package/build/shared/charts/descriptors/nlu/fuzzySearch.js +270 -0
- package/build/shared/charts/descriptors/nlu/index.js +7 -1
- package/build/shared/charts/descriptors/nlu/matchPattern.js +113 -0
- package/build/shared/charts/descriptors/nlu/regexSlotFiller.js +1 -1
- package/build/shared/charts/descriptors/nlu/utils/patternMatcher.js +265 -0
- package/build/shared/charts/descriptors/placeholder.js +1 -1
- package/build/shared/charts/descriptors/requiredFields.js +1 -1
- package/build/shared/charts/descriptors/service/checkAgentAvailability.js +203 -0
- package/build/shared/charts/descriptors/service/handover.js +30 -3
- package/build/shared/charts/descriptors/service/handoverV2.js +192 -0
- package/build/shared/charts/descriptors/service/httpRequest.js +40 -10
- package/build/shared/charts/descriptors/service/index.js +5 -1
- package/build/shared/charts/descriptors/service/triggerFunction/onScheduled.js +3 -1
- package/build/shared/charts/descriptors/service/triggerFunction/onSchedulingError.js +3 -1
- package/build/shared/charts/descriptors/service/triggerFunction/triggerFunction.js +1 -1
- package/build/shared/charts/descriptors/start.js +2 -1
- package/build/shared/charts/descriptors/voice/index.js +20 -0
- package/build/shared/charts/descriptors/voice/interface/IAudioCodes.js +3 -0
- package/build/shared/charts/descriptors/voice/interface/IVoiceGateway2.js +3 -0
- package/build/shared/charts/descriptors/voice/mappers/hangup.mapper.js +59 -0
- package/build/shared/charts/descriptors/voice/mappers/play.mapper.js +99 -0
- package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +296 -0
- package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +86 -0
- package/build/shared/charts/descriptors/voice/nodes/bargeIn.js +60 -0
- package/build/shared/charts/descriptors/voice/nodes/continuousAsr.js +72 -0
- package/build/shared/charts/descriptors/voice/nodes/dtmf.js +86 -0
- package/build/shared/charts/descriptors/voice/nodes/hangup.js +48 -0
- package/build/shared/charts/descriptors/voice/nodes/noUserInput.js +105 -0
- package/build/shared/charts/descriptors/voice/nodes/play.js +95 -0
- package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +105 -0
- package/build/shared/charts/descriptors/voice/nodes/transfer.js +114 -0
- package/build/shared/charts/descriptors/voice/utils/constants.js +8 -0
- package/build/shared/charts/descriptors/voice/utils/design.js +5 -0
- package/build/shared/charts/descriptors/voice/utils/helper.js +11 -0
- package/build/shared/charts/descriptors/voicegateway/index.js +1 -1
- package/build/shared/charts/descriptors/voicegateway/nodes/agentAssist.js +1 -1
- package/build/shared/charts/descriptors/voicegateway/nodes/callRecording.js +37 -17
- package/build/shared/charts/descriptors/voicegateway/nodes/handover.js +20 -34
- package/build/shared/charts/descriptors/voicegateway/nodes/hangup.js +11 -20
- package/build/shared/charts/descriptors/voicegateway/nodes/playURL.js +23 -29
- package/build/shared/charts/descriptors/voicegateway/nodes/sendMessage.js +5 -5
- package/build/shared/charts/descriptors/voicegateway/nodes/sendMetaData.js +1 -1
- package/build/shared/charts/descriptors/voicegateway/nodes/setSessionParams.js +4 -4
- package/build/shared/charts/descriptors/voicegateway/utils/paramUtils.js +34 -6
- package/build/shared/charts/descriptors/voicegateway2/index.js +25 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/dtmf.js +60 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/hangup.js +46 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +113 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/refer.js +103 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/sendMetadata.js +64 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +354 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +99 -0
- package/build/shared/charts/descriptors/voicegateway2/utils/constants.js +7 -0
- package/build/shared/charts/descriptors/voicegateway2/utils/design.js +5 -0
- package/build/shared/charts/descriptors/voicegateway2/utils/helper.js +39 -0
- package/build/shared/charts/descriptors/voicegateway2/utils/strip-nulls.js +19 -0
- package/build/shared/constants.js +11 -1
- package/build/shared/errors/baseError.js +35 -2
- package/build/shared/handoverClients/interfaces/TAnyProviderResponse.js +3 -0
- package/build/shared/handoverClients/interfaces/THandoverEventType.js +12 -0
- package/build/shared/helper/BaseContext.js +1 -1
- package/build/shared/helper/defaultDatepickerFunction.js +13 -0
- package/build/shared/helper/rest/array.js +19 -0
- package/build/shared/helper/rest/boolean.js +5 -1
- package/build/shared/helper/rest/index.js +4 -1
- package/build/shared/helper/rest/query-string/index.js +5 -5
- package/build/shared/helper/rest/query.js +0 -0
- package/build/shared/interfaces/IApiKey.js +1 -1
- package/build/shared/interfaces/IEndpointTranslationSettings.js +32 -0
- package/build/shared/interfaces/IHandoverRequestStatus.js +3 -0
- package/build/shared/interfaces/IHttpRequest.js +3 -0
- package/build/shared/interfaces/IOrganisation.js +22 -3
- package/build/shared/interfaces/IProfile.js +1 -1
- package/build/shared/interfaces/ISayNodeSettings.js +3 -0
- package/build/shared/interfaces/TEntrypointType.js +2 -0
- package/build/shared/interfaces/ai.js +0 -1
- package/build/shared/interfaces/amazonLexV2Interface.js +3 -0
- package/build/shared/interfaces/amqpInterface.js +4 -1
- package/build/shared/interfaces/analytics/IAnalyticsFlowHistoryData.js +3 -0
- package/build/shared/interfaces/analytics/IAnalyticsRating.js +13 -0
- package/build/shared/interfaces/analytics/IAnalyticsSourceData.js +196 -45
- package/build/shared/interfaces/analytics/IStepEvent.js +4 -1
- package/build/shared/interfaces/analytics/TAnalyticsMode.js +10 -0
- package/build/shared/interfaces/analytics/TAnalyticsType.js +5 -0
- package/build/shared/interfaces/debugEvents/IErrorEventPayload.js +3 -0
- package/build/shared/interfaces/debugEvents/TDebugEndpointEvent.js +1 -0
- package/build/shared/interfaces/debugEvents/TDebugEventType.js +2 -1
- package/build/shared/interfaces/fileStorage.js +23 -0
- package/build/shared/interfaces/handover.js +151 -3
- package/build/shared/interfaces/journeys/IJourney.js +1 -1
- package/build/shared/interfaces/license.js +34 -0
- package/build/shared/interfaces/license.js.map +1 -0
- package/build/shared/interfaces/management/deleteOrganisation/deleteOrganisationTypes.js +3 -0
- package/build/shared/interfaces/messageAPI/ai.js +15 -1
- package/build/shared/interfaces/messageAPI/analytics.js +3 -0
- package/build/shared/interfaces/messageAPI/endpoints.js +361 -11
- package/build/shared/interfaces/messageAPI/handover.js +270 -0
- package/build/shared/interfaces/resources/IAppTemplate.js +24 -0
- package/build/shared/interfaces/resources/IAuditEvent.js +39 -3
- package/build/shared/interfaces/resources/IChart.js +2 -1
- package/build/shared/interfaces/resources/IChartNode.js +58 -11
- package/build/shared/interfaces/resources/IConnection.js +1 -1
- package/build/shared/interfaces/resources/IConnectionSchema.js +1 -1
- package/build/shared/interfaces/resources/IEndpoint.js +7 -2
- package/build/shared/interfaces/resources/IExtension.js +17 -0
- package/build/shared/interfaces/resources/IFile.js +1 -1
- package/build/shared/interfaces/resources/IFlow.js +10 -2
- package/build/shared/interfaces/resources/IFlowState.js +1 -1
- package/build/shared/interfaces/resources/IFunctionInstance.js +1 -1
- package/build/shared/interfaces/resources/IHandoverConfiguration.js +13 -0
- package/build/shared/interfaces/resources/ILexicon.js +9 -3
- package/build/shared/interfaces/resources/ILexiconEntry.js +1 -1
- package/build/shared/interfaces/resources/INLUConnector.js +15 -2
- package/build/shared/interfaces/resources/INodeDescriptorSet.js +169 -53
- package/build/shared/interfaces/resources/IOptionsResolverFunction.js +18 -0
- package/build/shared/interfaces/resources/IOrganisationDeletion.js +10 -0
- package/build/shared/interfaces/resources/IPlaybookRun.js +61 -0
- package/build/shared/interfaces/resources/IProject.js +20 -1
- package/build/shared/interfaces/resources/IRemoveDuplicatedSlotsAndUpdateLexionEntries.js +3 -0
- package/build/shared/interfaces/resources/ISlotFiller.js +38 -21
- package/build/shared/interfaces/resources/ISnapshot.js +1 -1
- package/build/shared/interfaces/resources/ITrackAnalyticsStepsArguments.js +3 -0
- package/build/shared/interfaces/resources/TNLUConnectorType.js +3 -1
- package/build/shared/interfaces/resources/TResourceType.js +1 -0
- package/build/shared/interfaces/resources/TRestChannelType.js +10 -0
- package/build/shared/interfaces/resources/TSocketChannelType.js +9 -5
- package/build/shared/interfaces/resources/TWebhookChannelType.js +10 -0
- package/build/shared/interfaces/resources/chart/IChartExecutable.js +3 -2
- package/build/shared/interfaces/resources/chart/IChartExecutableNode.js +1 -0
- package/build/shared/interfaces/resources/intent/IIntent.js +26 -6
- package/build/shared/interfaces/resources/intent/IIntentTrainGroup.js +22 -2
- package/build/shared/interfaces/resources/intent/ISentence.js +32 -8
- package/build/shared/interfaces/resources/settings/IAgentSettings.js +81 -2
- package/build/shared/interfaces/resources/settings/IFlowSettings.js +20 -2
- package/build/shared/interfaces/resources/settings/ISharedSettings.js +5 -1
- package/build/shared/interfaces/resources/yesNoIntent/IYesNoItem.js +9 -0
- package/build/shared/interfaces/resources/yesNoIntent/index.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/IReadLiveAgentAccountRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/IReadProjectInboxRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/ISetupCognigyLiveAgentInboxRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/ISetupCognigyLiveAgentRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/IUpdateCognigyLiveAgentInboxRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/administration/organisations/v2.0/IReadCollectionsToBeDeletedRest_2_0.js +21 -0
- package/build/shared/interfaces/restAPI/administration/organisations/v2.0/IRequestOrganisationDeletionRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/organisations/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/analytics/IDeleteAnalyticsRecordsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/analytics/IUpdateAnalyticsRecordProperties_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/analytics/IUpdateAnalyticsRecordsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IAudioPreviewLanguages_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IAudioPreviewRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IIndexAudioPreviewLanguages_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/ITestVoiceProviderRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/ITestVoiceProvider_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IVGCallSettings_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IVoicePrepareCallRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/IVoicePrepareCall_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/audio/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/insights/IAnalyticsQueryFilter_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/TAnalyticsQueryFilterOperator_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/messages/IGenerateMessagesRest_2_0.js +5 -0
- package/build/shared/interfaces/restAPI/insights/messages/ILoadMessagesReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/messages/ILoadMessagesReportByQueryHashRestData_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/messages/ITopNMessages_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/publish/IPublishAnalyticsRestDataBody.js +4 -0
- package/build/shared/interfaces/restAPI/insights/reports/IGenerateReportResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/reports/IGenerateReportRest_2_0.js +41 -0
- package/build/shared/interfaces/restAPI/insights/reports/ILoadReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/reports/ILoadReportByQueryHashRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IGenerateStepReportRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IIndexStepsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/ILoadStepReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/ILoadStepReportByQueryHashRestData_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IStepIndexItem_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IStepReport_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IStep_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/IGenerateTranscriptsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/ILoadTranscriptsReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/ILoadTranscriptsReportByQueryHashRestData_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/IStepPath_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/management/organisations/v2.0/IDeleteOrganisationRest_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/chart/v2.0/ISearchChartNodesRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/extension/v2.0/IUpdateExtensionPackageRest_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/file/v2.0/IUploadFileRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/file/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/resources/flow/v2.0/ICloneFlowRest_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/flow/v2.0/ICreateFlowFromChildrenRest_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/flow/v2.0/sentence/IYesNoSentence_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/flow/v2.0/settings/ILocaleSettings_2_0.js +16 -0
- package/build/shared/interfaces/restAPI/resources/lexicon/v2.0/IComposeLexiconDownloadLinkRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IDeleteYesNoIntentRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IReadYesNoIntentsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/ITrainYesNoIntentsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IUpdateYesNoIntentRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IYesNoIntentItem_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IYesNoIntentMetaData_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IYesNoIntents_2_0.js +8 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/index.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/ICreateYesNoSentenceRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/IDeleteYesNoSentenceRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/IIndexYesNoSentencesRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/IReadYesNoSentenceRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/IUpdateYesNoSentenceRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoSentence/index.js +3 -0
- package/build/shared/interfaces/restAPI/resources/nluconnector/v2.0/TNLUConnectorType_2_0.js +5 -1
- package/build/shared/interfaces/restAPI/resources/nodedescriptorsets/v2.0/IOptionsResolverRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IDeletePlaybookRunRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IIndexPlaybookRunsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IPlaybookRunIndexItem_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IPlaybookRun_2_0.js +7 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IReadPlaybookRunRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/ISchedulePlaybookRunRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/project/v2.0/ICreateProjectRest_2_0.js +1 -0
- package/build/shared/interfaces/restAPI/resources/project/v2.0/ITrainAllProjectFlowsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/project/v2.0/settings/ITestTranslationSettingsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/project/v2.0/settings/ITestTranslationSettings_2_0.js +3 -0
- package/build/shared/interfaces/security/IACL.js +1 -1
- package/build/shared/interfaces/security/IPermission.js +10 -0
- package/build/shared/interfaces/security/IRole.js +21 -3
- package/build/shared/interfaces/sessionstate/ISessionState.js +3 -0
- package/build/shared/interfaces/sessionstate/index.js +3 -0
- package/build/shared/interfaces/trainer/ITrainerRecord.js +5 -1
- package/build/shared/interfaces/translation.js +11 -0
- package/build/shared/interfaces/user.js +1 -1
- package/package.json +40 -31
- package/types/index.d.ts +12527 -8567
- package/build/shared/charts/descriptors/logic/checkFrustration.js +0 -82
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This Question Node asks the user a question and expects a certain type of answer back.
|
|
4
|
+
* The answer is evaluated by the Node and if it's invalid, the user is guided towards
|
|
5
|
+
* giving a correct answer.
|
|
6
|
+
*
|
|
7
|
+
* The Node executes the following steps, all of which have been marked as #regions in the code below
|
|
8
|
+
*
|
|
9
|
+
* 0. Check if we're currently in a reconfirmation of a valid answer and if yes, handle it
|
|
10
|
+
*
|
|
11
|
+
* 1. Check if answer exists in context and stop if it does
|
|
12
|
+
*
|
|
13
|
+
* 2. Check if this is the first time the node is hit and if yes, ask the question and stop (return); if not
|
|
14
|
+
*
|
|
15
|
+
* 3. - doesnt exist anymore -
|
|
16
|
+
*
|
|
17
|
+
* 4. Run actual evaluation of the answer using evaluateQuestionAnswer
|
|
18
|
+
* 4.1 If result location was specified, try to get the result from there
|
|
19
|
+
*
|
|
20
|
+
* 5. If answer is:
|
|
21
|
+
* 5.1 VALID
|
|
22
|
+
* 5.1.1 If reconfirmation is needed, start reconfirmation process and stop
|
|
23
|
+
* 5.1.2 Store the answer either in Context or Input
|
|
24
|
+
* 5.1.3 Store the answer also in the profile
|
|
25
|
+
* 5.1.4 Reset markers and activeQuestion in system Context and return
|
|
26
|
+
*
|
|
27
|
+
* 5.2 INVALID
|
|
28
|
+
* 5.2.1 Check if we should escalate on intent and if yes, do so
|
|
29
|
+
* 5.2.2 Otherwise (!) check if we should escalate on multiple wrong answers and if yes, do so
|
|
30
|
+
* 5.2.3 Check if we should say the reprompt an if yes, say it, plus the question again
|
|
31
|
+
* 5.2.4 Sets itself as the next Node and stops execution
|
|
32
|
+
*/
|
|
2
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
34
|
exports.QUESTION = void 0;
|
|
35
|
+
//#region Imports
|
|
4
36
|
/* Custom modules */
|
|
5
37
|
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
6
38
|
const evaluateQuestionAnswer_1 = require("./utils/evaluateQuestionAnswer");
|
|
@@ -8,8 +40,17 @@ const say_1 = require("../say");
|
|
|
8
40
|
const goTo_1 = require("../../logic/goTo");
|
|
9
41
|
const executeFlow_1 = require("../../logic/executeFlow");
|
|
10
42
|
const BaseContext_1 = require("../../../../helper/BaseContext");
|
|
43
|
+
const getQuestionText_1 = require("./utils/getQuestionText");
|
|
44
|
+
const storeQuestionAnswer_1 = require("./utils/storeQuestionAnswer");
|
|
45
|
+
const generateAnswerShortForm_1 = require("./utils/generateAnswerShortForm");
|
|
46
|
+
const validateQuestionAnswer_1 = require("./utils/validateQuestionAnswer");
|
|
47
|
+
const service_1 = require("../../service");
|
|
11
48
|
const datepickerUtils_1 = require("./utils/datepickerUtils");
|
|
12
|
-
|
|
49
|
+
const resetNodeState_1 = require("./utils/resetNodeState");
|
|
50
|
+
const questionHandover_1 = require("./utils/questionHandover");
|
|
51
|
+
//#endregion Interfaces
|
|
52
|
+
exports.QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
53
|
+
//#region DescriptorFields
|
|
13
54
|
type: "question",
|
|
14
55
|
defaultLabel: "Question",
|
|
15
56
|
summary: "Ask a question and waits for a valid answer",
|
|
@@ -114,7 +155,10 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
114
155
|
type: "cognigyText",
|
|
115
156
|
label: "Reprompt Message",
|
|
116
157
|
description: "Message to output if the given answer is invalid",
|
|
117
|
-
defaultValue: "Not sure I understood this correctly."
|
|
158
|
+
defaultValue: "Not sure I understood this correctly.",
|
|
159
|
+
params: {
|
|
160
|
+
multiline: true
|
|
161
|
+
}
|
|
118
162
|
},
|
|
119
163
|
{
|
|
120
164
|
key: "repromptCondition",
|
|
@@ -208,6 +252,17 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
208
252
|
value: true
|
|
209
253
|
}
|
|
210
254
|
},
|
|
255
|
+
{
|
|
256
|
+
key: "onlyAcceptEscalationIntents",
|
|
257
|
+
type: "toggle",
|
|
258
|
+
label: "Only Accept Escalation Intents",
|
|
259
|
+
description: "Ignore all Intents on Answer, except Escalation Intents",
|
|
260
|
+
condition: {
|
|
261
|
+
key: "type",
|
|
262
|
+
value: "intent",
|
|
263
|
+
negate: true
|
|
264
|
+
}
|
|
265
|
+
},
|
|
211
266
|
{
|
|
212
267
|
key: "parseResultOnEntry",
|
|
213
268
|
type: "toggle",
|
|
@@ -274,6 +329,10 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
274
329
|
label: "Execute Flow and return",
|
|
275
330
|
value: "execute"
|
|
276
331
|
},
|
|
332
|
+
{
|
|
333
|
+
label: "Handover to Human Agent",
|
|
334
|
+
value: "handover"
|
|
335
|
+
}
|
|
277
336
|
],
|
|
278
337
|
},
|
|
279
338
|
defaultValue: 'none'
|
|
@@ -386,13 +445,150 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
386
445
|
}
|
|
387
446
|
},
|
|
388
447
|
{
|
|
389
|
-
key: "
|
|
448
|
+
key: "escalateAnswersHandoverText",
|
|
449
|
+
type: "cognigyText",
|
|
450
|
+
label: "Handover Accepted Message",
|
|
451
|
+
description: "The message to display to the user once the handover request was accepted by the live chat provider",
|
|
452
|
+
condition: {
|
|
453
|
+
key: "escalateAnswersAction",
|
|
454
|
+
value: "handover"
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
key: "escalateAnswersHandoverResolveBehavior",
|
|
459
|
+
type: "select",
|
|
460
|
+
label: "On Resolve Behavior",
|
|
461
|
+
condition: {
|
|
462
|
+
key: "escalateAnswersAction",
|
|
463
|
+
value: "handover"
|
|
464
|
+
},
|
|
465
|
+
defaultValue: "continueEntrypoint",
|
|
466
|
+
params: {
|
|
467
|
+
options: [
|
|
468
|
+
{
|
|
469
|
+
label: "Continue Flow below this Node",
|
|
470
|
+
value: "resetEntrypoint"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
label: "Continue Flow at current Entrypoint",
|
|
474
|
+
value: "continueEntrypoint",
|
|
475
|
+
},
|
|
476
|
+
],
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
key: "escalateAnswersHandoverSendResolveEvent",
|
|
390
481
|
type: "toggle",
|
|
391
|
-
label: "
|
|
482
|
+
label: "Send resolve event to Virtual Agent",
|
|
483
|
+
condition: {
|
|
484
|
+
key: "escalateAnswersAction",
|
|
485
|
+
value: "handover"
|
|
486
|
+
},
|
|
487
|
+
defaultValue: false,
|
|
488
|
+
},
|
|
489
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && {
|
|
490
|
+
key: "escalateAnswersAllowAgentInject",
|
|
491
|
+
type: "toggle",
|
|
492
|
+
label: "Live Agent - Allow to reply as user via UI",
|
|
493
|
+
description: "Display a button allowing human agents to reply as end user",
|
|
494
|
+
condition: {
|
|
495
|
+
key: "escalateAnswersAction",
|
|
496
|
+
value: "handover"
|
|
497
|
+
},
|
|
392
498
|
defaultValue: true,
|
|
499
|
+
},
|
|
500
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && {
|
|
501
|
+
key: "escalateAnswersAgentAssistInitMessage",
|
|
502
|
+
type: "cognigyText",
|
|
503
|
+
label: "Live Agent - Initial Whisper Assist Trigger",
|
|
504
|
+
description: "If an Assist Flow is configured, this trigger message is sent to it as an input upon Live Agent handover",
|
|
393
505
|
condition: {
|
|
394
506
|
key: "escalateAnswersAction",
|
|
395
|
-
value: "
|
|
507
|
+
value: "handover"
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
key: "escalateAnswersRepeatHandoverMessage",
|
|
512
|
+
type: "toggle",
|
|
513
|
+
label: "Repeat Handover Accepted Message",
|
|
514
|
+
description: "Repeatedly respond with Handover Accepted Message for each user input until human agent responds",
|
|
515
|
+
defaultValue: false,
|
|
516
|
+
condition: {
|
|
517
|
+
key: "escalateAnswersAction",
|
|
518
|
+
value: "handover"
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
key: "escalateAnswersHandoverCancelIntent",
|
|
523
|
+
type: "cognigyText",
|
|
524
|
+
label: "Cancel Intent",
|
|
525
|
+
description: "Name of the intent which will cancel the handover",
|
|
526
|
+
condition: {
|
|
527
|
+
key: "escalateAnswersAction",
|
|
528
|
+
value: "handover"
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
key: "escalateAnswersHandoverQuickReply",
|
|
533
|
+
type: "cognigyText",
|
|
534
|
+
label: "Cancel Button Text",
|
|
535
|
+
description: "Text of the Quick Reply Button which sends the user back to the Virtual Agent",
|
|
536
|
+
condition: {
|
|
537
|
+
key: "escalateAnswersAction",
|
|
538
|
+
value: "handover"
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && {
|
|
542
|
+
key: "escalateAnswersHandoverLiveAgentInboxId",
|
|
543
|
+
type: "cognigyText",
|
|
544
|
+
label: "Live Agent Inbox Id",
|
|
545
|
+
description: "Inbox Id in Live Agent",
|
|
546
|
+
condition: {
|
|
547
|
+
key: "escalateAnswersAction",
|
|
548
|
+
value: "handover"
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
key: "escalateAnswersHandoverChatwootInboxId",
|
|
553
|
+
type: "cognigyText",
|
|
554
|
+
label: "Chatwoot Inbox Id",
|
|
555
|
+
description: "Inbox Id in Chatwoot",
|
|
556
|
+
condition: {
|
|
557
|
+
key: "escalateAnswersAction",
|
|
558
|
+
value: "handover"
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
key: "escalateAnswersHandoverSendTranscriptAsFirstMessage",
|
|
563
|
+
type: "toggle",
|
|
564
|
+
label: "Salesforce Send Trascript As First Message",
|
|
565
|
+
description: "The Salesforce receives conversation transcript as a first message.",
|
|
566
|
+
defaultValue: false,
|
|
567
|
+
condition: {
|
|
568
|
+
key: "escalateAnswersAction",
|
|
569
|
+
value: "handover"
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
key: "escalateAnswersHandoverSalesforcePrechatEntities",
|
|
574
|
+
type: "json",
|
|
575
|
+
label: "Salesforce Prechat Entities",
|
|
576
|
+
description: "The Salesforce entity that should be used.",
|
|
577
|
+
defaultValue: "[]",
|
|
578
|
+
condition: {
|
|
579
|
+
key: "escalateAnswersAction",
|
|
580
|
+
value: "handover"
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
key: "escalateAnswersHandoverSalesforcePrechatDetails",
|
|
585
|
+
type: "json",
|
|
586
|
+
label: "Salesforce Prechat Details",
|
|
587
|
+
description: "The details that should be displayed to the Live Chat Agent.",
|
|
588
|
+
defaultValue: "[]",
|
|
589
|
+
condition: {
|
|
590
|
+
key: "escalateAnswersAction",
|
|
591
|
+
value: "handover"
|
|
396
592
|
}
|
|
397
593
|
},
|
|
398
594
|
{
|
|
@@ -434,6 +630,10 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
434
630
|
label: "Execute Flow and return",
|
|
435
631
|
value: "execute"
|
|
436
632
|
},
|
|
633
|
+
{
|
|
634
|
+
label: "Handover to Human Agent",
|
|
635
|
+
value: "handover"
|
|
636
|
+
}
|
|
437
637
|
],
|
|
438
638
|
},
|
|
439
639
|
defaultValue: 'none'
|
|
@@ -547,30 +747,208 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
547
747
|
}
|
|
548
748
|
},
|
|
549
749
|
{
|
|
550
|
-
key: "
|
|
750
|
+
key: "escalateIntentsHandoverText",
|
|
751
|
+
type: "cognigyText",
|
|
752
|
+
label: "Handover Accepted Message",
|
|
753
|
+
description: "The message to display to the user once the handover request was accepted by the live chat provider",
|
|
754
|
+
condition: {
|
|
755
|
+
key: "escalateIntentsAction",
|
|
756
|
+
value: "handover"
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
key: "escalateIntentsRepeatHandoverMessage",
|
|
551
761
|
type: "toggle",
|
|
552
|
-
label: "
|
|
762
|
+
label: "Repeat Handover Accepted Message",
|
|
763
|
+
description: "Repeatedly respond with Handover Accepted Message for each user input until human agent responds",
|
|
764
|
+
defaultValue: false,
|
|
765
|
+
condition: {
|
|
766
|
+
key: "escalateIntentsAction",
|
|
767
|
+
value: "handover"
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
key: "escalateIntentsHandoverCancelIntent",
|
|
772
|
+
type: "cognigyText",
|
|
773
|
+
label: "Cancel Intent",
|
|
774
|
+
description: "Name of the intent which will cancel the handover",
|
|
775
|
+
condition: {
|
|
776
|
+
key: "escalateIntentsAction",
|
|
777
|
+
value: "handover"
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
key: "escalateIntentsHandoverQuickReply",
|
|
782
|
+
type: "cognigyText",
|
|
783
|
+
label: "Cancel Button Text",
|
|
784
|
+
description: "Text of the Quick Reply Button which sends the user back to the Virtual Agent",
|
|
785
|
+
condition: {
|
|
786
|
+
key: "escalateIntentsAction",
|
|
787
|
+
value: "handover"
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
key: "escalateIntentsHandoverResolveBehavior",
|
|
792
|
+
type: "select",
|
|
793
|
+
label: "On Resolve Behavior",
|
|
794
|
+
condition: {
|
|
795
|
+
key: "escalateIntentsAction",
|
|
796
|
+
value: "handover"
|
|
797
|
+
},
|
|
798
|
+
defaultValue: "continueEntrypoint",
|
|
799
|
+
params: {
|
|
800
|
+
options: [
|
|
801
|
+
{
|
|
802
|
+
label: "Continue Flow below this Node",
|
|
803
|
+
value: "resetEntrypoint"
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
label: "Continue Flow at current Entrypoint",
|
|
807
|
+
value: "continueEntrypoint",
|
|
808
|
+
},
|
|
809
|
+
],
|
|
810
|
+
},
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
key: "escalateIntentsHandoverSendResolveEvent",
|
|
814
|
+
type: "toggle",
|
|
815
|
+
label: "Send resolve event to Virtual Agent",
|
|
816
|
+
condition: {
|
|
817
|
+
key: "escalateIntentsAction",
|
|
818
|
+
value: "handover"
|
|
819
|
+
},
|
|
820
|
+
defaultValue: false,
|
|
821
|
+
},
|
|
822
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && {
|
|
823
|
+
key: "escalateIntentsAllowAgentInject",
|
|
824
|
+
type: "toggle",
|
|
825
|
+
label: "Live Agent - Allow to reply as user via UI",
|
|
826
|
+
description: "Display a button allowing human agents to reply as end user",
|
|
827
|
+
condition: {
|
|
828
|
+
key: "escalateIntentsAction",
|
|
829
|
+
value: "handover"
|
|
830
|
+
},
|
|
553
831
|
defaultValue: true,
|
|
832
|
+
},
|
|
833
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && {
|
|
834
|
+
key: "escalateIntentsHandoverLiveAgentInboxId",
|
|
835
|
+
type: "cognigyText",
|
|
836
|
+
label: "Live Agent Inbox Id",
|
|
837
|
+
description: "Inbox Id in Live Agent",
|
|
554
838
|
condition: {
|
|
555
839
|
key: "escalateIntentsAction",
|
|
556
|
-
value: "
|
|
840
|
+
value: "handover"
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && {
|
|
844
|
+
key: "escalateIntentsAgentAssistInitMessage",
|
|
845
|
+
type: "cognigyText",
|
|
846
|
+
label: "Live Agent - Initial Whisper Assist Trigger",
|
|
847
|
+
description: "If an Assist Flow is configured, this trigger message is sent to it as an input upon Live Agent handover",
|
|
848
|
+
condition: {
|
|
849
|
+
key: "escalateIntentsAction",
|
|
850
|
+
value: "handover"
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
key: "escalateIntentsHandoverChatwootInboxId",
|
|
855
|
+
type: "cognigyText",
|
|
856
|
+
label: "Chatwoot Inbox Id",
|
|
857
|
+
description: "Inbox Id in Chatwoot",
|
|
858
|
+
condition: {
|
|
859
|
+
key: "escalateIntentsAction",
|
|
860
|
+
value: "handover"
|
|
557
861
|
}
|
|
558
862
|
},
|
|
559
863
|
{
|
|
560
|
-
key: "
|
|
864
|
+
key: "escalateIntentHandoverSendTranscriptAsFirstMessage",
|
|
561
865
|
type: "toggle",
|
|
562
|
-
label: "
|
|
866
|
+
label: "Salesforce Send Trascript As First Message",
|
|
867
|
+
description: "The Salesforce receives conversation transcript as a first message.",
|
|
868
|
+
defaultValue: false,
|
|
869
|
+
condition: {
|
|
870
|
+
key: "escalateIntentsAction",
|
|
871
|
+
value: "handover"
|
|
872
|
+
}
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
key: "escalateIntentsHandoverSalesforcePrechatEntities",
|
|
876
|
+
type: "json",
|
|
877
|
+
label: "Salesforce Prechat Entities",
|
|
878
|
+
description: "The Salesforce entity that should be used.",
|
|
879
|
+
defaultValue: "[]",
|
|
880
|
+
condition: {
|
|
881
|
+
key: "escalateIntentsAction",
|
|
882
|
+
value: "handover"
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
key: "escalateIntentsHandoverSalesforcePrechatDetails",
|
|
887
|
+
type: "json",
|
|
888
|
+
label: "Salesforce Prechat Details",
|
|
889
|
+
description: "The details that should be displayed to the Live Chat Agent.",
|
|
890
|
+
defaultValue: "[]",
|
|
891
|
+
condition: {
|
|
892
|
+
key: "escalateIntentsAction",
|
|
893
|
+
value: "handover"
|
|
894
|
+
}
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
key: "escalateIntentsRepromptPrevention",
|
|
898
|
+
type: "toggle",
|
|
899
|
+
label: "Prevent Reprompt Message Once",
|
|
563
900
|
defaultValue: true,
|
|
564
901
|
condition: {
|
|
565
902
|
key: "escalateIntentsAction",
|
|
566
|
-
value: "
|
|
903
|
+
value: "text"
|
|
904
|
+
}
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
key: "reconfirmationBehaviour",
|
|
908
|
+
type: "select",
|
|
909
|
+
description: "How and if to reconfirm question answers",
|
|
910
|
+
label: "Reconfirmation Behaviour",
|
|
911
|
+
defaultValue: "none",
|
|
912
|
+
params: {
|
|
913
|
+
options: [
|
|
914
|
+
{
|
|
915
|
+
label: "Do not reconfirm answer",
|
|
916
|
+
value: "none"
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
label: "Reconfirm answer",
|
|
920
|
+
value: "reconfirm"
|
|
921
|
+
},
|
|
922
|
+
]
|
|
567
923
|
}
|
|
568
924
|
},
|
|
569
|
-
|
|
925
|
+
{
|
|
926
|
+
key: "reconfirmationQuestion",
|
|
927
|
+
type: "cognigyText",
|
|
928
|
+
label: "Reconfirmation Question",
|
|
929
|
+
description: "The question to ask to reconfirm the answer",
|
|
930
|
+
defaultValue: "I heard you say [ANSWER]. Is that correct?",
|
|
931
|
+
condition: {
|
|
932
|
+
key: "reconfirmationBehaviour",
|
|
933
|
+
value: "reconfirm"
|
|
934
|
+
}
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
key: "reconfirmationQuestionReprompt",
|
|
938
|
+
type: "cognigyText",
|
|
939
|
+
label: "Reconfirmation Reprompt",
|
|
940
|
+
description: "What to say if the reconfirmation question wasn't answered with yes or no",
|
|
941
|
+
defaultValue: "I'm not sure I got that right.",
|
|
942
|
+
condition: {
|
|
943
|
+
key: "reconfirmationBehaviour",
|
|
944
|
+
value: "reconfirm"
|
|
945
|
+
}
|
|
946
|
+
},
|
|
947
|
+
...(0, datepickerUtils_1.getDatePickerFields)({
|
|
570
948
|
"key": "type",
|
|
571
949
|
"value": "date"
|
|
572
950
|
})
|
|
573
|
-
],
|
|
951
|
+
].filter(field => !!field),
|
|
574
952
|
sections: [
|
|
575
953
|
{
|
|
576
954
|
key: "context",
|
|
@@ -595,6 +973,16 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
595
973
|
"skipRepromptOnIntent"
|
|
596
974
|
]
|
|
597
975
|
},
|
|
976
|
+
{
|
|
977
|
+
key: "reconfirmation",
|
|
978
|
+
label: "Reconfirmation Options",
|
|
979
|
+
defaultCollapsed: true,
|
|
980
|
+
fields: [
|
|
981
|
+
"reconfirmationBehaviour",
|
|
982
|
+
"reconfirmationQuestion",
|
|
983
|
+
"reconfirmationQuestionReprompt"
|
|
984
|
+
]
|
|
985
|
+
},
|
|
598
986
|
{
|
|
599
987
|
key: "escalateIntents",
|
|
600
988
|
label: "Escalation - Intents",
|
|
@@ -609,8 +997,21 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
609
997
|
"escalateIntentsInjectedText",
|
|
610
998
|
"escalateIntentsInjectedData",
|
|
611
999
|
"escalateIntentsMessage",
|
|
1000
|
+
"escalateIntentsHandoverText",
|
|
1001
|
+
"escalateIntentsRepeatHandoverMessage",
|
|
1002
|
+
"escalateIntentsHandoverCancelIntent",
|
|
1003
|
+
"escalateIntentsHandoverQuickReply",
|
|
1004
|
+
"escalateIntentsHandoverResolveBehavior",
|
|
1005
|
+
"escalateIntentsHandoverSendResolveEvent",
|
|
1006
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && "escalateIntentsHandoverLiveAgentInboxId",
|
|
1007
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && "escalateIntentsAgentAssistInitMessage",
|
|
1008
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && "escalateIntentsAllowAgentInject",
|
|
1009
|
+
"escalateIntentsHandoverChatwootInboxId",
|
|
1010
|
+
"escalateIntentHandoverSendTranscriptAsFirstMessage",
|
|
1011
|
+
"escalateIntentsHandoverSalesforcePrechatEntities",
|
|
1012
|
+
"escalateIntentsHandoverSalesforcePrechatDetails",
|
|
612
1013
|
"escalateIntentsRepromptPrevention"
|
|
613
|
-
]
|
|
1014
|
+
].filter(field => !!field)
|
|
614
1015
|
},
|
|
615
1016
|
{
|
|
616
1017
|
key: "escalateAnswers",
|
|
@@ -625,9 +1026,22 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
625
1026
|
"escalateAnswersInjectedText",
|
|
626
1027
|
"escalateAnswersInjectedData",
|
|
627
1028
|
"escalateAnswersMessage",
|
|
1029
|
+
"escalateAnswersHandoverText",
|
|
1030
|
+
"escalateAnswersRepeatHandoverMessage",
|
|
1031
|
+
"escalateAnswersHandoverCancelIntent",
|
|
1032
|
+
"escalateAnswersHandoverQuickReply",
|
|
1033
|
+
"escalateAnswersHandoverResolveBehavior",
|
|
1034
|
+
"escalateAnswersHandoverSendResolveEvent",
|
|
1035
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && "escalateAnswersHandoverLiveAgentInboxId",
|
|
1036
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && "escalateAnswersAgentAssistInitMessage",
|
|
1037
|
+
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT && "escalateAnswersAllowAgentInject",
|
|
1038
|
+
"escalateAnswersHandoverChatwootInboxId",
|
|
1039
|
+
"escalateAnswersHandoverSendTranscriptAsFirstMessage",
|
|
1040
|
+
"escalateAnswersHandoverSalesforcePrechatEntities",
|
|
1041
|
+
"escalateAnswersHandoverSalesforcePrechatDetails",
|
|
628
1042
|
"escalateAnswersRepromptPrevention",
|
|
629
|
-
"escalateAnswersOnce"
|
|
630
|
-
]
|
|
1043
|
+
"escalateAnswersOnce",
|
|
1044
|
+
].filter(field => !!field)
|
|
631
1045
|
},
|
|
632
1046
|
{
|
|
633
1047
|
key: "advanced",
|
|
@@ -636,12 +1050,13 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
636
1050
|
fields: [
|
|
637
1051
|
"storeDetailedResults",
|
|
638
1052
|
"parseResultOnEntry",
|
|
1053
|
+
"onlyAcceptEscalationIntents",
|
|
639
1054
|
"additionalValidation",
|
|
640
1055
|
"resultLocation",
|
|
641
1056
|
"maxExecutionDiff",
|
|
642
1057
|
]
|
|
643
1058
|
},
|
|
644
|
-
...datepickerUtils_1.getDatePickerSections("Datepicker - ", {
|
|
1059
|
+
...(0, datepickerUtils_1.getDatePickerSections)("Datepicker - ", {
|
|
645
1060
|
"key": "type",
|
|
646
1061
|
"value": "date"
|
|
647
1062
|
})
|
|
@@ -654,6 +1069,7 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
654
1069
|
{ type: "field", key: "say" },
|
|
655
1070
|
{ type: "section", key: "context" },
|
|
656
1071
|
{ type: "section", key: "reprompt" },
|
|
1072
|
+
{ type: "section", key: "reconfirmation" },
|
|
657
1073
|
{ type: "section", key: "escalateIntents" },
|
|
658
1074
|
{ type: "section", key: "escalateAnswers" },
|
|
659
1075
|
{ type: "section", key: "advanced" },
|
|
@@ -670,19 +1086,31 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
670
1086
|
type: "sayNode",
|
|
671
1087
|
},
|
|
672
1088
|
tags: ["basic", "message", "nlu"],
|
|
673
|
-
|
|
1089
|
+
//#endregion DescriptorFields
|
|
1090
|
+
function: async ({ cognigy, nodeId, config, inputOptions }) => {
|
|
674
1091
|
var _a;
|
|
675
|
-
const { say, type, validationMessage, validationRepeat, storeResultInContext, contextKey, storeInContactProfile, profileKey, storeDetailedResults, parseResultOnEntry,
|
|
1092
|
+
const { say, type, validationMessage, validationRepeat, storeResultInContext, contextKey, storeInContactProfile, profileKey, storeDetailedResults, parseResultOnEntry, repromptCondition, maxExecutionDiff, resultLocation, skipRepromptOnIntent, onlyAcceptEscalationIntents, escalateAnswersAction, escalateAnswersThreshold, escalateAnswersGotoTarget, escalateAnswersExecuteTarget, escalateAnswersGotoExecutionMode, escalateAnswersInjectedText, escalateAnswersInjectedData, escalateAnswersMessage, escalateAnswersRepromptPrevention, escalateAnswersOnce, escalateAnswersHandoverText, escalateAnswersRepeatHandoverMessage, escalateAnswersHandoverCancelIntent, escalateAnswersHandoverQuickReply, escalateAnswersHandoverChatwootInboxId, escalateAnswersHandoverLiveAgentInboxId, escalateAnswersHandoverSendTranscriptAsFirstMessage, escalateAnswersHandoverSalesforcePrechatEntities, escalateAnswersHandoverSalesforcePrechatDetails, escalateAnswersHandoverSendResolveEvent, escalateAnswersHandoverResolveBehavior, escalateAnswersAgentAssistInitMessage, escalateAnswersAllowAgentInject, escalateIntentsAction, escalateIntentsValidIntents, escalateIntentsThreshold, escalateIntentsGotoTarget, escalateIntentsExecuteTarget, escalateIntentsGotoExecutionMode, escalateIntentsInjectedText, escalateIntentsInjectedData, escalateIntentsMessage, escalateIntentsHandoverText, escalateIntentsRepeatHandoverMessage, escalateIntentsHandoverCancelIntent, escalateIntentsHandoverQuickReply, escalateIntentsHandoverChatwootInboxId, escalateIntentsHandoverLiveAgentInboxId, escalateIntentHandoverSendTranscriptAsFirstMessage, escalateIntentsHandoverSalesforcePrechatEntities, escalateIntentsHandoverSalesforcePrechatDetails, escalateIntentsRepromptPrevention, escalateIntentsHandoverSendResolveEvent, escalateIntentsHandoverResolveBehavior, escalateIntentsAgentAssistInitMessage, escalateIntentsAllowAgentInject, reconfirmationBehaviour, reconfirmationQuestion, reconfirmationQuestionReprompt } = config;
|
|
676
1093
|
const { input, context, profile, api } = cognigy;
|
|
1094
|
+
const activeQuestionHandover = api.getSystemContext(`question-handover-${nodeId}`);
|
|
1095
|
+
const hasHandoverCompleted = !!activeQuestionHandover && ((_a = input.handover) === null || _a === void 0 ? void 0 : _a.status) !== "agentInject";
|
|
1096
|
+
const shouldEntrypointReset = activeQuestionHandover === null || activeQuestionHandover === void 0 ? void 0 : activeQuestionHandover.resetEntrypoint;
|
|
1097
|
+
if (hasHandoverCompleted && shouldEntrypointReset) {
|
|
1098
|
+
(0, resetNodeState_1.resetNodeState)(api, nodeId);
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
677
1101
|
// compute how often this node was hit
|
|
678
1102
|
const executionAmount = api.getExecutionAmount(nodeId);
|
|
679
1103
|
// compute how long ago this node was hit
|
|
680
1104
|
const lastExecutionMarker = api.getLastExecutionMarker(nodeId);
|
|
681
|
-
|
|
1105
|
+
let executionDiff = cognigy.input.execution - lastExecutionMarker;
|
|
1106
|
+
// the intent reconfirmation message should not count for the executionDiff
|
|
1107
|
+
if (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.handledIntentReconfirmation) {
|
|
1108
|
+
executionDiff -= 1;
|
|
1109
|
+
}
|
|
682
1110
|
// if this is the very first time the Node gets executed
|
|
683
1111
|
// or if we have been "away" from the Node for too long (maxExecutionDiff)
|
|
684
1112
|
// we consider it a first execution and show the question
|
|
685
|
-
|
|
1113
|
+
let isFirstExecution = executionAmount === 1 || executionDiff > (maxExecutionDiff || 1);
|
|
686
1114
|
// remember the current question in systemContext to later fill Input with it
|
|
687
1115
|
let activeQuestion = api.getSystemContext('activeQuestion');
|
|
688
1116
|
if (!activeQuestion || activeQuestion.nodeId !== nodeId) {
|
|
@@ -692,13 +1120,82 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
692
1120
|
lastExecutedAt: input.execution,
|
|
693
1121
|
forgetQuestionThreshold: maxExecutionDiff,
|
|
694
1122
|
repromptCount: 0,
|
|
695
|
-
escalationCount: 0
|
|
1123
|
+
escalationCount: 0,
|
|
696
1124
|
};
|
|
1125
|
+
if (onlyAcceptEscalationIntents && config.type !== "intent") {
|
|
1126
|
+
activeQuestion.onlyAcceptEscalationIntents = onlyAcceptEscalationIntents;
|
|
1127
|
+
activeQuestion.escalationIntents = escalateIntentsValidIntents;
|
|
1128
|
+
}
|
|
697
1129
|
api.setSystemContext('activeQuestion', activeQuestion);
|
|
698
1130
|
}
|
|
699
1131
|
else {
|
|
700
1132
|
activeQuestion.lastExecutedAt = input.execution;
|
|
701
1133
|
}
|
|
1134
|
+
// #region 0 CheckIfReconfirmationInProgress
|
|
1135
|
+
if (api.getSystemContext("reconfirmationQuestionInProgress")) {
|
|
1136
|
+
// if this is the case, we are now a YN question
|
|
1137
|
+
let res = (0, evaluateQuestionAnswer_1.evaluateQuestionAnswer)({
|
|
1138
|
+
cognigy, config: {
|
|
1139
|
+
"type": "yesNo"
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
const restoredInput = api.getSystemContext("reconfirmationQuestionInput");
|
|
1143
|
+
input.intent = restoredInput.intent;
|
|
1144
|
+
input.intentScore = restoredInput.intentScore;
|
|
1145
|
+
input.intentFlow = restoredInput.intentFlow;
|
|
1146
|
+
input.nlu = restoredInput.nlu;
|
|
1147
|
+
input.intentLevel = restoredInput.intentLevel;
|
|
1148
|
+
if (res === true) { // the reconfirmation answer was yes-like
|
|
1149
|
+
// get the tentative answer that was given and store it
|
|
1150
|
+
const result = activeQuestion === null || activeQuestion === void 0 ? void 0 : activeQuestion.tentativeAnswer;
|
|
1151
|
+
(0, storeQuestionAnswer_1.storeQuestionAnswer)({ context, contextKey, input, result, storeResultInContext });
|
|
1152
|
+
// reset everything and continue to the next node
|
|
1153
|
+
(0, resetNodeState_1.resetNodeState)(api, nodeId);
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
else if (res !== false) { // the reconfirmation answer was invalid (e.g. no yes-like or no-like answer)
|
|
1157
|
+
// output reconfirmation reprompt
|
|
1158
|
+
if (reconfirmationQuestionReprompt) {
|
|
1159
|
+
say_1.SAY.function({ cognigy, childConfigs: [], nodeId, config: { say: { type: "text", text: [reconfirmationQuestionReprompt] } } });
|
|
1160
|
+
}
|
|
1161
|
+
// output reconfirmationQuestion
|
|
1162
|
+
const tentativeAnswerShortform = (activeQuestion === null || activeQuestion === void 0 ? void 0 : activeQuestion.tentativeAnswerShortform) || "";
|
|
1163
|
+
say_1.SAY.function({ cognigy, childConfigs: [], nodeId, config: { say: { type: "text", text: [reconfirmationQuestion.replace("[ANSWER]", tentativeAnswerShortform)] } } });
|
|
1164
|
+
// set myself as next node and stop
|
|
1165
|
+
api.setNextNode(nodeId);
|
|
1166
|
+
api.stopExecution();
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
else { // the reconfirmation answer was no-like
|
|
1170
|
+
// delete all remnants of this reconfirmation
|
|
1171
|
+
api.deleteSystemContext('activeQuestion');
|
|
1172
|
+
api.deleteSystemContext('reconfirmationQuestionInProgress');
|
|
1173
|
+
api.deleteSystemContext("reconfirmationQuestionInput");
|
|
1174
|
+
// pretend the question was never asked and continue
|
|
1175
|
+
isFirstExecution = true;
|
|
1176
|
+
api.setExecutionAmount(nodeId, 1);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
// #endregion 0 CheckIfReconfirmationInProgress
|
|
1180
|
+
let currentNodeExecutionAmount = api.getExecutionAmount(nodeId) - 1;
|
|
1181
|
+
// Only validate if the forget question threshold is defined (gt 0)
|
|
1182
|
+
if (maxExecutionDiff > 0) {
|
|
1183
|
+
// Check if the same question node was executed before, if yes
|
|
1184
|
+
// calculate the question diff. last step - recent step
|
|
1185
|
+
let questionDiff = 0;
|
|
1186
|
+
if (executionAmount > 1) {
|
|
1187
|
+
// Calculate the question diff from the first lastExecutedAt
|
|
1188
|
+
questionDiff = executionDiff;
|
|
1189
|
+
}
|
|
1190
|
+
let validateAnswer = questionDiff <= maxExecutionDiff;
|
|
1191
|
+
// If we don't want to validate due to an exceeded forget question
|
|
1192
|
+
// threshold, we set setLastExecutionMarker to 0
|
|
1193
|
+
if (!validateAnswer) {
|
|
1194
|
+
currentNodeExecutionAmount = 0;
|
|
1195
|
+
api.setExecutionAmount(nodeId, 1);
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
// #region 1 AnswerExistsInContext
|
|
702
1199
|
// if the user has chose to skip the question in case the context already
|
|
703
1200
|
// exists, we will just skip the question
|
|
704
1201
|
if (config.storeResultInContext && config.skipIfResultInContext) {
|
|
@@ -710,32 +1207,32 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
710
1207
|
location = BaseContext_1.BaseContext.findLocationPathStateless(splits, true, location);
|
|
711
1208
|
target = splits[splits.length - 1];
|
|
712
1209
|
}
|
|
713
|
-
if (location[target]) {
|
|
1210
|
+
if (location[target] !== null && location[target] !== undefined) {
|
|
714
1211
|
api.setLastExecutionMarker(nodeId, -1);
|
|
715
1212
|
api.resetExecutionAmount(nodeId);
|
|
716
1213
|
api.deleteSystemContext('activeQuestion');
|
|
717
1214
|
return;
|
|
718
1215
|
}
|
|
719
1216
|
}
|
|
1217
|
+
// #endregion 1 AnswerExistsInContext
|
|
1218
|
+
// #region 2 FirstTimeNodeIsHit
|
|
720
1219
|
// if it's the first execution and you don't force evaluation on first execution, ask the question
|
|
721
1220
|
if (isFirstExecution && !parseResultOnEntry) {
|
|
722
1221
|
say_1.SAY.function({ cognigy, childConfigs: [], nodeId, config: { say } });
|
|
723
1222
|
if (config.type === "date" && !config.datepicker_hidePicker) {
|
|
724
|
-
datepickerUtils_1.showDatePicker(cognigy, config);
|
|
1223
|
+
(0, datepickerUtils_1.showDatePicker)(cognigy, config);
|
|
725
1224
|
}
|
|
726
1225
|
api.setLastExecutionMarker(nodeId, cognigy.input.execution);
|
|
727
1226
|
api.setNextNode(nodeId);
|
|
728
1227
|
api.stopExecution();
|
|
729
1228
|
return;
|
|
730
1229
|
}
|
|
731
|
-
|
|
732
|
-
// check if there is an extra condition defined and check whether it was truthy
|
|
733
|
-
if (additionalValidation) {
|
|
734
|
-
valid = !!api.parseCognigyScriptCondition(additionalValidation);
|
|
735
|
-
}
|
|
1230
|
+
// #endregion 2 FirstTimeNodeIsHit
|
|
736
1231
|
// if we're in a subsequent execution or we want to parse results
|
|
737
1232
|
// immediately on entry, continue with evaluation
|
|
738
|
-
let result = evaluateQuestionAnswer_1.evaluateQuestionAnswer({ cognigy, config });
|
|
1233
|
+
let result = (0, evaluateQuestionAnswer_1.evaluateQuestionAnswer)({ cognigy, config });
|
|
1234
|
+
// #endregion 4 RunQuestionAnswerValidation
|
|
1235
|
+
// #region 4.1 ResultLocationHandling
|
|
739
1236
|
// if a result location was specified, try to get the result from that location
|
|
740
1237
|
// if the location returns a falsey value, the answer is invalid
|
|
741
1238
|
if (resultLocation && result) {
|
|
@@ -744,46 +1241,59 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
744
1241
|
if (storeDetailedResults && result !== null && result !== undefined) {
|
|
745
1242
|
result = {
|
|
746
1243
|
"value": result,
|
|
747
|
-
"question": (
|
|
1244
|
+
"question": (0, getQuestionText_1.getQuestionText)(config),
|
|
748
1245
|
"timestamp": cognigy.input.currentTime.ISODate,
|
|
749
1246
|
"answer": cognigy.input.text,
|
|
750
1247
|
"answerData": cognigy.input.data
|
|
751
1248
|
};
|
|
752
1249
|
}
|
|
753
1250
|
}
|
|
1251
|
+
// #endregion 4.1 ResultLocationHandling
|
|
1252
|
+
const isValid = (0, validateQuestionAnswer_1.validateQuestionAnswer)(cognigy, config);
|
|
754
1253
|
// hard check against null & undefined, because result can be 0 or false
|
|
755
|
-
if (result !== null && result !== undefined &&
|
|
756
|
-
//
|
|
757
|
-
if (
|
|
758
|
-
//
|
|
759
|
-
//
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
1254
|
+
if (result !== null && result !== undefined && isValid) {
|
|
1255
|
+
// #region 5.1 AnswerIsValid
|
|
1256
|
+
if (reconfirmationBehaviour === "reconfirm" && reconfirmationQuestion) {
|
|
1257
|
+
// #region 5.1.1 ReconfirmationQuestion
|
|
1258
|
+
// remember the given answer in the activeQuestion object
|
|
1259
|
+
activeQuestion.tentativeAnswer = result;
|
|
1260
|
+
// remember a shortform of the given answer in the activeQuestion object
|
|
1261
|
+
activeQuestion.tentativeAnswerShortform = (0, generateAnswerShortForm_1.generateAnswerShortForm)(type, result, cognigy.input.text);
|
|
1262
|
+
// Output reconfirmationQuestion
|
|
1263
|
+
say_1.SAY.function({ cognigy, childConfigs: [], nodeId, config: { say: { type: "text", text: [reconfirmationQuestion.replace("[ANSWER]", activeQuestion.tentativeAnswerShortform)] } } });
|
|
1264
|
+
// remember that we are in reconfirmation mode and stop
|
|
1265
|
+
api.setSystemContext("reconfirmationQuestionInProgress", true);
|
|
1266
|
+
// we need to store the input, to be able to restore it afterwards
|
|
1267
|
+
// since we need information like intentLevel.
|
|
1268
|
+
api.setSystemContext("reconfirmationQuestionInput", input);
|
|
1269
|
+
api.setNextNode(nodeId);
|
|
1270
|
+
api.stopExecution();
|
|
1271
|
+
// #endregion 5.1.1 ReconfirmationQuestion
|
|
772
1272
|
}
|
|
773
1273
|
else {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
profile
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
1274
|
+
// #region 5.1.2 StoreAnswerInContextOrInput
|
|
1275
|
+
(0, storeQuestionAnswer_1.storeQuestionAnswer)({ context, contextKey, input, result, storeResultInContext });
|
|
1276
|
+
// #endregion 5.1.2 StoreAnswerInContextOrInput
|
|
1277
|
+
// #region 5.1.3 StoreAnswerInProfile
|
|
1278
|
+
// if profile storage is requested, also store in contact profile
|
|
1279
|
+
if (storeInContactProfile && profile && profileKey) {
|
|
1280
|
+
profile[profileKey] = (storeDetailedResults) ? result.value : result;
|
|
1281
|
+
}
|
|
1282
|
+
// #endregion 5.1.3 StoreAnswerInProfile
|
|
1283
|
+
// #region 5.1.4 SetMarkersAndContinue
|
|
1284
|
+
api.setLastExecutionMarker(nodeId, -1);
|
|
1285
|
+
api.resetExecutionAmount(nodeId);
|
|
1286
|
+
api.deleteSystemContext('activeQuestion');
|
|
1287
|
+
// #endregion 5.1.4 SetMarkersAndContinue
|
|
1288
|
+
}
|
|
782
1289
|
return;
|
|
1290
|
+
// #endregion 5.1 AnswerIsValid
|
|
783
1291
|
}
|
|
784
1292
|
else { // Answer was INVALID
|
|
1293
|
+
// #region 5.2 AnswerIsInvalid
|
|
785
1294
|
let sayReprompt = true;
|
|
786
1295
|
let escalatedInIntent = false;
|
|
1296
|
+
// #region 5.2.1 EscalationOnIntent
|
|
787
1297
|
// Process escalation on intents
|
|
788
1298
|
if (escalateIntentsAction && escalateIntentsAction !== "none") {
|
|
789
1299
|
const lastEscalation = api.getSystemContext(`lastEscalation-${nodeId}`);
|
|
@@ -800,6 +1310,8 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
800
1310
|
if (!escalateIntentsGotoTarget) {
|
|
801
1311
|
throw new Error("GoTo Target is required");
|
|
802
1312
|
}
|
|
1313
|
+
// remember when this escalation happened
|
|
1314
|
+
api.setSystemContext(`lastEscalation-${nodeId}`, cognigy.input.execution);
|
|
803
1315
|
await goTo_1.GO_TO.function({
|
|
804
1316
|
cognigy,
|
|
805
1317
|
childConfigs: [],
|
|
@@ -874,19 +1386,61 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
874
1386
|
sayReprompt = false;
|
|
875
1387
|
}
|
|
876
1388
|
break;
|
|
1389
|
+
case "handover":
|
|
1390
|
+
// avoid a second handover escalation
|
|
1391
|
+
if (lastEscalation) {
|
|
1392
|
+
break;
|
|
1393
|
+
}
|
|
1394
|
+
(0, questionHandover_1.questionHandover)({
|
|
1395
|
+
api,
|
|
1396
|
+
input,
|
|
1397
|
+
nodeId,
|
|
1398
|
+
resolveBehavior: escalateIntentsHandoverResolveBehavior,
|
|
1399
|
+
});
|
|
1400
|
+
await service_1.HANDOVER_V2.function({
|
|
1401
|
+
cognigy,
|
|
1402
|
+
childConfigs: [],
|
|
1403
|
+
nodeId,
|
|
1404
|
+
config: {
|
|
1405
|
+
text: escalateIntentsHandoverText,
|
|
1406
|
+
repeatHandoverMessage: escalateIntentsRepeatHandoverMessage,
|
|
1407
|
+
cancelIntent: escalateIntentsHandoverCancelIntent,
|
|
1408
|
+
quickReply: escalateIntentsHandoverQuickReply,
|
|
1409
|
+
chatwootInboxId: escalateIntentsHandoverChatwootInboxId,
|
|
1410
|
+
liveAgentInboxId: escalateIntentsHandoverLiveAgentInboxId,
|
|
1411
|
+
sendTranscriptAsFirstMessage: escalateIntentHandoverSendTranscriptAsFirstMessage,
|
|
1412
|
+
salesforcePrechatEntities: escalateIntentsHandoverSalesforcePrechatEntities,
|
|
1413
|
+
salesforcePrechatDetails: escalateIntentsHandoverSalesforcePrechatDetails,
|
|
1414
|
+
sendResolveEvent: escalateIntentsHandoverSendResolveEvent,
|
|
1415
|
+
resolveBehavior: escalateIntentsHandoverResolveBehavior,
|
|
1416
|
+
agentAssistInitMessage: escalateIntentsAgentAssistInitMessage,
|
|
1417
|
+
allowAgentInject: escalateIntentsAllowAgentInject,
|
|
1418
|
+
},
|
|
1419
|
+
nodeType: "question",
|
|
1420
|
+
});
|
|
1421
|
+
return;
|
|
877
1422
|
}
|
|
878
1423
|
}
|
|
879
1424
|
}
|
|
880
|
-
|
|
1425
|
+
// #endregion 5.2.1 EscalationOnIntent
|
|
1426
|
+
// #region 5.2.2 EscalationOnAnswers
|
|
1427
|
+
if ((!escalatedInIntent && escalatedInIntent != undefined) && escalateAnswersAction && escalateAnswersAction !== "none") {
|
|
881
1428
|
// the user set special escalation handling in case multiple wrong answers were provided
|
|
882
1429
|
// this is only done if intent escalation didnt happen
|
|
883
1430
|
const lastEscalation = api.getSystemContext(`lastEscalation-${nodeId}`);
|
|
1431
|
+
let addEscalationText = false;
|
|
1432
|
+
if (escalateAnswersOnce) {
|
|
1433
|
+
addEscalationText = currentNodeExecutionAmount === escalateAnswersThreshold;
|
|
1434
|
+
}
|
|
1435
|
+
else {
|
|
1436
|
+
addEscalationText = currentNodeExecutionAmount >= escalateAnswersThreshold;
|
|
1437
|
+
}
|
|
884
1438
|
// either we escalate only once on the threshold or always from the threshold on, depending on what was set
|
|
885
1439
|
if (lastEscalation && lastEscalation === cognigy.input.execution) {
|
|
886
1440
|
// escalation already happened on this execution - don't escalate again
|
|
887
1441
|
sayReprompt = false;
|
|
888
1442
|
}
|
|
889
|
-
else if (
|
|
1443
|
+
else if (addEscalationText) {
|
|
890
1444
|
// User has given enough wrong answers to trigger the threshold
|
|
891
1445
|
activeQuestion.escalationCount++;
|
|
892
1446
|
switch (escalateAnswersAction) {
|
|
@@ -894,6 +1448,8 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
894
1448
|
if (!escalateAnswersGotoTarget) {
|
|
895
1449
|
throw new Error("GoTo Target is required");
|
|
896
1450
|
}
|
|
1451
|
+
// remember when this escalation happened
|
|
1452
|
+
api.setSystemContext(`lastEscalation-${nodeId}`, cognigy.input.execution);
|
|
897
1453
|
await goTo_1.GO_TO.function({
|
|
898
1454
|
cognigy,
|
|
899
1455
|
childConfigs: [],
|
|
@@ -966,9 +1522,44 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
966
1522
|
sayReprompt = false;
|
|
967
1523
|
}
|
|
968
1524
|
break;
|
|
1525
|
+
case "handover":
|
|
1526
|
+
// avoid a second handover escalation
|
|
1527
|
+
if (lastEscalation) {
|
|
1528
|
+
break;
|
|
1529
|
+
}
|
|
1530
|
+
(0, questionHandover_1.questionHandover)({
|
|
1531
|
+
api,
|
|
1532
|
+
input,
|
|
1533
|
+
nodeId,
|
|
1534
|
+
resolveBehavior: escalateAnswersHandoverResolveBehavior,
|
|
1535
|
+
});
|
|
1536
|
+
await service_1.HANDOVER_V2.function({
|
|
1537
|
+
cognigy,
|
|
1538
|
+
childConfigs: [],
|
|
1539
|
+
nodeId,
|
|
1540
|
+
config: {
|
|
1541
|
+
text: escalateAnswersHandoverText,
|
|
1542
|
+
cancelIntent: escalateAnswersHandoverCancelIntent,
|
|
1543
|
+
repeatHandoverMessage: escalateAnswersRepeatHandoverMessage,
|
|
1544
|
+
quickReply: escalateAnswersHandoverQuickReply,
|
|
1545
|
+
chatwootInboxId: escalateAnswersHandoverChatwootInboxId,
|
|
1546
|
+
liveAgentInboxId: escalateAnswersHandoverLiveAgentInboxId,
|
|
1547
|
+
sendTranscriptAsFirstMessage: escalateAnswersHandoverSendTranscriptAsFirstMessage,
|
|
1548
|
+
salesforcePrechatEntities: escalateAnswersHandoverSalesforcePrechatEntities,
|
|
1549
|
+
salesforcePrechatDetails: escalateAnswersHandoverSalesforcePrechatDetails,
|
|
1550
|
+
sendResolveEvent: escalateAnswersHandoverSendResolveEvent,
|
|
1551
|
+
resolveBehavior: escalateAnswersHandoverResolveBehavior,
|
|
1552
|
+
agentAssistInitMessage: escalateAnswersAgentAssistInitMessage,
|
|
1553
|
+
allowAgentInject: escalateAnswersAllowAgentInject,
|
|
1554
|
+
},
|
|
1555
|
+
nodeType: "question",
|
|
1556
|
+
});
|
|
1557
|
+
return;
|
|
969
1558
|
}
|
|
970
1559
|
}
|
|
971
1560
|
}
|
|
1561
|
+
// #endregion 5.2.2 EscalationOnAnswers
|
|
1562
|
+
// #region 5.2.3 Reprompt
|
|
972
1563
|
// check if there is an extra condition defined for reprompts and check whether it was truthy
|
|
973
1564
|
if (sayReprompt && repromptCondition) {
|
|
974
1565
|
sayReprompt = !!api.parseCognigyScriptCondition(repromptCondition);
|
|
@@ -991,7 +1582,7 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
991
1582
|
config: { say }
|
|
992
1583
|
});
|
|
993
1584
|
if (config.type === "date" && !config.datepicker_hidePicker) {
|
|
994
|
-
datepickerUtils_1.showDatePicker(cognigy, config);
|
|
1585
|
+
(0, datepickerUtils_1.showDatePicker)(cognigy, config);
|
|
995
1586
|
}
|
|
996
1587
|
}
|
|
997
1588
|
}
|
|
@@ -1004,12 +1595,16 @@ exports.QUESTION = createNodeDescriptor_1.createNodeDescriptor({
|
|
|
1004
1595
|
config: { say }
|
|
1005
1596
|
});
|
|
1006
1597
|
if (config.type === "date" && !config.datepicker_hidePicker) {
|
|
1007
|
-
datepickerUtils_1.showDatePicker(cognigy, config);
|
|
1598
|
+
(0, datepickerUtils_1.showDatePicker)(cognigy, config);
|
|
1008
1599
|
}
|
|
1009
1600
|
}
|
|
1601
|
+
// #endregion 5.2.3 Reprompt
|
|
1602
|
+
// #region 5.2.4 SetNextNodeAndStop
|
|
1010
1603
|
api.setLastExecutionMarker(nodeId, cognigy.input.execution);
|
|
1011
1604
|
api.setNextNode(nodeId);
|
|
1012
1605
|
api.stopExecution();
|
|
1606
|
+
// #endregion 5.2.4 SetNextNodeAndStop
|
|
1607
|
+
// #endregion 5.2 AnswerIsInvalid
|
|
1013
1608
|
}
|
|
1014
1609
|
}
|
|
1015
1610
|
});
|