rebase on oct-10-2023
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import { registerPaymentMethod } from '@woocommerce/blocks-registry';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { getSetting } from '@woocommerce/settings';
|
||||
import { getPaymentMethodData } from '@woocommerce/settings';
|
||||
import { decodeEntities } from '@wordpress/html-entities';
|
||||
|
||||
/**
|
||||
@@ -11,12 +11,12 @@ import { decodeEntities } from '@wordpress/html-entities';
|
||||
*/
|
||||
import { PAYMENT_METHOD_NAME } from './constants';
|
||||
|
||||
const settings = getSetting( 'bacs_data', {} );
|
||||
const settings = getPaymentMethodData( 'bacs', {} );
|
||||
const defaultLabel = __(
|
||||
'Direct bank transfer',
|
||||
'woocommerce'
|
||||
);
|
||||
const label = decodeEntities( settings.title ) || defaultLabel;
|
||||
const label = decodeEntities( settings?.title || '' ) || defaultLabel;
|
||||
|
||||
/**
|
||||
* Content component
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import { registerPaymentMethod } from '@woocommerce/blocks-registry';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { getSetting } from '@woocommerce/settings';
|
||||
import { getPaymentMethodData } from '@woocommerce/settings';
|
||||
import { decodeEntities } from '@wordpress/html-entities';
|
||||
|
||||
/**
|
||||
@@ -11,9 +11,9 @@ import { decodeEntities } from '@wordpress/html-entities';
|
||||
*/
|
||||
import { PAYMENT_METHOD_NAME } from './constants';
|
||||
|
||||
const settings = getSetting( 'cheque_data', {} );
|
||||
const settings = getPaymentMethodData( 'cheque', {} );
|
||||
const defaultLabel = __( 'Check payment', 'woocommerce' );
|
||||
const label = decodeEntities( settings.title ) || defaultLabel;
|
||||
const label = decodeEntities( settings?.title || '' ) || defaultLabel;
|
||||
|
||||
/**
|
||||
* Content component
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import { registerPaymentMethod } from '@woocommerce/blocks-registry';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { getSetting } from '@woocommerce/settings';
|
||||
import { getPaymentMethodData } from '@woocommerce/settings';
|
||||
import { decodeEntities } from '@wordpress/html-entities';
|
||||
|
||||
/**
|
||||
@@ -11,9 +11,9 @@ import { decodeEntities } from '@wordpress/html-entities';
|
||||
*/
|
||||
import { PAYMENT_METHOD_NAME } from './constants';
|
||||
|
||||
const settings = getSetting( 'cod_data', {} );
|
||||
const settings = getPaymentMethodData( 'cod', {} );
|
||||
const defaultLabel = __( 'Cash on delivery', 'woocommerce' );
|
||||
const label = decodeEntities( settings.title ) || defaultLabel;
|
||||
const label = decodeEntities( settings?.title || '' ) || defaultLabel;
|
||||
|
||||
/**
|
||||
* Content component
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import { registerPaymentMethod } from '@woocommerce/blocks-registry';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { getSetting, WC_ASSET_URL } from '@woocommerce/settings';
|
||||
import { getPaymentMethodData, WC_ASSET_URL } from '@woocommerce/settings';
|
||||
import { decodeEntities } from '@wordpress/html-entities';
|
||||
|
||||
/**
|
||||
@@ -11,7 +11,7 @@ import { decodeEntities } from '@wordpress/html-entities';
|
||||
*/
|
||||
import { PAYMENT_METHOD_NAME } from './constants';
|
||||
|
||||
const settings = getSetting( 'paypal_data', {} );
|
||||
const settings = getPaymentMethodData( 'paypal', {} );
|
||||
|
||||
/**
|
||||
* Content component
|
||||
@@ -38,7 +38,7 @@ const paypalPaymentMethod = {
|
||||
edit: <Content />,
|
||||
canMakePayment: () => true,
|
||||
ariaLabel: decodeEntities(
|
||||
settings.title ||
|
||||
settings?.title ||
|
||||
__( 'Payment via PayPal', 'woocommerce' )
|
||||
),
|
||||
supports: {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { createInterpolateElement, useState } from '@wordpress/element';
|
||||
import { ADMIN_URL } from '@woocommerce/settings';
|
||||
import { ADMIN_URL, getSetting } from '@woocommerce/settings';
|
||||
import { CHECKOUT_PAGE_ID } from '@woocommerce/block-settings';
|
||||
import {
|
||||
CheckboxControl,
|
||||
@@ -47,6 +47,11 @@ const GeneralSettings = () => {
|
||||
useSettingsContext();
|
||||
const [ showCosts, setShowCosts ] = useState( !! settings.cost );
|
||||
|
||||
const shippingCostRequiresAddress = getSetting< boolean >(
|
||||
'shippingCostRequiresAddress',
|
||||
false
|
||||
);
|
||||
|
||||
return (
|
||||
<SettingsSection Description={ GeneralSettingsDescription }>
|
||||
<SettingsCard>
|
||||
@@ -78,10 +83,23 @@ const GeneralSettings = () => {
|
||||
'Enable local pickup',
|
||||
'woo-gutenberg-products-block'
|
||||
) }
|
||||
help={ __(
|
||||
'When enabled, local pickup will appear as an option on the block based checkout.',
|
||||
'woo-gutenberg-products-block'
|
||||
) }
|
||||
help={
|
||||
<span>
|
||||
{ __(
|
||||
'When enabled, local pickup will appear as an option on the block based checkout.',
|
||||
'woo-gutenberg-products-block'
|
||||
) }
|
||||
{ shippingCostRequiresAddress ? (
|
||||
<>
|
||||
<br />
|
||||
{ __(
|
||||
'If local pickup is enabled, the "Hide shipping costs until an address is entered" setting will be ignored.',
|
||||
'woo-gutenberg-products-block'
|
||||
) }
|
||||
</>
|
||||
) : null }
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
<TextControl
|
||||
label={ __( 'Title', 'woo-gutenberg-products-block' ) }
|
||||
|
||||
@@ -12,7 +12,7 @@ import type { UniqueIdentifier } from '@dnd-kit/core';
|
||||
import apiFetch from '@wordpress/api-fetch';
|
||||
import { dispatch } from '@wordpress/data';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { isEqual } from 'lodash';
|
||||
import fastDeepEqual from 'fast-deep-equal/es6';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
@@ -139,11 +139,14 @@ export const SettingsProvider = ( {
|
||||
} ).then( ( response ) => {
|
||||
setIsSaving( false );
|
||||
if (
|
||||
isEqual(
|
||||
fastDeepEqual(
|
||||
response.pickup_location_settings,
|
||||
data.pickup_location_settings
|
||||
) &&
|
||||
isEqual( response.pickup_locations, data.pickup_locations )
|
||||
fastDeepEqual(
|
||||
response.pickup_locations,
|
||||
data.pickup_locations
|
||||
)
|
||||
) {
|
||||
dispatch( 'core/notices' ).createSuccessNotice(
|
||||
__(
|
||||
|
||||
Reference in New Issue
Block a user