@@ -35,6 +35,9 @@ const PaymentsTab: FC<PaymentsTabProps> = (props: PaymentsTabProps) => {
3535 const [ hasEmailedSupport , setHasEmailedSupport ] : [ boolean , Dispatch < SetStateAction < boolean > > ]
3636 = useState < boolean > ( false )
3737
38+ const [ wantsToChangePreviousSelection , setWantsToChangePreviousSelection ] : [ boolean , Dispatch < SetStateAction < boolean > > ]
39+ = useState < boolean > ( false )
40+
3841 const [ paymentService , setPaymentService ] : [ string | undefined , Dispatch < SetStateAction < string | undefined > > ] = useState (
3942 localStorage . getItem ( `${ props . profile . handle } _${ PAYMENT_PROVIDER_KEY } ` ) || undefined ,
4043 )
@@ -68,7 +71,12 @@ const PaymentsTab: FC<PaymentsTabProps> = (props: PaymentsTabProps) => {
6871 }
6972 }
7073
71- function handleSelectedProviderReset ( ) : void {
74+ function handleSelectedProviderChange ( ) : void {
75+ setWantsToChangePreviousSelection ( true )
76+ }
77+
78+ function handleSelectionReset ( ) : void {
79+ setWantsToChangePreviousSelection ( false )
7280 localStorage . removeItem ( `${ props . profile . handle } _${ PAYMENT_PROVIDER_KEY } ` )
7381 setPaymentService ( undefined )
7482 }
@@ -108,7 +116,7 @@ const PaymentsTab: FC<PaymentsTabProps> = (props: PaymentsTabProps) => {
108116 </ p >
109117
110118 {
111- paymentService ? (
119+ paymentService && ! wantsToChangePreviousSelection ? (
112120 < SettingSection
113121 leftElement = { (
114122 < div className = { styles . providerSubmittedIcon } >
@@ -123,11 +131,37 @@ const PaymentsTab: FC<PaymentsTabProps> = (props: PaymentsTabProps) => {
123131 secondary
124132 size = 'lg'
125133 label = 'Change Provider'
126- onClick = { handleSelectedProviderReset }
134+ onClick = { handleSelectedProviderChange }
127135 />
128136 ) }
129137 />
130- ) : (
138+ ) : undefined
139+ }
140+
141+ {
142+ paymentService && wantsToChangePreviousSelection ? (
143+ < div className = { styles . confirmSelectionReset } >
144+ < p >
145+ < strong className = 'body-main-bold' >
146+ Your currently selected payment provider is:
147+ { ' ' }
148+ { paymentService }
149+ </ strong >
150+ < br />
151+ < strong className = 'body-main-bold' > Note: </ strong >
152+ You have chosen to change your selected payment provider. This change may take up to 48 hours to be reflected in your account.
153+ </ p >
154+ < Button
155+ secondary
156+ label = 'Cancel Change'
157+ onClick = { handleSelectionReset }
158+ />
159+ </ div >
160+ ) : undefined
161+ }
162+
163+ {
164+ ! paymentService || wantsToChangePreviousSelection ? (
131165 < >
132166 < div className = { styles . providers } >
133167 < div className = { styles . providerCard } >
@@ -214,7 +248,7 @@ const PaymentsTab: FC<PaymentsTabProps> = (props: PaymentsTabProps) => {
214248 prior to making a payment provider decision.
215249 </ p >
216250 </ >
217- )
251+ ) : undefined
218252 }
219253 </ Collapsible >
220254 </ div >
0 commit comments