@builder.io/sdk 3.0.5 → 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 +12 -0
- package/dist/index.browser.js +20 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.js +20 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +20 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +20 -12
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +3 -2
- package/dist/src/builder.class.d.ts +6 -4
- package/dist/src/builder.class.js +19 -11
- package/dist/src/builder.class.js.map +1 -1
- package/dist/src/sdk-version.d.ts +1 -0
- package/dist/src/sdk-version.js +5 -0
- package/dist/src/sdk-version.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/scripts/set-sdk-version.sh +25 -0
package/dist/index.cjs.js
CHANGED
|
@@ -126,8 +126,6 @@ function assertAllowedPropertyName(name) {
|
|
|
126
126
|
throw new Error("Property name \"".concat(name, "\" is not allowed"));
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
var version = "3.0.5";
|
|
130
|
-
|
|
131
129
|
var Subscription = /** @class */ (function () {
|
|
132
130
|
function Subscription(listeners, listener) {
|
|
133
131
|
this.listeners = listeners;
|
|
@@ -960,6 +958,8 @@ function toError(err) {
|
|
|
960
958
|
|
|
961
959
|
var DEFAULT_API_VERSION = 'v3';
|
|
962
960
|
|
|
961
|
+
var SDK_VERSION = '3.0.7';
|
|
962
|
+
|
|
963
963
|
function datePlusMinutes(minutes) {
|
|
964
964
|
if (minutes === void 0) { minutes = 30; }
|
|
965
965
|
return new Date(Date.now() + minutes * 60000);
|
|
@@ -1448,9 +1448,7 @@ var Builder = /** @class */ (function () {
|
|
|
1448
1448
|
getFetch()("".concat(host, "/api/v1/track"), {
|
|
1449
1449
|
method: 'POST',
|
|
1450
1450
|
body: JSON.stringify({ events: events }),
|
|
1451
|
-
headers: {
|
|
1452
|
-
'content-type': 'application/json',
|
|
1453
|
-
},
|
|
1451
|
+
headers: tslib.__assign({ 'content-type': 'application/json' }, this.getSdkHeaders()),
|
|
1454
1452
|
mode: 'cors',
|
|
1455
1453
|
}).catch(function () {
|
|
1456
1454
|
// Not the end of the world
|
|
@@ -2249,7 +2247,7 @@ var Builder = /** @class */ (function () {
|
|
|
2249
2247
|
// even though we only use `fetch()` now, we prefer to keep the old behavior and use the `fetch` that comes from
|
|
2250
2248
|
// the core SDK for consistency
|
|
2251
2249
|
Builder.prototype.requestUrl = function (url, options) {
|
|
2252
|
-
return getFetch()(url, options).then(function (res) { return res.json(); });
|
|
2250
|
+
return getFetch()(url, this.addSdkHeaders(options)).then(function (res) { return res.json(); });
|
|
2253
2251
|
};
|
|
2254
2252
|
Object.defineProperty(Builder.prototype, "host", {
|
|
2255
2253
|
get: function () {
|
|
@@ -2278,8 +2276,21 @@ var Builder = /** @class */ (function () {
|
|
|
2278
2276
|
enumerable: false,
|
|
2279
2277
|
configurable: true
|
|
2280
2278
|
});
|
|
2279
|
+
Builder.prototype.getSdkHeaders = function () {
|
|
2280
|
+
if (!Builder.sdkInfo) {
|
|
2281
|
+
return {};
|
|
2282
|
+
}
|
|
2283
|
+
return {
|
|
2284
|
+
'X-Builder-SDK': Builder.sdkInfo.name,
|
|
2285
|
+
'X-Builder-SDK-GEN': '1',
|
|
2286
|
+
'X-Builder-SDK-Version': Builder.sdkInfo.version,
|
|
2287
|
+
};
|
|
2288
|
+
};
|
|
2289
|
+
Builder.prototype.addSdkHeaders = function (fetchOptions) {
|
|
2290
|
+
return tslib.__assign(tslib.__assign({}, fetchOptions), { headers: tslib.__assign(tslib.__assign({}, fetchOptions.headers), this.getSdkHeaders()) });
|
|
2291
|
+
};
|
|
2281
2292
|
Builder.prototype.makeFetchApiCall = function (url, requestOptions) {
|
|
2282
|
-
return getFetch()(url, requestOptions);
|
|
2293
|
+
return getFetch()(url, this.addSdkHeaders(requestOptions));
|
|
2283
2294
|
};
|
|
2284
2295
|
Builder.prototype.flattenMongoQuery = function (obj, _current, _res) {
|
|
2285
2296
|
if (_res === void 0) { _res = {}; }
|
|
@@ -2634,11 +2645,7 @@ var Builder = /** @class */ (function () {
|
|
|
2634
2645
|
: undefined }))
|
|
2635
2646
|
.promise();
|
|
2636
2647
|
};
|
|
2637
|
-
|
|
2638
|
-
* @hidden
|
|
2639
|
-
* @deprecated. This is buggy, and always behind by a version.
|
|
2640
|
-
*/
|
|
2641
|
-
Builder.VERSION = version;
|
|
2648
|
+
Builder.VERSION = SDK_VERSION;
|
|
2642
2649
|
Builder.components = [];
|
|
2643
2650
|
/**
|
|
2644
2651
|
* Makes it so that a/b tests generate code like {@link
|
|
@@ -2682,6 +2689,7 @@ var Builder = /** @class */ (function () {
|
|
|
2682
2689
|
(location.search.indexOf('builder.preview=') !== -1 ||
|
|
2683
2690
|
location.search.indexOf('builder.frameEditing=') !== -1));
|
|
2684
2691
|
Builder.isReact = false;
|
|
2692
|
+
Builder.sdkInfo = undefined;
|
|
2685
2693
|
Builder.overrideUserAttributes = {};
|
|
2686
2694
|
return Builder;
|
|
2687
2695
|
}());
|