@smvtech/x-flux 1.0.7 → 1.0.9
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 +38 -1
- package/dist/index.mjs +38 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5271,6 +5271,7 @@ type TEDCFlowContext = {
|
|
|
5271
5271
|
updateAnswer: (application_id: string, question_type: QUESTION_TYPE, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
|
|
5272
5272
|
getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
|
|
5273
5273
|
acceptOrderQCTermsAndConditions: () => Promise<void>;
|
|
5274
|
+
runAllValidations: () => Promise<void>;
|
|
5274
5275
|
};
|
|
5275
5276
|
type TEDCFlowProviderProps = {
|
|
5276
5277
|
children: ReactNode;
|
|
@@ -5312,6 +5313,7 @@ declare const EDCFlow: {
|
|
|
5312
5313
|
updateAnswer: (application_id: string, question_type: QUESTION_TYPE, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
|
|
5313
5314
|
getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
|
|
5314
5315
|
acceptOrderQCTermsAndConditions: () => Promise<void>;
|
|
5316
|
+
runAllValidations: () => Promise<void>;
|
|
5315
5317
|
};
|
|
5316
5318
|
};
|
|
5317
5319
|
|
package/dist/index.d.ts
CHANGED
|
@@ -5271,6 +5271,7 @@ type TEDCFlowContext = {
|
|
|
5271
5271
|
updateAnswer: (application_id: string, question_type: QUESTION_TYPE, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
|
|
5272
5272
|
getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
|
|
5273
5273
|
acceptOrderQCTermsAndConditions: () => Promise<void>;
|
|
5274
|
+
runAllValidations: () => Promise<void>;
|
|
5274
5275
|
};
|
|
5275
5276
|
type TEDCFlowProviderProps = {
|
|
5276
5277
|
children: ReactNode;
|
|
@@ -5312,6 +5313,7 @@ declare const EDCFlow: {
|
|
|
5312
5313
|
updateAnswer: (application_id: string, question_type: QUESTION_TYPE, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
|
|
5313
5314
|
getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
|
|
5314
5315
|
acceptOrderQCTermsAndConditions: () => Promise<void>;
|
|
5316
|
+
runAllValidations: () => Promise<void>;
|
|
5315
5317
|
};
|
|
5316
5318
|
};
|
|
5317
5319
|
|
package/dist/index.js
CHANGED
|
@@ -611,6 +611,11 @@ var getFileURLfromFilename = async (filename, signal) => {
|
|
|
611
611
|
});
|
|
612
612
|
return { data: signedURLs };
|
|
613
613
|
};
|
|
614
|
+
var runAllValidations = async (orderId) => {
|
|
615
|
+
const client = getClient();
|
|
616
|
+
const response = await client.post(`/edc/run-all-validations`, { order_id: orderId });
|
|
617
|
+
return { data: response.data.data };
|
|
618
|
+
};
|
|
614
619
|
var updateOrderQCTermsAndConditions = async (orderId) => {
|
|
615
620
|
const client = getClient();
|
|
616
621
|
const response = await client.patch(`/visa_orders/update-order-qc-terms-conditions/${orderId}`);
|
|
@@ -849,6 +854,37 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
849
854
|
setError("Failed to accept order QCTerms and Conditions");
|
|
850
855
|
}
|
|
851
856
|
}, [order]);
|
|
857
|
+
const runAllValidationsHandler = react.useCallback(async () => {
|
|
858
|
+
if (!orderId || !questionnaire) return;
|
|
859
|
+
try {
|
|
860
|
+
setError(null);
|
|
861
|
+
const { data } = await runAllValidations(orderId);
|
|
862
|
+
if (data.order) {
|
|
863
|
+
setOrder(data.order);
|
|
864
|
+
}
|
|
865
|
+
if (data.applications && data.applications.length > 0) {
|
|
866
|
+
const applicants2 = createApplicantsFromApplications(
|
|
867
|
+
data.applications,
|
|
868
|
+
questionnaire
|
|
869
|
+
);
|
|
870
|
+
const { updatedQuestionnaire, updatedApplicants } = runApplicantSideEffects(applicants2, questionnaire, dynamicQuestionMap);
|
|
871
|
+
setQuestionnaire(updatedQuestionnaire);
|
|
872
|
+
setApplicants(updatedApplicants);
|
|
873
|
+
const applicantIds = Object.keys(updatedApplicants);
|
|
874
|
+
if (applicantIds.length > 0) {
|
|
875
|
+
if (activeApplicant && applicantIds.includes(activeApplicant)) {
|
|
876
|
+
setActiveApplicant(activeApplicant);
|
|
877
|
+
} else {
|
|
878
|
+
setActiveApplicant(applicantIds[0]);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
setSuccess("Validations completed successfully");
|
|
883
|
+
} catch (err) {
|
|
884
|
+
console.error("Failed to run all validations:", err);
|
|
885
|
+
setError("Failed to run all validations");
|
|
886
|
+
}
|
|
887
|
+
}, [orderId, questionnaire, dynamicQuestionMap, activeApplicant]);
|
|
852
888
|
react.useEffect(() => {
|
|
853
889
|
if (!orderId) return;
|
|
854
890
|
const initialize = async () => {
|
|
@@ -899,7 +935,8 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
899
935
|
refreshOrder,
|
|
900
936
|
refreshApplicant,
|
|
901
937
|
getS3UrlForAsset,
|
|
902
|
-
acceptOrderQCTermsAndConditions
|
|
938
|
+
acceptOrderQCTermsAndConditions,
|
|
939
|
+
runAllValidations: runAllValidationsHandler
|
|
903
940
|
};
|
|
904
941
|
return /* @__PURE__ */ jsxRuntime.jsx(EDCFlowContext.Provider, { value, children });
|
|
905
942
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -585,6 +585,11 @@ var getFileURLfromFilename = async (filename, signal) => {
|
|
|
585
585
|
});
|
|
586
586
|
return { data: signedURLs };
|
|
587
587
|
};
|
|
588
|
+
var runAllValidations = async (orderId) => {
|
|
589
|
+
const client = getClient();
|
|
590
|
+
const response = await client.post(`/edc/run-all-validations`, { order_id: orderId });
|
|
591
|
+
return { data: response.data.data };
|
|
592
|
+
};
|
|
588
593
|
var updateOrderQCTermsAndConditions = async (orderId) => {
|
|
589
594
|
const client = getClient();
|
|
590
595
|
const response = await client.patch(`/visa_orders/update-order-qc-terms-conditions/${orderId}`);
|
|
@@ -823,6 +828,37 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
823
828
|
setError("Failed to accept order QCTerms and Conditions");
|
|
824
829
|
}
|
|
825
830
|
}, [order]);
|
|
831
|
+
const runAllValidationsHandler = useCallback(async () => {
|
|
832
|
+
if (!orderId || !questionnaire) return;
|
|
833
|
+
try {
|
|
834
|
+
setError(null);
|
|
835
|
+
const { data } = await runAllValidations(orderId);
|
|
836
|
+
if (data.order) {
|
|
837
|
+
setOrder(data.order);
|
|
838
|
+
}
|
|
839
|
+
if (data.applications && data.applications.length > 0) {
|
|
840
|
+
const applicants2 = createApplicantsFromApplications(
|
|
841
|
+
data.applications,
|
|
842
|
+
questionnaire
|
|
843
|
+
);
|
|
844
|
+
const { updatedQuestionnaire, updatedApplicants } = runApplicantSideEffects(applicants2, questionnaire, dynamicQuestionMap);
|
|
845
|
+
setQuestionnaire(updatedQuestionnaire);
|
|
846
|
+
setApplicants(updatedApplicants);
|
|
847
|
+
const applicantIds = Object.keys(updatedApplicants);
|
|
848
|
+
if (applicantIds.length > 0) {
|
|
849
|
+
if (activeApplicant && applicantIds.includes(activeApplicant)) {
|
|
850
|
+
setActiveApplicant(activeApplicant);
|
|
851
|
+
} else {
|
|
852
|
+
setActiveApplicant(applicantIds[0]);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
setSuccess("Validations completed successfully");
|
|
857
|
+
} catch (err) {
|
|
858
|
+
console.error("Failed to run all validations:", err);
|
|
859
|
+
setError("Failed to run all validations");
|
|
860
|
+
}
|
|
861
|
+
}, [orderId, questionnaire, dynamicQuestionMap, activeApplicant]);
|
|
826
862
|
useEffect(() => {
|
|
827
863
|
if (!orderId) return;
|
|
828
864
|
const initialize = async () => {
|
|
@@ -873,7 +909,8 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
873
909
|
refreshOrder,
|
|
874
910
|
refreshApplicant,
|
|
875
911
|
getS3UrlForAsset,
|
|
876
|
-
acceptOrderQCTermsAndConditions
|
|
912
|
+
acceptOrderQCTermsAndConditions,
|
|
913
|
+
runAllValidations: runAllValidationsHandler
|
|
877
914
|
};
|
|
878
915
|
return /* @__PURE__ */ jsx(EDCFlowContext.Provider, { value, children });
|
|
879
916
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smvtech/x-flux",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
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",
|