@builder.io/sdk 2.2.6 → 2.2.7-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
@@ -1759,15 +1759,20 @@ var Builder = /** @class */ (function () {
1759
1759
  };
1760
1760
  Builder.prototype.setTestsFromUrl = function () {
1761
1761
  var search = this.getLocation().search;
1762
- var params = QueryString.parseDeep(this.modifySearch(search || '').substr(1));
1763
- var tests = params.builder && params.builder.tests;
1764
- if (tests && typeof tests === 'object') {
1765
- for (var key in tests) {
1766
- if (tests.hasOwnProperty(key)) {
1767
- this.setTestCookie(key, tests[key]);
1762
+ try {
1763
+ var params = QueryString.parseDeep(this.modifySearch(search || '').substr(1));
1764
+ var tests = params.builder && params.builder.tests;
1765
+ if (tests && typeof tests === 'object') {
1766
+ for (var key in tests) {
1767
+ if (tests.hasOwnProperty(key)) {
1768
+ this.setTestCookie(key, tests[key]);
1769
+ }
1768
1770
  }
1769
1771
  }
1770
1772
  }
1773
+ catch (e) {
1774
+ console.debug('Error parsing tests from URL', e);
1775
+ }
1771
1776
  };
1772
1777
  Builder.prototype.resetOverrides = function () {
1773
1778
  // Ugly - pass down instances per request instead using react context
@@ -1785,41 +1790,46 @@ var Builder = /** @class */ (function () {
1785
1790
  };
1786
1791
  Builder.prototype.getOverridesFromQueryString = function () {
1787
1792
  var location = this.getLocation();
1788
- var params = QueryString.parseDeep(this.modifySearch(location.search || '').substr(1));
1789
- var builder = params.builder;
1790
- if (builder) {
1791
- 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;
1792
- if (userAttributes) {
1793
- this.setUserAttributes(userAttributes);
1794
- }
1795
- if (options) {
1796
- // picking only locale, includeRefs, and enrich for now
1797
- this.queryOptions = __assign(__assign(__assign({}, (options.locale && { locale: options.locale })), (options.includeRefs && { includeRefs: options.includeRefs })), (options.enrich && { enrich: options.enrich }));
1798
- }
1799
- if (overrides) {
1800
- this.overrides = overrides;
1801
- }
1802
- if (validEnvList.indexOf(env || api) > -1) {
1803
- this.env = env || api;
1804
- }
1805
- if (Builder.isEditing) {
1806
- var editingModel = frameEditing || editing || preview;
1807
- if (editingModel && editingModel !== 'true') {
1808
- this.editingModel = editingModel;
1793
+ try {
1794
+ var params = QueryString.parseDeep(this.modifySearch(location.search || '').substr(1));
1795
+ var builder = params.builder;
1796
+ if (builder) {
1797
+ 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;
1798
+ if (userAttributes) {
1799
+ this.setUserAttributes(userAttributes);
1800
+ }
1801
+ if (options) {
1802
+ // picking only locale, includeRefs, and enrich for now
1803
+ this.queryOptions = __assign(__assign(__assign({}, (options.locale && { locale: options.locale })), (options.includeRefs && { includeRefs: options.includeRefs })), (options.enrich && { enrich: options.enrich }));
1804
+ }
1805
+ if (overrides) {
1806
+ this.overrides = overrides;
1807
+ }
1808
+ if (validEnvList.indexOf(env || api) > -1) {
1809
+ this.env = env || api;
1810
+ }
1811
+ if (Builder.isEditing) {
1812
+ var editingModel = frameEditing || editing || preview;
1813
+ if (editingModel && editingModel !== 'true') {
1814
+ this.editingModel = editingModel;
1815
+ }
1816
+ }
1817
+ if (cachebust) {
1818
+ this.cachebust = true;
1819
+ }
1820
+ if (noCache) {
1821
+ this.noCache = true;
1822
+ }
1823
+ if (preview) {
1824
+ this.preview = true;
1825
+ }
1826
+ if (params) {
1827
+ this.overrideParams = overrideParams;
1809
1828
  }
1810
1829
  }
1811
- if (cachebust) {
1812
- this.cachebust = true;
1813
- }
1814
- if (noCache) {
1815
- this.noCache = true;
1816
- }
1817
- if (preview) {
1818
- this.preview = true;
1819
- }
1820
- if (params) {
1821
- this.overrideParams = overrideParams;
1822
- }
1830
+ }
1831
+ catch (e) {
1832
+ console.debug('Error parsing overrides from URL', e);
1823
1833
  }
1824
1834
  };
1825
1835
  Builder.prototype.messageFrameLoaded = function () {
@@ -2336,7 +2346,7 @@ var Builder = /** @class */ (function () {
2336
2346
  }
2337
2347
  // TODO: merge in the attribute from query string ones
2338
2348
  // TODO: make this an option per component/request
2339
- queryParams.userAttributes = JSON.stringify(userAttributes);
2349
+ queryParams.userAttributes = userAttributes;
2340
2350
  if (!usePastQueue && !useQueue) {
2341
2351
  this.priorContentQueue = queue;
2342
2352
  this.getContentQueue = null;