@builder.io/sdk 1.1.27-0 → 1.1.27-3
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 +61 -56
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +61 -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 +61 -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 +63 -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.cjs.js
CHANGED
|
@@ -126,10 +126,10 @@ var QueryString = /** @class */ (function () {
|
|
|
126
126
|
}());
|
|
127
127
|
function assertAllowedPropertyName(name) {
|
|
128
128
|
if (PROPERTY_NAME_DENY_LIST.indexOf(name) >= 0)
|
|
129
|
-
throw new Error("Property name \""
|
|
129
|
+
throw new Error("Property name \"".concat(name, "\" is not allowed"));
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
var version = "1.1.
|
|
132
|
+
var version = "1.1.27-2";
|
|
133
133
|
|
|
134
134
|
var Subscription = /** @class */ (function () {
|
|
135
135
|
function Subscription(listeners, listener) {
|
|
@@ -142,7 +142,7 @@ var Subscription = /** @class */ (function () {
|
|
|
142
142
|
get: function () {
|
|
143
143
|
return this.unsubscribed;
|
|
144
144
|
},
|
|
145
|
-
enumerable:
|
|
145
|
+
enumerable: false,
|
|
146
146
|
configurable: true
|
|
147
147
|
});
|
|
148
148
|
Subscription.prototype.add = function (subscription) {
|
|
@@ -434,7 +434,7 @@ function tinyFetch(url, options) {
|
|
|
434
434
|
keys.push((key = key.toLowerCase()));
|
|
435
435
|
all.push([key, value]);
|
|
436
436
|
header = headers[key];
|
|
437
|
-
headers[key] = header ? header
|
|
437
|
+
headers[key] = header ? "".concat(header, ",").concat(value) : value;
|
|
438
438
|
return '';
|
|
439
439
|
});
|
|
440
440
|
return {
|
|
@@ -524,7 +524,7 @@ function throttle(func, wait, options) {
|
|
|
524
524
|
}
|
|
525
525
|
|
|
526
526
|
var camelCaseToKebabCase = function (str) {
|
|
527
|
-
return str ? str.replace(/([A-Z])/g, function (g) { return "-"
|
|
527
|
+
return str ? str.replace(/([A-Z])/g, function (g) { return "-".concat(g[0].toLowerCase()); }) : '';
|
|
528
528
|
};
|
|
529
529
|
var Animator = /** @class */ (function () {
|
|
530
530
|
function Animator() {
|
|
@@ -546,7 +546,7 @@ var Animator = /** @class */ (function () {
|
|
|
546
546
|
}
|
|
547
547
|
};
|
|
548
548
|
Animator.prototype.warnElementNotPresent = function (id) {
|
|
549
|
-
console.warn("Cannot animate element: element with ID "
|
|
549
|
+
console.warn("Cannot animate element: element with ID ".concat(id, " not found!"));
|
|
550
550
|
};
|
|
551
551
|
Animator.prototype.augmentAnimation = function (animation, element) {
|
|
552
552
|
var stylesUsed = this.getAllStylesUsed(animation);
|
|
@@ -602,7 +602,7 @@ var Animator = /** @class */ (function () {
|
|
|
602
602
|
// TODO: only include properties explicitly set in the animation
|
|
603
603
|
// using Object.keys(styles)
|
|
604
604
|
setTimeout(function () {
|
|
605
|
-
element.style.transition = "all "
|
|
605
|
+
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing));
|
|
606
606
|
if (animation.delay) {
|
|
607
607
|
element.style.transitionDelay = animation.delay + 's';
|
|
608
608
|
}
|
|
@@ -642,7 +642,7 @@ var Animator = /** @class */ (function () {
|
|
|
642
642
|
element.addEventListener('mouseleave', attachDefaultState);
|
|
643
643
|
// TODO: queue/batch these timeouts
|
|
644
644
|
setTimeout(function () {
|
|
645
|
-
element.style.transition = "all "
|
|
645
|
+
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing));
|
|
646
646
|
if (animation.delay) {
|
|
647
647
|
element.style.transitionDelay = animation.delay + 's';
|
|
648
648
|
}
|
|
@@ -696,7 +696,7 @@ var Animator = /** @class */ (function () {
|
|
|
696
696
|
attachDefaultState();
|
|
697
697
|
// TODO: queue/batch these timeouts!
|
|
698
698
|
setTimeout(function () {
|
|
699
|
-
element.style.transition = "all "
|
|
699
|
+
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing));
|
|
700
700
|
if (animation.delay) {
|
|
701
701
|
element.style.transitionDelay = animation.delay + 's';
|
|
702
702
|
}
|
|
@@ -804,7 +804,7 @@ var Cookie = /** @class */ (function () {
|
|
|
804
804
|
}
|
|
805
805
|
}
|
|
806
806
|
Cookie.prototype.toString = function () {
|
|
807
|
-
return this.name
|
|
807
|
+
return "".concat(this.name, "=").concat(this.value);
|
|
808
808
|
};
|
|
809
809
|
Cookie.prototype.toHeader = function () {
|
|
810
810
|
var header = this.toString();
|
|
@@ -812,16 +812,16 @@ var Cookie = /** @class */ (function () {
|
|
|
812
812
|
this.expires = new Date(Date.now() + this.maxAge);
|
|
813
813
|
}
|
|
814
814
|
if (this.path) {
|
|
815
|
-
header += "; path="
|
|
815
|
+
header += "; path=".concat(this.path);
|
|
816
816
|
}
|
|
817
817
|
if (this.expires) {
|
|
818
|
-
header += "; expires="
|
|
818
|
+
header += "; expires=".concat(this.expires.toUTCString());
|
|
819
819
|
}
|
|
820
820
|
if (this.domain) {
|
|
821
|
-
header += "; domain="
|
|
821
|
+
header += "; domain=".concat(this.domain);
|
|
822
822
|
}
|
|
823
823
|
// TODO: samesite=none by default (?)
|
|
824
|
-
header += "; SameSite="
|
|
824
|
+
header += "; SameSite=".concat(this.sameSite === true ? 'strict' : 'None');
|
|
825
825
|
// TODO: On by default
|
|
826
826
|
if (this.secure) {
|
|
827
827
|
header += '; secure';
|
|
@@ -834,12 +834,12 @@ var Cookie = /** @class */ (function () {
|
|
|
834
834
|
return Cookie;
|
|
835
835
|
}());
|
|
836
836
|
function getPattern(name) {
|
|
837
|
-
return new RegExp("(?:^|;) *"
|
|
837
|
+
return new RegExp("(?:^|;) *".concat(name.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), "=([^;]*)"));
|
|
838
838
|
}
|
|
839
839
|
function pushCookie(headers, cookie) {
|
|
840
840
|
if (cookie.overwrite) {
|
|
841
841
|
for (var i = headers.length - 1; i >= 0; i--) {
|
|
842
|
-
if (headers[i].indexOf(cookie.name
|
|
842
|
+
if (headers[i].indexOf("".concat(cookie.name, "=")) === 0) {
|
|
843
843
|
headers.splice(i, 1);
|
|
844
844
|
}
|
|
845
845
|
}
|
|
@@ -945,7 +945,7 @@ function setCookie(name$$1, value, expires) {
|
|
|
945
945
|
(value || '') +
|
|
946
946
|
expiresString +
|
|
947
947
|
'; path=/' +
|
|
948
|
-
|
|
948
|
+
"; domain=".concat(getTopLevelDomain(location.hostname)) +
|
|
949
949
|
(secure ? ';secure ; SameSite=None' : '');
|
|
950
950
|
}
|
|
951
951
|
catch (err) {
|
|
@@ -987,10 +987,10 @@ function BuilderComponent(info) {
|
|
|
987
987
|
}
|
|
988
988
|
var Builder = /** @class */ (function () {
|
|
989
989
|
function Builder(apiKey, request, response, forceNewInstance, authToken) {
|
|
990
|
-
var _this = this;
|
|
991
990
|
if (apiKey === void 0) { apiKey = null; }
|
|
992
991
|
if (forceNewInstance === void 0) { forceNewInstance = false; }
|
|
993
992
|
if (authToken === void 0) { authToken = null; }
|
|
993
|
+
var _this = this;
|
|
994
994
|
this.request = request;
|
|
995
995
|
this.response = response;
|
|
996
996
|
this.eventsQueue = [];
|
|
@@ -1150,13 +1150,13 @@ var Builder = /** @class */ (function () {
|
|
|
1150
1150
|
this.trustedHosts.push(host);
|
|
1151
1151
|
};
|
|
1152
1152
|
Builder.isTrustedHost = function (hostname) {
|
|
1153
|
-
return (this.trustedHosts.findIndex(function (trustedHost) { return trustedHost === hostname || hostname.endsWith("."
|
|
1153
|
+
return (this.trustedHosts.findIndex(function (trustedHost) { return trustedHost === hostname || hostname.endsWith(".".concat(trustedHost)); }) > -1);
|
|
1154
1154
|
};
|
|
1155
1155
|
Builder.runAction = function (action) {
|
|
1156
1156
|
// TODO
|
|
1157
1157
|
var actionObject = typeof action === 'string' ? find(this.actions, function (item) { return item.name === action; }) : action;
|
|
1158
1158
|
if (!actionObject) {
|
|
1159
|
-
throw new Error("Action not found: "
|
|
1159
|
+
throw new Error("Action not found: ".concat(action));
|
|
1160
1160
|
}
|
|
1161
1161
|
};
|
|
1162
1162
|
Builder.fields = function (name$$1, fields) {
|
|
@@ -1166,17 +1166,14 @@ var Builder = /** @class */ (function () {
|
|
|
1166
1166
|
data: { name: name$$1, fields: fields },
|
|
1167
1167
|
}, '*');
|
|
1168
1168
|
};
|
|
1169
|
+
/**
|
|
1170
|
+
* @deprecated
|
|
1171
|
+
* @hidden
|
|
1172
|
+
*
|
|
1173
|
+
* Use Builder.register('editor.settings', {}) instead.
|
|
1174
|
+
*/
|
|
1169
1175
|
Builder.set = function (settings) {
|
|
1170
|
-
|
|
1171
|
-
// TODO: merge
|
|
1172
|
-
Object.assign(this.settings, settings);
|
|
1173
|
-
var message = {
|
|
1174
|
-
type: 'builder.settingsChange',
|
|
1175
|
-
data: this.settings,
|
|
1176
|
-
};
|
|
1177
|
-
parent.postMessage(message, '*');
|
|
1178
|
-
}
|
|
1179
|
-
this.settingsChange.next(this.settings);
|
|
1176
|
+
Builder.register('editor.settings', settings);
|
|
1180
1177
|
};
|
|
1181
1178
|
Builder.import = function (packageName) {
|
|
1182
1179
|
if (!Builder.isBrowser) {
|
|
@@ -1189,7 +1186,7 @@ var Builder = /** @class */ (function () {
|
|
|
1189
1186
|
console.warn('System.js not available. Please include System.js when using Builder.import');
|
|
1190
1187
|
return;
|
|
1191
1188
|
}
|
|
1192
|
-
return System.import("https://cdn.builder.io/systemjs/"
|
|
1189
|
+
return System.import("https://cdn.builder.io/systemjs/".concat(packageName));
|
|
1193
1190
|
};
|
|
1194
1191
|
Object.defineProperty(Builder, "editingPage", {
|
|
1195
1192
|
// useCdnApi = false;
|
|
@@ -1207,7 +1204,7 @@ var Builder = /** @class */ (function () {
|
|
|
1207
1204
|
}
|
|
1208
1205
|
}
|
|
1209
1206
|
},
|
|
1210
|
-
enumerable:
|
|
1207
|
+
enumerable: false,
|
|
1211
1208
|
configurable: true
|
|
1212
1209
|
});
|
|
1213
1210
|
Builder.prepareComponentSpecToSend = function (spec) {
|
|
@@ -1222,7 +1219,7 @@ var Builder = /** @class */ (function () {
|
|
|
1222
1219
|
var key = keysToConvertFnToString_1[_i];
|
|
1223
1220
|
if (input[key] && typeof input[key] === 'function') {
|
|
1224
1221
|
var fn = input[key];
|
|
1225
|
-
input = tslib.__assign(tslib.__assign({}, input), (_a = {}, _a[key] = "return ("
|
|
1222
|
+
input = tslib.__assign(tslib.__assign({}, input), (_a = {}, _a[key] = "return (".concat(fn.toString(), ").apply(this, arguments)"), _a));
|
|
1226
1223
|
}
|
|
1227
1224
|
}
|
|
1228
1225
|
return input;
|
|
@@ -1236,7 +1233,7 @@ var Builder = /** @class */ (function () {
|
|
|
1236
1233
|
memo[key] = value;
|
|
1237
1234
|
}
|
|
1238
1235
|
else {
|
|
1239
|
-
memo[key] = "return ("
|
|
1236
|
+
memo[key] = "return (".concat(value.toString(), ").apply(this, arguments)");
|
|
1240
1237
|
}
|
|
1241
1238
|
return memo;
|
|
1242
1239
|
}, {}), class: undefined });
|
|
@@ -1299,7 +1296,7 @@ var Builder = /** @class */ (function () {
|
|
|
1299
1296
|
get: function () {
|
|
1300
1297
|
return this.component;
|
|
1301
1298
|
},
|
|
1302
|
-
enumerable:
|
|
1299
|
+
enumerable: false,
|
|
1303
1300
|
configurable: true
|
|
1304
1301
|
});
|
|
1305
1302
|
Builder.prototype.processEventsQueue = function () {
|
|
@@ -1320,7 +1317,7 @@ var Builder = /** @class */ (function () {
|
|
|
1320
1317
|
Object.assign(event_1.data.metadata.user, fullUserAttributes, event_1.data.metadata.user);
|
|
1321
1318
|
}
|
|
1322
1319
|
var host = this.host;
|
|
1323
|
-
fetch(host
|
|
1320
|
+
fetch("".concat(host, "/api/v1/track"), {
|
|
1324
1321
|
method: 'POST',
|
|
1325
1322
|
body: JSON.stringify({ events: events }),
|
|
1326
1323
|
headers: {
|
|
@@ -1333,9 +1330,9 @@ var Builder = /** @class */ (function () {
|
|
|
1333
1330
|
};
|
|
1334
1331
|
Object.defineProperty(Builder.prototype, "browserTrackingDisabled", {
|
|
1335
1332
|
get: function () {
|
|
1336
|
-
return
|
|
1333
|
+
return Builder.isBrowser && Boolean(window.builderNoTrack || !navigator.cookieEnabled);
|
|
1337
1334
|
},
|
|
1338
|
-
enumerable:
|
|
1335
|
+
enumerable: false,
|
|
1339
1336
|
configurable: true
|
|
1340
1337
|
});
|
|
1341
1338
|
Object.defineProperty(Builder.prototype, "canTrack", {
|
|
@@ -1347,7 +1344,7 @@ var Builder = /** @class */ (function () {
|
|
|
1347
1344
|
this.canTrack$.next(canTrack);
|
|
1348
1345
|
}
|
|
1349
1346
|
},
|
|
1350
|
-
enumerable:
|
|
1347
|
+
enumerable: false,
|
|
1351
1348
|
configurable: true
|
|
1352
1349
|
});
|
|
1353
1350
|
Object.defineProperty(Builder.prototype, "editingMode", {
|
|
@@ -1359,7 +1356,7 @@ var Builder = /** @class */ (function () {
|
|
|
1359
1356
|
this.editingMode$.next(value);
|
|
1360
1357
|
}
|
|
1361
1358
|
},
|
|
1362
|
-
enumerable:
|
|
1359
|
+
enumerable: false,
|
|
1363
1360
|
configurable: true
|
|
1364
1361
|
});
|
|
1365
1362
|
Object.defineProperty(Builder.prototype, "editingModel", {
|
|
@@ -1371,7 +1368,7 @@ var Builder = /** @class */ (function () {
|
|
|
1371
1368
|
this.editingModel$.next(value);
|
|
1372
1369
|
}
|
|
1373
1370
|
},
|
|
1374
|
-
enumerable:
|
|
1371
|
+
enumerable: false,
|
|
1375
1372
|
configurable: true
|
|
1376
1373
|
});
|
|
1377
1374
|
Builder.prototype.findParentElement = function (target, callback, checkElement) {
|
|
@@ -1535,7 +1532,7 @@ var Builder = /** @class */ (function () {
|
|
|
1535
1532
|
(Builder.isBrowser && (location.hostname === 'localhost' || location.port !== '')) ||
|
|
1536
1533
|
this.env !== 'production');
|
|
1537
1534
|
},
|
|
1538
|
-
enumerable:
|
|
1535
|
+
enumerable: false,
|
|
1539
1536
|
configurable: true
|
|
1540
1537
|
});
|
|
1541
1538
|
Builder.prototype.trackInteraction = function (contentId, variationId, alreadyTrackedOne, event, context) {
|
|
@@ -1600,7 +1597,7 @@ var Builder = /** @class */ (function () {
|
|
|
1600
1597
|
set: function (key) {
|
|
1601
1598
|
this.apiKey$.next(key);
|
|
1602
1599
|
},
|
|
1603
|
-
enumerable:
|
|
1600
|
+
enumerable: false,
|
|
1604
1601
|
configurable: true
|
|
1605
1602
|
});
|
|
1606
1603
|
Object.defineProperty(Builder.prototype, "authToken", {
|
|
@@ -1610,7 +1607,7 @@ var Builder = /** @class */ (function () {
|
|
|
1610
1607
|
set: function (token) {
|
|
1611
1608
|
this.authToken$.next(token);
|
|
1612
1609
|
},
|
|
1613
|
-
enumerable:
|
|
1610
|
+
enumerable: false,
|
|
1614
1611
|
configurable: true
|
|
1615
1612
|
});
|
|
1616
1613
|
Builder.prototype.modifySearch = function (search) {
|
|
@@ -1874,7 +1871,7 @@ var Builder = /** @class */ (function () {
|
|
|
1874
1871
|
!navigator.userAgent.match(/bot|crawler|spider|robot|crawling|prerender|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|phantom|headless|selenium|puppeteer/i) &&
|
|
1875
1872
|
!this.browserTrackingDisabled);
|
|
1876
1873
|
},
|
|
1877
|
-
enumerable:
|
|
1874
|
+
enumerable: false,
|
|
1878
1875
|
configurable: true
|
|
1879
1876
|
});
|
|
1880
1877
|
Builder.prototype.init = function (apiKey, canTrack, req, res, authToken) {
|
|
@@ -1898,7 +1895,7 @@ var Builder = /** @class */ (function () {
|
|
|
1898
1895
|
var params = QueryString.parse((search || '').substr(1));
|
|
1899
1896
|
return params['builder.preview'];
|
|
1900
1897
|
},
|
|
1901
|
-
enumerable:
|
|
1898
|
+
enumerable: false,
|
|
1902
1899
|
configurable: true
|
|
1903
1900
|
});
|
|
1904
1901
|
// TODO: allow adding location object as property and/or in constructor
|
|
@@ -2110,6 +2107,10 @@ var Builder = /** @class */ (function () {
|
|
|
2110
2107
|
resolve(JSON.parse(data));
|
|
2111
2108
|
}
|
|
2112
2109
|
catch (err) {
|
|
2110
|
+
if ((err === null || err === void 0 ? void 0 : err.name) === 'SyntaxError') {
|
|
2111
|
+
var jsonParseError = new Error("[Builder.io] ERROR: invalid response.\nRequest: ".concat(JSON.stringify(requestOptions, null, 2), "\nResponse Data: ").concat(data, "\n"));
|
|
2112
|
+
reject(jsonParseError);
|
|
2113
|
+
}
|
|
2113
2114
|
reject(err);
|
|
2114
2115
|
}
|
|
2115
2116
|
});
|
|
@@ -2143,14 +2144,14 @@ var Builder = /** @class */ (function () {
|
|
|
2143
2144
|
return Builder.overrideHost || 'https://cdn.builder.io';
|
|
2144
2145
|
}
|
|
2145
2146
|
},
|
|
2146
|
-
enumerable:
|
|
2147
|
+
enumerable: false,
|
|
2147
2148
|
configurable: true
|
|
2148
2149
|
});
|
|
2149
2150
|
Builder.prototype.flushGetContentQueue = function (usePastQueue, useQueue) {
|
|
2150
2151
|
var _this = this;
|
|
2151
2152
|
if (usePastQueue === void 0) { usePastQueue = false; }
|
|
2152
2153
|
if (!this.apiKey) {
|
|
2153
|
-
throw new Error("Fetching content failed, expected apiKey to be defined instead got: "
|
|
2154
|
+
throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
|
|
2154
2155
|
}
|
|
2155
2156
|
if (!usePastQueue && !this.getContentQueue) {
|
|
2156
2157
|
return;
|
|
@@ -2184,7 +2185,7 @@ var Builder = /** @class */ (function () {
|
|
|
2184
2185
|
if (fullUrlQueueItem) {
|
|
2185
2186
|
var location_1 = this.getLocation();
|
|
2186
2187
|
if (location_1.origin) {
|
|
2187
|
-
queryParams.url = ""
|
|
2188
|
+
queryParams.url = "".concat(location_1.origin).concat(location_1.pathname).concat(location_1.search);
|
|
2188
2189
|
}
|
|
2189
2190
|
}
|
|
2190
2191
|
var urlQueueItem = useQueue === null || useQueue === void 0 ? void 0 : useQueue.find(function (item) { return item.url; });
|
|
@@ -2214,7 +2215,7 @@ var Builder = /** @class */ (function () {
|
|
|
2214
2215
|
if (size(this.overrides)) {
|
|
2215
2216
|
for (var key in this.overrides) {
|
|
2216
2217
|
if (this.overrides.hasOwnProperty(key)) {
|
|
2217
|
-
queryParams["overrides."
|
|
2218
|
+
queryParams["overrides.".concat(key)] = this.overrides[key];
|
|
2218
2219
|
}
|
|
2219
2220
|
}
|
|
2220
2221
|
}
|
|
@@ -2278,9 +2279,9 @@ var Builder = /** @class */ (function () {
|
|
|
2278
2279
|
var format = queryParams.format;
|
|
2279
2280
|
var requestOptions = { headers: {} };
|
|
2280
2281
|
if (this.authToken) {
|
|
2281
|
-
requestOptions.headers = tslib.__assign(tslib.__assign({}, requestOptions.headers), { Authorization: "Bearer "
|
|
2282
|
+
requestOptions.headers = tslib.__assign(tslib.__assign({}, requestOptions.headers), { Authorization: "Bearer ".concat(this.authToken) });
|
|
2282
2283
|
}
|
|
2283
|
-
var promise = this.requestUrl(host
|
|
2284
|
+
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) {
|
|
2284
2285
|
for (var _i = 0, queue_3 = queue; _i < queue_3.length; _i++) {
|
|
2285
2286
|
var options = queue_3[_i];
|
|
2286
2287
|
var keyName = options.key;
|
|
@@ -2368,7 +2369,7 @@ var Builder = /** @class */ (function () {
|
|
|
2368
2369
|
return mappedResults;
|
|
2369
2370
|
};
|
|
2370
2371
|
Builder.prototype.getTestCookie = function (contentId) {
|
|
2371
|
-
return this.getCookie(this.testCookiePrefix
|
|
2372
|
+
return this.getCookie("".concat(this.testCookiePrefix, ".").concat(contentId));
|
|
2372
2373
|
};
|
|
2373
2374
|
Builder.prototype.setTestCookie = function (contentId, variationId) {
|
|
2374
2375
|
if (!this.canTrack) {
|
|
@@ -2378,7 +2379,7 @@ var Builder = /** @class */ (function () {
|
|
|
2378
2379
|
// 30 days from now
|
|
2379
2380
|
var future = new Date();
|
|
2380
2381
|
future.setDate(future.getDate() + 30);
|
|
2381
|
-
return this.setCookie(this.testCookiePrefix
|
|
2382
|
+
return this.setCookie("".concat(this.testCookiePrefix, ".").concat(contentId), variationId, future);
|
|
2382
2383
|
};
|
|
2383
2384
|
Builder.prototype.getCookie = function (name$$1) {
|
|
2384
2385
|
if (this.cookies) {
|
|
@@ -2398,7 +2399,7 @@ var Builder = /** @class */ (function () {
|
|
|
2398
2399
|
Builder.prototype.getContent = function (modelName, options) {
|
|
2399
2400
|
if (options === void 0) { options = {}; }
|
|
2400
2401
|
if (!this.apiKey) {
|
|
2401
|
-
throw new Error("Fetching content from model "
|
|
2402
|
+
throw new Error("Fetching content from model ".concat(modelName, " failed, expected apiKey to be defined instead got: ").concat(this.apiKey));
|
|
2402
2403
|
}
|
|
2403
2404
|
return this.queueGetContent(modelName, options);
|
|
2404
2405
|
};
|
|
@@ -2419,10 +2420,14 @@ var Builder = /** @class */ (function () {
|
|
|
2419
2420
|
// Make the key include all options so we don't reuse cache for the same conent fetched
|
|
2420
2421
|
// with different options
|
|
2421
2422
|
Builder.isBrowser
|
|
2422
|
-
? modelName
|
|
2423
|
+
? "".concat(modelName, ":").concat(hash(omit(options, 'initialContent', 'req', 'res')))
|
|
2423
2424
|
: undefined }))
|
|
2424
2425
|
.promise();
|
|
2425
2426
|
};
|
|
2427
|
+
/**
|
|
2428
|
+
* @hidden
|
|
2429
|
+
* @deprecated. This is buggy, and always behind by a version.
|
|
2430
|
+
*/
|
|
2426
2431
|
Builder.VERSION = version;
|
|
2427
2432
|
Builder.components = [];
|
|
2428
2433
|
/**
|