PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.5.2
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.5.2
3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / assets / js / admin / upgrade.js
everest-forms / assets / js / admin Last commit date
admin.js 3 weeks ago admin.min.js 3 weeks ago chart.js 2 years ago chart.min.js 1 year ago customize-controls.js 1 year ago customize-controls.min.js 1 year ago customize-preview.js 1 year ago customize-preview.min.js 1 year ago deactivation-feedback.js 2 years ago deactivation-feedback.min.js 2 years ago editor.js 8 years ago editor.min.js 5 years ago everest-forms-survey-polls-quiz-builder.js 2 years ago everest-forms-survey-polls-quiz-builder.min.js 2 years ago evf-admin-email.js 2 years ago evf-admin-email.min.js 1 year ago evf-clipboard.js 8 years ago evf-clipboard.min.js 8 years ago evf-enhanced-select.js 3 years ago evf-enhanced-select.min.js 2 years ago evf-file-uploader.js 1 year ago evf-file-uploader.min.js 1 year ago evf-setup.js 1 year ago evf-setup.min.js 1 year ago extensions.js 2 years ago extensions.min.js 2 years ago form-builder.js 1 week ago form-builder.min.js 1 week ago form-template-controller.js 3 years ago form-template-controller.min.js 3 years ago printThis.min.js 2 years ago progressbar.js 2 years ago progressbar.min.js 1 year ago randomColor.js 2 years ago randomColor.min.js 2 years ago settings.js 3 weeks ago settings.min.js 3 weeks ago shortcode-form-embed.js 2 years ago shortcode-form-embed.min.js 2 years ago tool-import-entries.js 2 years ago tool-import-entries.min.js 2 years ago tools.js 3 weeks ago tools.min.js 3 weeks ago upgrade.js 3 weeks ago upgrade.min.js 3 weeks ago
upgrade.js
928 lines
1 /* global evf_upgrade, evf_data */
2 jQuery( function( $ ) {
3
4 /**
5 * Upgrade actions.
6 */
7 var evf_upgrade_actions = {
8 init: function () {
9 $(document.body).on(
10 'click dragstart',
11 '.evf-registered-item.upgrade-modal',
12 this.field_upgrade,
13 );
14 $(document.body).on(
15 'click dragstart',
16 '.evf-registered-item.evf-upgrade-addon',
17 this.evf_upgrade_addon,
18 );
19 $(document.body).on(
20 'click',
21 '#evf-row-field-popover .evf-popover-field-item.evf-field-upgrade',
22 this.popover_field_upgrade,
23 );
24 $(document.body).on(
25 'click dragstart',
26 '.evf-registered-item.enable-stripe-model',
27 this.enable_stripe_model,
28 );
29 $(document.body).on(
30 'click dragstart',
31 '.evf-registered-item.enable-authorize-net-model',
32 this.enable_authorize_net_model,
33 );
34 $(document.body).on(
35 'click dragstart',
36 '.evf-registered-item.enable-payment-subscription-plan',
37 this.enable_recurring_payment,
38 );
39 $(document.body).on(
40 'click dragstart',
41 '.evf-registered-item.everest-forms-pro-is_square_install',
42 this.install_square_addon_notice,
43 );
44
45 if (
46 0 ===
47 $(document.body).find(
48 '.evf-registered-item.everest-forms-pro-is_square_install',
49 ).length
50 ) {
51 $(document.body).on(
52 'click dragstart',
53 '.evf-registered-item.enable-square-model',
54 this.enable_square_model,
55 );
56 }
57
58 $(document.body).on(
59 'click dragstart',
60 '.everest-forms-field-option-row.upgrade-modal',
61 this.feature_upgrade,
62 );
63 $(document.body).on(
64 'click',
65 '.everest-forms-locked-field-cta',
66 this.locked_field_upgrade,
67 );
68 $(document.body).on(
69 'click dragstart',
70 '.evf-upgradable-feature, .everest-forms-btn-group span.upgrade-modal',
71 this.feature_upgrade,
72 );
73 $(document.body).on(
74 'click dragstart',
75 '.evf-one-time-draggable-field, .evf-registered-item.evf-one-time-draggable-field',
76 this.evf_one_time_draggable_field,
77 );
78 $(document.body).on(
79 'click ',
80 '.everest-forms-integrations[data-action="upgrade"]',
81 this.integration_upgrade,
82 );
83 $(document.body).on(
84 'click dragstart',
85 '.evf-registered-item.recaptcha_empty_key_validate',
86 this.recaptcha_empty_key_validate,
87 );
88 $(document.body).on(
89 'click dragstart',
90 '.evf-registered-item.hcaptcha_empty_key_validate',
91 this.hcaptcha_empty_key_validate,
92 );
93 $(document.body).on(
94 'click dragstart',
95 '.evf-registered-item.turnstile_empty_key_validate',
96 this.turnstile_empty_key_validate,
97 );
98 $(document.body).on(
99 'click ',
100 '.upgrade-addons-settings,.evf-upsell-upgrade-trigger',
101 this.integration_upgrade,
102 );
103 $(document.body).on('click ', '.evf-pro-feature', this.customizerupgrade);
104 $(document.body).on('click ', '.evf-pro-palette', this.customizerupgrade);
105 $(document.body).on(
106 'click ',
107 '.everest-forms-pro-template',
108 this.customizerupgrade,
109 );
110
111 evf_upgrade_actions.limit_file_upload();
112
113 $(document).on(
114 'evf_field_drop_complete',
115 evf_upgrade_actions.limit_file_upload,
116 );
117 },
118
119 customizerupgrade: function (e) {
120 e.preventDefault();
121
122 var customStyles = `
123 .wp-customizer .jconfirm-box {
124 padding: 40px 30px !important;
125 }
126
127 .wp-customizer .jconfirm-box .jconfirm-title-c {
128 margin-bottom: 24px !important;
129 padding: 0 !important;
130 }
131
132 .wp-customizer .jconfirm-box .jconfirm-title-c .jconfirm-title {
133 text-align: center !important;
134 border-bottom: 0px;
135 }
136
137 .wp-customizer .jconfirm-box .jconfirm-content-pane {
138 margin-bottom: 0 !important;
139 }
140
141 .wp-customizer .jconfirm-box .jconfirm-content-pane .jcontent-content > div {
142 text-align: center !important;
143 color: #646464 !important;
144 font-size: 16px !important;
145 line-height: 26px !important;
146 font-weight: 400 !important;
147 }
148
149 .wp-customizer .jconfirm-box .jconfirm-content-pane .jconfirm-content > div h2 {
150 margin-top: 0 !important;
151 margin-bottom: 12px !important;
152 font-size: 26px !important;
153 line-height: 34px !important;
154 text-align: center !important;
155 font-weight: 600 !important;
156 color: #222222 !important;
157 border-bottom: 0 !important;
158 padding-bottom: 0 !important;
159 }
160
161 .wp-customizer .jconfirm-box .jconfirm-content-pane .jconfirm-content > div p {
162 color: #646464 !important;
163 text-align: center !important;
164 font-size: 15px !important;
165 font-weight: 400 !important;
166 line-height: 25px !important;
167 margin: 0 !important;
168 }
169
170 .wp-customizer .jconfirm-box .jconfirm-buttons {
171 margin-top: 20px !important;
172 padding: 0 !important;
173 background: none !important;
174 float: unset !important;
175 }
176
177 .wp-customizer .jconfirm-box .jconfirm-buttons .btn-confirm {
178 width: 100% !important;
179 border-radius: 4px !important;
180 background: #2563EB !important;
181 color: #ffffff !important;
182 font-size: 16px !important;
183 font-weight: 500 !important;
184 line-height: 24px !important;
185 padding: 10px !important;
186 }
187
188 .wp-customizer .jconfirm-box .jconfirm-buttons .btn-confirm:hover {
189 background: #2f49bc !important;
190 }
191
192 .jconfirm-title .dashicons {
193 margin-right: 8px;
194 vertical-align: middle;
195 font-size: 28px;
196 color: #2563EB;
197 }
198 `;
199
200 $('head').append('<style>' + customStyles + '</style>');
201
202 $.alert({
203 title: `
204 <svg width="150" height="131" viewBox="0 0 150 131" fill="none" xmlns="http://www.w3.org/2000/svg">
205 <path d="M115.352 14.9928L74.6528 0L34.3428 14.7953C29.1956 17.2851 24.6828 18.7814 24.6828 23.6952V48.1984C24.5988 65.3473 29.1904 82.1947 37.9638 96.9296C45.4812 109.445 57.1163 122.331 75.0718 130.524C91.5489 125.036 103.848 110.402 111.366 97.8812C120.14 83.1488 124.731 66.3031 124.647 49.1561V27.1187C124.617 20.1041 120.996 16.6806 115.352 14.9928Z" fill="#4A7EEE"/>
206 <g opacity="0.8">
207 <path d="M115.352 14.9928L74.6528 0L34.3428 14.7953C29.1956 17.2851 24.6828 18.7814 24.6828 23.6952V48.1984C24.5988 65.3473 29.1904 82.1947 37.9638 96.9296C45.4812 109.445 57.1163 122.331 75.0718 130.524C91.5489 125.036 103.848 110.402 111.366 97.8812C120.14 83.1488 124.731 66.3031 124.647 49.1561V27.1187C124.617 20.1041 120.996 16.6806 115.352 14.9928Z" fill="white"/>
208 </g>
209 <path d="M99.5029 76.9754H92.0215V36.2764C92.0215 31.6675 90.1906 27.2473 86.9316 23.9884C83.6726 20.7294 79.2525 18.8985 74.6436 18.8985C70.0347 18.8985 65.6145 20.7294 62.3556 23.9884C59.0966 27.2473 57.2657 31.6675 57.2657 36.2764V76.9754H49.7842V36.2764C49.7331 32.9794 50.3383 29.7051 51.5646 26.6442C52.791 23.5833 54.6139 20.7969 56.9274 18.4472C59.2409 16.0976 61.9986 14.2316 65.0402 12.9579C68.0817 11.6843 71.3462 11.0283 74.6436 11.0283C77.941 11.0283 81.2055 11.6843 84.247 12.9579C87.2885 14.2316 90.0463 16.0976 92.3597 18.4472C94.6732 20.7969 96.4962 23.5833 97.7225 26.6442C98.9489 29.7051 99.5541 32.9794 99.5029 36.2764V76.9754Z" fill="#4A7EEE"/>
210 <g opacity="0.4">
211 <path d="M99.5029 76.9754H92.0215V36.2764C92.0215 31.6675 90.1906 27.2473 86.9316 23.9884C83.6726 20.7294 79.2525 18.8985 74.6436 18.8985C70.0347 18.8985 65.6145 20.7294 62.3556 23.9884C59.0966 27.2473 57.2657 31.6675 57.2657 36.2764V76.9754H49.7842V36.2764C49.7331 32.9794 50.3383 29.7051 51.5646 26.6442C52.791 23.5833 54.6139 20.7969 56.9274 18.4472C59.2409 16.0976 61.9986 14.2316 65.0402 12.9579C68.0817 11.6843 71.3462 11.0283 74.6436 11.0283C77.941 11.0283 81.2055 11.6843 84.247 12.9579C87.2885 14.2316 90.0463 16.0976 92.3597 18.4472C94.6732 20.7969 96.4962 23.5833 97.7225 26.6442C98.9489 29.7051 99.5541 32.9794 99.5029 36.2764V76.9754Z" fill="black"/>
212 </g>
213 <path d="M104.669 58.8643H44.62C42.6995 58.8643 41.1426 60.4211 41.1426 62.3416V98.3722C41.1426 100.293 42.6995 101.85 44.62 101.85H104.669C106.59 101.85 108.146 100.293 108.146 98.3722V62.3416C108.146 60.4211 106.59 58.8643 104.669 58.8643Z" fill="#4A7EEE"/>
214 <g opacity="0.5">
215 <path d="M80.2433 74.7609C80.2439 73.7185 79.9537 72.6966 79.4053 71.8101C78.8569 70.9237 78.0721 70.2078 77.139 69.743C76.206 69.2782 75.1618 69.083 74.1238 69.1792C73.0859 69.2755 72.0954 69.6594 71.2637 70.2879C70.4321 70.9163 69.7922 71.7644 69.4162 72.7366C69.0402 73.7088 68.9429 74.7667 69.1353 75.7912C69.3276 76.8157 69.802 77.7662 70.5051 78.5358C71.2081 79.3054 72.112 79.8636 73.115 80.1476V88.5268H76.1734V80.1476C77.3467 79.817 78.3797 79.1116 79.1145 78.139C79.8494 77.1663 80.2458 75.98 80.2433 74.7609Z" fill="black"/>
216 </g>
217 <path d="M44.7148 97.7735C44.5592 97.7735 44.4395 90.5913 44.4395 81.7632C44.4395 72.9351 44.5592 65.7529 44.7148 65.7529C44.8704 65.7529 44.9961 72.9351 44.9961 81.7632C44.9961 90.5913 44.8704 97.7735 44.7148 97.7735Z" fill="#FAFAFA"/>
218 <path d="M70.2597 81.9363C70.2597 81.9363 69.9964 81.8525 69.6014 81.5652C69.0477 81.0856 68.8772 80.3202 69.0169 79.5446C69.1565 78.769 69.5892 78.1749 70.1629 77.9217C70.7366 77.6685 71.3607 77.7985 71.6148 78.3221C71.8689 78.8457 71.7395 79.5929 71.2041 79.8461C70.6686 80.0993 70.0355 79.9819 69.6014 79.5446C69.1686 79.1073 69.0928 78.4367 69.2597 77.7802C69.4265 77.1238 69.8361 76.8279 70.2597 76.8279C70.6832 76.8279 70.9671 77.1745 70.9671 77.5743C70.9671 77.974 70.6385 78.1795 70.2597 78.4227C69.8809 78.6659 69.6088 78.7225 69.3091 78.5463C69.0094 78.3701 68.8278 77.9376 68.9603 77.3941C69.0917 76.8506 69.5223 76.6619 69.9153 76.9748C70.3077 77.2877 70.2597 77.9673 70.2597 78.4929C70.2597 78.9541 70.3494 79.1229 70.2597 79.3749Z" fill="#FAFAFA"/>
219 </svg>
220 `,
221 content: `<h2>${evf_upgrade.upgrade_title}</h2><p>${evf_upgrade.upgrade_message}</p>`,
222 type: 'red',
223 closeIcon: true,
224 boxWidth: '400px',
225 buttons: {
226 confirm: {
227 text: evf_upgrade.upgrade_button,
228 btnClass: 'btn-confirm',
229 keys: ['enter'],
230 action: function () {
231 window.open(evf_upgrade.upgrade_url, '_blank');
232 },
233 },
234 },
235 onOpen: function () {
236 var $alertBox = this.$jconfirmBox;
237
238 $alertBox.find('.jconfirm-content > div').css({
239 'text-align': 'center',
240 color: '#646464',
241 'font-size': '16px',
242 'line-height': '26px',
243 'font-weight': '400',
244 });
245
246 $alertBox.find('.jconfirm-buttons').css({
247 'margin-top': '20px',
248 padding: '0',
249 background: 'none',
250 float: 'unset',
251 });
252
253 $alertBox.find('.btn-confirm').css({
254 width: '100%',
255 'border-radius': '4px',
256 background: '#2563EB',
257 color: '#ffffff',
258 'font-size': '16px',
259 'font-weight': '600',
260 'line-height': '24px',
261 padding: '10px',
262 });
263
264 $alertBox.find('.btn-confirm').hover(function () {
265 $(this).css('background', '#2f49bc');
266 });
267 },
268 });
269 },
270 integration_upgrade: function (e) {
271 e.preventDefault();
272
273 var $el = $(this);
274 var name =
275 $el.data('name') || $el.find('h3').text().trim() || $el.text().trim();
276 var links = $el.data('links') || '';
277
278 evf_upgrade_actions.upgrade_integration(name, links, $el);
279 },
280 feature_upgrade: function (e) {
281 e.preventDefault();
282 evf_upgrade_actions.upgrade_modal(
283 $(this).data('feature') ? $(this).data('feature') : $(this).text(),
284 );
285 },
286 /**
287 * Handle clicks on a locked (Pro/addon) field placed in the form - both
288 * the canvas PRO badge and the settings-panel overlay. Routes to the
289 * addon install/activate flow when licensed, otherwise the upgrade modal.
290 */
291 locked_field_upgrade: function (e) {
292 e.preventDefault();
293 // Prevent the click from also opening the field's settings panel.
294 e.stopPropagation();
295
296 var $el = $(this);
297
298 if ('evf-upgrade-addon' === $el.data('field-class')) {
299 evf_upgrade_actions.evf_upgrade_addon.call(this, e);
300 return;
301 }
302
303 var name = $el.data('field-name')
304 ? $el.data('field-name') + ' field'
305 : $el.text();
306
307 evf_upgrade_actions.upgrade_modal(name, $el.data('links') || '');
308 },
309 popover_field_upgrade: function () {
310 var fieldType = $(this).data('field-type'),
311 $sidebarBtn = $(
312 '.evf-registered-item[data-field-type="' + fieldType + '"]',
313 );
314 if ($sidebarBtn.length) {
315 $sidebarBtn.trigger('click');
316 }
317 },
318 field_upgrade: function (e) {
319 e.preventDefault();
320 if (evf_data && evf_data.is_pro) {
321 return;
322 }
323 evf_upgrade_actions.upgrade_modal(
324 $(this).data('feature')
325 ? $(this).data('feature')
326 : $(this).text() + ' field',
327 $(this).data('links'),
328 );
329 },
330 evf_upgrade_addon: function (e) {
331 e.preventDefault();
332
333 var $el = $(this);
334
335 // Guard against double-clicks: ignore if a request is already in flight.
336 if ($el.data('evf-addon-ajax')) {
337 return;
338 }
339 $el.data('evf-addon-ajax', true);
340
341 var fieldType = $el.data('field-type'),
342 fieldPlan = $el.data('field-plan'),
343 addonSlug = $el.data('addon-slug');
344
345 $.ajax({
346 type: 'POST',
347 url: evf_upgrade.ajax_url,
348 data: {
349 action: 'everest_forms_install_and_active_addons',
350 field_plan: fieldPlan,
351 field_type: fieldType,
352 addon_slug: addonSlug,
353 security: evf_upgrade.evf_install_and_active_nonce,
354 },
355 complete: function () {
356 $el.removeData('evf-addon-ajax');
357 },
358 success: function (res) {
359 if (res.success === true) {
360 $.alert({
361 title: res.data.title,
362 theme: 'jconfirm-modern jconfirm-everest-forms',
363 icon: 'dashicons dashicons-lock',
364 backgroundDismiss: false,
365 scrollToPreviousElement: false,
366 content: res.data.message,
367 buttons: {
368 confirm: {
369 text: res.data.content,
370 keys: ['enter'],
371 },
372 },
373 type: 'blue',
374 boxWidth: '565px',
375 });
376 }
377 if (res.success === false) {
378 // res.data.addon may be absent when the server throws before
379 // reaching the addon lookup (e.g. empty field_plan). Fall back
380 // to the addon slug so the modal still has a meaningful title.
381 var addonName =
382 res.data && res.data.addon && res.data.addon.name
383 ? res.data.addon.name
384 : addonSlug;
385 $.alert({
386 title: addonName + ' ' + evf_upgrade.upgrade_plan_title,
387 theme: 'jconfirm-modern jconfirm-everest-forms',
388 icon: 'dashicons dashicons-lock',
389 backgroundDismiss: false,
390 scrollToPreviousElement: false,
391 content: evf_upgrade.upgrade_plan_message,
392 type: 'red',
393 boxWidth: '565px',
394 buttons: {
395 confirm: {
396 text: evf_upgrade.upgrade_plan_button,
397 btnClass: 'btn-confirm',
398 keys: ['enter'],
399 action: function () {
400 window.open(evf_upgrade.upgrade_url, '_blank');
401 },
402 },
403 cancel: {
404 text: evf_data.i18n_ok,
405 },
406 },
407 });
408 }
409 },
410 });
411 },
412 upgrade_modal: function (feature, links = '') {
413 var message = evf_upgrade.upgrade_message.replace(/%name%/g, feature);
414 var boxWidth = '565px';
415 if (feature === 'Multiple selection') {
416 links = {
417 image_id: '',
418 vedio_id: evf_upgrade.vedio_links.dropdown,
419 };
420 }
421 if ('' !== links) {
422 const { image_id, vedio_id } = links;
423 boxWidth = '665px';
424
425 if (vedio_id !== '') {
426 var html =
427 '<div><iframe width="600px" height="300px" frameborder="0" src="https://www.youtube.com/embed/' +
428 vedio_id +
429 '" rel="1" allowfullscreen></iframe></div><br>';
430 } else {
431 var html =
432 '<div width="420" height="315"> <img src="' +
433 image_id +
434 '" /></div>';
435 }
436 message = html + message;
437 }
438 $.alert({
439 title: feature + ' ' + evf_upgrade.upgrade_title,
440 icon: 'dashicons dashicons-lock',
441 content: message,
442 type: 'red',
443 boxWidth: boxWidth,
444 buttons: {
445 confirm: {
446 text: evf_upgrade.upgrade_button,
447 btnClass: 'btn-confirm',
448 keys: ['enter'],
449 action: function () {
450 window.open(evf_upgrade.upgrade_url, '_blank');
451 },
452 },
453 cancel: {
454 text: evf_data.i18n_ok,
455 },
456 },
457 });
458 },
459 limit_file_upload: function () {
460 $(document).ready(function () {
461 if (typeof evf_data === 'undefined') {
462 console.error(
463 'evf_data is not localized. Check wp_localize_script().',
464 );
465 return;
466 }
467
468 if (!evf_data.is_pro) {
469 $(document.body)
470 .find(
471 '.everest-forms-field-option-row-max_file_number input[type="number"]',
472 )
473 .on('input', function () {
474 var $this = $(this);
475 $this.val(1);
476 evf_upgrade_actions.evf_one_file_limit_message();
477 });
478 }
479 });
480 },
481 upgrade_integration: function (name, links, $el) {
482 name = name || '';
483 links = links || '';
484 $el = $el || '';
485
486 var message = evf_upgrade.upgrade_message.replace(/%name%/g, name);
487 var boxWidth = links ? '1000px' : '565px'; // ← scope to video presence
488 var html = '';
489
490 if (links) {
491 html =
492 '<div><iframe width="900px" height="600px" frameborder="0" src="https://www.youtube.com/embed/' +
493 links +
494 '" rel="1" allowfullscreen></iframe></div><br>';
495 message = html + message;
496 }
497
498 $.alert({
499 title: name + ' ' + evf_upgrade.upgrade_title,
500 icon: 'dashicons dashicons-lock',
501 content: message,
502 type: 'red',
503 boxWidth: boxWidth,
504 buttons: {
505 confirm: {
506 text: evf_upgrade.upgrade_button,
507 btnClass: 'btn-confirm',
508 keys: ['enter'],
509 action: function () {
510 var url =
511 $el && $el.data('upgrade-url')
512 ? $el.data('upgrade-url')
513 : $el && $el.hasClass('upgrade-addons-settings')
514 ? evf_upgrade.upgrade_integration_url_form
515 : evf_upgrade.upgrade_integration_url;
516 window.open(url, '_blank');
517 },
518 },
519 cancel: { text: '' },
520 },
521 });
522 },
523 enable_stripe_model: function (e) {
524 e.preventDefault();
525 var $item = $(e.currentTarget).closest('.evf-registered-item');
526 if ($item.hasClass('evf-payment-method-dependent-disabled')) {
527 return;
528 }
529 // Recurring-only lock uses .recurring-payment + stripe-admin handler, not this modal.
530 if ($item.hasClass('recurring-payment')) {
531 return;
532 }
533 $.alert({
534 title: evf_upgrade.enable_stripe_title,
535 content: evf_upgrade.enable_stripe_message,
536 icon: 'dashicons dashicons-info',
537 type: 'blue',
538 buttons: {
539 confirm: {
540 text: evf_data.i18n_close,
541 btnClass: 'btn-confirm',
542 keys: ['enter'],
543 },
544 },
545 });
546 },
547 enable_authorize_net_model: function (e) {
548 e.preventDefault();
549 var $item = $(e.currentTarget).closest('.evf-registered-item');
550 if ($item.hasClass('evf-payment-method-dependent-disabled')) {
551 return;
552 }
553 $.alert({
554 title: evf_upgrade.enable_authorize_net_title,
555 content: evf_upgrade.enable_authorize_net_message,
556 icon: 'dashicons dashicons-info',
557 type: 'blue',
558 buttons: {
559 confirm: {
560 text: evf_data.i18n_close,
561 btnClass: 'btn-confirm',
562 keys: ['enter'],
563 },
564 },
565 });
566 },
567 enable_square_model: function (e) {
568 e.preventDefault();
569 var $item = $(e.currentTarget).closest('.evf-registered-item');
570 if ($item.hasClass('evf-payment-method-dependent-disabled')) {
571 return;
572 }
573 $.alert({
574 title: evf_upgrade.enable_square_title,
575 content: evf_upgrade.enable_square_message,
576 icon: 'dashicons dashicons-info',
577 type: 'blue',
578 buttons: {
579 confirm: {
580 text: evf_data.i18n_close,
581 btnClass: 'btn-confirm',
582 keys: ['enter'],
583 },
584 },
585 });
586 },
587 enable_recurring_payment: function (e) {
588 e.preventDefault();
589 $.alert({
590 title: evf_upgrade.enable_recurring_period_title,
591 content: evf_upgrade.enable_recurring_period_message,
592 icon: 'dashicons dashicons-info',
593 type: 'blue',
594 buttons: {
595 confirm: {
596 text: evf_data.i18n_close,
597 btnClass: 'btn-confirm',
598 keys: ['enter'],
599 },
600 },
601 });
602 },
603 install_square_addon_notice: function (e) {
604 e.preventDefault();
605 console.log(evf_upgrade.admin_url);
606
607 $.alert({
608 title: 'Activate Square',
609 content:
610 'Please go to <a href="' +
611 evf_upgrade.admin_url +
612 'admin.php?page=evf-dashboard#/features" target="__blank">Dashboard</a> to active Square.',
613 icon: 'dashicons dashicons-info',
614 type: 'blue',
615 buttons: {
616 confirm: {
617 text: evf_data.i18n_close,
618 btnClass: 'btn-confirm',
619 keys: ['enter'],
620 },
621 },
622 });
623 },
624 /**
625 * Labels of Credit Card / Authorize.Net / Square fields on the builder canvas.
626 *
627 * @return {string[]}
628 */
629 getLegacyPaymentFieldDisplayNames: function () {
630 var $b = $('#everest-forms-builder');
631 var names = [];
632 if (!$b.length) {
633 return names;
634 }
635 var fallbacks = {
636 'credit-card': evf_upgrade.evf_legacy_payment_label_credit_card,
637 'authorize-net': evf_upgrade.evf_legacy_payment_label_authorize_net,
638 'square-payment': evf_upgrade.evf_legacy_payment_label_square,
639 };
640 $b
641 .find(
642 '.everest-forms-field-credit-card, .everest-forms-field-authorize-net, .everest-forms-field-square-payment',
643 )
644 .each(function () {
645 var $f = $(this);
646 var label = $f.find('.label-title .text').first().text().trim();
647 var type = $f.attr('data-field-type') || '';
648 if (!label) {
649 label = fallbacks[type] || type;
650 }
651 names.push(label);
652 });
653 return names;
654 },
655
656 getEnabledPaymentsTabGatewayDisplayNames: function () {
657 var gateways = [
658 {
659 selectors: [
660 'input[type="checkbox"][name="payments[stripe][enable_stripe]"]',
661 '#everest-forms-panel-field-paymentsstripe-enable_stripe',
662 ],
663 label:
664 typeof evf_upgrade.evf_legacy_payment_label_credit_card !==
665 'undefined'
666 ? evf_upgrade.evf_legacy_payment_label_credit_card
667 : 'Stripe',
668 },
669 {
670 selectors: [
671 'input[type="checkbox"][name="payments[paypal][enable_paypal]"]',
672 '#everest-forms-panel-field-paypal-enable_paypal',
673 ],
674 label:
675 typeof evf_upgrade.evf_legacy_payment_label_paypal !== 'undefined'
676 ? evf_upgrade.evf_legacy_payment_label_paypal
677 : 'PayPal',
678 },
679 {
680 selectors: [
681 '#everest-forms-panel-field-paymentsrazorpay-enable_razorpay',
682 '#everest-forms-panel-field-razorpay-enable_razorpay',
683 'input[name*="[razorpay]"][name*="enable_razorpay"]',
684 ],
685 label:
686 typeof evf_upgrade.evf_legacy_payment_label_razorpay !== 'undefined'
687 ? evf_upgrade.evf_legacy_payment_label_razorpay
688 : 'Razorpay',
689 },
690 {
691 selectors: [
692 '#everest-forms-panel-field-authorize_net-enable_authorize_net',
693 ],
694 label:
695 typeof evf_upgrade.evf_legacy_payment_label_authorize_net !==
696 'undefined'
697 ? evf_upgrade.evf_legacy_payment_label_authorize_net
698 : 'Authorize.Net',
699 },
700 {
701 selectors: ['#everest-forms-panel-field-square-enable_square'],
702 label:
703 typeof evf_upgrade.evf_legacy_payment_label_square !== 'undefined'
704 ? evf_upgrade.evf_legacy_payment_label_square
705 : 'Square',
706 },
707 {
708 selectors: [
709 '#everest-forms-panel-field-paymentsmollie-enable_mollie',
710 ],
711 label:
712 typeof evf_upgrade.evf_legacy_payment_label_mollie !== 'undefined'
713 ? evf_upgrade.evf_legacy_payment_label_mollie
714 : 'Mollie',
715 },
716 ];
717 var enabled = [];
718 var g, s, $el, on;
719
720 for (g = 0; g < gateways.length; g++) {
721 on = false;
722 for (s = 0; s < gateways[g].selectors.length; s++) {
723 $el = $(gateways[g].selectors[s]);
724 if ($el.length && $el.is(':checked')) {
725 on = true;
726 break;
727 }
728 }
729 if (on) {
730 enabled.push(gateways[g].label);
731 }
732 }
733 return enabled;
734 },
735
736 evf_one_time_draggable_field: function (e) {
737 e.preventDefault();
738 var $item = $(e.currentTarget).closest('.evf-registered-item');
739 var fieldType = $item.data('field-type');
740 var title = evf_upgrade.evf_one_time_draggable_title;
741 var content = evf_upgrade.evf_one_time_draggable_message;
742 if (
743 $item.hasClass('evf-payment-method-dependent-disabled') &&
744 $.inArray(fieldType, ['credit-card', 'square-payment', 'authorize-net']) >=
745 0
746 ) {
747 if (
748 'credit-card' === fieldType &&
749 $item.hasClass('enable-stripe-model')
750 ) {
751 title = evf_upgrade.enable_stripe_title;
752 content = evf_upgrade.enable_stripe_message;
753 } else if (
754 'square-payment' === fieldType &&
755 $item.hasClass('enable-square-model')
756 ) {
757 title = evf_upgrade.enable_square_title;
758 content = evf_upgrade.enable_square_message;
759 } else if (
760 'authorize-net' === fieldType &&
761 $item.hasClass('enable-authorize-net-model')
762 ) {
763 title = evf_upgrade.enable_authorize_net_title;
764 content = evf_upgrade.enable_authorize_net_message;
765 } else {
766 title = evf_upgrade.evf_payment_method_dependency_title;
767 content = evf_upgrade.evf_payment_method_dependency_message;
768 }
769 }
770 if (
771 'payment-gateway-selector' === fieldType &&
772 $item.hasClass('evf-payment-method-dependent-disabled')
773 ) {
774 title = evf_upgrade.evf_legacy_payment_blocks_gateway_title;
775 var disabledReason = $item.attr('data-evf-disabled-reason') || '';
776 if (
777 'credit-card-field' === disabledReason &&
778 typeof evf_upgrade.evf_credit_card_blocks_gateway_message !==
779 'undefined'
780 ) {
781 content = evf_upgrade.evf_credit_card_blocks_gateway_message;
782 } else if (
783 typeof evf_upgrade.evf_legacy_payment_blocks_gateway_message !==
784 'undefined'
785 ) {
786 var isEnabledPaymentsDisable =
787 disabledReason === 'enabled-payments';
788 var legacyNames = isEnabledPaymentsDisable
789 ? []
790 : evf_upgrade_actions.getLegacyPaymentFieldDisplayNames();
791 var strongName = function (name) {
792 return (
793 '<strong>' +
794 $('<div/>').text(name).html() +
795 '</strong>'
796 );
797 };
798 var placeholder;
799 if (isEnabledPaymentsDisable) {
800 var enabled =
801 evf_upgrade_actions.getEnabledPaymentsTabGatewayDisplayNames();
802
803 if (enabled.length === 0) {
804 placeholder = strongName('payments');
805 } else if (enabled.length === 1) {
806 placeholder = strongName(enabled[0]);
807 } else {
808 placeholder = enabled.map(strongName).join(', ');
809 }
810 } else if (legacyNames.length === 0) {
811 placeholder =
812 'the ' +
813 strongName(
814 [
815 evf_upgrade.evf_legacy_payment_label_credit_card,
816 evf_upgrade.evf_legacy_payment_label_authorize_net,
817 evf_upgrade.evf_legacy_payment_label_square,
818 ].join(', '),
819 );
820 } else if (legacyNames.length === 1) {
821 placeholder = 'the ' + strongName(legacyNames[0]);
822 } else {
823 placeholder = legacyNames.map(strongName).join(', ');
824 }
825 content = evf_upgrade.evf_legacy_payment_blocks_gateway_message.replace(
826 '%s',
827 placeholder,
828 );
829 content = content.replace(
830 /\bPayments?\s+tab\b/i,
831 function (match) {
832 return (
833 '<span style="font-weight:700;">' + match + '</span>'
834 );
835 },
836 );
837 }
838 } else if (
839 'payment-gateway-selector' === fieldType &&
840 typeof evf_upgrade.evf_one_time_payment_gateway_message !== 'undefined'
841 ) {
842 title = evf_upgrade.evf_one_time_payment_gateway_title;
843 content = evf_upgrade.evf_one_time_payment_gateway_message;
844 }
845 $.alert({
846 title: title,
847 content: content,
848 icon: 'dashicons dashicons-info',
849 type: 'blue',
850 buttons: {
851 confirm: {
852 text: evf_data.i18n_close,
853 btnClass: 'btn-confirm',
854 keys: ['enter'],
855 },
856 },
857 });
858 },
859
860 evf_one_file_limit_message: function () {
861 $.alert({
862 title: evf_upgrade.evf_one_time_draggable_title,
863 content: evf_upgrade.evf_file_upload_free_file_limit_message,
864 icon: 'dashicons dashicons-info',
865 type: 'blue',
866 buttons: {
867 confirm: {
868 text: evf_data.i18n_close,
869 btnClass: 'btn-confirm',
870 keys: ['enter'],
871 },
872 },
873 });
874 },
875
876 recaptcha_empty_key_validate: function (e) {
877 e.preventDefault();
878 $.alert({
879 title: evf_upgrade.recaptcha_title,
880 content: evf_upgrade.recaptcha_api_key_message,
881 icon: 'dashicons dashicons-info',
882 type: 'blue',
883 buttons: {
884 confirm: {
885 text: evf_data.i18n_close,
886 btnClass: 'btn-confirm',
887 keys: ['enter'],
888 },
889 },
890 });
891 },
892 hcaptcha_empty_key_validate: function (e) {
893 e.preventDefault();
894 $.alert({
895 title: evf_upgrade.hcaptcha_title,
896 content: evf_upgrade.hcaptcha_api_key_message,
897 icon: 'dashicons dashicons-info',
898 type: 'blue',
899 buttons: {
900 confirm: {
901 text: evf_data.i18n_close,
902 btnClass: 'btn-confirm',
903 keys: ['enter'],
904 },
905 },
906 });
907 },
908 turnstile_empty_key_validate: function (e) {
909 e.preventDefault();
910 $.alert({
911 title: evf_upgrade.turnstile_title,
912 content: evf_upgrade.turnstile_api_key_message,
913 icon: 'dashicons dashicons-info',
914 type: 'blue',
915 buttons: {
916 confirm: {
917 text: evf_data.i18n_close,
918 btnClass: 'btn-confirm',
919 keys: ['enter'],
920 },
921 },
922 });
923 },
924 };
925
926 evf_upgrade_actions.init();
927 });
928