@weldsuite/helpdesk-widget-sdk 1.0.13 → 1.0.15

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.umd.js CHANGED
@@ -1029,11 +1029,7 @@
1029
1029
  * Validate message origin
1030
1030
  */
1031
1031
  isOriginAllowed(origin) {
1032
- // If no allowed origins specified, only allow same origin
1033
- if (this.config.allowedOrigins?.length === 0) {
1034
- return origin === window.location.origin;
1035
- }
1036
- // Check if origin is in allowed list
1032
+ // Check if origin is in allowed list (includes same-origin and programmatically added origins)
1037
1033
  if (this.allowedOrigins.has(origin)) {
1038
1034
  return true;
1039
1035
  }
@@ -1291,6 +1287,15 @@
1291
1287
  this.logger = logger.child('[MessageBroker]');
1292
1288
  this.iframeManager = iframeManager;
1293
1289
  this.security = new SecurityManager(config.security, this.logger);
1290
+ // Automatically trust messages from the widget's base URL
1291
+ // The iframes load from api.baseUrl, so we must accept their postMessages
1292
+ try {
1293
+ const widgetOrigin = new URL(config.api.baseUrl).origin;
1294
+ this.security.addAllowedOrigin(widgetOrigin);
1295
+ }
1296
+ catch {
1297
+ // Invalid URL, will rely on configured allowedOrigins
1298
+ }
1294
1299
  this.rateLimiter = new RateLimiter(100, 60000); // 100 messages per minute
1295
1300
  // Bind handlers once for proper cleanup
1296
1301
  this.boundHandleMessage = this.handleMessage.bind(this);
@@ -2396,7 +2401,7 @@
2396
2401
  }
2397
2402
  }
2398
2403
 
2399
- var version = "1.0.13";
2404
+ var version = "1.0.15";
2400
2405
  var packageJson = {
2401
2406
  version: version};
2402
2407