Skip to content

Commit

Permalink
Adding embedded card JS in WC block separately.
Browse files Browse the repository at this point in the history
  • Loading branch information
aashishgurung committed Aug 6, 2024
1 parent ab7d01a commit b8df20a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion includes/blocks/assets/js/build/credit_card.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '5064f6bb58dd3352c00f30554738304a');
<?php return array('dependencies' => array('react', 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '9d9c940edd665b09cdd8e15ab6212835');
2 changes: 1 addition & 1 deletion includes/blocks/assets/js/build/credit_card.js

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

8 changes: 8 additions & 0 deletions includes/blocks/gateways/omise-block-credit-card.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ public function get_payment_method_script_handles() {
$script_asset = require_once __DIR__ . '/../assets/js/build/credit_card.asset.php';

if (is_array($script_asset)) {
wp_register_script(
'embedded-js',
plugins_url( '../../assets/javascripts/omise-embedded-card.js', __FILE__ ),
[],
OMISE_WOOCOMMERCE_PLUGIN_VERSION,
true
);

wp_register_script(
"{$this->name}-payments-blocks",
plugin_dir_url( __DIR__ ) . 'assets/js/build/credit_card.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function get_payment_method_script_handles()
Monkey\Functions\expect('wp_script_is');
Monkey\Functions\expect('wp_register_script');
Monkey\Functions\expect('plugin_dir_url');
Monkey\Functions\expect('plugin_url');
Monkey\Functions\expect('is_checkout')->andReturn(true);
Monkey\Functions\expect('wc_string_to_bool')->andReturn(null);

Expand Down

0 comments on commit b8df20a

Please sign in to comment.