@uniformdev/context 20.49.3 → 20.49.4-alpha.2

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.
package/dist/index.esm.js CHANGED
@@ -2183,10 +2183,20 @@ calculateScores_fn = function(newData) {
2183
2183
 
2184
2184
  // src/devTools/enableContextDevTools.ts
2185
2185
  var isBrowser = typeof top !== "undefined";
2186
+ function isInCrossOriginIframe() {
2187
+ if (!isBrowser) {
2188
+ return false;
2189
+ }
2190
+ try {
2191
+ return top !== window && !(top == null ? void 0 : top.location.href);
2192
+ } catch (e) {
2193
+ return true;
2194
+ }
2195
+ }
2186
2196
  function enableContextDevTools(options) {
2187
2197
  return {
2188
2198
  logDrain: (message) => {
2189
- if (!isBrowser) {
2199
+ if (!isBrowser || isInCrossOriginIframe()) {
2190
2200
  return;
2191
2201
  }
2192
2202
  top == null ? void 0 : top.postMessage(
@@ -2198,6 +2208,11 @@ function enableContextDevTools(options) {
2198
2208
  );
2199
2209
  },
2200
2210
  init: (context) => {
2211
+ if (isInCrossOriginIframe()) {
2212
+ console.info("Uniform Context DevTools disabled in cross-origin iframe");
2213
+ return () => {
2214
+ };
2215
+ }
2201
2216
  const personalizations = [];
2202
2217
  const tests = [];
2203
2218
  const onContextDataUpdated = () => {
package/dist/index.js CHANGED
@@ -2276,10 +2276,20 @@ calculateScores_fn = function(newData) {
2276
2276
 
2277
2277
  // src/devTools/enableContextDevTools.ts
2278
2278
  var isBrowser = typeof top !== "undefined";
2279
+ function isInCrossOriginIframe() {
2280
+ if (!isBrowser) {
2281
+ return false;
2282
+ }
2283
+ try {
2284
+ return top !== window && !(top == null ? void 0 : top.location.href);
2285
+ } catch (e) {
2286
+ return true;
2287
+ }
2288
+ }
2279
2289
  function enableContextDevTools(options) {
2280
2290
  return {
2281
2291
  logDrain: (message) => {
2282
- if (!isBrowser) {
2292
+ if (!isBrowser || isInCrossOriginIframe()) {
2283
2293
  return;
2284
2294
  }
2285
2295
  top == null ? void 0 : top.postMessage(
@@ -2291,6 +2301,11 @@ function enableContextDevTools(options) {
2291
2301
  );
2292
2302
  },
2293
2303
  init: (context) => {
2304
+ if (isInCrossOriginIframe()) {
2305
+ console.info("Uniform Context DevTools disabled in cross-origin iframe");
2306
+ return () => {
2307
+ };
2308
+ }
2294
2309
  const personalizations = [];
2295
2310
  const tests = [];
2296
2311
  const onContextDataUpdated = () => {
package/dist/index.mjs CHANGED
@@ -2183,10 +2183,20 @@ calculateScores_fn = function(newData) {
2183
2183
 
2184
2184
  // src/devTools/enableContextDevTools.ts
2185
2185
  var isBrowser = typeof top !== "undefined";
2186
+ function isInCrossOriginIframe() {
2187
+ if (!isBrowser) {
2188
+ return false;
2189
+ }
2190
+ try {
2191
+ return top !== window && !(top == null ? void 0 : top.location.href);
2192
+ } catch (e) {
2193
+ return true;
2194
+ }
2195
+ }
2186
2196
  function enableContextDevTools(options) {
2187
2197
  return {
2188
2198
  logDrain: (message) => {
2189
- if (!isBrowser) {
2199
+ if (!isBrowser || isInCrossOriginIframe()) {
2190
2200
  return;
2191
2201
  }
2192
2202
  top == null ? void 0 : top.postMessage(
@@ -2198,6 +2208,11 @@ function enableContextDevTools(options) {
2198
2208
  );
2199
2209
  },
2200
2210
  init: (context) => {
2211
+ if (isInCrossOriginIframe()) {
2212
+ console.info("Uniform Context DevTools disabled in cross-origin iframe");
2213
+ return () => {
2214
+ };
2215
+ }
2201
2216
  const personalizations = [];
2202
2217
  const tests = [];
2203
2218
  const onContextDataUpdated = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/context",
3
- "version": "20.49.3",
3
+ "version": "20.49.4-alpha.2+0201693aca",
4
4
  "description": "Uniform Context core package",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "a6424635c7b318f5039e4d9c4d5a2ec72125af46"
73
+ "gitHead": "0201693aca0f20b06ffaaef22decc086ec730035"
74
74
  }