Conditional Fields for Contact Form 7 - Version 1.9

Version Description

(2020-06-21) = * Performance improvements * Added extra setting: "Conditional Fields UI". If you have a lot of conditions, set this to "Text mode" for better performance in the admin interface. * Improved styling on Conditional Fields Settings page * Improved docs * Improved the form tester * PRO: Multistep bug that was causing checkboxes and multiselect to not trigger validation errors * PRO: Summary added support for files, checkboxes and multiselect * Added test to ensure that normal view entries are always converted to text view correctly

Download this release

Release Info

Developer Jules Colle
Plugin Icon 128x128 Conditional Fields for Contact Form 7
Version 1.9
Comparing to
See all releases

Code changes from version 1.8.7 to 1.9

Files changed (13) hide show
  1. admin-style.css +226 -161
  2. admin-style.scss +93 -0
  3. admin.php +41 -23
  4. cf7cf.php +33 -0
  5. contact-form-7-conditional-fields.php +1 -1
  6. init.php +3 -3
  7. js/scripts.js +113 -115
  8. js/scripts.js.map +1 -1
  9. js/scripts_admin.js +360 -286
  10. js/scripts_es6.js +116 -103
  11. readme.txt +11 -1
  12. style.css +1 -19
  13. wpcf7cf-options.php +112 -159
admin-style.css CHANGED
@@ -1,161 +1,226 @@
1
- #wpcf7cf-new-entry {
2
- display: inline-block;
3
- display: none; }
4
-
5
- #wpcf7cf-delete-button {
6
- display: none; }
7
-
8
- #wpcf7cf-settings-text {
9
- width: 100%;
10
- height: 280px;
11
- font-family: "Courier New", Courier, monospace; }
12
-
13
- #wpcf7cf-conditional-panel {
14
- overflow-x: auto; }
15
- #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .label, #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .field, #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .description {
16
- padding: 10px;
17
- display: inline-block;
18
- vertical-align: middle;
19
- width: 10%; }
20
- #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .field {
21
- width: 20%; }
22
- #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .description {
23
- width: 40%;
24
- vertical-align: top; }
25
- #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line {
26
- border-bottom: 1px solid #dddddd;
27
- background-color: #f9f9f9;
28
- padding: 0 10px; }
29
- #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line:nth-child(2n) {
30
- background-color: #e9e9e9; }
31
- #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line input, #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line select {
32
- width: 100%; }
33
- #wpcf7cf-conditional-panel .ui-autocomplete-term {
34
- font-weight: bold; }
35
- #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable {
36
- position: relative; }
37
- #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input {
38
- background-color: transparent;
39
- border-width: 0;
40
- outline: none;
41
- box-shadow: none;
42
- padding: 0; }
43
- #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input:after {
44
- content: "edit";
45
- display: block;
46
- width: 10px;
47
- right: 0;
48
- position: absolute; }
49
- #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input:focus {
50
- background: #fff;
51
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
52
- border: 1px solid #ddd;
53
- padding: 2px; }
54
- #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input:focus:after {
55
- content: ""; }
56
- #wpcf7cf-conditional-panel .wpcf7cf-and {
57
- display: inline-block; }
58
- #wpcf7cf-conditional-panel .wpcf7cf-and-rules, #wpcf7cf-conditional-panel .wpcf7cf-if {
59
- display: inline-block;
60
- vertical-align: top; }
61
- #wpcf7cf-conditional-panel #wpcf7cf-entries input, #wpcf7cf-conditional-panel #wpcf7cf-entries select, #wpcf7cf-conditional-panel .and-button, #wpcf7cf-conditional-panel .delete-button, #wpcf7cf-conditional-panel #wpcf7cf-entries .if-txt, #wpcf7cf-conditional-panel #wpcf7cf-entries .label, #wpcf7cf-conditional-panel #wpcf7cf-add-button {
62
- position: relative;
63
- display: inline-block;
64
- vertical-align: bottom;
65
- margin: 2px;
66
- padding: 3px;
67
- background: #fefefe;
68
- border: 1px solid #bababa;
69
- box-shadow: none;
70
- height: 22px;
71
- line-height: 22px;
72
- box-sizing: content-box; }
73
- #wpcf7cf-conditional-panel #wpcf7cf-entries .label {
74
- background-color: transparent;
75
- border: none; }
76
- #wpcf7cf-conditional-panel .and-button, #wpcf7cf-conditional-panel .delete-button, #wpcf7cf-conditional-panel #wpcf7cf-add-button {
77
- border: 1px solid #4ed521;
78
- color: #007b04;
79
- cursor: pointer;
80
- font-size: 11px;
81
- font-weight: bold;
82
- -webkit-touch-callout: none;
83
- /* iOS Safari */
84
- -webkit-user-select: none;
85
- /* Safari */
86
- -khtml-user-select: none;
87
- /* Konqueror HTML */
88
- -moz-user-select: none;
89
- /* Firefox */
90
- -ms-user-select: none;
91
- /* Internet Explorer/Edge */
92
- user-select: none;
93
- /* Non-prefixed version, currently */
94
- background-color: rgba(75, 169, 61, 0.11); }
95
- #wpcf7cf-conditional-panel #wpcf7cf-add-button {
96
- margin-top: 10px;
97
- text-align: center;
98
- padding-left: 20px;
99
- padding-right: 20px; }
100
- #wpcf7cf-conditional-panel .and-button:hover {
101
- background-color: rgba(75, 169, 61, 0.2); }
102
- #wpcf7cf-conditional-panel .delete-button {
103
- border: 1px solid #bababa;
104
- color: #858585;
105
- background-color: transparent;
106
- margin-left: 42px; }
107
- #wpcf7cf-conditional-panel .delete-button:hover {
108
- background-color: rgba(133, 133, 133, 0.11); }
109
- #wpcf7cf-conditional-panel .and-button {
110
- display: none;
111
- width: 30px;
112
- text-align: center; }
113
- #wpcf7cf-conditional-panel .wpcf7cf-and-rule:first-child .and-button {
114
- display: inline-block;
115
- vertical-align: top;
116
- height: 22px;
117
- position: absolute;
118
- line-height: 22px;
119
- right: 50px;
120
- top: 0; }
121
- #wpcf7cf-conditional-panel .wpcf7cf-and-rule {
122
- margin-bottom: 4px;
123
- height: 30px; }
124
- #wpcf7cf-conditional-panel .wpcf7cf-and-rule .if-txt, #wpcf7cf-conditional-panel .wpcf7cf-if > .label {
125
- cursor: n-resize; }
126
- #wpcf7cf-conditional-panel .wpcf7cf-and-rule .if-txt:before {
127
- content: 'and';
128
- position: absolute;
129
- width: 30px;
130
- text-align: right;
131
- left: -34px; }
132
- #wpcf7cf-conditional-panel .wpcf7cf-and-rule:first-child .if-txt:before {
133
- display: none; }
134
- #wpcf7cf-conditional-panel .wpcf7cf-inner-container {
135
- min-width: 800px; }
136
- #wpcf7cf-conditional-panel .entry {
137
- box-sizing: border-box;
138
- display: flex; }
139
- #wpcf7cf-conditional-panel .entry .wpcf7cf-if {
140
- width: 188px; }
141
- #wpcf7cf-conditional-panel .then-field-select {
142
- width: 130px; }
143
- #wpcf7cf-conditional-panel .entry .wpcf7cf-and-rules {
144
- flex: 1;
145
- position: relative; }
146
- #wpcf7cf-conditional-panel .wpcf7cf-and-rule {
147
- display: flex; }
148
- #wpcf7cf-conditional-panel .if-txt {
149
- width: 14px;
150
- text-align: center; }
151
- #wpcf7cf-conditional-panel .operator {
152
- /*width:140px;*/ }
153
- #wpcf7cf-conditional-panel .if-value {
154
- flex: 1;
155
- margin-right: 3px !important; }
156
-
157
- .wpcf7cf-list li {
158
- list-style: disc;
159
- margin-left: 20px; }
160
-
161
- /*# sourceMappingURL=admin-style.css.map */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wpcf7cf-new-entry {
2
+ display: inline-block;
3
+ display: none; }
4
+
5
+ #wpcf7cf-delete-button {
6
+ display: none; }
7
+
8
+ #wpcf7cf-settings-text {
9
+ width: 100%;
10
+ height: 280px;
11
+ font-family: "Courier New", Courier, monospace; }
12
+
13
+ #wpcf7cf-conditional-panel {
14
+ overflow-x: auto; }
15
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .label, #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .field, #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .description {
16
+ padding: 10px;
17
+ display: inline-block;
18
+ vertical-align: middle;
19
+ width: 10%; }
20
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .field {
21
+ width: 20%; }
22
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .description {
23
+ width: 40%;
24
+ vertical-align: top; }
25
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line {
26
+ border-bottom: 1px solid #dddddd;
27
+ background-color: #f9f9f9;
28
+ padding: 0 10px; }
29
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line:nth-child(2n) {
30
+ background-color: #e9e9e9; }
31
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line input, #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line select {
32
+ width: 100%; }
33
+ #wpcf7cf-conditional-panel .ui-autocomplete-term {
34
+ font-weight: bold; }
35
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable {
36
+ position: relative; }
37
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input {
38
+ background-color: transparent;
39
+ border-width: 0;
40
+ outline: none;
41
+ box-shadow: none;
42
+ padding: 0; }
43
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input:after {
44
+ content: "edit";
45
+ display: block;
46
+ width: 10px;
47
+ right: 0;
48
+ position: absolute; }
49
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input:focus {
50
+ background: #fff;
51
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
52
+ border: 1px solid #ddd;
53
+ padding: 2px; }
54
+ #wpcf7cf-conditional-panel .wpcf7cf-admin-wrap .option-line > .label.editable input:focus:after {
55
+ content: ""; }
56
+ #wpcf7cf-conditional-panel .wpcf7cf-and {
57
+ display: inline-block; }
58
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rules, #wpcf7cf-conditional-panel .wpcf7cf-if {
59
+ display: inline-block;
60
+ vertical-align: top; }
61
+ #wpcf7cf-conditional-panel #wpcf7cf-entries input, #wpcf7cf-conditional-panel #wpcf7cf-entries select, #wpcf7cf-conditional-panel .and-button, #wpcf7cf-conditional-panel .delete-button, #wpcf7cf-conditional-panel #wpcf7cf-entries .if-txt, #wpcf7cf-conditional-panel #wpcf7cf-entries .label, #wpcf7cf-conditional-panel #wpcf7cf-add-button {
62
+ position: relative;
63
+ display: inline-block;
64
+ vertical-align: bottom;
65
+ margin: 2px;
66
+ padding: 3px;
67
+ background: #fefefe;
68
+ border: 1px solid #bababa;
69
+ box-shadow: none;
70
+ height: 22px;
71
+ line-height: 22px;
72
+ box-sizing: content-box; }
73
+ #wpcf7cf-conditional-panel #wpcf7cf-entries .label {
74
+ background-color: transparent;
75
+ border: none; }
76
+ #wpcf7cf-conditional-panel .and-button, #wpcf7cf-conditional-panel .delete-button, #wpcf7cf-conditional-panel #wpcf7cf-add-button {
77
+ border: 1px solid #4ed521;
78
+ color: #007b04;
79
+ cursor: pointer;
80
+ font-size: 11px;
81
+ font-weight: bold;
82
+ -webkit-touch-callout: none;
83
+ /* iOS Safari */
84
+ -webkit-user-select: none;
85
+ /* Safari */
86
+ -khtml-user-select: none;
87
+ /* Konqueror HTML */
88
+ -moz-user-select: none;
89
+ /* Firefox */
90
+ -ms-user-select: none;
91
+ /* Internet Explorer/Edge */
92
+ user-select: none;
93
+ /* Non-prefixed version, currently */
94
+ background-color: rgba(75, 169, 61, 0.11); }
95
+ #wpcf7cf-conditional-panel #wpcf7cf-add-button {
96
+ margin-top: 10px;
97
+ text-align: center;
98
+ padding-left: 20px;
99
+ padding-right: 20px; }
100
+ #wpcf7cf-conditional-panel .and-button:hover {
101
+ background-color: rgba(75, 169, 61, 0.2); }
102
+ #wpcf7cf-conditional-panel .delete-button {
103
+ border: 1px solid #bababa;
104
+ color: #858585;
105
+ background-color: transparent;
106
+ margin-left: 42px; }
107
+ #wpcf7cf-conditional-panel .delete-button:hover {
108
+ background-color: rgba(133, 133, 133, 0.11); }
109
+ #wpcf7cf-conditional-panel .and-button {
110
+ display: none;
111
+ width: 30px;
112
+ text-align: center; }
113
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule:first-child .and-button {
114
+ display: inline-block;
115
+ vertical-align: top;
116
+ height: 22px;
117
+ position: absolute;
118
+ line-height: 22px;
119
+ right: 50px;
120
+ top: 0; }
121
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule {
122
+ margin-bottom: 4px;
123
+ height: 30px; }
124
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule .if-txt, #wpcf7cf-conditional-panel .wpcf7cf-if > .label {
125
+ cursor: n-resize; }
126
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule .if-txt:before {
127
+ content: 'and';
128
+ position: absolute;
129
+ width: 30px;
130
+ text-align: right;
131
+ left: -34px; }
132
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule:first-child .if-txt:before {
133
+ display: none; }
134
+ #wpcf7cf-conditional-panel .wpcf7cf-inner-container {
135
+ min-width: 800px; }
136
+ #wpcf7cf-conditional-panel .entry {
137
+ box-sizing: border-box;
138
+ display: flex; }
139
+ #wpcf7cf-conditional-panel .entry .wpcf7cf-if {
140
+ width: 188px; }
141
+ #wpcf7cf-conditional-panel .then-field-select {
142
+ width: 130px; }
143
+ #wpcf7cf-conditional-panel .entry .wpcf7cf-and-rules {
144
+ flex: 1;
145
+ position: relative; }
146
+ #wpcf7cf-conditional-panel .wpcf7cf-and-rule {
147
+ display: flex; }
148
+ #wpcf7cf-conditional-panel .if-txt {
149
+ width: 14px;
150
+ text-align: center; }
151
+ #wpcf7cf-conditional-panel .operator {
152
+ /*width:140px;*/ }
153
+ #wpcf7cf-conditional-panel .if-value {
154
+ flex: 1;
155
+ margin-right: 3px !important; }
156
+
157
+ .wpcf7cf-list li {
158
+ list-style: disc;
159
+ margin-left: 20px; }
160
+
161
+ /* The switch - the box around the slider */
162
+ .wpcf7cf-switch {
163
+ position: absolute;
164
+ display: block;
165
+ top: 20px;
166
+ right: 20px; }
167
+ .wpcf7cf-switch .label {
168
+ margin-right: 4px;
169
+ display: inline-block;
170
+ vertical-align: top; }
171
+ .wpcf7cf-switch .switch {
172
+ position: relative;
173
+ display: inline-block;
174
+ width: 30px;
175
+ height: 17px;
176
+ /* Hide default HTML checkbox */
177
+ /* The slider */
178
+ /* Rounded sliders */ }
179
+ .wpcf7cf-switch .switch input {
180
+ opacity: 0;
181
+ width: 0;
182
+ height: 0; }
183
+ .wpcf7cf-switch .switch .slider {
184
+ position: absolute;
185
+ cursor: pointer;
186
+ top: 0;
187
+ left: 0;
188
+ right: 0;
189
+ bottom: 0;
190
+ background-color: #ccc;
191
+ -webkit-transition: .4s;
192
+ transition: .4s; }
193
+ .wpcf7cf-switch .switch .slider:before {
194
+ position: absolute;
195
+ content: "";
196
+ height: 13px;
197
+ width: 13px;
198
+ left: 2px;
199
+ bottom: 2px;
200
+ background-color: white;
201
+ -webkit-transition: .4s;
202
+ transition: .3s; }
203
+ .wpcf7cf-switch .switch input:checked + .slider {
204
+ background-color: #1e8cbe; }
205
+ .wpcf7cf-switch .switch input:focus + .slider {
206
+ box-shadow: 0 0 1px #1e8cbe; }
207
+ .wpcf7cf-switch .switch input:checked + .slider:before {
208
+ -webkit-transform: translateX(13px);
209
+ -ms-transform: translateX(13px);
210
+ transform: translateX(13px); }
211
+ .wpcf7cf-switch .switch .slider.round {
212
+ border-radius: 17px; }
213
+ .wpcf7cf-switch .switch .slider.round:before {
214
+ border-radius: 50%; }
215
+
216
+ #wpcf7cf-conditional-panel {
217
+ position: relative; }
218
+
219
+ .wpcf7cf-notice {
220
+ background: #fff;
221
+ border: 1px solid #ccd0d4;
222
+ border-left-width: 4px;
223
+ border-left-color: #ffb900;
224
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
225
+ margin: 5px 0 2px;
226
+ padding: 1px 12px; }
admin-style.scss CHANGED
@@ -218,4 +218,97 @@
218
  .wpcf7cf-list li {
219
  list-style: disc;
220
  margin-left: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
218
  .wpcf7cf-list li {
219
  list-style: disc;
220
  margin-left: 20px;
221
+ }
222
+
223
+ /* The switch - the box around the slider */
224
+
225
+
226
+ .wpcf7cf-switch {
227
+ position: absolute;
228
+ display: block;
229
+ top: 20px;
230
+ right: 20px;
231
+
232
+ .label {
233
+ margin-right: 4px;
234
+ display: inline-block;
235
+ vertical-align: top;
236
+ }
237
+
238
+ .switch {
239
+ position: relative;
240
+ display: inline-block;
241
+ width: 30px;
242
+ height: 17px;
243
+
244
+ /* Hide default HTML checkbox */
245
+ input {
246
+ opacity: 0;
247
+ width: 0;
248
+ height: 0;
249
+ }
250
+
251
+ /* The slider */
252
+ .slider {
253
+ position: absolute;
254
+ cursor: pointer;
255
+ top: 0;
256
+ left: 0;
257
+ right: 0;
258
+ bottom: 0;
259
+ background-color: #ccc;
260
+ -webkit-transition: .4s;
261
+ transition: .4s;
262
+ }
263
+
264
+ .slider:before {
265
+ position: absolute;
266
+ content: "";
267
+ height: 13px;
268
+ width: 13px;
269
+ left: 2px;
270
+ bottom: 2px;
271
+ background-color: white;
272
+ -webkit-transition: .4s;
273
+ transition: .3s;
274
+ }
275
+
276
+ input:checked + .slider {
277
+ background-color: #1e8cbe;
278
+ }
279
+
280
+ input:focus + .slider {
281
+ box-shadow: 0 0 1px #1e8cbe;
282
+ }
283
+
284
+ input:checked + .slider:before {
285
+ -webkit-transform: translateX(13px);
286
+ -ms-transform: translateX(13px);
287
+ transform: translateX(13px);
288
+ }
289
+
290
+ /* Rounded sliders */
291
+ .slider.round {
292
+ border-radius: 17px;
293
+ }
294
+
295
+ .slider.round:before {
296
+ border-radius: 50%;
297
+ }
298
+
299
+ }
300
+ }
301
+
302
+ #wpcf7cf-conditional-panel {
303
+ position: relative;
304
+ }
305
+
306
+ .wpcf7cf-notice {
307
+ background: #fff;
308
+ border: 1px solid #ccd0d4;
309
+ border-left-width: 4px;
310
+ border-left-color: #ffb900;
311
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
312
+ margin: 5px 0 2px;
313
+ padding: 1px 12px;
314
  }
admin.php CHANGED
@@ -70,6 +70,11 @@ if (!function_exists('all_operator_options')) {
70
 
71
  function wpcf7cf_editor_panel_conditional($form) {
72
 
 
 
 
 
 
73
  $form_id = isset($_GET['post']) ? $_GET['post'] : false;
74
 
75
  if ($form_id === false) {
@@ -90,27 +95,44 @@ function wpcf7cf_editor_panel_conditional($form) {
90
 
91
  ?>
92
  <div class="wpcf7cf-inner-container">
93
- <h2><?php echo esc_html( __( 'Conditional fields', 'wpcf7cf' ) ); ?></h2>
94
 
95
- <?php
96
- print_entries_html($form);
97
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
- <div id="wpcf7cf-entries">
100
- <?php
101
- print_entries_html($form, $wpcf7cf_entries);
102
- ?>
103
  </div>
104
-
105
- <span id="wpcf7cf-add-button" title="add new rule">+ add new conditional rule</span>
106
 
107
  <div id="wpcf7cf-text-entries">
108
- <p><a href="#" id="wpcf7cf-settings-to-text">Text view</a></p>
109
  <div id="wpcf7cf-settings-text-wrap">
110
- <textarea id="wpcf7cf-settings-text" name="wpcf7cf-settings-text"></textarea>
 
111
  <br>
112
- <input type="button" value="Update fields">
113
- <p><a href="#" id="wpcf7cf-settings-text-clear">Hide</a></p>
114
  </div>
115
  </div>
116
  </div>
@@ -208,8 +230,8 @@ function print_entries_html($form, $wpcf7cf_entries = false) {
208
  )
209
  )
210
  );
211
- }
212
-
213
  foreach($wpcf7cf_entries as $i => $entry) {
214
 
215
  // check for backwards compatibility ( < 2.0 )
@@ -220,13 +242,9 @@ function print_entries_html($form, $wpcf7cf_entries = false) {
220
  $and_entries = array_values($wpcf7cf_entries[$i]['and_rules']);
221
 
222
  if ($is_dummy) {
223
- ?>
224
- <div id="wpcf7cf-new-entry">
225
- <?php
226
  } else {
227
- ?>
228
- <div class="entry" id="entry-<?php echo $i ?>">
229
- <?php
230
  }
231
  ?>
232
  <div class="wpcf7cf-if">
@@ -253,7 +271,7 @@ function print_entries_html($form, $wpcf7cf_entries = false) {
253
  }
254
  ?>
255
  </div>
256
- </div>
257
  <?php
 
258
  }
259
  }
70
 
71
  function wpcf7cf_editor_panel_conditional($form) {
72
 
73
+ $settings = wpcf7cf_get_settings();
74
+ $is_text_only = $settings['conditions_ui'] === 'text_only';
75
+
76
+ // print_r($settings);
77
+
78
  $form_id = isset($_GET['post']) ? $_GET['post'] : false;
79
 
80
  if ($form_id === false) {
95
 
96
  ?>
97
  <div class="wpcf7cf-inner-container">
 
98
 
99
+ <label class="wpcf7cf-switch" id="wpcf7cf-text-only-switch">
100
+ <span class="label">Text mode</span>
101
+ <span class="switch">
102
+ <input type="checkbox" id="wpcf7cf-text-only-checkbox" name="wpcf7cf-text-only-checkbox" value="text_only" <?php echo $is_text_only ? 'checked':''; ?>>
103
+ <span class="slider round"></span>
104
+ </span>
105
+ </label>
106
+
107
+ <h2><?php echo esc_html( __( 'Conditional fields', 'wpcf7cf' ) ); ?></h2>
108
+
109
+ <div id="wpcf7cf-entries-ui" style="display:none">
110
+ <?php
111
+ print_entries_html($form);
112
+ ?>
113
+ <div id="wpcf7cf-entries">
114
+ <?php
115
+ //print_entries_html($form, $wpcf7cf_entries);
116
+ ?>
117
+ </div>
118
+
119
+ <span id="wpcf7cf-add-button" title="add new rule">+ add new conditional rule</span>
120
+
121
+ <div id="wpcf7cf-a-lot-of-conditions" class="wpcf7cf-notice notice-warning" style="display:none;">
122
+ <p>
123
+ <strong>Wow, That's a lot of conditions!</strong><br>
124
+ You can only add up to <?php echo WPCF7CF_MAX_RECOMMENDED_CONDITIONS ?> conditions using this interface.
125
+ Please switch to <strong>Text mode</strong> if you want to add more than <?php echo WPCF7CF_MAX_RECOMMENDED_CONDITIONS ?> conditions.
126
+ </p>
127
+ </div>
128
 
 
 
 
 
129
  </div>
 
 
130
 
131
  <div id="wpcf7cf-text-entries">
 
132
  <div id="wpcf7cf-settings-text-wrap">
133
+
134
+ <textarea id="wpcf7cf-settings-text" name="wpcf7cf-settings-text"><?php echo CF7CF::serializeConditions($wpcf7cf_entries) ?></textarea>
135
  <br>
 
 
136
  </div>
137
  </div>
138
  </div>
230
  )
231
  )
232
  );
233
+ }
234
+
235
  foreach($wpcf7cf_entries as $i => $entry) {
236
 
237
  // check for backwards compatibility ( < 2.0 )
242
  $and_entries = array_values($wpcf7cf_entries[$i]['and_rules']);
243
 
244
  if ($is_dummy) {
245
+ echo '<div id="wpcf7cf-new-entry">';
 
 
246
  } else {
247
+ echo '<div class="entry">';
 
 
248
  }
249
  ?>
250
  <div class="wpcf7cf-if">
271
  }
272
  ?>
273
  </div>
 
274
  <?php
275
+ echo '</div>';
276
  }
277
  }
cf7cf.php CHANGED
@@ -348,6 +348,39 @@ class CF7CF {
348
  return is_array($options) ? $options : array(); // the meta key 'wpcf7cf_options' is a bit misleading at this point, because it only holds the form's conditions, no other options/settings
349
  }
350
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
 
352
  /**
353
  * save the conditions to the form's post_meta
348
  return is_array($options) ? $options : array(); // the meta key 'wpcf7cf_options' is a bit misleading at this point, because it only holds the form's conditions, no other options/settings
349
  }
350
 
351
+ /**
352
+ * load the conditions from the form's post_meta as plain text
353
+ *
354
+ * @param string $form_id
355
+ * @return void
356
+ */
357
+ public static function getConditionsPlainText($form_id) {
358
+ return CF7CF::serializeConditions(CF7CF::getConditions($form_id));
359
+ }
360
+
361
+ public static function serializeConditions($array) {
362
+
363
+ $lines = [];
364
+
365
+ foreach ($array as $entry) {
366
+ $then_field = $entry['then_field'];
367
+ $and_rules = $entry['and_rules'];
368
+ $indent = strlen($then_field) + 4;
369
+ foreach ($and_rules as $i => $rule) {
370
+ $if_field = $rule['if_field'];
371
+ $operator = $rule['operator'];
372
+ $if_value = $rule['if_value'];
373
+
374
+ if ($i == 0) {
375
+ $lines[] = "show [${then_field}] if [${if_field}] ${operator} \"${if_value}\"";
376
+ } else {
377
+ $lines[] = str_repeat(' ',$indent)."and if [${if_field}] ${operator} \"${if_value}\"";
378
+ }
379
+ }
380
+ }
381
+
382
+ return implode("\n", $lines);
383
+ }
384
 
385
  /**
386
  * save the conditions to the form's post_meta
contact-form-7-conditional-fields.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Contact Form 7 Conditional Fields
4
  Plugin URI: http://bdwm.be/
5
  Description: Adds support for conditional fields to Contact Form 7. This plugin depends on Contact Form 7.
6
  Author: Jules Colle
7
- Version: 1.8.7
8
  Author URI: http://bdwm.be/
9
  */
10
 
4
  Plugin URI: http://bdwm.be/
5
  Description: Adds support for conditional fields to Contact Form 7. This plugin depends on Contact Form 7.
6
  Author: Jules Colle
7
+ Version: 1.9
8
  Author URI: http://bdwm.be/
9
  */
10
 
init.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- if (!defined('WPCF7CF_VERSION')) define( 'WPCF7CF_VERSION', '1.8.7' );
4
  if (!defined('WPCF7CF_REQUIRED_WP_VERSION')) define( 'WPCF7CF_REQUIRED_WP_VERSION', '4.1' );
5
  if (!defined('WPCF7CF_PLUGIN')) define( 'WPCF7CF_PLUGIN', __FILE__ );
6
  if (!defined('WPCF7CF_PLUGIN_BASENAME')) define( 'WPCF7CF_PLUGIN_BASENAME', plugin_basename( WPCF7CF_PLUGIN ) );
@@ -13,6 +13,7 @@ if (!defined('WPCF7CF_LOAD_CSS')) define('WPCF7CF_LOAD_CSS', true);
13
  if (!defined('WPCF7CF_REGEX_MAIL_GROUP')) define( 'WPCF7CF_REGEX_MAIL_GROUP', '@\[[\s]*([a-zA-Z_][0-9a-zA-Z:._-]*)[\s]*\](.*?)\[[\s]*/[\s]*\1[\s]*\]@s');
14
  if (!defined('WPCF7CF_REGEX_CONDITIONS')) define( 'WPCF7CF_REGEX_CONDITIONS', '/(?:show \[([^\]]*?)\]|and) if \[([^\]]*?)\] (?:(equals \(regex\)|not equals \(regex\)|equals|not equals|greater than or equals|greater than|less than or equals|less than|is empty|not empty|function)(?: \"(.*)\")?)/m');
15
 
 
16
 
17
  if(file_exists(WPCF7CF_PLUGIN_DIR.'/pro/pro-functions.php')) {
18
  if (!defined('WPCF7CF_IS_PRO')) define( 'WPCF7CF_IS_PRO', true );
@@ -20,10 +21,9 @@ if(file_exists(WPCF7CF_PLUGIN_DIR.'/pro/pro-functions.php')) {
20
  if (!defined('WPCF7CF_IS_PRO')) define( 'WPCF7CF_IS_PRO', false );
21
  }
22
 
23
-
24
  if(file_exists(WPCF7CF_PLUGIN_DIR.'/tests/init.php')) {
25
- if (!defined('WPCF7CF_TESTMODE')) define( 'WPCF7CF_TESTMODE', true );
26
  require_once WPCF7CF_PLUGIN_DIR.'/tests/init.php';
 
27
  }
28
 
29
  function wpcf7cf_plugin_path( $path = '' ) {
1
  <?php
2
 
3
+ if (!defined('WPCF7CF_VERSION')) define( 'WPCF7CF_VERSION', '1.9' );
4
  if (!defined('WPCF7CF_REQUIRED_WP_VERSION')) define( 'WPCF7CF_REQUIRED_WP_VERSION', '4.1' );
5
  if (!defined('WPCF7CF_PLUGIN')) define( 'WPCF7CF_PLUGIN', __FILE__ );
6
  if (!defined('WPCF7CF_PLUGIN_BASENAME')) define( 'WPCF7CF_PLUGIN_BASENAME', plugin_basename( WPCF7CF_PLUGIN ) );
13
  if (!defined('WPCF7CF_REGEX_MAIL_GROUP')) define( 'WPCF7CF_REGEX_MAIL_GROUP', '@\[[\s]*([a-zA-Z_][0-9a-zA-Z:._-]*)[\s]*\](.*?)\[[\s]*/[\s]*\1[\s]*\]@s');
14
  if (!defined('WPCF7CF_REGEX_CONDITIONS')) define( 'WPCF7CF_REGEX_CONDITIONS', '/(?:show \[([^\]]*?)\]|and) if \[([^\]]*?)\] (?:(equals \(regex\)|not equals \(regex\)|equals|not equals|greater than or equals|greater than|less than or equals|less than|is empty|not empty|function)(?: \"(.*)\")?)/m');
15
 
16
+ if (!defined('WPCF7CF_MAX_RECOMMENDED_CONDITIONS')) define( 'WPCF7CF_MAX_RECOMMENDED_CONDITIONS', 50 );
17
 
18
  if(file_exists(WPCF7CF_PLUGIN_DIR.'/pro/pro-functions.php')) {
19
  if (!defined('WPCF7CF_IS_PRO')) define( 'WPCF7CF_IS_PRO', true );
21
  if (!defined('WPCF7CF_IS_PRO')) define( 'WPCF7CF_IS_PRO', false );
22
  }
23
 
 
24
  if(file_exists(WPCF7CF_PLUGIN_DIR.'/tests/init.php')) {
 
25
  require_once WPCF7CF_PLUGIN_DIR.'/tests/init.php';
26
+ if (!defined('WPCF7CF_TESTMODE')) define( 'WPCF7CF_TESTMODE', true );
27
  }
28
 
29
  function wpcf7cf_plugin_path( $path = '' ) {
js/scripts.js CHANGED
@@ -106,7 +106,19 @@ __webpack_require__.r(__webpack_exports__);
106
  var cf7signature_resized = 0; // for compatibility with contact-form-7-signature-addon
107
 
108
  var wpcf7cf_timeout;
109
- var wpcf7cf_change_time_ms = window.wpcf7cf_running_tests ? 0 : 100;
 
 
 
 
 
 
 
 
 
 
 
 
110
  var wpcf7cf_show_animation = {
111
  "height": "show",
112
  "marginTop": "show",
@@ -128,7 +140,23 @@ var wpcf7cf_hide_step_animation = {
128
  "opacity": "hide"
129
  };
130
  var wpcf7cf_change_events = 'input.wpcf7cf paste.wpcf7cf change.wpcf7cf click.wpcf7cf propertychange.wpcf7cf';
131
- var wpcf7cf_forms = []; // endswith polyfill
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
  if (!String.prototype.endsWith) {
134
  String.prototype.endsWith = function (search, this_len) {
@@ -157,7 +185,13 @@ var Wpcf7cfForm = function Wpcf7cfForm($form) {
157
  form.$input_repeaters = $form.find('[name="_wpcf7cf_repeaters"]');
158
  form.$input_steps = $form.find('[name="_wpcf7cf_steps"]');
159
  form.unit_tag = $form.closest('.wpcf7').attr('id');
160
- form.conditions = form_options['conditions']; // compatibility with conditional forms created with older versions of the plugin ( < 1.4 )
 
 
 
 
 
 
161
 
162
  for (var i = 0; i < form.conditions.length; i++) {
163
  var condition = form.conditions[i];
@@ -202,13 +236,13 @@ var Wpcf7cfForm = function Wpcf7cfForm($form) {
202
  }, 200);
203
  }); // PRO ONLY
204
 
205
- jQuery('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)', $form).each(function () {
206
  form.repeaters.push(new Wpcf7cfRepeater(jQuery(this), form));
207
  });
208
  form.$input_repeaters.val(JSON.stringify(form.repeaters.map(function (item) {
209
  return item.params.$repeater.id;
210
  })));
211
- var $multistep = jQuery('.wpcf7cf_multistep', $form);
212
 
213
  if ($multistep.length) {
214
  form.multistep = new Wpcf7cfMultistep($multistep, form); // window.wpcf7cf.updateMultistepState(form.multistep);
@@ -230,8 +264,6 @@ Wpcf7cfForm.prototype.resetRepeaters = function () {
230
 
231
  Wpcf7cfForm.prototype.displayFields = function () {
232
  var form = this;
233
- window.wpcf7cf.get_simplified_dom_model(form.$form);
234
- var unit_tag = this.unit_tag;
235
  var wpcf7cf_conditions = this.conditions;
236
  var wpcf7cf_settings = this.settings; //for compatibility with contact-form-7-signature-addon
237
 
@@ -248,13 +280,14 @@ Wpcf7cfForm.prototype.displayFields = function () {
248
  }
249
 
250
  form.$groups.addClass('wpcf7cf-hidden');
 
251
 
252
  for (var i = 0; i < wpcf7cf_conditions.length; i++) {
253
  var condition = wpcf7cf_conditions[i];
254
- var show_group = window.wpcf7cf.should_group_be_shown(condition, form.$form);
255
 
256
  if (show_group) {
257
- jQuery('[data-id="' + condition.then_field + '"]', form.$form).eq(0).removeClass('wpcf7cf-hidden');
258
  }
259
  }
260
 
@@ -303,13 +336,22 @@ Wpcf7cfForm.prototype.displayFields = function () {
303
  };
304
 
305
  Wpcf7cfForm.prototype.updateSummaryFields = function () {
306
- var $summary = jQuery('.wpcf7cf-summary', this.$form);
 
307
  if ($summary.length == 0 || !$summary.is(':visible')) return;
308
  var fd = new FormData();
309
- var formdata = this.$form.serializeArray();
310
  jQuery.each(formdata, function (key, input) {
311
  fd.append(input.name, input.value);
312
- });
 
 
 
 
 
 
 
 
313
  jQuery.ajax({
314
  url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary',
315
  type: 'POST',
@@ -356,9 +398,9 @@ Wpcf7cfForm.prototype.updateGroups = function () {
356
  };
357
 
358
  Wpcf7cfForm.prototype.updateEventListeners = function () {
359
- var form = this; // monitor input changes, and call display_fields() if something has changed
360
 
361
- jQuery('input, select, textarea, button', form.$form).not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events, form, function (e) {
362
  var form = e.data;
363
  clearTimeout(wpcf7cf_timeout);
364
  wpcf7cf_timeout = setTimeout(function () {
@@ -366,7 +408,7 @@ Wpcf7cfForm.prototype.updateEventListeners = function () {
366
  }, wpcf7cf_change_time_ms);
367
  }); // PRO ONLY
368
 
369
- jQuery('.wpcf7cf-togglebutton', form.$form).off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf', function () {
370
  var $this = jQuery(this);
371
 
372
  if ($this.text() === $this.data('val-1')) {
@@ -612,7 +654,7 @@ function Wpcf7cfMultistep($multistep, form) {
612
  }
613
  }
614
  }, _callee);
615
- }))); // If form is submitted (by pressing return for example), and if we are not on the last step,
616
  // then trigger click event on the $btn_next button instead.
617
 
618
  multistep.form.$form.on('submit.wpcf7cf_step', function (e) {
@@ -638,6 +680,7 @@ Wpcf7cfMultistep.prototype.validateStep = function (step_index) {
638
  var multistep = this;
639
  var $multistep = multistep.$multistep;
640
  var $form = multistep.form.$form;
 
641
  $form.find('.wpcf7-response-output').addClass('wpcf7-display-none');
642
  return new Promise(function (resolve) {
643
  var fd = new FormData(); // Make sure to add file fields to FormData
@@ -670,7 +713,7 @@ Wpcf7cfMultistep.prototype.validateStep = function (step_index) {
670
  jQuery.each(json.invalid_fields, function (index, el) {
671
  if ($multistep.find('input[name="' + index + '"]').length || $multistep.find('input[name="' + index + '[]"]').length || $multistep.find('select[name="' + index + '"]').length || $multistep.find('select[name="' + index + '[]"]').length || $multistep.find('textarea[name="' + index + '"]').length || $multistep.find('textarea[name="' + index + '[]"]').length) {
672
  checkError = checkError + 1;
673
- var controlWrap = jQuery('.wpcf7-form-control-wrap.' + index, $form);
674
  controlWrap.find('input').addClass('wpcf7-not-valid');
675
  controlWrap.find('span.wpcf7-not-valid-tip').remove();
676
  controlWrap.append('<span role="alert" class="wpcf7-not-valid-tip">' + el.reason + '</span>');
@@ -713,11 +756,11 @@ Wpcf7cfMultistep.prototype.moveToStep = function (step_index) {
713
  };
714
 
715
  Wpcf7cfMultistep.prototype.getFieldsInStep = function (step_index) {
716
- var simpleDom = window.wpcf7cf.get_simplified_dom_model(this.form.$form);
717
  var inStep = false;
718
- return simpleDom.filter(function (item, i) {
719
  if (item.type == 'step') {
720
- inStep = item.step == step_index + '';
721
  }
722
 
723
  return inStep && item.type == 'input';
@@ -734,8 +777,8 @@ window.wpcf7cf = {
734
  },
735
  get_nested_conditions: function get_nested_conditions(conditions, $current_form) {
736
  //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index
737
- var simplified_dom = window.wpcf7cf.get_simplified_dom_model($current_form);
738
- var groups = simplified_dom.filter(function (item, i) {
739
  return item.type === 'group';
740
  });
741
  var sub_conditions = [];
@@ -760,73 +803,55 @@ window.wpcf7cf = {
760
  sub_conditions = sub_conditions.concat(relevant_conditions);
761
  }
762
 
763
- return conditions.concat(sub_conditions);
764
  },
765
  get_simplified_dom_model: function get_simplified_dom_model($current_form) {
766
- // if the dom is something like:
767
- // <form>
768
- // <repeater ra>
769
- // <group ga__1>
770
- // <repeater rb__1>
771
- // <input txta__1__1 />
772
- // <input txta__1__2 />
773
- // </repeater>
774
- // <group gb__1>
775
- // <input txtb__1 />
776
- // </group>
777
- // </group>
778
- // <group ga__2>
779
- // <repeater rb__2>
780
- // <input txta__2__1 />
781
- // </repeater>
782
- // <group gb__2>
783
- // <input txtb__2 />
784
- // </group>
785
- // </group>
786
- // </repeater>
787
- // </form>
788
- //
789
- // return something like:
790
- // [{type:repeater, name:'ra', suffix: '__1'}, {type: group, name:'ga', suffix: '__1'}, ...]
791
  var currentNode;
792
  var ni = document.createNodeIterator($current_form[0], NodeFilter.SHOW_ELEMENT, null, false); //, NodeFilter.SHOW_ELEMENT, function(){ return NodeFilter.FILTER_ACCEPT; }
793
 
794
- var simplified_dom = [];
795
 
796
  while (currentNode = ni.nextNode()) {
797
- if (currentNode.classList.contains('wpcf7cf_repeater')) {
798
- simplified_dom.push({
799
- type: 'repeater',
800
- name: currentNode.dataset.id,
801
- original_name: currentNode.dataset.orig_data_id
802
- });
803
- } else if (currentNode.dataset["class"] == 'wpcf7cf_group') {
804
- simplified_dom.push({
805
- type: 'group',
806
- name: currentNode.dataset.id,
807
- original_name: currentNode.dataset.orig_data_id
808
- });
809
- } else if (currentNode.className == 'wpcf7cf_step') {
810
- simplified_dom.push({
811
- type: 'step',
812
- name: currentNode.dataset.id,
813
- original_name: currentNode.dataset.id,
814
- step: currentNode.dataset.id.substring(5)
815
- });
816
- } else if (currentNode.hasAttribute('name')) {
817
- simplified_dom.push({
818
- type: 'input',
819
- name: currentNode.getAttribute('name'),
820
- original_name: currentNode.getAttribute('data-orig_name')
821
- });
822
  }
823
- }
824
 
825
- simplified_dom = simplified_dom.map(function (item, i) {
826
- var original_name_length = item.original_name == null ? item.name.length : item.original_name.length;
827
- item.suffix = item.name.substring(original_name_length);
828
- return item;
829
- }); //console.table(simplified_dom);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
830
 
831
  return simplified_dom;
832
  },
@@ -840,15 +865,15 @@ window.wpcf7cf = {
840
  };
841
  multistep.form.$input_steps.val(JSON.stringify(stepsData)); // update Buttons
842
 
843
- multistep.$btn_prev.removeClass('disabled');
844
- multistep.$btn_next.removeClass('disabled');
845
 
846
  if (multistep.currentStep == multistep.numSteps) {
847
- multistep.$btn_next.addClass('disabled');
848
  }
849
 
850
  if (multistep.currentStep == 1) {
851
- multistep.$btn_prev.addClass('disabled');
852
  } // replace next button with submit button on last step.
853
  // TODO: make this depend on a setting
854
 
@@ -878,48 +903,21 @@ window.wpcf7cf = {
878
  }
879
  }
880
  },
881
- should_group_be_shown: function should_group_be_shown(condition, $current_form) {
882
- var $ = jQuery;
883
  var show_group = true;
884
 
885
  for (var and_rule_i = 0; and_rule_i < condition.and_rules.length; and_rule_i++) {
886
  var condition_ok = false;
887
  var condition_and_rule = condition.and_rules[and_rule_i];
888
- var $field = jQuery('[name="' + condition_and_rule.if_field + '"], [name="' + condition_and_rule.if_field + '[]"], [data-original-name="' + condition_and_rule.if_field + '"], [data-original-name="' + condition_and_rule.if_field + '[]"]', $current_form);
889
  var if_val = condition_and_rule.if_value;
890
- var if_val_as_number = isFinite(parseFloat(if_val)) ? parseFloat(if_val) : 0;
891
- var operator = condition_and_rule.operator;
892
- var regex_patt = /.*/i; // fallback regex pattern
893
-
894
- var isValidRegex = true;
895
-
896
- try {
897
- regex_patt = new RegExp(if_val, 'i');
898
- } catch (e) {
899
- isValidRegex = false;
900
- } //backwards compat
901
-
902
 
903
  operator = operator === '≤' ? 'less than or equals' : operator;
904
  operator = operator === '≥' ? 'greater than or equals' : operator;
905
  operator = operator === '>' ? 'greater than' : operator;
906
  operator = operator === '<' ? 'less than' : operator;
907
-
908
- if ($field.is(':checkbox') || $field.is(':radio')) {
909
- var all_values = [];
910
- var checked_values = [];
911
- $field.each(function () {
912
- all_values.push(jQuery(this).val());
913
-
914
- if (jQuery(this).is(':checked')) {
915
- checked_values.push(jQuery(this).val());
916
- }
917
- });
918
- condition_ok = this.isConditionTrue(checked_values, operator, if_val, $field);
919
- } else {
920
- condition_ok = this.isConditionTrue($field.val(), operator, if_val, $field);
921
- }
922
-
923
  show_group = show_group && condition_ok;
924
  }
925
 
106
  var cf7signature_resized = 0; // for compatibility with contact-form-7-signature-addon
107
 
108
  var wpcf7cf_timeout;
109
+ var wpcf7cf_change_time_ms = 100;
110
+
111
+ if (window.wpcf7cf_running_tests) {
112
+ jQuery('input[name="_wpcf7cf_options"]').each(function (e) {
113
+ var $input = jQuery(this);
114
+ var opt = JSON.parse($input.val());
115
+ opt.settings.animation_intime = 0;
116
+ opt.settings.animation_outtime = 0;
117
+ $input.val(JSON.stringify(opt));
118
+ });
119
+ wpcf7cf_change_time_ms = 0;
120
+ }
121
+
122
  var wpcf7cf_show_animation = {
123
  "height": "show",
124
  "marginTop": "show",
140
  "opacity": "hide"
141
  };
142
  var wpcf7cf_change_events = 'input.wpcf7cf paste.wpcf7cf change.wpcf7cf click.wpcf7cf propertychange.wpcf7cf';
143
+ var wpcf7cf_forms = [];
144
+ window.wpcf7cf_dom = {};
145
+
146
+ var wpcf7cf_reload_dom = function wpcf7cf_reload_dom($form) {
147
+ wpcf7cf_dom = wpcf7cf.get_simplified_dom_model($form);
148
+ };
149
+
150
+ var wpcf7cf_getFieldsByOriginalName = function wpcf7cf_getFieldsByOriginalName(originalName) {
151
+ return Object.values(wpcf7cf_dom).filter(function (inputField) {
152
+ return inputField.original_name === originalName || inputField.original_name === originalName + '[]';
153
+ });
154
+ };
155
+
156
+ var wpcf7cf_getFieldByName = function wpcf7cf_getFieldByName(name) {
157
+ return wpcf7cf_dom[name] || wpcf7cf_dom[name + '[]'];
158
+ }; // endsWith polyfill
159
+
160
 
161
  if (!String.prototype.endsWith) {
162
  String.prototype.endsWith = function (search, this_len) {
185
  form.$input_repeaters = $form.find('[name="_wpcf7cf_repeaters"]');
186
  form.$input_steps = $form.find('[name="_wpcf7cf_steps"]');
187
  form.unit_tag = $form.closest('.wpcf7').attr('id');
188
+ form.conditions = form_options['conditions']; // Wrapper around jQuery(selector, form.$form)
189
+
190
+ form.get = function (selector) {
191
+ // TODO: implement some caching here.
192
+ return jQuery(selector, form.$form);
193
+ }; // compatibility with conditional forms created with older versions of the plugin ( < 1.4 )
194
+
195
 
196
  for (var i = 0; i < form.conditions.length; i++) {
197
  var condition = form.conditions[i];
236
  }, 200);
237
  }); // PRO ONLY
238
 
239
+ form.get('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)').each(function () {
240
  form.repeaters.push(new Wpcf7cfRepeater(jQuery(this), form));
241
  });
242
  form.$input_repeaters.val(JSON.stringify(form.repeaters.map(function (item) {
243
  return item.params.$repeater.id;
244
  })));
245
+ var $multistep = form.get('.wpcf7cf_multistep');
246
 
247
  if ($multistep.length) {
248
  form.multistep = new Wpcf7cfMultistep($multistep, form); // window.wpcf7cf.updateMultistepState(form.multistep);
264
 
265
  Wpcf7cfForm.prototype.displayFields = function () {
266
  var form = this;
 
 
267
  var wpcf7cf_conditions = this.conditions;
268
  var wpcf7cf_settings = this.settings; //for compatibility with contact-form-7-signature-addon
269
 
280
  }
281
 
282
  form.$groups.addClass('wpcf7cf-hidden');
283
+ wpcf7cf_reload_dom(form.$form);
284
 
285
  for (var i = 0; i < wpcf7cf_conditions.length; i++) {
286
  var condition = wpcf7cf_conditions[i];
287
+ var show_group = window.wpcf7cf.should_group_be_shown(condition, form);
288
 
289
  if (show_group) {
290
+ form.get('[data-id="' + condition.then_field + '"]').removeClass('wpcf7cf-hidden');
291
  }
292
  }
293
 
336
  };
337
 
338
  Wpcf7cfForm.prototype.updateSummaryFields = function () {
339
+ var form = this;
340
+ var $summary = form.get('.wpcf7cf-summary');
341
  if ($summary.length == 0 || !$summary.is(':visible')) return;
342
  var fd = new FormData();
343
+ var formdata = form.$form.serializeArray();
344
  jQuery.each(formdata, function (key, input) {
345
  fd.append(input.name, input.value);
346
+ }); // Make sure to add file fields to FormData
347
+
348
+ jQuery.each(form.$form.find('input[type="file"]'), function (index, el) {
349
+ if (!el.files.length) return false;
350
+ var file = el.files[0];
351
+ var fieldName = el.name;
352
+ fd.append(fieldName, new Blob(), file.name);
353
+ }); // add file fields to form-data
354
+
355
  jQuery.ajax({
356
  url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary',
357
  type: 'POST',
398
  };
399
 
400
  Wpcf7cfForm.prototype.updateEventListeners = function () {
401
+ var form = this; // monitor input changes, and call displayFields() if something has changed
402
 
403
+ form.get('input, select, textarea, button').not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events, form, function (e) {
404
  var form = e.data;
405
  clearTimeout(wpcf7cf_timeout);
406
  wpcf7cf_timeout = setTimeout(function () {
408
  }, wpcf7cf_change_time_ms);
409
  }); // PRO ONLY
410
 
411
+ form.get('.wpcf7cf-togglebutton').off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf', function () {
412
  var $this = jQuery(this);
413
 
414
  if ($this.text() === $this.data('val-1')) {
654
  }
655
  }
656
  }, _callee);
657
+ }))); // If form is submitted (by pressing Enter for example), and if we are not on the last step,
658
  // then trigger click event on the $btn_next button instead.
659
 
660
  multistep.form.$form.on('submit.wpcf7cf_step', function (e) {
680
  var multistep = this;
681
  var $multistep = multistep.$multistep;
682
  var $form = multistep.form.$form;
683
+ var form = multistep.form;
684
  $form.find('.wpcf7-response-output').addClass('wpcf7-display-none');
685
  return new Promise(function (resolve) {
686
  var fd = new FormData(); // Make sure to add file fields to FormData
713
  jQuery.each(json.invalid_fields, function (index, el) {
714
  if ($multistep.find('input[name="' + index + '"]').length || $multistep.find('input[name="' + index + '[]"]').length || $multistep.find('select[name="' + index + '"]').length || $multistep.find('select[name="' + index + '[]"]').length || $multistep.find('textarea[name="' + index + '"]').length || $multistep.find('textarea[name="' + index + '[]"]').length) {
715
  checkError = checkError + 1;
716
+ var controlWrap = form.get('.wpcf7-form-control-wrap.' + index);
717
  controlWrap.find('input').addClass('wpcf7-not-valid');
718
  controlWrap.find('span.wpcf7-not-valid-tip').remove();
719
  controlWrap.append('<span role="alert" class="wpcf7-not-valid-tip">' + el.reason + '</span>');
756
  };
757
 
758
  Wpcf7cfMultistep.prototype.getFieldsInStep = function (step_index) {
759
+ wpcf7cf_reload_dom(this.form.$form);
760
  var inStep = false;
761
+ return Object.values(wpcf7cf_dom).filter(function (item, i) {
762
  if (item.type == 'step') {
763
+ inStep = item.val == step_index + '';
764
  }
765
 
766
  return inStep && item.type == 'input';
777
  },
778
  get_nested_conditions: function get_nested_conditions(conditions, $current_form) {
779
  //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index
780
+ wpcf7cf_reload_dom($current_form);
781
+ var groups = Object.values(wpcf7cf_dom).filter(function (item, i) {
782
  return item.type === 'group';
783
  });
784
  var sub_conditions = [];
803
  sub_conditions = sub_conditions.concat(relevant_conditions);
804
  }
805
 
806
+ return sub_conditions;
807
  },
808
  get_simplified_dom_model: function get_simplified_dom_model($current_form) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
809
  var currentNode;
810
  var ni = document.createNodeIterator($current_form[0], NodeFilter.SHOW_ELEMENT, null, false); //, NodeFilter.SHOW_ELEMENT, function(){ return NodeFilter.FILTER_ACCEPT; }
811
 
812
+ var simplified_dom = {};
813
 
814
  while (currentNode = ni.nextNode()) {
815
+ var type = currentNode.classList.contains('wpcf7cf_repeater') ? 'repeater' : currentNode.dataset["class"] == 'wpcf7cf_group' ? 'group' : currentNode.className == 'wpcf7cf_step' ? 'step' : currentNode.hasAttribute('name') ? 'input' : false;
816
+
817
+ if (!type) {
818
+ continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
819
  }
 
820
 
821
+ var name = type === 'input' ? currentNode.getAttribute('name') : currentNode.dataset.id; // skip _wpcf7 hidden fields
822
+
823
+ if (name.substring(0, 6) === '_wpcf7') continue;
824
+ var original_name = type === 'repeater' || type === 'group' ? currentNode.dataset.orig_data_id : type === 'input' ? currentNode.getAttribute('data-orig_name') || name : name;
825
+ var val = type === 'step' ? [currentNode.dataset.id.substring(5)] : [];
826
+ var original_name_length = original_name == null ? name.length : original_name.length;
827
+ var suffix = name.substring(original_name_length);
828
+
829
+ if (!simplified_dom[name]) {
830
+ // init entry
831
+ simplified_dom[name] = {
832
+ name: name,
833
+ type: type,
834
+ original_name: original_name,
835
+ suffix: suffix,
836
+ val: val
837
+ };
838
+ }
839
+
840
+ if (type === 'input') {
841
+ // skip unchecked checkboxes and radiobuttons
842
+ if ((currentNode.type === 'checkbox' || currentNode.type === 'radio') && !currentNode.checked) continue; // if multiselect, make sure to add all the values
843
+
844
+ if (currentNode.multiple) {
845
+ simplified_dom[name].val = Object.values(currentNode.options).filter(function (o) {
846
+ return o.selected;
847
+ }).map(function (o) {
848
+ return o.value;
849
+ });
850
+ } else {
851
+ simplified_dom[name].val.push(currentNode.value);
852
+ }
853
+ }
854
+ }
855
 
856
  return simplified_dom;
857
  },
865
  };
866
  multistep.form.$input_steps.val(JSON.stringify(stepsData)); // update Buttons
867
 
868
+ multistep.$btn_prev.removeClass('disabled').attr('disabled', false);
869
+ multistep.$btn_next.removeClass('disabled').attr('disabled', false);
870
 
871
  if (multistep.currentStep == multistep.numSteps) {
872
+ multistep.$btn_next.addClass('disabled').attr('disabled', true);
873
  }
874
 
875
  if (multistep.currentStep == 1) {
876
+ multistep.$btn_prev.addClass('disabled').attr('disabled', true);
877
  } // replace next button with submit button on last step.
878
  // TODO: make this depend on a setting
879
 
903
  }
904
  }
905
  },
906
+ should_group_be_shown: function should_group_be_shown(condition) {
 
907
  var show_group = true;
908
 
909
  for (var and_rule_i = 0; and_rule_i < condition.and_rules.length; and_rule_i++) {
910
  var condition_ok = false;
911
  var condition_and_rule = condition.and_rules[and_rule_i];
912
+ var inputField = wpcf7cf_getFieldByName(condition_and_rule.if_field);
913
  var if_val = condition_and_rule.if_value;
914
+ var operator = condition_and_rule.operator; //backwards compat
 
 
 
 
 
 
 
 
 
 
 
915
 
916
  operator = operator === '≤' ? 'less than or equals' : operator;
917
  operator = operator === '≥' ? 'greater than or equals' : operator;
918
  operator = operator === '>' ? 'greater than' : operator;
919
  operator = operator === '<' ? 'less than' : operator;
920
+ condition_ok = this.isConditionTrue(inputField.val, operator, if_val);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
921
  show_group = show_group && condition_ok;
922
  }
923
 
js/scripts.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/scripts_es6.js","webpack:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack:///./node_modules/@babel/runtime/regenerator/index.js","webpack:///./node_modules/regenerator-runtime/runtime.js","webpack:///(webpack)/buildin/module.js"],"names":["cf7signature_resized","wpcf7cf_timeout","wpcf7cf_change_time_ms","window","wpcf7cf_running_tests","wpcf7cf_show_animation","wpcf7cf_hide_animation","wpcf7cf_show_step_animation","wpcf7cf_hide_step_animation","wpcf7cf_change_events","wpcf7cf_forms","String","prototype","endsWith","search","this_len","undefined","length","substring","Wpcf7cfForm","$form","options_element","find","eq","val","form","form_options","JSON","parse","$input_hidden_group_fields","$input_hidden_groups","$input_visible_groups","$input_repeaters","$input_steps","unit_tag","closest","attr","conditions","i","condition","and_rules","if_field","if_value","operator","initial_conditions","settings","$groups","jQuery","repeaters","multistep","fields","animation_intime","parseInt","animation_outtime","animation","updateGroups","updateEventListeners","displayFields","on","e","data","setTimeout","resetRepeaters","moveToStep","each","push","Wpcf7cfRepeater","stringify","map","item","params","$repeater","id","$multistep","Wpcf7cfMultistep","forEach","repeater","updateSubs","initial_subs","wpcf7cf","get_simplified_dom_model","wpcf7cf_conditions","wpcf7cf_settings","signatures","constructor","Array","canvas","width","$sig_canvas","$sig_wrap","height","addClass","show_group","should_group_be_shown","then_field","removeClass","index","$group","is","finish","css","hasClass","prop","show","trigger","animate","$inputs","not","$this","defaultValue","defaultChecked","selected","defaultSelected","$select","change","hide","updateHiddenFields","updateSummaryFields","$summary","fd","FormData","formdata","serializeArray","key","input","append","name","value","ajax","url","wpcf7cf_global_settings","ajaxurl","type","processData","contentType","dataType","success","json","html","summaryHtml","hidden_fields","hidden_groups","visible_groups","get_nested_conditions","off","clearTimeout","text","$","num_subs","orig_id","min","max","$repeater_sub","children","$repeater_controls","$repeater_sub_clone","clone","addBack","prev_suffix","new_suffix","prev_name","orig_name","new_name","replace","prev_data_id","orig_data_id","new_data_id","prev_id","new_id","prev_for","orig_for","new_for","repeater_sub_html","outerHTML","$repeater_count_field","$button_add","$button_remove","remove","subs_to_show","subs_to_add","removeSubs","addSubs","showButtonRemove","showButtonAdd","html_str","sub_suffix","RegExp","$html","insertBefore","updateMultistepState","cf7mdInit","slice","duration","done","$steps","$btn_next","$btn_prev","$dots","currentStep","numSteps","validateStep","result","stopImmediatePropagation","document","ajaxComplete","xhr","hasOwnProperty","responseJSON","status","into","step_index","Promise","resolve","el","files","file","fieldName","checkError","invalid_fields","controlWrap","reason","parent","message","fail","always","previousStep","formEl","topOffset","getBoundingClientRect","top","scrollIntoView","behavior","getFieldsInStep","simpleDom","inStep","filter","step","initForm","$current_form","simplified_dom","groups","sub_conditions","g","relevant_conditions","original_name","and_rule","suffix","concat","currentNode","ni","createNodeIterator","NodeFilter","SHOW_ELEMENT","nextNode","classList","contains","dataset","className","hasAttribute","getAttribute","original_name_length","stepsData","fieldsInCurrentStep","$submit_button","$ajax_loader","detach","appendTo","and_rule_i","condition_ok","condition_and_rule","$field","if_val","if_val_as_number","isFinite","parseFloat","regex_patt","isValidRegex","all_values","checked_values","isConditionTrue","values","testValue","isArray","valuesAreEmpty","every","v","testValueNumber","NaN","valueNumber","valsAreNumbers","isNaN","test","ready","f","old_wpcf7ExclusiveCheckbox","fn","wpcf7ExclusiveCheckbox","asyncGeneratorStep","gen","reject","_next","_throw","arg","info","error","then","_asyncToGenerator","self","args","arguments","apply","err","module","exports","require","runtime","Op","Object","hasOwn","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","wrap","innerFn","outerFn","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","makeInvokeMethod","tryCatch","obj","call","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","Gp","displayName","defineIteratorMethods","method","isGeneratorFunction","genFun","ctor","mark","setPrototypeOf","__proto__","awrap","__await","AsyncIterator","PromiseImpl","invoke","record","unwrapped","previousPromise","enqueue","callInvokeWithMethodAndArg","async","iter","next","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","resultName","nextLoc","toString","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","keys","object","reverse","pop","iterable","iteratorMethod","skipTempReset","prev","charAt","stop","rootEntry","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","Function","webpackPolyfill","deprecate","paths","defineProperty","enumerable","get","l"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAE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ACA,CArBD,C","file":"scripts.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./js/scripts_es6.js\");\n","\"use strict\";\n\nvar cf7signature_resized = 0; // for compatibility with contact-form-7-signature-addon\n\nvar wpcf7cf_timeout;\nvar wpcf7cf_change_time_ms = window.wpcf7cf_running_tests ? 0 : 100;\n\nvar wpcf7cf_show_animation = { \"height\": \"show\", \"marginTop\": \"show\", \"marginBottom\": \"show\", \"paddingTop\": \"show\", \"paddingBottom\": \"show\" };\nvar wpcf7cf_hide_animation = { \"height\": \"hide\", \"marginTop\": \"hide\", \"marginBottom\": \"hide\", \"paddingTop\": \"hide\", \"paddingBottom\": \"hide\" };\n\nvar wpcf7cf_show_step_animation = { \"opacity\": \"show\" };\nvar wpcf7cf_hide_step_animation = { \"opacity\": \"hide\" };\n\nvar wpcf7cf_change_events = 'input.wpcf7cf paste.wpcf7cf change.wpcf7cf click.wpcf7cf propertychange.wpcf7cf';\n\nvar wpcf7cf_forms = [];\n\n// endswith polyfill\nif (!String.prototype.endsWith) {\n\tString.prototype.endsWith = function(search, this_len) {\n\t\tif (this_len === undefined || this_len > this.length) {\n\t\t\tthis_len = this.length;\n\t\t}\n\t\treturn this.substring(this_len - search.length, this_len) === search;\n\t};\n}\n\nvar Wpcf7cfForm = function($form) {\n\n var options_element = $form.find('input[name=\"_wpcf7cf_options\"]').eq(0);\n if (!options_element.length || !options_element.val()) {\n // doesn't look like a CF7 form created with conditional fields plugin enabled.\n return false;\n }\n\n var form = this;\n\n var form_options = JSON.parse(options_element.val());\n\n form.$form = $form;\n form.$input_hidden_group_fields = $form.find('[name=\"_wpcf7cf_hidden_group_fields\"]');\n form.$input_hidden_groups = $form.find('[name=\"_wpcf7cf_hidden_groups\"]');\n form.$input_visible_groups = $form.find('[name=\"_wpcf7cf_visible_groups\"]');\n form.$input_repeaters = $form.find('[name=\"_wpcf7cf_repeaters\"]');\n form.$input_steps = $form.find('[name=\"_wpcf7cf_steps\"]');\n\n form.unit_tag = $form.closest('.wpcf7').attr('id');\n form.conditions = form_options['conditions'];\n\n // compatibility with conditional forms created with older versions of the plugin ( < 1.4 )\n for (var i=0; i < form.conditions.length; i++) {\n var condition = form.conditions[i];\n if (!('and_rules' in condition)) {\n condition.and_rules = [{'if_field':condition.if_field,'if_value':condition.if_value,'operator':condition.operator}];\n }\n }\n\n form.initial_conditions = form.conditions;\n form.settings = form_options['settings'];\n\n form.$groups = jQuery(); // empty jQuery set\n form.repeaters = [];\n form.multistep = null;\n form.fields = [];\n\n form.settings.animation_intime = parseInt(form.settings.animation_intime);\n form.settings.animation_outtime = parseInt(form.settings.animation_outtime);\n\n if (form.settings.animation === 'no') {\n form.settings.animation_intime = 0;\n form.settings.animation_outtime = 0;\n }\n\n form.updateGroups();\n form.updateEventListeners();\n form.displayFields();\n\n // bring form in initial state if the reset event is fired on it.\n form.$form.on('reset.wpcf7cf', form, function(e) {\n var form = e.data;\n setTimeout(function(){\n form.displayFields();\n form.resetRepeaters();\n if (form.multistep != null) {\n form.multistep.moveToStep(1); \n }\n },200);\n });\n\n // PRO ONLY\n\n jQuery('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)', $form).each(function(){\n form.repeaters.push(new Wpcf7cfRepeater(jQuery(this),form));\n });\n\n form.$input_repeaters.val(JSON.stringify(form.repeaters.map((item)=>item.params.$repeater.id)));\n\n var $multistep = jQuery('.wpcf7cf_multistep', $form);\n\n if ($multistep.length) {\n form.multistep = new Wpcf7cfMultistep($multistep, form);\n // window.wpcf7cf.updateMultistepState(form.multistep);\n }\n\n // END PRO ONLY\n\n}\n\n/**\n * reset initial number of subs for each repeater.\n * (does not clear values)\n */\nWpcf7cfForm.prototype.resetRepeaters = function() {\n var form = this;\n form.repeaters.forEach(repeater => {\n repeater.updateSubs( repeater.params.$repeater.initial_subs );\n });\n}\n\nWpcf7cfForm.prototype.displayFields = function() {\n\n var form = this;\n\n window.wpcf7cf.get_simplified_dom_model(form.$form);\n\n var unit_tag = this.unit_tag;\n var wpcf7cf_conditions = this.conditions;\n var wpcf7cf_settings = this.settings;\n\n //for compatibility with contact-form-7-signature-addon\n if (cf7signature_resized === 0 && typeof signatures !== 'undefined' && signatures.constructor === Array && signatures.length > 0 ) {\n for (var i = 0; i < signatures.length; i++) {\n if (signatures[i].canvas.width === 0) {\n\n var $sig_canvas = jQuery(\".wpcf7-form-control-signature-body>canvas\");\n var $sig_wrap = jQuery(\".wpcf7-form-control-signature-wrap\");\n $sig_canvas.eq(i).attr('width', $sig_wrap.width());\n $sig_canvas.eq(i).attr('height', $sig_wrap.height());\n\n cf7signature_resized = 1;\n }\n }\n }\n\n form.$groups.addClass('wpcf7cf-hidden');\n\n for (var i=0; i < wpcf7cf_conditions.length; i++) {\n\n var condition = wpcf7cf_conditions[i];\n\n var show_group = window.wpcf7cf.should_group_be_shown(condition, form.$form);\n\n if (show_group) {\n jQuery('[data-id=\"'+condition.then_field+'\"]',form.$form).eq(0).removeClass('wpcf7cf-hidden');\n }\n }\n\n var animation_intime = wpcf7cf_settings.animation_intime;\n var animation_outtime = wpcf7cf_settings.animation_outtime;\n\n form.$groups.each(function (index) {\n var $group = jQuery(this);\n if ($group.is(':animated')) $group.finish(); // stop any current animations on the group\n if ($group.css('display') === 'none' && !$group.hasClass('wpcf7cf-hidden')) {\n if ($group.prop('tagName') === 'SPAN') {\n $group.show().trigger('wpcf7cf_show_group');\n } else {\n $group.animate(wpcf7cf_show_animation, animation_intime).trigger('wpcf7cf_show_group'); // show\n }\n } else if ($group.css('display') !== 'none' && $group.hasClass('wpcf7cf-hidden')) {\n\n if ($group.attr('data-clear_on_hide') !== undefined) {\n var $inputs = jQuery(':input', $group).not(':button, :submit, :reset, :hidden');\n\n $inputs.each(function(){\n var $this = jQuery(this);\n $this.val(this.defaultValue);\n $this.prop('checked', this.defaultChecked);\n });\n\n jQuery('option', $group).each(function() {\n this.selected = this.defaultSelected;\n });\n\n jQuery('select', $group).each(function() {\n const $select = jQuery(this);\n if ($select.val() === null) {\n $select.val(jQuery(\"option:first\",$select).val());\n }\n });\n\n $inputs.change();\n //display_fields();\n }\n\n if ($group.prop('tagName') === 'SPAN') {\n $group.hide().trigger('wpcf7cf_hide_group');\n } else {\n $group.animate(wpcf7cf_hide_animation, animation_outtime).trigger('wpcf7cf_hide_group'); // hide\n }\n\n }\n });\n\n form.updateHiddenFields();\n form.updateSummaryFields();\n};\n\nWpcf7cfForm.prototype.updateSummaryFields = function() {\n var $summary = jQuery('.wpcf7cf-summary', this.$form);\n\n if ($summary.length == 0 || !$summary.is(':visible')) return;\n\n var fd = new FormData();\n\n var formdata = this.$form.serializeArray();\n jQuery.each(formdata,function(key, input){\n fd.append(input.name, input.value);\n });\n\n jQuery.ajax({\n url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary',\n type: 'POST',\n data: fd,\n processData: false,\n contentType: false,\n dataType: 'json',\n success: function(json) {\n $summary.html(json.summaryHtml);\n }\n });\n};\n\nWpcf7cfForm.prototype.updateHiddenFields = function() {\n\n var form = this;\n\n var hidden_fields = [];\n var hidden_groups = [];\n var visible_groups = [];\n\n form.$groups.each(function () {\n var $this = jQuery(this);\n if ($this.hasClass('wpcf7cf-hidden')) {\n hidden_groups.push($this.data('id'));\n $this.find('input,select,textarea').each(function () {\n hidden_fields.push(jQuery(this).attr('name'));\n });\n } else {\n visible_groups.push($this.data('id'));\n }\n });\n\n form.hidden_fields = hidden_fields;\n form.hidden_groups = hidden_groups;\n form.visible_groups = visible_groups;\n\n form.$input_hidden_group_fields.val(JSON.stringify(hidden_fields));\n form.$input_hidden_groups.val(JSON.stringify(hidden_groups));\n form.$input_visible_groups.val(JSON.stringify(visible_groups));\n\n return true;\n};\nWpcf7cfForm.prototype.updateGroups = function() {\n var form = this;\n form.$groups = form.$form.find('[data-class=\"wpcf7cf_group\"]');\n\n form.conditions = window.wpcf7cf.get_nested_conditions(form.initial_conditions, form.$form);\n\n};\nWpcf7cfForm.prototype.updateEventListeners = function() {\n\n var form = this;\n\n // monitor input changes, and call display_fields() if something has changed\n jQuery('input, select, textarea, button',form.$form).not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events,form, function(e) {\n var form = e.data;\n clearTimeout(wpcf7cf_timeout);\n wpcf7cf_timeout = setTimeout(function() {\n form.displayFields();\n }, wpcf7cf_change_time_ms);\n });\n\n // PRO ONLY\n jQuery('.wpcf7cf-togglebutton', form.$form).off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf',function() {\n var $this = jQuery(this);\n if ($this.text() === $this.data('val-1')) {\n $this.text($this.data('val-2'));\n $this.val($this.data('val-2'));\n } else {\n $this.text($this.data('val-1'));\n $this.val($this.data('val-1'));\n }\n });\n // END PRO ONLY\n};\n\n// PRO ONLY\nfunction Wpcf7cfRepeater($repeater, form) {\n var $ = jQuery;\n\n var repeater = this;\n\n var wpcf7cf_settings = form.settings;\n\n repeater.form = form;\n\n $repeater.num_subs = 0;\n $repeater.id = $repeater.data('id');\n $repeater.orig_id = $repeater.data('orig_data_id');\n $repeater.min = typeof( $repeater.data('min')) !== 'undefined' ? parseInt($repeater.data('min')) : 1;\n $repeater.max = typeof( $repeater.data('max')) !== 'undefined' ? parseInt($repeater.data('max')) : 200;\n $repeater.initial_subs = typeof( $repeater.data('initial')) !== 'undefined' ? parseInt($repeater.data('initial')) : $repeater.min;\n if ($repeater.initial_subs > $repeater.max) $repeater.initial_subs = $repeater.max;\n var $repeater_sub = $repeater.children('.wpcf7cf_repeater_sub').eq(0);\n var $repeater_controls = $repeater.children('.wpcf7cf_repeater_controls').eq(0);\n\n var $repeater_sub_clone = $repeater_sub.clone();\n\n $repeater_sub_clone.find('.wpcf7cf_repeater_sub').addBack('.wpcf7cf_repeater_sub').each(function() {\n var $this = jQuery(this);\n var prev_suffix = $this.attr('data-repeater_sub_suffix');\n var new_suffix = prev_suffix+'__{{repeater_sub_suffix}}';\n $this.attr('data-repeater_sub_suffix', new_suffix);\n });\n\n $repeater_sub_clone.find('[name]').each(function() {\n var $this = jQuery(this);\n var prev_name = $this.attr('name');\n var orig_name = $this.attr('data-orig_name') != null ? $this.attr('data-orig_name') : prev_name;\n var new_name = prev_name+'__{{repeater_sub_suffix}}';\n\n if(prev_name.endsWith('_count')) {\n new_name = prev_name.replace('_count','__{{repeater_sub_suffix}}_count');\n }\n\n $this.attr('name', new_name);\n $this.attr('data-orig_name', orig_name);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_name);\n });\n\n $repeater_sub_clone.find('.wpcf7cf_repeater,[data-class=\"wpcf7cf_group\"]').each(function() {\n var $this = jQuery(this);\n var prev_data_id = $this.attr('data-id');\n var orig_data_id = $this.attr('data-orig_data_id') != null ? $this.attr('data-orig_data_id') : prev_data_id;\n var new_data_id = prev_data_id+'__{{repeater_sub_suffix}}';\n\n if(prev_data_id.endsWith('_count')) {\n new_data_id = prev_data_id.replace('_count','__{{repeater_sub_suffix}}_count');\n }\n\n $this.attr('data-id', new_data_id);\n $this.attr('data-orig_data_id', orig_data_id);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_data_id);\n });\n\n $repeater_sub_clone.find('[id]').each(function() {\n var $this = jQuery(this);\n var prev_id = $this.attr('id');\n var orig_id = $this.attr('data-orig_id') != null ? $this.attr('data-orig_id') : prev_id;\n var new_id = prev_id+'__{{repeater_sub_suffix}}';\n\n $this.attr('id', new_id);\n $this.attr('data-orig_id', orig_id);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_id);\n });\n\n $repeater_sub_clone.find('[for]').each(function() {\n var $this = jQuery(this);\n var prev_for = $this.attr('for');\n var orig_for = $this.attr('data-orig_for') != null ? $this.attr('data-orig_for') : prev_for;\n var new_for = prev_for+'__{{repeater_sub_suffix}}';\n\n $this.attr('for', new_for);\n $this.attr('data-orig_for', orig_for);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_for);\n });\n\n var repeater_sub_html = $repeater_sub_clone[0].outerHTML;\n\n var $repeater_count_field = $repeater.find('[name='+$repeater.id+'_count]').eq(0);\n var $button_add = $repeater_controls.find('.wpcf7cf_add').eq(0);\n var $button_remove = $repeater_controls.find('.wpcf7cf_remove').eq(0);\n\n var params = {\n $repeater: $repeater,\n $repeater_count_field: $repeater_count_field,\n repeater_sub_html: repeater_sub_html,\n $repeater_controls: $repeater_controls,\n $button_add: $button_add,\n $button_remove: $button_remove,\n wpcf7cf_settings: wpcf7cf_settings\n };\n \n this.params = params;\n\n $button_add.on('click', null, repeater, function(e) {\n var repeater = e.data;\n repeater.updateSubs(params.$repeater.num_subs+1);\n });\n\n $button_remove.on('click', null, repeater,function(e) {\n var repeater = e.data;\n repeater.updateSubs(params.$repeater.num_subs-1);\n });\n\n jQuery('> .wpcf7cf_repeater_sub',params.$repeater).eq(0).remove(); // remove the first sub, it's just a template.\n\n repeater.updateSubs($repeater.initial_subs); \n\n}\n\n\n\nWpcf7cfRepeater.prototype.updateSubs = function(subs_to_show) {\n var repeater = this;\n var params = repeater.params;\n var subs_to_add = subs_to_show - params.$repeater.num_subs;\n\n if (subs_to_add < 0) {\n repeater.removeSubs(-subs_to_add);\n } else if (subs_to_add > 0) {\n repeater.addSubs(subs_to_add);\n }\n\n var showButtonRemove = false;\n var showButtonAdd = false;\n\n if (params.$repeater.num_subs < params.$repeater.max) {\n showButtonAdd = true;\n }\n if (params.$repeater.num_subs > params.$repeater.min) {\n showButtonRemove = true;\n }\n\n if (showButtonAdd) {\n params.$button_add.show();\n } else {\n params.$button_add.hide();\n\n }\n\n if (showButtonRemove) {\n params.$button_remove.show();\n } else {\n params.$button_remove.hide();\n }\n\n params.$repeater_count_field.val(subs_to_show);\n\n};\nWpcf7cfRepeater.prototype.addSubs = function(subs_to_add) {\n var $ = jQuery;\n var params = this.params;\n var repeater = this;\n var form = repeater.form;\n\n\n var $repeater = params.$repeater; \n var $repeater_controls = params.$repeater_controls;\n\n //jQuery(params.repeater_sub_html.replace(/name=\"(.*?)\"/g,'name=\"wpcf7cf_repeater['+$repeater.id+']['+$repeater.num_subs+'][$1]\" data-original-name=\"$1\"')).hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime);\n\n var html_str = '';\n\n for(var i=1; i<=subs_to_add; i++) {\n var sub_suffix = $repeater.num_subs+i;\n html_str += params.repeater_sub_html.replace(/\\{\\{repeater_sub_suffix\\}\\}/g,sub_suffix)\n .replace(new RegExp('\\{\\{'+$repeater.orig_id+'_index\\}\\}','g'),sub_suffix);\n }\n\n\n var $html = jQuery(html_str);\n\n // Add the newly created fields to the form\n $html.hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime).trigger('wpcf7cf_repeater_added');\n\n jQuery('.wpcf7cf_repeater', $html).each(function(){\n form.repeaters.push(new Wpcf7cfRepeater(jQuery(this),form));\n });\n form.$input_repeaters.val(JSON.stringify(form.repeaters.map((item)=>item.params.$repeater.id)));\n\n $repeater.num_subs+= subs_to_add;\n\n window.wpcf7cf.updateMultistepState(form.multistep);\n form.updateGroups();\n form.updateEventListeners();\n form.displayFields();\n\n // Exclusive Checkbox\n $html.on( 'click', '.wpcf7-exclusive-checkbox input:checkbox', function() {\n var name = $( this ).attr( 'name' );\n $html.find( 'input:checkbox[name=\"' + name + '\"]' ).not( this ).prop( 'checked', false );\n } );\n\n //basic compatibility with material-design-for-contact-form-7\n if (typeof window.cf7mdInit === \"function\") {\n window.cf7mdInit();\n }\n\n return false;\n};\nWpcf7cfRepeater.prototype.removeSubs = function(num_subs) {\n var $ = jQuery;\n var params = this.params;\n var form = this.form;\n\n params.$repeater.num_subs-= num_subs;\n\n jQuery('> .wpcf7cf_repeater_sub',params.$repeater).slice(-num_subs).animate(wpcf7cf_hide_animation, {duration:params.wpcf7cf_settings.animation_intime, done:function() {\n var $this = jQuery(this);\n //remove the actual fields from the form\n $this.remove();\n params.$repeater.trigger('wpcf7cf_repeater_removed');\n window.wpcf7cf.updateMultistepState(form.multistep);\n form.updateGroups();\n form.updateEventListeners();\n form.displayFields();\n }});\n\n return false;\n};\n\nfunction Wpcf7cfMultistep($multistep, form) {\n var multistep = this;\n multistep.$multistep = $multistep;\n multistep.form = form;\n multistep.$steps = $multistep.find('.wpcf7cf_step');\n multistep.$btn_next = $multistep.find('.wpcf7cf_next');\n multistep.$btn_prev = $multistep.find('.wpcf7cf_prev');\n multistep.$dots = $multistep.find('.wpcf7cf_steps-dots');\n multistep.currentStep = 0;\n multistep.numSteps = multistep.$steps.length;\n\n\n multistep.$dots.html('');\n for (var i = 1; i <= multistep.numSteps; i++) {\n multistep.$dots.append(`\n <div class=\"dot\" data-step=\"${i}\">\n <div class=\"step-index\">${i}</div>\n <div class=\"step-title\">${multistep.$steps.eq(i-1).data('title')}</div>\n </div>\n `);\n }\n\n multistep.$btn_next.on('click.wpcf7cf_step', async function() {\n \n var result = await multistep.validateStep(multistep.currentStep);\n if (result === 'success') {\n multistep.moveToStep(multistep.currentStep+1); \n }\n\n });\n\n // If form is submitted (by pressing return for example), and if we are not on the last step,\n // then trigger click event on the $btn_next button instead.\n multistep.form.$form.on('submit.wpcf7cf_step', function(e) {\n\n if (multistep.currentStep !== multistep.numSteps) {\n multistep.$btn_next.trigger('click.wpcf7cf_step');\n\n e.stopImmediatePropagation();\n return false;\n }\n });\n\n multistep.$btn_prev.on( 'click', function() {\n multistep.moveToStep(multistep.currentStep-1);\n });\n\n multistep.moveToStep(1);\n}\n\njQuery(document).ajaxComplete(function(e, xhr, settings){\n if (\n xhr.hasOwnProperty('responseJSON') &&\n xhr.responseJSON != null &&\n xhr.responseJSON.hasOwnProperty('status') &&\n xhr.responseJSON.hasOwnProperty('into') &&\n xhr.responseJSON.status === \"mail_success\"\n ) {\n jQuery( xhr.responseJSON.into ).trigger('reset.wpcf7cf');\n }\n});\n\nWpcf7cfMultistep.prototype.validateStep = function(step_index) {\n\n var multistep = this;\n var $multistep = multistep.$multistep;\n var $form = multistep.form.$form;\n\n $form.find('.wpcf7-response-output').addClass('wpcf7-display-none');\n\n return new Promise(resolve => {\n\n var fd = new FormData();\n\n // Make sure to add file fields to FormData\n jQuery.each($form.find('[data-id=\"step-'+step_index+'\"] input[type=\"file\"]'), function(index, el) {\n if (! el.files.length) return false;\n const file = el.files[0];\n const fieldName = el.name;\n fd.append(fieldName, file);\n });\n\n var formdata = $form.serializeArray();\n jQuery.each(formdata,function(key, input){\n fd.append(input.name, input.value);\n });\n\n jQuery.ajax({\n url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_validate_step',\n type: 'POST',\n data: fd,\n processData: false,\n contentType: false,\n dataType: 'json',\n }).done(function(json) {\n\n $multistep.find('.wpcf7-form-control-wrap .wpcf7-not-valid-tip').remove();\n $multistep.find('.wpcf7-not-valid').removeClass('wpcf7-not-valid');\n $multistep.find('.wpcf7-response-output').remove();\n $multistep.find('.wpcf7-response-output.wpcf7-validation-errors').removeClass('wpcf7-validation-errors');\n\n if (!json.success) {\n var checkError = 0;\n\n jQuery.each(json.invalid_fields, function(index, el) {\n if ($multistep.find('input[name=\"'+index+'\"]').length ||\n $multistep.find('input[name=\"'+index+'[]\"]').length ||\n $multistep.find('select[name=\"'+index+'\"]').length ||\n $multistep.find('select[name=\"'+index+'[]\"]').length ||\n $multistep.find('textarea[name=\"'+index+'\"]').length ||\n $multistep.find('textarea[name=\"'+index+'[]\"]').length\n ) {\n checkError = checkError + 1;\n\n var controlWrap = jQuery('.wpcf7-form-control-wrap.' + index, $form);\n controlWrap.find('input').addClass('wpcf7-not-valid');\n controlWrap.find('span.wpcf7-not-valid-tip').remove();\n controlWrap.append('<span role=\"alert\" class=\"wpcf7-not-valid-tip\">' + el.reason + '</span>');\n\n }\n });\n\n resolve('failed');\n\n $multistep.parent().find('.wpcf7-response-output').removeClass('wpcf7-display-none').html(json.message);\n\n } else if (json.success) {\n resolve('success');\n return false;\n }\n\n }).fail(function() {\n resolve('error');\n }).always(function() {\n // do nothing\n });\n });\n\n};\nWpcf7cfMultistep.prototype.moveToStep = function(step_index) {\n var multistep = this;\n var previousStep = multistep.currentStep;\n\n multistep.currentStep = step_index > multistep.numSteps ? multistep.numSteps\n : step_index < 1 ? 1\n : step_index;\n\n // ANIMATION DISABLED FOR NOW cause it's ugly\n // multistep.$steps.animate(wpcf7cf_hide_step_animation, multistep.form.settings.animation_outtime);\n // multistep.$steps.eq(multistep.currentStep-1).animate(wpcf7cf_show_step_animation, multistep.form.settings.animation_intime);\n\n multistep.$multistep.attr('data-current_step', multistep.currentStep);\n multistep.$steps.hide();\n multistep.$steps\n .eq(multistep.currentStep-1)\n .show()\n .trigger('wpcf7cf_change_step', [previousStep, multistep.currentStep]);\n\n const formEl = multistep.form.$form[0];\n const topOffset = formEl.getBoundingClientRect().top;\n if (topOffset < 0 && previousStep > 0) {\n formEl.scrollIntoView({behavior: \"smooth\"});\n }\n\n multistep.form.updateSummaryFields();\n\n window.wpcf7cf.updateMultistepState(multistep);\n};\n\nWpcf7cfMultistep.prototype.getFieldsInStep = function(step_index) {\n var simpleDom = window.wpcf7cf.get_simplified_dom_model(this.form.$form);\n var inStep = false;\n return simpleDom.filter(function(item, i) {\n if(item.type == 'step') {\n inStep = item.step == step_index+'';\n }\n return inStep && item.type == 'input';\n }).map(function(item) {\n return item.name;\n });\n};\n\n// END PRO ONLY\n\nwindow.wpcf7cf = {\n\n // keep this for backwards compatibility\n initForm : function($form) {\n wpcf7cf_forms.push(new Wpcf7cfForm($form));\n },\n\n get_nested_conditions : function(conditions, $current_form) {\n //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index\n var simplified_dom = window.wpcf7cf.get_simplified_dom_model($current_form);\n var groups = simplified_dom.filter(function(item, i) {\n return item.type==='group';\n });\n\n var sub_conditions = [];\n\n for(var i = 0; i < groups.length; i++) {\n var g = groups[i];\n var relevant_conditions = conditions.filter(function(condition, i) {\n return condition.then_field === g.original_name;\n });\n \n var relevant_conditions = relevant_conditions.map(function(item,i) {\n return {\n then_field : g.name,\n and_rules : item.and_rules.map(function(and_rule, i) {\n return {\n if_field : and_rule.if_field+g.suffix,\n if_value : and_rule.if_value,\n operator : and_rule.operator\n };\n })\n }\n });\n\n sub_conditions = sub_conditions.concat(relevant_conditions);\n }\n return conditions.concat(sub_conditions);\n },\n\n get_simplified_dom_model : function($current_form) {\n // if the dom is something like:\n // <form>\n // <repeater ra>\n // <group ga__1>\n // <repeater rb__1>\n // <input txta__1__1 />\n // <input txta__1__2 />\n // </repeater>\n // <group gb__1>\n // <input txtb__1 />\n // </group>\n // </group>\n // <group ga__2>\n // <repeater rb__2>\n // <input txta__2__1 />\n // </repeater>\n // <group gb__2>\n // <input txtb__2 />\n // </group>\n // </group>\n // </repeater>\n // </form>\n // \n // return something like:\n // [{type:repeater, name:'ra', suffix: '__1'}, {type: group, name:'ga', suffix: '__1'}, ...]\n\n var currentNode;\n var ni = document.createNodeIterator($current_form[0], NodeFilter.SHOW_ELEMENT, null, false); //, NodeFilter.SHOW_ELEMENT, function(){ return NodeFilter.FILTER_ACCEPT; }\n\n var simplified_dom = [];\n\n while(currentNode = ni.nextNode()) {\n if (currentNode.classList.contains('wpcf7cf_repeater')) {\n simplified_dom.push({type:'repeater', name:currentNode.dataset.id, original_name:currentNode.dataset.orig_data_id})\n } else if (currentNode.dataset.class == 'wpcf7cf_group') {\n simplified_dom.push({type:'group', name:currentNode.dataset.id, original_name:currentNode.dataset.orig_data_id})\n } else if (currentNode.className == 'wpcf7cf_step') {\n simplified_dom.push({type:'step', name:currentNode.dataset.id, original_name:currentNode.dataset.id, step: currentNode.dataset.id.substring(5)})\n } else if (currentNode.hasAttribute('name')) {\n simplified_dom.push({type:'input', name:currentNode.getAttribute('name'), original_name:currentNode.getAttribute('data-orig_name')})\n }\n }\n\n simplified_dom = simplified_dom.map(function(item, i){\n var original_name_length = item.original_name == null ? item.name.length : item.original_name.length;\n item.suffix = item.name.substring(original_name_length);\n return item;\n });\n\n //console.table(simplified_dom);\n return simplified_dom;\n\n },\n\n updateMultistepState: function (multistep) {\n if (multistep == null) return;\n\n // update hidden input field\n\n var stepsData = {\n currentStep : multistep.currentStep,\n numSteps : multistep.numSteps,\n fieldsInCurrentStep : multistep.getFieldsInStep(multistep.currentStep)\n };\n multistep.form.$input_steps.val(JSON.stringify(stepsData));\n\n // update Buttons\n multistep.$btn_prev.removeClass('disabled');\n multistep.$btn_next.removeClass('disabled');\n if (multistep.currentStep == multistep.numSteps) {\n multistep.$btn_next.addClass('disabled');\n }\n if (multistep.currentStep == 1) {\n multistep.$btn_prev.addClass('disabled');\n }\n\n // replace next button with submit button on last step.\n // TODO: make this depend on a setting\n var $submit_button = multistep.form.$form.find('input[type=\"submit\"]').eq(0);\n var $ajax_loader = multistep.form.$form.find('.ajax-loader').eq(0);\n if (multistep.currentStep == multistep.numSteps) {\n multistep.$btn_next.hide();\n $ajax_loader.detach().appendTo(multistep.$btn_next.parent());\n $submit_button.detach().appendTo(multistep.$btn_next.parent());\n $submit_button.show();\n } else {\n $submit_button.hide();\n multistep.$btn_next.show();\n }\n\n // update dots\n var $dots = multistep.$dots.find('.dot');\n $dots.removeClass('active').removeClass('completed');\n for(var step = 1; step <= multistep.numSteps; step++) {\n if (step < multistep.currentStep) {\n $dots.eq(step-1).addClass('completed');\n } else if (step == multistep.currentStep) {\n $dots.eq(step-1).addClass('active');\n }\n }\n\n },\n\n should_group_be_shown : function(condition, $current_form) {\n\n var $ = jQuery;\n\n var show_group = true;\n\n for (var and_rule_i = 0; and_rule_i < condition.and_rules.length; and_rule_i++) {\n\n var condition_ok = false;\n\n var condition_and_rule = condition.and_rules[and_rule_i];\n\n var $field = jQuery('[name=\"' + condition_and_rule.if_field + '\"], [name=\"' + condition_and_rule.if_field + '[]\"], [data-original-name=\"' + condition_and_rule.if_field + '\"], [data-original-name=\"' + condition_and_rule.if_field + '[]\"]',$current_form);\n\n var if_val = condition_and_rule.if_value;\n var if_val_as_number = isFinite(parseFloat(if_val)) ? parseFloat(if_val):0;\n var operator = condition_and_rule.operator;\n \n var regex_patt = /.*/i; // fallback regex pattern\n var isValidRegex = true;\n try {\n regex_patt = new RegExp(if_val, 'i');\n } catch(e) {\n isValidRegex = false;\n }\n\n\n //backwards compat\n operator = operator === '≤' ? 'less than or equals' : operator;\n operator = operator === '≥' ? 'greater than or equals' : operator;\n operator = operator === '>' ? 'greater than' : operator;\n operator = operator === '<' ? 'less than' : operator;\n\n\n if ( $field.is(':checkbox') || $field.is(':radio') ) {\n\n var all_values = [];\n var checked_values = [];\n $field.each(function () {\n all_values.push(jQuery(this).val());\n if (jQuery(this).is(':checked')) {\n checked_values.push(jQuery(this).val());\n }\n });\n\n condition_ok = this.isConditionTrue(checked_values,operator,if_val,$field);\n \n } else {\n \n condition_ok = this.isConditionTrue($field.val(),operator,if_val,$field);\n }\n\n show_group = show_group && condition_ok;\n }\n\n return show_group;\n\n },\n isConditionTrue(values, operator, testValue='', $field=jQuery()) {\n\n if (!Array.isArray(values)) {\n values = [values];\n }\n\n let condition_ok = false; // start by assuming that the condition is not met\n\n // Considered EMPTY: [] [''] [null] ['',null] [,,'']\n // Considered NOT EMPTY: [0] ['ab','c'] ['',0,null]\n const valuesAreEmpty = values.length === 0 || values.every((v) => !v&&v!==0); // 0 is not considered empty\n\n // special cases: [] equals '' => TRUE; [] not equals '' => FALSE\n if (operator === 'equals' && testValue === '' && valuesAreEmpty) {\n return true;\n }\n if (operator === 'not equals' && testValue === '' && valuesAreEmpty) {\n return false;\n }\n\n if (valuesAreEmpty) {\n if (operator === 'is empty') {\n condition_ok = true;\n }\n } else {\n if (operator === 'not empty') {\n condition_ok = true;\n }\n }\n\n const testValueNumber = isFinite(parseFloat(testValue)) ? parseFloat(testValue) : NaN;\n\n\n if (operator === 'not equals' || operator === 'not equals (regex)') {\n // start by assuming that the condition is met\n condition_ok = true;\n }\n\n if (\n operator === 'function'\n && typeof window[testValue] == 'function'\n && window[testValue]($field) // here we call the actual user defined function\n ) {\n condition_ok = true;\n }\n\n let regex_patt = /.*/i; // fallback regex pattern\n let isValidRegex = true;\n if (operator === 'equals (regex)' || operator === 'not equals (regex)') {\n try {\n regex_patt = new RegExp(testValue, 'i');\n } catch(e) {\n isValidRegex = false;\n }\n }\n\n\n for(let i = 0; i < values.length; i++) {\n\n const value = values[i];\n\n const valueNumber = isFinite(parseFloat(value)) ? parseFloat(value) : NaN;\n const valsAreNumbers = !isNaN(valueNumber) && !isNaN(testValueNumber);\n\n if (\n\n operator === 'equals' && value === testValue ||\n operator === 'equals (regex)' && regex_patt.test(value) ||\n operator === 'greater than' && valsAreNumbers && valueNumber > testValueNumber ||\n operator === 'less than' && valsAreNumbers && valueNumber < testValueNumber ||\n operator === 'greater than or equals' && valsAreNumbers && valueNumber >= testValueNumber ||\n operator === 'less than or equals' && valsAreNumbers && valueNumber <= testValueNumber\n \n ) {\n\n condition_ok = true;\n break;\n\n } else if (\n\n operator === 'not equals' && value === testValue ||\n operator === 'not equals (regex)' && regex_patt.test(value)\n\n ) {\n\n condition_ok = false;\n break;\n\n }\n }\n\n return condition_ok;\n\n }\n\n};\n\n\n\n\njQuery('.wpcf7-form').each(function(){\n wpcf7cf_forms.push(new Wpcf7cfForm(jQuery(this)));\n});\n\n// Call displayFields again on all forms\n// Necessary in case some theme or plugin changed a form value by the time the entire page is fully loaded.\njQuery('document').ready(function() {\n wpcf7cf_forms.forEach(function(f){\n f.displayFields();\n });\n});\n\n// fix for exclusive checkboxes in IE (this will call the change-event again after all other checkboxes are unchecked, triggering the display_fields() function)\nvar old_wpcf7ExclusiveCheckbox = jQuery.fn.wpcf7ExclusiveCheckbox;\njQuery.fn.wpcf7ExclusiveCheckbox = function() {\n return this.find('input:checkbox').on('click', function() {\n var name = jQuery(this).attr('name');\n jQuery(this).closest('form').find('input:checkbox[name=\"' + name + '\"]').not(this).prop('checked', false).eq(0).change();\n });\n};\n\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;","module.exports = require(\"regenerator-runtime\");\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/scripts_es6.js","webpack:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack:///./node_modules/@babel/runtime/regenerator/index.js","webpack:///./node_modules/regenerator-runtime/runtime.js","webpack:///(webpack)/buildin/module.js"],"names":["cf7signature_resized","wpcf7cf_timeout","wpcf7cf_change_time_ms","window","wpcf7cf_running_tests","jQuery","each","e","$input","opt","JSON","parse","val","settings","animation_intime","animation_outtime","stringify","wpcf7cf_show_animation","wpcf7cf_hide_animation","wpcf7cf_show_step_animation","wpcf7cf_hide_step_animation","wpcf7cf_change_events","wpcf7cf_forms","wpcf7cf_dom","wpcf7cf_reload_dom","$form","wpcf7cf","get_simplified_dom_model","wpcf7cf_getFieldsByOriginalName","originalName","Object","values","filter","inputField","original_name","wpcf7cf_getFieldByName","name","String","prototype","endsWith","search","this_len","undefined","length","substring","Wpcf7cfForm","options_element","find","eq","form","form_options","$input_hidden_group_fields","$input_hidden_groups","$input_visible_groups","$input_repeaters","$input_steps","unit_tag","closest","attr","conditions","get","selector","i","condition","and_rules","if_field","if_value","operator","initial_conditions","$groups","repeaters","multistep","fields","parseInt","animation","updateGroups","updateEventListeners","displayFields","on","data","setTimeout","resetRepeaters","moveToStep","push","Wpcf7cfRepeater","map","item","params","$repeater","id","$multistep","Wpcf7cfMultistep","forEach","repeater","updateSubs","initial_subs","wpcf7cf_conditions","wpcf7cf_settings","signatures","constructor","Array","canvas","width","$sig_canvas","$sig_wrap","height","addClass","show_group","should_group_be_shown","then_field","removeClass","index","$group","is","finish","css","hasClass","prop","show","trigger","animate","$inputs","not","$this","defaultValue","defaultChecked","selected","defaultSelected","$select","change","hide","updateHiddenFields","updateSummaryFields","$summary","fd","FormData","formdata","serializeArray","key","input","append","value","el","files","file","fieldName","Blob","ajax","url","wpcf7cf_global_settings","ajaxurl","type","processData","contentType","dataType","success","json","html","summaryHtml","hidden_fields","hidden_groups","visible_groups","get_nested_conditions","off","clearTimeout","text","$","num_subs","orig_id","min","max","$repeater_sub","children","$repeater_controls","$repeater_sub_clone","clone","addBack","prev_suffix","new_suffix","prev_name","orig_name","new_name","replace","prev_data_id","orig_data_id","new_data_id","prev_id","new_id","prev_for","orig_for","new_for","repeater_sub_html","outerHTML","$repeater_count_field","$button_add","$button_remove","remove","subs_to_show","subs_to_add","removeSubs","addSubs","showButtonRemove","showButtonAdd","html_str","sub_suffix","RegExp","$html","insertBefore","updateMultistepState","cf7mdInit","slice","duration","done","$steps","$btn_next","$btn_prev","$dots","currentStep","numSteps","validateStep","result","stopImmediatePropagation","document","ajaxComplete","xhr","hasOwnProperty","responseJSON","status","into","step_index","Promise","resolve","checkError","invalid_fields","controlWrap","reason","parent","message","fail","always","previousStep","formEl","topOffset","getBoundingClientRect","top","scrollIntoView","behavior","getFieldsInStep","inStep","initForm","$current_form","groups","sub_conditions","g","relevant_conditions","and_rule","suffix","concat","currentNode","ni","createNodeIterator","NodeFilter","SHOW_ELEMENT","simplified_dom","nextNode","classList","contains","dataset","className","hasAttribute","getAttribute","original_name_length","checked","multiple","options","o","stepsData","fieldsInCurrentStep","$submit_button","$ajax_loader","detach","appendTo","step","and_rule_i","condition_ok","condition_and_rule","if_val","isConditionTrue","testValue","$field","isArray","valuesAreEmpty","every","v","testValueNumber","isFinite","parseFloat","NaN","regex_patt","isValidRegex","valueNumber","valsAreNumbers","isNaN","test","ready","f","old_wpcf7ExclusiveCheckbox","fn","wpcf7ExclusiveCheckbox","asyncGeneratorStep","gen","reject","_next","_throw","arg","info","error","then","_asyncToGenerator","self","args","arguments","apply","err","module","exports","require","runtime","Op","hasOwn","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","wrap","innerFn","outerFn","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","makeInvokeMethod","tryCatch","obj","call","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","Gp","displayName","defineIteratorMethods","method","isGeneratorFunction","genFun","ctor","mark","setPrototypeOf","__proto__","awrap","__await","AsyncIterator","PromiseImpl","invoke","record","unwrapped","previousPromise","enqueue","callInvokeWithMethodAndArg","async","iter","next","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","resultName","nextLoc","toString","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","keys","object","reverse","pop","iterable","iteratorMethod","skipTempReset","prev","charAt","stop","rootEntry","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","Function","webpackPolyfill","deprecate","paths","defineProperty","enumerable","l"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AAAA;AAAa;;;;AAEb,IAAIA,oBAAoB,GAAG,CAA3B,C,CAA8B;;AAE9B,IAAIC,eAAJ;AACA,IAAIC,sBAAsB,GAAG,GAA7B;;AAEA,IAAIC,MAAM,CAACC,qBAAX,EAAkC;AAC9BC,QAAM,CAAC,gCAAD,CAAN,CAAyCC,IAAzC,CAA8C,UAASC,CAAT,EAAY;AACtD,QAAIC,MAAM,GAAGH,MAAM,CAAC,IAAD,CAAnB;AACA,QAAII,GAAG,GAAGC,IAAI,CAACC,KAAL,CAAWH,MAAM,CAACI,GAAP,EAAX,CAAV;AACAH,OAAG,CAACI,QAAJ,CAAaC,gBAAb,GAAgC,CAAhC;AACAL,OAAG,CAACI,QAAJ,CAAaE,iBAAb,GAAiC,CAAjC;AACAP,UAAM,CAACI,GAAP,CAAWF,IAAI,CAACM,SAAL,CAAeP,GAAf,CAAX;AACH,GAND;AAOAP,wBAAsB,GAAG,C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,MAAM,CAACtQ,CAAd;AACA;AAJkC,KAApC;AAMAsQ,UAAM,CAACkH,eAAP,GAAyB,CAAzB;AACA;;AACD,SAAOlH,MAAP;AACA,CArBD,C","file":"scripts.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./js/scripts_es6.js\");\n","\"use strict\";\n\nvar cf7signature_resized = 0; // for compatibility with contact-form-7-signature-addon\n\nvar wpcf7cf_timeout;\nvar wpcf7cf_change_time_ms = 100;\n\nif (window.wpcf7cf_running_tests) {\n jQuery('input[name=\"_wpcf7cf_options\"]').each(function(e) {\n var $input = jQuery(this);\n var opt = JSON.parse($input.val());\n opt.settings.animation_intime = 0;\n opt.settings.animation_outtime = 0;\n $input.val(JSON.stringify(opt));\n });\n wpcf7cf_change_time_ms = 0;\n}\n\nvar wpcf7cf_show_animation = { \"height\": \"show\", \"marginTop\": \"show\", \"marginBottom\": \"show\", \"paddingTop\": \"show\", \"paddingBottom\": \"show\" };\nvar wpcf7cf_hide_animation = { \"height\": \"hide\", \"marginTop\": \"hide\", \"marginBottom\": \"hide\", \"paddingTop\": \"hide\", \"paddingBottom\": \"hide\" };\n\nvar wpcf7cf_show_step_animation = { \"opacity\": \"show\" };\nvar wpcf7cf_hide_step_animation = { \"opacity\": \"hide\" };\n\nvar wpcf7cf_change_events = 'input.wpcf7cf paste.wpcf7cf change.wpcf7cf click.wpcf7cf propertychange.wpcf7cf';\n\nvar wpcf7cf_forms = [];\n\nwindow.wpcf7cf_dom = {};\n\nconst wpcf7cf_reload_dom = function($form) {\n wpcf7cf_dom = wpcf7cf.get_simplified_dom_model($form);\n}\n\nconst wpcf7cf_getFieldsByOriginalName = function(originalName) {\n return Object.values(wpcf7cf_dom).filter(function (inputField) {\n return inputField.original_name === originalName || inputField.original_name === originalName+'[]';\n });\n}\n\nconst wpcf7cf_getFieldByName = function(name) {\n return wpcf7cf_dom[name] || wpcf7cf_dom[name+'[]'];\n}\n\n// endsWith polyfill\nif (!String.prototype.endsWith) {\n\tString.prototype.endsWith = function(search, this_len) {\n\t\tif (this_len === undefined || this_len > this.length) {\n\t\t\tthis_len = this.length;\n\t\t}\n\t\treturn this.substring(this_len - search.length, this_len) === search;\n\t};\n}\n\nvar Wpcf7cfForm = function($form) {\n\n var options_element = $form.find('input[name=\"_wpcf7cf_options\"]').eq(0);\n if (!options_element.length || !options_element.val()) {\n // doesn't look like a CF7 form created with conditional fields plugin enabled.\n return false;\n }\n\n var form = this;\n\n var form_options = JSON.parse(options_element.val());\n\n form.$form = $form;\n form.$input_hidden_group_fields = $form.find('[name=\"_wpcf7cf_hidden_group_fields\"]');\n form.$input_hidden_groups = $form.find('[name=\"_wpcf7cf_hidden_groups\"]');\n form.$input_visible_groups = $form.find('[name=\"_wpcf7cf_visible_groups\"]');\n form.$input_repeaters = $form.find('[name=\"_wpcf7cf_repeaters\"]');\n form.$input_steps = $form.find('[name=\"_wpcf7cf_steps\"]');\n\n form.unit_tag = $form.closest('.wpcf7').attr('id');\n form.conditions = form_options['conditions'];\n\n // Wrapper around jQuery(selector, form.$form)\n form.get = function (selector) {\n // TODO: implement some caching here.\n return jQuery(selector, form.$form);\n }\n\n // compatibility with conditional forms created with older versions of the plugin ( < 1.4 )\n for (var i=0; i < form.conditions.length; i++) {\n var condition = form.conditions[i];\n if (!('and_rules' in condition)) {\n condition.and_rules = [{'if_field':condition.if_field,'if_value':condition.if_value,'operator':condition.operator}];\n }\n }\n\n form.initial_conditions = form.conditions;\n form.settings = form_options['settings'];\n\n form.$groups = jQuery(); // empty jQuery set\n form.repeaters = [];\n form.multistep = null;\n form.fields = [];\n\n form.settings.animation_intime = parseInt(form.settings.animation_intime);\n form.settings.animation_outtime = parseInt(form.settings.animation_outtime);\n\n if (form.settings.animation === 'no') {\n form.settings.animation_intime = 0;\n form.settings.animation_outtime = 0;\n }\n\n form.updateGroups();\n form.updateEventListeners();\n form.displayFields();\n\n // bring form in initial state if the reset event is fired on it.\n form.$form.on('reset.wpcf7cf', form, function(e) {\n var form = e.data;\n setTimeout(function(){\n form.displayFields();\n form.resetRepeaters();\n if (form.multistep != null) {\n form.multistep.moveToStep(1); \n }\n },200);\n });\n\n // PRO ONLY\n\n form.get('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)').each(function(){\n form.repeaters.push(new Wpcf7cfRepeater(jQuery(this),form));\n });\n\n form.$input_repeaters.val(JSON.stringify(form.repeaters.map((item)=>item.params.$repeater.id)));\n\n var $multistep = form.get('.wpcf7cf_multistep');\n\n if ($multistep.length) {\n form.multistep = new Wpcf7cfMultistep($multistep, form);\n // window.wpcf7cf.updateMultistepState(form.multistep);\n }\n\n // END PRO ONLY\n\n}\n\n/**\n * reset initial number of subs for each repeater.\n * (does not clear values)\n */\nWpcf7cfForm.prototype.resetRepeaters = function() {\n var form = this;\n form.repeaters.forEach(repeater => {\n repeater.updateSubs( repeater.params.$repeater.initial_subs );\n });\n}\n\nWpcf7cfForm.prototype.displayFields = function() {\n\n var form = this;\n\n var wpcf7cf_conditions = this.conditions;\n var wpcf7cf_settings = this.settings;\n\n //for compatibility with contact-form-7-signature-addon\n if (cf7signature_resized === 0 && typeof signatures !== 'undefined' && signatures.constructor === Array && signatures.length > 0 ) {\n for (var i = 0; i < signatures.length; i++) {\n if (signatures[i].canvas.width === 0) {\n\n var $sig_canvas = jQuery(\".wpcf7-form-control-signature-body>canvas\");\n var $sig_wrap = jQuery(\".wpcf7-form-control-signature-wrap\");\n $sig_canvas.eq(i).attr('width', $sig_wrap.width());\n $sig_canvas.eq(i).attr('height', $sig_wrap.height());\n\n cf7signature_resized = 1;\n }\n }\n }\n\n form.$groups.addClass('wpcf7cf-hidden');\n\n wpcf7cf_reload_dom(form.$form);\n\n for (var i=0; i < wpcf7cf_conditions.length; i++) {\n\n var condition = wpcf7cf_conditions[i];\n\n var show_group = window.wpcf7cf.should_group_be_shown(condition, form);\n\n if (show_group) {\n form.get('[data-id=\"'+condition.then_field+'\"]').removeClass('wpcf7cf-hidden');\n }\n }\n\n\n var animation_intime = wpcf7cf_settings.animation_intime;\n var animation_outtime = wpcf7cf_settings.animation_outtime;\n\n form.$groups.each(function (index) {\n var $group = jQuery(this);\n if ($group.is(':animated')) $group.finish(); // stop any current animations on the group\n if ($group.css('display') === 'none' && !$group.hasClass('wpcf7cf-hidden')) {\n if ($group.prop('tagName') === 'SPAN') {\n $group.show().trigger('wpcf7cf_show_group');\n } else {\n $group.animate(wpcf7cf_show_animation, animation_intime).trigger('wpcf7cf_show_group'); // show\n }\n } else if ($group.css('display') !== 'none' && $group.hasClass('wpcf7cf-hidden')) {\n\n if ($group.attr('data-clear_on_hide') !== undefined) {\n var $inputs = jQuery(':input', $group).not(':button, :submit, :reset, :hidden');\n\n $inputs.each(function(){\n var $this = jQuery(this);\n $this.val(this.defaultValue);\n $this.prop('checked', this.defaultChecked);\n });\n\n jQuery('option', $group).each(function() {\n this.selected = this.defaultSelected;\n });\n\n jQuery('select', $group).each(function() {\n const $select = jQuery(this);\n if ($select.val() === null) {\n $select.val(jQuery(\"option:first\",$select).val());\n }\n });\n\n $inputs.change();\n //display_fields();\n }\n\n if ($group.prop('tagName') === 'SPAN') {\n $group.hide().trigger('wpcf7cf_hide_group');\n } else {\n $group.animate(wpcf7cf_hide_animation, animation_outtime).trigger('wpcf7cf_hide_group'); // hide\n }\n\n }\n });\n\n form.updateHiddenFields();\n form.updateSummaryFields();\n};\n\nWpcf7cfForm.prototype.updateSummaryFields = function() {\n const form = this;\n var $summary = form.get('.wpcf7cf-summary');\n\n if ($summary.length == 0 || !$summary.is(':visible')) return;\n\n var fd = new FormData();\n\n var formdata = form.$form.serializeArray();\n jQuery.each(formdata,function(key, input){\n fd.append(input.name, input.value);\n });\n\n // Make sure to add file fields to FormData\n jQuery.each(form.$form.find('input[type=\"file\"]'), function(index, el) {\n if (! el.files.length) return false;\n const file = el.files[0];\n const fieldName = el.name;\n fd.append(fieldName, new Blob() ,file.name);\n });\n\n // add file fields to form-data\n\n jQuery.ajax({\n url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary',\n type: 'POST',\n data: fd,\n processData: false,\n contentType: false,\n dataType: 'json',\n success: function(json) {\n $summary.html(json.summaryHtml);\n }\n });\n};\n\nWpcf7cfForm.prototype.updateHiddenFields = function() {\n\n var form = this;\n\n var hidden_fields = [];\n var hidden_groups = [];\n var visible_groups = [];\n\n form.$groups.each(function () {\n var $this = jQuery(this);\n if ($this.hasClass('wpcf7cf-hidden')) {\n hidden_groups.push($this.data('id'));\n $this.find('input,select,textarea').each(function () {\n hidden_fields.push(jQuery(this).attr('name'));\n });\n } else {\n visible_groups.push($this.data('id'));\n }\n });\n\n form.hidden_fields = hidden_fields;\n form.hidden_groups = hidden_groups;\n form.visible_groups = visible_groups;\n\n form.$input_hidden_group_fields.val(JSON.stringify(hidden_fields));\n form.$input_hidden_groups.val(JSON.stringify(hidden_groups));\n form.$input_visible_groups.val(JSON.stringify(visible_groups));\n\n return true;\n};\nWpcf7cfForm.prototype.updateGroups = function() {\n var form = this;\n form.$groups = form.$form.find('[data-class=\"wpcf7cf_group\"]');\n\n form.conditions = window.wpcf7cf.get_nested_conditions(form.initial_conditions, form.$form);\n\n};\nWpcf7cfForm.prototype.updateEventListeners = function() {\n\n var form = this;\n\n // monitor input changes, and call displayFields() if something has changed\n form.get('input, select, textarea, button').not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events,form, function(e) {\n var form = e.data;\n clearTimeout(wpcf7cf_timeout);\n wpcf7cf_timeout = setTimeout(function() {\n form.displayFields();\n }, wpcf7cf_change_time_ms);\n });\n\n // PRO ONLY\n form.get('.wpcf7cf-togglebutton').off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf',function() {\n var $this = jQuery(this);\n if ($this.text() === $this.data('val-1')) {\n $this.text($this.data('val-2'));\n $this.val($this.data('val-2'));\n } else {\n $this.text($this.data('val-1'));\n $this.val($this.data('val-1'));\n }\n });\n // END PRO ONLY\n};\n\n// PRO ONLY\nfunction Wpcf7cfRepeater($repeater, form) {\n var $ = jQuery;\n\n var repeater = this;\n\n var wpcf7cf_settings = form.settings;\n\n repeater.form = form;\n\n $repeater.num_subs = 0;\n $repeater.id = $repeater.data('id');\n $repeater.orig_id = $repeater.data('orig_data_id');\n $repeater.min = typeof( $repeater.data('min')) !== 'undefined' ? parseInt($repeater.data('min')) : 1;\n $repeater.max = typeof( $repeater.data('max')) !== 'undefined' ? parseInt($repeater.data('max')) : 200;\n $repeater.initial_subs = typeof( $repeater.data('initial')) !== 'undefined' ? parseInt($repeater.data('initial')) : $repeater.min;\n if ($repeater.initial_subs > $repeater.max) $repeater.initial_subs = $repeater.max;\n var $repeater_sub = $repeater.children('.wpcf7cf_repeater_sub').eq(0);\n var $repeater_controls = $repeater.children('.wpcf7cf_repeater_controls').eq(0);\n\n var $repeater_sub_clone = $repeater_sub.clone();\n\n $repeater_sub_clone.find('.wpcf7cf_repeater_sub').addBack('.wpcf7cf_repeater_sub').each(function() {\n var $this = jQuery(this);\n var prev_suffix = $this.attr('data-repeater_sub_suffix');\n var new_suffix = prev_suffix+'__{{repeater_sub_suffix}}';\n $this.attr('data-repeater_sub_suffix', new_suffix);\n });\n\n $repeater_sub_clone.find('[name]').each(function() {\n var $this = jQuery(this);\n var prev_name = $this.attr('name');\n var orig_name = $this.attr('data-orig_name') != null ? $this.attr('data-orig_name') : prev_name;\n var new_name = prev_name+'__{{repeater_sub_suffix}}';\n\n if(prev_name.endsWith('_count')) {\n new_name = prev_name.replace('_count','__{{repeater_sub_suffix}}_count');\n }\n\n $this.attr('name', new_name);\n $this.attr('data-orig_name', orig_name);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_name);\n });\n\n $repeater_sub_clone.find('.wpcf7cf_repeater,[data-class=\"wpcf7cf_group\"]').each(function() {\n var $this = jQuery(this);\n var prev_data_id = $this.attr('data-id');\n var orig_data_id = $this.attr('data-orig_data_id') != null ? $this.attr('data-orig_data_id') : prev_data_id;\n var new_data_id = prev_data_id+'__{{repeater_sub_suffix}}';\n\n if(prev_data_id.endsWith('_count')) {\n new_data_id = prev_data_id.replace('_count','__{{repeater_sub_suffix}}_count');\n }\n\n $this.attr('data-id', new_data_id);\n $this.attr('data-orig_data_id', orig_data_id);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_data_id);\n });\n\n $repeater_sub_clone.find('[id]').each(function() {\n var $this = jQuery(this);\n var prev_id = $this.attr('id');\n var orig_id = $this.attr('data-orig_id') != null ? $this.attr('data-orig_id') : prev_id;\n var new_id = prev_id+'__{{repeater_sub_suffix}}';\n\n $this.attr('id', new_id);\n $this.attr('data-orig_id', orig_id);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_id);\n });\n\n $repeater_sub_clone.find('[for]').each(function() {\n var $this = jQuery(this);\n var prev_for = $this.attr('for');\n var orig_for = $this.attr('data-orig_for') != null ? $this.attr('data-orig_for') : prev_for;\n var new_for = prev_for+'__{{repeater_sub_suffix}}';\n\n $this.attr('for', new_for);\n $this.attr('data-orig_for', orig_for);\n $this.closest('.wpcf7-form-control-wrap').addClass(new_for);\n });\n\n var repeater_sub_html = $repeater_sub_clone[0].outerHTML;\n\n var $repeater_count_field = $repeater.find('[name='+$repeater.id+'_count]').eq(0);\n var $button_add = $repeater_controls.find('.wpcf7cf_add').eq(0);\n var $button_remove = $repeater_controls.find('.wpcf7cf_remove').eq(0);\n\n var params = {\n $repeater: $repeater,\n $repeater_count_field: $repeater_count_field,\n repeater_sub_html: repeater_sub_html,\n $repeater_controls: $repeater_controls,\n $button_add: $button_add,\n $button_remove: $button_remove,\n wpcf7cf_settings: wpcf7cf_settings\n };\n \n this.params = params;\n\n $button_add.on('click', null, repeater, function(e) {\n var repeater = e.data;\n repeater.updateSubs(params.$repeater.num_subs+1);\n });\n\n $button_remove.on('click', null, repeater,function(e) {\n var repeater = e.data;\n repeater.updateSubs(params.$repeater.num_subs-1);\n });\n\n jQuery('> .wpcf7cf_repeater_sub',params.$repeater).eq(0).remove(); // remove the first sub, it's just a template.\n\n repeater.updateSubs($repeater.initial_subs); \n\n}\n\n\n\nWpcf7cfRepeater.prototype.updateSubs = function(subs_to_show) {\n var repeater = this;\n var params = repeater.params;\n var subs_to_add = subs_to_show - params.$repeater.num_subs;\n\n if (subs_to_add < 0) {\n repeater.removeSubs(-subs_to_add);\n } else if (subs_to_add > 0) {\n repeater.addSubs(subs_to_add);\n }\n\n var showButtonRemove = false;\n var showButtonAdd = false;\n\n if (params.$repeater.num_subs < params.$repeater.max) {\n showButtonAdd = true;\n }\n if (params.$repeater.num_subs > params.$repeater.min) {\n showButtonRemove = true;\n }\n\n if (showButtonAdd) {\n params.$button_add.show();\n } else {\n params.$button_add.hide();\n\n }\n\n if (showButtonRemove) {\n params.$button_remove.show();\n } else {\n params.$button_remove.hide();\n }\n\n params.$repeater_count_field.val(subs_to_show);\n\n};\nWpcf7cfRepeater.prototype.addSubs = function(subs_to_add) {\n var $ = jQuery;\n var params = this.params;\n var repeater = this;\n var form = repeater.form;\n\n\n var $repeater = params.$repeater; \n var $repeater_controls = params.$repeater_controls;\n\n //jQuery(params.repeater_sub_html.replace(/name=\"(.*?)\"/g,'name=\"wpcf7cf_repeater['+$repeater.id+']['+$repeater.num_subs+'][$1]\" data-original-name=\"$1\"')).hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime);\n\n var html_str = '';\n\n for(var i=1; i<=subs_to_add; i++) {\n var sub_suffix = $repeater.num_subs+i;\n html_str += params.repeater_sub_html.replace(/\\{\\{repeater_sub_suffix\\}\\}/g,sub_suffix)\n .replace(new RegExp('\\{\\{'+$repeater.orig_id+'_index\\}\\}','g'),sub_suffix);\n }\n\n\n var $html = jQuery(html_str);\n\n // Add the newly created fields to the form\n $html.hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime).trigger('wpcf7cf_repeater_added');\n\n jQuery('.wpcf7cf_repeater', $html).each(function(){\n form.repeaters.push(new Wpcf7cfRepeater(jQuery(this),form));\n });\n form.$input_repeaters.val(JSON.stringify(form.repeaters.map((item)=>item.params.$repeater.id)));\n\n $repeater.num_subs+= subs_to_add;\n\n window.wpcf7cf.updateMultistepState(form.multistep);\n form.updateGroups();\n form.updateEventListeners();\n form.displayFields();\n\n // Exclusive Checkbox\n $html.on( 'click', '.wpcf7-exclusive-checkbox input:checkbox', function() {\n var name = $( this ).attr( 'name' );\n $html.find( 'input:checkbox[name=\"' + name + '\"]' ).not( this ).prop( 'checked', false );\n } );\n\n //basic compatibility with material-design-for-contact-form-7\n if (typeof window.cf7mdInit === \"function\") {\n window.cf7mdInit();\n }\n\n return false;\n};\nWpcf7cfRepeater.prototype.removeSubs = function(num_subs) {\n var $ = jQuery;\n var params = this.params;\n var form = this.form;\n\n params.$repeater.num_subs-= num_subs;\n\n jQuery('> .wpcf7cf_repeater_sub',params.$repeater).slice(-num_subs).animate(wpcf7cf_hide_animation, {duration:params.wpcf7cf_settings.animation_intime, done:function() {\n var $this = jQuery(this);\n //remove the actual fields from the form\n $this.remove();\n params.$repeater.trigger('wpcf7cf_repeater_removed');\n window.wpcf7cf.updateMultistepState(form.multistep);\n form.updateGroups();\n form.updateEventListeners();\n form.displayFields();\n }});\n\n return false;\n};\n\nfunction Wpcf7cfMultistep($multistep, form) {\n var multistep = this;\n multistep.$multistep = $multistep;\n multistep.form = form;\n multistep.$steps = $multistep.find('.wpcf7cf_step');\n multistep.$btn_next = $multistep.find('.wpcf7cf_next');\n multistep.$btn_prev = $multistep.find('.wpcf7cf_prev');\n multistep.$dots = $multistep.find('.wpcf7cf_steps-dots');\n multistep.currentStep = 0;\n multistep.numSteps = multistep.$steps.length;\n\n\n multistep.$dots.html('');\n for (var i = 1; i <= multistep.numSteps; i++) {\n multistep.$dots.append(`\n <div class=\"dot\" data-step=\"${i}\">\n <div class=\"step-index\">${i}</div>\n <div class=\"step-title\">${multistep.$steps.eq(i-1).data('title')}</div>\n </div>\n `);\n }\n\n multistep.$btn_next.on('click.wpcf7cf_step', async function() {\n \n var result = await multistep.validateStep(multistep.currentStep);\n if (result === 'success') {\n multistep.moveToStep(multistep.currentStep+1); \n }\n\n });\n\n // If form is submitted (by pressing Enter for example), and if we are not on the last step,\n // then trigger click event on the $btn_next button instead.\n multistep.form.$form.on('submit.wpcf7cf_step', function(e) {\n\n if (multistep.currentStep !== multistep.numSteps) {\n multistep.$btn_next.trigger('click.wpcf7cf_step');\n\n e.stopImmediatePropagation();\n return false;\n }\n });\n\n multistep.$btn_prev.on( 'click', function() {\n multistep.moveToStep(multistep.currentStep-1);\n });\n\n multistep.moveToStep(1);\n}\n\njQuery(document).ajaxComplete(function(e, xhr, settings){\n if (\n xhr.hasOwnProperty('responseJSON') &&\n xhr.responseJSON != null &&\n xhr.responseJSON.hasOwnProperty('status') &&\n xhr.responseJSON.hasOwnProperty('into') &&\n xhr.responseJSON.status === \"mail_success\"\n ) {\n jQuery( xhr.responseJSON.into ).trigger('reset.wpcf7cf');\n }\n});\n\nWpcf7cfMultistep.prototype.validateStep = function(step_index) {\n\n var multistep = this;\n var $multistep = multistep.$multistep;\n var $form = multistep.form.$form;\n var form = multistep.form;\n\n $form.find('.wpcf7-response-output').addClass('wpcf7-display-none');\n\n return new Promise(resolve => {\n\n var fd = new FormData();\n\n // Make sure to add file fields to FormData\n jQuery.each($form.find('[data-id=\"step-'+step_index+'\"] input[type=\"file\"]'), function(index, el) {\n if (! el.files.length) return false;\n const file = el.files[0];\n const fieldName = el.name;\n fd.append(fieldName, file);\n });\n\n var formdata = $form.serializeArray();\n jQuery.each(formdata,function(key, input){\n fd.append(input.name, input.value);\n });\n\n jQuery.ajax({\n url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_validate_step',\n type: 'POST',\n data: fd,\n processData: false,\n contentType: false,\n dataType: 'json',\n }).done(function(json) {\n\n $multistep.find('.wpcf7-form-control-wrap .wpcf7-not-valid-tip').remove();\n $multistep.find('.wpcf7-not-valid').removeClass('wpcf7-not-valid');\n $multistep.find('.wpcf7-response-output').remove();\n $multistep.find('.wpcf7-response-output.wpcf7-validation-errors').removeClass('wpcf7-validation-errors');\n\n if (!json.success) {\n var checkError = 0;\n\n jQuery.each(json.invalid_fields, function(index, el) {\n if ($multistep.find('input[name=\"'+index+'\"]').length ||\n $multistep.find('input[name=\"'+index+'[]\"]').length ||\n $multistep.find('select[name=\"'+index+'\"]').length ||\n $multistep.find('select[name=\"'+index+'[]\"]').length ||\n $multistep.find('textarea[name=\"'+index+'\"]').length ||\n $multistep.find('textarea[name=\"'+index+'[]\"]').length\n ) {\n checkError = checkError + 1;\n\n var controlWrap = form.get('.wpcf7-form-control-wrap.' + index);\n controlWrap.find('input').addClass('wpcf7-not-valid');\n controlWrap.find('span.wpcf7-not-valid-tip').remove();\n controlWrap.append('<span role=\"alert\" class=\"wpcf7-not-valid-tip\">' + el.reason + '</span>');\n\n }\n });\n\n resolve('failed');\n\n $multistep.parent().find('.wpcf7-response-output').removeClass('wpcf7-display-none').html(json.message);\n\n } else if (json.success) {\n resolve('success');\n return false;\n }\n\n }).fail(function() {\n resolve('error');\n }).always(function() {\n // do nothing\n });\n });\n\n};\nWpcf7cfMultistep.prototype.moveToStep = function(step_index) {\n var multistep = this;\n var previousStep = multistep.currentStep;\n\n multistep.currentStep = step_index > multistep.numSteps ? multistep.numSteps\n : step_index < 1 ? 1\n : step_index;\n\n // ANIMATION DISABLED FOR NOW cause it's ugly\n // multistep.$steps.animate(wpcf7cf_hide_step_animation, multistep.form.settings.animation_outtime);\n // multistep.$steps.eq(multistep.currentStep-1).animate(wpcf7cf_show_step_animation, multistep.form.settings.animation_intime);\n\n multistep.$multistep.attr('data-current_step', multistep.currentStep);\n multistep.$steps.hide();\n multistep.$steps\n .eq(multistep.currentStep-1)\n .show()\n .trigger('wpcf7cf_change_step', [previousStep, multistep.currentStep]);\n\n const formEl = multistep.form.$form[0];\n const topOffset = formEl.getBoundingClientRect().top;\n if (topOffset < 0 && previousStep > 0) {\n formEl.scrollIntoView({behavior: \"smooth\"});\n }\n\n multistep.form.updateSummaryFields();\n\n window.wpcf7cf.updateMultistepState(multistep);\n};\n\nWpcf7cfMultistep.prototype.getFieldsInStep = function(step_index) {\n wpcf7cf_reload_dom(this.form.$form);\n var inStep = false;\n return Object.values(wpcf7cf_dom).filter(function(item, i) {\n if(item.type == 'step') {\n inStep = item.val == step_index+'';\n }\n return inStep && item.type == 'input';\n }).map(function(item) {\n return item.name;\n });\n};\n\n// END PRO ONLY\n\nwindow.wpcf7cf = {\n\n // keep this for backwards compatibility\n initForm : function($form) {\n wpcf7cf_forms.push(new Wpcf7cfForm($form));\n },\n\n get_nested_conditions : function(conditions, $current_form) {\n //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index\n wpcf7cf_reload_dom($current_form);\n var groups = Object.values(wpcf7cf_dom).filter(function(item, i) {\n return item.type==='group';\n });\n\n var sub_conditions = [];\n\n for(var i = 0; i < groups.length; i++) {\n var g = groups[i];\n var relevant_conditions = conditions.filter(function(condition, i) {\n return condition.then_field === g.original_name;\n });\n \n var relevant_conditions = relevant_conditions.map(function(item,i) {\n return {\n then_field : g.name,\n and_rules : item.and_rules.map(function(and_rule, i) {\n return {\n if_field : and_rule.if_field+g.suffix,\n if_value : and_rule.if_value,\n operator : and_rule.operator\n };\n })\n }\n });\n\n sub_conditions = sub_conditions.concat(relevant_conditions);\n }\n return sub_conditions;\n },\n\n get_simplified_dom_model : function($current_form) {\n\n var currentNode;\n var ni = document.createNodeIterator($current_form[0], NodeFilter.SHOW_ELEMENT, null, false); //, NodeFilter.SHOW_ELEMENT, function(){ return NodeFilter.FILTER_ACCEPT; }\n\n var simplified_dom = {};\n\n while(currentNode = ni.nextNode()) {\n\n const type = currentNode.classList.contains('wpcf7cf_repeater') ? 'repeater' :\n currentNode.dataset.class == 'wpcf7cf_group' ? 'group' :\n currentNode.className == 'wpcf7cf_step' ? 'step' :\n currentNode.hasAttribute('name') ? 'input' : false;\n\n if (!type) {\n continue;\n } \n\n const name = type === 'input' ? currentNode.getAttribute('name') : currentNode.dataset.id;\n\n // skip _wpcf7 hidden fields\n if (name.substring(0,6) === '_wpcf7') continue;\n\n const original_name = type === 'repeater' || type === 'group' ? currentNode.dataset.orig_data_id\n : type === 'input' ? (currentNode.getAttribute('data-orig_name') || name)\n : name;\n\n const val = type === 'step' ? [currentNode.dataset.id.substring(5)] : [];\n\n const original_name_length = original_name == null ? name.length : original_name.length;\n const suffix = name.substring(original_name_length);\n\n if (!simplified_dom[name]) {\n // init entry\n simplified_dom[name] = {name, type, original_name, suffix, val}\n }\n\n if (type === 'input') {\n\n // skip unchecked checkboxes and radiobuttons\n if ( (currentNode.type === 'checkbox' || currentNode.type === 'radio') && !currentNode.checked ) continue;\n\n // if multiselect, make sure to add all the values\n if ( currentNode.multiple ) {\n simplified_dom[name].val = Object.values(currentNode.options).filter(o => o.selected).map(o => o.value)\n } else {\n simplified_dom[name].val.push(currentNode.value);\n }\n }\n\n }\n\n return simplified_dom;\n },\n\n updateMultistepState: function (multistep) {\n if (multistep == null) return;\n\n // update hidden input field\n\n var stepsData = {\n currentStep : multistep.currentStep,\n numSteps : multistep.numSteps,\n fieldsInCurrentStep : multistep.getFieldsInStep(multistep.currentStep)\n };\n multistep.form.$input_steps.val(JSON.stringify(stepsData));\n\n // update Buttons\n multistep.$btn_prev.removeClass('disabled').attr('disabled', false);\n multistep.$btn_next.removeClass('disabled').attr('disabled', false);\n if (multistep.currentStep == multistep.numSteps) {\n multistep.$btn_next.addClass('disabled').attr('disabled', true);\n }\n if (multistep.currentStep == 1) {\n multistep.$btn_prev.addClass('disabled').attr('disabled', true);\n }\n\n // replace next button with submit button on last step.\n // TODO: make this depend on a setting\n var $submit_button = multistep.form.$form.find('input[type=\"submit\"]').eq(0);\n var $ajax_loader = multistep.form.$form.find('.ajax-loader').eq(0);\n if (multistep.currentStep == multistep.numSteps) {\n multistep.$btn_next.hide();\n $ajax_loader.detach().appendTo(multistep.$btn_next.parent());\n $submit_button.detach().appendTo(multistep.$btn_next.parent());\n $submit_button.show();\n } else {\n $submit_button.hide();\n multistep.$btn_next.show();\n }\n\n // update dots\n var $dots = multistep.$dots.find('.dot');\n $dots.removeClass('active').removeClass('completed');\n for(var step = 1; step <= multistep.numSteps; step++) {\n if (step < multistep.currentStep) {\n $dots.eq(step-1).addClass('completed');\n } else if (step == multistep.currentStep) {\n $dots.eq(step-1).addClass('active');\n }\n }\n\n },\n\n should_group_be_shown : function(condition) {\n\n var show_group = true;\n\n for (var and_rule_i = 0; and_rule_i < condition.and_rules.length; and_rule_i++) {\n\n var condition_ok = false;\n\n var condition_and_rule = condition.and_rules[and_rule_i];\n\n var inputField = wpcf7cf_getFieldByName(condition_and_rule.if_field);\n\n var if_val = condition_and_rule.if_value;\n var operator = condition_and_rule.operator;\n\n //backwards compat\n operator = operator === '≤' ? 'less than or equals' : operator;\n operator = operator === '≥' ? 'greater than or equals' : operator;\n operator = operator === '>' ? 'greater than' : operator;\n operator = operator === '<' ? 'less than' : operator;\n\n condition_ok = this.isConditionTrue(inputField.val,operator,if_val);\n\n show_group = show_group && condition_ok;\n }\n\n return show_group;\n\n },\n isConditionTrue(values, operator, testValue='', $field=jQuery()) {\n\n if (!Array.isArray(values)) {\n values = [values];\n }\n\n let condition_ok = false; // start by assuming that the condition is not met\n\n // Considered EMPTY: [] [''] [null] ['',null] [,,'']\n // Considered NOT EMPTY: [0] ['ab','c'] ['',0,null]\n const valuesAreEmpty = values.length === 0 || values.every((v) => !v&&v!==0); // 0 is not considered empty\n\n // special cases: [] equals '' => TRUE; [] not equals '' => FALSE\n if (operator === 'equals' && testValue === '' && valuesAreEmpty) {\n return true;\n }\n if (operator === 'not equals' && testValue === '' && valuesAreEmpty) {\n return false;\n }\n\n if (valuesAreEmpty) {\n if (operator === 'is empty') {\n condition_ok = true;\n }\n } else {\n if (operator === 'not empty') {\n condition_ok = true;\n }\n }\n\n const testValueNumber = isFinite(parseFloat(testValue)) ? parseFloat(testValue) : NaN;\n\n\n if (operator === 'not equals' || operator === 'not equals (regex)') {\n // start by assuming that the condition is met\n condition_ok = true;\n }\n\n if (\n operator === 'function'\n && typeof window[testValue] == 'function'\n && window[testValue]($field) // here we call the actual user defined function\n ) {\n condition_ok = true;\n }\n\n let regex_patt = /.*/i; // fallback regex pattern\n let isValidRegex = true;\n if (operator === 'equals (regex)' || operator === 'not equals (regex)') {\n try {\n regex_patt = new RegExp(testValue, 'i');\n } catch(e) {\n isValidRegex = false;\n }\n }\n\n\n for(let i = 0; i < values.length; i++) {\n\n const value = values[i];\n\n const valueNumber = isFinite(parseFloat(value)) ? parseFloat(value) : NaN;\n const valsAreNumbers = !isNaN(valueNumber) && !isNaN(testValueNumber);\n\n if (\n\n operator === 'equals' && value === testValue ||\n operator === 'equals (regex)' && regex_patt.test(value) ||\n operator === 'greater than' && valsAreNumbers && valueNumber > testValueNumber ||\n operator === 'less than' && valsAreNumbers && valueNumber < testValueNumber ||\n operator === 'greater than or equals' && valsAreNumbers && valueNumber >= testValueNumber ||\n operator === 'less than or equals' && valsAreNumbers && valueNumber <= testValueNumber\n \n ) {\n\n condition_ok = true;\n break;\n\n } else if (\n\n operator === 'not equals' && value === testValue ||\n operator === 'not equals (regex)' && regex_patt.test(value)\n\n ) {\n\n condition_ok = false;\n break;\n\n }\n }\n\n return condition_ok;\n\n }\n\n};\n\njQuery('.wpcf7-form').each(function(){\n wpcf7cf_forms.push(new Wpcf7cfForm(jQuery(this)));\n});\n\n// Call displayFields again on all forms\n// Necessary in case some theme or plugin changed a form value by the time the entire page is fully loaded.\njQuery('document').ready(function() {\n wpcf7cf_forms.forEach(function(f){\n f.displayFields();\n });\n});\n\n// fix for exclusive checkboxes in IE (this will call the change-event again after all other checkboxes are unchecked, triggering the display_fields() function)\nvar old_wpcf7ExclusiveCheckbox = jQuery.fn.wpcf7ExclusiveCheckbox;\njQuery.fn.wpcf7ExclusiveCheckbox = function() {\n return this.find('input:checkbox').on('click', function() {\n var name = jQuery(this).attr('name');\n jQuery(this).closest('form').find('input:checkbox[name=\"' + name + '\"]').not(this).prop('checked', false).eq(0).change();\n });\n};\n\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;","module.exports = require(\"regenerator-runtime\");\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n"],"sourceRoot":""}
js/scripts_admin.js CHANGED
@@ -1,373 +1,447 @@
1
  /**
2
- * Created by jules on 7/17/2015.
 
3
  */
4
- var $wpcf7cf_new_entry = jQuery('#wpcf7cf-new-entry').eq(0);
5
 
6
- if ($wpcf7cf_new_entry.length > 0) {
7
 
8
- var wpcf7cf_new_and_rule_html = $wpcf7cf_new_entry.find('.wpcf7cf-and-rule')[0].outerHTML;
9
- var wpcf7cf_new_entry_html = $wpcf7cf_new_entry.html();
10
 
11
- var cf_rule_regex = /(?:show \[([^\]]*?)\]) if \[([^\]]*?)\] (?:(equals \(regex\)|not equals \(regex\)|equals|not equals|greater than or equals|greater than|less than or equals|less than|is empty|not empty|function)(?: \"(.*)\")?)/g;
12
- var cf_rule_regex_and = /and if \[([^\]]*?)\] (?:(equals \(regex\)|not equals \(regex\)|equals|not equals|greater than or equals|greater than|less than or equals|less than|is empty|not empty|function)(?: \"(.*)\")?)/g;
13
 
 
 
 
 
 
 
 
14
 
15
- if (_wpcf7 == null) { var _wpcf7 = wpcf7}; // wpcf7 4.8 fix
16
 
17
- var old_compose = _wpcf7.taggen.compose;
 
18
 
19
- var regexes = [
20
- { label: wpcf7cf_options_0.regex_email_label, desc: wpcf7cf_options_0.regex_email },
21
- { label: wpcf7cf_options_0.regex_numeric_label, desc: wpcf7cf_options_0.regex_numeric },
22
- { label: wpcf7cf_options_0.regex_alphanumeric_label, desc: wpcf7cf_options_0.regex_alphanumeric },
23
- { label: wpcf7cf_options_0.regex_alphabetic_label, desc: wpcf7cf_options_0.regex_alphabetic },
24
- { label: wpcf7cf_options_0.regex_date_label, desc: wpcf7cf_options_0.regex_date },
25
- { label: wpcf7cf_options_0.regex_custom_1_label, desc: wpcf7cf_options_0.regex_custom_1 },
26
- { label: wpcf7cf_options_0.regex_custom_2_label, desc: wpcf7cf_options_0.regex_custom_2 },
27
- { label: wpcf7cf_options_0.regex_custom_3_label, desc: wpcf7cf_options_0.regex_custom_3 },
28
- { label: wpcf7cf_options_0.regex_custom_4_label, desc: wpcf7cf_options_0.regex_custom_4 },
29
- { label: wpcf7cf_options_0.regex_custom_5_label, desc: wpcf7cf_options_0.regex_custom_5 },
30
- ];
31
 
32
- var i = regexes.length;
33
- while (i--) {
34
- if (null == regexes[i].label || null == regexes[i].desc || regexes[i].label == '' || regexes[i].desc == '') {
35
- regexes.splice(i,1);
36
- }
37
- }
38
-
39
- var termTemplate = "<span class='ui-autocomplete-term'>%s</span>";
40
-
41
- (function($) {
42
 
43
- $('#wpcf7cf-entries').sortable();
44
- $(('.wpcf7cf-and-rules')).sortable();
45
 
 
 
 
 
 
46
 
47
- // ...before overwriting the jQuery extension point
48
- _wpcf7.taggen.compose = function(tagType, $form)
49
- {
50
-
51
- $('#tag-generator-panel-group-style-hidden').val($('#tag-generator-panel-group-style').val());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
- // original behavior - use function.apply to preserve context
54
- var ret = old_compose.apply(this, arguments);
55
- //tagType = arguments[0];
56
- //$form = arguments[1];
57
 
58
- // START: code here will be executed after the _wpcf7.taggen.update function
59
- if (tagType== 'group') ret += "[/group]";
60
- if (tagType== 'repeater') ret += "[/repeater]";
 
61
 
62
- // END
 
 
 
63
 
64
- if (tagType== 'togglebutton') {
65
- $val1 = $('#tag-generator-panel-togglebutton-value-1');
66
- $val2 = $('#tag-generator-panel-togglebutton-value-2');
67
- var val1 = $val1.val();
68
- var val2 = $val2.val();
69
 
70
- if (val1 == "") val1 = $val1.data('default');
71
- if (val2 == "") val2 = $val2.data('default');
 
 
 
 
 
 
72
 
73
- str_val = ' "'+val1+'" "'+val2+'"';
 
 
 
 
 
74
 
75
- ret = ret.replace(']', str_val+']');
76
- }
 
 
 
 
 
77
 
78
- return ret;
79
- };
80
 
81
- var index = $('#wpcf7cf-entries .entry').length;
82
- var index_and = 0;
83
 
84
- $('#wpcf7cf-add-button').click(function(){
 
 
85
 
86
- var id = add_condition_fields();
 
87
 
88
- return false;
89
 
90
- });
 
 
91
 
92
- function clear_all_condition_fields() {
93
- $('.entry').remove();
94
  }
95
 
96
- function add_condition_fields() {
97
- $('<div class="entry" id="entry-'+index+'">'+(wpcf7cf_new_entry_html.replace(/{id}/g, index))+'</div>').appendTo('#wpcf7cf-entries');
98
- index++;
99
- update_entries();
100
- update_settings_textarea();
101
- return (index-1);
102
- }
103
 
104
- function add_and_condition_fields(id) {
105
- // $('#entry-'+id+' .wpcf7cf-and-rules').eq(0).append($wpcf7cf_new_and_rule.clone());
106
- $('#entry-'+id+' .wpcf7cf-and-rules').eq(0).append(wpcf7cf_new_and_rule_html.replace(/{id}/g, index-1).replace(/\[and_rules\]\[0\]/g, '[and_rules]['+index_and+']'));
107
- index_and++;
108
- return (index_and-1);
109
- }
110
 
111
- /**
112
- * Copy the textarea field to the entries.
113
- */
114
- function import_condition_fields() {
115
 
116
- $if_values = $('.if-value');
117
 
118
- var lines = $('#wpcf7cf-settings-text').val().split(/\r?\n/);
 
 
 
 
 
 
 
 
 
 
119
 
120
- var id = -1;
121
 
122
- for (var i = 0; i<lines.length; i++) {
123
 
124
- var str = lines[i];
 
 
125
 
126
- var match = cf_rule_regex.exec(str);
127
 
128
- if (match != null) {
 
 
 
 
 
 
 
 
129
 
130
- index_and = 0; // reset this for each first condition (This one has and_index [0]).
 
 
 
 
 
 
 
131
 
132
- id = add_condition_fields();
133
 
134
- $('#entry-'+id+' .then-field-select').val(match[1]);
135
- $('#entry-'+id+' .if-field-select').val(match[2]);
136
- $('#entry-'+id+' .operator').val(match[3]);
137
- $('#entry-'+id+' .if-value').val(match[4]);
138
 
139
- index_and = 1; // the next and condition will have and_index [1];
 
140
 
141
- cf_rule_regex.lastIndex = 0;
142
 
143
- }
 
 
 
 
144
 
145
- match = cf_rule_regex_and.exec(str);
 
 
 
 
146
 
147
- if (match != null && id != -1) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
- var and_id = add_and_condition_fields(id);
150
 
151
- $('#entry-'+id+' .wpcf7cf-and-rule:last-child .if-field-select').val(match[1]);
152
- $('#entry-'+id+' .wpcf7cf-and-rule:last-child .operator').val(match[2]);
153
- $('#entry-'+id+' .wpcf7cf-and-rule:last-child .if-value').val(match[3]);
154
 
155
- cf_rule_regex_and.lastIndex = 0;
 
156
 
157
- }
158
- }
 
159
 
160
- update_entries();
 
 
 
 
161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  }
 
163
 
164
- $('#wpcf7-admin-form-element, #post').on('submit.wpcf7cf', function() {
165
- update_settings_textarea();
166
- return true;
167
- });
168
 
169
- // export/import settings
170
 
171
- $('#wpcf7cf-settings-text-wrap').hide();
 
172
 
173
- $('#wpcf7cf-settings-to-text').click(function() {
174
- $('#wpcf7cf-settings-text-wrap').show();
175
- update_settings_textarea();
 
 
 
 
 
 
 
 
 
176
  return false;
177
- });
178
-
179
- /**
180
- * Copy the entries to the textarea field.
181
- */
182
- function update_settings_textarea() {
183
- $('#wpcf7cf-settings-text').val('');
184
- $('#wpcf7cf-entries .entry').each(function() {
185
- var $entry = $(this);
186
- var line = 'show [' + $entry.find('.then-field-select').val() + ']';
187
- var text_indent = line.length-3;
188
- $entry.find('.wpcf7cf-and-rule').each(function(i) {
189
- const $and_rule = $(this);
190
- const operator = $and_rule.find('.operator').val();
191
- if (i>0) {
192
-
193
- line += '\n'+' '.repeat(text_indent)+'and';
194
-
195
- }
196
- line += ' if [' + $and_rule.find('.if-field-select').val() + ']' + ' ' + operator;
197
- if (!['is empty', 'not empty'].includes(operator)) {
198
- line += ' "' + $and_rule.find('.if-value').val() + '"';
199
- }
200
- });
201
- $('#wpcf7cf-settings-text').val($('#wpcf7cf-settings-text').val() + line + "\n" );
202
  });
 
 
 
 
 
 
 
203
  }
 
 
 
 
 
204
 
205
- $if_values = $('.if-value');
206
 
207
- $('#add-fields').click(function() {
208
- import_condition_fields();
209
- return false;
210
- });
211
 
212
- $('#overwrite-fields').click(function() {
213
- clear_all_condition_fields();
214
- import_condition_fields();
215
- return false;
216
- });
 
 
 
 
 
 
 
 
217
 
218
- $('#wpcf7cf-settings-text').on('change.wpcf7cf', function(){
219
- clear_all_condition_fields();
220
- import_condition_fields();
221
- return true;
222
- });
 
 
223
 
224
-
 
225
 
226
- $('#wpcf7cf-settings-text-clear').click(function() {
227
- $('#wpcf7cf-settings-text-wrap').hide();
228
- $('#wpcf7cf-settings-text').val('');
229
- return false;
230
- });
231
-
232
- function update_entries() {
233
- $if_values = $('.if-value');
234
- init_autocomplete();
235
- $if_values.css({'visibility':'visible'});
236
- $if_values.autocomplete( "disable" );
237
-
238
- $('#wpcf7cf-entries .wpcf7cf-and-rule').each(function() {
239
- var $and_rule = $(this);
240
- if ($and_rule.find('.operator').eq(0).val() === 'is empty' || $and_rule.find('.operator').eq(0).val() === 'not empty') {
241
- $and_rule.find('.if-value').eq(0).css({'visibility':'hidden'});
242
- } else if ($and_rule.find('.operator').eq(0).val().endsWith('(regex)')) {
243
- $and_rule.find('.if-value').eq(0).autocomplete( "enable" );
244
- }
245
- });
246
 
247
- scale_and_button();
 
 
 
 
248
 
249
- set_events();
250
- }
 
 
 
 
 
 
251
 
252
- function init_autocomplete() {
253
-
254
- $if_values.autocomplete({
255
- disabled: true,
256
- source: function(request, response) {
257
- var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
258
- response($.grep(regexes, function(value) {
259
- return matcher.test(value.label || value.value || value) || matcher.test(value.desc);
260
- }));
261
- },
262
- focus: function( event, ui ) {
263
- $( event.target ).val( ui.item.desc );
264
- return false;
265
- },
266
- select: function( event, ui ) {
267
- $( event.target ).val( ui.item.desc );
268
- return false;
269
- },
270
- open: function(e,ui) {
271
- $el = $(e.target);
272
- var styledTerm = termTemplate.replace('%s', $el.val());
273
-
274
- $('.ui-autocomplete').find('em').each(function() {
275
- var me = $(this);
276
- me.html( me.text().replace($el.val(), styledTerm) );
277
- });
278
- },
279
- minLength: 0
280
- }).each(function() {
281
- $(this).autocomplete( "instance" )._renderItem = function( ul, item ) {
282
- return $("<li>")
283
- .append("<div><em>" + item.label + "</em><br><em>" + item.desc + "</em></div>")
284
- .appendTo(ul);
285
- }
286
- });
287
- $if_values.on('focus', function() {
288
- $(this).autocomplete("search");
289
- });
290
  }
 
 
 
 
 
 
 
291
 
292
- update_entries();
 
 
293
 
294
- function set_events() { // called at the end of update_entries
295
-
296
- $('.wpcf7cf-and-rules').sortable();
297
-
298
- $('.and-button').off('click').click(function() {
299
- $this = $(this);
300
- $andblock = $this.closest('.wpcf7cf-and-rule');
301
- $andblocks_container = $this.closest('.wpcf7cf-and-rules');
302
- next_index = $andblocks_container.data('next-index');
303
- $andblocks_container.data('next-index',next_index+1);
304
- var and_i = next_index;
305
- clone_html = $andblock.get(0).outerHTML.replace(/wpcf7cf_options\[([0-9]*)\]\[and_rules\]\[([0-9]*)\]/g, 'wpcf7cf_options[$1][and_rules]['+and_i+']');
306
- $andblock.after(clone_html);
307
- update_settings_textarea();
308
- update_entries();
309
- return false;
310
- });
311
 
312
- $('.delete-button').off('click').click(function(){
313
- $and_rule = $(this).closest('.wpcf7cf-and-rule');
314
- if ($and_rule.siblings().length > 0) {
315
- $and_rule.remove();
316
- } else {
317
- $and_rule[0].closest('.entry').remove();
318
- }
319
 
320
- update_settings_textarea();
321
- update_entries();
322
 
323
- return false;
324
- });
 
325
 
326
- $('.operator').off('change').change(function() {
327
- update_entries();
328
- return false;
329
- });
330
 
331
- $('input,select', '#wpcf7cf-entries').off('change.wpcf7cf_sync').on('change.wpcf7cf_sync', function() {
332
- update_settings_textarea();
333
- });
334
- }
335
 
336
- function scale_and_button() {
337
- $('.wpcf7cf-and-rule:first-child .and-button').each(function(){
338
- $and_button = $(this);
339
- num_and_rules = $and_button.closest('.wpcf7cf-and-rule').siblings().length+1;
340
- var height = (34*num_and_rules-12)+'px';
341
- $and_button.css({'height':height,'line-height':height});
342
- });
343
- }
344
 
345
- })( jQuery );
346
 
347
- }
348
 
349
- (function($) {
350
- // ------------------------------------
351
- // OPTIONS PAGE
352
- // ------------------------------------
353
 
354
- $(document).ready(function() {
355
 
356
- $('.wpcf7cf-options-notice .notice-dismiss-2').click(function () {
357
- $('.wpcf7cf-options-notice .notice-dismiss').click();
358
- });
359
- $('.wpcf7cf-options-notice .notice-dismiss').click(function () {
360
- wpcf7cf_dismiss_notice();
361
- });
362
 
363
- function wpcf7cf_dismiss_notice() {
 
 
364
 
365
- $('input[name="wpcf7cf_options[notice_dismissed]"]').val('true');
 
 
 
 
366
 
367
- $.post(ajaxurl, {action:'wpcf7cf_dismiss_notice'}, function(response) {
368
- // nothing to do. dismiss_notice option should be set to TRUE server side by now.
369
- });
370
- }
371
 
372
- });
373
- })( jQuery );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /**
2
+ * These scripts are part of the Conditional Fields for Contact Form 7 plugin.
3
+ * Should only be loaded when editing a form in the WP backend.
4
  */
 
5
 
 
6
 
7
+ var wpcf7cf = {};
 
8
 
9
+ wpcf7cf.MAX_CONDITIONS = 50;
 
10
 
11
+ wpcf7cf.$newEntry = jQuery('#wpcf7cf-new-entry').eq(0);
12
+ wpcf7cf.$textView = jQuery('#wpcf7cf-settings-text').eq(0);
13
+ wpcf7cf.$textOnlyCheckbox = jQuery('#wpcf7cf-text-only-checkbox').eq(0);
14
+ wpcf7cf.$entriesUi = jQuery('#wpcf7cf-entries-ui').eq(0);
15
+ wpcf7cf.$addButton = jQuery('#wpcf7cf-add-button').eq(0);
16
+ wpcf7cf.$maxReachedWarning = jQuery('#wpcf7cf-a-lot-of-conditions').eq(0);
17
+ wpcf7cf.$formEditorForm = jQuery('#wpcf7-admin-form-element').eq(0);
18
 
19
+ wpcf7cf.$if_values = jQuery('.if-value'); // gets updated now and then
20
 
21
+ wpcf7cf.regexCondition = /(?:show \[([^\]]*?)\]) if \[([^\]]*?)\] (?:(equals \(regex\)|not equals \(regex\)|equals|not equals|greater than or equals|greater than|less than or equals|less than|is empty|not empty|function)(?: \"(.*)\")?)/g;
22
+ wpcf7cf.regexConditionAnd = /and if \[([^\]]*?)\] (?:(equals \(regex\)|not equals \(regex\)|equals|not equals|greater than or equals|greater than|less than or equals|less than|is empty|not empty|function)(?: \"(.*)\")?)/g;
23
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
+ // HTML templates
26
+ wpcf7cf.template_for_condition_fields_with_one_and_rule = wpcf7cf.$newEntry.html();
27
+ wpcf7cf.template_for_and_rule = wpcf7cf.$newEntry.find('.wpcf7cf-and-rule')[0] ? wpcf7cf.$newEntry.find('.wpcf7cf-and-rule')[0].outerHTML : '';
28
+ // remove and-rules from dom
29
+ wpcf7cf.$newEntry.find('.wpcf7cf-and-rules').eq(0).html('');
30
+ wpcf7cf.template_for_condition_fields_without_and_rules = wpcf7cf.$newEntry.html();
 
 
 
 
31
 
32
+ wpcf7cf.transformConditionsFromStringToArrayOfObjects = function(str) {
 
33
 
34
+ if (!str) str = '';
35
+
36
+ var conditionsAsStrings = str.split(/\r?\n(?=show)/);
37
+ var conditionsAsObjects = [];
38
+ for (var i = 0; i<conditionsAsStrings.length; i++) {
39
 
40
+ var lines = conditionsAsStrings[i].split(/\r?\n/);
41
+
42
+ wpcf7cf.regexCondition.lastIndex = 0;
43
+ var line1Match = wpcf7cf.regexCondition.exec(lines[0]);
44
+
45
+ if (line1Match != null) {
46
+
47
+ var conditionObject = {
48
+ then_field:line1Match[1],
49
+ and_rules: [
50
+ {
51
+ if_field: line1Match[2],
52
+ operator: line1Match[3],
53
+ if_value: line1Match[4],
54
+ },
55
+ ],
56
+ };
57
+
58
+ for(var and_i = 1; and_i < lines.length; and_i++) {
59
+ wpcf7cf.regexConditionAnd.lastIndex = 0;
60
+ lineMatch = wpcf7cf.regexConditionAnd.exec(lines[and_i]);
61
+ if (lineMatch != null) {
62
+ conditionObject.and_rules.push({
63
+ if_field: lineMatch[1],
64
+ operator: lineMatch[2],
65
+ if_value: lineMatch[3],
66
+ });
67
+ }
68
+ }
69
 
70
+ conditionsAsObjects.push(conditionObject);
 
 
 
71
 
72
+ }
73
+ }
74
+ return conditionsAsObjects;
75
+ }
76
 
77
+ wpcf7cf.getnumberOfTextEntries = function () {
78
+ const textConditions = wpcf7cf.transformConditionsFromStringToArrayOfObjects(wpcf7cf.$textView.val());
79
+ return textConditions.length;
80
+ }
81
 
82
+ wpcf7cf.getnumberOfFieldEntries = function () {
83
+ return wpcf7cf.$entriesUi.find('.entry').length;
84
+ }
 
 
85
 
86
+ wpcf7cf.transformConditionsFromArrayOfObjectsToString = function(conditions) {
87
+ return conditions.map(function(condition){
88
+ var indent = ' '.repeat(condition.then_field.length + 4);
89
+ return `show [${condition.then_field}] `+condition.and_rules.map(function(rule, i){
90
+ return ( i>0 ? indent+'and ':'' ) + `if [${rule.if_field}] ${rule.operator} "${rule.if_value}"`
91
+ }).join('\n');
92
+ }).join('\n');
93
+ }
94
 
95
+ /**
96
+ * Tranform an array of conditions (Objects) to HTML fields
97
+ * @param Array conditions
98
+ * @returns jQuery
99
+ */
100
+ wpcf7cf.transformConditionsFromArrayOfObjectsToFieldElements = function(conditions) {
101
 
102
+ if ( wpcf7cf.MAX_CONDITIONS < conditions.length ) {
103
+ jQuery('#wpcf7cf-entries').html('');
104
+ wpcf7cf.maybeDisableAddButton();
105
+ return;
106
+ }
107
+
108
+ var entries = [];
109
 
110
+ for (var c_i = 0; c_i<conditions.length; c_i++) {
 
111
 
112
+ var condition = conditions[c_i];
113
+ var id=0;
114
 
115
+ // setup then_field
116
+ var $entry = jQuery( '<div class="entry">' + wpcf7cf.template_for_condition_fields_without_and_rules + '</div>' );
117
+ jQuery('.then-field-select', $entry).val(condition.then_field);
118
 
119
+ for (var a_i = 0; a_i < condition.and_rules.length; a_i++) {
120
+ var and_rule = condition.and_rules[a_i];
121
 
122
+ $rule = jQuery(wpcf7cf.template_for_and_rule);
123
 
124
+ jQuery('.if-field-select', $rule).val(and_rule.if_field);
125
+ jQuery('.operator', $rule).val(and_rule.operator);
126
+ jQuery('.if-value', $rule).val(and_rule.if_value);
127
 
128
+ jQuery('.wpcf7cf-and-rules', $entry).eq(0).append($rule);
129
+
130
  }
131
 
132
+ entries.push($entry);
133
+ }
 
 
 
 
 
134
 
135
+ jQuery('#wpcf7cf-entries').html(entries);
 
 
 
 
 
136
 
137
+ update_entries();
 
 
 
138
 
139
+ }
140
 
141
+ wpcf7cf.maybeDisableAddButton = function() {
142
+ if (wpcf7cf.getnumberOfTextEntries() >= wpcf7cf.MAX_CONDITIONS && wpcf7cf.getnumberOfFieldEntries() == 0 ||
143
+ wpcf7cf.getnumberOfFieldEntries() >= wpcf7cf.MAX_CONDITIONS
144
+ ) {
145
+ wpcf7cf.$addButton.hide();
146
+ wpcf7cf.$maxReachedWarning.show();
147
+ } else {
148
+ wpcf7cf.$addButton.show();
149
+ wpcf7cf.$maxReachedWarning.hide();
150
+ }
151
+ }
152
 
153
+ wpcf7cf.maybeDisableAddButton();
154
 
155
+ wpcf7cf.transformConditionsFromFieldsToArrayOfObjects = function($entries) {
156
 
157
+ if (!$entries) {
158
+ $entries = jQuery('#wpcf7cf-entries .entry');
159
+ }
160
 
161
+ var conditionsAsObjects = [];
162
 
163
+ $entries.each(function() {
164
+
165
+ var $entry = jQuery(this);
166
+ var then_field = $entry.find('.then-field-select').val();
167
+
168
+ var conditionObject = {
169
+ then_field: then_field,
170
+ and_rules: [],
171
+ };
172
 
173
+ $entry.find('.wpcf7cf-and-rule').each(function(i) {
174
+ const $and_rule = jQuery(this);
175
+ conditionObject.and_rules.push({
176
+ operator : $and_rule.find('.operator').val(),
177
+ if_field : $and_rule.find('.if-field-select').val(),
178
+ if_value : $and_rule.find('.if-value').val(),
179
+ });
180
+ });
181
 
182
+ conditionsAsObjects.push(conditionObject);
183
 
184
+ });
 
 
 
185
 
186
+ return conditionsAsObjects;
187
+ }
188
 
 
189
 
190
+ wpcf7cf.copyTextToFields = function() {
191
+ var str = wpcf7cf.$textView.val();
192
+ var obj = wpcf7cf.transformConditionsFromStringToArrayOfObjects(str);
193
+ wpcf7cf.transformConditionsFromArrayOfObjectsToFieldElements(obj);
194
+ }
195
 
196
+ wpcf7cf.copyFieldsToText = function() {
197
+ var obj = wpcf7cf.transformConditionsFromFieldsToArrayOfObjects();
198
+ var str = wpcf7cf.transformConditionsFromArrayOfObjectsToString(obj);
199
+ wpcf7cf.$textView.val(str);
200
+ }
201
 
202
+ var regexes = [
203
+ { label: wpcf7cf_options_0.regex_email_label, desc: wpcf7cf_options_0.regex_email },
204
+ { label: wpcf7cf_options_0.regex_numeric_label, desc: wpcf7cf_options_0.regex_numeric },
205
+ { label: wpcf7cf_options_0.regex_alphanumeric_label, desc: wpcf7cf_options_0.regex_alphanumeric },
206
+ { label: wpcf7cf_options_0.regex_alphabetic_label, desc: wpcf7cf_options_0.regex_alphabetic },
207
+ { label: wpcf7cf_options_0.regex_date_label, desc: wpcf7cf_options_0.regex_date },
208
+ { label: wpcf7cf_options_0.regex_custom_1_label, desc: wpcf7cf_options_0.regex_custom_1 },
209
+ { label: wpcf7cf_options_0.regex_custom_2_label, desc: wpcf7cf_options_0.regex_custom_2 },
210
+ { label: wpcf7cf_options_0.regex_custom_3_label, desc: wpcf7cf_options_0.regex_custom_3 },
211
+ { label: wpcf7cf_options_0.regex_custom_4_label, desc: wpcf7cf_options_0.regex_custom_4 },
212
+ { label: wpcf7cf_options_0.regex_custom_5_label, desc: wpcf7cf_options_0.regex_custom_5 },
213
+ ];
214
+
215
+ var i = regexes.length;
216
+ while (i--) {
217
+ if (null == regexes[i].label || null == regexes[i].desc || regexes[i].label == '' || regexes[i].desc == '') {
218
+ regexes.splice(i,1);
219
+ }
220
+ }
221
 
222
+ var termTemplate = "<span class='ui-autocomplete-term'>%s</span>";
223
 
224
+ jQuery('#wpcf7cf-entries').sortable();
 
 
225
 
226
+ var index = jQuery('#wpcf7cf-entries .entry').length;
227
+ var index_and = 0;
228
 
229
+ wpcf7cf.$addButton.click(function(){
230
+ add_condition_fields();
231
+ });
232
 
233
+ function add_condition_fields() {
234
+ $c = jQuery('<div class="entry">'+wpcf7cf.template_for_condition_fields_with_one_and_rule+'</div>')
235
+ $c.appendTo('#wpcf7cf-entries');
236
+ update_entries();
237
+ }
238
 
239
+ function update_entries() {
240
+ wpcf7cf.$if_values = jQuery('.if-value');
241
+ init_autocomplete();
242
+ wpcf7cf.$if_values.css({'visibility':'visible'});
243
+ wpcf7cf.$if_values.autocomplete( "disable" );
244
+
245
+ jQuery('#wpcf7cf-entries .wpcf7cf-and-rule').each(function() {
246
+ var $and_rule = jQuery(this);
247
+ var $operatorField = $and_rule.find('.operator').eq(0);
248
+ var operator = $operatorField.val() || 'equals';
249
+ if ($and_rule.find('.operator').eq(0).val() === 'is empty' || $and_rule.find('.operator').eq(0).val() === 'not empty') {
250
+ $and_rule.find('.if-value').eq(0).css({'visibility':'hidden'});
251
+ } else if (operator.endsWith('(regex)')) {
252
+ $and_rule.find('.if-value').eq(0).autocomplete( "enable" );
253
  }
254
+ });
255
 
256
+ scale_and_button();
 
 
 
257
 
258
+ set_events();
259
 
260
+ wpcf7cf.maybeDisableAddButton();
261
+ }
262
 
263
+ function init_autocomplete() {
264
+
265
+ wpcf7cf.$if_values.autocomplete({
266
+ disabled: true,
267
+ source: function(request, response) {
268
+ var matcher = new RegExp(jQuery.ui.autocomplete.escapeRegex(request.term), "i");
269
+ response(jQuery.grep(regexes, function(value) {
270
+ return matcher.test(value.label || value.value || value) || matcher.test(value.desc);
271
+ }));
272
+ },
273
+ focus: function( event, ui ) {
274
+ jQuery( event.target ).val( ui.item.desc );
275
  return false;
276
+ },
277
+ select: function( event, ui ) {
278
+ jQuery( event.target ).val( ui.item.desc );
279
+ return false;
280
+ },
281
+ open: function(e,ui) {
282
+ $el = jQuery(e.target);
283
+ var styledTerm = termTemplate.replace('%s', $el.val());
284
+
285
+ jQuery('.ui-autocomplete').find('em').each(function() {
286
+ var me = jQuery(this);
287
+ me.html( me.text().replace($el.val(), styledTerm) );
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  });
289
+ },
290
+ minLength: 0
291
+ }).each(function() {
292
+ jQuery(this).autocomplete( "instance" )._renderItem = function( ul, item ) {
293
+ return jQuery("<li>")
294
+ .append("<div><em>" + item.label + "</em><br><em>" + item.desc + "</em></div>")
295
+ .appendTo(ul);
296
  }
297
+ });
298
+ wpcf7cf.$if_values.on('focus', function() {
299
+ jQuery(this).autocomplete("search");
300
+ });
301
+ }
302
 
303
+ function set_events() { // called at the end of update_entries
304
 
305
+ jQuery('.wpcf7cf-and-rules').sortable();
 
 
 
306
 
307
+ jQuery('.and-button').off('click').click(function() {
308
+ $this = jQuery(this);
309
+ $andblock = $this.closest('.wpcf7cf-and-rule');
310
+ $andblocks_container = $this.closest('.wpcf7cf-and-rules');
311
+ next_index = $andblocks_container.data('next-index');
312
+ $andblocks_container.data('next-index',next_index+1);
313
+ var and_i = next_index;
314
+ clone_html = $andblock.get(0).outerHTML.replace(/wpcf7cf_options\[([0-9]*)\]\[and_rules\]\[([0-9]*)\]/g, 'wpcf7cf_options[$1][and_rules]['+and_i+']');
315
+ $andblock.after(clone_html);
316
+ //update_settings_textarea();
317
+ update_entries();
318
+ return false;
319
+ });
320
 
321
+ jQuery('.delete-button').off('click').click(function(){
322
+ $and_rule = jQuery(this).closest('.wpcf7cf-and-rule');
323
+ if ($and_rule.siblings().length > 0) {
324
+ $and_rule.remove();
325
+ } else {
326
+ $and_rule[0].closest('.entry').remove();
327
+ }
328
 
329
+ //update_settings_textarea();
330
+ update_entries();
331
 
332
+ return false;
333
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
335
+ jQuery('.operator').off('change').change(function() {
336
+ update_entries();
337
+ return false;
338
+ });
339
+ }
340
 
341
+ function scale_and_button() {
342
+ jQuery('.wpcf7cf-and-rule:first-child .and-button').each(function(){
343
+ $and_button = jQuery(this);
344
+ num_and_rules = $and_button.closest('.wpcf7cf-and-rule').siblings().length+1;
345
+ var height = (34*num_and_rules-12)+'px';
346
+ $and_button.css({'height':height,'line-height':height});
347
+ });
348
+ }
349
 
350
+ // ------------------------------------
351
+ // TOOGGLE UI MODE
352
+ // ------------------------------------
353
+
354
+ function setUiMode(is_text_only) {
355
+ if (is_text_only) {
356
+ wpcf7cf.currentMode = 'text';
357
+ wpcf7cf.$entriesUi.hide();
358
+ wpcf7cf.$textView.show();
359
+ if (wpcf7cf.getnumberOfFieldEntries() > 0) {
360
+ wpcf7cf.copyFieldsToText();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  }
362
+ } else {
363
+ wpcf7cf.currentMode = 'normal';
364
+ wpcf7cf.$entriesUi.show();
365
+ wpcf7cf.$textView.hide();
366
+ wpcf7cf.copyTextToFields();
367
+ }
368
+ }
369
 
370
+ wpcf7cf.$textOnlyCheckbox.on('change', function() {
371
+ setUiMode(wpcf7cf.$textOnlyCheckbox.is(':checked'));
372
+ });
373
 
374
+ setUiMode(wpcf7cf.$textOnlyCheckbox.is(':checked'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
 
376
+ wpcf7cf.$formEditorForm.on('submit', function() {
377
+ wpcf7cf.currentMode = 'normal';
378
+ if (wpcf7cf.getnumberOfFieldEntries() > 0) {
379
+ wpcf7cf.copyFieldsToText();
380
+ }
381
+ });
 
382
 
 
 
383
 
384
+ // ------------------------------------
385
+ // OPTIONS PAGE
386
+ // ------------------------------------
387
 
388
+ jQuery(document).ready(function() {
 
 
 
389
 
390
+ jQuery('.wpcf7cf-options-notice .notice-dismiss-2').click(function () {
391
+ jQuery('.wpcf7cf-options-notice .notice-dismiss').click();
392
+ });
 
393
 
394
+ jQuery('.wpcf7cf-options-notice .notice-dismiss').click(function () {
395
+ wpcf7cf_dismiss_notice();
396
+ });
 
 
 
 
 
397
 
398
+ function wpcf7cf_dismiss_notice() {
399
 
400
+ jQuery('input[name="wpcf7cf_options[notice_dismissed]"]').val('true');
401
 
402
+ jQuery.post(ajaxurl, {action:'wpcf7cf_dismiss_notice'}, function(response) {
403
+ // nothing to do. dismiss_notice option should be set to TRUE server side by now.
404
+ });
 
405
 
406
+ }
407
 
408
+ });
 
 
 
 
 
409
 
410
+ // ------------------------------------
411
+ // CF7 TAG GENERATOR OVERRIDE
412
+ // ------------------------------------
413
 
414
+ if (_wpcf7 == null) { var _wpcf7 = wpcf7}; // wpcf7 4.8 fix
415
+ var old_compose = _wpcf7.taggen.compose;
416
+ // ...before overwriting the jQuery extension point
417
+ _wpcf7.taggen.compose = function(tagType, $form)
418
+ {
419
 
420
+ jQuery('#tag-generator-panel-group-style-hidden').val(jQuery('#tag-generator-panel-group-style').val());
 
 
 
421
 
422
+ // original behavior - use function.apply to preserve context
423
+ var ret = old_compose.apply(this, arguments);
424
+ //tagType = arguments[0];
425
+ //$form = arguments[1];
426
+
427
+ // START: code here will be executed after the _wpcf7.taggen.update function
428
+ if (tagType== 'group') ret += "[/group]";
429
+ if (tagType== 'repeater') ret += "[/repeater]";
430
+ // END
431
+
432
+ if (tagType== 'togglebutton') {
433
+ $val1 = jQuery('#tag-generator-panel-togglebutton-value-1');
434
+ $val2 = jQuery('#tag-generator-panel-togglebutton-value-2');
435
+ var val1 = $val1.val();
436
+ var val2 = $val2.val();
437
+
438
+ if (val1 == "") val1 = $val1.data('default');
439
+ if (val2 == "") val2 = $val2.data('default');
440
+
441
+ str_val = ' "'+val1+'" "'+val2+'"';
442
+
443
+ ret = ret.replace(']', str_val+']');
444
+ }
445
+
446
+ return ret;
447
+ };
js/scripts_es6.js CHANGED
@@ -3,7 +3,18 @@
3
  var cf7signature_resized = 0; // for compatibility with contact-form-7-signature-addon
4
 
5
  var wpcf7cf_timeout;
6
- var wpcf7cf_change_time_ms = window.wpcf7cf_running_tests ? 0 : 100;
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  var wpcf7cf_show_animation = { "height": "show", "marginTop": "show", "marginBottom": "show", "paddingTop": "show", "paddingBottom": "show" };
9
  var wpcf7cf_hide_animation = { "height": "hide", "marginTop": "hide", "marginBottom": "hide", "paddingTop": "hide", "paddingBottom": "hide" };
@@ -15,7 +26,23 @@ var wpcf7cf_change_events = 'input.wpcf7cf paste.wpcf7cf change.wpcf7cf click.wp
15
 
16
  var wpcf7cf_forms = [];
17
 
18
- // endswith polyfill
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  if (!String.prototype.endsWith) {
20
  String.prototype.endsWith = function(search, this_len) {
21
  if (this_len === undefined || this_len > this.length) {
@@ -47,6 +74,12 @@ var Wpcf7cfForm = function($form) {
47
  form.unit_tag = $form.closest('.wpcf7').attr('id');
48
  form.conditions = form_options['conditions'];
49
 
 
 
 
 
 
 
50
  // compatibility with conditional forms created with older versions of the plugin ( < 1.4 )
51
  for (var i=0; i < form.conditions.length; i++) {
52
  var condition = form.conditions[i];
@@ -89,13 +122,13 @@ var Wpcf7cfForm = function($form) {
89
 
90
  // PRO ONLY
91
 
92
- jQuery('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)', $form).each(function(){
93
  form.repeaters.push(new Wpcf7cfRepeater(jQuery(this),form));
94
  });
95
 
96
  form.$input_repeaters.val(JSON.stringify(form.repeaters.map((item)=>item.params.$repeater.id)));
97
 
98
- var $multistep = jQuery('.wpcf7cf_multistep', $form);
99
 
100
  if ($multistep.length) {
101
  form.multistep = new Wpcf7cfMultistep($multistep, form);
@@ -121,9 +154,6 @@ Wpcf7cfForm.prototype.displayFields = function() {
121
 
122
  var form = this;
123
 
124
- window.wpcf7cf.get_simplified_dom_model(form.$form);
125
-
126
- var unit_tag = this.unit_tag;
127
  var wpcf7cf_conditions = this.conditions;
128
  var wpcf7cf_settings = this.settings;
129
 
@@ -144,17 +174,20 @@ Wpcf7cfForm.prototype.displayFields = function() {
144
 
145
  form.$groups.addClass('wpcf7cf-hidden');
146
 
 
 
147
  for (var i=0; i < wpcf7cf_conditions.length; i++) {
148
 
149
  var condition = wpcf7cf_conditions[i];
150
 
151
- var show_group = window.wpcf7cf.should_group_be_shown(condition, form.$form);
152
 
153
  if (show_group) {
154
- jQuery('[data-id="'+condition.then_field+'"]',form.$form).eq(0).removeClass('wpcf7cf-hidden');
155
  }
156
  }
157
 
 
158
  var animation_intime = wpcf7cf_settings.animation_intime;
159
  var animation_outtime = wpcf7cf_settings.animation_outtime;
160
 
@@ -207,17 +240,28 @@ Wpcf7cfForm.prototype.displayFields = function() {
207
  };
208
 
209
  Wpcf7cfForm.prototype.updateSummaryFields = function() {
210
- var $summary = jQuery('.wpcf7cf-summary', this.$form);
 
211
 
212
  if ($summary.length == 0 || !$summary.is(':visible')) return;
213
 
214
  var fd = new FormData();
215
 
216
- var formdata = this.$form.serializeArray();
217
  jQuery.each(formdata,function(key, input){
218
  fd.append(input.name, input.value);
219
  });
220
 
 
 
 
 
 
 
 
 
 
 
221
  jQuery.ajax({
222
  url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary',
223
  type: 'POST',
@@ -272,8 +316,8 @@ Wpcf7cfForm.prototype.updateEventListeners = function() {
272
 
273
  var form = this;
274
 
275
- // monitor input changes, and call display_fields() if something has changed
276
- jQuery('input, select, textarea, button',form.$form).not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events,form, function(e) {
277
  var form = e.data;
278
  clearTimeout(wpcf7cf_timeout);
279
  wpcf7cf_timeout = setTimeout(function() {
@@ -282,7 +326,7 @@ Wpcf7cfForm.prototype.updateEventListeners = function() {
282
  });
283
 
284
  // PRO ONLY
285
- jQuery('.wpcf7cf-togglebutton', form.$form).off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf',function() {
286
  var $this = jQuery(this);
287
  if ($this.text() === $this.data('val-1')) {
288
  $this.text($this.data('val-2'));
@@ -552,7 +596,7 @@ function Wpcf7cfMultistep($multistep, form) {
552
 
553
  });
554
 
555
- // If form is submitted (by pressing return for example), and if we are not on the last step,
556
  // then trigger click event on the $btn_next button instead.
557
  multistep.form.$form.on('submit.wpcf7cf_step', function(e) {
558
 
@@ -588,6 +632,7 @@ Wpcf7cfMultistep.prototype.validateStep = function(step_index) {
588
  var multistep = this;
589
  var $multistep = multistep.$multistep;
590
  var $form = multistep.form.$form;
 
591
 
592
  $form.find('.wpcf7-response-output').addClass('wpcf7-display-none');
593
 
@@ -635,7 +680,7 @@ Wpcf7cfMultistep.prototype.validateStep = function(step_index) {
635
  ) {
636
  checkError = checkError + 1;
637
 
638
- var controlWrap = jQuery('.wpcf7-form-control-wrap.' + index, $form);
639
  controlWrap.find('input').addClass('wpcf7-not-valid');
640
  controlWrap.find('span.wpcf7-not-valid-tip').remove();
641
  controlWrap.append('<span role="alert" class="wpcf7-not-valid-tip">' + el.reason + '</span>');
@@ -691,11 +736,11 @@ Wpcf7cfMultistep.prototype.moveToStep = function(step_index) {
691
  };
692
 
693
  Wpcf7cfMultistep.prototype.getFieldsInStep = function(step_index) {
694
- var simpleDom = window.wpcf7cf.get_simplified_dom_model(this.form.$form);
695
  var inStep = false;
696
- return simpleDom.filter(function(item, i) {
697
  if(item.type == 'step') {
698
- inStep = item.step == step_index+'';
699
  }
700
  return inStep && item.type == 'input';
701
  }).map(function(item) {
@@ -714,8 +759,8 @@ window.wpcf7cf = {
714
 
715
  get_nested_conditions : function(conditions, $current_form) {
716
  //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index
717
- var simplified_dom = window.wpcf7cf.get_simplified_dom_model($current_form);
718
- var groups = simplified_dom.filter(function(item, i) {
719
  return item.type==='group';
720
  });
721
 
@@ -742,62 +787,62 @@ window.wpcf7cf = {
742
 
743
  sub_conditions = sub_conditions.concat(relevant_conditions);
744
  }
745
- return conditions.concat(sub_conditions);
746
  },
747
 
748
  get_simplified_dom_model : function($current_form) {
749
- // if the dom is something like:
750
- // <form>
751
- // <repeater ra>
752
- // <group ga__1>
753
- // <repeater rb__1>
754
- // <input txta__1__1 />
755
- // <input txta__1__2 />
756
- // </repeater>
757
- // <group gb__1>
758
- // <input txtb__1 />
759
- // </group>
760
- // </group>
761
- // <group ga__2>
762
- // <repeater rb__2>
763
- // <input txta__2__1 />
764
- // </repeater>
765
- // <group gb__2>
766
- // <input txtb__2 />
767
- // </group>
768
- // </group>
769
- // </repeater>
770
- // </form>
771
- //
772
- // return something like:
773
- // [{type:repeater, name:'ra', suffix: '__1'}, {type: group, name:'ga', suffix: '__1'}, ...]
774
 
775
  var currentNode;
776
  var ni = document.createNodeIterator($current_form[0], NodeFilter.SHOW_ELEMENT, null, false); //, NodeFilter.SHOW_ELEMENT, function(){ return NodeFilter.FILTER_ACCEPT; }
777
 
778
- var simplified_dom = [];
779
 
780
  while(currentNode = ni.nextNode()) {
781
- if (currentNode.classList.contains('wpcf7cf_repeater')) {
782
- simplified_dom.push({type:'repeater', name:currentNode.dataset.id, original_name:currentNode.dataset.orig_data_id})
783
- } else if (currentNode.dataset.class == 'wpcf7cf_group') {
784
- simplified_dom.push({type:'group', name:currentNode.dataset.id, original_name:currentNode.dataset.orig_data_id})
785
- } else if (currentNode.className == 'wpcf7cf_step') {
786
- simplified_dom.push({type:'step', name:currentNode.dataset.id, original_name:currentNode.dataset.id, step: currentNode.dataset.id.substring(5)})
787
- } else if (currentNode.hasAttribute('name')) {
788
- simplified_dom.push({type:'input', name:currentNode.getAttribute('name'), original_name:currentNode.getAttribute('data-orig_name')})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
789
  }
790
- }
791
 
792
- simplified_dom = simplified_dom.map(function(item, i){
793
- var original_name_length = item.original_name == null ? item.name.length : item.original_name.length;
794
- item.suffix = item.name.substring(original_name_length);
795
- return item;
796
- });
797
 
798
- //console.table(simplified_dom);
799
- return simplified_dom;
 
 
 
 
 
 
 
 
 
 
800
 
 
801
  },
802
 
803
  updateMultistepState: function (multistep) {
@@ -813,13 +858,13 @@ window.wpcf7cf = {
813
  multistep.form.$input_steps.val(JSON.stringify(stepsData));
814
 
815
  // update Buttons
816
- multistep.$btn_prev.removeClass('disabled');
817
- multistep.$btn_next.removeClass('disabled');
818
  if (multistep.currentStep == multistep.numSteps) {
819
- multistep.$btn_next.addClass('disabled');
820
  }
821
  if (multistep.currentStep == 1) {
822
- multistep.$btn_prev.addClass('disabled');
823
  }
824
 
825
  // replace next button with submit button on last step.
@@ -849,9 +894,7 @@ window.wpcf7cf = {
849
 
850
  },
851
 
852
- should_group_be_shown : function(condition, $current_form) {
853
-
854
- var $ = jQuery;
855
 
856
  var show_group = true;
857
 
@@ -861,20 +904,10 @@ window.wpcf7cf = {
861
 
862
  var condition_and_rule = condition.and_rules[and_rule_i];
863
 
864
- var $field = jQuery('[name="' + condition_and_rule.if_field + '"], [name="' + condition_and_rule.if_field + '[]"], [data-original-name="' + condition_and_rule.if_field + '"], [data-original-name="' + condition_and_rule.if_field + '[]"]',$current_form);
865
 
866
  var if_val = condition_and_rule.if_value;
867
- var if_val_as_number = isFinite(parseFloat(if_val)) ? parseFloat(if_val):0;
868
  var operator = condition_and_rule.operator;
869
-
870
- var regex_patt = /.*/i; // fallback regex pattern
871
- var isValidRegex = true;
872
- try {
873
- regex_patt = new RegExp(if_val, 'i');
874
- } catch(e) {
875
- isValidRegex = false;
876
- }
877
-
878
 
879
  //backwards compat
880
  operator = operator === '≤' ? 'less than or equals' : operator;
@@ -882,24 +915,7 @@ window.wpcf7cf = {
882
  operator = operator === '>' ? 'greater than' : operator;
883
  operator = operator === '<' ? 'less than' : operator;
884
 
885
-
886
- if ( $field.is(':checkbox') || $field.is(':radio') ) {
887
-
888
- var all_values = [];
889
- var checked_values = [];
890
- $field.each(function () {
891
- all_values.push(jQuery(this).val());
892
- if (jQuery(this).is(':checked')) {
893
- checked_values.push(jQuery(this).val());
894
- }
895
- });
896
-
897
- condition_ok = this.isConditionTrue(checked_values,operator,if_val,$field);
898
-
899
- } else {
900
-
901
- condition_ok = this.isConditionTrue($field.val(),operator,if_val,$field);
902
- }
903
 
904
  show_group = show_group && condition_ok;
905
  }
@@ -1004,9 +1020,6 @@ window.wpcf7cf = {
1004
 
1005
  };
1006
 
1007
-
1008
-
1009
-
1010
  jQuery('.wpcf7-form').each(function(){
1011
  wpcf7cf_forms.push(new Wpcf7cfForm(jQuery(this)));
1012
  });
3
  var cf7signature_resized = 0; // for compatibility with contact-form-7-signature-addon
4
 
5
  var wpcf7cf_timeout;
6
+ var wpcf7cf_change_time_ms = 100;
7
+
8
+ if (window.wpcf7cf_running_tests) {
9
+ jQuery('input[name="_wpcf7cf_options"]').each(function(e) {
10
+ var $input = jQuery(this);
11
+ var opt = JSON.parse($input.val());
12
+ opt.settings.animation_intime = 0;
13
+ opt.settings.animation_outtime = 0;
14
+ $input.val(JSON.stringify(opt));
15
+ });
16
+ wpcf7cf_change_time_ms = 0;
17
+ }
18
 
19
  var wpcf7cf_show_animation = { "height": "show", "marginTop": "show", "marginBottom": "show", "paddingTop": "show", "paddingBottom": "show" };
20
  var wpcf7cf_hide_animation = { "height": "hide", "marginTop": "hide", "marginBottom": "hide", "paddingTop": "hide", "paddingBottom": "hide" };
26
 
27
  var wpcf7cf_forms = [];
28
 
29
+ window.wpcf7cf_dom = {};
30
+
31
+ const wpcf7cf_reload_dom = function($form) {
32
+ wpcf7cf_dom = wpcf7cf.get_simplified_dom_model($form);
33
+ }
34
+
35
+ const wpcf7cf_getFieldsByOriginalName = function(originalName) {
36
+ return Object.values(wpcf7cf_dom).filter(function (inputField) {
37
+ return inputField.original_name === originalName || inputField.original_name === originalName+'[]';
38
+ });
39
+ }
40
+
41
+ const wpcf7cf_getFieldByName = function(name) {
42
+ return wpcf7cf_dom[name] || wpcf7cf_dom[name+'[]'];
43
+ }
44
+
45
+ // endsWith polyfill
46
  if (!String.prototype.endsWith) {
47
  String.prototype.endsWith = function(search, this_len) {
48
  if (this_len === undefined || this_len > this.length) {
74
  form.unit_tag = $form.closest('.wpcf7').attr('id');
75
  form.conditions = form_options['conditions'];
76
 
77
+ // Wrapper around jQuery(selector, form.$form)
78
+ form.get = function (selector) {
79
+ // TODO: implement some caching here.
80
+ return jQuery(selector, form.$form);
81
+ }
82
+
83
  // compatibility with conditional forms created with older versions of the plugin ( < 1.4 )
84
  for (var i=0; i < form.conditions.length; i++) {
85
  var condition = form.conditions[i];
122
 
123
  // PRO ONLY
124
 
125
+ form.get('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)').each(function(){
126
  form.repeaters.push(new Wpcf7cfRepeater(jQuery(this),form));
127
  });
128
 
129
  form.$input_repeaters.val(JSON.stringify(form.repeaters.map((item)=>item.params.$repeater.id)));
130
 
131
+ var $multistep = form.get('.wpcf7cf_multistep');
132
 
133
  if ($multistep.length) {
134
  form.multistep = new Wpcf7cfMultistep($multistep, form);
154
 
155
  var form = this;
156
 
 
 
 
157
  var wpcf7cf_conditions = this.conditions;
158
  var wpcf7cf_settings = this.settings;
159
 
174
 
175
  form.$groups.addClass('wpcf7cf-hidden');
176
 
177
+ wpcf7cf_reload_dom(form.$form);
178
+
179
  for (var i=0; i < wpcf7cf_conditions.length; i++) {
180
 
181
  var condition = wpcf7cf_conditions[i];
182
 
183
+ var show_group = window.wpcf7cf.should_group_be_shown(condition, form);
184
 
185
  if (show_group) {
186
+ form.get('[data-id="'+condition.then_field+'"]').removeClass('wpcf7cf-hidden');
187
  }
188
  }
189
 
190
+
191
  var animation_intime = wpcf7cf_settings.animation_intime;
192
  var animation_outtime = wpcf7cf_settings.animation_outtime;
193
 
240
  };
241
 
242
  Wpcf7cfForm.prototype.updateSummaryFields = function() {
243
+ const form = this;
244
+ var $summary = form.get('.wpcf7cf-summary');
245
 
246
  if ($summary.length == 0 || !$summary.is(':visible')) return;
247
 
248
  var fd = new FormData();
249
 
250
+ var formdata = form.$form.serializeArray();
251
  jQuery.each(formdata,function(key, input){
252
  fd.append(input.name, input.value);
253
  });
254
 
255
+ // Make sure to add file fields to FormData
256
+ jQuery.each(form.$form.find('input[type="file"]'), function(index, el) {
257
+ if (! el.files.length) return false;
258
+ const file = el.files[0];
259
+ const fieldName = el.name;
260
+ fd.append(fieldName, new Blob() ,file.name);
261
+ });
262
+
263
+ // add file fields to form-data
264
+
265
  jQuery.ajax({
266
  url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary',
267
  type: 'POST',
316
 
317
  var form = this;
318
 
319
+ // monitor input changes, and call displayFields() if something has changed
320
+ form.get('input, select, textarea, button').not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events,form, function(e) {
321
  var form = e.data;
322
  clearTimeout(wpcf7cf_timeout);
323
  wpcf7cf_timeout = setTimeout(function() {
326
  });
327
 
328
  // PRO ONLY
329
+ form.get('.wpcf7cf-togglebutton').off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf',function() {
330
  var $this = jQuery(this);
331
  if ($this.text() === $this.data('val-1')) {
332
  $this.text($this.data('val-2'));
596
 
597
  });
598
 
599
+ // If form is submitted (by pressing Enter for example), and if we are not on the last step,
600
  // then trigger click event on the $btn_next button instead.
601
  multistep.form.$form.on('submit.wpcf7cf_step', function(e) {
602
 
632
  var multistep = this;
633
  var $multistep = multistep.$multistep;
634
  var $form = multistep.form.$form;
635
+ var form = multistep.form;
636
 
637
  $form.find('.wpcf7-response-output').addClass('wpcf7-display-none');
638
 
680
  ) {
681
  checkError = checkError + 1;
682
 
683
+ var controlWrap = form.get('.wpcf7-form-control-wrap.' + index);
684
  controlWrap.find('input').addClass('wpcf7-not-valid');
685
  controlWrap.find('span.wpcf7-not-valid-tip').remove();
686
  controlWrap.append('<span role="alert" class="wpcf7-not-valid-tip">' + el.reason + '</span>');
736
  };
737
 
738
  Wpcf7cfMultistep.prototype.getFieldsInStep = function(step_index) {
739
+ wpcf7cf_reload_dom(this.form.$form);
740
  var inStep = false;
741
+ return Object.values(wpcf7cf_dom).filter(function(item, i) {
742
  if(item.type == 'step') {
743
+ inStep = item.val == step_index+'';
744
  }
745
  return inStep && item.type == 'input';
746
  }).map(function(item) {
759
 
760
  get_nested_conditions : function(conditions, $current_form) {
761
  //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index
762
+ wpcf7cf_reload_dom($current_form);
763
+ var groups = Object.values(wpcf7cf_dom).filter(function(item, i) {
764
  return item.type==='group';
765
  });
766
 
787
 
788
  sub_conditions = sub_conditions.concat(relevant_conditions);
789
  }
790
+ return sub_conditions;
791
  },
792
 
793
  get_simplified_dom_model : function($current_form) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
794
 
795
  var currentNode;
796
  var ni = document.createNodeIterator($current_form[0], NodeFilter.SHOW_ELEMENT, null, false); //, NodeFilter.SHOW_ELEMENT, function(){ return NodeFilter.FILTER_ACCEPT; }
797
 
798
+ var simplified_dom = {};
799
 
800
  while(currentNode = ni.nextNode()) {
801
+
802
+ const type = currentNode.classList.contains('wpcf7cf_repeater') ? 'repeater' :
803
+ currentNode.dataset.class == 'wpcf7cf_group' ? 'group' :
804
+ currentNode.className == 'wpcf7cf_step' ? 'step' :
805
+ currentNode.hasAttribute('name') ? 'input' : false;
806
+
807
+ if (!type) {
808
+ continue;
809
+ }
810
+
811
+ const name = type === 'input' ? currentNode.getAttribute('name') : currentNode.dataset.id;
812
+
813
+ // skip _wpcf7 hidden fields
814
+ if (name.substring(0,6) === '_wpcf7') continue;
815
+
816
+ const original_name = type === 'repeater' || type === 'group' ? currentNode.dataset.orig_data_id
817
+ : type === 'input' ? (currentNode.getAttribute('data-orig_name') || name)
818
+ : name;
819
+
820
+ const val = type === 'step' ? [currentNode.dataset.id.substring(5)] : [];
821
+
822
+ const original_name_length = original_name == null ? name.length : original_name.length;
823
+ const suffix = name.substring(original_name_length);
824
+
825
+ if (!simplified_dom[name]) {
826
+ // init entry
827
+ simplified_dom[name] = {name, type, original_name, suffix, val}
828
  }
 
829
 
830
+ if (type === 'input') {
 
 
 
 
831
 
832
+ // skip unchecked checkboxes and radiobuttons
833
+ if ( (currentNode.type === 'checkbox' || currentNode.type === 'radio') && !currentNode.checked ) continue;
834
+
835
+ // if multiselect, make sure to add all the values
836
+ if ( currentNode.multiple ) {
837
+ simplified_dom[name].val = Object.values(currentNode.options).filter(o => o.selected).map(o => o.value)
838
+ } else {
839
+ simplified_dom[name].val.push(currentNode.value);
840
+ }
841
+ }
842
+
843
+ }
844
 
845
+ return simplified_dom;
846
  },
847
 
848
  updateMultistepState: function (multistep) {
858
  multistep.form.$input_steps.val(JSON.stringify(stepsData));
859
 
860
  // update Buttons
861
+ multistep.$btn_prev.removeClass('disabled').attr('disabled', false);
862
+ multistep.$btn_next.removeClass('disabled').attr('disabled', false);
863
  if (multistep.currentStep == multistep.numSteps) {
864
+ multistep.$btn_next.addClass('disabled').attr('disabled', true);
865
  }
866
  if (multistep.currentStep == 1) {
867
+ multistep.$btn_prev.addClass('disabled').attr('disabled', true);
868
  }
869
 
870
  // replace next button with submit button on last step.
894
 
895
  },
896
 
897
+ should_group_be_shown : function(condition) {
 
 
898
 
899
  var show_group = true;
900
 
904
 
905
  var condition_and_rule = condition.and_rules[and_rule_i];
906
 
907
+ var inputField = wpcf7cf_getFieldByName(condition_and_rule.if_field);
908
 
909
  var if_val = condition_and_rule.if_value;
 
910
  var operator = condition_and_rule.operator;
 
 
 
 
 
 
 
 
 
911
 
912
  //backwards compat
913
  operator = operator === '≤' ? 'less than or equals' : operator;
915
  operator = operator === '>' ? 'greater than' : operator;
916
  operator = operator === '<' ? 'less than' : operator;
917
 
918
+ condition_ok = this.isConditionTrue(inputField.val,operator,if_val);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
919
 
920
  show_group = show_group && condition_ok;
921
  }
1020
 
1021
  };
1022
 
 
 
 
1023
  jQuery('.wpcf7-form').each(function(){
1024
  wpcf7cf_forms.push(new Wpcf7cfForm(jQuery(this)));
1025
  });
readme.txt CHANGED
@@ -6,7 +6,7 @@ Website: http://bdwm.be
6
  Tags: wordpress, contact form 7, forms, conditional fields
7
  Requires at least: 4.1
8
  Tested up to: 5.4.1
9
- Stable tag: 1.8.7
10
  Requires PHP: 5.6
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -102,6 +102,16 @@ The conditional fields javascript code is loaded during wp_footer, so a call to
102
 
103
  == Changelog ==
104
 
 
 
 
 
 
 
 
 
 
 
105
  = 1.8.7 (2020-06-01) =
106
  * PRO: Change auto-update mechanism
107
  * Some minor JS refactoring
6
  Tags: wordpress, contact form 7, forms, conditional fields
7
  Requires at least: 4.1
8
  Tested up to: 5.4.1
9
+ Stable tag: 1.9
10
  Requires PHP: 5.6
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
102
 
103
  == Changelog ==
104
 
105
+ = 1.9 (2020-06-21) =
106
+ * Performance improvements
107
+ * Added extra setting: "Conditional Fields UI". If you have a lot of conditions, set this to "Text mode" for better performance in the admin interface.
108
+ * Improved styling on Conditional Fields Settings page
109
+ * Improved [docs](https://conditional-fields-cf7.bdwm.be/)
110
+ * Improved the [form tester](https://conditional-fields-cf7.bdwm.be/form-tester/)
111
+ * PRO: Multistep bug that was causing checkboxes and multiselect to not trigger validation errors
112
+ * PRO: Summary added support for files, checkboxes and multiselect
113
+ * Added test to ensure that normal view entries are always converted to text view correctly
114
+
115
  = 1.8.7 (2020-06-01) =
116
  * PRO: Change auto-update mechanism
117
  * Some minor JS refactoring
style.css CHANGED
@@ -70,22 +70,4 @@
70
  pointer-events: none;
71
  cursor: default;
72
  opacity: .5;
73
- }
74
-
75
- .page-template-tpl-form-tester .wpcf7cf_repeater {
76
- border: 3px solid #f0f0f0;
77
- background: #d9d9d9;
78
- padding: 20px 40px 20px 20px;
79
- }
80
-
81
- .page-template-tpl-form-tester .wpcf7cf_repeater_sub {
82
- border: 3px solid #f0f0f0;
83
- background: #ffffff;
84
- padding: 20px 40px 20px 20px;
85
- }
86
-
87
- .page-template-tpl-form-tester [data-class="wpcf7cf_group"] {
88
- border: 3px solid #f0f0f0;
89
- background: #8efca6b9;
90
- padding: 20px 40px 20px 20px;
91
- }
70
  pointer-events: none;
71
  cursor: default;
72
  opacity: .5;
73
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpcf7cf-options.php CHANGED
@@ -7,34 +7,57 @@ define('WPCF7CF_TEXT_DOMAIN', WPCF7CF_SLUG.'_text_domain');
7
  define('WPCF7CF_DEFAULT_ANIMATION', 'yes');
8
  define('WPCF7CF_DEFAULT_ANIMATION_INTIME', 200);
9
  define('WPCF7CF_DEFAULT_ANIMATION_OUTTIME', 200);
 
10
  define('WPCF7CF_DEFAULT_NOTICE_DISMISSED', false);
11
 
12
- $wpcf7cf_default_options = array(
13
- 'animation' => WPCF7CF_DEFAULT_ANIMATION,
14
- 'animation_intime' => WPCF7CF_DEFAULT_ANIMATION_INTIME,
15
- 'animation_outtime' => WPCF7CF_DEFAULT_ANIMATION_OUTTIME,
16
- 'notice_dismissed' => WPCF7CF_DEFAULT_NOTICE_DISMISSED
17
- );
18
-
19
  if ( ! defined( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY' ) ) {
20
  define( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY', 'publish_pages' );
21
  }
22
 
23
- $wpcf7cf_default_options = apply_filters('wpcf7cf_default_options', $wpcf7cf_default_options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- $wpcf7cf_options = get_option(WPCF7CF_OPTIONS);
 
26
 
27
- if (!is_array($wpcf7cf_options)) {
28
- $wpcf7cf_options = $wpcf7cf_default_options;
29
- update_option(WPCF7CF_OPTIONS, $wpcf7cf_options);
30
- }
31
 
 
 
32
 
33
- // this setting will only be 0 as long as the user has not saved any settings. Once the user has saved the WPCF7CF settings, this value will always remain 1.
34
- if (!key_exists('wpcf7cf_settings_saved',$wpcf7cf_options)) $wpcf7cf_options['wpcf7cf_settings_saved'] = 0;
 
 
 
35
 
36
- if ($wpcf7cf_options['wpcf7cf_settings_saved'] == 0) {
37
- $wpcf7cf_options = $wpcf7cf_default_options;
38
  }
39
 
40
  add_action( 'admin_enqueue_scripts', 'wpcf7cf_load_page_options_wp_admin_style' );
@@ -50,12 +73,7 @@ function wpcf7cf_admin_add_page() {
50
  }
51
 
52
  function wpcf7cf_options_page() {
53
- global $wpcf7cf_options;
54
-
55
- // // Include in admin_enqueue_scripts action hook
56
- // wp_enqueue_media();
57
- // //wp_enqueue_script( 'custom-background' );
58
- // wp_enqueue_script( 'wpcf7cf-image-upload', plugins_url('framework/js/bdwm-image-upload.js',__FILE__), array('jquery'), '1.0.0', true );
59
 
60
  if (isset($_POST['reset'])) {
61
  echo '<div id="message" class="updated fade"><p><strong>Settings restored to defaults</strong></p></div>';
@@ -67,7 +85,7 @@ function wpcf7cf_options_page() {
67
 
68
  <div class="wrap wpcf7cf-admin-wrap">
69
  <h2>Contact Form 7 - Conditional Fields Settings</h2>
70
- <?php if (!$wpcf7cf_options['notice_dismissed']) { ?>
71
  <div class="wpcf7cf-options-notice notice notice-warning is-dismissible"><div style="padding: 10px 0;"><strong>Notice</strong>: These are global settings for Contact Form 7 - Conditional Fields. <br><br><strong>How to create/edit conditional fields?</strong>
72
  <ol>
73
  <li>Create a new Contact Form or edit an existing one</li>
@@ -81,18 +99,17 @@ function wpcf7cf_options_page() {
81
  <form action="options.php" method="post">
82
  <?php settings_fields(WPCF7CF_OPTIONS); ?>
83
 
84
- <input type="hidden" value="1" id="wpcf7cf_settings_saved" name="<?php echo WPCF7CF_OPTIONS.'[wpcf7cf_settings_saved]' ?>">
85
- <input type="hidden" name="<?php echo WPCF7CF_OPTIONS.'[notice_dismissed]' ?>" value="<?php echo $wpcf7cf_options['notice_dismissed'] ?>" />
86
-
87
-
88
- <h3>Default animation Settings</h3>
89
 
90
  <?php
91
 
 
 
 
92
  wpcf7cf_input_select('animation', array(
93
  'label' => 'Animation',
94
  'description' => 'Use animations while showing/hiding groups',
95
- 'options' => array('no'=> 'Disabled', 'yes' => 'Enabled')
96
  ));
97
 
98
  wpcf7cf_input_field('animation_intime', array(
@@ -105,6 +122,7 @@ function wpcf7cf_options_page() {
105
  'description' => 'A positive integer value indicating the time, in milliseconds, it will take for each group to hide.',
106
  ));
107
 
 
108
  submit_button();
109
 
110
  if (!WPCF7CF_IS_PRO) {
@@ -124,6 +142,19 @@ function wpcf7cf_options_page() {
124
  }
125
  do_action('wpcf7cf_after_animation_settings');
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  ?>
128
 
129
  </form></div>
@@ -146,69 +177,20 @@ function wpcf7cf_options_page() {
146
  <?php
147
  }
148
 
149
-
150
- function wpcf7cf_image_field($slug, $args) {
151
-
152
- global $wpcf7cf_options, $wpcf7cf_default_options;
153
-
154
- $defaults = array(
155
- 'title'=>'Image',
156
- 'description' => '',
157
- 'choose_text' => 'Choose an image',
158
- 'update_text' => 'Use image',
159
- 'default' => $wpcf7cf_default_options[$slug]
160
- );
161
-
162
- $args = wp_parse_args( $args, $defaults );
163
- extract($args);
164
- $label; $description; $choose_text; $update_text; $default;
165
-
166
- if (!key_exists($slug, $wpcf7cf_options)) {
167
- $wpcf7cf_options[$slug] = $default;
168
- }
169
-
170
- ?>
171
- <div class="option-line">
172
- <span class="label"><?php echo $label; ?></span>
173
- <?php
174
- if ($description) {
175
- ?>
176
- <p><?php echo $description; ?></p>
177
- <?php
178
- }
179
- ?>
180
- <div>
181
- <div class="image-container" id="default-thumbnail-preview_<?php echo $slug ?>">
182
- <?php
183
- if ($wpcf7cf_options[$slug] != '') {
184
- $img_info = wp_get_attachment_image_src($wpcf7cf_options[$slug], 'full');
185
- $img_src = $img_info[0];
186
- ?>
187
- <img src="<?php echo $img_src ?>" height="100">
188
- <?php
189
- }
190
- ?>
191
- </div>
192
- <a class="choose-from-library-link" href="#"
193
- data-field="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>"
194
- data-image_container="default-thumbnail-preview_<?php echo $slug ?>"
195
- data-choose="<?php echo $choose_text; ?>"
196
- data-update="<?php echo $update_text; ?>"><?php _e( 'Choose image' ); ?>
197
- </a>
198
- <input type="hidden" value="<?php echo $wpcf7cf_options[$slug] ?>" id="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>" name="<?php echo WPCF7CF_OPTIONS.'['.$slug.']' ?>">
199
- </div>
200
- </div>
201
- <?php
202
-
203
  }
204
 
205
  function wpcf7cf_input_field($slug, $args) {
206
- global $wpcf7cf_options, $wpcf7cf_default_options;
207
 
208
  $defaults = array(
209
  'label'=>'',
210
  'desription' => '',
211
- 'default' => $wpcf7cf_default_options[$slug],
212
  'label_editable' => false
213
  );
214
 
@@ -217,104 +199,76 @@ function wpcf7cf_input_field($slug, $args) {
217
 
218
  $label; $description; $default; $label_editable;
219
 
220
- if (!key_exists($slug, $wpcf7cf_options)) {
221
- $wpcf7cf_options[$slug] = $default;
222
- $wpcf7cf_options[$slug.'_label'] = $label;
223
  }
224
 
225
  ?>
226
- <div class="option-line">
227
- <?php if ($label_editable) { ?>
228
- <span class="label editable"><input type="text" data-default-value="<?php echo $label ?>" value="<?php echo $wpcf7cf_options[$slug.'_label'] ?>" id="<?php echo WPCF7CF_OPTIONS.'_'.$slug.'_label' ?>" name="<?php echo WPCF7CF_OPTIONS.'['.$slug.'_label]' ?>"></span>
229
- <?php } else { ?>
230
- <span class="label"><?php echo $label ?></span>
231
- <?php } ?>
232
- <span class="field"><input type="text" data-default-value="<?php echo $default ?>" value="<?php echo $wpcf7cf_options[$slug] ?>" id="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>" name="<?php echo WPCF7CF_OPTIONS.'['.$slug.']' ?>"></span>
233
- <span class="description"><?php echo $description ?><?php if (!empty($default)) echo ' (Default: '.$default.')' ?></span>
234
- </div>
235
- <?php
236
-
237
- }
238
-
239
- function wpcf7cf_input_select($slug, $args) {
240
- global $wpcf7cf_options, $wpcf7cf_default_options;
241
-
242
- $defaults = array(
243
- 'label'=>'',
244
- 'desription' => '',
245
- 'options' => array(), // array($name => $value)
246
- 'default' => $wpcf7cf_default_options[$slug],
247
- );
248
-
249
- $args = wp_parse_args( $args, $defaults );
250
- extract($args);
251
 
252
- $label; $description; $options; $default;
 
253
 
254
- if (!key_exists($slug, $wpcf7cf_options)) {
255
- $wpcf7cf_options[$slug] = $default;
256
- }
 
 
257
 
258
- // $first_element = array('-1' => '-- Select --');
259
- // $options = array_merge($first_element, $options);
 
 
 
 
 
 
260
 
261
- ?>
262
- <div class="option-line">
263
- <span class="label"><?php echo $label ?></span>
264
- <span class="field">
265
- <select id="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>" data-default-value="<?php echo $default ?>" name="<?php echo WPCF7CF_OPTIONS.'['.$slug.']' ?>">
266
- <?php
267
- foreach($options as $value => $text) {
268
- ?>
269
- <option value="<?php echo $value ?>" <?php echo $wpcf7cf_options[$slug]==$value?'selected':'' ?>><?php echo $text ?></option>
270
- <?php
271
- }
272
- ?>
273
- </select>
274
- </span>
275
- <span class="description"><?php echo $description ?><?php if (!empty($default)) echo ' (Default: '.$options[$default].')' ?></span>
276
- </div>
277
  <?php
278
 
279
  }
280
 
281
- function wpcf7cf_checkbox($slug, $args) {
282
- global $wpcf7cf_options, $wpcf7cf_default_options;
283
 
284
  $defaults = array(
285
  'label'=>'',
286
  'desription' => '',
287
- 'default' => $wpcf7cf_default_options[$slug],
 
288
  );
289
 
290
  $args = wp_parse_args( $args, $defaults );
291
  extract($args);
292
 
293
- $label; $description; $default;
 
 
 
 
294
 
295
  ?>
296
- <div class="option-line">
297
- <span class="label"><?php echo $label ?></span>
298
- <span class="field">
299
- <input type="checkbox" data-default-value="<?php echo $default ?>" name="<?php echo WPCF7CF_OPTIONS.'['.$slug.']' ?>" value="1" <?php checked('1', $wpcf7cf_options[$slug]) ?>>
300
- </span>
301
- <span class="description"><?php echo $description ?><?php if (!empty($default)) echo ' (Default: '.$default.')' ?></span>
302
- </div>
 
 
 
 
 
 
303
  <?php
304
  }
305
 
306
- function wpcf7cf_regex_collection() {
307
- global $wpcf7cf_options, $wpcf7cf_default_options;
308
-
309
- }
310
-
311
  add_action('admin_init', 'wpcf7cf_admin_init');
312
  function wpcf7cf_admin_init(){
313
- global $wpcf7cf_default_options, $wpcf7cf_options;
314
 
315
  if(isset($_POST['reset']) && current_user_can( 'wpcf7_edit_contact_form' ) ) {
316
- update_option(WPCF7CF_OPTIONS, $wpcf7cf_default_options);
317
- $wpcf7cf_options['wpcf7cf_settings_saved'] = 0;
318
  }
319
 
320
  register_setting( WPCF7CF_OPTIONS, WPCF7CF_OPTIONS, 'wpcf7cf_options_sanitize' );
@@ -326,8 +280,7 @@ function wpcf7cf_options_sanitize($input) {
326
 
327
  add_action( 'wp_ajax_wpcf7cf_dismiss_notice', 'wpcf7cf_dismiss_notice' );
328
  function wpcf7cf_dismiss_notice() {
329
- global $wpcf7cf_options;
330
- $wpcf7cf_options['notice_dismissed'] = true;
331
- $wpcf7cf_options['wpcf7cf_settings_saved'] = 1;
332
- update_option(WPCF7CF_OPTIONS,$wpcf7cf_options);
333
  }
7
  define('WPCF7CF_DEFAULT_ANIMATION', 'yes');
8
  define('WPCF7CF_DEFAULT_ANIMATION_INTIME', 200);
9
  define('WPCF7CF_DEFAULT_ANIMATION_OUTTIME', 200);
10
+ define('WPCF7CF_DEFAULT_CONDITIONS_UI', 'normal');
11
  define('WPCF7CF_DEFAULT_NOTICE_DISMISSED', false);
12
 
 
 
 
 
 
 
 
13
  if ( ! defined( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY' ) ) {
14
  define( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY', 'publish_pages' );
15
  }
16
 
17
+ global $wpcf7cf_default_settings_glob;
18
+ $wpcf7cf_default_settings_glob = false;
19
+ function wpcf7cf_get_default_settings() {
20
+ global $wpcf7cf_default_settings_glob;
21
+ if ($wpcf7cf_default_settings_glob) return $wpcf7cf_default_settings_glob;
22
+
23
+ $wpcf7cf_default_settings_glob = array(
24
+ 'animation' => WPCF7CF_DEFAULT_ANIMATION,
25
+ 'animation_intime' => WPCF7CF_DEFAULT_ANIMATION_INTIME,
26
+ 'animation_outtime' => WPCF7CF_DEFAULT_ANIMATION_OUTTIME,
27
+ 'conditions_ui' => WPCF7CF_DEFAULT_CONDITIONS_UI,
28
+ 'notice_dismissed' => WPCF7CF_DEFAULT_NOTICE_DISMISSED
29
+ );
30
+ $wpcf7cf_default_settings_glob = apply_filters('wpcf7cf_default_options', $wpcf7cf_default_settings_glob);
31
+ return $wpcf7cf_default_settings_glob;
32
+ }
33
+
34
+ global $wpcf7cf_settings_glob;
35
+ $wpcf7cf_settings_glob = false;
36
+ function wpcf7cf_get_settings() {
37
+ global $wpcf7cf_settings_glob;
38
+ if ($wpcf7cf_settings_glob) {
39
+ return $wpcf7cf_settings_glob;
40
+ }
41
 
42
+ //get options from DB
43
+ $wpcf7cf_settings_glob = get_option(WPCF7CF_OPTIONS);
44
 
45
+ // if options have not been saved by the user yet, load the default options.
46
+ if ( !is_array($wpcf7cf_settings_glob) ) {
47
+ $wpcf7cf_settings_glob = wpcf7cf_get_default_settings();
48
+ }
49
 
50
+ return $wpcf7cf_settings_glob;
51
+ }
52
 
53
+ function wpcf7cf_set_options($settings) {
54
+ global $wpcf7cf_settings_glob;
55
+ $wpcf7cf_settings_glob = $settings;
56
+ update_option(WPCF7CF_OPTIONS, $wpcf7cf_settings_glob);
57
+ }
58
 
59
+ function wpcf7cf_reset_options() {
60
+ delete_option(WPCF7CF_OPTIONS);
61
  }
62
 
63
  add_action( 'admin_enqueue_scripts', 'wpcf7cf_load_page_options_wp_admin_style' );
73
  }
74
 
75
  function wpcf7cf_options_page() {
76
+ $settings = wpcf7cf_get_settings();
 
 
 
 
 
77
 
78
  if (isset($_POST['reset'])) {
79
  echo '<div id="message" class="updated fade"><p><strong>Settings restored to defaults</strong></p></div>';
85
 
86
  <div class="wrap wpcf7cf-admin-wrap">
87
  <h2>Contact Form 7 - Conditional Fields Settings</h2>
88
+ <?php if (!$settings['notice_dismissed']) { ?>
89
  <div class="wpcf7cf-options-notice notice notice-warning is-dismissible"><div style="padding: 10px 0;"><strong>Notice</strong>: These are global settings for Contact Form 7 - Conditional Fields. <br><br><strong>How to create/edit conditional fields?</strong>
90
  <ol>
91
  <li>Create a new Contact Form or edit an existing one</li>
99
  <form action="options.php" method="post">
100
  <?php settings_fields(WPCF7CF_OPTIONS); ?>
101
 
102
+ <input type="hidden" name="<?php echo WPCF7CF_OPTIONS.'[notice_dismissed]' ?>" value="<?php echo $settings['notice_dismissed'] ?>" />
 
 
 
 
103
 
104
  <?php
105
 
106
+ echo '<h3>Default animation Settings</h3>';
107
+ wpcf7cf_input_fields_wrapper_start();
108
+
109
  wpcf7cf_input_select('animation', array(
110
  'label' => 'Animation',
111
  'description' => 'Use animations while showing/hiding groups',
112
+ 'select_options' => array('yes' => 'Enabled', 'no'=> 'Disabled')
113
  ));
114
 
115
  wpcf7cf_input_field('animation_intime', array(
122
  'description' => 'A positive integer value indicating the time, in milliseconds, it will take for each group to hide.',
123
  ));
124
 
125
+ wpcf7cf_input_fields_wrapper_end();
126
  submit_button();
127
 
128
  if (!WPCF7CF_IS_PRO) {
142
  }
143
  do_action('wpcf7cf_after_animation_settings');
144
 
145
+ echo '<h3>Advanced Settings</h3>';
146
+ wpcf7cf_input_fields_wrapper_start();
147
+
148
+ wpcf7cf_input_select('conditions_ui', array(
149
+ 'label' => 'Conditonal Fields UI',
150
+ 'description' => 'If you want to add more than '.WPCF7CF_MAX_RECOMMENDED_CONDITIONS.' conditions, it\'s recommended to switch to <strong>Text mode</strong> mode for better performance.',
151
+ 'select_options' => array('normal'=> 'Normal', 'text_only' => 'Text mode')
152
+ ));
153
+
154
+ wpcf7cf_input_fields_wrapper_end();
155
+
156
+ submit_button();
157
+
158
  ?>
159
 
160
  </form></div>
177
  <?php
178
  }
179
 
180
+ function wpcf7cf_input_fields_wrapper_start() {
181
+ echo '<table class="form-table" role="presentation"><tbody>';
182
+ }
183
+ function wpcf7cf_input_fields_wrapper_end() {
184
+ echo '</tbody></table>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  }
186
 
187
  function wpcf7cf_input_field($slug, $args) {
188
+ $settings = wpcf7cf_get_settings();
189
 
190
  $defaults = array(
191
  'label'=>'',
192
  'desription' => '',
193
+ 'default' => wpcf7cf_get_default_settings()[$slug],
194
  'label_editable' => false
195
  );
196
 
199
 
200
  $label; $description; $default; $label_editable;
201
 
202
+ if (!key_exists($slug, $settings)) {
203
+ $settings[$slug] = $default;
204
+ $settings[$slug.'_label'] = $label;
205
  }
206
 
207
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
+ <tr>
210
+ <th scope="row">
211
 
212
+ <?php if ($label_editable) { ?>
213
+ <span class="label editable"><input type="text" data-default-value="<?php echo $label ?>" value="<?php echo $settings[$slug.'_label'] ?>" id="<?php echo WPCF7CF_OPTIONS.'_'.$slug.'_label' ?>" name="<?php echo WPCF7CF_OPTIONS.'['.$slug.'_label]' ?>"></span>
214
+ <?php } else { ?>
215
+ <label for="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>"><?php echo $label ?></label>
216
+ <?php } ?>
217
 
218
+ </th>
219
+ <td>
220
+ <input type="text" data-default-value="<?php echo $default ?>" value="<?php echo $settings[$slug] ?>" id="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>" name="<?php echo WPCF7CF_OPTIONS.'['.$slug.']' ?>">
221
+ <p class="description" id="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>-description">
222
+ <?php echo $description ?><?php if (!empty($default)) echo ' (Default: '.$default.')' ?>
223
+ </p>
224
+ </td>
225
+ </tr>
226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  <?php
228
 
229
  }
230
 
231
+ function wpcf7cf_input_select($slug, $args) {
232
+ $settings = wpcf7cf_get_settings();
233
 
234
  $defaults = array(
235
  'label'=>'',
236
  'desription' => '',
237
+ 'select_options' => array(), // array($name => $value)
238
+ 'default' => wpcf7cf_get_default_settings()[$slug],
239
  );
240
 
241
  $args = wp_parse_args( $args, $defaults );
242
  extract($args);
243
 
244
+ $label; $description; $select_options; $default;
245
+
246
+ if (!key_exists($slug, $settings)) {
247
+ $settings[$slug] = $default;
248
+ }
249
 
250
  ?>
251
+ <tr>
252
+ <th scope="row"><label for="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>"><?php echo $label ?></label></th>
253
+ <td>
254
+ <select id="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>" data-default-value="<?php echo $default ?>" name="<?php echo WPCF7CF_OPTIONS.'['.$slug.']' ?>">
255
+ <?php foreach($select_options as $value => $text) { ?>
256
+ <option value="<?php echo $value ?>" <?php echo $settings[$slug]==$value?'selected':'' ?>><?php echo $text ?></option>
257
+ <?php } ?>
258
+ </select>
259
+ <p class="description" id="<?php echo WPCF7CF_OPTIONS.'_'.$slug ?>-description">
260
+ <?php echo $description ?><?php if (!empty($default)) echo ' (Default: '.$select_options[$default].')' ?>
261
+ </p>
262
+ </td>
263
+ </tr>
264
  <?php
265
  }
266
 
 
 
 
 
 
267
  add_action('admin_init', 'wpcf7cf_admin_init');
268
  function wpcf7cf_admin_init(){
 
269
 
270
  if(isset($_POST['reset']) && current_user_can( 'wpcf7_edit_contact_form' ) ) {
271
+ wpcf7cf_reset_options();
 
272
  }
273
 
274
  register_setting( WPCF7CF_OPTIONS, WPCF7CF_OPTIONS, 'wpcf7cf_options_sanitize' );
280
 
281
  add_action( 'wp_ajax_wpcf7cf_dismiss_notice', 'wpcf7cf_dismiss_notice' );
282
  function wpcf7cf_dismiss_notice() {
283
+ $settings = wpcf7cf_get_settings();
284
+ $settings['notice_dismissed'] = true;
285
+ wpcf7cf_set_options($settings);
 
286
  }