Bump to support intl tel input 21#54
Conversation
i'll take a look at this change, thanks for pointing it to me.
That's not how I understand the doc
I suppose we should had a new |
|
Yeah you are right i will come back to you with a proposition. I see that with the last version intl-tel-input is bundled with types so i took the liberty to replace your types by the type of intl-tel-input project. |
|
So as said before i replace your types by the types from intl-tel-input. I add a new Input variable isMobileOnly default true (like i understand from the doc) |
| @Input() options: IntlTelInputOptions = {}; | ||
| @Input() options: SomeOptions = {}; | ||
| @Input() required!: boolean; | ||
| @Input() isMobileOnly: boolean = true; |
There was a problem hiding this comment.
This should go in a dedicated commit, and tests should be added.Also, I think that it should be false by default to be the least breaking as possible
| import intlTelInput from 'intl-tel-input'; | ||
| import { IntlTelInputOptions } from '../model/intl-tel-input-options'; | ||
| import { IntlTelInput } from "../model/intl-tel-input"; | ||
| import intlTelInput, {Iti, SomeOptions} from 'intl-tel-input'; |
There was a problem hiding this comment.
With v21.0.6, tsconfig.json needs to be changed, like this
"paths": {
"intl-tel-input": [
"node_modules/intl-tel-input/build/js/intlTelInput"
]
},and old path must be removed
"paths": {
"intl-tel-input": [
"src/lib/@types/intl-tel-input"
]
}There was a problem hiding this comment.
I think this is an error from upstream, will open a PR for discussion. We shouldn't need that
There was a problem hiding this comment.
21.0.8+ fixes this, so not needed (old path must still be cleaned up). You may npm update anyway, and see how it goes.
|
|
||
| it('should convert phone number to E164 format', () => { | ||
| component.options = { | ||
| initialCountry: 'ch', |
There was a problem hiding this comment.
I suppose we can't do better, uh
| i18n: { ch: 'Suisse' }, | ||
| onlyCountries: ['fr', 'ch'] | ||
| }" | ||
| [isMobileOnly]=false |
There was a problem hiding this comment.
please reindent and set to true as we'll switch to false by default
|
@tlebreton also please run |
Hi :)
This pr allow us to use intl-tel-input 21 Changelog 20 Changelog 21
I don't think verison 21 is a big problem for your package (maybe i am wrong :D )
I needed to update test unit because of this :
Remove defaultToFirstCountry option as that behaviour was jackocnr/intl-tel-input#1525 (comment) and so is not recommended (you can always use initialCountry to set the initial country if you wish to)
I decide to add initialCountry: "ch" because it solve test but don't know if it's correct or not.
Another thinks that changes is the way validNumber works :
By default, calling isValidNumber will now default to mobile-only mode (it will only return true for valid mobile numbers), which means it will be jackocnr/intl-tel-input#1535 - if you don't want this, you can pass false as an argument e.g. isValidNumber(false)
It can be solved with another options 'isMobileVerification' with default to true(like intl-tel-input)
What is your opinion on this subject ?