bruce-models 2.3.1 → 2.3.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.
@@ -1294,15 +1294,35 @@
1294
1294
  api: guardian
1295
1295
  });
1296
1296
  if (host === null || host === void 0 ? void 0 : host.location) {
1297
+ const settings = host.location.Settings;
1297
1298
  // Attempt to load regional base url.
1298
- if (host.location.BruceAPIURL) {
1299
- const regionalUrl = host.location.BruceAPIURL.replace("<ACCOUNT>", this.accountId).replace("<DOMAIN>", domain);
1299
+ // First try go through settings.
1300
+ let urlSet = false;
1301
+ if (settings === null || settings === void 0 ? void 0 : settings.BruceAPIURL) {
1302
+ let envUrl = settings.BruceAPIURL[env];
1303
+ if (envUrl) {
1304
+ envUrl = envUrl
1305
+ .replace("<ACCOUNTID>", this.accountId)
1306
+ .replace("<ACCOUNT>", this.accountId);
1307
+ if (envUrl && envUrl.length > 1) {
1308
+ this.baseUrl = envUrl;
1309
+ urlSet = true;
1310
+ }
1311
+ }
1312
+ }
1313
+ // Try go through host location's base url.
1314
+ // This may be wrong env which is why it's used as fallback right now.
1315
+ if (!urlSet && host.location.BruceAPIURL) {
1316
+ const regionalUrl = host.location.BruceAPIURL
1317
+ .replace("<ACCOUNTID>", this.accountId)
1318
+ .replace("<ACCOUNT>", this.accountId)
1319
+ .replace("<DOMAIN>", domain);
1300
1320
  if (regionalUrl && regionalUrl.length > 1) {
1301
1321
  this.baseUrl = regionalUrl;
1322
+ urlSet = true;
1302
1323
  }
1303
1324
  }
1304
1325
  // Attempt to load CDN settings.
1305
- const settings = host.location.Settings;
1306
1326
  if (settings === null || settings === void 0 ? void 0 : settings.CDN) {
1307
1327
  this.EntityCdnUrl = (_a = settings.CDN.entityURL) === null || _a === void 0 ? void 0 : _a[env];
1308
1328
  // We need to fix our configs.