@segment/action-destinations 3.478.0 → 3.478.1-staging-7ad09fc36.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/amazon-amc/function.d.ts +4 -3
- package/dist/destinations/amazon-amc/function.js +51 -8
- package/dist/destinations/amazon-amc/function.js.map +1 -1
- package/dist/destinations/amazon-amc/syncAudiencesToDSP/generated-types.d.ts +7 -0
- package/dist/destinations/amazon-amc/syncAudiencesToDSP/index.js +58 -4
- package/dist/destinations/amazon-amc/syncAudiencesToDSP/index.js.map +1 -1
- package/dist/destinations/amazon-amc/types.d.ts +24 -8
- package/dist/destinations/amazon-amc/types.js.map +1 -1
- package/dist/destinations/amazon-amc/utils.d.ts +3 -0
- package/dist/destinations/amazon-amc/utils.js +24 -1
- package/dist/destinations/amazon-amc/utils.js.map +1 -1
- package/dist/destinations/amplitude-cohorts/index.js +2 -2
- package/dist/destinations/amplitude-cohorts/index.js.map +1 -1
- package/dist/destinations/amplitude-cohorts/syncAudience/fields.js +6 -49
- package/dist/destinations/amplitude-cohorts/syncAudience/fields.js.map +1 -1
- package/dist/destinations/amplitude-cohorts/syncAudience/functions.d.ts +2 -2
- package/dist/destinations/amplitude-cohorts/syncAudience/functions.js +10 -8
- package/dist/destinations/amplitude-cohorts/syncAudience/functions.js.map +1 -1
- package/dist/destinations/amplitude-cohorts/syncAudience/generated-types.d.ts +1 -8
- package/dist/destinations/amplitude-cohorts/syncAudience/index.js +4 -4
- package/dist/destinations/amplitude-cohorts/syncAudience/index.js.map +1 -1
- package/dist/destinations/braze-cohorts/syncAudiences/index.js +28 -11
- package/dist/destinations/braze-cohorts/syncAudiences/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/addToCart/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/addToCart/index.js +4 -87
- package/dist/destinations/facebook-conversions-api/addToCart/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/addToCart2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/addToCart2/index.js +4 -86
- package/dist/destinations/facebook-conversions-api/addToCart2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/constants.d.ts +11 -0
- package/dist/destinations/facebook-conversions-api/constants.js +12 -1
- package/dist/destinations/facebook-conversions-api/constants.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/custom/generated-types.d.ts +9 -0
- package/dist/destinations/facebook-conversions-api/custom/index.js +5 -53
- package/dist/destinations/facebook-conversions-api/custom/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/custom2/generated-types.d.ts +9 -0
- package/dist/destinations/facebook-conversions-api/custom2/index.js +5 -52
- package/dist/destinations/facebook-conversions-api/custom2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/{fb-capi-properties.d.ts → fields.d.ts} +14 -10
- package/dist/destinations/facebook-conversions-api/fields.js +842 -0
- package/dist/destinations/facebook-conversions-api/fields.js.map +1 -0
- package/dist/destinations/facebook-conversions-api/functions.d.ts +37 -0
- package/dist/destinations/facebook-conversions-api/functions.js +425 -0
- package/dist/destinations/facebook-conversions-api/functions.js.map +1 -0
- package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js +4 -90
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/initiateCheckout2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/initiateCheckout2/index.js +4 -89
- package/dist/destinations/facebook-conversions-api/initiateCheckout2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/pageView/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/pageView/index.js +5 -46
- package/dist/destinations/facebook-conversions-api/pageView/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/pageView2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/pageView2/index.js +5 -45
- package/dist/destinations/facebook-conversions-api/pageView2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/purchase/generated-types.d.ts +11 -0
- package/dist/destinations/facebook-conversions-api/purchase/index.js +4 -95
- package/dist/destinations/facebook-conversions-api/purchase/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/purchase2/generated-types.d.ts +11 -0
- package/dist/destinations/facebook-conversions-api/purchase2/index.js +5 -4
- package/dist/destinations/facebook-conversions-api/purchase2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/search/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/search/index.js +4 -94
- package/dist/destinations/facebook-conversions-api/search/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/search2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/search2/index.js +4 -93
- package/dist/destinations/facebook-conversions-api/search2/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/types.d.ts +182 -0
- package/dist/destinations/facebook-conversions-api/types.js +3 -0
- package/dist/destinations/facebook-conversions-api/types.js.map +1 -0
- package/dist/destinations/facebook-conversions-api/viewContent/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/viewContent/index.js +4 -89
- package/dist/destinations/facebook-conversions-api/viewContent/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/viewContent2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/viewContent2/index.js +4 -88
- package/dist/destinations/facebook-conversions-api/viewContent2/index.js.map +1 -1
- package/dist/destinations/facebook-custom-audiences/constants.d.ts +1 -2
- package/dist/destinations/facebook-custom-audiences/constants.js +2 -54
- package/dist/destinations/facebook-custom-audiences/constants.js.map +1 -1
- package/dist/destinations/facebook-custom-audiences/fields.d.ts +3 -0
- package/dist/destinations/facebook-custom-audiences/fields.js +16 -0
- package/dist/destinations/facebook-custom-audiences/fields.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/functions.d.ts +19 -0
- package/dist/destinations/facebook-custom-audiences/functions.js +94 -0
- package/dist/destinations/facebook-custom-audiences/functions.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/generated-types.d.ts +1 -1
- package/dist/destinations/facebook-custom-audiences/index.js +25 -105
- package/dist/destinations/facebook-custom-audiences/index.js.map +1 -1
- package/dist/destinations/facebook-custom-audiences/presets.d.ts +2 -0
- package/dist/destinations/facebook-custom-audiences/presets.js +39 -0
- package/dist/destinations/facebook-custom-audiences/presets.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/sync/constants.d.ts +3 -0
- package/dist/destinations/facebook-custom-audiences/sync/constants.js +90 -0
- package/dist/destinations/facebook-custom-audiences/sync/constants.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/sync/fields.d.ts +7 -0
- package/dist/destinations/facebook-custom-audiences/sync/fields.js +269 -0
- package/dist/destinations/facebook-custom-audiences/sync/fields.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/sync/functions.d.ts +33 -0
- package/dist/destinations/facebook-custom-audiences/sync/functions.js +245 -0
- package/dist/destinations/facebook-custom-audiences/sync/functions.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/sync/generated-types.d.ts +3 -2
- package/dist/destinations/facebook-custom-audiences/sync/hook-functions.d.ts +45 -0
- package/dist/destinations/facebook-custom-audiences/sync/hook-functions.js +99 -0
- package/dist/destinations/facebook-custom-audiences/sync/hook-functions.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/sync/index.js +18 -267
- package/dist/destinations/facebook-custom-audiences/sync/index.js.map +1 -1
- package/dist/destinations/facebook-custom-audiences/sync/types.d.ts +35 -0
- package/dist/destinations/facebook-custom-audiences/sync/types.js +3 -0
- package/dist/destinations/facebook-custom-audiences/sync/types.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/types.d.ts +40 -0
- package/dist/destinations/facebook-custom-audiences/types.js +3 -0
- package/dist/destinations/facebook-custom-audiences/types.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +3 -3
- package/dist/destinations/google-enhanced-conversions/functions.js +57 -31
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/userList/index.js +5 -5
- package/dist/destinations/google-enhanced-conversions/userList/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/updateAudience/functions.d.ts +2 -2
- package/dist/destinations/linkedin-audiences/updateAudience/functions.js +40 -16
- package/dist/destinations/linkedin-audiences/updateAudience/functions.js.map +1 -1
- package/dist/destinations/linkedin-audiences/updateAudience/index.js +4 -4
- package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/destinations/facebook-conversions-api/fb-capi-app-data.d.ts +0 -11
- package/dist/destinations/facebook-conversions-api/fb-capi-app-data.js +0 -188
- package/dist/destinations/facebook-conversions-api/fb-capi-app-data.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.js +0 -185
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/fb-capi-user-data.d.ts +0 -7
- package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js +0 -272
- package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/purchase2/fields.d.ts +0 -2
- package/dist/destinations/facebook-conversions-api/purchase2/fields.js +0 -50
- package/dist/destinations/facebook-conversions-api/purchase2/fields.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/purchase2/functions.d.ts +0 -4
- package/dist/destinations/facebook-conversions-api/purchase2/functions.js +0 -59
- package/dist/destinations/facebook-conversions-api/purchase2/functions.js.map +0 -1
- package/dist/destinations/facebook-conversions-api/utils.d.ts +0 -3
- package/dist/destinations/facebook-conversions-api/utils.js +0 -19
- package/dist/destinations/facebook-conversions-api/utils.js.map +0 -1
- package/dist/destinations/facebook-custom-audiences/fbca-operations.d.ts +0 -42
- package/dist/destinations/facebook-custom-audiences/fbca-operations.js +0 -144
- package/dist/destinations/facebook-custom-audiences/fbca-operations.js.map +0 -1
- package/dist/destinations/facebook-custom-audiences/fbca-properties.d.ts +0 -8
- package/dist/destinations/facebook-custom-audiences/fbca-properties.js +0 -148
- package/dist/destinations/facebook-custom-audiences/fbca-properties.js.map +0 -1
|
@@ -1,105 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const fields_1 = require("../fields");
|
|
4
|
+
const functions_1 = require("../functions");
|
|
4
5
|
const constants_1 = require("../constants");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const fb_capi_properties_1 = require("../fb-capi-properties");
|
|
7
|
-
const fb_capi_user_data_1 = require("../fb-capi-user-data");
|
|
8
|
-
const fb_capi_app_data_1 = require("../fb-capi-app-data");
|
|
9
6
|
const action = {
|
|
10
7
|
title: 'Search',
|
|
11
8
|
description: 'Send event when a user searches content or products',
|
|
12
9
|
defaultSubscription: 'type = "track" and event = "Products Searched"',
|
|
13
|
-
fields:
|
|
14
|
-
action_source: { ...fb_capi_properties_1.action_source, required: true },
|
|
15
|
-
event_time: { ...fb_capi_properties_1.event_time, required: true },
|
|
16
|
-
user_data: fb_capi_user_data_1.user_data_field,
|
|
17
|
-
app_data_field: fb_capi_app_data_1.app_data_field,
|
|
18
|
-
content_category: fb_capi_properties_1.content_category,
|
|
19
|
-
content_ids: fb_capi_properties_1.content_ids,
|
|
20
|
-
contents: {
|
|
21
|
-
...fb_capi_properties_1.contents,
|
|
22
|
-
default: {
|
|
23
|
-
'@arrayPath': [
|
|
24
|
-
'$.properties',
|
|
25
|
-
{
|
|
26
|
-
id: {
|
|
27
|
-
'@path': '$.product_id'
|
|
28
|
-
},
|
|
29
|
-
quantity: {
|
|
30
|
-
'@path': '$.quantity'
|
|
31
|
-
},
|
|
32
|
-
item_price: {
|
|
33
|
-
'@path': '$.price'
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
currency: fb_capi_properties_1.currency,
|
|
40
|
-
event_id: fb_capi_properties_1.event_id,
|
|
41
|
-
event_source_url: fb_capi_properties_1.event_source_url,
|
|
42
|
-
search_string: {
|
|
43
|
-
label: 'Search String',
|
|
44
|
-
description: 'A search query made by a user. This must be a string.',
|
|
45
|
-
type: 'string',
|
|
46
|
-
default: {
|
|
47
|
-
'@path': '$.properties.query'
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
value: fb_capi_properties_1.value,
|
|
51
|
-
custom_data: fb_capi_properties_1.custom_data,
|
|
52
|
-
data_processing_options: fb_capi_properties_1.data_processing_options,
|
|
53
|
-
data_processing_options_country: fb_capi_properties_1.data_processing_options_country,
|
|
54
|
-
data_processing_options_state: fb_capi_properties_1.data_processing_options_state,
|
|
55
|
-
test_event_code: fb_capi_properties_1.test_event_code
|
|
56
|
-
},
|
|
10
|
+
fields: fields_1.searchFields,
|
|
57
11
|
perform: (request, { payload, settings, features, statsContext }) => {
|
|
58
|
-
|
|
59
|
-
throw new actions_core_1.IntegrationError(`${payload.currency} is not a valid currency code.`, 'Misconfigured required field', 400);
|
|
60
|
-
}
|
|
61
|
-
if (!payload.user_data) {
|
|
62
|
-
throw new actions_core_1.IntegrationError('Must include at least one user data property', 'Misconfigured required field', 400);
|
|
63
|
-
}
|
|
64
|
-
if (payload.action_source === 'website' && payload.user_data.client_user_agent === undefined) {
|
|
65
|
-
throw new actions_core_1.IntegrationError('If action source is "Website" then client_user_agent must be defined', 'Misconfigured required field', 400);
|
|
66
|
-
}
|
|
67
|
-
if (payload.contents) {
|
|
68
|
-
const err = (0, fb_capi_properties_1.validateContents)(payload.contents);
|
|
69
|
-
if (err)
|
|
70
|
-
throw err;
|
|
71
|
-
}
|
|
72
|
-
const [data_options, country_code, state_code] = (0, fb_capi_properties_1.dataProcessingOptions)(payload.data_processing_options, payload.data_processing_options_country, payload.data_processing_options_state);
|
|
73
|
-
const testEventCode = payload.test_event_code || settings.testEventCode;
|
|
74
|
-
return request(`https://graph.facebook.com/v${(0, utils_1.get_api_version)(features, statsContext)}/${settings.pixelId}/events`, {
|
|
75
|
-
method: 'POST',
|
|
76
|
-
json: {
|
|
77
|
-
data: [
|
|
78
|
-
{
|
|
79
|
-
event_name: 'Search',
|
|
80
|
-
event_time: payload.event_time,
|
|
81
|
-
action_source: payload.action_source,
|
|
82
|
-
event_id: payload.event_id,
|
|
83
|
-
event_source_url: payload.event_source_url,
|
|
84
|
-
user_data: (0, fb_capi_user_data_1.hash_user_data)({ user_data: payload.user_data }),
|
|
85
|
-
custom_data: {
|
|
86
|
-
...payload.custom_data,
|
|
87
|
-
currency: payload.currency,
|
|
88
|
-
content_ids: payload.content_ids,
|
|
89
|
-
contents: payload.contents,
|
|
90
|
-
content_category: payload.content_category,
|
|
91
|
-
value: payload.value,
|
|
92
|
-
search_string: payload.search_string
|
|
93
|
-
},
|
|
94
|
-
app_data: (0, fb_capi_app_data_1.generate_app_data)(payload.app_data_field),
|
|
95
|
-
data_processing_options: data_options,
|
|
96
|
-
data_processing_options_country: country_code,
|
|
97
|
-
data_processing_options_state: state_code
|
|
98
|
-
}
|
|
99
|
-
],
|
|
100
|
-
...(testEventCode && { test_event_code: testEventCode })
|
|
101
|
-
}
|
|
102
|
-
});
|
|
12
|
+
return (0, functions_1.send)(request, payload, settings, constants_1.EventType.Search, features, statsContext);
|
|
103
13
|
}
|
|
104
14
|
};
|
|
105
15
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/search/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/search/index.ts"],"names":[],"mappings":";;AAGA,sCAAwC;AACxC,4CAAmC;AACnC,4CAAwC;AAExC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,qDAAqD;IAClE,mBAAmB,EAAE,gDAAgD;IACrE,MAAM,EAAE,qBAAY;IACpB,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE;QAClE,OAAO,IAAA,gBAAI,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,qBAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAA;IACnF,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const fields_1 = require("../fields");
|
|
5
|
+
const functions_1 = require("../functions");
|
|
4
6
|
const constants_1 = require("../constants");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const fb_capi_properties_1 = require("../fb-capi-properties");
|
|
7
|
-
const fb_capi_user_data_1 = require("../fb-capi-user-data");
|
|
8
|
-
const fb_capi_app_data_1 = require("../fb-capi-app-data");
|
|
9
7
|
const action = {
|
|
10
8
|
title: 'Search V2',
|
|
11
9
|
description: 'Send event when a user searches content or products',
|
|
@@ -16,97 +14,10 @@ const action = {
|
|
|
16
14
|
default: 'add',
|
|
17
15
|
choices: [{ label: 'Insert Records', value: 'add' }]
|
|
18
16
|
},
|
|
19
|
-
fields:
|
|
20
|
-
action_source: { ...fb_capi_properties_1.action_source, required: true },
|
|
21
|
-
event_time: { ...fb_capi_properties_1.event_time, required: true },
|
|
22
|
-
user_data: fb_capi_user_data_1.user_data_field,
|
|
23
|
-
app_data_field: fb_capi_app_data_1.app_data_field,
|
|
24
|
-
content_category: fb_capi_properties_1.content_category,
|
|
25
|
-
content_ids: fb_capi_properties_1.content_ids,
|
|
26
|
-
contents: {
|
|
27
|
-
...fb_capi_properties_1.contents,
|
|
28
|
-
default: {
|
|
29
|
-
'@arrayPath': [
|
|
30
|
-
'$.properties',
|
|
31
|
-
{
|
|
32
|
-
id: {
|
|
33
|
-
'@path': '$.product_id'
|
|
34
|
-
},
|
|
35
|
-
quantity: {
|
|
36
|
-
'@path': '$.quantity'
|
|
37
|
-
},
|
|
38
|
-
item_price: {
|
|
39
|
-
'@path': '$.price'
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
currency: fb_capi_properties_1.currency,
|
|
46
|
-
event_id: fb_capi_properties_1.event_id,
|
|
47
|
-
event_source_url: fb_capi_properties_1.event_source_url,
|
|
48
|
-
search_string: {
|
|
49
|
-
label: 'Search String',
|
|
50
|
-
description: 'A search query made by a user. This must be a string.',
|
|
51
|
-
type: 'string',
|
|
52
|
-
default: {
|
|
53
|
-
'@path': '$.properties.query'
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
value: fb_capi_properties_1.value,
|
|
57
|
-
custom_data: fb_capi_properties_1.custom_data,
|
|
58
|
-
data_processing_options: fb_capi_properties_1.data_processing_options,
|
|
59
|
-
data_processing_options_country: fb_capi_properties_1.data_processing_options_country,
|
|
60
|
-
data_processing_options_state: fb_capi_properties_1.data_processing_options_state,
|
|
61
|
-
test_event_code: fb_capi_properties_1.test_event_code
|
|
62
|
-
},
|
|
17
|
+
fields: fields_1.searchFields,
|
|
63
18
|
perform: (request, { payload, settings, features, statsContext, syncMode }) => {
|
|
64
19
|
if (syncMode === 'add') {
|
|
65
|
-
|
|
66
|
-
throw new actions_core_1.IntegrationError(`${payload.currency} is not a valid currency code.`, 'Misconfigured required field', 400);
|
|
67
|
-
}
|
|
68
|
-
if (!payload.user_data) {
|
|
69
|
-
throw new actions_core_1.IntegrationError('Must include at least one user data property', 'Misconfigured required field', 400);
|
|
70
|
-
}
|
|
71
|
-
if (payload.action_source === 'website' && payload.user_data.client_user_agent === undefined) {
|
|
72
|
-
throw new actions_core_1.IntegrationError('If action source is "Website" then client_user_agent must be defined', 'Misconfigured required field', 400);
|
|
73
|
-
}
|
|
74
|
-
if (payload.contents) {
|
|
75
|
-
const err = (0, fb_capi_properties_1.validateContents)(payload.contents);
|
|
76
|
-
if (err)
|
|
77
|
-
throw err;
|
|
78
|
-
}
|
|
79
|
-
const [data_options, country_code, state_code] = (0, fb_capi_properties_1.dataProcessingOptions)(payload.data_processing_options, payload.data_processing_options_country, payload.data_processing_options_state);
|
|
80
|
-
const testEventCode = payload.test_event_code || settings.testEventCode;
|
|
81
|
-
return request(`https://graph.facebook.com/v${(0, utils_1.get_api_version)(features, statsContext)}/${settings.pixelId}/events`, {
|
|
82
|
-
method: 'POST',
|
|
83
|
-
json: {
|
|
84
|
-
data: [
|
|
85
|
-
{
|
|
86
|
-
event_name: 'Search',
|
|
87
|
-
event_time: payload.event_time,
|
|
88
|
-
action_source: payload.action_source,
|
|
89
|
-
event_id: payload.event_id,
|
|
90
|
-
event_source_url: payload.event_source_url,
|
|
91
|
-
user_data: (0, fb_capi_user_data_1.hash_user_data)({ user_data: payload.user_data }),
|
|
92
|
-
custom_data: {
|
|
93
|
-
...payload.custom_data,
|
|
94
|
-
currency: payload.currency,
|
|
95
|
-
content_ids: payload.content_ids,
|
|
96
|
-
contents: payload.contents,
|
|
97
|
-
content_category: payload.content_category,
|
|
98
|
-
value: payload.value,
|
|
99
|
-
search_string: payload.search_string
|
|
100
|
-
},
|
|
101
|
-
app_data: (0, fb_capi_app_data_1.generate_app_data)(payload.app_data_field),
|
|
102
|
-
data_processing_options: data_options,
|
|
103
|
-
data_processing_options_country: country_code,
|
|
104
|
-
data_processing_options_state: state_code
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
...(testEventCode && { test_event_code: testEventCode })
|
|
108
|
-
}
|
|
109
|
-
});
|
|
20
|
+
return (0, functions_1.send)(request, payload, settings, constants_1.EventType.Search, features, statsContext);
|
|
110
21
|
}
|
|
111
22
|
else {
|
|
112
23
|
throw new actions_core_1.IntegrationError(`Sync mode ${syncMode} is not supported`, 'Misconfigured sync mode', 400);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/search2/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAG1E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/search2/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAG1E,sCAAwC;AACxC,4CAAmC;AACnC,4CAAwC;AAExC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,qDAAqD;IAClE,mBAAmB,EAAE,gDAAgD;IACrE,QAAQ,EAAE;QACR,WAAW,EAAE,8DAA8D;QAC3E,KAAK,EAAE,qBAAqB;QAC5B,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;KACrD;IACD,MAAM,EAAE,qBAAY;IACpB,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC5E,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;YACvB,OAAO,IAAA,gBAAI,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,qBAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAA;QACnF,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,+BAAgB,CAAC,aAAa,QAAQ,mBAAmB,EAAE,yBAAyB,EAAE,GAAG,CAAC,CAAA;QACtG,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { EventType } from './constants';
|
|
2
|
+
import type { Payload as AddToCartPayload } from './addToCart/generated-types';
|
|
3
|
+
import type { Payload as AddToCart2Payload } from './addToCart2/generated-types';
|
|
4
|
+
import type { Payload as CustomPayload } from './custom/generated-types';
|
|
5
|
+
import type { Payload as Custom2Payload } from './custom2/generated-types';
|
|
6
|
+
import type { Payload as InitiateCheckoutPayload } from './initiateCheckout/generated-types';
|
|
7
|
+
import type { Payload as InitiateCheckout2Payload } from './initiateCheckout2/generated-types';
|
|
8
|
+
import type { Payload as PageViewPayload } from './pageView/generated-types';
|
|
9
|
+
import type { Payload as PageView2Payload } from './pageView2/generated-types';
|
|
10
|
+
import type { Payload as PurchasePayload } from './purchase/generated-types';
|
|
11
|
+
import type { Payload as Purchase2Payload } from './purchase2/generated-types';
|
|
12
|
+
import type { Payload as SearchPayload } from './search/generated-types';
|
|
13
|
+
import type { Payload as Search2Payload } from './search2/generated-types';
|
|
14
|
+
import type { Payload as ViewContentPayload } from './viewContent/generated-types';
|
|
15
|
+
import type { Payload as ViewContentPayload2 } from './viewContent2/generated-types';
|
|
16
|
+
export type AnyPayload = PurchasePayload | Purchase2Payload | AddToCartPayload | AddToCart2Payload | ViewContentPayload | ViewContentPayload2 | InitiateCheckoutPayload | InitiateCheckout2Payload | PageViewPayload | PageView2Payload | CustomPayload | Custom2Payload | SearchPayload | Search2Payload;
|
|
17
|
+
export type EventDataType = PurchaseEventData | AppendValueEventData | AddToCartEventData | ViewContentEventData | InitiateCheckoutEventData | PageEventData | CustomEventData | SearchEventData;
|
|
18
|
+
export type EventTypeKey = keyof typeof EventType;
|
|
19
|
+
export interface RequestJSON {
|
|
20
|
+
partner_agent: "segment";
|
|
21
|
+
data: [EventDataType];
|
|
22
|
+
test_event_code?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface BaseEventData {
|
|
25
|
+
event_time: string;
|
|
26
|
+
action_source: string;
|
|
27
|
+
event_source_url?: string;
|
|
28
|
+
event_id?: string;
|
|
29
|
+
user_data: UserData;
|
|
30
|
+
app_data?: Record<string, unknown>;
|
|
31
|
+
data_processing_options?: string[];
|
|
32
|
+
data_processing_options_country?: number;
|
|
33
|
+
data_processing_options_state?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface AddToCartEventData extends BaseEventData {
|
|
36
|
+
event_name: 'AddToCart';
|
|
37
|
+
custom_data: {
|
|
38
|
+
currency: string;
|
|
39
|
+
value?: number;
|
|
40
|
+
content_ids?: string[];
|
|
41
|
+
content_name?: string;
|
|
42
|
+
content_type?: string;
|
|
43
|
+
contents?: Array<{
|
|
44
|
+
id?: string;
|
|
45
|
+
quantity?: number;
|
|
46
|
+
item_price?: number;
|
|
47
|
+
delivery_category?: string;
|
|
48
|
+
}>;
|
|
49
|
+
[k: string]: unknown;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface CustomEventData extends BaseEventData {
|
|
53
|
+
event_name: string;
|
|
54
|
+
custom_data: {
|
|
55
|
+
[k: string]: unknown;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface PageEventData extends BaseEventData {
|
|
59
|
+
event_name: 'PageView';
|
|
60
|
+
}
|
|
61
|
+
export interface PurchaseEventData extends BaseEventData {
|
|
62
|
+
event_name: 'Purchase';
|
|
63
|
+
custom_data: {
|
|
64
|
+
currency: string;
|
|
65
|
+
value: number;
|
|
66
|
+
order_id?: string;
|
|
67
|
+
net_revenue?: number;
|
|
68
|
+
predicted_ltv?: number;
|
|
69
|
+
content_ids?: string[];
|
|
70
|
+
content_name?: string;
|
|
71
|
+
content_type?: string;
|
|
72
|
+
contents?: Array<{
|
|
73
|
+
id?: string;
|
|
74
|
+
quantity?: number;
|
|
75
|
+
item_price?: number;
|
|
76
|
+
delivery_category?: string;
|
|
77
|
+
}>;
|
|
78
|
+
num_items?: number;
|
|
79
|
+
[k: string]: unknown;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface InitiateCheckoutEventData extends BaseEventData {
|
|
83
|
+
event_name: 'InitiateCheckout';
|
|
84
|
+
custom_data: {
|
|
85
|
+
currency: string;
|
|
86
|
+
value?: number;
|
|
87
|
+
content_ids?: string[];
|
|
88
|
+
contents?: Array<{
|
|
89
|
+
id?: string;
|
|
90
|
+
quantity?: number;
|
|
91
|
+
item_price?: number;
|
|
92
|
+
delivery_category?: string;
|
|
93
|
+
}>;
|
|
94
|
+
num_items?: number;
|
|
95
|
+
content_category?: string;
|
|
96
|
+
[k: string]: unknown;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface SearchEventData extends BaseEventData {
|
|
100
|
+
event_name: 'Search';
|
|
101
|
+
custom_data: {
|
|
102
|
+
currency: string;
|
|
103
|
+
value?: number;
|
|
104
|
+
content_ids?: string[];
|
|
105
|
+
contents?: Array<{
|
|
106
|
+
id?: string;
|
|
107
|
+
quantity?: number;
|
|
108
|
+
item_price?: number;
|
|
109
|
+
delivery_category?: string;
|
|
110
|
+
}>;
|
|
111
|
+
content_category?: string;
|
|
112
|
+
search_string?: string;
|
|
113
|
+
[k: string]: unknown;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export interface ViewContentEventData extends BaseEventData {
|
|
117
|
+
event_name: 'ViewContent';
|
|
118
|
+
custom_data: {
|
|
119
|
+
currency: string;
|
|
120
|
+
value?: number;
|
|
121
|
+
content_ids?: string[];
|
|
122
|
+
content_name?: string;
|
|
123
|
+
content_type?: string;
|
|
124
|
+
contents?: Array<{
|
|
125
|
+
id?: string;
|
|
126
|
+
quantity?: number;
|
|
127
|
+
item_price?: number;
|
|
128
|
+
delivery_category?: string;
|
|
129
|
+
}>;
|
|
130
|
+
content_category?: string;
|
|
131
|
+
[k: string]: unknown;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
export interface AppendValueEventData extends BaseEventData {
|
|
135
|
+
event_name: 'AppendValue';
|
|
136
|
+
original_event_data: {
|
|
137
|
+
event_name: string;
|
|
138
|
+
event_time?: string;
|
|
139
|
+
order_id?: string;
|
|
140
|
+
event_id?: string;
|
|
141
|
+
};
|
|
142
|
+
custom_data: {
|
|
143
|
+
net_revenue?: number;
|
|
144
|
+
predicted_ltv?: number;
|
|
145
|
+
[k: string]: unknown;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export type GeneratedAppData = {
|
|
149
|
+
advertiser_tracking_enabled: 1 | 0;
|
|
150
|
+
application_tracking_enabled: 1 | 0;
|
|
151
|
+
madid?: string;
|
|
152
|
+
extinfo: string[];
|
|
153
|
+
};
|
|
154
|
+
export interface UserData {
|
|
155
|
+
em?: string;
|
|
156
|
+
ph?: string;
|
|
157
|
+
ge?: string;
|
|
158
|
+
db?: string;
|
|
159
|
+
ln?: string;
|
|
160
|
+
fn?: string;
|
|
161
|
+
ct?: string;
|
|
162
|
+
st?: string;
|
|
163
|
+
zp?: string;
|
|
164
|
+
country?: string;
|
|
165
|
+
external_id?: string[];
|
|
166
|
+
client_ip_address?: string;
|
|
167
|
+
client_user_agent?: string;
|
|
168
|
+
fbc?: string;
|
|
169
|
+
fbp?: string;
|
|
170
|
+
subscription_id?: string;
|
|
171
|
+
lead_id?: number;
|
|
172
|
+
anon_id?: string;
|
|
173
|
+
madid?: string;
|
|
174
|
+
fb_login_id?: number;
|
|
175
|
+
partner_id?: string;
|
|
176
|
+
partner_name?: string;
|
|
177
|
+
ctwa_clid?: string;
|
|
178
|
+
}
|
|
179
|
+
export type Content = {
|
|
180
|
+
id?: string;
|
|
181
|
+
delivery_category?: string;
|
|
182
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/facebook-conversions-api/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,100 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const fb_capi_user_data_1 = require("../fb-capi-user-data");
|
|
3
|
+
const fields_1 = require("../fields");
|
|
4
|
+
const functions_1 = require("../functions");
|
|
6
5
|
const constants_1 = require("../constants");
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
|
-
const fb_capi_app_data_1 = require("../fb-capi-app-data");
|
|
9
6
|
const action = {
|
|
10
7
|
title: 'View Content',
|
|
11
8
|
description: 'Send event when a user views content or a product',
|
|
12
9
|
defaultSubscription: 'type = "track" and event = "Product Viewed"',
|
|
13
|
-
fields:
|
|
14
|
-
action_source: { ...fb_capi_properties_1.action_source, required: true },
|
|
15
|
-
event_time: { ...fb_capi_properties_1.event_time, required: true },
|
|
16
|
-
user_data: fb_capi_user_data_1.user_data_field,
|
|
17
|
-
app_data_field: fb_capi_app_data_1.app_data_field,
|
|
18
|
-
content_category: fb_capi_properties_1.content_category,
|
|
19
|
-
content_ids: { ...fb_capi_properties_1.content_ids, default: { '@path': '$.properties.product_id' } },
|
|
20
|
-
content_name: fb_capi_properties_1.content_name,
|
|
21
|
-
content_type: fb_capi_properties_1.content_type,
|
|
22
|
-
contents: {
|
|
23
|
-
...fb_capi_properties_1.contents,
|
|
24
|
-
default: {
|
|
25
|
-
'@arrayPath': [
|
|
26
|
-
'$.properties',
|
|
27
|
-
{
|
|
28
|
-
id: {
|
|
29
|
-
'@path': '$.product_id'
|
|
30
|
-
},
|
|
31
|
-
quantity: {
|
|
32
|
-
'@path': '$.quantity'
|
|
33
|
-
},
|
|
34
|
-
item_price: {
|
|
35
|
-
'@path': '$.price'
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
currency: fb_capi_properties_1.currency,
|
|
42
|
-
event_id: fb_capi_properties_1.event_id,
|
|
43
|
-
event_source_url: fb_capi_properties_1.event_source_url,
|
|
44
|
-
value: { ...fb_capi_properties_1.value, default: { '@path': '$.properties.price' } },
|
|
45
|
-
custom_data: fb_capi_properties_1.custom_data,
|
|
46
|
-
data_processing_options: fb_capi_properties_1.data_processing_options,
|
|
47
|
-
data_processing_options_country: fb_capi_properties_1.data_processing_options_country,
|
|
48
|
-
data_processing_options_state: fb_capi_properties_1.data_processing_options_state,
|
|
49
|
-
test_event_code: fb_capi_properties_1.test_event_code
|
|
50
|
-
},
|
|
10
|
+
fields: fields_1.viewContentFields,
|
|
51
11
|
perform: (request, { payload, settings, features, statsContext }) => {
|
|
52
|
-
|
|
53
|
-
throw new actions_core_1.IntegrationError(`${payload.currency} is not a valid currency code.`, 'Misconfigured required field', 400);
|
|
54
|
-
}
|
|
55
|
-
if (!payload.user_data) {
|
|
56
|
-
throw new actions_core_1.IntegrationError('Must include at least one user data property', 'Misconfigured required field', 400);
|
|
57
|
-
}
|
|
58
|
-
if (payload.action_source === 'website' && payload.user_data.client_user_agent === undefined) {
|
|
59
|
-
throw new actions_core_1.IntegrationError('If action source is "Website" then client_user_agent must be defined', 'Misconfigured required field', 400);
|
|
60
|
-
}
|
|
61
|
-
if (payload.contents) {
|
|
62
|
-
const err = (0, fb_capi_properties_1.validateContents)(payload.contents);
|
|
63
|
-
if (err)
|
|
64
|
-
throw err;
|
|
65
|
-
}
|
|
66
|
-
const [data_options, country_code, state_code] = (0, fb_capi_properties_1.dataProcessingOptions)(payload.data_processing_options, payload.data_processing_options_country, payload.data_processing_options_state);
|
|
67
|
-
const testEventCode = payload.test_event_code || settings.testEventCode;
|
|
68
|
-
return request(`https://graph.facebook.com/v${(0, utils_1.get_api_version)(features, statsContext)}/${settings.pixelId}/events`, {
|
|
69
|
-
method: 'POST',
|
|
70
|
-
json: {
|
|
71
|
-
data: [
|
|
72
|
-
{
|
|
73
|
-
event_name: 'ViewContent',
|
|
74
|
-
event_time: payload.event_time,
|
|
75
|
-
action_source: payload.action_source,
|
|
76
|
-
event_id: payload.event_id,
|
|
77
|
-
event_source_url: payload.event_source_url,
|
|
78
|
-
user_data: (0, fb_capi_user_data_1.hash_user_data)({ user_data: payload.user_data }),
|
|
79
|
-
custom_data: {
|
|
80
|
-
...payload.custom_data,
|
|
81
|
-
currency: payload.currency,
|
|
82
|
-
value: payload.value,
|
|
83
|
-
content_ids: payload.content_ids,
|
|
84
|
-
content_name: payload.content_name,
|
|
85
|
-
content_type: payload.content_type,
|
|
86
|
-
contents: payload.contents,
|
|
87
|
-
content_category: payload.content_category
|
|
88
|
-
},
|
|
89
|
-
app_data: (0, fb_capi_app_data_1.generate_app_data)(payload.app_data_field),
|
|
90
|
-
data_processing_options: data_options,
|
|
91
|
-
data_processing_options_country: country_code,
|
|
92
|
-
data_processing_options_state: state_code
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
...(testEventCode && { test_event_code: testEventCode })
|
|
96
|
-
}
|
|
97
|
-
});
|
|
12
|
+
return (0, functions_1.send)(request, payload, settings, constants_1.EventType.ViewContent, features, statsContext);
|
|
98
13
|
}
|
|
99
14
|
};
|
|
100
15
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/viewContent/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-conversions-api/viewContent/index.ts"],"names":[],"mappings":";;AAGA,sCAA6C;AAC7C,4CAAmC;AACnC,4CAAwC;AAExC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,mDAAmD;IAChE,mBAAmB,EAAE,6CAA6C;IAClE,MAAM,EAAE,0BAAiB;IACzB,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE;QAClE,OAAO,IAAA,gBAAI,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,qBAAS,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAA;IACxF,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|