@agility/content-fetch 2.0.9 → 2.0.10

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/dist/browser.js CHANGED
@@ -493,20 +493,24 @@
493
493
  }
494
494
  };
495
495
  function buildBaseUrl(guid) {
496
- let baseUrlSuffixes = {
496
+ const baseUrlSuffixes = {
497
497
  u: "",
498
498
  c: "-ca",
499
499
  e: "-eu",
500
500
  a: "-aus",
501
- d: "-dev"
501
+ d: "-dev",
502
+ us2: "-usa2"
502
503
  };
503
- let suffix = guid.substr(guid.length - 2, 2);
504
- let env = suffix.substr(1);
505
- if (suffix.startsWith("-") && baseUrlSuffixes.hasOwnProperty(env)) {
506
- return `https://api${baseUrlSuffixes[env]}.aglty.io/${guid}`;
507
- } else {
508
- return `https://${guid}-api.agilitycms.cloud`;
504
+ const match = guid.match(/-(us2|[ucead])$/);
505
+ if (match) {
506
+ const env = match[1];
507
+ if (baseUrlSuffixes.hasOwnProperty(env)) {
508
+ const url = `https://api${baseUrlSuffixes[env]}.aglty.io/${guid}`;
509
+ return url;
510
+ }
509
511
  }
512
+ const legacyUrl = `https://${guid}-api.agilitycms.cloud`;
513
+ return legacyUrl;
510
514
  }
511
515
  function validateConfigParams(configParams) {
512
516
  if (!configParams.guid || configParams.guid.length == 0) {
package/dist/node.js CHANGED
@@ -511,20 +511,24 @@ var defaultConfig = {
511
511
  }
512
512
  };
513
513
  function buildBaseUrl(guid) {
514
- let baseUrlSuffixes = {
514
+ const baseUrlSuffixes = {
515
515
  u: "",
516
516
  c: "-ca",
517
517
  e: "-eu",
518
518
  a: "-aus",
519
- d: "-dev"
519
+ d: "-dev",
520
+ us2: "-usa2"
520
521
  };
521
- let suffix = guid.substr(guid.length - 2, 2);
522
- let env = suffix.substr(1);
523
- if (suffix.startsWith("-") && baseUrlSuffixes.hasOwnProperty(env)) {
524
- return `https://api${baseUrlSuffixes[env]}.aglty.io/${guid}`;
525
- } else {
526
- return `https://${guid}-api.agilitycms.cloud`;
522
+ const match = guid.match(/-(us2|[ucead])$/);
523
+ if (match) {
524
+ const env = match[1];
525
+ if (baseUrlSuffixes.hasOwnProperty(env)) {
526
+ const url = `https://api${baseUrlSuffixes[env]}.aglty.io/${guid}`;
527
+ return url;
528
+ }
527
529
  }
530
+ const legacyUrl = `https://${guid}-api.agilitycms.cloud`;
531
+ return legacyUrl;
528
532
  }
529
533
  function validateConfigParams(configParams) {
530
534
  if (!configParams.guid || configParams.guid.length == 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/content-fetch",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "JS/TS library for the Agility Fetch API",
5
5
  "repository": {
6
6
  "type": "git",