@usepatch/widget 0.1.0 → 0.2.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/dist/index.js CHANGED
@@ -2068,7 +2068,7 @@ function useWidgetUiStore() {
2068
2068
  }
2069
2069
 
2070
2070
  // src/env-token-resolver.ts
2071
- var MESSAGE = "[Patch] No project token found. Pass `projectToken` as a prop, or set NEXT_PUBLIC_PATCH_TOKEN (Next.js) / VITE_PATCH_TOKEN (Vite) in your env.";
2071
+ var MESSAGE = "[Patch] No project token found. Pass `projectToken` as a prop, or set NEXT_PUBLIC_PATCH_TOKEN (Next.js), VITE_PATCH_TOKEN (Vite / React Router), or PUBLIC_PATCH_TOKEN (Astro) in your env.";
2072
2072
  function resolveProjectToken(input) {
2073
2073
  const fromProp = input.prop?.trim();
2074
2074
  if (fromProp) return fromProp;
@@ -2076,6 +2076,8 @@ function resolveProjectToken(input) {
2076
2076
  if (fromNext) return fromNext;
2077
2077
  const fromVite = input.importMetaEnv?.VITE_PATCH_TOKEN?.trim();
2078
2078
  if (fromVite) return fromVite;
2079
+ const fromAstro = input.importMetaEnv?.PUBLIC_PATCH_TOKEN?.trim();
2080
+ if (fromAstro) return fromAstro;
2079
2081
  throw new Error(MESSAGE);
2080
2082
  }
2081
2083
  function readImportMetaEnv() {
@@ -2166,7 +2168,8 @@ function splitAvatarValue(value) {
2166
2168
  if (value.startsWith(AVATAR_SEED_PREFIX)) {
2167
2169
  return { url: null, seed: value.slice(AVATAR_SEED_PREFIX.length) || null };
2168
2170
  }
2169
- return { url: value, seed: null };
2171
+ if (/^https?:\/\//i.test(value)) return { url: value, seed: null };
2172
+ return { url: null, seed: value };
2170
2173
  }
2171
2174
 
2172
2175
  // ../shared/src/client-avatars.ts