authhero 0.27.0 → 0.28.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.
@@ -4398,11 +4398,14 @@ export type OnExecuteCredentialsExchangeAPI = {
4398
4398
  };
4399
4399
  export type OnExecuteCredentialsExchange = (event: OnExecuteCredentialsExchangeEvent, access: OnExecuteCredentialsExchangeAPI) => Promise<void>;
4400
4400
  export type SendEmailParams = {
4401
+ emailProvider: EmailProvider;
4401
4402
  to: string;
4402
4403
  from: string;
4403
4404
  subject: string;
4404
4405
  html?: string;
4405
4406
  text?: string;
4407
+ template: string;
4408
+ data: Record<string, string>;
4406
4409
  };
4407
4410
  export type SendEmailResponse = {};
4408
4411
  export type EmailService = (param: SendEmailParams) => Promise<SendEmailResponse>;
package/dist/authhero.mjs CHANGED
@@ -22905,38 +22905,37 @@ function Z2(r) {
22905
22905
  useragent: (i = r.header("user-agent")) == null ? void 0 : i.slice(0, 512)
22906
22906
  };
22907
22907
  }
22908
- async function Tf(r, e, a, i, t) {
22909
- var o;
22910
- const n = await r.env.data.emailProviders.get(e);
22911
- if (!n)
22908
+ async function Tf(r, e, a) {
22909
+ var n;
22910
+ const i = await r.env.data.emailProviders.get(e);
22911
+ if (!i)
22912
22912
  throw new se(500, { message: "Email provider not found" });
22913
- const s = (o = r.env.emailProviders) == null ? void 0 : o[n.name];
22914
- if (!s)
22913
+ const t = (n = r.env.emailProviders) == null ? void 0 : n[i.name];
22914
+ if (!t)
22915
22915
  throw new se(500, { message: "Email provider not found" });
22916
- await s({
22917
- to: a,
22918
- from: n.default_from_address || `login@${r.env.ISSUER}`,
22919
- subject: i,
22920
- html: t
22916
+ await t({
22917
+ emailProvider: i,
22918
+ ...a,
22919
+ from: i.default_from_address || `login@${r.env.ISSUER}`
22921
22920
  });
22922
22921
  }
22923
22922
  async function H2(r, e, a, i, t) {
22924
- await Tf(
22925
- r,
22926
- e,
22927
- a,
22928
- "Reset your password",
22929
- `Click here to reset your password: ${r.env.ISSUER}u/reset-password?state=${t}&code=${i}`
22930
- );
22923
+ await Tf(r, e, {
22924
+ to: a,
22925
+ subject: "Reset your password",
22926
+ html: `Click here to reset your password: ${r.env.ISSUER}u/reset-password?state=${t}&code=${i}`,
22927
+ template: "auth-password-reset",
22928
+ data: { code: i, state: t || "" }
22929
+ });
22931
22930
  }
22932
22931
  async function F2(r, e, a) {
22933
- await Tf(
22934
- r,
22935
- e,
22936
- a.email,
22937
- "Validate your email address",
22938
- `Click here to validate your email: ${r.env.ISSUER}u/validate-email`
22939
- );
22932
+ await Tf(r, e, {
22933
+ to: a.email,
22934
+ subject: "Validate your email address",
22935
+ html: `Click here to validate your email: ${r.env.ISSUER}u/validate-email`,
22936
+ template: "auth-verify-email",
22937
+ data: {}
22938
+ });
22940
22939
  }
22941
22940
  const K2 = new Qe().openapi(
22942
22941
  he({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authhero",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],