@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.umd.js
CHANGED
|
@@ -152,8 +152,6 @@
|
|
|
152
152
|
throw new Error("Property name \"".concat(name, "\" is not allowed"));
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
var version = "3.0.5";
|
|
156
|
-
|
|
157
155
|
var Subscription = /** @class */ (function () {
|
|
158
156
|
function Subscription(listeners, listener) {
|
|
159
157
|
this.listeners = listeners;
|
|
@@ -1054,6 +1052,8 @@
|
|
|
1054
1052
|
|
|
1055
1053
|
var DEFAULT_API_VERSION = 'v3';
|
|
1056
1054
|
|
|
1055
|
+
var SDK_VERSION = '3.0.7';
|
|
1056
|
+
|
|
1057
1057
|
function datePlusMinutes(minutes) {
|
|
1058
1058
|
if (minutes === void 0) { minutes = 30; }
|
|
1059
1059
|
return new Date(Date.now() + minutes * 60000);
|
|
@@ -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 = {}; }
|
|
@@ -2728,11 +2739,7 @@
|
|
|
2728
2739
|
: undefined }))
|
|
2729
2740
|
.promise();
|
|
2730
2741
|
};
|
|
2731
|
-
|
|
2732
|
-
* @hidden
|
|
2733
|
-
* @deprecated. This is buggy, and always behind by a version.
|
|
2734
|
-
*/
|
|
2735
|
-
Builder.VERSION = version;
|
|
2742
|
+
Builder.VERSION = SDK_VERSION;
|
|
2736
2743
|
Builder.components = [];
|
|
2737
2744
|
/**
|
|
2738
2745
|
* Makes it so that a/b tests generate code like {@link
|
|
@@ -2776,6 +2783,7 @@
|
|
|
2776
2783
|
(location.search.indexOf('builder.preview=') !== -1 ||
|
|
2777
2784
|
location.search.indexOf('builder.frameEditing=') !== -1));
|
|
2778
2785
|
Builder.isReact = false;
|
|
2786
|
+
Builder.sdkInfo = undefined;
|
|
2779
2787
|
Builder.overrideUserAttributes = {};
|
|
2780
2788
|
return Builder;
|
|
2781
2789
|
}());
|