@turbofy-ai/app-runtime 0.0.12 → 0.0.14

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,8 +1,12 @@
1
+ import type { ISocialSignInOptions, ISocialSignInResult } from "@/lib/social-popup";
1
2
  export interface IAuthResult {
2
3
  ok: boolean;
3
4
  error?: string;
4
5
  /** Signup only: the account was created but needs email confirmation. */
5
6
  needsConfirmation?: boolean;
7
+ /** A successful account mutation can still require a separate sign-in. */
8
+ signedIn?: boolean;
9
+ signInError?: string;
6
10
  }
7
11
  export interface ICurrentUser {
8
12
  sub: string;
@@ -19,11 +23,38 @@ export declare const signup: (params: {
19
23
  password: string;
20
24
  name?: string;
21
25
  }) => Promise<IAuthResult>;
22
- export declare const confirmSignup: (email: string, code: string) => Promise<IAuthResult>;
26
+ export declare const confirmSignup: (email: string, code: string, password?: string) => Promise<IAuthResult>;
27
+ export declare const refreshAccessToken: () => Promise<IAuthResult>;
28
+ export declare const forgotPassword: (email: string) => Promise<IAuthResult>;
29
+ export declare const resetPassword: (email: string, code: string, newPassword: string) => Promise<IAuthResult>;
30
+ export declare const changePassword: (currentPassword: string, newPassword: string) => Promise<IAuthResult>;
31
+ export type ISocialAuthorizeResult = {
32
+ ok: true;
33
+ url: string;
34
+ state: string;
35
+ } | {
36
+ ok: false;
37
+ error: string;
38
+ };
39
+ /** The caller owns the PKCE verifier, pending state, and provider navigation. */
40
+ export declare const getSocialAuthorizeUrl: (params: {
41
+ provider: string;
42
+ redirectUri: string;
43
+ codeChallenge: string;
44
+ }) => Promise<ISocialAuthorizeResult>;
45
+ /** Validate callback state against the pending login before exchanging its code. */
46
+ export declare const socialSignIn: (params: {
47
+ code: string;
48
+ state: string;
49
+ codeVerifier: string;
50
+ }) => Promise<IAuthResult>;
51
+ export type { ISocialSignInOptions, ISocialSignInResult, } from "@/lib/social-popup";
52
+ /** Preview uses the console callback; published apps supply their own callback. */
53
+ export declare const signInWithSocialProvider: (provider: string, options?: ISocialSignInOptions) => Promise<ISocialSignInResult>;
23
54
  export declare const logout: () => Promise<IAuthResult>;
24
- /** Read the signed-in Cognito user from the published app's session cookies. */
55
+ /** The signed-in end user, or null without a valid session. */
25
56
  export declare const currentUser: () => Promise<ICurrentUserResult>;
26
- /** React hook that loads the signed-in user once on mount. */
57
+ /** Load the signed-in user and follow successful session changes in this frame. */
27
58
  export declare const useCurrentUser: () => {
28
59
  refetch: () => Promise<void>;
29
60
  user: ICurrentUser | null;
@@ -37,3 +68,9 @@ export declare const useCurrentUser: () => {
37
68
  * the current locale, then the locale home, then the site root.
38
69
  */
39
70
  export declare function safeNextPath(next: string | undefined): string;
71
+ /**
72
+ * The published app reloads so the route middleware sees the new session
73
+ * cookie; the console preview has no cookie and stays inside its host-driven
74
+ * router.
75
+ */
76
+ export declare function redirectAfterAuth(next: string | undefined): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export declare const pageRoutePattern: (locale: string, slug: string) => string;
2
+ export declare const resolveGuestRedirect: ({ next, defaultPath, homePath, currentPath, guestPatterns, }: {
3
+ next?: string;
4
+ defaultPath?: string;
5
+ homePath: string;
6
+ currentPath: string;
7
+ guestPatterns: string[];
8
+ }) => string | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface IPreviewAuthContext {
2
+ locale: string;
3
+ socialCallbackUrl?: string;
4
+ defaultRedirectPath?: string;
5
+ }
6
+ export declare const setPreviewAuthContext: (context: IPreviewAuthContext | null) => void;
7
+ export declare const getPreviewAuthContext: () => IPreviewAuthContext | undefined;
@@ -0,0 +1,11 @@
1
+ export declare const APP_AUTH_CALLBACK_PATH = "/auth/app-callback";
2
+ export declare const APP_AUTH_CALLBACK_MESSAGE = "turbofy:app-auth-callback";
3
+ export interface ISocialCallback {
4
+ state: string;
5
+ code?: string;
6
+ error?: string;
7
+ }
8
+ export declare const parseSocialCallback: (search: string) => ISocialCallback | null;
9
+ export declare const readSocialCallbackMessage: (event: MessageEvent, popup: Window, callbackUrl: URL, state: string) => ISocialCallback | null;
10
+ export type ISocialCallbackStatus = "returning" | "returned" | "invalid" | "missingOpener" | "timedOut";
11
+ export declare const relaySocialCallback: (callback: ISocialCallback | null, onStatus: (status: ISocialCallbackStatus) => void) => (() => void);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { IAuthResult, ISocialAuthorizeResult } from "@/lib/auth";
2
+ export type ISocialSignInErrorCode = "NOT_CONFIGURED" | "POPUP_BLOCKED" | "CANCELLED" | "TIMED_OUT" | "IN_PROGRESS" | "SIGN_IN_FAILED";
3
+ export type ISocialSignInResult = IAuthResult & {
4
+ errorCode?: ISocialSignInErrorCode;
5
+ };
6
+ export interface ISocialSignInOptions {
7
+ redirectUri?: string;
8
+ signal?: AbortSignal;
9
+ }
10
+ interface IPopupActions {
11
+ authorize: (params: {
12
+ provider: string;
13
+ redirectUri: string;
14
+ codeChallenge: string;
15
+ }) => Promise<ISocialAuthorizeResult>;
16
+ exchange: (params: {
17
+ code: string;
18
+ state: string;
19
+ codeVerifier: string;
20
+ }) => Promise<IAuthResult>;
21
+ }
22
+ export declare const runSocialSignInPopup: (provider: string, options: ISocialSignInOptions, actions: IPopupActions) => Promise<ISocialSignInResult>;
23
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turbofy-ai/app-runtime",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -82,7 +82,7 @@
82
82
  "sonner": "^2.0.7",
83
83
  "tailwind-merge": "^3.4.0",
84
84
  "vaul": "^1.1.2",
85
- "zod": "^4.4.3"
85
+ "zod": "~4.3.6"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@graphapi-io/declarations": "*",