Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update naming conventions #303

Merged
merged 6 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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];
},
};
Loading