@unvired/turboforms-embed-sdk 1.0.9 → 1.0.11
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/unvired-form-sdk.html +270 -44
- package/dist/unvired-forms-sdk.js +919 -1244
- package/package.json +4 -3
- package/dist/index.d.ts +0 -216
- package/dist/unvired-forms-sdk-flutter.js +0 -65956
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unvired/turboforms-embed-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Reusable vanilla JS form library that works with React, Angular, Ionic, etc.",
|
|
5
5
|
"main": "dist/unvired-forms-sdk.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"dist/"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "node scripts/build.js && node scripts/build-
|
|
13
|
-
"build:
|
|
12
|
+
"build": "node scripts/build.js && node scripts/build-react-native.js",
|
|
13
|
+
"build:web": "node scripts/build.js",
|
|
14
14
|
"build:react-native": "node scripts/build-react-native.js"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"author": "Unvired Inc.",
|
|
26
26
|
"license": "UNLICENSED",
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"compression-webpack-plugin": "^11.1.0",
|
|
28
29
|
"esbuild": "^0.25.5",
|
|
29
30
|
"less": "^4.3.0"
|
|
30
31
|
},
|
package/dist/index.d.ts
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
// TypeScript definitions for unvired-forms-lib
|
|
2
|
-
|
|
3
|
-
export interface FormioLibPath {
|
|
4
|
-
formioPath: string;
|
|
5
|
-
lessFilesPath: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface LoadUnviredFormsOptions {
|
|
9
|
-
nestedFormData?: any[];
|
|
10
|
-
masterData?: any[];
|
|
11
|
-
title?: string;
|
|
12
|
-
description?: string;
|
|
13
|
-
commentsData: any[];
|
|
14
|
-
mode?: "pdf" | "readOnly" | "form" | "render" | "print" | string;
|
|
15
|
-
privateExternal?: string | boolean;
|
|
16
|
-
permission?: "writemultiple" | "writesingle" | "read" | string;
|
|
17
|
-
platform?: "android" | "web" | "ios" | string;
|
|
18
|
-
language?: string;
|
|
19
|
-
translations?: any;
|
|
20
|
-
environmentVariable?: any[];
|
|
21
|
-
themeData?: any;
|
|
22
|
-
userData?: any;
|
|
23
|
-
appData?: any;
|
|
24
|
-
controlData?: any;
|
|
25
|
-
showBackButton?: boolean;
|
|
26
|
-
showMoreButton?: boolean;
|
|
27
|
-
formioLibPath?: string | FormioLibPath;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Event Types
|
|
31
|
-
export const FORM_EVENTS: {
|
|
32
|
-
FORM_RENDER: "FORM_RENDER";
|
|
33
|
-
SAVE: "FORM_SAVE";
|
|
34
|
-
SUBMIT: "FORM_SUBMIT";
|
|
35
|
-
SUBMIT_ERROR: "FORM_SUBMIT_ERROR";
|
|
36
|
-
BACK_NAVIGATION: "FORM_BACK_NAVIGATION";
|
|
37
|
-
ONCHANGE: "FORM_ONCHANGE";
|
|
38
|
-
ACTION: "ACTION";
|
|
39
|
-
GET_ATTACHMENT: "GET_ATTACHMENT";
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// Event Structures
|
|
43
|
-
export interface SuccessEvent {
|
|
44
|
-
type:
|
|
45
|
-
| "FORM_RENDER"
|
|
46
|
-
| "FORM_SAVE"
|
|
47
|
-
| "FORM_SUBMIT"
|
|
48
|
-
| "FORM_BACK_NAVIGATION"
|
|
49
|
-
| "FORM_ONCHANGE"
|
|
50
|
-
| "ACTION"
|
|
51
|
-
| "OPEN_CAMERA"
|
|
52
|
-
| "BARCODE_SCAN"
|
|
53
|
-
| "LOCATION_REQUEST"
|
|
54
|
-
| "GET_ATTACHMENT";
|
|
55
|
-
message: string;
|
|
56
|
-
data: {
|
|
57
|
-
formData?: any;
|
|
58
|
-
templateData?: any;
|
|
59
|
-
completeFlag?: boolean;
|
|
60
|
-
completionPercentage?: number;
|
|
61
|
-
result?: any;
|
|
62
|
-
controlId?: string;
|
|
63
|
-
scannedValue?: string;
|
|
64
|
-
location?: string;
|
|
65
|
-
coordinates?: { lat: number; lng: number };
|
|
66
|
-
fileName?: string;
|
|
67
|
-
missingFiles?: Array<{ fileId: string; field: string }>;
|
|
68
|
-
[key: string]: any;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface ErrorEvent {
|
|
73
|
-
type: "ERROR";
|
|
74
|
-
errorMessage: string;
|
|
75
|
-
data: {
|
|
76
|
-
technicalError?: any;
|
|
77
|
-
reason?: string;
|
|
78
|
-
error?: any;
|
|
79
|
-
formData?: any;
|
|
80
|
-
completeFlag?: boolean;
|
|
81
|
-
completionPercentage?: number;
|
|
82
|
-
[key: string]: any;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export type FormEvent = SuccessEvent | ErrorEvent;
|
|
87
|
-
|
|
88
|
-
// Error Codes Reference
|
|
89
|
-
export const ERROR_CODES: {
|
|
90
|
-
"001": "Invalid formsData JSON";
|
|
91
|
-
"002": "Nested form validation error";
|
|
92
|
-
"003": "Master data validation error";
|
|
93
|
-
"004": "User Data not Provided";
|
|
94
|
-
"005": "Form render error";
|
|
95
|
-
"006": "Form submit error";
|
|
96
|
-
"007": "Form complete error";
|
|
97
|
-
"008": "Location permission denied";
|
|
98
|
-
"009": "Location unavailable";
|
|
99
|
-
"010": "Location request timeout";
|
|
100
|
-
"011": "Location unknown error";
|
|
101
|
-
"012": "Camera access error";
|
|
102
|
-
"013": "Attachments missing from storage";
|
|
103
|
-
"014": "Failed to validate attachments";
|
|
104
|
-
"015": "File not found in IndexedDB during processing";
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// Event Callback Function
|
|
108
|
-
export type EventCallback = (event: FormEvent) => void;
|
|
109
|
-
|
|
110
|
-
// Main Function Interface
|
|
111
|
-
export interface LoadUnviredFormsParams {
|
|
112
|
-
formsData: string | any;
|
|
113
|
-
submissionData?: any;
|
|
114
|
-
eventCallback?: EventCallback;
|
|
115
|
-
container?: HTMLElement;
|
|
116
|
-
options?: LoadUnviredFormsOptions;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface AttachmentInfo {
|
|
120
|
-
id: string;
|
|
121
|
-
name: string;
|
|
122
|
-
originalName: string;
|
|
123
|
-
size: number;
|
|
124
|
-
type: string;
|
|
125
|
-
url: string;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface FormInstance {
|
|
129
|
-
sendAction: (action: any) => void;
|
|
130
|
-
getAttachments?: () => Promise<AttachmentInfo[]>;
|
|
131
|
-
clearAttachments?: () => Promise<boolean>;
|
|
132
|
-
validateAttachments?: (formData: any) => void;
|
|
133
|
-
deleteAttachment?: (fileId: string) => Promise<boolean>;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export function loadUnviredForms(params: LoadUnviredFormsParams): FormInstance;
|
|
137
|
-
|
|
138
|
-
// Events that will be triggered:
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* SUCCESS EVENTS:
|
|
142
|
-
*
|
|
143
|
-
* 1. FORM_RENDER - Form rendered successfully
|
|
144
|
-
* { type: "FORM_RENDER", message: "Success: Form rendered successfully.", data: {} }
|
|
145
|
-
*
|
|
146
|
-
* 2. FORM_ONCHANGE - Form data changed
|
|
147
|
-
* { type: "FORM_ONCHANGE", message: "Success: Form onchange triggered.", data: { formData: submission, templateData: template } }
|
|
148
|
-
*
|
|
149
|
-
* 3. FORM_SUBMIT - Form submitted successfully
|
|
150
|
-
* { type: "FORM_SUBMIT", message: "Success: Form submitted successfully.", data: { formData: currentData, completeFlag, completionPercentage, result } }
|
|
151
|
-
*
|
|
152
|
-
* 4. FORM_SAVE - Form data saved
|
|
153
|
-
* { type: "FORM_SAVE", message: "Success: Data saved successfully.", data: { formData: updatedData, completeFlag, completionPercentage } }
|
|
154
|
-
*
|
|
155
|
-
* 5. FORM_BACK_NAVIGATION - Back navigation triggered
|
|
156
|
-
* { type: "FORM_BACK_NAVIGATION", message: "Back navigation triggered.", data: {} }
|
|
157
|
-
*
|
|
158
|
-
* 6. OPEN_CAMERA - Photo captured successfully
|
|
159
|
-
* { type: "OPEN_CAMERA", message: "Photo captured successfully", data: { controlId: "id", fileName: "photo.jpg" } }
|
|
160
|
-
*
|
|
161
|
-
* 7. BARCODE_SCAN - Barcode scanned successfully
|
|
162
|
-
* { type: "BARCODE_SCAN", message: "Barcode scanned successfully", data: { controlId: "id", scannedValue: "value" } }
|
|
163
|
-
*
|
|
164
|
-
* 8. LOCATION_REQUEST - Location retrieved successfully
|
|
165
|
-
* { type: "LOCATION_REQUEST", message: "Location retrieved successfully", data: { controlId: "id", location: "lat,lng", coordinates: { lat: 0, lng: 0 } } }
|
|
166
|
-
*
|
|
167
|
-
* 9. GET_ATTACHMENT - Request missing attachments from middleware
|
|
168
|
-
* { type: "GET_ATTACHMENT", message: "Requesting missing attachments from middleware", data: { missingFiles: [{fileId: "id", field: "fieldName"}] } }
|
|
169
|
-
*
|
|
170
|
-
* ERROR EVENTS:
|
|
171
|
-
*
|
|
172
|
-
* 1. ERROR Code 001 - Invalid formsData JSON
|
|
173
|
-
* { type: "ERROR", errorMessage: "Error Code 001 contact your admin", data: { error: e } }
|
|
174
|
-
*
|
|
175
|
-
* 2. ERROR Code 002 - Nested form validation error
|
|
176
|
-
* { type: "ERROR", errorMessage: "Error Code 002 contact your admin", data: { technicalError: nestedFormError } }
|
|
177
|
-
*
|
|
178
|
-
* 3. ERROR Code 003 - Master data validation error
|
|
179
|
-
* { type: "ERROR", errorMessage: "Error Code 003 contact your admin", data: { technicalError: masterdataError } }
|
|
180
|
-
*
|
|
181
|
-
* 4. ERROR Code 004 - User Data not Provided
|
|
182
|
-
* { type: "ERROR", errorMessage: "Error Code 004 contact your admin", data: { reason: "User Data not Provided" } }
|
|
183
|
-
*
|
|
184
|
-
* 5. ERROR Code 005 - Form render error
|
|
185
|
-
* { type: "ERROR", errorMessage: "Error Code 005 contact your admin", data: { technicalError: error } }
|
|
186
|
-
*
|
|
187
|
-
* 6. ERROR Code 006 - Form submit error
|
|
188
|
-
* { type: "ERROR", errorMessage: "Error Code 006 contact your admin", data: { formData: currentData, completeFlag, completionPercentage, technicalError: error } }
|
|
189
|
-
*
|
|
190
|
-
* 7. ERROR Code 007 - Form complete error
|
|
191
|
-
* { type: "ERROR", errorMessage: "Error Code 007 contact your admin", data: { formData: currentData, completeFlag, completionPercentage, technicalError: error } }
|
|
192
|
-
*
|
|
193
|
-
* 8. ERROR Code 008 - Location permission denied
|
|
194
|
-
* { type: "ERROR", errorMessage: "Error Code 008 contact your admin", data: { technicalError: error, reason: "Location permission denied" } }
|
|
195
|
-
*
|
|
196
|
-
* 9. ERROR Code 009 - Location unavailable
|
|
197
|
-
* { type: "ERROR", errorMessage: "Error Code 009 contact your admin", data: { technicalError: error, reason: "Location unavailable" } }
|
|
198
|
-
*
|
|
199
|
-
* 10. ERROR Code 010 - Location request timeout
|
|
200
|
-
* { type: "ERROR", errorMessage: "Error Code 010 contact your admin", data: { technicalError: error, reason: "Location timeout" } }
|
|
201
|
-
*
|
|
202
|
-
* 11. ERROR Code 011 - Location unknown error
|
|
203
|
-
* { type: "ERROR", errorMessage: "Error Code 011 contact your admin", data: { technicalError: error, reason: "Location unknown error" } }
|
|
204
|
-
*
|
|
205
|
-
* 12. ERROR Code 012 - Camera access error
|
|
206
|
-
* { type: "ERROR", errorMessage: "Error Code 012 contact your admin", data: { technicalError: error, reason: "Camera access error" } }
|
|
207
|
-
*
|
|
208
|
-
* 13. ERROR Code 013 - Attachments missing from storage
|
|
209
|
-
* { type: "ERROR", errorMessage: "ErrorCode : 013, contact your admin or tech team", data: { reason: "Some attachments are missing from storage", missingFiles: [] } }
|
|
210
|
-
*
|
|
211
|
-
* 14. ERROR Code 014 - Failed to validate attachments
|
|
212
|
-
* { type: "ERROR", errorMessage: "ErrorCode : 014, contact your admin or tech team", data: { reason: "Failed to validate attachments", technicalError: error } }
|
|
213
|
-
*
|
|
214
|
-
* 15. ERROR Code 015 - File not found in IndexedDB during processing
|
|
215
|
-
* { type: "ERROR", errorMessage: "ErrorCode : 015, contact your admin or tech team", data: { reason: "File not found in IndexedDB: fileId", fileId: "id", field: "fieldName" } }
|
|
216
|
-
*/
|