refactor: update WHMCS phone country code handling and schema validation
- Modify the phoneCountryCode assignment in the WHMCS mapper to ensure it is always a string when present. - Change the phonecc type in the WHMCS raw types schema to use numberLike for improved type safety and validation consistency.
This commit is contained in:
parent
1156398caa
commit
f4918b8a79
@ -56,7 +56,7 @@ function normalizeAddress(client: WhmcsRawClient): Address | undefined {
|
|||||||
country: client.country ?? null,
|
country: client.country ?? null,
|
||||||
countryCode: client.countrycode ?? null,
|
countryCode: client.countrycode ?? null,
|
||||||
phoneNumber: client.phonenumberformatted ?? client.phonenumber ?? null,
|
phoneNumber: client.phonenumberformatted ?? client.phonenumber ?? null,
|
||||||
phoneCountryCode: client.phonecc ?? null,
|
phoneCountryCode: client.phonecc == null ? null : String(client.phonecc),
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasValues = Object.values(address).some(v => v !== undefined && v !== null && v !== "");
|
const hasValues = Object.values(address).some(v => v !== undefined && v !== null && v !== "");
|
||||||
|
|||||||
@ -119,7 +119,7 @@ export const whmcsClientSchema = z
|
|||||||
postcode: z.string().optional(),
|
postcode: z.string().optional(),
|
||||||
country: z.string().optional(),
|
country: z.string().optional(),
|
||||||
countrycode: z.string().optional(),
|
countrycode: z.string().optional(),
|
||||||
phonecc: z.string().optional(),
|
phonecc: numberLike.optional(),
|
||||||
phonenumber: z.string().optional(),
|
phonenumber: z.string().optional(),
|
||||||
phonenumberformatted: z.string().optional(),
|
phonenumberformatted: z.string().optional(),
|
||||||
telephoneNumber: z.string().optional(),
|
telephoneNumber: z.string().optional(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user