Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f3f525a
feat(react): :sparkles: add SignIn component
movinsilva May 14, 2024
8552313
feat(react): :sparkles: add basic auth fragment
movinsilva May 15, 2024
300b364
feat(react): :bento: add social login svgs
movinsilva May 15, 2024
7040dc5
feat(react): :sparkles: add login options box
movinsilva May 15, 2024
914cec2
feat(react): :sparkles: add totp fragment
movinsilva May 15, 2024
99d78da
chore(sample-app): :tada: init react vite sample app
movinsilva May 15, 2024
cb4ba07
feat(react): :sparkles: export components and models
movinsilva May 15, 2024
c2d66f0
feat(sample-app): :package: add components to sample app
movinsilva May 15, 2024
852969b
feat(react): :sparkles: export components from react
movinsilva May 15, 2024
fca6189
feat(react): :sparkles: add generateThemeSignIn function
movinsilva May 15, 2024
91c4e4a
chore(sample-app): :heavy_plus_sign: add vite plugins for ssl and nod…
movinsilva May 15, 2024
84b0a1f
fix(core): :bug: make the function continue with the default branding…
movinsilva May 15, 2024
d2e6b18
fix(core): :art: remove unwanted import
movinsilva May 15, 2024
3b933b5
feat(react): :sparkles: add a circular progress until branding is fet…
movinsilva May 15, 2024
e7941bb
fix(react): :label: update exported interfaces
movinsilva May 15, 2024
db32402
fix(sample-app): remove strict mode
movinsilva May 15, 2024
0b3f671
feat(react): :sparkles: update alert usage
movinsilva May 15, 2024
7e6aab8
fix(auth-components): :lipstick: add max height for social login images
movinsilva May 15, 2024
85d7c5f
fix(react): :bug: update usages of `any` type
movinsilva May 15, 2024
b8b7f28
feat(react): :lipstick: update the button to get color from branding
movinsilva May 15, 2024
61e5972
feat(react): :sparkles: add email otp fragment
movinsilva May 15, 2024
113e7b6
feat(core): :sparkles: add localization for email otp
movinsilva May 15, 2024
773fa44
fix(react): :fire: remove a property from AuthContext interface
movinsilva May 15, 2024
e2878e2
refactor(core): :recycle: move defaultName to a separate constant
movinsilva May 15, 2024
317d904
refactor(react): :recycle: rename parts variable to keySegments in us…
movinsilva May 15, 2024
b792009
feat(react): :bento: add email icon
movinsilva May 15, 2024
595f9b9
docs(react): :memo: add js docs for components
movinsilva May 15, 2024
cd58d97
refactor(react): :recycle: update component's parametres
movinsilva May 15, 2024
4840051
docs(react): :memo: add js docs for BasicAuth component
movinsilva May 15, 2024
74d1a91
feat(react): :sparkles: add alert for email otp
movinsilva May 15, 2024
e739f77
refactor(react): :recycle: rename variable isAlert to alert
movinsilva May 15, 2024
188bf30
feat(react): :sparkles: configure footer component
movinsilva May 15, 2024
baaf5ba
feat(react): :sparkles: modify SignIn component to cater all combinat…
movinsilva May 15, 2024
1429b2f
feat(react): :lipstick: add styling for links and refactor authentica…
movinsilva May 15, 2024
ba87e3c
feat(core): :sparkles: add more common text keys
movinsilva May 15, 2024
eebf8f7
refactor: handle alert keys, added localization keys
movinsilva May 15, 2024
90ae0da
feat(react): :lipstick: update border radius of paper
movinsilva May 15, 2024
22764b8
feat(sample-app): :wrench: add config for asgardeo
movinsilva May 15, 2024
ee32334
feat(react): :lipstick: add styling for circular progress component
movinsilva May 15, 2024
0714b38
feat(react): :sparkles: add sms otp
movinsilva May 15, 2024
30a9459
feat(core): :globe_with_meridians: add i18n for sms otp
movinsilva May 15, 2024
1460277
style(react): :art: fix format in css
movinsilva May 15, 2024
2b5259c
feat(react): :sparkles: add SignedIn component
movinsilva May 16, 2024
e93accf
feat(react): :sparkles: add SignedOut component
movinsilva May 16, 2024
55cd687
feat(react): :sparkles: add SignInButton component
movinsilva May 16, 2024
1443211
feat(react): :sparkles: add sign out button and improve styling in si…
movinsilva May 16, 2024
16a7c5d
docs(react): :memo: add js docs for sing in and sign out components
movinsilva May 16, 2024
ec76186
fix: fix sign out function and use hooks in sample app
movinsilva May 16, 2024
d16d41e
fix(react): :bug: fix sign in divider component rendering
movinsilva May 16, 2024
2eb35c8
docs(react): :memo: add js docs
movinsilva May 16, 2024
50868d0
docs(react): :bulb: update comments in SignIn
movinsilva May 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"workspace",
"core",
"react",
"auth-components"
"auth-components",
"sample-app"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"nx": "18.2.4"
},
"workspaces": [
"packages/*"
"packages/*",
"recipes/*"
]
}
10 changes: 7 additions & 3 deletions packages/core/src/api/sign-out.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import {AuthClient, ResponseMode} from '../auth-client';
import AsgardeoUIException from '../exception';
import {UIAuthClient} from '../models/auth-config';

/**
* Sign out the user.
Expand Down Expand Up @@ -45,9 +46,11 @@ const signOut = async (): Promise<void> => {

const formBody: URLSearchParams = new URLSearchParams();

const authClient: UIAuthClient = AuthClient.getInstance();

try {
formBody.append('id_token_hint', await AuthClient.getInstance().getIDToken());
formBody.append('client_id', (await AuthClient.getInstance().getDataLayer().getConfigData()).clientID);
formBody.append('id_token_hint', await authClient.getIDToken());
formBody.append('client_id', (await authClient.getDataLayer().getConfigData()).clientID);
formBody.append('response_mode', ResponseMode.direct);
} catch (error) {
throw new AsgardeoUIException('JS_UI_CORE-SIGNOUT-SO-IV', 'Failed to build the body of the signout request.');
Expand All @@ -60,7 +63,8 @@ const signOut = async (): Promise<void> => {
};

try {
signOutUrl = (await AuthClient.getInstance().getOIDCServiceEndpoints()).endSessionEndpoint;
const {endSessionEndpoint} = await authClient.getOIDCServiceEndpoints();
signOutUrl = endSessionEndpoint;
} catch (error) {
throw new AsgardeoUIException('JS_UI_CORE-SIGNOUT-SO-NF', 'Failed to retrieve the sign out endpoint.');
}
Expand Down
10 changes: 8 additions & 2 deletions packages/core/src/branding/get-branding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ const getBranding = async (props: GetBrandingProps): Promise<Branding> => {
if (!merged) {
let brandingFromConsole: BrandingPreferenceAPIResponse;

if ((await AuthClient.getInstance().getDataLayer().getConfigData()).enableConsoleBranding ?? true) {
brandingFromConsole = await getBrandingPreference();
try {
if ((await AuthClient.getInstance().getDataLayer().getConfigData()).enableConsoleBranding ?? true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this to a variable for better readability

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do this in the next PR

brandingFromConsole = await getBrandingPreference();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brandingFromConsole is this term correct? We are not getting branding from the console rather from the IS/Asgardeo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Since we don't have a unified name yet, there was a discussion sometime back to use more common words without siding with either of them. Any suggestions for a better name?

}
} catch {
/**
* If the branding from the console cannot be fetched, proceed with the default branding.
*/
}

if (brandingFromConsole?.preference?.configs?.isBrandingEnabled) {
Expand Down
13 changes: 6 additions & 7 deletions packages/core/src/i18n/get-localization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import merge from 'lodash.merge';
import {TextObject} from './screens/model';
import getBrandingPreferenceText from '../api/get-branding-preference-text';
import {AuthClient} from '../auth-client';
import AsgardeoUIException from '../exception';
import {UIAuthConfig} from '../models/auth-config';
import {BrandingPreferenceTypes} from '../models/branding-api-response';
import {BrandingPreferenceTextAPIResponse} from '../models/branding-text-api-response';
Expand All @@ -42,21 +41,21 @@ const getLocalization = async (props: GetLocalizationProps): Promise<TextObject>

const configData: AuthClientConfig<UIAuthConfig> = await AuthClient.getInstance().getDataLayer().getConfigData();

const DEFAULT_NAME: string = 'carbon.super';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we move this to a default value of the AuthConfig itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will address this in the coming PR.
Is the actual default value carbon.super?


try {
if (configData.enableConsoleTextBranding ?? true) {
textFromConsoleBranding = await getBrandingPreferenceText({
locale,
name: configData.name ?? 'carbon.super',
name: configData.name ?? DEFAULT_NAME,
screen,
type: configData.type ?? BrandingPreferenceTypes.Org,
});
}
} catch (error) {
throw new AsgardeoUIException(
'JS_UI_CORE-LOCALIZATION-IV',
'Error occurred while fetching text from console branding.',
error.stack,
);
/**
* If the branding from the console cannot be fetched, proceed with the default branding.
*/
Comment on lines -55 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still better to throw this error as this error can be due to various reasons. Better throw the error and do the error handling wherever the function is being used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an usage of the branding-text api. This function needs to continue, as it needs to output a merged text object from the objects it can resolve.

If the api fails, the function still needs to merge the text provided from props with the default text and output them.

Note: often these api calls get failed as they are not configured for many screens.

}

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/i18n/screens/common/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import {Common} from './model';

export const common: Common = {
copyright: '© {{currentYear}} WSO2 LLC.',
error: 'Something went wrong. Please try again.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
error: 'Something went wrong. Please try again.',
error: "Something went wrong. Please try again.",

Do not use single quotes for strings. Always use double quotes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct this in other places as well

or: 'OR',
'prefix.register': "Don't have an account?",
'privacy.policy': 'Privacy Policy',
register: 'Register',
'site.title': 'WSO2 Identity Server',
'terms.of.service': 'Terms of Servicet',
};
4 changes: 4 additions & 0 deletions packages/core/src/i18n/screens/common/fr-FR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import {Common} from './model';

export const common: Common = {
copyright: '© {{currentYear}} WSO2 LLC.',
error: "Quelque chose s'est mal passé. Veuillez réessayer.",
or: 'OU',
'prefix.register': "Vous n'avez pas de compte?",
'privacy.policy': 'Politique de confidentialité',
register: "S'inscrire",
'site.title': 'Identity Server WSO2',
'terms.of.service': 'Conditions de service',
};
4 changes: 4 additions & 0 deletions packages/core/src/i18n/screens/common/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
*/
export interface Common {
copyright: string;
error: string;
or: string;
'prefix.register': string;
'privacy.policy': string;
register: string;
'site.title': string;
'terms.of.service': string;
}
26 changes: 26 additions & 0 deletions packages/core/src/i18n/screens/emailOtp/en-US.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import {EmailOTP} from './model';

export const emailOtp: EmailOTP = {
continue: 'Continue',
'email.otp.heading': 'OTP Verification',
'enter.verification.code.got.by.device': 'Enter the code sent to your email ID.',
'resend.code': 'Resend code',
};
27 changes: 27 additions & 0 deletions packages/core/src/i18n/screens/emailOtp/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
* Interface for the TOTP text.
*/
export interface EmailOTP {
continue: string;
'email.otp.heading': string;
'enter.verification.code.got.by.device': string;
'resend.code': string;
}
84 changes: 84 additions & 0 deletions packages/core/src/i18n/screens/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@
interface Keys {
common: {
copyright: string;
error: string;
or: string;
prefix: {
register: string;
};
privacy: {
policy: string;
};
register: string;
site: {
title: string;
};
Expand All @@ -34,6 +40,28 @@ interface Keys {
};
};
};
emailOtp: {
continue: string;
email: {
otp: {
heading: string;
};
};
enter: {
verification: {
code: {
got: {
by: {
device: string;
};
};
};
};
};
resend: {
code: string;
};
};
login: {
button: string;
enter: {
Expand All @@ -49,8 +77,22 @@ interface Keys {
remember: {
me: string;
};
retry: string;
username: string;
};
smsOtp: {
continue: string;
resend: {
code: string;
};

sms: {
otp: {
heading: string;
subheading: string;
};
};
};
totp: {
continue: string;
enroll: {
Expand All @@ -75,9 +117,15 @@ interface Keys {
export const keys: Keys = {
common: {
copyright: 'common.copyright',
error: 'common.error',
or: 'common.or',
prefix: {
register: 'common.prefix.register',
},
privacy: {
policy: 'common.privacy.policy',
},
register: 'common.register',
site: {
title: 'common.site.title',
},
Expand All @@ -87,6 +135,28 @@ export const keys: Keys = {
},
},
},
emailOtp: {
continue: 'emailOtp.continue',
email: {
otp: {
heading: 'emailOtp.email.otp.heading',
},
},
enter: {
verification: {
code: {
got: {
by: {
device: 'emailOtp.enter.verification.code.got.by.device',
},
},
},
},
},
resend: {
code: 'emailOtp.resend.code',
},
},
login: {
button: 'login.login.button',
enter: {
Expand All @@ -102,8 +172,22 @@ export const keys: Keys = {
remember: {
me: 'login.remember.me',
},
retry: 'login.retry',
username: 'login.username',
},
smsOtp: {
continue: 'smsOtp.continue',
resend: {
code: 'smsOtp.resend.code',
},

sms: {
otp: {
heading: 'smsOtp.sms.otp.heading',
subheading: 'smsOtp.sms.otp.subheading',
},
},
},
totp: {
continue: 'totp.continue',
enroll: {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/i18n/screens/login/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ export const login: Login = {
'login.heading': 'Sign In',
password: 'Password',
'remember.me': 'Remember me on this computer',
retry: 'Login failed! Please check your username and password and try again.',
username: 'Username',
};
1 change: 1 addition & 0 deletions packages/core/src/i18n/screens/login/fr-FR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ export const login: Login = {
'login.heading': 'Se connecter',
password: 'Mot de passe',
'remember.me': 'Se souvenir de moi sur cet ordinateur',
retry: "Échec de la connexion! Veuillez vérifier votre nom d'utilisateur et votre mot de passe et réessayer.",
username: "Nom d'utilisateur",
};
1 change: 1 addition & 0 deletions packages/core/src/i18n/screens/login/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ export interface Login {
'login.heading': string;
password: string;
'remember.me': string;
retry: string;
username: string;
}
26 changes: 26 additions & 0 deletions packages/core/src/i18n/screens/smsOtp/en-US.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import {SmsOTP} from './model';

export const smsOtp: SmsOTP = {
continue: 'Continue',
'resend.code': 'Resend code',
'sms.otp.heading': 'OTP Verification',
'sms.otp.subheading': 'Enter the code sent to your mobile device.',
};
Loading