@appcorp/fusion-storybook 0.1.14 → 0.1.16

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.
@@ -128,8 +128,9 @@ export const { actionTypes: ADMISSION_ACTION_TYPES, config: admissionModuleConfi
128
128
  // ENHANCED ADMISSION HOOK WITH API INTEGRATION
129
129
  // ============================================================================
130
130
  export const useAdmissionModule = () => {
131
- var _a, _b, _c, _d, _e;
131
+ var _a, _b, _c, _d, _e, _f;
132
132
  const context = useAdmissionContext();
133
+ const { dispatch } = context;
133
134
  const t = useTranslations("admission");
134
135
  const workspace = getCachedWorkspaceSync();
135
136
  const debouncedQuery = useDebounce(context.state.searchQuery, 800);
@@ -254,25 +255,25 @@ export const useAdmissionModule = () => {
254
255
  value.length >= 13) {
255
256
  formatted = (_c = (_b = formatPhone(value, "PK")) === null || _b === void 0 ? void 0 : _b.international) !== null && _c !== void 0 ? _c : value;
256
257
  }
257
- context.dispatch({
258
+ dispatch({
258
259
  type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
259
260
  payload: { key, value: formatted || value },
260
261
  });
261
- }, [context]);
262
+ }, [dispatch]);
262
263
  const resetFormAndCloseDrawer = useCallback(() => {
263
- context.dispatch({
264
+ dispatch({
264
265
  type: ADMISSION_ACTION_TYPES.SET_ERRORS,
265
266
  payload: { errors: {} },
266
267
  });
267
- context.dispatch({
268
+ dispatch({
268
269
  type: ADMISSION_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
269
270
  payload: { disabled: false },
270
271
  });
271
- context.dispatch({
272
+ dispatch({
272
273
  type: ADMISSION_ACTION_TYPES.SET_DRAWER,
273
274
  payload: { drawer: null },
274
275
  });
275
- }, [context]);
276
+ }, [dispatch]);
276
277
  // ============================================================================
277
278
  // API CALLBACKS
278
279
  // ============================================================================
@@ -282,7 +283,7 @@ export const useAdmissionModule = () => {
282
283
  return;
283
284
  }
284
285
  if (data) {
285
- context.dispatch({
286
+ dispatch({
286
287
  type: ADMISSION_ACTION_TYPES.SET_ITEMS,
287
288
  payload: { items: data.items || [], count: data.count || 0 },
288
289
  });
@@ -302,19 +303,25 @@ export const useAdmissionModule = () => {
302
303
  }
303
304
  };
304
305
  const byIdCallback = ({ data, error }) => {
305
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
306
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
306
307
  if (error) {
307
308
  showToast(t("messagesDetailsFetchFailed"), TOAST_VARIANT.ERROR);
308
309
  return;
309
310
  }
310
311
  if (data) {
311
312
  const admission = data;
313
+ if ((_a = admission === null || admission === void 0 ? void 0 : admission.fatherDetails) === null || _a === void 0 ? void 0 : _a.emergencyContact) {
314
+ setField("emergencyContact", "Father");
315
+ }
316
+ if ((_b = admission === null || admission === void 0 ? void 0 : admission.motherDetails) === null || _b === void 0 ? void 0 : _b.emergencyContact) {
317
+ setField("emergencyContact", "Mother");
318
+ }
312
319
  setField("id", admission.id);
313
- setField("firstName", (_a = admission.studentDetails) === null || _a === void 0 ? void 0 : _a.firstName);
314
- setField("lastName", (_b = admission.studentDetails) === null || _b === void 0 ? void 0 : _b.lastName);
315
- setField("bForm", (_c = admission.studentDetails) === null || _c === void 0 ? void 0 : _c.bForm);
320
+ setField("firstName", (_c = admission.studentDetails) === null || _c === void 0 ? void 0 : _c.firstName);
321
+ setField("lastName", (_d = admission.studentDetails) === null || _d === void 0 ? void 0 : _d.lastName);
322
+ setField("bForm", (_e = admission.studentDetails) === null || _e === void 0 ? void 0 : _e.bForm);
316
323
  // Normalise gender to match GENDER enum values (e.g. 'Male' → 'MALE')
317
- const rawGender = (_d = admission.studentDetails) === null || _d === void 0 ? void 0 : _d.gender;
324
+ const rawGender = (_f = admission.studentDetails) === null || _f === void 0 ? void 0 : _f.gender;
318
325
  let normalizedGender = null;
319
326
  if (typeof rawGender === "string" && rawGender.length > 0) {
320
327
  const upper = rawGender.toUpperCase();
@@ -323,37 +330,37 @@ export const useAdmissionModule = () => {
323
330
  : rawGender;
324
331
  }
325
332
  setField("gender", normalizedGender);
326
- setField("dob", (_e = admission.studentDetails) === null || _e === void 0 ? void 0 : _e.dob);
327
- setField("registrationCode", (_f = admission.studentDetails) === null || _f === void 0 ? void 0 : _f.registrationCode);
328
- setField("discountCode", (_g = admission.studentDetails) === null || _g === void 0 ? void 0 : _g.discountCode);
329
- setField("hafiz", (_h = admission.studentDetails) === null || _h === void 0 ? void 0 : _h.hafiz);
330
- setField("orphan", (_j = admission.studentDetails) === null || _j === void 0 ? void 0 : _j.orphan);
331
- setField("fatherFirstName", (_k = admission.fatherDetails) === null || _k === void 0 ? void 0 : _k.fatherFirstName);
332
- setField("fatherLastName", (_l = admission.fatherDetails) === null || _l === void 0 ? void 0 : _l.fatherLastName);
333
- setField("fatherCnic", (_m = admission.fatherDetails) === null || _m === void 0 ? void 0 : _m.fatherCnic);
334
- setField("fatherMobile", (_o = admission.fatherDetails) === null || _o === void 0 ? void 0 : _o.fatherMobile);
335
- setField("fatherOccupation", (_p = admission.fatherDetails) === null || _p === void 0 ? void 0 : _p.fatherOccupation);
336
- setField("fatherOrganization", (_q = admission.fatherDetails) === null || _q === void 0 ? void 0 : _q.fatherOrganization);
337
- setField("motherFirstName", (_r = admission.motherDetails) === null || _r === void 0 ? void 0 : _r.motherFirstName);
338
- setField("motherLastName", (_s = admission.motherDetails) === null || _s === void 0 ? void 0 : _s.motherLastName);
339
- setField("motherCnic", (_t = admission.motherDetails) === null || _t === void 0 ? void 0 : _t.motherCnic);
340
- setField("motherMobile", (_u = admission.motherDetails) === null || _u === void 0 ? void 0 : _u.motherMobile);
341
- setField("address", (_v = admission.homeDetails) === null || _v === void 0 ? void 0 : _v.address);
342
- setField("city", (_w = admission.homeDetails) === null || _w === void 0 ? void 0 : _w.city);
343
- setField("country", (_x = admission.homeDetails) === null || _x === void 0 ? void 0 : _x.country);
344
- setField("postalCode", (_y = admission.homeDetails) === null || _y === void 0 ? void 0 : _y.postalCode);
345
- setField("state", (_z = admission.homeDetails) === null || _z === void 0 ? void 0 : _z.state);
346
- setField("notes", (_0 = admission.officeUse) === null || _0 === void 0 ? void 0 : _0.notes);
347
- setField("admissionNotes", (_1 = admission.officeUse) === null || _1 === void 0 ? void 0 : _1.admissionNotes);
348
- setField("previousSchool", (_2 = admission.admissionDetails) === null || _2 === void 0 ? void 0 : _2.previousSchool);
349
- setField("siblings", (_3 = admission.admissionDetails) === null || _3 === void 0 ? void 0 : _3.siblings);
350
- setField("classForAdmission", (_4 = admission.admissionDetails) === null || _4 === void 0 ? void 0 : _4.classForAdmission);
333
+ setField("dob", (_g = admission.studentDetails) === null || _g === void 0 ? void 0 : _g.dob);
334
+ setField("registrationCode", (_h = admission.studentDetails) === null || _h === void 0 ? void 0 : _h.registrationCode);
335
+ setField("discountCode", (_j = admission.studentDetails) === null || _j === void 0 ? void 0 : _j.discountCode);
336
+ setField("hafiz", (_k = admission.studentDetails) === null || _k === void 0 ? void 0 : _k.hafiz);
337
+ setField("orphan", (_l = admission.studentDetails) === null || _l === void 0 ? void 0 : _l.orphan);
338
+ setField("fatherFirstName", (_m = admission.fatherDetails) === null || _m === void 0 ? void 0 : _m.fatherFirstName);
339
+ setField("fatherLastName", (_o = admission.fatherDetails) === null || _o === void 0 ? void 0 : _o.fatherLastName);
340
+ setField("fatherCnic", (_p = admission.fatherDetails) === null || _p === void 0 ? void 0 : _p.fatherCnic);
341
+ setField("fatherMobile", (_q = admission.fatherDetails) === null || _q === void 0 ? void 0 : _q.fatherMobile);
342
+ setField("fatherOccupation", (_r = admission.fatherDetails) === null || _r === void 0 ? void 0 : _r.fatherOccupation);
343
+ setField("fatherOrganization", (_s = admission.fatherDetails) === null || _s === void 0 ? void 0 : _s.fatherOrganization);
344
+ setField("motherFirstName", (_t = admission.motherDetails) === null || _t === void 0 ? void 0 : _t.motherFirstName);
345
+ setField("motherLastName", (_u = admission.motherDetails) === null || _u === void 0 ? void 0 : _u.motherLastName);
346
+ setField("motherCnic", (_v = admission.motherDetails) === null || _v === void 0 ? void 0 : _v.motherCnic);
347
+ setField("motherMobile", (_w = admission.motherDetails) === null || _w === void 0 ? void 0 : _w.motherMobile);
348
+ setField("address", (_x = admission.homeDetails) === null || _x === void 0 ? void 0 : _x.address);
349
+ setField("city", (_y = admission.homeDetails) === null || _y === void 0 ? void 0 : _y.city);
350
+ setField("country", (_z = admission.homeDetails) === null || _z === void 0 ? void 0 : _z.country);
351
+ setField("postalCode", (_0 = admission.homeDetails) === null || _0 === void 0 ? void 0 : _0.postalCode);
352
+ setField("state", (_1 = admission.homeDetails) === null || _1 === void 0 ? void 0 : _1.state);
353
+ setField("notes", (_2 = admission.officeUse) === null || _2 === void 0 ? void 0 : _2.notes);
354
+ setField("admissionNotes", (_3 = admission.officeUse) === null || _3 === void 0 ? void 0 : _3.admissionNotes);
355
+ setField("previousSchool", (_4 = admission.admissionDetails) === null || _4 === void 0 ? void 0 : _4.previousSchool);
356
+ setField("siblings", (_5 = admission.admissionDetails) === null || _5 === void 0 ? void 0 : _5.siblings);
357
+ setField("classForAdmission", (_6 = admission.admissionDetails) === null || _6 === void 0 ? void 0 : _6.classForAdmission);
351
358
  setField("status", admission.status || ADMISSION_STATUS.PENDING);
352
- setField("enabled", (_5 = admission.enabled) !== null && _5 !== void 0 ? _5 : true);
359
+ setField("enabled", (_7 = admission.enabled) !== null && _7 !== void 0 ? _7 : true);
353
360
  // Populate AI analysis if present
354
- const aiAnalysis = (_6 = admission
355
- .aiAnalysis) !== null && _6 !== void 0 ? _6 : null;
356
- context.dispatch({
361
+ const aiAnalysis = (_8 = admission
362
+ .aiAnalysis) !== null && _8 !== void 0 ? _8 : null;
363
+ dispatch({
357
364
  type: ADMISSION_ACTION_TYPES.SET_FORM_DATA,
358
365
  payload: { form: { aiAnalysis } },
359
366
  });
@@ -395,39 +402,39 @@ export const useAdmissionModule = () => {
395
402
  // HANDLERS
396
403
  // ============================================================================
397
404
  const handleChange = useCallback((field, value) => {
398
- context.dispatch({
405
+ dispatch({
399
406
  type: ADMISSION_ACTION_TYPES.SET_ERRORS,
400
407
  payload: { errors: {} },
401
408
  });
402
- context.dispatch({
409
+ dispatch({
403
410
  type: ADMISSION_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
404
411
  payload: { disabled: false },
405
412
  });
406
413
  setField(field, value);
407
- }, [setField, context]);
414
+ }, [setField, dispatch]);
408
415
  const handleCloseDrawer = useCallback(() => {
409
416
  resetFormAndCloseDrawer();
410
417
  }, [resetFormAndCloseDrawer]);
411
418
  const handleCreate = useCallback(() => {
412
- context.dispatch({
419
+ dispatch({
413
420
  type: ADMISSION_ACTION_TYPES.SET_DRAWER,
414
421
  payload: { drawer: ADMISSION_DRAWER.FORM_DRAWER },
415
422
  });
416
- }, [context]);
423
+ }, [dispatch]);
417
424
  const handleView = useCallback((row) => {
418
425
  byIdFetchNow === null || byIdFetchNow === void 0 ? void 0 : byIdFetchNow(undefined, { params: { id: row === null || row === void 0 ? void 0 : row.id } });
419
- context.dispatch({
426
+ dispatch({
420
427
  type: ADMISSION_ACTION_TYPES.SET_DRAWER,
421
428
  payload: { drawer: ADMISSION_DRAWER.VIEW_DRAWER },
422
429
  });
423
- }, [context, byIdFetchNow]);
430
+ }, [dispatch, byIdFetchNow]);
424
431
  const handleEdit = useCallback((row) => {
425
432
  byIdFetchNow === null || byIdFetchNow === void 0 ? void 0 : byIdFetchNow(undefined, { params: { id: row === null || row === void 0 ? void 0 : row.id } });
426
- context.dispatch({
433
+ dispatch({
427
434
  type: ADMISSION_ACTION_TYPES.SET_DRAWER,
428
435
  payload: { drawer: ADMISSION_DRAWER.FORM_DRAWER },
429
436
  });
430
- }, [context, byIdFetchNow]);
437
+ }, [dispatch, byIdFetchNow]);
431
438
  const handleDelete = useCallback((row) => {
432
439
  if (!confirm(t("areYouSureYouWantToDeleteThisAdmission")))
433
440
  return;
@@ -436,43 +443,43 @@ export const useAdmissionModule = () => {
436
443
  });
437
444
  }, [t, deleteFetchNow]);
438
445
  const handleFilters = useCallback(() => {
439
- context.dispatch({
446
+ dispatch({
440
447
  type: ADMISSION_ACTION_TYPES.SET_DRAWER,
441
448
  payload: { drawer: ADMISSION_DRAWER.FILTER_DRAWER },
442
449
  });
443
- }, [context]);
450
+ }, [dispatch]);
444
451
  const handlePageChange = useCallback((page) => {
445
- context.dispatch({
452
+ dispatch({
446
453
  type: ADMISSION_ACTION_TYPES.SET_CURRENT_PAGE,
447
454
  payload: { currentPage: page },
448
455
  });
449
- }, [context]);
456
+ }, [dispatch]);
450
457
  const handlePageLimitChange = useCallback((limit) => {
451
- context.dispatch({
458
+ dispatch({
452
459
  type: ADMISSION_ACTION_TYPES.SET_PAGE_LIMIT,
453
460
  payload: { pageLimit: limit },
454
461
  });
455
- }, [context]);
462
+ }, [dispatch]);
456
463
  const handleSearch = useCallback((query) => {
457
- context.dispatch({
464
+ dispatch({
458
465
  type: ADMISSION_ACTION_TYPES.SET_SEARCH_QUERY,
459
466
  payload: { searchQuery: query },
460
467
  });
461
- }, [context]);
468
+ }, [dispatch]);
462
469
  const handleSetStartDate = useCallback((startDate) => {
463
- context.dispatch({
470
+ dispatch({
464
471
  type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
465
472
  payload: { key: "filterStartDate", value: startDate },
466
473
  });
467
- }, [context]);
474
+ }, [dispatch]);
468
475
  const handleSetEndDate = useCallback((endDate) => {
469
- context.dispatch({
476
+ dispatch({
470
477
  type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
471
478
  payload: { key: "filterEndDate", value: endDate },
472
479
  });
473
- }, [context]);
480
+ }, [dispatch]);
474
481
  const clearFilters = useCallback(() => {
475
- context.dispatch({
482
+ dispatch({
476
483
  type: ADMISSION_ACTION_TYPES.SET_FILTERS,
477
484
  payload: {
478
485
  filters: {
@@ -487,11 +494,11 @@ export const useAdmissionModule = () => {
487
494
  },
488
495
  },
489
496
  });
490
- context.dispatch({
497
+ dispatch({
491
498
  type: ADMISSION_ACTION_TYPES.SET_CURRENT_PAGE,
492
499
  payload: { currentPage: 1 },
493
500
  });
494
- }, [context]);
501
+ }, [dispatch]);
495
502
  const handlePrint = useCallback(async (row) => {
496
503
  var _a, _b, _c, _d, _e;
497
504
  if (!row)
@@ -589,17 +596,17 @@ export const useAdmissionModule = () => {
589
596
  const schoolId = (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id;
590
597
  if (!schoolId)
591
598
  return;
592
- context.dispatch({
599
+ dispatch({
593
600
  type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
594
601
  payload: { key: "analyzeLoading", value: true },
595
602
  });
596
- context.dispatch({
603
+ dispatch({
597
604
  type: ADMISSION_ACTION_TYPES.SET_FORM_DATA,
598
605
  payload: { form: { analyzeError: null } },
599
606
  });
600
607
  // Open view drawer so user can watch progress
601
608
  await (byIdFetchNow === null || byIdFetchNow === void 0 ? void 0 : byIdFetchNow(undefined, { params: { id: tableRow.id } }));
602
- context.dispatch({
609
+ dispatch({
603
610
  type: ADMISSION_ACTION_TYPES.SET_DRAWER,
604
611
  payload: { drawer: ADMISSION_DRAWER.VIEW_DRAWER },
605
612
  });
@@ -612,12 +619,12 @@ export const useAdmissionModule = () => {
612
619
  },
613
620
  body: JSON.stringify({ id: tableRow.id, schoolId }),
614
621
  });
615
- context.dispatch({
622
+ dispatch({
616
623
  type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
617
624
  payload: { key: "analyzeLoading", value: false },
618
625
  });
619
626
  if (error) {
620
- context.dispatch({
627
+ dispatch({
621
628
  type: ADMISSION_ACTION_TYPES.SET_FORM_DATA,
622
629
  payload: { form: { analyzeError: t("messagesAnalyzeFailed") } },
623
630
  });
@@ -626,7 +633,7 @@ export const useAdmissionModule = () => {
626
633
  }
627
634
  const result = data;
628
635
  if (result === null || result === void 0 ? void 0 : result.aiAnalysis) {
629
- context.dispatch({
636
+ dispatch({
630
637
  type: ADMISSION_ACTION_TYPES.SET_FORM_DATA,
631
638
  payload: { form: { aiAnalysis: result.aiAnalysis } },
632
639
  });
@@ -637,9 +644,9 @@ export const useAdmissionModule = () => {
637
644
  description: `${t("messagesAnalyzeSuccess")} ${(_b = result === null || result === void 0 ? void 0 : result.score) !== null && _b !== void 0 ? _b : "N/A"} — ${(_c = result === null || result === void 0 ? void 0 : result.status) !== null && _c !== void 0 ? _c : ""}`,
638
645
  variant: TOAST_VARIANT.SUCCESS,
639
646
  });
640
- }, [(_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.id, t, showToast, byIdFetchNow, listFetchNow, context]);
647
+ }, [(_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.id, t, showToast, byIdFetchNow, listFetchNow, dispatch]);
641
648
  const handleSubmit = useCallback(() => {
642
- context.dispatch({
649
+ dispatch({
643
650
  type: ADMISSION_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
644
651
  payload: { disabled: true },
645
652
  });
@@ -647,27 +654,80 @@ export const useAdmissionModule = () => {
647
654
  params: updateParams,
648
655
  schema: admissionFormValidation,
649
656
  successCallback: () => {
657
+ var _a;
650
658
  updateFetchNow(undefined, {
651
- body: JSON.stringify(updateParams),
659
+ body: JSON.stringify({
660
+ schoolId: (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id,
661
+ admissionDetails: {
662
+ classForAdmission: updateParams.classForAdmission,
663
+ previousSchool: updateParams.previousSchool,
664
+ siblings: updateParams.siblings,
665
+ },
666
+ fatherDetails: {
667
+ fatherCnic: updateParams.fatherCnic,
668
+ fatherFirstName: updateParams.fatherFirstName,
669
+ fatherLastName: updateParams.fatherLastName,
670
+ fatherMobile: updateParams.fatherMobile,
671
+ fatherOccupation: updateParams.fatherOccupation,
672
+ fatherOrganization: updateParams.fatherOrganization,
673
+ emergencyContact: updateParams.emergencyContact === "Father",
674
+ },
675
+ motherDetails: {
676
+ motherCnic: updateParams.motherCnic,
677
+ motherFirstName: updateParams.motherFirstName,
678
+ motherLastName: updateParams.motherLastName,
679
+ motherMobile: updateParams.motherMobile,
680
+ emergencyContact: updateParams.emergencyContact === "Mother",
681
+ },
682
+ homeDetails: {
683
+ address: updateParams.address,
684
+ city: updateParams.city,
685
+ country: updateParams.country,
686
+ postalCode: updateParams.postalCode,
687
+ state: updateParams.state,
688
+ },
689
+ officeUse: {
690
+ notes: updateParams.notes,
691
+ admissionNotes: updateParams.admissionNotes,
692
+ },
693
+ studentDetails: {
694
+ bForm: updateParams.bForm,
695
+ discountCode: updateParams.discountCode,
696
+ dob: updateParams.dob,
697
+ firstName: updateParams.firstName,
698
+ gender: updateParams.gender,
699
+ hafiz: updateParams.hafiz,
700
+ lastName: updateParams.lastName,
701
+ orphan: updateParams.orphan,
702
+ registrationCode: updateParams.registrationCode,
703
+ },
704
+ }),
652
705
  });
653
706
  },
654
707
  errorCallback: (errors) => {
655
- context.dispatch({
708
+ dispatch({
656
709
  type: ADMISSION_ACTION_TYPES.SET_ERRORS,
657
710
  payload: { errors },
658
711
  });
659
- context.dispatch({
712
+ dispatch({
660
713
  type: ADMISSION_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
661
714
  payload: { disabled: false },
662
715
  });
663
716
  showToast(t("messagesFormErrors"), TOAST_VARIANT.ERROR);
664
717
  },
665
718
  });
666
- }, [context, updateParams, t, showToast, updateFetchNow]);
719
+ }, [
720
+ dispatch,
721
+ updateParams,
722
+ t,
723
+ showToast,
724
+ updateFetchNow,
725
+ (_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.id,
726
+ ]);
667
727
  // ============================================================================
668
728
  // HEADER & ROW ACTIONS
669
729
  // ============================================================================
670
- const hasGeminiSecrets = Boolean(((_d = workspace === null || workspace === void 0 ? void 0 : workspace.secrets) === null || _d === void 0 ? void 0 : _d.GEMINI_API_KEY) && ((_e = workspace === null || workspace === void 0 ? void 0 : workspace.secrets) === null || _e === void 0 ? void 0 : _e.GEMINI_MODEL));
730
+ const hasGeminiSecrets = Boolean(((_e = workspace === null || workspace === void 0 ? void 0 : workspace.secrets) === null || _e === void 0 ? void 0 : _e.GEMINI_API_KEY) && ((_f = workspace === null || workspace === void 0 ? void 0 : workspace.secrets) === null || _f === void 0 ? void 0 : _f.GEMINI_MODEL));
671
731
  const headerActions = useMemo(() => [
672
732
  {
673
733
  enabled: true,
@@ -732,13 +792,13 @@ export const useAdmissionModule = () => {
732
792
  t,
733
793
  ]);
734
794
  const applyFilters = useCallback(() => {
735
- context.dispatch({
795
+ dispatch({
736
796
  type: ADMISSION_ACTION_TYPES.SET_CURRENT_PAGE,
737
797
  payload: { currentPage: 1 },
738
798
  });
739
799
  listFetchNow();
740
800
  handleCloseDrawer();
741
- }, [context, listFetchNow, handleCloseDrawer]);
801
+ }, [dispatch, listFetchNow, handleCloseDrawer]);
742
802
  // ============================================================================
743
803
  // EFFECTS
744
804
  // ============================================================================
@@ -750,7 +810,7 @@ export const useAdmissionModule = () => {
750
810
  const { count, items } = await getCachedAdmissions({
751
811
  params: listParams,
752
812
  });
753
- context.dispatch({
813
+ dispatch({
754
814
  type: ADMISSION_ACTION_TYPES.SET_ITEMS,
755
815
  payload: { items: items || [], count: count || 0 },
756
816
  });
@@ -759,7 +819,7 @@ export const useAdmissionModule = () => {
759
819
  showToast(t("messagesFetchFailed"), TOAST_VARIANT.ERROR);
760
820
  }
761
821
  })();
762
- }, [listParams, workspace === null || workspace === void 0 ? void 0 : workspace.id, t, showToast, context.dispatch]);
822
+ }, [listParams, workspace === null || workspace === void 0 ? void 0 : workspace.id, t, showToast, dispatch]);
763
823
  // ============================================================================
764
824
  // RETURN
765
825
  // ============================================================================
@@ -131,7 +131,6 @@ const AdmissionPageInner = (props) => {
131
131
  if (!hasPermission) {
132
132
  return _jsx(RbacNoAccess, { moduleName: "Admission" });
133
133
  }
134
- console.log("Rendering AdmissionPageInner with config:", admissionConfig);
135
134
  return (_jsx("div", { className: "p-4", children: _jsx(GenericAdmissionPage, { overrideConfig: admissionConfig, context: context, tableBodyCols: tableBodyCols }) }));
136
135
  };
137
136
  export const AdmissionPage = (props) => (_jsx(AdmissionProvider, { children: _jsx(AdmissionPageInner, Object.assign({}, props)) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",