PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.21.13
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.21.13
V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 2.10.2 All 137 releases
bit-form / includes / Admin / Form / ScriptFilePriorityManager.php

ScriptFilePriorityManager.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 2.21.13, at includes/Admin/Form/ScriptFilePriorityManager.php

703 lines 31.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Admin\Form;
4
5 class ScriptFilePriorityManager
6 {
7 public static function jsFile()
8 {
9 /**
10 * file load priority
11 * first priority status code 100
12 * sub status code link 101,102
13 * second priority status code 200
14 * sub status code link 201,202, 203
15 * continue..........
16 * priority = 100 range for helper file
17 * priority = 200 range for field file
18 * priority = 300 range for script file
19 * priority = 400 range for custom script file
20 * priority = 500 range for js init for custom field file
21 * priority = 600 range for js init for CDN field file
22 * Priority = 700 range for validation js file
23 * priority = 800 range for conditional js file
24 * @array [fieldType] => [
25 * priority => 'choose one of the priority status code',
26 * filename => 'fileName',
27 * scriptTyp => 'script' or 'init' or 'custom' by default script
28 * source => 'filePath' or 'url' or 'cdn' or className or customClassName by scriptTyp && by default it will be 'filePath'=> 'assets/js/fileName.js'',
29 * fk => 'field key'
30 * field => 'field object'
31 * ]
32
33 * final priority
34 helper js
35 common js
36 custom field script js
37 init for custom field js
38 inti for CDN field js
39 validation js
40 confirmation js
41 conditional js
42 submit js
43 custom js
44 */
45 $initSource = '\\BitCode\\BitForm\\Admin\\Form\\InitJs\\';
46 return [
47 'helperScript' => [
48 ['priority' => 101, 'filename' => 'bfSelect.min.js'],
49 ['priority' => 101, 'filename' => 'bfReset.min.js'],
50 ['priority' => 101, 'filename' => 'setBFMsg.min.js'],
51 ['priority' => 101, 'filename' => 'bfSplit.min.js'],
52 ['priority' => 101, 'filename' => 'scrollToElm.min.js'],
53 ['priority' => 101, 'filename' => 'getFldKeyAndRowIndx.min.js'],
54 ['priority' => 101, 'filename' => 'moveToFirstErrFld.min.js'],
55 ['priority' => 101, 'filename' => 'bfValidationErrMsg.min.js'],
56 ['priority' => 101, 'filename' => 'setHiddenFld.min.js'],
57 ['priority' => 101, 'filename' => 'submit-form.min.js'],
58 ['priority' => 101, 'filename' => 'setStyleProperty.min.js']
59 ],
60 'range' => [
61 ['priority' => 301, 'filename' => 'setSliderFieldValue.min.js', 'path' => 'showValue'],
62 ],
63 'country' => [
64 ['priority' => 101, 'filename' => 'observeElm.min.js'],
65 ['priority' => 301, 'filename' => 'bit-country-field.min.js'],
66 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
67 ['priority' => 101, 'filename' => 'observeElm.min.js'],
68 ],
69 'currency' => [
70 ['priority' => 101, 'filename' => 'observeElm.min.js'],
71 ['priority' => 301, 'filename' => 'bit-currency-field.min.js'],
72 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
73 ['priority' => 101, 'filename' => 'observeElm.min.js'],
74 ],
75 'select' => [
76 ['priority' => 101, 'filename' => 'observeElm.min.js'],
77 ['priority' => 301, 'filename' => 'bit-select-field.min.js'],
78 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
79 ['priority' => 101, 'filename' => 'observeElm.min.js'],
80 ],
81 'advanced-file-up' => [
82 ['priority' => 101, 'filename' => 'observeElm.min.js'],
83 ['priority' => 202, 'filename' => 'bit-filepond.min.js'],
84 ['priority' => 301, 'filename' => 'bit-advanced-file-up-field.min.js'],
85 ['priority' => 101, 'filename' => 'advancedFileHandle.min.js'],
86 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
87 ],
88 'file-up' => [
89 ['priority' => 301, 'filename' => 'bit-file-up-field.min.js'],
90 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
91 ],
92 'phone-number' => [
93 ['priority' => 101, 'filename' => 'observeElm.min.js'],
94 ['priority' => 301, 'filename' => 'bit-phone-number-field.min.js'],
95 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
96 ['priority' => 101, 'filename' => 'observeElm.min.js'],
97 ],
98 'paypal' => [
99 ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
100 ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
101 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
102 ['priority' => 301, 'filename' => 'bit-paypal-field.min.js'],
103 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
104 ['priority' => 303, 'filename' => 'initPaypalFld.min.js'],
105 ],
106 'stripe' => [
107 ['priority' => 201, 'filename' => 'bitsFetchFront.min.js'],
108 ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
109 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
110 ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
111 ['priority' => 301, 'filename' => 'bit-stripe-field.min.js'],
112 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
113 ['priority' => 303, 'filename' => 'initStripeFld.min.js'],
114 ],
115 'mollie' => [
116 ['priority' => 201, 'filename' => 'bitsFetchFront.min.js'],
117 ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
118 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
119 ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
120 ['priority' => 301, 'filename' => 'bit-mollie-field.min.js'],
121 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
122 ['priority' => 303, 'filename' => 'initStripeFld.min.js'],
123 ],
124 'section' => [
125 ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'],
126 ],
127 'repeater' => [
128 ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'],
129 ['priority' => 102, 'filename' => 'bit-repeater-field.min.js'],
130 ['priority' => 701, 'filename' => 'checkRepeatedField.min.js'],
131 ['priority' => 701, 'filename' => 'isRepeaterField.min.js'],
132 ['priority' => 701, 'filename' => 'getRepeatedIndexes.min.js'],
133 ['priority' => 701, 'filename' => 'getIndexesBaseOnConditions.min.js'],
134 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
135 ],
136 'razorpay' => [
137 ['priority' => 201, 'filename' => 'replaceFieldAndSmartValues.min.js'],
138 ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
139 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
140 ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
141 ['priority' => 301, 'filename' => 'bit-razorpay-field.min.js'],
142 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
143 ['priority' => 303, 'filename' => 'initRazorpayFld.min.js'],
144 ],
145 'radio' => [
146 ['priority' => 301, 'filename' => 'initAddOtherOpt.min.js', 'path' => 'addOtherOpt'],
147 ['priority' => 301, 'filename' => 'resetOtherOpt.min.js', 'path' => 'addOtherOpt'],
148 ],
149 'check' => [
150 ['priority' => 301, 'filename' => 'initAddOtherOpt.min.js', 'path' => 'addOtherOpt'],
151 ['priority' => 301, 'filename' => 'resetOtherOpt.min.js', 'path' => 'addOtherOpt'],
152 ['priority' => 302, 'filename' => 'initCheckDisableOnMax.min.js', 'path' => 'valid->disableOnMax'],
153 ],
154 'image-select' => [
155 ['priority' => 302, 'filename' => 'initCheckDisableOnMax.min.js', 'path' => 'valid->disableOnMax'],
156 ],
157 'recaptcha' => [
158 ['priority' => 301, 'filename' => 'bit-recaptcha-field.min.js'],
159 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
160 ['priority' => 303, 'filename' => 'initRecaptchaFld.min.js'],
161 ],
162 'hcaptcha' => [
163 ['priority' => 301, 'filename' => 'bit-hcaptcha-field.min.js'],
164 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
165 ['priority' => 303, 'filename' => 'initHCaptchaFld.min.js'],
166 ],
167 'turnstile' => [
168 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
169 ['priority' => 303, 'filename' => 'initTurnstileFld.min.js'],
170 ],
171 'decision-box' => [
172 ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
173 ],
174 'gdpr' => [
175 ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
176 ],
177 'signature' => [
178 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
179 ['priority' => 301, 'filename' => 'bit-signature-field.min.js'],
180 ],
181 'rating' => [
182 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
183 ['priority' => 301, 'filename' => 'bit-rating-field.min.js'],
184 ],
185 'advanced-datetime' => [
186 ['priority' => 101, 'filename' => 'observeElm.min.js'],
187 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
188 ['priority' => 301, 'filename' => 'bit-advanced-datetime-field.min.js'],
189 ['priority' => 301, 'filename' => 'bfDatetimeFldValidation.min.js'],
190 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
191 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
192 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
193 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
194 ['priority' => 301, 'filename' => 'bfParseSpecialDateFormat.min.js'],
195 ['priority' => 301, 'filename' => 'bfSetDateTimeConfigOption.min.js'],
196 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
197 ],
198 'date' => [
199 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
200 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
201 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
202 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
203 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
204 ],
205 'datetime-local' => [
206 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
207 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
208 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
209 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
210 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
211 ],
212 'time' => [
213 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
214 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
215 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
216 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
217 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
218 ],
219 'month' => [
220 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
221 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
222 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
223 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
224 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
225 ],
226 'week' => [
227 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
228 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
229 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
230 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
231 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
232 ],
233 ];
234 }
235
236 public static function filePondPlugins($plugin)
237 {
238 $plugins = [
239 'allowFileSizeValidation' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-file-validate-size.min.js'],
240 'allowFileTypeValidation' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-file-validate-type.min.js'],
241 'allowImageCrop' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-crop.min.js'],
242 'allowImagePreview' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-preview.min.js'],
243 'allowImageResize' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-resize.min.js'],
244 'allowImageTransform' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-transform.min.js'],
245 'allowImageValidateSize' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-validate-size.min.js'],
246 'allowPreview' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-media-preview.min.js'],
247 ];
248 if (array_key_exists($plugin, $plugins)) {
249 return $plugins[$plugin];
250 }
251
252 return false;
253 }
254
255 public static function getAllFldConfs()
256 {
257 // $contentId = $fieldData['contentId'];
258 // $fieldKey = $fieldData['fk'];
259 // $field = $fieldData['field'];
260 // key is config path, value is field path
261 // var is for variable value
262 // path is for field path [ for multiple paths]
263 // val is for static value
264 $configs = [
265
266 'select' => [
267 'fieldKey' => ['var' => 'fieldKey'],
268 'options' => ['path' => 'optionsList'],
269 'placeholder' => ['path' => 'ph'],
270 'classNames' => ['path' => 'customClasses'],
271 'attributes' => ['path' => 'customAttributes'],
272 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
273 'separator' => ['val' => BITFORMS_BF_SEPARATOR],
274 'mn' => ['path' => 'mn', 'val' => 0],
275 'mx' => ['path' => 'mx', 'val' => 0],
276 'disableOnMax' => ['path' => 'valid->disableOnMax', 'val' => false],
277 ],
278 'country' => [
279 'fieldKey' => ['var' => 'fieldKey'],
280 'options' => ['path' => 'options'],
281 'placeholder' => ['path' => 'ph'],
282 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
283 'classNames' => ['path' => 'customClasses'],
284 'attributes' => ['path' => 'customAttributes'],
285 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
286 ],
287 'currency' => [
288 'fieldKey' => ['var' => 'fieldKey'],
289 'options' => ['path' => 'options'],
290 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/currencies/'],
291 'classNames' => ['path' => 'customClasses'],
292 'attributes' => ['path' => 'customAttributes'],
293 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
294 'inputFormatOptions' => ['path' => 'inputFormatOptions'],
295 'valueFormatOptions' => ['path' => 'valueFormatOptions'],
296 ],
297 'phone-number' => [
298 'fieldKey' => ['var' => 'fieldKey'],
299 'options' => ['path' => 'options'],
300 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
301 'classNames' => ['path' => 'customClasses'],
302 'attributes' => ['path' => 'customAttributes'],
303 'contentId' => ['var' => 'contentId'],
304 ],
305 'file-up' => [
306 'fieldKey' => ['var' => 'fieldKey'],
307 'formID' => ['var' => 'formId'],
308 'maxSizeErrMsg' => ['path' => ['err->maxSize->msg', 'err->maxSize->dflt']],
309 'minFileErrMsg' => ['path' => ['err->minFile->msg', 'err->minFile->dflt']],
310 'maxFileErrMsg' => ['path' => ['err->maxFile->msg', 'err->maxFile->dflt']],
311 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload/'],
312 'classNames' => ['path' => 'customClasses'],
313 'attributes' => ['path' => 'customAttributes'],
314 'fieldName' => ['path' => 'fieldName'],
315 'contentId' => ['var' => 'contentId'],
316 ],
317 'paypal' => [
318 'payIntegID' => ['path' => 'payIntegID'],
319 'style' => ['path' => 'style'],
320 'currency' => ['path' => 'currency', 'val' => 'USD'],
321 'amount' => ['path' => 'amount', 'val' => 0],
322 'amountFld' => ['path' => 'amountFld', 'val' => ''],
323 'shipping' => ['path' => 'shipping', 'val' => 0],
324 'shippingVal' => ['path' => 'shippingFld', 'val' => ''],
325 'tax' => ['path' => 'tax', 'val' => 0],
326 'taxVal' => ['path' => 'taxFld', 'val' => ''],
327 'description' => ['path' => 'description', 'val' => ''],
328 'descFld' => ['path' => 'descFld', 'val' => ''],
329 'payType' => ['path' => 'payType', 'val' => 'payment'],
330 'planId' => ['path' => 'planId', 'val' => ''],
331 'locale' => ['path' => 'locale', 'val' => 'en_US'],
332 'disableFunding' => ['path' => 'disableFunding', 'val' => ''],
333 'fieldKey' => ['var' => 'fieldKey'],
334 'clientId' => ['path' => 'clientId'],
335 'contentId' => ['var' => 'contentId'],
336 'namespace' => ['val' => 'bit-paypal-__$contentId__'],
337 ],
338 'stripe' => [
339 'payIntegID' => ['path' => 'payIntegID'],
340 'locale' => ['path' => 'config->options->locale', 'val' => 'en'],
341 'amountType' => ['path' => 'config->amountType', 'val'=> 'fixed'],
342 'fieldKey' => ['var' => 'fieldKey'],
343 'contentId' => ['var' => 'contentId'],
344 'publishableKey' => ['path' => 'publishableKey'],
345 ],
346 'mollie' => [
347 'payIntegID' => ['path' => 'payIntegID'],
348 'locale' => ['path' => 'config->locale', 'val' => 'en'],
349 'amountType' => ['path' => 'config->amountType', 'val'=> 'fixed'],
350 'fieldKey' => ['var' => 'fieldKey'],
351 'contentId' => ['var' => 'contentId'],
352 'apiKey' => ['path' => 'apiKey'],
353 'payment_method' => ['path' => 'config->payment_method', 'val' => ['creditcard']],
354 'description' => ['path' => 'config->description', 'val' => ''],
355 'amount' => ['path' => 'config->amount', 'val' => 0],
356 'currency' => ['path' => 'config->currency', 'val' => 'EUR'],
357 ],
358 'advanced-file-up' => [
359 'fieldKey' => ['var' => 'fieldKey'],
360 'formID' => ['var' => 'formId'],
361 'configSetting' => ['path' => 'config'],
362 'ajaxURL' => ['val' => admin_url('admin-ajax.php')],
363 'nonce' => ['val' => wp_create_nonce('bitforms_save')],
364 'uploadFileToServer' => ['val' => 1],
365 'fieldName' => ['path' => 'fieldName'],
366 'contentId' => ['var' => 'contentId'],
367 ],
368 'advanced-datetime' => [
369 'fieldKey' => ['var' => 'fieldKey'],
370 'formID' => ['var' => 'formId'],
371 'configSetting' => ['path' => 'config'],
372 'fieldName' => ['path' => 'fieldName'],
373 'contentId' => ['var' => 'contentId'],
374 ],
375 'razorpay' => [
376 'fieldKey' => ['var' => 'fieldKey'],
377 'options' => ['path' => 'options'],
378 'payIntegID' => ['path' => 'payIntegID'],
379 'payType' => ['path' =>'payType', 'val' => ''],
380 'clientId' => ['path' => 'clientId'],
381 'contentId' => ['var' => 'contentId'],
382 'includeOrderId' => ['path' => 'includeOrderId', 'val' => false],
383 'newOrderId' => ['path' => 'newOrderId', 'val' => false],
384 'orderIdFld' => ['path' => 'orderIdFld', 'val' => ''],
385 'formID' => ['var' => 'formId'],
386 ],
387 'repeater' => [
388 'fieldKey' => ['var' => 'fieldKey'],
389 'fieldName' => ['path' => 'fieldName'],
390 'contentId' => ['var' => 'contentId'],
391 'defaultRow' => ['path' => 'defaultRow', 'val' => 1],
392 'minimumRow' => ['path' => 'minRow', 'val' => 1],
393 'maximumRow' => ['path' => 'maxRow', 'val' => 0],
394 'showAddBtn' => ['path' => 'addBtn->show', 'val' => false],
395 'showAddToEndBtn' => ['path' => 'addToEndBtn->show', 'val' => false],
396 'defaultValue' => ['path' => 'val', 'val' => ''],
397 ],
398 'signature' => [
399 'fieldKey' => ['var' => 'fieldKey'],
400 'contentId' => ['var' => 'contentId'],
401 'maxWidth' => ['path' => 'config->maxWidth', 'val' => '1'],
402 'penColor' => ['path' => 'config->penColor', 'val'=> '#000000'],
403 'backgroundColor' => ['path' => 'config->backgroundColor', 'val' => '#ffffff'],
404 'imgTyp' => ['path' => 'config->imgTyp', 'val' => 'image/png'],
405 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/signature/']
406 ],
407 'rating' => [
408 'fieldKey' => ['var' => 'fieldKey'],
409 'contentId' => ['var' => 'contentId'],
410 'options' => ['path' => 'opt'],
411 'showReviewLblOnHover' => ['path' => 'showReviewLblOnHover'],
412 'showReviewLblOnSelect' => ['path' => 'showReviewLblOnSelect'],
413 'selectedRating' => ['path' => 'selectedRating'],
414 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
415 ],
416 'hcaptcha'=> [
417 'fieldKey' => ['var'=>'fieldKey']
418 ]
419 ];
420
421 return $configs;
422 }
423
424 public static function multiStepFiles()
425 {
426 return [
427 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
428 ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
429 ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
430 ['priority' => 700, 'filename' => 'bit-multi-step-form.min.js'],
431 ];
432 }
433
434 public static function conversationalFormFiles()
435 {
436 return [
437 ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
438 ['priority' => 700, 'filename' => 'bit-conversational-form.min.js'],
439 ['priority' => 700, 'filename' => 'handleConversationalFormMsg.min.js'],
440 ];
441 }
442
443 public static function frontendScriptFile()
444 {
445 return [
446 'observeElm' => ['priority' => 101, 'filename' => 'observeElm.min.js'],
447 'hidden-token-field' => ['priority' => 300, 'filename' => 'hidden-token-field.min.js'],
448 ];
449 }
450
451 public static function validationAndOtherScriptFile()
452 {
453 return [
454 'checkFldValidation' => ['priority' => 701, 'filename' => 'checkFldValidation.min.js'],
455 'checkMinMaxOptions' => ['priority' => 702, 'filename' => 'checkMinMaxOptions.min.js'],
456 'bfDatetimeFldValidation' => ['priority' => 702, 'filename' => 'bfDatetimeFldValidation.min.js'],
457 'bfParseDateTime' => ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
458 'checkMinMaxValue' => ['priority' => 702, 'filename' => 'checkMinMaxValue.min.js'],
459 'customOptionValidation' => ['priority' => 702, 'filename' => 'customOptionValidation.min.js'],
460 'dcsnbxFldValidation' => ['priority' => 702, 'filename' => 'dcsnbxFldValidation.min.js'],
461 'emailFldValidation' => ['priority' => 702, 'filename' => 'emailFldValidation.min.js'],
462 'fileupFldValidation' => ['priority' => 702, 'filename' => 'fileupFldValidation.min.js'],
463 'advanceFileupFldValidation' => ['priority' => 702, 'filename' => 'advanceFileUpFldValidation.min.js'],
464 'phoneNumberFldValidation' => ['priority' => 702, 'filename' => 'phoneNumberFldValidation.min.js'],
465 'currencyFldValidation' => ['priority' => 702, 'filename' => 'currencyFldValidation.min.js'],
466 'generateBackslashPattern' => ['priority' => 700, 'filename' => 'generateBackslashPattern.min.js'],
467 'nmbrFldValidation' => ['priority' => 702, 'filename' => 'nmbrFldValidation.min.js'],
468 'regexPatternValidation' => ['priority' => 701, 'filename' => 'regexPatternValidation.min.js'], // load before generateBackslashPattern file, then load regexPatternValidation
469 'inputMaskValidation' => ['priority' => 701, 'filename' => 'inputMaskValidation.min.js'], // load before generateBackslashPattern file, then load inputMaskValidation
470 'bit-input-mask' => ['priority' => 701, 'filename' => 'bit-input-mask.min.js'], // load before generateBackslashPattern file, then load bit-input-mask
471 'setBitInputMaskToInput' => ['priority' => 702, 'filename' => 'setBitInputMaskToInput.min.js'], // load before generateBackslashPattern file, then load setBitInputMaskToInput
472 'requiredFldValidation' => ['priority' => 700, 'filename' => 'requiredFldValidation.min.js'],
473 'urlFldValidation' => ['priority' => 702, 'filename' => 'urlFldValidation.min.js'],
474 'validation' => ['priority' => 705, 'filename' => 'validateForm.min.js'], // last priority for validation script
475 'conditionalLogic' => ['priority' => 705, 'filename' => 'bit-conditionals.min.js'], // last priority for validation script
476 'resetPlaceholders' => ['priority' => 201, 'filename' => 'resetPlaceholders.min.js'],
477 'bfResetDefaultValue' => ['priority' => 201, 'filename' => 'bfResetDefaultValue.min.js'],
478 'validateFocusLost' => ['priority' => 706, 'filename' => 'validate-focus.min.js'], // last priority for validation script
479 ];
480 }
481
482 public static function validationScriptFileMapping($fieldType)
483 {
484 $textTypeField = ['text', 'password', 'username', 'color'];
485 if (in_array($fieldType, $textTypeField)) {
486 $fieldType = 'text';
487 }
488 $fields =
489 [
490 'text' => [
491 'regexPatternValidation' => [
492 'paths' => ['valid->regexr'],
493 'dependencies' => [
494 'generateBackslashPattern'
495 ]
496 ],
497 'bit-input-mask' => [
498 'paths' => ['valid->inputMask'],
499 ],
500 'inputMaskValidation' => [
501 'paths' => ['valid->inputMask'],
502 'dependencies' => [
503 'generateBackslashPattern',
504 'validation',
505 ]
506 ],
507 'setBitInputMaskToInput' => [
508 'paths' => ['valid->inputMask'],
509 'dependencies' => [
510 'bit-input-mask'
511 ]
512 ]
513 ],
514 'textarea' => [
515 'bit-input-mask' => [
516 'paths' => ['valid->inputMask'],
517 ],
518 'inputMaskValidation' => [
519 'paths' => ['valid->inputMask'],
520 'dependencies' => [
521 'generateBackslashPattern',
522 'validation',
523 ]
524 ],
525 'setBitInputMaskToInput' => [
526 'paths' => ['valid->inputMask'],
527 'dependencies' => [
528 'bit-input-mask'
529 ]
530 ]
531 ],
532 'email' => [
533 'emailFldValidation' => [
534 'paths' => ['err->invalid->show'],
535 'dependencies' => [
536 'generateBackslashPattern'
537 ]
538 ],
539 ],
540 'number' => [
541 'nmbrFldValidation' => [
542 'paths' => ['mn', 'mx']
543 ]
544 ],
545 'radio' => [
546 'customOptionValidation' => [
547 'paths' => ['valid->otherOptReq'],
548 ]
549 ],
550 'check' => [
551 'checkMinMaxOptions' => [
552 'paths' => ['mn', 'mx'],
553 'dependencies' => [
554 'checkFldValidation'
555 ]
556 ],
557 'customOptionValidation' => [
558 'paths' => ['valid->otherOptReq'],
559 ]
560 ],
561 'select' => [
562 'checkMinMaxOptions' => [
563 'paths' => ['mn', 'mx'],
564 'dependencies' => [
565 'checkFldValidation'
566 ]
567 ],
568 ],
569 'image-select' => [
570 'checkMinMaxOptions' => [
571 'paths' => ['mn', 'mx'],
572 'dependencies' => [
573 'checkFldValidation'
574 ]
575 ],
576 ],
577 'range' => [
578 'checkMinMaxValue' => [
579 'paths' => ['mn', 'mx']
580 ]
581 ],
582 'url' => [
583 'regexPatternValidation' => [
584 'paths' => ['valid->regexr'],
585 'dependencies' => [
586 'generateBackslashPattern'
587 ]
588 ],
589 'urlFldValidation' => [
590 'paths' => ['err->invalid->show'],
591 'dependencies' => [
592 'generateBackslashPattern'
593 ]
594 ],
595 'bit-input-mask' => [
596 'paths' => ['valid->inputMask'],
597 ],
598 'inputMaskValidation' => [
599 'paths' => ['valid->inputMask'],
600 'dependencies' => [
601 'generateBackslashPattern',
602 'validation',
603 ]
604 ],
605 'setBitInputMaskToInput' => [
606 'paths' => ['valid->inputMask'],
607 'dependencies' => [
608 'bit-input-mask'
609 ]
610 ]
611 ],
612 'decision-box' => [
613 'dcsnbxFldValidation' => [
614 'paths' => ['valid->req']
615 ]
616 ],
617 'gdpr' => [
618 'dcsnbxFldValidation' => [
619 'paths' => ['valid->req']
620 ]
621 ],
622 'file-up' => [
623 'fileupFldValidation' => [
624 'paths' => ['valid->req']
625 ]
626 ],
627 'advanced-file-up' => [
628 'advanceFileupFldValidation' => [
629 'paths' => ['valid->req']
630 ]
631 ],
632 'phone-number' => [
633 'phoneNumberFldValidation' => [
634 'paths' => ['err->invalid->show'],
635 ]
636 ],
637 'currency' => [
638 'currencyFldValidation' => [
639 'paths' => ['err->minValue->show', 'err->maxValue->show'],
640 ]
641 ],
642 'date' => [
643 'bfDatetimeFldValidation' => [
644 'paths' => ['mn', 'mx'],
645 'dependencies' => [
646 'bfParseDateTime'
647 ]
648 ],
649 ],
650 'time' => [
651 'bfDatetimeFldValidation' => [
652 'paths' => ['mn', 'mx'],
653 'dependencies' => [
654 'bfParseDateTime'
655 ]
656 ],
657 ],
658 'week' => [
659 'bfDatetimeFldValidation' => [
660 'paths' => ['mn', 'mx'],
661 'dependencies' => [
662 'bfParseDateTime'
663 ]
664 ],
665 ],
666 'month' => [
667 'bfDatetimeFldValidation' => [
668 'paths' => ['mn', 'mx'],
669 'dependencies' => [
670 'bfParseDateTime'
671 ]
672 ],
673 ],
674 'datetime-local' => [
675 'bfDatetimeFldValidation' => [
676 'paths' => ['mn', 'mx'],
677 'dependencies' => [
678 'bfParseDateTime'
679 ]
680 ],
681 ],
682 ];
683 return isset($fields[$fieldType]) ? $fields[$fieldType] : [];
684 }
685
686 public static function formAbandonmentNeededFiles($abandonType = null)
687 {
688 $files = [
689 'autoSave' => [
690 ['priority' => 201, 'filename' => 'bit-page-lifecycle.min.js'],
691 ['priority' => 402, 'filename' => 'autoSavePartial.min.js'],
692 ]
693 ];
694
695 $required = [
696 ['priority' => 402, 'filename' => 'bit-form-abandonment.min.js'],
697 ['priority' => 401, 'filename' => 'saveFormProgress.min.js'],
698 ['priority' => 701, 'filename' => 'setFieldValues.min.js'],
699 ];
700 return isset($files[$abandonType]) ? array_merge($files[$abandonType], $required) : $required;
701 }
702 }
703