@segment/action-destinations 3.231.0 → 3.233.0-streams.1
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/absmartly/event.d.ts +9 -3
- package/dist/destinations/absmartly/event.js +0 -9
- package/dist/destinations/absmartly/event.js.map +1 -1
- package/dist/destinations/absmartly/exposure.d.ts +1 -1
- package/dist/destinations/absmartly/exposure.js +26 -10
- package/dist/destinations/absmartly/exposure.js.map +1 -1
- package/dist/destinations/absmartly/goal.d.ts +1 -2
- package/dist/destinations/absmartly/goal.js +4 -18
- package/dist/destinations/absmartly/goal.js.map +1 -1
- package/dist/destinations/absmartly/segment.d.ts +11 -0
- package/dist/destinations/absmartly/segment.js +3 -0
- package/dist/destinations/absmartly/segment.js.map +1 -0
- package/dist/destinations/absmartly/timestamp.d.ts +1 -1
- package/dist/destinations/absmartly/timestamp.js +2 -0
- package/dist/destinations/absmartly/timestamp.js.map +1 -1
- package/dist/destinations/absmartly/trackExposure/generated-types.d.ts +0 -1
- package/dist/destinations/absmartly/trackExposure/index.js +7 -2
- package/dist/destinations/absmartly/trackExposure/index.js.map +1 -1
- package/dist/destinations/absmartly/trackGoal/generated-types.d.ts +0 -2
- package/dist/destinations/absmartly/trackGoal/index.js +7 -2
- package/dist/destinations/absmartly/trackGoal/index.js.map +1 -1
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +1 -0
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +184 -0
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js.map +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +6 -3
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +1 -1
- package/dist/destinations/engage/utils/track.d.ts +9 -9
- package/dist/destinations/gleap/generated-types.d.ts +3 -0
- package/dist/destinations/gleap/generated-types.js +3 -0
- package/dist/destinations/gleap/generated-types.js.map +1 -0
- package/dist/destinations/gleap/identifyContact/generated-types.d.ts +18 -0
- package/dist/destinations/gleap/identifyContact/generated-types.js +3 -0
- package/dist/destinations/gleap/identifyContact/generated-types.js.map +1 -0
- package/dist/destinations/gleap/identifyContact/index.d.ts +5 -0
- package/dist/destinations/gleap/identifyContact/index.js +155 -0
- package/dist/destinations/gleap/identifyContact/index.js.map +1 -0
- package/dist/destinations/gleap/index.d.ts +4 -0
- package/dist/destinations/gleap/index.js +52 -0
- package/dist/destinations/gleap/index.js.map +1 -0
- package/dist/destinations/gleap/trackEvent/generated-types.d.ts +10 -0
- package/dist/destinations/gleap/trackEvent/generated-types.js +3 -0
- package/dist/destinations/gleap/trackEvent/generated-types.js.map +1 -0
- package/dist/destinations/gleap/trackEvent/index.d.ts +5 -0
- package/dist/destinations/gleap/trackEvent/index.js +111 -0
- package/dist/destinations/gleap/trackEvent/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 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/insider/cartViewedEvent/generated-types.d.ts +1 -0
- package/dist/destinations/insider/cartViewedEvent/index.js +1 -0
- package/dist/destinations/insider/cartViewedEvent/index.js.map +1 -1
- package/dist/destinations/insider/checkoutEvent/generated-types.d.ts +1 -0
- package/dist/destinations/insider/checkoutEvent/index.js +1 -0
- package/dist/destinations/insider/checkoutEvent/index.js.map +1 -1
- package/dist/destinations/insider/insider-helpers.d.ts +3 -0
- package/dist/destinations/insider/insider-helpers.js +7 -2
- package/dist/destinations/insider/insider-helpers.js.map +1 -1
- package/dist/destinations/insider/insider-properties.d.ts +1 -0
- package/dist/destinations/insider/insider-properties.js +7 -1
- package/dist/destinations/insider/insider-properties.js.map +1 -1
- package/dist/destinations/insider/orderCompletedEvent/generated-types.d.ts +1 -0
- package/dist/destinations/insider/orderCompletedEvent/index.js +1 -0
- package/dist/destinations/insider/orderCompletedEvent/index.js.map +1 -1
- package/dist/destinations/insider/productAddedEvent/generated-types.d.ts +1 -0
- package/dist/destinations/insider/productAddedEvent/index.js +1 -0
- package/dist/destinations/insider/productAddedEvent/index.js.map +1 -1
- package/dist/destinations/insider/productListViewedEvent/generated-types.d.ts +1 -0
- package/dist/destinations/insider/productListViewedEvent/index.js +1 -0
- package/dist/destinations/insider/productListViewedEvent/index.js.map +1 -1
- package/dist/destinations/insider/productRemovedEvent/generated-types.d.ts +1 -0
- package/dist/destinations/insider/productRemovedEvent/index.js +1 -0
- package/dist/destinations/insider/productRemovedEvent/index.js.map +1 -1
- package/dist/destinations/insider/productViewedEvent/generated-types.d.ts +1 -0
- package/dist/destinations/insider/productViewedEvent/index.js +1 -0
- package/dist/destinations/insider/productViewedEvent/index.js.map +1 -1
- package/dist/destinations/insider/trackEvent/generated-types.d.ts +1 -0
- package/dist/destinations/insider/trackEvent/index.js +1 -0
- package/dist/destinations/insider/trackEvent/index.js.map +1 -1
- package/dist/destinations/insider/updateUserProfile/generated-types.d.ts +1 -0
- package/dist/destinations/insider/updateUserProfile/index.js +2 -0
- package/dist/destinations/insider/updateUserProfile/index.js.map +1 -1
- package/dist/destinations/insider/userRegisteredEvent/generated-types.d.ts +1 -0
- package/dist/destinations/insider/userRegisteredEvent/index.js +1 -0
- package/dist/destinations/insider/userRegisteredEvent/index.js.map +1 -1
- package/dist/destinations/insider-audiences/insider-helpers.js +5 -0
- package/dist/destinations/insider-audiences/insider-helpers.js.map +1 -1
- package/dist/destinations/insider-audiences/insiderAudiences/generated-types.d.ts +1 -0
- package/dist/destinations/insider-audiences/insiderAudiences/index.js +6 -0
- package/dist/destinations/insider-audiences/insiderAudiences/index.js.map +1 -1
- package/dist/destinations/klaviyo/addProfileToList/generated-types.d.ts +3 -1
- package/dist/destinations/klaviyo/addProfileToList/index.js +14 -6
- package/dist/destinations/klaviyo/addProfileToList/index.js.map +1 -1
- package/dist/destinations/klaviyo/functions.d.ts +11 -3
- package/dist/destinations/klaviyo/functions.js +62 -19
- package/dist/destinations/klaviyo/functions.js.map +1 -1
- package/dist/destinations/klaviyo/index.js +1 -1
- package/dist/destinations/klaviyo/index.js.map +1 -1
- package/dist/destinations/klaviyo/properties.d.ts +3 -1
- package/dist/destinations/klaviyo/properties.js +14 -3
- package/dist/destinations/klaviyo/properties.js.map +1 -1
- package/dist/destinations/klaviyo/removeProfileFromList/generated-types.d.ts +3 -1
- package/dist/destinations/klaviyo/removeProfileFromList/index.js +18 -9
- package/dist/destinations/klaviyo/removeProfileFromList/index.js.map +1 -1
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +4 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +3 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +5 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.js +43 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.js.map +1 -0
- package/dist/destinations/klaviyo/types.d.ts +54 -4
- package/dist/destinations/klaviyo/upsertProfile/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/upsertProfile/index.js +27 -2
- package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/updateAudience/index.js +15 -9
- package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/api/api.test.d.ts +1 -0
- package/dist/destinations/linkedin-conversions/api/api.test.js +220 -0
- package/dist/destinations/linkedin-conversions/api/api.test.js.map +1 -0
- package/dist/destinations/linkedin-conversions/api/index.d.ts +10 -2
- package/dist/destinations/linkedin-conversions/api/index.js +198 -1
- package/dist/destinations/linkedin-conversions/api/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/constants.d.ts +1 -0
- package/dist/destinations/linkedin-conversions/constants.js +7 -1
- package/dist/destinations/linkedin-conversions/constants.js.map +1 -1
- package/dist/destinations/linkedin-conversions/index.js +2 -1
- package/dist/destinations/linkedin-conversions/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/streamConversion/generated-types.d.ts +18 -0
- package/dist/destinations/linkedin-conversions/streamConversion/index.js +181 -51
- package/dist/destinations/linkedin-conversions/streamConversion/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/types.d.ts +64 -0
- package/dist/destinations/liveramp-audiences/audienceEnteredS3/index.js +24 -4
- package/dist/destinations/liveramp-audiences/audienceEnteredS3/index.js.map +1 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredS3/s3.d.ts +9 -0
- package/dist/destinations/liveramp-audiences/audienceEnteredS3/s3.js +22 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredS3/s3.js.map +1 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredSftp/index.js +20 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredSftp/index.js.map +1 -1
- package/dist/destinations/liveramp-audiences/operations.d.ts +20 -1
- package/dist/destinations/liveramp-audiences/operations.js +67 -1
- package/dist/destinations/liveramp-audiences/operations.js.map +1 -1
- package/dist/destinations/mixpanel/utils.d.ts +13 -0
- package/dist/destinations/mixpanel/utils.js +117 -0
- package/dist/destinations/mixpanel/utils.js.map +1 -0
- package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +22 -0
- package/dist/destinations/movable-ink/categoryView/generated-types.js +3 -0
- package/dist/destinations/movable-ink/categoryView/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/categoryView/index.d.ts +5 -0
- package/dist/destinations/movable-ink/categoryView/index.js +43 -0
- package/dist/destinations/movable-ink/categoryView/index.js.map +1 -0
- package/dist/destinations/movable-ink/conversion/generated-types.d.ts +20 -0
- package/dist/destinations/movable-ink/conversion/generated-types.js +3 -0
- package/dist/destinations/movable-ink/conversion/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/conversion/index.d.ts +5 -0
- package/dist/destinations/movable-ink/conversion/index.js +45 -0
- package/dist/destinations/movable-ink/conversion/index.js.map +1 -0
- package/dist/destinations/movable-ink/fields.d.ts +21 -0
- package/dist/destinations/movable-ink/fields.js +236 -0
- package/dist/destinations/movable-ink/fields.js.map +1 -0
- package/dist/destinations/movable-ink/identify/generated-types.d.ts +7 -0
- package/dist/destinations/movable-ink/identify/generated-types.js +3 -0
- package/dist/destinations/movable-ink/identify/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/identify/index.d.ts +5 -0
- package/dist/destinations/movable-ink/identify/index.js +32 -0
- package/dist/destinations/movable-ink/identify/index.js.map +1 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +22 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.js +3 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/productAdded/index.d.ts +5 -0
- package/dist/destinations/movable-ink/productAdded/index.js +43 -0
- package/dist/destinations/movable-ink/productAdded/index.js.map +1 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +21 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.js +3 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/productViewed/index.d.ts +5 -0
- package/dist/destinations/movable-ink/productViewed/index.js +43 -0
- package/dist/destinations/movable-ink/productViewed/index.js.map +1 -0
- package/dist/destinations/movable-ink/search/generated-types.d.ts +12 -0
- package/dist/destinations/movable-ink/search/generated-types.js +3 -0
- package/dist/destinations/movable-ink/search/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/search/index.d.ts +5 -0
- package/dist/destinations/movable-ink/search/index.js +43 -0
- package/dist/destinations/movable-ink/search/index.js.map +1 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +25 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +3 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +5 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.js +48 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.js.map +1 -0
- package/dist/destinations/trackey/group.types.d.ts +11 -0
- package/dist/destinations/trackey/group.types.js +3 -0
- package/dist/destinations/trackey/group.types.js.map +1 -0
- package/dist/destinations/trackey/identify.types.d.ts +11 -0
- package/dist/destinations/trackey/identify.types.js +3 -0
- package/dist/destinations/trackey/identify.types.js.map +1 -0
- package/dist/destinations/trackey/track.types.d.ts +12 -0
- package/dist/destinations/trackey/track.types.js +3 -0
- package/dist/destinations/trackey/track.types.js.map +1 -0
- package/dist/destinations/usermaven/request-params.js +8 -3
- package/dist/destinations/usermaven/request-params.js.map +1 -1
- package/dist/destinations/yahoo-audiences/index.js +6 -0
- package/dist/destinations/yahoo-audiences/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
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 {
|
|
@@ -42,36 +42,25 @@ async function addProfileToList(request, id, list_id) {
|
|
|
42
42
|
return list;
|
|
43
43
|
}
|
|
44
44
|
exports.addProfileToList = addProfileToList;
|
|
45
|
-
async function removeProfileFromList(request,
|
|
45
|
+
async function removeProfileFromList(request, ids, list_id) {
|
|
46
46
|
const listData = {
|
|
47
|
-
data:
|
|
48
|
-
{
|
|
49
|
-
type: 'profile',
|
|
50
|
-
id: id
|
|
51
|
-
}
|
|
52
|
-
]
|
|
47
|
+
data: ids.map((id) => ({ type: 'profile', id }))
|
|
53
48
|
};
|
|
54
|
-
const
|
|
49
|
+
const response = await request(`${config_1.API_URL}/lists/${list_id}/relationships/profiles/`, {
|
|
55
50
|
method: 'DELETE',
|
|
56
51
|
json: listData
|
|
57
52
|
});
|
|
58
|
-
return
|
|
53
|
+
return response;
|
|
59
54
|
}
|
|
60
55
|
exports.removeProfileFromList = removeProfileFromList;
|
|
61
|
-
async function
|
|
62
|
-
const profile = await request(`${config_1.API_URL}/profiles/?filter=equals(email,"${email}")`, {
|
|
63
|
-
method: 'GET'
|
|
64
|
-
});
|
|
65
|
-
return profile.json();
|
|
66
|
-
}
|
|
67
|
-
exports.getProfile = getProfile;
|
|
68
|
-
async function createProfile(request, email) {
|
|
56
|
+
async function createProfile(request, email, external_id) {
|
|
69
57
|
try {
|
|
70
58
|
const profileData = {
|
|
71
59
|
data: {
|
|
72
60
|
type: 'profile',
|
|
73
61
|
attributes: {
|
|
74
|
-
email
|
|
62
|
+
email,
|
|
63
|
+
external_id
|
|
75
64
|
}
|
|
76
65
|
}
|
|
77
66
|
};
|
|
@@ -100,4 +89,58 @@ function buildHeaders(authKey) {
|
|
|
100
89
|
};
|
|
101
90
|
}
|
|
102
91
|
exports.buildHeaders = buildHeaders;
|
|
92
|
+
const createImportJobPayload = (profiles, listId) => ({
|
|
93
|
+
data: {
|
|
94
|
+
type: 'profile-bulk-import-job',
|
|
95
|
+
attributes: {
|
|
96
|
+
profiles: {
|
|
97
|
+
data: profiles.map(({ list_id, enable_batching, ...attributes }) => ({
|
|
98
|
+
type: 'profile',
|
|
99
|
+
attributes
|
|
100
|
+
}))
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
...(listId
|
|
104
|
+
? {
|
|
105
|
+
relationships: {
|
|
106
|
+
lists: {
|
|
107
|
+
data: [{ type: 'list', id: listId }]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
: {})
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
exports.createImportJobPayload = createImportJobPayload;
|
|
115
|
+
const sendImportJobRequest = async (request, importJobPayload) => {
|
|
116
|
+
return await request(`${config_1.API_URL}/profile-bulk-import-jobs/`, {
|
|
117
|
+
method: 'POST',
|
|
118
|
+
headers: {
|
|
119
|
+
revision: '2023-10-15.pre'
|
|
120
|
+
},
|
|
121
|
+
json: importJobPayload
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
exports.sendImportJobRequest = sendImportJobRequest;
|
|
125
|
+
async function getProfiles(request, emails, external_ids) {
|
|
126
|
+
const profileIds = [];
|
|
127
|
+
if (external_ids?.length) {
|
|
128
|
+
const filterId = `external_id,["${external_ids.join('","')}"]`;
|
|
129
|
+
const response = await request(`${config_1.API_URL}/profiles/?filter=any(${filterId})`, {
|
|
130
|
+
method: 'GET'
|
|
131
|
+
});
|
|
132
|
+
const data = await response.json();
|
|
133
|
+
profileIds.push(...data.data.map((profile) => profile.id));
|
|
134
|
+
}
|
|
135
|
+
if (emails?.length) {
|
|
136
|
+
const filterEmail = `email,["${emails.join('","')}"]`;
|
|
137
|
+
const response = await request(`${config_1.API_URL}/profiles/?filter=any(${filterEmail})`, {
|
|
138
|
+
method: 'GET'
|
|
139
|
+
});
|
|
140
|
+
const data = await response.json();
|
|
141
|
+
profileIds.push(...data.data.map((profile) => profile.id));
|
|
142
|
+
}
|
|
143
|
+
return Array.from(new Set(profileIds));
|
|
144
|
+
}
|
|
145
|
+
exports.getProfiles = getProfiles;
|
|
103
146
|
//# 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;AAY1C,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,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,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAA;KACpE;IAED,IAAI,MAAM,EAAE,MAAM,EAAE;QAClB,MAAM,WAAW,GAAG,WAAW,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA;QACrD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,gBAAO,yBAAyB,WAAW,GAAG,EAAE;YAChF,MAAM,EAAE,KAAK;SACd,CAAC,CAAA;QACF,MAAM,IAAI,GAAuB,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QACtD,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAA;KACpE;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAA;AACxC,CAAC;AA1BD,kCA0BC"}
|
|
@@ -19,7 +19,7 @@ const destination = {
|
|
|
19
19
|
scheme: 'custom',
|
|
20
20
|
fields: {
|
|
21
21
|
api_key: {
|
|
22
|
-
type: '
|
|
22
|
+
type: 'password',
|
|
23
23
|
label: 'API Key',
|
|
24
24
|
description: `You can find this by going to Klaviyo's UI and clicking Account > Settings > API Keys > Create API Key`,
|
|
25
25
|
required: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA+G;AAG/G,qCAAkC;AAClC,oEAA2C;AAC3C,0EAAiD;AACjD,oFAA2D;AAC3D,8DAAqC;AACrC,sEAA6C;AAC7C,2CAA0C;AAE1C,MAAM,WAAW,GAA4C;IAC3D,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA+G;AAG/G,qCAAkC;AAClC,oEAA2C;AAC3C,0EAAiD;AACjD,oFAA2D;AAC3D,8DAAqC;AACrC,sEAA6C;AAC7C,2CAA0C;AAE1C,MAAM,WAAW,GAA4C;IAC3D,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,wGAAwG;gBACrH,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,OAAO,CAAC,GAAG,gBAAO,YAAY,EAAE;gBACrC,MAAM,EAAE,KAAK;aACd,CAAC,CAAA;QACJ,CAAC;KACF;IAED,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACvC,OAAO,OAAO,CAAC,GAAG,gBAAO,8BAA8B,EAAE;YACvD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,IAAI,EAAE,2BAA2B;oBACjC,UAAU,EAAE;wBACV,OAAO,EAAE;4BACP,IAAI,EAAE;gCACJ,IAAI,EAAE,SAAS;gCACf,EAAE,EAAE,OAAO,CAAC,MAAM;6BACnB;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;IAED,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,OAAO,EAAE,wBAAY,CAAC,QAAQ,CAAC,OAAO,CAAC;SACxC,CAAA;IACH,CAAC;IAC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,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAC/B,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAA;YAE5B,IAAI,UAAU,KAAK,gBAAgB,CAAC,UAAU,EAAE;gBAC9C,MAAM,IAAI,+BAAgB,CACxB,kGAAkG,EAClG,sBAAsB,EACtB,GAAG,CACJ,CAAA;aACF;YAED,OAAO;gBACL,UAAU;aACX,CAAA;QACH,CAAC;KACF;IACD,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;QACb,gBAAgB,EAAhB,0BAAgB;QAChB,qBAAqB,EAArB,+BAAqB;QACrB,UAAU,EAAV,oBAAU;QACV,cAAc,EAAd,wBAAc;KACf;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { InputField } from '@segment/actions-core/destination-kit/types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const list_id: InputField;
|
|
3
3
|
export declare const email: InputField;
|
|
4
|
+
export declare const external_id: InputField;
|
|
5
|
+
export declare const enable_batching: InputField;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
label: '
|
|
3
|
+
exports.enable_batching = exports.external_id = exports.email = exports.list_id = void 0;
|
|
4
|
+
exports.list_id = {
|
|
5
|
+
label: 'List Id',
|
|
6
6
|
description: `'Insert the ID of the default list that you'd like to subscribe users to when you call .identify().'`,
|
|
7
7
|
type: 'string',
|
|
8
8
|
default: {
|
|
@@ -20,4 +20,15 @@ exports.email = {
|
|
|
20
20
|
},
|
|
21
21
|
readOnly: true
|
|
22
22
|
};
|
|
23
|
+
exports.external_id = {
|
|
24
|
+
label: 'External ID',
|
|
25
|
+
description: `A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system. One of External ID and Email required.`,
|
|
26
|
+
type: 'string'
|
|
27
|
+
};
|
|
28
|
+
exports.enable_batching = {
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
label: 'Batch Data to Klaviyo',
|
|
31
|
+
description: 'When enabled, the action will use the klaviyo batch API.',
|
|
32
|
+
default: true
|
|
33
|
+
};
|
|
23
34
|
//# sourceMappingURL=properties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/properties.ts"],"names":[],"mappings":";;;AAEa,QAAA,
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/properties.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAe;IACjC,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,sGAAsG;IACnH,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,yCAAyC;KACnD;IACD,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,KAAK,GAAe;IAC/B,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,qCAAqC;IAClD,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,wBAAwB;KAClC;IACD,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,WAAW,GAAe;IACrC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,iJAAiJ;IAC9J,IAAI,EAAE,QAAQ;CACf,CAAA;AAEY,QAAA,eAAe,GAAe;IACzC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EAAE,0DAA0D;IACvE,OAAO,EAAE,IAAI;CACd,CAAA"}
|
|
@@ -9,18 +9,27 @@ const action = {
|
|
|
9
9
|
defaultSubscription: 'event = "Audience Exited"',
|
|
10
10
|
fields: {
|
|
11
11
|
email: { ...properties_1.email },
|
|
12
|
-
external_id: { ...properties_1.external_id }
|
|
12
|
+
external_id: { ...properties_1.external_id },
|
|
13
|
+
list_id: { ...properties_1.list_id },
|
|
14
|
+
enable_batching: { ...properties_1.enable_batching }
|
|
13
15
|
},
|
|
14
16
|
perform: async (request, { payload }) => {
|
|
15
|
-
const { email, external_id } = payload;
|
|
16
|
-
if (!email) {
|
|
17
|
-
throw new actions_core_1.PayloadValidationError('Missing Email');
|
|
18
|
-
}
|
|
19
|
-
const profileData = await functions_1.getProfile(request, email);
|
|
20
|
-
const v = profileData.data;
|
|
21
|
-
if (v && v.length !== 0) {
|
|
22
|
-
return await functions_1.removeProfileFromList(request, v[0].id, external_id);
|
|
17
|
+
const { email, list_id, external_id } = payload;
|
|
18
|
+
if (!email && !external_id) {
|
|
19
|
+
throw new actions_core_1.PayloadValidationError('Missing Email or External Id');
|
|
23
20
|
}
|
|
21
|
+
const profileIds = await functions_1.getProfiles(request, email ? [email] : undefined, external_id ? [external_id] : undefined);
|
|
22
|
+
return await functions_1.removeProfileFromList(request, profileIds, list_id);
|
|
23
|
+
},
|
|
24
|
+
performBatch: async (request, { payload }) => {
|
|
25
|
+
const filteredPayload = payload.filter((profile) => profile.email || profile.external_id);
|
|
26
|
+
const listId = filteredPayload[0]?.list_id;
|
|
27
|
+
const emails = filteredPayload.map((profile) => profile.email).filter((email) => email);
|
|
28
|
+
const externalIds = filteredPayload
|
|
29
|
+
.map((profile) => profile.external_id)
|
|
30
|
+
.filter((external_id) => external_id);
|
|
31
|
+
const profileIds = await functions_1.getProfiles(request, emails, externalIds);
|
|
32
|
+
return await functions_1.removeProfileFromList(request, profileIds, listId);
|
|
24
33
|
}
|
|
25
34
|
};
|
|
26
35
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileFromList/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAIhF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileFromList/index.ts"],"names":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AAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAa,CAAA;QACnG,MAAM,WAAW,GAAG,eAAe;aAChC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC;aACrC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAa,CAAA;QAEnD,MAAM,UAAU,GAAG,MAAM,uBAAW,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;QAClE,OAAO,MAAM,iCAAqB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;IACjE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const functions_1 = require("../functions");
|
|
5
|
+
const properties_1 = require("../properties");
|
|
6
|
+
const action = {
|
|
7
|
+
title: 'Remove profile from list',
|
|
8
|
+
description: 'Remove profile from list',
|
|
9
|
+
fields: {
|
|
10
|
+
email: { ...properties_1.email },
|
|
11
|
+
list_id: { ...properties_1.external_id }
|
|
12
|
+
},
|
|
13
|
+
perform: async (request, { payload }) => {
|
|
14
|
+
const { email, list_id } = payload;
|
|
15
|
+
if (!email || !list_id) {
|
|
16
|
+
throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const profileData = await functions_1.getProfile(request, email);
|
|
20
|
+
const v = JSON.parse(profileData.content);
|
|
21
|
+
if (Object.keys(v).length !== 0) {
|
|
22
|
+
console.log(v);
|
|
23
|
+
const listData = {
|
|
24
|
+
data: [
|
|
25
|
+
{
|
|
26
|
+
type: 'profile',
|
|
27
|
+
id: v.data[0].id
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
const list = await functions_1.executeProfileList(request, 'DELETE', listData, list_id);
|
|
32
|
+
return list;
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.log(error);
|
|
38
|
+
throw new Error('An error occurred while processing the request');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.default = action;
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAK1E,4CAA6D;AAC7D,8CAAkD;AAElD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,0BAA0B;IACjC,WAAW,EAAE,0BAA0B;IACvC,MAAM,EAAE;QACN,KAAK,EAAE,EAAE,GAAG,kBAAK,EAAE;QACnB,OAAO,EAAE,EAAE,GAAG,wBAAW,EAAE;KAC5B;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;QAClC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE;YACtB,MAAM,IAAI,+BAAgB,CACxB,sEAAsE,EACtE,yBAAyB,EACzB,GAAG,CACJ,CAAA;SACF;QACD,IAAI;YACF,MAAM,WAAW,GAA2B,MAAM,sBAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;YAC5E,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;YACzC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC/B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;gBACd,MAAM,QAAQ,GAAa;oBACzB,IAAI,EAAE;wBACJ;4BACE,IAAI,EAAE,SAAS;4BACf,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;yBACjB;qBACF;iBACF,CAAA;gBAED,MAAM,IAAI,GAAG,MAAM,8BAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;gBAC3E,OAAO,IAAI,CAAA;aACZ;YACD,OAAM;SACP;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YAClB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;SAClE;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -60,10 +60,11 @@ export interface EventData {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
export interface listData {
|
|
63
|
-
data:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
data: listAttributes[];
|
|
64
|
+
}
|
|
65
|
+
export interface listAttributes {
|
|
66
|
+
type: string;
|
|
67
|
+
id?: string;
|
|
67
68
|
}
|
|
68
69
|
export interface ListIdResponse {
|
|
69
70
|
content: string;
|
|
@@ -76,3 +77,52 @@ export interface GetListResultContent {
|
|
|
76
77
|
};
|
|
77
78
|
}[];
|
|
78
79
|
}
|
|
80
|
+
export interface Location {
|
|
81
|
+
address1?: string | null;
|
|
82
|
+
address2?: string | null;
|
|
83
|
+
city?: string | null;
|
|
84
|
+
region?: string | null;
|
|
85
|
+
zip?: string | null;
|
|
86
|
+
latitude?: string | null;
|
|
87
|
+
longitude?: string | null;
|
|
88
|
+
country?: string | null;
|
|
89
|
+
}
|
|
90
|
+
export interface ProfileAttributes {
|
|
91
|
+
email?: string;
|
|
92
|
+
phone_number?: string;
|
|
93
|
+
external_id?: string;
|
|
94
|
+
first_name?: string;
|
|
95
|
+
last_name?: string;
|
|
96
|
+
organization?: string;
|
|
97
|
+
title?: string;
|
|
98
|
+
image?: string;
|
|
99
|
+
location?: Location | null;
|
|
100
|
+
properties?: Record<string, any>;
|
|
101
|
+
list_id?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface ImportJobPayload {
|
|
104
|
+
type: string;
|
|
105
|
+
attributes: {
|
|
106
|
+
profiles: {
|
|
107
|
+
data: {
|
|
108
|
+
type: string;
|
|
109
|
+
attributes: ProfileAttributes;
|
|
110
|
+
}[];
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
relationships?: {
|
|
114
|
+
lists: {
|
|
115
|
+
data: {
|
|
116
|
+
type: string;
|
|
117
|
+
id: string;
|
|
118
|
+
}[];
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export interface Profile {
|
|
123
|
+
type: string;
|
|
124
|
+
id: string;
|
|
125
|
+
}
|
|
126
|
+
export interface GetProfileResponse {
|
|
127
|
+
data: Profile[];
|
|
128
|
+
}
|
|
@@ -15,6 +15,11 @@ const action = {
|
|
|
15
15
|
format: 'email',
|
|
16
16
|
default: { '@path': '$.traits.email' }
|
|
17
17
|
},
|
|
18
|
+
enable_batching: {
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
label: 'Batch Data to Klaviyo',
|
|
21
|
+
description: 'When enabled, the action will use the klaviyo batch API.'
|
|
22
|
+
},
|
|
18
23
|
phone_number: {
|
|
19
24
|
label: 'Phone Number',
|
|
20
25
|
description: `Individual's phone number in E.164 format. If SMS is not enabled and if you use Phone Number as identifier, then you have to provide one of Email or External ID.`,
|
|
@@ -131,7 +136,7 @@ const action = {
|
|
|
131
136
|
}
|
|
132
137
|
},
|
|
133
138
|
perform: async (request, { payload }) => {
|
|
134
|
-
const { email, external_id, phone_number, list_id, ...otherAttributes } = payload;
|
|
139
|
+
const { email, external_id, phone_number, list_id, enable_batching, ...otherAttributes } = payload;
|
|
135
140
|
if (!email && !phone_number && !external_id) {
|
|
136
141
|
throw new actions_core_1.PayloadValidationError('One of External ID, Phone Number and Email is required.');
|
|
137
142
|
}
|
|
@@ -175,8 +180,28 @@ const action = {
|
|
|
175
180
|
return profile;
|
|
176
181
|
}
|
|
177
182
|
}
|
|
178
|
-
throw
|
|
183
|
+
throw error;
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
performBatch: async (request, { payload }) => {
|
|
187
|
+
payload = payload.filter((profile) => profile.email || profile.external_id || profile.phone_number);
|
|
188
|
+
const profilesWithList = payload.filter((profile) => profile.list_id);
|
|
189
|
+
const profilesWithoutList = payload.filter((profile) => !profile.list_id);
|
|
190
|
+
let importResponseWithList;
|
|
191
|
+
let importResponseWithoutList;
|
|
192
|
+
if (profilesWithList.length > 0) {
|
|
193
|
+
const listId = profilesWithList[0].list_id;
|
|
194
|
+
const importJobPayload = functions_1.createImportJobPayload(profilesWithList, listId);
|
|
195
|
+
importResponseWithList = await functions_1.sendImportJobRequest(request, importJobPayload);
|
|
179
196
|
}
|
|
197
|
+
if (profilesWithoutList.length > 0) {
|
|
198
|
+
const importJobPayload = functions_1.createImportJobPayload(profilesWithoutList);
|
|
199
|
+
importResponseWithoutList = await functions_1.sendImportJobRequest(request, importJobPayload);
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
withList: importResponseWithList,
|
|
203
|
+
withoutList: importResponseWithoutList
|
|
204
|
+
};
|
|
180
205
|
}
|
|
181
206
|
};
|
|
182
207
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/upsertProfile/index.ts"],"names":[],"mappings":";;AAIA,sCAAmC;AACnC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../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MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACrE,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;YAC/B,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;YAC1C,MAAM,gBAAgB,GAAG,kCAAsB,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;YACzE,sBAAsB,GAAG,MAAM,gCAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;SAC/E;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"}
|
|
@@ -76,21 +76,25 @@ const action = {
|
|
|
76
76
|
default: 'AUTO'
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
-
perform: async (request, { settings, payload }) => {
|
|
80
|
-
return processPayload(request, settings, [payload]);
|
|
79
|
+
perform: async (request, { settings, payload, statsContext }) => {
|
|
80
|
+
return processPayload(request, settings, [payload], statsContext);
|
|
81
81
|
},
|
|
82
|
-
performBatch: async (request, { settings, payload }) => {
|
|
83
|
-
return processPayload(request, settings, payload);
|
|
82
|
+
performBatch: async (request, { settings, payload, statsContext }) => {
|
|
83
|
+
return processPayload(request, settings, payload, statsContext);
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
async function processPayload(request, settings, payloads) {
|
|
86
|
+
async function processPayload(request, settings, payloads, statsContext) {
|
|
87
87
|
validate(settings, payloads);
|
|
88
88
|
const linkedinApiClient = new api_1.LinkedInAudiences(request);
|
|
89
|
-
const dmpSegmentId = await getDmpSegmentId(linkedinApiClient, settings, payloads[0]);
|
|
89
|
+
const dmpSegmentId = await getDmpSegmentId(linkedinApiClient, settings, payloads[0], statsContext);
|
|
90
90
|
const elements = extractUsers(settings, payloads);
|
|
91
91
|
if (elements.length < 1) {
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
+
statsContext?.statsClient?.incr('oauth_app_api_call', 1, [
|
|
95
|
+
...statsContext?.tags,
|
|
96
|
+
`endpoint:add-or-remove-users-from-dmpSegment`
|
|
97
|
+
]);
|
|
94
98
|
const res = await linkedinApiClient.batchUpdate(dmpSegmentId, elements);
|
|
95
99
|
if (res.status !== 200) {
|
|
96
100
|
throw new actions_core_1.RetryableError('Error while attempting to update LinkedIn DMP Segment. This batch will be retried.');
|
|
@@ -106,15 +110,17 @@ function validate(settings, payloads) {
|
|
|
106
110
|
throw new actions_core_1.IntegrationError('At least one of `Send Email` or `Send Google Advertising ID` must be set to `true`.', 'INVALID_SETTINGS', 400);
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
|
-
async function getDmpSegmentId(linkedinApiClient, settings, payload) {
|
|
113
|
+
async function getDmpSegmentId(linkedinApiClient, settings, payload, statsContext) {
|
|
114
|
+
statsContext?.statsClient?.incr('oauth_app_api_call', 1, [...statsContext?.tags, `endpoint:get-dmpSegment`]);
|
|
110
115
|
const res = await linkedinApiClient.getDmpSegment(settings, payload);
|
|
111
116
|
const body = await res.json();
|
|
112
117
|
if (body.elements?.length > 0) {
|
|
113
118
|
return body.elements[0].id;
|
|
114
119
|
}
|
|
115
|
-
return createDmpSegment(linkedinApiClient, settings, payload);
|
|
120
|
+
return createDmpSegment(linkedinApiClient, settings, payload, statsContext);
|
|
116
121
|
}
|
|
117
|
-
async function createDmpSegment(linkedinApiClient, settings, payload) {
|
|
122
|
+
async function createDmpSegment(linkedinApiClient, settings, payload, statsContext) {
|
|
123
|
+
statsContext?.statsClient?.incr('oauth_app_api_call', 1, [...statsContext?.tags, `endpoint:create-dmpSegment`]);
|
|
118
124
|
const res = await linkedinApiClient.createDmpSegment(settings, payload);
|
|
119
125
|
const headers = res.headers.toJSON();
|
|
120
126
|
return headers['x-linkedin-id'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/updateAudience/index.ts"],"names":[],"mappings":";;AACA,wDAAuF;AAGvF,mCAAmC;AACnC,gCAA0C;AAE1C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,oEAAoE;IACjF,mBAAmB,EAAE,yDAAyD;IAC9E,MAAM,EAAE;QACN,gBAAgB,EAAE;YAChB,KAAK,EAAE,0BAA0B;YACjC,WAAW,EACT,oNAAoN;YACtN,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,2BAA2B;aACrC;SACF;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,0DAA0D;YACvE,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,IAAI;SACd;QACD,KAAK,EAAE;YACL,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,+CAA+C;YAC5D,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE;gBACP,OAAO,EAAE,wBAAwB;aAClC;SACF;QACD,qBAAqB,EAAE;YACrB,KAAK,EAAE,4BAA4B;YACnC,WAAW,EAAE,uDAAuD;YACpE,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE;gBACP,OAAO,EAAE,gCAAgC;aAC1C;SACF;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,4BAA4B;YACnC,WAAW,EACT,oJAAoJ;YACtJ,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE;gBACP,OAAO,EAAE,2BAA2B;aACrC;SACF;QACD,qBAAqB,EAAE;YACrB,KAAK,EAAE,6BAA6B;YACpC,WAAW,EACT,iMAAiM;YACnM,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,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,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,oDAAoD;YACjE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE;gBACvC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC9B,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;aACrC;YACD,OAAO,EAAE,MAAM;SAChB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/updateAudience/index.ts"],"names":[],"mappings":";;AACA,wDAAuF;AAGvF,mCAAmC;AACnC,gCAA0C;AAE1C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,oEAAoE;IACjF,mBAAmB,EAAE,yDAAyD;IAC9E,MAAM,EAAE;QACN,gBAAgB,EAAE;YAChB,KAAK,EAAE,0BAA0B;YACjC,WAAW,EACT,oNAAoN;YACtN,IAAI,EAAE,QAAQ;YACd,O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