fix(mobile): address Apple review onboarding flows

This commit is contained in:
jjbrunton committed 2026-09-01 09:42:48 +01:00
1 parent 6883befff3
commit 7c8d91c89c
20 files changed
+661 -262

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
export interface AppleProfileName {
givenName?: string | null;
middleName?: string | null;
familyName?: string | null;
}
const MAX_PROFILE_NAME_LENGTH = 100;
/**
* Apple supplies its name fields only on the first authorization. Keep that
* user-provided value as the Sauci display name without retaining email or
* other Apple credential fields outside the existing profile contract.
*/
export function formatAppleProfileName(fullName: AppleProfileName | null | undefined): string | null {
const name = [fullName?.givenName, fullName?.middleName, fullName?.familyName]
.filter((part): part is string => typeof part === "string")
.join(" ")
.normalize("NFKC")
.replace(/[\u0000-\u001F\u007F-\u009F]/g, "")
.replace(/\s+/gu, " ")
.trim();
return name.length > 0 ? name.slice(0, MAX_PROFILE_NAME_LENGTH) : null;
}