diff --git a/config/AppSettings.ts b/config/AppSettings.ts index 7f95774..43d6fe7 100644 --- a/config/AppSettings.ts +++ b/config/AppSettings.ts @@ -105,7 +105,7 @@ export const AppSettings: Array = [ packageValue: true, i18nLabel: 'Enable Dialogflow Events (Optional)', i18nDescription: - 'Enabling this setting will automatically trigger a Dialogflow event based after the chat is ended with the agent. Please enter event name you want to cofigure in the following field(s).', + 'Enabling this setting will automatically trigger a Dialogflow event based after the chat is ended with the agent. Please enter event name you want to configure in the following field(s)', required: false, }, { @@ -114,7 +114,7 @@ export const AppSettings: Array = [ type: SettingType.STRING, packageValue: 'end_live_chat', i18nLabel: 'Dialogflow Agent Ended Chat Event Name (Optional)', - i18nDescription: 'Enter the Dialogflow event name you want app to trigger as soon as the chat is sucessfully ended by agent.', + i18nDescription: 'Enter the Dialogflow event name you want app to trigger as soon as the chat is successfully ended by agent.', required: false, }, { @@ -123,7 +123,7 @@ export const AppSettings: Array = [ type: SettingType.STRING, packageValue: 'end_live_chat', i18nLabel: 'Dialogflow Customer Ended Chat Event Name (Optional)', - i18nDescription: 'Enter the Dialogflow event name you want app to trigger as soon as the chat is sucessfully ended by customer.', + i18nDescription: 'Enter the Dialogflow event name you want app to trigger as soon as the chat is successfully ended by customer.', required: false, }, { @@ -213,7 +213,7 @@ export const AppSettings: Array = [ type: SettingType.STRING, packageValue: 'Sorry we are unable to complete your request right now.', i18nLabel: 'Technical Difficulty Message', - i18nDescription: 'Enter message to show to user when there is some tehnical error.', + i18nDescription: 'Enter message to show to user when there is some technical error.', required: true, }, { @@ -251,7 +251,7 @@ export const AppSettings: Array = [ }, { key: '2', - i18nLabel: '2_Erros_Information_and_Debug', + i18nLabel: '2_Errors_Information_and_Debug', }, ], i18nLabel: 'Salesforce App Log Level', diff --git a/endpoints/HandoverEndpoint.ts b/endpoints/HandoverEndpoint.ts index 887c28f..79a4125 100644 --- a/endpoints/HandoverEndpoint.ts +++ b/endpoints/HandoverEndpoint.ts @@ -23,9 +23,9 @@ export class HandoverEndpoint extends ApiEndpoint { console.log(InfoLogs.HANDOVER_ENDPOINT_REQUEST_RECEIVED); try { const assoc = getRoomAssoc(request.content.roomId); - const { persisantAffinity, persistantKey } = await retrievePersistentTokens(read, assoc); + const { persistentAffinity, persistentKey } = await retrievePersistentTokens(read, assoc); - if (persisantAffinity !== null && persistantKey !== null) { + if (persistentAffinity !== null && persistentKey !== null) { console.log(ErrorLogs.HANDOVER_ENDPOINT_REQUEST_FAILED); return createHttpResponse( HttpStatusCode.NOT_ACCEPTABLE, diff --git a/enum/ErrorLogs.ts b/enum/ErrorLogs.ts index 7c640b6..550e88e 100644 --- a/enum/ErrorLogs.ts +++ b/enum/ErrorLogs.ts @@ -1,7 +1,7 @@ export enum ErrorLogs { - HANDOVER_ENDPOINT_REQUEST_FAILED = 'Error completing recieved handover endpoint request.', - AVAILABILITY_ENDPOINT_REQUEST_ERROR = 'Error completing recieved availability endpoint request.', - CHECKING_AVAILABILITY_ERROR = 'Error checking availabilty from Salesforce Org.', + HANDOVER_ENDPOINT_REQUEST_FAILED = 'Error completing received handover endpoint request.', + AVAILABILITY_ENDPOINT_REQUEST_ERROR = 'Error completing received availability endpoint request.', + CHECKING_AVAILABILITY_ERROR = 'Error checking availability from Salesforce Org.', SALESFORCE_CHAT_API_NOT_FOUND = 'Salesforce Chat API endpoint not found.', ROCKETCHAT_SERVERURL_NOT_FOUND = 'Rocket Chat Server URL not found.', GETTING_LIVEAGENT_RESPONSE_ERROR = 'Error getting Liveagent response.', @@ -9,12 +9,12 @@ export enum ErrorLogs { GENERATING_LIVEAGENT_SESSION_ID_ERROR = 'Error generating Liveagent session ID.', CLOSING_LIVEAGENT_SESSION_ERROR = 'Error closing Liveagent Session.', SENDING_MESSAGE_TO_LIVEAGENT_ERROR = 'Error sending message to Liveagent.', - LIVEAGENT_SESSION_CLASS_FAILED = 'Unexpected error occured in LiveAgentSession class.', - UNCALCULATED_AGENT_EVENT_TYPE = 'Uncalculated agent event type recieved.', + LIVEAGENT_SESSION_CLASS_FAILED = 'Unexpected error occurred in LiveAgentSession class.', + UNCALCULATED_AGENT_EVENT_TYPE = 'Uncalculated agent event type received.', ALL_LIVEAGENTS_UNAVAILABLE = 'No Liveagent available right now.', APP_CONFIGURATION_INVALID = 'Entered app configurations are invalid. Please recheck.', - SALESFORCE_INTERNAL_FAILURE = 'Internal failure in Saleforce Org. Please check your org for potential issues.', - UNKNOWN_ERROR_IN_CHECKING_AGENT_RESPONSE = 'Unknown error occured while checking for Liveagent chat request.', + SALESFORCE_INTERNAL_FAILURE = 'Internal failure in Salesforce Org. Please check your org for potential issues.', + UNKNOWN_ERROR_IN_CHECKING_AGENT_RESPONSE = 'Unknown error occurred while checking for Liveagent chat request.', LIVEAGENT_SESSION_EXPIRED = 'Liveagent session expired.', INVALID_ROOM_ID = 'Room Id not valid.', INVALID_VISITOR_TOKEN = 'Visitor token not found.', @@ -25,5 +25,5 @@ export enum ErrorLogs { ENDCHAT_EVENT_API_CALL_FAIL = 'Cannot successfully call Dialogflow app incoming endpoint.', DIALOGFLOW_ERROR_SESSION = 'Error encountered in session. Triggering DIALOGFLOW_SESSION_ERROR_EVENT', CHASITOR_TYPING_API_CALL_FAIL = 'Cannot successfully call ChasitorTyping/ChasitorNotTyping api.', - CHASITOR_SNEAKPEAK_API_CALL_FAIL = 'Cannot successfully call ChasitorSneakPeek api.', + CHASITOR_SNEAKPEEK_API_CALL_FAIL = 'Cannot successfully call ChasitorSneakPeek api.', } diff --git a/enum/InfoLogs.ts b/enum/InfoLogs.ts index a0a0537..1ced2db 100644 --- a/enum/InfoLogs.ts +++ b/enum/InfoLogs.ts @@ -6,11 +6,11 @@ export enum InfoLogs { LIVEAGENT_CHAT_REQUEST_SENT = 'Liveagent chat request sent.', LIVEAGENT_SESSION_CLOSED = 'Liveagent Session closed.', MESSAGE_SENT_TO_LIVEAGENT = 'Message sent to Liveagent.', - LIVAGENT_CURRENTLY_TYPING = 'Liveagent currently typing.', + LIVEAGENT_CURRENTLY_TYPING = 'Liveagent currently typing.', LIVEAGENT_ACCEPTED_CHAT_REQUEST = 'Chat request accepted by Liveagent.', - SUCCESSFULLY_RECIEVED_LIVEAGENT_RESPONSE = 'Successfully recieved Liveagent Response.', - HANDOVER_ENDPOINT_REQUEST_RECEIVED = 'Handover endpoint request recieved', - AVAILABILITY_ENDPOINT_REQUEST_RECEIVED = 'Availability endpoint request recieved', + SUCCESSFULLY_RECEIVED_LIVEAGENT_RESPONSE = 'Successfully received Liveagent Response.', + HANDOVER_ENDPOINT_REQUEST_RECEIVED = 'Handover endpoint request received', + AVAILABILITY_ENDPOINT_REQUEST_RECEIVED = 'Availability endpoint request received', CHATBOT_NOT_CONFIGURED = 'Chatbot is not configured in app settings.', ENDCHAT_EVENT_NOT_ENABLED = 'Dialogflow endchat event not enabled.', UNHANDLED_BLOCK_ACTION_ID = 'Visitor interacted with unhandled actionId block.', diff --git a/handlers/InitiateSalesforceSessionHandler.ts b/handlers/InitiateSalesforceSessionHandler.ts index a0c44e4..3103f33 100644 --- a/handlers/InitiateSalesforceSessionHandler.ts +++ b/handlers/InitiateSalesforceSessionHandler.ts @@ -128,7 +128,7 @@ export class InitiateSalesforceSession { ); await pullMessages(this.http, salesforceChatApiEndpoint, affinityToken, key) .then(async (pullMessagesres) => { - console.log(InfoLogs.SUCCESSFULLY_RECIEVED_LIVEAGENT_RESPONSE); + console.log(InfoLogs.SUCCESSFULLY_RECEIVED_LIVEAGENT_RESPONSE); const pullMessagesContent = pullMessagesres.content; const pullMessagesContentParsed = JSON.parse(pullMessagesContent || '{}'); const pullMessagesMessageArray = pullMessagesContentParsed.messages; diff --git a/handlers/LiveAgentSessionHandler.ts b/handlers/LiveAgentSessionHandler.ts index bdd69ab..cd78aa0 100644 --- a/handlers/LiveAgentSessionHandler.ts +++ b/handlers/LiveAgentSessionHandler.ts @@ -32,9 +32,9 @@ export class LiveAgentSession { const salesforceChatApiEndpoint = await getSalesforceChatAPIEndpoint(this.read); const assoc = getRoomAssoc(this.message.room.id); - const { persisantAffinity, persistantKey } = await retrievePersistentTokens(this.read, assoc); + const { persistentAffinity, persistentKey } = await retrievePersistentTokens(this.read, assoc); - if (this.message.text !== 'Closed by visitor' && persisantAffinity !== null && persistantKey !== null) { + if (this.message.text !== 'Closed by visitor' && persistentAffinity !== null && persistentKey !== null) { const livechatRoom: ILivechatRoom = this.message.room as ILivechatRoom; const livechatAgent: IUser = livechatRoom.servedBy ? livechatRoom.servedBy : this.message.sender; @@ -46,7 +46,7 @@ export class LiveAgentSession { if (this.message.text) { messageText = this.message.text; } - await sendMessages(this.http, salesforceChatApiEndpoint, persisantAffinity, persistantKey, messageText) + await sendMessages(this.http, salesforceChatApiEndpoint, persistentAffinity, persistentKey, messageText) .then(async (response) => { if (response.statusCode === 403) { console.error('Send Message: Chat session is expired.', getError(response)); diff --git a/handlers/SalesforceAgentAssignedHandler.ts b/handlers/SalesforceAgentAssignedHandler.ts index e0651e2..167b330 100644 --- a/handlers/SalesforceAgentAssignedHandler.ts +++ b/handlers/SalesforceAgentAssignedHandler.ts @@ -26,8 +26,8 @@ export class SalesforceAgentAssigned { } const assoc = getRoomAssoc(this.data.room.id); - const persitedData = await retrievePersistentTokens(this.read, assoc); - const { persisantAffinity, persistantKey } = persitedData; + const persistedData = await retrievePersistentTokens(this.read, assoc); + const { persistentAffinity, persistentKey } = persistedData; const salesforceAgentName = (await retrievePersistentData(this.read, assoc)).salesforceAgentName; const technicalDifficultyMessage: string = await getAppSettingValue(this.read, AppSettingId.TECHNICAL_DIFFICULTY_MESSAGE); @@ -45,7 +45,7 @@ export class SalesforceAgentAssigned { const connectedToAgentMessage = `${InfoLogs.CONNECTING_TO_SALESFORCE_LIVEAGENT} ${salesforceAgentName}.`; await sendLCMessage(this.read, this.modify, this.data.room, connectedToAgentMessage, this.data.agent); - if (persisantAffinity !== null && persistantKey !== null) { + if (persistentAffinity !== null && persistentKey !== null) { // Executing subscribe function to listen to Liveagent messages. const subscribeLiveAgentClass = new SubscribeToLiveAgent( this.app, @@ -58,8 +58,8 @@ export class SalesforceAgentAssigned { salesforceChatApiEndpoint, LAChatEndedMessage, technicalDifficultyMessage, - persisantAffinity, - persistantKey, + persistentAffinity, + persistentKey, ); await subscribeLiveAgentClass.subscribeToLiveAgent(); } diff --git a/helperFunctions/PersistenceHelpers.ts b/helperFunctions/PersistenceHelpers.ts index 45b5be5..d798e9b 100644 --- a/helperFunctions/PersistenceHelpers.ts +++ b/helperFunctions/PersistenceHelpers.ts @@ -12,15 +12,15 @@ export async function retrievePersistentTokens(read: IRead, assoc: RocketChatAss return { id: contentParsed.id, - persisantAffinity: contentParsed.affinityToken as string, - persistantKey: contentParsed.key as string, + persistentAffinity: contentParsed.affinityToken as string, + persistentKey: contentParsed.key as string, }; } return { id: null, - persisantAffinity: null, - persistantKey: null, + persistentAffinity: null, + persistentKey: null, }; } catch (error) { throw new Error(error); @@ -37,8 +37,8 @@ export async function retrievePersistentData(read: IRead, assoc: RocketChatAssoc return { id: contentParsed.id, chasitorIdleTimeout: contentParsed.chasitorIdleTimeout, - persisantAffinity: contentParsed.affinityToken as string, - persistantKey: contentParsed.key as string, + persistentAffinity: contentParsed.affinityToken as string, + persistentKey: contentParsed.key as string, sneakPeekEnabled: contentParsed.sneakPeekEnabled as boolean, salesforceAgentName: contentParsed.salesforceAgentName as string, isIdleSessionTimerScheduled: contentParsed.isIdleSessionTimerScheduled as boolean, @@ -49,8 +49,8 @@ export async function retrievePersistentData(read: IRead, assoc: RocketChatAssoc return { id: null, chasitorIdleTimeout: null, - persisantAffinity: null, - persistantKey: null, + persistentAffinity: null, + persistentKey: null, sneakPeekEnabled: null, salesforceAgentName: null, isIdleSessionTimerScheduled: null, @@ -64,11 +64,11 @@ export async function retrievePersistentData(read: IRead, assoc: RocketChatAssoc export async function updatePersistentData(read: IRead, persistence: IPersistence, assoc: RocketChatAssociationRecord, data: object) { try { const persistentData = await retrievePersistentData(read, assoc); - const { persisantAffinity, persistantKey } = persistentData; + const { persistentAffinity, persistentKey } = persistentData; const updatedData = { ...persistentData, - affinityToken: persisantAffinity, - key: persistantKey, + affinityToken: persistentAffinity, + key: persistentKey, ...data, }; await persistence.updateByAssociation(assoc, updatedData, true); diff --git a/helperFunctions/subscribeHelpers/InitiateSalesforceSessionHelpers/CheckChatStatusHelper.ts b/helperFunctions/subscribeHelpers/InitiateSalesforceSessionHelpers/CheckChatStatusHelper.ts index 604d89d..41cc6a2 100644 --- a/helperFunctions/subscribeHelpers/InitiateSalesforceSessionHelpers/CheckChatStatusHelper.ts +++ b/helperFunctions/subscribeHelpers/InitiateSalesforceSessionHelpers/CheckChatStatusHelper.ts @@ -50,15 +50,15 @@ export class CheckChatStatus { return; } else if (response.statusCode === 204 || response.statusCode === 409) { // Empty Response from Liveagent - const { persisantAffinity, persistantKey } = await retrievePersistentTokens(this.read, this.assoc); - if (persisantAffinity !== null && persistantKey !== null) { + const { persistentAffinity, persistentKey } = await retrievePersistentTokens(this.read, this.assoc); + if (persistentAffinity !== null && persistentKey !== null) { await this.checkCurrentChatStatus(); } else { await checkAgentStatusDirectCallback.checkAgentStatusCallbackError(this.technicalDifficultyMessage); return; } } else { - console.log(InfoLogs.SUCCESSFULLY_RECIEVED_LIVEAGENT_RESPONSE, response); + console.log(InfoLogs.SUCCESSFULLY_RECEIVED_LIVEAGENT_RESPONSE, response); const { content } = response; const contentParsed = JSON.parse(content || '{}'); const messageArray = contentParsed.messages; @@ -82,12 +82,19 @@ export class CheckChatStatus { const chatEstablishedMessage = messageArray[0].message; const chasitorIdleTimeout = chatEstablishedMessage.chasitorIdleTimeout || false; const sneakPeekEnabled = chatEstablishedMessage.sneakPeekEnabled; - const { id, persisantAffinity, persistantKey } = await retrievePersistentTokens(this.read, this.assoc); + const { id, persistentAffinity, persistentKey } = await retrievePersistentTokens(this.read, this.assoc); const salesforceAgentName = chatEstablishedMessage.name; await this.persistence.updateByAssociation( this.assoc, - { id, affinityToken: persisantAffinity, key: persistantKey, chasitorIdleTimeout, sneakPeekEnabled, salesforceAgentName }, + { + id, + affinityToken: persistentAffinity, + key: persistentKey, + chasitorIdleTimeout, + sneakPeekEnabled, + salesforceAgentName, + }, true, ); @@ -121,8 +128,8 @@ export class CheckChatStatus { await checkAgentStatusDirectCallback.checkAgentStatusCallbackError(this.technicalDifficultyMessage); return; } else { - const { persisantAffinity, persistantKey } = await retrievePersistentTokens(this.read, this.assoc); - if (persisantAffinity !== null && persistantKey !== null) { + const { persistentAffinity, persistentKey } = await retrievePersistentTokens(this.read, this.assoc); + if (persistentAffinity !== null && persistentKey !== null) { await this.checkCurrentChatStatus(); } else { await checkAgentStatusDirectCallback.checkAgentStatusCallbackError(this.technicalDifficultyMessage); @@ -131,8 +138,8 @@ export class CheckChatStatus { } } else { console.error(ErrorLogs.UNKNOWN_ERROR_IN_CHECKING_AGENT_RESPONSE, response); - const { persisantAffinity, persistantKey } = await retrievePersistentTokens(this.read, this.assoc); - if (persisantAffinity !== null && persistantKey !== null) { + const { persistentAffinity, persistentKey } = await retrievePersistentTokens(this.read, this.assoc); + if (persistentAffinity !== null && persistentKey !== null) { await this.checkCurrentChatStatus(); } else { await checkAgentStatusDirectCallback.checkAgentStatusCallbackError(this.technicalDifficultyMessage); diff --git a/helperFunctions/subscribeHelpers/SalesforceAgentAssignedHelpers/SubsribeToLiveAgentHelper.ts b/helperFunctions/subscribeHelpers/SalesforceAgentAssignedHelpers/SubscribeToLiveAgentHelper.ts similarity index 86% rename from helperFunctions/subscribeHelpers/SalesforceAgentAssignedHelpers/SubsribeToLiveAgentHelper.ts rename to helperFunctions/subscribeHelpers/SalesforceAgentAssignedHelpers/SubscribeToLiveAgentHelper.ts index 1b2b1c5..1ce77f1 100644 --- a/helperFunctions/subscribeHelpers/SalesforceAgentAssignedHelpers/SubsribeToLiveAgentHelper.ts +++ b/helperFunctions/subscribeHelpers/SalesforceAgentAssignedHelpers/SubscribeToLiveAgentHelper.ts @@ -22,8 +22,8 @@ export class SubscribeToLiveAgent { private salesforceChatApiEndpoint: string, private LAChatEndedMessage: string, private technicalDifficultyMessage: string, - private persisantAffinity: string, - private persistantKey: string, + private persistentAffinity: string, + private persistentKey: string, ) {} public async subscribeToLiveAgent() { @@ -37,15 +37,15 @@ export class SubscribeToLiveAgent { this.assoc, this.technicalDifficultyMessage, ); - await pullMessages(this.http, this.salesforceChatApiEndpoint, this.persisantAffinity, this.persistantKey) + await pullMessages(this.http, this.salesforceChatApiEndpoint, this.persistentAffinity, this.persistentKey) .then(async (response) => { if (response.statusCode === 403) { console.log(ErrorLogs.LIVEAGENT_SESSION_EXPIRED); await handleEndChatCallback.handleEndChat(); return; } else if (response.statusCode === 204 || response.statusCode === 409) { - const { persisantAffinity, persistantKey } = await retrievePersistentTokens(this.read, this.assoc); - if (persisantAffinity !== null && persistantKey !== null) { + const { persistentAffinity, persistentKey } = await retrievePersistentTokens(this.read, this.assoc); + if (persistentAffinity !== null && persistentKey !== null) { await this.subscribeToLiveAgent(); } else { console.log(ErrorLogs.LIVEAGENT_SESSION_EXPIRED); @@ -53,7 +53,7 @@ export class SubscribeToLiveAgent { return; } } else { - console.log(InfoLogs.SUCCESSFULLY_RECIEVED_LIVEAGENT_RESPONSE, response); + console.log(InfoLogs.SUCCESSFULLY_RECEIVED_LIVEAGENT_RESPONSE, response); const { content } = response; const contentParsed = JSON.parse(content || '{}'); const messageArray = contentParsed.messages; @@ -74,8 +74,8 @@ export class SubscribeToLiveAgent { this.assoc, this.persistence, ); - const { persisantAffinity, persistantKey } = await retrievePersistentTokens(this.read, this.assoc); - if (persisantAffinity !== null && persistantKey !== null) { + const { persistentAffinity, persistentKey } = await retrievePersistentTokens(this.read, this.assoc); + if (persistentAffinity !== null && persistentKey !== null) { await this.subscribeToLiveAgent(); } else { console.log(ErrorLogs.LIVEAGENT_SESSION_EXPIRED); diff --git a/lib/IdleSessionTimeoutProcessor.ts b/lib/IdleSessionTimeoutProcessor.ts index 8178018..b574200 100644 --- a/lib/IdleSessionTimeoutProcessor.ts +++ b/lib/IdleSessionTimeoutProcessor.ts @@ -14,9 +14,9 @@ export class IdleSessionTimeoutProcessor implements IProcessor { public async processor(jobContext: IJobContext, read: IRead, modify: IModify, http: IHttp, persis: IPersistence): Promise { const assoc = getRoomAssoc(jobContext.rid); - const { persisantAffinity, persistantKey } = await retrievePersistentTokens(read, assoc); + const { persistentAffinity, persistentKey } = await retrievePersistentTokens(read, assoc); - if (persisantAffinity !== null && persistantKey !== null) { + if (persistentAffinity !== null && persistentKey !== null) { const room = (await read.getRoomReader().getById(jobContext.rid)) as ILivechatRoom; if (!room) { throw new Error(`${ErrorLogs.INVALID_ROOM_ID} ${jobContext.rid}`); diff --git a/lib/LivechatRoomClosedHandler.ts b/lib/LivechatRoomClosedHandler.ts index bde9a35..5bd672a 100644 --- a/lib/LivechatRoomClosedHandler.ts +++ b/lib/LivechatRoomClosedHandler.ts @@ -21,15 +21,15 @@ export class LivechatRoomClosedClass { public async closeChatFromSalesforce() { const { customFields, id: rid } = this.room; - const { persisantAffinity, persistantKey } = await retrievePersistentTokens(this.read, getRoomAssoc(rid)); + const { persistentAffinity, persistentKey } = await retrievePersistentTokens(this.read, getRoomAssoc(rid)); const salesforceChatApiEndpoint = await getSalesforceChatAPIEndpoint(this.read); - if (persisantAffinity !== null && persistantKey !== null) { + if (persistentAffinity !== null && persistentKey !== null) { let reason = ''; if (customFields && customFields.customerIdleTimeout === true) { reason = 'clientIdleTimeout'; } - await closeChat(this.http, salesforceChatApiEndpoint, persisantAffinity, persistantKey, reason) + await closeChat(this.http, salesforceChatApiEndpoint, persistentAffinity, persistentKey, reason) .then(async () => { console.log(InfoLogs.LIVEAGENT_SESSION_CLOSED); await this.persistence.removeByAssociation(getRoomAssoc(rid)); diff --git a/lib/OnUserTypingHandler.ts b/lib/OnUserTypingHandler.ts index 049c493..6ee7f9e 100644 --- a/lib/OnUserTypingHandler.ts +++ b/lib/OnUserTypingHandler.ts @@ -43,21 +43,21 @@ export class OnUserTypingHandler { return; } const assoc = getRoomAssoc(this.data.roomId); - const { persisantAffinity, persistantKey, sneakPeekEnabled } = await retrievePersistentData(this.read, assoc); + const { persistentAffinity, persistentKey, sneakPeekEnabled } = await retrievePersistentData(this.read, assoc); - if (persisantAffinity !== null && persistantKey !== null) { + if (persistentAffinity !== null && persistentKey !== null) { if (sneakPeekEnabled) { if (this.data.data.text || this.data.data.text === '') { - await chasitorSneakPeak(this.http, salesforceChatApiEndpoint, persisantAffinity, persistantKey, this.data.data.text) + await chasitorSneakPeak(this.http, salesforceChatApiEndpoint, persistentAffinity, persistentKey, this.data.data.text) .then(async () => { // ChasitorSneakPeak API Success }) .catch((error) => { - console.error(ErrorLogs.CHASITOR_SNEAKPEAK_API_CALL_FAIL, error); + console.error(ErrorLogs.CHASITOR_SNEAKPEEK_API_CALL_FAIL, error); }); } } else { - await chasitorTyping(this.http, salesforceChatApiEndpoint, persisantAffinity, persistantKey, this.data.typing) + await chasitorTyping(this.http, salesforceChatApiEndpoint, persistentAffinity, persistentKey, this.data.typing) .then(async () => { // ChasitorTyping/ChasitorNotTyping API Success }) diff --git a/lib/SalesforceAgentAssignedHandler.ts b/lib/SalesforceAgentAssignedHandler.ts index 8d68423..b2cebb3 100644 --- a/lib/SalesforceAgentAssignedHandler.ts +++ b/lib/SalesforceAgentAssignedHandler.ts @@ -21,10 +21,10 @@ export class SalesforceAgentAssignedClass { public async exec() { const assoc = getRoomAssoc(this.data.room.id); const salesforceBotUsername: string = await getAppSettingValue(this.read, AppSettingId.SALESFORCE_BOT_USERNAME); - const { persisantAffinity, persistantKey } = await retrievePersistentTokens(this.read, assoc); + const { persistentAffinity, persistentKey } = await retrievePersistentTokens(this.read, assoc); const FindingLiveagentMessage: string = await getAppSettingValue(this.read, AppSettingId.FINDING_LIVEAGENT_MESSAGE); - if (persisantAffinity === null && persistantKey === null && this.data.agent.username === salesforceBotUsername) { + if (persistentAffinity === null && persistentKey === null && this.data.agent.username === salesforceBotUsername) { const initiateSalesforceSession = new InitiateSalesforceSession( this.app, this.data,