better-auth-studio 1.0.59-beta.13 → 1.0.59-beta.15

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.
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAeA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAS9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA+D9C,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAqLhG;AAeD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAyxLR"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAeA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAS9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA+D9C,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAqLhG;AAeD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAkzLR"}
package/dist/routes.js CHANGED
@@ -5122,14 +5122,11 @@ export const authClient = createAuthClient({
5122
5122
  }
5123
5123
  const envPath = join(process.cwd(), '.env');
5124
5124
  const envLocalPath = join(process.cwd(), '.env.local');
5125
- // Try .env.local first, then .env
5126
5125
  const targetPath = existsSync(envLocalPath) ? envLocalPath : envPath;
5127
5126
  const envContent = existsSync(targetPath) ? readFileSync(targetPath, 'utf-8') : '';
5128
- // Generate environment variable names
5129
5127
  const providerUpper = provider.toUpperCase();
5130
5128
  const clientIdKey = `${providerUpper}_CLIENT_ID`;
5131
5129
  const clientSecretKey = `${providerUpper}_CLIENT_SECRET`;
5132
- // Parse existing .env file
5133
5130
  const envLines = envContent.split('\n');
5134
5131
  const existingCredentials = {};
5135
5132
  envLines.forEach((line) => {
@@ -5318,37 +5315,66 @@ export const authClient = createAuthClient({
5318
5315
  fileContent.slice(importBlockEnd + 1);
5319
5316
  }
5320
5317
  else {
5321
- fileContent = `const resend = new Resend(process.env.RESEND_API_KEY || '');\n` + fileContent;
5318
+ fileContent =
5319
+ `const resend = new Resend(process.env.RESEND_API_KEY || '');\n` + fileContent;
5322
5320
  }
5323
5321
  }
5324
5322
  const handlers = {
5325
5323
  'password-reset': {
5326
5324
  regex: /sendResetPassword\s*:\s*async\s*\([^)]*\)\s*=>\s*\{[\s\S]*?\},?/,
5327
5325
  fn: `sendResetPassword: async ({ user, url, token }, request) => {
5326
+ const subject = \\\`${escapedSubject}\\\`
5327
+ .replace(/{{user.name}}/g, user?.name || '')
5328
+ .replace(/{{user.email}}/g, user?.email || '');
5329
+
5330
+ const html = \\\`${escapedHtml}\\\`
5331
+ .replace(/{{user.name}}/g, user?.name || '')
5332
+ .replace(/{{user.email}}/g, user?.email || '')
5333
+ .replace(/{{url}}/g, url || '')
5334
+ .replace(/{{token}}/g, token || '');
5335
+
5328
5336
  void sendEmail({
5329
5337
  to: user.email,
5330
- subject: "Reset your password",
5331
- text: \\\`Click the link to reset your password: \\\${url}\\\`,
5338
+ subject,
5339
+ html,
5332
5340
  });
5333
5341
  }`,
5334
5342
  },
5335
5343
  'email-verification': {
5336
5344
  regex: /sendVerificationEmail\s*:\s*async\s*\([^)]*\)\s*=>\s*\{[\s\S]*?\},?/,
5337
5345
  fn: `sendVerificationEmail: async ({ user, url, token }, request) => {
5346
+ const subject = \\\`${escapedSubject}\\\`
5347
+ .replace(/{{user.name}}/g, user?.name || '')
5348
+ .replace(/{{user.email}}/g, user?.email || '');
5349
+
5350
+ const html = \\\`${escapedHtml}\\\`
5351
+ .replace(/{{user.name}}/g, user?.name || '')
5352
+ .replace(/{{user.email}}/g, user?.email || '')
5353
+ .replace(/{{url}}/g, url || '')
5354
+ .replace(/{{token}}/g, token || '');
5355
+
5338
5356
  void sendEmail({
5339
5357
  to: user.email,
5340
- subject: "Verify your email address",
5341
- text: \\\`Click the link to verify your email: \\\${url}\\\`,
5358
+ subject,
5359
+ html,
5342
5360
  });
5343
5361
  }`,
5344
5362
  },
5345
5363
  'magic-link': {
5346
5364
  regex: /sendMagicLink\s*:\s*async\s*\([^)]*\)\s*=>\s*\{[\s\S]*?\},?/,
5347
5365
  fn: `sendMagicLink: async ({ email, token, url }, ctx) => {
5366
+ const subject = \\\`${escapedSubject}\\\`
5367
+ .replace(/{{user.email}}/g, email || '');
5368
+
5369
+ const html = \\\`${escapedHtml}\\\`
5370
+ .replace(/{{user.email}}/g, email || '')
5371
+ .replace(/{{url}}/g, url || '')
5372
+ .replace(/{{token}}/g, token || '');
5373
+
5348
5374
  void sendEmail({
5349
5375
  to: email,
5350
- subject: "Sign in to your account",
5351
- text: \\\`Click the link to sign in: \\\${url}\\\`,
5376
+ subject,
5377
+ html,
5352
5378
  });
5353
5379
  }`,
5354
5380
  },