@leapdev/auth-agent 2.5.0 → 2.5.1-beta.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leapdev/auth-agent",
3
- "version": "2.5.0",
3
+ "version": "2.5.1-beta.0",
4
4
  "description": "LEAP Auth Agent",
5
5
  "license": "LEAP Legal Software, PTY LTD",
6
6
  "main": "./src/index.js",
package/src/index.umd.js CHANGED
@@ -6721,9 +6721,18 @@
6721
6721
  let redirection;
6722
6722
  let redirectUrl;
6723
6723
  const topLevelDomains = redirectionConfig.topLevelDomains;
6724
- const redirections = redirectionConfig.environments;
6725
- const suffix = topLevelDomains.find(suffix => origin.endsWith(suffix));
6726
- const environmentVariables = redirectionConfig.environmentVariables;
6724
+ const topLevelDomainsV2 = redirectionConfig.topLevelDomains_v2;
6725
+ let suffix;
6726
+ let redirections = redirectionConfig.environments;
6727
+ let environmentVariables;
6728
+ suffix = topLevelDomainsV2.find(s => origin.endsWith(s));
6729
+ if (suffix) {
6730
+ redirections = redirectionConfig.environments_v2;
6731
+ environmentVariables = {};
6732
+ } else {
6733
+ suffix = topLevelDomains.find(s => origin.endsWith(s));
6734
+ environmentVariables = redirectionConfig.environmentVariables;
6735
+ }
6727
6736
  if (suffix) {
6728
6737
  for (let i = 0; i < redirections.length; i++) {
6729
6738
  redirection = redirections[i];
@@ -3,9 +3,19 @@ export const getRedirectUri = (origin, decodedToken, redirectionConfig) => {
3
3
  let redirection;
4
4
  let redirectUrl;
5
5
  const topLevelDomains = redirectionConfig.topLevelDomains;
6
- const redirections = redirectionConfig.environments;
7
- const suffix = topLevelDomains.find((suffix) => origin.endsWith(suffix));
8
- const environmentVariables = redirectionConfig.environmentVariables;
6
+ const topLevelDomainsV2 = redirectionConfig.topLevelDomains_v2;
7
+ let suffix;
8
+ let redirections = redirectionConfig.environments;
9
+ let environmentVariables;
10
+ suffix = topLevelDomainsV2.find((s) => origin.endsWith(s));
11
+ if (suffix) {
12
+ redirections = redirectionConfig.environments_v2;
13
+ environmentVariables = {};
14
+ }
15
+ else {
16
+ suffix = topLevelDomains.find((s) => origin.endsWith(s));
17
+ environmentVariables = redirectionConfig.environmentVariables;
18
+ }
9
19
  if (suffix) {
10
20
  for (let i = 0; i < redirections.length; i++) {
11
21
  redirection = redirections[i];
@@ -75,10 +75,22 @@ export declare type LeapToken = {
75
75
  };
76
76
  export declare type Redirections = {
77
77
  topLevelDomains: Array<string>;
78
+ topLevelDomains_v2: Array<string>;
78
79
  environments: Array<{
79
80
  criteria: {
80
81
  region: string;
81
82
  environment: 'test' | 'live' | 'liveb';
83
+ countryCode: number;
84
+ };
85
+ topLevelDomain: string;
86
+ authHost: string;
87
+ applications: Array<string>;
88
+ }>;
89
+ environments_v2: Array<{
90
+ criteria: {
91
+ region: string;
92
+ environment: 'test' | 'live' | 'liveb';
93
+ countryCode: number;
82
94
  };
83
95
  topLevelDomain: string;
84
96
  authHost: string;