@builder.io/sdk 1.1.35 → 1.1.36-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.
Files changed (77) hide show
  1. package/.yarnrc.yml +1 -0
  2. package/CHANGELOG.md +1 -1
  3. package/coverage/clover.xml +3848 -0
  4. package/coverage/coverage-final.json +19 -0
  5. package/coverage/lcov-report/base.css +224 -0
  6. package/coverage/lcov-report/block-navigation.js +87 -0
  7. package/coverage/lcov-report/favicon.png +0 -0
  8. package/coverage/lcov-report/index.html +176 -0
  9. package/coverage/lcov-report/prettify.css +1 -0
  10. package/coverage/lcov-report/prettify.js +2 -0
  11. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  12. package/coverage/lcov-report/sorter.js +196 -0
  13. package/coverage/lcov-report/src/builder.class.ts.html +8107 -0
  14. package/coverage/lcov-report/src/classes/animator.class.ts.html +847 -0
  15. package/coverage/lcov-report/src/classes/cookies.class.ts.html +559 -0
  16. package/coverage/lcov-report/src/classes/index.html +176 -0
  17. package/coverage/lcov-report/src/classes/observable.class.ts.html +388 -0
  18. package/coverage/lcov-report/src/classes/promise.class.ts.html +607 -0
  19. package/coverage/lcov-report/src/classes/query-string.class.ts.html +328 -0
  20. package/coverage/lcov-report/src/functions/assign.function.ts.html +139 -0
  21. package/coverage/lcov-report/src/functions/fetch.function.ts.html +427 -0
  22. package/coverage/lcov-report/src/functions/get-top-level-domain.ts.html +121 -0
  23. package/coverage/lcov-report/src/functions/index.html +236 -0
  24. package/coverage/lcov-report/src/functions/next-tick.function.ts.html +184 -0
  25. package/coverage/lcov-report/src/functions/omit.function.ts.html +106 -0
  26. package/coverage/lcov-report/src/functions/server-only-require.function.ts.html +121 -0
  27. package/coverage/lcov-report/src/functions/throttle.function.ts.html +181 -0
  28. package/coverage/lcov-report/src/functions/to-error.ts.html +133 -0
  29. package/coverage/lcov-report/src/functions/uuid.ts.html +136 -0
  30. package/coverage/lcov-report/src/index.html +131 -0
  31. package/coverage/lcov-report/src/polyfills/custom-event-polyfill.js.html +121 -0
  32. package/coverage/lcov-report/src/polyfills/index.html +116 -0
  33. package/coverage/lcov-report/src/types/api-version.ts.html +91 -0
  34. package/coverage/lcov-report/src/types/index.html +116 -0
  35. package/coverage/lcov-report/src/url.ts.html +253 -0
  36. package/coverage/lcov.info +4317 -0
  37. package/dist/index.browser.js +2718 -1
  38. package/dist/index.browser.js.map +1 -1
  39. package/dist/index.cjs.js +59 -71
  40. package/dist/index.cjs.js.map +1 -1
  41. package/dist/index.d.ts +7 -7
  42. package/dist/index.esm.js +52 -66
  43. package/dist/index.esm.js.map +1 -1
  44. package/dist/index.umd.js +61 -70
  45. package/dist/index.umd.js.map +1 -1
  46. package/dist/package.json +3 -3
  47. package/dist/src/builder.class.d.ts +843 -842
  48. package/dist/src/builder.class.js +12 -2
  49. package/dist/src/builder.class.js.map +1 -1
  50. package/dist/src/builder.class.test.d.ts +1 -0
  51. package/dist/src/builder.class.test.js +23 -0
  52. package/dist/src/builder.class.test.js.map +1 -0
  53. package/dist/src/classes/animator.class.d.ts +26 -26
  54. package/dist/src/classes/cookies.class.d.ts +15 -15
  55. package/dist/src/classes/observable.class.d.ts +26 -26
  56. package/dist/src/classes/promise.class.d.ts +17 -17
  57. package/dist/src/classes/query-string.class.d.ts +9 -9
  58. package/dist/src/classes/query-string.class.test.d.ts +1 -1
  59. package/dist/src/constants/builder.d.ts +2 -2
  60. package/dist/src/functions/assign.function.d.ts +1 -1
  61. package/dist/src/functions/fetch.function.d.ts +28 -28
  62. package/dist/src/functions/finder.function.d.ts +10 -10
  63. package/dist/src/functions/get-top-level-domain.d.ts +6 -6
  64. package/dist/src/functions/next-tick.function.d.ts +2 -1
  65. package/dist/src/functions/omit.function.d.ts +1 -1
  66. package/dist/src/functions/server-only-require.function.d.ts +3 -3
  67. package/dist/src/functions/throttle.function.d.ts +1 -1
  68. package/dist/src/functions/to-error.d.ts +13 -13
  69. package/dist/src/functions/uuid.d.ts +8 -8
  70. package/dist/src/types/api-version.d.ts +2 -2
  71. package/dist/src/types/content.d.ts +31 -31
  72. package/dist/src/types/element.d.ts +60 -60
  73. package/dist/src/url.d.ts +9 -9
  74. package/dist/src/url.test.d.ts +1 -1
  75. package/dist/tsconfig.tsbuildinfo +1 -1
  76. package/jest.config.ts +1 -3
  77. package/package.json +4 -4
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 () {
@@ -71,8 +76,7 @@
71
76
  });
72
77
  // tslint:disable-next-line
73
78
  element.data = String((called = ++called));
74
- }
75
- //# sourceMappingURL=next-tick.function.js.map
79
+ }
76
80
 
77
81
  var PROPERTY_NAME_DENY_LIST = Object.freeze(['__proto__', 'prototype', 'constructor']);
78
82
  // TODO: unit tests
@@ -151,10 +155,9 @@
151
155
  function assertAllowedPropertyName(name) {
152
156
  if (PROPERTY_NAME_DENY_LIST.indexOf(name) >= 0)
153
157
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
154
- }
155
- //# sourceMappingURL=query-string.class.js.map
158
+ }
156
159
 
157
- var version = "1.1.35";
160
+ var version = "1.1.36-0";
158
161
 
159
162
  var Subscription = /** @class */ (function () {
160
163
  function Subscription(listeners, listener) {
@@ -247,8 +250,7 @@
247
250
  return this.toPromise();
248
251
  };
249
252
  return BehaviorSubject;
250
- }());
251
- //# sourceMappingURL=observable.class.js.map
253
+ }());
252
254
 
253
255
  var State = {
254
256
  Pending: 'Pending',
@@ -413,8 +415,7 @@
413
415
  };
414
416
  return TinyPromise;
415
417
  }());
416
- var Promise$1 = (typeof Promise !== 'undefined' ? Promise : TinyPromise);
417
- //# sourceMappingURL=promise.class.js.map
418
+ var Promise$1 = (typeof Promise !== 'undefined' ? Promise : TinyPromise);
418
419
 
419
420
  // Webpack workaround to conditionally require certain external modules
420
421
  // only on the server and not bundle them on the client
@@ -427,8 +428,7 @@
427
428
  // all good
428
429
  serverOnlyRequire = (function () { return null; });
429
430
  }
430
- var serverOnlyRequire$1 = serverOnlyRequire;
431
- //# sourceMappingURL=server-only-require.function.js.map
431
+ var serverOnlyRequire$1 = serverOnlyRequire;
432
432
 
433
433
  function promiseResolve(value) {
434
434
  return new Promise$1(function (resolve) { return resolve(value); });
@@ -504,14 +504,9 @@
504
504
  }
505
505
  // Otherwise, use tiny-fetch.
506
506
  return _fetch !== null && _fetch !== void 0 ? _fetch : tinyFetch;
507
- }
508
- //# sourceMappingURL=fetch.function.js.map
507
+ }
509
508
 
510
509
  function assign(target) {
511
- var args = [];
512
- for (var _i = 1; _i < arguments.length; _i++) {
513
- args[_i - 1] = arguments[_i];
514
- }
515
510
  var to = Object(target);
516
511
  for (var index = 1; index < arguments.length; index++) {
517
512
  var nextSource = arguments[index];
@@ -526,8 +521,7 @@
526
521
  }
527
522
  }
528
523
  return to;
529
- }
530
- //# sourceMappingURL=assign.function.js.map
524
+ }
531
525
 
532
526
  function throttle(func, wait, options) {
533
527
  if (options === void 0) { options = {}; }
@@ -565,8 +559,7 @@
565
559
  }
566
560
  return result;
567
561
  };
568
- }
569
- //# sourceMappingURL=throttle.function.js.map
562
+ }
570
563
 
571
564
  var camelCaseToKebabCase = function (str) {
572
565
  return str ? str.replace(/([A-Z])/g, function (g) { return "-".concat(g[0].toLowerCase()); }) : '';
@@ -768,8 +761,7 @@
768
761
  });
769
762
  };
770
763
  return Animator;
771
- }());
772
- //# sourceMappingURL=animator.class.js.map
764
+ }());
773
765
 
774
766
  /**
775
767
  * Only gets one level up from hostname
@@ -782,8 +774,7 @@
782
774
  return parts.slice(1).join('.');
783
775
  }
784
776
  return host;
785
- }
786
- //# sourceMappingURL=get-top-level-domain.js.map
777
+ }
787
778
 
788
779
  /**
789
780
  * RegExp to match field-content in RFC 7230 sec 3.2
@@ -907,8 +898,7 @@
907
898
  }
908
899
  }
909
900
  headers.push(cookie.toHeader());
910
- }
911
- //# sourceMappingURL=cookies.class.js.map
901
+ }
912
902
 
913
903
  function omit(obj) {
914
904
  var values = [];
@@ -921,8 +911,7 @@
921
911
  delete newObject[key];
922
912
  }
923
913
  return newObject;
924
- }
925
- //# sourceMappingURL=omit.function.js.map
914
+ }
926
915
 
927
916
  /**
928
917
  * @credit https://stackoverflow.com/a/2117523
@@ -938,8 +927,7 @@
938
927
  */
939
928
  function uuid() {
940
929
  return uuidv4().replace(/-/g, '');
941
- }
942
- //# sourceMappingURL=uuid.js.map
930
+ }
943
931
 
944
932
  function emptyUrl() {
945
933
  return {
@@ -959,7 +947,7 @@
959
947
  }
960
948
  // Replacement for `url.parse` using `URL` global object that works with relative paths.
961
949
  // Assumptions: this function operates in a NodeJS environment.
962
- function parse(url) {
950
+ function parse$1(url) {
963
951
  var out = emptyUrl();
964
952
  var u;
965
953
  var pathOnly = url === '' || url[0] === '/';
@@ -985,8 +973,7 @@
985
973
  out.path = "".concat(u.pathname).concat(u.search);
986
974
  out.pathname = u.pathname;
987
975
  return out;
988
- }
989
- //# sourceMappingURL=url.js.map
976
+ }
990
977
 
991
978
  function pad (hash, len) {
992
979
  while (hash.length < len) {
@@ -1072,11 +1059,9 @@
1072
1059
  if (err instanceof Error)
1073
1060
  return err;
1074
1061
  return new Error(String(err));
1075
- }
1076
- //# sourceMappingURL=to-error.js.map
1062
+ }
1077
1063
 
1078
- var DEFAULT_API_VERSION = 'v1';
1079
- //# sourceMappingURL=api-version.js.map
1064
+ var DEFAULT_API_VERSION = 'v1';
1080
1065
 
1081
1066
  function datePlusMinutes(minutes) {
1082
1067
  if (minutes === void 0) { minutes = 30; }
@@ -1140,12 +1125,12 @@
1140
1125
  return out;
1141
1126
  },
1142
1127
  };
1143
- var parse$1 = isReactNative
1128
+ var parse = isReactNative
1144
1129
  ? function () { return emptyUrl(); }
1145
1130
  : typeof window === 'object'
1146
1131
  ? urlParser.parse
1147
- : parse;
1148
- function setCookie(name$$1, value, expires) {
1132
+ : parse$1;
1133
+ function setCookie(name, value, expires) {
1149
1134
  try {
1150
1135
  var expiresString = '';
1151
1136
  // TODO: need to know if secure server side
@@ -1154,7 +1139,7 @@
1154
1139
  }
1155
1140
  var secure = isBrowser ? location.protocol === 'https:' : true;
1156
1141
  document.cookie =
1157
- name$$1 +
1142
+ name +
1158
1143
  '=' +
1159
1144
  (value || '') +
1160
1145
  expiresString +
@@ -1166,10 +1151,10 @@
1166
1151
  console.warn('Could not set cookie', err);
1167
1152
  }
1168
1153
  }
1169
- function getCookie(name$$1) {
1154
+ function getCookie(name) {
1170
1155
  try {
1171
1156
  return (decodeURIComponent(document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' +
1172
- encodeURIComponent(name$$1).replace(/[\-\.\+\*]/g, '\\$&') +
1157
+ encodeURIComponent(name).replace(/[\-\.\+\*]/g, '\\$&') +
1173
1158
  '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1')) || null);
1174
1159
  }
1175
1160
  catch (err) {
@@ -1379,7 +1364,11 @@
1379
1364
  this.trustedHosts.push(host);
1380
1365
  };
1381
1366
  Builder.isTrustedHost = function (hostname) {
1382
- return (this.trustedHosts.findIndex(function (trustedHost) { return trustedHost === hostname || hostname.endsWith(".".concat(trustedHost)); }) > -1);
1367
+ return (this.trustedHosts.findIndex(function (trustedHost) {
1368
+ return trustedHost.startsWith('*.')
1369
+ ? hostname.endsWith(trustedHost.slice(1))
1370
+ : trustedHost === hostname;
1371
+ }) > -1);
1383
1372
  };
1384
1373
  Builder.runAction = function (action) {
1385
1374
  // TODO
@@ -1388,11 +1377,11 @@
1388
1377
  throw new Error("Action not found: ".concat(action));
1389
1378
  }
1390
1379
  };
1391
- Builder.fields = function (name$$1, fields) {
1380
+ Builder.fields = function (name, fields) {
1392
1381
  var _a;
1393
1382
  (_a = window.parent) === null || _a === void 0 ? void 0 : _a.postMessage({
1394
1383
  type: 'builder.fields',
1395
- data: { name: name$$1, fields: fields },
1384
+ data: { name: name, fields: fields },
1396
1385
  }, '*');
1397
1386
  };
1398
1387
  /**
@@ -1885,7 +1874,7 @@
1885
1874
  var params = QueryString.parseDeep(this.modifySearch(location.search || '').substr(1));
1886
1875
  var builder = params.builder;
1887
1876
  if (builder) {
1888
- 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;
1877
+ 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;
1889
1878
  if (userAttributes) {
1890
1879
  this.setUserAttributes(userAttributes);
1891
1880
  }
@@ -1933,7 +1922,7 @@
1933
1922
  if (isBrowser) {
1934
1923
  addEventListener('message', function (event) {
1935
1924
  var _a, _b, _c, _d, _e;
1936
- var url = parse$1(event.origin);
1925
+ var url = parse(event.origin);
1937
1926
  var isRestricted = ['builder.register', 'builder.registerComponent'].indexOf((_a = event.data) === null || _a === void 0 ? void 0 : _a.type) === -1;
1938
1927
  var isTrusted = url.hostname && Builder.isTrustedHost(url.hostname);
1939
1928
  if (isRestricted && !isTrusted) {
@@ -2152,11 +2141,11 @@
2152
2141
  var parsedLocation = {};
2153
2142
  // in ssr mode
2154
2143
  if (this.request) {
2155
- parsedLocation = parse$1((_a = this.request.url) !== null && _a !== void 0 ? _a : '');
2144
+ parsedLocation = parse((_a = this.request.url) !== null && _a !== void 0 ? _a : '');
2156
2145
  }
2157
2146
  else if (typeof location === 'object') {
2158
2147
  // in the browser
2159
- parsedLocation = parse$1(location.href);
2148
+ parsedLocation = parse(location.href);
2160
2149
  }
2161
2150
  // IE11 bug with parsed path being empty string
2162
2151
  // causes issues with our user targeting
@@ -2397,7 +2386,7 @@
2397
2386
  }
2398
2387
  var pageQueryParams = typeof location !== 'undefined'
2399
2388
  ? QueryString.parseDeep(location.search.substr(1))
2400
- : undefined || {};
2389
+ : {};
2401
2390
  var userAttributes =
2402
2391
  // FIXME: HACK: only checks first in queue for user attributes overrides, should check all
2403
2392
  // TODO: merge user attributes provided here with defaults and current user attiributes (?)
@@ -2615,20 +2604,20 @@
2615
2604
  future.setDate(future.getDate() + 30);
2616
2605
  return this.setCookie("".concat(this.testCookiePrefix, ".").concat(contentId), variationId, future);
2617
2606
  };
2618
- Builder.prototype.getCookie = function (name$$1) {
2607
+ Builder.prototype.getCookie = function (name) {
2619
2608
  if (this.cookies) {
2620
- return this.cookies.get(name$$1);
2609
+ return this.cookies.get(name);
2621
2610
  }
2622
- return Builder.isBrowser && getCookie(name$$1);
2611
+ return Builder.isBrowser && getCookie(name);
2623
2612
  };
2624
- Builder.prototype.setCookie = function (name$$1, value, expires) {
2613
+ Builder.prototype.setCookie = function (name, value, expires) {
2625
2614
  if (this.cookies && !(Builder.isServer && Builder.isStatic)) {
2626
- return this.cookies.set(name$$1, value, {
2615
+ return this.cookies.set(name, value, {
2627
2616
  expires: expires,
2628
2617
  secure: this.getLocation().protocol === 'https:',
2629
2618
  });
2630
2619
  }
2631
- return Builder.isBrowser && setCookie(name$$1, value, expires);
2620
+ return Builder.isBrowser && setCookie(name, value, expires);
2632
2621
  };
2633
2622
  Builder.prototype.getContent = function (modelName, options) {
2634
2623
  if (options === void 0) { options = {}; }
@@ -2681,7 +2670,13 @@
2681
2670
  Builder.nextTick = nextTick;
2682
2671
  Builder.throttle = throttle;
2683
2672
  Builder.editors = [];
2684
- Builder.trustedHosts = ['builder.io', 'localhost'];
2673
+ Builder.trustedHosts = [
2674
+ '*.beta.builder.io',
2675
+ 'beta.builder.io',
2676
+ 'builder.io',
2677
+ 'localhost',
2678
+ 'qa.builder.io',
2679
+ ];
2685
2680
  Builder.plugins = [];
2686
2681
  Builder.actions = [];
2687
2682
  Builder.registry = {};
@@ -2706,23 +2701,19 @@
2706
2701
  Builder.isReact = false;
2707
2702
  Builder.overrideUserAttributes = {};
2708
2703
  return Builder;
2709
- }());
2710
- //# sourceMappingURL=builder.class.js.map
2704
+ }());
2711
2705
 
2712
2706
  var builder = new Builder(null, undefined, undefined, true);
2713
- Builder.singletonInstance = builder;
2714
- //# sourceMappingURL=builder.js.map
2715
-
2716
- //# sourceMappingURL=index.js.map
2707
+ Builder.singletonInstance = builder;
2717
2708
 
2709
+ exports.BehaviorSubject = BehaviorSubject;
2718
2710
  exports.Builder = Builder;
2719
2711
  exports.BuilderComponent = BuilderComponent;
2720
- exports.isBrowser = isBrowser;
2721
- exports.BehaviorSubject = BehaviorSubject;
2722
2712
  exports.Subscription = Subscription;
2723
2713
  exports.builder = builder;
2714
+ exports.isBrowser = isBrowser;
2724
2715
 
2725
2716
  Object.defineProperty(exports, '__esModule', { value: true });
2726
2717
 
2727
- })));
2718
+ }));
2728
2719
  //# sourceMappingURL=index.umd.js.map