From d719e15a504e495f67f190ad974f1ea2d668934a Mon Sep 17 00:00:00 2001 From: Jonas Hungershausen Date: Thu, 24 Oct 2024 09:40:07 +0200 Subject: [PATCH] fix: use correct node to detect two step registration (#249) --- .../src/components/card/__tests__/card-two-step.spec.ts | 4 ++-- .../src/components/card/card-two-step.utils.ts | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/elements-react/src/components/card/__tests__/card-two-step.spec.ts b/packages/elements-react/src/components/card/__tests__/card-two-step.spec.ts index 0812d280d..5c082cbcd 100644 --- a/packages/elements-react/src/components/card/__tests__/card-two-step.spec.ts +++ b/packages/elements-react/src/components/card/__tests__/card-two-step.spec.ts @@ -22,10 +22,10 @@ describe("CardTwoStep/utils", () => { }) describe("isChoosingMethod", () => { - test("should return true if a node has value 'profile:back'", () => { + test("should return true if a node has value 'screen=previous'", () => { const uiNodes: UiNode[] = [ { - attributes: { value: "profile:back" } as UiNodeAttributes, + attributes: { value: "previous", name: "screen" } as UiNodeAttributes, group: UiNodeGroupEnum.Default, } as UiNode, ] diff --git a/packages/elements-react/src/components/card/card-two-step.utils.ts b/packages/elements-react/src/components/card/card-two-step.utils.ts index f948ca141..71c4671d5 100644 --- a/packages/elements-react/src/components/card/card-two-step.utils.ts +++ b/packages/elements-react/src/components/card/card-two-step.utils.ts @@ -4,10 +4,14 @@ import { UiNode, UiNodeGroupEnum } from "@ory/client-fetch" export function isChoosingMethod(uiNodes: UiNode[]): boolean { + console.log(uiNodes) return ( uiNodes.some( (node) => - "value" in node.attributes && node.attributes.value === "profile:back", + "name" in node.attributes && + node.attributes.name === "screen" && + "value" in node.attributes && + node.attributes.value === "previous", ) || uiNodes.some( (node) =>