diff --git a/packages/destination-actions/src/destinations/sendgrid/sendEmail/__tests__/__snapshots__/snapshot.test.ts.snap b/packages/destination-actions/src/destinations/sendgrid/sendEmail/__tests__/__snapshots__/snapshot.test.ts.snap index fdc8142842..b55db3fe55 100644 --- a/packages/destination-actions/src/destinations/sendgrid/sendEmail/__tests__/__snapshots__/snapshot.test.ts.snap +++ b/packages/destination-actions/src/destinations/sendgrid/sendEmail/__tests__/__snapshots__/snapshot.test.ts.snap @@ -16,13 +16,13 @@ Object { Object { "bcc": Array [ Object { - "email": "oz@ogmeftik.fj", + "email": "tik@did.mr", "name": "!s3p^", }, ], "cc": Array [ Object { - "email": "oz@ogmeftik.fj", + "email": "tik@did.mr", "name": "!s3p^", }, ], @@ -37,14 +37,14 @@ Object { }, "to": Array [ Object { - "email": "oz@ogmeftik.fj", + "email": "tik@did.mr", "name": "!s3p^", }, ], }, ], "reply_to": Object { - "email": "oz@ogmeftik.fj", + "email": "tik@did.mr", "name": "!s3p^", }, "template_id": "d-1234567890", @@ -54,20 +54,20 @@ Object { exports[`Testing snapshot for Sendgrid's sendEmail destination action: required fields 1`] = ` Object { "from": Object { - "email": "oz@ogmeftik.fj", + "email": "tik@did.mr", }, "personalizations": Array [ Object { "headers": Object {}, "to": Array [ Object { - "email": "oz@ogmeftik.fj", + "email": "tik@did.mr", }, ], }, ], "reply_to": Object { - "email": "oz@ogmeftik.fj", + "email": "tik@did.mr", }, "template_id": "d-1234567890", } diff --git a/packages/destination-actions/src/destinations/sendgrid/sendEmail/fields.ts b/packages/destination-actions/src/destinations/sendgrid/sendEmail/fields.ts index 6849e7de64..c288707660 100644 --- a/packages/destination-actions/src/destinations/sendgrid/sendEmail/fields.ts +++ b/packages/destination-actions/src/destinations/sendgrid/sendEmail/fields.ts @@ -22,6 +22,7 @@ export const fields: Record = { label: 'Email', description: 'The email address of the sender.', type: 'string', + format: 'email', required: true }, name: { @@ -36,7 +37,7 @@ export const fields: Record = { label: 'To', description: 'Recipient details.', type: 'object', - multiple: true, + multiple: false, required: true, additionalProperties: false, defaultObjectUI: 'keyvalue', @@ -44,6 +45,7 @@ export const fields: Record = { email: { label: 'Email', description: 'The email address of the recipient.', + format: 'email', type: 'string', required: true }, @@ -55,17 +57,12 @@ export const fields: Record = { } }, default: { - '@arrayPath': [ - '$.properties', - { - email: { - '@path': '$.email' - }, - name: { - '@path': '$.name' - } - } - ] + email: { + '@path': '$.properties.email' + }, + name: { + '@path': '$.properties.name' + } } }, cc: { @@ -81,6 +78,7 @@ export const fields: Record = { label: 'Email', description: 'The email address of the CC recipient.', type: 'string', + format: 'email', required: true }, name: { @@ -105,6 +103,7 @@ export const fields: Record = { label: 'Email', description: 'The email address of the BCC recipient.', type: 'string', + format: 'email', required: true }, name: { @@ -170,6 +169,7 @@ export const fields: Record = { label: 'Email', description: 'The email to reply to.', type: 'string', + format: 'email', required: false }, name: { diff --git a/packages/destination-actions/src/destinations/sendgrid/sendEmail/generated-types.ts b/packages/destination-actions/src/destinations/sendgrid/sendEmail/generated-types.ts index 39ce824f04..013005396b 100644 --- a/packages/destination-actions/src/destinations/sendgrid/sendEmail/generated-types.ts +++ b/packages/destination-actions/src/destinations/sendgrid/sendEmail/generated-types.ts @@ -30,7 +30,7 @@ export interface Payload { * The name of the recipient. */ name?: string - }[] + } /** * CC recipient details */ diff --git a/packages/destination-actions/src/destinations/sendgrid/sendEmail/utils.ts b/packages/destination-actions/src/destinations/sendgrid/sendEmail/utils.ts index 9c9a5ff7e2..a9671a69cf 100644 --- a/packages/destination-actions/src/destinations/sendgrid/sendEmail/utils.ts +++ b/packages/destination-actions/src/destinations/sendgrid/sendEmail/utils.ts @@ -18,7 +18,7 @@ export async function send(request: RequestClient, payload: Payload) { const json: SendEmailReq = { personalizations: [ { - to: payload.to.map((to) => ({ email: to.email, name: to?.name ?? undefined })), + to: [{ email: payload.to.email, name: payload.to?.name ?? undefined }], cc: payload.cc?.map((cc) => ({ email: cc.email, name: cc?.name ?? undefined })) ?? undefined, bcc: payload.bcc?.map((bcc) => ({ email: bcc.email, name: bcc?.name ?? undefined })) ?? undefined, headers: