@blotoutio/providers-facebook-sdk 0.30.1 → 0.32.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 +12 -11
- package/index.js +12 -11
- package/index.mjs +12 -11
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -44,19 +44,20 @@ const init = ({ manifest, userId }) => {
|
|
|
44
44
|
window['fbq'].disablePushState = true;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
const getProductIdFromMapping = (item, productIdMapping) => {
|
|
48
|
+
if (productIdMapping === '1' && item['variantId']) {
|
|
49
|
+
return item['variantId'];
|
|
50
|
+
}
|
|
51
|
+
if (productIdMapping === '2' && item['sku']) {
|
|
52
|
+
return item['sku'];
|
|
53
|
+
}
|
|
54
|
+
return item['id'];
|
|
55
|
+
};
|
|
56
|
+
|
|
47
57
|
const getProductMappingModel = (productIdMapping, useVariantId) => {
|
|
48
58
|
const value = productIdMapping || useVariantId || '0';
|
|
49
59
|
return (value && /^[012]$/.test(value) ? value : '0');
|
|
50
60
|
};
|
|
51
|
-
const getProductId = (productIdMapping, item) => {
|
|
52
|
-
if (productIdMapping === '1' && item.variantId) {
|
|
53
|
-
return item.variantId;
|
|
54
|
-
}
|
|
55
|
-
if (productIdMapping === '2' && item.sku) {
|
|
56
|
-
return item.sku;
|
|
57
|
-
}
|
|
58
|
-
return item.id;
|
|
59
|
-
};
|
|
60
61
|
const prepareData = (data, productIdMapping) => {
|
|
61
62
|
const payload = {
|
|
62
63
|
app: 'Blotout',
|
|
@@ -91,7 +92,7 @@ const prepareData = (data, productIdMapping) => {
|
|
|
91
92
|
if (data['contents'] && Array.isArray(data['contents'])) {
|
|
92
93
|
payload['contents'] = data['contents'].map((item) => {
|
|
93
94
|
const content = {};
|
|
94
|
-
const contentId =
|
|
95
|
+
const contentId = getProductIdFromMapping(item, productIdMapping);
|
|
95
96
|
if (contentId) {
|
|
96
97
|
content['id'] = contentId;
|
|
97
98
|
}
|
|
@@ -123,7 +124,7 @@ const prepareData = (data, productIdMapping) => {
|
|
|
123
124
|
};
|
|
124
125
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
125
126
|
const payload = {
|
|
126
|
-
sdkVersion: "0.
|
|
127
|
+
sdkVersion: "0.32.0" ,
|
|
127
128
|
};
|
|
128
129
|
if (window.fbq && manifestVariables['enableBrowser'] === '1') {
|
|
129
130
|
const eventData = data['skipTransformation'] === true
|
package/index.js
CHANGED
|
@@ -45,19 +45,20 @@ var ProvidersFacebookSdk = (function () {
|
|
|
45
45
|
window['fbq'].disablePushState = true;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
const getProductIdFromMapping = (item, productIdMapping) => {
|
|
49
|
+
if (productIdMapping === '1' && item['variantId']) {
|
|
50
|
+
return item['variantId'];
|
|
51
|
+
}
|
|
52
|
+
if (productIdMapping === '2' && item['sku']) {
|
|
53
|
+
return item['sku'];
|
|
54
|
+
}
|
|
55
|
+
return item['id'];
|
|
56
|
+
};
|
|
57
|
+
|
|
48
58
|
const getProductMappingModel = (productIdMapping, useVariantId) => {
|
|
49
59
|
const value = productIdMapping || useVariantId || '0';
|
|
50
60
|
return (value && /^[012]$/.test(value) ? value : '0');
|
|
51
61
|
};
|
|
52
|
-
const getProductId = (productIdMapping, item) => {
|
|
53
|
-
if (productIdMapping === '1' && item.variantId) {
|
|
54
|
-
return item.variantId;
|
|
55
|
-
}
|
|
56
|
-
if (productIdMapping === '2' && item.sku) {
|
|
57
|
-
return item.sku;
|
|
58
|
-
}
|
|
59
|
-
return item.id;
|
|
60
|
-
};
|
|
61
62
|
const prepareData = (data, productIdMapping) => {
|
|
62
63
|
const payload = {
|
|
63
64
|
app: 'Blotout',
|
|
@@ -92,7 +93,7 @@ var ProvidersFacebookSdk = (function () {
|
|
|
92
93
|
if (data['contents'] && Array.isArray(data['contents'])) {
|
|
93
94
|
payload['contents'] = data['contents'].map((item) => {
|
|
94
95
|
const content = {};
|
|
95
|
-
const contentId =
|
|
96
|
+
const contentId = getProductIdFromMapping(item, productIdMapping);
|
|
96
97
|
if (contentId) {
|
|
97
98
|
content['id'] = contentId;
|
|
98
99
|
}
|
|
@@ -124,7 +125,7 @@ var ProvidersFacebookSdk = (function () {
|
|
|
124
125
|
};
|
|
125
126
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
126
127
|
const payload = {
|
|
127
|
-
sdkVersion: "0.
|
|
128
|
+
sdkVersion: "0.32.0" ,
|
|
128
129
|
};
|
|
129
130
|
if (window.fbq && manifestVariables['enableBrowser'] === '1') {
|
|
130
131
|
const eventData = data['skipTransformation'] === true
|
package/index.mjs
CHANGED
|
@@ -42,19 +42,20 @@ const init = ({ manifest, userId }) => {
|
|
|
42
42
|
window['fbq'].disablePushState = true;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
const getProductIdFromMapping = (item, productIdMapping) => {
|
|
46
|
+
if (productIdMapping === '1' && item['variantId']) {
|
|
47
|
+
return item['variantId'];
|
|
48
|
+
}
|
|
49
|
+
if (productIdMapping === '2' && item['sku']) {
|
|
50
|
+
return item['sku'];
|
|
51
|
+
}
|
|
52
|
+
return item['id'];
|
|
53
|
+
};
|
|
54
|
+
|
|
45
55
|
const getProductMappingModel = (productIdMapping, useVariantId) => {
|
|
46
56
|
const value = productIdMapping || useVariantId || '0';
|
|
47
57
|
return (value && /^[012]$/.test(value) ? value : '0');
|
|
48
58
|
};
|
|
49
|
-
const getProductId = (productIdMapping, item) => {
|
|
50
|
-
if (productIdMapping === '1' && item.variantId) {
|
|
51
|
-
return item.variantId;
|
|
52
|
-
}
|
|
53
|
-
if (productIdMapping === '2' && item.sku) {
|
|
54
|
-
return item.sku;
|
|
55
|
-
}
|
|
56
|
-
return item.id;
|
|
57
|
-
};
|
|
58
59
|
const prepareData = (data, productIdMapping) => {
|
|
59
60
|
const payload = {
|
|
60
61
|
app: 'Blotout',
|
|
@@ -89,7 +90,7 @@ const prepareData = (data, productIdMapping) => {
|
|
|
89
90
|
if (data['contents'] && Array.isArray(data['contents'])) {
|
|
90
91
|
payload['contents'] = data['contents'].map((item) => {
|
|
91
92
|
const content = {};
|
|
92
|
-
const contentId =
|
|
93
|
+
const contentId = getProductIdFromMapping(item, productIdMapping);
|
|
93
94
|
if (contentId) {
|
|
94
95
|
content['id'] = contentId;
|
|
95
96
|
}
|
|
@@ -121,7 +122,7 @@ const prepareData = (data, productIdMapping) => {
|
|
|
121
122
|
};
|
|
122
123
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
123
124
|
const payload = {
|
|
124
|
-
sdkVersion: "0.
|
|
125
|
+
sdkVersion: "0.32.0" ,
|
|
125
126
|
};
|
|
126
127
|
if (window.fbq && manifestVariables['enableBrowser'] === '1') {
|
|
127
128
|
const eventData = data['skipTransformation'] === true
|