@smvtech/x-flux 1.1.15 → 1.1.18
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 +47 -10
- package/dist/index.d.ts +47 -10
- package/dist/index.js +171 -105
- package/dist/index.mjs +168 -106
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -80,6 +80,20 @@ declare enum FIX_TYPE {
|
|
|
80
80
|
MANUAL = "manual",
|
|
81
81
|
NONE = "none"
|
|
82
82
|
}
|
|
83
|
+
declare enum ANSWER_STATUS {
|
|
84
|
+
ANSWERED = "ANSWERED",
|
|
85
|
+
APPROVED = "APPROVED",
|
|
86
|
+
REJECTED = "REJECTED",
|
|
87
|
+
NA = "NA",
|
|
88
|
+
UNSTARTED = "UNSTARTED",
|
|
89
|
+
PENDING = "PENDING"
|
|
90
|
+
}
|
|
91
|
+
declare enum ASSET_STATUS {
|
|
92
|
+
ANSWERED = "ANSWERED",
|
|
93
|
+
APPROVED = "APPROVED",
|
|
94
|
+
REJECTED = "REJECTED",
|
|
95
|
+
DELETED = "DELETED"
|
|
96
|
+
}
|
|
83
97
|
declare const QuestionnaireSchema: z.ZodObject<{
|
|
84
98
|
questionsWithRank: z.ZodArray<z.ZodObject<{
|
|
85
99
|
id: z.ZodString;
|
|
@@ -368,19 +382,19 @@ declare const AnswerSchema: z.ZodObject<{
|
|
|
368
382
|
assets_id: z.ZodArray<z.ZodObject<{
|
|
369
383
|
doc_id: z.ZodString;
|
|
370
384
|
issue_reason: z.ZodNullable<z.ZodString>;
|
|
371
|
-
status: z.
|
|
385
|
+
status: z.ZodNativeEnum<typeof ASSET_STATUS>;
|
|
372
386
|
}, "strip", z.ZodTypeAny, {
|
|
373
|
-
status:
|
|
387
|
+
status: ASSET_STATUS;
|
|
374
388
|
doc_id: string;
|
|
375
389
|
issue_reason: string | null;
|
|
376
390
|
}, {
|
|
377
|
-
status:
|
|
391
|
+
status: ASSET_STATUS;
|
|
378
392
|
doc_id: string;
|
|
379
393
|
issue_reason: string | null;
|
|
380
394
|
}>, "many">;
|
|
381
395
|
answer: z.ZodArray<z.ZodString, "many">;
|
|
382
396
|
issue_reason: z.ZodNullable<z.ZodString>;
|
|
383
|
-
status: z.
|
|
397
|
+
status: z.ZodNativeEnum<typeof ANSWER_STATUS>;
|
|
384
398
|
is_deleted: z.ZodBoolean;
|
|
385
399
|
visa_order_id: z.ZodString;
|
|
386
400
|
validations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -406,7 +420,7 @@ declare const AnswerSchema: z.ZodObject<{
|
|
|
406
420
|
created_at: z.ZodString;
|
|
407
421
|
updated_at: z.ZodString;
|
|
408
422
|
}, "strip", z.ZodTypeAny, {
|
|
409
|
-
status:
|
|
423
|
+
status: ANSWER_STATUS;
|
|
410
424
|
_id: string;
|
|
411
425
|
visa_order_id: string;
|
|
412
426
|
created_at: string;
|
|
@@ -417,7 +431,7 @@ declare const AnswerSchema: z.ZodObject<{
|
|
|
417
431
|
visa_questions_id: string;
|
|
418
432
|
traveller_id: string;
|
|
419
433
|
assets_id: {
|
|
420
|
-
status:
|
|
434
|
+
status: ASSET_STATUS;
|
|
421
435
|
doc_id: string;
|
|
422
436
|
issue_reason: string | null;
|
|
423
437
|
}[];
|
|
@@ -431,7 +445,7 @@ declare const AnswerSchema: z.ZodObject<{
|
|
|
431
445
|
time_saved: number;
|
|
432
446
|
}[] | undefined;
|
|
433
447
|
}, {
|
|
434
|
-
status:
|
|
448
|
+
status: ANSWER_STATUS;
|
|
435
449
|
_id: string;
|
|
436
450
|
visa_order_id: string;
|
|
437
451
|
created_at: string;
|
|
@@ -442,7 +456,7 @@ declare const AnswerSchema: z.ZodObject<{
|
|
|
442
456
|
visa_questions_id: string;
|
|
443
457
|
traveller_id: string;
|
|
444
458
|
assets_id: {
|
|
445
|
-
status:
|
|
459
|
+
status: ASSET_STATUS;
|
|
446
460
|
doc_id: string;
|
|
447
461
|
issue_reason: string | null;
|
|
448
462
|
}[];
|
|
@@ -5435,6 +5449,8 @@ type TUpdateAnswerPayload = {
|
|
|
5435
5449
|
answer: string;
|
|
5436
5450
|
traveller_id: string;
|
|
5437
5451
|
file?: File | Blob | string | null;
|
|
5452
|
+
autoApproveAnswers?: boolean;
|
|
5453
|
+
forceRunValidations?: boolean;
|
|
5438
5454
|
};
|
|
5439
5455
|
type TUploadProgressEvent = {
|
|
5440
5456
|
percent: number;
|
|
@@ -5459,7 +5475,23 @@ type ValidationResult = {
|
|
|
5459
5475
|
perfect: ValidationResultGroup;
|
|
5460
5476
|
totalTimeSaved: number;
|
|
5461
5477
|
} | null;
|
|
5478
|
+
type TQuestionRenderInfo = {
|
|
5479
|
+
status: ANSWER_STATUS;
|
|
5480
|
+
rejectionReasons: string[];
|
|
5481
|
+
rejectedAssets: {
|
|
5482
|
+
doc_id: string;
|
|
5483
|
+
reason: string;
|
|
5484
|
+
}[];
|
|
5485
|
+
validationResult: ValidationResult;
|
|
5486
|
+
};
|
|
5487
|
+
type TQuestionValidationEntry = TQuestionRenderInfo & {
|
|
5488
|
+
name: string;
|
|
5489
|
+
};
|
|
5462
5490
|
|
|
5491
|
+
declare enum EDCFormMode {
|
|
5492
|
+
CREATE = "CREATE",
|
|
5493
|
+
FIX = "FIX"
|
|
5494
|
+
}
|
|
5463
5495
|
type TEDCFlowContext = {
|
|
5464
5496
|
orderId: string | null;
|
|
5465
5497
|
order: TVisaOrder | null;
|
|
@@ -5470,6 +5502,7 @@ type TEDCFlowContext = {
|
|
|
5470
5502
|
loading: boolean;
|
|
5471
5503
|
error: string | null;
|
|
5472
5504
|
success: string | null;
|
|
5505
|
+
mode: EDCFormMode;
|
|
5473
5506
|
refreshOrder: () => Promise<void>;
|
|
5474
5507
|
refreshApplicant: (application_id: string) => Promise<void>;
|
|
5475
5508
|
addApplicant: (payload: TAddTravellerPayload) => Promise<TEDCApplicant | null>;
|
|
@@ -5484,6 +5517,7 @@ type TEDCFlowContext = {
|
|
|
5484
5517
|
type TEDCFlowProviderProps = {
|
|
5485
5518
|
children: ReactNode;
|
|
5486
5519
|
orderId: string;
|
|
5520
|
+
mode?: EDCFormMode;
|
|
5487
5521
|
};
|
|
5488
5522
|
declare const EDCFlowProvider: react__default.FC<TEDCFlowProviderProps>;
|
|
5489
5523
|
declare const useEDCFlow: () => TEDCFlowContext;
|
|
@@ -5499,7 +5533,7 @@ declare function getSignedUrlFromAsset(docId: string): Promise<string | null>;
|
|
|
5499
5533
|
declare function getDisplayableQuestions(questions: TEDCApplicant["questions"], questionAnswerSources: ANSWER_SOURCE[]): TEDCApplicant["questions"];
|
|
5500
5534
|
declare function getDisplayableDocuments(questions: TEDCApplicant["questions"], documentAnswerSources: ANSWER_SOURCE[]): TEDCApplicant["questions"];
|
|
5501
5535
|
declare function getValidationErrors(validations?: TAnswer["validations"] | null): ValidationResult;
|
|
5502
|
-
declare function getValidationResult(question: TEDCApplicant["questions"][0]):
|
|
5536
|
+
declare function getValidationResult(question: TEDCApplicant["questions"][0]): TQuestionRenderInfo;
|
|
5503
5537
|
declare function validateApplicantQuestions(applicant: TEDCApplicant, questionAnswerSources: ANSWER_SOURCE[]): Array<{
|
|
5504
5538
|
name: string;
|
|
5505
5539
|
validationResult: ValidationResult;
|
|
@@ -5554,6 +5588,7 @@ declare function validateOrder(order: TVisaOrder | null | undefined, applicants:
|
|
|
5554
5588
|
}>;
|
|
5555
5589
|
};
|
|
5556
5590
|
declare function getFixTypeFromFixableItems(fixableItems: ValidationItem[]): FIX_TYPE;
|
|
5591
|
+
declare function getQuestionRenderInfo(question: TQuestionWithAnswer): TQuestionRenderInfo;
|
|
5557
5592
|
|
|
5558
5593
|
declare const initializeEDCFlow: (config: EDCConfig) => void;
|
|
5559
5594
|
declare const EDCFlow: {
|
|
@@ -5561,6 +5596,7 @@ declare const EDCFlow: {
|
|
|
5561
5596
|
Provider: react.FC<{
|
|
5562
5597
|
children: react.ReactNode;
|
|
5563
5598
|
orderId: string;
|
|
5599
|
+
mode?: EDCFormMode;
|
|
5564
5600
|
}>;
|
|
5565
5601
|
useEDCFlow: () => {
|
|
5566
5602
|
orderId: string | null;
|
|
@@ -5572,6 +5608,7 @@ declare const EDCFlow: {
|
|
|
5572
5608
|
loading: boolean;
|
|
5573
5609
|
error: string | null;
|
|
5574
5610
|
success: string | null;
|
|
5611
|
+
mode: EDCFormMode;
|
|
5575
5612
|
refreshOrder: () => Promise<void>;
|
|
5576
5613
|
refreshApplicant: (application_id: string) => Promise<void>;
|
|
5577
5614
|
addApplicant: (payload: TAddTravellerPayload) => Promise<TEDCApplicant | null>;
|
|
@@ -5585,4 +5622,4 @@ declare const EDCFlow: {
|
|
|
5585
5622
|
};
|
|
5586
5623
|
};
|
|
5587
5624
|
|
|
5588
|
-
export { ANSWER_SOURCE, APPLICATION_STATUS, APPLICATION_TAGS, AnswerSchema, type ApiResponse, ApplicationSchema, DOC_TYPES, type EDCConfig, EDCFlowProvider, FIX_TYPE, INTERNAL_ORDER_TAGS, PROCESSING_BLOCKED_ON_PAYMENT_STATUS, QUESTION_TYPE, QuestionnaireSchema, TA_QC_EXTRACTION_STATUS, type TAddTravellerPayload, type TAnswer, type TEDCApplicant, TIMELINE_STEP, type TQuestionWithAnswer, type TQuestionnaire, type TRenderRule, type TTraveller, type TUpdateAnswerPayload, type TUpdateTravellerPayload, type TUploadProgressEvent, type TVisaOrder, TimelinePaymentStatus, TravellerSchema, type UploadProgressEvent, VALIDATION_STATUS, VISA_TYPE_INTERNAL_TAGS, type ValidationItem, type ValidationResult, type ValidationResultGroup, createAllQuestionsWithAnswers, createApplicantData, EDCFlow as default, filterConditionalQuestions, formatAnswerFromResponse, formatTravellerFromResponse, getDisplayableDocuments, getDisplayableQuestions, getFixTypeFromFixableItems, getSignedUrlFromAsset, getValidationErrors, getValidationResult, getVisibleQuestions, initializeEDCFlow, updateApplicantWithAnswer, useEDCFlow, validateAllApplicants, validateApplicant, validateApplicantDocuments, validateApplicantQuestions, validateOrder };
|
|
5625
|
+
export { ANSWER_SOURCE, ANSWER_STATUS, APPLICATION_STATUS, APPLICATION_TAGS, ASSET_STATUS, AnswerSchema, type ApiResponse, ApplicationSchema, DOC_TYPES, type EDCConfig, EDCFlowProvider, EDCFormMode, FIX_TYPE, INTERNAL_ORDER_TAGS, PROCESSING_BLOCKED_ON_PAYMENT_STATUS, QUESTION_TYPE, QuestionnaireSchema, TA_QC_EXTRACTION_STATUS, type TAddTravellerPayload, type TAnswer, type TEDCApplicant, TIMELINE_STEP, type TQuestionRenderInfo, type TQuestionValidationEntry, type TQuestionWithAnswer, type TQuestionnaire, type TRenderRule, type TTraveller, type TUpdateAnswerPayload, type TUpdateTravellerPayload, type TUploadProgressEvent, type TVisaOrder, TimelinePaymentStatus, TravellerSchema, type UploadProgressEvent, VALIDATION_STATUS, VISA_TYPE_INTERNAL_TAGS, type ValidationItem, type ValidationResult, type ValidationResultGroup, createAllQuestionsWithAnswers, createApplicantData, EDCFlow as default, filterConditionalQuestions, formatAnswerFromResponse, formatTravellerFromResponse, getDisplayableDocuments, getDisplayableQuestions, getFixTypeFromFixableItems, getQuestionRenderInfo, getSignedUrlFromAsset, getValidationErrors, getValidationResult, getVisibleQuestions, initializeEDCFlow, updateApplicantWithAnswer, useEDCFlow, validateAllApplicants, validateApplicant, validateApplicantDocuments, validateApplicantQuestions, validateOrder };
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,20 @@ declare enum FIX_TYPE {
|
|
|
80
80
|
MANUAL = "manual",
|
|
81
81
|
NONE = "none"
|
|
82
82
|
}
|
|
83
|
+
declare enum ANSWER_STATUS {
|
|
84
|
+
ANSWERED = "ANSWERED",
|
|
85
|
+
APPROVED = "APPROVED",
|
|
86
|
+
REJECTED = "REJECTED",
|
|
87
|
+
NA = "NA",
|
|
88
|
+
UNSTARTED = "UNSTARTED",
|
|
89
|
+
PENDING = "PENDING"
|
|
90
|
+
}
|
|
91
|
+
declare enum ASSET_STATUS {
|
|
92
|
+
ANSWERED = "ANSWERED",
|
|
93
|
+
APPROVED = "APPROVED",
|
|
94
|
+
REJECTED = "REJECTED",
|
|
95
|
+
DELETED = "DELETED"
|
|
96
|
+
}
|
|
83
97
|
declare const QuestionnaireSchema: z.ZodObject<{
|
|
84
98
|
questionsWithRank: z.ZodArray<z.ZodObject<{
|
|
85
99
|
id: z.ZodString;
|
|
@@ -368,19 +382,19 @@ declare const AnswerSchema: z.ZodObject<{
|
|
|
368
382
|
assets_id: z.ZodArray<z.ZodObject<{
|
|
369
383
|
doc_id: z.ZodString;
|
|
370
384
|
issue_reason: z.ZodNullable<z.ZodString>;
|
|
371
|
-
status: z.
|
|
385
|
+
status: z.ZodNativeEnum<typeof ASSET_STATUS>;
|
|
372
386
|
}, "strip", z.ZodTypeAny, {
|
|
373
|
-
status:
|
|
387
|
+
status: ASSET_STATUS;
|
|
374
388
|
doc_id: string;
|
|
375
389
|
issue_reason: string | null;
|
|
376
390
|
}, {
|
|
377
|
-
status:
|
|
391
|
+
status: ASSET_STATUS;
|
|
378
392
|
doc_id: string;
|
|
379
393
|
issue_reason: string | null;
|
|
380
394
|
}>, "many">;
|
|
381
395
|
answer: z.ZodArray<z.ZodString, "many">;
|
|
382
396
|
issue_reason: z.ZodNullable<z.ZodString>;
|
|
383
|
-
status: z.
|
|
397
|
+
status: z.ZodNativeEnum<typeof ANSWER_STATUS>;
|
|
384
398
|
is_deleted: z.ZodBoolean;
|
|
385
399
|
visa_order_id: z.ZodString;
|
|
386
400
|
validations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -406,7 +420,7 @@ declare const AnswerSchema: z.ZodObject<{
|
|
|
406
420
|
created_at: z.ZodString;
|
|
407
421
|
updated_at: z.ZodString;
|
|
408
422
|
}, "strip", z.ZodTypeAny, {
|
|
409
|
-
status:
|
|
423
|
+
status: ANSWER_STATUS;
|
|
410
424
|
_id: string;
|
|
411
425
|
visa_order_id: string;
|
|
412
426
|
created_at: string;
|
|
@@ -417,7 +431,7 @@ declare const AnswerSchema: z.ZodObject<{
|
|
|
417
431
|
visa_questions_id: string;
|
|
418
432
|
traveller_id: string;
|
|
419
433
|
assets_id: {
|
|
420
|
-
status:
|
|
434
|
+
status: ASSET_STATUS;
|
|
421
435
|
doc_id: string;
|
|
422
436
|
issue_reason: string | null;
|
|
423
437
|
}[];
|
|
@@ -431,7 +445,7 @@ declare const AnswerSchema: z.ZodObject<{
|
|
|
431
445
|
time_saved: number;
|
|
432
446
|
}[] | undefined;
|
|
433
447
|
}, {
|
|
434
|
-
status:
|
|
448
|
+
status: ANSWER_STATUS;
|
|
435
449
|
_id: string;
|
|
436
450
|
visa_order_id: string;
|
|
437
451
|
created_at: string;
|
|
@@ -442,7 +456,7 @@ declare const AnswerSchema: z.ZodObject<{
|
|
|
442
456
|
visa_questions_id: string;
|
|
443
457
|
traveller_id: string;
|
|
444
458
|
assets_id: {
|
|
445
|
-
status:
|
|
459
|
+
status: ASSET_STATUS;
|
|
446
460
|
doc_id: string;
|
|
447
461
|
issue_reason: string | null;
|
|
448
462
|
}[];
|
|
@@ -5435,6 +5449,8 @@ type TUpdateAnswerPayload = {
|
|
|
5435
5449
|
answer: string;
|
|
5436
5450
|
traveller_id: string;
|
|
5437
5451
|
file?: File | Blob | string | null;
|
|
5452
|
+
autoApproveAnswers?: boolean;
|
|
5453
|
+
forceRunValidations?: boolean;
|
|
5438
5454
|
};
|
|
5439
5455
|
type TUploadProgressEvent = {
|
|
5440
5456
|
percent: number;
|
|
@@ -5459,7 +5475,23 @@ type ValidationResult = {
|
|
|
5459
5475
|
perfect: ValidationResultGroup;
|
|
5460
5476
|
totalTimeSaved: number;
|
|
5461
5477
|
} | null;
|
|
5478
|
+
type TQuestionRenderInfo = {
|
|
5479
|
+
status: ANSWER_STATUS;
|
|
5480
|
+
rejectionReasons: string[];
|
|
5481
|
+
rejectedAssets: {
|
|
5482
|
+
doc_id: string;
|
|
5483
|
+
reason: string;
|
|
5484
|
+
}[];
|
|
5485
|
+
validationResult: ValidationResult;
|
|
5486
|
+
};
|
|
5487
|
+
type TQuestionValidationEntry = TQuestionRenderInfo & {
|
|
5488
|
+
name: string;
|
|
5489
|
+
};
|
|
5462
5490
|
|
|
5491
|
+
declare enum EDCFormMode {
|
|
5492
|
+
CREATE = "CREATE",
|
|
5493
|
+
FIX = "FIX"
|
|
5494
|
+
}
|
|
5463
5495
|
type TEDCFlowContext = {
|
|
5464
5496
|
orderId: string | null;
|
|
5465
5497
|
order: TVisaOrder | null;
|
|
@@ -5470,6 +5502,7 @@ type TEDCFlowContext = {
|
|
|
5470
5502
|
loading: boolean;
|
|
5471
5503
|
error: string | null;
|
|
5472
5504
|
success: string | null;
|
|
5505
|
+
mode: EDCFormMode;
|
|
5473
5506
|
refreshOrder: () => Promise<void>;
|
|
5474
5507
|
refreshApplicant: (application_id: string) => Promise<void>;
|
|
5475
5508
|
addApplicant: (payload: TAddTravellerPayload) => Promise<TEDCApplicant | null>;
|
|
@@ -5484,6 +5517,7 @@ type TEDCFlowContext = {
|
|
|
5484
5517
|
type TEDCFlowProviderProps = {
|
|
5485
5518
|
children: ReactNode;
|
|
5486
5519
|
orderId: string;
|
|
5520
|
+
mode?: EDCFormMode;
|
|
5487
5521
|
};
|
|
5488
5522
|
declare const EDCFlowProvider: react__default.FC<TEDCFlowProviderProps>;
|
|
5489
5523
|
declare const useEDCFlow: () => TEDCFlowContext;
|
|
@@ -5499,7 +5533,7 @@ declare function getSignedUrlFromAsset(docId: string): Promise<string | null>;
|
|
|
5499
5533
|
declare function getDisplayableQuestions(questions: TEDCApplicant["questions"], questionAnswerSources: ANSWER_SOURCE[]): TEDCApplicant["questions"];
|
|
5500
5534
|
declare function getDisplayableDocuments(questions: TEDCApplicant["questions"], documentAnswerSources: ANSWER_SOURCE[]): TEDCApplicant["questions"];
|
|
5501
5535
|
declare function getValidationErrors(validations?: TAnswer["validations"] | null): ValidationResult;
|
|
5502
|
-
declare function getValidationResult(question: TEDCApplicant["questions"][0]):
|
|
5536
|
+
declare function getValidationResult(question: TEDCApplicant["questions"][0]): TQuestionRenderInfo;
|
|
5503
5537
|
declare function validateApplicantQuestions(applicant: TEDCApplicant, questionAnswerSources: ANSWER_SOURCE[]): Array<{
|
|
5504
5538
|
name: string;
|
|
5505
5539
|
validationResult: ValidationResult;
|
|
@@ -5554,6 +5588,7 @@ declare function validateOrder(order: TVisaOrder | null | undefined, applicants:
|
|
|
5554
5588
|
}>;
|
|
5555
5589
|
};
|
|
5556
5590
|
declare function getFixTypeFromFixableItems(fixableItems: ValidationItem[]): FIX_TYPE;
|
|
5591
|
+
declare function getQuestionRenderInfo(question: TQuestionWithAnswer): TQuestionRenderInfo;
|
|
5557
5592
|
|
|
5558
5593
|
declare const initializeEDCFlow: (config: EDCConfig) => void;
|
|
5559
5594
|
declare const EDCFlow: {
|
|
@@ -5561,6 +5596,7 @@ declare const EDCFlow: {
|
|
|
5561
5596
|
Provider: react.FC<{
|
|
5562
5597
|
children: react.ReactNode;
|
|
5563
5598
|
orderId: string;
|
|
5599
|
+
mode?: EDCFormMode;
|
|
5564
5600
|
}>;
|
|
5565
5601
|
useEDCFlow: () => {
|
|
5566
5602
|
orderId: string | null;
|
|
@@ -5572,6 +5608,7 @@ declare const EDCFlow: {
|
|
|
5572
5608
|
loading: boolean;
|
|
5573
5609
|
error: string | null;
|
|
5574
5610
|
success: string | null;
|
|
5611
|
+
mode: EDCFormMode;
|
|
5575
5612
|
refreshOrder: () => Promise<void>;
|
|
5576
5613
|
refreshApplicant: (application_id: string) => Promise<void>;
|
|
5577
5614
|
addApplicant: (payload: TAddTravellerPayload) => Promise<TEDCApplicant | null>;
|
|
@@ -5585,4 +5622,4 @@ declare const EDCFlow: {
|
|
|
5585
5622
|
};
|
|
5586
5623
|
};
|
|
5587
5624
|
|
|
5588
|
-
export { ANSWER_SOURCE, APPLICATION_STATUS, APPLICATION_TAGS, AnswerSchema, type ApiResponse, ApplicationSchema, DOC_TYPES, type EDCConfig, EDCFlowProvider, FIX_TYPE, INTERNAL_ORDER_TAGS, PROCESSING_BLOCKED_ON_PAYMENT_STATUS, QUESTION_TYPE, QuestionnaireSchema, TA_QC_EXTRACTION_STATUS, type TAddTravellerPayload, type TAnswer, type TEDCApplicant, TIMELINE_STEP, type TQuestionWithAnswer, type TQuestionnaire, type TRenderRule, type TTraveller, type TUpdateAnswerPayload, type TUpdateTravellerPayload, type TUploadProgressEvent, type TVisaOrder, TimelinePaymentStatus, TravellerSchema, type UploadProgressEvent, VALIDATION_STATUS, VISA_TYPE_INTERNAL_TAGS, type ValidationItem, type ValidationResult, type ValidationResultGroup, createAllQuestionsWithAnswers, createApplicantData, EDCFlow as default, filterConditionalQuestions, formatAnswerFromResponse, formatTravellerFromResponse, getDisplayableDocuments, getDisplayableQuestions, getFixTypeFromFixableItems, getSignedUrlFromAsset, getValidationErrors, getValidationResult, getVisibleQuestions, initializeEDCFlow, updateApplicantWithAnswer, useEDCFlow, validateAllApplicants, validateApplicant, validateApplicantDocuments, validateApplicantQuestions, validateOrder };
|
|
5625
|
+
export { ANSWER_SOURCE, ANSWER_STATUS, APPLICATION_STATUS, APPLICATION_TAGS, ASSET_STATUS, AnswerSchema, type ApiResponse, ApplicationSchema, DOC_TYPES, type EDCConfig, EDCFlowProvider, EDCFormMode, FIX_TYPE, INTERNAL_ORDER_TAGS, PROCESSING_BLOCKED_ON_PAYMENT_STATUS, QUESTION_TYPE, QuestionnaireSchema, TA_QC_EXTRACTION_STATUS, type TAddTravellerPayload, type TAnswer, type TEDCApplicant, TIMELINE_STEP, type TQuestionRenderInfo, type TQuestionValidationEntry, type TQuestionWithAnswer, type TQuestionnaire, type TRenderRule, type TTraveller, type TUpdateAnswerPayload, type TUpdateTravellerPayload, type TUploadProgressEvent, type TVisaOrder, TimelinePaymentStatus, TravellerSchema, type UploadProgressEvent, VALIDATION_STATUS, VISA_TYPE_INTERNAL_TAGS, type ValidationItem, type ValidationResult, type ValidationResultGroup, createAllQuestionsWithAnswers, createApplicantData, EDCFlow as default, filterConditionalQuestions, formatAnswerFromResponse, formatTravellerFromResponse, getDisplayableDocuments, getDisplayableQuestions, getFixTypeFromFixableItems, getQuestionRenderInfo, getSignedUrlFromAsset, getValidationErrors, getValidationResult, getVisibleQuestions, initializeEDCFlow, updateApplicantWithAnswer, useEDCFlow, validateAllApplicants, validateApplicant, validateApplicantDocuments, validateApplicantQuestions, validateOrder };
|
package/dist/index.js
CHANGED
|
@@ -136,6 +136,22 @@ var FIX_TYPE = /* @__PURE__ */ ((FIX_TYPE2) => {
|
|
|
136
136
|
FIX_TYPE2["NONE"] = "none";
|
|
137
137
|
return FIX_TYPE2;
|
|
138
138
|
})(FIX_TYPE || {});
|
|
139
|
+
var ANSWER_STATUS = /* @__PURE__ */ ((ANSWER_STATUS2) => {
|
|
140
|
+
ANSWER_STATUS2["ANSWERED"] = "ANSWERED";
|
|
141
|
+
ANSWER_STATUS2["APPROVED"] = "APPROVED";
|
|
142
|
+
ANSWER_STATUS2["REJECTED"] = "REJECTED";
|
|
143
|
+
ANSWER_STATUS2["NA"] = "NA";
|
|
144
|
+
ANSWER_STATUS2["UNSTARTED"] = "UNSTARTED";
|
|
145
|
+
ANSWER_STATUS2["PENDING"] = "PENDING";
|
|
146
|
+
return ANSWER_STATUS2;
|
|
147
|
+
})(ANSWER_STATUS || {});
|
|
148
|
+
var ASSET_STATUS = /* @__PURE__ */ ((ASSET_STATUS2) => {
|
|
149
|
+
ASSET_STATUS2["ANSWERED"] = "ANSWERED";
|
|
150
|
+
ASSET_STATUS2["APPROVED"] = "APPROVED";
|
|
151
|
+
ASSET_STATUS2["REJECTED"] = "REJECTED";
|
|
152
|
+
ASSET_STATUS2["DELETED"] = "DELETED";
|
|
153
|
+
return ASSET_STATUS2;
|
|
154
|
+
})(ASSET_STATUS || {});
|
|
139
155
|
var QuestionnaireSchema = z2__namespace.object({
|
|
140
156
|
questionsWithRank: z2__namespace.array(z2__namespace.object({ id: z2__namespace.string(), rank: z2__namespace.number() })),
|
|
141
157
|
questionMap: z2__namespace.record(
|
|
@@ -213,12 +229,12 @@ var AnswerSchema = z2__namespace.object({
|
|
|
213
229
|
z2__namespace.object({
|
|
214
230
|
doc_id: z2__namespace.string(),
|
|
215
231
|
issue_reason: z2__namespace.string().nullable(),
|
|
216
|
-
status: z2__namespace.
|
|
232
|
+
status: z2__namespace.nativeEnum(ASSET_STATUS)
|
|
217
233
|
})
|
|
218
234
|
),
|
|
219
235
|
answer: z2__namespace.array(z2__namespace.string()),
|
|
220
236
|
issue_reason: z2__namespace.string().nullable(),
|
|
221
|
-
status: z2__namespace.
|
|
237
|
+
status: z2__namespace.nativeEnum(ANSWER_STATUS),
|
|
222
238
|
is_deleted: z2__namespace.boolean(),
|
|
223
239
|
visa_order_id: z2__namespace.string(),
|
|
224
240
|
validations: z2__namespace.array(z2__namespace.object({
|
|
@@ -621,14 +637,14 @@ function getValidationErrors(validations) {
|
|
|
621
637
|
totalTimeSaved
|
|
622
638
|
};
|
|
623
639
|
}
|
|
624
|
-
function
|
|
640
|
+
function computeValidationResult(question) {
|
|
625
641
|
const backendResult = getValidationErrors(question.answer_data?.validations);
|
|
626
642
|
if (backendResult && backendResult.status !== "PERFECT" /* PERFECT */) {
|
|
627
643
|
return backendResult;
|
|
628
644
|
}
|
|
629
645
|
if (question.question.is_required) {
|
|
630
646
|
const isDocument = question.question.type === "DOCUMENT" /* DOCUMENT */;
|
|
631
|
-
const hasApproved = question.answer_data?.assets_id?.find((asset) => asset.status === "APPROVED");
|
|
647
|
+
const hasApproved = question.answer_data?.assets_id?.find((asset) => asset.status === "APPROVED" /* APPROVED */);
|
|
632
648
|
const answer = question.answer_data?.answer?.[0];
|
|
633
649
|
const isAnswerEmpty = !answer || answer === "" || extractDefaultAnswer(answer) !== null;
|
|
634
650
|
if (isDocument && !hasApproved || !isDocument && isAnswerEmpty) {
|
|
@@ -655,16 +671,17 @@ function getValidationResult(question) {
|
|
|
655
671
|
totalTimeSaved: 0
|
|
656
672
|
};
|
|
657
673
|
}
|
|
674
|
+
function getValidationResult(question) {
|
|
675
|
+
return getQuestionRenderInfo(question);
|
|
676
|
+
}
|
|
658
677
|
function validateApplicantQuestions(applicant, questionAnswerSources) {
|
|
659
678
|
const displayableQuestions = getDisplayableQuestions(applicant.questions, questionAnswerSources);
|
|
660
679
|
const questionValidations = [];
|
|
661
680
|
displayableQuestions.forEach((question) => {
|
|
662
|
-
const
|
|
681
|
+
const renderInfo = getValidationResult(question);
|
|
682
|
+
const { validationResult } = renderInfo;
|
|
663
683
|
if (validationResult && (validationResult.status === "MISSING" /* MISSING */ || validationResult.status === "UNFIXABLE" /* UNFIXABLE */)) {
|
|
664
|
-
questionValidations.push({
|
|
665
|
-
name: question.question.question,
|
|
666
|
-
validationResult
|
|
667
|
-
});
|
|
684
|
+
questionValidations.push({ name: question.question.question, validationResult });
|
|
668
685
|
}
|
|
669
686
|
});
|
|
670
687
|
return questionValidations;
|
|
@@ -673,12 +690,10 @@ function validateApplicantDocuments(applicant, documentAnswerSources) {
|
|
|
673
690
|
const displayableDocuments = getDisplayableDocuments(applicant.questions, documentAnswerSources);
|
|
674
691
|
const documentValidations = [];
|
|
675
692
|
displayableDocuments.forEach((document) => {
|
|
676
|
-
const
|
|
693
|
+
const renderInfo = getValidationResult(document);
|
|
694
|
+
const { validationResult } = renderInfo;
|
|
677
695
|
if (validationResult && (validationResult.status === "MISSING" /* MISSING */ || validationResult.status === "UNFIXABLE" /* UNFIXABLE */)) {
|
|
678
|
-
documentValidations.push({
|
|
679
|
-
name: document.question.question,
|
|
680
|
-
validationResult
|
|
681
|
-
});
|
|
696
|
+
documentValidations.push({ name: document.question.question, validationResult });
|
|
682
697
|
}
|
|
683
698
|
});
|
|
684
699
|
return documentValidations;
|
|
@@ -736,6 +751,22 @@ function getFixTypeFromFixableItems(fixableItems) {
|
|
|
736
751
|
}
|
|
737
752
|
return "auto" /* AUTO */;
|
|
738
753
|
}
|
|
754
|
+
function getQuestionRenderInfo(question) {
|
|
755
|
+
const answer = question.answer_data;
|
|
756
|
+
const status = answer?.status ?? "UNSTARTED" /* UNSTARTED */;
|
|
757
|
+
let rejectionReasons = [];
|
|
758
|
+
let rejectedAssets = [];
|
|
759
|
+
if (status === "REJECTED" /* REJECTED */ && answer) {
|
|
760
|
+
rejectedAssets = answer.assets_id?.filter((a) => a.status === "REJECTED" /* REJECTED */ && a.issue_reason).map((a) => ({ doc_id: a.doc_id, reason: a.issue_reason })) ?? [];
|
|
761
|
+
rejectionReasons = rejectedAssets.length > 0 ? rejectedAssets.map((a) => a.reason) : answer.issue_reason ? [answer.issue_reason] : [];
|
|
762
|
+
}
|
|
763
|
+
return {
|
|
764
|
+
status,
|
|
765
|
+
rejectionReasons,
|
|
766
|
+
rejectedAssets,
|
|
767
|
+
validationResult: computeValidationResult(question)
|
|
768
|
+
};
|
|
769
|
+
}
|
|
739
770
|
|
|
740
771
|
// src/api/index.ts
|
|
741
772
|
var transformApplicationData = (rawData) => {
|
|
@@ -791,6 +822,12 @@ var updateAnswer = async (applicationId, data, onProgress) => {
|
|
|
791
822
|
if (data.file) {
|
|
792
823
|
formData.append("docs", data.file);
|
|
793
824
|
}
|
|
825
|
+
if (data.autoApproveAnswers !== void 0) {
|
|
826
|
+
formData.append("autoApproveAnswers", String(data.autoApproveAnswers));
|
|
827
|
+
}
|
|
828
|
+
if (data.forceRunValidations !== void 0) {
|
|
829
|
+
formData.append("forceRunValidations", String(data.forceRunValidations));
|
|
830
|
+
}
|
|
794
831
|
const response = await client.post(`/visa_answers/upsert-answer-edc`, formData, {
|
|
795
832
|
onUploadProgress: (event) => {
|
|
796
833
|
onProgress?.({
|
|
@@ -880,8 +917,17 @@ var mapFixableDocument = async (answerId) => {
|
|
|
880
917
|
}
|
|
881
918
|
};
|
|
882
919
|
};
|
|
920
|
+
var EDCFormMode = /* @__PURE__ */ ((EDCFormMode2) => {
|
|
921
|
+
EDCFormMode2["CREATE"] = "CREATE";
|
|
922
|
+
EDCFormMode2["FIX"] = "FIX";
|
|
923
|
+
return EDCFormMode2;
|
|
924
|
+
})(EDCFormMode || {});
|
|
883
925
|
var EDCFlowContext = react.createContext(void 0);
|
|
884
|
-
var EDCFlowProvider = ({
|
|
926
|
+
var EDCFlowProvider = ({
|
|
927
|
+
children,
|
|
928
|
+
orderId,
|
|
929
|
+
mode = "CREATE" /* CREATE */
|
|
930
|
+
}) => {
|
|
885
931
|
const [order, setOrder] = react.useState(null);
|
|
886
932
|
const [questionnaire, setQuestionnaire] = react.useState(null);
|
|
887
933
|
const [dynamicQuestionMap, setDynamicQuestionMap] = react.useState({});
|
|
@@ -1019,7 +1065,11 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1019
1065
|
const currentApplicant = prev[application_id];
|
|
1020
1066
|
if (!currentApplicant) return prev;
|
|
1021
1067
|
const applicantWithUpdatedAnswer = updateApplicantWithAnswer(
|
|
1022
|
-
{
|
|
1068
|
+
{
|
|
1069
|
+
...currentApplicant,
|
|
1070
|
+
application: updatedAnswerData.application,
|
|
1071
|
+
traveller: updatedAnswerData.traveller
|
|
1072
|
+
},
|
|
1023
1073
|
updatedAnswerData.answers.visa_questions_id,
|
|
1024
1074
|
updatedAnswerData.answers,
|
|
1025
1075
|
questionnaire
|
|
@@ -1056,63 +1106,69 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1056
1106
|
},
|
|
1057
1107
|
[questionnaire, order, refreshApplicant]
|
|
1058
1108
|
);
|
|
1059
|
-
const deleteApplicantById = react.useCallback(
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1109
|
+
const deleteApplicantById = react.useCallback(
|
|
1110
|
+
async (application_id) => {
|
|
1111
|
+
if (!questionnaire || !order) return;
|
|
1112
|
+
try {
|
|
1113
|
+
await deleteApplicant(application_id);
|
|
1114
|
+
setApplicants((prev) => {
|
|
1115
|
+
const { [application_id]: _, ...updatedApplicants } = prev;
|
|
1116
|
+
const { updatedQuestionnaire, updatedApplicants: applicantsWithSideEffects } = runApplicantSideEffects(updatedApplicants, questionnaire, dynamicQuestionMap);
|
|
1117
|
+
setQuestionnaire(updatedQuestionnaire);
|
|
1118
|
+
setActiveApplicant((prevActive) => {
|
|
1119
|
+
if (prevActive === application_id) {
|
|
1120
|
+
const remainingIds = Object.keys(applicantsWithSideEffects);
|
|
1121
|
+
return remainingIds.length > 0 ? remainingIds[remainingIds.length - 1] : null;
|
|
1122
|
+
}
|
|
1123
|
+
return prevActive;
|
|
1124
|
+
});
|
|
1125
|
+
return applicantsWithSideEffects;
|
|
1073
1126
|
});
|
|
1074
|
-
|
|
1075
|
-
})
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1127
|
+
setSuccess("Applicant deleted successfully");
|
|
1128
|
+
} catch (err) {
|
|
1129
|
+
console.error("Failed to delete applicant:", err);
|
|
1130
|
+
setError("Failed to delete applicant");
|
|
1131
|
+
throw err;
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
[questionnaire, order, dynamicQuestionMap]
|
|
1135
|
+
);
|
|
1083
1136
|
const refreshOrder = react.useCallback(async () => {
|
|
1084
1137
|
await fetchOrder();
|
|
1085
1138
|
}, [fetchOrder]);
|
|
1086
|
-
const getS3UrlForAsset = react.useCallback(
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
const existingRequest = s3UrlFetchFlightRequests.current.get(doc_id);
|
|
1092
|
-
if (existingRequest) {
|
|
1093
|
-
return existingRequest;
|
|
1094
|
-
}
|
|
1095
|
-
const request = (async () => {
|
|
1096
|
-
try {
|
|
1097
|
-
const s3Url = await getSignedUrlFromAsset(doc_id);
|
|
1098
|
-
setDocIdToS3Url((prev) => ({
|
|
1099
|
-
...prev,
|
|
1100
|
-
[doc_id]: s3Url
|
|
1101
|
-
}));
|
|
1102
|
-
s3UrlFetchFlightRequests.current.delete(doc_id);
|
|
1103
|
-
return s3Url;
|
|
1104
|
-
} catch (error2) {
|
|
1105
|
-
setDocIdToS3Url((prev) => ({
|
|
1106
|
-
...prev,
|
|
1107
|
-
[doc_id]: null
|
|
1108
|
-
}));
|
|
1109
|
-
s3UrlFetchFlightRequests.current.delete(doc_id);
|
|
1110
|
-
return null;
|
|
1139
|
+
const getS3UrlForAsset = react.useCallback(
|
|
1140
|
+
async (doc_id) => {
|
|
1141
|
+
if (!doc_id) return null;
|
|
1142
|
+
if (docIdToS3Url[doc_id] !== void 0) {
|
|
1143
|
+
return docIdToS3Url[doc_id];
|
|
1111
1144
|
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1145
|
+
const existingRequest = s3UrlFetchFlightRequests.current.get(doc_id);
|
|
1146
|
+
if (existingRequest) {
|
|
1147
|
+
return existingRequest;
|
|
1148
|
+
}
|
|
1149
|
+
const request = (async () => {
|
|
1150
|
+
try {
|
|
1151
|
+
const s3Url = await getSignedUrlFromAsset(doc_id);
|
|
1152
|
+
setDocIdToS3Url((prev) => ({
|
|
1153
|
+
...prev,
|
|
1154
|
+
[doc_id]: s3Url
|
|
1155
|
+
}));
|
|
1156
|
+
s3UrlFetchFlightRequests.current.delete(doc_id);
|
|
1157
|
+
return s3Url;
|
|
1158
|
+
} catch (error2) {
|
|
1159
|
+
setDocIdToS3Url((prev) => ({
|
|
1160
|
+
...prev,
|
|
1161
|
+
[doc_id]: null
|
|
1162
|
+
}));
|
|
1163
|
+
s3UrlFetchFlightRequests.current.delete(doc_id);
|
|
1164
|
+
return null;
|
|
1165
|
+
}
|
|
1166
|
+
})();
|
|
1167
|
+
s3UrlFetchFlightRequests.current.set(doc_id, request);
|
|
1168
|
+
return request;
|
|
1169
|
+
},
|
|
1170
|
+
[docIdToS3Url]
|
|
1171
|
+
);
|
|
1116
1172
|
const acceptOrderQCTermsAndConditions = react.useCallback(async () => {
|
|
1117
1173
|
if (!order) return;
|
|
1118
1174
|
try {
|
|
@@ -1131,11 +1187,12 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1131
1187
|
setOrder(data.order);
|
|
1132
1188
|
}
|
|
1133
1189
|
if (data.applications && data.applications.length > 0) {
|
|
1134
|
-
const applicants2 = createApplicantsFromApplications(
|
|
1135
|
-
|
|
1136
|
-
|
|
1190
|
+
const applicants2 = createApplicantsFromApplications(data.applications, questionnaire);
|
|
1191
|
+
const { updatedQuestionnaire, updatedApplicants } = runApplicantSideEffects(
|
|
1192
|
+
applicants2,
|
|
1193
|
+
questionnaire,
|
|
1194
|
+
dynamicQuestionMap
|
|
1137
1195
|
);
|
|
1138
|
-
const { updatedQuestionnaire, updatedApplicants } = runApplicantSideEffects(applicants2, questionnaire, dynamicQuestionMap);
|
|
1139
1196
|
setQuestionnaire(updatedQuestionnaire);
|
|
1140
1197
|
setApplicants(updatedApplicants);
|
|
1141
1198
|
const applicantIds = Object.keys(updatedApplicants);
|
|
@@ -1153,36 +1210,39 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1153
1210
|
setError("Failed to run all validations");
|
|
1154
1211
|
}
|
|
1155
1212
|
}, [orderId, questionnaire, dynamicQuestionMap, activeApplicant]);
|
|
1156
|
-
const runApplicantValidationsHandler = react.useCallback(
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1213
|
+
const runApplicantValidationsHandler = react.useCallback(
|
|
1214
|
+
async (applicationId) => {
|
|
1215
|
+
if (!orderId || !questionnaire) return;
|
|
1216
|
+
try {
|
|
1217
|
+
setError(null);
|
|
1218
|
+
const { data } = await runApplicantValidations(applicationId);
|
|
1219
|
+
if (data.application) {
|
|
1220
|
+
const applicant = createApplicantData(
|
|
1221
|
+
data.application.traveller,
|
|
1222
|
+
data.application.answers,
|
|
1223
|
+
questionnaire,
|
|
1224
|
+
data.application.application
|
|
1225
|
+
);
|
|
1226
|
+
if (applicant) {
|
|
1227
|
+
setApplicants((prev) => {
|
|
1228
|
+
const updatedApplicants = {
|
|
1229
|
+
...prev,
|
|
1230
|
+
[applicationId]: applicant
|
|
1231
|
+
};
|
|
1232
|
+
const { updatedQuestionnaire, updatedApplicants: applicantsWithSideEffects } = runApplicantSideEffects(updatedApplicants, questionnaire, dynamicQuestionMap);
|
|
1233
|
+
setQuestionnaire(updatedQuestionnaire);
|
|
1234
|
+
return applicantsWithSideEffects;
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1178
1237
|
}
|
|
1238
|
+
setSuccess("Applicant validations completed successfully");
|
|
1239
|
+
} catch (err) {
|
|
1240
|
+
console.error("Failed to run applicant validations:", err);
|
|
1241
|
+
setError("Failed to run applicant validations");
|
|
1179
1242
|
}
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
setError("Failed to run applicant validations");
|
|
1184
|
-
}
|
|
1185
|
-
}, [orderId, questionnaire, dynamicQuestionMap]);
|
|
1243
|
+
},
|
|
1244
|
+
[orderId, questionnaire, dynamicQuestionMap]
|
|
1245
|
+
);
|
|
1186
1246
|
react.useEffect(() => {
|
|
1187
1247
|
if (!orderId) return;
|
|
1188
1248
|
const initialize = async () => {
|
|
@@ -1195,12 +1255,13 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1195
1255
|
fetchApplicantsForOrder()
|
|
1196
1256
|
]);
|
|
1197
1257
|
if (orderData && questionnaireData && applications) {
|
|
1198
|
-
const applicants2 = createApplicantsFromApplications(
|
|
1199
|
-
applications,
|
|
1200
|
-
questionnaireData
|
|
1201
|
-
);
|
|
1258
|
+
const applicants2 = createApplicantsFromApplications(applications, questionnaireData);
|
|
1202
1259
|
const dynamicMap = buildDynamicQuestionMap(questionnaireData);
|
|
1203
|
-
const { updatedQuestionnaire, updatedApplicants } = runApplicantSideEffects(
|
|
1260
|
+
const { updatedQuestionnaire, updatedApplicants } = runApplicantSideEffects(
|
|
1261
|
+
applicants2,
|
|
1262
|
+
questionnaireData,
|
|
1263
|
+
dynamicMap
|
|
1264
|
+
);
|
|
1204
1265
|
setQuestionnaire(updatedQuestionnaire);
|
|
1205
1266
|
setApplicants(updatedApplicants);
|
|
1206
1267
|
const ids = Object.keys(updatedApplicants);
|
|
@@ -1227,6 +1288,7 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1227
1288
|
loading,
|
|
1228
1289
|
error,
|
|
1229
1290
|
success,
|
|
1291
|
+
mode,
|
|
1230
1292
|
addApplicant: addApplicant2,
|
|
1231
1293
|
updateAnswer: updateAnswer2,
|
|
1232
1294
|
deleteApplicant: deleteApplicantById,
|
|
@@ -1748,12 +1810,15 @@ var EDCFlow = {
|
|
|
1748
1810
|
var index_default = EDCFlow;
|
|
1749
1811
|
|
|
1750
1812
|
exports.ANSWER_SOURCE = ANSWER_SOURCE;
|
|
1813
|
+
exports.ANSWER_STATUS = ANSWER_STATUS;
|
|
1751
1814
|
exports.APPLICATION_STATUS = APPLICATION_STATUS;
|
|
1752
1815
|
exports.APPLICATION_TAGS = APPLICATION_TAGS;
|
|
1816
|
+
exports.ASSET_STATUS = ASSET_STATUS;
|
|
1753
1817
|
exports.AnswerSchema = AnswerSchema;
|
|
1754
1818
|
exports.ApplicationSchema = ApplicationSchema;
|
|
1755
1819
|
exports.DOC_TYPES = DOC_TYPES;
|
|
1756
1820
|
exports.EDCFlowProvider = EDCFlowProvider;
|
|
1821
|
+
exports.EDCFormMode = EDCFormMode;
|
|
1757
1822
|
exports.FIX_TYPE = FIX_TYPE;
|
|
1758
1823
|
exports.INTERNAL_ORDER_TAGS = INTERNAL_ORDER_TAGS;
|
|
1759
1824
|
exports.PROCESSING_BLOCKED_ON_PAYMENT_STATUS = PROCESSING_BLOCKED_ON_PAYMENT_STATUS;
|
|
@@ -1774,6 +1839,7 @@ exports.formatTravellerFromResponse = formatTravellerFromResponse;
|
|
|
1774
1839
|
exports.getDisplayableDocuments = getDisplayableDocuments;
|
|
1775
1840
|
exports.getDisplayableQuestions = getDisplayableQuestions;
|
|
1776
1841
|
exports.getFixTypeFromFixableItems = getFixTypeFromFixableItems;
|
|
1842
|
+
exports.getQuestionRenderInfo = getQuestionRenderInfo;
|
|
1777
1843
|
exports.getSignedUrlFromAsset = getSignedUrlFromAsset;
|
|
1778
1844
|
exports.getValidationErrors = getValidationErrors;
|
|
1779
1845
|
exports.getValidationResult = getValidationResult;
|
package/dist/index.mjs
CHANGED
|
@@ -110,6 +110,22 @@ var FIX_TYPE = /* @__PURE__ */ ((FIX_TYPE2) => {
|
|
|
110
110
|
FIX_TYPE2["NONE"] = "none";
|
|
111
111
|
return FIX_TYPE2;
|
|
112
112
|
})(FIX_TYPE || {});
|
|
113
|
+
var ANSWER_STATUS = /* @__PURE__ */ ((ANSWER_STATUS2) => {
|
|
114
|
+
ANSWER_STATUS2["ANSWERED"] = "ANSWERED";
|
|
115
|
+
ANSWER_STATUS2["APPROVED"] = "APPROVED";
|
|
116
|
+
ANSWER_STATUS2["REJECTED"] = "REJECTED";
|
|
117
|
+
ANSWER_STATUS2["NA"] = "NA";
|
|
118
|
+
ANSWER_STATUS2["UNSTARTED"] = "UNSTARTED";
|
|
119
|
+
ANSWER_STATUS2["PENDING"] = "PENDING";
|
|
120
|
+
return ANSWER_STATUS2;
|
|
121
|
+
})(ANSWER_STATUS || {});
|
|
122
|
+
var ASSET_STATUS = /* @__PURE__ */ ((ASSET_STATUS2) => {
|
|
123
|
+
ASSET_STATUS2["ANSWERED"] = "ANSWERED";
|
|
124
|
+
ASSET_STATUS2["APPROVED"] = "APPROVED";
|
|
125
|
+
ASSET_STATUS2["REJECTED"] = "REJECTED";
|
|
126
|
+
ASSET_STATUS2["DELETED"] = "DELETED";
|
|
127
|
+
return ASSET_STATUS2;
|
|
128
|
+
})(ASSET_STATUS || {});
|
|
113
129
|
var QuestionnaireSchema = z2.object({
|
|
114
130
|
questionsWithRank: z2.array(z2.object({ id: z2.string(), rank: z2.number() })),
|
|
115
131
|
questionMap: z2.record(
|
|
@@ -187,12 +203,12 @@ var AnswerSchema = z2.object({
|
|
|
187
203
|
z2.object({
|
|
188
204
|
doc_id: z2.string(),
|
|
189
205
|
issue_reason: z2.string().nullable(),
|
|
190
|
-
status: z2.
|
|
206
|
+
status: z2.nativeEnum(ASSET_STATUS)
|
|
191
207
|
})
|
|
192
208
|
),
|
|
193
209
|
answer: z2.array(z2.string()),
|
|
194
210
|
issue_reason: z2.string().nullable(),
|
|
195
|
-
status: z2.
|
|
211
|
+
status: z2.nativeEnum(ANSWER_STATUS),
|
|
196
212
|
is_deleted: z2.boolean(),
|
|
197
213
|
visa_order_id: z2.string(),
|
|
198
214
|
validations: z2.array(z2.object({
|
|
@@ -595,14 +611,14 @@ function getValidationErrors(validations) {
|
|
|
595
611
|
totalTimeSaved
|
|
596
612
|
};
|
|
597
613
|
}
|
|
598
|
-
function
|
|
614
|
+
function computeValidationResult(question) {
|
|
599
615
|
const backendResult = getValidationErrors(question.answer_data?.validations);
|
|
600
616
|
if (backendResult && backendResult.status !== "PERFECT" /* PERFECT */) {
|
|
601
617
|
return backendResult;
|
|
602
618
|
}
|
|
603
619
|
if (question.question.is_required) {
|
|
604
620
|
const isDocument = question.question.type === "DOCUMENT" /* DOCUMENT */;
|
|
605
|
-
const hasApproved = question.answer_data?.assets_id?.find((asset) => asset.status === "APPROVED");
|
|
621
|
+
const hasApproved = question.answer_data?.assets_id?.find((asset) => asset.status === "APPROVED" /* APPROVED */);
|
|
606
622
|
const answer = question.answer_data?.answer?.[0];
|
|
607
623
|
const isAnswerEmpty = !answer || answer === "" || extractDefaultAnswer(answer) !== null;
|
|
608
624
|
if (isDocument && !hasApproved || !isDocument && isAnswerEmpty) {
|
|
@@ -629,16 +645,17 @@ function getValidationResult(question) {
|
|
|
629
645
|
totalTimeSaved: 0
|
|
630
646
|
};
|
|
631
647
|
}
|
|
648
|
+
function getValidationResult(question) {
|
|
649
|
+
return getQuestionRenderInfo(question);
|
|
650
|
+
}
|
|
632
651
|
function validateApplicantQuestions(applicant, questionAnswerSources) {
|
|
633
652
|
const displayableQuestions = getDisplayableQuestions(applicant.questions, questionAnswerSources);
|
|
634
653
|
const questionValidations = [];
|
|
635
654
|
displayableQuestions.forEach((question) => {
|
|
636
|
-
const
|
|
655
|
+
const renderInfo = getValidationResult(question);
|
|
656
|
+
const { validationResult } = renderInfo;
|
|
637
657
|
if (validationResult && (validationResult.status === "MISSING" /* MISSING */ || validationResult.status === "UNFIXABLE" /* UNFIXABLE */)) {
|
|
638
|
-
questionValidations.push({
|
|
639
|
-
name: question.question.question,
|
|
640
|
-
validationResult
|
|
641
|
-
});
|
|
658
|
+
questionValidations.push({ name: question.question.question, validationResult });
|
|
642
659
|
}
|
|
643
660
|
});
|
|
644
661
|
return questionValidations;
|
|
@@ -647,12 +664,10 @@ function validateApplicantDocuments(applicant, documentAnswerSources) {
|
|
|
647
664
|
const displayableDocuments = getDisplayableDocuments(applicant.questions, documentAnswerSources);
|
|
648
665
|
const documentValidations = [];
|
|
649
666
|
displayableDocuments.forEach((document) => {
|
|
650
|
-
const
|
|
667
|
+
const renderInfo = getValidationResult(document);
|
|
668
|
+
const { validationResult } = renderInfo;
|
|
651
669
|
if (validationResult && (validationResult.status === "MISSING" /* MISSING */ || validationResult.status === "UNFIXABLE" /* UNFIXABLE */)) {
|
|
652
|
-
documentValidations.push({
|
|
653
|
-
name: document.question.question,
|
|
654
|
-
validationResult
|
|
655
|
-
});
|
|
670
|
+
documentValidations.push({ name: document.question.question, validationResult });
|
|
656
671
|
}
|
|
657
672
|
});
|
|
658
673
|
return documentValidations;
|
|
@@ -710,6 +725,22 @@ function getFixTypeFromFixableItems(fixableItems) {
|
|
|
710
725
|
}
|
|
711
726
|
return "auto" /* AUTO */;
|
|
712
727
|
}
|
|
728
|
+
function getQuestionRenderInfo(question) {
|
|
729
|
+
const answer = question.answer_data;
|
|
730
|
+
const status = answer?.status ?? "UNSTARTED" /* UNSTARTED */;
|
|
731
|
+
let rejectionReasons = [];
|
|
732
|
+
let rejectedAssets = [];
|
|
733
|
+
if (status === "REJECTED" /* REJECTED */ && answer) {
|
|
734
|
+
rejectedAssets = answer.assets_id?.filter((a) => a.status === "REJECTED" /* REJECTED */ && a.issue_reason).map((a) => ({ doc_id: a.doc_id, reason: a.issue_reason })) ?? [];
|
|
735
|
+
rejectionReasons = rejectedAssets.length > 0 ? rejectedAssets.map((a) => a.reason) : answer.issue_reason ? [answer.issue_reason] : [];
|
|
736
|
+
}
|
|
737
|
+
return {
|
|
738
|
+
status,
|
|
739
|
+
rejectionReasons,
|
|
740
|
+
rejectedAssets,
|
|
741
|
+
validationResult: computeValidationResult(question)
|
|
742
|
+
};
|
|
743
|
+
}
|
|
713
744
|
|
|
714
745
|
// src/api/index.ts
|
|
715
746
|
var transformApplicationData = (rawData) => {
|
|
@@ -765,6 +796,12 @@ var updateAnswer = async (applicationId, data, onProgress) => {
|
|
|
765
796
|
if (data.file) {
|
|
766
797
|
formData.append("docs", data.file);
|
|
767
798
|
}
|
|
799
|
+
if (data.autoApproveAnswers !== void 0) {
|
|
800
|
+
formData.append("autoApproveAnswers", String(data.autoApproveAnswers));
|
|
801
|
+
}
|
|
802
|
+
if (data.forceRunValidations !== void 0) {
|
|
803
|
+
formData.append("forceRunValidations", String(data.forceRunValidations));
|
|
804
|
+
}
|
|
768
805
|
const response = await client.post(`/visa_answers/upsert-answer-edc`, formData, {
|
|
769
806
|
onUploadProgress: (event) => {
|
|
770
807
|
onProgress?.({
|
|
@@ -854,8 +891,17 @@ var mapFixableDocument = async (answerId) => {
|
|
|
854
891
|
}
|
|
855
892
|
};
|
|
856
893
|
};
|
|
894
|
+
var EDCFormMode = /* @__PURE__ */ ((EDCFormMode2) => {
|
|
895
|
+
EDCFormMode2["CREATE"] = "CREATE";
|
|
896
|
+
EDCFormMode2["FIX"] = "FIX";
|
|
897
|
+
return EDCFormMode2;
|
|
898
|
+
})(EDCFormMode || {});
|
|
857
899
|
var EDCFlowContext = createContext(void 0);
|
|
858
|
-
var EDCFlowProvider = ({
|
|
900
|
+
var EDCFlowProvider = ({
|
|
901
|
+
children,
|
|
902
|
+
orderId,
|
|
903
|
+
mode = "CREATE" /* CREATE */
|
|
904
|
+
}) => {
|
|
859
905
|
const [order, setOrder] = useState(null);
|
|
860
906
|
const [questionnaire, setQuestionnaire] = useState(null);
|
|
861
907
|
const [dynamicQuestionMap, setDynamicQuestionMap] = useState({});
|
|
@@ -993,7 +1039,11 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
993
1039
|
const currentApplicant = prev[application_id];
|
|
994
1040
|
if (!currentApplicant) return prev;
|
|
995
1041
|
const applicantWithUpdatedAnswer = updateApplicantWithAnswer(
|
|
996
|
-
{
|
|
1042
|
+
{
|
|
1043
|
+
...currentApplicant,
|
|
1044
|
+
application: updatedAnswerData.application,
|
|
1045
|
+
traveller: updatedAnswerData.traveller
|
|
1046
|
+
},
|
|
997
1047
|
updatedAnswerData.answers.visa_questions_id,
|
|
998
1048
|
updatedAnswerData.answers,
|
|
999
1049
|
questionnaire
|
|
@@ -1030,63 +1080,69 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1030
1080
|
},
|
|
1031
1081
|
[questionnaire, order, refreshApplicant]
|
|
1032
1082
|
);
|
|
1033
|
-
const deleteApplicantById = useCallback(
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1083
|
+
const deleteApplicantById = useCallback(
|
|
1084
|
+
async (application_id) => {
|
|
1085
|
+
if (!questionnaire || !order) return;
|
|
1086
|
+
try {
|
|
1087
|
+
await deleteApplicant(application_id);
|
|
1088
|
+
setApplicants((prev) => {
|
|
1089
|
+
const { [application_id]: _, ...updatedApplicants } = prev;
|
|
1090
|
+
const { updatedQuestionnaire, updatedApplicants: applicantsWithSideEffects } = runApplicantSideEffects(updatedApplicants, questionnaire, dynamicQuestionMap);
|
|
1091
|
+
setQuestionnaire(updatedQuestionnaire);
|
|
1092
|
+
setActiveApplicant((prevActive) => {
|
|
1093
|
+
if (prevActive === application_id) {
|
|
1094
|
+
const remainingIds = Object.keys(applicantsWithSideEffects);
|
|
1095
|
+
return remainingIds.length > 0 ? remainingIds[remainingIds.length - 1] : null;
|
|
1096
|
+
}
|
|
1097
|
+
return prevActive;
|
|
1098
|
+
});
|
|
1099
|
+
return applicantsWithSideEffects;
|
|
1047
1100
|
});
|
|
1048
|
-
|
|
1049
|
-
})
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1101
|
+
setSuccess("Applicant deleted successfully");
|
|
1102
|
+
} catch (err) {
|
|
1103
|
+
console.error("Failed to delete applicant:", err);
|
|
1104
|
+
setError("Failed to delete applicant");
|
|
1105
|
+
throw err;
|
|
1106
|
+
}
|
|
1107
|
+
},
|
|
1108
|
+
[questionnaire, order, dynamicQuestionMap]
|
|
1109
|
+
);
|
|
1057
1110
|
const refreshOrder = useCallback(async () => {
|
|
1058
1111
|
await fetchOrder();
|
|
1059
1112
|
}, [fetchOrder]);
|
|
1060
|
-
const getS3UrlForAsset = useCallback(
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
const existingRequest = s3UrlFetchFlightRequests.current.get(doc_id);
|
|
1066
|
-
if (existingRequest) {
|
|
1067
|
-
return existingRequest;
|
|
1068
|
-
}
|
|
1069
|
-
const request = (async () => {
|
|
1070
|
-
try {
|
|
1071
|
-
const s3Url = await getSignedUrlFromAsset(doc_id);
|
|
1072
|
-
setDocIdToS3Url((prev) => ({
|
|
1073
|
-
...prev,
|
|
1074
|
-
[doc_id]: s3Url
|
|
1075
|
-
}));
|
|
1076
|
-
s3UrlFetchFlightRequests.current.delete(doc_id);
|
|
1077
|
-
return s3Url;
|
|
1078
|
-
} catch (error2) {
|
|
1079
|
-
setDocIdToS3Url((prev) => ({
|
|
1080
|
-
...prev,
|
|
1081
|
-
[doc_id]: null
|
|
1082
|
-
}));
|
|
1083
|
-
s3UrlFetchFlightRequests.current.delete(doc_id);
|
|
1084
|
-
return null;
|
|
1113
|
+
const getS3UrlForAsset = useCallback(
|
|
1114
|
+
async (doc_id) => {
|
|
1115
|
+
if (!doc_id) return null;
|
|
1116
|
+
if (docIdToS3Url[doc_id] !== void 0) {
|
|
1117
|
+
return docIdToS3Url[doc_id];
|
|
1085
1118
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1119
|
+
const existingRequest = s3UrlFetchFlightRequests.current.get(doc_id);
|
|
1120
|
+
if (existingRequest) {
|
|
1121
|
+
return existingRequest;
|
|
1122
|
+
}
|
|
1123
|
+
const request = (async () => {
|
|
1124
|
+
try {
|
|
1125
|
+
const s3Url = await getSignedUrlFromAsset(doc_id);
|
|
1126
|
+
setDocIdToS3Url((prev) => ({
|
|
1127
|
+
...prev,
|
|
1128
|
+
[doc_id]: s3Url
|
|
1129
|
+
}));
|
|
1130
|
+
s3UrlFetchFlightRequests.current.delete(doc_id);
|
|
1131
|
+
return s3Url;
|
|
1132
|
+
} catch (error2) {
|
|
1133
|
+
setDocIdToS3Url((prev) => ({
|
|
1134
|
+
...prev,
|
|
1135
|
+
[doc_id]: null
|
|
1136
|
+
}));
|
|
1137
|
+
s3UrlFetchFlightRequests.current.delete(doc_id);
|
|
1138
|
+
return null;
|
|
1139
|
+
}
|
|
1140
|
+
})();
|
|
1141
|
+
s3UrlFetchFlightRequests.current.set(doc_id, request);
|
|
1142
|
+
return request;
|
|
1143
|
+
},
|
|
1144
|
+
[docIdToS3Url]
|
|
1145
|
+
);
|
|
1090
1146
|
const acceptOrderQCTermsAndConditions = useCallback(async () => {
|
|
1091
1147
|
if (!order) return;
|
|
1092
1148
|
try {
|
|
@@ -1105,11 +1161,12 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1105
1161
|
setOrder(data.order);
|
|
1106
1162
|
}
|
|
1107
1163
|
if (data.applications && data.applications.length > 0) {
|
|
1108
|
-
const applicants2 = createApplicantsFromApplications(
|
|
1109
|
-
|
|
1110
|
-
|
|
1164
|
+
const applicants2 = createApplicantsFromApplications(data.applications, questionnaire);
|
|
1165
|
+
const { updatedQuestionnaire, updatedApplicants } = runApplicantSideEffects(
|
|
1166
|
+
applicants2,
|
|
1167
|
+
questionnaire,
|
|
1168
|
+
dynamicQuestionMap
|
|
1111
1169
|
);
|
|
1112
|
-
const { updatedQuestionnaire, updatedApplicants } = runApplicantSideEffects(applicants2, questionnaire, dynamicQuestionMap);
|
|
1113
1170
|
setQuestionnaire(updatedQuestionnaire);
|
|
1114
1171
|
setApplicants(updatedApplicants);
|
|
1115
1172
|
const applicantIds = Object.keys(updatedApplicants);
|
|
@@ -1127,36 +1184,39 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1127
1184
|
setError("Failed to run all validations");
|
|
1128
1185
|
}
|
|
1129
1186
|
}, [orderId, questionnaire, dynamicQuestionMap, activeApplicant]);
|
|
1130
|
-
const runApplicantValidationsHandler = useCallback(
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1187
|
+
const runApplicantValidationsHandler = useCallback(
|
|
1188
|
+
async (applicationId) => {
|
|
1189
|
+
if (!orderId || !questionnaire) return;
|
|
1190
|
+
try {
|
|
1191
|
+
setError(null);
|
|
1192
|
+
const { data } = await runApplicantValidations(applicationId);
|
|
1193
|
+
if (data.application) {
|
|
1194
|
+
const applicant = createApplicantData(
|
|
1195
|
+
data.application.traveller,
|
|
1196
|
+
data.application.answers,
|
|
1197
|
+
questionnaire,
|
|
1198
|
+
data.application.application
|
|
1199
|
+
);
|
|
1200
|
+
if (applicant) {
|
|
1201
|
+
setApplicants((prev) => {
|
|
1202
|
+
const updatedApplicants = {
|
|
1203
|
+
...prev,
|
|
1204
|
+
[applicationId]: applicant
|
|
1205
|
+
};
|
|
1206
|
+
const { updatedQuestionnaire, updatedApplicants: applicantsWithSideEffects } = runApplicantSideEffects(updatedApplicants, questionnaire, dynamicQuestionMap);
|
|
1207
|
+
setQuestionnaire(updatedQuestionnaire);
|
|
1208
|
+
return applicantsWithSideEffects;
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1152
1211
|
}
|
|
1212
|
+
setSuccess("Applicant validations completed successfully");
|
|
1213
|
+
} catch (err) {
|
|
1214
|
+
console.error("Failed to run applicant validations:", err);
|
|
1215
|
+
setError("Failed to run applicant validations");
|
|
1153
1216
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
setError("Failed to run applicant validations");
|
|
1158
|
-
}
|
|
1159
|
-
}, [orderId, questionnaire, dynamicQuestionMap]);
|
|
1217
|
+
},
|
|
1218
|
+
[orderId, questionnaire, dynamicQuestionMap]
|
|
1219
|
+
);
|
|
1160
1220
|
useEffect(() => {
|
|
1161
1221
|
if (!orderId) return;
|
|
1162
1222
|
const initialize = async () => {
|
|
@@ -1169,12 +1229,13 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1169
1229
|
fetchApplicantsForOrder()
|
|
1170
1230
|
]);
|
|
1171
1231
|
if (orderData && questionnaireData && applications) {
|
|
1172
|
-
const applicants2 = createApplicantsFromApplications(
|
|
1173
|
-
applications,
|
|
1174
|
-
questionnaireData
|
|
1175
|
-
);
|
|
1232
|
+
const applicants2 = createApplicantsFromApplications(applications, questionnaireData);
|
|
1176
1233
|
const dynamicMap = buildDynamicQuestionMap(questionnaireData);
|
|
1177
|
-
const { updatedQuestionnaire, updatedApplicants } = runApplicantSideEffects(
|
|
1234
|
+
const { updatedQuestionnaire, updatedApplicants } = runApplicantSideEffects(
|
|
1235
|
+
applicants2,
|
|
1236
|
+
questionnaireData,
|
|
1237
|
+
dynamicMap
|
|
1238
|
+
);
|
|
1178
1239
|
setQuestionnaire(updatedQuestionnaire);
|
|
1179
1240
|
setApplicants(updatedApplicants);
|
|
1180
1241
|
const ids = Object.keys(updatedApplicants);
|
|
@@ -1201,6 +1262,7 @@ var EDCFlowProvider = ({ children, orderId }) => {
|
|
|
1201
1262
|
loading,
|
|
1202
1263
|
error,
|
|
1203
1264
|
success,
|
|
1265
|
+
mode,
|
|
1204
1266
|
addApplicant: addApplicant2,
|
|
1205
1267
|
updateAnswer: updateAnswer2,
|
|
1206
1268
|
deleteApplicant: deleteApplicantById,
|
|
@@ -1721,4 +1783,4 @@ var EDCFlow = {
|
|
|
1721
1783
|
};
|
|
1722
1784
|
var index_default = EDCFlow;
|
|
1723
1785
|
|
|
1724
|
-
export { ANSWER_SOURCE, APPLICATION_STATUS, APPLICATION_TAGS, AnswerSchema, ApplicationSchema, DOC_TYPES, EDCFlowProvider, FIX_TYPE, INTERNAL_ORDER_TAGS, PROCESSING_BLOCKED_ON_PAYMENT_STATUS, QUESTION_TYPE, QuestionnaireSchema, TA_QC_EXTRACTION_STATUS, TIMELINE_STEP, TimelinePaymentStatus, TravellerSchema, VALIDATION_STATUS, VISA_TYPE_INTERNAL_TAGS, createAllQuestionsWithAnswers, createApplicantData, index_default as default, filterConditionalQuestions, formatAnswerFromResponse, formatTravellerFromResponse, getDisplayableDocuments, getDisplayableQuestions, getFixTypeFromFixableItems, getSignedUrlFromAsset, getValidationErrors, getValidationResult, getVisibleQuestions, initializeEDCFlow, updateApplicantWithAnswer, useEDCFlow, validateAllApplicants, validateApplicant, validateApplicantDocuments, validateApplicantQuestions, validateOrder };
|
|
1786
|
+
export { ANSWER_SOURCE, ANSWER_STATUS, APPLICATION_STATUS, APPLICATION_TAGS, ASSET_STATUS, AnswerSchema, ApplicationSchema, DOC_TYPES, EDCFlowProvider, EDCFormMode, FIX_TYPE, INTERNAL_ORDER_TAGS, PROCESSING_BLOCKED_ON_PAYMENT_STATUS, QUESTION_TYPE, QuestionnaireSchema, TA_QC_EXTRACTION_STATUS, TIMELINE_STEP, TimelinePaymentStatus, TravellerSchema, VALIDATION_STATUS, VISA_TYPE_INTERNAL_TAGS, createAllQuestionsWithAnswers, createApplicantData, index_default as default, filterConditionalQuestions, formatAnswerFromResponse, formatTravellerFromResponse, getDisplayableDocuments, getDisplayableQuestions, getFixTypeFromFixableItems, getQuestionRenderInfo, getSignedUrlFromAsset, getValidationErrors, getValidationResult, getVisibleQuestions, initializeEDCFlow, updateApplicantWithAnswer, useEDCFlow, validateAllApplicants, validateApplicant, validateApplicantDocuments, validateApplicantQuestions, validateOrder };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smvtech/x-flux",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.18",
|
|
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",
|