@ilife-tech/react-application-flow-renderer 1.0.17 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,6 +16,7 @@ A powerful and flexible React package for rendering dynamic forms with advanced
16
16
  - [Props Reference](#props-reference)
17
17
  - [Field Types](#field-types)
18
18
  - [Advanced Configuration](#advanced-configuration)
19
+ - [Performance & Engine Options](#performance--engine-options)
19
20
  - [Troubleshooting](#troubleshooting)
20
21
  - [Examples & Best Practices](#examples--best-practices)
21
22
 
@@ -314,8 +315,7 @@ function App() {
314
315
  storeVenderData: result,
315
316
  questionGroups,
316
317
  pageRules: Array.isArray(rawPageRules) ? rawPageRules : [],
317
- pageRuleGroup:
318
- Array.isArray(rawPageRuleGroup) ? rawPageRuleGroup : [],
318
+ pageRuleGroup: Array.isArray(rawPageRuleGroup) ? rawPageRuleGroup : [],
319
319
  validationSchema: validationErrors,
320
320
  actionSchema: actionButtons,
321
321
  sectionSchema: sectionList || [],
@@ -777,20 +777,20 @@ async function getStatesByCountry(apiUrl, country) {
777
777
 
778
778
  The `DynamicForm` component accepts the following props:
779
779
 
780
- | Prop | Type | Required | Default | Description |
781
- | ------------------ | ---------- | -------- | ------- | ------------------------------------------------ |
782
- | `questionGroups` | `Array` | Yes | `[]` | Array of question groups defining form structure |
783
- | `actionSchema` | `Array` | No | `[]` | Array of action buttons configuration |
784
- | `onSubmit` | `Function` | No | - | Form submission handler |
785
- | `onApiTrigger` | `Function` | No | - | API trigger event handler |
786
- | `apiConfig` | `Object` | No | `{}` | API configuration options |
787
- | `theme` | `Object` | No | `{}` | Theme customization |
788
- | `validationSchema` | `Array` | No | `[]` | Additional validation rules |
789
- | `pageRules` | `Array` | No | `[]` | Page rules for conditional logic |
780
+ | Prop | Type | Required | Default | Description |
781
+ | ------------------ | ---------- | -------- | ------- | ------------------------------------------------- |
782
+ | `questionGroups` | `Array` | Yes | `[]` | Array of question groups defining form structure |
783
+ | `actionSchema` | `Array` | No | `[]` | Array of action buttons configuration |
784
+ | `onSubmit` | `Function` | No | - | Form submission handler |
785
+ | `onApiTrigger` | `Function` | No | - | API trigger event handler |
786
+ | `apiConfig` | `Object` | No | `{}` | API configuration options |
787
+ | `theme` | `Object` | No | `{}` | Theme customization |
788
+ | `validationSchema` | `Array` | No | `[]` | Additional validation rules |
789
+ | `pageRules` | `Array` | No | `[]` | Page rules for conditional logic |
790
790
  | `pageRuleGroup` | `Array` | No | `[]` | Page rule groups with complex boolean expressions |
791
- | `debug` | `Boolean` | No | `false` | Enable debug mode |
792
- | `formApiRef` | `Object` | No | - | Ref object to access form API methods |
793
- | `toastConfig` | `Object` | No | `{}` | Toast configuration |
791
+ | `debug` | `Boolean` | No | `false` | Enable debug mode |
792
+ | `formApiRef` | `Object` | No | - | Ref object to access form API methods |
793
+ | `toastConfig` | `Object` | No | `{}` | Toast configuration |
794
794
 
795
795
  ### Props Details
796
796
 
@@ -908,6 +908,157 @@ The package supports a wide range of field types to handle various input require
908
908
  | `button` | `ButtonField` | Action button field |
909
909
  | `spinner` | `SpinnerField` | Loading indicator field |
910
910
 
911
+ ## Input Masking and Security
912
+
913
+ The React Dynamic Form Renderer includes advanced **dual masking system** for sensitive data fields, providing both input formatting and security masking capabilities.
914
+
915
+ ### Dual Masking System
916
+
917
+ The package implements a sophisticated dual masking approach:
918
+
919
+ 1. **Input Masking**: Real-time formatting during user input (e.g., `123-45-6789`)
920
+ 2. **Security Masking**: Hide sensitive characters for privacy (e.g., `***-**-6789`)
921
+
922
+ ### Supported Field Types
923
+
924
+ The following field types support dual masking:
925
+
926
+ | Field Type | Input Formatting | Security Masking | Eye Icon Toggle |
927
+ | ------------- | ---------------- | ---------------- | --------------- |
928
+ | `ssn` | ✅ | ✅ | ✅ |
929
+ | `itin` | ✅ | ✅ | ✅ |
930
+ | `phonenumber` | ✅ | ✅ | ✅ |
931
+ | `phone` | ✅ | ✅ | ✅ |
932
+ | `currency` | ✅ | ❌ | ❌ |
933
+ | `number` | ✅ | ❌ | ❌ |
934
+ | `percentage` | ✅ | ❌ | ❌ |
935
+
936
+ ### Configuration Options
937
+
938
+ #### Input Masking
939
+
940
+ ```javascript
941
+ {
942
+ "questionId": "ssn_field",
943
+ "label": "Social Security Number",
944
+ "questionType": "ssn",
945
+ "maskInput": "###-##-####", // Input formatting pattern
946
+ "required": true
947
+ }
948
+ ```
949
+
950
+ #### Security Masking
951
+
952
+ ```javascript
953
+ {
954
+ "questionId": "ssn_field",
955
+ "label": "Social Security Number",
956
+ "questionType": "ssn",
957
+ "maskInput": "###-##-####", // Input formatting
958
+ "maskingType": "prefix", // "prefix" or "suffix"
959
+ "maskingLength": 6, // Number of characters to mask
960
+ "required": true
961
+ }
962
+ ```
963
+
964
+ ### Masking Patterns
965
+
966
+ #### Common Patterns
967
+
968
+ | Field Type | Pattern | Example Input | Formatted | Security Masked |
969
+ | ---------- | ---------------- | ------------- | -------------- | ------------------ |
970
+ | SSN | `###-##-####` | 123456789 | 123-45-6789 | **\*-**-6789 |
971
+ | Phone | `(###) ###-####` | 1234567890 | (123) 456-7890 | (123) 456-\*\*\*\* |
972
+ | ITIN | `###-##-####` | 912456789 | 912-45-6789 | **\*-**-6789 |
973
+
974
+ #### Custom Patterns
975
+
976
+ You can define custom masking patterns using:
977
+
978
+ - `#` for digits (0-9)
979
+ - `*` for any character
980
+ - Special characters (hyphens, parentheses, etc.) are preserved
981
+
982
+ ### Eye Icon Toggle
983
+
984
+ Fields with security masking automatically display an eye icon (👁️/🙈) that allows users to toggle between:
985
+
986
+ - **Masked View**: Shows security masked value (e.g., `***-**-6789`)
987
+ - **Original View**: Shows formatted value (e.g., `123-45-6789`)
988
+
989
+ #### Accessibility Features
990
+
991
+ - **Keyboard Navigation**: Eye icon supports Tab navigation
992
+ - **Keyboard Activation**: Toggle with Enter or Space keys
993
+ - **Screen Reader Support**: Proper ARIA labels and descriptions
994
+ - **Focus Management**: Clear focus indicators
995
+
996
+ ### Advanced Configuration
997
+
998
+ #### Prefix vs Suffix Masking
999
+
1000
+ ```javascript
1001
+ // Prefix masking (mask first N characters)
1002
+ {
1003
+ "maskingType": "prefix",
1004
+ "maskingLength": 6,
1005
+ // "123-45-6789" → "***-**-6789"
1006
+ }
1007
+
1008
+ // Suffix masking (mask last N characters)
1009
+ {
1010
+ "maskingType": "suffix",
1011
+ "maskingLength": 4,
1012
+ // "123-45-6789" → "123-45-****"
1013
+ }
1014
+ ```
1015
+
1016
+ #### Validation with Masking
1017
+
1018
+ The masking system integrates seamlessly with validation:
1019
+
1020
+ ```javascript
1021
+ {
1022
+ "questionId": "ssn_field",
1023
+ "maskInput": "###-##-####",
1024
+ "maskingType": "prefix",
1025
+ "maskingLength": 6,
1026
+ "minLength": 9, // Validates unmasked length
1027
+ "maxLength": 9, // Validates unmasked length
1028
+ "required": true,
1029
+ "validation": {
1030
+ "pattern": "^\\d{9}$", // Validates digits only
1031
+ "message": "Please enter a valid 9-digit SSN"
1032
+ }
1033
+ }
1034
+ ```
1035
+
1036
+ ### Implementation Notes
1037
+
1038
+ - **Real-time Processing**: Masking is applied during user input, not just on blur
1039
+ - **Form Integration**: Masked values are properly integrated with form state
1040
+ - **Performance**: Optimized for large forms with multiple masked fields
1041
+ - **Browser Compatibility**: Works across all modern browsers
1042
+ - **Mobile Support**: Touch-friendly eye icon and responsive design
1043
+
1044
+ ### Troubleshooting
1045
+
1046
+ #### Common Issues
1047
+
1048
+ 1. **Masking Not Applied**: Ensure `maskInput` pattern is correctly formatted
1049
+ 2. **Eye Icon Missing**: Verify both `maskingType` and `maskingLength` are set
1050
+ 3. **Validation Errors**: Check that validation patterns match unmasked values
1051
+ 4. **Performance Issues**: Avoid overly complex masking patterns in large forms
1052
+
1053
+ #### Debug Tips
1054
+
1055
+ ```javascript
1056
+ // Enable console logging for masking operations
1057
+ console.log('Masked Value:', maskedValue);
1058
+ console.log('Display Value:', displayValue);
1059
+ console.log('Mask Config:', maskConfig);
1060
+ ```
1061
+
911
1062
  ## Conditional Logic
912
1063
 
913
1064
  The Dynamic Form Renderer provides powerful conditional logic capabilities through the `pageRules` and `pageRuleGroup` props.
@@ -919,12 +1070,12 @@ Page rules define individual conditions and actions for dynamic form behavior:
919
1070
  ```javascript
920
1071
  const pageRules = [
921
1072
  {
922
- ruleId: "rule1",
923
- triggerQuestionIds: ["101"],
924
- comparison: "equals",
925
- compareValue: "yes",
926
- action: "showquestion",
927
- targetQuestionIds: ["201"]
1073
+ ruleId: 'rule1',
1074
+ triggerQuestionIds: ['101'],
1075
+ comparison: 'equals',
1076
+ compareValue: 'yes',
1077
+ action: 'showquestion',
1078
+ targetQuestionIds: ['201'],
928
1079
  },
929
1080
  // more rules...
930
1081
  ];
@@ -938,13 +1089,13 @@ The enhanced `pageRuleGroup` feature provides sophisticated boolean expressions
938
1089
  // New array-based format with complex boolean expressions
939
1090
  const pageRuleGroup = [
940
1091
  {
941
- questionId: "40374",
942
- evaluationExpression: "rule1 AND rule2"
1092
+ questionId: '40374',
1093
+ evaluationExpression: 'rule1 AND rule2',
943
1094
  },
944
1095
  {
945
- questionId: "40555",
946
- evaluationExpression: "(rule1 AND rule2) OR rule3"
947
- }
1096
+ questionId: '40555',
1097
+ evaluationExpression: '(rule1 AND rule2) OR rule3',
1098
+ },
948
1099
  ];
949
1100
  ```
950
1101
 
@@ -980,6 +1131,38 @@ For detailed documentation on the enhanced pageRuleGroup feature, see the [PageR
980
1131
 
981
1132
  ## Advanced Configuration
982
1133
 
1134
+ ## Performance & Engine Options
1135
+
1136
+ When using the provider-level API, you can tune performance and engine behavior.
1137
+
1138
+ ### FormProvider props
1139
+
1140
+ - `performanceConfig`
1141
+ - `debounceDelayMs: number` (default: 120) – Debounce for textual input processing
1142
+
1143
+ - `engineOptions`
1144
+ - `enablePerActionGating: boolean` (default: true) – Toggle per-action gating via questionRules
1145
+ - `maxEvaluationDepth: number` (default: 20) – Reflexive evaluation depth guard
1146
+
1147
+ ### Example
1148
+
1149
+ ```jsx
1150
+ import { FormProvider } from '@ilife-tech/react-application-flow-renderer/context/FormContext';
1151
+ import DynamicFormInner from '@ilife-tech/react-application-flow-renderer/src/components/core/components/DynamicFormInner';
1152
+
1153
+ <FormProvider
1154
+ formSchema={questionGroups}
1155
+ questionRuleDetails={questionRuleDetails}
1156
+ questionRules={questionRules}
1157
+ performanceConfig={{ debounceDelayMs: 150 }}
1158
+ engineOptions={{ enablePerActionGating: true, maxEvaluationDepth: 20 }}
1159
+ >
1160
+ <DynamicFormInner schema={questionGroups} actionSchema={actionSchema} onSubmit={handleSubmit} />
1161
+ </FormProvider>;
1162
+ ```
1163
+
1164
+ Note: The top-level `DynamicForm` abstraction may not expose these knobs directly. Use `FormProvider` for fine-grained control.
1165
+
983
1166
  ### Toast Notifications
984
1167
 
985
1168
  The Dynamic Form Renderer uses react-toastify for displaying notifications such as error messages, warnings, and success confirmations.
@@ -1705,13 +1888,11 @@ const DynamicApiForm = ({ formId }) => {
1705
1888
  ### Security Best Practices
1706
1889
 
1707
1890
  1. **API Key Management**:
1708
-
1709
1891
  - Never hardcode API keys in your JavaScript code
1710
1892
  - Use environment variables for all sensitive credentials
1711
1893
  - Consider using token exchange services for third-party APIs
1712
1894
 
1713
1895
  2. **Sensitive Data Handling**:
1714
-
1715
1896
  - Use the built-in masking features for fields like SSN and credit card numbers
1716
1897
  - Avoid storing sensitive data in localStorage or sessionStorage
1717
1898
  - Clear sensitive form data after submission
@@ -1724,13 +1905,11 @@ const DynamicApiForm = ({ formId }) => {
1724
1905
  ### Accessibility Guidelines
1725
1906
 
1726
1907
  1. **Screen Reader Support**:
1727
-
1728
1908
  - All form fields include proper ARIA attributes
1729
1909
  - Error messages are announced to screen readers
1730
1910
  - Focus management follows a logical flow
1731
1911
 
1732
1912
  2. **Keyboard Navigation**:
1733
-
1734
1913
  - All interactive elements are focusable
1735
1914
  - Tab order follows a logical sequence
1736
1915
  - Custom components support keyboard interactions