@pradip1995/segment-login-template 0.5.20 → 0.5.22
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.22",
|
|
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
|
],
|
|
@@ -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>
|
|
@@ -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
|
}
|
|
@@ -54,7 +54,7 @@ export default function GoogleAuthSection({ countryCode }: { countryCode: string
|
|
|
54
54
|
type="button"
|
|
55
55
|
onClick={handleClick}
|
|
56
56
|
disabled={loading}
|
|
57
|
-
className={auth.btnOutline}
|
|
57
|
+
className={`${auth.btnOutline} sr-google-btn`}
|
|
58
58
|
aria-label="Continue with Google"
|
|
59
59
|
>
|
|
60
60
|
<svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true">
|
|
@@ -75,7 +75,7 @@ export default function GoogleAuthSection({ countryCode }: { countryCode: string
|
|
|
75
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
76
|
/>
|
|
77
77
|
</svg>
|
|
78
|
-
<span className="
|
|
78
|
+
<span className="sr-google-btn__label">
|
|
79
79
|
{loading ? "Redirecting…" : "Continue with Google"}
|
|
80
80
|
</span>
|
|
81
81
|
</button>
|
|
@@ -79,7 +79,7 @@ export default function LoginBrandPanel({
|
|
|
79
79
|
src={image}
|
|
80
80
|
alt=""
|
|
81
81
|
fill
|
|
82
|
-
className="object-cover object-center"
|
|
82
|
+
className="sr-login-hero object-cover object-center"
|
|
83
83
|
sizes="50vw"
|
|
84
84
|
priority
|
|
85
85
|
unoptimized={image.startsWith("data:")}
|
|
@@ -139,7 +139,7 @@ export default function LoginBrandPanel({
|
|
|
139
139
|
/>
|
|
140
140
|
) : (
|
|
141
141
|
<span
|
|
142
|
-
className="mt-1.5 h-2 w-2 rounded-full
|
|
142
|
+
className="sr-login-dot mt-1.5 h-2 w-2 rounded-full shrink-0"
|
|
143
143
|
aria-hidden
|
|
144
144
|
/>
|
|
145
145
|
)}
|