@smvtech/x-flux 1.0.0 → 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
@@ -298,6 +298,25 @@ declare const AnswerSchema: z.ZodObject<{
298
298
  status: z.ZodEnum<["ANSWERED", "APPROVED", "REJECTED", "NA", "UNSTARTED", "PENDING"]>;
299
299
  is_deleted: z.ZodBoolean;
300
300
  visa_order_id: z.ZodString;
301
+ validations: z.ZodArray<z.ZodObject<{
302
+ validation_name: z.ZodString;
303
+ error_text: z.ZodString;
304
+ result: z.ZodBoolean;
305
+ fix_type: z.ZodEnum<["auto", "manual", "none"]>;
306
+ time_saved: z.ZodNumber;
307
+ }, "strip", z.ZodTypeAny, {
308
+ validation_name: string;
309
+ error_text: string;
310
+ result: boolean;
311
+ fix_type: "auto" | "manual" | "none";
312
+ time_saved: number;
313
+ }, {
314
+ validation_name: string;
315
+ error_text: string;
316
+ result: boolean;
317
+ fix_type: "auto" | "manual" | "none";
318
+ time_saved: number;
319
+ }>, "many">;
301
320
  created_by: z.ZodString;
302
321
  created_at: z.ZodString;
303
322
  updated_at: z.ZodString;
@@ -319,6 +338,13 @@ declare const AnswerSchema: z.ZodObject<{
319
338
  }[];
320
339
  issue_reason: string | null;
321
340
  answer: string[];
341
+ validations: {
342
+ validation_name: string;
343
+ error_text: string;
344
+ result: boolean;
345
+ fix_type: "auto" | "manual" | "none";
346
+ time_saved: number;
347
+ }[];
322
348
  }, {
323
349
  status: "NA" | "ANSWERED" | "APPROVED" | "REJECTED" | "UNSTARTED" | "PENDING";
324
350
  _id: string;
@@ -337,6 +363,13 @@ declare const AnswerSchema: z.ZodObject<{
337
363
  }[];
338
364
  issue_reason: string | null;
339
365
  answer: string[];
366
+ validations: {
367
+ validation_name: string;
368
+ error_text: string;
369
+ result: boolean;
370
+ fix_type: "auto" | "manual" | "none";
371
+ time_saved: number;
372
+ }[];
340
373
  }>;
341
374
 
342
375
  declare enum INTERNAL_ORDER_TAGS {
@@ -5196,6 +5229,7 @@ type TEDCFlowContext = {
5196
5229
  deleteApplicant: (application_id: string) => Promise<void>;
5197
5230
  updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5198
5231
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5232
+ acceptOrderQCTermsAndConditions: () => Promise<void>;
5199
5233
  };
5200
5234
  type TEDCFlowProviderProps = {
5201
5235
  children: ReactNode;
@@ -5236,6 +5270,7 @@ declare const EDCFlow: {
5236
5270
  deleteApplicant: (application_id: string) => Promise<void>;
5237
5271
  updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5238
5272
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5273
+ acceptOrderQCTermsAndConditions: () => Promise<void>;
5239
5274
  };
5240
5275
  };
5241
5276
 
package/dist/index.d.ts CHANGED
@@ -298,6 +298,25 @@ declare const AnswerSchema: z.ZodObject<{
298
298
  status: z.ZodEnum<["ANSWERED", "APPROVED", "REJECTED", "NA", "UNSTARTED", "PENDING"]>;
299
299
  is_deleted: z.ZodBoolean;
300
300
  visa_order_id: z.ZodString;
301
+ validations: z.ZodArray<z.ZodObject<{
302
+ validation_name: z.ZodString;
303
+ error_text: z.ZodString;
304
+ result: z.ZodBoolean;
305
+ fix_type: z.ZodEnum<["auto", "manual", "none"]>;
306
+ time_saved: z.ZodNumber;
307
+ }, "strip", z.ZodTypeAny, {
308
+ validation_name: string;
309
+ error_text: string;
310
+ result: boolean;
311
+ fix_type: "auto" | "manual" | "none";
312
+ time_saved: number;
313
+ }, {
314
+ validation_name: string;
315
+ error_text: string;
316
+ result: boolean;
317
+ fix_type: "auto" | "manual" | "none";
318
+ time_saved: number;
319
+ }>, "many">;
301
320
  created_by: z.ZodString;
302
321
  created_at: z.ZodString;
303
322
  updated_at: z.ZodString;
@@ -319,6 +338,13 @@ declare const AnswerSchema: z.ZodObject<{
319
338
  }[];
320
339
  issue_reason: string | null;
321
340
  answer: string[];
341
+ validations: {
342
+ validation_name: string;
343
+ error_text: string;
344
+ result: boolean;
345
+ fix_type: "auto" | "manual" | "none";
346
+ time_saved: number;
347
+ }[];
322
348
  }, {
323
349
  status: "NA" | "ANSWERED" | "APPROVED" | "REJECTED" | "UNSTARTED" | "PENDING";
324
350
  _id: string;
@@ -337,6 +363,13 @@ declare const AnswerSchema: z.ZodObject<{
337
363
  }[];
338
364
  issue_reason: string | null;
339
365
  answer: string[];
366
+ validations: {
367
+ validation_name: string;
368
+ error_text: string;
369
+ result: boolean;
370
+ fix_type: "auto" | "manual" | "none";
371
+ time_saved: number;
372
+ }[];
340
373
  }>;
341
374
 
342
375
  declare enum INTERNAL_ORDER_TAGS {
@@ -5196,6 +5229,7 @@ type TEDCFlowContext = {
5196
5229
  deleteApplicant: (application_id: string) => Promise<void>;
5197
5230
  updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5198
5231
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5232
+ acceptOrderQCTermsAndConditions: () => Promise<void>;
5199
5233
  };
5200
5234
  type TEDCFlowProviderProps = {
5201
5235
  children: ReactNode;
@@ -5236,6 +5270,7 @@ declare const EDCFlow: {
5236
5270
  deleteApplicant: (application_id: string) => Promise<void>;
5237
5271
  updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5238
5272
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5273
+ acceptOrderQCTermsAndConditions: () => Promise<void>;
5239
5274
  };
5240
5275
  };
5241
5276
 
package/dist/index.js CHANGED
@@ -161,6 +161,13 @@ var AnswerSchema = z2__namespace.object({
161
161
  status: z2__namespace.enum(["ANSWERED", "APPROVED", "REJECTED", "NA", "UNSTARTED", "PENDING"]),
162
162
  is_deleted: z2__namespace.boolean(),
163
163
  visa_order_id: z2__namespace.string(),
164
+ validations: z2__namespace.array(z2__namespace.object({
165
+ validation_name: z2__namespace.string(),
166
+ error_text: z2__namespace.string(),
167
+ result: z2__namespace.boolean(),
168
+ fix_type: z2__namespace.enum(["auto", "manual", "none"]),
169
+ time_saved: z2__namespace.number()
170
+ })),
164
171
  created_by: z2__namespace.string(),
165
172
  created_at: z2__namespace.string(),
166
173
  updated_at: z2__namespace.string()
@@ -313,6 +320,7 @@ var formatAnswerFromResponse = (updatedAnswer, orderId) => {
313
320
  status: updatedAnswer.status,
314
321
  is_deleted: updatedAnswer.is_deleted,
315
322
  visa_order_id: updatedAnswer.visa_order_id || orderId,
323
+ validations: updatedAnswer.validations || [],
316
324
  created_by: updatedAnswer.created_by,
317
325
  created_at: updatedAnswer.created_at,
318
326
  updated_at: updatedAnswer.updated_at
@@ -572,6 +580,11 @@ var getFileURLfromFilename = async (filename, signal) => {
572
580
  });
573
581
  return { data: signedURLs };
574
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
+ };
575
588
  var EDCFlowContext = react.createContext(void 0);
576
589
  var EDCFlowProvider = ({ children, orderId }) => {
577
590
  const [order, setOrder] = react.useState(null);
@@ -799,6 +812,16 @@ var EDCFlowProvider = ({ children, orderId }) => {
799
812
  s3UrlFetchFlightRequests.current.set(doc_id, request);
800
813
  return request;
801
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]);
802
825
  react.useEffect(() => {
803
826
  if (!orderId) return;
804
827
  const initialize = async () => {
@@ -843,13 +866,14 @@ var EDCFlowProvider = ({ children, orderId }) => {
843
866
  setActiveApplicant,
844
867
  loading,
845
868
  error,
869
+ success,
846
870
  addApplicant: addApplicant2,
847
871
  updateAnswer: updateAnswer2,
848
872
  deleteApplicant: deleteApplicantById,
849
873
  refreshOrder,
850
874
  refreshApplicant,
851
875
  getS3UrlForAsset,
852
- success
876
+ acceptOrderQCTermsAndConditions
853
877
  };
854
878
  return /* @__PURE__ */ jsxRuntime.jsx(EDCFlowContext.Provider, { value, children });
855
879
  };
package/dist/index.mjs CHANGED
@@ -135,6 +135,13 @@ var AnswerSchema = z2.object({
135
135
  status: z2.enum(["ANSWERED", "APPROVED", "REJECTED", "NA", "UNSTARTED", "PENDING"]),
136
136
  is_deleted: z2.boolean(),
137
137
  visa_order_id: z2.string(),
138
+ validations: z2.array(z2.object({
139
+ validation_name: z2.string(),
140
+ error_text: z2.string(),
141
+ result: z2.boolean(),
142
+ fix_type: z2.enum(["auto", "manual", "none"]),
143
+ time_saved: z2.number()
144
+ })),
138
145
  created_by: z2.string(),
139
146
  created_at: z2.string(),
140
147
  updated_at: z2.string()
@@ -287,6 +294,7 @@ var formatAnswerFromResponse = (updatedAnswer, orderId) => {
287
294
  status: updatedAnswer.status,
288
295
  is_deleted: updatedAnswer.is_deleted,
289
296
  visa_order_id: updatedAnswer.visa_order_id || orderId,
297
+ validations: updatedAnswer.validations || [],
290
298
  created_by: updatedAnswer.created_by,
291
299
  created_at: updatedAnswer.created_at,
292
300
  updated_at: updatedAnswer.updated_at
@@ -546,6 +554,11 @@ var getFileURLfromFilename = async (filename, signal) => {
546
554
  });
547
555
  return { data: signedURLs };
548
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
+ };
549
562
  var EDCFlowContext = createContext(void 0);
550
563
  var EDCFlowProvider = ({ children, orderId }) => {
551
564
  const [order, setOrder] = useState(null);
@@ -773,6 +786,16 @@ var EDCFlowProvider = ({ children, orderId }) => {
773
786
  s3UrlFetchFlightRequests.current.set(doc_id, request);
774
787
  return request;
775
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]);
776
799
  useEffect(() => {
777
800
  if (!orderId) return;
778
801
  const initialize = async () => {
@@ -817,13 +840,14 @@ var EDCFlowProvider = ({ children, orderId }) => {
817
840
  setActiveApplicant,
818
841
  loading,
819
842
  error,
843
+ success,
820
844
  addApplicant: addApplicant2,
821
845
  updateAnswer: updateAnswer2,
822
846
  deleteApplicant: deleteApplicantById,
823
847
  refreshOrder,
824
848
  refreshApplicant,
825
849
  getS3UrlForAsset,
826
- success
850
+ acceptOrderQCTermsAndConditions
827
851
  };
828
852
  return /* @__PURE__ */ jsx(EDCFlowContext.Provider, { value, children });
829
853
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smvtech/x-flux",
3
- "version": "1.0.0",
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",