-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): add usage of bridge provider options in send message useca…
…ses a… (#6062) Co-authored-by: Richard Fontein <[email protected]>
- Loading branch information
1 parent
4a363ce
commit 01268c6
Showing
235 changed files
with
8,527 additions
and
3,976 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ export class SendTestEmail { | |
|
||
let html = ''; | ||
let subject = ''; | ||
let bridgeProviderData: Record<string, unknown> = {}; | ||
|
||
if (!command.bridge) { | ||
const template = await this.compileEmailTemplateUsecase.execute( | ||
|
@@ -111,6 +112,10 @@ export class SendTestEmail { | |
|
||
html = data.outputs.body; | ||
subject = data.outputs.subject; | ||
|
||
if (data.providers && typeof data.providers === 'object') { | ||
bridgeProviderData = data.providers[integration.providerId] || {}; | ||
} | ||
} | ||
|
||
if (email && integration) { | ||
|
@@ -121,7 +126,7 @@ export class SendTestEmail { | |
from: command.payload.$sender_email || integration?.credentials.from || '[email protected]', | ||
}; | ||
|
||
await this.sendMessage(integration, mailData, mailFactory, command); | ||
await this.sendMessage(integration, mailData, mailFactory, command, bridgeProviderData); | ||
|
||
return; | ||
} | ||
|
@@ -131,13 +136,14 @@ export class SendTestEmail { | |
integration: IntegrationEntity, | ||
mailData: IEmailOptions, | ||
mailFactory: MailFactory, | ||
command: SendTestEmailCommand | ||
command: SendTestEmailCommand, | ||
bridgeProviderData: Record<string, unknown> | ||
) { | ||
const { providerId } = integration; | ||
|
||
try { | ||
const mailHandler = mailFactory.getHandler(integration, mailData.from); | ||
await mailHandler.send(mailData); | ||
await mailHandler.send({ ...mailData, bridgeProviderData }); | ||
this.analyticsService.track('Test Email Sent - [Events]', command.userId, { | ||
_organization: command.organizationId, | ||
_environment: command.environmentId, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
.nyc_output | ||
build | ||
node_modules | ||
test | ||
src/**.js | ||
coverage | ||
*.log | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.