Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gridspace): implement uploadContactToCampaign action in gridspace extension #481

Merged
merged 5 commits into from
Oct 14, 2024

Conversation

mohsinht
Copy link
Contributor

@mohsinht mohsinht commented Oct 11, 2024

User description

For context, see: https://linear.app/awell/issue/TP-2540/update-the-gridspace-extension

This PR implements "Upload Contacts to Campaign" in the Gridspace Extension. Api endpoint documentation can be found here: https://docs.gridspace.com/docs/monophone/mm37fjyb66m01-upload-contacts-to-campaign


PR Type

Enhancement, Tests


Description

  • Implemented the uploadContactToCampaign action to add contacts to a Gridspace autodialer campaign.
  • Added tests for the uploadContactToCampaign action to ensure functionality.
  • Enhanced GridspaceClient with a new method to handle contact uploads.
  • Improved handling of profile data in callWithGrace action using isNil for null checks.

Changes walkthrough 📝

Relevant files
Enhancement
callWithGrace.ts
Improve profile data handling with `isNil` check                 

extensions/gridspace/actions/callWithGrace/callWithGrace.ts

  • Added isNil import from lodash.
  • Modified profile data handling to use isNil for null checks.
  • +3/-2     
    index.ts
    Export new `uploadContactToCampaign` action                           

    extensions/gridspace/actions/index.ts

    • Added uploadContactToCampaign action to exports.
    +2/-0     
    config.ts
    Define fields and validation for `uploadContactToCampaign`

    extensions/gridspace/actions/uploadContactToCampaign/config.ts

  • Defined fields for uploadContactToCampaign action.
  • Implemented validation schema for fields.
  • +77/-0   
    index.ts
    Export `uploadContactToCampaign` module                                   

    extensions/gridspace/actions/uploadContactToCampaign/index.ts

    • Exported uploadContactToCampaign module.
    +1/-0     
    uploadContactToCampaign.ts
    Implement `uploadContactToCampaign` action                             

    extensions/gridspace/actions/uploadContactToCampaign/uploadContactToCampaign.ts

  • Implemented uploadContactToCampaign action.
  • Utilized GridspaceClient to upload contacts.
  • +51/-0   
    client.ts
    Extend `GridspaceClient` with contact upload capability   

    extensions/gridspace/lib/client.ts

  • Added uploadContactsToCampaign method to GridspaceClient.
  • Made client property readonly.
  • +14/-3   
    Tests
    uploadContactToCampaign.test.ts
    Add tests for `uploadContactToCampaign` action                     

    extensions/gridspace/actions/uploadContactToCampaign/uploadContactToCampaign.test.ts

  • Added tests for uploadContactToCampaign action.
  • Mocked GridspaceClient for testing.
  • +60/-0   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    @mohsinht mohsinht added the enhancement New feature or request label Oct 11, 2024
    @mohsinht mohsinht requested a review from bejoinka October 11, 2024 14:55
    @mohsinht mohsinht self-assigned this Oct 11, 2024
    @github-actions github-actions bot added tests Adds or updates tests for an extension Review effort [1-5]: 3 labels Oct 11, 2024
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Code Consistency
    The import statement for 'settings' has been changed from destructured import to type-only import, which might affect how settings are used elsewhere in the module if they are not purely for type checking.

    Error Handling
    The JSON parsing and validation in the 'FieldsSchema' could be improved by handling specific parsing errors more gracefully and providing more detailed error messages to aid debugging.

    Type Safety
    The use of 'ts-expect-error' to bypass TypeScript's type checking could lead to runtime errors if the types of 'contactData' properties do not match the expected string type.

    @awell-health awell-health deleted a comment from github-actions bot Oct 11, 2024
    @bejoinka bejoinka merged commit 332c112 into main Oct 14, 2024
    1 check passed
    @bejoinka bejoinka deleted the tp-2540-update-the-gridspace-extension branch October 14, 2024 16:05
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    enhancement New feature or request Review effort [1-5]: 3 tests Adds or updates tests for an extension
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants