Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions e2e-tests/chatScripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ import {
import { getConfigValue } from './config';

export const defaultScript: ChatStatement[] = [
botStatement(
'Welcome. To help us better serve you, please answer the following questions. Are you calling about yourself? Please answer Yes or No.',
),
botStatement('Welcome to the helpline. Please answer the following questions.'),
callerStatement('yes'),
botStatement('How old are you?'),
callerStatement('10'),
botStatement('What is your gender?'),
callerStatement('girl'),
botStatement("We'll transfer you now. Please hold for a counsellor."),
botStatement('We will transfer you now. Please hold for a counsellor.'),
counselorAutoStatement('Hi, this is the counsellor. How can I help you?'),
callerStatement('CALLER TEST CHAT MESSAGE'),
counselorStatement('COUNSELLOR TEST CHAT MESSAGE'),
Expand Down
37 changes: 33 additions & 4 deletions plugin-hrm-form/src/maskIdentifiers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable import/no-unused-modules */
/* eslint-disable import/no-unused-modules,dot-notation */
/**
* Copyright (C) 2021-2023 Technology Matters
* This program is free software: you can redistribute it and/or modify
Expand All @@ -14,7 +14,17 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
import { Strings, TaskChannelDefinition, MessagingCanvas, MessageList } from '@twilio/flex-ui';
import {
Strings,
TaskChannelDefinition,
MessagingCanvas,
MessageList,
StateHelper,
ConversationHelper,
TaskHelper,
DefaultTaskChannels,
Manager,
} from '@twilio/flex-ui';

import { getInitializedCan } from '../permissions/rules';
import { PermissionActions } from '../permissions/actions';
Expand All @@ -24,7 +34,7 @@ export const maskChannelStringsWithIdentifiers = (channelType: TaskChannelDefini
const can = getInitializedCan();
const maskIdentifiers = !can(PermissionActions.VIEW_IDENTIFIERS);
if (!maskIdentifiers) return;

const { strings } = Manager.getInstance();
const {
IncomingTaskCanvas,
TaskListItem,
Expand All @@ -40,7 +50,26 @@ export const maskChannelStringsWithIdentifiers = (channelType: TaskChannelDefini

// Task list and panel when a call comes in
TaskListItem.firstLine = 'MaskIdentifiers';

if (channelType.name === DefaultTaskChannels.ChatSms.name) {
// The unmasked service user number appears in the last message info on SMS if they sent the last message
// Let's replace it with a version that doesn't include the sender's identity, regardless of who sent the last message.
TaskListItem.secondLine = task => {
const taskHelper = new TaskHelper(task);
const conversationState = StateHelper.getConversationStateForTask(task);
if (!conversationState) {
return taskHelper.durationSinceUpdate;
}
const conversationHelper = new ConversationHelper(conversationState);
if (!conversationHelper.lastMessage) {
return taskHelper.durationSinceUpdate;
}
return `${taskHelper.durationSinceUpdate} | ${
conversationHelper.lastMessage.isFromMe
? conversationHelper.lastMessage.authorName
: strings['MaskIdentifiers'] ?? 'XXXXXX'
}: ${conversationHelper.lastMessage.source.body ?? ''}`;
};
}
// Task panel during an active call
TaskCanvasHeader.title = 'MaskIdentifiers';
Supervisor.TaskCanvasHeader.title = 'MaskIdentifiers';
Expand Down
3 changes: 1 addition & 2 deletions twilio-iac/helplines/tz/staging.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ locals {

local_config = {
enable_post_survey = true
enable_lex_v2 = false
lex_v2_bot_languages = false
lex_v2_bot_languages = { }
enable_datadog_monitoring = false
custom_task_routing_filter_expression = "channelType IN [ 'whatsapp', 'instagram'] OR (channelType IN ['web'] AND preEngagementData.area == 'Main Land') OR (channelType IN ['web'] AND preEngagementData.language == 'sw_TZ' AND worker.routing.skills HAS 'Swahili') OR (channelType IN ['messenger'] AND facebookPage == 'mainland') OR twilioNumber == 'instagram:17841472327571934'"

Expand Down
29 changes: 29 additions & 0 deletions webchat/configurations/usvc-production.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright (C) 2021-2023 Technology Matters
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/

import { Configuration } from '../types';
import { config as usvcStaging } from '../configurations/usvc-staging';

const accountSid = 'AC3240f813a27a4c52b12e5c5c23960b25';
const flexFlowSid = 'FO98a2a2bf5f016669bba61ef9c19983aa';

export const config: Configuration = {
...usvcStaging,
checkOpenHours: false,
accountSid,
flexFlowSid,
twilioServicesUrl: new URL(`https://hrm-production.tl.techmatters.org/lambda/twilio/account-scoped/${accountSid}`),
};
Loading