Skip to content

Commit 503d904

Browse files
authored
[HRD-Console] React SDK implementation (#319)
* HRD in Console WIP * Set login function * Form reacting to webhook challenge update * Reorganize the state * Remove comment * Publish beta release * Create changeset * Remove log * Use lastest Core SDK * Revert dev env * Fix leftovers * Adjust the implementation * Write unit tests * Propagate flow cancelled error upstream * Use suffixed token * Adjust Remix SDK * whitespace * Write unit tests for org suffix * Fix dev file * Apply changes based on code review feedback * Add a separate changeset for token storage changes * Fix logout behaviour, debug switching WIP * Remove the logs, store user on switch * Get most recent user handle for the org switching flow * Fix the race condition when storing new user token * Add additional log out test * Extract common bits, refactor org switching flow * Refactor auth flow * Use null factor * Rename symbol * Define handlers per flow
1 parent a7c0b72 commit 503d904

39 files changed

Lines changed: 1369 additions & 576 deletions

.changeset/late-peas-turn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@slashid/react": minor
3+
---
4+
5+
Store user tokens for multiple organizations, suffixed with org ID

.changeset/tough-chairs-glow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@slashid/react": minor
3+
---
4+
5+
Create internal components for the new org switching flow

packages/react-primitives/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
},
7777
"devDependencies": {
7878
"@faker-js/faker": "^8.0.2",
79-
"@slashid/slashid": "3.17.1",
79+
"@slashid/slashid": "3.29.0",
8080
"@storybook/addon-essentials": "7.6.19",
8181
"@storybook/addon-interactions": "7.4.0",
8282
"@storybook/addon-links": "7.4.0",

packages/react/.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
VITE_ORG_ID=
1+
VITE_ORG_ID=
2+
VITE_ORG_SWITCHING_ORG_ID=

packages/react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
},
6161
"devDependencies": {
6262
"@faker-js/faker": "^8.0.2",
63-
"@slashid/slashid": "3.28.0",
63+
"@slashid/slashid": "3.29.0",
6464
"@storybook/addon-essentials": "7.6.19",
6565
"@storybook/addon-interactions": "7.4.0",
6666
"@storybook/addon-links": "7.4.0",

packages/react/src/components/dynamic-flow/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { clsx } from "clsx";
33
import { FormProvider } from "../../context/form-context";
44
import { useCallback, useRef } from "react";
55
import { Handle, LoginOptions } from "../../domain/types";
6-
import { CreateFlowOptions } from "../form/flow";
6+
import { CreateFlowOptions } from "../form/flow/flow.common";
77
import { useFlowState } from "../form/useFlowState";
88
import { AuthenticatingImplementation as Authenticating } from "../form/authenticating";
99
import { Success } from "../form/success";

packages/react/src/components/dynamic-flow/initial.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Factor } from "@slashid/slashid";
33
import { Divider } from "@slashid/react-primitives";
44

55
import { FormProvider } from "../../context/form-context";
6-
import { InitialState } from "../form/flow";
6+
import { InitialState } from "../form/flow/flow.common";
77
import { Logo } from "../form/initial/logo";
88
import { Oidc } from "./oidc";
99
import { Text } from "../text";

packages/react/src/components/form/authenticating/authenticating.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { render, screen } from "@testing-library/react";
22
import { AuthenticatingImplementation as Authenticating } from "./index";
3-
import { AuthenticatingState } from "../flow";
3+
import { AuthenticatingState } from "../flow/flow.common";
44
import {
55
TestSlashIDProvider,
66
TestTextProvider,

packages/react/src/components/form/authenticating/authenticating.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AuthenticatingState } from "../flow";
1+
import { AuthenticatingState } from "../flow/flow.common";
22

33
export type Props = {
44
flowState: AuthenticatingState;

packages/react/src/components/form/authenticating/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { Children, useEffect, useRef, useState } from "react";
2222
import { TOTPState } from "./totp";
2323
import { Delayed } from "@slashid/react-primitives";
2424
import { useInternalFormContext } from "../internal-context";
25-
import { AuthenticatingState } from "../flow";
25+
import { AuthenticatingState } from "../flow/flow.common";
2626
import { TIME_MS } from "../types";
2727
import { Loader } from "./icons";
2828
import {

0 commit comments

Comments
 (0)