fix: adding a new workflow step that requires kyc verification (#10912)
* fix verificaiton check when step is added * add verify badge with dialog also when adding action --------- Co-authored-by: CarinaWolli <wollencarina@gmail.com>
This commit is contained in:
1 parent
12148506bd
commit
b2382211db
3 files changed
+8
-3
No files matched your search
@@ -39,6 +39,7 @@ interface IAddActionDialog {
|
||||
senderId?: string,
|
||||
senderName?: string
|
||||
) => void;
|
||||
setKYCVerificationDialogOpen: () => void;
|
||||
}
|
||||
|
||||
interface ISelectActionOption {
|
||||
@@ -56,7 +57,7 @@ type AddActionFormValues = {
|
||||
|
||||
export const AddActionDialog = (props: IAddActionDialog) => {
|
||||
const { t } = useLocale();
|
||||
const { isOpenDialog, setIsOpenDialog, addAction } = props;
|
||||
const { isOpenDialog, setIsOpenDialog, addAction, setKYCVerificationDialogOpen } = props;
|
||||
const [isPhoneNumberNeeded, setIsPhoneNumberNeeded] = useState(false);
|
||||
const [isSenderIdNeeded, setIsSenderIdNeeded] = useState(false);
|
||||
const [isEmailAddressNeeded, setIsEmailAddressNeeded] = useState(false);
|
||||
@@ -168,7 +169,10 @@ export const AddActionDialog = (props: IAddActionDialog) => {
|
||||
className="text-sm"
|
||||
defaultValue={actionOptions[0]}
|
||||
onChange={handleSelectAction}
|
||||
options={actionOptions}
|
||||
options={actionOptions.map((option) => ({
|
||||
...option,
|
||||
verificationAction: () => setKYCVerificationDialogOpen(),
|
||||
}))}
|
||||
isOptionDisabled={(option: {
|
||||
label: string;
|
||||
value: WorkflowActions;
|
||||
|
||||
@@ -219,6 +219,7 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
isOpenDialog={isAddActionDialogOpen}
|
||||
setIsOpenDialog={setIsAddActionDialogOpen}
|
||||
addAction={addAction}
|
||||
setKYCVerificationDialogOpen={() => setKYCVerificationDialogOpen(true)}
|
||||
/>
|
||||
<KYCVerificationDialog
|
||||
isOpenDialog={isKYCVerificationDialogOpen}
|
||||
|
||||
@@ -603,7 +603,7 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
|
||||
if (isSMSOrWhatsappAction(s.action) && !hasPaidPlan) {
|
||||
throw new TRPCError({ code: "UNAUTHORIZED" });
|
||||
}
|
||||
if (isTextMessageToAttendeeAction(s.action)) {
|
||||
if (!isKYCVerified && isTextMessageToAttendeeAction(s.action)) {
|
||||
throw new TRPCError({ code: "UNAUTHORIZED", message: "Account needs to be verified" });
|
||||
}
|
||||
const { id: _stepId, ...stepToAdd } = s;
|
||||
|
||||
Reference in new issue
Block a user