@fluid-app/portal-sdk 0.1.159 → 0.1.161
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 +2 -196
- package/dist/{FluidProvider-Cqf2kmUc.mjs → FluidProvider-B00jTGTH.mjs} +1510 -1624
- package/dist/FluidProvider-B00jTGTH.mjs.map +1 -0
- package/dist/{FluidProvider-Bc-3uN7M.cjs → FluidProvider-BtGi2jJt.cjs} +1458 -1614
- package/dist/FluidProvider-BtGi2jJt.cjs.map +1 -0
- package/dist/{MessagingScreen-BGqIn-c2.cjs → MessagingScreen-BRCUJDDZ.cjs} +2 -2
- package/dist/{MessagingScreen-CbmuvlH6.mjs → MessagingScreen-BWpSXB8Q.mjs} +2 -2
- package/dist/{MessagingScreen-CbmuvlH6.mjs.map → MessagingScreen-BWpSXB8Q.mjs.map} +1 -1
- package/dist/{MessagingScreen-CBPjP4du.cjs → MessagingScreen-C_OLIWCC.cjs} +2 -2
- package/dist/{MessagingScreen-CBPjP4du.cjs.map → MessagingScreen-C_OLIWCC.cjs.map} +1 -1
- package/dist/{MySiteScreen-DSDLDnCN.cjs → MySiteScreen-B90qzZPe.cjs} +2 -2
- package/dist/{MySiteScreen-Cl6nuU99.cjs → MySiteScreen-DLuHDXB1.cjs} +2 -2
- package/dist/{MySiteScreen-Cl6nuU99.cjs.map → MySiteScreen-DLuHDXB1.cjs.map} +1 -1
- package/dist/{MySiteScreen-BT1PBPsH.mjs → MySiteScreen-VaOB-vWk.mjs} +2 -2
- package/dist/{MySiteScreen-BT1PBPsH.mjs.map → MySiteScreen-VaOB-vWk.mjs.map} +1 -1
- package/dist/ProductsScreen-B8OynxlP.cjs +13 -0
- package/dist/{ProductsScreen-4WRrJcvw.mjs → ProductsScreen-CbVSNv1l.mjs} +3 -5
- package/dist/ProductsScreen-CbVSNv1l.mjs.map +1 -0
- package/dist/{ProductsScreen-BCs3YKVk.cjs → ProductsScreen-D1bw4ZIH.cjs} +3 -5
- package/dist/ProductsScreen-D1bw4ZIH.cjs.map +1 -0
- package/dist/ProductsScreen-Pq3j09nI.mjs +11 -0
- package/dist/{ProfileScreen-BgyrIQdL.mjs → ProfileScreen-BCHljkWD.mjs} +2 -2
- package/dist/{ProfileScreen-BgyrIQdL.mjs.map → ProfileScreen-BCHljkWD.mjs.map} +1 -1
- package/dist/{ProfileScreen-B0KNWXpV.cjs → ProfileScreen-Bf-lYNzz.cjs} +2 -2
- package/dist/{ProfileScreen-DLLLRNB2.cjs → ProfileScreen-ksdtbydb.cjs} +2 -2
- package/dist/{ProfileScreen-DLLLRNB2.cjs.map → ProfileScreen-ksdtbydb.cjs.map} +1 -1
- package/dist/{ShareablesScreen-ySSwCVSI.cjs → ShareablesScreen-6wgiwi_9.cjs} +3 -5
- package/dist/ShareablesScreen-6wgiwi_9.cjs.map +1 -0
- package/dist/{ShareablesScreen-B8cmh8JC.mjs → ShareablesScreen-BLCukNTk.mjs} +3 -5
- package/dist/{ShareablesScreen-B8cmh8JC.mjs.map → ShareablesScreen-BLCukNTk.mjs.map} +1 -1
- package/dist/ShareablesScreen-CM9OH-Nx.mjs +11 -0
- package/dist/ShareablesScreen-rmLcUhbL.cjs +13 -0
- package/dist/{ShopScreen-DhMo8bvP.cjs → ShopScreen-8KKwwjka.cjs} +3 -3
- package/dist/{ShopScreen-DhMo8bvP.cjs.map → ShopScreen-8KKwwjka.cjs.map} +1 -1
- package/dist/{ShopScreen-BkvyW0pE.cjs → ShopScreen-CjEbB3Q7.cjs} +2 -2
- package/dist/{ShopScreen-BFFGYwdV.mjs → ShopScreen-Dn5LwwYD.mjs} +3 -3
- package/dist/{ShopScreen-BFFGYwdV.mjs.map → ShopScreen-Dn5LwwYD.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-RScBCcY0.cjs → SubscriptionsScreen-B16wPAoA.cjs} +2 -2
- package/dist/SubscriptionsScreen-B16wPAoA.cjs.map +1 -0
- package/dist/{SubscriptionsScreen-CiNR7JUC.mjs → SubscriptionsScreen-B4cTlgDU.mjs} +2 -2
- package/dist/SubscriptionsScreen-B4cTlgDU.mjs.map +1 -0
- package/dist/{SubscriptionsScreen-DMh-GE6n.cjs → SubscriptionsScreen-nRUMdnx7.cjs} +1 -1
- package/dist/{dist-Bg8UyHyM.cjs → dist-lO2OG0T5.cjs} +1 -1
- package/dist/{dist-Bg8UyHyM.cjs.map → dist-lO2OG0T5.cjs.map} +1 -1
- package/dist/index.cjs +134 -143
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +444 -655
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +444 -655
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +127 -130
- package/dist/index.mjs.map +1 -1
- package/dist/{sortable.esm-Cz-CP2N8.mjs → sortable.esm-DSrWP4x9.mjs} +1 -1
- package/dist/{sortable.esm-Cz-CP2N8.mjs.map → sortable.esm-DSrWP4x9.mjs.map} +1 -1
- package/dist/{use-portal-products-client-BmlUixy4.cjs → use-portal-products-client-BHSBT64s.cjs} +2 -2
- package/dist/use-portal-products-client-BHSBT64s.cjs.map +1 -0
- package/dist/{use-portal-products-client-DQK9nFxT.mjs → use-portal-products-client-tbqk6XUq.mjs} +2 -2
- package/dist/use-portal-products-client-tbqk6XUq.mjs.map +1 -0
- package/dist/{use-portal-shareables-api-KVPj0Jfr.mjs → use-portal-shareables-api-B9B4XTjw.mjs} +107 -201
- package/dist/use-portal-shareables-api-B9B4XTjw.mjs.map +1 -0
- package/dist/{use-portal-shareables-api-D5D6uIJy.cjs → use-portal-shareables-api-MBl0d0eQ.cjs} +106 -206
- package/dist/use-portal-shareables-api-MBl0d0eQ.cjs.map +1 -0
- package/package.json +13 -13
- package/dist/FluidProvider-Bc-3uN7M.cjs.map +0 -1
- package/dist/FluidProvider-Cqf2kmUc.mjs.map +0 -1
- package/dist/ProductsScreen-4WRrJcvw.mjs.map +0 -1
- package/dist/ProductsScreen-BCs3YKVk.cjs.map +0 -1
- package/dist/ProductsScreen-BR9TN4So.cjs +0 -48
- package/dist/ProductsScreen-Da6eWJ_c.mjs +0 -46
- package/dist/ShareablesScreen-DW0wCYOj.mjs +0 -46
- package/dist/ShareablesScreen-DbPJOtCF.cjs +0 -48
- package/dist/ShareablesScreen-ySSwCVSI.cjs.map +0 -1
- package/dist/SubscriptionsScreen-CiNR7JUC.mjs.map +0 -1
- package/dist/SubscriptionsScreen-RScBCcY0.cjs.map +0 -1
- package/dist/use-portal-products-client-BmlUixy4.cjs.map +0 -1
- package/dist/use-portal-products-client-DQK9nFxT.mjs.map +0 -1
- package/dist/use-portal-shareables-api-D5D6uIJy.cjs.map +0 -1
- package/dist/use-portal-shareables-api-KVPj0Jfr.mjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,87 +3,206 @@ import { QueryClient, UseQueryResult } from "@tanstack/react-query";
|
|
|
3
3
|
import Color from "colorjs.io";
|
|
4
4
|
import { LucideIcon } from "lucide-react";
|
|
5
5
|
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region ../../platform/api-client-core/src/fetch-client.d.ts
|
|
7
|
+
interface RequestOptions$1 {
|
|
8
|
+
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
params?: Record<string, unknown>;
|
|
11
|
+
body?: unknown;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
}
|
|
14
|
+
interface FetchClientInstance {
|
|
15
|
+
request: <TResponse = unknown>(endpoint: string, options?: RequestOptions$1) => Promise<TResponse>;
|
|
16
|
+
requestWithFormData: <TResponse = unknown>(endpoint: string, formData: FormData, options?: Omit<RequestOptions$1, "body" | "params"> & {
|
|
17
|
+
method?: "POST" | "PUT" | "PATCH";
|
|
18
|
+
}) => Promise<TResponse>;
|
|
19
|
+
get: <TResponse = unknown>(endpoint: string, params?: Record<string, unknown>, options?: Omit<RequestOptions$1, "method" | "params">) => Promise<TResponse>;
|
|
20
|
+
post: <TResponse = unknown>(endpoint: string, body?: unknown, options?: Omit<RequestOptions$1, "method" | "body">) => Promise<TResponse>;
|
|
21
|
+
put: <TResponse = unknown>(endpoint: string, body?: unknown, options?: Omit<RequestOptions$1, "method" | "body">) => Promise<TResponse>;
|
|
22
|
+
patch: <TResponse = unknown>(endpoint: string, body?: unknown, options?: Omit<RequestOptions$1, "method" | "body">) => Promise<TResponse>;
|
|
23
|
+
delete: <TResponse = unknown>(endpoint: string, options?: Omit<RequestOptions$1, "method">) => Promise<TResponse>;
|
|
24
|
+
}
|
|
25
|
+
type FetchClient = FetchClientInstance;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/client/types.d.ts
|
|
7
28
|
/**
|
|
8
|
-
*
|
|
29
|
+
* HTTP methods supported by the API client.
|
|
30
|
+
* Use `as const` for literal type inference and type safety.
|
|
9
31
|
*/
|
|
10
|
-
|
|
11
|
-
readonly
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
32
|
+
declare const HTTP_METHODS: {
|
|
33
|
+
readonly GET: "GET";
|
|
34
|
+
readonly POST: "POST";
|
|
35
|
+
readonly PUT: "PUT";
|
|
36
|
+
readonly PATCH: "PATCH";
|
|
37
|
+
readonly DELETE: "DELETE";
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Union type of all supported HTTP methods.
|
|
41
|
+
* Derived from HTTP_METHODS constant to avoid duplication.
|
|
42
|
+
*/
|
|
43
|
+
type HttpMethod = (typeof HTTP_METHODS)[keyof typeof HTTP_METHODS];
|
|
44
|
+
/**
|
|
45
|
+
* Configuration for the Fluid SDK client.
|
|
46
|
+
* Use Readonly<FluidSDKConfig> when the config should not be modified after creation.
|
|
47
|
+
*/
|
|
48
|
+
interface FluidSDKConfig {
|
|
49
|
+
/**
|
|
50
|
+
* Base URL for the Fluid API domain (e.g., "https://api.fluid.app").
|
|
51
|
+
* Endpoints include their full path from root (e.g., "/api/reps/me").
|
|
52
|
+
*/
|
|
53
|
+
readonly baseUrl: string;
|
|
54
|
+
/**
|
|
55
|
+
* Optional token getter for contexts where session cookies are unavailable
|
|
56
|
+
* (e.g., the cross-origin builder preview iframe). Not used in normal
|
|
57
|
+
* portal operation — auth is handled by session cookies via `credentials: 'include'`.
|
|
58
|
+
*/
|
|
59
|
+
readonly getAuthToken?: () => string | null | Promise<string | null>;
|
|
60
|
+
/**
|
|
61
|
+
* Callback invoked when a 401 authentication error occurs
|
|
62
|
+
* Use this to trigger re-authentication flows
|
|
63
|
+
*/
|
|
64
|
+
readonly onAuthError?: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* Default headers to include in all requests
|
|
67
|
+
* Example: { "x-fluid-client": "portal" }
|
|
68
|
+
*/
|
|
69
|
+
readonly defaultHeaders?: Readonly<Record<string, string>>;
|
|
70
|
+
/**
|
|
71
|
+
* Filestack API key for messaging file uploads.
|
|
72
|
+
* If not provided, file attachments will be disabled in the messaging composer.
|
|
73
|
+
*/
|
|
74
|
+
readonly filestackApiKey?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Override WebSocket URL for real-time messaging.
|
|
77
|
+
* Default: derived from baseUrl by replacing trailing /api with /cable
|
|
78
|
+
*/
|
|
79
|
+
readonly websocketUrl?: string;
|
|
80
|
+
/**
|
|
81
|
+
* ISO country code for the store/merchant (e.g., "US", "CA", "GB").
|
|
82
|
+
* Used to fetch country-specific payment methods.
|
|
83
|
+
* @default "US"
|
|
84
|
+
*/
|
|
85
|
+
readonly countryIso?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Options for individual API requests.
|
|
89
|
+
* Uses HttpMethod type for method to ensure type safety.
|
|
90
|
+
*/
|
|
91
|
+
interface RequestOptions {
|
|
92
|
+
readonly method?: HttpMethod;
|
|
93
|
+
readonly body?: unknown;
|
|
94
|
+
readonly params?: Readonly<Record<string, unknown>>;
|
|
95
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
96
|
+
readonly signal?: AbortSignal;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Cursor-based pagination parameters for list endpoints.
|
|
100
|
+
* Sent as query params `page[cursor]` and `page[limit]`.
|
|
101
|
+
*/
|
|
102
|
+
interface PaginationParams {
|
|
103
|
+
readonly page?: {
|
|
104
|
+
readonly cursor?: string;
|
|
105
|
+
readonly limit?: number;
|
|
106
|
+
};
|
|
20
107
|
}
|
|
21
108
|
/**
|
|
22
|
-
*
|
|
109
|
+
* Sort order constant - single source of truth for sort direction values.
|
|
110
|
+
* Use SORT_ORDERS.asc instead of "asc" for type-safe comparisons.
|
|
111
|
+
*/
|
|
112
|
+
declare const SORT_ORDERS: {
|
|
113
|
+
readonly asc: "asc";
|
|
114
|
+
readonly desc: "desc";
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Union type of sort order values, derived from SORT_ORDERS constant.
|
|
118
|
+
* @see deriving-typeof-for-object-keys pattern
|
|
119
|
+
*/
|
|
120
|
+
type SortOrder = (typeof SORT_ORDERS)[keyof typeof SORT_ORDERS];
|
|
121
|
+
/**
|
|
122
|
+
* Common filter parameters for list endpoints
|
|
23
123
|
*/
|
|
24
|
-
interface
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
phone?: string;
|
|
124
|
+
interface BaseListParams extends PaginationParams {
|
|
125
|
+
readonly sort_by?: string;
|
|
126
|
+
readonly sort_order?: SortOrder;
|
|
127
|
+
readonly search?: string;
|
|
29
128
|
}
|
|
30
129
|
//#endregion
|
|
31
|
-
//#region src/
|
|
130
|
+
//#region src/client/fluid-client.d.ts
|
|
32
131
|
/**
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
132
|
+
* API Error class for structured error handling
|
|
133
|
+
*/
|
|
134
|
+
declare class ApiError extends Error {
|
|
135
|
+
readonly status: number;
|
|
136
|
+
readonly data: unknown;
|
|
137
|
+
constructor(message: string, status: number, data?: unknown);
|
|
138
|
+
toJSON(): {
|
|
139
|
+
name: string;
|
|
140
|
+
message: string;
|
|
141
|
+
status: number;
|
|
142
|
+
data: unknown;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Type guard for ApiError
|
|
147
|
+
*/
|
|
148
|
+
declare function isApiError(error: unknown): error is ApiError;
|
|
149
|
+
/**
|
|
150
|
+
* Discriminated union representing the result of an API call.
|
|
151
|
+
* Use `isApiSuccess` and `isApiFailure` type guards to narrow.
|
|
40
152
|
*/
|
|
41
|
-
|
|
42
|
-
readonly
|
|
43
|
-
readonly
|
|
44
|
-
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
47
|
-
readonly add: "add";
|
|
48
|
-
readonly manage: "manage";
|
|
49
|
-
readonly send: "send";
|
|
153
|
+
type ApiResult<T> = {
|
|
154
|
+
readonly success: true;
|
|
155
|
+
readonly data: T;
|
|
156
|
+
} | {
|
|
157
|
+
readonly success: false;
|
|
158
|
+
readonly error: ApiError;
|
|
50
159
|
};
|
|
51
160
|
/**
|
|
52
|
-
*
|
|
53
|
-
* Derived from PERMISSION_ACTIONS constant to avoid duplication.
|
|
161
|
+
* Metadata included in every API envelope response.
|
|
54
162
|
*/
|
|
55
|
-
|
|
163
|
+
interface EnvelopeMeta {
|
|
164
|
+
readonly request_id: string | null;
|
|
165
|
+
readonly timestamp: string;
|
|
166
|
+
readonly pagination?: CursorPagination;
|
|
167
|
+
}
|
|
56
168
|
/**
|
|
57
|
-
*
|
|
58
|
-
* Known actions have explicit properties; index signature allows custom actions.
|
|
169
|
+
* Cursor-based pagination metadata returned in the envelope `meta`.
|
|
59
170
|
*/
|
|
60
|
-
interface
|
|
61
|
-
readonly
|
|
62
|
-
readonly
|
|
63
|
-
readonly
|
|
64
|
-
readonly
|
|
65
|
-
readonly settings?: boolean;
|
|
66
|
-
readonly add?: boolean;
|
|
67
|
-
readonly manage?: boolean;
|
|
68
|
-
readonly send?: boolean;
|
|
69
|
-
/** Allow custom action keys beyond the standard set */
|
|
70
|
-
readonly [key: string]: boolean | undefined;
|
|
171
|
+
interface CursorPagination {
|
|
172
|
+
readonly cursor: string | null;
|
|
173
|
+
readonly limit: number;
|
|
174
|
+
readonly next_cursor: string | null;
|
|
175
|
+
readonly prev_cursor: string | null;
|
|
71
176
|
}
|
|
72
177
|
/**
|
|
73
|
-
*
|
|
178
|
+
* Result type for paginated list endpoints.
|
|
179
|
+
* Includes both the unwrapped data and cursor-based pagination metadata.
|
|
74
180
|
*/
|
|
75
|
-
|
|
181
|
+
interface PaginatedResult<T> {
|
|
182
|
+
readonly data: T;
|
|
183
|
+
readonly pagination: CursorPagination | undefined;
|
|
184
|
+
}
|
|
76
185
|
/**
|
|
77
|
-
*
|
|
186
|
+
* The shape returned by `createFluidClient`.
|
|
187
|
+
* Generic helper methods preserve their type parameters so callers
|
|
188
|
+
* can specify response types at each call site.
|
|
78
189
|
*/
|
|
79
|
-
interface
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
190
|
+
interface FluidClientReturn {
|
|
191
|
+
readonly fetchClient: FetchClient;
|
|
192
|
+
readonly request: <TResponse = unknown>(endpoint: string, options?: RequestOptions) => Promise<TResponse>;
|
|
193
|
+
readonly requestNullable: <TResponse>(endpoint: string, options?: RequestOptions) => Promise<TResponse | null>;
|
|
194
|
+
readonly safeRequest: <TResponse>(endpoint: string, options?: RequestOptions) => Promise<ApiResult<TResponse>>;
|
|
195
|
+
readonly get: <TResponse = unknown, TParams extends object = Record<string, unknown>>(endpoint: string, params?: TParams, options?: Omit<RequestOptions, "method" | "params">) => Promise<TResponse>;
|
|
196
|
+
readonly post: <TResponse = unknown>(endpoint: string, body?: unknown, options?: Omit<RequestOptions, "method" | "body">) => Promise<TResponse>;
|
|
197
|
+
readonly put: <TResponse = unknown>(endpoint: string, body?: unknown, options?: Omit<RequestOptions, "method" | "body">) => Promise<TResponse>;
|
|
198
|
+
readonly patch: <TResponse = unknown>(endpoint: string, body?: unknown, options?: Omit<RequestOptions, "method" | "body">) => Promise<TResponse>;
|
|
199
|
+
readonly delete: <TResponse = unknown>(endpoint: string, options?: Omit<RequestOptions, "method">) => Promise<TResponse>;
|
|
86
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Creates a configured Fluid API client instance
|
|
203
|
+
*/
|
|
204
|
+
declare function createFluidClient(config: FluidSDKConfig): FluidClientReturn;
|
|
205
|
+
type FluidClient = ReturnType<typeof createFluidClient>;
|
|
87
206
|
//#endregion
|
|
88
207
|
//#region ../core/src/data-sources/types.d.ts
|
|
89
208
|
type StaticSourceType = "collections" | "categories" | "tags";
|
|
@@ -652,516 +771,50 @@ declare const sectionLayoutConfig: typeof SECTION_LAYOUT_CONFIG;
|
|
|
652
771
|
//#region ../core/src/types/index.d.ts
|
|
653
772
|
type StrictOmit<T, K extends keyof T> = Omit<T, K>;
|
|
654
773
|
//#endregion
|
|
655
|
-
//#region
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
774
|
+
//#region src/providers/FluidProvider.d.ts
|
|
775
|
+
/**
|
|
776
|
+
* Context value for FluidProvider.
|
|
777
|
+
* All properties are readonly since context values should not be mutated by consumers.
|
|
778
|
+
*/
|
|
779
|
+
interface FluidContextValue {
|
|
780
|
+
/** Configured API client instance */
|
|
781
|
+
readonly client: FluidClient;
|
|
782
|
+
/** SDK configuration */
|
|
783
|
+
readonly config: FluidSDKConfig;
|
|
662
784
|
}
|
|
663
|
-
interface
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
785
|
+
interface FluidProviderProps {
|
|
786
|
+
/** SDK configuration (baseUrl, auth, etc.) */
|
|
787
|
+
config: FluidSDKConfig;
|
|
788
|
+
/** React children */
|
|
789
|
+
children: ReactNode;
|
|
790
|
+
/** Optional custom QueryClient instance */
|
|
791
|
+
queryClient?: QueryClient;
|
|
792
|
+
/** Optional initial theme */
|
|
793
|
+
initialTheme?: ThemeDefinition;
|
|
794
|
+
/** Optional container for scoped theme application */
|
|
795
|
+
themeContainer?: HTMLElement | null;
|
|
796
|
+
/** Optional custom widget registry (defaults to all built-in widgets) */
|
|
797
|
+
widgetRegistry?: Record<string, React.ComponentType<any>>;
|
|
798
|
+
/** Dynamic variables for data source endpoint path substitution (e.g., { rep_id: "123" }) */
|
|
799
|
+
variables?: Record<string, string>;
|
|
673
800
|
}
|
|
674
|
-
type FetchClient = FetchClientInstance;
|
|
675
|
-
//#endregion
|
|
676
|
-
//#region src/client/types.d.ts
|
|
677
801
|
/**
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
*
|
|
690
|
-
*
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
* Configuration for the Fluid SDK client.
|
|
695
|
-
* Use Readonly<FluidSDKConfig> when the config should not be modified after creation.
|
|
696
|
-
*/
|
|
697
|
-
interface FluidSDKConfig {
|
|
698
|
-
/**
|
|
699
|
-
* Base URL for the Fluid API domain (e.g., "https://api.fluid.app").
|
|
700
|
-
* Endpoints include their full path from root (e.g., "/api/reps/me").
|
|
701
|
-
*/
|
|
702
|
-
readonly baseUrl: string;
|
|
703
|
-
/**
|
|
704
|
-
* Optional token getter for contexts where session cookies are unavailable
|
|
705
|
-
* (e.g., the cross-origin builder preview iframe). Not used in normal
|
|
706
|
-
* portal operation — auth is handled by session cookies via `credentials: 'include'`.
|
|
707
|
-
*/
|
|
708
|
-
readonly getAuthToken?: () => string | null | Promise<string | null>;
|
|
709
|
-
/**
|
|
710
|
-
* Callback invoked when a 401 authentication error occurs
|
|
711
|
-
* Use this to trigger re-authentication flows
|
|
712
|
-
*/
|
|
713
|
-
readonly onAuthError?: () => void;
|
|
714
|
-
/**
|
|
715
|
-
* Default headers to include in all requests
|
|
716
|
-
* Example: { "x-fluid-client": "portal" }
|
|
717
|
-
*/
|
|
718
|
-
readonly defaultHeaders?: Readonly<Record<string, string>>;
|
|
719
|
-
/**
|
|
720
|
-
* Filestack API key for messaging file uploads.
|
|
721
|
-
* If not provided, file attachments will be disabled in the messaging composer.
|
|
722
|
-
*/
|
|
723
|
-
readonly filestackApiKey?: string;
|
|
724
|
-
/**
|
|
725
|
-
* Override WebSocket URL for real-time messaging.
|
|
726
|
-
* Default: derived from baseUrl by replacing trailing /api with /cable
|
|
727
|
-
*/
|
|
728
|
-
readonly websocketUrl?: string;
|
|
729
|
-
/**
|
|
730
|
-
* ISO country code for the store/merchant (e.g., "US", "CA", "GB").
|
|
731
|
-
* Used to fetch country-specific payment methods.
|
|
732
|
-
* @default "US"
|
|
733
|
-
*/
|
|
734
|
-
readonly countryIso?: string;
|
|
735
|
-
}
|
|
736
|
-
/**
|
|
737
|
-
* Options for individual API requests.
|
|
738
|
-
* Uses HttpMethod type for method to ensure type safety.
|
|
739
|
-
*/
|
|
740
|
-
interface RequestOptions {
|
|
741
|
-
readonly method?: HttpMethod;
|
|
742
|
-
readonly body?: unknown;
|
|
743
|
-
readonly params?: Readonly<Record<string, unknown>>;
|
|
744
|
-
readonly headers?: Readonly<Record<string, string>>;
|
|
745
|
-
readonly signal?: AbortSignal;
|
|
746
|
-
}
|
|
747
|
-
/**
|
|
748
|
-
* Cursor-based pagination parameters for list endpoints.
|
|
749
|
-
* Sent as query params `page[cursor]` and `page[limit]`.
|
|
750
|
-
*/
|
|
751
|
-
interface PaginationParams {
|
|
752
|
-
readonly page?: {
|
|
753
|
-
readonly cursor?: string;
|
|
754
|
-
readonly limit?: number;
|
|
755
|
-
};
|
|
756
|
-
}
|
|
757
|
-
/**
|
|
758
|
-
* Sort order constant - single source of truth for sort direction values.
|
|
759
|
-
* Use SORT_ORDERS.asc instead of "asc" for type-safe comparisons.
|
|
760
|
-
*/
|
|
761
|
-
declare const SORT_ORDERS: {
|
|
762
|
-
readonly asc: "asc";
|
|
763
|
-
readonly desc: "desc";
|
|
764
|
-
};
|
|
765
|
-
/**
|
|
766
|
-
* Union type of sort order values, derived from SORT_ORDERS constant.
|
|
767
|
-
* @see deriving-typeof-for-object-keys pattern
|
|
768
|
-
*/
|
|
769
|
-
type SortOrder = (typeof SORT_ORDERS)[keyof typeof SORT_ORDERS];
|
|
770
|
-
/**
|
|
771
|
-
* Common filter parameters for list endpoints
|
|
772
|
-
*/
|
|
773
|
-
interface BaseListParams extends PaginationParams {
|
|
774
|
-
readonly sort_by?: string;
|
|
775
|
-
readonly sort_order?: SortOrder;
|
|
776
|
-
readonly search?: string;
|
|
777
|
-
}
|
|
778
|
-
//#endregion
|
|
779
|
-
//#region ../core/src/theme/color-engine.d.ts
|
|
780
|
-
/**
|
|
781
|
-
* Attempt to convert any string into a Color using colorjs.io.
|
|
782
|
-
* If the string is exactly 6 characters it is assumed to be a bare hex value
|
|
783
|
-
* (e.g. "3b82f6") and a "#" prefix is added before parsing.
|
|
784
|
-
*
|
|
785
|
-
* @returns the parsed Color, or a neutral gray (`oklch(0.5 0 0)`) on failure
|
|
786
|
-
*/
|
|
787
|
-
declare function parseColor(value: string): Color;
|
|
788
|
-
/**
|
|
789
|
-
* Returns either the original foreground or a corrected lightness variant,
|
|
790
|
-
* whichever provides better contrast against `color`.
|
|
791
|
-
* Inversion triggers when the APCA contrast is below 50.
|
|
792
|
-
*/
|
|
793
|
-
declare function getForegroundColor(foreground: Color, color: Color): Color;
|
|
794
|
-
/**
|
|
795
|
-
* Generate a 100–900 shade ramp from a base color.
|
|
796
|
-
* Base anchors at 500. Light shades (100–400) step toward white,
|
|
797
|
-
* dark shades (600–900) step toward black. Dark steps use an asymmetric
|
|
798
|
-
* multiplier (1.6×, 1.875×, 3×, 4× of `darkStep`) for a more gradual
|
|
799
|
-
* initial descent. Chroma is nudged per step for perceptually natural ramps.
|
|
800
|
-
*/
|
|
801
|
-
declare function generateShades(base: Color): Record<ShadeStep, Color>;
|
|
802
|
-
/**
|
|
803
|
-
* Derive a dark-mode ThemeColorInput from its light-mode counterpart.
|
|
804
|
-
*/
|
|
805
|
-
declare function deriveDarkVariant(name: SemanticColorName, light: ThemeColorInput): ThemeColorInput;
|
|
806
|
-
/**
|
|
807
|
-
* Merge auto-derived dark colors with any user-specified overrides.
|
|
808
|
-
* For each semantic color, if the user has fully overridden both base and
|
|
809
|
-
* foreground those are used; otherwise the missing channels are derived.
|
|
810
|
-
*/
|
|
811
|
-
declare function mergeDarkOverrides(def: ThemeDefinition): Record<SemanticColorName, ThemeColorInput>;
|
|
812
|
-
/**
|
|
813
|
-
* Resolve a ThemeDefinition into a complete ResolvedTheme.
|
|
814
|
-
* Dark mode colors are derived from light where not overridden.
|
|
815
|
-
*/
|
|
816
|
-
declare function resolveTheme(def: ThemeDefinition): ResolvedTheme;
|
|
817
|
-
//#endregion
|
|
818
|
-
//#region ../core/src/theme/css-generator.d.ts
|
|
819
|
-
interface GenerateThemeCSSOptions {
|
|
820
|
-
/** Whether or not to allow prefers-color-scheme to choose the theme mode */
|
|
821
|
-
disableAutoTheme?: boolean;
|
|
822
|
-
/** Whether to emit Tailwind built-in color overrides (default true) */
|
|
823
|
-
mapTailwindColors?: boolean;
|
|
824
|
-
}
|
|
825
|
-
/**
|
|
826
|
-
* Generate a complete CSS string for a resolved theme.
|
|
827
|
-
* Outputs 2–3 blocks: light default, dark explicit via `[data-theme-mode="dark"]`,
|
|
828
|
-
* and (unless `disableAutoTheme`) a `prefers-color-scheme: dark` media query block.
|
|
829
|
-
*/
|
|
830
|
-
declare function generateThemeCSS(theme: ResolvedTheme, options?: GenerateThemeCSSOptions): string;
|
|
831
|
-
//#endregion
|
|
832
|
-
//#region ../core/src/theme/serialisation.d.ts
|
|
833
|
-
/**
|
|
834
|
-
* Serialise a ThemeDefinition (with Color objects) to a plain JSON payload
|
|
835
|
-
* suitable for backend storage.
|
|
836
|
-
*/
|
|
837
|
-
declare function serialiseTheme(def: ThemeDefinition): ThemePayload;
|
|
838
|
-
/**
|
|
839
|
-
* Deserialise a backend payload into a ThemeDefinition with Color objects.
|
|
840
|
-
* Accepts `Record<string, unknown>` because API data is untyped at the boundary.
|
|
841
|
-
* Falls back to default colors for any missing light-mode entries.
|
|
842
|
-
*/
|
|
843
|
-
declare function deserialiseTheme(payload: Record<string, unknown>): ThemeDefinition;
|
|
844
|
-
//#endregion
|
|
845
|
-
//#region ../core/src/theme/transforms.d.ts
|
|
846
|
-
/** Shape of a raw theme from the FluidOS API */
|
|
847
|
-
interface RawApiTheme {
|
|
848
|
-
id: number;
|
|
849
|
-
config?: Record<string, unknown> | null;
|
|
850
|
-
active?: boolean | null;
|
|
851
|
-
name?: string | null;
|
|
852
|
-
}
|
|
853
|
-
/**
|
|
854
|
-
* Build a ThemeDefinition from a single API theme object.
|
|
855
|
-
* Handles both new structured format and legacy flat format.
|
|
856
|
-
*/
|
|
857
|
-
declare function buildThemeDefinition(theme: RawApiTheme): ThemeDefinition;
|
|
858
|
-
/**
|
|
859
|
-
* Transform raw API themes to ThemeDefinition[].
|
|
860
|
-
* Catches and logs errors per theme (graceful degradation).
|
|
861
|
-
*/
|
|
862
|
-
declare function transformThemes(themes: RawApiTheme[]): ThemeDefinition[];
|
|
863
|
-
/**
|
|
864
|
-
* Get the active theme ID from a list of raw API themes.
|
|
865
|
-
* Falls back to the first theme if none is marked active.
|
|
866
|
-
*/
|
|
867
|
-
declare function getActiveThemeId(themes: RawApiTheme[]): string | undefined;
|
|
868
|
-
//#endregion
|
|
869
|
-
//#region ../core/src/theme/theme-applicator.d.ts
|
|
870
|
-
/**
|
|
871
|
-
* Inject or update a `<style>` element in `<head>` for the given theme.
|
|
872
|
-
* The element ID is deterministic (`theme-style-{themeId}`) so repeated calls
|
|
873
|
-
* for the same theme are idempotent — the existing element is updated in place.
|
|
874
|
-
* Also loads Google Fonts referenced by the theme's font families.
|
|
875
|
-
* No-op when `document` is unavailable (SSR).
|
|
876
|
-
*/
|
|
877
|
-
declare function applyTheme(theme: ResolvedTheme, options?: GenerateThemeCSSOptions): void;
|
|
878
|
-
/** Remove an injected theme stylesheet and clean up font link ownership. No-op during SSR. */
|
|
879
|
-
declare function removeTheme(themeId: string): void;
|
|
880
|
-
/** Remove all injected theme stylesheets and font links. No-op during SSR. */
|
|
881
|
-
declare function removeAllThemes(): void;
|
|
882
|
-
//#endregion
|
|
883
|
-
//#region ../core/src/theme/defaults.d.ts
|
|
884
|
-
declare const DEFAULT_FONT_SIZES: Record<FontSizeKey, string>;
|
|
885
|
-
declare const DEFAULT_FONT_FAMILIES: Record<FontFamilyKey, string>;
|
|
886
|
-
declare const DEFAULT_SPACING = "0.25rem";
|
|
887
|
-
declare const DEFAULT_RADII: Record<RadiusKey, string>;
|
|
888
|
-
declare const DEFAULT_COLORS: {
|
|
889
|
-
readonly background: "#ffffff";
|
|
890
|
-
readonly foreground: "#1a1a1a";
|
|
891
|
-
readonly primary: "#3b82f6";
|
|
892
|
-
readonly secondary: "#6b7280";
|
|
893
|
-
readonly accent: "#10b981";
|
|
894
|
-
readonly muted: "#f3f4f6";
|
|
895
|
-
readonly destructive: "#ef4444";
|
|
896
|
-
readonly mutedForeground: "#6b7280";
|
|
897
|
-
};
|
|
898
|
-
declare const DEFAULT_THEME_ID = "default";
|
|
899
|
-
declare const DEFAULT_THEME_NAME = "Default Theme";
|
|
900
|
-
/**
|
|
901
|
-
* Build a fresh ThemeDefinition populated with all defaults.
|
|
902
|
-
* Returns a new object each call because Color instances are mutable — do not cache the result.
|
|
903
|
-
*/
|
|
904
|
-
declare function getDefaultThemeDefinition(): ThemeDefinition;
|
|
905
|
-
//#endregion
|
|
906
|
-
//#region src/transforms/screen-transforms.d.ts
|
|
907
|
-
/** Raw screen from the FluidOS API */
|
|
908
|
-
interface RawApiScreen {
|
|
909
|
-
id: number | string;
|
|
910
|
-
definition_id?: number | string;
|
|
911
|
-
name?: string | null;
|
|
912
|
-
slug?: string | null;
|
|
913
|
-
component_tree?: unknown;
|
|
914
|
-
}
|
|
915
|
-
/**
|
|
916
|
-
* Normalize component_tree to always be an array.
|
|
917
|
-
* The API stores component_tree as a hash (object), but the frontend expects an array.
|
|
918
|
-
*/
|
|
919
|
-
declare function normalizeComponentTree(componentTree: unknown): WidgetSchema[];
|
|
920
|
-
/**
|
|
921
|
-
* Convert a raw FluidOS screen to ScreenDefinition.
|
|
922
|
-
* Normalizes component_tree and converts string IDs to numbers.
|
|
923
|
-
*/
|
|
924
|
-
declare function toScreenDefinition(screen: RawApiScreen): ScreenDefinition$1;
|
|
925
|
-
//#endregion
|
|
926
|
-
//#region ../core/src/types/fluidos-api.d.ts
|
|
927
|
-
interface ResponseMeta {
|
|
928
|
-
request_id?: string;
|
|
929
|
-
timestamp?: string;
|
|
930
|
-
}
|
|
931
|
-
/** Raw FluidOS navigation item as returned by the API. */
|
|
932
|
-
interface FluidOsApiNavigationItem {
|
|
933
|
-
id: number;
|
|
934
|
-
icon?: string | null;
|
|
935
|
-
label?: string | null;
|
|
936
|
-
parent_id?: number | null;
|
|
937
|
-
position?: number | null;
|
|
938
|
-
screen_id?: number | null;
|
|
939
|
-
slug?: string | null;
|
|
940
|
-
/** @enum {string} */
|
|
941
|
-
source: "user" | "system" | "code";
|
|
942
|
-
children: FluidOsApiNavigationItem[];
|
|
943
|
-
}
|
|
944
|
-
//#endregion
|
|
945
|
-
//#region src/transforms/navigation-transforms.d.ts
|
|
946
|
-
/** Raw navigation item from the FluidOS API. */
|
|
947
|
-
type RawApiNavigationItem = FluidOsApiNavigationItem;
|
|
948
|
-
/**
|
|
949
|
-
* Convert a raw FluidOS navigation item to NavigationItem.
|
|
950
|
-
* Recursively transforms children and sorts by position.
|
|
951
|
-
*/
|
|
952
|
-
declare function toNavigationItem(item: RawApiNavigationItem): NavigationItem;
|
|
953
|
-
//#endregion
|
|
954
|
-
//#region src/transforms/index.d.ts
|
|
955
|
-
/** Raw manifest shape from the `/fluid_os/definitions/active` API response */
|
|
956
|
-
interface RawManifestResponse {
|
|
957
|
-
manifest: {
|
|
958
|
-
definition_id: number;
|
|
959
|
-
published_version?: number;
|
|
960
|
-
screens?: RawApiScreen[];
|
|
961
|
-
profile?: {
|
|
962
|
-
name?: string;
|
|
963
|
-
definition_id: number;
|
|
964
|
-
themes?: RawApiTheme[];
|
|
965
|
-
navigation?: {
|
|
966
|
-
id: number;
|
|
967
|
-
name?: string;
|
|
968
|
-
definition_id: number;
|
|
969
|
-
navigation_items?: RawApiNavigationItem[];
|
|
970
|
-
};
|
|
971
|
-
mobile_navigation?: {
|
|
972
|
-
id: number;
|
|
973
|
-
name?: string;
|
|
974
|
-
definition_id: number;
|
|
975
|
-
navigation_items?: RawApiNavigationItem[];
|
|
976
|
-
};
|
|
977
|
-
};
|
|
978
|
-
};
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* Convert a raw FluidOS API response to RawManifestResponse.
|
|
982
|
-
*
|
|
983
|
-
* The wire format includes `navigation_items` and full theme objects,
|
|
984
|
-
* but the generated OpenAPI types differ (e.g. `navigation_tree`, `themes: number[]`).
|
|
985
|
-
* This function bridges that gap so callers avoid `as unknown as` casts.
|
|
986
|
-
*/
|
|
987
|
-
declare function toRawManifest<T extends {
|
|
988
|
-
manifest?: object;
|
|
989
|
-
}>(raw: T): RawManifestResponse;
|
|
990
|
-
/**
|
|
991
|
-
* Transform a raw FluidOS manifest API response into RepAppData.
|
|
992
|
-
*
|
|
993
|
-
* This is the top-level transform used by `FluidClient.app.get()`.
|
|
994
|
-
* It handles:
|
|
995
|
-
* - Theme transformation (legacy and new formats)
|
|
996
|
-
* - Screen normalization (component_tree array wrapping)
|
|
997
|
-
* - Navigation item transformation (recursive with position sorting)
|
|
998
|
-
*/
|
|
999
|
-
declare function transformManifestToRepAppData(response: RawManifestResponse): RepAppData;
|
|
1000
|
-
//#endregion
|
|
1001
|
-
//#region src/client/fluid-client.d.ts
|
|
1002
|
-
/**
|
|
1003
|
-
* API Error class for structured error handling
|
|
1004
|
-
*/
|
|
1005
|
-
declare class ApiError extends Error {
|
|
1006
|
-
readonly status: number;
|
|
1007
|
-
readonly data: unknown;
|
|
1008
|
-
constructor(message: string, status: number, data?: unknown);
|
|
1009
|
-
toJSON(): {
|
|
1010
|
-
name: string;
|
|
1011
|
-
message: string;
|
|
1012
|
-
status: number;
|
|
1013
|
-
data: unknown;
|
|
1014
|
-
};
|
|
1015
|
-
}
|
|
1016
|
-
/**
|
|
1017
|
-
* Type guard for ApiError
|
|
1018
|
-
*/
|
|
1019
|
-
declare function isApiError(error: unknown): error is ApiError;
|
|
1020
|
-
/**
|
|
1021
|
-
* Discriminated union representing the result of an API call.
|
|
1022
|
-
* Use `isApiSuccess` and `isApiFailure` type guards to narrow.
|
|
1023
|
-
*/
|
|
1024
|
-
type ApiResult<T> = {
|
|
1025
|
-
readonly success: true;
|
|
1026
|
-
readonly data: T;
|
|
1027
|
-
} | {
|
|
1028
|
-
readonly success: false;
|
|
1029
|
-
readonly error: ApiError;
|
|
1030
|
-
};
|
|
1031
|
-
/**
|
|
1032
|
-
* Metadata included in every API envelope response.
|
|
1033
|
-
*/
|
|
1034
|
-
interface EnvelopeMeta {
|
|
1035
|
-
readonly request_id: string | null;
|
|
1036
|
-
readonly timestamp: string;
|
|
1037
|
-
readonly pagination?: CursorPagination;
|
|
1038
|
-
}
|
|
1039
|
-
/**
|
|
1040
|
-
* Cursor-based pagination metadata returned in the envelope `meta`.
|
|
1041
|
-
*/
|
|
1042
|
-
interface CursorPagination {
|
|
1043
|
-
readonly cursor: string | null;
|
|
1044
|
-
readonly limit: number;
|
|
1045
|
-
readonly next_cursor: string | null;
|
|
1046
|
-
readonly prev_cursor: string | null;
|
|
1047
|
-
}
|
|
1048
|
-
/**
|
|
1049
|
-
* Result type for paginated list endpoints.
|
|
1050
|
-
* Includes both the unwrapped data and cursor-based pagination metadata.
|
|
1051
|
-
*/
|
|
1052
|
-
interface PaginatedResult<T> {
|
|
1053
|
-
readonly data: T;
|
|
1054
|
-
readonly pagination: CursorPagination | undefined;
|
|
1055
|
-
}
|
|
1056
|
-
/** Minimal order shape returned by the analytics dashboard endpoint. */
|
|
1057
|
-
interface DashboardOrder {
|
|
1058
|
-
readonly id: string;
|
|
1059
|
-
readonly order_number: string;
|
|
1060
|
-
readonly status: string;
|
|
1061
|
-
readonly total: number;
|
|
1062
|
-
readonly created_at: string;
|
|
1063
|
-
}
|
|
1064
|
-
interface DashboardData {
|
|
1065
|
-
readonly total_sales: number;
|
|
1066
|
-
readonly total_orders: number;
|
|
1067
|
-
readonly total_customers: number;
|
|
1068
|
-
readonly recent_orders: readonly DashboardOrder[];
|
|
1069
|
-
}
|
|
1070
|
-
interface SalesParams {
|
|
1071
|
-
readonly date_from?: string;
|
|
1072
|
-
readonly date_to?: string;
|
|
1073
|
-
readonly group_by?: "day" | "week" | "month";
|
|
1074
|
-
}
|
|
1075
|
-
interface SalesData {
|
|
1076
|
-
readonly total: number;
|
|
1077
|
-
readonly data: readonly SalesDataPoint[];
|
|
1078
|
-
}
|
|
1079
|
-
interface SalesDataPoint {
|
|
1080
|
-
readonly date: string;
|
|
1081
|
-
readonly amount: number;
|
|
1082
|
-
readonly orders: number;
|
|
1083
|
-
}
|
|
1084
|
-
/**
|
|
1085
|
-
* The shape returned by `createFluidClient`.
|
|
1086
|
-
* Generic helper methods preserve their type parameters so callers
|
|
1087
|
-
* can specify response types at each call site.
|
|
1088
|
-
*/
|
|
1089
|
-
interface FluidClientReturn {
|
|
1090
|
-
readonly fetchClient: FetchClient;
|
|
1091
|
-
readonly request: <TResponse = unknown>(endpoint: string, options?: RequestOptions) => Promise<TResponse>;
|
|
1092
|
-
readonly requestNullable: <TResponse>(endpoint: string, options?: RequestOptions) => Promise<TResponse | null>;
|
|
1093
|
-
readonly safeRequest: <TResponse>(endpoint: string, options?: RequestOptions) => Promise<ApiResult<TResponse>>;
|
|
1094
|
-
readonly get: <TResponse = unknown, TParams extends object = Record<string, unknown>>(endpoint: string, params?: TParams, options?: Omit<RequestOptions, "method" | "params">) => Promise<TResponse>;
|
|
1095
|
-
readonly post: <TResponse = unknown>(endpoint: string, body?: unknown, options?: Omit<RequestOptions, "method" | "body">) => Promise<TResponse>;
|
|
1096
|
-
readonly put: <TResponse = unknown>(endpoint: string, body?: unknown, options?: Omit<RequestOptions, "method" | "body">) => Promise<TResponse>;
|
|
1097
|
-
readonly patch: <TResponse = unknown>(endpoint: string, body?: unknown, options?: Omit<RequestOptions, "method" | "body">) => Promise<TResponse>;
|
|
1098
|
-
readonly delete: <TResponse = unknown>(endpoint: string, options?: Omit<RequestOptions, "method">) => Promise<TResponse>;
|
|
1099
|
-
readonly reps: {
|
|
1100
|
-
readonly current: () => Promise<Rep>;
|
|
1101
|
-
readonly updateProfile: (data: UpdateRepData) => Promise<Rep>;
|
|
1102
|
-
};
|
|
1103
|
-
readonly app: {
|
|
1104
|
-
readonly getRaw: () => Promise<RawManifestResponse>;
|
|
1105
|
-
readonly get: () => Promise<RepAppData>;
|
|
1106
|
-
};
|
|
1107
|
-
readonly permissions: {
|
|
1108
|
-
readonly get: () => Promise<UserPermissions>;
|
|
1109
|
-
};
|
|
1110
|
-
readonly analytics: {
|
|
1111
|
-
readonly dashboard: () => Promise<DashboardData>;
|
|
1112
|
-
readonly sales: (params?: SalesParams) => Promise<SalesData>;
|
|
1113
|
-
};
|
|
1114
|
-
}
|
|
1115
|
-
/**
|
|
1116
|
-
* Creates a configured Fluid API client instance
|
|
1117
|
-
*/
|
|
1118
|
-
declare function createFluidClient(config: FluidSDKConfig): FluidClientReturn;
|
|
1119
|
-
type FluidClient = ReturnType<typeof createFluidClient>;
|
|
1120
|
-
//#endregion
|
|
1121
|
-
//#region src/providers/FluidProvider.d.ts
|
|
1122
|
-
/**
|
|
1123
|
-
* Context value for FluidProvider.
|
|
1124
|
-
* All properties are readonly since context values should not be mutated by consumers.
|
|
1125
|
-
*/
|
|
1126
|
-
interface FluidContextValue {
|
|
1127
|
-
/** Configured API client instance */
|
|
1128
|
-
readonly client: FluidClient;
|
|
1129
|
-
/** SDK configuration */
|
|
1130
|
-
readonly config: FluidSDKConfig;
|
|
1131
|
-
}
|
|
1132
|
-
interface FluidProviderProps {
|
|
1133
|
-
/** SDK configuration (baseUrl, auth, etc.) */
|
|
1134
|
-
config: FluidSDKConfig;
|
|
1135
|
-
/** React children */
|
|
1136
|
-
children: ReactNode;
|
|
1137
|
-
/** Optional custom QueryClient instance */
|
|
1138
|
-
queryClient?: QueryClient;
|
|
1139
|
-
/** Optional initial theme */
|
|
1140
|
-
initialTheme?: ThemeDefinition;
|
|
1141
|
-
/** Optional container for scoped theme application */
|
|
1142
|
-
themeContainer?: HTMLElement | null;
|
|
1143
|
-
/** Optional custom widget registry (defaults to all built-in widgets) */
|
|
1144
|
-
widgetRegistry?: Record<string, React.ComponentType<any>>;
|
|
1145
|
-
/** Dynamic variables for data source endpoint path substitution (e.g., { rep_id: "123" }) */
|
|
1146
|
-
variables?: Record<string, string>;
|
|
1147
|
-
}
|
|
1148
|
-
/**
|
|
1149
|
-
* Main provider for the Fluid Portal SDK
|
|
1150
|
-
*
|
|
1151
|
-
* @example
|
|
1152
|
-
* ```tsx
|
|
1153
|
-
* import { FluidProvider } from "@fluid-app/portal-sdk";
|
|
1154
|
-
*
|
|
1155
|
-
* function App() {
|
|
1156
|
-
* return (
|
|
1157
|
-
* <FluidProvider
|
|
1158
|
-
* config={{ baseUrl: "" }}
|
|
1159
|
-
* >
|
|
1160
|
-
* <YourApp />
|
|
1161
|
-
* </FluidProvider>
|
|
1162
|
-
* );
|
|
1163
|
-
* }
|
|
1164
|
-
* ```
|
|
802
|
+
* Main provider for the Fluid Portal SDK
|
|
803
|
+
*
|
|
804
|
+
* @example
|
|
805
|
+
* ```tsx
|
|
806
|
+
* import { FluidProvider } from "@fluid-app/portal-sdk";
|
|
807
|
+
*
|
|
808
|
+
* function App() {
|
|
809
|
+
* return (
|
|
810
|
+
* <FluidProvider
|
|
811
|
+
* config={{ baseUrl: "" }}
|
|
812
|
+
* >
|
|
813
|
+
* <YourApp />
|
|
814
|
+
* </FluidProvider>
|
|
815
|
+
* );
|
|
816
|
+
* }
|
|
817
|
+
* ```
|
|
1165
818
|
*/
|
|
1166
819
|
declare function FluidProvider({
|
|
1167
820
|
config,
|
|
@@ -1219,6 +872,25 @@ declare function useThemeContext(): ThemeContextValue;
|
|
|
1219
872
|
*/
|
|
1220
873
|
declare function usePortalTenantClient(): FetchClient;
|
|
1221
874
|
//#endregion
|
|
875
|
+
//#region ../core/src/fluidos-api.d.ts
|
|
876
|
+
interface ResponseMeta {
|
|
877
|
+
request_id?: string;
|
|
878
|
+
timestamp?: string;
|
|
879
|
+
}
|
|
880
|
+
/** Raw FluidOS navigation item as returned by the API. */
|
|
881
|
+
interface FluidOsApiNavigationItem {
|
|
882
|
+
id: number;
|
|
883
|
+
icon?: string | null;
|
|
884
|
+
label?: string | null;
|
|
885
|
+
parent_id?: number | null;
|
|
886
|
+
position?: number | null;
|
|
887
|
+
screen_id?: number | null;
|
|
888
|
+
slug?: string | null;
|
|
889
|
+
/** @enum {string} */
|
|
890
|
+
source: "user" | "system" | "code";
|
|
891
|
+
children: FluidOsApiNavigationItem[];
|
|
892
|
+
}
|
|
893
|
+
//#endregion
|
|
1222
894
|
//#region ../core/src/app-definition-types.d.ts
|
|
1223
895
|
interface AppFluidOsDefinition {
|
|
1224
896
|
id: number;
|
|
@@ -2111,26 +1783,6 @@ declare function createPortal(config?: PortalConfig): void;
|
|
|
2111
1783
|
*/
|
|
2112
1784
|
declare function createDefaultFluidConfig(overrides?: Partial<FluidSDKConfig>): FluidSDKConfig;
|
|
2113
1785
|
//#endregion
|
|
2114
|
-
//#region src/hooks/use-fluid-api.d.ts
|
|
2115
|
-
/**
|
|
2116
|
-
* Hook to access the Fluid API client
|
|
2117
|
-
*
|
|
2118
|
-
* @example
|
|
2119
|
-
* ```tsx
|
|
2120
|
-
* function RepProfile() {
|
|
2121
|
-
* const api = useFluidApi();
|
|
2122
|
-
*
|
|
2123
|
-
* const { data: rep } = useQuery({
|
|
2124
|
-
* queryKey: ["rep"],
|
|
2125
|
-
* queryFn: () => api.reps.current(),
|
|
2126
|
-
* });
|
|
2127
|
-
*
|
|
2128
|
-
* return <p>Hello, {rep?.first_name}</p>;
|
|
2129
|
-
* }
|
|
2130
|
-
* ```
|
|
2131
|
-
*/
|
|
2132
|
-
declare function useFluidApi(): FluidClient;
|
|
2133
|
-
//#endregion
|
|
2134
1786
|
//#region src/hooks/use-fluid-profile.d.ts
|
|
2135
1787
|
/**
|
|
2136
1788
|
* Base query key for profile data.
|
|
@@ -2169,6 +1821,209 @@ declare const PROFILE_QUERY_KEY: readonly ["fluid", "profile"];
|
|
|
2169
1821
|
*/
|
|
2170
1822
|
declare function useFluidProfile(): UseQueryResult<Profile>;
|
|
2171
1823
|
//#endregion
|
|
1824
|
+
//#region ../core/src/theme/color-engine.d.ts
|
|
1825
|
+
/**
|
|
1826
|
+
* Attempt to convert any string into a Color using colorjs.io.
|
|
1827
|
+
* If the string is exactly 6 characters it is assumed to be a bare hex value
|
|
1828
|
+
* (e.g. "3b82f6") and a "#" prefix is added before parsing.
|
|
1829
|
+
*
|
|
1830
|
+
* @returns the parsed Color, or a neutral gray (`oklch(0.5 0 0)`) on failure
|
|
1831
|
+
*/
|
|
1832
|
+
declare function parseColor(value: string): Color;
|
|
1833
|
+
/**
|
|
1834
|
+
* Returns either the original foreground or a corrected lightness variant,
|
|
1835
|
+
* whichever provides better contrast against `color`.
|
|
1836
|
+
* Inversion triggers when the APCA contrast is below 50.
|
|
1837
|
+
*/
|
|
1838
|
+
declare function getForegroundColor(foreground: Color, color: Color): Color;
|
|
1839
|
+
/**
|
|
1840
|
+
* Generate a 100–900 shade ramp from a base color.
|
|
1841
|
+
* Base anchors at 500. Light shades (100–400) step toward white,
|
|
1842
|
+
* dark shades (600–900) step toward black. Dark steps use an asymmetric
|
|
1843
|
+
* multiplier (1.6×, 1.875×, 3×, 4× of `darkStep`) for a more gradual
|
|
1844
|
+
* initial descent. Chroma is nudged per step for perceptually natural ramps.
|
|
1845
|
+
*/
|
|
1846
|
+
declare function generateShades(base: Color): Record<ShadeStep, Color>;
|
|
1847
|
+
/**
|
|
1848
|
+
* Derive a dark-mode ThemeColorInput from its light-mode counterpart.
|
|
1849
|
+
*/
|
|
1850
|
+
declare function deriveDarkVariant(name: SemanticColorName, light: ThemeColorInput): ThemeColorInput;
|
|
1851
|
+
/**
|
|
1852
|
+
* Merge auto-derived dark colors with any user-specified overrides.
|
|
1853
|
+
* For each semantic color, if the user has fully overridden both base and
|
|
1854
|
+
* foreground those are used; otherwise the missing channels are derived.
|
|
1855
|
+
*/
|
|
1856
|
+
declare function mergeDarkOverrides(def: ThemeDefinition): Record<SemanticColorName, ThemeColorInput>;
|
|
1857
|
+
/**
|
|
1858
|
+
* Resolve a ThemeDefinition into a complete ResolvedTheme.
|
|
1859
|
+
* Dark mode colors are derived from light where not overridden.
|
|
1860
|
+
*/
|
|
1861
|
+
declare function resolveTheme(def: ThemeDefinition): ResolvedTheme;
|
|
1862
|
+
//#endregion
|
|
1863
|
+
//#region ../core/src/theme/css-generator.d.ts
|
|
1864
|
+
interface GenerateThemeCSSOptions {
|
|
1865
|
+
/** Whether or not to allow prefers-color-scheme to choose the theme mode */
|
|
1866
|
+
disableAutoTheme?: boolean;
|
|
1867
|
+
/** Whether to emit Tailwind built-in color overrides (default true) */
|
|
1868
|
+
mapTailwindColors?: boolean;
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Generate a complete CSS string for a resolved theme.
|
|
1872
|
+
* Outputs 2–3 blocks: light default, dark explicit via `[data-theme-mode="dark"]`,
|
|
1873
|
+
* and (unless `disableAutoTheme`) a `prefers-color-scheme: dark` media query block.
|
|
1874
|
+
*/
|
|
1875
|
+
declare function generateThemeCSS(theme: ResolvedTheme, options?: GenerateThemeCSSOptions): string;
|
|
1876
|
+
//#endregion
|
|
1877
|
+
//#region ../core/src/theme/serialisation.d.ts
|
|
1878
|
+
/**
|
|
1879
|
+
* Serialise a ThemeDefinition (with Color objects) to a plain JSON payload
|
|
1880
|
+
* suitable for backend storage.
|
|
1881
|
+
*/
|
|
1882
|
+
declare function serialiseTheme(def: ThemeDefinition): ThemePayload;
|
|
1883
|
+
/**
|
|
1884
|
+
* Deserialise a backend payload into a ThemeDefinition with Color objects.
|
|
1885
|
+
* Accepts `Record<string, unknown>` because API data is untyped at the boundary.
|
|
1886
|
+
* Falls back to default colors for any missing light-mode entries.
|
|
1887
|
+
*/
|
|
1888
|
+
declare function deserialiseTheme(payload: Record<string, unknown>): ThemeDefinition;
|
|
1889
|
+
//#endregion
|
|
1890
|
+
//#region ../core/src/theme/transforms.d.ts
|
|
1891
|
+
/** Shape of a raw theme from the FluidOS API */
|
|
1892
|
+
interface RawApiTheme {
|
|
1893
|
+
id: number;
|
|
1894
|
+
config?: Record<string, unknown> | null;
|
|
1895
|
+
active?: boolean | null;
|
|
1896
|
+
name?: string | null;
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Build a ThemeDefinition from a single API theme object.
|
|
1900
|
+
* Handles both new structured format and legacy flat format.
|
|
1901
|
+
*/
|
|
1902
|
+
declare function buildThemeDefinition(theme: RawApiTheme): ThemeDefinition;
|
|
1903
|
+
/**
|
|
1904
|
+
* Transform raw API themes to ThemeDefinition[].
|
|
1905
|
+
* Catches and logs errors per theme (graceful degradation).
|
|
1906
|
+
*/
|
|
1907
|
+
declare function transformThemes(themes: RawApiTheme[]): ThemeDefinition[];
|
|
1908
|
+
/**
|
|
1909
|
+
* Get the active theme ID from a list of raw API themes.
|
|
1910
|
+
* Falls back to the first theme if none is marked active.
|
|
1911
|
+
*/
|
|
1912
|
+
declare function getActiveThemeId(themes: RawApiTheme[]): string | undefined;
|
|
1913
|
+
//#endregion
|
|
1914
|
+
//#region ../core/src/theme/theme-applicator.d.ts
|
|
1915
|
+
/**
|
|
1916
|
+
* Inject or update a `<style>` element in `<head>` for the given theme.
|
|
1917
|
+
* The element ID is deterministic (`theme-style-{themeId}`) so repeated calls
|
|
1918
|
+
* for the same theme are idempotent — the existing element is updated in place.
|
|
1919
|
+
* Also loads Google Fonts referenced by the theme's font families.
|
|
1920
|
+
* No-op when `document` is unavailable (SSR).
|
|
1921
|
+
*/
|
|
1922
|
+
declare function applyTheme(theme: ResolvedTheme, options?: GenerateThemeCSSOptions): void;
|
|
1923
|
+
/** Remove an injected theme stylesheet and clean up font link ownership. No-op during SSR. */
|
|
1924
|
+
declare function removeTheme(themeId: string): void;
|
|
1925
|
+
/** Remove all injected theme stylesheets and font links. No-op during SSR. */
|
|
1926
|
+
declare function removeAllThemes(): void;
|
|
1927
|
+
//#endregion
|
|
1928
|
+
//#region ../core/src/theme/defaults.d.ts
|
|
1929
|
+
declare const DEFAULT_FONT_SIZES: Record<FontSizeKey, string>;
|
|
1930
|
+
declare const DEFAULT_FONT_FAMILIES: Record<FontFamilyKey, string>;
|
|
1931
|
+
declare const DEFAULT_SPACING = "0.25rem";
|
|
1932
|
+
declare const DEFAULT_RADII: Record<RadiusKey, string>;
|
|
1933
|
+
declare const DEFAULT_COLORS: {
|
|
1934
|
+
readonly background: "#ffffff";
|
|
1935
|
+
readonly foreground: "#1a1a1a";
|
|
1936
|
+
readonly primary: "#3b82f6";
|
|
1937
|
+
readonly secondary: "#6b7280";
|
|
1938
|
+
readonly accent: "#10b981";
|
|
1939
|
+
readonly muted: "#f3f4f6";
|
|
1940
|
+
readonly destructive: "#ef4444";
|
|
1941
|
+
readonly mutedForeground: "#6b7280";
|
|
1942
|
+
};
|
|
1943
|
+
declare const DEFAULT_THEME_ID = "default";
|
|
1944
|
+
declare const DEFAULT_THEME_NAME = "Default Theme";
|
|
1945
|
+
/**
|
|
1946
|
+
* Build a fresh ThemeDefinition populated with all defaults.
|
|
1947
|
+
* Returns a new object each call because Color instances are mutable — do not cache the result.
|
|
1948
|
+
*/
|
|
1949
|
+
declare function getDefaultThemeDefinition(): ThemeDefinition;
|
|
1950
|
+
//#endregion
|
|
1951
|
+
//#region src/transforms/screen-transforms.d.ts
|
|
1952
|
+
/** Raw screen from the FluidOS API */
|
|
1953
|
+
interface RawApiScreen {
|
|
1954
|
+
id: number | string;
|
|
1955
|
+
definition_id?: number | string;
|
|
1956
|
+
name?: string | null;
|
|
1957
|
+
slug?: string | null;
|
|
1958
|
+
component_tree?: unknown;
|
|
1959
|
+
}
|
|
1960
|
+
/**
|
|
1961
|
+
* Normalize component_tree to always be an array.
|
|
1962
|
+
* The API stores component_tree as a hash (object), but the frontend expects an array.
|
|
1963
|
+
*/
|
|
1964
|
+
declare function normalizeComponentTree(componentTree: unknown): WidgetSchema[];
|
|
1965
|
+
/**
|
|
1966
|
+
* Convert a raw FluidOS screen to ScreenDefinition.
|
|
1967
|
+
* Normalizes component_tree and converts string IDs to numbers.
|
|
1968
|
+
*/
|
|
1969
|
+
declare function toScreenDefinition(screen: RawApiScreen): ScreenDefinition$1;
|
|
1970
|
+
//#endregion
|
|
1971
|
+
//#region src/transforms/navigation-transforms.d.ts
|
|
1972
|
+
/** Raw navigation item from the FluidOS API. */
|
|
1973
|
+
type RawApiNavigationItem = FluidOsApiNavigationItem;
|
|
1974
|
+
/**
|
|
1975
|
+
* Convert a raw FluidOS navigation item to NavigationItem.
|
|
1976
|
+
* Recursively transforms children and sorts by position.
|
|
1977
|
+
*/
|
|
1978
|
+
declare function toNavigationItem(item: RawApiNavigationItem): NavigationItem;
|
|
1979
|
+
//#endregion
|
|
1980
|
+
//#region src/transforms/index.d.ts
|
|
1981
|
+
/** Raw manifest shape from the `/fluid_os/definitions/active` API response */
|
|
1982
|
+
interface RawManifestResponse {
|
|
1983
|
+
manifest: {
|
|
1984
|
+
definition_id: number;
|
|
1985
|
+
published_version?: number;
|
|
1986
|
+
screens?: RawApiScreen[];
|
|
1987
|
+
profile?: {
|
|
1988
|
+
name?: string;
|
|
1989
|
+
definition_id: number;
|
|
1990
|
+
themes?: RawApiTheme[];
|
|
1991
|
+
navigation?: {
|
|
1992
|
+
id: number;
|
|
1993
|
+
name?: string;
|
|
1994
|
+
definition_id: number;
|
|
1995
|
+
navigation_items?: RawApiNavigationItem[];
|
|
1996
|
+
};
|
|
1997
|
+
mobile_navigation?: {
|
|
1998
|
+
id: number;
|
|
1999
|
+
name?: string;
|
|
2000
|
+
definition_id: number;
|
|
2001
|
+
navigation_items?: RawApiNavigationItem[];
|
|
2002
|
+
};
|
|
2003
|
+
};
|
|
2004
|
+
};
|
|
2005
|
+
}
|
|
2006
|
+
/**
|
|
2007
|
+
* Convert a raw FluidOS API response to RawManifestResponse.
|
|
2008
|
+
*
|
|
2009
|
+
* The wire format includes `navigation_items` and full theme objects,
|
|
2010
|
+
* but the generated OpenAPI types differ (e.g. `navigation_tree`, `themes: number[]`).
|
|
2011
|
+
* This function bridges that gap so callers avoid `as unknown as` casts.
|
|
2012
|
+
*/
|
|
2013
|
+
declare function toRawManifest<T extends {
|
|
2014
|
+
manifest?: object;
|
|
2015
|
+
}>(raw: T): RawManifestResponse;
|
|
2016
|
+
/**
|
|
2017
|
+
* Transform a raw FluidOS manifest API response into RepAppData.
|
|
2018
|
+
*
|
|
2019
|
+
* This is the top-level transform used by `useFluidApp` and `useFluidProfile`.
|
|
2020
|
+
* It handles:
|
|
2021
|
+
* - Theme transformation (legacy and new formats)
|
|
2022
|
+
* - Screen normalization (component_tree array wrapping)
|
|
2023
|
+
* - Navigation item transformation (recursive with position sorting)
|
|
2024
|
+
*/
|
|
2025
|
+
declare function transformManifestToRepAppData(response: RawManifestResponse): RepAppData;
|
|
2026
|
+
//#endregion
|
|
2172
2027
|
//#region src/hooks/use-fluid-app.d.ts
|
|
2173
2028
|
/**
|
|
2174
2029
|
* Base query key for full app data (fluidos endpoint).
|
|
@@ -2234,44 +2089,6 @@ declare function useAppDefinition(options?: {
|
|
|
2234
2089
|
enabled?: boolean;
|
|
2235
2090
|
}): UseQueryResult<AppDefinitionResponse>;
|
|
2236
2091
|
//#endregion
|
|
2237
|
-
//#region src/hooks/use-fluid-permissions.d.ts
|
|
2238
|
-
/**
|
|
2239
|
-
* Base query key for permissions data.
|
|
2240
|
-
* Kept for backwards compatibility — the runtime key used by the hook
|
|
2241
|
-
* includes a company prefix via {@link useCompanyScopedQueryKey}.
|
|
2242
|
-
*/
|
|
2243
|
-
declare const PERMISSIONS_QUERY_KEY: readonly ["fluid", "permissions"];
|
|
2244
|
-
/**
|
|
2245
|
-
* Result of useFluidPermissions hook
|
|
2246
|
-
*/
|
|
2247
|
-
interface UseFluidPermissionsResult {
|
|
2248
|
-
/** Raw permissions query result */
|
|
2249
|
-
query: UseQueryResult<UserPermissions>;
|
|
2250
|
-
/** Permissions data (alias for query.data) */
|
|
2251
|
-
permissions: UserPermissions | undefined;
|
|
2252
|
-
/** Check if user has a specific permission */
|
|
2253
|
-
can: (resource: string, action?: PermissionAction) => boolean;
|
|
2254
|
-
/** Check if user is a super admin */
|
|
2255
|
-
isSuperAdmin: boolean;
|
|
2256
|
-
}
|
|
2257
|
-
/**
|
|
2258
|
-
* Hook to fetch and check user permissions
|
|
2259
|
-
*
|
|
2260
|
-
* @example
|
|
2261
|
-
* ```tsx
|
|
2262
|
-
* function TeamSettings() {
|
|
2263
|
-
* const { can, isSuperAdmin } = useFluidPermissions();
|
|
2264
|
-
*
|
|
2265
|
-
* if (!can("team", "manage")) {
|
|
2266
|
-
* return <AccessDenied />;
|
|
2267
|
-
* }
|
|
2268
|
-
*
|
|
2269
|
-
* return <TeamSettingsForm canDelete={can("team", "delete")} />;
|
|
2270
|
-
* }
|
|
2271
|
-
* ```
|
|
2272
|
-
*/
|
|
2273
|
-
declare function useFluidPermissions(): UseFluidPermissionsResult;
|
|
2274
|
-
//#endregion
|
|
2275
2092
|
//#region src/hooks/use-fluid-theme.d.ts
|
|
2276
2093
|
/**
|
|
2277
2094
|
* Result of useFluidTheme hook
|
|
@@ -2320,34 +2137,6 @@ interface UseFluidThemeResult {
|
|
|
2320
2137
|
*/
|
|
2321
2138
|
declare function useFluidTheme(): UseFluidThemeResult;
|
|
2322
2139
|
//#endregion
|
|
2323
|
-
//#region src/hooks/use-current-rep.d.ts
|
|
2324
|
-
/**
|
|
2325
|
-
* Base query key for current rep data.
|
|
2326
|
-
* Kept for backwards compatibility — the runtime key used by the hook
|
|
2327
|
-
* includes a company prefix via {@link useCompanyScopedQueryKey}.
|
|
2328
|
-
*/
|
|
2329
|
-
declare const CURRENT_REP_QUERY_KEY: readonly ["fluid", "currentRep"];
|
|
2330
|
-
/**
|
|
2331
|
-
* Hook to fetch the currently authenticated rep's profile
|
|
2332
|
-
*
|
|
2333
|
-
* @example
|
|
2334
|
-
* ```tsx
|
|
2335
|
-
* function RepHeader() {
|
|
2336
|
-
* const { data: rep, isLoading } = useCurrentRep();
|
|
2337
|
-
*
|
|
2338
|
-
* if (isLoading) return <Skeleton />;
|
|
2339
|
-
*
|
|
2340
|
-
* return (
|
|
2341
|
-
* <div>
|
|
2342
|
-
* <Avatar src={rep?.avatar_url} />
|
|
2343
|
-
* <span>{rep?.first_name} {rep?.last_name}</span>
|
|
2344
|
-
* </div>
|
|
2345
|
-
* );
|
|
2346
|
-
* }
|
|
2347
|
-
* ```
|
|
2348
|
-
*/
|
|
2349
|
-
declare function useCurrentRep(): UseQueryResult<Rep>;
|
|
2350
|
-
//#endregion
|
|
2351
2140
|
//#region src/hooks/query-keys.d.ts
|
|
2352
2141
|
/**
|
|
2353
2142
|
* Create a company-scoped query key by prepending ["company", companyId].
|
|
@@ -4952,5 +4741,5 @@ declare function useThemeMode(): ThemeModeContextValue;
|
|
|
4952
4741
|
/** Maps a ThemeMode to the value for `data-theme-mode`. Returns undefined for "auto". */
|
|
4953
4742
|
declare function getThemeModeAttribute(mode: ThemeMode): string | undefined;
|
|
4954
4743
|
//#endregion
|
|
4955
|
-
export { ACTIVITY_SLUGS, APP_DATA_QUERY_KEY, APP_DEFINITION_QUERY_KEY, type Activity as ActivityItem, type ActivitySlug, AlertWidget, type AlignOptions, ApiError, type AppDefinitionApi, type AppDefinitionResponse, type AppFluidOsDefinition, AppLink, type AppLinkProps, type AppNavigationContextValue, AppNavigationProvider, type AppNavigationProviderProps, AppShell, type AppShellProps, type BackgroundType, type BackgroundValue, type BaseListParams, type BorderRadiusOptions, BuilderScreenView, type BuilderScreenViewProps, BulletListWidget, type ButtonSizeOptions, CORE_PAGE_IDS,
|
|
4744
|
+
export { ACTIVITY_SLUGS, APP_DATA_QUERY_KEY, APP_DEFINITION_QUERY_KEY, type Activity as ActivityItem, type ActivitySlug, AlertWidget, type AlignOptions, ApiError, type AppDefinitionApi, type AppDefinitionResponse, type AppFluidOsDefinition, AppLink, type AppLinkProps, type AppNavigationContextValue, AppNavigationProvider, type AppNavigationProviderProps, AppShell, type AppShellProps, type BackgroundType, type BackgroundValue, type BaseListParams, type BorderRadiusOptions, BuilderScreenView, type BuilderScreenViewProps, BulletListWidget, type ButtonSizeOptions, CORE_PAGE_IDS, type CalendarEvent, CalendarWidget, CardWidget, CarouselWidget, type CatchUp as CatchUpItem, CatchUpWidget, ChartWidget, type ColorOptions, type Contact, type ContactAddress, type ContactStatus, type ContactType, ContactsScreen, ContainerWidget, type Conversation, type ConversationStatus, type CursorPagination, CustomersScreen, DEFAULT_COLORS, DEFAULT_FONT_FAMILIES, DEFAULT_FONT_SIZES, DEFAULT_RADII, DEFAULT_SDK_WIDGET_REGISTRY, DEFAULT_SPACING, DEFAULT_THEME_ID, DEFAULT_THEME_NAME, EmbedWidget, type EnvelopeMeta, FONT_FAMILY_KEYS, FONT_SIZE_KEYS, type FileCategory, type FileUploader, FluidProvider, type FluidProviderProps, type FluidSDKConfig, FluidThemeProvider, type FluidThemeProviderProps, type FontFamilyKey, type FontSizeKey, type FontSizeOptions, type GapOptions, type GenerateThemeCSSOptions, ImageWidget, LayoutWidget, LinkWidget, type ListQueryResult, ListWidget, type ManifestEntry, type Message, type MessageType, type MessagingAuthContext, type MessagingConfig, type MessagingCurrentUser, MessagingScreen, type MySiteData, MySiteScreen, MySiteWidget, type Navigation, type NavigationItem, NestedWidget, type OklchPlain, OrdersScreen, PAGE_CATEGORIES, PROFILE_QUERY_KEY, PROPERTY_FIELD_TYPES, type PaddingOptions, type PageCategory, type PageCategoryId, type PageOverride, type PageReference, PageRouter, type PageRouterProps, type PageTemplate, PageTemplateProvider, PageTemplateRegistry, type PaginatedResult, type PaginationParams, type Participant, PointsWidget, type PortalConfig, type FetchClient as PortalTenantFetchClient, ProductsScreen, type Profile, ProfileScreen, type PropertyFieldSchema, type PropertyFieldType, type QueryResult, type QueryResultNullable, QuickLinksDropdown, type QuickLinksDropdownProps, QuickShareWidget, RADIUS_KEYS, type RadiusKey, type RawApiNavigationItem, type RawApiScreen, type RawApiTheme, type RawManifestResponse, RecentActivityWidget, type RepAppData, type RepAppManifest, type RepAppProfile, type RequestOptions, type ResolvedColorSet, type ResolvedSemanticColor, type ResolvedTheme, SCAFFOLD_MANIFEST, SEMANTIC_COLOR_NAMES, SHADE_STEPS, type ScaffoldFile, type ScreenDefinition, SdkCompanySwitcher, SdkHeader, type SdkHeaderProps, SdkNavigation, type SdkNavigationProps, type SectionLayoutType, type SemanticColorName, SeparatorWidget, type ShadeStep, type ShareableItem, ShareablesScreen, ShopScreen, type SlugMatch, SpacerWidget, SubscriptionsScreen, type TabConfig, TableWidget, TextWidget, type ThemeColorInput, type ThemeColorPlain, type ThemeDefinition, type ThemeMode, ThemeModeProvider, type ThemePayload, ToDoWidget, type Todo as TodoItem, type TypedWidgetSchema, USER_TYPES, type UploadCallbacks, type UploadResult, type UseCompanySwitchOptions, type UseContactResult, type UseContactsParams, type UseContactsResult, type UseConversationMessagesResult, type UseConversationsResult, type UseFluidThemeResult, type UseListResourceHook, type UseLogoutOptions, type UseSingleResourceHook, type UserType, type ValueListQueryResult, VideoWidget, WIDGET_TYPE_NAMES, type WidgetPath, type WidgetPropertySchema, type WidgetRegistry, type WidgetSchema, type WidgetType, type WidgetTypeName, type WithData, alertWidgetPropertySchema, applyTheme, assertDefined, assertNever, buildThemeDefinition, buildWidgetRegistry, bulletListWidgetPropertySchema, calendarWidgetPropertySchema, cardWidgetPropertySchema, carouselWidgetPropertySchema, catchUpWidgetPropertySchema, chartWidgetPropertySchema, collectNavSlugs, contactsScreenPropertySchema, containerWidgetPropertySchema, createCompanyQueryKey, createDefaultFluidConfig, createFluidFileUploader, createPortal, createScreen, createWidgetFromShareable, createWidgetRegistry, customersScreenPropertySchema, deriveDarkVariant, deserialiseTheme, embedWidgetPropertySchema, extractSlugFromPathname, filterRepOnlyNavItems, gapValues, generateShades, generateThemeCSS, getActiveThemeId, getAvailablePageTemplates, getCorePageTemplates, getDefaultThemeDefinition, getForegroundColor, getOptionalPageTemplates, getProperty, getThemeModeAttribute, groupChildrenByColumn, hasData, imageWidgetPropertySchema, isActivitySlug, isApiError, isContactStatus, isErrorResult, isIdle, isLoading, isPropertyFieldType, isSlugInSection, isUserType, isWidgetType, isWidgetTypeName, layoutWidgetPropertySchema, linkWidgetPropertySchema, listWidgetPropertySchema, matchSlugPrefix, mergeDarkOverrides, messagingScreenPropertySchema, mySiteScreenPropertySchema, mySiteWidgetPropertySchema, nestedWidgetPropertySchema, normalizeComponentTree, ordersScreenPropertySchema, parseColor, pointsWidgetPropertySchema, productsScreenPropertySchema, profileScreenPropertySchema, quickShareWidgetPropertySchema, recentActivityWidgetPropertySchema, removeAllThemes, removeTheme, resolveNavigationPages, resolveTheme, screenPropertySchemas, sectionLayoutConfig, selectProperty, separatorWidgetPropertySchema, serialiseTheme, shareablesScreenPropertySchema, shopScreenPropertySchema, spacerWidgetPropertySchema, subscriptionsScreenPropertySchema, tableWidgetPropertySchema, textWidgetPropertySchema, toDoWidgetPropertySchema, toNavigationItem, toRawManifest, toScreenDefinition, transformManifestToRepAppData, transformThemes, useActivities, useAppDefinition, useAppDefinitionApi, useAppNavigation, useCalendarEvents, useCatchUps, useCompanyScopedQueryKey, useCompanySwitch, useContact, useContacts, useConversationMessages, useConversations, useFluidApp, useFluidContext, useFluidProfile, useFluidTheme, useLogout, useMessagingAuth, useMessagingConfig, useMySite, usePageTemplates, usePortalTenantClient, useResolvedPages, useThemeContext, useThemeMode, useTodos, validateNavigationPages, videoWidgetPropertySchema, widgetPropertySchemas };
|
|
4956
4745
|
//# sourceMappingURL=index.d.cts.map
|