@segment/action-destinations 3.338.0 → 3.338.1-staging-5a1a8b003.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/first-party-dv360/addToAudMobileDeviceId/generated-types.d.ts +5 -0
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/generated-types.js.map +1 -0
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/index.d.ts +5 -0
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/index.js +24 -0
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/index.js.map +1 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/generated-types.d.ts +10 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/generated-types.js +3 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/generated-types.js.map +1 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/index.d.ts +5 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/index.js +29 -0
- package/dist/destinations/first-party-dv360/addtoAudContactInfo/index.js.map +1 -0
- package/dist/destinations/first-party-dv360/functions.d.ts +23 -1
- package/dist/destinations/first-party-dv360/functions.js +133 -1
- package/dist/destinations/first-party-dv360/functions.js.map +1 -1
- package/dist/destinations/first-party-dv360/generated-types.d.ts +0 -1
- package/dist/destinations/first-party-dv360/index.js +12 -19
- package/dist/destinations/first-party-dv360/index.js.map +1 -1
- package/dist/destinations/first-party-dv360/properties.d.ts +12 -0
- package/dist/destinations/first-party-dv360/properties.js +94 -0
- package/dist/destinations/first-party-dv360/properties.js.map +1 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/generated-types.d.ts +10 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/generated-types.js +3 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/generated-types.js.map +1 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/index.d.ts +5 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/index.js +29 -0
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/index.js.map +1 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/generated-types.d.ts +5 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/generated-types.js +3 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/generated-types.js.map +1 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/index.d.ts +5 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/index.js +24 -0
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/index.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.js +1 -1
- package/dist/destinations/index.js +1 -1
- package/dist/destinations/klaviyo/addProfileToList/index.js +1 -13
- package/dist/destinations/klaviyo/addProfileToList/index.js.map +1 -1
- package/dist/destinations/klaviyo/functions.d.ts +11 -4
- package/dist/destinations/klaviyo/functions.js +251 -2
- package/dist/destinations/klaviyo/functions.js.map +1 -1
- package/dist/destinations/klaviyo/properties.d.ts +2 -0
- package/dist/destinations/klaviyo/properties.js +4 -2
- package/dist/destinations/klaviyo/properties.js.map +1 -1
- package/dist/destinations/klaviyo/trackEvent/index.js +8 -3
- package/dist/destinations/klaviyo/trackEvent/index.js.map +1 -1
- package/dist/destinations/klaviyo/types.d.ts +18 -0
- package/dist/destinations/klaviyo/upsertProfile/index.js +1 -1
- package/dist/destinations/mixpanel/__test__/multistatus.test.d.ts +1 -0
- package/dist/destinations/mixpanel/__test__/multistatus.test.js +347 -0
- package/dist/destinations/mixpanel/__test__/multistatus.test.js.map +1 -0
- package/dist/destinations/mixpanel/common/utils.d.ts +15 -0
- package/dist/destinations/mixpanel/common/utils.js +27 -1
- package/dist/destinations/mixpanel/common/utils.js.map +1 -1
- package/dist/destinations/mixpanel/trackEvent/functions.js +1 -1
- package/dist/destinations/mixpanel/trackEvent/functions.js.map +1 -1
- package/dist/destinations/mixpanel/trackEvent/index.js +30 -3
- package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
- package/dist/destinations/mixpanel/trackPurchase/index.js +32 -3
- package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -1
- package/dist/destinations/responsys/index.js +14 -5
- package/dist/destinations/responsys/index.js.map +1 -1
- package/dist/destinations/responsys/sendAudience/index.js +1 -1
- package/dist/destinations/responsys/sendAudienceAsPet/functions.d.ts +10 -0
- package/dist/destinations/responsys/sendAudienceAsPet/functions.js +152 -0
- package/dist/destinations/responsys/sendAudienceAsPet/functions.js.map +1 -0
- package/dist/destinations/responsys/sendAudienceAsPet/generated-types.d.ts +15 -0
- package/dist/destinations/responsys/sendAudienceAsPet/generated-types.js +3 -0
- package/dist/destinations/responsys/sendAudienceAsPet/generated-types.js.map +1 -0
- package/dist/destinations/responsys/sendAudienceAsPet/index.js +143 -0
- package/dist/destinations/responsys/sendAudienceAsPet/index.js.map +1 -0
- package/dist/destinations/responsys/sendCustomTraits/index.js +1 -1
- package/dist/destinations/responsys/{shared_properties.js → shared-properties.js} +1 -1
- package/dist/destinations/responsys/{shared_properties.js.map → shared-properties.js.map} +1 -1
- package/dist/destinations/responsys/types.d.ts +18 -9
- package/dist/destinations/responsys/upsertListMember/index.js +1 -1
- package/dist/destinations/responsys/utils.d.ts +5 -4
- package/dist/destinations/responsys/utils.js +14 -42
- package/dist/destinations/responsys/utils.js.map +1 -1
- package/dist/destinations/s3/fields.js +9 -0
- package/dist/destinations/s3/fields.js.map +1 -1
- package/dist/destinations/s3/functions.d.ts +2 -1
- package/dist/destinations/s3/functions.js +14 -3
- package/dist/destinations/s3/functions.js.map +1 -1
- package/dist/destinations/s3/syncToS3/generated-types.d.ts +1 -0
- package/dist/destinations/s3/syncToS3/index.js +4 -2
- package/dist/destinations/s3/syncToS3/index.js.map +1 -1
- package/dist/destinations/sendgrid/index.js +3 -1
- package/dist/destinations/sendgrid/index.js.map +1 -1
- package/dist/destinations/sendgrid/sendEmail/constants.d.ts +10 -0
- package/dist/destinations/sendgrid/sendEmail/constants.js +27 -0
- package/dist/destinations/sendgrid/sendEmail/constants.js.map +1 -0
- package/dist/destinations/sendgrid/sendEmail/dynamic-fields.d.ts +6 -0
- package/dist/destinations/sendgrid/sendEmail/dynamic-fields.js +135 -0
- package/dist/destinations/sendgrid/sendEmail/dynamic-fields.js.map +1 -0
- package/dist/destinations/sendgrid/sendEmail/fields.d.ts +2 -0
- package/dist/destinations/sendgrid/sendEmail/fields.js +291 -0
- package/dist/destinations/sendgrid/sendEmail/fields.js.map +1 -0
- package/dist/destinations/sendgrid/sendEmail/generated-types.d.ts +53 -0
- package/dist/destinations/sendgrid/sendEmail/generated-types.js +3 -0
- package/dist/destinations/sendgrid/sendEmail/generated-types.js.map +1 -0
- package/dist/destinations/sendgrid/sendEmail/index.d.ts +5 -0
- package/dist/destinations/sendgrid/sendEmail/index.js +29 -0
- package/dist/destinations/sendgrid/sendEmail/index.js.map +1 -0
- package/dist/destinations/sendgrid/sendEmail/types.d.ts +51 -0
- package/dist/destinations/sendgrid/sendEmail/types.js +3 -0
- package/dist/destinations/sendgrid/sendEmail/types.js.map +1 -0
- package/dist/destinations/sendgrid/sendEmail/utils.d.ts +3 -0
- package/dist/destinations/sendgrid/sendEmail/utils.js +98 -0
- package/dist/destinations/sendgrid/sendEmail/utils.js.map +1 -0
- package/dist/destinations/webhook-audiences/__test__/index.test.js +0 -38
- package/dist/destinations/webhook-audiences/__test__/index.test.js.map +1 -1
- package/dist/destinations/webhook-audiences/index.js +14 -2
- package/dist/destinations/webhook-audiences/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/destinations/first-party-dv360/addToList/generated-types.d.ts +0 -2
- package/dist/destinations/first-party-dv360/addToList/generated-types.js.map +0 -1
- package/dist/destinations/first-party-dv360/addToList/index.js +0 -11
- package/dist/destinations/first-party-dv360/addToList/index.js.map +0 -1
- /package/dist/destinations/first-party-dv360/{addToList → addToAudMobileDeviceId}/generated-types.js +0 -0
- /package/dist/destinations/{first-party-dv360/addToList → responsys/sendAudienceAsPet}/index.d.ts +0 -0
- /package/dist/destinations/responsys/{shared_properties.d.ts → shared-properties.d.ts} +0 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fields = void 0;
|
|
4
|
+
exports.fields = {
|
|
5
|
+
domain: {
|
|
6
|
+
label: 'Validated Domain',
|
|
7
|
+
description: 'The domain to use for the email. This field is optional but recommended. If you do not provide a domain, Sendgrid will attempt to send the email based on the from address, and may fail if the domain in the from address is not validated.',
|
|
8
|
+
type: 'string',
|
|
9
|
+
required: false,
|
|
10
|
+
dynamic: true
|
|
11
|
+
},
|
|
12
|
+
from: {
|
|
13
|
+
label: 'From',
|
|
14
|
+
description: 'From details.',
|
|
15
|
+
type: 'object',
|
|
16
|
+
required: true,
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
defaultObjectUI: 'keyvalue',
|
|
19
|
+
properties: {
|
|
20
|
+
email: {
|
|
21
|
+
label: 'Email',
|
|
22
|
+
description: 'The email address of the sender.',
|
|
23
|
+
type: 'string',
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
name: {
|
|
27
|
+
label: 'Name',
|
|
28
|
+
description: 'From name of the sender, displayed to the recipient.',
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
to: {
|
|
35
|
+
label: 'To',
|
|
36
|
+
description: 'Recipient details.',
|
|
37
|
+
type: 'object',
|
|
38
|
+
multiple: true,
|
|
39
|
+
required: true,
|
|
40
|
+
additionalProperties: false,
|
|
41
|
+
defaultObjectUI: 'keyvalue',
|
|
42
|
+
properties: {
|
|
43
|
+
email: {
|
|
44
|
+
label: 'Email',
|
|
45
|
+
description: 'The email address of the recipient.',
|
|
46
|
+
type: 'string',
|
|
47
|
+
required: true
|
|
48
|
+
},
|
|
49
|
+
name: {
|
|
50
|
+
label: 'Name',
|
|
51
|
+
description: 'The name of the recipient.',
|
|
52
|
+
type: 'string',
|
|
53
|
+
required: false
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
cc: {
|
|
58
|
+
label: 'CC',
|
|
59
|
+
description: 'CC recipient details',
|
|
60
|
+
type: 'object',
|
|
61
|
+
multiple: true,
|
|
62
|
+
required: false,
|
|
63
|
+
additionalProperties: false,
|
|
64
|
+
defaultObjectUI: 'keyvalue',
|
|
65
|
+
properties: {
|
|
66
|
+
email: {
|
|
67
|
+
label: 'Email',
|
|
68
|
+
description: 'The email address of the CC recipient.',
|
|
69
|
+
type: 'string',
|
|
70
|
+
required: true
|
|
71
|
+
},
|
|
72
|
+
name: {
|
|
73
|
+
label: 'Name',
|
|
74
|
+
description: 'The name of the CC recipient.',
|
|
75
|
+
type: 'string',
|
|
76
|
+
required: false
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
bcc: {
|
|
81
|
+
label: 'BCC',
|
|
82
|
+
description: 'BCC recipient details',
|
|
83
|
+
type: 'object',
|
|
84
|
+
multiple: true,
|
|
85
|
+
required: false,
|
|
86
|
+
additionalProperties: false,
|
|
87
|
+
defaultObjectUI: 'keyvalue',
|
|
88
|
+
properties: {
|
|
89
|
+
email: {
|
|
90
|
+
label: 'Email',
|
|
91
|
+
description: 'The email address of the BCC recipient.',
|
|
92
|
+
type: 'string',
|
|
93
|
+
required: true
|
|
94
|
+
},
|
|
95
|
+
name: {
|
|
96
|
+
label: 'Name',
|
|
97
|
+
description: 'The name of the BCC recipient.',
|
|
98
|
+
type: 'string',
|
|
99
|
+
required: false
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
headers: {
|
|
104
|
+
label: 'Headers',
|
|
105
|
+
description: 'Headers for the email.',
|
|
106
|
+
type: 'object',
|
|
107
|
+
required: false,
|
|
108
|
+
additionalProperties: true,
|
|
109
|
+
defaultObjectUI: 'keyvalue'
|
|
110
|
+
},
|
|
111
|
+
dynamic_template_data: {
|
|
112
|
+
label: 'Dynamic Template Data',
|
|
113
|
+
description: 'A collection of property names that will be substituted by their corresponding property values in the subject, reply-to and content portions of a SendGrid Dynamic Template.',
|
|
114
|
+
type: 'object',
|
|
115
|
+
required: false,
|
|
116
|
+
defaultObjectUI: 'keyvalue',
|
|
117
|
+
additionalProperties: true
|
|
118
|
+
},
|
|
119
|
+
template_id: {
|
|
120
|
+
label: 'Template ID',
|
|
121
|
+
description: "The template ID to use for the email. This must be for a Dynamic Template and should start with a 'd-'",
|
|
122
|
+
type: 'string',
|
|
123
|
+
required: true,
|
|
124
|
+
dynamic: true
|
|
125
|
+
},
|
|
126
|
+
custom_args: {
|
|
127
|
+
label: 'Custom Args',
|
|
128
|
+
description: 'Custom arguments for the email.',
|
|
129
|
+
type: 'object',
|
|
130
|
+
required: false,
|
|
131
|
+
additionalProperties: true,
|
|
132
|
+
defaultObjectUI: 'keyvalue'
|
|
133
|
+
},
|
|
134
|
+
send_at: {
|
|
135
|
+
label: 'Send At',
|
|
136
|
+
description: 'The time to send the email. ISO 8601 format. E.g. 2024-09-23T12:00:00Z. A send cannot be scheduled more than 72 hours in advance.',
|
|
137
|
+
type: 'string',
|
|
138
|
+
format: 'date-time',
|
|
139
|
+
required: false
|
|
140
|
+
},
|
|
141
|
+
reply_to: {
|
|
142
|
+
label: 'Reply To',
|
|
143
|
+
description: 'Reply to details.',
|
|
144
|
+
type: 'object',
|
|
145
|
+
required: true,
|
|
146
|
+
additionalProperties: false,
|
|
147
|
+
defaultObjectUI: 'keyvalue',
|
|
148
|
+
properties: {
|
|
149
|
+
reply_to_equals_from: {
|
|
150
|
+
label: 'Reply To Equals From',
|
|
151
|
+
description: 'Whether "reply to" settings are the same as "from"',
|
|
152
|
+
type: 'boolean',
|
|
153
|
+
required: true
|
|
154
|
+
},
|
|
155
|
+
email: {
|
|
156
|
+
label: 'Email',
|
|
157
|
+
description: 'The email to reply to.',
|
|
158
|
+
type: 'string',
|
|
159
|
+
required: false
|
|
160
|
+
},
|
|
161
|
+
name: {
|
|
162
|
+
label: 'Name',
|
|
163
|
+
description: 'The name to reply to.',
|
|
164
|
+
type: 'string',
|
|
165
|
+
required: false
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
default: {
|
|
169
|
+
reply_to_equals_from: true
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
subscription_tracking: {
|
|
173
|
+
label: 'Subscription Tracking',
|
|
174
|
+
description: 'Allows you to insert a subscription management link at the bottom of the text and HTML bodies of your email.',
|
|
175
|
+
type: 'object',
|
|
176
|
+
required: false,
|
|
177
|
+
additionalProperties: false,
|
|
178
|
+
defaultObjectUI: 'keyvalue',
|
|
179
|
+
properties: {
|
|
180
|
+
enable: {
|
|
181
|
+
label: 'Enabled',
|
|
182
|
+
description: 'Indicates if this setting is enabled',
|
|
183
|
+
type: 'boolean',
|
|
184
|
+
required: true
|
|
185
|
+
},
|
|
186
|
+
text: {
|
|
187
|
+
label: 'Text',
|
|
188
|
+
description: 'Text to be appended to the email with the subscription tracking link.',
|
|
189
|
+
type: 'string',
|
|
190
|
+
required: false
|
|
191
|
+
},
|
|
192
|
+
html: {
|
|
193
|
+
label: 'HTML',
|
|
194
|
+
description: 'HTML to be appended to the email with the subscription tracking link.',
|
|
195
|
+
type: 'string',
|
|
196
|
+
required: false
|
|
197
|
+
},
|
|
198
|
+
substitution_tag: {
|
|
199
|
+
label: 'Substitution Tag',
|
|
200
|
+
description: 'A tag that will be replaced with the unsubscribe URL. If this property is used, it will override both the text and html properties.',
|
|
201
|
+
type: 'string',
|
|
202
|
+
required: false
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
default: {
|
|
206
|
+
enable: false
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
categories: {
|
|
210
|
+
label: 'Categories',
|
|
211
|
+
description: 'Categories for the email.',
|
|
212
|
+
type: 'string',
|
|
213
|
+
multiple: true,
|
|
214
|
+
required: false
|
|
215
|
+
},
|
|
216
|
+
google_analytics: {
|
|
217
|
+
label: 'Google Analytics',
|
|
218
|
+
description: 'Allows you to enable tracking provided by Google Analytics.',
|
|
219
|
+
type: 'object',
|
|
220
|
+
required: false,
|
|
221
|
+
defaultObjectUI: 'keyvalue',
|
|
222
|
+
additionalProperties: false,
|
|
223
|
+
properties: {
|
|
224
|
+
enable: {
|
|
225
|
+
label: 'Enabled',
|
|
226
|
+
description: 'Indicates if this setting is enabled',
|
|
227
|
+
type: 'boolean',
|
|
228
|
+
required: true
|
|
229
|
+
},
|
|
230
|
+
utm_source: {
|
|
231
|
+
label: 'UTM Source',
|
|
232
|
+
description: 'Name of the referrer source. (e.g., Google, SomeDomain.com, or Marketing Email)',
|
|
233
|
+
type: 'string',
|
|
234
|
+
required: false
|
|
235
|
+
},
|
|
236
|
+
utm_medium: {
|
|
237
|
+
label: 'UTM Medium',
|
|
238
|
+
description: 'Name of the marketing medium. (e.g., Email)',
|
|
239
|
+
type: 'string',
|
|
240
|
+
required: false
|
|
241
|
+
},
|
|
242
|
+
utm_term: {
|
|
243
|
+
label: 'UTM Term',
|
|
244
|
+
description: 'Used to identify any paid keywords.',
|
|
245
|
+
type: 'string',
|
|
246
|
+
required: false
|
|
247
|
+
},
|
|
248
|
+
utm_content: {
|
|
249
|
+
label: 'UTM Content',
|
|
250
|
+
description: 'Used to differentiate your campaign from advertisements.',
|
|
251
|
+
type: 'string',
|
|
252
|
+
required: false
|
|
253
|
+
},
|
|
254
|
+
utm_campaign: {
|
|
255
|
+
label: 'UTM Campaign',
|
|
256
|
+
description: 'The name of the campaign.',
|
|
257
|
+
type: 'string',
|
|
258
|
+
required: false
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
default: {
|
|
262
|
+
enable: true,
|
|
263
|
+
utm_source: { '@path': '$.context.campaign.source' },
|
|
264
|
+
utm_medium: { '@path': '$.context.campaign.medium' },
|
|
265
|
+
utm_term: { '@path': '$.context.campaign.term' },
|
|
266
|
+
utm_content: { '@path': '$.context.campaign.content' },
|
|
267
|
+
utm_campaign: { '@path': '$.context.campaign.name' }
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
ip_pool_name: {
|
|
271
|
+
label: 'IP Pool',
|
|
272
|
+
description: 'Send email with an ip pool.',
|
|
273
|
+
type: 'string',
|
|
274
|
+
required: false,
|
|
275
|
+
dynamic: true
|
|
276
|
+
},
|
|
277
|
+
group_id: {
|
|
278
|
+
label: 'Group ID',
|
|
279
|
+
description: 'Specify a Group ID',
|
|
280
|
+
type: 'string',
|
|
281
|
+
required: false,
|
|
282
|
+
dynamic: true
|
|
283
|
+
},
|
|
284
|
+
sandbox_mode: {
|
|
285
|
+
label: 'Sandbox Mode',
|
|
286
|
+
description: 'Sandbox Mode allows you to send a test email to ensure that your request body is valid and formatted correctly.',
|
|
287
|
+
type: 'boolean',
|
|
288
|
+
required: false
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/destinations/sendgrid/sendEmail/fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,MAAM,GAA+B;IAChD,MAAM,EAAE;QACN,KAAK,EAAE,kBAAkB;QACzB,WAAW,EACT,8OAA8O;QAChP,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,IAAI;KACd;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,oBAAoB,EAAE,KAAK;QAC3B,eAAe,EAAE,UAAU;QAC3B,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,KAAK,EAAE,OAAO;gBACd,WAAW,EAAE,kCAAkC;gBA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E,IAAI;YACZ,UAAU,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE;YACpD,UAAU,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE;YACpD,QAAQ,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE;YAChD,WAAW,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE;YACtD,YAAY,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE;SACrD;KACF;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,6BAA6B;QAC1C,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,IAAI;KACd;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,IAAI;KACd;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,cAAc;QACrB,WAAW,EACT,iHAAiH;QACnH,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,KAAK;KAChB;CACF,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
domain?: string;
|
|
3
|
+
from: {
|
|
4
|
+
email: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
};
|
|
7
|
+
to: {
|
|
8
|
+
email: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
}[];
|
|
11
|
+
cc?: {
|
|
12
|
+
email: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
}[];
|
|
15
|
+
bcc?: {
|
|
16
|
+
email: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
}[];
|
|
19
|
+
headers?: {
|
|
20
|
+
[k: string]: unknown;
|
|
21
|
+
};
|
|
22
|
+
dynamic_template_data?: {
|
|
23
|
+
[k: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
template_id: string;
|
|
26
|
+
custom_args?: {
|
|
27
|
+
[k: string]: unknown;
|
|
28
|
+
};
|
|
29
|
+
send_at?: string;
|
|
30
|
+
reply_to: {
|
|
31
|
+
reply_to_equals_from: boolean;
|
|
32
|
+
email?: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
};
|
|
35
|
+
subscription_tracking?: {
|
|
36
|
+
enable: boolean;
|
|
37
|
+
text?: string;
|
|
38
|
+
html?: string;
|
|
39
|
+
substitution_tag?: string;
|
|
40
|
+
};
|
|
41
|
+
categories?: string[];
|
|
42
|
+
google_analytics?: {
|
|
43
|
+
enable: boolean;
|
|
44
|
+
utm_source?: string;
|
|
45
|
+
utm_medium?: string;
|
|
46
|
+
utm_term?: string;
|
|
47
|
+
utm_content?: string;
|
|
48
|
+
utm_campaign?: string;
|
|
49
|
+
};
|
|
50
|
+
ip_pool_name?: string;
|
|
51
|
+
group_id?: string;
|
|
52
|
+
sandbox_mode?: boolean;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/sendgrid/sendEmail/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("./utils");
|
|
4
|
+
const fields_1 = require("./fields");
|
|
5
|
+
const dynamic_fields_1 = require("./dynamic-fields");
|
|
6
|
+
const action = {
|
|
7
|
+
title: 'Send email with Dynamic Template',
|
|
8
|
+
description: 'Send email to recipient(s) using a Dynamic Template in Sendgrid',
|
|
9
|
+
fields: fields_1.fields,
|
|
10
|
+
dynamicFields: {
|
|
11
|
+
template_id: async (request) => {
|
|
12
|
+
return await dynamic_fields_1.dynamicTemplateId(request);
|
|
13
|
+
},
|
|
14
|
+
ip_pool_name: async (request) => {
|
|
15
|
+
return await dynamic_fields_1.dynamicIpPoolNames(request);
|
|
16
|
+
},
|
|
17
|
+
domain: async (request) => {
|
|
18
|
+
return await dynamic_fields_1.dynamicDomain(request);
|
|
19
|
+
},
|
|
20
|
+
group_id: async (request) => {
|
|
21
|
+
return await dynamic_fields_1.dynamicGroupId(request);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
perform: async (request, { payload }) => {
|
|
25
|
+
return await utils_1.send(request, payload);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.default = action;
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/sendgrid/sendEmail/index.ts"],"names":[],"mappings":";;AAGA,mCAA8B;AAC9B,qCAAiC;AACjC,qDAAuG;AAEvG,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kCAAkC;IACzC,WAAW,EAAE,iEAAiE;IAC9E,MAAM,EAAN,eAAM;IACN,aAAa,EAAE;QACb,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YAC7B,OAAO,MAAM,kCAAiB,CAAC,OAAO,CAAC,CAAA;QACzC,CAAC;QACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YAC9B,OAAO,MAAM,mCAAkB,CAAC,OAAO,CAAC,CAAA;QAC1C,CAAC;QACD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACxB,OAAO,MAAM,8BAAa,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC;QACD,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YAC1B,OAAO,MAAM,+BAAc,CAAC,OAAO,CAAC,CAAA;QACtC,CAAC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,OAAO,MAAM,YAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
interface EmailDetails {
|
|
2
|
+
email: string;
|
|
3
|
+
name: string | undefined;
|
|
4
|
+
}
|
|
5
|
+
interface StringObject {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SendEmailReq {
|
|
9
|
+
domain?: string;
|
|
10
|
+
personalizations: [
|
|
11
|
+
{
|
|
12
|
+
to: EmailDetails[];
|
|
13
|
+
cc?: EmailDetails[];
|
|
14
|
+
bcc?: EmailDetails[];
|
|
15
|
+
headers?: StringObject;
|
|
16
|
+
dynamic_template_data?: {
|
|
17
|
+
[k: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
custom_args?: StringObject;
|
|
20
|
+
send_at?: number;
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
from: EmailDetails;
|
|
24
|
+
reply_to?: EmailDetails;
|
|
25
|
+
template_id: string;
|
|
26
|
+
categories?: string[];
|
|
27
|
+
asm?: {
|
|
28
|
+
group_id: number;
|
|
29
|
+
};
|
|
30
|
+
ip_pool_name?: string;
|
|
31
|
+
tracking_settings?: {
|
|
32
|
+
subscription_tracking?: {
|
|
33
|
+
enable: boolean;
|
|
34
|
+
text?: string;
|
|
35
|
+
html?: string;
|
|
36
|
+
substitution_tag?: string;
|
|
37
|
+
};
|
|
38
|
+
ganalytics?: {
|
|
39
|
+
enable: boolean;
|
|
40
|
+
utm_source?: string;
|
|
41
|
+
utm_medium?: string;
|
|
42
|
+
utm_term?: string;
|
|
43
|
+
utm_content?: string;
|
|
44
|
+
utm_campaign?: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
mail_settings?: {
|
|
48
|
+
sandbox_mode?: boolean;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/destinations/sendgrid/sendEmail/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.send = void 0;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
async function send(request, payload) {
|
|
7
|
+
validate(payload);
|
|
8
|
+
const groupId = getIntFromString(payload.group_id);
|
|
9
|
+
const json = {
|
|
10
|
+
personalizations: [
|
|
11
|
+
{
|
|
12
|
+
to: payload.to.map((to) => ({ email: to.email, name: to?.name ?? undefined })),
|
|
13
|
+
cc: payload.cc?.map((cc) => ({ email: cc.email, name: cc?.name ?? undefined })) ?? undefined,
|
|
14
|
+
bcc: payload.bcc?.map((bcc) => ({ email: bcc.email, name: bcc?.name ?? undefined })) ?? undefined,
|
|
15
|
+
headers: Object.entries(payload?.headers ?? {}).reduce((acc, [key, value]) => {
|
|
16
|
+
acc[key] = String(value);
|
|
17
|
+
return acc;
|
|
18
|
+
}, {}) || undefined,
|
|
19
|
+
dynamic_template_data: payload.dynamic_template_data,
|
|
20
|
+
custom_args: payload?.custom_args && Object.keys(payload.custom_args).length > 0
|
|
21
|
+
? Object.fromEntries(Object.entries(payload.custom_args).map(([key, value]) => [key, String(value)]))
|
|
22
|
+
: undefined,
|
|
23
|
+
send_at: toUnixTS(payload.send_at) ?? undefined
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
from: { email: payload.from.email, name: payload.from?.name ?? undefined },
|
|
27
|
+
reply_to: {
|
|
28
|
+
email: (payload.reply_to.reply_to_equals_from ? payload.from.email : payload.reply_to.email),
|
|
29
|
+
name: payload.reply_to.reply_to_equals_from ? payload.from.name : payload.reply_to.name
|
|
30
|
+
},
|
|
31
|
+
template_id: payload.template_id,
|
|
32
|
+
categories: payload.categories,
|
|
33
|
+
asm: typeof groupId === 'number' ? { group_id: groupId } : undefined,
|
|
34
|
+
ip_pool_name: payload.ip_pool_name,
|
|
35
|
+
tracking_settings: {
|
|
36
|
+
subscription_tracking: payload.subscription_tracking ?? undefined,
|
|
37
|
+
ganalytics: payload.google_analytics ?? undefined
|
|
38
|
+
},
|
|
39
|
+
mail_settings: typeof payload.sandbox_mode === 'boolean' ? { sandbox_mode: payload.sandbox_mode } : undefined
|
|
40
|
+
};
|
|
41
|
+
return await request(constants_1.SEND_EMAIL_URL, {
|
|
42
|
+
method: 'post',
|
|
43
|
+
json
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.send = send;
|
|
47
|
+
function toUnixTS(date) {
|
|
48
|
+
if (typeof date === 'undefined' || date === null || date === '') {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return new Date(date).getTime();
|
|
52
|
+
}
|
|
53
|
+
function getIntFromString(value) {
|
|
54
|
+
const regex = /^\d+/;
|
|
55
|
+
const match = regex.exec(value ?? '');
|
|
56
|
+
if (match) {
|
|
57
|
+
const maybeInt = parseInt(match[0], 10);
|
|
58
|
+
if (!isNaN(maybeInt)) {
|
|
59
|
+
return maybeInt;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
function validate(payload) {
|
|
65
|
+
if (payload.group_id && typeof getIntFromString(payload.group_id) !== 'number') {
|
|
66
|
+
throw new actions_core_1.PayloadValidationError('Group ID value must be a numberic (integer) string');
|
|
67
|
+
}
|
|
68
|
+
if (payload.domain && !payload.from.email.endsWith(payload.domain)) {
|
|
69
|
+
throw new actions_core_1.PayloadValidationError('From email must be from the selected domain');
|
|
70
|
+
}
|
|
71
|
+
if (!payload.template_id.startsWith('d-')) {
|
|
72
|
+
throw new actions_core_1.PayloadValidationError('Template ID must refer to a Dynamic Template. Dynamic Template IDs start with "d-"');
|
|
73
|
+
}
|
|
74
|
+
if (!payload.reply_to.reply_to_equals_from && !payload.reply_to.email) {
|
|
75
|
+
throw new actions_core_1.PayloadValidationError("'Reply To >> Email' must be provided if 'Reply To Equals From' is set to true");
|
|
76
|
+
}
|
|
77
|
+
if (Object.keys(payload?.headers ?? {}).some((key) => constants_1.RESERVED_HEADERS.includes(key))) {
|
|
78
|
+
throw new actions_core_1.PayloadValidationError(`Headers cannot contain any of the following reserved headers: ${constants_1.RESERVED_HEADERS.join(', ')}`);
|
|
79
|
+
}
|
|
80
|
+
payload?.categories?.forEach((category) => {
|
|
81
|
+
if (category.length > constants_1.MAX_CATEGORY_LENGTH) {
|
|
82
|
+
throw new actions_core_1.PayloadValidationError(`Category with name ${category} exceeds the max length of ${constants_1.MAX_CATEGORY_LENGTH} characters`);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
if (payload.send_at) {
|
|
86
|
+
const sendAt = new Date(payload.send_at);
|
|
87
|
+
const now = new Date();
|
|
88
|
+
if (sendAt.getTime() < now.getTime() || sendAt.getTime() > now.getTime() + 72 * 60 * 60 * 1000) {
|
|
89
|
+
throw new actions_core_1.PayloadValidationError('send_at should be less than 72 hours from now');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (payload.ip_pool_name &&
|
|
93
|
+
(payload.ip_pool_name.length >= constants_1.MAX_IP_POOL_NAME_LENGTH || payload.ip_pool_name.length <= constants_1.MIN_IP_POOL_NAME_LENGTH)) {
|
|
94
|
+
throw new actions_core_1.PayloadValidationError(`IP Pool Name should at least ${constants_1.MIN_IP_POOL_NAME_LENGTH} characters and at most ${constants_1.MAX_IP_POOL_NAME_LENGTH} characters in length`);
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/destinations/sendgrid/sendEmail/utils.ts"],"names":[],"mappings":";;;AAAA,wDAA6E;AAG7E,2CAMoB;AAEb,KAAK,UAAU,IAAI,CAAC,OAAsB,EAAE,OAAgB;IACjE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAEjB,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC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2B,mCAAuB,uBAAuB,CACjI,CAAA;KACF;IAED,OAAM;AACR,CAAC"}
|
|
@@ -10,44 +10,6 @@ const actions_core_1 = require("@segment/actions-core");
|
|
|
10
10
|
webhook_test_1.baseWebhookTests(index_1.default);
|
|
11
11
|
const testDestination = actions_core_1.createTestIntegration(index_1.default);
|
|
12
12
|
describe('Webhook Audience Tests', () => {
|
|
13
|
-
it('creates an audience', async () => {
|
|
14
|
-
const fakeUrl = 'http://segmentfake.xyz';
|
|
15
|
-
const exampleRequest = {
|
|
16
|
-
audienceName: 'My Cool Audience',
|
|
17
|
-
nice: 'ok'
|
|
18
|
-
};
|
|
19
|
-
const exampleResponse = {
|
|
20
|
-
externalId: 'abc123xyz'
|
|
21
|
-
};
|
|
22
|
-
nock_1.default(fakeUrl).post('/', exampleRequest).reply(200, exampleResponse);
|
|
23
|
-
const expectedResponse = await testDestination.createAudience({
|
|
24
|
-
audienceName: 'My Cool Audience',
|
|
25
|
-
audienceSettings: {
|
|
26
|
-
extras: JSON.stringify({ nice: 'ok' })
|
|
27
|
-
},
|
|
28
|
-
settings: { createAudienceUrl: fakeUrl }
|
|
29
|
-
});
|
|
30
|
-
expect(expectedResponse).toStrictEqual(exampleResponse);
|
|
31
|
-
});
|
|
32
|
-
it('gets an audience', async () => {
|
|
33
|
-
const fakeUrl = 'http://segmentfake.xyz';
|
|
34
|
-
const exampleRequest = {
|
|
35
|
-
externalId: 'abc123xyz',
|
|
36
|
-
nice: 'ok'
|
|
37
|
-
};
|
|
38
|
-
const exampleResponse = {
|
|
39
|
-
externalId: 'abc123xyz'
|
|
40
|
-
};
|
|
41
|
-
nock_1.default(fakeUrl).post('/', exampleRequest).reply(200, exampleResponse);
|
|
42
|
-
const expectedResponse = await testDestination.getAudience({
|
|
43
|
-
externalId: 'abc123xyz',
|
|
44
|
-
settings: { getAudienceUrl: fakeUrl },
|
|
45
|
-
audienceSettings: {
|
|
46
|
-
extras: JSON.stringify({ nice: 'ok' })
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
expect(expectedResponse).toStrictEqual(exampleResponse);
|
|
50
|
-
});
|
|
51
13
|
it('send through audience extra settings', async () => {
|
|
52
14
|
const url = 'https://example.com';
|
|
53
15
|
const event = actions_core_1.createTestEvent({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/destinations/webhook-audiences/__test__/index.test.ts"],"names":[],"mappings":";;;;;AAAA,qDAAsC;AACtC,sEAAsE;AACtE,gDAAuB;AACvB,wDAA8E;AAE9E,+BAAgB,CAAC,eAAe,CAAC,CAAA;AAEjC,MAAM,eAAe,GAAG,oCAAqB,CAAC,eAAe,CAAC,CAAA;AAC9D,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/destinations/webhook-audiences/__test__/index.test.ts"],"names":[],"mappings":";;;;;AAAA,qDAAsC;AACtC,sEAAsE;AACtE,gDAAuB;AACvB,wDAA8E;AAE9E,+BAAgB,CAAC,eAAe,CAAC,CAAA;AAEjC,MAAM,eAAe,GAAG,oCAAqB,CAAC,eAAe,CAAC,CAAA;AAC9D,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IA6CtC,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,GAAG,GAAG,qBAAqB,CAAA;QACjC,MAAM,KAAK,GAAG,8BAAe,CAAC;YAC5B,OAAO,EAAE;gBACP,QAAQ,EAAE;oBACR,iBAAiB,EAAE;wBACjB,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;qBACvC;iBACF;aACF;SACF,CAAC,CAAA;QAEF,cAAI,CAAC,GAAG,CAAC;aACN,IAAI,CAAC,GAAG,CAAC;aACT,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,CAAA;QAE9C,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE;YACzD,KAAK;YACL,OAAO,EAAE;gBACP,GAAG;aACJ;YACD,kBAAkB,EAAE,IAAI;SACzB,CAAC,CAAA;QAEF,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAChC,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;QAC7B,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAClC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|