@appcorp/fusion-storybook 0.2.90 → 0.2.93

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,7 @@ import { ADMISSION_API_ROUTES } from "../../../constants";
11
11
  import { admissionFormValidation } from "../validate";
12
12
  import { getCachedWorkspaceSync } from "../../workspace/cache";
13
13
  import { generateAdmissionReceiptPDF, } from "../../../utils/admission-pdf";
14
+ import { normalizeIdNumber } from "../../../utils/id-number";
14
15
  import { formatNumber } from "@react-pakistan/util-functions/general/format-number";
15
16
  import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
16
17
  import { Filter, Plus } from "lucide-react";
@@ -556,7 +557,7 @@ export const useAdmissionModule = () => {
556
557
  siblings: updateParams.siblings,
557
558
  },
558
559
  fatherDetails: {
559
- fatherIdNumber: updateParams.fatherIdNumber,
560
+ fatherIdNumber: normalizeIdNumber(updateParams.fatherIdNumber),
560
561
  fatherFirstName: updateParams.fatherFirstName,
561
562
  fatherLastName: updateParams.fatherLastName,
562
563
  fatherMobile: updateParams.fatherMobile,
@@ -565,7 +566,7 @@ export const useAdmissionModule = () => {
565
566
  emergencyContact: updateParams.emergencyContact === "Father",
566
567
  },
567
568
  motherDetails: {
568
- motherIdNumber: updateParams.motherIdNumber || "",
569
+ motherIdNumber: normalizeIdNumber(updateParams.motherIdNumber || ""),
569
570
  motherFirstName: updateParams.motherFirstName || "N/A",
570
571
  motherLastName: updateParams.motherLastName || "N/A",
571
572
  motherMobile: updateParams.motherMobile,
@@ -583,7 +584,7 @@ export const useAdmissionModule = () => {
583
584
  admissionNotes: updateParams.admissionNotes,
584
585
  },
585
586
  studentDetails: {
586
- studentIdNumber: updateParams.studentIdNumber,
587
+ studentIdNumber: normalizeIdNumber(updateParams.studentIdNumber),
587
588
  discountCode: updateParams.discountCode,
588
589
  dob: updateParams.dob,
589
590
  firstName: updateParams.firstName,
@@ -9,7 +9,7 @@ export declare const admissionFormValidation: z.ZodObject<{
9
9
  registrationCode: z.ZodString;
10
10
  firstName: z.ZodString;
11
11
  lastName: z.ZodString;
12
- studentIdNumber: z.ZodString;
12
+ studentIdNumber: z.ZodPipe<z.ZodString, z.ZodTransform<string | null | undefined, string>>;
13
13
  dob: z.ZodString;
14
14
  gender: z.ZodEnum<typeof GENDER>;
15
15
  discountCode: z.ZodOptional<z.ZodString>;
@@ -17,13 +17,13 @@ export declare const admissionFormValidation: z.ZodObject<{
17
17
  orphan: z.ZodOptional<z.ZodBoolean>;
18
18
  fatherFirstName: z.ZodString;
19
19
  fatherLastName: z.ZodString;
20
- fatherIdNumber: z.ZodString;
20
+ fatherIdNumber: z.ZodPipe<z.ZodString, z.ZodTransform<string | null | undefined, string>>;
21
21
  fatherMobile: z.ZodString;
22
22
  fatherOccupation: z.ZodOptional<z.ZodString>;
23
23
  fatherOrganization: z.ZodOptional<z.ZodString>;
24
24
  motherFirstName: z.ZodString;
25
25
  motherLastName: z.ZodString;
26
- motherIdNumber: z.ZodString;
26
+ motherIdNumber: z.ZodPipe<z.ZodString, z.ZodTransform<string | null | undefined, string>>;
27
27
  motherMobile: z.ZodString;
28
28
  address: z.ZodString;
29
29
  city: z.ZodString;
@@ -5,12 +5,13 @@
5
5
  */
6
6
  import { z } from "zod";
7
7
  import { GENDER } from "../../type";
8
+ import { normalizeIdNumber } from "../../utils/id-number";
8
9
  export const admissionFormValidation = z.object({
9
10
  // Student Information
10
11
  registrationCode: z.string().min(1, "Registration code is required"),
11
12
  firstName: z.string().min(1, "First name is required"),
12
13
  lastName: z.string().min(1, "Last name is required"),
13
- studentIdNumber: z.string().min(1, "Student ID number is required"),
14
+ studentIdNumber: z.string().min(1, "Student ID number is required").transform(normalizeIdNumber),
14
15
  dob: z
15
16
  .string()
16
17
  .min(1, "Date of birth is required")
@@ -33,14 +34,14 @@ export const admissionFormValidation = z.object({
33
34
  // Father Information
34
35
  fatherFirstName: z.string().min(1, "Father's first name is required"),
35
36
  fatherLastName: z.string().min(1, "Father's last name is required"),
36
- fatherIdNumber: z.string().min(1, "Father's ID number is required"),
37
+ fatherIdNumber: z.string().min(1, "Father's ID number is required").transform(normalizeIdNumber),
37
38
  fatherMobile: z.string().min(1, "Father's mobile number is required"),
38
39
  fatherOccupation: z.string().optional(),
39
40
  fatherOrganization: z.string().optional(),
40
41
  // Mother Information
41
42
  motherFirstName: z.string().min(1, "Mother's first name is required"),
42
43
  motherLastName: z.string().min(1, "Mother's last name is required"),
43
- motherIdNumber: z.string().min(1, "Mother's ID number is required"),
44
+ motherIdNumber: z.string().min(1, "Mother's ID number is required").transform(normalizeIdNumber),
44
45
  motherMobile: z.string().min(1, "Mother's mobile number is required"),
45
46
  // Home Information
46
47
  address: z.string().min(1, "Home address is required"),
@@ -426,15 +426,15 @@ export const useFamilyModule = () => {
426
426
  // ==========================================================================
427
427
  // 1.4.9 EFFECTS
428
428
  // ==========================================================================
429
+ useEffect(() => {
430
+ listFetchNowRef.current = listFetchNow;
431
+ }, [listFetchNow]);
429
432
  useEffect(() => {
430
433
  var _a, _b;
431
434
  if (!((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id))
432
435
  return;
433
436
  (_b = listFetchNowRef.current) === null || _b === void 0 ? void 0 : _b.call(listFetchNowRef);
434
437
  }, [listParams, (_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id]);
435
- useEffect(() => {
436
- listFetchNowRef.current = listFetchNow;
437
- }, [listFetchNow]);
438
438
  // ==========================================================================
439
439
  // 1.4.10 RETURN
440
440
  // ==========================================================================
@@ -26,6 +26,7 @@ import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
26
26
  import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
27
27
  import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
28
28
  import { pageLimit } from "./constants";
29
+ import { normalizeIdNumber } from "../../utils/id-number";
29
30
  import { FAMILY_MEMBER_API_ROUTES } from "../../constants";
30
31
  import { familyMemberFormValidation } from "./validate";
31
32
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
@@ -407,7 +408,7 @@ export const useFamilyMemberModule = () => {
407
408
  schema: familyMemberFormValidation,
408
409
  successCallback: () => {
409
410
  updateFetchNow(undefined, {
410
- body: JSON.stringify(updateParams),
411
+ body: JSON.stringify(Object.assign(Object.assign({}, updateParams), { idNumber: normalizeIdNumber(updateParams.idNumber) })),
411
412
  });
412
413
  },
413
414
  errorCallback: (errors) => {
@@ -468,15 +469,15 @@ export const useFamilyMemberModule = () => {
468
469
  // ============================================================================
469
470
  // 1.4.9 EFFECTS
470
471
  // ============================================================================
472
+ useEffect(() => {
473
+ listFetchNowRef.current = listFetchNow;
474
+ }, [listFetchNow]);
471
475
  useEffect(() => {
472
476
  var _a, _b;
473
477
  if (!((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id))
474
478
  return;
475
479
  (_b = listFetchNowRef.current) === null || _b === void 0 ? void 0 : _b.call(listFetchNowRef);
476
480
  }, [listParams, (_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id]);
477
- useEffect(() => {
478
- listFetchNowRef.current = listFetchNow;
479
- }, [listFetchNow]);
480
481
  // ============================================================================
481
482
  // 1.4.10 RETURN
482
483
  // ============================================================================
@@ -25,7 +25,7 @@ export declare const familyMemberFormValidation: z.ZodObject<{
25
25
  relationship: z.ZodOptional<z.ZodString>;
26
26
  occupation: z.ZodOptional<z.ZodString>;
27
27
  emergencyPhone: z.ZodOptional<z.ZodString>;
28
- idNumber: z.ZodOptional<z.ZodString>;
28
+ idNumber: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | null | undefined, string | undefined>>;
29
29
  avatar: z.ZodOptional<z.ZodString>;
30
30
  isPrimary: z.ZodOptional<z.ZodBoolean>;
31
31
  enabled: z.ZodOptional<z.ZodBoolean>;
@@ -4,6 +4,7 @@
4
4
  * Zod validation schemas for family-member form data.
5
5
  */
6
6
  import { z } from "zod";
7
+ import { normalizeIdNumber } from "../../utils/id-number";
7
8
  // ============================================================================
8
9
  // VALIDATION KEYS (used as Zod error messages, translated via getTranslatedError)
9
10
  // ============================================================================
@@ -35,7 +36,7 @@ export const familyMemberFormValidation = z.object({
35
36
  relationship: z.string().optional(),
36
37
  occupation: z.string().optional(),
37
38
  emergencyPhone: z.string().optional(),
38
- idNumber: z.string().optional(),
39
+ idNumber: z.string().optional().transform((val) => (val ? normalizeIdNumber(val) : val)),
39
40
  avatar: z.string().optional(),
40
41
  isPrimary: z.boolean().optional(),
41
42
  enabled: z.boolean().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.2.90",
3
+ "version": "0.2.93",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",