@asgardeo/vue 0.0.9 → 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.
- package/README.md +136 -1
- package/dist/AsgardeoVueClient.d.ts +64 -0
- package/dist/__temp__/api.d.ts +63 -0
- package/dist/__temp__/models.d.ts +43 -0
- package/dist/api/getAllOrganizations.d.ts +24 -0
- package/dist/api/getMeOrganizations.d.ts +24 -0
- package/dist/api/getSchemas.d.ts +24 -0
- package/dist/api/getScim2Me.d.ts +24 -0
- package/dist/cjs/index.js +10849 -1568
- package/dist/cjs/index.js.map +7 -1
- package/dist/components/actions/BaseSignInButton.d.ts +34 -0
- package/dist/components/actions/BaseSignOutButton.d.ts +34 -0
- package/dist/components/actions/BaseSignUpButton.d.ts +34 -0
- package/dist/components/actions/SignInButton.d.ts +26 -0
- package/dist/components/actions/SignOutButton.d.ts +23 -0
- package/dist/components/actions/SignUpButton.d.ts +26 -0
- package/dist/{cjs/types/vitest.config.d.ts → components/adapters/FacebookButton.d.ts} +7 -2
- package/dist/components/adapters/GitHubButton.d.ts +24 -0
- package/dist/components/adapters/GoogleButton.d.ts +24 -0
- package/dist/components/adapters/MicrosoftButton.d.ts +24 -0
- package/dist/components/auth/Callback.d.ts +31 -0
- package/dist/components/control/Loading.d.ts +33 -0
- package/dist/components/control/SignedIn.d.ts +33 -0
- package/dist/components/control/SignedOut.d.ts +33 -0
- package/dist/components/control/organization/Organization.d.ts +38 -0
- package/dist/components/control/user/User.d.ts +38 -0
- package/dist/components/factories/FieldFactory.d.ts +51 -0
- package/dist/components/presentation/accept-invite/AcceptInvite.d.ts +28 -0
- package/dist/components/presentation/accept-invite/BaseAcceptInvite.d.ts +82 -0
- package/dist/{esm/types/composables/useAsgardeo.d.ts → components/presentation/create-organization/BaseCreateOrganization.d.ts} +5 -4
- package/dist/components/presentation/create-organization/CreateOrganization.css.d.ts +34 -0
- package/dist/components/presentation/create-organization/CreateOrganization.d.ts +25 -0
- package/dist/components/presentation/invite-user/BaseInviteUser.d.ts +80 -0
- package/dist/components/presentation/invite-user/InviteUser.d.ts +25 -0
- package/dist/components/presentation/language-switcher/BaseLanguageSwitcher.d.ts +25 -0
- package/dist/components/presentation/language-switcher/LanguageSwitcher.css.d.ts +36 -0
- package/dist/components/presentation/language-switcher/LanguageSwitcher.d.ts +25 -0
- package/dist/components/presentation/organization-list/BaseOrganizationList.d.ts +23 -0
- package/dist/components/presentation/organization-list/OrganizationList.css.d.ts +32 -0
- package/dist/{cjs/types/composables/useAsgardeo.d.ts → components/presentation/organization-list/OrganizationList.d.ts} +5 -4
- package/dist/{cjs/types/composables/useAsgardeoContext.d.ts → components/presentation/organization-profile/BaseOrganizationProfile.d.ts} +6 -5
- package/dist/components/presentation/organization-profile/OrganizationProfile.css.d.ts +24 -0
- package/dist/components/presentation/organization-profile/OrganizationProfile.d.ts +25 -0
- package/dist/components/presentation/organization-switcher/BaseOrganizationSwitcher.d.ts +25 -0
- package/dist/components/presentation/organization-switcher/OrganizationSwitcher.css.d.ts +39 -0
- package/dist/components/presentation/organization-switcher/OrganizationSwitcher.d.ts +25 -0
- package/dist/components/presentation/sign-in/AuthOptionFactory.d.ts +18 -0
- package/dist/components/presentation/sign-in/AuthOptionFactoryCore.d.ts +68 -0
- package/dist/components/presentation/sign-in/BaseSignIn.d.ts +27 -0
- package/dist/components/presentation/sign-in/SignIn.d.ts +27 -0
- package/dist/components/presentation/sign-in/v1/BaseSignIn.d.ts +26 -0
- package/dist/components/presentation/sign-in/v1/SignIn.d.ts +26 -0
- package/dist/components/presentation/sign-in/v1/options/SignInOptionFactory.d.ts +46 -0
- package/dist/components/presentation/sign-in/v2/AuthOptionFactory.d.ts +18 -0
- package/dist/components/presentation/sign-in/v2/BaseSignIn.d.ts +82 -0
- package/dist/components/presentation/sign-in/v2/SignIn.d.ts +55 -0
- package/dist/components/presentation/sign-up/BaseSignUp.d.ts +72 -0
- package/dist/components/presentation/sign-up/SignUp.d.ts +25 -0
- package/dist/components/presentation/user-dropdown/BaseUserDropdown.d.ts +33 -0
- package/dist/components/presentation/user-dropdown/UserDropdown.css.d.ts +35 -0
- package/dist/components/presentation/user-dropdown/UserDropdown.d.ts +25 -0
- package/dist/components/presentation/user-profile/BaseUserProfile.d.ts +47 -0
- package/dist/components/presentation/user-profile/UserProfile.css.d.ts +24 -0
- package/dist/{esm/types/public-api.d.ts → components/presentation/user-profile/UserProfile.d.ts} +3 -2
- package/dist/components/primitives/Alert/Alert.css.d.ts +30 -0
- package/dist/{cjs/types/public-api.d.ts → components/primitives/Alert/Alert.d.ts} +3 -2
- package/dist/components/primitives/Alert/index.d.ts +18 -0
- package/dist/components/primitives/Button/Button.css.d.ts +36 -0
- package/dist/components/primitives/Button/Button.d.ts +20 -0
- package/dist/components/primitives/Button/index.d.ts +18 -0
- package/dist/components/primitives/Card/Card.css.d.ts +29 -0
- package/dist/{esm/types/index.d.ts → components/primitives/Card/Card.d.ts} +3 -3
- package/dist/components/primitives/Card/index.d.ts +18 -0
- package/dist/components/primitives/Checkbox/Checkbox.css.d.ts +30 -0
- package/dist/components/primitives/Checkbox/Checkbox.d.ts +20 -0
- package/dist/components/primitives/Checkbox/index.d.ts +18 -0
- package/dist/components/primitives/DatePicker/DatePicker.css.d.ts +30 -0
- package/dist/components/primitives/DatePicker/DatePicker.d.ts +20 -0
- package/dist/components/primitives/DatePicker/index.d.ts +18 -0
- package/dist/components/primitives/Divider/Divider.css.d.ts +32 -0
- package/dist/components/primitives/Divider/Divider.d.ts +20 -0
- package/dist/components/primitives/Divider/index.d.ts +18 -0
- package/dist/components/primitives/Icons.d.ts +34 -0
- package/dist/components/primitives/Logo/Logo.css.d.ts +27 -0
- package/dist/{cjs/types/index.d.ts → components/primitives/Logo/Logo.d.ts} +3 -3
- package/dist/components/primitives/Logo/index.d.ts +18 -0
- package/dist/{cjs/types/plugins/AsgardeoPlugin.d.ts → components/primitives/OtpField/OtpField.css.d.ts} +10 -5
- package/dist/components/primitives/OtpField/OtpField.d.ts +20 -0
- package/dist/components/primitives/OtpField/index.d.ts +18 -0
- package/dist/components/primitives/PasswordField/PasswordField.css.d.ts +30 -0
- package/dist/components/primitives/PasswordField/PasswordField.d.ts +20 -0
- package/dist/components/primitives/PasswordField/index.d.ts +18 -0
- package/dist/components/primitives/Select/Select.css.d.ts +30 -0
- package/dist/components/primitives/Select/Select.d.ts +25 -0
- package/dist/components/primitives/Select/index.d.ts +18 -0
- package/dist/{esm/types/composables/useAsgardeoContext.d.ts → components/primitives/Spinner/Spinner.css.d.ts} +13 -5
- package/dist/components/primitives/Spinner/Spinner.d.ts +20 -0
- package/dist/components/primitives/Spinner/index.d.ts +18 -0
- package/dist/components/primitives/TextField/TextField.css.d.ts +30 -0
- package/dist/components/primitives/TextField/TextField.d.ts +20 -0
- package/dist/components/primitives/TextField/index.d.ts +18 -0
- package/dist/components/primitives/Typography/Typography.css.d.ts +30 -0
- package/dist/components/primitives/Typography/Typography.d.ts +20 -0
- package/dist/components/primitives/Typography/index.d.ts +18 -0
- package/dist/composables/useAsgardeo.d.ts +48 -0
- package/dist/composables/useBranding.d.ts +43 -0
- package/dist/composables/useFlow.d.ts +45 -0
- package/dist/composables/useFlowMeta.d.ts +41 -0
- package/dist/composables/useI18n.d.ts +45 -0
- package/dist/composables/useOAuthCallback.d.ts +65 -0
- package/dist/composables/useOrganization.d.ts +41 -0
- package/dist/composables/useTheme.d.ts +43 -0
- package/dist/composables/useUser.d.ts +44 -0
- package/dist/index.d.ts +103 -141
- package/dist/index.js +11073 -0
- package/dist/index.js.map +7 -0
- package/dist/keys.d.ts +51 -0
- package/dist/models/config.d.ts +19 -0
- package/dist/models/contexts.d.ts +244 -0
- package/dist/{esm/types/plugins → plugins}/AsgardeoPlugin.d.ts +28 -4
- package/dist/providers/AsgardeoProvider.d.ts +35 -0
- package/dist/providers/BrandingProvider.d.ts +29 -0
- package/dist/providers/FlowMetaProvider.d.ts +20 -0
- package/dist/providers/FlowProvider.d.ts +20 -0
- package/dist/providers/I18nProvider.d.ts +20 -0
- package/dist/providers/OrganizationProvider.d.ts +20 -0
- package/dist/providers/ThemeProvider.d.ts +20 -0
- package/dist/providers/UserProvider.d.ts +20 -0
- package/dist/router/callbackRoute.d.ts +87 -0
- package/dist/router/guard.d.ts +96 -0
- package/dist/styles/animations.css.d.ts +28 -0
- package/dist/styles/defaults.css.d.ts +31 -0
- package/dist/styles/injectStyles.d.ts +23 -0
- package/dist/theme/getActiveTheme.d.ts +28 -0
- package/dist/theme/themeDetection.d.ts +30 -0
- package/dist/utils/handleWebAuthnAuthentication.d.ts +27 -0
- package/dist/utils/hasAuthParamsInUrl.d.ts +26 -0
- package/dist/utils/http.d.ts +26 -0
- package/dist/utils/logger.d.ts +30 -0
- package/dist/utils/navigate.d.ts +27 -0
- package/dist/utils/oauth.d.ts +24 -0
- package/dist/utils/v2/buildThemeConfigFromFlowMeta.d.ts +28 -0
- package/dist/utils/v2/flowTransformer.d.ts +96 -0
- package/dist/utils/v2/getAuthComponentHeadings.d.ts +40 -0
- package/dist/utils/v2/passkey.d.ts +31 -0
- package/dist/utils/v2/resolveTranslationsInArray.d.ts +29 -0
- package/dist/utils/v2/resolveTranslationsInObject.d.ts +29 -0
- package/package.json +54 -67
- package/dist/cjs/types/auth-api.d.ts +0 -231
- package/dist/cjs/types/tests/mocks/mocks.d.ts +0 -57
- package/dist/cjs/types/types.d.ts +0 -107
- package/dist/esm/index.js +0 -1590
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/types/auth-api.d.ts +0 -231
- package/dist/esm/types/tests/mocks/mocks.d.ts +0 -57
- package/dist/esm/types/types.d.ts +0 -107
- package/dist/esm/types/vitest.config.d.ts +0 -19
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
* Options for the Asgardeo navigation guard.
|
|
20
|
+
*/
|
|
21
|
+
export interface GuardOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Maximum time (in ms) to wait for SDK initialization before redirecting.
|
|
24
|
+
* Only applicable when `waitForInit` is `true`.
|
|
25
|
+
* @default 10000
|
|
26
|
+
*/
|
|
27
|
+
initTimeout?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The path to redirect unauthenticated users to.
|
|
30
|
+
* @default '/'
|
|
31
|
+
*/
|
|
32
|
+
redirectTo?: string;
|
|
33
|
+
/**
|
|
34
|
+
* If `true`, the guard will wait for the SDK to finish initializing before
|
|
35
|
+
* evaluating the authentication state. If `false`, the guard will reject
|
|
36
|
+
* immediately when the SDK is not yet initialized.
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
waitForInit?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A minimal navigation guard type compatible with Vue Router's `NavigationGuard`.
|
|
43
|
+
*
|
|
44
|
+
* This avoids a hard dependency on `vue-router` while remaining structurally compatible.
|
|
45
|
+
* When consumers pass this to `beforeEnter` or `router.beforeEach`, Vue Router will
|
|
46
|
+
* accept it because it satisfies the shape of `NavigationGuard`.
|
|
47
|
+
*/
|
|
48
|
+
export type NavigationGuardReturn = boolean | string | {
|
|
49
|
+
path: string;
|
|
50
|
+
} | {
|
|
51
|
+
name: string;
|
|
52
|
+
} | undefined;
|
|
53
|
+
export type AsgardeoNavigationGuard = (to: {
|
|
54
|
+
fullPath: string;
|
|
55
|
+
path: string;
|
|
56
|
+
query: Record<string, string | (string | null)[] | null | undefined>;
|
|
57
|
+
}, from: {
|
|
58
|
+
fullPath: string;
|
|
59
|
+
path: string;
|
|
60
|
+
}, next: (target?: NavigationGuardReturn) => void) => void | Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a Vue Router navigation guard that protects routes by requiring authentication.
|
|
63
|
+
*
|
|
64
|
+
* The guard injects the Asgardeo context to check `isSignedIn` state.
|
|
65
|
+
* If the user is not authenticated, they are redirected to `redirectTo`.
|
|
66
|
+
*
|
|
67
|
+
* **Requires `vue-router` as a peer dependency.**
|
|
68
|
+
*
|
|
69
|
+
* @param options - Guard configuration options.
|
|
70
|
+
* @returns A navigation guard function compatible with Vue Router's `beforeEnter` or `router.beforeEach`.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* import { createRouter, createWebHistory } from 'vue-router';
|
|
75
|
+
* import { createAsgardeoGuard } from '@asgardeo/vue';
|
|
76
|
+
*
|
|
77
|
+
* const router = createRouter({
|
|
78
|
+
* history: createWebHistory(),
|
|
79
|
+
* routes: [
|
|
80
|
+
* {
|
|
81
|
+
* path: '/dashboard',
|
|
82
|
+
* component: Dashboard,
|
|
83
|
+
* beforeEnter: createAsgardeoGuard({ redirectTo: '/login' }),
|
|
84
|
+
* },
|
|
85
|
+
* ],
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* // Global guard on all routes
|
|
92
|
+
* router.beforeEach(createAsgardeoGuard({ redirectTo: '/' }));
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare const createAsgardeoGuard: (options?: GuardOptions) => AsgardeoNavigationGuard;
|
|
96
|
+
export default createAsgardeoGuard;
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
* Shared CSS keyframe animations used by multiple primitive components.
|
|
20
|
+
*
|
|
21
|
+
* `asgardeo-spin` - used by Spinner (__svg) and Button (__spinner)
|
|
22
|
+
* `asgardeo-spinner-dash` - used by Spinner (__circle)
|
|
23
|
+
*
|
|
24
|
+
* Defined once here rather than in each component's CSS file to avoid
|
|
25
|
+
* duplicate `@keyframes` blocks in the injected stylesheet.
|
|
26
|
+
*/
|
|
27
|
+
declare const ANIMATIONS_CSS: string;
|
|
28
|
+
export default ANIMATIONS_CSS;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
* Default CSS custom property fallback values.
|
|
20
|
+
*
|
|
21
|
+
* These are written into a `:root` rule so that every Asgardeo Vue primitive
|
|
22
|
+
* renders correctly even when no ThemeProvider is mounted. When ThemeProvider
|
|
23
|
+
* IS present it calls `document.documentElement.style.setProperty(...)` which
|
|
24
|
+
* has higher specificity than a stylesheet `:root` rule and therefore wins
|
|
25
|
+
* automatically — no special cascade tricks required.
|
|
26
|
+
*
|
|
27
|
+
* Design token naming follows the pattern:
|
|
28
|
+
* --asgardeo-{category}-{sub}-{scale?}
|
|
29
|
+
*/
|
|
30
|
+
declare const DEFAULTS_CSS: string;
|
|
31
|
+
export default DEFAULTS_CSS;
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
* Injects Asgardeo Vue component styles into the document `<head>` once.
|
|
20
|
+
* Subsequent calls are no-ops (idempotent).
|
|
21
|
+
*/
|
|
22
|
+
export declare function injectStyles(): void;
|
|
23
|
+
export default injectStyles;
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
* Re-export of the active theme resolver from the Browser SDK.
|
|
20
|
+
*
|
|
21
|
+
* Gets the active theme based on the theme mode preference:
|
|
22
|
+
* - `'light'` / `'dark'` → Returns the specified mode directly.
|
|
23
|
+
* - `'system'` → Uses `matchMedia('(prefers-color-scheme: dark)')` to detect system preference.
|
|
24
|
+
* - `'class'` → Inspects DOM element class list for dark/light classes.
|
|
25
|
+
*
|
|
26
|
+
* @see {@link @asgardeo/browser#getActiveTheme}
|
|
27
|
+
*/
|
|
28
|
+
export { getActiveTheme, getActiveTheme as default } from '@asgardeo/browser';
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
* Re-exports of theme detection utilities from the Browser SDK.
|
|
20
|
+
*
|
|
21
|
+
* - `detectThemeMode` — Detects current theme mode based on system preference or DOM class.
|
|
22
|
+
* - `createClassObserver` — Creates a MutationObserver watching for CSS class changes on a target element.
|
|
23
|
+
* - `createMediaQueryListener` — Creates a media query listener for `prefers-color-scheme` changes.
|
|
24
|
+
* - `BrowserThemeDetection` — Configuration interface for DOM-specific theme detection options.
|
|
25
|
+
*
|
|
26
|
+
* @see {@link @asgardeo/browser#detectThemeMode}
|
|
27
|
+
* @see {@link @asgardeo/browser#createClassObserver}
|
|
28
|
+
* @see {@link @asgardeo/browser#createMediaQueryListener}
|
|
29
|
+
*/
|
|
30
|
+
export { detectThemeMode, createClassObserver, createMediaQueryListener, type BrowserThemeDetection, } from '@asgardeo/browser';
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
* Re-export of the WebAuthn authentication handler from the Browser SDK.
|
|
20
|
+
*
|
|
21
|
+
* Handles WebAuthn/Passkey authentication flow for browser environments,
|
|
22
|
+
* including browser compatibility checks, HTTPS validation, challenge processing,
|
|
23
|
+
* and the credential authentication ceremony.
|
|
24
|
+
*
|
|
25
|
+
* @see {@link @asgardeo/browser#handleWebAuthnAuthentication}
|
|
26
|
+
*/
|
|
27
|
+
export { handleWebAuthnAuthentication, handleWebAuthnAuthentication as default } from '@asgardeo/browser';
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* Re-export of the auth params URL check from the Browser SDK.
|
|
20
|
+
*
|
|
21
|
+
* Checks if `code` (and optionally `session_state`) are present in the URL search params,
|
|
22
|
+
* indicating an OAuth2 authorization code callback.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link @asgardeo/browser#hasAuthParamsInUrl}
|
|
25
|
+
*/
|
|
26
|
+
export { hasAuthParamsInUrl, hasAuthParamsInUrl as default } from '@asgardeo/browser';
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* Re-export of the HTTP utility from the Browser SDK.
|
|
20
|
+
*
|
|
21
|
+
* Creates an HTTP utility for making authenticated requests using a specific
|
|
22
|
+
* AsgardeoSPAClient instance. The returned object has `request` and `requestAll` methods.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link @asgardeo/browser#http}
|
|
25
|
+
*/
|
|
26
|
+
export { http, http as default } from '@asgardeo/browser';
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { createPackageComponentLogger, createPackageLogger } from '@asgardeo/browser';
|
|
19
|
+
/**
|
|
20
|
+
* Package-level logger for `@asgardeo/vue`.
|
|
21
|
+
* Use this when logging is not tied to a specific component.
|
|
22
|
+
*/
|
|
23
|
+
declare const logger: ReturnType<typeof createPackageLogger>;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a component-scoped logger prefixed with `@asgardeo/vue - <component>`.
|
|
26
|
+
*
|
|
27
|
+
* @param component - The component or module name (e.g. `'AsgardeoProvider'`).
|
|
28
|
+
*/
|
|
29
|
+
export declare const createVueLogger: (component: string) => ReturnType<typeof createPackageComponentLogger>;
|
|
30
|
+
export default logger;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
* Re-export of the navigation helper from the Browser SDK.
|
|
20
|
+
*
|
|
21
|
+
* Navigates to a new URL within the browser:
|
|
22
|
+
* - For same-origin URLs: Uses the History API and dispatches a `popstate` event (SPA navigation).
|
|
23
|
+
* - For cross-origin URLs: Performs a full page load using `window.location.assign`.
|
|
24
|
+
*
|
|
25
|
+
* @see {@link @asgardeo/browser#navigate}
|
|
26
|
+
*/
|
|
27
|
+
export { navigate, navigate as default } from '@asgardeo/browser';
|
|
@@ -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
|
+
/**
|
|
19
|
+
* Initiates OAuth redirect with CSRF protection.
|
|
20
|
+
* Generates random state, stores return path in sessionStorage, and redirects to OAuth provider.
|
|
21
|
+
*
|
|
22
|
+
* @param redirectURL - OAuth authorization URL from the server
|
|
23
|
+
*/
|
|
24
|
+
export declare function initiateOAuthRedirect(redirectURL: string): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, 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 { FlowMetaTheme, RecursivePartial, ThemeConfig } from '@asgardeo/browser';
|
|
19
|
+
/**
|
|
20
|
+
* Converts a v2 `FlowMetaTheme` into a `RecursivePartial<ThemeConfig>` that
|
|
21
|
+
* `createTheme` can consume.
|
|
22
|
+
*
|
|
23
|
+
* Only fields explicitly present in the FlowMeta response are included so that
|
|
24
|
+
* `createTheme` can deep-merge them onto its base (light/dark) defaults without
|
|
25
|
+
* accidentally dropping sibling keys that were not returned by the server.
|
|
26
|
+
*/
|
|
27
|
+
declare const buildThemeConfigFromFlowMeta: (flowMetaTheme: FlowMetaTheme, colorScheme: "light" | "dark") => RecursivePartial<ThemeConfig>;
|
|
28
|
+
export default buildThemeConfigFromFlowMeta;
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
* @fileoverview Shared flow response transformer utilities for v2 embedded flows.
|
|
20
|
+
*
|
|
21
|
+
* This module provides reusable transformation functions for normalizing embedded flow
|
|
22
|
+
* responses from Asgardeo APIs. It handles both successful responses with component
|
|
23
|
+
* extraction and error responses with proper error message extraction.
|
|
24
|
+
*
|
|
25
|
+
* Key features:
|
|
26
|
+
* - Component extraction from flow meta structure
|
|
27
|
+
* - Translation string resolution in components
|
|
28
|
+
* - Error response detection and message extraction
|
|
29
|
+
* - Configurable error handling (throw vs return errors)
|
|
30
|
+
*
|
|
31
|
+
* Usage:
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import { normalizeFlowResponse } from '../../../utils/v2/flowTransformer';
|
|
34
|
+
*
|
|
35
|
+
* const { flowId, components } = normalizeFlowResponse(apiResponse, t, {
|
|
36
|
+
* defaultErrorKey: 'components.signIn.errors.generic'
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* This transformer is used by both SignIn and SignUp v2 components to ensure
|
|
41
|
+
* consistent response handling across all embedded flows.
|
|
42
|
+
*/
|
|
43
|
+
import { EmbeddedFlowComponentV2 as EmbeddedFlowComponent, FlowMetadataResponse } from '@asgardeo/browser';
|
|
44
|
+
type TranslationFn = (key: string, params?: Record<string, string | number>) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Generic flow error response interface that covers common error structure
|
|
47
|
+
*/
|
|
48
|
+
export interface FlowErrorResponse {
|
|
49
|
+
failureReason?: string;
|
|
50
|
+
flowId: string;
|
|
51
|
+
flowStatus: 'ERROR';
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Configuration options for flow transformation
|
|
55
|
+
*/
|
|
56
|
+
export interface FlowTransformOptions {
|
|
57
|
+
/**
|
|
58
|
+
* Default error message key for translation fallback
|
|
59
|
+
* @default 'errors.flow.generic'
|
|
60
|
+
*/
|
|
61
|
+
defaultErrorKey?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Whether to resolve translation strings or keep them as i18n keys
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
resolveTranslations?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Whether to throw errors or return them as normalized response
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
throwOnError?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Transform and resolve translations in components from flow response.
|
|
75
|
+
*/
|
|
76
|
+
export declare const transformComponents: (response: any, t: TranslationFn, resolveTranslations?: boolean, meta?: FlowMetadataResponse | null) => EmbeddedFlowComponent[];
|
|
77
|
+
/**
|
|
78
|
+
* Extract error message from flow error response.
|
|
79
|
+
* Supports any flow error response that follows the standard structure.
|
|
80
|
+
* Prioritizes failureReason if present, otherwise falls back to translated generic message.
|
|
81
|
+
*/
|
|
82
|
+
export declare const extractErrorMessage: (error: FlowErrorResponse | any, t: TranslationFn, defaultErrorKey?: string) => string;
|
|
83
|
+
/**
|
|
84
|
+
* Check if a response is an error response and extract the error message.
|
|
85
|
+
*/
|
|
86
|
+
export declare const checkForErrorResponse: (response: any, t: TranslationFn, defaultErrorKey?: string) => string | null;
|
|
87
|
+
/**
|
|
88
|
+
* Generic flow response normalizer that handles both success and error responses.
|
|
89
|
+
* This is the main transformer function that should be used by all flow components.
|
|
90
|
+
*/
|
|
91
|
+
export declare const normalizeFlowResponse: (response: any, t: TranslationFn, options?: FlowTransformOptions, meta?: FlowMetadataResponse | null) => {
|
|
92
|
+
additionalData: Record<string, any>;
|
|
93
|
+
components: EmbeddedFlowComponent[];
|
|
94
|
+
flowId: string;
|
|
95
|
+
};
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { EmbeddedFlowComponentV2 as EmbeddedFlowComponent } from '@asgardeo/browser';
|
|
19
|
+
/**
|
|
20
|
+
* Result of heading extraction from flow components
|
|
21
|
+
*/
|
|
22
|
+
export interface HeadingExtractionResult {
|
|
23
|
+
heading: EmbeddedFlowComponent | null;
|
|
24
|
+
subheading: EmbeddedFlowComponent | null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Complete result of authentication component heading extraction
|
|
28
|
+
*/
|
|
29
|
+
export interface AuthComponentHeadingsResult {
|
|
30
|
+
componentsWithoutHeadings: EmbeddedFlowComponent[];
|
|
31
|
+
headingComponents: HeadingExtractionResult;
|
|
32
|
+
subtitle: string;
|
|
33
|
+
title: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Extracts heading and subheading components from authentication flow components
|
|
37
|
+
* and provides resolved title/subtitle text with fallback logic.
|
|
38
|
+
*/
|
|
39
|
+
declare const getAuthComponentHeadings: (components: EmbeddedFlowComponent[], flowTitle?: string, flowSubtitle?: string, defaultTitle?: string, defaultSubtitle?: string) => AuthComponentHeadingsResult;
|
|
40
|
+
export default getAuthComponentHeadings;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
* Handles WebAuthn/Passkey registration flow for browser environments.
|
|
20
|
+
*
|
|
21
|
+
* @param challengeData - JSON stringified challenge data containing WebAuthn creation options.
|
|
22
|
+
* @returns Promise that resolves to a JSON string containing the WebAuthn registration response.
|
|
23
|
+
*/
|
|
24
|
+
export declare const handlePasskeyRegistration: (challengeData: string) => Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Handles WebAuthn/Passkey authentication flow for browser environments.
|
|
27
|
+
*
|
|
28
|
+
* @param challengeData - JSON stringified challenge data containing WebAuthn request options.
|
|
29
|
+
* @returns Promise that resolves to a JSON string containing the WebAuthn authentication response.
|
|
30
|
+
*/
|
|
31
|
+
export declare const handlePasskeyAuthentication: (challengeData: string) => Promise<string>;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { FlowMetadataResponse } from '@asgardeo/browser';
|
|
19
|
+
type TranslationFn = (key: string, params?: Record<string, string | number>) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Recursively resolves translation and meta template strings in an array of objects.
|
|
22
|
+
* @param items - Array of objects to process
|
|
23
|
+
* @param t - The translation function from useI18n
|
|
24
|
+
* @param properties - Array of property names to resolve (optional)
|
|
25
|
+
* @param meta - Optional flow metadata for resolving meta() expressions
|
|
26
|
+
* @returns A new array with resolved translations
|
|
27
|
+
*/
|
|
28
|
+
declare const resolveTranslationsInArray: <T extends Record<string, any>>(items: T[], t: TranslationFn, properties?: string[], meta?: FlowMetadataResponse | null) => T[];
|
|
29
|
+
export default resolveTranslationsInArray;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { FlowMetadataResponse } from '@asgardeo/browser';
|
|
19
|
+
type TranslationFn = (key: string, params?: Record<string, string | number>) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Resolves all {{ t() }} and {{ meta() }} template expressions in an object's string properties.
|
|
22
|
+
* @param obj - The object to process
|
|
23
|
+
* @param t - The translation function from useI18n
|
|
24
|
+
* @param properties - Array of property names to resolve (optional, defaults to common properties)
|
|
25
|
+
* @param meta - Optional flow metadata for resolving meta() expressions
|
|
26
|
+
* @returns A new object with resolved template strings
|
|
27
|
+
*/
|
|
28
|
+
export declare const resolveTranslationsInObject: <T extends Record<string, any>>(obj: T, t: TranslationFn, properties?: string[], meta?: FlowMetadataResponse | null) => T;
|
|
29
|
+
export default resolveTranslationsInObject;
|