feat: send one SMS from a person or lead and keep the dashboard inside the phone frame

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-13 21:05:17 +03:30
co-authored by Cursor
parent 13ee70764b
commit 42f0573a5f
13 changed files with 733 additions and 113 deletions
+35
View File
@@ -0,0 +1,35 @@
import { jalaliMonthName, toJalali } from './jalali';
import { applyMessageTemplate } from '../message-automations/message-automation.util';
const FA_DIGITS = '۰۱۲۳۴۵۶۷۸۹';
function toFaDigits(value: string | number) {
return String(value).replace(/\d/g, (d) => FA_DIGITS[Number(d)] ?? d);
}
function tehranJalaliLong(d: Date) {
const [gy, gm, gd] = new Intl.DateTimeFormat('en-CA', {
timeZone: 'Asia/Tehran',
year: 'numeric',
month: '2-digit',
day: '2-digit',
})
.format(d)
.split('-')
.map(Number);
const j = toJalali(gy, gm, gd);
return `${toFaDigits(j.jd)} ${jalaliMonthName(j.jm)} ${toFaDigits(j.jy)}`;
}
export function renderSmsText(
text: string,
vars: { name?: string; phone?: string; title?: string; company?: string },
) {
return applyMessageTemplate(text, {
name: vars.name,
phone: vars.phone,
title: vars.title,
company: vars.company,
date: tehranJalaliLong(new Date()),
}).trim();
}