@pradip1995/segment-login-template 0.5.25 → 0.5.27

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.
Files changed (38) hide show
  1. package/package.json +2 -2
  2. package/src/account-addresses.tsx +287 -287
  3. package/src/account-guest-orders.tsx +98 -98
  4. package/src/account-orders.tsx +260 -260
  5. package/src/account-overview.tsx +133 -133
  6. package/src/account-payment-methods.tsx +328 -328
  7. package/src/account-profile-logic.ts +282 -282
  8. package/src/account-profile.tsx +111 -111
  9. package/src/account-theme.ts +91 -91
  10. package/src/account-utils.ts +20 -20
  11. package/src/auth-server.ts +442 -442
  12. package/src/commerce-auth-otp-modal.css +125 -125
  13. package/src/commerce-auth-otp-modal.tsx +121 -121
  14. package/src/forgot-password-form.tsx +109 -109
  15. package/src/google-auth-section.tsx +22 -22
  16. package/src/google-sign-in-section.tsx +67 -67
  17. package/src/guest-order-modal.tsx +215 -215
  18. package/src/index.ts +7 -7
  19. package/src/is-next-redirect.ts +60 -60
  20. package/src/login-brand-panel.tsx +6 -5
  21. package/src/login-form.tsx +469 -469
  22. package/src/manifest.ts +11 -11
  23. package/src/order-history-status.test.ts +224 -224
  24. package/src/order-history-status.ts +244 -244
  25. package/src/otp-component.ts +14 -14
  26. package/src/otp-input.tsx +46 -46
  27. package/src/otp-unified-form.tsx +333 -333
  28. package/src/otp-verification-modal.tsx +112 -112
  29. package/src/payment-methods-actions.ts +243 -243
  30. package/src/profile-email-field.tsx +116 -116
  31. package/src/profile-email.test.ts +182 -182
  32. package/src/profile-email.ts +54 -54
  33. package/src/profile-phone-field.tsx +119 -119
  34. package/src/register-form.tsx +339 -339
  35. package/src/reorder-checkout-address.ts +101 -101
  36. package/src/reset-password-form.tsx +103 -103
  37. package/src/reset-password-page.tsx +12 -12
  38. package/src/segment.tsx +272 -272
@@ -1,112 +1,112 @@
1
- "use client"
2
-
3
- import OtpInput from "./otp-input"
4
-
5
- export type OtpVerificationModalProps = {
6
- open: boolean
7
- title: string
8
- description: string
9
- otp: string
10
- onOtpChange: (value: string) => void
11
- error: string | null
12
- pending: boolean
13
- success?: boolean
14
- successTitle?: string
15
- successMessage?: string
16
- verifyLabel?: string
17
- onVerify: () => void
18
- onResend: () => void
19
- onClose?: () => void
20
- /** When true, backdrop click does not dismiss the modal (registration OTP). */
21
- preventClose?: boolean
22
- extraContent?: React.ReactNode
23
- }
24
-
25
- export default function OtpVerificationModal({
26
- open,
27
- title,
28
- description,
29
- otp,
30
- onOtpChange,
31
- error,
32
- pending,
33
- success = false,
34
- successTitle = "Verified",
35
- successMessage = "Redirecting you…",
36
- verifyLabel = "Verify & continue",
37
- onVerify,
38
- onResend,
39
- onClose,
40
- preventClose = false,
41
- extraContent,
42
- }: OtpVerificationModalProps) {
43
- if (!open) return null
44
-
45
- function handleBackdropClick() {
46
- if (preventClose || pending || success) return
47
- onClose?.()
48
- }
49
-
50
- return (
51
- <div className="fixed inset-0 z-50 flex items-center justify-center p-4">
52
- <button
53
- type="button"
54
- className="absolute inset-0 bg-black/40"
55
- aria-label="Close verification dialog"
56
- onClick={handleBackdropClick}
57
- />
58
- <div className="relative w-full max-w-md rounded-2xl bg-page-bg border border-cart-border shadow-xl p-6">
59
- {success ? (
60
- <div className="text-center space-y-4 py-4">
61
- <div className="w-14 h-14 mx-auto rounded-full bg-green-100 flex items-center justify-center text-2xl text-green-600">
62
- ✓
63
- </div>
64
- <h2 className="section-heading text-lg">{successTitle}</h2>
65
- <p className="text-sm text-muted">{successMessage}</p>
66
- </div>
67
- ) : (
68
- <>
69
- <h2 className="section-heading text-lg text-center mb-2">{title}</h2>
70
- <p className="text-sm text-muted text-center mb-6">{description}</p>
71
-
72
- {extraContent}
73
-
74
- <div className="mb-6">
75
- <OtpInput value={otp} onChange={onOtpChange} autoFocus />
76
- </div>
77
-
78
- {error && (
79
- <p className="text-sm text-brand-sale text-center mb-4" role="alert">
80
- {error}
81
- </p>
82
- )}
83
-
84
- <button
85
- type="button"
86
- onClick={onVerify}
87
- disabled={pending || otp.length < 6}
88
- className="btn-primary w-full disabled:opacity-60 mb-3"
89
- >
90
- {pending ? "Verifying…" : verifyLabel}
91
- </button>
92
-
93
- <button
94
- type="button"
95
- onClick={onResend}
96
- disabled={pending}
97
- className="text-sm text-muted hover:text-brand-accent w-full text-center disabled:opacity-60"
98
- >
99
- Didn&apos;t receive the code? Resend
100
- </button>
101
-
102
- {preventClose && (
103
- <p className="text-xs text-muted text-center mt-4">
104
- Verification is required to complete {verifyLabel.includes("sign in") ? "sign in" : "registration"}.
105
- </p>
106
- )}
107
- </>
108
- )}
109
- </div>
110
- </div>
111
- )
112
- }
1
+ "use client"
2
+
3
+ import OtpInput from "./otp-input"
4
+
5
+ export type OtpVerificationModalProps = {
6
+ open: boolean
7
+ title: string
8
+ description: string
9
+ otp: string
10
+ onOtpChange: (value: string) => void
11
+ error: string | null
12
+ pending: boolean
13
+ success?: boolean
14
+ successTitle?: string
15
+ successMessage?: string
16
+ verifyLabel?: string
17
+ onVerify: () => void
18
+ onResend: () => void
19
+ onClose?: () => void
20
+ /** When true, backdrop click does not dismiss the modal (registration OTP). */
21
+ preventClose?: boolean
22
+ extraContent?: React.ReactNode
23
+ }
24
+
25
+ export default function OtpVerificationModal({
26
+ open,
27
+ title,
28
+ description,
29
+ otp,
30
+ onOtpChange,
31
+ error,
32
+ pending,
33
+ success = false,
34
+ successTitle = "Verified",
35
+ successMessage = "Redirecting you…",
36
+ verifyLabel = "Verify & continue",
37
+ onVerify,
38
+ onResend,
39
+ onClose,
40
+ preventClose = false,
41
+ extraContent,
42
+ }: OtpVerificationModalProps) {
43
+ if (!open) return null
44
+
45
+ function handleBackdropClick() {
46
+ if (preventClose || pending || success) return
47
+ onClose?.()
48
+ }
49
+
50
+ return (
51
+ <div className="fixed inset-0 z-50 flex items-center justify-center p-4">
52
+ <button
53
+ type="button"
54
+ className="absolute inset-0 bg-black/40"
55
+ aria-label="Close verification dialog"
56
+ onClick={handleBackdropClick}
57
+ />
58
+ <div className="relative w-full max-w-md rounded-2xl bg-page-bg border border-cart-border shadow-xl p-6">
59
+ {success ? (
60
+ <div className="text-center space-y-4 py-4">
61
+ <div className="w-14 h-14 mx-auto rounded-full bg-green-100 flex items-center justify-center text-2xl text-green-600">
62
+ ✓
63
+ </div>
64
+ <h2 className="section-heading text-lg">{successTitle}</h2>
65
+ <p className="text-sm text-muted">{successMessage}</p>
66
+ </div>
67
+ ) : (
68
+ <>
69
+ <h2 className="section-heading text-lg text-center mb-2">{title}</h2>
70
+ <p className="text-sm text-muted text-center mb-6">{description}</p>
71
+
72
+ {extraContent}
73
+
74
+ <div className="mb-6">
75
+ <OtpInput value={otp} onChange={onOtpChange} autoFocus />
76
+ </div>
77
+
78
+ {error && (
79
+ <p className="text-sm text-brand-sale text-center mb-4" role="alert">
80
+ {error}
81
+ </p>
82
+ )}
83
+
84
+ <button
85
+ type="button"
86
+ onClick={onVerify}
87
+ disabled={pending || otp.length < 6}
88
+ className="btn-primary w-full disabled:opacity-60 mb-3"
89
+ >
90
+ {pending ? "Verifying…" : verifyLabel}
91
+ </button>
92
+
93
+ <button
94
+ type="button"
95
+ onClick={onResend}
96
+ disabled={pending}
97
+ className="text-sm text-muted hover:text-brand-accent w-full text-center disabled:opacity-60"
98
+ >
99
+ Didn&apos;t receive the code? Resend
100
+ </button>
101
+
102
+ {preventClose && (
103
+ <p className="text-xs text-muted text-center mt-4">
104
+ Verification is required to complete {verifyLabel.includes("sign in") ? "sign in" : "registration"}.
105
+ </p>
106
+ )}
107
+ </>
108
+ )}
109
+ </div>
110
+ </div>
111
+ )
112
+ }