Skip to content

Commit

Permalink
use constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayisha committed Nov 5, 2024
1 parent 28b7bb3 commit 1add408
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion client/settings/payment-methods/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PaymentRequestSection from '../payment-request-section';
import GeneralSettingsSection from '../general-settings-section';
import LoadableSettingsSection from '../loadable-settings-section';
import DisplayOrderCustomizationNotice from '../display-order-customization-notice';
import { NEW_CHECKOUT_EXPERIENCE_BANNER } from 'wcstripe/settings/payment-settings/constants';
import PromotionalBannerSection from 'wcstripe/settings/payment-settings/promotional-banner-section';
import UpeToggleContext from 'wcstripe/settings/upe-toggle/context';
import { useAccount } from 'wcstripe/data/account';
Expand Down Expand Up @@ -86,7 +87,7 @@ const PaymentMethodsPanel = ( { onSaveChanges } ) => {
<GeneralSettingsSection
onSaveChanges={ onSaveChanges }
showLegacyExperienceTransitionNotice={
promotionalBannerType !== 'new-checkout-experience'
promotionalBannerType !== NEW_CHECKOUT_EXPERIENCE_BANNER
}
/>
</SettingsSection>
Expand Down
2 changes: 2 additions & 0 deletions client/settings/payment-settings/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const RECONNECT_BANNER = 'stripe-reconnect';
export const NEW_CHECKOUT_EXPERIENCE_BANNER = 'new-checkout-experience';
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import interpolateComponents from 'interpolate-components';
import CardBody from '../card-body';
import bannerIllustration from './banner-illustration.svg';
import bannerIllustrationReConnect from './banner-illustration-re-connect.svg';
import { RECONNECT_BANNER, NEW_CHECKOUT_EXPERIENCE_BANNER } from './constants';
import Pill from 'wcstripe/components/pill';
import { recordEvent } from 'wcstripe/tracking';
import { useEnabledPaymentMethodIds, useTestMode } from 'wcstripe/data';
Expand Down Expand Up @@ -289,14 +290,14 @@ const PromotionalBannerSection = ( {

let BannerContent = null;
if ( isConnectedViaOAuth === false ) {
setPromotionalBannerType( 'stripe-reconnect' );
setPromotionalBannerType?.( RECONNECT_BANNER );
BannerContent = <ReConnectAccountBanner />;
} else if ( ! isUpeEnabled ) {
if ( hasAPMEnabled ) {
setPromotionalBannerType( 'new-checkout-experience' );
setPromotionalBannerType?.( NEW_CHECKOUT_EXPERIENCE_BANNER );
BannerContent = <NewCheckoutExperienceAPMsBanner />;
} else {
setPromotionalBannerType( 'new-checkout-experience' );
setPromotionalBannerType?.( NEW_CHECKOUT_EXPERIENCE_BANNER );
BannerContent = <NewCheckoutExperienceBanner />;
}
}
Expand Down

0 comments on commit 1add408

Please sign in to comment.