diff --git a/.example.env b/.example.env index 5466250e094..3e71d08fae3 100644 --- a/.example.env +++ b/.example.env @@ -72,3 +72,6 @@ REACT_DEFAULT_ENCOUNTER_TYPE= # Available languages to switch between (2 Digit language code seperated by comas. See src->Locale->config.ts for available codes) REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn" + +# ISO 3166-1 Alpha-2 code for the default country code (default: "IN") +REACT_DEFAULT_COUNTRY= diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0075353370b..56b14a37e2e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,24 +1,25 @@ version: 2 updates: - - package-ecosystem: "yarn" + - package-ecosystem: npm directory: "/" schedule: interval: "daily" + open-pull-requests-limit: 0 allow: - dependency-name: "*" dependency-type: "production" assignees: - "tomahawk_pilot" labels: - - "yarn" - "dependencies" - package-ecosystem: "github-actions" directory: "/" schedule: interval: "daily" - assignees: + open-pull-requests-limit: 0 + assignees: - "tomahawk_pilot" labels: - "ci" - - "dependencies" \ No newline at end of file + - "dependencies" diff --git a/.github/workflows/auto-testing-label.yml b/.github/workflows/auto-testing-label.yml index d69a26545aa..6d3cbd92ca4 100644 --- a/.github/workflows/auto-testing-label.yml +++ b/.github/workflows/auto-testing-label.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Check PR Conditions and Add Label id: check_conditions - uses: actions/github-script@v5 + uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 84e392219d0..f669f34bd23 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -16,7 +16,7 @@ jobs: contents: read steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: diff --git a/.github/workflows/comment-p1-issues.yml b/.github/workflows/comment-p1-issues.yml index 40eab027740..4a7c5f97339 100644 --- a/.github/workflows/comment-p1-issues.yml +++ b/.github/workflows/comment-p1-issues.yml @@ -13,7 +13,7 @@ jobs: issues: write steps: - name: Add comment - uses: actions/github-script@v6.4.1 + uses: actions/github-script@v7 with: script: | const body = ':warning: **Refrain from assigning this issue to yourself if you have another `P1` issue assigned that is not yet closed.**' diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 6761a9fe10a..301f0c7cbfe 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -21,7 +21,7 @@ jobs: steps: - name: Checkout 📥 - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Determine PR Origin id: pr_origin diff --git a/.github/workflows/label-deploy-failed.yml b/.github/workflows/label-deploy-failed.yml index c7878de6017..1907d87f8e9 100644 --- a/.github/workflows/label-deploy-failed.yml +++ b/.github/workflows/label-deploy-failed.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Add 'Deploy-Failed' if: contains(github.event.comment.body, 'failed') - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | github.rest.issues.addLabels({ @@ -30,7 +30,7 @@ jobs: - name: Remove 'Deploy-Failed' label if: contains(github.event.comment.body, 'ready') - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | github.rest.issues.removeLabel({ diff --git a/.github/workflows/label-wip.yml b/.github/workflows/label-wip.yml index 7c888e09f71..8515c00a00c 100644 --- a/.github/workflows/label-wip.yml +++ b/.github/workflows/label-wip.yml @@ -32,7 +32,7 @@ jobs: if: github.repository == 'ohcnetwork/care_fe' && join(needs.check-linked-issues.outputs.linked_issues) != '' steps: - name: Label - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | const issues = "${{ needs.check-linked-issues.outputs.linked_issues }}".split(',') diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0c52bfd7124..6eb50339b12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: name: Release on Push runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Necessary to fetch all tags diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 17afd8edc25..c6dc34004c2 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-24.04-arm if: github.repository == 'ohcnetwork/care_fe' steps: - - uses: actions/stale@v6 + - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-label: "stale" diff --git a/.github/workflows/thank-you.yml b/.github/workflows/thank-you.yml index 1338787dd17..3b7c5cc71ee 100644 --- a/.github/workflows/thank-you.yml +++ b/.github/workflows/thank-you.yml @@ -15,7 +15,7 @@ jobs: contents: write steps: - name: Add thankyou note - uses: actions/github-script@v6.4.1 + uses: actions/github-script@v7 with: script: | const thankyouNote = 'Your efforts have helped advance digital healthcare and TeleICU systems. :rocket: Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! :raised_hands:'; diff --git a/README.md b/README.md index 61ad8de9895..b0f6338fbb5 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ CARE Logo +
+ DPG Badge

Our goal is to continuously improve the quality and accessibility of public healthcare services using digital tools.

@@ -151,3 +153,10 @@ Starts a production http-server in local to run the project with Service worker. The build is minified and the filenames include the hashes. **🚀 Your app is ready to be deployed!** + +
+ +
+Digital Public Goods Badge + +
diff --git a/care.config.ts b/care.config.ts index c9022c51f2f..0bd759fd246 100644 --- a/care.config.ts +++ b/care.config.ts @@ -1,3 +1,5 @@ +import { CountryCode } from "libphonenumber-js/types.cjs"; + import { EncounterClass } from "@/types/emr/encounter"; const env = import.meta.env; @@ -148,6 +150,8 @@ const careConfig = { plotsConfigUrl: env.REACT_OBSERVATION_PLOTS_CONFIG_URL || "/config/plots.json", + + defaultCountry: (env.REACT_DEFAULT_COUNTRY || "IN") as CountryCode, } as const; export default careConfig; diff --git a/cypress/e2e/facility_spec/facility_creation.cy.ts b/cypress/e2e/facility_spec/facility_creation.cy.ts index d95832965bb..d2d0351c414 100644 --- a/cypress/e2e/facility_spec/facility_creation.cy.ts +++ b/cypress/e2e/facility_spec/facility_creation.cy.ts @@ -1,6 +1,6 @@ -import { FacilityCreation } from "pageObject/facility/FacilityCreation"; -import { generatePhoneNumber } from "utils/commonUtils"; -import { generateFacilityData } from "utils/facilityData"; +import { FacilityCreation } from "@/pageObject/facility/FacilityCreation"; +import { generatePhoneNumber } from "@/utils/commonUtils"; +import { generateFacilityData } from "@/utils/facilityData"; const LOCATION_HIERARCHY = { localBody: "Aluva", diff --git a/cypress/e2e/login_spec/loginpage.cy.ts b/cypress/e2e/login_spec/loginpage.cy.ts index 89e67763ade..8ca52275170 100644 --- a/cypress/e2e/login_spec/loginpage.cy.ts +++ b/cypress/e2e/login_spec/loginpage.cy.ts @@ -1,4 +1,4 @@ -import { LoginPage } from "../../pageObject/auth/LoginPage"; +import { LoginPage } from "@/pageObject/auth/LoginPage"; describe("Login Page", () => { const loginPage = new LoginPage(); diff --git a/cypress/e2e/patient_spec/patient_creation.cy.ts b/cypress/e2e/patient_spec/patient_creation.cy.ts index 06cb1a606b2..cbeb15a241d 100644 --- a/cypress/e2e/patient_spec/patient_creation.cy.ts +++ b/cypress/e2e/patient_spec/patient_creation.cy.ts @@ -1,13 +1,14 @@ -import { patientCreation } from "pageObject/Patients/PatientCreation"; -import { patientDashboard } from "pageObject/Patients/PatientDashboard"; -import { patientVerify } from "pageObject/Patients/PatientVerify"; -import { FacilityCreation } from "pageObject/facility/FacilityCreation"; import { generateAddress, generateName, generatePhoneNumber, } from "utils/commonUtils"; +import { patientCreation } from "@/pageObject/Patients/PatientCreation"; +import { patientDashboard } from "@/pageObject/Patients/PatientDashboard"; +import { patientVerify } from "@/pageObject/Patients/PatientVerify"; +import { FacilityCreation } from "@/pageObject/facility/FacilityCreation"; + const facilityCreation = new FacilityCreation(); const ENCOUNTER_TYPE = "Observation"; const ENCOUNTER_STATUS = "In Progress"; diff --git a/cypress/e2e/patient_spec/patient_encounter.cy.ts b/cypress/e2e/patient_spec/patient_encounter.cy.ts index 7680762a012..ac13650585d 100644 --- a/cypress/e2e/patient_spec/patient_encounter.cy.ts +++ b/cypress/e2e/patient_spec/patient_encounter.cy.ts @@ -1,5 +1,5 @@ -import { PatientEncounter } from "pageObject/Patients/PatientEncounter"; -import { FacilityCreation } from "pageObject/facility/FacilityCreation"; +import { PatientEncounter } from "@/pageObject/Patients/PatientEncounter"; +import { FacilityCreation } from "@/pageObject/facility/FacilityCreation"; const facilityCreation = new FacilityCreation(); const patientEncounter = new PatientEncounter(); diff --git a/cypress/e2e/users_spec/user_creation.cy.ts b/cypress/e2e/users_spec/user_creation.cy.ts index 3c45b3057c0..c43eae3d02f 100644 --- a/cypress/e2e/users_spec/user_creation.cy.ts +++ b/cypress/e2e/users_spec/user_creation.cy.ts @@ -1,10 +1,10 @@ -import { UserCreation } from "pageObject/Users/UserCreation"; -import { FacilityCreation } from "pageObject/facility/FacilityCreation"; +import { UserCreation } from "@/pageObject/Users/UserCreation"; +import { FacilityCreation } from "@/pageObject/facility/FacilityCreation"; import { generateName, generatePhoneNumber, generateUsername, -} from "utils/commonUtils"; +} from "@/utils/commonUtils"; describe("User Creation", () => { const facilityCreation = new FacilityCreation(); diff --git a/cypress/pageObject/Users/UserCreation.ts b/cypress/pageObject/Users/UserCreation.ts index 47bfb40bd3c..e5cc81e0332 100644 --- a/cypress/pageObject/Users/UserCreation.ts +++ b/cypress/pageObject/Users/UserCreation.ts @@ -72,11 +72,11 @@ export class UserCreation { { label: "Confirm Password", message: "Required" }, { label: "Phone Number", - message: "Phone number must start with +91 followed by 10 digits", + message: "Invalid input", }, { label: "Alternate Phone Number", - message: "Phone number must start with +91 followed by 10 digits", + message: "Invalid input", }, { label: "State", message: "Required" }, ]); diff --git a/cypress/pageObject/facility/FacilityCreation.ts b/cypress/pageObject/facility/FacilityCreation.ts index 8e630f7e56e..8f7e0edf319 100644 --- a/cypress/pageObject/facility/FacilityCreation.ts +++ b/cypress/pageObject/facility/FacilityCreation.ts @@ -94,7 +94,7 @@ export class FacilityCreation { { label: "Address", message: "Address is required" }, { label: "Phone Number", - message: "Phone number must start with +91 followed by 10 digits", + message: "Invalid input", }, { label: "Pincode", message: "Invalid Pincode" }, ]); diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 597454eb00c..6b5ac7d593a 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -62,6 +62,7 @@ Cypress.Commands.add("getAttached", (selector: string) => { $el = getElement(Cypress.$($d)); // Ensure $el is an HTMLElement before checking if it is detached if ($el.length && $el[0] instanceof HTMLElement) { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions expect(Cypress.dom.isDetached($el[0])).to.be.false; // Access the first HTMLElement } else { throw new Error("Element is not an HTMLElement or is detached."); diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index f887c29aead..76cc5965d64 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -1 +1 @@ -import "./commands"; +import "@/support/commands"; diff --git a/cypress/support/index.ts b/cypress/support/index.ts index 4a8bd309951..cdab9462722 100644 --- a/cypress/support/index.ts +++ b/cypress/support/index.ts @@ -1,4 +1,4 @@ -import { ErrorMessageItem } from "./commands"; +import { ErrorMessageItem } from "@/support/commands"; declare global { // eslint-disable-next-line @typescript-eslint/no-namespace diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index 3fbb7b08f69..e4db1f71f13 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -13,7 +13,10 @@ "es2020" ], "typeRoots": ["./support"], - "resolveJsonModule": true + "resolveJsonModule": true, + "paths": { + "@/*": ["./*"], + } }, "include": ["**/*.cy.ts", "support/commands.ts", "**/*.ts"] } diff --git a/eslint.config.mjs b/eslint.config.mjs index da34692bca6..35fd03f40b7 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -34,6 +34,7 @@ export default [ ...globals.node, React: true, }, + parser: tsParser, parserOptions: { ecmaFeatures: { jsx: true, diff --git a/package-lock.json b/package-lock.json index aa61fcbff16..64e65897005 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "care_fe", - "version": "2.6.0", + "version": "2.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "care_fe", - "version": "2.6.0", + "version": "2.8.0", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -64,8 +64,9 @@ "i18next-http-backend": "^3.0.1", "i18next-resources-to-backend": "^1.2.1", "input-otp": "^1.4.2", + "libphonenumber-js": "^1.11.18", "lodash-es": "^4.17.21", - "lucide-react": "^0.473.0", + "lucide-react": "^0.474.0", "markdown-it": "^14.1.0", "next-themes": "^0.4.3", "postcss-loader": "^8.1.1", @@ -80,6 +81,7 @@ "react-infinite-scroll-component": "^6.1.0", "react-intersection-observer": "^9.15.1", "react-pdf": "^9.2.1", + "react-phone-number-input": "^3.4.11", "react-webcam": "^7.2.0", "recharts": "^2.15.0", "sonner": "^1.7.2", @@ -118,7 +120,7 @@ "dompurify": "^3.1.7", "dotenv": "^16.4.5", "eslint": "^9.18.0", - "eslint-config-prettier": "^9.1.0", + "eslint-config-prettier": "^10.0.0", "eslint-plugin-i18next": "^6.1.0", "eslint-plugin-no-relative-import-paths": "^1.6.1", "eslint-plugin-prettier": "^5.2.1", @@ -130,7 +132,7 @@ "jsdom": "^25.0.1", "lint-staged": "^15.2.10", "local-cypress": "^1.2.6", - "marked": "^14.1.4", + "marked": "^15.0.0", "postcss": "^8.4.47", "prettier": "^3.3.3", "prettier-plugin-tailwindcss": "^0.6.8", @@ -152,8 +154,8 @@ "optionalDependencies": { "@esbuild/linux-arm64": "latest", "@esbuild/linux-x64": "latest", - "@rollup/rollup-linux-arm64-gnu": "4.32.0", - "@rollup/rollup-linux-x64-gnu": "4.32.0" + "@rollup/rollup-linux-arm64-gnu": "4.32.1", + "@rollup/rollup-linux-x64-gnu": "4.32.1" } }, "node_modules/@actions/core": { @@ -5721,9 +5723,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.32.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.32.0.tgz", - "integrity": "sha512-r7/OTF5MqeBrZo5omPXcTnjvv1GsrdH8a8RerARvDFiDwFpDVDnJyByYM/nX+mvks8XXsgPUxkwe/ltaX2VH7w==", + "version": "4.32.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.32.1.tgz", + "integrity": "sha512-tZWc9iEt5fGJ1CL2LRPw8OttkCBDs+D8D3oEM8mH8S1ICZCtFJhD7DZ3XMGM8kpqHvhGUTvNUYVDnmkj4BDXnw==", "cpu": [ "arm64" ], @@ -5799,9 +5801,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.32.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.32.0.tgz", - "integrity": "sha512-VDzNHtLLI5s7xd/VubyS10mq6TxvZBp+4NRWoW+Hi3tgV05RtVm4qK99+dClwTN1McA6PHwob6DEJ6PlXbY83A==", + "version": "4.32.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.32.1.tgz", + "integrity": "sha512-WQFLZ9c42ECqEjwg/GHHsouij3pzLXkFdz0UxHa/0OM12LzvX7DzedlY0SIEly2v18YZLRhCRoHZDxbBSWoGYg==", "cpu": [ "x64" ], @@ -6123,9 +6125,9 @@ } }, "node_modules/@tanstack/query-core": { - "version": "5.64.2", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.64.2.tgz", - "integrity": "sha512-hdO8SZpWXoADNTWXV9We8CwTkXU88OVWRBcsiFrk7xJQnhm6WRlweDzMD+uH+GnuieTBVSML6xFa17C2cNV8+g==", + "version": "5.65.0", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.65.0.tgz", + "integrity": "sha512-Bnnq/1axf00r2grRT6gUyIkZRKzhHs+p4DijrCQ3wMlA3D3TTT71gtaSLtqnzGddj73/7X5JDGyjiSLdjvQN4w==", "license": "MIT", "funding": { "type": "github", @@ -6133,9 +6135,9 @@ } }, "node_modules/@tanstack/query-devtools": { - "version": "5.64.2", - "resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.64.2.tgz", - "integrity": "sha512-3DautR5UpVZdk/qNIhioZVF7g8fdQZ1U98sBEEk4Tzz3tihSBNMPgwlP40nzgbPEDBIrn/j/oyyvNBVSo083Vw==", + "version": "5.65.0", + "resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.65.0.tgz", + "integrity": "sha512-g5y7zc07U9D3esMdqUfTEVu9kMHoIaVBsD0+M3LPdAdD710RpTcLiNvJY1JkYXqkq9+NV+CQoemVNpQPBXVsJg==", "license": "MIT", "funding": { "type": "github", @@ -6143,12 +6145,12 @@ } }, "node_modules/@tanstack/react-query": { - "version": "5.64.2", - "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.64.2.tgz", - "integrity": "sha512-3pakNscZNm8KJkxmovvtZ4RaXLyiYYobwleTMvpIGUoKRa8j8VlrQKNl5W8VUEfVfZKkikvXVddLuWMbcSCA1Q==", + "version": "5.65.1", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.65.1.tgz", + "integrity": "sha512-BSpjo4RQdJ75Mw3pqM1AJYNhanNxJE3ct7RmCZUAv9cUJg/Qmonzc/Xy2kKXeQA1InuKATSuc6pOZciWOF8TYQ==", "license": "MIT", "dependencies": { - "@tanstack/query-core": "5.64.2" + "@tanstack/query-core": "5.65.0" }, "funding": { "type": "github", @@ -6159,19 +6161,19 @@ } }, "node_modules/@tanstack/react-query-devtools": { - "version": "5.64.2", - "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.64.2.tgz", - "integrity": "sha512-+ZjJVnPzc8BUV/Eklu2k9T/IAyAyvwoCHqOaOrk2sbU33LFhM52BpX4eyENXn0bx5LwV3DJZgEQlIzucoemfGQ==", + "version": "5.65.1", + "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.65.1.tgz", + "integrity": "sha512-PKUBz7+FAP3eI1zoWrP5vxNQXs+elPz3u/3cILGhNZl2dufgbU9OJRpbC+BAptLXTsGxTwkAlrWBIZbD/c7CDw==", "license": "MIT", "dependencies": { - "@tanstack/query-devtools": "5.64.2" + "@tanstack/query-devtools": "5.65.0" }, "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" }, "peerDependencies": { - "@tanstack/react-query": "^5.64.2", + "@tanstack/react-query": "^5.65.1", "react": "^18 || ^19" } }, @@ -6472,9 +6474,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.10.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.10.tgz", - "integrity": "sha512-X47y/mPNzxviAGY5TcYPtYL8JsY3kAq2n8fMmKoRCxq/c4v4pyGNCzM2R6+M5/umG4ZfHuT+sgqDYqWc9rJ6ww==", + "version": "22.12.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.12.0.tgz", + "integrity": "sha512-Fll2FZ1riMjNmlmJOdAyY5pUbkftXslB5DgEzlIuNaiWhXd00FhWxVC/r4yV/4wBb9JfImTu+jiSvXTkJ7F/gA==", "devOptional": true, "license": "MIT", "dependencies": { @@ -6596,17 +6598,17 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.21.0.tgz", - "integrity": "sha512-eTH+UOR4I7WbdQnG4Z48ebIA6Bgi7WO8HvFEneeYBxG8qCOYgTOFPSg6ek9ITIDvGjDQzWHcoWHCDO2biByNzA==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.22.0.tgz", + "integrity": "sha512-4Uta6REnz/xEJMvwf72wdUnC3rr4jAQf5jnTkeRQ9b6soxLxhDEbS/pfMPoJLDfFPNVRdryqWUIV/2GZzDJFZw==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.21.0", - "@typescript-eslint/type-utils": "8.21.0", - "@typescript-eslint/utils": "8.21.0", - "@typescript-eslint/visitor-keys": "8.21.0", + "@typescript-eslint/scope-manager": "8.22.0", + "@typescript-eslint/type-utils": "8.22.0", + "@typescript-eslint/utils": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -6626,9 +6628,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.21.0.tgz", - "integrity": "sha512-PAL6LUuQwotLW2a8VsySDBwYMm129vFm4tMVlylzdoTybTHaAi0oBp7Ac6LhSrHHOdLM3efH+nAR6hAWoMF89A==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.22.0.tgz", + "integrity": "sha512-0S4M4baNzp612zwpD4YOieP3VowOARgK2EkN/GBn95hpyF8E2fbMT55sRHWBq+Huaqk3b3XK+rxxlM8sPgGM6A==", "dev": true, "license": "MIT", "engines": { @@ -6640,13 +6642,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.21.0.tgz", - "integrity": "sha512-BkLMNpdV6prozk8LlyK/SOoWLmUFi+ZD+pcqti9ILCbVvHGk1ui1g4jJOc2WDLaeExz2qWwojxlPce5PljcT3w==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.22.0.tgz", + "integrity": "sha512-AWpYAXnUgvLNabGTy3uBylkgZoosva/miNd1I8Bz3SjotmQPbVqhO4Cczo8AsZ44XVErEBPr/CRSgaj8sG7g0w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", + "@typescript-eslint/types": "8.22.0", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -6684,16 +6686,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.21.0.tgz", - "integrity": "sha512-Wy+/sdEH9kI3w9civgACwabHbKl+qIOu0uFZ9IMKzX3Jpv9og0ZBJrZExGrPpFAY7rWsXuxs5e7CPPP17A4eYA==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.22.0.tgz", + "integrity": "sha512-MqtmbdNEdoNxTPzpWiWnqNac54h8JDAmkWtJExBVVnSrSmi9z+sZUt0LfKqk9rjqmKOIeRhO4fHHJ1nQIjduIQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.21.0", - "@typescript-eslint/types": "8.21.0", - "@typescript-eslint/typescript-estree": "8.21.0", - "@typescript-eslint/visitor-keys": "8.21.0", + "@typescript-eslint/scope-manager": "8.22.0", + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/typescript-estree": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0", "debug": "^4.3.4" }, "engines": { @@ -6709,9 +6711,9 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.21.0.tgz", - "integrity": "sha512-PAL6LUuQwotLW2a8VsySDBwYMm129vFm4tMVlylzdoTybTHaAi0oBp7Ac6LhSrHHOdLM3efH+nAR6hAWoMF89A==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.22.0.tgz", + "integrity": "sha512-0S4M4baNzp612zwpD4YOieP3VowOARgK2EkN/GBn95hpyF8E2fbMT55sRHWBq+Huaqk3b3XK+rxxlM8sPgGM6A==", "dev": true, "license": "MIT", "engines": { @@ -6723,14 +6725,14 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.21.0.tgz", - "integrity": "sha512-x+aeKh/AjAArSauz0GiQZsjT8ciadNMHdkUSwBB9Z6PrKc/4knM4g3UfHml6oDJmKC88a6//cdxnO/+P2LkMcg==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.22.0.tgz", + "integrity": "sha512-SJX99NAS2ugGOzpyhMza/tX+zDwjvwAtQFLsBo3GQxiGcvaKlqGBkmZ+Y1IdiSi9h4Q0Lr5ey+Cp9CGWNY/F/w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", - "@typescript-eslint/visitor-keys": "8.21.0", + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -6750,13 +6752,13 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.21.0.tgz", - "integrity": "sha512-BkLMNpdV6prozk8LlyK/SOoWLmUFi+ZD+pcqti9ILCbVvHGk1ui1g4jJOc2WDLaeExz2qWwojxlPce5PljcT3w==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.22.0.tgz", + "integrity": "sha512-AWpYAXnUgvLNabGTy3uBylkgZoosva/miNd1I8Bz3SjotmQPbVqhO4Cczo8AsZ44XVErEBPr/CRSgaj8sG7g0w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", + "@typescript-eslint/types": "8.22.0", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -6794,14 +6796,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.21.0.tgz", - "integrity": "sha512-G3IBKz0/0IPfdeGRMbp+4rbjfSSdnGkXsM/pFZA8zM9t9klXDnB/YnKOBQ0GoPmoROa4bCq2NeHgJa5ydsQ4mA==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.22.0.tgz", + "integrity": "sha512-/lwVV0UYgkj7wPSw0o8URy6YI64QmcOdwHuGuxWIYznO6d45ER0wXUbksr9pYdViAofpUCNJx/tAzNukgvaaiQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", - "@typescript-eslint/visitor-keys": "8.21.0" + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -6812,9 +6814,9 @@ } }, "node_modules/@typescript-eslint/scope-manager/node_modules/@typescript-eslint/types": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.21.0.tgz", - "integrity": "sha512-PAL6LUuQwotLW2a8VsySDBwYMm129vFm4tMVlylzdoTybTHaAi0oBp7Ac6LhSrHHOdLM3efH+nAR6hAWoMF89A==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.22.0.tgz", + "integrity": "sha512-0S4M4baNzp612zwpD4YOieP3VowOARgK2EkN/GBn95hpyF8E2fbMT55sRHWBq+Huaqk3b3XK+rxxlM8sPgGM6A==", "dev": true, "license": "MIT", "engines": { @@ -6826,13 +6828,13 @@ } }, "node_modules/@typescript-eslint/scope-manager/node_modules/@typescript-eslint/visitor-keys": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.21.0.tgz", - "integrity": "sha512-BkLMNpdV6prozk8LlyK/SOoWLmUFi+ZD+pcqti9ILCbVvHGk1ui1g4jJOc2WDLaeExz2qWwojxlPce5PljcT3w==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.22.0.tgz", + "integrity": "sha512-AWpYAXnUgvLNabGTy3uBylkgZoosva/miNd1I8Bz3SjotmQPbVqhO4Cczo8AsZ44XVErEBPr/CRSgaj8sG7g0w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", + "@typescript-eslint/types": "8.22.0", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -6857,14 +6859,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.21.0.tgz", - "integrity": "sha512-95OsL6J2BtzoBxHicoXHxgk3z+9P3BEcQTpBKriqiYzLKnM2DeSqs+sndMKdamU8FosiadQFT3D+BSL9EKnAJQ==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.22.0.tgz", + "integrity": "sha512-NzE3aB62fDEaGjaAYZE4LH7I1MUwHooQ98Byq0G0y3kkibPJQIXVUspzlFOmOfHhiDLwKzMlWxaNv+/qcZurJA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.21.0", - "@typescript-eslint/utils": "8.21.0", + "@typescript-eslint/typescript-estree": "8.22.0", + "@typescript-eslint/utils": "8.22.0", "debug": "^4.3.4", "ts-api-utils": "^2.0.0" }, @@ -6881,9 +6883,9 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.21.0.tgz", - "integrity": "sha512-PAL6LUuQwotLW2a8VsySDBwYMm129vFm4tMVlylzdoTybTHaAi0oBp7Ac6LhSrHHOdLM3efH+nAR6hAWoMF89A==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.22.0.tgz", + "integrity": "sha512-0S4M4baNzp612zwpD4YOieP3VowOARgK2EkN/GBn95hpyF8E2fbMT55sRHWBq+Huaqk3b3XK+rxxlM8sPgGM6A==", "dev": true, "license": "MIT", "engines": { @@ -6895,14 +6897,14 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.21.0.tgz", - "integrity": "sha512-x+aeKh/AjAArSauz0GiQZsjT8ciadNMHdkUSwBB9Z6PrKc/4knM4g3UfHml6oDJmKC88a6//cdxnO/+P2LkMcg==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.22.0.tgz", + "integrity": "sha512-SJX99NAS2ugGOzpyhMza/tX+zDwjvwAtQFLsBo3GQxiGcvaKlqGBkmZ+Y1IdiSi9h4Q0Lr5ey+Cp9CGWNY/F/w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", - "@typescript-eslint/visitor-keys": "8.21.0", + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -6922,13 +6924,13 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.21.0.tgz", - "integrity": "sha512-BkLMNpdV6prozk8LlyK/SOoWLmUFi+ZD+pcqti9ILCbVvHGk1ui1g4jJOc2WDLaeExz2qWwojxlPce5PljcT3w==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.22.0.tgz", + "integrity": "sha512-AWpYAXnUgvLNabGTy3uBylkgZoosva/miNd1I8Bz3SjotmQPbVqhO4Cczo8AsZ44XVErEBPr/CRSgaj8sG7g0w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", + "@typescript-eslint/types": "8.22.0", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -7009,16 +7011,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.21.0.tgz", - "integrity": "sha512-xcXBfcq0Kaxgj7dwejMbFyq7IOHgpNMtVuDveK7w3ZGwG9owKzhALVwKpTF2yrZmEwl9SWdetf3fxNzJQaVuxw==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.22.0.tgz", + "integrity": "sha512-T8oc1MbF8L+Bk2msAvCUzjxVB2Z2f+vXYfcucE2wOmYs7ZUwco5Ep0fYZw8quNwOiw9K8GYVL+Kgc2pETNTLOg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.21.0", - "@typescript-eslint/types": "8.21.0", - "@typescript-eslint/typescript-estree": "8.21.0" + "@typescript-eslint/scope-manager": "8.22.0", + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/typescript-estree": "8.22.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -7033,9 +7035,9 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.21.0.tgz", - "integrity": "sha512-PAL6LUuQwotLW2a8VsySDBwYMm129vFm4tMVlylzdoTybTHaAi0oBp7Ac6LhSrHHOdLM3efH+nAR6hAWoMF89A==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.22.0.tgz", + "integrity": "sha512-0S4M4baNzp612zwpD4YOieP3VowOARgK2EkN/GBn95hpyF8E2fbMT55sRHWBq+Huaqk3b3XK+rxxlM8sPgGM6A==", "dev": true, "license": "MIT", "engines": { @@ -7047,14 +7049,14 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.21.0.tgz", - "integrity": "sha512-x+aeKh/AjAArSauz0GiQZsjT8ciadNMHdkUSwBB9Z6PrKc/4knM4g3UfHml6oDJmKC88a6//cdxnO/+P2LkMcg==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.22.0.tgz", + "integrity": "sha512-SJX99NAS2ugGOzpyhMza/tX+zDwjvwAtQFLsBo3GQxiGcvaKlqGBkmZ+Y1IdiSi9h4Q0Lr5ey+Cp9CGWNY/F/w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", - "@typescript-eslint/visitor-keys": "8.21.0", + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -7074,13 +7076,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.21.0.tgz", - "integrity": "sha512-BkLMNpdV6prozk8LlyK/SOoWLmUFi+ZD+pcqti9ILCbVvHGk1ui1g4jJOc2WDLaeExz2qWwojxlPce5PljcT3w==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.22.0.tgz", + "integrity": "sha512-AWpYAXnUgvLNabGTy3uBylkgZoosva/miNd1I8Bz3SjotmQPbVqhO4Cczo8AsZ44XVErEBPr/CRSgaj8sG7g0w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.21.0", + "@typescript-eslint/types": "8.22.0", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -8223,6 +8225,12 @@ "url": "https://polar.sh/cva" } }, + "node_modules/classnames": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", + "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==", + "license": "MIT" + }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -8489,6 +8497,12 @@ } } }, + "node_modules/country-flag-icons": { + "version": "1.5.14", + "resolved": "https://registry.npmjs.org/country-flag-icons/-/country-flag-icons-1.5.14.tgz", + "integrity": "sha512-GAFsVzHDu3bdAhbQ1LwBRqk/Ad8+ZzS5zU49P+lRla0KGy/V1V8ywNa1SxBOAmI/lyEOT9dfH3Q++q1lqJlvBA==", + "license": "MIT" + }, "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", @@ -9925,13 +9939,13 @@ } }, "node_modules/eslint-config-prettier": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", - "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.0.1.tgz", + "integrity": "sha512-lZBts941cyJyeaooiKxAtzoPHTN+GbQTJFAIdQbRhA4/8whaAraEh47Whw/ZFfrjNSnlAxqfm9i0XVAEkULjCw==", "dev": true, "license": "MIT", "bin": { - "eslint-config-prettier": "bin/cli.js" + "eslint-config-prettier": "build/bin/cli.js" }, "peerDependencies": { "eslint": ">=7.0.0" @@ -11574,6 +11588,27 @@ "node": ">=10" } }, + "node_modules/input-format": { + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/input-format/-/input-format-0.3.12.tgz", + "integrity": "sha512-ml5iG8JA5aw6nsmxKOe++wAL6D8xb7MUadSPkyzHckxQnhscTqt81X+Tgv/ax3D36dkVwkcwAzKyKKPb6F7rBQ==", + "license": "MIT", + "dependencies": { + "prop-types": "^15.8.1" + }, + "peerDependencies": { + "react": ">=18.1.0", + "react-dom": ">=18.1.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, "node_modules/input-otp": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/input-otp/-/input-otp-1.4.2.tgz", @@ -12489,6 +12524,12 @@ "node": ">= 0.8.0" } }, + "node_modules/libphonenumber-js": { + "version": "1.11.18", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.11.18.tgz", + "integrity": "sha512-okMm/MCoFrm1vByeVFLBdkFIXLSHy/AIK2AEGgY3eoicfWZeOZqv3GfhtQgICkzs/tqorAMm3a4GBg5qNCrqzg==", + "license": "MIT" + }, "node_modules/lie": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", @@ -12527,9 +12568,9 @@ } }, "node_modules/lint-staged": { - "version": "15.4.2", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.4.2.tgz", - "integrity": "sha512-gCqzB/Li281uZJgReNci+oXXqUEdrFAQAzTE/LwoxxiEuP41vozNe4BATS+4ehdqkWn+Z6bGc3EDcBja3npBVw==", + "version": "15.4.3", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.4.3.tgz", + "integrity": "sha512-FoH1vOeouNh1pw+90S+cnuoFwRfUD9ijY2GKy5h7HS3OR7JVir2N2xrsa0+Twc1B7cW72L+88geG5cW4wIhn7g==", "dev": true, "license": "MIT", "dependencies": { @@ -13330,9 +13371,9 @@ } }, "node_modules/lucide-react": { - "version": "0.473.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.473.0.tgz", - "integrity": "sha512-KW6u5AKeIjkvrxXZ6WuCu9zHE/gEYSXCay+Gre2ZoInD0Je/e3RBtP4OHpJVJ40nDklSvjVKjgH7VU8/e2dzRw==", + "version": "0.474.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.474.0.tgz", + "integrity": "sha512-CmghgHkh0OJNmxGKWc0qfPJCYHASPMVSyGY8fj3xgk4v84ItqDg64JNKFZn5hC6E0vHi6gxnbCgwhyVB09wQtA==", "license": "ISC", "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" @@ -13393,9 +13434,9 @@ } }, "node_modules/marked": { - "version": "14.1.4", - "resolved": "https://registry.npmjs.org/marked/-/marked-14.1.4.tgz", - "integrity": "sha512-vkVZ8ONmUdPnjCKc5uTRvmkRbx4EAi2OkTOXmfTDhZz3OFqMNBM1oTTWwTr4HY4uAEojhzPf+Fy8F1DWa3Sndg==", + "version": "15.0.6", + "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.6.tgz", + "integrity": "sha512-Y07CUOE+HQXbVDCGl3LXggqJDbXDP2pArc2C1N1RRMN0ONiShoSsIInMd5Gsxupe7fKLpgimTV+HOJ9r7bA+pg==", "dev": true, "license": "MIT", "bin": { @@ -15203,6 +15244,23 @@ } } }, + "node_modules/react-phone-number-input": { + "version": "3.4.11", + "resolved": "https://registry.npmjs.org/react-phone-number-input/-/react-phone-number-input-3.4.11.tgz", + "integrity": "sha512-ypN9hXwUModpngho9brCHLLD40xzb1DKAZFacbF0J+fFaMVLEJo+zul9sZfSRlKehSjpttT4b1pLMcOWXI228g==", + "license": "MIT", + "dependencies": { + "classnames": "^2.5.1", + "country-flag-icons": "^1.5.11", + "input-format": "^0.3.10", + "libphonenumber-js": "^1.11.17", + "prop-types": "^15.8.1" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, "node_modules/react-redux": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz", @@ -15382,16 +15440,16 @@ } }, "node_modules/recharts": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.15.0.tgz", - "integrity": "sha512-cIvMxDfpAmqAmVgc4yb7pgm/O1tmmkl/CjrvXuW+62/+7jj/iF9Ykm+hb/UJt42TREHMyd3gb+pkgoa2MxgDIw==", + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.15.1.tgz", + "integrity": "sha512-v8PUTUlyiDe56qUj82w/EDVuzEFXwEHp9/xOowGAZwfLjB9uAy3GllQVIYMWF6nU+qibx85WF75zD7AjqoT54Q==", "license": "MIT", "dependencies": { "clsx": "^2.0.0", "eventemitter3": "^4.0.1", "lodash": "^4.17.21", "react-is": "^18.3.1", - "react-smooth": "^4.0.0", + "react-smooth": "^4.0.4", "recharts-scale": "^0.4.4", "tiny-invariant": "^1.3.1", "victory-vendor": "^36.6.8" diff --git a/package.json b/package.json index e388ece22d3..4de4ddb48bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "care_fe", - "version": "2.6.0", + "version": "2.8.0", "description": "Care is a Digital Public Good enabling TeleICU & Decentralised Administration of Healthcare Capacity across States.", "private": true, "repository": { @@ -102,8 +102,9 @@ "i18next-http-backend": "^3.0.1", "i18next-resources-to-backend": "^1.2.1", "input-otp": "^1.4.2", + "libphonenumber-js": "^1.11.18", "lodash-es": "^4.17.21", - "lucide-react": "^0.473.0", + "lucide-react": "^0.474.0", "markdown-it": "^14.1.0", "next-themes": "^0.4.3", "postcss-loader": "^8.1.1", @@ -118,6 +119,7 @@ "react-infinite-scroll-component": "^6.1.0", "react-intersection-observer": "^9.15.1", "react-pdf": "^9.2.1", + "react-phone-number-input": "^3.4.11", "react-webcam": "^7.2.0", "recharts": "^2.15.0", "sonner": "^1.7.2", @@ -156,7 +158,7 @@ "dompurify": "^3.1.7", "dotenv": "^16.4.5", "eslint": "^9.18.0", - "eslint-config-prettier": "^9.1.0", + "eslint-config-prettier": "^10.0.0", "eslint-plugin-i18next": "^6.1.0", "eslint-plugin-no-relative-import-paths": "^1.6.1", "eslint-plugin-prettier": "^5.2.1", @@ -168,7 +170,7 @@ "jsdom": "^25.0.1", "lint-staged": "^15.2.10", "local-cypress": "^1.2.6", - "marked": "^14.1.4", + "marked": "^15.0.0", "postcss": "^8.4.47", "prettier": "^3.3.3", "prettier-plugin-tailwindcss": "^0.6.8", @@ -187,8 +189,8 @@ "optionalDependencies": { "@esbuild/linux-arm64": "latest", "@esbuild/linux-x64": "latest", - "@rollup/rollup-linux-arm64-gnu": "4.32.0", - "@rollup/rollup-linux-x64-gnu": "4.32.0" + "@rollup/rollup-linux-arm64-gnu": "4.32.1", + "@rollup/rollup-linux-x64-gnu": "4.32.1" }, "browserslist": { "production": [ diff --git a/plugins/treeShakeCareIcons.ts b/plugins/treeShakeCareIcons.ts index 3ce077f5d5f..a817bfa2272 100644 --- a/plugins/treeShakeCareIcons.ts +++ b/plugins/treeShakeCareIcons.ts @@ -61,7 +61,7 @@ export function treeShakeCareIcons( // Generates a map of used icon names to their paths from UniconPaths.json, including any whitelisted icons. function getTreeShakenUniconPaths() { const usedIcons = [...getAllUsedIconNames(), ...options.iconWhitelist]; - const treeshakenCareIconPaths = {}; + const treeshakenCareIconPaths: { [key: string]: string } = {}; for (const iconName of usedIcons) { const path = allUniconPaths[iconName]; diff --git a/public/locale/en.json b/public/locale/en.json index 1262e486770..9aa895900a3 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -903,6 +903,7 @@ "enter_mobile_number": "Enter Mobile Number", "enter_mobile_otp": "Enter OTP sent to the given mobile number", "enter_otp": "Enter OTP sent to the registered mobile with the respective ID", + "enter_phone_number": "Enter phone number", "enter_phone_number_to_login_register": "Enter phone number to login/register", "enter_tag_name": "Enter tag name", "enter_tag_slug": "Enter tag slug", @@ -1092,8 +1093,6 @@ "invalid_password": "Password doesn't meet the requirements", "invalid_password_reset_link": "Invalid password reset link", "invalid_patient_data": "Invalid Patient Data", - "invalid_phone": "Please enter valid phone number", - "invalid_phone_number": "Invalid Phone Number", "invalid_pincode": "Invalid Pincode", "invalid_pincode_msg": "Please enter valid pincode", "invalid_reset": "Invalid Reset", @@ -1153,6 +1152,7 @@ "last_updated_by": "Last updated by", "last_vaccinated_on": "Last Vaccinated on", "last_week_short": "Last wk", + "latitude": "Latitude", "latitude_invalid": "Latitude must be between -90 and 90", "left": "Left", "length": "Length ({{unit}})", @@ -1196,9 +1196,12 @@ "logged_in_as": "Logged in as", "login": "Login", "logout": "Log Out", + "longitude": "Longitude", "longitude_invalid": "Longitude must be between -180 and 180", "low": "Low", "lsg": "Lsg", + "make_facility_public": "Make this facility public", + "make_facility_public_description": "When enabled, this facility will be visible to the public and can be discovered by anyone using the platform", "make_multiple_beds_label": "Do you want to make multiple beds?", "manage_bed_presets": "Manage Presets of Bed", "manage_organizations": "Manage Organizations", @@ -1304,6 +1307,7 @@ "no_consultation_filed": "No consultation filed", "no_consultation_history": "No consultation history available", "no_consultation_updates": "No consultation updates", + "no_country_found": "No country found", "no_data_found": "No data found", "no_doctors_found": "No Doctors Found", "no_duplicate_facility": "You should not create duplicate facilities", @@ -1337,6 +1341,7 @@ "no_plots_configured": "No plots configured", "no_policy_added": "No Insurance Policy Added", "no_policy_found": "No Insurance Policy Found for this Patient", + "no_practitioners_found": "No practicioners found", "no_presets": "No Presets", "no_questionnaire_responses": "No Questionnaire Responses", "no_questionnaires_found": "No questionnaires found", @@ -1513,7 +1518,7 @@ "phone_number_min_error": "Phone number must be at least 10 characters long", "phone_number_must_be_10_digits": "Phone number must be a 10-digit mobile number", "phone_number_not_found": "Phone number not found", - "phone_number_validation": "Phone number must start with +91 followed by 10 digits", + "phone_number_validation_error": "Entered phone number is not valid", "phone_number_verified": "Phone Number Verified", "pincode": "Pincode", "pincode_autofill": "State and District auto-filled from Pincode", @@ -1781,6 +1786,7 @@ "search_by_patient_no": "Search by Patient Number", "search_by_phone_number": "Search by Phone Number", "search_by_username": "Search by username", + "search_country": "Search country...", "search_encounters": "Search Encounters", "search_for_diagnoses_to_add": "Search for diagnoses to add", "search_for_facility": "Search for Facility", @@ -1844,6 +1850,7 @@ "select_time": "Select time", "select_time_slot": "Select time slot", "select_user": "Select user", + "select_user_type": "Select user type", "select_wards": "Select wards", "selected_organizations": "Selected Organizations", "selected_slot_not_found": "Selected Slot Not Found", @@ -1894,6 +1901,7 @@ "show_patient_presets": "Show Patient Presets", "show_unread_notifications": "Show Unread", "showing_all_appointments": "Showing all appointments", + "showing_x_of_y": "Showing {{x}} of {{y}}", "sign_in": "Sign in", "sign_out": "Sign out", "site": "Site", @@ -2010,6 +2018,7 @@ "type_your_comment": "Type your comment", "type_your_reason_here": "Type your reason here", "unable_to_assess": "Unable to Assess", + "unable_to_get_current_location": "Unable to get current location", "unable_to_get_current_position": "Unable to get current position.", "unable_to_get_location: ": "Unable to get location: ", "unassign": "Unassign", diff --git a/public/locale/hi.json b/public/locale/hi.json index 13a9b43e422..5afef1fa777 100644 --- a/public/locale/hi.json +++ b/public/locale/hi.json @@ -411,8 +411,6 @@ "invalid_link_msg": "ऐसा प्रतीत होता है कि आपने जो पासवर्ड रीसेट लिंक इस्तेमाल किया है वह या तो अमान्य है या उसकी समय-सीमा समाप्त हो चुकी है। कृपया नया पासवर्ड रीसेट लिंक अनुरोध करें।", "invalid_password": "पासवर्ड आवश्यकताओं को पूरा नहीं करता है", "invalid_password_reset_link": "अमान्य पासवर्ड रीसेट लिंक", - "invalid_phone": "कृपया एक वैध नंबर डालें", - "invalid_phone_number": "अमान्य फ़ोन नंबर", "invalid_pincode": "अमान्य पिनकोड", "invalid_reset": "अमान्य रीसेट", "invalid_username": "आवश्यक। 150 अक्षर या उससे कम। केवल अक्षर, अंक और @/./+/-/_।", diff --git a/public/locale/kn.json b/public/locale/kn.json index 7056c325648..0d73df7f8b8 100644 --- a/public/locale/kn.json +++ b/public/locale/kn.json @@ -413,8 +413,6 @@ "invalid_link_msg": "ನೀವು ಬಳಸಿದ ಪಾಸ್‌ವರ್ಡ್ ಮರುಹೊಂದಿಸುವ ಲಿಂಕ್ ಅಮಾನ್ಯವಾಗಿದೆ ಅಥವಾ ಅವಧಿ ಮೀರಿದೆ ಎಂದು ತೋರುತ್ತಿದೆ. ದಯವಿಟ್ಟು ಹೊಸ ಪಾಸ್‌ವರ್ಡ್ ಮರುಹೊಂದಿಸುವ ಲಿಂಕ್ ಅನ್ನು ವಿನಂತಿಸಿ.", "invalid_password": "ಪಾಸ್ವರ್ಡ್ ಅವಶ್ಯಕತೆಗಳನ್ನು ಪೂರೈಸುವುದಿಲ್ಲ", "invalid_password_reset_link": "ಅಮಾನ್ಯವಾದ ಪಾಸ್‌ವರ್ಡ್ ಮರುಹೊಂದಿಸುವ ಲಿಂಕ್", - "invalid_phone": "ದಯವಿಟ್ಟು ಮಾನ್ಯವಾದ ಫೋನ್ ಸಂಖ್ಯೆಯನ್ನು ನಮೂದಿಸಿ", - "invalid_phone_number": "ಅಮಾನ್ಯವಾದ ಫೋನ್ ಸಂಖ್ಯೆ", "invalid_pincode": "ಅಮಾನ್ಯವಾದ ಪಿನ್‌ಕೋಡ್", "invalid_reset": "ಅಮಾನ್ಯ ಮರುಹೊಂದಿಸಿ", "invalid_username": "ಅಗತ್ಯವಿದೆ. 150 ಅಕ್ಷರಗಳು ಅಥವಾ ಕಡಿಮೆ. ಅಕ್ಷರಗಳು, ಅಂಕೆಗಳು ಮತ್ತು @/./+/-/_ ಮಾತ್ರ.", diff --git a/public/locale/ml.json b/public/locale/ml.json index 0447dc62c21..3d18c5890ae 100644 --- a/public/locale/ml.json +++ b/public/locale/ml.json @@ -1066,8 +1066,6 @@ "invalid_password": "പാസ്‌വേഡ് ആവശ്യകതകൾ പാലിക്കുന്നില്ല", "invalid_password_reset_link": "അസാധുവായ പാസ്‌വേഡ് പുനഃസജ്ജീകരണ ലിങ്ക്", "invalid_patient_data": "രോഗിയുടെ ഡാറ്റ അസാധുവാണ്", - "invalid_phone": "ദയവായി പ്രാമാണികമായ ഫോൺ നമ്പർ നൽകുക", - "invalid_phone_number": "അസാധുവായ ഫോൺ നമ്പർ", "invalid_pincode": "പിൻകോഡ് അസാധുവാണ്", "invalid_pincode_msg": "ദയവായി സാധുവായ പിൻകോഡ് നൽകുക", "invalid_reset": "അസാധുവായ റീസെറ്റ്", @@ -1963,4 +1961,4 @@ "you_need_at_least_a_location_to_create_an_assest": "ഒരു അസസ്‌റ്റ് സൃഷ്‌ടിക്കാൻ നിങ്ങൾക്ക് ഒരു ലൊക്കേഷനെങ്കിലും ആവശ്യമാണ്.", "zoom_in": "സൂം ഇൻ ചെയ്യുക", "zoom_out": "സൂം ഔട്ട്" -} +} \ No newline at end of file diff --git a/public/locale/mr.json b/public/locale/mr.json index 3d7890fe9b9..dd3112f8857 100644 --- a/public/locale/mr.json +++ b/public/locale/mr.json @@ -41,7 +41,6 @@ "goal": "डिजिटल साधनांचा वापर करून सार्वजनिक आरोग्य सेवांची गुणवत्ता आणि सुलभता सतत सुधारणे हे आमचे ध्येय आहे.", "invalid_email": "वैध ईमेल पत्ता प्रविष्ट करा.", "invalid_password": "पासवर्डसाठी आवश्यक बाबी नाहीत", - "invalid_phone": "वैध दूरध्वनी क्रमांक प्रविष्ट करा.", "invalid_username": "आवश्यक. १५० अक्षरे किंवा त्याहून कमी. फक्त अक्षरे, अंक आणि @/./+/-/_", "last_name": "आडनाव", "login": "लॉगिन", @@ -94,4 +93,4 @@ "ongoing_medications": "चालू औषधे", "allergies": "अॅलर्जी", "is_pregnant": "गर्भवती आहे" -} +} \ No newline at end of file diff --git a/public/locale/ta.json b/public/locale/ta.json index f792cb7cefd..50e884b2d1d 100644 --- a/public/locale/ta.json +++ b/public/locale/ta.json @@ -412,8 +412,6 @@ "invalid_link_msg": "நீங்கள் பயன்படுத்திய கடவுச்சொல் மீட்டமைப்பு இணைப்பு தவறானது அல்லது காலாவதியானது போல் தெரிகிறது. புதிய கடவுச்சொல் மீட்டமைப்பு இணைப்பைக் கோரவும்.", "invalid_password": "கடவுச்சொல் தேவைகளை பூர்த்தி செய்யவில்லை", "invalid_password_reset_link": "தவறான கடவுச்சொல் மீட்டமைப்பு இணைப்பு", - "invalid_phone": "செல்லுபடியாகும் தொலைபேசி எண்ணை உள்ளிடவும்", - "invalid_phone_number": "தவறான தொலைபேசி எண்", "invalid_pincode": "தவறான பின்கோடு", "invalid_reset": "தவறான மீட்டமைப்பு", "invalid_username": "தேவை. 150 எழுத்துக்கள் அல்லது குறைவானவை. எழுத்துக்கள், எண்கள் மற்றும் @ /. / + / - / _ மட்டும்.", diff --git a/scripts/sort-locales.js b/scripts/sort-locales.js index 62c3e3d8ba1..4d970452dcc 100644 --- a/scripts/sort-locales.js +++ b/scripts/sort-locales.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires const fs = require("fs"); const file = "public/locale/en.json"; diff --git a/src/Utils/utils.ts b/src/Utils/utils.ts index f67ba8e5e7d..a0694146ba1 100644 --- a/src/Utils/utils.ts +++ b/src/Utils/utils.ts @@ -2,9 +2,6 @@ import { differenceInMinutes, format } from "date-fns"; import { toPng } from "html-to-image"; import { toast } from "sonner"; -import { AREACODES, IN_LANDLINE_AREA_CODES } from "@/common/constants"; -import phoneCodesJson from "@/common/static/countryPhoneAndFlags.json"; - import dayjs from "@/Utils/dayjs"; import { Time } from "@/Utils/types"; import { Patient } from "@/types/emr/newPatient"; @@ -126,141 +123,6 @@ export const isUserOnline = (user: { last_login: DateLike }) => { : false; }; -export interface CountryData { - flag: string; - name: string; - code: string; -} - -export const parsePhoneNumber = (phoneNumber: string, countryCode?: string) => { - if (!phoneNumber) return ""; - if (phoneNumber === "+91") return ""; - const phoneCodes: Record = phoneCodesJson; - let parsedNumber = phoneNumber.replace(/[-+() ]/g, ""); - if (parsedNumber.length < 12) return ""; - if (countryCode && phoneCodes[countryCode]) { - parsedNumber = phoneCodes[countryCode].code + parsedNumber; - } else if (!phoneNumber.startsWith("+")) { - return undefined; - } - parsedNumber = "+" + parsedNumber; - return parsedNumber; -}; - -export const formatPhoneNumber = (phoneNumber: string) => { - if (phoneNumber.startsWith("+91")) { - phoneNumber = phoneNumber.startsWith("+910") - ? phoneNumber.slice(4) - : phoneNumber.slice(3); - const landline_code = IN_LANDLINE_AREA_CODES.find((code) => - phoneNumber.startsWith(code), - ); - if (landline_code === undefined) - return "+91" + " " + phoneNumber.slice(0, 5) + " " + phoneNumber.slice(5); - const subscriber_no_length = 10 - landline_code.length; - return ( - "+91" + - " " + - landline_code + - " " + - phoneNumber.slice( - landline_code.length, - subscriber_no_length / 2 + landline_code.length, - ) + - " " + - phoneNumber.slice(subscriber_no_length / 2 + landline_code.length) - ); - } else if (phoneNumber.startsWith("1800")) { - return "1800" + " " + phoneNumber.slice(4, 7) + " " + phoneNumber.slice(7); - } else if (phoneNumber.startsWith("+")) { - const countryCode = getCountryCode(phoneNumber); - if (!countryCode) return phoneNumber; - const phoneCodes: Record = phoneCodesJson; - return ( - "+" + - phoneCodes[countryCode].code + - " " + - phoneNumber.slice(phoneCodes[countryCode].code.length + 1) - ); - } - return phoneNumber; -}; - -export const getCountryCode = (phoneNumber: string) => { - if (phoneNumber.startsWith("+")) { - const phoneCodes: Record = phoneCodesJson; - const phoneCodesArr = Object.keys(phoneCodes); - phoneNumber = phoneNumber.slice(1); - const allMatchedCountries: { name: string; code: string }[] = []; - for (let i = 0; i < phoneCodesArr.length; i++) { - if ( - phoneNumber.startsWith( - phoneCodes[phoneCodesArr[i]].code.replaceAll("-", ""), - ) - ) { - allMatchedCountries.push({ - name: phoneCodesArr[i], - code: phoneCodes[phoneCodesArr[i]].code.replaceAll("-", ""), - }); - } - } - // returns the country which is longest in case there are multiple matches - if (allMatchedCountries.length === 0) return undefined; - const matchedCountry = allMatchedCountries.reduce((max, country) => - max.code > country.code ? max : country, - ); - const sameCodeCountries = allMatchedCountries.filter( - (country) => country.code === matchedCountry.code, - ); - if (matchedCountry === undefined) return undefined; - // some countries share same country code but differ in area codes - // The area codes are checked for such countries - if (matchedCountry.code == "1") { - const areaCode = phoneNumber.substring(1, 4); - return ( - sameCodeCountries.find((country) => - AREACODES[country.name]?.includes(areaCode), - )?.name ?? "US" - ); - } else if (matchedCountry.code === "262") { - const areaCode = phoneNumber.substring(3, 6); - return sameCodeCountries.find((country) => - AREACODES[country.name]?.includes(areaCode), - )?.name; - } else if (matchedCountry.code === "61") { - const areaCode = phoneNumber.substring(2, 7); - return ( - sameCodeCountries.find((country) => - AREACODES[country.name]?.includes(areaCode), - )?.name ?? "AU" - ); - } else if (matchedCountry.code === "599") { - const areaCode = phoneNumber.substring(3, 4); - return ( - sameCodeCountries.find((country) => - AREACODES[country.name]?.includes(areaCode), - )?.name ?? "CW" - ); - } else if (matchedCountry.code == "7") { - const areaCode = phoneNumber.substring(1, 2); - return ( - sameCodeCountries.find((country) => - AREACODES[country.name]?.includes(areaCode), - )?.name ?? "RU" - ); - } else if (matchedCountry.code == "47") { - const areaCode = phoneNumber.substring(2, 4); - return ( - sameCodeCountries.find((country) => - AREACODES[country.name]?.includes(areaCode), - )?.name ?? "NO" - ); - } - return matchedCountry.name; - } - return undefined; -}; - const getRelativeDateSuffix = (abbreviated: boolean) => { return { day: abbreviated ? "d" : "days", diff --git a/src/Utils/validators.ts b/src/Utils/validators.ts new file mode 100644 index 00000000000..8fc37b39f55 --- /dev/null +++ b/src/Utils/validators.ts @@ -0,0 +1,28 @@ +import { t } from "i18next"; +import { isValidPhoneNumber } from "react-phone-number-input"; +import { z } from "zod"; + +export default { + phoneNumber: { + optional: z + .string() + .optional() + .refine((val) => !val || isValidPhoneNumber(val), { + message: t("phone_number_validation_error"), + }), + required: z.string().refine((val) => isValidPhoneNumber(val), { + message: t("phone_number_validation_error"), + }), + }, + + coordinates: { + latitude: z + .number() + .min(-90, t("invalid_latitude")) + .max(90, t("invalid_latitude")), + longitude: z + .number() + .min(-180, t("invalid_longitude")) + .max(180, t("invalid_longitude")), + }, +}; diff --git a/src/common/constants.tsx b/src/common/constants.tsx index bf0c68def2f..820ace57839 100644 --- a/src/common/constants.tsx +++ b/src/common/constants.tsx @@ -380,129 +380,6 @@ export const FACILITY_FEATURE_TYPES: { }, ]; -export const AREACODES: Record = { - CA: [ - "403", - "587", - "250", - "604", - "778", - "204", - "431", - "506", - "709", - "867", - "902", - "226", - "249", - "289", - "343", - "365", - "416", - "437", - "519", - "613", - "647", - "705", - "807", - "902", - "418", - "438", - "450", - "514", - "579", - "581", - "819", - "306", - "639", - "867", - ], - JM: ["658", "876"], - PR: ["787", "939"], - DO: ["809", "829"], - RE: ["262", "263", "692", "693"], - YT: ["269", "639"], - CC: ["89162"], - CX: ["89164"], - BQ: ["9"], - KZ: ["6", "7"], - SJ: ["79"], -}; - -export const IN_LANDLINE_AREA_CODES = [ - "11", - "22", - "33", - "44", - "20", - "40", - "79", - "80", - "120", - "124", - "129", - "135", - "141", - "160", - "161", - "172", - "175", - "181", - "183", - "233", - "240", - "241", - "250", - "251", - "253", - "257", - "260", - "261", - "265", - "343", - "413", - "422", - "431", - "435", - "452", - "462", - "471", - "474", - "477", - "478", - "481", - "484", - "485", - "487", - "490", - "497", - "512", - "522", - "532", - "542", - "551", - "562", - "581", - "591", - "621", - "612", - "641", - "657", - "712", - "721", - "724", - "751", - "761", - "821", - "824", - "831", - "836", - "866", - "870", - "891", - "4822", -]; - export const SOCIOECONOMIC_STATUS_CHOICES = [ "MIDDLE_CLASS", "POOR", diff --git a/src/common/static/countryPhoneAndFlags.json b/src/common/static/countryPhoneAndFlags.json deleted file mode 100644 index ecc024647eb..00000000000 --- a/src/common/static/countryPhoneAndFlags.json +++ /dev/null @@ -1,251 +0,0 @@ -{ - "AD": { "flag": "🇦🇩", "name": "Andorra", "code": "376" }, - "AE": { "flag": "🇦🇪", "name": "United Arab Emirates", "code": "971" }, - "AF": { "flag": "🇦🇫", "name": "Afghanistan", "code": "93" }, - "AG": { "flag": "🇦🇬", "name": "Antigua & Barbuda", "code": "1-268" }, - "AI": { "flag": "🇦🇮", "name": "Anguilla", "code": "1-264" }, - "AL": { "flag": "🇦🇱", "name": "Albania", "code": "355" }, - "AM": { "flag": "🇦🇲", "name": "Armenia", "code": "374" }, - "AO": { "flag": "🇦🇴", "name": "Angola", "code": "244" }, - "AR": { "flag": "🇦🇷", "name": "Argentina", "code": "54" }, - "AS": { "flag": "🇦🇸", "name": "American Samoa", "code": "1-684" }, - "AT": { "flag": "🇦🇹", "name": "Austria", "code": "43" }, - "AU": { "flag": "🇦🇺", "name": "Australia", "code": "61" }, - "AW": { "flag": "🇦🇼", "name": "Aruba", "code": "297" }, - "AX": { "flag": "🇦🇽", "name": "Åland Islands", "code": "358-18" }, - "AZ": { "flag": "🇦🇿", "name": "Azerbaijan", "code": "994" }, - "BA": { "flag": "🇧🇦", "name": "Bosnia & Herzegovina", "code": "387" }, - "BB": { "flag": "🇧🇧", "name": "Barbados", "code": "1-246" }, - "BD": { "flag": "🇧🇩", "name": "Bangladesh", "code": "880" }, - "BE": { "flag": "🇧🇪", "name": "Belgium", "code": "32" }, - "BF": { "flag": "🇧🇫", "name": "Burkina Faso", "code": "226" }, - "BG": { "flag": "🇧🇬", "name": "Bulgaria", "code": "359" }, - "BH": { "flag": "🇧🇭", "name": "Bahrain", "code": "973" }, - "BI": { "flag": "🇧🇮", "name": "Burundi", "code": "257" }, - "BJ": { "flag": "🇧🇯", "name": "Benin", "code": "229" }, - "BL": { "flag": "🇧🇱", "name": "St. Barthélemy", "code": "590" }, - "BM": { "flag": "🇧🇲", "name": "Bermuda", "code": "1-441" }, - "BN": { "flag": "🇧🇳", "name": "Brunei", "code": "673" }, - "BO": { "flag": "🇧🇴", "name": "Bolivia", "code": "591" }, - "BQ": { "flag": "🇧🇶", "name": "Caribbean Netherlands", "code": "599" }, - "BR": { "flag": "🇧🇷", "name": "Brazil", "code": "55" }, - "BS": { "flag": "🇧🇸", "name": "Bahamas", "code": "1-242" }, - "BT": { "flag": "🇧🇹", "name": "Bhutan", "code": "975" }, - "BW": { "flag": "🇧🇼", "name": "Botswana", "code": "267" }, - "BY": { "flag": "🇧🇾", "name": "Belarus", "code": "375" }, - "BZ": { "flag": "🇧🇿", "name": "Belize", "code": "501" }, - "CA": { "flag": "🇨🇦", "name": "Canada", "code": "1" }, - "CC": { "flag": "🇨🇨", "name": "Cocos (Keeling) Islands", "code": "61" }, - "CD": { "flag": "🇨🇩", "name": "Congo - Kinshasa", "code": "243" }, - "CF": { "flag": "🇨🇫", "name": "Central African Republic", "code": "236" }, - "CG": { "flag": "🇨🇬", "name": "Congo - Brazzaville", "code": "242" }, - "CH": { "flag": "🇨🇭", "name": "Switzerland", "code": "41" }, - "CI": { "flag": "🇨🇮", "name": "Côte d’Ivoire", "code": "225" }, - "CK": { "flag": "🇨🇰", "name": "Cook Islands", "code": "682" }, - "CL": { "flag": "🇨🇱", "name": "Chile", "code": "56" }, - "CM": { "flag": "🇨🇲", "name": "Cameroon", "code": "237" }, - "CN": { "flag": "🇨🇳", "name": "China", "code": "86" }, - "CO": { "flag": "🇨🇴", "name": "Colombia", "code": "57" }, - "CR": { "flag": "🇨🇷", "name": "Costa Rica", "code": "506" }, - "CU": { "flag": "🇨🇺", "name": "Cuba", "code": "53" }, - "CV": { "flag": "🇨🇻", "name": "Cape Verde", "code": "238" }, - "CW": { "flag": "🇨🇼", "name": "Curaçao", "code": "599" }, - "CX": { "flag": "🇨🇽", "name": "Christmas Island", "code": "61" }, - "CY": { "flag": "🇨🇾", "name": "Cyprus", "code": "357" }, - "CZ": { "flag": "🇨🇿", "name": "Czechia", "code": "420" }, - "DE": { "flag": "🇩🇪", "name": "Germany", "code": "49" }, - "DJ": { "flag": "🇩🇯", "name": "Djibouti", "code": "253" }, - "DK": { "flag": "🇩🇰", "name": "Denmark", "code": "45" }, - "DM": { "flag": "🇩🇲", "name": "Dominica", "code": "1-767" }, - "DO": { "flag": "🇩🇴", "name": "Dominican Republic", "code": "1" }, - "DZ": { "flag": "🇩🇿", "name": "Algeria", "code": "213" }, - "EC": { "flag": "🇪🇨", "name": "Ecuador", "code": "593" }, - "EE": { "flag": "🇪🇪", "name": "Estonia", "code": "372" }, - "EG": { "flag": "🇪🇬", "name": "Egypt", "code": "20" }, - "EH": { "flag": "🇪🇭", "name": "Western Sahara", "code": "212" }, - "ER": { "flag": "🇪🇷", "name": "Eritrea", "code": "291" }, - "ES": { "flag": "🇪🇸", "name": "Spain", "code": "34" }, - "ET": { "flag": "🇪🇹", "name": "Ethiopia", "code": "251" }, - "FI": { "flag": "🇫🇮", "name": "Finland", "code": "358" }, - "FJ": { "flag": "🇫🇯", "name": "Fiji", "code": "679" }, - "FK": { "flag": "🇫🇰", "name": "Falkland Islands", "code": "500" }, - "FM": { "flag": "🇫🇲", "name": "Micronesia", "code": "691" }, - "FO": { "flag": "🇫🇴", "name": "Faroe Islands", "code": "298" }, - "FR": { "flag": "🇫🇷", "name": "France", "code": "33" }, - "GA": { "flag": "🇬🇦", "name": "Gabon", "code": "241" }, - "GB": { "flag": "🇬🇧", "name": "United Kingdom", "code": "44" }, - "GD": { "flag": "🇬🇩", "name": "Grenada", "code": "1-473" }, - "GE": { "flag": "🇬🇪", "name": "Georgia", "code": "995" }, - "GF": { "flag": "🇬🇫", "name": "French Guiana", "code": "594" }, - "GG": { "flag": "🇬🇬", "name": "Guernsey", "code": "44-1481" }, - "GH": { "flag": "🇬🇭", "name": "Ghana", "code": "233" }, - "GI": { "flag": "🇬🇮", "name": "Gibraltar", "code": "350" }, - "GL": { "flag": "🇬🇱", "name": "Greenland", "code": "299" }, - "GM": { "flag": "🇬🇲", "name": "Gambia", "code": "220" }, - "GN": { "flag": "🇬🇳", "name": "Guinea", "code": "224" }, - "GP": { "flag": "🇬🇵", "name": "Guadeloupe", "code": "590" }, - "GQ": { "flag": "🇬🇶", "name": "Equatorial Guinea", "code": "240" }, - "GR": { "flag": "🇬🇷", "name": "Greece", "code": "30" }, - "GT": { "flag": "🇬🇹", "name": "Guatemala", "code": "502" }, - "GU": { "flag": "🇬🇺", "name": "Guam", "code": "1-671" }, - "GW": { "flag": "🇬🇼", "name": "Guinea-Bissau", "code": "245" }, - "GY": { "flag": "🇬🇾", "name": "Guyana", "code": "592" }, - "HK": { "flag": "🇭🇰", "name": "Hong Kong SAR China", "code": "852" }, - "HM": { "flag": "🇭🇲", "name": "Heard & McDonald Islands", "code": " " }, - "HN": { "flag": "🇭🇳", "name": "Honduras", "code": "504" }, - "HR": { "flag": "🇭🇷", "name": "Croatia", "code": "385" }, - "HT": { "flag": "🇭🇹", "name": "Haiti", "code": "509" }, - "HU": { "flag": "🇭🇺", "name": "Hungary", "code": "36" }, - "ID": { "flag": "🇮🇩", "name": "Indonesia", "code": "62" }, - "IE": { "flag": "🇮🇪", "name": "Ireland", "code": "353" }, - "IL": { "flag": "🇮🇱", "name": "Israel", "code": "972" }, - "IM": { "flag": "🇮🇲", "name": "Isle of Man", "code": "44-1624" }, - "IN": { "flag": "🇮🇳", "name": "India", "code": "91" }, - "IO": { - "flag": "🇮🇴", - "name": "British Indian Ocean Territory", - "code": "246" - }, - "IQ": { "flag": "🇮🇶", "name": "Iraq", "code": "964" }, - "IR": { "flag": "🇮🇷", "name": "Iran", "code": "98" }, - "IS": { "flag": "🇮🇸", "name": "Iceland", "code": "354" }, - "IT": { "flag": "🇮🇹", "name": "Italy", "code": "39" }, - "JE": { "flag": "🇯🇪", "name": "Jersey", "code": "44-1534" }, - "JM": { "flag": "🇯🇲", "name": "Jamaica", "code": "1" }, - "JO": { "flag": "🇯🇴", "name": "Jordan", "code": "962" }, - "JP": { "flag": "🇯🇵", "name": "Japan", "code": "81" }, - "KE": { "flag": "🇰🇪", "name": "Kenya", "code": "254" }, - "KG": { "flag": "🇰🇬", "name": "Kyrgyzstan", "code": "996" }, - "KH": { "flag": "🇰🇭", "name": "Cambodia", "code": "855" }, - "KI": { "flag": "🇰🇮", "name": "Kiribati", "code": "686" }, - "KM": { "flag": "🇰🇲", "name": "Comoros", "code": "269" }, - "KN": { "flag": "🇰🇳", "name": "St. Kitts & Nevis", "code": "1-869" }, - "KP": { "flag": "🇰🇵", "name": "North Korea", "code": "850" }, - "KR": { "flag": "🇰🇷", "name": "South Korea", "code": "82" }, - "KW": { "flag": "🇰🇼", "name": "Kuwait", "code": "965" }, - "KY": { "flag": "🇰🇾", "name": "Cayman Islands", "code": "1-345" }, - "KZ": { "flag": "🇰🇿", "name": "Kazakhstan", "code": "7" }, - "LA": { "flag": "🇱🇦", "name": "Laos", "code": "856" }, - "LB": { "flag": "🇱🇧", "name": "Lebanon", "code": "961" }, - "LC": { "flag": "🇱🇨", "name": "St. Lucia", "code": "1-758" }, - "LI": { "flag": "🇱🇮", "name": "Liechtenstein", "code": "423" }, - "LK": { "flag": "🇱🇰", "name": "Sri Lanka", "code": "94" }, - "LR": { "flag": "🇱🇷", "name": "Liberia", "code": "231" }, - "LS": { "flag": "🇱🇸", "name": "Lesotho", "code": "266" }, - "LT": { "flag": "🇱🇹", "name": "Lithuania", "code": "370" }, - "LU": { "flag": "🇱🇺", "name": "Luxembourg", "code": "352" }, - "LV": { "flag": "🇱🇻", "name": "Latvia", "code": "371" }, - "LY": { "flag": "🇱🇾", "name": "Libya", "code": "218" }, - "MA": { "flag": "🇲🇦", "name": "Morocco", "code": "212" }, - "MC": { "flag": "🇲🇨", "name": "Monaco", "code": "377" }, - "MD": { "flag": "🇲🇩", "name": "Moldova", "code": "373" }, - "ME": { "flag": "🇲🇪", "name": "Montenegro", "code": "382" }, - "MF": { "flag": "🇲🇫", "name": "St. Martin", "code": "590" }, - "MG": { "flag": "🇲🇬", "name": "Madagascar", "code": "261" }, - "MH": { "flag": "🇲🇭", "name": "Marshall Islands", "code": "692" }, - "MK": { "flag": "🇲🇰", "name": "North Macedonia", "code": "389" }, - "ML": { "flag": "🇲🇱", "name": "Mali", "code": "223" }, - "MM": { "flag": "🇲🇲", "name": "Myanmar (Burma)", "code": "95" }, - "MN": { "flag": "🇲🇳", "name": "Mongolia", "code": "976" }, - "MO": { "flag": "🇲🇴", "name": "Macao SAR China", "code": "853" }, - "MP": { "flag": "🇲🇵", "name": "Northern Mariana Islands", "code": "1-670" }, - "MQ": { "flag": "🇲🇶", "name": "Martinique", "code": "596" }, - "MR": { "flag": "🇲🇷", "name": "Mauritania", "code": "222" }, - "MS": { "flag": "🇲🇸", "name": "Montserrat", "code": "1-664" }, - "MT": { "flag": "🇲🇹", "name": "Malta", "code": "356" }, - "MU": { "flag": "🇲🇺", "name": "Mauritius", "code": "230" }, - "MV": { "flag": "🇲🇻", "name": "Maldives", "code": "960" }, - "MW": { "flag": "🇲🇼", "name": "Malawi", "code": "265" }, - "MX": { "flag": "🇲🇽", "name": "Mexico", "code": "52" }, - "MY": { "flag": "🇲🇾", "name": "Malaysia", "code": "60" }, - "MZ": { "flag": "🇲🇿", "name": "Mozambique", "code": "258" }, - "NA": { "flag": "🇳🇦", "name": "Namibia", "code": "264" }, - "NC": { "flag": "🇳🇨", "name": "New Caledonia", "code": "687" }, - "NE": { "flag": "🇳🇪", "name": "Niger", "code": "227" }, - "NF": { "flag": "🇳🇫", "name": "Norfolk Island", "code": "672" }, - "NG": { "flag": "🇳🇬", "name": "Nigeria", "code": "234" }, - "NI": { "flag": "🇳🇮", "name": "Nicaragua", "code": "505" }, - "NL": { "flag": "🇳🇱", "name": "Netherlands", "code": "31" }, - "NO": { "flag": "🇳🇴", "name": "Norway", "code": "47" }, - "NP": { "flag": "🇳🇵", "name": "Nepal", "code": "977" }, - "NR": { "flag": "🇳🇷", "name": "Nauru", "code": "674" }, - "NU": { "flag": "🇳🇺", "name": "Niue", "code": "683" }, - "NZ": { "flag": "🇳🇿", "name": "New Zealand", "code": "64" }, - "OM": { "flag": "🇴🇲", "name": "Oman", "code": "968" }, - "PA": { "flag": "🇵🇦", "name": "Panama", "code": "507" }, - "PE": { "flag": "🇵🇪", "name": "Peru", "code": "51" }, - "PF": { "flag": "🇵🇫", "name": "French Polynesia", "code": "689" }, - "PG": { "flag": "🇵🇬", "name": "Papua New Guinea", "code": "675" }, - "PH": { "flag": "🇵🇭", "name": "Philippines", "code": "63" }, - "PK": { "flag": "🇵🇰", "name": "Pakistan", "code": "92" }, - "PL": { "flag": "🇵🇱", "name": "Poland", "code": "48" }, - "PM": { "flag": "🇵🇲", "name": "St. Pierre & Miquelon", "code": "508" }, - "PN": { "flag": "🇵🇳", "name": "Pitcairn Islands", "code": "870" }, - "PR": { "flag": "🇵🇷", "name": "Puerto Rico", "code": "1" }, - "PS": { "flag": "🇵🇸", "name": "Palestinian Territories", "code": "970" }, - "PT": { "flag": "🇵🇹", "name": "Portugal", "code": "351" }, - "PW": { "flag": "🇵🇼", "name": "Palau", "code": "680" }, - "PY": { "flag": "🇵🇾", "name": "Paraguay", "code": "595" }, - "QA": { "flag": "🇶🇦", "name": "Qatar", "code": "974" }, - "RE": { "flag": "🇷🇪", "name": "Réunion", "code": "262" }, - "RO": { "flag": "🇷🇴", "name": "Romania", "code": "40" }, - "RS": { "flag": "🇷🇸", "name": "Serbia", "code": "381" }, - "RU": { "flag": "🇷🇺", "name": "Russia", "code": "7" }, - "RW": { "flag": "🇷🇼", "name": "Rwanda", "code": "250" }, - "SA": { "flag": "🇸🇦", "name": "Saudi Arabia", "code": "966" }, - "SB": { "flag": "🇸🇧", "name": "Solomon Islands", "code": "677" }, - "SC": { "flag": "🇸🇨", "name": "Seychelles", "code": "248" }, - "SD": { "flag": "🇸🇩", "name": "Sudan", "code": "249" }, - "SE": { "flag": "🇸🇪", "name": "Sweden", "code": "46" }, - "SG": { "flag": "🇸🇬", "name": "Singapore", "code": "65" }, - "SH": { "flag": "🇸🇭", "name": "St. Helena", "code": "290" }, - "SI": { "flag": "🇸🇮", "name": "Slovenia", "code": "386" }, - "SJ": { "flag": "🇸🇯", "name": "Svalbard & Jan Mayen", "code": "47" }, - "SK": { "flag": "🇸🇰", "name": "Slovakia", "code": "421" }, - "SL": { "flag": "🇸🇱", "name": "Sierra Leone", "code": "232" }, - "SM": { "flag": "🇸🇲", "name": "San Marino", "code": "378" }, - "SN": { "flag": "🇸🇳", "name": "Senegal", "code": "221" }, - "SO": { "flag": "🇸🇴", "name": "Somalia", "code": "252" }, - "SR": { "flag": "🇸🇷", "name": "Suriname", "code": "597" }, - "SS": { "flag": "🇸🇸", "name": "South Sudan", "code": "211" }, - "ST": { "flag": "🇸🇹", "name": "São Tomé & Príncipe", "code": "239" }, - "SV": { "flag": "🇸🇻", "name": "El Salvador", "code": "503" }, - "SX": { "flag": "🇸🇽", "name": "Sint Maarten", "code": "1-721" }, - "SY": { "flag": "🇸🇾", "name": "Syria", "code": "963" }, - "SZ": { "flag": "🇸🇿", "name": "Eswatini", "code": "268" }, - "TC": { "flag": "🇹🇨", "name": "Turks & Caicos Islands", "code": "1-649" }, - "TD": { "flag": "🇹🇩", "name": "Chad", "code": "235" }, - "TG": { "flag": "🇹🇬", "name": "Togo", "code": "228" }, - "TH": { "flag": "🇹🇭", "name": "Thailand", "code": "66" }, - "TJ": { "flag": "🇹🇯", "name": "Tajikistan", "code": "992" }, - "TK": { "flag": "🇹🇰", "name": "Tokelau", "code": "690" }, - "TL": { "flag": "🇹🇱", "name": "Timor-Leste", "code": "670" }, - "TM": { "flag": "🇹🇲", "name": "Turkmenistan", "code": "993" }, - "TN": { "flag": "🇹🇳", "name": "Tunisia", "code": "216" }, - "TO": { "flag": "🇹🇴", "name": "Tonga", "code": "676" }, - "TR": { "flag": "🇹🇷", "name": "Turkey", "code": "90" }, - "TT": { "flag": "🇹🇹", "name": "Trinidad & Tobago", "code": "1-868" }, - "TV": { "flag": "🇹🇻", "name": "Tuvalu", "code": "688" }, - "TW": { "flag": "🇹🇼", "name": "Taiwan", "code": "886" }, - "TZ": { "flag": "🇹🇿", "name": "Tanzania", "code": "255" }, - "UA": { "flag": "🇺🇦", "name": "Ukraine", "code": "380" }, - "UG": { "flag": "🇺🇬", "name": "Uganda", "code": "256" }, - "UM": { "flag": "🇺🇲", "name": "U.S. Outlying Islands", "code": "1" }, - "US": { "flag": "🇺🇸", "name": "United States", "code": "1" }, - "UY": { "flag": "🇺🇾", "name": "Uruguay", "code": "598" }, - "UZ": { "flag": "🇺🇿", "name": "Uzbekistan", "code": "998" }, - "VA": { "flag": "🇻🇦", "name": "Vatican City", "code": "379" }, - "VC": { "flag": "🇻🇨", "name": "St. Vincent & Grenadines", "code": "1-784" }, - "VE": { "flag": "🇻🇪", "name": "Venezuela", "code": "58" }, - "VG": { "flag": "🇻🇬", "name": "British Virgin Islands", "code": "1-284" }, - "VI": { "flag": "🇻🇮", "name": "U.S. Virgin Islands", "code": "1-340" }, - "VN": { "flag": "🇻🇳", "name": "Vietnam", "code": "84" }, - "VU": { "flag": "🇻🇺", "name": "Vanuatu", "code": "678" }, - "WF": { "flag": "🇼🇫", "name": "Wallis & Futuna", "code": "681" }, - "WS": { "flag": "🇼🇸", "name": "Samoa", "code": "685" }, - "YE": { "flag": "🇾🇪", "name": "Yemen", "code": "967" }, - "YT": { "flag": "🇾🇹", "name": "Mayotte", "code": "262" }, - "ZA": { "flag": "🇿🇦", "name": "South Africa", "code": "27" }, - "ZM": { "flag": "🇿🇲", "name": "Zambia", "code": "260" }, - "ZW": { "flag": "🇿🇼", "name": "Zimbabwe", "code": "263" } -} diff --git a/src/common/validation.tsx b/src/common/validation.tsx index a8bce0bcfbe..e875f243d55 100644 --- a/src/common/validation.tsx +++ b/src/common/validation.tsx @@ -1,19 +1,3 @@ -export const phonePreg = (phone: string) => { - const pattern = /^((\+91|91|0)[- ]{0,1})?[123456789]\d{9}$/; - return pattern.test(phone); -}; - -const valueIsBetween = (val: number, a: number, b: number) => - a <= val && val <= b; - -export const validateLatitude = (latitude: number) => { - return valueIsBetween(Number(latitude), -90, 90); -}; - -export const validateLongitude = (longitude: number) => { - return valueIsBetween(Number(longitude), -180, 180); -}; - export const validateName = (name: string) => { return name.length >= 3; }; diff --git a/src/components/Auth/Login.tsx b/src/components/Auth/Login.tsx index 8d77e0d95d4..efd4403c23d 100644 --- a/src/components/Auth/Login.tsx +++ b/src/components/Auth/Login.tsx @@ -4,6 +4,7 @@ import { Link, useQueryParams } from "raviger"; import { useState } from "react"; import ReCaptcha from "react-google-recaptcha"; import { useTranslation } from "react-i18next"; +import { isValidPhoneNumber } from "react-phone-number-input"; import { toast } from "sonner"; import { cn } from "@/lib/utils"; @@ -21,6 +22,7 @@ import { import { Input } from "@/components/ui/input"; import { PasswordInput } from "@/components/ui/input-password"; import { Label } from "@/components/ui/label"; +import { PhoneInput } from "@/components/ui/phone-input"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import CircularProgress from "@/components/Common/CircularProgress"; @@ -110,7 +112,7 @@ const Login = (props: LoginProps) => { const { mutate: sendOtp, isPending: sendOtpPending } = useMutation({ mutationFn: async (phone: string) => { const response = await request(routes.otp.sendOtp, { - body: { phone_number: `+91${phone}` }, + body: { phone_number: phone }, silent: true, }); return response; @@ -148,7 +150,7 @@ const Login = (props: LoginProps) => { setOtpValidationError(""); const tokenData: TokenData = { token: access, - phoneNumber: `+91${phone}`, + phoneNumber: phone, createdAt: new Date().toISOString(), }; patientLogin(tokenData, `/patient/home`); @@ -183,22 +185,6 @@ const Login = (props: LoginProps) => { }, }); - // Format phone number to include +91 - const formatPhoneNumber = (value: string) => { - // Remove any non-digit characters - const digits = value.replace(/\D/g, ""); - // Limit to 10 digits - const truncated = digits.slice(0, 10); - return truncated; - }; - - const handlePhoneChange = (e: React.ChangeEvent) => { - const formattedNumber = formatPhoneNumber(e.target.value); - setPhone(formattedNumber); - setOtpError(""); // Clear error when input changes - setOtpValidationError(""); - }; - // Login form validation const handleChange = (e: any) => { const { value, name } = e.target; @@ -297,7 +283,7 @@ const Login = (props: LoginProps) => { await sendOtp(phone); setIsOtpSent(true); } else { - await verifyOtp({ phone_number: `+91${phone}`, otp }); + await verifyOtp({ phone_number: phone, otp }); } } catch (error: any) { if (!isOtpSent) { @@ -633,21 +619,18 @@ const Login = (props: LoginProps) => {
-
- - +91 - - -
+ { + setPhone(value); + setOtpError(""); + setOtpValidationError(""); + }} + disabled={isOtpSent} + placeholder={t("enter_phone_number")} + /> {otpError && (

{otpError}

)} @@ -694,8 +677,7 @@ const Login = (props: LoginProps) => { variant="primary" disabled={ isLoading || - !phone || - phone.length !== 10 || + !isValidPhoneNumber(phone) || (isOtpSent && otp.length !== 5) } > diff --git a/src/components/Common/AvatarEditModal.tsx b/src/components/Common/AvatarEditModal.tsx index 65132eccd59..31d0f772a60 100644 --- a/src/components/Common/AvatarEditModal.tsx +++ b/src/components/Common/AvatarEditModal.tsx @@ -257,7 +257,12 @@ const AvatarEditModal = ({
-
)} {item.value.value && ( -
{item.value.value}
+
+ {item.value.value} +
)} {item.note && (
diff --git a/src/components/Facility/ConsultationDetails/QuestionnaireResponsesList.tsx b/src/components/Facility/ConsultationDetails/QuestionnaireResponsesList.tsx index 8d701f09393..11ba2b75c7b 100644 --- a/src/components/Facility/ConsultationDetails/QuestionnaireResponsesList.tsx +++ b/src/components/Facility/ConsultationDetails/QuestionnaireResponsesList.tsx @@ -50,7 +50,7 @@ function QuestionResponseValue({ )}
-
+
{formatValue(String(value), question.type)} {response.note && ( diff --git a/src/components/Facility/FacilityForm.tsx b/src/components/Facility/FacilityForm.tsx index 711deb881b1..bac5b022fdc 100644 --- a/src/components/Facility/FacilityForm.tsx +++ b/src/components/Facility/FacilityForm.tsx @@ -20,6 +20,7 @@ import { } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { MultiSelect } from "@/components/ui/multi-select"; +import { PhoneInput } from "@/components/ui/phone-input"; import { Select, SelectContent, @@ -34,16 +35,12 @@ import { FacilityModel } from "@/components/Facility/models"; import { useStateAndDistrictFromPincode } from "@/hooks/useStateAndDistrictFromPincode"; import { FACILITY_FEATURE_TYPES, FACILITY_TYPES } from "@/common/constants"; -import { - validateLatitude, - validateLongitude, - validatePincode, -} from "@/common/validation"; +import { validatePincode } from "@/common/validation"; import routes from "@/Utils/request/api"; import mutate from "@/Utils/request/mutate"; import query from "@/Utils/request/query"; -import { parsePhoneNumber } from "@/Utils/utils"; +import validators from "@/Utils/validators"; import GovtOrganizationSelector from "@/pages/Organization/components/GovtOrganizationSelector"; import { BaseFacility } from "@/types/facility/facility"; import { Organization } from "@/types/organization/organization"; @@ -69,19 +66,11 @@ export default function FacilityForm(props: FacilityProps) { description: z.string().optional(), features: z.array(z.number()).default([]), pincode: z.string().refine(validatePincode, t("invalid_pincode")), - geo_organization: z.string().min(1, t("organization_required")), + geo_organization: z.string().min(1, t("field_required")), address: z.string().min(1, t("address_is_required")), - phone_number: z - .string() - .regex(/^\+91[0-9]{10}$/, t("phone_number_validation")), - latitude: z - .number() - .optional() - .refine((val) => !val || validateLatitude(val), t("invalid_latitude")), - longitude: z - .number() - .optional() - .refine((val) => !val || validateLongitude(val), t("invalid_longitude")), + phone_number: validators.phoneNumber.required, + latitude: validators.coordinates.latitude.optional(), + longitude: validators.coordinates.longitude.optional(), is_public: z.boolean().default(false), }); @@ -97,7 +86,7 @@ export default function FacilityForm(props: FacilityProps) { pincode: "", geo_organization: "", address: "", - phone_number: "+91", + phone_number: "", latitude: undefined, longitude: undefined, is_public: false, @@ -141,15 +130,10 @@ export default function FacilityForm(props: FacilityProps) { const onSubmit: (data: FacilityFormValues) => void = ( data: FacilityFormValues, ) => { - const requestData = { - ...data, - phone_number: parsePhoneNumber(data.phone_number), - }; - if (facilityId) { - updateFacility(requestData); + updateFacility(data); } else { - createFacility(requestData); + createFacility(data); } }; @@ -170,7 +154,7 @@ export default function FacilityForm(props: FacilityProps) { }, (error) => { setIsGettingLocation(false); - toast.error(t("unable_to_get_location") + error.message); + toast.error(t("unable_to_get_current_location") + error.message); }, { timeout: 10000 }, ); @@ -246,7 +230,7 @@ export default function FacilityForm(props: FacilityProps) { name="facility_type" render={({ field }) => ( - Facility Type + {t("facility_type")} ( - Description + {t("description")}