Skip to content

Commit

Permalink
added woocommerce active status key | returns boolean based on plugin…
Browse files Browse the repository at this point in the history
… status (#8)

* added woocommerce active status key

* js keys added

* bump version 1.0.3

* version bump lock
  • Loading branch information
ramyakrishnai authored Sep 12, 2023
1 parent ff11b34 commit 9de4f76
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions includes/Runtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function prepareRuntime() {
'siteTitle' => htmlspecialchars_decode( \get_bloginfo( 'name' ) ),
'restUrl' => \esc_url_raw( \get_home_url() . '/index.php?rest_route=' ),
'restNonce' => wp_create_nonce('wp-rest'),
'isWoocommerceActive' => is_plugin_active('woocommerce/woocommerce.php'),
...$sdk
);
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@newfold-labs/wp-module-runtime",
"description": "Runtime for Newfold WP modules and plugins",
"license": "GPL-2.0-or-later",
"version": "1.0.2",
"version": "1.0.3",
"main": "build/index.js",
"files": [
"build/index.js",
Expand Down
15 changes: 15 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,19 @@ export const NewfoldRuntime = {
get sdk() {
return window.NewfoldRuntime?.sdk;
},
get isWoo() {
return window.NewfoldRuntime?.isWoocommerceActive;
},
get ecommerce() {
return window.NewfoldRuntime?.ecommerce;
},
get plugin() {
return window.NewfoldRuntime?.plugin;
},
get wpversion() {
return window.NewfoldRuntime?.wpversion;
},
get siteTitle(){
return window.NewfoldRuntime?.siteTitle;
}
};

0 comments on commit 9de4f76

Please sign in to comment.