@betterinternship/core 2.8.9 → 2.9.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.js +4 -4
- package/dist/lib/broker/base.process.d.ts +2 -2
- package/dist/lib/broker/base.process.js +2 -2
- package/dist/lib/broker/base.task.d.ts +40 -40
- package/dist/lib/broker/broker.d.ts +28 -28
- package/dist/lib/broker/broker.js +111 -111
- package/dist/lib/chat/chat.d.ts +51 -51
- package/dist/lib/chat/chat.js +183 -183
- package/dist/lib/chat/index.d.ts +2 -2
- package/dist/lib/chat/index.js +2 -2
- package/dist/lib/chat/pb.d.ts +3 -3
- package/dist/lib/chat/pb.js +15 -15
- package/dist/lib/email/email.d.ts +13 -2
- package/dist/lib/email/email.js +76 -0
- package/dist/lib/email/email.js.map +1 -1
- package/dist/lib/env.d.ts +1 -1
- package/dist/lib/env.js +3 -3
- package/dist/lib/forms/constants/fonts.d.ts +131 -131
- package/dist/lib/forms/constants/fonts.js +54 -54
- package/dist/lib/forms/constants/form.d.ts +2 -2
- package/dist/lib/forms/constants/form.js +17 -17
- package/dist/lib/forms/constants/index.d.ts +2 -2
- package/dist/lib/forms/field-preset-templates.d.ts +23 -23
- package/dist/lib/forms/field-preset-templates.js +239 -239
- package/dist/lib/forms/fields.client.d.ts +30 -30
- package/dist/lib/forms/fields.client.js +20 -20
- package/dist/lib/forms/fields.server.d.ts +16 -16
- package/dist/lib/forms/fields.server.js +1 -1
- package/dist/lib/forms/form-metadata.d.ts +136 -135
- package/dist/lib/forms/form-metadata.js +338 -328
- package/dist/lib/forms/form-metadata.js.map +1 -1
- package/dist/lib/forms/index.d.ts +7 -7
- package/dist/lib/forms/index.js +7 -7
- package/dist/lib/forms/validator-ir.d.ts +186 -186
- package/dist/lib/forms/validator-ir.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
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."})`;
|
|
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
8
|
const MULTISELECT_VALIDATOR = `z.array(
|
|
9
9
|
z.enum(
|
|
10
10
|
[
|
|
@@ -13,236 +13,236 @@ const MULTISELECT_VALIDATOR = `z.array(
|
|
|
13
13
|
],
|
|
14
14
|
{ message: "This field is required." }
|
|
15
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 baseIr = (baseType, rules) => ({
|
|
23
|
-
version: 0,
|
|
24
|
-
baseType,
|
|
25
|
-
rules,
|
|
26
|
-
mode: 'builder',
|
|
27
|
-
importStatus: 'exact',
|
|
28
|
-
});
|
|
29
|
-
export const FIELD_PRESET_TEMPLATES = [
|
|
30
|
-
{
|
|
31
|
-
id: 'preset-short-text',
|
|
32
|
-
name: 'short_text',
|
|
33
|
-
label: 'Short Text',
|
|
34
|
-
iconKey: 'shortText',
|
|
35
|
-
type: 'text',
|
|
36
|
-
group: 'core',
|
|
37
|
-
source: 'manual',
|
|
38
|
-
shared: true,
|
|
39
|
-
tag: 'preset',
|
|
40
|
-
preset: 'preset',
|
|
41
|
-
prefiller: '',
|
|
42
|
-
tooltip_label: '',
|
|
43
|
-
validator: SHORT_TEXT_VALIDATOR,
|
|
44
|
-
validator_ir: baseIr('text', []),
|
|
45
|
-
is_phantom: false,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: 'preset-name',
|
|
49
|
-
name: 'name',
|
|
50
|
-
label: 'Name',
|
|
51
|
-
iconKey: 'shortText',
|
|
52
|
-
type: 'text',
|
|
53
|
-
group: 'core',
|
|
54
|
-
source: 'manual',
|
|
55
|
-
shared: true,
|
|
56
|
-
tag: 'preset',
|
|
57
|
-
preset: 'preset',
|
|
58
|
-
prefiller: '',
|
|
59
|
-
tooltip_label: '',
|
|
60
|
-
validator: NAME_VALIDATOR,
|
|
61
|
-
validator_ir: baseIr('text', [{ kind: 'plainText' }, { kind: 'titleCase' }]),
|
|
62
|
-
is_phantom: false,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: 'preset-long-text',
|
|
66
|
-
name: 'long_text',
|
|
67
|
-
label: 'Long Text',
|
|
68
|
-
iconKey: 'longText',
|
|
69
|
-
type: 'text',
|
|
70
|
-
group: 'core',
|
|
71
|
-
source: 'manual',
|
|
72
|
-
shared: true,
|
|
73
|
-
tag: 'preset',
|
|
74
|
-
preset: 'preset',
|
|
75
|
-
prefiller: '',
|
|
76
|
-
tooltip_label: '',
|
|
77
|
-
validator: LONG_TEXT_VALIDATOR,
|
|
78
|
-
validator_ir: baseIr('textarea', []),
|
|
79
|
-
is_phantom: false,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: 'preset-number',
|
|
83
|
-
name: 'number',
|
|
84
|
-
label: 'Number',
|
|
85
|
-
iconKey: 'number',
|
|
86
|
-
type: 'text',
|
|
87
|
-
group: 'core',
|
|
88
|
-
source: 'manual',
|
|
89
|
-
shared: true,
|
|
90
|
-
tag: 'preset',
|
|
91
|
-
preset: 'preset',
|
|
92
|
-
prefiller: '',
|
|
93
|
-
tooltip_label: '',
|
|
94
|
-
validator: NUMBER_VALIDATOR,
|
|
95
|
-
validator_ir: baseIr('number', []),
|
|
96
|
-
is_phantom: false,
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
id: 'preset-signature',
|
|
100
|
-
name: 'signature',
|
|
101
|
-
label: 'Signature',
|
|
102
|
-
iconKey: 'signature',
|
|
103
|
-
type: 'signature',
|
|
104
|
-
group: 'core',
|
|
105
|
-
source: 'manual',
|
|
106
|
-
shared: true,
|
|
107
|
-
tag: 'preset',
|
|
108
|
-
preset: 'preset',
|
|
109
|
-
prefiller: '',
|
|
110
|
-
tooltip_label: '',
|
|
111
|
-
validator: SIGNATURE_VALIDATOR,
|
|
112
|
-
validator_ir: baseIr('signature', [{ kind: 'required' }]),
|
|
113
|
-
is_phantom: false,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
id: 'preset-dropdown',
|
|
117
|
-
name: 'dropdown',
|
|
118
|
-
label: 'Dropdown',
|
|
119
|
-
iconKey: 'dropdown',
|
|
120
|
-
type: 'text',
|
|
121
|
-
group: 'core',
|
|
122
|
-
source: 'manual',
|
|
123
|
-
shared: true,
|
|
124
|
-
tag: 'preset',
|
|
125
|
-
preset: 'preset',
|
|
126
|
-
prefiller: '',
|
|
127
|
-
tooltip_label: '',
|
|
128
|
-
validator: DROPDOWN_VALIDATOR,
|
|
129
|
-
validator_ir: baseIr('enum', [{ kind: 'enum', options: ['Option 1', 'Option 2'] }]),
|
|
130
|
-
is_phantom: false,
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
id: 'preset-multiselect',
|
|
134
|
-
name: 'multiselect',
|
|
135
|
-
label: 'Multiselect',
|
|
136
|
-
iconKey: 'multiselect',
|
|
137
|
-
type: 'text',
|
|
138
|
-
group: 'core',
|
|
139
|
-
source: 'manual',
|
|
140
|
-
shared: true,
|
|
141
|
-
tag: 'preset',
|
|
142
|
-
preset: 'preset',
|
|
143
|
-
prefiller: '',
|
|
144
|
-
tooltip_label: '',
|
|
145
|
-
validator: MULTISELECT_VALIDATOR,
|
|
146
|
-
validator_ir: baseIr('array', [{ kind: 'array', options: ['Option 1', 'Option 2'] }]),
|
|
147
|
-
is_phantom: false,
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
id: 'preset-date',
|
|
151
|
-
name: 'date',
|
|
152
|
-
label: 'Date',
|
|
153
|
-
iconKey: 'date',
|
|
154
|
-
type: 'text',
|
|
155
|
-
group: 'core',
|
|
156
|
-
source: 'manual',
|
|
157
|
-
shared: true,
|
|
158
|
-
tag: 'preset',
|
|
159
|
-
preset: 'preset',
|
|
160
|
-
prefiller: '',
|
|
161
|
-
tooltip_label: '',
|
|
162
|
-
validator: DATE_VALIDATOR,
|
|
163
|
-
validator_ir: baseIr('date', []),
|
|
164
|
-
is_phantom: false,
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
id: 'preset-time',
|
|
168
|
-
name: 'time',
|
|
169
|
-
label: 'Time',
|
|
170
|
-
iconKey: 'time',
|
|
171
|
-
type: 'text',
|
|
172
|
-
group: 'core',
|
|
173
|
-
source: 'manual',
|
|
174
|
-
shared: true,
|
|
175
|
-
tag: 'preset',
|
|
176
|
-
preset: 'preset',
|
|
177
|
-
prefiller: '',
|
|
178
|
-
tooltip_label: '',
|
|
179
|
-
validator: TIME_VALIDATOR,
|
|
180
|
-
validator_ir: baseIr('time', []),
|
|
181
|
-
is_phantom: false,
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
id: 'preset-url',
|
|
185
|
-
name: 'url',
|
|
186
|
-
label: 'URL',
|
|
187
|
-
iconKey: 'url',
|
|
188
|
-
type: 'text',
|
|
189
|
-
group: 'format',
|
|
190
|
-
source: 'manual',
|
|
191
|
-
shared: true,
|
|
192
|
-
tag: 'preset',
|
|
193
|
-
preset: 'preset',
|
|
194
|
-
prefiller: '',
|
|
195
|
-
tooltip_label: '',
|
|
196
|
-
validator: URL_VALIDATOR,
|
|
197
|
-
validator_ir: baseIr('url', []),
|
|
198
|
-
is_phantom: false,
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
id: 'preset-phone-number',
|
|
202
|
-
name: 'phone_number',
|
|
203
|
-
label: 'Phone Number',
|
|
204
|
-
iconKey: 'phone',
|
|
205
|
-
type: 'text',
|
|
206
|
-
group: 'format',
|
|
207
|
-
source: 'manual',
|
|
208
|
-
shared: true,
|
|
209
|
-
tag: 'preset',
|
|
210
|
-
preset: 'preset',
|
|
211
|
-
prefiller: '',
|
|
212
|
-
tooltip_label: '',
|
|
213
|
-
validator: PHONE_NUMBER_VALIDATOR,
|
|
214
|
-
validator_ir: baseIr('phone', []),
|
|
215
|
-
is_phantom: false,
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
id: 'preset-email',
|
|
219
|
-
name: 'email',
|
|
220
|
-
label: 'Email',
|
|
221
|
-
iconKey: 'email',
|
|
222
|
-
type: 'text',
|
|
223
|
-
group: 'format',
|
|
224
|
-
source: 'manual',
|
|
225
|
-
shared: true,
|
|
226
|
-
tag: 'preset',
|
|
227
|
-
preset: 'preset',
|
|
228
|
-
prefiller: '',
|
|
229
|
-
tooltip_label: '',
|
|
230
|
-
validator: EMAIL_VALIDATOR,
|
|
231
|
-
validator_ir: baseIr('email', []),
|
|
232
|
-
is_phantom: false,
|
|
233
|
-
},
|
|
234
|
-
];
|
|
235
|
-
export function getFieldPresetTemplates() {
|
|
236
|
-
return FIELD_PRESET_TEMPLATES.map((preset) => ({
|
|
237
|
-
...preset,
|
|
238
|
-
validator_ir: preset.validator_ir
|
|
239
|
-
? {
|
|
240
|
-
...preset.validator_ir,
|
|
241
|
-
rules: Array.isArray(preset.validator_ir.rules)
|
|
242
|
-
? preset.validator_ir.rules.map((rule) => ({ ...rule }))
|
|
243
|
-
: [],
|
|
244
|
-
}
|
|
245
|
-
: null,
|
|
246
|
-
}));
|
|
247
|
-
}
|
|
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 baseIr = (baseType, rules) => ({
|
|
23
|
+
version: 0,
|
|
24
|
+
baseType,
|
|
25
|
+
rules,
|
|
26
|
+
mode: 'builder',
|
|
27
|
+
importStatus: 'exact',
|
|
28
|
+
});
|
|
29
|
+
export const FIELD_PRESET_TEMPLATES = [
|
|
30
|
+
{
|
|
31
|
+
id: 'preset-short-text',
|
|
32
|
+
name: 'short_text',
|
|
33
|
+
label: 'Short Text',
|
|
34
|
+
iconKey: 'shortText',
|
|
35
|
+
type: 'text',
|
|
36
|
+
group: 'core',
|
|
37
|
+
source: 'manual',
|
|
38
|
+
shared: true,
|
|
39
|
+
tag: 'preset',
|
|
40
|
+
preset: 'preset',
|
|
41
|
+
prefiller: '',
|
|
42
|
+
tooltip_label: '',
|
|
43
|
+
validator: SHORT_TEXT_VALIDATOR,
|
|
44
|
+
validator_ir: baseIr('text', []),
|
|
45
|
+
is_phantom: false,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'preset-name',
|
|
49
|
+
name: 'name',
|
|
50
|
+
label: 'Name',
|
|
51
|
+
iconKey: 'shortText',
|
|
52
|
+
type: 'text',
|
|
53
|
+
group: 'core',
|
|
54
|
+
source: 'manual',
|
|
55
|
+
shared: true,
|
|
56
|
+
tag: 'preset',
|
|
57
|
+
preset: 'preset',
|
|
58
|
+
prefiller: '',
|
|
59
|
+
tooltip_label: '',
|
|
60
|
+
validator: NAME_VALIDATOR,
|
|
61
|
+
validator_ir: baseIr('text', [{ kind: 'plainText' }, { kind: 'titleCase' }]),
|
|
62
|
+
is_phantom: false,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'preset-long-text',
|
|
66
|
+
name: 'long_text',
|
|
67
|
+
label: 'Long Text',
|
|
68
|
+
iconKey: 'longText',
|
|
69
|
+
type: 'text',
|
|
70
|
+
group: 'core',
|
|
71
|
+
source: 'manual',
|
|
72
|
+
shared: true,
|
|
73
|
+
tag: 'preset',
|
|
74
|
+
preset: 'preset',
|
|
75
|
+
prefiller: '',
|
|
76
|
+
tooltip_label: '',
|
|
77
|
+
validator: LONG_TEXT_VALIDATOR,
|
|
78
|
+
validator_ir: baseIr('textarea', []),
|
|
79
|
+
is_phantom: false,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 'preset-number',
|
|
83
|
+
name: 'number',
|
|
84
|
+
label: 'Number',
|
|
85
|
+
iconKey: 'number',
|
|
86
|
+
type: 'text',
|
|
87
|
+
group: 'core',
|
|
88
|
+
source: 'manual',
|
|
89
|
+
shared: true,
|
|
90
|
+
tag: 'preset',
|
|
91
|
+
preset: 'preset',
|
|
92
|
+
prefiller: '',
|
|
93
|
+
tooltip_label: '',
|
|
94
|
+
validator: NUMBER_VALIDATOR,
|
|
95
|
+
validator_ir: baseIr('number', []),
|
|
96
|
+
is_phantom: false,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'preset-signature',
|
|
100
|
+
name: 'signature',
|
|
101
|
+
label: 'Signature',
|
|
102
|
+
iconKey: 'signature',
|
|
103
|
+
type: 'signature',
|
|
104
|
+
group: 'core',
|
|
105
|
+
source: 'manual',
|
|
106
|
+
shared: true,
|
|
107
|
+
tag: 'preset',
|
|
108
|
+
preset: 'preset',
|
|
109
|
+
prefiller: '',
|
|
110
|
+
tooltip_label: '',
|
|
111
|
+
validator: SIGNATURE_VALIDATOR,
|
|
112
|
+
validator_ir: baseIr('signature', [{ kind: 'required' }]),
|
|
113
|
+
is_phantom: false,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: 'preset-dropdown',
|
|
117
|
+
name: 'dropdown',
|
|
118
|
+
label: 'Dropdown',
|
|
119
|
+
iconKey: 'dropdown',
|
|
120
|
+
type: 'text',
|
|
121
|
+
group: 'core',
|
|
122
|
+
source: 'manual',
|
|
123
|
+
shared: true,
|
|
124
|
+
tag: 'preset',
|
|
125
|
+
preset: 'preset',
|
|
126
|
+
prefiller: '',
|
|
127
|
+
tooltip_label: '',
|
|
128
|
+
validator: DROPDOWN_VALIDATOR,
|
|
129
|
+
validator_ir: baseIr('enum', [{ kind: 'enum', options: ['Option 1', 'Option 2'] }]),
|
|
130
|
+
is_phantom: false,
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: 'preset-multiselect',
|
|
134
|
+
name: 'multiselect',
|
|
135
|
+
label: 'Multiselect',
|
|
136
|
+
iconKey: 'multiselect',
|
|
137
|
+
type: 'text',
|
|
138
|
+
group: 'core',
|
|
139
|
+
source: 'manual',
|
|
140
|
+
shared: true,
|
|
141
|
+
tag: 'preset',
|
|
142
|
+
preset: 'preset',
|
|
143
|
+
prefiller: '',
|
|
144
|
+
tooltip_label: '',
|
|
145
|
+
validator: MULTISELECT_VALIDATOR,
|
|
146
|
+
validator_ir: baseIr('array', [{ kind: 'array', options: ['Option 1', 'Option 2'] }]),
|
|
147
|
+
is_phantom: false,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: 'preset-date',
|
|
151
|
+
name: 'date',
|
|
152
|
+
label: 'Date',
|
|
153
|
+
iconKey: 'date',
|
|
154
|
+
type: 'text',
|
|
155
|
+
group: 'core',
|
|
156
|
+
source: 'manual',
|
|
157
|
+
shared: true,
|
|
158
|
+
tag: 'preset',
|
|
159
|
+
preset: 'preset',
|
|
160
|
+
prefiller: '',
|
|
161
|
+
tooltip_label: '',
|
|
162
|
+
validator: DATE_VALIDATOR,
|
|
163
|
+
validator_ir: baseIr('date', []),
|
|
164
|
+
is_phantom: false,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
id: 'preset-time',
|
|
168
|
+
name: 'time',
|
|
169
|
+
label: 'Time',
|
|
170
|
+
iconKey: 'time',
|
|
171
|
+
type: 'text',
|
|
172
|
+
group: 'core',
|
|
173
|
+
source: 'manual',
|
|
174
|
+
shared: true,
|
|
175
|
+
tag: 'preset',
|
|
176
|
+
preset: 'preset',
|
|
177
|
+
prefiller: '',
|
|
178
|
+
tooltip_label: '',
|
|
179
|
+
validator: TIME_VALIDATOR,
|
|
180
|
+
validator_ir: baseIr('time', []),
|
|
181
|
+
is_phantom: false,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: 'preset-url',
|
|
185
|
+
name: 'url',
|
|
186
|
+
label: 'URL',
|
|
187
|
+
iconKey: 'url',
|
|
188
|
+
type: 'text',
|
|
189
|
+
group: 'format',
|
|
190
|
+
source: 'manual',
|
|
191
|
+
shared: true,
|
|
192
|
+
tag: 'preset',
|
|
193
|
+
preset: 'preset',
|
|
194
|
+
prefiller: '',
|
|
195
|
+
tooltip_label: '',
|
|
196
|
+
validator: URL_VALIDATOR,
|
|
197
|
+
validator_ir: baseIr('url', []),
|
|
198
|
+
is_phantom: false,
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
id: 'preset-phone-number',
|
|
202
|
+
name: 'phone_number',
|
|
203
|
+
label: 'Phone Number',
|
|
204
|
+
iconKey: 'phone',
|
|
205
|
+
type: 'text',
|
|
206
|
+
group: 'format',
|
|
207
|
+
source: 'manual',
|
|
208
|
+
shared: true,
|
|
209
|
+
tag: 'preset',
|
|
210
|
+
preset: 'preset',
|
|
211
|
+
prefiller: '',
|
|
212
|
+
tooltip_label: '',
|
|
213
|
+
validator: PHONE_NUMBER_VALIDATOR,
|
|
214
|
+
validator_ir: baseIr('phone', []),
|
|
215
|
+
is_phantom: false,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
id: 'preset-email',
|
|
219
|
+
name: 'email',
|
|
220
|
+
label: 'Email',
|
|
221
|
+
iconKey: 'email',
|
|
222
|
+
type: 'text',
|
|
223
|
+
group: 'format',
|
|
224
|
+
source: 'manual',
|
|
225
|
+
shared: true,
|
|
226
|
+
tag: 'preset',
|
|
227
|
+
preset: 'preset',
|
|
228
|
+
prefiller: '',
|
|
229
|
+
tooltip_label: '',
|
|
230
|
+
validator: EMAIL_VALIDATOR,
|
|
231
|
+
validator_ir: baseIr('email', []),
|
|
232
|
+
is_phantom: false,
|
|
233
|
+
},
|
|
234
|
+
];
|
|
235
|
+
export function getFieldPresetTemplates() {
|
|
236
|
+
return FIELD_PRESET_TEMPLATES.map((preset) => ({
|
|
237
|
+
...preset,
|
|
238
|
+
validator_ir: preset.validator_ir
|
|
239
|
+
? {
|
|
240
|
+
...preset.validator_ir,
|
|
241
|
+
rules: Array.isArray(preset.validator_ir.rules)
|
|
242
|
+
? preset.validator_ir.rules.map((rule) => ({ ...rule }))
|
|
243
|
+
: [],
|
|
244
|
+
}
|
|
245
|
+
: null,
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
248
|
//# sourceMappingURL=field-preset-templates.js.map
|
|
@@ -1,30 +1,30 @@
|
|
|
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';
|
|
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>;
|
|
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>;
|
|
21
|
-
};
|
|
22
|
-
export interface ClientBlock<SourceDomains extends any[]> {
|
|
23
|
-
block_type: (typeof BLOCK_TYPES)[number];
|
|
24
|
-
order: number;
|
|
25
|
-
signing_party_id: IFormSigningParty['_id'];
|
|
26
|
-
text_content?: string;
|
|
27
|
-
field_schema?: ClientField<SourceDomains>;
|
|
28
|
-
phantom_field_schema?: ClientPhantomField<SourceDomains>;
|
|
29
|
-
}
|
|
30
|
-
export {};
|
|
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';
|
|
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>;
|
|
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>;
|
|
21
|
+
};
|
|
22
|
+
export interface ClientBlock<SourceDomains extends any[]> {
|
|
23
|
+
block_type: (typeof BLOCK_TYPES)[number];
|
|
24
|
+
order: number;
|
|
25
|
+
signing_party_id: IFormSigningParty['_id'];
|
|
26
|
+
text_content?: string;
|
|
27
|
+
field_schema?: ClientField<SourceDomains>;
|
|
28
|
+
phantom_field_schema?: ClientPhantomField<SourceDomains>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
export const getSchemaClientType = (s) => {
|
|
3
|
-
const infer = s.type;
|
|
4
|
-
const desc = s.description;
|
|
5
|
-
if (infer === 'date' || desc === 'date')
|
|
6
|
-
return 'date';
|
|
7
|
-
if (infer === 'number' || desc === 'number')
|
|
8
|
-
return 'number';
|
|
9
|
-
if (infer === 'enum' || desc === 'dropdown')
|
|
10
|
-
return 'dropdown';
|
|
11
|
-
if (infer === 'boolean' || desc === 'checkbox')
|
|
12
|
-
return 'checkbox';
|
|
13
|
-
if (s instanceof z.ZodArray && desc === 'multiselect')
|
|
14
|
-
return 'multiselect';
|
|
15
|
-
if (desc === 'textarea')
|
|
16
|
-
return 'textarea';
|
|
17
|
-
if (desc === 'time')
|
|
18
|
-
return 'time';
|
|
19
|
-
return 'text';
|
|
20
|
-
};
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export const getSchemaClientType = (s) => {
|
|
3
|
+
const infer = s.type;
|
|
4
|
+
const desc = s.description;
|
|
5
|
+
if (infer === 'date' || desc === 'date')
|
|
6
|
+
return 'date';
|
|
7
|
+
if (infer === 'number' || desc === 'number')
|
|
8
|
+
return 'number';
|
|
9
|
+
if (infer === 'enum' || desc === 'dropdown')
|
|
10
|
+
return 'dropdown';
|
|
11
|
+
if (infer === 'boolean' || desc === 'checkbox')
|
|
12
|
+
return 'checkbox';
|
|
13
|
+
if (s instanceof z.ZodArray && desc === 'multiselect')
|
|
14
|
+
return 'multiselect';
|
|
15
|
+
if (desc === 'textarea')
|
|
16
|
+
return 'textarea';
|
|
17
|
+
if (desc === 'time')
|
|
18
|
+
return 'time';
|
|
19
|
+
return 'text';
|
|
20
|
+
};
|
|
21
21
|
//# sourceMappingURL=fields.client.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
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
|
+
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,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=fields.server.js.map
|