@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.
@@ -1861,15 +1861,20 @@
1861
1861
  };
1862
1862
  Builder.prototype.setTestsFromUrl = function () {
1863
1863
  var search = this.getLocation().search;
1864
- var params = QueryString.parseDeep(this.modifySearch(search || '').substr(1));
1865
- var tests = params.builder && params.builder.tests;
1866
- if (tests && typeof tests === 'object') {
1867
- for (var key in tests) {
1868
- if (tests.hasOwnProperty(key)) {
1869
- this.setTestCookie(key, tests[key]);
1864
+ try {
1865
+ var params = QueryString.parseDeep(this.modifySearch(search || '').substr(1));
1866
+ var tests = params.builder && params.builder.tests;
1867
+ if (tests && typeof tests === 'object') {
1868
+ for (var key in tests) {
1869
+ if (tests.hasOwnProperty(key)) {
1870
+ this.setTestCookie(key, tests[key]);
1871
+ }
1870
1872
  }
1871
1873
  }
1872
1874
  }
1875
+ catch (e) {
1876
+ console.debug('Error parsing tests from URL', e);
1877
+ }
1873
1878
  };
1874
1879
  Builder.prototype.resetOverrides = function () {
1875
1880
  // Ugly - pass down instances per request instead using react context
@@ -1887,41 +1892,46 @@
1887
1892
  };
1888
1893
  Builder.prototype.getOverridesFromQueryString = function () {
1889
1894
  var location = this.getLocation();
1890
- var params = QueryString.parseDeep(this.modifySearch(location.search || '').substr(1));
1891
- var builder = params.builder;
1892
- if (builder) {
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;
1894
- if (userAttributes) {
1895
- this.setUserAttributes(userAttributes);
1896
- }
1897
- if (options) {
1898
- // picking only locale, includeRefs, and enrich for now
1899
- this.queryOptions = __assign(__assign(__assign({}, (options.locale && { locale: options.locale })), (options.includeRefs && { includeRefs: options.includeRefs })), (options.enrich && { enrich: options.enrich }));
1900
- }
1901
- if (overrides) {
1902
- this.overrides = overrides;
1903
- }
1904
- if (validEnvList.indexOf(env || api) > -1) {
1905
- this.env = env || api;
1906
- }
1907
- if (Builder.isEditing) {
1908
- var editingModel = frameEditing || editing || preview;
1909
- if (editingModel && editingModel !== 'true') {
1910
- this.editingModel = editingModel;
1895
+ try {
1896
+ var params = QueryString.parseDeep(this.modifySearch(location.search || '').substr(1));
1897
+ var builder = params.builder;
1898
+ if (builder) {
1899
+ 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;
1900
+ if (userAttributes) {
1901
+ this.setUserAttributes(userAttributes);
1902
+ }
1903
+ if (options) {
1904
+ // picking only locale, includeRefs, and enrich for now
1905
+ this.queryOptions = __assign(__assign(__assign({}, (options.locale && { locale: options.locale })), (options.includeRefs && { includeRefs: options.includeRefs })), (options.enrich && { enrich: options.enrich }));
1906
+ }
1907
+ if (overrides) {
1908
+ this.overrides = overrides;
1909
+ }
1910
+ if (validEnvList.indexOf(env || api) > -1) {
1911
+ this.env = env || api;
1912
+ }
1913
+ if (Builder.isEditing) {
1914
+ var editingModel = frameEditing || editing || preview;
1915
+ if (editingModel && editingModel !== 'true') {
1916
+ this.editingModel = editingModel;
1917
+ }
1918
+ }
1919
+ if (cachebust) {
1920
+ this.cachebust = true;
1921
+ }
1922
+ if (noCache) {
1923
+ this.noCache = true;
1924
+ }
1925
+ if (preview) {
1926
+ this.preview = true;
1927
+ }
1928
+ if (params) {
1929
+ this.overrideParams = overrideParams;
1911
1930
  }
1912
1931
  }
1913
- if (cachebust) {
1914
- this.cachebust = true;
1915
- }
1916
- if (noCache) {
1917
- this.noCache = true;
1918
- }
1919
- if (preview) {
1920
- this.preview = true;
1921
- }
1922
- if (params) {
1923
- this.overrideParams = overrideParams;
1924
- }
1932
+ }
1933
+ catch (e) {
1934
+ console.debug('Error parsing overrides from URL', e);
1925
1935
  }
1926
1936
  };
1927
1937
  Builder.prototype.messageFrameLoaded = function () {
@@ -2438,7 +2448,7 @@
2438
2448
  }
2439
2449
  // TODO: merge in the attribute from query string ones
2440
2450
  // TODO: make this an option per component/request
2441
- queryParams.userAttributes = JSON.stringify(userAttributes);
2451
+ queryParams.userAttributes = userAttributes;
2442
2452
  if (!usePastQueue && !useQueue) {
2443
2453
  this.priorContentQueue = queue;
2444
2454
  this.getContentQueue = null;