@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.
Files changed (96) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +179 -0
  3. package/dist/index.d.ts +61 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +196 -0
  6. package/dist/liquid.d.ts +5 -0
  7. package/dist/liquid.d.ts.map +1 -0
  8. package/dist/liquid.js +156 -0
  9. package/dist/providers/local.d.ts +22 -0
  10. package/dist/providers/local.d.ts.map +1 -0
  11. package/dist/providers/local.js +23 -0
  12. package/dist/providers/voyant-cloud-email.d.ts +27 -0
  13. package/dist/providers/voyant-cloud-email.d.ts.map +1 -0
  14. package/dist/providers/voyant-cloud-email.js +73 -0
  15. package/dist/providers/voyant-cloud-sms.d.ts +26 -0
  16. package/dist/providers/voyant-cloud-sms.d.ts.map +1 -0
  17. package/dist/providers/voyant-cloud-sms.js +24 -0
  18. package/dist/routes.d.ts +1546 -0
  19. package/dist/routes.d.ts.map +1 -0
  20. package/dist/routes.js +337 -0
  21. package/dist/schema.d.ts +2119 -0
  22. package/dist/schema.d.ts.map +1 -0
  23. package/dist/schema.js +356 -0
  24. package/dist/service-booking-document-lifecycle.d.ts +99 -0
  25. package/dist/service-booking-document-lifecycle.d.ts.map +1 -0
  26. package/dist/service-booking-document-lifecycle.js +259 -0
  27. package/dist/service-booking-documents.d.ts +256 -0
  28. package/dist/service-booking-documents.d.ts.map +1 -0
  29. package/dist/service-booking-documents.js +323 -0
  30. package/dist/service-deliveries.d.ts +183 -0
  31. package/dist/service-deliveries.d.ts.map +1 -0
  32. package/dist/service-deliveries.js +413 -0
  33. package/dist/service-delivery-metadata.d.ts +42 -0
  34. package/dist/service-delivery-metadata.d.ts.map +1 -0
  35. package/dist/service-delivery-metadata.js +114 -0
  36. package/dist/service-reminder-authoring.d.ts +33 -0
  37. package/dist/service-reminder-authoring.d.ts.map +1 -0
  38. package/dist/service-reminder-authoring.js +247 -0
  39. package/dist/service-reminder-booking-context.d.ts +94 -0
  40. package/dist/service-reminder-booking-context.d.ts.map +1 -0
  41. package/dist/service-reminder-booking-context.js +164 -0
  42. package/dist/service-reminder-events.d.ts +33 -0
  43. package/dist/service-reminder-events.d.ts.map +1 -0
  44. package/dist/service-reminder-events.js +178 -0
  45. package/dist/service-reminder-run-state.d.ts +114 -0
  46. package/dist/service-reminder-run-state.d.ts.map +1 -0
  47. package/dist/service-reminder-run-state.js +100 -0
  48. package/dist/service-reminder-stage-runs.d.ts +6 -0
  49. package/dist/service-reminder-stage-runs.d.ts.map +1 -0
  50. package/dist/service-reminder-stage-runs.js +310 -0
  51. package/dist/service-reminders.d.ts +30 -0
  52. package/dist/service-reminders.d.ts.map +1 -0
  53. package/dist/service-reminders.js +189 -0
  54. package/dist/service-sequence-targets.d.ts +50 -0
  55. package/dist/service-sequence-targets.d.ts.map +1 -0
  56. package/dist/service-sequence-targets.js +136 -0
  57. package/dist/service-sequence.d.ts +68 -0
  58. package/dist/service-sequence.d.ts.map +1 -0
  59. package/dist/service-sequence.js +316 -0
  60. package/dist/service-shared.d.ts +107 -0
  61. package/dist/service-shared.d.ts.map +1 -0
  62. package/dist/service-shared.js +159 -0
  63. package/dist/service-stages.d.ts +23 -0
  64. package/dist/service-stages.d.ts.map +1 -0
  65. package/dist/service-stages.js +203 -0
  66. package/dist/service-template-data.d.ts +19 -0
  67. package/dist/service-template-data.d.ts.map +1 -0
  68. package/dist/service-template-data.js +278 -0
  69. package/dist/service-templates.d.ts +260 -0
  70. package/dist/service-templates.d.ts.map +1 -0
  71. package/dist/service-templates.js +293 -0
  72. package/dist/service.d.ts +273 -0
  73. package/dist/service.d.ts.map +1 -0
  74. package/dist/service.js +51 -0
  75. package/dist/task-runtime.d.ts +19 -0
  76. package/dist/task-runtime.d.ts.map +1 -0
  77. package/dist/task-runtime.js +11 -0
  78. package/dist/tasks/deliver-reminder.d.ts +9 -0
  79. package/dist/tasks/deliver-reminder.d.ts.map +1 -0
  80. package/dist/tasks/deliver-reminder.js +12 -0
  81. package/dist/tasks/index.d.ts +3 -0
  82. package/dist/tasks/index.d.ts.map +1 -0
  83. package/dist/tasks/index.js +2 -0
  84. package/dist/tasks/send-due-reminders.d.ts +7 -0
  85. package/dist/tasks/send-due-reminders.d.ts.map +1 -0
  86. package/dist/tasks/send-due-reminders.js +31 -0
  87. package/dist/template-authoring.d.ts +23 -0
  88. package/dist/template-authoring.d.ts.map +1 -0
  89. package/dist/template-authoring.js +386 -0
  90. package/dist/types.d.ts +82 -0
  91. package/dist/types.d.ts.map +1 -0
  92. package/dist/types.js +1 -0
  93. package/dist/validation.d.ts +1093 -0
  94. package/dist/validation.d.ts.map +1 -0
  95. package/dist/validation.js +451 -0
  96. package/package.json +102 -0
@@ -0,0 +1,259 @@
1
+ import { bookings } from "@voyant-travel/bookings/schema";
2
+ import { eq } from "drizzle-orm";
3
+ import { bookingDocumentNotificationsService, } from "./service-booking-documents.js";
4
+ import { listBookingNotificationItems, listBookingNotificationParticipants, resolveReminderRecipient, } from "./service-shared.js";
5
+ export const BOOKING_FULLY_PAID_EVENT = "booking.fully-paid";
6
+ function stageOptionsForTrigger(options, trigger) {
7
+ return trigger === BOOKING_FULLY_PAID_EVENT ? options.fullyPaid : options.confirmation;
8
+ }
9
+ function defaultDocumentTypesForTrigger(trigger) {
10
+ return trigger === BOOKING_FULLY_PAID_EVENT ? ["contract", "invoice"] : ["contract", "proforma"];
11
+ }
12
+ function getRequestedDocumentTypes(options, trigger) {
13
+ return (stageOptionsForTrigger(options, trigger)?.documentTypes ??
14
+ defaultDocumentTypesForTrigger(trigger));
15
+ }
16
+ function hasDocument(documents, documentType) {
17
+ return documents.some((document) => document.documentType === documentType);
18
+ }
19
+ function isFinanceDocumentType(documentType) {
20
+ return documentType === "invoice" || documentType === "proforma";
21
+ }
22
+ function messageFromError(error) {
23
+ return error instanceof Error ? error.message : String(error);
24
+ }
25
+ function generatorStep(source, documentType, status, reason) {
26
+ return {
27
+ source,
28
+ documentType,
29
+ status,
30
+ ...(reason ? { reason } : {}),
31
+ };
32
+ }
33
+ export async function resolveBookingDocumentBundleLifecycleContext(db, input) {
34
+ const [booking] = await db
35
+ .select()
36
+ .from(bookings)
37
+ .where(eq(bookings.id, input.event.bookingId))
38
+ .limit(1);
39
+ if (!booking) {
40
+ return null;
41
+ }
42
+ const [bundle, travelers, items] = await Promise.all([
43
+ bookingDocumentNotificationsService.listBookingDocumentBundle(db, booking.id),
44
+ listBookingNotificationParticipants(db, booking.id),
45
+ listBookingNotificationItems(db, booking.id),
46
+ ]);
47
+ return {
48
+ trigger: input.trigger,
49
+ event: input.event,
50
+ booking,
51
+ customer: resolveReminderRecipient(booking, travelers),
52
+ travelers,
53
+ items,
54
+ existingDocuments: bundle?.documents ?? [],
55
+ };
56
+ }
57
+ export function createDefaultBookingDocumentBundlePolicy(options) {
58
+ return async (context, helpers) => {
59
+ const requestedTypes = getRequestedDocumentTypes(options, context.trigger);
60
+ const steps = [];
61
+ let documents = context.existingDocuments;
62
+ const missingTypes = requestedTypes.filter((documentType) => !hasDocument(documents, documentType));
63
+ const needsContract = missingTypes.includes("contract");
64
+ const financeTypes = missingTypes.filter(isFinanceDocumentType);
65
+ if (needsContract) {
66
+ if (helpers.ensureLegalDocuments) {
67
+ try {
68
+ steps.push(...((await helpers.ensureLegalDocuments(context, {
69
+ trigger: context.trigger,
70
+ documentTypes: ["contract"],
71
+ })) ?? [generatorStep("legal", "contract", "created")]));
72
+ documents = await helpers.refreshDocuments();
73
+ }
74
+ catch (error) {
75
+ return {
76
+ status: "failed",
77
+ bookingId: context.booking.id,
78
+ steps: [
79
+ ...steps,
80
+ generatorStep("legal", "contract", "failed", messageFromError(error)),
81
+ ],
82
+ error: messageFromError(error),
83
+ };
84
+ }
85
+ }
86
+ else {
87
+ steps.push(generatorStep("legal", "contract", "skipped", "no_generator"));
88
+ }
89
+ }
90
+ else if (requestedTypes.includes("contract")) {
91
+ steps.push(generatorStep("legal", "contract", "existing"));
92
+ }
93
+ for (const documentType of financeTypes) {
94
+ if (!helpers.ensureFinanceDocuments) {
95
+ steps.push(generatorStep("finance", documentType, "skipped", "no_generator"));
96
+ continue;
97
+ }
98
+ try {
99
+ steps.push(...((await helpers.ensureFinanceDocuments(context, {
100
+ trigger: context.trigger,
101
+ documentTypes: [documentType],
102
+ })) ?? [generatorStep("finance", documentType, "created")]));
103
+ documents = await helpers.refreshDocuments();
104
+ }
105
+ catch (error) {
106
+ return {
107
+ status: "failed",
108
+ bookingId: context.booking.id,
109
+ steps: [
110
+ ...steps,
111
+ generatorStep("finance", documentType, "failed", messageFromError(error)),
112
+ ],
113
+ error: messageFromError(error),
114
+ };
115
+ }
116
+ }
117
+ for (const documentType of requestedTypes) {
118
+ if (isFinanceDocumentType(documentType) && !financeTypes.includes(documentType)) {
119
+ steps.push(generatorStep("finance", documentType, "existing"));
120
+ }
121
+ }
122
+ if (requestedTypes.includes("brochure")) {
123
+ if (helpers.resolveBrochureDocuments) {
124
+ try {
125
+ const brochures = await helpers.resolveBrochureDocuments(context);
126
+ documents = [...documents, ...brochures];
127
+ steps.push({
128
+ source: "products",
129
+ documentType: "brochure",
130
+ status: brochures.length > 0 ? "existing" : "skipped",
131
+ ...(brochures.length === 0 ? { reason: "not_available" } : {}),
132
+ });
133
+ }
134
+ catch (error) {
135
+ return {
136
+ status: "failed",
137
+ bookingId: context.booking.id,
138
+ steps: [
139
+ ...steps,
140
+ {
141
+ source: "products",
142
+ documentType: "brochure",
143
+ status: "failed",
144
+ reason: messageFromError(error),
145
+ },
146
+ ],
147
+ error: messageFromError(error),
148
+ };
149
+ }
150
+ }
151
+ else {
152
+ steps.push({
153
+ source: "products",
154
+ documentType: "brochure",
155
+ status: "skipped",
156
+ reason: "no_resolver",
157
+ });
158
+ }
159
+ }
160
+ return {
161
+ status: "ok",
162
+ bookingId: context.booking.id,
163
+ documents,
164
+ steps,
165
+ };
166
+ };
167
+ }
168
+ function defaultNotificationInput(options, context) {
169
+ const stage = stageOptionsForTrigger(options, context.trigger);
170
+ if (stage?.notification === false)
171
+ return false;
172
+ return {
173
+ ...(stage?.notification ?? {}),
174
+ documentTypes: stage?.notification && "documentTypes" in stage.notification
175
+ ? stage.notification.documentTypes
176
+ : getRequestedDocumentTypes(options, context.trigger),
177
+ };
178
+ }
179
+ export const bookingDocumentBundleLifecycleService = {
180
+ async run(db, dispatcher, input, options = {}, runtime = {}) {
181
+ const resolveContext = runtime.resolveContext ?? resolveBookingDocumentBundleLifecycleContext;
182
+ const context = await resolveContext(db, input);
183
+ if (!context) {
184
+ return { status: "not_found", bookingId: input.event.bookingId };
185
+ }
186
+ const helpers = {
187
+ refreshDocuments: async () => {
188
+ const bundle = await bookingDocumentNotificationsService.listBookingDocumentBundle(db, context.booking.id);
189
+ return bundle?.documents ?? [];
190
+ },
191
+ ensureLegalDocuments: options.ensureLegalDocuments,
192
+ ensureFinanceDocuments: options.ensureFinanceDocuments,
193
+ resolveBrochureDocuments: options.resolveBrochureDocuments,
194
+ };
195
+ let policyResult;
196
+ try {
197
+ const policy = options.policy ?? createDefaultBookingDocumentBundlePolicy(options);
198
+ policyResult = await policy(context, helpers);
199
+ }
200
+ catch (error) {
201
+ policyResult = {
202
+ status: "failed",
203
+ bookingId: context.booking.id,
204
+ steps: [{ source: "policy", status: "failed", reason: messageFromError(error) }],
205
+ error: messageFromError(error),
206
+ };
207
+ }
208
+ if (policyResult.status !== "ok") {
209
+ return policyResult;
210
+ }
211
+ let notificationInput;
212
+ try {
213
+ notificationInput =
214
+ options.notificationPolicy !== undefined
215
+ ? await options.notificationPolicy(context, policyResult)
216
+ : defaultNotificationInput(options, context);
217
+ }
218
+ catch (error) {
219
+ return {
220
+ status: "failed",
221
+ bookingId: context.booking.id,
222
+ steps: [
223
+ ...policyResult.steps,
224
+ { source: "notification", status: "failed", reason: messageFromError(error) },
225
+ ],
226
+ error: messageFromError(error),
227
+ };
228
+ }
229
+ if (notificationInput === false || notificationInput == null) {
230
+ return policyResult;
231
+ }
232
+ let notification;
233
+ try {
234
+ notification = await bookingDocumentNotificationsService.sendBookingDocumentsNotification(db, dispatcher, context.booking.id, notificationInput, { attachmentResolver: runtime.attachmentResolver, eventBus: runtime.eventBus });
235
+ }
236
+ catch (error) {
237
+ return {
238
+ status: "failed",
239
+ bookingId: context.booking.id,
240
+ steps: [
241
+ ...policyResult.steps,
242
+ { source: "notification", status: "failed", reason: messageFromError(error) },
243
+ ],
244
+ error: messageFromError(error),
245
+ };
246
+ }
247
+ return {
248
+ ...policyResult,
249
+ steps: [
250
+ ...policyResult.steps,
251
+ {
252
+ source: "notification",
253
+ status: notification.status === "sent" ? "sent" : "skipped",
254
+ reason: notification.status === "sent" ? undefined : notification.status,
255
+ },
256
+ ],
257
+ };
258
+ },
259
+ };
@@ -0,0 +1,256 @@
1
+ import type { EventBus } from "@voyant-travel/core";
2
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
3
+ import type { BookingDocumentBundleItem, NotificationService, SendBookingDocumentsNotificationInput } from "./service-shared.js";
4
+ import type { NotificationAttachment } from "./types.js";
5
+ export type BookingDocumentAttachmentResolver = (document: BookingDocumentBundleItem) => Promise<NotificationAttachment | null>;
6
+ export interface SendBookingDocumentsRuntimeOptions {
7
+ attachmentResolver?: BookingDocumentAttachmentResolver;
8
+ eventBus?: EventBus;
9
+ }
10
+ export interface BookingDocumentsSentEvent {
11
+ bookingId: string;
12
+ recipient: string;
13
+ deliveryId: string;
14
+ provider: string | null;
15
+ documentKeys: string[];
16
+ }
17
+ declare function createDefaultAttachmentFromDocument(document: BookingDocumentBundleItem): NotificationAttachment | null;
18
+ export declare const bookingDocumentNotificationsService: {
19
+ listBookingDocumentBundle(db: PostgresJsDatabase, bookingId: string): Promise<{
20
+ bookingId: string;
21
+ documents: {
22
+ key: string;
23
+ source: "products" | "legal" | "finance";
24
+ documentType: "contract" | "invoice" | "proforma" | "brochure";
25
+ bookingId: string;
26
+ name: string;
27
+ createdAt: string;
28
+ contractId?: string | null | undefined;
29
+ invoiceId?: string | null | undefined;
30
+ attachmentId?: string | null | undefined;
31
+ renditionId?: string | null | undefined;
32
+ contractStatus?: string | null | undefined;
33
+ invoiceStatus?: string | null | undefined;
34
+ format?: string | null | undefined;
35
+ mimeType?: string | null | undefined;
36
+ storageKey?: string | null | undefined;
37
+ downloadUrl?: string | null | undefined;
38
+ language?: string | null | undefined;
39
+ metadata?: Record<string, unknown> | null | undefined;
40
+ }[];
41
+ } | null>;
42
+ sendBookingDocumentsNotification(db: PostgresJsDatabase, dispatcher: NotificationService, bookingId: string, input: SendBookingDocumentsNotificationInput, runtime?: SendBookingDocumentsRuntimeOptions): Promise<{
43
+ status: "not_found";
44
+ bookingId?: undefined;
45
+ recipient?: undefined;
46
+ documents?: undefined;
47
+ delivery?: undefined;
48
+ } | {
49
+ status: "no_documents";
50
+ bookingId?: undefined;
51
+ recipient?: undefined;
52
+ documents?: undefined;
53
+ delivery?: undefined;
54
+ } | {
55
+ status: "no_recipient";
56
+ bookingId?: undefined;
57
+ recipient?: undefined;
58
+ documents?: undefined;
59
+ delivery?: undefined;
60
+ } | {
61
+ status: "no_attachments";
62
+ bookingId?: undefined;
63
+ recipient?: undefined;
64
+ documents?: undefined;
65
+ delivery?: undefined;
66
+ } | {
67
+ status: "send_failed";
68
+ bookingId?: undefined;
69
+ recipient?: undefined;
70
+ documents?: undefined;
71
+ delivery?: undefined;
72
+ } | {
73
+ status: "sent";
74
+ bookingId: string;
75
+ recipient: string;
76
+ documents: {
77
+ key: string;
78
+ source: "products" | "legal" | "finance";
79
+ documentType: "contract" | "invoice" | "proforma" | "brochure";
80
+ bookingId: string;
81
+ name: string;
82
+ createdAt: string;
83
+ contractId?: string | null | undefined;
84
+ invoiceId?: string | null | undefined;
85
+ attachmentId?: string | null | undefined;
86
+ renditionId?: string | null | undefined;
87
+ contractStatus?: string | null | undefined;
88
+ invoiceStatus?: string | null | undefined;
89
+ format?: string | null | undefined;
90
+ mimeType?: string | null | undefined;
91
+ storageKey?: string | null | undefined;
92
+ downloadUrl?: string | null | undefined;
93
+ language?: string | null | undefined;
94
+ metadata?: Record<string, unknown> | null | undefined;
95
+ }[];
96
+ delivery: {
97
+ id: string;
98
+ templateId: string | null;
99
+ templateSlug: string | null;
100
+ targetType: "invoice" | "booking" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization" | "other";
101
+ targetId: string | null;
102
+ personId: string | null;
103
+ organizationId: string | null;
104
+ bookingId: string | null;
105
+ invoiceId: string | null;
106
+ paymentSessionId: string | null;
107
+ channel: "email" | "sms";
108
+ provider: string;
109
+ providerMessageId: string | null;
110
+ status: "pending" | "sent" | "failed" | "cancelled";
111
+ toAddress: string;
112
+ fromAddress: string | null;
113
+ subject: string | null;
114
+ htmlBody: string | null;
115
+ textBody: string | null;
116
+ payloadData: Record<string, unknown> | null;
117
+ metadata: Record<string, unknown> | null;
118
+ errorMessage: string | null;
119
+ scheduledFor: Date | null;
120
+ sentAt: Date | null;
121
+ failedAt: Date | null;
122
+ createdAt: Date;
123
+ updatedAt: Date;
124
+ };
125
+ }>;
126
+ /**
127
+ * Confirm-and-dispatch — single orchestrated call for the operator flow
128
+ * that wants "list the booking's documents, then send them to the client"
129
+ * to be one action instead of two round-trips.
130
+ *
131
+ * With `sendNotification: false`, the caller gets the bundle back without
132
+ * attempting a send — useful for rendering a preview/checkbox list before
133
+ * the operator confirms. With `sendNotification: true`, the same send
134
+ * guards as `sendBookingDocumentsNotification` apply (no_documents,
135
+ * no_recipient, no_attachments, send_failed); the result keeps the bundle
136
+ * regardless so the UI always has something to show.
137
+ */
138
+ confirmAndDispatchBooking(db: PostgresJsDatabase, dispatcher: NotificationService, bookingId: string, input: {
139
+ sendNotification?: boolean;
140
+ } & SendBookingDocumentsNotificationInput, runtime?: SendBookingDocumentsRuntimeOptions): Promise<{
141
+ status: "not_found";
142
+ bookingId?: undefined;
143
+ documents?: undefined;
144
+ skipReason?: undefined;
145
+ recipient?: undefined;
146
+ delivery?: undefined;
147
+ } | {
148
+ status: "preview";
149
+ bookingId: string;
150
+ documents: {
151
+ key: string;
152
+ source: "products" | "legal" | "finance";
153
+ documentType: "contract" | "invoice" | "proforma" | "brochure";
154
+ bookingId: string;
155
+ name: string;
156
+ createdAt: string;
157
+ contractId?: string | null | undefined;
158
+ invoiceId?: string | null | undefined;
159
+ attachmentId?: string | null | undefined;
160
+ renditionId?: string | null | undefined;
161
+ contractStatus?: string | null | undefined;
162
+ invoiceStatus?: string | null | undefined;
163
+ format?: string | null | undefined;
164
+ mimeType?: string | null | undefined;
165
+ storageKey?: string | null | undefined;
166
+ downloadUrl?: string | null | undefined;
167
+ language?: string | null | undefined;
168
+ metadata?: Record<string, unknown> | null | undefined;
169
+ }[];
170
+ skipReason?: undefined;
171
+ recipient?: undefined;
172
+ delivery?: undefined;
173
+ } | {
174
+ status: "skipped";
175
+ bookingId: string;
176
+ documents: {
177
+ key: string;
178
+ source: "products" | "legal" | "finance";
179
+ documentType: "contract" | "invoice" | "proforma" | "brochure";
180
+ bookingId: string;
181
+ name: string;
182
+ createdAt: string;
183
+ contractId?: string | null | undefined;
184
+ invoiceId?: string | null | undefined;
185
+ attachmentId?: string | null | undefined;
186
+ renditionId?: string | null | undefined;
187
+ contractStatus?: string | null | undefined;
188
+ invoiceStatus?: string | null | undefined;
189
+ format?: string | null | undefined;
190
+ mimeType?: string | null | undefined;
191
+ storageKey?: string | null | undefined;
192
+ downloadUrl?: string | null | undefined;
193
+ language?: string | null | undefined;
194
+ metadata?: Record<string, unknown> | null | undefined;
195
+ }[];
196
+ skipReason: "no_documents" | "no_recipient" | "no_attachments" | "send_failed";
197
+ recipient?: undefined;
198
+ delivery?: undefined;
199
+ } | {
200
+ status: "dispatched";
201
+ bookingId: string;
202
+ documents: {
203
+ key: string;
204
+ source: "products" | "legal" | "finance";
205
+ documentType: "contract" | "invoice" | "proforma" | "brochure";
206
+ bookingId: string;
207
+ name: string;
208
+ createdAt: string;
209
+ contractId?: string | null | undefined;
210
+ invoiceId?: string | null | undefined;
211
+ attachmentId?: string | null | undefined;
212
+ renditionId?: string | null | undefined;
213
+ contractStatus?: string | null | undefined;
214
+ invoiceStatus?: string | null | undefined;
215
+ format?: string | null | undefined;
216
+ mimeType?: string | null | undefined;
217
+ storageKey?: string | null | undefined;
218
+ downloadUrl?: string | null | undefined;
219
+ language?: string | null | undefined;
220
+ metadata?: Record<string, unknown> | null | undefined;
221
+ }[];
222
+ recipient: string;
223
+ delivery: {
224
+ id: string;
225
+ templateId: string | null;
226
+ templateSlug: string | null;
227
+ targetType: "invoice" | "booking" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization" | "other";
228
+ targetId: string | null;
229
+ personId: string | null;
230
+ organizationId: string | null;
231
+ bookingId: string | null;
232
+ invoiceId: string | null;
233
+ paymentSessionId: string | null;
234
+ channel: "email" | "sms";
235
+ provider: string;
236
+ providerMessageId: string | null;
237
+ status: "pending" | "sent" | "failed" | "cancelled";
238
+ toAddress: string;
239
+ fromAddress: string | null;
240
+ subject: string | null;
241
+ htmlBody: string | null;
242
+ textBody: string | null;
243
+ payloadData: Record<string, unknown> | null;
244
+ metadata: Record<string, unknown> | null;
245
+ errorMessage: string | null;
246
+ scheduledFor: Date | null;
247
+ sentAt: Date | null;
248
+ failedAt: Date | null;
249
+ createdAt: Date;
250
+ updatedAt: Date;
251
+ };
252
+ skipReason?: undefined;
253
+ }>;
254
+ };
255
+ export { createDefaultAttachmentFromDocument as createDefaultBookingDocumentAttachment };
256
+ //# sourceMappingURL=service-booking-documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-booking-documents.d.ts","sourceRoot":"","sources":["../src/service-booking-documents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAInD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,qCAAqC,EACtC,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAExD,MAAM,MAAM,iCAAiC,GAAG,CAC9C,QAAQ,EAAE,yBAAyB,KAChC,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAA;AAE3C,MAAM,WAAW,kCAAkC;IACjD,kBAAkB,CAAC,EAAE,iCAAiC,CAAA;IACtD,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB;AA2BD,iBAAS,mCAAmC,CAC1C,QAAQ,EAAE,yBAAyB,GAClC,sBAAsB,GAAG,IAAI,CAU/B;AAwLD,eAAO,MAAM,mCAAmC;kCACV,kBAAkB,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;yCAkBnE,kBAAkB,cACV,mBAAmB,aACpB,MAAM,SACV,qCAAqC,YACnC,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoH7C;;;;;;;;;;;OAWG;kCAEG,kBAAkB,cACV,mBAAmB,aACpB,MAAM,SACV;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,qCAAqC,YACpE,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4C9C,CAAA;AAED,OAAO,EAAE,mCAAmC,IAAI,sCAAsC,EAAE,CAAA"}