@rqdhw3n/react-auth-flow 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +99 -1020
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +63 -984
- package/dist/index.es.js.map +1 -1
- package/package.json +3 -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,10 +396,10 @@ 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
|
}
|
|
@@ -1335,10 +414,10 @@ const LoginForm = ({
|
|
|
1335
414
|
onError
|
|
1336
415
|
}) => {
|
|
1337
416
|
const { login, isLoading: authLoading, error: authError } = useAuth();
|
|
1338
|
-
const [formError, setFormError] =
|
|
1339
|
-
const [email, setEmail] =
|
|
1340
|
-
const [password, setPassword] =
|
|
1341
|
-
const [rememberMe, setRememberMe] =
|
|
417
|
+
const [formError, setFormError] = React.useState("");
|
|
418
|
+
const [email, setEmail] = React.useState("");
|
|
419
|
+
const [password, setPassword] = React.useState("");
|
|
420
|
+
const [rememberMe, setRememberMe] = React.useState(false);
|
|
1342
421
|
const isLoading = authLoading;
|
|
1343
422
|
const error = formError || authError?.message;
|
|
1344
423
|
const handleSubmit = async (e) => {
|
|
@@ -1360,10 +439,10 @@ const LoginForm = ({
|
|
|
1360
439
|
});
|
|
1361
440
|
}
|
|
1362
441
|
};
|
|
1363
|
-
return /* @__PURE__ */
|
|
1364
|
-
/* @__PURE__ */
|
|
1365
|
-
/* @__PURE__ */
|
|
1366
|
-
/* @__PURE__ */
|
|
442
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className, children: [
|
|
443
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
|
|
444
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: "auth-form-label", children: labels.email || "Email" }),
|
|
445
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1367
446
|
"input",
|
|
1368
447
|
{
|
|
1369
448
|
id: "email",
|
|
@@ -1377,9 +456,9 @@ const LoginForm = ({
|
|
|
1377
456
|
}
|
|
1378
457
|
)
|
|
1379
458
|
] }),
|
|
1380
|
-
/* @__PURE__ */
|
|
1381
|
-
/* @__PURE__ */
|
|
1382
|
-
/* @__PURE__ */
|
|
459
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
|
|
460
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "password", className: "auth-form-label", children: labels.password || "Password" }),
|
|
461
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1383
462
|
"input",
|
|
1384
463
|
{
|
|
1385
464
|
id: "password",
|
|
@@ -1393,8 +472,8 @@ const LoginForm = ({
|
|
|
1393
472
|
}
|
|
1394
473
|
)
|
|
1395
474
|
] }),
|
|
1396
|
-
/* @__PURE__ */
|
|
1397
|
-
/* @__PURE__ */
|
|
475
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group auth-form-checkbox", children: [
|
|
476
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1398
477
|
"input",
|
|
1399
478
|
{
|
|
1400
479
|
id: "rememberMe",
|
|
@@ -1405,10 +484,10 @@ const LoginForm = ({
|
|
|
1405
484
|
className: "auth-form-input"
|
|
1406
485
|
}
|
|
1407
486
|
),
|
|
1408
|
-
/* @__PURE__ */
|
|
487
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "rememberMe", className: "auth-form-label", children: labels.rememberMe || "Remember me" })
|
|
1409
488
|
] }),
|
|
1410
|
-
error && /* @__PURE__ */
|
|
1411
|
-
/* @__PURE__ */
|
|
489
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-form-error", children: error }),
|
|
490
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1412
491
|
"button",
|
|
1413
492
|
{
|
|
1414
493
|
type: "submit",
|
|
@@ -1429,11 +508,11 @@ const RegisterForm = ({
|
|
|
1429
508
|
onError
|
|
1430
509
|
}) => {
|
|
1431
510
|
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] =
|
|
511
|
+
const [formError, setFormError] = React.useState("");
|
|
512
|
+
const [name, setName] = React.useState("");
|
|
513
|
+
const [email, setEmail] = React.useState("");
|
|
514
|
+
const [password, setPassword] = React.useState("");
|
|
515
|
+
const [confirmPassword, setConfirmPassword] = React.useState("");
|
|
1437
516
|
const isLoading = authLoading;
|
|
1438
517
|
const error = formError || authError?.message;
|
|
1439
518
|
const handleSubmit = async (e) => {
|
|
@@ -1468,10 +547,10 @@ const RegisterForm = ({
|
|
|
1468
547
|
});
|
|
1469
548
|
}
|
|
1470
549
|
};
|
|
1471
|
-
return /* @__PURE__ */
|
|
1472
|
-
/* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
550
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className, children: [
|
|
551
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
|
|
552
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "name", className: "auth-form-label", children: labels.name || "Full Name" }),
|
|
553
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1475
554
|
"input",
|
|
1476
555
|
{
|
|
1477
556
|
id: "name",
|
|
@@ -1485,9 +564,9 @@ const RegisterForm = ({
|
|
|
1485
564
|
}
|
|
1486
565
|
)
|
|
1487
566
|
] }),
|
|
1488
|
-
/* @__PURE__ */
|
|
1489
|
-
/* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
|
|
568
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: "auth-form-label", children: labels.email || "Email" }),
|
|
569
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1491
570
|
"input",
|
|
1492
571
|
{
|
|
1493
572
|
id: "email",
|
|
@@ -1501,9 +580,9 @@ const RegisterForm = ({
|
|
|
1501
580
|
}
|
|
1502
581
|
)
|
|
1503
582
|
] }),
|
|
1504
|
-
/* @__PURE__ */
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
/* @__PURE__ */
|
|
583
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
|
|
584
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "password", className: "auth-form-label", children: labels.password || "Password" }),
|
|
585
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1507
586
|
"input",
|
|
1508
587
|
{
|
|
1509
588
|
id: "password",
|
|
@@ -1517,9 +596,9 @@ const RegisterForm = ({
|
|
|
1517
596
|
}
|
|
1518
597
|
)
|
|
1519
598
|
] }),
|
|
1520
|
-
/* @__PURE__ */
|
|
1521
|
-
/* @__PURE__ */
|
|
1522
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
|
|
600
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "confirmPassword", className: "auth-form-label", children: labels.confirmPassword || "Confirm Password" }),
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1523
602
|
"input",
|
|
1524
603
|
{
|
|
1525
604
|
id: "confirmPassword",
|
|
@@ -1533,8 +612,8 @@ const RegisterForm = ({
|
|
|
1533
612
|
}
|
|
1534
613
|
)
|
|
1535
614
|
] }),
|
|
1536
|
-
error && /* @__PURE__ */
|
|
1537
|
-
/* @__PURE__ */
|
|
615
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-form-error", children: error }),
|
|
616
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1538
617
|
"button",
|
|
1539
618
|
{
|
|
1540
619
|
type: "submit",
|
|
@@ -1559,9 +638,9 @@ const ForgotPasswordForm = ({
|
|
|
1559
638
|
isLoading: authLoading,
|
|
1560
639
|
error: authError
|
|
1561
640
|
} = useAuth();
|
|
1562
|
-
const [formError, setFormError] =
|
|
1563
|
-
const [email, setEmail] =
|
|
1564
|
-
const [successMessage, setSuccessMessage] =
|
|
641
|
+
const [formError, setFormError] = React.useState("");
|
|
642
|
+
const [email, setEmail] = React.useState("");
|
|
643
|
+
const [successMessage, setSuccessMessage] = React.useState("");
|
|
1565
644
|
const isLoading = authLoading;
|
|
1566
645
|
const error = formError || authError?.message;
|
|
1567
646
|
const handleSubmit = async (e) => {
|
|
@@ -1587,12 +666,12 @@ const ForgotPasswordForm = ({
|
|
|
1587
666
|
}
|
|
1588
667
|
};
|
|
1589
668
|
if (successMessage) {
|
|
1590
|
-
return /* @__PURE__ */
|
|
669
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `auth-form-success ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "auth-form-success-message", children: successMessage }) });
|
|
1591
670
|
}
|
|
1592
|
-
return /* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1595
|
-
/* @__PURE__ */
|
|
671
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className, children: [
|
|
672
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
|
|
673
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: "auth-form-label", children: labels.email || "Email" }),
|
|
674
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1596
675
|
"input",
|
|
1597
676
|
{
|
|
1598
677
|
id: "email",
|
|
@@ -1606,8 +685,8 @@ const ForgotPasswordForm = ({
|
|
|
1606
685
|
}
|
|
1607
686
|
)
|
|
1608
687
|
] }),
|
|
1609
|
-
error && /* @__PURE__ */
|
|
1610
|
-
/* @__PURE__ */
|
|
688
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-form-error", children: error }),
|
|
689
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1611
690
|
"button",
|
|
1612
691
|
{
|
|
1613
692
|
type: "submit",
|
|
@@ -1633,10 +712,10 @@ const ResetPasswordForm = ({
|
|
|
1633
712
|
isLoading: authLoading,
|
|
1634
713
|
error: authError
|
|
1635
714
|
} = useAuth();
|
|
1636
|
-
const [formError, setFormError] =
|
|
1637
|
-
const [password, setPassword] =
|
|
1638
|
-
const [confirmPassword, setConfirmPassword] =
|
|
1639
|
-
const [successMessage, setSuccessMessage] =
|
|
715
|
+
const [formError, setFormError] = React.useState("");
|
|
716
|
+
const [password, setPassword] = React.useState("");
|
|
717
|
+
const [confirmPassword, setConfirmPassword] = React.useState("");
|
|
718
|
+
const [successMessage, setSuccessMessage] = React.useState("");
|
|
1640
719
|
const isLoading = authLoading;
|
|
1641
720
|
const error = formError || authError?.message;
|
|
1642
721
|
const handleSubmit = async (e) => {
|
|
@@ -1671,12 +750,12 @@ const ResetPasswordForm = ({
|
|
|
1671
750
|
}
|
|
1672
751
|
};
|
|
1673
752
|
if (successMessage) {
|
|
1674
|
-
return /* @__PURE__ */
|
|
753
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `auth-form-success ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "auth-form-success-message", children: successMessage }) });
|
|
1675
754
|
}
|
|
1676
|
-
return /* @__PURE__ */
|
|
1677
|
-
/* @__PURE__ */
|
|
1678
|
-
/* @__PURE__ */
|
|
1679
|
-
/* @__PURE__ */
|
|
755
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className, children: [
|
|
756
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
|
|
757
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "password", className: "auth-form-label", children: labels.password || "New Password" }),
|
|
758
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1680
759
|
"input",
|
|
1681
760
|
{
|
|
1682
761
|
id: "password",
|
|
@@ -1690,9 +769,9 @@ const ResetPasswordForm = ({
|
|
|
1690
769
|
}
|
|
1691
770
|
)
|
|
1692
771
|
] }),
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1695
|
-
/* @__PURE__ */
|
|
772
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
|
|
773
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "confirmPassword", className: "auth-form-label", children: labels.confirmPassword || "Confirm Password" }),
|
|
774
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1696
775
|
"input",
|
|
1697
776
|
{
|
|
1698
777
|
id: "confirmPassword",
|
|
@@ -1706,8 +785,8 @@ const ResetPasswordForm = ({
|
|
|
1706
785
|
}
|
|
1707
786
|
)
|
|
1708
787
|
] }),
|
|
1709
|
-
error && /* @__PURE__ */
|
|
1710
|
-
/* @__PURE__ */
|
|
788
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-form-error", children: error }),
|
|
789
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1711
790
|
"button",
|
|
1712
791
|
{
|
|
1713
792
|
type: "submit",
|
|
@@ -1734,13 +813,13 @@ const VerifyEmailForm = ({
|
|
|
1734
813
|
isLoading: authLoading,
|
|
1735
814
|
error: authError
|
|
1736
815
|
} = useAuth();
|
|
1737
|
-
const [formError, setFormError] =
|
|
1738
|
-
const [email, setEmail] =
|
|
1739
|
-
const [token, setToken] =
|
|
1740
|
-
const [successMessage, setSuccessMessage] =
|
|
816
|
+
const [formError, setFormError] = React.useState("");
|
|
817
|
+
const [email, setEmail] = React.useState(initialEmail || "");
|
|
818
|
+
const [token, setToken] = React.useState(initialToken || "");
|
|
819
|
+
const [successMessage, setSuccessMessage] = React.useState("");
|
|
1741
820
|
const isLoading = authLoading;
|
|
1742
821
|
const error = formError || authError?.message;
|
|
1743
|
-
|
|
822
|
+
React.useEffect(() => {
|
|
1744
823
|
if (token && email && !successMessage && !error) {
|
|
1745
824
|
handleSubmit({ preventDefault: () => {
|
|
1746
825
|
} });
|
|
@@ -1772,12 +851,12 @@ const VerifyEmailForm = ({
|
|
|
1772
851
|
}
|
|
1773
852
|
};
|
|
1774
853
|
if (successMessage) {
|
|
1775
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `auth-form-success ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "auth-form-success-message", children: successMessage }) });
|
|
1776
855
|
}
|
|
1777
|
-
return /* @__PURE__ */
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1780
|
-
/* @__PURE__ */
|
|
856
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className, children: [
|
|
857
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
|
|
858
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: "auth-form-label", children: labels.email || "Email" }),
|
|
859
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1781
860
|
"input",
|
|
1782
861
|
{
|
|
1783
862
|
id: "email",
|
|
@@ -1791,9 +870,9 @@ const VerifyEmailForm = ({
|
|
|
1791
870
|
}
|
|
1792
871
|
)
|
|
1793
872
|
] }),
|
|
1794
|
-
/* @__PURE__ */
|
|
1795
|
-
/* @__PURE__ */
|
|
1796
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "token", className: "auth-form-label", children: labels.token || "Verification Code" }),
|
|
875
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1797
876
|
"input",
|
|
1798
877
|
{
|
|
1799
878
|
id: "token",
|
|
@@ -1807,8 +886,8 @@ const VerifyEmailForm = ({
|
|
|
1807
886
|
}
|
|
1808
887
|
)
|
|
1809
888
|
] }),
|
|
1810
|
-
error && /* @__PURE__ */
|
|
1811
|
-
/* @__PURE__ */
|
|
889
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-form-error", children: error }),
|
|
890
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1812
891
|
"button",
|
|
1813
892
|
{
|
|
1814
893
|
type: "submit",
|
|
@@ -1829,15 +908,15 @@ const ProtectedRoute = ({
|
|
|
1829
908
|
}) => {
|
|
1830
909
|
const { isAuthenticated, isLoading, user } = useAuth();
|
|
1831
910
|
if (isLoading) {
|
|
1832
|
-
return fallback || /* @__PURE__ */
|
|
911
|
+
return fallback || /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-loading", children: "Loading..." });
|
|
1833
912
|
}
|
|
1834
913
|
if (!isAuthenticated) {
|
|
1835
|
-
return /* @__PURE__ */
|
|
914
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: redirectTo, replace: true });
|
|
1836
915
|
}
|
|
1837
916
|
if (roles && roles.length > 0) {
|
|
1838
917
|
const hasRole = user?.roles?.some((role) => roles.includes(role));
|
|
1839
918
|
if (!hasRole) {
|
|
1840
|
-
return /* @__PURE__ */
|
|
919
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-forbidden", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "You do not have permission to access this page." }) });
|
|
1841
920
|
}
|
|
1842
921
|
}
|
|
1843
922
|
if (permissions && permissions.length > 0) {
|
|
@@ -1845,10 +924,10 @@ const ProtectedRoute = ({
|
|
|
1845
924
|
(permission) => permissions.includes(permission)
|
|
1846
925
|
);
|
|
1847
926
|
if (!hasPermission) {
|
|
1848
|
-
return /* @__PURE__ */
|
|
927
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-forbidden", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "You do not have permission to access this page." }) });
|
|
1849
928
|
}
|
|
1850
929
|
}
|
|
1851
|
-
return /* @__PURE__ */
|
|
930
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
1852
931
|
};
|
|
1853
932
|
ProtectedRoute.displayName = "ProtectedRoute";
|
|
1854
933
|
exports.AuthContext = AuthContext;
|