diff --git a/includes/Runtime.php b/includes/Runtime.php index f7473a3..ea09163 100644 --- a/includes/Runtime.php +++ b/includes/Runtime.php @@ -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 ); } diff --git a/package-lock.json b/package-lock.json index 91c30fe..bc1a20c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@newfold-labs/wp-module-runtime", - "version": "1.0.1", + "version": "1.0.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@newfold-labs/wp-module-runtime", - "version": "1.0.1", + "version": "1.0.3", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/url": "3.36.0" diff --git a/package.json b/package.json index 8139057..a5208fa 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/index.js b/src/index.js index ba28aab..9942926 100644 --- a/src/index.js +++ b/src/index.js @@ -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; + } };