@segment/action-destinations 3.297.1-staging-ead140a61 → 3.298.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/destinations/facebook-custom-audiences/constants.d.ts +0 -1
- package/dist/destinations/facebook-custom-audiences/constants.js +1 -182
- package/dist/destinations/facebook-custom-audiences/constants.js.map +1 -1
- package/dist/destinations/facebook-custom-audiences/sync/index.js +2 -4
- package/dist/destinations/facebook-custom-audiences/sync/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/index.js +4 -4
- package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion2/index.js +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion2/index.js.map +1 -1
- package/dist/destinations/salesforce/sf-operations.js +1 -1
- package/dist/destinations/salesforce/sf-operations.js.map +1 -1
- package/dist/destinations/salesforce-marketing-cloud/sfmc-properties.js +1 -1
- package/dist/destinations/segment/index.js +1 -5
- package/dist/destinations/segment/index.js.map +1 -1
- package/dist/destinations/segment/properties.d.ts +0 -4
- package/dist/destinations/segment/properties.js +1 -14
- package/dist/destinations/segment/properties.js.map +1 -1
- package/dist/destinations/tiktok-audiences/generated-types.d.ts +0 -1
- package/dist/destinations/tiktok-audiences/index.js +0 -11
- package/dist/destinations/tiktok-audiences/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/destinations/amazon-ads/generated-types.d.ts +0 -12
- package/dist/destinations/amazon-ads/generated-types.js +0 -3
- package/dist/destinations/amazon-ads/generated-types.js.map +0 -1
- package/dist/destinations/amazon-ads/index.d.ts +0 -4
- package/dist/destinations/amazon-ads/index.js +0 -237
- package/dist/destinations/amazon-ads/index.js.map +0 -1
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +0 -15
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.js +0 -3
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.js.map +0 -1
- package/dist/destinations/amazon-ads/syncAudiences/index.d.ts +0 -5
- package/dist/destinations/amazon-ads/syncAudiences/index.js +0 -182
- package/dist/destinations/amazon-ads/syncAudiences/index.js.map +0 -1
- package/dist/destinations/amazon-ads/types.d.ts +0 -47
- package/dist/destinations/amazon-ads/types.js +0 -11
- package/dist/destinations/amazon-ads/types.js.map +0 -1
- package/dist/destinations/amazon-ads/utils.d.ts +0 -37
- package/dist/destinations/amazon-ads/utils.js +0 -25
- package/dist/destinations/amazon-ads/utils.js.map +0 -1
- package/dist/destinations/contentstack/constants.d.ts +0 -3
- package/dist/destinations/contentstack/constants.js +0 -7
- package/dist/destinations/contentstack/constants.js.map +0 -1
- package/dist/destinations/engage/sendgrid/destinationDefinition.d.ts +0 -3
- package/dist/destinations/engage/sendgrid/destinationDefinition.js +0 -70
- package/dist/destinations/engage/sendgrid/destinationDefinition.js.map +0 -1
- package/dist/destinations/engage/sendgrid/generated-types.d.ts +0 -1
- package/dist/destinations/engage/sendgrid/generated-types.js +0 -14
- package/dist/destinations/engage/sendgrid/generated-types.js.map +0 -1
- package/dist/destinations/engage/sendgrid/index.d.ts +0 -2
- package/dist/destinations/engage/sendgrid/index.js +0 -5
- package/dist/destinations/engage/sendgrid/index.js.map +0 -1
- package/dist/destinations/engage/sendgrid/previewApiLookup/actionDefinition.d.ts +0 -4
- package/dist/destinations/engage/sendgrid/previewApiLookup/actionDefinition.js +0 -28
- package/dist/destinations/engage/sendgrid/previewApiLookup/actionDefinition.js.map +0 -1
- package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.d.ts +0 -1
- package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.js +0 -14
- package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.js.map +0 -1
- package/dist/destinations/engage/sendgrid/previewApiLookup/index.d.ts +0 -1
- package/dist/destinations/engage/sendgrid/previewApiLookup/index.js +0 -14
- package/dist/destinations/engage/sendgrid/previewApiLookup/index.js.map +0 -1
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.d.ts +0 -44
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +0 -419
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +0 -1
- package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.d.ts +0 -12
- package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.js +0 -3
- package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.js.map +0 -1
- package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.d.ts +0 -4
- package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.js +0 -257
- package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.js.map +0 -1
- package/dist/destinations/engage/sendgrid/sendEmail/generated-types.d.ts +0 -1
- package/dist/destinations/engage/sendgrid/sendEmail/generated-types.js +0 -14
- package/dist/destinations/engage/sendgrid/sendEmail/generated-types.js.map +0 -1
- package/dist/destinations/engage/sendgrid/sendEmail/index.d.ts +0 -1
- package/dist/destinations/engage/sendgrid/sendEmail/index.js +0 -14
- package/dist/destinations/engage/sendgrid/sendEmail/index.js.map +0 -1
- package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.d.ts +0 -1
- package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.js +0 -23
- package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.js.map +0 -1
- package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.d.ts +0 -1
- package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.js +0 -14
- package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.js.map +0 -1
- package/dist/destinations/engage/twilio/destinationDefinition.d.ts +0 -3
- package/dist/destinations/engage/twilio/destinationDefinition.js +0 -172
- package/dist/destinations/engage/twilio/destinationDefinition.js.map +0 -1
- package/dist/destinations/engage/twilio/generated-types.d.ts +0 -1
- package/dist/destinations/engage/twilio/generated-types.js +0 -14
- package/dist/destinations/engage/twilio/generated-types.js.map +0 -1
- package/dist/destinations/engage/twilio/index.d.ts +0 -2
- package/dist/destinations/engage/twilio/index.js +0 -5
- package/dist/destinations/engage/twilio/index.js.map +0 -1
- package/dist/destinations/engage/twilio/sendMobilePush/PushSender.d.ts +0 -28
- package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js +0 -151
- package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js.map +0 -1
- package/dist/destinations/engage/twilio/sendMobilePush/actionDefinition.d.ts +0 -4
- package/dist/destinations/engage/twilio/sendMobilePush/actionDefinition.js +0 -250
- package/dist/destinations/engage/twilio/sendMobilePush/actionDefinition.js.map +0 -1
- package/dist/destinations/engage/twilio/sendMobilePush/generated-types.d.ts +0 -1
- package/dist/destinations/engage/twilio/sendMobilePush/generated-types.js +0 -14
- package/dist/destinations/engage/twilio/sendMobilePush/generated-types.js.map +0 -1
- package/dist/destinations/engage/twilio/sendMobilePush/index.d.ts +0 -1
- package/dist/destinations/engage/twilio/sendMobilePush/index.js +0 -14
- package/dist/destinations/engage/twilio/sendMobilePush/index.js.map +0 -1
- package/dist/destinations/engage/twilio/sendSms/SmsMessageSender.d.ts +0 -9
- package/dist/destinations/engage/twilio/sendSms/SmsMessageSender.js +0 -72
- package/dist/destinations/engage/twilio/sendSms/SmsMessageSender.js.map +0 -1
- package/dist/destinations/engage/twilio/sendSms/actionDefinition.d.ts +0 -4
- package/dist/destinations/engage/twilio/sendSms/actionDefinition.js +0 -162
- package/dist/destinations/engage/twilio/sendSms/actionDefinition.js.map +0 -1
- package/dist/destinations/engage/twilio/sendSms/generated-types.d.ts +0 -1
- package/dist/destinations/engage/twilio/sendSms/generated-types.js +0 -14
- package/dist/destinations/engage/twilio/sendSms/generated-types.js.map +0 -1
- package/dist/destinations/engage/twilio/sendSms/index.d.ts +0 -1
- package/dist/destinations/engage/twilio/sendSms/index.js +0 -14
- package/dist/destinations/engage/twilio/sendSms/index.js.map +0 -1
- package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.d.ts +0 -9
- package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.js +0 -89
- package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.js.map +0 -1
- package/dist/destinations/engage/twilio/sendWhatsApp/actionDefinition.d.ts +0 -4
- package/dist/destinations/engage/twilio/sendWhatsApp/actionDefinition.js +0 -136
- package/dist/destinations/engage/twilio/sendWhatsApp/actionDefinition.js.map +0 -1
- package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.d.ts +0 -1
- package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.js +0 -14
- package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.js.map +0 -1
- package/dist/destinations/engage/twilio/sendWhatsApp/index.d.ts +0 -1
- package/dist/destinations/engage/twilio/sendWhatsApp/index.js +0 -14
- package/dist/destinations/engage/twilio/sendWhatsApp/index.js.map +0 -1
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.d.ts +0 -16
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js +0 -71
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js.map +0 -1
- package/dist/destinations/engage/twilio/utils/TwilioMessageSender.d.ts +0 -16
- package/dist/destinations/engage/twilio/utils/TwilioMessageSender.js +0 -115
- package/dist/destinations/engage/twilio/utils/TwilioMessageSender.js.map +0 -1
- package/dist/destinations/engage/twilio/utils/index.d.ts +0 -2
- package/dist/destinations/engage/twilio/utils/index.js +0 -15
- package/dist/destinations/engage/twilio/utils/index.js.map +0 -1
- package/dist/destinations/engage/twilio/utils/types.d.ts +0 -23
- package/dist/destinations/engage/twilio/utils/types.js +0 -3
- package/dist/destinations/engage/twilio/utils/types.js.map +0 -1
- package/dist/destinations/engage/utils/AggregateError.d.ts +0 -14
- package/dist/destinations/engage/utils/AggregateError.js +0 -26
- package/dist/destinations/engage/utils/AggregateError.js.map +0 -1
- package/dist/destinations/engage/utils/EngageActionPerformer.d.ts +0 -42
- package/dist/destinations/engage/utils/EngageActionPerformer.js +0 -148
- package/dist/destinations/engage/utils/EngageActionPerformer.js.map +0 -1
- package/dist/destinations/engage/utils/EngageLogger.d.ts +0 -18
- package/dist/destinations/engage/utils/EngageLogger.js +0 -52
- package/dist/destinations/engage/utils/EngageLogger.js.map +0 -1
- package/dist/destinations/engage/utils/EngageStats.d.ts +0 -18
- package/dist/destinations/engage/utils/EngageStats.js +0 -95
- package/dist/destinations/engage/utils/EngageStats.js.map +0 -1
- package/dist/destinations/engage/utils/IntegrationErrorWrapper.d.ts +0 -12
- package/dist/destinations/engage/utils/IntegrationErrorWrapper.js +0 -31
- package/dist/destinations/engage/utils/IntegrationErrorWrapper.js.map +0 -1
- package/dist/destinations/engage/utils/MessageSendPerformer.d.ts +0 -65
- package/dist/destinations/engage/utils/MessageSendPerformer.js +0 -211
- package/dist/destinations/engage/utils/MessageSendPerformer.js.map +0 -1
- package/dist/destinations/engage/utils/Profile.d.ts +0 -6
- package/dist/destinations/engage/utils/Profile.js +0 -3
- package/dist/destinations/engage/utils/Profile.js.map +0 -1
- package/dist/destinations/engage/utils/ResponseError.d.ts +0 -25
- package/dist/destinations/engage/utils/ResponseError.js +0 -22
- package/dist/destinations/engage/utils/ResponseError.js.map +0 -1
- package/dist/destinations/engage/utils/apiLookups.d.ts +0 -22
- package/dist/destinations/engage/utils/apiLookups.js +0 -189
- package/dist/destinations/engage/utils/apiLookups.js.map +0 -1
- package/dist/destinations/engage/utils/getProfileApiEndpoint.d.ts +0 -2
- package/dist/destinations/engage/utils/getProfileApiEndpoint.js +0 -10
- package/dist/destinations/engage/utils/getProfileApiEndpoint.js.map +0 -1
- package/dist/destinations/engage/utils/index.d.ts +0 -9
- package/dist/destinations/engage/utils/index.js +0 -22
- package/dist/destinations/engage/utils/index.js.map +0 -1
- package/dist/destinations/engage/utils/isDestinationActionService.d.ts +0 -1
- package/dist/destinations/engage/utils/isDestinationActionService.js +0 -8
- package/dist/destinations/engage/utils/isDestinationActionService.js.map +0 -1
- package/dist/destinations/engage/utils/isRetryableError.d.ts +0 -2
- package/dist/destinations/engage/utils/isRetryableError.js +0 -33
- package/dist/destinations/engage/utils/isRetryableError.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/GenericMethodDecorator.d.ts +0 -1
- package/dist/destinations/engage/utils/operationTracking/GenericMethodDecorator.js +0 -3
- package/dist/destinations/engage/utils/operationTracking/GenericMethodDecorator.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/OperationDecorator.d.ts +0 -46
- package/dist/destinations/engage/utils/operationTracking/OperationDecorator.js +0 -46
- package/dist/destinations/engage/utils/operationTracking/OperationDecorator.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/OperationDuration.d.ts +0 -12
- package/dist/destinations/engage/utils/operationTracking/OperationDuration.js +0 -23
- package/dist/destinations/engage/utils/operationTracking/OperationDuration.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/OperationErrorHandler.d.ts +0 -12
- package/dist/destinations/engage/utils/operationTracking/OperationErrorHandler.js +0 -35
- package/dist/destinations/engage/utils/operationTracking/OperationErrorHandler.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.d.ts +0 -14
- package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.js +0 -31
- package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/OperationLogger.d.ts +0 -31
- package/dist/destinations/engage/utils/operationTracking/OperationLogger.js +0 -104
- package/dist/destinations/engage/utils/operationTracking/OperationLogger.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/OperationStats.d.ts +0 -39
- package/dist/destinations/engage/utils/operationTracking/OperationStats.js +0 -130
- package/dist/destinations/engage/utils/operationTracking/OperationStats.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/OperationTracker.test.d.ts +0 -1
- package/dist/destinations/engage/utils/operationTracking/OperationTracker.test.js +0 -377
- package/dist/destinations/engage/utils/operationTracking/OperationTracker.test.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/OperationTree.d.ts +0 -23
- package/dist/destinations/engage/utils/operationTracking/OperationTree.js +0 -49
- package/dist/destinations/engage/utils/operationTracking/OperationTree.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/TrackedError.d.ts +0 -6
- package/dist/destinations/engage/utils/operationTracking/TrackedError.js +0 -3
- package/dist/destinations/engage/utils/operationTracking/TrackedError.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/index.d.ts +0 -10
- package/dist/destinations/engage/utils/operationTracking/index.js +0 -23
- package/dist/destinations/engage/utils/operationTracking/index.js.map +0 -1
- package/dist/destinations/engage/utils/operationTracking/wrapTryCatchFinallyPromisable.d.ts +0 -21
- package/dist/destinations/engage/utils/operationTracking/wrapTryCatchFinallyPromisable.js +0 -99
- package/dist/destinations/engage/utils/operationTracking/wrapTryCatchFinallyPromisable.js.map +0 -1
- package/dist/destinations/engage/utils/testUtils.d.ts +0 -6
- package/dist/destinations/engage/utils/testUtils.js +0 -26
- package/dist/destinations/engage/utils/testUtils.js.map +0 -1
- package/dist/destinations/engage/utils/track.d.ts +0 -52
- package/dist/destinations/engage/utils/track.js +0 -9
- package/dist/destinations/engage/utils/track.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup.types.d.ts +0 -16
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup.types.js +0 -3
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup.types.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail.types.d.ts +0 -56
- package/dist/destinations/engage-messaging-sendgrid/sendEmail.types.js +0 -3
- package/dist/destinations/engage-messaging-sendgrid/sendEmail.types.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush.types.d.ts +0 -39
- package/dist/destinations/engage-messaging-twilio/sendMobilePush.types.js +0 -3
- package/dist/destinations/engage-messaging-twilio/sendMobilePush.types.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendSms.types.d.ts +0 -27
- package/dist/destinations/engage-messaging-twilio/sendSms.types.js +0 -3
- package/dist/destinations/engage-messaging-twilio/sendSms.types.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp.types.d.ts +0 -25
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp.types.js +0 -3
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp.types.js.map +0 -1
- package/dist/destinations/facebook-custom-audiences/add/generated-types.d.ts +0 -2
- package/dist/destinations/facebook-custom-audiences/add/generated-types.js +0 -3
- package/dist/destinations/facebook-custom-audiences/add/generated-types.js.map +0 -1
- package/dist/destinations/facebook-custom-audiences/add/index.d.ts +0 -5
- package/dist/destinations/facebook-custom-audiences/add/index.js +0 -11
- package/dist/destinations/facebook-custom-audiences/add/index.js.map +0 -1
- package/dist/destinations/facebook-custom-audiences/remove/generated-types.d.ts +0 -2
- package/dist/destinations/facebook-custom-audiences/remove/generated-types.js +0 -3
- package/dist/destinations/facebook-custom-audiences/remove/generated-types.js.map +0 -1
- package/dist/destinations/facebook-custom-audiences/remove/index.d.ts +0 -5
- package/dist/destinations/facebook-custom-audiences/remove/index.js +0 -11
- package/dist/destinations/facebook-custom-audiences/remove/index.js.map +0 -1
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.destinationDefinition = void 0;
|
|
4
|
-
const sendEmail_1 = require("./sendEmail");
|
|
5
|
-
const previewApiLookup_1 = require("./previewApiLookup");
|
|
6
|
-
exports.destinationDefinition = {
|
|
7
|
-
name: 'Engage Messaging SendGrid',
|
|
8
|
-
slug: 'actions-personas-messaging-sendgrid',
|
|
9
|
-
mode: 'cloud',
|
|
10
|
-
description: 'This is an Engage specific action to send an email',
|
|
11
|
-
authentication: {
|
|
12
|
-
scheme: 'custom',
|
|
13
|
-
fields: {
|
|
14
|
-
unlayerApiKey: {
|
|
15
|
-
label: 'Unlayer API Key',
|
|
16
|
-
type: 'password',
|
|
17
|
-
description: 'The API key for your Unlayer account'
|
|
18
|
-
},
|
|
19
|
-
sendGridApiKey: {
|
|
20
|
-
label: 'API Key',
|
|
21
|
-
type: 'password',
|
|
22
|
-
description: 'The Api Key for your SendGrid account',
|
|
23
|
-
required: true
|
|
24
|
-
},
|
|
25
|
-
profileApiEnvironment: {
|
|
26
|
-
label: 'Profile API Environment',
|
|
27
|
-
description: 'Profile API Environment',
|
|
28
|
-
type: 'string',
|
|
29
|
-
required: true
|
|
30
|
-
},
|
|
31
|
-
profileApiAccessToken: {
|
|
32
|
-
label: 'Profile API Access Token',
|
|
33
|
-
description: 'Profile API Access Token',
|
|
34
|
-
type: 'password',
|
|
35
|
-
required: true
|
|
36
|
-
},
|
|
37
|
-
spaceId: {
|
|
38
|
-
label: 'Space ID',
|
|
39
|
-
description: 'Space ID',
|
|
40
|
-
type: 'string',
|
|
41
|
-
required: true
|
|
42
|
-
},
|
|
43
|
-
sourceId: {
|
|
44
|
-
label: 'Source ID',
|
|
45
|
-
description: 'Source ID',
|
|
46
|
-
type: 'string',
|
|
47
|
-
required: true
|
|
48
|
-
},
|
|
49
|
-
region: {
|
|
50
|
-
label: 'Region',
|
|
51
|
-
description: 'The region where the email is originating from',
|
|
52
|
-
type: 'string',
|
|
53
|
-
choices: [
|
|
54
|
-
{ value: 'us-west-2', label: 'US West 2' },
|
|
55
|
-
{ value: 'eu-west-1', label: 'EU West 1' }
|
|
56
|
-
],
|
|
57
|
-
default: 'us-west-2',
|
|
58
|
-
required: false
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
testAuthentication: (request) => {
|
|
62
|
-
return request('https://api.sendgrid.com/v3/mail_settings');
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
actions: {
|
|
66
|
-
sendEmail: sendEmail_1.actionDefinition,
|
|
67
|
-
previewApiLookup: previewApiLookup_1.actionDefinition
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
//# sourceMappingURL=destinationDefinition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"destinationDefinition.js","sourceRoot":"","sources":["../../../../src/destinations/engage/sendgrid/destinationDefinition.ts"],"names":[],"mappings":";;;AAEA,2CAA2D;AAC3D,yDAAyE;AAE5D,QAAA,qBAAqB,GAAoC;IACpE,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,qCAAqC;IAC3C,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,oDAAoD;IACjE,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,aAAa,EAAE;gBACb,KAAK,EAAE,iBAAiB;gBACxB,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,sCAAsC;aACpD;YACD,cAAc,EAAE;gBACd,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,uCAAuC;gBACpD,QAAQ,EAAE,IAAI;aACf;YACD,qBAAqB,EAAE;gBACrB,KAAK,EAAE,yBAAyB;gBAChC,WAAW,EAAE,yBAAyB;gBACtC,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,qBAAqB,EAAE;gBACrB,KAAK,EAAE,0BAA0B;gBACjC,WAAW,EAAE,0BAA0B;gBACvC,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;aACf;YACD,OAAO,EAAE;gBACP,KAAK,EAAE,UAAU;gBACjB,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,MAAM,EAAE;gBACN,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,gDAAgD;gBAC7D,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBAC1C,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;iBAC3C;gBACD,OAAO,EAAE,WAAW;gBACpB,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,OAAO,CAAC,2CAA2C,CAAC,CAAA;QAC7D,CAAC;KACF;IACD,OAAO,EAAE;QACP,SAAS,EAAT,4BAAS;QACT,gBAAgB,EAAhB,mCAAgB;KACjB;CACF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../../engage-messaging-sendgrid/generated-types';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("../../engage-messaging-sendgrid/generated-types"), exports);
|
|
14
|
-
//# sourceMappingURL=generated-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/engage/sendgrid/generated-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kFAA+D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/engage/sendgrid/index.ts"],"names":[],"mappings":";;AAAA,mEAA+D;AAC/D,kBAAe,6CAAqB,CAAA"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.actionDefinition = void 0;
|
|
4
|
-
const apiLookups_1 = require("../../utils/apiLookups");
|
|
5
|
-
exports.actionDefinition = {
|
|
6
|
-
title: 'Perform a single API lookup',
|
|
7
|
-
description: 'Perform a single API lookup and return the response',
|
|
8
|
-
fields: {
|
|
9
|
-
...apiLookups_1.apiLookupActionFields,
|
|
10
|
-
traits: {
|
|
11
|
-
label: 'Traits',
|
|
12
|
-
description: "A user profile's traits",
|
|
13
|
-
type: 'object',
|
|
14
|
-
required: false
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
perform: async (request, { settings, payload, statsContext, logger }) => {
|
|
18
|
-
const statsClient = statsContext?.statsClient;
|
|
19
|
-
const tags = statsContext?.tags ?? [];
|
|
20
|
-
const { traits = {}, ...apiLookupConfig } = payload;
|
|
21
|
-
const profile = { traits: traits };
|
|
22
|
-
const data = await apiLookups_1.performApiLookup(request, apiLookupConfig, profile, statsClient, tags, settings, logger);
|
|
23
|
-
return {
|
|
24
|
-
data
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=actionDefinition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actionDefinition.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/actionDefinition.ts"],"names":[],"mappings":";;;AAGA,uDAAgF;AAGnE,QAAA,gBAAgB,GAAwC;IACnE,KAAK,EAAE,6BAA6B;IACpC,WAAW,EAAE,qDAAqD;IAClE,MAAM,EAAE;QACN,GAAG,kCAAqB;QACxB,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE;QACtE,MAAM,WAAW,GAAG,YAAY,EAAE,WAAW,CAAA;QAC7C,MAAM,IAAI,GAAG,YAAY,EAAE,IAAI,IAAI,EAAE,CAAA;QACrC,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,eAAe,EAAE,GAAG,OAAO,CAAA;QACnD,MAAM,OAAO,GAAY,EAAE,MAAM,EAAE,MAAgC,EAAE,CAAA;QACrE,MAAM,IAAI,GAAG,MAAM,6BAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC3G,OAAO;YACL,IAAI;SACL,CAAA;IACH,CAAC;CACF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../../../engage-messaging-sendgrid/previewApiLookup.types';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("../../../engage-messaging-sendgrid/previewApiLookup.types"), exports);
|
|
14
|
-
//# sourceMappingURL=generated-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/generated-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4FAAyE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './actionDefinition';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./actionDefinition"), exports);
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ExtId, MessageSendPerformer, OperationContext, ResponseError } from '../../utils';
|
|
2
|
-
import type { Settings } from '../generated-types';
|
|
3
|
-
import type { Payload } from './generated-types';
|
|
4
|
-
import { Profile } from '../../utils/Profile';
|
|
5
|
-
import { Liquid as LiquidJs } from 'liquidjs';
|
|
6
|
-
import { ApiLookupConfig, apiLookupLiquidKey } from '../../utils/apiLookups';
|
|
7
|
-
export declare const EXTERNAL_ID_KEY = "email";
|
|
8
|
-
export declare const Liquid: LiquidJs;
|
|
9
|
-
export declare class SendEmailPerformer extends MessageSendPerformer<Settings, Payload> {
|
|
10
|
-
getIntegrationStatsName(): string;
|
|
11
|
-
getChannelType(): string;
|
|
12
|
-
getDefaultSettingsRegion(): string;
|
|
13
|
-
isSupportedExternalId(externalId: ExtId<Payload>): boolean;
|
|
14
|
-
isExternalIdSubscribed(extId: ExtId<Payload>): boolean | undefined;
|
|
15
|
-
getRecepients(): ExtId<Payload>[];
|
|
16
|
-
parseTemplating(content: string, liquidData: {
|
|
17
|
-
profile: Profile;
|
|
18
|
-
[apiLookupLiquidKey]?: Record<string, unknown>;
|
|
19
|
-
}, contentType: string): Promise<any>;
|
|
20
|
-
sendToRecepient(emailProfile: ExtId<Payload>): Promise<import("@segment/actions-core").ModifiedResponse<unknown> | undefined>;
|
|
21
|
-
getBodyTemplateFromS3(bodyUrl: string): Promise<string>;
|
|
22
|
-
getBodyHtml(profile: Profile, apiLookupData: Record<string, unknown>, emailProfile: {
|
|
23
|
-
id?: string | undefined;
|
|
24
|
-
type?: string | undefined;
|
|
25
|
-
subscriptionStatus?: string | undefined;
|
|
26
|
-
unsubscribeLink?: string | undefined;
|
|
27
|
-
preferencesLink?: string | undefined;
|
|
28
|
-
groups?: {
|
|
29
|
-
id?: string | undefined;
|
|
30
|
-
isSubscribed?: boolean | undefined;
|
|
31
|
-
groupUnsubscribeLink?: string | undefined;
|
|
32
|
-
}[] | undefined;
|
|
33
|
-
}): Promise<string>;
|
|
34
|
-
generateEmailHtml(design: string): Promise<string>;
|
|
35
|
-
performApiLookups(this: SendEmailPerformer, apiLookups: ApiLookupConfig[] | undefined, profile: Profile): Promise<Record<string, unknown>>;
|
|
36
|
-
validateLinkAndLog(link: string): void;
|
|
37
|
-
insertUnsubscribeLinks(html: string, emailProfile: EmailProfile): string;
|
|
38
|
-
onResponse(args: {
|
|
39
|
-
response?: Response;
|
|
40
|
-
error?: ResponseError;
|
|
41
|
-
operation: OperationContext;
|
|
42
|
-
}): void;
|
|
43
|
-
}
|
|
44
|
-
export declare type EmailProfile = ExtId<Payload>;
|
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SendEmailPerformer = exports.Liquid = exports.EXTERNAL_ID_KEY = void 0;
|
|
13
|
-
const utils_1 = require("../../utils");
|
|
14
|
-
const liquidjs_1 = require("liquidjs");
|
|
15
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
16
|
-
const apiLookups_1 = require("../../utils/apiLookups");
|
|
17
|
-
const insertEmailPreviewText_1 = require("./insertEmailPreviewText");
|
|
18
|
-
const cheerio_1 = __importDefault(require("cheerio"));
|
|
19
|
-
const isRestrictedDomain_1 = require("./isRestrictedDomain");
|
|
20
|
-
exports.EXTERNAL_ID_KEY = 'email';
|
|
21
|
-
exports.Liquid = new liquidjs_1.Liquid();
|
|
22
|
-
class SendEmailPerformer extends utils_1.MessageSendPerformer {
|
|
23
|
-
getIntegrationStatsName() {
|
|
24
|
-
return 'actions_personas_messaging_sendgrid';
|
|
25
|
-
}
|
|
26
|
-
getChannelType() {
|
|
27
|
-
return 'email';
|
|
28
|
-
}
|
|
29
|
-
getDefaultSettingsRegion() {
|
|
30
|
-
return 'us-west-2';
|
|
31
|
-
}
|
|
32
|
-
isSupportedExternalId(externalId) {
|
|
33
|
-
return externalId.type === 'email';
|
|
34
|
-
}
|
|
35
|
-
isExternalIdSubscribed(extId) {
|
|
36
|
-
const bypass_subscription = this.payload.byPassSubscription !== undefined && this.payload.byPassSubscription;
|
|
37
|
-
if (bypass_subscription) {
|
|
38
|
-
this.currentOperation?.logs.push('Bypassing subscription');
|
|
39
|
-
this.currentOperation?.tags.push('bypass_subscription:' + true);
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
const isSubscribed = super.isExternalIdSubscribed(extId);
|
|
43
|
-
if (!isSubscribed)
|
|
44
|
-
return isSubscribed;
|
|
45
|
-
if (!this.payload.groupId)
|
|
46
|
-
return isSubscribed;
|
|
47
|
-
const recepientGroup = extId.groups?.find((g) => g.id === this.payload.groupId);
|
|
48
|
-
if (!recepientGroup) {
|
|
49
|
-
this.statsClient.incr('group_notfound', 1);
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
if (!recepientGroup.isSubscribed) {
|
|
53
|
-
this.statsClient.incr('group_notsubscribed', 1);
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
getRecepients() {
|
|
59
|
-
if (this.payload.toEmail) {
|
|
60
|
-
const externalIdContext = this.payload?.externalIds && this.payload?.externalIds[0];
|
|
61
|
-
return [
|
|
62
|
-
{
|
|
63
|
-
id: this.payload.toEmail,
|
|
64
|
-
type: 'email',
|
|
65
|
-
subscriptionStatus: externalIdContext?.subscriptionStatus,
|
|
66
|
-
unsubscribeLink: externalIdContext?.unsubscribeLink,
|
|
67
|
-
preferencesLink: externalIdContext?.preferencesLink,
|
|
68
|
-
groups: externalIdContext?.groups
|
|
69
|
-
}
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
const res = super.getRecepients();
|
|
73
|
-
if (res.length > 0)
|
|
74
|
-
return [res[0]];
|
|
75
|
-
return res;
|
|
76
|
-
}
|
|
77
|
-
async parseTemplating(content, liquidData, contentType) {
|
|
78
|
-
const traits = liquidData.profile.traits ? { ...liquidData.profile.traits } : liquidData.profile.traits;
|
|
79
|
-
if (traits) {
|
|
80
|
-
for (const trait of Object.keys(traits)) {
|
|
81
|
-
if (traits && traits[trait] && (traits[trait] === '<nil>' || traits[trait].toString().trim() === '')) {
|
|
82
|
-
traits[trait] = '';
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const parsedContent = content == null
|
|
87
|
-
? content
|
|
88
|
-
: await exports.Liquid.parseAndRender(content, { ...liquidData, profile: { ...liquidData.profile, traits } });
|
|
89
|
-
this.logOnError(() => 'Content type: ' + contentType);
|
|
90
|
-
return parsedContent;
|
|
91
|
-
}
|
|
92
|
-
async sendToRecepient(emailProfile) {
|
|
93
|
-
const traits = await this.getProfileTraits();
|
|
94
|
-
const profile = {
|
|
95
|
-
email: emailProfile?.id,
|
|
96
|
-
traits
|
|
97
|
-
};
|
|
98
|
-
const toEmail = profile.email;
|
|
99
|
-
if (!toEmail) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (isRestrictedDomain_1.isRestrictedDomain(toEmail)) {
|
|
103
|
-
this.tags.push('reason:restricted_domain');
|
|
104
|
-
throw new actions_core_1.IntegrationError('Emails with gmailx.com, yahoox.com, aolx.com, and hotmailx.com domains are blocked.', 'Invalid input', 400);
|
|
105
|
-
}
|
|
106
|
-
const bcc = JSON.parse(this.payload.bcc ?? '[]');
|
|
107
|
-
const [parsedFromEmail, parsedFromName, parsedFromReplyToEmail, parsedFromReplyToName, parsedSubject] = await Promise.all([
|
|
108
|
-
this.parseTemplating(this.payload.fromEmail, { profile }, 'FromEmail'),
|
|
109
|
-
this.parseTemplating(this.payload.fromName, { profile }, 'FromName'),
|
|
110
|
-
this.parseTemplating(this.payload.replyToEmail, { profile }, 'ReplyToEmail'),
|
|
111
|
-
this.parseTemplating(this.payload.replyToName, { profile }, 'ReplyToName'),
|
|
112
|
-
this.parseTemplating(this.payload.subject, { profile }, 'Subject')
|
|
113
|
-
]);
|
|
114
|
-
let apiLookupData = {};
|
|
115
|
-
if (this.isFeatureActive(apiLookups_1.FLAGON_NAME_DATA_FEEDS)) {
|
|
116
|
-
try {
|
|
117
|
-
apiLookupData = await this.performApiLookups(this.payload.apiLookups, profile);
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
this.tags.push('reason:data_feed_failure');
|
|
121
|
-
throw error;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
const parsedBodyHtml = await this.getBodyHtml(profile, apiLookupData, emailProfile);
|
|
125
|
-
const mailContentSubscriptionHonored = {
|
|
126
|
-
personalizations: [
|
|
127
|
-
{
|
|
128
|
-
to: [
|
|
129
|
-
{
|
|
130
|
-
email: toEmail
|
|
131
|
-
}
|
|
132
|
-
],
|
|
133
|
-
bcc: bcc.length > 0 ? bcc : undefined,
|
|
134
|
-
custom_args: {
|
|
135
|
-
...this.payload.customArgs,
|
|
136
|
-
source_id: this.settings.sourceId,
|
|
137
|
-
space_id: this.settings.spaceId,
|
|
138
|
-
user_id: this.payload.userId ?? undefined,
|
|
139
|
-
__segment_internal_external_id_key__: exports.EXTERNAL_ID_KEY,
|
|
140
|
-
__segment_internal_external_id_value__: profile[exports.EXTERNAL_ID_KEY]
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
],
|
|
144
|
-
from: {
|
|
145
|
-
email: parsedFromEmail,
|
|
146
|
-
name: parsedFromName
|
|
147
|
-
},
|
|
148
|
-
reply_to: {
|
|
149
|
-
email: parsedFromReplyToEmail,
|
|
150
|
-
name: parsedFromReplyToName
|
|
151
|
-
},
|
|
152
|
-
subject: parsedSubject,
|
|
153
|
-
content: [
|
|
154
|
-
{
|
|
155
|
-
type: 'text/html',
|
|
156
|
-
value: parsedBodyHtml
|
|
157
|
-
}
|
|
158
|
-
],
|
|
159
|
-
tracking_settings: {
|
|
160
|
-
subscription_tracking: {
|
|
161
|
-
enable: true,
|
|
162
|
-
substitution_tag: '[unsubscribe]'
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
let mailContent;
|
|
167
|
-
let unsubscribeLink;
|
|
168
|
-
if (this.payload.groupId) {
|
|
169
|
-
const group = emailProfile.groups?.find((grp) => grp.id === this.payload.groupId);
|
|
170
|
-
unsubscribeLink = group?.groupUnsubscribeLink ?? '';
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
unsubscribeLink = emailProfile?.unsubscribeLink;
|
|
174
|
-
}
|
|
175
|
-
if (unsubscribeLink) {
|
|
176
|
-
mailContent = {
|
|
177
|
-
...mailContentSubscriptionHonored,
|
|
178
|
-
headers: {
|
|
179
|
-
'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click',
|
|
180
|
-
'List-Unsubscribe': '<' + unsubscribeLink + '>'
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
mailContent.tracking_settings.subscription_tracking.enable = false;
|
|
184
|
-
this.statsClient?.incr('request.list_unsubscribe__header_added', 1);
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
mailContent = mailContentSubscriptionHonored;
|
|
188
|
-
}
|
|
189
|
-
if (this.payload.byPassSubscription) {
|
|
190
|
-
mailContent = {
|
|
191
|
-
...mailContent,
|
|
192
|
-
mail_settings: {
|
|
193
|
-
bypass_list_management: {
|
|
194
|
-
enable: true
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
this.statsClient?.incr('request.by_pass_subscription', 1);
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
this.statsClient?.incr('request.dont_pass_subscription', 1);
|
|
202
|
-
}
|
|
203
|
-
if (this.payload.ipPool) {
|
|
204
|
-
mailContent = {
|
|
205
|
-
...mailContent,
|
|
206
|
-
ip_pool_name: this.payload.ipPool
|
|
207
|
-
};
|
|
208
|
-
this.statsClient?.incr('request.ip_pool_name_provided', 1);
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
this.statsClient?.incr('request.ip_pool_name_not_provided', 1);
|
|
212
|
-
}
|
|
213
|
-
const req = {
|
|
214
|
-
method: 'post',
|
|
215
|
-
headers: {
|
|
216
|
-
authorization: `Bearer ${this.settings.sendGridApiKey}`,
|
|
217
|
-
'x-nef-fp': process.env.SENDGRID_BYPASS_IP_BLOCK_HEADER_SECRET ?? ''
|
|
218
|
-
},
|
|
219
|
-
json: mailContent
|
|
220
|
-
};
|
|
221
|
-
this.statsClient?.set('message_body_size', JSON.stringify(req).length);
|
|
222
|
-
const response = await this.request('https://api.sendgrid.com/v3/mail/send', req);
|
|
223
|
-
if (this.payload?.eventOccurredTS != undefined) {
|
|
224
|
-
this.statsClient?.histogram('eventDeliveryTS', Date.now() - new Date(this.payload?.eventOccurredTS).getTime(), this.tags);
|
|
225
|
-
}
|
|
226
|
-
return response;
|
|
227
|
-
}
|
|
228
|
-
async getBodyTemplateFromS3(bodyUrl) {
|
|
229
|
-
const { content } = await this.request(bodyUrl, { method: 'GET', skipResponseCloning: true });
|
|
230
|
-
return content;
|
|
231
|
-
}
|
|
232
|
-
async getBodyHtml(profile, apiLookupData, emailProfile) {
|
|
233
|
-
let parsedBodyHtml;
|
|
234
|
-
if (this.payload.bodyUrl && this.settings.unlayerApiKey) {
|
|
235
|
-
const body = await this.getBodyTemplateFromS3(this.payload.bodyUrl);
|
|
236
|
-
const bodyHtml = this.payload.bodyType === 'html' ? body : await this.generateEmailHtml(body);
|
|
237
|
-
parsedBodyHtml = await this.parseTemplating(bodyHtml, { profile, [apiLookups_1.apiLookupLiquidKey]: apiLookupData }, 'Body');
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
parsedBodyHtml = await this.parseTemplating(this.payload.bodyHtml ?? '', { profile, [apiLookups_1.apiLookupLiquidKey]: apiLookupData }, 'Body HTML');
|
|
241
|
-
}
|
|
242
|
-
if (this.payload.previewText) {
|
|
243
|
-
try {
|
|
244
|
-
const parsedPreviewText = await this.parseTemplating(this.payload.previewText, { profile }, 'Preview text');
|
|
245
|
-
parsedBodyHtml = insertEmailPreviewText_1.insertEmailPreviewText(parsedBodyHtml, parsedPreviewText);
|
|
246
|
-
}
|
|
247
|
-
catch (ex) {
|
|
248
|
-
this.logger?.error('Error inserting preview text, using original html', {
|
|
249
|
-
ex
|
|
250
|
-
});
|
|
251
|
-
this.statsClient.incr('insert_preview_fail', 1);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
parsedBodyHtml = this.insertUnsubscribeLinks(parsedBodyHtml, emailProfile);
|
|
255
|
-
return parsedBodyHtml;
|
|
256
|
-
}
|
|
257
|
-
async generateEmailHtml(design) {
|
|
258
|
-
this.statsClient.incr('unlayer_request', 1);
|
|
259
|
-
const response = await this.request('https://api.unlayer.com/v2/export/html', {
|
|
260
|
-
method: 'POST',
|
|
261
|
-
headers: {
|
|
262
|
-
authorization: `Basic ${Buffer.from(`${this.settings.unlayerApiKey}:`).toString('base64')}`,
|
|
263
|
-
'content-type': 'application/json'
|
|
264
|
-
},
|
|
265
|
-
body: JSON.stringify({
|
|
266
|
-
displayMode: 'email',
|
|
267
|
-
design: JSON.parse(design)
|
|
268
|
-
})
|
|
269
|
-
});
|
|
270
|
-
const body = await response.json();
|
|
271
|
-
return body.data.html;
|
|
272
|
-
}
|
|
273
|
-
async performApiLookups(apiLookups, profile) {
|
|
274
|
-
if (!apiLookups) {
|
|
275
|
-
return {};
|
|
276
|
-
}
|
|
277
|
-
const request = this.request.bind(this);
|
|
278
|
-
const data = await Promise.all(apiLookups.map(async (apiLookup) => {
|
|
279
|
-
const data = await apiLookups_1.performApiLookup(request, apiLookup, profile, this.statsClient.statsClient, this.tags, this.settings, this.logger.loggerClient, this.dataFeedCache);
|
|
280
|
-
return { name: apiLookup.name, data };
|
|
281
|
-
}));
|
|
282
|
-
return data.reduce((acc, { name, data }) => {
|
|
283
|
-
acc[name] = data;
|
|
284
|
-
return acc;
|
|
285
|
-
}, {});
|
|
286
|
-
}
|
|
287
|
-
validateLinkAndLog(link) {
|
|
288
|
-
let workspaceId = this.payload.customArgs && this.payload.customArgs['workspace_id'];
|
|
289
|
-
let audienceId = this.payload.customArgs &&
|
|
290
|
-
(this.payload.customArgs['audience_id'] || this.payload.customArgs['__segment_internal_audience_id__']);
|
|
291
|
-
workspaceId = JSON.stringify(workspaceId);
|
|
292
|
-
audienceId = JSON.stringify(audienceId);
|
|
293
|
-
this.logger.info(`Validating the link: ${link} ${workspaceId} ${audienceId}`);
|
|
294
|
-
const parsedLink = new URL(link);
|
|
295
|
-
const checkParam = (paramName) => {
|
|
296
|
-
const paramValue = parsedLink.searchParams.get(paramName);
|
|
297
|
-
if (!paramValue || paramValue === '') {
|
|
298
|
-
this.logger.error(`${paramName} is missing: ${link} ${workspaceId} ${audienceId}`);
|
|
299
|
-
this.statsClient.incr('missing_query_param', 1, [`param:${paramName}`, `audienceId:${audienceId}`]);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
const requiredParams = ['contactId', 'data', 'code', 'spaceId', 'workspaceId', 'messageId', 'user-agent'];
|
|
303
|
-
requiredParams.forEach((param) => checkParam(param));
|
|
304
|
-
}
|
|
305
|
-
insertUnsubscribeLinks(html, emailProfile) {
|
|
306
|
-
const spaceId = this.settings.spaceId;
|
|
307
|
-
const groupId = this.payload.groupId;
|
|
308
|
-
const globalUnsubscribeLink = emailProfile?.unsubscribeLink;
|
|
309
|
-
const preferencesLink = emailProfile?.preferencesLink;
|
|
310
|
-
const unsubscribeLinkRef = 'a[href*="[upa_unsubscribe_link]"]';
|
|
311
|
-
const preferencesLinkRef = 'a[href*="[upa_preferences_link]"]';
|
|
312
|
-
const sendgridUnsubscribeLinkRef = 'a[href*="[unsubscribe]"]';
|
|
313
|
-
const sendgridUnsubscribeLinkTag = '[unsubscribe]';
|
|
314
|
-
const $ = cheerio_1.default.load(html);
|
|
315
|
-
const _this = this;
|
|
316
|
-
let hasSendgridSubstitutionTag = false;
|
|
317
|
-
$(sendgridUnsubscribeLinkRef).each(function () {
|
|
318
|
-
emailProfile.unsubscribeLink = '';
|
|
319
|
-
emailProfile.preferencesLink = '';
|
|
320
|
-
if (groupId) {
|
|
321
|
-
const group = emailProfile.groups?.find((grp) => grp.id === groupId);
|
|
322
|
-
if (group) {
|
|
323
|
-
group.groupUnsubscribeLink = '';
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
hasSendgridSubstitutionTag = true;
|
|
327
|
-
});
|
|
328
|
-
if (hasSendgridSubstitutionTag) {
|
|
329
|
-
return $.html();
|
|
330
|
-
}
|
|
331
|
-
if (groupId) {
|
|
332
|
-
const group = emailProfile.groups?.find((grp) => grp.id === groupId);
|
|
333
|
-
const groupUnsubscribeLink = group?.groupUnsubscribeLink;
|
|
334
|
-
$(unsubscribeLinkRef).each(function () {
|
|
335
|
-
if (!groupUnsubscribeLink) {
|
|
336
|
-
_this.logger.info(`Group Unsubscribe link missing`);
|
|
337
|
-
_this.statsClient.incr('group_unsubscribe_link_missing', 1);
|
|
338
|
-
$(this).attr('href', sendgridUnsubscribeLinkTag);
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
_this.validateLinkAndLog(groupUnsubscribeLink);
|
|
342
|
-
$(this).removeAttr('href');
|
|
343
|
-
$(this).attr('clicktracking', 'off').attr('href', groupUnsubscribeLink);
|
|
344
|
-
_this.logger?.info(`Group Unsubscribe link replaced`);
|
|
345
|
-
_this.statsClient?.incr('replaced_group_unsubscribe_link', 1);
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
$(unsubscribeLinkRef).each(function () {
|
|
351
|
-
if (!globalUnsubscribeLink) {
|
|
352
|
-
_this.logger?.info(`Global Unsubscribe link missing`);
|
|
353
|
-
_this.statsClient?.incr('global_unsubscribe_link_missing', 1);
|
|
354
|
-
$(this).attr('href', sendgridUnsubscribeLinkTag);
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
_this.validateLinkAndLog(globalUnsubscribeLink);
|
|
358
|
-
$(this).removeAttr('href');
|
|
359
|
-
$(this).attr('clicktracking', 'off').attr('href', globalUnsubscribeLink);
|
|
360
|
-
_this.logger?.info(`Global Unsubscribe link replaced`);
|
|
361
|
-
_this.statsClient?.incr('replaced_global_unsubscribe_link', 1);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
$(preferencesLinkRef).each(function () {
|
|
366
|
-
if (!preferencesLink) {
|
|
367
|
-
$(this.parent?.children).each(function () {
|
|
368
|
-
if ($(this).text() == ' | ') {
|
|
369
|
-
$(this).remove();
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
$(this).remove();
|
|
373
|
-
_this.logger?.info(`Preferences link removed from the html body - ${spaceId}`);
|
|
374
|
-
_this.statsClient?.incr('removed_preferences_link', 1);
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
_this.validateLinkAndLog(preferencesLink);
|
|
378
|
-
$(this).removeAttr('href');
|
|
379
|
-
$(this).attr('clicktracking', 'off').attr('href', preferencesLink);
|
|
380
|
-
_this.logger?.info(`Preferences link replaced - ${spaceId}`);
|
|
381
|
-
_this.statsClient?.incr('replaced_preferences_link', 1);
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
return $.html();
|
|
385
|
-
}
|
|
386
|
-
onResponse(args) {
|
|
387
|
-
const headers = args.response?.headers || args.error?.response?.headers;
|
|
388
|
-
const sgMsgId = headers?.get('X-Message-ID');
|
|
389
|
-
if (sgMsgId)
|
|
390
|
-
args.operation.logs.push('[sendgrid]X-Message-ID: ' + sgMsgId);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
__decorate([
|
|
394
|
-
utils_1.track({
|
|
395
|
-
wrapIntegrationError: () => [`Unable to parse templating in email`, `templating parse failure`, 400]
|
|
396
|
-
})
|
|
397
|
-
], SendEmailPerformer.prototype, "parseTemplating", null);
|
|
398
|
-
__decorate([
|
|
399
|
-
utils_1.track()
|
|
400
|
-
], SendEmailPerformer.prototype, "getBodyTemplateFromS3", null);
|
|
401
|
-
__decorate([
|
|
402
|
-
utils_1.track()
|
|
403
|
-
], SendEmailPerformer.prototype, "getBodyHtml", null);
|
|
404
|
-
__decorate([
|
|
405
|
-
utils_1.track({
|
|
406
|
-
wrapIntegrationError: () => ['Unable to export email as HTML', 'Export HTML failure', 400]
|
|
407
|
-
})
|
|
408
|
-
], SendEmailPerformer.prototype, "generateEmailHtml", null);
|
|
409
|
-
__decorate([
|
|
410
|
-
utils_1.track()
|
|
411
|
-
], SendEmailPerformer.prototype, "performApiLookups", null);
|
|
412
|
-
__decorate([
|
|
413
|
-
utils_1.track()
|
|
414
|
-
], SendEmailPerformer.prototype, "validateLinkAndLog", null);
|
|
415
|
-
__decorate([
|
|
416
|
-
utils_1.track()
|
|
417
|
-
], SendEmailPerformer.prototype, "insertUnsubscribeLinks", null);
|
|
418
|
-
exports.SendEmailPerformer = SendEmailPerformer;
|
|
419
|
-
//# sourceMappingURL=SendEmailPerformer.js.map
|