@blotoutio/edgetag-sdk-js 1.36.2 → 1.37.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.
Files changed (3) hide show
  1. package/index.cjs.js +22 -1
  2. package/index.mjs +22 -1
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -992,6 +992,25 @@ const getInitData = (edgeURL, manifestResult) => ({
992
992
  consentSetting: manifestResult.consentSetting,
993
993
  session: manifestResult.session,
994
994
  });
995
+ const updateUserProperties = (destination, data) => {
996
+ const configuratorSetting = getSetting(destination, 'configuratorSetting');
997
+ if (configuratorSetting === null || configuratorSetting === void 0 ? void 0 : configuratorSetting.length) {
998
+ const latestUserProperties = {};
999
+ if (data['email']) {
1000
+ latestUserProperties['hasEmail'] = true;
1001
+ }
1002
+ if (data['phone']) {
1003
+ latestUserProperties['hasPhone'] = true;
1004
+ }
1005
+ if (typeof data['isNewCustomer'] === 'string') {
1006
+ latestUserProperties['isNewCustomer'] = data['isNewCustomer'] === 'true';
1007
+ }
1008
+ const userProperties = getSetting(destination, 'userProperties');
1009
+ setSetting(destination, {
1010
+ userProperties: { ...userProperties, ...latestUserProperties },
1011
+ });
1012
+ }
1013
+ };
995
1014
 
996
1015
  const tagStorage = 'edgeTag';
997
1016
  const consentKey = 'consent';
@@ -1283,7 +1302,7 @@ const getStandardPayload = (destination, payload) => {
1283
1302
  referrer: getReferrer(destination),
1284
1303
  search: getSearch(destination),
1285
1304
  locale: getLocale(),
1286
- sdkVersion: "1.36.2" ,
1305
+ sdkVersion: "1.37.1" ,
1287
1306
  ...(payload || {}),
1288
1307
  };
1289
1308
  let storage = {};
@@ -1608,6 +1627,7 @@ const hasAllowedManifestTags = (tags, consent, providersConfig) => {
1608
1627
 
1609
1628
  const processData = (destination, data, providers, options) => {
1610
1629
  saveKV(destination, data);
1630
+ updateUserProperties(destination, data);
1611
1631
  const providerPackages = getSetting(destination, 'browserPackages');
1612
1632
  const configuredTags = getSetting(destination, 'channels');
1613
1633
  const userId = getUserId$1(destination);
@@ -2138,6 +2158,7 @@ const processUser = (destination, key, value, providers, options) => {
2138
2158
  saveKV(destination, {
2139
2159
  [key]: value,
2140
2160
  });
2161
+ updateUserProperties(destination, { [key]: value });
2141
2162
  const providerPackages = getSetting(destination, 'browserPackages');
2142
2163
  const configuredTags = getSetting(destination, 'channels');
2143
2164
  const userId = getUserId$1(destination);
package/index.mjs CHANGED
@@ -990,6 +990,25 @@ const getInitData = (edgeURL, manifestResult) => ({
990
990
  consentSetting: manifestResult.consentSetting,
991
991
  session: manifestResult.session,
992
992
  });
993
+ const updateUserProperties = (destination, data) => {
994
+ const configuratorSetting = getSetting(destination, 'configuratorSetting');
995
+ if (configuratorSetting === null || configuratorSetting === void 0 ? void 0 : configuratorSetting.length) {
996
+ const latestUserProperties = {};
997
+ if (data['email']) {
998
+ latestUserProperties['hasEmail'] = true;
999
+ }
1000
+ if (data['phone']) {
1001
+ latestUserProperties['hasPhone'] = true;
1002
+ }
1003
+ if (typeof data['isNewCustomer'] === 'string') {
1004
+ latestUserProperties['isNewCustomer'] = data['isNewCustomer'] === 'true';
1005
+ }
1006
+ const userProperties = getSetting(destination, 'userProperties');
1007
+ setSetting(destination, {
1008
+ userProperties: { ...userProperties, ...latestUserProperties },
1009
+ });
1010
+ }
1011
+ };
993
1012
 
994
1013
  const tagStorage = 'edgeTag';
995
1014
  const consentKey = 'consent';
@@ -1281,7 +1300,7 @@ const getStandardPayload = (destination, payload) => {
1281
1300
  referrer: getReferrer(destination),
1282
1301
  search: getSearch(destination),
1283
1302
  locale: getLocale(),
1284
- sdkVersion: "1.36.2" ,
1303
+ sdkVersion: "1.37.1" ,
1285
1304
  ...(payload || {}),
1286
1305
  };
1287
1306
  let storage = {};
@@ -1606,6 +1625,7 @@ const hasAllowedManifestTags = (tags, consent, providersConfig) => {
1606
1625
 
1607
1626
  const processData = (destination, data, providers, options) => {
1608
1627
  saveKV(destination, data);
1628
+ updateUserProperties(destination, data);
1609
1629
  const providerPackages = getSetting(destination, 'browserPackages');
1610
1630
  const configuredTags = getSetting(destination, 'channels');
1611
1631
  const userId = getUserId$1(destination);
@@ -2136,6 +2156,7 @@ const processUser = (destination, key, value, providers, options) => {
2136
2156
  saveKV(destination, {
2137
2157
  [key]: value,
2138
2158
  });
2159
+ updateUserProperties(destination, { [key]: value });
2139
2160
  const providerPackages = getSetting(destination, 'browserPackages');
2140
2161
  const configuredTags = getSetting(destination, 'channels');
2141
2162
  const userId = getUserId$1(destination);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "1.36.2",
3
+ "version": "1.37.1",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",