@pradip1995/segment-login-template 0.5.26 → 0.5.28

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