@interopio/browser 3.1.2 → 3.1.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.
@@ -6124,7 +6124,7 @@
6124
6124
  }
6125
6125
  }
6126
6126
 
6127
- var version$2 = "3.1.2";
6127
+ var version$2 = "3.1.3";
6128
6128
 
6129
6129
  const createFactoryFunction = (coreFactoryFunction) => {
6130
6130
  return (userConfig) => __awaiter$1(void 0, void 0, void 0, function* () {
@@ -8445,7 +8445,7 @@
8445
8445
  });
8446
8446
  };
8447
8447
  GW3ProtocolImpl.prototype.getNewGWToken = function () {
8448
- if (typeof window !== undefined) {
8448
+ if (typeof window !== "undefined") {
8449
8449
  var glue42gd = window.glue42gd;
8450
8450
  if (glue42gd) {
8451
8451
  return glue42gd.getGWToken();
@@ -8783,6 +8783,11 @@
8783
8783
  if (!data || _this.rejected) {
8784
8784
  return;
8785
8785
  }
8786
+ var allowedOrigins = _this.settings.allowedOrigins || [];
8787
+ if (allowedOrigins.length && !allowedOrigins.includes(event.origin)) {
8788
+ _this.logger.warn("received a message from an origin which is not in the allowed list: ".concat(event.origin));
8789
+ return;
8790
+ }
8786
8791
  if (!_this.checkMessageTypeValid(data.type)) {
8787
8792
  _this.logger.error("cannot handle the incoming glue42 core message, because the type is invalid: ".concat(data.type));
8788
8793
  return;
@@ -8890,6 +8895,11 @@
8890
8895
  if (!extData) {
8891
8896
  return;
8892
8897
  }
8898
+ var allowedOrigins = _this.settings.allowedOrigins || [];
8899
+ if (allowedOrigins.length && !allowedOrigins.includes(event.origin)) {
8900
+ _this.logger.warn("received a message from an origin which is not in the allowed list: ".concat(event.origin));
8901
+ return;
8902
+ }
8893
8903
  _this.registry.execute("onMessage", extData);
8894
8904
  });
8895
8905
  if (this.connectionResolve) {
@@ -9767,7 +9777,7 @@
9767
9777
  }
9768
9778
  };
9769
9779
 
9770
- var version = "6.1.0";
9780
+ var version = "6.1.1";
9771
9781
 
9772
9782
  function prepareConfig (configuration, ext, glue42gd) {
9773
9783
  var _a, _b, _c, _d;
@@ -13548,41 +13558,46 @@
13548
13558
  return this.registerCore(methodDefinition, wrappedCallbackFunction);
13549
13559
  };
13550
13560
  Server.prototype.registerAsync = function (methodDefinition, callback) {
13561
+ var _this = this;
13551
13562
  if (!methodDefinition) {
13552
13563
  return Promise.reject("Method definition is required. Please, provide either a unique string for a method name or a “methodDefinition” object with a required “name” property.");
13553
13564
  }
13554
13565
  if (typeof callback !== "function") {
13555
13566
  return Promise.reject("The second parameter must be a callback function. Method: ".concat(typeof methodDefinition === "string" ? methodDefinition : methodDefinition.name));
13556
13567
  }
13557
- var wrappedCallback = function (context, resultCallback) {
13558
- try {
13559
- var resultCalled_1 = false;
13560
- var success = function (result) {
13561
- if (!resultCalled_1) {
13562
- resultCallback(undefined, result);
13563
- }
13564
- resultCalled_1 = true;
13565
- };
13566
- var error = function (e) {
13567
- if (!resultCalled_1) {
13568
- if (!e) {
13569
- e = "";
13568
+ var wrappedCallback = function (context, resultCallback) { return __awaiter(_this, void 0, void 0, function () {
13569
+ var resultCalled_1, success, error, methodResult;
13570
+ return __generator(this, function (_a) {
13571
+ try {
13572
+ resultCalled_1 = false;
13573
+ success = function (result) {
13574
+ if (!resultCalled_1) {
13575
+ resultCallback(undefined, result);
13570
13576
  }
13571
- resultCallback(e, e);
13577
+ resultCalled_1 = true;
13578
+ };
13579
+ error = function (e) {
13580
+ if (!resultCalled_1) {
13581
+ if (!e) {
13582
+ e = "";
13583
+ }
13584
+ resultCallback(e, e);
13585
+ }
13586
+ resultCalled_1 = true;
13587
+ };
13588
+ methodResult = callback(context.args, context.instance, success, error);
13589
+ if (methodResult && typeof methodResult.then === "function") {
13590
+ methodResult
13591
+ .then(success)
13592
+ .catch(error);
13572
13593
  }
13573
- resultCalled_1 = true;
13574
- };
13575
- var methodResult = callback(context.args, context.instance, success, error);
13576
- if (methodResult && typeof methodResult.then === "function") {
13577
- methodResult
13578
- .then(success)
13579
- .catch(error);
13580
13594
  }
13581
- }
13582
- catch (e) {
13583
- resultCallback(e, undefined);
13584
- }
13585
- };
13595
+ catch (e) {
13596
+ resultCallback(e, undefined);
13597
+ }
13598
+ return [2];
13599
+ });
13600
+ }); };
13586
13601
  wrappedCallback.userCallbackAsync = callback;
13587
13602
  return this.registerCore(methodDefinition, wrappedCallback);
13588
13603
  };
@@ -13693,7 +13708,7 @@
13693
13708
  return [2, Promise.reject("Please, provide a (unique) string value for the \u201Cname\u201D property in the \u201CmethodDefinition\u201D object: ".concat(JSON.stringify(method)))];
13694
13709
  }
13695
13710
  unregisterInProgress = this.currentlyUnregistering[methodDefinition.name];
13696
- if (!unregisterInProgress) return [3, 2];
13711
+ if (!(typeof unregisterInProgress !== "undefined")) return [3, 2];
13697
13712
  return [4, unregisterInProgress];
13698
13713
  case 1:
13699
13714
  _a.sent();