Skip to content

Commit b4b0efc

Browse files
authored
Merge pull request #147 from WebDevStudios/release/2.0.0
Release/2.0.0
2 parents 7d7026d + 9f53560 commit b4b0efc

20 files changed

+1016
-195
lines changed

app/admin-bundle.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/admin.css

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
body.toplevel_page_ctct-woo-settings,
2+
.cc-woo-wrap,
3+
.cc-woo-welcome-wrap {
4+
font-family: 'Maven Pro', sans-serif;
5+
font-size: 14px;
6+
font-weight: 400px;
7+
}
8+
9+
body.toplevel_page_ctct-woo-settings .wrap.woocommerce,
10+
.cc-woo-wrap {
11+
padding: 20px 30px;
12+
margin: 10px 20px 0 2px;
13+
background-color: white;
14+
}
15+
16+
.cc-woo-wrap h1,
17+
.cc-woo-welcome-wrap h1,
18+
body.toplevel_page_ctct-woo-settings h1 {
19+
font-size: 30px;
20+
font-weight: 700;
21+
line-height: 40px;
22+
}
23+
24+
.cc-woo-wrap h2,
25+
.cc-woo-welcome-wrap h2,
26+
body.toplevel_page_ctct-woo-settings h2 {
27+
font-size: 20px;
28+
font-weight: 700;
29+
line-height: 28px;
30+
}
31+
32+
.cc-woo-welcome-wrap {
33+
padding: 80px 0px;
34+
background-color: #ffff;
35+
}
36+
37+
.wrap {
38+
position: relative;
39+
}
40+
.cc-woo-welcome-wrap .container {
41+
width: 80%;
42+
min-height: 500px;
43+
text-align: center;
44+
margin: 80px auto auto;
45+
}
46+
47+
48+
a.cc-woo-back {
49+
text-decoration: none;
50+
}
51+
52+
tbody#cc-optional-fields tr:nth-child(2),
53+
tbody#cc-optional-fields tr:first-child {
54+
display: inline-block;
55+
width: 50%;
56+
}
57+
58+
tbody#cc-optional-fields tr:nth-child(2) th,
59+
tbody#cc-optional-fields tr:nth-child(2) td,
60+
tbody#cc-optional-fields tr:first-child th,
61+
tbody#cc-optional-fields tr:first-child td {
62+
display:block;
63+
}
64+
65+
66+
/* TBD*/
67+
68+
.btn-wrap {
69+
margin: 40px;
70+
}
71+
72+
.btn-wrap a {
73+
margin: 20px 10px;
74+
}
75+
76+
a.cc-woo-btn.btn-alternate {
77+
background-color: #fff;
78+
color: #1856ED;
79+
}
80+
81+
.cc-woo-btn {
82+
border: 1px solid #1856ED;
83+
transition: 0.2s ease-in all;
84+
text-decoration: none;
85+
border-radius: 50px !important;
86+
color: #fff;
87+
padding: 7px 14px;
88+
margin: 20px auto;
89+
width: fit-content;
90+
background: #1856ED;
91+
}
92+
93+
.cc-woo-wrap a.cc-woo-btn.btn-primary,
94+
body.toplevel_page_ctct-woo-settings a.cc-woo-btn.btn-primary{
95+
display: flex;
96+
justify-content: center;
97+
align-items: center;
98+
}
99+
100+
a.cc-woo-btn:hover {
101+
box-shadow: 0 0 8px 4px rgb(70 150 240 / 25%) inset, 0 0 8px 4px rgb(70 150 240 / 25%);
102+
border: 1px solid rgba(70,150,240,1);
103+
color: #fff
104+
}
105+
106+
.btn-alternate:hover {
107+
color:#1856ED !important;
108+
}
109+
110+
.form-table td {
111+
margin-bottom: 9px;
112+
}
113+
114+
115+
116+
body.toplevel_page_ctct-woo-settings td,
117+
body.toplevel_page_ctct-woo-settings th,
118+
.cc-woo-wrap td,
119+
.cc-woo-wrap th{
120+
display: block;
121+
padding: 6px 10px 6px 0;
122+
}
123+
124+
125+
body.toplevel_page_ctct-woo-settings input[type="email"],
126+
body.toplevel_page_ctct-woo-settings input[type="text"],
127+
.cc-woo-wrap table.form-table input[type="email"],
128+
.cc-woo-wrap table.form-table input[type="text"]{
129+
width: 100% !important;
130+
border-radius: 0px;
131+
}
132+
133+
body.toplevel_page_ctct-woo-settings label,
134+
.cc-woo-wrap label {
135+
font-weight: 400;
136+
}
137+
138+
#cc_woo_store_information_currency,
139+
#cc_woo_store_information_country_code {
140+
width: 25% !important;
141+
}
142+
143+
input#cc_woo_save_store_details {
144+
border-radius: 0px;
145+
border: 1px soild #1856ed;
146+
}
147+
148+
body.toplevel_page_ctct-woo-settings input[type="radio"]:active,
149+
body.toplevel_page_ctct-woo-settings input[type="radio"]:focus,
150+
body.toplevel_page_ctct-woo-settings input[type="radio"]:checked,
151+
.cc-woo-wrap input[type="radio"]:active,
152+
.cc-woo-wrap input[type="radio"]:checked,
153+
.cc-woo-wrap input[type="radio"]:focus {
154+
border-color: #1856ED;
155+
box-shadow: 0 0 0 1px #1856ED;
156+
outline: 2px solid transparent;
157+
}
158+
159+
body.toplevel_page_ctct-woo-settings th.titledesc,
160+
.cc-woo-wrap th.titledesc {
161+
font-weight: 400;
162+
}
163+
164+
.cc-woo-top-logo {
165+
position: absolute;
166+
top: 12%;
167+
left: 5%;
168+
}
169+
170+
.cc-woo-top-logo img {
171+
width: 43px;
172+
}
173+
174+
input#cc_woo_save_store_details:checked {
175+
background: #1856ED;
176+
transition: all 0.2s ease-in-out;
177+
}
178+
179+
input#cc_woo_save_store_details:checked::before {
180+
filter: brightness(0) invert(1);
181+
}
182+
183+
body.toplevel_page_ctct-woo-settings input[type="radio"]:checked::before,
184+
.cc-woo-wrap input[type="radio"]:checked::before {
185+
background: #1856ED;
186+
}
187+
188+
body.toplevel_page_ctct-woo-settings a:focus,
189+
.cc-woo-wrap a:focus {
190+
outline: none;
191+
box-shadow: none;
192+
}

app/admin.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import HandleSettingsPage from './handleSettingsPage';
2+
3+
// Handles store details.
4+
const enableStoreDetails = new HandleSettingsPage();
5+
window.onload = function(e)
6+
{
7+
enableStoreDetails.init();
8+
};

app/bundle.js

Lines changed: 136 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/handleSettingsPage.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
2+
/**
3+
* GuestCheckoutCapture.
4+
*
5+
* @package WebDevStudios\CCForWoo
6+
* @since 1.2.0
7+
*/
8+
export default class HandleSettingsPage {
9+
10+
/**
11+
* @constructor
12+
*
13+
* @author Biplav Subedi <[email protected]>
14+
* @since 2.0.0
15+
*/
16+
constructor() {
17+
this.els = {};
18+
}
19+
20+
/**
21+
* Init ccWoo admin JS.
22+
*
23+
* @author Biplav Subedi <[email protected]>
24+
* @since 2.0.0
25+
*/
26+
init() {
27+
this.cacheEls();
28+
this.bindEvents();
29+
this.enableStoreDetails();
30+
}
31+
32+
/**
33+
* Cache some DOM elements.
34+
*
35+
* @author Biplav Subedi <[email protected]>
36+
* @since 2.0.0
37+
*/
38+
cacheEls() {
39+
this.els.enableStoreDetails = document.getElementById( 'cc_woo_save_store_details' );
40+
this.els.optionalFields = document.getElementById( 'cc-optional-fields' );
41+
42+
}
43+
44+
/**
45+
* Bind callbacks to events.
46+
*
47+
* @author Biplav Subedi <[email protected]>
48+
* @since 2.0.0
49+
*/
50+
bindEvents() {
51+
this.els.enableStoreDetails.addEventListener( 'change', e => {
52+
this.enableStoreDetails();
53+
} );
54+
}
55+
56+
/**
57+
* Captures guest checkout if billing email is valid.
58+
*
59+
* @author Biplav Subedi <[email protected]>
60+
* @since 2.0.0
61+
*/
62+
enableStoreDetails() {
63+
if (this.els.enableStoreDetails.checked) {
64+
console.log(this.els.optionalFields.parentElement);
65+
this.els.optionalFields.parentElement.style.display = 'block';
66+
} else {
67+
this.els.optionalFields.parentElement.style.display = 'none';
68+
}
69+
}
70+
71+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "constant-contact-woocommerce",
3-
"version": "1.4.1",
3+
"version": "2.0.0",
44
"description": "",
55
"main": "index.js",
66
"engines": {

phpcs.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@
6363
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
6464
</rule>
6565

66-
</ruleset>
66+
</ruleset>

plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Plugin Name: Constant Contact + WooCommerce
1111
* Description: Add products to your emails and sync your contacts.
1212
* Plugin URI: https://github.com/WebDevStudios/constant-contact-woocommerce
13-
* Version: 1.4.1
13+
* Version: 2.0.0
1414
* Author: Constant Contact
1515
* Author URI: https://www.constantcontact.com/
1616
* Text Domain: cc-woo

src/AbandonedCheckouts/CheckoutHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class CheckoutHandler extends Service {
3333
public function register_hooks() {
3434
add_action( 'woocommerce_before_checkout_form', [ $this, 'enqueue_scripts' ] );
3535

36+
3637
add_action( 'woocommerce_after_template_part', [ $this, 'save_or_clear_checkout_data' ], 10, 4 );
3738
add_action( 'woocommerce_cart_updated', [ $this, 'update_checkout_data' ] );
3839
add_action( 'woocommerce_set_cart_cookies', [ $this, 'update_checkout_data' ] );

src/Plugin.php

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use WebDevStudios\CCForWoo\Api\KeyManager;
2121
use WebDevStudios\CCForWoo\WebHook\Disconnect;
2222
use WebDevStudios\CCForWoo\View\Admin\MenuItem;
23+
use WebDevStudios\CCForWoo\View\Admin\Disconnect as DisconnectSettings;
2324
use WebDevStudios\CCForWoo\AbandonedCheckouts\CheckoutHandler;
2425
use WebDevStudios\CCForWoo\AbandonedCheckouts\CheckoutsTable;
2526
use WebDevStudios\CCForWoo\AbandonedCheckouts\CheckoutRecovery;
@@ -46,7 +47,7 @@ final class Plugin extends ServiceRegistrar {
4647
* @since 1.0.0
4748
* @var string
4849
*/
49-
const PLUGIN_VERSION = '1.4.0';
50+
const PLUGIN_VERSION = '2.0.0';
5051

5152
/**
5253
* Whether the plugin is currently active.
@@ -79,6 +80,7 @@ final class Plugin extends ServiceRegistrar {
7980
CheckoutsTable::class,
8081
CheckoutRecovery::class,
8182
RestRegistrar::class,
83+
DisconnectSettings::class,
8284
];
8385

8486
/**
@@ -93,6 +95,25 @@ final class Plugin extends ServiceRegistrar {
9395
*/
9496
public function __construct( string $plugin_file ) {
9597
$this->plugin_file = $plugin_file;
98+
add_action( 'admin_notices', [ $this, 'add_ssl_notice' ] );
99+
}
100+
101+
/**
102+
* Returns a notice if SSL is not active.
103+
*
104+
* @since 2.0.0
105+
* @author Biplav Subedi <[email protected]>
106+
*/
107+
public function add_ssl_notice() {
108+
$connected = get_option( 'cc_woo_import_connection_established' );
109+
110+
if ( ! $connected && 'on' !== $_SERVER['HTTPS'] ) {
111+
$message = __( 'Your site does not appear to be using a secure connection (SSL). You might face issues when connecting to your account. Please add HTTPS to your site to make sure you have no issues connecting.', 'cc-woo' );
112+
new Notice(
113+
new NoticeMessage( $message, 'error', true )
114+
);
115+
}
116+
96117
}
97118

98119
/**
@@ -159,6 +180,8 @@ public function check_for_required_dependencies() {
159180
} catch ( Exception $e ) {
160181
$this->deactivate( $e->getMessage() );
161182
}
183+
184+
162185
}
163186

164187
/**
@@ -187,6 +210,7 @@ public function run() {
187210
public function register_hooks() {
188211
add_action( 'plugins_loaded', [ $this, 'check_for_required_dependencies' ] );
189212
add_action( 'wp_enqueue_scripts', [ $this, 'register_scripts' ] );
213+
add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ], 99 );
190214

191215
register_activation_hook( $this->plugin_file, [ $this, 'do_activation_process' ] );
192216
register_deactivation_hook( $this->plugin_file, [ $this, 'do_deactivation_process' ] );
@@ -329,4 +353,19 @@ public function do_deactivation_process() {
329353
public function register_scripts() {
330354
wp_register_script( 'cc-woo-public', trailingslashit( plugin_dir_url( $this->get_plugin_file() ) ) . 'app/bundle.js', [ 'wp-util' ], self::PLUGIN_VERSION, false );
331355
}
356+
357+
/**
358+
* Load back-end scripts.
359+
*
360+
* @author Biplav Subedi <[email protected]>
361+
* @since 2.0.0
362+
*
363+
* @return void
364+
*/
365+
public function admin_enqueue_scripts() {
366+
wp_enqueue_script( 'cc-woo-admin', trailingslashit( plugin_dir_url( $this->get_plugin_file() ) ) . 'app/admin-bundle.js', [ 'wp-util' ], self::PLUGIN_VERSION, false );
367+
wp_enqueue_style( 'cc-woo-admin', trailingslashit( plugin_dir_url( $this->get_plugin_file() ) ) . 'app/admin.css' );
368+
wp_enqueue_style( 'cc-woo-google-fonts', 'https://fonts.googleapis.com/css2?family=Maven+Pro:wght@400;700&display=swap', false );
369+
}
332370
}
371+

0 commit comments

Comments
 (0)