{"version":3,"sources":["webpack:///./transfer/components/contactAvatar.js","webpack:///./lib/avatar.js"],"names":["LATIN_REGEX","ContactAvatar","props","size","imageUrl","altText","isBusiness","firstInitial","lastInitial","color","isFavorite","avatarProps","src","alt","test","initials","generic","badge","React","createElement","_FavoriteBadge","data-testid","_Avatar","getAvatarColor","_ref","firstName","lastName","shift","codePointAt","pop","e"],"mappings":"mKAGMA,EAAc,sDAYL,SAASC,EAAcC,GACpC,IAAM,KACJC,EAAO,KAAI,SACXC,EAAQ,QACRC,EAAO,WACPC,GAAa,EAAK,aAClBC,EAAY,YACZC,EAAW,MACXC,EAAQ,UAAS,WACjBC,GAAa,GACXR,EAEES,EAAc,CAClBR,OACA,eAAe,GA2BjB,OAzBIC,GACFO,EAAYC,IAAMR,EAClBO,EAAYE,IAAM,GACdR,IACFM,EAAYE,IAAMR,IAIpBE,GACAC,GACAR,EAAYc,KAAKP,IACjBP,EAAYc,KAAKN,IAEjBG,EAAYI,SAAWR,EAAeC,EACtCG,EAAYF,MAAQA,GAEpBE,EAAYK,QADHV,EACa,WAEA,UAGpBI,IACFC,EAAYM,MAAQC,IAAAC,cAAAC,IAAA,CAAeC,cAAY,6BAG1CH,IAAAC,cAAAG,IAAYX,K,iCClDd,SAASY,EAAcC,GAM3B,IAN4B,UAC7BC,EAAS,SACTC,GAIDF,EACC,IAKE,MAAO,CAAC,SAAU,QAAS,UAAW,YAJVC,EACxB,IAAIA,GAAWE,QAAQC,YAAY,GACnC,IACuBF,EAAW,IAAIA,GAAUG,MAAMD,YAAY,GAAK,IAE5B,GAE/C,MAAOE,GACP,MAAO,UApBX","file":"default~VisaPlusConfirmPhone~blockedContactList~contact-list~guest~multi-recipient-redux~request-pag~17361cbc.esm.js","sourcesContent":["import React from 'react'\nimport { Avatar, FavoriteBadge } from '@paypalcorp/pp-react'\n\nconst LATIN_REGEX = /^[A-z\\u00C0-\\u00ff\\s'\\.,-\\/#!$%\\^&\\*;:{}=\\-_`~()]+$/\n\ntype Props = {\n size?: 'xs' | 'sm' | 'md' | 'lg',\n imageUrl?: string,\n altText?: string,\n firstInitial?: string,\n lastInitial?: string,\n isBusiness?: boolean,\n color?: 'magenta' | 'yellow' | 'green' | 'purple',\n isFavorite?: boolean, // TODO\n}\nexport default function ContactAvatar(props: Props) {\n const {\n size = 'md',\n imageUrl,\n altText,\n isBusiness = false,\n firstInitial,\n lastInitial,\n color = 'magenta',\n isFavorite = false,\n } = props\n\n const avatarProps = {\n size,\n 'aria-hidden': true,\n }\n if (imageUrl) {\n avatarProps.src = imageUrl\n avatarProps.alt = ''\n if (altText) {\n avatarProps.alt = altText\n }\n } else if (\n // show initials IFF both initials present AND both are latin characters\n firstInitial &&\n lastInitial &&\n LATIN_REGEX.test(firstInitial) &&\n LATIN_REGEX.test(lastInitial)\n ) {\n avatarProps.initials = firstInitial + lastInitial\n avatarProps.color = color\n } else if (isBusiness) {\n avatarProps.generic = 'merchant'\n } else {\n avatarProps.generic = 'profile'\n }\n\n if (isFavorite) {\n avatarProps.badge = \n }\n\n return \n}\n","// @flow\n\n// sum of unicode code point integers of the first character of the first name\n// (or 0 if not present) and the last character of the last name (or 0 if not present),\n// mod the number of possible colors (4), and then index from the list of colors\n// where the list of colors is ['yellow', 'green', 'magenta', 'purple']\nexport function getAvatarColor({\n firstName,\n lastName,\n}: {\n firstName: ?string,\n lastName: ?string,\n}) {\n try {\n const firstNameUnicodeInt = firstName\n ? [...firstName].shift().codePointAt(0)\n : 0\n const lastNameUnicodeInt = lastName ? [...lastName].pop().codePointAt(0) : 0\n return ['yellow', 'green', 'magenta', 'purple'][\n (firstNameUnicodeInt + lastNameUnicodeInt) % 4\n ]\n } catch (e) {\n return 'yellow'\n }\n}\n"],"sourceRoot":""}