( email?: string, )
| 32 | // here keeps a value set after init (a signup in this session) from going out |
| 33 | // in plain text. |
| 34 | export const hashEmailForMeta = async ( |
| 35 | email?: string, |
| 36 | ): Promise<string | undefined> => { |
| 37 | const normalized = email?.trim().toLowerCase(); |
| 38 | |
| 39 | if (!normalized || !globalThis.crypto?.subtle) { |
| 40 | return undefined; |
| 41 | } |
| 42 | |
| 43 | const digest = await globalThis.crypto.subtle.digest( |
| 44 | 'SHA-256', |
| 45 | new TextEncoder().encode(normalized), |
| 46 | ); |
| 47 | |
| 48 | return Array.from(new Uint8Array(digest)) |
| 49 | .map((byte) => byte.toString(16).padStart(2, '0')) |
| 50 | .join(''); |
| 51 | }; |
| 52 | |
| 53 | const FbTracking = ({ userId, consent, email }: PixelProps): ReactElement => { |
| 54 | useEffect(() => { |
no outgoing calls
no test coverage detected