@nerdfolio/ba-guest-list 0.1.0 → 0.1.1

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/dist/index.cjs CHANGED
@@ -40,10 +40,13 @@ var import_v4_mini = require("zod/v4-mini");
40
40
 
41
41
  // src/utils.ts
42
42
  var import_lodash_es = require("lodash-es");
43
- function getHostName(url) {
43
+ function parseEmailDomain(url) {
44
44
  try {
45
- const parsedUrl = new URL(url);
46
- return parsedUrl.hostname;
45
+ const { hostname } = new URL(url);
46
+ if (hostname === "localhost") {
47
+ return "localhost.example.com";
48
+ }
49
+ return hostname;
47
50
  } catch (_error) {
48
51
  return null;
49
52
  }
@@ -128,7 +131,7 @@ var guestList = (options) => {
128
131
  message: options?.revealNames ? `Name not on list. Try: ${JSON.stringify(Object.keys(guestLookup))}` : ERROR_CODES.NAME_NOT_ON_GUEST_LIST
129
132
  });
130
133
  }
131
- const { emailDomainName = getHostName(ctx.context.baseURL) } = options ?? {};
134
+ const { emailDomainName = parseEmailDomain(ctx.context.baseURL) } = options ?? {};
132
135
  const email = `${cleanedName.toLowerCase().replaceAll(/\s/g, "")}.onguestlist@${emailDomainName}`;
133
136
  const found = await ctx.context.internalAdapter.findUserByEmail(email);
134
137
  async function createNewUser() {
package/dist/index.mjs CHANGED
@@ -13,10 +13,13 @@ import { z } from "zod/v4-mini";
13
13
 
14
14
  // src/utils.ts
15
15
  import { capitalize } from "lodash-es";
16
- function getHostName(url) {
16
+ function parseEmailDomain(url) {
17
17
  try {
18
- const parsedUrl = new URL(url);
19
- return parsedUrl.hostname;
18
+ const { hostname } = new URL(url);
19
+ if (hostname === "localhost") {
20
+ return "localhost.example.com";
21
+ }
22
+ return hostname;
20
23
  } catch (_error) {
21
24
  return null;
22
25
  }
@@ -101,7 +104,7 @@ var guestList = (options) => {
101
104
  message: options?.revealNames ? `Name not on list. Try: ${JSON.stringify(Object.keys(guestLookup))}` : ERROR_CODES.NAME_NOT_ON_GUEST_LIST
102
105
  });
103
106
  }
104
- const { emailDomainName = getHostName(ctx.context.baseURL) } = options ?? {};
107
+ const { emailDomainName = parseEmailDomain(ctx.context.baseURL) } = options ?? {};
105
108
  const email = `${cleanedName.toLowerCase().replaceAll(/\s/g, "")}.onguestlist@${emailDomainName}`;
106
109
  const found = await ctx.context.internalAdapter.findUserByEmail(email);
107
110
  async function createNewUser() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nerdfolio/ba-guest-list",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Similar to anonymous, but with a name that must be on a guest list. Useful for testing or demo with fixed logins",
5
5
  "repository": "https://github.com/nerdfolio/better-auth-goodies",
6
6
  "type": "module",