PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / trunk
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more vtrunk
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 1 week ago vendor 8 months ago admin.build.js 1 week ago admin.js 3 months ago analytics-tracker.js 4 weeks ago analytics.build.js 1 week ago blocks.build.js 1 week ago carousel.js 1 year ago custom-player.build.js 1 week ago documents-viewer-script.js 3 months ago ep-pdf-lightbox.js 3 months ago ep-view-count.js 1 week ago ep-yt-queue.js 4 weeks ago feature-notices.js 7 months ago front.js 4 weeks ago frontend.build.js 3 months ago gallery-justify.js 1 week ago gutneberg-script.js 1 month ago index.html 7 years ago initCarousel.js 2 years ago initplyr.js 1 month ago instafeed.js 4 weeks ago instagram-shortcode-generator.js 1 month ago lazy-load.js 6 months ago license.js 3 months ago meetup-timezone.js 3 months ago onboarding.build.js 1 week ago pdf-gallery-elementor-editor.js 3 months ago pdf-gallery.js 3 months ago preview.js 8 months ago settings.js 3 months ago sponsored.js 9 months ago
license.js
233 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 || function(url, args) {
13 var urlObj = new URL(url);
14 Object.keys(args).forEach(function(key) {
15 urlObj.searchParams.set(key, args[key]);
16 });
17 return urlObj.toString();
18 };
19
20 $(document).on('click', '.embedpress-license-activation-btn', function (e) {
21 e.preventDefault();
22 let $this = $(this);
23
24 const licensesKey = $('#embedpress-pro-license-key').val();
25
26 if (licensesKey) {
27 $this.attr('disabled', 'disabled');
28 $this.html(__('Sending Request.....', 'embedpress'));
29 }
30
31 $.ajax({
32 type: 'POST',
33 url: ajaxurl,
34 data: {
35 // Your data to be sent in the request body
36 action: 'embedpress/license/activate',
37 _nonce: embedpressLicenseData.nonce, //
38 license_key: licensesKey,
39 },
40 success: function (response) {
41 // Handle the successful response here
42 if (!response.success) {
43 $this.html(__('Active License', 'embedpress'));
44 $this.removeAttr('disabled');
45 $('.embedpress-toast__message.toast__message--error p').text(response?.data?.message);
46 $('.toast__message--error').addClass('show-toast');
47
48 setTimeout(() => {
49 $('.toast__message--error').removeClass('show-toast');
50 }, 2000);
51
52 }
53 else if (response.data.license === 'valid') {
54 activationMessage();
55 }
56 else if (response.data.license === 'required_otp') {
57 $this.html(__('Verification Required', 'embedpress'));
58 $('#valid-license-key-message').removeClass('hidden');
59 $('#email-placeholder').text(response.data.customer_email);
60 $('#embedpress-pro-license-key').attr('disabled', 'disabled');
61
62 $('.embedpress-toast__message.toast__message--success p').text('Verification Code Sent successfully');
63 $('.toast__message--success').addClass('show-toast');
64
65 setTimeout(() => {
66 $('.toast__message--success').removeClass('show-toast');
67 }, 2000);
68
69 $('#otp-varify-form').removeClass('hidden');
70 }
71 },
72 error: function (xhr, status, error) {
73 // Handle errors here
74 console.error('Error:', status, error);
75 }
76 });
77
78 });
79
80 $(document).on('click', '.embedpress-verification-activation-btn', function (e) {
81 e.preventDefault();
82 let $this = $(this);
83
84 const licensesKey = $('#embedpress-pro-license-key').val();
85 const otpCode = $('#embedpress-pro-verification-key').val();
86
87 $('#invalid-verification-key-message').addClass('hidden');
88
89 if (licensesKey) {
90 $this.attr('disabled', 'disabled');
91 $this.html(__('Verifying.....', 'embedpress'));
92 }
93 // var ajaxUrl = 'embedpress/license/activate'; // Replace with the actual URL
94
95 $.ajax({
96 type: 'POST',
97 url: ajaxurl,
98 data: {
99 // Your data to be sent in the request body
100 action: 'embedpress/license/submit-otp',
101 _nonce: embedpressLicenseData.nonce, //
102 license: licensesKey,
103 otp: otpCode,
104 },
105 success: function (response) {
106 // Handle the successful response here
107 if (!response.success) {
108 $this.html('Verify');
109 $this.removeAttr('disabled');
110 $('.embedpress-toast__message.toast__message--error p').text(response?.data?.message);
111 $('.toast__message--error').addClass('show-toast');
112 setTimeout(() => {
113 $('.toast__message--error').removeClass('show-toast');
114 }, 2000);
115
116 }
117 else {
118 $this.html(__('Verified', 'embedpress'));
119 activationMessage();
120 }
121 },
122 error: function (xhr, status, error) {
123 // Handle errors here
124 console.error('Error:', status, error);
125 }
126 });
127
128 });
129 $(document).on('click', '#resend-license-verification-key', function (e) {
130 e.preventDefault();
131 let $this = $(this);
132
133
134 const licensesKey = $('#embedpress-pro-license-key').val();
135 $('#resend-license-verification-key').text(__('Resending', 'embedpress'));
136
137 $.ajax({
138 type: 'POST',
139 url: ajaxurl,
140 data: {
141 // Your data to be sent in the request body
142 action: 'embedpress/license/resend-otp',
143 _nonce: embedpressLicenseData.nonce, //
144 license: licensesKey,
145 },
146 success: function (response) {
147 // Handle the successful response here
148 if (!response.success) {
149 $('.embedpress-toast__message.toast__message--error p').text(response?.data?.message);
150 $('.toast__message--error').addClass('show-toast');
151
152 setTimeout(() => {
153 $('.toast__message--error').removeClass('show-toast');
154 }, 2000);
155
156 }
157 else {
158 $('.embedpress-toast__message.toast__message--success p').text('Verification Code Resent Successfully.');
159 $('.toast__message--success').addClass('show-toast');
160
161 setTimeout(() => {
162 $('.toast__message--success').removeClass('show-toast');
163 }, 2000);
164 }
165
166 $('#resend-license-verification-key').text(__('Resend', 'embedpress'));
167
168 },
169 error: function (xhr, status, error) {
170 // Handle errors here
171 console.error('Error:', status, error);
172 }
173 });
174
175 });
176
177 $(document).on('click', '.embedpress-license-deactivation-btn', function (e) {
178 e.preventDefault();
179 let $this = $(this);
180
181 const licensesKey = $('#embedpress-pro-license-key').val();
182 const otpCode = $('#embedpress-pro-verification-key').val();
183
184 if (licensesKey) {
185 $this.attr('disabled', 'disabled');
186 $this.html(__('Deactivating.....', 'embedpress'));
187 }
188 // var ajaxUrl = 'embedpress/license/activate'; // Replace with the actual URL
189
190 $.ajax({
191 type: 'POST',
192 url: ajaxurl,
193 data: {
194 // Your data to be sent in the request body
195 action: 'embedpress/license/deactivate',
196 _nonce: embedpressLicenseData.nonce, //
197 },
198 success: function (response) {
199 // Handle the successful response here
200 if (response.success) {
201 deactivationMessage();
202 }
203 },
204 error: function (xhr, status, error) {
205 // Handle errors here
206 console.error('Error:', status, error);
207 }
208 });
209
210 });
211
212 function activationMessage() {
213 var currentUrl = window.location.href;
214 var newUrl = addQueryArgs(currentUrl, {
215 success: true,
216 message: __('License has been activated', 'embedpress')
217 });
218 window.location.href = newUrl;
219 }
220 function deactivationMessage() {
221 var currentUrl = window.location.href;
222 var newUrl = addQueryArgs(currentUrl, {
223 success: true,
224 message: __('License has been deactivated', 'embedpress')
225 });
226
227 window.location.href = newUrl;
228 }
229
230
231
232 })(jQuery);
233