@builder.io/sdk 2.0.6 → 2.0.7

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index.browser.js +2726 -1
  3. package/dist/index.browser.js.map +1 -1
  4. package/dist/index.cjs.js +29 -31
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.d.ts +7 -7
  7. package/dist/index.esm.js +22 -26
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.umd.js +31 -30
  10. package/dist/index.umd.js.map +1 -1
  11. package/dist/package.json +13 -9
  12. package/dist/src/builder.class.d.ts +862 -862
  13. package/dist/src/classes/animator.class.d.ts +26 -26
  14. package/dist/src/classes/cookies.class.d.ts +15 -15
  15. package/dist/src/classes/observable.class.d.ts +27 -27
  16. package/dist/src/classes/promise.class.d.ts +17 -17
  17. package/dist/src/classes/query-string.class.d.ts +9 -9
  18. package/dist/src/classes/query-string.class.test.d.ts +1 -1
  19. package/dist/src/constants/builder.d.ts +2 -2
  20. package/dist/src/functions/assign.function.d.ts +1 -1
  21. package/dist/src/functions/fetch.function.d.ts +28 -28
  22. package/dist/src/functions/finder.function.d.ts +10 -10
  23. package/dist/src/functions/get-top-level-domain.d.ts +6 -6
  24. package/dist/src/functions/next-tick.function.d.ts +2 -1
  25. package/dist/src/functions/omit.function.d.ts +1 -1
  26. package/dist/src/functions/server-only-require.function.d.ts +3 -3
  27. package/dist/src/functions/throttle.function.d.ts +1 -1
  28. package/dist/src/functions/to-error.d.ts +13 -13
  29. package/dist/src/functions/uuid.d.ts +8 -8
  30. package/dist/src/types/api-version.d.ts +2 -2
  31. package/dist/src/types/content.d.ts +31 -31
  32. package/dist/src/types/element.d.ts +60 -60
  33. package/dist/src/url.d.ts +9 -9
  34. package/dist/src/url.test.d.ts +1 -1
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +13 -9
  37. package/project.json +4 -0
package/dist/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
3
  typeof define === 'function' && define.amd ? define('@builder.io/sdk', ['exports'], factory) :
4
- (factory((global.BuilderIO = {})));
5
- }(this, (function (exports) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BuilderIO = {}));
5
+ })(this, (function (exports) { 'use strict';
6
6
 
7
7
  /******************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -28,6 +28,11 @@
28
28
  return t;
29
29
  };
30
30
  return __assign.apply(this, arguments);
31
+ };
32
+
33
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
34
+ var e = new Error(message);
35
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
31
36
  };
32
37
 
33
38
  (function () {
@@ -152,7 +157,7 @@
152
157
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
153
158
  }
154
159
 
155
- var version = "2.0.5";
160
+ var version = "2.0.6";
156
161
 
157
162
  var Subscription = /** @class */ (function () {
158
163
  function Subscription(listeners, listener) {
@@ -511,10 +516,6 @@
511
516
  }
512
517
 
513
518
  function assign(target) {
514
- var args = [];
515
- for (var _i = 1; _i < arguments.length; _i++) {
516
- args[_i - 1] = arguments[_i];
517
- }
518
519
  var to = Object(target);
519
520
  for (var index = 1; index < arguments.length; index++) {
520
521
  var nextSource = arguments[index];
@@ -955,7 +956,7 @@
955
956
  }
956
957
  // Replacement for `url.parse` using `URL` global object that works with relative paths.
957
958
  // Assumptions: this function operates in a NodeJS environment.
958
- function parse(url) {
959
+ function parse$1(url) {
959
960
  var out = emptyUrl();
960
961
  var u;
961
962
  var pathOnly = url === '' || url[0] === '/';
@@ -1133,12 +1134,12 @@
1133
1134
  return out;
1134
1135
  },
1135
1136
  };
1136
- var parse$1 = isReactNative
1137
+ var parse = isReactNative
1137
1138
  ? function () { return emptyUrl(); }
1138
1139
  : typeof window === 'object'
1139
1140
  ? urlParser.parse
1140
- : parse;
1141
- function setCookie(name$$1, value, expires) {
1141
+ : parse$1;
1142
+ function setCookie(name, value, expires) {
1142
1143
  try {
1143
1144
  var expiresString = '';
1144
1145
  // TODO: need to know if secure server side
@@ -1147,7 +1148,7 @@
1147
1148
  }
1148
1149
  var secure = isBrowser ? location.protocol === 'https:' : true;
1149
1150
  document.cookie =
1150
- name$$1 +
1151
+ name +
1151
1152
  '=' +
1152
1153
  (value || '') +
1153
1154
  expiresString +
@@ -1159,10 +1160,10 @@
1159
1160
  console.warn('Could not set cookie', err);
1160
1161
  }
1161
1162
  }
1162
- function getCookie(name$$1) {
1163
+ function getCookie(name) {
1163
1164
  try {
1164
1165
  return (decodeURIComponent(document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' +
1165
- encodeURIComponent(name$$1).replace(/[\-\.\+\*]/g, '\\$&') +
1166
+ encodeURIComponent(name).replace(/[\-\.\+\*]/g, '\\$&') +
1166
1167
  '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1')) || null);
1167
1168
  }
1168
1169
  catch (err) {
@@ -1392,11 +1393,11 @@
1392
1393
  throw new Error("Action not found: ".concat(action));
1393
1394
  }
1394
1395
  };
1395
- Builder.fields = function (name$$1, fields) {
1396
+ Builder.fields = function (name, fields) {
1396
1397
  var _a;
1397
1398
  (_a = window.parent) === null || _a === void 0 ? void 0 : _a.postMessage({
1398
1399
  type: 'builder.fields',
1399
- data: { name: name$$1, fields: fields },
1400
+ data: { name: name, fields: fields },
1400
1401
  }, '*');
1401
1402
  };
1402
1403
  /**
@@ -1889,7 +1890,7 @@
1889
1890
  var params = QueryString.parseDeep(this.modifySearch(location.search || '').substr(1));
1890
1891
  var builder = params.builder;
1891
1892
  if (builder) {
1892
- var userAttributes = builder.userAttributes, overrides = builder.overrides, env = builder.env, host = builder.host, api = builder.api, cachebust = builder.cachebust, noCache = builder.noCache, preview = builder.preview, editing = builder.editing, frameEditing = builder.frameEditing, options = builder.options, overrideParams = builder.params;
1893
+ var userAttributes = builder.userAttributes, overrides = builder.overrides, env = builder.env; builder.host; var api = builder.api, cachebust = builder.cachebust, noCache = builder.noCache, preview = builder.preview, editing = builder.editing, frameEditing = builder.frameEditing, options = builder.options, overrideParams = builder.params;
1893
1894
  if (userAttributes) {
1894
1895
  this.setUserAttributes(userAttributes);
1895
1896
  }
@@ -1937,7 +1938,7 @@
1937
1938
  if (isBrowser) {
1938
1939
  addEventListener('message', function (event) {
1939
1940
  var _a, _b, _c, _d, _e;
1940
- var url = parse$1(event.origin);
1941
+ var url = parse(event.origin);
1941
1942
  var isRestricted = ['builder.register', 'builder.registerComponent'].indexOf((_a = event.data) === null || _a === void 0 ? void 0 : _a.type) === -1;
1942
1943
  var isTrusted = url.hostname && Builder.isTrustedHost(url.hostname);
1943
1944
  if (isRestricted && !isTrusted) {
@@ -2156,11 +2157,11 @@
2156
2157
  var parsedLocation = {};
2157
2158
  // in ssr mode
2158
2159
  if (this.request) {
2159
- parsedLocation = parse$1((_a = this.request.url) !== null && _a !== void 0 ? _a : '');
2160
+ parsedLocation = parse((_a = this.request.url) !== null && _a !== void 0 ? _a : '');
2160
2161
  }
2161
2162
  else if (typeof location === 'object') {
2162
2163
  // in the browser
2163
- parsedLocation = parse$1(location.href);
2164
+ parsedLocation = parse(location.href);
2164
2165
  }
2165
2166
  // IE11 bug with parsed path being empty string
2166
2167
  // causes issues with our user targeting
@@ -2404,7 +2405,7 @@
2404
2405
  }
2405
2406
  var pageQueryParams = typeof location !== 'undefined'
2406
2407
  ? QueryString.parseDeep(location.search.substr(1))
2407
- : undefined || {};
2408
+ : {};
2408
2409
  var userAttributes =
2409
2410
  // FIXME: HACK: only checks first in queue for user attributes overrides, should check all
2410
2411
  // TODO: merge user attributes provided here with defaults and current user attiributes (?)
@@ -2617,20 +2618,20 @@
2617
2618
  future.setDate(future.getDate() + 30);
2618
2619
  return this.setCookie("".concat(this.testCookiePrefix, ".").concat(contentId), variationId, future);
2619
2620
  };
2620
- Builder.prototype.getCookie = function (name$$1) {
2621
+ Builder.prototype.getCookie = function (name) {
2621
2622
  if (this.cookies) {
2622
- return this.cookies.get(name$$1);
2623
+ return this.cookies.get(name);
2623
2624
  }
2624
- return Builder.isBrowser && getCookie(name$$1);
2625
+ return Builder.isBrowser && getCookie(name);
2625
2626
  };
2626
- Builder.prototype.setCookie = function (name$$1, value, expires) {
2627
+ Builder.prototype.setCookie = function (name, value, expires) {
2627
2628
  if (this.cookies && !(Builder.isServer && Builder.isStatic)) {
2628
- return this.cookies.set(name$$1, value, {
2629
+ return this.cookies.set(name, value, {
2629
2630
  expires: expires,
2630
2631
  secure: this.getLocation().protocol === 'https:',
2631
2632
  });
2632
2633
  }
2633
- return Builder.isBrowser && setCookie(name$$1, value, expires);
2634
+ return Builder.isBrowser && setCookie(name, value, expires);
2634
2635
  };
2635
2636
  Builder.prototype.getContent = function (modelName, options) {
2636
2637
  if (options === void 0) { options = {}; }
@@ -2713,14 +2714,14 @@
2713
2714
  var builder = new Builder(null, undefined, undefined, true);
2714
2715
  Builder.singletonInstance = builder;
2715
2716
 
2717
+ exports.BehaviorSubject = BehaviorSubject;
2716
2718
  exports.Builder = Builder;
2717
2719
  exports.BuilderComponent = BuilderComponent;
2718
- exports.isBrowser = isBrowser;
2719
- exports.BehaviorSubject = BehaviorSubject;
2720
2720
  exports.Subscription = Subscription;
2721
2721
  exports.builder = builder;
2722
+ exports.isBrowser = isBrowser;
2722
2723
 
2723
2724
  Object.defineProperty(exports, '__esModule', { value: true });
2724
2725
 
2725
- })));
2726
+ }));
2726
2727
  //# sourceMappingURL=index.umd.js.map