@asgardeo/nuxt 0.0.0 → 0.1.0-alpha.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 (119) hide show
  1. package/README.md +482 -6
  2. package/dist/module.d.mts +17 -24
  3. package/dist/module.json +2 -2
  4. package/dist/module.mjs +174 -48
  5. package/dist/runtime/components/AsgardeoRoot.d.ts +52 -0
  6. package/dist/runtime/components/AsgardeoRoot.js +160 -0
  7. package/dist/runtime/components/actions/SignInButton.d.ts +37 -0
  8. package/dist/runtime/components/actions/SignInButton.js +51 -0
  9. package/dist/runtime/components/actions/SignOutButton.d.ts +34 -0
  10. package/dist/runtime/components/actions/SignOutButton.js +43 -0
  11. package/dist/runtime/components/actions/SignUpButton.d.ts +33 -0
  12. package/dist/runtime/components/actions/SignUpButton.js +48 -0
  13. package/dist/runtime/components/auth/Callback.d.ts +43 -0
  14. package/dist/runtime/components/auth/Callback.js +93 -0
  15. package/dist/runtime/components/auth/SignIn.d.ts +38 -0
  16. package/dist/runtime/components/auth/SignIn.js +60 -0
  17. package/dist/runtime/components/auth/SignUp.d.ts +40 -0
  18. package/dist/runtime/components/auth/SignUp.js +79 -0
  19. package/dist/runtime/components/control/Loading.d.ts +36 -0
  20. package/dist/runtime/components/control/Loading.js +17 -0
  21. package/dist/runtime/components/control/SignedIn.d.ts +38 -0
  22. package/dist/runtime/components/control/SignedIn.js +17 -0
  23. package/dist/runtime/components/control/SignedOut.d.ts +37 -0
  24. package/dist/runtime/components/control/SignedOut.js +17 -0
  25. package/dist/runtime/components/organization/CreateOrganization.d.ts +32 -0
  26. package/dist/runtime/components/organization/CreateOrganization.js +29 -0
  27. package/dist/runtime/components/organization/Organization.d.ts +39 -0
  28. package/dist/runtime/components/organization/Organization.js +17 -0
  29. package/dist/runtime/components/organization/OrganizationList.d.ts +34 -0
  30. package/dist/runtime/components/organization/OrganizationList.js +30 -0
  31. package/dist/runtime/components/organization/OrganizationProfile.d.ts +32 -0
  32. package/dist/runtime/components/organization/OrganizationProfile.js +32 -0
  33. package/dist/runtime/components/organization/OrganizationSwitcher.d.ts +36 -0
  34. package/dist/runtime/components/organization/OrganizationSwitcher.js +26 -0
  35. package/dist/runtime/components/user/User.d.ts +38 -0
  36. package/dist/runtime/components/user/User.js +17 -0
  37. package/dist/runtime/components/user/UserDropdown.d.ts +38 -0
  38. package/dist/runtime/components/user/UserDropdown.js +45 -0
  39. package/dist/runtime/components/user/UserProfile.d.ts +35 -0
  40. package/dist/runtime/components/user/UserProfile.js +35 -0
  41. package/dist/runtime/composables/useAsgardeo.d.ts +38 -0
  42. package/dist/runtime/composables/useAsgardeo.js +73 -0
  43. package/dist/runtime/errors/asgardeo-error.d.ts +47 -0
  44. package/dist/runtime/errors/asgardeo-error.js +15 -0
  45. package/dist/runtime/errors/error-codes.d.ts +40 -0
  46. package/dist/runtime/errors/error-codes.js +19 -0
  47. package/dist/runtime/{composables/asgardeo/useAuth.d.ts → errors/index.d.ts} +2 -2
  48. package/dist/runtime/errors/index.js +2 -0
  49. package/dist/runtime/middleware/auth.d.ts +35 -0
  50. package/dist/runtime/middleware/auth.js +2 -0
  51. package/dist/runtime/middleware/defineAsgardeoMiddleware.d.ts +53 -0
  52. package/dist/runtime/middleware/defineAsgardeoMiddleware.js +24 -0
  53. package/dist/runtime/plugins/asgardeo.d.ts +40 -0
  54. package/dist/runtime/plugins/asgardeo.js +129 -0
  55. package/dist/runtime/server/AsgardeoNuxtClient.d.ts +182 -0
  56. package/dist/runtime/server/AsgardeoNuxtClient.js +366 -0
  57. package/dist/runtime/server/index.d.ts +33 -0
  58. package/dist/runtime/server/index.js +3 -0
  59. package/dist/runtime/server/plugins/asgardeo-ssr.d.ts +41 -0
  60. package/dist/runtime/server/plugins/asgardeo-ssr.js +134 -0
  61. package/dist/runtime/server/routes/auth/branding/branding.get.d.ts +31 -0
  62. package/dist/runtime/server/routes/auth/branding/branding.get.js +40 -0
  63. package/dist/runtime/server/routes/auth/organizations/current.get.d.ts +29 -0
  64. package/dist/runtime/server/routes/auth/organizations/current.get.js +24 -0
  65. package/dist/runtime/server/routes/auth/organizations/id.get.d.ts +28 -0
  66. package/dist/runtime/server/routes/auth/organizations/id.get.js +28 -0
  67. package/dist/runtime/server/routes/auth/organizations/index.get.d.ts +28 -0
  68. package/dist/runtime/server/routes/auth/organizations/index.get.js +24 -0
  69. package/dist/runtime/server/routes/auth/organizations/index.post.d.ts +30 -0
  70. package/dist/runtime/server/routes/auth/organizations/index.post.js +30 -0
  71. package/dist/runtime/server/routes/auth/organizations/me.get.d.ts +28 -0
  72. package/dist/runtime/server/routes/auth/organizations/me.get.js +24 -0
  73. package/dist/runtime/server/routes/auth/organizations/switch.post.d.ts +32 -0
  74. package/dist/runtime/server/routes/auth/organizations/switch.post.js +49 -0
  75. package/dist/runtime/server/routes/auth/session/callback.get.d.ts +27 -0
  76. package/dist/runtime/server/routes/auth/session/callback.get.js +91 -0
  77. package/dist/runtime/server/routes/auth/session/callback.post.d.ts +48 -0
  78. package/dist/runtime/server/routes/auth/session/callback.post.js +53 -0
  79. package/dist/runtime/server/routes/auth/session/session.get.d.ts +26 -0
  80. package/dist/runtime/server/routes/auth/session/session.get.js +22 -0
  81. package/dist/runtime/server/routes/auth/session/signin.get.d.ts +29 -0
  82. package/dist/runtime/server/routes/auth/session/signin.get.js +37 -0
  83. package/dist/runtime/server/routes/auth/session/signin.post.d.ts +37 -0
  84. package/dist/runtime/server/routes/auth/session/signin.post.js +102 -0
  85. package/dist/runtime/server/routes/auth/session/signout.post.d.ts +31 -0
  86. package/dist/runtime/server/routes/auth/session/signout.post.js +38 -0
  87. package/dist/runtime/server/routes/auth/session/signup.post.d.ts +36 -0
  88. package/dist/runtime/server/routes/auth/session/signup.post.js +30 -0
  89. package/dist/runtime/server/routes/auth/session/token.get.d.ts +29 -0
  90. package/dist/runtime/server/routes/auth/session/token.get.js +6 -0
  91. package/dist/runtime/server/routes/auth/user/profile.get.d.ts +29 -0
  92. package/dist/runtime/server/routes/auth/user/profile.get.js +24 -0
  93. package/dist/runtime/server/{handler.d.ts → routes/auth/user/profile.patch.d.ts} +17 -13
  94. package/dist/runtime/server/routes/auth/user/profile.patch.js +33 -0
  95. package/dist/runtime/server/{services/asgardeo/index.d.ts → routes/auth/user/user.get.d.ts} +6 -4
  96. package/dist/runtime/server/routes/auth/user/user.get.js +21 -0
  97. package/dist/runtime/server/utils/event-context.d.ts +49 -0
  98. package/dist/runtime/server/utils/event-context.js +3 -0
  99. package/dist/runtime/server/utils/serverSession.d.ts +65 -0
  100. package/dist/runtime/server/utils/serverSession.js +44 -0
  101. package/dist/runtime/server/utils/session.d.ts +85 -0
  102. package/dist/runtime/server/utils/session.js +106 -0
  103. package/dist/runtime/server/utils/token-refresh.d.ts +42 -0
  104. package/dist/runtime/server/utils/token-refresh.js +65 -0
  105. package/dist/runtime/types/augments.d.ts +61 -0
  106. package/dist/runtime/types.d.ts +115 -38
  107. package/dist/runtime/utils/createRouteMatcher.d.ts +40 -0
  108. package/dist/runtime/utils/createRouteMatcher.js +7 -0
  109. package/dist/runtime/utils/index.d.ts +30 -0
  110. package/dist/runtime/utils/index.js +1 -0
  111. package/dist/runtime/utils/log.d.ts +44 -0
  112. package/dist/runtime/utils/log.js +25 -0
  113. package/dist/runtime/utils/url-validation.d.ts +49 -0
  114. package/dist/runtime/utils/url-validation.js +38 -0
  115. package/dist/types.d.mts +0 -2
  116. package/package.json +48 -23
  117. package/dist/runtime/composables/asgardeo/useAuth.js +0 -129
  118. package/dist/runtime/server/handler.js +0 -231
  119. package/dist/runtime/server/services/asgardeo/index.js +0 -18
@@ -0,0 +1,48 @@
1
+ import { AsgardeoRuntimeError } from "@asgardeo/browser";
2
+ import { BaseSignUpButton } from "@asgardeo/vue";
3
+ import { defineComponent, h, ref } from "vue";
4
+ import { navigateTo } from "#app";
5
+ import { useAsgardeo } from "#imports";
6
+ const SignUpButton = defineComponent({
7
+ emits: ["click", "error"],
8
+ name: "SignUpButton",
9
+ setup(_, { slots, emit, attrs }) {
10
+ const { signUp, signUpUrl } = useAsgardeo();
11
+ const isLoading = ref(false);
12
+ const handleSignUp = async (e) => {
13
+ try {
14
+ isLoading.value = true;
15
+ if (signUpUrl) {
16
+ await navigateTo(signUpUrl, { external: true });
17
+ } else {
18
+ await signUp();
19
+ }
20
+ if (e) emit("click", e);
21
+ } catch (error) {
22
+ emit("error", error);
23
+ throw new AsgardeoRuntimeError(
24
+ `Sign up failed: ${error instanceof Error ? error.message : String(error)}`,
25
+ "SignUpButton-handleSignUp-RuntimeError-001",
26
+ "nuxt",
27
+ "Something went wrong while trying to sign up. Please try again later."
28
+ );
29
+ } finally {
30
+ isLoading.value = false;
31
+ }
32
+ };
33
+ return () => {
34
+ const slotContent = slots["default"] ? () => slots["default"]({ isLoading: isLoading.value }) : void 0;
35
+ return h(
36
+ BaseSignUpButton,
37
+ {
38
+ class: attrs["class"],
39
+ isLoading: isLoading.value,
40
+ onClick: handleSignUp,
41
+ style: attrs["style"]
42
+ },
43
+ slotContent
44
+ );
45
+ };
46
+ }
47
+ });
48
+ export default SignUpButton;
@@ -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
+ import { type Component } from 'vue';
19
+ /**
20
+ * Nuxt-specific Callback component.
21
+ *
22
+ * Handles OAuth callback parameter forwarding — extracts `code`, `state`, and
23
+ * `error` from the URL, validates the state stored in `sessionStorage`, and
24
+ * forwards the OAuth parameters to the originating route.
25
+ *
26
+ * **SSR-safe**: all `window` / `sessionStorage` access is gated inside
27
+ * `onMounted`, which only runs on the client. Navigation uses Nuxt's
28
+ * `navigateTo` instead of `window.location` so the redirect is handled
29
+ * correctly in both SSR and CSR contexts.
30
+ *
31
+ * Pass `onNavigate` to override the navigation handler (e.g. for testing or
32
+ * custom routing logic).
33
+ *
34
+ * @example
35
+ * ```vue
36
+ * <!-- pages/callback.vue -->
37
+ * <template>
38
+ * <AsgardeoCallback :on-error="handleError" />
39
+ * </template>
40
+ * ```
41
+ */
42
+ declare const Callback: Component;
43
+ export default Callback;
@@ -0,0 +1,93 @@
1
+ import { defineComponent, onMounted } from "vue";
2
+ import { navigateTo } from "#app";
3
+ const error = (msg, ...args) => {
4
+ console.error(`[@asgardeo/nuxt] Callback: ${msg}`, ...args);
5
+ };
6
+ const Callback = defineComponent({
7
+ name: "Callback",
8
+ props: {
9
+ onError: { default: void 0, type: Function },
10
+ onNavigate: { default: void 0, type: Function }
11
+ },
12
+ setup(props) {
13
+ const navigate = (path) => {
14
+ if (props.onNavigate) {
15
+ props.onNavigate(path);
16
+ } else {
17
+ navigateTo(path);
18
+ }
19
+ };
20
+ onMounted(() => {
21
+ let returnPath = "/";
22
+ try {
23
+ const urlParams = new URLSearchParams(window.location.search);
24
+ const code = urlParams.get("code");
25
+ const state = urlParams.get("state");
26
+ const nonce = urlParams.get("nonce");
27
+ const oauthError = urlParams.get("error");
28
+ const errorDescription = urlParams.get("error_description");
29
+ if (!code && !state && !oauthError) {
30
+ return;
31
+ }
32
+ if (!state) {
33
+ throw new Error("Missing OAuth state parameter - possible security issue");
34
+ }
35
+ const storedData = sessionStorage.getItem(`asgardeo_oauth_${state}`);
36
+ if (!storedData) {
37
+ if (oauthError) {
38
+ const errorMsg = errorDescription || oauthError || "OAuth authentication failed";
39
+ const err = new Error(errorMsg);
40
+ props.onError?.(err);
41
+ const params2 = new URLSearchParams();
42
+ params2.set("error", oauthError);
43
+ if (errorDescription) {
44
+ params2.set("error_description", errorDescription);
45
+ }
46
+ navigate(`/?${params2.toString()}`);
47
+ return;
48
+ }
49
+ throw new Error("Invalid OAuth state - possible CSRF attack");
50
+ }
51
+ const { path, timestamp } = JSON.parse(storedData);
52
+ returnPath = path || "/";
53
+ const MAX_STATE_AGE = 3e5;
54
+ if (Date.now() - timestamp > MAX_STATE_AGE) {
55
+ sessionStorage.removeItem(`asgardeo_oauth_${state}`);
56
+ throw new Error("OAuth state expired - please try again");
57
+ }
58
+ sessionStorage.removeItem(`asgardeo_oauth_${state}`);
59
+ if (oauthError) {
60
+ const errorMsg = errorDescription || oauthError || "OAuth authentication failed";
61
+ const err = new Error(errorMsg);
62
+ props.onError?.(err);
63
+ const params2 = new URLSearchParams();
64
+ params2.set("error", oauthError);
65
+ if (errorDescription) {
66
+ params2.set("error_description", errorDescription);
67
+ }
68
+ navigate(`${returnPath}?${params2.toString()}`);
69
+ return;
70
+ }
71
+ if (!code) {
72
+ throw new Error("Missing OAuth authorization code");
73
+ }
74
+ const params = new URLSearchParams();
75
+ params.set("code", code);
76
+ if (nonce) {
77
+ params.set("nonce", nonce);
78
+ }
79
+ navigate(`${returnPath}?${params.toString()}`);
80
+ } catch (err) {
81
+ const errorMessage = err instanceof Error ? err.message : "OAuth callback processing failed";
82
+ error("OAuth callback error:", err);
83
+ props.onError?.(err instanceof Error ? err : new Error(errorMessage));
84
+ const params = new URLSearchParams();
85
+ params.set("error", "callback_error");
86
+ params.set("error_description", errorMessage);
87
+ navigate(`${returnPath}?${params.toString()}`);
88
+ }
89
+ });
90
+ return () => null;
91
+ }
92
+ });
93
+ export default Callback;
@@ -0,0 +1,38 @@
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 { type Component } from 'vue';
19
+ /**
20
+ * Nuxt-specific SignIn container for the embedded (app-native) sign-in flow.
21
+ *
22
+ * Mirrors the Vue SDK's `SignIn` container but replaces all `window.location`
23
+ * navigation with Nuxt's `navigateTo` so redirects after a successful embedded
24
+ * sign-in are SSR-safe.
25
+ *
26
+ * Uses `useAsgardeo()` from the Nuxt auto-import layer — the Nuxt-specific
27
+ * wrapper that provides Nitro-route-aware `signIn`, `signOut`, `signUp`.
28
+ *
29
+ * Delegates all UI rendering to {@link BaseSignIn} from `@asgardeo/vue`, which
30
+ * itself is platform-aware (routes to V1 authenticator or V2 component flow).
31
+ *
32
+ * @example
33
+ * ```vue
34
+ * <AsgardeoSignIn @success="onSignIn" @error="onError" />
35
+ * ```
36
+ */
37
+ declare const SignIn: Component;
38
+ export default SignIn;
@@ -0,0 +1,60 @@
1
+ import { BaseSignIn } from "@asgardeo/vue";
2
+ import { defineComponent, h } from "vue";
3
+ import { navigateTo } from "#app";
4
+ import { useAsgardeo } from "#imports";
5
+ const SignIn = defineComponent({
6
+ emits: ["error", "success"],
7
+ name: "SignIn",
8
+ props: {
9
+ className: { default: "", type: String },
10
+ size: {
11
+ default: "medium",
12
+ type: String
13
+ },
14
+ variant: {
15
+ default: "outlined",
16
+ type: String
17
+ }
18
+ },
19
+ setup(props, { emit, attrs }) {
20
+ const { signIn, afterSignInUrl, isInitialized, isLoading } = useAsgardeo();
21
+ const handleInitialize = async () => (
22
+ // Pass flowId='' to trigger the embedded-flow initiation path in useAsgardeo.
23
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
+ await signIn({ flowId: "" }, {})
25
+ );
26
+ const handleOnSubmit = async (payload, request) => await signIn(payload, request);
27
+ const handleSuccess = async (authData) => {
28
+ emit("success", authData);
29
+ if (authData && afterSignInUrl) {
30
+ if (import.meta.client) {
31
+ const url = new URL(afterSignInUrl, window.location.origin);
32
+ Object.entries(authData).forEach(([key, value]) => {
33
+ if (value !== void 0 && value !== null) {
34
+ url.searchParams.append(key, String(value));
35
+ }
36
+ });
37
+ await navigateTo(url.pathname + url.search + url.hash);
38
+ } else {
39
+ await navigateTo(afterSignInUrl);
40
+ }
41
+ }
42
+ };
43
+ return () => h(BaseSignIn, {
44
+ ...attrs,
45
+ afterSignInUrl,
46
+ class: props.className,
47
+ isLoading: (isLoading?.value ?? false) || !(isInitialized?.value ?? true),
48
+ onError: (err) => emit("error", err),
49
+ onInitialize: handleInitialize,
50
+ onSubmit: handleOnSubmit,
51
+ onSuccess: handleSuccess,
52
+ showLogo: true,
53
+ showSubtitle: true,
54
+ showTitle: true,
55
+ size: props.size,
56
+ variant: props.variant
57
+ });
58
+ }
59
+ });
60
+ export default SignIn;
@@ -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 type { BaseSignUpRenderProps } from '@asgardeo/vue';
19
+ import { type Component } from 'vue';
20
+ export type SignUpRenderProps = BaseSignUpRenderProps;
21
+ /**
22
+ * Nuxt-specific SignUp container for the embedded registration flow.
23
+ *
24
+ * Mirrors the Vue SDK's `SignUp` container but replaces all `window.location`
25
+ * redirects with Nuxt's `navigateTo` for SSR-safe navigation after a
26
+ * successful sign-up.
27
+ *
28
+ * Uses `useAsgardeo()` from the Nuxt auto-import layer and delegates all UI
29
+ * rendering to {@link BaseSignUp} from `@asgardeo/vue`.
30
+ *
31
+ * Additionally, `window.location.href` for OAuth redirect URLs is replaced
32
+ * with `navigateTo` so the redirect works in both SSR and CSR contexts.
33
+ *
34
+ * @example
35
+ * ```vue
36
+ * <AsgardeoSignUp @complete="onComplete" @error="onError" />
37
+ * ```
38
+ */
39
+ declare const SignUp: Component;
40
+ export default SignUp;
@@ -0,0 +1,79 @@
1
+ import {
2
+ EmbeddedFlowResponseType,
3
+ EmbeddedFlowType
4
+ } from "@asgardeo/browser";
5
+ import { BaseSignUp } from "@asgardeo/vue";
6
+ import { defineComponent, h } from "vue";
7
+ import { navigateTo } from "#app";
8
+ import { useAsgardeo } from "#imports";
9
+ const SignUp = defineComponent({
10
+ name: "SignUp",
11
+ props: {
12
+ afterSignUpUrl: { default: void 0, type: String },
13
+ buttonClassName: { default: "", type: String },
14
+ className: { default: "", type: String },
15
+ errorClassName: { default: "", type: String },
16
+ inputClassName: { default: "", type: String },
17
+ messageClassName: { default: "", type: String },
18
+ onComplete: { default: void 0, type: Function },
19
+ onError: { default: void 0, type: Function },
20
+ shouldRedirectAfterSignUp: { default: true, type: Boolean },
21
+ showSubtitle: { default: true, type: Boolean },
22
+ showTitle: { default: true, type: Boolean },
23
+ size: { default: "medium", type: String },
24
+ variant: { default: "outlined", type: String }
25
+ },
26
+ setup(props, { slots }) {
27
+ const { signUp, isInitialized, applicationId } = useAsgardeo();
28
+ const handleInitialize = async (payload) => {
29
+ let applicationIdFromUrl = null;
30
+ if (import.meta.client) {
31
+ const urlParams = new URL(window.location.href).searchParams;
32
+ applicationIdFromUrl = urlParams.get("applicationId");
33
+ }
34
+ const effectiveApplicationId = applicationId || applicationIdFromUrl || void 0;
35
+ const initialPayload = payload || {
36
+ flowType: EmbeddedFlowType.Registration,
37
+ ...effectiveApplicationId && { applicationId: effectiveApplicationId }
38
+ };
39
+ return await signUp(initialPayload);
40
+ };
41
+ const handleOnSubmit = async (payload) => await signUp(payload);
42
+ const handleComplete = async (response) => {
43
+ props.onComplete?.(response);
44
+ const oauthRedirectUrl = response?.redirectUrl;
45
+ if (props.shouldRedirectAfterSignUp && oauthRedirectUrl) {
46
+ await navigateTo(oauthRedirectUrl, { external: true });
47
+ return;
48
+ }
49
+ if (props.shouldRedirectAfterSignUp && response?.type !== EmbeddedFlowResponseType.Redirection && props.afterSignUpUrl) {
50
+ await navigateTo(props.afterSignUpUrl, { external: true });
51
+ }
52
+ if (props.shouldRedirectAfterSignUp && response?.type === EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL && !response.data.redirectURL.includes("oauth") && !response.data.redirectURL.includes("auth")) {
53
+ await navigateTo(response.data.redirectURL, { external: true });
54
+ }
55
+ };
56
+ return () => h(
57
+ BaseSignUp,
58
+ {
59
+ afterSignUpUrl: props.afterSignUpUrl,
60
+ buttonClassName: props.buttonClassName,
61
+ className: props.className,
62
+ errorClassName: props.errorClassName,
63
+ inputClassName: props.inputClassName,
64
+ isInitialized: isInitialized?.value ?? false,
65
+ messageClassName: props.messageClassName,
66
+ onComplete: handleComplete,
67
+ onError: props.onError,
68
+ onInitialize: handleInitialize,
69
+ onSubmit: handleOnSubmit,
70
+ showSubtitle: props.showSubtitle,
71
+ showTitle: props.showTitle,
72
+ size: props.size,
73
+ variant: props.variant
74
+ },
75
+ slots["default"] ? { default: (renderProps) => slots["default"](renderProps) } : void 0
76
+ );
77
+ }
78
+ });
79
+ export default SignUp;
@@ -0,0 +1,36 @@
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 { type Component } from 'vue';
19
+ /**
20
+ * Nuxt-specific Loading control component.
21
+ *
22
+ * Renders its default slot while Asgardeo is initialising. Renders the
23
+ * `fallback` slot (if provided) once loading is complete.
24
+ *
25
+ * Uses `useAsgardeo()` from the Nuxt auto-import layer.
26
+ *
27
+ * @example
28
+ * ```vue
29
+ * <AsgardeoLoading>
30
+ * <Spinner />
31
+ * <template #fallback><NuxtPage /></template>
32
+ * </AsgardeoLoading>
33
+ * ```
34
+ */
35
+ declare const Loading: Component;
36
+ export default Loading;
@@ -0,0 +1,17 @@
1
+ import { Fragment, defineComponent, h } from "vue";
2
+ import { useAsgardeo } from "#imports";
3
+ const Loading = defineComponent({
4
+ name: "Loading",
5
+ setup(_props, { slots }) {
6
+ const { isLoading } = useAsgardeo();
7
+ return () => {
8
+ if (!isLoading.value) {
9
+ const fallback = slots["fallback"]?.();
10
+ return fallback ? h(Fragment, {}, fallback) : null;
11
+ }
12
+ const content = slots["default"]?.();
13
+ return content ? h(Fragment, {}, content) : null;
14
+ };
15
+ }
16
+ });
17
+ export default Loading;
@@ -0,0 +1,38 @@
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 { type Component } from 'vue';
19
+ /**
20
+ * Nuxt-specific SignedIn control component.
21
+ *
22
+ * Renders its default slot only when the user is authenticated. Renders the
23
+ * `fallback` slot (if provided) when the user is not signed in.
24
+ *
25
+ * Uses `useAsgardeo()` from the Nuxt auto-import layer so it reads from the
26
+ * ASGARDEO_KEY context wired up by the Nuxt plugin — not directly from
27
+ * `@asgardeo/vue`.
28
+ *
29
+ * @example
30
+ * ```vue
31
+ * <AsgardeoSignedIn>
32
+ * <p>Welcome!</p>
33
+ * <template #fallback><p>Please sign in.</p></template>
34
+ * </AsgardeoSignedIn>
35
+ * ```
36
+ */
37
+ declare const SignedIn: Component;
38
+ export default SignedIn;
@@ -0,0 +1,17 @@
1
+ import { Fragment, defineComponent, h } from "vue";
2
+ import { useAsgardeo } from "#imports";
3
+ const SignedIn = defineComponent({
4
+ name: "SignedIn",
5
+ setup(_props, { slots }) {
6
+ const { isSignedIn } = useAsgardeo();
7
+ return () => {
8
+ if (!isSignedIn.value) {
9
+ const fallback = slots["fallback"]?.();
10
+ return fallback ? h(Fragment, {}, fallback) : null;
11
+ }
12
+ const content = slots["default"]?.();
13
+ return content ? h(Fragment, {}, content) : null;
14
+ };
15
+ }
16
+ });
17
+ export default SignedIn;
@@ -0,0 +1,37 @@
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 { type Component } from 'vue';
19
+ /**
20
+ * Nuxt-specific SignedOut control component.
21
+ *
22
+ * Renders its default slot only when the user is NOT authenticated. Renders
23
+ * the `fallback` slot (if provided) when the user is already signed in.
24
+ *
25
+ * Uses `useAsgardeo()` from the Nuxt auto-import layer so it reads from the
26
+ * ASGARDEO_KEY context wired up by the Nuxt plugin.
27
+ *
28
+ * @example
29
+ * ```vue
30
+ * <AsgardeoSignedOut>
31
+ * <p>Please sign in.</p>
32
+ * <template #fallback><p>You are signed in.</p></template>
33
+ * </AsgardeoSignedOut>
34
+ * ```
35
+ */
36
+ declare const SignedOut: Component;
37
+ export default SignedOut;
@@ -0,0 +1,17 @@
1
+ import { Fragment, defineComponent, h } from "vue";
2
+ import { useAsgardeo } from "#imports";
3
+ const SignedOut = defineComponent({
4
+ name: "SignedOut",
5
+ setup(_props, { slots }) {
6
+ const { isSignedIn } = useAsgardeo();
7
+ return () => {
8
+ if (isSignedIn.value) {
9
+ const fallback = slots["fallback"]?.();
10
+ return fallback ? h(Fragment, {}, fallback) : null;
11
+ }
12
+ const content = slots["default"]?.();
13
+ return content ? h(Fragment, {}, content) : null;
14
+ };
15
+ }
16
+ });
17
+ export default SignedOut;
@@ -0,0 +1,32 @@
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 { type Component } from 'vue';
19
+ /**
20
+ * Nuxt-specific CreateOrganization container.
21
+ *
22
+ * Reads `createOrganization` from `useOrganization()` (Nuxt auto-import,
23
+ * re-exported from `@asgardeo/vue`) and delegates rendering to
24
+ * {@link BaseCreateOrganization} from `@asgardeo/vue`.
25
+ *
26
+ * @example
27
+ * ```vue
28
+ * <AsgardeoCreateOrganization title="New Team" />
29
+ * ```
30
+ */
31
+ declare const CreateOrganization: Component;
32
+ export default CreateOrganization;
@@ -0,0 +1,29 @@
1
+ import { withVendorCSSClassPrefix } from "@asgardeo/browser";
2
+ import { BaseCreateOrganization } from "@asgardeo/vue";
3
+ import { defineComponent, h } from "vue";
4
+ import { useOrganization } from "#imports";
5
+ const CreateOrganization = defineComponent({
6
+ name: "CreateOrganization",
7
+ props: {
8
+ className: { default: "", type: String },
9
+ description: { default: "Create a new sub-organization.", type: String },
10
+ title: { default: "Create Organization", type: String }
11
+ },
12
+ setup(props, { slots }) {
13
+ const { createOrganization } = useOrganization();
14
+ return () => h(
15
+ BaseCreateOrganization,
16
+ {
17
+ class: withVendorCSSClassPrefix("create-organization--styled"),
18
+ className: props.className,
19
+ description: props.description,
20
+ onCreate: createOrganization ? async (name) => {
21
+ await createOrganization({ description: "", name, parentId: "", type: "TENANT" }, "");
22
+ } : void 0,
23
+ title: props.title
24
+ },
25
+ slots
26
+ );
27
+ }
28
+ });
29
+ export default CreateOrganization;
@@ -0,0 +1,39 @@
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 { type Component } from 'vue';
19
+ /**
20
+ * Nuxt-specific Organization control component.
21
+ *
22
+ * Exposes the current organization via a scoped slot. Renders the `fallback`
23
+ * slot when no organization is selected.
24
+ *
25
+ * Uses `useOrganization()` from the Nuxt auto-import layer (re-exported from
26
+ * `@asgardeo/vue`) so it reads from the OrganizationProvider context.
27
+ *
28
+ * @example
29
+ * ```vue
30
+ * <AsgardeoOrganization>
31
+ * <template #default="{ organization }">
32
+ * <p>Current org: {{ organization.name }}</p>
33
+ * </template>
34
+ * <template #fallback><p>No organization selected.</p></template>
35
+ * </AsgardeoOrganization>
36
+ * ```
37
+ */
38
+ declare const Organization: Component;
39
+ export default Organization;