PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 4.4.6
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v4.4.6
4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / assets / js / license.js
embedpress / assets / js Last commit date
chunks 7 months ago vendor 8 months ago admin.build.js 7 months ago admin.js 9 months ago analytics-tracker.js 9 months ago analytics.build.js 7 months ago blocks.build.js 7 months ago carousel.js 1 year ago documents-viewer-script.js 3 years ago feature-notices.js 7 months ago front.js 7 months ago frontend.build.js 9 months ago gallery-justify.js 9 months ago gutneberg-script.js 1 year ago index.html 7 years ago initCarousel.js 2 years ago initplyr.js 8 months ago instafeed.js 7 months ago license.js 7 months ago preview.js 8 months ago settings.js 7 months ago sponsored.js 9 months ago
license.js
227 lines
1 /**
2 * @package EmbedPress
3 * @author EmbedPress <help@embedpress.com>
4 * @copyright Copyright (C) 2018 EmbedPress. All rights reserved.
5 * @license GPLv2 or later
6 * @since 1.7.0
7 */
8 (function ($) {
9 'use strict';
10
11 var __ = wp.i18n.__;
12 var addQueryArgs = wp?.url?.addQueryArgs;
13
14 $(document).on('click', '.embedpress-license-activation-btn', function (e) {
15 e.preventDefault();
16 let $this = $(this);
17
18 const licensesKey = $('#embedpress-pro-license-key').val();
19
20 if (licensesKey) {
21 $this.attr('disabled', 'disabled');
22 $this.html(__('Sending Request.....', 'embedpress'));
23 }
24
25 $.ajax({
26 type: 'POST',
27 url: ajaxurl,
28 data: {
29 // Your data to be sent in the request body
30 action: 'embedpress/license/activate',
31 _nonce: embedpressLicenseData.nonce, //
32 license_key: licensesKey,
33 },
34 success: function (response) {
35 // Handle the successful response here
36 if (!response.success) {
37 $this.html(__('Active License', 'embedpress'));
38 $this.removeAttr('disabled');
39 $('.embedpress-toast__message.toast__message--error p').text(response?.data?.message);
40 $('.toast__message--error').addClass('show-toast');
41
42 setTimeout(() => {
43 $('.toast__message--error').removeClass('show-toast');
44 }, 2000);
45
46 }
47 else if (response.data.license === 'valid') {
48 activationMessage();
49 }
50 else if (response.data.license === 'required_otp') {
51 $this.html(__('Verification Required', 'embedpress'));
52 $('#valid-license-key-message').removeClass('hidden');
53 $('#email-placeholder').text(response.data.customer_email);
54 $('#embedpress-pro-license-key').attr('disabled', 'disabled');
55
56 $('.embedpress-toast__message.toast__message--success p').text('Verification Code Sent successfully');
57 $('.toast__message--success').addClass('show-toast');
58
59 setTimeout(() => {
60 $('.toast__message--success').removeClass('show-toast');
61 }, 2000);
62
63 $('#otp-varify-form').removeClass('hidden');
64 }
65 },
66 error: function (xhr, status, error) {
67 // Handle errors here
68 console.error('Error:', status, error);
69 }
70 });
71
72 });
73
74 $(document).on('click', '.embedpress-verification-activation-btn', function (e) {
75 e.preventDefault();
76 let $this = $(this);
77
78 const licensesKey = $('#embedpress-pro-license-key').val();
79 const otpCode = $('#embedpress-pro-verification-key').val();
80
81 $('#invalid-verification-key-message').addClass('hidden');
82
83 if (licensesKey) {
84 $this.attr('disabled', 'disabled');
85 $this.html(__('Verifying.....', 'embedpress'));
86 }
87 // var ajaxUrl = 'embedpress/license/activate'; // Replace with the actual URL
88
89 $.ajax({
90 type: 'POST',
91 url: ajaxurl,
92 data: {
93 // Your data to be sent in the request body
94 action: 'embedpress/license/submit-otp',
95 _nonce: embedpressLicenseData.nonce, //
96 license: licensesKey,
97 otp: otpCode,
98 },
99 success: function (response) {
100 // Handle the successful response here
101 if (!response.success) {
102 $this.html('Verify');
103 $this.removeAttr('disabled');
104 $('.embedpress-toast__message.toast__message--error p').text(response?.data?.message);
105 $('.toast__message--error').addClass('show-toast');
106 setTimeout(() => {
107 $('.toast__message--error').removeClass('show-toast');
108 }, 2000);
109
110 }
111 else {
112 $this.html(__('Verified', 'embedpress'));
113 activationMessage();
114 }
115 },
116 error: function (xhr, status, error) {
117 // Handle errors here
118 console.error('Error:', status, error);
119 }
120 });
121
122 });
123 $(document).on('click', '#resend-license-verification-key', function (e) {
124 e.preventDefault();
125 let $this = $(this);
126
127
128 const licensesKey = $('#embedpress-pro-license-key').val();
129 $('#resend-license-verification-key').text(__('Resending', 'embedpress'));
130
131 $.ajax({
132 type: 'POST',
133 url: ajaxurl,
134 data: {
135 // Your data to be sent in the request body
136 action: 'embedpress/license/resend-otp',
137 _nonce: embedpressLicenseData.nonce, //
138 license: licensesKey,
139 },
140 success: function (response) {
141 // Handle the successful response here
142 if (!response.success) {
143 $('.embedpress-toast__message.toast__message--error p').text(response?.data?.message);
144 $('.toast__message--error').addClass('show-toast');
145
146 setTimeout(() => {
147 $('.toast__message--error').removeClass('show-toast');
148 }, 2000);
149
150 }
151 else {
152 $('.embedpress-toast__message.toast__message--success p').text('Verification Code Resent Successfully.');
153 $('.toast__message--success').addClass('show-toast');
154
155 setTimeout(() => {
156 $('.toast__message--success').removeClass('show-toast');
157 }, 2000);
158 }
159
160 $('#resend-license-verification-key').text(__('Resend', 'embedpress'));
161
162 },
163 error: function (xhr, status, error) {
164 // Handle errors here
165 console.error('Error:', status, error);
166 }
167 });
168
169 });
170
171 $(document).on('click', '.embedpress-license-deactivation-btn', function (e) {
172 e.preventDefault();
173 let $this = $(this);
174
175 const licensesKey = $('#embedpress-pro-license-key').val();
176 const otpCode = $('#embedpress-pro-verification-key').val();
177
178 if (licensesKey) {
179 $this.attr('disabled', 'disabled');
180 $this.html(__('Deactivating.....', 'embedpress'));
181 }
182 // var ajaxUrl = 'embedpress/license/activate'; // Replace with the actual URL
183
184 $.ajax({
185 type: 'POST',
186 url: ajaxurl,
187 data: {
188 // Your data to be sent in the request body
189 action: 'embedpress/license/deactivate',
190 _nonce: embedpressLicenseData.nonce, //
191 },
192 success: function (response) {
193 // Handle the successful response here
194 if (response.success) {
195 deactivationMessage();
196 }
197 },
198 error: function (xhr, status, error) {
199 // Handle errors here
200 console.error('Error:', status, error);
201 }
202 });
203
204 });
205
206 function activationMessage() {
207 var currentUrl = window.location.href;
208 var newUrl = addQueryArgs(currentUrl, {
209 success: true,
210 message: __('License has been activated', 'embedpress')
211 });
212 window.location.href = newUrl;
213 }
214 function deactivationMessage() {
215 var currentUrl = window.location.href;
216 var newUrl = addQueryArgs(currentUrl, {
217 success: true,
218 message: __('License has been deactivated', 'embedpress')
219 });
220
221 window.location.href = newUrl;
222 }
223
224
225
226 })(jQuery);
227