-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from WebDevStudios/release/2.0.0
Release/2.0.0
- Loading branch information
Showing
20 changed files
with
1,016 additions
and
195 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,4 +63,4 @@ | |
<exclude name="WordPress.Files.FileName.InvalidClassFileName" /> | ||
</rule> | ||
|
||
</ruleset> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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. | ||
|
@@ -79,6 +80,7 @@ final class Plugin extends ServiceRegistrar { | |
CheckoutsTable::class, | ||
CheckoutRecovery::class, | ||
RestRegistrar::class, | ||
DisconnectSettings::class, | ||
]; | ||
|
||
/** | ||
|
@@ -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 ) | ||
); | ||
} | ||
|
||
} | ||
|
||
/** | ||
|
@@ -159,6 +180,8 @@ public function check_for_required_dependencies() { | |
} catch ( Exception $e ) { | ||
$this->deactivate( $e->getMessage() ); | ||
} | ||
|
||
|
||
} | ||
|
||
/** | ||
|
@@ -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' ] ); | ||
|
@@ -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 ); | ||
} | ||
} | ||
|
Oops, something went wrong.