Skip to content

Commit

Permalink
Merge pull request #147 from WebDevStudios/release/2.0.0
Browse files Browse the repository at this point in the history
Release/2.0.0
  • Loading branch information
bplv112 authored Aug 31, 2022
2 parents 7d7026d + 9f53560 commit b4b0efc
Show file tree
Hide file tree
Showing 20 changed files with 1,016 additions and 195 deletions.
1 change: 1 addition & 0 deletions app/admin-bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

192 changes: 192 additions & 0 deletions app/admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
body.toplevel_page_ctct-woo-settings,
.cc-woo-wrap,
.cc-woo-welcome-wrap {
font-family: 'Maven Pro', sans-serif;
font-size: 14px;
font-weight: 400px;
}

body.toplevel_page_ctct-woo-settings .wrap.woocommerce,
.cc-woo-wrap {
padding: 20px 30px;
margin: 10px 20px 0 2px;
background-color: white;
}

.cc-woo-wrap h1,
.cc-woo-welcome-wrap h1,
body.toplevel_page_ctct-woo-settings h1 {
font-size: 30px;
font-weight: 700;
line-height: 40px;
}

.cc-woo-wrap h2,
.cc-woo-welcome-wrap h2,
body.toplevel_page_ctct-woo-settings h2 {
font-size: 20px;
font-weight: 700;
line-height: 28px;
}

.cc-woo-welcome-wrap {
padding: 80px 0px;
background-color: #ffff;
}

.wrap {
position: relative;
}
.cc-woo-welcome-wrap .container {
width: 80%;
min-height: 500px;
text-align: center;
margin: 80px auto auto;
}


a.cc-woo-back {
text-decoration: none;
}

tbody#cc-optional-fields tr:nth-child(2),
tbody#cc-optional-fields tr:first-child {
display: inline-block;
width: 50%;
}

tbody#cc-optional-fields tr:nth-child(2) th,
tbody#cc-optional-fields tr:nth-child(2) td,
tbody#cc-optional-fields tr:first-child th,
tbody#cc-optional-fields tr:first-child td {
display:block;
}


/* TBD*/

.btn-wrap {
margin: 40px;
}

.btn-wrap a {
margin: 20px 10px;
}

a.cc-woo-btn.btn-alternate {
background-color: #fff;
color: #1856ED;
}

.cc-woo-btn {
border: 1px solid #1856ED;
transition: 0.2s ease-in all;
text-decoration: none;
border-radius: 50px !important;
color: #fff;
padding: 7px 14px;
margin: 20px auto;
width: fit-content;
background: #1856ED;
}

.cc-woo-wrap a.cc-woo-btn.btn-primary,
body.toplevel_page_ctct-woo-settings a.cc-woo-btn.btn-primary{
display: flex;
justify-content: center;
align-items: center;
}

a.cc-woo-btn:hover {
box-shadow: 0 0 8px 4px rgb(70 150 240 / 25%) inset, 0 0 8px 4px rgb(70 150 240 / 25%);
border: 1px solid rgba(70,150,240,1);
color: #fff
}

.btn-alternate:hover {
color:#1856ED !important;
}

.form-table td {
margin-bottom: 9px;
}



body.toplevel_page_ctct-woo-settings td,
body.toplevel_page_ctct-woo-settings th,
.cc-woo-wrap td,
.cc-woo-wrap th{
display: block;
padding: 6px 10px 6px 0;
}


body.toplevel_page_ctct-woo-settings input[type="email"],
body.toplevel_page_ctct-woo-settings input[type="text"],
.cc-woo-wrap table.form-table input[type="email"],
.cc-woo-wrap table.form-table input[type="text"]{
width: 100% !important;
border-radius: 0px;
}

body.toplevel_page_ctct-woo-settings label,
.cc-woo-wrap label {
font-weight: 400;
}

#cc_woo_store_information_currency,
#cc_woo_store_information_country_code {
width: 25% !important;
}

input#cc_woo_save_store_details {
border-radius: 0px;
border: 1px soild #1856ed;
}

body.toplevel_page_ctct-woo-settings input[type="radio"]:active,
body.toplevel_page_ctct-woo-settings input[type="radio"]:focus,
body.toplevel_page_ctct-woo-settings input[type="radio"]:checked,
.cc-woo-wrap input[type="radio"]:active,
.cc-woo-wrap input[type="radio"]:checked,
.cc-woo-wrap input[type="radio"]:focus {
border-color: #1856ED;
box-shadow: 0 0 0 1px #1856ED;
outline: 2px solid transparent;
}

body.toplevel_page_ctct-woo-settings th.titledesc,
.cc-woo-wrap th.titledesc {
font-weight: 400;
}

.cc-woo-top-logo {
position: absolute;
top: 12%;
left: 5%;
}

.cc-woo-top-logo img {
width: 43px;
}

input#cc_woo_save_store_details:checked {
background: #1856ED;
transition: all 0.2s ease-in-out;
}

input#cc_woo_save_store_details:checked::before {
filter: brightness(0) invert(1);
}

body.toplevel_page_ctct-woo-settings input[type="radio"]:checked::before,
.cc-woo-wrap input[type="radio"]:checked::before {
background: #1856ED;
}

body.toplevel_page_ctct-woo-settings a:focus,
.cc-woo-wrap a:focus {
outline: none;
box-shadow: none;
}
8 changes: 8 additions & 0 deletions app/admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import HandleSettingsPage from './handleSettingsPage';

// Handles store details.
const enableStoreDetails = new HandleSettingsPage();
window.onload = function(e)
{
enableStoreDetails.init();
};
137 changes: 136 additions & 1 deletion app/bundle.js

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions app/handleSettingsPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

/**
* GuestCheckoutCapture.
*
* @package WebDevStudios\CCForWoo
* @since 1.2.0
*/
export default class HandleSettingsPage {

/**
* @constructor
*
* @author Biplav Subedi <[email protected]>
* @since 2.0.0
*/
constructor() {
this.els = {};
}

/**
* Init ccWoo admin JS.
*
* @author Biplav Subedi <[email protected]>
* @since 2.0.0
*/
init() {
this.cacheEls();
this.bindEvents();
this.enableStoreDetails();
}

/**
* Cache some DOM elements.
*
* @author Biplav Subedi <[email protected]>
* @since 2.0.0
*/
cacheEls() {
this.els.enableStoreDetails = document.getElementById( 'cc_woo_save_store_details' );
this.els.optionalFields = document.getElementById( 'cc-optional-fields' );

}

/**
* Bind callbacks to events.
*
* @author Biplav Subedi <[email protected]>
* @since 2.0.0
*/
bindEvents() {
this.els.enableStoreDetails.addEventListener( 'change', e => {
this.enableStoreDetails();
} );
}

/**
* Captures guest checkout if billing email is valid.
*
* @author Biplav Subedi <[email protected]>
* @since 2.0.0
*/
enableStoreDetails() {
if (this.els.enableStoreDetails.checked) {
console.log(this.els.optionalFields.parentElement);
this.els.optionalFields.parentElement.style.display = 'block';
} else {
this.els.optionalFields.parentElement.style.display = 'none';
}
}

}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "constant-contact-woocommerce",
"version": "1.4.1",
"version": "2.0.0",
"description": "",
"main": "index.js",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
</rule>

</ruleset>
</ruleset>
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Plugin Name: Constant Contact + WooCommerce
* Description: Add products to your emails and sync your contacts.
* Plugin URI: https://github.com/WebDevStudios/constant-contact-woocommerce
* Version: 1.4.1
* Version: 2.0.0
* Author: Constant Contact
* Author URI: https://www.constantcontact.com/
* Text Domain: cc-woo
Expand Down
1 change: 1 addition & 0 deletions src/AbandonedCheckouts/CheckoutHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class CheckoutHandler extends Service {
public function register_hooks() {
add_action( 'woocommerce_before_checkout_form', [ $this, 'enqueue_scripts' ] );


add_action( 'woocommerce_after_template_part', [ $this, 'save_or_clear_checkout_data' ], 10, 4 );
add_action( 'woocommerce_cart_updated', [ $this, 'update_checkout_data' ] );
add_action( 'woocommerce_set_cart_cookies', [ $this, 'update_checkout_data' ] );
Expand Down
41 changes: 40 additions & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use WebDevStudios\CCForWoo\Api\KeyManager;
use WebDevStudios\CCForWoo\WebHook\Disconnect;
use WebDevStudios\CCForWoo\View\Admin\MenuItem;
use WebDevStudios\CCForWoo\View\Admin\Disconnect as DisconnectSettings;
use WebDevStudios\CCForWoo\AbandonedCheckouts\CheckoutHandler;
use WebDevStudios\CCForWoo\AbandonedCheckouts\CheckoutsTable;
use WebDevStudios\CCForWoo\AbandonedCheckouts\CheckoutRecovery;
Expand All @@ -46,7 +47,7 @@ final class Plugin extends ServiceRegistrar {
* @since 1.0.0
* @var string
*/
const PLUGIN_VERSION = '1.4.0';
const PLUGIN_VERSION = '2.0.0';

/**
* Whether the plugin is currently active.
Expand Down Expand Up @@ -79,6 +80,7 @@ final class Plugin extends ServiceRegistrar {
CheckoutsTable::class,
CheckoutRecovery::class,
RestRegistrar::class,
DisconnectSettings::class,
];

/**
Expand All @@ -93,6 +95,25 @@ final class Plugin extends ServiceRegistrar {
*/
public function __construct( string $plugin_file ) {
$this->plugin_file = $plugin_file;
add_action( 'admin_notices', [ $this, 'add_ssl_notice' ] );
}

/**
* Returns a notice if SSL is not active.
*
* @since 2.0.0
* @author Biplav Subedi <[email protected]>
*/
public function add_ssl_notice() {
$connected = get_option( 'cc_woo_import_connection_established' );

if ( ! $connected && 'on' !== $_SERVER['HTTPS'] ) {
$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' );
new Notice(
new NoticeMessage( $message, 'error', true )
);
}

}

/**
Expand Down Expand Up @@ -159,6 +180,8 @@ public function check_for_required_dependencies() {
} catch ( Exception $e ) {
$this->deactivate( $e->getMessage() );
}


}

/**
Expand Down Expand Up @@ -187,6 +210,7 @@ public function run() {
public function register_hooks() {
add_action( 'plugins_loaded', [ $this, 'check_for_required_dependencies' ] );
add_action( 'wp_enqueue_scripts', [ $this, 'register_scripts' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ], 99 );

register_activation_hook( $this->plugin_file, [ $this, 'do_activation_process' ] );
register_deactivation_hook( $this->plugin_file, [ $this, 'do_deactivation_process' ] );
Expand Down Expand Up @@ -329,4 +353,19 @@ public function do_deactivation_process() {
public function register_scripts() {
wp_register_script( 'cc-woo-public', trailingslashit( plugin_dir_url( $this->get_plugin_file() ) ) . 'app/bundle.js', [ 'wp-util' ], self::PLUGIN_VERSION, false );
}

/**
* Load back-end scripts.
*
* @author Biplav Subedi <[email protected]>
* @since 2.0.0
*
* @return void
*/
public function admin_enqueue_scripts() {
wp_enqueue_script( 'cc-woo-admin', trailingslashit( plugin_dir_url( $this->get_plugin_file() ) ) . 'app/admin-bundle.js', [ 'wp-util' ], self::PLUGIN_VERSION, false );
wp_enqueue_style( 'cc-woo-admin', trailingslashit( plugin_dir_url( $this->get_plugin_file() ) ) . 'app/admin.css' );
wp_enqueue_style( 'cc-woo-google-fonts', 'https://fonts.googleapis.com/css2?family=Maven+Pro:wght@400;700&display=swap', false );
}
}

Loading

0 comments on commit b4b0efc

Please sign in to comment.