deepspace 0.3.8 → 0.3.10

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.d.ts CHANGED
@@ -5202,15 +5202,7 @@ declare const signIn: {
5202
5202
  message?: string | undefined;
5203
5203
  }, FetchOptions["throw"] extends true ? true : false>>;
5204
5204
  };
5205
- declare const signOut: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
5206
- query?: Record<string, any> | undefined;
5207
- fetchOptions?: FetchOptions | undefined;
5208
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react.BetterFetchResponse<{
5209
- success: boolean;
5210
- }, {
5211
- code?: string | undefined;
5212
- message?: string | undefined;
5213
- }, FetchOptions["throw"] extends true ? true : false>>;
5205
+ declare function signOut(...args: Parameters<typeof authClient.signOut>): Promise<Awaited<ReturnType<typeof authClient.signOut>>>;
5214
5206
 
5215
5207
  /**
5216
5208
  * Short-lived JWT provider for WebSocket and API authentication.
@@ -5838,6 +5830,8 @@ declare function usePresence(opts?: UsePresenceOptions): {
5838
5830
  interface UseYjsRoomResult {
5839
5831
  /** The Yjs document */
5840
5832
  doc: Y.Doc;
5833
+ /** Awareness instance for presence/typing state */
5834
+ awareness: Awareness;
5841
5835
  /** Current text content (for the specified field) */
5842
5836
  text: string;
5843
5837
  /** Set text (replaces full content) */
@@ -6858,6 +6852,176 @@ type AiStreamAction = {
6858
6852
  /** Decode one v5 UIMessage stream chunk into an action, or `null` to ignore. */
6859
6853
  declare function decodeAiStreamChunk(chunk: AiStreamChunk): AiStreamAction | null;
6860
6854
 
6855
+ /**
6856
+ * Subscription primitives shared between client (useSubscription hook) and
6857
+ * server (requireSubscription helper). Pulled into a shared module so the
6858
+ * entitlement gate has a single source of truth — if it ever diverges between
6859
+ * client and server, gated features silently disagree about who's allowed in,
6860
+ * which is a security bug, not a UX bug.
6861
+ */
6862
+ type SubscriptionStatus = 'none' | 'trialing' | 'active' | 'past_due' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'unpaid' | 'paused';
6863
+ /** Per-interval price advertised by a plan. */
6864
+ interface PlanPrice {
6865
+ interval: 'month' | 'year';
6866
+ priceCents: number;
6867
+ currency?: string;
6868
+ }
6869
+ /**
6870
+ * Plan shape returned by `/api/subscriptions/me` and consumed directly by
6871
+ * `<PricingTable plans={sub.plans}>`. Fields beyond slug/rank are optional so
6872
+ * a free tier (no prices, no trial) doesn't need to fabricate them.
6873
+ */
6874
+ interface PlanInfo {
6875
+ slug: string;
6876
+ rank: number;
6877
+ name: string;
6878
+ trialDays?: number | null;
6879
+ prices: PlanPrice[];
6880
+ }
6881
+
6882
+ interface SubscriptionState {
6883
+ tier: string;
6884
+ status: SubscriptionStatus;
6885
+ /** Billing interval of the active subscription, or null for free / no sub. */
6886
+ interval: 'month' | 'year' | null;
6887
+ currentPeriodEnd: number | null;
6888
+ cancelAtPeriodEnd: boolean;
6889
+ trialEndsAt: number | null;
6890
+ plans: PlanInfo[];
6891
+ }
6892
+ interface SubscribeOpts {
6893
+ interval?: 'month' | 'year';
6894
+ returnUrl?: string;
6895
+ cancelUrl?: string;
6896
+ }
6897
+ interface SubscribeResult {
6898
+ url: string | null;
6899
+ immediate: boolean;
6900
+ requiresPayment?: boolean;
6901
+ hostedInvoiceUrl?: string | null;
6902
+ }
6903
+ interface UseSubscriptionReturn {
6904
+ tier: string;
6905
+ status: SubscriptionStatus;
6906
+ /**
6907
+ * True iff status is `active` or `trialing`. `hasTier` and `isAtLeast`
6908
+ * already encode this — read `entitled` only when you need the raw boolean
6909
+ * without picking a tier.
6910
+ */
6911
+ entitled: boolean;
6912
+ /** Current billing interval, or null when on free / no subscription. */
6913
+ interval: 'month' | 'year' | null;
6914
+ currentPeriodEnd: number | null;
6915
+ cancelAtPeriodEnd: boolean;
6916
+ trialEndsAt: number | null;
6917
+ isLoading: boolean;
6918
+ error: string | null;
6919
+ /**
6920
+ * Returns true only when `tier === slug` AND the subscription is currently
6921
+ * entitled (status ∈ {active, trialing}). A `past_due` / `canceled` /
6922
+ * `unpaid` subscription that still has a stored paid tier returns false.
6923
+ * The free tier is always entitled.
6924
+ */
6925
+ hasTier: (slug: string) => boolean;
6926
+ /**
6927
+ * Returns true when the tier's rank meets-or-exceeds `slug` AND the
6928
+ * subscription is currently entitled. Same entitlement gate as `hasTier`.
6929
+ */
6930
+ isAtLeast: (slug: string) => boolean;
6931
+ /** Plan catalog from /me — pass into `<PricingTable plans={...}>` directly. */
6932
+ plans: PlanInfo[];
6933
+ subscribe: (planSlug: string, opts?: SubscribeOpts) => Promise<SubscribeResult>;
6934
+ openPortal: (returnUrl?: string) => Promise<{
6935
+ url: string;
6936
+ }>;
6937
+ refresh: () => Promise<void>;
6938
+ }
6939
+ declare function useSubscription(): UseSubscriptionReturn;
6940
+
6941
+ type PricingTablePrice = PlanPrice;
6942
+ type PricingTablePlan = PlanInfo;
6943
+ declare function PricingTable(props: {
6944
+ plans: PricingTablePlan[];
6945
+ interval?: 'month' | 'year';
6946
+ currentTier?: string;
6947
+ onSelect: (planSlug: string, interval: 'month' | 'year') => void | Promise<void>;
6948
+ }): react_jsx_runtime.JSX.Element;
6949
+
6950
+ interface ChargeRedirectOpts {
6951
+ /** Defaults to window.location.href. */
6952
+ returnUrl?: string;
6953
+ /** Defaults to window.location.href. */
6954
+ cancelUrl?: string;
6955
+ }
6956
+ /**
6957
+ * Product-mode charge: amount, name, and currency are resolved server-side
6958
+ * from the developer's declared product catalog (`src/products.ts`). The
6959
+ * browser cannot influence the price — this is the only entitlement-safe
6960
+ * shape because `useCheckout({productId}).owned` can be trusted afterwards.
6961
+ */
6962
+ interface ProductChargeOpts extends ChargeRedirectOpts {
6963
+ productId: string;
6964
+ }
6965
+ /**
6966
+ * Ad-hoc charge: tips, donations, "name your price". Caller supplies the
6967
+ * amount and display name; the resulting invoice has `productId=null`, so
6968
+ * `ownsProduct()` will never report ownership against it. Use for revenue
6969
+ * collection, not for feature gating.
6970
+ */
6971
+ interface AdHocChargeOpts extends ChargeRedirectOpts {
6972
+ /** Amount in cents. Minimum 100 (Stripe fees eat smaller amounts). */
6973
+ amount: number;
6974
+ /** Product name shown in Checkout and on the customer's receipt. */
6975
+ name: string;
6976
+ /** Optional description rendered under the product name. */
6977
+ description?: string;
6978
+ /** Must be omitted in ad-hoc mode — the never type makes the union disjoint. */
6979
+ productId?: never;
6980
+ }
6981
+ /**
6982
+ * `chargeOnce` accepts either a `productId` (server-resolves price/name) or
6983
+ * an `amount`+`name` pair (ad-hoc). The two are mutually exclusive at the
6984
+ * type level so the safe path doesn't require dummy amount/name fields.
6985
+ */
6986
+ type ChargeOnceOpts = ProductChargeOpts | AdHocChargeOpts;
6987
+ interface ChargeOnceResult {
6988
+ url: string;
6989
+ }
6990
+ interface Purchase {
6991
+ /** Internal invoice row id. Stable across refetches. */
6992
+ id: string;
6993
+ /** Developer-supplied product id, or null for pre-entitlement rows. */
6994
+ productId: string | null;
6995
+ /** Display name captured at checkout time. */
6996
+ name: string;
6997
+ /** Amount paid in cents (post-tax — uses Stripe's `amount_total`). */
6998
+ amount: number;
6999
+ currency: string;
7000
+ /** ISO timestamp of the payment. */
7001
+ paidAt: string;
7002
+ }
7003
+ interface UseCheckoutOpts {
7004
+ /**
7005
+ * Product id to derive `owned` against. Without this, `owned` is always
7006
+ * false — the hook still surfaces `purchases` and `ownsProduct` for
7007
+ * callers that need to ask about more than one product.
7008
+ */
7009
+ productId?: string;
7010
+ }
7011
+ interface UseCheckoutReturn {
7012
+ chargeOnce: (opts: ChargeOnceOpts) => Promise<ChargeOnceResult>;
7013
+ isLoading: boolean;
7014
+ error: string | null;
7015
+ purchases: Purchase[];
7016
+ /** True iff `opts.productId` was provided and a non-fully-refunded row matches. */
7017
+ owned: boolean;
7018
+ /** Pure function over the in-memory `purchases` array. No network. */
7019
+ ownsProduct: (productId: string) => boolean;
7020
+ /** Re-fetch the purchase list. Useful right after a successful checkout. */
7021
+ refresh: () => Promise<void>;
7022
+ }
7023
+ declare function useCheckout(opts?: UseCheckoutOpts): UseCheckoutReturn;
7024
+
6861
7025
  declare function cn(...inputs: ClassValue[]): string;
6862
7026
 
6863
7027
  declare const Card: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
@@ -7230,4 +7394,4 @@ interface SearchInputProps extends Omit<React$1.ComponentProps<'input'>, 'type'>
7230
7394
  }
7231
7395
  declare const SearchInput: React$1.ForwardRefExoticComponent<Omit<SearchInputProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
7232
7396
 
7233
- export { type AiStreamAction, type AiStreamChunk, Alert, AlertDescription, AlertTitle, AuthGate, type AuthGateProps, AuthOverlay, Avatar, AvatarFallback, AvatarImage, Awareness, type AwarenessState, type AwarenessStates, Badge, type BadgeProps, type BaseMessage, Button, type ButtonProps, type CanvasShapeClient, Card, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardTitle, type Channel, type ChannelInvitation, type ChannelMember, Checkbox, type ClientMessage, type CollectionSchema, ConfirmModal, type ConnectionAttachment, type ConnectionStatus, type ContentSegment, type ConversationObject, type CronHistoryEntry, type CronTaskState, DEEPSPACE_THEME_PROPERTIES, DEFAULT_USER_COLORS, DeepSpaceAuthProvider, type DeepSpaceThemeConfig, DeepSpaceThemeProvider, type DeepSpaceThemeProviderProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ENV, EmptyDocuments, EmptyError, EmptyItems, EmptyProjects, EmptySearch, EmptyState, EmptyTeam, type Environment, type FetchUserProfile, type FileAttachment, type GamePlayer, GridCard, type GroupedReaction, GuestBanner, type HandlerContext, type InboxEntry, Input, type IntegrationResponse, Label, type LinkPreviewData, LoadingOverlay, LoadingSpinner, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type MemberRecord, type Message, type MessageHandlers, type MessageRecord, Modal, type MsgType, PlatformContext, type PlatformContextValue, PlatformProvider, type PlatformWSOptions, type PlatformWSResult, type PresencePeerClient, Progress, type ProtocolMessage, type Query, type R2FileInfo, type R2Scope, type R2UploadResult, ROLES, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_CONFIG, ROLE_DEFAULT, type Reaction, type ReactionRecord, type ReadCursorRecord, type ReadReceipt, type RecordData, RecordProvider, type RecordProviderProps, RecordScope, type RequestOptions, type Role, type RoomUser, type ScopeEntry, ScopeRegistryProvider, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, type ServerMessage, SignedIn, SignedOut, Skeleton, SkeletonAvatar, SkeletonCard, SkeletonList, SkeletonTable, SkeletonText, Switch, type SyncResult, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ToastProvider, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseCanvasResult, type UseCronMonitorResult, type UseGameRoomResult, type UsePresenceRoomResult, type UseR2FilesReturn, type UseYjsFieldResult, type UseYjsRoomResult, type UseYjsTextResult, type User, type UserCredits, type UserInfo, type UserKarma, type UserProfile, type ViewportClient, applyDeepSpaceTheme, applyUIThemeTokens, authClient, badgeVariants, buttonVariants, clearAuthToken, clearDeepSpaceTheme, clientBuild, cn, createDecoder, createEncoder, decodeAiStreamChunk, detectEnvironment, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, formatFileSize, formatFullTimestamp, formatMessageTime, getApiUrl, getAuthToken, getAuthUrl, getConversationDisplayName, getConversationParticipantIds, getEnvironmentConfig, getMessageType, getPlatformWorkerUrl, getThreadCounts, getUserColor, groupReactionsForMessage, handleAwarenessMessage, handleSyncMessage, hasContent, integration, isDMConversation, isDarkColor, isImageFile, isLocalDev, isProduction, parseMessageMetadata, parseSseLine, readThemeFromDOM, readVarUint, readVarUint8Array, resetEnvironmentCache, serverBuild, shouldGroupMessages, signIn, signOut, toConnectionStatus, toUint8Array, useAuth, useAuthUser, useCanvas, useChannelMembers, useChannels, useCommunities, useConversation, useConversations, useCronMonitor, useDisplayName, useGameRoom, useInbox, useIsDarkTheme, useMessages, useMutations, usePlatform, usePlatformWS, usePosts, usePresence, usePresenceRoom, useQuery, useR2Files, useReactions, useReadReceipts, useRecordContext, useSession, useToast, useUser, useUserLookup, useUsers, useYjsField, useYjsRoom, useYjsText, writeVarUint, writeVarUint8Array };
7397
+ export { type AdHocChargeOpts, type AiStreamAction, type AiStreamChunk, Alert, AlertDescription, AlertTitle, AuthGate, type AuthGateProps, AuthOverlay, Avatar, AvatarFallback, AvatarImage, Awareness, type AwarenessState, type AwarenessStates, Badge, type BadgeProps, type BaseMessage, Button, type ButtonProps, type CanvasShapeClient, Card, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardTitle, type Channel, type ChannelInvitation, type ChannelMember, type ChargeOnceOpts, type ChargeOnceResult, Checkbox, type ClientMessage, type CollectionSchema, ConfirmModal, type ConnectionAttachment, type ConnectionStatus, type ContentSegment, type ConversationObject, type CronHistoryEntry, type CronTaskState, DEEPSPACE_THEME_PROPERTIES, DEFAULT_USER_COLORS, DeepSpaceAuthProvider, type DeepSpaceThemeConfig, DeepSpaceThemeProvider, type DeepSpaceThemeProviderProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ENV, EmptyDocuments, EmptyError, EmptyItems, EmptyProjects, EmptySearch, EmptyState, EmptyTeam, type Environment, type FetchUserProfile, type FileAttachment, type GamePlayer, GridCard, type GroupedReaction, GuestBanner, type HandlerContext, type InboxEntry, Input, type IntegrationResponse, Label, type LinkPreviewData, LoadingOverlay, LoadingSpinner, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type MemberRecord, type Message, type MessageHandlers, type MessageRecord, Modal, type MsgType, type PlanInfo, PlatformContext, type PlatformContextValue, PlatformProvider, type PlatformWSOptions, type PlatformWSResult, type PresencePeerClient, PricingTable, type PricingTablePlan, type PricingTablePrice, type ProductChargeOpts, Progress, type ProtocolMessage, type Purchase, type Query, type R2FileInfo, type R2Scope, type R2UploadResult, ROLES, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_CONFIG, ROLE_DEFAULT, type Reaction, type ReactionRecord, type ReadCursorRecord, type ReadReceipt, type RecordData, RecordProvider, type RecordProviderProps, RecordScope, type RequestOptions, type Role, type RoomUser, type ScopeEntry, ScopeRegistryProvider, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, type ServerMessage, SignedIn, SignedOut, Skeleton, SkeletonAvatar, SkeletonCard, SkeletonList, SkeletonTable, SkeletonText, type SubscribeOpts, type SubscribeResult, type SubscriptionState, type SubscriptionStatus, Switch, type SyncResult, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ToastProvider, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseCanvasResult, type UseCheckoutOpts, type UseCronMonitorResult, type UseGameRoomResult, type UsePresenceRoomResult, type UseR2FilesReturn, type UseYjsFieldResult, type UseYjsRoomResult, type UseYjsTextResult, type User, type UserCredits, type UserInfo, type UserKarma, type UserProfile, type ViewportClient, applyDeepSpaceTheme, applyUIThemeTokens, authClient, badgeVariants, buttonVariants, clearAuthToken, clearDeepSpaceTheme, clientBuild, cn, createDecoder, createEncoder, decodeAiStreamChunk, detectEnvironment, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, formatFileSize, formatFullTimestamp, formatMessageTime, getApiUrl, getAuthToken, getAuthUrl, getConversationDisplayName, getConversationParticipantIds, getEnvironmentConfig, getMessageType, getPlatformWorkerUrl, getThreadCounts, getUserColor, groupReactionsForMessage, handleAwarenessMessage, handleSyncMessage, hasContent, integration, isDMConversation, isDarkColor, isImageFile, isLocalDev, isProduction, parseMessageMetadata, parseSseLine, readThemeFromDOM, readVarUint, readVarUint8Array, resetEnvironmentCache, serverBuild, shouldGroupMessages, signIn, signOut, toConnectionStatus, toUint8Array, useAuth, useAuthUser, useCanvas, useChannelMembers, useChannels, useCheckout, useCommunities, useConversation, useConversations, useCronMonitor, useDisplayName, useGameRoom, useInbox, useIsDarkTheme, useMessages, useMutations, usePlatform, usePlatformWS, usePosts, usePresence, usePresenceRoom, useQuery, useR2Files, useReactions, useReadReceipts, useRecordContext, useSession, useSubscription, useToast, useUser, useUserLookup, useUsers, useYjsField, useYjsRoom, useYjsText, writeVarUint, writeVarUint8Array };