-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbf29d8
commit 35c0f70
Showing
56 changed files
with
5,978 additions
and
4,332 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright © 2024 Ory Corp | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { PropsWithChildren } from "react" | ||
import { useComponents } from "../../context/component" | ||
import { OryForm } from "./form" | ||
import { UiNode } from "@ory/client-fetch" | ||
|
||
export type OryFormSectionProps = PropsWithChildren<{ | ||
nodes?: UiNode[] | ||
}> | ||
|
||
export function OryFormSection({ children, nodes }: OryFormSectionProps) { | ||
const { Settings } = useComponents() | ||
|
||
return ( | ||
<OryForm nodes={nodes}> | ||
<Settings.Section>{children}</Settings.Section> | ||
</OryForm> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
export * from "./card" | ||
export * from "./form" | ||
export * from "./generic" | ||
export * from "./settings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright © 2024 Ory Corp | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { UiNode } from "@ory/client-fetch" | ||
|
||
export * from "./settings-card" | ||
|
||
export type OrySettingsRecoveryCodesProps = { | ||
codes: string[] | ||
regnerateButton?: UiNode | ||
revealButton?: UiNode | ||
} | ||
|
||
export type OrySettingsTotpProps = | ||
| { | ||
totpImage: UiNode | ||
totpSecret: UiNode | ||
totpInput: UiNode | ||
} | ||
| { | ||
totpUnlink: UiNode | ||
} | ||
|
||
export type OrySettingsOidcProps = { | ||
linkButtons: UiNode[] | ||
unlinkButtons: UiNode[] | ||
} | ||
|
||
export type OrySettingsWebauthnProps = { | ||
nameInput: UiNode | ||
triggerButton: UiNode & { onClick: () => void } | ||
removeButtons: UiNode[] | ||
} | ||
|
||
export type OrySettingsPasskeyProps = { | ||
triggerButton: UiNode & { onClick: () => void } | ||
removeButtons: UiNode[] | ||
} |
45 changes: 45 additions & 0 deletions
45
packages/elements-react/src/components/settings/oidc-settings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright © 2024 Ory Corp | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { UiNode } from "@ory/client-fetch" | ||
import { useComponents } from "../../context" | ||
import { useIntl } from "react-intl" | ||
|
||
const getLinkButtons = (nodes: UiNode[]): UiNode[] => | ||
nodes.filter( | ||
(node) => "name" in node.attributes && node.attributes.name === "link", | ||
) | ||
|
||
const getUnlinkButtons = (nodes: UiNode[]): UiNode[] => | ||
nodes.filter( | ||
(node) => "name" in node.attributes && node.attributes.name === "unlink", | ||
) | ||
|
||
export interface HeadlessSettingsOidcProps { | ||
nodes: UiNode[] | ||
} | ||
|
||
export function OrySettingsOidc({ nodes }: HeadlessSettingsOidcProps) { | ||
const { Settings } = useComponents() | ||
const intl = useIntl() | ||
|
||
const linkButtons = getLinkButtons(nodes) | ||
const unlinkButtons = getUnlinkButtons(nodes) | ||
|
||
return ( | ||
<> | ||
<Settings.SectionContent | ||
title={intl.formatMessage({ id: "settings.oidc.title" })} | ||
description={intl.formatMessage({ id: "settings.oidc.description" })} | ||
> | ||
<Settings.Oidc | ||
linkButtons={linkButtons} | ||
unlinkButtons={unlinkButtons} | ||
/> | ||
</Settings.SectionContent> | ||
<Settings.SectionFooter> | ||
<span>{intl.formatMessage({ id: "settings.oidc.info" })}</span> | ||
</Settings.SectionFooter> | ||
</> | ||
) | ||
} |
Oops, something went wrong.