@twilio/flex-ui
Version:
Twilio Flex UI
32 lines (31 loc) • 2.06 kB
TypeScript
/**
* These helpers are used in the SLO journeys for these usecases:
* - task-completion: when the customer hangs up a voice call before the agent. We have no visibility in the UI who has hung up the call,
* so we use localStorage in order to track whether we have already sent a "start" event for the 'complete' (wrapup) action,
* which would indicate that the agent has hung up the call first. If that localStorage item is not found, it means that
* the customer has hung up first, or that another agent in the call (if applicable) has done so,
* and so we are able to send an additional "start" event and have a complete SLO journey for the task completion (start & complete).
*
* - task-transfer: in external warm transfers, when the agent cancels the transfer before the external number picks up,
* we send a 'cancelled' event and store the task sid in localstorage with these helpers. Later when the 'complete' event
* is about to get sent, we check with this localstorage item whether we've already send the event, and avoid doing so for the second time.
*/
/**
* Saves an identifier to a localStorage array item.
* If the array already exists, it adds to the array instead of creating a new one.
*
* @param {string} trackerName the name of the Tracker used
* @param {string} id the task sid to store
* @example setTaskSidToLocalStorage(TaskCompletionTracker.trackerName, details.task_sid);
*/
export declare function setTaskSidToLocalStorage(trackerName: string, id: string): void;
/**
* Searches for the localStorage item specified. If found, it immediately removes it.
* Returns a boolean based on whether the localstorage item was found or not.
*
* @param {string} trackerName the name of the Tracker used
* @param {string} id the identifier to store
* @returns {boolean} true / false based on the result of the search
* @example const found = findTaskSidInLocalStorage(TaskCompletionTracker.trackerName, details.task_sid);
*/
export declare function findTaskSidInLocalStorage(trackerName: string, id?: string): boolean;