ts-mailkit 0.3.0 → 1.1.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.
- package/README.md +0 -17
- package/dist/core/client.d.ts +0 -23
- package/dist/core/client.d.ts.map +1 -1
- package/dist/index.cjs +130 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +130 -63
- package/dist/index.js.map +1 -1
- package/dist/templates/dto/index.d.ts +0 -4
- package/dist/templates/dto/index.d.ts.map +1 -1
- package/dist/templates/factory.d.ts +73 -13
- package/dist/templates/factory.d.ts.map +1 -1
- package/dist/transports/zeptomail/types.d.ts +0 -5
- package/dist/transports/zeptomail/types.d.ts.map +1 -1
- package/dist/transports/zeptomail/zeptomail-sender.d.ts +0 -12
- package/dist/transports/zeptomail/zeptomail-sender.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -286,23 +286,6 @@ pnpm run prepublishOnly
|
|
|
286
286
|
|
|
287
287
|
---
|
|
288
288
|
|
|
289
|
-
## Deprecated API (Scheduled for Removal in v1.0.0)
|
|
290
|
-
|
|
291
|
-
The following legacy migration bridges and aliases are marked `@deprecated` and scheduled for removal in `v1.0.0`:
|
|
292
|
-
|
|
293
|
-
| Deprecated | Replacement | Notes |
|
|
294
|
-
| :--- | :--- | :--- |
|
|
295
|
-
| `ZeptoMailSender` | `ZeptoMailHttpSender` | Renamed to explicitly signify HTTP transport adapter. |
|
|
296
|
-
| `ZeptoMailConfig` | `ZeptoMailHttpConfig` | Configuration interface rename. |
|
|
297
|
-
| `sender.sendEmail(...)` | `sender.send({ to, subject, html, text, ... })` | Standardized on `SendMailOptions`. |
|
|
298
|
-
| `mailer.send(to, template, toName)` | `mailer.send({ to, template, ... })` | Use the type-safe options object. |
|
|
299
|
-
| `mailer.sendSimpleMessage(...)` | `mailer.sendRaw({ to, subject, text, html })` | Direct raw email dispatch. |
|
|
300
|
-
| `mailer.buildPlainTextMessage(template)` | `mailer.render(template)` or `buildPlainText(dto)` | Standalone or client renderer methods. |
|
|
301
|
-
| `EmailService` | `MailKit` | Main client class. |
|
|
302
|
-
| `BaseEmailDto` | `EmailTemplateDto` | Core DTO interface. |
|
|
303
|
-
|
|
304
|
-
---
|
|
305
|
-
|
|
306
289
|
## License
|
|
307
290
|
|
|
308
291
|
[MIT](LICENSE)
|
package/dist/core/client.d.ts
CHANGED
|
@@ -93,13 +93,6 @@ export declare class MailKit {
|
|
|
93
93
|
* Renders an email DTO to HTML and plain text without dispatching.
|
|
94
94
|
*/
|
|
95
95
|
render(template: EmailTemplateDto): Promise<RenderedEmail>;
|
|
96
|
-
/**
|
|
97
|
-
* Legacy positional send signature for backwards compatibility with 0.1.x:
|
|
98
|
-
* `send(to: string, template: EmailTemplateDto, toName?: string): Promise<SendResult>`
|
|
99
|
-
*
|
|
100
|
-
* @deprecated Use `send({ to, template, ... })` instead. This overload will be removed in v1.0.0.
|
|
101
|
-
*/
|
|
102
|
-
send(to: string, template: EmailTemplateDto, toName?: string): Promise<SendResult>;
|
|
103
96
|
/**
|
|
104
97
|
* Sends an email using a strongly-typed template DTO.
|
|
105
98
|
*
|
|
@@ -117,25 +110,9 @@ export declare class MailKit {
|
|
|
117
110
|
* If `options.text` is omitted, plain text is automatically derived from `options.html`.
|
|
118
111
|
*/
|
|
119
112
|
sendRaw(options: SendMailOptions): Promise<SendResult>;
|
|
120
|
-
/**
|
|
121
|
-
* Helper method matching legacy 0.1.x `sendSimpleMessage(to, subject, text, fromName?)`.
|
|
122
|
-
* @deprecated Use `sendRaw({ to, subject, text, ... })` instead. This method will be removed in v1.0.0.
|
|
123
|
-
*/
|
|
124
|
-
sendSimpleMessage(to: string, subject: string, text: string, fromName?: string): Promise<SendResult>;
|
|
125
|
-
/**
|
|
126
|
-
* Legacy helper method to construct plain text from a template.
|
|
127
|
-
* @deprecated Use `render(template)` or `buildPlainText(dto)` instead. This method will be removed in v1.0.0.
|
|
128
|
-
*/
|
|
129
|
-
buildPlainTextMessage(template: EmailTemplateDto): string;
|
|
130
113
|
}
|
|
131
114
|
/**
|
|
132
115
|
* Convenience factory to create a MailKit client instance.
|
|
133
116
|
*/
|
|
134
117
|
export declare function createMailKit(options: MailKitOptions): MailKit;
|
|
135
|
-
/**
|
|
136
|
-
* Backward-compatibility alias for `MailKit`.
|
|
137
|
-
* @deprecated Use `MailKit` instead. This alias will be removed in v1.0.0.
|
|
138
|
-
*/
|
|
139
|
-
export declare const EmailService: typeof MailKit;
|
|
140
|
-
export type EmailService = MailKit;
|
|
141
118
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAGxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,UAAU,EAChB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,EAAE,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAC5B;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,EAAE,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAC7B;;OAEG;IACH,GAAG,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAClC;;OAEG;IACH,WA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ClB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAY;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAiC;gBAExD,OAAO,EAAE,cAAc;IAWnC;;OAEG;IACH,YAAY,IAAI,YAAY;IAI5B;;OAEG;IACG,MAAM,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAIhE;;;;;;;;;;OAUG;IACG,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAgD7D;;;OAGG;IACG,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;CAS7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAE9D"}
|
package/dist/index.cjs
CHANGED
|
@@ -23,7 +23,6 @@ __export(index_exports, {
|
|
|
23
23
|
ConfigurationError: () => ConfigurationError,
|
|
24
24
|
ConsoleEmailSender: () => ConsoleEmailSender,
|
|
25
25
|
DefaultEmailRenderer: () => DefaultEmailRenderer,
|
|
26
|
-
EmailService: () => EmailService,
|
|
27
26
|
EmailTemplateFactory: () => EmailTemplateFactory,
|
|
28
27
|
MailKit: () => MailKit,
|
|
29
28
|
MailKitError: () => MailKitError,
|
|
@@ -31,7 +30,6 @@ __export(index_exports, {
|
|
|
31
30
|
TemplateError: () => TemplateError,
|
|
32
31
|
TransportError: () => TransportError,
|
|
33
32
|
ZeptoMailHttpSender: () => ZeptoMailHttpSender,
|
|
34
|
-
ZeptoMailSender: () => ZeptoMailSender,
|
|
35
33
|
buildHtml: () => buildHtml,
|
|
36
34
|
buildPlainText: () => buildPlainText,
|
|
37
35
|
createMailKit: () => createMailKit,
|
|
@@ -274,12 +272,18 @@ var MailKit = class {
|
|
|
274
272
|
async render(template) {
|
|
275
273
|
return await this.renderer.render(template);
|
|
276
274
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
275
|
+
/**
|
|
276
|
+
* Sends an email using a strongly-typed template DTO.
|
|
277
|
+
*
|
|
278
|
+
* Example:
|
|
279
|
+
* ```ts
|
|
280
|
+
* await mailer.send({
|
|
281
|
+
* to: 'user@example.com',
|
|
282
|
+
* template: myDto,
|
|
283
|
+
* });
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
async send(options) {
|
|
283
287
|
const template = options.template;
|
|
284
288
|
const recipientName = options.toName ?? template.userName;
|
|
285
289
|
let resolvedFromName = options.fromName ?? template.fromName;
|
|
@@ -330,31 +334,10 @@ var MailKit = class {
|
|
|
330
334
|
text
|
|
331
335
|
});
|
|
332
336
|
}
|
|
333
|
-
/**
|
|
334
|
-
* Helper method matching legacy 0.1.x `sendSimpleMessage(to, subject, text, fromName?)`.
|
|
335
|
-
* @deprecated Use `sendRaw({ to, subject, text, ... })` instead. This method will be removed in v1.0.0.
|
|
336
|
-
*/
|
|
337
|
-
async sendSimpleMessage(to, subject, text, fromName) {
|
|
338
|
-
return await this.sendRaw({
|
|
339
|
-
to,
|
|
340
|
-
subject,
|
|
341
|
-
text,
|
|
342
|
-
html: `<pre style="font-family:monospace;white-space:pre-wrap;">${text}</pre>`,
|
|
343
|
-
from: fromName && this.defaultFrom ? { address: normalizeRecipient(this.defaultFrom).address, name: fromName } : this.defaultFrom
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Legacy helper method to construct plain text from a template.
|
|
348
|
-
* @deprecated Use `render(template)` or `buildPlainText(dto)` instead. This method will be removed in v1.0.0.
|
|
349
|
-
*/
|
|
350
|
-
buildPlainTextMessage(template) {
|
|
351
|
-
return template.noHtmlMessage ?? buildPlainText(template);
|
|
352
|
-
}
|
|
353
337
|
};
|
|
354
338
|
function createMailKit(options) {
|
|
355
339
|
return new MailKit(options);
|
|
356
340
|
}
|
|
357
|
-
var EmailService = MailKit;
|
|
358
341
|
|
|
359
342
|
// src/transports/zeptomail/zeptomail-sender.ts
|
|
360
343
|
var ZeptoMailHttpSender = class {
|
|
@@ -500,22 +483,7 @@ var ZeptoMailHttpSender = class {
|
|
|
500
483
|
response: responseData
|
|
501
484
|
};
|
|
502
485
|
}
|
|
503
|
-
/**
|
|
504
|
-
* Backward-compatible helper method matching legacy signature:
|
|
505
|
-
* `sendEmail(to, htmlBody, subject, toName?, plaintextBody?, fromName?)`
|
|
506
|
-
* @deprecated Use `send({ to, subject, html, text, ... })` instead. This method will be removed in v1.0.0.
|
|
507
|
-
*/
|
|
508
|
-
async sendEmail(to, htmlBody, subject, toName = "", plaintextBody, fromName) {
|
|
509
|
-
await this.send({
|
|
510
|
-
to: { address: to, name: toName },
|
|
511
|
-
from: fromName ? { address: this.defaultFrom.address, name: fromName } : this.defaultFrom,
|
|
512
|
-
subject,
|
|
513
|
-
html: htmlBody,
|
|
514
|
-
text: plaintextBody
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
486
|
};
|
|
518
|
-
var ZeptoMailSender = ZeptoMailHttpSender;
|
|
519
487
|
|
|
520
488
|
// src/transports/memory/memory-sender.ts
|
|
521
489
|
var MemoryEmailSender = class {
|
|
@@ -637,7 +605,8 @@ var EmailTemplateFactory = class _EmailTemplateFactory {
|
|
|
637
605
|
/**
|
|
638
606
|
* Welcome / email-verification email sent after registration.
|
|
639
607
|
*/
|
|
640
|
-
createEmailVerification(
|
|
608
|
+
createEmailVerification(params) {
|
|
609
|
+
const { username, verificationUrl, otp, brandName } = params;
|
|
641
610
|
const brand = this.resolveBrand(brandName);
|
|
642
611
|
const body = `Hi ${username},<br/>Thank you for signing up. Use the code below or click the button to verify your email address.`;
|
|
643
612
|
return {
|
|
@@ -660,10 +629,18 @@ Alternatively, verify here:
|
|
|
660
629
|
${verificationUrl}`
|
|
661
630
|
};
|
|
662
631
|
}
|
|
632
|
+
/**
|
|
633
|
+
* @deprecated Use `createEmailVerification({ username, verificationUrl, otp, brandName })` with the Parameter Object pattern instead.
|
|
634
|
+
* Will be removed in the next major release.
|
|
635
|
+
*/
|
|
636
|
+
createEmailVerification_Legacy(username, verificationUrl, otp, brandName) {
|
|
637
|
+
return this.createEmailVerification({ username, verificationUrl, otp, brandName });
|
|
638
|
+
}
|
|
663
639
|
/**
|
|
664
640
|
* Password-reset email with an optional OTP code and action link.
|
|
665
641
|
*/
|
|
666
|
-
createPasswordReset(
|
|
642
|
+
createPasswordReset(params) {
|
|
643
|
+
const { username, resetUrl, otp = "", brandName } = params;
|
|
667
644
|
const brand = this.resolveBrand(brandName);
|
|
668
645
|
const body = `Hi ${username},<br/>We received a request to reset your password. Use the OTP code below or click the button to proceed.`;
|
|
669
646
|
const plainTextOtp = otp ? `
|
|
@@ -687,10 +664,18 @@ Alternatively, you can use the following link to reset your password:
|
|
|
687
664
|
${resetUrl}`
|
|
688
665
|
};
|
|
689
666
|
}
|
|
667
|
+
/**
|
|
668
|
+
* @deprecated Use `createPasswordReset({ username, resetUrl, otp, brandName })` with the Parameter Object pattern instead.
|
|
669
|
+
* Will be removed in the next major release.
|
|
670
|
+
*/
|
|
671
|
+
createPasswordReset_Legacy(username, resetUrl, otp = "", brandName) {
|
|
672
|
+
return this.createPasswordReset({ username, resetUrl, otp, brandName });
|
|
673
|
+
}
|
|
690
674
|
/**
|
|
691
675
|
* Generic plain message email (no action button, no OTP).
|
|
692
676
|
*/
|
|
693
|
-
createSimpleMessage(
|
|
677
|
+
createSimpleMessage(params) {
|
|
678
|
+
const { subject, header, body, brandName } = params;
|
|
694
679
|
const brand = this.resolveBrand(brandName);
|
|
695
680
|
return {
|
|
696
681
|
subject,
|
|
@@ -702,10 +687,18 @@ ${resetUrl}`
|
|
|
702
687
|
noHtmlMessage: htmlToPlainText(body)
|
|
703
688
|
};
|
|
704
689
|
}
|
|
690
|
+
/**
|
|
691
|
+
* @deprecated Use `createSimpleMessage({ subject, header, body, brandName })` with the Parameter Object pattern instead.
|
|
692
|
+
* Will be removed in the next major release.
|
|
693
|
+
*/
|
|
694
|
+
createSimpleMessage_Legacy(subject, header, body, brandName) {
|
|
695
|
+
return this.createSimpleMessage({ subject, header, body, brandName });
|
|
696
|
+
}
|
|
705
697
|
/**
|
|
706
698
|
* Newsletter / announcement email with an optional hero image and CTA button.
|
|
707
699
|
*/
|
|
708
|
-
createNewsLetter(
|
|
700
|
+
createNewsLetter(params) {
|
|
701
|
+
const { subject, header, body, imageUrl, actionUrl, actionText, brandName, logoUrl } = params;
|
|
709
702
|
const brand = this.resolveBrand(brandName);
|
|
710
703
|
let noHtmlMessage = htmlToPlainText(body);
|
|
711
704
|
if (actionUrl) {
|
|
@@ -726,10 +719,27 @@ ${actionText || "Learn more"}: ${actionUrl}`;
|
|
|
726
719
|
noHtmlMessage
|
|
727
720
|
};
|
|
728
721
|
}
|
|
722
|
+
/**
|
|
723
|
+
* @deprecated Use `createNewsLetter({ subject, header, body, imageUrl, actionUrl, actionText, brandName, logoUrl })` with the Parameter Object pattern instead.
|
|
724
|
+
* Will be removed in the next major release.
|
|
725
|
+
*/
|
|
726
|
+
createNewsLetter_Legacy(subject, header, body, imageUrl, actionUrl, actionText, brandName, logoUrl) {
|
|
727
|
+
return this.createNewsLetter({
|
|
728
|
+
subject,
|
|
729
|
+
header,
|
|
730
|
+
body,
|
|
731
|
+
imageUrl,
|
|
732
|
+
actionUrl,
|
|
733
|
+
actionText,
|
|
734
|
+
brandName,
|
|
735
|
+
logoUrl
|
|
736
|
+
});
|
|
737
|
+
}
|
|
729
738
|
/**
|
|
730
739
|
* Two-factor authentication email with OTP code and optional magic link.
|
|
731
740
|
*/
|
|
732
|
-
create2FAEmail(
|
|
741
|
+
create2FAEmail(params) {
|
|
742
|
+
const { username, otp, magicLink = "", brandName } = params;
|
|
733
743
|
const brand = this.resolveBrand(brandName);
|
|
734
744
|
const body = `Hi ${username},<br/>Use the code below or click the button to complete your login.`;
|
|
735
745
|
const plainLink = magicLink ? `
|
|
@@ -753,10 +763,18 @@ ${magicLink}` : "";
|
|
|
753
763
|
Your verification code is: ${otp}` + plainLink
|
|
754
764
|
};
|
|
755
765
|
}
|
|
766
|
+
/**
|
|
767
|
+
* @deprecated Use `create2FAEmail({ username, otp, magicLink, brandName })` with the Parameter Object pattern instead.
|
|
768
|
+
* Will be removed in the next major release.
|
|
769
|
+
*/
|
|
770
|
+
create2FAEmail_Legacy(username, otp, magicLink = "", brandName) {
|
|
771
|
+
return this.create2FAEmail({ username, otp, magicLink, brandName });
|
|
772
|
+
}
|
|
756
773
|
/**
|
|
757
774
|
* Magic link sign-in email (no OTP, button only).
|
|
758
775
|
*/
|
|
759
|
-
createMagicLinkEmail(
|
|
776
|
+
createMagicLinkEmail(params) {
|
|
777
|
+
const { username, magicLink, brandName } = params;
|
|
760
778
|
const brand = this.resolveBrand(brandName);
|
|
761
779
|
const body = `Hi ${username},<br/>Click the button below to sign in. No password needed.`;
|
|
762
780
|
return {
|
|
@@ -776,6 +794,13 @@ Sign in here:
|
|
|
776
794
|
${magicLink}`
|
|
777
795
|
};
|
|
778
796
|
}
|
|
797
|
+
/**
|
|
798
|
+
* @deprecated Use `createMagicLinkEmail({ username, magicLink, brandName })` with the Parameter Object pattern instead.
|
|
799
|
+
* Will be removed in the next major release.
|
|
800
|
+
*/
|
|
801
|
+
createMagicLinkEmail_Legacy(username, magicLink, brandName) {
|
|
802
|
+
return this.createMagicLinkEmail({ username, magicLink, brandName });
|
|
803
|
+
}
|
|
779
804
|
// ─── Default Static Instance ──────────────────────────────────────────────
|
|
780
805
|
static _defaultInstance;
|
|
781
806
|
static get defaultInstance() {
|
|
@@ -784,17 +809,45 @@ ${magicLink}`
|
|
|
784
809
|
}
|
|
785
810
|
return this._defaultInstance;
|
|
786
811
|
}
|
|
787
|
-
static createEmailVerification(
|
|
788
|
-
return this.defaultInstance.createEmailVerification(
|
|
812
|
+
static createEmailVerification(params) {
|
|
813
|
+
return this.defaultInstance.createEmailVerification(params);
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* @deprecated Use `createEmailVerification(params: EmailVerificationParams)` instead.
|
|
817
|
+
* Will be removed in the next major release.
|
|
818
|
+
*/
|
|
819
|
+
static createEmailVerification_Legacy(username, verificationUrl, otp, brandName) {
|
|
820
|
+
return this.defaultInstance.createEmailVerification({ username, verificationUrl, otp, brandName });
|
|
821
|
+
}
|
|
822
|
+
static createPasswordReset(params) {
|
|
823
|
+
return this.defaultInstance.createPasswordReset(params);
|
|
789
824
|
}
|
|
790
|
-
|
|
791
|
-
|
|
825
|
+
/**
|
|
826
|
+
* @deprecated Use `createPasswordReset(params: PasswordResetParams)` instead.
|
|
827
|
+
* Will be removed in the next major release.
|
|
828
|
+
*/
|
|
829
|
+
static createPasswordReset_Legacy(username, resetUrl, otp, brandName) {
|
|
830
|
+
return this.defaultInstance.createPasswordReset({ username, resetUrl, otp, brandName });
|
|
831
|
+
}
|
|
832
|
+
static createSimpleMessage(params) {
|
|
833
|
+
return this.defaultInstance.createSimpleMessage(params);
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* @deprecated Use `createSimpleMessage(params: SimpleMessageParams)` instead.
|
|
837
|
+
* Will be removed in the next major release.
|
|
838
|
+
*/
|
|
839
|
+
static createSimpleMessage_Legacy(subject, header, body, brandName) {
|
|
840
|
+
return this.defaultInstance.createSimpleMessage({ subject, header, body, brandName });
|
|
792
841
|
}
|
|
793
|
-
static
|
|
794
|
-
return this.defaultInstance.
|
|
842
|
+
static createNewsLetter(params) {
|
|
843
|
+
return this.defaultInstance.createNewsLetter(params);
|
|
795
844
|
}
|
|
796
|
-
|
|
797
|
-
|
|
845
|
+
/**
|
|
846
|
+
* @deprecated Use `createNewsLetter(params: NewsletterParams)` instead.
|
|
847
|
+
* Will be removed in the next major release.
|
|
848
|
+
*/
|
|
849
|
+
static createNewsLetter_Legacy(subject, header, body, imageUrl, actionUrl, actionText, brandName, logoUrl) {
|
|
850
|
+
return this.defaultInstance.createNewsLetter({
|
|
798
851
|
subject,
|
|
799
852
|
header,
|
|
800
853
|
body,
|
|
@@ -803,13 +856,27 @@ ${magicLink}`
|
|
|
803
856
|
actionText,
|
|
804
857
|
brandName,
|
|
805
858
|
logoUrl
|
|
806
|
-
);
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
static create2FAEmail(params) {
|
|
862
|
+
return this.defaultInstance.create2FAEmail(params);
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* @deprecated Use `create2FAEmail(params: TwoFactorParams)` instead.
|
|
866
|
+
* Will be removed in the next major release.
|
|
867
|
+
*/
|
|
868
|
+
static create2FAEmail_Legacy(username, otp, magicLink, brandName) {
|
|
869
|
+
return this.defaultInstance.create2FAEmail({ username, otp, magicLink, brandName });
|
|
807
870
|
}
|
|
808
|
-
static
|
|
809
|
-
return this.defaultInstance.
|
|
871
|
+
static createMagicLinkEmail(params) {
|
|
872
|
+
return this.defaultInstance.createMagicLinkEmail(params);
|
|
810
873
|
}
|
|
811
|
-
|
|
812
|
-
|
|
874
|
+
/**
|
|
875
|
+
* @deprecated Use `createMagicLinkEmail(params: MagicLinkParams)` instead.
|
|
876
|
+
* Will be removed in the next major release.
|
|
877
|
+
*/
|
|
878
|
+
static createMagicLinkEmail_Legacy(username, magicLink, brandName) {
|
|
879
|
+
return this.defaultInstance.createMagicLinkEmail({ username, magicLink, brandName });
|
|
813
880
|
}
|
|
814
881
|
};
|
|
815
882
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -817,7 +884,6 @@ ${magicLink}`
|
|
|
817
884
|
ConfigurationError,
|
|
818
885
|
ConsoleEmailSender,
|
|
819
886
|
DefaultEmailRenderer,
|
|
820
|
-
EmailService,
|
|
821
887
|
EmailTemplateFactory,
|
|
822
888
|
MailKit,
|
|
823
889
|
MailKitError,
|
|
@@ -825,7 +891,6 @@ ${magicLink}`
|
|
|
825
891
|
TemplateError,
|
|
826
892
|
TransportError,
|
|
827
893
|
ZeptoMailHttpSender,
|
|
828
|
-
ZeptoMailSender,
|
|
829
894
|
buildHtml,
|
|
830
895
|
buildPlainText,
|
|
831
896
|
createMailKit,
|