@smvtech/x-flux 1.1.9 → 1.1.11

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.
package/dist/index.js CHANGED
@@ -1019,19 +1019,12 @@ var EDCFlowProvider = ({ children, orderId }) => {
1019
1019
  const currentApplicant = prev[application_id];
1020
1020
  if (!currentApplicant) return prev;
1021
1021
  const applicantWithUpdatedAnswer = updateApplicantWithAnswer(
1022
- currentApplicant,
1022
+ { ...currentApplicant, application: updatedAnswerData.application, traveller: updatedAnswerData.traveller },
1023
1023
  updatedAnswerData.answers.visa_questions_id,
1024
1024
  updatedAnswerData.answers,
1025
1025
  questionnaire
1026
1026
  );
1027
- const updatedApplicants = {
1028
- ...prev,
1029
- [application_id]: {
1030
- ...applicantWithUpdatedAnswer,
1031
- application: updatedAnswerData.application,
1032
- traveller: updatedAnswerData.traveller
1033
- }
1034
- };
1027
+ const updatedApplicants = { ...prev, [application_id]: applicantWithUpdatedAnswer };
1035
1028
  if (shouldRecalculateSideEffects) {
1036
1029
  const { updatedQuestionnaire, updatedApplicants: applicantsWithSideEffects } = runApplicantSideEffects(updatedApplicants, questionnaire, dynamicQuestionMap);
1037
1030
  setQuestionnaire(updatedQuestionnaire);
@@ -1058,28 +1051,16 @@ var EDCFlowProvider = ({ children, orderId }) => {
1058
1051
  [data.docId]: data.signedUrl
1059
1052
  }));
1060
1053
  }
1061
- setApplicants((prev) => {
1062
- const currentApplicant = prev[applicationId];
1063
- if (!currentApplicant) return prev;
1064
- const applicantWithUpdatedAnswer = updateApplicantWithAnswer(
1065
- currentApplicant,
1066
- data.answer.visa_questions_id,
1067
- data.answer,
1068
- questionnaire
1069
- );
1070
- return {
1071
- ...prev,
1072
- [applicationId]: applicantWithUpdatedAnswer
1073
- };
1074
- });
1075
1054
  setSuccess("Document auto-fixed successfully");
1076
1055
  } catch (err) {
1077
1056
  console.error("Failed to apply auto fix:", err);
1078
1057
  setError("Failed to apply auto fix");
1079
1058
  throw err;
1059
+ } finally {
1060
+ await refreshApplicant(applicationId);
1080
1061
  }
1081
1062
  },
1082
- [questionnaire, order]
1063
+ [questionnaire, order, refreshApplicant]
1083
1064
  );
1084
1065
  const deleteApplicantById = react.useCallback(async (application_id) => {
1085
1066
  if (!questionnaire || !order) return;
package/dist/index.mjs CHANGED
@@ -993,19 +993,12 @@ var EDCFlowProvider = ({ children, orderId }) => {
993
993
  const currentApplicant = prev[application_id];
994
994
  if (!currentApplicant) return prev;
995
995
  const applicantWithUpdatedAnswer = updateApplicantWithAnswer(
996
- currentApplicant,
996
+ { ...currentApplicant, application: updatedAnswerData.application, traveller: updatedAnswerData.traveller },
997
997
  updatedAnswerData.answers.visa_questions_id,
998
998
  updatedAnswerData.answers,
999
999
  questionnaire
1000
1000
  );
1001
- const updatedApplicants = {
1002
- ...prev,
1003
- [application_id]: {
1004
- ...applicantWithUpdatedAnswer,
1005
- application: updatedAnswerData.application,
1006
- traveller: updatedAnswerData.traveller
1007
- }
1008
- };
1001
+ const updatedApplicants = { ...prev, [application_id]: applicantWithUpdatedAnswer };
1009
1002
  if (shouldRecalculateSideEffects) {
1010
1003
  const { updatedQuestionnaire, updatedApplicants: applicantsWithSideEffects } = runApplicantSideEffects(updatedApplicants, questionnaire, dynamicQuestionMap);
1011
1004
  setQuestionnaire(updatedQuestionnaire);
@@ -1032,28 +1025,16 @@ var EDCFlowProvider = ({ children, orderId }) => {
1032
1025
  [data.docId]: data.signedUrl
1033
1026
  }));
1034
1027
  }
1035
- setApplicants((prev) => {
1036
- const currentApplicant = prev[applicationId];
1037
- if (!currentApplicant) return prev;
1038
- const applicantWithUpdatedAnswer = updateApplicantWithAnswer(
1039
- currentApplicant,
1040
- data.answer.visa_questions_id,
1041
- data.answer,
1042
- questionnaire
1043
- );
1044
- return {
1045
- ...prev,
1046
- [applicationId]: applicantWithUpdatedAnswer
1047
- };
1048
- });
1049
1028
  setSuccess("Document auto-fixed successfully");
1050
1029
  } catch (err) {
1051
1030
  console.error("Failed to apply auto fix:", err);
1052
1031
  setError("Failed to apply auto fix");
1053
1032
  throw err;
1033
+ } finally {
1034
+ await refreshApplicant(applicationId);
1054
1035
  }
1055
1036
  },
1056
- [questionnaire, order]
1037
+ [questionnaire, order, refreshApplicant]
1057
1038
  );
1058
1039
  const deleteApplicantById = useCallback(async (application_id) => {
1059
1040
  if (!questionnaire || !order) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smvtech/x-flux",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "x-flux - A powerful React package for managing effective document collection flows, visa questionnaires, travellers, and applications",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",