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

7203 support emails links phones in zapier inputs 2 #7562

Merged
merged 4 commits into from
Oct 10, 2024

Conversation

martmull
Copy link
Contributor

Done

  • add EMAILS, PHONES, LINKS, RICH_TEXT, POSITION, and ARRAY field support in Twenty zapier integration
  • fix twenty-zapier package tests and requirements

Emails

image

Links

image

Phones

image

Array

image

@martmull martmull linked an issue Oct 10, 2024 that may be closed by this pull request
@martmull martmull marked this pull request as ready for review October 10, 2024 13:23
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This pull request enhances the Twenty Zapier integration by adding support for new field types, including EMAILS, PHONES, LINKS, RICH_TEXT, POSITION, and ARRAY.

  • Updated computeInputFields.ts to handle new field types, improving type safety with FieldMetadataType enum
  • Added formatArrayInputData function in handleQueryParams.ts for processing complex array inputs
  • Expanded FieldMetadataType enum and updated NodeField and InputField types in data.types.ts
  • Modified test files to cover new field types and their expected behaviors
  • Added 'dotenv' dependency to package.json for environment variable management

8 file(s) reviewed, 9 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +219 to +221
label: 'Whatsapp: Secondary Lings',
type: 'string',
helpText: 'Contact’s Whatsapp account: Link Label',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: 'Secondary Lings' is misspelled, should be 'Secondary Links'

Comment on lines +19 to +21
whatsapp__secondaryLinks: [
"{url: '/secondary_whatsapp_url',label: 'Secondary Whatsapp Link'}",
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The whatsapp__secondaryLinks array contains a string instead of an object. This might cause issues when parsing the data.

phones: {
primaryPhoneNumber: '322110011',
primaryPhoneCountryCode: '+33',
additionalPhones: ["{ phoneNumber: '322110012', countryCode: '+33' }"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The additionalPhones array contains a string representation of an object instead of an actual object. This might lead to parsing issues.

'domainName: "Company Domain Name", ' +
'linkedinUrl: {url: "/linkedin_url", label: "Test linkedinUrl"}, ' +
'whatsapp: {primaryLinkUrl: "/whatsapp_url", primaryLinkLabel: "Whatsapp Link", secondaryLinks: [{url: \'/secondary_whatsapp_url\',label: \'Secondary Whatsapp Link\'}]}, ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: The expected result for whatsapp.secondaryLinks contains escaped single quotes. Ensure this matches the actual output of handleQueryParams.

'domainName: "Company Domain Name", ' +
'linkedinUrl: {url: "/linkedin_url", label: "Test linkedinUrl"}, ' +
'whatsapp: {primaryLinkUrl: "/whatsapp_url", primaryLinkLabel: "Whatsapp Link", secondaryLinks: [{url: \'/secondary_whatsapp_url\',label: \'Secondary Whatsapp Link\'}]}, ' +
'emails: {primaryEmail: "[email protected]", additionalEmails: ["[email protected]"]}, ' +
'phones: {primaryPhoneNumber: "322110011", primaryPhoneCountryCode: "+33", additionalPhones: [{ phoneNumber: \'322110012\', countryCode: \'+33\' }]}, ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: The expected result for phones.additionalPhones contains an object literal without quotes. Verify if this matches the actual output of handleQueryParams.

@@ -141,6 +148,84 @@ const get_subfieldsFromField = (nodeField: NodeField): NodeField[] => {
};
return [address1, address2, city, state, postalCode, country];
}
case FieldMetadataType.PHONES: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: The structure for PHONES is more complex than other fields. Consider extracting this into a separate function for better readability

@@ -1,5 +1,17 @@
import { InputData } from '../utils/data.types';

const OBJECT_SUBFIELD_NAMES = ['secondaryLinks', 'additionalPhones'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using a more descriptive name for OBJECT_SUBFIELD_NAMES, such as ARRAY_OBJECT_SUBFIELD_NAMES, to better reflect its purpose

Comment on lines +32 to +35
if (Array.isArray(formattedInputData[key])) {
result = result.concat(
`${key}: [${formatArrayInputData(key, formattedInputData)}], `,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Ensure that formatArrayInputData is called with the correct arguments. The second argument should be formattedInputData[key], not the entire formattedInputData object

Comment on lines +14 to +17
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using a single pattern '**/*.{spec,test}.{ts,tsx}' to cover all test files

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@martmull martmull merged commit 29bd74f into main Oct 10, 2024
5 checks passed
@martmull martmull deleted the 7203-support-emails-links-phones-in-zapier-inputs-2 branch October 10, 2024 13:32
harshit078 pushed a commit to harshit078/twenty that referenced this pull request Oct 14, 2024
## Done
- add `EMAILS`, `PHONES`, `LINKS`, `RICH_TEXT`, `POSITION`, and `ARRAY`
field support in Twenty zapier integration
- fix `twenty-zapier` package tests and requirements

## Emails
<img width="791" alt="image"
src="https://github.com/user-attachments/assets/7987a1a2-6076-4715-9221-d4a1898b7634">

## Links
<img width="797" alt="image"
src="https://github.com/user-attachments/assets/b94ce972-fae2-4953-b9e8-79c0478f5f60">

## Phones
<img width="789" alt="image"
src="https://github.com/user-attachments/assets/7234eaaf-40b8-4772-8880-c58ba47618c5">

## Array
<img width="834" alt="image"
src="https://github.com/user-attachments/assets/99cb6795-e428-40ea-9c3a-d52561c2c6e1">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support EMAILS, LINKS, PHONES in Zapier Inputs
2 participants