{"version":3,"file":"SocialProviders-DGIcmehJ.js","sources":["../../src/components/pages/Auth/FormSection/FormContent/SocialProviders.tsx"],"sourcesContent":["import { FunctionComponent, PropsWithChildren } from 'react';\nimport { useQuery } from '@apollo/client';\nimport { gql } from '__generated__/gql';\nimport { ReactComponent as LogoPlaceholder } from 'images/avatar-logo-placeholder.svg';\nimport { useExtendedIntl } from 'hooks/useExtendedIntl';\nimport { ErrorMessage } from 'shared/ErrorMessage';\nimport { LoadingBlock } from 'shared/LoadingBlock';\nimport { SocialProviderNode } from 'typeDeclarations/graphql/nodes';\nimport { SOCIAL_ACCOUNTS_ICONS } from 'shared/DefaultDataGrid/constants';\nimport { DefaultSVGIcon } from 'shared/DefaultSVGIcon';\n\nimport { Grid, ListItemButton, ListItemIcon, ListItemText, GridProps } from '@mui/material';\n\nconst SOCIAL_PROVIDERS_QUERY = gql(/* GraphQL */ `\n query socialProvidersQuery {\n ...AllSocialProvidersFragment\n }\n`);\n\ninterface SocialProvidersQueryData {\n allSocialProviders: SocialProviderNode[];\n}\n\ninterface SocialProvidersProps extends GridProps<'ul'> {\n connect?: boolean;\n}\n\nexport const SocialProviders: FunctionComponent> = ({\n connect,\n ...remainingProps\n}) => {\n const { formatMessage, formatSocialProviders } = useExtendedIntl();\n\n const { data, loading, error } = useQuery(SOCIAL_PROVIDERS_QUERY);\n\n if (loading) return ;\n\n if (error || !data) return ;\n\n const { allSocialProviders } = data;\n\n return (\n \n {allSocialProviders.map(({ _id, loginEndpoint, connectEndpoint }) => {\n const icon = SOCIAL_ACCOUNTS_ICONS[_id] ?? LogoPlaceholder;\n\n let endpoint: undefined | string;\n let textIntlId: undefined | string;\n\n if (connect) {\n textIntlId = 'social-providers.sign-up-with';\n endpoint = connectEndpoint + '&next=/account-settings/social-accounts/';\n } else {\n endpoint = loginEndpoint;\n textIntlId = 'social-providers.sign-in-with';\n }\n const text = formatMessage({ id: textIntlId }, { socialProvider: formatSocialProviders(_id) });\n\n return (\n \n \n \n \n \n \n \n \n );\n })}\n \n );\n};\n"],"names":["SOCIAL_PROVIDERS_QUERY","gql","SocialProviders","connect","remainingProps","formatMessage","formatSocialProviders","useExtendedIntl","data","loading","error","useQuery","jsx","LoadingBlock","ErrorMessage","allSocialProviders","Grid","_id","loginEndpoint","connectEndpoint","icon","SOCIAL_ACCOUNTS_ICONS","LogoPlaceholder","endpoint","textIntlId","text","jsxs","ListItemButton","ListItemIcon","DefaultSVGIcon","ListItemText"],"mappings":"oNAaA,MAAMA,EAAyBC,EAAkB;AAAA;AAAA;AAAA;AAAA,CAIhD,EAUYC,EAA8E,CAAC,CAC1F,QAAAC,EACA,GAAGC,CACL,IAAM,CACJ,KAAM,CAAE,cAAAC,EAAe,sBAAAC,CAAsB,EAAIC,EAAgB,EAE3D,CAAE,KAAAC,EAAM,QAAAC,EAAS,MAAAC,CAAM,EAAIC,EAAmCX,CAAsB,EAEtF,GAAAS,EAAgB,OAAAG,EAAAA,IAACC,EAAa,CAAA,CAAA,EAElC,GAAIH,GAAS,CAACF,EAAM,aAAQM,EAAa,CAAA,CAAA,EAEnC,KAAA,CAAE,mBAAAC,CAAuB,EAAAP,EAE/B,OACGI,EAAAA,IAAAI,EAAA,CAAK,UAAS,GAAC,UAAU,KAAM,GAAGZ,EAChC,SAAAW,EAAmB,IAAI,CAAC,CAAE,IAAAE,EAAK,cAAAC,EAAe,gBAAAC,KAAsB,CAC7D,MAAAC,EAAOC,EAAsBJ,CAAG,GAAKK,EAEvC,IAAAC,EACAC,EAEArB,GACWqB,EAAA,gCACbD,EAAWJ,EAAkB,6CAElBI,EAAAL,EACEM,EAAA,iCAET,MAAAC,EAAOpB,EAAc,CAAE,GAAImB,CAAA,EAAc,CAAE,eAAgBlB,EAAsBW,CAAG,CAAA,CAAG,EAG3F,OAAAL,EAAAA,IAACI,EAAK,CAAA,UAAS,GAAC,KAAI,GAAC,GAAI,GAAI,GAAI,EAAG,UAAU,KAC5C,SAAAU,EAAA,KAACC,EAAA,CACC,UAAU,IACV,c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