@blotoutio/providers-facebook-sdk 1.22.1 → 1.22.3
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/index.cjs.js +25 -2
- package/index.js +25 -2
- package/index.mjs +25 -2
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -202,6 +202,26 @@ encode([...defaultComputedEvents].map((n) => predefinedEvents.get(n)));
|
|
|
202
202
|
|
|
203
203
|
const packageName = 'facebook';
|
|
204
204
|
const sdkUrl = 'https://connect.facebook.net/en_US/fbevents.js';
|
|
205
|
+
const FACEBOOK_STANDARD_EVENTS = new Set([
|
|
206
|
+
'PageView',
|
|
207
|
+
'AddPaymentInfo',
|
|
208
|
+
'AddToCart',
|
|
209
|
+
'AddToWishList',
|
|
210
|
+
'CompleteRegistration',
|
|
211
|
+
'Contact',
|
|
212
|
+
'CustomizeProduct',
|
|
213
|
+
'Donate',
|
|
214
|
+
'FindLocation',
|
|
215
|
+
'InitiateCheckout',
|
|
216
|
+
'Lead',
|
|
217
|
+
'Purchase',
|
|
218
|
+
'Schedule',
|
|
219
|
+
'Search',
|
|
220
|
+
'StartTrial',
|
|
221
|
+
'SubmitApplication',
|
|
222
|
+
'Subscribe',
|
|
223
|
+
'ViewContent',
|
|
224
|
+
]);
|
|
205
225
|
|
|
206
226
|
const getFbq = () => {
|
|
207
227
|
if (!window || !window.fbq) {
|
|
@@ -310,6 +330,7 @@ const getProductIdFromMapping = (item, productIdMapping) => {
|
|
|
310
330
|
return item['id'];
|
|
311
331
|
};
|
|
312
332
|
|
|
333
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
313
334
|
const getProductMappingModel = (productIdMapping, useVariantId) => {
|
|
314
335
|
const value = productIdMapping || useVariantId || '0';
|
|
315
336
|
return (value && /^[012]$/.test(value) ? value : '0');
|
|
@@ -383,7 +404,7 @@ const prepareData = (data, productIdMapping) => {
|
|
|
383
404
|
};
|
|
384
405
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
385
406
|
const payload = {
|
|
386
|
-
sdkVersion: "1.22.
|
|
407
|
+
sdkVersion: "1.22.3" ,
|
|
387
408
|
};
|
|
388
409
|
if (window.fbq &&
|
|
389
410
|
!!manifestVariables['pixelId'] &&
|
|
@@ -392,7 +413,9 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
|
392
413
|
? data
|
|
393
414
|
: prepareData(data, getProductMappingModel(manifestVariables['productIdMapping'], manifestVariables['variantId']));
|
|
394
415
|
delete eventData['skipTransformation'];
|
|
395
|
-
window.fbq(
|
|
416
|
+
window.fbq(FACEBOOK_STANDARD_EVENTS.has(eventName)
|
|
417
|
+
? 'trackSingle'
|
|
418
|
+
: 'trackSingleCustom', manifestVariables['pixelId'], eventName, eventData, {
|
|
396
419
|
eventID: eventId,
|
|
397
420
|
});
|
|
398
421
|
}
|
package/index.js
CHANGED
|
@@ -203,6 +203,26 @@ var ProvidersFacebookSdk = (function () {
|
|
|
203
203
|
|
|
204
204
|
const packageName = 'facebook';
|
|
205
205
|
const sdkUrl = 'https://connect.facebook.net/en_US/fbevents.js';
|
|
206
|
+
const FACEBOOK_STANDARD_EVENTS = new Set([
|
|
207
|
+
'PageView',
|
|
208
|
+
'AddPaymentInfo',
|
|
209
|
+
'AddToCart',
|
|
210
|
+
'AddToWishList',
|
|
211
|
+
'CompleteRegistration',
|
|
212
|
+
'Contact',
|
|
213
|
+
'CustomizeProduct',
|
|
214
|
+
'Donate',
|
|
215
|
+
'FindLocation',
|
|
216
|
+
'InitiateCheckout',
|
|
217
|
+
'Lead',
|
|
218
|
+
'Purchase',
|
|
219
|
+
'Schedule',
|
|
220
|
+
'Search',
|
|
221
|
+
'StartTrial',
|
|
222
|
+
'SubmitApplication',
|
|
223
|
+
'Subscribe',
|
|
224
|
+
'ViewContent',
|
|
225
|
+
]);
|
|
206
226
|
|
|
207
227
|
const getFbq = () => {
|
|
208
228
|
if (!window || !window.fbq) {
|
|
@@ -311,6 +331,7 @@ var ProvidersFacebookSdk = (function () {
|
|
|
311
331
|
return item['id'];
|
|
312
332
|
};
|
|
313
333
|
|
|
334
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
314
335
|
const getProductMappingModel = (productIdMapping, useVariantId) => {
|
|
315
336
|
const value = productIdMapping || useVariantId || '0';
|
|
316
337
|
return (value && /^[012]$/.test(value) ? value : '0');
|
|
@@ -384,7 +405,7 @@ var ProvidersFacebookSdk = (function () {
|
|
|
384
405
|
};
|
|
385
406
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
386
407
|
const payload = {
|
|
387
|
-
sdkVersion: "1.22.
|
|
408
|
+
sdkVersion: "1.22.3" ,
|
|
388
409
|
};
|
|
389
410
|
if (window.fbq &&
|
|
390
411
|
!!manifestVariables['pixelId'] &&
|
|
@@ -393,7 +414,9 @@ var ProvidersFacebookSdk = (function () {
|
|
|
393
414
|
? data
|
|
394
415
|
: prepareData(data, getProductMappingModel(manifestVariables['productIdMapping'], manifestVariables['variantId']));
|
|
395
416
|
delete eventData['skipTransformation'];
|
|
396
|
-
window.fbq(
|
|
417
|
+
window.fbq(FACEBOOK_STANDARD_EVENTS.has(eventName)
|
|
418
|
+
? 'trackSingle'
|
|
419
|
+
: 'trackSingleCustom', manifestVariables['pixelId'], eventName, eventData, {
|
|
397
420
|
eventID: eventId,
|
|
398
421
|
});
|
|
399
422
|
}
|
package/index.mjs
CHANGED
|
@@ -200,6 +200,26 @@ encode([...defaultComputedEvents].map((n) => predefinedEvents.get(n)));
|
|
|
200
200
|
|
|
201
201
|
const packageName = 'facebook';
|
|
202
202
|
const sdkUrl = 'https://connect.facebook.net/en_US/fbevents.js';
|
|
203
|
+
const FACEBOOK_STANDARD_EVENTS = new Set([
|
|
204
|
+
'PageView',
|
|
205
|
+
'AddPaymentInfo',
|
|
206
|
+
'AddToCart',
|
|
207
|
+
'AddToWishList',
|
|
208
|
+
'CompleteRegistration',
|
|
209
|
+
'Contact',
|
|
210
|
+
'CustomizeProduct',
|
|
211
|
+
'Donate',
|
|
212
|
+
'FindLocation',
|
|
213
|
+
'InitiateCheckout',
|
|
214
|
+
'Lead',
|
|
215
|
+
'Purchase',
|
|
216
|
+
'Schedule',
|
|
217
|
+
'Search',
|
|
218
|
+
'StartTrial',
|
|
219
|
+
'SubmitApplication',
|
|
220
|
+
'Subscribe',
|
|
221
|
+
'ViewContent',
|
|
222
|
+
]);
|
|
203
223
|
|
|
204
224
|
const getFbq = () => {
|
|
205
225
|
if (!window || !window.fbq) {
|
|
@@ -308,6 +328,7 @@ const getProductIdFromMapping = (item, productIdMapping) => {
|
|
|
308
328
|
return item['id'];
|
|
309
329
|
};
|
|
310
330
|
|
|
331
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
311
332
|
const getProductMappingModel = (productIdMapping, useVariantId) => {
|
|
312
333
|
const value = productIdMapping || useVariantId || '0';
|
|
313
334
|
return (value && /^[012]$/.test(value) ? value : '0');
|
|
@@ -381,7 +402,7 @@ const prepareData = (data, productIdMapping) => {
|
|
|
381
402
|
};
|
|
382
403
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
383
404
|
const payload = {
|
|
384
|
-
sdkVersion: "1.22.
|
|
405
|
+
sdkVersion: "1.22.3" ,
|
|
385
406
|
};
|
|
386
407
|
if (window.fbq &&
|
|
387
408
|
!!manifestVariables['pixelId'] &&
|
|
@@ -390,7 +411,9 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
|
390
411
|
? data
|
|
391
412
|
: prepareData(data, getProductMappingModel(manifestVariables['productIdMapping'], manifestVariables['variantId']));
|
|
392
413
|
delete eventData['skipTransformation'];
|
|
393
|
-
window.fbq(
|
|
414
|
+
window.fbq(FACEBOOK_STANDARD_EVENTS.has(eventName)
|
|
415
|
+
? 'trackSingle'
|
|
416
|
+
: 'trackSingleCustom', manifestVariables['pixelId'], eventName, eventData, {
|
|
394
417
|
eventID: eventId,
|
|
395
418
|
});
|
|
396
419
|
}
|