@mvf/external-components 3.32.3-dev.0 → 3.32.3
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/Components/Molecules/PhoneNumberTextFieldCustom/__helpers__/utils/phoneUtilSingleton.d.ts +0 -25
- package/Components/Molecules/PhoneNumberTextFieldCustom/__helpers__/utils/phoneUtilSingleton.js +0 -94
- package/Components/Molecules/PhoneNumberTextFieldCustom/__helpers__/utils/phoneUtilSingleton.js.map +0 -1
- package/Components/Molecules/PhoneNumberTextFieldCustom/__helpers__/utils/phoneUtilSingleton.test.d.ts +0 -0
- package/Components/Molecules/PhoneNumberTextFieldCustom/__helpers__/utils/phoneUtilSingleton.test.js +0 -2
- package/Components/Molecules/PhoneNumberTextFieldCustom/__helpers__/utils/phoneUtilSingleton.test.js.map +0 -1
package/package.json
CHANGED
package/Components/Molecules/PhoneNumberTextFieldCustom/__helpers__/utils/phoneUtilSingleton.d.ts
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
import { PhoneNumberUtil, AsYouTypeFormatter } from 'google-libphonenumber';
|
2
|
-
import { CountryCode } from './countryData';
|
3
|
-
/**
|
4
|
-
* Gets the singleton PhoneNumberUtil instance with proper error handling
|
5
|
-
* @returns PhoneNumberUtil instance or mock fallback
|
6
|
-
*/
|
7
|
-
export declare const getPhoneUtil: () => PhoneNumberUtil;
|
8
|
-
/**
|
9
|
-
* Gets a cached AsYouTypeFormatter for the specified country
|
10
|
-
* @param countryCode - The country code to get formatter for
|
11
|
-
* @returns Cached or new AsYouTypeFormatter instance
|
12
|
-
*/
|
13
|
-
export declare const getFormatter: (countryCode: CountryCode) => AsYouTypeFormatter;
|
14
|
-
/**
|
15
|
-
* Clears the formatter cache (useful for testing or memory management)
|
16
|
-
*/
|
17
|
-
export declare const clearFormatterCache: () => void;
|
18
|
-
/**
|
19
|
-
* Gets the current cache size (useful for monitoring/debugging)
|
20
|
-
*/
|
21
|
-
export declare const getFormatterCacheSize: () => number;
|
22
|
-
/**
|
23
|
-
* Resets the PhoneNumberUtil singleton (useful for testing)
|
24
|
-
*/
|
25
|
-
export declare const resetPhoneUtilInstance: () => void;
|
package/Components/Molecules/PhoneNumberTextFieldCustom/__helpers__/utils/phoneUtilSingleton.js
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.resetPhoneUtilInstance = exports.getFormatterCacheSize = exports.clearFormatterCache = exports.getFormatter = exports.getPhoneUtil = void 0;
|
4
|
-
var google_libphonenumber_1 = require("google-libphonenumber");
|
5
|
-
// Singleton PhoneNumberUtil instance
|
6
|
-
var phoneUtilInstance = null;
|
7
|
-
/**
|
8
|
-
* Creates a mock PhoneNumberUtil for fallback when initialization fails
|
9
|
-
*/
|
10
|
-
var createMockPhoneUtil = function () {
|
11
|
-
return {
|
12
|
-
parse: function () { return null; },
|
13
|
-
isValidNumber: function () { return false; },
|
14
|
-
format: function () { return ''; },
|
15
|
-
getRegionCodeForNumber: function () { return undefined; },
|
16
|
-
getNumberType: function () { return undefined; },
|
17
|
-
getExampleNumber: function () { return null; },
|
18
|
-
getCountryCodeForRegion: function () { return undefined; },
|
19
|
-
isPossibleNumberWithReason: function () { return undefined; },
|
20
|
-
};
|
21
|
-
};
|
22
|
-
/**
|
23
|
-
* Gets the singleton PhoneNumberUtil instance with proper error handling
|
24
|
-
* @returns PhoneNumberUtil instance or mock fallback
|
25
|
-
*/
|
26
|
-
var getPhoneUtil = function () {
|
27
|
-
if (!phoneUtilInstance) {
|
28
|
-
try {
|
29
|
-
phoneUtilInstance = google_libphonenumber_1.PhoneNumberUtil.getInstance();
|
30
|
-
}
|
31
|
-
catch (error) {
|
32
|
-
console.error('Failed to initialize PhoneNumberUtil:', error);
|
33
|
-
phoneUtilInstance = createMockPhoneUtil();
|
34
|
-
}
|
35
|
-
}
|
36
|
-
return phoneUtilInstance;
|
37
|
-
};
|
38
|
-
exports.getPhoneUtil = getPhoneUtil;
|
39
|
-
// AsYouTypeFormatter cache
|
40
|
-
var formatterCache = new Map();
|
41
|
-
/**
|
42
|
-
* Gets a cached AsYouTypeFormatter for the specified country
|
43
|
-
* @param countryCode - The country code to get formatter for
|
44
|
-
* @returns Cached or new AsYouTypeFormatter instance
|
45
|
-
*/
|
46
|
-
var getFormatter = function (countryCode) {
|
47
|
-
if (!formatterCache.has(countryCode)) {
|
48
|
-
try {
|
49
|
-
formatterCache.set(countryCode, new google_libphonenumber_1.AsYouTypeFormatter(countryCode));
|
50
|
-
}
|
51
|
-
catch (error) {
|
52
|
-
console.error("Failed to create formatter for ".concat(countryCode, ":"), error);
|
53
|
-
// Fallback to US formatter if country-specific formatter fails
|
54
|
-
if (countryCode !== 'US' && !formatterCache.has('US')) {
|
55
|
-
try {
|
56
|
-
formatterCache.set('US', new google_libphonenumber_1.AsYouTypeFormatter('US'));
|
57
|
-
}
|
58
|
-
catch (fallbackError) {
|
59
|
-
console.error('Failed to create fallback US formatter:', fallbackError);
|
60
|
-
// Return a mock formatter that returns input as-is
|
61
|
-
return {
|
62
|
-
inputDigit: function (digit) { return digit; },
|
63
|
-
clear: function () { },
|
64
|
-
};
|
65
|
-
}
|
66
|
-
}
|
67
|
-
return formatterCache.get('US') || formatterCache.get(countryCode);
|
68
|
-
}
|
69
|
-
}
|
70
|
-
return formatterCache.get(countryCode);
|
71
|
-
};
|
72
|
-
exports.getFormatter = getFormatter;
|
73
|
-
/**
|
74
|
-
* Clears the formatter cache (useful for testing or memory management)
|
75
|
-
*/
|
76
|
-
var clearFormatterCache = function () {
|
77
|
-
formatterCache.clear();
|
78
|
-
};
|
79
|
-
exports.clearFormatterCache = clearFormatterCache;
|
80
|
-
/**
|
81
|
-
* Gets the current cache size (useful for monitoring/debugging)
|
82
|
-
*/
|
83
|
-
var getFormatterCacheSize = function () {
|
84
|
-
return formatterCache.size;
|
85
|
-
};
|
86
|
-
exports.getFormatterCacheSize = getFormatterCacheSize;
|
87
|
-
/**
|
88
|
-
* Resets the PhoneNumberUtil singleton (useful for testing)
|
89
|
-
*/
|
90
|
-
var resetPhoneUtilInstance = function () {
|
91
|
-
phoneUtilInstance = null;
|
92
|
-
};
|
93
|
-
exports.resetPhoneUtilInstance = resetPhoneUtilInstance;
|
94
|
-
//# sourceMappingURL=phoneUtilSingleton.js.map
|
package/Components/Molecules/PhoneNumberTextFieldCustom/__helpers__/utils/phoneUtilSingleton.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"phoneUtilSingleton.js","sourceRoot":"","sources":["../../../../../../src/Components/Molecules/PhoneNumberTextFieldCustom/__helpers__/utils/phoneUtilSingleton.ts"],"names":[],"mappings":";;;AAAA,+DAG+B;AAG/B,qCAAqC;AACrC,IAAI,iBAAiB,GAA2B,IAAI,CAAC;AAErD;;GAEG;AACH,IAAM,mBAAmB,GAAG;IAC1B,OAAO;QACL,KAAK,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QACjB,aAAa,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK;QAC1B,MAAM,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;QAChB,sBAAsB,EAAE,cAAM,OAAA,SAAS,EAAT,CAAS;QACvC,aAAa,EAAE,cAAM,OAAA,SAAS,EAAT,CAAS;QAC9B,gBAAgB,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QAC5B,uBAAuB,EAAE,cAAM,OAAA,SAAS,EAAT,CAAS;QACxC,0BAA0B,EAAE,cAAM,OAAA,SAAS,EAAT,CAAS;KACd,CAAC;AAClC,CAAC,CAAC;AAEF;;;GAGG;AACI,IAAM,YAAY,GAAG;IAC1B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,IAAI,CAAC;YACH,iBAAiB,GAAG,uCAAe,CAAC,WAAW,EAAE,CAAC;QACpD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAA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W,QAAA,YAAY,gBAuBvB;AAEF;;GAEG;AACI,IAAM,mBAAmB,GAAG;IACjC,cAAc,CAAC,KAAK,EAAE,CAAC;AACzB,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEF;;GAEG;AACI,IAAM,qBAAqB,GAAG;IACnC,OAAO,cAAc,CAAC,IAAI,CAAC;AAC7B,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC;AAEF;;GAEG;AACI,IAAM,sBAAsB,GAAG;IACpC,iBAAiB,GAAG,IAAI,CAAC;AAC3B,CAAC,CAAC;AAFW,QAAA,sBAAsB,0BAEjC"}
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"phoneUtilSingleton.test.js","sourceRoot":"","sources":["../../../../../../src/Components/Molecules/PhoneNumberTextFieldCustom/__helpers__/utils/phoneUtilSingleton.test.ts"],"names":[],"mappings":""}
|