@pradip1995/segment-login-template 0.5.21 → 0.5.24
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/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pradip1995/segment-login-template",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.24",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"sideEffects":
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"src/commerce-auth-otp-modal.css"
|
|
10
|
+
],
|
|
9
11
|
"files": [
|
|
10
12
|
"src"
|
|
11
13
|
],
|
|
@@ -21,6 +23,7 @@
|
|
|
21
23
|
"./profile-phone-field": "./src/profile-phone-field.tsx",
|
|
22
24
|
"./profile-email-field": "./src/profile-email-field.tsx",
|
|
23
25
|
"./google-auth-section": "./src/google-auth-section.tsx",
|
|
26
|
+
"./google-sign-in-section": "./src/google-sign-in-section.tsx",
|
|
24
27
|
"./otp-input": "./src/otp-input.tsx"
|
|
25
28
|
},
|
|
26
29
|
"peerDependencies": {
|
|
@@ -34,8 +37,8 @@
|
|
|
34
37
|
"dependencies": {
|
|
35
38
|
"@pradip1995/commerce-auth": "^4.0.0",
|
|
36
39
|
"@pradip1995/commerce-core": "^4.0.0",
|
|
37
|
-
"@pradip1995/segment-primitives": "^0.4.
|
|
38
|
-
"@pradip1995/segment-tokens": "^0.3.
|
|
40
|
+
"@pradip1995/segment-primitives": "^0.4.14",
|
|
41
|
+
"@pradip1995/segment-tokens": "^0.3.19"
|
|
39
42
|
},
|
|
40
43
|
"devDependencies": {
|
|
41
44
|
"@pradip1995/plugin-sdk": "^0.2.0",
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { HttpTypes } from "@medusajs/types"
|
|
4
4
|
import LocalizedLink from "@pradip1995/segment-primitives/localized-link"
|
|
5
5
|
import { formatPrice } from "@pradip1995/segment-primitives/format-price"
|
|
6
|
+
import { presentOrderLines } from "@pradip1995/segment-primitives/order-lines"
|
|
6
7
|
import { logoutGuest } from "@pradip1995/commerce-core/data/guest"
|
|
7
8
|
import { acct } from "./account-theme"
|
|
8
9
|
import {
|
|
@@ -82,7 +83,10 @@ export default function AccountGuestOrders({
|
|
|
82
83
|
</p>
|
|
83
84
|
</div>
|
|
84
85
|
<p className="sr-guest-orders__total text-sm font-semibold shrink-0">
|
|
85
|
-
{formatPrice(
|
|
86
|
+
{formatPrice(
|
|
87
|
+
presentOrderLines(order).paidTotal,
|
|
88
|
+
order.currency_code
|
|
89
|
+
)}
|
|
86
90
|
</p>
|
|
87
91
|
</LocalizedLink>
|
|
88
92
|
</li>
|
package/src/auth-server.ts
CHANGED
|
@@ -8,7 +8,11 @@ import {
|
|
|
8
8
|
sendCustomerOTP,
|
|
9
9
|
verifyCustomerOTP,
|
|
10
10
|
} from "@pradip1995/commerce-core/data/customer-registration"
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
authenticateGoogleCredential as authenticateGoogleCredentialCore,
|
|
13
|
+
handleGoogleCallback as handleGoogleCallbackCore,
|
|
14
|
+
transferCart,
|
|
15
|
+
} from "@pradip1995/commerce-core/data/customer"
|
|
12
16
|
import { getAuthHeaders, getCacheTag, setAuthToken } from "@pradip1995/commerce-core/data/cookies"
|
|
13
17
|
import { sendOTP, verifyOTP } from "@pradip1995/commerce-core/data/guest"
|
|
14
18
|
import { getGoogleOAuthCallbackUrl } from "@pradip1995/commerce-core/util/google-oauth"
|
|
@@ -371,6 +375,21 @@ export async function verifyContactChange(input: { otpToken: string; code: strin
|
|
|
371
375
|
return { success: true as const }
|
|
372
376
|
}
|
|
373
377
|
|
|
378
|
+
/** GIS One Tap / credential button → Medusa POST /auth/customer/google/callback { credential } */
|
|
379
|
+
export async function authenticateGoogleCredential(credential: string) {
|
|
380
|
+
return authenticateGoogleCredentialCore(credential)
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** After OAuth JWT: link or create customer (guest upgrade via customer-registration). */
|
|
384
|
+
export async function handleGoogleCallback(
|
|
385
|
+
token: string,
|
|
386
|
+
email?: string,
|
|
387
|
+
first_name?: string,
|
|
388
|
+
last_name?: string
|
|
389
|
+
) {
|
|
390
|
+
return handleGoogleCallbackCore(token, email, first_name, last_name)
|
|
391
|
+
}
|
|
392
|
+
|
|
374
393
|
export async function initiateGoogleAuth(countryCode?: string) {
|
|
375
394
|
try {
|
|
376
395
|
const backendUrl = getBaseUrl()
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
.sr-otp-modal {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
z-index: 90;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
padding: 1rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.sr-otp-modal__backdrop {
|
|
12
|
+
position: absolute;
|
|
13
|
+
inset: 0;
|
|
14
|
+
border: 0;
|
|
15
|
+
background: rgba(10, 16, 28, 0.48);
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sr-otp-modal__panel {
|
|
20
|
+
position: relative;
|
|
21
|
+
z-index: 1;
|
|
22
|
+
width: min(100%, 22rem);
|
|
23
|
+
max-height: min(92vh, 36rem);
|
|
24
|
+
overflow: auto;
|
|
25
|
+
padding: 1.35rem 1.15rem 1.2rem;
|
|
26
|
+
border-radius: 1rem;
|
|
27
|
+
background: #ffffff;
|
|
28
|
+
box-shadow: 0 18px 44px rgba(19, 38, 77, 0.22);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.sr-otp-modal__panel > div {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
gap: 1.15rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.sr-otp-modal__title {
|
|
38
|
+
margin: 0;
|
|
39
|
+
font-family: var(--font-heading, Georgia, serif);
|
|
40
|
+
font-size: 1.65rem;
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
line-height: 1.2;
|
|
43
|
+
color: #0a0a0a;
|
|
44
|
+
text-align: center;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.sr-otp-modal__copy,
|
|
48
|
+
.sr-otp-modal__hint,
|
|
49
|
+
.sr-otp-modal__success {
|
|
50
|
+
margin: 0.4rem 0 0;
|
|
51
|
+
font-size: 0.875rem;
|
|
52
|
+
line-height: 1.5;
|
|
53
|
+
color: #5c6570;
|
|
54
|
+
text-align: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.sr-otp-modal__panel [class*="justify-center"] {
|
|
58
|
+
display: flex;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
gap: 0.45rem;
|
|
61
|
+
width: 100%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.sr-otp-modal__cell {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
width: 2.35rem;
|
|
69
|
+
height: 2.85rem;
|
|
70
|
+
border: 1.5px solid #d5dde6;
|
|
71
|
+
border-radius: 0.55rem;
|
|
72
|
+
background: #f7fafc;
|
|
73
|
+
font-size: 1.15rem;
|
|
74
|
+
font-weight: 700;
|
|
75
|
+
color: #13264d;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.sr-otp-modal__cell.is-active,
|
|
79
|
+
.sr-otp-modal__cell.is-filled {
|
|
80
|
+
border-color: #13264d;
|
|
81
|
+
background: #ffffff;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.sr-otp-modal__error {
|
|
85
|
+
margin: 0;
|
|
86
|
+
color: #b42318;
|
|
87
|
+
text-align: center;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.sr-otp-modal__verify,
|
|
91
|
+
.sr-otp-modal__resend {
|
|
92
|
+
display: block;
|
|
93
|
+
width: 100%;
|
|
94
|
+
min-height: 2.75rem;
|
|
95
|
+
border-radius: 999px;
|
|
96
|
+
font-size: 0.75rem;
|
|
97
|
+
font-weight: 700;
|
|
98
|
+
letter-spacing: 0.12em;
|
|
99
|
+
text-transform: uppercase;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.sr-otp-modal__verify {
|
|
104
|
+
border: 1px solid #13264d;
|
|
105
|
+
background: #13264d;
|
|
106
|
+
color: #ffffff;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.sr-otp-modal__verify:disabled {
|
|
110
|
+
opacity: 0.55;
|
|
111
|
+
cursor: not-allowed;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.sr-otp-modal__resend {
|
|
115
|
+
border: 0;
|
|
116
|
+
background: transparent;
|
|
117
|
+
color: #13264d;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media (max-width: 380px) {
|
|
121
|
+
.sr-otp-modal__cell {
|
|
122
|
+
width: 2.05rem;
|
|
123
|
+
height: 2.55rem;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
+
import { useEffect, useState } from "react"
|
|
4
|
+
import { createPortal } from "react-dom"
|
|
3
5
|
import OtpInput from "@pradip1995/commerce-auth/components/otp-input"
|
|
4
6
|
import type { OtpVerificationModalProps } from "./otp-verification-modal"
|
|
7
|
+
import "./commerce-auth-otp-modal.css"
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* OTP modal styled like commerce-auth/chocomelon, compatible with segment-login-template props.
|
|
@@ -25,15 +28,21 @@ export default function CommerceAuthOtpModal({
|
|
|
25
28
|
preventClose = false,
|
|
26
29
|
extraContent,
|
|
27
30
|
}: OtpVerificationModalProps) {
|
|
28
|
-
|
|
31
|
+
const [mounted, setMounted] = useState(false)
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setMounted(true)
|
|
35
|
+
}, [])
|
|
36
|
+
|
|
37
|
+
if (!open || !mounted) return null
|
|
29
38
|
|
|
30
39
|
function handleBackdropClick() {
|
|
31
40
|
if (preventClose || pending || success) return
|
|
32
41
|
onClose?.()
|
|
33
42
|
}
|
|
34
43
|
|
|
35
|
-
return (
|
|
36
|
-
<div className="sr-otp-modal
|
|
44
|
+
return createPortal(
|
|
45
|
+
<div className="sr-otp-modal" role="presentation">
|
|
37
46
|
<button
|
|
38
47
|
type="button"
|
|
39
48
|
className="sr-otp-modal__backdrop absolute inset-0"
|
|
@@ -106,6 +115,7 @@ export default function CommerceAuthOtpModal({
|
|
|
106
115
|
)}
|
|
107
116
|
</div>
|
|
108
117
|
</div>
|
|
109
|
-
</div
|
|
118
|
+
</div>,
|
|
119
|
+
document.body
|
|
110
120
|
)
|
|
111
121
|
}
|
|
@@ -1,84 +1,22 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
clearMedusaAuthCookies,
|
|
6
|
-
GOOGLE_LOGIN_COUNTRY_CODE_KEY,
|
|
7
|
-
} from "@pradip1995/commerce-auth/util/google-auth-client"
|
|
8
|
-
import { initiateGoogleAuth } from "./auth-server"
|
|
3
|
+
import { GoogleSignInSection } from "./google-sign-in-section"
|
|
9
4
|
import { auth } from "./account-theme"
|
|
10
5
|
|
|
11
|
-
export default function GoogleAuthSection({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const handleClick = async () => {
|
|
19
|
-
setError(null)
|
|
20
|
-
setLoading(true)
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
localStorage.setItem(GOOGLE_LOGIN_COUNTRY_CODE_KEY, countryCode)
|
|
24
|
-
clearMedusaAuthCookies()
|
|
25
|
-
|
|
26
|
-
const result = await initiateGoogleAuth(countryCode)
|
|
27
|
-
|
|
28
|
-
if (result.error) {
|
|
29
|
-
setError(result.error)
|
|
30
|
-
setLoading(false)
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (result.redirectUrl) {
|
|
35
|
-
window.location.href = result.redirectUrl
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
setLoading(false)
|
|
40
|
-
} catch {
|
|
41
|
-
setError("Google sign-in failed. Please try again.")
|
|
42
|
-
setLoading(false)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
6
|
+
export default function GoogleAuthSection({
|
|
7
|
+
countryCode,
|
|
8
|
+
enableOneTap = true,
|
|
9
|
+
}: {
|
|
10
|
+
countryCode: string
|
|
11
|
+
enableOneTap?: boolean
|
|
12
|
+
}) {
|
|
46
13
|
return (
|
|
47
|
-
<
|
|
48
|
-
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
type="button"
|
|
55
|
-
onClick={handleClick}
|
|
56
|
-
disabled={loading}
|
|
57
|
-
className={`${auth.btnOutline} sr-google-btn`}
|
|
58
|
-
aria-label="Continue with Google"
|
|
59
|
-
>
|
|
60
|
-
<svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true">
|
|
61
|
-
<path
|
|
62
|
-
fill="#4285F4"
|
|
63
|
-
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
64
|
-
/>
|
|
65
|
-
<path
|
|
66
|
-
fill="#34A853"
|
|
67
|
-
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
68
|
-
/>
|
|
69
|
-
<path
|
|
70
|
-
fill="#FBBC05"
|
|
71
|
-
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
72
|
-
/>
|
|
73
|
-
<path
|
|
74
|
-
fill="#EA4335"
|
|
75
|
-
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
76
|
-
/>
|
|
77
|
-
</svg>
|
|
78
|
-
<span className="sr-google-btn__label">
|
|
79
|
-
{loading ? "Redirecting…" : "Continue with Google"}
|
|
80
|
-
</span>
|
|
81
|
-
</button>
|
|
82
|
-
</div>
|
|
14
|
+
<GoogleSignInSection
|
|
15
|
+
countryCode={countryCode}
|
|
16
|
+
defaultCountryCode="in"
|
|
17
|
+
enableOneTap={enableOneTap}
|
|
18
|
+
credentialButtonClassName={`${auth.btnOutline} sr-google-btn`}
|
|
19
|
+
oauthButtonClassName={`${auth.btnOutline} sr-google-btn`}
|
|
20
|
+
/>
|
|
83
21
|
)
|
|
84
22
|
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useEffect, useMemo, useState } from "react"
|
|
4
|
+
import { GoogleAuthProvider } from "@pradip1995/commerce-auth/components/google-oauth-provider"
|
|
5
|
+
import { GoogleCredentialButton } from "@pradip1995/commerce-auth/components/google-credential-button"
|
|
6
|
+
import { GoogleIdentityServicesScript } from "@pradip1995/commerce-auth/components/google-identity-script"
|
|
7
|
+
import { GoogleLoginButton } from "@pradip1995/commerce-auth/components/google-login"
|
|
8
|
+
import { GoogleOneTapLogin } from "@pradip1995/commerce-auth/components/google-one-tap"
|
|
9
|
+
import {
|
|
10
|
+
authenticateGoogleCredential,
|
|
11
|
+
handleGoogleCallback,
|
|
12
|
+
initiateGoogleAuth,
|
|
13
|
+
} from "./auth-server"
|
|
14
|
+
|
|
15
|
+
type GisUiState = "loading" | "ready" | "fallback"
|
|
16
|
+
|
|
17
|
+
const ORIGIN_REJECTED = /origin is not allowed|origin_mismatch|unregistered_origin/i
|
|
18
|
+
|
|
19
|
+
function useGsiOriginWatch(onRejected: () => void) {
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (typeof window === "undefined" || window.__vnGsiConsolePatched) return
|
|
22
|
+
window.__vnGsiConsolePatched = true
|
|
23
|
+
const original = console.error
|
|
24
|
+
console.error = (...args: unknown[]) => {
|
|
25
|
+
const text = args.map((a) => (typeof a === "string" ? a : String(a))).join(" ")
|
|
26
|
+
if (text.includes("[GSI_LOGGER]") && ORIGIN_REJECTED.test(text)) {
|
|
27
|
+
onRejected()
|
|
28
|
+
console.warn(...args)
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
original(...args)
|
|
32
|
+
}
|
|
33
|
+
return () => {
|
|
34
|
+
console.error = original
|
|
35
|
+
window.__vnGsiConsolePatched = false
|
|
36
|
+
}
|
|
37
|
+
}, [onRejected])
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare global {
|
|
41
|
+
interface Window {
|
|
42
|
+
__vnGsiConsolePatched?: boolean
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Google Sign-In for Medusa storefronts: GIS "Continue as {email}" button,
|
|
48
|
+
* One Tap prompt, and OAuth redirect fallback (same pattern as VyaparNext deployer).
|
|
49
|
+
*/
|
|
50
|
+
export function GoogleSignInSection({
|
|
51
|
+
countryCode,
|
|
52
|
+
defaultCountryCode = "in",
|
|
53
|
+
enableOneTap = true,
|
|
54
|
+
credentialButtonClassName,
|
|
55
|
+
oauthButtonClassName,
|
|
56
|
+
onError,
|
|
57
|
+
}: {
|
|
58
|
+
countryCode: string
|
|
59
|
+
defaultCountryCode?: string
|
|
60
|
+
enableOneTap?: boolean
|
|
61
|
+
credentialButtonClassName?: string
|
|
62
|
+
oauthButtonClassName?: string
|
|
63
|
+
onError?: (message: string) => void
|
|
64
|
+
}) {
|
|
65
|
+
const clientId = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID?.trim()
|
|
66
|
+
const [gis, setGis] = useState<GisUiState>("loading")
|
|
67
|
+
const [error, setError] = useState<string | null>(null)
|
|
68
|
+
|
|
69
|
+
const handlers = useMemo(
|
|
70
|
+
() => ({
|
|
71
|
+
authenticateCredential: authenticateGoogleCredential,
|
|
72
|
+
handleCustomerCallback: handleGoogleCallback,
|
|
73
|
+
}),
|
|
74
|
+
[]
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
useGsiOriginWatch(() => setGis("fallback"))
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (!clientId || gis === "fallback") return
|
|
81
|
+
const timer = window.setTimeout(() => {
|
|
82
|
+
setGis((s) => (s === "fallback" ? s : "ready"))
|
|
83
|
+
}, 1200)
|
|
84
|
+
return () => window.clearTimeout(timer)
|
|
85
|
+
}, [clientId, gis])
|
|
86
|
+
|
|
87
|
+
if (!clientId) return null
|
|
88
|
+
|
|
89
|
+
const showOAuth = gis !== "ready"
|
|
90
|
+
const showCredential = gis !== "fallback"
|
|
91
|
+
|
|
92
|
+
const reportError = (message: string) => {
|
|
93
|
+
setError(message)
|
|
94
|
+
onError?.(message)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<GoogleAuthProvider clientId={clientId}>
|
|
99
|
+
<GoogleIdentityServicesScript />
|
|
100
|
+
{error ? (
|
|
101
|
+
<p className="mb-3 text-sm text-brand-sale" role="alert">
|
|
102
|
+
{error}
|
|
103
|
+
</p>
|
|
104
|
+
) : null}
|
|
105
|
+
<div className="google-signin-section" data-gis={gis}>
|
|
106
|
+
{showCredential ? (
|
|
107
|
+
<GoogleCredentialButton
|
|
108
|
+
handlers={handlers}
|
|
109
|
+
countryCode={countryCode}
|
|
110
|
+
defaultCountryCode={defaultCountryCode}
|
|
111
|
+
className={credentialButtonClassName}
|
|
112
|
+
onError={(msg) => {
|
|
113
|
+
setGis("fallback")
|
|
114
|
+
reportError(msg)
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
) : null}
|
|
118
|
+
{showOAuth ? (
|
|
119
|
+
<GoogleLoginButton
|
|
120
|
+
countryCode={countryCode}
|
|
121
|
+
defaultCountryCode={defaultCountryCode}
|
|
122
|
+
className={oauthButtonClassName}
|
|
123
|
+
initiateAuth={initiateGoogleAuth}
|
|
124
|
+
/>
|
|
125
|
+
) : null}
|
|
126
|
+
{enableOneTap ? (
|
|
127
|
+
<GoogleOneTapLogin
|
|
128
|
+
handlers={handlers}
|
|
129
|
+
countryCode={countryCode}
|
|
130
|
+
defaultCountryCode={defaultCountryCode}
|
|
131
|
+
useFedcmForPrompt={true}
|
|
132
|
+
onError={(msg) => {
|
|
133
|
+
if (process.env.NODE_ENV === "development") {
|
|
134
|
+
console.info("[One Tap]", msg)
|
|
135
|
+
}
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
) : null}
|
|
139
|
+
</div>
|
|
140
|
+
</GoogleAuthProvider>
|
|
141
|
+
)
|
|
142
|
+
}
|