@builder.io/sdk 1.1.34-0 → 1.1.34-1
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 +4 -0
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.js +25 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +25 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +25 -15
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/builder.class.js +3 -3
- package/dist/src/builder.class.js.map +1 -1
- package/dist/src/functions/fetch.function.d.ts +1 -2
- package/dist/src/functions/fetch.function.js +22 -11
- package/dist/src/functions/fetch.function.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
throw new Error("Property name \"".concat(name, "\" is not allowed"));
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
var version = "1.1.
|
|
155
|
+
var version = "1.1.34-0";
|
|
156
156
|
|
|
157
157
|
var Subscription = /** @class */ (function () {
|
|
158
158
|
function Subscription(listeners, listener) {
|
|
@@ -479,17 +479,27 @@
|
|
|
479
479
|
}
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
482
|
+
function getFetch() {
|
|
483
|
+
// If fetch is defined, in the browser, via polyfill, or in a Cloudflare worker, use it.
|
|
484
|
+
var _fetch = fetch;
|
|
485
|
+
if (globalThis.fetch) {
|
|
486
|
+
_fetch !== null && _fetch !== void 0 ? _fetch : (_fetch = globalThis.fetch);
|
|
487
|
+
}
|
|
488
|
+
else if (typeof window === 'undefined') {
|
|
489
|
+
// If fetch is not defined, in a Node.js environment, use node-fetch.
|
|
490
|
+
try {
|
|
491
|
+
// node-fetch@^3 is ESM only, and will throw error on require.
|
|
492
|
+
_fetch !== null && _fetch !== void 0 ? _fetch : (_fetch = serverOnlyRequire$1('node-fetch'));
|
|
493
|
+
}
|
|
494
|
+
catch (e) {
|
|
495
|
+
// If node-fetch is not installed, use tiny-fetch.
|
|
496
|
+
console.warn('node-fetch is not installed. consider polyfilling fetch or installing node-fetch.');
|
|
497
|
+
console.warn(e);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
// Otherwise, use tiny-fetch.
|
|
501
|
+
return _fetch !== null && _fetch !== void 0 ? _fetch : tinyFetch;
|
|
502
|
+
}
|
|
493
503
|
|
|
494
504
|
function assign(target) {
|
|
495
505
|
var args = [];
|
|
@@ -1514,7 +1524,7 @@
|
|
|
1514
1524
|
Object.assign(event_1.data.metadata.user, fullUserAttributes, event_1.data.metadata.user);
|
|
1515
1525
|
}
|
|
1516
1526
|
var host = this.host;
|
|
1517
|
-
|
|
1527
|
+
getFetch()("".concat(host, "/api/v1/track"), {
|
|
1518
1528
|
method: 'POST',
|
|
1519
1529
|
body: JSON.stringify({ events: events }),
|
|
1520
1530
|
headers: {
|
|
@@ -2285,7 +2295,7 @@
|
|
|
2285
2295
|
// even though we only use `fetch()` now, we prefer to keep the old behavior and use the `fetch` that comes from
|
|
2286
2296
|
// the core SDK for consistency
|
|
2287
2297
|
Builder.prototype.requestUrl = function (url, options) {
|
|
2288
|
-
return
|
|
2298
|
+
return getFetch()(url, options).then(function (res) { return res.json(); });
|
|
2289
2299
|
};
|
|
2290
2300
|
Object.defineProperty(Builder.prototype, "host", {
|
|
2291
2301
|
get: function () {
|
|
@@ -2451,7 +2461,7 @@
|
|
|
2451
2461
|
var fn = format === 'solid' || format === 'react' ? 'codegen' : 'query';
|
|
2452
2462
|
var url = "".concat(host, "/api/v1/").concat(fn, "/").concat(this.apiKey, "/").concat(keyNames) +
|
|
2453
2463
|
(queryParams && hasParams ? "?".concat(queryStr) : '');
|
|
2454
|
-
var promise =
|
|
2464
|
+
var promise = getFetch()(url, requestOptions)
|
|
2455
2465
|
.then(function (res) { return res.json(); })
|
|
2456
2466
|
.then(function (result) {
|
|
2457
2467
|
for (var _i = 0, queue_3 = queue; _i < queue_3.length; _i++) {
|