@segment/action-destinations 3.472.0 → 3.472.1-staging-9c999842e.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-conversions-api/index.js +3 -3
- package/dist/destinations/amazon-conversions-api/index.js.map +1 -1
- package/dist/destinations/amazon-conversions-api/trackConversion/fields.js +1 -1
- package/dist/destinations/amazon-conversions-api/trackConversion/fields.js.map +1 -1
- package/dist/destinations/amazon-conversions-api/trackConversion/generated-types.d.ts +0 -1
- package/dist/destinations/amazon-conversions-api/trackConversion/index.js.map +1 -1
- package/dist/destinations/amazon-conversions-api/trackConversion/utils.d.ts +3 -3
- package/dist/destinations/amazon-conversions-api/trackConversion/utils.js +27 -20
- package/dist/destinations/amazon-conversions-api/trackConversion/utils.js.map +1 -1
- package/dist/destinations/amazon-conversions-api/types.d.ts +28 -21
- package/dist/destinations/criteo-audiences/criteo-audiences.js +2 -1
- package/dist/destinations/criteo-audiences/criteo-audiences.js.map +1 -1
- package/dist/destinations/criteo-audiences/versioning-info.d.ts +1 -0
- package/dist/destinations/criteo-audiences/versioning-info.js +5 -0
- package/dist/destinations/criteo-audiences/versioning-info.js.map +1 -0
- package/dist/destinations/facebook-conversions-api/addToCart/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/addToCart2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/custom/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/custom2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js +10 -1
- package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/initiateCheckout2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/pageView/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/pageView2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/purchase/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/purchase2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/search/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/search2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/viewContent/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-conversions-api/viewContent2/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-custom-audiences/constants.d.ts +0 -3
- package/dist/destinations/facebook-custom-audiences/constants.js +1 -55
- 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 +20 -0
- package/dist/destinations/facebook-custom-audiences/functions.js +87 -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 +243 -0
- package/dist/destinations/facebook-custom-audiences/sync/fields.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/sync/functions.d.ts +32 -0
- package/dist/destinations/facebook-custom-audiences/sync/functions.js +267 -0
- package/dist/destinations/facebook-custom-audiences/sync/functions.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/sync/generated-types.d.ts +10 -2
- package/dist/destinations/facebook-custom-audiences/sync/hook-functions.d.ts +49 -0
- package/dist/destinations/facebook-custom-audiences/sync/hook-functions.js +104 -0
- package/dist/destinations/facebook-custom-audiences/sync/hook-functions.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/sync/index.js +15 -266
- package/dist/destinations/facebook-custom-audiences/sync/index.js.map +1 -1
- package/dist/destinations/facebook-custom-audiences/sync/types.d.ts +33 -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 +26 -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/hubspot/customEvent/functions/hubspot-event-schema-functions.js.map +1 -1
- package/dist/destinations/iterable-lists/constants.d.ts +2 -0
- package/dist/destinations/iterable-lists/constants.js +3 -1
- package/dist/destinations/iterable-lists/constants.js.map +1 -1
- package/dist/destinations/iterable-lists/functions.d.ts +5 -0
- package/dist/destinations/iterable-lists/functions.js +38 -0
- package/dist/destinations/iterable-lists/functions.js.map +1 -0
- package/dist/destinations/iterable-lists/generated-types.d.ts +1 -0
- package/dist/destinations/iterable-lists/index.js +28 -31
- package/dist/destinations/iterable-lists/index.js.map +1 -1
- package/dist/destinations/iterable-lists/syncAudience/fields.d.ts +2 -0
- package/dist/destinations/iterable-lists/syncAudience/fields.js +67 -0
- package/dist/destinations/iterable-lists/syncAudience/fields.js.map +1 -0
- package/dist/destinations/iterable-lists/syncAudience/functions.d.ts +4 -0
- package/dist/destinations/iterable-lists/syncAudience/functions.js +111 -0
- package/dist/destinations/iterable-lists/syncAudience/functions.js.map +1 -0
- package/dist/destinations/iterable-lists/syncAudience/index.js +8 -76
- package/dist/destinations/iterable-lists/syncAudience/index.js.map +1 -1
- package/dist/destinations/iterable-lists/syncAudience/types.d.ts +25 -0
- package/dist/destinations/iterable-lists/syncAudience/types.js +3 -0
- package/dist/destinations/iterable-lists/syncAudience/types.js.map +1 -0
- package/dist/destinations/iterable-lists/types.d.ts +0 -21
- package/dist/destinations/klaviyo/config.js +2 -1
- package/dist/destinations/klaviyo/config.js.map +1 -1
- package/dist/destinations/klaviyo/versioning-info.d.ts +1 -0
- package/dist/destinations/klaviyo/versioning-info.js +5 -0
- package/dist/destinations/klaviyo/versioning-info.js.map +1 -0
- package/dist/destinations/launchdarkly-audiences/constants.js +2 -1
- package/dist/destinations/launchdarkly-audiences/constants.js.map +1 -1
- package/dist/destinations/launchdarkly-audiences/versioning-info.d.ts +1 -0
- package/dist/destinations/launchdarkly-audiences/versioning-info.js +5 -0
- package/dist/destinations/launchdarkly-audiences/versioning-info.js.map +1 -0
- package/dist/destinations/linkedin-conversions/api/index.js +6 -2
- package/dist/destinations/linkedin-conversions/api/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/constants.js +1 -1
- package/dist/destinations/linkedin-conversions/constants.js.map +1 -1
- package/dist/destinations/linkedin-conversions/streamConversion/generated-types.d.ts +3 -3
- package/dist/destinations/linkedin-conversions/streamConversion/index.js +3 -0
- package/dist/destinations/linkedin-conversions/streamConversion/index.js.map +1 -1
- package/dist/destinations/liveramp-audiences/operations.js +7 -5
- package/dist/destinations/liveramp-audiences/operations.js.map +1 -1
- package/dist/destinations/memora/index.js +3 -3
- package/dist/destinations/memora/index.js.map +1 -1
- package/dist/destinations/memora/upsertProfile/index.js +39 -24
- package/dist/destinations/memora/upsertProfile/index.js.map +1 -1
- package/dist/destinations/moengage/identifyUser/index.js +2 -1
- package/dist/destinations/moengage/identifyUser/index.js.map +1 -1
- package/dist/destinations/moengage/index.js +2 -1
- package/dist/destinations/moengage/index.js.map +1 -1
- package/dist/destinations/moengage/trackEvent/index.js +3 -2
- package/dist/destinations/moengage/trackEvent/index.js.map +1 -1
- package/dist/destinations/moengage/versioning-info.d.ts +1 -0
- package/dist/destinations/moengage/versioning-info.js +5 -0
- package/dist/destinations/moengage/versioning-info.js.map +1 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/index.js +2 -1
- package/dist/destinations/optimizely-feature-experimentation-actions/index.js.map +1 -1
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/index.js +2 -1
- package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/index.js.map +1 -1
- package/dist/destinations/optimizely-feature-experimentation-actions/versioning-info.d.ts +2 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/versioning-info.js +6 -0
- package/dist/destinations/optimizely-feature-experimentation-actions/versioning-info.js.map +1 -0
- package/dist/destinations/rokt-capi/index.js.map +1 -1
- package/dist/destinations/rokt-capi/send/fields.js +1 -1
- package/dist/destinations/rokt-capi/send/fields.js.map +1 -1
- package/dist/destinations/yahoo-audiences/utils-rt.js +1 -1
- package/dist/destinations/yahoo-audiences/utils-rt.js.map +1 -1
- package/package.json +4 -4
- 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
- package/dist/destinations/iterable-lists/syncAudience/iterable-client.d.ts +0 -13
- package/dist/destinations/iterable-lists/syncAudience/iterable-client.js +0 -88
- package/dist/destinations/iterable-lists/syncAudience/iterable-client.js.map +0 -1
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.retlHookOutputTypes = exports.retlHookInputFields = exports.fields = void 0;
|
|
4
|
+
const hook_functions_1 = require("./hook-functions");
|
|
5
|
+
exports.fields = {
|
|
6
|
+
externalId: {
|
|
7
|
+
type: 'string',
|
|
8
|
+
required: true,
|
|
9
|
+
label: 'External ID',
|
|
10
|
+
category: 'hashedPII',
|
|
11
|
+
description: 'Your company’s custom identifier for this user. This can be any unique ID, such as loyalty membership IDs, user IDs, and external cookie IDs.'
|
|
12
|
+
},
|
|
13
|
+
email: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
label: 'Email',
|
|
16
|
+
description: 'User’s email (ex: foo@bar.com)',
|
|
17
|
+
category: 'hashedPII'
|
|
18
|
+
},
|
|
19
|
+
phone: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
label: 'Phone',
|
|
22
|
+
description: 'User’s phone number, including country code. Punctuation and spaces are ok (ex: 1-234-567-8910 or +44 844 412 4653)',
|
|
23
|
+
category: 'hashedPII'
|
|
24
|
+
},
|
|
25
|
+
birth: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
label: 'Date of Birth',
|
|
28
|
+
description: 'User’s date of birth. Include as many fields as possible for better match rates (ex: year = YYYY, month = MM, day = DD)',
|
|
29
|
+
properties: {
|
|
30
|
+
year: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
label: 'Year'
|
|
33
|
+
},
|
|
34
|
+
month: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
label: 'Month'
|
|
37
|
+
},
|
|
38
|
+
day: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
label: 'Day'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
category: 'hashedPII'
|
|
44
|
+
},
|
|
45
|
+
name: {
|
|
46
|
+
type: 'object',
|
|
47
|
+
label: 'Name',
|
|
48
|
+
description: 'User’s name. Include as many fields as possible for better match rates. Use a-z only. No punctuation. Special characters in UTF-8 format',
|
|
49
|
+
category: 'hashedPII',
|
|
50
|
+
properties: {
|
|
51
|
+
first: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
label: 'First Name',
|
|
54
|
+
category: 'hashedPII'
|
|
55
|
+
},
|
|
56
|
+
last: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
label: 'Last Name',
|
|
59
|
+
category: 'hashedPII'
|
|
60
|
+
},
|
|
61
|
+
firstInitial: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
label: 'First Initial'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
gender: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
label: 'Gender',
|
|
70
|
+
description: 'User’s gender (m for male, f for female)',
|
|
71
|
+
category: 'hashedPII'
|
|
72
|
+
},
|
|
73
|
+
city: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
label: 'City',
|
|
76
|
+
description: 'User’s city. Use a-z only. No punctuation. No special characters.',
|
|
77
|
+
category: 'hashedPII'
|
|
78
|
+
},
|
|
79
|
+
state: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
label: 'State',
|
|
82
|
+
description: 'User’s state. Use the 2-character ANSI abbreviation code, Normalize states outside the US with no punctuation and no special characters.',
|
|
83
|
+
category: 'hashedPII'
|
|
84
|
+
},
|
|
85
|
+
zip: {
|
|
86
|
+
type: 'string',
|
|
87
|
+
label: 'Postal Code',
|
|
88
|
+
description: 'User’s postal code. For the US, use only the first 5 digits. For the UK, use the Area/District/Sector format.',
|
|
89
|
+
category: 'hashedPII'
|
|
90
|
+
},
|
|
91
|
+
country: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
label: 'Country',
|
|
94
|
+
description: 'User’s country. Use 2-letter country codes in ISO 3166-1 alpha-2 format.',
|
|
95
|
+
category: 'hashedPII'
|
|
96
|
+
},
|
|
97
|
+
mobileAdId: {
|
|
98
|
+
type: 'string',
|
|
99
|
+
label: 'Mobile Advertising ID',
|
|
100
|
+
description: 'User’s Apple IDFA, Android Ad ID, or Facebook app scoped ID. Keep hyphens (ex: AB1234CD-E123-12FG-J123)',
|
|
101
|
+
category: 'hashedPII'
|
|
102
|
+
},
|
|
103
|
+
appId: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
label: 'App ID',
|
|
106
|
+
description: 'The app ID of the user.',
|
|
107
|
+
category: 'hashedPII'
|
|
108
|
+
},
|
|
109
|
+
pageId: {
|
|
110
|
+
type: 'string',
|
|
111
|
+
label: 'Page ID',
|
|
112
|
+
description: 'The page ID of the user.',
|
|
113
|
+
category: 'hashedPII'
|
|
114
|
+
},
|
|
115
|
+
igAccountIds: {
|
|
116
|
+
type: 'string',
|
|
117
|
+
label: 'Instagram Account IDs',
|
|
118
|
+
description: 'The Instagram account ID of the user.',
|
|
119
|
+
category: 'hashedPII'
|
|
120
|
+
},
|
|
121
|
+
external_audience_id: {
|
|
122
|
+
label: 'Facebook List ID',
|
|
123
|
+
description: `The ID representing the Facebook identifier. This is the identifier that is returned during audience creation.'`,
|
|
124
|
+
type: 'string',
|
|
125
|
+
default: {
|
|
126
|
+
'@path': '$.context.personas.external_audience_id'
|
|
127
|
+
},
|
|
128
|
+
unsafe_hidden: true
|
|
129
|
+
},
|
|
130
|
+
enable_batching: {
|
|
131
|
+
label: 'Enable Batching',
|
|
132
|
+
description: 'Enable batching of requests.',
|
|
133
|
+
type: 'boolean',
|
|
134
|
+
default: true,
|
|
135
|
+
unsafe_hidden: true,
|
|
136
|
+
required: true
|
|
137
|
+
},
|
|
138
|
+
batch_size: {
|
|
139
|
+
label: 'Batch Size',
|
|
140
|
+
description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
|
|
141
|
+
type: 'number',
|
|
142
|
+
default: 10000,
|
|
143
|
+
unsafe_hidden: true,
|
|
144
|
+
required: true
|
|
145
|
+
},
|
|
146
|
+
engage_fields: {
|
|
147
|
+
label: 'Engage Audience Fields',
|
|
148
|
+
description: 'Field used for processing an Engage Audience. Segment uses these fields to determine if the payload is generated from an Engage Audience and to extract the necessary information for audience syncing. If these fields are empty the "Sync Mode" field will be used to determine if the payload is from an Engage Audience.',
|
|
149
|
+
type: 'object',
|
|
150
|
+
required: false,
|
|
151
|
+
properties: {
|
|
152
|
+
traits_or_properties: {
|
|
153
|
+
label: 'Traits or Properties',
|
|
154
|
+
description: 'Field used for processing an Engage Audience.',
|
|
155
|
+
type: 'object',
|
|
156
|
+
required: true
|
|
157
|
+
},
|
|
158
|
+
audience_key: {
|
|
159
|
+
label: 'Segment Audience Key',
|
|
160
|
+
description: 'Field used for processing an Engage Audience.',
|
|
161
|
+
type: 'string',
|
|
162
|
+
required: true
|
|
163
|
+
},
|
|
164
|
+
computation_class: {
|
|
165
|
+
label: 'Segment Computation Action',
|
|
166
|
+
description: "Field used to check if the payload is generated by an Engage Audience. values with 'audience' or 'journey_step' indicate an Engage audience.",
|
|
167
|
+
type: 'string',
|
|
168
|
+
required: true
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
default: {
|
|
172
|
+
traits_or_properties: {
|
|
173
|
+
'@if': {
|
|
174
|
+
exists: { '@path': '$.traits' },
|
|
175
|
+
then: { '@path': '$.traits' },
|
|
176
|
+
else: { '@path': '$.properties' }
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
audience_key: {
|
|
180
|
+
'@path': '$.context.personas.computation_key'
|
|
181
|
+
},
|
|
182
|
+
computation_class: {
|
|
183
|
+
'@path': '$.context.personas.computation_class'
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
exports.retlHookInputFields = {
|
|
189
|
+
operation: {
|
|
190
|
+
type: 'string',
|
|
191
|
+
label: 'Create a new custom audience or connect to an existing one?',
|
|
192
|
+
description: 'Choose to either create a new custom audience or use an existing one. If you opt to create a new audience, we will display the required fields for audience creation. If you opt to use an existing audience, a drop-down menu will appear, allowing you to select from all the custom audiences in your ad account.',
|
|
193
|
+
choices: [
|
|
194
|
+
{ label: 'Create New Audience', value: 'create' },
|
|
195
|
+
{ label: 'Connect to Existing Audience', value: 'existing' }
|
|
196
|
+
],
|
|
197
|
+
default: 'create'
|
|
198
|
+
},
|
|
199
|
+
audienceName: {
|
|
200
|
+
type: 'string',
|
|
201
|
+
label: 'Audience Creation Name',
|
|
202
|
+
description: 'The name of the audience in Facebook.',
|
|
203
|
+
depends_on: {
|
|
204
|
+
conditions: [
|
|
205
|
+
{
|
|
206
|
+
fieldKey: 'operation',
|
|
207
|
+
operator: 'is',
|
|
208
|
+
value: 'create'
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
existingAudienceId: {
|
|
214
|
+
type: 'string',
|
|
215
|
+
label: 'Existing Audience ID',
|
|
216
|
+
description: 'The ID of the audience in Facebook.',
|
|
217
|
+
depends_on: {
|
|
218
|
+
conditions: [
|
|
219
|
+
{
|
|
220
|
+
fieldKey: 'operation',
|
|
221
|
+
operator: 'is',
|
|
222
|
+
value: 'existing'
|
|
223
|
+
}
|
|
224
|
+
]
|
|
225
|
+
},
|
|
226
|
+
dynamic: hook_functions_1.getExistingAudienceIdChoices
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
exports.retlHookOutputTypes = {
|
|
230
|
+
audienceName: {
|
|
231
|
+
type: 'string',
|
|
232
|
+
label: 'Audience Name',
|
|
233
|
+
description: 'The name of the audience in Facebook this mapping is connected to.',
|
|
234
|
+
required: true
|
|
235
|
+
},
|
|
236
|
+
audienceId: {
|
|
237
|
+
type: 'string',
|
|
238
|
+
label: 'Audience ID',
|
|
239
|
+
description: 'The ID of the audience in Facebook.',
|
|
240
|
+
required: true
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-custom-audiences/sync/fields.ts"],"names":[],"mappings":";;;AAIA,qDAA+D;AAElD,QAAA,MAAM,GAA+B;IAChD,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,aAAa;QACpB,QAAQ,EAAE,WAAW;QACrB,WAAW,EACT,+IAA+I;KAClJ;IACD,K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AE;YACjD,EAAE,KAAK,EAAE,8BAA8B,EAAE,KAAK,EAAE,UAAU,EAAE;SAC7D;QACD,OAAO,EAAE,QAAQ;KAClB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,uCAAuC;QACpD,UAAU,EAAE;YACV,UAAU,EAAE;gBACV;oBACE,QAAQ,EAAE,WAAW;oBACrB,QAAQ,EAAE,IAAI;oBACd,KAAK,EAAE,QAAQ;iBAChB;aACF;SACF;KACF;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,qCAAqC;QAClD,UAAU,EAAE;YACV,UAAU,EAAE;gBACV;oBACE,QAAQ,EAAE,WAAW;oBACrB,QAAQ,EAAE,IAAI;oBACd,KAAK,EAAE,UAAU;iBAClB;aACF;SACF;QACD,OAAO,EAAE,6CAA4B;KACtC;CACF,CAAA;AAEY,QAAA,mBAAmB,GAMb;IACjB,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,oEAAoE;QACjF,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,qCAAqC;QAClD,QAAQ,EAAE,IAAI;KACf;CACF,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Payload } from './generated-types';
|
|
2
|
+
import { RequestClient, MultiStatusResponse } from '@segment/actions-core';
|
|
3
|
+
import { AudienceJSON, FacebookDataRow } from './types';
|
|
4
|
+
export declare function send(request: RequestClient, payloads: Payload[], isBatch: boolean, hookOutputs?: {
|
|
5
|
+
retlOnMappingSave?: {
|
|
6
|
+
outputs?: {
|
|
7
|
+
audienceId?: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
}, syncMode?: string): Promise<MultiStatusResponse | undefined>;
|
|
11
|
+
export declare function sendRequest(request: RequestClient, audienceId: string, map: Map<number, Payload>, msResponse: MultiStatusResponse, method: 'POST' | 'DELETE', isBatch: boolean): Promise<void>;
|
|
12
|
+
export declare function returnErrorResponse(msResponse: MultiStatusResponse, payloads: Payload[], isBatch: boolean, errorMessage: string): MultiStatusResponse;
|
|
13
|
+
export declare function getAudienceId(payload: Payload, hookOutputs?: {
|
|
14
|
+
retlOnMappingSave?: {
|
|
15
|
+
outputs?: {
|
|
16
|
+
audienceId?: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}): string;
|
|
20
|
+
export declare function isEngageAudience(payload: Payload): boolean;
|
|
21
|
+
export declare function hasSyncModevalue(syncMode: string | undefined): boolean;
|
|
22
|
+
export declare function getJSON(payloads: Payload[]): AudienceJSON;
|
|
23
|
+
export declare function validate(audienceId: unknown, isEngageAudience: boolean, hasSyncMode: boolean): string | undefined;
|
|
24
|
+
export declare function getData(payloads: Payload[]): FacebookDataRow[];
|
|
25
|
+
export declare function normalizePhone(value: string): string;
|
|
26
|
+
export declare function normalizeGender(value: string): string;
|
|
27
|
+
export declare function normalizeMonth(value: string): string;
|
|
28
|
+
export declare function normalizeName(value: string): string;
|
|
29
|
+
export declare function normalizeCity(value: string): string;
|
|
30
|
+
export declare function normalizeState(value: string): string;
|
|
31
|
+
export declare function normalizeZip(value: string): string;
|
|
32
|
+
export declare function normalizeCountry(value: string): string;
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.send = send;
|
|
4
|
+
exports.sendRequest = sendRequest;
|
|
5
|
+
exports.returnErrorResponse = returnErrorResponse;
|
|
6
|
+
exports.getAudienceId = getAudienceId;
|
|
7
|
+
exports.isEngageAudience = isEngageAudience;
|
|
8
|
+
exports.hasSyncModevalue = hasSyncModevalue;
|
|
9
|
+
exports.getJSON = getJSON;
|
|
10
|
+
exports.validate = validate;
|
|
11
|
+
exports.getData = getData;
|
|
12
|
+
exports.normalizePhone = normalizePhone;
|
|
13
|
+
exports.normalizeGender = normalizeGender;
|
|
14
|
+
exports.normalizeMonth = normalizeMonth;
|
|
15
|
+
exports.normalizeName = normalizeName;
|
|
16
|
+
exports.normalizeCity = normalizeCity;
|
|
17
|
+
exports.normalizeState = normalizeState;
|
|
18
|
+
exports.normalizeZip = normalizeZip;
|
|
19
|
+
exports.normalizeCountry = normalizeCountry;
|
|
20
|
+
const constants_1 = require("./constants");
|
|
21
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
22
|
+
const hashing_utils_1 = require("../../../lib/hashing-utils");
|
|
23
|
+
const constants_2 = require("../constants");
|
|
24
|
+
async function send(request, payloads, isBatch, hookOutputs, syncMode) {
|
|
25
|
+
const msResponse = new actions_core_1.MultiStatusResponse();
|
|
26
|
+
const audienceId = getAudienceId(payloads[0], hookOutputs);
|
|
27
|
+
const isEngage = isEngageAudience(payloads[0]);
|
|
28
|
+
const hasSyncMode = hasSyncModevalue(syncMode);
|
|
29
|
+
const errorMessage = validate(audienceId, isEngage, hasSyncMode);
|
|
30
|
+
if (errorMessage) {
|
|
31
|
+
return returnErrorResponse(msResponse, payloads, isBatch, errorMessage);
|
|
32
|
+
}
|
|
33
|
+
const addMap = new Map();
|
|
34
|
+
const deleteMap = new Map();
|
|
35
|
+
if (!isEngage) {
|
|
36
|
+
syncMode === 'delete'
|
|
37
|
+
? payloads.forEach((payload, index) => deleteMap.set(index, payload))
|
|
38
|
+
: payloads.forEach((payload, index) => addMap.set(index, payload));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
payloads.forEach((payload, index) => {
|
|
42
|
+
const { engage_fields: { traits_or_properties, audience_key } = {} } = payload;
|
|
43
|
+
const isAudienceMember = traits_or_properties && typeof audience_key === 'string' && traits_or_properties[audience_key] === true;
|
|
44
|
+
if (isAudienceMember) {
|
|
45
|
+
addMap.set(index, payload);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
deleteMap.set(index, payload);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const requests = [];
|
|
53
|
+
if (addMap.size > 0) {
|
|
54
|
+
requests.push(sendRequest(request, audienceId, addMap, msResponse, 'POST', isBatch));
|
|
55
|
+
}
|
|
56
|
+
if (deleteMap.size > 0) {
|
|
57
|
+
requests.push(sendRequest(request, audienceId, deleteMap, msResponse, 'DELETE', isBatch));
|
|
58
|
+
}
|
|
59
|
+
await Promise.all(requests);
|
|
60
|
+
if (isBatch) {
|
|
61
|
+
return msResponse;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function sendRequest(request, audienceId, map, msResponse, method, isBatch) {
|
|
65
|
+
const indices = Array.from(map.keys());
|
|
66
|
+
const payloads = Array.from(map.values());
|
|
67
|
+
const json = getJSON(payloads);
|
|
68
|
+
try {
|
|
69
|
+
await request(`${constants_2.BASE_URL}/${constants_2.API_VERSION}/${audienceId}/users`, {
|
|
70
|
+
method,
|
|
71
|
+
json
|
|
72
|
+
});
|
|
73
|
+
for (let i = 0; i < indices.length; i++) {
|
|
74
|
+
const originalIndex = indices[i];
|
|
75
|
+
msResponse.setSuccessResponseAtIndex(originalIndex, {
|
|
76
|
+
status: 200,
|
|
77
|
+
body: payloads[i],
|
|
78
|
+
sent: {
|
|
79
|
+
data: json.payload.data[i],
|
|
80
|
+
method,
|
|
81
|
+
audienceId
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
const { response: { status = 500, data: { error: { message: facebookMessage = undefined, code: errorCode = 400, type: errorType = 'FACEBOOK_API_ERROR' } = {} } = {} } = {}, message: genericMessage } = error || {};
|
|
88
|
+
const message = facebookMessage || genericMessage || 'Unknown error';
|
|
89
|
+
const errorMessage = errorCode ? `${message} (code: ${errorCode})` : message;
|
|
90
|
+
if (!isBatch) {
|
|
91
|
+
throw new actions_core_1.IntegrationError(errorMessage, errorType, errorCode);
|
|
92
|
+
}
|
|
93
|
+
for (let i = 0; i < indices.length; i++) {
|
|
94
|
+
const originalIndex = indices[i];
|
|
95
|
+
msResponse.setErrorResponseAtIndex(originalIndex, {
|
|
96
|
+
status,
|
|
97
|
+
errortype: errorType,
|
|
98
|
+
errormessage: errorMessage,
|
|
99
|
+
body: payloads[i],
|
|
100
|
+
sent: {
|
|
101
|
+
data: json.payload.data[i],
|
|
102
|
+
method,
|
|
103
|
+
audienceId
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function returnErrorResponse(msResponse, payloads, isBatch, errorMessage) {
|
|
110
|
+
if (isBatch) {
|
|
111
|
+
payloads.forEach((payload, i) => {
|
|
112
|
+
msResponse.setErrorResponseAtIndex(i, {
|
|
113
|
+
status: 400,
|
|
114
|
+
errortype: 'PAYLOAD_VALIDATION_FAILED',
|
|
115
|
+
errormessage: errorMessage,
|
|
116
|
+
body: payload
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
return msResponse;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
throw new actions_core_1.PayloadValidationError(errorMessage);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function getAudienceId(payload, hookOutputs) {
|
|
126
|
+
const { retlOnMappingSave: { outputs: { audienceId: hookAudienceId = undefined } = {} } = {} } = hookOutputs ?? {};
|
|
127
|
+
const { external_audience_id: payloadAudienceId } = payload;
|
|
128
|
+
return (hookAudienceId ?? payloadAudienceId);
|
|
129
|
+
}
|
|
130
|
+
function isEngageAudience(payload) {
|
|
131
|
+
const { engage_fields: { computation_class, audience_key, traits_or_properties } = {} } = payload;
|
|
132
|
+
return typeof traits_or_properties === 'object' &&
|
|
133
|
+
audience_key &&
|
|
134
|
+
computation_class &&
|
|
135
|
+
['audience', 'journey_step'].includes(computation_class)
|
|
136
|
+
? true
|
|
137
|
+
: false;
|
|
138
|
+
}
|
|
139
|
+
function hasSyncModevalue(syncMode) {
|
|
140
|
+
return typeof syncMode === 'string' && ['upsert', 'delete'].includes(syncMode) ? true : false;
|
|
141
|
+
}
|
|
142
|
+
function getJSON(payloads) {
|
|
143
|
+
const data = getData(payloads);
|
|
144
|
+
const app_ids = [];
|
|
145
|
+
const page_ids = [];
|
|
146
|
+
const ig_account_ids = [];
|
|
147
|
+
payloads.forEach((payload) => {
|
|
148
|
+
const { appId, pageId, igAccountIds } = payload;
|
|
149
|
+
app_ids.push(typeof appId === 'string' && appId ? appId : '');
|
|
150
|
+
page_ids.push(typeof pageId === 'string' && pageId ? pageId : '');
|
|
151
|
+
ig_account_ids.push(typeof igAccountIds === 'string' && igAccountIds ? igAccountIds : '');
|
|
152
|
+
});
|
|
153
|
+
return {
|
|
154
|
+
payload: {
|
|
155
|
+
schema: constants_1.SCHEMA_PROPERTIES,
|
|
156
|
+
data,
|
|
157
|
+
...(app_ids?.some((id) => id?.trim() !== '') ? { app_ids } : {}),
|
|
158
|
+
...(page_ids?.some((id) => id?.trim() !== '') ? { page_ids } : {}),
|
|
159
|
+
...(ig_account_ids?.some((id) => id?.trim() !== '') ? { ig_account_ids } : {})
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function validate(audienceId, isEngageAudience, hasSyncMode) {
|
|
164
|
+
if (!audienceId || typeof audienceId !== 'string') {
|
|
165
|
+
return 'Missing audience ID.';
|
|
166
|
+
}
|
|
167
|
+
if (!isEngageAudience && !hasSyncMode) {
|
|
168
|
+
return 'Audience payloads should have a Sync mode value, or should be sent from Engage.';
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function getData(payloads) {
|
|
172
|
+
const data = new Array(payloads.length);
|
|
173
|
+
payloads.forEach((payload, index) => {
|
|
174
|
+
const { externalId, email, phone, birth: { year, month, day } = {}, name: { last, first, firstInitial } = {}, gender, city, state, zip, country, mobileAdId } = payload;
|
|
175
|
+
const row = [
|
|
176
|
+
externalId ?? '',
|
|
177
|
+
email ? (0, hashing_utils_1.processHashing)(email.trim().toLowerCase(), 'sha256', 'hex') : '',
|
|
178
|
+
phone ? (0, hashing_utils_1.processHashing)(phone, 'sha256', 'hex', normalizePhone) ?? '' : '',
|
|
179
|
+
year ? (0, hashing_utils_1.processHashing)(year.trim(), 'sha256', 'hex') ?? '' : '',
|
|
180
|
+
month ? (0, hashing_utils_1.processHashing)(normalizeMonth(month), 'sha256', 'hex') ?? '' : '',
|
|
181
|
+
day ? (0, hashing_utils_1.processHashing)(day.trim(), 'sha256', 'hex') ?? '' : '',
|
|
182
|
+
last ? (0, hashing_utils_1.processHashing)(normalizeName(last), 'sha256', 'hex') ?? '' : '',
|
|
183
|
+
first ? (0, hashing_utils_1.processHashing)(normalizeName(first), 'sha256', 'hex') ?? '' : '',
|
|
184
|
+
firstInitial ? (0, hashing_utils_1.processHashing)(firstInitial.trim().toLowerCase(), 'sha256', 'hex') ?? '' : '',
|
|
185
|
+
gender ? (0, hashing_utils_1.processHashing)(normalizeGender(gender), 'sha256', 'hex') ?? '' : '',
|
|
186
|
+
city ? (0, hashing_utils_1.processHashing)(normalizeCity(city), 'sha256', 'hex') ?? '' : '',
|
|
187
|
+
state ? (0, hashing_utils_1.processHashing)(normalizeState(state), 'sha256', 'hex') ?? '' : '',
|
|
188
|
+
zip ? (0, hashing_utils_1.processHashing)(normalizeZip(zip), 'sha256', 'hex') ?? '' : '',
|
|
189
|
+
country ? (0, hashing_utils_1.processHashing)(normalizeCountry(country), 'sha256', 'hex') ?? '' : '',
|
|
190
|
+
mobileAdId ?? ''
|
|
191
|
+
];
|
|
192
|
+
data[index] = row;
|
|
193
|
+
});
|
|
194
|
+
return data;
|
|
195
|
+
}
|
|
196
|
+
function normalizePhone(value) {
|
|
197
|
+
const removedNonNumveric = value.replace(/\D/g, '');
|
|
198
|
+
return removedNonNumveric.replace(/^0+/, '');
|
|
199
|
+
}
|
|
200
|
+
function normalizeGender(value) {
|
|
201
|
+
const lowerCaseValue = value.toLowerCase().trim();
|
|
202
|
+
if (['male', 'boy', 'm'].includes(lowerCaseValue))
|
|
203
|
+
return 'm';
|
|
204
|
+
if (['female', 'woman', 'girl', 'f'].includes(lowerCaseValue))
|
|
205
|
+
return 'f';
|
|
206
|
+
return value;
|
|
207
|
+
}
|
|
208
|
+
function normalizeMonth(value) {
|
|
209
|
+
const normalizedValue = value.replace(/\s/g, '').trim();
|
|
210
|
+
if (normalizedValue.length === 2 && typeof Number(normalizedValue) === 'number') {
|
|
211
|
+
return normalizedValue;
|
|
212
|
+
}
|
|
213
|
+
const lowerCaseValue = value.trim().toLowerCase();
|
|
214
|
+
const months = [
|
|
215
|
+
'january',
|
|
216
|
+
'february',
|
|
217
|
+
'march',
|
|
218
|
+
'april',
|
|
219
|
+
'may',
|
|
220
|
+
'june',
|
|
221
|
+
'july',
|
|
222
|
+
'august',
|
|
223
|
+
'september',
|
|
224
|
+
'october',
|
|
225
|
+
'november',
|
|
226
|
+
'december'
|
|
227
|
+
];
|
|
228
|
+
const monthIndex = months.indexOf(lowerCaseValue);
|
|
229
|
+
if (monthIndex === -1) {
|
|
230
|
+
return value;
|
|
231
|
+
}
|
|
232
|
+
if (monthIndex < 9) {
|
|
233
|
+
return `0${monthIndex + 1}`;
|
|
234
|
+
}
|
|
235
|
+
return `${monthIndex + 1}`;
|
|
236
|
+
}
|
|
237
|
+
function normalizeName(value) {
|
|
238
|
+
return value.trim().toLowerCase().replace(/\p{P}/gu, '');
|
|
239
|
+
}
|
|
240
|
+
function normalizeCity(value) {
|
|
241
|
+
return value
|
|
242
|
+
.trim()
|
|
243
|
+
.replace(/[\s\W_]/g, '')
|
|
244
|
+
.toLowerCase();
|
|
245
|
+
}
|
|
246
|
+
function normalizeState(value) {
|
|
247
|
+
if (constants_1.US_STATE_CODES.has(value.toLowerCase().trim())) {
|
|
248
|
+
return constants_1.US_STATE_CODES.get(value.toLowerCase().trim());
|
|
249
|
+
}
|
|
250
|
+
return value
|
|
251
|
+
.trim()
|
|
252
|
+
.replace(/[\s\W_]/g, '')
|
|
253
|
+
.toLowerCase();
|
|
254
|
+
}
|
|
255
|
+
function normalizeZip(value) {
|
|
256
|
+
if (value.includes('-')) {
|
|
257
|
+
return value.split('-')[0];
|
|
258
|
+
}
|
|
259
|
+
return value.trim().replace(/\s/g, '').toLowerCase();
|
|
260
|
+
}
|
|
261
|
+
function normalizeCountry(value) {
|
|
262
|
+
return value
|
|
263
|
+
.trim()
|
|
264
|
+
.replace(/[\s\W_]/g, '')
|
|
265
|
+
.toLowerCase();
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../src/destinations/facebook-custom-audiences/sync/functions.ts"],"names":[],"mappings":";;AAQA,oBAsDC;AAED,kCAkEC;AAED,kDAmBC;AAED,sCASC;AAED,4CASC;AAED,4CAEC;AAED,0BAsBC;AAED,4BAQC;AAED,0BAwCC;AAED,wCAIC;AAED,0CAOC;AAED,wCAiCC;AAED,sCAEC;AAED,sCAKC;AAED,wCASC;AAED,oCAMC;AAED,4CAKC;AApVD,2CAA+D;AAE/D,wDAAoH;AAEpH,8DAA2D;AAE3D,4CAAoD;AAE7C,KAAK,UAAU,IAAI,CACxB,OAAsB,EACtB,QAAmB,EACnB,OAAgB,EAChB,WAA2E,EAC3E,QAAiB;IAEjB,MAAM,UAAU,GAAG,IAAI,kCAAmB,EAAE,CAAA;IAC5C,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAA;IAC1D,MAAM,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9C,MAAM,WAAW,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IAC9C,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,EAAE,QAAQ,EAAE,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AAW,EAAE,CAAC,IAAI,EAAE,CAAW,CAAA;IACjE,CAAC;IAED,OAAO,KAAK;SACT,IAAI,EAAE;SACN,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,WAAW,EAAE,CAAA;AAClB,CAAC;AAED,SAAgB,YAAY,CAAC,KAAa;IACxC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5B,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;AACtD,CAAC;AAED,SAAgB,gBAAgB,CAAC,KAAa;IAC5C,OAAO,KAAK;SACT,IAAI,EAAE;SACN,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,WAAW,EAAE,CAAA;AAClB,CAAC"}
|
|
@@ -2,7 +2,6 @@ export interface Payload {
|
|
|
2
2
|
externalId: string;
|
|
3
3
|
email?: string;
|
|
4
4
|
phone?: string;
|
|
5
|
-
country?: string;
|
|
6
5
|
birth?: {
|
|
7
6
|
year?: string;
|
|
8
7
|
month?: string;
|
|
@@ -13,16 +12,25 @@ export interface Payload {
|
|
|
13
12
|
last?: string;
|
|
14
13
|
firstInitial?: string;
|
|
15
14
|
};
|
|
15
|
+
gender?: string;
|
|
16
16
|
city?: string;
|
|
17
17
|
state?: string;
|
|
18
18
|
zip?: string;
|
|
19
|
-
|
|
19
|
+
country?: string;
|
|
20
20
|
mobileAdId?: string;
|
|
21
21
|
appId?: string;
|
|
22
22
|
pageId?: string;
|
|
23
|
+
igAccountIds?: string;
|
|
23
24
|
external_audience_id?: string;
|
|
24
25
|
enable_batching: boolean;
|
|
25
26
|
batch_size: number;
|
|
27
|
+
engage_fields?: {
|
|
28
|
+
traits_or_properties: {
|
|
29
|
+
[k: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
audience_key: string;
|
|
32
|
+
computation_class: string;
|
|
33
|
+
};
|
|
26
34
|
}
|
|
27
35
|
export interface RetlOnMappingSaveInputs {
|
|
28
36
|
operation?: string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { RequestClient } from '@segment/actions-core';
|
|
2
|
+
import type { DynamicFieldItem, DynamicFieldError } from '@segment/actions-core';
|
|
3
|
+
import { Settings } from '../generated-types';
|
|
4
|
+
export declare function performHook(request: RequestClient, adAccountId: string, operation?: string, audienceName?: string, existingAudienceId?: string): Promise<{
|
|
5
|
+
error: {
|
|
6
|
+
message: string;
|
|
7
|
+
code: string;
|
|
8
|
+
};
|
|
9
|
+
choices?: undefined;
|
|
10
|
+
successMessage?: undefined;
|
|
11
|
+
savedData?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
error: {
|
|
14
|
+
message: string;
|
|
15
|
+
code: string;
|
|
16
|
+
};
|
|
17
|
+
choices: never[];
|
|
18
|
+
successMessage?: undefined;
|
|
19
|
+
savedData?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
successMessage: string;
|
|
22
|
+
savedData: {
|
|
23
|
+
audienceId: string | undefined;
|
|
24
|
+
audienceName: string;
|
|
25
|
+
};
|
|
26
|
+
error?: undefined;
|
|
27
|
+
choices?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
successMessage: string;
|
|
30
|
+
savedData: {
|
|
31
|
+
audienceId: string;
|
|
32
|
+
audienceName: string | undefined;
|
|
33
|
+
};
|
|
34
|
+
error?: undefined;
|
|
35
|
+
choices?: undefined;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function getExistingAudienceIdChoices(request: RequestClient, { settings }: {
|
|
38
|
+
settings: Settings;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
error: DynamicFieldError;
|
|
41
|
+
choices: never[];
|
|
42
|
+
} | {
|
|
43
|
+
choices: DynamicFieldItem[];
|
|
44
|
+
error?: undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export declare function getAllAudiences(request: RequestClient, adAccountId: string): Promise<{
|
|
47
|
+
choices: DynamicFieldItem[];
|
|
48
|
+
error?: DynamicFieldError;
|
|
49
|
+
}>;
|