@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.esm.js
CHANGED
|
@@ -118,7 +118,7 @@ function assertAllowedPropertyName(name) {
|
|
|
118
118
|
throw new Error("Property name \"".concat(name, "\" is not allowed"));
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
var version = "
|
|
121
|
+
var version = "3.0.0";
|
|
122
122
|
|
|
123
123
|
var Subscription = /** @class */ (function () {
|
|
124
124
|
function Subscription(listeners, listener) {
|
|
@@ -1748,15 +1748,20 @@ var Builder = /** @class */ (function () {
|
|
|
1748
1748
|
};
|
|
1749
1749
|
Builder.prototype.setTestsFromUrl = function () {
|
|
1750
1750
|
var search = this.getLocation().search;
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1751
|
+
try {
|
|
1752
|
+
var params = QueryString.parseDeep(this.modifySearch(search || '').substr(1));
|
|
1753
|
+
var tests = params.builder && params.builder.tests;
|
|
1754
|
+
if (tests && typeof tests === 'object') {
|
|
1755
|
+
for (var key in tests) {
|
|
1756
|
+
if (tests.hasOwnProperty(key)) {
|
|
1757
|
+
this.setTestCookie(key, tests[key]);
|
|
1758
|
+
}
|
|
1757
1759
|
}
|
|
1758
1760
|
}
|
|
1759
1761
|
}
|
|
1762
|
+
catch (e) {
|
|
1763
|
+
console.debug('Error parsing tests from URL', e);
|
|
1764
|
+
}
|
|
1760
1765
|
};
|
|
1761
1766
|
Builder.prototype.resetOverrides = function () {
|
|
1762
1767
|
// Ugly - pass down instances per request instead using react context
|
|
@@ -1774,41 +1779,46 @@ var Builder = /** @class */ (function () {
|
|
|
1774
1779
|
};
|
|
1775
1780
|
Builder.prototype.getOverridesFromQueryString = function () {
|
|
1776
1781
|
var location = this.getLocation();
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1782
|
+
try {
|
|
1783
|
+
var params = QueryString.parseDeep(this.modifySearch(location.search || '').substr(1));
|
|
1784
|
+
var builder = params.builder;
|
|
1785
|
+
if (builder) {
|
|
1786
|
+
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;
|
|
1787
|
+
if (userAttributes) {
|
|
1788
|
+
this.setUserAttributes(userAttributes);
|
|
1789
|
+
}
|
|
1790
|
+
if (options) {
|
|
1791
|
+
// picking only locale, includeRefs, and enrich for now
|
|
1792
|
+
this.queryOptions = __assign(__assign(__assign({}, (options.locale && { locale: options.locale })), (options.includeRefs && { includeRefs: options.includeRefs })), (options.enrich && { enrich: options.enrich }));
|
|
1793
|
+
}
|
|
1794
|
+
if (overrides) {
|
|
1795
|
+
this.overrides = overrides;
|
|
1796
|
+
}
|
|
1797
|
+
if (validEnvList.indexOf(env || api) > -1) {
|
|
1798
|
+
this.env = env || api;
|
|
1799
|
+
}
|
|
1800
|
+
if (Builder.isEditing) {
|
|
1801
|
+
var editingModel = frameEditing || editing || preview;
|
|
1802
|
+
if (editingModel && editingModel !== 'true') {
|
|
1803
|
+
this.editingModel = editingModel;
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
if (cachebust) {
|
|
1807
|
+
this.cachebust = true;
|
|
1808
|
+
}
|
|
1809
|
+
if (noCache) {
|
|
1810
|
+
this.noCache = true;
|
|
1811
|
+
}
|
|
1812
|
+
if (preview) {
|
|
1813
|
+
this.preview = true;
|
|
1814
|
+
}
|
|
1815
|
+
if (params) {
|
|
1816
|
+
this.overrideParams = overrideParams;
|
|
1798
1817
|
}
|
|
1799
1818
|
}
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
if (noCache) {
|
|
1804
|
-
this.noCache = true;
|
|
1805
|
-
}
|
|
1806
|
-
if (preview) {
|
|
1807
|
-
this.preview = true;
|
|
1808
|
-
}
|
|
1809
|
-
if (params) {
|
|
1810
|
-
this.overrideParams = overrideParams;
|
|
1811
|
-
}
|
|
1819
|
+
}
|
|
1820
|
+
catch (e) {
|
|
1821
|
+
console.debug('Error parsing overrides from URL', e);
|
|
1812
1822
|
}
|
|
1813
1823
|
};
|
|
1814
1824
|
Builder.prototype.messageFrameLoaded = function () {
|
|
@@ -2229,7 +2239,7 @@ var Builder = /** @class */ (function () {
|
|
|
2229
2239
|
// even though we only use `fetch()` now, we prefer to keep the old behavior and use the `fetch` that comes from
|
|
2230
2240
|
// the core SDK for consistency
|
|
2231
2241
|
Builder.prototype.requestUrl = function (url, options) {
|
|
2232
|
-
return getFetch()(url,
|
|
2242
|
+
return getFetch()(url, options).then(function (res) { return res.json(); });
|
|
2233
2243
|
};
|
|
2234
2244
|
Object.defineProperty(Builder.prototype, "host", {
|
|
2235
2245
|
get: function () {
|
|
@@ -2325,7 +2335,7 @@ var Builder = /** @class */ (function () {
|
|
|
2325
2335
|
}
|
|
2326
2336
|
// TODO: merge in the attribute from query string ones
|
|
2327
2337
|
// TODO: make this an option per component/request
|
|
2328
|
-
queryParams.userAttributes = userAttributes;
|
|
2338
|
+
queryParams.userAttributes = JSON.stringify(userAttributes);
|
|
2329
2339
|
if (!usePastQueue && !useQueue) {
|
|
2330
2340
|
this.priorContentQueue = queue;
|
|
2331
2341
|
this.getContentQueue = null;
|
|
@@ -2403,7 +2413,7 @@ var Builder = /** @class */ (function () {
|
|
|
2403
2413
|
}
|
|
2404
2414
|
var queryStr = QueryString.stringifyDeep(queryParams);
|
|
2405
2415
|
var format = queryParams.format;
|
|
2406
|
-
var requestOptions = { headers: {}
|
|
2416
|
+
var requestOptions = { headers: {} };
|
|
2407
2417
|
if (this.authToken) {
|
|
2408
2418
|
requestOptions.headers = __assign(__assign({}, requestOptions.headers), { Authorization: "Bearer ".concat(this.authToken) });
|
|
2409
2419
|
}
|