@builder.io/sdk 2.2.8 → 3.0.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/CHANGELOG.md +16 -0
- package/dist/index.browser.js +53 -43
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.js +53 -43
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +53 -43
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +53 -43
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +2 -3
- package/dist/src/builder.class.js +52 -42
- package/dist/src/builder.class.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -3
package/dist/index.umd.js
CHANGED
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
throw new Error("Property name \"".concat(name, "\" is not allowed"));
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
var version = "
|
|
155
|
+
var version = "3.0.0";
|
|
156
156
|
|
|
157
157
|
var Subscription = /** @class */ (function () {
|
|
158
158
|
function Subscription(listeners, listener) {
|
|
@@ -1850,15 +1850,20 @@
|
|
|
1850
1850
|
};
|
|
1851
1851
|
Builder.prototype.setTestsFromUrl = function () {
|
|
1852
1852
|
var search = this.getLocation().search;
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1853
|
+
try {
|
|
1854
|
+
var params = QueryString.parseDeep(this.modifySearch(search || '').substr(1));
|
|
1855
|
+
var tests = params.builder && params.builder.tests;
|
|
1856
|
+
if (tests && typeof tests === 'object') {
|
|
1857
|
+
for (var key in tests) {
|
|
1858
|
+
if (tests.hasOwnProperty(key)) {
|
|
1859
|
+
this.setTestCookie(key, tests[key]);
|
|
1860
|
+
}
|
|
1859
1861
|
}
|
|
1860
1862
|
}
|
|
1861
1863
|
}
|
|
1864
|
+
catch (e) {
|
|
1865
|
+
console.debug('Error parsing tests from URL', e);
|
|
1866
|
+
}
|
|
1862
1867
|
};
|
|
1863
1868
|
Builder.prototype.resetOverrides = function () {
|
|
1864
1869
|
// Ugly - pass down instances per request instead using react context
|
|
@@ -1876,41 +1881,46 @@
|
|
|
1876
1881
|
};
|
|
1877
1882
|
Builder.prototype.getOverridesFromQueryString = function () {
|
|
1878
1883
|
var location = this.getLocation();
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1884
|
+
try {
|
|
1885
|
+
var params = QueryString.parseDeep(this.modifySearch(location.search || '').substr(1));
|
|
1886
|
+
var builder = params.builder;
|
|
1887
|
+
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;
|
|
1889
|
+
if (userAttributes) {
|
|
1890
|
+
this.setUserAttributes(userAttributes);
|
|
1891
|
+
}
|
|
1892
|
+
if (options) {
|
|
1893
|
+
// picking only locale, includeRefs, and enrich for now
|
|
1894
|
+
this.queryOptions = __assign(__assign(__assign({}, (options.locale && { locale: options.locale })), (options.includeRefs && { includeRefs: options.includeRefs })), (options.enrich && { enrich: options.enrich }));
|
|
1895
|
+
}
|
|
1896
|
+
if (overrides) {
|
|
1897
|
+
this.overrides = overrides;
|
|
1898
|
+
}
|
|
1899
|
+
if (validEnvList.indexOf(env || api) > -1) {
|
|
1900
|
+
this.env = env || api;
|
|
1901
|
+
}
|
|
1902
|
+
if (Builder.isEditing) {
|
|
1903
|
+
var editingModel = frameEditing || editing || preview;
|
|
1904
|
+
if (editingModel && editingModel !== 'true') {
|
|
1905
|
+
this.editingModel = editingModel;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
if (cachebust) {
|
|
1909
|
+
this.cachebust = true;
|
|
1910
|
+
}
|
|
1911
|
+
if (noCache) {
|
|
1912
|
+
this.noCache = true;
|
|
1913
|
+
}
|
|
1914
|
+
if (preview) {
|
|
1915
|
+
this.preview = true;
|
|
1916
|
+
}
|
|
1917
|
+
if (params) {
|
|
1918
|
+
this.overrideParams = overrideParams;
|
|
1900
1919
|
}
|
|
1901
1920
|
}
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
if (noCache) {
|
|
1906
|
-
this.noCache = true;
|
|
1907
|
-
}
|
|
1908
|
-
if (preview) {
|
|
1909
|
-
this.preview = true;
|
|
1910
|
-
}
|
|
1911
|
-
if (params) {
|
|
1912
|
-
this.overrideParams = overrideParams;
|
|
1913
|
-
}
|
|
1921
|
+
}
|
|
1922
|
+
catch (e) {
|
|
1923
|
+
console.debug('Error parsing overrides from URL', e);
|
|
1914
1924
|
}
|
|
1915
1925
|
};
|
|
1916
1926
|
Builder.prototype.messageFrameLoaded = function () {
|
|
@@ -2331,7 +2341,7 @@
|
|
|
2331
2341
|
// even though we only use `fetch()` now, we prefer to keep the old behavior and use the `fetch` that comes from
|
|
2332
2342
|
// the core SDK for consistency
|
|
2333
2343
|
Builder.prototype.requestUrl = function (url, options) {
|
|
2334
|
-
return getFetch()(url,
|
|
2344
|
+
return getFetch()(url, options).then(function (res) { return res.json(); });
|
|
2335
2345
|
};
|
|
2336
2346
|
Object.defineProperty(Builder.prototype, "host", {
|
|
2337
2347
|
get: function () {
|
|
@@ -2427,7 +2437,7 @@
|
|
|
2427
2437
|
}
|
|
2428
2438
|
// TODO: merge in the attribute from query string ones
|
|
2429
2439
|
// TODO: make this an option per component/request
|
|
2430
|
-
queryParams.userAttributes = userAttributes;
|
|
2440
|
+
queryParams.userAttributes = JSON.stringify(userAttributes);
|
|
2431
2441
|
if (!usePastQueue && !useQueue) {
|
|
2432
2442
|
this.priorContentQueue = queue;
|
|
2433
2443
|
this.getContentQueue = null;
|
|
@@ -2505,7 +2515,7 @@
|
|
|
2505
2515
|
}
|
|
2506
2516
|
var queryStr = QueryString.stringifyDeep(queryParams);
|
|
2507
2517
|
var format = queryParams.format;
|
|
2508
|
-
var requestOptions = { headers: {}
|
|
2518
|
+
var requestOptions = { headers: {} };
|
|
2509
2519
|
if (this.authToken) {
|
|
2510
2520
|
requestOptions.headers = __assign(__assign({}, requestOptions.headers), { Authorization: "Bearer ".concat(this.authToken) });
|
|
2511
2521
|
}
|