2021-04-22 11:37:27 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { getSetting, STORE_PAGES } from '@woocommerce/settings';
|
|
|
|
|
2021-04-27 16:39:20 +00:00
|
|
|
export type WordCountType =
|
|
|
|
| 'words'
|
|
|
|
| 'characters_excluding_spaces'
|
|
|
|
| 'characters_including_spaces';
|
|
|
|
|
2021-04-22 11:37:27 +00:00
|
|
|
interface WcBlocksConfig {
|
|
|
|
buildPhase: number;
|
|
|
|
pluginUrl: string;
|
|
|
|
productCount: number;
|
2021-06-29 14:04:24 +00:00
|
|
|
defaultAvatar: string;
|
2021-04-22 11:37:27 +00:00
|
|
|
restApiRoutes: Record< string, string[] >;
|
2021-04-27 16:39:20 +00:00
|
|
|
wordCountType: WordCountType;
|
2021-04-22 11:37:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const blocksConfig = getSetting( 'wcBlocksConfig', {
|
|
|
|
buildPhase: 1,
|
|
|
|
pluginUrl: '',
|
|
|
|
productCount: 0,
|
2021-06-29 14:04:24 +00:00
|
|
|
defaultAvatar: '',
|
2021-04-22 11:37:27 +00:00
|
|
|
restApiRoutes: {},
|
|
|
|
wordCountType: 'words',
|
|
|
|
} ) as WcBlocksConfig;
|
|
|
|
|
2021-06-29 14:04:24 +00:00
|
|
|
export const WC_BLOCKS_IMAGE_URL = blocksConfig.pluginUrl + 'images/';
|
2021-04-22 11:37:27 +00:00
|
|
|
export const WC_BLOCKS_BUILD_URL = blocksConfig.pluginUrl + 'build/';
|
|
|
|
export const WC_BLOCKS_PHASE = blocksConfig.buildPhase;
|
|
|
|
export const SHOP_URL = STORE_PAGES.shop?.permalink;
|
|
|
|
export const CHECKOUT_PAGE_ID = STORE_PAGES.checkout.id;
|
|
|
|
export const CHECKOUT_URL = STORE_PAGES.checkout.permalink;
|
|
|
|
export const PRIVACY_URL = STORE_PAGES.privacy.permalink;
|
|
|
|
export const PRIVACY_PAGE_NAME = STORE_PAGES.privacy.title;
|
|
|
|
export const TERMS_URL = STORE_PAGES.terms.permalink;
|
|
|
|
export const TERMS_PAGE_NAME = STORE_PAGES.terms.title;
|
|
|
|
export const CART_PAGE_ID = STORE_PAGES.cart.id;
|
|
|
|
export const CART_URL = STORE_PAGES.cart.permalink;
|
|
|
|
export const LOGIN_URL = STORE_PAGES.myaccount.permalink
|
|
|
|
? STORE_PAGES.myaccount.permalink
|
|
|
|
: getSetting( 'wpLoginUrl', '/wp-login.php' );
|
2021-06-17 08:35:24 +00:00
|
|
|
export const SHIPPING_COUNTRIES = getSetting< Record< string, string > >(
|
|
|
|
'shippingCountries',
|
|
|
|
{}
|
|
|
|
);
|
|
|
|
export const ALLOWED_COUNTRIES = getSetting< Record< string, string > >(
|
|
|
|
'allowedCountries',
|
|
|
|
{}
|
|
|
|
);
|
|
|
|
export const SHIPPING_STATES = getSetting<
|
|
|
|
Record< string, Record< string, string > >
|
|
|
|
>( 'shippingStates', {} );
|
|
|
|
export const ALLOWED_STATES = getSetting< Record< string, string > >(
|
|
|
|
'allowedStates',
|
|
|
|
{}
|
|
|
|
);
|