@asgardeo/nextjs 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +68 -8
  2. package/dist/AsgardeoNextClient.d.ts +44 -9
  3. package/dist/AsgardeoNextClient.js +178 -85
  4. package/dist/AsgardeoNextClient.js.map +1 -1
  5. package/dist/cjs/index.js +28 -2
  6. package/dist/cjs/index.js.map +2 -2
  7. package/dist/client/components/actions/SignInButton/SignInButton.d.ts +2 -2
  8. package/dist/client/components/actions/SignInButton/SignInButton.js +34 -7
  9. package/dist/client/components/actions/SignInButton/SignInButton.js.map +1 -1
  10. package/dist/client/components/actions/SignOutButton/SignOutButton.d.ts +1 -2
  11. package/dist/client/components/actions/SignOutButton/SignOutButton.js +25 -4
  12. package/dist/client/components/actions/SignOutButton/SignOutButton.js.map +1 -1
  13. package/dist/client/components/actions/SignUpButton/SignUpButton.d.ts +38 -14
  14. package/dist/client/components/actions/SignUpButton/SignUpButton.js +69 -15
  15. package/dist/client/components/actions/SignUpButton/SignUpButton.js.map +1 -1
  16. package/dist/client/components/control/SignedIn/SignedIn.js +3 -17
  17. package/dist/client/components/control/SignedIn/SignedIn.js.map +1 -1
  18. package/dist/client/components/control/SignedOut/SignedOut.js +3 -17
  19. package/dist/client/components/control/SignedOut/SignedOut.js.map +1 -1
  20. package/dist/client/components/presentation/SignIn/SignIn.d.ts +69 -0
  21. package/dist/client/components/presentation/SignIn/SignIn.js +85 -0
  22. package/dist/client/components/presentation/SignIn/SignIn.js.map +1 -0
  23. package/dist/client/components/presentation/SignUp/SignUp.d.ts +55 -0
  24. package/dist/client/components/presentation/SignUp/SignUp.js +70 -0
  25. package/dist/client/components/presentation/SignUp/SignUp.js.map +1 -0
  26. package/dist/client/components/presentation/UserDropdown/UserDropdown.d.ts +105 -0
  27. package/dist/client/components/presentation/UserDropdown/UserDropdown.js +106 -0
  28. package/dist/client/components/presentation/UserDropdown/UserDropdown.js.map +1 -0
  29. package/dist/client/components/presentation/UserProfile/UserProfile.d.ts +49 -0
  30. package/dist/client/components/presentation/UserProfile/UserProfile.js +57 -0
  31. package/dist/client/components/presentation/UserProfile/UserProfile.js.map +1 -0
  32. package/dist/client/contexts/Asgardeo/AsgardeoContext.d.ts +1 -8
  33. package/dist/client/contexts/Asgardeo/AsgardeoContext.js +13 -1
  34. package/dist/client/contexts/Asgardeo/AsgardeoContext.js.map +1 -1
  35. package/dist/client/contexts/Asgardeo/AsgardeoProvider.d.ts +15 -5
  36. package/dist/client/contexts/Asgardeo/AsgardeoProvider.js +119 -37
  37. package/dist/client/contexts/Asgardeo/AsgardeoProvider.js.map +1 -1
  38. package/dist/index.d.ts +14 -0
  39. package/dist/index.js +9 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/middleware/asgardeoMiddleware.d.ts +63 -0
  42. package/dist/middleware/asgardeoMiddleware.js +115 -0
  43. package/dist/middleware/asgardeoMiddleware.js.map +1 -0
  44. package/dist/server/AsgardeoProvider.d.ts +6 -3
  45. package/dist/server/AsgardeoProvider.js +42 -3
  46. package/dist/server/AsgardeoProvider.js.map +1 -1
  47. package/dist/server/actions/getClientOrigin.d.ts +2 -0
  48. package/dist/server/actions/getClientOrigin.js +10 -0
  49. package/dist/server/actions/getClientOrigin.js.map +1 -0
  50. package/dist/server/actions/getUserAction.d.ts +35 -0
  51. package/dist/server/actions/getUserAction.js +35 -0
  52. package/dist/server/actions/getUserAction.js.map +1 -0
  53. package/dist/server/actions/getUserProfileAction.d.ts +40 -0
  54. package/dist/server/actions/getUserProfileAction.js +45 -0
  55. package/dist/server/actions/getUserProfileAction.js.map +1 -0
  56. package/dist/server/actions/handleOAuthCallbackAction.d.ts +33 -0
  57. package/dist/server/actions/handleOAuthCallbackAction.js +80 -0
  58. package/dist/server/actions/handleOAuthCallbackAction.js.map +1 -0
  59. package/dist/server/actions/isSignedIn.d.ts +1 -1
  60. package/dist/server/actions/isSignedIn.js +5 -5
  61. package/dist/server/actions/isSignedIn.js.map +1 -1
  62. package/dist/server/actions/signInAction.d.ts +35 -0
  63. package/dist/server/actions/signInAction.js +71 -0
  64. package/dist/server/actions/signInAction.js.map +1 -0
  65. package/dist/server/actions/signOutAction.d.ts +25 -0
  66. package/dist/server/actions/signOutAction.js +33 -0
  67. package/dist/server/actions/signOutAction.js.map +1 -0
  68. package/dist/server/actions/signUpAction.d.ts +35 -0
  69. package/dist/server/actions/signUpAction.js +52 -0
  70. package/dist/server/actions/signUpAction.js.map +1 -0
  71. package/dist/server/actions/updateUserProfileAction.d.ts +36 -0
  72. package/dist/server/actions/updateUserProfileAction.js +41 -0
  73. package/dist/server/actions/updateUserProfileAction.js.map +1 -0
  74. package/dist/utils/decorateConfigWithNextEnv.js +5 -1
  75. package/dist/utils/decorateConfigWithNextEnv.js.map +1 -1
  76. package/package.json +14 -4
@@ -17,11 +17,13 @@
17
17
  */
18
18
  'use client';
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
- import { forwardRef } from 'react';
21
- import InternalAuthAPIRoutesConfig from '../../../../configs/InternalAuthAPIRoutesConfig';
22
- import { BaseSignInButton } from '@asgardeo/react';
20
+ import { forwardRef, useState } from 'react';
21
+ import { AsgardeoRuntimeError } from '@asgardeo/node';
22
+ import { BaseSignInButton, useTranslation } from '@asgardeo/react';
23
+ import useAsgardeo from '../../../../client/contexts/Asgardeo/useAsgardeo';
24
+ import { useRouter } from 'next/navigation';
23
25
  /**
24
- * SignInButton component that supports both render props and traditional props patterns for Next.js.
26
+ * SignInButton component that uses server actions for authentication in Next.js.
25
27
  *
26
28
  * @example Using render props
27
29
  * ```tsx
@@ -40,12 +42,37 @@ import { BaseSignInButton } from '@asgardeo/react';
40
42
  * ```
41
43
  *
42
44
  * @remarks
43
- * In Next.js with server actions, the sign-in is handled via form submission.
45
+ * In Next.js with server actions, the sign-in is handled via the server action.
44
46
  * When using render props, the custom button should use `type="submit"` instead of `onClick={signIn}`.
45
47
  * The `signIn` function in render props is provided for API consistency but should not be used directly.
46
48
  */
47
- const SignInButton = forwardRef(({ className, style, ...rest }, ref) => {
48
- return (_jsx("form", { action: InternalAuthAPIRoutesConfig.signIn, children: _jsx(BaseSignInButton, { className: className, style: style, ref: ref, type: "submit", ...rest }) }));
49
+ const SignInButton = forwardRef(({ className, style, children, preferences, onClick, ...rest }, ref) => {
50
+ const { signIn, signInUrl } = useAsgardeo();
51
+ const router = useRouter();
52
+ const { t } = useTranslation(preferences?.i18n);
53
+ const [isLoading, setIsLoading] = useState(false);
54
+ const handleOnClick = async (e) => {
55
+ try {
56
+ setIsLoading(true);
57
+ // If a custom `signInUrl` is provided, use it for navigation.
58
+ if (signInUrl) {
59
+ router.push(signInUrl);
60
+ }
61
+ else {
62
+ await signIn();
63
+ }
64
+ if (onClick) {
65
+ onClick(e);
66
+ }
67
+ }
68
+ catch (error) {
69
+ throw new AsgardeoRuntimeError(`Sign in failed: ${error instanceof Error ? error.message : String(error)}`, 'SignInButton-handleSignIn-RuntimeError-001', 'nextjs', 'Something went wrong while trying to sign in. Please try again later.');
70
+ }
71
+ finally {
72
+ setIsLoading(false);
73
+ }
74
+ };
75
+ return (_jsx(BaseSignInButton, { className: className, style: style, ref: ref, preferences: preferences, onClick: handleOnClick, ...rest, children: children ?? t('elements.buttons.signIn') }));
49
76
  });
50
77
  SignInButton.displayName = 'SignInButton';
51
78
  export default SignInButton;
@@ -1 +1 @@
1
- {"version":3,"file":"SignInButton.js","sourceRoot":"","sources":["../../../../../src/client/components/actions/SignInButton/SignInButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAC,UAAU,EAA8D,MAAM,OAAO,CAAC;AAC9F,OAAO,2BAA2B,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAC,gBAAgB,EAAwB,MAAM,iBAAiB,CAAC;AAOxE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,YAAY,GAAG,UA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AAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,aAAa,GAAG,KAAK,EAAE,CAAgC,EAAiB,EAAE;QAC9E,IAAI,CAAC;YACH,YAAY,CAAC,IAAI,CAAC,CAAC;YAEnB,8DAA8D;YAC9D,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACN,MAAM,MAAM,EAAE,CAAC;YACjB,CAAC;YAED,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,oBAAoB,CAC5B,mBAAmB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAC3E,4CAA4C,EAC5C,QAAQ,EACR,uEAAuE,CACxE,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,gBAAgB,IACf,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,aAAa,KAClB,IAAI,YAEP,QAAQ,IAAI,CAAC,CAAC,yBAAyB,CAAC,GACxB,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,eAAe,YAAY,CAAC"}
@@ -15,7 +15,6 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { FC, PropsWithChildren } from 'react';
19
18
  import { BaseSignOutButtonProps } from '@asgardeo/react';
20
19
  /**
21
20
  * Interface for SignInButton component props.
@@ -38,5 +37,5 @@ export type SignOutButtonProps = BaseSignOutButtonProps;
38
37
  * }
39
38
  * ```
40
39
  */
41
- declare const SignOutButton: FC<PropsWithChildren<SignOutButtonProps>>;
40
+ declare const SignOutButton: import("react").ForwardRefExoticComponent<BaseSignOutButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
42
41
  export default SignOutButton;
@@ -17,9 +17,10 @@
17
17
  */
18
18
  'use client';
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
- import { forwardRef } from 'react';
21
- import InternalAuthAPIRoutesConfig from '../../../../configs/InternalAuthAPIRoutesConfig';
22
- import { BaseSignOutButton } from '@asgardeo/react';
20
+ import { forwardRef, useState } from 'react';
21
+ import { BaseSignOutButton, useTranslation } from '@asgardeo/react';
22
+ import { AsgardeoRuntimeError } from '@asgardeo/node';
23
+ import useAsgardeo from '../../../../client/contexts/Asgardeo/useAsgardeo';
23
24
  /**
24
25
  * SignInButton component. This button initiates the sign-in process when clicked.
25
26
  *
@@ -37,6 +38,26 @@ import { BaseSignOutButton } from '@asgardeo/react';
37
38
  * }
38
39
  * ```
39
40
  */
40
- const SignOutButton = forwardRef(({ className, style, ...rest }, ref) => (_jsx("form", { action: InternalAuthAPIRoutesConfig.signOut, children: _jsx(BaseSignOutButton, { className: className, style: style, ref: ref, type: "submit", ...rest }) })));
41
+ const SignOutButton = forwardRef(({ className, style, preferences, onClick, children, ...rest }, ref) => {
42
+ const { signOut } = useAsgardeo();
43
+ const { t } = useTranslation(preferences?.i18n);
44
+ const [isLoading, setIsLoading] = useState(false);
45
+ const handleOnClick = async (e) => {
46
+ try {
47
+ setIsLoading(true);
48
+ await signOut();
49
+ if (onClick) {
50
+ onClick(e);
51
+ }
52
+ }
53
+ catch (error) {
54
+ throw new AsgardeoRuntimeError(`Sign out failed: ${error instanceof Error ? error.message : String(error)}`, 'SignOutButton-handleOnClick-RuntimeError-001', 'next', 'Something went wrong while trying to sign out. Please try again later.');
55
+ }
56
+ finally {
57
+ setIsLoading(false);
58
+ }
59
+ };
60
+ return (_jsx(BaseSignOutButton, { ref: ref, onClick: handleOnClick, isLoading: isLoading, preferences: preferences, ...rest, children: children ?? t('elements.buttons.signOut') }));
61
+ });
41
62
  export default SignOutButton;
42
63
  //# sourceMappingURL=SignOutButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignOutButton.js","sourceRoot":"","sources":["../../../../../src/client/components/actions/SignOutButton/SignOutButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAK,UAAU,EAAuC,MAAM,OAAO,CAAC;AAC3E,OAAO,2BAA2B,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAC,iBAAiB,EAAyB,MAAM,iBAAiB,CAAC;AAO1E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,aAAa,GAA8C,UAAU,CAIzE,CAAC,EAAC,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAwC,EAAE,GAA2B,EAAgB,EAAE,CAAC,CACjH,eAAM,MAAM,EAAE,2BAA2B,CAAC,OAAO,YAC/C,KAAC,iBAAiB,IAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,QAAQ,KAAK,IAAI,GAAI,GACtF,CACR,CACF,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"SignOutButton.js","sourceRoot":"","sources":["../../../../../src/client/components/actions/SignOutButton/SignOutButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAK,UAAU,EAAwC,QAAQ,EAAa,MAAM,OAAO,CAAC;AACjG,OAAO,EAAC,iBAAiB,EAA0B,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AACpD,OAAO,WAAW,MAAM,kDAAkD,CAAC;AAO3E;;;;;;;;;;;;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License.
17
17
  */
18
- import { FC, PropsWithChildren } from 'react';
18
+ import { ForwardRefExoticComponent, RefAttributes } from 'react';
19
19
  import { BaseSignUpButtonProps } from '@asgardeo/react';
20
20
  /**
21
- * Interface for SignInButton component props.
21
+ * Props interface of {@link SignUpButton}
22
22
  */
23
23
  export type SignUpButtonProps = BaseSignUpButtonProps;
24
24
  /**
25
- * SignInButton component. This button initiates the sign-in process when clicked.
25
+ * SignUpButton component that supports both render props and traditional props patterns.
26
+ * It redirects the user to the Asgardeo sign-up page configured for the application.
26
27
  *
27
- * @example
28
+ * @remarks This component is only supported in browser based React applications (CSR).
29
+ *
30
+ * @example Using render props pattern
31
+ * ```tsx
32
+ * <SignUpButton>
33
+ * {({ signUp, isLoading }) => (
34
+ * <button onClick={signUp} disabled={isLoading}>
35
+ * {isLoading ? 'Creating Account...' : 'Create Account'}
36
+ * </button>
37
+ * )}
38
+ * </SignUpButton>
39
+ * ```
40
+ *
41
+ * @example Using traditional props pattern
28
42
  * ```tsx
29
- * import { SignInButton } from '@asgardeo/auth-react';
43
+ * <SignUpButton className="custom-button">Create Account</SignUpButton>
44
+ * ```
30
45
  *
31
- * const App = () => {
32
- * const buttonRef = useRef<HTMLButtonElement>(null);
33
- * return (
34
- * <SignInButton ref={buttonRef} className="custom-class" style={{ backgroundColor: 'blue' }}>
35
- * Sign In
36
- * </SignInButton>
37
- * );
38
- * }
46
+ * @example Using component-level preferences
47
+ * ```tsx
48
+ * <SignUpButton
49
+ * preferences={{
50
+ * i18n: {
51
+ * bundles: {
52
+ * 'en-US': {
53
+ * translations: {
54
+ * 'buttons.signUp': 'Custom Sign Up Text'
55
+ * }
56
+ * }
57
+ * }
58
+ * }
59
+ * }}
60
+ * >
61
+ * Custom Sign Up
62
+ * </SignUpButton>
39
63
  * ```
40
64
  */
41
- declare const SignUpButton: FC<PropsWithChildren<SignUpButtonProps>>;
65
+ declare const SignUpButton: ForwardRefExoticComponent<SignUpButtonProps & RefAttributes<HTMLButtonElement>>;
42
66
  export default SignUpButton;
@@ -17,26 +17,80 @@
17
17
  */
18
18
  'use client';
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
- import { forwardRef } from 'react';
21
- import InternalAuthAPIRoutesConfig from '../../../../configs/InternalAuthAPIRoutesConfig';
22
- import { BaseSignUpButton } from '@asgardeo/react';
20
+ import { AsgardeoRuntimeError } from '@asgardeo/node';
21
+ import { forwardRef, useState } from 'react';
22
+ import { BaseSignUpButton, useTranslation } from '@asgardeo/react';
23
+ import useAsgardeo from '../../../contexts/Asgardeo/useAsgardeo';
24
+ import { useRouter } from 'next/navigation';
23
25
  /**
24
- * SignInButton component. This button initiates the sign-in process when clicked.
26
+ * SignUpButton component that supports both render props and traditional props patterns.
27
+ * It redirects the user to the Asgardeo sign-up page configured for the application.
25
28
  *
26
- * @example
29
+ * @remarks This component is only supported in browser based React applications (CSR).
30
+ *
31
+ * @example Using render props pattern
32
+ * ```tsx
33
+ * <SignUpButton>
34
+ * {({ signUp, isLoading }) => (
35
+ * <button onClick={signUp} disabled={isLoading}>
36
+ * {isLoading ? 'Creating Account...' : 'Create Account'}
37
+ * </button>
38
+ * )}
39
+ * </SignUpButton>
40
+ * ```
41
+ *
42
+ * @example Using traditional props pattern
27
43
  * ```tsx
28
- * import { SignInButton } from '@asgardeo/auth-react';
44
+ * <SignUpButton className="custom-button">Create Account</SignUpButton>
45
+ * ```
29
46
  *
30
- * const App = () => {
31
- * const buttonRef = useRef<HTMLButtonElement>(null);
32
- * return (
33
- * <SignInButton ref={buttonRef} className="custom-class" style={{ backgroundColor: 'blue' }}>
34
- * Sign In
35
- * </SignInButton>
36
- * );
37
- * }
47
+ * @example Using component-level preferences
48
+ * ```tsx
49
+ * <SignUpButton
50
+ * preferences={{
51
+ * i18n: {
52
+ * bundles: {
53
+ * 'en-US': {
54
+ * translations: {
55
+ * 'buttons.signUp': 'Custom Sign Up Text'
56
+ * }
57
+ * }
58
+ * }
59
+ * }
60
+ * }}
61
+ * >
62
+ * Custom Sign Up
63
+ * </SignUpButton>
38
64
  * ```
39
65
  */
40
- const SignUpButton = forwardRef(({ className, style, ...rest }, ref) => (_jsx("form", { action: InternalAuthAPIRoutesConfig.signUp, children: _jsx(BaseSignUpButton, { className: className, style: style, ref: ref, type: "submit", ...rest }) })));
66
+ const SignUpButton = forwardRef(({ children, onClick, preferences, ...rest }, ref) => {
67
+ const { signUp, signUpUrl } = useAsgardeo();
68
+ const router = useRouter();
69
+ const { t } = useTranslation(preferences?.i18n);
70
+ const [isLoading, setIsLoading] = useState(false);
71
+ const handleSignUp = async (e) => {
72
+ try {
73
+ setIsLoading(true);
74
+ // If a custom `signUpUrl` is provided, use it for navigation.
75
+ if (signUpUrl) {
76
+ router.push(signUpUrl);
77
+ }
78
+ else {
79
+ await signUp();
80
+ }
81
+ if (onClick) {
82
+ onClick(e);
83
+ }
84
+ }
85
+ catch (error) {
86
+ throw new AsgardeoRuntimeError(`Sign up failed: ${error instanceof Error ? error.message : String(error)}`, 'SignUpButton-handleSignUp-RuntimeError-001', 'nextjs', 'Something went wrong while trying to sign up. Please try again later.');
87
+ }
88
+ finally {
89
+ setIsLoading(false);
90
+ }
91
+ };
92
+ return (_jsx(BaseSignUpButton, { ref: ref, onClick: handleSignUp, isLoading: isLoading, signUp: handleSignUp, preferences: preferences, ...rest, children: children ?? t('elements.buttons.signUp') }));
93
+ });
94
+ SignUpButton.displayName = 'SignUpButton';
41
95
  export default SignUpButton;
42
96
  //# sourceMappingURL=SignUpButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignUpButton.js","sourceRoot":"","sources":["../../../../../src/client/components/actions/SignUpButton/SignUpButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAK,UAAU,EAAuC,MAAM,OAAO,CAAC;AAC3E,OAAO,2BAA2B,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAC,gBAAgB,EAAwB,MAAM,iBAAiB,CAAC;AA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AG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,YAAY,GAAG,KAAK,EAAE,CAAiC,EAAiB,EAAE;QAC9E,IAAI,CAAC;YACH,YAAY,CAAC,IAAI,CAAC,CAAC;YAEnB,8DAA8D;YAC9D,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACN,MAAM,MAAM,EAAE,CAAC;YACjB,CAAC;YAED,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,CAAkC,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,oBAAoB,CAC5B,mBAAmB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAC3E,4CAA4C,EAC5C,QAAQ,EACR,uEAAuE,CACxE,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,gBAAgB,IACf,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,KACpB,IAAI,YAEP,QAAQ,IAAI,CAAC,CAAC,yBAAyB,CAAC,GACxB,CACpB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,eAAe,YAAY,CAAC"}
@@ -17,8 +17,7 @@
17
17
  */
18
18
  'use client';
19
19
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
20
- import { useEffect, useState } from 'react';
21
- import isSignedIn from '../../../../server/actions/isSignedIn';
20
+ import useAsgardeo from '../../../contexts/Asgardeo/useAsgardeo';
22
21
  /**
23
22
  * A component that only renders its children when the user is signed in.
24
23
  *
@@ -36,21 +35,8 @@ import isSignedIn from '../../../../server/actions/isSignedIn';
36
35
  * ```
37
36
  */
38
37
  const SignedIn = ({ children, fallback = null, }) => {
39
- const [isSignedInSync, setIsSignedInSync] = useState(null);
40
- useEffect(() => {
41
- (async () => {
42
- try {
43
- const result = await isSignedIn();
44
- setIsSignedInSync(result);
45
- }
46
- catch (error) {
47
- setIsSignedInSync(false);
48
- }
49
- })();
50
- }, []);
51
- if (isSignedInSync === null)
52
- return null;
53
- return _jsx(_Fragment, { children: isSignedInSync ? children : fallback });
38
+ const { isSignedIn } = useAsgardeo();
39
+ return _jsx(_Fragment, { children: isSignedIn ? children : fallback });
54
40
  };
55
41
  export default SignedIn;
56
42
  //# sourceMappingURL=SignedIn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignedIn.js","sourceRoot":"","sources":["../../../../../src/client/components/control/SignedIn/SignedIn.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAmC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,UAAU,MAAM,uCAAuC,CAAC;AAY/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,QAAQ,GAAyC,CAAC,EACtD,QAAQ,EACR,QAAQ,GAAG,IAAI,GACkB,EAAE,EAAE;IACrC,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAC;IAE3E,SAAS,CAAC,GAAG,EAAE;QACb,CAAC,KAAK,IAAmB,EAAE;YACzB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAY,MAAM,UAAU,EAAE,CAAC;gBAE3C,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC5B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,cAAc,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEzC,OAAO,4BAAG,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAI,CAAC;AACrD,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"SignedIn.js","sourceRoot":"","sources":["../../../../../src/client/components/control/SignedIn/SignedIn.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAGb,OAAO,WAAW,MAAM,wCAAwC,CAAC;AAYjE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,QAAQ,GAAyC,CAAC,EACtD,QAAQ,EACR,QAAQ,GAAG,IAAI,GACkB,EAAE,EAAE;IACrC,MAAM,EAAC,UAAU,EAAC,GAAG,WAAW,EAAE,CAAC;IAEnC,OAAO,4BAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAI,CAAC;AACjD,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -17,8 +17,7 @@
17
17
  */
18
18
  'use client';
19
19
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
20
- import { useEffect, useState } from 'react';
21
- import isSignedIn from '../../../../server/actions/isSignedIn';
20
+ import useAsgardeo from '../../../contexts/Asgardeo/useAsgardeo';
22
21
  /**
23
22
  * A component that only renders its children when the user is signed out.
24
23
  *
@@ -36,21 +35,8 @@ import isSignedIn from '../../../../server/actions/isSignedIn';
36
35
  * ```
37
36
  */
38
37
  const SignedOut = ({ children, fallback = null, }) => {
39
- const [isSignedInSync, setIsSignedInSync] = useState(null);
40
- useEffect(() => {
41
- (async () => {
42
- try {
43
- const result = await isSignedIn();
44
- setIsSignedInSync(result);
45
- }
46
- catch (error) {
47
- setIsSignedInSync(false);
48
- }
49
- })();
50
- }, []);
51
- if (isSignedInSync === null)
52
- return null;
53
- return _jsx(_Fragment, { children: !isSignedInSync ? children : fallback });
38
+ const { isSignedIn } = useAsgardeo();
39
+ return _jsx(_Fragment, { children: !isSignedIn ? children : fallback });
54
40
  };
55
41
  export default SignedOut;
56
42
  //# sourceMappingURL=SignedOut.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignedOut.js","sourceRoot":"","sources":["../../../../../src/client/components/control/SignedOut/SignedOut.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAmC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,UAAU,MAAM,uCAAuC,CAAC;AAY/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,SAAS,GAA0C,CAAC,EACxD,QAAQ,EACR,QAAQ,GAAG,IAAI,GACmB,EAAE,EAAE;IACtC,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAC;IAE3E,SAAS,CAAC,GAAG,EAAE;QACb,CAAC,KAAK,IAAmB,EAAE;YACzB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAY,MAAM,UAAU,EAAE,CAAC;gBAE3C,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC5B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,cAAc,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEzC,OAAO,4BAAG,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAI,CAAC;AACtD,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"SignedOut.js","sourceRoot":"","sources":["../../../../../src/client/components/control/SignedOut/SignedOut.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAGb,OAAO,WAAW,MAAM,wCAAwC,CAAC;AAYjE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,SAAS,GAA0C,CAAC,EACxD,QAAQ,EACR,QAAQ,GAAG,IAAI,GACmB,EAAE,EAAE;IACtC,MAAM,EAAC,UAAU,EAAC,GAAG,WAAW,EAAE,CAAC;IAEnC,OAAO,4BAAG,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAI,CAAC;AAClD,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,69 @@
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 { BaseSignInProps } from '@asgardeo/react';
19
+ import { FC } from 'react';
20
+ /**
21
+ * Props for the SignIn component.
22
+ * Extends BaseSignInProps for full compatibility with the React BaseSignIn component
23
+ */
24
+ export type SignInProps = Pick<BaseSignInProps, 'className' | 'onSuccess' | 'onError' | 'variant' | 'size'>;
25
+ /**
26
+ * A SignIn component for Next.js that provides native authentication flow.
27
+ * This component delegates to the BaseSignIn from @asgardeo/react and requires
28
+ * the API functions to be provided as props.
29
+ *
30
+ * @remarks This component requires the authentication API functions to be provided
31
+ * as props. For a complete working example, you'll need to implement the server-side
32
+ * authentication endpoints or use the traditional OAuth flow with SignInButton.
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * import { SignIn } from '@asgardeo/nextjs';
37
+ * import { executeEmbeddedSignInFlow } from '@asgardeo/browser';
38
+ *
39
+ * const LoginPage = () => {
40
+ * const handleInitialize = async () => {
41
+ * return await executeEmbeddedSignInFlow({
42
+ * response_mode: 'direct',
43
+ * });
44
+ * };
45
+ *
46
+ * const handleSubmit = async (flow) => {
47
+ * return await executeEmbeddedSignInFlow({ flow });
48
+ * };
49
+ *
50
+ * return (
51
+ * <SignIn
52
+ * onInitialize={handleInitialize}
53
+ * onSubmit={handleSubmit}
54
+ * onSuccess={(authData) => {
55
+ * console.log('Authentication successful:', authData);
56
+ * }}
57
+ * onError={(error) => {
58
+ * console.error('Authentication failed:', error);
59
+ * }}
60
+ * size="medium"
61
+ * variant="outlined"
62
+ * afterSignInUrl="/dashboard"
63
+ * />
64
+ * );
65
+ * };
66
+ * ```
67
+ */
68
+ declare const SignIn: FC<SignInProps>;
69
+ export default SignIn;
@@ -0,0 +1,85 @@
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
+ 'use client';
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { BaseSignIn } from '@asgardeo/react';
21
+ import useAsgardeo from '../../../contexts/Asgardeo/useAsgardeo';
22
+ /**
23
+ * A SignIn component for Next.js that provides native authentication flow.
24
+ * This component delegates to the BaseSignIn from @asgardeo/react and requires
25
+ * the API functions to be provided as props.
26
+ *
27
+ * @remarks This component requires the authentication API functions to be provided
28
+ * as props. For a complete working example, you'll need to implement the server-side
29
+ * authentication endpoints or use the traditional OAuth flow with SignInButton.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * import { SignIn } from '@asgardeo/nextjs';
34
+ * import { executeEmbeddedSignInFlow } from '@asgardeo/browser';
35
+ *
36
+ * const LoginPage = () => {
37
+ * const handleInitialize = async () => {
38
+ * return await executeEmbeddedSignInFlow({
39
+ * response_mode: 'direct',
40
+ * });
41
+ * };
42
+ *
43
+ * const handleSubmit = async (flow) => {
44
+ * return await executeEmbeddedSignInFlow({ flow });
45
+ * };
46
+ *
47
+ * return (
48
+ * <SignIn
49
+ * onInitialize={handleInitialize}
50
+ * onSubmit={handleSubmit}
51
+ * onSuccess={(authData) => {
52
+ * console.log('Authentication successful:', authData);
53
+ * }}
54
+ * onError={(error) => {
55
+ * console.error('Authentication failed:', error);
56
+ * }}
57
+ * size="medium"
58
+ * variant="outlined"
59
+ * afterSignInUrl="/dashboard"
60
+ * />
61
+ * );
62
+ * };
63
+ * ```
64
+ */
65
+ const SignIn = ({ size = 'medium', variant = 'outlined', ...rest }) => {
66
+ const { signIn, afterSignInUrl } = useAsgardeo();
67
+ const handleInitialize = async () => await signIn({
68
+ flowId: '',
69
+ selectedAuthenticator: {
70
+ authenticatorId: '',
71
+ params: {},
72
+ },
73
+ });
74
+ const handleOnSubmit = async (payload, request) => {
75
+ return await signIn(payload, request);
76
+ };
77
+ return (_jsx(BaseSignIn
78
+ // isLoading={isLoading || !isInitialized}
79
+ , {
80
+ // isLoading={isLoading || !isInitialized}
81
+ afterSignInUrl: afterSignInUrl, onInitialize: handleInitialize, onSubmit: handleOnSubmit, size: size, variant: variant, ...rest }));
82
+ };
83
+ SignIn.displayName = 'SignIn';
84
+ export default SignIn;
85
+ //# sourceMappingURL=SignIn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignIn.js","sourceRoot":"","sources":["../../../../../src/client/components/presentation/SignIn/SignIn.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAQb,OAAO,EAAC,UAAU,EAAkB,MAAM,iBAAiB,CAAC;AAE5D,OAAO,WAAW,MAAM,wCAAwC,CAAC;AAQjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,MAAM,GAAoB,CAAC,EAAC,IAAI,GAAG,QAAQ,EAAE,OAAO,GAAG,UAAU,EAAE,GAAG,IAAI,EAAc,EAAE,EAAE;IAChG,MAAM,EAAC,MAAM,EAAE,cAAc,EAAC,GAAG,WAAW,EAAE,CAAC;IAE/C,MAAM,gBAAgB,GAAG,KAAK,IAAiD,EAAE,CAC/E,MAAM,MAAM,CAAC;QACX,MAAM,EAAE,EAAE;QACV,qBAAqB,EAAE;YACrB,eAAe,EAAE,EAAE;YACnB,MAAM,EAAE,EAAE;SACX;KACF,CAAC,CAAC;IAEL,MAAM,cAAc,GAAG,KAAK,EAC1B,OAA+C,EAC/C,OAAyC,EACE,EAAE;QAC7C,OAAO,MAAM,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,UAAU;IACT,0CAA0C;;QAA1C,0CAA0C;QAC1C,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,KACZ,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE9B,eAAe,MAAM,CAAC"}
@@ -0,0 +1,55 @@
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 { FC } from 'react';
19
+ import { BaseSignUpProps } from '@asgardeo/react';
20
+ /**
21
+ * Props for the SignUp component.
22
+ */
23
+ export type SignUpProps = BaseSignUpProps;
24
+ /**
25
+ * A styled SignUp component that provides embedded sign-up flow with pre-built styling.
26
+ * This component handles the API calls for sign-up and delegates UI logic to BaseSignUp.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * import { SignUp } from '@asgardeo/react';
31
+ *
32
+ * const App = () => {
33
+ * return (
34
+ * <SignUp
35
+ * onSuccess={(response) => {
36
+ * console.log('Sign-up successful:', response);
37
+ * // Handle successful sign-up (e.g., redirect, show confirmation)
38
+ * }}
39
+ * onError={(error) => {
40
+ * console.error('Sign-up failed:', error);
41
+ * }}
42
+ * onComplete={(redirectUrl) => {
43
+ * // Platform-specific redirect handling (e.g., Next.js router.push)
44
+ * router.push(redirectUrl); // or window.location.href = redirectUrl
45
+ * }}
46
+ * size="medium"
47
+ * variant="outlined"
48
+ * afterSignUpUrl="/welcome"
49
+ * />
50
+ * );
51
+ * };
52
+ * ```
53
+ */
54
+ declare const SignUp: FC<SignUpProps>;
55
+ export default SignUp;