@blotoutio/edgetag-sdk-js 1.56.0 → 1.57.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 +41 -37
- package/index.mjs +41 -37
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -1407,6 +1407,11 @@ const getSession = (key) => {
|
|
|
1407
1407
|
}
|
|
1408
1408
|
};
|
|
1409
1409
|
|
|
1410
|
+
const getIsNewCustomerFlag = async (getData) => {
|
|
1411
|
+
const { isNewCustomer } = await new Promise((resolve) => getData(['isNewCustomer'], resolve));
|
|
1412
|
+
return isNewCustomer ? isNewCustomer === 'true' : undefined;
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1410
1415
|
const getUserId$1 = (destination) => {
|
|
1411
1416
|
const userId = getSetting(destination, 'userId');
|
|
1412
1417
|
if (userId) {
|
|
@@ -1465,7 +1470,7 @@ const getStandardPayload = (destination, payload) => {
|
|
|
1465
1470
|
referrer: getReferrer(destination),
|
|
1466
1471
|
search: getSearch(destination),
|
|
1467
1472
|
locale: getLocale(),
|
|
1468
|
-
sdkVersion: "1.
|
|
1473
|
+
sdkVersion: "1.57.0" ,
|
|
1469
1474
|
...(payload || {}),
|
|
1470
1475
|
};
|
|
1471
1476
|
let storage = {};
|
|
@@ -1668,6 +1673,7 @@ const runPluginHook = async (plugins, hookName, baseParams) => {
|
|
|
1668
1673
|
const payload = baseParams['payload'];
|
|
1669
1674
|
let currentEventName = payload['eventName'];
|
|
1670
1675
|
let currentData = payload['data'];
|
|
1676
|
+
let currentProviders = baseParams['providers'];
|
|
1671
1677
|
let skip = false;
|
|
1672
1678
|
for (const plugin of plugins) {
|
|
1673
1679
|
const hook = plugin.rules[hookName];
|
|
@@ -1693,6 +1699,9 @@ const runPluginHook = async (plugins, hookName, baseParams) => {
|
|
|
1693
1699
|
if ((_b = result === null || result === void 0 ? void 0 : result.payload) === null || _b === void 0 ? void 0 : _b.data) {
|
|
1694
1700
|
currentData = result.payload.data;
|
|
1695
1701
|
}
|
|
1702
|
+
if ((result === null || result === void 0 ? void 0 : result.providers) !== undefined) {
|
|
1703
|
+
currentProviders = result.providers;
|
|
1704
|
+
}
|
|
1696
1705
|
if (result === null || result === void 0 ? void 0 : result.additionalEvents) {
|
|
1697
1706
|
for (const evt of result.additionalEvents) {
|
|
1698
1707
|
handleTag(evt.eventName, evt.data, undefined, undefined);
|
|
@@ -1706,6 +1715,7 @@ const runPluginHook = async (plugins, hookName, baseParams) => {
|
|
|
1706
1715
|
return {
|
|
1707
1716
|
eventName: currentEventName,
|
|
1708
1717
|
data: currentData,
|
|
1718
|
+
providers: currentProviders,
|
|
1709
1719
|
skip,
|
|
1710
1720
|
};
|
|
1711
1721
|
};
|
|
@@ -1756,23 +1766,29 @@ const processTag = async (destination, eventName, data = {}, providers, options)
|
|
|
1756
1766
|
providers = rulesResult.updatedProviders;
|
|
1757
1767
|
}
|
|
1758
1768
|
const plugins = getPlugins(destination);
|
|
1769
|
+
const pluginSettings = {
|
|
1770
|
+
userId,
|
|
1771
|
+
sessionId,
|
|
1772
|
+
geoCountry: requestCountry,
|
|
1773
|
+
geoRegion: requestRegion,
|
|
1774
|
+
isEURequest,
|
|
1775
|
+
ip,
|
|
1776
|
+
consent: consentChannel,
|
|
1777
|
+
consentCategories: consentCategory,
|
|
1778
|
+
userProperties,
|
|
1779
|
+
};
|
|
1780
|
+
const pluginContext = getStandardPayload(destination);
|
|
1781
|
+
const pluginUtilities = {
|
|
1782
|
+
getIsNewCustomerFlag: () => getIsNewCustomerFlag(processGetData.bind(null, destination)),
|
|
1783
|
+
};
|
|
1759
1784
|
if (plugins.length > 0) {
|
|
1760
|
-
const
|
|
1761
|
-
userId,
|
|
1762
|
-
sessionId,
|
|
1763
|
-
geoCountry: requestCountry,
|
|
1764
|
-
geoRegion: requestRegion,
|
|
1765
|
-
isEURequest,
|
|
1766
|
-
ip,
|
|
1767
|
-
consent: consentChannel,
|
|
1768
|
-
consentCategories: consentCategory,
|
|
1769
|
-
userProperties,
|
|
1770
|
-
};
|
|
1771
|
-
const baseParams = {
|
|
1785
|
+
const rootResult = await runPluginHook(plugins, 'tagRoot', {
|
|
1772
1786
|
payload: { eventName: currentEventName, data, eventId },
|
|
1787
|
+
context: pluginContext,
|
|
1788
|
+
providers,
|
|
1773
1789
|
settings: pluginSettings,
|
|
1774
|
-
|
|
1775
|
-
|
|
1790
|
+
utilities: pluginUtilities,
|
|
1791
|
+
});
|
|
1776
1792
|
if (rootResult.skip) {
|
|
1777
1793
|
sendTag(destination, {
|
|
1778
1794
|
configuratorProcessed: true,
|
|
@@ -1785,6 +1801,10 @@ const processTag = async (destination, eventName, data = {}, providers, options)
|
|
|
1785
1801
|
});
|
|
1786
1802
|
return;
|
|
1787
1803
|
}
|
|
1804
|
+
if (rootResult.providers !== undefined) {
|
|
1805
|
+
// eslint-disable-next-line no-param-reassign
|
|
1806
|
+
providers = rootResult.providers;
|
|
1807
|
+
}
|
|
1788
1808
|
currentEventName = rootResult.eventName;
|
|
1789
1809
|
// eslint-disable-next-line no-param-reassign
|
|
1790
1810
|
data = rootResult.data;
|
|
@@ -1808,18 +1828,10 @@ const processTag = async (destination, eventName, data = {}, providers, options)
|
|
|
1808
1828
|
data: channelData,
|
|
1809
1829
|
eventId,
|
|
1810
1830
|
},
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
sessionId,
|
|
1814
|
-
geoCountry: requestCountry,
|
|
1815
|
-
geoRegion: requestRegion,
|
|
1816
|
-
isEURequest,
|
|
1817
|
-
ip,
|
|
1818
|
-
consent: consentChannel,
|
|
1819
|
-
consentCategories: consentCategory,
|
|
1820
|
-
userProperties,
|
|
1821
|
-
},
|
|
1831
|
+
context: pluginContext,
|
|
1832
|
+
settings: pluginSettings,
|
|
1822
1833
|
providerId: pkg.name,
|
|
1834
|
+
utilities: pluginUtilities,
|
|
1823
1835
|
});
|
|
1824
1836
|
if (channelResult.skip)
|
|
1825
1837
|
continue;
|
|
@@ -1851,18 +1863,10 @@ const processTag = async (destination, eventName, data = {}, providers, options)
|
|
|
1851
1863
|
data: instanceData,
|
|
1852
1864
|
eventId,
|
|
1853
1865
|
},
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
sessionId,
|
|
1857
|
-
geoCountry: requestCountry,
|
|
1858
|
-
geoRegion: requestRegion,
|
|
1859
|
-
isEURequest,
|
|
1860
|
-
ip,
|
|
1861
|
-
consent: consentChannel,
|
|
1862
|
-
consentCategories: consentCategory,
|
|
1863
|
-
userProperties,
|
|
1864
|
-
},
|
|
1866
|
+
context: pluginContext,
|
|
1867
|
+
settings: pluginSettings,
|
|
1865
1868
|
providerId: pkg.name,
|
|
1869
|
+
utilities: pluginUtilities,
|
|
1866
1870
|
});
|
|
1867
1871
|
if (instanceResult.skip)
|
|
1868
1872
|
continue;
|
package/index.mjs
CHANGED
|
@@ -1405,6 +1405,11 @@ const getSession = (key) => {
|
|
|
1405
1405
|
}
|
|
1406
1406
|
};
|
|
1407
1407
|
|
|
1408
|
+
const getIsNewCustomerFlag = async (getData) => {
|
|
1409
|
+
const { isNewCustomer } = await new Promise((resolve) => getData(['isNewCustomer'], resolve));
|
|
1410
|
+
return isNewCustomer ? isNewCustomer === 'true' : undefined;
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1408
1413
|
const getUserId$1 = (destination) => {
|
|
1409
1414
|
const userId = getSetting(destination, 'userId');
|
|
1410
1415
|
if (userId) {
|
|
@@ -1463,7 +1468,7 @@ const getStandardPayload = (destination, payload) => {
|
|
|
1463
1468
|
referrer: getReferrer(destination),
|
|
1464
1469
|
search: getSearch(destination),
|
|
1465
1470
|
locale: getLocale(),
|
|
1466
|
-
sdkVersion: "1.
|
|
1471
|
+
sdkVersion: "1.57.0" ,
|
|
1467
1472
|
...(payload || {}),
|
|
1468
1473
|
};
|
|
1469
1474
|
let storage = {};
|
|
@@ -1666,6 +1671,7 @@ const runPluginHook = async (plugins, hookName, baseParams) => {
|
|
|
1666
1671
|
const payload = baseParams['payload'];
|
|
1667
1672
|
let currentEventName = payload['eventName'];
|
|
1668
1673
|
let currentData = payload['data'];
|
|
1674
|
+
let currentProviders = baseParams['providers'];
|
|
1669
1675
|
let skip = false;
|
|
1670
1676
|
for (const plugin of plugins) {
|
|
1671
1677
|
const hook = plugin.rules[hookName];
|
|
@@ -1691,6 +1697,9 @@ const runPluginHook = async (plugins, hookName, baseParams) => {
|
|
|
1691
1697
|
if ((_b = result === null || result === void 0 ? void 0 : result.payload) === null || _b === void 0 ? void 0 : _b.data) {
|
|
1692
1698
|
currentData = result.payload.data;
|
|
1693
1699
|
}
|
|
1700
|
+
if ((result === null || result === void 0 ? void 0 : result.providers) !== undefined) {
|
|
1701
|
+
currentProviders = result.providers;
|
|
1702
|
+
}
|
|
1694
1703
|
if (result === null || result === void 0 ? void 0 : result.additionalEvents) {
|
|
1695
1704
|
for (const evt of result.additionalEvents) {
|
|
1696
1705
|
handleTag(evt.eventName, evt.data, undefined, undefined);
|
|
@@ -1704,6 +1713,7 @@ const runPluginHook = async (plugins, hookName, baseParams) => {
|
|
|
1704
1713
|
return {
|
|
1705
1714
|
eventName: currentEventName,
|
|
1706
1715
|
data: currentData,
|
|
1716
|
+
providers: currentProviders,
|
|
1707
1717
|
skip,
|
|
1708
1718
|
};
|
|
1709
1719
|
};
|
|
@@ -1754,23 +1764,29 @@ const processTag = async (destination, eventName, data = {}, providers, options)
|
|
|
1754
1764
|
providers = rulesResult.updatedProviders;
|
|
1755
1765
|
}
|
|
1756
1766
|
const plugins = getPlugins(destination);
|
|
1767
|
+
const pluginSettings = {
|
|
1768
|
+
userId,
|
|
1769
|
+
sessionId,
|
|
1770
|
+
geoCountry: requestCountry,
|
|
1771
|
+
geoRegion: requestRegion,
|
|
1772
|
+
isEURequest,
|
|
1773
|
+
ip,
|
|
1774
|
+
consent: consentChannel,
|
|
1775
|
+
consentCategories: consentCategory,
|
|
1776
|
+
userProperties,
|
|
1777
|
+
};
|
|
1778
|
+
const pluginContext = getStandardPayload(destination);
|
|
1779
|
+
const pluginUtilities = {
|
|
1780
|
+
getIsNewCustomerFlag: () => getIsNewCustomerFlag(processGetData.bind(null, destination)),
|
|
1781
|
+
};
|
|
1757
1782
|
if (plugins.length > 0) {
|
|
1758
|
-
const
|
|
1759
|
-
userId,
|
|
1760
|
-
sessionId,
|
|
1761
|
-
geoCountry: requestCountry,
|
|
1762
|
-
geoRegion: requestRegion,
|
|
1763
|
-
isEURequest,
|
|
1764
|
-
ip,
|
|
1765
|
-
consent: consentChannel,
|
|
1766
|
-
consentCategories: consentCategory,
|
|
1767
|
-
userProperties,
|
|
1768
|
-
};
|
|
1769
|
-
const baseParams = {
|
|
1783
|
+
const rootResult = await runPluginHook(plugins, 'tagRoot', {
|
|
1770
1784
|
payload: { eventName: currentEventName, data, eventId },
|
|
1785
|
+
context: pluginContext,
|
|
1786
|
+
providers,
|
|
1771
1787
|
settings: pluginSettings,
|
|
1772
|
-
|
|
1773
|
-
|
|
1788
|
+
utilities: pluginUtilities,
|
|
1789
|
+
});
|
|
1774
1790
|
if (rootResult.skip) {
|
|
1775
1791
|
sendTag(destination, {
|
|
1776
1792
|
configuratorProcessed: true,
|
|
@@ -1783,6 +1799,10 @@ const processTag = async (destination, eventName, data = {}, providers, options)
|
|
|
1783
1799
|
});
|
|
1784
1800
|
return;
|
|
1785
1801
|
}
|
|
1802
|
+
if (rootResult.providers !== undefined) {
|
|
1803
|
+
// eslint-disable-next-line no-param-reassign
|
|
1804
|
+
providers = rootResult.providers;
|
|
1805
|
+
}
|
|
1786
1806
|
currentEventName = rootResult.eventName;
|
|
1787
1807
|
// eslint-disable-next-line no-param-reassign
|
|
1788
1808
|
data = rootResult.data;
|
|
@@ -1806,18 +1826,10 @@ const processTag = async (destination, eventName, data = {}, providers, options)
|
|
|
1806
1826
|
data: channelData,
|
|
1807
1827
|
eventId,
|
|
1808
1828
|
},
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
sessionId,
|
|
1812
|
-
geoCountry: requestCountry,
|
|
1813
|
-
geoRegion: requestRegion,
|
|
1814
|
-
isEURequest,
|
|
1815
|
-
ip,
|
|
1816
|
-
consent: consentChannel,
|
|
1817
|
-
consentCategories: consentCategory,
|
|
1818
|
-
userProperties,
|
|
1819
|
-
},
|
|
1829
|
+
context: pluginContext,
|
|
1830
|
+
settings: pluginSettings,
|
|
1820
1831
|
providerId: pkg.name,
|
|
1832
|
+
utilities: pluginUtilities,
|
|
1821
1833
|
});
|
|
1822
1834
|
if (channelResult.skip)
|
|
1823
1835
|
continue;
|
|
@@ -1849,18 +1861,10 @@ const processTag = async (destination, eventName, data = {}, providers, options)
|
|
|
1849
1861
|
data: instanceData,
|
|
1850
1862
|
eventId,
|
|
1851
1863
|
},
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
sessionId,
|
|
1855
|
-
geoCountry: requestCountry,
|
|
1856
|
-
geoRegion: requestRegion,
|
|
1857
|
-
isEURequest,
|
|
1858
|
-
ip,
|
|
1859
|
-
consent: consentChannel,
|
|
1860
|
-
consentCategories: consentCategory,
|
|
1861
|
-
userProperties,
|
|
1862
|
-
},
|
|
1864
|
+
context: pluginContext,
|
|
1865
|
+
settings: pluginSettings,
|
|
1863
1866
|
providerId: pkg.name,
|
|
1867
|
+
utilities: pluginUtilities,
|
|
1864
1868
|
});
|
|
1865
1869
|
if (instanceResult.skip)
|
|
1866
1870
|
continue;
|