@webitel/api-services 26.8.73 → 26.8.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/clients/emails/emails.ts +1 -1
- package/src/api/clients/imClients/imClients.ts +1 -1
- package/src/api/clients/phones/phones.ts +1 -1
- package/src/api/clients/variables/variables.ts +1 -1
- package/src/validations/_shared/__tests__/phoneNumber.validations.spec.ts +1 -1
- package/src/validations/_shared/phoneNumber.validations.ts +3 -15
- package/types/.tsbuildinfo +1 -1
- package/types/validations/_shared/phoneNumber.validations.d.ts +0 -6
package/package.json
CHANGED
|
@@ -19,12 +19,12 @@ describe('phoneNumberSchema', () => {
|
|
|
19
19
|
'1-800-FLOWERS',
|
|
20
20
|
"a.b!c~d*e'f(g)",
|
|
21
21
|
'+(044)123-45-67',
|
|
22
|
+
'+',
|
|
22
23
|
])('accepts %j', (value) => {
|
|
23
24
|
expect(phoneNumberSchema.safeParse(value).success).toBe(true);
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
it.each([
|
|
27
|
-
'+',
|
|
28
28
|
'++380',
|
|
29
29
|
'380+',
|
|
30
30
|
'38+0',
|
|
@@ -2,22 +2,10 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
import { i18nIssue } from './i18nIssue';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* `+` only as a leading sign. Shared by all phone-shaped fields (member
|
|
8
|
-
* destination, resource number, csv imports).
|
|
9
|
-
*
|
|
10
|
-
* [WTEL-9678](https://webitel.atlassian.net/browse/WTEL-9678),
|
|
11
|
-
* [WTEL-10374](https://webitel.atlassian.net/browse/WTEL-10374)
|
|
12
|
-
*/
|
|
13
|
-
const phoneNumberPattern = /^\+?[A-Za-z0-9\-_.!~*'()]+$/;
|
|
5
|
+
// optional leading `+`, then latin letters, digits and `- _ . ! ~ * ' ( )`
|
|
6
|
+
const phoneNumberPattern = /^\+?[A-Za-z0-9\-_.!~*'()]*$/;
|
|
14
7
|
|
|
15
|
-
|
|
16
|
-
* Required phone-shaped value.
|
|
17
|
-
*
|
|
18
|
-
* `refine`, not `regex`: only a `custom` issue passes `params.i18nKey` to the ui.
|
|
19
|
-
* Empty string passes the refinement, so a blank field reports only `required`.
|
|
20
|
-
*/
|
|
8
|
+
// `refine`, not `regex`: only a `custom` issue carries `params.i18nKey`
|
|
21
9
|
export const phoneNumberSchema = z
|
|
22
10
|
.string()
|
|
23
11
|
.min(1)
|