@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.esm.js
CHANGED
|
@@ -120,10 +120,10 @@ var QueryString = /** @class */ (function () {
|
|
|
120
120
|
}());
|
|
121
121
|
function assertAllowedPropertyName(name) {
|
|
122
122
|
if (PROPERTY_NAME_DENY_LIST.indexOf(name) >= 0)
|
|
123
|
-
throw new Error("Property name \""
|
|
123
|
+
throw new Error("Property name \"".concat(name, "\" is not allowed"));
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
var version = "1.1.
|
|
126
|
+
var version = "1.1.27-2";
|
|
127
127
|
|
|
128
128
|
var Subscription = /** @class */ (function () {
|
|
129
129
|
function Subscription(listeners, listener) {
|
|
@@ -136,7 +136,7 @@ var Subscription = /** @class */ (function () {
|
|
|
136
136
|
get: function () {
|
|
137
137
|
return this.unsubscribed;
|
|
138
138
|
},
|
|
139
|
-
enumerable:
|
|
139
|
+
enumerable: false,
|
|
140
140
|
configurable: true
|
|
141
141
|
});
|
|
142
142
|
Subscription.prototype.add = function (subscription) {
|
|
@@ -428,7 +428,7 @@ function tinyFetch(url, options) {
|
|
|
428
428
|
keys.push((key = key.toLowerCase()));
|
|
429
429
|
all.push([key, value]);
|
|
430
430
|
header = headers[key];
|
|
431
|
-
headers[key] = header ? header
|
|
431
|
+
headers[key] = header ? "".concat(header, ",").concat(value) : value;
|
|
432
432
|
return '';
|
|
433
433
|
});
|
|
434
434
|
return {
|
|
@@ -518,7 +518,7 @@ function throttle(func, wait, options) {
|
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
var camelCaseToKebabCase = function (str) {
|
|
521
|
-
return str ? str.replace(/([A-Z])/g, function (g) { return "-"
|
|
521
|
+
return str ? str.replace(/([A-Z])/g, function (g) { return "-".concat(g[0].toLowerCase()); }) : '';
|
|
522
522
|
};
|
|
523
523
|
var Animator = /** @class */ (function () {
|
|
524
524
|
function Animator() {
|
|
@@ -540,7 +540,7 @@ var Animator = /** @class */ (function () {
|
|
|
540
540
|
}
|
|
541
541
|
};
|
|
542
542
|
Animator.prototype.warnElementNotPresent = function (id) {
|
|
543
|
-
console.warn("Cannot animate element: element with ID "
|
|
543
|
+
console.warn("Cannot animate element: element with ID ".concat(id, " not found!"));
|
|
544
544
|
};
|
|
545
545
|
Animator.prototype.augmentAnimation = function (animation, element) {
|
|
546
546
|
var stylesUsed = this.getAllStylesUsed(animation);
|
|
@@ -596,7 +596,7 @@ var Animator = /** @class */ (function () {
|
|
|
596
596
|
// TODO: only include properties explicitly set in the animation
|
|
597
597
|
// using Object.keys(styles)
|
|
598
598
|
setTimeout(function () {
|
|
599
|
-
element.style.transition = "all "
|
|
599
|
+
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing));
|
|
600
600
|
if (animation.delay) {
|
|
601
601
|
element.style.transitionDelay = animation.delay + 's';
|
|
602
602
|
}
|
|
@@ -636,7 +636,7 @@ var Animator = /** @class */ (function () {
|
|
|
636
636
|
element.addEventListener('mouseleave', attachDefaultState);
|
|
637
637
|
// TODO: queue/batch these timeouts
|
|
638
638
|
setTimeout(function () {
|
|
639
|
-
element.style.transition = "all "
|
|
639
|
+
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing));
|
|
640
640
|
if (animation.delay) {
|
|
641
641
|
element.style.transitionDelay = animation.delay + 's';
|
|
642
642
|
}
|
|
@@ -690,7 +690,7 @@ var Animator = /** @class */ (function () {
|
|
|
690
690
|
attachDefaultState();
|
|
691
691
|
// TODO: queue/batch these timeouts!
|
|
692
692
|
setTimeout(function () {
|
|
693
|
-
element.style.transition = "all "
|
|
693
|
+
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing));
|
|
694
694
|
if (animation.delay) {
|
|
695
695
|
element.style.transitionDelay = animation.delay + 's';
|
|
696
696
|
}
|
|
@@ -798,7 +798,7 @@ var Cookie = /** @class */ (function () {
|
|
|
798
798
|
}
|
|
799
799
|
}
|
|
800
800
|
Cookie.prototype.toString = function () {
|
|
801
|
-
return this.name
|
|
801
|
+
return "".concat(this.name, "=").concat(this.value);
|
|
802
802
|
};
|
|
803
803
|
Cookie.prototype.toHeader = function () {
|
|
804
804
|
var header = this.toString();
|
|
@@ -806,16 +806,16 @@ var Cookie = /** @class */ (function () {
|
|
|
806
806
|
this.expires = new Date(Date.now() + this.maxAge);
|
|
807
807
|
}
|
|
808
808
|
if (this.path) {
|
|
809
|
-
header += "; path="
|
|
809
|
+
header += "; path=".concat(this.path);
|
|
810
810
|
}
|
|
811
811
|
if (this.expires) {
|
|
812
|
-
header += "; expires="
|
|
812
|
+
header += "; expires=".concat(this.expires.toUTCString());
|
|
813
813
|
}
|
|
814
814
|
if (this.domain) {
|
|
815
|
-
header += "; domain="
|
|
815
|
+
header += "; domain=".concat(this.domain);
|
|
816
816
|
}
|
|
817
817
|
// TODO: samesite=none by default (?)
|
|
818
|
-
header += "; SameSite="
|
|
818
|
+
header += "; SameSite=".concat(this.sameSite === true ? 'strict' : 'None');
|
|
819
819
|
// TODO: On by default
|
|
820
820
|
if (this.secure) {
|
|
821
821
|
header += '; secure';
|
|
@@ -828,12 +828,12 @@ var Cookie = /** @class */ (function () {
|
|
|
828
828
|
return Cookie;
|
|
829
829
|
}());
|
|
830
830
|
function getPattern(name) {
|
|
831
|
-
return new RegExp("(?:^|;) *"
|
|
831
|
+
return new RegExp("(?:^|;) *".concat(name.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), "=([^;]*)"));
|
|
832
832
|
}
|
|
833
833
|
function pushCookie(headers, cookie) {
|
|
834
834
|
if (cookie.overwrite) {
|
|
835
835
|
for (var i = headers.length - 1; i >= 0; i--) {
|
|
836
|
-
if (headers[i].indexOf(cookie.name
|
|
836
|
+
if (headers[i].indexOf("".concat(cookie.name, "=")) === 0) {
|
|
837
837
|
headers.splice(i, 1);
|
|
838
838
|
}
|
|
839
839
|
}
|
|
@@ -939,7 +939,7 @@ function setCookie(name$$1, value, expires) {
|
|
|
939
939
|
(value || '') +
|
|
940
940
|
expiresString +
|
|
941
941
|
'; path=/' +
|
|
942
|
-
|
|
942
|
+
"; domain=".concat(getTopLevelDomain(location.hostname)) +
|
|
943
943
|
(secure ? ';secure ; SameSite=None' : '');
|
|
944
944
|
}
|
|
945
945
|
catch (err) {
|
|
@@ -981,10 +981,10 @@ function BuilderComponent(info) {
|
|
|
981
981
|
}
|
|
982
982
|
var Builder = /** @class */ (function () {
|
|
983
983
|
function Builder(apiKey, request, response, forceNewInstance, authToken) {
|
|
984
|
-
var _this = this;
|
|
985
984
|
if (apiKey === void 0) { apiKey = null; }
|
|
986
985
|
if (forceNewInstance === void 0) { forceNewInstance = false; }
|
|
987
986
|
if (authToken === void 0) { authToken = null; }
|
|
987
|
+
var _this = this;
|
|
988
988
|
this.request = request;
|
|
989
989
|
this.response = response;
|
|
990
990
|
this.eventsQueue = [];
|
|
@@ -1144,13 +1144,13 @@ var Builder = /** @class */ (function () {
|
|
|
1144
1144
|
this.trustedHosts.push(host);
|
|
1145
1145
|
};
|
|
1146
1146
|
Builder.isTrustedHost = function (hostname) {
|
|
1147
|
-
return (this.trustedHosts.findIndex(function (trustedHost) { return trustedHost === hostname || hostname.endsWith("."
|
|
1147
|
+
return (this.trustedHosts.findIndex(function (trustedHost) { return trustedHost === hostname || hostname.endsWith(".".concat(trustedHost)); }) > -1);
|
|
1148
1148
|
};
|
|
1149
1149
|
Builder.runAction = function (action) {
|
|
1150
1150
|
// TODO
|
|
1151
1151
|
var actionObject = typeof action === 'string' ? find(this.actions, function (item) { return item.name === action; }) : action;
|
|
1152
1152
|
if (!actionObject) {
|
|
1153
|
-
throw new Error("Action not found: "
|
|
1153
|
+
throw new Error("Action not found: ".concat(action));
|
|
1154
1154
|
}
|
|
1155
1155
|
};
|
|
1156
1156
|
Builder.fields = function (name$$1, fields) {
|
|
@@ -1160,17 +1160,14 @@ var Builder = /** @class */ (function () {
|
|
|
1160
1160
|
data: { name: name$$1, fields: fields },
|
|
1161
1161
|
}, '*');
|
|
1162
1162
|
};
|
|
1163
|
+
/**
|
|
1164
|
+
* @deprecated
|
|
1165
|
+
* @hidden
|
|
1166
|
+
*
|
|
1167
|
+
* Use Builder.register('editor.settings', {}) instead.
|
|
1168
|
+
*/
|
|
1163
1169
|
Builder.set = function (settings) {
|
|
1164
|
-
|
|
1165
|
-
// TODO: merge
|
|
1166
|
-
Object.assign(this.settings, settings);
|
|
1167
|
-
var message = {
|
|
1168
|
-
type: 'builder.settingsChange',
|
|
1169
|
-
data: this.settings,
|
|
1170
|
-
};
|
|
1171
|
-
parent.postMessage(message, '*');
|
|
1172
|
-
}
|
|
1173
|
-
this.settingsChange.next(this.settings);
|
|
1170
|
+
Builder.register('editor.settings', settings);
|
|
1174
1171
|
};
|
|
1175
1172
|
Builder.import = function (packageName) {
|
|
1176
1173
|
if (!Builder.isBrowser) {
|
|
@@ -1183,7 +1180,7 @@ var Builder = /** @class */ (function () {
|
|
|
1183
1180
|
console.warn('System.js not available. Please include System.js when using Builder.import');
|
|
1184
1181
|
return;
|
|
1185
1182
|
}
|
|
1186
|
-
return System.import("https://cdn.builder.io/systemjs/"
|
|
1183
|
+
return System.import("https://cdn.builder.io/systemjs/".concat(packageName));
|
|
1187
1184
|
};
|
|
1188
1185
|
Object.defineProperty(Builder, "editingPage", {
|
|
1189
1186
|
// useCdnApi = false;
|
|
@@ -1201,7 +1198,7 @@ var Builder = /** @class */ (function () {
|
|
|
1201
1198
|
}
|
|
1202
1199
|
}
|
|
1203
1200
|
},
|
|
1204
|
-
enumerable:
|
|
1201
|
+
enumerable: false,
|
|
1205
1202
|
configurable: true
|
|
1206
1203
|
});
|
|
1207
1204
|
Builder.prepareComponentSpecToSend = function (spec) {
|
|
@@ -1216,7 +1213,7 @@ var Builder = /** @class */ (function () {
|
|
|
1216
1213
|
var key = keysToConvertFnToString_1[_i];
|
|
1217
1214
|
if (input[key] && typeof input[key] === 'function') {
|
|
1218
1215
|
var fn = input[key];
|
|
1219
|
-
input = __assign(__assign({}, input), (_a = {}, _a[key] = "return ("
|
|
1216
|
+
input = __assign(__assign({}, input), (_a = {}, _a[key] = "return (".concat(fn.toString(), ").apply(this, arguments)"), _a));
|
|
1220
1217
|
}
|
|
1221
1218
|
}
|
|
1222
1219
|
return input;
|
|
@@ -1230,7 +1227,7 @@ var Builder = /** @class */ (function () {
|
|
|
1230
1227
|
memo[key] = value;
|
|
1231
1228
|
}
|
|
1232
1229
|
else {
|
|
1233
|
-
memo[key] = "return ("
|
|
1230
|
+
memo[key] = "return (".concat(value.toString(), ").apply(this, arguments)");
|
|
1234
1231
|
}
|
|
1235
1232
|
return memo;
|
|
1236
1233
|
}, {}), class: undefined });
|
|
@@ -1293,7 +1290,7 @@ var Builder = /** @class */ (function () {
|
|
|
1293
1290
|
get: function () {
|
|
1294
1291
|
return this.component;
|
|
1295
1292
|
},
|
|
1296
|
-
enumerable:
|
|
1293
|
+
enumerable: false,
|
|
1297
1294
|
configurable: true
|
|
1298
1295
|
});
|
|
1299
1296
|
Builder.prototype.processEventsQueue = function () {
|
|
@@ -1314,7 +1311,7 @@ var Builder = /** @class */ (function () {
|
|
|
1314
1311
|
Object.assign(event_1.data.metadata.user, fullUserAttributes, event_1.data.metadata.user);
|
|
1315
1312
|
}
|
|
1316
1313
|
var host = this.host;
|
|
1317
|
-
fetch(host
|
|
1314
|
+
fetch("".concat(host, "/api/v1/track"), {
|
|
1318
1315
|
method: 'POST',
|
|
1319
1316
|
body: JSON.stringify({ events: events }),
|
|
1320
1317
|
headers: {
|
|
@@ -1327,9 +1324,9 @@ var Builder = /** @class */ (function () {
|
|
|
1327
1324
|
};
|
|
1328
1325
|
Object.defineProperty(Builder.prototype, "browserTrackingDisabled", {
|
|
1329
1326
|
get: function () {
|
|
1330
|
-
return
|
|
1327
|
+
return Builder.isBrowser && Boolean(window.builderNoTrack || !navigator.cookieEnabled);
|
|
1331
1328
|
},
|
|
1332
|
-
enumerable:
|
|
1329
|
+
enumerable: false,
|
|
1333
1330
|
configurable: true
|
|
1334
1331
|
});
|
|
1335
1332
|
Object.defineProperty(Builder.prototype, "canTrack", {
|
|
@@ -1341,7 +1338,7 @@ var Builder = /** @class */ (function () {
|
|
|
1341
1338
|
this.canTrack$.next(canTrack);
|
|
1342
1339
|
}
|
|
1343
1340
|
},
|
|
1344
|
-
enumerable:
|
|
1341
|
+
enumerable: false,
|
|
1345
1342
|
configurable: true
|
|
1346
1343
|
});
|
|
1347
1344
|
Object.defineProperty(Builder.prototype, "editingMode", {
|
|
@@ -1353,7 +1350,7 @@ var Builder = /** @class */ (function () {
|
|
|
1353
1350
|
this.editingMode$.next(value);
|
|
1354
1351
|
}
|
|
1355
1352
|
},
|
|
1356
|
-
enumerable:
|
|
1353
|
+
enumerable: false,
|
|
1357
1354
|
configurable: true
|
|
1358
1355
|
});
|
|
1359
1356
|
Object.defineProperty(Builder.prototype, "editingModel", {
|
|
@@ -1365,7 +1362,7 @@ var Builder = /** @class */ (function () {
|
|
|
1365
1362
|
this.editingModel$.next(value);
|
|
1366
1363
|
}
|
|
1367
1364
|
},
|
|
1368
|
-
enumerable:
|
|
1365
|
+
enumerable: false,
|
|
1369
1366
|
configurable: true
|
|
1370
1367
|
});
|
|
1371
1368
|
Builder.prototype.findParentElement = function (target, callback, checkElement) {
|
|
@@ -1529,7 +1526,7 @@ var Builder = /** @class */ (function () {
|
|
|
1529
1526
|
(Builder.isBrowser && (location.hostname === 'localhost' || location.port !== '')) ||
|
|
1530
1527
|
this.env !== 'production');
|
|
1531
1528
|
},
|
|
1532
|
-
enumerable:
|
|
1529
|
+
enumerable: false,
|
|
1533
1530
|
configurable: true
|
|
1534
1531
|
});
|
|
1535
1532
|
Builder.prototype.trackInteraction = function (contentId, variationId, alreadyTrackedOne, event, context) {
|
|
@@ -1594,7 +1591,7 @@ var Builder = /** @class */ (function () {
|
|
|
1594
1591
|
set: function (key) {
|
|
1595
1592
|
this.apiKey$.next(key);
|
|
1596
1593
|
},
|
|
1597
|
-
enumerable:
|
|
1594
|
+
enumerable: false,
|
|
1598
1595
|
configurable: true
|
|
1599
1596
|
});
|
|
1600
1597
|
Object.defineProperty(Builder.prototype, "authToken", {
|
|
@@ -1604,7 +1601,7 @@ var Builder = /** @class */ (function () {
|
|
|
1604
1601
|
set: function (token) {
|
|
1605
1602
|
this.authToken$.next(token);
|
|
1606
1603
|
},
|
|
1607
|
-
enumerable:
|
|
1604
|
+
enumerable: false,
|
|
1608
1605
|
configurable: true
|
|
1609
1606
|
});
|
|
1610
1607
|
Builder.prototype.modifySearch = function (search) {
|
|
@@ -1868,7 +1865,7 @@ var Builder = /** @class */ (function () {
|
|
|
1868
1865
|
!navigator.userAgent.match(/bot|crawler|spider|robot|crawling|prerender|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|phantom|headless|selenium|puppeteer/i) &&
|
|
1869
1866
|
!this.browserTrackingDisabled);
|
|
1870
1867
|
},
|
|
1871
|
-
enumerable:
|
|
1868
|
+
enumerable: false,
|
|
1872
1869
|
configurable: true
|
|
1873
1870
|
});
|
|
1874
1871
|
Builder.prototype.init = function (apiKey, canTrack, req, res, authToken) {
|
|
@@ -1892,7 +1889,7 @@ var Builder = /** @class */ (function () {
|
|
|
1892
1889
|
var params = QueryString.parse((search || '').substr(1));
|
|
1893
1890
|
return params['builder.preview'];
|
|
1894
1891
|
},
|
|
1895
|
-
enumerable:
|
|
1892
|
+
enumerable: false,
|
|
1896
1893
|
configurable: true
|
|
1897
1894
|
});
|
|
1898
1895
|
// TODO: allow adding location object as property and/or in constructor
|
|
@@ -2104,6 +2101,10 @@ var Builder = /** @class */ (function () {
|
|
|
2104
2101
|
resolve(JSON.parse(data));
|
|
2105
2102
|
}
|
|
2106
2103
|
catch (err) {
|
|
2104
|
+
if ((err === null || err === void 0 ? void 0 : err.name) === 'SyntaxError') {
|
|
2105
|
+
var jsonParseError = new Error("[Builder.io] ERROR: invalid response.\nRequest: ".concat(JSON.stringify(requestOptions, null, 2), "\nResponse Data: ").concat(data, "\n"));
|
|
2106
|
+
reject(jsonParseError);
|
|
2107
|
+
}
|
|
2107
2108
|
reject(err);
|
|
2108
2109
|
}
|
|
2109
2110
|
});
|
|
@@ -2137,14 +2138,14 @@ var Builder = /** @class */ (function () {
|
|
|
2137
2138
|
return Builder.overrideHost || 'https://cdn.builder.io';
|
|
2138
2139
|
}
|
|
2139
2140
|
},
|
|
2140
|
-
enumerable:
|
|
2141
|
+
enumerable: false,
|
|
2141
2142
|
configurable: true
|
|
2142
2143
|
});
|
|
2143
2144
|
Builder.prototype.flushGetContentQueue = function (usePastQueue, useQueue) {
|
|
2144
2145
|
var _this = this;
|
|
2145
2146
|
if (usePastQueue === void 0) { usePastQueue = false; }
|
|
2146
2147
|
if (!this.apiKey) {
|
|
2147
|
-
throw new Error("Fetching content failed, expected apiKey to be defined instead got: "
|
|
2148
|
+
throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
|
|
2148
2149
|
}
|
|
2149
2150
|
if (!usePastQueue && !this.getContentQueue) {
|
|
2150
2151
|
return;
|
|
@@ -2178,7 +2179,7 @@ var Builder = /** @class */ (function () {
|
|
|
2178
2179
|
if (fullUrlQueueItem) {
|
|
2179
2180
|
var location_1 = this.getLocation();
|
|
2180
2181
|
if (location_1.origin) {
|
|
2181
|
-
queryParams.url = ""
|
|
2182
|
+
queryParams.url = "".concat(location_1.origin).concat(location_1.pathname).concat(location_1.search);
|
|
2182
2183
|
}
|
|
2183
2184
|
}
|
|
2184
2185
|
var urlQueueItem = useQueue === null || useQueue === void 0 ? void 0 : useQueue.find(function (item) { return item.url; });
|
|
@@ -2208,7 +2209,7 @@ var Builder = /** @class */ (function () {
|
|
|
2208
2209
|
if (size(this.overrides)) {
|
|
2209
2210
|
for (var key in this.overrides) {
|
|
2210
2211
|
if (this.overrides.hasOwnProperty(key)) {
|
|
2211
|
-
queryParams["overrides."
|
|
2212
|
+
queryParams["overrides.".concat(key)] = this.overrides[key];
|
|
2212
2213
|
}
|
|
2213
2214
|
}
|
|
2214
2215
|
}
|
|
@@ -2272,9 +2273,9 @@ var Builder = /** @class */ (function () {
|
|
|
2272
2273
|
var format = queryParams.format;
|
|
2273
2274
|
var requestOptions = { headers: {} };
|
|
2274
2275
|
if (this.authToken) {
|
|
2275
|
-
requestOptions.headers = __assign(__assign({}, requestOptions.headers), { Authorization: "Bearer "
|
|
2276
|
+
requestOptions.headers = __assign(__assign({}, requestOptions.headers), { Authorization: "Bearer ".concat(this.authToken) });
|
|
2276
2277
|
}
|
|
2277
|
-
var promise = this.requestUrl(host
|
|
2278
|
+
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) {
|
|
2278
2279
|
for (var _i = 0, queue_3 = queue; _i < queue_3.length; _i++) {
|
|
2279
2280
|
var options = queue_3[_i];
|
|
2280
2281
|
var keyName = options.key;
|
|
@@ -2362,7 +2363,7 @@ var Builder = /** @class */ (function () {
|
|
|
2362
2363
|
return mappedResults;
|
|
2363
2364
|
};
|
|
2364
2365
|
Builder.prototype.getTestCookie = function (contentId) {
|
|
2365
|
-
return this.getCookie(this.testCookiePrefix
|
|
2366
|
+
return this.getCookie("".concat(this.testCookiePrefix, ".").concat(contentId));
|
|
2366
2367
|
};
|
|
2367
2368
|
Builder.prototype.setTestCookie = function (contentId, variationId) {
|
|
2368
2369
|
if (!this.canTrack) {
|
|
@@ -2372,7 +2373,7 @@ var Builder = /** @class */ (function () {
|
|
|
2372
2373
|
// 30 days from now
|
|
2373
2374
|
var future = new Date();
|
|
2374
2375
|
future.setDate(future.getDate() + 30);
|
|
2375
|
-
return this.setCookie(this.testCookiePrefix
|
|
2376
|
+
return this.setCookie("".concat(this.testCookiePrefix, ".").concat(contentId), variationId, future);
|
|
2376
2377
|
};
|
|
2377
2378
|
Builder.prototype.getCookie = function (name$$1) {
|
|
2378
2379
|
if (this.cookies) {
|
|
@@ -2392,7 +2393,7 @@ var Builder = /** @class */ (function () {
|
|
|
2392
2393
|
Builder.prototype.getContent = function (modelName, options) {
|
|
2393
2394
|
if (options === void 0) { options = {}; }
|
|
2394
2395
|
if (!this.apiKey) {
|
|
2395
|
-
throw new Error("Fetching content from model "
|
|
2396
|
+
throw new Error("Fetching content from model ".concat(modelName, " failed, expected apiKey to be defined instead got: ").concat(this.apiKey));
|
|
2396
2397
|
}
|
|
2397
2398
|
return this.queueGetContent(modelName, options);
|
|
2398
2399
|
};
|
|
@@ -2413,10 +2414,14 @@ var Builder = /** @class */ (function () {
|
|
|
2413
2414
|
// Make the key include all options so we don't reuse cache for the same conent fetched
|
|
2414
2415
|
// with different options
|
|
2415
2416
|
Builder.isBrowser
|
|
2416
|
-
? modelName
|
|
2417
|
+
? "".concat(modelName, ":").concat(hash(omit(options, 'initialContent', 'req', 'res')))
|
|
2417
2418
|
: undefined }))
|
|
2418
2419
|
.promise();
|
|
2419
2420
|
};
|
|
2421
|
+
/**
|
|
2422
|
+
* @hidden
|
|
2423
|
+
* @deprecated. This is buggy, and always behind by a version.
|
|
2424
|
+
*/
|
|
2420
2425
|
Builder.VERSION = version;
|
|
2421
2426
|
Builder.components = [];
|
|
2422
2427
|
/**
|