better-auth-studio 1.0.59-beta.10 → 1.0.59-beta.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-auth-studio",
3
- "version": "1.0.59-beta.10",
3
+ "version": "1.0.59-beta.11",
4
4
  "description": "Studio for Better Auth",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -685,7 +685,7 @@ ${e.map(n=>{var s,i,o;const a=Object.entries(n.styles).filter(([l,c])=>c).map(([
685
685
  <hr style="border: none; border-top: 1px solid #eee; margin: 30px 0;">
686
686
  <p style="color: #999; font-size: 12px; text-align: center;">© {{year}} Better Auth. All rights reserved.</p>
687
687
  </body>
688
- </html>`,fields:["user.email","url","token","expiresIn"],category:"authentication"},"org-invitation":{id:"org-invitation",name:"Organization Invitation",subject:"You've been invited to {{org.name}}",html:`<!DOCTYPE html>
688
+ </html>`,fields:["user.email","url","token","expiresIn"],category:"authentication"},"org-invitation":{id:"org-invitation",name:"Organization Invitation",subject:"You've been invited to {{organization.name}}",html:`<!DOCTYPE html>
689
689
  <html>
690
690
  <head>
691
691
  <meta charset="utf-8">
@@ -702,21 +702,21 @@ ${e.map(n=>{var s,i,o;const a=Object.entries(n.styles).filter(([l,c])=>c).map(([
702
702
 
703
703
  <p>Hello,</p>
704
704
 
705
- <p><strong>{{inviter.name}}</strong> has invited you to join <strong>{{org.name}}</strong>.</p>
705
+ <p><strong>{{inviter.user.name}}</strong> has invited you to join <strong>{{organization.name}}</strong>.</p>
706
706
 
707
707
  <div style="text-align: center; margin: 30px 0;">
708
- <a href="{{url}}" style="display: inline-block; background: #000; color: #fff; padding: 12px 30px; text-decoration: none; border-radius: 4px; font-weight: 500;">Accept Invitation</a>
708
+ <a href="{{invitation.url}}" style="display: inline-block; background: #000; color: #fff; padding: 12px 30px; text-decoration: none; border-radius: 4px; font-weight: 500;">Accept Invitation</a>
709
709
  </div>
710
710
 
711
711
  <p style="color: #666; font-size: 14px;">Or copy and paste this link into your browser:</p>
712
- <p style="color: #666; font-size: 14px; word-break: break-all;">{{url}}</p>
712
+ <p style="color: #666; font-size: 14px; word-break: break-all;">{{invitation.url}}</p>
713
713
 
714
714
  <p style="color: #666; font-size: 14px;">This invitation will expire in {{expiresIn}}.</p>
715
715
 
716
716
  <hr style="border: none; border-top: 1px solid #eee; margin: 30px 0;">
717
717
  <p style="color: #999; font-size: 12px; text-align: center;">© {{year}} Better Auth. All rights reserved.</p>
718
718
  </body>
719
- </html>`,fields:["inviter.name","inviter.email","org.name","org.slug","url","role","expiresIn"],category:"organization"},welcome:{id:"welcome",name:"Welcome Email",subject:"Welcome to {{app.name}}",html:`<!DOCTYPE html>
719
+ </html>`,fields:["invitation.url","invitation.expiresAt","invitation.email","invitation.role","inviter.user.name","inviter.user.email","organization.name","organization.slug","expiresIn"],category:"organization"},welcome:{id:"welcome",name:"Welcome Email",subject:"Welcome to {{app.name}}",html:`<!DOCTYPE html>
720
720
  <html>
721
721
  <head>
722
722
  <meta charset="utf-8">
@@ -837,12 +837,22 @@ export const auth = betterAuth({
837
837
  // ... other config
838
838
  plugins: [
839
839
  organization({
840
- sendInvitationEmail: async ({ invitation, org, inviter, url }) => {
840
+ sendInvitationEmail: async ( data, request ) => {
841
+ const { invitation, organization, inviter } = data;
842
+ const url =
843
+ (invitation as any).url ||
844
+ (invitation as any).link ||
845
+ request?.url ||
846
+ invitation.id;
841
847
  await resend.emails.send({
842
848
  from: 'noreply@yourdomain.com',
843
- to: invitation.email,
849
+ to: invitation.email || data.email,
844
850
  subject: \`${A}\`,
845
- html: \`${j}\`,
851
+ html: \`${j}\`
852
+ .replace(/{{invitation.url}}/g, url)
853
+ .replace(/{{organization.name}}/g, organization?.name || '')
854
+ .replace(/{{inviter.user.name}}/g, inviter?.user?.name || '')
855
+ .replace(/{{inviter.user.email}}/g, inviter?.user?.email || '')\`,
846
856
  });
847
857
  },
848
858
  }),
package/public/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Better Auth Studio</title>
8
- <script type="module" crossorigin src="/assets/main-BysNKkbj.js"></script>
8
+ <script type="module" crossorigin src="/assets/main-RRrATaXc.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/main-Bbsm29F_.css">
10
10
  </head>
11
11
  <body>