PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.4
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.4
6.0.4 6.0.3 6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 All 35 releases
automatorwp / integrations / zoom / assets / js / automatorwp-zoom.js

automatorwp-zoom.js in AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI 6.0.4, at integrations/zoom/assets/js/automatorwp-zoom.js

78 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function( $ ) {
2
3 var prefix = 'automatorwp-zoom-';
4 var _prefix = 'automatorwp_zoom_';
5
6 // On click authorize button
7 $('body').on('click', '.automatorwp_settings #' + _prefix + 'meetings_authorize', function(e) {
8 e.preventDefault();
9
10 var button = $(this);
11 var wrapper = button.parent();
12 var platform = button.attr('id').replace( _prefix, '' ).replace( '_authorize', '' );
13
14 // Update prefix
15 var box_prefix = _prefix + platform + '_';
16
17 var client_id = $('#' + box_prefix + 'client_id').val();
18 var client_secret = $('#' + box_prefix + 'client_secret').val();
19
20 // Check if response div exists
21 var response_wrap = wrapper.find('#' + box_prefix + 'response');
22
23 if( ! response_wrap.length ) {
24 wrapper.append( '<div id="' + box_prefix + 'response" style="display: none; margin-top: 10px;"></div>' );
25 response_wrap = wrapper.find('#' + box_prefix + 'response');
26 }
27
28 // Show error message if not correctly configured
29 if( client_id.length === 0 || client_secret.length === 0 ) {
30 response_wrap.addClass( 'automatorwp-notice-error' );
31 response_wrap.html( 'All fields are required to connect with Zoom' );
32 response_wrap.slideDown('fast');
33 return;
34 }
35
36 response_wrap.slideUp('fast');
37 response_wrap.attr('class', '');
38
39 // Show spinner
40 wrapper.append('<span class="spinner is-active" style="float: none;"></span>');
41
42 // Disable button
43 button.prop('disabled', true);
44
45 $.post(
46 ajaxurl,
47 {
48 action: 'automatorwp_zoom_authorize',
49 nonce: automatorwp_zoom.nonce,
50 client_id: client_id,
51 client_secret: client_secret,
52 platform: platform,
53 },
54 function( response ) {
55
56 // Add class automatorwp-notice-success on successful unlock, if not will add the class automatorwp-notice-error
57 response_wrap.addClass( 'automatorwp-notice-' + ( response.success === true ? 'success' : 'error' ) );
58 response_wrap.html( ( response.data.message !== undefined ? response.data.message : response.data ) );
59 response_wrap.slideDown('fast');
60
61 // Hide spinner
62 wrapper.find('.spinner').remove();
63
64 // Redirect on success
65 if( response.success === true && response.data.redirect_url !== undefined ) {
66 window.location = response.data.redirect_url;
67 return;
68 }
69
70 // Enable button
71 button.prop('disabled', false);
72
73 }
74 );
75
76 });
77
78 })( jQuery );