@rodrigobeber/patoai-dtos 4.8.8 → 4.8.10
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/crew/index.d.ts +1 -0
- package/dist/crew/index.js +1 -0
- package/dist/crew/reminder-datetime.d.ts +1 -0
- package/dist/crew/reminder-datetime.js +25 -0
- package/dist/support/support-crew-config.dto.d.ts +1 -0
- package/dist/webchat/crew/webchat-crew-alerts.dto.d.ts +1 -0
- package/package.json +1 -1
package/dist/crew/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './gender-tokens';
|
|
|
4
4
|
export * from './friendly-variables';
|
|
5
5
|
export * from './follow-up-mode.enum';
|
|
6
6
|
export * from './reminder.enum';
|
|
7
|
+
export * from './reminder-datetime';
|
|
7
8
|
export * from './get-provider.dto';
|
|
8
9
|
export * from './online-mode.enum';
|
|
9
10
|
export * from './unit.dto';
|
package/dist/crew/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./gender-tokens"), exports);
|
|
|
20
20
|
__exportStar(require("./friendly-variables"), exports);
|
|
21
21
|
__exportStar(require("./follow-up-mode.enum"), exports);
|
|
22
22
|
__exportStar(require("./reminder.enum"), exports);
|
|
23
|
+
__exportStar(require("./reminder-datetime"), exports);
|
|
23
24
|
__exportStar(require("./get-provider.dto"), exports);
|
|
24
25
|
__exportStar(require("./online-mode.enum"), exports);
|
|
25
26
|
__exportStar(require("./unit.dto"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatReminderDateTime(at: Date | string | null | undefined, timezone?: string): string | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatReminderDateTime = formatReminderDateTime;
|
|
4
|
+
// Formato do token 'data_hora' dos templates de lembrete. Fonte UNICA, usada tanto no ENVIO
|
|
5
|
+
// (patoai-crew, ReminderTemplateHelper) quanto no PREVIEW do painel (patoai-frontend) — se as duas
|
|
6
|
+
// divergirem, o dono escreve o template olhando um texto e o lead recebe outro.
|
|
7
|
+
// Devolve a expressao COMPLETA ("terca-feira, 28/07 as 16:00"), ja com preposicao e horario: o
|
|
8
|
+
// template NAO deve acrescentar "as" nem "horas" em volta.
|
|
9
|
+
const DEFAULT_TIMEZONE = 'America/Sao_Paulo';
|
|
10
|
+
function formatReminderDateTime(at, timezone) {
|
|
11
|
+
if (!at)
|
|
12
|
+
return null;
|
|
13
|
+
try {
|
|
14
|
+
const tz = timezone || DEFAULT_TIMEZONE;
|
|
15
|
+
const d = at instanceof Date ? at : new Date(at);
|
|
16
|
+
if (isNaN(d.getTime()))
|
|
17
|
+
return null;
|
|
18
|
+
const date = new Intl.DateTimeFormat('pt-BR', { timeZone: tz, weekday: 'long', day: '2-digit', month: '2-digit' }).format(d);
|
|
19
|
+
const time = new Intl.DateTimeFormat('pt-BR', { timeZone: tz, hour: '2-digit', minute: '2-digit' }).format(d);
|
|
20
|
+
return `${date} às ${time}`;
|
|
21
|
+
}
|
|
22
|
+
catch (_a) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|