@thunderid/nuxt 0.0.1
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/LICENSE +201 -0
- package/dist/module.d.mts +46 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +216 -0
- package/dist/runtime/components/ThunderIDRoot.d.ts +52 -0
- package/dist/runtime/components/ThunderIDRoot.js +160 -0
- package/dist/runtime/components/actions/SignInButton.d.ts +37 -0
- package/dist/runtime/components/actions/SignInButton.js +51 -0
- package/dist/runtime/components/actions/SignOutButton.d.ts +34 -0
- package/dist/runtime/components/actions/SignOutButton.js +43 -0
- package/dist/runtime/components/actions/SignUpButton.d.ts +33 -0
- package/dist/runtime/components/actions/SignUpButton.js +48 -0
- package/dist/runtime/components/auth/Callback.d.ts +43 -0
- package/dist/runtime/components/auth/Callback.js +93 -0
- package/dist/runtime/components/auth/SignIn.d.ts +38 -0
- package/dist/runtime/components/auth/SignIn.js +60 -0
- package/dist/runtime/components/auth/SignUp.d.ts +40 -0
- package/dist/runtime/components/auth/SignUp.js +79 -0
- package/dist/runtime/components/control/Loading.d.ts +36 -0
- package/dist/runtime/components/control/Loading.js +17 -0
- package/dist/runtime/components/control/SignedIn.d.ts +38 -0
- package/dist/runtime/components/control/SignedIn.js +17 -0
- package/dist/runtime/components/control/SignedOut.d.ts +37 -0
- package/dist/runtime/components/control/SignedOut.js +17 -0
- package/dist/runtime/components/organization/CreateOrganization.d.ts +32 -0
- package/dist/runtime/components/organization/CreateOrganization.js +29 -0
- package/dist/runtime/components/organization/Organization.d.ts +39 -0
- package/dist/runtime/components/organization/Organization.js +17 -0
- package/dist/runtime/components/organization/OrganizationList.d.ts +34 -0
- package/dist/runtime/components/organization/OrganizationList.js +30 -0
- package/dist/runtime/components/organization/OrganizationProfile.d.ts +32 -0
- package/dist/runtime/components/organization/OrganizationProfile.js +32 -0
- package/dist/runtime/components/organization/OrganizationSwitcher.d.ts +36 -0
- package/dist/runtime/components/organization/OrganizationSwitcher.js +26 -0
- package/dist/runtime/components/user/User.d.ts +38 -0
- package/dist/runtime/components/user/User.js +17 -0
- package/dist/runtime/components/user/UserDropdown.d.ts +38 -0
- package/dist/runtime/components/user/UserDropdown.js +45 -0
- package/dist/runtime/components/user/UserProfile.d.ts +35 -0
- package/dist/runtime/components/user/UserProfile.js +35 -0
- package/dist/runtime/composables/useThunderID.d.ts +38 -0
- package/dist/runtime/composables/useThunderID.js +73 -0
- package/dist/runtime/errors/error-codes.d.ts +40 -0
- package/dist/runtime/errors/error-codes.js +19 -0
- package/dist/runtime/errors/index.d.ts +19 -0
- package/dist/runtime/errors/index.js +2 -0
- package/dist/runtime/errors/thunderid-error.d.ts +47 -0
- package/dist/runtime/errors/thunderid-error.js +15 -0
- package/dist/runtime/middleware/auth.d.ts +35 -0
- package/dist/runtime/middleware/auth.js +2 -0
- package/dist/runtime/middleware/defineThunderIDMiddleware.d.ts +53 -0
- package/dist/runtime/middleware/defineThunderIDMiddleware.js +24 -0
- package/dist/runtime/plugins/thunderid.d.ts +39 -0
- package/dist/runtime/plugins/thunderid.js +128 -0
- package/dist/runtime/server/ThunderIDNuxtClient.d.ts +186 -0
- package/dist/runtime/server/ThunderIDNuxtClient.js +384 -0
- package/dist/runtime/server/index.d.ts +33 -0
- package/dist/runtime/server/index.js +3 -0
- package/dist/runtime/server/plugins/thunderid-ssr.d.ts +40 -0
- package/dist/runtime/server/plugins/thunderid-ssr.js +135 -0
- package/dist/runtime/server/routes/auth/branding/branding.get.d.ts +31 -0
- package/dist/runtime/server/routes/auth/branding/branding.get.js +40 -0
- package/dist/runtime/server/routes/auth/organizations/current.get.d.ts +29 -0
- package/dist/runtime/server/routes/auth/organizations/current.get.js +24 -0
- package/dist/runtime/server/routes/auth/organizations/id.get.d.ts +28 -0
- package/dist/runtime/server/routes/auth/organizations/id.get.js +28 -0
- package/dist/runtime/server/routes/auth/organizations/index.get.d.ts +28 -0
- package/dist/runtime/server/routes/auth/organizations/index.get.js +24 -0
- package/dist/runtime/server/routes/auth/organizations/index.post.d.ts +30 -0
- package/dist/runtime/server/routes/auth/organizations/index.post.js +30 -0
- package/dist/runtime/server/routes/auth/organizations/me.get.d.ts +28 -0
- package/dist/runtime/server/routes/auth/organizations/me.get.js +24 -0
- package/dist/runtime/server/routes/auth/organizations/switch.post.d.ts +32 -0
- package/dist/runtime/server/routes/auth/organizations/switch.post.js +49 -0
- package/dist/runtime/server/routes/auth/session/callback.get.d.ts +27 -0
- package/dist/runtime/server/routes/auth/session/callback.get.js +91 -0
- package/dist/runtime/server/routes/auth/session/callback.post.d.ts +48 -0
- package/dist/runtime/server/routes/auth/session/callback.post.js +53 -0
- package/dist/runtime/server/routes/auth/session/session.get.d.ts +26 -0
- package/dist/runtime/server/routes/auth/session/session.get.js +22 -0
- package/dist/runtime/server/routes/auth/session/signin.get.d.ts +29 -0
- package/dist/runtime/server/routes/auth/session/signin.get.js +37 -0
- package/dist/runtime/server/routes/auth/session/signin.post.d.ts +37 -0
- package/dist/runtime/server/routes/auth/session/signin.post.js +102 -0
- package/dist/runtime/server/routes/auth/session/signout.post.d.ts +31 -0
- package/dist/runtime/server/routes/auth/session/signout.post.js +38 -0
- package/dist/runtime/server/routes/auth/session/signup.post.d.ts +36 -0
- package/dist/runtime/server/routes/auth/session/signup.post.js +30 -0
- package/dist/runtime/server/routes/auth/session/token.get.d.ts +29 -0
- package/dist/runtime/server/routes/auth/session/token.get.js +6 -0
- package/dist/runtime/server/routes/auth/user/profile.get.d.ts +29 -0
- package/dist/runtime/server/routes/auth/user/profile.get.js +24 -0
- package/dist/runtime/server/routes/auth/user/profile.patch.d.ts +35 -0
- package/dist/runtime/server/routes/auth/user/profile.patch.js +41 -0
- package/dist/runtime/server/routes/auth/user/user.get.d.ts +25 -0
- package/dist/runtime/server/routes/auth/user/user.get.js +21 -0
- package/dist/runtime/server/utils/event-context.d.ts +49 -0
- package/dist/runtime/server/utils/event-context.js +3 -0
- package/dist/runtime/server/utils/serverSession.d.ts +65 -0
- package/dist/runtime/server/utils/serverSession.js +44 -0
- package/dist/runtime/server/utils/session.d.ts +85 -0
- package/dist/runtime/server/utils/session.js +106 -0
- package/dist/runtime/server/utils/token-refresh.d.ts +42 -0
- package/dist/runtime/server/utils/token-refresh.js +65 -0
- package/dist/runtime/types.d.ts +161 -0
- package/dist/runtime/types.js +0 -0
- package/dist/runtime/utils/createRouteMatcher.d.ts +40 -0
- package/dist/runtime/utils/createRouteMatcher.js +7 -0
- package/dist/runtime/utils/index.d.ts +30 -0
- package/dist/runtime/utils/index.js +1 -0
- package/dist/runtime/utils/log.d.ts +44 -0
- package/dist/runtime/utils/log.js +25 -0
- package/dist/runtime/utils/url-validation.d.ts +49 -0
- package/dist/runtime/utils/url-validation.js +38 -0
- package/dist/types.d.mts +7 -0
- package/package.json +101 -0
|
@@ -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 '@thunderid/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 `useThunderID()` from the Nuxt auto-import layer and delegates all UI
|
|
29
|
+
* rendering to {@link BaseSignUp} from `@thunderid/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
|
+
* <ThunderIDSignUp @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 "@thunderid/browser";
|
|
5
|
+
import { BaseSignUp } from "@thunderid/vue";
|
|
6
|
+
import { defineComponent, h } from "vue";
|
|
7
|
+
import { navigateTo } from "#app";
|
|
8
|
+
import { useThunderID } 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 } = useThunderID();
|
|
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 ThunderID is initialising. Renders the
|
|
23
|
+
* `fallback` slot (if provided) once loading is complete.
|
|
24
|
+
*
|
|
25
|
+
* Uses `useThunderID()` from the Nuxt auto-import layer.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```vue
|
|
29
|
+
* <ThunderIDLoading>
|
|
30
|
+
* <Spinner />
|
|
31
|
+
* <template #fallback><NuxtPage /></template>
|
|
32
|
+
* </ThunderIDLoading>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare const Loading: Component;
|
|
36
|
+
export default Loading;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Fragment, defineComponent, h } from "vue";
|
|
2
|
+
import { useThunderID } from "#imports";
|
|
3
|
+
const Loading = defineComponent({
|
|
4
|
+
name: "Loading",
|
|
5
|
+
setup(_props, { slots }) {
|
|
6
|
+
const { isLoading } = useThunderID();
|
|
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 `useThunderID()` from the Nuxt auto-import layer so it reads from the
|
|
26
|
+
* THUNDERID_KEY context wired up by the Nuxt plugin — not directly from
|
|
27
|
+
* `@thunderid/vue`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```vue
|
|
31
|
+
* <ThunderIDSignedIn>
|
|
32
|
+
* <p>Welcome!</p>
|
|
33
|
+
* <template #fallback><p>Please sign in.</p></template>
|
|
34
|
+
* </ThunderIDSignedIn>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare const SignedIn: Component;
|
|
38
|
+
export default SignedIn;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Fragment, defineComponent, h } from "vue";
|
|
2
|
+
import { useThunderID } from "#imports";
|
|
3
|
+
const SignedIn = defineComponent({
|
|
4
|
+
name: "SignedIn",
|
|
5
|
+
setup(_props, { slots }) {
|
|
6
|
+
const { isSignedIn } = useThunderID();
|
|
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 `useThunderID()` from the Nuxt auto-import layer so it reads from the
|
|
26
|
+
* THUNDERID_KEY context wired up by the Nuxt plugin.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```vue
|
|
30
|
+
* <ThunderIDSignedOut>
|
|
31
|
+
* <p>Please sign in.</p>
|
|
32
|
+
* <template #fallback><p>You are signed in.</p></template>
|
|
33
|
+
* </ThunderIDSignedOut>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare const SignedOut: Component;
|
|
37
|
+
export default SignedOut;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Fragment, defineComponent, h } from "vue";
|
|
2
|
+
import { useThunderID } from "#imports";
|
|
3
|
+
const SignedOut = defineComponent({
|
|
4
|
+
name: "SignedOut",
|
|
5
|
+
setup(_props, { slots }) {
|
|
6
|
+
const { isSignedIn } = useThunderID();
|
|
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 `@thunderid/vue`) and delegates rendering to
|
|
24
|
+
* {@link BaseCreateOrganization} from `@thunderid/vue`.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```vue
|
|
28
|
+
* <ThunderIDCreateOrganization title="New Team" />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
declare const CreateOrganization: Component;
|
|
32
|
+
export default CreateOrganization;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
2
|
+
import { BaseCreateOrganization } from "@thunderid/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
|
+
* `@thunderid/vue`) so it reads from the OrganizationProvider context.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```vue
|
|
30
|
+
* <ThunderIDOrganization>
|
|
31
|
+
* <template #default="{ organization }">
|
|
32
|
+
* <p>Current org: {{ organization.name }}</p>
|
|
33
|
+
* </template>
|
|
34
|
+
* <template #fallback><p>No organization selected.</p></template>
|
|
35
|
+
* </ThunderIDOrganization>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare const Organization: Component;
|
|
39
|
+
export default Organization;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Fragment, defineComponent, h } from "vue";
|
|
2
|
+
import { useOrganization } from "#imports";
|
|
3
|
+
const Organization = defineComponent({
|
|
4
|
+
name: "Organization",
|
|
5
|
+
setup(_props, { slots }) {
|
|
6
|
+
const { currentOrganization } = useOrganization();
|
|
7
|
+
return () => {
|
|
8
|
+
if (!currentOrganization?.value) {
|
|
9
|
+
const fallback = slots["fallback"]?.();
|
|
10
|
+
return fallback ? h(Fragment, {}, fallback) : null;
|
|
11
|
+
}
|
|
12
|
+
const content = slots["default"]?.({ organization: currentOrganization.value });
|
|
13
|
+
return content ? h(Fragment, {}, content) : null;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export default Organization;
|
|
@@ -0,0 +1,34 @@
|
|
|
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 OrganizationList container.
|
|
21
|
+
*
|
|
22
|
+
* Reads organization list context from `useOrganization()` (Nuxt auto-import)
|
|
23
|
+
* and delegates rendering to {@link BaseOrganizationList} from `@thunderid/vue`.
|
|
24
|
+
*
|
|
25
|
+
* Emits a `select` event with the chosen {@link IOrganization} before calling
|
|
26
|
+
* `switchOrganization` so consumers can handle custom post-switch logic.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```vue
|
|
30
|
+
* <ThunderIDOrganizationList @select="handleOrgSelect" />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare const OrganizationList: Component;
|
|
34
|
+
export default OrganizationList;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
2
|
+
import { BaseOrganizationList } from "@thunderid/vue";
|
|
3
|
+
import { defineComponent, h } from "vue";
|
|
4
|
+
import { useOrganization } from "#imports";
|
|
5
|
+
const OrganizationList = defineComponent({
|
|
6
|
+
emits: ["select"],
|
|
7
|
+
name: "OrganizationList",
|
|
8
|
+
props: {
|
|
9
|
+
className: { default: "", type: String }
|
|
10
|
+
},
|
|
11
|
+
setup(props, { slots, emit }) {
|
|
12
|
+
const { myOrganizations, isLoading, switchOrganization } = useOrganization();
|
|
13
|
+
const handleSelect = async (org) => {
|
|
14
|
+
emit("select", org);
|
|
15
|
+
await switchOrganization(org);
|
|
16
|
+
};
|
|
17
|
+
return () => h(
|
|
18
|
+
BaseOrganizationList,
|
|
19
|
+
{
|
|
20
|
+
class: withVendorCSSClassPrefix("organization-list--styled"),
|
|
21
|
+
className: props.className,
|
|
22
|
+
isLoading: isLoading?.value ?? false,
|
|
23
|
+
onSelect: handleSelect,
|
|
24
|
+
organizations: myOrganizations?.value ?? []
|
|
25
|
+
},
|
|
26
|
+
slots
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export default OrganizationList;
|
|
@@ -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 OrganizationProfile container.
|
|
21
|
+
*
|
|
22
|
+
* Reads the current organization from `useOrganization()` (Nuxt auto-import,
|
|
23
|
+
* re-exported from `@thunderid/vue`) and delegates rendering to
|
|
24
|
+
* {@link BaseOrganizationProfile} from `@thunderid/vue`.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```vue
|
|
28
|
+
* <ThunderIDOrganizationProfile :editable="true" />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
declare const OrganizationProfile: Component;
|
|
32
|
+
export default OrganizationProfile;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
2
|
+
import { BaseOrganizationProfile } from "@thunderid/vue";
|
|
3
|
+
import { defineComponent, h } from "vue";
|
|
4
|
+
import { useOrganization } from "#imports";
|
|
5
|
+
const OrganizationProfile = defineComponent({
|
|
6
|
+
name: "OrganizationProfile",
|
|
7
|
+
props: {
|
|
8
|
+
className: { default: "", type: String },
|
|
9
|
+
editable: { default: false, type: Boolean },
|
|
10
|
+
onUpdate: {
|
|
11
|
+
default: void 0,
|
|
12
|
+
type: Function
|
|
13
|
+
},
|
|
14
|
+
title: { default: "Organization Profile", type: String }
|
|
15
|
+
},
|
|
16
|
+
setup(props, { slots }) {
|
|
17
|
+
const { currentOrganization } = useOrganization();
|
|
18
|
+
return () => h(
|
|
19
|
+
BaseOrganizationProfile,
|
|
20
|
+
{
|
|
21
|
+
class: withVendorCSSClassPrefix("organization-profile--styled"),
|
|
22
|
+
className: props.className,
|
|
23
|
+
editable: props.editable,
|
|
24
|
+
onUpdate: props.onUpdate,
|
|
25
|
+
organization: currentOrganization?.value ?? null,
|
|
26
|
+
title: props.title
|
|
27
|
+
},
|
|
28
|
+
slots
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export default OrganizationProfile;
|
|
@@ -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 OrganizationSwitcher container.
|
|
21
|
+
*
|
|
22
|
+
* Reads organization context from `useOrganization()` (Nuxt auto-import,
|
|
23
|
+
* re-exported from `@thunderid/vue`) and delegates rendering to
|
|
24
|
+
* {@link BaseOrganizationSwitcher} from `@thunderid/vue`.
|
|
25
|
+
*
|
|
26
|
+
* The `switchOrganization` action is provided by the OrganizationProvider
|
|
27
|
+
* context set up by {@link ThunderIDRoot}, which ultimately calls the Nitro
|
|
28
|
+
* `/api/auth/switch-org` route — no direct `window.location` usage.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```vue
|
|
32
|
+
* <ThunderIDOrganizationSwitcher />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare const OrganizationSwitcher: Component;
|
|
36
|
+
export default OrganizationSwitcher;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
2
|
+
import { BaseOrganizationSwitcher } from "@thunderid/vue";
|
|
3
|
+
import { defineComponent, h } from "vue";
|
|
4
|
+
import { useOrganization } from "#imports";
|
|
5
|
+
const OrganizationSwitcher = defineComponent({
|
|
6
|
+
name: "OrganizationSwitcher",
|
|
7
|
+
props: {
|
|
8
|
+
className: { default: "", type: String }
|
|
9
|
+
},
|
|
10
|
+
setup(props, { slots }) {
|
|
11
|
+
const { currentOrganization, myOrganizations, isLoading, switchOrganization } = useOrganization();
|
|
12
|
+
return () => h(
|
|
13
|
+
BaseOrganizationSwitcher,
|
|
14
|
+
{
|
|
15
|
+
class: withVendorCSSClassPrefix("organization-switcher--styled"),
|
|
16
|
+
className: props.className,
|
|
17
|
+
currentOrganization: currentOrganization?.value ?? null,
|
|
18
|
+
isLoading: isLoading?.value ?? false,
|
|
19
|
+
onSwitch: switchOrganization,
|
|
20
|
+
organizations: myOrganizations?.value ?? []
|
|
21
|
+
},
|
|
22
|
+
slots
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export default OrganizationSwitcher;
|
|
@@ -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 User control component.
|
|
21
|
+
*
|
|
22
|
+
* Exposes the current authenticated user via a scoped slot. Renders the
|
|
23
|
+
* `fallback` slot when no user is signed in.
|
|
24
|
+
*
|
|
25
|
+
* Uses `useThunderID()` from the Nuxt auto-import layer.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```vue
|
|
29
|
+
* <ThunderIDUser>
|
|
30
|
+
* <template #default="{ user }">
|
|
31
|
+
* <p>Welcome, {{ user.givenName }}!</p>
|
|
32
|
+
* </template>
|
|
33
|
+
* <template #fallback><p>Not signed in.</p></template>
|
|
34
|
+
* </ThunderIDUser>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare const User: Component;
|
|
38
|
+
export default User;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Fragment, defineComponent, h } from "vue";
|
|
2
|
+
import { useThunderID } from "#imports";
|
|
3
|
+
const User = defineComponent({
|
|
4
|
+
name: "User",
|
|
5
|
+
setup(_props, { slots }) {
|
|
6
|
+
const { user } = useThunderID();
|
|
7
|
+
return () => {
|
|
8
|
+
if (!user.value) {
|
|
9
|
+
const fallback = slots["fallback"]?.();
|
|
10
|
+
return fallback ? h(Fragment, {}, fallback) : null;
|
|
11
|
+
}
|
|
12
|
+
const content = slots["default"]?.({ user: user.value });
|
|
13
|
+
return content ? h(Fragment, {}, content) : null;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export default User;
|