@asgardeo/vue 0.0.10 → 0.1.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.
Files changed (157) hide show
  1. package/README.md +136 -1
  2. package/dist/AsgardeoVueClient.d.ts +64 -0
  3. package/dist/__temp__/api.d.ts +63 -0
  4. package/dist/__temp__/models.d.ts +43 -0
  5. package/dist/api/getAllOrganizations.d.ts +24 -0
  6. package/dist/api/getMeOrganizations.d.ts +24 -0
  7. package/dist/api/getSchemas.d.ts +24 -0
  8. package/dist/api/getScim2Me.d.ts +24 -0
  9. package/dist/cjs/index.js +10849 -1578
  10. package/dist/cjs/index.js.map +7 -1
  11. package/dist/components/actions/BaseSignInButton.d.ts +34 -0
  12. package/dist/components/actions/BaseSignOutButton.d.ts +34 -0
  13. package/dist/components/actions/BaseSignUpButton.d.ts +34 -0
  14. package/dist/components/actions/SignInButton.d.ts +26 -0
  15. package/dist/components/actions/SignOutButton.d.ts +23 -0
  16. package/dist/components/actions/SignUpButton.d.ts +26 -0
  17. package/dist/{cjs/types/vitest.config.d.ts → components/adapters/FacebookButton.d.ts} +7 -2
  18. package/dist/components/adapters/GitHubButton.d.ts +24 -0
  19. package/dist/components/adapters/GoogleButton.d.ts +24 -0
  20. package/dist/components/adapters/MicrosoftButton.d.ts +24 -0
  21. package/dist/components/auth/Callback.d.ts +31 -0
  22. package/dist/components/control/Loading.d.ts +33 -0
  23. package/dist/components/control/SignedIn.d.ts +33 -0
  24. package/dist/components/control/SignedOut.d.ts +33 -0
  25. package/dist/components/control/organization/Organization.d.ts +38 -0
  26. package/dist/components/control/user/User.d.ts +38 -0
  27. package/dist/components/factories/FieldFactory.d.ts +51 -0
  28. package/dist/components/presentation/accept-invite/AcceptInvite.d.ts +28 -0
  29. package/dist/components/presentation/accept-invite/BaseAcceptInvite.d.ts +82 -0
  30. package/dist/{esm/types/composables/useAsgardeo.d.ts → components/presentation/create-organization/BaseCreateOrganization.d.ts} +5 -4
  31. package/dist/components/presentation/create-organization/CreateOrganization.css.d.ts +34 -0
  32. package/dist/components/presentation/create-organization/CreateOrganization.d.ts +25 -0
  33. package/dist/components/presentation/invite-user/BaseInviteUser.d.ts +80 -0
  34. package/dist/components/presentation/invite-user/InviteUser.d.ts +25 -0
  35. package/dist/components/presentation/language-switcher/BaseLanguageSwitcher.d.ts +25 -0
  36. package/dist/components/presentation/language-switcher/LanguageSwitcher.css.d.ts +36 -0
  37. package/dist/components/presentation/language-switcher/LanguageSwitcher.d.ts +25 -0
  38. package/dist/components/presentation/organization-list/BaseOrganizationList.d.ts +23 -0
  39. package/dist/components/presentation/organization-list/OrganizationList.css.d.ts +32 -0
  40. package/dist/{cjs/types/composables/useAsgardeo.d.ts → components/presentation/organization-list/OrganizationList.d.ts} +5 -4
  41. package/dist/{cjs/types/composables/useAsgardeoContext.d.ts → components/presentation/organization-profile/BaseOrganizationProfile.d.ts} +6 -5
  42. package/dist/components/presentation/organization-profile/OrganizationProfile.css.d.ts +24 -0
  43. package/dist/components/presentation/organization-profile/OrganizationProfile.d.ts +25 -0
  44. package/dist/components/presentation/organization-switcher/BaseOrganizationSwitcher.d.ts +25 -0
  45. package/dist/components/presentation/organization-switcher/OrganizationSwitcher.css.d.ts +39 -0
  46. package/dist/components/presentation/organization-switcher/OrganizationSwitcher.d.ts +25 -0
  47. package/dist/components/presentation/sign-in/AuthOptionFactory.d.ts +18 -0
  48. package/dist/components/presentation/sign-in/AuthOptionFactoryCore.d.ts +68 -0
  49. package/dist/components/presentation/sign-in/BaseSignIn.d.ts +27 -0
  50. package/dist/components/presentation/sign-in/SignIn.d.ts +27 -0
  51. package/dist/components/presentation/sign-in/v1/BaseSignIn.d.ts +26 -0
  52. package/dist/components/presentation/sign-in/v1/SignIn.d.ts +26 -0
  53. package/dist/components/presentation/sign-in/v1/options/SignInOptionFactory.d.ts +46 -0
  54. package/dist/components/presentation/sign-in/v2/AuthOptionFactory.d.ts +18 -0
  55. package/dist/components/presentation/sign-in/v2/BaseSignIn.d.ts +82 -0
  56. package/dist/components/presentation/sign-in/v2/SignIn.d.ts +55 -0
  57. package/dist/components/presentation/sign-up/BaseSignUp.d.ts +72 -0
  58. package/dist/components/presentation/sign-up/SignUp.d.ts +25 -0
  59. package/dist/components/presentation/user-dropdown/BaseUserDropdown.d.ts +33 -0
  60. package/dist/components/presentation/user-dropdown/UserDropdown.css.d.ts +35 -0
  61. package/dist/components/presentation/user-dropdown/UserDropdown.d.ts +25 -0
  62. package/dist/components/presentation/user-profile/BaseUserProfile.d.ts +47 -0
  63. package/dist/components/presentation/user-profile/UserProfile.css.d.ts +24 -0
  64. package/dist/{esm/types/public-api.d.ts → components/presentation/user-profile/UserProfile.d.ts} +3 -2
  65. package/dist/components/primitives/Alert/Alert.css.d.ts +30 -0
  66. package/dist/{cjs/types/public-api.d.ts → components/primitives/Alert/Alert.d.ts} +3 -2
  67. package/dist/components/primitives/Alert/index.d.ts +18 -0
  68. package/dist/components/primitives/Button/Button.css.d.ts +36 -0
  69. package/dist/components/primitives/Button/Button.d.ts +20 -0
  70. package/dist/components/primitives/Button/index.d.ts +18 -0
  71. package/dist/components/primitives/Card/Card.css.d.ts +29 -0
  72. package/dist/{esm/types/index.d.ts → components/primitives/Card/Card.d.ts} +3 -3
  73. package/dist/components/primitives/Card/index.d.ts +18 -0
  74. package/dist/components/primitives/Checkbox/Checkbox.css.d.ts +30 -0
  75. package/dist/components/primitives/Checkbox/Checkbox.d.ts +20 -0
  76. package/dist/components/primitives/Checkbox/index.d.ts +18 -0
  77. package/dist/components/primitives/DatePicker/DatePicker.css.d.ts +30 -0
  78. package/dist/components/primitives/DatePicker/DatePicker.d.ts +20 -0
  79. package/dist/components/primitives/DatePicker/index.d.ts +18 -0
  80. package/dist/components/primitives/Divider/Divider.css.d.ts +32 -0
  81. package/dist/components/primitives/Divider/Divider.d.ts +20 -0
  82. package/dist/components/primitives/Divider/index.d.ts +18 -0
  83. package/dist/components/primitives/Icons.d.ts +34 -0
  84. package/dist/components/primitives/Logo/Logo.css.d.ts +27 -0
  85. package/dist/{cjs/types/index.d.ts → components/primitives/Logo/Logo.d.ts} +3 -3
  86. package/dist/components/primitives/Logo/index.d.ts +18 -0
  87. package/dist/{cjs/types/plugins/AsgardeoPlugin.d.ts → components/primitives/OtpField/OtpField.css.d.ts} +10 -5
  88. package/dist/components/primitives/OtpField/OtpField.d.ts +20 -0
  89. package/dist/components/primitives/OtpField/index.d.ts +18 -0
  90. package/dist/components/primitives/PasswordField/PasswordField.css.d.ts +30 -0
  91. package/dist/components/primitives/PasswordField/PasswordField.d.ts +20 -0
  92. package/dist/components/primitives/PasswordField/index.d.ts +18 -0
  93. package/dist/components/primitives/Select/Select.css.d.ts +30 -0
  94. package/dist/components/primitives/Select/Select.d.ts +25 -0
  95. package/dist/components/primitives/Select/index.d.ts +18 -0
  96. package/dist/{esm/types/composables/useAsgardeoContext.d.ts → components/primitives/Spinner/Spinner.css.d.ts} +13 -5
  97. package/dist/components/primitives/Spinner/Spinner.d.ts +20 -0
  98. package/dist/components/primitives/Spinner/index.d.ts +18 -0
  99. package/dist/components/primitives/TextField/TextField.css.d.ts +30 -0
  100. package/dist/components/primitives/TextField/TextField.d.ts +20 -0
  101. package/dist/components/primitives/TextField/index.d.ts +18 -0
  102. package/dist/components/primitives/Typography/Typography.css.d.ts +30 -0
  103. package/dist/components/primitives/Typography/Typography.d.ts +20 -0
  104. package/dist/components/primitives/Typography/index.d.ts +18 -0
  105. package/dist/composables/useAsgardeo.d.ts +48 -0
  106. package/dist/composables/useBranding.d.ts +43 -0
  107. package/dist/composables/useFlow.d.ts +45 -0
  108. package/dist/composables/useFlowMeta.d.ts +41 -0
  109. package/dist/composables/useI18n.d.ts +45 -0
  110. package/dist/composables/useOAuthCallback.d.ts +65 -0
  111. package/dist/composables/useOrganization.d.ts +41 -0
  112. package/dist/composables/useTheme.d.ts +43 -0
  113. package/dist/composables/useUser.d.ts +44 -0
  114. package/dist/index.d.ts +103 -141
  115. package/dist/index.js +11073 -0
  116. package/dist/index.js.map +7 -0
  117. package/dist/keys.d.ts +51 -0
  118. package/dist/models/config.d.ts +19 -0
  119. package/dist/models/contexts.d.ts +244 -0
  120. package/dist/{esm/types/plugins → plugins}/AsgardeoPlugin.d.ts +28 -4
  121. package/dist/providers/AsgardeoProvider.d.ts +35 -0
  122. package/dist/providers/BrandingProvider.d.ts +29 -0
  123. package/dist/providers/FlowMetaProvider.d.ts +20 -0
  124. package/dist/providers/FlowProvider.d.ts +20 -0
  125. package/dist/providers/I18nProvider.d.ts +20 -0
  126. package/dist/providers/OrganizationProvider.d.ts +20 -0
  127. package/dist/providers/ThemeProvider.d.ts +20 -0
  128. package/dist/providers/UserProvider.d.ts +20 -0
  129. package/dist/router/callbackRoute.d.ts +87 -0
  130. package/dist/router/guard.d.ts +96 -0
  131. package/dist/styles/animations.css.d.ts +28 -0
  132. package/dist/styles/defaults.css.d.ts +31 -0
  133. package/dist/styles/injectStyles.d.ts +23 -0
  134. package/dist/theme/getActiveTheme.d.ts +28 -0
  135. package/dist/theme/themeDetection.d.ts +30 -0
  136. package/dist/utils/handleWebAuthnAuthentication.d.ts +27 -0
  137. package/dist/utils/hasAuthParamsInUrl.d.ts +26 -0
  138. package/dist/utils/http.d.ts +26 -0
  139. package/dist/utils/logger.d.ts +30 -0
  140. package/dist/utils/navigate.d.ts +27 -0
  141. package/dist/utils/oauth.d.ts +24 -0
  142. package/dist/utils/v2/buildThemeConfigFromFlowMeta.d.ts +28 -0
  143. package/dist/utils/v2/flowTransformer.d.ts +96 -0
  144. package/dist/utils/v2/getAuthComponentHeadings.d.ts +40 -0
  145. package/dist/utils/v2/passkey.d.ts +31 -0
  146. package/dist/utils/v2/resolveTranslationsInArray.d.ts +29 -0
  147. package/dist/utils/v2/resolveTranslationsInObject.d.ts +29 -0
  148. package/package.json +54 -68
  149. package/dist/cjs/types/auth-api.d.ts +0 -237
  150. package/dist/cjs/types/tests/mocks/mocks.d.ts +0 -57
  151. package/dist/cjs/types/types.d.ts +0 -107
  152. package/dist/esm/index.js +0 -1600
  153. package/dist/esm/index.js.map +0 -1
  154. package/dist/esm/types/auth-api.d.ts +0 -237
  155. package/dist/esm/types/tests/mocks/mocks.d.ts +0 -57
  156. package/dist/esm/types/types.d.ts +0 -107
  157. package/dist/esm/types/vitest.config.d.ts +0 -19
package/README.md CHANGED
@@ -8,6 +8,141 @@
8
8
  <a href="./LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License"></a>
9
9
  </div>
10
10
 
11
+ ## Overview
12
+
13
+ The Asgardeo Vue SDK provides a streamlined way to integrate secure authentication and user management into your Vue.js applications. Built for Vue 3, it offers a comprehensive set of composables, components, and utilities to handle authentication flows, user profiles, and multi-tenancy features.
14
+
15
+ ## Key Features
16
+
17
+ - **Easy Integration**: Simple setup with the `AsgardeoPlugin` and provider components
18
+ - **Composable API**: Vue 3 composables for reactive authentication state management
19
+ - **Pre-built Components**: Ready-to-use components for sign-in, sign-up, user profiles, and more
20
+ - **Multi-Tenancy Support**: Built-in organization/workspace management capabilities
21
+ - **Customizable UI**: Primitive components and styling options for seamless integration
22
+ - **International Support**: Multi-language support with easy localization
23
+ - **Type-Safe**: Full TypeScript support for better developer experience
24
+
25
+ ## Quick Start
26
+
27
+ Get started with Asgardeo in your Vue application in minutes. Follow our [Vue Quick Start Guide](./QUICKSTART.md) for step-by-step instructions on integrating authentication into your app.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ # Using npm
33
+ npm install @asgardeo/vue
34
+
35
+ # Using pnpm
36
+ pnpm add @asgardeo/vue
37
+
38
+ # Using yarn
39
+ yarn add @asgardeo/vue
40
+ ```
41
+
42
+ ## Basic Usage
43
+
44
+ ```vue
45
+ <script setup lang="ts">
46
+ import { useUser } from '@asgardeo/vue'
47
+
48
+ const { user, isLoading } = useUser()
49
+ </script>
50
+
51
+ <template>
52
+ <div>
53
+ <p v-if="isLoading">Loading...</p>
54
+ <p v-else-if="user">Welcome, {{ user.username }}</p>
55
+ <p v-else>Not signed in</p>
56
+ </div>
57
+ </template>
58
+ ```
59
+
60
+ ## API Documentation
61
+
62
+ For complete API documentation including all components, composables, and customization options, see the [Vue SDK Documentation](https://wso2.com/asgardeo/docs/sdks/vue/overview).
63
+
64
+ ## Supported Features
65
+
66
+ ### Composables
67
+ - `useAsgardeo()` - Main SDK client access
68
+ - `useUser()` - User profile and authentication state
69
+ - `useOrganization()` - Organization/workspace management
70
+ - `useI18n()` - Internationalization
71
+ - `useTheme()` - Theme customization
72
+ - `useBranding()` - Branding customization
73
+ - `useFlow()` - Authentication flow control
74
+ - `useFlowMeta()` - Flow metadata access
75
+
76
+ ### Components
77
+
78
+ #### Control
79
+ - `SignedIn` - Renders children only when user is authenticated
80
+ - `SignedOut` - Renders children only when user is not authenticated
81
+ - `Loading` - Renders children while authentication state is loading
82
+ - `UserComponent` - Access user information with scoped slot pattern
83
+ - `OrganizationComponent` - Access organization context with scoped slot pattern
84
+
85
+ #### Actions
86
+ - `SignInButton` / `BaseSignInButton` - Sign-in button (styled and unstyled)
87
+ - `SignOutButton` / `BaseSignOutButton` - Sign-out button (styled and unstyled)
88
+ - `SignUpButton` / `BaseSignUpButton` - Sign-up button (styled and unstyled)
89
+
90
+ #### Presentation
91
+ - `SignIn` / `BaseSignIn` - Embedded sign-in form
92
+ - `SignUp` / `BaseSignUp` - Embedded sign-up form
93
+ - `UserProfileComponent` / `BaseUserProfile` - User profile display
94
+ - `UserDropdown` / `BaseUserDropdown` - User menu dropdown
95
+ - `OrganizationList` / `BaseOrganizationList` - Organization listing
96
+ - `OrganizationSwitcher` / `BaseOrganizationSwitcher` - Organization switcher
97
+ - `OrganizationProfile` / `BaseOrganizationProfile` - Organization profile
98
+ - `CreateOrganization` / `BaseCreateOrganization` - Organization creation form
99
+ - `AcceptInvite` / `BaseAcceptInvite` - Invitation acceptance
100
+ - `InviteUser` / `BaseInviteUser` - User invitation form
101
+ - `LanguageSwitcher` / `BaseLanguageSwitcher` - Language selection
102
+
103
+ #### Auth Flow
104
+ - `Callback` - Handle OAuth callback redirect
105
+
106
+ #### Social Login Adapters
107
+ - `GoogleButton` - Sign in with Google
108
+ - `FacebookButton` - Sign in with Facebook
109
+ - `GitHubButton` - Sign in with GitHub
110
+ - `MicrosoftButton` - Sign in with Microsoft
111
+
112
+ #### Primitives
113
+ - `Button`, `Card`, `Alert`, `TextField`, `PasswordField`, `Select`, `Checkbox`, `DatePicker`, `OtpField`, `Typography`, `Divider`, `Logo`, `Spinner`
114
+
115
+ ### Utilities
116
+ - `createAsgardeoGuard` - Vue Router navigation guard for protected routes
117
+ - `createCallbackRoute` - Generate a callback route record for Vue Router
118
+ - `handleWebAuthnAuthentication` - WebAuthn/passkey support
119
+ - `hasAuthParamsInUrl` - Detect OAuth parameters in URL
120
+ - `navigate` - Programmatic navigation helper
121
+ - `http` - HTTP client with token management
122
+
123
+ ## Examples
124
+
125
+ Check out our [example applications](../../samples/) to see the Vue SDK in action:
126
+ - [Vue SDK Playground](../../samples/vue-sdk-playground/) - Example application
127
+
128
+ ## Documentation
129
+
130
+ - [Getting Started](https://wso2.com/asgardeo/docs/get-started/)
131
+ - [Vue SDK Guide](https://wso2.com/asgardeo/docs/sdks/vue/)
132
+ - [Configuration Options](https://wso2.com/asgardeo/docs/sdks/vue/configuration/)
133
+ - [Composables & Components](https://wso2.com/asgardeo/docs/sdks/vue/api/)
134
+
135
+ ## Support
136
+
137
+ For support and questions:
138
+ - [Asgardeo Documentation](https://wso2.com/asgardeo/docs/)
139
+ - [GitHub Issues](https://github.com/asgardeo/asgardeo-auth-vue-sdk/issues)
140
+ - [WSO2 Community Forum](https://wso2.com/community/)
141
+
142
+ ## Contributing
143
+
144
+ We welcome contributions! Please see our [Contributing Guidelines](./CONTRIBUTING.md) for more details.
145
+
11
146
  ## License
12
147
 
13
- Licenses this source under the Apache License, Version 2.0 [LICENSE](./LICENSE), You may not use this file except in compliance with the License.
148
+ Licenses this source under the Apache License, Version 2.0 [LICENSE](./LICENSE), You may not use this file except in compliance with the License.
@@ -0,0 +1,64 @@
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
+ import { AsgardeoBrowserClient, UserProfile, SignInOptions, SignOutOptions, User, EmbeddedFlowExecuteResponse, SignUpOptions, EmbeddedFlowExecuteRequestPayload, EmbeddedSignInFlowHandleRequestPayload, Organization, IdToken, EmbeddedFlowExecuteRequestConfig, AllOrganizationsApiResponse, TokenResponse, HttpRequestConfig, HttpResponse, TokenExchangeRequestConfig } from '@asgardeo/browser';
19
+ import { AsgardeoVueConfig } from './models/config';
20
+ /**
21
+ * Client for implementing Asgardeo in Vue applications.
22
+ * This class provides the core functionality for managing user authentication and sessions.
23
+ *
24
+ * @typeParam T - Configuration type that extends AsgardeoVueConfig.
25
+ */
26
+ declare class AsgardeoVueClient<T extends AsgardeoVueConfig = AsgardeoVueConfig> extends AsgardeoBrowserClient<T> {
27
+ private asgardeo;
28
+ private loadingState;
29
+ private clientInstanceId;
30
+ constructor(instanceId?: number);
31
+ getInstanceId(): number;
32
+ private setLoading;
33
+ private withLoading;
34
+ initialize(config: AsgardeoVueConfig): Promise<boolean>;
35
+ reInitialize(config: Partial<AsgardeoVueConfig>): Promise<boolean>;
36
+ updateUserProfile(): Promise<User>;
37
+ getUser(options?: any): Promise<User>;
38
+ getDecodedIdToken(sessionId?: string): Promise<IdToken>;
39
+ getIdToken(): Promise<string>;
40
+ getUserProfile(options?: any): Promise<UserProfile>;
41
+ getMyOrganizations(options?: any): Promise<Organization[]>;
42
+ getAllOrganizations(options?: any): Promise<AllOrganizationsApiResponse>;
43
+ getCurrentOrganization(): Promise<Organization | null>;
44
+ switchOrganization(organization: Organization): Promise<TokenResponse | Response>;
45
+ isLoading(): boolean;
46
+ isInitialized(): Promise<boolean>;
47
+ isSignedIn(): Promise<boolean>;
48
+ getConfiguration(): T;
49
+ exchangeToken(config: TokenExchangeRequestConfig): Promise<TokenResponse | Response>;
50
+ signIn(options?: SignInOptions, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
51
+ signIn(payload: EmbeddedSignInFlowHandleRequestPayload, request: EmbeddedFlowExecuteRequestConfig, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
52
+ signInSilently(options?: SignInOptions): Promise<User | boolean>;
53
+ signOut(options?: SignOutOptions, afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;
54
+ signOut(options?: SignOutOptions, sessionId?: string, afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;
55
+ signUp(options?: SignUpOptions): Promise<void>;
56
+ signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
57
+ request(requestConfig?: HttpRequestConfig): Promise<HttpResponse<any>>;
58
+ requestAll(requestConfigs?: HttpRequestConfig[]): Promise<HttpResponse<any>[]>;
59
+ getAccessToken(sessionId?: string): Promise<string>;
60
+ clearSession(sessionId?: string): void;
61
+ setSession(sessionData: Record<string, unknown>, sessionId?: string): Promise<void>;
62
+ decodeJwtToken<TResult = Record<string, unknown>>(token: string): Promise<TResult>;
63
+ }
64
+ export default AsgardeoVueClient;
@@ -0,0 +1,63 @@
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
+ import { AsgardeoSPAClient, AuthClientConfig, User, LegacyConfig as Config, IdToken, Hooks, HttpClientInstance, HttpRequestConfig, HttpResponse, OIDCEndpoints, SignInConfig, SPACustomGrantConfig } from '@asgardeo/browser';
19
+ import { AuthStateInterface } from './models';
20
+ declare class AuthAPI {
21
+ static DEFAULT_STATE: AuthStateInterface;
22
+ private authState;
23
+ private client;
24
+ private apiInstanceId;
25
+ private loadingState;
26
+ constructor(spaClient?: AsgardeoSPAClient, instanceId?: number);
27
+ getInstanceId(): number;
28
+ setLoadingState(isLoading: boolean): void;
29
+ getLoadingState(): boolean;
30
+ isLoading(): boolean;
31
+ getState(): AuthStateInterface;
32
+ init(config: AuthClientConfig<Config>): Promise<boolean>;
33
+ getConfigData(): Promise<AuthClientConfig<Config>>;
34
+ getStorageManager(): Promise<any>;
35
+ isInitialized(): Promise<boolean>;
36
+ signIn(config: SignInConfig, authorizationCode?: string, sessionState?: string, authState?: string, callback?: (response: User) => void, tokenRequestConfig?: {
37
+ params: Record<string, unknown>;
38
+ }): Promise<any>;
39
+ signOut(callback?: (response?: boolean) => void): Promise<boolean>;
40
+ updateState(state: AuthStateInterface): void;
41
+ getUser(): Promise<User>;
42
+ httpRequest(config: HttpRequestConfig): Promise<HttpResponse<any>>;
43
+ httpRequestAll(configs: HttpRequestConfig[]): Promise<HttpResponse<any>[]>;
44
+ exchangeToken(config: SPACustomGrantConfig, callback: (response: User | Response) => void): Promise<User | Response>;
45
+ getOpenIDProviderEndpoints(): Promise<OIDCEndpoints>;
46
+ getHttpClient(): Promise<HttpClientInstance>;
47
+ decodeJwtToken<T = Record<string, unknown>>(token: string): Promise<T>;
48
+ getDecodedIdToken(sessionId?: string): Promise<IdToken>;
49
+ getIdToken(): Promise<string>;
50
+ getAccessToken(sessionId?: string): Promise<string>;
51
+ refreshAccessToken(): Promise<User>;
52
+ isSignedIn(): Promise<boolean>;
53
+ enableHttpHandler(): Promise<boolean>;
54
+ disableHttpHandler(): Promise<boolean>;
55
+ reInitialize(config: Partial<AuthClientConfig<Config>>): Promise<void>;
56
+ on(hook: Hooks.CustomGrant, callback: (response?: any) => void, id: string): Promise<void>;
57
+ on(hook: Exclude<Hooks, Hooks.CustomGrant>, callback: (response?: any) => void): Promise<void>;
58
+ signInSilently(additionalParams?: Record<string, string | boolean>, tokenRequestConfig?: {
59
+ params: Record<string, unknown>;
60
+ }): Promise<User | boolean | undefined>;
61
+ clearSession(sessionId?: string): void;
62
+ }
63
+ export default AuthAPI;
@@ -0,0 +1,43 @@
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
+ * Interface for the Authenticated state of the user which is exposed
20
+ * via `state` object from the auth context.
21
+ */
22
+ export interface AuthStateInterface {
23
+ /**
24
+ * The display name of the user.
25
+ */
26
+ displayName?: string;
27
+ /**
28
+ * The email address of the user.
29
+ */
30
+ email?: string;
31
+ /**
32
+ * Are the Auth requests loading.
33
+ */
34
+ isLoading: boolean;
35
+ /**
36
+ * Specifies if the user is authenticated or not.
37
+ */
38
+ isSignedIn: boolean;
39
+ /**
40
+ * The username of the user.
41
+ */
42
+ username?: string;
43
+ }
@@ -0,0 +1,24 @@
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
+ import { GetAllOrganizationsConfig as BaseGetAllOrganizationsConfig, AllOrganizationsApiResponse } from '@asgardeo/browser';
19
+ export interface GetAllOrganizationsConfig extends Omit<BaseGetAllOrganizationsConfig, 'fetcher'> {
20
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
21
+ instanceId?: number;
22
+ }
23
+ declare const getAllOrganizations: ({ fetcher, instanceId, ...requestConfig }: GetAllOrganizationsConfig) => Promise<AllOrganizationsApiResponse>;
24
+ export default getAllOrganizations;
@@ -0,0 +1,24 @@
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
+ import { Organization, GetMeOrganizationsConfig as BaseGetMeOrganizationsConfig } from '@asgardeo/browser';
19
+ export interface GetMeOrganizationsConfig extends Omit<BaseGetMeOrganizationsConfig, 'fetcher'> {
20
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
21
+ instanceId?: number;
22
+ }
23
+ declare const getMeOrganizations: ({ fetcher, instanceId, ...requestConfig }: GetMeOrganizationsConfig) => Promise<Organization[]>;
24
+ export default getMeOrganizations;
@@ -0,0 +1,24 @@
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
+ import { Schema, GetSchemasConfig as BaseGetSchemasConfig } from '@asgardeo/browser';
19
+ export interface GetSchemasConfig extends Omit<BaseGetSchemasConfig, 'fetcher'> {
20
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
21
+ instanceId?: number;
22
+ }
23
+ declare const getSchemas: ({ fetcher, instanceId, ...requestConfig }: GetSchemasConfig) => Promise<Schema[]>;
24
+ export default getSchemas;
@@ -0,0 +1,24 @@
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
+ import { User, GetScim2MeConfig as BaseGetScim2MeConfig } from '@asgardeo/browser';
19
+ export interface GetScim2MeConfig extends Omit<BaseGetScim2MeConfig, 'fetcher'> {
20
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
21
+ instanceId?: number;
22
+ }
23
+ declare const getScim2Me: ({ fetcher, instanceId, ...requestConfig }: GetScim2MeConfig) => Promise<User>;
24
+ export default getScim2Me;