@builder.io/sdk 3.0.6 → 3.0.7
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 +6 -0
- package/dist/index.browser.js +18 -6
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.js +18 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +18 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +18 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/builder.class.d.ts +6 -0
- package/dist/src/builder.class.js +17 -5
- package/dist/src/builder.class.js.map +1 -1
- package/dist/src/sdk-version.d.ts +1 -1
- package/dist/src/sdk-version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1052,7 +1052,7 @@
|
|
|
1052
1052
|
|
|
1053
1053
|
var DEFAULT_API_VERSION = 'v3';
|
|
1054
1054
|
|
|
1055
|
-
var SDK_VERSION = '3.0.
|
|
1055
|
+
var SDK_VERSION = '3.0.7';
|
|
1056
1056
|
|
|
1057
1057
|
function datePlusMinutes(minutes) {
|
|
1058
1058
|
if (minutes === void 0) { minutes = 30; }
|
|
@@ -1542,9 +1542,7 @@
|
|
|
1542
1542
|
getFetch()("".concat(host, "/api/v1/track"), {
|
|
1543
1543
|
method: 'POST',
|
|
1544
1544
|
body: JSON.stringify({ events: events }),
|
|
1545
|
-
headers: {
|
|
1546
|
-
'content-type': 'application/json',
|
|
1547
|
-
},
|
|
1545
|
+
headers: __assign({ 'content-type': 'application/json' }, this.getSdkHeaders()),
|
|
1548
1546
|
mode: 'cors',
|
|
1549
1547
|
}).catch(function () {
|
|
1550
1548
|
// Not the end of the world
|
|
@@ -2343,7 +2341,7 @@
|
|
|
2343
2341
|
// even though we only use `fetch()` now, we prefer to keep the old behavior and use the `fetch` that comes from
|
|
2344
2342
|
// the core SDK for consistency
|
|
2345
2343
|
Builder.prototype.requestUrl = function (url, options) {
|
|
2346
|
-
return getFetch()(url, options).then(function (res) { return res.json(); });
|
|
2344
|
+
return getFetch()(url, this.addSdkHeaders(options)).then(function (res) { return res.json(); });
|
|
2347
2345
|
};
|
|
2348
2346
|
Object.defineProperty(Builder.prototype, "host", {
|
|
2349
2347
|
get: function () {
|
|
@@ -2372,8 +2370,21 @@
|
|
|
2372
2370
|
enumerable: false,
|
|
2373
2371
|
configurable: true
|
|
2374
2372
|
});
|
|
2373
|
+
Builder.prototype.getSdkHeaders = function () {
|
|
2374
|
+
if (!Builder.sdkInfo) {
|
|
2375
|
+
return {};
|
|
2376
|
+
}
|
|
2377
|
+
return {
|
|
2378
|
+
'X-Builder-SDK': Builder.sdkInfo.name,
|
|
2379
|
+
'X-Builder-SDK-GEN': '1',
|
|
2380
|
+
'X-Builder-SDK-Version': Builder.sdkInfo.version,
|
|
2381
|
+
};
|
|
2382
|
+
};
|
|
2383
|
+
Builder.prototype.addSdkHeaders = function (fetchOptions) {
|
|
2384
|
+
return __assign(__assign({}, fetchOptions), { headers: __assign(__assign({}, fetchOptions.headers), this.getSdkHeaders()) });
|
|
2385
|
+
};
|
|
2375
2386
|
Builder.prototype.makeFetchApiCall = function (url, requestOptions) {
|
|
2376
|
-
return getFetch()(url, requestOptions);
|
|
2387
|
+
return getFetch()(url, this.addSdkHeaders(requestOptions));
|
|
2377
2388
|
};
|
|
2378
2389
|
Builder.prototype.flattenMongoQuery = function (obj, _current, _res) {
|
|
2379
2390
|
if (_res === void 0) { _res = {}; }
|
|
@@ -2772,6 +2783,7 @@
|
|
|
2772
2783
|
(location.search.indexOf('builder.preview=') !== -1 ||
|
|
2773
2784
|
location.search.indexOf('builder.frameEditing=') !== -1));
|
|
2774
2785
|
Builder.isReact = false;
|
|
2786
|
+
Builder.sdkInfo = undefined;
|
|
2775
2787
|
Builder.overrideUserAttributes = {};
|
|
2776
2788
|
return Builder;
|
|
2777
2789
|
}());
|