@pradip1995/segment-login-template 0.5.21 → 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
|
}
|