Skip to content

Commit cec3d88

Browse files
committed
Show modal to users for blocked-popup.
1 parent 33cb1e4 commit cec3d88

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

css/admin.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,8 @@ th.mailchimp-connect {
262262
display: block;
263263
color: #db3a1b;
264264
}
265+
266+
.mailchimp-sf-oauth-connect-wrapper {
267+
display: flex;
268+
text-align: right;
269+
}

includes/class-mailchimp-data-encryption.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private function get_default_key() {
128128
/**
129129
* Gets the default encryption salt to use.
130130
*
131-
* @since 1.0.0
131+
* @since x.x.x
132132
*
133133
* @return string Encryption salt.
134134
*/

js/admin.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,31 @@
2525
const popup = window.open(startUrl, params.oauth_window_name, windowOptions);
2626

2727
if (popup == null) {
28-
// TODO: Handle popup blocked.
29-
console.error('Popup blocked. Please enable popups for this site.');
28+
// Show modal if popup is blocked.
29+
$('#login-popup-blocked-modal').dialog({
30+
modal: true,
31+
title: params.modal_title,
32+
width: 480,
33+
buttons: [
34+
{
35+
text: params.modal_button_cancel,
36+
class: 'button-secondary',
37+
click() {
38+
$(this).dialog('close');
39+
},
40+
},
41+
{
42+
text: params.modal_button_try_again,
43+
class: 'button-primary',
44+
click() {
45+
$(this).dialog('close');
46+
openMailChimpOauthPopup(token);
47+
},
48+
style: 'margin-left: 10px;',
49+
},
50+
],
51+
});
52+
$(spinner).removeClass('is-active');
3053
} else {
3154
// Handle popup opened.
3255
const oauthInterval = window.setInterval(function () {

views/setup_page.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@
8686
</tr>
8787
</table>
8888
<p class="oauth-error error_msg" style="display:none;"></p>
89+
<div id="login-popup-blocked-modal" style="display:none;">
90+
<p><?php esc_html_e( 'Please allow your browser to show popups for this page.', 'distributor' ); ?></p>
91+
<div class="footer">
92+
<a href="https://mailchimp.com/help/enable-pop-ups-in-your-browser/"><!--TODO: This link not working fix this. -->
93+
<?php esc_html_e( 'How to Enable Pop-ups in Your Browser', 'mailchimp' ); ?>
94+
</a>
95+
</div>
96+
</div>
8997
</div>
9098
</div>
9199

0 commit comments

Comments
 (0)