@ixon-cdk/iframe-adapter 1.2.0-next.7 → 1.2.0-next.9

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 +45 -50
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -54,10 +54,6 @@ class ComponentContext {
54
54
  }
55
55
 
56
56
  _messageHandler(event) {
57
- if (event.origin !== window.origin) {
58
- return;
59
- }
60
-
61
57
  if (event.source !== window.parent) {
62
58
  return;
63
59
  }
@@ -91,7 +87,7 @@ class ComponentContext {
91
87
  type: EVENTS.ResourceDataClientCreate,
92
88
  payload: { clientId },
93
89
  },
94
- window.origin,
90
+ '*',
95
91
  );
96
92
  return new ResourceDataClient(clientId);
97
93
  }
@@ -101,7 +97,7 @@ class ComponentContext {
101
97
  }
102
98
 
103
99
  destroy() {
104
- window.parent.postMessage({ type: EVENTS.Destroy }, window.origin);
100
+ window.parent.postMessage({ type: EVENTS.Destroy }, '*');
105
101
  window.removeEventListener('message', this._messageHandler, false);
106
102
  this.destroyed = true;
107
103
  }
@@ -132,7 +128,7 @@ class ComponentContext {
132
128
  navigateByUrl(url) {
133
129
  window.parent.postMessage(
134
130
  { type: EVENTS.NavigateByUrl, payload: { url } },
135
- window.origin,
131
+ '*',
136
132
  );
137
133
  }
138
134
 
@@ -146,7 +142,7 @@ class ComponentContext {
146
142
  type: EVENTS.SetTimeRange,
147
143
  payload: { timeRange },
148
144
  },
149
- window.origin,
145
+ '*',
150
146
  );
151
147
  }
152
148
 
@@ -156,7 +152,7 @@ class ComponentContext {
156
152
  type: EVENTS.ShowVpnStatusDetails,
157
153
  payload: { agentId },
158
154
  },
159
- window.origin,
155
+ '*',
160
156
  );
161
157
  }
162
158
 
@@ -167,7 +163,7 @@ class ComponentContext {
167
163
  toggleVpn(agentId) {
168
164
  window.parent.postMessage(
169
165
  { type: EVENTS.ToggleVpn, payload: { agentId } },
170
- window.origin,
166
+ '*',
171
167
  );
172
168
  }
173
169
 
@@ -191,7 +187,7 @@ class ResourceDataClient {
191
187
  type: EVENTS.ResourceDataClientQuery,
192
188
  payload: { clientId: this.id, queryId, query },
193
189
  },
194
- window.origin,
190
+ '*',
195
191
  );
196
192
 
197
193
  return () => {
@@ -199,10 +195,6 @@ class ResourceDataClient {
199
195
  };
200
196
 
201
197
  function _queryHandler(event) {
202
- if (event.origin !== window.origin) {
203
- return;
204
- }
205
-
206
198
  if (event.source !== window.parent) {
207
199
  return;
208
200
  }
@@ -226,7 +218,7 @@ class ResourceDataClient {
226
218
  type: EVENTS.ResourceDataClientRender,
227
219
  payload: { clientId: this.id, queryId, query },
228
220
  },
229
- window.origin,
221
+ '*',
230
222
  );
231
223
 
232
224
  return () => {
@@ -234,10 +226,6 @@ class ResourceDataClient {
234
226
  };
235
227
 
236
228
  function _queryHandler(event) {
237
- if (event.origin !== window.origin) {
238
- return;
239
- }
240
-
241
229
  if (event.source !== window.parent) {
242
230
  return;
243
231
  }
@@ -257,7 +245,7 @@ class ResourceDataClient {
257
245
  type: EVENTS.ResourceDataClientDestroy,
258
246
  payload: { clientId: this.id },
259
247
  },
260
- window.origin,
248
+ '*',
261
249
  );
262
250
  }
263
251
  }
@@ -273,10 +261,6 @@ export function getComponentContext(options) {
273
261
  window.addEventListener(
274
262
  'message',
275
263
  function messageHandler(event) {
276
- if (event.origin !== window.origin) {
277
- return;
278
- }
279
-
280
264
  if (event.source !== window.parent) {
281
265
  return;
282
266
  }
@@ -306,7 +290,7 @@ export function getComponentContext(options) {
306
290
  );
307
291
 
308
292
  // dispatch "create" event
309
- window.parent.postMessage({ type: EVENTS.Create }, window.origin);
293
+ window.parent.postMessage({ type: EVENTS.Create }, '*');
310
294
  });
311
295
  }
312
296
 
@@ -316,20 +300,26 @@ export function connect({ iframe, context }) {
316
300
  // Broadcasts time range changes to connected iframe
317
301
  context.ontimerangechange = (...args) => {
318
302
  if (iframe.contentWindow) {
319
- iframe.contentWindow.postMessage({
320
- type: EVENTS.TimeRangeChange,
321
- payload: args,
322
- });
303
+ iframe.contentWindow.postMessage(
304
+ {
305
+ type: EVENTS.TimeRangeChange,
306
+ payload: args,
307
+ },
308
+ '*',
309
+ );
323
310
  }
324
311
  };
325
312
 
326
313
  // Broadcasts VPN Client status changes to connected iframe
327
314
  context.onvpnclientstatuschange = (...args) => {
328
315
  if (iframe.contentWindow) {
329
- iframe.contentWindow.postMessage({
330
- type: EVENTS.VpnClientStatusChange,
331
- payload: args,
332
- });
316
+ iframe.contentWindow.postMessage(
317
+ {
318
+ type: EVENTS.VpnClientStatusChange,
319
+ payload: args,
320
+ },
321
+ '*',
322
+ );
333
323
  }
334
324
  };
335
325
 
@@ -360,10 +350,6 @@ export function connect({ iframe, context }) {
360
350
  _adapterMessageHandler._clients =
361
351
  _adapterMessageHandler._clients || new Map([]);
362
352
 
363
- if (event.origin !== window.origin) {
364
- return;
365
- }
366
-
367
353
  if (event.source !== iframe.contentWindow) {
368
354
  return;
369
355
  }
@@ -373,10 +359,13 @@ export function connect({ iframe, context }) {
373
359
  * Lifecycle
374
360
  */
375
361
  case EVENTS.Create:
376
- iframe.contentWindow.postMessage({
377
- type: EVENTS.Created,
378
- payload: _getSerializableContext(context),
379
- });
362
+ iframe.contentWindow.postMessage(
363
+ {
364
+ type: EVENTS.Created,
365
+ payload: _getSerializableContext(context),
366
+ },
367
+ '*',
368
+ );
380
369
  break;
381
370
  case EVENTS.Destroy:
382
371
  context.destroy();
@@ -405,10 +394,13 @@ export function connect({ iframe, context }) {
405
394
  if (client && !client._destroyed) {
406
395
  client.query(query, results => {
407
396
  if (client && !client._destroyed) {
408
- iframe.contentWindow.postMessage({
409
- type: EVENTS.ResourceDataClientQueryResult,
410
- payload: { queryId, results },
411
- });
397
+ iframe.contentWindow.postMessage(
398
+ {
399
+ type: EVENTS.ResourceDataClientQueryResult,
400
+ payload: { queryId, results },
401
+ },
402
+ '*',
403
+ );
412
404
  }
413
405
  });
414
406
  }
@@ -420,10 +412,13 @@ export function connect({ iframe, context }) {
420
412
  if (client && !client._destroyed) {
421
413
  client.render(query, results => {
422
414
  if (client && !client._destroyed) {
423
- iframe.contentWindow.postMessage({
424
- type: EVENTS.ResourceDataClientRenderResult,
425
- payload: { queryId, results },
426
- });
415
+ iframe.contentWindow.postMessage(
416
+ {
417
+ type: EVENTS.ResourceDataClientRenderResult,
418
+ payload: { queryId, results },
419
+ },
420
+ '*',
421
+ );
427
422
  }
428
423
  });
429
424
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixon-cdk/iframe-adapter",
3
- "version": "1.2.0-next.7",
3
+ "version": "1.2.0-next.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "",
@@ -10,6 +10,6 @@
10
10
  "index.d.ts"
11
11
  ],
12
12
  "peerDependencies": {
13
- "@ixon-cdk/types": "^1.2.0-next.7"
13
+ "@ixon-cdk/types": "^1.2.0-next.9"
14
14
  }
15
15
  }