oa-componentbook 1.0.1-stage.442 → 1.0.1-stage.443

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.
@@ -18,7 +18,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
18
18
  * @param {number} totalStep - The total number of steps in the progress.
19
19
  * @param {string} headingColor - The color used for the step text heading.
20
20
  * @param {string} barColor - The color used for the progress bar.
21
- * @param {boolean} showStepText - Whether to display the step text (Step X out of Y).
22
21
  *
23
22
  * @returns {React.ReactElement} A component displaying the current progress.
24
23
  */
@@ -27,10 +26,9 @@ function ProgressBar(_ref) {
27
26
  currentStep,
28
27
  totalStep,
29
28
  headingColor,
30
- barColor,
31
- showStepText
29
+ barColor
32
30
  } = _ref;
33
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showStepText && /*#__PURE__*/_react.default.createElement("div", {
31
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
34
32
  className: "margin-bottom-8"
35
33
  }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
36
34
  color: headingColor,
@@ -59,14 +57,12 @@ ProgressBar.propTypes = {
59
57
  currentStep: _propTypes.default.number,
60
58
  totalStep: _propTypes.default.number,
61
59
  headingColor: _propTypes.default.string,
62
- barColor: _propTypes.default.string,
63
- showStepText: _propTypes.default.bool
60
+ barColor: _propTypes.default.string
64
61
  };
65
62
  ProgressBar.defaultProps = {
66
63
  currentStep: 1,
67
64
  totalStep: 1,
68
65
  headingColor: 'positive',
69
- barColor: 'positive',
70
- showStepText: true
66
+ barColor: 'positive'
71
67
  };
72
68
  var _default = exports.default = ProgressBar;
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  });
9
9
  exports.default = void 0;
10
10
  require("core-js/modules/web.dom-collections.iterator.js");
11
+ require("core-js/modules/es.json.stringify.js");
11
12
  var _react = _interopRequireWildcard(require("react"));
12
13
  var _Search = _interopRequireDefault(require("@material-ui/icons/Search"));
13
14
  var _FilterList = _interopRequireDefault(require("@material-ui/icons/FilterList"));
@@ -185,12 +186,45 @@ function TableWithSearchAndFilter(_ref) {
185
186
  return keys;
186
187
  }, [filterConfig]);
187
188
 
189
+ // Create a stable string representation of filterValues for required keys
190
+ // This ensures reliable dependency tracking in production builds
191
+ const requiredFieldsSignature = (0, _react.useMemo)(() => requiredKeys.map(key => {
192
+ const value = filterValues[key];
193
+ // Create a stable string representation that changes when value changes
194
+ if (value === undefined || value === null) return "".concat(key, ":null");
195
+ if (value instanceof Date) return "".concat(key, ":").concat(value.getTime());
196
+ return "".concat(key, ":").concat(JSON.stringify(value));
197
+ }).join('|'), [requiredKeys, filterValues]);
198
+
188
199
  // Memoized check if all required fields are filled
189
- const areAllRequiredFieldsFilled = (0, _react.useMemo)(() => requiredKeys.every(requiredKey => {
190
- const value = filterValues[requiredKey];
191
- // Check if value exists and is not empty/null/undefined
192
- return value !== undefined && value !== null && value !== '';
193
- }), [requiredKeys, filterValues]);
200
+ const areAllRequiredFieldsFilled = (0, _react.useMemo)(() => {
201
+ // If no required fields, button should be enabled
202
+ if (requiredKeys.length === 0) {
203
+ return true;
204
+ }
205
+
206
+ // Check each required field has a valid value
207
+ return requiredKeys.every(requiredKey => {
208
+ const value = filterValues[requiredKey];
209
+
210
+ // Check if value exists and is not empty/null/undefined
211
+ // Also handle edge cases: empty arrays, empty objects, etc.
212
+ if (value === undefined || value === null || value === '') {
213
+ return false;
214
+ }
215
+
216
+ // Handle arrays
217
+ if (Array.isArray(value)) {
218
+ return value.length > 0;
219
+ }
220
+
221
+ // Handle objects (but allow Date objects and other valid objects)
222
+ if (typeof value === 'object' && !(value instanceof Date)) {
223
+ return Object.keys(value).length > 0;
224
+ }
225
+ return true;
226
+ });
227
+ }, [requiredKeys, requiredFieldsSignature, filterValues]);
194
228
 
195
229
  // Helper function to determine notFoundContent message
196
230
  const getNotFoundContent = (isApiCallInProgress, query) => {
@@ -1,25 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.object.assign.js");
4
- require("core-js/modules/es.weak-map.js");
5
- require("core-js/modules/web.dom-collections.iterator.js");
6
4
  Object.defineProperty(exports, "__esModule", {
7
5
  value: true
8
6
  });
9
7
  exports.default = void 0;
10
- require("core-js/modules/es.string.trim.js");
11
8
  var _react = _interopRequireDefault(require("react"));
12
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
10
  var _antd = require("antd");
14
- var _SendRounded = _interopRequireDefault(require("@material-ui/icons/SendRounded"));
15
- var _styles = _interopRequireWildcard(require("./styles"));
11
+ var _styles = _interopRequireDefault(require("./styles"));
16
12
  var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
17
- var _MaterialIcon = _interopRequireDefault(require("../oa-component-icons/MaterialIcon"));
18
- var _constants = require("./constants");
19
- const _excluded = ["rows", "placeholder", "maxLength", "className", "variant"],
20
- _excluded2 = ["minRows", "maxRows", "sendIconConfig", "onSend", "value", "onChange", "disabled"];
21
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
+ const _excluded = ["rows", "placeholder", "maxLength", "className"];
23
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
15
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
16
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -28,25 +19,19 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
28
19
  * A custom text area component.
29
20
  *
30
21
  * The component includes the following properties:
31
- * - `rows`: The number of rows for the text area (used for default variant).
22
+ * - `rows`: The number of rows for the text area.
32
23
  * - `placeholder`: The placeholder text for the text area.
33
24
  * - `maxLength`: The maximum length of the input value.
34
25
  * - `className`: Additional CSS class to apply to the text area.
35
- * - `variant`: 'default' or 'gradient' - determines the styling variant.
36
- * - `minRows`: Initial line height for gradient variant (default: 1).
37
- * - `maxRows`: Maximum rows before scrolling starts for gradient variant (default: null for unlimited).
38
- * - `sendIconConfig`: Object with `show` (boolean, default: false) and `disabled` (boolean, default: false) for gradient variant only.
39
- * - `onSend`: Callback function called when send icon is clicked (gradient variant only).
40
26
  * - `antDesignProps`: Any other props to pass to the antd Input.TextArea component.
41
27
  *
42
28
  * The component will apply the following styles:
43
29
  * - A dark grey background when the component is disabled.
44
30
  * - A dark grey text color when the component is disabled.
45
31
  * - A custom style class of `custom-textarea` to the outer element.
46
- * - Gradient border and auto-growing height for gradient variant.
47
32
  *
48
33
  * The component will also apply the following props to the antd Input.TextArea component:
49
- * - `rows` (for default variant) or `minRows`/`maxRows` (for gradient variant)
34
+ * - `rows`
50
35
  * - `placeholder`
51
36
  * - `maxLength`
52
37
  * - `className` (appended to the outer element)
@@ -57,79 +42,9 @@ function CustomTextArea(_ref) {
57
42
  rows,
58
43
  placeholder,
59
44
  maxLength,
60
- className,
61
- variant = 'default'
45
+ className
62
46
  } = _ref,
63
47
  antDesignProps = _objectWithoutProperties(_ref, _excluded);
64
- // Render gradient variant
65
- if (variant === 'gradient') {
66
- // Extract gradient-specific props from antDesignProps
67
- const _ref2 = antDesignProps || {},
68
- {
69
- minRows = _constants.DEFAULT_MIN_ROWS,
70
- maxRows = _constants.DEFAULT_MAX_ROWS,
71
- sendIconConfig = _constants.DEFAULT_SEND_ICON_CONFIG,
72
- onSend,
73
- value,
74
- onChange,
75
- disabled
76
- } = _ref2,
77
- restAntDesignProps = _objectWithoutProperties(_ref2, _excluded2);
78
-
79
- // Handle send icon click - gradient variant only
80
- // Use value prop directly - no internal state management
81
- const handleSendClick = () => {
82
- const currentValue = value || '';
83
- // Only allow click if textarea is enabled, icon config is not disabled, and has content
84
- if (onSend && !disabled && !sendIconConfig.disabled && currentValue.trim()) {
85
- onSend(currentValue);
86
- }
87
- };
88
-
89
- // Determine if send icon should be enabled - gradient variant only
90
- // Icon is enabled if: textarea is enabled AND config says it's not disabled AND there's content
91
- // Use value prop directly - no internal state
92
- const currentValue = value || '';
93
- const isSendEnabled = !disabled && !sendIconConfig.disabled && currentValue.trim().length > 0;
94
-
95
- // Determine if icon should be shown - only for gradient variant
96
- // Hidden by default, only show when explicitly requested via sendIconConfig.show
97
- const shouldShowIcon = sendIconConfig.show;
98
- return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
99
- theme: {
100
- token: {
101
- colorBgContainerDisabled: _ColorVariablesMap.default['--color-divider'],
102
- colorTextDisabled: _ColorVariablesMap.default['--color-secondary-content']
103
- }
104
- }
105
- }, /*#__PURE__*/_react.default.createElement(_styles.TextAreaWrapper, {
106
- className: className,
107
- $disabled: disabled
108
- }, /*#__PURE__*/_react.default.createElement(_styles.default, _extends({
109
- placeholder: placeholder,
110
- maxLength: maxLength,
111
- className: "custom-textarea-gradient",
112
- value: value,
113
- onChange: onChange,
114
- disabled: disabled,
115
- autoSize: maxRows ? {
116
- minRows,
117
- maxRows
118
- } : {
119
- minRows
120
- }
121
- }, restAntDesignProps)), shouldShowIcon && /*#__PURE__*/_react.default.createElement(_styles.SendIconWrapper, {
122
- className: disabled || sendIconConfig.disabled || !isSendEnabled ? 'icon-disabled' : 'icon-enabled'
123
- }, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
124
- icon: _SendRounded.default,
125
- size: 24,
126
- color: isSendEnabled ? 'primary' : 'placeholder-text',
127
- onClick: handleSendClick
128
- }))));
129
- }
130
-
131
- // Render default variant (existing behavior - completely unchanged)
132
- // All props including value, onChange pass through naturally via antDesignProps
133
48
  return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
134
49
  theme: {
135
50
  token: {
@@ -148,14 +63,12 @@ CustomTextArea.propTypes = {
148
63
  rows: _propTypes.default.number,
149
64
  placeholder: _propTypes.default.string,
150
65
  maxLength: _propTypes.default.number,
151
- className: _propTypes.default.string,
152
- variant: _propTypes.default.oneOf(['default', 'gradient'])
66
+ className: _propTypes.default.string
153
67
  };
154
68
  CustomTextArea.defaultProps = {
155
- rows: _constants.DEFAULT_ROWS,
69
+ rows: 2,
156
70
  placeholder: null,
157
71
  maxLength: 5000,
158
- className: '',
159
- variant: 'default'
72
+ className: ''
160
73
  };
161
74
  var _default = exports.default = CustomTextArea;
@@ -3,23 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.TextAreaWrapper = exports.SendIconWrapper = void 0;
6
+ exports.default = void 0;
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
8
  var _antd = require("antd");
9
- var _constants = require("./constants");
10
- var _templateObject, _templateObject2, _templateObject3;
9
+ var _templateObject;
11
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
11
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
13
12
  const {
14
13
  TextArea: AntdTextArea
15
14
  } = _antd.Input;
16
-
17
- // Default textarea styles (existing)
18
- const StyledTextArea = (0, _styledComponents.default)(AntdTextArea)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.custom-textarea {\n padding: 16px;\n resize: none;\n border-radius: 4px;\n max-height: 92px;\n border: 1px solid var(--color-placeholder-text);\n }\n &.custom-textarea:hover {\n border: 1px solid var(--color-primary);\n }\n &.custom-textarea:focus-within {\n box-shadow: 0px 0px 4px 0px rgba(1, 79, 197, 0.90);\n }\n\n /* Gradient variant styles */\n &.custom-textarea-gradient {\n padding: 16px 48px 16px 16px;\n resize: none;\n border-radius: calc(", " - 2px);\n border: none;\n background: var(--color-primary-background);\n font-size: 16px;\n line-height: 24px;\n color: var(--color-primary-content);\n min-height: auto !important;\n box-shadow: none;\n width: 100%;\n }\n\n &.custom-textarea-gradient::placeholder {\n color: var(--color-secondary-content);\n }\n\n &.custom-textarea-gradient:hover {\n box-shadow: none;\n }\n\n &.custom-textarea-gradient:focus {\n outline: none;\n box-shadow: none;\n }\n\n &.custom-textarea-gradient:focus-within {\n box-shadow: none;\n }\n"])), _constants.TEXTAREA_BORDER_RADIUS);
19
-
20
- // Wrapper for gradient variant with gradient border
21
- const TextAreaWrapper = exports.TextAreaWrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n display: block;\n width: 100%;\n border-radius: ", ";\n padding: 2px;\n background: ", ";\n box-shadow: ", ";\n opacity: ", ";\n"])), _constants.TEXTAREA_BORDER_RADIUS, props => props.$disabled ? 'var(--color-divider)' : "linear-gradient(\n 135deg,\n ".concat(_constants.GRADIENT_BORDER_COLORS.top, " 0%,\n ").concat(_constants.GRADIENT_BORDER_COLORS.middle, " 50%,\n ").concat(_constants.GRADIENT_BORDER_COLORS.bottom, " 100%\n )"), props => props.$disabled ? 'none' : _constants.TEXTAREA_SHADOW, props => props.$disabled ? 0.6 : 1);
22
-
23
- // Send icon wrapper positioned absolutely
24
- const SendIconWrapper = exports.SendIconWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n top: 18px;\n right: 18px;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10;\n pointer-events: none;\n\n button,\n svg {\n pointer-events: auto;\n }\n\n /* Icon disabled state */\n &.icon-disabled {\n opacity: 0.5;\n \n button,\n svg {\n cursor: not-allowed;\n }\n }\n\n /* Icon enabled state */\n &.icon-enabled {\n opacity: 1;\n \n button,\n svg {\n cursor: pointer;\n }\n }\n"])));
15
+ const StyledTextArea = (0, _styledComponents.default)(AntdTextArea)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.custom-textarea {\n padding: 16px;\n resize: none;\n border-radius: 4px;\n max-height: 92px;\n border: 1px solid var(--color-placeholder-text);\n }\n &.custom-textarea:hover {\n border: 1px solid var(--color-primary);\n }\n &.custom-textarea:focus-within {\n box-shadow: 0px 0px 4px 0px rgba(1, 79, 197, 0.90);\n }\n"])));
25
16
  var _default = exports.default = StyledTextArea;
@@ -58,8 +58,7 @@ function EntityOverviewLayout(_ref) {
58
58
  profileData,
59
59
  accordionData,
60
60
  drawer,
61
- modal,
62
- misc
61
+ modal
63
62
  } = state !== null && state !== void 0 ? state : {};
64
63
  (0, _react.useEffect)(() => {
65
64
  init();
@@ -122,90 +121,8 @@ function EntityOverviewLayout(_ref) {
122
121
  placement: "bottomRight"
123
122
  });
124
123
  };
125
- const handleCloseDrawer = async () => {
126
- var _state$misc2, _state$misc3, _state$misc4;
127
- // Get selected enterprise from session storage to ensure profile data reflects correct enterprise
128
- const selectedEnterpriseFromStorage = JSON.parse(sessionStorage.getItem('selectedEnterprise') || 'null');
129
- const enterpriseIdFromStorage = (selectedEnterpriseFromStorage === null || selectedEnterpriseFromStorage === void 0 ? void 0 : selectedEnterpriseFromStorage.value) || (selectedEnterpriseFromStorage === null || selectedEnterpriseFromStorage === void 0 ? void 0 : selectedEnterpriseFromStorage.enterpriseId) || (selectedEnterpriseFromStorage === null || selectedEnterpriseFromStorage === void 0 ? void 0 : selectedEnterpriseFromStorage.id);
130
-
131
- // Update misc with enterpriseId from session storage
132
- const currentMisc = _objectSpread(_objectSpread({}, (_state$misc2 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc2 !== void 0 ? _state$misc2 : {}), {}, {
133
- enterpriseId: enterpriseIdFromStorage || (state === null || state === void 0 || (_state$misc3 = state.misc) === null || _state$misc3 === void 0 ? void 0 : _state$misc3.enterpriseId),
134
- enterpriseData: selectedEnterpriseFromStorage || (state === null || state === void 0 || (_state$misc4 = state.misc) === null || _state$misc4 === void 0 ? void 0 : _state$misc4.enterpriseData)
135
- });
136
- dispatch({
137
- type: _entityOverviewLayoutReducer.actionTypes.SET_LOADING,
138
- payload: true
139
- });
140
- if (getInitialData) {
141
- const {
142
- error,
143
- data
144
- } = await (getInitialData === null || getInitialData === void 0 ? void 0 : getInitialData(_objectSpread({}, currentMisc)));
145
- if (error) {
146
- showErrorNotification(error);
147
- const dynamicConfig = (0, _staticConfigResolver.default)(config, {});
148
- // Update misc with enterpriseId from session storage
149
- if (currentMisc) {
150
- dynamicConfig.misc = currentMisc;
151
- }
152
- // Don't preserve profile data - let it be re-rendered from config with correct enterprise
153
- // Don't preserve accordion data - use fresh data from API (or empty if error)
154
- dispatch({
155
- type: _entityOverviewLayoutReducer.actionTypes.INIT,
156
- payload: dynamicConfig
157
- });
158
- } else {
159
- const dynamicConfig = (0, _staticConfigResolver.default)(config, data !== null && data !== void 0 ? data : {});
160
- // Update misc with enterpriseId from session storage
161
- if (currentMisc) {
162
- dynamicConfig.misc = currentMisc;
163
- }
164
- // Use fresh profile data from API response to reflect correct enterprise
165
- if (data !== null && data !== void 0 && data.data) {
166
- dispatch({
167
- type: _entityOverviewLayoutReducer.actionTypes.UPDATE_PROFILE_DATA,
168
- payload: data.data
169
- });
170
- }
171
- // Use fresh accordion data from API response (includes newly added users)
172
- // Check for both 'accordionData' and 'accordianData' (typo in API response)
173
- const freshAccordionData = (data === null || data === void 0 ? void 0 : data.accordionData) || (data === null || data === void 0 ? void 0 : data.accordianData);
174
- if (freshAccordionData) {
175
- let accordionDataToUpdate;
176
- if (Array.isArray(freshAccordionData)) {
177
- accordionDataToUpdate = freshAccordionData;
178
- } else if (freshAccordionData.data && Array.isArray(freshAccordionData.data)) {
179
- accordionDataToUpdate = freshAccordionData.data;
180
- } else {
181
- accordionDataToUpdate = freshAccordionData;
182
- }
183
- // Update accordion data with fresh data from API
184
- dispatch({
185
- type: _entityOverviewLayoutReducer.actionTypes.UPDATE_ACCORDION_DATA,
186
- payload: accordionDataToUpdate
187
- });
188
- }
189
- dispatch({
190
- type: _entityOverviewLayoutReducer.actionTypes.INIT,
191
- payload: dynamicConfig
192
- });
193
- }
194
- } else {
195
- const dynamicConfig = (0, _staticConfigResolver.default)(config, {});
196
- // Update misc with enterpriseId from session storage
197
- if (currentMisc) {
198
- dynamicConfig.misc = currentMisc;
199
- }
200
- dispatch({
201
- type: _entityOverviewLayoutReducer.actionTypes.INIT,
202
- payload: dynamicConfig
203
- });
204
- }
205
- dispatch({
206
- type: _entityOverviewLayoutReducer.actionTypes.SET_LOADING,
207
- payload: false
208
- });
124
+ const handleCloseDrawer = () => {
125
+ init();
209
126
  dispatch({
210
127
  type: _entityOverviewLayoutReducer.actionTypes.CLOSE_DRAWER
211
128
  });
@@ -223,70 +140,14 @@ function EntityOverviewLayout(_ref) {
223
140
  {
224
141
  (config === null || config === void 0 ? void 0 : config.storageType) == "sessionStorage" && (config === null || config === void 0 ? void 0 : config.storageKey) && sessionStorage.setItem(config === null || config === void 0 ? void 0 : config.storageKey, JSON.stringify(selectedData));
225
142
  }
226
- // Always update 'selectedEnterprise' in sessionStorage to keep misc.enterpriseId in sync
227
- if (selectedData) {
228
- sessionStorage.setItem('selectedEnterprise', JSON.stringify(selectedData));
229
- }
230
143
  showSuccessNotification(config === null || config === void 0 ? void 0 : config.successMessage);
231
144
  if (error) {
232
145
  showErrorNotification(error);
233
146
  } else {
234
- // Update misc.enterpriseId to keep it in sync with selected enterprise
235
- // Read from selectedData to match the sessionStorage structure
236
- const enterpriseId = (selectedData === null || selectedData === void 0 ? void 0 : selectedData.value) || (selectedData === null || selectedData === void 0 ? void 0 : selectedData.enterpriseId) || (selectedData === null || selectedData === void 0 ? void 0 : selectedData.id) || selectedValue;
237
- if (enterpriseId) {
238
- dispatch({
239
- type: _entityOverviewLayoutReducer.actionTypes.SET_MISC,
240
- payload: _objectSpread(_objectSpread({}, state === null || state === void 0 ? void 0 : state.misc), {}, {
241
- enterpriseId: enterpriseId,
242
- enterpriseData: selectedData // Also update enterpriseData to match sessionStorage
243
- })
244
- });
245
- }
246
147
  dispatch({
247
148
  type: _entityOverviewLayoutReducer.actionTypes.UPDATE_PROFILE_DATA,
248
149
  payload: selectedItem
249
150
  });
250
- // Update accordion data if provided in the response
251
- // Note: API returns 'accordianData' (typo) but we check for both
252
- const accordionDataFromResponse = (data === null || data === void 0 ? void 0 : data.accordionData) || (data === null || data === void 0 ? void 0 : data.accordianData);
253
-
254
- // Check if accordionDataFromResponse is an object with data array, or if it's directly an array
255
- if (accordionDataFromResponse) {
256
- let accordionDataToUpdate;
257
- if (Array.isArray(accordionDataFromResponse)) {
258
- // If it's directly an array, use it as is
259
- accordionDataToUpdate = accordionDataFromResponse;
260
- } else if (accordionDataFromResponse.data && Array.isArray(accordionDataFromResponse.data)) {
261
- // If it's an object with a data property containing the array, extract the data array
262
- accordionDataToUpdate = accordionDataFromResponse.data;
263
- }
264
- if (accordionDataToUpdate) {
265
- dispatch({
266
- type: _entityOverviewLayoutReducer.actionTypes.UPDATE_ACCORDION_DATA,
267
- payload: accordionDataToUpdate
268
- });
269
- } else {
270
- console.log('Accordion data structure not recognized:', accordionDataFromResponse);
271
- }
272
- } else {
273
- if (getInitialData && config !== null && config !== void 0 && config.refreshAccordionOnSwitch) {
274
- var _state$misc5;
275
- // Optionally refresh accordion data by calling getInitialData again
276
- const {
277
- error: refreshError,
278
- data: refreshData
279
- } = await (getInitialData === null || getInitialData === void 0 ? void 0 : getInitialData(_objectSpread(_objectSpread({}, (_state$misc5 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc5 !== void 0 ? _state$misc5 : {}), {}, {
280
- selectedValue
281
- })));
282
- if (!refreshError && refreshData !== null && refreshData !== void 0 && refreshData.accordionData) {
283
- dispatch({
284
- type: _entityOverviewLayoutReducer.actionTypes.UPDATE_ACCORDION_DATA,
285
- payload: refreshData.accordionData
286
- });
287
- }
288
- }
289
- }
290
151
  }
291
152
  }
292
153
  };
@@ -394,9 +255,7 @@ function EntityOverviewLayout(_ref) {
394
255
  customPageModal: modal,
395
256
  addUserClick: addUserClick,
396
257
  deleteUserClick: deleteUserClick,
397
- editUserClick: editUserClick,
398
- misc: misc,
399
- drawer: drawer
258
+ editUserClick: editUserClick
400
259
  }))))));
401
260
  }
402
261
  EntityOverviewLayout.propTypes = {};
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.initialState = exports.entityOverviewLayoutReducer = exports.actionTypes = void 0;
7
- require("core-js/modules/web.dom-collections.iterator.js");
8
7
  require("core-js/modules/es.symbol.description.js");
9
8
  var _staticConfigResolver = require("../../GenricLayOut/resolver/staticConfigResolver");
10
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -20,8 +19,7 @@ const actionTypes = exports.actionTypes = {
20
19
  SET_DRAWER: 'SET_DRAWER',
21
20
  TOGGLE_DRAWER: 'TOGGLE_DRAWER',
22
21
  CLOSE_DRAWER: 'CLOSE_DRAWER',
23
- UPDATE_PROFILE_DATA: 'UPDATE_PROFILE_DATA',
24
- UPDATE_ACCORDION_DATA: 'UPDATE_ACCORDION_DATA'
22
+ UPDATE_PROFILE_DATA: 'UPDATE_PROFILE_DATA'
25
23
  };
26
24
  const initialState = exports.initialState = {};
27
25
  const entityOverviewLayoutReducer = (state, action) => {
@@ -40,21 +38,6 @@ const entityOverviewLayoutReducer = (state, action) => {
40
38
  return _objectSpread(_objectSpread({}, state), {}, {
41
39
  profileData: action.payload
42
40
  });
43
- case actionTypes.UPDATE_ACCORDION_DATA:
44
- {
45
- var _state$accordionData$, _state$accordionData;
46
- console.log('Reducer: Updating accordion data with payload:', action.payload);
47
- const newAccordionData = _objectSpread(_objectSpread({}, (state === null || state === void 0 ? void 0 : state.accordionData) || {}), {}, {
48
- // Preserve all existing accordionData properties
49
- visible: (_state$accordionData$ = state === null || state === void 0 || (_state$accordionData = state.accordionData) === null || _state$accordionData === void 0 ? void 0 : _state$accordionData.visible) !== null && _state$accordionData$ !== void 0 ? _state$accordionData$ : true,
50
- // Preserve visible property, default to true
51
- data: Array.isArray(action.payload) ? [...action.payload] : action.payload // Ensure new array reference
52
- });
53
- console.log('Reducer: New accordion data:', newAccordionData);
54
- return _objectSpread(_objectSpread({}, state), {}, {
55
- accordionData: newAccordionData
56
- });
57
- }
58
41
  case actionTypes.SET_MISC:
59
42
  return _objectSpread(_objectSpread({}, state), {}, {
60
43
  misc: _objectSpread(_objectSpread({}, state.misc), action.payload)
@@ -452,8 +452,7 @@ function FormWidget(props) {
452
452
  initialData: (item === null || item === void 0 ? void 0 : item.value) || [],
453
453
  fields: item === null || item === void 0 ? void 0 : item.fields,
454
454
  disabled: (item === null || item === void 0 ? void 0 : item.disabled) || false,
455
- customPageModal: props === null || props === void 0 ? void 0 : props.customPageModal,
456
- misc: props === null || props === void 0 ? void 0 : props.misc
455
+ customPageModal: props === null || props === void 0 ? void 0 : props.customPageModal
457
456
  }, props)));
458
457
  case "field":
459
458
  return renderFieldWidget(item);
@@ -5,12 +5,9 @@ require("core-js/modules/es.weak-map.js");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = _default;
8
+ exports.default = UserManagementWidget;
9
9
  require("core-js/modules/web.dom-collections.iterator.js");
10
10
  require("core-js/modules/es.promise.js");
11
- require("core-js/modules/es.regexp.constructor.js");
12
- require("core-js/modules/es.regexp.exec.js");
13
- require("core-js/modules/es.regexp.to-string.js");
14
11
  var _react = _interopRequireWildcard(require("react"));
15
12
  var _antd = require("antd");
16
13
  var _EditOutlined = _interopRequireDefault(require("@material-ui/icons/EditOutlined"));
@@ -31,8 +28,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
31
28
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
32
29
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
33
30
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* eslint-disable */
34
- function _default(_ref) {
35
- var _drawer$data, _activeDrawerData$mis;
31
+ function UserManagementWidget(_ref) {
36
32
  let {
37
33
  form,
38
34
  fieldName = "users",
@@ -43,8 +39,7 @@ function _default(_ref) {
43
39
  addUserClick,
44
40
  deleteUserClick,
45
41
  editUserClick,
46
- misc,
47
- drawer
42
+ misc
48
43
  } = _ref;
49
44
  const finalFields = fields || [];
50
45
  const [editingUserId, setEditingUserId] = (0, _react.useState)(null);
@@ -93,28 +88,6 @@ function _default(_ref) {
93
88
  [fieldName]: defaultUsers
94
89
  });
95
90
  }, [initialData, fieldName, form]);
96
-
97
- // Reset form state when drawer closes or opens to ensure fresh context
98
- (0, _react.useEffect)(() => {
99
- if (drawer && drawer.visible === false) {
100
- // Reset adding/editing state when drawer closes
101
- setAddingUser(false);
102
- setEditingUserId(null);
103
- setDeleteModalVisible(false);
104
- setUserToDelete(null);
105
-
106
- // Clear form fields
107
- const clearData = {};
108
- finalFields.forEach(field => {
109
- clearData["".concat(fieldName, "_").concat(field.key)] = "";
110
- });
111
- form.setFieldsValue(clearData);
112
- }
113
- }, [drawer === null || drawer === void 0 ? void 0 : drawer.visible, form, fieldName, finalFields]);
114
-
115
- // Access branchId dynamically from drawer data using active drawer key
116
- const activeDrawerData = drawer === null || drawer === void 0 || (_drawer$data = drawer.data) === null || _drawer$data === void 0 ? void 0 : _drawer$data[drawer === null || drawer === void 0 ? void 0 : drawer.active];
117
- const branchId = activeDrawerData === null || activeDrawerData === void 0 || (_activeDrawerData$mis = activeDrawerData.misc) === null || _activeDrawerData$mis === void 0 ? void 0 : _activeDrawerData$mis.branchId;
118
91
  const handleEdit = user => {
119
92
  setEditingUserId(user.id);
120
93
  setAddingUser(false);
@@ -154,7 +127,7 @@ function _default(_ref) {
154
127
  const {
155
128
  error,
156
129
  data
157
- } = await editUserClick(editingUserId, userData, misc);
130
+ } = await editUserClick(editingUserId, userData);
158
131
  if (error) {
159
132
  showErrorNotification(error);
160
133
  } else {
@@ -173,13 +146,10 @@ function _default(_ref) {
173
146
  } else if (addingUser) {
174
147
  // Add new user
175
148
  if (addUserClick) {
176
- console.log("userData", userData);
177
- console.log("misc", misc);
178
- console.log("branchId", branchId);
179
149
  const {
180
150
  error,
181
151
  data
182
- } = await addUserClick(userData, misc, branchId);
152
+ } = await addUserClick(userData, misc);
183
153
  if (error) {
184
154
  showErrorNotification(error);
185
155
  } else {
@@ -245,38 +215,15 @@ function _default(_ref) {
245
215
  };
246
216
  const canDelete = users.length > 1;
247
217
  const isEditing = editingUserId !== null || addingUser;
248
-
249
- // Process rules to handle checkValidator structure (similar to FormWidget)
250
- const processRules = rules => {
251
- if (!rules || !Array.isArray(rules)) {
252
- return rules;
253
- }
254
- return rules.map(r => {
255
- // If rule has checkValidator, extract the nested rule object
256
- if (r !== null && r !== void 0 && r.checkValidator && r !== null && r !== void 0 && r.rule) {
257
- let processedRule = _objectSpread({}, r.rule);
258
-
259
- // Handle pattern conversion if it's a string
260
- if (processedRule.pattern && typeof processedRule.pattern === "string") {
261
- processedRule.pattern = new RegExp(processedRule.pattern);
262
- }
263
- return processedRule;
264
- }
265
-
266
- // Return rule as-is if it doesn't have checkValidator structure
267
- return r;
268
- });
269
- };
270
218
  const renderFormField = field => {
271
219
  var _field$options;
272
220
  const fieldNameWithPrefix = "".concat(fieldName, "_").concat(field.key);
273
- const processedRules = processRules(field.rules);
274
221
  switch (field.widget || field.type) {
275
222
  case "input":
276
223
  return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
277
224
  name: fieldNameWithPrefix,
278
225
  label: field.label,
279
- rules: processedRules,
226
+ rules: field.rules,
280
227
  style: {
281
228
  marginBottom: 16
282
229
  }
@@ -287,7 +234,7 @@ function _default(_ref) {
287
234
  return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
288
235
  name: fieldNameWithPrefix,
289
236
  label: field.label,
290
- rules: processedRules,
237
+ rules: field.rules,
291
238
  style: {
292
239
  marginBottom: 16
293
240
  }
@@ -302,7 +249,7 @@ function _default(_ref) {
302
249
  return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
303
250
  name: fieldNameWithPrefix,
304
251
  label: field.label,
305
- rules: processedRules,
252
+ rules: field.rules,
306
253
  style: {
307
254
  marginBottom: 16
308
255
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "1.0.1-stage.442",
3
+ "version": "1.0.1-stage.443",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.TEXTAREA_SHADOW = exports.TEXTAREA_BORDER_RADIUS = exports.SEND_ICON_SIZE = exports.GRADIENT_BORDER_COLORS = exports.DEFAULT_SEND_ICON_CONFIG = exports.DEFAULT_ROWS = exports.DEFAULT_MIN_ROWS = exports.DEFAULT_MAX_ROWS = void 0;
7
- /**
8
- * Constants for CustomTextArea component
9
- */
10
-
11
- // Default values for textarea configuration
12
- const DEFAULT_MIN_ROWS = exports.DEFAULT_MIN_ROWS = 1;
13
- const DEFAULT_MAX_ROWS = exports.DEFAULT_MAX_ROWS = null; // null means unlimited growth
14
- const DEFAULT_ROWS = exports.DEFAULT_ROWS = 2;
15
-
16
- // Gradient border colors
17
- const GRADIENT_BORDER_COLORS = exports.GRADIENT_BORDER_COLORS = {
18
- top: '#0098FF',
19
- // Blue
20
- middle: '#9A6CFF',
21
- // Purple
22
- bottom: '#FB6252' // Coral/Orange-Red
23
- };
24
-
25
- // Shadow styles
26
- const TEXTAREA_SHADOW = exports.TEXTAREA_SHADOW = '0px 2px 10px rgba(0, 0, 0, 0.14)';
27
-
28
- // Border radius
29
- const TEXTAREA_BORDER_RADIUS = exports.TEXTAREA_BORDER_RADIUS = '12px';
30
-
31
- // Icon sizes
32
- const SEND_ICON_SIZE = exports.SEND_ICON_SIZE = 24;
33
-
34
- // Default send icon configuration
35
- const DEFAULT_SEND_ICON_CONFIG = exports.DEFAULT_SEND_ICON_CONFIG = {
36
- show: false,
37
- // Hidden by default - only show when explicitly requested
38
- disabled: false
39
- };