@universe-platform/ui 0.1.0-beta.8 → 0.1.0-beta.81
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/dist/globals.css +2100 -35
- package/dist/index.d.mts +844 -49
- package/dist/index.d.ts +844 -49
- package/dist/index.js +22163 -3230
- package/dist/index.mjs +21904 -3094
- package/dist/phone.d.mts +12 -1
- package/dist/phone.d.ts +12 -1
- package/dist/phone.js +20 -0
- package/dist/phone.mjs +19 -0
- package/package.json +10 -3
package/dist/phone.d.mts
CHANGED
|
@@ -34,5 +34,16 @@ declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
34
34
|
* @returns WhatsApp URL or null if phone is empty
|
|
35
35
|
*/
|
|
36
36
|
declare function generateWhatsAppLink(phone: string, defaultCountryCode?: string): string | null;
|
|
37
|
+
/**
|
|
38
|
+
* Normalizes a phone number for WhatsApp sending (Meta international format without leading '+').
|
|
39
|
+
* - Returns empty string if input is falsy.
|
|
40
|
+
* - Trims input and removes leading '+' if it exists.
|
|
41
|
+
* - Strips all non-digit characters.
|
|
42
|
+
* - If starting with '972', returns it as is.
|
|
43
|
+
* - If starting with '0' (Israeli mobile/landline), strips '0' and prepends '972'.
|
|
44
|
+
* - If exactly 9 digits long (omitted leading zero), prepends '972'.
|
|
45
|
+
* - Returns the processed digits string.
|
|
46
|
+
*/
|
|
47
|
+
declare function normalizePhoneForWhatsApp(phone: string): string;
|
|
37
48
|
|
|
38
|
-
export { formatPhoneDisplay, generateWhatsAppLink, isValidPhoneNumber, openWhatsAppChat, sanitizePhoneNumber };
|
|
49
|
+
export { formatPhoneDisplay, generateWhatsAppLink, isValidPhoneNumber, normalizePhoneForWhatsApp, openWhatsAppChat, sanitizePhoneNumber };
|
package/dist/phone.d.ts
CHANGED
|
@@ -34,5 +34,16 @@ declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
34
34
|
* @returns WhatsApp URL or null if phone is empty
|
|
35
35
|
*/
|
|
36
36
|
declare function generateWhatsAppLink(phone: string, defaultCountryCode?: string): string | null;
|
|
37
|
+
/**
|
|
38
|
+
* Normalizes a phone number for WhatsApp sending (Meta international format without leading '+').
|
|
39
|
+
* - Returns empty string if input is falsy.
|
|
40
|
+
* - Trims input and removes leading '+' if it exists.
|
|
41
|
+
* - Strips all non-digit characters.
|
|
42
|
+
* - If starting with '972', returns it as is.
|
|
43
|
+
* - If starting with '0' (Israeli mobile/landline), strips '0' and prepends '972'.
|
|
44
|
+
* - If exactly 9 digits long (omitted leading zero), prepends '972'.
|
|
45
|
+
* - Returns the processed digits string.
|
|
46
|
+
*/
|
|
47
|
+
declare function normalizePhoneForWhatsApp(phone: string): string;
|
|
37
48
|
|
|
38
|
-
export { formatPhoneDisplay, generateWhatsAppLink, isValidPhoneNumber, openWhatsAppChat, sanitizePhoneNumber };
|
|
49
|
+
export { formatPhoneDisplay, generateWhatsAppLink, isValidPhoneNumber, normalizePhoneForWhatsApp, openWhatsAppChat, sanitizePhoneNumber };
|
package/dist/phone.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(phone_exports, {
|
|
|
23
23
|
formatPhoneDisplay: () => formatPhoneDisplay,
|
|
24
24
|
generateWhatsAppLink: () => generateWhatsAppLink,
|
|
25
25
|
isValidPhoneNumber: () => isValidPhoneNumber,
|
|
26
|
+
normalizePhoneForWhatsApp: () => normalizePhoneForWhatsApp,
|
|
26
27
|
openWhatsAppChat: () => openWhatsAppChat,
|
|
27
28
|
sanitizePhoneNumber: () => sanitizePhoneNumber
|
|
28
29
|
});
|
|
@@ -80,11 +81,30 @@ function generateWhatsAppLink(phone, defaultCountryCode = "972") {
|
|
|
80
81
|
}
|
|
81
82
|
return `https://wa.me/${cleaned}`;
|
|
82
83
|
}
|
|
84
|
+
function normalizePhoneForWhatsApp(phone) {
|
|
85
|
+
if (!phone) return "";
|
|
86
|
+
let cleaned = phone.trim();
|
|
87
|
+
if (cleaned.startsWith("+")) {
|
|
88
|
+
cleaned = cleaned.substring(1);
|
|
89
|
+
}
|
|
90
|
+
const digitsOnly = cleaned.replace(/\D/g, "");
|
|
91
|
+
if (digitsOnly.startsWith("972")) {
|
|
92
|
+
return digitsOnly;
|
|
93
|
+
}
|
|
94
|
+
if (digitsOnly.startsWith("0")) {
|
|
95
|
+
return `972${digitsOnly.substring(1)}`;
|
|
96
|
+
}
|
|
97
|
+
if (digitsOnly.length === 9) {
|
|
98
|
+
return `972${digitsOnly}`;
|
|
99
|
+
}
|
|
100
|
+
return digitsOnly;
|
|
101
|
+
}
|
|
83
102
|
// Annotate the CommonJS export names for ESM import in node:
|
|
84
103
|
0 && (module.exports = {
|
|
85
104
|
formatPhoneDisplay,
|
|
86
105
|
generateWhatsAppLink,
|
|
87
106
|
isValidPhoneNumber,
|
|
107
|
+
normalizePhoneForWhatsApp,
|
|
88
108
|
openWhatsAppChat,
|
|
89
109
|
sanitizePhoneNumber
|
|
90
110
|
});
|
package/dist/phone.mjs
CHANGED
|
@@ -50,10 +50,29 @@ function generateWhatsAppLink(phone, defaultCountryCode = "972") {
|
|
|
50
50
|
}
|
|
51
51
|
return `https://wa.me/${cleaned}`;
|
|
52
52
|
}
|
|
53
|
+
function normalizePhoneForWhatsApp(phone) {
|
|
54
|
+
if (!phone) return "";
|
|
55
|
+
let cleaned = phone.trim();
|
|
56
|
+
if (cleaned.startsWith("+")) {
|
|
57
|
+
cleaned = cleaned.substring(1);
|
|
58
|
+
}
|
|
59
|
+
const digitsOnly = cleaned.replace(/\D/g, "");
|
|
60
|
+
if (digitsOnly.startsWith("972")) {
|
|
61
|
+
return digitsOnly;
|
|
62
|
+
}
|
|
63
|
+
if (digitsOnly.startsWith("0")) {
|
|
64
|
+
return `972${digitsOnly.substring(1)}`;
|
|
65
|
+
}
|
|
66
|
+
if (digitsOnly.length === 9) {
|
|
67
|
+
return `972${digitsOnly}`;
|
|
68
|
+
}
|
|
69
|
+
return digitsOnly;
|
|
70
|
+
}
|
|
53
71
|
export {
|
|
54
72
|
formatPhoneDisplay,
|
|
55
73
|
generateWhatsAppLink,
|
|
56
74
|
isValidPhoneNumber,
|
|
75
|
+
normalizePhoneForWhatsApp,
|
|
57
76
|
openWhatsAppChat,
|
|
58
77
|
sanitizePhoneNumber
|
|
59
78
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@universe-platform/ui",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.81",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@tailwindcss/postcss": "^4.3.1",
|
|
39
|
+
"@types/papaparse": "^5.3.14",
|
|
40
|
+
"@universe-platform/shared": "*",
|
|
39
41
|
"autoprefixer": "^10.5.2",
|
|
40
42
|
"postcss": "^8.5.15",
|
|
41
43
|
"tailwindcss": "^4.3.1",
|
|
@@ -43,9 +45,14 @@
|
|
|
43
45
|
"typescript": "^5.0.0"
|
|
44
46
|
},
|
|
45
47
|
"dependencies": {
|
|
48
|
+
"ag-grid-community": "^36.2.0",
|
|
49
|
+
"ag-grid-react": "^36.2.0",
|
|
46
50
|
"clsx": "^2.1.1",
|
|
51
|
+
"emoji-picker-react": "^4.22.3",
|
|
47
52
|
"lucide-react": "^1.25.0",
|
|
53
|
+
"papaparse": "^5.4.1",
|
|
48
54
|
"sonner": "^2.0.7",
|
|
49
|
-
"tailwind-merge": "^3.6.0"
|
|
55
|
+
"tailwind-merge": "^3.6.0",
|
|
56
|
+
"xlsx": "^0.18.5"
|
|
50
57
|
}
|
|
51
|
-
}
|
|
58
|
+
}
|