@builder.io/sdk 2.2.9 → 3.0.1

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,21 @@
1
1
  # @builder.io/sdk
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 69859d4: serialize functions for registering plugins so you can have showIf on fields as functions
8
+
9
+ ## 3.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - bc1d409: Fix: Reintroduced `JSON.stringify(userAttributes)` change to standardize parsing logic and preserve strings. This is a breaking change as it doesn't require manual stringification of `userAttributes` values. Ensure that attributes are not manually stringified before passing them to avoid potential issues.
14
+
15
+ ### Patch Changes
16
+
17
+ - 1586519: Fix: remove `next: { revalidate: 1 }` in SDKs fetch
18
+
3
19
  ## 2.2.9
4
20
 
5
21
  ### Patch Changes
@@ -152,7 +152,7 @@
152
152
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
153
153
  }
154
154
 
155
- var version = "2.2.9";
155
+ var version = "3.0.1";
156
156
 
157
157
  var Subscription = /** @class */ (function () {
158
158
  function Subscription(listeners, listener) {
@@ -1320,6 +1320,9 @@
1320
1320
  }
1321
1321
  }
1322
1322
  Builder.register = function (type, info) {
1323
+ if (type === 'plugin') {
1324
+ info = this.serializeIncludingFunctions(info);
1325
+ }
1323
1326
  // TODO: all must have name and can't conflict?
1324
1327
  var typeList = this.registry[type];
1325
1328
  if (!typeList) {
@@ -1441,7 +1444,7 @@
1441
1444
  enumerable: false,
1442
1445
  configurable: true
1443
1446
  });
1444
- Builder.serializeComponentInfo = function (info) {
1447
+ Builder.serializeIncludingFunctions = function (info) {
1445
1448
  var serializeFn = function (fnValue) {
1446
1449
  var fnStr = fnValue.toString().trim();
1447
1450
  // we need to account for a few different fn syntaxes:
@@ -1459,7 +1462,7 @@
1459
1462
  }));
1460
1463
  };
1461
1464
  Builder.prepareComponentSpecToSend = function (spec) {
1462
- return __assign(__assign({}, this.serializeComponentInfo(spec)), { class: undefined });
1465
+ return __assign(__assign({}, this.serializeIncludingFunctions(spec)), { class: undefined });
1463
1466
  };
1464
1467
  Builder.registerBlock = function (component, options) {
1465
1468
  this.registerComponent(component, options);
@@ -2341,7 +2344,7 @@
2341
2344
  // even though we only use `fetch()` now, we prefer to keep the old behavior and use the `fetch` that comes from
2342
2345
  // the core SDK for consistency
2343
2346
  Builder.prototype.requestUrl = function (url, options) {
2344
- return getFetch()(url, __assign({ next: __assign({ revalidate: 1 }, options === null || options === void 0 ? void 0 : options.next) }, options)).then(function (res) { return res.json(); });
2347
+ return getFetch()(url, options).then(function (res) { return res.json(); });
2345
2348
  };
2346
2349
  Object.defineProperty(Builder.prototype, "host", {
2347
2350
  get: function () {
@@ -2437,7 +2440,7 @@
2437
2440
  }
2438
2441
  // TODO: merge in the attribute from query string ones
2439
2442
  // TODO: make this an option per component/request
2440
- queryParams.userAttributes = userAttributes;
2443
+ queryParams.userAttributes = JSON.stringify(userAttributes);
2441
2444
  if (!usePastQueue && !useQueue) {
2442
2445
  this.priorContentQueue = queue;
2443
2446
  this.getContentQueue = null;
@@ -2515,7 +2518,7 @@
2515
2518
  }
2516
2519
  var queryStr = QueryString.stringifyDeep(queryParams);
2517
2520
  var format = queryParams.format;
2518
- var requestOptions = { headers: {}, next: { revalidate: 1 } };
2521
+ var requestOptions = { headers: {} };
2519
2522
  if (this.authToken) {
2520
2523
  requestOptions.headers = __assign(__assign({}, requestOptions.headers), { Authorization: "Bearer ".concat(this.authToken) });
2521
2524
  }