CHI-3946-quick_dial_with_config - #4622
Conversation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
…nt/AsyncIterable pattern Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
…basic-sms-test-methods
- Add SMS channel to twilio-iac/helplines/e2e/development.hcl using the messaging-lex-v3-blocking-lambda.tftpl template (same as aselo_webchat) and an empty contact_identity (conversations address managed separately) - Create twilio-iac/helplines/e2e/files/additional.configure.tf that uses a Twilio data source to look up the only phone number attached to the account at apply time and creates the SMS conversations address linked to the SMS studio flow - Guard twilio_conversations_configuration_addresses_v1 in channels/v1/main.tf so channels with an empty contact_identity skip automatic address creation (allowing helpline-specific additional.tf to manage it instead) Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
…basic-sms-test-methods
- Replace dynamic phone number lookup with hardcoded +12607821891 in both development.hcl and additional.configure.tf - Remove data source that previously scraped the phone number from the Twilio account - Set contact_identity to the hardcoded phone number in the SMS channel configuration Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
The twilio-iac/terraform-modules/channels/v1/main.tf module now automatically creates the SMS conversations address since contact_identity is no longer empty. The separate additional.configure.tf file is no longer needed. Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
- Add voice channel using voice-no-chatbot-operating-hours-blocking-lambda template - Use the same phone number (+12607821891) as the SMS channel - Include voice_ivr_greeting_message, voice_ivr_blocked_message, and voice_ivr_language - Follows established patterns used in other helplines for voice configurations Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
… CHI-3711-voice_test_poc
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
…nt/AsyncIterable pattern Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
- Add SMS channel to twilio-iac/helplines/e2e/development.hcl using the messaging-lex-v3-blocking-lambda.tftpl template (same as aselo_webchat) and an empty contact_identity (conversations address managed separately) - Create twilio-iac/helplines/e2e/files/additional.configure.tf that uses a Twilio data source to look up the only phone number attached to the account at apply time and creates the SMS conversations address linked to the SMS studio flow - Guard twilio_conversations_configuration_addresses_v1 in channels/v1/main.tf so channels with an empty contact_identity skip automatic address creation (allowing helpline-specific additional.tf to manage it instead) Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR migrates the Quick Dial UI from hardcoded/dummy options to options sourced from an account-scoped “private configuration” endpoint, then loads that configuration into the Flex plugin Redux state for UI consumption.
Changes:
- Added an account-scoped lambda route/handler (and unit tests) to return Twilio “private” configuration from S3.
- Added client-side service + Redux async action/reducer logic to load private Twilio configuration into state.
- Added a selector to read
quickDialOptionsfrom Redux for the UI.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| plugin-hrm-form/src/states/configuration/selectQuickDialOptions.ts | Adds selector to read quickDialOptions from Redux state. |
| plugin-hrm-form/src/states/configuration/reducer.ts | Extends configuration state to include twilioPrivateConfiguration and wires in the loader reducer. |
| plugin-hrm-form/src/states/configuration/loadPrivateTwilioConfig.ts | Adds async action + reducer to fetch/store private Twilio configuration. |
| plugin-hrm-form/src/services/fetchProtectedApi.ts | Adds account-scoped GET helper and improves error wrapping for protected API calls. |
| plugin-hrm-form/src/services/configurationService.ts | Adds service wrapper to fetch the private Twilio configuration from account-scoped lambda. |
| plugin-hrm-form/src/HrmFormPlugin.tsx | Dispatches private configuration load during plugin initialization. |
| lambdas/account-scoped/tests/unit/configuration/getTwilioPrivateConfiguration.test.ts | Adds unit tests for the new private configuration handler. |
| lambdas/account-scoped/src/router.ts | Registers the new account-scoped configuration/twilioPrivate route. |
| lambdas/account-scoped/src/configuration/getTwilioPrivateConfiguration.ts | Implements handler that reads/parses twilio-private.json from S3. |
| lambdas/account-scoped/package.json | Adds @tech-matters/s3 dependency for S3 reads in the lambda. |
Suppressed comments (1)
plugin-hrm-form/src/services/configurationService.ts:23
getPrivateTwilioConfigurationusesgetFromAccountScopedLambda(GET), but the account-scoped router protects this endpoint withvalidateFlexTokenRequestwhich currently only acceptsTokenfrom the request body. As written, this call will be rejected as missingToken.
export const getPrivateTwilioConfiguration = async (): Promise<ConfigurationState['twilioPrivateConfiguration']> =>
getFromAccountScopedLambda(`configuration/twilioPrivate`);
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
# Conflicts: # lambdas/account-scoped/src/router.ts # plugin-hrm-form/src/HrmFormPlugin.tsx
|
@copilot - fix the failing unit tests and add unit tests for all new / changed code in this PR except for react components |
Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
Addressed in commit 280419c. I fixed the failing configuration reducer unit expectations and added unit tests for the new/changed non-React quick-dial configuration code paths (configuration service, account-scoped lambda fetch helper, quick-dial selector, async configuration reducer behavior, and flex token header/body validation). |
|
@copilot One unit test is still failing |
Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
plugin-hrm-form/src/services/fetchProtectedApi.ts:69
fetchOptionsis spread after theheadersobject, so if a caller passesfetchOptions.headers, it will overwrite the entireheadersobject and silently drop theAuthorization/Content-Typeheaders. This can break auth (and is easy to miss because tests don’t cover the overriding case).
'Content-Type': contentType,
...fetchOptions?.headers,
},
...fetchOptions,
};
plugin-hrm-form/src/states/configuration/loadAseloTwilioConfiguration.ts:42
- The fulfilled reducer stores the remote JSON payload directly into Redux without whitelisting/validation. Since this data comes from S3 (arbitrary JSON), unexpected keys will be persisted client-side and a malformed
quickDialOptionsvalue (e.g. non-array) can later crash the UI when it’s mapped. Prefer projecting the payload into the expected shape before storing it.
(state, { payload }): ConfigurationState => {
return {
...state,
aseloTwilioConfiguration: payload,
};
CHI-3711: POC for voice and sms E2E tests - CI only
Description
This PR moves the quick dial UI over from dummy hardcoded values to using the private config endpoint set up in copilot/add_private_configuration_endpoint (those changes are included inthis PR)
Checklist
Other Related Issues
None
Verification steps
AFTER YOU MERGE
You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P