@pradip1995/segment-login-template 0.5.24 → 0.5.26

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 +54 -54
  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 -142
  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 +158 -158
  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,158 +1,158 @@
1
- "use client"
2
-
3
- import Image from "next/image"
4
- import type { BrandPanelConfig } from "./account-theme"
5
-
6
- type LoginBrandPanelProps = {
7
- panel?: BrandPanelConfig | null
8
- variant?: "desktop" | "mobile"
9
- }
10
-
11
- const PLACEHOLDER =
12
- "data:image/svg+xml," +
13
- encodeURIComponent(
14
- `<svg xmlns="http://www.w3.org/2000/svg" width="800" height="1200" viewBox="0 0 800 1200">
15
- <defs>
16
- <linearGradient id="g" x1="0" y1="0" x2="1" y2="1">
17
- <stop offset="0%" stop-color="#1a1a1a"/>
18
- <stop offset="100%" stop-color="#3d3d3d"/>
19
- </linearGradient>
20
- </defs>
21
- <rect width="800" height="1200" fill="url(#g)"/>
22
- <circle cx="400" cy="520" r="80" fill="none" stroke="#c9a46c" stroke-width="1.5" opacity="0.5"/>
23
- <circle cx="400" cy="520" r="40" fill="#c9a46c" opacity="0.25"/>
24
- </svg>`
25
- )
26
-
27
- export default function LoginBrandPanel({
28
- panel,
29
- variant = "desktop",
30
- }: LoginBrandPanelProps) {
31
- const image = panel?.image || PLACEHOLDER
32
- const headline = panel?.headline || panel?.title
33
- const features = panel?.featureCards?.filter((c) => c.title && c.text) || []
34
-
35
- if (variant === "mobile") {
36
- return (
37
- <div className="relative w-full h-[26vh] min-h-[160px] max-h-[220px] shrink-0 overflow-hidden bg-page-bg lg:hidden">
38
- <Image
39
- src={image}
40
- alt=""
41
- fill
42
- className="object-cover object-center"
43
- sizes="100vw"
44
- priority
45
- unoptimized={image.startsWith("data:")}
46
- />
47
- <div className="absolute inset-0 bg-gradient-to-b from-black/25 via-transparent to-page-bg" />
48
- {(panel?.eyebrow || headline) && (
49
- <div className="absolute inset-x-0 bottom-0 p-5 z-[1]">
50
- {panel?.logo && (
51
- <Image
52
- src={panel.logo}
53
- alt=""
54
- width={140}
55
- height={40}
56
- className="h-8 w-auto object-contain mb-2"
57
- unoptimized
58
- />
59
- )}
60
- {panel?.eyebrow && (
61
- <p className="text-[10px] font-semibold uppercase tracking-[0.28em] text-inverse/80 mb-1">
62
- {panel.eyebrow}
63
- </p>
64
- )}
65
- {headline && (
66
- <p className="font-heading text-lg text-inverse font-bold tracking-wide">
67
- {headline}
68
- </p>
69
- )}
70
- </div>
71
- )}
72
- </div>
73
- )
74
- }
75
-
76
- return (
77
- <div className="relative hidden lg:flex lg:w-1/2 h-full shrink-0 overflow-hidden bg-heading flex-col">
78
- <Image
79
- src={image}
80
- alt=""
81
- fill
82
- className="sr-login-hero object-cover object-center"
83
- sizes="50vw"
84
- priority
85
- unoptimized={image.startsWith("data:")}
86
- />
87
- <div
88
- className="absolute inset-0 bg-gradient-to-t from-black/80 via-black/45 to-black/25"
89
- aria-hidden
90
- />
91
-
92
- <div className="relative z-[1] flex flex-1 flex-col justify-between p-10 xl:p-14 text-inverse">
93
- <div>
94
- {panel?.logo ? (
95
- <Image
96
- src={panel.logo}
97
- alt=""
98
- width={180}
99
- height={48}
100
- className="h-12 w-auto object-contain mb-6"
101
- unoptimized
102
- />
103
- ) : panel?.eyebrow ? (
104
- <p className="text-[10px] font-semibold uppercase tracking-[0.28em] text-inverse/70 mb-3">
105
- {panel.eyebrow}
106
- </p>
107
- ) : null}
108
-
109
- {headline && (
110
- <h2 className="font-heading text-3xl xl:text-4xl font-bold tracking-wide leading-snug">
111
- {headline}
112
- </h2>
113
- )}
114
- {panel?.description && (
115
- <p className="mt-3 text-sm text-inverse/80 leading-relaxed max-w-md">
116
- {panel.description}
117
- </p>
118
- )}
119
- </div>
120
-
121
- {features.length > 0 && (
122
- <div className="mt-8">
123
- {panel?.featuresLabel && (
124
- <p className="text-[10px] font-semibold uppercase tracking-[0.24em] text-inverse/60 mb-4">
125
- {panel.featuresLabel}
126
- </p>
127
- )}
128
- <ul className="space-y-3">
129
- {features.map((card, index) => (
130
- <li key={`${card.title}-${index}`} className="flex gap-3 items-start">
131
- {card.imageSrc ? (
132
- <Image
133
- src={card.imageSrc}
134
- alt=""
135
- width={28}
136
- height={28}
137
- className="mt-0.5 shrink-0"
138
- unoptimized
139
- />
140
- ) : (
141
- <span
142
- className="sr-login-dot mt-1.5 h-2 w-2 rounded-full shrink-0"
143
- aria-hidden
144
- />
145
- )}
146
- <div>
147
- <p className="text-sm font-semibold text-inverse">{card.title}</p>
148
- <p className="text-xs text-inverse/70 mt-0.5">{card.text}</p>
149
- </div>
150
- </li>
151
- ))}
152
- </ul>
153
- </div>
154
- )}
155
- </div>
156
- </div>
157
- )
158
- }
1
+ "use client"
2
+
3
+ import Image from "next/image"
4
+ import type { BrandPanelConfig } from "./account-theme"
5
+
6
+ type LoginBrandPanelProps = {
7
+ panel?: BrandPanelConfig | null
8
+ variant?: "desktop" | "mobile"
9
+ }
10
+
11
+ const PLACEHOLDER =
12
+ "data:image/svg+xml," +
13
+ encodeURIComponent(
14
+ `<svg xmlns="http://www.w3.org/2000/svg" width="800" height="1200" viewBox="0 0 800 1200">
15
+ <defs>
16
+ <linearGradient id="g" x1="0" y1="0" x2="1" y2="1">
17
+ <stop offset="0%" stop-color="#1a1a1a"/>
18
+ <stop offset="100%" stop-color="#3d3d3d"/>
19
+ </linearGradient>
20
+ </defs>
21
+ <rect width="800" height="1200" fill="url(#g)"/>
22
+ <circle cx="400" cy="520" r="80" fill="none" stroke="#c9a46c" stroke-width="1.5" opacity="0.5"/>
23
+ <circle cx="400" cy="520" r="40" fill="#c9a46c" opacity="0.25"/>
24
+ </svg>`
25
+ )
26
+
27
+ export default function LoginBrandPanel({
28
+ panel,
29
+ variant = "desktop",
30
+ }: LoginBrandPanelProps) {
31
+ const image = panel?.image || PLACEHOLDER
32
+ const headline = panel?.headline || panel?.title
33
+ const features = panel?.featureCards?.filter((c) => c.title && c.text) || []
34
+
35
+ if (variant === "mobile") {
36
+ return (
37
+ <div className="relative w-full h-[26vh] min-h-[160px] max-h-[220px] shrink-0 overflow-hidden bg-page-bg lg:hidden">
38
+ <Image
39
+ src={image}
40
+ alt=""
41
+ fill
42
+ className="object-cover object-center"
43
+ sizes="100vw"
44
+ priority
45
+ unoptimized={image.startsWith("data:")}
46
+ />
47
+ <div className="absolute inset-0 bg-gradient-to-b from-black/25 via-transparent to-page-bg" />
48
+ {(panel?.eyebrow || headline) && (
49
+ <div className="absolute inset-x-0 bottom-0 p-5 z-[1]">
50
+ {panel?.logo && (
51
+ <Image
52
+ src={panel.logo}
53
+ alt=""
54
+ width={140}
55
+ height={40}
56
+ className="h-8 w-auto object-contain mb-2"
57
+ unoptimized
58
+ />
59
+ )}
60
+ {panel?.eyebrow && (
61
+ <p className="text-[10px] font-semibold uppercase tracking-[0.28em] text-inverse/80 mb-1">
62
+ {panel.eyebrow}
63
+ </p>
64
+ )}
65
+ {headline && (
66
+ <p className="font-heading text-lg text-inverse font-bold tracking-wide">
67
+ {headline}
68
+ </p>
69
+ )}
70
+ </div>
71
+ )}
72
+ </div>
73
+ )
74
+ }
75
+
76
+ return (
77
+ <div className="relative hidden lg:flex lg:w-1/2 h-full shrink-0 overflow-hidden bg-heading flex-col">
78
+ <Image
79
+ src={image}
80
+ alt=""
81
+ fill
82
+ className="sr-login-hero object-cover object-center"
83
+ sizes="50vw"
84
+ priority
85
+ unoptimized={image.startsWith("data:")}
86
+ />
87
+ <div
88
+ className="absolute inset-0 bg-gradient-to-t from-black/80 via-black/45 to-black/25"
89
+ aria-hidden
90
+ />
91
+
92
+ <div className="relative z-[1] flex flex-1 flex-col justify-between p-10 xl:p-14 text-inverse">
93
+ <div>
94
+ {panel?.logo ? (
95
+ <Image
96
+ src={panel.logo}
97
+ alt=""
98
+ width={180}
99
+ height={48}
100
+ className="h-12 w-auto object-contain mb-6"
101
+ unoptimized
102
+ />
103
+ ) : panel?.eyebrow ? (
104
+ <p className="text-[10px] font-semibold uppercase tracking-[0.28em] text-inverse/70 mb-3">
105
+ {panel.eyebrow}
106
+ </p>
107
+ ) : null}
108
+
109
+ {headline && (
110
+ <h2 className="font-heading text-3xl xl:text-4xl font-bold tracking-wide leading-snug">
111
+ {headline}
112
+ </h2>
113
+ )}
114
+ {panel?.description && (
115
+ <p className="mt-3 text-sm text-inverse/80 leading-relaxed max-w-md">
116
+ {panel.description}
117
+ </p>
118
+ )}
119
+ </div>
120
+
121
+ {features.length > 0 && (
122
+ <div className="mt-8">
123
+ {panel?.featuresLabel && (
124
+ <p className="text-[10px] font-semibold uppercase tracking-[0.24em] text-inverse/60 mb-4">
125
+ {panel.featuresLabel}
126
+ </p>
127
+ )}
128
+ <ul className="space-y-3">
129
+ {features.map((card, index) => (
130
+ <li key={`${card.title}-${index}`} className="flex gap-3 items-start">
131
+ {card.imageSrc ? (
132
+ <Image
133
+ src={card.imageSrc}
134
+ alt=""
135
+ width={28}
136
+ height={28}
137
+ className="mt-0.5 shrink-0"
138
+ unoptimized
139
+ />
140
+ ) : (
141
+ <span
142
+ className="sr-login-dot mt-1.5 h-2 w-2 rounded-full shrink-0"
143
+ aria-hidden
144
+ />
145
+ )}
146
+ <div>
147
+ <p className="text-sm font-semibold text-inverse">{card.title}</p>
148
+ <p className="text-xs text-inverse/70 mt-0.5">{card.text}</p>
149
+ </div>
150
+ </li>
151
+ ))}
152
+ </ul>
153
+ </div>
154
+ )}
155
+ </div>
156
+ </div>
157
+ )
158
+ }