Skip to content

Commit

Permalink
Remove account_contract_choose_pin_code_enabled flag (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodyowl authored Sep 30, 2024
1 parent 230c725 commit 1ea319d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
23 changes: 5 additions & 18 deletions clients/banking/src/components/CardItemPhysicalDeliveryWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useRef, useState } from "react";
import { match } from "ts-pattern";
import { CompleteAddressInput } from "../graphql/partner";
import { t } from "../utils/i18n";
import { useTgglFlag } from "../utils/tggl";
import {
CardItemPhysicalChoosePinForm,
CardItemPhysicalChoosePinFormRef,
Expand Down Expand Up @@ -43,11 +42,7 @@ export const CardItemPhysicalDeliveryWizard = ({
const choosePinRef = useRef<CardItemPhysicalChoosePinFormRef>(null);
const deliveryAddressRef = useRef<CardItemPhysicalDeliveryAddressFormRef>(null);

const isChoosePinActive = useTgglFlag("account_contract_choose_pin_code_enabled").getOr(false);
const [step, setStep] = useState<Step>(
// if flag is inactive, default to not choosing PIN code
isChoosePinActive ? { name: "ChoosePin" } : { name: "Address", choosePin: false },
);
const [step, setStep] = useState<Step>({ name: "ChoosePin" });

return (
<LakeModal
Expand Down Expand Up @@ -78,25 +73,17 @@ export const CardItemPhysicalDeliveryWizard = ({
))
.exhaustive()}

{isChoosePinActive && (
<>
<Space height={12} />
<StepDots currentStep={step.name} steps={formSteps} />
<Space height={12} />
</>
)}
<Space height={12} />
<StepDots currentStep={step.name} steps={formSteps} />
<Space height={12} />

<LakeButtonGroup paddingBottom={0}>
<LakeButton
onPress={() => {
match(step)
.with({ name: "ChoosePin" }, () => onPressClose())
.with({ name: "Address" }, () => {
if (isChoosePinActive) {
setStep({ name: "ChoosePin" });
} else {
onPressClose();
}
setStep({ name: "ChoosePin" });
})
.exhaustive();
}}
Expand Down
15 changes: 2 additions & 13 deletions clients/banking/src/components/CardWizardIndividualDelivery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
} from "../graphql/partner";
import { getMemberName } from "../utils/accountMembership";
import { t } from "../utils/i18n";
import { useTgglFlag } from "../utils/tggl";
import { validateAddressLine } from "../utils/validations";
import { Address, CardWizardAddressForm } from "./CardWizardAddressForm";
import { CardWizardChoosePinModal } from "./CardWizardChoosePinModal";
Expand Down Expand Up @@ -195,8 +194,6 @@ const CardWizardIndividualDeliveryWithAddress = forwardRef<

export const CardWizardIndividualDelivery = forwardRef<CardWizardIndividualDeliveryRef, Props>(
({ members, address, onSubmit }: Props, ref) => {
const isChoosePinActive = useTgglFlag("account_contract_choose_pin_code_enabled").getOr(false);

const [choosePinModal, setChoosePinModal] = useState<Option<CardIndividualDeliveryConfig>>(
Option.None(),
);
Expand All @@ -209,11 +206,7 @@ export const CardWizardIndividualDelivery = forwardRef<CardWizardIndividualDeliv
members={members}
address={address}
onSubmit={value => {
if (isChoosePinActive) {
setChoosePinModal(Option.Some(value));
} else {
onSubmit(value);
}
setChoosePinModal(Option.Some(value));
}}
/>
) : (
Expand All @@ -233,11 +226,7 @@ export const CardWizardIndividualDelivery = forwardRef<CardWizardIndividualDeliv
},
choosePin: false,
}));
if (isChoosePinActive) {
setChoosePinModal(Option.Some(config));
} else {
onSubmit(config);
}
setChoosePinModal(Option.Some(config));
}}
/>
</Tile>
Expand Down

0 comments on commit 1ea319d

Please sign in to comment.