@segment/analytics-browser-actions-facebook-conversions-api-web 1.0.1-staging-0104ee0bb.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/README.md +31 -0
- package/dist/cjs/generated-types.d.ts +5 -0
- package/dist/cjs/generated-types.js +3 -0
- package/dist/cjs/generated-types.js.map +1 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.js +191 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/init-script.d.ts +2 -0
- package/dist/cjs/init-script.js +41 -0
- package/dist/cjs/init-script.js.map +1 -0
- package/dist/cjs/send/constants.d.ts +3 -0
- package/dist/cjs/send/constants.js +484 -0
- package/dist/cjs/send/constants.js.map +1 -0
- package/dist/cjs/send/depends-on.d.ts +5 -0
- package/dist/cjs/send/depends-on.js +46 -0
- package/dist/cjs/send/depends-on.js.map +1 -0
- package/dist/cjs/send/fields.d.ts +39 -0
- package/dist/cjs/send/fields.js +383 -0
- package/dist/cjs/send/fields.js.map +1 -0
- package/dist/cjs/send/generated-types.d.ts +43 -0
- package/dist/cjs/send/generated-types.js +3 -0
- package/dist/cjs/send/generated-types.js.map +1 -0
- package/dist/cjs/send/index.d.ts +6 -0
- package/dist/cjs/send/index.js +37 -0
- package/dist/cjs/send/index.js.map +1 -0
- package/dist/cjs/send/utils.d.ts +8 -0
- package/dist/cjs/send/utils.js +79 -0
- package/dist/cjs/send/utils.js.map +1 -0
- package/dist/cjs/send/validate.d.ts +2 -0
- package/dist/cjs/send/validate.js +12 -0
- package/dist/cjs/send/validate.js.map +1 -0
- package/dist/cjs/types.d.ts +132 -0
- package/dist/cjs/types.js +30 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/generated-types.d.ts +5 -0
- package/dist/esm/generated-types.js +2 -0
- package/dist/esm/generated-types.js.map +1 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.js +187 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/init-script.d.ts +2 -0
- package/dist/esm/init-script.js +38 -0
- package/dist/esm/init-script.js.map +1 -0
- package/dist/esm/send/constants.d.ts +3 -0
- package/dist/esm/send/constants.js +481 -0
- package/dist/esm/send/constants.js.map +1 -0
- package/dist/esm/send/depends-on.d.ts +5 -0
- package/dist/esm/send/depends-on.js +41 -0
- package/dist/esm/send/depends-on.js.map +1 -0
- package/dist/esm/send/fields.d.ts +39 -0
- package/dist/esm/send/fields.js +380 -0
- package/dist/esm/send/fields.js.map +1 -0
- package/dist/esm/send/generated-types.d.ts +43 -0
- package/dist/esm/send/generated-types.js +2 -0
- package/dist/esm/send/generated-types.js.map +1 -0
- package/dist/esm/send/index.d.ts +6 -0
- package/dist/esm/send/index.js +35 -0
- package/dist/esm/send/index.js.map +1 -0
- package/dist/esm/send/utils.d.ts +8 -0
- package/dist/esm/send/utils.js +74 -0
- package/dist/esm/send/utils.js.map +1 -0
- package/dist/esm/send/validate.d.ts +2 -0
- package/dist/esm/send/validate.js +9 -0
- package/dist/esm/send/validate.js.map +1 -0
- package/dist/esm/types.d.ts +132 -0
- package/dist/esm/types.js +27 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +25 -0
- package/src/generated-types.ts +16 -0
- package/src/index.ts +205 -0
- package/src/init-script.ts +40 -0
- package/src/send/constants.ts +482 -0
- package/src/send/depends-on.ts +47 -0
- package/src/send/fields.ts +400 -0
- package/src/send/generated-types.ts +150 -0
- package/src/send/index.ts +64 -0
- package/src/send/utils.ts +90 -0
- package/src/send/validate.ts +15 -0
- package/src/types.ts +117 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AllFields = exports.userData = exports.actionSource = exports.eventSourceUrl = exports.eventID = exports.custom_data = exports.value = exports.status = exports.search_string = exports.predicted_ltv = exports.num_items = exports.delivery_category = exports.currency = exports.contents = exports.content_type = exports.content_name = exports.content_ids = exports.content_category = exports.event_config = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const depends_on_1 = require("./depends-on");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
exports.event_config = {
|
|
8
|
+
label: 'Event Configuration',
|
|
9
|
+
description: 'Specify the type of Facebook Conversions API event to send.',
|
|
10
|
+
type: 'object',
|
|
11
|
+
required: true,
|
|
12
|
+
additionalProperties: false,
|
|
13
|
+
properties: {
|
|
14
|
+
event_name: {
|
|
15
|
+
label: 'Event Name',
|
|
16
|
+
description: "Facebook Conversions API Event Name to send. Select 'Custom Event' to send a non standard event.",
|
|
17
|
+
type: 'string',
|
|
18
|
+
required: true,
|
|
19
|
+
choices: [
|
|
20
|
+
{ label: 'Custom Event', value: 'CustomEvent' },
|
|
21
|
+
{ label: 'Add Payment Info', value: 'AddPaymentInfo' },
|
|
22
|
+
{ label: 'Add To Cart', value: 'AddToCart' },
|
|
23
|
+
{ label: 'Add To Wishlist', value: 'AddToWishlist' },
|
|
24
|
+
{ label: 'Complete Registration', value: 'CompleteRegistration' },
|
|
25
|
+
{ label: 'Contact', value: 'Contact' },
|
|
26
|
+
{ label: 'Customize Product', value: 'CustomizeProduct' },
|
|
27
|
+
{ label: 'Donate', value: 'Donate' },
|
|
28
|
+
{ label: 'Find Location', value: 'FindLocation' },
|
|
29
|
+
{ label: 'Initiate Checkout', value: 'InitiateCheckout' },
|
|
30
|
+
{ label: 'Lead', value: 'Lead' },
|
|
31
|
+
{ label: 'Purchase', value: 'Purchase' },
|
|
32
|
+
{ label: 'Schedule', value: 'Schedule' },
|
|
33
|
+
{ label: 'Search', value: 'Search' },
|
|
34
|
+
{ label: 'Start Trial', value: 'StartTrial' },
|
|
35
|
+
{ label: 'Submit Application', value: 'SubmitApplication' },
|
|
36
|
+
{ label: 'Subscribe', value: 'Subscribe' },
|
|
37
|
+
{ label: 'View Content', value: 'ViewContent' }
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
custom_event_name: {
|
|
41
|
+
label: 'Custom Event Name',
|
|
42
|
+
description: 'Custom event name to send to Facebook',
|
|
43
|
+
type: 'string',
|
|
44
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('custom_event_name')
|
|
45
|
+
},
|
|
46
|
+
show_fields: {
|
|
47
|
+
label: 'Show all fields',
|
|
48
|
+
description: 'Show all fields, even those which are not relevant to the selected Event Name.',
|
|
49
|
+
type: 'boolean',
|
|
50
|
+
default: false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
default: {
|
|
54
|
+
show_fields: false,
|
|
55
|
+
custom_event_name: { '@path': '$.event' }
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.content_category = {
|
|
59
|
+
label: 'Content Category',
|
|
60
|
+
description: 'The category of the content associated with the event.',
|
|
61
|
+
type: 'string',
|
|
62
|
+
default: { '@path': '$.properties.category' },
|
|
63
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('content_category')
|
|
64
|
+
};
|
|
65
|
+
exports.content_ids = {
|
|
66
|
+
label: 'Content IDs',
|
|
67
|
+
description: "Product IDs associated with the event, such as SKUs (e.g. ['ABC123', 'XYZ789']). Accepts a single string value or array of strings.",
|
|
68
|
+
type: 'string',
|
|
69
|
+
multiple: true,
|
|
70
|
+
allowNull: false,
|
|
71
|
+
minimum: 1,
|
|
72
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('content_ids'),
|
|
73
|
+
required: {
|
|
74
|
+
match: 'all',
|
|
75
|
+
conditions: [
|
|
76
|
+
{
|
|
77
|
+
fieldKey: 'event_config.event_name',
|
|
78
|
+
operator: 'is',
|
|
79
|
+
value: ['AddToCart', 'Purchase', 'ViewContent']
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
fieldKey: 'contents',
|
|
83
|
+
operator: 'is_not',
|
|
84
|
+
value: undefined
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
fieldKey: 'contents',
|
|
88
|
+
operator: 'is_not',
|
|
89
|
+
value: ''
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
exports.content_name = {
|
|
95
|
+
label: 'Content Name',
|
|
96
|
+
description: 'The name of the page or product associated with the event.',
|
|
97
|
+
type: 'string',
|
|
98
|
+
default: { '@path': '$.properties.name' },
|
|
99
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('content_name')
|
|
100
|
+
};
|
|
101
|
+
exports.content_type = {
|
|
102
|
+
label: 'Content Type',
|
|
103
|
+
description: 'If the IDs being passed in content_ids or contents parameter are IDs of products, then the value should be product. If product group IDs are being passed, then the value should be product_group. If no content_type is provided, Meta will match the event to every item that has the same ID, independent of its type.',
|
|
104
|
+
type: 'string',
|
|
105
|
+
choices: [
|
|
106
|
+
{ value: 'product', label: 'Product' },
|
|
107
|
+
{ value: 'product_group', label: 'Product Group' }
|
|
108
|
+
],
|
|
109
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('content_type')
|
|
110
|
+
};
|
|
111
|
+
exports.contents = {
|
|
112
|
+
label: 'Contents',
|
|
113
|
+
description: 'A list of JSON objects that contain the product IDs associated with the event plus information about the products. ID and quantity are required fields.',
|
|
114
|
+
type: 'object',
|
|
115
|
+
multiple: true,
|
|
116
|
+
allowNull: false,
|
|
117
|
+
minimum: 1,
|
|
118
|
+
additionalProperties: true,
|
|
119
|
+
properties: {
|
|
120
|
+
id: {
|
|
121
|
+
label: 'ID',
|
|
122
|
+
description: 'The product ID of the purchased item.',
|
|
123
|
+
type: 'string',
|
|
124
|
+
required: true
|
|
125
|
+
},
|
|
126
|
+
quantity: {
|
|
127
|
+
label: 'Quantity',
|
|
128
|
+
description: 'The number of items purchased.',
|
|
129
|
+
type: 'integer',
|
|
130
|
+
required: true
|
|
131
|
+
},
|
|
132
|
+
item_price: {
|
|
133
|
+
label: 'Item Price',
|
|
134
|
+
description: 'The price of the item.',
|
|
135
|
+
type: 'number'
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
default: {
|
|
139
|
+
'@arrayPath': [
|
|
140
|
+
'$.properties.products',
|
|
141
|
+
{
|
|
142
|
+
id: { '@path': '$.id' },
|
|
143
|
+
quantity: { '@path': '$.quantity' },
|
|
144
|
+
item_price: { '@path': '$.price' }
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('contents'),
|
|
149
|
+
required: {
|
|
150
|
+
match: 'all',
|
|
151
|
+
conditions: [
|
|
152
|
+
{
|
|
153
|
+
fieldKey: 'event_config.event_name',
|
|
154
|
+
operator: 'is',
|
|
155
|
+
value: ['AddToCart', 'Purchase', 'ViewContent']
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
fieldKey: 'content_ids',
|
|
159
|
+
operator: 'is_not',
|
|
160
|
+
value: undefined
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
fieldKey: 'content_ids',
|
|
164
|
+
operator: 'is_not',
|
|
165
|
+
value: ''
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
exports.currency = {
|
|
171
|
+
label: 'Currency',
|
|
172
|
+
description: 'The currency for the value specified. Currency must be a valid ISO 4217 three-digit currency code.',
|
|
173
|
+
type: 'string',
|
|
174
|
+
default: { '@path': '$.properties.currency' },
|
|
175
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('currency'),
|
|
176
|
+
choices: (() => {
|
|
177
|
+
return [...constants_1.CURRENCY_ISO_CODES].map(code => ({
|
|
178
|
+
value: code,
|
|
179
|
+
label: code
|
|
180
|
+
}));
|
|
181
|
+
})(),
|
|
182
|
+
required: {
|
|
183
|
+
match: 'all',
|
|
184
|
+
conditions: [
|
|
185
|
+
{
|
|
186
|
+
fieldKey: 'event_config.event_name',
|
|
187
|
+
operator: 'is',
|
|
188
|
+
value: 'Purchase'
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
exports.delivery_category = {
|
|
194
|
+
label: 'Delivery Category',
|
|
195
|
+
description: 'Category of the delivery',
|
|
196
|
+
type: 'string',
|
|
197
|
+
choices: [
|
|
198
|
+
{ value: 'in_store', label: 'In Store' },
|
|
199
|
+
{ value: 'curbside', label: 'Curbside' },
|
|
200
|
+
{ value: 'home_delivery', label: 'Home Delivery' }
|
|
201
|
+
],
|
|
202
|
+
default: 'home_delivery',
|
|
203
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('delivery_category')
|
|
204
|
+
};
|
|
205
|
+
exports.num_items = {
|
|
206
|
+
label: 'Number of Items',
|
|
207
|
+
description: 'The number of items when checkout was initiated.',
|
|
208
|
+
type: 'integer',
|
|
209
|
+
default: { '@path': '$.properties.quantity' },
|
|
210
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('num_items')
|
|
211
|
+
};
|
|
212
|
+
exports.predicted_ltv = {
|
|
213
|
+
label: 'Predicted LTV',
|
|
214
|
+
description: 'Predicted lifetime value of a subscriber as defined by the advertiser and expressed as an exact value.',
|
|
215
|
+
type: 'number',
|
|
216
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('predicted_ltv')
|
|
217
|
+
};
|
|
218
|
+
exports.search_string = {
|
|
219
|
+
label: 'Search String',
|
|
220
|
+
description: 'The string entered by the user for the search.',
|
|
221
|
+
type: 'string',
|
|
222
|
+
default: { '@path': '$.properties.query' },
|
|
223
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('search_string')
|
|
224
|
+
};
|
|
225
|
+
exports.status = {
|
|
226
|
+
label: 'Registration Status',
|
|
227
|
+
description: 'The status of the registration. true for completed registrations, false otherwise.',
|
|
228
|
+
type: 'boolean',
|
|
229
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('status')
|
|
230
|
+
};
|
|
231
|
+
exports.value = {
|
|
232
|
+
label: 'Value',
|
|
233
|
+
description: 'A numeric value associated with this event. This could be a monetary value or a value in some other metric.',
|
|
234
|
+
type: 'number',
|
|
235
|
+
default: { '@path': '$.properties.currency' },
|
|
236
|
+
depends_on: (0, depends_on_1.getDependenciesFor)('value'),
|
|
237
|
+
required: {
|
|
238
|
+
match: 'all',
|
|
239
|
+
conditions: [
|
|
240
|
+
{
|
|
241
|
+
fieldKey: 'event_config.event_name',
|
|
242
|
+
operator: 'is',
|
|
243
|
+
value: 'Purchase'
|
|
244
|
+
}
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
exports.custom_data = {
|
|
249
|
+
label: 'Custom Data',
|
|
250
|
+
description: 'The custom data object can be used to pass custom properties.',
|
|
251
|
+
type: 'object',
|
|
252
|
+
additionalProperties: true,
|
|
253
|
+
defaultObjectUI: 'keyvalue'
|
|
254
|
+
};
|
|
255
|
+
exports.eventID = {
|
|
256
|
+
label: 'Event ID',
|
|
257
|
+
description: 'This ID can be any unique string. Event ID is used to deduplicate events sent by both Facebook Pixel and Conversions API.',
|
|
258
|
+
type: 'string',
|
|
259
|
+
default: { '@path': '$.messageId' }
|
|
260
|
+
};
|
|
261
|
+
exports.eventSourceUrl = {
|
|
262
|
+
label: 'Event Source URL',
|
|
263
|
+
description: 'The URL of the page where the event occurred. Can be used to override the default URL taken from the current page.',
|
|
264
|
+
type: 'string',
|
|
265
|
+
default: { '@path': '$.context.page.url' }
|
|
266
|
+
};
|
|
267
|
+
exports.actionSource = {
|
|
268
|
+
label: 'Action Source',
|
|
269
|
+
description: 'The source of the event. This can be used to specify where the event originated from.',
|
|
270
|
+
type: 'string',
|
|
271
|
+
choices: [
|
|
272
|
+
{ label: 'Email', value: types_1.ACTION_SOURCES.email },
|
|
273
|
+
{ label: 'Website', value: types_1.ACTION_SOURCES.website },
|
|
274
|
+
{ label: 'App', value: types_1.ACTION_SOURCES.app },
|
|
275
|
+
{ label: 'Phone Call', value: types_1.ACTION_SOURCES.phone_call },
|
|
276
|
+
{ label: 'Chat', value: types_1.ACTION_SOURCES.chat },
|
|
277
|
+
{ label: 'Physical Store', value: types_1.ACTION_SOURCES.physical_store },
|
|
278
|
+
{ label: 'System Generated', value: types_1.ACTION_SOURCES.system_generated },
|
|
279
|
+
{ label: 'Other', value: types_1.ACTION_SOURCES.other }
|
|
280
|
+
],
|
|
281
|
+
default: types_1.ACTION_SOURCES.website
|
|
282
|
+
};
|
|
283
|
+
exports.userData = {
|
|
284
|
+
label: 'User Data',
|
|
285
|
+
description: 'User data to be sent with the event. This can include hashed identifiers like email, phone number, etc.',
|
|
286
|
+
type: 'object',
|
|
287
|
+
properties: {
|
|
288
|
+
external_id: {
|
|
289
|
+
label: 'External ID',
|
|
290
|
+
description: 'A unique identifier for the user from your system',
|
|
291
|
+
type: 'string'
|
|
292
|
+
},
|
|
293
|
+
em: {
|
|
294
|
+
label: 'Email',
|
|
295
|
+
description: 'Email address of the user',
|
|
296
|
+
type: 'string',
|
|
297
|
+
format: 'email'
|
|
298
|
+
},
|
|
299
|
+
ph: {
|
|
300
|
+
label: 'Phone Number',
|
|
301
|
+
description: 'Phone number of the user',
|
|
302
|
+
type: 'string'
|
|
303
|
+
},
|
|
304
|
+
fn: {
|
|
305
|
+
label: 'First Name',
|
|
306
|
+
description: 'First name of the user',
|
|
307
|
+
type: 'string'
|
|
308
|
+
},
|
|
309
|
+
ln: {
|
|
310
|
+
label: 'Last Name',
|
|
311
|
+
description: 'Last name of the user',
|
|
312
|
+
type: 'string'
|
|
313
|
+
},
|
|
314
|
+
ge: {
|
|
315
|
+
label: 'Gender',
|
|
316
|
+
description: 'Gender of the user. If unknown leave blank.',
|
|
317
|
+
type: 'string',
|
|
318
|
+
choices: [
|
|
319
|
+
{ label: 'Male', value: 'm' },
|
|
320
|
+
{ label: 'Female', value: 'f' }
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
db: {
|
|
324
|
+
label: 'Date of Birth',
|
|
325
|
+
description: 'Date of birth of the user',
|
|
326
|
+
type: 'string'
|
|
327
|
+
},
|
|
328
|
+
ct: {
|
|
329
|
+
label: 'City',
|
|
330
|
+
description: 'City of the user',
|
|
331
|
+
type: 'string'
|
|
332
|
+
},
|
|
333
|
+
st: {
|
|
334
|
+
label: 'State',
|
|
335
|
+
description: 'State of the user. Two-letter state or province code for the United States, For example, "NY" for New York.',
|
|
336
|
+
type: 'string'
|
|
337
|
+
},
|
|
338
|
+
zp: {
|
|
339
|
+
label: 'ZIP/Postal Code',
|
|
340
|
+
description: 'ZIP or postal code of the user. For example, "94025" for Menlo Park, CA, or "10001" for New York City.',
|
|
341
|
+
type: 'string'
|
|
342
|
+
},
|
|
343
|
+
country: {
|
|
344
|
+
label: 'Country',
|
|
345
|
+
description: 'Country code of the user. This should be a valid ISO 3166-1 alpha-2 country code. For example, "US" for the United States.',
|
|
346
|
+
type: 'string'
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
default: {
|
|
350
|
+
external_id: { '@path': '$.context.traits.userId' },
|
|
351
|
+
em: { '@path': '$.context.traits.email' },
|
|
352
|
+
ph: { '@path': '$.context.traits.phone' },
|
|
353
|
+
fn: { '@path': '$.context.traits.first_name' },
|
|
354
|
+
ln: { '@path': '$.context.traits.last_name' },
|
|
355
|
+
ge: { '@path': '$.context.traits.gender' },
|
|
356
|
+
db: { '@path': '$.context.traits.birthday' },
|
|
357
|
+
ct: { '@path': '$.context.traits.address.city' },
|
|
358
|
+
st: { '@path': '$.context.traits.address.state' },
|
|
359
|
+
zp: { '@path': '$.context.traits.address.postal_code' },
|
|
360
|
+
country: { '@path': '$.context.traits.address.country' }
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
exports.AllFields = {
|
|
364
|
+
event_config: exports.event_config,
|
|
365
|
+
content_category: exports.content_category,
|
|
366
|
+
content_ids: exports.content_ids,
|
|
367
|
+
content_name: exports.content_name,
|
|
368
|
+
content_type: exports.content_type,
|
|
369
|
+
contents: exports.contents,
|
|
370
|
+
currency: exports.currency,
|
|
371
|
+
delivery_category: exports.delivery_category,
|
|
372
|
+
num_items: exports.num_items,
|
|
373
|
+
predicted_ltv: exports.predicted_ltv,
|
|
374
|
+
search_string: exports.search_string,
|
|
375
|
+
status: exports.status,
|
|
376
|
+
value: exports.value,
|
|
377
|
+
custom_data: exports.custom_data,
|
|
378
|
+
eventID: exports.eventID,
|
|
379
|
+
eventSourceUrl: exports.eventSourceUrl,
|
|
380
|
+
actionSource: exports.actionSource,
|
|
381
|
+
userData: exports.userData
|
|
382
|
+
};
|
|
383
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../src/send/fields.ts"],"names":[],"mappings":";;;AACA,oCAAyC;AACzC,6CAAiD;AACjD,2CAAgD;AAEnC,QAAA,YAAY,GAAe;IACpC,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EAAE,6DAA6D;IAC1E,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,IAAI;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACR,UAAU,EAAE;YACR,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,kGAAkG;YAC/G,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACL,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE;gBAC/C,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,gBAAgB,EAAE;gBACtD,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE;gBAC5C,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,eAAe,EAAE;gBACpD,EAAE,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,sBAAsB,EAAE;gBACjE,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;gBACtC,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,kBAAkB,EAAE;gBACzD,EAAE,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AAE,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE;QAC7C,EAAE,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE;QAC1C,EAAE,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE;QAC5C,EAAE,EAAE,EAAE,OAAO,EAAE,+BAA+B,EAAE;QAChD,EAAE,EAAE,EAAE,OAAO,EAAE,gCAAgC,EAAE;QACjD,EAAE,EAAE,EAAE,OAAO,EAAE,sCAAsC,EAAE;QACvD,OAAO,EAAE,EAAE,OAAO,EAAE,kCAAkC,EAAE;KAC3D;CACJ,CAAA;AAEY,QAAA,SAAS,GAAG;IACrB,YAAY,EAAZ,oBAAY;IACZ,gBAAgB,EAAhB,wBAAgB;IAChB,WAAW,EAAX,mBAAW;IACX,YAAY,EAAZ,oBAAY;IACZ,YAAY,EAAZ,oBAAY;IACZ,QAAQ,EAAR,gBAAQ;IACR,QAAQ,EAAR,gBAAQ;IACR,iBAAiB,EAAjB,yBAAiB;IACjB,SAAS,EAAT,iBAAS;IACT,aAAa,EAAb,qBAAa;IACb,aAAa,EAAb,qBAAa;IACb,MAAM,EAAN,cAAM;IACN,KAAK,EAAL,aAAK;IACL,WAAW,EAAX,mBAAW;IACX,OAAO,EAAP,eAAO;IACP,cAAc,EAAd,sBAAc;IACd,YAAY,EAAZ,oBAAY;IACZ,QAAQ,EAAR,gBAAQ;CACX,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
event_config: {
|
|
3
|
+
event_name: string;
|
|
4
|
+
custom_event_name?: string;
|
|
5
|
+
show_fields?: boolean;
|
|
6
|
+
};
|
|
7
|
+
content_category?: string;
|
|
8
|
+
content_ids?: string[];
|
|
9
|
+
content_name?: string;
|
|
10
|
+
content_type?: string;
|
|
11
|
+
contents?: {
|
|
12
|
+
id: string;
|
|
13
|
+
quantity: number;
|
|
14
|
+
item_price?: number;
|
|
15
|
+
[k: string]: unknown;
|
|
16
|
+
}[];
|
|
17
|
+
currency?: string;
|
|
18
|
+
delivery_category?: string;
|
|
19
|
+
num_items?: number;
|
|
20
|
+
predicted_ltv?: number;
|
|
21
|
+
search_string?: string;
|
|
22
|
+
status?: boolean;
|
|
23
|
+
value?: number;
|
|
24
|
+
custom_data?: {
|
|
25
|
+
[k: string]: unknown;
|
|
26
|
+
};
|
|
27
|
+
eventID?: string;
|
|
28
|
+
eventSourceUrl?: string;
|
|
29
|
+
actionSource?: string;
|
|
30
|
+
userData?: {
|
|
31
|
+
external_id?: string;
|
|
32
|
+
em?: string;
|
|
33
|
+
ph?: string;
|
|
34
|
+
fn?: string;
|
|
35
|
+
ln?: string;
|
|
36
|
+
ge?: string;
|
|
37
|
+
db?: string;
|
|
38
|
+
ct?: string;
|
|
39
|
+
st?: string;
|
|
40
|
+
zp?: string;
|
|
41
|
+
country?: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/send/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
|
|
2
|
+
import type { Settings } from '../generated-types';
|
|
3
|
+
import type { Payload } from './generated-types';
|
|
4
|
+
import type { FBClient } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, FBClient, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fields_1 = require("./fields");
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
const depends_on_1 = require("./depends-on");
|
|
6
|
+
const validate_1 = require("./validate");
|
|
7
|
+
const action = {
|
|
8
|
+
title: 'Send Event',
|
|
9
|
+
description: 'Send a Standard or Custom Event to Facebook Conversions API.',
|
|
10
|
+
platform: 'web',
|
|
11
|
+
fields: fields_1.AllFields,
|
|
12
|
+
perform: (client, { payload, settings }) => {
|
|
13
|
+
const { pixelId } = settings;
|
|
14
|
+
const { event_config: { custom_event_name, show_fields, event_name } = {}, eventID, eventSourceUrl, actionSource, userData, ...rest } = payload;
|
|
15
|
+
const isCustom = event_name === 'CustomEvent' ? true : false;
|
|
16
|
+
if (isCustom) {
|
|
17
|
+
(0, validate_1.validate)(payload);
|
|
18
|
+
}
|
|
19
|
+
if (show_fields === false) {
|
|
20
|
+
const fieldsToDelete = (0, depends_on_1.getNotVisibleForEvent)(event_name);
|
|
21
|
+
fieldsToDelete.forEach(field => {
|
|
22
|
+
if (field in rest) {
|
|
23
|
+
delete rest[field];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const options = (0, utils_1.buildOptions)(payload);
|
|
28
|
+
if (isCustom) {
|
|
29
|
+
client('trackSingleCustom', pixelId, custom_event_name, { ...rest }, options);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
client('trackSingle', pixelId, event_name, { ...rest }, options);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.default = action;
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/send/index.ts"],"names":[],"mappings":";;AAGA,qCAAoC;AAEpC,mCAAsC;AACtC,6CAAoD;AACpD,yCAAqC;AAErC,MAAM,MAAM,GAAyD;IACnE,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,8DAA8D;IAC3E,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,kBAAS;IACjB,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QACzC,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAA;QAC5B,MAAM,EACF,YAAY,EAAE,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,EAAE,EACjE,OAAO,EACP,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,GAAG,IAAI,EACV,GAAG,OAAO,CAAA;QAEX,MAAM,QAAQ,GAAG,UAAU,KAAK,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;QAE5D,IAAG,QAAQ,EAAC,CAAC;YACT,IAAA,mBAAQ,EAAC,OAAO,CAAC,CAAA;QACrB,CAAC;QAED,IAAG,WAAW,KAAK,KAAK,EAAC,CAAC;YAEtB,MAAM,cAAc,GAAG,IAAA,kCAAqB,EAAC,UAA0D,CAAC,CAAA;YACxG,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBAC3B,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;oBAChB,OAAO,IAAI,CAAC,KAA0B,CAAC,CAAA;gBAC3C,CAAC;YACL,CAAC,CAAC,CAAA;QACN,CAAC;QAED,MAAM,OAAO,GAAG,IAAA,oBAAY,EAAC,OAAO,CAAC,CAAA;QAErC,IAAG,QAAQ,EAAC,CAAC;YACX,MAAM,CACJ,mBAAmB,EACnB,OAAO,EACP,iBAA2B,EAC3B,EAAE,GAAG,IAAI,EAAE,EACX,OAAO,CACR,CAAA;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CACJ,aAAa,EACb,OAAO,EACP,UAAiC,EACjC,EAAE,GAAG,IAAI,EAAE,EACX,OAAO,CACR,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LDU, UserData, Options } from '../types';
|
|
2
|
+
import { Payload } from './generated-types';
|
|
3
|
+
export declare function getLDU(ldu: keyof typeof LDU): {
|
|
4
|
+
country: 0 | 1 | undefined;
|
|
5
|
+
state: 0 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare function buildOptions(payload: Payload): Options | undefined;
|
|
8
|
+
export declare function santizeUserData(userData: UserData): UserData | undefined;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLDU = getLDU;
|
|
4
|
+
exports.buildOptions = buildOptions;
|
|
5
|
+
exports.santizeUserData = santizeUserData;
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
function getLDU(ldu) {
|
|
9
|
+
const lduObj = types_1.LDU[ldu];
|
|
10
|
+
return { country: lduObj.country, state: lduObj.state };
|
|
11
|
+
}
|
|
12
|
+
function buildOptions(payload) {
|
|
13
|
+
const { eventID, eventSourceUrl, actionSource, userData } = payload;
|
|
14
|
+
const options = {
|
|
15
|
+
eventID,
|
|
16
|
+
eventSourceUrl,
|
|
17
|
+
actionSource: actionSource,
|
|
18
|
+
userData: santizeUserData(userData)
|
|
19
|
+
};
|
|
20
|
+
return Object.values(options).some(Boolean) ? options : undefined;
|
|
21
|
+
}
|
|
22
|
+
function santizeUserData(userData) {
|
|
23
|
+
if (!userData) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
userData.em = typeof userData.em === 'string' ? userData.em.toLowerCase().trim() : undefined;
|
|
27
|
+
userData.ph = userData.ph ? userData.ph.replace(/\D/g, '') : undefined;
|
|
28
|
+
userData.fn = userData.fn ? userData.fn.toLowerCase().trim() : undefined;
|
|
29
|
+
userData.ln = userData.ln ? userData.ln.toLowerCase().trim() : undefined;
|
|
30
|
+
userData.ge = userData.ge ? userData.ge.toLowerCase().trim() : undefined;
|
|
31
|
+
userData.db = formatDate(userData.db);
|
|
32
|
+
userData.ct = userData.ct ? userData.ct.toLowerCase().replace(/\s+/g, '') : undefined;
|
|
33
|
+
userData.st = sanitizeState(userData.st);
|
|
34
|
+
userData.zp = userData.zp ? userData.zp.trim() : undefined;
|
|
35
|
+
userData.country = sanitizeCountry(userData.country);
|
|
36
|
+
return userData;
|
|
37
|
+
}
|
|
38
|
+
function formatDate(isoDate) {
|
|
39
|
+
if (!isoDate || typeof isoDate !== 'string') {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const date = new Date(isoDate);
|
|
43
|
+
if (isNaN(date.getTime())) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const year = date.getUTCFullYear();
|
|
47
|
+
const month = (date.getUTCMonth() + 1).toString().padStart(2, '0');
|
|
48
|
+
const day = date.getUTCDate().toString().padStart(2, '0');
|
|
49
|
+
return `${year}${month}${day}`;
|
|
50
|
+
}
|
|
51
|
+
function sanitizeState(state) {
|
|
52
|
+
if (typeof state !== 'string' || !state.trim()) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const normalized = state.replace(/\s+/g, '').toLowerCase();
|
|
56
|
+
const abbreviation = constants_1.US_STATE_CODES.get(normalized);
|
|
57
|
+
if (abbreviation) {
|
|
58
|
+
return abbreviation;
|
|
59
|
+
}
|
|
60
|
+
if (/^[a-z]{2}$/i.test(normalized)) {
|
|
61
|
+
return normalized.toLowerCase();
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
function sanitizeCountry(country) {
|
|
66
|
+
if (typeof country !== 'string' || !country.trim()) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const normalized = country.replace(/\s+/g, '').toUpperCase();
|
|
70
|
+
const abbreviation = constants_1.COUNTRY_CODES.get(normalized);
|
|
71
|
+
if (abbreviation) {
|
|
72
|
+
return abbreviation;
|
|
73
|
+
}
|
|
74
|
+
if (/^[A-Z]{2}$/.test(normalized)) {
|
|
75
|
+
return normalized.toLowerCase();
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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CAAC,UAAU,CAAC,CAAA;IAClD,IAAI,YAAY,EAAE,CAAC;QACf,OAAO,YAAY,CAAA;IACvB,CAAC;IAED,IAAI,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,OAAO,UAAU,CAAC,WAAW,EAAE,CAAA;IACnC,CAAC;IAED,OAAO,SAAS,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validate = validate;
|
|
4
|
+
function validate(payload) {
|
|
5
|
+
const { event_config: { event_name }, content_ids, contents } = payload;
|
|
6
|
+
if (['AddToCart', 'Purchase', 'ViewContent'].includes(event_name)) {
|
|
7
|
+
if (content_ids?.length === 0 || contents?.length === 0) {
|
|
8
|
+
throw new Error(`content_ids or contents are required for event ${event_name}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/send/validate.ts"],"names":[],"mappings":";;AAEA,4BAYC;AAZD,SAAgB,QAAQ,CAAC,OAAgB;IACrC,MAAM,EACF,YAAY,EAAE,EAAE,UAAU,EAAE,EAC5B,WAAW,EACX,QAAQ,EACX,GAAG,OAAO,CAAA;IAEX,IAAG,CAAC,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAC,CAAC;QAC9D,IAAG,WAAW,EAAE,MAAM,KAAK,CAAC,IAAI,QAAQ,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,KAAK,CAAC,kDAAkD,UAAU,EAAE,CAAC,CAAA;QACnF,CAAC;IACL,CAAC;AACL,CAAC"}
|