@builder.io/sdk 1.1.26 → 1.1.27-2
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/README.md +5 -4
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.js +63 -56
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +63 -56
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +63 -56
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +9 -2
- package/dist/src/builder.class.d.ts +203 -18
- package/dist/src/builder.class.js +65 -57
- package/dist/src/builder.class.js.map +1 -1
- package/dist/src/classes/animator.class.js +13 -12
- package/dist/src/classes/animator.class.js.map +1 -1
- package/dist/src/classes/cookies.class.js +8 -8
- package/dist/src/classes/cookies.class.js.map +1 -1
- package/dist/src/classes/observable.class.js +2 -1
- package/dist/src/classes/observable.class.js.map +1 -1
- package/dist/src/classes/promise.class.js +5 -4
- package/dist/src/classes/promise.class.js.map +1 -1
- package/dist/src/classes/query-string.class.js +2 -1
- package/dist/src/classes/query-string.class.js.map +1 -1
- package/dist/src/constants/builder.js +1 -0
- package/dist/src/constants/builder.js.map +1 -1
- package/dist/src/functions/assign.function.js +1 -0
- package/dist/src/functions/assign.function.js.map +1 -1
- package/dist/src/functions/fetch.function.js +3 -2
- package/dist/src/functions/fetch.function.js.map +1 -1
- package/dist/src/functions/finder.function.js +13 -11
- package/dist/src/functions/finder.function.js.map +1 -1
- package/dist/src/functions/get-top-level-domain.js +1 -0
- package/dist/src/functions/get-top-level-domain.js.map +1 -1
- package/dist/src/functions/next-tick.function.js +1 -0
- package/dist/src/functions/next-tick.function.js.map +1 -1
- package/dist/src/functions/omit.function.js +1 -0
- package/dist/src/functions/omit.function.js.map +1 -1
- package/dist/src/functions/throttle.function.js +1 -0
- package/dist/src/functions/throttle.function.js.map +1 -1
- package/dist/src/functions/uuid.js +1 -0
- package/dist/src/functions/uuid.js.map +1 -1
- package/dist/src/types/element.d.ts +4 -2
- package/docs/interfaces/Component.md +267 -0
- package/docs/interfaces/GetContentOptions.md +396 -0
- package/docs/interfaces/Input.md +232 -0
- package/docs/interfaces/InsertMenuConfig.md +83 -0
- package/docs/interfaces/InsertMenuItem.md +39 -0
- package/docs/interfaces/ParamsMap.md +5 -0
- package/docs/interfaces/UserAttributes.md +25 -0
- package/jest.config.ts +4 -4
- package/package.json +9 -2
- package/scripts/cleanup-generated-docs.js +18 -0
- package/typedoc.js +5 -0
- package/BUILD +0 -19
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.builder = exports.Subscription = exports.BehaviorSubject = exports.isBrowser = exports.BuilderComponent = exports.Builder = void 0;
|
|
3
4
|
var builder_class_1 = require("./src/builder.class");
|
|
4
|
-
exports
|
|
5
|
-
exports
|
|
6
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "Builder", { enumerable: true, get: function () { return builder_class_1.Builder; } });
|
|
6
|
+
Object.defineProperty(exports, "BuilderComponent", { enumerable: true, get: function () { return builder_class_1.BuilderComponent; } });
|
|
7
|
+
Object.defineProperty(exports, "isBrowser", { enumerable: true, get: function () { return builder_class_1.isBrowser; } });
|
|
7
8
|
var observable_class_1 = require("./src/classes/observable.class");
|
|
8
|
-
exports
|
|
9
|
-
exports
|
|
9
|
+
Object.defineProperty(exports, "BehaviorSubject", { enumerable: true, get: function () { return observable_class_1.BehaviorSubject; } });
|
|
10
|
+
Object.defineProperty(exports, "Subscription", { enumerable: true, get: function () { return observable_class_1.Subscription; } });
|
|
10
11
|
var builder_1 = require("./src/constants/builder");
|
|
11
|
-
exports
|
|
12
|
+
Object.defineProperty(exports, "builder", { enumerable: true, get: function () { return builder_1.builder; } });
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,qDAQ6B;AACpB,wFARP,uBAAO,OAQO;AAAE,iGAPhB,gCAAgB,OAOgB;AAAE,0FANlC,yBAAS,OAMkC;AAE7C,mEAA+E;AAAtE,mHAAA,eAAe,OAAA;AAAE,gHAAA,YAAY,OAAA;AAKtC,mDAAkD;AAAzC,kGAAA,OAAO,OAAA"}
|
package/dist/index.umd.js
CHANGED
|
@@ -149,10 +149,10 @@
|
|
|
149
149
|
}());
|
|
150
150
|
function assertAllowedPropertyName(name) {
|
|
151
151
|
if (PROPERTY_NAME_DENY_LIST.indexOf(name) >= 0)
|
|
152
|
-
throw new Error("Property name \""
|
|
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.27-1";
|
|
156
156
|
|
|
157
157
|
var Subscription = /** @class */ (function () {
|
|
158
158
|
function Subscription(listeners, listener) {
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
get: function () {
|
|
166
166
|
return this.unsubscribed;
|
|
167
167
|
},
|
|
168
|
-
enumerable:
|
|
168
|
+
enumerable: false,
|
|
169
169
|
configurable: true
|
|
170
170
|
});
|
|
171
171
|
Subscription.prototype.add = function (subscription) {
|
|
@@ -457,7 +457,7 @@
|
|
|
457
457
|
keys.push((key = key.toLowerCase()));
|
|
458
458
|
all.push([key, value]);
|
|
459
459
|
header = headers[key];
|
|
460
|
-
headers[key] = header ? header
|
|
460
|
+
headers[key] = header ? "".concat(header, ",").concat(value) : value;
|
|
461
461
|
return '';
|
|
462
462
|
});
|
|
463
463
|
return {
|
|
@@ -547,7 +547,7 @@
|
|
|
547
547
|
}
|
|
548
548
|
|
|
549
549
|
var camelCaseToKebabCase = function (str) {
|
|
550
|
-
return str ? str.replace(/([A-Z])/g, function (g) { return "-"
|
|
550
|
+
return str ? str.replace(/([A-Z])/g, function (g) { return "-".concat(g[0].toLowerCase()); }) : '';
|
|
551
551
|
};
|
|
552
552
|
var Animator = /** @class */ (function () {
|
|
553
553
|
function Animator() {
|
|
@@ -569,7 +569,7 @@
|
|
|
569
569
|
}
|
|
570
570
|
};
|
|
571
571
|
Animator.prototype.warnElementNotPresent = function (id) {
|
|
572
|
-
console.warn("Cannot animate element: element with ID "
|
|
572
|
+
console.warn("Cannot animate element: element with ID ".concat(id, " not found!"));
|
|
573
573
|
};
|
|
574
574
|
Animator.prototype.augmentAnimation = function (animation, element) {
|
|
575
575
|
var stylesUsed = this.getAllStylesUsed(animation);
|
|
@@ -625,7 +625,7 @@
|
|
|
625
625
|
// TODO: only include properties explicitly set in the animation
|
|
626
626
|
// using Object.keys(styles)
|
|
627
627
|
setTimeout(function () {
|
|
628
|
-
element.style.transition = "all "
|
|
628
|
+
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing));
|
|
629
629
|
if (animation.delay) {
|
|
630
630
|
element.style.transitionDelay = animation.delay + 's';
|
|
631
631
|
}
|
|
@@ -665,7 +665,7 @@
|
|
|
665
665
|
element.addEventListener('mouseleave', attachDefaultState);
|
|
666
666
|
// TODO: queue/batch these timeouts
|
|
667
667
|
setTimeout(function () {
|
|
668
|
-
element.style.transition = "all "
|
|
668
|
+
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing));
|
|
669
669
|
if (animation.delay) {
|
|
670
670
|
element.style.transitionDelay = animation.delay + 's';
|
|
671
671
|
}
|
|
@@ -719,7 +719,7 @@
|
|
|
719
719
|
attachDefaultState();
|
|
720
720
|
// TODO: queue/batch these timeouts!
|
|
721
721
|
setTimeout(function () {
|
|
722
|
-
element.style.transition = "all "
|
|
722
|
+
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing));
|
|
723
723
|
if (animation.delay) {
|
|
724
724
|
element.style.transitionDelay = animation.delay + 's';
|
|
725
725
|
}
|
|
@@ -827,7 +827,7 @@
|
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
829
|
Cookie.prototype.toString = function () {
|
|
830
|
-
return this.name
|
|
830
|
+
return "".concat(this.name, "=").concat(this.value);
|
|
831
831
|
};
|
|
832
832
|
Cookie.prototype.toHeader = function () {
|
|
833
833
|
var header = this.toString();
|
|
@@ -835,16 +835,16 @@
|
|
|
835
835
|
this.expires = new Date(Date.now() + this.maxAge);
|
|
836
836
|
}
|
|
837
837
|
if (this.path) {
|
|
838
|
-
header += "; path="
|
|
838
|
+
header += "; path=".concat(this.path);
|
|
839
839
|
}
|
|
840
840
|
if (this.expires) {
|
|
841
|
-
header += "; expires="
|
|
841
|
+
header += "; expires=".concat(this.expires.toUTCString());
|
|
842
842
|
}
|
|
843
843
|
if (this.domain) {
|
|
844
|
-
header += "; domain="
|
|
844
|
+
header += "; domain=".concat(this.domain);
|
|
845
845
|
}
|
|
846
846
|
// TODO: samesite=none by default (?)
|
|
847
|
-
header += "; SameSite="
|
|
847
|
+
header += "; SameSite=".concat(this.sameSite === true ? 'strict' : 'None');
|
|
848
848
|
// TODO: On by default
|
|
849
849
|
if (this.secure) {
|
|
850
850
|
header += '; secure';
|
|
@@ -857,12 +857,12 @@
|
|
|
857
857
|
return Cookie;
|
|
858
858
|
}());
|
|
859
859
|
function getPattern(name) {
|
|
860
|
-
return new RegExp("(?:^|;) *"
|
|
860
|
+
return new RegExp("(?:^|;) *".concat(name.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), "=([^;]*)"));
|
|
861
861
|
}
|
|
862
862
|
function pushCookie(headers, cookie) {
|
|
863
863
|
if (cookie.overwrite) {
|
|
864
864
|
for (var i = headers.length - 1; i >= 0; i--) {
|
|
865
|
-
if (headers[i].indexOf(cookie.name
|
|
865
|
+
if (headers[i].indexOf("".concat(cookie.name, "=")) === 0) {
|
|
866
866
|
headers.splice(i, 1);
|
|
867
867
|
}
|
|
868
868
|
}
|
|
@@ -1036,7 +1036,7 @@
|
|
|
1036
1036
|
(value || '') +
|
|
1037
1037
|
expiresString +
|
|
1038
1038
|
'; path=/' +
|
|
1039
|
-
|
|
1039
|
+
"; domain=".concat(getTopLevelDomain(location.hostname)) +
|
|
1040
1040
|
(secure ? ';secure ; SameSite=None' : '');
|
|
1041
1041
|
}
|
|
1042
1042
|
catch (err) {
|
|
@@ -1078,10 +1078,10 @@
|
|
|
1078
1078
|
}
|
|
1079
1079
|
var Builder = /** @class */ (function () {
|
|
1080
1080
|
function Builder(apiKey, request, response, forceNewInstance, authToken) {
|
|
1081
|
-
var _this = this;
|
|
1082
1081
|
if (apiKey === void 0) { apiKey = null; }
|
|
1083
1082
|
if (forceNewInstance === void 0) { forceNewInstance = false; }
|
|
1084
1083
|
if (authToken === void 0) { authToken = null; }
|
|
1084
|
+
var _this = this;
|
|
1085
1085
|
this.request = request;
|
|
1086
1086
|
this.response = response;
|
|
1087
1087
|
this.eventsQueue = [];
|
|
@@ -1241,13 +1241,13 @@
|
|
|
1241
1241
|
this.trustedHosts.push(host);
|
|
1242
1242
|
};
|
|
1243
1243
|
Builder.isTrustedHost = function (hostname) {
|
|
1244
|
-
return (this.trustedHosts.findIndex(function (trustedHost) { return trustedHost === hostname || hostname.endsWith("."
|
|
1244
|
+
return (this.trustedHosts.findIndex(function (trustedHost) { return trustedHost === hostname || hostname.endsWith(".".concat(trustedHost)); }) > -1);
|
|
1245
1245
|
};
|
|
1246
1246
|
Builder.runAction = function (action) {
|
|
1247
1247
|
// TODO
|
|
1248
1248
|
var actionObject = typeof action === 'string' ? find(this.actions, function (item) { return item.name === action; }) : action;
|
|
1249
1249
|
if (!actionObject) {
|
|
1250
|
-
throw new Error("Action not found: "
|
|
1250
|
+
throw new Error("Action not found: ".concat(action));
|
|
1251
1251
|
}
|
|
1252
1252
|
};
|
|
1253
1253
|
Builder.fields = function (name$$1, fields) {
|
|
@@ -1257,17 +1257,14 @@
|
|
|
1257
1257
|
data: { name: name$$1, fields: fields },
|
|
1258
1258
|
}, '*');
|
|
1259
1259
|
};
|
|
1260
|
+
/**
|
|
1261
|
+
* @deprecated
|
|
1262
|
+
* @hidden
|
|
1263
|
+
*
|
|
1264
|
+
* Use Builder.register('editor.settings', {}) instead.
|
|
1265
|
+
*/
|
|
1260
1266
|
Builder.set = function (settings) {
|
|
1261
|
-
|
|
1262
|
-
// TODO: merge
|
|
1263
|
-
Object.assign(this.settings, settings);
|
|
1264
|
-
var message = {
|
|
1265
|
-
type: 'builder.settingsChange',
|
|
1266
|
-
data: this.settings,
|
|
1267
|
-
};
|
|
1268
|
-
parent.postMessage(message, '*');
|
|
1269
|
-
}
|
|
1270
|
-
this.settingsChange.next(this.settings);
|
|
1267
|
+
Builder.register('editor.settings', settings);
|
|
1271
1268
|
};
|
|
1272
1269
|
Builder.import = function (packageName) {
|
|
1273
1270
|
if (!Builder.isBrowser) {
|
|
@@ -1280,7 +1277,7 @@
|
|
|
1280
1277
|
console.warn('System.js not available. Please include System.js when using Builder.import');
|
|
1281
1278
|
return;
|
|
1282
1279
|
}
|
|
1283
|
-
return System.import("https://cdn.builder.io/systemjs/"
|
|
1280
|
+
return System.import("https://cdn.builder.io/systemjs/".concat(packageName));
|
|
1284
1281
|
};
|
|
1285
1282
|
Object.defineProperty(Builder, "editingPage", {
|
|
1286
1283
|
// useCdnApi = false;
|
|
@@ -1298,7 +1295,7 @@
|
|
|
1298
1295
|
}
|
|
1299
1296
|
}
|
|
1300
1297
|
},
|
|
1301
|
-
enumerable:
|
|
1298
|
+
enumerable: false,
|
|
1302
1299
|
configurable: true
|
|
1303
1300
|
});
|
|
1304
1301
|
Builder.prepareComponentSpecToSend = function (spec) {
|
|
@@ -1313,7 +1310,7 @@
|
|
|
1313
1310
|
var key = keysToConvertFnToString_1[_i];
|
|
1314
1311
|
if (input[key] && typeof input[key] === 'function') {
|
|
1315
1312
|
var fn = input[key];
|
|
1316
|
-
input = __assign(__assign({}, input), (_a = {}, _a[key] = "return ("
|
|
1313
|
+
input = __assign(__assign({}, input), (_a = {}, _a[key] = "return (".concat(fn.toString(), ").apply(this, arguments)"), _a));
|
|
1317
1314
|
}
|
|
1318
1315
|
}
|
|
1319
1316
|
return input;
|
|
@@ -1327,7 +1324,7 @@
|
|
|
1327
1324
|
memo[key] = value;
|
|
1328
1325
|
}
|
|
1329
1326
|
else {
|
|
1330
|
-
memo[key] = "return ("
|
|
1327
|
+
memo[key] = "return (".concat(value.toString(), ").apply(this, arguments)");
|
|
1331
1328
|
}
|
|
1332
1329
|
return memo;
|
|
1333
1330
|
}, {}), class: undefined });
|
|
@@ -1390,7 +1387,7 @@
|
|
|
1390
1387
|
get: function () {
|
|
1391
1388
|
return this.component;
|
|
1392
1389
|
},
|
|
1393
|
-
enumerable:
|
|
1390
|
+
enumerable: false,
|
|
1394
1391
|
configurable: true
|
|
1395
1392
|
});
|
|
1396
1393
|
Builder.prototype.processEventsQueue = function () {
|
|
@@ -1411,7 +1408,7 @@
|
|
|
1411
1408
|
Object.assign(event_1.data.metadata.user, fullUserAttributes, event_1.data.metadata.user);
|
|
1412
1409
|
}
|
|
1413
1410
|
var host = this.host;
|
|
1414
|
-
fetch(host
|
|
1411
|
+
fetch("".concat(host, "/api/v1/track"), {
|
|
1415
1412
|
method: 'POST',
|
|
1416
1413
|
body: JSON.stringify({ events: events }),
|
|
1417
1414
|
headers: {
|
|
@@ -1424,9 +1421,9 @@
|
|
|
1424
1421
|
};
|
|
1425
1422
|
Object.defineProperty(Builder.prototype, "browserTrackingDisabled", {
|
|
1426
1423
|
get: function () {
|
|
1427
|
-
return Boolean(Builder.isBrowser && window.builderNoTrack);
|
|
1424
|
+
return Boolean((Builder.isBrowser && window.builderNoTrack) || !navigator.cookieEnabled);
|
|
1428
1425
|
},
|
|
1429
|
-
enumerable:
|
|
1426
|
+
enumerable: false,
|
|
1430
1427
|
configurable: true
|
|
1431
1428
|
});
|
|
1432
1429
|
Object.defineProperty(Builder.prototype, "canTrack", {
|
|
@@ -1438,7 +1435,7 @@
|
|
|
1438
1435
|
this.canTrack$.next(canTrack);
|
|
1439
1436
|
}
|
|
1440
1437
|
},
|
|
1441
|
-
enumerable:
|
|
1438
|
+
enumerable: false,
|
|
1442
1439
|
configurable: true
|
|
1443
1440
|
});
|
|
1444
1441
|
Object.defineProperty(Builder.prototype, "editingMode", {
|
|
@@ -1450,7 +1447,7 @@
|
|
|
1450
1447
|
this.editingMode$.next(value);
|
|
1451
1448
|
}
|
|
1452
1449
|
},
|
|
1453
|
-
enumerable:
|
|
1450
|
+
enumerable: false,
|
|
1454
1451
|
configurable: true
|
|
1455
1452
|
});
|
|
1456
1453
|
Object.defineProperty(Builder.prototype, "editingModel", {
|
|
@@ -1462,7 +1459,7 @@
|
|
|
1462
1459
|
this.editingModel$.next(value);
|
|
1463
1460
|
}
|
|
1464
1461
|
},
|
|
1465
|
-
enumerable:
|
|
1462
|
+
enumerable: false,
|
|
1466
1463
|
configurable: true
|
|
1467
1464
|
});
|
|
1468
1465
|
Builder.prototype.findParentElement = function (target, callback, checkElement) {
|
|
@@ -1626,7 +1623,7 @@
|
|
|
1626
1623
|
(Builder.isBrowser && (location.hostname === 'localhost' || location.port !== '')) ||
|
|
1627
1624
|
this.env !== 'production');
|
|
1628
1625
|
},
|
|
1629
|
-
enumerable:
|
|
1626
|
+
enumerable: false,
|
|
1630
1627
|
configurable: true
|
|
1631
1628
|
});
|
|
1632
1629
|
Builder.prototype.trackInteraction = function (contentId, variationId, alreadyTrackedOne, event, context) {
|
|
@@ -1691,7 +1688,7 @@
|
|
|
1691
1688
|
set: function (key) {
|
|
1692
1689
|
this.apiKey$.next(key);
|
|
1693
1690
|
},
|
|
1694
|
-
enumerable:
|
|
1691
|
+
enumerable: false,
|
|
1695
1692
|
configurable: true
|
|
1696
1693
|
});
|
|
1697
1694
|
Object.defineProperty(Builder.prototype, "authToken", {
|
|
@@ -1701,7 +1698,7 @@
|
|
|
1701
1698
|
set: function (token) {
|
|
1702
1699
|
this.authToken$.next(token);
|
|
1703
1700
|
},
|
|
1704
|
-
enumerable:
|
|
1701
|
+
enumerable: false,
|
|
1705
1702
|
configurable: true
|
|
1706
1703
|
});
|
|
1707
1704
|
Builder.prototype.modifySearch = function (search) {
|
|
@@ -1965,7 +1962,7 @@
|
|
|
1965
1962
|
!navigator.userAgent.match(/bot|crawler|spider|robot|crawling|prerender|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|phantom|headless|selenium|puppeteer/i) &&
|
|
1966
1963
|
!this.browserTrackingDisabled);
|
|
1967
1964
|
},
|
|
1968
|
-
enumerable:
|
|
1965
|
+
enumerable: false,
|
|
1969
1966
|
configurable: true
|
|
1970
1967
|
});
|
|
1971
1968
|
Builder.prototype.init = function (apiKey, canTrack, req, res, authToken) {
|
|
@@ -1989,7 +1986,7 @@
|
|
|
1989
1986
|
var params = QueryString.parse((search || '').substr(1));
|
|
1990
1987
|
return params['builder.preview'];
|
|
1991
1988
|
},
|
|
1992
|
-
enumerable:
|
|
1989
|
+
enumerable: false,
|
|
1993
1990
|
configurable: true
|
|
1994
1991
|
});
|
|
1995
1992
|
// TODO: allow adding location object as property and/or in constructor
|
|
@@ -2189,6 +2186,8 @@
|
|
|
2189
2186
|
module
|
|
2190
2187
|
.get(requestOptions, function (resp) {
|
|
2191
2188
|
var data = '';
|
|
2189
|
+
// We are collecting textual data
|
|
2190
|
+
resp.setEncoding('utf8');
|
|
2192
2191
|
// A chunk of data has been recieved.
|
|
2193
2192
|
resp.on('data', function (chunk) {
|
|
2194
2193
|
data += chunk;
|
|
@@ -2199,6 +2198,10 @@
|
|
|
2199
2198
|
resolve(JSON.parse(data));
|
|
2200
2199
|
}
|
|
2201
2200
|
catch (err) {
|
|
2201
|
+
if ((err === null || err === void 0 ? void 0 : err.name) === 'SyntaxError') {
|
|
2202
|
+
var jsonParseError = new Error("[Builder.io] ERROR: invalid response.\nRequest: ".concat(JSON.stringify(requestOptions, null, 2), "\nResponse Data: ").concat(data, "\n"));
|
|
2203
|
+
reject(jsonParseError);
|
|
2204
|
+
}
|
|
2202
2205
|
reject(err);
|
|
2203
2206
|
}
|
|
2204
2207
|
});
|
|
@@ -2232,14 +2235,14 @@
|
|
|
2232
2235
|
return Builder.overrideHost || 'https://cdn.builder.io';
|
|
2233
2236
|
}
|
|
2234
2237
|
},
|
|
2235
|
-
enumerable:
|
|
2238
|
+
enumerable: false,
|
|
2236
2239
|
configurable: true
|
|
2237
2240
|
});
|
|
2238
2241
|
Builder.prototype.flushGetContentQueue = function (usePastQueue, useQueue) {
|
|
2239
2242
|
var _this = this;
|
|
2240
2243
|
if (usePastQueue === void 0) { usePastQueue = false; }
|
|
2241
2244
|
if (!this.apiKey) {
|
|
2242
|
-
throw new Error("Fetching content failed, expected apiKey to be defined instead got: "
|
|
2245
|
+
throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
|
|
2243
2246
|
}
|
|
2244
2247
|
if (!usePastQueue && !this.getContentQueue) {
|
|
2245
2248
|
return;
|
|
@@ -2273,7 +2276,7 @@
|
|
|
2273
2276
|
if (fullUrlQueueItem) {
|
|
2274
2277
|
var location_1 = this.getLocation();
|
|
2275
2278
|
if (location_1.origin) {
|
|
2276
|
-
queryParams.url = ""
|
|
2279
|
+
queryParams.url = "".concat(location_1.origin).concat(location_1.pathname).concat(location_1.search);
|
|
2277
2280
|
}
|
|
2278
2281
|
}
|
|
2279
2282
|
var urlQueueItem = useQueue === null || useQueue === void 0 ? void 0 : useQueue.find(function (item) { return item.url; });
|
|
@@ -2303,7 +2306,7 @@
|
|
|
2303
2306
|
if (size(this.overrides)) {
|
|
2304
2307
|
for (var key in this.overrides) {
|
|
2305
2308
|
if (this.overrides.hasOwnProperty(key)) {
|
|
2306
|
-
queryParams["overrides."
|
|
2309
|
+
queryParams["overrides.".concat(key)] = this.overrides[key];
|
|
2307
2310
|
}
|
|
2308
2311
|
}
|
|
2309
2312
|
}
|
|
@@ -2367,9 +2370,9 @@
|
|
|
2367
2370
|
var format = queryParams.format;
|
|
2368
2371
|
var requestOptions = { headers: {} };
|
|
2369
2372
|
if (this.authToken) {
|
|
2370
|
-
requestOptions.headers = __assign(__assign({}, requestOptions.headers), { Authorization: "Bearer "
|
|
2373
|
+
requestOptions.headers = __assign(__assign({}, requestOptions.headers), { Authorization: "Bearer ".concat(this.authToken) });
|
|
2371
2374
|
}
|
|
2372
|
-
var promise = this.requestUrl(host
|
|
2375
|
+
var promise = this.requestUrl("".concat(host, "/api/v1/").concat(format === 'solid' || format === 'react' ? 'codegen' : 'query', "/").concat(this.apiKey, "/").concat(keyNames) + (queryParams && hasParams ? "?".concat(queryStr) : ''), requestOptions).then(function (result) {
|
|
2373
2376
|
for (var _i = 0, queue_3 = queue; _i < queue_3.length; _i++) {
|
|
2374
2377
|
var options = queue_3[_i];
|
|
2375
2378
|
var keyName = options.key;
|
|
@@ -2457,7 +2460,7 @@
|
|
|
2457
2460
|
return mappedResults;
|
|
2458
2461
|
};
|
|
2459
2462
|
Builder.prototype.getTestCookie = function (contentId) {
|
|
2460
|
-
return this.getCookie(this.testCookiePrefix
|
|
2463
|
+
return this.getCookie("".concat(this.testCookiePrefix, ".").concat(contentId));
|
|
2461
2464
|
};
|
|
2462
2465
|
Builder.prototype.setTestCookie = function (contentId, variationId) {
|
|
2463
2466
|
if (!this.canTrack) {
|
|
@@ -2467,7 +2470,7 @@
|
|
|
2467
2470
|
// 30 days from now
|
|
2468
2471
|
var future = new Date();
|
|
2469
2472
|
future.setDate(future.getDate() + 30);
|
|
2470
|
-
return this.setCookie(this.testCookiePrefix
|
|
2473
|
+
return this.setCookie("".concat(this.testCookiePrefix, ".").concat(contentId), variationId, future);
|
|
2471
2474
|
};
|
|
2472
2475
|
Builder.prototype.getCookie = function (name$$1) {
|
|
2473
2476
|
if (this.cookies) {
|
|
@@ -2487,7 +2490,7 @@
|
|
|
2487
2490
|
Builder.prototype.getContent = function (modelName, options) {
|
|
2488
2491
|
if (options === void 0) { options = {}; }
|
|
2489
2492
|
if (!this.apiKey) {
|
|
2490
|
-
throw new Error("Fetching content from model "
|
|
2493
|
+
throw new Error("Fetching content from model ".concat(modelName, " failed, expected apiKey to be defined instead got: ").concat(this.apiKey));
|
|
2491
2494
|
}
|
|
2492
2495
|
return this.queueGetContent(modelName, options);
|
|
2493
2496
|
};
|
|
@@ -2508,10 +2511,14 @@
|
|
|
2508
2511
|
// Make the key include all options so we don't reuse cache for the same conent fetched
|
|
2509
2512
|
// with different options
|
|
2510
2513
|
Builder.isBrowser
|
|
2511
|
-
? modelName
|
|
2514
|
+
? "".concat(modelName, ":").concat(hashSum(omit(options, 'initialContent', 'req', 'res')))
|
|
2512
2515
|
: undefined }))
|
|
2513
2516
|
.promise();
|
|
2514
2517
|
};
|
|
2518
|
+
/**
|
|
2519
|
+
* @hidden
|
|
2520
|
+
* @deprecated. This is buggy, and always behind by a version.
|
|
2521
|
+
*/
|
|
2515
2522
|
Builder.VERSION = version;
|
|
2516
2523
|
Builder.components = [];
|
|
2517
2524
|
/**
|