@scalemule/nextjs 0.1.75 → 0.1.76

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.
@@ -267,5 +267,4 @@ interface ServiceAiClientConfig {
267
267
  */
268
268
  declare function createServiceAiClient(config: ServiceAiClientConfig): ScaleMuleAi;
269
269
 
270
- export { KNOWN_ACCOUNTS_COOKIE_NAME as K, USER_ID_COOKIE_NAME as U, SESSION_COOKIE_NAME as d, appendKnownAccountCookie as f, clearKnownAccountsCookie as g, clearSession as h, createAiRoutes as i, createServiceAiClient as j, getKnownAccountsCookieRaw as k, getKnownAccountsFromRequest as l, getSession as m, getSessionFromRequest as n, normalizeKnownAccountsCookie as o, requireSession as p, resolveAiTarget as q, removeKnownAccountFromCookie as r, withSession as w };
271
- export type { AiAccountResolver as A, SessionCookieOptions as S, SessionData as a, AiRoutesConfig as b, KnownAccountEntry as c, ServiceAiClientConfig as e };
270
+ export { type AiAccountResolver as A, KNOWN_ACCOUNTS_COOKIE_NAME as K, type SessionCookieOptions as S, USER_ID_COOKIE_NAME as U, type SessionData as a, type AiRoutesConfig as b, type KnownAccountEntry as c, SESSION_COOKIE_NAME as d, type ServiceAiClientConfig as e, appendKnownAccountCookie as f, clearKnownAccountsCookie as g, clearSession as h, createAiRoutes as i, createServiceAiClient as j, getKnownAccountsCookieRaw as k, getKnownAccountsFromRequest as l, getSession as m, getSessionFromRequest as n, normalizeKnownAccountsCookie as o, requireSession as p, resolveAiTarget as q, removeKnownAccountFromCookie as r, withSession as w };
@@ -267,5 +267,4 @@ interface ServiceAiClientConfig {
267
267
  */
268
268
  declare function createServiceAiClient(config: ServiceAiClientConfig): ScaleMuleAi;
269
269
 
270
- export { KNOWN_ACCOUNTS_COOKIE_NAME as K, USER_ID_COOKIE_NAME as U, SESSION_COOKIE_NAME as d, appendKnownAccountCookie as f, clearKnownAccountsCookie as g, clearSession as h, createAiRoutes as i, createServiceAiClient as j, getKnownAccountsCookieRaw as k, getKnownAccountsFromRequest as l, getSession as m, getSessionFromRequest as n, normalizeKnownAccountsCookie as o, requireSession as p, resolveAiTarget as q, removeKnownAccountFromCookie as r, withSession as w };
271
- export type { AiAccountResolver as A, SessionCookieOptions as S, SessionData as a, AiRoutesConfig as b, KnownAccountEntry as c, ServiceAiClientConfig as e };
270
+ export { type AiAccountResolver as A, KNOWN_ACCOUNTS_COOKIE_NAME as K, type SessionCookieOptions as S, USER_ID_COOKIE_NAME as U, type SessionData as a, type AiRoutesConfig as b, type KnownAccountEntry as c, SESSION_COOKIE_NAME as d, type ServiceAiClientConfig as e, appendKnownAccountCookie as f, clearKnownAccountsCookie as g, clearSession as h, createAiRoutes as i, createServiceAiClient as j, getKnownAccountsCookieRaw as k, getKnownAccountsFromRequest as l, getSession as m, getSessionFromRequest as n, normalizeKnownAccountsCookie as o, requireSession as p, resolveAiTarget as q, removeKnownAccountFromCookie as r, withSession as w };
package/dist/audio.d.mts CHANGED
@@ -335,5 +335,4 @@ declare function ListeningLibrary({ open }: {
335
335
  open?: boolean;
336
336
  }): react_jsx_runtime.JSX.Element;
337
337
 
338
- export { ArticleAudioControls, AudioPlayer, ListeningLibrary, NarrationHighlighter, NetworkAudioController, NetworkAudioPlayer, NetworkAudioProvider, SENTENCE_HIGHLIGHT, WORD_HIGHLIGHT, narrationHighlightSupported, parseTimingsPayload, useArticleNarration, useNetworkAudio };
339
- export type { ArticleAudioControlsProps, AudioPlayerNarration, AudioPlayerProps, AudioPlayerSource, AudioPlayerVariant, ListeningPersistence, NarrationTimings, NetworkAudioCommand, NetworkAudioContextValue, NetworkAudioPlayerProps, NetworkAudioProviderProps, NetworkAudioSnapshot, NetworkAudioTrack, NetworkPlayerConnection, NetworkPlayerHostOptions, ResolveNetworkAudio };
338
+ export { ArticleAudioControls, type ArticleAudioControlsProps, AudioPlayer, type AudioPlayerNarration, type AudioPlayerProps, type AudioPlayerSource, type AudioPlayerVariant, ListeningLibrary, type ListeningPersistence, NarrationHighlighter, type NarrationTimings, type NetworkAudioCommand, type NetworkAudioContextValue, NetworkAudioController, NetworkAudioPlayer, type NetworkAudioPlayerProps, NetworkAudioProvider, type NetworkAudioProviderProps, type NetworkAudioSnapshot, type NetworkAudioTrack, type NetworkPlayerConnection, type NetworkPlayerHostOptions, type ResolveNetworkAudio, SENTENCE_HIGHLIGHT, WORD_HIGHLIGHT, narrationHighlightSupported, parseTimingsPayload, useArticleNarration, useNetworkAudio };
package/dist/audio.d.ts CHANGED
@@ -335,5 +335,4 @@ declare function ListeningLibrary({ open }: {
335
335
  open?: boolean;
336
336
  }): react_jsx_runtime.JSX.Element;
337
337
 
338
- export { ArticleAudioControls, AudioPlayer, ListeningLibrary, NarrationHighlighter, NetworkAudioController, NetworkAudioPlayer, NetworkAudioProvider, SENTENCE_HIGHLIGHT, WORD_HIGHLIGHT, narrationHighlightSupported, parseTimingsPayload, useArticleNarration, useNetworkAudio };
339
- export type { ArticleAudioControlsProps, AudioPlayerNarration, AudioPlayerProps, AudioPlayerSource, AudioPlayerVariant, ListeningPersistence, NarrationTimings, NetworkAudioCommand, NetworkAudioContextValue, NetworkAudioPlayerProps, NetworkAudioProviderProps, NetworkAudioSnapshot, NetworkAudioTrack, NetworkPlayerConnection, NetworkPlayerHostOptions, ResolveNetworkAudio };
338
+ export { ArticleAudioControls, type ArticleAudioControlsProps, AudioPlayer, type AudioPlayerNarration, type AudioPlayerProps, type AudioPlayerSource, type AudioPlayerVariant, ListeningLibrary, type ListeningPersistence, NarrationHighlighter, type NarrationTimings, type NetworkAudioCommand, type NetworkAudioContextValue, NetworkAudioController, NetworkAudioPlayer, type NetworkAudioPlayerProps, NetworkAudioProvider, type NetworkAudioProviderProps, type NetworkAudioSnapshot, type NetworkAudioTrack, type NetworkPlayerConnection, type NetworkPlayerHostOptions, type ResolveNetworkAudio, SENTENCE_HIGHLIGHT, WORD_HIGHLIGHT, narrationHighlightSupported, parseTimingsPayload, useArticleNarration, useNetworkAudio };
package/dist/client.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { StorageAdapter, ApiError } from './index.mjs';
1
+ import { ac as StorageAdapter, A as ApiError } from './index-BOPHR50i.mjs';
2
2
 
3
3
  /**
4
4
  * ScaleMule API Client
@@ -237,5 +237,4 @@ declare class ScaleMuleClient {
237
237
  */
238
238
  declare function createClient(config: ClientConfig): ScaleMuleClient;
239
239
 
240
- export { ScaleMuleClient, createClient };
241
- export type { ClientConfig, RequestOptions, ScaleMuleEnvironment };
240
+ export { type ClientConfig, type RequestOptions, ScaleMuleClient, type ScaleMuleEnvironment, createClient };
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { StorageAdapter, ApiError } from './index.js';
1
+ import { ac as StorageAdapter, A as ApiError } from './index-BOPHR50i.js';
2
2
 
3
3
  /**
4
4
  * ScaleMule API Client
@@ -237,5 +237,4 @@ declare class ScaleMuleClient {
237
237
  */
238
238
  declare function createClient(config: ClientConfig): ScaleMuleClient;
239
239
 
240
- export { ScaleMuleClient, createClient };
241
- export type { ClientConfig, RequestOptions, ScaleMuleEnvironment };
240
+ export { type ClientConfig, type RequestOptions, ScaleMuleClient, type ScaleMuleEnvironment, createClient };
@@ -983,5 +983,4 @@ interface UseBillingReturn {
983
983
  }) => Promise<string | null>;
984
984
  }
985
985
 
986
- export { ScaleMuleApiError as a5 };
987
- export type { PhoneVerifyRequest as $, ApiError as A, BatchTrackRequest as B, ChangeEmailRequest as C, DeviceFingerprint as D, EnhancedAnalyticsEvent as E, ForgotPasswordRequest as F, LoginRiskInfo as G, MFAMethod as H, MFASMSSetupResponse as I, MFASetupRequest as J, KnownAccountInfo as K, LoginResponse as L, MFAChallengeResponse as M, MFAStatus as N, MFATOTPSetupResponse as O, MFAVerifyRequest as P, OAuthCallbackRequest as Q, OAuthCallbackResponse as R, ScaleMuleConfig as S, OAuthConfig as T, User as U, OAuthProvider as V, OAuthStartResponse as W, PageViewData as X, PayoutSchedule as Y, PhoneLoginRequest as Z, PhoneSendCodeRequest as _, UseAuthReturn as a, Profile as a0, ProxyBearerLoginResponse as a1, RefreshResponse as a2, RegisterRequest as a3, ResetPasswordRequest as a4, ScaleMuleEnvironment as a6, Session as a7, SignedUploadCompleteRequest as a8, SignedUploadRequest as a9, SignedUploadResponse as aa, SignedUploadUrl as ab, StorageAdapter as ac, StorageFile as ad, TrackEventResponse as ae, TransactionSummary as af, UTMParams as ag, UpdateProfileRequest as ah, UploadOptions as ai, UploadResponse as aj, VerifyEmailRequest as ak, UseBillingReturn as b, ListFilesParams as c, UseContentReturn as d, UseUserReturn as e, UseAnalyticsOptions as f, UseAnalyticsReturn as g, AccountBalance as h, AnalyticsEvent as i, ApiResponse as j, AuthLoginResponse as k, BillingPayment as l, BillingPayout as m, BillingRefund as n, BillingTransaction as o, ChangePasswordRequest as p, ClientContext as q, ConnectedAccount as r, CookieLoginResponse as s, CookieOAuthCallbackResponse as t, DeviceInfo as u, LinkedAccount as v, ListFilesResponse as w, LoginDeviceInfo as x, LoginRequest as y, LoginResponseWithMFA as z };
986
+ export { type PhoneVerifyRequest as $, type ApiError as A, type BatchTrackRequest as B, type ChangeEmailRequest as C, type DeviceFingerprint as D, type EnhancedAnalyticsEvent as E, type ForgotPasswordRequest as F, type LoginRiskInfo as G, type MFAMethod as H, type MFASMSSetupResponse as I, type MFASetupRequest as J, type KnownAccountInfo as K, type LoginResponse as L, type MFAChallengeResponse as M, type MFAStatus as N, type MFATOTPSetupResponse as O, type MFAVerifyRequest as P, type OAuthCallbackRequest as Q, type OAuthCallbackResponse as R, type ScaleMuleConfig as S, type OAuthConfig as T, type User as U, type OAuthProvider as V, type OAuthStartResponse as W, type PageViewData as X, type PayoutSchedule as Y, type PhoneLoginRequest as Z, type PhoneSendCodeRequest as _, type UseAuthReturn as a, type Profile as a0, type ProxyBearerLoginResponse as a1, type RefreshResponse as a2, type RegisterRequest as a3, type ResetPasswordRequest as a4, ScaleMuleApiError as a5, type ScaleMuleEnvironment as a6, type Session as a7, type SignedUploadCompleteRequest as a8, type SignedUploadRequest as a9, type SignedUploadResponse as aa, type SignedUploadUrl as ab, type StorageAdapter as ac, type StorageFile as ad, type TrackEventResponse as ae, type TransactionSummary as af, type UTMParams as ag, type UpdateProfileRequest as ah, type UploadOptions as ai, type UploadResponse as aj, type VerifyEmailRequest as ak, type UseBillingReturn as b, type ListFilesParams as c, type UseContentReturn as d, type UseUserReturn as e, type UseAnalyticsOptions as f, type UseAnalyticsReturn as g, type AccountBalance as h, type AnalyticsEvent as i, type ApiResponse as j, type AuthLoginResponse as k, type BillingPayment as l, type BillingPayout as m, type BillingRefund as n, type BillingTransaction as o, type ChangePasswordRequest as p, type ClientContext as q, type ConnectedAccount as r, type CookieLoginResponse as s, type CookieOAuthCallbackResponse as t, type DeviceInfo as u, type LinkedAccount as v, type ListFilesResponse as w, type LoginDeviceInfo as x, type LoginRequest as y, type LoginResponseWithMFA as z };
@@ -983,5 +983,4 @@ interface UseBillingReturn {
983
983
  }) => Promise<string | null>;
984
984
  }
985
985
 
986
- export { ScaleMuleApiError as a5 };
987
- export type { PhoneVerifyRequest as $, ApiError as A, BatchTrackRequest as B, ChangeEmailRequest as C, DeviceFingerprint as D, EnhancedAnalyticsEvent as E, ForgotPasswordRequest as F, LoginRiskInfo as G, MFAMethod as H, MFASMSSetupResponse as I, MFASetupRequest as J, KnownAccountInfo as K, LoginResponse as L, MFAChallengeResponse as M, MFAStatus as N, MFATOTPSetupResponse as O, MFAVerifyRequest as P, OAuthCallbackRequest as Q, OAuthCallbackResponse as R, ScaleMuleConfig as S, OAuthConfig as T, User as U, OAuthProvider as V, OAuthStartResponse as W, PageViewData as X, PayoutSchedule as Y, PhoneLoginRequest as Z, PhoneSendCodeRequest as _, UseAuthReturn as a, Profile as a0, ProxyBearerLoginResponse as a1, RefreshResponse as a2, RegisterRequest as a3, ResetPasswordRequest as a4, ScaleMuleEnvironment as a6, Session as a7, SignedUploadCompleteRequest as a8, SignedUploadRequest as a9, SignedUploadResponse as aa, SignedUploadUrl as ab, StorageAdapter as ac, StorageFile as ad, TrackEventResponse as ae, TransactionSummary as af, UTMParams as ag, UpdateProfileRequest as ah, UploadOptions as ai, UploadResponse as aj, VerifyEmailRequest as ak, UseBillingReturn as b, ListFilesParams as c, UseContentReturn as d, UseUserReturn as e, UseAnalyticsOptions as f, UseAnalyticsReturn as g, AccountBalance as h, AnalyticsEvent as i, ApiResponse as j, AuthLoginResponse as k, BillingPayment as l, BillingPayout as m, BillingRefund as n, BillingTransaction as o, ChangePasswordRequest as p, ClientContext as q, ConnectedAccount as r, CookieLoginResponse as s, CookieOAuthCallbackResponse as t, DeviceInfo as u, LinkedAccount as v, ListFilesResponse as w, LoginDeviceInfo as x, LoginRequest as y, LoginResponseWithMFA as z };
986
+ export { type PhoneVerifyRequest as $, type ApiError as A, type BatchTrackRequest as B, type ChangeEmailRequest as C, type DeviceFingerprint as D, type EnhancedAnalyticsEvent as E, type ForgotPasswordRequest as F, type LoginRiskInfo as G, type MFAMethod as H, type MFASMSSetupResponse as I, type MFASetupRequest as J, type KnownAccountInfo as K, type LoginResponse as L, type MFAChallengeResponse as M, type MFAStatus as N, type MFATOTPSetupResponse as O, type MFAVerifyRequest as P, type OAuthCallbackRequest as Q, type OAuthCallbackResponse as R, type ScaleMuleConfig as S, type OAuthConfig as T, type User as U, type OAuthProvider as V, type OAuthStartResponse as W, type PageViewData as X, type PayoutSchedule as Y, type PhoneLoginRequest as Z, type PhoneSendCodeRequest as _, type UseAuthReturn as a, type Profile as a0, type ProxyBearerLoginResponse as a1, type RefreshResponse as a2, type RegisterRequest as a3, type ResetPasswordRequest as a4, ScaleMuleApiError as a5, type ScaleMuleEnvironment as a6, type Session as a7, type SignedUploadCompleteRequest as a8, type SignedUploadRequest as a9, type SignedUploadResponse as aa, type SignedUploadUrl as ab, type StorageAdapter as ac, type StorageFile as ad, type TrackEventResponse as ae, type TransactionSummary as af, type UTMParams as ag, type UpdateProfileRequest as ah, type UploadOptions as ai, type UploadResponse as aj, type VerifyEmailRequest as ak, type UseBillingReturn as b, type ListFilesParams as c, type UseContentReturn as d, type UseUserReturn as e, type UseAnalyticsOptions as f, type UseAnalyticsReturn as g, type AccountBalance as h, type AnalyticsEvent as i, type ApiResponse as j, type AuthLoginResponse as k, type BillingPayment as l, type BillingPayout as m, type BillingRefund as n, type BillingTransaction as o, type ChangePasswordRequest as p, type ClientContext as q, type ConnectedAccount as r, type CookieLoginResponse as s, type CookieOAuthCallbackResponse as t, type DeviceInfo as u, type LinkedAccount as v, type ListFilesResponse as w, type LoginDeviceInfo as x, type LoginRequest as y, type LoginResponseWithMFA as z };
package/dist/index.d.mts CHANGED
@@ -6,8 +6,8 @@ import { MoneyClient } from '@scalemule/money';
6
6
  export { MoneyClient, MoneyClientConfig, createMoneyClient } from '@scalemule/money';
7
7
  import { ScaleMuleClient } from './client.mjs';
8
8
  export { ClientConfig, RequestOptions, createClient } from './client.mjs';
9
- import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-CCqkMN-C.mjs';
10
- export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-CCqkMN-C.mjs';
9
+ import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-BOPHR50i.mjs';
10
+ export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-BOPHR50i.mjs';
11
11
 
12
12
  /**
13
13
  * Tri-state file visibility — `'private' | 'app_public' | 'anonymous_visible'`.
@@ -1351,5 +1351,4 @@ declare function createSafeLogger(prefix: string): {
1351
1351
  error: (message: string, data?: unknown) => void;
1352
1352
  };
1353
1353
 
1354
- export { ApiError$1 as ApiError, FeedbackWidget, ListFilesParams, LoginResponse, NarrationPlayer, RegisterHoneypot, ScaleMuleClient, ScaleMuleConfig, ScaleMuleMedia, ScaleMuleProvider, UseAnalyticsOptions, UseAnalyticsReturn, UseAuthReturn, UseBillingReturn, UseContentReturn, UseUserReturn, User, VoteButton, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAudio, useAuth, useBilling, useContent, useExperiment, useFeatureFlags, useFeedback, useFileStatus, useHoneypot, useMedia, useMoney, useMoneyClient, usePushNotifications, useRealtime, useScaleMule, useScaleMuleClient, useShare, useTtsJob, useUser, useVote, validateForm, validators };
1355
- export type { AudioFile, AudioUploadResult, ConversationKind, FeatureFlagEvaluation, FeatureFlagEvaluation as FeatureFlagResult, FeedbackItem, FeedbackItemInput, FeedbackPriority, FeedbackStatus, FeedbackType, FeedbackWidgetConfig, FeedbackWidgetProps, HoneypotFieldName, MediaPolicy, MediaUploadResult, NarrationPlayerAudio, NarrationPlayerProps, PasswordValidationResult, PhoneCountry, PhoneValidationResult, RealtimeEvent, RealtimeMessage, RealtimeStatus, RegisterHoneypotProps, ScaleMuleMediaProps, ScaleMuleProviderProps, SecurityChallenge, SecurityChallengePrompt, UseAudioReturn, UseAudioUploadOptions, UseExperimentOptions, UseExperimentReturn, UseFeatureFlagsOptions, UseFeatureFlagsReturn, UseFeedbackOptions, UseFeedbackResult, UseFileStatusOptions, UseFileStatusReturn, UseFeatureFlagsOptions as UseFlagsOptions, UseFeatureFlagsReturn as UseFlagsReturn, UseHoneypotReturn, UseMediaReturn, UseMediaUploadOptions, UsePushNotificationsOptions, UsePushNotificationsReturn, UseRealtimeOptions, UseRealtimeReturn, UseShareOptions, UseShareReturn, UseTtsJobOptions, UseTtsJobReturn, UseVoteOptions, UseVoteReturn, UsernameValidationResult, VoteButtonClassNames, VoteButtonProps, VoteState };
1354
+ export { ApiError$1 as ApiError, type AudioFile, type AudioUploadResult, type ConversationKind, type FeatureFlagEvaluation, type FeatureFlagEvaluation as FeatureFlagResult, type FeedbackItem, type FeedbackItemInput, type FeedbackPriority, type FeedbackStatus, type FeedbackType, FeedbackWidget, type FeedbackWidgetConfig, type FeedbackWidgetProps, type HoneypotFieldName, ListFilesParams, LoginResponse, type MediaPolicy, type MediaUploadResult, NarrationPlayer, type NarrationPlayerAudio, type NarrationPlayerProps, type PasswordValidationResult, type PhoneCountry, type PhoneValidationResult, type RealtimeEvent, type RealtimeMessage, type RealtimeStatus, RegisterHoneypot, type RegisterHoneypotProps, ScaleMuleClient, ScaleMuleConfig, ScaleMuleMedia, type ScaleMuleMediaProps, ScaleMuleProvider, type ScaleMuleProviderProps, type SecurityChallenge, type SecurityChallengePrompt, UseAnalyticsOptions, UseAnalyticsReturn, type UseAudioReturn, type UseAudioUploadOptions, UseAuthReturn, UseBillingReturn, UseContentReturn, type UseExperimentOptions, type UseExperimentReturn, type UseFeatureFlagsOptions, type UseFeatureFlagsReturn, type UseFeedbackOptions, type UseFeedbackResult, type UseFileStatusOptions, type UseFileStatusReturn, type UseFeatureFlagsOptions as UseFlagsOptions, type UseFeatureFlagsReturn as UseFlagsReturn, type UseHoneypotReturn, type UseMediaReturn, type UseMediaUploadOptions, type UsePushNotificationsOptions, type UsePushNotificationsReturn, type UseRealtimeOptions, type UseRealtimeReturn, type UseShareOptions, type UseShareReturn, type UseTtsJobOptions, type UseTtsJobReturn, UseUserReturn, type UseVoteOptions, type UseVoteReturn, User, type UsernameValidationResult, VoteButton, type VoteButtonClassNames, type VoteButtonProps, type VoteState, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAudio, useAuth, useBilling, useContent, useExperiment, useFeatureFlags, useFeedback, useFileStatus, useHoneypot, useMedia, useMoney, useMoneyClient, usePushNotifications, useRealtime, useScaleMule, useScaleMuleClient, useShare, useTtsJob, useUser, useVote, validateForm, validators };
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@ import { MoneyClient } from '@scalemule/money';
6
6
  export { MoneyClient, MoneyClientConfig, createMoneyClient } from '@scalemule/money';
7
7
  import { ScaleMuleClient } from './client.js';
8
8
  export { ClientConfig, RequestOptions, createClient } from './client.js';
9
- import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-CCqkMN-C.js';
10
- export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-CCqkMN-C.js';
9
+ import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-BOPHR50i.js';
10
+ export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-BOPHR50i.js';
11
11
 
12
12
  /**
13
13
  * Tri-state file visibility — `'private' | 'app_public' | 'anonymous_visible'`.
@@ -1351,5 +1351,4 @@ declare function createSafeLogger(prefix: string): {
1351
1351
  error: (message: string, data?: unknown) => void;
1352
1352
  };
1353
1353
 
1354
- export { ApiError$1 as ApiError, FeedbackWidget, ListFilesParams, LoginResponse, NarrationPlayer, RegisterHoneypot, ScaleMuleClient, ScaleMuleConfig, ScaleMuleMedia, ScaleMuleProvider, UseAnalyticsOptions, UseAnalyticsReturn, UseAuthReturn, UseBillingReturn, UseContentReturn, UseUserReturn, User, VoteButton, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAudio, useAuth, useBilling, useContent, useExperiment, useFeatureFlags, useFeedback, useFileStatus, useHoneypot, useMedia, useMoney, useMoneyClient, usePushNotifications, useRealtime, useScaleMule, useScaleMuleClient, useShare, useTtsJob, useUser, useVote, validateForm, validators };
1355
- export type { AudioFile, AudioUploadResult, ConversationKind, FeatureFlagEvaluation, FeatureFlagEvaluation as FeatureFlagResult, FeedbackItem, FeedbackItemInput, FeedbackPriority, FeedbackStatus, FeedbackType, FeedbackWidgetConfig, FeedbackWidgetProps, HoneypotFieldName, MediaPolicy, MediaUploadResult, NarrationPlayerAudio, NarrationPlayerProps, PasswordValidationResult, PhoneCountry, PhoneValidationResult, RealtimeEvent, RealtimeMessage, RealtimeStatus, RegisterHoneypotProps, ScaleMuleMediaProps, ScaleMuleProviderProps, SecurityChallenge, SecurityChallengePrompt, UseAudioReturn, UseAudioUploadOptions, UseExperimentOptions, UseExperimentReturn, UseFeatureFlagsOptions, UseFeatureFlagsReturn, UseFeedbackOptions, UseFeedbackResult, UseFileStatusOptions, UseFileStatusReturn, UseFeatureFlagsOptions as UseFlagsOptions, UseFeatureFlagsReturn as UseFlagsReturn, UseHoneypotReturn, UseMediaReturn, UseMediaUploadOptions, UsePushNotificationsOptions, UsePushNotificationsReturn, UseRealtimeOptions, UseRealtimeReturn, UseShareOptions, UseShareReturn, UseTtsJobOptions, UseTtsJobReturn, UseVoteOptions, UseVoteReturn, UsernameValidationResult, VoteButtonClassNames, VoteButtonProps, VoteState };
1354
+ export { ApiError$1 as ApiError, type AudioFile, type AudioUploadResult, type ConversationKind, type FeatureFlagEvaluation, type FeatureFlagEvaluation as FeatureFlagResult, type FeedbackItem, type FeedbackItemInput, type FeedbackPriority, type FeedbackStatus, type FeedbackType, FeedbackWidget, type FeedbackWidgetConfig, type FeedbackWidgetProps, type HoneypotFieldName, ListFilesParams, LoginResponse, type MediaPolicy, type MediaUploadResult, NarrationPlayer, type NarrationPlayerAudio, type NarrationPlayerProps, type PasswordValidationResult, type PhoneCountry, type PhoneValidationResult, type RealtimeEvent, type RealtimeMessage, type RealtimeStatus, RegisterHoneypot, type RegisterHoneypotProps, ScaleMuleClient, ScaleMuleConfig, ScaleMuleMedia, type ScaleMuleMediaProps, ScaleMuleProvider, type ScaleMuleProviderProps, type SecurityChallenge, type SecurityChallengePrompt, UseAnalyticsOptions, UseAnalyticsReturn, type UseAudioReturn, type UseAudioUploadOptions, UseAuthReturn, UseBillingReturn, UseContentReturn, type UseExperimentOptions, type UseExperimentReturn, type UseFeatureFlagsOptions, type UseFeatureFlagsReturn, type UseFeedbackOptions, type UseFeedbackResult, type UseFileStatusOptions, type UseFileStatusReturn, type UseFeatureFlagsOptions as UseFlagsOptions, type UseFeatureFlagsReturn as UseFlagsReturn, type UseHoneypotReturn, type UseMediaReturn, type UseMediaUploadOptions, type UsePushNotificationsOptions, type UsePushNotificationsReturn, type UseRealtimeOptions, type UseRealtimeReturn, type UseShareOptions, type UseShareReturn, type UseTtsJobOptions, type UseTtsJobReturn, UseUserReturn, type UseVoteOptions, type UseVoteReturn, User, type UsernameValidationResult, VoteButton, type VoteButtonClassNames, type VoteButtonProps, type VoteState, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAudio, useAuth, useBilling, useContent, useExperiment, useFeatureFlags, useFeedback, useFileStatus, useHoneypot, useMedia, useMoney, useMoneyClient, usePushNotifications, useRealtime, useScaleMule, useScaleMuleClient, useShare, useTtsJob, useUser, useVote, validateForm, validators };
package/dist/index.js CHANGED
@@ -1149,6 +1149,24 @@ function reportSdkError(payload) {
1149
1149
  } catch {
1150
1150
  }
1151
1151
  }
1152
+
1153
+ // src/session-errors.ts
1154
+ var SESSION_ENDED_CODES = /* @__PURE__ */ new Set([
1155
+ "UNAUTHORIZED",
1156
+ "INVALID_SESSION",
1157
+ "SESSION_EXPIRED",
1158
+ "SESSION_IDLE_EXPIRED",
1159
+ "SESSION_ABSOLUTE_EXPIRED",
1160
+ "SESSION_REVOKED",
1161
+ "TOKEN_EXPIRED",
1162
+ "TOKEN_INVALID"
1163
+ ]);
1164
+ function isSessionEndedError(error) {
1165
+ if (!error || typeof error !== "object") return false;
1166
+ const { status, code } = error;
1167
+ if (status === 401) return true;
1168
+ return typeof code === "string" && SESSION_ENDED_CODES.has(code);
1169
+ }
1152
1170
  var USER_CACHE_KEY = "scalemule_user";
1153
1171
  function getCachedUser() {
1154
1172
  if (typeof window === "undefined") return null;
@@ -1170,6 +1188,26 @@ function setCachedUser(user) {
1170
1188
  } catch {
1171
1189
  }
1172
1190
  }
1191
+ var PROXY_SESSION_RETRY_DELAYS_MS = [1e3, 3e3];
1192
+ var PROXY_SESSION_CHECK_TIMEOUT_MS = 1e4;
1193
+ async function checkProxySession(authProxyUrl) {
1194
+ let response;
1195
+ let body;
1196
+ try {
1197
+ const timeout = typeof AbortSignal !== "undefined" && typeof AbortSignal.timeout === "function" ? AbortSignal.timeout(PROXY_SESSION_CHECK_TIMEOUT_MS) : void 0;
1198
+ response = await fetch(`${authProxyUrl}/me`, { credentials: "include", signal: timeout });
1199
+ body = await response.json().catch(() => null);
1200
+ } catch {
1201
+ return { kind: "failed" };
1202
+ }
1203
+ if (body?.success && body.data?.user) {
1204
+ return { kind: "user", data: body.data };
1205
+ }
1206
+ if (response.status === 401 || isSessionEndedError(body?.error) || isSessionEndedError(body?.data?.error) || response.ok && body?.success === true) {
1207
+ return { kind: "ended" };
1208
+ }
1209
+ return { kind: "failed" };
1210
+ }
1173
1211
  var ScaleMuleContext = React.createContext(null);
1174
1212
  function ScaleMuleProvider({
1175
1213
  apiKey,
@@ -1342,17 +1380,25 @@ function ScaleMuleProvider({
1342
1380
  setInitializing(false);
1343
1381
  }
1344
1382
  try {
1345
- const response = await fetch(`${authProxyUrl}/me`, {
1346
- credentials: "include"
1347
- });
1348
- const data = await response.json();
1383
+ let check = await checkProxySession(authProxyUrl);
1384
+ for (const delay of PROXY_SESSION_RETRY_DELAYS_MS) {
1385
+ if (check.kind !== "failed" || !mounted) break;
1386
+ await new Promise((resolve) => setTimeout(resolve, delay));
1387
+ check = await checkProxySession(authProxyUrl);
1388
+ }
1349
1389
  if (mounted) {
1350
- if (data.success && data.data?.user) {
1351
- client.setCookieSession(data.data.user.id);
1352
- setUser(data.data.user);
1353
- setCachedUser(data.data.user);
1354
- if (data.data.sessionToken) {
1355
- await client.setSession(data.data.sessionToken, data.data.userId || "");
1390
+ if (check.kind === "user") {
1391
+ const data = check.data;
1392
+ client.setCookieSession(data.user.id);
1393
+ setUser(data.user);
1394
+ setCachedUser(data.user);
1395
+ if (data.sessionToken) {
1396
+ await client.setSession(data.sessionToken, data.userId || "");
1397
+ }
1398
+ } else if (check.kind === "failed" && cachedUser) {
1399
+ client.setCookieSession(cachedUser.id);
1400
+ if (debug) {
1401
+ console.debug("[ScaleMule] Auth proxy session check failed; keeping the signed-in user");
1356
1402
  }
1357
1403
  } else {
1358
1404
  client.setCookieSession(null);
@@ -1360,15 +1406,6 @@ function ScaleMuleProvider({
1360
1406
  setCachedUser(null);
1361
1407
  }
1362
1408
  }
1363
- } catch {
1364
- if (mounted) {
1365
- client.setCookieSession(null);
1366
- setUser(null);
1367
- setCachedUser(null);
1368
- if (debug) {
1369
- console.debug("[ScaleMule] Auth proxy session check failed; clearing cached user");
1370
- }
1371
- }
1372
1409
  } finally {
1373
1410
  client.resolveSessionPending();
1374
1411
  }
@@ -1515,26 +1552,6 @@ function useMoneyClient() {
1515
1552
  const { money } = useScaleMule();
1516
1553
  return money;
1517
1554
  }
1518
-
1519
- // src/session-errors.ts
1520
- var SESSION_ENDED_CODES = /* @__PURE__ */ new Set([
1521
- "UNAUTHORIZED",
1522
- "INVALID_SESSION",
1523
- "SESSION_EXPIRED",
1524
- "SESSION_IDLE_EXPIRED",
1525
- "SESSION_ABSOLUTE_EXPIRED",
1526
- "SESSION_REVOKED",
1527
- "TOKEN_EXPIRED",
1528
- "TOKEN_INVALID"
1529
- ]);
1530
- function isSessionEndedError(error) {
1531
- if (!error || typeof error !== "object") return false;
1532
- const { status, code } = error;
1533
- if (status === 401) return true;
1534
- return typeof code === "string" && SESSION_ENDED_CODES.has(code);
1535
- }
1536
-
1537
- // src/hooks/useAuth.ts
1538
1555
  function cookieLoginResult(user) {
1539
1556
  return { authenticated: true, userId: user.id, user };
1540
1557
  }
package/dist/index.mjs CHANGED
@@ -1129,6 +1129,24 @@ function reportSdkError(payload) {
1129
1129
  } catch {
1130
1130
  }
1131
1131
  }
1132
+
1133
+ // src/session-errors.ts
1134
+ var SESSION_ENDED_CODES = /* @__PURE__ */ new Set([
1135
+ "UNAUTHORIZED",
1136
+ "INVALID_SESSION",
1137
+ "SESSION_EXPIRED",
1138
+ "SESSION_IDLE_EXPIRED",
1139
+ "SESSION_ABSOLUTE_EXPIRED",
1140
+ "SESSION_REVOKED",
1141
+ "TOKEN_EXPIRED",
1142
+ "TOKEN_INVALID"
1143
+ ]);
1144
+ function isSessionEndedError(error) {
1145
+ if (!error || typeof error !== "object") return false;
1146
+ const { status, code } = error;
1147
+ if (status === 401) return true;
1148
+ return typeof code === "string" && SESSION_ENDED_CODES.has(code);
1149
+ }
1132
1150
  var USER_CACHE_KEY = "scalemule_user";
1133
1151
  function getCachedUser() {
1134
1152
  if (typeof window === "undefined") return null;
@@ -1150,6 +1168,26 @@ function setCachedUser(user) {
1150
1168
  } catch {
1151
1169
  }
1152
1170
  }
1171
+ var PROXY_SESSION_RETRY_DELAYS_MS = [1e3, 3e3];
1172
+ var PROXY_SESSION_CHECK_TIMEOUT_MS = 1e4;
1173
+ async function checkProxySession(authProxyUrl) {
1174
+ let response;
1175
+ let body;
1176
+ try {
1177
+ const timeout = typeof AbortSignal !== "undefined" && typeof AbortSignal.timeout === "function" ? AbortSignal.timeout(PROXY_SESSION_CHECK_TIMEOUT_MS) : void 0;
1178
+ response = await fetch(`${authProxyUrl}/me`, { credentials: "include", signal: timeout });
1179
+ body = await response.json().catch(() => null);
1180
+ } catch {
1181
+ return { kind: "failed" };
1182
+ }
1183
+ if (body?.success && body.data?.user) {
1184
+ return { kind: "user", data: body.data };
1185
+ }
1186
+ if (response.status === 401 || isSessionEndedError(body?.error) || isSessionEndedError(body?.data?.error) || response.ok && body?.success === true) {
1187
+ return { kind: "ended" };
1188
+ }
1189
+ return { kind: "failed" };
1190
+ }
1153
1191
  var ScaleMuleContext = createContext(null);
1154
1192
  function ScaleMuleProvider({
1155
1193
  apiKey,
@@ -1322,17 +1360,25 @@ function ScaleMuleProvider({
1322
1360
  setInitializing(false);
1323
1361
  }
1324
1362
  try {
1325
- const response = await fetch(`${authProxyUrl}/me`, {
1326
- credentials: "include"
1327
- });
1328
- const data = await response.json();
1363
+ let check = await checkProxySession(authProxyUrl);
1364
+ for (const delay of PROXY_SESSION_RETRY_DELAYS_MS) {
1365
+ if (check.kind !== "failed" || !mounted) break;
1366
+ await new Promise((resolve) => setTimeout(resolve, delay));
1367
+ check = await checkProxySession(authProxyUrl);
1368
+ }
1329
1369
  if (mounted) {
1330
- if (data.success && data.data?.user) {
1331
- client.setCookieSession(data.data.user.id);
1332
- setUser(data.data.user);
1333
- setCachedUser(data.data.user);
1334
- if (data.data.sessionToken) {
1335
- await client.setSession(data.data.sessionToken, data.data.userId || "");
1370
+ if (check.kind === "user") {
1371
+ const data = check.data;
1372
+ client.setCookieSession(data.user.id);
1373
+ setUser(data.user);
1374
+ setCachedUser(data.user);
1375
+ if (data.sessionToken) {
1376
+ await client.setSession(data.sessionToken, data.userId || "");
1377
+ }
1378
+ } else if (check.kind === "failed" && cachedUser) {
1379
+ client.setCookieSession(cachedUser.id);
1380
+ if (debug) {
1381
+ console.debug("[ScaleMule] Auth proxy session check failed; keeping the signed-in user");
1336
1382
  }
1337
1383
  } else {
1338
1384
  client.setCookieSession(null);
@@ -1340,15 +1386,6 @@ function ScaleMuleProvider({
1340
1386
  setCachedUser(null);
1341
1387
  }
1342
1388
  }
1343
- } catch {
1344
- if (mounted) {
1345
- client.setCookieSession(null);
1346
- setUser(null);
1347
- setCachedUser(null);
1348
- if (debug) {
1349
- console.debug("[ScaleMule] Auth proxy session check failed; clearing cached user");
1350
- }
1351
- }
1352
1389
  } finally {
1353
1390
  client.resolveSessionPending();
1354
1391
  }
@@ -1495,26 +1532,6 @@ function useMoneyClient() {
1495
1532
  const { money } = useScaleMule();
1496
1533
  return money;
1497
1534
  }
1498
-
1499
- // src/session-errors.ts
1500
- var SESSION_ENDED_CODES = /* @__PURE__ */ new Set([
1501
- "UNAUTHORIZED",
1502
- "INVALID_SESSION",
1503
- "SESSION_EXPIRED",
1504
- "SESSION_IDLE_EXPIRED",
1505
- "SESSION_ABSOLUTE_EXPIRED",
1506
- "SESSION_REVOKED",
1507
- "TOKEN_EXPIRED",
1508
- "TOKEN_INVALID"
1509
- ]);
1510
- function isSessionEndedError(error) {
1511
- if (!error || typeof error !== "object") return false;
1512
- const { status, code } = error;
1513
- if (status === 401) return true;
1514
- return typeof code === "string" && SESSION_ENDED_CODES.has(code);
1515
- }
1516
-
1517
- // src/hooks/useAuth.ts
1518
1535
  function cookieLoginResult(user) {
1519
1536
  return { authenticated: true, userId: user.id, user };
1520
1537
  }
@@ -41,5 +41,4 @@ declare function createLedveryRoutes(config: LedveryRoutesConfig): {
41
41
  POST: RouteHandler;
42
42
  };
43
43
 
44
- export { SM_LEDVERY_ACCESS_TOKEN_COOKIE as S, SM_LEDVERY_ID_TOKEN_COOKIE as b, SM_LEDVERY_NONCE_COOKIE as c, SM_LEDVERY_PKCE_VERIFIER_COOKIE as d, SM_LEDVERY_STATE_COOKIE as e, createLedveryRoutes as f, getLedverySession as g };
45
- export type { LedveryRoutesConfig as L, LedverySessionData as a };
44
+ export { type LedveryRoutesConfig as L, SM_LEDVERY_ACCESS_TOKEN_COOKIE as S, type LedverySessionData as a, SM_LEDVERY_ID_TOKEN_COOKIE as b, SM_LEDVERY_NONCE_COOKIE as c, SM_LEDVERY_PKCE_VERIFIER_COOKIE as d, SM_LEDVERY_STATE_COOKIE as e, createLedveryRoutes as f, getLedverySession as g };
@@ -41,5 +41,4 @@ declare function createLedveryRoutes(config: LedveryRoutesConfig): {
41
41
  POST: RouteHandler;
42
42
  };
43
43
 
44
- export { SM_LEDVERY_ACCESS_TOKEN_COOKIE as S, SM_LEDVERY_ID_TOKEN_COOKIE as b, SM_LEDVERY_NONCE_COOKIE as c, SM_LEDVERY_PKCE_VERIFIER_COOKIE as d, SM_LEDVERY_STATE_COOKIE as e, createLedveryRoutes as f, getLedverySession as g };
45
- export type { LedveryRoutesConfig as L, LedverySessionData as a };
44
+ export { type LedveryRoutesConfig as L, SM_LEDVERY_ACCESS_TOKEN_COOKIE as S, type LedverySessionData as a, SM_LEDVERY_ID_TOKEN_COOKIE as b, SM_LEDVERY_NONCE_COOKIE as c, SM_LEDVERY_PKCE_VERIFIER_COOKIE as d, SM_LEDVERY_STATE_COOKIE as e, createLedveryRoutes as f, getLedverySession as g };
@@ -1,2 +1,2 @@
1
1
  export { ScaleMuleAi } from '@scalemule/ai';
2
- export { A as AiAccountResolver, b as AiRoutesConfig, e as ServiceAiClientConfig, i as createAiRoutes, j as createServiceAiClient, q as resolveAiTarget } from '../ai-VzQ-4hdN.mjs';
2
+ export { A as AiAccountResolver, b as AiRoutesConfig, e as ServiceAiClientConfig, i as createAiRoutes, j as createServiceAiClient, q as resolveAiTarget } from '../ai-DFsYPvk8.mjs';
@@ -1,2 +1,2 @@
1
1
  export { ScaleMuleAi } from '@scalemule/ai';
2
- export { A as AiAccountResolver, b as AiRoutesConfig, e as ServiceAiClientConfig, i as createAiRoutes, j as createServiceAiClient, q as resolveAiTarget } from '../ai-VzQ-4hdN.js';
2
+ export { A as AiAccountResolver, b as AiRoutesConfig, e as ServiceAiClientConfig, i as createAiRoutes, j as createServiceAiClient, q as resolveAiTarget } from '../ai-DFsYPvk8.js';
@@ -1922,11 +1922,25 @@ function createAuthRoutes(config = {}) {
1922
1922
  rotated = newToken;
1923
1923
  }
1924
1924
  });
1925
- } catch {
1926
- return withNorm(clearSession(
1927
- { error: { code: "SESSION_EXPIRED", message: "Session expired" } },
1928
- cookieOptions
1929
- ));
1925
+ } catch (err) {
1926
+ const apiErr = err instanceof ScaleMuleApiError ? err : null;
1927
+ if (isSessionEndedError(apiErr)) {
1928
+ return withNorm(clearSession(
1929
+ { error: { code: "SESSION_EXPIRED", message: "Session expired" } },
1930
+ cookieOptions
1931
+ ));
1932
+ }
1933
+ const failure = errorResponse(
1934
+ apiErr?.code || "SESSION_CHECK_FAILED",
1935
+ "The session could not be checked",
1936
+ apiErr?.status && apiErr.status >= 400 ? apiErr.status : 503
1937
+ );
1938
+ const refreshedToken = rotated;
1939
+ if (refreshedToken) {
1940
+ const carrier = withRefreshedSession(refreshedToken, session.userId, {}, cookieOptions);
1941
+ for (const cookie of carrier.headers.getSetCookie()) failure.headers.append("Set-Cookie", cookie);
1942
+ }
1943
+ return withNorm(failure);
1930
1944
  }
1931
1945
  if (rotated) {
1932
1946
  return withNorm(withRefreshedSession(
@@ -1920,11 +1920,25 @@ function createAuthRoutes(config = {}) {
1920
1920
  rotated = newToken;
1921
1921
  }
1922
1922
  });
1923
- } catch {
1924
- return withNorm(clearSession(
1925
- { error: { code: "SESSION_EXPIRED", message: "Session expired" } },
1926
- cookieOptions
1927
- ));
1923
+ } catch (err) {
1924
+ const apiErr = err instanceof ScaleMuleApiError ? err : null;
1925
+ if (isSessionEndedError(apiErr)) {
1926
+ return withNorm(clearSession(
1927
+ { error: { code: "SESSION_EXPIRED", message: "Session expired" } },
1928
+ cookieOptions
1929
+ ));
1930
+ }
1931
+ const failure = errorResponse(
1932
+ apiErr?.code || "SESSION_CHECK_FAILED",
1933
+ "The session could not be checked",
1934
+ apiErr?.status && apiErr.status >= 400 ? apiErr.status : 503
1935
+ );
1936
+ const refreshedToken = rotated;
1937
+ if (refreshedToken) {
1938
+ const carrier = withRefreshedSession(refreshedToken, session.userId, {}, cookieOptions);
1939
+ for (const cookie of carrier.headers.getSetCookie()) failure.headers.append("Set-Cookie", cookie);
1940
+ }
1941
+ return withNorm(failure);
1928
1942
  }
1929
1943
  if (rotated) {
1930
1944
  return withNorm(withRefreshedSession(
@@ -1,9 +1,9 @@
1
- import { S as ServerConfig } from '../webhook-handler-hPeW76a1.mjs';
2
- export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-hPeW76a1.mjs';
3
- import { ClientContext, ApiError } from '../index.mjs';
4
- import { S as SessionCookieOptions, a as SessionData } from '../ai-VzQ-4hdN.mjs';
5
- export { A as AiAccountResolver, b as AiRoutesConfig, K as KNOWN_ACCOUNTS_COOKIE_NAME, c as KnownAccountEntry, d as SESSION_COOKIE_NAME, e as ServiceAiClientConfig, U as USER_ID_COOKIE_NAME, f as appendKnownAccountCookie, g as clearKnownAccountsCookie, h as clearSession, i as createAiRoutes, j as createServiceAiClient, k as getKnownAccountsCookieRaw, l as getKnownAccountsFromRequest, m as getSession, n as getSessionFromRequest, o as normalizeKnownAccountsCookie, r as removeKnownAccountFromCookie, p as requireSession, w as withSession } from '../ai-VzQ-4hdN.mjs';
6
- export { L as LedveryRoutesConfig, a as LedverySessionData, S as SM_LEDVERY_ACCESS_TOKEN_COOKIE, b as SM_LEDVERY_ID_TOKEN_COOKIE, c as SM_LEDVERY_NONCE_COOKIE, d as SM_LEDVERY_PKCE_VERIFIER_COOKIE, e as SM_LEDVERY_STATE_COOKIE, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-Caj1fxvW.mjs';
1
+ import { S as ServerConfig } from '../webhook-handler-CoASZNi5.mjs';
2
+ export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-CoASZNi5.mjs';
3
+ import { q as ClientContext, A as ApiError } from '../index-BOPHR50i.mjs';
4
+ import { S as SessionCookieOptions, a as SessionData } from '../ai-DFsYPvk8.mjs';
5
+ export { A as AiAccountResolver, b as AiRoutesConfig, K as KNOWN_ACCOUNTS_COOKIE_NAME, c as KnownAccountEntry, d as SESSION_COOKIE_NAME, e as ServiceAiClientConfig, U as USER_ID_COOKIE_NAME, f as appendKnownAccountCookie, g as clearKnownAccountsCookie, h as clearSession, i as createAiRoutes, j as createServiceAiClient, k as getKnownAccountsCookieRaw, l as getKnownAccountsFromRequest, m as getSession, n as getSessionFromRequest, o as normalizeKnownAccountsCookie, r as removeKnownAccountFromCookie, p as requireSession, w as withSession } from '../ai-DFsYPvk8.mjs';
6
+ export { L as LedveryRoutesConfig, a as LedverySessionData, S as SM_LEDVERY_ACCESS_TOKEN_COOKIE, b as SM_LEDVERY_ID_TOKEN_COOKIE, c as SM_LEDVERY_NONCE_COOKIE, d as SM_LEDVERY_PKCE_VERIFIER_COOKIE, e as SM_LEDVERY_STATE_COOKIE, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-CxPzZpxP.mjs';
7
7
  import { NextRequest, NextResponse } from 'next/server';
8
8
  import '@scalemule/sdk';
9
9
  import '@scalemule/money';
@@ -1301,5 +1301,4 @@ declare const DEFAULT_PERMISSIONS_POLICY: PermissionsPolicyMap;
1301
1301
  */
1302
1302
  declare function buildSecurityHeaders(opts?: BuildSecurityHeadersOptions): SecurityHeaderEntry[];
1303
1303
 
1304
- export { CSRF_COOKIE_NAME, CSRF_HEADER_NAME, DEFAULT_PERMISSIONS_POLICY, OAUTH_STATE_COOKIE_NAME, ScaleMuleError, ServerConfig, SessionCookieOptions, SessionData, apiHandler, buildClientContextHeaders, buildFlagContext, buildSecurityHeaders, clearOAuthState, configureBundles, configureSecrets, createAnalyticsRoutes, createAuthMiddleware, createAuthRoutes, createNewsletterRoutes, createNotificationRoutes, createPushRoutes, encodePathSegment, errorCodeToStatus, extractClientContext, extractClientContextFromReq, generateCSRFToken, getAppSecret, getAppSecretOrDefault, getBootstrapFlags, getBundle, getCSRFToken, getMySqlBundle, getOAuthBundle, getPostgresBundle, getRedisBundle, getS3Bundle, getSmtpBundle, hasUnsafePathSyntax, invalidateBundleCache, invalidateSecretCache, isSafePathSegment, isSafeRedirect, newsletterRoute, prefetchBundles, prefetchSecrets, requireAppSecret, requireBundle, resolveNotificationTarget, resolvePushTarget, setOAuthState, unwrap, validateCSRFToken, validateCSRFTokenAsync, validateOAuthState, validateOAuthStateAsync, validateSafeRedirect, withAuth, withCSRFProtection, withCSRFToken };
1305
- export type { AnalyticsRoutesConfig, AnalyticsTrackingGateConfig, AuthMiddlewareConfig, AuthRoutesConfig, BuildSecurityHeadersOptions, HandlerContext, HandlerOptions, MySqlBundle, NewsletterRoutesConfig, NotificationRoutesConfig, OAuthBundle, PermissionsPolicyMap, PermissionsPolicyValue, PostgresBundle, PushRoutesConfig, PushTarget, RedisBundle, S3Bundle, SafeRedirectOptions, SecurityHeaderEntry, SmtpBundle };
1304
+ export { type AnalyticsRoutesConfig, type AnalyticsTrackingGateConfig, type AuthMiddlewareConfig, type AuthRoutesConfig, type BuildSecurityHeadersOptions, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, DEFAULT_PERMISSIONS_POLICY, type HandlerContext, type HandlerOptions, type MySqlBundle, type NewsletterRoutesConfig, type NotificationRoutesConfig, OAUTH_STATE_COOKIE_NAME, type OAuthBundle, type PermissionsPolicyMap, type PermissionsPolicyValue, type PostgresBundle, type PushRoutesConfig, type PushTarget, type RedisBundle, type S3Bundle, type SafeRedirectOptions, ScaleMuleError, type SecurityHeaderEntry, ServerConfig, SessionCookieOptions, SessionData, type SmtpBundle, apiHandler, buildClientContextHeaders, buildFlagContext, buildSecurityHeaders, clearOAuthState, configureBundles, configureSecrets, createAnalyticsRoutes, createAuthMiddleware, createAuthRoutes, createNewsletterRoutes, createNotificationRoutes, createPushRoutes, encodePathSegment, errorCodeToStatus, extractClientContext, extractClientContextFromReq, generateCSRFToken, getAppSecret, getAppSecretOrDefault, getBootstrapFlags, getBundle, getCSRFToken, getMySqlBundle, getOAuthBundle, getPostgresBundle, getRedisBundle, getS3Bundle, getSmtpBundle, hasUnsafePathSyntax, invalidateBundleCache, invalidateSecretCache, isSafePathSegment, isSafeRedirect, newsletterRoute, prefetchBundles, prefetchSecrets, requireAppSecret, requireBundle, resolveNotificationTarget, resolvePushTarget, setOAuthState, unwrap, validateCSRFToken, validateCSRFTokenAsync, validateOAuthState, validateOAuthStateAsync, validateSafeRedirect, withAuth, withCSRFProtection, withCSRFToken };
@@ -1,9 +1,9 @@
1
- import { S as ServerConfig } from '../webhook-handler-DZXq9HbA.js';
2
- export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-DZXq9HbA.js';
3
- import { ClientContext, ApiError } from '../index.js';
4
- import { S as SessionCookieOptions, a as SessionData } from '../ai-VzQ-4hdN.js';
5
- export { A as AiAccountResolver, b as AiRoutesConfig, K as KNOWN_ACCOUNTS_COOKIE_NAME, c as KnownAccountEntry, d as SESSION_COOKIE_NAME, e as ServiceAiClientConfig, U as USER_ID_COOKIE_NAME, f as appendKnownAccountCookie, g as clearKnownAccountsCookie, h as clearSession, i as createAiRoutes, j as createServiceAiClient, k as getKnownAccountsCookieRaw, l as getKnownAccountsFromRequest, m as getSession, n as getSessionFromRequest, o as normalizeKnownAccountsCookie, r as removeKnownAccountFromCookie, p as requireSession, w as withSession } from '../ai-VzQ-4hdN.js';
6
- export { L as LedveryRoutesConfig, a as LedverySessionData, S as SM_LEDVERY_ACCESS_TOKEN_COOKIE, b as SM_LEDVERY_ID_TOKEN_COOKIE, c as SM_LEDVERY_NONCE_COOKIE, d as SM_LEDVERY_PKCE_VERIFIER_COOKIE, e as SM_LEDVERY_STATE_COOKIE, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-Caj1fxvW.js';
1
+ import { S as ServerConfig } from '../webhook-handler-C7XK0Tjs.js';
2
+ export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-C7XK0Tjs.js';
3
+ import { q as ClientContext, A as ApiError } from '../index-BOPHR50i.js';
4
+ import { S as SessionCookieOptions, a as SessionData } from '../ai-DFsYPvk8.js';
5
+ export { A as AiAccountResolver, b as AiRoutesConfig, K as KNOWN_ACCOUNTS_COOKIE_NAME, c as KnownAccountEntry, d as SESSION_COOKIE_NAME, e as ServiceAiClientConfig, U as USER_ID_COOKIE_NAME, f as appendKnownAccountCookie, g as clearKnownAccountsCookie, h as clearSession, i as createAiRoutes, j as createServiceAiClient, k as getKnownAccountsCookieRaw, l as getKnownAccountsFromRequest, m as getSession, n as getSessionFromRequest, o as normalizeKnownAccountsCookie, r as removeKnownAccountFromCookie, p as requireSession, w as withSession } from '../ai-DFsYPvk8.js';
6
+ export { L as LedveryRoutesConfig, a as LedverySessionData, S as SM_LEDVERY_ACCESS_TOKEN_COOKIE, b as SM_LEDVERY_ID_TOKEN_COOKIE, c as SM_LEDVERY_NONCE_COOKIE, d as SM_LEDVERY_PKCE_VERIFIER_COOKIE, e as SM_LEDVERY_STATE_COOKIE, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-CxPzZpxP.js';
7
7
  import { NextRequest, NextResponse } from 'next/server';
8
8
  import '@scalemule/sdk';
9
9
  import '@scalemule/money';
@@ -1301,5 +1301,4 @@ declare const DEFAULT_PERMISSIONS_POLICY: PermissionsPolicyMap;
1301
1301
  */
1302
1302
  declare function buildSecurityHeaders(opts?: BuildSecurityHeadersOptions): SecurityHeaderEntry[];
1303
1303
 
1304
- export { CSRF_COOKIE_NAME, CSRF_HEADER_NAME, DEFAULT_PERMISSIONS_POLICY, OAUTH_STATE_COOKIE_NAME, ScaleMuleError, ServerConfig, SessionCookieOptions, SessionData, apiHandler, buildClientContextHeaders, buildFlagContext, buildSecurityHeaders, clearOAuthState, configureBundles, configureSecrets, createAnalyticsRoutes, createAuthMiddleware, createAuthRoutes, createNewsletterRoutes, createNotificationRoutes, createPushRoutes, encodePathSegment, errorCodeToStatus, extractClientContext, extractClientContextFromReq, generateCSRFToken, getAppSecret, getAppSecretOrDefault, getBootstrapFlags, getBundle, getCSRFToken, getMySqlBundle, getOAuthBundle, getPostgresBundle, getRedisBundle, getS3Bundle, getSmtpBundle, hasUnsafePathSyntax, invalidateBundleCache, invalidateSecretCache, isSafePathSegment, isSafeRedirect, newsletterRoute, prefetchBundles, prefetchSecrets, requireAppSecret, requireBundle, resolveNotificationTarget, resolvePushTarget, setOAuthState, unwrap, validateCSRFToken, validateCSRFTokenAsync, validateOAuthState, validateOAuthStateAsync, validateSafeRedirect, withAuth, withCSRFProtection, withCSRFToken };
1305
- export type { AnalyticsRoutesConfig, AnalyticsTrackingGateConfig, AuthMiddlewareConfig, AuthRoutesConfig, BuildSecurityHeadersOptions, HandlerContext, HandlerOptions, MySqlBundle, NewsletterRoutesConfig, NotificationRoutesConfig, OAuthBundle, PermissionsPolicyMap, PermissionsPolicyValue, PostgresBundle, PushRoutesConfig, PushTarget, RedisBundle, S3Bundle, SafeRedirectOptions, SecurityHeaderEntry, SmtpBundle };
1304
+ export { type AnalyticsRoutesConfig, type AnalyticsTrackingGateConfig, type AuthMiddlewareConfig, type AuthRoutesConfig, type BuildSecurityHeadersOptions, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, DEFAULT_PERMISSIONS_POLICY, type HandlerContext, type HandlerOptions, type MySqlBundle, type NewsletterRoutesConfig, type NotificationRoutesConfig, OAUTH_STATE_COOKIE_NAME, type OAuthBundle, type PermissionsPolicyMap, type PermissionsPolicyValue, type PostgresBundle, type PushRoutesConfig, type PushTarget, type RedisBundle, type S3Bundle, type SafeRedirectOptions, ScaleMuleError, type SecurityHeaderEntry, ServerConfig, SessionCookieOptions, SessionData, type SmtpBundle, apiHandler, buildClientContextHeaders, buildFlagContext, buildSecurityHeaders, clearOAuthState, configureBundles, configureSecrets, createAnalyticsRoutes, createAuthMiddleware, createAuthRoutes, createNewsletterRoutes, createNotificationRoutes, createPushRoutes, encodePathSegment, errorCodeToStatus, extractClientContext, extractClientContextFromReq, generateCSRFToken, getAppSecret, getAppSecretOrDefault, getBootstrapFlags, getBundle, getCSRFToken, getMySqlBundle, getOAuthBundle, getPostgresBundle, getRedisBundle, getS3Bundle, getSmtpBundle, hasUnsafePathSyntax, invalidateBundleCache, invalidateSecretCache, isSafePathSegment, isSafeRedirect, newsletterRoute, prefetchBundles, prefetchSecrets, requireAppSecret, requireBundle, resolveNotificationTarget, resolvePushTarget, setOAuthState, unwrap, validateCSRFToken, validateCSRFTokenAsync, validateOAuthState, validateOAuthStateAsync, validateSafeRedirect, withAuth, withCSRFProtection, withCSRFToken };
@@ -2100,11 +2100,25 @@ function createAuthRoutes(config = {}) {
2100
2100
  rotated = newToken;
2101
2101
  }
2102
2102
  });
2103
- } catch {
2104
- return withNorm(clearSession(
2105
- { error: { code: "SESSION_EXPIRED", message: "Session expired" } },
2106
- cookieOptions
2107
- ));
2103
+ } catch (err) {
2104
+ const apiErr = err instanceof ScaleMuleApiError ? err : null;
2105
+ if (isSessionEndedError(apiErr)) {
2106
+ return withNorm(clearSession(
2107
+ { error: { code: "SESSION_EXPIRED", message: "Session expired" } },
2108
+ cookieOptions
2109
+ ));
2110
+ }
2111
+ const failure = errorResponse(
2112
+ apiErr?.code || "SESSION_CHECK_FAILED",
2113
+ "The session could not be checked",
2114
+ apiErr?.status && apiErr.status >= 400 ? apiErr.status : 503
2115
+ );
2116
+ const refreshedToken = rotated;
2117
+ if (refreshedToken) {
2118
+ const carrier = withRefreshedSession(refreshedToken, session.userId, {}, cookieOptions);
2119
+ for (const cookie of carrier.headers.getSetCookie()) failure.headers.append("Set-Cookie", cookie);
2120
+ }
2121
+ return withNorm(failure);
2108
2122
  }
2109
2123
  if (rotated) {
2110
2124
  return withNorm(withRefreshedSession(
@@ -2098,11 +2098,25 @@ function createAuthRoutes(config = {}) {
2098
2098
  rotated = newToken;
2099
2099
  }
2100
2100
  });
2101
- } catch {
2102
- return withNorm(clearSession(
2103
- { error: { code: "SESSION_EXPIRED", message: "Session expired" } },
2104
- cookieOptions
2105
- ));
2101
+ } catch (err) {
2102
+ const apiErr = err instanceof ScaleMuleApiError ? err : null;
2103
+ if (isSessionEndedError(apiErr)) {
2104
+ return withNorm(clearSession(
2105
+ { error: { code: "SESSION_EXPIRED", message: "Session expired" } },
2106
+ cookieOptions
2107
+ ));
2108
+ }
2109
+ const failure = errorResponse(
2110
+ apiErr?.code || "SESSION_CHECK_FAILED",
2111
+ "The session could not be checked",
2112
+ apiErr?.status && apiErr.status >= 400 ? apiErr.status : 503
2113
+ );
2114
+ const refreshedToken = rotated;
2115
+ if (refreshedToken) {
2116
+ const carrier = withRefreshedSession(refreshedToken, session.userId, {}, cookieOptions);
2117
+ for (const cookie of carrier.headers.getSetCookie()) failure.headers.append("Set-Cookie", cookie);
2118
+ }
2119
+ return withNorm(failure);
2106
2120
  }
2107
2121
  if (rotated) {
2108
2122
  return withNorm(withRefreshedSession(
@@ -1 +1 @@
1
- export { L as LedveryRoutesConfig, a as LedverySessionData, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-Caj1fxvW.mjs';
1
+ export { L as LedveryRoutesConfig, a as LedverySessionData, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-CxPzZpxP.mjs';
@@ -1 +1 @@
1
- export { L as LedveryRoutesConfig, a as LedverySessionData, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-Caj1fxvW.js';
1
+ export { L as LedveryRoutesConfig, a as LedverySessionData, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-CxPzZpxP.js';
@@ -1,4 +1,4 @@
1
- export { g as createWebhookHandler } from '../webhook-handler-hPeW76a1.mjs';
1
+ export { g as createWebhookHandler } from '../webhook-handler-CoASZNi5.mjs';
2
2
  import '@scalemule/sdk';
3
3
  import '@scalemule/money';
4
- import '../index-CCqkMN-C.mjs';
4
+ import '../index-BOPHR50i.mjs';
@@ -1,4 +1,4 @@
1
- export { g as createWebhookHandler } from '../webhook-handler-DZXq9HbA.js';
1
+ export { g as createWebhookHandler } from '../webhook-handler-C7XK0Tjs.js';
2
2
  import '@scalemule/sdk';
3
3
  import '@scalemule/money';
4
- import '../index-CCqkMN-C.js';
4
+ import '../index-BOPHR50i.js';
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { User, ApiError, StorageFile } from './index.mjs';
3
+ import { U as User, A as ApiError, ad as StorageFile } from './index-BOPHR50i.mjs';
4
4
 
5
5
  interface MockUserOptions {
6
6
  id?: string;
@@ -106,5 +106,4 @@ declare function MockScaleMuleProvider({ children, user: initialUser, initializi
106
106
  */
107
107
  declare function useMockScaleMule(): MockScaleMuleContextValue;
108
108
 
109
- export { MockScaleMuleClient, MockScaleMuleProvider, createMockFile, createMockUser, useMockScaleMule };
110
- export type { MockClientConfig, MockFileOptions, MockScaleMuleProviderProps, MockUserOptions };
109
+ export { type MockClientConfig, type MockFileOptions, MockScaleMuleClient, MockScaleMuleProvider, type MockScaleMuleProviderProps, type MockUserOptions, createMockFile, createMockUser, useMockScaleMule };
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { User, ApiError, StorageFile } from './index.js';
3
+ import { U as User, A as ApiError, ad as StorageFile } from './index-BOPHR50i.js';
4
4
 
5
5
  interface MockUserOptions {
6
6
  id?: string;
@@ -106,5 +106,4 @@ declare function MockScaleMuleProvider({ children, user: initialUser, initializi
106
106
  */
107
107
  declare function useMockScaleMule(): MockScaleMuleContextValue;
108
108
 
109
- export { MockScaleMuleClient, MockScaleMuleProvider, createMockFile, createMockUser, useMockScaleMule };
110
- export type { MockClientConfig, MockFileOptions, MockScaleMuleProviderProps, MockUserOptions };
109
+ export { type MockClientConfig, type MockFileOptions, MockScaleMuleClient, MockScaleMuleProvider, type MockScaleMuleProviderProps, type MockUserOptions, createMockFile, createMockUser, useMockScaleMule };
@@ -1,6 +1,6 @@
1
1
  import { ExperimentAssignment } from '@scalemule/sdk';
2
2
  import { MoneyClient } from '@scalemule/money';
3
- import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-CCqkMN-C.js';
3
+ import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-BOPHR50i.js';
4
4
 
5
5
  /**
6
6
  * Server-Side ScaleMule Client
@@ -855,5 +855,4 @@ type RouteHandler = (request: Request) => Promise<Response>;
855
855
  */
856
856
  declare function createWebhookHandler(config?: WebhookHandlerConfig): RouteHandler;
857
857
 
858
- export { ScaleMuleServer as a, createServerClient as f, createWebhookHandler as g, createWebhookRoutes as h, resolveGatewayUrl as i, parseWebhookEvent as p, registerVideoWebhook as r, verifyWebhookSignature as v };
859
- export type { ServerConfig as S, VideoFailedEvent as V, WebhookEvent as W, VideoReadyEvent as b, VideoTranscodedEvent as c, VideoUploadedEvent as d, WebhookRoutesConfig as e };
858
+ export { type ServerConfig as S, type VideoFailedEvent as V, type WebhookEvent as W, ScaleMuleServer as a, type VideoReadyEvent as b, type VideoTranscodedEvent as c, type VideoUploadedEvent as d, type WebhookRoutesConfig as e, createServerClient as f, createWebhookHandler as g, createWebhookRoutes as h, resolveGatewayUrl as i, parseWebhookEvent as p, registerVideoWebhook as r, verifyWebhookSignature as v };
@@ -1,6 +1,6 @@
1
1
  import { ExperimentAssignment } from '@scalemule/sdk';
2
2
  import { MoneyClient } from '@scalemule/money';
3
- import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-CCqkMN-C.mjs';
3
+ import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-BOPHR50i.mjs';
4
4
 
5
5
  /**
6
6
  * Server-Side ScaleMule Client
@@ -855,5 +855,4 @@ type RouteHandler = (request: Request) => Promise<Response>;
855
855
  */
856
856
  declare function createWebhookHandler(config?: WebhookHandlerConfig): RouteHandler;
857
857
 
858
- export { ScaleMuleServer as a, createServerClient as f, createWebhookHandler as g, createWebhookRoutes as h, resolveGatewayUrl as i, parseWebhookEvent as p, registerVideoWebhook as r, verifyWebhookSignature as v };
859
- export type { ServerConfig as S, VideoFailedEvent as V, WebhookEvent as W, VideoReadyEvent as b, VideoTranscodedEvent as c, VideoUploadedEvent as d, WebhookRoutesConfig as e };
858
+ export { type ServerConfig as S, type VideoFailedEvent as V, type WebhookEvent as W, ScaleMuleServer as a, type VideoReadyEvent as b, type VideoTranscodedEvent as c, type VideoUploadedEvent as d, type WebhookRoutesConfig as e, createServerClient as f, createWebhookHandler as g, createWebhookRoutes as h, resolveGatewayUrl as i, parseWebhookEvent as p, registerVideoWebhook as r, verifyWebhookSignature as v };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/nextjs",
3
- "version": "0.1.75",
3
+ "version": "0.1.76",
4
4
  "description": "ScaleMule SDK for Next.js applications - authentication, storage, and user management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",