@betterinternship/core 2.35.0 → 3.0.0
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.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/auth/db.d.ts +1 -1
- package/dist/lib/auth/db.js +1 -1
- package/dist/lib/auth/db.js.map +1 -1
- package/dist/lib/auth/events.d.ts +2 -2
- package/dist/lib/auth/limits.d.ts +3 -3
- package/dist/lib/auth/limits.js.map +1 -1
- package/dist/lib/email/archive.js +2 -2
- package/dist/lib/email/archive.js.map +1 -1
- package/dist/lib/email/email.js +4 -4
- package/dist/lib/email/email.js.map +1 -1
- package/dist/lib/pdf-viewer/BasePdfViewer.d.ts +4 -2
- package/dist/lib/pdf-viewer/BasePdfViewer.js +203 -5
- package/dist/lib/pdf-viewer/BasePdfViewer.js.map +1 -1
- package/dist/lib/pdf-viewer/index.d.ts +0 -5
- package/dist/lib/pdf-viewer/index.js +0 -5
- package/dist/lib/pdf-viewer/index.js.map +1 -1
- package/dist/lib/pdf-viewer/use-pdf-page-renderer.js +38 -11
- package/dist/lib/pdf-viewer/use-pdf-page-renderer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +88 -92
- package/dist/lib/forms/constants/fonts.d.ts +0 -131
- package/dist/lib/forms/constants/fonts.js +0 -55
- package/dist/lib/forms/constants/fonts.js.map +0 -1
- package/dist/lib/forms/constants/form.d.ts +0 -2
- package/dist/lib/forms/constants/form.js +0 -18
- package/dist/lib/forms/constants/form.js.map +0 -1
- package/dist/lib/forms/constants/index.d.ts +0 -2
- package/dist/lib/forms/constants/index.js +0 -3
- package/dist/lib/forms/constants/index.js.map +0 -1
- package/dist/lib/forms/field-preset-templates.d.ts +0 -23
- package/dist/lib/forms/field-preset-templates.js +0 -266
- package/dist/lib/forms/field-preset-templates.js.map +0 -1
- package/dist/lib/forms/fields.client.d.ts +0 -31
- package/dist/lib/forms/fields.client.js +0 -24
- package/dist/lib/forms/fields.client.js.map +0 -1
- package/dist/lib/forms/fields.server.d.ts +0 -16
- package/dist/lib/forms/fields.server.js +0 -2
- package/dist/lib/forms/fields.server.js.map +0 -1
- package/dist/lib/forms/form-metadata.d.ts +0 -142
- package/dist/lib/forms/form-metadata.js +0 -346
- package/dist/lib/forms/form-metadata.js.map +0 -1
- package/dist/lib/forms/index.d.ts +0 -9
- package/dist/lib/forms/index.js +0 -10
- package/dist/lib/forms/index.js.map +0 -1
- package/dist/lib/forms/recipient-email.d.ts +0 -7
- package/dist/lib/forms/recipient-email.js +0 -37
- package/dist/lib/forms/recipient-email.js.map +0 -1
- package/dist/lib/forms/signature-image.d.ts +0 -37
- package/dist/lib/forms/signature-image.js +0 -114
- package/dist/lib/forms/signature-image.js.map +0 -1
- package/dist/lib/forms/validator-ir.d.ts +0 -203
- package/dist/lib/forms/validator-ir.js +0 -2
- package/dist/lib/forms/validator-ir.js.map +0 -1
- package/dist/lib/pdf-viewer/FormFillPdfViewer.d.ts +0 -31
- package/dist/lib/pdf-viewer/FormFillPdfViewer.js +0 -107
- package/dist/lib/pdf-viewer/FormFillPdfViewer.js.map +0 -1
- package/dist/lib/pdf-viewer/PdfPageOverlay.d.ts +0 -18
- package/dist/lib/pdf-viewer/PdfPageOverlay.js +0 -236
- package/dist/lib/pdf-viewer/PdfPageOverlay.js.map +0 -1
- package/dist/lib/pdf-viewer/form-previewer-model.d.ts +0 -52
- package/dist/lib/pdf-viewer/form-previewer-model.js +0 -329
- package/dist/lib/pdf-viewer/form-previewer-model.js.map +0 -1
- package/dist/lib/pdf-viewer/form-previewer-rendering.d.ts +0 -55
- package/dist/lib/pdf-viewer/form-previewer-rendering.js +0 -317
- package/dist/lib/pdf-viewer/form-previewer-rendering.js.map +0 -1
- package/dist/lib/pdf-viewer/party-colors.d.ts +0 -22
- package/dist/lib/pdf-viewer/party-colors.js +0 -20
- package/dist/lib/pdf-viewer/party-colors.js.map +0 -1
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
const TEXT_PREPROCESS = `z.preprocess((v) => ((v ?? null) == null ? "" : (typeof v === "string" ? v.trim() : v)), `;
|
|
2
|
-
const SHORT_TEXT_VALIDATOR = `${TEXT_PREPROCESS}z.string())`;
|
|
3
|
-
const NAME_VALIDATOR = `${TEXT_PREPROCESS}z.string().min(1, { message: "This field is required." }).max(100).regex(/^(?!.*[\\p{Extended_Pictographic}\\uFE0F])(?!.*[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\u007F])(?!.*[\\u202A-\\u202E\\u2066-\\u2069])[\\p{L}\\p{M}\\p{Pc}\\p{Pd}\\p{Ps}\\p{Pe}\\p{Pi}\\p{Pf}\\p{Po}\\p{Zs}\\n\\r\\t]+$/u, "This field accepts letters, spaces, and common punctuation only. No numbers or emojis.").refine(s => s.replace(/\\p{L}+/gu, w => w[0].toLocaleUpperCase() + w.slice(1).toLocaleLowerCase()) === s, "Please write in title case (capitalize the first letter of each word)."))`;
|
|
4
|
-
const LONG_TEXT_VALIDATOR = `${TEXT_PREPROCESS}z.string().describe("textarea"))`;
|
|
5
|
-
const NUMBER_VALIDATOR = 'z.number()';
|
|
6
|
-
const SIGNATURE_VALIDATOR = `${TEXT_PREPROCESS}z.string().nonempty({ message: "This field is required." }))`;
|
|
7
|
-
const DROPDOWN_VALIDATOR = `z.enum(["Option 1", "Option 2"], {message:"This field is required."})`;
|
|
8
|
-
const MULTISELECT_VALIDATOR = `z.array(
|
|
9
|
-
z.enum(
|
|
10
|
-
[
|
|
11
|
-
"Option 1",
|
|
12
|
-
"Option 2"
|
|
13
|
-
],
|
|
14
|
-
{ message: "This field is required." }
|
|
15
|
-
)
|
|
16
|
-
).describe("multiselect")`;
|
|
17
|
-
const DATE_VALIDATOR = 'z.coerce.date()';
|
|
18
|
-
const TIME_VALIDATOR = 'z.string().describe("time")';
|
|
19
|
-
const EMAIL_VALIDATOR = `${TEXT_PREPROCESS}z.string().email())`;
|
|
20
|
-
const URL_VALIDATOR = `${TEXT_PREPROCESS}z.string().url())`;
|
|
21
|
-
const PHONE_NUMBER_VALIDATOR = `${TEXT_PREPROCESS}z.string().regex(/^\\+?[0-9()\\-\\s]{7,20}$/, { message: "Please enter a valid phone number." }).describe("phone"))`;
|
|
22
|
-
const RADIO_VALIDATOR = `z.enum(["X", ""]).describe("radio")`;
|
|
23
|
-
const baseIr = (baseType, rules) => ({
|
|
24
|
-
version: 0,
|
|
25
|
-
baseType,
|
|
26
|
-
rules,
|
|
27
|
-
mode: 'builder',
|
|
28
|
-
importStatus: 'exact',
|
|
29
|
-
});
|
|
30
|
-
export const FIELD_PRESET_TEMPLATES = [
|
|
31
|
-
{
|
|
32
|
-
id: 'preset-short-text',
|
|
33
|
-
name: 'short_text',
|
|
34
|
-
label: 'Short Text',
|
|
35
|
-
iconKey: 'shortText',
|
|
36
|
-
type: 'text',
|
|
37
|
-
group: 'core',
|
|
38
|
-
source: 'manual',
|
|
39
|
-
shared: true,
|
|
40
|
-
tag: 'preset',
|
|
41
|
-
preset: 'preset',
|
|
42
|
-
prefiller: '',
|
|
43
|
-
tooltip_label: '',
|
|
44
|
-
validator: SHORT_TEXT_VALIDATOR,
|
|
45
|
-
validator_ir: baseIr('text', []),
|
|
46
|
-
is_phantom: false,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: 'preset-name',
|
|
50
|
-
name: 'name',
|
|
51
|
-
label: 'Name',
|
|
52
|
-
iconKey: 'shortText',
|
|
53
|
-
type: 'text',
|
|
54
|
-
group: 'core',
|
|
55
|
-
source: 'manual',
|
|
56
|
-
shared: true,
|
|
57
|
-
tag: 'preset',
|
|
58
|
-
preset: 'preset',
|
|
59
|
-
prefiller: '',
|
|
60
|
-
tooltip_label: '',
|
|
61
|
-
validator: NAME_VALIDATOR,
|
|
62
|
-
validator_ir: baseIr('text', [{ kind: 'plainText' }, { kind: 'titleCase' }]),
|
|
63
|
-
is_phantom: false,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: 'preset-long-text',
|
|
67
|
-
name: 'long_text',
|
|
68
|
-
label: 'Long Text',
|
|
69
|
-
iconKey: 'longText',
|
|
70
|
-
type: 'text',
|
|
71
|
-
group: 'core',
|
|
72
|
-
source: 'manual',
|
|
73
|
-
shared: true,
|
|
74
|
-
tag: 'preset',
|
|
75
|
-
preset: 'preset',
|
|
76
|
-
prefiller: '',
|
|
77
|
-
tooltip_label: '',
|
|
78
|
-
validator: LONG_TEXT_VALIDATOR,
|
|
79
|
-
validator_ir: baseIr('textarea', []),
|
|
80
|
-
is_phantom: false,
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
id: 'preset-number',
|
|
84
|
-
name: 'number',
|
|
85
|
-
label: 'Number',
|
|
86
|
-
iconKey: 'number',
|
|
87
|
-
type: 'text',
|
|
88
|
-
group: 'core',
|
|
89
|
-
source: 'manual',
|
|
90
|
-
shared: true,
|
|
91
|
-
tag: 'preset',
|
|
92
|
-
preset: 'preset',
|
|
93
|
-
prefiller: '',
|
|
94
|
-
tooltip_label: '',
|
|
95
|
-
validator: NUMBER_VALIDATOR,
|
|
96
|
-
validator_ir: baseIr('number', []),
|
|
97
|
-
is_phantom: false,
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
id: 'preset-signature',
|
|
101
|
-
name: 'signature',
|
|
102
|
-
label: 'Signature',
|
|
103
|
-
iconKey: 'signature',
|
|
104
|
-
type: 'signature',
|
|
105
|
-
group: 'core',
|
|
106
|
-
source: 'manual',
|
|
107
|
-
shared: true,
|
|
108
|
-
tag: 'preset',
|
|
109
|
-
preset: 'preset',
|
|
110
|
-
prefiller: '',
|
|
111
|
-
tooltip_label: '',
|
|
112
|
-
validator: SIGNATURE_VALIDATOR,
|
|
113
|
-
validator_ir: baseIr('signature', [{ kind: 'required' }]),
|
|
114
|
-
is_phantom: false,
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
id: 'preset-dropdown',
|
|
118
|
-
name: 'dropdown',
|
|
119
|
-
label: 'Dropdown',
|
|
120
|
-
iconKey: 'dropdown',
|
|
121
|
-
type: 'text',
|
|
122
|
-
group: 'core',
|
|
123
|
-
source: 'manual',
|
|
124
|
-
shared: true,
|
|
125
|
-
tag: 'preset',
|
|
126
|
-
preset: 'preset',
|
|
127
|
-
prefiller: '',
|
|
128
|
-
tooltip_label: '',
|
|
129
|
-
validator: DROPDOWN_VALIDATOR,
|
|
130
|
-
validator_ir: baseIr('enum', [{ kind: 'enum', options: ['Option 1', 'Option 2'] }]),
|
|
131
|
-
is_phantom: false,
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
id: 'preset-multiselect',
|
|
135
|
-
name: 'multiselect',
|
|
136
|
-
label: 'Multiselect',
|
|
137
|
-
iconKey: 'multiselect',
|
|
138
|
-
type: 'text',
|
|
139
|
-
group: 'core',
|
|
140
|
-
source: 'manual',
|
|
141
|
-
shared: true,
|
|
142
|
-
tag: 'preset',
|
|
143
|
-
preset: 'preset',
|
|
144
|
-
prefiller: '',
|
|
145
|
-
tooltip_label: '',
|
|
146
|
-
validator: MULTISELECT_VALIDATOR,
|
|
147
|
-
validator_ir: baseIr('array', [{ kind: 'array', options: ['Option 1', 'Option 2'] }]),
|
|
148
|
-
is_phantom: false,
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
id: 'preset-date',
|
|
152
|
-
name: 'date',
|
|
153
|
-
label: 'Date',
|
|
154
|
-
iconKey: 'date',
|
|
155
|
-
type: 'text',
|
|
156
|
-
group: 'core',
|
|
157
|
-
source: 'manual',
|
|
158
|
-
shared: true,
|
|
159
|
-
tag: 'preset',
|
|
160
|
-
preset: 'preset',
|
|
161
|
-
prefiller: '',
|
|
162
|
-
tooltip_label: '',
|
|
163
|
-
validator: DATE_VALIDATOR,
|
|
164
|
-
validator_ir: baseIr('date', []),
|
|
165
|
-
is_phantom: false,
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
id: 'preset-time',
|
|
169
|
-
name: 'time',
|
|
170
|
-
label: 'Time',
|
|
171
|
-
iconKey: 'time',
|
|
172
|
-
type: 'text',
|
|
173
|
-
group: 'core',
|
|
174
|
-
source: 'manual',
|
|
175
|
-
shared: true,
|
|
176
|
-
tag: 'preset',
|
|
177
|
-
preset: 'preset',
|
|
178
|
-
prefiller: '',
|
|
179
|
-
tooltip_label: '',
|
|
180
|
-
validator: TIME_VALIDATOR,
|
|
181
|
-
validator_ir: baseIr('time', []),
|
|
182
|
-
is_phantom: false,
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
id: 'preset-url',
|
|
186
|
-
name: 'url',
|
|
187
|
-
label: 'URL',
|
|
188
|
-
iconKey: 'url',
|
|
189
|
-
type: 'text',
|
|
190
|
-
group: 'format',
|
|
191
|
-
source: 'manual',
|
|
192
|
-
shared: true,
|
|
193
|
-
tag: 'preset',
|
|
194
|
-
preset: 'preset',
|
|
195
|
-
prefiller: '',
|
|
196
|
-
tooltip_label: '',
|
|
197
|
-
validator: URL_VALIDATOR,
|
|
198
|
-
validator_ir: baseIr('url', []),
|
|
199
|
-
is_phantom: false,
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
id: 'preset-phone-number',
|
|
203
|
-
name: 'phone_number',
|
|
204
|
-
label: 'Phone Number',
|
|
205
|
-
iconKey: 'phone',
|
|
206
|
-
type: 'text',
|
|
207
|
-
group: 'format',
|
|
208
|
-
source: 'manual',
|
|
209
|
-
shared: true,
|
|
210
|
-
tag: 'preset',
|
|
211
|
-
preset: 'preset',
|
|
212
|
-
prefiller: '',
|
|
213
|
-
tooltip_label: '',
|
|
214
|
-
validator: PHONE_NUMBER_VALIDATOR,
|
|
215
|
-
validator_ir: baseIr('phone', []),
|
|
216
|
-
is_phantom: false,
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
id: 'preset-email',
|
|
220
|
-
name: 'email',
|
|
221
|
-
label: 'Email',
|
|
222
|
-
iconKey: 'email',
|
|
223
|
-
type: 'text',
|
|
224
|
-
group: 'format',
|
|
225
|
-
source: 'manual',
|
|
226
|
-
shared: true,
|
|
227
|
-
tag: 'preset',
|
|
228
|
-
preset: 'preset',
|
|
229
|
-
prefiller: '',
|
|
230
|
-
tooltip_label: '',
|
|
231
|
-
validator: EMAIL_VALIDATOR,
|
|
232
|
-
validator_ir: baseIr('email', []),
|
|
233
|
-
is_phantom: false,
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
id: 'preset-radio',
|
|
237
|
-
name: 'radio',
|
|
238
|
-
label: 'Radio Option',
|
|
239
|
-
iconKey: 'radio',
|
|
240
|
-
type: 'text',
|
|
241
|
-
group: 'core',
|
|
242
|
-
source: 'manual',
|
|
243
|
-
shared: true,
|
|
244
|
-
tag: 'preset',
|
|
245
|
-
preset: 'preset',
|
|
246
|
-
prefiller: '',
|
|
247
|
-
tooltip_label: '',
|
|
248
|
-
validator: RADIO_VALIDATOR,
|
|
249
|
-
validator_ir: baseIr('radio', []),
|
|
250
|
-
is_phantom: false,
|
|
251
|
-
},
|
|
252
|
-
];
|
|
253
|
-
export function getFieldPresetTemplates() {
|
|
254
|
-
return FIELD_PRESET_TEMPLATES.map((preset) => ({
|
|
255
|
-
...preset,
|
|
256
|
-
validator_ir: preset.validator_ir
|
|
257
|
-
? {
|
|
258
|
-
...preset.validator_ir,
|
|
259
|
-
rules: Array.isArray(preset.validator_ir.rules)
|
|
260
|
-
? preset.validator_ir.rules.map((rule) => ({ ...rule }))
|
|
261
|
-
: [],
|
|
262
|
-
}
|
|
263
|
-
: null,
|
|
264
|
-
}));
|
|
265
|
-
}
|
|
266
|
-
//# sourceMappingURL=field-preset-templates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-preset-templates.js","sourceRoot":"","sources":["../../../lib/forms/field-preset-templates.ts"],"names":[],"mappings":"AAyCA,MAAM,eAAe,GAAG,2FAA2F,CAAC;AACpH,MAAM,oBAAoB,GAAG,GAAG,eAAe,aAAa,CAAC;AAC7D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AAS,EAAE,EAAE;QACb,aAAa,EAAE,EAAE;QACjB,SAAS,EAAE,eAAe;QAC1B,YAAY,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;QACjC,UAAU,EAAE,KAAK;KAClB;CACF,CAAC;AAGF,MAAM,UAAU,uBAAuB;IACrC,OAAO,sBAAsB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC7C,GAAG,MAAM;QACT,YAAY,EAAE,MAAM,CAAC,YAAY;YAC/B,CAAC,CAAC;gBACE,GAAG,MAAM,CAAC,YAAY;gBACtB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC;oBAC7C,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;oBACxD,CAAC,CAAC,EAAE;aACP;YACH,CAAC,CAAC,IAAI;KACT,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ZodType } from 'zod';
|
|
2
|
-
import { BLOCK_TYPES, IFormField, IFormFieldPrefiller, IFormFieldValidator, IFormPhantomField, IFormSigningParty } from './form-metadata.js';
|
|
3
|
-
type EnumValue = string | number;
|
|
4
|
-
export declare const getSchemaClientType: (s: ZodType) => ClientFieldType;
|
|
5
|
-
export type ClientFieldType = 'text' | 'number' | 'date' | 'dropdown' | 'checkbox' | 'textarea' | 'multiselect' | 'time' | 'signature' | 'radio';
|
|
6
|
-
export type ClientField<SourceDomains extends any[]> = Omit<IFormField, 'x' | 'y' | 'w' | 'h' | 'page' | 'type' | 'validator' | 'prefiller' | 'align_h' | 'align_v'> & {
|
|
7
|
-
type: ClientFieldType;
|
|
8
|
-
signing_party_id?: string;
|
|
9
|
-
validator: IFormFieldValidator | null;
|
|
10
|
-
prefiller: IFormFieldPrefiller<SourceDomains> | null;
|
|
11
|
-
options?: EnumValue[];
|
|
12
|
-
coerce: (s: string) => string | number | boolean | Date | Array<string> | undefined;
|
|
13
|
-
};
|
|
14
|
-
export type ClientPhantomField<SourceDomains extends any[]> = Omit<IFormPhantomField, 'type' | 'validator' | 'prefiller'> & {
|
|
15
|
-
type: ClientFieldType;
|
|
16
|
-
signing_party_id?: string;
|
|
17
|
-
validator: IFormFieldValidator | null;
|
|
18
|
-
prefiller: IFormFieldPrefiller<SourceDomains> | null;
|
|
19
|
-
options?: EnumValue[];
|
|
20
|
-
coerce: (s: string) => string | number | boolean | Date | Array<string> | undefined;
|
|
21
|
-
};
|
|
22
|
-
export declare const isFieldRequired: <SourceDomains extends any[]>(field: ClientField<SourceDomains> | ClientPhantomField<SourceDomains>) => boolean;
|
|
23
|
-
export interface ClientBlock<SourceDomains extends any[]> {
|
|
24
|
-
block_type: (typeof BLOCK_TYPES)[number];
|
|
25
|
-
order: number;
|
|
26
|
-
signing_party_id: IFormSigningParty['_id'];
|
|
27
|
-
text_content?: string;
|
|
28
|
-
field_schema?: ClientField<SourceDomains>;
|
|
29
|
-
phantom_field_schema?: ClientPhantomField<SourceDomains>;
|
|
30
|
-
}
|
|
31
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
export const getSchemaClientType = (s) => {
|
|
3
|
-
const infer = s.type;
|
|
4
|
-
const desc = s.description;
|
|
5
|
-
if (desc === 'radio')
|
|
6
|
-
return 'radio';
|
|
7
|
-
if (infer === 'date' || desc === 'date')
|
|
8
|
-
return 'date';
|
|
9
|
-
if (infer === 'number' || desc === 'number')
|
|
10
|
-
return 'number';
|
|
11
|
-
if (infer === 'enum' || desc === 'dropdown')
|
|
12
|
-
return 'dropdown';
|
|
13
|
-
if (infer === 'boolean' || desc === 'checkbox')
|
|
14
|
-
return 'checkbox';
|
|
15
|
-
if (s instanceof z.ZodArray && desc === 'multiselect')
|
|
16
|
-
return 'multiselect';
|
|
17
|
-
if (desc === 'textarea')
|
|
18
|
-
return 'textarea';
|
|
19
|
-
if (desc === 'time')
|
|
20
|
-
return 'time';
|
|
21
|
-
return 'text';
|
|
22
|
-
};
|
|
23
|
-
export const isFieldRequired = (field) => !!field.validator && !field.validator.safeParse(field.coerce('')).success;
|
|
24
|
-
//# sourceMappingURL=fields.client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fields.client.js","sourceRoot":"","sources":["../../../lib/forms/fields.client.ts"],"names":[],"mappings":"AAUA,OAAO,CAAc,MAAM,KAAK,CAAC;AAWjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAU,EAAmB,EAAE;IACjE,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC;IACrB,MAAM,IAAI,GAAG,CAAC,CAAC,WAAW,CAAC;IAC3B,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IACrC,IAAI,KAAK,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACvD,IAAI,KAAK,KAAK,QAAQ,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC7D,IAAI,KAAK,KAAK,MAAM,IAAI,IAAI,KAAK,UAAU;QAAE,OAAO,UAAU,CAAC;IAC/D,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI,KAAK,UAAU;QAAE,OAAO,UAAU,CAAC;IAClE,IAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,IAAI,IAAI,KAAK,aAAa;QAAE,OAAO,aAAa,CAAC;IAC5E,IAAI,IAAI,KAAK,UAAU;QAAE,OAAO,UAAU,CAAC;IAC3C,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACnC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA+CF,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAqE,EACrE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { FontFilename } from './constants/fonts.js';
|
|
2
|
-
export type ServerField = {
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
w: number;
|
|
6
|
-
h: number;
|
|
7
|
-
page: number;
|
|
8
|
-
type: 'text' | 'signature';
|
|
9
|
-
field: string;
|
|
10
|
-
value?: string;
|
|
11
|
-
align_h: 'center' | 'left' | 'right';
|
|
12
|
-
align_v: 'middle' | 'top' | 'bottom';
|
|
13
|
-
size?: number;
|
|
14
|
-
wrap?: boolean;
|
|
15
|
-
font?: FontFilename;
|
|
16
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fields.server.js","sourceRoot":"","sources":["../../../lib/forms/fields.server.ts"],"names":[],"mappings":""}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { ZodType } from 'zod';
|
|
2
|
-
import { ClientBlock, ClientField, ClientPhantomField } from './fields.client.js';
|
|
3
|
-
import { ServerField } from './fields.server.js';
|
|
4
|
-
import { FontName } from './constants/fonts.js';
|
|
5
|
-
import type { ValidatorIRv0 } from './validator-ir.js';
|
|
6
|
-
export type FormValues = Record<string, string>;
|
|
7
|
-
export type FormErrors = Record<string, string>;
|
|
8
|
-
export declare const SCHEMA_VERSION = 1;
|
|
9
|
-
export declare const FIELD_TYPES: string[];
|
|
10
|
-
export declare const BLOCK_TYPES: string[];
|
|
11
|
-
export declare const ALIGN_H: string[];
|
|
12
|
-
export declare const ALIGN_V: string[];
|
|
13
|
-
export declare const SOURCES: string[];
|
|
14
|
-
export type { ValidatorIRv0, ValidatorBaseType } from './validator-ir.js';
|
|
15
|
-
export interface IFormMetadata {
|
|
16
|
-
name: string;
|
|
17
|
-
label: string;
|
|
18
|
-
schema_version: number;
|
|
19
|
-
schema: IForm;
|
|
20
|
-
signing_parties: IFormSigningParty[];
|
|
21
|
-
subscribers?: IFormSubscriber[];
|
|
22
|
-
}
|
|
23
|
-
export type IFormSubscriber = {
|
|
24
|
-
email: string;
|
|
25
|
-
};
|
|
26
|
-
export interface IFormSignatory {
|
|
27
|
-
name?: string;
|
|
28
|
-
email: string;
|
|
29
|
-
title?: string;
|
|
30
|
-
honorific?: string;
|
|
31
|
-
}
|
|
32
|
-
export interface IFormSigningParty {
|
|
33
|
-
_id: string;
|
|
34
|
-
order: number;
|
|
35
|
-
signatory_title: string;
|
|
36
|
-
signatory_account?: IFormSignatory;
|
|
37
|
-
signatory_email_options?: string[];
|
|
38
|
-
signatory_source?: {
|
|
39
|
-
_id: string;
|
|
40
|
-
label: string;
|
|
41
|
-
tooltip_label: string;
|
|
42
|
-
};
|
|
43
|
-
signed?: boolean;
|
|
44
|
-
signed_ip_address?: string;
|
|
45
|
-
}
|
|
46
|
-
export interface IFormSignee {
|
|
47
|
-
name: string;
|
|
48
|
-
sourceEmail: string;
|
|
49
|
-
title?: string;
|
|
50
|
-
honorific?: string;
|
|
51
|
-
signedDate?: number;
|
|
52
|
-
}
|
|
53
|
-
export interface IForm {
|
|
54
|
-
blocks: IFormBlock[];
|
|
55
|
-
}
|
|
56
|
-
export interface IFormBlock {
|
|
57
|
-
_id: string;
|
|
58
|
-
block_type: (typeof BLOCK_TYPES)[number];
|
|
59
|
-
order: number;
|
|
60
|
-
signing_party_id: IFormSigningParty['_id'];
|
|
61
|
-
text_content?: string;
|
|
62
|
-
field_schema?: IFormField;
|
|
63
|
-
phantom_field_schema?: IFormPhantomField;
|
|
64
|
-
}
|
|
65
|
-
export interface IFormField {
|
|
66
|
-
field: string;
|
|
67
|
-
type: 'text' | 'signature' | 'image';
|
|
68
|
-
x: number;
|
|
69
|
-
y: number;
|
|
70
|
-
w: number;
|
|
71
|
-
h: number;
|
|
72
|
-
page: number;
|
|
73
|
-
align_h?: (typeof ALIGN_H)[number];
|
|
74
|
-
align_v?: (typeof ALIGN_V)[number];
|
|
75
|
-
label: string;
|
|
76
|
-
tooltip_label: string;
|
|
77
|
-
shared: boolean;
|
|
78
|
-
source: (typeof SOURCES)[number];
|
|
79
|
-
prefiller?: string;
|
|
80
|
-
validator?: string;
|
|
81
|
-
validator_ir?: ValidatorIRv0 | null;
|
|
82
|
-
size?: number;
|
|
83
|
-
wrap?: boolean;
|
|
84
|
-
font?: FontName;
|
|
85
|
-
radio_group_id?: string;
|
|
86
|
-
radio_option_label?: string;
|
|
87
|
-
}
|
|
88
|
-
export interface IFormPhantomField {
|
|
89
|
-
field: string;
|
|
90
|
-
type: 'text' | 'signature' | 'image';
|
|
91
|
-
label: string;
|
|
92
|
-
tooltip_label: string;
|
|
93
|
-
shared: boolean;
|
|
94
|
-
source: (typeof SOURCES)[number];
|
|
95
|
-
prefiller?: string;
|
|
96
|
-
validator?: string;
|
|
97
|
-
validator_ir?: ValidatorIRv0 | null;
|
|
98
|
-
radio_group_id?: string;
|
|
99
|
-
radio_option_label?: string;
|
|
100
|
-
}
|
|
101
|
-
export interface IFormParameters {
|
|
102
|
-
[key: string]: string | ZodType;
|
|
103
|
-
}
|
|
104
|
-
export type IFormSourceDomains<SourceDomains extends any[]> = Record<string, SourceDomains[number]>;
|
|
105
|
-
export type IFormFieldValidator = ZodType;
|
|
106
|
-
export type IFormFieldPrefiller<SourceDomains extends any[]> = (sourceDomains: IFormSourceDomains<SourceDomains>) => string;
|
|
107
|
-
export declare class FormMetadata<SourceDomains extends any[]> {
|
|
108
|
-
private readonly formMetadata;
|
|
109
|
-
private readonly blocks;
|
|
110
|
-
constructor(formMetadata: IFormMetadata);
|
|
111
|
-
getBlocksForClientService(signingPartyId?: string): ClientBlock<SourceDomains>[];
|
|
112
|
-
getSigningPartyFieldName(signingPartyId: string): string;
|
|
113
|
-
getSigningPartyTitleFromFieldName(signingPartyFieldName: string): string | undefined;
|
|
114
|
-
getSigningPartyBlocks(sourceSigningPartyId: string): ClientBlock<SourceDomains>[];
|
|
115
|
-
getSigningPartyFields(signingPartyId: string): (ClientField<SourceDomains> | ClientPhantomField<SourceDomains>)[];
|
|
116
|
-
static getSigningPartyValues(signingParties: IFormSigningParty[], values: FormValues): Record<string, IFormSignatory>;
|
|
117
|
-
private getFields;
|
|
118
|
-
private getField;
|
|
119
|
-
private getPhantomFields;
|
|
120
|
-
private getPhantomField;
|
|
121
|
-
encodeAsJSON(): string;
|
|
122
|
-
static decodeFromJSON<SourceDomains extends any[]>(json: string): FormMetadata<SourceDomains>;
|
|
123
|
-
getLabel(): string;
|
|
124
|
-
private getFieldForClientService;
|
|
125
|
-
getFieldsForClientService(signingPartyId?: string, sourceDomains?: IFormSourceDomains<SourceDomains>, derivationBase?: IFormParameters): (ClientField<SourceDomains> | ClientPhantomField<SourceDomains>)[];
|
|
126
|
-
getSignatureFieldsForClientService(signingPartyId: string): (ClientField<SourceDomains> | ClientPhantomField<SourceDomains>)[];
|
|
127
|
-
getSignatureValueForSigningParty(values: FormValues, signingPartyId: string): string;
|
|
128
|
-
setSignatureValueForSigningParty(values: FormValues, signatureString: string, signingPartyId: string): FormValues;
|
|
129
|
-
getFieldsForEditorService(): IFormField[];
|
|
130
|
-
getPhantomFieldsForEditorService(): IFormPhantomField[];
|
|
131
|
-
getBlocksForEditorService(): IFormBlock[];
|
|
132
|
-
getFieldsForSigningService(): ServerField[];
|
|
133
|
-
inferParams(): string[];
|
|
134
|
-
private parseValidator;
|
|
135
|
-
private parsePrefiller;
|
|
136
|
-
private enumerateParams;
|
|
137
|
-
private populateParams;
|
|
138
|
-
getSchemaVersion(): number;
|
|
139
|
-
getSubscribers(): IFormSubscriber[];
|
|
140
|
-
getSigningParties(): IFormSigningParty[];
|
|
141
|
-
mayInvolveEsign(): boolean;
|
|
142
|
-
}
|