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