@smvtech/x-flux 1.0.3 → 1.0.4

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
@@ -28,6 +28,25 @@ declare enum APPLICATION_TAGS {
28
28
  DRAFTED_APPLICATION = "DRAFTED_APPLICATION",
29
29
  DUPLICATE_TRAVELLER = "DUPLICATE_TRAVELLER"
30
30
  }
31
+ declare enum ANSWER_SOURCE {
32
+ USER_INPUT = "USER_INPUT",
33
+ DOCUMENT = "DOCUMENT",
34
+ VISA_EXPERT = "VISA_EXPERT",
35
+ PASSPORT_FRONT_OCR = "PASSPORT_FRONT_OCR",
36
+ FLIGHT_TICKET_OCR = "FLIGHT_TICKET_OCR",
37
+ PASSPORT_BACK_OCR = "PASSPORT_BACK_OCR",
38
+ KNOWN = "KNOWN",
39
+ DEFAULT = "DEFAULT"
40
+ }
41
+ declare enum QUESTION_TYPE {
42
+ MULTIPLE_CHOICE = "MULTIPLE_CHOICE",
43
+ SINGLE_CHOICE = "SINGLE_CHOICE",
44
+ DOCUMENT = "DOCUMENT",
45
+ TEXT = "TEXT",
46
+ CALENDAR = "CALENDAR",
47
+ TEXTAREA = "TEXTAREA",
48
+ DROPDOWN = "DROPDOWN"
49
+ }
31
50
  declare enum TA_QC_EXTRACTION_STATUS {
32
51
  SUCCESS = "SUCCESS",
33
52
  FAIL = "FAIL",
@@ -46,14 +65,14 @@ declare const QuestionnaireSchema: z.ZodObject<{
46
65
  }>, "many">;
47
66
  questionMap: z.ZodRecord<z.ZodString, z.ZodObject<{
48
67
  category: z.ZodString;
49
- answer_source: z.ZodString;
68
+ answer_source: z.ZodNativeEnum<typeof ANSWER_SOURCE>;
50
69
  isApplicationSpecific: z.ZodBoolean;
51
70
  question: z.ZodString;
52
71
  subType: z.ZodString;
53
72
  options: z.ZodArray<z.ZodString, "many">;
54
73
  is_required: z.ZodBoolean;
55
74
  is_root: z.ZodBoolean;
56
- type: z.ZodEnum<["CALENDAR", "DOCUMENT", "DROPDOWN", "SINGLE_CHOICE", "TEXT", "TEXTAREA"]>;
75
+ type: z.ZodNativeEnum<typeof QUESTION_TYPE>;
57
76
  renders: z.ZodArray<z.ZodObject<{
58
77
  operation: z.ZodString;
59
78
  value: z.ZodString;
@@ -69,9 +88,9 @@ declare const QuestionnaireSchema: z.ZodObject<{
69
88
  }>, "many">;
70
89
  }, "strip", z.ZodTypeAny, {
71
90
  options: string[];
72
- type: "CALENDAR" | "DOCUMENT" | "DROPDOWN" | "SINGLE_CHOICE" | "TEXT" | "TEXTAREA";
91
+ type: QUESTION_TYPE;
73
92
  category: string;
74
- answer_source: string;
93
+ answer_source: ANSWER_SOURCE;
75
94
  isApplicationSpecific: boolean;
76
95
  question: string;
77
96
  subType: string;
@@ -84,9 +103,9 @@ declare const QuestionnaireSchema: z.ZodObject<{
84
103
  }[];
85
104
  }, {
86
105
  options: string[];
87
- type: "CALENDAR" | "DOCUMENT" | "DROPDOWN" | "SINGLE_CHOICE" | "TEXT" | "TEXTAREA";
106
+ type: QUESTION_TYPE;
88
107
  category: string;
89
- answer_source: string;
108
+ answer_source: ANSWER_SOURCE;
90
109
  isApplicationSpecific: boolean;
91
110
  question: string;
92
111
  subType: string;
@@ -105,9 +124,9 @@ declare const QuestionnaireSchema: z.ZodObject<{
105
124
  }[];
106
125
  questionMap: Record<string, {
107
126
  options: string[];
108
- type: "CALENDAR" | "DOCUMENT" | "DROPDOWN" | "SINGLE_CHOICE" | "TEXT" | "TEXTAREA";
127
+ type: QUESTION_TYPE;
109
128
  category: string;
110
- answer_source: string;
129
+ answer_source: ANSWER_SOURCE;
111
130
  isApplicationSpecific: boolean;
112
131
  question: string;
113
132
  subType: string;
@@ -126,9 +145,9 @@ declare const QuestionnaireSchema: z.ZodObject<{
126
145
  }[];
127
146
  questionMap: Record<string, {
128
147
  options: string[];
129
- type: "CALENDAR" | "DOCUMENT" | "DROPDOWN" | "SINGLE_CHOICE" | "TEXT" | "TEXTAREA";
148
+ type: QUESTION_TYPE;
130
149
  category: string;
131
- answer_source: string;
150
+ answer_source: ANSWER_SOURCE;
132
151
  isApplicationSpecific: boolean;
133
152
  question: string;
134
153
  subType: string;
@@ -5227,7 +5246,7 @@ type TEDCFlowContext = {
5227
5246
  refreshApplicant: (application_id: string) => Promise<void>;
5228
5247
  addApplicant: (payload: TAddTravellerPayload) => Promise<TEDCApplicant | null>;
5229
5248
  deleteApplicant: (application_id: string) => Promise<void>;
5230
- updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5249
+ updateAnswer: (application_id: string, question_type: QUESTION_TYPE, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5231
5250
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5232
5251
  acceptOrderQCTermsAndConditions: () => Promise<void>;
5233
5252
  };
@@ -5268,7 +5287,7 @@ declare const EDCFlow: {
5268
5287
  refreshApplicant: (application_id: string) => Promise<void>;
5269
5288
  addApplicant: (payload: TAddTravellerPayload) => Promise<TEDCApplicant | null>;
5270
5289
  deleteApplicant: (application_id: string) => Promise<void>;
5271
- updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5290
+ updateAnswer: (application_id: string, question_type: QUESTION_TYPE, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5272
5291
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5273
5292
  acceptOrderQCTermsAndConditions: () => Promise<void>;
5274
5293
  };
package/dist/index.d.ts CHANGED
@@ -28,6 +28,25 @@ declare enum APPLICATION_TAGS {
28
28
  DRAFTED_APPLICATION = "DRAFTED_APPLICATION",
29
29
  DUPLICATE_TRAVELLER = "DUPLICATE_TRAVELLER"
30
30
  }
31
+ declare enum ANSWER_SOURCE {
32
+ USER_INPUT = "USER_INPUT",
33
+ DOCUMENT = "DOCUMENT",
34
+ VISA_EXPERT = "VISA_EXPERT",
35
+ PASSPORT_FRONT_OCR = "PASSPORT_FRONT_OCR",
36
+ FLIGHT_TICKET_OCR = "FLIGHT_TICKET_OCR",
37
+ PASSPORT_BACK_OCR = "PASSPORT_BACK_OCR",
38
+ KNOWN = "KNOWN",
39
+ DEFAULT = "DEFAULT"
40
+ }
41
+ declare enum QUESTION_TYPE {
42
+ MULTIPLE_CHOICE = "MULTIPLE_CHOICE",
43
+ SINGLE_CHOICE = "SINGLE_CHOICE",
44
+ DOCUMENT = "DOCUMENT",
45
+ TEXT = "TEXT",
46
+ CALENDAR = "CALENDAR",
47
+ TEXTAREA = "TEXTAREA",
48
+ DROPDOWN = "DROPDOWN"
49
+ }
31
50
  declare enum TA_QC_EXTRACTION_STATUS {
32
51
  SUCCESS = "SUCCESS",
33
52
  FAIL = "FAIL",
@@ -46,14 +65,14 @@ declare const QuestionnaireSchema: z.ZodObject<{
46
65
  }>, "many">;
47
66
  questionMap: z.ZodRecord<z.ZodString, z.ZodObject<{
48
67
  category: z.ZodString;
49
- answer_source: z.ZodString;
68
+ answer_source: z.ZodNativeEnum<typeof ANSWER_SOURCE>;
50
69
  isApplicationSpecific: z.ZodBoolean;
51
70
  question: z.ZodString;
52
71
  subType: z.ZodString;
53
72
  options: z.ZodArray<z.ZodString, "many">;
54
73
  is_required: z.ZodBoolean;
55
74
  is_root: z.ZodBoolean;
56
- type: z.ZodEnum<["CALENDAR", "DOCUMENT", "DROPDOWN", "SINGLE_CHOICE", "TEXT", "TEXTAREA"]>;
75
+ type: z.ZodNativeEnum<typeof QUESTION_TYPE>;
57
76
  renders: z.ZodArray<z.ZodObject<{
58
77
  operation: z.ZodString;
59
78
  value: z.ZodString;
@@ -69,9 +88,9 @@ declare const QuestionnaireSchema: z.ZodObject<{
69
88
  }>, "many">;
70
89
  }, "strip", z.ZodTypeAny, {
71
90
  options: string[];
72
- type: "CALENDAR" | "DOCUMENT" | "DROPDOWN" | "SINGLE_CHOICE" | "TEXT" | "TEXTAREA";
91
+ type: QUESTION_TYPE;
73
92
  category: string;
74
- answer_source: string;
93
+ answer_source: ANSWER_SOURCE;
75
94
  isApplicationSpecific: boolean;
76
95
  question: string;
77
96
  subType: string;
@@ -84,9 +103,9 @@ declare const QuestionnaireSchema: z.ZodObject<{
84
103
  }[];
85
104
  }, {
86
105
  options: string[];
87
- type: "CALENDAR" | "DOCUMENT" | "DROPDOWN" | "SINGLE_CHOICE" | "TEXT" | "TEXTAREA";
106
+ type: QUESTION_TYPE;
88
107
  category: string;
89
- answer_source: string;
108
+ answer_source: ANSWER_SOURCE;
90
109
  isApplicationSpecific: boolean;
91
110
  question: string;
92
111
  subType: string;
@@ -105,9 +124,9 @@ declare const QuestionnaireSchema: z.ZodObject<{
105
124
  }[];
106
125
  questionMap: Record<string, {
107
126
  options: string[];
108
- type: "CALENDAR" | "DOCUMENT" | "DROPDOWN" | "SINGLE_CHOICE" | "TEXT" | "TEXTAREA";
127
+ type: QUESTION_TYPE;
109
128
  category: string;
110
- answer_source: string;
129
+ answer_source: ANSWER_SOURCE;
111
130
  isApplicationSpecific: boolean;
112
131
  question: string;
113
132
  subType: string;
@@ -126,9 +145,9 @@ declare const QuestionnaireSchema: z.ZodObject<{
126
145
  }[];
127
146
  questionMap: Record<string, {
128
147
  options: string[];
129
- type: "CALENDAR" | "DOCUMENT" | "DROPDOWN" | "SINGLE_CHOICE" | "TEXT" | "TEXTAREA";
148
+ type: QUESTION_TYPE;
130
149
  category: string;
131
- answer_source: string;
150
+ answer_source: ANSWER_SOURCE;
132
151
  isApplicationSpecific: boolean;
133
152
  question: string;
134
153
  subType: string;
@@ -5227,7 +5246,7 @@ type TEDCFlowContext = {
5227
5246
  refreshApplicant: (application_id: string) => Promise<void>;
5228
5247
  addApplicant: (payload: TAddTravellerPayload) => Promise<TEDCApplicant | null>;
5229
5248
  deleteApplicant: (application_id: string) => Promise<void>;
5230
- updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5249
+ updateAnswer: (application_id: string, question_type: QUESTION_TYPE, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5231
5250
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5232
5251
  acceptOrderQCTermsAndConditions: () => Promise<void>;
5233
5252
  };
@@ -5268,7 +5287,7 @@ declare const EDCFlow: {
5268
5287
  refreshApplicant: (application_id: string) => Promise<void>;
5269
5288
  addApplicant: (payload: TAddTravellerPayload) => Promise<TEDCApplicant | null>;
5270
5289
  deleteApplicant: (application_id: string) => Promise<void>;
5271
- updateAnswer: (application_id: string, question_type: string, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5290
+ updateAnswer: (application_id: string, question_type: QUESTION_TYPE, question: string, data: TUpdateAnswerPayload, onProgress?: (event: TUploadProgressEvent) => void) => Promise<void>;
5272
5291
  getS3UrlForAsset: (doc_id: string) => Promise<string | null>;
5273
5292
  acceptOrderQCTermsAndConditions: () => Promise<void>;
5274
5293
  };
package/dist/index.js CHANGED
@@ -78,6 +78,27 @@ var APPLICATION_TAGS = /* @__PURE__ */ ((APPLICATION_TAGS2) => {
78
78
  APPLICATION_TAGS2["DUPLICATE_TRAVELLER"] = "DUPLICATE_TRAVELLER";
79
79
  return APPLICATION_TAGS2;
80
80
  })(APPLICATION_TAGS || {});
81
+ var ANSWER_SOURCE = /* @__PURE__ */ ((ANSWER_SOURCE2) => {
82
+ ANSWER_SOURCE2["USER_INPUT"] = "USER_INPUT";
83
+ ANSWER_SOURCE2["DOCUMENT"] = "DOCUMENT";
84
+ ANSWER_SOURCE2["VISA_EXPERT"] = "VISA_EXPERT";
85
+ ANSWER_SOURCE2["PASSPORT_FRONT_OCR"] = "PASSPORT_FRONT_OCR";
86
+ ANSWER_SOURCE2["FLIGHT_TICKET_OCR"] = "FLIGHT_TICKET_OCR";
87
+ ANSWER_SOURCE2["PASSPORT_BACK_OCR"] = "PASSPORT_BACK_OCR";
88
+ ANSWER_SOURCE2["KNOWN"] = "KNOWN";
89
+ ANSWER_SOURCE2["DEFAULT"] = "DEFAULT";
90
+ return ANSWER_SOURCE2;
91
+ })(ANSWER_SOURCE || {});
92
+ var QUESTION_TYPE = /* @__PURE__ */ ((QUESTION_TYPE2) => {
93
+ QUESTION_TYPE2["MULTIPLE_CHOICE"] = "MULTIPLE_CHOICE";
94
+ QUESTION_TYPE2["SINGLE_CHOICE"] = "SINGLE_CHOICE";
95
+ QUESTION_TYPE2["DOCUMENT"] = "DOCUMENT";
96
+ QUESTION_TYPE2["TEXT"] = "TEXT";
97
+ QUESTION_TYPE2["CALENDAR"] = "CALENDAR";
98
+ QUESTION_TYPE2["TEXTAREA"] = "TEXTAREA";
99
+ QUESTION_TYPE2["DROPDOWN"] = "DROPDOWN";
100
+ return QUESTION_TYPE2;
101
+ })(QUESTION_TYPE || {});
81
102
  var TA_QC_EXTRACTION_STATUS = /* @__PURE__ */ ((TA_QC_EXTRACTION_STATUS2) => {
82
103
  TA_QC_EXTRACTION_STATUS2["SUCCESS"] = "SUCCESS";
83
104
  TA_QC_EXTRACTION_STATUS2["FAIL"] = "FAIL";
@@ -89,14 +110,14 @@ var QuestionnaireSchema = z2__namespace.object({
89
110
  questionMap: z2__namespace.record(
90
111
  z2__namespace.object({
91
112
  category: z2__namespace.string(),
92
- answer_source: z2__namespace.string(),
113
+ answer_source: z2__namespace.nativeEnum(ANSWER_SOURCE),
93
114
  isApplicationSpecific: z2__namespace.boolean(),
94
115
  question: z2__namespace.string(),
95
116
  subType: z2__namespace.string(),
96
117
  options: z2__namespace.array(z2__namespace.string()),
97
118
  is_required: z2__namespace.boolean(),
98
119
  is_root: z2__namespace.boolean(),
99
- type: z2__namespace.enum(["CALENDAR", "DOCUMENT", "DROPDOWN", "SINGLE_CHOICE", "TEXT", "TEXTAREA"]),
120
+ type: z2__namespace.nativeEnum(QUESTION_TYPE),
100
121
  renders: z2__namespace.array(
101
122
  z2__namespace.object({
102
123
  operation: z2__namespace.string(),
@@ -156,7 +177,7 @@ var AnswerSchema = z2__namespace.object({
156
177
  status: z2__namespace.enum(["ANSWERED", "APPROVED", "REJECTED", "DELETED"])
157
178
  })
158
179
  ),
159
- answer: z2__namespace.string().array(),
180
+ answer: z2__namespace.array(z2__namespace.string()),
160
181
  issue_reason: z2__namespace.string().nullable(),
161
182
  status: z2__namespace.enum(["ANSWERED", "APPROVED", "REJECTED", "NA", "UNSTARTED", "PENDING"]),
162
183
  is_deleted: z2__namespace.boolean(),
@@ -718,7 +739,7 @@ var EDCFlowProvider = ({ children, orderId }) => {
718
739
  [updatedAnswerData.docId]: updatedAnswerData.signedUrl
719
740
  }));
720
741
  }
721
- if (question_type === "DOCUMENT") {
742
+ if (question_type === "DOCUMENT" /* DOCUMENT */) {
722
743
  await refreshApplicant(application_id);
723
744
  } else {
724
745
  const shouldRecalculateSideEffects = question.toLowerCase().includes("birth");
package/dist/index.mjs CHANGED
@@ -52,6 +52,27 @@ var APPLICATION_TAGS = /* @__PURE__ */ ((APPLICATION_TAGS2) => {
52
52
  APPLICATION_TAGS2["DUPLICATE_TRAVELLER"] = "DUPLICATE_TRAVELLER";
53
53
  return APPLICATION_TAGS2;
54
54
  })(APPLICATION_TAGS || {});
55
+ var ANSWER_SOURCE = /* @__PURE__ */ ((ANSWER_SOURCE2) => {
56
+ ANSWER_SOURCE2["USER_INPUT"] = "USER_INPUT";
57
+ ANSWER_SOURCE2["DOCUMENT"] = "DOCUMENT";
58
+ ANSWER_SOURCE2["VISA_EXPERT"] = "VISA_EXPERT";
59
+ ANSWER_SOURCE2["PASSPORT_FRONT_OCR"] = "PASSPORT_FRONT_OCR";
60
+ ANSWER_SOURCE2["FLIGHT_TICKET_OCR"] = "FLIGHT_TICKET_OCR";
61
+ ANSWER_SOURCE2["PASSPORT_BACK_OCR"] = "PASSPORT_BACK_OCR";
62
+ ANSWER_SOURCE2["KNOWN"] = "KNOWN";
63
+ ANSWER_SOURCE2["DEFAULT"] = "DEFAULT";
64
+ return ANSWER_SOURCE2;
65
+ })(ANSWER_SOURCE || {});
66
+ var QUESTION_TYPE = /* @__PURE__ */ ((QUESTION_TYPE2) => {
67
+ QUESTION_TYPE2["MULTIPLE_CHOICE"] = "MULTIPLE_CHOICE";
68
+ QUESTION_TYPE2["SINGLE_CHOICE"] = "SINGLE_CHOICE";
69
+ QUESTION_TYPE2["DOCUMENT"] = "DOCUMENT";
70
+ QUESTION_TYPE2["TEXT"] = "TEXT";
71
+ QUESTION_TYPE2["CALENDAR"] = "CALENDAR";
72
+ QUESTION_TYPE2["TEXTAREA"] = "TEXTAREA";
73
+ QUESTION_TYPE2["DROPDOWN"] = "DROPDOWN";
74
+ return QUESTION_TYPE2;
75
+ })(QUESTION_TYPE || {});
55
76
  var TA_QC_EXTRACTION_STATUS = /* @__PURE__ */ ((TA_QC_EXTRACTION_STATUS2) => {
56
77
  TA_QC_EXTRACTION_STATUS2["SUCCESS"] = "SUCCESS";
57
78
  TA_QC_EXTRACTION_STATUS2["FAIL"] = "FAIL";
@@ -63,14 +84,14 @@ var QuestionnaireSchema = z2.object({
63
84
  questionMap: z2.record(
64
85
  z2.object({
65
86
  category: z2.string(),
66
- answer_source: z2.string(),
87
+ answer_source: z2.nativeEnum(ANSWER_SOURCE),
67
88
  isApplicationSpecific: z2.boolean(),
68
89
  question: z2.string(),
69
90
  subType: z2.string(),
70
91
  options: z2.array(z2.string()),
71
92
  is_required: z2.boolean(),
72
93
  is_root: z2.boolean(),
73
- type: z2.enum(["CALENDAR", "DOCUMENT", "DROPDOWN", "SINGLE_CHOICE", "TEXT", "TEXTAREA"]),
94
+ type: z2.nativeEnum(QUESTION_TYPE),
74
95
  renders: z2.array(
75
96
  z2.object({
76
97
  operation: z2.string(),
@@ -130,7 +151,7 @@ var AnswerSchema = z2.object({
130
151
  status: z2.enum(["ANSWERED", "APPROVED", "REJECTED", "DELETED"])
131
152
  })
132
153
  ),
133
- answer: z2.string().array(),
154
+ answer: z2.array(z2.string()),
134
155
  issue_reason: z2.string().nullable(),
135
156
  status: z2.enum(["ANSWERED", "APPROVED", "REJECTED", "NA", "UNSTARTED", "PENDING"]),
136
157
  is_deleted: z2.boolean(),
@@ -692,7 +713,7 @@ var EDCFlowProvider = ({ children, orderId }) => {
692
713
  [updatedAnswerData.docId]: updatedAnswerData.signedUrl
693
714
  }));
694
715
  }
695
- if (question_type === "DOCUMENT") {
716
+ if (question_type === "DOCUMENT" /* DOCUMENT */) {
696
717
  await refreshApplicant(application_id);
697
718
  } else {
698
719
  const shouldRecalculateSideEffects = question.toLowerCase().includes("birth");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smvtech/x-flux",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
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",