From 3e0c7fbe77f62283b12ab3b4ea6d6099907b33d2 Mon Sep 17 00:00:00 2001 From: Sarthak Kumar Shailendra <69191344+sarthak-kumar-shailendra@users.noreply.github.com> Date: Sun, 6 Oct 2024 02:56:38 +0530 Subject: [PATCH 1/6] fix: correct the url for flag images --- .../src/sections/phoneNumber/phoneNumber-form.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx b/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx index 91c2cfae..ce181950 100644 --- a/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx +++ b/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx @@ -19,6 +19,8 @@ import { localPhoneNumbersByDialCodeMap, } from './data/phoneNumber'; +import { getFlagOfCountry } from '@razorpay/i18nify-js'; + const PhoneNumberForm = ({ inpValue, onInpChange, @@ -82,15 +84,15 @@ const PhoneNumberForm = ({ >
+ {code}
From 52d3a1a0d3226ef3cf4634a9ac811ec044b187a6 Mon Sep 17 00:00:00 2001 From: Sarthak Kumar Shailendra <69191344+sarthak-kumar-shailendra@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:54:27 +0530 Subject: [PATCH 2/6] Update phoneNumber-form.jsx --- .../src/sections/phoneNumber/phoneNumber-form.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx b/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx index ce181950..3bb071a9 100644 --- a/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx +++ b/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx @@ -84,7 +84,7 @@ const PhoneNumberForm = ({ >
+ {code}
Date: Fri, 11 Oct 2024 21:42:05 +0530 Subject: [PATCH 3/6] correcting the url to avoid error --- packages/i18nify-playground/src/constants/phoneNumber/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/i18nify-playground/src/constants/phoneNumber/index.js b/packages/i18nify-playground/src/constants/phoneNumber/index.js index e057216d..c0016cd3 100644 --- a/packages/i18nify-playground/src/constants/phoneNumber/index.js +++ b/packages/i18nify-playground/src/constants/phoneNumber/index.js @@ -18,3 +18,6 @@ export const PHONE_MASKING_INPUTS = [ type: 'number', }, ]; + +export const FLAG_4X3_BASE_PATH = + 'https://unpkg.com/@razorpay/i18nify-js/lib/assets/flags'; From 35e5ea07716b9c47ca8be424e7d7114bef356d77 Mon Sep 17 00:00:00 2001 From: Sarthak Kumar Shailendra <69191344+sarthak-kumar-shailendra@users.noreply.github.com> Date: Fri, 11 Oct 2024 21:42:54 +0530 Subject: [PATCH 4/6] correcting the url to avoid error --- .../src/sections/phoneNumber/phoneNumber-form.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx b/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx index 3bb071a9..38a3e4a2 100644 --- a/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx +++ b/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx @@ -19,7 +19,7 @@ import { localPhoneNumbersByDialCodeMap, } from './data/phoneNumber'; -import { getFlagOfCountry } from '@razorpay/i18nify-js'; +import { FLAG_4X3_BASE_PATH } from 'src/constants/phoneNumber'; const PhoneNumberForm = ({ inpValue, @@ -90,9 +90,9 @@ const PhoneNumberForm = ({ marginRight: 8, }} loading="lazy" - src={getFlagOfCountry(dialCodeCountryCodeMap[ + src={`${FLAG_4X3_BASE_PATH}/${dialCodeCountryCodeMap[ code - ][0])['4X3']} + ][0].toLocaleLowerCase()}.svg`} /> From bf51fafc4d04a511761b92148647c815555e1be9 Mon Sep 17 00:00:00 2001 From: Sarthak Kumar Shailendra <69191344+sarthak-kumar-shailendra@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:04:28 +0530 Subject: [PATCH 5/6] Update index.js --- .../i18nify-playground/src/constants/phoneNumber/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/i18nify-playground/src/constants/phoneNumber/index.js b/packages/i18nify-playground/src/constants/phoneNumber/index.js index c0016cd3..08ab38ab 100644 --- a/packages/i18nify-playground/src/constants/phoneNumber/index.js +++ b/packages/i18nify-playground/src/constants/phoneNumber/index.js @@ -19,5 +19,5 @@ export const PHONE_MASKING_INPUTS = [ }, ]; -export const FLAG_4X3_BASE_PATH = - 'https://unpkg.com/@razorpay/i18nify-js/lib/assets/flags'; +export const FLAG_CDN_BASE_PATH = + 'https://flagcdn.com'; From e347a9cf7ba454389f4d94514a29ae437d50594b Mon Sep 17 00:00:00 2001 From: Sarthak Kumar Shailendra <69191344+sarthak-kumar-shailendra@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:06:05 +0530 Subject: [PATCH 6/6] Added cases to handle 001 and ac country code --- .../src/sections/phoneNumber/phoneNumber-form.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx b/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx index 38a3e4a2..7acd71e3 100644 --- a/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx +++ b/packages/i18nify-playground/src/sections/phoneNumber/phoneNumber-form.jsx @@ -19,7 +19,7 @@ import { localPhoneNumbersByDialCodeMap, } from './data/phoneNumber'; -import { FLAG_4X3_BASE_PATH } from 'src/constants/phoneNumber'; +import { FLAG_CDN_BASE_PATH } from 'src/constants/phoneNumber'; const PhoneNumberForm = ({ inpValue, @@ -90,9 +90,11 @@ const PhoneNumberForm = ({ marginRight: 8, }} loading="lazy" - src={`${FLAG_4X3_BASE_PATH}/${dialCodeCountryCodeMap[ - code - ][0].toLocaleLowerCase()}.svg`} + src={`${FLAG_CDN_BASE_PATH}/${ + dialCodeCountryCodeMap[code][0].toLocaleLowerCase() === '001'? 'us' : + dialCodeCountryCodeMap[code][0].toLocaleLowerCase() === 'ac' ? 'sh' : + dialCodeCountryCodeMap[code][0].toLocaleLowerCase() + }.svg`} />