feat: add per-org SMS wallet with adm panel and header credit
Bill all platform SMS (including OTP), allow negative balance with manual/auto cutoffs, and support own-panel bypass without wallet debit.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
/** Persian SMS parts (same rules as Hamkar SmsSegmentCalculator). */
|
||||
const PERSIAN_LIMITS = [70, 64, 67] as const;
|
||||
|
||||
export function countSmsParts(text: string): number {
|
||||
const length = [...String(text ?? '').trim()].length;
|
||||
if (length <= 0) return 0;
|
||||
|
||||
const [first, second, rest] = PERSIAN_LIMITS;
|
||||
if (length <= first) return 1;
|
||||
if (length <= first + second) return 2;
|
||||
const thirdThreshold = first + second + rest;
|
||||
if (length <= thirdThreshold) return 3;
|
||||
return 3 + Math.ceil((length - thirdThreshold) / rest);
|
||||
}
|
||||
Reference in New Issue
Block a user