mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
♻️ Rename actions for better semantics
This commit is contained in:
parent
da96c084ab
commit
1e26852aa1
3 changed files with 14 additions and 14 deletions
|
@ -150,7 +150,7 @@ export const persist = function* () {
|
|||
*
|
||||
* @return {Action} The action.
|
||||
*/
|
||||
export const connectToSandbox = function* () {
|
||||
export const sandboxOnboardingUrl = function* () {
|
||||
return yield {
|
||||
type: ACTION_TYPES.DO_GENERATE_ONBOARDING_URL,
|
||||
environment: 'sandbox',
|
||||
|
@ -164,7 +164,7 @@ export const connectToSandbox = function* () {
|
|||
* @param {string[]} products Which products/features to display in the ISU popup.
|
||||
* @return {Action} The action.
|
||||
*/
|
||||
export const connectToProduction = function* ( products = [] ) {
|
||||
export const productionOnboardingUrl = function* ( products = [] ) {
|
||||
return yield {
|
||||
type: ACTION_TYPES.DO_GENERATE_ONBOARDING_URL,
|
||||
environment: 'production',
|
||||
|
|
|
@ -31,8 +31,8 @@ const useHooks = () => {
|
|||
setManualConnectionMode,
|
||||
setClientId,
|
||||
setClientSecret,
|
||||
connectToSandbox,
|
||||
connectToProduction,
|
||||
sandboxOnboardingUrl,
|
||||
productionOnboardingUrl,
|
||||
connectViaIdAndSecret,
|
||||
} = useDispatch( STORE_NAME );
|
||||
|
||||
|
@ -77,8 +77,8 @@ const useHooks = () => {
|
|||
setClientSecret: ( value ) => {
|
||||
return savePersistent( setClientSecret, value );
|
||||
},
|
||||
connectToSandbox,
|
||||
connectToProduction,
|
||||
sandboxOnboardingUrl,
|
||||
productionOnboardingUrl,
|
||||
connectViaIdAndSecret,
|
||||
merchant,
|
||||
wooSettings,
|
||||
|
@ -86,15 +86,15 @@ const useHooks = () => {
|
|||
};
|
||||
|
||||
export const useSandbox = () => {
|
||||
const { isSandboxMode, setSandboxMode, connectToSandbox } = useHooks();
|
||||
const { isSandboxMode, setSandboxMode, sandboxOnboardingUrl } = useHooks();
|
||||
|
||||
return { isSandboxMode, setSandboxMode, connectToSandbox };
|
||||
return { isSandboxMode, setSandboxMode, sandboxOnboardingUrl };
|
||||
};
|
||||
|
||||
export const useProduction = () => {
|
||||
const { connectToProduction } = useHooks();
|
||||
const { productionOnboardingUrl } = useHooks();
|
||||
|
||||
return { connectToProduction };
|
||||
return { productionOnboardingUrl };
|
||||
};
|
||||
|
||||
export const useManualConnection = () => {
|
||||
|
|
|
@ -118,11 +118,11 @@ const useConnectionAttempt = ( connectFn, errorMessage ) => {
|
|||
};
|
||||
|
||||
export const useSandboxConnection = () => {
|
||||
const { connectToSandbox, isSandboxMode, setSandboxMode } =
|
||||
const { sandboxOnboardingUrl, isSandboxMode, setSandboxMode } =
|
||||
CommonHooks.useSandbox();
|
||||
const { withActivity } = CommonHooks.useBusyState();
|
||||
const connectionAttempt = useConnectionAttempt(
|
||||
connectToSandbox,
|
||||
sandboxOnboardingUrl,
|
||||
MESSAGES.SANDBOX_ERROR
|
||||
);
|
||||
|
||||
|
@ -142,11 +142,11 @@ export const useSandboxConnection = () => {
|
|||
};
|
||||
|
||||
export const useProductionConnection = () => {
|
||||
const { connectToProduction } = CommonHooks.useProduction();
|
||||
const { productionOnboardingUrl } = CommonHooks.useProduction();
|
||||
const { withActivity } = CommonHooks.useBusyState();
|
||||
const products = OnboardingHooks.useDetermineProducts();
|
||||
const connectionAttempt = useConnectionAttempt(
|
||||
() => connectToProduction( products ),
|
||||
() => productionOnboardingUrl( products ),
|
||||
MESSAGES.PRODUCTION_ERROR
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue