Skip to content

Commit 7199414

Browse files
committed
Refactor EmbeddedFlowActionVariant: replace 'SOCIAL' with 'OUTLINED' for clarity; update SubmitButton and AuthOptionFactory to support new variant; add ArrowRightLeft icon component and register it in flowIconRegistry
1 parent 553058e commit 7199414

5 files changed

Lines changed: 63 additions & 4 deletions

File tree

packages/javascript/src/models/v2/embedded-flow-v2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ export enum EmbeddedFlowActionVariant {
102102
/** Secondary action button with moderate visual emphasis */
103103
Secondary = 'SECONDARY',
104104

105-
/** Social media action button (e.g., Google, Facebook) */
106-
Social = 'SOCIAL',
105+
/** Outlined action button for secondary emphasis */
106+
Outlined = 'OUTLINED',
107107

108108
/** Success action button for positive confirmations */
109109
Success = 'SUCCESS',

packages/react/src/components/adapters/SubmitButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const ButtonComponent: FC<AdapterProps> = ({
4747
case 'TEXT':
4848
return {color: 'primary' as const, variant: 'text' as const};
4949
case 'SOCIAL':
50+
case 'OUTLINED':
5051
return {color: 'primary' as const, variant: 'outline' as const};
5152
default:
5253
return {color: 'primary' as const, variant: 'solid' as const};

packages/react/src/components/presentation/auth/AuthOptionFactory.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ const createAuthComponentFromFlow = (
143143
options: {
144144
buttonClassName?: string;
145145
inputClassName?: string;
146+
inStack?: boolean;
146147
key?: string | number;
147148
/** Flow metadata for resolving {{meta(...)}} expressions at render time */
148149
meta?: FlowMetadataResponse | null;
@@ -355,16 +356,18 @@ const createAuthComponentFromFlow = (
355356
}
356357

357358
case EmbeddedFlowComponentType.Image: {
359+
const explicitHeight: string = resolve(component.height?.toString());
360+
const explicitWidth: string = resolve(component.width?.toString());
358361
return (
359362
<ImageComponent
360363
key={key}
361364
component={
362365
{
363366
config: {
364367
alt: resolve(component.alt) || resolve(component.label) || 'Image',
365-
height: resolve(component.height.toString()) || 'auto',
368+
height: explicitHeight || (options.inStack ? '50' : 'auto'),
366369
src: resolve(component.src),
367-
width: resolve(component.width.toString()) || '100%',
370+
width: explicitWidth || (options.inStack ? '50' : '100%'),
368371
},
369372
} as any
370373
}
@@ -418,6 +421,7 @@ const createAuthComponentFromFlow = (
418421
authType,
419422
{
420423
...options,
424+
inStack: true,
421425
key: childComponent.id || `${component.id}_${index}`,
422426
},
423427
),
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3+
*
4+
* WSO2 LLC. licenses this file to you under the Apache License,
5+
* Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
import {FC} from 'react';
20+
21+
export interface ArrowRightLeftProps {
22+
/** Color of the icon stroke */
23+
color?: string;
24+
/** Icon size in pixels */
25+
size?: number;
26+
}
27+
28+
/**
29+
* ArrowRightLeft Icon component (lucide-compatible).
30+
*/
31+
const ArrowRightLeft: FC<ArrowRightLeftProps> = ({color = 'currentColor', size = 24}: ArrowRightLeftProps) => (
32+
<svg
33+
xmlns="http://www.w3.org/2000/svg"
34+
width={size}
35+
height={size}
36+
viewBox="0 0 24 24"
37+
fill="none"
38+
stroke={color}
39+
strokeWidth="2"
40+
strokeLinecap="round"
41+
strokeLinejoin="round"
42+
>
43+
<path d="m16 3 4 4-4 4" />
44+
<path d="M20 7H4" />
45+
<path d="m8 21-4-4 4-4" />
46+
<path d="M4 17h16" />
47+
</svg>
48+
);
49+
50+
ArrowRightLeft.displayName = 'ArrowRightLeft';
51+
52+
export default ArrowRightLeft;

packages/react/src/components/primitives/Icons/flowIconRegistry.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import {FC} from 'react';
2020
import ArrowLeftRight from './ArrowLeftRight';
21+
import ArrowRightLeft from './ArrowRightLeft';
2122

2223
export interface FlowIconProps {
2324
color?: string;
@@ -30,6 +31,7 @@ export interface FlowIconProps {
3031
*/
3132
const flowIconRegistry: Record<string, FC<FlowIconProps>> = {
3233
ArrowLeftRight,
34+
ArrowRightLeft,
3335
};
3436

3537
export default flowIconRegistry;

0 commit comments

Comments
 (0)