Skip to content

Commit

Permalink
Merge pull request #58 from newfold-labs/update/use-newfoldruntime-fo…
Browse files Browse the repository at this point in the history
…r-capabilitites

use newfoldruntime for capabilitites check
  • Loading branch information
abhijitb authored Oct 10, 2024
2 parents 77e132e + 26af110 commit 0e92e33
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 28 deletions.
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '9f695924420aef9082a5');
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '97f9cfd4e293ed413729');
34 changes: 17 additions & 17 deletions build/index.js

Large diffs are not rendered by default.

28 changes: 18 additions & 10 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,24 @@ export const OnboardingAPIs = {
};

export const CapabilityAPI = {
getHelpCenterCapability: () =>
apiFetch( {
path: base + '/capability',
method: 'GET',
} ),
getBrand: () =>
apiFetch( {
path: base + '/capability/brand',
method: 'GET',
} ),
getHelpCenterCapability: () => {
return (
// get the help center capability from newfold runtime
window.NewfoldRuntime?.capabilities?.canAccessHelpCenter || false
);
},
getBrand: () => {
// get the brand name from newfold runtime
const brand = window.NewfoldRuntime?.plugin?.brand || 'wordpress';
// add region if HostGator
if (
brand.includes( 'hostgator' ) &&
window.NewfoldRuntime?.plugin?.region
) {
return brand + '-' + window.NewfoldRuntime?.plugin?.region;
}
return brand;
},
};

// A wrapper to get and set things more easily
Expand Down

0 comments on commit 0e92e33

Please sign in to comment.