Skip to content

Commit af4a2a9

Browse files
authored
Merge pull request #65 from WebDevStudios/feature/abandoned-carts
Feature: Abandoned Carts
2 parents f86bf32 + 8478197 commit af4a2a9

File tree

22 files changed

+1975
-11
lines changed

22 files changed

+1975
-11
lines changed

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @ggwicz
1+
* @ggwicz @ravewebdev

app/admin.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#cc_woo_abandoned_carts_secret_key {
2+
width: 90%;
3+
}
4+
5+
#cc_woo_abandoned_carts_rest_endpoints {
6+
display: none !important; /* !important is unfortunately required here to override inline styles. */
7+
}
8+
9+
#cc_woo_abandoned_carts_server_info {
10+
display: none !important; /* !important is unfortunately required here to override inline styles. */
11+
}
12+
13+
#cc_woo_abandoned_carts_rest_endpoints + .description * {
14+
font-style: normal;
15+
}
16+
17+
#cc_woo_abandoned_carts_server_info + .description * {
18+
font-style: normal;
19+
}
20+
21+
.forminp code {
22+
background: none;
23+
white-space: pre-line;
24+
}

app/admin.js

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/**
2+
* Constant Contact WooCommerce Admin
3+
*
4+
* @package WebDevStudios\CCForWoo
5+
* @since 2019-10-24
6+
*/
7+
window.ccWooAdmin = {};
8+
9+
( function( app ) {
10+
11+
/**
12+
* Init the admin functionality.
13+
*
14+
* @author George Gecewicz <[email protected]>
15+
* @since 2019-10-24
16+
*/
17+
app.init = function() {
18+
app.cacheEls();
19+
app.bindEvents();
20+
};
21+
22+
/**
23+
* Cache DOM els.
24+
*
25+
* @author George Gecewicz <[email protected]>
26+
* @since 2019-10-24
27+
*/
28+
app.cacheEls = function() {
29+
app.els = {};
30+
31+
app.els.input = document.getElementById( 'cc_woo_abandoned_carts_secret_key' );
32+
app.els.button = document.getElementById( 'cc_woo_abandoned_carts_generate_secret_key' );
33+
};
34+
35+
/**
36+
* Bind callbacks to events.
37+
*
38+
* @author George Gecewicz <[email protected]>
39+
* @since 2019-10-24
40+
*/
41+
app.bindEvents = function() {
42+
43+
// Generate new key.
44+
app.els.button.addEventListener( 'click', function( e ) {
45+
e.preventDefault();
46+
app.generateKey();
47+
} );
48+
};
49+
50+
/**
51+
* Gets a new key.
52+
*
53+
* @author George Gecewicz <[email protected]>
54+
* @since 2019-10-24
55+
*/
56+
app.generateKey = function() {
57+
wp.ajax.send( 'cc_woo_abandoned_carts_generate_secret_key', {
58+
data: {
59+
nonce: app.els.button.getAttribute( 'data-wp-nonce' )
60+
},
61+
success: app.handleGenerateKeySuccess
62+
} );
63+
};
64+
65+
/**
66+
* Handle a successful generation of new secret key.
67+
*
68+
* @author George Gecewicz <[email protected]>
69+
* @since 2019-10-24
70+
*
71+
* @param {object} data The AJAX response data from wp.ajax's success callback.
72+
*/
73+
app.handleGenerateKeySuccess = function( data ) {
74+
app.els.input.value = data.key;
75+
};
76+
77+
app.init();
78+
79+
} ( window.ccWooAdmin ) );

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
},
2929
"require": {
3030
"webdevstudios/oops-wp": "^0.1",
31-
"composer/installers": "^1.6"
31+
"composer/installers": "^1.6",
32+
"firebase/php-jwt": "^5.0"
3233
},
3334
"archive": {
3435
"exclude": [

composer.lock

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

plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
* Author: Constant Contact
1515
* Author URI: https://www.constantcontact.com/
1616
* Text Domain: cc-woo
17+
* Requires PHP: 7.2
1718
* License: GPL-3.0+
1819
* License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
1920
*/
2021

2122
// Autoload things.
2223
$autoloader = dirname( __FILE__ ) . '/vendor/autoload.php';
2324

24-
// @TODO We'll probably want to ship the autoloader and dependencies with the plugin and not require folks to have to run Composer.
2525
if ( ! is_readable( $autoloader ) ) {
26-
// translators: placeholder is the current directory.
26+
/* Translators: Placeholder is the current directory. */
2727
throw new \Exception( sprintf( __( 'Please run `composer install` in the plugin folder "%s" and try activating this plugin again.', 'cc-woo' ), dirname( __FILE__ ) ) );
2828
}
2929

0 commit comments

Comments
 (0)