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