@sudobility/auth-components-rn 1.0.1
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/AuthAction.d.ts +7 -0
- package/dist/AuthAction.d.ts.map +1 -0
- package/dist/AuthInline.d.ts +7 -0
- package/dist/AuthInline.d.ts.map +1 -0
- package/dist/AuthProvider.d.ts +15 -0
- package/dist/AuthProvider.d.ts.map +1 -0
- package/dist/AuthScreen.d.ts +7 -0
- package/dist/AuthScreen.d.ts.map +1 -0
- package/dist/Avatar.d.ts +8 -0
- package/dist/Avatar.d.ts.map +1 -0
- package/dist/EmailSignInForm.d.ts +7 -0
- package/dist/EmailSignInForm.d.ts.map +1 -0
- package/dist/EmailSignUpForm.d.ts +7 -0
- package/dist/EmailSignUpForm.d.ts.map +1 -0
- package/dist/ForgotPasswordForm.d.ts +7 -0
- package/dist/ForgotPasswordForm.d.ts.map +1 -0
- package/dist/ProviderButtons.d.ts +7 -0
- package/dist/ProviderButtons.d.ts.map +1 -0
- package/dist/index.cjs.js +1850 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +1850 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/types.d.ts +313 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +64 -0
- package/src/AuthAction.tsx +107 -0
- package/src/AuthInline.tsx +124 -0
- package/src/AuthProvider.tsx +276 -0
- package/src/AuthScreen.tsx +117 -0
- package/src/Avatar.tsx +86 -0
- package/src/EmailSignInForm.tsx +130 -0
- package/src/EmailSignUpForm.tsx +161 -0
- package/src/ForgotPasswordForm.tsx +129 -0
- package/src/ProviderButtons.tsx +106 -0
- package/src/__tests__/AuthAction.test.tsx +261 -0
- package/src/__tests__/AuthProvider.test.tsx +459 -0
- package/src/__tests__/Avatar.test.tsx +165 -0
- package/src/index.ts +52 -0
- package/src/nativewind.d.ts +30 -0
- package/src/types.ts +383 -0
|
@@ -0,0 +1,1850 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require$$0 = require("react");
|
|
4
|
+
const reactNative = require("react-native");
|
|
5
|
+
const componentsRn = require("@sudobility/components-rn");
|
|
6
|
+
var jsxRuntime = { exports: {} };
|
|
7
|
+
var reactJsxRuntime_production_min = {};
|
|
8
|
+
/**
|
|
9
|
+
* @license React
|
|
10
|
+
* react-jsx-runtime.production.min.js
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
var hasRequiredReactJsxRuntime_production_min;
|
|
18
|
+
function requireReactJsxRuntime_production_min() {
|
|
19
|
+
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
20
|
+
hasRequiredReactJsxRuntime_production_min = 1;
|
|
21
|
+
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 };
|
|
22
|
+
function q(c, a, g) {
|
|
23
|
+
var b, d = {}, e = null, h = null;
|
|
24
|
+
void 0 !== g && (e = "" + g);
|
|
25
|
+
void 0 !== a.key && (e = "" + a.key);
|
|
26
|
+
void 0 !== a.ref && (h = a.ref);
|
|
27
|
+
for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
28
|
+
if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
|
|
29
|
+
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
|
30
|
+
}
|
|
31
|
+
reactJsxRuntime_production_min.Fragment = l;
|
|
32
|
+
reactJsxRuntime_production_min.jsx = q;
|
|
33
|
+
reactJsxRuntime_production_min.jsxs = q;
|
|
34
|
+
return reactJsxRuntime_production_min;
|
|
35
|
+
}
|
|
36
|
+
var reactJsxRuntime_development = {};
|
|
37
|
+
/**
|
|
38
|
+
* @license React
|
|
39
|
+
* react-jsx-runtime.development.js
|
|
40
|
+
*
|
|
41
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
42
|
+
*
|
|
43
|
+
* This source code is licensed under the MIT license found in the
|
|
44
|
+
* LICENSE file in the root directory of this source tree.
|
|
45
|
+
*/
|
|
46
|
+
var hasRequiredReactJsxRuntime_development;
|
|
47
|
+
function requireReactJsxRuntime_development() {
|
|
48
|
+
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
49
|
+
hasRequiredReactJsxRuntime_development = 1;
|
|
50
|
+
if (process.env.NODE_ENV !== "production") {
|
|
51
|
+
(function() {
|
|
52
|
+
var React = require$$0;
|
|
53
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
|
54
|
+
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
55
|
+
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
56
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
57
|
+
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
58
|
+
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
|
59
|
+
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
60
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
61
|
+
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
62
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
|
63
|
+
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
|
64
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
65
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
66
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
67
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
68
|
+
function getIteratorFn(maybeIterable) {
|
|
69
|
+
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
73
|
+
if (typeof maybeIterator === "function") {
|
|
74
|
+
return maybeIterator;
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
79
|
+
function error(format) {
|
|
80
|
+
{
|
|
81
|
+
{
|
|
82
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
83
|
+
args[_key2 - 1] = arguments[_key2];
|
|
84
|
+
}
|
|
85
|
+
printWarning("error", format, args);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function printWarning(level, format, args) {
|
|
90
|
+
{
|
|
91
|
+
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
92
|
+
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
|
93
|
+
if (stack !== "") {
|
|
94
|
+
format += "%s";
|
|
95
|
+
args = args.concat([stack]);
|
|
96
|
+
}
|
|
97
|
+
var argsWithFormat = args.map(function(item) {
|
|
98
|
+
return String(item);
|
|
99
|
+
});
|
|
100
|
+
argsWithFormat.unshift("Warning: " + format);
|
|
101
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
var enableScopeAPI = false;
|
|
105
|
+
var enableCacheElement = false;
|
|
106
|
+
var enableTransitionTracing = false;
|
|
107
|
+
var enableLegacyHidden = false;
|
|
108
|
+
var enableDebugTracing = false;
|
|
109
|
+
var REACT_MODULE_REFERENCE;
|
|
110
|
+
{
|
|
111
|
+
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
|
112
|
+
}
|
|
113
|
+
function isValidElementType(type) {
|
|
114
|
+
if (typeof type === "string" || typeof type === "function") {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
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) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
if (typeof type === "object" && type !== null) {
|
|
121
|
+
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
|
|
122
|
+
// types supported by any Flight configuration anywhere since
|
|
123
|
+
// we don't know which Flight build this will end up being used
|
|
124
|
+
// with.
|
|
125
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
132
|
+
var displayName = outerType.displayName;
|
|
133
|
+
if (displayName) {
|
|
134
|
+
return displayName;
|
|
135
|
+
}
|
|
136
|
+
var functionName = innerType.displayName || innerType.name || "";
|
|
137
|
+
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
138
|
+
}
|
|
139
|
+
function getContextName(type) {
|
|
140
|
+
return type.displayName || "Context";
|
|
141
|
+
}
|
|
142
|
+
function getComponentNameFromType(type) {
|
|
143
|
+
if (type == null) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
{
|
|
147
|
+
if (typeof type.tag === "number") {
|
|
148
|
+
error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (typeof type === "function") {
|
|
152
|
+
return type.displayName || type.name || null;
|
|
153
|
+
}
|
|
154
|
+
if (typeof type === "string") {
|
|
155
|
+
return type;
|
|
156
|
+
}
|
|
157
|
+
switch (type) {
|
|
158
|
+
case REACT_FRAGMENT_TYPE:
|
|
159
|
+
return "Fragment";
|
|
160
|
+
case REACT_PORTAL_TYPE:
|
|
161
|
+
return "Portal";
|
|
162
|
+
case REACT_PROFILER_TYPE:
|
|
163
|
+
return "Profiler";
|
|
164
|
+
case REACT_STRICT_MODE_TYPE:
|
|
165
|
+
return "StrictMode";
|
|
166
|
+
case REACT_SUSPENSE_TYPE:
|
|
167
|
+
return "Suspense";
|
|
168
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
169
|
+
return "SuspenseList";
|
|
170
|
+
}
|
|
171
|
+
if (typeof type === "object") {
|
|
172
|
+
switch (type.$$typeof) {
|
|
173
|
+
case REACT_CONTEXT_TYPE:
|
|
174
|
+
var context = type;
|
|
175
|
+
return getContextName(context) + ".Consumer";
|
|
176
|
+
case REACT_PROVIDER_TYPE:
|
|
177
|
+
var provider = type;
|
|
178
|
+
return getContextName(provider._context) + ".Provider";
|
|
179
|
+
case REACT_FORWARD_REF_TYPE:
|
|
180
|
+
return getWrappedName(type, type.render, "ForwardRef");
|
|
181
|
+
case REACT_MEMO_TYPE:
|
|
182
|
+
var outerName = type.displayName || null;
|
|
183
|
+
if (outerName !== null) {
|
|
184
|
+
return outerName;
|
|
185
|
+
}
|
|
186
|
+
return getComponentNameFromType(type.type) || "Memo";
|
|
187
|
+
case REACT_LAZY_TYPE: {
|
|
188
|
+
var lazyComponent = type;
|
|
189
|
+
var payload = lazyComponent._payload;
|
|
190
|
+
var init = lazyComponent._init;
|
|
191
|
+
try {
|
|
192
|
+
return getComponentNameFromType(init(payload));
|
|
193
|
+
} catch (x) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
var assign = Object.assign;
|
|
202
|
+
var disabledDepth = 0;
|
|
203
|
+
var prevLog;
|
|
204
|
+
var prevInfo;
|
|
205
|
+
var prevWarn;
|
|
206
|
+
var prevError;
|
|
207
|
+
var prevGroup;
|
|
208
|
+
var prevGroupCollapsed;
|
|
209
|
+
var prevGroupEnd;
|
|
210
|
+
function disabledLog() {
|
|
211
|
+
}
|
|
212
|
+
disabledLog.__reactDisabledLog = true;
|
|
213
|
+
function disableLogs() {
|
|
214
|
+
{
|
|
215
|
+
if (disabledDepth === 0) {
|
|
216
|
+
prevLog = console.log;
|
|
217
|
+
prevInfo = console.info;
|
|
218
|
+
prevWarn = console.warn;
|
|
219
|
+
prevError = console.error;
|
|
220
|
+
prevGroup = console.group;
|
|
221
|
+
prevGroupCollapsed = console.groupCollapsed;
|
|
222
|
+
prevGroupEnd = console.groupEnd;
|
|
223
|
+
var props = {
|
|
224
|
+
configurable: true,
|
|
225
|
+
enumerable: true,
|
|
226
|
+
value: disabledLog,
|
|
227
|
+
writable: true
|
|
228
|
+
};
|
|
229
|
+
Object.defineProperties(console, {
|
|
230
|
+
info: props,
|
|
231
|
+
log: props,
|
|
232
|
+
warn: props,
|
|
233
|
+
error: props,
|
|
234
|
+
group: props,
|
|
235
|
+
groupCollapsed: props,
|
|
236
|
+
groupEnd: props
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
disabledDepth++;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function reenableLogs() {
|
|
243
|
+
{
|
|
244
|
+
disabledDepth--;
|
|
245
|
+
if (disabledDepth === 0) {
|
|
246
|
+
var props = {
|
|
247
|
+
configurable: true,
|
|
248
|
+
enumerable: true,
|
|
249
|
+
writable: true
|
|
250
|
+
};
|
|
251
|
+
Object.defineProperties(console, {
|
|
252
|
+
log: assign({}, props, {
|
|
253
|
+
value: prevLog
|
|
254
|
+
}),
|
|
255
|
+
info: assign({}, props, {
|
|
256
|
+
value: prevInfo
|
|
257
|
+
}),
|
|
258
|
+
warn: assign({}, props, {
|
|
259
|
+
value: prevWarn
|
|
260
|
+
}),
|
|
261
|
+
error: assign({}, props, {
|
|
262
|
+
value: prevError
|
|
263
|
+
}),
|
|
264
|
+
group: assign({}, props, {
|
|
265
|
+
value: prevGroup
|
|
266
|
+
}),
|
|
267
|
+
groupCollapsed: assign({}, props, {
|
|
268
|
+
value: prevGroupCollapsed
|
|
269
|
+
}),
|
|
270
|
+
groupEnd: assign({}, props, {
|
|
271
|
+
value: prevGroupEnd
|
|
272
|
+
})
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
if (disabledDepth < 0) {
|
|
276
|
+
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
281
|
+
var prefix;
|
|
282
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
283
|
+
{
|
|
284
|
+
if (prefix === void 0) {
|
|
285
|
+
try {
|
|
286
|
+
throw Error();
|
|
287
|
+
} catch (x) {
|
|
288
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
289
|
+
prefix = match && match[1] || "";
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return "\n" + prefix + name;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
var reentry = false;
|
|
296
|
+
var componentFrameCache;
|
|
297
|
+
{
|
|
298
|
+
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
|
299
|
+
componentFrameCache = new PossiblyWeakMap();
|
|
300
|
+
}
|
|
301
|
+
function describeNativeComponentFrame(fn, construct) {
|
|
302
|
+
if (!fn || reentry) {
|
|
303
|
+
return "";
|
|
304
|
+
}
|
|
305
|
+
{
|
|
306
|
+
var frame = componentFrameCache.get(fn);
|
|
307
|
+
if (frame !== void 0) {
|
|
308
|
+
return frame;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
var control;
|
|
312
|
+
reentry = true;
|
|
313
|
+
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
314
|
+
Error.prepareStackTrace = void 0;
|
|
315
|
+
var previousDispatcher;
|
|
316
|
+
{
|
|
317
|
+
previousDispatcher = ReactCurrentDispatcher.current;
|
|
318
|
+
ReactCurrentDispatcher.current = null;
|
|
319
|
+
disableLogs();
|
|
320
|
+
}
|
|
321
|
+
try {
|
|
322
|
+
if (construct) {
|
|
323
|
+
var Fake = function() {
|
|
324
|
+
throw Error();
|
|
325
|
+
};
|
|
326
|
+
Object.defineProperty(Fake.prototype, "props", {
|
|
327
|
+
set: function() {
|
|
328
|
+
throw Error();
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
if (typeof Reflect === "object" && Reflect.construct) {
|
|
332
|
+
try {
|
|
333
|
+
Reflect.construct(Fake, []);
|
|
334
|
+
} catch (x) {
|
|
335
|
+
control = x;
|
|
336
|
+
}
|
|
337
|
+
Reflect.construct(fn, [], Fake);
|
|
338
|
+
} else {
|
|
339
|
+
try {
|
|
340
|
+
Fake.call();
|
|
341
|
+
} catch (x) {
|
|
342
|
+
control = x;
|
|
343
|
+
}
|
|
344
|
+
fn.call(Fake.prototype);
|
|
345
|
+
}
|
|
346
|
+
} else {
|
|
347
|
+
try {
|
|
348
|
+
throw Error();
|
|
349
|
+
} catch (x) {
|
|
350
|
+
control = x;
|
|
351
|
+
}
|
|
352
|
+
fn();
|
|
353
|
+
}
|
|
354
|
+
} catch (sample) {
|
|
355
|
+
if (sample && control && typeof sample.stack === "string") {
|
|
356
|
+
var sampleLines = sample.stack.split("\n");
|
|
357
|
+
var controlLines = control.stack.split("\n");
|
|
358
|
+
var s = sampleLines.length - 1;
|
|
359
|
+
var c = controlLines.length - 1;
|
|
360
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
361
|
+
c--;
|
|
362
|
+
}
|
|
363
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
|
364
|
+
if (sampleLines[s] !== controlLines[c]) {
|
|
365
|
+
if (s !== 1 || c !== 1) {
|
|
366
|
+
do {
|
|
367
|
+
s--;
|
|
368
|
+
c--;
|
|
369
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
370
|
+
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
|
371
|
+
if (fn.displayName && _frame.includes("<anonymous>")) {
|
|
372
|
+
_frame = _frame.replace("<anonymous>", fn.displayName);
|
|
373
|
+
}
|
|
374
|
+
{
|
|
375
|
+
if (typeof fn === "function") {
|
|
376
|
+
componentFrameCache.set(fn, _frame);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return _frame;
|
|
380
|
+
}
|
|
381
|
+
} while (s >= 1 && c >= 0);
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
} finally {
|
|
388
|
+
reentry = false;
|
|
389
|
+
{
|
|
390
|
+
ReactCurrentDispatcher.current = previousDispatcher;
|
|
391
|
+
reenableLogs();
|
|
392
|
+
}
|
|
393
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
394
|
+
}
|
|
395
|
+
var name = fn ? fn.displayName || fn.name : "";
|
|
396
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
397
|
+
{
|
|
398
|
+
if (typeof fn === "function") {
|
|
399
|
+
componentFrameCache.set(fn, syntheticFrame);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return syntheticFrame;
|
|
403
|
+
}
|
|
404
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
405
|
+
{
|
|
406
|
+
return describeNativeComponentFrame(fn, false);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function shouldConstruct(Component) {
|
|
410
|
+
var prototype = Component.prototype;
|
|
411
|
+
return !!(prototype && prototype.isReactComponent);
|
|
412
|
+
}
|
|
413
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
414
|
+
if (type == null) {
|
|
415
|
+
return "";
|
|
416
|
+
}
|
|
417
|
+
if (typeof type === "function") {
|
|
418
|
+
{
|
|
419
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
if (typeof type === "string") {
|
|
423
|
+
return describeBuiltInComponentFrame(type);
|
|
424
|
+
}
|
|
425
|
+
switch (type) {
|
|
426
|
+
case REACT_SUSPENSE_TYPE:
|
|
427
|
+
return describeBuiltInComponentFrame("Suspense");
|
|
428
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
429
|
+
return describeBuiltInComponentFrame("SuspenseList");
|
|
430
|
+
}
|
|
431
|
+
if (typeof type === "object") {
|
|
432
|
+
switch (type.$$typeof) {
|
|
433
|
+
case REACT_FORWARD_REF_TYPE:
|
|
434
|
+
return describeFunctionComponentFrame(type.render);
|
|
435
|
+
case REACT_MEMO_TYPE:
|
|
436
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
437
|
+
case REACT_LAZY_TYPE: {
|
|
438
|
+
var lazyComponent = type;
|
|
439
|
+
var payload = lazyComponent._payload;
|
|
440
|
+
var init = lazyComponent._init;
|
|
441
|
+
try {
|
|
442
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
443
|
+
} catch (x) {
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return "";
|
|
449
|
+
}
|
|
450
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
451
|
+
var loggedTypeFailures = {};
|
|
452
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
453
|
+
function setCurrentlyValidatingElement(element) {
|
|
454
|
+
{
|
|
455
|
+
if (element) {
|
|
456
|
+
var owner = element._owner;
|
|
457
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
458
|
+
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
459
|
+
} else {
|
|
460
|
+
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
465
|
+
{
|
|
466
|
+
var has = Function.call.bind(hasOwnProperty);
|
|
467
|
+
for (var typeSpecName in typeSpecs) {
|
|
468
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
469
|
+
var error$1 = void 0;
|
|
470
|
+
try {
|
|
471
|
+
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
472
|
+
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`.");
|
|
473
|
+
err.name = "Invariant Violation";
|
|
474
|
+
throw err;
|
|
475
|
+
}
|
|
476
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
477
|
+
} catch (ex) {
|
|
478
|
+
error$1 = ex;
|
|
479
|
+
}
|
|
480
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
481
|
+
setCurrentlyValidatingElement(element);
|
|
482
|
+
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);
|
|
483
|
+
setCurrentlyValidatingElement(null);
|
|
484
|
+
}
|
|
485
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
486
|
+
loggedTypeFailures[error$1.message] = true;
|
|
487
|
+
setCurrentlyValidatingElement(element);
|
|
488
|
+
error("Failed %s type: %s", location, error$1.message);
|
|
489
|
+
setCurrentlyValidatingElement(null);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
var isArrayImpl = Array.isArray;
|
|
496
|
+
function isArray(a) {
|
|
497
|
+
return isArrayImpl(a);
|
|
498
|
+
}
|
|
499
|
+
function typeName(value) {
|
|
500
|
+
{
|
|
501
|
+
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
|
502
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
503
|
+
return type;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
function willCoercionThrow(value) {
|
|
507
|
+
{
|
|
508
|
+
try {
|
|
509
|
+
testStringCoercion(value);
|
|
510
|
+
return false;
|
|
511
|
+
} catch (e) {
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
function testStringCoercion(value) {
|
|
517
|
+
return "" + value;
|
|
518
|
+
}
|
|
519
|
+
function checkKeyStringCoercion(value) {
|
|
520
|
+
{
|
|
521
|
+
if (willCoercionThrow(value)) {
|
|
522
|
+
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
523
|
+
return testStringCoercion(value);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
528
|
+
var RESERVED_PROPS = {
|
|
529
|
+
key: true,
|
|
530
|
+
ref: true,
|
|
531
|
+
__self: true,
|
|
532
|
+
__source: true
|
|
533
|
+
};
|
|
534
|
+
var specialPropKeyWarningShown;
|
|
535
|
+
var specialPropRefWarningShown;
|
|
536
|
+
function hasValidRef(config) {
|
|
537
|
+
{
|
|
538
|
+
if (hasOwnProperty.call(config, "ref")) {
|
|
539
|
+
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
|
540
|
+
if (getter && getter.isReactWarning) {
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
return config.ref !== void 0;
|
|
546
|
+
}
|
|
547
|
+
function hasValidKey(config) {
|
|
548
|
+
{
|
|
549
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
550
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
551
|
+
if (getter && getter.isReactWarning) {
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return config.key !== void 0;
|
|
557
|
+
}
|
|
558
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
559
|
+
{
|
|
560
|
+
if (typeof config.ref === "string" && ReactCurrentOwner.current && self) ;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
564
|
+
{
|
|
565
|
+
var warnAboutAccessingKey = function() {
|
|
566
|
+
if (!specialPropKeyWarningShown) {
|
|
567
|
+
specialPropKeyWarningShown = true;
|
|
568
|
+
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);
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
572
|
+
Object.defineProperty(props, "key", {
|
|
573
|
+
get: warnAboutAccessingKey,
|
|
574
|
+
configurable: true
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
579
|
+
{
|
|
580
|
+
var warnAboutAccessingRef = function() {
|
|
581
|
+
if (!specialPropRefWarningShown) {
|
|
582
|
+
specialPropRefWarningShown = true;
|
|
583
|
+
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);
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
587
|
+
Object.defineProperty(props, "ref", {
|
|
588
|
+
get: warnAboutAccessingRef,
|
|
589
|
+
configurable: true
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
|
594
|
+
var element = {
|
|
595
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
596
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
597
|
+
// Built-in properties that belong on the element
|
|
598
|
+
type,
|
|
599
|
+
key,
|
|
600
|
+
ref,
|
|
601
|
+
props,
|
|
602
|
+
// Record the component responsible for creating this element.
|
|
603
|
+
_owner: owner
|
|
604
|
+
};
|
|
605
|
+
{
|
|
606
|
+
element._store = {};
|
|
607
|
+
Object.defineProperty(element._store, "validated", {
|
|
608
|
+
configurable: false,
|
|
609
|
+
enumerable: false,
|
|
610
|
+
writable: true,
|
|
611
|
+
value: false
|
|
612
|
+
});
|
|
613
|
+
Object.defineProperty(element, "_self", {
|
|
614
|
+
configurable: false,
|
|
615
|
+
enumerable: false,
|
|
616
|
+
writable: false,
|
|
617
|
+
value: self
|
|
618
|
+
});
|
|
619
|
+
Object.defineProperty(element, "_source", {
|
|
620
|
+
configurable: false,
|
|
621
|
+
enumerable: false,
|
|
622
|
+
writable: false,
|
|
623
|
+
value: source
|
|
624
|
+
});
|
|
625
|
+
if (Object.freeze) {
|
|
626
|
+
Object.freeze(element.props);
|
|
627
|
+
Object.freeze(element);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return element;
|
|
631
|
+
};
|
|
632
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
|
633
|
+
{
|
|
634
|
+
var propName;
|
|
635
|
+
var props = {};
|
|
636
|
+
var key = null;
|
|
637
|
+
var ref = null;
|
|
638
|
+
if (maybeKey !== void 0) {
|
|
639
|
+
{
|
|
640
|
+
checkKeyStringCoercion(maybeKey);
|
|
641
|
+
}
|
|
642
|
+
key = "" + maybeKey;
|
|
643
|
+
}
|
|
644
|
+
if (hasValidKey(config)) {
|
|
645
|
+
{
|
|
646
|
+
checkKeyStringCoercion(config.key);
|
|
647
|
+
}
|
|
648
|
+
key = "" + config.key;
|
|
649
|
+
}
|
|
650
|
+
if (hasValidRef(config)) {
|
|
651
|
+
ref = config.ref;
|
|
652
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
653
|
+
}
|
|
654
|
+
for (propName in config) {
|
|
655
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
656
|
+
props[propName] = config[propName];
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
if (type && type.defaultProps) {
|
|
660
|
+
var defaultProps = type.defaultProps;
|
|
661
|
+
for (propName in defaultProps) {
|
|
662
|
+
if (props[propName] === void 0) {
|
|
663
|
+
props[propName] = defaultProps[propName];
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (key || ref) {
|
|
668
|
+
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
|
669
|
+
if (key) {
|
|
670
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
671
|
+
}
|
|
672
|
+
if (ref) {
|
|
673
|
+
defineRefPropWarningGetter(props, displayName);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
680
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
681
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
682
|
+
{
|
|
683
|
+
if (element) {
|
|
684
|
+
var owner = element._owner;
|
|
685
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
686
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
687
|
+
} else {
|
|
688
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
var propTypesMisspellWarningShown;
|
|
693
|
+
{
|
|
694
|
+
propTypesMisspellWarningShown = false;
|
|
695
|
+
}
|
|
696
|
+
function isValidElement(object) {
|
|
697
|
+
{
|
|
698
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
function getDeclarationErrorAddendum() {
|
|
702
|
+
{
|
|
703
|
+
if (ReactCurrentOwner$1.current) {
|
|
704
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
705
|
+
if (name) {
|
|
706
|
+
return "\n\nCheck the render method of `" + name + "`.";
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
return "";
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
function getSourceInfoErrorAddendum(source) {
|
|
713
|
+
{
|
|
714
|
+
return "";
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
var ownerHasKeyUseWarning = {};
|
|
718
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
719
|
+
{
|
|
720
|
+
var info = getDeclarationErrorAddendum();
|
|
721
|
+
if (!info) {
|
|
722
|
+
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
|
723
|
+
if (parentName) {
|
|
724
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return info;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
function validateExplicitKey(element, parentType) {
|
|
731
|
+
{
|
|
732
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
element._store.validated = true;
|
|
736
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
737
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
741
|
+
var childOwner = "";
|
|
742
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
743
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
744
|
+
}
|
|
745
|
+
setCurrentlyValidatingElement$1(element);
|
|
746
|
+
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);
|
|
747
|
+
setCurrentlyValidatingElement$1(null);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
function validateChildKeys(node, parentType) {
|
|
751
|
+
{
|
|
752
|
+
if (typeof node !== "object") {
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
if (isArray(node)) {
|
|
756
|
+
for (var i = 0; i < node.length; i++) {
|
|
757
|
+
var child = node[i];
|
|
758
|
+
if (isValidElement(child)) {
|
|
759
|
+
validateExplicitKey(child, parentType);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
} else if (isValidElement(node)) {
|
|
763
|
+
if (node._store) {
|
|
764
|
+
node._store.validated = true;
|
|
765
|
+
}
|
|
766
|
+
} else if (node) {
|
|
767
|
+
var iteratorFn = getIteratorFn(node);
|
|
768
|
+
if (typeof iteratorFn === "function") {
|
|
769
|
+
if (iteratorFn !== node.entries) {
|
|
770
|
+
var iterator = iteratorFn.call(node);
|
|
771
|
+
var step;
|
|
772
|
+
while (!(step = iterator.next()).done) {
|
|
773
|
+
if (isValidElement(step.value)) {
|
|
774
|
+
validateExplicitKey(step.value, parentType);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
function validatePropTypes(element) {
|
|
783
|
+
{
|
|
784
|
+
var type = element.type;
|
|
785
|
+
if (type === null || type === void 0 || typeof type === "string") {
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
var propTypes;
|
|
789
|
+
if (typeof type === "function") {
|
|
790
|
+
propTypes = type.propTypes;
|
|
791
|
+
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
792
|
+
// Inner props are checked in the reconciler.
|
|
793
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
794
|
+
propTypes = type.propTypes;
|
|
795
|
+
} else {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
if (propTypes) {
|
|
799
|
+
var name = getComponentNameFromType(type);
|
|
800
|
+
checkPropTypes(propTypes, element.props, "prop", name, element);
|
|
801
|
+
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
|
802
|
+
propTypesMisspellWarningShown = true;
|
|
803
|
+
var _name = getComponentNameFromType(type);
|
|
804
|
+
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
|
805
|
+
}
|
|
806
|
+
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
|
807
|
+
error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
function validateFragmentProps(fragment) {
|
|
812
|
+
{
|
|
813
|
+
var keys = Object.keys(fragment.props);
|
|
814
|
+
for (var i = 0; i < keys.length; i++) {
|
|
815
|
+
var key = keys[i];
|
|
816
|
+
if (key !== "children" && key !== "key") {
|
|
817
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
818
|
+
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
|
819
|
+
setCurrentlyValidatingElement$1(null);
|
|
820
|
+
break;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
if (fragment.ref !== null) {
|
|
824
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
825
|
+
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
|
826
|
+
setCurrentlyValidatingElement$1(null);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
var didWarnAboutKeySpread = {};
|
|
831
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
832
|
+
{
|
|
833
|
+
var validType = isValidElementType(type);
|
|
834
|
+
if (!validType) {
|
|
835
|
+
var info = "";
|
|
836
|
+
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
|
837
|
+
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.";
|
|
838
|
+
}
|
|
839
|
+
var sourceInfo = getSourceInfoErrorAddendum();
|
|
840
|
+
if (sourceInfo) {
|
|
841
|
+
info += sourceInfo;
|
|
842
|
+
} else {
|
|
843
|
+
info += getDeclarationErrorAddendum();
|
|
844
|
+
}
|
|
845
|
+
var typeString;
|
|
846
|
+
if (type === null) {
|
|
847
|
+
typeString = "null";
|
|
848
|
+
} else if (isArray(type)) {
|
|
849
|
+
typeString = "array";
|
|
850
|
+
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
851
|
+
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
|
852
|
+
info = " Did you accidentally export a JSX literal instead of a component?";
|
|
853
|
+
} else {
|
|
854
|
+
typeString = typeof type;
|
|
855
|
+
}
|
|
856
|
+
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);
|
|
857
|
+
}
|
|
858
|
+
var element = jsxDEV(type, props, key, source, self);
|
|
859
|
+
if (element == null) {
|
|
860
|
+
return element;
|
|
861
|
+
}
|
|
862
|
+
if (validType) {
|
|
863
|
+
var children = props.children;
|
|
864
|
+
if (children !== void 0) {
|
|
865
|
+
if (isStaticChildren) {
|
|
866
|
+
if (isArray(children)) {
|
|
867
|
+
for (var i = 0; i < children.length; i++) {
|
|
868
|
+
validateChildKeys(children[i], type);
|
|
869
|
+
}
|
|
870
|
+
if (Object.freeze) {
|
|
871
|
+
Object.freeze(children);
|
|
872
|
+
}
|
|
873
|
+
} else {
|
|
874
|
+
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.");
|
|
875
|
+
}
|
|
876
|
+
} else {
|
|
877
|
+
validateChildKeys(children, type);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
{
|
|
882
|
+
if (hasOwnProperty.call(props, "key")) {
|
|
883
|
+
var componentName = getComponentNameFromType(type);
|
|
884
|
+
var keys = Object.keys(props).filter(function(k) {
|
|
885
|
+
return k !== "key";
|
|
886
|
+
});
|
|
887
|
+
var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
888
|
+
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
889
|
+
var afterExample = keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}";
|
|
890
|
+
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);
|
|
891
|
+
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
896
|
+
validateFragmentProps(element);
|
|
897
|
+
} else {
|
|
898
|
+
validatePropTypes(element);
|
|
899
|
+
}
|
|
900
|
+
return element;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
904
|
+
{
|
|
905
|
+
return jsxWithValidation(type, props, key, true);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
909
|
+
{
|
|
910
|
+
return jsxWithValidation(type, props, key, false);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
var jsx = jsxWithValidationDynamic;
|
|
914
|
+
var jsxs = jsxWithValidationStatic;
|
|
915
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
916
|
+
reactJsxRuntime_development.jsx = jsx;
|
|
917
|
+
reactJsxRuntime_development.jsxs = jsxs;
|
|
918
|
+
})();
|
|
919
|
+
}
|
|
920
|
+
return reactJsxRuntime_development;
|
|
921
|
+
}
|
|
922
|
+
var hasRequiredJsxRuntime;
|
|
923
|
+
function requireJsxRuntime() {
|
|
924
|
+
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
925
|
+
hasRequiredJsxRuntime = 1;
|
|
926
|
+
if (process.env.NODE_ENV === "production") {
|
|
927
|
+
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
928
|
+
} else {
|
|
929
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
930
|
+
}
|
|
931
|
+
return jsxRuntime.exports;
|
|
932
|
+
}
|
|
933
|
+
var jsxRuntimeExports = requireJsxRuntime();
|
|
934
|
+
const AuthContext = require$$0.createContext(null);
|
|
935
|
+
function createDefaultErrorTexts() {
|
|
936
|
+
return {
|
|
937
|
+
"auth/user-not-found": "No account found with this email.",
|
|
938
|
+
"auth/wrong-password": "Incorrect password.",
|
|
939
|
+
"auth/invalid-email": "Please enter a valid email address.",
|
|
940
|
+
"auth/invalid-credential": "Invalid email or password.",
|
|
941
|
+
"auth/email-already-in-use": "An account already exists with this email.",
|
|
942
|
+
"auth/weak-password": "Password should be at least 6 characters.",
|
|
943
|
+
"auth/too-many-requests": "Too many attempts. Please try again later.",
|
|
944
|
+
"auth/network-request-failed": "Network error. Please check your connection.",
|
|
945
|
+
"auth/popup-closed-by-user": "Sign-in was cancelled.",
|
|
946
|
+
"auth/popup-blocked": "Sign-in popup was blocked.",
|
|
947
|
+
"auth/account-exists-with-different-credential": "An account already exists with a different sign-in method.",
|
|
948
|
+
"auth/operation-not-allowed": "This sign-in method is not enabled.",
|
|
949
|
+
default: "An error occurred. Please try again."
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
function useAuthStatus() {
|
|
953
|
+
const context = require$$0.useContext(AuthContext);
|
|
954
|
+
if (!context) {
|
|
955
|
+
throw new Error("useAuthStatus must be used within an AuthProvider");
|
|
956
|
+
}
|
|
957
|
+
return context;
|
|
958
|
+
}
|
|
959
|
+
function AuthProvider({
|
|
960
|
+
children,
|
|
961
|
+
providerConfig,
|
|
962
|
+
texts,
|
|
963
|
+
errorTexts,
|
|
964
|
+
callbacks,
|
|
965
|
+
resolveErrorMessage
|
|
966
|
+
}) {
|
|
967
|
+
const [user, setUser] = require$$0.useState(null);
|
|
968
|
+
const [loading, setLoading] = require$$0.useState(true);
|
|
969
|
+
const [error, setError] = require$$0.useState(null);
|
|
970
|
+
const getErrorMessage = require$$0.useCallback(
|
|
971
|
+
(code) => {
|
|
972
|
+
if (resolveErrorMessage) {
|
|
973
|
+
return resolveErrorMessage(code);
|
|
974
|
+
}
|
|
975
|
+
const key = code;
|
|
976
|
+
return errorTexts[key] || errorTexts.default;
|
|
977
|
+
},
|
|
978
|
+
[errorTexts, resolveErrorMessage]
|
|
979
|
+
);
|
|
980
|
+
const handleError = require$$0.useCallback(
|
|
981
|
+
(err) => {
|
|
982
|
+
var _a;
|
|
983
|
+
const code = err.code || "default";
|
|
984
|
+
const message = getErrorMessage(code);
|
|
985
|
+
setError(message);
|
|
986
|
+
(_a = callbacks == null ? void 0 : callbacks.onError) == null ? void 0 : _a.call(callbacks, err, code);
|
|
987
|
+
},
|
|
988
|
+
[getErrorMessage, callbacks]
|
|
989
|
+
);
|
|
990
|
+
require$$0.useEffect(() => {
|
|
991
|
+
setLoading(false);
|
|
992
|
+
}, []);
|
|
993
|
+
const signInWithGoogle = require$$0.useCallback(async () => {
|
|
994
|
+
setLoading(true);
|
|
995
|
+
setError(null);
|
|
996
|
+
try {
|
|
997
|
+
throw new Error("Google sign-in not implemented");
|
|
998
|
+
} catch (err) {
|
|
999
|
+
handleError(err);
|
|
1000
|
+
} finally {
|
|
1001
|
+
setLoading(false);
|
|
1002
|
+
}
|
|
1003
|
+
}, [handleError]);
|
|
1004
|
+
const signInWithApple = require$$0.useCallback(async () => {
|
|
1005
|
+
setLoading(true);
|
|
1006
|
+
setError(null);
|
|
1007
|
+
try {
|
|
1008
|
+
throw new Error("Apple sign-in not implemented");
|
|
1009
|
+
} catch (err) {
|
|
1010
|
+
handleError(err);
|
|
1011
|
+
} finally {
|
|
1012
|
+
setLoading(false);
|
|
1013
|
+
}
|
|
1014
|
+
}, [handleError]);
|
|
1015
|
+
const signInWithEmail = require$$0.useCallback(
|
|
1016
|
+
async (_email, _password) => {
|
|
1017
|
+
setLoading(true);
|
|
1018
|
+
setError(null);
|
|
1019
|
+
try {
|
|
1020
|
+
throw new Error("Email sign-in not implemented");
|
|
1021
|
+
} catch (err) {
|
|
1022
|
+
handleError(err);
|
|
1023
|
+
} finally {
|
|
1024
|
+
setLoading(false);
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
[handleError]
|
|
1028
|
+
);
|
|
1029
|
+
const signUpWithEmail = require$$0.useCallback(
|
|
1030
|
+
async (_email, _password, _displayName) => {
|
|
1031
|
+
setLoading(true);
|
|
1032
|
+
setError(null);
|
|
1033
|
+
try {
|
|
1034
|
+
throw new Error("Email sign-up not implemented");
|
|
1035
|
+
} catch (err) {
|
|
1036
|
+
handleError(err);
|
|
1037
|
+
} finally {
|
|
1038
|
+
setLoading(false);
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
[handleError]
|
|
1042
|
+
);
|
|
1043
|
+
const resetPassword = require$$0.useCallback(
|
|
1044
|
+
async (_email) => {
|
|
1045
|
+
setLoading(true);
|
|
1046
|
+
setError(null);
|
|
1047
|
+
try {
|
|
1048
|
+
throw new Error("Password reset not implemented");
|
|
1049
|
+
} catch (err) {
|
|
1050
|
+
handleError(err);
|
|
1051
|
+
} finally {
|
|
1052
|
+
setLoading(false);
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
[handleError]
|
|
1056
|
+
);
|
|
1057
|
+
const signOut = require$$0.useCallback(async () => {
|
|
1058
|
+
var _a;
|
|
1059
|
+
setLoading(true);
|
|
1060
|
+
setError(null);
|
|
1061
|
+
try {
|
|
1062
|
+
setUser(null);
|
|
1063
|
+
(_a = callbacks == null ? void 0 : callbacks.onSignOut) == null ? void 0 : _a.call(callbacks);
|
|
1064
|
+
} catch (err) {
|
|
1065
|
+
handleError(err);
|
|
1066
|
+
} finally {
|
|
1067
|
+
setLoading(false);
|
|
1068
|
+
}
|
|
1069
|
+
}, [handleError, callbacks]);
|
|
1070
|
+
const signInAnonymously = require$$0.useCallback(async () => {
|
|
1071
|
+
setLoading(true);
|
|
1072
|
+
setError(null);
|
|
1073
|
+
try {
|
|
1074
|
+
throw new Error("Anonymous sign-in not implemented");
|
|
1075
|
+
} catch (err) {
|
|
1076
|
+
handleError(err);
|
|
1077
|
+
} finally {
|
|
1078
|
+
setLoading(false);
|
|
1079
|
+
}
|
|
1080
|
+
}, [handleError]);
|
|
1081
|
+
const clearError = require$$0.useCallback(() => {
|
|
1082
|
+
setError(null);
|
|
1083
|
+
}, []);
|
|
1084
|
+
const value = require$$0.useMemo(
|
|
1085
|
+
() => ({
|
|
1086
|
+
user,
|
|
1087
|
+
loading,
|
|
1088
|
+
error,
|
|
1089
|
+
isAuthenticated: !!user && !user.isAnonymous,
|
|
1090
|
+
isAnonymous: (user == null ? void 0 : user.isAnonymous) ?? false,
|
|
1091
|
+
signInWithGoogle,
|
|
1092
|
+
signInWithApple,
|
|
1093
|
+
signInWithEmail,
|
|
1094
|
+
signUpWithEmail,
|
|
1095
|
+
resetPassword,
|
|
1096
|
+
signOut,
|
|
1097
|
+
signInAnonymously,
|
|
1098
|
+
clearError,
|
|
1099
|
+
texts,
|
|
1100
|
+
providerConfig
|
|
1101
|
+
}),
|
|
1102
|
+
[
|
|
1103
|
+
user,
|
|
1104
|
+
loading,
|
|
1105
|
+
error,
|
|
1106
|
+
signInWithGoogle,
|
|
1107
|
+
signInWithApple,
|
|
1108
|
+
signInWithEmail,
|
|
1109
|
+
signUpWithEmail,
|
|
1110
|
+
resetPassword,
|
|
1111
|
+
signOut,
|
|
1112
|
+
signInAnonymously,
|
|
1113
|
+
clearError,
|
|
1114
|
+
texts,
|
|
1115
|
+
providerConfig
|
|
1116
|
+
]
|
|
1117
|
+
);
|
|
1118
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(AuthContext.Provider, { value, children });
|
|
1119
|
+
}
|
|
1120
|
+
const ProviderButton = ({
|
|
1121
|
+
provider,
|
|
1122
|
+
label,
|
|
1123
|
+
onPress,
|
|
1124
|
+
className
|
|
1125
|
+
}) => {
|
|
1126
|
+
const bgColors = {
|
|
1127
|
+
google: "bg-white border border-gray-300",
|
|
1128
|
+
apple: "bg-black",
|
|
1129
|
+
email: "bg-blue-600"
|
|
1130
|
+
};
|
|
1131
|
+
const textColors = {
|
|
1132
|
+
google: "text-gray-900",
|
|
1133
|
+
apple: "text-white",
|
|
1134
|
+
email: "text-white"
|
|
1135
|
+
};
|
|
1136
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1137
|
+
reactNative.Pressable,
|
|
1138
|
+
{
|
|
1139
|
+
onPress,
|
|
1140
|
+
className: componentsRn.cn(
|
|
1141
|
+
"flex-row items-center justify-center py-3 px-4 rounded-lg",
|
|
1142
|
+
"active:opacity-80",
|
|
1143
|
+
bgColors[provider],
|
|
1144
|
+
className
|
|
1145
|
+
),
|
|
1146
|
+
accessibilityRole: "button",
|
|
1147
|
+
accessibilityLabel: label,
|
|
1148
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: componentsRn.cn("font-medium text-base", textColors[provider]), children: label })
|
|
1149
|
+
}
|
|
1150
|
+
);
|
|
1151
|
+
};
|
|
1152
|
+
const ProviderButtons = ({
|
|
1153
|
+
providers,
|
|
1154
|
+
onEmailPress,
|
|
1155
|
+
onTrack,
|
|
1156
|
+
trackingLabel,
|
|
1157
|
+
componentName = "ProviderButtons"
|
|
1158
|
+
}) => {
|
|
1159
|
+
const { texts, signInWithGoogle, signInWithApple } = useAuthStatus();
|
|
1160
|
+
const handleProviderPress = async (provider) => {
|
|
1161
|
+
onTrack == null ? void 0 : onTrack({
|
|
1162
|
+
action: "provider_press",
|
|
1163
|
+
trackingLabel,
|
|
1164
|
+
componentName
|
|
1165
|
+
});
|
|
1166
|
+
if (provider === "google") {
|
|
1167
|
+
await signInWithGoogle();
|
|
1168
|
+
} else if (provider === "apple") {
|
|
1169
|
+
await signInWithApple();
|
|
1170
|
+
} else if (provider === "email") {
|
|
1171
|
+
onEmailPress();
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
const getLabel = (provider) => {
|
|
1175
|
+
switch (provider) {
|
|
1176
|
+
case "google":
|
|
1177
|
+
return texts.continueWithGoogle;
|
|
1178
|
+
case "apple":
|
|
1179
|
+
return texts.continueWithApple;
|
|
1180
|
+
case "email":
|
|
1181
|
+
return texts.continueWithEmail;
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1184
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.View, { className: "gap-3", children: providers.map((provider) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1185
|
+
ProviderButton,
|
|
1186
|
+
{
|
|
1187
|
+
provider,
|
|
1188
|
+
label: getLabel(provider),
|
|
1189
|
+
onPress: () => handleProviderPress(provider)
|
|
1190
|
+
},
|
|
1191
|
+
provider
|
|
1192
|
+
)) });
|
|
1193
|
+
};
|
|
1194
|
+
const EmailSignInForm = ({
|
|
1195
|
+
onSwitchToSignUp,
|
|
1196
|
+
onSwitchToForgotPassword,
|
|
1197
|
+
onSuccess,
|
|
1198
|
+
onTrack,
|
|
1199
|
+
trackingLabel,
|
|
1200
|
+
componentName = "EmailSignInForm"
|
|
1201
|
+
}) => {
|
|
1202
|
+
const { texts, signInWithEmail, loading, error, clearError } = useAuthStatus();
|
|
1203
|
+
const [email, setEmail] = require$$0.useState("");
|
|
1204
|
+
const [password, setPassword] = require$$0.useState("");
|
|
1205
|
+
const handleSubmit = async () => {
|
|
1206
|
+
onTrack == null ? void 0 : onTrack({
|
|
1207
|
+
action: "form_submit",
|
|
1208
|
+
trackingLabel,
|
|
1209
|
+
componentName
|
|
1210
|
+
});
|
|
1211
|
+
clearError();
|
|
1212
|
+
await signInWithEmail(email, password);
|
|
1213
|
+
onSuccess == null ? void 0 : onSuccess();
|
|
1214
|
+
};
|
|
1215
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-4", children: [
|
|
1216
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-2", children: [
|
|
1217
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm font-medium text-gray-900 dark:text-white", children: texts.email }),
|
|
1218
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1219
|
+
reactNative.TextInput,
|
|
1220
|
+
{
|
|
1221
|
+
value: email,
|
|
1222
|
+
onChangeText: setEmail,
|
|
1223
|
+
placeholder: texts.emailPlaceholder,
|
|
1224
|
+
keyboardType: "email-address",
|
|
1225
|
+
autoCapitalize: "none",
|
|
1226
|
+
autoCorrect: false,
|
|
1227
|
+
className: "px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",
|
|
1228
|
+
placeholderTextColor: "#9CA3AF"
|
|
1229
|
+
}
|
|
1230
|
+
)
|
|
1231
|
+
] }),
|
|
1232
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-2", children: [
|
|
1233
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm font-medium text-gray-900 dark:text-white", children: texts.password }),
|
|
1234
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1235
|
+
reactNative.TextInput,
|
|
1236
|
+
{
|
|
1237
|
+
value: password,
|
|
1238
|
+
onChangeText: setPassword,
|
|
1239
|
+
placeholder: texts.passwordPlaceholder,
|
|
1240
|
+
secureTextEntry: true,
|
|
1241
|
+
className: "px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",
|
|
1242
|
+
placeholderTextColor: "#9CA3AF"
|
|
1243
|
+
}
|
|
1244
|
+
)
|
|
1245
|
+
] }),
|
|
1246
|
+
error && /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm text-red-600 dark:text-red-400", children: error }),
|
|
1247
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1248
|
+
reactNative.Pressable,
|
|
1249
|
+
{
|
|
1250
|
+
onPress: handleSubmit,
|
|
1251
|
+
disabled: loading || !email || !password,
|
|
1252
|
+
className: componentsRn.cn(
|
|
1253
|
+
"py-3 px-4 rounded-lg items-center justify-center",
|
|
1254
|
+
"bg-blue-600 active:bg-blue-700",
|
|
1255
|
+
(loading || !email || !password) && "opacity-50"
|
|
1256
|
+
),
|
|
1257
|
+
accessibilityRole: "button",
|
|
1258
|
+
accessibilityLabel: texts.signIn,
|
|
1259
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "font-medium text-white", children: loading ? texts.loading : texts.signIn })
|
|
1260
|
+
}
|
|
1261
|
+
),
|
|
1262
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1263
|
+
reactNative.Pressable,
|
|
1264
|
+
{
|
|
1265
|
+
onPress: () => {
|
|
1266
|
+
onTrack == null ? void 0 : onTrack({
|
|
1267
|
+
action: "switch_mode",
|
|
1268
|
+
trackingLabel,
|
|
1269
|
+
componentName
|
|
1270
|
+
});
|
|
1271
|
+
onSwitchToForgotPassword();
|
|
1272
|
+
},
|
|
1273
|
+
className: "items-center py-2",
|
|
1274
|
+
accessibilityRole: "button",
|
|
1275
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm text-blue-600 dark:text-blue-400", children: texts.forgotPassword })
|
|
1276
|
+
}
|
|
1277
|
+
),
|
|
1278
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "flex-row items-center justify-center gap-1", children: [
|
|
1279
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm text-gray-500 dark:text-gray-400", children: texts.noAccount }),
|
|
1280
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1281
|
+
reactNative.Pressable,
|
|
1282
|
+
{
|
|
1283
|
+
onPress: () => {
|
|
1284
|
+
onTrack == null ? void 0 : onTrack({
|
|
1285
|
+
action: "switch_mode",
|
|
1286
|
+
trackingLabel,
|
|
1287
|
+
componentName
|
|
1288
|
+
});
|
|
1289
|
+
onSwitchToSignUp();
|
|
1290
|
+
},
|
|
1291
|
+
accessibilityRole: "button",
|
|
1292
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm font-medium text-blue-600 dark:text-blue-400", children: texts.signUp })
|
|
1293
|
+
}
|
|
1294
|
+
)
|
|
1295
|
+
] })
|
|
1296
|
+
] });
|
|
1297
|
+
};
|
|
1298
|
+
const EmailSignUpForm = ({
|
|
1299
|
+
onSwitchToSignIn,
|
|
1300
|
+
onSuccess,
|
|
1301
|
+
onTrack,
|
|
1302
|
+
trackingLabel,
|
|
1303
|
+
componentName = "EmailSignUpForm"
|
|
1304
|
+
}) => {
|
|
1305
|
+
const { texts, signUpWithEmail, loading, error, clearError } = useAuthStatus();
|
|
1306
|
+
const [email, setEmail] = require$$0.useState("");
|
|
1307
|
+
const [password, setPassword] = require$$0.useState("");
|
|
1308
|
+
const [confirmPassword, setConfirmPassword] = require$$0.useState("");
|
|
1309
|
+
const [displayName, setDisplayName] = require$$0.useState("");
|
|
1310
|
+
const [localError, setLocalError] = require$$0.useState(null);
|
|
1311
|
+
const handleSubmit = async () => {
|
|
1312
|
+
setLocalError(null);
|
|
1313
|
+
clearError();
|
|
1314
|
+
if (password !== confirmPassword) {
|
|
1315
|
+
setLocalError(texts.passwordMismatch);
|
|
1316
|
+
return;
|
|
1317
|
+
}
|
|
1318
|
+
if (password.length < 6) {
|
|
1319
|
+
setLocalError(texts.passwordTooShort);
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
onTrack == null ? void 0 : onTrack({
|
|
1323
|
+
action: "form_submit",
|
|
1324
|
+
trackingLabel,
|
|
1325
|
+
componentName
|
|
1326
|
+
});
|
|
1327
|
+
await signUpWithEmail(email, password, displayName || void 0);
|
|
1328
|
+
onSuccess == null ? void 0 : onSuccess();
|
|
1329
|
+
};
|
|
1330
|
+
const displayError = localError || error;
|
|
1331
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-4", children: [
|
|
1332
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-2", children: [
|
|
1333
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm font-medium text-gray-900 dark:text-white", children: texts.displayName }),
|
|
1334
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1335
|
+
reactNative.TextInput,
|
|
1336
|
+
{
|
|
1337
|
+
value: displayName,
|
|
1338
|
+
onChangeText: setDisplayName,
|
|
1339
|
+
placeholder: texts.displayNamePlaceholder,
|
|
1340
|
+
autoCapitalize: "words",
|
|
1341
|
+
className: "px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",
|
|
1342
|
+
placeholderTextColor: "#9CA3AF"
|
|
1343
|
+
}
|
|
1344
|
+
)
|
|
1345
|
+
] }),
|
|
1346
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-2", children: [
|
|
1347
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm font-medium text-gray-900 dark:text-white", children: texts.email }),
|
|
1348
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1349
|
+
reactNative.TextInput,
|
|
1350
|
+
{
|
|
1351
|
+
value: email,
|
|
1352
|
+
onChangeText: setEmail,
|
|
1353
|
+
placeholder: texts.emailPlaceholder,
|
|
1354
|
+
keyboardType: "email-address",
|
|
1355
|
+
autoCapitalize: "none",
|
|
1356
|
+
autoCorrect: false,
|
|
1357
|
+
className: "px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",
|
|
1358
|
+
placeholderTextColor: "#9CA3AF"
|
|
1359
|
+
}
|
|
1360
|
+
)
|
|
1361
|
+
] }),
|
|
1362
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-2", children: [
|
|
1363
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm font-medium text-gray-900 dark:text-white", children: texts.password }),
|
|
1364
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1365
|
+
reactNative.TextInput,
|
|
1366
|
+
{
|
|
1367
|
+
value: password,
|
|
1368
|
+
onChangeText: setPassword,
|
|
1369
|
+
placeholder: texts.passwordPlaceholder,
|
|
1370
|
+
secureTextEntry: true,
|
|
1371
|
+
className: "px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",
|
|
1372
|
+
placeholderTextColor: "#9CA3AF"
|
|
1373
|
+
}
|
|
1374
|
+
)
|
|
1375
|
+
] }),
|
|
1376
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-2", children: [
|
|
1377
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm font-medium text-gray-900 dark:text-white", children: texts.confirmPassword }),
|
|
1378
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1379
|
+
reactNative.TextInput,
|
|
1380
|
+
{
|
|
1381
|
+
value: confirmPassword,
|
|
1382
|
+
onChangeText: setConfirmPassword,
|
|
1383
|
+
placeholder: texts.confirmPasswordPlaceholder,
|
|
1384
|
+
secureTextEntry: true,
|
|
1385
|
+
className: "px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",
|
|
1386
|
+
placeholderTextColor: "#9CA3AF"
|
|
1387
|
+
}
|
|
1388
|
+
)
|
|
1389
|
+
] }),
|
|
1390
|
+
displayError && /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm text-red-600 dark:text-red-400", children: displayError }),
|
|
1391
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1392
|
+
reactNative.Pressable,
|
|
1393
|
+
{
|
|
1394
|
+
onPress: handleSubmit,
|
|
1395
|
+
disabled: loading || !email || !password || !confirmPassword,
|
|
1396
|
+
className: componentsRn.cn(
|
|
1397
|
+
"py-3 px-4 rounded-lg items-center justify-center",
|
|
1398
|
+
"bg-blue-600 active:bg-blue-700",
|
|
1399
|
+
(loading || !email || !password || !confirmPassword) && "opacity-50"
|
|
1400
|
+
),
|
|
1401
|
+
accessibilityRole: "button",
|
|
1402
|
+
accessibilityLabel: texts.signUp,
|
|
1403
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "font-medium text-white", children: loading ? texts.loading : texts.signUp })
|
|
1404
|
+
}
|
|
1405
|
+
),
|
|
1406
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "flex-row items-center justify-center gap-1", children: [
|
|
1407
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm text-gray-500 dark:text-gray-400", children: texts.haveAccount }),
|
|
1408
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1409
|
+
reactNative.Pressable,
|
|
1410
|
+
{
|
|
1411
|
+
onPress: () => {
|
|
1412
|
+
onTrack == null ? void 0 : onTrack({
|
|
1413
|
+
action: "switch_mode",
|
|
1414
|
+
trackingLabel,
|
|
1415
|
+
componentName
|
|
1416
|
+
});
|
|
1417
|
+
onSwitchToSignIn();
|
|
1418
|
+
},
|
|
1419
|
+
accessibilityRole: "button",
|
|
1420
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm font-medium text-blue-600 dark:text-blue-400", children: texts.signIn })
|
|
1421
|
+
}
|
|
1422
|
+
)
|
|
1423
|
+
] })
|
|
1424
|
+
] });
|
|
1425
|
+
};
|
|
1426
|
+
const ForgotPasswordForm = ({
|
|
1427
|
+
onSwitchToSignIn,
|
|
1428
|
+
onTrack,
|
|
1429
|
+
trackingLabel,
|
|
1430
|
+
componentName = "ForgotPasswordForm"
|
|
1431
|
+
}) => {
|
|
1432
|
+
const { texts, resetPassword, loading, error, clearError } = useAuthStatus();
|
|
1433
|
+
const [email, setEmail] = require$$0.useState("");
|
|
1434
|
+
const [success, setSuccess] = require$$0.useState(false);
|
|
1435
|
+
const handleSubmit = async () => {
|
|
1436
|
+
clearError();
|
|
1437
|
+
setSuccess(false);
|
|
1438
|
+
onTrack == null ? void 0 : onTrack({
|
|
1439
|
+
action: "form_submit",
|
|
1440
|
+
trackingLabel,
|
|
1441
|
+
componentName
|
|
1442
|
+
});
|
|
1443
|
+
await resetPassword(email);
|
|
1444
|
+
setSuccess(true);
|
|
1445
|
+
};
|
|
1446
|
+
if (success) {
|
|
1447
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-4", children: [
|
|
1448
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "p-4 rounded-lg bg-green-50 dark:bg-green-900/20", children: [
|
|
1449
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-base font-medium text-green-800 dark:text-green-200", children: texts.resetEmailSent }),
|
|
1450
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "mt-1 text-sm text-green-700 dark:text-green-300", children: texts.resetEmailSentDesc.replace("{{email}}", email) })
|
|
1451
|
+
] }),
|
|
1452
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1453
|
+
reactNative.Pressable,
|
|
1454
|
+
{
|
|
1455
|
+
onPress: () => {
|
|
1456
|
+
onTrack == null ? void 0 : onTrack({
|
|
1457
|
+
action: "switch_mode",
|
|
1458
|
+
trackingLabel,
|
|
1459
|
+
componentName
|
|
1460
|
+
});
|
|
1461
|
+
onSwitchToSignIn();
|
|
1462
|
+
},
|
|
1463
|
+
className: "py-3 px-4 rounded-lg items-center justify-center bg-blue-600 active:bg-blue-700",
|
|
1464
|
+
accessibilityRole: "button",
|
|
1465
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "font-medium text-white", children: texts.backToSignIn })
|
|
1466
|
+
}
|
|
1467
|
+
)
|
|
1468
|
+
] });
|
|
1469
|
+
}
|
|
1470
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-4", children: [
|
|
1471
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm text-gray-500 dark:text-gray-400", children: "Enter your email address and we'll send you a link to reset your password." }),
|
|
1472
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-2", children: [
|
|
1473
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm font-medium text-gray-900 dark:text-white", children: texts.email }),
|
|
1474
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1475
|
+
reactNative.TextInput,
|
|
1476
|
+
{
|
|
1477
|
+
value: email,
|
|
1478
|
+
onChangeText: setEmail,
|
|
1479
|
+
placeholder: texts.emailPlaceholder,
|
|
1480
|
+
keyboardType: "email-address",
|
|
1481
|
+
autoCapitalize: "none",
|
|
1482
|
+
autoCorrect: false,
|
|
1483
|
+
className: "px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",
|
|
1484
|
+
placeholderTextColor: "#9CA3AF"
|
|
1485
|
+
}
|
|
1486
|
+
)
|
|
1487
|
+
] }),
|
|
1488
|
+
error && /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm text-red-600 dark:text-red-400", children: error }),
|
|
1489
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1490
|
+
reactNative.Pressable,
|
|
1491
|
+
{
|
|
1492
|
+
onPress: handleSubmit,
|
|
1493
|
+
disabled: loading || !email,
|
|
1494
|
+
className: componentsRn.cn(
|
|
1495
|
+
"py-3 px-4 rounded-lg items-center justify-center",
|
|
1496
|
+
"bg-blue-600 active:bg-blue-700",
|
|
1497
|
+
(loading || !email) && "opacity-50"
|
|
1498
|
+
),
|
|
1499
|
+
accessibilityRole: "button",
|
|
1500
|
+
accessibilityLabel: texts.sendResetLink,
|
|
1501
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "font-medium text-white", children: loading ? texts.loading : texts.sendResetLink })
|
|
1502
|
+
}
|
|
1503
|
+
),
|
|
1504
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1505
|
+
reactNative.Pressable,
|
|
1506
|
+
{
|
|
1507
|
+
onPress: () => {
|
|
1508
|
+
onTrack == null ? void 0 : onTrack({
|
|
1509
|
+
action: "switch_mode",
|
|
1510
|
+
trackingLabel,
|
|
1511
|
+
componentName
|
|
1512
|
+
});
|
|
1513
|
+
onSwitchToSignIn();
|
|
1514
|
+
},
|
|
1515
|
+
className: "items-center py-2",
|
|
1516
|
+
accessibilityRole: "button",
|
|
1517
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm text-blue-600 dark:text-blue-400", children: texts.backToSignIn })
|
|
1518
|
+
}
|
|
1519
|
+
)
|
|
1520
|
+
] });
|
|
1521
|
+
};
|
|
1522
|
+
const AuthScreen = ({
|
|
1523
|
+
initialMode = "select",
|
|
1524
|
+
className,
|
|
1525
|
+
providers,
|
|
1526
|
+
showTitle = true,
|
|
1527
|
+
title,
|
|
1528
|
+
onModeChange,
|
|
1529
|
+
onSuccess,
|
|
1530
|
+
onTrack,
|
|
1531
|
+
trackingLabel,
|
|
1532
|
+
componentName = "AuthScreen"
|
|
1533
|
+
}) => {
|
|
1534
|
+
const { texts, providerConfig } = useAuthStatus();
|
|
1535
|
+
const [mode, setMode] = require$$0.useState(initialMode);
|
|
1536
|
+
const activeProviders = providers || providerConfig.providers;
|
|
1537
|
+
const handleModeChange = (newMode) => {
|
|
1538
|
+
setMode(newMode);
|
|
1539
|
+
onModeChange == null ? void 0 : onModeChange(newMode);
|
|
1540
|
+
};
|
|
1541
|
+
const getTitle = () => {
|
|
1542
|
+
if (title) return title;
|
|
1543
|
+
switch (mode) {
|
|
1544
|
+
case "select":
|
|
1545
|
+
return texts.signInTitle;
|
|
1546
|
+
case "email-signin":
|
|
1547
|
+
return texts.signInWithEmail;
|
|
1548
|
+
case "email-signup":
|
|
1549
|
+
return texts.createAccount;
|
|
1550
|
+
case "forgot-password":
|
|
1551
|
+
return texts.resetPassword;
|
|
1552
|
+
}
|
|
1553
|
+
};
|
|
1554
|
+
const renderContent = () => {
|
|
1555
|
+
switch (mode) {
|
|
1556
|
+
case "select":
|
|
1557
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1558
|
+
ProviderButtons,
|
|
1559
|
+
{
|
|
1560
|
+
providers: activeProviders,
|
|
1561
|
+
onEmailPress: () => handleModeChange("email-signin"),
|
|
1562
|
+
onTrack,
|
|
1563
|
+
trackingLabel,
|
|
1564
|
+
componentName
|
|
1565
|
+
}
|
|
1566
|
+
);
|
|
1567
|
+
case "email-signin":
|
|
1568
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1569
|
+
EmailSignInForm,
|
|
1570
|
+
{
|
|
1571
|
+
onSwitchToSignUp: () => handleModeChange("email-signup"),
|
|
1572
|
+
onSwitchToForgotPassword: () => handleModeChange("forgot-password"),
|
|
1573
|
+
onSuccess,
|
|
1574
|
+
onTrack,
|
|
1575
|
+
trackingLabel,
|
|
1576
|
+
componentName
|
|
1577
|
+
}
|
|
1578
|
+
);
|
|
1579
|
+
case "email-signup":
|
|
1580
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1581
|
+
EmailSignUpForm,
|
|
1582
|
+
{
|
|
1583
|
+
onSwitchToSignIn: () => handleModeChange("email-signin"),
|
|
1584
|
+
onSuccess,
|
|
1585
|
+
onTrack,
|
|
1586
|
+
trackingLabel,
|
|
1587
|
+
componentName
|
|
1588
|
+
}
|
|
1589
|
+
);
|
|
1590
|
+
case "forgot-password":
|
|
1591
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1592
|
+
ForgotPasswordForm,
|
|
1593
|
+
{
|
|
1594
|
+
onSwitchToSignIn: () => handleModeChange("email-signin"),
|
|
1595
|
+
onTrack,
|
|
1596
|
+
trackingLabel,
|
|
1597
|
+
componentName
|
|
1598
|
+
}
|
|
1599
|
+
);
|
|
1600
|
+
}
|
|
1601
|
+
};
|
|
1602
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.SafeAreaView, { className: componentsRn.cn("flex-1 bg-white dark:bg-gray-900", className), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1603
|
+
reactNative.ScrollView,
|
|
1604
|
+
{
|
|
1605
|
+
className: "flex-1",
|
|
1606
|
+
contentContainerClassName: "flex-grow justify-center px-6 py-8",
|
|
1607
|
+
keyboardShouldPersistTaps: "handled",
|
|
1608
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "max-w-md w-full self-center gap-8", children: [
|
|
1609
|
+
showTitle && /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-2xl font-bold text-gray-900 dark:text-white text-center", children: getTitle() }),
|
|
1610
|
+
renderContent()
|
|
1611
|
+
] })
|
|
1612
|
+
}
|
|
1613
|
+
) });
|
|
1614
|
+
};
|
|
1615
|
+
const AuthInline = ({
|
|
1616
|
+
initialMode = "select",
|
|
1617
|
+
className,
|
|
1618
|
+
providers,
|
|
1619
|
+
showTitle = true,
|
|
1620
|
+
title,
|
|
1621
|
+
onModeChange,
|
|
1622
|
+
onSuccess,
|
|
1623
|
+
variant = "card",
|
|
1624
|
+
onTrack,
|
|
1625
|
+
trackingLabel,
|
|
1626
|
+
componentName = "AuthInline"
|
|
1627
|
+
}) => {
|
|
1628
|
+
const { texts, providerConfig } = useAuthStatus();
|
|
1629
|
+
const [mode, setMode] = require$$0.useState(initialMode);
|
|
1630
|
+
const activeProviders = providers || providerConfig.providers;
|
|
1631
|
+
const handleModeChange = (newMode) => {
|
|
1632
|
+
setMode(newMode);
|
|
1633
|
+
onModeChange == null ? void 0 : onModeChange(newMode);
|
|
1634
|
+
};
|
|
1635
|
+
const getTitle = () => {
|
|
1636
|
+
if (title) return title;
|
|
1637
|
+
switch (mode) {
|
|
1638
|
+
case "select":
|
|
1639
|
+
return texts.signInTitle;
|
|
1640
|
+
case "email-signin":
|
|
1641
|
+
return texts.signInWithEmail;
|
|
1642
|
+
case "email-signup":
|
|
1643
|
+
return texts.createAccount;
|
|
1644
|
+
case "forgot-password":
|
|
1645
|
+
return texts.resetPassword;
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
const renderContent = () => {
|
|
1649
|
+
switch (mode) {
|
|
1650
|
+
case "select":
|
|
1651
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1652
|
+
ProviderButtons,
|
|
1653
|
+
{
|
|
1654
|
+
providers: activeProviders,
|
|
1655
|
+
onEmailPress: () => handleModeChange("email-signin"),
|
|
1656
|
+
onTrack,
|
|
1657
|
+
trackingLabel,
|
|
1658
|
+
componentName
|
|
1659
|
+
}
|
|
1660
|
+
);
|
|
1661
|
+
case "email-signin":
|
|
1662
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1663
|
+
EmailSignInForm,
|
|
1664
|
+
{
|
|
1665
|
+
onSwitchToSignUp: () => handleModeChange("email-signup"),
|
|
1666
|
+
onSwitchToForgotPassword: () => handleModeChange("forgot-password"),
|
|
1667
|
+
onSuccess,
|
|
1668
|
+
onTrack,
|
|
1669
|
+
trackingLabel,
|
|
1670
|
+
componentName
|
|
1671
|
+
}
|
|
1672
|
+
);
|
|
1673
|
+
case "email-signup":
|
|
1674
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1675
|
+
EmailSignUpForm,
|
|
1676
|
+
{
|
|
1677
|
+
onSwitchToSignIn: () => handleModeChange("email-signin"),
|
|
1678
|
+
onSuccess,
|
|
1679
|
+
onTrack,
|
|
1680
|
+
trackingLabel,
|
|
1681
|
+
componentName
|
|
1682
|
+
}
|
|
1683
|
+
);
|
|
1684
|
+
case "forgot-password":
|
|
1685
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1686
|
+
ForgotPasswordForm,
|
|
1687
|
+
{
|
|
1688
|
+
onSwitchToSignIn: () => handleModeChange("email-signin"),
|
|
1689
|
+
onTrack,
|
|
1690
|
+
trackingLabel,
|
|
1691
|
+
componentName
|
|
1692
|
+
}
|
|
1693
|
+
);
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
const content = /* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "gap-4", children: [
|
|
1697
|
+
showTitle && /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-xl font-semibold text-gray-900 dark:text-white text-center", children: getTitle() }),
|
|
1698
|
+
renderContent()
|
|
1699
|
+
] });
|
|
1700
|
+
if (variant === "flat") {
|
|
1701
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.View, { className, children: content });
|
|
1702
|
+
}
|
|
1703
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1704
|
+
componentsRn.Card,
|
|
1705
|
+
{
|
|
1706
|
+
variant: variant === "bordered" ? "bordered" : "default",
|
|
1707
|
+
padding: "lg",
|
|
1708
|
+
className,
|
|
1709
|
+
children: content
|
|
1710
|
+
}
|
|
1711
|
+
);
|
|
1712
|
+
};
|
|
1713
|
+
function getInitials(name, email) {
|
|
1714
|
+
if (name) {
|
|
1715
|
+
const parts = name.trim().split(/\s+/);
|
|
1716
|
+
if (parts.length >= 2) {
|
|
1717
|
+
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
1718
|
+
}
|
|
1719
|
+
return name.slice(0, 2).toUpperCase();
|
|
1720
|
+
}
|
|
1721
|
+
if (email) {
|
|
1722
|
+
return email.slice(0, 2).toUpperCase();
|
|
1723
|
+
}
|
|
1724
|
+
return "?";
|
|
1725
|
+
}
|
|
1726
|
+
const Avatar = ({
|
|
1727
|
+
user,
|
|
1728
|
+
size = 32,
|
|
1729
|
+
className,
|
|
1730
|
+
onPress,
|
|
1731
|
+
...props
|
|
1732
|
+
}) => {
|
|
1733
|
+
const [imageError, setImageError] = require$$0.useState(false);
|
|
1734
|
+
const hasValidPhoto = user.photoURL && !imageError;
|
|
1735
|
+
const initials = getInitials(user.displayName, user.email);
|
|
1736
|
+
const sizeStyle = {
|
|
1737
|
+
width: size,
|
|
1738
|
+
height: size,
|
|
1739
|
+
borderRadius: size / 2
|
|
1740
|
+
};
|
|
1741
|
+
const content = hasValidPhoto ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1742
|
+
reactNative.Image,
|
|
1743
|
+
{
|
|
1744
|
+
source: { uri: user.photoURL },
|
|
1745
|
+
style: sizeStyle,
|
|
1746
|
+
className: "bg-gray-200 dark:bg-gray-700",
|
|
1747
|
+
onError: () => setImageError(true),
|
|
1748
|
+
accessibilityLabel: user.displayName || "User avatar"
|
|
1749
|
+
}
|
|
1750
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1751
|
+
reactNative.View,
|
|
1752
|
+
{
|
|
1753
|
+
style: sizeStyle,
|
|
1754
|
+
className: componentsRn.cn("items-center justify-center bg-blue-600", className),
|
|
1755
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { style: { fontSize: size * 0.4 }, className: "font-medium text-white", children: initials })
|
|
1756
|
+
}
|
|
1757
|
+
);
|
|
1758
|
+
if (onPress) {
|
|
1759
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1760
|
+
reactNative.Pressable,
|
|
1761
|
+
{
|
|
1762
|
+
onPress,
|
|
1763
|
+
className: componentsRn.cn("active:opacity-80", className),
|
|
1764
|
+
accessibilityRole: "button",
|
|
1765
|
+
accessibilityLabel: user.displayName || "User avatar",
|
|
1766
|
+
...props,
|
|
1767
|
+
children: content
|
|
1768
|
+
}
|
|
1769
|
+
);
|
|
1770
|
+
}
|
|
1771
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.View, { className, ...props, children: content });
|
|
1772
|
+
};
|
|
1773
|
+
const AuthAction = ({
|
|
1774
|
+
className,
|
|
1775
|
+
loginButtonVariant = "primary",
|
|
1776
|
+
size = "md",
|
|
1777
|
+
loginButtonContent,
|
|
1778
|
+
avatarSize = 32,
|
|
1779
|
+
menuItems: _menuItems = [],
|
|
1780
|
+
showUserInfo = true,
|
|
1781
|
+
renderUserInfo: _renderUserInfo,
|
|
1782
|
+
renderAvatar,
|
|
1783
|
+
onLoginPress,
|
|
1784
|
+
onLogoutPress,
|
|
1785
|
+
onTrack,
|
|
1786
|
+
trackingLabel,
|
|
1787
|
+
componentName = "AuthAction"
|
|
1788
|
+
}) => {
|
|
1789
|
+
const { user, isAuthenticated, texts, signOut, loading } = useAuthStatus();
|
|
1790
|
+
const handleLoginPress = () => {
|
|
1791
|
+
onTrack == null ? void 0 : onTrack({
|
|
1792
|
+
action: "login_press",
|
|
1793
|
+
trackingLabel,
|
|
1794
|
+
componentName
|
|
1795
|
+
});
|
|
1796
|
+
const result = onLoginPress == null ? void 0 : onLoginPress();
|
|
1797
|
+
if (result === false) return;
|
|
1798
|
+
};
|
|
1799
|
+
const handleLogoutPress = async () => {
|
|
1800
|
+
onTrack == null ? void 0 : onTrack({
|
|
1801
|
+
action: "logout_press",
|
|
1802
|
+
trackingLabel,
|
|
1803
|
+
componentName
|
|
1804
|
+
});
|
|
1805
|
+
onLogoutPress == null ? void 0 : onLogoutPress();
|
|
1806
|
+
await signOut();
|
|
1807
|
+
};
|
|
1808
|
+
if (!isAuthenticated || !user) {
|
|
1809
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1810
|
+
componentsRn.Button,
|
|
1811
|
+
{
|
|
1812
|
+
variant: loginButtonVariant,
|
|
1813
|
+
size: size === "md" ? "default" : size,
|
|
1814
|
+
onPress: handleLoginPress,
|
|
1815
|
+
disabled: loading,
|
|
1816
|
+
className,
|
|
1817
|
+
children: loginButtonContent || texts.login
|
|
1818
|
+
}
|
|
1819
|
+
);
|
|
1820
|
+
}
|
|
1821
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: componentsRn.cn("flex-row items-center gap-3", className), children: [
|
|
1822
|
+
showUserInfo && /* @__PURE__ */ jsxRuntimeExports.jsxs(reactNative.View, { className: "items-end", children: [
|
|
1823
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm font-medium text-gray-900 dark:text-white", children: user.displayName || user.email }),
|
|
1824
|
+
user.displayName && user.email && /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-xs text-gray-500 dark:text-gray-400", children: user.email })
|
|
1825
|
+
] }),
|
|
1826
|
+
renderAvatar ? renderAvatar(user) : /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { user, size: avatarSize }),
|
|
1827
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1828
|
+
reactNative.Pressable,
|
|
1829
|
+
{
|
|
1830
|
+
onPress: handleLogoutPress,
|
|
1831
|
+
className: "px-3 py-1.5 rounded-md bg-gray-100 dark:bg-gray-800 active:opacity-80",
|
|
1832
|
+
accessibilityRole: "button",
|
|
1833
|
+
accessibilityLabel: texts.logout,
|
|
1834
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.Text, { className: "text-sm text-gray-700 dark:text-gray-300", children: texts.logout })
|
|
1835
|
+
}
|
|
1836
|
+
)
|
|
1837
|
+
] });
|
|
1838
|
+
};
|
|
1839
|
+
exports.AuthAction = AuthAction;
|
|
1840
|
+
exports.AuthInline = AuthInline;
|
|
1841
|
+
exports.AuthProvider = AuthProvider;
|
|
1842
|
+
exports.AuthScreen = AuthScreen;
|
|
1843
|
+
exports.Avatar = Avatar;
|
|
1844
|
+
exports.EmailSignInForm = EmailSignInForm;
|
|
1845
|
+
exports.EmailSignUpForm = EmailSignUpForm;
|
|
1846
|
+
exports.ForgotPasswordForm = ForgotPasswordForm;
|
|
1847
|
+
exports.ProviderButtons = ProviderButtons;
|
|
1848
|
+
exports.createDefaultErrorTexts = createDefaultErrorTexts;
|
|
1849
|
+
exports.useAuthStatus = useAuthStatus;
|
|
1850
|
+
//# sourceMappingURL=index.cjs.js.map
|