Skip to content

[CA-4639] True React SDK #270

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

[CA-4639] True React SDK #270

wants to merge 8 commits into from

Conversation

moust
Copy link
Contributor

@moust moust commented Feb 24, 2025

CA-4639

The aime of this RP is to be able to use widgets as React component to be use as follow :

import { createRoot } from 'react-dom/client';
import { Config, createClient } from "@reachfive/identity-core";
import { ReachfiveProvider, Auth } from '@reachfive/identity-ui'

const config: Config = {
  clientId,
  domain,
  language,
  locale
}

const coreClient: Client = createClient(config)

const container = document.getElementById('root')
const root = createRoot(container)
root.render(
  <ReachfiveProvider client={coreClient} config={config} fallback={<p>Loading...</p>}>
    <Auth allowWebAuthnLogin={false} />
  </ReachfiveProvider>
)

Furthermore, ReachfiveProvider leverage the use of Suspense API and expose a fallback property to provide content to render during configuration loading and widget initialization.

@moust moust marked this pull request as draft February 24, 2025 14:02
@moust moust force-pushed the true-react-sdk branch 4 times, most recently from bf8efc5 to f96db63 Compare March 3, 2025 13:44
@moust moust self-assigned this Mar 3, 2025
@moust moust marked this pull request as ready for review March 11, 2025 15:17
@moust moust added the require review Reviews are required label Mar 11, 2025
@moust moust changed the title True React SDK [CA-4639] True React SDK Mar 11, 2025
Copy link

@flofy flofy left a comment

Choose a reason for hiding this comment

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

2 comment and some conflict and that's good

@@ -238,6 +236,7 @@ export function createForm<Model extends Record<PropertyKey, unknown> = {}, P =
};

const handleError = (err: unknown) => {
console.error(err)
Copy link

Choose a reason for hiding this comment

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

perhaps better to remove console no ?

@@ -49,83 +53,81 @@ export interface WidgetProps {
// type PropsWithWidgetProps<P> = P & WidgetProps
type WidgetOptions<P> = Prettify<P & WidgetProps & I18nProps & ThemeProps>

type Widget<P> = (props: P, ctx: Context) => Promise<React.JSX.Element>
// type Widget<P> = (props: P, ctx: Context) => Promise<React.JSX.Element>
Copy link

Choose a reason for hiding this comment

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

why removing type ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Parce qu'il est devenu inutile. Mais par contre j'ai oublié de le retirer complètement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
require review Reviews are required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants