@temboplus/frontend-core
Version:
A JavaScript/TypeScript package providing common utilities and logic shared across front-end TemboPlus projects.
46 lines (45 loc) • 2.29 kB
TypeScript
import { ISO2CountryCode } from "@models/country/country.types.js";
import { MNOInfo } from "@models/phone-number/mno/mno.types.js";
import { PhoneNumber } from "@models/phone-number/phone-number.js";
import { type ParsedPhoneNumber, PhoneNumberService } from "@models/phone-number/phone-number.service.js";
import { type PhoneNumberContract, type PhoneNumberParseOptions, PhoneNumberType } from "@models/phone-number/phone-number.types.js";
/**
* Represents a validated Kenyan (KE) **mobile** phone number.
* Extends the generic PhoneNumber class and implements the common PhoneNumberContract interface.
* Note: Does not provide MNO details as per requirement.
*/
export declare class KEMobileNumber extends PhoneNumber implements PhoneNumberContract {
readonly countryCode: ISO2CountryCode;
/**
* Protected constructor. Use static `from` method for instantiation.
* Calls the base class constructor.
*/
protected constructor(parsedInfo: ParsedPhoneNumber, service: PhoneNumberService);
/**
* Validates the structure for a Kenyan **mobile** phone number.
* Checks base validity AND ensures the national number starts with a valid KE mobile prefix.
* @returns {boolean} True if the number is a valid KE mobile number structure.
*/
validate(): boolean;
/**
* Gets associated mobile operator information. Returns undefined for KE.
* Overrides the base implementation.
* @returns {MNOInfo | undefined} Always returns undefined.
*/
getOperatorInfo(): MNOInfo | undefined;
/**
* Gets the specific type for this class, overriding the base method.
* @returns {PhoneNumberType} Always returns MOBILE.
*/
getNumberType(): PhoneNumberType;
/**
* Attempts to create a `KEMobileNumber` instance from a given string input.
* Performs KE-specific parsing and validation FIRST, then uses the core
* service for final validation and object creation.
*
* @param input - The input phone number string.
* @param options - Parsing options (optional).
* @returns {KEMobileNumber | undefined} An instance if valid, otherwise undefined.
*/
static from(input: string | null | undefined, options?: PhoneNumberParseOptions): KEMobileNumber | undefined;
}