@segment/action-destinations 3.112.1-alpha.9 → 3.113.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/clevertap/index.js +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +1 -0
- package/dist/destinations/google-enhanced-conversions/functions.js +8 -1
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js +2 -2
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js +8 -44
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map +1 -1
- package/dist/destinations/hubspot/errors.d.ts +17 -0
- package/dist/destinations/hubspot/errors.js +30 -0
- package/dist/destinations/hubspot/errors.js.map +1 -0
- package/dist/destinations/hubspot/index.js +5 -3
- package/dist/destinations/hubspot/index.js.map +1 -1
- package/dist/destinations/hubspot/properties.d.ts +3 -1
- package/dist/destinations/hubspot/properties.js +4 -2
- package/dist/destinations/hubspot/properties.js.map +1 -1
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js +2 -2
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js.map +1 -1
- package/dist/destinations/hubspot/upsertCompany/generated-types.d.ts +21 -0
- package/dist/destinations/hubspot/upsertCompany/generated-types.js +3 -0
- package/dist/destinations/hubspot/upsertCompany/generated-types.js.map +1 -0
- package/dist/destinations/hubspot/upsertCompany/index.d.ts +5 -0
- package/dist/destinations/hubspot/upsertCompany/index.js +321 -0
- package/dist/destinations/hubspot/upsertCompany/index.js.map +1 -0
- package/dist/destinations/hubspot/upsertContact/index.js +5 -5
- package/dist/destinations/hubspot/upsertContact/index.js.map +1 -1
- package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js +39 -10
- package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/generated-types.d.ts +0 -2
- package/dist/destinations/linkedin-audiences/index.js +20 -49
- package/dist/destinations/linkedin-audiences/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/linkedin-properties.d.ts +1 -0
- package/dist/destinations/linkedin-audiences/linkedin-properties.js +5 -0
- package/dist/destinations/linkedin-audiences/linkedin-properties.js.map +1 -0
- package/dist/destinations/linkedin-audiences/updateAudience/generated-types.d.ts +2 -0
- package/dist/destinations/linkedin-audiences/updateAudience/index.js +63 -26
- package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
- package/dist/destinations/mixpanel/identifyUser/generated-types.d.ts +1 -0
- package/dist/destinations/mixpanel/identifyUser/index.js +9 -0
- package/dist/destinations/mixpanel/identifyUser/index.js.map +1 -1
- package/dist/destinations/mixpanel/trackPurchase/index.js +18 -6
- package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -1
- package/dist/destinations/sendgrid/sendgrid-properties.js +2 -1
- package/dist/destinations/sendgrid/sendgrid-properties.js.map +1 -1
- package/package.json +4 -4
- package/dist/destinations/hubspot/testHelper.d.ts +0 -7
- package/dist/destinations/hubspot/testHelper.js +0 -24
- package/dist/destinations/hubspot/testHelper.js.map +0 -1
- package/dist/destinations/linkedin-audiences/api/index.d.ts +0 -13
- package/dist/destinations/linkedin-audiences/api/index.js +0 -62
- package/dist/destinations/linkedin-audiences/api/index.js.map +0 -1
- package/dist/destinations/linkedin-audiences/constants.d.ts +0 -2
- package/dist/destinations/linkedin-audiences/constants.js +0 -6
- package/dist/destinations/linkedin-audiences/constants.js.map +0 -1
- package/dist/destinations/linkedin-audiences/types.d.ts +0 -28
- package/dist/destinations/linkedin-audiences/types.js +0 -11
- package/dist/destinations/linkedin-audiences/types.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkedin-properties.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-audiences/linkedin-properties.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,QAAQ,CAAA"}
|
|
@@ -2,7 +2,9 @@ export interface Payload {
|
|
|
2
2
|
dmp_segment_name?: string;
|
|
3
3
|
enable_batching?: boolean;
|
|
4
4
|
email?: string;
|
|
5
|
+
send_email?: boolean;
|
|
5
6
|
google_advertising_id?: string;
|
|
7
|
+
send_google_advertising_id?: boolean;
|
|
6
8
|
source_segment_id?: string;
|
|
7
9
|
personas_audience_key: string;
|
|
8
10
|
event_name?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const actions_core_1 = require("@segment/actions-core");
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
|
-
const
|
|
5
|
+
const actions_core_2 = require("@segment/actions-core");
|
|
6
6
|
const action = {
|
|
7
7
|
title: 'Sync To LinkedIn DMP Segment',
|
|
8
8
|
description: 'Syncs contacts from a Personas Audience to a LinkedIn DMP Segment.',
|
|
@@ -29,6 +29,12 @@ const action = {
|
|
|
29
29
|
'@path': '$.context.traits.email'
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
+
send_email: {
|
|
33
|
+
label: 'Send Email',
|
|
34
|
+
description: 'Whether to send `email` to LinkedIn.',
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
default: true
|
|
37
|
+
},
|
|
32
38
|
google_advertising_id: {
|
|
33
39
|
label: 'User Google Advertising ID',
|
|
34
40
|
description: "The user's Google Advertising ID to send to LinkedIn.",
|
|
@@ -37,6 +43,12 @@ const action = {
|
|
|
37
43
|
'@path': '$.context.device.advertisingId'
|
|
38
44
|
}
|
|
39
45
|
},
|
|
46
|
+
send_google_advertising_id: {
|
|
47
|
+
label: 'Send Google Advertising ID',
|
|
48
|
+
description: 'Whether to send Google Advertising ID to LinkedIn.',
|
|
49
|
+
type: 'boolean',
|
|
50
|
+
default: true
|
|
51
|
+
},
|
|
40
52
|
source_segment_id: {
|
|
41
53
|
label: 'LinkedIn Source Segment ID',
|
|
42
54
|
description: "A Segment-specific key associated with the LinkedIn DMP Segment. This is the lookup key Segment uses to fetch the DMP Segment from LinkedIn's API.",
|
|
@@ -68,41 +80,66 @@ const action = {
|
|
|
68
80
|
}
|
|
69
81
|
};
|
|
70
82
|
async function processPayload(request, settings, payloads) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const dmpSegmentId = await getDmpSegmentId(linkedinApiClient, settings, payloads[0]);
|
|
74
|
-
const elements = extractUsers(settings, payloads);
|
|
75
|
-
if (elements.length < 1) {
|
|
76
|
-
return;
|
|
83
|
+
if (payloads[0].source_segment_id !== payloads[0].personas_audience_key) {
|
|
84
|
+
throw new actions_core_2.IntegrationError('The value of `source_segment_id` and `personas_audience_key` must match.', 'Invalid settings.', 400);
|
|
77
85
|
}
|
|
78
|
-
const
|
|
86
|
+
const dmpSegmentId = await getDmpSegmentId(request, settings, payloads[0]);
|
|
87
|
+
const elements = extractUsers(payloads);
|
|
88
|
+
const res = await request(`https://api.linkedin.com/rest/dmpSegments/${dmpSegmentId}/users`, {
|
|
89
|
+
method: 'POST',
|
|
90
|
+
headers: {
|
|
91
|
+
'X-RestLi-Method': 'BATCH_CREATE'
|
|
92
|
+
},
|
|
93
|
+
json: {
|
|
94
|
+
elements
|
|
95
|
+
},
|
|
96
|
+
throwHttpErrors: false
|
|
97
|
+
});
|
|
79
98
|
if (res.status !== 200) {
|
|
80
99
|
throw new actions_core_1.RetryableError('Error while attempting to update LinkedIn DMP Segment. This batch will be retried.');
|
|
81
100
|
}
|
|
82
101
|
return res;
|
|
83
102
|
}
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
throw new actions_core_1.IntegrationError('The value of `source_segment_id` and `personas_audience_key` must match.', 'INVALID_SETTINGS', 400);
|
|
87
|
-
}
|
|
88
|
-
if (!settings.send_google_advertising_id && !settings.send_email) {
|
|
89
|
-
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);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
async function getDmpSegmentId(linkedinApiClient, settings, payload) {
|
|
93
|
-
const res = await linkedinApiClient.getDmpSegment(settings, payload);
|
|
103
|
+
async function getDmpSegmentId(request, settings, payload) {
|
|
104
|
+
const res = await getDmpSegment(request, settings, payload);
|
|
94
105
|
const body = await res.json();
|
|
95
106
|
if (body.elements?.length > 0) {
|
|
96
107
|
return body.elements[0].id;
|
|
97
108
|
}
|
|
98
|
-
return createDmpSegment(
|
|
109
|
+
return createDmpSegment(request, settings, payload);
|
|
99
110
|
}
|
|
100
|
-
async function
|
|
101
|
-
|
|
111
|
+
async function getDmpSegment(request, settings, payload) {
|
|
112
|
+
return request('https://api.linkedin.com/rest/dmpSegments', {
|
|
113
|
+
method: 'GET',
|
|
114
|
+
searchParams: {
|
|
115
|
+
q: 'account',
|
|
116
|
+
account: `urn:li:sponsoredAccount:${settings.ad_account_id}`,
|
|
117
|
+
sourceSegmentId: payload.source_segment_id || '',
|
|
118
|
+
sourcePlatform: 'SEGMENT'
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async function createDmpSegment(request, settings, payload) {
|
|
123
|
+
const res = await request('https://api.linkedin.com/rest/dmpSegments', {
|
|
124
|
+
method: 'POST',
|
|
125
|
+
json: {
|
|
126
|
+
name: payload.dmp_segment_name,
|
|
127
|
+
sourcePlatform: 'SEGMENT',
|
|
128
|
+
sourceSegmentId: payload.source_segment_id,
|
|
129
|
+
account: `urn:li:sponsoredAccount:${settings.ad_account_id}`,
|
|
130
|
+
accessPolicy: 'PRIVATE',
|
|
131
|
+
type: 'USER',
|
|
132
|
+
destinations: [
|
|
133
|
+
{
|
|
134
|
+
destination: 'LINKEDIN'
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
});
|
|
102
139
|
const headers = res.headers.toJSON();
|
|
103
140
|
return headers['x-linkedin-id'];
|
|
104
141
|
}
|
|
105
|
-
function extractUsers(
|
|
142
|
+
function extractUsers(payloads) {
|
|
106
143
|
const elements = [];
|
|
107
144
|
payloads.forEach((payload) => {
|
|
108
145
|
if (!payload.email && !payload.google_advertising_id) {
|
|
@@ -110,7 +147,7 @@ function extractUsers(settings, payloads) {
|
|
|
110
147
|
}
|
|
111
148
|
elements.push({
|
|
112
149
|
action: getAction(payload),
|
|
113
|
-
userIds: getUserIds(
|
|
150
|
+
userIds: getUserIds(payload)
|
|
114
151
|
});
|
|
115
152
|
});
|
|
116
153
|
return elements;
|
|
@@ -123,15 +160,15 @@ function getAction(payload) {
|
|
|
123
160
|
return 'REMOVE';
|
|
124
161
|
}
|
|
125
162
|
}
|
|
126
|
-
function getUserIds(
|
|
163
|
+
function getUserIds(payload) {
|
|
127
164
|
const users = [];
|
|
128
|
-
if (payload.email
|
|
165
|
+
if (payload.email) {
|
|
129
166
|
users.push({
|
|
130
167
|
idType: 'SHA256_EMAIL',
|
|
131
168
|
idValue: crypto_1.createHash('sha256').update(payload.email).digest('hex')
|
|
132
169
|
});
|
|
133
170
|
}
|
|
134
|
-
if (payload.google_advertising_id
|
|
171
|
+
if (payload.google_advertising_id) {
|
|
135
172
|
users.push({
|
|
136
173
|
idType: 'GOOGLE_AID',
|
|
137
174
|
idValue: payload.google_advertising_id
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/updateAudience/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/updateAudience/index.ts"],"names":[],"mappings":";;AAEA,wDAAsD;AAGtD,mCAAmC;AACnC,wDAAwD;AAExD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,oEAAoE;IACjF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A;AACjC,CAAC;AAED,SAAS,YAAY,CAAC,QAAmB;IACvC,MAAM,QAAQ,GAA0B,EAAE,CAAA;IAE1C,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAgB,EAAE,EAAE;QACpC,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE;YACpD,OAAM;SACP;QAED,QAAQ,CAAC,IAAI,CAAC;YACZ,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC;YAC1B,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;SAC7B,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,SAAS,SAAS,CAAC,OAAgB;IACjC,IAAI,OAAO,CAAC,UAAU,KAAK,kBAAkB,EAAE;QAC7C,OAAO,KAAK,CAAA;KACb;SAAM,IAAI,OAAO,CAAC,UAAU,KAAK,iBAAiB,EAAE;QACnD,OAAO,QAAQ,CAAA;KAChB;AACH,CAAC;AAED,SAAS,UAAU,CAAC,OAAgB;IAClC,MAAM,KAAK,GAAG,EAAE,CAAA;IAEhB,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,KAAK,CAAC,IAAI,CAAC;YACT,MAAM,EAAE,cAAc;YACtB,OAAO,EAAE,mBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAClE,CAAC,CAAA;KACH;IAED,IAAI,OAAO,CAAC,qBAAqB,EAAE;QACjC,KAAK,CAAC,IAAI,CAAC;YACT,MAAM,EAAE,YAAY;YACpB,OAAO,EAAE,OAAO,CAAC,qBAAqB;SACvC,CAAC,CAAA;KACH;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -7,6 +7,14 @@ const action = {
|
|
|
7
7
|
description: 'Set the user ID for a particular device ID or update user properties. Learn more about [User Profiles](https://help.mixpanel.com/hc/en-us/articles/115004501966?source=segment-actions) and [Identity Management](https://help.mixpanel.com/hc/en-us/articles/360041039771-Getting-Started-with-Identity-Management?source=segment-actions).',
|
|
8
8
|
defaultSubscription: 'type = "identify"',
|
|
9
9
|
fields: {
|
|
10
|
+
ip: {
|
|
11
|
+
label: 'IP Address',
|
|
12
|
+
type: 'string',
|
|
13
|
+
description: "The IP address of the user. This is only used for geolocation and won't be stored.",
|
|
14
|
+
default: {
|
|
15
|
+
'@path': '$.context.ip'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
10
18
|
user_id: {
|
|
11
19
|
label: 'User ID',
|
|
12
20
|
type: 'string',
|
|
@@ -70,6 +78,7 @@ const action = {
|
|
|
70
78
|
const data = {
|
|
71
79
|
$token: settings.projectToken,
|
|
72
80
|
$distinct_id: payload.user_id,
|
|
81
|
+
$ip: payload.ip,
|
|
73
82
|
$set: traits
|
|
74
83
|
};
|
|
75
84
|
const engageResponse = request(`${apiServerUrl}/engage`, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/mixpanel/identifyUser/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAIhF,oCAA0C;AAE1C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,8UAA8U;IAChV,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,uCAAuC;YACpD,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,yCAAyC;YACtD,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,MAAM,EAAE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,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;SAC/B;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IAC/B,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -8,7 +8,19 @@ const utils_1 = require("../utils");
|
|
|
8
8
|
const functions_1 = require("../trackEvent/functions");
|
|
9
9
|
const mixpanel_properties_1 = require("../mixpanel-properties");
|
|
10
10
|
const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
|
|
11
|
-
const topLevelKeys = [
|
|
11
|
+
const topLevelKeys = [
|
|
12
|
+
'affiliation',
|
|
13
|
+
'subtotal',
|
|
14
|
+
'total',
|
|
15
|
+
'revenue',
|
|
16
|
+
'shipping',
|
|
17
|
+
'tax',
|
|
18
|
+
'discount',
|
|
19
|
+
'coupon',
|
|
20
|
+
'currency',
|
|
21
|
+
'order_number',
|
|
22
|
+
'products'
|
|
23
|
+
];
|
|
12
24
|
const getPurchaseEventsFromPayload = (payload, settings) => {
|
|
13
25
|
const orderCompletedEvent = {
|
|
14
26
|
event: payload.event,
|
|
@@ -24,12 +36,12 @@ const getPurchaseEventsFromPayload = (payload, settings) => {
|
|
|
24
36
|
let insertIdCount = 0;
|
|
25
37
|
purchaseEvents = payload.products.map((product) => {
|
|
26
38
|
return {
|
|
27
|
-
event:
|
|
39
|
+
event: 'Product Purchased',
|
|
28
40
|
properties: {
|
|
29
41
|
...actions_core_1.omit(orderCompletedEvent.properties, topLevelKeys),
|
|
30
|
-
$insert_id:
|
|
42
|
+
$insert_id: (insertIdCount++).toString() + insertId,
|
|
31
43
|
time: --time,
|
|
32
|
-
...product
|
|
44
|
+
...product
|
|
33
45
|
}
|
|
34
46
|
};
|
|
35
47
|
});
|
|
@@ -67,14 +79,14 @@ const action = {
|
|
|
67
79
|
default: {
|
|
68
80
|
'@path': '$.event'
|
|
69
81
|
}
|
|
70
|
-
}
|
|
82
|
+
}
|
|
71
83
|
},
|
|
72
84
|
perform: async (request, { settings, payload }) => {
|
|
73
85
|
return processData(request, settings, [payload]);
|
|
74
86
|
},
|
|
75
87
|
performBatch: async (request, { settings, payload }) => {
|
|
76
88
|
return processData(request, settings, payload);
|
|
77
|
-
}
|
|
89
|
+
}
|
|
78
90
|
};
|
|
79
91
|
exports.default = action;
|
|
80
92
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/mixpanel/trackPurchase/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA6E;AAI7E,oCAAqD;AACrD,uDAA4D;AAC5D,gEAA4E;AAC5E,+DAAsC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/mixpanel/trackPurchase/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA6E;AAI7E,oCAAqD;AACrD,uDAA4D;AAC5D,gEAA4E;AAC5E,+DAAsC;AAEtC,MAAM,YAAY,GAAG;IACnB,aAAa;IACb,UAAU;IACV,OAAO;IACP,SAAS;IACT,UAAU;IACV,KAAK;IACL,UAAU;IACV,QAAQ;IACR,UAAU;IACV,cAAc;IACd,UAAU;CACX,CAAA;AAED,MAAM,4BAA4B,GAAG,CAAC,OAAgB,EAAE,QAAkB,EAAmB,EAAE;IAC7F,MAAM,mBAAmB,GAAkB;QACzC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,UAAU,EAAE;YACV,GAAG,8BAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC;SACzC;KACF,CAAA;IACD,IAAI,cAAc,GAAoB,EAAE,CAAA;IACxC,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,+BAA+B,EAAE;QAC/D,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAA;QAC7B,IAAI,IAAI,GAAG,QAAQ,IAAI,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,eAA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AE,gBAAgB;IACvB,WAAW,EAAE,8CAA8C;IAC3D,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,+BAA+B,EAAE;YAC/B,KAAK,EAAE,qCAAqC;YAC5C,WAAW,EAAE,4EAA4E;YACzF,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACf;QACD,GAAG,qCAAe;QAClB,GAAG,wCAAkB;QACrB,KAAK,EAAE;YACL,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;KACF;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,OAAO,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAClD,CAAC;IAED,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QACrD,OAAO,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IAChD,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertPayload = exports.fetchAccountCustomFields = exports.customFields = void 0;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
5
|
exports.customFields = {
|
|
5
6
|
label: 'Other Fields',
|
|
6
7
|
description: `
|
|
@@ -40,7 +41,7 @@ const convertCustomFieldNamesToIds = (customFields, accountCustomFields) => {
|
|
|
40
41
|
actualKey = matchingCustomField.id;
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
|
-
throw new
|
|
44
|
+
throw new actions_core_1.IntegrationError(`Unknown custom field '${key}'. To see your defined custom fields, visit https://mc.sendgrid.com/custom-fields`, 'Invalid value', 400);
|
|
44
45
|
}
|
|
45
46
|
result[actualKey] = customFields[key];
|
|
46
47
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendgrid-properties.js","sourceRoot":"","sources":["../../../src/destinations/sendgrid/sendgrid-properties.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sendgrid-properties.js","sourceRoot":"","sources":["../../../src/destinations/sendgrid/sendgrid-properties.ts"],"names":[],"mappings":";;;AAAA,wDAAmF;AAGtE,QAAA,YAAY,GAAe;IACtC,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE;;;;;;;;GAQZ;IACD,IAAI,EAAE,QAAQ;IACd,eAAe,EAAE,UAAU;CAC5B,CAAA;AAaM,MAAM,wBAAwB,GAAG,KAAK,EAAE,OAAsB,EAA0B,EAAE;IAC/F,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,yDAAyD,CAAC,CAAA;IACzF,MAAM,IAAI,GAAY,QAAQ,CAAC,IAAe,CAAA;IAC9C,MAAM,YAAY,GAAkB,IAAI,CAAC,aAA8B,CAAA;IAGvE,IAAI,YAAY,KAAK,SAAS,EAAE;QAC9B,OAAO,EAAE,CAAA;KACV;IAED,OAAO,YAAY,CAAC,GAAG,CAErB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAe,EAAe,EAAE;QACzC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;IACrB,CAAC,CACF,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,wBAAwB,4BAgBpC;AAKD,MAAM,4BAA4B,GAAG,CAAC,YAAiB,EAAE,mBAAkC,EAAO,EAAE;IAClG,MAAM,SAAS,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC9D,MAAM,WAAW,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAA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aAAa,EAAE,mBAAmB,EAAE,CAAA;AAC5G,CAAC,CAAA;AATY,QAAA,cAAc,kBAS1B"}
|
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.
|
|
4
|
+
"version": "3.113.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@amplitude/ua-parser-js": "^0.7.25",
|
|
40
40
|
"@segment/a1-notation": "^2.1.4",
|
|
41
|
-
"@segment/actions-core": "^3.
|
|
42
|
-
"@segment/actions-shared": "^1.
|
|
41
|
+
"@segment/actions-core": "^3.41.0",
|
|
42
|
+
"@segment/actions-shared": "^1.24.0",
|
|
43
43
|
"cheerio": "^1.0.0-rc.10",
|
|
44
44
|
"dayjs": "^1.10.7",
|
|
45
45
|
"escape-goat": "^3",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"lcov"
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "8fca4dc3b41a91f52b161179c1b27f920208b0c7"
|
|
69
69
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateValidHubSpotCustomObjectName = void 0;
|
|
4
|
-
const generateHash = (seed) => {
|
|
5
|
-
let i, chr, hash;
|
|
6
|
-
hash = 0;
|
|
7
|
-
if (seed.length === 0)
|
|
8
|
-
return hash;
|
|
9
|
-
for (i = 0; i < seed.length; i++) {
|
|
10
|
-
chr = seed.charCodeAt(i);
|
|
11
|
-
hash = (hash << 5) - hash + chr;
|
|
12
|
-
hash |= 0;
|
|
13
|
-
}
|
|
14
|
-
return Math.abs(hash);
|
|
15
|
-
};
|
|
16
|
-
const generateValidHubSpotCustomObjectName = (seed) => {
|
|
17
|
-
const hash = generateHash(seed);
|
|
18
|
-
return {
|
|
19
|
-
objectType: `p${hash}_Obj${hash}`,
|
|
20
|
-
properties: { testProperty: `testValue-${hash}` }
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
exports.generateValidHubSpotCustomObjectName = generateValidHubSpotCustomObjectName;
|
|
24
|
-
//# sourceMappingURL=testHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testHelper.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/testHelper.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;IACpC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAA;IAChB,IAAI,GAAG,CAAC,CAAA;IAER,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAChC,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QACxB,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAA;QAC/B,IAAI,IAAI,CAAC,CAAA;KACV;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACvB,CAAC,CAAA;AAED,MAAM,oCAAoC,GAAG,CAAC,IAAY,EAAE,EAAE;IAC5D,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAC/B,OAAO;QACL,UAAU,EAAE,IAAI,IAAI,OAAO,IAAI,EAAE;QACjC,UAAU,EAAE,EAAE,YAAY,EAAE,aAAa,IAAI,EAAE,EAAE;KAClD,CAAA;AACH,CAAC,CAAA;AACQ,oFAAoC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { RequestClient, ModifiedResponse } from '@segment/actions-core';
|
|
2
|
-
import type { Settings } from '../generated-types';
|
|
3
|
-
import type { Payload } from '../updateAudience/generated-types';
|
|
4
|
-
import type { ProfileAPIResponse, AdAccountUserResponse } from '../types';
|
|
5
|
-
export declare class LinkedInAudiences {
|
|
6
|
-
request: RequestClient;
|
|
7
|
-
constructor(request: RequestClient);
|
|
8
|
-
getProfile(): Promise<ModifiedResponse<ProfileAPIResponse>>;
|
|
9
|
-
getAdAccountUserProfile(settings: Settings, userId: string): Promise<ModifiedResponse<AdAccountUserResponse>>;
|
|
10
|
-
getDmpSegment(settings: Settings, payload: Payload): Promise<ModifiedResponse>;
|
|
11
|
-
createDmpSegment(settings: Settings, payload: Payload): Promise<ModifiedResponse>;
|
|
12
|
-
batchUpdate(dmpSegmentId: string, elements: Record<string, string>[]): Promise<ModifiedResponse>;
|
|
13
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LinkedInAudiences = void 0;
|
|
4
|
-
const constants_1 = require("../constants");
|
|
5
|
-
class LinkedInAudiences {
|
|
6
|
-
constructor(request) {
|
|
7
|
-
this.request = request;
|
|
8
|
-
}
|
|
9
|
-
async getProfile() {
|
|
10
|
-
return this.request(`${constants_1.BASE_URL}/me`, {
|
|
11
|
-
method: 'GET'
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
async getAdAccountUserProfile(settings, userId) {
|
|
15
|
-
return this.request(`${constants_1.BASE_URL}/adAccountUsers/account=urn:li:sponsoredAccount:${settings.ad_account_id}&user=urn:li:person:${userId}`, {
|
|
16
|
-
method: 'GET'
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
async getDmpSegment(settings, payload) {
|
|
20
|
-
return this.request(`${constants_1.BASE_URL}/dmpSegments`, {
|
|
21
|
-
method: 'GET',
|
|
22
|
-
searchParams: {
|
|
23
|
-
q: 'account',
|
|
24
|
-
account: `urn:li:sponsoredAccount:${settings.ad_account_id}`,
|
|
25
|
-
sourceSegmentId: payload.source_segment_id || '',
|
|
26
|
-
sourcePlatform: 'SEGMENT'
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
async createDmpSegment(settings, payload) {
|
|
31
|
-
return this.request(`${constants_1.BASE_URL}/dmpSegments`, {
|
|
32
|
-
method: 'POST',
|
|
33
|
-
json: {
|
|
34
|
-
name: payload.dmp_segment_name,
|
|
35
|
-
sourcePlatform: 'SEGMENT',
|
|
36
|
-
sourceSegmentId: payload.source_segment_id,
|
|
37
|
-
account: `urn:li:sponsoredAccount:${settings.ad_account_id}`,
|
|
38
|
-
accessPolicy: 'PRIVATE',
|
|
39
|
-
type: 'USER',
|
|
40
|
-
destinations: [
|
|
41
|
-
{
|
|
42
|
-
destination: 'LINKEDIN'
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
async batchUpdate(dmpSegmentId, elements) {
|
|
49
|
-
return this.request(`${constants_1.BASE_URL}/dmpSegments/${dmpSegmentId}/users`, {
|
|
50
|
-
method: 'POST',
|
|
51
|
-
headers: {
|
|
52
|
-
'X-RestLi-Method': 'BATCH_CREATE'
|
|
53
|
-
},
|
|
54
|
-
json: {
|
|
55
|
-
elements
|
|
56
|
-
},
|
|
57
|
-
throwHttpErrors: false
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.LinkedInAudiences = LinkedInAudiences;
|
|
62
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/api/index.ts"],"names":[],"mappings":";;;AAGA,4CAAuC;AAGvC,MAAa,iBAAiB;IAG5B,YAAY,OAAsB;QAChC,IAAI,CAAC,O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QAAkC;QACxE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,oBAAQ,gBAAgB,YAAY,QAAQ,EAAE;YACnE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,iBAAiB,EAAE,cAAc;aAClC;YACD,IAAI,EAAE;gBACJ,QAAQ;aACT;YACD,eAAe,EAAE,KAAK;SACvB,CAAC,CAAA;IACJ,CAAC;CACF;AAjED,8CAiEC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BASE_URL = exports.LINKEDIN_API_VERSION = void 0;
|
|
4
|
-
exports.LINKEDIN_API_VERSION = '202207';
|
|
5
|
-
exports.BASE_URL = 'https://api.linkedin.com/rest';
|
|
6
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-audiences/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,QAAQ,CAAA;AAC/B,QAAA,QAAQ,GAAG,+BAA+B,CAAA"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { HTTPError } from '@segment/actions-core';
|
|
2
|
-
export interface RefreshTokenResponse {
|
|
3
|
-
access_token: string;
|
|
4
|
-
scope: string;
|
|
5
|
-
expires_in: number;
|
|
6
|
-
token_type: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ProfileAPIResponse {
|
|
9
|
-
id: string;
|
|
10
|
-
}
|
|
11
|
-
export interface AdAccountUserResponse {
|
|
12
|
-
role: string;
|
|
13
|
-
}
|
|
14
|
-
export declare class LinkedInRefreshTokenError extends HTTPError {
|
|
15
|
-
response: Response & {
|
|
16
|
-
data: {
|
|
17
|
-
error: string;
|
|
18
|
-
error_description: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export declare class LinkedInTestAuthenticationError extends HTTPError {
|
|
23
|
-
response: Response & {
|
|
24
|
-
data: {
|
|
25
|
-
message: string;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LinkedInTestAuthenticationError = exports.LinkedInRefreshTokenError = void 0;
|
|
4
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
-
class LinkedInRefreshTokenError extends actions_core_1.HTTPError {
|
|
6
|
-
}
|
|
7
|
-
exports.LinkedInRefreshTokenError = LinkedInRefreshTokenError;
|
|
8
|
-
class LinkedInTestAuthenticationError extends actions_core_1.HTTPError {
|
|
9
|
-
}
|
|
10
|
-
exports.LinkedInTestAuthenticationError = LinkedInTestAuthenticationError;
|
|
11
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-audiences/types.ts"],"names":[],"mappings":";;;AAAA,wDAAiD;AAiBjD,MAAa,yBAA0B,SAAQ,wBAAS;CAOvD;AAPD,8DAOC;AAED,MAAa,+BAAgC,SAAQ,wBAAS;CAM7D;AAND,0EAMC"}
|