@segment/action-destinations 3.229.1-test-bk-59928928.45 → 3.229.1-test-action-cli.12
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 +3 -9
- package/dist/destinations/absmartly/event.js +9 -0
- package/dist/destinations/absmartly/event.js.map +1 -1
- package/dist/destinations/absmartly/exposure.d.ts +1 -1
- package/dist/destinations/absmartly/exposure.js +10 -26
- package/dist/destinations/absmartly/exposure.js.map +1 -1
- package/dist/destinations/absmartly/goal.d.ts +2 -1
- package/dist/destinations/absmartly/goal.js +18 -4
- package/dist/destinations/absmartly/goal.js.map +1 -1
- package/dist/destinations/absmartly/timestamp.d.ts +1 -1
- package/dist/destinations/absmartly/timestamp.js +0 -2
- package/dist/destinations/absmartly/timestamp.js.map +1 -1
- package/dist/destinations/absmartly/trackExposure/generated-types.d.ts +1 -0
- package/dist/destinations/absmartly/trackExposure/index.js +2 -7
- package/dist/destinations/absmartly/trackExposure/index.js.map +1 -1
- package/dist/destinations/absmartly/trackGoal/generated-types.d.ts +2 -0
- package/dist/destinations/absmartly/trackGoal/index.js +2 -7
- package/dist/destinations/absmartly/trackGoal/index.js.map +1 -1
- package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.d.ts +1 -1
- package/dist/destinations/devrev/createRevUser/index.js +1 -1
- package/dist/destinations/devrev/createRevUser/index.js.map +1 -1
- package/dist/destinations/devrev/mocks/index.d.ts +1 -1
- package/dist/destinations/devrev/mocks/index.js +1 -1
- package/dist/destinations/devrev/mocks/index.js.map +1 -1
- package/dist/destinations/display-video-360/addToAudience/generated-types.d.ts +0 -5
- package/dist/destinations/display-video-360/addToAudience/index.d.ts +2 -2
- package/dist/destinations/display-video-360/addToAudience/index.js +4 -19
- package/dist/destinations/display-video-360/addToAudience/index.js.map +1 -1
- package/dist/destinations/display-video-360/constants.d.ts +0 -2
- package/dist/destinations/display-video-360/constants.js +2 -4
- package/dist/destinations/display-video-360/constants.js.map +1 -1
- package/dist/destinations/display-video-360/generated-types.d.ts +1 -2
- package/dist/destinations/display-video-360/index.js +51 -57
- package/dist/destinations/display-video-360/index.js.map +1 -1
- package/dist/destinations/display-video-360/removeFromAudience/generated-types.d.ts +0 -5
- package/dist/destinations/display-video-360/removeFromAudience/index.d.ts +2 -2
- package/dist/destinations/display-video-360/removeFromAudience/index.js +3 -18
- package/dist/destinations/display-video-360/removeFromAudience/index.js.map +1 -1
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +3 -6
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +1 -1
- package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js +1 -1
- package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js.map +1 -1
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js +1 -3
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js.map +1 -1
- package/dist/destinations/engage/utils/track.d.ts +10 -10
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.js +1 -1
- package/dist/destinations/hyperengage/group/generated-types.d.ts +0 -1
- package/dist/destinations/hyperengage/group/index.js +2 -20
- package/dist/destinations/hyperengage/group/index.js.map +1 -1
- package/dist/destinations/hyperengage/identify/index.js +1 -7
- package/dist/destinations/hyperengage/identify/index.js.map +1 -1
- package/dist/destinations/hyperengage/track/generated-types.d.ts +1 -1
- package/dist/destinations/hyperengage/track/index.js +9 -9
- package/dist/destinations/hyperengage/track/index.js.map +1 -1
- package/dist/destinations/hyperengage/validateInput.js +2 -5
- package/dist/destinations/hyperengage/validateInput.js.map +1 -1
- package/dist/destinations/index.js +0 -1
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/insider/cartViewedEvent/generated-types.d.ts +0 -1
- package/dist/destinations/insider/cartViewedEvent/index.js +0 -1
- package/dist/destinations/insider/cartViewedEvent/index.js.map +1 -1
- package/dist/destinations/insider/checkoutEvent/generated-types.d.ts +0 -1
- package/dist/destinations/insider/checkoutEvent/index.js +0 -1
- package/dist/destinations/insider/checkoutEvent/index.js.map +1 -1
- package/dist/destinations/insider/insider-helpers.d.ts +0 -3
- package/dist/destinations/insider/insider-helpers.js +2 -7
- package/dist/destinations/insider/insider-helpers.js.map +1 -1
- package/dist/destinations/insider/insider-properties.d.ts +0 -1
- package/dist/destinations/insider/insider-properties.js +1 -7
- package/dist/destinations/insider/insider-properties.js.map +1 -1
- package/dist/destinations/insider/orderCompletedEvent/generated-types.d.ts +0 -1
- package/dist/destinations/insider/orderCompletedEvent/index.js +0 -1
- package/dist/destinations/insider/orderCompletedEvent/index.js.map +1 -1
- package/dist/destinations/insider/productAddedEvent/generated-types.d.ts +0 -1
- package/dist/destinations/insider/productAddedEvent/index.js +0 -1
- package/dist/destinations/insider/productAddedEvent/index.js.map +1 -1
- package/dist/destinations/insider/productListViewedEvent/generated-types.d.ts +0 -1
- package/dist/destinations/insider/productListViewedEvent/index.js +0 -1
- package/dist/destinations/insider/productListViewedEvent/index.js.map +1 -1
- package/dist/destinations/insider/productRemovedEvent/generated-types.d.ts +0 -1
- package/dist/destinations/insider/productRemovedEvent/index.js +0 -1
- package/dist/destinations/insider/productRemovedEvent/index.js.map +1 -1
- package/dist/destinations/insider/productViewedEvent/generated-types.d.ts +0 -1
- package/dist/destinations/insider/productViewedEvent/index.js +0 -1
- package/dist/destinations/insider/productViewedEvent/index.js.map +1 -1
- package/dist/destinations/insider/trackEvent/generated-types.d.ts +0 -1
- package/dist/destinations/insider/trackEvent/index.js +0 -1
- package/dist/destinations/insider/trackEvent/index.js.map +1 -1
- package/dist/destinations/insider/updateUserProfile/generated-types.d.ts +0 -1
- package/dist/destinations/insider/updateUserProfile/index.js +0 -2
- package/dist/destinations/insider/updateUserProfile/index.js.map +1 -1
- package/dist/destinations/insider/userRegisteredEvent/generated-types.d.ts +0 -1
- package/dist/destinations/insider/userRegisteredEvent/index.js +0 -1
- package/dist/destinations/insider/userRegisteredEvent/index.js.map +1 -1
- package/dist/destinations/insider-audiences/insider-helpers.js +0 -5
- package/dist/destinations/insider-audiences/insider-helpers.js.map +1 -1
- package/dist/destinations/insider-audiences/insiderAudiences/generated-types.d.ts +0 -1
- package/dist/destinations/insider-audiences/insiderAudiences/index.js +0 -6
- package/dist/destinations/insider-audiences/insiderAudiences/index.js.map +1 -1
- package/dist/destinations/klaviyo/addProfileToList/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/addProfileToList/index.js +8 -1
- package/dist/destinations/klaviyo/addProfileToList/index.js.map +1 -1
- package/dist/destinations/klaviyo/functions.d.ts +3 -19
- package/dist/destinations/klaviyo/functions.js +14 -107
- package/dist/destinations/klaviyo/functions.js.map +1 -1
- package/dist/destinations/klaviyo/index.d.ts +2 -2
- package/dist/destinations/klaviyo/index.js +7 -53
- package/dist/destinations/klaviyo/index.js.map +1 -1
- package/dist/destinations/klaviyo/properties.d.ts +1 -0
- package/dist/destinations/klaviyo/properties.js +7 -1
- package/dist/destinations/klaviyo/properties.js.map +1 -1
- package/dist/destinations/klaviyo/removeProfileFromList/generated-types.d.ts +1 -0
- package/dist/destinations/klaviyo/removeProfileFromList/index.js +14 -6
- package/dist/destinations/klaviyo/removeProfileFromList/index.js.map +1 -1
- package/dist/destinations/klaviyo/types.d.ts +0 -52
- package/dist/destinations/klaviyo/types.js.map +1 -1
- package/dist/destinations/klaviyo/upsertProfile/generated-types.d.ts +0 -1
- package/dist/destinations/klaviyo/upsertProfile/index.js +4 -29
- package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/updateAudience/index.js +9 -15
- package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/api/index.d.ts +2 -10
- package/dist/destinations/linkedin-conversions/api/index.js +1 -198
- package/dist/destinations/linkedin-conversions/api/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/constants.d.ts +0 -1
- package/dist/destinations/linkedin-conversions/constants.js +1 -7
- package/dist/destinations/linkedin-conversions/constants.js.map +1 -1
- package/dist/destinations/linkedin-conversions/index.js +1 -2
- package/dist/destinations/linkedin-conversions/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/streamConversion/generated-types.d.ts +0 -18
- package/dist/destinations/linkedin-conversions/streamConversion/index.js +51 -181
- package/dist/destinations/linkedin-conversions/streamConversion/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/types.d.ts +0 -64
- package/dist/destinations/liveramp-audiences/audienceEnteredS3/index.js +21 -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 +23 -2
- 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 +7 -1
- package/dist/destinations/liveramp-audiences/operations.js +71 -14
- package/dist/destinations/liveramp-audiences/operations.js.map +1 -1
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js +2 -8
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -1
- package/dist/destinations/tiktok-audiences/addToAudience/generated-types.d.ts +0 -2
- package/dist/destinations/tiktok-audiences/addToAudience/index.js +0 -2
- package/dist/destinations/tiktok-audiences/addToAudience/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/addUser/generated-types.d.ts +0 -2
- package/dist/destinations/tiktok-audiences/addUser/index.js +0 -2
- package/dist/destinations/tiktok-audiences/addUser/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/functions.js +2 -17
- package/dist/destinations/tiktok-audiences/functions.js.map +1 -1
- package/dist/destinations/tiktok-audiences/properties.d.ts +0 -2
- package/dist/destinations/tiktok-audiences/properties.js +7 -28
- package/dist/destinations/tiktok-audiences/properties.js.map +1 -1
- package/dist/destinations/tiktok-audiences/removeFromAudience/generated-types.d.ts +0 -2
- package/dist/destinations/tiktok-audiences/removeFromAudience/index.js +0 -2
- package/dist/destinations/tiktok-audiences/removeFromAudience/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/removeUser/generated-types.d.ts +0 -2
- package/dist/destinations/tiktok-audiences/removeUser/index.js +0 -2
- package/dist/destinations/tiktok-audiences/removeUser/index.js.map +1 -1
- package/dist/destinations/usermaven/request-params.js +3 -8
- package/dist/destinations/usermaven/request-params.js.map +1 -1
- package/dist/destinations/yahoo-audiences/generated-types.d.ts +2 -1
- package/dist/destinations/yahoo-audiences/index.js +21 -17
- package/dist/destinations/yahoo-audiences/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/updateSegment/generated-types.d.ts +1 -1
- package/dist/destinations/yahoo-audiences/updateSegment/index.js +23 -23
- package/dist/destinations/yahoo-audiences/updateSegment/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/utils-rt.js +5 -15
- package/dist/destinations/yahoo-audiences/utils-rt.js.map +1 -1
- package/dist/destinations/yahoo-audiences/utils-tax.js +2 -2
- package/dist/destinations/yahoo-audiences/utils-tax.js.map +1 -1
- package/package.json +4 -7
|
@@ -15,11 +15,6 @@ 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
|
-
},
|
|
23
18
|
phone_number: {
|
|
24
19
|
label: 'Phone Number',
|
|
25
20
|
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,12 +126,12 @@ const action = {
|
|
|
131
126
|
}
|
|
132
127
|
},
|
|
133
128
|
dynamicFields: {
|
|
134
|
-
list_id: async (request) => {
|
|
135
|
-
return functions_1.getListIdDynamicData(request);
|
|
129
|
+
list_id: async (request, { settings }) => {
|
|
130
|
+
return functions_1.getListIdDynamicData(request, settings);
|
|
136
131
|
}
|
|
137
132
|
},
|
|
138
133
|
perform: async (request, { payload }) => {
|
|
139
|
-
const { email, external_id, phone_number, list_id,
|
|
134
|
+
const { email, external_id, phone_number, list_id, ...otherAttributes } = payload;
|
|
140
135
|
if (!email && !phone_number && !external_id) {
|
|
141
136
|
throw new actions_core_1.PayloadValidationError('One of External ID, Phone Number and Email is required.');
|
|
142
137
|
}
|
|
@@ -180,28 +175,8 @@ const action = {
|
|
|
180
175
|
return profile;
|
|
181
176
|
}
|
|
182
177
|
}
|
|
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);
|
|
178
|
+
throw new actions_core_1.APIError('An error occurred while processing the request', 400);
|
|
196
179
|
}
|
|
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
|
-
};
|
|
205
180
|
}
|
|
206
181
|
};
|
|
207
182
|
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":["../../../../src/destinations/klaviyo/upsertProfile/index.ts"],"names":[],"mappings":";;AAIA,sCAAmC;AACnC,wDAAwE;AAExE,4CAAqE;AAErE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,sBAAsB;IACnC,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,kFAAkF;YAC/F,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;SACvC;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,mKAAmK;YAChL,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;SAC/C;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,+JAA+J;YAC5K,IAAI,EAAE,QAAQ;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;SAC3C;QACD,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;SAC1C;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,uFAAuF;YACpG,IAAI,EAAE,QAAQ;YACd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 'AUTO'
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
-
perform: async (request, { settings, payload
|
|
80
|
-
return processPayload(request, settings, [payload]
|
|
79
|
+
perform: async (request, { settings, payload }) => {
|
|
80
|
+
return processPayload(request, settings, [payload]);
|
|
81
81
|
},
|
|
82
|
-
performBatch: async (request, { settings, payload
|
|
83
|
-
return processPayload(request, settings, payload
|
|
82
|
+
performBatch: async (request, { settings, payload }) => {
|
|
83
|
+
return processPayload(request, settings, payload);
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
async function processPayload(request, settings, payloads
|
|
86
|
+
async function processPayload(request, settings, payloads) {
|
|
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]);
|
|
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
|
-
]);
|
|
98
94
|
const res = await linkedinApiClient.batchUpdate(dmpSegmentId, elements);
|
|
99
95
|
if (res.status !== 200) {
|
|
100
96
|
throw new actions_core_1.RetryableError('Error while attempting to update LinkedIn DMP Segment. This batch will be retried.');
|
|
@@ -110,17 +106,15 @@ function validate(settings, payloads) {
|
|
|
110
106
|
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);
|
|
111
107
|
}
|
|
112
108
|
}
|
|
113
|
-
async function getDmpSegmentId(linkedinApiClient, settings, payload
|
|
114
|
-
statsContext?.statsClient?.incr('oauth_app_api_call', 1, [...statsContext?.tags, `endpoint:get-dmpSegment`]);
|
|
109
|
+
async function getDmpSegmentId(linkedinApiClient, settings, payload) {
|
|
115
110
|
const res = await linkedinApiClient.getDmpSegment(settings, payload);
|
|
116
111
|
const body = await res.json();
|
|
117
112
|
if (body.elements?.length > 0) {
|
|
118
113
|
return body.elements[0].id;
|
|
119
114
|
}
|
|
120
|
-
return createDmpSegment(linkedinApiClient, settings, payload
|
|
115
|
+
return createDmpSegment(linkedinApiClient, settings, payload);
|
|
121
116
|
}
|
|
122
|
-
async function createDmpSegment(linkedinApiClient, settings, payload
|
|
123
|
-
statsContext?.statsClient?.incr('oauth_app_api_call', 1, [...statsContext?.tags, `endpoint:create-dmpSegment`]);
|
|
117
|
+
async function createDmpSegment(linkedinApiClient, settings, payload) {
|
|
124
118
|
const res = await linkedinApiClient.createDmpSegment(settings, payload);
|
|
125
119
|
const headers = res.headers.toJSON();
|
|
126
120
|
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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/updateAudience/index.ts"],"names":[],"mappings":";;AACA,wDA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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,IAAI,QAAQ,CAAC,0BAA0B,KAAK,IAAI,EAAE;QACjF,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"}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import type { RequestClient, ModifiedResponse
|
|
1
|
+
import type { RequestClient, ModifiedResponse } from '@segment/actions-core';
|
|
2
2
|
import type { ProfileAPIResponse } from '../types';
|
|
3
|
-
import type { Payload, HookBundle } from '../streamConversion/generated-types';
|
|
4
3
|
export declare class LinkedInConversions {
|
|
5
4
|
request: RequestClient;
|
|
6
|
-
|
|
7
|
-
constructor(request: RequestClient, conversionRuleId?: string);
|
|
5
|
+
constructor(request: RequestClient);
|
|
8
6
|
getProfile(): Promise<ModifiedResponse<ProfileAPIResponse>>;
|
|
9
|
-
createConversionRule: (payload: Payload, hookInputs: HookBundle['onMappingSave']['inputs']) => Promise<ActionHookResponse<HookBundle['onMappingSave']['outputs']>>;
|
|
10
|
-
getAdAccounts: () => Promise<DynamicFieldResponse>;
|
|
11
|
-
getConversionRulesList: (adAccountId: string) => Promise<DynamicFieldResponse>;
|
|
12
|
-
getCampaignsList: (adAccountUrn: string) => Promise<DynamicFieldResponse>;
|
|
13
|
-
streamConversionEvent(payload: Payload, conversionTime: number): Promise<ModifiedResponse>;
|
|
14
|
-
associateCampignToConversion(payload: Payload): Promise<ModifiedResponse>;
|
|
15
7
|
}
|
|
@@ -3,211 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LinkedInConversions = void 0;
|
|
4
4
|
const constants_1 = require("../constants");
|
|
5
5
|
class LinkedInConversions {
|
|
6
|
-
constructor(request
|
|
7
|
-
this.createConversionRule = async (payload, hookInputs) => {
|
|
8
|
-
if (hookInputs?.conversionRuleId) {
|
|
9
|
-
try {
|
|
10
|
-
const { data } = await this.request(`${constants_1.BASE_URL}/conversions/${this.conversionRuleId}`, {
|
|
11
|
-
method: 'get',
|
|
12
|
-
searchParams: {
|
|
13
|
-
account: payload?.adAccountId
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return {
|
|
17
|
-
successMessage: `Using existing Conversion Rule: ${hookInputs.conversionRuleId} `,
|
|
18
|
-
savedData: {
|
|
19
|
-
id: hookInputs.conversionRuleId,
|
|
20
|
-
name: data.name || `No name returned for rule: ${hookInputs.conversionRuleId}`,
|
|
21
|
-
conversionType: data.type || `No type returned for rule: ${hookInputs.conversionRuleId}`
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
return {
|
|
27
|
-
error: {
|
|
28
|
-
message: `Failed to verify conversion rule: ${e?.message ?? JSON.stringify(e)}`,
|
|
29
|
-
code: 'CONVERSION_RULE_VERIFICATION_FAILURE'
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
const { data } = await this.request(`${constants_1.BASE_URL}/conversions`, {
|
|
36
|
-
method: 'post',
|
|
37
|
-
json: {
|
|
38
|
-
name: hookInputs?.name,
|
|
39
|
-
account: payload?.adAccountId,
|
|
40
|
-
conversionMethod: 'CONVERSIONS_API',
|
|
41
|
-
postClickAttributionWindowSize: 30,
|
|
42
|
-
viewThroughAttributionWindowSize: 7,
|
|
43
|
-
attributionType: hookInputs?.attribution_type,
|
|
44
|
-
type: hookInputs?.conversionType
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return {
|
|
48
|
-
successMessage: `Conversion rule ${data.id} created successfully!`,
|
|
49
|
-
savedData: {
|
|
50
|
-
id: data.id,
|
|
51
|
-
name: data.name,
|
|
52
|
-
conversionType: data.type
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
return {
|
|
58
|
-
error: {
|
|
59
|
-
message: `Failed to create conversion rule: ${e?.message ?? JSON.stringify(e)}`,
|
|
60
|
-
code: 'CONVERSION_RULE_CREATION_FAILURE'
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
this.getAdAccounts = async () => {
|
|
66
|
-
try {
|
|
67
|
-
const response = [];
|
|
68
|
-
const result = await this.request(`${constants_1.BASE_URL}/adAccountUsers`, {
|
|
69
|
-
method: 'GET',
|
|
70
|
-
searchParams: {
|
|
71
|
-
q: 'authenticatedUser'
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
result.data.elements.forEach((item) => {
|
|
75
|
-
response.push(item);
|
|
76
|
-
});
|
|
77
|
-
const choices = response?.map((item) => {
|
|
78
|
-
return {
|
|
79
|
-
label: item.user,
|
|
80
|
-
value: item.account
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
return {
|
|
84
|
-
choices
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
catch (err) {
|
|
88
|
-
return {
|
|
89
|
-
choices: [],
|
|
90
|
-
error: {
|
|
91
|
-
message: err.response?.data?.message ?? 'An error occurred while fetching ad accounts.',
|
|
92
|
-
code: err.response?.data?.code?.toString() ?? 'FETCH_AD_ACCOUNTS_ERROR'
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
this.getConversionRulesList = async (adAccountId) => {
|
|
98
|
-
if (!adAccountId || !adAccountId.length) {
|
|
99
|
-
return {
|
|
100
|
-
choices: [],
|
|
101
|
-
error: {
|
|
102
|
-
message: 'Please select Ad Account first to get list of Conversion Rules.',
|
|
103
|
-
code: 'FIELD_NOT_SELECTED'
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
try {
|
|
108
|
-
const response = [];
|
|
109
|
-
const result = await this.request(`${constants_1.BASE_URL}/conversions`, {
|
|
110
|
-
method: 'GET',
|
|
111
|
-
searchParams: {
|
|
112
|
-
q: 'account',
|
|
113
|
-
account: adAccountId
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
result.data.elements.forEach((item) => {
|
|
117
|
-
response.push(item);
|
|
118
|
-
});
|
|
119
|
-
const choices = response?.map((item) => {
|
|
120
|
-
return {
|
|
121
|
-
label: item.name,
|
|
122
|
-
value: item.id
|
|
123
|
-
};
|
|
124
|
-
});
|
|
125
|
-
return {
|
|
126
|
-
choices
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
catch (err) {
|
|
130
|
-
return {
|
|
131
|
-
choices: [],
|
|
132
|
-
error: {
|
|
133
|
-
message: err.response?.data?.message ?? 'An error occurred while fetching conversion rules.',
|
|
134
|
-
code: err.response?.data?.code?.toString() ?? 'FETCH_CONVERSIONS_ERROR'
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
this.getCampaignsList = async (adAccountUrn) => {
|
|
140
|
-
const parts = adAccountUrn.split(':');
|
|
141
|
-
const adAccountId = parts.pop();
|
|
142
|
-
if (!adAccountId || !adAccountId.length) {
|
|
143
|
-
return {
|
|
144
|
-
choices: [],
|
|
145
|
-
error: {
|
|
146
|
-
message: 'Please select Ad Account first to get list of Conversion Rules.',
|
|
147
|
-
code: 'FIELD_NOT_SELECTED'
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
try {
|
|
152
|
-
const response = [];
|
|
153
|
-
const result = await this.request(`${constants_1.BASE_URL}/adAccounts/${adAccountId}/adCampaigns?q=search&search=(status:(values:List(ACTIVE)))`, {
|
|
154
|
-
method: 'GET'
|
|
155
|
-
});
|
|
156
|
-
result.data.elements.forEach((item) => {
|
|
157
|
-
response.push(item);
|
|
158
|
-
});
|
|
159
|
-
const choices = response?.map((item) => {
|
|
160
|
-
return {
|
|
161
|
-
label: item.name,
|
|
162
|
-
value: item.id
|
|
163
|
-
};
|
|
164
|
-
});
|
|
165
|
-
return {
|
|
166
|
-
choices
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
catch (err) {
|
|
170
|
-
return {
|
|
171
|
-
choices: [],
|
|
172
|
-
error: {
|
|
173
|
-
message: err.response?.data?.message ?? 'An error occurred while fetching conversion rules.',
|
|
174
|
-
code: err.response?.data?.code?.toString() ?? 'FETCH_CONVERSIONS_ERROR'
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
};
|
|
6
|
+
constructor(request) {
|
|
179
7
|
this.request = request;
|
|
180
|
-
this.conversionRuleId = conversionRuleId;
|
|
181
8
|
}
|
|
182
9
|
async getProfile() {
|
|
183
10
|
return this.request(`${constants_1.BASE_URL}/me`, {
|
|
184
11
|
method: 'GET'
|
|
185
12
|
});
|
|
186
13
|
}
|
|
187
|
-
async streamConversionEvent(payload, conversionTime) {
|
|
188
|
-
return this.request(`${constants_1.BASE_URL}/conversionEvents`, {
|
|
189
|
-
method: 'POST',
|
|
190
|
-
json: {
|
|
191
|
-
conversion: `urn:lla:llaPartnerConversion:${this.conversionRuleId}`,
|
|
192
|
-
conversionHappenedAt: conversionTime,
|
|
193
|
-
conversionValue: payload.conversionValue,
|
|
194
|
-
eventId: payload.eventId,
|
|
195
|
-
user: {
|
|
196
|
-
userIds: payload.userIds,
|
|
197
|
-
userInfo: payload.userInfo
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
async associateCampignToConversion(payload) {
|
|
203
|
-
return this.request(`${constants_1.BASE_URL}/campaignConversions/(campaign:urn%3Ali%3AsponsoredCampaign%3A${payload.campaignId},conversion:urn%3Alla%3AllaPartnerConversion%3A${this.conversionRuleId})`, {
|
|
204
|
-
method: 'PUT',
|
|
205
|
-
body: JSON.stringify({
|
|
206
|
-
campaign: `urn:li:sponsoredCampaign:${payload.campaignId}`,
|
|
207
|
-
conversion: `urn:lla:llaPartnerConversion:${this.conversionRuleId}`
|
|
208
|
-
})
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
14
|
}
|
|
212
15
|
exports.LinkedInConversions = LinkedInConversions;
|
|
213
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-conversions/api/index.ts"],"names":[],"mappings":";;;AACA,4CAAuC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-conversions/api/index.ts"],"names":[],"mappings":";;;AACA,4CAAuC;AAGvC,MAAa,mBAAmB;IAG9B,YAAY,OAAsB;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,oBAAQ,KAAK,EAAE;YACpC,MAAM,EAAE,KAAK;SACd,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,kDAYC"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LINKEDIN_SOURCE_PLATFORM = exports.BASE_URL = exports.LINKEDIN_API_VERSION = void 0;
|
|
4
4
|
exports.LINKEDIN_API_VERSION = '202309';
|
|
5
5
|
exports.BASE_URL = 'https://api.linkedin.com/rest';
|
|
6
6
|
exports.LINKEDIN_SOURCE_PLATFORM = 'SEGMENT';
|
|
7
|
-
exports.SUPPORTED_ID_TYPE = [
|
|
8
|
-
'SHA256_EMAIL',
|
|
9
|
-
'LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID',
|
|
10
|
-
'ACXIOM_ID',
|
|
11
|
-
'ORACLE_MOAT_ID'
|
|
12
|
-
];
|
|
13
7
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-conversions/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,QAAQ,CAAA;AAC/B,QAAA,QAAQ,GAAG,+BAA+B,CAAA;AAC1C,QAAA,wBAAwB,GAAG,SAAS,CAAA
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-conversions/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,QAAQ,CAAA;AAC/B,QAAA,QAAQ,GAAG,+BAA+B,CAAA;AAC1C,QAAA,wBAAwB,GAAG,SAAS,CAAA"}
|
|
@@ -57,8 +57,7 @@ const destination = {
|
|
|
57
57
|
return {
|
|
58
58
|
headers: {
|
|
59
59
|
authorization: `Bearer ${auth?.accessToken}`,
|
|
60
|
-
'LinkedIn-Version': constants_1.LINKEDIN_API_VERSION
|
|
61
|
-
'X-Restli-Protocol-Version': `2.0.0`
|
|
60
|
+
'LinkedIn-Version': constants_1.LINKEDIN_API_VERSION
|
|
62
61
|
}
|
|
63
62
|
};
|
|
64
63
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-conversions/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAgG;AAEhG,+BAA2C;AAE3C,2CAAkD;AAElD,0EAAiD;AAEjD,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,EAAE;QACV,kBAAkB,EAAE,KAAK,EAAE,O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AAC,oBAAoB,EAC/B,GAAG,CACJ,CAAA;aACF;YAED,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA;QACjD,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;gBAC5C,kBAAkB,EAAE,gCAAoB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-conversions/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAgG;AAEhG,+BAA2C;AAE3C,2CAAkD;AAElD,0EAAiD;AAEjD,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,EAAE;QACV,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAC9C,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE;gBACtB,MAAM,IAAI,yCAA0B,CAAC,gEAAgE,CAAC,CAAA;aACvG;YAED,MAAM,iBAAiB,GAAwB,IAAI,yBAAmB,CAAC,OAAO,CAAC,CAAA;YAE/E,IAAI;gBAGF,OAAO,MAAM,iBAAiB,CAAC,UAAU,EAAE,CAAA;aAC5C;YAAC,OAAO,CAAM,EAAE;gBACf,MAAM,KAAK,GAAG,CAAoC,CAAA;gBAClD,IAAI,KAAK,CAAC,OAAO,KAAK,cAAc,EAAE;oBACpC,MAAM,IAAI,KAAK,CACb,8HAA8H,CAC/H,CAAA;iBACF;gBACD,MAAM,CAAC,CAAA;aACR;QACH,CAAC;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAC9C,IAAI,GAAG,CAAA;YAEP,IAAI;gBACF,GAAG,GAAG,MAAM,OAAO,CAAuB,+CAA+C,EAAE;oBACzF,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,IAAI,eAAe,CAAC;wBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;wBAChC,SAAS,EAAE,IAAI,CAAC,QAAQ;wBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;wBAChC,UAAU,EAAE,eAAe;qBAC5B,CAAC;iBACH,CAAC,CAAA;aACH;YAAC,OAAO,CAAM,EAAE;gBACf,MAAM,KAAK,GAAG,CAA8B,CAAA;gBAC5C,IAAI,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,KAAK,eAAe,EAAE;oBACnD,MAAM,IAAI,+BAAgB,CACxB,wHAAwH,EACxH,yBAAU,CAAC,qBAAqB,EAChC,GAAG,CACJ,CAAA;iBACF;gBAED,MAAM,IAAI,+BAAgB,CACxB,+CAA+C,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAC5E,yBAAU,CAAC,oBAAoB,EAC/B,GAAG,CACJ,CAAA;aACF;YAED,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA;QACjD,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;gBAC5C,kBAAkB,EAAE,gCAAoB;aACzC;SACF,CAAA;IACH,CAAC;IACD,OAAO,EAAE;QACP,gBAAgB,EAAhB,0BAAgB;KACjB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
export interface Payload {
|
|
2
2
|
adAccountId: string;
|
|
3
|
-
conversionHappenedAt: string;
|
|
4
|
-
conversionValue?: {
|
|
5
|
-
currencyCode: string;
|
|
6
|
-
amount: string;
|
|
7
|
-
};
|
|
8
|
-
eventId?: string;
|
|
9
|
-
userIds?: {
|
|
10
|
-
idType: string;
|
|
11
|
-
idValue: string;
|
|
12
|
-
}[];
|
|
13
|
-
userInfo?: {
|
|
14
|
-
firstName?: string;
|
|
15
|
-
lastName?: string;
|
|
16
|
-
companyName?: string;
|
|
17
|
-
title?: string;
|
|
18
|
-
countryCode?: string;
|
|
19
|
-
};
|
|
20
|
-
campaignId: string;
|
|
21
3
|
}
|
|
22
4
|
export interface HookBundle {
|
|
23
5
|
onMappingSave: {
|