@asgardeo/javascript 0.1.15 → 0.1.17

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.
@@ -81,6 +81,16 @@ export interface AsgardeoClient<T> {
81
81
  * @returns Promise resolving to boolean indicating success.
82
82
  */
83
83
  initialize(config: T, storage?: Storage): Promise<boolean>;
84
+ /**
85
+ * Re-initializes the client with a new configuration.
86
+ *
87
+ * @remarks
88
+ * This can be partial configuration to update only specific fields.
89
+ *
90
+ * @param config - New configuration to re-initialize the client with.
91
+ * @returns Promise resolving to boolean indicating success.
92
+ */
93
+ reInitialize(config: Partial<T>): Promise<boolean>;
84
94
  /**
85
95
  * Checks if the client is currently loading.
86
96
  * This can be used to determine if the client is in the process of initializing or fetching user data.
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ /**
19
+ * Enumeration of supported identity platforms.
20
+ *
21
+ * - `Asgardeo`: Represents the Asgardeo cloud identity platform (asgardeo.io domains).
22
+ * - `IdentityServer`: Represents WSO2 Identity Server (on-prem or custom domains).
23
+ * - `Unknown`: Used when the platform cannot be determined from the configuration.
24
+ *
25
+ * This enum is used to distinguish between different identity providers and to
26
+ * enable platform-specific logic throughout the SDK.
27
+ */
28
+ export declare enum Platform {
29
+ /** Asgardeo cloud identity platform (asgardeo.io domains) */
30
+ Asgardeo = "ASGARDEO",
31
+ /** WSO2 Identity Server (on-prem or custom domains) */
32
+ IdentityServer = "IDENTITY_SERVER",
33
+ /** Unknown or unsupported platform */
34
+ Unknown = "UNKNOWN"
35
+ }
@@ -31,7 +31,8 @@
31
31
  * specific language governing permissions and limitations
32
32
  * under the License.
33
33
  */
34
- import { Theme, ThemeConfig } from './types';
34
+ import { Theme, ThemeConfig, ThemeMode } from './types';
35
35
  import { RecursivePartial } from '../models/utility-types';
36
36
  declare const createTheme: (config?: RecursivePartial<ThemeConfig>, isDark?: boolean) => Theme;
37
+ export declare const DEFAULT_THEME: ThemeMode;
37
38
  export default createTheme;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { Config } from '../models/config';
19
+ /**
20
+ * Utility to generate the redirect-based sign-up URL for Asgardeo.
21
+ *
22
+ * If the baseUrl is recognized (standard Asgardeo pattern), constructs the sign-up URL.
23
+ * Otherwise, returns an empty string.
24
+ *
25
+ * @param baseUrl - The base URL of the Asgardeo identity server (string or undefined)
26
+ * @returns The sign-up URL if baseUrl is recognized, otherwise an empty string
27
+ */
28
+ declare const getRedirectBasedSignUpUrl: (config: Config) => string;
29
+ export default getRedirectBasedSignUpUrl;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { Config } from '../models/config';
19
+ import { Platform } from '../models/platforms';
20
+ /**
21
+ * Identifies the platform based on the given base URL.
22
+ *
23
+ * If the URL is recognized and matches the Asgardeo domain, returns Platform.Asgardeo.
24
+ * Otherwise, returns Platform.IdentityServer.
25
+ *
26
+ * @param baseUrl - The base URL to check
27
+ * @returns Platform enum value
28
+ */
29
+ declare const identifyPlatform: (config: Config) => Platform;
30
+ export default identifyPlatform;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ /**
19
+ * Utility to determine if sensible Asgardeo fallbacks can be used based on the given base URL.
20
+ *
21
+ * This checks if the URL follows the standard Asgardeo pattern: /t/{orgHandle}
22
+ * Returns true if sensible fallbacks (like deriving organization handle, tenant, etc.) can be used, false otherwise.
23
+ *
24
+ * @param baseUrl - The base URL of the Asgardeo identity server (string or undefined)
25
+ * @returns boolean - true if sensible fallbacks can be used, false otherwise
26
+ *
27
+ * @example
28
+ * isRecognizedBaseUrlPattern('https://dev.asgardeo.io/t/dxlab'); // true
29
+ * isRecognizedBaseUrlPattern('https://custom.example.com/auth'); // false
30
+ */
31
+ declare const isRecognizedBaseUrlPattern: (baseUrl: string | undefined) => boolean;
32
+ export default isRecognizedBaseUrlPattern;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgardeo/javascript",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Framework agnostic JavaScript SDK for Asgardeo.",
5
5
  "keywords": [
6
6
  "asgardeo",
@@ -34,7 +34,7 @@
34
34
  "directory": "packages/javascript"
35
35
  },
36
36
  "devDependencies": {
37
- "@types/node": "^22.15.3",
37
+ "@types/node": "^22.15.30",
38
38
  "@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?a1fc6eb570653c999828aea9f5027cba06af4391",
39
39
  "@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?a1fc6eb570653c999828aea9f5027cba06af4391",
40
40
  "esbuild": "^0.25.9",