@builder.io/sdk 6.0.6 → 6.0.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @builder.io/sdk
2
2
 
3
+ ## 6.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - a6eee0e: Fix: Functions in plugins will be selectively serialized
8
+
9
+ ## 6.0.7
10
+
11
+ ### Patch Changes
12
+
13
+ - c8d7674: Stricter trusted origin check
14
+
3
15
  ## 6.0.6
4
16
 
5
17
  ### Patch Changes
@@ -1052,7 +1052,7 @@
1052
1052
 
1053
1053
  var DEFAULT_API_VERSION = 'v3';
1054
1054
 
1055
- var SDK_VERSION = '6.0.6';
1055
+ var SDK_VERSION = '6.0.8';
1056
1056
 
1057
1057
  function datePlusMinutes(minutes) {
1058
1058
  if (minutes === void 0) { minutes = 30; }
@@ -1323,7 +1323,7 @@
1323
1323
  }
1324
1324
  Builder.register = function (type, info) {
1325
1325
  if (type === 'plugin') {
1326
- info = this.serializeIncludingFunctions(info);
1326
+ info = this.serializeIncludingFunctions(info, true);
1327
1327
  }
1328
1328
  // TODO: all must have name and can't conflict?
1329
1329
  var typeList = this.registry[type];
@@ -1393,6 +1393,9 @@
1393
1393
  return isTrusted;
1394
1394
  };
1395
1395
  Builder.isTrustedHostForEvent = function (event) {
1396
+ if (event.origin === 'null') {
1397
+ return false;
1398
+ }
1396
1399
  var url = parse(event.origin);
1397
1400
  return url.hostname && Builder.isTrustedHost(url.hostname);
1398
1401
  };
@@ -1451,7 +1454,7 @@
1451
1454
  enumerable: false,
1452
1455
  configurable: true
1453
1456
  });
1454
- Builder.serializeIncludingFunctions = function (info) {
1457
+ Builder.serializeIncludingFunctions = function (info, isForPlugin) {
1455
1458
  var serializeFn = function (fnValue) {
1456
1459
  var fnStr = fnValue.toString().trim();
1457
1460
  // we need to account for a few different fn syntaxes:
@@ -1469,12 +1472,17 @@
1469
1472
  !isArrowWithoutParens;
1470
1473
  return "return (".concat(appendFunction ? 'function ' : '').concat(fnStr, ").apply(this, arguments)");
1471
1474
  };
1472
- return JSON.parse(JSON.stringify(info, function (key, value) {
1473
- if (typeof value === 'function') {
1475
+ var objToReturn = JSON.parse(JSON.stringify(info, function (key, value) {
1476
+ var shouldNotSerializeFn = isForPlugin && key === 'onSave';
1477
+ if (typeof value === 'function' && !shouldNotSerializeFn) {
1474
1478
  return serializeFn(value);
1475
1479
  }
1476
1480
  return value;
1477
1481
  }));
1482
+ if (isForPlugin) {
1483
+ objToReturn.onSave = info.onSave;
1484
+ }
1485
+ return objToReturn;
1478
1486
  };
1479
1487
  Builder.prepareComponentSpecToSend = function (spec) {
1480
1488
  return __assign(__assign({}, this.serializeIncludingFunctions(spec)), { class: undefined });