@sublay/core 7.0.3 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,41 +1,81 @@
1
- # Sublay Core
1
+ # @sublay/core
2
2
 
3
- > **Note:** It is recommended to use the framework-specific package instead of this core package. Use `@sublay/react`, `@sublay/react-native`, or `@sublay/expo` for better integration, as they include `@sublay/core` under the hood.
3
+ [![npm](https://img.shields.io/npm/v/@sublay/core.svg)](https://www.npmjs.com/package/@sublay/core)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
4
5
 
5
- ## Overview
6
+ > **Backend infrastructure for user-powered products.** Pre-modeled bundles for the layers every app ends up rebuilding — comments, notifications, files, search, chat, and more. Install what you need, call through one SDK. Build the part that's actually yours.
6
7
 
7
- Sublay Core is the foundational package that powers the Sublay platform, providing developers with an easy-to-integrate solution for adding social and interactive features to their applications. It includes all the core client functionality needed to interact with Sublay’s backend services, allowing for seamless authentication, entity management, commenting, voting, notifications, and more.
8
+ Platform-agnostic hooks, context providers, and utilities that wrap the Sublay HTTP API.
8
9
 
9
- This package is designed to be flexible, efficient, and developer-friendly, offering powerful hooks and methods to streamline the integration process.
10
+ Most apps install one of the framework-specific packages — [`@sublay/react-js`](https://www.npmjs.com/package/@sublay/react-js), [`@sublay/react-native`](https://www.npmjs.com/package/@sublay/react-native), or [`@sublay/expo`](https://www.npmjs.com/package/@sublay/expo) — which re-export from `@sublay/core`. Install `@sublay/core` directly only if you need the lowest-level building blocks.
10
11
 
11
- ## Key Features
12
+ ```bash
13
+ npm install @sublay/core
14
+ ```
12
15
 
13
- - **Authentication** – Secure user authentication with support for external user management systems.
14
- - **Entities** – Create, update, delete, and manage content such as posts, products, or other user-generated items.
15
- - **Comments** – Full-featured comment system with replies, voting, and user mentions.
16
- - **Voting System** – Upvote/downvote functionality for both entities and comments.
17
- - **Entity Lists** – Fetch and display dynamic feeds with various filtering and sorting options.
18
- - **Lists** – Enable users to create collections of entities, including nested sublists.
19
- - **Reporting** – Allow users to report inappropriate content, enhancing moderation.
20
- - **App Notifications** – Generate in-app notifications for key user actions.
21
- - **Follows** – Establish follow relationships between users to build social connections.
16
+ ---
22
17
 
23
- ## Why Use Sublay Core?
18
+ ## What is Sublay
24
19
 
25
- Sublay Core eliminates the complexity of building essential social features from scratch. Instead of developing authentication, feeds, comments, and notifications independently, developers can leverage Sublay’s streamlined API and prebuilt functionality, saving time and ensuring best practices in security and performance.
20
+ Every user-powered product runs into the same engineering problems content modeling, threaded discussions, permission graphs, ranking pipelines, search indexing, notification fan-out, social graphs, and moderation queues. Sublay solves them, so you don't have to.
26
21
 
27
- ## Installation
22
+ Sublay ships these layers as **pre-modeled bundles** that attach to one shared entity model. You install the bundles you need from the dashboard, call them through any Sublay SDK, and build the part that's actually yours on top.
28
23
 
29
- Install the package via NPM:
24
+ ## Bundles you can install
30
25
 
31
- ```sh
32
- npm install @sublay/core
33
- ```
26
+ - **Comments & Threads** — threaded discussions with mentions, replies, sorting
27
+ - **Reactions & Votes** — upvotes, downvotes, multi-emoji reactions
28
+ - **Spaces & Communities** — groups, sub-forums, membership
29
+ - **Notifications** — in-app notification fan-out with optional webhook delivery
30
+ - **Feeds & Discovery** — hot / top / new / controversial, filtered by tag, geography, timeframe, or follow graph
31
+ - **Real-Time Chat** — direct messages and group threads
32
+ - **Follows & Connections** — one-way follows, mutual connections
33
+ - **Files & Storage** — file blob storage with managed upload URLs
34
+ - **AI-Powered Search** — semantic search across your entity tree
35
+ - **Moderation** — report queues and content-removal workflows
36
+
37
+ Every bundle attaches to the same model. No mismatches, no extra databases. One schema for everything.
38
+
39
+ ## How it works
40
+
41
+ 1. Create a project at [dash.sublay.io](https://dash.sublay.io) and install the bundles you need.
42
+ 2. Install a Sublay SDK in your app — this one, or one of its siblings (see below).
43
+ 3. Optionally drop in the open-source [`@sublay/ui-core-*`](https://github.com/sublay/ui-core) primitives, or install full components via the Sublay CLI registry.
44
+
45
+ ## The Sublay dashboard
46
+
47
+ The dashboard at [dash.sublay.io](https://dash.sublay.io) is a database/backend console for your project:
48
+
49
+ - **Overview** — usage metrics and project health
50
+ - **Authentication** — end users and OAuth providers
51
+ - **Database** — schema browser (tables, relationships) and a table editor for browsing rows
52
+ - **Storage** — file blobs uploaded through the Files bundle
53
+ - **Reports** — moderation queue across entity and comment reports
54
+ - **Broadcast** — send notifications to your users
55
+ - **Settings** — domains, webhooks, integrations, members, secrets, billing
56
+
57
+ ## The Sublay SDK family
58
+
59
+ - [`@sublay/core`](https://www.npmjs.com/package/@sublay/core) — platform-agnostic hooks and utilities
60
+ - [`@sublay/react-js`](https://www.npmjs.com/package/@sublay/react-js) — React (web)
61
+ - [`@sublay/react-native`](https://www.npmjs.com/package/@sublay/react-native) — React Native
62
+ - [`@sublay/expo`](https://www.npmjs.com/package/@sublay/expo) — Expo with SecureStore token storage
63
+ - [`@sublay/node`](https://www.npmjs.com/package/@sublay/node) — server-side Node.js (backends, server actions, webhook handlers)
64
+ - [`@sublay/js`](https://www.npmjs.com/package/@sublay/js) — framework-agnostic JavaScript (browser apps without React)
65
+ - [`@sublay/ui-core-react-js`](https://www.npmjs.com/package/@sublay/ui-core-react-js) / [`@sublay/ui-core-react-native`](https://www.npmjs.com/package/@sublay/ui-core-react-native) — open-source UI primitives
34
66
 
35
67
  ## Documentation
36
68
 
37
- Full documentation, including API references and integration guides, is available at [Sublay Documentation](https://docs.sublay.io).
69
+ Full API reference, SDK guides, and recipes: **[docs.sublay.io](https://docs.sublay.io)**
70
+
71
+ ## Community & support
72
+
73
+ - **Discord** — [discord.gg/REKxnCJzPz](https://discord.gg/REKxnCJzPz)
74
+ - **Blog** — [blog.sublay.io](https://blog.sublay.io)
75
+ - **X** — [@yantsab](https://x.com/yantsab)
76
+ - **LinkedIn** — [linkedin.com/company/sublay](https://www.linkedin.com/company/sublay)
77
+ - **Email** — [support@sublay.io](mailto:support@sublay.io)
38
78
 
39
79
  ## License
40
80
 
41
- Sublay Core is licensed under the Apache 2.0 License.
81
+ Apache 2.0
@@ -0,0 +1,70 @@
1
+ import type { AppDispatch } from "../../store/types";
2
+ /**
3
+ * Platform-agnostic OAuth helpers shared by the web (`@sublay/react-js`) and
4
+ * Expo (`@sublay/expo`) `useOAuthSignIn` hooks.
5
+ *
6
+ * These helpers deliberately contain NO browser/DOM globals (`window`,
7
+ * `document`, `localStorage`) and NO React Native globals, so the same code
8
+ * path runs on every platform. Each platform owns only its own I/O: obtaining
9
+ * the redirect URL (web reads `window.location`, Expo opens a web-browser auth
10
+ * session) and any navigation/URL cleanup.
11
+ */
12
+ export declare const OAUTH_BASE_URL = "https://api.sublay.io/v7";
13
+ /**
14
+ * Server-call head: POST to `/{projectId}/oauth/{authorize|link}` and return the
15
+ * provider `authorizationUrl`.
16
+ *
17
+ * - `authorize` is unauthenticated; `link` requires the caller's access token,
18
+ * passed via `accessToken` (sent as a Bearer header only when present).
19
+ * - Throws an `Error` carrying the server's `error` body on a non-ok response.
20
+ */
21
+ export declare function requestOAuthAuthorizationUrl({ projectId, endpoint, provider, redirectAfterAuth, accessToken, baseUrl, }: {
22
+ projectId: string;
23
+ endpoint: "authorize" | "link";
24
+ provider: string;
25
+ redirectAfterAuth: string;
26
+ /** Required for `link`, omitted for `authorize`. */
27
+ accessToken?: string | null;
28
+ baseUrl?: string;
29
+ }): Promise<string>;
30
+ export interface OAuthRedirectParams {
31
+ accessToken: string | null;
32
+ refreshToken: string | null;
33
+ error: string | null;
34
+ errorDescription: string | null;
35
+ }
36
+ /**
37
+ * Tolerantly parse a redirect URL string into OAuth params.
38
+ *
39
+ * The Sublay OAuth callback carries tokens in the URL **fragment**
40
+ * (`#accessToken=...&refreshToken=...`) and errors in the **query**
41
+ * (`?error=...&error_description=...`). This splits the string by hand rather
42
+ * than relying on `new URL().hash`, whose fragment handling is unreliable under
43
+ * React Native's URL polyfill — exactly where the tokens live.
44
+ */
45
+ export declare function parseOAuthRedirectUrl(url: string): OAuthRedirectParams;
46
+ export interface HandleOAuthRedirectResult {
47
+ /** True when tokens were found and dispatched. */
48
+ success: boolean;
49
+ /** A human-readable error message when the redirect carried an `?error=`. */
50
+ error: string | null;
51
+ }
52
+ /**
53
+ * Token-handling tail: given a redirect URL **string**, extract the tokens /
54
+ * error and, on success, perform the same Redux dispatches the web hook has
55
+ * always done (`setTokens` → `setInitialized` → `requestNewAccessTokenThunk`).
56
+ *
57
+ * Pure of any I/O beyond dispatching: it does not read globals, navigate, or
58
+ * clean the URL — the caller owns that. Accepts a URL string (or pre-parsed
59
+ * `params`, e.g. from `expo-linking`) so any platform can feed it whatever it
60
+ * obtained however it likes.
61
+ *
62
+ * Returns `{ success, error }` instead of throwing so callers can drive their
63
+ * own loading/error UI state.
64
+ */
65
+ export declare function handleOAuthRedirect({ dispatch, projectId, url, params, }: {
66
+ dispatch: AppDispatch;
67
+ projectId: string | null | undefined;
68
+ url?: string;
69
+ params?: OAuthRedirectParams;
70
+ }): HandleOAuthRedirectResult;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAUTH_BASE_URL = void 0;
4
+ exports.requestOAuthAuthorizationUrl = requestOAuthAuthorizationUrl;
5
+ exports.parseOAuthRedirectUrl = parseOAuthRedirectUrl;
6
+ exports.handleOAuthRedirect = handleOAuthRedirect;
7
+ const authSlice_1 = require("../../store/slices/authSlice");
8
+ const authThunks_1 = require("../../store/slices/authThunks");
9
+ /**
10
+ * Platform-agnostic OAuth helpers shared by the web (`@sublay/react-js`) and
11
+ * Expo (`@sublay/expo`) `useOAuthSignIn` hooks.
12
+ *
13
+ * These helpers deliberately contain NO browser/DOM globals (`window`,
14
+ * `document`, `localStorage`) and NO React Native globals, so the same code
15
+ * path runs on every platform. Each platform owns only its own I/O: obtaining
16
+ * the redirect URL (web reads `window.location`, Expo opens a web-browser auth
17
+ * session) and any navigation/URL cleanup.
18
+ */
19
+ // Single source of truth for the API base URL. Matches the web hook's prior
20
+ // hardcoded value exactly — do NOT swap in `getApiBaseUrl()`, which is
21
+ // env-aware and would diverge from the web hook's production-only behavior.
22
+ exports.OAUTH_BASE_URL = "https://api.sublay.io/v7";
23
+ /**
24
+ * Server-call head: POST to `/{projectId}/oauth/{authorize|link}` and return the
25
+ * provider `authorizationUrl`.
26
+ *
27
+ * - `authorize` is unauthenticated; `link` requires the caller's access token,
28
+ * passed via `accessToken` (sent as a Bearer header only when present).
29
+ * - Throws an `Error` carrying the server's `error` body on a non-ok response.
30
+ */
31
+ async function requestOAuthAuthorizationUrl({ projectId, endpoint, provider, redirectAfterAuth, accessToken, baseUrl = exports.OAUTH_BASE_URL, }) {
32
+ const headers = {
33
+ "Content-Type": "application/json",
34
+ };
35
+ if (accessToken) {
36
+ headers["Authorization"] = `Bearer ${accessToken}`;
37
+ }
38
+ const response = await fetch(`${baseUrl}/${projectId}/oauth/${endpoint}`, {
39
+ method: "POST",
40
+ headers,
41
+ body: JSON.stringify({ provider, redirectAfterAuth }),
42
+ });
43
+ if (!response.ok) {
44
+ const data = await response.json();
45
+ throw new Error(data.error || "Failed to initiate OAuth");
46
+ }
47
+ const data = await response.json();
48
+ return data.authorizationUrl;
49
+ }
50
+ /**
51
+ * Tolerantly parse a redirect URL string into OAuth params.
52
+ *
53
+ * The Sublay OAuth callback carries tokens in the URL **fragment**
54
+ * (`#accessToken=...&refreshToken=...`) and errors in the **query**
55
+ * (`?error=...&error_description=...`). This splits the string by hand rather
56
+ * than relying on `new URL().hash`, whose fragment handling is unreliable under
57
+ * React Native's URL polyfill — exactly where the tokens live.
58
+ */
59
+ function parseOAuthRedirectUrl(url) {
60
+ const hashIndex = url.indexOf("#");
61
+ const fragment = hashIndex >= 0 ? url.substring(hashIndex + 1) : "";
62
+ const beforeHash = hashIndex >= 0 ? url.substring(0, hashIndex) : url;
63
+ const queryIndex = beforeHash.indexOf("?");
64
+ const query = queryIndex >= 0 ? beforeHash.substring(queryIndex + 1) : "";
65
+ const fragmentParams = new URLSearchParams(fragment);
66
+ const queryParams = new URLSearchParams(query);
67
+ return {
68
+ accessToken: fragmentParams.get("accessToken"),
69
+ refreshToken: fragmentParams.get("refreshToken"),
70
+ error: queryParams.get("error"),
71
+ errorDescription: queryParams.get("error_description"),
72
+ };
73
+ }
74
+ /**
75
+ * Token-handling tail: given a redirect URL **string**, extract the tokens /
76
+ * error and, on success, perform the same Redux dispatches the web hook has
77
+ * always done (`setTokens` → `setInitialized` → `requestNewAccessTokenThunk`).
78
+ *
79
+ * Pure of any I/O beyond dispatching: it does not read globals, navigate, or
80
+ * clean the URL — the caller owns that. Accepts a URL string (or pre-parsed
81
+ * `params`, e.g. from `expo-linking`) so any platform can feed it whatever it
82
+ * obtained however it likes.
83
+ *
84
+ * Returns `{ success, error }` instead of throwing so callers can drive their
85
+ * own loading/error UI state.
86
+ */
87
+ function handleOAuthRedirect({ dispatch, projectId, url, params, }) {
88
+ const parsed = params ?? (url != null ? parseOAuthRedirectUrl(url) : null);
89
+ if (!parsed) {
90
+ return { success: false, error: null };
91
+ }
92
+ // Errors arrive in the query string. Surface them without dispatching.
93
+ if (parsed.error) {
94
+ return { success: false, error: parsed.errorDescription || parsed.error };
95
+ }
96
+ // Tokens arrive in the fragment. Only dispatch when both are present.
97
+ if (parsed.accessToken && parsed.refreshToken) {
98
+ dispatch((0, authSlice_1.setTokens)({
99
+ accessToken: parsed.accessToken,
100
+ refreshToken: parsed.refreshToken,
101
+ }));
102
+ dispatch((0, authSlice_1.setInitialized)(true));
103
+ // Fetch the user profile so `useAccountSync` can persist the account. The
104
+ // thunk reads the just-set refresh token from Redux, calls the server, and
105
+ // dispatches setUser + setUserInUserSlice on success.
106
+ if (projectId) {
107
+ dispatch((0, authThunks_1.requestNewAccessTokenThunk)({ projectId }));
108
+ }
109
+ return { success: true, error: null };
110
+ }
111
+ return { success: false, error: null };
112
+ }
113
+ //# sourceMappingURL=oauthCore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauthCore.js","sourceRoot":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AK,EAAE,CAAC;QACjB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,gBAAgB,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5E,CAAC;IAED,sEAAsE;IACtE,IAAI,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QAC9C,QAAQ,CACN,IAAA,qBAAS,EAAC;YACR,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC,CACH,CAAC;QACF,QAAQ,CAAC,IAAA,0BAAc,EAAC,IAAI,CAAC,CAAC,CAAC;QAE/B,0EAA0E;QAC1E,2EAA2E;QAC3E,sDAAsD;QACtD,IAAI,SAAS,EAAE,CAAC;YACd,QAAQ,CAAC,IAAA,uCAA0B,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACxC,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzC,CAAC"}
@@ -13,6 +13,7 @@ export { useSignTestingJwt, type SignTestingJwtProps } from "./hooks/crypto";
13
13
  export { useAuth, useRequestPasswordReset, useSendVerificationEmail, useVerifyEmail, type UseAuthValues, type SignUpWithEmailAndPasswordProps, type SignInWithEmailAndPasswordProps, type ChangePasswordProps, type RequestPasswordResetProps, type SendVerificationEmailProps, type VerifyEmailProps, } from "./hooks/auth";
14
14
  export { useAccountSync, useAccounts, useSwitchAccount, useAddAccount, useRemoveAccount, useSignOutAll, type UseAccountsReturn, type UseSwitchAccountReturn, type UseAddAccountReturn, type UseRemoveAccountReturn, type UseSignOutAllReturn, } from "./hooks/auth";
15
15
  export { useOAuthIdentities, type OAuthIdentity, type UseOAuthIdentitiesReturn, } from "./hooks/auth";
16
+ export { OAUTH_BASE_URL, requestOAuthAuthorizationUrl, parseOAuthRedirectUrl, handleOAuthRedirect, type OAuthRedirectParams, type HandleOAuthRedirectResult, } from "./hooks/auth/oauthCore";
16
17
  export { useSublayDispatch, useSublaySelector } from "./store/hooks";
17
18
  export { setTokens, setInitialized, selectAccessToken, } from "./store/slices/authSlice";
18
19
  export { requestNewAccessTokenThunk } from "./store/slices/authThunks";
@@ -53,7 +54,7 @@ export type { CommentsSortByOptions } from "./interfaces/CommentsSortByOptions";
53
54
  export type { EntityListSortByOptions, SortByReaction, SortDirection, SortType, } from "./interfaces/EntityListSortByOptions";
54
55
  export { validateSortBy, validateMetadataPropertyName, validateSortType, } from "./interfaces/EntityListSortByOptions";
55
56
  export type { TimeFrame } from "./interfaces/TimeFrame";
56
- export type { Connection, EstablishedConnection, PendingConnection, ConnectionsResponse, PendingConnectionsResponse, PendingConnectionListResponse, ConnectionRequestParams, ConnectionActionResponse, ConnectionWithdrawResponse, ConnectionCountResponse, RemoveConnectionByUserIdResponse, ConnectionStatusResponse, ConnectionStatus, } from "./interfaces/models/Connection";
57
+ export type { Connection, EstablishedConnection, PendingConnection, ConnectionRequestParams, ConnectionActionResponse, ConnectionWithdrawResponse, ConnectionCountResponse, RemoveConnectionByUserIdResponse, ConnectionStatusResponse, ConnectionStatus, } from "./interfaces/models/Connection";
57
58
  export type { Image, ImageVariant, UploadImageOptions, } from "./interfaces/models/Image";
58
59
  export type { File } from "./interfaces/models/File";
59
60
  export { useConversations, useConversation, useFetchConversation, useUpdateConversation, useDeleteConversation, useCreateDirectConversation, useFetchSpaceConversation, useConversationMembers, useChatMessages, useSendMessage, useEditMessage, useDeleteMessage, useToggleReaction, useMessageThread, useTotalUnreadCount, useUnreadConversationCount, useMarkConversationAsRead, useReportMessage, useConversationData, useTypingIndicator, useChatSocket, } from "./hooks/chat";
package/dist/cjs/index.js CHANGED
@@ -36,11 +36,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.useAppNotificationsActions = exports.useAppNotifications = exports.useUserActions = exports.useUser = exports.MAX_ACCOUNTS = exports.requestNewAccessTokenThunk = exports.selectAccessToken = exports.setInitialized = exports.setTokens = exports.useSublaySelector = exports.useSublayDispatch = exports.useOAuthIdentities = exports.useSignOutAll = exports.useRemoveAccount = exports.useAddAccount = exports.useSwitchAccount = exports.useAccounts = exports.useAccountSync = exports.useVerifyEmail = exports.useSendVerificationEmail = exports.useRequestPasswordReset = exports.useAuth = exports.useSignTestingJwt = exports.useProjectData = exports.useProject = exports.sublayApi = exports.sublayMiddleware = exports.sublayApiReducer = exports.sublayReducers = exports.useMessageThreadContext = exports.useConversationContext = exports.useChatContext = exports.MessageThreadProvider = exports.ConversationProvider = exports.ChatProvider = exports.SpaceProvider = exports.CommentSectionProvider = exports.EntityProvider = exports.SublayIntegrationProvider = exports.SublayProvider = exports.reportReasons = exports.getEnvVar = exports.getApiBaseUrl = exports.isProduction = exports.isDevelopment = exports.getPublicFileUrl = exports.getUserName = exports.safeMergeStyleProps = exports.keywordHelpers = exports.handleError = void 0;
40
- exports.useDeleteRule = exports.useUpdateRule = exports.useCreateRule = exports.useUpdateDigestConfig = exports.useFetchDigestConfig = exports.useCheckMyMembership = exports.useSpaceMentions = exports.useSpacePermissions = exports.useModerateSpaceComment = exports.useModerateSpaceEntity = exports.useUnbanMember = exports.useRemoveMember = exports.useDeclineMember = exports.useApproveMember = exports.useUpdateMemberRole = exports.useFetchUserSpaces = exports.useFetchSpaceTeam = exports.useFetchSpaceMembers = exports.useLeaveSpace = exports.useJoinSpace = exports.useDeleteSpace = exports.useUpdateSpace = exports.useCreateSpace = exports.useCheckSlugAvailability = exports.useFetchManySpaces = exports.useFetchSpaceChildren = exports.useFetchSpaceBreadcrumb = exports.useFetchSpaceBySlug = exports.useFetchSpaceByShortId = exports.useFetchSpace = exports.useSpaceData = exports.useSpace = exports.useEntityListActions = exports.useEntityList = exports.useIsEntitySaved = exports.usePublishDraft = exports.useFetchDrafts = exports.useUpdateEntity = exports.useFetchManyEntitiesWrapper = exports.useFetchManyEntities = exports.useFetchEntityByShortId = exports.useFetchEntityByForeignId = exports.useFetchEntity = exports.useDeleteEntity = exports.useCreateEntity = exports.useEntityData = exports.useEntity = exports.useCollectionEntitiesWrapper = exports.useCollectionsActions = exports.useCollections = void 0;
41
- exports.useFetchConnectionsCount = exports.useRemoveConnectionByUserId = exports.useFetchConnectionStatus = exports.useFetchConnections = exports.useRemoveConnection = exports.useDeclineConnection = exports.useAcceptConnection = exports.useRequestConnection = exports.useUnfollowUserByUserId = exports.useUnfollowByFollowId = exports.useFollowUser = exports.useFollowManager = exports.useFetchFollowingCountByUserId = exports.useFetchFollowingCount = exports.useFetchFollowingByUserId = exports.useFetchFollowing = exports.useFetchFollowersCountByUserId = exports.useFetchFollowersCount = exports.useFetchFollowersByUserId = exports.useFetchFollowers = exports.useFetchFollowStatus = exports.useUserMentions = exports.useFetchUserSuggestions = exports.useCheckUsernameAvailability = exports.useFetchUserByUsername = exports.useFetchUserByForeignId = exports.useFetchUser = exports.useReactionToggle = exports.useRemoveReaction = exports.useAddReaction = exports.useFetchCommentReactionsWrapper = exports.useFetchEntityReactionsWrapper = exports.useFetchCommentReactions = exports.useFetchEntityReactions = exports.useFetchManyCommentsWrapper = exports.useEntityComments = exports.useDeleteComment = exports.useUpdateComment = exports.useReplies = exports.useFetchCommentByForeignId = exports.useFetchComment = exports.useFetchManyComments = exports.useCreateComment = exports.useCommentSectionData = exports.useCommentSection = exports.useSpaceListActions = exports.useSpaceList = exports.useReorderRules = exports.useFetchManyRules = exports.useFetchRule = void 0;
42
- exports.clearUnread = exports.incrementUnread = exports.upsertConversationPreview = exports.setConversationListCursor = exports.setConversationListHasMore = exports.setConversationListLoading = exports.setConversationList = exports.setConversationLoading = exports.setConversation = exports.useChatSocket = exports.useTypingIndicator = exports.useConversationData = exports.useReportMessage = exports.useMarkConversationAsRead = exports.useUnreadConversationCount = exports.useTotalUnreadCount = exports.useMessageThread = exports.useToggleReaction = exports.useDeleteMessage = exports.useEditMessage = exports.useSendMessage = exports.useChatMessages = exports.useConversationMembers = exports.useFetchSpaceConversation = exports.useCreateDirectConversation = exports.useDeleteConversation = exports.useUpdateConversation = exports.useFetchConversation = exports.useConversation = exports.useConversations = exports.validateSortType = exports.validateMetadataPropertyName = exports.validateSortBy = exports.AppNotification = exports.useUploadImage = exports.useUploadFile = exports.useAskContent = exports.useSearchSpaces = exports.useSearchUsers = exports.useSearchContent = exports.useGetMetadata = exports.useHandleSpaceCommentReport = exports.useHandleSpaceEntityReport = exports.useFetchModeratedReports = exports.useCreateReport = exports.useConnectionManager = exports.useFetchConnectionsCountByUserId = exports.useFetchConnectionsByUserId = exports.useFetchReceivedPendingConnections = exports.useFetchSentPendingConnections = void 0;
43
- exports.selectSocketConnected = exports.selectTypingUsers = exports.selectThreadHasMore = exports.selectThreadLoading = exports.selectThreadReplies = exports.selectNewestMessageId = exports.selectOldestMessageId = exports.selectMessagesHasMore = exports.selectMessagesLoading = exports.selectMessages = exports.selectConversationListCursor = exports.selectConversationListHasMore = exports.selectConversationListLoading = exports.selectConversationList = exports.selectConversationLoading = exports.selectConversation = exports.setSocketConnected = exports.setTypingUsers = exports.setThreadLoading = exports.setThreadReplies = exports.updateReactions = exports.removeMessage = exports.failOptimisticMessage = exports.addOptimisticMessage = exports.upsertMessage = exports.setMessagesHasMore = exports.setMessagesLoading = void 0;
39
+ exports.MAX_ACCOUNTS = exports.requestNewAccessTokenThunk = exports.selectAccessToken = exports.setInitialized = exports.setTokens = exports.useSublaySelector = exports.useSublayDispatch = exports.handleOAuthRedirect = exports.parseOAuthRedirectUrl = exports.requestOAuthAuthorizationUrl = exports.OAUTH_BASE_URL = exports.useOAuthIdentities = exports.useSignOutAll = exports.useRemoveAccount = exports.useAddAccount = exports.useSwitchAccount = exports.useAccounts = exports.useAccountSync = exports.useVerifyEmail = exports.useSendVerificationEmail = exports.useRequestPasswordReset = exports.useAuth = exports.useSignTestingJwt = exports.useProjectData = exports.useProject = exports.sublayApi = exports.sublayMiddleware = exports.sublayApiReducer = exports.sublayReducers = exports.useMessageThreadContext = exports.useConversationContext = exports.useChatContext = exports.MessageThreadProvider = exports.ConversationProvider = exports.ChatProvider = exports.SpaceProvider = exports.CommentSectionProvider = exports.EntityProvider = exports.SublayIntegrationProvider = exports.SublayProvider = exports.reportReasons = exports.getEnvVar = exports.getApiBaseUrl = exports.isProduction = exports.isDevelopment = exports.getPublicFileUrl = exports.getUserName = exports.safeMergeStyleProps = exports.keywordHelpers = exports.handleError = void 0;
40
+ exports.useFetchDigestConfig = exports.useCheckMyMembership = exports.useSpaceMentions = exports.useSpacePermissions = exports.useModerateSpaceComment = exports.useModerateSpaceEntity = exports.useUnbanMember = exports.useRemoveMember = exports.useDeclineMember = exports.useApproveMember = exports.useUpdateMemberRole = exports.useFetchUserSpaces = exports.useFetchSpaceTeam = exports.useFetchSpaceMembers = exports.useLeaveSpace = exports.useJoinSpace = exports.useDeleteSpace = exports.useUpdateSpace = exports.useCreateSpace = exports.useCheckSlugAvailability = exports.useFetchManySpaces = exports.useFetchSpaceChildren = exports.useFetchSpaceBreadcrumb = exports.useFetchSpaceBySlug = exports.useFetchSpaceByShortId = exports.useFetchSpace = exports.useSpaceData = exports.useSpace = exports.useEntityListActions = exports.useEntityList = exports.useIsEntitySaved = exports.usePublishDraft = exports.useFetchDrafts = exports.useUpdateEntity = exports.useFetchManyEntitiesWrapper = exports.useFetchManyEntities = exports.useFetchEntityByShortId = exports.useFetchEntityByForeignId = exports.useFetchEntity = exports.useDeleteEntity = exports.useCreateEntity = exports.useEntityData = exports.useEntity = exports.useCollectionEntitiesWrapper = exports.useCollectionsActions = exports.useCollections = exports.useAppNotificationsActions = exports.useAppNotifications = exports.useUserActions = exports.useUser = void 0;
41
+ exports.useRemoveConnection = exports.useDeclineConnection = exports.useAcceptConnection = exports.useRequestConnection = exports.useUnfollowUserByUserId = exports.useUnfollowByFollowId = exports.useFollowUser = exports.useFollowManager = exports.useFetchFollowingCountByUserId = exports.useFetchFollowingCount = exports.useFetchFollowingByUserId = exports.useFetchFollowing = exports.useFetchFollowersCountByUserId = exports.useFetchFollowersCount = exports.useFetchFollowersByUserId = exports.useFetchFollowers = exports.useFetchFollowStatus = exports.useUserMentions = exports.useFetchUserSuggestions = exports.useCheckUsernameAvailability = exports.useFetchUserByUsername = exports.useFetchUserByForeignId = exports.useFetchUser = exports.useReactionToggle = exports.useRemoveReaction = exports.useAddReaction = exports.useFetchCommentReactionsWrapper = exports.useFetchEntityReactionsWrapper = exports.useFetchCommentReactions = exports.useFetchEntityReactions = exports.useFetchManyCommentsWrapper = exports.useEntityComments = exports.useDeleteComment = exports.useUpdateComment = exports.useReplies = exports.useFetchCommentByForeignId = exports.useFetchComment = exports.useFetchManyComments = exports.useCreateComment = exports.useCommentSectionData = exports.useCommentSection = exports.useSpaceListActions = exports.useSpaceList = exports.useReorderRules = exports.useFetchManyRules = exports.useFetchRule = exports.useDeleteRule = exports.useUpdateRule = exports.useCreateRule = exports.useUpdateDigestConfig = void 0;
42
+ exports.setConversationListHasMore = exports.setConversationListLoading = exports.setConversationList = exports.setConversationLoading = exports.setConversation = exports.useChatSocket = exports.useTypingIndicator = exports.useConversationData = exports.useReportMessage = exports.useMarkConversationAsRead = exports.useUnreadConversationCount = exports.useTotalUnreadCount = exports.useMessageThread = exports.useToggleReaction = exports.useDeleteMessage = exports.useEditMessage = exports.useSendMessage = exports.useChatMessages = exports.useConversationMembers = exports.useFetchSpaceConversation = exports.useCreateDirectConversation = exports.useDeleteConversation = exports.useUpdateConversation = exports.useFetchConversation = exports.useConversation = exports.useConversations = exports.validateSortType = exports.validateMetadataPropertyName = exports.validateSortBy = exports.AppNotification = exports.useUploadImage = exports.useUploadFile = exports.useAskContent = exports.useSearchSpaces = exports.useSearchUsers = exports.useSearchContent = exports.useGetMetadata = exports.useHandleSpaceCommentReport = exports.useHandleSpaceEntityReport = exports.useFetchModeratedReports = exports.useCreateReport = exports.useConnectionManager = exports.useFetchConnectionsCountByUserId = exports.useFetchConnectionsByUserId = exports.useFetchReceivedPendingConnections = exports.useFetchSentPendingConnections = exports.useFetchConnectionsCount = exports.useRemoveConnectionByUserId = exports.useFetchConnectionStatus = exports.useFetchConnections = void 0;
43
+ exports.selectSocketConnected = exports.selectTypingUsers = exports.selectThreadHasMore = exports.selectThreadLoading = exports.selectThreadReplies = exports.selectNewestMessageId = exports.selectOldestMessageId = exports.selectMessagesHasMore = exports.selectMessagesLoading = exports.selectMessages = exports.selectConversationListCursor = exports.selectConversationListHasMore = exports.selectConversationListLoading = exports.selectConversationList = exports.selectConversationLoading = exports.selectConversation = exports.setSocketConnected = exports.setTypingUsers = exports.setThreadLoading = exports.setThreadReplies = exports.updateReactions = exports.removeMessage = exports.failOptimisticMessage = exports.addOptimisticMessage = exports.upsertMessage = exports.setMessagesHasMore = exports.setMessagesLoading = exports.clearUnread = exports.incrementUnread = exports.upsertConversationPreview = exports.setConversationListCursor = void 0;
44
44
  // Helpers & Utilities
45
45
  var handleError_1 = require("./utils/handleError");
46
46
  Object.defineProperty(exports, "handleError", { enumerable: true, get: function () { return handleError_1.handleError; } });
@@ -103,6 +103,12 @@ Object.defineProperty(exports, "useSignOutAll", { enumerable: true, get: functio
103
103
  // -- authentication (OAuth)
104
104
  var auth_3 = require("./hooks/auth");
105
105
  Object.defineProperty(exports, "useOAuthIdentities", { enumerable: true, get: function () { return auth_3.useOAuthIdentities; } });
106
+ // -- authentication (OAuth shared helpers — consumed by platform hooks)
107
+ var oauthCore_1 = require("./hooks/auth/oauthCore");
108
+ Object.defineProperty(exports, "OAUTH_BASE_URL", { enumerable: true, get: function () { return oauthCore_1.OAUTH_BASE_URL; } });
109
+ Object.defineProperty(exports, "requestOAuthAuthorizationUrl", { enumerable: true, get: function () { return oauthCore_1.requestOAuthAuthorizationUrl; } });
110
+ Object.defineProperty(exports, "parseOAuthRedirectUrl", { enumerable: true, get: function () { return oauthCore_1.parseOAuthRedirectUrl; } });
111
+ Object.defineProperty(exports, "handleOAuthRedirect", { enumerable: true, get: function () { return oauthCore_1.handleOAuthRedirect; } });
106
112
  // -- store internals (for platform-specific hooks in react-js / react-native)
107
113
  var hooks_1 = require("./store/hooks");
108
114
  Object.defineProperty(exports, "useSublayDispatch", { enumerable: true, get: function () { return hooks_1.useSublayDispatch; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sBAAsB;AACtB,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AACpB,yDAAwD;AAA/C,gHAAA,cAAc,OAAA;AACvB,qEAAoE;AAA3D,0HAAA,mBAAmB,OAAA;AAC5B,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,+DAAyE;AAAhE,qIAAA,OAAO,OAAoB;AACpC,mCAKqB;AAJnB,oGAAA,aAAa,OAAA;AACb,mGAAA,YAAY,OAAA;AACZ,oGAAA,aAAa,OAAA;AACb,gGAAA,SAAS,OAAA;AAGX,YAAY;AACZ,2DAA0D;AAAjD,8GAAA,aAAa,OAAA;AAGtB,+CAA+C;AAC/C,qCAkBmB;AAjBjB,yGAAA,cAAc,OAAA;AACd,oHAAA,yBAAyB,OAAA;AACzB,yGAAA,cAAc,OAAA;AACd,iHAAA,sBAAsB,OAAA;AACtB,wGAAA,aAAa,OAAA;AACb,uGAAA,YAAY,OAAA;AACZ,+GAAA,oBAAoB,OAAA;AACpB,gHAAA,qBAAqB,OAAA;AACrB,yGAAA,cAAc,OAAA;AACd,iHAAA,sBAAsB,OAAA;AACtB,kHAAA,uBAAuB,OAAA;AASzB,kEAAkE;AAClE,mDAM6B;AAL3B,6GAAA,cAAc,OAAA;AACd,+GAAA,gBAAgB,OAAA;AAChB,+GAAA,gBAAgB,OAAA;AAChB,wGAAA,SAAS,OAAA;AA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
13
  user: User;
14
14
  type: "received" | "sent";
15
15
  }
16
- export interface PaginationInfo {
17
- currentPage: number;
18
- totalPages: number;
19
- totalCount: number;
20
- hasNextPage: boolean;
21
- hasPreviousPage: boolean;
22
- limit: number;
23
- }
24
- export interface ConnectionsResponse {
25
- connections: EstablishedConnection[];
26
- pagination: PaginationInfo;
27
- }
28
- export interface PendingConnectionsResponse {
29
- received: {
30
- requests: PendingConnection[];
31
- pagination: PaginationInfo;
32
- };
33
- sent: {
34
- requests: PendingConnection[];
35
- pagination: PaginationInfo;
36
- };
37
- }
38
- export interface PendingConnectionListResponse {
39
- requests: PendingConnection[];
40
- pagination: PaginationInfo;
41
- }
42
16
  export interface ConnectionRequestParams {
43
17
  userId: string;
44
18
  message?: string;
@@ -20,7 +20,7 @@ interface FetchCollectionEntitiesResponse {
20
20
  data: Entity[];
21
21
  pagination: {
22
22
  page: number;
23
- limit: number;
23
+ pageSize: number;
24
24
  totalPages: number;
25
25
  totalItems: number;
26
26
  hasMore: boolean;
@@ -0,0 +1,70 @@
1
+ import type { AppDispatch } from "../../store/types";
2
+ /**
3
+ * Platform-agnostic OAuth helpers shared by the web (`@sublay/react-js`) and
4
+ * Expo (`@sublay/expo`) `useOAuthSignIn` hooks.
5
+ *
6
+ * These helpers deliberately contain NO browser/DOM globals (`window`,
7
+ * `document`, `localStorage`) and NO React Native globals, so the same code
8
+ * path runs on every platform. Each platform owns only its own I/O: obtaining
9
+ * the redirect URL (web reads `window.location`, Expo opens a web-browser auth
10
+ * session) and any navigation/URL cleanup.
11
+ */
12
+ export declare const OAUTH_BASE_URL = "https://api.sublay.io/v7";
13
+ /**
14
+ * Server-call head: POST to `/{projectId}/oauth/{authorize|link}` and return the
15
+ * provider `authorizationUrl`.
16
+ *
17
+ * - `authorize` is unauthenticated; `link` requires the caller's access token,
18
+ * passed via `accessToken` (sent as a Bearer header only when present).
19
+ * - Throws an `Error` carrying the server's `error` body on a non-ok response.
20
+ */
21
+ export declare function requestOAuthAuthorizationUrl({ projectId, endpoint, provider, redirectAfterAuth, accessToken, baseUrl, }: {
22
+ projectId: string;
23
+ endpoint: "authorize" | "link";
24
+ provider: string;
25
+ redirectAfterAuth: string;
26
+ /** Required for `link`, omitted for `authorize`. */
27
+ accessToken?: string | null;
28
+ baseUrl?: string;
29
+ }): Promise<string>;
30
+ export interface OAuthRedirectParams {
31
+ accessToken: string | null;
32
+ refreshToken: string | null;
33
+ error: string | null;
34
+ errorDescription: string | null;
35
+ }
36
+ /**
37
+ * Tolerantly parse a redirect URL string into OAuth params.
38
+ *
39
+ * The Sublay OAuth callback carries tokens in the URL **fragment**
40
+ * (`#accessToken=...&refreshToken=...`) and errors in the **query**
41
+ * (`?error=...&error_description=...`). This splits the string by hand rather
42
+ * than relying on `new URL().hash`, whose fragment handling is unreliable under
43
+ * React Native's URL polyfill — exactly where the tokens live.
44
+ */
45
+ export declare function parseOAuthRedirectUrl(url: string): OAuthRedirectParams;
46
+ export interface HandleOAuthRedirectResult {
47
+ /** True when tokens were found and dispatched. */
48
+ success: boolean;
49
+ /** A human-readable error message when the redirect carried an `?error=`. */
50
+ error: string | null;
51
+ }
52
+ /**
53
+ * Token-handling tail: given a redirect URL **string**, extract the tokens /
54
+ * error and, on success, perform the same Redux dispatches the web hook has
55
+ * always done (`setTokens` → `setInitialized` → `requestNewAccessTokenThunk`).
56
+ *
57
+ * Pure of any I/O beyond dispatching: it does not read globals, navigate, or
58
+ * clean the URL — the caller owns that. Accepts a URL string (or pre-parsed
59
+ * `params`, e.g. from `expo-linking`) so any platform can feed it whatever it
60
+ * obtained however it likes.
61
+ *
62
+ * Returns `{ success, error }` instead of throwing so callers can drive their
63
+ * own loading/error UI state.
64
+ */
65
+ export declare function handleOAuthRedirect({ dispatch, projectId, url, params, }: {
66
+ dispatch: AppDispatch;
67
+ projectId: string | null | undefined;
68
+ url?: string;
69
+ params?: OAuthRedirectParams;
70
+ }): HandleOAuthRedirectResult;
@@ -0,0 +1,107 @@
1
+ import { setTokens, setInitialized } from "../../store/slices/authSlice";
2
+ import { requestNewAccessTokenThunk } from "../../store/slices/authThunks";
3
+ /**
4
+ * Platform-agnostic OAuth helpers shared by the web (`@sublay/react-js`) and
5
+ * Expo (`@sublay/expo`) `useOAuthSignIn` hooks.
6
+ *
7
+ * These helpers deliberately contain NO browser/DOM globals (`window`,
8
+ * `document`, `localStorage`) and NO React Native globals, so the same code
9
+ * path runs on every platform. Each platform owns only its own I/O: obtaining
10
+ * the redirect URL (web reads `window.location`, Expo opens a web-browser auth
11
+ * session) and any navigation/URL cleanup.
12
+ */
13
+ // Single source of truth for the API base URL. Matches the web hook's prior
14
+ // hardcoded value exactly — do NOT swap in `getApiBaseUrl()`, which is
15
+ // env-aware and would diverge from the web hook's production-only behavior.
16
+ export const OAUTH_BASE_URL = "https://api.sublay.io/v7";
17
+ /**
18
+ * Server-call head: POST to `/{projectId}/oauth/{authorize|link}` and return the
19
+ * provider `authorizationUrl`.
20
+ *
21
+ * - `authorize` is unauthenticated; `link` requires the caller's access token,
22
+ * passed via `accessToken` (sent as a Bearer header only when present).
23
+ * - Throws an `Error` carrying the server's `error` body on a non-ok response.
24
+ */
25
+ export async function requestOAuthAuthorizationUrl({ projectId, endpoint, provider, redirectAfterAuth, accessToken, baseUrl = OAUTH_BASE_URL, }) {
26
+ const headers = {
27
+ "Content-Type": "application/json",
28
+ };
29
+ if (accessToken) {
30
+ headers["Authorization"] = `Bearer ${accessToken}`;
31
+ }
32
+ const response = await fetch(`${baseUrl}/${projectId}/oauth/${endpoint}`, {
33
+ method: "POST",
34
+ headers,
35
+ body: JSON.stringify({ provider, redirectAfterAuth }),
36
+ });
37
+ if (!response.ok) {
38
+ const data = await response.json();
39
+ throw new Error(data.error || "Failed to initiate OAuth");
40
+ }
41
+ const data = await response.json();
42
+ return data.authorizationUrl;
43
+ }
44
+ /**
45
+ * Tolerantly parse a redirect URL string into OAuth params.
46
+ *
47
+ * The Sublay OAuth callback carries tokens in the URL **fragment**
48
+ * (`#accessToken=...&refreshToken=...`) and errors in the **query**
49
+ * (`?error=...&error_description=...`). This splits the string by hand rather
50
+ * than relying on `new URL().hash`, whose fragment handling is unreliable under
51
+ * React Native's URL polyfill — exactly where the tokens live.
52
+ */
53
+ export function parseOAuthRedirectUrl(url) {
54
+ const hashIndex = url.indexOf("#");
55
+ const fragment = hashIndex >= 0 ? url.substring(hashIndex + 1) : "";
56
+ const beforeHash = hashIndex >= 0 ? url.substring(0, hashIndex) : url;
57
+ const queryIndex = beforeHash.indexOf("?");
58
+ const query = queryIndex >= 0 ? beforeHash.substring(queryIndex + 1) : "";
59
+ const fragmentParams = new URLSearchParams(fragment);
60
+ const queryParams = new URLSearchParams(query);
61
+ return {
62
+ accessToken: fragmentParams.get("accessToken"),
63
+ refreshToken: fragmentParams.get("refreshToken"),
64
+ error: queryParams.get("error"),
65
+ errorDescription: queryParams.get("error_description"),
66
+ };
67
+ }
68
+ /**
69
+ * Token-handling tail: given a redirect URL **string**, extract the tokens /
70
+ * error and, on success, perform the same Redux dispatches the web hook has
71
+ * always done (`setTokens` → `setInitialized` → `requestNewAccessTokenThunk`).
72
+ *
73
+ * Pure of any I/O beyond dispatching: it does not read globals, navigate, or
74
+ * clean the URL — the caller owns that. Accepts a URL string (or pre-parsed
75
+ * `params`, e.g. from `expo-linking`) so any platform can feed it whatever it
76
+ * obtained however it likes.
77
+ *
78
+ * Returns `{ success, error }` instead of throwing so callers can drive their
79
+ * own loading/error UI state.
80
+ */
81
+ export function handleOAuthRedirect({ dispatch, projectId, url, params, }) {
82
+ const parsed = params ?? (url != null ? parseOAuthRedirectUrl(url) : null);
83
+ if (!parsed) {
84
+ return { success: false, error: null };
85
+ }
86
+ // Errors arrive in the query string. Surface them without dispatching.
87
+ if (parsed.error) {
88
+ return { success: false, error: parsed.errorDescription || parsed.error };
89
+ }
90
+ // Tokens arrive in the fragment. Only dispatch when both are present.
91
+ if (parsed.accessToken && parsed.refreshToken) {
92
+ dispatch(setTokens({
93
+ accessToken: parsed.accessToken,
94
+ refreshToken: parsed.refreshToken,
95
+ }));
96
+ dispatch(setInitialized(true));
97
+ // Fetch the user profile so `useAccountSync` can persist the account. The
98
+ // thunk reads the just-set refresh token from Redux, calls the server, and
99
+ // dispatches setUser + setUserInUserSlice on success.
100
+ if (projectId) {
101
+ dispatch(requestNewAccessTokenThunk({ projectId }));
102
+ }
103
+ return { success: true, error: null };
104
+ }
105
+ return { success: false, error: null };
106
+ }
107
+ //# sourceMappingURL=oauthCore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauthCore.js","sourceRoot":"","sources":["../../../../src/hooks/auth/oauthCore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3E;;;;;;;;;GASG;AAEH,4EAA4E;AAC5E,uEAAuE;AACvE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,EACjD,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,OAAO,GAAG,cAAc,GASzB;IACC,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;KACnC,CAAC;IACF,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,WAAW,EAAE,CAAC;IACrD,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,IAAI,SAAS,UAAU,QAAQ,EAAE,EAAE;QACxE,MAAM,EAAE,MAAM;QACd,OAAO;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;KACtD,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MA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set, useSendVerificationEmail, useVerifyEmail, type UseAuthValues, type SignUpWithEmailAndPasswordProps, type SignInWithEmailAndPasswordProps, type ChangePasswordProps, type RequestPasswordResetProps, type SendVerificationEmailProps, type VerifyEmailProps, } from "./hooks/auth";
14
14
  export { useAccountSync, useAccounts, useSwitchAccount, useAddAccount, useRemoveAccount, useSignOutAll, type UseAccountsReturn, type UseSwitchAccountReturn, type UseAddAccountReturn, type UseRemoveAccountReturn, type UseSignOutAllReturn, } from "./hooks/auth";
15
15
  export { useOAuthIdentities, type OAuthIdentity, type UseOAuthIdentitiesReturn, } from "./hooks/auth";
16
+ export { OAUTH_BASE_URL, requestOAuthAuthorizationUrl, parseOAuthRedirectUrl, handleOAuthRedirect, type OAuthRedirectParams, type HandleOAuthRedirectResult, } from "./hooks/auth/oauthCore";
16
17
  export { useSublayDispatch, useSublaySelector } from "./store/hooks";
17
18
  export { setTokens, setInitialized, selectAccessToken, } from "./store/slices/authSlice";
18
19
  export { requestNewAccessTokenThunk } from "./store/slices/authThunks";
@@ -53,7 +54,7 @@ export type { CommentsSortByOptions } from "./interfaces/CommentsSortByOptions";
53
54
  export type { EntityListSortByOptions, SortByReaction, SortDirection, SortType, } from "./interfaces/EntityListSortByOptions";
54
55
  export { validateSortBy, validateMetadataPropertyName, validateSortType, } from "./interfaces/EntityListSortByOptions";
55
56
  export type { TimeFrame } from "./interfaces/TimeFrame";
56
- export type { Connection, EstablishedConnection, PendingConnection, ConnectionsResponse, PendingConnectionsResponse, PendingConnectionListResponse, ConnectionRequestParams, ConnectionActionResponse, ConnectionWithdrawResponse, ConnectionCountResponse, RemoveConnectionByUserIdResponse, ConnectionStatusResponse, ConnectionStatus, } from "./interfaces/models/Connection";
57
+ export type { Connection, EstablishedConnection, PendingConnection, ConnectionRequestParams, ConnectionActionResponse, ConnectionWithdrawResponse, ConnectionCountResponse, RemoveConnectionByUserIdResponse, ConnectionStatusResponse, ConnectionStatus, } from "./interfaces/models/Connection";
57
58
  export type { Image, ImageVariant, UploadImageOptions, } from "./interfaces/models/Image";
58
59
  export type { File } from "./interfaces/models/File";
59
60
  export { useConversations, useConversation, useFetchConversation, useUpdateConversation, useDeleteConversation, useCreateDirectConversation, useFetchSpaceConversation, useConversationMembers, useChatMessages, useSendMessage, useEditMessage, useDeleteMessage, useToggleReaction, useMessageThread, useTotalUnreadCount, useUnreadConversationCount, useMarkConversationAsRead, useReportMessage, useConversationData, useTypingIndicator, useChatSocket, } from "./hooks/chat";
package/dist/esm/index.js CHANGED
@@ -21,6 +21,8 @@ export { useAuth, useRequestPasswordReset, useSendVerificationEmail, useVerifyEm
21
21
  export { useAccountSync, useAccounts, useSwitchAccount, useAddAccount, useRemoveAccount, useSignOutAll, } from "./hooks/auth";
22
22
  // -- authentication (OAuth)
23
23
  export { useOAuthIdentities, } from "./hooks/auth";
24
+ // -- authentication (OAuth shared helpers — consumed by platform hooks)
25
+ export { OAUTH_BASE_URL, requestOAuthAuthorizationUrl, parseOAuthRedirectUrl, handleOAuthRedirect, } from "./hooks/auth/oauthCore";
24
26
  // -- store internals (for platform-specific hooks in react-js / react-native)
25
27
  export { useSublayDispatch, useSublaySelector } from "./store/hooks";
26
28
  export { setTokens, setInitialized, selectAccessToken, } from "./store/slices/authSlice";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,YAAY;AACZ,OAA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qB,EACrB,qBAAqB,EACrB,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,EAC1B,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,GACd,MAAM,cAAc,CAAC;AA4CtB,gBAAgB;AAChB,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC5B,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GAEtB,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAS,GACV,MAAM,aA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,cAAc,EACd,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,sCAAsC,CAAC;AAqB9C,gBAAgB;AAChB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,EAC1B,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,GACd,MAAM,cAAc,CAAC;AA4CtB,gBAAgB;AAChB,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC5B,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GAEtB,MAAM,0BAA0B,CAAC"}
@@ -13,32 +13,6 @@ export interface PendingConnection extends Connection {
13
13
  user: User;
14
14
  type: "received" | "sent";
15
15
  }
16
- export interface PaginationInfo {
17
- currentPage: number;
18
- totalPages: number;
19
- totalCount: number;
20
- hasNextPage: boolean;
21
- hasPreviousPage: boolean;
22
- limit: number;
23
- }
24
- export interface ConnectionsResponse {
25
- connections: EstablishedConnection[];
26
- pagination: PaginationInfo;
27
- }
28
- export interface PendingConnectionsResponse {
29
- received: {
30
- requests: PendingConnection[];
31
- pagination: PaginationInfo;
32
- };
33
- sent: {
34
- requests: PendingConnection[];
35
- pagination: PaginationInfo;
36
- };
37
- }
38
- export interface PendingConnectionListResponse {
39
- requests: PendingConnection[];
40
- pagination: PaginationInfo;
41
- }
42
16
  export interface ConnectionRequestParams {
43
17
  userId: string;
44
18
  message?: string;
@@ -20,7 +20,7 @@ interface FetchCollectionEntitiesResponse {
20
20
  data: Entity[];
21
21
  pagination: {
22
22
  page: number;
23
- limit: number;
23
+ pageSize: number;
24
24
  totalPages: number;
25
25
  totalItems: number;
26
26
  hasMore: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sublay/core",
3
- "version": "7.0.3",
3
+ "version": "7.1.0",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "author": "Sublay, maintained by Yanay Tsabary",