@appcorp/fusion-storybook 0.1.19 → 0.1.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.
@@ -11,6 +11,21 @@
11
11
  */
12
12
  import { FC } from "react";
13
13
  import { USER_ROLE } from "@/type";
14
- export declare const DiscountCodePage: FC<{
14
+ interface Props {
15
+ cancelLabel: string;
16
+ drawerTitle: string;
17
+ labelActions: string;
18
+ labelCode: string;
19
+ labelDescription: string;
20
+ labelDiscountType: string;
21
+ labelDiscountValue: string;
22
+ labelEnabled: string;
23
+ labelId: string;
24
+ saveLabel: string;
25
+ searchPlaceholder: string;
26
+ tableDescription: string;
27
+ tableTitle: string;
15
28
  userRole: USER_ROLE;
16
- }>;
29
+ }
30
+ export declare const DiscountCodePage: FC<Props>;
31
+ export {};
@@ -19,10 +19,8 @@ import { DiscountCodeFilter } from "./filter";
19
19
  import { DiscountCodeForm } from "./form";
20
20
  import { DiscountCodeMoreActions } from "./more-actions";
21
21
  import { DiscountCodeView } from "./view";
22
- // import { useAuthStateContext } from "@/contexts/auth-context";
23
22
  import { resolveRbacPermissions } from "@/utils/resolve-rbac-permissions";
24
23
  import { RbacNoAccess } from "@/components/rbac-no-access";
25
- import { useTranslations } from "next-intl";
26
24
  // ============================================================================
27
25
  // TABLE COLUMN CONFIGURATION (static — no runtime deps)
28
26
  // ============================================================================
@@ -35,19 +33,6 @@ const tableBodyCols = [
35
33
  { componentType: COMPONENT_TYPE.BOOLEAN, key: "enabled" },
36
34
  { componentType: COMPONENT_TYPE.ACTIONS },
37
35
  ];
38
- const tableColumns = [
39
- { label: "id", width: "5%" },
40
- { label: "code", width: "15%" },
41
- { label: "description", width: "25%" },
42
- { label: "discountType", width: "15%" },
43
- { label: "discountValue", width: "15%" },
44
- { label: "status", width: "15%" },
45
- { label: "actions", width: "10%" },
46
- ];
47
- // ============================================================================
48
- // TRANSLATED COLUMNS HELPER
49
- // ============================================================================
50
- const getTranslatedColumns = (t) => tableColumns.map((col) => (Object.assign(Object.assign({}, col), { label: t(col.label) })));
51
36
  // ============================================================================
52
37
  // COMPONENT FACTORY (creates JSX elements when config is created, not during render)
53
38
  // ============================================================================
@@ -57,23 +42,28 @@ const createComponentInstances = () => ({
57
42
  moreActions: _jsx(DiscountCodeMoreActions, {}),
58
43
  view: _jsx(DiscountCodeView, {}),
59
44
  });
60
- // ============================================================================
61
- // CONFIG CREATION HELPER
62
- // ============================================================================
63
- const createDiscountCodeConfig = (t, drawer, dispatch) => {
45
+ const createDiscountCodeConfig = ({ cancelLabel, drawer, dispatch, drawerTitle, labelActions, labelCode, labelDescription, labelDiscountType, labelDiscountValue, labelEnabled, labelId, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
64
46
  const components = createComponentInstances();
65
47
  return {
66
48
  moduleName: "discountCode",
67
- tableColumns: getTranslatedColumns(t),
68
- cancelLabel: t("cancel"),
69
- drawerTitle: t("drawerTitle"),
49
+ tableColumns: [
50
+ { label: labelId, width: "5%" },
51
+ { label: labelCode, width: "15%" },
52
+ { label: labelDescription, width: "25%" },
53
+ { label: labelDiscountType, width: "15%" },
54
+ { label: labelDiscountValue, width: "15%" },
55
+ { label: labelEnabled, width: "15%" },
56
+ { label: labelActions, width: "10%" },
57
+ ],
58
+ cancelLabel,
59
+ drawerTitle,
70
60
  filterContent: components.filter,
71
61
  formContent: components.form,
72
62
  moreActionsContent: components.moreActions,
73
- saveLabel: t("save"),
74
- searchPlaceholder: t("tableSearchPlaceholder"),
75
- tableDescription: t("tableDescription"),
76
- tableTitle: t("tableTitle"),
63
+ saveLabel,
64
+ searchPlaceholder,
65
+ tableDescription,
66
+ tableTitle,
77
67
  viewContent: components.view,
78
68
  size: drawer === DISCOUNT_CODE_DRAWER.FORM_DRAWER ? "full" : "small",
79
69
  onClearFilters: () => {
@@ -88,18 +78,49 @@ const GenericDiscountCodePage = createGenericModulePage();
88
78
  // ============================================================================
89
79
  // INNER PAGE (requires DiscountCodeProvider context)
90
80
  // ============================================================================
91
- const DiscountCodePageInner = ({ userRole }) => {
92
- const t = useTranslations("discountCode");
81
+ const DiscountCodePageInner = (props) => {
93
82
  const context = useDiscountCodeModule();
94
- const hasPermission = useMemo(() => resolveRbacPermissions({
95
- userRole,
83
+ // Memoize config creation - destructure props to avoid object reference changes
84
+ const discountCodeConfig = useMemo(() => createDiscountCodeConfig({
85
+ dispatch: context.dispatch,
86
+ drawer: context.state.drawer,
87
+ cancelLabel: props.cancelLabel,
88
+ drawerTitle: props.drawerTitle,
89
+ labelActions: props.labelActions,
90
+ labelCode: props.labelCode,
91
+ labelDescription: props.labelDescription,
92
+ labelDiscountType: props.labelDiscountType,
93
+ labelDiscountValue: props.labelDiscountValue,
94
+ labelEnabled: props.labelEnabled,
95
+ labelId: props.labelId,
96
+ saveLabel: props.saveLabel,
97
+ searchPlaceholder: props.searchPlaceholder,
98
+ tableDescription: props.tableDescription,
99
+ tableTitle: props.tableTitle,
100
+ }), [
101
+ context.dispatch,
102
+ context.state.drawer,
103
+ props.cancelLabel,
104
+ props.drawerTitle,
105
+ props.labelActions,
106
+ props.labelCode,
107
+ props.labelDescription,
108
+ props.labelDiscountType,
109
+ props.labelDiscountValue,
110
+ props.labelEnabled,
111
+ props.labelId,
112
+ props.saveLabel,
113
+ props.searchPlaceholder,
114
+ props.tableDescription,
115
+ props.tableTitle,
116
+ ]);
117
+ const hasPermission = resolveRbacPermissions({
118
+ userRole: props.userRole,
96
119
  moduleName: "DiscountCode",
97
- }), [userRole]);
98
- // Memoize config creation
99
- const discountCodeConfig = useMemo(() => createDiscountCodeConfig(t, context.state.drawer, context.dispatch), [t, context.state.drawer, context.dispatch]);
120
+ });
100
121
  if (!hasPermission) {
101
122
  return _jsx(RbacNoAccess, { moduleName: "DiscountCode" });
102
123
  }
103
124
  return (_jsx("div", { className: "p-4", children: _jsx(GenericDiscountCodePage, { overrideConfig: discountCodeConfig, context: context, tableBodyCols: tableBodyCols }) }));
104
125
  };
105
- export const DiscountCodePage = ({ userRole }) => (_jsx(DiscountCodeProvider, { children: _jsx(DiscountCodePageInner, { userRole: userRole }) }));
126
+ export const DiscountCodePage = (props) => (_jsx(DiscountCodeProvider, { children: _jsx(DiscountCodePageInner, Object.assign({}, props)) }));
@@ -123,6 +123,27 @@ export declare const FamilyStateContextProvider: import("react").FC<{
123
123
  children: React.ReactNode;
124
124
  }>;
125
125
  export declare const useFamilyModule: () => {
126
+ state: {
127
+ items: FamilyBE[];
128
+ count: number;
129
+ currentPage: number;
130
+ pageLimit: number;
131
+ searchQuery: string;
132
+ disableSaveButton: boolean;
133
+ drawer: string | null;
134
+ address: string;
135
+ city: string;
136
+ country: string;
137
+ enabled: boolean;
138
+ errors: Record<string, string>;
139
+ familyCode: string;
140
+ filterEnabled: boolean | undefined;
141
+ id: string;
142
+ postalCode: string;
143
+ stateProvince: string;
144
+ userId: string;
145
+ };
146
+ dispatch: import("react").Dispatch<any>;
126
147
  applyFilters: () => void;
127
148
  byIdLoading: boolean;
128
149
  clearFilters: () => void;
@@ -149,25 +170,4 @@ export declare const useFamilyModule: () => {
149
170
  listLoading: boolean;
150
171
  rowActions: RowAction[];
151
172
  updateLoading: boolean;
152
- state: {
153
- items: FamilyBE[];
154
- count: number;
155
- currentPage: number;
156
- pageLimit: number;
157
- searchQuery: string;
158
- disableSaveButton: boolean;
159
- drawer: string | null;
160
- address: string;
161
- city: string;
162
- country: string;
163
- enabled: boolean;
164
- errors: Record<string, string>;
165
- familyCode: string;
166
- filterEnabled: boolean | undefined;
167
- id: string;
168
- postalCode: string;
169
- stateProvince: string;
170
- userId: string;
171
- };
172
- dispatch: React.Dispatch<any>;
173
173
  };
@@ -85,47 +85,46 @@ export const FamilyStateContextProvider = FamilyProvider;
85
85
  // ============================================================================
86
86
  export const useFamilyModule = () => {
87
87
  var _a, _b;
88
- const context = useFamilyContext();
89
- const { dispatch } = context;
88
+ const { state, dispatch } = useFamilyContext();
90
89
  const t = useTranslations("family");
91
90
  const workspace = getCachedWorkspaceSync();
92
- const debouncedQuery = useDebounce(context.state.searchQuery, 800);
91
+ const debouncedQuery = useDebounce(state.searchQuery, 800);
93
92
  // ============================================================================
94
93
  // API PARAMETERS
95
94
  // ============================================================================
96
95
  const listParams = useMemo(() => {
97
96
  var _a;
98
- return (Object.assign(Object.assign({ currentPage: context.state.currentPage, pageLimit: context.state.pageLimit, schoolId: ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "" }, (debouncedQuery ? { searchQuery: debouncedQuery } : {})), (context.state.filterEnabled !== undefined
99
- ? { filterEnabled: String(context.state.filterEnabled) }
97
+ return (Object.assign(Object.assign({ currentPage: state.currentPage, pageLimit: state.pageLimit, schoolId: ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "" }, (debouncedQuery ? { searchQuery: debouncedQuery } : {})), (state.filterEnabled !== undefined
98
+ ? { filterEnabled: String(state.filterEnabled) }
100
99
  : {})));
101
100
  }, [
102
- context.state.currentPage,
103
- context.state.filterEnabled,
104
- context.state.pageLimit,
101
+ state.currentPage,
102
+ state.filterEnabled,
103
+ state.pageLimit,
105
104
  debouncedQuery,
106
105
  (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id,
107
106
  ]);
108
107
  const updateParams = useMemo(() => ({
109
- address: context.state.address,
110
- city: context.state.city,
111
- country: context.state.country,
112
- enabled: context.state.enabled,
113
- familyCode: context.state.familyCode,
114
- id: context.state.id,
115
- postalCode: context.state.postalCode,
116
- stateProvince: context.state.stateProvince,
108
+ address: state.address,
109
+ city: state.city,
110
+ country: state.country,
111
+ enabled: state.enabled,
112
+ familyCode: state.familyCode,
113
+ id: state.id,
114
+ postalCode: state.postalCode,
115
+ stateProvince: state.stateProvince,
117
116
  }), [
118
- context.state.address,
119
- context.state.city,
120
- context.state.country,
121
- context.state.enabled,
122
- context.state.familyCode,
123
- context.state.id,
124
- context.state.postalCode,
125
- context.state.stateProvince,
117
+ state.address,
118
+ state.city,
119
+ state.country,
120
+ state.enabled,
121
+ state.familyCode,
122
+ state.id,
123
+ state.postalCode,
124
+ state.stateProvince,
126
125
  ]);
127
- const byIdParams = useMemo(() => ({ id: context.state.id }), [context.state.id]);
128
- const deleteParams = useMemo(() => ({ id: context.state.id }), [context.state.id]);
126
+ const byIdParams = useMemo(() => ({ id: state.id }), [state.id]);
127
+ const deleteParams = useMemo(() => ({ id: state.id }), [state.id]);
129
128
  // ============================================================================
130
129
  // API CALLBACKS
131
130
  // ============================================================================
@@ -419,7 +418,10 @@ export const useFamilyModule = () => {
419
418
  // ============================================================================
420
419
  // RETURN
421
420
  // ============================================================================
422
- return Object.assign(Object.assign({}, context), { applyFilters,
421
+ return {
422
+ state,
423
+ dispatch,
424
+ applyFilters,
423
425
  byIdLoading,
424
426
  clearFilters,
425
427
  deleteLoading,
@@ -438,5 +440,6 @@ export const useFamilyModule = () => {
438
440
  headerActions,
439
441
  listLoading,
440
442
  rowActions,
441
- updateLoading });
443
+ updateLoading,
444
+ };
442
445
  };
@@ -11,6 +11,21 @@
11
11
  */
12
12
  import { FC } from "react";
13
13
  import { USER_ROLE } from "@/type";
14
- export declare const FamilyPage: FC<{
14
+ interface Props {
15
+ cancelLabel: string;
16
+ drawerTitle: string;
17
+ labelActions: string;
18
+ labelAddress: string;
19
+ labelCity: string;
20
+ labelEnabled: string;
21
+ labelFamilyCode: string;
22
+ labelId: string;
23
+ labelPrimaryEmail: string;
24
+ saveLabel: string;
25
+ searchPlaceholder: string;
26
+ tableDescription: string;
27
+ tableTitle: string;
15
28
  userRole: USER_ROLE;
16
- }>;
29
+ }
30
+ export declare const FamilyPage: FC<Props>;
31
+ export {};
@@ -14,15 +14,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { useMemo } from "react";
15
15
  import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
16
16
  import { createGenericModulePage, } from "@react-pakistan/util-functions/factory/generic-component-factory";
17
- import { useFamilyModule, FamilyProvider, FAMILY_ACTION_TYPES, } from "./context";
17
+ import { useFamilyModule, FamilyProvider, FAMILY_ACTION_TYPES, FAMILY_DRAWER, } from "./context";
18
18
  import { FamilyFilter } from "./filter";
19
19
  import { FamilyForm } from "./form";
20
20
  import { FamilyMoreActions } from "./more-actions";
21
21
  import { FamilyView } from "./view";
22
- // import { useAuthStateContext } from "@/contexts/auth-context";
23
22
  import { resolveRbacPermissions } from "@/utils/resolve-rbac-permissions";
24
23
  import { RbacNoAccess } from "@/components/rbac-no-access";
25
- import { useTranslations } from "next-intl";
26
24
  // ============================================================================
27
25
  // TABLE COLUMN CONFIGURATION (static — no runtime deps)
28
26
  // ============================================================================
@@ -35,19 +33,6 @@ const tableBodyCols = [
35
33
  { componentType: COMPONENT_TYPE.BOOLEAN, key: "enabled" },
36
34
  { componentType: COMPONENT_TYPE.ACTIONS },
37
35
  ];
38
- const tableColumns = [
39
- { label: "id", width: "5%" },
40
- { label: "familyCode", width: "20%" },
41
- { label: "primaryEmail", width: "20%" },
42
- { label: "address", width: "20%" },
43
- { label: "city", width: "15%" },
44
- { label: "status", width: "15%" },
45
- { label: "actions", width: "5%" },
46
- ];
47
- // ============================================================================
48
- // TRANSLATED COLUMNS HELPER
49
- // ============================================================================
50
- const getTranslatedColumns = (t) => tableColumns.map((col) => (Object.assign(Object.assign({}, col), { label: t(col.label) })));
51
36
  // ============================================================================
52
37
  // COMPONENT FACTORY (creates JSX elements when config is created, not during render)
53
38
  // ============================================================================
@@ -57,24 +42,30 @@ const createComponentInstances = () => ({
57
42
  moreActions: _jsx(FamilyMoreActions, {}),
58
43
  view: _jsx(FamilyView, {}),
59
44
  });
60
- // ============================================================================
61
- // CONFIG CREATION HELPER
62
- // ============================================================================
63
- const createFamilyConfig = (t, dispatch) => {
45
+ const createFamilyConfig = ({ cancelLabel, dispatch, drawer, drawerTitle, labelActions, labelAddress, labelCity, labelEnabled, labelFamilyCode, labelId, labelPrimaryEmail, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
64
46
  const components = createComponentInstances();
65
47
  return {
66
48
  moduleName: "family",
67
- tableColumns: getTranslatedColumns(t),
68
- cancelLabel: t("cancel"),
69
- drawerTitle: t("family"),
49
+ tableColumns: [
50
+ { label: labelId, width: "5%" },
51
+ { label: labelFamilyCode, width: "20%" },
52
+ { label: labelPrimaryEmail, width: "20%" },
53
+ { label: labelAddress, width: "20%" },
54
+ { label: labelCity, width: "15%" },
55
+ { label: labelEnabled, width: "15%" },
56
+ { label: labelActions, width: "5%" },
57
+ ],
58
+ cancelLabel,
59
+ drawerTitle,
70
60
  filterContent: components.filter,
71
61
  formContent: components.form,
72
62
  moreActionsContent: components.moreActions,
73
- saveLabel: t("save"),
74
- searchPlaceholder: t("searchFamilies"),
75
- tableDescription: t("manageFamilyAccountsAndTheirInformation"),
76
- tableTitle: t("family"),
63
+ saveLabel,
64
+ searchPlaceholder,
65
+ tableDescription,
66
+ tableTitle,
77
67
  viewContent: components.view,
68
+ size: drawer === FAMILY_DRAWER.FORM_DRAWER ? "full" : "small",
78
69
  onClearFilters: () => {
79
70
  dispatch({ type: FAMILY_ACTION_TYPES.RESET_FORM });
80
71
  },
@@ -87,19 +78,49 @@ const GenericFamilyPage = createGenericModulePage();
87
78
  // ============================================================================
88
79
  // INNER PAGE (requires FamilyProvider context)
89
80
  // ============================================================================
90
- const FamilyPageInner = ({ userRole }) => {
91
- const t = useTranslations("family");
81
+ const FamilyPageInner = (props) => {
92
82
  const context = useFamilyModule();
93
- // Memoize permission check to avoid recalculation on every render
94
- const hasPermission = useMemo(() => resolveRbacPermissions({
95
- userRole,
83
+ // Memoize config creation - destructure props to avoid object reference changes
84
+ const familyConfig = useMemo(() => createFamilyConfig({
85
+ dispatch: context.dispatch,
86
+ drawer: context.state.drawer,
87
+ cancelLabel: props.cancelLabel,
88
+ drawerTitle: props.drawerTitle,
89
+ labelActions: props.labelActions,
90
+ labelAddress: props.labelAddress,
91
+ labelCity: props.labelCity,
92
+ labelEnabled: props.labelEnabled,
93
+ labelFamilyCode: props.labelFamilyCode,
94
+ labelId: props.labelId,
95
+ labelPrimaryEmail: props.labelPrimaryEmail,
96
+ saveLabel: props.saveLabel,
97
+ searchPlaceholder: props.searchPlaceholder,
98
+ tableDescription: props.tableDescription,
99
+ tableTitle: props.tableTitle,
100
+ }), [
101
+ context.dispatch,
102
+ context.state.drawer,
103
+ props.cancelLabel,
104
+ props.drawerTitle,
105
+ props.labelActions,
106
+ props.labelAddress,
107
+ props.labelCity,
108
+ props.labelEnabled,
109
+ props.labelFamilyCode,
110
+ props.labelId,
111
+ props.labelPrimaryEmail,
112
+ props.saveLabel,
113
+ props.searchPlaceholder,
114
+ props.tableDescription,
115
+ props.tableTitle,
116
+ ]);
117
+ const hasPermission = resolveRbacPermissions({
118
+ userRole: props.userRole,
96
119
  moduleName: "People Management",
97
- }), [userRole]);
98
- // Memoize config creation
99
- const familyConfig = useMemo(() => createFamilyConfig(t, context.dispatch), [t, context.dispatch]);
120
+ });
100
121
  if (!hasPermission) {
101
122
  return _jsx(RbacNoAccess, { moduleName: "People Management" });
102
123
  }
103
124
  return (_jsx("div", { className: "p-4", children: _jsx(GenericFamilyPage, { overrideConfig: familyConfig, context: context, tableBodyCols: tableBodyCols }) }));
104
125
  };
105
- export const FamilyPage = ({ userRole }) => (_jsx(FamilyProvider, { children: _jsx(FamilyPageInner, { userRole: userRole }) }));
126
+ export const FamilyPage = (props) => (_jsx(FamilyProvider, { children: _jsx(FamilyPageInner, Object.assign({}, props)) }));
@@ -11,6 +11,22 @@
11
11
  */
12
12
  import { FC } from "react";
13
13
  import { USER_ROLE } from "@/type";
14
- export declare const FamilyMemberPage: FC<{
14
+ interface Props {
15
+ cancelLabel: string;
16
+ drawerTitle: string;
17
+ labelActions: string;
18
+ labelEmail: string;
19
+ labelEnabled: string;
20
+ labelFirstName: string;
21
+ labelId: string;
22
+ labelPhone: string;
23
+ labelPrimaryContact: string;
24
+ labelRole: string;
25
+ saveLabel: string;
26
+ searchPlaceholder: string;
27
+ tableDescription: string;
28
+ tableTitle: string;
15
29
  userRole: USER_ROLE;
16
- }>;
30
+ }
31
+ export declare const FamilyMemberPage: FC<Props>;
32
+ export {};
@@ -21,7 +21,6 @@ import { FamilyMemberMoreActions } from "./more-actions";
21
21
  import { FamilyMemberView } from "./view";
22
22
  import { resolveRbacPermissions } from "@/utils/resolve-rbac-permissions";
23
23
  import { RbacNoAccess } from "@/components/rbac-no-access";
24
- import { useTranslations } from "next-intl";
25
24
  // ============================================================================
26
25
  // TABLE COLUMN CONFIGURATION (static — no runtime deps)
27
26
  // ============================================================================
@@ -35,20 +34,6 @@ const tableBodyCols = [
35
34
  { componentType: COMPONENT_TYPE.BOOLEAN, key: "enabled" },
36
35
  { componentType: COMPONENT_TYPE.ACTIONS },
37
36
  ];
38
- const tableColumns = [
39
- { label: "id", width: "5%" },
40
- { label: "firstName", width: "20%" },
41
- { label: "role", width: "15%" },
42
- { label: "email", width: "20%" },
43
- { label: "phone", width: "15%" },
44
- { label: "primaryContact", width: "10%" },
45
- { label: "status", width: "10%" },
46
- { label: "actions", width: "5%" },
47
- ];
48
- // ============================================================================
49
- // TRANSLATED COLUMNS HELPER
50
- // ============================================================================
51
- const getTranslatedColumns = (t) => tableColumns.map((col) => (Object.assign(Object.assign({}, col), { label: t(col.label) })));
52
37
  // ============================================================================
53
38
  // COMPONENT FACTORY (creates JSX elements when config is created, not during render)
54
39
  // ============================================================================
@@ -58,23 +43,29 @@ const createComponentInstances = () => ({
58
43
  moreActions: _jsx(FamilyMemberMoreActions, {}),
59
44
  view: _jsx(FamilyMemberView, {}),
60
45
  });
61
- // ============================================================================
62
- // CONFIG CREATION HELPER
63
- // ============================================================================
64
- const createFamilyMemberConfig = (t, drawer, dispatch) => {
46
+ const createFamilyMemberConfig = ({ cancelLabel, drawer, dispatch, drawerTitle, labelActions, labelEmail, labelEnabled, labelFirstName, labelId, labelPhone, labelPrimaryContact, labelRole, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
65
47
  const components = createComponentInstances();
66
48
  return {
67
49
  moduleName: "familyMember",
68
- tableColumns: getTranslatedColumns(t),
69
- cancelLabel: t("cancel"),
70
- drawerTitle: t("familyMember"),
50
+ tableColumns: [
51
+ { label: labelId, width: "5%" },
52
+ { label: labelFirstName, width: "20%" },
53
+ { label: labelRole, width: "15%" },
54
+ { label: labelEmail, width: "20%" },
55
+ { label: labelPhone, width: "15%" },
56
+ { label: labelPrimaryContact, width: "10%" },
57
+ { label: labelEnabled, width: "10%" },
58
+ { label: labelActions, width: "5%" },
59
+ ],
60
+ cancelLabel,
61
+ drawerTitle,
71
62
  filterContent: components.filter,
72
63
  formContent: components.form,
73
64
  moreActionsContent: components.moreActions,
74
- saveLabel: t("save"),
75
- searchPlaceholder: t("searchFamilyMembers"),
76
- tableDescription: t("manageFamilyMembersAndTheirInformation"),
77
- tableTitle: t("familyMember"),
65
+ saveLabel,
66
+ searchPlaceholder,
67
+ tableDescription,
68
+ tableTitle,
78
69
  viewContent: components.view,
79
70
  size: drawer === FAMILY_MEMBER_DRAWER.FORM_DRAWER ? "full" : "small",
80
71
  onClearFilters: () => {
@@ -89,19 +80,51 @@ const GenericFamilyMemberPage = createGenericModulePage();
89
80
  // ============================================================================
90
81
  // INNER PAGE (requires FamilyMemberProvider context)
91
82
  // ============================================================================
92
- const FamilyMemberPageInner = ({ userRole }) => {
93
- const t = useTranslations("familyMember");
83
+ const FamilyMemberPageInner = (props) => {
94
84
  const context = useFamilyMemberModule();
95
- // Memoize permission check to avoid recalculation on every render
96
- const hasPermission = useMemo(() => resolveRbacPermissions({
97
- userRole,
85
+ // Memoize config creation - destructure props to avoid object reference changes
86
+ const familyMemberConfig = useMemo(() => createFamilyMemberConfig({
87
+ dispatch: context.dispatch,
88
+ drawer: context.state.drawer,
89
+ cancelLabel: props.cancelLabel,
90
+ drawerTitle: props.drawerTitle,
91
+ labelActions: props.labelActions,
92
+ labelEmail: props.labelEmail,
93
+ labelEnabled: props.labelEnabled,
94
+ labelFirstName: props.labelFirstName,
95
+ labelId: props.labelId,
96
+ labelPhone: props.labelPhone,
97
+ labelPrimaryContact: props.labelPrimaryContact,
98
+ labelRole: props.labelRole,
99
+ saveLabel: props.saveLabel,
100
+ searchPlaceholder: props.searchPlaceholder,
101
+ tableDescription: props.tableDescription,
102
+ tableTitle: props.tableTitle,
103
+ }), [
104
+ context.dispatch,
105
+ context.state.drawer,
106
+ props.cancelLabel,
107
+ props.drawerTitle,
108
+ props.labelActions,
109
+ props.labelEmail,
110
+ props.labelEnabled,
111
+ props.labelFirstName,
112
+ props.labelId,
113
+ props.labelPhone,
114
+ props.labelPrimaryContact,
115
+ props.labelRole,
116
+ props.saveLabel,
117
+ props.searchPlaceholder,
118
+ props.tableDescription,
119
+ props.tableTitle,
120
+ ]);
121
+ const hasPermission = resolveRbacPermissions({
122
+ userRole: props.userRole,
98
123
  moduleName: "People Management",
99
- }), [userRole]);
100
- // Memoize config creation
101
- const familyMemberConfig = useMemo(() => createFamilyMemberConfig(t, context.state.drawer, context.dispatch), [t, context.state.drawer, context.dispatch]);
124
+ });
102
125
  if (!hasPermission) {
103
126
  return _jsx(RbacNoAccess, { moduleName: "People Management" });
104
127
  }
105
128
  return (_jsx("div", { className: "p-4", children: _jsx(GenericFamilyMemberPage, { overrideConfig: familyMemberConfig, context: context, tableBodyCols: tableBodyCols }) }));
106
129
  };
107
- export const FamilyMemberPage = ({ userRole }) => (_jsx(FamilyMemberProvider, { children: _jsx(FamilyMemberPageInner, { userRole: userRole }) }));
130
+ export const FamilyMemberPage = (props) => (_jsx(FamilyMemberProvider, { children: _jsx(FamilyMemberPageInner, Object.assign({}, props)) }));
@@ -6,4 +6,22 @@
6
6
  * via the `ComponentConfig`.
7
7
  */
8
8
  import { FC } from "react";
9
- export declare const StudentProfilePage: FC;
9
+ import { USER_ROLE } from "@/type";
10
+ interface Props {
11
+ cancelLabel: string;
12
+ drawerTitle: string;
13
+ labelActions: string;
14
+ labelEnabled: string;
15
+ labelFirstName: string;
16
+ labelId: string;
17
+ labelLastName: string;
18
+ labelStatus: string;
19
+ labelStudentCode: string;
20
+ saveLabel: string;
21
+ searchPlaceholder: string;
22
+ tableDescription: string;
23
+ tableTitle: string;
24
+ userRole: USER_ROLE;
25
+ }
26
+ export declare const StudentProfilePage: FC<Props>;
27
+ export {};