feat: add isShadow field browser steps
This commit is contained in:
@@ -5,6 +5,7 @@ export interface TextStep {
|
||||
type: 'text';
|
||||
label: string;
|
||||
data: string;
|
||||
isShadow?: boolean;
|
||||
selectorObj: SelectorObject;
|
||||
actionId?: string;
|
||||
}
|
||||
@@ -21,10 +22,12 @@ export interface ListStep {
|
||||
id: number;
|
||||
type: 'list';
|
||||
listSelector: string;
|
||||
isShadow?: boolean;
|
||||
fields: { [key: string]: TextStep };
|
||||
pagination?: {
|
||||
type: string;
|
||||
selector: string;
|
||||
isShadow?: boolean;
|
||||
};
|
||||
limit?: number;
|
||||
actionId?: string;
|
||||
@@ -36,14 +39,14 @@ export interface SelectorObject {
|
||||
selector: string;
|
||||
tag?: string;
|
||||
attribute?: string;
|
||||
shadow?: boolean;
|
||||
isShadow?: boolean;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface BrowserStepsContextType {
|
||||
browserSteps: BrowserStep[];
|
||||
addTextStep: (label: string, data: string, selectorObj: SelectorObject, actionId: string) => void;
|
||||
addListStep: (listSelector: string, fields: { [key: string]: TextStep }, listId: number, actionId: string, pagination?: { type: string; selector: string }, limit?: number) => void
|
||||
addListStep: (listSelector: string, fields: { [key: string]: TextStep }, listId: number, actionId: string, pagination?: { type: string; selector: string, isShadow?: boolean }, limit?: number, isShadow?: boolean) => void
|
||||
addScreenshotStep: (fullPage: boolean, actionId: string) => void;
|
||||
deleteBrowserStep: (id: number) => void;
|
||||
updateBrowserTextStepLabel: (id: number, newLabel: string) => void;
|
||||
@@ -68,7 +71,15 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||
]);
|
||||
};
|
||||
|
||||
const addListStep = (listSelector: string, newFields: { [key: string]: TextStep }, listId: number, actionId: string, pagination?: { type: string; selector: string }, limit?: number) => {
|
||||
const addListStep = (
|
||||
listSelector: string,
|
||||
newFields: { [key: string]: TextStep },
|
||||
listId: number,
|
||||
actionId: string,
|
||||
pagination?: { type: string; selector: string; isShadow?: boolean },
|
||||
limit?: number,
|
||||
isShadow?: boolean
|
||||
) => {
|
||||
setBrowserSteps(prevSteps => {
|
||||
const existingListStepIndex = prevSteps.findIndex(step => step.type === 'list' && step.id === listId);
|
||||
|
||||
@@ -101,7 +112,8 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||
fields: mergedFields,
|
||||
pagination: pagination || existingListStep.pagination,
|
||||
limit: limit,
|
||||
actionId
|
||||
actionId,
|
||||
isShadow: isShadow !== undefined ? isShadow : existingListStep.isShadow
|
||||
};
|
||||
return updatedSteps;
|
||||
} else {
|
||||
@@ -115,7 +127,16 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||
|
||||
return [
|
||||
...prevSteps,
|
||||
{ id: listId, type: 'list', listSelector, fields: fieldsWithActionId, pagination, limit, actionId }
|
||||
{
|
||||
id: listId,
|
||||
type: 'list',
|
||||
listSelector,
|
||||
fields: fieldsWithActionId,
|
||||
pagination,
|
||||
limit,
|
||||
actionId,
|
||||
isShadow
|
||||
}
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user