@voyant-travel/notifications 0.111.7
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/LICENSE +201 -0
- package/README.md +179 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/liquid.d.ts +5 -0
- package/dist/liquid.d.ts.map +1 -0
- package/dist/liquid.js +156 -0
- package/dist/providers/local.d.ts +22 -0
- package/dist/providers/local.d.ts.map +1 -0
- package/dist/providers/local.js +23 -0
- package/dist/providers/voyant-cloud-email.d.ts +27 -0
- package/dist/providers/voyant-cloud-email.d.ts.map +1 -0
- package/dist/providers/voyant-cloud-email.js +73 -0
- package/dist/providers/voyant-cloud-sms.d.ts +26 -0
- package/dist/providers/voyant-cloud-sms.d.ts.map +1 -0
- package/dist/providers/voyant-cloud-sms.js +24 -0
- package/dist/routes.d.ts +1546 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +337 -0
- package/dist/schema.d.ts +2119 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +356 -0
- package/dist/service-booking-document-lifecycle.d.ts +99 -0
- package/dist/service-booking-document-lifecycle.d.ts.map +1 -0
- package/dist/service-booking-document-lifecycle.js +259 -0
- package/dist/service-booking-documents.d.ts +256 -0
- package/dist/service-booking-documents.d.ts.map +1 -0
- package/dist/service-booking-documents.js +323 -0
- package/dist/service-deliveries.d.ts +183 -0
- package/dist/service-deliveries.d.ts.map +1 -0
- package/dist/service-deliveries.js +413 -0
- package/dist/service-delivery-metadata.d.ts +42 -0
- package/dist/service-delivery-metadata.d.ts.map +1 -0
- package/dist/service-delivery-metadata.js +114 -0
- package/dist/service-reminder-authoring.d.ts +33 -0
- package/dist/service-reminder-authoring.d.ts.map +1 -0
- package/dist/service-reminder-authoring.js +247 -0
- package/dist/service-reminder-booking-context.d.ts +94 -0
- package/dist/service-reminder-booking-context.d.ts.map +1 -0
- package/dist/service-reminder-booking-context.js +164 -0
- package/dist/service-reminder-events.d.ts +33 -0
- package/dist/service-reminder-events.d.ts.map +1 -0
- package/dist/service-reminder-events.js +178 -0
- package/dist/service-reminder-run-state.d.ts +114 -0
- package/dist/service-reminder-run-state.d.ts.map +1 -0
- package/dist/service-reminder-run-state.js +100 -0
- package/dist/service-reminder-stage-runs.d.ts +6 -0
- package/dist/service-reminder-stage-runs.d.ts.map +1 -0
- package/dist/service-reminder-stage-runs.js +310 -0
- package/dist/service-reminders.d.ts +30 -0
- package/dist/service-reminders.d.ts.map +1 -0
- package/dist/service-reminders.js +189 -0
- package/dist/service-sequence-targets.d.ts +50 -0
- package/dist/service-sequence-targets.d.ts.map +1 -0
- package/dist/service-sequence-targets.js +136 -0
- package/dist/service-sequence.d.ts +68 -0
- package/dist/service-sequence.d.ts.map +1 -0
- package/dist/service-sequence.js +316 -0
- package/dist/service-shared.d.ts +107 -0
- package/dist/service-shared.d.ts.map +1 -0
- package/dist/service-shared.js +159 -0
- package/dist/service-stages.d.ts +23 -0
- package/dist/service-stages.d.ts.map +1 -0
- package/dist/service-stages.js +203 -0
- package/dist/service-template-data.d.ts +19 -0
- package/dist/service-template-data.d.ts.map +1 -0
- package/dist/service-template-data.js +278 -0
- package/dist/service-templates.d.ts +260 -0
- package/dist/service-templates.d.ts.map +1 -0
- package/dist/service-templates.js +293 -0
- package/dist/service.d.ts +273 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +51 -0
- package/dist/task-runtime.d.ts +19 -0
- package/dist/task-runtime.d.ts.map +1 -0
- package/dist/task-runtime.js +11 -0
- package/dist/tasks/deliver-reminder.d.ts +9 -0
- package/dist/tasks/deliver-reminder.d.ts.map +1 -0
- package/dist/tasks/deliver-reminder.js +12 -0
- package/dist/tasks/index.d.ts +3 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +2 -0
- package/dist/tasks/send-due-reminders.d.ts +7 -0
- package/dist/tasks/send-due-reminders.d.ts.map +1 -0
- package/dist/tasks/send-due-reminders.js +31 -0
- package/dist/template-authoring.d.ts +23 -0
- package/dist/template-authoring.d.ts.map +1 -0
- package/dist/template-authoring.js +386 -0
- package/dist/types.d.ts +82 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/validation.d.ts +1093 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +451 -0
- package/package.json +102 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
function centsToAmount(value) {
|
|
2
|
+
if (typeof value !== "number")
|
|
3
|
+
return null;
|
|
4
|
+
return value / 100;
|
|
5
|
+
}
|
|
6
|
+
function buildFullName(firstName, lastName) {
|
|
7
|
+
return [firstName, lastName]
|
|
8
|
+
.map((part) => (typeof part === "string" ? part.trim() : ""))
|
|
9
|
+
.filter(Boolean)
|
|
10
|
+
.join(" ");
|
|
11
|
+
}
|
|
12
|
+
function parseDate(value) {
|
|
13
|
+
if (!value)
|
|
14
|
+
return null;
|
|
15
|
+
const date = value instanceof Date ? value : new Date(String(value));
|
|
16
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
17
|
+
}
|
|
18
|
+
function toRecord(value) {
|
|
19
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
20
|
+
return null;
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function dateDiffInDays(from, to) {
|
|
24
|
+
const diff = to.getTime() - from.getTime();
|
|
25
|
+
return Math.ceil(diff / (24 * 60 * 60 * 1000));
|
|
26
|
+
}
|
|
27
|
+
function enrichTraveler(value) {
|
|
28
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
29
|
+
return value;
|
|
30
|
+
const traveler = value;
|
|
31
|
+
const fullName = buildFullName(traveler.firstName, traveler.lastName);
|
|
32
|
+
return {
|
|
33
|
+
...traveler,
|
|
34
|
+
fullName: fullName || null,
|
|
35
|
+
name: fullName || null,
|
|
36
|
+
role: traveler.participantType ?? null,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function enrichBooking(value) {
|
|
40
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
41
|
+
return value;
|
|
42
|
+
const booking = value;
|
|
43
|
+
const bookingNumber = typeof booking.bookingNumber === "string"
|
|
44
|
+
? booking.bookingNumber
|
|
45
|
+
: typeof booking.reference === "string"
|
|
46
|
+
? booking.reference
|
|
47
|
+
: typeof booking.code === "string"
|
|
48
|
+
? booking.code
|
|
49
|
+
: typeof booking.number === "string"
|
|
50
|
+
? booking.number
|
|
51
|
+
: null;
|
|
52
|
+
const currency = typeof booking.currency === "string"
|
|
53
|
+
? booking.currency
|
|
54
|
+
: typeof booking.sellCurrency === "string"
|
|
55
|
+
? booking.sellCurrency
|
|
56
|
+
: null;
|
|
57
|
+
const totalAmount = centsToAmount(booking.totalAmountCents) ??
|
|
58
|
+
centsToAmount(booking.sellAmountCents) ??
|
|
59
|
+
(typeof booking.totalAmount === "number" ? booking.totalAmount : null);
|
|
60
|
+
const startDate = parseDate(booking.startDate);
|
|
61
|
+
const endDate = parseDate(booking.endDate);
|
|
62
|
+
const dateRange = startDate && endDate
|
|
63
|
+
? `${startDate.toISOString().slice(0, 10)} - ${endDate.toISOString().slice(0, 10)}`
|
|
64
|
+
: null;
|
|
65
|
+
return {
|
|
66
|
+
...booking,
|
|
67
|
+
code: bookingNumber,
|
|
68
|
+
number: bookingNumber,
|
|
69
|
+
reference: bookingNumber,
|
|
70
|
+
currency,
|
|
71
|
+
total: totalAmount,
|
|
72
|
+
totalAmount,
|
|
73
|
+
totalPrice: totalAmount,
|
|
74
|
+
dateRange,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function enrichInvoice(value) {
|
|
78
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
79
|
+
return value;
|
|
80
|
+
const invoice = value;
|
|
81
|
+
return {
|
|
82
|
+
...invoice,
|
|
83
|
+
number: typeof invoice.number === "string"
|
|
84
|
+
? invoice.number
|
|
85
|
+
: typeof invoice.invoiceNumber === "string"
|
|
86
|
+
? invoice.invoiceNumber
|
|
87
|
+
: null,
|
|
88
|
+
type: typeof invoice.type === "string"
|
|
89
|
+
? invoice.type
|
|
90
|
+
: typeof invoice.invoiceType === "string"
|
|
91
|
+
? invoice.invoiceType
|
|
92
|
+
: null,
|
|
93
|
+
subtotalAmount: centsToAmount(invoice.subtotalCents) ??
|
|
94
|
+
(typeof invoice.subtotalAmount === "number" ? invoice.subtotalAmount : null),
|
|
95
|
+
taxAmount: centsToAmount(invoice.taxCents) ??
|
|
96
|
+
(typeof invoice.taxAmount === "number" ? invoice.taxAmount : null),
|
|
97
|
+
totalAmount: centsToAmount(invoice.totalCents) ??
|
|
98
|
+
(typeof invoice.totalAmount === "number" ? invoice.totalAmount : null),
|
|
99
|
+
paidAmount: centsToAmount(invoice.paidCents) ??
|
|
100
|
+
(typeof invoice.paidAmount === "number" ? invoice.paidAmount : null),
|
|
101
|
+
balanceDueAmount: centsToAmount(invoice.balanceDueCents) ??
|
|
102
|
+
(typeof invoice.balanceDueAmount === "number" ? invoice.balanceDueAmount : null),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function enrichPaymentSession(value) {
|
|
106
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
107
|
+
return value;
|
|
108
|
+
const session = value;
|
|
109
|
+
return {
|
|
110
|
+
...session,
|
|
111
|
+
amount: centsToAmount(session.amountCents) ??
|
|
112
|
+
(typeof session.amount === "number" ? session.amount : null),
|
|
113
|
+
paymentUrl: typeof session.paymentUrl === "string"
|
|
114
|
+
? session.paymentUrl
|
|
115
|
+
: typeof session.redirectUrl === "string"
|
|
116
|
+
? session.redirectUrl
|
|
117
|
+
: null,
|
|
118
|
+
reference: typeof session.reference === "string"
|
|
119
|
+
? session.reference
|
|
120
|
+
: typeof session.externalReference === "string"
|
|
121
|
+
? session.externalReference
|
|
122
|
+
: null,
|
|
123
|
+
method: typeof session.method === "string"
|
|
124
|
+
? session.method
|
|
125
|
+
: typeof session.paymentMethod === "string"
|
|
126
|
+
? session.paymentMethod
|
|
127
|
+
: null,
|
|
128
|
+
isPaid: session.status === "paid" ||
|
|
129
|
+
session.status === "completed" ||
|
|
130
|
+
session.status === "succeeded" ||
|
|
131
|
+
Boolean(session.completedAt),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function enrichPaymentSchedule(value) {
|
|
135
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
136
|
+
return value;
|
|
137
|
+
const schedule = value;
|
|
138
|
+
const dueDate = parseDate(schedule.dueDate);
|
|
139
|
+
const today = new Date();
|
|
140
|
+
return {
|
|
141
|
+
...schedule,
|
|
142
|
+
amountDue: centsToAmount(schedule.amountCents) ??
|
|
143
|
+
(typeof schedule.amountDue === "number" ? schedule.amountDue : null),
|
|
144
|
+
type: typeof schedule.type === "string"
|
|
145
|
+
? schedule.type
|
|
146
|
+
: typeof schedule.scheduleType === "string"
|
|
147
|
+
? schedule.scheduleType
|
|
148
|
+
: null,
|
|
149
|
+
daysLeft: dueDate ? dateDiffInDays(today, dueDate) : null,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function enrichDocument(value) {
|
|
153
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
154
|
+
return value;
|
|
155
|
+
return value;
|
|
156
|
+
}
|
|
157
|
+
export function enrichBookingItem(value) {
|
|
158
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
159
|
+
return value;
|
|
160
|
+
const item = value;
|
|
161
|
+
return {
|
|
162
|
+
...item,
|
|
163
|
+
description: typeof item.description === "string" && item.description.trim().length > 0
|
|
164
|
+
? item.description
|
|
165
|
+
: typeof item.title === "string"
|
|
166
|
+
? item.title
|
|
167
|
+
: null,
|
|
168
|
+
currency: typeof item.currency === "string"
|
|
169
|
+
? item.currency
|
|
170
|
+
: typeof item.sellCurrency === "string"
|
|
171
|
+
? item.sellCurrency
|
|
172
|
+
: null,
|
|
173
|
+
unitPrice: centsToAmount(item.unitSellAmountCents) ??
|
|
174
|
+
(typeof item.unitPrice === "number" ? item.unitPrice : null),
|
|
175
|
+
total: centsToAmount(item.totalSellAmountCents) ??
|
|
176
|
+
(typeof item.total === "number" ? item.total : null),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export function normalizeNotificationTemplateData(data) {
|
|
180
|
+
const traveler = enrichTraveler(data.traveler);
|
|
181
|
+
const travelers = Array.isArray(data.travelers)
|
|
182
|
+
? data.travelers.map((entry) => enrichTraveler(entry))
|
|
183
|
+
: traveler
|
|
184
|
+
? [traveler]
|
|
185
|
+
: [];
|
|
186
|
+
const booking = enrichBooking(data.booking);
|
|
187
|
+
const invoice = enrichInvoice(data.invoice);
|
|
188
|
+
const paymentSession = enrichPaymentSession(data.paymentSession);
|
|
189
|
+
const paymentSchedule = enrichPaymentSchedule(data.paymentSchedule);
|
|
190
|
+
const bookingRecord = toRecord(booking);
|
|
191
|
+
const invoiceRecord = toRecord(invoice);
|
|
192
|
+
const paymentSessionRecord = toRecord(paymentSession);
|
|
193
|
+
const paymentScheduleRecord = toRecord(paymentSchedule);
|
|
194
|
+
const suppliedPayment = data.payment && typeof data.payment === "object" && !Array.isArray(data.payment)
|
|
195
|
+
? data.payment
|
|
196
|
+
: null;
|
|
197
|
+
const documents = Array.isArray(data.documents)
|
|
198
|
+
? data.documents.map((document) => enrichDocument(document))
|
|
199
|
+
: [];
|
|
200
|
+
const items = Array.isArray(data.items) ? data.items.map((item) => enrichBookingItem(item)) : [];
|
|
201
|
+
const derivedPayment = paymentScheduleRecord
|
|
202
|
+
? {
|
|
203
|
+
amount: paymentScheduleRecord.amountDue ?? null,
|
|
204
|
+
currency: paymentScheduleRecord.currency ??
|
|
205
|
+
invoiceRecord?.currency ??
|
|
206
|
+
paymentSessionRecord?.currency ??
|
|
207
|
+
bookingRecord?.currency ??
|
|
208
|
+
null,
|
|
209
|
+
dueDate: paymentScheduleRecord.dueDate ?? null,
|
|
210
|
+
daysLeft: paymentScheduleRecord.daysLeft ?? null,
|
|
211
|
+
reference: bookingRecord?.reference ?? invoiceRecord?.number ?? null,
|
|
212
|
+
method: paymentSessionRecord?.method ?? paymentSessionRecord?.provider ?? null,
|
|
213
|
+
link: paymentSessionRecord?.paymentUrl ?? null,
|
|
214
|
+
payMode: paymentScheduleRecord.type ?? null,
|
|
215
|
+
paidAmount: invoiceRecord?.paidAmount ??
|
|
216
|
+
(paymentSessionRecord?.isPaid ? paymentSessionRecord.amount : null),
|
|
217
|
+
balanceDue: invoiceRecord?.balanceDueAmount ?? paymentScheduleRecord.amountDue ?? null,
|
|
218
|
+
isPaidInFull: invoiceRecord?.balanceDueAmount === 0,
|
|
219
|
+
}
|
|
220
|
+
: paymentSessionRecord
|
|
221
|
+
? {
|
|
222
|
+
amount: paymentSessionRecord.amount ?? null,
|
|
223
|
+
currency: paymentSessionRecord.currency ?? null,
|
|
224
|
+
dueDate: null,
|
|
225
|
+
daysLeft: null,
|
|
226
|
+
reference: paymentSessionRecord.reference ?? null,
|
|
227
|
+
method: paymentSessionRecord.method ?? null,
|
|
228
|
+
link: paymentSessionRecord.paymentUrl ?? null,
|
|
229
|
+
payMode: null,
|
|
230
|
+
paidAmount: null,
|
|
231
|
+
balanceDue: invoiceRecord?.balanceDueAmount ?? null,
|
|
232
|
+
isPaidInFull: invoiceRecord?.balanceDueAmount === 0,
|
|
233
|
+
}
|
|
234
|
+
: invoiceRecord
|
|
235
|
+
? {
|
|
236
|
+
amount: invoiceRecord.balanceDueAmount ?? null,
|
|
237
|
+
currency: invoiceRecord.currency ?? null,
|
|
238
|
+
dueDate: invoiceRecord.dueDate ?? null,
|
|
239
|
+
daysLeft: null,
|
|
240
|
+
reference: bookingRecord?.reference ?? invoiceRecord.number ?? null,
|
|
241
|
+
method: null,
|
|
242
|
+
link: null,
|
|
243
|
+
payMode: null,
|
|
244
|
+
paidAmount: invoiceRecord.paidAmount ?? null,
|
|
245
|
+
balanceDue: invoiceRecord.balanceDueAmount ?? null,
|
|
246
|
+
isPaidInFull: invoiceRecord.balanceDueAmount === 0,
|
|
247
|
+
}
|
|
248
|
+
: null;
|
|
249
|
+
const payment = derivedPayment
|
|
250
|
+
? {
|
|
251
|
+
...derivedPayment,
|
|
252
|
+
...suppliedPayment,
|
|
253
|
+
}
|
|
254
|
+
: suppliedPayment;
|
|
255
|
+
const product = items.length > 0 && items[0] && typeof items[0] === "object"
|
|
256
|
+
? {
|
|
257
|
+
title: items[0].title ??
|
|
258
|
+
items[0].description ??
|
|
259
|
+
null,
|
|
260
|
+
}
|
|
261
|
+
: null;
|
|
262
|
+
return {
|
|
263
|
+
...data,
|
|
264
|
+
traveler,
|
|
265
|
+
travelers,
|
|
266
|
+
billingPerson: traveler,
|
|
267
|
+
billing: traveler,
|
|
268
|
+
booking,
|
|
269
|
+
invoice,
|
|
270
|
+
paymentSession,
|
|
271
|
+
paymentSchedule,
|
|
272
|
+
payment,
|
|
273
|
+
documents,
|
|
274
|
+
documentsCount: documents.length,
|
|
275
|
+
items,
|
|
276
|
+
product,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
+
import type { CreateNotificationReminderRuleInput, CreateNotificationTemplateInput, NotificationReminderRuleListQuery, NotificationReminderRunListQuery, NotificationTemplateListQuery, UpdateNotificationReminderRuleInput, UpdateNotificationTemplateInput } from "./service-shared.js";
|
|
3
|
+
export declare function listTemplates(db: PostgresJsDatabase, query: NotificationTemplateListQuery): Promise<{
|
|
4
|
+
data: {
|
|
5
|
+
id: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
name: string;
|
|
8
|
+
channel: "email" | "sms";
|
|
9
|
+
provider: string | null;
|
|
10
|
+
status: "draft" | "active" | "archived";
|
|
11
|
+
subjectTemplate: string | null;
|
|
12
|
+
htmlTemplate: string | null;
|
|
13
|
+
textTemplate: string | null;
|
|
14
|
+
fromAddress: string | null;
|
|
15
|
+
isSystem: boolean;
|
|
16
|
+
metadata: Record<string, unknown> | null;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
}[];
|
|
20
|
+
total: number;
|
|
21
|
+
limit: number;
|
|
22
|
+
offset: number;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function getTemplateById(db: PostgresJsDatabase, id: string): Promise<{
|
|
25
|
+
id: string;
|
|
26
|
+
slug: string;
|
|
27
|
+
name: string;
|
|
28
|
+
channel: "email" | "sms";
|
|
29
|
+
provider: string | null;
|
|
30
|
+
status: "draft" | "active" | "archived";
|
|
31
|
+
subjectTemplate: string | null;
|
|
32
|
+
htmlTemplate: string | null;
|
|
33
|
+
textTemplate: string | null;
|
|
34
|
+
fromAddress: string | null;
|
|
35
|
+
isSystem: boolean;
|
|
36
|
+
metadata: Record<string, unknown> | null;
|
|
37
|
+
createdAt: Date;
|
|
38
|
+
updatedAt: Date;
|
|
39
|
+
} | null>;
|
|
40
|
+
export declare function getTemplateBySlug(db: PostgresJsDatabase, slug: string): Promise<{
|
|
41
|
+
id: string;
|
|
42
|
+
slug: string;
|
|
43
|
+
name: string;
|
|
44
|
+
channel: "email" | "sms";
|
|
45
|
+
provider: string | null;
|
|
46
|
+
status: "draft" | "active" | "archived";
|
|
47
|
+
subjectTemplate: string | null;
|
|
48
|
+
htmlTemplate: string | null;
|
|
49
|
+
textTemplate: string | null;
|
|
50
|
+
fromAddress: string | null;
|
|
51
|
+
isSystem: boolean;
|
|
52
|
+
metadata: Record<string, unknown> | null;
|
|
53
|
+
createdAt: Date;
|
|
54
|
+
updatedAt: Date;
|
|
55
|
+
} | null>;
|
|
56
|
+
export declare function createTemplate(db: PostgresJsDatabase, data: CreateNotificationTemplateInput): Promise<{
|
|
57
|
+
provider: string | null;
|
|
58
|
+
metadata: Record<string, unknown> | null;
|
|
59
|
+
channel: "email" | "sms";
|
|
60
|
+
status: "draft" | "active" | "archived";
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
slug: string;
|
|
64
|
+
subjectTemplate: string | null;
|
|
65
|
+
htmlTemplate: string | null;
|
|
66
|
+
textTemplate: string | null;
|
|
67
|
+
fromAddress: string | null;
|
|
68
|
+
isSystem: boolean;
|
|
69
|
+
createdAt: Date;
|
|
70
|
+
updatedAt: Date;
|
|
71
|
+
} | null>;
|
|
72
|
+
export declare function updateTemplate(db: PostgresJsDatabase, id: string, data: UpdateNotificationTemplateInput): Promise<{
|
|
73
|
+
id: string;
|
|
74
|
+
slug: string;
|
|
75
|
+
name: string;
|
|
76
|
+
channel: "email" | "sms";
|
|
77
|
+
provider: string | null;
|
|
78
|
+
status: "draft" | "active" | "archived";
|
|
79
|
+
subjectTemplate: string | null;
|
|
80
|
+
htmlTemplate: string | null;
|
|
81
|
+
textTemplate: string | null;
|
|
82
|
+
fromAddress: string | null;
|
|
83
|
+
isSystem: boolean;
|
|
84
|
+
metadata: Record<string, unknown> | null;
|
|
85
|
+
createdAt: Date;
|
|
86
|
+
updatedAt: Date;
|
|
87
|
+
} | null>;
|
|
88
|
+
export declare function deleteTemplate(db: PostgresJsDatabase, id: string): Promise<boolean>;
|
|
89
|
+
export declare function listReminderRules(db: PostgresJsDatabase, query: NotificationReminderRuleListQuery): Promise<{
|
|
90
|
+
data: {
|
|
91
|
+
id: string;
|
|
92
|
+
slug: string;
|
|
93
|
+
name: string;
|
|
94
|
+
status: "draft" | "active" | "archived";
|
|
95
|
+
targetType: "invoice" | "booking_payment_schedule" | "booking_confirmed" | "payment_complete" | "booking_cancelled_non_payment";
|
|
96
|
+
channel: "email" | "sms";
|
|
97
|
+
provider: string | null;
|
|
98
|
+
templateId: string | null;
|
|
99
|
+
templateSlug: string | null;
|
|
100
|
+
priority: number;
|
|
101
|
+
suppressionGroup: string | null;
|
|
102
|
+
isSystem: boolean;
|
|
103
|
+
metadata: Record<string, unknown> | null;
|
|
104
|
+
createdAt: Date;
|
|
105
|
+
updatedAt: Date;
|
|
106
|
+
}[];
|
|
107
|
+
total: number;
|
|
108
|
+
limit: number;
|
|
109
|
+
offset: number;
|
|
110
|
+
}>;
|
|
111
|
+
export declare function getReminderRuleById(db: PostgresJsDatabase, id: string): Promise<{
|
|
112
|
+
id: string;
|
|
113
|
+
slug: string;
|
|
114
|
+
name: string;
|
|
115
|
+
status: "draft" | "active" | "archived";
|
|
116
|
+
targetType: "invoice" | "booking_payment_schedule" | "booking_confirmed" | "payment_complete" | "booking_cancelled_non_payment";
|
|
117
|
+
channel: "email" | "sms";
|
|
118
|
+
provider: string | null;
|
|
119
|
+
templateId: string | null;
|
|
120
|
+
templateSlug: string | null;
|
|
121
|
+
priority: number;
|
|
122
|
+
suppressionGroup: string | null;
|
|
123
|
+
isSystem: boolean;
|
|
124
|
+
metadata: Record<string, unknown> | null;
|
|
125
|
+
createdAt: Date;
|
|
126
|
+
updatedAt: Date;
|
|
127
|
+
} | null>;
|
|
128
|
+
export declare function createReminderRule(db: PostgresJsDatabase, data: CreateNotificationReminderRuleInput): Promise<{
|
|
129
|
+
templateId: string | null;
|
|
130
|
+
templateSlug: string | null;
|
|
131
|
+
provider: string | null;
|
|
132
|
+
metadata: Record<string, unknown> | null;
|
|
133
|
+
channel: "email" | "sms";
|
|
134
|
+
status: "draft" | "active" | "archived";
|
|
135
|
+
id: string;
|
|
136
|
+
name: string;
|
|
137
|
+
slug: string;
|
|
138
|
+
isSystem: boolean;
|
|
139
|
+
createdAt: Date;
|
|
140
|
+
updatedAt: Date;
|
|
141
|
+
targetType: "invoice" | "booking_payment_schedule" | "booking_confirmed" | "payment_complete" | "booking_cancelled_non_payment";
|
|
142
|
+
priority: number;
|
|
143
|
+
suppressionGroup: string | null;
|
|
144
|
+
} | null>;
|
|
145
|
+
export declare function updateReminderRule(db: PostgresJsDatabase, id: string, data: UpdateNotificationReminderRuleInput): Promise<{
|
|
146
|
+
id: string;
|
|
147
|
+
slug: string;
|
|
148
|
+
name: string;
|
|
149
|
+
status: "draft" | "active" | "archived";
|
|
150
|
+
targetType: "invoice" | "booking_payment_schedule" | "booking_confirmed" | "payment_complete" | "booking_cancelled_non_payment";
|
|
151
|
+
channel: "email" | "sms";
|
|
152
|
+
provider: string | null;
|
|
153
|
+
templateId: string | null;
|
|
154
|
+
templateSlug: string | null;
|
|
155
|
+
priority: number;
|
|
156
|
+
suppressionGroup: string | null;
|
|
157
|
+
isSystem: boolean;
|
|
158
|
+
metadata: Record<string, unknown> | null;
|
|
159
|
+
createdAt: Date;
|
|
160
|
+
updatedAt: Date;
|
|
161
|
+
} | null>;
|
|
162
|
+
export declare function deleteReminderRule(db: PostgresJsDatabase, id: string): Promise<boolean>;
|
|
163
|
+
export declare function listReminderRuns(db: PostgresJsDatabase, query: NotificationReminderRunListQuery): Promise<{
|
|
164
|
+
data: {
|
|
165
|
+
id: string;
|
|
166
|
+
reminderRuleId: string;
|
|
167
|
+
targetType: "invoice" | "booking_payment_schedule" | "booking_confirmed" | "payment_complete" | "booking_cancelled_non_payment";
|
|
168
|
+
targetId: string;
|
|
169
|
+
dedupeKey: string;
|
|
170
|
+
status: "sent" | "failed" | "queued" | "processing" | "skipped";
|
|
171
|
+
recipient: string | null;
|
|
172
|
+
scheduledFor: string;
|
|
173
|
+
processedAt: string;
|
|
174
|
+
errorMessage: string | null;
|
|
175
|
+
metadata: Record<string, unknown> | null;
|
|
176
|
+
createdAt: string;
|
|
177
|
+
updatedAt: string;
|
|
178
|
+
links: {
|
|
179
|
+
bookingId: string | null;
|
|
180
|
+
bookingPaymentScheduleId: string | null;
|
|
181
|
+
invoiceId: string | null;
|
|
182
|
+
paymentSessionId: string | null;
|
|
183
|
+
personId: string | null;
|
|
184
|
+
organizationId: string | null;
|
|
185
|
+
notificationDeliveryId: string | null;
|
|
186
|
+
};
|
|
187
|
+
reminderRule: {
|
|
188
|
+
id: string;
|
|
189
|
+
slug: string;
|
|
190
|
+
name: string;
|
|
191
|
+
status: "draft" | "active" | "archived";
|
|
192
|
+
targetType: "invoice" | "booking_payment_schedule" | "booking_confirmed" | "payment_complete" | "booking_cancelled_non_payment";
|
|
193
|
+
channel: "email" | "sms";
|
|
194
|
+
provider: string | null;
|
|
195
|
+
templateId: string | null;
|
|
196
|
+
templateSlug: string | null;
|
|
197
|
+
};
|
|
198
|
+
delivery: {
|
|
199
|
+
id: string;
|
|
200
|
+
status: "pending" | "sent" | "failed" | "cancelled";
|
|
201
|
+
channel: "email" | "sms";
|
|
202
|
+
provider: string;
|
|
203
|
+
toAddress: string;
|
|
204
|
+
subject: string | null;
|
|
205
|
+
sentAt: string | null;
|
|
206
|
+
failedAt: string | null;
|
|
207
|
+
errorMessage: string | null;
|
|
208
|
+
} | null;
|
|
209
|
+
}[];
|
|
210
|
+
total: number;
|
|
211
|
+
limit: number;
|
|
212
|
+
offset: number;
|
|
213
|
+
}>;
|
|
214
|
+
export declare function getReminderRunById(db: PostgresJsDatabase, id: string): Promise<{
|
|
215
|
+
id: string;
|
|
216
|
+
reminderRuleId: string;
|
|
217
|
+
targetType: "invoice" | "booking_payment_schedule" | "booking_confirmed" | "payment_complete" | "booking_cancelled_non_payment";
|
|
218
|
+
targetId: string;
|
|
219
|
+
dedupeKey: string;
|
|
220
|
+
status: "sent" | "failed" | "queued" | "processing" | "skipped";
|
|
221
|
+
recipient: string | null;
|
|
222
|
+
scheduledFor: string;
|
|
223
|
+
processedAt: string;
|
|
224
|
+
errorMessage: string | null;
|
|
225
|
+
metadata: Record<string, unknown> | null;
|
|
226
|
+
createdAt: string;
|
|
227
|
+
updatedAt: string;
|
|
228
|
+
links: {
|
|
229
|
+
bookingId: string | null;
|
|
230
|
+
bookingPaymentScheduleId: string | null;
|
|
231
|
+
invoiceId: string | null;
|
|
232
|
+
paymentSessionId: string | null;
|
|
233
|
+
personId: string | null;
|
|
234
|
+
organizationId: string | null;
|
|
235
|
+
notificationDeliveryId: string | null;
|
|
236
|
+
};
|
|
237
|
+
reminderRule: {
|
|
238
|
+
id: string;
|
|
239
|
+
slug: string;
|
|
240
|
+
name: string;
|
|
241
|
+
status: "draft" | "active" | "archived";
|
|
242
|
+
targetType: "invoice" | "booking_payment_schedule" | "booking_confirmed" | "payment_complete" | "booking_cancelled_non_payment";
|
|
243
|
+
channel: "email" | "sms";
|
|
244
|
+
provider: string | null;
|
|
245
|
+
templateId: string | null;
|
|
246
|
+
templateSlug: string | null;
|
|
247
|
+
};
|
|
248
|
+
delivery: {
|
|
249
|
+
id: string;
|
|
250
|
+
status: "pending" | "sent" | "failed" | "cancelled";
|
|
251
|
+
channel: "email" | "sms";
|
|
252
|
+
provider: string;
|
|
253
|
+
toAddress: string;
|
|
254
|
+
subject: string | null;
|
|
255
|
+
sentAt: string | null;
|
|
256
|
+
failedAt: string | null;
|
|
257
|
+
errorMessage: string | null;
|
|
258
|
+
} | null;
|
|
259
|
+
} | null>;
|
|
260
|
+
//# sourceMappingURL=service-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-templates.d.ts","sourceRoot":"","sources":["../src/service-templates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAQjE,OAAO,KAAK,EACV,mCAAmC,EACnC,+BAA+B,EAC/B,iCAAiC,EACjC,gCAAgC,EAEhC,6BAA6B,EAC7B,mCAAmC,EACnC,+BAA+B,EAChC,MAAM,qBAAqB,CAAA;AAoG5B,wBAAsB,aAAa,CAAC,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,6BAA6B;;;;;;;;;;;;;;;;;;;;GAyB/F;AAED,wBAAsB,eAAe,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;UAOvE;AAED,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;UAO3E;AAED,wBAAsB,cAAc,CAClC,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,+BAA+B;;;;;;;;;;;;;;;UAItC;AAED,wBAAsB,cAAc,CAClC,EAAE,EAAE,kBAAkB,EACtB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,+BAA+B;;;;;;;;;;;;;;;UAQtC;AAED,wBAAsB,cAAc,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAMzF;AAED,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,kBAAkB,EACtB,KAAK,EAAE,iCAAiC;;;;;;;;;;;;;;;;;;;;;GA0BzC;AAED,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;UAO3E;AAED,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,mCAAmC;;;;;;;;;;;;;;;;UAI1C;AAED,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,kBAAkB,EACtB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,mCAAmC;;;;;;;;;;;;;;;;UAQ1C;AAED,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAM7F;AAED,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,kBAAkB,EACtB,KAAK,EAAE,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoGxC;AAED,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAoD1E"}
|