diff --git a/src/components/portal/data.ts b/src/components/portal/data.ts index f388e46..752391e 100644 --- a/src/components/portal/data.ts +++ b/src/components/portal/data.ts @@ -75,11 +75,12 @@ export const countryCodes: CountryCode[] = [ ]; export const relationshipOptions = [ - "Homeowner", + "Customer", + "Employee", + "Owner", "Contractor", - "Property Manager", - "Tenant", - "Authorized Representative", + "Sub-Con", + "Vendor", ]; export const sectors = [ diff --git a/src/components/portal/register-flow.tsx b/src/components/portal/register-flow.tsx index 0832111..0c755ee 100644 --- a/src/components/portal/register-flow.tsx +++ b/src/components/portal/register-flow.tsx @@ -27,7 +27,7 @@ export function RegisterFlow() { const [cc, setCc] = useState("+1"); const [phone, setPhone] = useState(""); const [pw, setPw] = useState(""); - const [relationship, setRelationship] = useState("Homeowner"); + const [relationship, setRelationship] = useState("Customer"); const [alloeNo, setAlloeNo] = useState(""); const [alloeFirst, setAlloeFirst] = useState(""); const [alloeLast, setAlloeLast] = useState(""); @@ -42,15 +42,16 @@ export function RegisterFlow() { const [emailVerified, setEmailVerified] = useState(false); const [phoneVerified, setPhoneVerified] = useState(false); - const isSelf = relationship === "Homeowner"; + const isSelf = relationship === "Customer" || relationship === "Owner"; + const isEmployee = relationship === "Employee"; const country = countryCodes.find((c) => c.code === cc)!; const phoneOk = phone.replace(/\D/g, "").length === country.digits; const pwOk = sso ? true : passwordStrength(pw).score >= 3; - const alloeIdOk = /^(?=.*[a-zA-Z])(?=.*\d).{8,}$/.test(alloeNo); + const alloeIdOk = /^(?=.*[a-zA-Z])(?=.*\d).{4,}$/.test(alloeNo); const step0Valid = first.trim() && last.trim() && EMAIL_RE.test(sso?.email || email) && phoneOk && pwOk && - termsOk && privacyOk && (isSelf || (alloeIdOk && alloeFirst.trim() && alloeLast.trim())); + termsOk && privacyOk && (isSelf || (alloeIdOk && (isEmployee || (alloeFirst.trim() && alloeLast.trim())))); const step1Valid = /^LUP-\d{6}$/.test(allotment) || plotVerified; const step2Valid = emailVerified && phoneVerified; @@ -221,26 +222,38 @@ function StepAccount(p: { {p.isSelf ? ( -
Homeowner account — you own this property.
- ) : ( -
- Registering on behalf of the property owner. -
-
- Property Owner Details - {p.alloeNo && (p.alloeIdOk ? Valid : Checking…)} -
-
- - p.setAlloeNo(e.target.value.toUpperCase())} placeholder="Alphanumeric ID" /> -
-
-
p.setAlloeFirst(e.target.value)} />
-
p.setAlloeLast(e.target.value)} />
+
{p.relationship === "Owner" ? "Owner" : "Customer"} account — you own this property.
+ ) : (() => { + const isEmployee = p.relationship === "Employee"; + const cfg = ({ + Employee: { banner: "Registering as a LynkedUp Pro team member.", title: "Employee details", idLabel: "Employee ID", idPh: "EMP-12345" }, + Contractor:{ banner: "Registering on behalf of the property owner.", title: "Contractor details", idLabel: "Contractor ID", idPh: "Alphanumeric ID" }, + "Sub-Con": { banner: "Registering on behalf of the property owner.", title: "Sub-contractor details", idLabel: "Sub-contractor ID", idPh: "Alphanumeric ID" }, + Vendor: { banner: "Registering on behalf of the property owner.", title: "Vendor details", idLabel: "Vendor ID", idPh: "Alphanumeric ID" }, + } as Record)[p.relationship] + ?? { banner: "Registering on behalf of the property owner.", title: "Property Owner Details", idLabel: "Owner / Property ID", idPh: "Alphanumeric ID" }; + return ( +
+ {cfg.banner} +
+
+ {cfg.title} + {p.alloeNo && (p.alloeIdOk ? Valid : Checking…)} +
+
+ + p.setAlloeNo(e.target.value.toUpperCase())} placeholder={cfg.idPh} /> +
+ {!isEmployee && ( +
+
p.setAlloeFirst(e.target.value)} />
+
p.setAlloeLast(e.target.value)} />
+
+ )}
-
- )} + ); + })()}