@blotoutio/edgetag-sdk-js 1.38.1 → 1.40.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 (3) hide show
  1. package/index.cjs.js +14 -9
  2. package/index.mjs +14 -9
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -838,17 +838,22 @@ const getGlobalSettings = () => {
838
838
  return ((_a = globalThis.edgeTagSettings) !== null && _a !== void 0 ? _a : (globalThis.edgeTagSettings = {}));
839
839
  };
840
840
  const initSettings = (destination, options) => {
841
+ var _a, _b, _c, _d, _e, _f, _g, _h;
841
842
  const settings = getGlobalSettings();
843
+ const existing = settings[destination];
844
+ // Preserve existing critical state if settings already exist
845
+ // This prevents clearing stubs, initialized flag, and other state
846
+ // when init is called multiple times for the same destination
842
847
  settings[destination] = {
843
848
  destination,
844
- initialized: false,
845
- stubs: [],
846
- browserPackages: [],
847
- channels: new Map(),
848
- geoCountry: null,
849
- geoRegion: null,
850
- isEURequest: false,
851
- consentSetting: {
849
+ initialized: (_a = existing === null || existing === void 0 ? void 0 : existing.initialized) !== null && _a !== void 0 ? _a : false,
850
+ stubs: (_b = existing === null || existing === void 0 ? void 0 : existing.stubs) !== null && _b !== void 0 ? _b : [],
851
+ browserPackages: (_c = existing === null || existing === void 0 ? void 0 : existing.browserPackages) !== null && _c !== void 0 ? _c : [],
852
+ channels: (_d = existing === null || existing === void 0 ? void 0 : existing.channels) !== null && _d !== void 0 ? _d : new Map(),
853
+ geoCountry: (_e = existing === null || existing === void 0 ? void 0 : existing.geoCountry) !== null && _e !== void 0 ? _e : null,
854
+ geoRegion: (_f = existing === null || existing === void 0 ? void 0 : existing.geoRegion) !== null && _f !== void 0 ? _f : null,
855
+ isEURequest: (_g = existing === null || existing === void 0 ? void 0 : existing.isEURequest) !== null && _g !== void 0 ? _g : false,
856
+ consentSetting: (_h = existing === null || existing === void 0 ? void 0 : existing.consentSetting) !== null && _h !== void 0 ? _h : {
852
857
  enabled: false,
853
858
  channels: {},
854
859
  },
@@ -1300,7 +1305,7 @@ const getStandardPayload = (destination, payload) => {
1300
1305
  referrer: getReferrer(destination),
1301
1306
  search: getSearch(destination),
1302
1307
  locale: getLocale(),
1303
- sdkVersion: "1.38.1" ,
1308
+ sdkVersion: "1.40.0" ,
1304
1309
  ...(payload || {}),
1305
1310
  };
1306
1311
  let storage = {};
package/index.mjs CHANGED
@@ -836,17 +836,22 @@ const getGlobalSettings = () => {
836
836
  return ((_a = globalThis.edgeTagSettings) !== null && _a !== void 0 ? _a : (globalThis.edgeTagSettings = {}));
837
837
  };
838
838
  const initSettings = (destination, options) => {
839
+ var _a, _b, _c, _d, _e, _f, _g, _h;
839
840
  const settings = getGlobalSettings();
841
+ const existing = settings[destination];
842
+ // Preserve existing critical state if settings already exist
843
+ // This prevents clearing stubs, initialized flag, and other state
844
+ // when init is called multiple times for the same destination
840
845
  settings[destination] = {
841
846
  destination,
842
- initialized: false,
843
- stubs: [],
844
- browserPackages: [],
845
- channels: new Map(),
846
- geoCountry: null,
847
- geoRegion: null,
848
- isEURequest: false,
849
- consentSetting: {
847
+ initialized: (_a = existing === null || existing === void 0 ? void 0 : existing.initialized) !== null && _a !== void 0 ? _a : false,
848
+ stubs: (_b = existing === null || existing === void 0 ? void 0 : existing.stubs) !== null && _b !== void 0 ? _b : [],
849
+ browserPackages: (_c = existing === null || existing === void 0 ? void 0 : existing.browserPackages) !== null && _c !== void 0 ? _c : [],
850
+ channels: (_d = existing === null || existing === void 0 ? void 0 : existing.channels) !== null && _d !== void 0 ? _d : new Map(),
851
+ geoCountry: (_e = existing === null || existing === void 0 ? void 0 : existing.geoCountry) !== null && _e !== void 0 ? _e : null,
852
+ geoRegion: (_f = existing === null || existing === void 0 ? void 0 : existing.geoRegion) !== null && _f !== void 0 ? _f : null,
853
+ isEURequest: (_g = existing === null || existing === void 0 ? void 0 : existing.isEURequest) !== null && _g !== void 0 ? _g : false,
854
+ consentSetting: (_h = existing === null || existing === void 0 ? void 0 : existing.consentSetting) !== null && _h !== void 0 ? _h : {
850
855
  enabled: false,
851
856
  channels: {},
852
857
  },
@@ -1298,7 +1303,7 @@ const getStandardPayload = (destination, payload) => {
1298
1303
  referrer: getReferrer(destination),
1299
1304
  search: getSearch(destination),
1300
1305
  locale: getLocale(),
1301
- sdkVersion: "1.38.1" ,
1306
+ sdkVersion: "1.40.0" ,
1302
1307
  ...(payload || {}),
1303
1308
  };
1304
1309
  let storage = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "1.38.1",
3
+ "version": "1.40.0",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",