Skip to content

Commit

Permalink
Merge pull request #303 from newfold-labs/PRESS0-1194
Browse files Browse the repository at this point in the history
update naming conventions
  • Loading branch information
aratidgr8 authored Jul 10, 2024
2 parents 31bf53d + 5e30e16 commit 9e85f65
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion includes/ECommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function ( $classes ) {
'single' => true,
)
);
add_filter( 'newfold-runtime', array( $this, 'add_to_runtime' ) );
add_filter( 'newfold_runtime', array( $this, 'add_to_runtime' ) );
$this->add_filters(
array( 'postbox_classes_page_wpseo_meta', 'postbox_classes_post_wpseo_meta', 'postbox_classes_product_wpseo_meta' ),
function ( $classes ) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/OnboardingScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export function OnboardingScreen({
}}
as="a"
className="nfd-bg-canvas "
href={NewfoldRuntime.siteDetails.url}
href={NewfoldRuntime.siteUrl}
target="_blank"
variant="secondary"
data-cy="view-site"
Expand Down
2 changes: 1 addition & 1 deletion src/components/SiteStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function SiteStatus({ comingSoon, toggleComingSoon, notify }) {
<Button
as="a"
className="nfd-bg-canvas"
href={NewfoldRuntime.hasCapability("isEcommerce") && window.location.href.includes('store') ? `${NewfoldRuntime.siteDetails.url}/shop` : NewfoldRuntime.siteDetails.url}
href={NewfoldRuntime.hasCapability("isEcommerce") && window.location.href.includes('store') ? `${NewfoldRuntime.siteUrl}/shop` : NewfoldRuntime.siteUrl}
target="_blank"
variant="secondary"
id="view-site"
Expand Down
24 changes: 12 additions & 12 deletions src/sdk/NewfoldRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@ export const NewfoldRuntime = {
return window.NewfoldRuntime?.capabilities[name] === true;
},
adminUrl(path) {
return window.NewfoldRuntime?.admin_url + path;
return window.NewfoldRuntime?.adminUrl + path;
},
createApiUrl(url, qs = {}) {
return addQueryArgs(window.NewfoldRuntime?.base_url, {
return addQueryArgs(window.NewfoldRuntime?.homeUrl, {
rest_route: url,
...qs,
});
},
get siteDetails() {
return window.NewfoldRuntime?.site;
get siteUrl() {
return window.NewfoldRuntime?.siteUrl;
},
get sdk() {
return window.NewfoldRuntime?.sdk;
},
get isWoo(){
get isWoo() {
return window.NewfoldRuntime?.isWoocommerceActive
},
get isJet(){
get isJet() {
return window.NewfoldRuntime?.isJetpackBoostActive
},
get homeUrl(){
get homeUrl() {
return window.NewfoldRuntime?.homeUrl
},
get currentTheme(){
get currentTheme() {
return (window.NewfoldRuntime?.currentTheme);
},
get plugin(){
get plugin() {
return (window.NewfoldRuntime?.plugin);
},
get ecommerce() {
return (window.NewfoldRuntime?.ecommerce);
}
};
2 changes: 1 addition & 1 deletion src/sdk/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Endpoints = {
PLUGIN_INSTALL: NewfoldRuntime.createApiUrl("/newfold-installer/v1/plugins/install"),
};

const INSTALL_TOKEN = NewfoldRuntime.sdk.ecommerce.install_token;
const INSTALL_TOKEN = NewfoldRuntime.ecommerce.install_token;

export const PluginsSdk = {
queries: {
Expand Down
4 changes: 2 additions & 2 deletions src/sdk/runtime.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NewfoldRuntime } from "./NewfoldRuntime";

export const RuntimeSdk = {
brandSettings: NewfoldRuntime.sdk.ecommerce?.brand_settings,
brandSettings: NewfoldRuntime.ecommerce?.brand_settings,
adminUrl(path, backToNfd = false) {
let href = NewfoldRuntime.adminUrl(path);
if (backToNfd === false) {
Expand All @@ -13,6 +13,6 @@ export const RuntimeSdk = {
return `${page}?${query}`;
},
nonce(name) {
return NewfoldRuntime.sdk.ecommerce.nonces?.[name];
return NewfoldRuntime.ecommerce.nonces?.[name];
},
};

0 comments on commit 9e85f65

Please sign in to comment.