woocommerce/plugins/woocommerce-blocks/assets/js/settings/shared/settings-init.ts

110 lines
2.6 KiB
TypeScript
Raw Normal View History

/**
* External dependencies
*/
Convert product-elements/price to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7683) * Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * Apply review feedback * Outsource supports section * bot: update checkstyle.xml * Resolve merge conflicts * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * bot: update checkstyle.xml * Empty-Commit * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * Resolve merge conflicts * Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Apply review feedback * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * Empty-Commit * bot: update checkstyle.xml * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * bot: update checkstyle.xml * Empty checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Use BlockAttributes from @wordpress/blocks * Fix TS error * Fix TS errors * Fix TS error Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-12-23 15:30:10 +00:00
import { SymbolPosition, CurrencyCode } from '@woocommerce/types';
Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059) * BLOCK SETTINGS: Remove unused constants/settings * AssetDataRegistry: Helpers to check for settings that exist, and registering page ID/permalinks * Move checkout and cart block settings to checkout and cart blocktypes * Move isShippingCalculatorEnabled to cart block * Remove HAS_DARK_EDITOR_STYLE_SUPPORT and IS_SHIPPING_CALCULATOR_ENABLED in favour of getSetting * Move displayCartPricesIncludingTax to blocktypes, and implement getSetting * Move block settings to core settings and blocktypes * Fix namespace usage * Move review settings * move tag settings * Keep productCount in core data * Move min and default height * Improve storePages code * Move attributes to attribute filter block type * Move $word_count_type outside of settings array * Remove unneeded setting in preview data (shippingCostRequiresAddress) * Move min/max settings dependency from GridLayoutControl to Blocks themselves and use getSettings * DEFAULT_COLUMNS and ROWS to settings * Move product columns/rows to block types * Add grid settings to AllProducts block * Correct default rows * correct min rows default * Move hasDarkEditorStyleSupport * Move hideOutOfStockItems to block type settings * Move build settings to inline script dependency * Pass data through asset api and move restApiRoutes * Export all core settings as constants * Remove WORD_COUNT_TYPE from core settings * Move some other core settings to assets * Update constants * Make settings use TypeScript * Update CURRENT_USER_IS_ADMIN usage * WORD_COUNT_TYPE * REST_API_ROUTES * REVIEW_RATINGS_ENABLED and SHOW_AVATARS * Remove REVIEW_RATINGS_ENABLED and SHOW_AVATARS constants * Remove MIN_HEIGHT * Remove DEFAULT_HEIGHT * PLACEHOLDER_IMG_SRC * LIMIT_TAGS * HAS_PRODUCTS * HOME_URL * HAS_TAGS * COUPONS_ENABLED * SHIPPING_ENABLED * TAXES_ENABLED * DISPLAY_ITEMIZED_TAXES * SHIPPING_COST_REQUIRES_ADDRESS * SHIPPING_STATES and SHIPPING_COUNTRIES * STORE_PAGES * ALLOWED_COUNTRIES * ALLOWED_STATES * SHIPPING_METHODS_EXIST * PAYMENT_GATEWAY_SORT_ORDER * CHECKOUT_SHOW_LOGIN_REMINDER * CHECKOUT_ALLOWS_GUEST and CHECKOUT_ALLOWS_SIGNUP * ATTRIBUTES * DISPLAY_CART_PRICES_INCLUDING_TAX * DISPLAY_CART_PRICES_INCLUDING_TAX * update build for TS files * fix build dir * Move blocks build config params * Move placeholderImgSrc to core settings * Move rest api hydration hoc to shared hocs and provide it restApiRoutes directly to avoid asset data registration * Move wordCountType to abstract block * Remove WORD_COUNT_TYPE in favour of getSetting * Move IS_LARGE_CATALOG and PRODUCT_COUNT to abstract block type and use getSetting inline * Add wcBlocksConfig * fix tests * Remove unused $asset_data_registry * remove console.log * Move build settings to abstract block * Trigger build again * Move hydration back to regular hocs for compatibility with trunk (merge conflict) * Removed wcSharedHocsConfig * esc home url * Update search fixture * Update search snap * 40000 timeout * hasProducts -> productCount * Product Count is part of blocks config * update mocks * Use version comparison to determine if batching is enabled * Change isWpVersion * scrollTo button
2021-04-22 11:37:27 +00:00
declare global {
interface Window {
wcSettings: Record< string, unknown >;
}
}
export interface WooCommerceSiteCurrency {
// The ISO code for the currency.
Convert product-elements/price to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7683) * Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * Apply review feedback * Outsource supports section * bot: update checkstyle.xml * Resolve merge conflicts * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * bot: update checkstyle.xml * Empty-Commit * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * Resolve merge conflicts * Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Apply review feedback * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * Empty-Commit * bot: update checkstyle.xml * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * bot: update checkstyle.xml * Empty checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Use BlockAttributes from @wordpress/blocks * Fix TS error * Fix TS errors * Fix TS error Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-12-23 15:30:10 +00:00
code: CurrencyCode;
Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059) * BLOCK SETTINGS: Remove unused constants/settings * AssetDataRegistry: Helpers to check for settings that exist, and registering page ID/permalinks * Move checkout and cart block settings to checkout and cart blocktypes * Move isShippingCalculatorEnabled to cart block * Remove HAS_DARK_EDITOR_STYLE_SUPPORT and IS_SHIPPING_CALCULATOR_ENABLED in favour of getSetting * Move displayCartPricesIncludingTax to blocktypes, and implement getSetting * Move block settings to core settings and blocktypes * Fix namespace usage * Move review settings * move tag settings * Keep productCount in core data * Move min and default height * Improve storePages code * Move attributes to attribute filter block type * Move $word_count_type outside of settings array * Remove unneeded setting in preview data (shippingCostRequiresAddress) * Move min/max settings dependency from GridLayoutControl to Blocks themselves and use getSettings * DEFAULT_COLUMNS and ROWS to settings * Move product columns/rows to block types * Add grid settings to AllProducts block * Correct default rows * correct min rows default * Move hasDarkEditorStyleSupport * Move hideOutOfStockItems to block type settings * Move build settings to inline script dependency * Pass data through asset api and move restApiRoutes * Export all core settings as constants * Remove WORD_COUNT_TYPE from core settings * Move some other core settings to assets * Update constants * Make settings use TypeScript * Update CURRENT_USER_IS_ADMIN usage * WORD_COUNT_TYPE * REST_API_ROUTES * REVIEW_RATINGS_ENABLED and SHOW_AVATARS * Remove REVIEW_RATINGS_ENABLED and SHOW_AVATARS constants * Remove MIN_HEIGHT * Remove DEFAULT_HEIGHT * PLACEHOLDER_IMG_SRC * LIMIT_TAGS * HAS_PRODUCTS * HOME_URL * HAS_TAGS * COUPONS_ENABLED * SHIPPING_ENABLED * TAXES_ENABLED * DISPLAY_ITEMIZED_TAXES * SHIPPING_COST_REQUIRES_ADDRESS * SHIPPING_STATES and SHIPPING_COUNTRIES * STORE_PAGES * ALLOWED_COUNTRIES * ALLOWED_STATES * SHIPPING_METHODS_EXIST * PAYMENT_GATEWAY_SORT_ORDER * CHECKOUT_SHOW_LOGIN_REMINDER * CHECKOUT_ALLOWS_GUEST and CHECKOUT_ALLOWS_SIGNUP * ATTRIBUTES * DISPLAY_CART_PRICES_INCLUDING_TAX * DISPLAY_CART_PRICES_INCLUDING_TAX * update build for TS files * fix build dir * Move blocks build config params * Move placeholderImgSrc to core settings * Move rest api hydration hoc to shared hocs and provide it restApiRoutes directly to avoid asset data registration * Move wordCountType to abstract block * Remove WORD_COUNT_TYPE in favour of getSetting * Move IS_LARGE_CATALOG and PRODUCT_COUNT to abstract block type and use getSetting inline * Add wcBlocksConfig * fix tests * Remove unused $asset_data_registry * remove console.log * Move build settings to abstract block * Trigger build again * Move hydration back to regular hocs for compatibility with trunk (merge conflict) * Removed wcSharedHocsConfig * esc home url * Update search fixture * Update search snap * 40000 timeout * hasProducts -> productCount * Product Count is part of blocks config * update mocks * Use version comparison to determine if batching is enabled * Change isWpVersion * scrollTo button
2021-04-22 11:37:27 +00:00
// The precision (decimal places).
precision: number;
// The symbol for the currency (eg '$')
symbol: string;
// The position for the symbol ('left', or 'right')
symbolPosition: SymbolPosition;
Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059) * BLOCK SETTINGS: Remove unused constants/settings * AssetDataRegistry: Helpers to check for settings that exist, and registering page ID/permalinks * Move checkout and cart block settings to checkout and cart blocktypes * Move isShippingCalculatorEnabled to cart block * Remove HAS_DARK_EDITOR_STYLE_SUPPORT and IS_SHIPPING_CALCULATOR_ENABLED in favour of getSetting * Move displayCartPricesIncludingTax to blocktypes, and implement getSetting * Move block settings to core settings and blocktypes * Fix namespace usage * Move review settings * move tag settings * Keep productCount in core data * Move min and default height * Improve storePages code * Move attributes to attribute filter block type * Move $word_count_type outside of settings array * Remove unneeded setting in preview data (shippingCostRequiresAddress) * Move min/max settings dependency from GridLayoutControl to Blocks themselves and use getSettings * DEFAULT_COLUMNS and ROWS to settings * Move product columns/rows to block types * Add grid settings to AllProducts block * Correct default rows * correct min rows default * Move hasDarkEditorStyleSupport * Move hideOutOfStockItems to block type settings * Move build settings to inline script dependency * Pass data through asset api and move restApiRoutes * Export all core settings as constants * Remove WORD_COUNT_TYPE from core settings * Move some other core settings to assets * Update constants * Make settings use TypeScript * Update CURRENT_USER_IS_ADMIN usage * WORD_COUNT_TYPE * REST_API_ROUTES * REVIEW_RATINGS_ENABLED and SHOW_AVATARS * Remove REVIEW_RATINGS_ENABLED and SHOW_AVATARS constants * Remove MIN_HEIGHT * Remove DEFAULT_HEIGHT * PLACEHOLDER_IMG_SRC * LIMIT_TAGS * HAS_PRODUCTS * HOME_URL * HAS_TAGS * COUPONS_ENABLED * SHIPPING_ENABLED * TAXES_ENABLED * DISPLAY_ITEMIZED_TAXES * SHIPPING_COST_REQUIRES_ADDRESS * SHIPPING_STATES and SHIPPING_COUNTRIES * STORE_PAGES * ALLOWED_COUNTRIES * ALLOWED_STATES * SHIPPING_METHODS_EXIST * PAYMENT_GATEWAY_SORT_ORDER * CHECKOUT_SHOW_LOGIN_REMINDER * CHECKOUT_ALLOWS_GUEST and CHECKOUT_ALLOWS_SIGNUP * ATTRIBUTES * DISPLAY_CART_PRICES_INCLUDING_TAX * DISPLAY_CART_PRICES_INCLUDING_TAX * update build for TS files * fix build dir * Move blocks build config params * Move placeholderImgSrc to core settings * Move rest api hydration hoc to shared hocs and provide it restApiRoutes directly to avoid asset data registration * Move wordCountType to abstract block * Remove WORD_COUNT_TYPE in favour of getSetting * Move IS_LARGE_CATALOG and PRODUCT_COUNT to abstract block type and use getSetting inline * Add wcBlocksConfig * fix tests * Remove unused $asset_data_registry * remove console.log * Move build settings to abstract block * Trigger build again * Move hydration back to regular hocs for compatibility with trunk (merge conflict) * Removed wcSharedHocsConfig * esc home url * Update search fixture * Update search snap * 40000 timeout * hasProducts -> productCount * Product Count is part of blocks config * update mocks * Use version comparison to determine if batching is enabled * Change isWpVersion * scrollTo button
2021-04-22 11:37:27 +00:00
// The string used for the decimal separator.
decimalSeparator: string;
// The string used for the thousands separator.
thousandSeparator: string;
// The format string use for displaying an amount in this currency.
priceFormat: string;
}
export interface WooCommerceSiteLocale {
// The locale string for the current site.
siteLocale: string;
// The locale string for the current user.
userLocale: string;
// An array of short weekday strings in the current user's locale.
weekdaysShort: string[];
}
export interface WooCommerceSharedSettings {
adminUrl: string;
countries: Record< string, string > | never[];
currency: WooCommerceSiteCurrency;
currentUserId: number;
Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059) * BLOCK SETTINGS: Remove unused constants/settings * AssetDataRegistry: Helpers to check for settings that exist, and registering page ID/permalinks * Move checkout and cart block settings to checkout and cart blocktypes * Move isShippingCalculatorEnabled to cart block * Remove HAS_DARK_EDITOR_STYLE_SUPPORT and IS_SHIPPING_CALCULATOR_ENABLED in favour of getSetting * Move displayCartPricesIncludingTax to blocktypes, and implement getSetting * Move block settings to core settings and blocktypes * Fix namespace usage * Move review settings * move tag settings * Keep productCount in core data * Move min and default height * Improve storePages code * Move attributes to attribute filter block type * Move $word_count_type outside of settings array * Remove unneeded setting in preview data (shippingCostRequiresAddress) * Move min/max settings dependency from GridLayoutControl to Blocks themselves and use getSettings * DEFAULT_COLUMNS and ROWS to settings * Move product columns/rows to block types * Add grid settings to AllProducts block * Correct default rows * correct min rows default * Move hasDarkEditorStyleSupport * Move hideOutOfStockItems to block type settings * Move build settings to inline script dependency * Pass data through asset api and move restApiRoutes * Export all core settings as constants * Remove WORD_COUNT_TYPE from core settings * Move some other core settings to assets * Update constants * Make settings use TypeScript * Update CURRENT_USER_IS_ADMIN usage * WORD_COUNT_TYPE * REST_API_ROUTES * REVIEW_RATINGS_ENABLED and SHOW_AVATARS * Remove REVIEW_RATINGS_ENABLED and SHOW_AVATARS constants * Remove MIN_HEIGHT * Remove DEFAULT_HEIGHT * PLACEHOLDER_IMG_SRC * LIMIT_TAGS * HAS_PRODUCTS * HOME_URL * HAS_TAGS * COUPONS_ENABLED * SHIPPING_ENABLED * TAXES_ENABLED * DISPLAY_ITEMIZED_TAXES * SHIPPING_COST_REQUIRES_ADDRESS * SHIPPING_STATES and SHIPPING_COUNTRIES * STORE_PAGES * ALLOWED_COUNTRIES * ALLOWED_STATES * SHIPPING_METHODS_EXIST * PAYMENT_GATEWAY_SORT_ORDER * CHECKOUT_SHOW_LOGIN_REMINDER * CHECKOUT_ALLOWS_GUEST and CHECKOUT_ALLOWS_SIGNUP * ATTRIBUTES * DISPLAY_CART_PRICES_INCLUDING_TAX * DISPLAY_CART_PRICES_INCLUDING_TAX * update build for TS files * fix build dir * Move blocks build config params * Move placeholderImgSrc to core settings * Move rest api hydration hoc to shared hocs and provide it restApiRoutes directly to avoid asset data registration * Move wordCountType to abstract block * Remove WORD_COUNT_TYPE in favour of getSetting * Move IS_LARGE_CATALOG and PRODUCT_COUNT to abstract block type and use getSetting inline * Add wcBlocksConfig * fix tests * Remove unused $asset_data_registry * remove console.log * Move build settings to abstract block * Trigger build again * Move hydration back to regular hocs for compatibility with trunk (merge conflict) * Removed wcSharedHocsConfig * esc home url * Update search fixture * Update search snap * 40000 timeout * hasProducts -> productCount * Product Count is part of blocks config * update mocks * Use version comparison to determine if batching is enabled * Change isWpVersion * scrollTo button
2021-04-22 11:37:27 +00:00
currentUserIsAdmin: boolean;
homeUrl: string;
locale: WooCommerceSiteLocale;
orderStatuses: Record< string, string > | never[];
placeholderImgSrc: string;
siteTitle: string;
storePages: Record< string, string > | never[];
wcAssetUrl: string;
wcVersion: string;
wpLoginUrl: string;
wpVersion: string;
}
const defaults: WooCommerceSharedSettings = {
adminUrl: '',
countries: [],
currency: {
code: 'USD',
precision: 2,
symbol: '$',
symbolPosition: 'left',
decimalSeparator: '.',
priceFormat: '%1$s%2$s',
thousandSeparator: ',',
},
currentUserId: 0,
Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059) * BLOCK SETTINGS: Remove unused constants/settings * AssetDataRegistry: Helpers to check for settings that exist, and registering page ID/permalinks * Move checkout and cart block settings to checkout and cart blocktypes * Move isShippingCalculatorEnabled to cart block * Remove HAS_DARK_EDITOR_STYLE_SUPPORT and IS_SHIPPING_CALCULATOR_ENABLED in favour of getSetting * Move displayCartPricesIncludingTax to blocktypes, and implement getSetting * Move block settings to core settings and blocktypes * Fix namespace usage * Move review settings * move tag settings * Keep productCount in core data * Move min and default height * Improve storePages code * Move attributes to attribute filter block type * Move $word_count_type outside of settings array * Remove unneeded setting in preview data (shippingCostRequiresAddress) * Move min/max settings dependency from GridLayoutControl to Blocks themselves and use getSettings * DEFAULT_COLUMNS and ROWS to settings * Move product columns/rows to block types * Add grid settings to AllProducts block * Correct default rows * correct min rows default * Move hasDarkEditorStyleSupport * Move hideOutOfStockItems to block type settings * Move build settings to inline script dependency * Pass data through asset api and move restApiRoutes * Export all core settings as constants * Remove WORD_COUNT_TYPE from core settings * Move some other core settings to assets * Update constants * Make settings use TypeScript * Update CURRENT_USER_IS_ADMIN usage * WORD_COUNT_TYPE * REST_API_ROUTES * REVIEW_RATINGS_ENABLED and SHOW_AVATARS * Remove REVIEW_RATINGS_ENABLED and SHOW_AVATARS constants * Remove MIN_HEIGHT * Remove DEFAULT_HEIGHT * PLACEHOLDER_IMG_SRC * LIMIT_TAGS * HAS_PRODUCTS * HOME_URL * HAS_TAGS * COUPONS_ENABLED * SHIPPING_ENABLED * TAXES_ENABLED * DISPLAY_ITEMIZED_TAXES * SHIPPING_COST_REQUIRES_ADDRESS * SHIPPING_STATES and SHIPPING_COUNTRIES * STORE_PAGES * ALLOWED_COUNTRIES * ALLOWED_STATES * SHIPPING_METHODS_EXIST * PAYMENT_GATEWAY_SORT_ORDER * CHECKOUT_SHOW_LOGIN_REMINDER * CHECKOUT_ALLOWS_GUEST and CHECKOUT_ALLOWS_SIGNUP * ATTRIBUTES * DISPLAY_CART_PRICES_INCLUDING_TAX * DISPLAY_CART_PRICES_INCLUDING_TAX * update build for TS files * fix build dir * Move blocks build config params * Move placeholderImgSrc to core settings * Move rest api hydration hoc to shared hocs and provide it restApiRoutes directly to avoid asset data registration * Move wordCountType to abstract block * Remove WORD_COUNT_TYPE in favour of getSetting * Move IS_LARGE_CATALOG and PRODUCT_COUNT to abstract block type and use getSetting inline * Add wcBlocksConfig * fix tests * Remove unused $asset_data_registry * remove console.log * Move build settings to abstract block * Trigger build again * Move hydration back to regular hocs for compatibility with trunk (merge conflict) * Removed wcSharedHocsConfig * esc home url * Update search fixture * Update search snap * 40000 timeout * hasProducts -> productCount * Product Count is part of blocks config * update mocks * Use version comparison to determine if batching is enabled * Change isWpVersion * scrollTo button
2021-04-22 11:37:27 +00:00
currentUserIsAdmin: false,
homeUrl: '',
locale: {
siteLocale: 'en_US',
userLocale: 'en_US',
weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
},
orderStatuses: [],
placeholderImgSrc: '',
siteTitle: '',
storePages: [],
wcAssetUrl: '',
wcVersion: '',
wpLoginUrl: '',
wpVersion: '',
};
const globalSharedSettings =
typeof window.wcSettings === 'object' ? window.wcSettings : {};
Convert product-elements/price to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7683) * Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * Apply review feedback * Outsource supports section * bot: update checkstyle.xml * Resolve merge conflicts * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * bot: update checkstyle.xml * Empty-Commit * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * Resolve merge conflicts * Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Apply review feedback * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * Empty-Commit * bot: update checkstyle.xml * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * bot: update checkstyle.xml * Empty checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Use BlockAttributes from @wordpress/blocks * Fix TS error * Fix TS errors * Fix TS error Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-12-23 15:30:10 +00:00
interface AllSettings extends Record< string, unknown > {
currency: WooCommerceSiteCurrency;
}
Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059) * BLOCK SETTINGS: Remove unused constants/settings * AssetDataRegistry: Helpers to check for settings that exist, and registering page ID/permalinks * Move checkout and cart block settings to checkout and cart blocktypes * Move isShippingCalculatorEnabled to cart block * Remove HAS_DARK_EDITOR_STYLE_SUPPORT and IS_SHIPPING_CALCULATOR_ENABLED in favour of getSetting * Move displayCartPricesIncludingTax to blocktypes, and implement getSetting * Move block settings to core settings and blocktypes * Fix namespace usage * Move review settings * move tag settings * Keep productCount in core data * Move min and default height * Improve storePages code * Move attributes to attribute filter block type * Move $word_count_type outside of settings array * Remove unneeded setting in preview data (shippingCostRequiresAddress) * Move min/max settings dependency from GridLayoutControl to Blocks themselves and use getSettings * DEFAULT_COLUMNS and ROWS to settings * Move product columns/rows to block types * Add grid settings to AllProducts block * Correct default rows * correct min rows default * Move hasDarkEditorStyleSupport * Move hideOutOfStockItems to block type settings * Move build settings to inline script dependency * Pass data through asset api and move restApiRoutes * Export all core settings as constants * Remove WORD_COUNT_TYPE from core settings * Move some other core settings to assets * Update constants * Make settings use TypeScript * Update CURRENT_USER_IS_ADMIN usage * WORD_COUNT_TYPE * REST_API_ROUTES * REVIEW_RATINGS_ENABLED and SHOW_AVATARS * Remove REVIEW_RATINGS_ENABLED and SHOW_AVATARS constants * Remove MIN_HEIGHT * Remove DEFAULT_HEIGHT * PLACEHOLDER_IMG_SRC * LIMIT_TAGS * HAS_PRODUCTS * HOME_URL * HAS_TAGS * COUPONS_ENABLED * SHIPPING_ENABLED * TAXES_ENABLED * DISPLAY_ITEMIZED_TAXES * SHIPPING_COST_REQUIRES_ADDRESS * SHIPPING_STATES and SHIPPING_COUNTRIES * STORE_PAGES * ALLOWED_COUNTRIES * ALLOWED_STATES * SHIPPING_METHODS_EXIST * PAYMENT_GATEWAY_SORT_ORDER * CHECKOUT_SHOW_LOGIN_REMINDER * CHECKOUT_ALLOWS_GUEST and CHECKOUT_ALLOWS_SIGNUP * ATTRIBUTES * DISPLAY_CART_PRICES_INCLUDING_TAX * DISPLAY_CART_PRICES_INCLUDING_TAX * update build for TS files * fix build dir * Move blocks build config params * Move placeholderImgSrc to core settings * Move rest api hydration hoc to shared hocs and provide it restApiRoutes directly to avoid asset data registration * Move wordCountType to abstract block * Remove WORD_COUNT_TYPE in favour of getSetting * Move IS_LARGE_CATALOG and PRODUCT_COUNT to abstract block type and use getSetting inline * Add wcBlocksConfig * fix tests * Remove unused $asset_data_registry * remove console.log * Move build settings to abstract block * Trigger build again * Move hydration back to regular hocs for compatibility with trunk (merge conflict) * Removed wcSharedHocsConfig * esc home url * Update search fixture * Update search snap * 40000 timeout * hasProducts -> productCount * Product Count is part of blocks config * update mocks * Use version comparison to determine if batching is enabled * Change isWpVersion * scrollTo button
2021-04-22 11:37:27 +00:00
// Use defaults or global settings, depending on what is set.
Convert product-elements/price to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7683) * Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * Apply review feedback * Outsource supports section * bot: update checkstyle.xml * Resolve merge conflicts * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * bot: update checkstyle.xml * Empty-Commit * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * Resolve merge conflicts * Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Apply review feedback * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * Empty-Commit * bot: update checkstyle.xml * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * bot: update checkstyle.xml * Empty checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Use BlockAttributes from @wordpress/blocks * Fix TS error * Fix TS errors * Fix TS error Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-12-23 15:30:10 +00:00
const allSettings: AllSettings = {
Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059) * BLOCK SETTINGS: Remove unused constants/settings * AssetDataRegistry: Helpers to check for settings that exist, and registering page ID/permalinks * Move checkout and cart block settings to checkout and cart blocktypes * Move isShippingCalculatorEnabled to cart block * Remove HAS_DARK_EDITOR_STYLE_SUPPORT and IS_SHIPPING_CALCULATOR_ENABLED in favour of getSetting * Move displayCartPricesIncludingTax to blocktypes, and implement getSetting * Move block settings to core settings and blocktypes * Fix namespace usage * Move review settings * move tag settings * Keep productCount in core data * Move min and default height * Improve storePages code * Move attributes to attribute filter block type * Move $word_count_type outside of settings array * Remove unneeded setting in preview data (shippingCostRequiresAddress) * Move min/max settings dependency from GridLayoutControl to Blocks themselves and use getSettings * DEFAULT_COLUMNS and ROWS to settings * Move product columns/rows to block types * Add grid settings to AllProducts block * Correct default rows * correct min rows default * Move hasDarkEditorStyleSupport * Move hideOutOfStockItems to block type settings * Move build settings to inline script dependency * Pass data through asset api and move restApiRoutes * Export all core settings as constants * Remove WORD_COUNT_TYPE from core settings * Move some other core settings to assets * Update constants * Make settings use TypeScript * Update CURRENT_USER_IS_ADMIN usage * WORD_COUNT_TYPE * REST_API_ROUTES * REVIEW_RATINGS_ENABLED and SHOW_AVATARS * Remove REVIEW_RATINGS_ENABLED and SHOW_AVATARS constants * Remove MIN_HEIGHT * Remove DEFAULT_HEIGHT * PLACEHOLDER_IMG_SRC * LIMIT_TAGS * HAS_PRODUCTS * HOME_URL * HAS_TAGS * COUPONS_ENABLED * SHIPPING_ENABLED * TAXES_ENABLED * DISPLAY_ITEMIZED_TAXES * SHIPPING_COST_REQUIRES_ADDRESS * SHIPPING_STATES and SHIPPING_COUNTRIES * STORE_PAGES * ALLOWED_COUNTRIES * ALLOWED_STATES * SHIPPING_METHODS_EXIST * PAYMENT_GATEWAY_SORT_ORDER * CHECKOUT_SHOW_LOGIN_REMINDER * CHECKOUT_ALLOWS_GUEST and CHECKOUT_ALLOWS_SIGNUP * ATTRIBUTES * DISPLAY_CART_PRICES_INCLUDING_TAX * DISPLAY_CART_PRICES_INCLUDING_TAX * update build for TS files * fix build dir * Move blocks build config params * Move placeholderImgSrc to core settings * Move rest api hydration hoc to shared hocs and provide it restApiRoutes directly to avoid asset data registration * Move wordCountType to abstract block * Remove WORD_COUNT_TYPE in favour of getSetting * Move IS_LARGE_CATALOG and PRODUCT_COUNT to abstract block type and use getSetting inline * Add wcBlocksConfig * fix tests * Remove unused $asset_data_registry * remove console.log * Move build settings to abstract block * Trigger build again * Move hydration back to regular hocs for compatibility with trunk (merge conflict) * Removed wcSharedHocsConfig * esc home url * Update search fixture * Update search snap * 40000 timeout * hasProducts -> productCount * Product Count is part of blocks config * update mocks * Use version comparison to determine if batching is enabled * Change isWpVersion * scrollTo button
2021-04-22 11:37:27 +00:00
...defaults,
...globalSharedSettings,
};
allSettings.currency = {
...defaults.currency,
Convert product-elements/price to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7683) * Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * Apply review feedback * Outsource supports section * bot: update checkstyle.xml * Resolve merge conflicts * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * bot: update checkstyle.xml * Empty-Commit * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * Resolve merge conflicts * Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Apply review feedback * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * Empty-Commit * bot: update checkstyle.xml * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * bot: update checkstyle.xml * Empty checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Use BlockAttributes from @wordpress/blocks * Fix TS error * Fix TS errors * Fix TS error Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-12-23 15:30:10 +00:00
...( allSettings.currency as WooCommerceSiteCurrency ),
Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059) * BLOCK SETTINGS: Remove unused constants/settings * AssetDataRegistry: Helpers to check for settings that exist, and registering page ID/permalinks * Move checkout and cart block settings to checkout and cart blocktypes * Move isShippingCalculatorEnabled to cart block * Remove HAS_DARK_EDITOR_STYLE_SUPPORT and IS_SHIPPING_CALCULATOR_ENABLED in favour of getSetting * Move displayCartPricesIncludingTax to blocktypes, and implement getSetting * Move block settings to core settings and blocktypes * Fix namespace usage * Move review settings * move tag settings * Keep productCount in core data * Move min and default height * Improve storePages code * Move attributes to attribute filter block type * Move $word_count_type outside of settings array * Remove unneeded setting in preview data (shippingCostRequiresAddress) * Move min/max settings dependency from GridLayoutControl to Blocks themselves and use getSettings * DEFAULT_COLUMNS and ROWS to settings * Move product columns/rows to block types * Add grid settings to AllProducts block * Correct default rows * correct min rows default * Move hasDarkEditorStyleSupport * Move hideOutOfStockItems to block type settings * Move build settings to inline script dependency * Pass data through asset api and move restApiRoutes * Export all core settings as constants * Remove WORD_COUNT_TYPE from core settings * Move some other core settings to assets * Update constants * Make settings use TypeScript * Update CURRENT_USER_IS_ADMIN usage * WORD_COUNT_TYPE * REST_API_ROUTES * REVIEW_RATINGS_ENABLED and SHOW_AVATARS * Remove REVIEW_RATINGS_ENABLED and SHOW_AVATARS constants * Remove MIN_HEIGHT * Remove DEFAULT_HEIGHT * PLACEHOLDER_IMG_SRC * LIMIT_TAGS * HAS_PRODUCTS * HOME_URL * HAS_TAGS * COUPONS_ENABLED * SHIPPING_ENABLED * TAXES_ENABLED * DISPLAY_ITEMIZED_TAXES * SHIPPING_COST_REQUIRES_ADDRESS * SHIPPING_STATES and SHIPPING_COUNTRIES * STORE_PAGES * ALLOWED_COUNTRIES * ALLOWED_STATES * SHIPPING_METHODS_EXIST * PAYMENT_GATEWAY_SORT_ORDER * CHECKOUT_SHOW_LOGIN_REMINDER * CHECKOUT_ALLOWS_GUEST and CHECKOUT_ALLOWS_SIGNUP * ATTRIBUTES * DISPLAY_CART_PRICES_INCLUDING_TAX * DISPLAY_CART_PRICES_INCLUDING_TAX * update build for TS files * fix build dir * Move blocks build config params * Move placeholderImgSrc to core settings * Move rest api hydration hoc to shared hocs and provide it restApiRoutes directly to avoid asset data registration * Move wordCountType to abstract block * Remove WORD_COUNT_TYPE in favour of getSetting * Move IS_LARGE_CATALOG and PRODUCT_COUNT to abstract block type and use getSetting inline * Add wcBlocksConfig * fix tests * Remove unused $asset_data_registry * remove console.log * Move build settings to abstract block * Trigger build again * Move hydration back to regular hocs for compatibility with trunk (merge conflict) * Removed wcSharedHocsConfig * esc home url * Update search fixture * Update search snap * 40000 timeout * hasProducts -> productCount * Product Count is part of blocks config * update mocks * Use version comparison to determine if batching is enabled * Change isWpVersion * scrollTo button
2021-04-22 11:37:27 +00:00
};
allSettings.locale = {
...defaults.locale,
...( allSettings.locale as Record< string, unknown > ),
};
export { allSettings };