@blotoutio/providers-facebook-sdk 1.68.2 → 1.69.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/index.cjs.js +85 -47
- package/index.js +85 -47
- package/index.mjs +85 -47
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -244,48 +244,96 @@ const META_IDENTITY_KEYS = new Set([
|
|
|
244
244
|
'ig_sid',
|
|
245
245
|
]);
|
|
246
246
|
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
const keyPrefix = `_worker`;
|
|
248
|
+
|
|
249
|
+
const getProductIdFromMapping = (item, productIdMapping) => {
|
|
250
|
+
if (productIdMapping === '1' && item['variantId']) {
|
|
251
|
+
return item['variantId'];
|
|
250
252
|
}
|
|
251
|
-
|
|
253
|
+
if (productIdMapping === '2' && item['sku']) {
|
|
254
|
+
return item['sku'];
|
|
255
|
+
}
|
|
256
|
+
return item['id'];
|
|
252
257
|
};
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
258
|
+
|
|
259
|
+
const initKey = `${keyPrefix}StoreMultiple`;
|
|
260
|
+
const getData = (destination, persistType, key = initKey) => {
|
|
261
|
+
let data;
|
|
262
|
+
if (persistType === 'session') {
|
|
263
|
+
data = getSession(key);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
data = getLocal(key);
|
|
267
|
+
}
|
|
268
|
+
return (data === null || data === void 0 ? void 0 : data[destination]) || {};
|
|
269
|
+
};
|
|
270
|
+
const getLocal = (key) => {
|
|
256
271
|
try {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
return data;
|
|
260
|
-
}
|
|
261
|
-
if (user.email) {
|
|
262
|
-
data['em'] = user.email;
|
|
263
|
-
}
|
|
264
|
-
if (user.phone) {
|
|
265
|
-
data['ph'] = user.phone;
|
|
266
|
-
}
|
|
267
|
-
if (user.firstName) {
|
|
268
|
-
data['fn'] = user.firstName;
|
|
272
|
+
if (!localStorage) {
|
|
273
|
+
return {};
|
|
269
274
|
}
|
|
270
|
-
|
|
271
|
-
|
|
275
|
+
const data = localStorage.getItem(key);
|
|
276
|
+
if (!data) {
|
|
277
|
+
return {};
|
|
272
278
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
279
|
+
return JSON.parse(data) || {};
|
|
280
|
+
}
|
|
281
|
+
catch {
|
|
282
|
+
return {};
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
const getSession = (key) => {
|
|
286
|
+
try {
|
|
287
|
+
if (!sessionStorage) {
|
|
288
|
+
return {};
|
|
278
289
|
}
|
|
279
|
-
|
|
280
|
-
|
|
290
|
+
const data = sessionStorage.getItem(key);
|
|
291
|
+
if (!data) {
|
|
292
|
+
return {};
|
|
281
293
|
}
|
|
294
|
+
return JSON.parse(data) || {};
|
|
282
295
|
}
|
|
283
|
-
catch
|
|
284
|
-
|
|
296
|
+
catch {
|
|
297
|
+
return {};
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const getFbq = () => {
|
|
302
|
+
if (!window || !window.fbq) {
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
return window.fbq;
|
|
306
|
+
};
|
|
307
|
+
const getUserData = (destination) => {
|
|
308
|
+
const data = {};
|
|
309
|
+
const user = getData(destination, 'session')['kv'];
|
|
310
|
+
if (!user) {
|
|
311
|
+
return data;
|
|
312
|
+
}
|
|
313
|
+
if (user['email']) {
|
|
314
|
+
data['em'] = user['email'];
|
|
315
|
+
}
|
|
316
|
+
if (user['phone']) {
|
|
317
|
+
data['ph'] = user['phone'];
|
|
318
|
+
}
|
|
319
|
+
if (user['firstName']) {
|
|
320
|
+
data['fn'] = user['firstName'];
|
|
321
|
+
}
|
|
322
|
+
if (user['lastName']) {
|
|
323
|
+
data['ln'] = user['lastName'];
|
|
324
|
+
}
|
|
325
|
+
if (user['city']) {
|
|
326
|
+
data['ct'] = user['city'];
|
|
327
|
+
}
|
|
328
|
+
if (user['state']) {
|
|
329
|
+
data['st'] = user['state'];
|
|
330
|
+
}
|
|
331
|
+
if (user['country']) {
|
|
332
|
+
data['country'] = user['country'];
|
|
285
333
|
}
|
|
286
334
|
return data;
|
|
287
335
|
};
|
|
288
|
-
const runInit = (pixelId, ldu, userId) => {
|
|
336
|
+
const runInit = (pixelId, ldu, userId, destination) => {
|
|
289
337
|
var _a, _b;
|
|
290
338
|
const wrapper = getFbq();
|
|
291
339
|
if (!wrapper) {
|
|
@@ -296,7 +344,7 @@ const runInit = (pixelId, ldu, userId) => {
|
|
|
296
344
|
}
|
|
297
345
|
wrapper('init', pixelId, {
|
|
298
346
|
external_id: userId,
|
|
299
|
-
...getUserData(),
|
|
347
|
+
...getUserData(destination),
|
|
300
348
|
});
|
|
301
349
|
wrapper.disablePushState = true;
|
|
302
350
|
if (ldu) {
|
|
@@ -331,7 +379,7 @@ const snippet = () => {
|
|
|
331
379
|
script.parentNode.insertBefore(element, script);
|
|
332
380
|
}
|
|
333
381
|
};
|
|
334
|
-
const init = ({ manifest, userId, consentData }) => {
|
|
382
|
+
const init = ({ manifest, userId, consentData, destination }) => {
|
|
335
383
|
var _a;
|
|
336
384
|
if (!manifest.variables ||
|
|
337
385
|
!manifest.variables['pixelId'] ||
|
|
@@ -339,7 +387,7 @@ const init = ({ manifest, userId, consentData }) => {
|
|
|
339
387
|
return;
|
|
340
388
|
}
|
|
341
389
|
snippet();
|
|
342
|
-
runInit(manifest.variables['pixelId'], manifest.variables['ldu'] === '1', userId);
|
|
390
|
+
runInit(manifest.variables['pixelId'], manifest.variables['ldu'] === '1', userId, destination);
|
|
343
391
|
if (((_a = consentData === null || consentData === void 0 ? void 0 : consentData.consent) === null || _a === void 0 ? void 0 : _a.facebook) || (consentData === null || consentData === void 0 ? void 0 : consentData.categories.advertising)) {
|
|
344
392
|
if (window.clientParamsHelper) {
|
|
345
393
|
window.clientParamsHelper.collectAndSetParams(true);
|
|
@@ -347,16 +395,6 @@ const init = ({ manifest, userId, consentData }) => {
|
|
|
347
395
|
}
|
|
348
396
|
};
|
|
349
397
|
|
|
350
|
-
const getProductIdFromMapping = (item, productIdMapping) => {
|
|
351
|
-
if (productIdMapping === '1' && item['variantId']) {
|
|
352
|
-
return item['variantId'];
|
|
353
|
-
}
|
|
354
|
-
if (productIdMapping === '2' && item['sku']) {
|
|
355
|
-
return item['sku'];
|
|
356
|
-
}
|
|
357
|
-
return item['id'];
|
|
358
|
-
};
|
|
359
|
-
|
|
360
398
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
361
399
|
const FB_STANDARD_KEYS = new Set([
|
|
362
400
|
'value',
|
|
@@ -507,7 +545,7 @@ const prepareData = (data, productIdMapping) => {
|
|
|
507
545
|
};
|
|
508
546
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
509
547
|
const payload = {
|
|
510
|
-
sdkVersion: "1.
|
|
548
|
+
sdkVersion: "1.69.0" ,
|
|
511
549
|
};
|
|
512
550
|
if (window.fbq &&
|
|
513
551
|
!!manifestVariables['pixelId'] &&
|
|
@@ -525,13 +563,13 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
|
525
563
|
return payload;
|
|
526
564
|
};
|
|
527
565
|
|
|
528
|
-
const user = ({ userId, manifestVariables }) => {
|
|
566
|
+
const user = ({ userId, manifestVariables, destination }) => {
|
|
529
567
|
if (!manifestVariables ||
|
|
530
568
|
!manifestVariables['pixelId'] ||
|
|
531
569
|
manifestVariables['enableBrowser'] !== '1') {
|
|
532
570
|
return;
|
|
533
571
|
}
|
|
534
|
-
runInit(manifestVariables['pixelId'], manifestVariables['ldu'] === '1', userId);
|
|
572
|
+
runInit(manifestVariables['pixelId'], manifestVariables['ldu'] === '1', userId, destination);
|
|
535
573
|
};
|
|
536
574
|
|
|
537
575
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
package/index.js
CHANGED
|
@@ -245,48 +245,96 @@ var ProvidersFacebookSdk = (function () {
|
|
|
245
245
|
'ig_sid',
|
|
246
246
|
]);
|
|
247
247
|
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
const keyPrefix = `_worker`;
|
|
249
|
+
|
|
250
|
+
const getProductIdFromMapping = (item, productIdMapping) => {
|
|
251
|
+
if (productIdMapping === '1' && item['variantId']) {
|
|
252
|
+
return item['variantId'];
|
|
251
253
|
}
|
|
252
|
-
|
|
254
|
+
if (productIdMapping === '2' && item['sku']) {
|
|
255
|
+
return item['sku'];
|
|
256
|
+
}
|
|
257
|
+
return item['id'];
|
|
253
258
|
};
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
259
|
+
|
|
260
|
+
const initKey = `${keyPrefix}StoreMultiple`;
|
|
261
|
+
const getData = (destination, persistType, key = initKey) => {
|
|
262
|
+
let data;
|
|
263
|
+
if (persistType === 'session') {
|
|
264
|
+
data = getSession(key);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
data = getLocal(key);
|
|
268
|
+
}
|
|
269
|
+
return (data === null || data === void 0 ? void 0 : data[destination]) || {};
|
|
270
|
+
};
|
|
271
|
+
const getLocal = (key) => {
|
|
257
272
|
try {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
return data;
|
|
261
|
-
}
|
|
262
|
-
if (user.email) {
|
|
263
|
-
data['em'] = user.email;
|
|
264
|
-
}
|
|
265
|
-
if (user.phone) {
|
|
266
|
-
data['ph'] = user.phone;
|
|
267
|
-
}
|
|
268
|
-
if (user.firstName) {
|
|
269
|
-
data['fn'] = user.firstName;
|
|
273
|
+
if (!localStorage) {
|
|
274
|
+
return {};
|
|
270
275
|
}
|
|
271
|
-
|
|
272
|
-
|
|
276
|
+
const data = localStorage.getItem(key);
|
|
277
|
+
if (!data) {
|
|
278
|
+
return {};
|
|
273
279
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
280
|
+
return JSON.parse(data) || {};
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return {};
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
const getSession = (key) => {
|
|
287
|
+
try {
|
|
288
|
+
if (!sessionStorage) {
|
|
289
|
+
return {};
|
|
279
290
|
}
|
|
280
|
-
|
|
281
|
-
|
|
291
|
+
const data = sessionStorage.getItem(key);
|
|
292
|
+
if (!data) {
|
|
293
|
+
return {};
|
|
282
294
|
}
|
|
295
|
+
return JSON.parse(data) || {};
|
|
283
296
|
}
|
|
284
|
-
catch
|
|
285
|
-
|
|
297
|
+
catch {
|
|
298
|
+
return {};
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
const getFbq = () => {
|
|
303
|
+
if (!window || !window.fbq) {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
return window.fbq;
|
|
307
|
+
};
|
|
308
|
+
const getUserData = (destination) => {
|
|
309
|
+
const data = {};
|
|
310
|
+
const user = getData(destination, 'session')['kv'];
|
|
311
|
+
if (!user) {
|
|
312
|
+
return data;
|
|
313
|
+
}
|
|
314
|
+
if (user['email']) {
|
|
315
|
+
data['em'] = user['email'];
|
|
316
|
+
}
|
|
317
|
+
if (user['phone']) {
|
|
318
|
+
data['ph'] = user['phone'];
|
|
319
|
+
}
|
|
320
|
+
if (user['firstName']) {
|
|
321
|
+
data['fn'] = user['firstName'];
|
|
322
|
+
}
|
|
323
|
+
if (user['lastName']) {
|
|
324
|
+
data['ln'] = user['lastName'];
|
|
325
|
+
}
|
|
326
|
+
if (user['city']) {
|
|
327
|
+
data['ct'] = user['city'];
|
|
328
|
+
}
|
|
329
|
+
if (user['state']) {
|
|
330
|
+
data['st'] = user['state'];
|
|
331
|
+
}
|
|
332
|
+
if (user['country']) {
|
|
333
|
+
data['country'] = user['country'];
|
|
286
334
|
}
|
|
287
335
|
return data;
|
|
288
336
|
};
|
|
289
|
-
const runInit = (pixelId, ldu, userId) => {
|
|
337
|
+
const runInit = (pixelId, ldu, userId, destination) => {
|
|
290
338
|
var _a, _b;
|
|
291
339
|
const wrapper = getFbq();
|
|
292
340
|
if (!wrapper) {
|
|
@@ -297,7 +345,7 @@ var ProvidersFacebookSdk = (function () {
|
|
|
297
345
|
}
|
|
298
346
|
wrapper('init', pixelId, {
|
|
299
347
|
external_id: userId,
|
|
300
|
-
...getUserData(),
|
|
348
|
+
...getUserData(destination),
|
|
301
349
|
});
|
|
302
350
|
wrapper.disablePushState = true;
|
|
303
351
|
if (ldu) {
|
|
@@ -332,7 +380,7 @@ var ProvidersFacebookSdk = (function () {
|
|
|
332
380
|
script.parentNode.insertBefore(element, script);
|
|
333
381
|
}
|
|
334
382
|
};
|
|
335
|
-
const init = ({ manifest, userId, consentData }) => {
|
|
383
|
+
const init = ({ manifest, userId, consentData, destination }) => {
|
|
336
384
|
var _a;
|
|
337
385
|
if (!manifest.variables ||
|
|
338
386
|
!manifest.variables['pixelId'] ||
|
|
@@ -340,7 +388,7 @@ var ProvidersFacebookSdk = (function () {
|
|
|
340
388
|
return;
|
|
341
389
|
}
|
|
342
390
|
snippet();
|
|
343
|
-
runInit(manifest.variables['pixelId'], manifest.variables['ldu'] === '1', userId);
|
|
391
|
+
runInit(manifest.variables['pixelId'], manifest.variables['ldu'] === '1', userId, destination);
|
|
344
392
|
if (((_a = consentData === null || consentData === void 0 ? void 0 : consentData.consent) === null || _a === void 0 ? void 0 : _a.facebook) || (consentData === null || consentData === void 0 ? void 0 : consentData.categories.advertising)) {
|
|
345
393
|
if (window.clientParamsHelper) {
|
|
346
394
|
window.clientParamsHelper.collectAndSetParams(true);
|
|
@@ -348,16 +396,6 @@ var ProvidersFacebookSdk = (function () {
|
|
|
348
396
|
}
|
|
349
397
|
};
|
|
350
398
|
|
|
351
|
-
const getProductIdFromMapping = (item, productIdMapping) => {
|
|
352
|
-
if (productIdMapping === '1' && item['variantId']) {
|
|
353
|
-
return item['variantId'];
|
|
354
|
-
}
|
|
355
|
-
if (productIdMapping === '2' && item['sku']) {
|
|
356
|
-
return item['sku'];
|
|
357
|
-
}
|
|
358
|
-
return item['id'];
|
|
359
|
-
};
|
|
360
|
-
|
|
361
399
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
362
400
|
const FB_STANDARD_KEYS = new Set([
|
|
363
401
|
'value',
|
|
@@ -508,7 +546,7 @@ var ProvidersFacebookSdk = (function () {
|
|
|
508
546
|
};
|
|
509
547
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
510
548
|
const payload = {
|
|
511
|
-
sdkVersion: "1.
|
|
549
|
+
sdkVersion: "1.69.0" ,
|
|
512
550
|
};
|
|
513
551
|
if (window.fbq &&
|
|
514
552
|
!!manifestVariables['pixelId'] &&
|
|
@@ -526,13 +564,13 @@ var ProvidersFacebookSdk = (function () {
|
|
|
526
564
|
return payload;
|
|
527
565
|
};
|
|
528
566
|
|
|
529
|
-
const user = ({ userId, manifestVariables }) => {
|
|
567
|
+
const user = ({ userId, manifestVariables, destination }) => {
|
|
530
568
|
if (!manifestVariables ||
|
|
531
569
|
!manifestVariables['pixelId'] ||
|
|
532
570
|
manifestVariables['enableBrowser'] !== '1') {
|
|
533
571
|
return;
|
|
534
572
|
}
|
|
535
|
-
runInit(manifestVariables['pixelId'], manifestVariables['ldu'] === '1', userId);
|
|
573
|
+
runInit(manifestVariables['pixelId'], manifestVariables['ldu'] === '1', userId, destination);
|
|
536
574
|
};
|
|
537
575
|
|
|
538
576
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
package/index.mjs
CHANGED
|
@@ -242,48 +242,96 @@ const META_IDENTITY_KEYS = new Set([
|
|
|
242
242
|
'ig_sid',
|
|
243
243
|
]);
|
|
244
244
|
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
245
|
+
const keyPrefix = `_worker`;
|
|
246
|
+
|
|
247
|
+
const getProductIdFromMapping = (item, productIdMapping) => {
|
|
248
|
+
if (productIdMapping === '1' && item['variantId']) {
|
|
249
|
+
return item['variantId'];
|
|
248
250
|
}
|
|
249
|
-
|
|
251
|
+
if (productIdMapping === '2' && item['sku']) {
|
|
252
|
+
return item['sku'];
|
|
253
|
+
}
|
|
254
|
+
return item['id'];
|
|
250
255
|
};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
256
|
+
|
|
257
|
+
const initKey = `${keyPrefix}StoreMultiple`;
|
|
258
|
+
const getData = (destination, persistType, key = initKey) => {
|
|
259
|
+
let data;
|
|
260
|
+
if (persistType === 'session') {
|
|
261
|
+
data = getSession(key);
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
data = getLocal(key);
|
|
265
|
+
}
|
|
266
|
+
return (data === null || data === void 0 ? void 0 : data[destination]) || {};
|
|
267
|
+
};
|
|
268
|
+
const getLocal = (key) => {
|
|
254
269
|
try {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
return data;
|
|
258
|
-
}
|
|
259
|
-
if (user.email) {
|
|
260
|
-
data['em'] = user.email;
|
|
261
|
-
}
|
|
262
|
-
if (user.phone) {
|
|
263
|
-
data['ph'] = user.phone;
|
|
264
|
-
}
|
|
265
|
-
if (user.firstName) {
|
|
266
|
-
data['fn'] = user.firstName;
|
|
270
|
+
if (!localStorage) {
|
|
271
|
+
return {};
|
|
267
272
|
}
|
|
268
|
-
|
|
269
|
-
|
|
273
|
+
const data = localStorage.getItem(key);
|
|
274
|
+
if (!data) {
|
|
275
|
+
return {};
|
|
270
276
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
277
|
+
return JSON.parse(data) || {};
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
return {};
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
const getSession = (key) => {
|
|
284
|
+
try {
|
|
285
|
+
if (!sessionStorage) {
|
|
286
|
+
return {};
|
|
276
287
|
}
|
|
277
|
-
|
|
278
|
-
|
|
288
|
+
const data = sessionStorage.getItem(key);
|
|
289
|
+
if (!data) {
|
|
290
|
+
return {};
|
|
279
291
|
}
|
|
292
|
+
return JSON.parse(data) || {};
|
|
280
293
|
}
|
|
281
|
-
catch
|
|
282
|
-
|
|
294
|
+
catch {
|
|
295
|
+
return {};
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const getFbq = () => {
|
|
300
|
+
if (!window || !window.fbq) {
|
|
301
|
+
return null;
|
|
302
|
+
}
|
|
303
|
+
return window.fbq;
|
|
304
|
+
};
|
|
305
|
+
const getUserData = (destination) => {
|
|
306
|
+
const data = {};
|
|
307
|
+
const user = getData(destination, 'session')['kv'];
|
|
308
|
+
if (!user) {
|
|
309
|
+
return data;
|
|
310
|
+
}
|
|
311
|
+
if (user['email']) {
|
|
312
|
+
data['em'] = user['email'];
|
|
313
|
+
}
|
|
314
|
+
if (user['phone']) {
|
|
315
|
+
data['ph'] = user['phone'];
|
|
316
|
+
}
|
|
317
|
+
if (user['firstName']) {
|
|
318
|
+
data['fn'] = user['firstName'];
|
|
319
|
+
}
|
|
320
|
+
if (user['lastName']) {
|
|
321
|
+
data['ln'] = user['lastName'];
|
|
322
|
+
}
|
|
323
|
+
if (user['city']) {
|
|
324
|
+
data['ct'] = user['city'];
|
|
325
|
+
}
|
|
326
|
+
if (user['state']) {
|
|
327
|
+
data['st'] = user['state'];
|
|
328
|
+
}
|
|
329
|
+
if (user['country']) {
|
|
330
|
+
data['country'] = user['country'];
|
|
283
331
|
}
|
|
284
332
|
return data;
|
|
285
333
|
};
|
|
286
|
-
const runInit = (pixelId, ldu, userId) => {
|
|
334
|
+
const runInit = (pixelId, ldu, userId, destination) => {
|
|
287
335
|
var _a, _b;
|
|
288
336
|
const wrapper = getFbq();
|
|
289
337
|
if (!wrapper) {
|
|
@@ -294,7 +342,7 @@ const runInit = (pixelId, ldu, userId) => {
|
|
|
294
342
|
}
|
|
295
343
|
wrapper('init', pixelId, {
|
|
296
344
|
external_id: userId,
|
|
297
|
-
...getUserData(),
|
|
345
|
+
...getUserData(destination),
|
|
298
346
|
});
|
|
299
347
|
wrapper.disablePushState = true;
|
|
300
348
|
if (ldu) {
|
|
@@ -329,7 +377,7 @@ const snippet = () => {
|
|
|
329
377
|
script.parentNode.insertBefore(element, script);
|
|
330
378
|
}
|
|
331
379
|
};
|
|
332
|
-
const init = ({ manifest, userId, consentData }) => {
|
|
380
|
+
const init = ({ manifest, userId, consentData, destination }) => {
|
|
333
381
|
var _a;
|
|
334
382
|
if (!manifest.variables ||
|
|
335
383
|
!manifest.variables['pixelId'] ||
|
|
@@ -337,7 +385,7 @@ const init = ({ manifest, userId, consentData }) => {
|
|
|
337
385
|
return;
|
|
338
386
|
}
|
|
339
387
|
snippet();
|
|
340
|
-
runInit(manifest.variables['pixelId'], manifest.variables['ldu'] === '1', userId);
|
|
388
|
+
runInit(manifest.variables['pixelId'], manifest.variables['ldu'] === '1', userId, destination);
|
|
341
389
|
if (((_a = consentData === null || consentData === void 0 ? void 0 : consentData.consent) === null || _a === void 0 ? void 0 : _a.facebook) || (consentData === null || consentData === void 0 ? void 0 : consentData.categories.advertising)) {
|
|
342
390
|
if (window.clientParamsHelper) {
|
|
343
391
|
window.clientParamsHelper.collectAndSetParams(true);
|
|
@@ -345,16 +393,6 @@ const init = ({ manifest, userId, consentData }) => {
|
|
|
345
393
|
}
|
|
346
394
|
};
|
|
347
395
|
|
|
348
|
-
const getProductIdFromMapping = (item, productIdMapping) => {
|
|
349
|
-
if (productIdMapping === '1' && item['variantId']) {
|
|
350
|
-
return item['variantId'];
|
|
351
|
-
}
|
|
352
|
-
if (productIdMapping === '2' && item['sku']) {
|
|
353
|
-
return item['sku'];
|
|
354
|
-
}
|
|
355
|
-
return item['id'];
|
|
356
|
-
};
|
|
357
|
-
|
|
358
396
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
359
397
|
const FB_STANDARD_KEYS = new Set([
|
|
360
398
|
'value',
|
|
@@ -505,7 +543,7 @@ const prepareData = (data, productIdMapping) => {
|
|
|
505
543
|
};
|
|
506
544
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
507
545
|
const payload = {
|
|
508
|
-
sdkVersion: "1.
|
|
546
|
+
sdkVersion: "1.69.0" ,
|
|
509
547
|
};
|
|
510
548
|
if (window.fbq &&
|
|
511
549
|
!!manifestVariables['pixelId'] &&
|
|
@@ -523,13 +561,13 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
|
523
561
|
return payload;
|
|
524
562
|
};
|
|
525
563
|
|
|
526
|
-
const user = ({ userId, manifestVariables }) => {
|
|
564
|
+
const user = ({ userId, manifestVariables, destination }) => {
|
|
527
565
|
if (!manifestVariables ||
|
|
528
566
|
!manifestVariables['pixelId'] ||
|
|
529
567
|
manifestVariables['enableBrowser'] !== '1') {
|
|
530
568
|
return;
|
|
531
569
|
}
|
|
532
|
-
runInit(manifestVariables['pixelId'], manifestVariables['ldu'] === '1', userId);
|
|
570
|
+
runInit(manifestVariables['pixelId'], manifestVariables['ldu'] === '1', userId, destination);
|
|
533
571
|
};
|
|
534
572
|
|
|
535
573
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|