@blotoutio/providers-facebook-sdk 0.29.0 → 0.30.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 +9 -4
- package/index.js +9 -4
- package/index.mjs +9 -4
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const packageName = 'facebook';
|
|
4
|
+
const sdkUrl = 'https://connect.facebook.net/en_US/fbevents.js';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
3
7
|
const snippet = () => {
|
|
4
8
|
if (!window || !document || window.fbq) {
|
|
5
9
|
return;
|
|
@@ -20,7 +24,7 @@ const snippet = () => {
|
|
|
20
24
|
n['queue'] = [];
|
|
21
25
|
const element = document.createElement('script');
|
|
22
26
|
element.async = !0;
|
|
23
|
-
element.src =
|
|
27
|
+
element.src = sdkUrl;
|
|
24
28
|
const script = document.getElementsByTagName('script')[0];
|
|
25
29
|
if (script && script.parentNode) {
|
|
26
30
|
script.parentNode.insertBefore(element, script);
|
|
@@ -42,7 +46,7 @@ const init = ({ manifest, userId }) => {
|
|
|
42
46
|
|
|
43
47
|
const getProductMappingModel = (productIdMapping, useVariantId) => {
|
|
44
48
|
const value = productIdMapping || useVariantId || '0';
|
|
45
|
-
return value && /^[012]$/.test(value) ? value : '0';
|
|
49
|
+
return (value && /^[012]$/.test(value) ? value : '0');
|
|
46
50
|
};
|
|
47
51
|
const getProductId = (productIdMapping, item) => {
|
|
48
52
|
if (productIdMapping === '1') {
|
|
@@ -119,7 +123,7 @@ const prepareData = (data, productIdMapping) => {
|
|
|
119
123
|
};
|
|
120
124
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
121
125
|
const payload = {
|
|
122
|
-
sdkVersion: "0.
|
|
126
|
+
sdkVersion: "0.30.0" ,
|
|
123
127
|
};
|
|
124
128
|
if (window.fbq && manifestVariables['enableBrowser'] === '1') {
|
|
125
129
|
const eventData = data['skipTransformation'] === true
|
|
@@ -133,8 +137,9 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
|
133
137
|
return payload;
|
|
134
138
|
};
|
|
135
139
|
|
|
140
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
136
141
|
const data = {
|
|
137
|
-
name:
|
|
142
|
+
name: packageName,
|
|
138
143
|
tag,
|
|
139
144
|
init,
|
|
140
145
|
};
|
package/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
var ProvidersFacebookSdk = (function () {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
const packageName = 'facebook';
|
|
5
|
+
const sdkUrl = 'https://connect.facebook.net/en_US/fbevents.js';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
4
8
|
const snippet = () => {
|
|
5
9
|
if (!window || !document || window.fbq) {
|
|
6
10
|
return;
|
|
@@ -21,7 +25,7 @@ var ProvidersFacebookSdk = (function () {
|
|
|
21
25
|
n['queue'] = [];
|
|
22
26
|
const element = document.createElement('script');
|
|
23
27
|
element.async = !0;
|
|
24
|
-
element.src =
|
|
28
|
+
element.src = sdkUrl;
|
|
25
29
|
const script = document.getElementsByTagName('script')[0];
|
|
26
30
|
if (script && script.parentNode) {
|
|
27
31
|
script.parentNode.insertBefore(element, script);
|
|
@@ -43,7 +47,7 @@ var ProvidersFacebookSdk = (function () {
|
|
|
43
47
|
|
|
44
48
|
const getProductMappingModel = (productIdMapping, useVariantId) => {
|
|
45
49
|
const value = productIdMapping || useVariantId || '0';
|
|
46
|
-
return value && /^[012]$/.test(value) ? value : '0';
|
|
50
|
+
return (value && /^[012]$/.test(value) ? value : '0');
|
|
47
51
|
};
|
|
48
52
|
const getProductId = (productIdMapping, item) => {
|
|
49
53
|
if (productIdMapping === '1') {
|
|
@@ -120,7 +124,7 @@ var ProvidersFacebookSdk = (function () {
|
|
|
120
124
|
};
|
|
121
125
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
122
126
|
const payload = {
|
|
123
|
-
sdkVersion: "0.
|
|
127
|
+
sdkVersion: "0.30.0" ,
|
|
124
128
|
};
|
|
125
129
|
if (window.fbq && manifestVariables['enableBrowser'] === '1') {
|
|
126
130
|
const eventData = data['skipTransformation'] === true
|
|
@@ -134,8 +138,9 @@ var ProvidersFacebookSdk = (function () {
|
|
|
134
138
|
return payload;
|
|
135
139
|
};
|
|
136
140
|
|
|
141
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
137
142
|
const data = {
|
|
138
|
-
name:
|
|
143
|
+
name: packageName,
|
|
139
144
|
tag,
|
|
140
145
|
init,
|
|
141
146
|
};
|
package/index.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
const packageName = 'facebook';
|
|
2
|
+
const sdkUrl = 'https://connect.facebook.net/en_US/fbevents.js';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
1
5
|
const snippet = () => {
|
|
2
6
|
if (!window || !document || window.fbq) {
|
|
3
7
|
return;
|
|
@@ -18,7 +22,7 @@ const snippet = () => {
|
|
|
18
22
|
n['queue'] = [];
|
|
19
23
|
const element = document.createElement('script');
|
|
20
24
|
element.async = !0;
|
|
21
|
-
element.src =
|
|
25
|
+
element.src = sdkUrl;
|
|
22
26
|
const script = document.getElementsByTagName('script')[0];
|
|
23
27
|
if (script && script.parentNode) {
|
|
24
28
|
script.parentNode.insertBefore(element, script);
|
|
@@ -40,7 +44,7 @@ const init = ({ manifest, userId }) => {
|
|
|
40
44
|
|
|
41
45
|
const getProductMappingModel = (productIdMapping, useVariantId) => {
|
|
42
46
|
const value = productIdMapping || useVariantId || '0';
|
|
43
|
-
return value && /^[012]$/.test(value) ? value : '0';
|
|
47
|
+
return (value && /^[012]$/.test(value) ? value : '0');
|
|
44
48
|
};
|
|
45
49
|
const getProductId = (productIdMapping, item) => {
|
|
46
50
|
if (productIdMapping === '1') {
|
|
@@ -117,7 +121,7 @@ const prepareData = (data, productIdMapping) => {
|
|
|
117
121
|
};
|
|
118
122
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
119
123
|
const payload = {
|
|
120
|
-
sdkVersion: "0.
|
|
124
|
+
sdkVersion: "0.30.0" ,
|
|
121
125
|
};
|
|
122
126
|
if (window.fbq && manifestVariables['enableBrowser'] === '1') {
|
|
123
127
|
const eventData = data['skipTransformation'] === true
|
|
@@ -131,8 +135,9 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
|
131
135
|
return payload;
|
|
132
136
|
};
|
|
133
137
|
|
|
138
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
134
139
|
const data = {
|
|
135
|
-
name:
|
|
140
|
+
name: packageName,
|
|
136
141
|
tag,
|
|
137
142
|
init,
|
|
138
143
|
};
|