@howone/sdk 0.3.25 → 0.3.26

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.mjs CHANGED
@@ -3855,8 +3855,20 @@ function createClient(opts) {
3855
3855
  if (!availableToken) {
3856
3856
  availableToken = await fetchExternalToken() ?? getCachedOrGlobalToken();
3857
3857
  }
3858
- if (!availableToken) return null;
3859
- return parseUserFromToken(availableToken);
3858
+ if (availableToken) {
3859
+ return parseUserFromToken(availableToken);
3860
+ }
3861
+ const sessionId = getGuestSessionId();
3862
+ if (sessionId) {
3863
+ return {
3864
+ id: `guest_${sessionId}`,
3865
+ email: "",
3866
+ name: "Guest",
3867
+ avatar: "",
3868
+ isGuest: true
3869
+ };
3870
+ }
3871
+ return null;
3860
3872
  } catch (_e2) {
3861
3873
  return null;
3862
3874
  }
@@ -3875,7 +3887,7 @@ function createClient(opts) {
3875
3887
  }
3876
3888
  return getCachedOrGlobalToken();
3877
3889
  },
3878
- isAuthenticated: () => Boolean(getCachedOrGlobalToken()),
3890
+ isAuthenticated: () => Boolean(getCachedOrGlobalToken() || getGuestSessionId()),
3879
3891
  // minimal login/logout stubs - consumers can override behavior
3880
3892
  login: (redirect) => {
3881
3893
  if (typeof window === "undefined") return;