@smvtech/x-flux 1.1.2 → 1.1.3
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.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +44 -1
- package/dist/index.mjs +44 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5360,6 +5360,7 @@ type TEDCFlowContext = {
|
|
|
5360
5360
|
getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
|
|
5361
5361
|
acceptOrderQCTermsAndConditions: () => Promise<void>;
|
|
5362
5362
|
runAllValidations: () => Promise<void>;
|
|
5363
|
+
runApplicantValidations: (applicationId: string) => Promise<void>;
|
|
5363
5364
|
};
|
|
5364
5365
|
type TEDCFlowProviderProps = {
|
|
5365
5366
|
children: ReactNode;
|
|
@@ -5459,6 +5460,7 @@ declare const EDCFlow: {
|
|
|
5459
5460
|
getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
|
|
5460
5461
|
acceptOrderQCTermsAndConditions: () => Promise<void>;
|
|
5461
5462
|
runAllValidations: () => Promise<void>;
|
|
5463
|
+
runApplicantValidations: (applicationId: string) => Promise<void>;
|
|
5462
5464
|
};
|
|
5463
5465
|
};
|
|
5464
5466
|
|
package/dist/index.d.ts
CHANGED
|
@@ -5360,6 +5360,7 @@ type TEDCFlowContext = {
|
|
|
5360
5360
|
getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
|
|
5361
5361
|
acceptOrderQCTermsAndConditions: () => Promise<void>;
|
|
5362
5362
|
runAllValidations: () => Promise<void>;
|
|
5363
|
+
runApplicantValidations: (applicationId: string) => Promise<void>;
|
|
5363
5364
|
};
|
|
5364
5365
|
type TEDCFlowProviderProps = {
|
|
5365
5366
|
children: ReactNode;
|
|
@@ -5459,6 +5460,7 @@ declare const EDCFlow: {
|
|
|
5459
5460
|
getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
|
|
5460
5461
|
acceptOrderQCTermsAndConditions: () => Promise<void>;
|
|
5461
5462
|
runAllValidations: () => Promise<void>;
|
|
5463
|
+
runApplicantValidations: (applicationId: string) => Promise<void>;
|
|
5462
5464
|
};
|
|
5463
5465
|
};
|
|
5464
5466
|
|
package/dist/index.js
CHANGED
|
@@ -855,6 +855,18 @@ var runAllValidations = async (orderId) => {
|
|
|
855
855
|
}
|
|
856
856
|
};
|
|
857
857
|
};
|
|
858
|
+
var runApplicantValidations = async (applicationId) => {
|
|
859
|
+
const client = getClient();
|
|
860
|
+
const response = await client.post(`/edc/run-applicant-validations`, {
|
|
861
|
+
application_id: applicationId
|
|
862
|
+
});
|
|
863
|
+
const rawData = response.data.data;
|
|
864
|
+
return {
|
|
865
|
+
data: {
|
|
866
|
+
application: transformApplicationData(rawData.application)
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
};
|
|
858
870
|
var updateOrderQCTermsAndConditions = async (orderId) => {
|
|
859
871
|
const client = getClient();
|
|
860
872
|
const response = await client.patch(`/visa_orders/update-order-qc-terms-conditions/${orderId}`);
|
|
@@ -1124,6 +1136,36 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1124
1136
|
setError("Failed to run all validations");
|
|
1125
1137
|
}
|
|
1126
1138
|
}, [orderId, questionnaire, dynamicQuestionMap, activeApplicant]);
|
|
1139
|
+
const runApplicantValidationsHandler = react.useCallback(async (applicationId) => {
|
|
1140
|
+
if (!orderId || !questionnaire) return;
|
|
1141
|
+
try {
|
|
1142
|
+
setError(null);
|
|
1143
|
+
const { data } = await runApplicantValidations(applicationId);
|
|
1144
|
+
if (data.application) {
|
|
1145
|
+
const applicant = createApplicantData(
|
|
1146
|
+
data.application.traveller,
|
|
1147
|
+
data.application.answers,
|
|
1148
|
+
questionnaire,
|
|
1149
|
+
data.application.application
|
|
1150
|
+
);
|
|
1151
|
+
if (applicant) {
|
|
1152
|
+
setApplicants((prev) => {
|
|
1153
|
+
const updatedApplicants = {
|
|
1154
|
+
...prev,
|
|
1155
|
+
[applicationId]: applicant
|
|
1156
|
+
};
|
|
1157
|
+
const { updatedQuestionnaire, updatedApplicants: applicantsWithSideEffects } = runApplicantSideEffects(updatedApplicants, questionnaire, dynamicQuestionMap);
|
|
1158
|
+
setQuestionnaire(updatedQuestionnaire);
|
|
1159
|
+
return applicantsWithSideEffects;
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
setSuccess("Applicant validations completed successfully");
|
|
1164
|
+
} catch (err) {
|
|
1165
|
+
console.error("Failed to run applicant validations:", err);
|
|
1166
|
+
setError("Failed to run applicant validations");
|
|
1167
|
+
}
|
|
1168
|
+
}, [orderId, questionnaire, dynamicQuestionMap]);
|
|
1127
1169
|
react.useEffect(() => {
|
|
1128
1170
|
if (!orderId) return;
|
|
1129
1171
|
const initialize = async () => {
|
|
@@ -1175,7 +1217,8 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1175
1217
|
refreshApplicant,
|
|
1176
1218
|
getS3UrlForAsset,
|
|
1177
1219
|
acceptOrderQCTermsAndConditions,
|
|
1178
|
-
runAllValidations: runAllValidationsHandler
|
|
1220
|
+
runAllValidations: runAllValidationsHandler,
|
|
1221
|
+
runApplicantValidations: runApplicantValidationsHandler
|
|
1179
1222
|
};
|
|
1180
1223
|
return /* @__PURE__ */ jsxRuntime.jsx(EDCFlowContext.Provider, { value, children });
|
|
1181
1224
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -829,6 +829,18 @@ var runAllValidations = async (orderId) => {
|
|
|
829
829
|
}
|
|
830
830
|
};
|
|
831
831
|
};
|
|
832
|
+
var runApplicantValidations = async (applicationId) => {
|
|
833
|
+
const client = getClient();
|
|
834
|
+
const response = await client.post(`/edc/run-applicant-validations`, {
|
|
835
|
+
application_id: applicationId
|
|
836
|
+
});
|
|
837
|
+
const rawData = response.data.data;
|
|
838
|
+
return {
|
|
839
|
+
data: {
|
|
840
|
+
application: transformApplicationData(rawData.application)
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
};
|
|
832
844
|
var updateOrderQCTermsAndConditions = async (orderId) => {
|
|
833
845
|
const client = getClient();
|
|
834
846
|
const response = await client.patch(`/visa_orders/update-order-qc-terms-conditions/${orderId}`);
|
|
@@ -1098,6 +1110,36 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1098
1110
|
setError("Failed to run all validations");
|
|
1099
1111
|
}
|
|
1100
1112
|
}, [orderId, questionnaire, dynamicQuestionMap, activeApplicant]);
|
|
1113
|
+
const runApplicantValidationsHandler = useCallback(async (applicationId) => {
|
|
1114
|
+
if (!orderId || !questionnaire) return;
|
|
1115
|
+
try {
|
|
1116
|
+
setError(null);
|
|
1117
|
+
const { data } = await runApplicantValidations(applicationId);
|
|
1118
|
+
if (data.application) {
|
|
1119
|
+
const applicant = createApplicantData(
|
|
1120
|
+
data.application.traveller,
|
|
1121
|
+
data.application.answers,
|
|
1122
|
+
questionnaire,
|
|
1123
|
+
data.application.application
|
|
1124
|
+
);
|
|
1125
|
+
if (applicant) {
|
|
1126
|
+
setApplicants((prev) => {
|
|
1127
|
+
const updatedApplicants = {
|
|
1128
|
+
...prev,
|
|
1129
|
+
[applicationId]: applicant
|
|
1130
|
+
};
|
|
1131
|
+
const { updatedQuestionnaire, updatedApplicants: applicantsWithSideEffects } = runApplicantSideEffects(updatedApplicants, questionnaire, dynamicQuestionMap);
|
|
1132
|
+
setQuestionnaire(updatedQuestionnaire);
|
|
1133
|
+
return applicantsWithSideEffects;
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
setSuccess("Applicant validations completed successfully");
|
|
1138
|
+
} catch (err) {
|
|
1139
|
+
console.error("Failed to run applicant validations:", err);
|
|
1140
|
+
setError("Failed to run applicant validations");
|
|
1141
|
+
}
|
|
1142
|
+
}, [orderId, questionnaire, dynamicQuestionMap]);
|
|
1101
1143
|
useEffect(() => {
|
|
1102
1144
|
if (!orderId) return;
|
|
1103
1145
|
const initialize = async () => {
|
|
@@ -1149,7 +1191,8 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1149
1191
|
refreshApplicant,
|
|
1150
1192
|
getS3UrlForAsset,
|
|
1151
1193
|
acceptOrderQCTermsAndConditions,
|
|
1152
|
-
runAllValidations: runAllValidationsHandler
|
|
1194
|
+
runAllValidations: runAllValidationsHandler,
|
|
1195
|
+
runApplicantValidations: runApplicantValidationsHandler
|
|
1153
1196
|
};
|
|
1154
1197
|
return /* @__PURE__ */ jsx(EDCFlowContext.Provider, { value, children });
|
|
1155
1198
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smvtech/x-flux",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
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",
|