@redzone/taunt-logins-ui-react 0.0.11 → 0.0.13

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.
@@ -0,0 +1,647 @@
1
+ function __insertCSS(code) {
2
+ if (!code || typeof document == 'undefined') return
3
+ let head = document.head || document.getElementsByTagName('head')[0]
4
+ let style = document.createElement('style')
5
+ style.type = 'text/css'
6
+ head.appendChild(style)
7
+ ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code))
8
+ }
9
+
10
+ var jsxRuntime = require('react/jsx-runtime');
11
+ var react = require('react');
12
+ var cc = require('./cc-D-353NYd.cjs');
13
+ var tauntLogins = require('@redzone/taunt-logins');
14
+
15
+ __insertCSS(".rzd-loginui-complete{background:radial-gradient(50% 50% at 50% 50%,#132c50 0,#0b101b 100%);border-radius:37px;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;gap:20px;padding:40px;max-width:620px;min-height:455px;min-width:500px}.rzd-loginview{box-sizing:border-box;color:#fff;font-size:36px;font-weight:700;color:#fff;text-transform:uppercase;margin:20px 0}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}.card{padding:2em}.read-the-docs{color:#888}input.rdz-input{box-sizing:border-box;position:relative;width:100%;max-width:480px;height:58px;border:2px solid #009df3;box-shadow:0 0 16.9px 1px #0e79f3;border-radius:11px}input.rdz-input::placeholder{color:#fff;opacity:1;font-family:\"Futura PT\",sans-serif;font-size:1em}.rdz-magic-email-container{display:flex;flex-direction:column;align-items:center;gap:12px;width:100%}.rdz-magic-email-error{color:red}.rdz-sign-up-text{font-family:\"Futura PT\",sans-serif;font-size:1.2em;font-weight:400}.rdz-icon-button{width:55px;height:55px;border-radius:50%;border:none;background-color:transparent;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;transition:transform .2s ease,filter .2s ease}.rdz-icon-button img{width:100%;height:100%;object-fit:contain}.rdz-icon-button:hover{transform:scale(1.1);filter:brightness(1.1)}.rdz-icon-button:active{transform:scale(.95)}.rdz-icon-button-disabled,.rdz-icon-button:disabled{opacity:.4;cursor:not-allowed;filter:grayscale(100%);pointer-events:none}.rdz-icon-button-disabled:hover,.rdz-icon-button:disabled:hover{transform:none;filter:grayscale(100%)}.rdz-magic-email-button{background-size:100% 100%;background-position:center;background-repeat:no-repeat;font-family:DRUNKWIDE,sans-serif;border:none;color:#fff;padding:16px 32px;cursor:pointer;min-height:135px;margin-bottom:-20px;width:100%;max-width:410px;font-size:22px;font-weight:700;text-transform:uppercase;letter-spacing:1px;background-color:transparent;transition:transform .2s ease,filter .2s ease}.rdz-magic-email-button:hover{transform:scale(1.05);filter:brightness(1.1)}.rdz-magic-email-button:active{transform:scale(.98)}.rdz-logout-button{margin-left:8px;padding:12px 24px;background-color:#3b82f6;color:#fff;border-radius:6px;border:none;cursor:pointer;font-family:\"Futura PT\",sans-serif;font-size:16px;font-weight:500;transition:transform .2s ease,filter .2s ease}.rdz-logout-button:hover{transform:scale(1.05);filter:brightness(1.1)}.rdz-logout-button:active{transform:scale(.98)}");
16
+
17
+ const coinbaseLogo = "https://res.cloudinary.com/dz0wa3qbj/image/upload/v1760030923/coinbase_kyknjr.png";
18
+ const CoinbaseButton = ({ openCoinbase, disabled = false })=>{
19
+ const runCoinbase = react.useCallback(()=>{
20
+ if (disabled) return;
21
+ if (openCoinbase) {
22
+ openCoinbase();
23
+ } else {
24
+ console.log("Coinbase login not yet implemented");
25
+ }
26
+ }, [
27
+ openCoinbase,
28
+ disabled
29
+ ]);
30
+ return /*#__PURE__*/ jsxRuntime.jsx("button", {
31
+ className: `rdz-icon-button ${disabled ? "rdz-icon-button-disabled" : ""}`,
32
+ onClick: runCoinbase,
33
+ disabled: disabled,
34
+ children: /*#__PURE__*/ jsxRuntime.jsx("img", {
35
+ src: coinbaseLogo,
36
+ alt: "Coinbase"
37
+ })
38
+ });
39
+ };
40
+
41
+ function LoadingView() {
42
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
43
+ className: "rzd-loginview",
44
+ style: {
45
+ display: "flex",
46
+ flexDirection: "column",
47
+ alignItems: "center",
48
+ gap: 20
49
+ },
50
+ children: [
51
+ /*#__PURE__*/ jsxRuntime.jsx("h1", {
52
+ children: "Processing..."
53
+ }),
54
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
55
+ style: {
56
+ width: "60px",
57
+ height: "60px",
58
+ border: "4px solid #009df3",
59
+ borderTop: "4px solid transparent",
60
+ borderRadius: "50%",
61
+ animation: "spin 1s linear infinite"
62
+ }
63
+ }),
64
+ /*#__PURE__*/ jsxRuntime.jsx("style", {
65
+ children: `
66
+ @keyframes spin {
67
+ 0% { transform: rotate(0deg); }
68
+ 100% { transform: rotate(360deg); }
69
+ }
70
+ `
71
+ }),
72
+ /*#__PURE__*/ jsxRuntime.jsx("p", {
73
+ style: {
74
+ fontFamily: "Futura PT, sans-serif",
75
+ fontSize: "1.2em",
76
+ color: "white"
77
+ },
78
+ children: "Please wait while we authenticate you..."
79
+ })
80
+ ]
81
+ });
82
+ }
83
+
84
+ const TauntContext = react.createContext({
85
+ tauntServiceEndpoint: "",
86
+ isLoading: false,
87
+ loggedIn: false,
88
+ metamaskLogin: ()=>{},
89
+ otpMagicLogin: ()=>{},
90
+ telegramLogin: ()=>{},
91
+ metaLogin: ()=>{},
92
+ coinbaseLogin: ()=>{},
93
+ refreshToken: (token)=>cc._async_to_generator(function*() {})(),
94
+ getClaimrToken: ()=>Promise.resolve(undefined),
95
+ logout: ()=>{}
96
+ });
97
+ function useTaunt() {
98
+ const ctx = react.useContext(TauntContext);
99
+ if (!ctx) {
100
+ throw new Error("useTaunt must be used within a TauntProvider");
101
+ }
102
+ return ctx;
103
+ }
104
+
105
+ const btnImage = "https://res.cloudinary.com/dz0wa3qbj/image/upload/v1760030925/btn_ioay6n.png";
106
+ const MagicEmailInput = ({ onEmail })=>{
107
+ const { otpMagicLogin } = useTaunt();
108
+ const [email, setEmail] = react.useState();
109
+ const [showError, setShowError] = react.useState(false);
110
+ const validEmail = react.useMemo(()=>{
111
+ const validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
112
+ return (email == null ? void 0 : email.match(validRegex)) ? email : undefined;
113
+ }, [
114
+ email
115
+ ]);
116
+ const runMagic = ()=>{
117
+ if (!validEmail) {
118
+ setShowError(true);
119
+ return;
120
+ }
121
+ setShowError(false);
122
+ if (onEmail) {
123
+ onEmail(email);
124
+ } else {
125
+ otpMagicLogin(email);
126
+ }
127
+ };
128
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
129
+ className: "rdz-magic-email-container",
130
+ children: [
131
+ showError && /*#__PURE__*/ jsxRuntime.jsx("div", {
132
+ className: "rdz-magic-email-error",
133
+ children: "Please enter a valid email"
134
+ }),
135
+ /*#__PURE__*/ jsxRuntime.jsx("input", {
136
+ className: "rdz-input",
137
+ onChange: (e)=>setEmail(e.target.value ? e.target.value : undefined),
138
+ placeholder: "Email address",
139
+ type: "email",
140
+ value: email
141
+ }),
142
+ /*#__PURE__*/ jsxRuntime.jsx("button", {
143
+ onClick: runMagic,
144
+ type: "button",
145
+ className: "rdz-magic-email-button",
146
+ style: {
147
+ backgroundImage: `url(${btnImage})`
148
+ },
149
+ children: "LOG IN / SIGN UP"
150
+ })
151
+ ]
152
+ });
153
+ };
154
+
155
+ const metaLogo = "https://res.cloudinary.com/dz0wa3qbj/image/upload/v1760030923/meta_rhrjov.png";
156
+ const MetaButton = ({ openMeta, disabled = false })=>{
157
+ // const { metaLogin } = useTaunt() // Uncomment when meta login is implemented
158
+ const runMeta = react.useCallback(()=>{
159
+ if (disabled) return;
160
+ if (openMeta) {
161
+ openMeta();
162
+ } else {
163
+ // metaLogin() // Uncomment when meta login is implemented
164
+ console.log("Meta login not yet implemented");
165
+ }
166
+ }, [
167
+ openMeta,
168
+ disabled
169
+ ]);
170
+ return /*#__PURE__*/ jsxRuntime.jsx("button", {
171
+ className: `rdz-icon-button ${disabled ? 'rdz-icon-button-disabled' : ''}`,
172
+ onClick: runMeta,
173
+ disabled: disabled,
174
+ children: /*#__PURE__*/ jsxRuntime.jsx("img", {
175
+ src: metaLogo,
176
+ alt: "Meta"
177
+ })
178
+ });
179
+ };
180
+
181
+ const metamaskLogo = "https://res.cloudinary.com/dz0wa3qbj/image/upload/v1760030924/metamask_asjtmi.png";
182
+ const MetaMaskButton = ({ openMetamask, disabled = false })=>{
183
+ const { metamaskLogin } = useTaunt();
184
+ const runMetamask = react.useCallback(()=>{
185
+ if (disabled) return;
186
+ if (openMetamask) {
187
+ openMetamask();
188
+ } else {
189
+ metamaskLogin();
190
+ }
191
+ }, [
192
+ metamaskLogin,
193
+ openMetamask,
194
+ disabled
195
+ ]);
196
+ return /*#__PURE__*/ jsxRuntime.jsx("button", {
197
+ className: `rdz-icon-button ${disabled ? 'rdz-icon-button-disabled' : ''}`,
198
+ onClick: runMetamask,
199
+ disabled: disabled,
200
+ children: /*#__PURE__*/ jsxRuntime.jsx("img", {
201
+ src: metamaskLogo,
202
+ alt: "MetaMask"
203
+ })
204
+ });
205
+ };
206
+
207
+ const telegramLogo = "https://res.cloudinary.com/dz0wa3qbj/image/upload/v1760030924/tel_vcs64d.png";
208
+ const TelegramButton = ({ openTelegram, disabled = false })=>{
209
+ const { telegramLogin } = useTaunt();
210
+ const runTelegram = react.useCallback(()=>{
211
+ if (disabled) return;
212
+ if (openTelegram) {
213
+ openTelegram();
214
+ } else {
215
+ telegramLogin();
216
+ }
217
+ }, [
218
+ telegramLogin,
219
+ openTelegram,
220
+ disabled
221
+ ]);
222
+ return /*#__PURE__*/ jsxRuntime.jsx("button", {
223
+ className: `rdz-icon-button ${disabled ? 'rdz-icon-button-disabled' : ''}`,
224
+ onClick: runTelegram,
225
+ disabled: disabled,
226
+ children: /*#__PURE__*/ jsxRuntime.jsx("img", {
227
+ src: telegramLogo,
228
+ alt: "Telegram"
229
+ })
230
+ });
231
+ };
232
+
233
+ const LoginView = ({ providers = [
234
+ "email",
235
+ "metamask",
236
+ "telegram",
237
+ "meta",
238
+ "coinbase"
239
+ ], showEmail = true, showDisabled = false, dividerText = "Or Sign Up Using", providerGap = 20, showTerms = false, termsContent, privacyContent, onTermsClick, onPrivacyClick, ModalComponent, magicEmailProps = {}, coinbaseProps = {}, metamaskProps = {}, metaProps = {}, telegramProps = {} })=>{
240
+ const [modalContent, setModalContent] = react.useState(null);
241
+ const showEmailInput = showEmail || providers.includes("email");
242
+ const allSocialProviders = [
243
+ "coinbase",
244
+ "metamask",
245
+ "meta",
246
+ "telegram"
247
+ ];
248
+ // Determine which social providers to show
249
+ const socialProvidersToShow = showDisabled ? allSocialProviders : allSocialProviders.filter((p)=>providers.includes(p));
250
+ const hasSocialProviders = socialProvidersToShow.length > 0;
251
+ const handleTermsClick = ()=>{
252
+ console.log("Terms clicked", {
253
+ onTermsClick,
254
+ termsContent: !!termsContent
255
+ });
256
+ if (onTermsClick) {
257
+ onTermsClick();
258
+ } else if (termsContent) {
259
+ setModalContent({
260
+ title: "Terms of Service",
261
+ content: termsContent
262
+ });
263
+ }
264
+ };
265
+ const handlePrivacyClick = ()=>{
266
+ console.log("Privacy clicked", {
267
+ onPrivacyClick,
268
+ privacyContent: !!privacyContent
269
+ });
270
+ if (onPrivacyClick) {
271
+ onPrivacyClick();
272
+ } else if (privacyContent) {
273
+ setModalContent({
274
+ title: "Privacy Policy",
275
+ content: privacyContent
276
+ });
277
+ }
278
+ };
279
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
280
+ children: [
281
+ showEmailInput && /*#__PURE__*/ jsxRuntime.jsx(MagicEmailInput, cc._extends({}, magicEmailProps)),
282
+ showEmailInput && hasSocialProviders && /*#__PURE__*/ jsxRuntime.jsx("p", {
283
+ className: "rdz-sign-up-text",
284
+ children: dividerText
285
+ }),
286
+ hasSocialProviders && /*#__PURE__*/ jsxRuntime.jsxs("div", {
287
+ style: {
288
+ display: "flex",
289
+ flexDirection: "row",
290
+ gap: providerGap,
291
+ alignItems: "center"
292
+ },
293
+ children: [
294
+ socialProvidersToShow.includes("coinbase") && /*#__PURE__*/ jsxRuntime.jsx(CoinbaseButton, cc._extends({
295
+ disabled: !providers.includes("coinbase")
296
+ }, coinbaseProps)),
297
+ socialProvidersToShow.includes("metamask") && /*#__PURE__*/ jsxRuntime.jsx(MetaMaskButton, cc._extends({
298
+ disabled: !providers.includes("metamask")
299
+ }, metamaskProps)),
300
+ socialProvidersToShow.includes("meta") && /*#__PURE__*/ jsxRuntime.jsx(MetaButton, cc._extends({
301
+ disabled: !providers.includes("meta")
302
+ }, metaProps)),
303
+ socialProvidersToShow.includes("telegram") && /*#__PURE__*/ jsxRuntime.jsx(TelegramButton, cc._extends({
304
+ disabled: !providers.includes("telegram")
305
+ }, telegramProps))
306
+ ]
307
+ }),
308
+ console.log("Terms render check:", {
309
+ showTerms,
310
+ hasTermsContent: !!termsContent,
311
+ hasPrivacyContent: !!privacyContent,
312
+ hasTermsClick: !!onTermsClick,
313
+ hasPrivacyClick: !!onPrivacyClick
314
+ }),
315
+ showTerms && (termsContent || privacyContent || onTermsClick || onPrivacyClick) && /*#__PURE__*/ jsxRuntime.jsxs("p", {
316
+ style: {
317
+ fontFamily: "Futura PT, sans-serif",
318
+ fontSize: "1.3em"
319
+ },
320
+ children: [
321
+ "By connecting you are agreeing to our",
322
+ " ",
323
+ (termsContent || onTermsClick) && /*#__PURE__*/ jsxRuntime.jsx("a", {
324
+ href: "#",
325
+ onClick: (e)=>{
326
+ e.preventDefault();
327
+ handleTermsClick();
328
+ },
329
+ style: {
330
+ color: "#0099ff",
331
+ textDecoration: "none",
332
+ cursor: "pointer"
333
+ },
334
+ children: "Terms of Service"
335
+ }),
336
+ (termsContent || onTermsClick) && (privacyContent || onPrivacyClick) && " and ",
337
+ (privacyContent || onPrivacyClick) && /*#__PURE__*/ jsxRuntime.jsx("a", {
338
+ href: "#",
339
+ onClick: (e)=>{
340
+ e.preventDefault();
341
+ handlePrivacyClick();
342
+ },
343
+ style: {
344
+ color: "#0099ff",
345
+ textDecoration: "none",
346
+ cursor: "pointer"
347
+ },
348
+ children: "Privacy Policy"
349
+ })
350
+ ]
351
+ }),
352
+ modalContent && ModalComponent && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
353
+ children: [
354
+ console.log("Rendering modal", {
355
+ modalContent,
356
+ ModalComponent: !!ModalComponent
357
+ }),
358
+ /*#__PURE__*/ jsxRuntime.jsx(ModalComponent, {
359
+ title: modalContent.title,
360
+ content: modalContent.content,
361
+ onClose: ()=>setModalContent(null)
362
+ })
363
+ ]
364
+ })
365
+ ]
366
+ });
367
+ };
368
+
369
+ const LoginUIComplete = (_param)=>{
370
+ var { className, extLoading = false } = _param, loginProps = cc._object_without_properties_loose(_param, [
371
+ "className",
372
+ "extLoading"
373
+ ]);
374
+ const { loggedIn, isLoading } = useTaunt();
375
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
376
+ className: `rzd-loginview rzd-loginui-complete ${className || ""}`,
377
+ children: extLoading || isLoading ? /*#__PURE__*/ jsxRuntime.jsx(LoadingView, {}) : loggedIn ? /*#__PURE__*/ jsxRuntime.jsx(LoggedInView, {}) : /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
378
+ children: [
379
+ /*#__PURE__*/ jsxRuntime.jsx("h1", {
380
+ className: "header-login",
381
+ children: "login"
382
+ }),
383
+ /*#__PURE__*/ jsxRuntime.jsx(LoginView, cc._extends({}, loginProps))
384
+ ]
385
+ })
386
+ });
387
+ };
388
+ function LoggedInView() {
389
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
390
+ children: [
391
+ /*#__PURE__*/ jsxRuntime.jsx("h1", {
392
+ children: "Successfully Logged In"
393
+ }),
394
+ /*#__PURE__*/ jsxRuntime.jsx("p", {
395
+ style: {
396
+ fontFamily: "Futura PT, sans-serif",
397
+ fontSize: "1.2em"
398
+ },
399
+ children: "You are now logged in!"
400
+ }),
401
+ /*#__PURE__*/ jsxRuntime.jsx(LogoutButton, {})
402
+ ]
403
+ });
404
+ }
405
+ function LogoutButton() {
406
+ const { logout } = useTaunt();
407
+ return /*#__PURE__*/ jsxRuntime.jsx("button", {
408
+ onClick: logout,
409
+ className: "rdz-logout-button",
410
+ type: "button",
411
+ children: "Logout"
412
+ });
413
+ }
414
+
415
+ function ModalView({ title, content, onClose }) {
416
+ // Close modal on Escape key
417
+ react.useEffect(()=>{
418
+ const handleEscape = (e)=>{
419
+ if (e.key === "Escape") onClose();
420
+ };
421
+ document.addEventListener("keydown", handleEscape);
422
+ return ()=>document.removeEventListener("keydown", handleEscape);
423
+ }, [
424
+ onClose
425
+ ]);
426
+ // Parse content to identify headers and format them
427
+ const formatContent = (text)=>{
428
+ const lines = text.split("\n");
429
+ return lines.map((line, index)=>{
430
+ const trimmedLine = line.trim();
431
+ // First line is the main title (h1)
432
+ if (index === 0 && trimmedLine) {
433
+ return /*#__PURE__*/ jsxRuntime.jsx("h1", {
434
+ style: {
435
+ marginTop: 0,
436
+ marginBottom: "20px",
437
+ fontSize: "28px"
438
+ },
439
+ children: trimmedLine
440
+ }, index);
441
+ }
442
+ // Section headers (lines that are short and followed by content)
443
+ // Common patterns: "Table of contents", "User content", etc.
444
+ if (trimmedLine && trimmedLine.length < 100 && !trimmedLine.includes(".") && index < lines.length - 1 && lines[index + 1].trim()) {
445
+ // Check if next line starts with lowercase or is a paragraph
446
+ const nextLine = lines[index + 1].trim();
447
+ if (nextLine && (nextLine[0] === nextLine[0].toUpperCase() || nextLine.startsWith("We "))) {
448
+ return /*#__PURE__*/ jsxRuntime.jsx("h3", {
449
+ style: {
450
+ marginTop: "24px",
451
+ marginBottom: "12px",
452
+ fontSize: "18px",
453
+ fontWeight: "600"
454
+ },
455
+ children: trimmedLine
456
+ }, index);
457
+ }
458
+ }
459
+ // Regular paragraphs
460
+ if (trimmedLine) {
461
+ return /*#__PURE__*/ jsxRuntime.jsx("p", {
462
+ style: {
463
+ marginBottom: "12px"
464
+ },
465
+ children: trimmedLine
466
+ }, index);
467
+ }
468
+ // Empty lines
469
+ return /*#__PURE__*/ jsxRuntime.jsx("br", {}, index);
470
+ });
471
+ };
472
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
473
+ style: {
474
+ position: "fixed",
475
+ top: 0,
476
+ left: 0,
477
+ right: 0,
478
+ bottom: 0,
479
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
480
+ display: "flex",
481
+ alignItems: "center",
482
+ justifyContent: "center",
483
+ zIndex: 1000,
484
+ padding: "20px"
485
+ },
486
+ onClick: onClose,
487
+ children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
488
+ style: {
489
+ backgroundColor: "#1a1a1a",
490
+ borderRadius: "12px",
491
+ border: "2px solid #009df3",
492
+ maxWidth: "800px",
493
+ maxHeight: "80vh",
494
+ width: "100%",
495
+ display: "flex",
496
+ flexDirection: "column",
497
+ overflow: "hidden"
498
+ },
499
+ onClick: (e)=>e.stopPropagation(),
500
+ children: [
501
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
502
+ style: {
503
+ padding: "20px 24px",
504
+ borderBottom: "1px solid #009df3",
505
+ display: "flex",
506
+ justifyContent: "space-between",
507
+ alignItems: "center"
508
+ },
509
+ children: [
510
+ /*#__PURE__*/ jsxRuntime.jsx("h2", {
511
+ style: {
512
+ fontFamily: "Futura PT, sans-serif",
513
+ margin: 0,
514
+ color: "white",
515
+ fontSize: "24px"
516
+ },
517
+ children: title
518
+ }),
519
+ /*#__PURE__*/ jsxRuntime.jsx("button", {
520
+ onClick: onClose,
521
+ style: {
522
+ background: "transparent",
523
+ border: "none",
524
+ color: "white",
525
+ fontSize: "32px",
526
+ cursor: "pointer",
527
+ padding: "0 10px",
528
+ lineHeight: 1
529
+ },
530
+ children: "×"
531
+ })
532
+ ]
533
+ }),
534
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
535
+ style: {
536
+ padding: "24px",
537
+ overflow: "auto",
538
+ flex: 1,
539
+ fontFamily: "Futura PT, sans-serif",
540
+ fontSize: "15px",
541
+ lineHeight: "1.6",
542
+ color: "white",
543
+ textAlign: "left"
544
+ },
545
+ children: formatContent(content)
546
+ })
547
+ ]
548
+ })
549
+ });
550
+ }
551
+
552
+ const TauntProvider = ({ children, tauntServiceEndpoint, magicKey })=>{
553
+ const [deets, setDeets] = react.useState();
554
+ const taunt = new tauntLogins.TauntApi(tauntServiceEndpoint);
555
+ const [isLoading, setIsLoading] = react.useState(false);
556
+ const loggedIn = !!deets;
557
+ const otpMagicLogin = react.useCallback((email)=>{
558
+ if (!magicKey) throw new Error("magicKey is required for OTP login");
559
+ setIsLoading(true);
560
+ tauntLogins.tauntMagicEmailOTPLogin(tauntServiceEndpoint, magicKey, email, taunt).then(setDeets).finally(()=>setIsLoading(false));
561
+ }, [
562
+ tauntServiceEndpoint,
563
+ magicKey
564
+ ]);
565
+ const metamaskLogin = react.useCallback(()=>{
566
+ setIsLoading(true);
567
+ tauntLogins.tauntMetamaskLogin(tauntServiceEndpoint, undefined, taunt).then(setDeets).finally(()=>setIsLoading(false));
568
+ }, [
569
+ tauntServiceEndpoint
570
+ ]);
571
+ const telegramLogin = react.useCallback(()=>{
572
+ if (!magicKey) throw new Error("magicKey is required for Telegram login");
573
+ setIsLoading(true);
574
+ tauntLogins.tauntMagicTelegramLogin(tauntServiceEndpoint, magicKey, taunt).then(setDeets).finally(()=>setIsLoading(false));
575
+ }, [
576
+ tauntServiceEndpoint,
577
+ magicKey
578
+ ]);
579
+ const metaLogin = react.useCallback(()=>{
580
+ setIsLoading(true);
581
+ console.log("Meta login not yet implemented");
582
+ // Placeholder for Meta login
583
+ setTimeout(()=>setIsLoading(false), 1000);
584
+ }, []);
585
+ const coinbaseLogin = react.useCallback(()=>{
586
+ setIsLoading(true);
587
+ console.log("Coinbase login not yet implemented");
588
+ // Placeholder for Coinbase login
589
+ setTimeout(()=>setIsLoading(false), 1000);
590
+ }, []);
591
+ const getClaimrToken = react.useCallback(()=>{
592
+ if (!loggedIn) return undefined;
593
+ return taunt.getClaimrToken();
594
+ }, [
595
+ loggedIn
596
+ ]);
597
+ const logout = react.useCallback(()=>{
598
+ setDeets(undefined);
599
+ }, []);
600
+ const refreshToken = react.useCallback((token)=>cc._async_to_generator(function*() {
601
+ if (!token) return;
602
+ setIsLoading(true);
603
+ try {
604
+ const newDeets = yield taunt.refresh(token);
605
+ setDeets(newDeets);
606
+ } catch (error) {
607
+ console.error("Failed to refresh token:", error);
608
+ } finally{
609
+ setIsLoading(false);
610
+ }
611
+ })(), []);
612
+ if (!tauntServiceEndpoint) {
613
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
614
+ children: "tauntServiceEndpoint is required"
615
+ });
616
+ }
617
+ return /*#__PURE__*/ jsxRuntime.jsx(TauntContext.Provider, {
618
+ value: {
619
+ tauntServiceEndpoint,
620
+ loggedIn,
621
+ isLoading,
622
+ deets,
623
+ getClaimrToken,
624
+ otpMagicLogin,
625
+ metamaskLogin,
626
+ telegramLogin,
627
+ metaLogin,
628
+ coinbaseLogin,
629
+ refreshToken,
630
+ logout
631
+ },
632
+ children: children
633
+ });
634
+ };
635
+
636
+ exports.CoinbaseButton = CoinbaseButton;
637
+ exports.LoadingView = LoadingView;
638
+ exports.LoginUIComplete = LoginUIComplete;
639
+ exports.LoginView = LoginView;
640
+ exports.MagicEmailInput = MagicEmailInput;
641
+ exports.MetaButton = MetaButton;
642
+ exports.MetaMaskButton = MetaMaskButton;
643
+ exports.ModalView = ModalView;
644
+ exports.TauntContext = TauntContext;
645
+ exports.TauntProvider = TauntProvider;
646
+ exports.TelegramButton = TelegramButton;
647
+ exports.useTaunt = useTaunt;