import { EventEmitter, OnInit, OnChanges, SimpleChanges, OnDestroy, ChangeDetectorRef } from '@angular/core'; import { FormBuilder, FormGroup, FormArray } from '@angular/forms'; import { DynamicSelectFieldConfig } from '../../dynamic-select/dynamic-select-field.component'; import { TemplateVariable, TemplateVariablesFormComponent } from '../template-variables-form/template-variables-form.component'; import * as i0 from "@angular/core"; interface Element { id?: number; name: string; locatorValue?: string; otherLocator?: string[]; [key: string]: any; } export interface VariableDefinition { path: string; default: string | boolean | number | null; mutable: boolean; type?: string; options?: string[]; } export interface ActionTemplate { id?: number; naturalText?: string; displayName?: string; htmlGrammar?: string; searchableGrammar?: string; workspaceType?: string; action?: string; isAddon?: boolean; variables?: Record; allowedValues?: any; data?: any; stepActionType?: any; stepType?: any; displayOrder?: number; } export interface ElementField { key: string; label: string; value: string; type: 'element' | 'test-data' | 'attribute'; } /** Host passes this after elementService.show() so Label Screen Name / Label prefill on edit. */ export interface ElementScreenPrefill { elementId: number; screenNameId?: number; selectedScreenName?: string; } export declare class StepBuilderActionComponent implements OnInit, OnChanges, OnDestroy { private fb; private cdr; showHeader: boolean; /** Increment this counter to trigger "Change Template" from a parent component. */ changeTemplateSignal: number; /** Increment this counter to trigger "Cancel template selection" from a parent component. */ cancelChangeTemplateSignal: number; /** List of action templates to display */ templates: ActionTemplate[]; /** When provided, automatically selects this template on init (edit mode). */ initialTemplate?: ActionTemplate; /** When provided, pre-populates the description field in edit mode. */ initialDescription?: string; /** When provided, pre-populates the metadata field in edit mode. */ initialMetadata?: string; /** When true, enables debug-mode behaviour: auto-selects initialTemplate and pre-fills description/metadata. */ isDebug: boolean; /** When provided, overrides the default isEditMode logic (useful when parent knows edit state independently of initialTemplate). */ editMode?: boolean; get isEditMode(): boolean; /** Placeholder text for search input */ searchPlaceholder: string; /** Function to handle variable processing or custom logic. Can be passed from parent component. */ setTemplateVariables: (variables: ActionTemplate) => any; /** Function to handle advanced settings variables. Can be passed from parent component. */ setAdvancedSettingsVariables: (template: ActionTemplate, testStep?: any) => any[]; /** Centralised HTML grammar computation function. Pass StepBuilderService.computeHtmlGrammar from the host app. */ computeHtmlGrammarFn?: (template: any, variables: any[]) => string; preventSelectTemplate: string[]; elementOptions: Element[]; hasMoreElements: boolean; isLoadingElements: boolean; /** Screen name options for element form autocomplete (from API) */ screenNameOptions: { id?: number; name: string; }[]; /** Whether more screen names are available for infinite scroll */ hasMoreScreenNames: boolean; /** True while parent is loading screen names (search or load more) */ isLoadingScreenNames: boolean; /** Parameter options for test data parameter dropdown (from API) */ parameterOptions: any[]; /** Whether more parameters are available for infinite scroll */ hasMoreParameters: boolean; /** True while parent is loading parameters (search or load more) */ isLoadingParameters: boolean; /** Upload options for upload dropdown (from API) */ uploadOptions: any[]; /** Whether more uploads are available for infinite scroll */ hasMoreUploads: boolean; /** True while parent is loading uploads (search or load more) */ isLoadingUploads: boolean; /** Environment options for environment parameter dropdown (from API) */ environmentOptions: { id: string; name: string; value: string; environment: string; }[]; /** Whether more environments are available for infinite scroll */ hasMoreEnvironments: boolean; /** True while parent is loading environments (search or load more) */ isLoadingEnvironments: boolean; /** Default test data profile ID from test case (if available, profile and data set dropdowns will be disabled) */ defaultTestDataProfileId?: number; /** Default test data start index from test case (data set index in the profile) */ defaultTestDataStartIndex?: number; /** Default test data end index from test case (used for FOR loop context) */ defaultTestDataEndIndex?: number; /** Whether current step creation is happening inside FOR loop context */ isInsideForLoopStep: boolean; /** True when the parent test case has a test data profile configured (testCase.testDataId is set). */ hasTestDataProfile: boolean; /** True while parent is creating the step (API in progress); show loader on Create/Update Step button */ isCreatingStep: boolean; elementScreenPrefill?: ElementScreenPrefill | null; templateChanged: EventEmitter; loadMoreElements: EventEmitter; searchElements: EventEmitter; searchElementsByScreenName: EventEmitter<{ screenNameId: number; searchTerm?: string; }>; createElement: EventEmitter; searchScreenName: EventEmitter; loadMoreScreenNames: EventEmitter; createScreenNameRequest: EventEmitter; searchParameters: EventEmitter; loadMoreParameters: EventEmitter; searchUploads: EventEmitter; loadMoreUploads: EventEmitter; searchEnvironments: EventEmitter; loadMoreEnvironments: EventEmitter; /** Emit when step is created */ createStep: EventEmitter; /** Emit when cancelled */ cancelled: EventEmitter; redirectToParameter: EventEmitter; redirectToEnvironment: EventEmitter; filteredTemplates: ActionTemplate[]; searchValue: string; selectedTemplate: ActionTemplate | null; private previousTemplateForEdit; metadata: string; description: string; advancedExpanded: boolean; templateVariables: TemplateVariable[]; variablesForm: FormArray; advancedSettingsVariables: any[]; advancedVariablesForm: FormArray; updatedHtmlGrammar: string; createElementVisible: boolean; templateVariablesForm?: TemplateVariablesFormComponent; private selectConfigCache; private formValidCache; private lastFormValidationTime; private readonly FORM_VALIDATION_CACHE_MS; private formValueChangesSubscription?; constructor(fb: FormBuilder, cdr: ChangeDetectorRef); /** * Handle element form visibility change */ onElementFormVisibilityChange(visible: boolean): void; onShowElementForm(): void; ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; onSearchChange(value: string): void; onSearchSubmit(value: string): void; onSearchCleared(): void; private applyElementScreenPrefill; applyFilter(): void; /** * Strip HTML tags from a string, returning only the text content * @param htmlString - HTML string to strip tags from * @returns Plain text without HTML tags */ private stripHtmlTags; selectTemplate(template: ActionTemplate): void; private buildVariablesForm; private buildAdvancedVariablesForm; ngOnDestroy(): void; getSelectConfig(variable: any, index: number): DynamicSelectFieldConfig; /** Get form group for a variable by name */ getVariableFormGroup(variableName: string): FormGroup | null; /** Add a new variable to the form array dynamically */ addVariable(variable: any): void; onVariableValueChange(variableName: string, value: any): void; onVariableBooleanChange(variableName: string, value: boolean): void; onAdvancedVariableBooleanChange(variableName: string, value: boolean): void; onAdvancedVariableValueChange(variableName: string, value: any): void; onChangeTemplate(): void; onCancelTemplateSelection(): void; onBack(): void; onCancel(): void; isFormValid(): boolean; trackByTemplate(index: number, template: ActionTemplate): any; trackByVariable(index: number, variable: any): any; onCreateStep(): void; private getCurrentTemplateVariables; private buildTestDataList; private resolveVariableTestDataValue; private resolveSelectedTestDataProfileId; private parseVariableDataType; toggleAdvanced(): void; onElementClick(elementKey: string): void; onElementValueChange(key: string, value: string): void; onTestDataValueChange(key: string, value: string): void; /** * Update HTML grammar by replacing placeholder spans with actual variable values. * Delegates to computeHtmlGrammarFn when provided by the host app (centralised logic in StepBuilderService). */ private updateHtmlGrammar; /** * Check if selector variable is available in templateVariables */ get selectorVariableAvailable(): boolean; /** * Check if parameter variable is available (testData with parameter type) */ get parameterVariableAvailable(): boolean; /** * Check if environment variable is available (testData with environment type) */ get environmentVariableAvailable(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export {};