7203 support emails links phones in zapier inputs 2 (#7562)

## 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">
This commit is contained in:
martmull
2024-10-10 15:32:06 +02:00
committed by GitHub
parent f4bc0c687e
commit 29bd74feea
9 changed files with 221 additions and 30 deletions

View File

@ -1,5 +1,5 @@
import { computeInputFields } from '../../utils/computeInputFields';
import { InputField } from '../../utils/data.types';
import { FieldMetadataType, InputField } from '../../utils/data.types';
describe('computeInputFields', () => {
test('should create Person input fields properly', () => {
@ -11,7 +11,7 @@ describe('computeInputFields', () => {
edges: [
{
node: {
type: 'RELATION',
type: FieldMetadataType.RELATION,
name: 'favorites',
label: 'Favorites',
description: 'Favorites linked to the contact',
@ -21,7 +21,7 @@ describe('computeInputFields', () => {
},
{
node: {
type: 'CURRENCY',
type: FieldMetadataType.CURRENCY,
name: 'annualSalary',
label: 'Annual Salary',
description: 'Annual Salary of the Person',
@ -31,7 +31,7 @@ describe('computeInputFields', () => {
},
{
node: {
type: 'TEXT',
type: FieldMetadataType.TEXT,
name: 'jobTitle',
label: 'Job Title',
description: 'Contacts job title',
@ -43,7 +43,7 @@ describe('computeInputFields', () => {
},
{
node: {
type: 'DATE_TIME',
type: FieldMetadataType.DATE_TIME,
name: 'updatedAt',
label: 'Update date',
description: null,
@ -55,7 +55,7 @@ describe('computeInputFields', () => {
},
{
node: {
type: 'FULL_NAME',
type: FieldMetadataType.FULL_NAME,
name: 'name',
label: 'Name',
description: 'Contacts name',
@ -68,7 +68,7 @@ describe('computeInputFields', () => {
},
{
node: {
type: 'UUID',
type: FieldMetadataType.UUID,
name: 'id',
label: 'Id',
description: null,
@ -81,7 +81,7 @@ describe('computeInputFields', () => {
},
{
node: {
type: 'NUMBER',
type: FieldMetadataType.NUMBER,
name: 'recordPosition',
label: 'RecordPosition',
description: 'Record Position',
@ -91,7 +91,7 @@ describe('computeInputFields', () => {
},
{
node: {
type: 'LINK',
type: FieldMetadataType.LINK,
name: 'xLink',
label: 'X',
description: 'Contacts X/Twitter account',
@ -101,7 +101,17 @@ describe('computeInputFields', () => {
},
{
node: {
type: 'EMAIL',
type: FieldMetadataType.LINKS,
name: 'whatsapp',
label: 'Whatsapp',
description: 'Contacts Whatsapp account',
isNullable: true,
defaultValue: null,
},
},
{
node: {
type: FieldMetadataType.EMAIL,
name: 'email',
label: 'Email',
description: 'Contacts Email',
@ -113,7 +123,7 @@ describe('computeInputFields', () => {
},
{
node: {
type: 'UUID',
type: FieldMetadataType.UUID,
name: 'companyId',
label: 'Company id (foreign key)',
description: 'Contacts company id foreign key',
@ -190,6 +200,27 @@ describe('computeInputFields', () => {
helpText: 'Contacts X/Twitter account: Link Label',
required: false,
},
{
key: 'whatsapp__url',
label: 'Whatsapp: Url',
type: 'string',
helpText: 'Contacts Whatsapp account: Link Url',
required: false,
},
{
key: 'whatsapp__label',
label: 'Whatsapp: Label',
type: 'string',
helpText: 'Contacts Whatsapp account: Link Label',
required: false,
},
{
key: 'whatsapp__secondaryLinks',
label: 'Whatsapp: Secondary Lings',
type: 'string',
helpText: 'Contacts Whatsapp account: Link Label',
required: false,
},
{
key: 'email',
label: 'Email',

View File

@ -14,6 +14,20 @@ describe('utils.handleQueryParams', () => {
domainName: 'Company Domain Name',
linkedinUrl__url: '/linkedin_url',
linkedinUrl__label: 'Test linkedinUrl',
whatsapp__primaryLinkUrl: '/whatsapp_url',
whatsapp__primaryLinkLabel: 'Whatsapp Link',
whatsapp__secondaryLinks: [
"{url: '/secondary_whatsapp_url',label: 'Secondary Whatsapp Link'}",
],
emails: {
primaryEmail: 'primary@email.com',
additionalEmails: ['secondary@email.com'],
},
phones: {
primaryPhoneNumber: '322110011',
primaryPhoneCountryCode: '+33',
additionalPhones: ["{ phoneNumber: '322110012', countryCode: '+33' }"],
},
xUrl__url: '/x_url',
xUrl__label: 'Test xUrl',
annualRecurringRevenue: 100000,
@ -23,9 +37,12 @@ describe('utils.handleQueryParams', () => {
const result = handleQueryParams(inputData);
const expectedResult =
'name: "Company Name", ' +
'address: { addressCity: "Paris" }, ' +
'address: {addressCity: "Paris"}, ' +
'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: "primary@email.com", additionalEmails: ["secondary@email.com"]}, ' +
'phones: {primaryPhoneNumber: "322110011", primaryPhoneCountryCode: "+33", additionalPhones: [{ phoneNumber: \'322110012\', countryCode: \'+33\' }]}, ' +
'xUrl: {url: "/x_url", label: "Test xUrl"}, ' +
'annualRecurringRevenue: 100000, ' +
'idealCustomerProfile: true, ' +