@blotoutio/edgetag-sdk-browser 1.37.1 → 1.37.3

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 +19 -21
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -521,6 +521,7 @@
521
521
  return true;
522
522
  };
523
523
 
524
+ const resolveProviders = (p) => p && Object.keys(p).length > 0 ? p : { all: true };
524
525
  /**
525
526
  * Get a nested value from an object using dot notation
526
527
  */
@@ -710,12 +711,12 @@
710
711
  * @returns Updated payload, providers, skipEvent flag, and additional event names
711
712
  */
712
713
  const applyActions = (actions, payload, providers) => {
713
- var _a;
714
714
  const updatedPayload = structuredClone(payload);
715
715
  if (!updatedPayload.data) {
716
716
  updatedPayload.data = {};
717
717
  }
718
- const updatedProviders = ((_a = providers !== null && providers !== void 0 ? providers : updatedPayload.providers) !== null && _a !== void 0 ? _a : { all: true });
718
+ const incomingProviders = providers !== null && providers !== void 0 ? providers : updatedPayload.providers;
719
+ const updatedProviders = resolveProviders(incomingProviders);
719
720
  let skipEvent = false;
720
721
  let skipBrowserEvent = false;
721
722
  const additionalEvents = [];
@@ -785,9 +786,9 @@
785
786
  * @returns Updated payload, providers, skipEvent flag, and additional event names
786
787
  */
787
788
  const evaluateEventRules = (rules, payload, providers, userData = {}) => {
788
- var _a;
789
789
  let updatedPayload = payload;
790
- let updatedProviders = ((_a = providers !== null && providers !== void 0 ? providers : payload.providers) !== null && _a !== void 0 ? _a : { all: true });
790
+ const incomingProviders = providers !== null && providers !== void 0 ? providers : payload.providers;
791
+ let updatedProviders = resolveProviders(incomingProviders);
791
792
  let skipEvent = false;
792
793
  let skipBrowserEvent = false;
793
794
  const allAdditionalEvents = [];
@@ -994,23 +995,20 @@
994
995
  session: manifestResult.session,
995
996
  });
996
997
  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
- });
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';
1013
1007
  }
1008
+ const userProperties = getSetting(destination, 'userProperties');
1009
+ setSetting(destination, {
1010
+ userProperties: { ...userProperties, ...latestUserProperties },
1011
+ });
1014
1012
  };
1015
1013
 
1016
1014
  const tagStorage = 'edgeTag';
@@ -1303,7 +1301,7 @@
1303
1301
  referrer: getReferrer(destination),
1304
1302
  search: getSearch(destination),
1305
1303
  locale: getLocale(),
1306
- sdkVersion: "1.37.1" ,
1304
+ sdkVersion: "1.37.3" ,
1307
1305
  ...(payload || {}),
1308
1306
  };
1309
1307
  let storage = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-browser",
3
- "version": "1.37.1",
3
+ "version": "1.37.3",
4
4
  "description": "Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",