@appcorp/fusion-storybook 0.3.14 → 0.3.15

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.
@@ -231,7 +231,7 @@ export const useStudentFeeModule = () => {
231
231
  // 1.4.6 HANDLERS
232
232
  // ============================================================================
233
233
  const handleChange = useCallback(async (field, value) => {
234
- var _a, _b, _c, _d, _e;
234
+ var _a, _b, _c, _d, _e, _f, _g;
235
235
  dispatch({
236
236
  type: STUDENT_FEE_ACTION_TYPES.SET_ERRORS,
237
237
  payload: { errors: {} },
@@ -281,20 +281,26 @@ export const useStudentFeeModule = () => {
281
281
  });
282
282
  }
283
283
  }
284
- catch (_f) {
284
+ catch (_h) {
285
285
  // silent fallback
286
286
  }
287
287
  }
288
288
  if (field === "studentProfileId" && typeof value === "string" && value) {
289
289
  try {
290
- const { data } = await fetchData({
291
- url: "/api/v1/student-profile",
292
- method: API_METHODS.GET,
293
- headers: { "Content-Type": "application/json" },
294
- params: { id: value, schoolId: (_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id },
295
- });
296
- const familyId = (data === null || data === void 0 ? void 0 : data.studentProfile.familyMember.familyId) || "";
297
- const studentProfile = (_c = getCachedStudentProfilesSync().items) === null || _c === void 0 ? void 0 : _c.find((s) => s.id === value);
290
+ // eslint-disable-next-line
291
+ let apiResponse;
292
+ (async () => {
293
+ var _a;
294
+ const response = await fetchData({
295
+ url: "/api/v1/student-profile",
296
+ method: API_METHODS.GET,
297
+ headers: { "Content-Type": "application/json" },
298
+ params: { id: value, schoolId: (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id },
299
+ });
300
+ apiResponse = response;
301
+ })();
302
+ const familyId = ((_d = (_c = (_b = apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse.data) === null || _b === void 0 ? void 0 : _b.studentProfile) === null || _c === void 0 ? void 0 : _c.familyMember) === null || _d === void 0 ? void 0 : _d.familyId) || "";
303
+ const studentProfile = (_e = getCachedStudentProfilesSync().items) === null || _e === void 0 ? void 0 : _e.find((s) => s.id === value);
298
304
  dispatch({
299
305
  type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
300
306
  payload: {
@@ -303,7 +309,7 @@ export const useStudentFeeModule = () => {
303
309
  },
304
310
  });
305
311
  if (studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.discountCode) {
306
- const discountCode = (_d = discountCodes.items) === null || _d === void 0 ? void 0 : _d.find((code) => code.code === studentProfile.discountCode && code.enabled);
312
+ const discountCode = (_f = discountCodes.items) === null || _f === void 0 ? void 0 : _f.find((code) => code.code === studentProfile.discountCode && code.enabled);
307
313
  if (discountCode) {
308
314
  dispatch({
309
315
  type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
@@ -334,13 +340,13 @@ export const useStudentFeeModule = () => {
334
340
  }
335
341
  }
336
342
  }
337
- catch (_g) {
343
+ catch (_j) {
338
344
  // silent fallback
339
345
  }
340
346
  }
341
347
  if (field === "discountCodeId" && typeof value === "string" && value) {
342
348
  try {
343
- const discountCode = (_e = discountCodes.items) === null || _e === void 0 ? void 0 : _e.find((code) => code.id === value && code.enabled);
349
+ const discountCode = (_g = discountCodes.items) === null || _g === void 0 ? void 0 : _g.find((code) => code.id === value && code.enabled);
344
350
  if (discountCode) {
345
351
  const originalFee = Number(currentState.originalFee) || 0;
346
352
  let discountAmount = discountCode.discountType === DISCOUNT_TYPE.PERCENTAGE
@@ -362,7 +368,7 @@ export const useStudentFeeModule = () => {
362
368
  });
363
369
  }
364
370
  }
365
- catch (_h) {
371
+ catch (_k) {
366
372
  // silent fallback
367
373
  }
368
374
  }
@@ -599,6 +605,7 @@ export const useStudentFeeModule = () => {
599
605
  });
600
606
  },
601
607
  errorCallback: (errors) => {
608
+ console.log("_>>>,", errors);
602
609
  dispatch({
603
610
  type: STUDENT_FEE_ACTION_TYPES.SET_ERRORS,
604
611
  payload: { errors },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",