@rqdhw3n/react-auth-flow 1.0.2 → 1.0.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/README.md +124 -62
- package/dist/index.cjs.js +449 -1195
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +32 -7
- package/dist/index.es.js +413 -1159
- package/dist/index.es.js.map +1 -1
- package/package.json +8 -2
package/dist/index.es.js
CHANGED
|
@@ -1,927 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { createContext, useReducer, useCallback, useEffect, useContext, useState } from "react";
|
|
2
3
|
import { Navigate } from "react-router-dom";
|
|
3
|
-
var jsxRuntime = { exports: {} };
|
|
4
|
-
var reactJsxRuntime_production_min = {};
|
|
5
|
-
/**
|
|
6
|
-
* @license React
|
|
7
|
-
* react-jsx-runtime.production.min.js
|
|
8
|
-
*
|
|
9
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the MIT license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/
|
|
14
|
-
var hasRequiredReactJsxRuntime_production_min;
|
|
15
|
-
function requireReactJsxRuntime_production_min() {
|
|
16
|
-
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
17
|
-
hasRequiredReactJsxRuntime_production_min = 1;
|
|
18
|
-
var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
|
|
19
|
-
function q(c, a, g) {
|
|
20
|
-
var b, d = {}, e = null, h = null;
|
|
21
|
-
void 0 !== g && (e = "" + g);
|
|
22
|
-
void 0 !== a.key && (e = "" + a.key);
|
|
23
|
-
void 0 !== a.ref && (h = a.ref);
|
|
24
|
-
for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
25
|
-
if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
|
|
26
|
-
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
|
27
|
-
}
|
|
28
|
-
reactJsxRuntime_production_min.Fragment = l;
|
|
29
|
-
reactJsxRuntime_production_min.jsx = q;
|
|
30
|
-
reactJsxRuntime_production_min.jsxs = q;
|
|
31
|
-
return reactJsxRuntime_production_min;
|
|
32
|
-
}
|
|
33
|
-
var reactJsxRuntime_development = {};
|
|
34
|
-
/**
|
|
35
|
-
* @license React
|
|
36
|
-
* react-jsx-runtime.development.js
|
|
37
|
-
*
|
|
38
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the MIT license found in the
|
|
41
|
-
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/
|
|
43
|
-
var hasRequiredReactJsxRuntime_development;
|
|
44
|
-
function requireReactJsxRuntime_development() {
|
|
45
|
-
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
46
|
-
hasRequiredReactJsxRuntime_development = 1;
|
|
47
|
-
if (process.env.NODE_ENV !== "production") {
|
|
48
|
-
(function() {
|
|
49
|
-
var React = require$$0;
|
|
50
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
|
51
|
-
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
52
|
-
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
53
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
54
|
-
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
55
|
-
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
|
56
|
-
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
57
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
58
|
-
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
59
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
|
60
|
-
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
|
61
|
-
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
62
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
63
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
64
|
-
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
65
|
-
function getIteratorFn(maybeIterable) {
|
|
66
|
-
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
70
|
-
if (typeof maybeIterator === "function") {
|
|
71
|
-
return maybeIterator;
|
|
72
|
-
}
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
76
|
-
function error(format) {
|
|
77
|
-
{
|
|
78
|
-
{
|
|
79
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
80
|
-
args[_key2 - 1] = arguments[_key2];
|
|
81
|
-
}
|
|
82
|
-
printWarning("error", format, args);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function printWarning(level, format, args) {
|
|
87
|
-
{
|
|
88
|
-
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
89
|
-
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
|
90
|
-
if (stack !== "") {
|
|
91
|
-
format += "%s";
|
|
92
|
-
args = args.concat([stack]);
|
|
93
|
-
}
|
|
94
|
-
var argsWithFormat = args.map(function(item) {
|
|
95
|
-
return String(item);
|
|
96
|
-
});
|
|
97
|
-
argsWithFormat.unshift("Warning: " + format);
|
|
98
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
var enableScopeAPI = false;
|
|
102
|
-
var enableCacheElement = false;
|
|
103
|
-
var enableTransitionTracing = false;
|
|
104
|
-
var enableLegacyHidden = false;
|
|
105
|
-
var enableDebugTracing = false;
|
|
106
|
-
var REACT_MODULE_REFERENCE;
|
|
107
|
-
{
|
|
108
|
-
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
|
109
|
-
}
|
|
110
|
-
function isValidElementType(type) {
|
|
111
|
-
if (typeof type === "string" || typeof type === "function") {
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
if (typeof type === "object" && type !== null) {
|
|
118
|
-
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
119
|
-
// types supported by any Flight configuration anywhere since
|
|
120
|
-
// we don't know which Flight build this will end up being used
|
|
121
|
-
// with.
|
|
122
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
129
|
-
var displayName = outerType.displayName;
|
|
130
|
-
if (displayName) {
|
|
131
|
-
return displayName;
|
|
132
|
-
}
|
|
133
|
-
var functionName = innerType.displayName || innerType.name || "";
|
|
134
|
-
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
135
|
-
}
|
|
136
|
-
function getContextName(type) {
|
|
137
|
-
return type.displayName || "Context";
|
|
138
|
-
}
|
|
139
|
-
function getComponentNameFromType(type) {
|
|
140
|
-
if (type == null) {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
{
|
|
144
|
-
if (typeof type.tag === "number") {
|
|
145
|
-
error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (typeof type === "function") {
|
|
149
|
-
return type.displayName || type.name || null;
|
|
150
|
-
}
|
|
151
|
-
if (typeof type === "string") {
|
|
152
|
-
return type;
|
|
153
|
-
}
|
|
154
|
-
switch (type) {
|
|
155
|
-
case REACT_FRAGMENT_TYPE:
|
|
156
|
-
return "Fragment";
|
|
157
|
-
case REACT_PORTAL_TYPE:
|
|
158
|
-
return "Portal";
|
|
159
|
-
case REACT_PROFILER_TYPE:
|
|
160
|
-
return "Profiler";
|
|
161
|
-
case REACT_STRICT_MODE_TYPE:
|
|
162
|
-
return "StrictMode";
|
|
163
|
-
case REACT_SUSPENSE_TYPE:
|
|
164
|
-
return "Suspense";
|
|
165
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
166
|
-
return "SuspenseList";
|
|
167
|
-
}
|
|
168
|
-
if (typeof type === "object") {
|
|
169
|
-
switch (type.$$typeof) {
|
|
170
|
-
case REACT_CONTEXT_TYPE:
|
|
171
|
-
var context = type;
|
|
172
|
-
return getContextName(context) + ".Consumer";
|
|
173
|
-
case REACT_PROVIDER_TYPE:
|
|
174
|
-
var provider = type;
|
|
175
|
-
return getContextName(provider._context) + ".Provider";
|
|
176
|
-
case REACT_FORWARD_REF_TYPE:
|
|
177
|
-
return getWrappedName(type, type.render, "ForwardRef");
|
|
178
|
-
case REACT_MEMO_TYPE:
|
|
179
|
-
var outerName = type.displayName || null;
|
|
180
|
-
if (outerName !== null) {
|
|
181
|
-
return outerName;
|
|
182
|
-
}
|
|
183
|
-
return getComponentNameFromType(type.type) || "Memo";
|
|
184
|
-
case REACT_LAZY_TYPE: {
|
|
185
|
-
var lazyComponent = type;
|
|
186
|
-
var payload = lazyComponent._payload;
|
|
187
|
-
var init = lazyComponent._init;
|
|
188
|
-
try {
|
|
189
|
-
return getComponentNameFromType(init(payload));
|
|
190
|
-
} catch (x) {
|
|
191
|
-
return null;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
var assign = Object.assign;
|
|
199
|
-
var disabledDepth = 0;
|
|
200
|
-
var prevLog;
|
|
201
|
-
var prevInfo;
|
|
202
|
-
var prevWarn;
|
|
203
|
-
var prevError;
|
|
204
|
-
var prevGroup;
|
|
205
|
-
var prevGroupCollapsed;
|
|
206
|
-
var prevGroupEnd;
|
|
207
|
-
function disabledLog() {
|
|
208
|
-
}
|
|
209
|
-
disabledLog.__reactDisabledLog = true;
|
|
210
|
-
function disableLogs() {
|
|
211
|
-
{
|
|
212
|
-
if (disabledDepth === 0) {
|
|
213
|
-
prevLog = console.log;
|
|
214
|
-
prevInfo = console.info;
|
|
215
|
-
prevWarn = console.warn;
|
|
216
|
-
prevError = console.error;
|
|
217
|
-
prevGroup = console.group;
|
|
218
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
219
|
-
prevGroupEnd = console.groupEnd;
|
|
220
|
-
var props = {
|
|
221
|
-
configurable: true,
|
|
222
|
-
enumerable: true,
|
|
223
|
-
value: disabledLog,
|
|
224
|
-
writable: true
|
|
225
|
-
};
|
|
226
|
-
Object.defineProperties(console, {
|
|
227
|
-
info: props,
|
|
228
|
-
log: props,
|
|
229
|
-
warn: props,
|
|
230
|
-
error: props,
|
|
231
|
-
group: props,
|
|
232
|
-
groupCollapsed: props,
|
|
233
|
-
groupEnd: props
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
disabledDepth++;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function reenableLogs() {
|
|
240
|
-
{
|
|
241
|
-
disabledDepth--;
|
|
242
|
-
if (disabledDepth === 0) {
|
|
243
|
-
var props = {
|
|
244
|
-
configurable: true,
|
|
245
|
-
enumerable: true,
|
|
246
|
-
writable: true
|
|
247
|
-
};
|
|
248
|
-
Object.defineProperties(console, {
|
|
249
|
-
log: assign({}, props, {
|
|
250
|
-
value: prevLog
|
|
251
|
-
}),
|
|
252
|
-
info: assign({}, props, {
|
|
253
|
-
value: prevInfo
|
|
254
|
-
}),
|
|
255
|
-
warn: assign({}, props, {
|
|
256
|
-
value: prevWarn
|
|
257
|
-
}),
|
|
258
|
-
error: assign({}, props, {
|
|
259
|
-
value: prevError
|
|
260
|
-
}),
|
|
261
|
-
group: assign({}, props, {
|
|
262
|
-
value: prevGroup
|
|
263
|
-
}),
|
|
264
|
-
groupCollapsed: assign({}, props, {
|
|
265
|
-
value: prevGroupCollapsed
|
|
266
|
-
}),
|
|
267
|
-
groupEnd: assign({}, props, {
|
|
268
|
-
value: prevGroupEnd
|
|
269
|
-
})
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
if (disabledDepth < 0) {
|
|
273
|
-
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
278
|
-
var prefix;
|
|
279
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
280
|
-
{
|
|
281
|
-
if (prefix === void 0) {
|
|
282
|
-
try {
|
|
283
|
-
throw Error();
|
|
284
|
-
} catch (x) {
|
|
285
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
286
|
-
prefix = match && match[1] || "";
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return "\n" + prefix + name;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
var reentry = false;
|
|
293
|
-
var componentFrameCache;
|
|
294
|
-
{
|
|
295
|
-
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
|
296
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
297
|
-
}
|
|
298
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
299
|
-
if (!fn || reentry) {
|
|
300
|
-
return "";
|
|
301
|
-
}
|
|
302
|
-
{
|
|
303
|
-
var frame = componentFrameCache.get(fn);
|
|
304
|
-
if (frame !== void 0) {
|
|
305
|
-
return frame;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
var control;
|
|
309
|
-
reentry = true;
|
|
310
|
-
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
311
|
-
Error.prepareStackTrace = void 0;
|
|
312
|
-
var previousDispatcher;
|
|
313
|
-
{
|
|
314
|
-
previousDispatcher = ReactCurrentDispatcher.current;
|
|
315
|
-
ReactCurrentDispatcher.current = null;
|
|
316
|
-
disableLogs();
|
|
317
|
-
}
|
|
318
|
-
try {
|
|
319
|
-
if (construct) {
|
|
320
|
-
var Fake = function() {
|
|
321
|
-
throw Error();
|
|
322
|
-
};
|
|
323
|
-
Object.defineProperty(Fake.prototype, "props", {
|
|
324
|
-
set: function() {
|
|
325
|
-
throw Error();
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
if (typeof Reflect === "object" && Reflect.construct) {
|
|
329
|
-
try {
|
|
330
|
-
Reflect.construct(Fake, []);
|
|
331
|
-
} catch (x) {
|
|
332
|
-
control = x;
|
|
333
|
-
}
|
|
334
|
-
Reflect.construct(fn, [], Fake);
|
|
335
|
-
} else {
|
|
336
|
-
try {
|
|
337
|
-
Fake.call();
|
|
338
|
-
} catch (x) {
|
|
339
|
-
control = x;
|
|
340
|
-
}
|
|
341
|
-
fn.call(Fake.prototype);
|
|
342
|
-
}
|
|
343
|
-
} else {
|
|
344
|
-
try {
|
|
345
|
-
throw Error();
|
|
346
|
-
} catch (x) {
|
|
347
|
-
control = x;
|
|
348
|
-
}
|
|
349
|
-
fn();
|
|
350
|
-
}
|
|
351
|
-
} catch (sample) {
|
|
352
|
-
if (sample && control && typeof sample.stack === "string") {
|
|
353
|
-
var sampleLines = sample.stack.split("\n");
|
|
354
|
-
var controlLines = control.stack.split("\n");
|
|
355
|
-
var s = sampleLines.length - 1;
|
|
356
|
-
var c = controlLines.length - 1;
|
|
357
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
358
|
-
c--;
|
|
359
|
-
}
|
|
360
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
361
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
362
|
-
if (s !== 1 || c !== 1) {
|
|
363
|
-
do {
|
|
364
|
-
s--;
|
|
365
|
-
c--;
|
|
366
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
367
|
-
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
|
368
|
-
if (fn.displayName && _frame.includes("<anonymous>")) {
|
|
369
|
-
_frame = _frame.replace("<anonymous>", fn.displayName);
|
|
370
|
-
}
|
|
371
|
-
{
|
|
372
|
-
if (typeof fn === "function") {
|
|
373
|
-
componentFrameCache.set(fn, _frame);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
return _frame;
|
|
377
|
-
}
|
|
378
|
-
} while (s >= 1 && c >= 0);
|
|
379
|
-
}
|
|
380
|
-
break;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
} finally {
|
|
385
|
-
reentry = false;
|
|
386
|
-
{
|
|
387
|
-
ReactCurrentDispatcher.current = previousDispatcher;
|
|
388
|
-
reenableLogs();
|
|
389
|
-
}
|
|
390
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
391
|
-
}
|
|
392
|
-
var name = fn ? fn.displayName || fn.name : "";
|
|
393
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
394
|
-
{
|
|
395
|
-
if (typeof fn === "function") {
|
|
396
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
return syntheticFrame;
|
|
400
|
-
}
|
|
401
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
402
|
-
{
|
|
403
|
-
return describeNativeComponentFrame(fn, false);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
function shouldConstruct(Component) {
|
|
407
|
-
var prototype = Component.prototype;
|
|
408
|
-
return !!(prototype && prototype.isReactComponent);
|
|
409
|
-
}
|
|
410
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
411
|
-
if (type == null) {
|
|
412
|
-
return "";
|
|
413
|
-
}
|
|
414
|
-
if (typeof type === "function") {
|
|
415
|
-
{
|
|
416
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
if (typeof type === "string") {
|
|
420
|
-
return describeBuiltInComponentFrame(type);
|
|
421
|
-
}
|
|
422
|
-
switch (type) {
|
|
423
|
-
case REACT_SUSPENSE_TYPE:
|
|
424
|
-
return describeBuiltInComponentFrame("Suspense");
|
|
425
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
426
|
-
return describeBuiltInComponentFrame("SuspenseList");
|
|
427
|
-
}
|
|
428
|
-
if (typeof type === "object") {
|
|
429
|
-
switch (type.$$typeof) {
|
|
430
|
-
case REACT_FORWARD_REF_TYPE:
|
|
431
|
-
return describeFunctionComponentFrame(type.render);
|
|
432
|
-
case REACT_MEMO_TYPE:
|
|
433
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
434
|
-
case REACT_LAZY_TYPE: {
|
|
435
|
-
var lazyComponent = type;
|
|
436
|
-
var payload = lazyComponent._payload;
|
|
437
|
-
var init = lazyComponent._init;
|
|
438
|
-
try {
|
|
439
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
440
|
-
} catch (x) {
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
return "";
|
|
446
|
-
}
|
|
447
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
448
|
-
var loggedTypeFailures = {};
|
|
449
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
450
|
-
function setCurrentlyValidatingElement(element) {
|
|
451
|
-
{
|
|
452
|
-
if (element) {
|
|
453
|
-
var owner = element._owner;
|
|
454
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
455
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
456
|
-
} else {
|
|
457
|
-
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
462
|
-
{
|
|
463
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
464
|
-
for (var typeSpecName in typeSpecs) {
|
|
465
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
466
|
-
var error$1 = void 0;
|
|
467
|
-
try {
|
|
468
|
-
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
469
|
-
var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
470
|
-
err.name = "Invariant Violation";
|
|
471
|
-
throw err;
|
|
472
|
-
}
|
|
473
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
474
|
-
} catch (ex) {
|
|
475
|
-
error$1 = ex;
|
|
476
|
-
}
|
|
477
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
478
|
-
setCurrentlyValidatingElement(element);
|
|
479
|
-
error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
|
|
480
|
-
setCurrentlyValidatingElement(null);
|
|
481
|
-
}
|
|
482
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
483
|
-
loggedTypeFailures[error$1.message] = true;
|
|
484
|
-
setCurrentlyValidatingElement(element);
|
|
485
|
-
error("Failed %s type: %s", location, error$1.message);
|
|
486
|
-
setCurrentlyValidatingElement(null);
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
var isArrayImpl = Array.isArray;
|
|
493
|
-
function isArray(a) {
|
|
494
|
-
return isArrayImpl(a);
|
|
495
|
-
}
|
|
496
|
-
function typeName(value) {
|
|
497
|
-
{
|
|
498
|
-
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
|
499
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
500
|
-
return type;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
function willCoercionThrow(value) {
|
|
504
|
-
{
|
|
505
|
-
try {
|
|
506
|
-
testStringCoercion(value);
|
|
507
|
-
return false;
|
|
508
|
-
} catch (e) {
|
|
509
|
-
return true;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
function testStringCoercion(value) {
|
|
514
|
-
return "" + value;
|
|
515
|
-
}
|
|
516
|
-
function checkKeyStringCoercion(value) {
|
|
517
|
-
{
|
|
518
|
-
if (willCoercionThrow(value)) {
|
|
519
|
-
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
520
|
-
return testStringCoercion(value);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
525
|
-
var RESERVED_PROPS = {
|
|
526
|
-
key: true,
|
|
527
|
-
ref: true,
|
|
528
|
-
__self: true,
|
|
529
|
-
__source: true
|
|
530
|
-
};
|
|
531
|
-
var specialPropKeyWarningShown;
|
|
532
|
-
var specialPropRefWarningShown;
|
|
533
|
-
function hasValidRef(config) {
|
|
534
|
-
{
|
|
535
|
-
if (hasOwnProperty.call(config, "ref")) {
|
|
536
|
-
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
|
537
|
-
if (getter && getter.isReactWarning) {
|
|
538
|
-
return false;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
return config.ref !== void 0;
|
|
543
|
-
}
|
|
544
|
-
function hasValidKey(config) {
|
|
545
|
-
{
|
|
546
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
547
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
548
|
-
if (getter && getter.isReactWarning) {
|
|
549
|
-
return false;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
return config.key !== void 0;
|
|
554
|
-
}
|
|
555
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
556
|
-
{
|
|
557
|
-
if (typeof config.ref === "string" && ReactCurrentOwner.current && self) ;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
561
|
-
{
|
|
562
|
-
var warnAboutAccessingKey = function() {
|
|
563
|
-
if (!specialPropKeyWarningShown) {
|
|
564
|
-
specialPropKeyWarningShown = true;
|
|
565
|
-
error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
566
|
-
}
|
|
567
|
-
};
|
|
568
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
569
|
-
Object.defineProperty(props, "key", {
|
|
570
|
-
get: warnAboutAccessingKey,
|
|
571
|
-
configurable: true
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
576
|
-
{
|
|
577
|
-
var warnAboutAccessingRef = function() {
|
|
578
|
-
if (!specialPropRefWarningShown) {
|
|
579
|
-
specialPropRefWarningShown = true;
|
|
580
|
-
error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
584
|
-
Object.defineProperty(props, "ref", {
|
|
585
|
-
get: warnAboutAccessingRef,
|
|
586
|
-
configurable: true
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
|
591
|
-
var element = {
|
|
592
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
593
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
594
|
-
// Built-in properties that belong on the element
|
|
595
|
-
type,
|
|
596
|
-
key,
|
|
597
|
-
ref,
|
|
598
|
-
props,
|
|
599
|
-
// Record the component responsible for creating this element.
|
|
600
|
-
_owner: owner
|
|
601
|
-
};
|
|
602
|
-
{
|
|
603
|
-
element._store = {};
|
|
604
|
-
Object.defineProperty(element._store, "validated", {
|
|
605
|
-
configurable: false,
|
|
606
|
-
enumerable: false,
|
|
607
|
-
writable: true,
|
|
608
|
-
value: false
|
|
609
|
-
});
|
|
610
|
-
Object.defineProperty(element, "_self", {
|
|
611
|
-
configurable: false,
|
|
612
|
-
enumerable: false,
|
|
613
|
-
writable: false,
|
|
614
|
-
value: self
|
|
615
|
-
});
|
|
616
|
-
Object.defineProperty(element, "_source", {
|
|
617
|
-
configurable: false,
|
|
618
|
-
enumerable: false,
|
|
619
|
-
writable: false,
|
|
620
|
-
value: source
|
|
621
|
-
});
|
|
622
|
-
if (Object.freeze) {
|
|
623
|
-
Object.freeze(element.props);
|
|
624
|
-
Object.freeze(element);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
return element;
|
|
628
|
-
};
|
|
629
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
630
|
-
{
|
|
631
|
-
var propName;
|
|
632
|
-
var props = {};
|
|
633
|
-
var key = null;
|
|
634
|
-
var ref = null;
|
|
635
|
-
if (maybeKey !== void 0) {
|
|
636
|
-
{
|
|
637
|
-
checkKeyStringCoercion(maybeKey);
|
|
638
|
-
}
|
|
639
|
-
key = "" + maybeKey;
|
|
640
|
-
}
|
|
641
|
-
if (hasValidKey(config)) {
|
|
642
|
-
{
|
|
643
|
-
checkKeyStringCoercion(config.key);
|
|
644
|
-
}
|
|
645
|
-
key = "" + config.key;
|
|
646
|
-
}
|
|
647
|
-
if (hasValidRef(config)) {
|
|
648
|
-
ref = config.ref;
|
|
649
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
650
|
-
}
|
|
651
|
-
for (propName in config) {
|
|
652
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
653
|
-
props[propName] = config[propName];
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
if (type && type.defaultProps) {
|
|
657
|
-
var defaultProps = type.defaultProps;
|
|
658
|
-
for (propName in defaultProps) {
|
|
659
|
-
if (props[propName] === void 0) {
|
|
660
|
-
props[propName] = defaultProps[propName];
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
if (key || ref) {
|
|
665
|
-
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
|
666
|
-
if (key) {
|
|
667
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
668
|
-
}
|
|
669
|
-
if (ref) {
|
|
670
|
-
defineRefPropWarningGetter(props, displayName);
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
677
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
678
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
679
|
-
{
|
|
680
|
-
if (element) {
|
|
681
|
-
var owner = element._owner;
|
|
682
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
683
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
684
|
-
} else {
|
|
685
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
var propTypesMisspellWarningShown;
|
|
690
|
-
{
|
|
691
|
-
propTypesMisspellWarningShown = false;
|
|
692
|
-
}
|
|
693
|
-
function isValidElement(object) {
|
|
694
|
-
{
|
|
695
|
-
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
function getDeclarationErrorAddendum() {
|
|
699
|
-
{
|
|
700
|
-
if (ReactCurrentOwner$1.current) {
|
|
701
|
-
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
702
|
-
if (name) {
|
|
703
|
-
return "\n\nCheck the render method of `" + name + "`.";
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
return "";
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
function getSourceInfoErrorAddendum(source) {
|
|
710
|
-
{
|
|
711
|
-
return "";
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
var ownerHasKeyUseWarning = {};
|
|
715
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
716
|
-
{
|
|
717
|
-
var info = getDeclarationErrorAddendum();
|
|
718
|
-
if (!info) {
|
|
719
|
-
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
|
720
|
-
if (parentName) {
|
|
721
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
return info;
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
function validateExplicitKey(element, parentType) {
|
|
728
|
-
{
|
|
729
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
730
|
-
return;
|
|
731
|
-
}
|
|
732
|
-
element._store.validated = true;
|
|
733
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
734
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
735
|
-
return;
|
|
736
|
-
}
|
|
737
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
738
|
-
var childOwner = "";
|
|
739
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
740
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
741
|
-
}
|
|
742
|
-
setCurrentlyValidatingElement$1(element);
|
|
743
|
-
error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
744
|
-
setCurrentlyValidatingElement$1(null);
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
function validateChildKeys(node, parentType) {
|
|
748
|
-
{
|
|
749
|
-
if (typeof node !== "object") {
|
|
750
|
-
return;
|
|
751
|
-
}
|
|
752
|
-
if (isArray(node)) {
|
|
753
|
-
for (var i = 0; i < node.length; i++) {
|
|
754
|
-
var child = node[i];
|
|
755
|
-
if (isValidElement(child)) {
|
|
756
|
-
validateExplicitKey(child, parentType);
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
} else if (isValidElement(node)) {
|
|
760
|
-
if (node._store) {
|
|
761
|
-
node._store.validated = true;
|
|
762
|
-
}
|
|
763
|
-
} else if (node) {
|
|
764
|
-
var iteratorFn = getIteratorFn(node);
|
|
765
|
-
if (typeof iteratorFn === "function") {
|
|
766
|
-
if (iteratorFn !== node.entries) {
|
|
767
|
-
var iterator = iteratorFn.call(node);
|
|
768
|
-
var step;
|
|
769
|
-
while (!(step = iterator.next()).done) {
|
|
770
|
-
if (isValidElement(step.value)) {
|
|
771
|
-
validateExplicitKey(step.value, parentType);
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
function validatePropTypes(element) {
|
|
780
|
-
{
|
|
781
|
-
var type = element.type;
|
|
782
|
-
if (type === null || type === void 0 || typeof type === "string") {
|
|
783
|
-
return;
|
|
784
|
-
}
|
|
785
|
-
var propTypes;
|
|
786
|
-
if (typeof type === "function") {
|
|
787
|
-
propTypes = type.propTypes;
|
|
788
|
-
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
789
|
-
// Inner props are checked in the reconciler.
|
|
790
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
791
|
-
propTypes = type.propTypes;
|
|
792
|
-
} else {
|
|
793
|
-
return;
|
|
794
|
-
}
|
|
795
|
-
if (propTypes) {
|
|
796
|
-
var name = getComponentNameFromType(type);
|
|
797
|
-
checkPropTypes(propTypes, element.props, "prop", name, element);
|
|
798
|
-
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
|
799
|
-
propTypesMisspellWarningShown = true;
|
|
800
|
-
var _name = getComponentNameFromType(type);
|
|
801
|
-
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
|
802
|
-
}
|
|
803
|
-
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
|
804
|
-
error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
function validateFragmentProps(fragment) {
|
|
809
|
-
{
|
|
810
|
-
var keys = Object.keys(fragment.props);
|
|
811
|
-
for (var i = 0; i < keys.length; i++) {
|
|
812
|
-
var key = keys[i];
|
|
813
|
-
if (key !== "children" && key !== "key") {
|
|
814
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
815
|
-
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
|
816
|
-
setCurrentlyValidatingElement$1(null);
|
|
817
|
-
break;
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
if (fragment.ref !== null) {
|
|
821
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
822
|
-
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
|
823
|
-
setCurrentlyValidatingElement$1(null);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
var didWarnAboutKeySpread = {};
|
|
828
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
829
|
-
{
|
|
830
|
-
var validType = isValidElementType(type);
|
|
831
|
-
if (!validType) {
|
|
832
|
-
var info = "";
|
|
833
|
-
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
|
834
|
-
info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
|
|
835
|
-
}
|
|
836
|
-
var sourceInfo = getSourceInfoErrorAddendum();
|
|
837
|
-
if (sourceInfo) {
|
|
838
|
-
info += sourceInfo;
|
|
839
|
-
} else {
|
|
840
|
-
info += getDeclarationErrorAddendum();
|
|
841
|
-
}
|
|
842
|
-
var typeString;
|
|
843
|
-
if (type === null) {
|
|
844
|
-
typeString = "null";
|
|
845
|
-
} else if (isArray(type)) {
|
|
846
|
-
typeString = "array";
|
|
847
|
-
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
848
|
-
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
|
849
|
-
info = " Did you accidentally export a JSX literal instead of a component?";
|
|
850
|
-
} else {
|
|
851
|
-
typeString = typeof type;
|
|
852
|
-
}
|
|
853
|
-
error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
|
|
854
|
-
}
|
|
855
|
-
var element = jsxDEV(type, props, key, source, self);
|
|
856
|
-
if (element == null) {
|
|
857
|
-
return element;
|
|
858
|
-
}
|
|
859
|
-
if (validType) {
|
|
860
|
-
var children = props.children;
|
|
861
|
-
if (children !== void 0) {
|
|
862
|
-
if (isStaticChildren) {
|
|
863
|
-
if (isArray(children)) {
|
|
864
|
-
for (var i = 0; i < children.length; i++) {
|
|
865
|
-
validateChildKeys(children[i], type);
|
|
866
|
-
}
|
|
867
|
-
if (Object.freeze) {
|
|
868
|
-
Object.freeze(children);
|
|
869
|
-
}
|
|
870
|
-
} else {
|
|
871
|
-
error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
872
|
-
}
|
|
873
|
-
} else {
|
|
874
|
-
validateChildKeys(children, type);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
{
|
|
879
|
-
if (hasOwnProperty.call(props, "key")) {
|
|
880
|
-
var componentName = getComponentNameFromType(type);
|
|
881
|
-
var keys = Object.keys(props).filter(function(k) {
|
|
882
|
-
return k !== "key";
|
|
883
|
-
});
|
|
884
|
-
var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
885
|
-
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
886
|
-
var afterExample = keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}";
|
|
887
|
-
error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
|
888
|
-
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
893
|
-
validateFragmentProps(element);
|
|
894
|
-
} else {
|
|
895
|
-
validatePropTypes(element);
|
|
896
|
-
}
|
|
897
|
-
return element;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
901
|
-
{
|
|
902
|
-
return jsxWithValidation(type, props, key, true);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
function jsxWithValidationDynamic(type, props, key) {
|
|
906
|
-
{
|
|
907
|
-
return jsxWithValidation(type, props, key, false);
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
var jsx = jsxWithValidationDynamic;
|
|
911
|
-
var jsxs = jsxWithValidationStatic;
|
|
912
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
913
|
-
reactJsxRuntime_development.jsx = jsx;
|
|
914
|
-
reactJsxRuntime_development.jsxs = jsxs;
|
|
915
|
-
})();
|
|
916
|
-
}
|
|
917
|
-
return reactJsxRuntime_development;
|
|
918
|
-
}
|
|
919
|
-
if (process.env.NODE_ENV === "production") {
|
|
920
|
-
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
921
|
-
} else {
|
|
922
|
-
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
923
|
-
}
|
|
924
|
-
var jsxRuntimeExports = jsxRuntime.exports;
|
|
925
4
|
const AuthContext = createContext(
|
|
926
5
|
void 0
|
|
927
6
|
);
|
|
@@ -1157,7 +236,7 @@ const AuthProvider = ({
|
|
|
1157
236
|
// 5 minutes
|
|
1158
237
|
}) => {
|
|
1159
238
|
const [state, dispatch] = useReducer(authReducer, initialState);
|
|
1160
|
-
const clientRef =
|
|
239
|
+
const clientRef = React.useRef(
|
|
1161
240
|
createAuthClient({
|
|
1162
241
|
baseURL,
|
|
1163
242
|
endpoints,
|
|
@@ -1315,7 +394,7 @@ const AuthProvider = ({
|
|
|
1315
394
|
restoreSession,
|
|
1316
395
|
setUser
|
|
1317
396
|
};
|
|
1318
|
-
return /* @__PURE__ */
|
|
397
|
+
return /* @__PURE__ */ jsx(AuthContext.Provider, { value, children });
|
|
1319
398
|
};
|
|
1320
399
|
function useAuth() {
|
|
1321
400
|
const context = useContext(AuthContext);
|
|
@@ -1324,11 +403,36 @@ function useAuth() {
|
|
|
1324
403
|
}
|
|
1325
404
|
return context;
|
|
1326
405
|
}
|
|
406
|
+
function cn(...classes) {
|
|
407
|
+
return classes.filter(Boolean).join(" ");
|
|
408
|
+
}
|
|
409
|
+
const DEFAULT_CLASSES$4 = {
|
|
410
|
+
form: "space-y-5",
|
|
411
|
+
field: "space-y-2",
|
|
412
|
+
label: "block text-sm font-medium text-slate-700",
|
|
413
|
+
input: "w-full rounded-xl border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 disabled:cursor-not-allowed disabled:bg-slate-100",
|
|
414
|
+
button: "w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60",
|
|
415
|
+
error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
|
|
416
|
+
title: "text-2xl font-bold text-slate-900",
|
|
417
|
+
subtitle: "mt-1 text-sm text-slate-500"
|
|
418
|
+
};
|
|
1327
419
|
const LoginForm = ({
|
|
1328
|
-
className
|
|
420
|
+
className,
|
|
421
|
+
formClassName,
|
|
422
|
+
fieldClassName,
|
|
423
|
+
labelClassName,
|
|
424
|
+
inputClassName,
|
|
425
|
+
buttonClassName,
|
|
426
|
+
errorClassName,
|
|
427
|
+
titleClassName,
|
|
428
|
+
subtitleClassName,
|
|
1329
429
|
labels = {},
|
|
1330
430
|
placeholders = {},
|
|
1331
431
|
submitButtonText = "Login",
|
|
432
|
+
loadingText = "Signing in...",
|
|
433
|
+
title,
|
|
434
|
+
subtitle,
|
|
435
|
+
showTitle = !!title,
|
|
1332
436
|
onSuccess,
|
|
1333
437
|
onError
|
|
1334
438
|
}) => {
|
|
@@ -1358,71 +462,106 @@ const LoginForm = ({
|
|
|
1358
462
|
});
|
|
1359
463
|
}
|
|
1360
464
|
};
|
|
1361
|
-
return /* @__PURE__ */
|
|
1362
|
-
/* @__PURE__ */
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
/* @__PURE__ */
|
|
1365
|
-
"input",
|
|
1366
|
-
{
|
|
1367
|
-
id: "email",
|
|
1368
|
-
type: "email",
|
|
1369
|
-
value: email,
|
|
1370
|
-
onChange: (e) => setEmail(e.target.value),
|
|
1371
|
-
placeholder: placeholders.email || "your@email.com",
|
|
1372
|
-
disabled: isLoading,
|
|
1373
|
-
className: "auth-form-input",
|
|
1374
|
-
required: true
|
|
1375
|
-
}
|
|
1376
|
-
)
|
|
465
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
466
|
+
showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
467
|
+
/* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$4.title, titleClassName), children: title }),
|
|
468
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$4.subtitle, subtitleClassName), children: subtitle })
|
|
1377
469
|
] }),
|
|
1378
|
-
/* @__PURE__ */
|
|
1379
|
-
/* @__PURE__ */
|
|
1380
|
-
|
|
1381
|
-
|
|
470
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$4.form, formClassName), children: [
|
|
471
|
+
/* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$4.field, fieldClassName), children: [
|
|
472
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES$4.label, labelClassName), children: labels.email || "Email" }),
|
|
473
|
+
/* @__PURE__ */ jsx(
|
|
474
|
+
"input",
|
|
475
|
+
{
|
|
476
|
+
id: "email",
|
|
477
|
+
type: "email",
|
|
478
|
+
value: email,
|
|
479
|
+
onChange: (e) => setEmail(e.target.value),
|
|
480
|
+
placeholder: placeholders.email || "your@email.com",
|
|
481
|
+
disabled: isLoading,
|
|
482
|
+
className: cn(DEFAULT_CLASSES$4.input, inputClassName),
|
|
483
|
+
required: true
|
|
484
|
+
}
|
|
485
|
+
)
|
|
486
|
+
] }),
|
|
487
|
+
/* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$4.field, fieldClassName), children: [
|
|
488
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "password", className: cn(DEFAULT_CLASSES$4.label, labelClassName), children: labels.password || "Password" }),
|
|
489
|
+
/* @__PURE__ */ jsx(
|
|
490
|
+
"input",
|
|
491
|
+
{
|
|
492
|
+
id: "password",
|
|
493
|
+
type: "password",
|
|
494
|
+
value: password,
|
|
495
|
+
onChange: (e) => setPassword(e.target.value),
|
|
496
|
+
placeholder: placeholders.password || "••••••••",
|
|
497
|
+
disabled: isLoading,
|
|
498
|
+
className: cn(DEFAULT_CLASSES$4.input, inputClassName),
|
|
499
|
+
required: true
|
|
500
|
+
}
|
|
501
|
+
)
|
|
502
|
+
] }),
|
|
503
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
504
|
+
/* @__PURE__ */ jsx(
|
|
505
|
+
"input",
|
|
506
|
+
{
|
|
507
|
+
id: "rememberMe",
|
|
508
|
+
type: "checkbox",
|
|
509
|
+
checked: rememberMe,
|
|
510
|
+
onChange: (e) => setRememberMe(e.target.checked),
|
|
511
|
+
disabled: isLoading,
|
|
512
|
+
className: "h-4 w-4 rounded border-slate-300"
|
|
513
|
+
}
|
|
514
|
+
),
|
|
515
|
+
/* @__PURE__ */ jsx(
|
|
516
|
+
"label",
|
|
517
|
+
{
|
|
518
|
+
htmlFor: "rememberMe",
|
|
519
|
+
className: "ml-2 text-sm text-slate-700",
|
|
520
|
+
children: labels.rememberMe || "Remember me"
|
|
521
|
+
}
|
|
522
|
+
)
|
|
523
|
+
] }),
|
|
524
|
+
error && /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$4.error, errorClassName), children: error }),
|
|
525
|
+
/* @__PURE__ */ jsx(
|
|
526
|
+
"button",
|
|
1382
527
|
{
|
|
1383
|
-
|
|
1384
|
-
type: "password",
|
|
1385
|
-
value: password,
|
|
1386
|
-
onChange: (e) => setPassword(e.target.value),
|
|
1387
|
-
placeholder: placeholders.password || "••••••••",
|
|
528
|
+
type: "submit",
|
|
1388
529
|
disabled: isLoading,
|
|
1389
|
-
className:
|
|
1390
|
-
|
|
530
|
+
className: cn(DEFAULT_CLASSES$4.button, buttonClassName),
|
|
531
|
+
children: isLoading ? loadingText : submitButtonText
|
|
1391
532
|
}
|
|
1392
533
|
)
|
|
1393
|
-
] })
|
|
1394
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "auth-form-group auth-form-checkbox", children: [
|
|
1395
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1396
|
-
"input",
|
|
1397
|
-
{
|
|
1398
|
-
id: "rememberMe",
|
|
1399
|
-
type: "checkbox",
|
|
1400
|
-
checked: rememberMe,
|
|
1401
|
-
onChange: (e) => setRememberMe(e.target.checked),
|
|
1402
|
-
disabled: isLoading,
|
|
1403
|
-
className: "auth-form-input"
|
|
1404
|
-
}
|
|
1405
|
-
),
|
|
1406
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "rememberMe", className: "auth-form-label", children: labels.rememberMe || "Remember me" })
|
|
1407
|
-
] }),
|
|
1408
|
-
error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "auth-form-error", children: error }),
|
|
1409
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1410
|
-
"button",
|
|
1411
|
-
{
|
|
1412
|
-
type: "submit",
|
|
1413
|
-
disabled: isLoading,
|
|
1414
|
-
className: "auth-form-button auth-form-button-primary",
|
|
1415
|
-
children: isLoading ? "Loading..." : submitButtonText
|
|
1416
|
-
}
|
|
1417
|
-
)
|
|
534
|
+
] })
|
|
1418
535
|
] });
|
|
1419
536
|
};
|
|
1420
537
|
LoginForm.displayName = "LoginForm";
|
|
538
|
+
const DEFAULT_CLASSES$3 = {
|
|
539
|
+
form: "space-y-5",
|
|
540
|
+
field: "space-y-2",
|
|
541
|
+
label: "block text-sm font-medium text-slate-700",
|
|
542
|
+
input: "w-full rounded-xl border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 disabled:cursor-not-allowed disabled:bg-slate-100",
|
|
543
|
+
button: "w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60",
|
|
544
|
+
error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
|
|
545
|
+
title: "text-2xl font-bold text-slate-900",
|
|
546
|
+
subtitle: "mt-1 text-sm text-slate-500"
|
|
547
|
+
};
|
|
1421
548
|
const RegisterForm = ({
|
|
1422
|
-
className
|
|
549
|
+
className,
|
|
550
|
+
formClassName,
|
|
551
|
+
fieldClassName,
|
|
552
|
+
labelClassName,
|
|
553
|
+
inputClassName,
|
|
554
|
+
buttonClassName,
|
|
555
|
+
errorClassName,
|
|
556
|
+
titleClassName,
|
|
557
|
+
subtitleClassName,
|
|
1423
558
|
labels = {},
|
|
1424
559
|
placeholders = {},
|
|
1425
560
|
submitButtonText = "Register",
|
|
561
|
+
loadingText = "Creating account...",
|
|
562
|
+
title,
|
|
563
|
+
subtitle,
|
|
564
|
+
showTitle = !!title,
|
|
1426
565
|
onSuccess,
|
|
1427
566
|
onError
|
|
1428
567
|
}) => {
|
|
@@ -1466,89 +605,119 @@ const RegisterForm = ({
|
|
|
1466
605
|
});
|
|
1467
606
|
}
|
|
1468
607
|
};
|
|
1469
|
-
return /* @__PURE__ */
|
|
1470
|
-
/* @__PURE__ */
|
|
1471
|
-
/* @__PURE__ */
|
|
1472
|
-
/* @__PURE__ */
|
|
1473
|
-
"input",
|
|
1474
|
-
{
|
|
1475
|
-
id: "name",
|
|
1476
|
-
type: "text",
|
|
1477
|
-
value: name,
|
|
1478
|
-
onChange: (e) => setName(e.target.value),
|
|
1479
|
-
placeholder: placeholders.name || "John Doe",
|
|
1480
|
-
disabled: isLoading,
|
|
1481
|
-
className: "auth-form-input",
|
|
1482
|
-
required: true
|
|
1483
|
-
}
|
|
1484
|
-
)
|
|
1485
|
-
] }),
|
|
1486
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "auth-form-group", children: [
|
|
1487
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "email", className: "auth-form-label", children: labels.email || "Email" }),
|
|
1488
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1489
|
-
"input",
|
|
1490
|
-
{
|
|
1491
|
-
id: "email",
|
|
1492
|
-
type: "email",
|
|
1493
|
-
value: email,
|
|
1494
|
-
onChange: (e) => setEmail(e.target.value),
|
|
1495
|
-
placeholder: placeholders.email || "your@email.com",
|
|
1496
|
-
disabled: isLoading,
|
|
1497
|
-
className: "auth-form-input",
|
|
1498
|
-
required: true
|
|
1499
|
-
}
|
|
1500
|
-
)
|
|
608
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
609
|
+
showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
610
|
+
/* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$3.title, titleClassName), children: title }),
|
|
611
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$3.subtitle, subtitleClassName), children: subtitle })
|
|
1501
612
|
] }),
|
|
1502
|
-
/* @__PURE__ */
|
|
1503
|
-
/* @__PURE__ */
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
/* @__PURE__ */
|
|
1520
|
-
|
|
1521
|
-
|
|
613
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$3.form, formClassName), children: [
|
|
614
|
+
/* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
|
|
615
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "name", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.name || "Full Name" }),
|
|
616
|
+
/* @__PURE__ */ jsx(
|
|
617
|
+
"input",
|
|
618
|
+
{
|
|
619
|
+
id: "name",
|
|
620
|
+
type: "text",
|
|
621
|
+
value: name,
|
|
622
|
+
onChange: (e) => setName(e.target.value),
|
|
623
|
+
placeholder: placeholders.name || "John Doe",
|
|
624
|
+
disabled: isLoading,
|
|
625
|
+
className: cn(DEFAULT_CLASSES$3.input, inputClassName),
|
|
626
|
+
required: true
|
|
627
|
+
}
|
|
628
|
+
)
|
|
629
|
+
] }),
|
|
630
|
+
/* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
|
|
631
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.email || "Email" }),
|
|
632
|
+
/* @__PURE__ */ jsx(
|
|
633
|
+
"input",
|
|
634
|
+
{
|
|
635
|
+
id: "email",
|
|
636
|
+
type: "email",
|
|
637
|
+
value: email,
|
|
638
|
+
onChange: (e) => setEmail(e.target.value),
|
|
639
|
+
placeholder: placeholders.email || "your@email.com",
|
|
640
|
+
disabled: isLoading,
|
|
641
|
+
className: cn(DEFAULT_CLASSES$3.input, inputClassName),
|
|
642
|
+
required: true
|
|
643
|
+
}
|
|
644
|
+
)
|
|
645
|
+
] }),
|
|
646
|
+
/* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
|
|
647
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "password", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.password || "Password" }),
|
|
648
|
+
/* @__PURE__ */ jsx(
|
|
649
|
+
"input",
|
|
650
|
+
{
|
|
651
|
+
id: "password",
|
|
652
|
+
type: "password",
|
|
653
|
+
value: password,
|
|
654
|
+
onChange: (e) => setPassword(e.target.value),
|
|
655
|
+
placeholder: placeholders.password || "••••••••",
|
|
656
|
+
disabled: isLoading,
|
|
657
|
+
className: cn(DEFAULT_CLASSES$3.input, inputClassName),
|
|
658
|
+
required: true
|
|
659
|
+
}
|
|
660
|
+
)
|
|
661
|
+
] }),
|
|
662
|
+
/* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
|
|
663
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "confirmPassword", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.confirmPassword || "Confirm Password" }),
|
|
664
|
+
/* @__PURE__ */ jsx(
|
|
665
|
+
"input",
|
|
666
|
+
{
|
|
667
|
+
id: "confirmPassword",
|
|
668
|
+
type: "password",
|
|
669
|
+
value: confirmPassword,
|
|
670
|
+
onChange: (e) => setConfirmPassword(e.target.value),
|
|
671
|
+
placeholder: placeholders.confirmPassword || "••••••••",
|
|
672
|
+
disabled: isLoading,
|
|
673
|
+
className: cn(DEFAULT_CLASSES$3.input, inputClassName),
|
|
674
|
+
required: true
|
|
675
|
+
}
|
|
676
|
+
)
|
|
677
|
+
] }),
|
|
678
|
+
error && /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$3.error, errorClassName), children: error }),
|
|
679
|
+
/* @__PURE__ */ jsx(
|
|
680
|
+
"button",
|
|
1522
681
|
{
|
|
1523
|
-
|
|
1524
|
-
type: "password",
|
|
1525
|
-
value: confirmPassword,
|
|
1526
|
-
onChange: (e) => setConfirmPassword(e.target.value),
|
|
1527
|
-
placeholder: placeholders.confirmPassword || "••••••••",
|
|
682
|
+
type: "submit",
|
|
1528
683
|
disabled: isLoading,
|
|
1529
|
-
className:
|
|
1530
|
-
|
|
684
|
+
className: cn(DEFAULT_CLASSES$3.button, buttonClassName),
|
|
685
|
+
children: isLoading ? loadingText : submitButtonText
|
|
1531
686
|
}
|
|
1532
687
|
)
|
|
1533
|
-
] })
|
|
1534
|
-
error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "auth-form-error", children: error }),
|
|
1535
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1536
|
-
"button",
|
|
1537
|
-
{
|
|
1538
|
-
type: "submit",
|
|
1539
|
-
disabled: isLoading,
|
|
1540
|
-
className: "auth-form-button auth-form-button-primary",
|
|
1541
|
-
children: isLoading ? "Loading..." : submitButtonText
|
|
1542
|
-
}
|
|
1543
|
-
)
|
|
688
|
+
] })
|
|
1544
689
|
] });
|
|
1545
690
|
};
|
|
1546
691
|
RegisterForm.displayName = "RegisterForm";
|
|
692
|
+
const DEFAULT_CLASSES$2 = {
|
|
693
|
+
form: "space-y-5",
|
|
694
|
+
field: "space-y-2",
|
|
695
|
+
label: "block text-sm font-medium text-slate-700",
|
|
696
|
+
input: "w-full rounded-xl border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 disabled:cursor-not-allowed disabled:bg-slate-100",
|
|
697
|
+
button: "w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60",
|
|
698
|
+
error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
|
|
699
|
+
success: "rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",
|
|
700
|
+
title: "text-2xl font-bold text-slate-900",
|
|
701
|
+
subtitle: "mt-1 text-sm text-slate-500"
|
|
702
|
+
};
|
|
1547
703
|
const ForgotPasswordForm = ({
|
|
1548
|
-
className
|
|
704
|
+
className,
|
|
705
|
+
formClassName,
|
|
706
|
+
fieldClassName,
|
|
707
|
+
labelClassName,
|
|
708
|
+
inputClassName,
|
|
709
|
+
buttonClassName,
|
|
710
|
+
errorClassName,
|
|
711
|
+
successClassName,
|
|
712
|
+
titleClassName,
|
|
713
|
+
subtitleClassName,
|
|
1549
714
|
labels = {},
|
|
1550
715
|
placeholders = {},
|
|
1551
716
|
submitButtonText = "Send Reset Link",
|
|
717
|
+
loadingText = "Sending...",
|
|
718
|
+
title,
|
|
719
|
+
subtitle,
|
|
720
|
+
showTitle = !!title,
|
|
1552
721
|
onSuccess,
|
|
1553
722
|
onError
|
|
1554
723
|
}) => {
|
|
@@ -1585,44 +754,80 @@ const ForgotPasswordForm = ({
|
|
|
1585
754
|
}
|
|
1586
755
|
};
|
|
1587
756
|
if (successMessage) {
|
|
1588
|
-
return /* @__PURE__ */
|
|
757
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
758
|
+
showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
759
|
+
/* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$2.title, titleClassName), children: title }),
|
|
760
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$2.subtitle, subtitleClassName), children: subtitle })
|
|
761
|
+
] }),
|
|
762
|
+
/* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$2.success, successClassName), children: /* @__PURE__ */ jsx("p", { children: successMessage }) })
|
|
763
|
+
] });
|
|
1589
764
|
}
|
|
1590
|
-
return /* @__PURE__ */
|
|
1591
|
-
/* @__PURE__ */
|
|
1592
|
-
/* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
|
|
765
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
766
|
+
showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
767
|
+
/* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$2.title, titleClassName), children: title }),
|
|
768
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$2.subtitle, subtitleClassName), children: subtitle })
|
|
769
|
+
] }),
|
|
770
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$2.form, formClassName), children: [
|
|
771
|
+
/* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$2.field, fieldClassName), children: [
|
|
772
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES$2.label, labelClassName), children: labels.email || "Email" }),
|
|
773
|
+
/* @__PURE__ */ jsx(
|
|
774
|
+
"input",
|
|
775
|
+
{
|
|
776
|
+
id: "email",
|
|
777
|
+
type: "email",
|
|
778
|
+
value: email,
|
|
779
|
+
onChange: (e) => setEmail(e.target.value),
|
|
780
|
+
placeholder: placeholders.email || "your@email.com",
|
|
781
|
+
disabled: isLoading,
|
|
782
|
+
className: cn(DEFAULT_CLASSES$2.input, inputClassName),
|
|
783
|
+
required: true
|
|
784
|
+
}
|
|
785
|
+
)
|
|
786
|
+
] }),
|
|
787
|
+
error && /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$2.error, errorClassName), children: error }),
|
|
788
|
+
/* @__PURE__ */ jsx(
|
|
789
|
+
"button",
|
|
1595
790
|
{
|
|
1596
|
-
|
|
1597
|
-
type: "email",
|
|
1598
|
-
value: email,
|
|
1599
|
-
onChange: (e) => setEmail(e.target.value),
|
|
1600
|
-
placeholder: placeholders.email || "your@email.com",
|
|
791
|
+
type: "submit",
|
|
1601
792
|
disabled: isLoading,
|
|
1602
|
-
className:
|
|
1603
|
-
|
|
793
|
+
className: cn(DEFAULT_CLASSES$2.button, buttonClassName),
|
|
794
|
+
children: isLoading ? loadingText : submitButtonText
|
|
1604
795
|
}
|
|
1605
796
|
)
|
|
1606
|
-
] })
|
|
1607
|
-
error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "auth-form-error", children: error }),
|
|
1608
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1609
|
-
"button",
|
|
1610
|
-
{
|
|
1611
|
-
type: "submit",
|
|
1612
|
-
disabled: isLoading,
|
|
1613
|
-
className: "auth-form-button auth-form-button-primary",
|
|
1614
|
-
children: isLoading ? "Loading..." : submitButtonText
|
|
1615
|
-
}
|
|
1616
|
-
)
|
|
797
|
+
] })
|
|
1617
798
|
] });
|
|
1618
799
|
};
|
|
1619
800
|
ForgotPasswordForm.displayName = "ForgotPasswordForm";
|
|
801
|
+
const DEFAULT_CLASSES$1 = {
|
|
802
|
+
form: "space-y-5",
|
|
803
|
+
field: "space-y-2",
|
|
804
|
+
label: "block text-sm font-medium text-slate-700",
|
|
805
|
+
input: "w-full rounded-xl border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 disabled:cursor-not-allowed disabled:bg-slate-100",
|
|
806
|
+
button: "w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60",
|
|
807
|
+
error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
|
|
808
|
+
success: "rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",
|
|
809
|
+
title: "text-2xl font-bold text-slate-900",
|
|
810
|
+
subtitle: "mt-1 text-sm text-slate-500"
|
|
811
|
+
};
|
|
1620
812
|
const ResetPasswordForm = ({
|
|
1621
813
|
token,
|
|
1622
|
-
className
|
|
814
|
+
className,
|
|
815
|
+
formClassName,
|
|
816
|
+
fieldClassName,
|
|
817
|
+
labelClassName,
|
|
818
|
+
inputClassName,
|
|
819
|
+
buttonClassName,
|
|
820
|
+
errorClassName,
|
|
821
|
+
successClassName,
|
|
822
|
+
titleClassName,
|
|
823
|
+
subtitleClassName,
|
|
1623
824
|
labels = {},
|
|
1624
825
|
placeholders = {},
|
|
1625
826
|
submitButtonText = "Reset Password",
|
|
827
|
+
loadingText = "Updating...",
|
|
828
|
+
title,
|
|
829
|
+
subtitle,
|
|
830
|
+
showTitle = !!title,
|
|
1626
831
|
onSuccess,
|
|
1627
832
|
onError
|
|
1628
833
|
}) => {
|
|
@@ -1669,61 +874,97 @@ const ResetPasswordForm = ({
|
|
|
1669
874
|
}
|
|
1670
875
|
};
|
|
1671
876
|
if (successMessage) {
|
|
1672
|
-
return /* @__PURE__ */
|
|
877
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
878
|
+
showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
879
|
+
/* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$1.title, titleClassName), children: title }),
|
|
880
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$1.subtitle, subtitleClassName), children: subtitle })
|
|
881
|
+
] }),
|
|
882
|
+
/* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$1.success, successClassName), children: /* @__PURE__ */ jsx("p", { children: successMessage }) })
|
|
883
|
+
] });
|
|
1673
884
|
}
|
|
1674
|
-
return /* @__PURE__ */
|
|
1675
|
-
/* @__PURE__ */
|
|
1676
|
-
/* @__PURE__ */
|
|
1677
|
-
/* @__PURE__ */
|
|
1678
|
-
"input",
|
|
1679
|
-
{
|
|
1680
|
-
id: "password",
|
|
1681
|
-
type: "password",
|
|
1682
|
-
value: password,
|
|
1683
|
-
onChange: (e) => setPassword(e.target.value),
|
|
1684
|
-
placeholder: placeholders.password || "••••••••",
|
|
1685
|
-
disabled: isLoading,
|
|
1686
|
-
className: "auth-form-input",
|
|
1687
|
-
required: true
|
|
1688
|
-
}
|
|
1689
|
-
)
|
|
885
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
886
|
+
showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
887
|
+
/* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$1.title, titleClassName), children: title }),
|
|
888
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$1.subtitle, subtitleClassName), children: subtitle })
|
|
1690
889
|
] }),
|
|
1691
|
-
/* @__PURE__ */
|
|
1692
|
-
/* @__PURE__ */
|
|
1693
|
-
|
|
1694
|
-
|
|
890
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$1.form, formClassName), children: [
|
|
891
|
+
/* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$1.field, fieldClassName), children: [
|
|
892
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "password", className: cn(DEFAULT_CLASSES$1.label, labelClassName), children: labels.password || "New Password" }),
|
|
893
|
+
/* @__PURE__ */ jsx(
|
|
894
|
+
"input",
|
|
895
|
+
{
|
|
896
|
+
id: "password",
|
|
897
|
+
type: "password",
|
|
898
|
+
value: password,
|
|
899
|
+
onChange: (e) => setPassword(e.target.value),
|
|
900
|
+
placeholder: placeholders.password || "••••••••",
|
|
901
|
+
disabled: isLoading,
|
|
902
|
+
className: cn(DEFAULT_CLASSES$1.input, inputClassName),
|
|
903
|
+
required: true
|
|
904
|
+
}
|
|
905
|
+
)
|
|
906
|
+
] }),
|
|
907
|
+
/* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$1.field, fieldClassName), children: [
|
|
908
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "confirmPassword", className: cn(DEFAULT_CLASSES$1.label, labelClassName), children: labels.confirmPassword || "Confirm Password" }),
|
|
909
|
+
/* @__PURE__ */ jsx(
|
|
910
|
+
"input",
|
|
911
|
+
{
|
|
912
|
+
id: "confirmPassword",
|
|
913
|
+
type: "password",
|
|
914
|
+
value: confirmPassword,
|
|
915
|
+
onChange: (e) => setConfirmPassword(e.target.value),
|
|
916
|
+
placeholder: placeholders.confirmPassword || "••••••••",
|
|
917
|
+
disabled: isLoading,
|
|
918
|
+
className: cn(DEFAULT_CLASSES$1.input, inputClassName),
|
|
919
|
+
required: true
|
|
920
|
+
}
|
|
921
|
+
)
|
|
922
|
+
] }),
|
|
923
|
+
error && /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$1.error, errorClassName), children: error }),
|
|
924
|
+
/* @__PURE__ */ jsx(
|
|
925
|
+
"button",
|
|
1695
926
|
{
|
|
1696
|
-
|
|
1697
|
-
type: "password",
|
|
1698
|
-
value: confirmPassword,
|
|
1699
|
-
onChange: (e) => setConfirmPassword(e.target.value),
|
|
1700
|
-
placeholder: placeholders.confirmPassword || "••••••••",
|
|
927
|
+
type: "submit",
|
|
1701
928
|
disabled: isLoading,
|
|
1702
|
-
className:
|
|
1703
|
-
|
|
929
|
+
className: cn(DEFAULT_CLASSES$1.button, buttonClassName),
|
|
930
|
+
children: isLoading ? loadingText : submitButtonText
|
|
1704
931
|
}
|
|
1705
932
|
)
|
|
1706
|
-
] })
|
|
1707
|
-
error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "auth-form-error", children: error }),
|
|
1708
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1709
|
-
"button",
|
|
1710
|
-
{
|
|
1711
|
-
type: "submit",
|
|
1712
|
-
disabled: isLoading,
|
|
1713
|
-
className: "auth-form-button auth-form-button-primary",
|
|
1714
|
-
children: isLoading ? "Loading..." : submitButtonText
|
|
1715
|
-
}
|
|
1716
|
-
)
|
|
933
|
+
] })
|
|
1717
934
|
] });
|
|
1718
935
|
};
|
|
1719
936
|
ResetPasswordForm.displayName = "ResetPasswordForm";
|
|
937
|
+
const DEFAULT_CLASSES = {
|
|
938
|
+
form: "space-y-5",
|
|
939
|
+
field: "space-y-2",
|
|
940
|
+
label: "block text-sm font-medium text-slate-700",
|
|
941
|
+
input: "w-full rounded-xl border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 disabled:cursor-not-allowed disabled:bg-slate-100",
|
|
942
|
+
button: "w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60",
|
|
943
|
+
error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
|
|
944
|
+
success: "rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",
|
|
945
|
+
title: "text-2xl font-bold text-slate-900",
|
|
946
|
+
subtitle: "mt-1 text-sm text-slate-500"
|
|
947
|
+
};
|
|
1720
948
|
const VerifyEmailForm = ({
|
|
1721
949
|
token: initialToken,
|
|
1722
950
|
email: initialEmail,
|
|
1723
|
-
className
|
|
951
|
+
className,
|
|
952
|
+
formClassName,
|
|
953
|
+
fieldClassName,
|
|
954
|
+
labelClassName,
|
|
955
|
+
inputClassName,
|
|
956
|
+
buttonClassName,
|
|
957
|
+
errorClassName,
|
|
958
|
+
successClassName,
|
|
959
|
+
titleClassName,
|
|
960
|
+
subtitleClassName,
|
|
1724
961
|
labels = {},
|
|
1725
962
|
placeholders = {},
|
|
1726
963
|
submitButtonText = "Verify Email",
|
|
964
|
+
loadingText = "Verifying...",
|
|
965
|
+
title,
|
|
966
|
+
subtitle,
|
|
967
|
+
showTitle = !!title,
|
|
1727
968
|
onSuccess,
|
|
1728
969
|
onError
|
|
1729
970
|
}) => {
|
|
@@ -1770,51 +1011,63 @@ const VerifyEmailForm = ({
|
|
|
1770
1011
|
}
|
|
1771
1012
|
};
|
|
1772
1013
|
if (successMessage) {
|
|
1773
|
-
return /* @__PURE__ */
|
|
1014
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
1015
|
+
showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
1016
|
+
/* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES.title, titleClassName), children: title }),
|
|
1017
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES.subtitle, subtitleClassName), children: subtitle })
|
|
1018
|
+
] }),
|
|
1019
|
+
/* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES.success, successClassName), children: /* @__PURE__ */ jsx("p", { children: successMessage }) })
|
|
1020
|
+
] });
|
|
1774
1021
|
}
|
|
1775
|
-
return /* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
"input",
|
|
1780
|
-
{
|
|
1781
|
-
id: "email",
|
|
1782
|
-
type: "email",
|
|
1783
|
-
value: email,
|
|
1784
|
-
onChange: (e) => setEmail(e.target.value),
|
|
1785
|
-
placeholder: placeholders.email || "your@email.com",
|
|
1786
|
-
disabled: isLoading,
|
|
1787
|
-
className: "auth-form-input",
|
|
1788
|
-
required: true
|
|
1789
|
-
}
|
|
1790
|
-
)
|
|
1022
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
1023
|
+
showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
1024
|
+
/* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES.title, titleClassName), children: title }),
|
|
1025
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES.subtitle, subtitleClassName), children: subtitle })
|
|
1791
1026
|
] }),
|
|
1792
|
-
/* @__PURE__ */
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
|
|
1795
|
-
|
|
1027
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES.form, formClassName), children: [
|
|
1028
|
+
/* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES.field, fieldClassName), children: [
|
|
1029
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES.label, labelClassName), children: labels.email || "Email" }),
|
|
1030
|
+
/* @__PURE__ */ jsx(
|
|
1031
|
+
"input",
|
|
1032
|
+
{
|
|
1033
|
+
id: "email",
|
|
1034
|
+
type: "email",
|
|
1035
|
+
value: email,
|
|
1036
|
+
onChange: (e) => setEmail(e.target.value),
|
|
1037
|
+
placeholder: placeholders.email || "your@email.com",
|
|
1038
|
+
disabled: isLoading,
|
|
1039
|
+
className: cn(DEFAULT_CLASSES.input, inputClassName),
|
|
1040
|
+
required: true
|
|
1041
|
+
}
|
|
1042
|
+
)
|
|
1043
|
+
] }),
|
|
1044
|
+
/* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES.field, fieldClassName), children: [
|
|
1045
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "token", className: cn(DEFAULT_CLASSES.label, labelClassName), children: labels.token || "Verification Code" }),
|
|
1046
|
+
/* @__PURE__ */ jsx(
|
|
1047
|
+
"input",
|
|
1048
|
+
{
|
|
1049
|
+
id: "token",
|
|
1050
|
+
type: "text",
|
|
1051
|
+
value: token,
|
|
1052
|
+
onChange: (e) => setToken(e.target.value),
|
|
1053
|
+
placeholder: placeholders.token || "Enter verification code",
|
|
1054
|
+
disabled: isLoading,
|
|
1055
|
+
className: cn(DEFAULT_CLASSES.input, inputClassName),
|
|
1056
|
+
required: true
|
|
1057
|
+
}
|
|
1058
|
+
)
|
|
1059
|
+
] }),
|
|
1060
|
+
error && /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES.error, errorClassName), children: error }),
|
|
1061
|
+
/* @__PURE__ */ jsx(
|
|
1062
|
+
"button",
|
|
1796
1063
|
{
|
|
1797
|
-
|
|
1798
|
-
type: "text",
|
|
1799
|
-
value: token,
|
|
1800
|
-
onChange: (e) => setToken(e.target.value),
|
|
1801
|
-
placeholder: placeholders.token || "Enter verification code",
|
|
1064
|
+
type: "submit",
|
|
1802
1065
|
disabled: isLoading,
|
|
1803
|
-
className:
|
|
1804
|
-
|
|
1066
|
+
className: cn(DEFAULT_CLASSES.button, buttonClassName),
|
|
1067
|
+
children: isLoading ? loadingText : submitButtonText
|
|
1805
1068
|
}
|
|
1806
1069
|
)
|
|
1807
|
-
] })
|
|
1808
|
-
error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "auth-form-error", children: error }),
|
|
1809
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1810
|
-
"button",
|
|
1811
|
-
{
|
|
1812
|
-
type: "submit",
|
|
1813
|
-
disabled: isLoading,
|
|
1814
|
-
className: "auth-form-button auth-form-button-primary",
|
|
1815
|
-
children: isLoading ? "Loading..." : submitButtonText
|
|
1816
|
-
}
|
|
1817
|
-
)
|
|
1070
|
+
] })
|
|
1818
1071
|
] });
|
|
1819
1072
|
};
|
|
1820
1073
|
VerifyEmailForm.displayName = "VerifyEmailForm";
|
|
@@ -1827,15 +1080,15 @@ const ProtectedRoute = ({
|
|
|
1827
1080
|
}) => {
|
|
1828
1081
|
const { isAuthenticated, isLoading, user } = useAuth();
|
|
1829
1082
|
if (isLoading) {
|
|
1830
|
-
return fallback || /* @__PURE__ */
|
|
1083
|
+
return fallback || /* @__PURE__ */ jsx("div", { className: "auth-loading", children: "Loading..." });
|
|
1831
1084
|
}
|
|
1832
1085
|
if (!isAuthenticated) {
|
|
1833
|
-
return /* @__PURE__ */
|
|
1086
|
+
return /* @__PURE__ */ jsx(Navigate, { to: redirectTo, replace: true });
|
|
1834
1087
|
}
|
|
1835
1088
|
if (roles && roles.length > 0) {
|
|
1836
1089
|
const hasRole = user?.roles?.some((role) => roles.includes(role));
|
|
1837
1090
|
if (!hasRole) {
|
|
1838
|
-
return /* @__PURE__ */
|
|
1091
|
+
return /* @__PURE__ */ jsx("div", { className: "auth-forbidden", children: /* @__PURE__ */ jsx("p", { children: "You do not have permission to access this page." }) });
|
|
1839
1092
|
}
|
|
1840
1093
|
}
|
|
1841
1094
|
if (permissions && permissions.length > 0) {
|
|
@@ -1843,10 +1096,10 @@ const ProtectedRoute = ({
|
|
|
1843
1096
|
(permission) => permissions.includes(permission)
|
|
1844
1097
|
);
|
|
1845
1098
|
if (!hasPermission) {
|
|
1846
|
-
return /* @__PURE__ */
|
|
1099
|
+
return /* @__PURE__ */ jsx("div", { className: "auth-forbidden", children: /* @__PURE__ */ jsx("p", { children: "You do not have permission to access this page." }) });
|
|
1847
1100
|
}
|
|
1848
1101
|
}
|
|
1849
|
-
return /* @__PURE__ */
|
|
1102
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1850
1103
|
};
|
|
1851
1104
|
ProtectedRoute.displayName = "ProtectedRoute";
|
|
1852
1105
|
export {
|
|
@@ -1858,6 +1111,7 @@ export {
|
|
|
1858
1111
|
RegisterForm,
|
|
1859
1112
|
ResetPasswordForm,
|
|
1860
1113
|
VerifyEmailForm,
|
|
1114
|
+
cn,
|
|
1861
1115
|
createAuthClient,
|
|
1862
1116
|
normalizeError,
|
|
1863
1117
|
useAuth
|