@fluid-app/rep-sdk 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ContactsScreen-33AJ5XUB.js +5 -0
- package/dist/{ContactsScreen-BYXF74BO.js.map → ContactsScreen-33AJ5XUB.js.map} +1 -1
- package/dist/ContactsScreen-ATASCZO2.cjs +18 -0
- package/dist/{ContactsScreen-XZOQJVFE.cjs.map → ContactsScreen-ATASCZO2.cjs.map} +1 -1
- package/dist/CustomersScreen-E4HXBKV7.js +5 -0
- package/dist/{CustomersScreen-VS6LGULO.js.map → CustomersScreen-E4HXBKV7.js.map} +1 -1
- package/dist/CustomersScreen-XMPMKSQA.cjs +18 -0
- package/dist/{CustomersScreen-53SXRDDK.cjs.map → CustomersScreen-XMPMKSQA.cjs.map} +1 -1
- package/dist/MessagingScreen-5TEWFUX4.js +4 -0
- package/dist/{MessagingScreen-O42JEJMW.js.map → MessagingScreen-5TEWFUX4.js.map} +1 -1
- package/dist/MessagingScreen-JC7I55NG.cjs +17 -0
- package/dist/{MessagingScreen-UCVLYWZB.cjs.map → MessagingScreen-JC7I55NG.cjs.map} +1 -1
- package/dist/OrdersScreen-IPPZLEYF.js +5 -0
- package/dist/{OrdersScreen-QQJFTTSS.js.map → OrdersScreen-IPPZLEYF.js.map} +1 -1
- package/dist/OrdersScreen-X7FYUROL.cjs +18 -0
- package/dist/{OrdersScreen-WNT2WDLI.cjs.map → OrdersScreen-X7FYUROL.cjs.map} +1 -1
- package/dist/ProductsScreen-4ZIUQNUU.cjs +18 -0
- package/dist/{ProductsScreen-CTIAKS3Z.cjs.map → ProductsScreen-4ZIUQNUU.cjs.map} +1 -1
- package/dist/ProductsScreen-YTSOZW7B.js +5 -0
- package/dist/{ProductsScreen-TRIT2FE3.js.map → ProductsScreen-YTSOZW7B.js.map} +1 -1
- package/dist/chunk-424PT5DM.js +21 -0
- package/dist/chunk-424PT5DM.js.map +1 -0
- package/dist/{chunk-QUVJ3R4T.cjs → chunk-5UBEM3AX.cjs} +4 -4
- package/dist/{chunk-QUVJ3R4T.cjs.map → chunk-5UBEM3AX.cjs.map} +1 -1
- package/dist/chunk-B6S6BEPL.cjs +16 -0
- package/dist/chunk-B6S6BEPL.cjs.map +1 -0
- package/dist/{chunk-WH7WZXT6.js → chunk-CMF2FYTD.js} +3 -3
- package/dist/{chunk-WH7WZXT6.js.map → chunk-CMF2FYTD.js.map} +1 -1
- package/dist/{chunk-MEOOAMH2.cjs → chunk-EOXYOOWS.cjs} +4 -4
- package/dist/{chunk-MEOOAMH2.cjs.map → chunk-EOXYOOWS.cjs.map} +1 -1
- package/dist/{chunk-YII3IXF4.cjs → chunk-FG2CI6HA.cjs} +4 -4
- package/dist/{chunk-YII3IXF4.cjs.map → chunk-FG2CI6HA.cjs.map} +1 -1
- package/dist/chunk-HDQ2JUQT.cjs +24 -0
- package/dist/chunk-HDQ2JUQT.cjs.map +1 -0
- package/dist/{chunk-MBUCXIUN.cjs → chunk-MHPK7YQ2.cjs} +4 -4
- package/dist/{chunk-MBUCXIUN.cjs.map → chunk-MHPK7YQ2.cjs.map} +1 -1
- package/dist/chunk-OE62VIZU.cjs +1955 -0
- package/dist/chunk-OE62VIZU.cjs.map +1 -0
- package/dist/{chunk-2AWTZV3T.js → chunk-QZMWG7EM.js} +3 -3
- package/dist/{chunk-2AWTZV3T.js.map → chunk-QZMWG7EM.js.map} +1 -1
- package/dist/chunk-R4SXB6EV.js +1881 -0
- package/dist/chunk-R4SXB6EV.js.map +1 -0
- package/dist/chunk-RS4OSTES.js +14 -0
- package/dist/chunk-RS4OSTES.js.map +1 -0
- package/dist/{chunk-PZIHCYDD.js → chunk-WFPYEYC7.js} +3 -3
- package/dist/{chunk-PZIHCYDD.js.map → chunk-WFPYEYC7.js.map} +1 -1
- package/dist/{chunk-CXRJSGO6.js → chunk-WMBD65GH.js} +3 -3
- package/dist/{chunk-CXRJSGO6.js.map → chunk-WMBD65GH.js.map} +1 -1
- package/dist/index.cjs +1726 -1194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2603 -0
- package/dist/index.d.ts +2603 -0
- package/dist/index.js +1395 -1021
- package/dist/index.js.map +1 -1
- package/package.json +26 -7
- package/dist/ContactsScreen-BYXF74BO.js +0 -4
- package/dist/ContactsScreen-XZOQJVFE.cjs +0 -17
- package/dist/CustomersScreen-53SXRDDK.cjs +0 -17
- package/dist/CustomersScreen-VS6LGULO.js +0 -4
- package/dist/MessagingScreen-O42JEJMW.js +0 -4
- package/dist/MessagingScreen-UCVLYWZB.cjs +0 -17
- package/dist/OrdersScreen-QQJFTTSS.js +0 -4
- package/dist/OrdersScreen-WNT2WDLI.cjs +0 -17
- package/dist/ProductsScreen-CTIAKS3Z.cjs +0 -17
- package/dist/ProductsScreen-TRIT2FE3.js +0 -4
- package/dist/chunk-DEQ3PBVX.cjs +0 -29
- package/dist/chunk-DEQ3PBVX.cjs.map +0 -1
- package/dist/chunk-JZRNKSKT.cjs +0 -19
- package/dist/chunk-JZRNKSKT.cjs.map +0 -1
- package/dist/chunk-LO2HDG6C.js +0 -26
- package/dist/chunk-LO2HDG6C.js.map +0 -1
- package/dist/chunk-PJWPO4BJ.js +0 -16
- package/dist/chunk-PJWPO4BJ.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
var
|
|
3
|
+
var chunkOE62VIZU_cjs = require('./chunk-OE62VIZU.cjs');
|
|
4
|
+
var chunkEOXYOOWS_cjs = require('./chunk-EOXYOOWS.cjs');
|
|
5
|
+
var chunkFG2CI6HA_cjs = require('./chunk-FG2CI6HA.cjs');
|
|
6
|
+
var chunkMHPK7YQ2_cjs = require('./chunk-MHPK7YQ2.cjs');
|
|
7
|
+
var chunk5UBEM3AX_cjs = require('./chunk-5UBEM3AX.cjs');
|
|
8
|
+
var chunkB6S6BEPL_cjs = require('./chunk-B6S6BEPL.cjs');
|
|
9
|
+
require('./chunk-HDQ2JUQT.cjs');
|
|
10
|
+
var React2 = require('react');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
-
var
|
|
12
|
+
var reactQuery = require('@tanstack/react-query');
|
|
13
13
|
var types = require('@fluid-app/rep-core/types');
|
|
14
|
-
var theme_star = require('@fluid-app/rep-core/theme');
|
|
15
14
|
var widgets = require('@fluid-app/rep-widgets/widgets');
|
|
16
15
|
var widgetUtils = require('@fluid-app/rep-core/widget-utils');
|
|
17
16
|
var registries = require('@fluid-app/rep-core/registries');
|
|
17
|
+
var AppShellLayout = require('@fluid-app/rep-core/shell/AppShellLayout');
|
|
18
|
+
var ThemeModeContext = require('@fluid-app/rep-core/shell/ThemeModeContext');
|
|
19
|
+
var systemNavigationItems = require('@fluid-app/rep-core/navigation/system-navigation-items');
|
|
20
|
+
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
21
|
+
var faEllipsis = require('@fortawesome/pro-regular-svg-icons/faEllipsis');
|
|
22
|
+
var faXmark = require('@fortawesome/pro-regular-svg-icons/faXmark');
|
|
23
|
+
var RepIcon = require('@fluid-app/rep-core/components/RepIcon');
|
|
24
|
+
var sidebar = require('@fluid-app/rep-core/shell/sidebar');
|
|
25
|
+
var theme = require('@fluid-app/rep-core/theme');
|
|
26
|
+
var faBars = require('@fortawesome/pro-regular-svg-icons/faBars');
|
|
27
|
+
var faSun = require('@fortawesome/pro-regular-svg-icons/faSun');
|
|
28
|
+
var faMoon = require('@fortawesome/pro-regular-svg-icons/faMoon');
|
|
29
|
+
var faTableCellsLarge = require('@fortawesome/pro-regular-svg-icons/faTableCellsLarge');
|
|
30
|
+
var DataAwareWidget = require('@fluid-app/rep-core/data-sources/DataAwareWidget');
|
|
31
|
+
var contexts = require('@fluid-app/rep-widgets/contexts');
|
|
18
32
|
|
|
19
33
|
function _interopNamespace(e) {
|
|
20
34
|
if (e && e.__esModule) return e;
|
|
@@ -34,934 +48,7 @@ function _interopNamespace(e) {
|
|
|
34
48
|
return Object.freeze(n);
|
|
35
49
|
}
|
|
36
50
|
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
// src/client/types.ts
|
|
40
|
-
var HTTP_METHODS = {
|
|
41
|
-
GET: "GET",
|
|
42
|
-
POST: "POST",
|
|
43
|
-
PUT: "PUT",
|
|
44
|
-
PATCH: "PATCH",
|
|
45
|
-
DELETE: "DELETE"
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// src/auth/auth-redirect.ts
|
|
49
|
-
var DEFAULT_AUTH_URL = "https://auth.fluid.app";
|
|
50
|
-
var AUTH_REDIRECT_TOKEN_KEY = "jwt";
|
|
51
|
-
var REDIRECT_TIMESTAMP_KEY = "__fluid_auth_redirect_ts";
|
|
52
|
-
var REDIRECT_COOLDOWN_S = 10;
|
|
53
|
-
function isRedirectLoop() {
|
|
54
|
-
try {
|
|
55
|
-
const ts = sessionStorage.getItem(REDIRECT_TIMESTAMP_KEY);
|
|
56
|
-
if (!ts) return false;
|
|
57
|
-
const elapsed = (Date.now() - Number(ts)) / 1e3;
|
|
58
|
-
return elapsed < REDIRECT_COOLDOWN_S;
|
|
59
|
-
} catch {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function markRedirect() {
|
|
64
|
-
try {
|
|
65
|
-
sessionStorage.setItem(REDIRECT_TIMESTAMP_KEY, String(Date.now()));
|
|
66
|
-
} catch {
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function createDefaultAuthRedirect(authUrl) {
|
|
70
|
-
return () => {
|
|
71
|
-
if (isRedirectLoop()) {
|
|
72
|
-
console.warn(
|
|
73
|
-
"[FluidAuth] Auth redirect suppressed \u2014 possible redirect loop. Check that your auth server returns a token accepted by the API."
|
|
74
|
-
);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
markRedirect();
|
|
78
|
-
const base = authUrl ?? DEFAULT_AUTH_URL;
|
|
79
|
-
const currentUrl = encodeURIComponent(window.location.href);
|
|
80
|
-
window.location.href = `${base}/?redirect_url=${currentUrl}`;
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function resolveAuthFailureHandler(onAuthFailure, authUrl) {
|
|
84
|
-
return onAuthFailure ?? createDefaultAuthRedirect(authUrl);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// src/client/fluid-client.ts
|
|
88
|
-
var ApiError = class _ApiError extends Error {
|
|
89
|
-
status;
|
|
90
|
-
data;
|
|
91
|
-
constructor(message, status, data) {
|
|
92
|
-
super(message);
|
|
93
|
-
this.name = "ApiError";
|
|
94
|
-
this.status = status;
|
|
95
|
-
this.data = data;
|
|
96
|
-
const errorWithCapture = Error;
|
|
97
|
-
if (errorWithCapture.captureStackTrace) {
|
|
98
|
-
errorWithCapture.captureStackTrace(this, _ApiError);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
toJSON() {
|
|
102
|
-
return {
|
|
103
|
-
name: this.name,
|
|
104
|
-
message: this.message,
|
|
105
|
-
status: this.status,
|
|
106
|
-
data: this.data
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
function isApiError(error) {
|
|
111
|
-
return error instanceof ApiError;
|
|
112
|
-
}
|
|
113
|
-
function isString(value) {
|
|
114
|
-
return typeof value === "string";
|
|
115
|
-
}
|
|
116
|
-
function extractErrorMessage(data, fallback) {
|
|
117
|
-
if ("message" in data && isString(data.message)) {
|
|
118
|
-
return data.message;
|
|
119
|
-
}
|
|
120
|
-
if ("error_message" in data && isString(data.error_message)) {
|
|
121
|
-
return data.error_message;
|
|
122
|
-
}
|
|
123
|
-
if ("error" in data && isString(data.error)) {
|
|
124
|
-
return data.error;
|
|
125
|
-
}
|
|
126
|
-
return fallback;
|
|
127
|
-
}
|
|
128
|
-
function createFluidClient(config) {
|
|
129
|
-
const { baseUrl, getAuthToken, onAuthError, defaultHeaders = {} } = config;
|
|
130
|
-
const effectiveOnAuthError = onAuthError ?? createDefaultAuthRedirect();
|
|
131
|
-
async function buildHeaders(customHeaders) {
|
|
132
|
-
const headers = {
|
|
133
|
-
"Content-Type": "application/json",
|
|
134
|
-
...defaultHeaders,
|
|
135
|
-
...customHeaders
|
|
136
|
-
};
|
|
137
|
-
if (getAuthToken) {
|
|
138
|
-
const token = await getAuthToken();
|
|
139
|
-
if (token) {
|
|
140
|
-
headers.Authorization = `Bearer ${token}`;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return headers;
|
|
144
|
-
}
|
|
145
|
-
function buildUrl(endpoint, params) {
|
|
146
|
-
const normalizedBase = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
147
|
-
const normalizedEndpoint = endpoint.startsWith("/") ? endpoint : `/${endpoint}`;
|
|
148
|
-
const url = new URL(normalizedBase + normalizedEndpoint);
|
|
149
|
-
if (params) {
|
|
150
|
-
for (const [key, value] of Object.entries(params)) {
|
|
151
|
-
if (value === void 0 || value === null) {
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
if (Array.isArray(value)) {
|
|
155
|
-
for (const item of value) {
|
|
156
|
-
url.searchParams.append(`${key}[]`, String(item));
|
|
157
|
-
}
|
|
158
|
-
} else if (typeof value === "object") {
|
|
159
|
-
for (const [subKey, subValue] of Object.entries(
|
|
160
|
-
value
|
|
161
|
-
)) {
|
|
162
|
-
if (subValue === void 0 || subValue === null) {
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
if (Array.isArray(subValue)) {
|
|
166
|
-
for (const item of subValue) {
|
|
167
|
-
url.searchParams.append(`${key}[${subKey}][]`, String(item));
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
url.searchParams.append(`${key}[${subKey}]`, String(subValue));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
} else {
|
|
174
|
-
url.searchParams.append(key, String(value));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return url.toString();
|
|
179
|
-
}
|
|
180
|
-
const defaultRequestOptions = {
|
|
181
|
-
method: HTTP_METHODS.GET
|
|
182
|
-
};
|
|
183
|
-
async function request(endpoint, options = {}) {
|
|
184
|
-
const {
|
|
185
|
-
method = defaultRequestOptions.method,
|
|
186
|
-
headers: customHeaders,
|
|
187
|
-
params,
|
|
188
|
-
body,
|
|
189
|
-
signal
|
|
190
|
-
} = options;
|
|
191
|
-
const url = buildUrl(
|
|
192
|
-
endpoint,
|
|
193
|
-
method === HTTP_METHODS.GET ? params : void 0
|
|
194
|
-
);
|
|
195
|
-
const headers = await buildHeaders(customHeaders);
|
|
196
|
-
let response;
|
|
197
|
-
try {
|
|
198
|
-
const fetchOptions = {
|
|
199
|
-
method,
|
|
200
|
-
headers
|
|
201
|
-
};
|
|
202
|
-
if (signal !== void 0) {
|
|
203
|
-
fetchOptions.signal = signal;
|
|
204
|
-
}
|
|
205
|
-
if (body && method !== HTTP_METHODS.GET) {
|
|
206
|
-
fetchOptions.body = JSON.stringify(body);
|
|
207
|
-
}
|
|
208
|
-
response = await fetch(url, fetchOptions);
|
|
209
|
-
} catch (networkError) {
|
|
210
|
-
throw new ApiError(
|
|
211
|
-
`Network error: ${networkError instanceof Error ? networkError.message : "Unknown network error"}`,
|
|
212
|
-
0,
|
|
213
|
-
null
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
if (response.status === 401) {
|
|
217
|
-
effectiveOnAuthError();
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
if (!response.ok) {
|
|
221
|
-
try {
|
|
222
|
-
const contentType = response.headers.get("content-type");
|
|
223
|
-
if (contentType?.includes("application/json")) {
|
|
224
|
-
const data = await response.json();
|
|
225
|
-
const errorMessage = extractErrorMessage(
|
|
226
|
-
data,
|
|
227
|
-
`${method} request failed`
|
|
228
|
-
);
|
|
229
|
-
throw new ApiError(
|
|
230
|
-
errorMessage,
|
|
231
|
-
response.status,
|
|
232
|
-
"errors" in data ? data.errors : data
|
|
233
|
-
);
|
|
234
|
-
} else {
|
|
235
|
-
throw new ApiError(
|
|
236
|
-
`${method} request failed with status ${response.status}`,
|
|
237
|
-
response.status,
|
|
238
|
-
null
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
} catch (error) {
|
|
242
|
-
if (isApiError(error)) {
|
|
243
|
-
throw error;
|
|
244
|
-
}
|
|
245
|
-
throw new ApiError(
|
|
246
|
-
`${method} request failed with status ${response.status}`,
|
|
247
|
-
response.status,
|
|
248
|
-
null
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
if (response.status === 204 || response.headers.get("content-length") === "0") {
|
|
253
|
-
return null;
|
|
254
|
-
}
|
|
255
|
-
try {
|
|
256
|
-
const data = await response.json();
|
|
257
|
-
if (data === null || data === void 0) {
|
|
258
|
-
throw new ApiError(
|
|
259
|
-
"Unexpected null/undefined in JSON response",
|
|
260
|
-
response.status,
|
|
261
|
-
null
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
return data;
|
|
265
|
-
} catch (parseError) {
|
|
266
|
-
if (isApiError(parseError)) {
|
|
267
|
-
throw parseError;
|
|
268
|
-
}
|
|
269
|
-
throw new ApiError(
|
|
270
|
-
"Failed to parse response as JSON",
|
|
271
|
-
response.status,
|
|
272
|
-
null
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
async function requestNullable(endpoint, options = {}) {
|
|
277
|
-
return request(endpoint, options);
|
|
278
|
-
}
|
|
279
|
-
async function safeRequest(endpoint, options = {}) {
|
|
280
|
-
try {
|
|
281
|
-
const data = await request(endpoint, options);
|
|
282
|
-
return { success: true, data };
|
|
283
|
-
} catch (error) {
|
|
284
|
-
if (isApiError(error)) {
|
|
285
|
-
return { success: false, error };
|
|
286
|
-
}
|
|
287
|
-
return {
|
|
288
|
-
success: false,
|
|
289
|
-
error: new ApiError(
|
|
290
|
-
error instanceof Error ? error.message : "Unknown error",
|
|
291
|
-
0,
|
|
292
|
-
null
|
|
293
|
-
)
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
function toParams(params) {
|
|
298
|
-
return params;
|
|
299
|
-
}
|
|
300
|
-
const get = (endpoint, params, options) => {
|
|
301
|
-
const baseOptions = {
|
|
302
|
-
...options,
|
|
303
|
-
method: HTTP_METHODS.GET
|
|
304
|
-
};
|
|
305
|
-
const convertedParams = toParams(params);
|
|
306
|
-
const requestOptions = convertedParams !== void 0 ? { ...baseOptions, params: convertedParams } : baseOptions;
|
|
307
|
-
return request(endpoint, requestOptions);
|
|
308
|
-
};
|
|
309
|
-
const post = (endpoint, body, options) => request(endpoint, {
|
|
310
|
-
...options,
|
|
311
|
-
method: HTTP_METHODS.POST,
|
|
312
|
-
body
|
|
313
|
-
});
|
|
314
|
-
const put = (endpoint, body, options) => request(endpoint, {
|
|
315
|
-
...options,
|
|
316
|
-
method: HTTP_METHODS.PUT,
|
|
317
|
-
body
|
|
318
|
-
});
|
|
319
|
-
const patch = (endpoint, body, options) => request(endpoint, {
|
|
320
|
-
...options,
|
|
321
|
-
method: HTTP_METHODS.PATCH,
|
|
322
|
-
body
|
|
323
|
-
});
|
|
324
|
-
const del = (endpoint, options) => request(endpoint, {
|
|
325
|
-
...options,
|
|
326
|
-
method: HTTP_METHODS.DELETE
|
|
327
|
-
});
|
|
328
|
-
return {
|
|
329
|
-
// Low-level methods for custom endpoints
|
|
330
|
-
request,
|
|
331
|
-
requestNullable,
|
|
332
|
-
safeRequest,
|
|
333
|
-
get,
|
|
334
|
-
post,
|
|
335
|
-
put,
|
|
336
|
-
patch,
|
|
337
|
-
delete: del,
|
|
338
|
-
// Products API - matches fluid-admin's /company/v1/products
|
|
339
|
-
products: {
|
|
340
|
-
list: (params) => get(
|
|
341
|
-
"/company/v1/products",
|
|
342
|
-
params
|
|
343
|
-
),
|
|
344
|
-
get: (id) => get(`/company/v1/products/${id}`),
|
|
345
|
-
search: (query, params) => get("/company/v1/products", {
|
|
346
|
-
search_query: query,
|
|
347
|
-
...params
|
|
348
|
-
})
|
|
349
|
-
},
|
|
350
|
-
// Orders API
|
|
351
|
-
orders: {
|
|
352
|
-
list: (params) => get("/orders", params),
|
|
353
|
-
get: (id) => get(`/orders/${id}`),
|
|
354
|
-
create: (data) => post("/orders", data)
|
|
355
|
-
},
|
|
356
|
-
// Reps API
|
|
357
|
-
reps: {
|
|
358
|
-
current: () => get("/reps/me"),
|
|
359
|
-
updateProfile: (data) => patch("/reps/me", data)
|
|
360
|
-
},
|
|
361
|
-
// Profile API (themes, navigation, screens)
|
|
362
|
-
profile: {
|
|
363
|
-
get: () => get("/rep_app/manifest")
|
|
364
|
-
},
|
|
365
|
-
// Permissions API
|
|
366
|
-
permissions: {
|
|
367
|
-
get: () => get("/company/roles/my_permissions")
|
|
368
|
-
},
|
|
369
|
-
// Analytics API
|
|
370
|
-
analytics: {
|
|
371
|
-
dashboard: () => get("/analytics/dashboard"),
|
|
372
|
-
sales: (params) => get("/analytics/sales", params)
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
var ThemeContext = react.createContext(null);
|
|
377
|
-
function applyThemeVariables(theme, container) {
|
|
378
|
-
const target = container ?? document.documentElement;
|
|
379
|
-
const toRemove = [];
|
|
380
|
-
for (let i = 0; i < target.style.length; i++) {
|
|
381
|
-
const prop = target.style[i];
|
|
382
|
-
if (prop.startsWith("--fluid-")) {
|
|
383
|
-
toRemove.push(prop);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
for (const prop of toRemove) {
|
|
387
|
-
target.style.removeProperty(prop);
|
|
388
|
-
}
|
|
389
|
-
for (const [key, value] of Object.entries(theme.config)) {
|
|
390
|
-
target.style.setProperty(`--fluid-${key}`, value);
|
|
391
|
-
}
|
|
392
|
-
if (theme.mode) {
|
|
393
|
-
target.dataset.fluidThemeMode = theme.mode;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
function FluidThemeProvider({
|
|
397
|
-
children,
|
|
398
|
-
initialTheme,
|
|
399
|
-
container
|
|
400
|
-
}) {
|
|
401
|
-
const [currentTheme, setCurrentTheme] = react.useState(
|
|
402
|
-
initialTheme ?? null
|
|
403
|
-
);
|
|
404
|
-
react.useEffect(() => {
|
|
405
|
-
if (currentTheme) {
|
|
406
|
-
applyThemeVariables(currentTheme, container ?? null);
|
|
407
|
-
}
|
|
408
|
-
}, [currentTheme, container]);
|
|
409
|
-
const setTheme = react.useCallback((theme) => {
|
|
410
|
-
setCurrentTheme(theme);
|
|
411
|
-
}, []);
|
|
412
|
-
const setThemeMode = react.useCallback((mode) => {
|
|
413
|
-
setCurrentTheme((prev) => prev ? { ...prev, mode } : null);
|
|
414
|
-
}, []);
|
|
415
|
-
const value = react.useMemo(
|
|
416
|
-
() => ({
|
|
417
|
-
currentTheme,
|
|
418
|
-
setTheme,
|
|
419
|
-
setThemeMode
|
|
420
|
-
}),
|
|
421
|
-
[currentTheme, setTheme, setThemeMode]
|
|
422
|
-
);
|
|
423
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value, children });
|
|
424
|
-
}
|
|
425
|
-
function useThemeContext() {
|
|
426
|
-
const context = react.useContext(ThemeContext);
|
|
427
|
-
if (!context) {
|
|
428
|
-
throw new Error("useThemeContext must be used within a FluidThemeProvider");
|
|
429
|
-
}
|
|
430
|
-
return context;
|
|
431
|
-
}
|
|
432
|
-
var FluidContext = react.createContext(null);
|
|
433
|
-
function FluidProvider({
|
|
434
|
-
config,
|
|
435
|
-
children,
|
|
436
|
-
queryClient,
|
|
437
|
-
initialTheme,
|
|
438
|
-
themeContainer
|
|
439
|
-
}) {
|
|
440
|
-
const defaultQueryClient = react.useMemo(
|
|
441
|
-
() => new reactQuery.QueryClient({
|
|
442
|
-
defaultOptions: {
|
|
443
|
-
queries: {
|
|
444
|
-
staleTime: 1e3 * 60,
|
|
445
|
-
// 1 minute
|
|
446
|
-
retry: 1
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}),
|
|
450
|
-
[]
|
|
451
|
-
);
|
|
452
|
-
const configRef = react.useRef(config);
|
|
453
|
-
configRef.current = config;
|
|
454
|
-
const client = react.useMemo(
|
|
455
|
-
() => createFluidClient({
|
|
456
|
-
...configRef.current,
|
|
457
|
-
getAuthToken: () => configRef.current.getAuthToken?.() ?? null,
|
|
458
|
-
onAuthError: () => configRef.current.onAuthError?.()
|
|
459
|
-
}),
|
|
460
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
461
|
-
[config.baseUrl]
|
|
462
|
-
);
|
|
463
|
-
const contextValue = react.useMemo(
|
|
464
|
-
() => ({ client, config: configRef.current }),
|
|
465
|
-
[client]
|
|
466
|
-
);
|
|
467
|
-
const themeProviderProps = {
|
|
468
|
-
...initialTheme !== void 0 && { initialTheme },
|
|
469
|
-
...themeContainer !== void 0 && { container: themeContainer }
|
|
470
|
-
};
|
|
471
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient ?? defaultQueryClient, children: /* @__PURE__ */ jsxRuntime.jsx(FluidContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(FluidThemeProvider, { ...themeProviderProps, children }) }) });
|
|
472
|
-
}
|
|
473
|
-
function useFluidContext() {
|
|
474
|
-
const context = react.useContext(FluidContext);
|
|
475
|
-
if (!context) {
|
|
476
|
-
throw new Error("useFluidContext must be used within a FluidProvider");
|
|
477
|
-
}
|
|
478
|
-
return context;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
// src/auth/constants.ts
|
|
482
|
-
var AUTH_CONSTANTS = {
|
|
483
|
-
/**
|
|
484
|
-
* Grace period in milliseconds to account for clock skew
|
|
485
|
-
* when checking token expiration. Tokens are considered valid
|
|
486
|
-
* if they expire within this period.
|
|
487
|
-
*/
|
|
488
|
-
TOKEN_GRACE_PERIOD_MS: 30 * 1e3,
|
|
489
|
-
// 30 seconds
|
|
490
|
-
/**
|
|
491
|
-
* Default cookie max age in seconds (9 days).
|
|
492
|
-
* This matches the typical JWT token lifetime from the Fluid API.
|
|
493
|
-
*/
|
|
494
|
-
COOKIE_MAX_AGE: 9 * 24 * 60 * 60
|
|
495
|
-
// 9 days = 777600 seconds
|
|
496
|
-
};
|
|
497
|
-
var STORAGE_KEYS = {
|
|
498
|
-
/** localStorage key for user token */
|
|
499
|
-
USER_TOKEN: "fluidUserToken",
|
|
500
|
-
/** localStorage key for company token (legacy) */
|
|
501
|
-
COMPANY_TOKEN: "fluidCompanyToken",
|
|
502
|
-
/** Cookie name for auth token */
|
|
503
|
-
AUTH_COOKIE: "auth_token"
|
|
504
|
-
};
|
|
505
|
-
var URL_PARAMS = {
|
|
506
|
-
/** URL parameter name for user token */
|
|
507
|
-
USER_TOKEN: "fluidUserToken",
|
|
508
|
-
/** URL parameter name for company token (legacy) */
|
|
509
|
-
COMPANY_TOKEN: "fluidCompanyToken"
|
|
510
|
-
};
|
|
511
|
-
|
|
512
|
-
// src/auth/browser-utils.ts
|
|
513
|
-
function isBrowser() {
|
|
514
|
-
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
// src/auth/url-token.ts
|
|
518
|
-
function extractTokenFromUrl(tokenKey = URL_PARAMS.USER_TOKEN) {
|
|
519
|
-
if (!isBrowser()) {
|
|
520
|
-
return null;
|
|
521
|
-
}
|
|
522
|
-
try {
|
|
523
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
524
|
-
return searchParams.get(tokenKey);
|
|
525
|
-
} catch {
|
|
526
|
-
return null;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
function extractCompanyTokenFromUrl(tokenKey = URL_PARAMS.COMPANY_TOKEN) {
|
|
530
|
-
if (!isBrowser()) {
|
|
531
|
-
return null;
|
|
532
|
-
}
|
|
533
|
-
try {
|
|
534
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
535
|
-
return searchParams.get(tokenKey);
|
|
536
|
-
} catch {
|
|
537
|
-
return null;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
function cleanTokenFromUrl(tokenKey = URL_PARAMS.USER_TOKEN) {
|
|
541
|
-
if (!isBrowser()) {
|
|
542
|
-
return;
|
|
543
|
-
}
|
|
544
|
-
try {
|
|
545
|
-
const url = new URL(window.location.href);
|
|
546
|
-
const hadToken = url.searchParams.has(tokenKey);
|
|
547
|
-
const hadCompanyToken = url.searchParams.has(URL_PARAMS.COMPANY_TOKEN);
|
|
548
|
-
url.searchParams.delete(tokenKey);
|
|
549
|
-
url.searchParams.delete(URL_PARAMS.COMPANY_TOKEN);
|
|
550
|
-
if (hadToken || hadCompanyToken) {
|
|
551
|
-
window.history.replaceState(
|
|
552
|
-
window.history.state,
|
|
553
|
-
document.title,
|
|
554
|
-
url.toString()
|
|
555
|
-
);
|
|
556
|
-
}
|
|
557
|
-
} catch (error) {
|
|
558
|
-
console.warn("[FluidAuth] Failed to clean token from URL:", error);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
function hasTokenInUrl(tokenKey = URL_PARAMS.USER_TOKEN) {
|
|
562
|
-
if (!isBrowser()) {
|
|
563
|
-
return false;
|
|
564
|
-
}
|
|
565
|
-
try {
|
|
566
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
567
|
-
return searchParams.has(tokenKey);
|
|
568
|
-
} catch {
|
|
569
|
-
return false;
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
function extractAllTokensFromUrl(userTokenKey = URL_PARAMS.USER_TOKEN, companyTokenKey = URL_PARAMS.COMPANY_TOKEN) {
|
|
573
|
-
if (!isBrowser()) {
|
|
574
|
-
return { userToken: null, companyToken: null };
|
|
575
|
-
}
|
|
576
|
-
try {
|
|
577
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
578
|
-
return {
|
|
579
|
-
userToken: searchParams.get(userTokenKey),
|
|
580
|
-
companyToken: searchParams.get(companyTokenKey)
|
|
581
|
-
};
|
|
582
|
-
} catch {
|
|
583
|
-
return { userToken: null, companyToken: null };
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
// src/auth/token-storage.ts
|
|
588
|
-
function parseCookies() {
|
|
589
|
-
if (!isBrowser()) {
|
|
590
|
-
return {};
|
|
591
|
-
}
|
|
592
|
-
const cookies = {};
|
|
593
|
-
const cookieString = document.cookie;
|
|
594
|
-
if (!cookieString) {
|
|
595
|
-
return cookies;
|
|
596
|
-
}
|
|
597
|
-
cookieString.split(";").forEach((cookie) => {
|
|
598
|
-
const [name, ...valueParts] = cookie.trim().split("=");
|
|
599
|
-
if (name) {
|
|
600
|
-
cookies[name] = decodeURIComponent(valueParts.join("="));
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
return cookies;
|
|
604
|
-
}
|
|
605
|
-
function setCookie(name, value, options = {}) {
|
|
606
|
-
if (!isBrowser()) {
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
const {
|
|
610
|
-
maxAge = AUTH_CONSTANTS.COOKIE_MAX_AGE,
|
|
611
|
-
path = "/",
|
|
612
|
-
sameSite = "lax",
|
|
613
|
-
secure = window.location.protocol === "https:"
|
|
614
|
-
} = options;
|
|
615
|
-
let cookieString = `${name}=${encodeURIComponent(value)}`;
|
|
616
|
-
cookieString += `; path=${path}`;
|
|
617
|
-
cookieString += `; max-age=${maxAge}`;
|
|
618
|
-
cookieString += `; samesite=${sameSite}`;
|
|
619
|
-
if (secure) {
|
|
620
|
-
cookieString += "; secure";
|
|
621
|
-
}
|
|
622
|
-
document.cookie = cookieString;
|
|
623
|
-
}
|
|
624
|
-
function deleteCookie(name, path = "/") {
|
|
625
|
-
if (!isBrowser()) {
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
|
-
document.cookie = `${name}=; path=${path}; max-age=0`;
|
|
629
|
-
}
|
|
630
|
-
function getStoredToken(config) {
|
|
631
|
-
if (!isBrowser()) {
|
|
632
|
-
return null;
|
|
633
|
-
}
|
|
634
|
-
const cookieKey = config?.cookieKey ?? STORAGE_KEYS.AUTH_COOKIE;
|
|
635
|
-
const localStorageKey = STORAGE_KEYS.USER_TOKEN;
|
|
636
|
-
const cookies = parseCookies();
|
|
637
|
-
const cookieToken = cookies[cookieKey];
|
|
638
|
-
if (cookieToken) {
|
|
639
|
-
return cookieToken;
|
|
640
|
-
}
|
|
641
|
-
try {
|
|
642
|
-
return localStorage.getItem(localStorageKey);
|
|
643
|
-
} catch {
|
|
644
|
-
return null;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
function storeToken(token, config) {
|
|
648
|
-
if (!isBrowser()) {
|
|
649
|
-
return;
|
|
650
|
-
}
|
|
651
|
-
const cookieKey = config?.cookieKey ?? STORAGE_KEYS.AUTH_COOKIE;
|
|
652
|
-
const maxAge = config?.cookieMaxAge ?? AUTH_CONSTANTS.COOKIE_MAX_AGE;
|
|
653
|
-
try {
|
|
654
|
-
setCookie(cookieKey, token, {
|
|
655
|
-
maxAge,
|
|
656
|
-
path: "/",
|
|
657
|
-
// Use 'none' with secure for cross-origin iframe scenarios
|
|
658
|
-
sameSite: window.self !== window.top ? "none" : "lax",
|
|
659
|
-
secure: window.location.protocol === "https:"
|
|
660
|
-
});
|
|
661
|
-
} catch (error) {
|
|
662
|
-
console.warn("[FluidAuth] Failed to store token in cookie:", error);
|
|
663
|
-
}
|
|
664
|
-
try {
|
|
665
|
-
localStorage.setItem(STORAGE_KEYS.USER_TOKEN, token);
|
|
666
|
-
} catch (error) {
|
|
667
|
-
console.warn("[FluidAuth] Failed to store token in localStorage:", error);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
function clearTokens(config) {
|
|
671
|
-
if (!isBrowser()) {
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
const cookieKey = config?.cookieKey ?? STORAGE_KEYS.AUTH_COOKIE;
|
|
675
|
-
try {
|
|
676
|
-
deleteCookie(cookieKey);
|
|
677
|
-
} catch {
|
|
678
|
-
}
|
|
679
|
-
try {
|
|
680
|
-
localStorage.removeItem(STORAGE_KEYS.USER_TOKEN);
|
|
681
|
-
localStorage.removeItem(STORAGE_KEYS.COMPANY_TOKEN);
|
|
682
|
-
} catch {
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
function hasStoredToken(config) {
|
|
686
|
-
return getStoredToken(config) !== null;
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
// src/auth/types.ts
|
|
690
|
-
var USER_TYPES = {
|
|
691
|
-
admin: "admin",
|
|
692
|
-
rep: "rep",
|
|
693
|
-
root_admin: "root_admin",
|
|
694
|
-
customer: "customer"
|
|
695
|
-
};
|
|
696
|
-
function isUserType(value) {
|
|
697
|
-
return Object.values(USER_TYPES).includes(value);
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
// src/auth/token-utils.ts
|
|
701
|
-
function extractPayloadFromJose(decoded) {
|
|
702
|
-
const rawUserType = decoded.user_type;
|
|
703
|
-
const rawOgUserType = decoded.og_user_type;
|
|
704
|
-
return {
|
|
705
|
-
id: typeof decoded.id === "number" ? decoded.id : void 0,
|
|
706
|
-
email: typeof decoded.email === "string" ? decoded.email : void 0,
|
|
707
|
-
full_name: typeof decoded.full_name === "string" ? decoded.full_name : void 0,
|
|
708
|
-
user_type: typeof rawUserType === "string" && isUserType(rawUserType) ? rawUserType : "rep",
|
|
709
|
-
og_user_type: typeof rawOgUserType === "string" && isUserType(rawOgUserType) ? rawOgUserType : void 0,
|
|
710
|
-
company_id: typeof decoded.company_id === "number" ? decoded.company_id : void 0,
|
|
711
|
-
exp: decoded.exp,
|
|
712
|
-
auth_type: typeof decoded.auth_type === "string" ? decoded.auth_type : void 0
|
|
713
|
-
};
|
|
714
|
-
}
|
|
715
|
-
function decodeToken(token) {
|
|
716
|
-
try {
|
|
717
|
-
const decoded = jose.decodeJwt(token);
|
|
718
|
-
return extractPayloadFromJose(decoded);
|
|
719
|
-
} catch (error) {
|
|
720
|
-
console.error("[FluidAuth] Failed to decode JWT token:", error);
|
|
721
|
-
return null;
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
function isTokenExpired(token, gracePeriodMs = AUTH_CONSTANTS.TOKEN_GRACE_PERIOD_MS) {
|
|
725
|
-
try {
|
|
726
|
-
const decoded = jose.decodeJwt(token);
|
|
727
|
-
if (!decoded.exp) {
|
|
728
|
-
return false;
|
|
729
|
-
}
|
|
730
|
-
const expirationTime = decoded.exp * 1e3;
|
|
731
|
-
const currentTime = Date.now();
|
|
732
|
-
return currentTime > expirationTime + gracePeriodMs;
|
|
733
|
-
} catch {
|
|
734
|
-
return true;
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
function validateToken(token, gracePeriodMs = AUTH_CONSTANTS.TOKEN_GRACE_PERIOD_MS) {
|
|
738
|
-
if (!token || token.trim() === "") {
|
|
739
|
-
return {
|
|
740
|
-
isValid: false,
|
|
741
|
-
error: "Token is empty or not provided"
|
|
742
|
-
};
|
|
743
|
-
}
|
|
744
|
-
const payload = decodeToken(token);
|
|
745
|
-
if (!payload) {
|
|
746
|
-
return {
|
|
747
|
-
isValid: false,
|
|
748
|
-
error: "Token has invalid format"
|
|
749
|
-
};
|
|
750
|
-
}
|
|
751
|
-
if (isTokenExpired(token, gracePeriodMs)) {
|
|
752
|
-
return {
|
|
753
|
-
isValid: false,
|
|
754
|
-
payload,
|
|
755
|
-
error: "Token has expired"
|
|
756
|
-
};
|
|
757
|
-
}
|
|
758
|
-
return {
|
|
759
|
-
isValid: true,
|
|
760
|
-
payload
|
|
761
|
-
};
|
|
762
|
-
}
|
|
763
|
-
function isValidToken(result) {
|
|
764
|
-
return result.isValid === true;
|
|
765
|
-
}
|
|
766
|
-
function getTokenExpiration(token) {
|
|
767
|
-
try {
|
|
768
|
-
const decoded = jose.decodeJwt(token);
|
|
769
|
-
if (!decoded.exp) {
|
|
770
|
-
return null;
|
|
771
|
-
}
|
|
772
|
-
return new Date(decoded.exp * 1e3);
|
|
773
|
-
} catch {
|
|
774
|
-
return null;
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
function getTokenTimeRemaining(token) {
|
|
778
|
-
try {
|
|
779
|
-
const decoded = jose.decodeJwt(token);
|
|
780
|
-
if (!decoded.exp) {
|
|
781
|
-
return Infinity;
|
|
782
|
-
}
|
|
783
|
-
const expirationTime = decoded.exp * 1e3;
|
|
784
|
-
const remaining = expirationTime - Date.now();
|
|
785
|
-
return Math.max(0, remaining);
|
|
786
|
-
} catch {
|
|
787
|
-
return 0;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
async function verifyToken(token, jwksUrl) {
|
|
791
|
-
try {
|
|
792
|
-
const JWKS = jose.createRemoteJWKSet(new URL(jwksUrl));
|
|
793
|
-
const { payload } = await jose.jwtVerify(token, JWKS);
|
|
794
|
-
const decoded = payload;
|
|
795
|
-
return extractPayloadFromJose(decoded);
|
|
796
|
-
} catch (error) {
|
|
797
|
-
console.error("[FluidAuth] JWT signature verification failed:", error);
|
|
798
|
-
return null;
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
// src/auth/dev-utils.ts
|
|
803
|
-
function isDevBypassActive(devBypass) {
|
|
804
|
-
if (!devBypass) return false;
|
|
805
|
-
try {
|
|
806
|
-
return undefined.DEV === true;
|
|
807
|
-
} catch {
|
|
808
|
-
return false;
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
function createDevUser() {
|
|
812
|
-
return {
|
|
813
|
-
id: 99999,
|
|
814
|
-
// Dev placeholder — avoids falsy 0
|
|
815
|
-
email: "dev@localhost",
|
|
816
|
-
full_name: "Dev User",
|
|
817
|
-
user_type: USER_TYPES.rep,
|
|
818
|
-
og_user_type: void 0,
|
|
819
|
-
company_id: 99999,
|
|
820
|
-
// Dev placeholder — avoids falsy 0
|
|
821
|
-
exp: void 0,
|
|
822
|
-
// Never expires
|
|
823
|
-
auth_type: "dev_bypass"
|
|
824
|
-
};
|
|
825
|
-
}
|
|
826
|
-
var FluidAuthContext = react.createContext(null);
|
|
827
|
-
function FluidAuthProvider({
|
|
828
|
-
children,
|
|
829
|
-
config
|
|
830
|
-
}) {
|
|
831
|
-
const configRef = react.useRef(config);
|
|
832
|
-
configRef.current = config;
|
|
833
|
-
const [isLoading2, setIsLoading] = react.useState(true);
|
|
834
|
-
const [token, setToken] = react.useState(null);
|
|
835
|
-
const [user, setUser] = react.useState(null);
|
|
836
|
-
const [error, setError] = react.useState(null);
|
|
837
|
-
react.useEffect(() => {
|
|
838
|
-
const initializeAuth = async () => {
|
|
839
|
-
const handleAuthFailure = () => {
|
|
840
|
-
const current = configRef.current;
|
|
841
|
-
const handler = resolveAuthFailureHandler(current?.onAuthFailure, current?.authUrl);
|
|
842
|
-
handler();
|
|
843
|
-
};
|
|
844
|
-
try {
|
|
845
|
-
if (isDevBypassActive(config?.devBypass)) {
|
|
846
|
-
const envToken = undefined.VITE_DEV_TOKEN;
|
|
847
|
-
if (envToken) {
|
|
848
|
-
const validation = validateToken(envToken, config?.gracePeriodMs);
|
|
849
|
-
if (validation.isValid && validation.payload) {
|
|
850
|
-
storeToken(envToken, config);
|
|
851
|
-
setToken(envToken);
|
|
852
|
-
setUser(validation.payload);
|
|
853
|
-
setError(null);
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
856
|
-
console.warn(
|
|
857
|
-
"[FluidAuth] VITE_DEV_TOKEN is invalid or expired, falling back to mock user"
|
|
858
|
-
);
|
|
859
|
-
}
|
|
860
|
-
console.warn(
|
|
861
|
-
"[FluidAuth] Dev bypass active - using mock user. API calls will fail without a real token."
|
|
862
|
-
);
|
|
863
|
-
const devUser = createDevUser();
|
|
864
|
-
setToken(null);
|
|
865
|
-
setUser(devUser);
|
|
866
|
-
setError(null);
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
const tokenKey = config?.tokenKey ?? "fluidUserToken";
|
|
870
|
-
let candidateToken = extractTokenFromUrl(tokenKey);
|
|
871
|
-
if (!candidateToken && tokenKey !== AUTH_REDIRECT_TOKEN_KEY) {
|
|
872
|
-
candidateToken = extractTokenFromUrl(AUTH_REDIRECT_TOKEN_KEY);
|
|
873
|
-
}
|
|
874
|
-
cleanTokenFromUrl(tokenKey);
|
|
875
|
-
cleanTokenFromUrl(AUTH_REDIRECT_TOKEN_KEY);
|
|
876
|
-
if (!candidateToken) {
|
|
877
|
-
candidateToken = getStoredToken(config);
|
|
878
|
-
}
|
|
879
|
-
if (candidateToken) {
|
|
880
|
-
let payload = null;
|
|
881
|
-
if (config?.jwksUrl) {
|
|
882
|
-
payload = await verifyToken(candidateToken, config.jwksUrl);
|
|
883
|
-
if (!payload) {
|
|
884
|
-
clearTokens(config);
|
|
885
|
-
setToken(null);
|
|
886
|
-
setUser(null);
|
|
887
|
-
setError(new Error("JWT signature verification failed"));
|
|
888
|
-
handleAuthFailure();
|
|
889
|
-
return;
|
|
890
|
-
}
|
|
891
|
-
if (isTokenExpired(candidateToken, config?.gracePeriodMs)) {
|
|
892
|
-
clearTokens(config);
|
|
893
|
-
setToken(null);
|
|
894
|
-
setUser(null);
|
|
895
|
-
setError(new Error("Token has expired"));
|
|
896
|
-
handleAuthFailure();
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
} else {
|
|
900
|
-
const validation = validateToken(
|
|
901
|
-
candidateToken,
|
|
902
|
-
config?.gracePeriodMs
|
|
903
|
-
);
|
|
904
|
-
if (validation.isValid && validation.payload) {
|
|
905
|
-
payload = validation.payload;
|
|
906
|
-
} else {
|
|
907
|
-
clearTokens(config);
|
|
908
|
-
setToken(null);
|
|
909
|
-
setUser(null);
|
|
910
|
-
setError(new Error(validation.error ?? "Invalid token"));
|
|
911
|
-
handleAuthFailure();
|
|
912
|
-
return;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
storeToken(candidateToken, config);
|
|
916
|
-
setToken(candidateToken);
|
|
917
|
-
setUser(payload);
|
|
918
|
-
setError(null);
|
|
919
|
-
} else {
|
|
920
|
-
setToken(null);
|
|
921
|
-
setUser(null);
|
|
922
|
-
setError(new Error("No authentication token found"));
|
|
923
|
-
handleAuthFailure();
|
|
924
|
-
}
|
|
925
|
-
} catch (err) {
|
|
926
|
-
const error2 = err instanceof Error ? err : new Error("Authentication error");
|
|
927
|
-
setError(error2);
|
|
928
|
-
setToken(null);
|
|
929
|
-
setUser(null);
|
|
930
|
-
handleAuthFailure();
|
|
931
|
-
} finally {
|
|
932
|
-
setIsLoading(false);
|
|
933
|
-
}
|
|
934
|
-
};
|
|
935
|
-
void initializeAuth();
|
|
936
|
-
}, []);
|
|
937
|
-
const clearAuth = react.useCallback(() => {
|
|
938
|
-
clearTokens(configRef.current);
|
|
939
|
-
setToken(null);
|
|
940
|
-
setUser(null);
|
|
941
|
-
setError(null);
|
|
942
|
-
}, []);
|
|
943
|
-
const contextValue = react.useMemo(
|
|
944
|
-
() => ({
|
|
945
|
-
isAuthenticated: user !== null,
|
|
946
|
-
isLoading: isLoading2,
|
|
947
|
-
user,
|
|
948
|
-
token,
|
|
949
|
-
clearAuth,
|
|
950
|
-
error
|
|
951
|
-
}),
|
|
952
|
-
[token, isLoading2, user, clearAuth, error]
|
|
953
|
-
);
|
|
954
|
-
return /* @__PURE__ */ jsxRuntime.jsx(FluidAuthContext.Provider, { value: contextValue, children });
|
|
955
|
-
}
|
|
956
|
-
function useFluidAuthContext() {
|
|
957
|
-
const context = react.useContext(FluidAuthContext);
|
|
958
|
-
if (!context) {
|
|
959
|
-
throw new Error(
|
|
960
|
-
"useFluidAuthContext must be used within a FluidAuthProvider. Wrap your app with <FluidAuthProvider> to use authentication features."
|
|
961
|
-
);
|
|
962
|
-
}
|
|
963
|
-
return context;
|
|
964
|
-
}
|
|
51
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
965
52
|
|
|
966
53
|
// src/types/page-template.ts
|
|
967
54
|
var PAGE_CATEGORIES = {
|
|
@@ -1161,103 +248,653 @@ function resolveNavigationPages(navigation) {
|
|
|
1161
248
|
function getAvailablePageTemplates() {
|
|
1162
249
|
return PageTemplateRegistry.listAll();
|
|
1163
250
|
}
|
|
1164
|
-
function getCorePageTemplates() {
|
|
1165
|
-
return PageTemplateRegistry.listCore();
|
|
251
|
+
function getCorePageTemplates() {
|
|
252
|
+
return PageTemplateRegistry.listCore();
|
|
253
|
+
}
|
|
254
|
+
function getOptionalPageTemplates() {
|
|
255
|
+
return PageTemplateRegistry.listOptional();
|
|
256
|
+
}
|
|
257
|
+
function validateNavigationPages(navigation) {
|
|
258
|
+
const corePages = PageTemplateRegistry.listCore();
|
|
259
|
+
const referencedTemplateIds = new Set(
|
|
260
|
+
navigation.page_refs?.map((ref) => ref.page_template_id) ?? []
|
|
261
|
+
);
|
|
262
|
+
const missingCorePages = corePages.filter((page) => !referencedTemplateIds.has(page.id)).map((page) => page.id);
|
|
263
|
+
return {
|
|
264
|
+
valid: missingCorePages.length === 0,
|
|
265
|
+
missingCorePages
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
var EMPTY_TEMPLATES = [];
|
|
269
|
+
var PageTemplateContext = React2.createContext(
|
|
270
|
+
null
|
|
271
|
+
);
|
|
272
|
+
function PageTemplateProvider({
|
|
273
|
+
children,
|
|
274
|
+
templates = EMPTY_TEMPLATES
|
|
275
|
+
}) {
|
|
276
|
+
const registeredIds = React2.useRef([]);
|
|
277
|
+
const templateKey = templates.map((t) => t.id).join(",");
|
|
278
|
+
React2.useEffect(() => {
|
|
279
|
+
const registered = [];
|
|
280
|
+
for (const template of templates) {
|
|
281
|
+
if (!PageTemplateRegistry.has(template.id)) {
|
|
282
|
+
try {
|
|
283
|
+
PageTemplateRegistry.register(template);
|
|
284
|
+
registered.push(template.id);
|
|
285
|
+
} catch (error) {
|
|
286
|
+
console.warn(
|
|
287
|
+
`Failed to register page template "${template.id}":`,
|
|
288
|
+
error
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
registeredIds.current = registered;
|
|
294
|
+
return () => {
|
|
295
|
+
for (const id of registeredIds.current) {
|
|
296
|
+
PageTemplateRegistry.unregister(id);
|
|
297
|
+
}
|
|
298
|
+
registeredIds.current = [];
|
|
299
|
+
};
|
|
300
|
+
}, [templateKey]);
|
|
301
|
+
const contextValue = React2.useMemo(
|
|
302
|
+
() => ({
|
|
303
|
+
resolvePages: resolveNavigationPages,
|
|
304
|
+
listTemplates: () => PageTemplateRegistry.listAll(),
|
|
305
|
+
getTemplate: (id) => PageTemplateRegistry.get(id),
|
|
306
|
+
hasTemplate: (id) => PageTemplateRegistry.has(id)
|
|
307
|
+
}),
|
|
308
|
+
[]
|
|
309
|
+
);
|
|
310
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PageTemplateContext.Provider, { value: contextValue, children });
|
|
311
|
+
}
|
|
312
|
+
function usePageTemplates() {
|
|
313
|
+
const context = React2.useContext(PageTemplateContext);
|
|
314
|
+
if (!context) {
|
|
315
|
+
throw new Error(
|
|
316
|
+
"usePageTemplates must be used within a PageTemplateProvider"
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
return context;
|
|
320
|
+
}
|
|
321
|
+
function useResolvedPages(navigation) {
|
|
322
|
+
const { resolvePages } = usePageTemplates();
|
|
323
|
+
return React2.useMemo(() => resolvePages(navigation), [resolvePages, navigation]);
|
|
324
|
+
}
|
|
325
|
+
var PROFILE_QUERY_KEY = ["fluid", "profile"];
|
|
326
|
+
function useFluidProfile() {
|
|
327
|
+
const api = chunkOE62VIZU_cjs.useFluidApi();
|
|
328
|
+
return reactQuery.useQuery({
|
|
329
|
+
queryKey: PROFILE_QUERY_KEY,
|
|
330
|
+
queryFn: () => api.profile.get()
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
function systemSetTimeoutZero(callback) {
|
|
334
|
+
setTimeout(callback, 0);
|
|
335
|
+
}
|
|
336
|
+
function matchQuery(filters, query) {
|
|
337
|
+
const {
|
|
338
|
+
type = "all",
|
|
339
|
+
exact,
|
|
340
|
+
fetchStatus,
|
|
341
|
+
predicate,
|
|
342
|
+
queryKey,
|
|
343
|
+
stale
|
|
344
|
+
} = filters;
|
|
345
|
+
if (queryKey) {
|
|
346
|
+
if (exact) {
|
|
347
|
+
if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
} else if (!partialMatchKey(query.queryKey, queryKey)) {
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (type !== "all") {
|
|
355
|
+
const isActive = query.isActive();
|
|
356
|
+
if (type === "active" && !isActive) {
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
if (type === "inactive" && isActive) {
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
if (typeof stale === "boolean" && query.isStale() !== stale) {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
if (fetchStatus && fetchStatus !== query.state.fetchStatus) {
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
if (predicate && !predicate(query)) {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
return true;
|
|
373
|
+
}
|
|
374
|
+
function hashQueryKeyByOptions(queryKey, options) {
|
|
375
|
+
const hashFn = options?.queryKeyHashFn || hashKey;
|
|
376
|
+
return hashFn(queryKey);
|
|
377
|
+
}
|
|
378
|
+
function hashKey(queryKey) {
|
|
379
|
+
return JSON.stringify(
|
|
380
|
+
queryKey,
|
|
381
|
+
(_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
|
|
382
|
+
result[key] = val[key];
|
|
383
|
+
return result;
|
|
384
|
+
}, {}) : val
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
function partialMatchKey(a, b) {
|
|
388
|
+
if (a === b) {
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
if (typeof a !== typeof b) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
395
|
+
return Object.keys(b).every((key) => partialMatchKey(a[key], b[key]));
|
|
396
|
+
}
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
function isPlainObject(o) {
|
|
400
|
+
if (!hasObjectPrototype(o)) {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
const ctor = o.constructor;
|
|
404
|
+
if (ctor === void 0) {
|
|
405
|
+
return true;
|
|
406
|
+
}
|
|
407
|
+
const prot = ctor.prototype;
|
|
408
|
+
if (!hasObjectPrototype(prot)) {
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
if (!prot.hasOwnProperty("isPrototypeOf")) {
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
if (Object.getPrototypeOf(o) !== Object.prototype) {
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
419
|
+
function hasObjectPrototype(o) {
|
|
420
|
+
return Object.prototype.toString.call(o) === "[object Object]";
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// ../../../node_modules/.pnpm/@tanstack+query-core@5.90.12/node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
424
|
+
var defaultScheduler = systemSetTimeoutZero;
|
|
425
|
+
function createNotifyManager() {
|
|
426
|
+
let queue = [];
|
|
427
|
+
let transactions = 0;
|
|
428
|
+
let notifyFn = (callback) => {
|
|
429
|
+
callback();
|
|
430
|
+
};
|
|
431
|
+
let batchNotifyFn = (callback) => {
|
|
432
|
+
callback();
|
|
433
|
+
};
|
|
434
|
+
let scheduleFn = defaultScheduler;
|
|
435
|
+
const schedule = (callback) => {
|
|
436
|
+
if (transactions) {
|
|
437
|
+
queue.push(callback);
|
|
438
|
+
} else {
|
|
439
|
+
scheduleFn(() => {
|
|
440
|
+
notifyFn(callback);
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
const flush = () => {
|
|
445
|
+
const originalQueue = queue;
|
|
446
|
+
queue = [];
|
|
447
|
+
if (originalQueue.length) {
|
|
448
|
+
scheduleFn(() => {
|
|
449
|
+
batchNotifyFn(() => {
|
|
450
|
+
originalQueue.forEach((callback) => {
|
|
451
|
+
notifyFn(callback);
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
return {
|
|
458
|
+
batch: (callback) => {
|
|
459
|
+
let result;
|
|
460
|
+
transactions++;
|
|
461
|
+
try {
|
|
462
|
+
result = callback();
|
|
463
|
+
} finally {
|
|
464
|
+
transactions--;
|
|
465
|
+
if (!transactions) {
|
|
466
|
+
flush();
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return result;
|
|
470
|
+
},
|
|
471
|
+
/**
|
|
472
|
+
* All calls to the wrapped function will be batched.
|
|
473
|
+
*/
|
|
474
|
+
batchCalls: (callback) => {
|
|
475
|
+
return (...args) => {
|
|
476
|
+
schedule(() => {
|
|
477
|
+
callback(...args);
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
},
|
|
481
|
+
schedule,
|
|
482
|
+
/**
|
|
483
|
+
* Use this method to set a custom notify function.
|
|
484
|
+
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
485
|
+
*/
|
|
486
|
+
setNotifyFunction: (fn) => {
|
|
487
|
+
notifyFn = fn;
|
|
488
|
+
},
|
|
489
|
+
/**
|
|
490
|
+
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
491
|
+
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
492
|
+
*/
|
|
493
|
+
setBatchNotifyFunction: (fn) => {
|
|
494
|
+
batchNotifyFn = fn;
|
|
495
|
+
},
|
|
496
|
+
setScheduler: (fn) => {
|
|
497
|
+
scheduleFn = fn;
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
var notifyManager = createNotifyManager();
|
|
502
|
+
|
|
503
|
+
// ../../../node_modules/.pnpm/@tanstack+query-persist-client-core@5.91.11/node_modules/@tanstack/query-persist-client-core/build/modern/createPersister.js
|
|
504
|
+
var PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
505
|
+
function experimental_createQueryPersister({
|
|
506
|
+
storage: storage2,
|
|
507
|
+
buster = "",
|
|
508
|
+
maxAge = 1e3 * 60 * 60 * 24,
|
|
509
|
+
serialize = JSON.stringify,
|
|
510
|
+
deserialize = JSON.parse,
|
|
511
|
+
prefix = PERSISTER_KEY_PREFIX,
|
|
512
|
+
refetchOnRestore = true,
|
|
513
|
+
filters
|
|
514
|
+
}) {
|
|
515
|
+
function isExpiredOrBusted(persistedQuery) {
|
|
516
|
+
if (persistedQuery.state.dataUpdatedAt) {
|
|
517
|
+
const queryAge = Date.now() - persistedQuery.state.dataUpdatedAt;
|
|
518
|
+
const expired = queryAge > maxAge;
|
|
519
|
+
const busted = persistedQuery.buster !== buster;
|
|
520
|
+
if (expired || busted) {
|
|
521
|
+
return true;
|
|
522
|
+
}
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
async function retrieveQuery(queryHash, afterRestoreMacroTask) {
|
|
528
|
+
if (storage2 != null) {
|
|
529
|
+
const storageKey = `${prefix}-${queryHash}`;
|
|
530
|
+
try {
|
|
531
|
+
const storedData = await storage2.getItem(storageKey);
|
|
532
|
+
if (storedData) {
|
|
533
|
+
const persistedQuery = await deserialize(storedData);
|
|
534
|
+
if (isExpiredOrBusted(persistedQuery)) {
|
|
535
|
+
await storage2.removeItem(storageKey);
|
|
536
|
+
} else {
|
|
537
|
+
if (afterRestoreMacroTask) {
|
|
538
|
+
notifyManager.schedule(
|
|
539
|
+
() => afterRestoreMacroTask(persistedQuery)
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
return persistedQuery.state.data;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
} catch (err) {
|
|
546
|
+
if (process.env.NODE_ENV === "development") {
|
|
547
|
+
console.error(err);
|
|
548
|
+
console.warn(
|
|
549
|
+
"Encountered an error attempting to restore query cache from persisted location."
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
await storage2.removeItem(storageKey);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
async function persistQueryByKey(queryKey, queryClient) {
|
|
558
|
+
if (storage2 != null) {
|
|
559
|
+
const query = queryClient.getQueryCache().find({ queryKey });
|
|
560
|
+
if (query) {
|
|
561
|
+
await persistQuery(query);
|
|
562
|
+
} else {
|
|
563
|
+
if (process.env.NODE_ENV === "development") {
|
|
564
|
+
console.warn(
|
|
565
|
+
"Could not find query to be persisted. QueryKey:",
|
|
566
|
+
JSON.stringify(queryKey)
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
async function persistQuery(query) {
|
|
573
|
+
if (storage2 != null) {
|
|
574
|
+
const storageKey = `${prefix}-${query.queryHash}`;
|
|
575
|
+
storage2.setItem(
|
|
576
|
+
storageKey,
|
|
577
|
+
await serialize({
|
|
578
|
+
state: query.state,
|
|
579
|
+
queryKey: query.queryKey,
|
|
580
|
+
queryHash: query.queryHash,
|
|
581
|
+
buster
|
|
582
|
+
})
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
async function persisterFn(queryFn, ctx, query) {
|
|
587
|
+
const matchesFilter = filters ? matchQuery(filters, query) : true;
|
|
588
|
+
if (matchesFilter && query.state.data === void 0 && storage2 != null) {
|
|
589
|
+
const restoredData = await retrieveQuery(
|
|
590
|
+
query.queryHash,
|
|
591
|
+
(persistedQuery) => {
|
|
592
|
+
query.setState({
|
|
593
|
+
dataUpdatedAt: persistedQuery.state.dataUpdatedAt,
|
|
594
|
+
errorUpdatedAt: persistedQuery.state.errorUpdatedAt
|
|
595
|
+
});
|
|
596
|
+
if (refetchOnRestore === "always" || refetchOnRestore === true && query.isStale()) {
|
|
597
|
+
query.fetch();
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
if (restoredData !== void 0) {
|
|
602
|
+
return Promise.resolve(restoredData);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
const queryFnResult = await queryFn(ctx);
|
|
606
|
+
if (matchesFilter && storage2 != null) {
|
|
607
|
+
notifyManager.schedule(() => {
|
|
608
|
+
persistQuery(query);
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
return Promise.resolve(queryFnResult);
|
|
612
|
+
}
|
|
613
|
+
async function persisterGc() {
|
|
614
|
+
if (storage2?.entries) {
|
|
615
|
+
const entries = await storage2.entries();
|
|
616
|
+
for (const [key, value] of entries) {
|
|
617
|
+
if (key.startsWith(prefix)) {
|
|
618
|
+
const persistedQuery = await deserialize(value);
|
|
619
|
+
if (isExpiredOrBusted(persistedQuery)) {
|
|
620
|
+
await storage2.removeItem(key);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
} else if (process.env.NODE_ENV === "development") {
|
|
625
|
+
throw new Error(
|
|
626
|
+
"Provided storage does not implement `entries` method. Garbage collection is not possible without ability to iterate over storage items."
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
async function restoreQueries(queryClient, filters2 = {}) {
|
|
631
|
+
const { exact, queryKey } = filters2;
|
|
632
|
+
if (storage2?.entries) {
|
|
633
|
+
const entries = await storage2.entries();
|
|
634
|
+
for (const [key, value] of entries) {
|
|
635
|
+
if (key.startsWith(prefix)) {
|
|
636
|
+
const persistedQuery = await deserialize(value);
|
|
637
|
+
if (isExpiredOrBusted(persistedQuery)) {
|
|
638
|
+
await storage2.removeItem(key);
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
if (queryKey) {
|
|
642
|
+
if (exact) {
|
|
643
|
+
if (persistedQuery.queryHash !== hashKey(queryKey)) {
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
} else if (!partialMatchKey(persistedQuery.queryKey, queryKey)) {
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
queryClient.setQueryData(
|
|
651
|
+
persistedQuery.queryKey,
|
|
652
|
+
persistedQuery.state.data,
|
|
653
|
+
{
|
|
654
|
+
updatedAt: persistedQuery.state.dataUpdatedAt
|
|
655
|
+
}
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
} else if (process.env.NODE_ENV === "development") {
|
|
660
|
+
throw new Error(
|
|
661
|
+
"Provided storage does not implement `entries` method. Restoration of all stored entries is not possible without ability to iterate over storage items."
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return {
|
|
666
|
+
persisterFn,
|
|
667
|
+
persistQuery,
|
|
668
|
+
persistQueryByKey,
|
|
669
|
+
retrieveQuery,
|
|
670
|
+
persisterGc,
|
|
671
|
+
restoreQueries
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
// ../../platform/query-persister/src/persister.ts
|
|
676
|
+
var DB_NAME = "fluid_tanstack_query_cache";
|
|
677
|
+
var STORE_NAME = "fluid_queries";
|
|
678
|
+
var VERSION = 1;
|
|
679
|
+
var dbPromise = null;
|
|
680
|
+
async function deleteDatabase() {
|
|
681
|
+
return new Promise((resolve, reject) => {
|
|
682
|
+
console.warn("[IDB] Deleting database due to error");
|
|
683
|
+
const req = indexedDB.deleteDatabase(DB_NAME);
|
|
684
|
+
req.onsuccess = () => {
|
|
685
|
+
console.log("[IDB] Database deleted successfully");
|
|
686
|
+
resolve();
|
|
687
|
+
};
|
|
688
|
+
req.onerror = () => {
|
|
689
|
+
console.error("[IDB] Failed to delete database:", req.error);
|
|
690
|
+
reject(req.error ?? new Error("deleteDatabase failed"));
|
|
691
|
+
};
|
|
692
|
+
req.onblocked = () => {
|
|
693
|
+
console.warn("[IDB] Delete blocked: close all tabs using this database");
|
|
694
|
+
};
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
function openDatabase() {
|
|
698
|
+
return new Promise((resolve, reject) => {
|
|
699
|
+
const req = indexedDB.open(DB_NAME, VERSION);
|
|
700
|
+
req.onupgradeneeded = () => {
|
|
701
|
+
const upgradeDb = req.result;
|
|
702
|
+
if (!upgradeDb.objectStoreNames.contains(STORE_NAME)) {
|
|
703
|
+
upgradeDb.createObjectStore(STORE_NAME);
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
req.onsuccess = () => {
|
|
707
|
+
const conn = req.result;
|
|
708
|
+
conn.onversionchange = () => {
|
|
709
|
+
console.trace("[IDB] version change \u2013 closing connection");
|
|
710
|
+
conn.close();
|
|
711
|
+
dbPromise = null;
|
|
712
|
+
};
|
|
713
|
+
resolve(conn);
|
|
714
|
+
};
|
|
715
|
+
req.onblocked = () => {
|
|
716
|
+
console.warn("[IDB] open blocked: another connection is holding the DB");
|
|
717
|
+
};
|
|
718
|
+
req.onerror = () => {
|
|
719
|
+
reject(
|
|
720
|
+
req.error instanceof Error ? req.error : new Error(`IndexedDB open failed: ${String(req.error)}`)
|
|
721
|
+
);
|
|
722
|
+
};
|
|
723
|
+
});
|
|
1166
724
|
}
|
|
1167
|
-
function
|
|
1168
|
-
|
|
725
|
+
async function getDbWithRecovery() {
|
|
726
|
+
try {
|
|
727
|
+
return await openDatabase();
|
|
728
|
+
} catch (err) {
|
|
729
|
+
console.warn("[IDB] Initial open failed, attempting recovery:", err);
|
|
730
|
+
try {
|
|
731
|
+
await deleteDatabase();
|
|
732
|
+
console.log("[IDB] Retrying database open after deletion");
|
|
733
|
+
return await openDatabase();
|
|
734
|
+
} catch (retryErr) {
|
|
735
|
+
console.error("[IDB] Recovery failed:", retryErr);
|
|
736
|
+
throw retryErr;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
1169
739
|
}
|
|
1170
|
-
function
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
return
|
|
1177
|
-
valid: missingCorePages.length === 0,
|
|
1178
|
-
missingCorePages
|
|
1179
|
-
};
|
|
740
|
+
function getDb() {
|
|
741
|
+
if (dbPromise) return dbPromise;
|
|
742
|
+
dbPromise = getDbWithRecovery().catch((err) => {
|
|
743
|
+
dbPromise = null;
|
|
744
|
+
throw err;
|
|
745
|
+
});
|
|
746
|
+
return dbPromise;
|
|
1180
747
|
}
|
|
1181
|
-
var
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
);
|
|
1185
|
-
|
|
1186
|
-
children,
|
|
1187
|
-
templates = EMPTY_TEMPLATES
|
|
1188
|
-
}) {
|
|
1189
|
-
const registeredIds = react.useRef([]);
|
|
1190
|
-
const templateKey = templates.map((t) => t.id).join(",");
|
|
1191
|
-
react.useEffect(() => {
|
|
1192
|
-
const registered = [];
|
|
1193
|
-
for (const template of templates) {
|
|
1194
|
-
if (!PageTemplateRegistry.has(template.id)) {
|
|
748
|
+
var storage = {
|
|
749
|
+
async getItem(key) {
|
|
750
|
+
try {
|
|
751
|
+
const db = await getDb();
|
|
752
|
+
return new Promise((res) => {
|
|
1195
753
|
try {
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
754
|
+
const r = db.transaction(STORE_NAME, "readonly").objectStore(STORE_NAME).get(key);
|
|
755
|
+
r.onsuccess = () => res(r.result);
|
|
756
|
+
r.onerror = () => {
|
|
757
|
+
console.trace("[IDB] getItem error:", r.error);
|
|
758
|
+
res(void 0);
|
|
759
|
+
};
|
|
760
|
+
} catch (txErr) {
|
|
761
|
+
console.trace("[IDB] getItem transaction error:", txErr);
|
|
762
|
+
res(void 0);
|
|
1203
763
|
}
|
|
764
|
+
});
|
|
765
|
+
} catch (err) {
|
|
766
|
+
console.trace("[IDB] getItem getDb error:", err);
|
|
767
|
+
try {
|
|
768
|
+
const db = await getDb();
|
|
769
|
+
return new Promise((res) => {
|
|
770
|
+
try {
|
|
771
|
+
const r = db.transaction(STORE_NAME, "readonly").objectStore(STORE_NAME).get(key);
|
|
772
|
+
r.onsuccess = () => res(r.result);
|
|
773
|
+
r.onerror = () => {
|
|
774
|
+
console.trace("[IDB] getItem retry error:", r.error);
|
|
775
|
+
res(void 0);
|
|
776
|
+
};
|
|
777
|
+
} catch (txErr) {
|
|
778
|
+
console.trace("[IDB] getItem retry transaction error:", txErr);
|
|
779
|
+
res(void 0);
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
} catch (recoveryErr) {
|
|
783
|
+
console.trace("[IDB] getItem recovery failed:", recoveryErr);
|
|
1204
784
|
}
|
|
785
|
+
return void 0;
|
|
1205
786
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
787
|
+
},
|
|
788
|
+
async setItem(key, value) {
|
|
789
|
+
const cloneableValue = JSON.parse(JSON.stringify(value));
|
|
790
|
+
try {
|
|
791
|
+
const db = await getDb();
|
|
792
|
+
if (!db) return;
|
|
793
|
+
await new Promise((resolve) => {
|
|
794
|
+
try {
|
|
795
|
+
const req = db.transaction(STORE_NAME, "readwrite").objectStore(STORE_NAME).put(cloneableValue, key);
|
|
796
|
+
req.onsuccess = () => resolve();
|
|
797
|
+
req.onerror = () => {
|
|
798
|
+
console.trace("[IDB] setItem error:", req.error);
|
|
799
|
+
resolve();
|
|
800
|
+
};
|
|
801
|
+
} catch (txErr) {
|
|
802
|
+
console.trace("[IDB] setItem transaction error:", txErr);
|
|
803
|
+
resolve();
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
} catch (err) {
|
|
807
|
+
console.trace("[IDB] setItem getDb error:", err);
|
|
808
|
+
try {
|
|
809
|
+
const db = await getDb();
|
|
810
|
+
await new Promise((resolve) => {
|
|
811
|
+
try {
|
|
812
|
+
const req = db.transaction(STORE_NAME, "readwrite").objectStore(STORE_NAME).put(cloneableValue, key);
|
|
813
|
+
req.onsuccess = () => resolve();
|
|
814
|
+
req.onerror = () => {
|
|
815
|
+
console.trace("[IDB] setItem retry error:", req.error);
|
|
816
|
+
resolve();
|
|
817
|
+
};
|
|
818
|
+
} catch (txErr) {
|
|
819
|
+
console.trace("[IDB] setItem retry transaction error:", txErr);
|
|
820
|
+
resolve();
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
} catch (recoveryErr) {
|
|
824
|
+
console.trace("[IDB] setItem recovery failed:", recoveryErr);
|
|
1210
825
|
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
)
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
async removeItem(key) {
|
|
829
|
+
try {
|
|
830
|
+
const db = await getDb();
|
|
831
|
+
if (!db) return;
|
|
832
|
+
await new Promise((resolve) => {
|
|
833
|
+
try {
|
|
834
|
+
const req = db.transaction(STORE_NAME, "readwrite").objectStore(STORE_NAME).delete(key);
|
|
835
|
+
req.onsuccess = () => resolve();
|
|
836
|
+
req.onerror = () => {
|
|
837
|
+
console.trace("[IDB] removeItem error:", req.error);
|
|
838
|
+
resolve();
|
|
839
|
+
};
|
|
840
|
+
} catch (txErr) {
|
|
841
|
+
console.trace("[IDB] removeItem transaction error:", txErr);
|
|
842
|
+
resolve();
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
} catch (err) {
|
|
846
|
+
console.trace("[IDB] removeItem getDb error:", err);
|
|
847
|
+
try {
|
|
848
|
+
const db = await getDb();
|
|
849
|
+
await new Promise((resolve) => {
|
|
850
|
+
try {
|
|
851
|
+
const req = db.transaction(STORE_NAME, "readwrite").objectStore(STORE_NAME).delete(key);
|
|
852
|
+
req.onsuccess = () => resolve();
|
|
853
|
+
req.onerror = () => {
|
|
854
|
+
console.trace("[IDB] removeItem retry error:", req.error);
|
|
855
|
+
resolve();
|
|
856
|
+
};
|
|
857
|
+
} catch (txErr) {
|
|
858
|
+
console.trace("[IDB] removeItem retry transaction error:", txErr);
|
|
859
|
+
resolve();
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
} catch (recoveryErr) {
|
|
863
|
+
console.trace("[IDB] removeItem recovery failed:", recoveryErr);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
1231
866
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
867
|
+
};
|
|
868
|
+
function createPersister() {
|
|
869
|
+
return experimental_createQueryPersister({
|
|
870
|
+
storage,
|
|
871
|
+
serialize: (persistedQuery) => persistedQuery,
|
|
872
|
+
deserialize: (cached) => cached
|
|
873
|
+
});
|
|
1237
874
|
}
|
|
1238
875
|
|
|
1239
|
-
// src/hooks/use-fluid-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
var PROFILE_QUERY_KEY = ["fluid", "profile"];
|
|
1245
|
-
function useFluidProfile() {
|
|
1246
|
-
const api = useFluidApi();
|
|
876
|
+
// src/hooks/use-fluid-app.ts
|
|
877
|
+
var APP_DATA_QUERY_KEY = ["fluid", "app"];
|
|
878
|
+
var appDataPersister = typeof window !== "undefined" ? createPersister() : void 0;
|
|
879
|
+
function useFluidApp(options) {
|
|
880
|
+
const api = chunkOE62VIZU_cjs.useFluidApi();
|
|
1247
881
|
return reactQuery.useQuery({
|
|
1248
|
-
queryKey:
|
|
1249
|
-
queryFn: () => api.
|
|
882
|
+
queryKey: APP_DATA_QUERY_KEY,
|
|
883
|
+
queryFn: () => api.app.getRaw(),
|
|
884
|
+
select: chunkOE62VIZU_cjs.transformManifestToRepAppData,
|
|
885
|
+
...appDataPersister && { persister: appDataPersister.persisterFn },
|
|
886
|
+
...options?.enabled !== void 0 && { enabled: options.enabled }
|
|
1250
887
|
});
|
|
1251
888
|
}
|
|
1252
889
|
var PERMISSIONS_QUERY_KEY = ["fluid", "permissions"];
|
|
1253
890
|
function useFluidPermissions() {
|
|
1254
|
-
const api = useFluidApi();
|
|
891
|
+
const api = chunkOE62VIZU_cjs.useFluidApi();
|
|
1255
892
|
const query = reactQuery.useQuery({
|
|
1256
893
|
queryKey: PERMISSIONS_QUERY_KEY,
|
|
1257
894
|
queryFn: () => api.permissions.get()
|
|
1258
895
|
});
|
|
1259
896
|
const permissions = query.data;
|
|
1260
|
-
const can =
|
|
897
|
+
const can = React2.useMemo(() => {
|
|
1261
898
|
return (resource, action = "view") => {
|
|
1262
899
|
if (!permissions) {
|
|
1263
900
|
return false;
|
|
@@ -1283,17 +920,17 @@ function useFluidPermissions() {
|
|
|
1283
920
|
|
|
1284
921
|
// src/hooks/use-fluid-theme.ts
|
|
1285
922
|
function useFluidTheme() {
|
|
1286
|
-
const { currentTheme, setTheme, setThemeMode } = useThemeContext();
|
|
923
|
+
const { currentTheme, setTheme, setThemeMode, mode } = chunkOE62VIZU_cjs.useThemeContext();
|
|
1287
924
|
return {
|
|
1288
925
|
currentTheme,
|
|
1289
926
|
setTheme,
|
|
1290
927
|
setThemeMode,
|
|
1291
|
-
mode
|
|
928
|
+
mode
|
|
1292
929
|
};
|
|
1293
930
|
}
|
|
1294
931
|
var CURRENT_REP_QUERY_KEY = ["fluid", "currentRep"];
|
|
1295
932
|
function useCurrentRep() {
|
|
1296
|
-
const api = useFluidApi();
|
|
933
|
+
const api = chunkOE62VIZU_cjs.useFluidApi();
|
|
1297
934
|
return reactQuery.useQuery({
|
|
1298
935
|
queryKey: CURRENT_REP_QUERY_KEY,
|
|
1299
936
|
queryFn: () => api.reps.current()
|
|
@@ -1302,7 +939,7 @@ function useCurrentRep() {
|
|
|
1302
939
|
|
|
1303
940
|
// src/hooks/use-fluid-auth.ts
|
|
1304
941
|
function useFluidAuth() {
|
|
1305
|
-
return useFluidAuthContext();
|
|
942
|
+
return chunkOE62VIZU_cjs.useFluidAuthContext();
|
|
1306
943
|
}
|
|
1307
944
|
|
|
1308
945
|
// src/hooks/demo-data/calendar-events.ts
|
|
@@ -1973,7 +1610,7 @@ function ensureSpinStyle() {
|
|
|
1973
1610
|
document.head.appendChild(style);
|
|
1974
1611
|
}
|
|
1975
1612
|
function AuthLoading() {
|
|
1976
|
-
|
|
1613
|
+
React2.useEffect(() => {
|
|
1977
1614
|
ensureSpinStyle();
|
|
1978
1615
|
}, []);
|
|
1979
1616
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2032,17 +1669,13 @@ function RequireAuth({
|
|
|
2032
1669
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
2033
1670
|
}
|
|
2034
1671
|
|
|
2035
|
-
// src/themes/index.ts
|
|
2036
|
-
var themes_exports = {};
|
|
2037
|
-
chunkDEQ3PBVX_cjs.__reExport(themes_exports, theme_star__namespace);
|
|
2038
|
-
|
|
2039
1672
|
// src/screens/index.ts
|
|
2040
1673
|
var screenPropertySchemas = {
|
|
2041
|
-
MessagingScreen: () => import('./MessagingScreen-
|
|
2042
|
-
ContactsScreen: () => import('./ContactsScreen-
|
|
2043
|
-
OrdersScreen: () => import('./OrdersScreen-
|
|
2044
|
-
CustomersScreen: () => import('./CustomersScreen-
|
|
2045
|
-
ProductsScreen: () => import('./ProductsScreen-
|
|
1674
|
+
MessagingScreen: () => import('./MessagingScreen-JC7I55NG.cjs').then((m) => m.messagingScreenPropertySchema),
|
|
1675
|
+
ContactsScreen: () => import('./ContactsScreen-ATASCZO2.cjs').then((m) => m.contactsScreenPropertySchema),
|
|
1676
|
+
OrdersScreen: () => import('./OrdersScreen-X7FYUROL.cjs').then((m) => m.ordersScreenPropertySchema),
|
|
1677
|
+
CustomersScreen: () => import('./CustomersScreen-XMPMKSQA.cjs').then((m) => m.customersScreenPropertySchema),
|
|
1678
|
+
ProductsScreen: () => import('./ProductsScreen-4ZIUQNUU.cjs').then((m) => m.productsScreenPropertySchema)
|
|
2046
1679
|
};
|
|
2047
1680
|
var CORE_PAGE_IDS = {
|
|
2048
1681
|
MESSAGING: "core-messaging",
|
|
@@ -2063,154 +1696,1060 @@ function registerCorePageTemplates() {
|
|
|
2063
1696
|
isCore: true,
|
|
2064
1697
|
component_tree: [
|
|
2065
1698
|
{
|
|
2066
|
-
type: "MessagingScreen",
|
|
2067
|
-
id: "messaging-screen-root",
|
|
2068
|
-
props: {}
|
|
1699
|
+
type: "MessagingScreen",
|
|
1700
|
+
id: "messaging-screen-root",
|
|
1701
|
+
props: {}
|
|
1702
|
+
}
|
|
1703
|
+
],
|
|
1704
|
+
defaultProps: {}
|
|
1705
|
+
});
|
|
1706
|
+
PageTemplateRegistry.register({
|
|
1707
|
+
id: CORE_PAGE_IDS.CONTACTS,
|
|
1708
|
+
slug: "contacts",
|
|
1709
|
+
name: "Contacts",
|
|
1710
|
+
description: "Contact management provided by Fluid Commerce",
|
|
1711
|
+
category: PAGE_CATEGORIES.CORE,
|
|
1712
|
+
tags: ["contacts", "people", "address-book"],
|
|
1713
|
+
version: "1.0.0",
|
|
1714
|
+
isCore: true,
|
|
1715
|
+
component_tree: [
|
|
1716
|
+
{
|
|
1717
|
+
type: "ContactsScreen",
|
|
1718
|
+
id: "contacts-screen-root",
|
|
1719
|
+
props: {}
|
|
1720
|
+
}
|
|
1721
|
+
],
|
|
1722
|
+
defaultProps: {}
|
|
1723
|
+
});
|
|
1724
|
+
PageTemplateRegistry.register({
|
|
1725
|
+
id: CORE_PAGE_IDS.ORDERS,
|
|
1726
|
+
slug: "orders",
|
|
1727
|
+
name: "Orders",
|
|
1728
|
+
description: "Order management provided by Fluid Commerce",
|
|
1729
|
+
category: PAGE_CATEGORIES.CORE,
|
|
1730
|
+
tags: ["orders", "commerce", "sales"],
|
|
1731
|
+
version: "1.0.0",
|
|
1732
|
+
isCore: true,
|
|
1733
|
+
component_tree: [
|
|
1734
|
+
{
|
|
1735
|
+
type: "OrdersScreen",
|
|
1736
|
+
id: "orders-screen-root",
|
|
1737
|
+
props: {}
|
|
1738
|
+
}
|
|
1739
|
+
],
|
|
1740
|
+
defaultProps: {}
|
|
1741
|
+
});
|
|
1742
|
+
PageTemplateRegistry.register({
|
|
1743
|
+
id: CORE_PAGE_IDS.CUSTOMERS,
|
|
1744
|
+
slug: "customers",
|
|
1745
|
+
name: "Customers",
|
|
1746
|
+
description: "Customer management provided by Fluid Commerce",
|
|
1747
|
+
category: PAGE_CATEGORIES.CORE,
|
|
1748
|
+
tags: ["customers", "people", "commerce"],
|
|
1749
|
+
version: "1.0.0",
|
|
1750
|
+
isCore: true,
|
|
1751
|
+
component_tree: [
|
|
1752
|
+
{
|
|
1753
|
+
type: "CustomersScreen",
|
|
1754
|
+
id: "customers-screen-root",
|
|
1755
|
+
props: {}
|
|
1756
|
+
}
|
|
1757
|
+
],
|
|
1758
|
+
defaultProps: {}
|
|
1759
|
+
});
|
|
1760
|
+
PageTemplateRegistry.register({
|
|
1761
|
+
id: CORE_PAGE_IDS.PRODUCTS,
|
|
1762
|
+
slug: "products",
|
|
1763
|
+
name: "Products",
|
|
1764
|
+
description: "Product catalog provided by Fluid Commerce",
|
|
1765
|
+
category: PAGE_CATEGORIES.CORE,
|
|
1766
|
+
tags: ["products", "catalog", "commerce"],
|
|
1767
|
+
version: "1.0.0",
|
|
1768
|
+
isCore: true,
|
|
1769
|
+
component_tree: [
|
|
1770
|
+
{
|
|
1771
|
+
type: "ProductsScreen",
|
|
1772
|
+
id: "products-screen-root",
|
|
1773
|
+
props: {}
|
|
1774
|
+
}
|
|
1775
|
+
],
|
|
1776
|
+
defaultProps: {}
|
|
1777
|
+
});
|
|
1778
|
+
}
|
|
1779
|
+
registerCorePageTemplates();
|
|
1780
|
+
function isInSection(item, currentSlug) {
|
|
1781
|
+
const normalized = systemNavigationItems.normalizeSlug(currentSlug);
|
|
1782
|
+
if (systemNavigationItems.normalizeSlug(item.slug) === normalized) return true;
|
|
1783
|
+
return item.children?.some((child) => systemNavigationItems.normalizeSlug(child.slug) === normalized) ?? false;
|
|
1784
|
+
}
|
|
1785
|
+
function getNavTarget(item) {
|
|
1786
|
+
if (item.slug && (!item.children || item.children.length === 0)) {
|
|
1787
|
+
return systemNavigationItems.normalizeSlug(item.slug);
|
|
1788
|
+
}
|
|
1789
|
+
if (item.children && item.children.length > 0) {
|
|
1790
|
+
const firstChild = item.children[0];
|
|
1791
|
+
if (firstChild?.slug) return systemNavigationItems.normalizeSlug(firstChild.slug);
|
|
1792
|
+
}
|
|
1793
|
+
return null;
|
|
1794
|
+
}
|
|
1795
|
+
function SdkBottomNav({
|
|
1796
|
+
navItems,
|
|
1797
|
+
currentSlug,
|
|
1798
|
+
onNavigate,
|
|
1799
|
+
maxVisibleItems = 5
|
|
1800
|
+
}) {
|
|
1801
|
+
const { isMobile, useBottomNav } = sidebar.useSidebar();
|
|
1802
|
+
const [moreOpen, setMoreOpen] = React2__namespace.useState(false);
|
|
1803
|
+
if (!isMobile || !useBottomNav) return null;
|
|
1804
|
+
const navigableItems = navItems.filter((item) => !item.parent_id).filter((item) => item.slug || item.children && item.children.length > 0);
|
|
1805
|
+
const hasOverflow = navigableItems.length > maxVisibleItems;
|
|
1806
|
+
const visibleItems = hasOverflow ? navigableItems.slice(0, maxVisibleItems - 1) : navigableItems;
|
|
1807
|
+
const overflowItems = hasOverflow ? navigableItems.slice(maxVisibleItems - 1) : [];
|
|
1808
|
+
const handleItemClick = (item) => {
|
|
1809
|
+
const target = getNavTarget(item);
|
|
1810
|
+
if (target) onNavigate(target);
|
|
1811
|
+
setMoreOpen(false);
|
|
1812
|
+
};
|
|
1813
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1814
|
+
/* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "fixed right-0 bottom-0 left-0 z-40 flex h-16 items-end justify-around border-t border-border bg-sidebar pb-[env(safe-area-inset-bottom)]", children: [
|
|
1815
|
+
visibleItems.map((item) => {
|
|
1816
|
+
const isActive = isInSection(item, currentSlug);
|
|
1817
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1818
|
+
"button",
|
|
1819
|
+
{
|
|
1820
|
+
type: "button",
|
|
1821
|
+
onClick: () => handleItemClick(item),
|
|
1822
|
+
className: `flex flex-1 flex-col items-center justify-center gap-0.5 py-2 text-[10px] font-medium transition-colors ${isActive ? "text-primary" : "text-muted-foreground"}`,
|
|
1823
|
+
children: [
|
|
1824
|
+
item.icon ? /* @__PURE__ */ jsxRuntime.jsx(RepIcon.RepIcon, { name: item.icon, className: "size-5" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-5" }),
|
|
1825
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-[72px] truncate", children: item.label })
|
|
1826
|
+
]
|
|
1827
|
+
},
|
|
1828
|
+
item.id ?? item.slug ?? item.label
|
|
1829
|
+
);
|
|
1830
|
+
}),
|
|
1831
|
+
hasOverflow && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1832
|
+
"button",
|
|
1833
|
+
{
|
|
1834
|
+
type: "button",
|
|
1835
|
+
onClick: () => setMoreOpen(true),
|
|
1836
|
+
className: `flex flex-1 flex-col items-center justify-center gap-0.5 py-2 text-[10px] font-medium transition-colors ${overflowItems.some((item) => isInSection(item, currentSlug)) ? "text-primary" : "text-muted-foreground"}`,
|
|
1837
|
+
children: [
|
|
1838
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faEllipsis.faEllipsis, className: "size-5" }),
|
|
1839
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "More" })
|
|
1840
|
+
]
|
|
1841
|
+
}
|
|
1842
|
+
)
|
|
1843
|
+
] }),
|
|
1844
|
+
moreOpen && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed inset-0 z-50 flex flex-col", children: [
|
|
1845
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1846
|
+
"div",
|
|
1847
|
+
{
|
|
1848
|
+
className: "flex-1 bg-black/50",
|
|
1849
|
+
onClick: () => setMoreOpen(false),
|
|
1850
|
+
"aria-hidden": "true"
|
|
1851
|
+
}
|
|
1852
|
+
),
|
|
1853
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-t-2xl bg-sidebar pb-[env(safe-area-inset-bottom)]", children: [
|
|
1854
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 pt-4 pb-2", children: [
|
|
1855
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold text-foreground", children: "More" }),
|
|
1856
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1857
|
+
"button",
|
|
1858
|
+
{
|
|
1859
|
+
type: "button",
|
|
1860
|
+
onClick: () => setMoreOpen(false),
|
|
1861
|
+
className: "flex items-center justify-center rounded-full p-1 text-muted-foreground hover:bg-sidebar-accent",
|
|
1862
|
+
"aria-label": "Close",
|
|
1863
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faXmark.faXmark, className: "size-5" })
|
|
1864
|
+
}
|
|
1865
|
+
)
|
|
1866
|
+
] }),
|
|
1867
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 pb-4", children: overflowItems.map((item) => {
|
|
1868
|
+
const isActive = isInSection(item, currentSlug);
|
|
1869
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1870
|
+
"button",
|
|
1871
|
+
{
|
|
1872
|
+
type: "button",
|
|
1873
|
+
onClick: () => handleItemClick(item),
|
|
1874
|
+
className: `flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-colors ${isActive ? "bg-sidebar-primary text-sidebar-primary-foreground" : "text-sidebar-foreground hover:bg-sidebar-accent"}`,
|
|
1875
|
+
children: [
|
|
1876
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx(RepIcon.RepIcon, { name: item.icon, className: "size-5" }),
|
|
1877
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
1878
|
+
]
|
|
1879
|
+
},
|
|
1880
|
+
item.id ?? item.slug ?? item.label
|
|
1881
|
+
);
|
|
1882
|
+
}) })
|
|
1883
|
+
] })
|
|
1884
|
+
] })
|
|
1885
|
+
] });
|
|
1886
|
+
}
|
|
1887
|
+
var SPIN_STYLE_ID2 = "fluid-app-shell-loading-spin";
|
|
1888
|
+
function ensureSpinStyle2() {
|
|
1889
|
+
if (typeof document === "undefined") return;
|
|
1890
|
+
if (document.getElementById(SPIN_STYLE_ID2)) return;
|
|
1891
|
+
const style = document.createElement("style");
|
|
1892
|
+
style.id = SPIN_STYLE_ID2;
|
|
1893
|
+
style.textContent = `@keyframes spin { to { transform: rotate(360deg); } }`;
|
|
1894
|
+
document.head.appendChild(style);
|
|
1895
|
+
}
|
|
1896
|
+
function AppShellLoading() {
|
|
1897
|
+
React2.useEffect(() => {
|
|
1898
|
+
ensureSpinStyle2();
|
|
1899
|
+
}, []);
|
|
1900
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1901
|
+
"div",
|
|
1902
|
+
{
|
|
1903
|
+
style: {
|
|
1904
|
+
display: "flex",
|
|
1905
|
+
flexDirection: "column",
|
|
1906
|
+
alignItems: "center",
|
|
1907
|
+
justifyContent: "center",
|
|
1908
|
+
minHeight: "100vh",
|
|
1909
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
1910
|
+
backgroundColor: "#f9fafb"
|
|
1911
|
+
},
|
|
1912
|
+
children: [
|
|
1913
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1914
|
+
"div",
|
|
1915
|
+
{
|
|
1916
|
+
style: {
|
|
1917
|
+
width: "40px",
|
|
1918
|
+
height: "40px",
|
|
1919
|
+
border: "3px solid #e5e7eb",
|
|
1920
|
+
borderTopColor: "#3b82f6",
|
|
1921
|
+
borderRadius: "50%",
|
|
1922
|
+
animation: "spin 1s linear infinite"
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
),
|
|
1926
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1927
|
+
"p",
|
|
1928
|
+
{
|
|
1929
|
+
style: {
|
|
1930
|
+
marginTop: "1rem",
|
|
1931
|
+
color: "#6b7280",
|
|
1932
|
+
fontSize: "0.875rem"
|
|
1933
|
+
},
|
|
1934
|
+
children: "Loading..."
|
|
1935
|
+
}
|
|
1936
|
+
)
|
|
1937
|
+
]
|
|
1938
|
+
}
|
|
1939
|
+
);
|
|
1940
|
+
}
|
|
1941
|
+
function collectNavSlugs(items) {
|
|
1942
|
+
const slugs = [];
|
|
1943
|
+
for (const item of items) {
|
|
1944
|
+
if (item.slug) slugs.push(systemNavigationItems.normalizeSlug(item.slug));
|
|
1945
|
+
for (const child of item.children ?? []) {
|
|
1946
|
+
if (child.slug) slugs.push(systemNavigationItems.normalizeSlug(child.slug));
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
return [...slugs].sort((a, b) => b.split("/").length - a.split("/").length);
|
|
1950
|
+
}
|
|
1951
|
+
function matchSlugPrefix(fullSlug, navSlugs) {
|
|
1952
|
+
const normalized = systemNavigationItems.normalizeSlug(fullSlug);
|
|
1953
|
+
if (!normalized) return void 0;
|
|
1954
|
+
for (const navSlug of navSlugs) {
|
|
1955
|
+
if (normalized === navSlug) {
|
|
1956
|
+
return { matchedSlug: navSlug, rest: "" };
|
|
1957
|
+
}
|
|
1958
|
+
if (normalized.startsWith(navSlug + "/")) {
|
|
1959
|
+
return {
|
|
1960
|
+
matchedSlug: navSlug,
|
|
1961
|
+
rest: normalized.slice(navSlug.length + 1)
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
return void 0;
|
|
1966
|
+
}
|
|
1967
|
+
function extractSlugFromPathname(pathname, basePath) {
|
|
1968
|
+
if (basePath === "/") {
|
|
1969
|
+
return pathname.replace(/^\//, "");
|
|
1970
|
+
}
|
|
1971
|
+
if (pathname.startsWith(basePath)) {
|
|
1972
|
+
return pathname.slice(basePath.length).replace(/^\//, "");
|
|
1973
|
+
}
|
|
1974
|
+
return pathname.replace(/^\//, "");
|
|
1975
|
+
}
|
|
1976
|
+
function isSlugInSection(item, currentSlug, navSlugs) {
|
|
1977
|
+
const match = matchSlugPrefix(currentSlug, navSlugs);
|
|
1978
|
+
const baseSlug = match?.matchedSlug ?? systemNavigationItems.normalizeSlug(currentSlug);
|
|
1979
|
+
if (systemNavigationItems.normalizeSlug(item.slug) === baseSlug) return true;
|
|
1980
|
+
return item.children?.some((child) => systemNavigationItems.normalizeSlug(child.slug) === baseSlug) ?? false;
|
|
1981
|
+
}
|
|
1982
|
+
function SdkNavigation({
|
|
1983
|
+
navItems,
|
|
1984
|
+
currentSlug,
|
|
1985
|
+
onNavigate,
|
|
1986
|
+
navSlugs
|
|
1987
|
+
}) {
|
|
1988
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sidebar.SidebarMenu, { children: navItems.map((item, index) => {
|
|
1989
|
+
if (!item.slug && !item.label) return null;
|
|
1990
|
+
if (!item.slug) {
|
|
1991
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sidebar.SidebarGroupLabel, { children: item.label }, item.id ?? `section-${index}`);
|
|
1992
|
+
}
|
|
1993
|
+
const itemSlug = systemNavigationItems.normalizeSlug(item.slug);
|
|
1994
|
+
const isActive = isSlugInSection(item, currentSlug, navSlugs);
|
|
1995
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sidebar.SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1996
|
+
sidebar.SidebarMenuButton,
|
|
1997
|
+
{
|
|
1998
|
+
isActive,
|
|
1999
|
+
onClick: () => onNavigate(itemSlug),
|
|
2000
|
+
children: [
|
|
2001
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx(RepIcon.RepIcon, { name: item.icon }),
|
|
2002
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.label })
|
|
2003
|
+
]
|
|
2069
2004
|
}
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2005
|
+
) }, item.id ?? itemSlug);
|
|
2006
|
+
}) });
|
|
2007
|
+
}
|
|
2008
|
+
function QuickLinksDropdown({ onNavigate }) {
|
|
2009
|
+
const [open, setOpen] = React2.useState(false);
|
|
2010
|
+
const panelRef = React2.useRef(null);
|
|
2011
|
+
const buttonRef = React2.useRef(null);
|
|
2012
|
+
const close = React2.useCallback(() => setOpen(false), []);
|
|
2013
|
+
React2.useEffect(() => {
|
|
2014
|
+
if (!open) return;
|
|
2015
|
+
const handleMouseDown = (e) => {
|
|
2016
|
+
if (panelRef.current && !panelRef.current.contains(e.target) && buttonRef.current && !buttonRef.current.contains(e.target)) {
|
|
2017
|
+
close();
|
|
2018
|
+
}
|
|
2019
|
+
};
|
|
2020
|
+
const handleKeyDown = (e) => {
|
|
2021
|
+
if (e.key === "Escape") close();
|
|
2022
|
+
};
|
|
2023
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
2024
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2025
|
+
return () => {
|
|
2026
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
2027
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
2028
|
+
};
|
|
2029
|
+
}, [open, close]);
|
|
2030
|
+
const sections = systemNavigationItems.getSystemNavigationBySection();
|
|
2031
|
+
const handleItemClick = (slug) => {
|
|
2032
|
+
onNavigate(slug);
|
|
2033
|
+
close();
|
|
2034
|
+
};
|
|
2035
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
2036
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2037
|
+
"button",
|
|
2083
2038
|
{
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2039
|
+
ref: buttonRef,
|
|
2040
|
+
type: "button",
|
|
2041
|
+
onClick: () => setOpen((prev) => !prev),
|
|
2042
|
+
className: "flex shrink-0 items-center justify-center rounded-md p-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
2043
|
+
"aria-label": "Quick links",
|
|
2044
|
+
"aria-expanded": open,
|
|
2045
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faTableCellsLarge.faTableCellsLarge, className: "h-4 w-4" })
|
|
2087
2046
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
PageTemplateRegistry.register({
|
|
2092
|
-
id: CORE_PAGE_IDS.ORDERS,
|
|
2093
|
-
slug: "orders",
|
|
2094
|
-
name: "Orders",
|
|
2095
|
-
description: "Order management provided by Fluid Commerce",
|
|
2096
|
-
category: PAGE_CATEGORIES.CORE,
|
|
2097
|
-
tags: ["orders", "commerce", "sales"],
|
|
2098
|
-
version: "1.0.0",
|
|
2099
|
-
isCore: true,
|
|
2100
|
-
component_tree: [
|
|
2047
|
+
),
|
|
2048
|
+
open && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2049
|
+
"div",
|
|
2101
2050
|
{
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2051
|
+
ref: panelRef,
|
|
2052
|
+
className: "absolute top-full right-0 z-50 mt-1 w-[700px] max-w-[90vw] overflow-hidden rounded-lg border border-border bg-background shadow-lg",
|
|
2053
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
2054
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 border-b bg-background p-4", children: [
|
|
2055
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2056
|
+
reactFontawesome.FontAwesomeIcon,
|
|
2057
|
+
{
|
|
2058
|
+
icon: faTableCellsLarge.faTableCellsLarge,
|
|
2059
|
+
className: "h-5 w-5 text-muted-foreground"
|
|
2060
|
+
}
|
|
2061
|
+
),
|
|
2062
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-semibold text-foreground", children: "Shortcuts" })
|
|
2063
|
+
] }),
|
|
2064
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-6 bg-muted p-6", children: Object.entries(sections).map(([sectionName, items]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
2065
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-semibold text-foreground", children: sectionName }),
|
|
2066
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-4 gap-2", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2067
|
+
"button",
|
|
2068
|
+
{
|
|
2069
|
+
type: "button",
|
|
2070
|
+
onClick: () => handleItemClick(item.slug),
|
|
2071
|
+
className: "flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-sidebar-foreground transition-colors hover:bg-sidebar-primary hover:text-sidebar-primary-foreground",
|
|
2072
|
+
children: [
|
|
2073
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2074
|
+
RepIcon.RepIcon,
|
|
2075
|
+
{
|
|
2076
|
+
name: item.icon,
|
|
2077
|
+
className: "h-4 w-4 shrink-0 text-muted-foreground"
|
|
2078
|
+
}
|
|
2079
|
+
),
|
|
2080
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.label })
|
|
2081
|
+
]
|
|
2082
|
+
},
|
|
2083
|
+
item.slug
|
|
2084
|
+
)) })
|
|
2085
|
+
] }, sectionName)) })
|
|
2086
|
+
] })
|
|
2105
2087
|
}
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2088
|
+
)
|
|
2089
|
+
] });
|
|
2090
|
+
}
|
|
2091
|
+
function SdkHeader({
|
|
2092
|
+
tabs,
|
|
2093
|
+
mobileTabs,
|
|
2094
|
+
currentSlug,
|
|
2095
|
+
onNavigate,
|
|
2096
|
+
navSlugs
|
|
2097
|
+
}) {
|
|
2098
|
+
const sidebar$1 = sidebar.useSidebar();
|
|
2099
|
+
const themeMode = ThemeModeContext.useThemeMode();
|
|
2100
|
+
const match = matchSlugPrefix(currentSlug, navSlugs);
|
|
2101
|
+
const baseSlug = match?.matchedSlug ?? systemNavigationItems.normalizeSlug(currentSlug);
|
|
2102
|
+
const themeIcon = themeMode.mode === "dark" ? faMoon.faMoon : faSun.faSun;
|
|
2103
|
+
const activeTabs = sidebar$1.isMobile && sidebar$1.useBottomNav && mobileTabs ? mobileTabs : tabs;
|
|
2104
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex h-[52px] shrink-0 items-center gap-2 bg-sidebar px-6", children: [
|
|
2105
|
+
sidebar$1.isMobile && !sidebar$1.useBottomNav && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2106
|
+
"button",
|
|
2119
2107
|
{
|
|
2120
|
-
type: "
|
|
2121
|
-
|
|
2122
|
-
|
|
2108
|
+
type: "button",
|
|
2109
|
+
onClick: sidebar$1.toggleSidebar,
|
|
2110
|
+
className: "mr-2 flex shrink-0 items-center justify-center rounded-md p-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
2111
|
+
"aria-label": "Toggle sidebar",
|
|
2112
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: faBars.faBars, className: "size-5" })
|
|
2123
2113
|
}
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2114
|
+
),
|
|
2115
|
+
/* @__PURE__ */ jsxRuntime.jsx("nav", { className: "scrollbar-none flex flex-1 items-center gap-1 overflow-x-auto", children: activeTabs.map((tab) => {
|
|
2116
|
+
const tabSlug = systemNavigationItems.normalizeSlug(tab.slug);
|
|
2117
|
+
if (!tabSlug) return null;
|
|
2118
|
+
const isActive = tabSlug === baseSlug;
|
|
2119
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2120
|
+
"button",
|
|
2121
|
+
{
|
|
2122
|
+
type: "button",
|
|
2123
|
+
onClick: () => onNavigate(tabSlug),
|
|
2124
|
+
className: `border-b-2 px-4 py-3 text-sm font-medium whitespace-nowrap transition-colors ${isActive ? "border-primary text-foreground" : "border-transparent text-muted-foreground hover:border-border hover:text-foreground"}`,
|
|
2125
|
+
children: tab.label
|
|
2126
|
+
},
|
|
2127
|
+
tab.id ?? tabSlug
|
|
2128
|
+
);
|
|
2129
|
+
}) }),
|
|
2130
|
+
/* @__PURE__ */ jsxRuntime.jsx(QuickLinksDropdown, { onNavigate }),
|
|
2131
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2132
|
+
"button",
|
|
2137
2133
|
{
|
|
2138
|
-
type: "
|
|
2139
|
-
|
|
2140
|
-
|
|
2134
|
+
type: "button",
|
|
2135
|
+
onClick: themeMode.cycleMode,
|
|
2136
|
+
className: "ml-2 flex shrink-0 items-center justify-center rounded-md p-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
2137
|
+
"aria-label": `Switch theme (current: ${themeMode.mode})`,
|
|
2138
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: themeIcon, className: "size-3" })
|
|
2141
2139
|
}
|
|
2142
|
-
|
|
2143
|
-
|
|
2140
|
+
)
|
|
2141
|
+
] });
|
|
2142
|
+
}
|
|
2143
|
+
function WidgetRenderer({ widget, index }) {
|
|
2144
|
+
const registry = contexts.useRegistry();
|
|
2145
|
+
const Component = registry[widget.type];
|
|
2146
|
+
if (!Component) {
|
|
2147
|
+
console.warn(
|
|
2148
|
+
`[BuilderScreenView] Widget type "${String(widget.type)}" not found in registry`
|
|
2149
|
+
);
|
|
2150
|
+
return null;
|
|
2151
|
+
}
|
|
2152
|
+
if (widget.dataSource) {
|
|
2153
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(DataAwareWidget.DataAwareWidget, { widget, Component }) }, widget.id ?? index);
|
|
2154
|
+
}
|
|
2155
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(Component, { ...widget.props }) }, widget.id ?? index);
|
|
2156
|
+
}
|
|
2157
|
+
function BuilderScreenViewImpl({ screen, className }) {
|
|
2158
|
+
const widgets = screen.component_tree;
|
|
2159
|
+
if (!widgets || widgets.length === 0) {
|
|
2160
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className ?? "h-full w-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "This screen has no content yet." }) }) });
|
|
2161
|
+
}
|
|
2162
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className ?? "h-full w-full", children: widgets.map((widget, index) => {
|
|
2163
|
+
if (!widget) return null;
|
|
2164
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2165
|
+
WidgetRenderer,
|
|
2166
|
+
{
|
|
2167
|
+
widget,
|
|
2168
|
+
index
|
|
2169
|
+
},
|
|
2170
|
+
widget.id ?? index
|
|
2171
|
+
);
|
|
2172
|
+
}) });
|
|
2173
|
+
}
|
|
2174
|
+
var BuilderScreenView = React2.memo(BuilderScreenViewImpl);
|
|
2175
|
+
var SYSTEM_SLUG_SCREEN_MAP = {
|
|
2176
|
+
messages: chunkOE62VIZU_cjs.MessagingScreen,
|
|
2177
|
+
contacts: chunkEOXYOOWS_cjs.ContactsScreen,
|
|
2178
|
+
shop: chunkFG2CI6HA_cjs.OrdersScreen,
|
|
2179
|
+
customers: chunkMHPK7YQ2_cjs.CustomersScreen,
|
|
2180
|
+
products: chunk5UBEM3AX_cjs.ProductsScreen
|
|
2181
|
+
};
|
|
2182
|
+
function PageRouter({
|
|
2183
|
+
currentSlug,
|
|
2184
|
+
currentNavItem,
|
|
2185
|
+
customPages,
|
|
2186
|
+
screens,
|
|
2187
|
+
baseSlug,
|
|
2188
|
+
restParams
|
|
2189
|
+
}) {
|
|
2190
|
+
const screenById = React2.useMemo(() => {
|
|
2191
|
+
if (!screens || screens.length === 0) return void 0;
|
|
2192
|
+
return new Map(screens.map((s) => [s.id, s]));
|
|
2193
|
+
}, [screens]);
|
|
2194
|
+
const screenBySlug = React2.useMemo(() => {
|
|
2195
|
+
if (!screens || screens.length === 0) return void 0;
|
|
2196
|
+
return new Map(screens.filter((s) => s.slug).map((s) => [s.slug, s]));
|
|
2197
|
+
}, [screens]);
|
|
2198
|
+
const builderScreen = React2.useMemo(() => {
|
|
2199
|
+
if (currentNavItem?.screen_id && screenById) {
|
|
2200
|
+
const byId = screenById.get(currentNavItem.screen_id);
|
|
2201
|
+
if (byId) return byId;
|
|
2202
|
+
}
|
|
2203
|
+
if (screenBySlug) {
|
|
2204
|
+
return screenBySlug.get(currentSlug) ?? screenBySlug.get(baseSlug) ?? void 0;
|
|
2205
|
+
}
|
|
2206
|
+
return void 0;
|
|
2207
|
+
}, [
|
|
2208
|
+
currentNavItem?.screen_id,
|
|
2209
|
+
screenById,
|
|
2210
|
+
screenBySlug,
|
|
2211
|
+
currentSlug,
|
|
2212
|
+
baseSlug
|
|
2213
|
+
]);
|
|
2214
|
+
const SystemScreen = SYSTEM_SLUG_SCREEN_MAP[baseSlug];
|
|
2215
|
+
if (SystemScreen) {
|
|
2216
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SystemScreen, {});
|
|
2217
|
+
}
|
|
2218
|
+
if (systemNavigationItems.isSystemNavigationItem(baseSlug)) {
|
|
2219
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkB6S6BEPL_cjs.CoreScreenPlaceholder, { name: currentNavItem?.label ?? baseSlug });
|
|
2220
|
+
}
|
|
2221
|
+
const ExactCustomPage = customPages?.[currentSlug];
|
|
2222
|
+
if (ExactCustomPage) {
|
|
2223
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ExactCustomPage, { slug: currentSlug, params: restParams });
|
|
2224
|
+
}
|
|
2225
|
+
if (baseSlug !== currentSlug) {
|
|
2226
|
+
const PrefixCustomPage = customPages?.[baseSlug];
|
|
2227
|
+
if (PrefixCustomPage) {
|
|
2228
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PrefixCustomPage, { slug: currentSlug, params: restParams });
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
if (builderScreen) {
|
|
2232
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BuilderScreenView, { screen: builderScreen });
|
|
2233
|
+
}
|
|
2234
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkB6S6BEPL_cjs.CoreScreenPlaceholder, { name: currentNavItem?.label ?? currentSlug });
|
|
2235
|
+
}
|
|
2236
|
+
var AppNavigationContext = React2.createContext(
|
|
2237
|
+
null
|
|
2238
|
+
);
|
|
2239
|
+
function AppNavigationProvider({
|
|
2240
|
+
currentSlug,
|
|
2241
|
+
basePath,
|
|
2242
|
+
navigate,
|
|
2243
|
+
children
|
|
2244
|
+
}) {
|
|
2245
|
+
const buildHref = React2.useMemo(() => {
|
|
2246
|
+
return (slug) => {
|
|
2247
|
+
if (basePath === "/") return `/${slug}`;
|
|
2248
|
+
return `${basePath}/${slug}`;
|
|
2249
|
+
};
|
|
2250
|
+
}, [basePath]);
|
|
2251
|
+
const value = React2.useMemo(
|
|
2252
|
+
() => ({ currentSlug, basePath, navigate, buildHref }),
|
|
2253
|
+
[currentSlug, basePath, navigate, buildHref]
|
|
2254
|
+
);
|
|
2255
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AppNavigationContext.Provider, { value, children });
|
|
2256
|
+
}
|
|
2257
|
+
function useAppNavigation() {
|
|
2258
|
+
const ctx = React2.useContext(AppNavigationContext);
|
|
2259
|
+
if (!ctx) {
|
|
2260
|
+
throw new Error(
|
|
2261
|
+
"useAppNavigation must be used within an <AppShell> or <AppNavigationProvider>"
|
|
2262
|
+
);
|
|
2263
|
+
}
|
|
2264
|
+
return ctx;
|
|
2265
|
+
}
|
|
2266
|
+
var THEME_STORAGE_KEY = "rep-theme-mode";
|
|
2267
|
+
var DEFAULT_NAVIGATION = [
|
|
2268
|
+
{ label: "We Commerce", children: [] },
|
|
2269
|
+
{ slug: "shop", label: "Shop", icon: "store", children: [] },
|
|
2270
|
+
{ slug: "account", label: "Account", icon: "user-gear", children: [] },
|
|
2271
|
+
{ slug: "messages", label: "Messaging", icon: "comment", children: [] },
|
|
2272
|
+
{ label: "Marketing Assets", children: [] },
|
|
2273
|
+
{
|
|
2274
|
+
slug: "share/products",
|
|
2275
|
+
label: "Products",
|
|
2276
|
+
icon: "boxes-stacked",
|
|
2277
|
+
children: []
|
|
2278
|
+
}
|
|
2279
|
+
];
|
|
2280
|
+
function getInitialThemeMode() {
|
|
2281
|
+
if (typeof window === "undefined") return "light";
|
|
2282
|
+
const stored = localStorage.getItem(THEME_STORAGE_KEY);
|
|
2283
|
+
if (stored === "light" || stored === "dark") return stored;
|
|
2284
|
+
return "light";
|
|
2285
|
+
}
|
|
2286
|
+
function findFirstNavigableSlug(items) {
|
|
2287
|
+
for (const item of items) {
|
|
2288
|
+
if (item.slug) return systemNavigationItems.normalizeSlug(item.slug);
|
|
2289
|
+
for (const child of item.children ?? []) {
|
|
2290
|
+
if (child.slug) return systemNavigationItems.normalizeSlug(child.slug);
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
return "";
|
|
2294
|
+
}
|
|
2295
|
+
function findCurrentSection(items, slug) {
|
|
2296
|
+
const normalized = systemNavigationItems.normalizeSlug(slug);
|
|
2297
|
+
for (const item of items) {
|
|
2298
|
+
if (systemNavigationItems.normalizeSlug(item.slug) === normalized) return item;
|
|
2299
|
+
if (item.children?.some((child) => systemNavigationItems.normalizeSlug(child.slug) === normalized)) {
|
|
2300
|
+
return item;
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
return void 0;
|
|
2304
|
+
}
|
|
2305
|
+
function findNavItem(items, slug) {
|
|
2306
|
+
const normalized = systemNavigationItems.normalizeSlug(slug);
|
|
2307
|
+
for (const item of items) {
|
|
2308
|
+
if (systemNavigationItems.normalizeSlug(item.slug) === normalized) return item;
|
|
2309
|
+
for (const child of item.children ?? []) {
|
|
2310
|
+
if (systemNavigationItems.normalizeSlug(child.slug) === normalized) return child;
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
return void 0;
|
|
2314
|
+
}
|
|
2315
|
+
function AppShell({
|
|
2316
|
+
appData: appDataProp,
|
|
2317
|
+
navigation: navigationProp,
|
|
2318
|
+
customPages,
|
|
2319
|
+
basePath = "/",
|
|
2320
|
+
currentSlug: controlledSlug,
|
|
2321
|
+
onNavigate: onNavigateProp,
|
|
2322
|
+
sidebarHeader,
|
|
2323
|
+
sidebarFooter,
|
|
2324
|
+
children
|
|
2325
|
+
}) {
|
|
2326
|
+
const normalizedBasePath = React2.useMemo(() => {
|
|
2327
|
+
const stripped = basePath.replace(/^\/|\/$/g, "");
|
|
2328
|
+
return stripped ? `/${stripped}` : "/";
|
|
2329
|
+
}, [basePath]);
|
|
2330
|
+
const { data: fetchedAppData, isLoading: isLoading2 } = useFluidApp({
|
|
2331
|
+
enabled: !appDataProp
|
|
2332
|
+
});
|
|
2333
|
+
const appData = appDataProp ?? fetchedAppData;
|
|
2334
|
+
const activeTheme = React2.useMemo(() => {
|
|
2335
|
+
if (!appData?.profile?.themes?.length) return void 0;
|
|
2336
|
+
const themes = appData.profile.themes;
|
|
2337
|
+
const activeId = appData.profile.activeThemeId;
|
|
2338
|
+
return activeId ? themes.find((t) => t.id === activeId) ?? themes[0] : themes[0];
|
|
2339
|
+
}, [appData?.profile?.themes, appData?.profile?.activeThemeId]);
|
|
2340
|
+
React2.useEffect(() => {
|
|
2341
|
+
if (!activeTheme) return;
|
|
2342
|
+
const resolved = theme.resolveTheme(activeTheme);
|
|
2343
|
+
theme.applyTheme(resolved);
|
|
2344
|
+
return () => {
|
|
2345
|
+
theme.removeAllThemes();
|
|
2346
|
+
};
|
|
2347
|
+
}, [activeTheme]);
|
|
2348
|
+
const navItems = React2.useMemo(() => {
|
|
2349
|
+
if (navigationProp) return navigationProp;
|
|
2350
|
+
const profileNav = appData?.profile?.navigation?.navigation_items;
|
|
2351
|
+
if (profileNav && profileNav.length > 0) return profileNav;
|
|
2352
|
+
return DEFAULT_NAVIGATION;
|
|
2353
|
+
}, [navigationProp, appData?.profile?.navigation?.navigation_items]);
|
|
2354
|
+
const mobileNavItems = React2.useMemo(() => {
|
|
2355
|
+
const mobileNav = appData?.profile?.mobile_navigation?.navigation_items;
|
|
2356
|
+
if (mobileNav && mobileNav.length > 0) return mobileNav;
|
|
2357
|
+
return navItems;
|
|
2358
|
+
}, [appData?.profile?.mobile_navigation?.navigation_items, navItems]);
|
|
2359
|
+
const screens = appData?.screens;
|
|
2360
|
+
const navSlugs = React2.useMemo(() => collectNavSlugs(navItems), [navItems]);
|
|
2361
|
+
const [themeMode, setThemeMode] = React2.useState(getInitialThemeMode);
|
|
2362
|
+
const handleThemeModeChange = React2.useCallback((mode) => {
|
|
2363
|
+
setThemeMode(mode);
|
|
2364
|
+
if (typeof window !== "undefined") {
|
|
2365
|
+
localStorage.setItem(THEME_STORAGE_KEY, mode);
|
|
2366
|
+
}
|
|
2367
|
+
}, []);
|
|
2368
|
+
const [pathSlug, setPathSlug] = React2.useState(() => {
|
|
2369
|
+
if (typeof window === "undefined") return "";
|
|
2370
|
+
return extractSlugFromPathname(
|
|
2371
|
+
window.location.pathname,
|
|
2372
|
+
normalizedBasePath
|
|
2373
|
+
);
|
|
2144
2374
|
});
|
|
2375
|
+
React2.useEffect(() => {
|
|
2376
|
+
if (controlledSlug !== void 0) return;
|
|
2377
|
+
if (typeof window === "undefined") return;
|
|
2378
|
+
const currentPath = extractSlugFromPathname(
|
|
2379
|
+
window.location.pathname,
|
|
2380
|
+
normalizedBasePath
|
|
2381
|
+
);
|
|
2382
|
+
if (!currentPath) {
|
|
2383
|
+
const firstSlug = findFirstNavigableSlug(navItems);
|
|
2384
|
+
if (firstSlug) {
|
|
2385
|
+
const targetPath = normalizedBasePath === "/" ? `/${firstSlug}` : `${normalizedBasePath}/${firstSlug}`;
|
|
2386
|
+
history.replaceState(null, "", targetPath);
|
|
2387
|
+
setPathSlug(firstSlug);
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
}, [navItems, controlledSlug, normalizedBasePath]);
|
|
2391
|
+
React2.useEffect(() => {
|
|
2392
|
+
if (controlledSlug !== void 0) return;
|
|
2393
|
+
const handlePopState = () => {
|
|
2394
|
+
const slug = extractSlugFromPathname(
|
|
2395
|
+
window.location.pathname,
|
|
2396
|
+
normalizedBasePath
|
|
2397
|
+
);
|
|
2398
|
+
setPathSlug(slug);
|
|
2399
|
+
};
|
|
2400
|
+
window.addEventListener("popstate", handlePopState);
|
|
2401
|
+
return () => window.removeEventListener("popstate", handlePopState);
|
|
2402
|
+
}, [controlledSlug, normalizedBasePath]);
|
|
2403
|
+
const activeSlug = controlledSlug ?? pathSlug;
|
|
2404
|
+
const handleNavigate = React2.useCallback(
|
|
2405
|
+
(slug) => {
|
|
2406
|
+
if (onNavigateProp) {
|
|
2407
|
+
onNavigateProp(slug);
|
|
2408
|
+
return;
|
|
2409
|
+
}
|
|
2410
|
+
const targetPath = normalizedBasePath === "/" ? `/${slug}` : `${normalizedBasePath}/${slug}`;
|
|
2411
|
+
history.pushState(null, "", targetPath);
|
|
2412
|
+
setPathSlug(slug);
|
|
2413
|
+
},
|
|
2414
|
+
[onNavigateProp, normalizedBasePath]
|
|
2415
|
+
);
|
|
2416
|
+
const slugMatch = React2.useMemo(
|
|
2417
|
+
() => matchSlugPrefix(activeSlug, navSlugs),
|
|
2418
|
+
[activeSlug, navSlugs]
|
|
2419
|
+
);
|
|
2420
|
+
const baseSlug = slugMatch?.matchedSlug ?? systemNavigationItems.normalizeSlug(activeSlug);
|
|
2421
|
+
const restParams = slugMatch?.rest ?? "";
|
|
2422
|
+
const currentSection = findCurrentSection(navItems, baseSlug);
|
|
2423
|
+
const secondLevelTabs = currentSection?.children ?? [];
|
|
2424
|
+
const mobileCurrentSection = findCurrentSection(mobileNavItems, baseSlug);
|
|
2425
|
+
const mobileSecondLevelTabs = mobileCurrentSection?.children ?? [];
|
|
2426
|
+
const currentNavItem = findNavItem(navItems, baseSlug);
|
|
2427
|
+
const content = typeof children === "function" ? children({ currentSlug: activeSlug, currentNavItem }) : children ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2428
|
+
PageRouter,
|
|
2429
|
+
{
|
|
2430
|
+
currentSlug: activeSlug,
|
|
2431
|
+
currentNavItem,
|
|
2432
|
+
customPages,
|
|
2433
|
+
screens,
|
|
2434
|
+
baseSlug,
|
|
2435
|
+
restParams
|
|
2436
|
+
}
|
|
2437
|
+
);
|
|
2438
|
+
if (isLoading2 && !appData) {
|
|
2439
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AppShellLoading, {});
|
|
2440
|
+
}
|
|
2441
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2442
|
+
ThemeModeContext.ThemeModeProvider,
|
|
2443
|
+
{
|
|
2444
|
+
mode: themeMode,
|
|
2445
|
+
onModeChange: handleThemeModeChange,
|
|
2446
|
+
autoModeEnabled: false,
|
|
2447
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2448
|
+
AppNavigationProvider,
|
|
2449
|
+
{
|
|
2450
|
+
currentSlug: activeSlug,
|
|
2451
|
+
basePath: normalizedBasePath,
|
|
2452
|
+
navigate: handleNavigate,
|
|
2453
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2454
|
+
"div",
|
|
2455
|
+
{
|
|
2456
|
+
"data-theme": activeTheme?.id,
|
|
2457
|
+
"data-theme-mode": themeMode === "auto" ? void 0 : themeMode,
|
|
2458
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2459
|
+
AppShellLayout.AppShellLayout,
|
|
2460
|
+
{
|
|
2461
|
+
sidebarContent: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2462
|
+
SdkNavigation,
|
|
2463
|
+
{
|
|
2464
|
+
navItems,
|
|
2465
|
+
currentSlug: activeSlug,
|
|
2466
|
+
onNavigate: handleNavigate,
|
|
2467
|
+
navSlugs
|
|
2468
|
+
}
|
|
2469
|
+
),
|
|
2470
|
+
headerContent: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2471
|
+
SdkHeader,
|
|
2472
|
+
{
|
|
2473
|
+
tabs: secondLevelTabs,
|
|
2474
|
+
mobileTabs: mobileSecondLevelTabs,
|
|
2475
|
+
currentSlug: activeSlug,
|
|
2476
|
+
onNavigate: handleNavigate,
|
|
2477
|
+
navSlugs
|
|
2478
|
+
}
|
|
2479
|
+
),
|
|
2480
|
+
sidebarHeader,
|
|
2481
|
+
sidebarFooter,
|
|
2482
|
+
useBottomNav: true,
|
|
2483
|
+
afterContent: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2484
|
+
SdkBottomNav,
|
|
2485
|
+
{
|
|
2486
|
+
navItems: mobileNavItems,
|
|
2487
|
+
currentSlug: activeSlug,
|
|
2488
|
+
onNavigate: handleNavigate
|
|
2489
|
+
}
|
|
2490
|
+
),
|
|
2491
|
+
children: content
|
|
2492
|
+
}
|
|
2493
|
+
)
|
|
2494
|
+
}
|
|
2495
|
+
)
|
|
2496
|
+
}
|
|
2497
|
+
)
|
|
2498
|
+
}
|
|
2499
|
+
);
|
|
2145
2500
|
}
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
var
|
|
2162
|
-
var
|
|
2163
|
-
var
|
|
2164
|
-
var
|
|
2165
|
-
var
|
|
2166
|
-
var
|
|
2167
|
-
var
|
|
2168
|
-
var
|
|
2169
|
-
var
|
|
2170
|
-
var
|
|
2171
|
-
var
|
|
2172
|
-
var
|
|
2173
|
-
var
|
|
2501
|
+
var AppLink = React2.forwardRef(
|
|
2502
|
+
function AppLink2({ to, onClick, children, ...rest }, ref) {
|
|
2503
|
+
const { navigate, buildHref } = useAppNavigation();
|
|
2504
|
+
const handleClick = (e) => {
|
|
2505
|
+
onClick?.(e);
|
|
2506
|
+
if (e.defaultPrevented) return;
|
|
2507
|
+
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
2508
|
+
if (e.button !== 0) return;
|
|
2509
|
+
if (rest.target && rest.target !== "_self") return;
|
|
2510
|
+
e.preventDefault();
|
|
2511
|
+
navigate(to);
|
|
2512
|
+
};
|
|
2513
|
+
return /* @__PURE__ */ jsxRuntime.jsx("a", { ref, href: buildHref(to), onClick: handleClick, ...rest, children });
|
|
2514
|
+
}
|
|
2515
|
+
);
|
|
2516
|
+
var export_DEFAULT_COLORS = chunkOE62VIZU_cjs.themes_exports.DEFAULT_COLORS;
|
|
2517
|
+
var export_DEFAULT_FONT_FAMILIES = chunkOE62VIZU_cjs.themes_exports.DEFAULT_FONT_FAMILIES;
|
|
2518
|
+
var export_DEFAULT_FONT_SIZES = chunkOE62VIZU_cjs.themes_exports.DEFAULT_FONT_SIZES;
|
|
2519
|
+
var export_DEFAULT_RADII = chunkOE62VIZU_cjs.themes_exports.DEFAULT_RADII;
|
|
2520
|
+
var export_DEFAULT_SPACING = chunkOE62VIZU_cjs.themes_exports.DEFAULT_SPACING;
|
|
2521
|
+
var export_DEFAULT_THEME_ID = chunkOE62VIZU_cjs.themes_exports.DEFAULT_THEME_ID;
|
|
2522
|
+
var export_DEFAULT_THEME_NAME = chunkOE62VIZU_cjs.themes_exports.DEFAULT_THEME_NAME;
|
|
2523
|
+
var export_FONT_FAMILY_KEYS = chunkOE62VIZU_cjs.themes_exports.FONT_FAMILY_KEYS;
|
|
2524
|
+
var export_FONT_SIZE_KEYS = chunkOE62VIZU_cjs.themes_exports.FONT_SIZE_KEYS;
|
|
2525
|
+
var export_RADIUS_KEYS = chunkOE62VIZU_cjs.themes_exports.RADIUS_KEYS;
|
|
2526
|
+
var export_SEMANTIC_COLOR_NAMES = chunkOE62VIZU_cjs.themes_exports.SEMANTIC_COLOR_NAMES;
|
|
2527
|
+
var export_SHADE_STEPS = chunkOE62VIZU_cjs.themes_exports.SHADE_STEPS;
|
|
2528
|
+
var export_applyTheme = chunkOE62VIZU_cjs.themes_exports.applyTheme;
|
|
2529
|
+
var export_deriveDarkVariant = chunkOE62VIZU_cjs.themes_exports.deriveDarkVariant;
|
|
2530
|
+
var export_deserialiseTheme = chunkOE62VIZU_cjs.themes_exports.deserialiseTheme;
|
|
2531
|
+
var export_generateShades = chunkOE62VIZU_cjs.themes_exports.generateShades;
|
|
2532
|
+
var export_generateThemeCSS = chunkOE62VIZU_cjs.themes_exports.generateThemeCSS;
|
|
2533
|
+
var export_getDefaultThemeDefinition = chunkOE62VIZU_cjs.themes_exports.getDefaultThemeDefinition;
|
|
2534
|
+
var export_getForegroundColor = chunkOE62VIZU_cjs.themes_exports.getForegroundColor;
|
|
2535
|
+
var export_mergeDarkOverrides = chunkOE62VIZU_cjs.themes_exports.mergeDarkOverrides;
|
|
2536
|
+
var export_parseColor = chunkOE62VIZU_cjs.themes_exports.parseColor;
|
|
2537
|
+
var export_removeAllThemes = chunkOE62VIZU_cjs.themes_exports.removeAllThemes;
|
|
2538
|
+
var export_removeTheme = chunkOE62VIZU_cjs.themes_exports.removeTheme;
|
|
2539
|
+
var export_resolveTheme = chunkOE62VIZU_cjs.themes_exports.resolveTheme;
|
|
2540
|
+
var export_serialiseTheme = chunkOE62VIZU_cjs.themes_exports.serialiseTheme;
|
|
2174
2541
|
|
|
2542
|
+
Object.defineProperty(exports, "AUTH_CONSTANTS", {
|
|
2543
|
+
enumerable: true,
|
|
2544
|
+
get: function () { return chunkOE62VIZU_cjs.AUTH_CONSTANTS; }
|
|
2545
|
+
});
|
|
2546
|
+
Object.defineProperty(exports, "ApiError", {
|
|
2547
|
+
enumerable: true,
|
|
2548
|
+
get: function () { return chunkOE62VIZU_cjs.ApiError; }
|
|
2549
|
+
});
|
|
2550
|
+
Object.defineProperty(exports, "DEFAULT_AUTH_URL", {
|
|
2551
|
+
enumerable: true,
|
|
2552
|
+
get: function () { return chunkOE62VIZU_cjs.DEFAULT_AUTH_URL; }
|
|
2553
|
+
});
|
|
2554
|
+
Object.defineProperty(exports, "DEFAULT_SDK_WIDGET_REGISTRY", {
|
|
2555
|
+
enumerable: true,
|
|
2556
|
+
get: function () { return chunkOE62VIZU_cjs.DEFAULT_SDK_WIDGET_REGISTRY; }
|
|
2557
|
+
});
|
|
2558
|
+
Object.defineProperty(exports, "FluidAuthProvider", {
|
|
2559
|
+
enumerable: true,
|
|
2560
|
+
get: function () { return chunkOE62VIZU_cjs.FluidAuthProvider; }
|
|
2561
|
+
});
|
|
2562
|
+
Object.defineProperty(exports, "FluidProvider", {
|
|
2563
|
+
enumerable: true,
|
|
2564
|
+
get: function () { return chunkOE62VIZU_cjs.FluidProvider; }
|
|
2565
|
+
});
|
|
2566
|
+
Object.defineProperty(exports, "FluidThemeProvider", {
|
|
2567
|
+
enumerable: true,
|
|
2568
|
+
get: function () { return chunkOE62VIZU_cjs.FluidThemeProvider; }
|
|
2569
|
+
});
|
|
2175
2570
|
Object.defineProperty(exports, "MessagingScreen", {
|
|
2176
2571
|
enumerable: true,
|
|
2177
|
-
get: function () { return
|
|
2572
|
+
get: function () { return chunkOE62VIZU_cjs.MessagingScreen; }
|
|
2573
|
+
});
|
|
2574
|
+
Object.defineProperty(exports, "STORAGE_KEYS", {
|
|
2575
|
+
enumerable: true,
|
|
2576
|
+
get: function () { return chunkOE62VIZU_cjs.STORAGE_KEYS; }
|
|
2577
|
+
});
|
|
2578
|
+
Object.defineProperty(exports, "URL_PARAMS", {
|
|
2579
|
+
enumerable: true,
|
|
2580
|
+
get: function () { return chunkOE62VIZU_cjs.URL_PARAMS; }
|
|
2581
|
+
});
|
|
2582
|
+
Object.defineProperty(exports, "USER_TYPES", {
|
|
2583
|
+
enumerable: true,
|
|
2584
|
+
get: function () { return chunkOE62VIZU_cjs.USER_TYPES; }
|
|
2585
|
+
});
|
|
2586
|
+
Object.defineProperty(exports, "buildThemeDefinition", {
|
|
2587
|
+
enumerable: true,
|
|
2588
|
+
get: function () { return chunkOE62VIZU_cjs.buildThemeDefinition; }
|
|
2589
|
+
});
|
|
2590
|
+
Object.defineProperty(exports, "cleanTokenFromUrl", {
|
|
2591
|
+
enumerable: true,
|
|
2592
|
+
get: function () { return chunkOE62VIZU_cjs.cleanTokenFromUrl; }
|
|
2593
|
+
});
|
|
2594
|
+
Object.defineProperty(exports, "clearTokens", {
|
|
2595
|
+
enumerable: true,
|
|
2596
|
+
get: function () { return chunkOE62VIZU_cjs.clearTokens; }
|
|
2597
|
+
});
|
|
2598
|
+
Object.defineProperty(exports, "createDefaultAuthRedirect", {
|
|
2599
|
+
enumerable: true,
|
|
2600
|
+
get: function () { return chunkOE62VIZU_cjs.createDefaultAuthRedirect; }
|
|
2601
|
+
});
|
|
2602
|
+
Object.defineProperty(exports, "createFluidClient", {
|
|
2603
|
+
enumerable: true,
|
|
2604
|
+
get: function () { return chunkOE62VIZU_cjs.createFluidClient; }
|
|
2605
|
+
});
|
|
2606
|
+
Object.defineProperty(exports, "createFluidFileUploader", {
|
|
2607
|
+
enumerable: true,
|
|
2608
|
+
get: function () { return chunkOE62VIZU_cjs.createFluidFileUploader; }
|
|
2609
|
+
});
|
|
2610
|
+
Object.defineProperty(exports, "decodeToken", {
|
|
2611
|
+
enumerable: true,
|
|
2612
|
+
get: function () { return chunkOE62VIZU_cjs.decodeToken; }
|
|
2613
|
+
});
|
|
2614
|
+
Object.defineProperty(exports, "extractAllTokensFromUrl", {
|
|
2615
|
+
enumerable: true,
|
|
2616
|
+
get: function () { return chunkOE62VIZU_cjs.extractAllTokensFromUrl; }
|
|
2617
|
+
});
|
|
2618
|
+
Object.defineProperty(exports, "extractCompanyTokenFromUrl", {
|
|
2619
|
+
enumerable: true,
|
|
2620
|
+
get: function () { return chunkOE62VIZU_cjs.extractCompanyTokenFromUrl; }
|
|
2621
|
+
});
|
|
2622
|
+
Object.defineProperty(exports, "extractTokenFromUrl", {
|
|
2623
|
+
enumerable: true,
|
|
2624
|
+
get: function () { return chunkOE62VIZU_cjs.extractTokenFromUrl; }
|
|
2625
|
+
});
|
|
2626
|
+
Object.defineProperty(exports, "getActiveThemeId", {
|
|
2627
|
+
enumerable: true,
|
|
2628
|
+
get: function () { return chunkOE62VIZU_cjs.getActiveThemeId; }
|
|
2629
|
+
});
|
|
2630
|
+
Object.defineProperty(exports, "getStoredToken", {
|
|
2631
|
+
enumerable: true,
|
|
2632
|
+
get: function () { return chunkOE62VIZU_cjs.getStoredToken; }
|
|
2633
|
+
});
|
|
2634
|
+
Object.defineProperty(exports, "getTokenExpiration", {
|
|
2635
|
+
enumerable: true,
|
|
2636
|
+
get: function () { return chunkOE62VIZU_cjs.getTokenExpiration; }
|
|
2637
|
+
});
|
|
2638
|
+
Object.defineProperty(exports, "getTokenTimeRemaining", {
|
|
2639
|
+
enumerable: true,
|
|
2640
|
+
get: function () { return chunkOE62VIZU_cjs.getTokenTimeRemaining; }
|
|
2641
|
+
});
|
|
2642
|
+
Object.defineProperty(exports, "hasStoredToken", {
|
|
2643
|
+
enumerable: true,
|
|
2644
|
+
get: function () { return chunkOE62VIZU_cjs.hasStoredToken; }
|
|
2645
|
+
});
|
|
2646
|
+
Object.defineProperty(exports, "hasTokenInUrl", {
|
|
2647
|
+
enumerable: true,
|
|
2648
|
+
get: function () { return chunkOE62VIZU_cjs.hasTokenInUrl; }
|
|
2649
|
+
});
|
|
2650
|
+
Object.defineProperty(exports, "isApiError", {
|
|
2651
|
+
enumerable: true,
|
|
2652
|
+
get: function () { return chunkOE62VIZU_cjs.isApiError; }
|
|
2653
|
+
});
|
|
2654
|
+
Object.defineProperty(exports, "isTokenExpired", {
|
|
2655
|
+
enumerable: true,
|
|
2656
|
+
get: function () { return chunkOE62VIZU_cjs.isTokenExpired; }
|
|
2657
|
+
});
|
|
2658
|
+
Object.defineProperty(exports, "isUserType", {
|
|
2659
|
+
enumerable: true,
|
|
2660
|
+
get: function () { return chunkOE62VIZU_cjs.isUserType; }
|
|
2661
|
+
});
|
|
2662
|
+
Object.defineProperty(exports, "isValidToken", {
|
|
2663
|
+
enumerable: true,
|
|
2664
|
+
get: function () { return chunkOE62VIZU_cjs.isValidToken; }
|
|
2178
2665
|
});
|
|
2179
2666
|
Object.defineProperty(exports, "messagingScreenPropertySchema", {
|
|
2180
2667
|
enumerable: true,
|
|
2181
|
-
get: function () { return
|
|
2668
|
+
get: function () { return chunkOE62VIZU_cjs.messagingScreenPropertySchema; }
|
|
2669
|
+
});
|
|
2670
|
+
Object.defineProperty(exports, "normalizeComponentTree", {
|
|
2671
|
+
enumerable: true,
|
|
2672
|
+
get: function () { return chunkOE62VIZU_cjs.normalizeComponentTree; }
|
|
2673
|
+
});
|
|
2674
|
+
Object.defineProperty(exports, "storeToken", {
|
|
2675
|
+
enumerable: true,
|
|
2676
|
+
get: function () { return chunkOE62VIZU_cjs.storeToken; }
|
|
2677
|
+
});
|
|
2678
|
+
Object.defineProperty(exports, "toNavigationItem", {
|
|
2679
|
+
enumerable: true,
|
|
2680
|
+
get: function () { return chunkOE62VIZU_cjs.toNavigationItem; }
|
|
2681
|
+
});
|
|
2682
|
+
Object.defineProperty(exports, "toScreenDefinition", {
|
|
2683
|
+
enumerable: true,
|
|
2684
|
+
get: function () { return chunkOE62VIZU_cjs.toScreenDefinition; }
|
|
2685
|
+
});
|
|
2686
|
+
Object.defineProperty(exports, "transformManifestToRepAppData", {
|
|
2687
|
+
enumerable: true,
|
|
2688
|
+
get: function () { return chunkOE62VIZU_cjs.transformManifestToRepAppData; }
|
|
2689
|
+
});
|
|
2690
|
+
Object.defineProperty(exports, "transformThemes", {
|
|
2691
|
+
enumerable: true,
|
|
2692
|
+
get: function () { return chunkOE62VIZU_cjs.transformThemes; }
|
|
2693
|
+
});
|
|
2694
|
+
Object.defineProperty(exports, "useFluidApi", {
|
|
2695
|
+
enumerable: true,
|
|
2696
|
+
get: function () { return chunkOE62VIZU_cjs.useFluidApi; }
|
|
2697
|
+
});
|
|
2698
|
+
Object.defineProperty(exports, "useFluidAuthContext", {
|
|
2699
|
+
enumerable: true,
|
|
2700
|
+
get: function () { return chunkOE62VIZU_cjs.useFluidAuthContext; }
|
|
2701
|
+
});
|
|
2702
|
+
Object.defineProperty(exports, "useFluidContext", {
|
|
2703
|
+
enumerable: true,
|
|
2704
|
+
get: function () { return chunkOE62VIZU_cjs.useFluidContext; }
|
|
2705
|
+
});
|
|
2706
|
+
Object.defineProperty(exports, "useMessagingAuth", {
|
|
2707
|
+
enumerable: true,
|
|
2708
|
+
get: function () { return chunkOE62VIZU_cjs.useMessagingAuth; }
|
|
2709
|
+
});
|
|
2710
|
+
Object.defineProperty(exports, "useMessagingConfig", {
|
|
2711
|
+
enumerable: true,
|
|
2712
|
+
get: function () { return chunkOE62VIZU_cjs.useMessagingConfig; }
|
|
2713
|
+
});
|
|
2714
|
+
Object.defineProperty(exports, "useThemeContext", {
|
|
2715
|
+
enumerable: true,
|
|
2716
|
+
get: function () { return chunkOE62VIZU_cjs.useThemeContext; }
|
|
2717
|
+
});
|
|
2718
|
+
Object.defineProperty(exports, "validateToken", {
|
|
2719
|
+
enumerable: true,
|
|
2720
|
+
get: function () { return chunkOE62VIZU_cjs.validateToken; }
|
|
2182
2721
|
});
|
|
2183
2722
|
Object.defineProperty(exports, "ContactsScreen", {
|
|
2184
2723
|
enumerable: true,
|
|
2185
|
-
get: function () { return
|
|
2724
|
+
get: function () { return chunkEOXYOOWS_cjs.ContactsScreen; }
|
|
2186
2725
|
});
|
|
2187
2726
|
Object.defineProperty(exports, "contactsScreenPropertySchema", {
|
|
2188
2727
|
enumerable: true,
|
|
2189
|
-
get: function () { return
|
|
2728
|
+
get: function () { return chunkEOXYOOWS_cjs.contactsScreenPropertySchema; }
|
|
2190
2729
|
});
|
|
2191
2730
|
Object.defineProperty(exports, "OrdersScreen", {
|
|
2192
2731
|
enumerable: true,
|
|
2193
|
-
get: function () { return
|
|
2732
|
+
get: function () { return chunkFG2CI6HA_cjs.OrdersScreen; }
|
|
2194
2733
|
});
|
|
2195
2734
|
Object.defineProperty(exports, "ordersScreenPropertySchema", {
|
|
2196
2735
|
enumerable: true,
|
|
2197
|
-
get: function () { return
|
|
2736
|
+
get: function () { return chunkFG2CI6HA_cjs.ordersScreenPropertySchema; }
|
|
2198
2737
|
});
|
|
2199
2738
|
Object.defineProperty(exports, "CustomersScreen", {
|
|
2200
2739
|
enumerable: true,
|
|
2201
|
-
get: function () { return
|
|
2740
|
+
get: function () { return chunkMHPK7YQ2_cjs.CustomersScreen; }
|
|
2202
2741
|
});
|
|
2203
2742
|
Object.defineProperty(exports, "customersScreenPropertySchema", {
|
|
2204
2743
|
enumerable: true,
|
|
2205
|
-
get: function () { return
|
|
2744
|
+
get: function () { return chunkMHPK7YQ2_cjs.customersScreenPropertySchema; }
|
|
2206
2745
|
});
|
|
2207
2746
|
Object.defineProperty(exports, "ProductsScreen", {
|
|
2208
2747
|
enumerable: true,
|
|
2209
|
-
get: function () { return
|
|
2748
|
+
get: function () { return chunk5UBEM3AX_cjs.ProductsScreen; }
|
|
2210
2749
|
});
|
|
2211
2750
|
Object.defineProperty(exports, "productsScreenPropertySchema", {
|
|
2212
2751
|
enumerable: true,
|
|
2213
|
-
get: function () { return
|
|
2752
|
+
get: function () { return chunk5UBEM3AX_cjs.productsScreenPropertySchema; }
|
|
2214
2753
|
});
|
|
2215
2754
|
Object.defineProperty(exports, "WIDGET_TYPE_NAMES", {
|
|
2216
2755
|
enumerable: true,
|
|
@@ -2420,85 +2959,82 @@ Object.defineProperty(exports, "isPropertyFieldType", {
|
|
|
2420
2959
|
enumerable: true,
|
|
2421
2960
|
get: function () { return registries.isPropertyFieldType; }
|
|
2422
2961
|
});
|
|
2962
|
+
Object.defineProperty(exports, "ThemeModeProvider", {
|
|
2963
|
+
enumerable: true,
|
|
2964
|
+
get: function () { return ThemeModeContext.ThemeModeProvider; }
|
|
2965
|
+
});
|
|
2966
|
+
Object.defineProperty(exports, "getThemeModeAttribute", {
|
|
2967
|
+
enumerable: true,
|
|
2968
|
+
get: function () { return ThemeModeContext.getThemeModeAttribute; }
|
|
2969
|
+
});
|
|
2970
|
+
Object.defineProperty(exports, "useThemeMode", {
|
|
2971
|
+
enumerable: true,
|
|
2972
|
+
get: function () { return ThemeModeContext.useThemeMode; }
|
|
2973
|
+
});
|
|
2423
2974
|
exports.ACTIVITY_SLUGS = ACTIVITY_SLUGS;
|
|
2424
|
-
exports.
|
|
2425
|
-
exports.
|
|
2975
|
+
exports.APP_DATA_QUERY_KEY = APP_DATA_QUERY_KEY;
|
|
2976
|
+
exports.AppLink = AppLink;
|
|
2977
|
+
exports.AppNavigationProvider = AppNavigationProvider;
|
|
2978
|
+
exports.AppShell = AppShell;
|
|
2426
2979
|
exports.AuthError = AuthError;
|
|
2427
2980
|
exports.AuthLoading = AuthLoading;
|
|
2428
|
-
exports.
|
|
2429
|
-
exports.CORE_COLOR_KEYS = export_CORE_COLOR_KEYS;
|
|
2981
|
+
exports.BuilderScreenView = BuilderScreenView;
|
|
2430
2982
|
exports.CORE_PAGE_IDS = CORE_PAGE_IDS;
|
|
2431
2983
|
exports.CURRENT_REP_QUERY_KEY = CURRENT_REP_QUERY_KEY;
|
|
2432
|
-
exports.
|
|
2433
|
-
exports.
|
|
2434
|
-
exports.
|
|
2435
|
-
exports.
|
|
2436
|
-
exports.
|
|
2984
|
+
exports.DEFAULT_COLORS = export_DEFAULT_COLORS;
|
|
2985
|
+
exports.DEFAULT_FONT_FAMILIES = export_DEFAULT_FONT_FAMILIES;
|
|
2986
|
+
exports.DEFAULT_FONT_SIZES = export_DEFAULT_FONT_SIZES;
|
|
2987
|
+
exports.DEFAULT_RADII = export_DEFAULT_RADII;
|
|
2988
|
+
exports.DEFAULT_SPACING = export_DEFAULT_SPACING;
|
|
2989
|
+
exports.DEFAULT_THEME_ID = export_DEFAULT_THEME_ID;
|
|
2990
|
+
exports.DEFAULT_THEME_NAME = export_DEFAULT_THEME_NAME;
|
|
2991
|
+
exports.FONT_FAMILY_KEYS = export_FONT_FAMILY_KEYS;
|
|
2992
|
+
exports.FONT_SIZE_KEYS = export_FONT_SIZE_KEYS;
|
|
2437
2993
|
exports.PAGE_CATEGORIES = PAGE_CATEGORIES;
|
|
2438
2994
|
exports.PERMISSIONS_QUERY_KEY = PERMISSIONS_QUERY_KEY;
|
|
2439
2995
|
exports.PROFILE_QUERY_KEY = PROFILE_QUERY_KEY;
|
|
2996
|
+
exports.PageRouter = PageRouter;
|
|
2440
2997
|
exports.PageTemplateProvider = PageTemplateProvider;
|
|
2441
2998
|
exports.PageTemplateRegistry = PageTemplateRegistry;
|
|
2999
|
+
exports.QuickLinksDropdown = QuickLinksDropdown;
|
|
3000
|
+
exports.RADIUS_KEYS = export_RADIUS_KEYS;
|
|
2442
3001
|
exports.RequireAuth = RequireAuth;
|
|
2443
|
-
exports.
|
|
2444
|
-
exports.
|
|
2445
|
-
exports.
|
|
2446
|
-
exports.
|
|
2447
|
-
exports.
|
|
2448
|
-
exports.
|
|
2449
|
-
exports.
|
|
2450
|
-
exports.
|
|
2451
|
-
exports.
|
|
2452
|
-
exports.
|
|
2453
|
-
exports.
|
|
2454
|
-
exports.detectThemeMode = export_detectThemeMode;
|
|
2455
|
-
exports.dracula = export_dracula;
|
|
2456
|
-
exports.everforest = export_everforest;
|
|
2457
|
-
exports.extractAllTokensFromUrl = extractAllTokensFromUrl;
|
|
2458
|
-
exports.extractCompanyTokenFromUrl = extractCompanyTokenFromUrl;
|
|
2459
|
-
exports.extractTokenFromUrl = extractTokenFromUrl;
|
|
2460
|
-
exports.generateColorSwatches = export_generateColorSwatches;
|
|
2461
|
-
exports.generateDualTheme = export_generateDualTheme;
|
|
2462
|
-
exports.generateSmartDualTheme = export_generateSmartDualTheme;
|
|
2463
|
-
exports.generateTheme = export_generateTheme;
|
|
2464
|
-
exports.generateThemeCssVars = export_generateThemeCssVars;
|
|
3002
|
+
exports.SEMANTIC_COLOR_NAMES = export_SEMANTIC_COLOR_NAMES;
|
|
3003
|
+
exports.SHADE_STEPS = export_SHADE_STEPS;
|
|
3004
|
+
exports.SdkHeader = SdkHeader;
|
|
3005
|
+
exports.SdkNavigation = SdkNavigation;
|
|
3006
|
+
exports.applyTheme = export_applyTheme;
|
|
3007
|
+
exports.collectNavSlugs = collectNavSlugs;
|
|
3008
|
+
exports.deriveDarkVariant = export_deriveDarkVariant;
|
|
3009
|
+
exports.deserialiseTheme = export_deserialiseTheme;
|
|
3010
|
+
exports.extractSlugFromPathname = extractSlugFromPathname;
|
|
3011
|
+
exports.generateShades = export_generateShades;
|
|
3012
|
+
exports.generateThemeCSS = export_generateThemeCSS;
|
|
2465
3013
|
exports.getAvailablePageTemplates = getAvailablePageTemplates;
|
|
2466
3014
|
exports.getCorePageTemplates = getCorePageTemplates;
|
|
3015
|
+
exports.getDefaultThemeDefinition = export_getDefaultThemeDefinition;
|
|
3016
|
+
exports.getForegroundColor = export_getForegroundColor;
|
|
2467
3017
|
exports.getOptionalPageTemplates = getOptionalPageTemplates;
|
|
2468
3018
|
exports.getProperty = getProperty;
|
|
2469
|
-
exports.getStoredToken = getStoredToken;
|
|
2470
|
-
exports.getTokenExpiration = getTokenExpiration;
|
|
2471
|
-
exports.getTokenTimeRemaining = getTokenTimeRemaining;
|
|
2472
|
-
exports.gruvbox = export_gruvbox;
|
|
2473
3019
|
exports.hasData = hasData;
|
|
2474
|
-
exports.hasStoredToken = hasStoredToken;
|
|
2475
|
-
exports.hasTokenInUrl = hasTokenInUrl;
|
|
2476
3020
|
exports.isActivitySlug = isActivitySlug;
|
|
2477
|
-
exports.isApiError = isApiError;
|
|
2478
3021
|
exports.isContactStatus = isContactStatus;
|
|
2479
3022
|
exports.isErrorResult = isErrorResult;
|
|
2480
3023
|
exports.isIdle = isIdle;
|
|
2481
3024
|
exports.isLoading = isLoading;
|
|
2482
|
-
exports.
|
|
2483
|
-
exports.
|
|
2484
|
-
exports.
|
|
2485
|
-
exports.
|
|
2486
|
-
exports.
|
|
2487
|
-
exports.
|
|
2488
|
-
exports.oklchString = export_oklchString;
|
|
2489
|
-
exports.parseOklch = export_parseOklch;
|
|
3025
|
+
exports.isSlugInSection = isSlugInSection;
|
|
3026
|
+
exports.matchSlugPrefix = matchSlugPrefix;
|
|
3027
|
+
exports.mergeDarkOverrides = export_mergeDarkOverrides;
|
|
3028
|
+
exports.parseColor = export_parseColor;
|
|
3029
|
+
exports.removeAllThemes = export_removeAllThemes;
|
|
3030
|
+
exports.removeTheme = export_removeTheme;
|
|
2490
3031
|
exports.resolveNavigationPages = resolveNavigationPages;
|
|
2491
|
-
exports.
|
|
2492
|
-
exports.rotateHue = export_rotateHue;
|
|
2493
|
-
exports.rotateSoft = export_rotateSoft;
|
|
3032
|
+
exports.resolveTheme = export_resolveTheme;
|
|
2494
3033
|
exports.screenPropertySchemas = screenPropertySchemas;
|
|
2495
3034
|
exports.selectProperty = selectProperty;
|
|
2496
|
-
exports.
|
|
2497
|
-
exports.storeToken = storeToken;
|
|
2498
|
-
exports.toDarkMode = export_toDarkMode;
|
|
2499
|
-
exports.toLightMode = export_toLightMode;
|
|
2500
|
-
exports.tokyoNight = export_tokyoNight;
|
|
3035
|
+
exports.serialiseTheme = export_serialiseTheme;
|
|
2501
3036
|
exports.useActivities = useActivities;
|
|
3037
|
+
exports.useAppNavigation = useAppNavigation;
|
|
2502
3038
|
exports.useCalendarEvents = useCalendarEvents;
|
|
2503
3039
|
exports.useCatchUps = useCatchUps;
|
|
2504
3040
|
exports.useContact = useContact;
|
|
@@ -2506,19 +3042,15 @@ exports.useContacts = useContacts;
|
|
|
2506
3042
|
exports.useConversationMessages = useConversationMessages;
|
|
2507
3043
|
exports.useConversations = useConversations;
|
|
2508
3044
|
exports.useCurrentRep = useCurrentRep;
|
|
2509
|
-
exports.
|
|
3045
|
+
exports.useFluidApp = useFluidApp;
|
|
2510
3046
|
exports.useFluidAuth = useFluidAuth;
|
|
2511
|
-
exports.useFluidAuthContext = useFluidAuthContext;
|
|
2512
|
-
exports.useFluidContext = useFluidContext;
|
|
2513
3047
|
exports.useFluidPermissions = useFluidPermissions;
|
|
2514
3048
|
exports.useFluidProfile = useFluidProfile;
|
|
2515
3049
|
exports.useFluidTheme = useFluidTheme;
|
|
2516
3050
|
exports.useMySite = useMySite;
|
|
2517
3051
|
exports.usePageTemplates = usePageTemplates;
|
|
2518
3052
|
exports.useResolvedPages = useResolvedPages;
|
|
2519
|
-
exports.useThemeContext = useThemeContext;
|
|
2520
3053
|
exports.useTodos = useTodos;
|
|
2521
3054
|
exports.validateNavigationPages = validateNavigationPages;
|
|
2522
|
-
exports.validateToken = validateToken;
|
|
2523
3055
|
//# sourceMappingURL=index.cjs.map
|
|
2524
3056
|
//# sourceMappingURL=index.cjs.map
|