A codebase for forms automation and more that is to be used in feature like forms and workflows in app and web
npm install superleap-features#### Installation
``bashVia npm
npm install superleap-features
Import Guide
This package is designed to be tree-shakable. Import only what you need using the subpath imports below.
$3
#### 1. Forms - Automation Types and Utils ā
Recommended
`typescript
// Automation types
import type { ComponentLocation } from 'superleap-features/automation';// Automation utilities
import type { executeFunction } from 'superleap-features/automation';
`#### 2. Forms - Automation Node Handlers ā
Recommended
`typescript
// Form, field, and utility handlers
import {
handleFormOnLoad,
handleFormOnSubmit,
handleFieldOnChange,
handleSendHttpRequest,
handleParseJson
} from 'superleap-features/automation/handlers';
`#### 2a. Forms - Mobile Automation Node Handlers ā
For React Native
`typescript
// Mobile-specific handlers for React Native apps
import {
handleFrontendExecuteFunctionMob,
handleScriptTriggerMob,
setGlobalCodeExecutor
} from 'superleap-features/automation/handlersMob';
`#### 3. Forms - CodeEditor Types and Utils ā
Recommended
`typescript
// CodeEditor utilities
import { editorUtilityFunctions } from 'superleap-features/automation/codeEditor';// CodeEditor Types (base, element, layout, media)
import {BaseComponentInstance } from 'superleap-features/automation/codeEditor';
`
#### 4. Forms - CodeEditor Instance Utils ā
Recommended
`typescript
// CodeEditor InstanceUtils (base, element, layout, media)
import { createAudioRecordingInstance } from 'superleap-features/automation/codeEditor/instanceUtils';
`#### 4. Forms - Form Types and Utils ā
Recommended
`typescript
// Form types and Utils
import { SubmitButtonType, getAllFieldInstances } from 'superleap-features/form';`#### 5. Forms - Form Actions ā
Recommended
`typescript
// Granular form actions
import { createAddActions, createGetterActions } from 'superleap-features/form/actions';
`#### 6. Workflows Module ā
Recommended
`typescript
// Workflow utilities
import {
executeWorkflow,
validateWorkflowNode
} from 'superleap-features/workflows';// Workflow types
import {
WorkFlowNode,
ExecutedInOut,
ValidationError
} from 'superleap-features/workflows';
`#### 7. Global Types & Enums ā
Recommended
`typescript
// Global types, enums, and utilities
import {
ErrorCodes,
DataType,
FieldType,
ComponentType,
AccessLevel,
Operators,
ButtonVariant,
ActionTypeSlug,
ViewType
} from 'superleap-features';
`$3
#### Example 1: Form Automation
`typescript
import { handleFormOnLoad, handleFieldOnChange } from 'superleap-features/automation/handlers';
import { SubmitButtonType, getAllFieldInstances } from 'superleap-features/form';const formStore: FormStore = { / ... / };
// Handle form load event
const result = handleFormOnLoad(formStore);
// Handle field change
handleFieldOnChange(formStore, 'fieldId', newValue);
`#### Example 1a: React Native Form Automation
`typescript
import {
handleFrontendExecuteFunctionMob,
setGlobalCodeExecutor
} from 'superleap-features/automation/handlersMob';// IMPORTANT: Set up custom code executor in your React Native app initialization
// This is required because React Native's Metro bundler restricts eval() in node_modules
// Add this in your app's entry point (e.g., App.tsx or index.js)
setGlobalCodeExecutor((code: string) => {
// Use eval directly in your app code (not from node_modules)
// This works because Metro allows eval in app code but not in bundled packages
return eval(
(function() { ${code} }));
});// Now you can use the mobile handlers
const result = await handleFrontendExecuteFunctionMob(
createSuperLeapSDK,
getSDKInstance,
node,
formStore,
nodesOutput,
toast
);
`
$3
1. ā
DO: Use specific subpath imports
`typescript
import { addField } from 'superleap-features/form/actions';
`2. ā ļø AVOID: Importing from main entry when possible
`typescript
import { addField } from 'superleap-features'; // imports everything
`3. ā
DO: Import only what you need
`typescript
import { handleFormOnLoad } from 'superleap-features/automation/handlers';
`4. ā
DO: Use type imports separately
`typescript
import type { FormStore } from 'superleap-features/form';
`$3
`
superleap-features/
āāā index.js # Main entry (all modules)
āāā global.js # Global types, enums & utilities
āāā automation/ # Forms automation
ā āāā index.js # Automation utils & types
ā āāā handlers/ # Node handlers
ā ā āāā index.js # Form, field, utility handlers
ā āāā codeEditor/ # Code editor utilities
ā āāā index.js # Editor utils & types
ā āāā instanceUtils/ # Instance utilities
ā āāā index.js # Base, element, layout, media
āāā form/ # Form module
ā āāā index.js # Form utils & types
ā āāā actions/ # Form actions
ā āāā index.js # Add, delete, update, validate
āāā workflows/ # Workflows module
āāā index.js # Workflow utils & types
``