@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/dist/index.cjs.js CHANGED
@@ -126,7 +126,7 @@ function assertAllowedPropertyName(name) {
126
126
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
127
127
  }
128
128
 
129
- var version = "2.2.9";
129
+ var version = "3.0.1";
130
130
 
131
131
  var Subscription = /** @class */ (function () {
132
132
  function Subscription(listeners, listener) {
@@ -1226,6 +1226,9 @@ var Builder = /** @class */ (function () {
1226
1226
  }
1227
1227
  }
1228
1228
  Builder.register = function (type, info) {
1229
+ if (type === 'plugin') {
1230
+ info = this.serializeIncludingFunctions(info);
1231
+ }
1229
1232
  // TODO: all must have name and can't conflict?
1230
1233
  var typeList = this.registry[type];
1231
1234
  if (!typeList) {
@@ -1347,7 +1350,7 @@ var Builder = /** @class */ (function () {
1347
1350
  enumerable: false,
1348
1351
  configurable: true
1349
1352
  });
1350
- Builder.serializeComponentInfo = function (info) {
1353
+ Builder.serializeIncludingFunctions = function (info) {
1351
1354
  var serializeFn = function (fnValue) {
1352
1355
  var fnStr = fnValue.toString().trim();
1353
1356
  // we need to account for a few different fn syntaxes:
@@ -1365,7 +1368,7 @@ var Builder = /** @class */ (function () {
1365
1368
  }));
1366
1369
  };
1367
1370
  Builder.prepareComponentSpecToSend = function (spec) {
1368
- return tslib.__assign(tslib.__assign({}, this.serializeComponentInfo(spec)), { class: undefined });
1371
+ return tslib.__assign(tslib.__assign({}, this.serializeIncludingFunctions(spec)), { class: undefined });
1369
1372
  };
1370
1373
  Builder.registerBlock = function (component, options) {
1371
1374
  this.registerComponent(component, options);
@@ -2247,7 +2250,7 @@ var Builder = /** @class */ (function () {
2247
2250
  // even though we only use `fetch()` now, we prefer to keep the old behavior and use the `fetch` that comes from
2248
2251
  // the core SDK for consistency
2249
2252
  Builder.prototype.requestUrl = function (url, options) {
2250
- return getFetch()(url, tslib.__assign({ next: tslib.__assign({ revalidate: 1 }, options === null || options === void 0 ? void 0 : options.next) }, options)).then(function (res) { return res.json(); });
2253
+ return getFetch()(url, options).then(function (res) { return res.json(); });
2251
2254
  };
2252
2255
  Object.defineProperty(Builder.prototype, "host", {
2253
2256
  get: function () {
@@ -2343,7 +2346,7 @@ var Builder = /** @class */ (function () {
2343
2346
  }
2344
2347
  // TODO: merge in the attribute from query string ones
2345
2348
  // TODO: make this an option per component/request
2346
- queryParams.userAttributes = userAttributes;
2349
+ queryParams.userAttributes = JSON.stringify(userAttributes);
2347
2350
  if (!usePastQueue && !useQueue) {
2348
2351
  this.priorContentQueue = queue;
2349
2352
  this.getContentQueue = null;
@@ -2421,7 +2424,7 @@ var Builder = /** @class */ (function () {
2421
2424
  }
2422
2425
  var queryStr = QueryString.stringifyDeep(queryParams);
2423
2426
  var format = queryParams.format;
2424
- var requestOptions = { headers: {}, next: { revalidate: 1 } };
2427
+ var requestOptions = { headers: {} };
2425
2428
  if (this.authToken) {
2426
2429
  requestOptions.headers = tslib.__assign(tslib.__assign({}, requestOptions.headers), { Authorization: "Bearer ".concat(this.authToken) });
2427
2430
  }