2024-07-12 13:24:22 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import type { Currency, SymbolPosition } from '@woocommerce/types';
|
|
|
|
|
2021-04-22 11:37:27 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { allSettings } from './settings-init';
|
2024-07-12 13:24:22 +00:00
|
|
|
import { getCurrencyPrefix, getCurrencySuffix } from './utils';
|
2021-04-22 11:37:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This exports all default core settings as constants.
|
|
|
|
*/
|
|
|
|
export const ADMIN_URL = allSettings.adminUrl;
|
|
|
|
export const COUNTRIES = allSettings.countries;
|
2022-12-19 14:19:52 +00:00
|
|
|
export const CURRENT_USER_IS_ADMIN = allSettings.currentUserIsAdmin as boolean;
|
2023-05-24 12:24:08 +00:00
|
|
|
export const HOME_URL = allSettings.homeUrl as string | undefined;
|
2021-04-22 11:37:27 +00:00
|
|
|
export const LOCALE = allSettings.locale;
|
|
|
|
export const ORDER_STATUSES = allSettings.orderStatuses;
|
2021-04-26 12:20:30 +00:00
|
|
|
export const PLACEHOLDER_IMG_SRC = allSettings.placeholderImgSrc as string;
|
2021-04-22 11:37:27 +00:00
|
|
|
export const SITE_TITLE = allSettings.siteTitle;
|
|
|
|
export const STORE_PAGES = allSettings.storePages as Record<
|
|
|
|
string,
|
|
|
|
{
|
|
|
|
id: 0;
|
|
|
|
title: '';
|
|
|
|
permalink: '';
|
|
|
|
}
|
|
|
|
>;
|
|
|
|
export const WC_ASSET_URL = allSettings.wcAssetUrl;
|
|
|
|
export const WC_VERSION = allSettings.wcVersion;
|
|
|
|
export const WP_LOGIN_URL = allSettings.wpLoginUrl;
|
|
|
|
export const WP_VERSION = allSettings.wpVersion;
|
2024-07-12 13:24:22 +00:00
|
|
|
|
|
|
|
// Settings from the server in WooCommerceSiteCurrency format.
|
|
|
|
export const CURRENCY = allSettings.currency;
|
|
|
|
// Convert WooCommerceSiteCurrency format to Currency format.
|
|
|
|
export const SITE_CURRENCY: Currency = {
|
|
|
|
code: CURRENCY.code,
|
|
|
|
symbol: CURRENCY.symbol,
|
|
|
|
thousandSeparator: CURRENCY.thousandSeparator,
|
|
|
|
decimalSeparator: CURRENCY.decimalSeparator,
|
|
|
|
minorUnit: CURRENCY.precision,
|
|
|
|
prefix: getCurrencyPrefix(
|
|
|
|
CURRENCY.symbol,
|
|
|
|
CURRENCY.symbolPosition as SymbolPosition
|
|
|
|
),
|
|
|
|
suffix: getCurrencySuffix(
|
|
|
|
CURRENCY.symbol,
|
|
|
|
CURRENCY.symbolPosition as SymbolPosition
|
|
|
|
),
|
|
|
|
};
|