@pradip1995/segment-jewelry-account-pages 0.1.6 → 0.1.8

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@pradip1995/segment-jewelry-account-pages",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,6 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import { useActionState, useEffect, useState, type ReactNode } from "react"
4
+ import { createPortal } from "react-dom"
4
5
  import type { HttpTypes } from "@medusajs/types"
5
6
  import {
6
7
  addCustomerAddress,
@@ -100,7 +101,7 @@ export default function ModernAccountAddresses({
100
101
  fontWeight: 700,
101
102
  letterSpacing: "0.1em",
102
103
  textTransform: "uppercase",
103
- backgroundColor: "#3e3053",
104
+ backgroundColor: "#13264d",
104
105
  color: "#ffffff",
105
106
  }}
106
107
  >
@@ -150,22 +151,11 @@ export default function ModernAccountAddresses({
150
151
  <div style={{ display: "flex", gap: "0.65rem", marginTop: "1rem", flexWrap: "wrap" }}>
151
152
  <button
152
153
  type="button"
154
+ className="modern-address-edit"
153
155
  onClick={() => {
154
156
  setShowAdd(false)
155
157
  setEditingId(address.id!)
156
158
  }}
157
- style={{
158
- padding: "0.45rem 1.25rem",
159
- borderRadius: "999px",
160
- fontSize: "0.72rem",
161
- fontWeight: 700,
162
- letterSpacing: "0.08em",
163
- textTransform: "uppercase",
164
- backgroundColor: "#3e3053",
165
- color: "#ffffff",
166
- border: "none",
167
- cursor: "pointer",
168
- }}
169
159
  >
170
160
  EDIT
171
161
  </button>
@@ -448,39 +438,69 @@ function MakeDefaultButton({ addressId }: { addressId: string }) {
448
438
 
449
439
  function DeleteAddressButton({ addressId }: { addressId: string }) {
450
440
  const [pending, setPending] = useState(false)
441
+ const [confirmOpen, setConfirmOpen] = useState(false)
442
+ const [error, setError] = useState("")
451
443
 
452
444
  async function handleDelete() {
453
- if (!confirm("Are you sure you want to remove this address?")) return
454
445
  setPending(true)
446
+ setError("")
455
447
  try {
456
448
  await deleteCustomerAddress(addressId)
457
449
  window.location.reload()
458
- } finally {
450
+ } catch (deleteError) {
451
+ setError(deleteError instanceof Error ? deleteError.message : "Could not remove this address.")
459
452
  setPending(false)
460
453
  }
461
454
  }
462
455
 
463
456
  return (
464
- <button
465
- type="button"
466
- onClick={handleDelete}
467
- disabled={pending}
468
- style={{
469
- padding: "0.45rem 1.25rem",
470
- borderRadius: "999px",
471
- fontSize: "0.72rem",
472
- fontWeight: 700,
473
- letterSpacing: "0.08em",
474
- textTransform: "uppercase",
475
- backgroundColor: "#ffffff",
476
- color: "#dc2626",
477
- border: "1px solid #dc2626",
478
- cursor: "pointer",
479
- }}
480
- aria-label="Remove address"
481
- >
482
- {pending ? "…" : "REMOVE"}
483
- </button>
457
+ <>
458
+ <button
459
+ type="button"
460
+ onClick={() => setConfirmOpen(true)}
461
+ disabled={pending}
462
+ style={{
463
+ padding: "0.45rem 1.25rem",
464
+ borderRadius: "999px",
465
+ fontSize: "0.72rem",
466
+ fontWeight: 700,
467
+ letterSpacing: "0.08em",
468
+ textTransform: "uppercase",
469
+ backgroundColor: "#ffffff",
470
+ color: "#dc2626",
471
+ border: "1px solid #dc2626",
472
+ cursor: "pointer",
473
+ }}
474
+ aria-label="Remove address"
475
+ >
476
+ {pending ? "…" : "Remove"}
477
+ </button>
478
+ {error ? <p style={{ color: "#dc2626", fontSize: "0.75rem", margin: "0.2rem 0 0" }}>{error}</p> : null}
479
+ {confirmOpen
480
+ ? createPortal(
481
+ <div className="modern-modal-backdrop" role="presentation">
482
+ <div
483
+ className="modern-address-confirm"
484
+ role="dialog"
485
+ aria-modal="true"
486
+ aria-labelledby="remove-address-title"
487
+ >
488
+ <h2 id="remove-address-title">Remove this address?</h2>
489
+ <p>This delivery address will be deleted from your account.</p>
490
+ <div className="modern-address-confirm__actions">
491
+ <button type="button" onClick={() => setConfirmOpen(false)} disabled={pending}>
492
+ Cancel
493
+ </button>
494
+ <button type="button" className="is-danger" onClick={handleDelete} disabled={pending}>
495
+ {pending ? "Removing…" : "Remove"}
496
+ </button>
497
+ </div>
498
+ </div>
499
+ </div>,
500
+ document.body
501
+ )
502
+ : null}
503
+ </>
484
504
  )
485
505
  }
486
506
 
@@ -4,6 +4,7 @@ import Image from "next/image"
4
4
  import type { HttpTypes } from "@medusajs/types"
5
5
  import LocalizedLink from "@pradip1995/segment-primitives/localized-link"
6
6
  import { formatPrice } from "@pradip1995/segment-primitives/format-price"
7
+ import { presentOrderLines } from "@pradip1995/segment-primitives/order-lines"
7
8
  import {
8
9
  resolveOrderHistoryStatus,
9
10
  type OrderHistoryStatusInput,
@@ -91,7 +92,8 @@ export default function ModernAccountOrderCard({
91
92
  }) {
92
93
  const currency = order.currency_code
93
94
  const statusInfo = getStatusDetails(order)
94
- const items = order.items || []
95
+ const presentation = presentOrderLines(order)
96
+ const items = presentation.purchasedItems
95
97
 
96
98
  const dateStr = order.created_at
97
99
  ? new Date(order.created_at).toLocaleDateString("en-US", {
@@ -120,7 +122,7 @@ export default function ModernAccountOrderCard({
120
122
  <div className="modern-order-row__col">
121
123
  <p className="modern-order-row__label">Total amount</p>
122
124
  <p className="modern-order-row__val modern-order-row__val--price">
123
- {formatPrice(order.total, currency)}
125
+ {formatPrice(presentation.paidTotal, currency)}
124
126
  </p>
125
127
  </div>
126
128
 
@@ -191,10 +193,12 @@ export default function ModernAccountOrderCard({
191
193
  </div>
192
194
  <div className="modern-order-card__item-info">
193
195
  <p className="modern-order-card__item-name">{itemTitle(item)}</p>
194
- {item.variant_title && item.variant_title.toLowerCase() !== "default" ? (
195
- <p className="modern-order-card__item-meta">{item.variant_title}</p>
196
- ) : null}
197
- <p className="modern-order-card__item-meta">Qty: {item.quantity}</p>
196
+ <p className="modern-order-card__item-meta">
197
+ {item.variant_title && item.variant_title.toLowerCase() !== "default"
198
+ ? `${item.variant_title} · `
199
+ : null}
200
+ Qty: {item.quantity}
201
+ </p>
198
202
  </div>
199
203
  <p className="modern-order-card__item-price">
200
204
  {formatPrice(itemTotal(item), currency)}
@@ -208,7 +212,7 @@ export default function ModernAccountOrderCard({
208
212
  <div className="modern-order-card__foot">
209
213
  <div>
210
214
  <span className="modern-order-card__label">Total Amount</span>
211
- <p className="modern-order-card__total-val">{formatPrice(order.total, currency)}</p>
215
+ <p className="modern-order-card__total-val">{formatPrice(presentation.paidTotal, currency)}</p>
212
216
  </div>
213
217
  <LocalizedLink href={`/orders/${order.id}`} className="modern-btn modern-btn--outline">
214
218
  View Order Details →
@@ -37,7 +37,7 @@ export default function ModernAccountOverview({
37
37
  <LocalizedLink
38
38
  href="/account/profile"
39
39
  className="modern-btn modern-btn--outline"
40
- style={{ background: "#ffffff", borderColor: "#ffffff", color: "#3e3053" }}
40
+ style={{ background: "#ffffff", borderColor: "#ffffff", color: "#13264d" }}
41
41
  >
42
42
  Account Details
43
43
  </LocalizedLink>
@@ -23,8 +23,7 @@ import {
23
23
  EMAIL_OTP_ERRORS,
24
24
  PHONE_OTP_ERRORS,
25
25
  isValidEmail,
26
- normalizeEmail,
27
- phoneDigits,
26
+ isContactStatusVerified,
28
27
  resolveEmailOtpFlow,
29
28
  resolvePhoneOtpFlow,
30
29
  verifiedFieldAction,
@@ -150,15 +149,11 @@ export default function ModernAccountProfile({
150
149
  try {
151
150
  const fullName = String(formData.get("full_name") || "").trim()
152
151
  const [first_name, ...rest] = fullName.split(/\s+/)
153
- const e164 = normalizeIndianPhone(phone)
152
+ // Phone/email only change via OTP contact endpoints — never PATCH them here.
154
153
  await updateCustomer({
155
154
  first_name: first_name || "",
156
155
  last_name: rest.join(" ") || ".",
157
- phone: e164 || undefined,
158
156
  })
159
- if (e164 && phoneDigits(e164) !== phoneDigits(customer.phone || "")) {
160
- setPhoneVerified(false)
161
- }
162
157
  return { ok: true, error: null }
163
158
  } catch (err) {
164
159
  if (isNextRedirect(err)) throw err
@@ -189,30 +184,6 @@ export default function ModernAccountProfile({
189
184
  ready: emailReady,
190
185
  })
191
186
 
192
- async function ensurePhoneSavedForVerification(): Promise<boolean> {
193
- setPhoneError(null)
194
- if (!phoneReady) {
195
- setPhoneError(PHONE_OTP_ERRORS.empty)
196
- return false
197
- }
198
-
199
- const e164 = normalizeIndianPhone(phone)
200
- if (phoneDigits(e164) === phoneDigits(customer.phone || "")) {
201
- return true
202
- }
203
-
204
- try {
205
- await updateCustomer({ phone: e164 })
206
- return true
207
- } catch (err) {
208
- if (isNextRedirect(err)) throw err
209
- setPhoneError(
210
- safeErrorMessage(err, "Failed to save mobile number. Please try again.")
211
- )
212
- return false
213
- }
214
- }
215
-
216
187
  async function sendVerifyOtp(type: "email_verification" | "phone_verification") {
217
188
  setOtpType(type)
218
189
  setOtpPending(true)
@@ -230,14 +201,10 @@ export default function ModernAccountProfile({
230
201
  return
231
202
  }
232
203
  setOtpFlow(resolved.flow)
233
- let res
234
- if (resolved.flow === "change_contact") {
235
- res = await requestContactChange({ phone: resolved.phone })
236
- } else {
237
- const saved = await ensurePhoneSavedForVerification()
238
- if (!saved) return
239
- res = await sendRegistrationOtp(customer.id, type)
240
- }
204
+ const res =
205
+ resolved.flow === "change_contact"
206
+ ? await requestContactChange({ phone: resolved.phone })
207
+ : await sendRegistrationOtp(customer.id, type)
241
208
  if (!res.success) throw new Error(res.error || "Failed to send code")
242
209
  setOtpToken(res.token ?? null)
243
210
  setOtp("")
@@ -314,27 +281,38 @@ export default function ModernAccountProfile({
314
281
  function handlePhoneChange(value: string) {
315
282
  setPhone(value)
316
283
  setPhoneError(null)
317
- const next = normalizeIndianPhone(value)
318
- if (next && phoneDigits(next) !== phoneDigits(customer.phone || "")) {
319
- setPhoneVerified(false)
320
- } else {
321
- setPhoneVerified(readVerified(customer, "phone_verified"))
322
- }
284
+ // Any edit clears verified UI until OTP succeeds — never restore from server mid-edit.
285
+ setPhoneVerified(false)
323
286
  }
324
287
 
325
288
  function handleEmailChange(value: string) {
326
289
  setEmail(value)
327
290
  setEmailError(null)
328
- if (normalizeEmail(value) !== normalizeEmail(customer.email)) {
329
- setEmailVerified(false)
330
- } else {
331
- setEmailVerified(readVerified(customer, "email_verified"))
332
- }
291
+ setEmailVerified(false)
292
+ }
293
+
294
+ function startEditingPhone() {
295
+ setEditingPhone(true)
296
+ setPhoneVerified(false)
297
+ setPhoneError(null)
298
+ }
299
+
300
+ function startEditingEmail() {
301
+ setEditingEmail(true)
302
+ setEmailVerified(false)
303
+ setEmailError(null)
333
304
  }
334
305
 
335
306
  const fullName = [customer.first_name, customer.last_name].filter(Boolean).join(" ")
336
307
  const initials = getInitials(fullName || customer.email)
337
- const mobileVerified = phoneVerified && Boolean(customer.phone || phoneReady)
308
+ const mobileVerified = isContactStatusVerified({
309
+ verified: phoneVerified && Boolean(customer.phone || phoneReady),
310
+ editing: editingPhone,
311
+ })
312
+ const emailStatusVerified = isContactStatusVerified({
313
+ verified: emailVerified,
314
+ editing: editingEmail,
315
+ })
338
316
  const otpTarget =
339
317
  otpType === "email_verification" ? email || "email" : phone || "phone"
340
318
 
@@ -357,9 +335,9 @@ export default function ModernAccountProfile({
357
335
  {mobileVerified ? "Mobile Verified" : "Mobile Unverified"}
358
336
  </span>
359
337
 
360
- <span className={`modern-status-dot-pill ${emailVerified ? "is-verified" : "is-unverified"}`}>
338
+ <span className={`modern-status-dot-pill ${emailStatusVerified ? "is-verified" : "is-unverified"}`}>
361
339
  <span className="modern-status-dot" />
362
- {emailVerified ? "Email Verified" : "Email Unverified"}
340
+ {emailStatusVerified ? "Email Verified" : "Email Unverified"}
363
341
  </span>
364
342
  </div>
365
343
  </div>
@@ -408,7 +386,7 @@ export default function ModernAccountProfile({
408
386
  verifyAriaLabel="Verify mobile number"
409
387
  editAriaLabel="Edit mobile number"
410
388
  onVerify={() => sendVerifyOtp("phone_verification")}
411
- onEdit={() => setEditingPhone(true)}
389
+ onEdit={startEditingPhone}
412
390
  />
413
391
  </div>
414
392
  {phoneError ? (
@@ -448,9 +426,9 @@ export default function ModernAccountProfile({
448
426
  verifyLabel="Verify Email"
449
427
  verifyAriaLabel="Verify email"
450
428
  editAriaLabel="Edit email"
451
- onVerify={() => sendVerifyOtp("email_verification")}
452
- onEdit={() => setEditingEmail(true)}
453
- />
429
+ onVerify={() => sendVerifyOtp("email_verification")}
430
+ onEdit={startEditingEmail}
431
+ />
454
432
  </div>
455
433
  {emailError ? (
456
434
  <p role="alert" className="modern-field-hint modern-field-hint--error">
@@ -1,14 +1,14 @@
1
1
  /* Luxury Modern Account Page CSS */
2
2
 
3
3
  .modern-account-page {
4
- --lux-onyx: #18141d;
5
- --lux-plum: #3e3053;
6
- --lux-plum-light: #52426c;
7
- --lux-gold: #b89759;
8
- --lux-gold-soft: #fbf7ef;
9
- --lux-muted: #6c6575;
10
- --lux-border: rgba(24, 20, 29, 0.09);
11
- --lux-bg: #faf8f5;
4
+ --lux-onyx: #0a0a0a;
5
+ --lux-plum: #13264d;
6
+ --lux-plum-light: #1c3a70;
7
+ --lux-gold: #c9a86c;
8
+ --lux-gold-soft: #ebf3f6;
9
+ --lux-muted: #737373;
10
+ --lux-border: rgba(19, 38, 77, 0.1);
11
+ --lux-bg: #faf7f5;
12
12
  --lux-shadow: 0 4px 20px -2px rgba(24, 20, 29, 0.04);
13
13
  display: flex;
14
14
  flex-direction: column;
@@ -57,7 +57,7 @@
57
57
  padding: 1.4rem 1.6rem;
58
58
  border-radius: 0.85rem;
59
59
  background: #f7f4f0;
60
- border: 1px solid rgba(62, 48, 83, 0.08);
60
+ border: 1px solid rgba(19, 38, 77, 0.08);
61
61
  }
62
62
 
63
63
  .modern-profile-banner__avatar-wrap {
@@ -77,7 +77,7 @@
77
77
  font-family: var(--font-heading, "Cormorant Garamond", Georgia, serif);
78
78
  font-size: 1.65rem;
79
79
  font-weight: 600;
80
- box-shadow: 0 4px 12px -2px rgba(62, 48, 83, 0.25);
80
+ box-shadow: 0 4px 12px -2px rgba(19, 38, 77, 0.25);
81
81
  }
82
82
 
83
83
  .modern-profile-banner__edit-badge {
@@ -247,11 +247,11 @@
247
247
  gap: 1.25rem;
248
248
  padding: 1.85rem 2.25rem;
249
249
  border-radius: 0.85rem;
250
- background: linear-gradient(135deg, rgba(62, 48, 83, 0.92) 0%, rgba(30, 20, 45, 0.96) 100%), url("/jewelry_account_welcome_bg.png");
250
+ background: linear-gradient(135deg, rgba(19, 38, 77, 0.82) 0%, rgba(15, 28, 54, 0.88) 100%), url("/jewelry_account_welcome_bg.png");
251
251
  background-size: cover;
252
252
  background-position: center;
253
253
  color: #ffffff;
254
- box-shadow: 0 8px 24px -4px rgba(30, 20, 45, 0.3);
254
+ box-shadow: 0 8px 24px -4px rgba(19, 38, 77, 0.28);
255
255
  overflow: hidden;
256
256
  border: 1px solid rgba(255, 255, 255, 0.12);
257
257
  }
@@ -302,7 +302,7 @@
302
302
 
303
303
  .modern-account-stat-card:hover {
304
304
  transform: translateY(-2px);
305
- border-color: rgba(62, 48, 83, 0.25);
305
+ border-color: rgba(19, 38, 77, 0.25);
306
306
  box-shadow: 0 10px 24px -4px rgba(24, 20, 29, 0.08);
307
307
  }
308
308
 
@@ -354,7 +354,7 @@
354
354
  width: 100%;
355
355
  height: 4px;
356
356
  border-radius: 999px;
357
- background: #f0ecf4;
357
+ background: #ebf3f6;
358
358
  overflow: hidden;
359
359
  margin-top: 0.2rem;
360
360
  }
@@ -435,7 +435,7 @@
435
435
  }
436
436
 
437
437
  .modern-order-row:hover {
438
- border-color: rgba(62, 48, 83, 0.25);
438
+ border-color: rgba(19, 38, 77, 0.25);
439
439
  box-shadow: 0 8px 24px -4px rgba(24, 20, 29, 0.08);
440
440
  }
441
441
 
@@ -526,6 +526,8 @@
526
526
  display: flex;
527
527
  flex-direction: column;
528
528
  gap: 1.15rem;
529
+ min-width: 0;
530
+ max-width: 100%;
529
531
  padding: 1.4rem 1.6rem;
530
532
  border: 1px solid var(--lux-border);
531
533
  border-radius: 0.85rem;
@@ -535,7 +537,7 @@
535
537
  }
536
538
 
537
539
  .modern-order-card:hover {
538
- border-color: rgba(62, 48, 83, 0.25);
540
+ border-color: rgba(19, 38, 77, 0.25);
539
541
  box-shadow: 0 8px 24px -4px rgba(24, 20, 29, 0.08);
540
542
  }
541
543
 
@@ -589,9 +591,12 @@
589
591
  }
590
592
 
591
593
  .modern-order-card__item {
592
- display: flex;
594
+ display: grid;
595
+ grid-template-columns: 4.5rem minmax(0, 1fr) auto;
593
596
  align-items: center;
594
- gap: 1rem;
597
+ column-gap: 1rem;
598
+ row-gap: 0.35rem;
599
+ min-width: 0;
595
600
  }
596
601
 
597
602
  .modern-order-card__item-photo {
@@ -618,7 +623,6 @@
618
623
 
619
624
  .modern-order-card__item-info {
620
625
  min-width: 0;
621
- flex: 1;
622
626
  }
623
627
 
624
628
  .modern-order-card__item-name {
@@ -631,17 +635,22 @@
631
635
  -webkit-line-clamp: 2;
632
636
  -webkit-box-orient: vertical;
633
637
  overflow: hidden;
638
+ overflow-wrap: break-word;
634
639
  }
635
640
 
636
641
  .modern-order-card__item-meta {
637
642
  margin: 0.2rem 0 0;
638
643
  font-size: 0.78125rem;
644
+ line-height: 1.4;
639
645
  color: var(--lux-muted);
646
+ overflow-wrap: break-word;
640
647
  }
641
648
 
642
649
  .modern-order-card__item-price {
643
650
  margin: 0;
644
- flex-shrink: 0;
651
+ justify-self: end;
652
+ text-align: right;
653
+ white-space: nowrap;
645
654
  font-family: var(--font-heading, "Cormorant Garamond", Georgia, serif);
646
655
  font-size: 1.15rem;
647
656
  font-weight: 600;
@@ -650,9 +659,11 @@
650
659
 
651
660
  .modern-order-card__foot {
652
661
  display: flex;
662
+ flex-wrap: wrap;
653
663
  align-items: center;
654
664
  justify-content: space-between;
655
665
  gap: 1rem;
666
+ min-width: 0;
656
667
  }
657
668
 
658
669
  .modern-order-card__total-val {
@@ -708,7 +719,7 @@
708
719
  .modern-search-input:focus {
709
720
  outline: none;
710
721
  border-color: var(--lux-plum);
711
- box-shadow: 0 0 0 3px rgba(62, 48, 83, 0.1);
722
+ box-shadow: 0 0 0 3px rgba(19, 38, 77, 0.1);
712
723
  }
713
724
 
714
725
  .modern-field__input[readonly],
@@ -740,7 +751,26 @@
740
751
  color: #b91c1c;
741
752
  }
742
753
 
743
- /* Buttons */
754
+ .modern-address-edit {
755
+ min-height: 2.4rem;
756
+ padding: 0.45rem 1.25rem;
757
+ border: 1px solid #13264d;
758
+ border-radius: 999px;
759
+ background: #13264d;
760
+ color: #ffffff;
761
+ font-size: 0.72rem;
762
+ font-weight: 700;
763
+ letter-spacing: 0.08em;
764
+ text-transform: uppercase;
765
+ cursor: pointer;
766
+ transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
767
+ }
768
+
769
+ .modern-address-edit:hover {
770
+ background: #ebf3f6;
771
+ border-color: #c5d4e0;
772
+ color: #13264d;
773
+ }
744
774
  .modern-btn {
745
775
  display: inline-flex;
746
776
  align-items: center;
@@ -799,7 +829,7 @@
799
829
  }
800
830
 
801
831
  .modern-address-type__option input:focus-visible + span {
802
- box-shadow: 0 0 0 3px rgba(62, 48, 83, 0.18);
832
+ box-shadow: 0 0 0 3px rgba(19, 38, 77, 0.18);
803
833
  }
804
834
 
805
835
  .modern-address-type__option input:checked + span {
@@ -809,7 +839,7 @@
809
839
  }
810
840
 
811
841
  .modern-btn--primary:hover:not(:disabled) {
812
- background: #2d223f;
842
+ background: #1c3a70;
813
843
  }
814
844
 
815
845
  .modern-btn--outline {
@@ -844,7 +874,61 @@
844
874
  cursor: not-allowed;
845
875
  }
846
876
 
847
- /* Modals */
877
+ .modern-address-confirm {
878
+ width: min(100%, 22rem);
879
+ padding: 1.35rem 1.2rem 1.15rem;
880
+ border: 1px solid var(--lux-border);
881
+ border-radius: 1rem;
882
+ background: #ffffff;
883
+ box-shadow: 0 18px 40px rgba(19, 38, 77, 0.18);
884
+ text-align: center;
885
+ }
886
+
887
+ .modern-address-confirm h2 {
888
+ margin: 0;
889
+ font-family: var(--font-heading, Georgia, serif);
890
+ font-size: 1.45rem;
891
+ font-weight: 500;
892
+ color: #0a0a0a;
893
+ }
894
+
895
+ .modern-address-confirm p {
896
+ margin: 0.55rem 0 0;
897
+ font-size: 0.9rem;
898
+ line-height: 1.5;
899
+ color: #5c6570;
900
+ }
901
+
902
+ .modern-address-confirm__actions {
903
+ display: flex;
904
+ gap: 0.6rem;
905
+ margin-top: 1.15rem;
906
+ }
907
+
908
+ .modern-address-confirm__actions button {
909
+ flex: 1;
910
+ min-height: 2.6rem;
911
+ border-radius: 999px;
912
+ border: 1px solid #13264d;
913
+ background: #ffffff;
914
+ color: #13264d;
915
+ font-size: 0.75rem;
916
+ font-weight: 700;
917
+ letter-spacing: 0.08em;
918
+ text-transform: uppercase;
919
+ cursor: pointer;
920
+ }
921
+
922
+ .modern-address-confirm__actions button.is-danger {
923
+ border-color: #b42318;
924
+ background: #b42318;
925
+ color: #ffffff;
926
+ }
927
+
928
+ .modern-address-confirm__actions button:disabled {
929
+ opacity: 0.6;
930
+ cursor: not-allowed;
931
+ }
848
932
  .modern-modal-backdrop {
849
933
  position: fixed;
850
934
  inset: 0;
@@ -902,7 +986,7 @@
902
986
  border: 1px solid rgba(21, 128, 61, 0.2);
903
987
  }
904
988
 
905
- @media (max-width: 768px) {
989
+ @media (max-width: 1100px) {
906
990
  .modern-order-row {
907
991
  grid-template-columns: 1fr 1fr;
908
992
  gap: 1rem;
@@ -912,3 +996,104 @@
912
996
  display: none;
913
997
  }
914
998
  }
999
+
1000
+ @media (max-width: 640px) {
1001
+ .modern-account-welcome {
1002
+ flex-direction: column;
1003
+ align-items: stretch;
1004
+ padding: 1.25rem 1rem;
1005
+ }
1006
+
1007
+ .modern-account-welcome__title {
1008
+ font-size: clamp(1.35rem, 6vw, 1.7rem);
1009
+ }
1010
+
1011
+ .modern-account-welcome__email {
1012
+ display: inline-block;
1013
+ max-width: 100%;
1014
+ overflow-wrap: anywhere;
1015
+ }
1016
+
1017
+ .modern-account-welcome .modern-btn {
1018
+ width: 100%;
1019
+ }
1020
+
1021
+ .modern-profile-banner {
1022
+ flex-direction: column;
1023
+ align-items: flex-start;
1024
+ padding: 1.1rem;
1025
+ }
1026
+
1027
+ .modern-account-stats-grid,
1028
+ .modern-form-grid-2 {
1029
+ grid-template-columns: 1fr;
1030
+ }
1031
+
1032
+ .modern-account-sec-head,
1033
+ .modern-order-card__head,
1034
+ .modern-order-card__foot,
1035
+ .modern-order-card__head-meta {
1036
+ flex-direction: column;
1037
+ align-items: flex-start;
1038
+ }
1039
+
1040
+ .modern-order-row {
1041
+ grid-template-columns: 1fr;
1042
+ }
1043
+
1044
+ .modern-order-card {
1045
+ padding: 1rem;
1046
+ min-width: 0;
1047
+ }
1048
+
1049
+ .modern-order-card__item {
1050
+ grid-template-columns: 4.25rem minmax(0, 1fr);
1051
+ grid-template-areas:
1052
+ "photo info"
1053
+ "photo price";
1054
+ align-items: start;
1055
+ column-gap: 0.75rem;
1056
+ }
1057
+
1058
+ .modern-order-card__item-photo {
1059
+ grid-area: photo;
1060
+ width: 4.25rem;
1061
+ height: 4.25rem;
1062
+ }
1063
+
1064
+ .modern-order-card__item-info {
1065
+ grid-area: info;
1066
+ }
1067
+
1068
+ .modern-order-card__item-price {
1069
+ grid-area: price;
1070
+ margin: 0.15rem 0 0;
1071
+ justify-self: start;
1072
+ white-space: normal;
1073
+ }
1074
+
1075
+ .modern-order-card__foot {
1076
+ flex-direction: column;
1077
+ align-items: stretch;
1078
+ }
1079
+
1080
+ .modern-order-card__foot .modern-btn {
1081
+ width: 100%;
1082
+ }
1083
+
1084
+ .modern-account-card,
1085
+ .modern-account-empty,
1086
+ .modern-modal {
1087
+ padding: 1.1rem;
1088
+ }
1089
+
1090
+ .modern-field-row {
1091
+ flex-direction: column;
1092
+ align-items: stretch;
1093
+ }
1094
+
1095
+ .modern-field-row .modern-field__input {
1096
+ min-width: 0;
1097
+ width: 100%;
1098
+ }
1099
+ }
@@ -5,6 +5,7 @@ import {
5
5
  PHONE_OTP_ERRORS,
6
6
  isValidEmail,
7
7
  isVerifiedFieldLocked,
8
+ isContactStatusVerified,
8
9
  normalizeEmail,
9
10
  phoneDigits,
10
11
  resolveEmailOtpFlow,
@@ -67,11 +68,18 @@ describe("verifiedFieldAction", () => {
67
68
  want: "edit",
68
69
  },
69
70
  {
70
- name: "editing a verified contact keeps verified until the value changes",
71
+ name: "editing a previously verified contact requires verify again",
71
72
  verified: true,
72
73
  editing: true,
73
74
  ready: true,
74
- want: "verified",
75
+ want: "verify",
76
+ },
77
+ {
78
+ name: "editing with incomplete draft shows no action yet",
79
+ verified: true,
80
+ editing: true,
81
+ ready: false,
82
+ want: "none",
75
83
  },
76
84
  {
77
85
  name: "typed valid unverified contact shows verify",
@@ -102,6 +110,27 @@ describe("verifiedFieldAction", () => {
102
110
  }
103
111
  })
104
112
 
113
+ describe("isContactStatusVerified", () => {
114
+ const cases: Array<{
115
+ name: string
116
+ verified: boolean
117
+ editing: boolean
118
+ want: boolean
119
+ }> = [
120
+ { name: "verified and not editing is verified", verified: true, editing: false, want: true },
121
+ { name: "verified while editing is not verified", verified: true, editing: true, want: false },
122
+ { name: "unverified is never verified", verified: false, editing: false, want: false },
123
+ ]
124
+ for (const tc of cases) {
125
+ it(tc.name, () => {
126
+ assert.equal(
127
+ isContactStatusVerified({ verified: tc.verified, editing: tc.editing }),
128
+ tc.want
129
+ )
130
+ })
131
+ }
132
+ })
133
+
105
134
  describe("normalizeEmail", () => {
106
135
  const cases: Array<{ name: string; value: string | null | undefined; want: string }> = [
107
136
  { name: "trims and lowercases", value: " Jay@Empire.COM ", want: "jay@empire.com" },
@@ -29,12 +29,23 @@ export function verifiedFieldAction(input: {
29
29
  editing: boolean
30
30
  ready: boolean
31
31
  }): VerifiedFieldAction {
32
+ // Locked verified contact: show Edit. Once editing starts, never show
33
+ // Verified again until OTP succeeds — draft changes must re-verify.
32
34
  if (isVerifiedFieldLocked(input)) return "edit"
35
+ if (input.editing) return input.ready ? "verify" : "none"
33
36
  if (input.verified) return "verified"
34
37
  if (input.ready) return "verify"
35
38
  return "none"
36
39
  }
37
40
 
41
+ /** True only when server says verified and the user is not mid-edit. */
42
+ export function isContactStatusVerified(input: {
43
+ verified: boolean
44
+ editing: boolean
45
+ }): boolean {
46
+ return input.verified && !input.editing
47
+ }
48
+
38
49
  export function normalizeEmail(value: string | null | undefined): string {
39
50
  return (value || "").trim().toLowerCase()
40
51
  }