Skip to content

Commit

Permalink
Merge branch 'CHI-2317-refactor_contact_redux' into CHI-1976-case_tim…
Browse files Browse the repository at this point in the history
…eline_rework
  • Loading branch information
stephenhand committed Dec 11, 2023
2 parents 2aa916c + 2cee38d commit 211ecdf
Show file tree
Hide file tree
Showing 28 changed files with 242 additions and 163 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,22 @@ jobs:
working-directory: ./plugin-hrm-form
shell: bash

- name: Set Twilio account SID
uses: "marvinpinto/action-inject-ssm-secrets@latest"
with:
ssm_parameter: "/development/twilio/E2E/account_sid"
env_variable_name: "TWILIO_ACCOUNT_SID"

- name: Set Twilio Auth Token
uses: "marvinpinto/action-inject-ssm-secrets@latest"
with:
ssm_parameter: "/development/twilio/${{env.TWILIO_ACCOUNT_SID}}/auth_token"
env_variable_name: "TWILIO_AUTH_TOKEN"

- name: Replace Twilio account SID in appConfig.js
uses: falnyr/replace-env-vars-action@master
env:
TWILIO_ACCOUNT_SID: ${{ secrets.E2E_DEV_ACCOUNT_SID}}
TWILIO_ACCOUNT_SID: ${{env.TWILIO_ACCOUNT_SID}}
with:
filename: ./plugin-hrm-form/public/appConfig.js

Expand Down Expand Up @@ -79,7 +91,7 @@ jobs:
working-directory: ./plugin-hrm-form

- name: Run Flex Dev Server
run: NODE_ENV=development REACT_APP_FORM_DEFINITIONS_BASE_URL=http://localhost:8090 TWILIO_ACCOUNT_SID=${{secrets.E2E_DEV_ACCOUNT_SID}} TWILIO_AUTH_TOKEN=${{secrets.E2E_DEV_AUTH_TOKEN}} npm run start &
run: NODE_ENV=development REACT_APP_FORM_DEFINITIONS_BASE_URL=http://localhost:8090 TWILIO_ACCOUNT_SID=${{env.TWILIO_ACCOUNT_SID}} TWILIO_AUTH_TOKEN=${{env.TWILIO_AUTH_TOKEN}} npm run start &
working-directory: ./plugin-hrm-form

- name: Run e2e tests
Expand Down
41 changes: 39 additions & 2 deletions .github/workflows/flex-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,27 @@ jobs:
- name: Run hrm-form-definitions Tests
run: npm run test
working-directory: ./hrm-form-definitions
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Set Twilio account SID for AS DEV
uses: "marvinpinto/action-inject-ssm-secrets@latest"
with:
ssm_parameter: "/development/twilio/AS/account_sid"
env_variable_name: "TWILIO_ACCOUNT_SID"

- name: Set Twilio Auth Token for AS DEV
uses: "marvinpinto/action-inject-ssm-secrets@latest"
with:
ssm_parameter: "/development/twilio/${{env.TWILIO_ACCOUNT_SID}}/auth_token"
env_variable_name: "TWILIO_AUTH_TOKEN"

- name: Run plugin-hrm-form Tests
run: TWILIO_ACCOUNT_SID=${{secrets.AS_DEV_ACCOUNT_SID}} TWILIO_AUTH_TOKEN=${{secrets.AS_DEV_AUTH_TOKEN}} npm run test
run: TWILIO_ACCOUNT_SID=${{env.TWILIO_ACCOUNT_SID}} TWILIO_AUTH_TOKEN=${{env.TWILIO_AUTH_TOKEN}} npm run test
working-directory: ./plugin-hrm-form
env:
CI: true
Expand All @@ -82,6 +100,25 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: '16.x'

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Set Twilio account SID for E2E
uses: "marvinpinto/action-inject-ssm-secrets@latest"
with:
ssm_parameter: "/development/twilio/E2E/account_sid"
env_variable_name: "TWILIO_ACCOUNT_SID"

- name: Set Twilio Auth Token for E2E
uses: "marvinpinto/action-inject-ssm-secrets@latest"
with:
ssm_parameter: "/development/twilio/${{env.TWILIO_ACCOUNT_SID}}/auth_token"
env_variable_name: "TWILIO_AUTH_TOKEN"

- name: Install Flex Plugin
uses: ./.github/actions/install-flex-plugin
Expand Down Expand Up @@ -114,7 +151,7 @@ jobs:

- name: Run Flex Dev Server
# Creds aren't used in the tests, but I don't think the dev server starts without some set.
run: NODE_ENV=development REACT_APP_FORM_DEFINITIONS_BASE_URL=http://localhost:8090 TWILIO_ACCOUNT_SID=${{secrets.E2E_DEV_ACCOUNT_SID}} TWILIO_AUTH_TOKEN=${{secrets.E2E_DEV_AUTH_TOKEN}} npm run start &
run: NODE_ENV=development REACT_APP_FORM_DEFINITIONS_BASE_URL=http://localhost:8090 TWILIO_ACCOUNT_SID=${{env.TWILIO_ACCOUNT_SID}} TWILIO_AUTH_TOKEN=${{env.TWILIO_AUTH_TOKEN}} npm run start &
working-directory: ./plugin-hrm-form

- name: Run e2e tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flex-deploy-all-production-helplines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ jobs:
with:
project: flex
helplines: ${{ needs.configure.outputs.target_helplines }}
environments: '[ "PROD" ]'
environments: '[ "production" ]'
changelog: ${{ inputs.changelog }}
2 changes: 1 addition & 1 deletion .github/workflows/flex-deploy-all-staging-helplines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ jobs:
with:
project: flex
helplines: ${{ needs.configure.outputs.target_helplines }}
environments: '[ "STG" ]'
environments: '[ "staging" ]'
changelog: ${{ inputs.changelog }}
20 changes: 14 additions & 6 deletions .github/workflows/flex-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
TWILIO_ACCOUNT_SID_SECRET_NAME: ${{inputs.helpline_code}}_${{inputs.environment_code}}_ACCOUNT_SID
TWILIO_AUTH_TOKEN_SECRET_NAME: ${{inputs.helpline_code}}_${{inputs.environment_code}}_AUTH_TOKEN

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -67,12 +64,23 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: '16.x'
# Call main-action to compile and deploy
- name: Set Twilio account SID
uses: "marvinpinto/action-inject-ssm-secrets@latest"
with:
ssm_parameter: "/${{inputs.environment_code}}/twilio/${{inputs.helpline_code}}/account_sid"
env_variable_name: "TWILIO_ACCOUNT_SID"
- name: Set Twilio Auth Token
uses: "marvinpinto/action-inject-ssm-secrets@latest"
with:
ssm_parameter: "/${{inputs.environment_code}}/twilio/${{env.TWILIO_ACCOUNT_SID}}/auth_token"
env_variable_name: "TWILIO_AUTH_TOKEN"

# Call main-action to compile and deploy secrets.AS_DEV_ACCOUNT_SID
- name: Executing main-action
uses: ./.github/actions/main-action
with:
account-sid: ${{ secrets[env.TWILIO_ACCOUNT_SID_SECRET_NAME] }}
auth-token: ${{ secrets[env.TWILIO_AUTH_TOKEN_SECRET_NAME] }}
account-sid: ${{env.TWILIO_ACCOUNT_SID}}
auth-token: ${{env.TWILIO_AUTH_TOKEN}}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
[
{
"name": "summary",
"label": "Summary ",
"label": "Summary",
"editLabel": "Edit Summary",
"type": "textarea",
"rows": 20,
"width": 300,
"placeholder": "Enter a summary of the case"
"width": 500,
"placeholder": "Enter a summary of the client"
},
{
"name": "recommended approach",
"name": "recommendedApproach",
"label": "Recommended Approach",
"editLabel": "Edit Recommended Approach",
"type": "textarea",
"rows": 20,
"width": 300,
"placeholder": "Enter recommended approach "
"width": 500,
"placeholder": "Enter recommended approach"
},
{
"name": "details",
"label": "Details",
"editLabel": "Edit Details",
"type": "textarea",
"rows": 20,
"width": 300,
"width": 500,
"placeholder": "Enter Details"
}
]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"name": "summary",
"label": "Summary",
"editLabel": "Edit Summary",
"type": "textarea",
"rows": 20,
"width": 500,
"placeholder": "Ingrese un resumen del cliente"
},
{
"name": "somethingElse",
"label": "Something Else",
"editLabel": "Edit Something Else",
"type": "textarea",
"rows": 20,
"width": 500,
"placeholder": "Ingrese el enfoque recomendado"
}
]
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
[
{
"name": "summary",
"label": "Summary ",
"label": "Summary",
"editLabel": "Edit Summary",
"type": "textarea",
"rows": 20,
"width": 300,
"placeholder": "Enter a summary of the case"
"width": 500,
"placeholder": "Enter a summary of the client"
},
{
"name": "recommended approach",
"name": "recommendedApproach",
"label": "Recommended Approach",
"editLabel": "Edit Recommended Approach",
"type": "textarea",
"rows": 20,
"width": 300,
"placeholder": "Enter recommended approach "
"width": 500,
"placeholder": "Enter recommended approach"
},
{
"name": "details",
"label": "Details",
"editLabel": "Edit Details",
"type": "textarea",
"rows": 20,
"width": 300,
"width": 500,
"placeholder": "Enter Details"
}
]
]
4 changes: 2 additions & 2 deletions hrm-form-definitions/src/formDefinition/loadDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
isSelectDefinitionWithReferenceOptions,
LayoutVersion,
CategoriesDefinition,
ProfileSection,
ProfileSectionDefinition,
} from './types';
import { OneToManyConfigSpecs, OneToOneConfigSpec } from './insightsConfig';

Expand Down Expand Up @@ -197,7 +197,7 @@ export async function loadDefinition(baseUrl: string): Promise<DefinitionVersion
),
fetchDefinition<Record<string, any>>('ReferenceData.json', {}),
fetchDefinition<string[]>('BlockedEmojis.json', []),
fetchDefinition<ProfileSection[]>('profileForms/Sections.json', []),
fetchDefinition<ProfileSectionDefinition[]>('profileForms/Sections.json', []),
]);

const { helplines } = helplineInformation;
Expand Down
5 changes: 3 additions & 2 deletions hrm-form-definitions/src/formDefinition/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,10 @@ type CustomContactComponentDefinition = ItemBase &
props?: Record<string, boolean | number | string>;
};

export declare type ProfileSection = {
export declare type ProfileSectionDefinition = {
name: string;
label: string;
editLabel: string;
type: string;
rows: number;
placeholder: string;
Expand Down Expand Up @@ -338,5 +339,5 @@ export type DefinitionVersion = {
};
referenceData?: Record<string, any>;
blockedEmojis: string[];
profileForms?: { Sections: ProfileSection[] };
profileForms?: { Sections: ProfileSectionDefinition[] };
};
9 changes: 6 additions & 3 deletions plugin-hrm-form/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,22 @@ import { BannerContainer, Text, CaseLink, BannerActionLink } from './styles';
import InfoIcon from './InfoIcon';
import { showRemovedFromCaseBannerAction } from '../../states/case/caseBanners';
import selectCaseByCaseId from '../../states/case/selectCaseStateByCaseId';
import { RootState } from '../../states';

type OwnProps = {
taskId: string;
};

type Props = OwnProps & ReturnType<typeof mapStateToProps> & ReturnType<typeof mapDispatchToProps>;

const mapStateToProps = (state, { taskId }: OwnProps) => {
const mapStateToProps = (state: RootState, { taskId }: OwnProps) => {
const { savedContact } = selectContactByTaskSid(state, taskId);
const connectedCase = selectCaseByCaseId(state, savedContact.caseId ?? '')?.connectedCase;
const caseId = savedContact?.caseId;
return {
contact: savedContact,
connectedCase,
caseId,
};
};

Expand All @@ -58,6 +61,7 @@ const ContactAddedToCaseBanner: React.FC<Props> = ({
contact,
viewCaseDetails,
removeContactFromCase,
caseId,
}) => {
if (connectedCase === undefined) return null;

Expand All @@ -69,7 +73,7 @@ const ContactAddedToCaseBanner: React.FC<Props> = ({
</Text>
<CaseLink type="button" onClick={() => viewCaseDetails(connectedCase)}>
<Template code="Case-CaseNumber" />
{connectedCase.id}
{caseId}
</CaseLink>
<BannerActionLink type="button" onClick={() => removeContactFromCase(contact.id)}>
<Template code="CaseMerging-RemoveFromCase" />
Expand Down
Loading

0 comments on commit 211ecdf

Please sign in to comment.