@segment/action-destinations 3.268.0 → 3.268.1-staging.13
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/amazon-ads/generated-types.d.ts +9 -0
- package/dist/destinations/amazon-ads/index.d.ts +2 -2
- package/dist/destinations/amazon-ads/index.js +161 -11
- package/dist/destinations/amazon-ads/index.js.map +1 -1
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +13 -0
- package/dist/destinations/amazon-ads/syncAudiences/index.js +174 -7
- package/dist/destinations/amazon-ads/syncAudiences/index.js.map +1 -1
- package/dist/destinations/amazon-ads/types.d.ts +25 -0
- package/dist/destinations/amazon-ads/utils.d.ts +37 -0
- package/dist/destinations/amazon-ads/utils.js +25 -0
- package/dist/destinations/amazon-ads/utils.js.map +1 -0
- package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.d.ts +1 -1
- package/dist/destinations/engage/utils/track.d.ts +17 -17
- package/dist/destinations/klaviyo/functions.d.ts +3 -1
- package/dist/destinations/klaviyo/functions.js +23 -2
- package/dist/destinations/klaviyo/functions.js.map +1 -1
- package/dist/destinations/klaviyo/types.d.ts +4 -0
- package/dist/destinations/klaviyo/types.js.map +1 -1
- package/dist/destinations/klaviyo/upsertProfile/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/upsertProfile/index.js +15 -7
- package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AudienceDestinationDefinition } from '@segment/actions-core';
|
|
2
|
-
import type { Settings } from './generated-types';
|
|
3
|
-
declare const destination: AudienceDestinationDefinition<Settings>;
|
|
2
|
+
import type { Settings, AudienceSettings } from './generated-types';
|
|
3
|
+
declare const destination: AudienceDestinationDefinition<Settings, AudienceSettings>;
|
|
4
4
|
export default destination;
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
7
8
|
const syncAudiences_1 = __importDefault(require("./syncAudiences"));
|
|
8
9
|
const destination = {
|
|
9
10
|
name: 'Amazon Ads',
|
|
@@ -20,30 +21,32 @@ const destination = {
|
|
|
20
21
|
{ label: 'Europe (EU)', value: 'https://advertising-api-eu.amazon.com' },
|
|
21
22
|
{ label: 'Far East (FE)', value: 'https://advertising-api-fe.amazon.com' }
|
|
22
23
|
],
|
|
23
|
-
default: '
|
|
24
|
+
default: 'https://advertising-api.amazon.com',
|
|
24
25
|
type: 'string',
|
|
25
26
|
required: true
|
|
26
27
|
}
|
|
27
28
|
},
|
|
28
|
-
testAuthentication: async (request, { auth }) => {
|
|
29
|
+
testAuthentication: async (request, { auth, settings }) => {
|
|
29
30
|
if (!auth?.accessToken) {
|
|
30
31
|
throw new actions_core_1.InvalidAuthenticationError('Please authenticate via Oauth before enabling the destination.');
|
|
31
32
|
}
|
|
32
33
|
try {
|
|
33
|
-
await request(
|
|
34
|
+
await request(`${settings.region}/v2/profiles`, {
|
|
34
35
|
method: 'GET'
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
38
|
catch (e) {
|
|
38
39
|
const error = e;
|
|
39
40
|
if (error.message === 'Unauthorized') {
|
|
40
|
-
throw new
|
|
41
|
+
throw new actions_core_1.InvalidAuthenticationError('Invalid Amazon Oauth access token. Please reauthenticate to retrieve a valid access token before enabling the destination.');
|
|
41
42
|
}
|
|
42
43
|
throw e;
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
|
-
refreshAccessToken: async (request, { auth }) => {
|
|
46
|
+
refreshAccessToken: async (request, { auth, settings }) => {
|
|
47
|
+
const endpoint = utils_1.AUTHORIZATION_URL[`${settings.region}`];
|
|
46
48
|
let res;
|
|
49
|
+
console.log(settings.region, auth, endpoint);
|
|
47
50
|
try {
|
|
48
51
|
res = await request('https://api.amazon.com/auth/o2/token', {
|
|
49
52
|
method: 'POST',
|
|
@@ -52,31 +55,178 @@ const destination = {
|
|
|
52
55
|
client_id: auth.clientId,
|
|
53
56
|
client_secret: auth.clientSecret,
|
|
54
57
|
grant_type: 'refresh_token'
|
|
55
|
-
})
|
|
58
|
+
}),
|
|
59
|
+
headers: {
|
|
60
|
+
authorization: ''
|
|
61
|
+
}
|
|
56
62
|
});
|
|
63
|
+
return { accessToken: res.data.access_token };
|
|
57
64
|
}
|
|
58
65
|
catch (e) {
|
|
66
|
+
console.log(e);
|
|
59
67
|
const error = e;
|
|
60
68
|
if (error.response?.data?.error === 'invalid_grant') {
|
|
61
|
-
throw new actions_core_1.
|
|
69
|
+
throw new actions_core_1.InvalidAuthenticationError(`Invalid Authentication: Your refresh token is invalid or expired. Please re-authenticate to fetch a new refresh token.`, actions_core_1.ErrorCodes.REFRESH_TOKEN_EXPIRED);
|
|
62
70
|
}
|
|
63
|
-
throw new actions_core_1.
|
|
71
|
+
throw new actions_core_1.InvalidAuthenticationError(`Failed to fetch a new access token. Reason: ${error.response?.data?.error}`, actions_core_1.ErrorCodes.OAUTH_REFRESH_FAILED);
|
|
64
72
|
}
|
|
65
|
-
return { accessToken: res?.data?.access_token };
|
|
66
73
|
}
|
|
67
74
|
},
|
|
68
75
|
extendRequest({ auth }) {
|
|
69
76
|
return {
|
|
70
77
|
headers: {
|
|
71
|
-
authorization: `Bearer ${auth?.accessToken}
|
|
78
|
+
authorization: `Bearer ${auth?.accessToken}`,
|
|
79
|
+
'Amazon-Advertising-API-ClientID': process.env.ACTIONS_AMAZON_ADS_CLIENT_ID || ''
|
|
72
80
|
}
|
|
73
81
|
};
|
|
74
82
|
},
|
|
75
|
-
audienceFields: {
|
|
83
|
+
audienceFields: {
|
|
84
|
+
description: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
label: 'Description',
|
|
87
|
+
required: true,
|
|
88
|
+
description: 'The audience description. Must be an alphanumeric, non-null string between 0 to 1000 characters in length.'
|
|
89
|
+
},
|
|
90
|
+
countryCode: {
|
|
91
|
+
type: 'string',
|
|
92
|
+
label: 'Country Code',
|
|
93
|
+
required: true,
|
|
94
|
+
description: 'A String value representing ISO 3166-1 alpha-2 country code for the members in this audience.'
|
|
95
|
+
},
|
|
96
|
+
externalAudienceId: {
|
|
97
|
+
type: 'string',
|
|
98
|
+
label: 'External Audience Id',
|
|
99
|
+
required: true,
|
|
100
|
+
description: 'The user-defined audience identifier.'
|
|
101
|
+
},
|
|
102
|
+
cpmCents: {
|
|
103
|
+
label: 'CPM Cents',
|
|
104
|
+
type: 'number',
|
|
105
|
+
description: `Cost per thousand impressions (CPM) in cents. For example, $1.00 = 100 cents.`
|
|
106
|
+
},
|
|
107
|
+
currency: {
|
|
108
|
+
label: 'Currency',
|
|
109
|
+
type: 'string',
|
|
110
|
+
description: `The price paid. Base units depend on the currency. As an example, USD should be reported as Dollars.Cents, whereas JPY should be reported as a whole number of Yen. All provided values will be rounded to two digits with toFixed(2).Refer [Aamzon Ads Documentation](https://advertising.amazon.com/API/docs/en-us/amc-advertiser-audience#tag/Audience-Metadata/operation/CreateAudienceMetadataV2) to view supported Currency`
|
|
111
|
+
},
|
|
112
|
+
ttl: {
|
|
113
|
+
type: 'number',
|
|
114
|
+
label: 'Time-to-live',
|
|
115
|
+
required: false,
|
|
116
|
+
description: 'Time-to-live in seconds. The amount of time the record is associated with the audience.'
|
|
117
|
+
},
|
|
118
|
+
advertiserId: {
|
|
119
|
+
label: 'Advertiser ID',
|
|
120
|
+
description: 'Advertiser Id',
|
|
121
|
+
type: 'string',
|
|
122
|
+
required: true
|
|
123
|
+
}
|
|
124
|
+
},
|
|
76
125
|
audienceConfig: {
|
|
77
126
|
mode: {
|
|
78
127
|
type: 'synced',
|
|
79
128
|
full_audience_sync: false
|
|
129
|
+
},
|
|
130
|
+
async createAudience(request, createAudienceInput) {
|
|
131
|
+
const { audienceName, statsContext, audienceSettings } = createAudienceInput;
|
|
132
|
+
const { statsClient, tags: statsTags } = statsContext || {};
|
|
133
|
+
const endpoint = createAudienceInput.settings.region;
|
|
134
|
+
const description = audienceSettings?.description;
|
|
135
|
+
const advertiser_id = audienceSettings?.advertiserId;
|
|
136
|
+
const external_audience_id = audienceSettings?.externalAudienceId;
|
|
137
|
+
const country_code = audienceSettings?.countryCode;
|
|
138
|
+
const ttl = audienceSettings?.ttl;
|
|
139
|
+
const currency = audienceSettings?.currency;
|
|
140
|
+
const cpm_cents = audienceSettings?.cpmCents;
|
|
141
|
+
const statsName = 'createAmazonAudience';
|
|
142
|
+
statsTags?.push(`slug:${destination.slug}`);
|
|
143
|
+
statsTags?.push(`ttl_type:${typeof ttl}_${ttl}`);
|
|
144
|
+
statsTags?.push(`cpmcents_type:${typeof cpm_cents}_${cpm_cents}`);
|
|
145
|
+
statsClient?.incr(`${statsName}.intialise`, 1, statsTags);
|
|
146
|
+
console.log(ttl, cpm_cents);
|
|
147
|
+
if (!advertiser_id) {
|
|
148
|
+
throw new actions_core_1.IntegrationError('Missing advertiserId Value', 'MISSING_REQUIRED_FIELD', 400);
|
|
149
|
+
}
|
|
150
|
+
if (!description) {
|
|
151
|
+
throw new actions_core_1.IntegrationError('Missing description Value', 'MISSING_REQUIRED_FIELD', 400);
|
|
152
|
+
}
|
|
153
|
+
if (!external_audience_id) {
|
|
154
|
+
throw new actions_core_1.IntegrationError('Missing externalAudienceId Value', 'MISSING_REQUIRED_FIELD', 400);
|
|
155
|
+
}
|
|
156
|
+
if (!audienceName) {
|
|
157
|
+
throw new actions_core_1.IntegrationError('Missing audienceName Value', 'MISSING_REQUIRED_FIELD', 400);
|
|
158
|
+
}
|
|
159
|
+
if (!country_code) {
|
|
160
|
+
throw new actions_core_1.IntegrationError('Missing countryCode Value', 'MISSING_REQUIRED_FIELD', 400);
|
|
161
|
+
}
|
|
162
|
+
const payload = {
|
|
163
|
+
name: audienceName,
|
|
164
|
+
description: description,
|
|
165
|
+
targetResource: {
|
|
166
|
+
advertiserId: advertiser_id
|
|
167
|
+
},
|
|
168
|
+
metadata: {
|
|
169
|
+
externalAudienceId: external_audience_id
|
|
170
|
+
},
|
|
171
|
+
countryCode: country_code
|
|
172
|
+
};
|
|
173
|
+
if (ttl) {
|
|
174
|
+
const timeToLive = Number(ttl);
|
|
175
|
+
if (!timeToLive) {
|
|
176
|
+
throw new actions_core_1.IntegrationError('TTL:-String can not be converted to Number', 'INVALID_TTL_VALUE', 400);
|
|
177
|
+
}
|
|
178
|
+
payload.metadata.ttl = timeToLive;
|
|
179
|
+
}
|
|
180
|
+
if (cpm_cents && currency) {
|
|
181
|
+
if (!utils_1.CURRENCY.includes(currency)) {
|
|
182
|
+
throw new actions_core_1.IntegrationError('Invalid Currency Value', 'INVALID_CURRENCY_VALUE', 400);
|
|
183
|
+
}
|
|
184
|
+
const cpmCents = Number(cpm_cents);
|
|
185
|
+
if (!cpmCents) {
|
|
186
|
+
throw new actions_core_1.IntegrationError('CPM_CENTS:-String can not be converted to Number', 'INVALID_CPMCENTS_VALUE', 400);
|
|
187
|
+
}
|
|
188
|
+
payload.metadata.audienceFees = [];
|
|
189
|
+
payload.metadata?.audienceFees.push({
|
|
190
|
+
currency,
|
|
191
|
+
cpmCents: cpmCents
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
statsTags?.push(`slug:${destination.slug}`);
|
|
195
|
+
statsClient?.incr(`${statsName}.call`, 1, statsTags);
|
|
196
|
+
let payloadString = JSON.stringify(payload);
|
|
197
|
+
payloadString = payloadString.replace(utils_1.REGEX_ADVERTISERID, '"advertiserId":$1');
|
|
198
|
+
const response = await request(`${endpoint}/amc/audiences/metadata`, {
|
|
199
|
+
method: 'POST',
|
|
200
|
+
body: payloadString,
|
|
201
|
+
headers: {
|
|
202
|
+
'Content-Type': 'application/vnd.amcaudiences.v1+json'
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
const res = await response.text();
|
|
206
|
+
const resp = utils_1.extractNumberAndSubstituteWithStringValue(res, utils_1.REGEX_AUDIENCEID, '"audienceId":"$1"');
|
|
207
|
+
return {
|
|
208
|
+
externalId: resp.audienceId
|
|
209
|
+
};
|
|
210
|
+
},
|
|
211
|
+
async getAudience(request, getAudienceInput) {
|
|
212
|
+
const { statsContext } = getAudienceInput;
|
|
213
|
+
const audience_id = getAudienceInput.externalId;
|
|
214
|
+
const endpoint = getAudienceInput.settings.region;
|
|
215
|
+
const { statsClient, tags: statsTags } = statsContext || {};
|
|
216
|
+
const statsName = 'getAudience';
|
|
217
|
+
statsTags?.push(`slug:${destination.slug}`);
|
|
218
|
+
statsClient?.incr(`${statsName}.call`, 1, statsTags);
|
|
219
|
+
if (!audience_id) {
|
|
220
|
+
throw new actions_core_1.IntegrationError('Missing audienceId value', 'MISSING_REQUIRED_FIELD', 400);
|
|
221
|
+
}
|
|
222
|
+
const response = await request(`${endpoint}/amc/audiences/metadata/${audience_id}`, {
|
|
223
|
+
method: 'GET'
|
|
224
|
+
});
|
|
225
|
+
const res = await response.text();
|
|
226
|
+
const resp = utils_1.extractNumberAndSubstituteWithStringValue(res, utils_1.REGEX_AUDIENCEID, '"audienceId":"$1"');
|
|
227
|
+
return {
|
|
228
|
+
externalId: resp.audienceId
|
|
229
|
+
};
|
|
80
230
|
}
|
|
81
231
|
},
|
|
82
232
|
actions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAgG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAgG;AAGhG,mCAOgB;AAEhB,oEAA2C;AAE3C,MAAM,WAAW,GAA8D;IAC7E,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,M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AAE,mBAAmB,CAAC,CAAA;YAClG,OAAO;gBACL,UAAU,EAAE,IAAI,CAAC,UAAU;aAC5B,CAAA;QACH,CAAC;KACF;IACD,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
export interface Payload {
|
|
2
|
+
event_name?: string;
|
|
3
|
+
externalUserId: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
firstName?: string;
|
|
6
|
+
lastName?: string;
|
|
7
|
+
phone?: string;
|
|
8
|
+
postal?: string;
|
|
9
|
+
state?: string;
|
|
10
|
+
city?: string;
|
|
11
|
+
address?: string;
|
|
12
|
+
audienceId: string;
|
|
13
|
+
enable_batching: boolean;
|
|
14
|
+
batch_size?: number;
|
|
2
15
|
}
|
|
@@ -1,15 +1,182 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
3
5
|
const action = {
|
|
4
|
-
title: 'Sync
|
|
6
|
+
title: 'Sync Audience',
|
|
5
7
|
description: 'Sync audiences from Segment to Amazon Ads Audience.',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
defaultSubscription: 'event = "Audience Entered" or event = "Audience Exited"',
|
|
9
|
+
fields: {
|
|
10
|
+
event_name: {
|
|
11
|
+
label: 'Event Name',
|
|
12
|
+
description: 'The name of the current Segment event.',
|
|
13
|
+
type: 'string',
|
|
14
|
+
unsafe_hidden: true,
|
|
15
|
+
default: {
|
|
16
|
+
'@path': '$.event'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
externalUserId: {
|
|
20
|
+
label: 'External User ID',
|
|
21
|
+
description: 'This is an external user identifier defined by data providers.',
|
|
22
|
+
type: 'string',
|
|
23
|
+
required: true,
|
|
24
|
+
default: { '@path': '$.userId' }
|
|
25
|
+
},
|
|
26
|
+
email: {
|
|
27
|
+
label: 'Email',
|
|
28
|
+
description: 'User email address. Vaule will be hashed before sending to Amazon.',
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: false,
|
|
31
|
+
default: { '@path': '$.properties.email' }
|
|
32
|
+
},
|
|
33
|
+
firstName: {
|
|
34
|
+
label: 'First name',
|
|
35
|
+
description: 'User first name. Value will be hashed before sending to Amazon.',
|
|
36
|
+
type: 'string',
|
|
37
|
+
required: false,
|
|
38
|
+
default: { '@path': '$.properties.first_name' }
|
|
39
|
+
},
|
|
40
|
+
lastName: {
|
|
41
|
+
label: 'Last name',
|
|
42
|
+
description: 'User Last name. Value will be hashed before sending to Amazon.',
|
|
43
|
+
type: 'string',
|
|
44
|
+
required: false,
|
|
45
|
+
default: { '@path': '$.properties.last_name' }
|
|
46
|
+
},
|
|
47
|
+
phone: {
|
|
48
|
+
label: 'Phone',
|
|
49
|
+
description: 'Phone Number. Value will be hashed before sending to Amazon.',
|
|
50
|
+
type: 'string',
|
|
51
|
+
required: false,
|
|
52
|
+
default: { '@path': '$.properties.phone' }
|
|
53
|
+
},
|
|
54
|
+
postal: {
|
|
55
|
+
label: 'Postal',
|
|
56
|
+
description: 'POstal Code. Value will be hashed before sending to Amazon.',
|
|
57
|
+
type: 'string',
|
|
58
|
+
required: false,
|
|
59
|
+
default: { '@path': '$.properties.postal' }
|
|
60
|
+
},
|
|
61
|
+
state: {
|
|
62
|
+
label: 'Postal',
|
|
63
|
+
description: 'State Code. Value will be hashed before sending to Amazon.',
|
|
64
|
+
type: 'string',
|
|
65
|
+
required: false,
|
|
66
|
+
default: { '@path': '$.properties.state' }
|
|
67
|
+
},
|
|
68
|
+
city: {
|
|
69
|
+
label: 'City',
|
|
70
|
+
description: 'City name. Value will be hashed before sending to Amazon.',
|
|
71
|
+
type: 'string',
|
|
72
|
+
required: false,
|
|
73
|
+
default: { '@path': '$.properties.city' }
|
|
74
|
+
},
|
|
75
|
+
address: {
|
|
76
|
+
label: 'Address',
|
|
77
|
+
description: 'Address Code. Value will be hashed before sending to Amazon.',
|
|
78
|
+
type: 'string',
|
|
79
|
+
required: false,
|
|
80
|
+
default: { '@path': '$.properties.address' }
|
|
81
|
+
},
|
|
82
|
+
audienceId: {
|
|
83
|
+
label: 'Audience ID',
|
|
84
|
+
type: 'string',
|
|
85
|
+
required: true,
|
|
86
|
+
unsafe_hidden: true,
|
|
87
|
+
description: 'A number value representing the Amazon audience identifier. This is the identifier that is returned during audience creation.',
|
|
88
|
+
default: {
|
|
89
|
+
'@path': '$.context.personas.external_audience_id'
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
enable_batching: {
|
|
93
|
+
label: 'Enable Batching',
|
|
94
|
+
description: 'When enabled,segment will send data in batching',
|
|
95
|
+
type: 'boolean',
|
|
96
|
+
required: true,
|
|
97
|
+
default: true
|
|
98
|
+
},
|
|
99
|
+
batch_size: {
|
|
100
|
+
label: 'Batch Size',
|
|
101
|
+
description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
|
|
102
|
+
type: 'number',
|
|
103
|
+
unsafe_hidden: true,
|
|
104
|
+
required: false,
|
|
105
|
+
default: 10000
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
perform: (request, { settings, payload, statsContext, audienceSettings }) => {
|
|
109
|
+
return processPayload(request, settings, [payload], statsContext, audienceSettings);
|
|
110
|
+
},
|
|
111
|
+
performBatch: (request, { settings, payload: payloads, statsContext, audienceSettings }) => {
|
|
112
|
+
return processPayload(request, settings, payloads, statsContext, audienceSettings);
|
|
12
113
|
}
|
|
13
114
|
};
|
|
115
|
+
async function processPayload(request, settings, payload, statsContext, audienceSettings) {
|
|
116
|
+
const { statsClient, tags: statsTags } = statsContext || {};
|
|
117
|
+
const statsName = 'syncAmazonAdsAudience';
|
|
118
|
+
statsClient?.incr(`${statsName}.intialise`, 1, statsTags);
|
|
119
|
+
const payloadRecord = createPayloadToUploadRecords(payload, audienceSettings);
|
|
120
|
+
const payloadString = JSON.stringify(payloadRecord).replace(/"audienceId":"(\d+)"/, '"audienceId":$1');
|
|
121
|
+
const response = await request(`${settings.region}/amc/audiences/records`, {
|
|
122
|
+
method: 'POST',
|
|
123
|
+
body: payloadString,
|
|
124
|
+
headers: {
|
|
125
|
+
'Content-Type': 'application/vnd.amcaudiences.v1+json'
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
const result = response.data;
|
|
129
|
+
return {
|
|
130
|
+
result
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function createPayloadToUploadRecords(payloads, audienceSettings) {
|
|
134
|
+
const records = [];
|
|
135
|
+
const { audienceId } = payloads[0];
|
|
136
|
+
payloads.forEach((payload) => {
|
|
137
|
+
const hashedPII = {};
|
|
138
|
+
if (payload.firstName) {
|
|
139
|
+
hashedPII.firstname = normalizeAndHash(payload.firstName);
|
|
140
|
+
}
|
|
141
|
+
if (payload.lastName) {
|
|
142
|
+
hashedPII.lastname = normalizeAndHash(payload.lastName);
|
|
143
|
+
}
|
|
144
|
+
if (payload.address) {
|
|
145
|
+
hashedPII.address = normalizeAndHash(payload.address);
|
|
146
|
+
}
|
|
147
|
+
if (payload.postal) {
|
|
148
|
+
hashedPII.postal = normalizeAndHash(payload.postal);
|
|
149
|
+
}
|
|
150
|
+
if (payload.phone) {
|
|
151
|
+
hashedPII.phone = normalizeAndHash(payload.phone);
|
|
152
|
+
}
|
|
153
|
+
if (payload.city) {
|
|
154
|
+
hashedPII.city = normalizeAndHash(payload.city);
|
|
155
|
+
}
|
|
156
|
+
if (payload.state) {
|
|
157
|
+
hashedPII.state = normalizeAndHash(payload.state);
|
|
158
|
+
}
|
|
159
|
+
if (payload.email) {
|
|
160
|
+
hashedPII.email = normalizeAndHash(payload.email);
|
|
161
|
+
}
|
|
162
|
+
const payloadRecord = {
|
|
163
|
+
externalUserId: payload.externalUserId,
|
|
164
|
+
countryCode: audienceSettings.countryCode,
|
|
165
|
+
action: payload.event_name == 'Audience Entered' ? utils_1.CONSTANTS.CREATE : utils_1.CONSTANTS.DELETE,
|
|
166
|
+
hashedPII: [hashedPII]
|
|
167
|
+
};
|
|
168
|
+
records.push(payloadRecord);
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
records: records,
|
|
172
|
+
audienceId: audienceId
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function normalizeAndHash(data) {
|
|
176
|
+
const normalizedData = data.toLowerCase().trim();
|
|
177
|
+
const hash = crypto_1.createHash('sha256');
|
|
178
|
+
hash.update(normalizedData);
|
|
179
|
+
return hash.digest('hex');
|
|
180
|
+
}
|
|
14
181
|
exports.default = action;
|
|
15
182
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-ads/syncAudiences/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-ads/syncAudiences/index.ts"],"names":[],"mappings":";;AAGA,oCAAyD;AACzD,mCAAmC;AAGnC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,qDAAqD;IAClE,mBAAmB,EAAE,yDAAyD;IAC9E,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,wCAAwC;YACrD,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,cAAc,EAAE;YACd,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,gEAAgE;YAC7E,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE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AK,CAAC,CAAA;AAC3B,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -20,3 +20,28 @@ export declare class AmazonRefreshTokenError extends HTTPError {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
+
export interface HashedPIIObject {
|
|
24
|
+
firstname?: string;
|
|
25
|
+
lastname?: string;
|
|
26
|
+
phone?: string;
|
|
27
|
+
city?: string;
|
|
28
|
+
state?: string;
|
|
29
|
+
postal?: string;
|
|
30
|
+
email?: string;
|
|
31
|
+
address?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface AudienceRecord {
|
|
34
|
+
hashedPII?: HashedPIIObject[];
|
|
35
|
+
externalUserId: string;
|
|
36
|
+
countryCode: string;
|
|
37
|
+
action: string;
|
|
38
|
+
}
|
|
39
|
+
export interface TargetResourceRecords {
|
|
40
|
+
connectionId: string;
|
|
41
|
+
targetTypes: string[];
|
|
42
|
+
}
|
|
43
|
+
export interface AudienceRecordPayload {
|
|
44
|
+
records: AudienceRecord[];
|
|
45
|
+
targetResource: TargetResourceRecords;
|
|
46
|
+
audienceId: number;
|
|
47
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { HTTPError } from '@segment/actions-core';
|
|
2
|
+
export declare class AmazonAdsError extends HTTPError {
|
|
3
|
+
response: Response & {
|
|
4
|
+
data: {
|
|
5
|
+
status: string;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface AudiencePayload {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
countryCode: string;
|
|
14
|
+
targetResource: {
|
|
15
|
+
advertiserId: string;
|
|
16
|
+
};
|
|
17
|
+
metadata: {
|
|
18
|
+
externalAudienceId: string;
|
|
19
|
+
ttl?: number;
|
|
20
|
+
audienceFees?: {
|
|
21
|
+
cpmCents: number;
|
|
22
|
+
currency: string;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface RecordsResponseType {
|
|
27
|
+
jobRequestId: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const AUTHORIZATION_URL: any;
|
|
30
|
+
export declare const CONSTANTS: {
|
|
31
|
+
CREATE: string;
|
|
32
|
+
DELETE: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const CURRENCY: string[];
|
|
35
|
+
export declare const REGEX_AUDIENCEID: RegExp;
|
|
36
|
+
export declare const REGEX_ADVERTISERID: RegExp;
|
|
37
|
+
export declare function extractNumberAndSubstituteWithStringValue(responseString: string, regex: any, substituteWith: string): any;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractNumberAndSubstituteWithStringValue = exports.REGEX_ADVERTISERID = exports.REGEX_AUDIENCEID = exports.CURRENCY = exports.CONSTANTS = exports.AUTHORIZATION_URL = exports.AmazonAdsError = void 0;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
class AmazonAdsError extends actions_core_1.HTTPError {
|
|
6
|
+
}
|
|
7
|
+
exports.AmazonAdsError = AmazonAdsError;
|
|
8
|
+
exports.AUTHORIZATION_URL = {
|
|
9
|
+
'https://advertising-api.amazon.com': 'https://api.amazon.com',
|
|
10
|
+
'https://advertising-api-eu.amazon.com': 'https://api.amazon.co.uk',
|
|
11
|
+
'https://advertising-api-fe.amazon.com': 'https://api.amazon.co.jp'
|
|
12
|
+
};
|
|
13
|
+
exports.CONSTANTS = {
|
|
14
|
+
CREATE: 'CREATE',
|
|
15
|
+
DELETE: 'DELETE'
|
|
16
|
+
};
|
|
17
|
+
exports.CURRENCY = ['USD', 'CAD', 'JPY', 'GBP', 'EUR', 'SAR', 'AUD', 'AED', 'CNY', 'MXN', 'INR', 'SEK', 'TRY'];
|
|
18
|
+
exports.REGEX_AUDIENCEID = /"audienceId":(\d+)/;
|
|
19
|
+
exports.REGEX_ADVERTISERID = /"advertiserId":"(\d+)"/;
|
|
20
|
+
function extractNumberAndSubstituteWithStringValue(responseString, regex, substituteWith) {
|
|
21
|
+
const resString = responseString.replace(regex, substituteWith);
|
|
22
|
+
return JSON.parse(resString);
|
|
23
|
+
}
|
|
24
|
+
exports.extractNumberAndSubstituteWithStringValue = extractNumberAndSubstituteWithStringValue;
|
|
25
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/utils.ts"],"names":[],"mappings":";;;AAAA,wDAAiD;AAEjD,MAAa,cAAe,SAAQ,wBAAS;CAO5C;AAPD,wCAOC;AAsBY,QAAA,iBAAiB,GAAQ;IACpC,oCAAoC,EAAE,wBAAwB;IAC9D,uCAAuC,EAAE,0BAA0B;IACnE,uCAAuC,EAAE,0BAA0B;CACpE,CAAA;AACY,QAAA,SAAS,GAAG;IACvB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACjB,CAAA;AACY,QAAA,QAAQ,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;AAEtG,QAAA,gBAAgB,GAAG,oBAAoB,CAAA;AACvC,QAAA,kBAAkB,GAAG,wBAAwB,CAAA;AAE1D,SAAgB,yCAAyC,CAAC,cAAsB,EAAE,KAAU,EAAE,cAAsB;IAClH,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC,CAAA;IAC/D,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;AAC9B,CAAC;AAHD,8FAGC"}
|
|
@@ -9,7 +9,7 @@ export declare const dateStringToFuzzyDate: (dateString: string | number) => fal
|
|
|
9
9
|
y: string;
|
|
10
10
|
};
|
|
11
11
|
export declare const augmentFieldsWithConstituentFields: (fields: Record<string, InputField>) => Record<string, InputField>;
|
|
12
|
-
export declare const splitConstituentPayload: (payload: CreateOrUpdateIndividualConstituentPayload) => (Partial<
|
|
12
|
+
export declare const splitConstituentPayload: (payload: CreateOrUpdateIndividualConstituentPayload) => (Partial<Phone> | Partial<Constituent> | Partial<Address> | Partial<OnlinePresence>)[];
|
|
13
13
|
export declare const buildConstituentPayloadFromPayload: (payload: StringIndexedObject) => Partial<CreateOrUpdateIndividualConstituentPayload>;
|
|
14
14
|
export declare const buildGiftDataFromPayload: (constituentId: string, payload: CreateGiftPayload) => Partial<Gift>;
|
|
15
15
|
export declare const buildConstituentActionDataFromPayload: (constituentId: string, payload: CreateConstituentAction) => Partial<ConstituentAction>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ContextFromDecorator } from './operationTracking';
|
|
2
2
|
export declare const track: ((decoratorArgs?: ({
|
|
3
|
+
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
4
|
+
} & {
|
|
3
5
|
onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
|
|
4
|
-
} &
|
|
6
|
+
} & {
|
|
5
7
|
onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
6
8
|
onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
7
|
-
} & {
|
|
8
|
-
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
9
|
-
} & {
|
|
9
|
+
} & import("./operationTracking").OperationLoggerDecoratorArgs & {
|
|
10
10
|
wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
|
|
11
11
|
}) | undefined) => import("./operationTracking").GenericMethodDecorator<(this: any, ...args: any[]) => any>) & {
|
|
12
12
|
getCurrentOperation(classInstance: any): (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
|
|
@@ -15,8 +15,13 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
15
15
|
}) | undefined;
|
|
16
16
|
} & {
|
|
17
17
|
_contextType: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
tags: string[];
|
|
19
|
+
sharedContext: {
|
|
20
|
+
tags: string[];
|
|
21
|
+
};
|
|
22
|
+
decoratorArgs?: {
|
|
23
|
+
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
24
|
+
} | undefined;
|
|
20
25
|
} & {
|
|
21
26
|
decoratorArgs?: {
|
|
22
27
|
onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
|
|
@@ -25,10 +30,8 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
25
30
|
parent?: (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & any) | undefined;
|
|
26
31
|
sharedContext: {};
|
|
27
32
|
} & {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
|
|
31
|
-
sharedContext: import("./operationTracking").OperationLoggerSharedContext;
|
|
33
|
+
start?: number | undefined;
|
|
34
|
+
duration?: number | undefined;
|
|
32
35
|
} & {
|
|
33
36
|
onFinally: (() => void)[];
|
|
34
37
|
decoratorArgs?: {
|
|
@@ -36,13 +39,10 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
36
39
|
onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
37
40
|
} | undefined;
|
|
38
41
|
} & {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
decoratorArgs?: {
|
|
44
|
-
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
45
|
-
} | undefined;
|
|
42
|
+
logs: string[];
|
|
43
|
+
logMetadata?: Record<string, unknown> | undefined;
|
|
44
|
+
decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
|
|
45
|
+
sharedContext: import("./operationTracking").OperationLoggerSharedContext;
|
|
46
46
|
} & {
|
|
47
47
|
decoratorArgs?: {
|
|
48
48
|
wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestClient, DynamicFieldResponse } from '@segment/actions-core';
|
|
2
|
-
import { ImportJobPayload, SubscribeProfile, SubscribeEventData, UnsubscribeProfile, UnsubscribeEventData } from './types';
|
|
2
|
+
import { ImportJobPayload, SubscribeProfile, SubscribeEventData, UnsubscribeProfile, UnsubscribeEventData, GroupedProfiles } from './types';
|
|
3
3
|
import { Payload } from './upsertProfile/generated-types';
|
|
4
4
|
export declare function getListIdDynamicData(request: RequestClient): Promise<DynamicFieldResponse>;
|
|
5
5
|
export declare function addProfileToList(request: RequestClient, id: string, list_id: string | undefined): Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
@@ -22,3 +22,5 @@ export declare function formatSubscribeProfile(email: string | undefined, phone_
|
|
|
22
22
|
export declare function formatSubscribeRequestBody(profiles: SubscribeProfile | SubscribeProfile[], list_id: string | undefined, custom_source: string | undefined): SubscribeEventData;
|
|
23
23
|
export declare function formatUnsubscribeRequestBody(profiles: UnsubscribeProfile | UnsubscribeProfile[], list_id: string | undefined): UnsubscribeEventData;
|
|
24
24
|
export declare function formatUnsubscribeProfile(email: string | undefined, phone_number: string | undefined): UnsubscribeProfile;
|
|
25
|
+
export declare function groupByListId(profiles: Payload[]): GroupedProfiles;
|
|
26
|
+
export declare function processProfilesByGroup(request: RequestClient, groupedProfiles: GroupedProfiles): Promise<import("@segment/actions-core").ModifiedResponse<unknown>[]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatUnsubscribeProfile = exports.formatUnsubscribeRequestBody = exports.formatSubscribeRequestBody = exports.formatSubscribeProfile = exports.getProfiles = exports.sendImportJobRequest = exports.createImportJobPayload = exports.buildHeaders = exports.createProfile = exports.removeProfileFromList = exports.addProfileToList = exports.getListIdDynamicData = void 0;
|
|
3
|
+
exports.processProfilesByGroup = exports.groupByListId = exports.formatUnsubscribeProfile = exports.formatUnsubscribeRequestBody = exports.formatSubscribeRequestBody = exports.formatSubscribeProfile = exports.getProfiles = exports.sendImportJobRequest = exports.createImportJobPayload = exports.buildHeaders = exports.createProfile = exports.removeProfileFromList = exports.addProfileToList = exports.getListIdDynamicData = void 0;
|
|
4
4
|
const config_1 = require("./config");
|
|
5
5
|
async function getListIdDynamicData(request) {
|
|
6
6
|
try {
|
|
@@ -94,7 +94,7 @@ const createImportJobPayload = (profiles, listId) => ({
|
|
|
94
94
|
type: 'profile-bulk-import-job',
|
|
95
95
|
attributes: {
|
|
96
96
|
profiles: {
|
|
97
|
-
data: profiles.map(({ list_id, enable_batching, batch_size, ...attributes }) => ({
|
|
97
|
+
data: profiles.map(({ list_id, enable_batching, batch_size, override_list_id, ...attributes }) => ({
|
|
98
98
|
type: 'profile',
|
|
99
99
|
attributes
|
|
100
100
|
}))
|
|
@@ -244,4 +244,25 @@ function formatUnsubscribeProfile(email, phone_number) {
|
|
|
244
244
|
return profileToSubscribe;
|
|
245
245
|
}
|
|
246
246
|
exports.formatUnsubscribeProfile = formatUnsubscribeProfile;
|
|
247
|
+
function groupByListId(profiles) {
|
|
248
|
+
const grouped = {};
|
|
249
|
+
for (const profile of profiles) {
|
|
250
|
+
const listId = profile.override_list_id || profile.list_id;
|
|
251
|
+
if (!grouped[listId]) {
|
|
252
|
+
grouped[listId] = [];
|
|
253
|
+
}
|
|
254
|
+
grouped[listId].push(profile);
|
|
255
|
+
}
|
|
256
|
+
return grouped;
|
|
257
|
+
}
|
|
258
|
+
exports.groupByListId = groupByListId;
|
|
259
|
+
async function processProfilesByGroup(request, groupedProfiles) {
|
|
260
|
+
const importResponses = await Promise.all(Object.keys(groupedProfiles).map(async (listId) => {
|
|
261
|
+
const profiles = groupedProfiles[listId];
|
|
262
|
+
const importJobPayload = exports.createImportJobPayload(profiles, listId);
|
|
263
|
+
return await exports.sendImportJobRequest(request, importJobPayload);
|
|
264
|
+
}));
|
|
265
|
+
return importResponses;
|
|
266
|
+
}
|
|
267
|
+
exports.processProfilesByGroup = processProfilesByGroup;
|
|
247
268
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/functions.ts"],"names":[],"mappings":";;;AACA,qCAAiD;
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/functions.ts"],"names":[],"mappings":";;;AACA,qCAAiD;AAiB1C,KAAK,UAAU,oBAAoB,CAAC,OAAsB;IAC/D,IAAI;QACF,MAAM,MAAM,GAAmB,MAAM,OAAO,CAAC,GAAG,gBAAO,SAAS,EAAE;YAChE,MAAM,EAAE,KAAK;SACd,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAkD,EAAE,EAAE;YACzG,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,C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CAAA;IACD,OAAO,eAAe,CAAA;AACxB,CAAC;AATD,wDASC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HTTPError } from '@segment/actions-core';
|
|
2
|
+
import { Payload } from './upsertProfile/generated-types';
|
|
2
3
|
export declare class KlaviyoAPIError extends HTTPError {
|
|
3
4
|
response: Response & {
|
|
4
5
|
data: {
|
|
@@ -193,3 +194,6 @@ export interface UnsubscribeEventData {
|
|
|
193
194
|
};
|
|
194
195
|
};
|
|
195
196
|
}
|
|
197
|
+
export interface GroupedProfiles {
|
|
198
|
+
[listId: string]: Payload[];
|
|
199
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/types.ts"],"names":[],"mappings":";;;AAAA,wDAAiD;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/types.ts"],"names":[],"mappings":";;;AAAA,wDAAiD;AAEjD,MAAa,eAAgB,SAAQ,wBAAS;CAmB7C;AAnBD,0CAmBC"}
|
|
@@ -128,9 +128,17 @@ const action = {
|
|
|
128
128
|
label: 'List',
|
|
129
129
|
description: `The Klaviyo list to add the profile to.`,
|
|
130
130
|
type: 'string',
|
|
131
|
-
dynamic: true
|
|
131
|
+
dynamic: true,
|
|
132
|
+
default: ''
|
|
132
133
|
},
|
|
133
|
-
batch_size: { ...properties_1.batch_size }
|
|
134
|
+
batch_size: { ...properties_1.batch_size },
|
|
135
|
+
override_list_id: {
|
|
136
|
+
unsafe_hidden: true,
|
|
137
|
+
label: 'List ID Override',
|
|
138
|
+
description: 'Klaviyo list ID to override the default list ID when provided in an event payload. Added to support backward compatibility with klaviyo(classic) and facilitate a seamless migration.',
|
|
139
|
+
type: 'string',
|
|
140
|
+
default: { '@path': '$.integrations.Klaviyo.listId' }
|
|
141
|
+
}
|
|
134
142
|
},
|
|
135
143
|
dynamicFields: {
|
|
136
144
|
list_id: async (request) => {
|
|
@@ -138,7 +146,8 @@ const action = {
|
|
|
138
146
|
}
|
|
139
147
|
},
|
|
140
148
|
perform: async (request, { payload }) => {
|
|
141
|
-
const { email, external_id, phone_number,
|
|
149
|
+
const { email, external_id, phone_number, enable_batching, batch_size, list_id: otherListId, override_list_id, ...otherAttributes } = payload;
|
|
150
|
+
const list_id = override_list_id || otherListId;
|
|
142
151
|
if (!email && !phone_number && !external_id) {
|
|
143
152
|
throw new actions_core_1.PayloadValidationError('One of External ID, Phone Number and Email is required.');
|
|
144
153
|
}
|
|
@@ -187,14 +196,13 @@ const action = {
|
|
|
187
196
|
},
|
|
188
197
|
performBatch: async (request, { payload }) => {
|
|
189
198
|
payload = payload.filter((profile) => profile.email || profile.external_id || profile.phone_number);
|
|
190
|
-
const profilesWithList = payload.filter((profile) => profile.list_id);
|
|
199
|
+
const profilesWithList = payload.filter((profile) => profile.list_id || profile.override_list_id);
|
|
191
200
|
const profilesWithoutList = payload.filter((profile) => !profile.list_id);
|
|
192
201
|
let importResponseWithList;
|
|
193
202
|
let importResponseWithoutList;
|
|
194
203
|
if (profilesWithList.length > 0) {
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
importResponseWithList = await functions_1.sendImportJobRequest(request, importJobPayload);
|
|
204
|
+
const groupedByListId = functions_1.groupByListId(profilesWithList);
|
|
205
|
+
importResponseWithList = await functions_1.processProfilesByGroup(request, groupedByListId);
|
|
198
206
|
}
|
|
199
207
|
if (profilesWithoutList.length > 0) {
|
|
200
208
|
const importJobPayload = functions_1.createImportJobPayload(profilesWithoutList);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/upsertProfile/index.ts"],"names":[],"mappings":";;AAIA,sCAAmC;AACnC,wDAA8D;AAE9D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/upsertProfile/index.ts"],"names":[],"mappings":";;AAIA,sCAAmC;AACnC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SACZ;IACH,CAAC;IAED,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAC3C,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,CAAA;QAEnG,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAA;QACjG,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAEzE,IAAI,sBAAsB,CAAA;QAC1B,IAAI,yBAAyB,CAAA;QAE7B,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;YAE/B,MAAM,eAAe,GAAG,yBAAa,CAAC,gBAAgB,CAAC,CAAA;YACvD,sBAAsB,GAAG,MAAM,kCAAsB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAA;SAChF;QAED,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE;YAClC,MAAM,gBAAgB,GAAG,kCAAsB,CAAC,mBAAmB,CAAC,CAAA;YACpE,yBAAyB,GAAG,MAAM,gCAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;SAClF;QAED,OAAO;YACL,QAAQ,EAAE,sBAAsB;YAChC,WAAW,EAAE,yBAAyB;SACvC,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/action-destinations",
|
|
3
3
|
"description": "Destination Actions engine and definitions.",
|
|
4
|
-
"version": "3.268.
|
|
4
|
+
"version": "3.268.1-staging.13+e465cf066",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@bufbuild/protobuf": "^1.4.2",
|
|
44
44
|
"@bufbuild/protoc-gen-es": "^1.4.2",
|
|
45
45
|
"@segment/a1-notation": "^2.1.4",
|
|
46
|
-
"@segment/actions-core": "
|
|
46
|
+
"@segment/actions-core": "3.110.1-staging.12",
|
|
47
47
|
"@segment/actions-shared": "^1.92.0",
|
|
48
48
|
"@types/node": "^18.11.15",
|
|
49
49
|
"ajv-formats": "^2.1.1",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"__tests__/__helpers__/"
|
|
87
87
|
]
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "e465cf066d3795e9d65ed36011e69130bc7f40a4"
|
|
90
90
|
}
|