Skip to content

Commit

Permalink
Considering feature flag value when displaying the setting
Browse files Browse the repository at this point in the history
  • Loading branch information
wjrosa committed Feb 26, 2025
1 parent b9c8241 commit 4a4a8d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion client/settings/advanced-settings-section/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global wc_stripe_settings_params */
import { __ } from '@wordpress/i18n';
import React from 'react';
import { Card } from '@wordpress/components';
Expand All @@ -21,14 +22,15 @@ const AdvancedSettingsDescription = () => (
);

const AdvancedSettings = () => {
const isSpeAvailable = wc_stripe_settings_params.is_spe_available; // eslint-disable-line camelcase
return (
<SettingsSection Description={ AdvancedSettingsDescription }>
<LoadableSettingsSection numLines={ 10 }>
<Card>
<CardBody>
<DebugMode />
<ExperimentalFeatures />
<SinglePaymentElementFeature />
{ isSpeAvailable && <SinglePaymentElementFeature /> }
</CardBody>
</Card>
</LoadableSettingsSection>
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-wc-stripe-settings-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function admin_scripts( $hook_suffix ) {
'account_country' => $this->account->get_account_country(),
'are_apms_deprecated' => WC_Stripe_Feature_Flags::are_apms_deprecated(),
'is_amazon_pay_available' => WC_Stripe_Feature_Flags::is_amazon_pay_available(),
'is_spe_enabled' => WC_Stripe_Feature_Flags::is_spe_enabled(),
'is_spe_available' => WC_Stripe_Feature_Flags::is_spe_available(),
'oauth_nonce' => wp_create_nonce( 'wc_stripe_get_oauth_urls' ),
];
wp_localize_script(
Expand Down
3 changes: 2 additions & 1 deletion includes/class-wc-stripe-feature-flags.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class WC_Stripe_Feature_Flags {
'_wcstripe_feature_upe' => 'yes',
self::ECE_FEATURE_FLAG_NAME => 'yes',
self::AMAZON_PAY_FEATURE_FLAG_NAME => 'no',
self::SPE_FEATURE_FLAG_NAME => 'no',
self::LPM_ACH_FEATURE_FLAG_NAME => 'no',
self::LPM_ACSS_FEATURE_FLAG_NAME => 'no',
self::LPM_BACS_FEATURE_FLAG_NAME => 'no',
Expand Down Expand Up @@ -143,7 +144,7 @@ public static function are_apms_deprecated() {
*
* @return bool
*/
public static function is_spe_enabled() {
public static function is_spe_available() {
return 'yes' === self::get_option_with_default( self::SPE_FEATURE_FLAG_NAME );
}
}

0 comments on commit 4a4a8d8

Please sign in to comment.