@segment/action-destinations 3.336.25-staging.0 → 3.337.2-staging.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/blackbaud-raisers-edge-nxt/utils/index.d.ts +1 -1
- package/dist/destinations/engage/sendgrid/Profile.d.ts +6 -0
- package/dist/destinations/engage/sendgrid/Profile.js +3 -0
- package/dist/destinations/engage/sendgrid/Profile.js.map +1 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +21 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +174 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -0
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js +27 -0
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js.map +1 -1
- package/dist/destinations/hubspot/utils.d.ts +10 -0
- package/dist/destinations/index.js +0 -1
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/klaviyo/index.js +1 -1
- package/dist/destinations/klaviyo/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/index.js +4 -1
- package/dist/destinations/linkedin-conversions/index.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/segment-profiles/generated-types.d.ts +0 -1
- package/dist/destinations/segment-profiles/index.js +0 -18
- package/dist/destinations/segment-profiles/index.js.map +1 -1
- package/dist/destinations/segment-profiles/sendGroup/index.js +5 -20
- package/dist/destinations/segment-profiles/sendGroup/index.js.map +1 -1
- package/dist/destinations/segment-profiles/sendIdentify/index.js +5 -20
- package/dist/destinations/segment-profiles/sendIdentify/index.js.map +1 -1
- package/dist/destinations/segment-profiles/sendSubscription/index.js +5 -21
- package/dist/destinations/segment-profiles/sendSubscription/index.js.map +1 -1
- package/dist/destinations/tiktok-offline-conversions/common_fields.d.ts +2 -0
- package/dist/destinations/tiktok-offline-conversions/common_fields.js +85 -0
- package/dist/destinations/tiktok-offline-conversions/common_fields.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions/formatter.d.ts +2 -0
- package/dist/destinations/tiktok-offline-conversions/formatter.js +33 -0
- package/dist/destinations/tiktok-offline-conversions/formatter.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/generated-types.d.ts +10 -0
- package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/generated-types.js.map +1 -0
- package/dist/destinations/{amazon-ads/syncAudiences → tiktok-offline-conversions/trackNonPaymentOfflineConversion}/index.d.ts +1 -1
- package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.js +41 -0
- package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/generated-types.d.ts +20 -0
- package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/generated-types.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.d.ts +5 -0
- package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.js +137 -0
- package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.js.map +1 -0
- package/package.json +2 -2
- package/dist/destinations/amazon-ads/generated-types.d.ts +0 -3
- package/dist/destinations/amazon-ads/generated-types.js.map +0 -1
- package/dist/destinations/amazon-ads/index.d.ts +0 -4
- package/dist/destinations/amazon-ads/index.js +0 -87
- package/dist/destinations/amazon-ads/index.js.map +0 -1
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +0 -2
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.js.map +0 -1
- package/dist/destinations/amazon-ads/syncAudiences/index.js +0 -15
- package/dist/destinations/amazon-ads/syncAudiences/index.js.map +0 -1
- package/dist/destinations/amazon-ads/types.d.ts +0 -22
- package/dist/destinations/amazon-ads/types.js +0 -11
- package/dist/destinations/amazon-ads/types.js.map +0 -1
- /package/dist/destinations/{amazon-ads → tiktok-offline-conversions/trackNonPaymentOfflineConversion}/generated-types.js +0 -0
- /package/dist/destinations/{amazon-ads/syncAudiences → tiktok-offline-conversions/trackPaymentOfflineConversion}/generated-types.js +0 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const segment_properties_1 = require("../segment-properties");
|
|
4
|
-
const helperFunctions_1 = require("../helperFunctions");
|
|
5
|
-
const properties_1 = require("../properties");
|
|
6
4
|
const errors_1 = require("../errors");
|
|
7
5
|
const action = {
|
|
8
6
|
title: 'Send Group',
|
|
@@ -16,7 +14,7 @@ const action = {
|
|
|
16
14
|
traits: segment_properties_1.traits,
|
|
17
15
|
timestamp: segment_properties_1.timestamp
|
|
18
16
|
},
|
|
19
|
-
perform: (
|
|
17
|
+
perform: (_request, { payload, statsContext }) => {
|
|
20
18
|
if (!payload.anonymous_id && !payload.user_id) {
|
|
21
19
|
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
22
20
|
}
|
|
@@ -30,24 +28,11 @@ const action = {
|
|
|
30
28
|
timestamp: payload?.timestamp,
|
|
31
29
|
integrations: {
|
|
32
30
|
All: false
|
|
33
|
-
}
|
|
31
|
+
},
|
|
32
|
+
type: 'group'
|
|
34
33
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
if (features && features['actions-segment-profiles-tapi-internal-enabled']) {
|
|
39
|
-
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, `action:sendGroup`]);
|
|
40
|
-
const payload = { ...groupPayload, type: 'group' };
|
|
41
|
-
return { batch: [payload] };
|
|
42
|
-
}
|
|
43
|
-
const selectedSegmentEndpoint = properties_1.SEGMENT_ENDPOINTS[settings.endpoint].url;
|
|
44
|
-
return request(`${selectedSegmentEndpoint}/group`, {
|
|
45
|
-
method: 'POST',
|
|
46
|
-
json: groupPayload,
|
|
47
|
-
headers: {
|
|
48
|
-
authorization: helperFunctions_1.generateSegmentAPIAuthHeaders(payload.engage_space)
|
|
49
|
-
}
|
|
50
|
-
});
|
|
34
|
+
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, `action:sendGroup`]);
|
|
35
|
+
return { batch: [groupPayload] };
|
|
51
36
|
}
|
|
52
37
|
};
|
|
53
38
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment-profiles/sendGroup/index.ts"],"names":[],"mappings":";;AAGA,8DAAwG;AACxG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment-profiles/sendGroup/index.ts"],"names":[],"mappings":";;AAGA,8DAAwG;AACxG,sCAAkE;AAElE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,wGAAwG;IACrH,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,YAAY,EAAZ,iCAAY;QACZ,OAAO,EAAP,4BAAO;QACP,YAAY,EAAZ,iCAAY;QACZ,QAAQ,EAAE,EAAE,GAAG,6BAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QACzC,MAAM,EAAN,2BAAM;QACN,SAAS,EAAT,8BAAS;KACV;IACD,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE;QAC/C,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YAC7C,MAAM,+CAAsC,CAAA;SAC7C;QACD,MAAM,YAAY,GAAW;YAC3B,MAAM,EAAE,OAAO,EAAE,OAAO;YACxB,WAAW,EAAE,OAAO,EAAE,YAAY;YAClC,OAAO,EAAE,OAAO,EAAE,QAAQ;YAC1B,MAAM,EAAE;gBACN,GAAG,OAAO,EAAE,MAAM;aACnB;YACD,SAAS,EAAE,OAAO,EAAE,SAAS;YAC7B,YAAY,EAAE;gBAGZ,GAAG,EAAE,KAAK;aACX;YACD,IAAI,EAAE,OAAO;SACd,CAAA;QAED,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAA;QAC/F,OAAO,EAAE,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,CAAA;IAClC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const segment_properties_1 = require("../segment-properties");
|
|
4
|
-
const helperFunctions_1 = require("../helperFunctions");
|
|
5
|
-
const properties_1 = require("../properties");
|
|
6
4
|
const errors_1 = require("../errors");
|
|
7
5
|
const action = {
|
|
8
6
|
title: 'Send Identify',
|
|
@@ -16,7 +14,7 @@ const action = {
|
|
|
16
14
|
traits: segment_properties_1.traits,
|
|
17
15
|
timestamp: segment_properties_1.timestamp
|
|
18
16
|
},
|
|
19
|
-
perform: (
|
|
17
|
+
perform: (_request, { payload, statsContext }) => {
|
|
20
18
|
if (!payload.anonymous_id && !payload.user_id) {
|
|
21
19
|
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
22
20
|
}
|
|
@@ -30,24 +28,11 @@ const action = {
|
|
|
30
28
|
timestamp: payload?.timestamp,
|
|
31
29
|
integrations: {
|
|
32
30
|
All: false
|
|
33
|
-
}
|
|
31
|
+
},
|
|
32
|
+
type: 'identify'
|
|
34
33
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
if (features && features['actions-segment-profiles-tapi-internal-enabled']) {
|
|
39
|
-
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, `action:sendIdentify`]);
|
|
40
|
-
const payload = { ...identityPayload, type: 'identify' };
|
|
41
|
-
return { batch: [payload] };
|
|
42
|
-
}
|
|
43
|
-
const selectedSegmentEndpoint = properties_1.SEGMENT_ENDPOINTS[settings.endpoint].url;
|
|
44
|
-
return request(`${selectedSegmentEndpoint}/identify`, {
|
|
45
|
-
method: 'POST',
|
|
46
|
-
json: identityPayload,
|
|
47
|
-
headers: {
|
|
48
|
-
authorization: helperFunctions_1.generateSegmentAPIAuthHeaders(payload.engage_space)
|
|
49
|
-
}
|
|
50
|
-
});
|
|
34
|
+
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, `action:sendIdentify`]);
|
|
35
|
+
return { batch: [identityPayload] };
|
|
51
36
|
}
|
|
52
37
|
};
|
|
53
38
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment-profiles/sendIdentify/index.ts"],"names":[],"mappings":";;AAGA,8DAAwG;AACxG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment-profiles/sendIdentify/index.ts"],"names":[],"mappings":";;AAGA,8DAAwG;AACxG,sCAAkE;AAElE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,gIAAgI;IAClI,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,YAAY,EAAZ,iCAAY;QACZ,OAAO,EAAP,4BAAO;QACP,YAAY,EAAZ,iCAAY;QACZ,QAAQ,EAAR,6BAAQ;QACR,MAAM,EAAN,2BAAM;QACN,SAAS,EAAT,8BAAS;KACV;IACD,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE;QAC/C,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YAC7C,MAAM,+CAAsC,CAAA;SAC7C;QACD,MAAM,eAAe,GAAW;YAC9B,MAAM,EAAE,OAAO,EAAE,OAAO;YACxB,WAAW,EAAE,OAAO,EAAE,YAAY;YAClC,OAAO,EAAE,OAAO,EAAE,QAAQ;YAC1B,MAAM,EAAE;gBACN,GAAG,OAAO,EAAE,MAAM;aACnB;YACD,SAAS,EAAE,OAAO,EAAE,SAAS;YAC7B,YAAY,EAAE;gBAGZ,GAAG,EAAE,KAAK;aACX;YACD,IAAI,EAAE,UAAU;SACjB,CAAA;QAED,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAA;QAClG,OAAO,EAAE,KAAK,EAAE,CAAC,eAAe,CAAC,EAAE,CAAA;IACrC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const subscription_properties_1 = require("./subscription-properties");
|
|
4
4
|
const errors_1 = require("../errors");
|
|
5
|
-
const helperFunctions_1 = require("../helperFunctions");
|
|
6
|
-
const properties_1 = require("../properties");
|
|
7
5
|
const segment_properties_1 = require("../segment-properties");
|
|
8
6
|
const subscriptionStatusConfig = [
|
|
9
7
|
{ status: 'SUBSCRIBED', matchingStatuses: ['true', 'subscribed'] },
|
|
@@ -180,14 +178,10 @@ const action = {
|
|
|
180
178
|
traits: subscription_properties_1.traits,
|
|
181
179
|
timestamp: segment_properties_1.timestamp
|
|
182
180
|
},
|
|
183
|
-
perform: (
|
|
181
|
+
perform: (_request, { payload, statsContext }) => {
|
|
184
182
|
const statsClient = statsContext?.statsClient;
|
|
185
183
|
const tags = statsContext?.tags;
|
|
186
184
|
tags?.push(`action:sendSubscription`);
|
|
187
|
-
if (!settings.endpoint || !(settings.endpoint in properties_1.SEGMENT_ENDPOINTS)) {
|
|
188
|
-
statsClient?.incr('invalid_endpoint', 1, tags);
|
|
189
|
-
throw errors_1.InvalidEndpointSelectedThrowableError;
|
|
190
|
-
}
|
|
191
185
|
validateSubscriptions(payload, statsClient, tags);
|
|
192
186
|
const externalIds = enrichExternalIds(payload, []);
|
|
193
187
|
const messagingSubscriptions = enrichMessagingSubscriptions(payload, []);
|
|
@@ -205,22 +199,12 @@ const action = {
|
|
|
205
199
|
timestamp: payload?.timestamp,
|
|
206
200
|
integrations: {
|
|
207
201
|
All: false
|
|
208
|
-
}
|
|
202
|
+
},
|
|
203
|
+
type: 'identify'
|
|
209
204
|
};
|
|
210
205
|
statsClient?.incr('success', 1, tags);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const payload = { ...subscriptionPayload, type: 'identify' };
|
|
214
|
-
return { batch: [payload] };
|
|
215
|
-
}
|
|
216
|
-
const selectedSegmentEndpoint = properties_1.SEGMENT_ENDPOINTS[settings.endpoint].url;
|
|
217
|
-
return request(`${selectedSegmentEndpoint}/identify`, {
|
|
218
|
-
method: 'POST',
|
|
219
|
-
json: subscriptionPayload,
|
|
220
|
-
headers: {
|
|
221
|
-
authorization: helperFunctions_1.generateSegmentAPIAuthHeaders(payload.engage_space)
|
|
222
|
-
}
|
|
223
|
-
});
|
|
206
|
+
statsClient?.incr('tapi_internal', 1, tags);
|
|
207
|
+
return { batch: [subscriptionPayload] };
|
|
224
208
|
}
|
|
225
209
|
};
|
|
226
210
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment-profiles/sendSubscription/index.ts"],"names":[],"mappings":";;AAGA,uEAekC;AAClC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment-profiles/sendSubscription/index.ts"],"names":[],"mappings":";;AAGA,uEAekC;AAClC,sCASkB;AAClB,8DAAiD;AAQjD,MAAM,wBAAwB,GAA+B;IAC3D,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC,MAAM,E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,eAAe,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;QAC3C,OAAO,EAAE,KAAK,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAA;IACzC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commonFields = void 0;
|
|
4
|
+
exports.commonFields = {
|
|
5
|
+
event: {
|
|
6
|
+
label: 'Event Name',
|
|
7
|
+
type: 'string',
|
|
8
|
+
required: true,
|
|
9
|
+
description: 'Conversion event name. Please refer to the "Supported Offline Events" section on in TikTok’s [Offline Events API documentation](https://ads.tiktok.com/marketing_api/docs?id=1758053486938113) for accepted event names.'
|
|
10
|
+
},
|
|
11
|
+
event_id: {
|
|
12
|
+
label: 'Event ID',
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'A unique value for each event. This ID can be used to match data between partner and TikTok. We suggest it is a String of 32 characters, including numeric digits (0-9), uppercase letters (A-Z), and lowercase letters (a-z).',
|
|
15
|
+
default: {
|
|
16
|
+
'@path': '$.messageId'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
timestamp: {
|
|
20
|
+
label: 'Event Timestamp',
|
|
21
|
+
type: 'string',
|
|
22
|
+
required: true,
|
|
23
|
+
description: 'Timestamp that the event took place, in ISO 8601 format. e.g. 2019-06-12T19:11:01.152Z',
|
|
24
|
+
default: {
|
|
25
|
+
'@path': '$.timestamp'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
phone_numbers: {
|
|
29
|
+
label: 'Phone Numbers',
|
|
30
|
+
description: 'A single phone number or array of phone numbers in E.164 standard format. Segment will hash this value before sending to TikTok. At least one phone number is required if no value is provided in the Emails field.',
|
|
31
|
+
type: 'string',
|
|
32
|
+
multiple: true,
|
|
33
|
+
default: {
|
|
34
|
+
'@if': {
|
|
35
|
+
exists: { '@path': '$.properties.phone' },
|
|
36
|
+
then: { '@path': '$.properties.phone' },
|
|
37
|
+
else: { '@path': '$.traits.phone' }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
email_addresses: {
|
|
42
|
+
label: 'Emails',
|
|
43
|
+
description: 'A single email address or an array of email addresses. Segment will hash this value before sending to TikTok. At least one email is required if no value is provided in the Phone Numbers field.',
|
|
44
|
+
type: 'string',
|
|
45
|
+
multiple: true,
|
|
46
|
+
default: {
|
|
47
|
+
'@if': {
|
|
48
|
+
exists: { '@path': '$.properties.email' },
|
|
49
|
+
then: { '@path': '$.properties.email' },
|
|
50
|
+
else: { '@path': '$.traits.email' }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
order_id: {
|
|
55
|
+
label: 'Order ID',
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'The order id',
|
|
58
|
+
default: {
|
|
59
|
+
'@path': '$.properties.order_id'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
shop_id: {
|
|
63
|
+
label: 'Shop ID',
|
|
64
|
+
type: 'string',
|
|
65
|
+
description: 'The shop id',
|
|
66
|
+
default: {
|
|
67
|
+
'@path': '$.properties.shop_id'
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
event_channel: {
|
|
71
|
+
label: 'Event channel',
|
|
72
|
+
type: 'string',
|
|
73
|
+
description: 'Event channel of the offline conversion event. Accepted values are: email, website, phone_call, in_store, crm, other. Any other value will be rejected',
|
|
74
|
+
choices: [
|
|
75
|
+
{ label: 'Email', value: 'email' },
|
|
76
|
+
{ label: 'Website', value: 'website' },
|
|
77
|
+
{ label: 'Phone call', value: 'phone_call' },
|
|
78
|
+
{ label: 'In store', value: 'in_store' },
|
|
79
|
+
{ label: 'CRM', value: 'crm' },
|
|
80
|
+
{ label: 'Other', value: 'other' }
|
|
81
|
+
],
|
|
82
|
+
default: 'in_store'
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=common_fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common_fields.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-offline-conversions/common_fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,YAAY,GAA+B;IACtD,KAAK,EAAE;QACL,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,0NAA0N;KAC7N;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,gOAAgO;QAClO,OAAO,EAAE;YACP,OAAO,EAAE,aAAa;SACvB;KACF;IACD,SAAS,EAAE;QACT,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,wFAAwF;QACrG,OAAO,EAAE;YACP,OAAO,EAAE,aAAa;SACvB;KACF;IACD,aAAa,EAAE;QACb,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,qNAAqN;QACvN,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,MAAM,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;gBACzC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;gBACvC,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;aACpC;SACF;KACF;IACD,eAAe,EAAE;QACf,KAAK,EAAE,QAAQ;QACf,WAAW,EACT,kMAAkM;QACpM,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,MAAM,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;gBACzC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;gBACvC,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;aACpC;SACF;KACF;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE;YACP,OAAO,EAAE,uBAAuB;SACjC;KACF;IACD,OAAO,EAAE;QACP,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,aAAa;QAC1B,OAAO,EAAE;YACP,OAAO,EAAE,sBAAsB;SAChC;KACF;IACD,aAAa,EAAE;QACb,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,wJAAwJ;QAC1J,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;YAClC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;YACtC,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;YAC5C,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;YACxC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;YAC9B,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;SACnC;QACD,OAAO,EAAE,UAAU;KACpB;CACF,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatPhones = exports.formatEmails = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const formatEmails = (email_addresses) => {
|
|
6
|
+
const result = [];
|
|
7
|
+
if (email_addresses) {
|
|
8
|
+
email_addresses.forEach((email) => {
|
|
9
|
+
result.push(hashAndEncode(email.toLowerCase()));
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
exports.formatEmails = formatEmails;
|
|
15
|
+
const formatPhones = (phone_numbers) => {
|
|
16
|
+
const result = [];
|
|
17
|
+
if (!phone_numbers)
|
|
18
|
+
return result;
|
|
19
|
+
phone_numbers.forEach((phone) => {
|
|
20
|
+
const validatedPhone = phone.match(/[0-9]{0,14}/g);
|
|
21
|
+
if (validatedPhone === null) {
|
|
22
|
+
throw new Error(`${phone} is not a valid E.164 phone number.`);
|
|
23
|
+
}
|
|
24
|
+
const formattedPhone = `+${phone.replace(/[^0-9]/g, '')}`;
|
|
25
|
+
result.push(hashAndEncode(formattedPhone.substring(0, 15)));
|
|
26
|
+
});
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
exports.formatPhones = formatPhones;
|
|
30
|
+
function hashAndEncode(property) {
|
|
31
|
+
return crypto_1.createHash('sha256').update(property).digest('hex');
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-offline-conversions/formatter.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAK5B,MAAM,YAAY,GAAG,CAAC,eAAqC,EAAY,EAAE;IAC9E,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,eAAe,EAAE;QACnB,eAAe,CAAC,OAAO,CAAC,CAAC,KAAa,EAAE,EAAE;YACxC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;QACjD,CAAC,CAAC,CAAA;KACH;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AARY,QAAA,YAAY,gBAQxB;AAOM,MAAM,YAAY,GAAG,CAAC,aAAmC,EAAY,EAAE;IAC5E,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,CAAC,aAAa;QAAE,OAAO,MAAM,CAAA;IAEjC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAa,EAAE,EAAE;QACtC,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QAClD,IAAI,cAAc,KAAK,IAAI,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,qCAAqC,CAAC,CAAA;SAC/D;QAED,MAAM,cAAc,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAA;QAEzD,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IAC7D,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAhBY,QAAA,YAAY,gBAgBxB;AAED,SAAS,aAAa,CAAC,QAAgB;IACrC,OAAO,mBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ActionDefinition } from '@segment/actions-core';
|
|
2
2
|
import type { Settings } from '../generated-types';
|
|
3
3
|
import type { Payload } from './generated-types';
|
|
4
4
|
declare const action: ActionDefinition<Settings, Payload>;
|
package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const common_fields_1 = require("../common_fields");
|
|
5
|
+
const formatter_1 = require("../formatter");
|
|
6
|
+
const action = {
|
|
7
|
+
title: 'Track Non Payment Offline Conversion',
|
|
8
|
+
description: 'Send a non payment related event to the TikTok Offline Conversions API',
|
|
9
|
+
fields: {
|
|
10
|
+
...common_fields_1.commonFields
|
|
11
|
+
},
|
|
12
|
+
perform: (request, { payload, settings }) => {
|
|
13
|
+
const phone_numbers = formatter_1.formatPhones(payload.phone_numbers);
|
|
14
|
+
const emails = formatter_1.formatEmails(payload.email_addresses);
|
|
15
|
+
if (phone_numbers.length < 1 && emails.length < 1)
|
|
16
|
+
throw new actions_core_1.PayloadValidationError('TikTok Offline Conversions API requires an email address and/or phone number');
|
|
17
|
+
return request('https://business-api.tiktok.com/open_api/v1.3/offline/track/', {
|
|
18
|
+
method: 'post',
|
|
19
|
+
json: {
|
|
20
|
+
event_set_id: settings.eventSetID,
|
|
21
|
+
event: payload.event,
|
|
22
|
+
event_id: payload.event_id ? `${payload.event_id}` : undefined,
|
|
23
|
+
timestamp: payload.timestamp,
|
|
24
|
+
context: {
|
|
25
|
+
user: {
|
|
26
|
+
phone_numbers,
|
|
27
|
+
emails
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
properties: {
|
|
31
|
+
order_id: payload.order_id,
|
|
32
|
+
shop_id: payload.shop_id,
|
|
33
|
+
event_channel: payload.event_channel
|
|
34
|
+
},
|
|
35
|
+
partner_name: 'Segment'
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.default = action;
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAGhF,oDAA+C;AAC/C,4CAAyD;AAEzD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,sCAAsC;IAC7C,WAAW,EAAE,wEAAwE;IACrF,MAAM,EAAE;QACN,GAAG,4BAAY;KAChB;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,MAAM,aAAa,GAAG,wBAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;QACzD,MAAM,MAAM,GAAG,wBAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;QAEpD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;YAC/C,MAAM,IAAI,qCAAsB,CAAC,8EAA8E,CAAC,CAAA;QAElH,OAAO,OAAO,CAAC,8DAA8D,EAAE;YAC7E,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,YAAY,EAAE,QAAQ,CAAC,UAAU;gBACjC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;gBAC9D,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,OAAO,EAAE;oBACP,IAAI,EAAE;wBACJ,aAAa;wBACb,MAAM;qBACP;iBACF;gBACD,UAAU,EAAE;oBACV,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,aAAa,EAAE,OAAO,CAAC,aAAa;iBACrC;gBACD,YAAY,EAAE,SAAS;aACxB;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
event: string;
|
|
3
|
+
event_id?: string;
|
|
4
|
+
timestamp?: string;
|
|
5
|
+
phone_numbers?: string[];
|
|
6
|
+
email_addresses?: string[];
|
|
7
|
+
order_id?: string;
|
|
8
|
+
shop_id?: string;
|
|
9
|
+
event_channel?: string;
|
|
10
|
+
contents?: {
|
|
11
|
+
price?: number;
|
|
12
|
+
quantity?: number;
|
|
13
|
+
content_type?: string;
|
|
14
|
+
content_id?: string;
|
|
15
|
+
content_name?: string;
|
|
16
|
+
content_category?: string;
|
|
17
|
+
}[];
|
|
18
|
+
currency: string;
|
|
19
|
+
value: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const common_fields_1 = require("../common_fields");
|
|
5
|
+
const formatter_1 = require("../formatter");
|
|
6
|
+
const action = {
|
|
7
|
+
title: 'Track Payment Offline Conversion',
|
|
8
|
+
description: 'Send details of an in-store purchase or console purchase to the Tiktok Offline Events API',
|
|
9
|
+
fields: {
|
|
10
|
+
...common_fields_1.commonFields,
|
|
11
|
+
timestamp: {
|
|
12
|
+
label: 'Event Timestamp',
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Timestamp that the event took place, in ISO 8601 format. e.g. 2019-06-12T19:11:01.152Z',
|
|
15
|
+
default: {
|
|
16
|
+
'@path': '$.timestamp'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
contents: {
|
|
20
|
+
label: 'Contents',
|
|
21
|
+
type: 'object',
|
|
22
|
+
multiple: true,
|
|
23
|
+
description: 'Array of product or content items for the offline event.',
|
|
24
|
+
properties: {
|
|
25
|
+
price: {
|
|
26
|
+
label: 'Price',
|
|
27
|
+
description: 'Price of the product or content item. Price is a required field for all content items.',
|
|
28
|
+
type: 'number'
|
|
29
|
+
},
|
|
30
|
+
quantity: {
|
|
31
|
+
label: 'Quantity',
|
|
32
|
+
description: 'Quantity of this product ot item in the offline event. Quantity is a required field for all content items.',
|
|
33
|
+
type: 'number'
|
|
34
|
+
},
|
|
35
|
+
content_type: {
|
|
36
|
+
label: 'Content Type',
|
|
37
|
+
description: 'Product type',
|
|
38
|
+
type: 'string'
|
|
39
|
+
},
|
|
40
|
+
content_id: {
|
|
41
|
+
label: 'Content ID',
|
|
42
|
+
description: 'Product or content item identifier. Content ID is a required field for all product or content items.',
|
|
43
|
+
type: 'string'
|
|
44
|
+
},
|
|
45
|
+
content_name: {
|
|
46
|
+
label: 'Content Name',
|
|
47
|
+
description: 'Name of the product or content item.',
|
|
48
|
+
type: 'string'
|
|
49
|
+
},
|
|
50
|
+
content_category: {
|
|
51
|
+
label: 'Content Category',
|
|
52
|
+
description: 'Category of the product or content item.',
|
|
53
|
+
type: 'string'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
default: {
|
|
57
|
+
'@arrayPath': [
|
|
58
|
+
'$.properties.products',
|
|
59
|
+
{
|
|
60
|
+
price: {
|
|
61
|
+
'@path': 'price'
|
|
62
|
+
},
|
|
63
|
+
quantity: {
|
|
64
|
+
'@path': 'quantity'
|
|
65
|
+
},
|
|
66
|
+
content_type: {
|
|
67
|
+
'@path': 'type'
|
|
68
|
+
},
|
|
69
|
+
content_id: {
|
|
70
|
+
'@path': 'product_id'
|
|
71
|
+
},
|
|
72
|
+
content_name: {
|
|
73
|
+
'@path': 'name'
|
|
74
|
+
},
|
|
75
|
+
content_category: {
|
|
76
|
+
'@path': 'category'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
currency: {
|
|
83
|
+
label: 'Currency',
|
|
84
|
+
type: 'string',
|
|
85
|
+
required: true,
|
|
86
|
+
description: 'ISO 4217 code. Required for revenue reporting. Example: "USD".List of currencies currently supported: AED, ARS, AUD, BDT, BHD, BIF, BOB, BRL, CAD, CHF, CLP, CNY, COP, CRC, CZK, DKK, DZD, EGP, EUR, GBP, GTQ, HKD, HNL, HUF, IDR, ILS, INR, ISK, JPY, KES, KHR, KRW, KWD, KZT, MAD, MOP, MXN, MYR, NGN, NIO, NOK, NZD, OMR, PEN, PHP, PHP, PKR, PLN, PYG, QAR, RON, RUB, SAR, SEK, SGD, THB, TRY, TWD, UAH, USD, VES, VND, ZAR.',
|
|
87
|
+
default: {
|
|
88
|
+
'@path': '$.properties.currency'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
value: {
|
|
92
|
+
label: 'Value',
|
|
93
|
+
type: 'number',
|
|
94
|
+
required: true,
|
|
95
|
+
description: 'Revenue of total products or content items. Required for revenue reporting. Must be a number. e.g. 101.99 and not "101.99 USD"',
|
|
96
|
+
default: {
|
|
97
|
+
'@if': {
|
|
98
|
+
exists: { '@path': '$.properties.value' },
|
|
99
|
+
then: { '@path': '$.properties.value' },
|
|
100
|
+
else: { '@path': '$.properties.revenue' }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
perform: (request, { payload, settings }) => {
|
|
106
|
+
const phone_numbers = formatter_1.formatPhones(payload.phone_numbers);
|
|
107
|
+
const emails = formatter_1.formatEmails(payload.email_addresses);
|
|
108
|
+
if (phone_numbers.length < 1 && emails.length < 1)
|
|
109
|
+
throw new actions_core_1.PayloadValidationError('TikTok Offline Conversions API requires an email address and/or phone number');
|
|
110
|
+
return request('https://business-api.tiktok.com/open_api/v1.3/offline/track/', {
|
|
111
|
+
method: 'post',
|
|
112
|
+
json: {
|
|
113
|
+
event_set_id: settings.eventSetID,
|
|
114
|
+
event: payload.event,
|
|
115
|
+
event_id: payload.event_id ? `${payload.event_id}` : undefined,
|
|
116
|
+
timestamp: payload.timestamp,
|
|
117
|
+
context: {
|
|
118
|
+
user: {
|
|
119
|
+
phone_numbers,
|
|
120
|
+
emails
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
properties: {
|
|
124
|
+
order_id: payload.order_id,
|
|
125
|
+
shop_id: payload.shop_id,
|
|
126
|
+
contents: payload.contents,
|
|
127
|
+
currency: payload.currency,
|
|
128
|
+
value: payload.value,
|
|
129
|
+
event_channel: payload.event_channel
|
|
130
|
+
},
|
|
131
|
+
partner_name: 'Segment'
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
exports.default = action;
|
|
137
|
+
//# sourceMappingURL=index.js.map
|
package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAGhF,oDAA+C;AAC/C,4CAAyD;AAEzD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kCAAkC;IACzC,WAAW,EAAE,2FAA2F;IACxG,MAAM,EAAE;QACN,GAAG,4BAAY;QACf,SAAS,EAAE;YACT,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wFAAwF;YACrG,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,0DAA0D;YACvE,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,KAAK,EAAE,OAAO;oBACd,WAAW,EAAE,wFAAwF;oBACrG,IAAI,EAAE,QAAQ;iBACf;gBACD,QAAQ,EAAE;oBACR,KAAK,EAAE,UAAU;oBACjB,WAAW,EACT,4GAA4G;oBAC9G,IAAI,EAAE,QAAQ;iBACf;gBACD,YAAY,EAAE;oBACZ,KAAK,EAAE,cAAc;oBACrB,WAAW,EAAE,cAAc;oBAC3B,IAAI,EAAE,QAAQ;iBACf;gBACD,UAAU,EAAE;oBACV,KAAK,EAAE,YAAY;oBACn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MAAM,aAAa,GAAG,wBAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;QACzD,MAAM,MAAM,GAAG,wBAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;QAEpD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;YAC/C,MAAM,IAAI,qCAAsB,CAAC,8EAA8E,CAAC,CAAA;QAElH,OAAO,OAAO,CAAC,8DAA8D,EAAE;YAC7E,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,YAAY,EAAE,QAAQ,CAAC,UAAU;gBACjC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;gBAC9D,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,OAAO,EAAE;oBACP,IAAI,EAAE;wBACJ,aAAa;wBACb,MAAM;qBACP;iBACF;gBACD,UAAU,EAAE;oBACV,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,aAAa,EAAE,OAAO,CAAC,aAAa;iBACrC;gBACD,YAAY,EAAE,SAAS;aACxB;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/action-destinations",
|
|
3
3
|
"description": "Destination Actions engine and definitions.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.337.2-staging.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@bufbuild/protobuf": "^1.4.2",
|
|
44
44
|
"@bufbuild/protoc-gen-es": "^1.4.2",
|
|
45
45
|
"@segment/a1-notation": "^2.1.4",
|
|
46
|
-
"@segment/actions-core": "3.90.
|
|
46
|
+
"@segment/actions-core": "3.90.0-staging.2",
|
|
47
47
|
"@segment/actions-shared": "^1.70.0",
|
|
48
48
|
"@types/node": "^18.11.15",
|
|
49
49
|
"ajv-formats": "^2.1.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/generated-types.ts"],"names":[],"mappings":""}
|