@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.esm.js
CHANGED
|
@@ -950,7 +950,7 @@ function toError(err) {
|
|
|
950
950
|
|
|
951
951
|
var DEFAULT_API_VERSION = 'v3';
|
|
952
952
|
|
|
953
|
-
var SDK_VERSION = '3.0.
|
|
953
|
+
var SDK_VERSION = '3.0.7';
|
|
954
954
|
|
|
955
955
|
function datePlusMinutes(minutes) {
|
|
956
956
|
if (minutes === void 0) { minutes = 30; }
|
|
@@ -1440,9 +1440,7 @@ var Builder = /** @class */ (function () {
|
|
|
1440
1440
|
getFetch()("".concat(host, "/api/v1/track"), {
|
|
1441
1441
|
method: 'POST',
|
|
1442
1442
|
body: JSON.stringify({ events: events }),
|
|
1443
|
-
headers: {
|
|
1444
|
-
'content-type': 'application/json',
|
|
1445
|
-
},
|
|
1443
|
+
headers: __assign({ 'content-type': 'application/json' }, this.getSdkHeaders()),
|
|
1446
1444
|
mode: 'cors',
|
|
1447
1445
|
}).catch(function () {
|
|
1448
1446
|
// Not the end of the world
|
|
@@ -2241,7 +2239,7 @@ var Builder = /** @class */ (function () {
|
|
|
2241
2239
|
// even though we only use `fetch()` now, we prefer to keep the old behavior and use the `fetch` that comes from
|
|
2242
2240
|
// the core SDK for consistency
|
|
2243
2241
|
Builder.prototype.requestUrl = function (url, options) {
|
|
2244
|
-
return getFetch()(url, options).then(function (res) { return res.json(); });
|
|
2242
|
+
return getFetch()(url, this.addSdkHeaders(options)).then(function (res) { return res.json(); });
|
|
2245
2243
|
};
|
|
2246
2244
|
Object.defineProperty(Builder.prototype, "host", {
|
|
2247
2245
|
get: function () {
|
|
@@ -2270,8 +2268,21 @@ var Builder = /** @class */ (function () {
|
|
|
2270
2268
|
enumerable: false,
|
|
2271
2269
|
configurable: true
|
|
2272
2270
|
});
|
|
2271
|
+
Builder.prototype.getSdkHeaders = function () {
|
|
2272
|
+
if (!Builder.sdkInfo) {
|
|
2273
|
+
return {};
|
|
2274
|
+
}
|
|
2275
|
+
return {
|
|
2276
|
+
'X-Builder-SDK': Builder.sdkInfo.name,
|
|
2277
|
+
'X-Builder-SDK-GEN': '1',
|
|
2278
|
+
'X-Builder-SDK-Version': Builder.sdkInfo.version,
|
|
2279
|
+
};
|
|
2280
|
+
};
|
|
2281
|
+
Builder.prototype.addSdkHeaders = function (fetchOptions) {
|
|
2282
|
+
return __assign(__assign({}, fetchOptions), { headers: __assign(__assign({}, fetchOptions.headers), this.getSdkHeaders()) });
|
|
2283
|
+
};
|
|
2273
2284
|
Builder.prototype.makeFetchApiCall = function (url, requestOptions) {
|
|
2274
|
-
return getFetch()(url, requestOptions);
|
|
2285
|
+
return getFetch()(url, this.addSdkHeaders(requestOptions));
|
|
2275
2286
|
};
|
|
2276
2287
|
Builder.prototype.flattenMongoQuery = function (obj, _current, _res) {
|
|
2277
2288
|
if (_res === void 0) { _res = {}; }
|
|
@@ -2670,6 +2681,7 @@ var Builder = /** @class */ (function () {
|
|
|
2670
2681
|
(location.search.indexOf('builder.preview=') !== -1 ||
|
|
2671
2682
|
location.search.indexOf('builder.frameEditing=') !== -1));
|
|
2672
2683
|
Builder.isReact = false;
|
|
2684
|
+
Builder.sdkInfo = undefined;
|
|
2673
2685
|
Builder.overrideUserAttributes = {};
|
|
2674
2686
|
return Builder;
|
|
2675
2687
|
}());
|