Files
Laca-City/backend/node_modules/libphonenumber-js/es6/legacy/isValidNumberForRegion.js
PhongPham c65cc97a33 🎯 MapView v2.0 - Global Deployment Ready
 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
2025-07-20 19:52:16 +07:00

67 lines
2.4 KiB
JavaScript

import isViablePhoneNumber from '../helpers/isViablePhoneNumber.js';
import parseNumber from '../parse.js';
import _isValidNumberForRegion from './isValidNumberForRegion_.js'; // This function has been deprecated and is not exported as
// `isValidPhoneNumberForCountry()` or `isValidPhoneNumberForRegion()`.
//
// The rationale is:
//
// * We don't use the "region" word, so "country" would be better.
//
// * It could be substituted with:
//
// ```js
// export default function isValidPhoneNumberForCountry(phoneNumberString, country) {
// const phoneNumber = parsePhoneNumber(phoneNumberString, {
// defaultCountry: country,
// // Demand that the entire input string must be a phone number.
// // Otherwise, it would "extract" a phone number from an input string.
// extract: false
// })
// if (!phoneNumber) {
// return false
// }
// if (phoneNumber.country !== country) {
// return false
// }
// return phoneNumber.isValid()
// }
// ```
//
// * Same function could be used for `isPossiblePhoneNumberForCountry()`
// by replacing `isValid()` with `isPossible()`.
//
// * The reason why this function is not exported is because its result is ambiguous.
// Suppose `false` is returned. It could mean any of:
// * Not a phone number.
// * The phone number is valid but belongs to another country or another calling code.
// * The phone number belongs to the correct country but is not valid digit-wise.
// All those three cases should be handled separately from a "User Experience" standpoint.
// Simply showing "Invalid phone number" error in all of those cases would be lazy UX.
export default function isValidNumberForRegion(number, country, metadata) {
if (typeof number !== 'string') {
throw new TypeError('number must be a string');
}
if (typeof country !== 'string') {
throw new TypeError('country must be a string');
} // `parse` extracts phone numbers from raw text,
// therefore it will cut off all "garbage" characters,
// while this `validate` function needs to verify
// that the phone number contains no "garbage"
// therefore the explicit `isViablePhoneNumber` check.
var input;
if (isViablePhoneNumber(number)) {
input = parseNumber(number, {
defaultCountry: country
}, metadata);
} else {
input = {};
}
return _isValidNumberForRegion(input, country, undefined, metadata);
}
//# sourceMappingURL=isValidNumberForRegion.js.map