@automattic/newspack-blocks 2.0.0 → 2.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cache/babel/405a59e43e00b2c52dbadde7c6a04c87.json.gz +0 -0
- package/.cache/babel/6715650e6d89955011841839faac29f2.json.gz +0 -0
- package/.cache/babel/8b2ff59858cc47bf8aca96b47daeb4e4.json.gz +0 -0
- package/.cache/babel/fb39540b9437544cb27c360f7d885b90.json.gz +0 -0
- package/CHANGELOG.md +7 -0
- package/dist/editor.asset.php +1 -1
- package/dist/editor.js +1 -1
- package/dist/modal.asset.php +1 -1
- package/dist/modal.js +1 -1
- package/dist/modalCheckout.asset.php +1 -1
- package/dist/modalCheckout.css +1 -1
- package/dist/modalCheckout.rtl.css +1 -1
- package/includes/class-modal-checkout.php +87 -44
- package/newspack-blocks.php +2 -2
- package/package.json +1 -1
- package/src/blocks/checkout-button/block.json +2 -1
- package/src/blocks/checkout-button/edit.js +1 -42
- package/src/blocks/donate/block.json +10 -0
- package/src/blocks/donate/edit/index.tsx +4 -0
- package/src/blocks/donate/frontend/class-newspack-blocks-donate-renderer-base.php +14 -2
- package/src/blocks/donate/frontend/class-newspack-blocks-donate-renderer-frequency-based.php +2 -2
- package/src/blocks/donate/frontend/class-newspack-blocks-donate-renderer-tiers-based.php +1 -1
- package/src/blocks/donate/types.ts +4 -0
- package/src/components/redirect-after-success.tsx +50 -0
- package/src/modal-checkout/checkout.scss +2 -2
- package/src/modal-checkout/modal.js +17 -0
- package/src/modal-checkout/templates/thankyou.php +48 -35
- package/vendor/autoload.php +1 -1
- package/vendor/composer/autoload_real.php +4 -4
- package/vendor/composer/autoload_static.php +2 -2
- package/vendor/composer/installed.php +2 -2
- package/.cache/babel/05ef61416b32f57c09787aa5b64d2174.json.gz +0 -0
- package/.cache/babel/6e8243b5aa4f0e5b85ddf1418e5908d0.json.gz +0 -0
- package/.cache/babel/a3f4c297e3a52f8342c1ffea1b4b1c0c.json.gz +0 -0
|
@@ -33,10 +33,12 @@ function newspack_blocks_replace_login_with_order_summary() {
|
|
|
33
33
|
|
|
34
34
|
// Handle the newsletter signup form.
|
|
35
35
|
$newsletter_confirmation = \Newspack_Blocks\Modal_Checkout::confirm_newsletter_signup();
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
$is_error = \is_wp_error( $newsletter_confirmation );
|
|
37
|
+
$no_selected_lists = $is_error && 'newspack_no_lists_selected' === $newsletter_confirmation->get_error_code();
|
|
38
|
+
if ( true === $newsletter_confirmation || $no_selected_lists ) {
|
|
39
|
+
echo \Newspack_Blocks\Modal_Checkout::render_newsletter_confirmation( $no_selected_lists ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
38
40
|
return;
|
|
39
|
-
} elseif (
|
|
41
|
+
} elseif ( $is_error ) {
|
|
40
42
|
echo esc_html( $newsletter_confirmation->get_error_message() );
|
|
41
43
|
return;
|
|
42
44
|
}
|
|
@@ -45,49 +47,60 @@ function newspack_blocks_replace_login_with_order_summary() {
|
|
|
45
47
|
return;
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
$is_success = ! $order->has_status( 'failed' );
|
|
51
|
+
|
|
48
52
|
?>
|
|
49
53
|
|
|
50
54
|
<div class="woocommerce-order">
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
<?php if ( $is_success ) : ?>
|
|
56
|
+
<h4><?php esc_html_e( 'Transaction Successful', 'newspack-blocks' ); ?></h4>
|
|
57
|
+
<ul class="woocommerce-order-overview woocommerce-thankyou-order-details order_details">
|
|
58
|
+
<li class="woocommerce-order-overview__date date">
|
|
59
|
+
<?php esc_html_e( 'Date:', 'newspack-blocks' ); ?>
|
|
60
|
+
<strong><?php echo wc_format_datetime( $order->get_date_created() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong>
|
|
61
|
+
</li>
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
<?php if ( $order->get_billing_email() ) : ?>
|
|
64
|
+
<li class="woocommerce-order-overview__email email">
|
|
65
|
+
<?php esc_html_e( 'Email:', 'newspack-blocks' ); ?>
|
|
66
|
+
<strong><?php echo $order->get_billing_email(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong>
|
|
67
|
+
</li>
|
|
68
|
+
<?php endif; ?>
|
|
69
|
+
|
|
70
|
+
<li class="woocommerce-order-overview__total total">
|
|
71
|
+
<?php esc_html_e( 'Total:', 'newspack-blocks' ); ?>
|
|
72
|
+
<strong><?php echo $order->get_formatted_order_total(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong>
|
|
62
73
|
</li>
|
|
63
|
-
<?php endif; ?>
|
|
64
74
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
<?php if ( $order->get_payment_method_title() ) : ?>
|
|
76
|
+
<li class="woocommerce-order-overview__payment-method method">
|
|
77
|
+
<?php esc_html_e( 'Payment method:', 'newspack-blocks' ); ?>
|
|
78
|
+
<strong><?php echo wp_kses_post( $order->get_payment_method_title() ); ?></strong>
|
|
79
|
+
</li>
|
|
80
|
+
<?php endif; ?>
|
|
69
81
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<strong><?php echo wp_kses_post( $order->get_payment_method_title() ); ?></strong>
|
|
82
|
+
<li class="woocommerce-order-overview__order order">
|
|
83
|
+
<?php esc_html_e( 'Transaction:', 'newspack-blocks' ); ?>
|
|
84
|
+
<strong><?php echo $order->get_order_number(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong>
|
|
74
85
|
</li>
|
|
75
|
-
|
|
86
|
+
</ul>
|
|
87
|
+
<?php else : ?>
|
|
88
|
+
<p class="woocommerce-notice woocommerce-notice--error woocommerce-thankyou-order-failed">
|
|
89
|
+
<?php esc_html_e( 'Unfortunately your order cannot be processed. Please attempt your purchase again.', 'newspack-blocks' ); ?>
|
|
90
|
+
</p>
|
|
76
91
|
|
|
77
|
-
<
|
|
78
|
-
<?php esc_html_e( '
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
92
|
+
<p class="woocommerce-notice woocommerce-notice--error woocommerce-thankyou-order-failed-actions">
|
|
93
|
+
<a href="<?php echo esc_url( $order->get_checkout_payment_url() ); ?>" class="button pay"><?php esc_html_e( 'Pay', 'newspack-blocks' ); ?></a>
|
|
94
|
+
<?php if ( is_user_logged_in() ) : ?>
|
|
95
|
+
<a href="<?php echo esc_url( wc_get_page_permalink( 'myaccount' ) ); ?>" class="button pay"><?php esc_html_e( 'My account', 'newspack-blocks' ); ?></a>
|
|
96
|
+
<?php endif; ?>
|
|
97
|
+
</p>
|
|
98
|
+
<?php endif; ?>
|
|
82
99
|
</div>
|
|
83
100
|
|
|
84
|
-
<?php
|
|
85
|
-
|
|
86
|
-
<?php
|
|
87
|
-
if ( $order ) {
|
|
88
|
-
echo \Newspack_Blocks\Modal_Checkout::render_newsletter_signup_form( $order ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
89
|
-
}
|
|
90
|
-
?>
|
|
101
|
+
<?php if ( $is_success ) : ?>
|
|
102
|
+
<?php echo \Newspack_Blocks\Modal_Checkout::render_checkout_after_success_markup( $order ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
|
103
|
+
<?php endif; ?>
|
|
91
104
|
|
|
92
105
|
<?php
|
|
93
106
|
}
|
package/vendor/autoload.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// autoload_real.php @generated by Composer
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class ComposerAutoloaderInitf52fad8dcdfedff4d68993a76d27f9ec
|
|
6
6
|
{
|
|
7
7
|
private static $loader;
|
|
8
8
|
|
|
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit232d6885e695e323ef57a5d5ea2f9d04
|
|
|
22
22
|
return self::$loader;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
spl_autoload_register(array('
|
|
25
|
+
spl_autoload_register(array('ComposerAutoloaderInitf52fad8dcdfedff4d68993a76d27f9ec', 'loadClassLoader'), true, true);
|
|
26
26
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
|
27
|
-
spl_autoload_unregister(array('
|
|
27
|
+
spl_autoload_unregister(array('ComposerAutoloaderInitf52fad8dcdfedff4d68993a76d27f9ec', 'loadClassLoader'));
|
|
28
28
|
|
|
29
29
|
require __DIR__ . '/autoload_static.php';
|
|
30
|
-
call_user_func(\Composer\Autoload\
|
|
30
|
+
call_user_func(\Composer\Autoload\ComposerStaticInitf52fad8dcdfedff4d68993a76d27f9ec::getInitializer($loader));
|
|
31
31
|
|
|
32
32
|
$loader->register(true);
|
|
33
33
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
namespace Composer\Autoload;
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class ComposerStaticInitf52fad8dcdfedff4d68993a76d27f9ec
|
|
8
8
|
{
|
|
9
9
|
public static $classMap = array (
|
|
10
10
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
|
@@ -13,7 +13,7 @@ class ComposerStaticInit232d6885e695e323ef57a5d5ea2f9d04
|
|
|
13
13
|
public static function getInitializer(ClassLoader $loader)
|
|
14
14
|
{
|
|
15
15
|
return \Closure::bind(function () use ($loader) {
|
|
16
|
-
$loader->classMap =
|
|
16
|
+
$loader->classMap = ComposerStaticInitf52fad8dcdfedff4d68993a76d27f9ec::$classMap;
|
|
17
17
|
|
|
18
18
|
}, null, ClassLoader::class);
|
|
19
19
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
'name' => 'automattic/newspack-blocks',
|
|
4
4
|
'pretty_version' => 'dev-master',
|
|
5
5
|
'version' => 'dev-master',
|
|
6
|
-
'reference' => '
|
|
6
|
+
'reference' => 'b39c74f409d0212c22e93408dd549734b54863d8',
|
|
7
7
|
'type' => 'wordpress-plugin',
|
|
8
8
|
'install_path' => __DIR__ . '/../../',
|
|
9
9
|
'aliases' => array(),
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
'automattic/newspack-blocks' => array(
|
|
14
14
|
'pretty_version' => 'dev-master',
|
|
15
15
|
'version' => 'dev-master',
|
|
16
|
-
'reference' => '
|
|
16
|
+
'reference' => 'b39c74f409d0212c22e93408dd549734b54863d8',
|
|
17
17
|
'type' => 'wordpress-plugin',
|
|
18
18
|
'install_path' => __DIR__ . '/../../',
|
|
19
19
|
'aliases' => array(),
|
|
Binary file
|
|
Binary file
|
|
Binary file
|