@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.
@@ -6118,7 +6118,7 @@ class IoC {
6118
6118
  }
6119
6119
  }
6120
6120
 
6121
- var version$2 = "3.1.2";
6121
+ var version$2 = "3.1.3";
6122
6122
 
6123
6123
  const createFactoryFunction = (coreFactoryFunction) => {
6124
6124
  return (userConfig) => __awaiter$1(void 0, void 0, void 0, function* () {
@@ -8439,7 +8439,7 @@ var GW3ProtocolImpl = (function () {
8439
8439
  });
8440
8440
  };
8441
8441
  GW3ProtocolImpl.prototype.getNewGWToken = function () {
8442
- if (typeof window !== undefined) {
8442
+ if (typeof window !== "undefined") {
8443
8443
  var glue42gd = window.glue42gd;
8444
8444
  if (glue42gd) {
8445
8445
  return glue42gd.getGWToken();
@@ -8777,6 +8777,11 @@ var WebPlatformTransport = (function () {
8777
8777
  if (!data || _this.rejected) {
8778
8778
  return;
8779
8779
  }
8780
+ var allowedOrigins = _this.settings.allowedOrigins || [];
8781
+ if (allowedOrigins.length && !allowedOrigins.includes(event.origin)) {
8782
+ _this.logger.warn("received a message from an origin which is not in the allowed list: ".concat(event.origin));
8783
+ return;
8784
+ }
8780
8785
  if (!_this.checkMessageTypeValid(data.type)) {
8781
8786
  _this.logger.error("cannot handle the incoming glue42 core message, because the type is invalid: ".concat(data.type));
8782
8787
  return;
@@ -8884,6 +8889,11 @@ var WebPlatformTransport = (function () {
8884
8889
  if (!extData) {
8885
8890
  return;
8886
8891
  }
8892
+ var allowedOrigins = _this.settings.allowedOrigins || [];
8893
+ if (allowedOrigins.length && !allowedOrigins.includes(event.origin)) {
8894
+ _this.logger.warn("received a message from an origin which is not in the allowed list: ".concat(event.origin));
8895
+ return;
8896
+ }
8887
8897
  _this.registry.execute("onMessage", extData);
8888
8898
  });
8889
8899
  if (this.connectionResolve) {
@@ -9761,7 +9771,7 @@ var ContextMessageReplaySpec = {
9761
9771
  }
9762
9772
  };
9763
9773
 
9764
- var version = "6.1.0";
9774
+ var version = "6.1.1";
9765
9775
 
9766
9776
  function prepareConfig (configuration, ext, glue42gd) {
9767
9777
  var _a, _b, _c, _d;
@@ -13542,41 +13552,46 @@ var Server = (function () {
13542
13552
  return this.registerCore(methodDefinition, wrappedCallbackFunction);
13543
13553
  };
13544
13554
  Server.prototype.registerAsync = function (methodDefinition, callback) {
13555
+ var _this = this;
13545
13556
  if (!methodDefinition) {
13546
13557
  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.");
13547
13558
  }
13548
13559
  if (typeof callback !== "function") {
13549
13560
  return Promise.reject("The second parameter must be a callback function. Method: ".concat(typeof methodDefinition === "string" ? methodDefinition : methodDefinition.name));
13550
13561
  }
13551
- var wrappedCallback = function (context, resultCallback) {
13552
- try {
13553
- var resultCalled_1 = false;
13554
- var success = function (result) {
13555
- if (!resultCalled_1) {
13556
- resultCallback(undefined, result);
13557
- }
13558
- resultCalled_1 = true;
13559
- };
13560
- var error = function (e) {
13561
- if (!resultCalled_1) {
13562
- if (!e) {
13563
- e = "";
13562
+ var wrappedCallback = function (context, resultCallback) { return __awaiter(_this, void 0, void 0, function () {
13563
+ var resultCalled_1, success, error, methodResult;
13564
+ return __generator(this, function (_a) {
13565
+ try {
13566
+ resultCalled_1 = false;
13567
+ success = function (result) {
13568
+ if (!resultCalled_1) {
13569
+ resultCallback(undefined, result);
13564
13570
  }
13565
- resultCallback(e, e);
13571
+ resultCalled_1 = true;
13572
+ };
13573
+ error = function (e) {
13574
+ if (!resultCalled_1) {
13575
+ if (!e) {
13576
+ e = "";
13577
+ }
13578
+ resultCallback(e, e);
13579
+ }
13580
+ resultCalled_1 = true;
13581
+ };
13582
+ methodResult = callback(context.args, context.instance, success, error);
13583
+ if (methodResult && typeof methodResult.then === "function") {
13584
+ methodResult
13585
+ .then(success)
13586
+ .catch(error);
13566
13587
  }
13567
- resultCalled_1 = true;
13568
- };
13569
- var methodResult = callback(context.args, context.instance, success, error);
13570
- if (methodResult && typeof methodResult.then === "function") {
13571
- methodResult
13572
- .then(success)
13573
- .catch(error);
13574
13588
  }
13575
- }
13576
- catch (e) {
13577
- resultCallback(e, undefined);
13578
- }
13579
- };
13589
+ catch (e) {
13590
+ resultCallback(e, undefined);
13591
+ }
13592
+ return [2];
13593
+ });
13594
+ }); };
13580
13595
  wrappedCallback.userCallbackAsync = callback;
13581
13596
  return this.registerCore(methodDefinition, wrappedCallback);
13582
13597
  };
@@ -13687,7 +13702,7 @@ var Server = (function () {
13687
13702
  return [2, Promise.reject("Please, provide a (unique) string value for the \u201Cname\u201D property in the \u201CmethodDefinition\u201D object: ".concat(JSON.stringify(method)))];
13688
13703
  }
13689
13704
  unregisterInProgress = this.currentlyUnregistering[methodDefinition.name];
13690
- if (!unregisterInProgress) return [3, 2];
13705
+ if (!(typeof unregisterInProgress !== "undefined")) return [3, 2];
13691
13706
  return [4, unregisterInProgress];
13692
13707
  case 1:
13693
13708
  _a.sent();