Add can use Fastlane flag and pass it to welcome docs component

This commit is contained in:
Emili Castells Guasch 2025-02-26 15:19:42 +01:00
parent 63b3c8a113
commit 109e6517f0
5 changed files with 12 additions and 4 deletions

View file

@ -12,7 +12,7 @@ import AdvancedOptionsForm from '../Components/AdvancedOptionsForm';
const StepWelcome = ( { setStep, currentStep } ) => { const StepWelcome = ( { setStep, currentStep } ) => {
const { storeCountry } = CommonHooks.useWooSettings(); const { storeCountry } = CommonHooks.useWooSettings();
const { canUseCardPayments } = OnboardingHooks.useFlags(); const { canUseCardPayments, canUseFastlane } = OnboardingHooks.useFlags();
const nonAcdcIcons = [ 'paypal', 'visa', 'mastercard', 'amex', 'discover' ]; const nonAcdcIcons = [ 'paypal', 'visa', 'mastercard', 'amex', 'discover' ];
return ( return (
@ -54,7 +54,7 @@ const StepWelcome = ( { setStep, currentStep } ) => {
<Separator className="ppcp-r-page-welcome-mode-separator" /> <Separator className="ppcp-r-page-welcome-mode-separator" />
<WelcomeDocs <WelcomeDocs
useAcdc={ canUseCardPayments } useAcdc={ canUseCardPayments }
isFastlane={ true } isFastlane={ canUseFastlane }
isPayLater={ true } isPayLater={ true }
storeCountry={ storeCountry } storeCountry={ storeCountry }
/> />

View file

@ -24,6 +24,7 @@ const defaultTransient = Object.freeze( {
canUseCardPayments: false, canUseCardPayments: false,
canUseSubscriptions: false, canUseSubscriptions: false,
shouldSkipPaymentMethods: false, shouldSkipPaymentMethods: false,
canUseFastlane: false,
} ), } ),
} ); } );

View file

@ -69,13 +69,15 @@ return array(
$can_use_subscriptions = $container->has( 'wc-subscriptions.helper' ) && $container->get( 'wc-subscriptions.helper' ) $can_use_subscriptions = $container->has( 'wc-subscriptions.helper' ) && $container->get( 'wc-subscriptions.helper' )
->plugin_is_active(); ->plugin_is_active();
$should_skip_payment_methods = class_exists( '\WC_Payments' ); $should_skip_payment_methods = class_exists( '\WC_Payments' );
$can_use_fastlane = $container->get( 'axo.eligible' );
return new OnboardingProfile( return new OnboardingProfile(
$can_use_casual_selling, $can_use_casual_selling,
$can_use_vaulting, $can_use_vaulting,
$can_use_card_payments, $can_use_card_payments,
$can_use_subscriptions, $can_use_subscriptions,
$should_skip_payment_methods $should_skip_payment_methods,
$can_use_fastlane
); );
}, },
'settings.data.general' => static function ( ContainerInterface $container ) : GeneralSettings { 'settings.data.general' => static function ( ContainerInterface $container ) : GeneralSettings {

View file

@ -52,7 +52,8 @@ class OnboardingProfile extends AbstractDataModel {
bool $can_use_vaulting = false, bool $can_use_vaulting = false,
bool $can_use_card_payments = false, bool $can_use_card_payments = false,
bool $can_use_subscriptions = false, bool $can_use_subscriptions = false,
bool $should_skip_payment_methods = false bool $should_skip_payment_methods = false,
bool $can_use_fastlane = false
) { ) {
parent::__construct(); parent::__construct();
@ -61,6 +62,7 @@ class OnboardingProfile extends AbstractDataModel {
$this->flags['can_use_card_payments'] = $can_use_card_payments; $this->flags['can_use_card_payments'] = $can_use_card_payments;
$this->flags['can_use_subscriptions'] = $can_use_subscriptions; $this->flags['can_use_subscriptions'] = $can_use_subscriptions;
$this->flags['should_skip_payment_methods'] = $should_skip_payment_methods; $this->flags['should_skip_payment_methods'] = $should_skip_payment_methods;
$this->flags['can_use_fastlane'] = $can_use_fastlane;
} }
/** /**

View file

@ -83,6 +83,9 @@ class OnboardingRestEndpoint extends RestEndpoint {
'should_skip_payment_methods' => array( 'should_skip_payment_methods' => array(
'js_name' => 'shouldSkipPaymentMethods', 'js_name' => 'shouldSkipPaymentMethods',
), ),
'can_use_fastlane' => array(
'js_name' => 'canUseFastlane',
),
); );
/** /**