Skip to content
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

refactor: flatten project config and make arguments optional #236

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
257 changes: 235 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/elements-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"devDependencies": {
"@hookform/devtools": "^4.3.1",
"@svgr/plugin-svgo": "^8.1.0",
"@testing-library/react": "^16.0.1",
"@types/lodash.merge": "4.6.9",
"esbuild-plugin-svgr": "^2.1.0",
"eslint-plugin-react": "7.37.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function OryTwoStepCard() {
{step === ProcessStep.ChooseAuthMethod && (
<>
{flowType === FlowType.Login && (
<BackButton href={config.project.login_ui_url} />
<BackButton href={config.login_ui_url ?? '/login'} />
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should make assumptions about the library setup here. If we do, this will cause unexpected behavior for customers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm ok, but it kinda sucks that I have to define all of these values when I want to use the SDK

)}
{options.map((option) => (
<Card.AuthMethodListItem
Expand Down
2 changes: 0 additions & 2 deletions packages/elements-react/src/tests/jest/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ const customRender = (

export const defaultConfiguration: OryClientConfiguration = {
name: "test",
project: {
login_ui_url: "http://localhost:4455/login",
recovery_ui_url: "http://localhost:4455/recovery",
registration_ui_url: "http://localhost:4455/registration",
verification_ui_url: "http://localhost:4455/verification",
recovery_enabled: true,
registration_enabled: true,
verification_enabled: true,
},
sdk: {
url: "http://localhost:4455",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function LoginCardFooter() {
const { config } = useOryFlow()
const intl = useIntl()

if (!config.project.registration_enabled) {
if (!config.registration_enabled ?? true) {
return null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ export function DefaultLabel({
{uiTextToFormattedMessage(label, intl)}
</label>
{isPassword &&
config.project.recovery_enabled &&
(config.recovery_enabled ?? true) &&
flowType === FlowType.Login && (
// TODO: make it possible to override with a custom component
<a
href={config.project.recovery_ui_url}
href={config.recovery_ui_url ?? '/recovery'}
className="text-links-link-default hover:underline hover:text-link-hover transition-colors text-sm font-medium"
>
{intl.formatMessage({
Expand Down
Loading
Loading