@segment/action-destinations 3.494.1-staging-f466f04ea.0 → 3.496.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/braze/ecommerce/constants.d.ts +0 -1
- package/dist/destinations/braze/ecommerce/constants.js +0 -1
- package/dist/destinations/braze/ecommerce/constants.js.map +1 -1
- package/dist/destinations/braze/ecommerce/fields.d.ts +0 -6
- package/dist/destinations/braze/ecommerce/fields.js +2 -173
- package/dist/destinations/braze/ecommerce/fields.js.map +1 -1
- package/dist/destinations/braze/ecommerce/functions.js +8 -35
- package/dist/destinations/braze/ecommerce/functions.js.map +1 -1
- package/dist/destinations/braze/ecommerce/generated-types.d.ts +0 -4
- package/dist/destinations/braze/ecommerce/types.d.ts +3 -25
- package/dist/destinations/braze/ecommerceSingleProduct/generated-types.d.ts +0 -5
- package/dist/destinations/braze/ecommerceSingleProduct/index.js +0 -1
- package/dist/destinations/braze/ecommerceSingleProduct/index.js.map +1 -1
- package/dist/destinations/braze/index.js +2 -48
- package/dist/destinations/braze/index.js.map +1 -1
- package/dist/destinations/braze/userAlias.d.ts +2 -1
- package/dist/destinations/customerio/createUpdateObject/index.js +11 -33
- package/dist/destinations/customerio/createUpdateObject/index.js.map +1 -1
- package/dist/destinations/customerio/utils.d.ts +1 -4
- package/dist/destinations/customerio/utils.js +7 -52
- package/dist/destinations/customerio/utils.js.map +1 -1
- package/dist/destinations/display-video-360/index.js +0 -7
- package/dist/destinations/display-video-360/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/addToCart/generated-types.d.ts +0 -1
- package/dist/destinations/facebook-conversions-api/addToCart2/generated-types.d.ts +0 -1
- package/dist/destinations/facebook-conversions-api/custom/generated-types.d.ts +0 -9
- package/dist/destinations/facebook-conversions-api/custom2/generated-types.d.ts +0 -9
- package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.d.ts +0 -1
- package/dist/destinations/facebook-conversions-api/initiateCheckout2/generated-types.d.ts +0 -1
- package/dist/destinations/facebook-conversions-api/pageView/generated-types.d.ts +0 -1
- package/dist/destinations/facebook-conversions-api/pageView2/generated-types.d.ts +0 -1
- package/dist/destinations/facebook-conversions-api/purchase/generated-types.d.ts +0 -11
- package/dist/destinations/facebook-conversions-api/purchase2/generated-types.d.ts +0 -11
- package/dist/destinations/facebook-conversions-api/search/generated-types.d.ts +0 -1
- package/dist/destinations/facebook-conversions-api/search2/generated-types.d.ts +0 -1
- package/dist/destinations/facebook-conversions-api/shared/constants.d.ts +0 -1
- package/dist/destinations/facebook-conversions-api/shared/constants.js +1 -2
- package/dist/destinations/facebook-conversions-api/shared/constants.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/shared/fields.d.ts +0 -3
- package/dist/destinations/facebook-conversions-api/shared/fields.js +2 -109
- package/dist/destinations/facebook-conversions-api/shared/fields.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/shared/functions.d.ts +4 -5
- package/dist/destinations/facebook-conversions-api/shared/functions.js +16 -90
- package/dist/destinations/facebook-conversions-api/shared/functions.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/shared/types.d.ts +1 -23
- package/dist/destinations/facebook-conversions-api/viewContent/generated-types.d.ts +0 -1
- package/dist/destinations/facebook-conversions-api/viewContent2/generated-types.d.ts +0 -1
- package/dist/destinations/facebook-custom-audiences/presets.js +0 -7
- package/dist/destinations/facebook-custom-audiences/presets.js.map +1 -1
- package/dist/destinations/first-party-dv360/properties.js +6 -30
- package/dist/destinations/first-party-dv360/properties.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +7 -12
- package/dist/destinations/google-enhanced-conversions/functions.js +103 -163
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/index.js +20 -22
- package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/types.d.ts +0 -20
- package/dist/destinations/google-enhanced-conversions/userList/index.js +24 -20
- package/dist/destinations/google-enhanced-conversions/userList/index.js.map +1 -1
- package/dist/destinations/hubspot/index.js +2 -3
- package/dist/destinations/hubspot/index.js.map +1 -1
- package/dist/destinations/hubspot/versioning-info.d.ts +0 -1
- package/dist/destinations/hubspot/versioning-info.js +1 -2
- package/dist/destinations/hubspot/versioning-info.js.map +1 -1
- package/dist/destinations/iterable/index.js +1 -3
- package/dist/destinations/iterable/index.js.map +1 -1
- package/dist/destinations/iterable/updateUser/generated-types.d.ts +0 -1
- package/dist/destinations/iterable/updateUser/index.js +5 -35
- package/dist/destinations/iterable/updateUser/index.js.map +1 -1
- package/dist/destinations/iterable/utils.d.ts +0 -5
- package/dist/destinations/iterable/utils.js +1 -9
- package/dist/destinations/iterable/utils.js.map +1 -1
- package/dist/destinations/linkedin-conversions/api/index.js +2 -14
- package/dist/destinations/linkedin-conversions/api/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/streamConversion/generated-types.d.ts +0 -2
- package/dist/destinations/linkedin-conversions/streamConversion/index.js +6 -19
- package/dist/destinations/linkedin-conversions/streamConversion/index.js.map +1 -1
- package/dist/destinations/mixpanel/__test__/multistatus.test.js +1 -0
- package/dist/destinations/mixpanel/__test__/multistatus.test.js.map +1 -1
- package/dist/destinations/mixpanel/generated-types.d.ts +1 -0
- package/dist/destinations/mixpanel/incrementProperties/__test__/index.test.js +6 -0
- package/dist/destinations/mixpanel/incrementProperties/__test__/index.test.js.map +1 -1
- package/dist/destinations/mixpanel/index.js +7 -0
- package/dist/destinations/mixpanel/index.js.map +1 -1
- package/dist/destinations/mixpanel/trackEvent/index.js +1 -1
- package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
- package/dist/destinations/mixpanel/trackPurchase/index.js +1 -1
- package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -1
- package/dist/destinations/ms-bing-ads-audiences/index.js +5 -19
- package/dist/destinations/ms-bing-ads-audiences/index.js.map +1 -1
- package/dist/destinations/ms-bing-ads-audiences/syncAudiences/index.js +5 -68
- package/dist/destinations/ms-bing-ads-audiences/syncAudiences/index.js.map +1 -1
- package/dist/destinations/ms-bing-ads-audiences/utils.d.ts +0 -2
- package/dist/destinations/ms-bing-ads-audiences/utils.js +1 -43
- package/dist/destinations/ms-bing-ads-audiences/utils.js.map +1 -1
- package/dist/destinations/pinterest-conversions/constants.d.ts +0 -13
- package/dist/destinations/pinterest-conversions/constants.js +1 -14
- package/dist/destinations/pinterest-conversions/constants.js.map +1 -1
- package/dist/destinations/pinterest-conversions/index.js +8 -88
- package/dist/destinations/pinterest-conversions/index.js.map +1 -1
- package/dist/destinations/pinterest-conversions/pinterest-capi-custom-data.d.ts +2 -4
- package/dist/destinations/pinterest-conversions/pinterest-capi-custom-data.js +8 -185
- package/dist/destinations/pinterest-conversions/pinterest-capi-custom-data.js.map +1 -1
- package/dist/destinations/pinterest-conversions/reportConversionEvent/generated-types.d.ts +1 -70
- package/dist/destinations/pinterest-conversions/reportConversionEvent/index.js +42 -354
- package/dist/destinations/pinterest-conversions/reportConversionEvent/index.js.map +1 -1
- package/dist/destinations/pinterest-conversions/types.d.ts +0 -117
- package/dist/destinations/reddit-conversions-api/customEvent/generated-types.d.ts +0 -5
- package/dist/destinations/reddit-conversions-api/customEvent/index.js +5 -8
- package/dist/destinations/reddit-conversions-api/customEvent/index.js.map +1 -1
- package/dist/destinations/reddit-conversions-api/fields.d.ts +0 -3
- package/dist/destinations/reddit-conversions-api/fields.js +2 -42
- package/dist/destinations/reddit-conversions-api/fields.js.map +1 -1
- package/dist/destinations/reddit-conversions-api/index.js.map +1 -1
- package/dist/destinations/reddit-conversions-api/standardEvent/generated-types.d.ts +0 -5
- package/dist/destinations/reddit-conversions-api/standardEvent/index.js +5 -8
- package/dist/destinations/reddit-conversions-api/standardEvent/index.js.map +1 -1
- package/dist/destinations/reddit-conversions-api/types.d.ts +0 -50
- package/dist/destinations/reddit-conversions-api/utils.d.ts +2 -6
- package/dist/destinations/reddit-conversions-api/utils.js +137 -12
- package/dist/destinations/reddit-conversions-api/utils.js.map +1 -1
- package/dist/destinations/reddit-conversions-api/versioning-info.d.ts +0 -1
- package/dist/destinations/reddit-conversions-api/versioning-info.js +1 -2
- package/dist/destinations/reddit-conversions-api/versioning-info.js.map +1 -1
- package/dist/destinations/rokt-capi/send/functions.js +16 -37
- package/dist/destinations/rokt-capi/send/functions.js.map +1 -1
- package/dist/destinations/s3/syncToS3/fields.js +0 -28
- package/dist/destinations/s3/syncToS3/fields.js.map +1 -1
- package/dist/destinations/s3/syncToS3/functions.d.ts +3 -5
- package/dist/destinations/s3/syncToS3/functions.js +9 -47
- package/dist/destinations/s3/syncToS3/functions.js.map +1 -1
- package/dist/destinations/s3/syncToS3/generated-types.d.ts +0 -4
- package/dist/destinations/s3/syncToS3/index.js +4 -4
- package/dist/destinations/s3/syncToS3/index.js.map +1 -1
- package/dist/destinations/s3/syncToS3/types.d.ts +0 -2
- package/dist/destinations/salesforce-marketing-cloud/_tests_/getCategoryList.test.js +0 -88
- package/dist/destinations/salesforce-marketing-cloud/_tests_/getCategoryList.test.js.map +1 -1
- package/dist/destinations/salesforce-marketing-cloud/asyncDataExtension/generated-types.d.ts +0 -1
- package/dist/destinations/salesforce-marketing-cloud/asyncDataExtension/index.js +52 -4
- package/dist/destinations/salesforce-marketing-cloud/asyncDataExtension/index.js.map +1 -1
- package/dist/destinations/salesforce-marketing-cloud/index.js +2 -6
- package/dist/destinations/salesforce-marketing-cloud/index.js.map +1 -1
- package/dist/destinations/salesforce-marketing-cloud/sfmc-operations.d.ts +3 -13
- package/dist/destinations/salesforce-marketing-cloud/sfmc-operations.js +6 -11
- package/dist/destinations/salesforce-marketing-cloud/sfmc-operations.js.map +1 -1
- package/dist/destinations/salesforce-marketing-cloud/sfmc-properties.js +2 -2
- package/dist/destinations/salesforce-marketing-cloud/sfmc-properties.js.map +1 -1
- package/dist/destinations/salesforce-marketing-cloud/versioning-info.d.ts +0 -1
- package/dist/destinations/salesforce-marketing-cloud/versioning-info.js +1 -2
- package/dist/destinations/salesforce-marketing-cloud/versioning-info.js.map +1 -1
- package/dist/destinations/tiktok-audiences/index.js +0 -7
- package/dist/destinations/tiktok-audiences/index.js.map +1 -1
- package/dist/destinations/webhook/send/index.js +0 -7
- package/dist/destinations/webhook/send/index.js.map +1 -1
- package/dist/destinations/webhook-extensible/send/index.js +0 -7
- package/dist/destinations/webhook-extensible/send/index.js.map +1 -1
- package/package.json +5 -5
- package/dist/destinations/braze/mergeUsers/functions.d.ts +0 -12
- package/dist/destinations/braze/mergeUsers/functions.js +0 -142
- package/dist/destinations/braze/mergeUsers/functions.js.map +0 -1
- package/dist/destinations/braze/mergeUsers/generated-types.d.ts +0 -17
- package/dist/destinations/braze/mergeUsers/generated-types.js +0 -3
- package/dist/destinations/braze/mergeUsers/generated-types.js.map +0 -1
- package/dist/destinations/braze/mergeUsers/index.d.ts +0 -5
- package/dist/destinations/braze/mergeUsers/index.js +0 -216
- package/dist/destinations/braze/mergeUsers/index.js.map +0 -1
- package/dist/destinations/braze/mergeUsers/types.d.ts +0 -27
- package/dist/destinations/braze/mergeUsers/types.js +0 -3
- package/dist/destinations/braze/mergeUsers/types.js.map +0 -1
- package/dist/destinations/customerio/types.d.ts +0 -9
- package/dist/destinations/customerio/types.js +0 -3
- package/dist/destinations/customerio/types.js.map +0 -1
- package/dist/destinations/iterable/updateSubscriptions/constants.d.ts +0 -3
- package/dist/destinations/iterable/updateSubscriptions/constants.js +0 -7
- package/dist/destinations/iterable/updateSubscriptions/constants.js.map +0 -1
- package/dist/destinations/iterable/updateSubscriptions/dynamic-fields.d.ts +0 -9
- package/dist/destinations/iterable/updateSubscriptions/dynamic-fields.js +0 -60
- package/dist/destinations/iterable/updateSubscriptions/dynamic-fields.js.map +0 -1
- package/dist/destinations/iterable/updateSubscriptions/functions.d.ts +0 -9
- package/dist/destinations/iterable/updateSubscriptions/functions.js +0 -168
- package/dist/destinations/iterable/updateSubscriptions/functions.js.map +0 -1
- package/dist/destinations/iterable/updateSubscriptions/generated-types.d.ts +0 -15
- package/dist/destinations/iterable/updateSubscriptions/generated-types.js +0 -3
- package/dist/destinations/iterable/updateSubscriptions/generated-types.js.map +0 -1
- package/dist/destinations/iterable/updateSubscriptions/index.d.ts +0 -5
- package/dist/destinations/iterable/updateSubscriptions/index.js +0 -129
- package/dist/destinations/iterable/updateSubscriptions/index.js.map +0 -1
- package/dist/destinations/iterable/updateSubscriptions/types.d.ts +0 -39
- package/dist/destinations/iterable/updateSubscriptions/types.js +0 -3
- package/dist/destinations/iterable/updateSubscriptions/types.js.map +0 -1
- package/dist/destinations/reddit-conversions-api/shared.d.ts +0 -20
- package/dist/destinations/reddit-conversions-api/shared.js +0 -66
- package/dist/destinations/reddit-conversions-api/shared.js.map +0 -1
- package/dist/destinations/reddit-conversions-api/v2.d.ts +0 -5
- package/dist/destinations/reddit-conversions-api/v2.js +0 -87
- package/dist/destinations/reddit-conversions-api/v2.js.map +0 -1
- package/dist/destinations/reddit-conversions-api/v3.d.ts +0 -6
- package/dist/destinations/reddit-conversions-api/v3.js +0 -118
- package/dist/destinations/reddit-conversions-api/v3.js.map +0 -1
- package/dist/destinations/s3/constants.d.ts +0 -1
- package/dist/destinations/s3/constants.js +0 -5
- package/dist/destinations/s3/constants.js.map +0 -1
- package/dist/destinations/salesforce-marketing-cloud/_tests_/asyncDataExtension.async.test.d.ts +0 -1
- package/dist/destinations/salesforce-marketing-cloud/_tests_/asyncDataExtension.async.test.js +0 -656
- package/dist/destinations/salesforce-marketing-cloud/_tests_/asyncDataExtension.async.test.js.map +0 -1
- package/dist/destinations/salesforce-marketing-cloud/asyncDataExtension/fields.d.ts +0 -140
- package/dist/destinations/salesforce-marketing-cloud/asyncDataExtension/fields.js +0 -69
- package/dist/destinations/salesforce-marketing-cloud/asyncDataExtension/fields.js.map +0 -1
- package/dist/destinations/salesforce-marketing-cloud/asyncDataExtension/index.async.d.ts +0 -5
- package/dist/destinations/salesforce-marketing-cloud/asyncDataExtension/index.async.js +0 -145
- package/dist/destinations/salesforce-marketing-cloud/asyncDataExtension/index.async.js.map +0 -1
- package/dist/destinations/webhook/ssrf-utils.d.ts +0 -1
- package/dist/destinations/webhook/ssrf-utils.js +0 -74
- package/dist/destinations/webhook/ssrf-utils.js.map +0 -1
- package/dist/destinations/webhook-extensible/ssrf-utils.d.ts +0 -1
- package/dist/destinations/webhook-extensible/ssrf-utils.js +0 -74
- package/dist/destinations/webhook-extensible/ssrf-utils.js.map +0 -1
|
@@ -34,13 +34,6 @@ exports.presets = [
|
|
|
34
34
|
mapping: (0, actions_core_1.defaultValues)(sync_1.default.fields),
|
|
35
35
|
type: 'specificEvent',
|
|
36
36
|
eventSlug: 'journeys_step_entered_track'
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'Journey Step All Events',
|
|
40
|
-
partnerAction: 'sync',
|
|
41
|
-
mapping: (0, actions_core_1.defaultValues)(sync_1.default.fields),
|
|
42
|
-
type: 'specificEvent',
|
|
43
|
-
eventSlug: 'journey_step_all_events_track'
|
|
44
37
|
}
|
|
45
38
|
];
|
|
46
39
|
//# sourceMappingURL=presets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../../src/destinations/facebook-custom-audiences/presets.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAqD;AAErD,kDAAyB;AAEZ,QAAA,OAAO,GAAa;IAC/B;QACE,IAAI,EAAE,sCAAsC;QAC5C,aAAa,EAAE,MAAM;QACrB,OAAO,EAAE,IAAA,4BAAa,EAAC,cAAI,CAAC,MAAM,CAAC;QACnC,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,gDAAgD;KAC5D;IACD;QACE,IAAI,EAAE,yBAAyB;QAC/B,aAAa,EAAE,MAAM;QACrB,OAAO,EAAE,IAAA,4BAAa,EAAC,cAAI,CAAC,MAAM,CAAC;QACnC,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,8BAA8B;KAC1C;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,aAAa,EAAE,MAAM;QACrB,OAAO,EAAE,IAAA,4BAAa,EAAC,cAAI,CAAC,MAAM,CAAC;QACnC,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,gCAAgC;KAC5C;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,aAAa,EAAE,MAAM;QACrB,OAAO,EAAE,IAAA,4BAAa,EAAC,cAAI,CAAC,MAAM,CAAC;QACnC,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,6BAA6B;KACzC;
|
|
1
|
+
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../../src/destinations/facebook-custom-audiences/presets.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAqD;AAErD,kDAAyB;AAEZ,QAAA,OAAO,GAAa;IAC/B;QACE,IAAI,EAAE,sCAAsC;QAC5C,aAAa,EAAE,MAAM;QACrB,OAAO,EAAE,IAAA,4BAAa,EAAC,cAAI,CAAC,MAAM,CAAC;QACnC,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,gDAAgD;KAC5D;IACD;QACE,IAAI,EAAE,yBAAyB;QAC/B,aAAa,EAAE,MAAM;QACrB,OAAO,EAAE,IAAA,4BAAa,EAAC,cAAI,CAAC,MAAM,CAAC;QACnC,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,8BAA8B;KAC1C;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,aAAa,EAAE,MAAM;QACrB,OAAO,EAAE,IAAA,4BAAa,EAAC,cAAI,CAAC,MAAM,CAAC;QACnC,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,gCAAgC;KAC5C;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,aAAa,EAAE,MAAM;QACrB,OAAO,EAAE,IAAA,4BAAa,EAAC,cAAI,CAAC,MAAM,CAAC;QACnC,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,6BAA6B;KACzC;CACF,CAAA"}
|
|
@@ -24,11 +24,7 @@ exports.emails = {
|
|
|
24
24
|
description: `A list of the user's emails. If not already hashed, the system will hash them before use.`,
|
|
25
25
|
type: 'string',
|
|
26
26
|
default: {
|
|
27
|
-
'@
|
|
28
|
-
exists: { '@path': '$.context.traits.email' },
|
|
29
|
-
then: { '@path': '$.context.traits.email' },
|
|
30
|
-
else: { '@path': '$.traits.email' }
|
|
31
|
-
}
|
|
27
|
+
'@path': '$.context.traits.emails'
|
|
32
28
|
},
|
|
33
29
|
category: 'hashedPII'
|
|
34
30
|
};
|
|
@@ -37,11 +33,7 @@ exports.phoneNumbers = {
|
|
|
37
33
|
description: `A list of the user's phone numbers. If not already hashed, the system will hash them before use.`,
|
|
38
34
|
type: 'string',
|
|
39
35
|
default: {
|
|
40
|
-
'@
|
|
41
|
-
exists: { '@path': '$.traits.phone' },
|
|
42
|
-
then: { '@path': '$.traits.phone' },
|
|
43
|
-
else: { '@path': '$.properties.phone' }
|
|
44
|
-
}
|
|
36
|
+
'@path': '$.context.traits.phoneNumbers'
|
|
45
37
|
},
|
|
46
38
|
category: 'hashedPII'
|
|
47
39
|
};
|
|
@@ -50,11 +42,7 @@ exports.zipCodes = {
|
|
|
50
42
|
description: `A list of the user's zip codes.`,
|
|
51
43
|
type: 'string',
|
|
52
44
|
default: {
|
|
53
|
-
'@
|
|
54
|
-
exists: { '@path': '$.traits.zipCodes' },
|
|
55
|
-
then: { '@path': '$.traits.zipCodes' },
|
|
56
|
-
else: { '@path': '$.properties.zipCodes' }
|
|
57
|
-
}
|
|
45
|
+
'@path': '$.context.traits.zipCodes'
|
|
58
46
|
}
|
|
59
47
|
};
|
|
60
48
|
exports.firstName = {
|
|
@@ -62,11 +50,7 @@ exports.firstName = {
|
|
|
62
50
|
description: `The user's first name. If not already hashed, the system will hash it before use.`,
|
|
63
51
|
type: 'string',
|
|
64
52
|
default: {
|
|
65
|
-
'@
|
|
66
|
-
exists: { '@path': '$.traits.firstName' },
|
|
67
|
-
then: { '@path': '$.traits.firstName' },
|
|
68
|
-
else: { '@path': '$.properties.firstName' }
|
|
69
|
-
}
|
|
53
|
+
'@path': '$.context.traits.firstName'
|
|
70
54
|
},
|
|
71
55
|
category: 'hashedPII'
|
|
72
56
|
};
|
|
@@ -75,11 +59,7 @@ exports.lastName = {
|
|
|
75
59
|
description: `The user's last name. If not already hashed, the system will hash it before use.`,
|
|
76
60
|
type: 'string',
|
|
77
61
|
default: {
|
|
78
|
-
'@
|
|
79
|
-
exists: { '@path': '$.traits.lastName' },
|
|
80
|
-
then: { '@path': '$.traits.lastName' },
|
|
81
|
-
else: { '@path': '$.properties.lastName' }
|
|
82
|
-
}
|
|
62
|
+
'@path': '$.context.traits.lastName'
|
|
83
63
|
},
|
|
84
64
|
category: 'hashedPII'
|
|
85
65
|
};
|
|
@@ -88,11 +68,7 @@ exports.countryCode = {
|
|
|
88
68
|
description: `The country code of the user.`,
|
|
89
69
|
type: 'string',
|
|
90
70
|
default: {
|
|
91
|
-
'@
|
|
92
|
-
exists: { '@path': '$.traits.countryCode' },
|
|
93
|
-
then: { '@path': '$.traits.countryCode' },
|
|
94
|
-
else: { '@path': '$.properties.countryCode' }
|
|
95
|
-
}
|
|
71
|
+
'@path': '$.context.traits..countryCode'
|
|
96
72
|
}
|
|
97
73
|
};
|
|
98
74
|
exports.mobileDeviceIds = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/first-party-dv360/properties.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAe;IACrC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,+BAA+B;IAC5C,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,yCAAyC;KACnD;IACD,aAAa,EAAE,IAAI;CACpB,CAAA;AAEY,QAAA,aAAa,GAAe;IACvC,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,uDAAuD;IACpE,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,mDAAmD;KAC7D;IACD,aAAa,EAAE,IAAI;CACpB,CAAA;AAEY,QAAA,MAAM,GAAe;IAChC,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,2FAA2F;IACxG,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/first-party-dv360/properties.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAe;IACrC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,+BAA+B;IAC5C,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,yCAAyC;KACnD;IACD,aAAa,EAAE,IAAI;CACpB,CAAA;AAEY,QAAA,aAAa,GAAe;IACvC,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,uDAAuD;IACpE,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,mDAAmD;KAC7D;IACD,aAAa,EAAE,IAAI;CACpB,CAAA;AAEY,QAAA,MAAM,GAAe;IAChC,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,2FAA2F;IACxG,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,yBAAyB;KACnC;IACD,QAAQ,EAAE,WAAW;CACtB,CAAA;AAEY,QAAA,YAAY,GAAe;IACtC,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,kGAAkG;IAC/G,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,+BAA+B;KACzC;IACD,QAAQ,EAAE,WAAW;CACtB,CAAA;AAEY,QAAA,QAAQ,GAAe;IAClC,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,iCAAiC;IAC9C,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,2BAA2B;KACrC;CACF,CAAA;AAEY,QAAA,SAAS,GAAe;IACnC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,mFAAmF;IAChG,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,4BAA4B;KACtC;IACD,QAAQ,EAAE,WAAW;CACtB,CAAA;AAEY,QAAA,QAAQ,GAAe;IAClC,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,kFAAkF;IAC/F,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,2BAA2B;KACrC;IACD,QAAQ,EAAE,WAAW;CACtB,CAAA;AAEY,QAAA,WAAW,GAAe;IACrC,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,+BAA+B;IAC5C,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,+BAA+B;KACzC;CACF,CAAA;AAEY,QAAA,eAAe,GAAe;IACzC,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,oIAAoI;IACjJ,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,kCAAkC;KAC5C;CACF,CAAA;AAEY,QAAA,eAAe,GAAe;IACzC,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,8BAA8B;IAC3C,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;CACf,CAAA;AAGY,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,qFAAqF;IAClG,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;CACf,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ConversionCustomVariable, PartialErrorResponse, QueryResponse, CustomVariableInterface, CreateAudienceInput, UserListResponse, KeyValuePairList
|
|
2
|
-
import { ModifiedResponse, RequestClient, DynamicFieldResponse, Features, MultiStatusResponse
|
|
3
|
-
import { StatsContext
|
|
1
|
+
import { ConversionCustomVariable, PartialErrorResponse, QueryResponse, CustomVariableInterface, CreateAudienceInput, UserListResponse, KeyValuePairList } from './types';
|
|
2
|
+
import { ModifiedResponse, RequestClient, DynamicFieldResponse, Features, MultiStatusResponse } from '@segment/actions-core';
|
|
3
|
+
import { StatsContext } from '@segment/actions-core/destination-kit';
|
|
4
4
|
import { HTTPError } from '@segment/actions-core';
|
|
5
5
|
import type { Payload as UserListPayload } from './userList/generated-types';
|
|
6
6
|
import type { Payload as ClickConversionPayload } from './uploadClickConversion/generated-types';
|
|
@@ -38,11 +38,6 @@ export declare class GoogleAdsError extends HTTPError {
|
|
|
38
38
|
}
|
|
39
39
|
export declare function formatCustomVariables(customVariables: object, customVariableIdsResults: Array<ConversionCustomVariable>): CustomVariableInterface[];
|
|
40
40
|
export declare const hash: (value: string | undefined) => string | undefined;
|
|
41
|
-
export declare const DATA_MANAGER_BASE_URL = "https://datamanager.googleapis.com/v1";
|
|
42
|
-
export declare function exchangeForAccessToken(request: RequestClient, refreshToken: string): Promise<string>;
|
|
43
|
-
export declare function createDataManagerPartnerLink(request: RequestClient, customerId: string, customerAccessToken: string, loginCustomerId?: string): Promise<PartnerLinkResponse>;
|
|
44
|
-
export declare function createDataManagerUserList(request: RequestClient, customerId: string, listName: string, uploadKeyType: string, segmentAccessToken: string, appId?: string): Promise<DataManagerUserList>;
|
|
45
|
-
export declare function getDataManagerUserList(request: RequestClient, customerId: string, userListId: string, segmentAccessToken: string): Promise<DataManagerUserList>;
|
|
46
41
|
export declare function getCustomVariables(customerId: string, auth: any, request: RequestClient, features: Features | undefined, statsContext: StatsContext | undefined): Promise<ModifiedResponse<QueryResponse[]>>;
|
|
47
42
|
export declare function memoizedGetCustomVariables(): (customerId: string, auth: any, request: RequestClient, features: Features | undefined, statsContext: StatsContext | undefined) => Promise<ModifiedResponse<QueryResponse[]> | undefined>;
|
|
48
43
|
export declare function getConversionActionId(customerId: string | undefined, auth: any, request: RequestClient, features: Features | undefined, statsContext: StatsContext | undefined): Promise<ModifiedResponse<QueryResponse[]>>;
|
|
@@ -68,12 +63,12 @@ export declare function getListIds(request: RequestClient, settings: CreateAudie
|
|
|
68
63
|
code: string;
|
|
69
64
|
};
|
|
70
65
|
}>;
|
|
71
|
-
export declare function createGoogleAudience(request: RequestClient, input: CreateAudienceInput,
|
|
72
|
-
export declare function getGoogleAudience(request: RequestClient, settings: CreateAudienceInput['settings'], externalId: string,
|
|
66
|
+
export declare function createGoogleAudience(request: RequestClient, input: CreateAudienceInput, auth: CreateAudienceInput['settings']['oauth'], features?: Features | undefined, statsContext?: StatsContext): Promise<string>;
|
|
67
|
+
export declare function getGoogleAudience(request: RequestClient, settings: CreateAudienceInput['settings'], externalId: string, auth: CreateAudienceInput['settings']['oauth'], features?: Features | undefined, statsContext?: StatsContext): Promise<UserListResponse>;
|
|
73
68
|
export declare function formatToE164(phoneNumber: string, countryCode: string): string;
|
|
74
69
|
export declare const formatPhone: (phone: string, countryCode?: string, features?: Features, statsContext?: StatsContext) => string;
|
|
75
70
|
export declare const validateAndFormatToE164: (phoneNumber: string, countryCode?: string, statsContext?: StatsContext) => string;
|
|
76
|
-
export declare const handleUpdate: (request: RequestClient, settings: CreateAudienceInput["settings"], audienceSettings: CreateAudienceInput["audienceSettings"], payloads: UserListPayload[], hookListId: string, hookListType: string, syncMode?: string, features?: Features | undefined, statsContext?: StatsContext
|
|
71
|
+
export declare const handleUpdate: (request: RequestClient, settings: CreateAudienceInput["settings"], audienceSettings: CreateAudienceInput["audienceSettings"], payloads: UserListPayload[], hookListId: string, hookListType: string, syncMode?: string, features?: Features | undefined, statsContext?: StatsContext) => Promise<unknown>;
|
|
77
72
|
export declare const verifyCustomerId: (customerId: string | undefined) => string;
|
|
78
73
|
export declare const handlePartialFailureResponse: (partialFailureError: any, validPayloadIndicesBitmap: number[], multiStatusResponse: MultiStatusResponse, userIdentifiers: any[], failedPayloadIndices: Set<number>) => void;
|
|
79
74
|
export declare const createIdentifierExtractors: (features?: Features) => {
|
|
@@ -102,7 +97,7 @@ export declare const createIdentifierExtractors: (features?: Features) => {
|
|
|
102
97
|
hashedPhoneNumber?: undefined;
|
|
103
98
|
})[] | null;
|
|
104
99
|
};
|
|
105
|
-
export declare const processBatchPayload: (request: RequestClient, settings: CreateAudienceInput["settings"], audienceSettings: CreateAudienceInput["audienceSettings"], payloads: UserListPayload[], hookListId: string, hookListType: string, syncMode?: string, features?: Features | undefined, statsContext?: StatsContext
|
|
100
|
+
export declare const processBatchPayload: (request: RequestClient, settings: CreateAudienceInput["settings"], audienceSettings: CreateAudienceInput["audienceSettings"], payloads: UserListPayload[], hookListId: string, hookListType: string, syncMode?: string, features?: Features | undefined, statsContext?: StatsContext) => Promise<MultiStatusResponse>;
|
|
106
101
|
export declare const handleJobExecutionError: (executedJob: any, validPayloadIndicesBitmap: number[], multiStatusResponse: MultiStatusResponse, sentBody: string, failedPayloadIndices: Set<number>) => void;
|
|
107
102
|
export declare function getSessionAttributesKeyValuePairs(payload: ClickConversionPayload | ClickConversionPayload2): {
|
|
108
103
|
sessionAttributesKeyValuePairs: {
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleJobExecutionError = exports.processBatchPayload = exports.createIdentifierExtractors = exports.handlePartialFailureResponse = exports.verifyCustomerId = exports.handleUpdate = exports.validateAndFormatToE164 = exports.formatPhone = exports.commonEmailValidation = exports.isHashedInformation = exports.
|
|
3
|
+
exports.handleJobExecutionError = exports.processBatchPayload = exports.createIdentifierExtractors = exports.handlePartialFailureResponse = exports.verifyCustomerId = exports.handleUpdate = exports.validateAndFormatToE164 = exports.formatPhone = exports.commonEmailValidation = exports.isHashedInformation = exports.hash = exports.GoogleAdsError = exports.FLAGON_NAME_PHONE_VALIDATION_CHECK = exports.FLAGON_NAME = exports.CANARY_API_VERSION = exports.API_VERSION = void 0;
|
|
4
4
|
exports.formatCustomVariables = formatCustomVariables;
|
|
5
|
-
exports.exchangeForAccessToken = exchangeForAccessToken;
|
|
6
|
-
exports.createDataManagerPartnerLink = createDataManagerPartnerLink;
|
|
7
|
-
exports.createDataManagerUserList = createDataManagerUserList;
|
|
8
|
-
exports.getDataManagerUserList = getDataManagerUserList;
|
|
9
5
|
exports.getCustomVariables = getCustomVariables;
|
|
10
6
|
exports.memoizedGetCustomVariables = memoizedGetCustomVariables;
|
|
11
7
|
exports.getConversionActionId = getConversionActionId;
|
|
@@ -62,76 +58,6 @@ const hash = (value) => {
|
|
|
62
58
|
return hash.digest('hex');
|
|
63
59
|
};
|
|
64
60
|
exports.hash = hash;
|
|
65
|
-
exports.DATA_MANAGER_BASE_URL = 'https://datamanager.googleapis.com/v1';
|
|
66
|
-
const UPLOAD_KEY_TYPE_MAP = {
|
|
67
|
-
CONTACT_INFO: 'CONTACT_ID',
|
|
68
|
-
CRM_ID: 'USER_ID',
|
|
69
|
-
MOBILE_ADVERTISING_ID: 'MOBILE_ID'
|
|
70
|
-
};
|
|
71
|
-
async function exchangeForAccessToken(request, refreshToken) {
|
|
72
|
-
if (!process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_ID || !process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_SECRET) {
|
|
73
|
-
throw new actions_core_1.PayloadValidationError('OAuth client credentials (client ID / client secret) are not configured.');
|
|
74
|
-
}
|
|
75
|
-
const res = await request('https://www.googleapis.com/oauth2/v4/token', {
|
|
76
|
-
method: 'POST',
|
|
77
|
-
body: new URLSearchParams({
|
|
78
|
-
refresh_token: refreshToken,
|
|
79
|
-
client_id: process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_ID,
|
|
80
|
-
client_secret: process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_SECRET,
|
|
81
|
-
grant_type: 'refresh_token'
|
|
82
|
-
})
|
|
83
|
-
});
|
|
84
|
-
return res.data.access_token;
|
|
85
|
-
}
|
|
86
|
-
async function createDataManagerPartnerLink(request, customerId, customerAccessToken, loginCustomerId) {
|
|
87
|
-
const partnerAccountId = '1663649500';
|
|
88
|
-
if (!partnerAccountId) {
|
|
89
|
-
throw new actions_core_1.IntegrationError('GOOGLE_DATA_MANAGER_PARTNER_ACCOUNT_ID environment variable is not set.', 'MISSING_PARTNER_ACCOUNT_ID', 400);
|
|
90
|
-
}
|
|
91
|
-
const owningAccountId = loginCustomerId || customerId;
|
|
92
|
-
const url = `${exports.DATA_MANAGER_BASE_URL}/accountTypes/GOOGLE_ADS/accounts/${customerId}/partnerLinks`;
|
|
93
|
-
const response = await request(url, {
|
|
94
|
-
method: 'POST',
|
|
95
|
-
headers: {
|
|
96
|
-
authorization: `Bearer ${customerAccessToken}`,
|
|
97
|
-
'login-account': `accountTypes/GOOGLE_ADS/accounts/${owningAccountId}`
|
|
98
|
-
},
|
|
99
|
-
json: {
|
|
100
|
-
owningAccount: { accountId: owningAccountId, accountType: 'GOOGLE_ADS' },
|
|
101
|
-
partnerAccount: { accountId: partnerAccountId, accountType: 'DATA_PARTNER' }
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
return response.data;
|
|
105
|
-
}
|
|
106
|
-
async function createDataManagerUserList(request, customerId, listName, uploadKeyType, segmentAccessToken, appId) {
|
|
107
|
-
const partnerAccountId = '1663649500';
|
|
108
|
-
const url = `${exports.DATA_MANAGER_BASE_URL}/accountTypes/GOOGLE_ADS/accounts/${customerId}/userLists`;
|
|
109
|
-
const response = await request(url, {
|
|
110
|
-
method: 'POST',
|
|
111
|
-
headers: {
|
|
112
|
-
authorization: `Bearer ${segmentAccessToken}`,
|
|
113
|
-
...(partnerAccountId && { 'login-account': `accountTypes/DATA_PARTNER/accounts/${partnerAccountId}` })
|
|
114
|
-
},
|
|
115
|
-
json: {
|
|
116
|
-
displayName: listName,
|
|
117
|
-
uploadKeyType: UPLOAD_KEY_TYPE_MAP[uploadKeyType] ?? uploadKeyType,
|
|
118
|
-
...(appId && { appId })
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
return response.data;
|
|
122
|
-
}
|
|
123
|
-
async function getDataManagerUserList(request, customerId, userListId, segmentAccessToken) {
|
|
124
|
-
const partnerAccountId = process.env.GOOGLE_DATA_MANAGER_PARTNER_ACCOUNT_ID;
|
|
125
|
-
const url = `${exports.DATA_MANAGER_BASE_URL}/accountTypes/GOOGLE_ADS/accounts/${customerId}/userLists/${userListId}`;
|
|
126
|
-
const response = await request(url, {
|
|
127
|
-
method: 'GET',
|
|
128
|
-
headers: {
|
|
129
|
-
authorization: `Bearer ${segmentAccessToken}`,
|
|
130
|
-
...(partnerAccountId && { 'login-account': `accountTypes/DATA_PARTNER/accounts/${partnerAccountId}` })
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
return response.data;
|
|
134
|
-
}
|
|
135
61
|
async function getCustomVariables(customerId, auth, request, features, statsContext) {
|
|
136
62
|
return await request(`https://googleads.googleapis.com/${getApiVersion(features, statsContext)}/customers/${customerId}/googleAds:searchStream`, {
|
|
137
63
|
method: 'post',
|
|
@@ -187,7 +113,7 @@ async function getConversionActionDynamicData(request, settings, auth, features,
|
|
|
187
113
|
nextPage: '',
|
|
188
114
|
error: {
|
|
189
115
|
message: err.response?.statusText ?? 'Unknown error',
|
|
190
|
-
code:
|
|
116
|
+
code: err.response?.status + '' ?? '500'
|
|
191
117
|
}
|
|
192
118
|
};
|
|
193
119
|
}
|
|
@@ -263,38 +189,98 @@ async function getListIds(request, settings, auth, features, statsContext) {
|
|
|
263
189
|
nextPage: '',
|
|
264
190
|
error: {
|
|
265
191
|
message: err.response?.statusText ?? 'Unknown error',
|
|
266
|
-
code:
|
|
192
|
+
code: err.response?.status + '' ?? '500'
|
|
267
193
|
}
|
|
268
194
|
};
|
|
269
195
|
}
|
|
270
196
|
}
|
|
271
|
-
async function createGoogleAudience(request, input,
|
|
197
|
+
async function createGoogleAudience(request, input, auth, features, statsContext) {
|
|
272
198
|
if (input.audienceSettings.external_id_type === 'MOBILE_ADVERTISING_ID' && !input.audienceSettings.app_id) {
|
|
273
199
|
throw new actions_core_1.PayloadValidationError('App ID is required when external ID type is mobile advertising ID.');
|
|
274
200
|
}
|
|
201
|
+
if (!auth?.refresh_token ||
|
|
202
|
+
!process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_ID ||
|
|
203
|
+
!process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_SECRET) {
|
|
204
|
+
throw new actions_core_1.PayloadValidationError('Oauth credentials missing.');
|
|
205
|
+
}
|
|
206
|
+
const res = await request('https://www.googleapis.com/oauth2/v4/token', {
|
|
207
|
+
method: 'POST',
|
|
208
|
+
body: new URLSearchParams({
|
|
209
|
+
refresh_token: auth.refresh_token,
|
|
210
|
+
client_id: process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_ID,
|
|
211
|
+
client_secret: process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_SECRET,
|
|
212
|
+
grant_type: 'refresh_token'
|
|
213
|
+
})
|
|
214
|
+
});
|
|
215
|
+
const accessToken = res.data.access_token;
|
|
275
216
|
const statsClient = statsContext?.statsClient;
|
|
276
217
|
const statsTags = statsContext?.tags;
|
|
277
|
-
const
|
|
278
|
-
|
|
218
|
+
const json = {
|
|
219
|
+
operations: [
|
|
220
|
+
{
|
|
221
|
+
create: {
|
|
222
|
+
crmBasedUserList: {
|
|
223
|
+
uploadKeyType: input.audienceSettings.external_id_type,
|
|
224
|
+
appId: input.audienceSettings.app_id
|
|
225
|
+
},
|
|
226
|
+
membershipLifeSpan: '540',
|
|
227
|
+
name: `${input.audienceName}`
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
};
|
|
232
|
+
const response = await request(`https://googleads.googleapis.com/${getApiVersion(features, statsContext)}/customers/${input.settings.customerId}/userLists:mutate`, {
|
|
233
|
+
method: 'post',
|
|
234
|
+
headers: {
|
|
235
|
+
'developer-token': `${process.env.ADWORDS_DEVELOPER_TOKEN}`,
|
|
236
|
+
authorization: `Bearer ${accessToken}`
|
|
237
|
+
},
|
|
238
|
+
json
|
|
239
|
+
});
|
|
240
|
+
const name = response.data.results[0].resourceName;
|
|
241
|
+
if (!name) {
|
|
279
242
|
statsClient?.incr('createAudience.error', 1, statsTags);
|
|
280
243
|
throw new actions_core_1.IntegrationError('Failed to receive a created customer list id.', 'INVALID_RESPONSE', 400);
|
|
281
244
|
}
|
|
282
245
|
statsClient?.incr('createAudience.success', 1, statsTags);
|
|
283
|
-
return
|
|
246
|
+
return name.split('/')[3];
|
|
284
247
|
}
|
|
285
|
-
async function getGoogleAudience(request, settings, externalId,
|
|
248
|
+
async function getGoogleAudience(request, settings, externalId, auth, features, statsContext) {
|
|
249
|
+
if (!auth?.refresh_token ||
|
|
250
|
+
!process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_ID ||
|
|
251
|
+
!process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_SECRET) {
|
|
252
|
+
throw new actions_core_1.PayloadValidationError('Oauth credentials missing.');
|
|
253
|
+
}
|
|
254
|
+
const res = await request('https://www.googleapis.com/oauth2/v4/token', {
|
|
255
|
+
method: 'POST',
|
|
256
|
+
body: new URLSearchParams({
|
|
257
|
+
refresh_token: auth.refresh_token,
|
|
258
|
+
client_id: process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_ID,
|
|
259
|
+
client_secret: process.env.GOOGLE_ENHANCED_CONVERSIONS_CLIENT_SECRET,
|
|
260
|
+
grant_type: 'refresh_token'
|
|
261
|
+
})
|
|
262
|
+
});
|
|
263
|
+
const accessToken = res.data.access_token;
|
|
286
264
|
const statsClient = statsContext?.statsClient;
|
|
287
265
|
const statsTags = statsContext?.tags;
|
|
288
|
-
const
|
|
289
|
-
|
|
266
|
+
const json = {
|
|
267
|
+
query: `SELECT user_list.id, user_list.name FROM user_list where user_list.id = '${externalId}'`
|
|
268
|
+
};
|
|
269
|
+
const response = await request(`https://googleads.googleapis.com/${getApiVersion(features, statsContext)}/customers/${settings.customerId}/googleAds:search`, {
|
|
270
|
+
method: 'post',
|
|
271
|
+
headers: {
|
|
272
|
+
'developer-token': `${process.env.ADWORDS_DEVELOPER_TOKEN}`,
|
|
273
|
+
authorization: `Bearer ${accessToken}`
|
|
274
|
+
},
|
|
275
|
+
json
|
|
276
|
+
});
|
|
277
|
+
const id = response.data.results[0].userList.id;
|
|
278
|
+
if (!id) {
|
|
290
279
|
statsClient?.incr('getAudience.error', 1, statsTags);
|
|
291
280
|
throw new actions_core_1.IntegrationError('Failed to receive a customer list.', 'INVALID_RESPONSE', 400);
|
|
292
281
|
}
|
|
293
282
|
statsClient?.incr('getAudience.success', 1, statsTags);
|
|
294
|
-
return
|
|
295
|
-
results: [{ userList: { resourceName: userList.name, id: userList.id, name: userList.displayName } }],
|
|
296
|
-
fieldMask: ''
|
|
297
|
-
};
|
|
283
|
+
return response.data;
|
|
298
284
|
}
|
|
299
285
|
function formatToE164(phoneNumber, countryCode) {
|
|
300
286
|
const numericPhoneNumber = phoneNumber.replace(/\D/g, '');
|
|
@@ -346,7 +332,7 @@ const validateAndFormatToE164 = (phoneNumber, countryCode, statsContext) => {
|
|
|
346
332
|
}
|
|
347
333
|
};
|
|
348
334
|
exports.validateAndFormatToE164 = validateAndFormatToE164;
|
|
349
|
-
const extractUserIdentifiers = (payloads, idType, syncMode, features, statsContext
|
|
335
|
+
const extractUserIdentifiers = (payloads, idType, syncMode, features, statsContext) => {
|
|
350
336
|
const removeUserIdentifiers = [];
|
|
351
337
|
const addUserIdentifiers = [];
|
|
352
338
|
const identifierFunctions = {
|
|
@@ -383,39 +369,16 @@ const extractUserIdentifiers = (payloads, idType, syncMode, features, statsConte
|
|
|
383
369
|
return identifiers;
|
|
384
370
|
}
|
|
385
371
|
};
|
|
386
|
-
const { computation_class } = personasContext || {};
|
|
387
372
|
for (const payload of payloads) {
|
|
388
|
-
if (
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
audienceMembership === true) {
|
|
393
|
-
addUserIdentifiers.push({ create: { userIdentifiers: identifierFunctions[idType](payload) } });
|
|
394
|
-
}
|
|
395
|
-
else if (payload.event_name === 'Audience Exited' ||
|
|
396
|
-
syncMode === 'delete' ||
|
|
397
|
-
(syncMode === 'mirror' && payload.event_name === 'deleted') ||
|
|
398
|
-
audienceMembership === false) {
|
|
399
|
-
removeUserIdentifiers.push({ remove: { userIdentifiers: identifierFunctions[idType](payload) } });
|
|
400
|
-
}
|
|
401
|
-
else if (computation_class === 'journey_step') {
|
|
402
|
-
addUserIdentifiers.push({ create: { userIdentifiers: identifierFunctions[idType](payload) } });
|
|
403
|
-
}
|
|
373
|
+
if (payload.event_name === 'Audience Entered' ||
|
|
374
|
+
syncMode === 'add' ||
|
|
375
|
+
(syncMode === 'mirror' && (payload.event_name === 'new' || payload.event_name === 'updated'))) {
|
|
376
|
+
addUserIdentifiers.push({ create: { userIdentifiers: identifierFunctions[idType](payload) } });
|
|
404
377
|
}
|
|
405
|
-
else
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
addUserIdentifiers.push({ create: { userIdentifiers: identifierFunctions[idType](payload) } });
|
|
410
|
-
}
|
|
411
|
-
else if (payload.event_name === 'Audience Exited' ||
|
|
412
|
-
syncMode === 'delete' ||
|
|
413
|
-
(syncMode === 'mirror' && payload.event_name === 'deleted')) {
|
|
414
|
-
removeUserIdentifiers.push({ remove: { userIdentifiers: identifierFunctions[idType](payload) } });
|
|
415
|
-
}
|
|
416
|
-
else if (computation_class === 'journey_step') {
|
|
417
|
-
addUserIdentifiers.push({ create: { userIdentifiers: identifierFunctions[idType](payload) } });
|
|
418
|
-
}
|
|
378
|
+
else if (payload.event_name === 'Audience Exited' ||
|
|
379
|
+
syncMode === 'delete' ||
|
|
380
|
+
(syncMode === 'mirror' && payload.event_name === 'deleted')) {
|
|
381
|
+
removeUserIdentifiers.push({ remove: { userIdentifiers: identifierFunctions[idType](payload) } });
|
|
419
382
|
}
|
|
420
383
|
}
|
|
421
384
|
return [addUserIdentifiers, removeUserIdentifiers];
|
|
@@ -475,13 +438,13 @@ const processOperations = async (request, userIdentifiers, resourceName, validPa
|
|
|
475
438
|
(0, exports.handlePartialFailureResponse)(partialFailureError, validPayloadIndicesBitmap, multiStatusResponse, userIdentifiers, failedPayloadIndices);
|
|
476
439
|
}
|
|
477
440
|
};
|
|
478
|
-
const handleUpdate = async (request, settings, audienceSettings, payloads, hookListId, hookListType, syncMode, features, statsContext
|
|
441
|
+
const handleUpdate = async (request, settings, audienceSettings, payloads, hookListId, hookListType, syncMode, features, statsContext) => {
|
|
479
442
|
const externalAudienceId = hookListId || payloads[0]?.external_audience_id;
|
|
480
443
|
if (!externalAudienceId) {
|
|
481
444
|
throw new actions_core_1.PayloadValidationError('External Audience ID is required.');
|
|
482
445
|
}
|
|
483
446
|
const id_type = hookListType ?? audienceSettings.external_id_type;
|
|
484
|
-
const [adduserIdentifiers, removeUserIdentifiers] = extractUserIdentifiers(payloads, id_type, syncMode, features, statsContext
|
|
447
|
+
const [adduserIdentifiers, removeUserIdentifiers] = extractUserIdentifiers(payloads, id_type, syncMode, features, statsContext);
|
|
485
448
|
const offlineUserJobPayload = createOfflineUserJobPayload(externalAudienceId, payloads[0], settings.customerId);
|
|
486
449
|
const offlineUserJobResponse = await createOfflineUserJob(request, offlineUserJobPayload, settings, features, statsContext);
|
|
487
450
|
if (!offlineUserJobResponse.success) {
|
|
@@ -622,7 +585,7 @@ const createIdentifierExtractors = (features) => ({
|
|
|
622
585
|
}
|
|
623
586
|
});
|
|
624
587
|
exports.createIdentifierExtractors = createIdentifierExtractors;
|
|
625
|
-
const extractBatchUserIdentifiers = (payloads, idType, multiStatusResponse, syncMode, features
|
|
588
|
+
const extractBatchUserIdentifiers = (payloads, idType, multiStatusResponse, syncMode, features) => {
|
|
626
589
|
const removeUserIdentifiers = [];
|
|
627
590
|
const addUserIdentifiers = [];
|
|
628
591
|
const validPayloadIndicesBitmap = [];
|
|
@@ -650,8 +613,8 @@ const extractBatchUserIdentifiers = (payloads, idType, multiStatusResponse, sync
|
|
|
650
613
|
});
|
|
651
614
|
return;
|
|
652
615
|
}
|
|
653
|
-
const operationType = determineOperationType(payload, syncMode
|
|
654
|
-
if (operationType
|
|
616
|
+
const operationType = determineOperationType(payload, syncMode);
|
|
617
|
+
if (!operationType) {
|
|
655
618
|
multiStatusResponse.setErrorResponseAtIndex(index, {
|
|
656
619
|
status: 400,
|
|
657
620
|
errortype: 'PAYLOAD_VALIDATION_FAILED',
|
|
@@ -660,7 +623,7 @@ const extractBatchUserIdentifiers = (payloads, idType, multiStatusResponse, sync
|
|
|
660
623
|
return;
|
|
661
624
|
}
|
|
662
625
|
validPayloadIndicesBitmap.push(index);
|
|
663
|
-
if (operationType ===
|
|
626
|
+
if (operationType === 'add') {
|
|
664
627
|
addUserIdentifiers.push({ create: { userIdentifiers } });
|
|
665
628
|
}
|
|
666
629
|
else {
|
|
@@ -669,41 +632,18 @@ const extractBatchUserIdentifiers = (payloads, idType, multiStatusResponse, sync
|
|
|
669
632
|
});
|
|
670
633
|
return { addUserIdentifiers, removeUserIdentifiers, validPayloadIndicesBitmap };
|
|
671
634
|
};
|
|
672
|
-
const determineOperationType = (payload, syncMode
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
audienceMembership === false) {
|
|
685
|
-
return false;
|
|
686
|
-
}
|
|
687
|
-
else if (computation_class === 'journey_step') {
|
|
688
|
-
return true;
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
else {
|
|
692
|
-
if (payload.event_name === 'Audience Entered' ||
|
|
693
|
-
syncMode === 'add' ||
|
|
694
|
-
(syncMode === 'mirror' && (payload.event_name === 'new' || payload.event_name === 'updated'))) {
|
|
695
|
-
return true;
|
|
696
|
-
}
|
|
697
|
-
else if (payload.event_name === 'Audience Exited' ||
|
|
698
|
-
syncMode === 'delete' ||
|
|
699
|
-
(syncMode === 'mirror' && payload.event_name === 'deleted')) {
|
|
700
|
-
return false;
|
|
701
|
-
}
|
|
702
|
-
else if (computation_class === 'journey_step') {
|
|
703
|
-
return true;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
return undefined;
|
|
635
|
+
const determineOperationType = (payload, syncMode) => {
|
|
636
|
+
if (payload.event_name === 'Audience Entered' ||
|
|
637
|
+
syncMode === 'add' ||
|
|
638
|
+
(syncMode === 'mirror' && (payload.event_name === 'new' || payload.event_name === 'updated'))) {
|
|
639
|
+
return 'add';
|
|
640
|
+
}
|
|
641
|
+
else if (payload.event_name === 'Audience Exited' ||
|
|
642
|
+
syncMode === 'delete' ||
|
|
643
|
+
(syncMode === 'mirror' && payload.event_name === 'deleted')) {
|
|
644
|
+
return 'remove';
|
|
645
|
+
}
|
|
646
|
+
return null;
|
|
707
647
|
};
|
|
708
648
|
const createOfflineUserJobPayload = (audienceId, payload, customerId) => ({
|
|
709
649
|
job: {
|
|
@@ -717,14 +657,14 @@ const createOfflineUserJobPayload = (audienceId, payload, customerId) => ({
|
|
|
717
657
|
}
|
|
718
658
|
}
|
|
719
659
|
});
|
|
720
|
-
const processBatchPayload = async (request, settings, audienceSettings, payloads, hookListId, hookListType, syncMode, features, statsContext
|
|
660
|
+
const processBatchPayload = async (request, settings, audienceSettings, payloads, hookListId, hookListType, syncMode, features, statsContext) => {
|
|
721
661
|
const externalAudienceId = hookListId || payloads[0]?.external_audience_id;
|
|
722
662
|
if (!externalAudienceId) {
|
|
723
663
|
throw new actions_core_1.PayloadValidationError('External Audience ID is required.');
|
|
724
664
|
}
|
|
725
665
|
const multiStatusResponse = new actions_core_1.MultiStatusResponse();
|
|
726
666
|
const id_type = hookListType ?? audienceSettings.external_id_type;
|
|
727
|
-
const { addUserIdentifiers, removeUserIdentifiers, validPayloadIndicesBitmap } = extractBatchUserIdentifiers(payloads, id_type, multiStatusResponse, syncMode, features
|
|
667
|
+
const { addUserIdentifiers, removeUserIdentifiers, validPayloadIndicesBitmap } = extractBatchUserIdentifiers(payloads, id_type, multiStatusResponse, syncMode, features);
|
|
728
668
|
const offlineUserJobPayload = createOfflineUserJobPayload(externalAudienceId, payloads[0], settings.customerId);
|
|
729
669
|
const { success, data: resourceName, error } = await createOfflineUserJob(request, offlineUserJobPayload, settings, features, statsContext);
|
|
730
670
|
if (!success) {
|