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 1 commit
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 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 @@ -82,7 +82,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
4 changes: 2 additions & 2 deletions src/components/WonderCart.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function WonderCart(props) {
href={
(canAccessGlobalCTB &&
!hasYithExtended &&
NewfoldRuntime.sdk.ecommerce.brand_settings.wondercartBuyNow) || ''
NewfoldRuntime.ecommerce.brand_settings.wondercartBuyNow) || ''
}
variant="upsell"
isLoading={showInProgress}
Expand All @@ -94,7 +94,7 @@ export function WonderCart(props) {
cardLink={
(canAccessGlobalCTB &&
!hasYithExtended &&
NewfoldRuntime.sdk.ecommerce.brand_settings.wondercartBuyNow) || ''
NewfoldRuntime.ecommerce.brand_settings.wondercartBuyNow) || ''
manikantakailasa marked this conversation as resolved.
Show resolved Hide resolved
}
target="_blank"
cardText={
Expand Down
11 changes: 4 additions & 7 deletions src/sdk/NewfoldRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ 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 sdk() {
return window.NewfoldRuntime?.sdk;
get siteUrl() {
return window.NewfoldRuntime?.siteUrl;
},
get isWoo(){
return window.NewfoldRuntime?.isWoocommerceActive
Expand Down
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