flowlink-auth 2.7.2 → 2.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +46 -1069
- package/package.json +4 -3
- package/src/ErrorBox.jsx +22 -0
- package/src/SignIn.jsx +212 -0
- package/src/SignUp.jsx +260 -0
- package/src/api.js +60 -0
- package/src/createAuthMiddleware.js +69 -0
- package/src/index.d.ts +15 -0
- package/src/index.js +5 -0
- package/src/init.js +100 -0
- package/src/provider.js +261 -0
- package/src/securityUtils.js +151 -0
- package/src/useAuth.js +13 -0
package/dist/index.js
CHANGED
|
@@ -1,1015 +1,5 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
// node_modules/react/cjs/react.development.js
|
|
28
|
-
var require_react_development = __commonJS({
|
|
29
|
-
"node_modules/react/cjs/react.development.js"(exports, module) {
|
|
30
|
-
"use strict";
|
|
31
|
-
(function() {
|
|
32
|
-
function defineDeprecationWarning(methodName, info) {
|
|
33
|
-
Object.defineProperty(Component.prototype, methodName, {
|
|
34
|
-
get: function() {
|
|
35
|
-
console.warn(
|
|
36
|
-
"%s(...) is deprecated in plain JavaScript React classes. %s",
|
|
37
|
-
info[0],
|
|
38
|
-
info[1]
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function getIteratorFn(maybeIterable) {
|
|
44
|
-
if (null === maybeIterable || "object" !== typeof maybeIterable)
|
|
45
|
-
return null;
|
|
46
|
-
maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
|
|
47
|
-
return "function" === typeof maybeIterable ? maybeIterable : null;
|
|
48
|
-
}
|
|
49
|
-
function warnNoop(publicInstance, callerName) {
|
|
50
|
-
publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
|
|
51
|
-
var warningKey = publicInstance + "." + callerName;
|
|
52
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error(
|
|
53
|
-
"Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",
|
|
54
|
-
callerName,
|
|
55
|
-
publicInstance
|
|
56
|
-
), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
|
|
57
|
-
}
|
|
58
|
-
function Component(props, context, updater) {
|
|
59
|
-
this.props = props;
|
|
60
|
-
this.context = context;
|
|
61
|
-
this.refs = emptyObject;
|
|
62
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
63
|
-
}
|
|
64
|
-
function ComponentDummy() {
|
|
65
|
-
}
|
|
66
|
-
function PureComponent(props, context, updater) {
|
|
67
|
-
this.props = props;
|
|
68
|
-
this.context = context;
|
|
69
|
-
this.refs = emptyObject;
|
|
70
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
71
|
-
}
|
|
72
|
-
function noop() {
|
|
73
|
-
}
|
|
74
|
-
function testStringCoercion(value) {
|
|
75
|
-
return "" + value;
|
|
76
|
-
}
|
|
77
|
-
function checkKeyStringCoercion(value) {
|
|
78
|
-
try {
|
|
79
|
-
testStringCoercion(value);
|
|
80
|
-
var JSCompiler_inline_result = false;
|
|
81
|
-
} catch (e) {
|
|
82
|
-
JSCompiler_inline_result = true;
|
|
83
|
-
}
|
|
84
|
-
if (JSCompiler_inline_result) {
|
|
85
|
-
JSCompiler_inline_result = console;
|
|
86
|
-
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
87
|
-
var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
88
|
-
JSCompiler_temp_const.call(
|
|
89
|
-
JSCompiler_inline_result,
|
|
90
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
91
|
-
JSCompiler_inline_result$jscomp$0
|
|
92
|
-
);
|
|
93
|
-
return testStringCoercion(value);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function getComponentNameFromType(type) {
|
|
97
|
-
if (null == type) return null;
|
|
98
|
-
if ("function" === typeof type)
|
|
99
|
-
return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
100
|
-
if ("string" === typeof type) return type;
|
|
101
|
-
switch (type) {
|
|
102
|
-
case REACT_FRAGMENT_TYPE:
|
|
103
|
-
return "Fragment";
|
|
104
|
-
case REACT_PROFILER_TYPE:
|
|
105
|
-
return "Profiler";
|
|
106
|
-
case REACT_STRICT_MODE_TYPE:
|
|
107
|
-
return "StrictMode";
|
|
108
|
-
case REACT_SUSPENSE_TYPE:
|
|
109
|
-
return "Suspense";
|
|
110
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
111
|
-
return "SuspenseList";
|
|
112
|
-
case REACT_ACTIVITY_TYPE:
|
|
113
|
-
return "Activity";
|
|
114
|
-
}
|
|
115
|
-
if ("object" === typeof type)
|
|
116
|
-
switch ("number" === typeof type.tag && console.error(
|
|
117
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
118
|
-
), type.$$typeof) {
|
|
119
|
-
case REACT_PORTAL_TYPE:
|
|
120
|
-
return "Portal";
|
|
121
|
-
case REACT_CONTEXT_TYPE:
|
|
122
|
-
return type.displayName || "Context";
|
|
123
|
-
case REACT_CONSUMER_TYPE:
|
|
124
|
-
return (type._context.displayName || "Context") + ".Consumer";
|
|
125
|
-
case REACT_FORWARD_REF_TYPE:
|
|
126
|
-
var innerType = type.render;
|
|
127
|
-
type = type.displayName;
|
|
128
|
-
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
129
|
-
return type;
|
|
130
|
-
case REACT_MEMO_TYPE:
|
|
131
|
-
return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
132
|
-
case REACT_LAZY_TYPE:
|
|
133
|
-
innerType = type._payload;
|
|
134
|
-
type = type._init;
|
|
135
|
-
try {
|
|
136
|
-
return getComponentNameFromType(type(innerType));
|
|
137
|
-
} catch (x) {
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
function getTaskName(type) {
|
|
143
|
-
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
144
|
-
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
|
|
145
|
-
return "<...>";
|
|
146
|
-
try {
|
|
147
|
-
var name = getComponentNameFromType(type);
|
|
148
|
-
return name ? "<" + name + ">" : "<...>";
|
|
149
|
-
} catch (x) {
|
|
150
|
-
return "<...>";
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
function getOwner() {
|
|
154
|
-
var dispatcher = ReactSharedInternals.A;
|
|
155
|
-
return null === dispatcher ? null : dispatcher.getOwner();
|
|
156
|
-
}
|
|
157
|
-
function UnknownOwner() {
|
|
158
|
-
return Error("react-stack-top-frame");
|
|
159
|
-
}
|
|
160
|
-
function hasValidKey(config) {
|
|
161
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
162
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
163
|
-
if (getter && getter.isReactWarning) return false;
|
|
164
|
-
}
|
|
165
|
-
return void 0 !== config.key;
|
|
166
|
-
}
|
|
167
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
168
|
-
function warnAboutAccessingKey() {
|
|
169
|
-
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
|
|
170
|
-
"%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://react.dev/link/special-props)",
|
|
171
|
-
displayName
|
|
172
|
-
));
|
|
173
|
-
}
|
|
174
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
175
|
-
Object.defineProperty(props, "key", {
|
|
176
|
-
get: warnAboutAccessingKey,
|
|
177
|
-
configurable: true
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
function elementRefGetterWithDeprecationWarning() {
|
|
181
|
-
var componentName = getComponentNameFromType(this.type);
|
|
182
|
-
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
|
|
183
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
184
|
-
));
|
|
185
|
-
componentName = this.props.ref;
|
|
186
|
-
return void 0 !== componentName ? componentName : null;
|
|
187
|
-
}
|
|
188
|
-
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
189
|
-
var refProp = props.ref;
|
|
190
|
-
type = {
|
|
191
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
192
|
-
type,
|
|
193
|
-
key,
|
|
194
|
-
props,
|
|
195
|
-
_owner: owner
|
|
196
|
-
};
|
|
197
|
-
null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
|
|
198
|
-
enumerable: false,
|
|
199
|
-
get: elementRefGetterWithDeprecationWarning
|
|
200
|
-
}) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
201
|
-
type._store = {};
|
|
202
|
-
Object.defineProperty(type._store, "validated", {
|
|
203
|
-
configurable: false,
|
|
204
|
-
enumerable: false,
|
|
205
|
-
writable: true,
|
|
206
|
-
value: 0
|
|
207
|
-
});
|
|
208
|
-
Object.defineProperty(type, "_debugInfo", {
|
|
209
|
-
configurable: false,
|
|
210
|
-
enumerable: false,
|
|
211
|
-
writable: true,
|
|
212
|
-
value: null
|
|
213
|
-
});
|
|
214
|
-
Object.defineProperty(type, "_debugStack", {
|
|
215
|
-
configurable: false,
|
|
216
|
-
enumerable: false,
|
|
217
|
-
writable: true,
|
|
218
|
-
value: debugStack
|
|
219
|
-
});
|
|
220
|
-
Object.defineProperty(type, "_debugTask", {
|
|
221
|
-
configurable: false,
|
|
222
|
-
enumerable: false,
|
|
223
|
-
writable: true,
|
|
224
|
-
value: debugTask
|
|
225
|
-
});
|
|
226
|
-
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
227
|
-
return type;
|
|
228
|
-
}
|
|
229
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
|
230
|
-
newKey = ReactElement(
|
|
231
|
-
oldElement.type,
|
|
232
|
-
newKey,
|
|
233
|
-
oldElement.props,
|
|
234
|
-
oldElement._owner,
|
|
235
|
-
oldElement._debugStack,
|
|
236
|
-
oldElement._debugTask
|
|
237
|
-
);
|
|
238
|
-
oldElement._store && (newKey._store.validated = oldElement._store.validated);
|
|
239
|
-
return newKey;
|
|
240
|
-
}
|
|
241
|
-
function validateChildKeys(node) {
|
|
242
|
-
isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
243
|
-
}
|
|
244
|
-
function isValidElement(object) {
|
|
245
|
-
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
246
|
-
}
|
|
247
|
-
function escape(key) {
|
|
248
|
-
var escaperLookup = { "=": "=0", ":": "=2" };
|
|
249
|
-
return "$" + key.replace(/[=:]/g, function(match) {
|
|
250
|
-
return escaperLookup[match];
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
function getElementKey(element, index) {
|
|
254
|
-
return "object" === typeof element && null !== element && null != element.key ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
|
|
255
|
-
}
|
|
256
|
-
function resolveThenable(thenable) {
|
|
257
|
-
switch (thenable.status) {
|
|
258
|
-
case "fulfilled":
|
|
259
|
-
return thenable.value;
|
|
260
|
-
case "rejected":
|
|
261
|
-
throw thenable.reason;
|
|
262
|
-
default:
|
|
263
|
-
switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
|
|
264
|
-
function(fulfilledValue) {
|
|
265
|
-
"pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
|
|
266
|
-
},
|
|
267
|
-
function(error) {
|
|
268
|
-
"pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
|
|
269
|
-
}
|
|
270
|
-
)), thenable.status) {
|
|
271
|
-
case "fulfilled":
|
|
272
|
-
return thenable.value;
|
|
273
|
-
case "rejected":
|
|
274
|
-
throw thenable.reason;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
throw thenable;
|
|
278
|
-
}
|
|
279
|
-
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
280
|
-
var type = typeof children;
|
|
281
|
-
if ("undefined" === type || "boolean" === type) children = null;
|
|
282
|
-
var invokeCallback = false;
|
|
283
|
-
if (null === children) invokeCallback = true;
|
|
284
|
-
else
|
|
285
|
-
switch (type) {
|
|
286
|
-
case "bigint":
|
|
287
|
-
case "string":
|
|
288
|
-
case "number":
|
|
289
|
-
invokeCallback = true;
|
|
290
|
-
break;
|
|
291
|
-
case "object":
|
|
292
|
-
switch (children.$$typeof) {
|
|
293
|
-
case REACT_ELEMENT_TYPE:
|
|
294
|
-
case REACT_PORTAL_TYPE:
|
|
295
|
-
invokeCallback = true;
|
|
296
|
-
break;
|
|
297
|
-
case REACT_LAZY_TYPE:
|
|
298
|
-
return invokeCallback = children._init, mapIntoArray(
|
|
299
|
-
invokeCallback(children._payload),
|
|
300
|
-
array,
|
|
301
|
-
escapedPrefix,
|
|
302
|
-
nameSoFar,
|
|
303
|
-
callback
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
if (invokeCallback) {
|
|
308
|
-
invokeCallback = children;
|
|
309
|
-
callback = callback(invokeCallback);
|
|
310
|
-
var childKey = "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
|
|
311
|
-
isArrayImpl(callback) ? (escapedPrefix = "", null != childKey && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
|
|
312
|
-
return c;
|
|
313
|
-
})) : null != callback && (isValidElement(callback) && (null != callback.key && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(
|
|
314
|
-
callback,
|
|
315
|
-
escapedPrefix + (null == callback.key || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(
|
|
316
|
-
userProvidedKeyEscapeRegex,
|
|
317
|
-
"$&/"
|
|
318
|
-
) + "/") + childKey
|
|
319
|
-
), "" !== nameSoFar && null != invokeCallback && isValidElement(invokeCallback) && null == invokeCallback.key && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
|
|
320
|
-
return 1;
|
|
321
|
-
}
|
|
322
|
-
invokeCallback = 0;
|
|
323
|
-
childKey = "" === nameSoFar ? "." : nameSoFar + ":";
|
|
324
|
-
if (isArrayImpl(children))
|
|
325
|
-
for (var i = 0; i < children.length; i++)
|
|
326
|
-
nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
|
|
327
|
-
nameSoFar,
|
|
328
|
-
array,
|
|
329
|
-
escapedPrefix,
|
|
330
|
-
type,
|
|
331
|
-
callback
|
|
332
|
-
);
|
|
333
|
-
else if (i = getIteratorFn(children), "function" === typeof i)
|
|
334
|
-
for (i === children.entries && (didWarnAboutMaps || console.warn(
|
|
335
|
-
"Using Maps as children is not supported. Use an array of keyed ReactElements instead."
|
|
336
|
-
), didWarnAboutMaps = true), children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
|
|
337
|
-
nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
|
|
338
|
-
nameSoFar,
|
|
339
|
-
array,
|
|
340
|
-
escapedPrefix,
|
|
341
|
-
type,
|
|
342
|
-
callback
|
|
343
|
-
);
|
|
344
|
-
else if ("object" === type) {
|
|
345
|
-
if ("function" === typeof children.then)
|
|
346
|
-
return mapIntoArray(
|
|
347
|
-
resolveThenable(children),
|
|
348
|
-
array,
|
|
349
|
-
escapedPrefix,
|
|
350
|
-
nameSoFar,
|
|
351
|
-
callback
|
|
352
|
-
);
|
|
353
|
-
array = String(children);
|
|
354
|
-
throw Error(
|
|
355
|
-
"Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
return invokeCallback;
|
|
359
|
-
}
|
|
360
|
-
function mapChildren(children, func, context) {
|
|
361
|
-
if (null == children) return children;
|
|
362
|
-
var result = [], count = 0;
|
|
363
|
-
mapIntoArray(children, result, "", "", function(child) {
|
|
364
|
-
return func.call(context, child, count++);
|
|
365
|
-
});
|
|
366
|
-
return result;
|
|
367
|
-
}
|
|
368
|
-
function lazyInitializer(payload) {
|
|
369
|
-
if (-1 === payload._status) {
|
|
370
|
-
var ioInfo = payload._ioInfo;
|
|
371
|
-
null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
|
|
372
|
-
ioInfo = payload._result;
|
|
373
|
-
var thenable = ioInfo();
|
|
374
|
-
thenable.then(
|
|
375
|
-
function(moduleObject) {
|
|
376
|
-
if (0 === payload._status || -1 === payload._status) {
|
|
377
|
-
payload._status = 1;
|
|
378
|
-
payload._result = moduleObject;
|
|
379
|
-
var _ioInfo = payload._ioInfo;
|
|
380
|
-
null != _ioInfo && (_ioInfo.end = performance.now());
|
|
381
|
-
void 0 === thenable.status && (thenable.status = "fulfilled", thenable.value = moduleObject);
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
function(error) {
|
|
385
|
-
if (0 === payload._status || -1 === payload._status) {
|
|
386
|
-
payload._status = 2;
|
|
387
|
-
payload._result = error;
|
|
388
|
-
var _ioInfo2 = payload._ioInfo;
|
|
389
|
-
null != _ioInfo2 && (_ioInfo2.end = performance.now());
|
|
390
|
-
void 0 === thenable.status && (thenable.status = "rejected", thenable.reason = error);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
);
|
|
394
|
-
ioInfo = payload._ioInfo;
|
|
395
|
-
if (null != ioInfo) {
|
|
396
|
-
ioInfo.value = thenable;
|
|
397
|
-
var displayName = thenable.displayName;
|
|
398
|
-
"string" === typeof displayName && (ioInfo.name = displayName);
|
|
399
|
-
}
|
|
400
|
-
-1 === payload._status && (payload._status = 0, payload._result = thenable);
|
|
401
|
-
}
|
|
402
|
-
if (1 === payload._status)
|
|
403
|
-
return ioInfo = payload._result, void 0 === ioInfo && console.error(
|
|
404
|
-
"lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",
|
|
405
|
-
ioInfo
|
|
406
|
-
), "default" in ioInfo || console.error(
|
|
407
|
-
"lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
|
|
408
|
-
ioInfo
|
|
409
|
-
), ioInfo.default;
|
|
410
|
-
throw payload._result;
|
|
411
|
-
}
|
|
412
|
-
function resolveDispatcher() {
|
|
413
|
-
var dispatcher = ReactSharedInternals.H;
|
|
414
|
-
null === dispatcher && console.error(
|
|
415
|
-
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
|
|
416
|
-
);
|
|
417
|
-
return dispatcher;
|
|
418
|
-
}
|
|
419
|
-
function releaseAsyncTransition() {
|
|
420
|
-
ReactSharedInternals.asyncTransitions--;
|
|
421
|
-
}
|
|
422
|
-
function enqueueTask(task) {
|
|
423
|
-
if (null === enqueueTaskImpl)
|
|
424
|
-
try {
|
|
425
|
-
var requireString = ("require" + Math.random()).slice(0, 7);
|
|
426
|
-
enqueueTaskImpl = (module && module[requireString]).call(
|
|
427
|
-
module,
|
|
428
|
-
"timers"
|
|
429
|
-
).setImmediate;
|
|
430
|
-
} catch (_err) {
|
|
431
|
-
enqueueTaskImpl = function(callback) {
|
|
432
|
-
false === didWarnAboutMessageChannel && (didWarnAboutMessageChannel = true, "undefined" === typeof MessageChannel && console.error(
|
|
433
|
-
"This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
|
|
434
|
-
));
|
|
435
|
-
var channel = new MessageChannel();
|
|
436
|
-
channel.port1.onmessage = callback;
|
|
437
|
-
channel.port2.postMessage(void 0);
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
return enqueueTaskImpl(task);
|
|
441
|
-
}
|
|
442
|
-
function aggregateErrors(errors) {
|
|
443
|
-
return 1 < errors.length && "function" === typeof AggregateError ? new AggregateError(errors) : errors[0];
|
|
444
|
-
}
|
|
445
|
-
function popActScope(prevActQueue, prevActScopeDepth) {
|
|
446
|
-
prevActScopeDepth !== actScopeDepth - 1 && console.error(
|
|
447
|
-
"You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
|
|
448
|
-
);
|
|
449
|
-
actScopeDepth = prevActScopeDepth;
|
|
450
|
-
}
|
|
451
|
-
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
452
|
-
var queue = ReactSharedInternals.actQueue;
|
|
453
|
-
if (null !== queue)
|
|
454
|
-
if (0 !== queue.length)
|
|
455
|
-
try {
|
|
456
|
-
flushActQueue(queue);
|
|
457
|
-
enqueueTask(function() {
|
|
458
|
-
return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
459
|
-
});
|
|
460
|
-
return;
|
|
461
|
-
} catch (error) {
|
|
462
|
-
ReactSharedInternals.thrownErrors.push(error);
|
|
463
|
-
}
|
|
464
|
-
else ReactSharedInternals.actQueue = null;
|
|
465
|
-
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
|
|
466
|
-
}
|
|
467
|
-
function flushActQueue(queue) {
|
|
468
|
-
if (!isFlushing) {
|
|
469
|
-
isFlushing = true;
|
|
470
|
-
var i = 0;
|
|
471
|
-
try {
|
|
472
|
-
for (; i < queue.length; i++) {
|
|
473
|
-
var callback = queue[i];
|
|
474
|
-
do {
|
|
475
|
-
ReactSharedInternals.didUsePromise = false;
|
|
476
|
-
var continuation = callback(false);
|
|
477
|
-
if (null !== continuation) {
|
|
478
|
-
if (ReactSharedInternals.didUsePromise) {
|
|
479
|
-
queue[i] = callback;
|
|
480
|
-
queue.splice(0, i);
|
|
481
|
-
return;
|
|
482
|
-
}
|
|
483
|
-
callback = continuation;
|
|
484
|
-
} else break;
|
|
485
|
-
} while (1);
|
|
486
|
-
}
|
|
487
|
-
queue.length = 0;
|
|
488
|
-
} catch (error) {
|
|
489
|
-
queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
|
|
490
|
-
} finally {
|
|
491
|
-
isFlushing = false;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
496
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
|
|
497
|
-
isMounted: function() {
|
|
498
|
-
return false;
|
|
499
|
-
},
|
|
500
|
-
enqueueForceUpdate: function(publicInstance) {
|
|
501
|
-
warnNoop(publicInstance, "forceUpdate");
|
|
502
|
-
},
|
|
503
|
-
enqueueReplaceState: function(publicInstance) {
|
|
504
|
-
warnNoop(publicInstance, "replaceState");
|
|
505
|
-
},
|
|
506
|
-
enqueueSetState: function(publicInstance) {
|
|
507
|
-
warnNoop(publicInstance, "setState");
|
|
508
|
-
}
|
|
509
|
-
}, assign = Object.assign, emptyObject = {};
|
|
510
|
-
Object.freeze(emptyObject);
|
|
511
|
-
Component.prototype.isReactComponent = {};
|
|
512
|
-
Component.prototype.setState = function(partialState, callback) {
|
|
513
|
-
if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
|
|
514
|
-
throw Error(
|
|
515
|
-
"takes an object of state variables to update or a function which returns an object of state variables."
|
|
516
|
-
);
|
|
517
|
-
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
518
|
-
};
|
|
519
|
-
Component.prototype.forceUpdate = function(callback) {
|
|
520
|
-
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
521
|
-
};
|
|
522
|
-
var deprecatedAPIs = {
|
|
523
|
-
isMounted: [
|
|
524
|
-
"isMounted",
|
|
525
|
-
"Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
|
|
526
|
-
],
|
|
527
|
-
replaceState: [
|
|
528
|
-
"replaceState",
|
|
529
|
-
"Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
|
|
530
|
-
]
|
|
531
|
-
};
|
|
532
|
-
for (fnName in deprecatedAPIs)
|
|
533
|
-
deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
534
|
-
ComponentDummy.prototype = Component.prototype;
|
|
535
|
-
deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
|
|
536
|
-
deprecatedAPIs.constructor = PureComponent;
|
|
537
|
-
assign(deprecatedAPIs, Component.prototype);
|
|
538
|
-
deprecatedAPIs.isPureReactComponent = true;
|
|
539
|
-
var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
|
|
540
|
-
H: null,
|
|
541
|
-
A: null,
|
|
542
|
-
T: null,
|
|
543
|
-
S: null,
|
|
544
|
-
actQueue: null,
|
|
545
|
-
asyncTransitions: 0,
|
|
546
|
-
isBatchingLegacy: false,
|
|
547
|
-
didScheduleLegacyUpdate: false,
|
|
548
|
-
didUsePromise: false,
|
|
549
|
-
thrownErrors: [],
|
|
550
|
-
getCurrentStack: null,
|
|
551
|
-
recentlyCreatedOwnerStacks: 0
|
|
552
|
-
}, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
|
|
553
|
-
return null;
|
|
554
|
-
};
|
|
555
|
-
deprecatedAPIs = {
|
|
556
|
-
react_stack_bottom_frame: function(callStackForError) {
|
|
557
|
-
return callStackForError();
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
|
|
561
|
-
var didWarnAboutElementRef = {};
|
|
562
|
-
var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
|
|
563
|
-
deprecatedAPIs,
|
|
564
|
-
UnknownOwner
|
|
565
|
-
)();
|
|
566
|
-
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
567
|
-
var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
|
|
568
|
-
if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
|
|
569
|
-
var event = new window.ErrorEvent("error", {
|
|
570
|
-
bubbles: true,
|
|
571
|
-
cancelable: true,
|
|
572
|
-
message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
|
|
573
|
-
error
|
|
574
|
-
});
|
|
575
|
-
if (!window.dispatchEvent(event)) return;
|
|
576
|
-
} else if ("object" === typeof process && "function" === typeof process.emit) {
|
|
577
|
-
process.emit("uncaughtException", error);
|
|
578
|
-
return;
|
|
579
|
-
}
|
|
580
|
-
console.error(error);
|
|
581
|
-
}, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = "function" === typeof queueMicrotask ? function(callback) {
|
|
582
|
-
queueMicrotask(function() {
|
|
583
|
-
return queueMicrotask(callback);
|
|
584
|
-
});
|
|
585
|
-
} : enqueueTask;
|
|
586
|
-
deprecatedAPIs = Object.freeze({
|
|
587
|
-
__proto__: null,
|
|
588
|
-
c: function(size) {
|
|
589
|
-
return resolveDispatcher().useMemoCache(size);
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
var fnName = {
|
|
593
|
-
map: mapChildren,
|
|
594
|
-
forEach: function(children, forEachFunc, forEachContext) {
|
|
595
|
-
mapChildren(
|
|
596
|
-
children,
|
|
597
|
-
function() {
|
|
598
|
-
forEachFunc.apply(this, arguments);
|
|
599
|
-
},
|
|
600
|
-
forEachContext
|
|
601
|
-
);
|
|
602
|
-
},
|
|
603
|
-
count: function(children) {
|
|
604
|
-
var n = 0;
|
|
605
|
-
mapChildren(children, function() {
|
|
606
|
-
n++;
|
|
607
|
-
});
|
|
608
|
-
return n;
|
|
609
|
-
},
|
|
610
|
-
toArray: function(children) {
|
|
611
|
-
return mapChildren(children, function(child) {
|
|
612
|
-
return child;
|
|
613
|
-
}) || [];
|
|
614
|
-
},
|
|
615
|
-
only: function(children) {
|
|
616
|
-
if (!isValidElement(children))
|
|
617
|
-
throw Error(
|
|
618
|
-
"React.Children.only expected to receive a single React element child."
|
|
619
|
-
);
|
|
620
|
-
return children;
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
exports.Activity = REACT_ACTIVITY_TYPE;
|
|
624
|
-
exports.Children = fnName;
|
|
625
|
-
exports.Component = Component;
|
|
626
|
-
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
627
|
-
exports.Profiler = REACT_PROFILER_TYPE;
|
|
628
|
-
exports.PureComponent = PureComponent;
|
|
629
|
-
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
630
|
-
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
631
|
-
exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
|
|
632
|
-
exports.__COMPILER_RUNTIME = deprecatedAPIs;
|
|
633
|
-
exports.act = function(callback) {
|
|
634
|
-
var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
|
|
635
|
-
actScopeDepth++;
|
|
636
|
-
var queue = ReactSharedInternals.actQueue = null !== prevActQueue ? prevActQueue : [], didAwaitActCall = false;
|
|
637
|
-
try {
|
|
638
|
-
var result = callback();
|
|
639
|
-
} catch (error) {
|
|
640
|
-
ReactSharedInternals.thrownErrors.push(error);
|
|
641
|
-
}
|
|
642
|
-
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
643
|
-
throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
644
|
-
if (null !== result && "object" === typeof result && "function" === typeof result.then) {
|
|
645
|
-
var thenable = result;
|
|
646
|
-
queueSeveralMicrotasks(function() {
|
|
647
|
-
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
|
|
648
|
-
"You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"
|
|
649
|
-
));
|
|
650
|
-
});
|
|
651
|
-
return {
|
|
652
|
-
then: function(resolve, reject) {
|
|
653
|
-
didAwaitActCall = true;
|
|
654
|
-
thenable.then(
|
|
655
|
-
function(returnValue) {
|
|
656
|
-
popActScope(prevActQueue, prevActScopeDepth);
|
|
657
|
-
if (0 === prevActScopeDepth) {
|
|
658
|
-
try {
|
|
659
|
-
flushActQueue(queue), enqueueTask(function() {
|
|
660
|
-
return recursivelyFlushAsyncActWork(
|
|
661
|
-
returnValue,
|
|
662
|
-
resolve,
|
|
663
|
-
reject
|
|
664
|
-
);
|
|
665
|
-
});
|
|
666
|
-
} catch (error$0) {
|
|
667
|
-
ReactSharedInternals.thrownErrors.push(error$0);
|
|
668
|
-
}
|
|
669
|
-
if (0 < ReactSharedInternals.thrownErrors.length) {
|
|
670
|
-
var _thrownError = aggregateErrors(
|
|
671
|
-
ReactSharedInternals.thrownErrors
|
|
672
|
-
);
|
|
673
|
-
ReactSharedInternals.thrownErrors.length = 0;
|
|
674
|
-
reject(_thrownError);
|
|
675
|
-
}
|
|
676
|
-
} else resolve(returnValue);
|
|
677
|
-
},
|
|
678
|
-
function(error) {
|
|
679
|
-
popActScope(prevActQueue, prevActScopeDepth);
|
|
680
|
-
0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(
|
|
681
|
-
ReactSharedInternals.thrownErrors
|
|
682
|
-
), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
|
|
683
|
-
}
|
|
684
|
-
);
|
|
685
|
-
}
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
var returnValue$jscomp$0 = result;
|
|
689
|
-
popActScope(prevActQueue, prevActScopeDepth);
|
|
690
|
-
0 === prevActScopeDepth && (flushActQueue(queue), 0 !== queue.length && queueSeveralMicrotasks(function() {
|
|
691
|
-
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
|
|
692
|
-
"A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"
|
|
693
|
-
));
|
|
694
|
-
}), ReactSharedInternals.actQueue = null);
|
|
695
|
-
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
696
|
-
throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
697
|
-
return {
|
|
698
|
-
then: function(resolve, reject) {
|
|
699
|
-
didAwaitActCall = true;
|
|
700
|
-
0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
|
|
701
|
-
return recursivelyFlushAsyncActWork(
|
|
702
|
-
returnValue$jscomp$0,
|
|
703
|
-
resolve,
|
|
704
|
-
reject
|
|
705
|
-
);
|
|
706
|
-
})) : resolve(returnValue$jscomp$0);
|
|
707
|
-
}
|
|
708
|
-
};
|
|
709
|
-
};
|
|
710
|
-
exports.cache = function(fn) {
|
|
711
|
-
return function() {
|
|
712
|
-
return fn.apply(null, arguments);
|
|
713
|
-
};
|
|
714
|
-
};
|
|
715
|
-
exports.cacheSignal = function() {
|
|
716
|
-
return null;
|
|
717
|
-
};
|
|
718
|
-
exports.captureOwnerStack = function() {
|
|
719
|
-
var getCurrentStack = ReactSharedInternals.getCurrentStack;
|
|
720
|
-
return null === getCurrentStack ? null : getCurrentStack();
|
|
721
|
-
};
|
|
722
|
-
exports.cloneElement = function(element, config, children) {
|
|
723
|
-
if (null === element || void 0 === element)
|
|
724
|
-
throw Error(
|
|
725
|
-
"The argument must be a React element, but you passed " + element + "."
|
|
726
|
-
);
|
|
727
|
-
var props = assign({}, element.props), key = element.key, owner = element._owner;
|
|
728
|
-
if (null != config) {
|
|
729
|
-
var JSCompiler_inline_result;
|
|
730
|
-
a: {
|
|
731
|
-
if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
|
|
732
|
-
config,
|
|
733
|
-
"ref"
|
|
734
|
-
).get) && JSCompiler_inline_result.isReactWarning) {
|
|
735
|
-
JSCompiler_inline_result = false;
|
|
736
|
-
break a;
|
|
737
|
-
}
|
|
738
|
-
JSCompiler_inline_result = void 0 !== config.ref;
|
|
739
|
-
}
|
|
740
|
-
JSCompiler_inline_result && (owner = getOwner());
|
|
741
|
-
hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
|
|
742
|
-
for (propName in config)
|
|
743
|
-
!hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
|
|
744
|
-
}
|
|
745
|
-
var propName = arguments.length - 2;
|
|
746
|
-
if (1 === propName) props.children = children;
|
|
747
|
-
else if (1 < propName) {
|
|
748
|
-
JSCompiler_inline_result = Array(propName);
|
|
749
|
-
for (var i = 0; i < propName; i++)
|
|
750
|
-
JSCompiler_inline_result[i] = arguments[i + 2];
|
|
751
|
-
props.children = JSCompiler_inline_result;
|
|
752
|
-
}
|
|
753
|
-
props = ReactElement(
|
|
754
|
-
element.type,
|
|
755
|
-
key,
|
|
756
|
-
props,
|
|
757
|
-
owner,
|
|
758
|
-
element._debugStack,
|
|
759
|
-
element._debugTask
|
|
760
|
-
);
|
|
761
|
-
for (key = 2; key < arguments.length; key++)
|
|
762
|
-
validateChildKeys(arguments[key]);
|
|
763
|
-
return props;
|
|
764
|
-
};
|
|
765
|
-
exports.createContext = function(defaultValue) {
|
|
766
|
-
defaultValue = {
|
|
767
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
768
|
-
_currentValue: defaultValue,
|
|
769
|
-
_currentValue2: defaultValue,
|
|
770
|
-
_threadCount: 0,
|
|
771
|
-
Provider: null,
|
|
772
|
-
Consumer: null
|
|
773
|
-
};
|
|
774
|
-
defaultValue.Provider = defaultValue;
|
|
775
|
-
defaultValue.Consumer = {
|
|
776
|
-
$$typeof: REACT_CONSUMER_TYPE,
|
|
777
|
-
_context: defaultValue
|
|
778
|
-
};
|
|
779
|
-
defaultValue._currentRenderer = null;
|
|
780
|
-
defaultValue._currentRenderer2 = null;
|
|
781
|
-
return defaultValue;
|
|
782
|
-
};
|
|
783
|
-
exports.createElement = function(type, config, children) {
|
|
784
|
-
for (var i = 2; i < arguments.length; i++)
|
|
785
|
-
validateChildKeys(arguments[i]);
|
|
786
|
-
i = {};
|
|
787
|
-
var key = null;
|
|
788
|
-
if (null != config)
|
|
789
|
-
for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn(
|
|
790
|
-
"Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
|
|
791
|
-
)), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config)
|
|
792
|
-
hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config[propName]);
|
|
793
|
-
var childrenLength = arguments.length - 2;
|
|
794
|
-
if (1 === childrenLength) i.children = children;
|
|
795
|
-
else if (1 < childrenLength) {
|
|
796
|
-
for (var childArray = Array(childrenLength), _i = 0; _i < childrenLength; _i++)
|
|
797
|
-
childArray[_i] = arguments[_i + 2];
|
|
798
|
-
Object.freeze && Object.freeze(childArray);
|
|
799
|
-
i.children = childArray;
|
|
800
|
-
}
|
|
801
|
-
if (type && type.defaultProps)
|
|
802
|
-
for (propName in childrenLength = type.defaultProps, childrenLength)
|
|
803
|
-
void 0 === i[propName] && (i[propName] = childrenLength[propName]);
|
|
804
|
-
key && defineKeyPropWarningGetter(
|
|
805
|
-
i,
|
|
806
|
-
"function" === typeof type ? type.displayName || type.name || "Unknown" : type
|
|
807
|
-
);
|
|
808
|
-
var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
809
|
-
return ReactElement(
|
|
810
|
-
type,
|
|
811
|
-
key,
|
|
812
|
-
i,
|
|
813
|
-
getOwner(),
|
|
814
|
-
propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
|
|
815
|
-
propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
816
|
-
);
|
|
817
|
-
};
|
|
818
|
-
exports.createRef = function() {
|
|
819
|
-
var refObject = { current: null };
|
|
820
|
-
Object.seal(refObject);
|
|
821
|
-
return refObject;
|
|
822
|
-
};
|
|
823
|
-
exports.forwardRef = function(render) {
|
|
824
|
-
null != render && render.$$typeof === REACT_MEMO_TYPE ? console.error(
|
|
825
|
-
"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
|
|
826
|
-
) : "function" !== typeof render ? console.error(
|
|
827
|
-
"forwardRef requires a render function but was given %s.",
|
|
828
|
-
null === render ? "null" : typeof render
|
|
829
|
-
) : 0 !== render.length && 2 !== render.length && console.error(
|
|
830
|
-
"forwardRef render functions accept exactly two parameters: props and ref. %s",
|
|
831
|
-
1 === render.length ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
|
|
832
|
-
);
|
|
833
|
-
null != render && null != render.defaultProps && console.error(
|
|
834
|
-
"forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
|
|
835
|
-
);
|
|
836
|
-
var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
|
|
837
|
-
Object.defineProperty(elementType, "displayName", {
|
|
838
|
-
enumerable: false,
|
|
839
|
-
configurable: true,
|
|
840
|
-
get: function() {
|
|
841
|
-
return ownName;
|
|
842
|
-
},
|
|
843
|
-
set: function(name) {
|
|
844
|
-
ownName = name;
|
|
845
|
-
render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
|
|
846
|
-
}
|
|
847
|
-
});
|
|
848
|
-
return elementType;
|
|
849
|
-
};
|
|
850
|
-
exports.isValidElement = isValidElement;
|
|
851
|
-
exports.lazy = function(ctor) {
|
|
852
|
-
ctor = { _status: -1, _result: ctor };
|
|
853
|
-
var lazyType = {
|
|
854
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
855
|
-
_payload: ctor,
|
|
856
|
-
_init: lazyInitializer
|
|
857
|
-
}, ioInfo = {
|
|
858
|
-
name: "lazy",
|
|
859
|
-
start: -1,
|
|
860
|
-
end: -1,
|
|
861
|
-
value: null,
|
|
862
|
-
owner: null,
|
|
863
|
-
debugStack: Error("react-stack-top-frame"),
|
|
864
|
-
debugTask: console.createTask ? console.createTask("lazy()") : null
|
|
865
|
-
};
|
|
866
|
-
ctor._ioInfo = ioInfo;
|
|
867
|
-
lazyType._debugInfo = [{ awaited: ioInfo }];
|
|
868
|
-
return lazyType;
|
|
869
|
-
};
|
|
870
|
-
exports.memo = function(type, compare) {
|
|
871
|
-
null == type && console.error(
|
|
872
|
-
"memo: The first argument must be a component. Instead received: %s",
|
|
873
|
-
null === type ? "null" : typeof type
|
|
874
|
-
);
|
|
875
|
-
compare = {
|
|
876
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
877
|
-
type,
|
|
878
|
-
compare: void 0 === compare ? null : compare
|
|
879
|
-
};
|
|
880
|
-
var ownName;
|
|
881
|
-
Object.defineProperty(compare, "displayName", {
|
|
882
|
-
enumerable: false,
|
|
883
|
-
configurable: true,
|
|
884
|
-
get: function() {
|
|
885
|
-
return ownName;
|
|
886
|
-
},
|
|
887
|
-
set: function(name) {
|
|
888
|
-
ownName = name;
|
|
889
|
-
type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
|
|
890
|
-
}
|
|
891
|
-
});
|
|
892
|
-
return compare;
|
|
893
|
-
};
|
|
894
|
-
exports.startTransition = function(scope) {
|
|
895
|
-
var prevTransition = ReactSharedInternals.T, currentTransition = {};
|
|
896
|
-
currentTransition._updatedFibers = /* @__PURE__ */ new Set();
|
|
897
|
-
ReactSharedInternals.T = currentTransition;
|
|
898
|
-
try {
|
|
899
|
-
var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
|
|
900
|
-
null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
|
|
901
|
-
"object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
|
|
902
|
-
} catch (error) {
|
|
903
|
-
reportGlobalError(error);
|
|
904
|
-
} finally {
|
|
905
|
-
null === prevTransition && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn(
|
|
906
|
-
"Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
|
|
907
|
-
)), null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error(
|
|
908
|
-
"We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."
|
|
909
|
-
), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
|
|
910
|
-
}
|
|
911
|
-
};
|
|
912
|
-
exports.unstable_useCacheRefresh = function() {
|
|
913
|
-
return resolveDispatcher().useCacheRefresh();
|
|
914
|
-
};
|
|
915
|
-
exports.use = function(usable) {
|
|
916
|
-
return resolveDispatcher().use(usable);
|
|
917
|
-
};
|
|
918
|
-
exports.useActionState = function(action, initialState, permalink) {
|
|
919
|
-
return resolveDispatcher().useActionState(
|
|
920
|
-
action,
|
|
921
|
-
initialState,
|
|
922
|
-
permalink
|
|
923
|
-
);
|
|
924
|
-
};
|
|
925
|
-
exports.useCallback = function(callback, deps) {
|
|
926
|
-
return resolveDispatcher().useCallback(callback, deps);
|
|
927
|
-
};
|
|
928
|
-
exports.useContext = function(Context) {
|
|
929
|
-
var dispatcher = resolveDispatcher();
|
|
930
|
-
Context.$$typeof === REACT_CONSUMER_TYPE && console.error(
|
|
931
|
-
"Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
|
|
932
|
-
);
|
|
933
|
-
return dispatcher.useContext(Context);
|
|
934
|
-
};
|
|
935
|
-
exports.useDebugValue = function(value, formatterFn) {
|
|
936
|
-
return resolveDispatcher().useDebugValue(value, formatterFn);
|
|
937
|
-
};
|
|
938
|
-
exports.useDeferredValue = function(value, initialValue) {
|
|
939
|
-
return resolveDispatcher().useDeferredValue(value, initialValue);
|
|
940
|
-
};
|
|
941
|
-
exports.useEffect = function(create, deps) {
|
|
942
|
-
null == create && console.warn(
|
|
943
|
-
"React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
944
|
-
);
|
|
945
|
-
return resolveDispatcher().useEffect(create, deps);
|
|
946
|
-
};
|
|
947
|
-
exports.useEffectEvent = function(callback) {
|
|
948
|
-
return resolveDispatcher().useEffectEvent(callback);
|
|
949
|
-
};
|
|
950
|
-
exports.useId = function() {
|
|
951
|
-
return resolveDispatcher().useId();
|
|
952
|
-
};
|
|
953
|
-
exports.useImperativeHandle = function(ref, create, deps) {
|
|
954
|
-
return resolveDispatcher().useImperativeHandle(ref, create, deps);
|
|
955
|
-
};
|
|
956
|
-
exports.useInsertionEffect = function(create, deps) {
|
|
957
|
-
null == create && console.warn(
|
|
958
|
-
"React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
959
|
-
);
|
|
960
|
-
return resolveDispatcher().useInsertionEffect(create, deps);
|
|
961
|
-
};
|
|
962
|
-
exports.useLayoutEffect = function(create, deps) {
|
|
963
|
-
null == create && console.warn(
|
|
964
|
-
"React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
965
|
-
);
|
|
966
|
-
return resolveDispatcher().useLayoutEffect(create, deps);
|
|
967
|
-
};
|
|
968
|
-
exports.useMemo = function(create, deps) {
|
|
969
|
-
return resolveDispatcher().useMemo(create, deps);
|
|
970
|
-
};
|
|
971
|
-
exports.useOptimistic = function(passthrough, reducer) {
|
|
972
|
-
return resolveDispatcher().useOptimistic(passthrough, reducer);
|
|
973
|
-
};
|
|
974
|
-
exports.useReducer = function(reducer, initialArg, init) {
|
|
975
|
-
return resolveDispatcher().useReducer(reducer, initialArg, init);
|
|
976
|
-
};
|
|
977
|
-
exports.useRef = function(initialValue) {
|
|
978
|
-
return resolveDispatcher().useRef(initialValue);
|
|
979
|
-
};
|
|
980
|
-
exports.useState = function(initialState) {
|
|
981
|
-
return resolveDispatcher().useState(initialState);
|
|
982
|
-
};
|
|
983
|
-
exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
|
|
984
|
-
return resolveDispatcher().useSyncExternalStore(
|
|
985
|
-
subscribe,
|
|
986
|
-
getSnapshot,
|
|
987
|
-
getServerSnapshot
|
|
988
|
-
);
|
|
989
|
-
};
|
|
990
|
-
exports.useTransition = function() {
|
|
991
|
-
return resolveDispatcher().useTransition();
|
|
992
|
-
};
|
|
993
|
-
exports.version = "19.2.0";
|
|
994
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
995
|
-
})();
|
|
996
|
-
}
|
|
997
|
-
});
|
|
998
|
-
|
|
999
|
-
// node_modules/react/index.js
|
|
1000
|
-
var require_react = __commonJS({
|
|
1001
|
-
"node_modules/react/index.js"(exports, module) {
|
|
1002
|
-
"use strict";
|
|
1003
|
-
if (false) {
|
|
1004
|
-
module.exports = null;
|
|
1005
|
-
} else {
|
|
1006
|
-
module.exports = require_react_development();
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
});
|
|
1010
|
-
|
|
1011
1
|
// src/provider.js
|
|
1012
|
-
|
|
2
|
+
import React, { createContext, useContext, useEffect, useState, useCallback, useRef } from "react";
|
|
1013
3
|
|
|
1014
4
|
// src/securityUtils.js
|
|
1015
5
|
function isSecureContext() {
|
|
@@ -1039,19 +29,19 @@ function getSafeErrorMessage(error) {
|
|
|
1039
29
|
}
|
|
1040
30
|
|
|
1041
31
|
// src/provider.js
|
|
1042
|
-
var AuthContext =
|
|
32
|
+
var AuthContext = createContext(null);
|
|
1043
33
|
var FlowlinkAuthProvider = ({ children, publishableKey, baseUrl, redirect }) => {
|
|
1044
|
-
const [ready, setReady] =
|
|
1045
|
-
const [error, setError] =
|
|
1046
|
-
const [user, setUser] =
|
|
1047
|
-
const [loadingUser, setLoadingUser] =
|
|
1048
|
-
const [sessionTimeout, setSessionTimeout] =
|
|
1049
|
-
const redirectedRef =
|
|
1050
|
-
const sessionTimerRef =
|
|
1051
|
-
|
|
34
|
+
const [ready, setReady] = useState(false);
|
|
35
|
+
const [error, setError] = useState(null);
|
|
36
|
+
const [user, setUser] = useState(null);
|
|
37
|
+
const [loadingUser, setLoadingUser] = useState(true);
|
|
38
|
+
const [sessionTimeout, setSessionTimeout] = useState(null);
|
|
39
|
+
const redirectedRef = useRef(false);
|
|
40
|
+
const sessionTimerRef = useRef(null);
|
|
41
|
+
useEffect(() => {
|
|
1052
42
|
checkSecureContext();
|
|
1053
43
|
}, []);
|
|
1054
|
-
|
|
44
|
+
useEffect(() => {
|
|
1055
45
|
if (!publishableKey || !publishableKey.trim()) {
|
|
1056
46
|
setError("Missing publishable key");
|
|
1057
47
|
setReady(false);
|
|
@@ -1068,7 +58,7 @@ var FlowlinkAuthProvider = ({ children, publishableKey, baseUrl, redirect }) =>
|
|
|
1068
58
|
setError(null);
|
|
1069
59
|
setReady(true);
|
|
1070
60
|
}, [publishableKey, baseUrl]);
|
|
1071
|
-
const normalizedBase =
|
|
61
|
+
const normalizedBase = useCallback(() => {
|
|
1072
62
|
return baseUrl?.replace(/\/+$/, "") || "";
|
|
1073
63
|
}, [baseUrl]);
|
|
1074
64
|
const redirectTo = (url, { replace = true } = {}) => {
|
|
@@ -1085,7 +75,7 @@ var FlowlinkAuthProvider = ({ children, publishableKey, baseUrl, redirect }) =>
|
|
|
1085
75
|
window.location.href = url;
|
|
1086
76
|
}
|
|
1087
77
|
};
|
|
1088
|
-
const resetSessionTimeout =
|
|
78
|
+
const resetSessionTimeout = useCallback(() => {
|
|
1089
79
|
if (sessionTimerRef.current) {
|
|
1090
80
|
clearTimeout(sessionTimerRef.current);
|
|
1091
81
|
}
|
|
@@ -1094,7 +84,7 @@ var FlowlinkAuthProvider = ({ children, publishableKey, baseUrl, redirect }) =>
|
|
|
1094
84
|
logout();
|
|
1095
85
|
}, 24 * 60 * 60 * 1e3);
|
|
1096
86
|
}, []);
|
|
1097
|
-
const fetchMe =
|
|
87
|
+
const fetchMe = useCallback(async () => {
|
|
1098
88
|
setLoadingUser(true);
|
|
1099
89
|
try {
|
|
1100
90
|
const base = normalizedBase();
|
|
@@ -1130,7 +120,7 @@ var FlowlinkAuthProvider = ({ children, publishableKey, baseUrl, redirect }) =>
|
|
|
1130
120
|
return null;
|
|
1131
121
|
}
|
|
1132
122
|
}, [normalizedBase, resetSessionTimeout]);
|
|
1133
|
-
|
|
123
|
+
useEffect(() => {
|
|
1134
124
|
if (!ready) return;
|
|
1135
125
|
fetchMe();
|
|
1136
126
|
const onStorage = (e) => {
|
|
@@ -1148,7 +138,7 @@ var FlowlinkAuthProvider = ({ children, publishableKey, baseUrl, redirect }) =>
|
|
|
1148
138
|
}
|
|
1149
139
|
};
|
|
1150
140
|
}, [ready, fetchMe]);
|
|
1151
|
-
|
|
141
|
+
useEffect(() => {
|
|
1152
142
|
if (!ready) return;
|
|
1153
143
|
if (loadingUser) return;
|
|
1154
144
|
if (!user) {
|
|
@@ -1160,7 +150,7 @@ var FlowlinkAuthProvider = ({ children, publishableKey, baseUrl, redirect }) =>
|
|
|
1160
150
|
redirectTo(redirect, { replace: true });
|
|
1161
151
|
}
|
|
1162
152
|
}, [ready, loadingUser, user, redirect]);
|
|
1163
|
-
const completeLogin =
|
|
153
|
+
const completeLogin = useCallback(async (opts = {}) => {
|
|
1164
154
|
const { redirectTo: redirectUrl, replace = true } = opts;
|
|
1165
155
|
const u = await fetchMe();
|
|
1166
156
|
try {
|
|
@@ -1173,7 +163,7 @@ var FlowlinkAuthProvider = ({ children, publishableKey, baseUrl, redirect }) =>
|
|
|
1173
163
|
}
|
|
1174
164
|
return u;
|
|
1175
165
|
}, [fetchMe, redirect]);
|
|
1176
|
-
const logout =
|
|
166
|
+
const logout = useCallback(async (opts = {}) => {
|
|
1177
167
|
const { callServer = true, redirectTo: redirectUrl, replace = true } = opts;
|
|
1178
168
|
const base = normalizedBase();
|
|
1179
169
|
if (callServer && base) {
|
|
@@ -1205,17 +195,17 @@ var FlowlinkAuthProvider = ({ children, publishableKey, baseUrl, redirect }) =>
|
|
|
1205
195
|
logout,
|
|
1206
196
|
completeLogin
|
|
1207
197
|
};
|
|
1208
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ React.createElement(AuthContext.Provider, { value }, error ? /* @__PURE__ */ React.createElement("div", { style: { padding: "20px", background: "#220000", color: "white" } }, /* @__PURE__ */ React.createElement("h2", null, "flowlink Auth Error"), /* @__PURE__ */ React.createElement("p", null, error)) : !ready ? null : children);
|
|
1209
199
|
};
|
|
1210
200
|
var useAuth = () => {
|
|
1211
|
-
const ctx =
|
|
201
|
+
const ctx = useContext(AuthContext);
|
|
1212
202
|
if (!ctx) throw new Error("useAuth must be used within FlowlinkAuthProvider");
|
|
1213
203
|
return ctx;
|
|
1214
204
|
};
|
|
1215
205
|
var provider_default = FlowlinkAuthProvider;
|
|
1216
206
|
|
|
1217
207
|
// src/SignIn.jsx
|
|
1218
|
-
|
|
208
|
+
import React2, { useState as useState2 } from "react";
|
|
1219
209
|
function SignIn({ onSuccess } = {}) {
|
|
1220
210
|
const {
|
|
1221
211
|
publishableKey,
|
|
@@ -1228,11 +218,11 @@ function SignIn({ onSuccess } = {}) {
|
|
|
1228
218
|
fetchMe,
|
|
1229
219
|
setUser
|
|
1230
220
|
} = useAuth();
|
|
1231
|
-
const [email, setEmail] = (
|
|
1232
|
-
const [password, setPassword] = (
|
|
1233
|
-
const [loading, setLoading] = (
|
|
1234
|
-
const [error, setError] = (
|
|
1235
|
-
const [message, setMessage] = (
|
|
221
|
+
const [email, setEmail] = useState2("");
|
|
222
|
+
const [password, setPassword] = useState2("");
|
|
223
|
+
const [loading, setLoading] = useState2(false);
|
|
224
|
+
const [error, setError] = useState2(null);
|
|
225
|
+
const [message, setMessage] = useState2(null);
|
|
1236
226
|
if (loadingUser) return null;
|
|
1237
227
|
if (user && redirect) {
|
|
1238
228
|
if (typeof redirectTo === "function") redirectTo(redirect);
|
|
@@ -1308,10 +298,10 @@ function SignIn({ onSuccess } = {}) {
|
|
|
1308
298
|
try {
|
|
1309
299
|
const rid = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
1310
300
|
const callbackUrl = encodeURIComponent(`${window.location.origin}/signin`);
|
|
1311
|
-
const sdkBase = typeof process !== "undefined" && process.env && process.env.
|
|
301
|
+
const sdkBase = typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_FLOWLINK_BASE_URL || baseUrl || "http://localhost:3001";
|
|
1312
302
|
const startUrl = `${sdkBase.replace(/\/+$/, "")}/sdk/auth/start?rid=${rid}&source=${encodeURIComponent(provider)}&callbackUrl=${callbackUrl}`;
|
|
1313
303
|
if (!publishableKey) {
|
|
1314
|
-
throw new Error("Missing publishable key (client side). Set
|
|
304
|
+
throw new Error("Missing publishable key (client side). Set NEXT_PUBLIC_FLOWLINK_PUBLISHABLE_KEY or provide publishableKey in provider.");
|
|
1315
305
|
}
|
|
1316
306
|
const res = await fetch(startUrl, {
|
|
1317
307
|
method: "GET",
|
|
@@ -1336,7 +326,7 @@ function SignIn({ onSuccess } = {}) {
|
|
|
1336
326
|
if (e && typeof e.preventDefault === "function") e.preventDefault();
|
|
1337
327
|
startOAuthFlow("github");
|
|
1338
328
|
};
|
|
1339
|
-
return /* @__PURE__ */
|
|
329
|
+
return /* @__PURE__ */ React2.createElement("div", { style: overlay }, /* @__PURE__ */ React2.createElement("div", { style: modal }, /* @__PURE__ */ React2.createElement("h2", { style: title }, "Sign in"), /* @__PURE__ */ React2.createElement("p", { style: subtitle }, "Welcome back \u2014 enter your credentials."), /* @__PURE__ */ React2.createElement("form", { onSubmit: submit, style: { width: "100%" } }, /* @__PURE__ */ React2.createElement("label", { style: label }, "Email"), /* @__PURE__ */ React2.createElement(
|
|
1340
330
|
"input",
|
|
1341
331
|
{
|
|
1342
332
|
style: input,
|
|
@@ -1345,7 +335,7 @@ function SignIn({ onSuccess } = {}) {
|
|
|
1345
335
|
type: "email",
|
|
1346
336
|
required: true
|
|
1347
337
|
}
|
|
1348
|
-
), /* @__PURE__ */
|
|
338
|
+
), /* @__PURE__ */ React2.createElement("label", { style: label }, "Password"), /* @__PURE__ */ React2.createElement(
|
|
1349
339
|
"input",
|
|
1350
340
|
{
|
|
1351
341
|
style: input,
|
|
@@ -1354,7 +344,7 @@ function SignIn({ onSuccess } = {}) {
|
|
|
1354
344
|
onChange: (e) => setPassword(e.target.value),
|
|
1355
345
|
required: true
|
|
1356
346
|
}
|
|
1357
|
-
), /* @__PURE__ */
|
|
347
|
+
), /* @__PURE__ */ React2.createElement("div", { style: { marginTop: 12 } }, /* @__PURE__ */ React2.createElement("button", { style: button, type: "submit", disabled: loading }, loading ? "Signing in\u2026" : "Sign in")), /* @__PURE__ */ React2.createElement("div", { style: { display: "flex", gap: 8, marginTop: 16 } }, /* @__PURE__ */ React2.createElement("button", { type: "button", onClick: handleGoogle, style: oauthButtonGoogle, disabled: loading }, "Continue with Google"), /* @__PURE__ */ React2.createElement("button", { type: "button", onClick: handleGithub, style: oauthButtonGithub, disabled: loading }, "Continue with GitHub")), error && /* @__PURE__ */ React2.createElement("div", { style: errorBox }, error), message && /* @__PURE__ */ React2.createElement("div", { style: successBox }, message))));
|
|
1358
348
|
}
|
|
1359
349
|
var overlay = { position: "fixed", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", background: "rgba(0,0,0,0.45)", zIndex: 9999, padding: 20 };
|
|
1360
350
|
var modal = { width: "100%", maxWidth: 420, background: "#0f1724", color: "#fff", borderRadius: 12, padding: 22, boxShadow: "0 10px 30px rgba(2,6,23,0.6)", border: "1px solid rgba(255,255,255,0.04)" };
|
|
@@ -1369,7 +359,7 @@ var errorBox = { marginTop: 10, color: "#ffb4b4", fontSize: 13 };
|
|
|
1369
359
|
var successBox = { marginTop: 10, color: "#bef264", fontSize: 13 };
|
|
1370
360
|
|
|
1371
361
|
// src/SignUp.jsx
|
|
1372
|
-
|
|
362
|
+
import React3, { useState as useState3 } from "react";
|
|
1373
363
|
function SignUp() {
|
|
1374
364
|
const {
|
|
1375
365
|
publishableKey,
|
|
@@ -1381,12 +371,12 @@ function SignUp() {
|
|
|
1381
371
|
fetchMe,
|
|
1382
372
|
setUser
|
|
1383
373
|
} = useAuth();
|
|
1384
|
-
const [name, setName] = (
|
|
1385
|
-
const [email, setEmail] = (
|
|
1386
|
-
const [password, setPassword] = (
|
|
1387
|
-
const [loading, setLoading] = (
|
|
1388
|
-
const [error, setError] = (
|
|
1389
|
-
const [message, setMessage] = (
|
|
374
|
+
const [name, setName] = useState3("");
|
|
375
|
+
const [email, setEmail] = useState3("");
|
|
376
|
+
const [password, setPassword] = useState3("");
|
|
377
|
+
const [loading, setLoading] = useState3(false);
|
|
378
|
+
const [error, setError] = useState3(null);
|
|
379
|
+
const [message, setMessage] = useState3(null);
|
|
1390
380
|
if (loadingUser) return null;
|
|
1391
381
|
if (user && redirect) {
|
|
1392
382
|
if (typeof redirectTo === "function") redirectTo(redirect);
|
|
@@ -1433,10 +423,10 @@ function SignUp() {
|
|
|
1433
423
|
try {
|
|
1434
424
|
const rid = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
1435
425
|
const callbackUrl = encodeURIComponent(`${window.location.origin}/signup`);
|
|
1436
|
-
const sdkBase = typeof process !== "undefined" && process.env && process.env.
|
|
426
|
+
const sdkBase = typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_FLOWLINK_BASE_URL || baseUrl || window.location.origin.replace(/\/+$/, "");
|
|
1437
427
|
const startUrl = `${sdkBase}/sdk/auth/start?rid=${rid}&source=${encodeURIComponent(provider)}&callbackUrl=${callbackUrl}`;
|
|
1438
428
|
if (!publishableKey) {
|
|
1439
|
-
throw new Error("Missing publishable key (client side). Set
|
|
429
|
+
throw new Error("Missing publishable key (client side). Set NEXT_PUBLIC_FLOWLINK_PUBLISHABLE_KEY or provide publishableKey in provider.");
|
|
1440
430
|
}
|
|
1441
431
|
const res = await fetch(startUrl, {
|
|
1442
432
|
method: "GET",
|
|
@@ -1466,7 +456,7 @@ function SignUp() {
|
|
|
1466
456
|
if (e && typeof e.preventDefault === "function") e.preventDefault();
|
|
1467
457
|
startOAuthFlow("github");
|
|
1468
458
|
};
|
|
1469
|
-
return /* @__PURE__ */
|
|
459
|
+
return /* @__PURE__ */ React3.createElement("div", { style: overlay2 }, /* @__PURE__ */ React3.createElement("div", { style: modal2 }, /* @__PURE__ */ React3.createElement("h2", { style: title2 }, "Create account"), /* @__PURE__ */ React3.createElement("form", { onSubmit: submit }, /* @__PURE__ */ React3.createElement("label", { style: label2 }, "Full name"), /* @__PURE__ */ React3.createElement(
|
|
1470
460
|
"input",
|
|
1471
461
|
{
|
|
1472
462
|
name: "name",
|
|
@@ -1475,7 +465,7 @@ function SignUp() {
|
|
|
1475
465
|
onChange: (e) => setName(e.target.value),
|
|
1476
466
|
autoComplete: "name"
|
|
1477
467
|
}
|
|
1478
|
-
), /* @__PURE__ */
|
|
468
|
+
), /* @__PURE__ */ React3.createElement("label", { style: label2 }, "Email"), /* @__PURE__ */ React3.createElement(
|
|
1479
469
|
"input",
|
|
1480
470
|
{
|
|
1481
471
|
name: "email",
|
|
@@ -1486,7 +476,7 @@ function SignUp() {
|
|
|
1486
476
|
required: true,
|
|
1487
477
|
autoComplete: "email"
|
|
1488
478
|
}
|
|
1489
|
-
), /* @__PURE__ */
|
|
479
|
+
), /* @__PURE__ */ React3.createElement("label", { style: label2 }, "Password"), /* @__PURE__ */ React3.createElement(
|
|
1490
480
|
"input",
|
|
1491
481
|
{
|
|
1492
482
|
name: "password",
|
|
@@ -1497,7 +487,7 @@ function SignUp() {
|
|
|
1497
487
|
required: true,
|
|
1498
488
|
autoComplete: "new-password"
|
|
1499
489
|
}
|
|
1500
|
-
), /* @__PURE__ */
|
|
490
|
+
), /* @__PURE__ */ React3.createElement("div", { style: { marginTop: 12 } }, /* @__PURE__ */ React3.createElement("button", { style: button2, type: "submit", disabled: loading }, loading ? "Creating..." : "Create account")), /* @__PURE__ */ React3.createElement("div", { style: { display: "flex", gap: 8, marginTop: 16 } }, /* @__PURE__ */ React3.createElement(
|
|
1501
491
|
"button",
|
|
1502
492
|
{
|
|
1503
493
|
type: "button",
|
|
@@ -1505,7 +495,7 @@ function SignUp() {
|
|
|
1505
495
|
style: oauthButtonGoogle2
|
|
1506
496
|
},
|
|
1507
497
|
"Continue with Google"
|
|
1508
|
-
), /* @__PURE__ */
|
|
498
|
+
), /* @__PURE__ */ React3.createElement(
|
|
1509
499
|
"button",
|
|
1510
500
|
{
|
|
1511
501
|
type: "button",
|
|
@@ -1513,7 +503,7 @@ function SignUp() {
|
|
|
1513
503
|
style: oauthButtonGithub2
|
|
1514
504
|
},
|
|
1515
505
|
"Continue with GitHub"
|
|
1516
|
-
)), error && /* @__PURE__ */
|
|
506
|
+
)), error && /* @__PURE__ */ React3.createElement("div", { style: errorBox2 }, error), message && /* @__PURE__ */ React3.createElement("div", { style: successBox2 }, message))));
|
|
1517
507
|
}
|
|
1518
508
|
var overlay2 = {
|
|
1519
509
|
position: "fixed",
|
|
@@ -1581,16 +571,3 @@ export {
|
|
|
1581
571
|
SignUp,
|
|
1582
572
|
useAuth
|
|
1583
573
|
};
|
|
1584
|
-
/*! Bundled license information:
|
|
1585
|
-
|
|
1586
|
-
react/cjs/react.development.js:
|
|
1587
|
-
(**
|
|
1588
|
-
* @license React
|
|
1589
|
-
* react.development.js
|
|
1590
|
-
*
|
|
1591
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1592
|
-
*
|
|
1593
|
-
* This source code is licensed under the MIT license found in the
|
|
1594
|
-
* LICENSE file in the root directory of this source tree.
|
|
1595
|
-
*)
|
|
1596
|
-
*/
|