@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.cjs.js
CHANGED
|
@@ -126,7 +126,7 @@ function assertAllowedPropertyName(name) {
|
|
|
126
126
|
throw new Error("Property name \"".concat(name, "\" is not allowed"));
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
var version = "
|
|
129
|
+
var version = "3.0.0";
|
|
130
130
|
|
|
131
131
|
var Subscription = /** @class */ (function () {
|
|
132
132
|
function Subscription(listeners, listener) {
|
|
@@ -1756,15 +1756,20 @@ var Builder = /** @class */ (function () {
|
|
|
1756
1756
|
};
|
|
1757
1757
|
Builder.prototype.setTestsFromUrl = function () {
|
|
1758
1758
|
var search = this.getLocation().search;
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1759
|
+
try {
|
|
1760
|
+
var params = QueryString.parseDeep(this.modifySearch(search || '').substr(1));
|
|
1761
|
+
var tests = params.builder && params.builder.tests;
|
|
1762
|
+
if (tests && typeof tests === 'object') {
|
|
1763
|
+
for (var key in tests) {
|
|
1764
|
+
if (tests.hasOwnProperty(key)) {
|
|
1765
|
+
this.setTestCookie(key, tests[key]);
|
|
1766
|
+
}
|
|
1765
1767
|
}
|
|
1766
1768
|
}
|
|
1767
1769
|
}
|
|
1770
|
+
catch (e) {
|
|
1771
|
+
console.debug('Error parsing tests from URL', e);
|
|
1772
|
+
}
|
|
1768
1773
|
};
|
|
1769
1774
|
Builder.prototype.resetOverrides = function () {
|
|
1770
1775
|
// Ugly - pass down instances per request instead using react context
|
|
@@ -1782,41 +1787,46 @@ var Builder = /** @class */ (function () {
|
|
|
1782
1787
|
};
|
|
1783
1788
|
Builder.prototype.getOverridesFromQueryString = function () {
|
|
1784
1789
|
var location = this.getLocation();
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1790
|
+
try {
|
|
1791
|
+
var params = QueryString.parseDeep(this.modifySearch(location.search || '').substr(1));
|
|
1792
|
+
var builder = params.builder;
|
|
1793
|
+
if (builder) {
|
|
1794
|
+
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;
|
|
1795
|
+
if (userAttributes) {
|
|
1796
|
+
this.setUserAttributes(userAttributes);
|
|
1797
|
+
}
|
|
1798
|
+
if (options) {
|
|
1799
|
+
// picking only locale, includeRefs, and enrich for now
|
|
1800
|
+
this.queryOptions = tslib.__assign(tslib.__assign(tslib.__assign({}, (options.locale && { locale: options.locale })), (options.includeRefs && { includeRefs: options.includeRefs })), (options.enrich && { enrich: options.enrich }));
|
|
1801
|
+
}
|
|
1802
|
+
if (overrides) {
|
|
1803
|
+
this.overrides = overrides;
|
|
1804
|
+
}
|
|
1805
|
+
if (validEnvList.indexOf(env || api) > -1) {
|
|
1806
|
+
this.env = env || api;
|
|
1807
|
+
}
|
|
1808
|
+
if (Builder.isEditing) {
|
|
1809
|
+
var editingModel = frameEditing || editing || preview;
|
|
1810
|
+
if (editingModel && editingModel !== 'true') {
|
|
1811
|
+
this.editingModel = editingModel;
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
if (cachebust) {
|
|
1815
|
+
this.cachebust = true;
|
|
1816
|
+
}
|
|
1817
|
+
if (noCache) {
|
|
1818
|
+
this.noCache = true;
|
|
1819
|
+
}
|
|
1820
|
+
if (preview) {
|
|
1821
|
+
this.preview = true;
|
|
1822
|
+
}
|
|
1823
|
+
if (params) {
|
|
1824
|
+
this.overrideParams = overrideParams;
|
|
1806
1825
|
}
|
|
1807
1826
|
}
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
if (noCache) {
|
|
1812
|
-
this.noCache = true;
|
|
1813
|
-
}
|
|
1814
|
-
if (preview) {
|
|
1815
|
-
this.preview = true;
|
|
1816
|
-
}
|
|
1817
|
-
if (params) {
|
|
1818
|
-
this.overrideParams = overrideParams;
|
|
1819
|
-
}
|
|
1827
|
+
}
|
|
1828
|
+
catch (e) {
|
|
1829
|
+
console.debug('Error parsing overrides from URL', e);
|
|
1820
1830
|
}
|
|
1821
1831
|
};
|
|
1822
1832
|
Builder.prototype.messageFrameLoaded = function () {
|
|
@@ -2237,7 +2247,7 @@ var Builder = /** @class */ (function () {
|
|
|
2237
2247
|
// even though we only use `fetch()` now, we prefer to keep the old behavior and use the `fetch` that comes from
|
|
2238
2248
|
// the core SDK for consistency
|
|
2239
2249
|
Builder.prototype.requestUrl = function (url, options) {
|
|
2240
|
-
return getFetch()(url,
|
|
2250
|
+
return getFetch()(url, options).then(function (res) { return res.json(); });
|
|
2241
2251
|
};
|
|
2242
2252
|
Object.defineProperty(Builder.prototype, "host", {
|
|
2243
2253
|
get: function () {
|
|
@@ -2333,7 +2343,7 @@ var Builder = /** @class */ (function () {
|
|
|
2333
2343
|
}
|
|
2334
2344
|
// TODO: merge in the attribute from query string ones
|
|
2335
2345
|
// TODO: make this an option per component/request
|
|
2336
|
-
queryParams.userAttributes = userAttributes;
|
|
2346
|
+
queryParams.userAttributes = JSON.stringify(userAttributes);
|
|
2337
2347
|
if (!usePastQueue && !useQueue) {
|
|
2338
2348
|
this.priorContentQueue = queue;
|
|
2339
2349
|
this.getContentQueue = null;
|
|
@@ -2411,7 +2421,7 @@ var Builder = /** @class */ (function () {
|
|
|
2411
2421
|
}
|
|
2412
2422
|
var queryStr = QueryString.stringifyDeep(queryParams);
|
|
2413
2423
|
var format = queryParams.format;
|
|
2414
|
-
var requestOptions = { headers: {}
|
|
2424
|
+
var requestOptions = { headers: {} };
|
|
2415
2425
|
if (this.authToken) {
|
|
2416
2426
|
requestOptions.headers = tslib.__assign(tslib.__assign({}, requestOptions.headers), { Authorization: "Bearer ".concat(this.authToken) });
|
|
2417
2427
|
}
|