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.
@@ -1317,15 +1317,35 @@ var BruceApi;
1317
1317
  api: guardian
1318
1318
  });
1319
1319
  if (host === null || host === void 0 ? void 0 : host.location) {
1320
+ const settings = host.location.Settings;
1320
1321
  // Attempt to load regional base url.
1321
- if (host.location.BruceAPIURL) {
1322
- const regionalUrl = host.location.BruceAPIURL.replace("<ACCOUNT>", this.accountId).replace("<DOMAIN>", domain);
1322
+ // First try go through settings.
1323
+ let urlSet = false;
1324
+ if (settings === null || settings === void 0 ? void 0 : settings.BruceAPIURL) {
1325
+ let envUrl = settings.BruceAPIURL[env];
1326
+ if (envUrl) {
1327
+ envUrl = envUrl
1328
+ .replace("<ACCOUNTID>", this.accountId)
1329
+ .replace("<ACCOUNT>", this.accountId);
1330
+ if (envUrl && envUrl.length > 1) {
1331
+ this.baseUrl = envUrl;
1332
+ urlSet = true;
1333
+ }
1334
+ }
1335
+ }
1336
+ // Try go through host location's base url.
1337
+ // This may be wrong env which is why it's used as fallback right now.
1338
+ if (!urlSet && host.location.BruceAPIURL) {
1339
+ const regionalUrl = host.location.BruceAPIURL
1340
+ .replace("<ACCOUNTID>", this.accountId)
1341
+ .replace("<ACCOUNT>", this.accountId)
1342
+ .replace("<DOMAIN>", domain);
1323
1343
  if (regionalUrl && regionalUrl.length > 1) {
1324
1344
  this.baseUrl = regionalUrl;
1345
+ urlSet = true;
1325
1346
  }
1326
1347
  }
1327
1348
  // Attempt to load CDN settings.
1328
- const settings = host.location.Settings;
1329
1349
  if (settings === null || settings === void 0 ? void 0 : settings.CDN) {
1330
1350
  this.EntityCdnUrl = (_a = settings.CDN.entityURL) === null || _a === void 0 ? void 0 : _a[env];
1331
1351
  // We need to fix our configs.