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