PageSourceSearch

https://www.horses.nl/wp-content/plugins/bondis-subscriptions-api/…bsa-front-end-functions-js-gfa.js?ver=1.7.5

js horses.nl collected 2026-10-02 18:30:23 UTC 70,085 bytes, 2,018 lines download raw bytes

1//General variables
2let bsaPlgBlockDifferentAddressAjax = {};
3let bsaPlgAjaxRequestsFrontEndGfa = {};
4
5//Default html objects
6class bsaPlgFormClassGfa {
7    //Construct
8    constructor() {
9        //Nothing to do - there are no instances.
10    }
11
12    //Property functions
13    static setGlobalVariables(formId) {
14        if (bsaPlgIsNullOrEmpty(bsaPlgBlockDifferentAddressAjax[formId])) {
15            bsaPlgBlockDifferentAddressAjax[formId] = false;
16        }
17
18        if (bsaPlgIsNullOrEmpty(bsaPlgAjaxRequestsFrontEndGfa[formId])) {
19            bsaPlgAjaxRequestsFrontEndGfa[formId] = 0;
20        }
21
22        bsaPlgAjaxGfa(formId, [], bsaPlgNonceClassGfa, 'bsa_plg_get_nonces_ajax_gfa', true);
23    }
24
25    //Functions
26    static isFormSubscriptionForm(formId) {
27        //Check if the form exists
28        const bsaFormElement = document.getElementById(`gform_${formId}`);
29        if (bsaPlgIsNullOrEmpty(bsaFormElement)) {
30            return false;
31        }
32
33        //Check if the form has a class attribute and if the value is correct
34        if (!bsaFormElement.hasAttribute('class')) {
35            return false;
36        }
37        return jQuery(`#gform_${formId}`).attr('class').includes('bsaPlgSubscriptionForm');
38    }
39
40    static getFormPosted(formId) {
41        //Get value based on classname from the form
42        return jQuery(`#gform_${formId}`).attr('class').includes('bsaPlgFormPostedGfa');
43    }
44
45    static getLeadingAddress(formId) {
46        //Get leadingAddress based on classname from the form
47        const classNames = jQuery(`#gform_${formId}`).attr('class');
48        const leadingAddress = (classNames.includes('bsaPlgFormPayerGfa')) ? 'payer' : 'no_leading_address';
49        return (classNames.includes('bsaPlgFormReceiverGfa')) ? 'receiver' : leadingAddress;
50    }
51
52    static getHideSingleAction(formId) {
53        //Get value based on classname from the form
54        return jQuery(`#gform_${formId}`).attr('class').includes('bsaPlgFormHideSingleActionGfa');
55    }
56
57    static getHideSinglePremium(formId) {
58        //Get value based on classname from the form
59        return jQuery(`#gform_${formId}`).attr('class').includes('bsaPlgFormHideSinglePremiumGfa');
60    }
61
62    static getAjaxValues(formId) {
63        return {
64            ...bsaPlgActionTypeClassGfa.getNameAndValue(formId),
65            ...bsaPlgActionWrapperClassGfa.getNameAndValue(formId),
66            ...bsaPlgCountryClassGfa.getNameAndValue(formId, 'payer'),
67            ...bsaPlgCountryClassGfa.getNameAndValue(formId, 'receiver'),
68            ...bsaPlgDifferentAddressClassGfa.getNameAndValue(formId)
69        };
70    }
71
72    //Behaviours
73    static disable(formId) {
74        //If the request is smaller than zero, something went wrong in keeping track of the request. So we reset the count
75        bsaPlgAjaxRequestsFrontEndGfa[formId] = (bsaPlgAjaxRequestsFrontEndGfa[formId] < 0) ? 0 : bsaPlgAjaxRequestsFrontEndGfa[formId];
76
77        //Check if there are any ajax request running
78        if (bsaPlgAjaxRequestsFrontEndGfa[formId] <= 0) {
79            return;
80        }
81
82        //Disable forms if there are ajax request running
83        jQuery(`#gform_${formId} input[type="button"]`).attr('inert', true);
84        jQuery(`#gform_${formId} input[type="submit"]`).attr('inert', true);
85    }
86
87    static enable(formId, async = true) {
88        //If the request is smaller than zero, something went wrong in keeping track of the request. So we reset the count
89        bsaPlgAjaxRequestsFrontEndGfa[formId] = (bsaPlgAjaxRequestsFrontEndGfa[formId] < 0) ? 0 : bsaPlgAjaxRequestsFrontEndGfa[formId];
90
91        //Check if there are any ajax request running
92        if (bsaPlgAjaxRequestsFrontEndGfa[formId] > 0 || !async) {
93            return;
94        }
95
96        //Enable forms if there are no ajax request running
97        jQuery(`#gform_${formId} input[type="button"]`).removeAttr('inert');
98        jQuery(`#gform_${formId} input[type="submit"]`).removeAttr('inert');
99    }
100}
101
102class bsaPlgRadioClassGfa {
103    //Construct
104    constructor() {
105        //Nothing to do - there are no instances.
106    }
107
108    //Property functions
109    static setClassName() {
110        this.className = '';
111    }
112
113    //Functions
114    static count(formId) {
115        //Always set the properties first
116        this.setClassName();
117
118        //return output
119        return jQuery(`#gform_${formId} .${this.className} div div input`).length;
120    }
121
122    static getName(formId) {
123        //Always set the properties first
124        this.setClassName();
125
126        //return output
127        const output = jQuery(`#gform_${formId} .${this.className} div div input:first-child`).attr('name');
128        return (bsaPlgIsNullOrEmpty(output)) ? 'no_element_field' : output;
129    }
130
131    static getId(formId) {
132        const name = this.getName(formId);
133        return name.replace('input_', '');
134    }
135
136    static getValue(formId) {
137        //Always set the properties first
138        this.setClassName();
139
140        //return output
141        let output = jQuery(`#gform_${formId} .${this.className} div div input:checked`).val();
142        if (output !== 'gf_other_choice') {
143            return (bsaPlgIsNullOrEmpty(output)) ? '' : output;
144        }
145
146        //We found gf_other_choice
147        output = jQuery(`#gform_${formId} .${this.className} div div input:checked`).parent('div').children('input.gchoice_other_control').val();
148        return (bsaPlgIsNullOrEmpty(output)) ? '' : output;
149    }
150
151    static getText(formId) {
152        //Always set the properties first
153        this.setClassName();
154
155        //We need the id first
156        const inputId = jQuery(`#gform_${formId} .${this.className} div div input:checked`).attr('id');
157        if (bsaPlgIsNullOrEmpty(inputId)) {
158            return '';
159        }
160
161        //Label ID
162        const labelId = inputId.replace('choice_', 'label_');
163        const output = jQuery(`#gform_${formId} .${this.className} div div label#${labelId}`).text();
164        return (bsaPlgIsNullOrEmpty(output)) ? '' : output;
165    }
166
167    static getLabel(formId) {
168        //Always set the properties first
169        this.setClassName();
170
171        //Return the label text
172        return jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').children('legend').text();
173    }
174
175    static getFields(formId) {
176        //Get the correct fieldId
177        const fieldId = this.getId(formId);
178        return jQuery(`#gform_${formId} #field_${formId}_${fieldId}`);
179    }
180
181    static getNameAndValue(formId) {
182        return { [this.getName(formId)]: this.getValue(formId) };
183    }
184
185    //Behaviours
186    static hide(formId) {
187        const count = this.count(formId);
188        if (count === 0 || count === 1) {
189            jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').addClass('bsaPlgHiddenImp');
190        } else {
191            jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').removeClass('bsaPlgHiddenImp');
192        }
193    }
194
195    static disable(formId) {
196        //Always set the properties first
197        this.setClassName();
198
199        //Disable the field
200        jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').attr('inert', true);
201    }
202
203    static enable(formId) {
204        //Always set the properties first
205        this.setClassName();
206
207        //Enable the field
208        jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').removeAttr('inert');
209    }
210
211    static afterGetContentFieldAjax(formId, content) {
212        //Get the correct fieldId
213        const fieldId = this.getId(formId);
214
215        //Remove content and add new content
216        jQuery(`#field_${formId}_${fieldId} div.${this.className}`).remove();
217        jQuery(`#field_${formId}_${fieldId}`).append(content);
218    }
219}
220
221class bsaPlgSelectClassGfa {
222    //Construct
223    constructor() {
224        //Nothing to do - there are no instances.
225    }
226
227    //Property functions
228    static setClassName(split = '') {
229        this.className = '';
230    }
231
232    //Functions
233    static count(formId, split = '') {
234        //Always set the properties first
235        this.setClassName(split);
236
237        //return output
238        return jQuery(`#gform_${formId} .${this.className} select option`).length;
239    }
240
241    static getName(formId, split = '') {
242        //Always set the properties first
243        this.setClassName(split);
244
245        //return output
246        const output = jQuery(`#gform_${formId} .${this.className} select`).attr('name');
247        return (bsaPlgIsNullOrEmpty(output)) ? 'no_element_field' : output;
248    }
249
250    static getId(formId, split = '') {
251        const name = this.getName(formId, split);
252        return name.replace('input_', '');
253    }
254
255    static getValue(formId, split = '') {
256        //Always set the properties first
257        this.setClassName(split);
258
259        //return output
260        const output = jQuery(`#gform_${formId} .${this.className} select`).val();
261        return (bsaPlgIsNullOrEmpty(output)) ? '' : output;
262    }
263
264    static getText(formId, split = '') {
265        //Always set the properties first
266        this.setClassName(split);
267
268        //return output
269        const output = jQuery(`#gform_${formId} .${this.className} select`).children('option:selected').text();
270        return (bsaPlgIsNullOrEmpty(output)) ? '' : output;
271    }
272
273    static getLabel(formId, split = '') {
274        //Always set the properties first
275        this.setClassName(split);
276
277        //Return the label text
278        return jQuery(`#gform_${formId} .${this.className}`).parent('div').children('label').text();
279    }
280
281    static getFields(formId, split = '') {
282        //Get the correct fieldId
283        const fieldId = this.getId(formId, split);
284        return jQuery(`#gform_${formId} #field_${formId}_${fieldId}`);
285    }
286
287    static getNameAndValue(formId, split = '') {
288        return { [this.getName(formId, split)]: this.getValue(formId, split) };
289    }
290
291    //Behaviours
292    static hide(formId, split = '') {
293        const count = this.count(formId, split);
294        if (count === 0) {
295            jQuery(`#gform_${formId} .${this.className}`).parent('div').addClass('bsaPlgHiddenImp');
296        } else {
297            jQuery(`#gform_${formId} .${this.className}`).parent('div').removeClass('bsaPlgHiddenImp');
298        }
299    }
300
301    static disable(formId, split = '') {
302        //Always set the properties first
303        this.setClassName(split);
304
305        //Disable the field
306        jQuery(`#gform_${formId} .${this.className}`).parent('div').attr('inert', true);
307    }
308
309    static enable(formId, split = '') {
310        //Always set the properties first
311        this.setClassName(split);
312
313        //Enable the field
314        jQuery(`#gform_${formId} .${this.className}`).parent('div').removeAttr('inert');
315    }
316
317    static afterGetContentFieldAjax(formId, content, split = '') {
318        //Get the correct fieldId
319        const fieldId = this.getId(formId, split);
320
321        //Remove content and add new content
322        jQuery(`#field_${formId}_${fieldId} div.${this.className}`).remove();
323        jQuery(`#field_${formId}_${fieldId}`).append(content);
324    }
325}
326
327class bsaPlgTextClassGfa {
328    //Construct
329    constructor() {
330        //Nothing to do - there are no instances.
331    }
332
333    //Property functions
334    static setClassName(split = '') {
335        this.className = '';
336    }
337
338    //Functions
339    static getName(formId, split = '') {
340        //Always set the properties first
341        this.setClassName(split);
342
343        //return output
344        const output = jQuery(`#gform_${formId} .${this.className} input`).attr('name');
345        return (bsaPlgIsNullOrEmpty(output)) ? 'no_element_field' : output;
346    }
347
348    static getId(formId, split = '') {
349        const name = this.getName(formId, split);
350        return name.replace('input_', '');
351    }
352
353    static getValue(formId, split = '') {
354        //Always set the properties first
355        this.setClassName(split);
356
357        //return output
358        const output = jQuery(`#gform_${formId} .${this.className} input`).val();
359        return (bsaPlgIsNullOrEmpty(output)) ? '' : output;
360    }
361
362    static getLabel(formId, split = '') {
363        //Always set the properties first
364        this.setClassName(split);
365
366        //Return the label text
367        return jQuery(`#gform_${formId} .${this.className}`).parent('div').children('label').text();
368    }
369
370    static getNameAndValue(formId, split = '') {
371        return { [this.getName(formId, split)]: this.getValue(formId, split) };
372    }
373
374    static setValue(formId, newValue, split = '') {
375        //Only if there is a value
376        if (bsaPlgIsNullOrEmpty(newValue)) {
377            return;
378        }
379
380        //Always set the properties first
381        this.setClassName(split);
382
383        //Set the value
384        jQuery(`#gform_${formId} .${this.className} input`).val(newValue);
385    }
386
387    //Behaviours
388    static disable(formId, split = '') {
389        //Always set the properties first
390        this.setClassName(split);
391
392        //Disable the field
393        jQuery(`#gform_${formId} .${this.className}`).parent('div').attr('inert', true);
394    }
395
396    static enable(formId, split = '') {
397        //Always set the properties first
398        this.setClassName(split);
399
400        //Disable the field
401        jQuery(`#gform_${formId} .${this.className}`).parent('div').removeAttr('inert');
402    }
403
404    static invalid(formId, split = '') {
405        //Always set the properties first
406        this.setClassName(split);
407
408        //Make field invalid
409        jQuery(`#gform_${formId} .${this.className} input`).addClass('bsaPlgInvalidInputFieldGfa');
410    }
411
412    static valid(formId, split = '') {
413        //Always set the properties first
414        this.setClassName(split);
415
416        //Make field invalid
417        jQuery(`#gform_${formId} .${this.className} input`).removeClass('bsaPlgInvalidInputFieldGfa');
418    }
419}
420
421class bsaPlgCheckboxClassGfa {
422    //Construct
423    constructor() {
424        //Nothing to do - there are no instances.
425    }
426
427    //Property functions
428    static setClassName() {
429        this.className = '';
430    }
431
432    //Functions
433    static count(formId) {
434        //Always set the properties first
435        this.setClassName();
436
437        //return output
438        return jQuery(`#gform_${formId} .${this.className} div div input`).length;
439    }
440
441    static getName(formId) {
442        //Always set the properties first
443        this.setClassName();
444
445        //return output
446        let output = jQuery(`#gform_${formId} .${this.className} div div input:first-child`).attr('name');
447        return (bsaPlgIsNullOrEmpty(output)) ? 'no_element_field' : output.replace('.1', '');
448    }
449
450    static getId(formId) {
451        const name = this.getName(formId);
452        return name.replace('input_', '');
453    }
454
455    static getValue(formId) {
456        //Always set the properties first
457        this.setClassName();
458
459        //return output
460        const output = jQuery(`#gform_${formId} .${this.className} div div input:checked`).val();
461        return (bsaPlgIsNullOrEmpty(output)) ? '' : output;
462    }
463
464    static getText(formId) {
465        //Always set the properties first
466        this.setClassName();
467
468        //We need the id first
469        const inputId = jQuery(`#gform_${formId} .${this.className} div div input:checked`).attr('id');
470        if (bsaPlgIsNullOrEmpty(inputId)) {
471            return '';
472        }
473
474        //Label ID
475        const labelId = inputId.replace('choice_', 'label_');
476        const output = jQuery(`#gform_${formId} .${this.className} div div label#${labelId}`).text();
477        return (bsaPlgIsNullOrEmpty(output)) ? '' : output;
478    }
479
480    static getLabel(formId) {
481        //Always set the properties first
482        this.setClassName();
483
484        //Return the label text
485        return jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').children('legend').text();
486    }
487
488    static getFields(formId) {
489        //Get the correct fieldId
490        const fieldId = this.getId(formId);
491        return jQuery(`#gform_${formId} #field_${formId}_${fieldId}`);
492    }
493
494    static getNameAndValue(formId) {
495        return { [this.getName(formId)]: this.getValue(formId) };
496    }
497
498    //Behaviours
499    static hide(formId) {
500        const count = this.count(formId);
501        if (count === 0) {
502            jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').addClass('bsaPlgHiddenImp');
503        } else {
504            jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').removeClass('bsaPlgHiddenImp');
505        }
506    }
507
508    static disable(formId) {
509        //Always set the properties first
510        this.setClassName();
511
512        //Disable the field
513        jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').attr('inert', true);
514    }
515
516    static enable(formId) {
517        //Always set the properties first
518        this.setClassName();
519
520        //Enable the field
521        jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').removeAttr('inert');
522    }
523
524    static afterGetContentFieldAjax(formId, content) {
525        //Get the correct fieldId
526        const fieldId = this.getId(formId);
527
528        //Remove content and add new content
529        jQuery(`#field_${formId}_${fieldId} div.${this.className}`).remove();
530        jQuery(`#field_${formId}_${fieldId}`).append(content);
531    }
532}
533
534class bsaPlgHiddenClassGfa {
535    //Construct
536    constructor() {
537        //Nothing to do - there are no instances.
538    }
539
540    //Property functions
541    static setClassName() {
542        this.className = '';
543    }
544
545    //Functions
546    static getName(formId) {
547        //Always set the properties first
548        this.setClassName();
549
550        //return output
551        const output = jQuery(`#gform_${formId} .${this.className} input`).attr('name');
552        return (bsaPlgIsNullOrEmpty(output)) ? 'no_element_field' : output;
553    }
554
555    static getId(formId) {
556        const name = this.getName(formId);
557        return name.replace('input_', '');
558    }
559
560    static getValue(formId) {
561        //Always set the properties first
562        this.setClassName();
563
564        //return output
565        const output = jQuery(`#gform_${formId} .${this.className} input`).val();
566        return (bsaPlgIsNullOrEmpty(output)) ? '' : output;
567    }
568
569    static getNameAndValue(formId) {
570        return { [this.getName(formId)]: this.getValue(formId) };
571    }
572
573    static setValue(formId, newValue) {
574        //Only if there is a value
575        if (bsaPlgIsNullOrEmpty(newValue)) {
576            return;
577        }
578
579        //Always set the properties first
580        this.setClassName();
581
582        //Set the value
583        jQuery(`#gform_${formId} .${this.className} input`).val(newValue);
584    }
585}
586
587//Extended objects
588class bsaPlgActionTypeClassGfa extends bsaPlgRadioClassGfa {
589    //Property functions
590    static setClassName() {
591        this.className = 'bsaPlgActionTypeGfa';
592    }
593
594    //Behaviours
595    static hide(formId) {
596        const count = this.count(formId);
597        if (count === 0 || count === 1) {
598            jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').addClass('bsaPlgHiddenImp');
599        } else {
600            jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').removeClass('bsaPlgHiddenImp');
601        }
602    }
603}
604
605class bsaPlgActionClassGfa extends bsaPlgRadioClassGfa {
606    //Property functions
607    static setClassName() {
608        this.className = 'bsaPlgActionGfa';
609    }
610
611    //Behaviours
612    static hide(formId, click) {
613        //First we check if the forms always wants to hide a single action
614        if (bsaPlgFormClassGfa.getHideSingleAction(formId)) {
615            const count = this.count(formId);
616            if (count === 0 || count === 1) {
617                jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').addClass('bsaPlgHiddenImp');
618                return;
619            } else {
620                jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').removeClass('bsaPlgHiddenImp');
621            }
622        }
623
624        //If actionType is empty, return
625        const actionType = bsaPlgActionTypeClassGfa.getValue(formId);
626        if (bsaPlgIsNullOrEmpty(actionType)) {
627            return;
628        }
629
630        //continue and set the properties first
631        this.setClassName();
632        jQuery(`#gform_${formId} .${this.className} div div`).each(function () {
633            //Get value of radio
634            const value = jQuery(this).children('input').val();
635
636            //If type was clicked, reset radio
637            if (click) {
638                jQuery(this).children('input').prop('checked', false);
639            }
640
641            //Hide or unhide based on type0
642            if (value.includes(actionType)) {
643                jQuery(this).removeClass('bsaPlgHiddenImp');
644            } else {
645                jQuery(this).addClass('bsaPlgHiddenImp');
646            }
647        });
648    }
649
650    //Extra functions
651    static getInfo(formId, info) {
652        //Get relevant information
653        const actionValue = this.getValue(formId);
654        if (bsaPlgIsNullOrEmpty(actionValue)) {
655            return '';
656        }
657
658        // Check for delimiter
659        if ((actionValue.match(/_/g) || []).length !== 7) {
660            return '';
661        }
662
663        // Split input
664        const infoArray = actionValue.split('_');
665        return (bsaPlgIsNullOrEmpty(infoArray[info])) ? '' : infoArray[info];
666    }
667}
668
669class bsaPlgActionSelectClassGfa extends bsaPlgSelectClassGfa {
670    //Property functions
671    static setClassName() {
672        this.className = 'bsaPlgActionSelectGfa';
673    }
674
675    //Behaviours
676    static hide(formId, click) {
677        //Hide if empty
678        const count = this.count(formId);
679        if (count === 0 || count === 1) {
680            jQuery(`#gform_${formId} .${this.className}`).parent('div').addClass('bsaPlgHiddenImp');
681        } else {
682            jQuery(`#gform_${formId} .${this.className}`).parent('div').removeClass('bsaPlgHiddenImp');
683        }
684
685        //Second we check if we want to hide a single action
686        if (count === 2) {
687            if (bsaPlgFormClassGfa.getHideSingleAction(formId)) {
688                jQuery(`#gform_${formId} .${this.className}`).parent('div').addClass('bsaPlgHiddenImp');
689            } else {
690                jQuery(`#gform_${formId} .${this.className}`).parent('div').removeClass('bsaPlgHiddenImp');
691            }
692        }
693
694        //If actionType is empty, return
695        const actionType = bsaPlgActionTypeClassGfa.getValue(formId);
696        if (bsaPlgIsNullOrEmpty(actionType)) {
697            return;
698        }
699
700        //continue and set the properties first
701        this.setClassName();
702        jQuery(`#gform_${formId} .${this.className} select option`).each(function () {
703            //Get value of radio
704            const value = jQuery(this).val();
705
706            //If type was clicked, reset radio
707            if (click) {
708                jQuery(this).children('input').prop('selected', false);
709                this.selected = false;
710            }
711
712            //Hide or unhide based on type0
713            if (value.includes(actionType) || value === '') {
714                jQuery(this).removeClass('bsaPlgHiddenImp');
715            } else {
716                jQuery(this).addClass('bsaPlgHiddenImp');
717            }
718        });
719    }
720
721    //Extra functions
722    static getInfo(formId, info) {
723        //Get relevant information
724        const actionValue = this.getValue(formId);
725        if (bsaPlgIsNullOrEmpty(actionValue)) {
726            return '';
727        }
728
729        // Check for delimiter
730        if ((actionValue.match(/_/g) || []).length !== 7) {
731            return '';
732        }
733
734        // Split input
735        const infoArray = actionValue.split('_');
736        return (bsaPlgIsNullOrEmpty(infoArray[info])) ? '' : infoArray[info];
737    }
738}
739
740class bsaPlgEditionClassGfa extends bsaPlgRadioClassGfa {
741    //Property functions
742    static setClassName() {
743        this.className = 'bsaPlgEditionGfa';
744    }
745
746    //Behaviours
747    static afterGetContentFieldAjax(formId, content) {
748        //Get the correct fieldId
749        const fieldId = this.getId(formId);
750
751        //Remove content and add new content
752        jQuery(`#field_${formId}_${fieldId} div.${this.className}`).remove();
753        jQuery(`#field_${formId}_${fieldId}`).append(content);
754        this.hide(formId);
755    }
756
757    //Extra functions
758    static getInfo(formId, info) {
759        //Get relevant information
760        const editionValue = this.getValue(formId);
761        if (bsaPlgIsNullOrEmpty(editionValue)) {
762            return '';
763        }
764
765        // Check for delimiter
766        if ((editionValue.match(/_/g) || []).length !== 1) {
767            return '';
768        }
769
770        // Split input
771        const infoArray = editionValue.split('_');
772        return (bsaPlgIsNullOrEmpty(infoArray[info])) ? '' : infoArray[info];
773    }
774}
775
776class bsaPlgPremiumClassGfa extends bsaPlgSelectClassGfa {
777    //Property functions
778    static setClassName() {
779        this.className = 'bsaPlgPremiumGfa';
780    }
781
782    //Behaviours
783    static hide(formId, split = '') {
784        const count = this.count(formId, split);
785        if (count === 0 || count === 1) {
786            jQuery(`#gform_${formId} .${this.className}`).parent('div').addClass('bsaPlgHiddenImp');
787        } else {
788            jQuery(`#gform_${formId} .${this.className}`).parent('div').removeClass('bsaPlgHiddenImp');
789        }
790
791        //Second we check if we want to hide a single premium
792        if (count === 2) {
793            if (bsaPlgFormClassGfa.getHideSinglePremium(formId)) {
794                jQuery(`#gform_${formId} .${this.className}`).parent('div').addClass('bsaPlgHiddenImp');
795            } else {
796                jQuery(`#gform_${formId} .${this.className}`).parent('div').removeClass('bsaPlgHiddenImp');
797            }
798        }
799    }
800
801    static afterGetContentFieldAjax(formId, content, split = '') {
802        //Get the correct fieldId
803        const fieldId = this.getId(formId, split);
804
805        //Remove content and add new content
806        jQuery(`#field_${formId}_${fieldId} div.${this.className}`).remove();
807        jQuery(`#field_${formId}_${fieldId}`).append(content);
808        this.hide(formId, split);
809    }
810}
811
812class bsaPlgDiscountCodeClassGfa extends bsaPlgTextClassGfa {
813    //Property functions
814    static setClassName() {
815        this.className = 'bsaPlgDiscountCodeGfa';
816    }
817}
818
819class bsaPlgGenderClassGfa extends bsaPlgSelectClassGfa {
820    //Property functions
821    static setClassName(split = '') {
822        if (split === '') {
823            this.className = 'no_element_field';
824            return;
825        }
826
827        //payer or receiver
828        switch (split) {
829            case 'payer':
830                this.className = 'bsaPlgGenderPayerGfa';
831                break;
832            case 'receiver':
833                this.className = 'bsaPlgGenderReceiverGfa';
834                break;
835            default:
836                this.className = 'no_element_field';
837        }
838    }
839
840    //Functions
841    static getValue(formId, split = '') {
842        //Always set the properties first
843        this.setClassName(split);
844
845        //return output
846        let output = jQuery(`#gform_${formId} .${this.className} select`).val();
847        output = (bsaPlgIsNullOrEmpty(output)) ? '' : output;
848
849        //Check different address and always return value is yes
850        //Because in this instance, both fields should be present
851        const differentAddressValue = bsaPlgDifferentAddressClassGfa.getValue(formId);
852        if (differentAddressValue === 'yes') {
853            return output;
854        }
855
856        //If no different address was found, only return a value for allowed element
857        const leadingAddress = bsaPlgFormClassGfa.getLeadingAddress(formId);
858        return (this.className.toLowerCase().includes(leadingAddress)) ? output : '';
859    }
860}
861
862class bsaPlgCountryClassGfa extends bsaPlgSelectClassGfa {
863    //Property functions
864    static setClassName(type = '') {
865        if (type === '') {
866            this.className = 'no_element_field';
867            return;
868        }
869
870        //payer or receiver
871        switch (type) {
872            case 'payer':
873                this.className = 'bsaPlgCountryPayerGfa';
874                break;
875            case 'receiver':
876                this.className = 'bsaPlgCountryReceiverGfa';
877                break;
878            default:
879                this.className = 'no_element_field';
880        }
881    }
882
883    //Functions
884    static getValue(formId, split = '') {
885        //Always set the properties first
886        this.setClassName(split);
887
888        //return output
889        let output = jQuery(`#gform_${formId} .${this.className} select`).val();
890        output = (bsaPlgIsNullOrEmpty(output)) ? '' : output;
891
892        //Check different address and always return value is yes
893        //Because in this instance, both fields should be present
894        const differentAddressValue = bsaPlgDifferentAddressClassGfa.getValue(formId);
895        if (differentAddressValue === 'yes') {
896            return output;
897        }
898
899        //If no different address was found, only return a value for allowed element
900        const leadingAddress = bsaPlgFormClassGfa.getLeadingAddress(formId);
901        return (this.className.toLowerCase().includes(leadingAddress)) ? output : '';
902    }
903}
904
905class bsaPlgPhoneNum
905berClassGfa extends bsaPlgTextClassGfa {
906    //Property functions
907    static setClassName(split = '') {
908        if (split === '') {
909            this.className = 'no_element_field';
910            return;
911        }
912
913        //payer or receiver
914        switch (split) {
915            case 'payer':
916                this.className = 'bsaPlgPhoneNumberPayerGfa';
917                break;
918            case 'receiver':
919                this.className = 'bsaPlgPhoneNumberReceiverGfa';
920                break;
921            default:
922                this.className = 'no_element_field';
923        }
924    }
925
926    //Functions
927    static getValue(formId, split = '') {
928        //Always set the properties first
929        this.setClassName(split);
930
931        //return output
932        let output = jQuery(`#gform_${formId} .${this.className} input`).val();
933        output = (bsaPlgIsNullOrEmpty(output)) ? '' : output;
934
935        //Check different address and always return value is yes
936        //Because in this instance, both fields should be present
937        const differentAddressValue = bsaPlgDifferentAddressClassGfa.getValue(formId);
938        if (differentAddressValue === 'yes') {
939            return output;
940        }
941
942        //If no different address was found, only return a value for allowed element
943        const leadingAddress = bsaPlgFormClassGfa.getLeadingAddress(formId);
944        return (this.className.toLowerCase().includes(leadingAddress)) ? output : '';
945    }
946}
947
948class bsaPlgDifferentAddressClassGfa extends bsaPlgRadioClassGfa {
949    //Property functions
950    static setClassName() {
951        this.className = 'bsaPlgDifferentAddressGfa';
952    }
953
954    //Behaviours
955    static hide(formId) {
956        //Get the action value and return if empty.
957        const action = bsaPlgActionWrapperClassGfa.getValue(formId);
958        if (bsaPlgIsNullOrEmpty(action)) {
959            return;
960        }
961
962        //Always set the properties first
963        this.setClassName();
964
965        //Return if not gift
966        if (!action.includes('gift')) {
967            jQuery(`#gform_${formId} .${this.className}`).removeClass('bsaPlgHiddenImp');
968            return;
969        }
970
971        //get current values
972        const selectedDifferentAddressValue = this.getValue(formId);
973        jQuery(`#gform_${formId} .${this.className}`).addClass('bsaPlgHiddenImp');
974
975        //Return if already yes
976        if (selectedDifferentAddressValue === 'yes') {
977            return;
978        }
979
980        bsaPlgBlockDifferentAddressAjax[formId] = true;
981        jQuery(`#gform_${formId} .${this.className} div div input[value="yes"]`).prop('checked', true);
982        jQuery(`#gform_${formId} .${this.className} div div input[value="yes"]`).trigger('change');
983    }
984}
985
986class bsaPlgPaymentMethodClassGfa extends bsaPlgRadioClassGfa {
987    //Property functions
988    static setClassName() {
989        this.className = 'bsaPlgPaymentMethodGfa';
990    }
991
992    //Behaviours
993    static afterGetContentFieldAjax(formId, content) {
994        //Get the correct fieldId
995        const fieldId = this.getId(formId);
996
997        //Remove content and add new content
998        jQuery(`#field_${formId}_${fieldId} div.${this.className}`).remove();
999        jQuery(`#field_${formId}_${fieldId}`).append(content);
1000
1001        //Hide iban
1002        bsaPlgGiveAuthorizationClassGfa.hide(formId, true);
1003        bsaPlgIbanClassGfa.hide(formId);
1004        bsaPlgBankAccountNameClassGfa.hide(formId);
1005    }
1006
1007    //Extra functions
1008    static getInfo(formId, info) {
1009        //Get relevant information
1010        const paymentMethodValue = this.getValue(formId);
1011        if (bsaPlgIsNullOrEmpty(paymentMethodValue)) {
1012            return '';
1013        }
1014
1015        // Check for delimiter
1016        if ((paymentMethodValue.match(/_/g) || []).length !== 3) {
1017            return '';
1018        }
1019
1020        // Split input
1021        const infoArray = paymentMethodValue.split('_');
1022        return (bsaPlgIsNullOrEmpty(infoArray[info])) ? '' : infoArray[info];
1023    }
1024}
1025
1026class bsaPlgGiveAuthorizationClassGfa extends bsaPlgCheckboxClassGfa {
1027    //Property functions
1028    static setClassName() {
1029        this.className = 'bsaPlgGiveAuthorizationGfa';
1030    }
1031
1032    //Behaviours
1033    static hide(formId, uncheck) {
1034        //Always set the properties first
1035        this.setClassName();
1036
1037        //Get relevant data
1038        const paymentMethod = bsaPlgPaymentMethodClassGfa.getInfo(formId, bsaPlgInfoPaymentMethodGfa.paymentMethodCode);
1039        const invoicePeriod = bsaPlgPaymentMethodClassGfa.getInfo(formId, bsaPlgInfoPaymentMethodGfa.invoicePeriodCode);
1040        const willRenew = bsaPlgActionWrapperClassGfa.getInfo(formId, bsaPlgInfoActionGfa.willRenew);
1041        const check = (!uncheck) ? jQuery(`#gform_${formId} .${this.className} div div input`).is(':checked') : false;
1042
1043        //Is field required
1044        const isRequired = bsaPlgIsBankAccountRequired(paymentMethod, invoicePeriod);
1045        if (isRequired || (willRenew === 'true' && paymentMethod === 'ID')) {
1046            jQuery(`#gform_${formId} .${this.className} div div input`).prop('checked', check);
1047            jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').removeClass('bsaPlgHiddenImp');
1048        } else {
1049            jQuery(`#gform_${formId} .${this.className} div div input`).prop('checked', true);
1050            jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').addClass('bsaPlgHiddenImp');
1051        }
1052
1053        //Extra description
1054        if (willRenew === 'true' && paymentMethod === 'ID') {
1055            jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').children('.gfield_description').removeClass('bsaPlgHiddenImp');
1056        } else {
1057            jQuery(`#gform_${formId} .${this.className}`).parent('fieldset').children('.gfield_description').addClass('bsaPlgHiddenImp');
1058        }
1059    }
1060}
1061
1062class bsaPlgIbanClassGfa extends bsaPlgTextClassGfa {
1063    //Property functions
1064    static setClassName() {
1065        this.className = 'bsaPlgIbanGfa';
1066    }
1067
1068    //Behaviours
1069    static hide(formId) {
1070        //Always set the properties first
1071        this.setClassName();
1072
1073        //Get relevant data
1074        let ibanValue = this.getValue(formId);
1075        const paymentMethod = bsaPlgPaymentMethodClassGfa.getInfo(formId, bsaPlgInfoPaymentMethodGfa.paymentMethodCode);
1076        const invoicePeriod = bsaPlgPaymentMethodClassGfa.getInfo(formId, bsaPlgInfoPaymentMethodGfa.invoicePeriodCode);
1077
1078        //Is field required
1079        const isRequired = bsaPlgIsBankAccountRequired(paymentMethod, invoicePeriod);
1080        if (isRequired) {
1081            ibanValue = (ibanValue === '-') ? '' : ibanValue;
1082            jQuery(`#gform_${formId} .${this.className}`).parent('div').removeClass('bsaPlgHiddenImp');
1083            jQuery(`#gform_${formId} .${this.className}`).children('input').val(ibanValue);
1084        } else {
1085            ibanValue = (ibanValue === '') ? '-' : ibanValue;
1086            jQuery(`#gform_${formId} .${this.className}`).parent('div').addClass('bsaPlgHiddenImp');
1087            jQuery(`#gform_${formId} .${this.className}`).children('input').val(ibanValue);
1088        }
1089    }
1090}
1091
1092class bsaPlgBankAccountNameClassGfa extends bsaPlgTextClassGfa {
1093    //Property functions
1094    static setClassName() {
1095        this.className = 'bsaPlgBankAccountNameGfa';
1096    }
1097
1098    //Behaviours
1099    static hide(formId) {
1100        //Always set the properties first
1101        this.setClassName();
1102
1103        //Get relevant data
1104        let bankAccountNameValue = this.getValue(formId);
1105        const paymentMethod = bsaPlgPaymentMethodClassGfa.getInfo(formId, bsaPlgInfoPaymentMethodGfa.paymentMethodCode);
1106        const invoicePeriod = bsaPlgPaymentMethodClassGfa.getInfo(formId, bsaPlgInfoPaymentMethodGfa.invoicePeriodCode);
1107
1108        //Is field required
1109        const isRequired = bsaPlgIsBankAccountRequired(paymentMethod, invoicePeriod);
1110        if (isRequired) {
1111            bankAccountNameValue = (bankAccountNameValue === '-') ? '' : bankAccountNameValue;
1112            jQuery(`#gform_${formId} .${this.className}`).parent('div').removeClass('bsaPlgHiddenImp');
1113            jQuery(`#gform_${formId} .${this.className}`).children('input').val(bankAccountNameValue);
1114        } else {
1115            bankAccountNameValue = (bankAccountNameValue === '') ? '-' : bankAccountNameValue;
1116            jQuery(`#gform_${formId} .${this.className}`).parent('div').addClass('bsaPlgHiddenImp');
1117            jQuery(`#gform_${formId} .${this.className}`).children('input').val(bankAccountNameValue);
1118        }
1119    }
1120}
1121
1122class bsaPlgExtraChargeClassGfa extends bsaPlgRadioClassGfa {
1123    //Property functions
1124    static setClassName() {
1125        this.className = 'bsaPlgExtraChargeGfa';
1126    }
1127}
1128
1129//Extended objects that don't have a counterpart in php, so they need to be handed differently
1130class bsaPlgPostalCodeClassGfa extends bsaPlgTextClassGfa {
1131    //Property functions
1132    static setClassName(split = '') {
1133        if (split === '') {
1134            this.className = 'no_element_field';
1135            return;
1136        }
1137
1138        //payer or receiver
1139        switch (split) {
1140            case 'payer':
1141                this.className = 'bsa_payer_address_postalCode_gfa';
1142                break;
1143            case 'receiver':
1144                this.className = 'bsa_receiver_address_postalCode_gfa';
1145                break;
1146            default:
1147                this.className = 'no_element_field';
1148        }
1149    }
1150
1151    //Functions
1152    static getValue(formId, split = '') {
1153        //Always set the properties first
1154        this.setClassName(split);
1155
1156        //return output
1157        let output = jQuery(`#gform_${formId} .${this.className} input`).val();
1158        output = (bsaPlgIsNullOrEmpty(output)) ? '' : output;
1159
1160        //Check different address and always return value is yes
1161        //Because in this instance, both fields should be present
1162        const differentAddressValue = bsaPlgDifferentAddressClassGfa.getValue(formId);
1163        if (differentAddressValue === 'yes') {
1164            return output;
1165        }
1166
1167        //If no different address was found, only return a value for allowed element
1168        const leadingAddress = bsaPlgFormClassGfa.getLeadingAddress(formId);
1169        return (this.className.toLowerCase().includes(leadingAddress)) ? output : '';
1170    }
1171
1172    static getLabel(formId, split = '') {
1173        //Always set the properties first
1174        this.setClassName(split);
1175
1176        //Return the label text
1177        return jQuery(`#gform_${formId} .${this.className}`).children('label').text();
1178    }
1179
1180    //Behaviours
1181    static disable(formId, split = '') {
1182        //Do nothing
1183    }
1184
1185    static enable(formId, split = '') {
1186        //Do nothing
1187    }
1188
1189    //Extra functions
1190    static markAddressInvalid(formId, split = '') {
1191        this.invalid(formId, split);
1192        bsaPlgStreetNumberClassGfa.invalid(formId, split);
1193        bsaPlgStreetClassGfa.invalid(formId, split);
1194        bsaPlgCityClassGfa.invalid(formId, split);
1195    }
1196
1197    static markAddressValid(formId, split = '') {
1198        this.valid(formId, split);
1199        bsaPlgStreetNumberClassGfa.valid(formId, split);
1200        bsaPlgStreetClassGfa.valid(formId, split);
1201        bsaPlgCityClassGfa.valid(formId, split);
1202    }
1203
1204    static afterLookupAddressAjax(formId, content, split = '') {
1205        //Re enable locked fields
1206        bsaPlgStreetClassGfa.enable(formId, split);
1207        bsaPlgCityClassGfa.enable(formId, split);
1208
1209        //Content needs to be filled
1210        if (bsaPlgIsNullOrEmpty(content)) {
1211            this.markAddressInvalid(formId, split);
1212            return;
1213        }
1214
1215        //Update street
1216        let streetFound = false;
1217        if ('street' in content) {
1218            bsaPlgStreetClassGfa.setValue(formId, content['street'], split);
1219            streetFound = (!bsaPlgIsNullOrEmpty(content['street'])) ? true : false;
1220        }
1221
1222        //Update city
1223        let cityFound = false;
1224        if ('city' in content) {
1225            bsaPlgCityClassGfa.setValue(formId, content['city'], split);
1226            cityFound = (!bsaPlgIsNullOrEmpty(content['street'])) ? true : false;
1227        }
1228
1229        //End
1230        if (streetFound && cityFound) {
1231            this.markAddressValid(formId, split);
1232        } else {
1233            this.markAddressInvalid(formId, split);
1234        }
1235    }
1236}
1237
1238class bsaPlgStreetNumberClassGfa extends bsaPlgTextClassGfa {
1239    //Property functions
1240    static setClassName(split = '') {
1241        if (split === '') {
1242            this.className = 'no_element_field';
1243            return;
1244        }
1245
1246        //payer or receiver
1247        switch (split) {
1248            case 'payer':
1249                this.className = 'bsa_payer_address_streetNumber_gfa';
1250                break;
1251            case 'receiver':
1252                this.className = 'bsa_receiver_address_streetNumber_gfa';
1253                break;
1254            default:
1255                this.className = 'no_element_field';
1256        }
1257    }
1258
1259    //Functions
1260    static getValue(formId, split = '') {
1261        //Always set the properties first
1262        this.setClassName(split);
1263
1264        //return output
1265        let output = jQuery(`#gform_${formId} .${this.className} input`).val();
1266        output = (bsaPlgIsNullOrEmpty(output)) ? '' : output;
1267
1268        //Check different address and always return value is yes
1269        //Because in this instance, both fields should be present
1270        const differentAddressValue = bsaPlgDifferentAddressClassGfa.getValue(formId);
1271        if (differentAddressValue === 'yes') {
1272            return output;
1273        }
1274
1275        //If no different address was found, only return a value for allowed element
1276        const leadingAddress = bsaPlgFormClassGfa.getLeadingAddress(formId);
1277        return (this.className.toLowerCase().includes(leadingAddress)) ? output : '';
1278    }
1279
1280    static getLabel(formId, split = '') {
1281        //Always set the properties first
1282        this.setClassName(split);
1283
1284        //Return the label text
1285        return jQuery(`#gform_${formId} .${this.className}`).children('label').text();
1286    }
1287
1288    //Behaviours
1289    static disable(formId, split = '') {
1290        //Do nothing
1291    }
1292
1293    static enable(formId, split = '') {
1294        //Do nothing
1295    }
1296
1297    //Extra functions
1298    static markAddressInvalid(formId, split = '') {
1299        bsaPlgPostalCodeClassGfa.invalid(formId, split);
1300        this.invalid(formId, split);
1301        bsaPlgStreetClassGfa.invalid(formId, split);
1302        bsaPlgCityClassGfa.invalid(formId, split);
1303    }
1304
1305    static markAddressValid(formId, split = '') {
1306        bsaPlgPostalCodeClassGfa.valid(formId, split);
1307        this.valid(formId, split);
1308        bsaPlgStreetClassGfa.valid(formId, split);
1309        bsaPlgCityClassGfa.valid(formId, split);
1310    }
1311
1312    static afterLookupAddressAjax(formId, content, split = '') {
1313        //Re enable locked fields
1314        bsaPlgStreetClassGfa.enable(formId, split);
1315        bsaPlgCityClassGfa.enable(formId, split);
1316
1317        //Content needs to be filled
1318        if (bsaPlgIsNullOrEmpty(content)) {
1319            this.markAddressInvalid(formId, split);
1320            return;
1321        }
1322
1323        //Update street
1324        let streetFound = false;
1325        if ('street' in content) {
1326            bsaPlgStreetClassGfa.setValue(formId, content['street'], split);
1327            streetFound = (!bsaPlgIsNullOrEmpty(content['street'])) ? true : false;
1328        }
1329
1330        //Update city
1331        let cityFound = false;
1332        if ('city' in content) {
1333            bsaPlgCityClassGfa.setValue(formId, content['city'], split);
1334            cityFound = (!bsaPlgIsNullOrEmpty(content['street'])) ? true : false;
1335        }
1336
1337        //End
1338        if (streetFound && cityFound) {
1339            this.markAddressValid(formId, split);
1340        } else {
1341            this.markAddressInvalid(formId, split);
1342        }
1343    }
1344}
1345
1346class bsaPlgStreetClassGfa extends bsaPlgTextClassGfa {
1347    //Property functions
1348    static setClassName(split = '') {
1349        if (split === '') {
1350            this.className = 'no_element_field';
1351            return;
1352        }
1353
1354        //payer or receiver
1355        switch (split) {
1356            case 'payer':
1357                this.className = 'bsa_payer_address_street_gfa';
1358                break;
1359            case 'receiver':
1360                this.className = 'bsa_receiver_address_street_gfa';
1361                break;
1362            default:
1363                this.className = 'no_element_field';
1364        }
1365    }
1366
1367    //Functions
1368    static getValue(formId, split = '') {
1369        //Always set the properties first
1370        this.setClassName(split);
1371
1372        //return output
1373        let output = jQuery(`#gform_${formId} .${this.className} input`).val();
1374        output = (bsaPlgIsNullOrEmpty(output)) ? '' : output;
1375
1376        //Check different address and always return value is yes
1377        //Because in this instance, both fields should be present
1378        const differentAddressValue = bsaPlgDifferentAddressClassGfa.getValue(formId);
1379        if (differentAddressValue === 'yes') {
1380            return output;
1381        }
1382
1383        //If no different address was found, only return a value for allowed element
1384        const leadingAddress = bsaPlgFormClassGfa.getLeadingAddress(formId);
1385        return (this.className.toLowerCase().includes(leadingAddress)) ? output : '';
1386    }
1387
1388    static getLabel(formId, split = '') {
1389        //Always set the properties first
1390        this.setClassName(split);
1391
1392        //Return the label text
1393        return jQuery(`#gform_${formId} .${this.className}`).children('label').text();
1394    }
1395
1396    //Behaviours
1397    static disable(formId, split = '') {
1398        //Always set the properties first
1399        this.setClassName(split);
1400
1401        //Disable the field
1402        jQuery(`#gform_${formId} .${this.className} div input`).addClass('bsaDisabledInput');
1403        jQuery(`#gform_${formId} .${this.className}`).attr('inert', true);
1404    }
1405
1406    static enable(formId, split = '') {
1407        //Always set the properties first
1408        this.setClassName(split);
1409
1410        //Disable the field
1411        jQuery(`#gform_${formId} .${this.className} div input`).removeClass('bsaDisabledInput');
1412        jQuery(`#gform_${formId} .${this.className}`).removeAttr('inert');
1413    }
1414}
1415
1416class bsaPlgCityClassGfa extends bsaPlgTextClassGfa {
1417    //Property functions
1418    static setClassName(split = '') {
1419        if (split === '') {
1420            this.className = 'no_element_field';
1421            return;
1422        }
1423
1424        //payer or receiver
1425        switch (split) {
1426            case 'payer':
1427                this.className = 'bsa_payer_address_city_gfa';
1428                break;
1429            case 'receiver':
1430                this.className = 'bsa_receiver_address_city_gfa';
1431                break;
1432            default:
1433                this.className = 'no_element_field';
1434        }
1435    }
1436
1437    //Functions
1438    static getValue(formId, split = '') {
1439        //Always set the properties first
1440        this.setClassName(split);
1441
1442        //return output
1443        let output = jQuery(`#gform_${formId} .${this.className} input`).val();
1444        output = (bsaPlgIsNullOrEmpty(output)) ? '' : output;
1445
1446        //Check different address and always return value is yes
1447        //Because in this instance, both fields should be present
1448        const differentAddressValue = bsaPlgDifferentAddressClassGfa.getValue(formId);
1449        if (differentAddressValue === 'yes') {
1450            return output;
1451        }
1452
1453        //If no different address was found, only return a value for allowed element
1454        const leadingAddress = bsaPlgFormClassGfa.getLeadingAddress(formId);
1455        return (this.className.toLowerCase().includes(leadingAddress)) ? output : '';
1456    }
1457
1458    static getLabel(formId, split = '') {
1459        //Always set the properties first
1460        this.setClassName(split);
1461
1462        //Return the label text
1463        return jQuery(`#gform_${formId} .${this.className}`).children('label').text();
1464    }
1465
1466    //Behaviours
1467    static disable(formId, split = '') {
1468        //Always set the properties first
1469        this.setClassName(split);
1470
1471        //Disable the field
1472        jQuery(`#gform_${formId} .${this.className} div input`).addClass('bsaDisabledInput');
1473        jQuery(`#gform_${formId} .${this.className}`).attr('inert', true);
1474    }
1475
1476    static enable(formId, split = '') {
1477        //Always set the properties first
1478        this.setClassName(split);
1479
1480        //Disable the field
1481        jQuery(`#gform_${formId} .${this.className} div input`).removeClass('bsaDisabledInput');
1482        jQuery(`#gform_${formId} .${this.className}`).removeAttr('inert');
1483    }
1484}
1485
1486//Hidden extended objects
1487class bsaPlgHiddenActionIdClassGfa extends bsaPlgHiddenClassGfa {
1488    //Property functions
1489    static setClassName() {
1490        this.className = 'bsaPlgHiddenActionIdGfa';
1491    }
1492}
1493
1494class bsaPlgHiddenActionTypeClassGfa extends bsaPlgHiddenClassGfa {
1495    //Property functions
1496    static setClassName() {
1497        this.className = 'bsaPlgHiddenActionTypeGfa';
1498    }
1499}
1500
1501class bsaPlgHiddenActionCodeClassGfa extends bsaPlgHiddenClassGfa {
1502    //Property functions
1503    static setClassName() {
1504        this.className = 'bsaPlgHiddenActionCodeGfa';
1505    }
1506}
1507
1508class bsaPlgHiddenActionTextClassGfa extends bsaPlgHiddenClassGfa {
1509    //Property functions
1510    static setClassName() {
1511        this.className = 'bsaPlgHiddenActionTextGfa';
1512    }
1513}
1514
1515class bsaPlgHiddenActionPriceClassGfa extends bsaPlgHiddenClassGfa {
1516    //Property functions
1517    static setClassName() {
1518        this.className = 'bsaPlgHiddenActionPriceGfa';
1519    }
1520
1521    //Functions
1522    static setValue(formId, newValue) {
1523        //Only if there is a value
1524        if (bsaPlgIsNullOrEmpty(newValue)) {
1525            return;
1526        }
1527
1528        //Always set the properties first
1529        this.setClassName();
1530
1531        //Set the value
1532        let formattedValue = newValue.toFixed(2);
1533        formattedValue = formattedValue.replace('.', ',');
1534        jQuery(`#gform_${formId} .${this.className} input`).val(formattedValue);
1535    }
1536}
1537
1538class bsaPlgHiddenPublicationCodeClassGfa extends bsaPlgHiddenClassGfa {
1539    //Property functions
1540    static setClassName() {
1541        this.className = 'bsaPlgHiddenPublicationCodeGfa';
1542    }
1543}
1544
1545class bsaPlgHiddenPremiumIdClassGfa extends bsaPlgHiddenClassGfa {
1546    //Property functions
1547    static setClassName() {
1548        this.className = 'bsaPlgHiddenPremiumIdGfa';
1549    }
1550}
1551
1552class bsaPlgHiddenPremiumTextClassGfa extends bsaPlgHiddenClassGfa {
1553    //Property functions
1554    static setClassName() {
1555        this.className = 'bsaPlgHiddenPremiumTextGfa';
1556    }
1557}
1558
1559class bsaPlgHiddenPaymentMethodCodeClassGfa extends bsaPlgHiddenClassGfa {
1560    //Property functions
1561    static setClassName() {
1562        this.className = 'bsaPlgHiddenPaymentMethodCodeGfa';
1563    }
1564}
1565
1566class bsaPlgHiddenPaymentMethodPriceClassGfa extends bsaPlgHiddenClassGfa {
1567    //Property functions
1568    static setClassName() {
1569        this.className = 'bsaPlgHiddenPaymentMethodPriceGfa';
1570    }
1571
1572    //Functions
1573    static setValue(formId, newValue) {
1574        //Only if there is a value
1575        if (bsaPlgIsNullOrEmpty(newValue)) {
1576            return;
1577        }
1578
1579        //Always set the properties first
1580        this.setClassName();
1581
1582        //Set the value
1583        let formattedValue = newValue.toFixed(2);
1584        formattedValue = formattedValue.replace('.', ',');
1585        jQuery(`#gform_${formId} .${this.className} input`).val(formattedValue);
1586    }
1587}
1588
1589class bsaPlgHiddenInvoicePeriodCodeClassGfa extends bsaPlgHiddenClassGfa {
1590    //Property functions
1591    static setClassName() {
1592        this.className = 'bsaPlgHiddenInvoicePeriodCodeGfa';
1593    }
1594}
1595
1596class bsaPlgHiddenEditionIdClassGfa extends bsaPlgHiddenClassGfa {
1597    //Property functions
1598    static setClassName() {
1599        this.className = 'bsaPlgHiddenEditionIdGfa';
1600    }
1601}
1602
1603class bsaPlgHiddenEditionTextClassGfa extends bsaPlgHiddenClassGfa {
1604    //Property functions
1605    static setClassName() {
1606        this.className = 'bsaPlgHiddenEditionTextGfa';
1607    }
1608}
1609
1610class bsaPlgHiddenEditionPriceClassGfa extends bsaPlgHiddenClassGfa {
1611    //Property functions
1612    static setClassName() {
1613        this.className = 'bsaPlgHiddenEditionPriceGfa';
1614    }
1615
1616    //Functions
1617    static setValue(formId, newValue) {
1618        //Only if there is a value
1619        if (bsaPlgIsNullOrEmpty(newValue)) {
1620            return;
1621        }
1622
1623        //Always set the properties first
1624        this.setClassName();
1625
1626        //Set the value
1627        let formattedValue = newValue.toFixed(2);
1628        formattedValue = formattedValue.replace('.', ',');
1629        jQuery(`#gform_${formId} .${this.className} input`).val(formattedValue);
1630    }
1631}
1632
1633class bsaPlgHiddenTransactionIdClassGfa extends bsaPlgHiddenClassGfa {
1634    //Property functions
1635    static setClassName() {
1636        this.className = 'bsaPlgHiddenTransactionIdGfa';
1637    }
1638}
1639
1640//Wrapper fields
1641class bsaPlgActionWrapperClassGfa {
1642    //Functions
1643    static getName(formId) {
1644        //First we set a default output/value
1645        let name = 'no_element_field';
1646
1647        //First we try bsaPlgActionClassGfa
1648        if (name === '' || name === 'no_element_field') {
1649            name = bsaPlgActionClassGfa.getName(formId);
1650        }
1651
1652        //Second we try bsa_actions_field_select_class_gfa
1653        if (name === '' || name === 'no_element_field') {
1654            name = bsaPlgActionSelectClassGfa.getName(formId);
1655        }
1656
1657        //Return what we find
1658        return name;
1659    }
1660
1661    static getValue(formId) {
1662        //First we set a default output/value
1663        let value = '';
1664
1665        //First we try bsaPlgActionClassGfa
1666        if (value === '') {
1667            value = bsaPlgActionClassGfa.getValue(formId);
1668        }
1669
1670        //Second we try bsa_actions_field_select_class_gfa
1671        if (value === '') {
1672            value = bsaPlgActionSelectClassGfa.getValue(formId);
1673        }
1674
1675        //Return what we find
1676        return value;
1677    }
1678
1679    static getText(formId) {
1680        //First we set a default output/value
1681        let text = '';
1682
1683        //First we try bsaPlgActionClassGfa
1684        if (text === '') {
1685            text = bsaPlgActionClassGfa.getText(formId);
1686        }
1687
1688        //Second we try bsa_actions_field_select_class_gfa
1689        if (text === '') {
1690            text = bsaPlgActionSelectClassGfa.getText(formId);
1691        }
1692
1693        //Return what we find
1694        return text;
1695    }
1696
1697    static getNameAndValue(formId) {
1698        return { [this.getName(formId)]: this.getValue(formId) };
1699    }
1700
1701    //Extra functions
1702    static getInfo(formId, info) {
1703        //First we set a default output/value
1704        let output = '';
1705
1706        //First we try bsaPlgActionClassGfa
1707        if (output === '') {
1708            output = bsaPlgActionClassGfa.getInfo(formId, info);
1709        }
1710
1711        //Second we try bsa_actions_field_select_class_gfa
1712        if (output === '') {
1713            output = bsaPlgActionSelectClassGfa.getInfo(formId, info);
1714        }
1715
1716        //Return what we find
1717        return output;
1718    }
1719}
1720
1721//Extra objects
1722class bsaPlgNonceClassGfa {
1723    //Construct
1724    constructor() {
1725        //Nothing to do - there are no instances.
1726    }
1727
1728    //Property functions
1729    static setClassName() {
1730        this.className = 'bsaPlgNonceClassGfa';
1731    }
1732
1733    //Functions
1734    static afterGetNoncesAjax(formId, content) {
1735        //Content needs to be filled
1736        if (bsaPlgIsNullOrEmpty(content)) {
1737            return;
1738        }
1739
1740        //Save nonces in session storage
1741        if ('bsaPlgGetContentFieldAjaxNonceGfa' in content) {
1742            sessionStorage.setItem('bsaPlgGetContentFieldAjaxNonceGfa', content['bsaPlgGetContentFieldAjaxNonceGfa']);
1743        }
1744
1745        if ('bsaPlgLookupAddressAjaxNonceGfa' in content) {
1746            sessionStorage.setItem('bsaPlgLookupAddressAjaxNonceGfa', content['bsaPlgLookupAddressAjaxNonceGfa']);
1747        }
1748    }
1749}
1750
1751//Async functions
1752async function bsaPlgAjaxGfa(formId, extraData, element, action, async) {
1753    try {
1754        //Set start time for log
1755        const startTime = new Date();
1756
1757        //Increase counter and disable form and element
1758        bsaPlgAjaxRequestsFrontEndGfa[formId]++;
1759        bsaPlgFormClassGfa.disable(formId);
1760
1761        const split = ('split' in extraData) ? extraData['split'] : '';
1762        if (element !== null && 'setClassName' in element) {
1763            element.setClassName(split);
1764        }
1765
1766        if (element !== null && 'disable' in element) {
1767            element.disable(formId, split);
1768        }
1769
1770        //Set some default values
1771        let language = jQuery('html').attr('lang');
1772        language = (bsaPlgIsNullOrEmpty(language)) ? 'en_US' : language.replace('-', '_');
1773
1774        let nonce = '';
1775        switch (action) {
1776            case 'bsa_plg_get_content_field_ajax_gfa':
1777                nonce = sessionStorage.getItem('bsaPlgGetContentFieldAjaxNonceGfa');
1778                nonce = (bsaPlgIsNullOrEmpty(nonce)) ? bsaPlgGetCookieValue('bsaPlgGetContentFieldAjaxNonceGfa') : nonce;
1779                nonce = (bsaPlgIsNullOrEmpty(nonce)) ? bsaFrontEndFunctionsJsGfa.bsaPlgGetContentFieldAjaxNonceGfa : nonce;
1780                break;
1781            case 'bsa_plg_lookup_address_ajax':
1782                nonce = sessionStorage.getItem('bsaPlgLookupAddressAjaxNonceGfa');
1783                nonce = (bsaPlgIsNullOrEmpty(nonce)) ? bsaPlgGetCookieValue('bsaPlgLookupAddressAjaxNonceGfa') : nonce;
1784                nonce = (bsaPlgIsNullOrEmpty(nonce)) ? bsaFrontEndFunctionsJsGfa.bsaPlgLookupAddressAjaxNonceGfa : nonce;
1785                break;
1786            default:
1787                nonce = '';
1788        }
1789
1790        //prepare data
1791        let ajaxData = {
1792            formId: formId,
1793            lang: language,
1794            action: action,
1795            nonce: nonce
1796        };
1797        ajaxData = { ...ajaxData, ...extraData };
1798
1799        //Log request
1800        if (bsaFrontEndFunctionsJsGfa.bsaPlgEnableConsoleLogGfa) {
1801            console.log(`Ajax request for form ${formId} has started. Request is ${action} for ${element.className}. Total requests running: ${bsaPlgAjaxRequestsFrontEndGfa[formId]}`);
1802        }
1803
1804        //Run call
1805        return jQuery.ajax({
1806            url: bsaFrontEndFunctionsJsGfa.bsaPlgAjaxUrlGfa,
1807            type: 'POST',
1808            dataType: 'JSON',
1809            data: ajaxData,
1810            success: function (ajaxResult) {
1811                //Check for certain functions to run
1812                if (element !== null) {
1813                    if (ajaxResult['success'] === true && 'afterGetContentFieldAjax' in element && action === 'bsa_plg_get_content_field_ajax_gfa') {
1814                        element.afterGetContentFieldAjax(formId, ajaxResult['data'], split);
1815                    }
1816
1817                    if (ajaxResult['success'] === true && 'afterGetNoncesAjax' in element && action === 'bsa_plg_get_nonces_ajax_gfa') {
1818                        element.afterGetNoncesAjax(formId, ajaxResult['data']);
1819                    }
1820
1821                    if ('afterLookupAddressAjax' in element && action === 'bsa_plg_lookup_address_ajax') {
1822                        element.afterLookupAddressAjax(formId, (ajaxResult['success'] === true) ? ajaxResult['data'] : '', split);
1823                    }
1824
1825                    if ('enable' in element) {
1826                        element.enable(formId, split);
1827                    }
1828                }
1829
1830                //Decrease counter and try to enable the form
1831                bsaPlgAjaxRequestsFrontEndGfa[formId]--;
1832                bsaPlgFormClassGfa.enable(formId, async);
1833
1834                //Log result
1835                if (bsaFrontEndFunctionsJsGfa.bsaPlgEnableConsoleLogGfa) {
1836                    const endTime = new Date();
1837                    const timeElapsed = endTime - startTime;
1838                    const resultText = (ajaxResult['success'] === true) ? 'success' : 'failure';
1839                    console.log(`Ajax request for form ${formId} has finished. Request was ${action} for ${element.className}. Request took ${timeElapsed}ms and was a ${resultText}. Total requests running: ${bsaPlgAjaxRequestsFrontEndGfa[formId]}`);
1840                    !ajaxResult['success'] && console.log(ajaxResult);
1841                }
1842            },
1843            error: function (ajaxResult) {
1844                //Check if we need to enable a field
1845                if (element !== null && 'enable' in element) {
1846                    element.enable(formId, split);
1847                }
1848
1849                //Decrease counter and try to enable the form
1850                bsaPlgAjaxRequestsFrontEndGfa[formId]--;
1851                bsaPlgFormClassGfa.enable(formId, async);
1852
1853                //Log result
1854                if (bsaFrontEndFunctionsJsGfa.bsaPlgEnableConsoleLogGfa) {
1855                    const endTime = new Date();
1856                    const timeElapsed = endTime - startTime;
1857                    console.log(`Ajax request for form ${formId} has finished. Request was ${action} for ${element.className}. Request took ${timeElapsed}ms and was a failure. Total requests running: ${bsaPlgAjaxRequestsFrontEndGfa[formId]}`);
1858                    console.log(ajaxResult);
1859                }
1860            }
1861        });
1862    } catch (error) {
1863        if (bsaFrontEndFunctionsJsGfa.bsaPlgEnableConsoleLogGfa) {
1864            console.log(error);
1865        }
1866        //Decrease counter and try to enable the form
1867        bsaPlgAjaxRequestsFrontEndGfa[formId]--;
1868        bsaPlgFormClassGfa.enable(formId, async);
1869        return false;
1870    }
1871}
1872
1873async function bsaPlgGetContentFieldAsyncGfa(formId, currentPage, element, extraData, fieldCanBeDuplicate, async) {
1874    try {
1875        //If a field can be duplicate, we want a splitter
1876        if (fieldCanBeDuplicate && !('split' in extraData)) {
1877            return false;
1878        }
1879
1880        //Get splitter
1881        const split = ('split' in extraData) ? extraData['split'] : '';
1882
1883        //Get fields. If we have more then two fields, something is wrong
1884        const fields = element.getFields(formId, split);
1885        if (fields.length > 1) {
1886            return false;
1887        }
1888
1889        //Loop fields
1890        let fieldExecuted = false;
1891        for (const field of fields) {
1892            //Get pageNr of the field and check if it is loaded on the current page
1893            const pageId = jQuery(field).parents('.gform_page').attr('id');
1894            const pageNr = (bsaPlgIsNullOrEmpty(pageId)) ? currentPage : parseInt(pageId.replace(`gform_page_${formId}_`, ''));
1895            if (currentPage !== pageNr) {
1896                continue;
1897            }
1898
1899            //Get data from fields
1900            const fieldName = element.getName(formId, split);
1901            const fieldValue = element.getValue(formId, split);
1902            const fieldId = element.getId(formId, split);
1903
1904            //Data
1905            const elementData = { [fieldName]: fieldValue, currentField: fieldId, currentValue: fieldValue };
1906            const sendData = { ...elementData, ...extraData };
1907
1908            //Call function
1909            if (!async) {
1910                await bsaPlgAjaxGfa(formId, sendData, element, 'bsa_plg_get_content_field_ajax_gfa', false);
1911                fieldExecuted = true;
1912                continue;
1913            }
1914
1915            bsaPlgAjaxGfa(formId, sendData, element, 'bsa_plg_get_content_field_ajax_gfa', true);
1916            fieldExecuted = true;
1917            continue;
1918        }
1919        return fieldExecuted;
1920    } catch (error) {
1921        if (bsaFrontEndFunctionsJsGfa.bsaPlgEnableConsoleLogGfa) {
1922            console.log(error);
1923        }
1924        return false;
1925    }
1926}
1927
1928async function bsaPlgGetContentDependingOnActionGfa(formId, currentPage) {
1929    //Hide differentAdress
1930    bsaPlgDifferentAddressClassGfa.hide(formId);
1931
1932    //Get data
1933    const leadingAddress = bsaPlgFormClassGfa.getLeadingAddress(formId);
1934    const secondAddress = (leadingAddress === 'payer') ? 'receiver' : 'payer';
1935    let sendData = { ['split']: leadingAddress, ...bsaPlgFormClassGfa.getAjaxValues(formId) };
1936
1937    //Message what is happening
1938    if (bsaFrontEndFunctionsJsGfa.bsaPlgEnableConsoleLogGfa) {
1939        console.log('Action changed');
1940        console.log(`${leadingAddress} first`);
1941        console.log(`${secondAddress} second`);
1942    }
1943
1944    //First we load fields usually found at the start of the form. Other fields are not dependent on these fields, so we can use async calls
1945    const requestEditions = await bsaPlgGetContentFieldAsyncGfa(formId, currentPage, bsaPlgEditionClassGfa, sendData, false, true);
1946    const requestPremiums = await bsaPlgGetContentFieldAsyncGfa(formId, currentPage, bsaPlgPremiumClassGfa, sendData, false, true);
1947
1948    //Second we load fields usually found in the middle of the form. Other fields are dependent on these fields, so we cannot use async calls
1949    await bsaPlgGetContentFieldAsyncGfa(formId, currentPage, bsaPlgCountryClassGfa, sendData, true, false);
1950    sendData = { ['split']: secondAddress, ...bsaPlgFormClassGfa.getAjaxValues(formId) };
1951
1952    //Last we load fields usually found at the end of the form. Other fields are not dependent on these fields, so we can use async calls
1953    const requestCountries = await bsaPlgGetContentFieldAsyncGfa(formId, currentPage, bsaPlgCountryClassGfa, sendData, true, true);
1954    const requestPaymentMethods = await bsaPlgGetContentFieldAsyncGfa(formId, currentPage, bsaPlgPaymentMethodClassGfa, sendData, false, true);
1955
1956    //Check if certain requests called the ajax function, if not enable the form
1957    if (!requestEditions && !requestPremiums && !requestCountries && !requestPaymentMethods) {
1958        bsaPlgFormClassGfa.enable(formId, true);
1959    }
1960}
1961
1962//Normal functions
1963function bsaPlgGetContentDependingOnDifferentAddressGfa(formId, currentPage) {
1964    //Only run on actual click
1965    if (bsaPlgBlockDifferentAddressAjax[formId]) {
1966        bsaPlgBlockDifferentAddressAjax[formId] = false;
1967        return;
1968    }
1969
1970    //Get data
1971    const sendData = bsaPlgFormClassGfa.getAjaxValues(formId);
1972
1973    //Refresh fields
1974    if (bsaFrontEndFunctionsJsGfa.bsaPlgEnableConsoleLogGfa) {
1975        console.log('Different address changed');
1976    }
1977    bsaPlgGetContentFieldAsyncGfa(formId, currentPage, bsaPlgPaymentMethodClassGfa, sendData, false, true);
1978}
1979
1980function bsaPlgLookupAddressGfa(formId, split) {
1981    //See if all the fields have value
1982
1983    //postalCode
1984    const postalCode = bsaPlgPostalCodeClassGfa.getValue(formId, split);
1985    if (bsaPlgIsNullOrEmpty(postalCode)) {
1986        return;
1987    }
1988
1989    //Street number
1990    const streetNumber = bsaPlgStreetNumberClassGfa.getValue(formId, split);
1991    if (bsaPlgIsNullOrEmpty(streetNumber)) {
1992        return;
1993    }
1994
1995    //Country
1996    const country = bsaPlgCountryClassGfa.getValue(formId, split);
1997    if (bsaPlgIsNullOrEmpty(country)) {
1998        return;
1999    }
2000
2001    //Country must be NL
2002    if (country !== 'NL') {
2003        return;
2004    }
2005
2006    //Get all the values
2007    const address = {
2008        ...{ country: country },
2009        ...{ postalCode: postalCode },
2010        ...{ split: split },
2011        ...{ streetNumber: streetNumber }
2012    };
2013
2014    //Execute ajax
2015    bsaPlgStreetClassGfa.disable(formId, split);
2016    bsaPlgCityClassGfa.disable(formId, split);
2017    bsaPlgAjaxGfa(formId, address, bsaPlgPostalCodeClassGfa, 'bsa_plg_lookup_address_ajax', true);
2018}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.