@blotoutio/providers-facebook-sdk 0.45.4 → 0.46.1

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 CHANGED
@@ -4,6 +4,12 @@ const packageName = 'facebook';
4
4
  const sdkUrl = 'https://connect.facebook.net/en_US/fbevents.js';
5
5
 
6
6
  // eslint-disable-next-line @nx/enforce-module-boundaries
7
+ const getFbq = () => {
8
+ if (!window || !window.fbq) {
9
+ return null;
10
+ }
11
+ return window.fbq;
12
+ };
7
13
  const snippet = () => {
8
14
  if (!window || !document || window.fbq) {
9
15
  return;
@@ -37,13 +43,14 @@ const init = ({ manifest, userId }) => {
37
43
  return;
38
44
  }
39
45
  snippet();
40
- if (!window.fbq) {
46
+ const wrapper = getFbq();
47
+ if (!wrapper) {
41
48
  return;
42
49
  }
43
- window['fbq']('init', manifest.variables['pixelId'], {
50
+ wrapper('init', manifest.variables['pixelId'], {
44
51
  external_id: userId,
45
52
  });
46
- window['fbq'].disablePushState = true;
53
+ wrapper.disablePushState = true;
47
54
  };
48
55
 
49
56
  const getProductIdFromMapping = (item, productIdMapping) => {
@@ -126,7 +133,7 @@ const prepareData = (data, productIdMapping) => {
126
133
  };
127
134
  const tag = ({ data, eventName, manifestVariables, eventId }) => {
128
135
  const payload = {
129
- sdkVersion: "0.45.4" ,
136
+ sdkVersion: "0.46.1" ,
130
137
  };
131
138
  if (window.fbq &&
132
139
  !!manifestVariables['pixelId'] &&
package/index.js CHANGED
@@ -5,6 +5,12 @@ var ProvidersFacebookSdk = (function () {
5
5
  const sdkUrl = 'https://connect.facebook.net/en_US/fbevents.js';
6
6
 
7
7
  // eslint-disable-next-line @nx/enforce-module-boundaries
8
+ const getFbq = () => {
9
+ if (!window || !window.fbq) {
10
+ return null;
11
+ }
12
+ return window.fbq;
13
+ };
8
14
  const snippet = () => {
9
15
  if (!window || !document || window.fbq) {
10
16
  return;
@@ -38,13 +44,14 @@ var ProvidersFacebookSdk = (function () {
38
44
  return;
39
45
  }
40
46
  snippet();
41
- if (!window.fbq) {
47
+ const wrapper = getFbq();
48
+ if (!wrapper) {
42
49
  return;
43
50
  }
44
- window['fbq']('init', manifest.variables['pixelId'], {
51
+ wrapper('init', manifest.variables['pixelId'], {
45
52
  external_id: userId,
46
53
  });
47
- window['fbq'].disablePushState = true;
54
+ wrapper.disablePushState = true;
48
55
  };
49
56
 
50
57
  const getProductIdFromMapping = (item, productIdMapping) => {
@@ -127,7 +134,7 @@ var ProvidersFacebookSdk = (function () {
127
134
  };
128
135
  const tag = ({ data, eventName, manifestVariables, eventId }) => {
129
136
  const payload = {
130
- sdkVersion: "0.45.4" ,
137
+ sdkVersion: "0.46.1" ,
131
138
  };
132
139
  if (window.fbq &&
133
140
  !!manifestVariables['pixelId'] &&
package/index.mjs CHANGED
@@ -2,6 +2,12 @@ const packageName = 'facebook';
2
2
  const sdkUrl = 'https://connect.facebook.net/en_US/fbevents.js';
3
3
 
4
4
  // eslint-disable-next-line @nx/enforce-module-boundaries
5
+ const getFbq = () => {
6
+ if (!window || !window.fbq) {
7
+ return null;
8
+ }
9
+ return window.fbq;
10
+ };
5
11
  const snippet = () => {
6
12
  if (!window || !document || window.fbq) {
7
13
  return;
@@ -35,13 +41,14 @@ const init = ({ manifest, userId }) => {
35
41
  return;
36
42
  }
37
43
  snippet();
38
- if (!window.fbq) {
44
+ const wrapper = getFbq();
45
+ if (!wrapper) {
39
46
  return;
40
47
  }
41
- window['fbq']('init', manifest.variables['pixelId'], {
48
+ wrapper('init', manifest.variables['pixelId'], {
42
49
  external_id: userId,
43
50
  });
44
- window['fbq'].disablePushState = true;
51
+ wrapper.disablePushState = true;
45
52
  };
46
53
 
47
54
  const getProductIdFromMapping = (item, productIdMapping) => {
@@ -124,7 +131,7 @@ const prepareData = (data, productIdMapping) => {
124
131
  };
125
132
  const tag = ({ data, eventName, manifestVariables, eventId }) => {
126
133
  const payload = {
127
- sdkVersion: "0.45.4" ,
134
+ sdkVersion: "0.46.1" ,
128
135
  };
129
136
  if (window.fbq &&
130
137
  !!manifestVariables['pixelId'] &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-facebook-sdk",
3
- "version": "0.45.4",
3
+ "version": "0.46.1",
4
4
  "description": "Facebook Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",