@smvtech/x-flux 1.0.1 → 1.0.2

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 CHANGED
@@ -303,16 +303,19 @@ declare const AnswerSchema: z.ZodObject<{
303
303
  error_text: z.ZodString;
304
304
  result: z.ZodBoolean;
305
305
  fix_type: z.ZodEnum<["auto", "manual", "none"]>;
306
+ time_saved: z.ZodNumber;
306
307
  }, "strip", z.ZodTypeAny, {
307
308
  validation_name: string;
308
309
  error_text: string;
309
310
  result: boolean;
310
311
  fix_type: "auto" | "manual" | "none";
312
+ time_saved: number;
311
313
  }, {
312
314
  validation_name: string;
313
315
  error_text: string;
314
316
  result: boolean;
315
317
  fix_type: "auto" | "manual" | "none";
318
+ time_saved: number;
316
319
  }>, "many">;
317
320
  created_by: z.ZodString;
318
321
  created_at: z.ZodString;
@@ -340,6 +343,7 @@ declare const AnswerSchema: z.ZodObject<{
340
343
  error_text: string;
341
344
  result: boolean;
342
345
  fix_type: "auto" | "manual" | "none";
346
+ time_saved: number;
343
347
  }[];
344
348
  }, {
345
349
  status: "NA" | "ANSWERED" | "APPROVED" | "REJECTED" | "UNSTARTED" | "PENDING";
@@ -364,6 +368,7 @@ declare const AnswerSchema: z.ZodObject<{
364
368
  error_text: string;
365
369
  result: boolean;
366
370
  fix_type: "auto" | "manual" | "none";
371
+ time_saved: number;
367
372
  }[];
368
373
  }>;
369
374
 
@@ -5224,6 +5229,7 @@ type TEDCFlowContext = {
5224
5229
  deleteApplicant: (application_id: string) => Promise<void>;
5225
5230
  updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5226
5231
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5232
+ acceptOrderQCTermsAndConditions: () => Promise<void>;
5227
5233
  };
5228
5234
  type TEDCFlowProviderProps = {
5229
5235
  children: ReactNode;
@@ -5264,6 +5270,7 @@ declare const EDCFlow: {
5264
5270
  deleteApplicant: (application_id: string) => Promise<void>;
5265
5271
  updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5266
5272
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5273
+ acceptOrderQCTermsAndConditions: () => Promise<void>;
5267
5274
  };
5268
5275
  };
5269
5276
 
package/dist/index.d.ts CHANGED
@@ -303,16 +303,19 @@ declare const AnswerSchema: z.ZodObject<{
303
303
  error_text: z.ZodString;
304
304
  result: z.ZodBoolean;
305
305
  fix_type: z.ZodEnum<["auto", "manual", "none"]>;
306
+ time_saved: z.ZodNumber;
306
307
  }, "strip", z.ZodTypeAny, {
307
308
  validation_name: string;
308
309
  error_text: string;
309
310
  result: boolean;
310
311
  fix_type: "auto" | "manual" | "none";
312
+ time_saved: number;
311
313
  }, {
312
314
  validation_name: string;
313
315
  error_text: string;
314
316
  result: boolean;
315
317
  fix_type: "auto" | "manual" | "none";
318
+ time_saved: number;
316
319
  }>, "many">;
317
320
  created_by: z.ZodString;
318
321
  created_at: z.ZodString;
@@ -340,6 +343,7 @@ declare const AnswerSchema: z.ZodObject<{
340
343
  error_text: string;
341
344
  result: boolean;
342
345
  fix_type: "auto" | "manual" | "none";
346
+ time_saved: number;
343
347
  }[];
344
348
  }, {
345
349
  status: "NA" | "ANSWERED" | "APPROVED" | "REJECTED" | "UNSTARTED" | "PENDING";
@@ -364,6 +368,7 @@ declare const AnswerSchema: z.ZodObject<{
364
368
  error_text: string;
365
369
  result: boolean;
366
370
  fix_type: "auto" | "manual" | "none";
371
+ time_saved: number;
367
372
  }[];
368
373
  }>;
369
374
 
@@ -5224,6 +5229,7 @@ type TEDCFlowContext = {
5224
5229
  deleteApplicant: (application_id: string) => Promise<void>;
5225
5230
  updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5226
5231
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5232
+ acceptOrderQCTermsAndConditions: () => Promise<void>;
5227
5233
  };
5228
5234
  type TEDCFlowProviderProps = {
5229
5235
  children: ReactNode;
@@ -5264,6 +5270,7 @@ declare const EDCFlow: {
5264
5270
  deleteApplicant: (application_id: string) => Promise<void>;
5265
5271
  updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5266
5272
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5273
+ acceptOrderQCTermsAndConditions: () => Promise<void>;
5267
5274
  };
5268
5275
  };
5269
5276
 
package/dist/index.js CHANGED
@@ -165,7 +165,8 @@ var AnswerSchema = z2__namespace.object({
165
165
  validation_name: z2__namespace.string(),
166
166
  error_text: z2__namespace.string(),
167
167
  result: z2__namespace.boolean(),
168
- fix_type: z2__namespace.enum(["auto", "manual", "none"])
168
+ fix_type: z2__namespace.enum(["auto", "manual", "none"]),
169
+ time_saved: z2__namespace.number()
169
170
  })),
170
171
  created_by: z2__namespace.string(),
171
172
  created_at: z2__namespace.string(),
@@ -579,6 +580,11 @@ var getFileURLfromFilename = async (filename, signal) => {
579
580
  });
580
581
  return { data: signedURLs };
581
582
  };
583
+ var updateOrderQCTermsAndConditions = async (orderId) => {
584
+ const client = getClient();
585
+ const response = await client.patch(`/visa_orders/update-order-qc-terms-conditions/${orderId}`);
586
+ return { data: response.data.data };
587
+ };
582
588
  var EDCFlowContext = react.createContext(void 0);
583
589
  var EDCFlowProvider = ({ children, orderId }) => {
584
590
  const [order, setOrder] = react.useState(null);
@@ -806,6 +812,16 @@ var EDCFlowProvider = ({ children, orderId }) => {
806
812
  s3UrlFetchFlightRequests.current.set(doc_id, request);
807
813
  return request;
808
814
  }, [docIdToS3Url]);
815
+ const acceptOrderQCTermsAndConditions = react.useCallback(async () => {
816
+ if (!order) return;
817
+ try {
818
+ const { data: updatedOrder } = await updateOrderQCTermsAndConditions(order._id);
819
+ setOrder(updatedOrder);
820
+ } catch (err) {
821
+ console.error("Failed to accept order QCTerms and Conditions:", err);
822
+ setError("Failed to accept order QCTerms and Conditions");
823
+ }
824
+ }, [order]);
809
825
  react.useEffect(() => {
810
826
  if (!orderId) return;
811
827
  const initialize = async () => {
@@ -850,13 +866,14 @@ var EDCFlowProvider = ({ children, orderId }) => {
850
866
  setActiveApplicant,
851
867
  loading,
852
868
  error,
869
+ success,
853
870
  addApplicant: addApplicant2,
854
871
  updateAnswer: updateAnswer2,
855
872
  deleteApplicant: deleteApplicantById,
856
873
  refreshOrder,
857
874
  refreshApplicant,
858
875
  getS3UrlForAsset,
859
- success
876
+ acceptOrderQCTermsAndConditions
860
877
  };
861
878
  return /* @__PURE__ */ jsxRuntime.jsx(EDCFlowContext.Provider, { value, children });
862
879
  };
package/dist/index.mjs CHANGED
@@ -139,7 +139,8 @@ var AnswerSchema = z2.object({
139
139
  validation_name: z2.string(),
140
140
  error_text: z2.string(),
141
141
  result: z2.boolean(),
142
- fix_type: z2.enum(["auto", "manual", "none"])
142
+ fix_type: z2.enum(["auto", "manual", "none"]),
143
+ time_saved: z2.number()
143
144
  })),
144
145
  created_by: z2.string(),
145
146
  created_at: z2.string(),
@@ -553,6 +554,11 @@ var getFileURLfromFilename = async (filename, signal) => {
553
554
  });
554
555
  return { data: signedURLs };
555
556
  };
557
+ var updateOrderQCTermsAndConditions = async (orderId) => {
558
+ const client = getClient();
559
+ const response = await client.patch(`/visa_orders/update-order-qc-terms-conditions/${orderId}`);
560
+ return { data: response.data.data };
561
+ };
556
562
  var EDCFlowContext = createContext(void 0);
557
563
  var EDCFlowProvider = ({ children, orderId }) => {
558
564
  const [order, setOrder] = useState(null);
@@ -780,6 +786,16 @@ var EDCFlowProvider = ({ children, orderId }) => {
780
786
  s3UrlFetchFlightRequests.current.set(doc_id, request);
781
787
  return request;
782
788
  }, [docIdToS3Url]);
789
+ const acceptOrderQCTermsAndConditions = useCallback(async () => {
790
+ if (!order) return;
791
+ try {
792
+ const { data: updatedOrder } = await updateOrderQCTermsAndConditions(order._id);
793
+ setOrder(updatedOrder);
794
+ } catch (err) {
795
+ console.error("Failed to accept order QCTerms and Conditions:", err);
796
+ setError("Failed to accept order QCTerms and Conditions");
797
+ }
798
+ }, [order]);
783
799
  useEffect(() => {
784
800
  if (!orderId) return;
785
801
  const initialize = async () => {
@@ -824,13 +840,14 @@ var EDCFlowProvider = ({ children, orderId }) => {
824
840
  setActiveApplicant,
825
841
  loading,
826
842
  error,
843
+ success,
827
844
  addApplicant: addApplicant2,
828
845
  updateAnswer: updateAnswer2,
829
846
  deleteApplicant: deleteApplicantById,
830
847
  refreshOrder,
831
848
  refreshApplicant,
832
849
  getS3UrlForAsset,
833
- success
850
+ acceptOrderQCTermsAndConditions
834
851
  };
835
852
  return /* @__PURE__ */ jsx(EDCFlowContext.Provider, { value, children });
836
853
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smvtech/x-flux",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
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",