@builder.io/sdk 2.0.7 → 2.1.0

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.esm.js CHANGED
@@ -16,21 +16,16 @@ import hash from 'hash-sum';
16
16
 
17
17
  var isSafari = typeof window !== 'undefined' &&
18
18
  /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
19
+ var isClient = typeof window !== 'undefined';
19
20
  // TODO: queue all of these in a debounceNextTick
20
21
  function nextTick(fn) {
21
- // React native
22
- if (typeof setImmediate === 'function' && typeof window === 'undefined') {
23
- return setImmediate(fn);
24
- }
25
- // TODO: should this be setImmediate instead? Forgot if that is micro or macro task
26
- // TODO: detect specifically if is server
27
22
  // if (typeof process !== 'undefined' && process.nextTick) {
28
23
  // console.log('process.nextTick?');
29
24
  // process.nextTick(fn);
30
25
  // return;
31
26
  // }
32
27
  // FIXME: fix the real safari issue of this randomly not working
33
- if (isSafari || typeof MutationObserver === 'undefined') {
28
+ if (!isClient || isSafari || typeof MutationObserver === 'undefined') {
34
29
  setTimeout(fn);
35
30
  return;
36
31
  }
@@ -123,7 +118,7 @@ function assertAllowedPropertyName(name) {
123
118
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
124
119
  }
125
120
 
126
- var version = "2.0.6";
121
+ var version = "2.0.8";
127
122
 
128
123
  var Subscription = /** @class */ (function () {
129
124
  function Subscription(listeners, listener) {
@@ -2301,9 +2296,12 @@ var Builder = /** @class */ (function () {
2301
2296
  if (queue[0].format) {
2302
2297
  queryParams.format = queue[0].format;
2303
2298
  }
2299
+ if ('noTraverse' in queue[0]) {
2300
+ queryParams.noTraverse = queue[0].noTraverse;
2301
+ }
2304
2302
  var pageQueryParams = typeof location !== 'undefined'
2305
2303
  ? QueryString.parseDeep(location.search.substr(1))
2306
- : {};
2304
+ : {}; // TODO: WHAT about SSR (this.request) ?
2307
2305
  var userAttributes =
2308
2306
  // FIXME: HACK: only checks first in queue for user attributes overrides, should check all
2309
2307
  // TODO: merge user attributes provided here with defaults and current user attiributes (?)
@@ -2555,6 +2553,10 @@ var Builder = /** @class */ (function () {
2555
2553
  this.apiVersion = options.apiVersion;
2556
2554
  }
2557
2555
  }
2556
+ // Set noTraverse=true if NOT already passed by user, for query performance
2557
+ if (!('noTraverse' in options)) {
2558
+ options.noTraverse = true;
2559
+ }
2558
2560
  return instance
2559
2561
  .getContent(modelName, __assign(__assign({ limit: 30 }, options), { key: options.key ||
2560
2562
  // Make the key include all options, so we don't reuse cache for the same content fetched