Skip to content

Commit

Permalink
Merge pull request #29 from techsavvyash/fix/scheme
Browse files Browse the repository at this point in the history
Fix/scheme
  • Loading branch information
Amruth-Vamshi authored Jun 13, 2024
2 parents 4d03dd6 + 9f5010a commit 45e6e82
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/xstate/prompt/prompt.gaurds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ export const promptGuards = {
ifMultipleAadhaar: (_, event) =>
event.data == "This mobile number taged with multiple records.",

ifInValidScheme: (_, event) =>
!VALID_SCHEMES.includes(event.data.prompt.input.schemeName),

ifNoRecordsFound: (context, event) =>
event.data ==
`No Record Found for this (${context.userAadhaarNumber}) Aadhar/Ben_id/Mobile.`,
// ifInValidScheme: (_, event) =>
// !VALID_SCHEMES.includes(event.data.prompt.input.schemeName),

ifNoRecordsFound: (context, event) => {
const pattern =
/No Record Found for this \((.*?)\) Aadhar\/Ben_id\/Mobile\./;
return (
pattern.test(event.data) ||
((event.data as string).startsWith("No Record Found for this") &&
(event.data as string).endsWith("Aadhar/Ben_id/Mobile."))
);
},
// event.data ==
// `No Record Found for this (${context.userAadhaarNumber}) Aadhar/Ben_id/Mobile.`,

ifOTPSend: (_, event) => event.data == "OTP send successfully!",

Expand Down

0 comments on commit 45e6e82

Please sign in to comment.