@blotoutio/edgetag-sdk-js 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 (3) hide show
  1. package/index.cjs.js +19 -21
  2. package/index.mjs +19 -21
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -520,6 +520,7 @@ const doesGeoRequestMatchList = (requestCountry, requestRegion, isEUCountry, geo
520
520
  return true;
521
521
  };
522
522
 
523
+ const resolveProviders = (p) => p && Object.keys(p).length > 0 ? p : { all: true };
523
524
  /**
524
525
  * Get a nested value from an object using dot notation
525
526
  */
@@ -709,12 +710,12 @@ const evaluateConditions = (conditions, logicalOperator, payload, userData = {})
709
710
  * @returns Updated payload, providers, skipEvent flag, and additional event names
710
711
  */
711
712
  const applyActions = (actions, payload, providers) => {
712
- var _a;
713
713
  const updatedPayload = structuredClone(payload);
714
714
  if (!updatedPayload.data) {
715
715
  updatedPayload.data = {};
716
716
  }
717
- const updatedProviders = ((_a = providers !== null && providers !== void 0 ? providers : updatedPayload.providers) !== null && _a !== void 0 ? _a : { all: true });
717
+ const incomingProviders = providers !== null && providers !== void 0 ? providers : updatedPayload.providers;
718
+ const updatedProviders = resolveProviders(incomingProviders);
718
719
  let skipEvent = false;
719
720
  let skipBrowserEvent = false;
720
721
  const additionalEvents = [];
@@ -784,9 +785,9 @@ const applyActions = (actions, payload, providers) => {
784
785
  * @returns Updated payload, providers, skipEvent flag, and additional event names
785
786
  */
786
787
  const evaluateEventRules = (rules, payload, providers, userData = {}) => {
787
- var _a;
788
788
  let updatedPayload = payload;
789
- let updatedProviders = ((_a = providers !== null && providers !== void 0 ? providers : payload.providers) !== null && _a !== void 0 ? _a : { all: true });
789
+ const incomingProviders = providers !== null && providers !== void 0 ? providers : payload.providers;
790
+ let updatedProviders = resolveProviders(incomingProviders);
790
791
  let skipEvent = false;
791
792
  let skipBrowserEvent = false;
792
793
  const allAdditionalEvents = [];
@@ -993,23 +994,20 @@ const getInitData = (edgeURL, manifestResult) => ({
993
994
  session: manifestResult.session,
994
995
  });
995
996
  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
- });
997
+ const latestUserProperties = {};
998
+ if (data['email']) {
999
+ latestUserProperties['hasEmail'] = true;
1000
+ }
1001
+ if (data['phone']) {
1002
+ latestUserProperties['hasPhone'] = true;
1003
+ }
1004
+ if (typeof data['isNewCustomer'] === 'string') {
1005
+ latestUserProperties['isNewCustomer'] = data['isNewCustomer'] === 'true';
1012
1006
  }
1007
+ const userProperties = getSetting(destination, 'userProperties');
1008
+ setSetting(destination, {
1009
+ userProperties: { ...userProperties, ...latestUserProperties },
1010
+ });
1013
1011
  };
1014
1012
 
1015
1013
  const tagStorage = 'edgeTag';
@@ -1302,7 +1300,7 @@ const getStandardPayload = (destination, payload) => {
1302
1300
  referrer: getReferrer(destination),
1303
1301
  search: getSearch(destination),
1304
1302
  locale: getLocale(),
1305
- sdkVersion: "1.37.1" ,
1303
+ sdkVersion: "1.37.3" ,
1306
1304
  ...(payload || {}),
1307
1305
  };
1308
1306
  let storage = {};
package/index.mjs CHANGED
@@ -518,6 +518,7 @@ const doesGeoRequestMatchList = (requestCountry, requestRegion, isEUCountry, geo
518
518
  return true;
519
519
  };
520
520
 
521
+ const resolveProviders = (p) => p && Object.keys(p).length > 0 ? p : { all: true };
521
522
  /**
522
523
  * Get a nested value from an object using dot notation
523
524
  */
@@ -707,12 +708,12 @@ const evaluateConditions = (conditions, logicalOperator, payload, userData = {})
707
708
  * @returns Updated payload, providers, skipEvent flag, and additional event names
708
709
  */
709
710
  const applyActions = (actions, payload, providers) => {
710
- var _a;
711
711
  const updatedPayload = structuredClone(payload);
712
712
  if (!updatedPayload.data) {
713
713
  updatedPayload.data = {};
714
714
  }
715
- const updatedProviders = ((_a = providers !== null && providers !== void 0 ? providers : updatedPayload.providers) !== null && _a !== void 0 ? _a : { all: true });
715
+ const incomingProviders = providers !== null && providers !== void 0 ? providers : updatedPayload.providers;
716
+ const updatedProviders = resolveProviders(incomingProviders);
716
717
  let skipEvent = false;
717
718
  let skipBrowserEvent = false;
718
719
  const additionalEvents = [];
@@ -782,9 +783,9 @@ const applyActions = (actions, payload, providers) => {
782
783
  * @returns Updated payload, providers, skipEvent flag, and additional event names
783
784
  */
784
785
  const evaluateEventRules = (rules, payload, providers, userData = {}) => {
785
- var _a;
786
786
  let updatedPayload = payload;
787
- let updatedProviders = ((_a = providers !== null && providers !== void 0 ? providers : payload.providers) !== null && _a !== void 0 ? _a : { all: true });
787
+ const incomingProviders = providers !== null && providers !== void 0 ? providers : payload.providers;
788
+ let updatedProviders = resolveProviders(incomingProviders);
788
789
  let skipEvent = false;
789
790
  let skipBrowserEvent = false;
790
791
  const allAdditionalEvents = [];
@@ -991,23 +992,20 @@ const getInitData = (edgeURL, manifestResult) => ({
991
992
  session: manifestResult.session,
992
993
  });
993
994
  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
- });
995
+ const latestUserProperties = {};
996
+ if (data['email']) {
997
+ latestUserProperties['hasEmail'] = true;
998
+ }
999
+ if (data['phone']) {
1000
+ latestUserProperties['hasPhone'] = true;
1001
+ }
1002
+ if (typeof data['isNewCustomer'] === 'string') {
1003
+ latestUserProperties['isNewCustomer'] = data['isNewCustomer'] === 'true';
1010
1004
  }
1005
+ const userProperties = getSetting(destination, 'userProperties');
1006
+ setSetting(destination, {
1007
+ userProperties: { ...userProperties, ...latestUserProperties },
1008
+ });
1011
1009
  };
1012
1010
 
1013
1011
  const tagStorage = 'edgeTag';
@@ -1300,7 +1298,7 @@ const getStandardPayload = (destination, payload) => {
1300
1298
  referrer: getReferrer(destination),
1301
1299
  search: getSearch(destination),
1302
1300
  locale: getLocale(),
1303
- sdkVersion: "1.37.1" ,
1301
+ sdkVersion: "1.37.3" ,
1304
1302
  ...(payload || {}),
1305
1303
  };
1306
1304
  let storage = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "1.37.1",
3
+ "version": "1.37.3",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",