@mailquilt/templates 0.0.0 → 0.5.0

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.
@@ -0,0 +1,609 @@
1
+ import {
2
+ bold,
3
+ br,
4
+ buttonBlock,
5
+ col,
6
+ defineStarterEmail,
7
+ dividerBlock,
8
+ doc,
9
+ emailDoc,
10
+ FONT_SANS,
11
+ headingBlock,
12
+ headingDoc,
13
+ linkText,
14
+ p,
15
+ row,
16
+ singleColRow,
17
+ tag,
18
+ tagLink,
19
+ textBlock,
20
+ } from "../builders.js";
21
+ import type { TemplateStarterEmail } from "../types.js";
22
+
23
+ /** Transactional payment receipt with structured invoice metadata and total. */
24
+ export const receipt: TemplateStarterEmail =
25
+ /* #__PURE__ */
26
+ defineStarterEmail(
27
+ {
28
+ category: "transactional",
29
+ description: "Clean invoice summary and billing details",
30
+ name: "Payment receipt",
31
+ },
32
+ () =>
33
+ emailDoc(
34
+ {
35
+ backgroundColor: "#f4f4f5",
36
+ fontFamily: FONT_SANS,
37
+ language: "en",
38
+ preheader:
39
+ "Payment received: {{amount_paid}} for {{plan_name}} (Invoice {{invoice_number}}).",
40
+ style: {
41
+ buttonBackgroundColor: "#111827",
42
+ buttonBorderRadius: 6,
43
+ emailBackgroundColor: "#ffffff",
44
+ heading1FontSize: 26,
45
+ heading2FontSize: 18,
46
+ linkColor: "#1d4ed8",
47
+ textColor: "#111827",
48
+ textFontSize: 15,
49
+ },
50
+ width: 560,
51
+ },
52
+ [
53
+ row(
54
+ "rc-header-row",
55
+ [
56
+ col(
57
+ "rc-header-left",
58
+ 50,
59
+ [
60
+ textBlock(
61
+ "rc-brand",
62
+ doc(p(tag("company_name", [{ type: "bold" }]))),
63
+ {
64
+ color: "#111827",
65
+ fontSize: 17,
66
+ paddingBottom: 8,
67
+ paddingLeft: 0,
68
+ paddingRight: 8,
69
+ paddingTop: 8,
70
+ }
71
+ ),
72
+ ],
73
+ { verticalAlign: "middle" }
74
+ ),
75
+ col(
76
+ "rc-header-right",
77
+ 50,
78
+ [
79
+ textBlock("rc-status", doc(p(bold("PAID RECEIPT"))), {
80
+ align: "right",
81
+ color: "#047857",
82
+ fontSize: 12,
83
+ paddingBottom: 8,
84
+ paddingLeft: 8,
85
+ paddingRight: 0,
86
+ paddingTop: 8,
87
+ }),
88
+ ],
89
+ { verticalAlign: "middle" }
90
+ ),
91
+ ],
92
+ {
93
+ backgroundColor: "#ffffff",
94
+ paddingBottom: 8,
95
+ paddingLeft: 32,
96
+ paddingRight: 32,
97
+ paddingTop: 24,
98
+ phone: { paddingLeft: 20, paddingRight: 20 },
99
+ stackOnPhone: false,
100
+ }
101
+ ),
102
+ singleColRow(
103
+ "rc-summary-row",
104
+ "rc-summary-col",
105
+ [
106
+ dividerBlock("rc-top-rule", {
107
+ color: "#e5e7eb",
108
+ paddingBottom: 20,
109
+ paddingLeft: 0,
110
+ paddingRight: 0,
111
+ paddingTop: 0,
112
+ thickness: 1,
113
+ }),
114
+ headingBlock(
115
+ "rc-title",
116
+ 1,
117
+ headingDoc(p("Receipt for ", tag("amount_paid"))),
118
+ {
119
+ paddingBottom: 8,
120
+ paddingLeft: 0,
121
+ paddingRight: 0,
122
+ paddingTop: 0,
123
+ }
124
+ ),
125
+ textBlock(
126
+ "rc-intro",
127
+ doc(
128
+ p(
129
+ "Hi ",
130
+ tag("first_name"),
131
+ ", thank you for your payment. Keep this receipt for your accounting records."
132
+ )
133
+ ),
134
+ {
135
+ color: "#4b5563",
136
+ paddingBottom: 16,
137
+ paddingLeft: 0,
138
+ paddingRight: 0,
139
+ paddingTop: 0,
140
+ }
141
+ ),
142
+ ],
143
+ {
144
+ backgroundColor: "#ffffff",
145
+ paddingBottom: 4,
146
+ paddingLeft: 32,
147
+ paddingRight: 32,
148
+ paddingTop: 0,
149
+ phone: { paddingLeft: 20, paddingRight: 20 },
150
+ }
151
+ ),
152
+ row(
153
+ "rc-meta-row",
154
+ [
155
+ col(
156
+ "rc-meta-left",
157
+ 50,
158
+ [
159
+ textBlock(
160
+ "rc-meta-1",
161
+ doc(
162
+ p(bold("Invoice number"), br(), tag("invoice_number")),
163
+ p(bold("Date paid"), br(), tag("invoice_date"))
164
+ ),
165
+ {
166
+ color: "#111827",
167
+ fontSize: 14,
168
+ paddingBottom: 14,
169
+ paddingLeft: 16,
170
+ paddingRight: 16,
171
+ paddingTop: 14,
172
+ }
173
+ ),
174
+ ],
175
+ {
176
+ backgroundColor: "#f9fafb",
177
+ borderColor: "#e5e7eb",
178
+ borderStyle: "solid",
179
+ borderWidth: 1,
180
+ }
181
+ ),
182
+ col(
183
+ "rc-meta-right",
184
+ 50,
185
+ [
186
+ textBlock(
187
+ "rc-meta-2",
188
+ doc(
189
+ p(bold("Plan"), br(), tag("plan_name")),
190
+ p(bold("Payment method"), br(), tag("payment_method"))
191
+ ),
192
+ {
193
+ color: "#111827",
194
+ fontSize: 14,
195
+ paddingBottom: 14,
196
+ paddingLeft: 16,
197
+ paddingRight: 16,
198
+ paddingTop: 14,
199
+ }
200
+ ),
201
+ ],
202
+ {
203
+ backgroundColor: "#f9fafb",
204
+ borderColor: "#e5e7eb",
205
+ borderStyle: "solid",
206
+ borderWidth: 1,
207
+ }
208
+ ),
209
+ ],
210
+ {
211
+ backgroundColor: "#ffffff",
212
+ paddingBottom: 18,
213
+ paddingLeft: 32,
214
+ paddingRight: 32,
215
+ paddingTop: 4,
216
+ phone: { paddingLeft: 20, paddingRight: 20 },
217
+ }
218
+ ),
219
+ row(
220
+ "rc-line-item-row",
221
+ [
222
+ col("rc-item-desc-col", 67, [
223
+ textBlock(
224
+ "rc-item-desc",
225
+ doc(p(tag("plan_name"), " — Monthly subscription")),
226
+ {
227
+ color: "#374151",
228
+ fontSize: 14,
229
+ paddingBottom: 10,
230
+ paddingLeft: 0,
231
+ paddingRight: 8,
232
+ paddingTop: 8,
233
+ }
234
+ ),
235
+ ]),
236
+ col("rc-item-price-col", 33, [
237
+ textBlock(
238
+ "rc-item-price",
239
+ doc(p(tag("amount_paid", [{ type: "bold" }]))),
240
+ {
241
+ align: "right",
242
+ color: "#111827",
243
+ fontSize: 14,
244
+ paddingBottom: 10,
245
+ paddingLeft: 8,
246
+ paddingRight: 0,
247
+ paddingTop: 8,
248
+ }
249
+ ),
250
+ ]),
251
+ ],
252
+ {
253
+ backgroundColor: "#ffffff",
254
+ paddingBottom: 4,
255
+ paddingLeft: 32,
256
+ paddingRight: 32,
257
+ paddingTop: 4,
258
+ phone: { paddingLeft: 20, paddingRight: 20 },
259
+ stackOnPhone: false,
260
+ }
261
+ ),
262
+ singleColRow(
263
+ "rc-total-divider-row",
264
+ "rc-total-divider-col",
265
+ [
266
+ dividerBlock("rc-total-rule", {
267
+ color: "#d1d5db",
268
+ paddingBottom: 0,
269
+ paddingLeft: 0,
270
+ paddingRight: 0,
271
+ paddingTop: 0,
272
+ thickness: 1,
273
+ }),
274
+ ],
275
+ {
276
+ backgroundColor: "#ffffff",
277
+ paddingBottom: 4,
278
+ paddingLeft: 32,
279
+ paddingRight: 32,
280
+ paddingTop: 4,
281
+ phone: { paddingLeft: 20, paddingRight: 20 },
282
+ }
283
+ ),
284
+ row(
285
+ "rc-total-row",
286
+ [
287
+ col("rc-total-label-col", 67, [
288
+ textBlock("rc-total-label", doc(p(bold("Total paid"))), {
289
+ color: "#111827",
290
+ fontSize: 15,
291
+ paddingBottom: 12,
292
+ paddingLeft: 0,
293
+ paddingRight: 8,
294
+ paddingTop: 8,
295
+ }),
296
+ ]),
297
+ col("rc-total-val-col", 33, [
298
+ textBlock(
299
+ "rc-total-val",
300
+ doc(p(tag("amount_paid", [{ type: "bold" }]))),
301
+ {
302
+ align: "right",
303
+ color: "#111827",
304
+ fontSize: 15,
305
+ paddingBottom: 12,
306
+ paddingLeft: 8,
307
+ paddingRight: 0,
308
+ paddingTop: 8,
309
+ }
310
+ ),
311
+ ]),
312
+ ],
313
+ {
314
+ backgroundColor: "#ffffff",
315
+ paddingBottom: 8,
316
+ paddingLeft: 32,
317
+ paddingRight: 32,
318
+ paddingTop: 0,
319
+ phone: { paddingLeft: 20, paddingRight: 20 },
320
+ stackOnPhone: false,
321
+ }
322
+ ),
323
+ singleColRow(
324
+ "rc-action-row",
325
+ "rc-action-col",
326
+ [
327
+ buttonBlock(
328
+ "rc-pdf-btn",
329
+ "Download PDF invoice",
330
+ "{{invoice_url}}",
331
+ {
332
+ align: "left",
333
+ paddingBottom: 16,
334
+ paddingLeft: 0,
335
+ paddingRight: 0,
336
+ paddingTop: 8,
337
+ }
338
+ ),
339
+ textBlock(
340
+ "rc-support",
341
+ doc(
342
+ p(
343
+ "Questions about this charge or need a billing address update? Contact ",
344
+ tagLink("support_email", "mailto:{{support_email}}"),
345
+ "."
346
+ )
347
+ ),
348
+ {
349
+ color: "#4b5563",
350
+ fontSize: 14,
351
+ paddingBottom: 4,
352
+ paddingLeft: 0,
353
+ paddingRight: 0,
354
+ paddingTop: 0,
355
+ }
356
+ ),
357
+ ],
358
+ {
359
+ backgroundColor: "#ffffff",
360
+ paddingBottom: 28,
361
+ paddingLeft: 32,
362
+ paddingRight: 32,
363
+ paddingTop: 4,
364
+ phone: { paddingLeft: 20, paddingRight: 20 },
365
+ }
366
+ ),
367
+ singleColRow(
368
+ "rc-footer-row",
369
+ "rc-footer-col",
370
+ [
371
+ textBlock(
372
+ "rc-footer-text",
373
+ doc(
374
+ p(
375
+ tag("company_name"),
376
+ " · ",
377
+ tag("company_address"),
378
+ br(),
379
+ linkText(
380
+ "Manage billing email preferences",
381
+ "{{unsubscribe_url}}"
382
+ )
383
+ )
384
+ ),
385
+ {
386
+ align: "center",
387
+ color: "#52525b",
388
+ fontSize: 13,
389
+ paddingBottom: 0,
390
+ paddingLeft: 0,
391
+ paddingRight: 0,
392
+ paddingTop: 0,
393
+ }
394
+ ),
395
+ ],
396
+ {
397
+ backgroundColor: "#f4f4f5",
398
+ paddingBottom: 24,
399
+ paddingLeft: 24,
400
+ paddingRight: 24,
401
+ paddingTop: 20,
402
+ }
403
+ ),
404
+ ]
405
+ )
406
+ );
407
+
408
+ /** High-clarity password reset and account security notice. */
409
+ export const passwordReset: TemplateStarterEmail =
410
+ /* #__PURE__ */
411
+ defineStarterEmail(
412
+ {
413
+ category: "transactional",
414
+ description: "High-clarity security link with expiry notice",
415
+ name: "Password reset",
416
+ },
417
+ () =>
418
+ emailDoc(
419
+ {
420
+ backgroundColor: "#f4f4f5",
421
+ fontFamily: FONT_SANS,
422
+ language: "en",
423
+ preheader:
424
+ "Use this one-time link within {{expiry_minutes}} minutes to reset your password.",
425
+ style: {
426
+ buttonBackgroundColor: "#0f172a",
427
+ buttonBorderRadius: 6,
428
+ emailBackgroundColor: "#ffffff",
429
+ heading1FontSize: 26,
430
+ linkColor: "#1d4ed8",
431
+ textColor: "#111827",
432
+ textFontSize: 16,
433
+ },
434
+ width: 540,
435
+ },
436
+ [
437
+ singleColRow(
438
+ "pr-header-row",
439
+ "pr-header-col",
440
+ [
441
+ textBlock(
442
+ "pr-brand",
443
+ doc(
444
+ p(
445
+ tag("company_name", [{ type: "bold" }]),
446
+ " · Account Security"
447
+ )
448
+ ),
449
+ {
450
+ color: "#475569",
451
+ fontSize: 13,
452
+ paddingBottom: 14,
453
+ paddingLeft: 0,
454
+ paddingRight: 0,
455
+ paddingTop: 4,
456
+ }
457
+ ),
458
+ dividerBlock("pr-top-rule", {
459
+ color: "#e4e4e7",
460
+ paddingBottom: 0,
461
+ paddingLeft: 0,
462
+ paddingRight: 0,
463
+ paddingTop: 0,
464
+ thickness: 1,
465
+ }),
466
+ ],
467
+ {
468
+ backgroundColor: "#ffffff",
469
+ paddingBottom: 8,
470
+ paddingLeft: 32,
471
+ paddingRight: 32,
472
+ paddingTop: 24,
473
+ phone: { paddingLeft: 20, paddingRight: 20 },
474
+ }
475
+ ),
476
+ singleColRow(
477
+ "pr-body-row",
478
+ "pr-body-col",
479
+ [
480
+ headingBlock(
481
+ "pr-title",
482
+ 1,
483
+ headingDoc(p("Reset your password")),
484
+ {
485
+ paddingBottom: 12,
486
+ paddingLeft: 0,
487
+ paddingRight: 0,
488
+ paddingTop: 12,
489
+ }
490
+ ),
491
+ textBlock(
492
+ "pr-copy",
493
+ doc(
494
+ p(
495
+ "Hi ",
496
+ tag("first_name"),
497
+ ", we received a request to reset the password for your ",
498
+ tag("company_name"),
499
+ " account. Use the button below to choose a new password."
500
+ )
501
+ ),
502
+ {
503
+ paddingBottom: 20,
504
+ paddingLeft: 0,
505
+ paddingRight: 0,
506
+ paddingTop: 0,
507
+ }
508
+ ),
509
+ buttonBlock("pr-cta", "Choose a new password", "{{reset_url}}", {
510
+ align: "left",
511
+ paddingBottom: 22,
512
+ paddingLeft: 0,
513
+ paddingRight: 0,
514
+ paddingTop: 0,
515
+ }),
516
+ textBlock(
517
+ "pr-notice-box",
518
+ doc(
519
+ p(
520
+ bold("Security details: "),
521
+ "This link expires in ",
522
+ tag("expiry_minutes", [{ type: "bold" }]),
523
+ " minutes and can only be used once. If you did not request a password reset, you can safely ignore this email — your password has not changed."
524
+ )
525
+ ),
526
+ {
527
+ borderColor: "#cbd5e1",
528
+ borderRadius: 6,
529
+ borderStyle: "solid",
530
+ borderWidth: 1,
531
+ boxBackgroundColor: "#f8fafc",
532
+ color: "#1e293b",
533
+ fontSize: 14,
534
+ paddingBottom: 16,
535
+ paddingLeft: 18,
536
+ paddingRight: 18,
537
+ paddingTop: 16,
538
+ }
539
+ ),
540
+ textBlock(
541
+ "pr-help",
542
+ doc(
543
+ p(
544
+ "Need help securing your account? ",
545
+ linkText("Visit the security help center", "{{help_url}}"),
546
+ " or contact ",
547
+ tagLink("support_email", "mailto:{{support_email}}"),
548
+ "."
549
+ )
550
+ ),
551
+ {
552
+ color: "#475569",
553
+ fontSize: 14,
554
+ paddingBottom: 4,
555
+ paddingLeft: 0,
556
+ paddingRight: 0,
557
+ paddingTop: 18,
558
+ }
559
+ ),
560
+ ],
561
+ {
562
+ backgroundColor: "#ffffff",
563
+ paddingBottom: 28,
564
+ paddingLeft: 32,
565
+ paddingRight: 32,
566
+ paddingTop: 4,
567
+ phone: { paddingLeft: 20, paddingRight: 20 },
568
+ }
569
+ ),
570
+ singleColRow(
571
+ "pr-footer-row",
572
+ "pr-footer-col",
573
+ [
574
+ textBlock(
575
+ "pr-footer-text",
576
+ doc(
577
+ p(
578
+ tag("company_name"),
579
+ " · ",
580
+ tag("company_address"),
581
+ br(),
582
+ linkText(
583
+ "Manage security notification preferences",
584
+ "{{unsubscribe_url}}"
585
+ )
586
+ )
587
+ ),
588
+ {
589
+ align: "center",
590
+ color: "#52525b",
591
+ fontSize: 13,
592
+ paddingBottom: 0,
593
+ paddingLeft: 0,
594
+ paddingRight: 0,
595
+ paddingTop: 0,
596
+ }
597
+ ),
598
+ ],
599
+ {
600
+ backgroundColor: "#f4f4f5",
601
+ paddingBottom: 24,
602
+ paddingLeft: 24,
603
+ paddingRight: 24,
604
+ paddingTop: 20,
605
+ }
606
+ ),
607
+ ]
608
+ )
609
+ );