-
Notifications
You must be signed in to change notification settings - Fork 36
feat(react): add SignIn component and create sample app #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f3f525a
8552313
300b364
7040dc5
914cec2
99d78da
cb4ba07
c2d66f0
852969b
fca6189
91c4e4a
84b0a1f
d2e6b18
3b933b5
e7941bb
db32402
0b3f671
7e6aab8
85d7c5f
b8b7f28
61e5972
113e7b6
773fa44
e2878e2
317d904
b792009
595f9b9
cd58d97
4840051
74d1a91
e739f77
188bf30
baaf5ba
1429b2f
ba87e3c
eebf8f7
90ae0da
22764b8
ee32334
0714b38
30a9459
1460277
2b5259c
e93accf
55cd687
1443211
16a7c5d
ec76186
d16d41e
2eb35c8
50868d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
"nx": "18.2.4" | ||
}, | ||
"workspaces": [ | ||
"packages/*" | ||
"packages/*", | ||
"recipes/*" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's move this to a variable for better readability There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do this in the next PR |
||
brandingFromConsole = await getBrandingPreference(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'; | ||
|
@@ -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'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we move this to a default value of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will address this in the coming PR. |
||
|
||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -20,7 +20,11 @@ import {Common} from './model'; | |||||
|
||||||
export const common: Common = { | ||||||
copyright: '© {{currentYear}} WSO2 LLC.', | ||||||
error: 'Something went wrong. Please try again.', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Do not use single quotes for strings. Always use double quotes. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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', | ||||||
}; |
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', | ||
}; |
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; | ||
} |
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.', | ||
}; |
Uh oh!
There was an error while loading. Please reload this page.