@os-team/profile 1.0.37 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/profile/ProfileDrawerContent.js.map +1 -1
- package/dist/cjs/components/profile/ProfileUpdateNameForm.js.map +1 -1
- package/dist/cjs/components/profile/ProfileUpdatePasswordForm.js.map +1 -1
- package/dist/cjs/components/profile/ProtectedWrapper.js.map +1 -1
- package/dist/cjs/components/profile/UserAvatar.js +1 -1
- package/dist/cjs/components/profile/UserAvatar.js.map +1 -1
- package/dist/esm/components/profile/ProfileDrawerContent.js.map +1 -1
- package/dist/esm/components/profile/ProfileUpdateNameForm.js.map +1 -1
- package/dist/esm/components/profile/ProfileUpdatePasswordForm.js.map +1 -1
- package/dist/esm/components/profile/ProtectedWrapper.js.map +1 -1
- package/dist/esm/components/profile/UserAvatar.js +1 -1
- package/dist/esm/components/profile/UserAvatar.js.map +1 -1
- package/dist/types/components/profile/ProfileDrawerContent.d.ts +1 -0
- package/dist/types/components/profile/ProfileDrawerContent.d.ts.map +1 -1
- package/dist/types/components/profile/ProfileUpdateNameForm.d.ts +4 -1
- package/dist/types/components/profile/ProfileUpdateNameForm.d.ts.map +1 -1
- package/dist/types/components/profile/ProfileUpdatePasswordForm.d.ts +4 -1
- package/dist/types/components/profile/ProfileUpdatePasswordForm.d.ts.map +1 -1
- package/dist/types/components/profile/ProtectedWrapper.d.ts +1 -0
- package/dist/types/components/profile/ProtectedWrapper.d.ts.map +1 -1
- package/package.json +48 -48
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"names":["AvatarContainer","styled","div","UserContent","FullName","p","theme","sizes","large","Email","inputColorPlaceholder","ActionsContainer","Footer","HiddenInput","input","profileDrawerContentUpdateAvatarMutation","DeleteAvatarButton","t","commit","loading","handler","variables","avatar","onError","error","message","source","errors","onCompleted","success","UpdateAvatarButton","hasAvatar","fileInputRef","e","target","files","file","uploadables","current","value","click","UpdateNameButton","hasName","modalVisibility","setModalVisibility","ChangePasswordButton","SignOutButton","window","location","href","ProfileDrawerContent","actions","children","email","firstName","lastName","fullName","filter","i","join"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAMA,eAAe,GAAGC,gBAAOC,GAAV,wKAArB;;AAOA,IAAMC,WAAW,GAAGF,gBAAOC,GAAV,6FAAjB;;AAIA,IAAME,QAAQ,GAAGH,gBAAOC,GAAV,iKACC,UAACG,CAAD;AAAA,SAAOA,CAAC,CAACC,KAAF,CAAQC,KAAR,CAAcC,KAArB;AAAA,CADD,CAAd;;AAOA,IAAMC,KAAK,GAAGR,gBAAOC,GAAV,uIACA,UAACG,CAAD;AAAA,SAAO,kBAAIA,CAAC,CAACC,KAAF,CAAQI,qBAAZ,CAAP;AAAA,CADA,CAAX;;AAMA,IAAMC,gBAAgB,GAAGV,gBAAOC,GAAV,+FAAtB;;AAIA,IAAMU,MAAM,GAAGX,gBAAOC,GAAV,mKAAZ;;AAOA,IAAMW,WAAW,GAAGZ,gBAAOa,KAAV,2FAAjB;;AAIA,IAAMC,wCAAwC,8kBAA9C;;AAWA,IAAMC,kBAA4B,GAAG,SAA/BA,kBAA+B,GAAM;AACzC,wBAAc,kCAAe,SAAf,CAAd;AAAA,MAAQC,CAAR,mBAAQA,CAAR;;AAEA,qBACE,wBACEF,wCADF,CADF;AAAA;AAAA,MAAOG,MAAP;AAAA,MAAeC,OAAf;;AAKA,MAAMC,OAAO,GAAG,wBAAY,YAAM;AAChCF,IAAAA,MAAM,CAAC;AACLG,MAAAA,SAAS,EAAE;AACTP,QAAAA,KAAK,EAAE;AAAEQ,UAAAA,MAAM,EAAE;AAAV;AADE,OADN;AAILC,MAAAA,OAAO,EAAE,iBAACC,KAAD,EAAW;AAAA;;AAClB;AACAC,sBAAQD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import React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { message, ThemeSwitcher } from '@os-design/core';\nimport styled from '@emotion/styled';\nimport { clr } from '@os-design/theming';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport UserAvatar from './UserAvatar';\nimport { useProfile } from './ProfileContext';\nimport ProfileButton from './ProfileButton';\nimport ProfileUpdateNameModal from './ProfileUpdateNameModal';\nimport ProfileUpdatePasswordModal from './ProfileUpdatePasswordModal';\nimport { ProfileDrawerContentSignOutMutation } from './__generated__/ProfileDrawerContentSignOutMutation.graphql';\nimport { ProfileDrawerContentUpdateAvatarMutation } from './__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql';\n\nexport interface ProfileDrawerContentProps {\n /**\n * Additional actions placed under the avatar.\n * @default undefined\n */\n actions?: React.ReactNode;\n}\n\nconst AvatarContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n`;\n\nconst UserContent = styled.div`\n margin-top: 1em;\n`;\n\nconst FullName = styled.div`\n font-size: ${(p) => p.theme.sizes.large}em;\n font-weight: 500;\n text-align: center;\n line-height: 1.2;\n`;\n\nconst Email = styled.div`\n color: ${(p) => clr(p.theme.inputColorPlaceholder)};\n margin-top: 0.2em;\n text-align: center;\n`;\n\nconst ActionsContainer = styled.div`\n margin-top: 1.5em;\n`;\n\nconst Footer = styled.div`\n display: flex;\n justify-content: center;\n margin-top: auto;\n padding-top: 1.5em;\n`;\n\nconst HiddenInput = styled.input`\n display: none;\n`;\n\nconst profileDrawerContentUpdateAvatarMutation = graphql`\n mutation ProfileDrawerContentUpdateAvatarMutation(\n $input: UpdateAvatarInput!\n ) {\n updateAvatar(input: $input) {\n id\n avatar\n }\n }\n`;\n\nconst DeleteAvatarButton: React.FC = () => {\n const { t } = useTranslation('profile');\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentUpdateAvatarMutation>(\n profileDrawerContentUpdateAvatarMutation\n );\n\n const handler = useCallback(() => {\n commit({\n variables: {\n input: { avatar: null },\n },\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n }, [commit, t]);\n\n return (\n <ProfileButton loading={loading} onClick={handler}>\n {t('profile:deleteAvatar')}\n </ProfileButton>\n );\n};\n\ninterface UpdateAvatarButtonProps {\n hasAvatar: boolean;\n}\n\nconst UpdateAvatarButton: React.FC<UpdateAvatarButtonProps> = ({\n hasAvatar,\n}) => {\n const { t } = useTranslation('profile');\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentUpdateAvatarMutation>(\n profileDrawerContentUpdateAvatarMutation\n );\n\n const handler = useCallback(\n (e) => {\n const target = e.target as HTMLInputElement | null;\n if (!target) return;\n\n const { files } = target;\n if (!files) return;\n\n const file = files[0];\n\n commit({\n variables: {\n input: {},\n },\n uploadables: { avatar: file },\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n },\n [commit, t]\n );\n\n return (\n <>\n <ProfileButton\n loading={loading}\n onClick={() => {\n if (!fileInputRef.current) return;\n fileInputRef.current.value = '';\n fileInputRef.current.click();\n }}\n >\n {t(`profile:${hasAvatar ? 'changeAvatar' : 'setAvatar'}`)}\n </ProfileButton>\n\n <HiddenInput\n type='file'\n accept='image/jpeg,image/png,image/webp'\n onChange={handler}\n ref={fileInputRef}\n />\n </>\n );\n};\n\ninterface UpdateNameButtonProps {\n hasName: boolean;\n}\n\nconst UpdateNameButton: React.FC<UpdateNameButtonProps> = ({ hasName }) => {\n const { t } = useTranslation('profile');\n const [modalVisibility, setModalVisibility] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisibility(true)}>\n {t(`profile:${hasName ? 'changeName' : 'setName'}`)}\n </ProfileButton>\n\n <ProfileUpdateNameModal\n visibility={modalVisibility}\n onClose={() => setModalVisibility(false)}\n />\n </>\n );\n};\n\nconst ChangePasswordButton: React.FC = () => {\n const { t } = useTranslation('profile');\n const [modalVisibility, setModalVisibility] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisibility(true)}>\n {t('profile:changePassword')}\n </ProfileButton>\n\n <ProfileUpdatePasswordModal\n visibility={modalVisibility}\n onClose={() => setModalVisibility(false)}\n />\n </>\n );\n};\n\nconst SignOutButton: React.FC = () => {\n const { t } = useTranslation('profile');\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentSignOutMutation>(graphql`\n mutation ProfileDrawerContentSignOutMutation {\n signOut {\n ok\n }\n }\n `);\n\n const handler = useCallback(() => {\n commit({\n variables: {},\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n window.location.href = '/auth/';\n },\n });\n }, [commit]);\n\n return (\n <ProfileButton danger loading={loading} onClick={handler}>\n {t('profile:signOut')}\n </ProfileButton>\n );\n};\n\nconst ProfileDrawerContent: React.FC<ProfileDrawerContentProps> = ({\n actions,\n children,\n}) => {\n const { email, firstName, lastName, avatar } = useProfile();\n\n const fullName = useMemo(\n () => [firstName, lastName].filter((i) => i).join(' '),\n [firstName, lastName]\n );\n\n return (\n <>\n <AvatarContainer>\n <UserAvatar size='10em' />\n <UserContent>\n {fullName && <FullName>{fullName}</FullName>}\n <Email>{email}</Email>\n </UserContent>\n </AvatarContainer>\n\n <ActionsContainer>\n {avatar && <DeleteAvatarButton />}\n\n <UpdateAvatarButton hasAvatar={!!avatar} />\n <UpdateNameButton hasName={!!fullName} />\n <ChangePasswordButton />\n\n {actions}\n\n <SignOutButton />\n\n {children}\n </ActionsContainer>\n\n <Footer>\n <ThemeSwitcher />\n </Footer>\n </>\n );\n};\n\nexport default ProfileDrawerContent;\n"],"file":"ProfileDrawerContent.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"names":["AvatarContainer","styled","div","UserContent","FullName","p","theme","sizes","large","Email","inputColorPlaceholder","ActionsContainer","Footer","HiddenInput","input","profileDrawerContentUpdateAvatarMutation","DeleteAvatarButton","t","commit","loading","handler","variables","avatar","onError","error","message","source","errors","onCompleted","success","UpdateAvatarButton","hasAvatar","fileInputRef","e","target","files","file","uploadables","current","value","click","UpdateNameButton","hasName","modalVisibility","setModalVisibility","ChangePasswordButton","SignOutButton","window","location","href","ProfileDrawerContent","actions","children","email","firstName","lastName","fullName","filter","i","join"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAMA,eAAe,GAAGC,gBAAOC,GAAV,wKAArB;;AAOA,IAAMC,WAAW,GAAGF,gBAAOC,GAAV,6FAAjB;;AAIA,IAAME,QAAQ,GAAGH,gBAAOC,GAAV,iKACC,UAACG,CAAD;AAAA,SAAOA,CAAC,CAACC,KAAF,CAAQC,KAAR,CAAcC,KAArB;AAAA,CADD,CAAd;;AAOA,IAAMC,KAAK,GAAGR,gBAAOC,GAAV,uIACA,UAACG,CAAD;AAAA,SAAO,kBAAIA,CAAC,CAACC,KAAF,CAAQI,qBAAZ,CAAP;AAAA,CADA,CAAX;;AAMA,IAAMC,gBAAgB,GAAGV,gBAAOC,GAAV,+FAAtB;;AAIA,IAAMU,MAAM,GAAGX,gBAAOC,GAAV,mKAAZ;;AAOA,IAAMW,WAAW,GAAGZ,gBAAOa,KAAV,2FAAjB;;AAIA,IAAMC,wCAAwC,8kBAA9C;;AAWA,IAAMC,kBAA4B,GAAG,SAA/BA,kBAA+B,GAAM;AACzC,wBAAc,kCAAe,SAAf,CAAd;AAAA,MAAQC,CAAR,mBAAQA,CAAR;;AAEA,qBACE,wBACEF,wCADF,CADF;AAAA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AAC,CAACA;AAAjC,IAHF,eAIE,6BAAC,gBAAD;AAAkB,IAAA,OAAO,EAAE,CAAC,CAACkC;AAA7B,IAJF,eAKE,6BAAC,oBAAD,OALF,EAOGL,OAPH,eASE,6BAAC,aAAD,OATF,EAWGC,QAXH,CATF,eAuBE,6BAAC,MAAD,qBACE,6BAAC,mBAAD,OADF,CAvBF,CADF;AA6BD,CAxCD;;eA0CeF,oB","sourcesContent":["import React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { message, ThemeSwitcher } from '@os-design/core';\nimport styled from '@emotion/styled';\nimport { clr } from '@os-design/theming';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport UserAvatar from './UserAvatar';\nimport { useProfile } from './ProfileContext';\nimport ProfileButton from './ProfileButton';\nimport ProfileUpdateNameModal from './ProfileUpdateNameModal';\nimport ProfileUpdatePasswordModal from './ProfileUpdatePasswordModal';\nimport { ProfileDrawerContentSignOutMutation } from './__generated__/ProfileDrawerContentSignOutMutation.graphql';\nimport { ProfileDrawerContentUpdateAvatarMutation } from './__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql';\n\nexport interface ProfileDrawerContentProps {\n /**\n * Additional actions placed under the avatar.\n * @default undefined\n */\n actions?: React.ReactNode;\n /**\n * The children.\n */\n children?: React.ReactNode;\n}\n\nconst AvatarContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n`;\n\nconst UserContent = styled.div`\n margin-top: 1em;\n`;\n\nconst FullName = styled.div`\n font-size: ${(p) => p.theme.sizes.large}em;\n font-weight: 500;\n text-align: center;\n line-height: 1.2;\n`;\n\nconst Email = styled.div`\n color: ${(p) => clr(p.theme.inputColorPlaceholder)};\n margin-top: 0.2em;\n text-align: center;\n`;\n\nconst ActionsContainer = styled.div`\n margin-top: 1.5em;\n`;\n\nconst Footer = styled.div`\n display: flex;\n justify-content: center;\n margin-top: auto;\n padding-top: 1.5em;\n`;\n\nconst HiddenInput = styled.input`\n display: none;\n`;\n\nconst profileDrawerContentUpdateAvatarMutation = graphql`\n mutation ProfileDrawerContentUpdateAvatarMutation(\n $input: UpdateAvatarInput!\n ) {\n updateAvatar(input: $input) {\n id\n avatar\n }\n }\n`;\n\nconst DeleteAvatarButton: React.FC = () => {\n const { t } = useTranslation('profile');\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentUpdateAvatarMutation>(\n profileDrawerContentUpdateAvatarMutation\n );\n\n const handler = useCallback(() => {\n commit({\n variables: {\n input: { avatar: null },\n },\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n }, [commit, t]);\n\n return (\n <ProfileButton loading={loading} onClick={handler}>\n {t('profile:deleteAvatar')}\n </ProfileButton>\n );\n};\n\ninterface UpdateAvatarButtonProps {\n hasAvatar: boolean;\n}\n\nconst UpdateAvatarButton: React.FC<UpdateAvatarButtonProps> = ({\n hasAvatar,\n}) => {\n const { t } = useTranslation('profile');\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentUpdateAvatarMutation>(\n profileDrawerContentUpdateAvatarMutation\n );\n\n const handler = useCallback(\n (e) => {\n const target = e.target as HTMLInputElement | null;\n if (!target) return;\n\n const { files } = target;\n if (!files) return;\n\n const file = files[0];\n\n commit({\n variables: {\n input: {},\n },\n uploadables: { avatar: file },\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n },\n [commit, t]\n );\n\n return (\n <>\n <ProfileButton\n loading={loading}\n onClick={() => {\n if (!fileInputRef.current) return;\n fileInputRef.current.value = '';\n fileInputRef.current.click();\n }}\n >\n {t(`profile:${hasAvatar ? 'changeAvatar' : 'setAvatar'}`)}\n </ProfileButton>\n\n <HiddenInput\n type='file'\n accept='image/jpeg,image/png,image/webp'\n onChange={handler}\n ref={fileInputRef}\n />\n </>\n );\n};\n\ninterface UpdateNameButtonProps {\n hasName: boolean;\n}\n\nconst UpdateNameButton: React.FC<UpdateNameButtonProps> = ({ hasName }) => {\n const { t } = useTranslation('profile');\n const [modalVisibility, setModalVisibility] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisibility(true)}>\n {t(`profile:${hasName ? 'changeName' : 'setName'}`)}\n </ProfileButton>\n\n <ProfileUpdateNameModal\n visibility={modalVisibility}\n onClose={() => setModalVisibility(false)}\n />\n </>\n );\n};\n\nconst ChangePasswordButton: React.FC = () => {\n const { t } = useTranslation('profile');\n const [modalVisibility, setModalVisibility] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisibility(true)}>\n {t('profile:changePassword')}\n </ProfileButton>\n\n <ProfileUpdatePasswordModal\n visibility={modalVisibility}\n onClose={() => setModalVisibility(false)}\n />\n </>\n );\n};\n\nconst SignOutButton: React.FC = () => {\n const { t } = useTranslation('profile');\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentSignOutMutation>(graphql`\n mutation ProfileDrawerContentSignOutMutation {\n signOut {\n ok\n }\n }\n `);\n\n const handler = useCallback(() => {\n commit({\n variables: {},\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n window.location.href = '/auth/';\n },\n });\n }, [commit]);\n\n return (\n <ProfileButton danger loading={loading} onClick={handler}>\n {t('profile:signOut')}\n </ProfileButton>\n );\n};\n\nconst ProfileDrawerContent: React.FC<ProfileDrawerContentProps> = ({\n actions,\n children,\n}) => {\n const { email, firstName, lastName, avatar } = useProfile();\n\n const fullName = useMemo(\n () => [firstName, lastName].filter((i) => i).join(' '),\n [firstName, lastName]\n );\n\n return (\n <>\n <AvatarContainer>\n <UserAvatar size='10em' />\n <UserContent>\n {fullName && <FullName>{fullName}</FullName>}\n <Email>{email}</Email>\n </UserContent>\n </AvatarContainer>\n\n <ActionsContainer>\n {avatar && <DeleteAvatarButton />}\n\n <UpdateAvatarButton hasAvatar={!!avatar} />\n <UpdateNameButton hasName={!!fullName} />\n <ChangePasswordButton />\n\n {actions}\n\n <SignOutButton />\n\n {children}\n </ActionsContainer>\n\n <Footer>\n <ThemeSwitcher />\n </Footer>\n </>\n );\n};\n\nexport default ProfileDrawerContent;\n"],"file":"ProfileDrawerContent.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdateNameForm.tsx"],"names":["ProfileUpdateNameForm","children","t","formError","firstName","lastName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdateNameForm.tsx"],"names":["ProfileUpdateNameForm","children","t","formError","firstName","lastName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAWA,IAAMA,qBAA2D,GAAG,SAA9DA,qBAA8D,OAE9D;AAAA,MADJC,QACI,QADJA,QACI;;AACJ,wBAAc,kCAAe,SAAf,CAAd;AAAA,MAAQC,CAAR,mBAAQA,CAAR;;AACA,iBAAsB,yBAAtB;AAAA,MAAQC,SAAR,YAAQA,SAAR;;AAEA,MAAMC,SAAS,GAAG,4BAAY,WAAZ,CAAlB;AACA,MAAMC,QAAQ,GAAG,4BAAY,UAAZ,CAAjB;AAEA,sBACE,6BAAC,UAAD,qBACE,6BAAC,cAAD;AACE,IAAA,KAAK,EAAEH,CAAC,CAAC,yCAAD;AADV,KAEME,SAAS,CAAC,CAAD,CAFf,gBAIE,6BAAC,WAAD;AACE,IAAA,WAAW,EAAEF,CAAC,CAAC,+CAAD;AADhB,KAEME,SAAS,CAAC,CAAD,CAFf,EAJF,CADF,eAWE,6BAAC,cAAD;AACE,IAAA,KAAK,EAAEF,CAAC,CAAC,wCAAD;AADV,KAEMG,QAAQ,CAAC,CAAD,CAFd,gBAIE,6BAAC,WAAD;AACE,IAAA,WAAW,EAAEH,CAAC,CAAC,8CAAD;AADhB,KAEMG,QAAQ,CAAC,CAAD,CAFd,EAJF,CAXF,EAqBGF,SAAS,iBAAI,6BAAC,WAAD;AAAO,IAAA,IAAI,EAAC;AAAZ,KAAqBA,SAArB,CArBhB,EAuBGF,QAvBH,CADF;AA2BD,CApCD;;eAsCeD,qB","sourcesContent":["import React from 'react';\nimport { useForm, useFormItem } from '@os-team/form-utils';\nimport { Alert, Form, FormItem, Input } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\n\nexport interface ProfileUpdateNameFormData {\n firstName: string;\n lastName: string;\n}\n\ninterface ProfileUpdateNameFormProps {\n children?: React.ReactNode;\n}\n\nconst ProfileUpdateNameForm: React.FC<ProfileUpdateNameFormProps> = ({\n children,\n}) => {\n const { t } = useTranslation('profile');\n const { formError } = useForm();\n\n const firstName = useFormItem('firstName');\n const lastName = useFormItem('lastName');\n\n return (\n <Form>\n <FormItem\n label={t('profile:updateNameModal.firstName.label')}\n {...firstName[0]}\n >\n <Input\n placeholder={t('profile:updateNameModal.firstName.placeholder')}\n {...firstName[1]}\n />\n </FormItem>\n\n <FormItem\n label={t('profile:updateNameModal.lastName.label')}\n {...lastName[0]}\n >\n <Input\n placeholder={t('profile:updateNameModal.lastName.placeholder')}\n {...lastName[1]}\n />\n </FormItem>\n\n {formError && <Alert type='error'>{formError}</Alert>}\n\n {children}\n </Form>\n );\n};\n\nexport default ProfileUpdateNameForm;\n"],"file":"ProfileUpdateNameForm.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdatePasswordForm.tsx"],"names":["ProfileUpdatePasswordForm","children","t","formError","currentPassword","password","returnObjects"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdatePasswordForm.tsx"],"names":["ProfileUpdatePasswordForm","children","t","formError","currentPassword","password","returnObjects"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAWA,IAAMA,yBAAmE,GAAG,SAAtEA,yBAAsE,OAEtE;AAAA,MADJC,QACI,QADJA,QACI;;AACJ,wBAAc,kCAAe,SAAf,CAAd;AAAA,MAAQC,CAAR,mBAAQA,CAAR;;AACA,iBAAsB,yBAAtB;AAAA,MAAQC,SAAR,YAAQA,SAAR;;AAEA,MAAMC,eAAe,GAAG,4BAAY,iBAAZ,CAAxB;AACA,MAAMC,QAAQ,GAAG,4BAAY,UAAZ,CAAjB;AAEA,sBACE,6BAAC,UAAD,qBACE,6BAAC,cAAD;AACE,IAAA,KAAK,EAAEH,CAAC,CAAC,mDAAD;AADV,KAEME,eAAe,CAAC,CAAD,CAFrB,gBAIE,6BAAC,mBAAD;AACE,IAAA,WAAW,EAAEF,CAAC,CACZ,yDADY;AADhB,KAIME,eAAe,CAAC,CAAD,CAJrB,EAJF,CADF,eAaE,6BAAC,cAAD;AACE,IAAA,KAAK,EAAEF,CAAC,CAAC,+CAAD;AADV,KAEMG,QAAQ,CAAC,CAAD,CAFd,gBAIE,6BAAC,mBAAD;AACE,IAAA,WAAW,EAAEH,CAAC,CAAC,qDAAD,CADhB;AAEE,IAAA,iBAAiB,MAFnB;AAGE,IAAA,aAAa,EAAEA,CAAC,CACd,mDADc,EAEd;AACEI,MAAAA,aAAa,EAAE;AADjB,KAFc;AAHlB,KASMD,QAAQ,CAAC,CAAD,CATd,EAJF,CAbF,EA8BGF,SAAS,iBAAI,6BAAC,WAAD;AAAO,IAAA,IAAI,EAAC;AAAZ,KAAqBA,SAArB,CA9BhB,EAgCGF,QAhCH,CADF;AAoCD,CA7CD;;eA+CeD,yB","sourcesContent":["import React from 'react';\nimport { useForm, useFormItem } from '@os-team/form-utils';\nimport { Alert, Form, FormItem, InputPassword } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\n\nexport interface ProfileUpdatePasswordFormData {\n currentPassword: string;\n password: string;\n}\n\ninterface ProfileUpdatePasswordFormProps {\n children?: React.ReactNode;\n}\n\nconst ProfileUpdatePasswordForm: React.FC<ProfileUpdatePasswordFormProps> = ({\n children,\n}) => {\n const { t } = useTranslation('profile');\n const { formError } = useForm();\n\n const currentPassword = useFormItem('currentPassword');\n const password = useFormItem('password');\n\n return (\n <Form>\n <FormItem\n label={t('profile:updatePasswordModal.currentPassword.label')}\n {...currentPassword[0]}\n >\n <InputPassword\n placeholder={t(\n 'profile:updatePasswordModal.currentPassword.placeholder'\n )}\n {...currentPassword[1]}\n />\n </FormItem>\n\n <FormItem\n label={t('profile:updatePasswordModal.newPassword.label')}\n {...password[0]}\n >\n <InputPassword\n placeholder={t('profile:updatePasswordModal.newPassword.placeholder')}\n showStrengthMeter\n strengthNames={t(\n 'profile:updatePasswordModal.passwordStrengthNames',\n {\n returnObjects: true,\n }\n )}\n {...password[1]}\n />\n </FormItem>\n\n {formError && <Alert type='error'>{formError}</Alert>}\n\n {children}\n </Form>\n );\n};\n\nexport default ProfileUpdatePasswordForm;\n"],"file":"ProfileUpdatePasswordForm.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProtectedWrapper.tsx"],"names":["ProtectedWrapperLoader","children","fetchPolicy","profile","profileContext","id","email","firstName","undefined","lastName","avatar","ProtectedWrapper","bucketId","profileConfigContext","window","location","href"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProtectedWrapper.tsx"],"names":["ProtectedWrapperLoader","children","fetchPolicy","profile","profileContext","id","email","firstName","undefined","lastName","avatar","ProtectedWrapper","bucketId","profileConfigContext","window","location","href"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;AAOA,IAAMA,sBAA6D,GAAG,SAAhEA,sBAAgE,OA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CANF,CADF,CADF;AAYD,CAlBD;;eAoBeU,gB","sourcesContent":["import React, { useMemo } from 'react';\nimport graphql from 'babel-plugin-relay/macro';\nimport { useLazyLoadQuery } from 'react-relay/hooks';\nimport { ErrorBoundary } from '@os-design/utils';\nimport ProfileConfigContext from './ProfileConfigContext';\nimport ProfileContext from './ProfileContext';\nimport { ProtectedWrapperQuery } from './__generated__/ProtectedWrapperQuery.graphql';\n\ninterface ProtectedWrapperLoaderProps {\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapperLoader: React.FC<ProtectedWrapperLoaderProps> = ({\n children,\n}) => {\n const { profile } = useLazyLoadQuery<ProtectedWrapperQuery>(\n graphql`\n query ProtectedWrapperQuery {\n profile {\n id\n email\n firstName\n lastName\n avatar\n }\n }\n `,\n {},\n { fetchPolicy: 'store-or-network' }\n );\n\n const profileContext = useMemo(\n () => ({\n id: profile.id,\n email: profile.email,\n firstName: profile.firstName || undefined,\n lastName: profile.lastName || undefined,\n avatar: profile.avatar || undefined,\n }),\n [\n profile.avatar,\n profile.email,\n profile.firstName,\n profile.id,\n profile.lastName,\n ]\n );\n\n return (\n <ProfileContext.Provider value={profileContext}>\n {children}\n </ProfileContext.Provider>\n );\n};\n\nexport interface ProtectedWrapperProps {\n bucketId: string;\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapper: React.FC<ProtectedWrapperProps> = ({\n bucketId,\n children,\n}) => {\n const profileConfigContext = useMemo(() => ({ bucketId }), [bucketId]);\n\n return (\n <ProfileConfigContext.Provider value={profileConfigContext}>\n <ErrorBoundary\n fallback={() => {\n window.location.href = '/auth/';\n return null;\n }}\n >\n <ProtectedWrapperLoader>{children}</ProtectedWrapperLoader>\n </ErrorBoundary>\n </ProfileConfigContext.Provider>\n );\n};\n\nexport default ProtectedWrapper;\n"],"file":"ProtectedWrapper.js"}
|
|
@@ -42,7 +42,7 @@ var UserAvatar = function UserAvatar(props) {
|
|
|
42
42
|
}, [email, firstName, lastName]);
|
|
43
43
|
var image = (0, _react.useMemo)(function () {
|
|
44
44
|
if (!avatar) return undefined;
|
|
45
|
-
return "https://storage.
|
|
45
|
+
return "https://storage.yandexcloud.net/".concat(bucketId, "/users/").concat(avatar);
|
|
46
46
|
}, [avatar, bucketId]);
|
|
47
47
|
return /*#__PURE__*/_react.default.createElement(_core.Avatar, _extends({}, avatarProps, {
|
|
48
48
|
image: image
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/UserAvatar.tsx"],"names":["UserAvatar","props","email","firstName","lastName","avatar","bucketId","avatarProps","image","undefined"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,UAAiC,GAAG,SAApCA,UAAoC,CAACC,KAAD,EAAW;AACnD,oBAA+C,iCAA/C;AAAA,MAAQC,KAAR,eAAQA,KAAR;AAAA,MAAeC,SAAf,eAAeA,SAAf;AAAA,MAA0BC,QAA1B,eAA0BA,QAA1B;AAAA,MAAoCC,MAApC,eAAoCA,MAApC;;AACA,0BAAqB,6CAArB;AAAA,MAAQC,QAAR,qBAAQA,QAAR;;AAEA,MAAMC,WAAW,GAAG,oBAAQ,YAAM;AAChC,QAAIJ,SAAS,IAAIC,QAAjB,EAA2B,OAAO;AAAED,MAAAA,SAAS,EAATA,SAAF;AAAaC,MAAAA,QAAQ,EAARA;AAAb,KAAP;AAC3B,WAAO;AAAED,MAAAA,SAAS,EAAED;AAAb,KAAP;AACD,GAHmB,EAGjB,CAACA,KAAD,EAAQC,SAAR,EAAmBC,QAAnB,CAHiB,CAApB;AAKA,MAAMI,KAAK,GAAG,oBAAQ,YAAM;AAC1B,QAAI,CAACH,MAAL,EAAa,OAAOI,SAAP;AACb,
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/UserAvatar.tsx"],"names":["UserAvatar","props","email","firstName","lastName","avatar","bucketId","avatarProps","image","undefined"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,UAAiC,GAAG,SAApCA,UAAoC,CAACC,KAAD,EAAW;AACnD,oBAA+C,iCAA/C;AAAA,MAAQC,KAAR,eAAQA,KAAR;AAAA,MAAeC,SAAf,eAAeA,SAAf;AAAA,MAA0BC,QAA1B,eAA0BA,QAA1B;AAAA,MAAoCC,MAApC,eAAoCA,MAApC;;AACA,0BAAqB,6CAArB;AAAA,MAAQC,QAAR,qBAAQA,QAAR;;AAEA,MAAMC,WAAW,GAAG,oBAAQ,YAAM;AAChC,QAAIJ,SAAS,IAAIC,QAAjB,EAA2B,OAAO;AAAED,MAAAA,SAAS,EAATA,SAAF;AAAaC,MAAAA,QAAQ,EAARA;AAAb,KAAP;AAC3B,WAAO;AAAED,MAAAA,SAAS,EAAED;AAAb,KAAP;AACD,GAHmB,EAGjB,CAACA,KAAD,EAAQC,SAAR,EAAmBC,QAAnB,CAHiB,CAApB;AAKA,MAAMI,KAAK,GAAG,oBAAQ,YAAM;AAC1B,QAAI,CAACH,MAAL,EAAa,OAAOI,SAAP;AACb,qDAA0CH,QAA1C,oBAA4DD,MAA5D;AACD,GAHa,EAGX,CAACA,MAAD,EAASC,QAAT,CAHW,CAAd;AAKA,sBAAO,6BAAC,YAAD,eAAYC,WAAZ;AAAyB,IAAA,KAAK,EAAEC;AAAhC,KAA2CP,KAA3C,EAAP;AACD,CAfD;;eAiBeD,U","sourcesContent":["import React, { useMemo } from 'react';\nimport { Avatar, AvatarProps } from '@os-design/core';\nimport { useProfile } from './ProfileContext';\nimport { useProfileConfig } from './ProfileConfigContext';\n\nconst UserAvatar: React.FC<AvatarProps> = (props) => {\n const { email, firstName, lastName, avatar } = useProfile();\n const { bucketId } = useProfileConfig();\n\n const avatarProps = useMemo(() => {\n if (firstName || lastName) return { firstName, lastName };\n return { firstName: email };\n }, [email, firstName, lastName]);\n\n const image = useMemo(() => {\n if (!avatar) return undefined;\n return `https://storage.yandexcloud.net/${bucketId}/users/${avatar}`;\n }, [avatar, bucketId]);\n\n return <Avatar {...avatarProps} image={image} {...props} />;\n};\n\nexport default UserAvatar;\n"],"file":"UserAvatar.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"names":["React","useCallback","useMemo","useRef","useState","message","ThemeSwitcher","styled","clr","useTranslation","useMutation","UserAvatar","useProfile","ProfileButton","ProfileUpdateNameModal","ProfileUpdatePasswordModal","AvatarContainer","div","UserContent","FullName","p","theme","sizes","large","Email","inputColorPlaceholder","ActionsContainer","Footer","HiddenInput","input","profileDrawerContentUpdateAvatarMutation","DeleteAvatarButton","t","commit","loading","handler","variables","avatar","onError","error","source","errors","onCompleted","success","UpdateAvatarButton","hasAvatar","fileInputRef","e","target","files","file","uploadables","current","value","click","UpdateNameButton","hasName","modalVisibility","setModalVisibility","ChangePasswordButton","SignOutButton","window","location","href","ProfileDrawerContent","actions","children","email","firstName","lastName","fullName","filter","i","join"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,OAA7B,EAAsCC,MAAtC,EAA8CC,QAA9C,QAA8D,OAA9D;AACA,SAASC,OAAT,EAAkBC,aAAlB,QAAuC,iBAAvC;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,GAAT,QAAoB,oBAApB;AACA,SAASC,cAAT,QAA+B,eAA/B;AACA,SAASC,WAAT,QAA4B,mBAA5B;AAEA,OAAOC,UAAP,MAAuB,cAAvB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,sBAAP,MAAmC,0BAAnC;AACA,OAAOC,0BAAP,MAAuC,8BAAvC;AAYA,MAAMC,eAAe,GAAGT,MAAM,CAACU,GAAI;AACnC;AACA;AACA;AACA;AACA,CALA;AAOA,MAAMC,WAAW,GAAGX,MAAM,CAACU,GAAI;AAC/B;AACA,CAFA;AAIA,MAAME,QAAQ,GAAGZ,MAAM,CAACU,GAAI;AAC5B,eAAgBG,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sBE,MAAtB,CAA8BC,CAAD,IAAOA,CAApC,EAAuCC,IAAvC,CAA4C,GAA5C,CADgB,EAEtB,CAACL,SAAD,EAAYC,QAAZ,CAFsB,CAAxB;AAKA,sBACE,uDACE,oBAAC,eAAD,qBACE,oBAAC,UAAD;AAAY,IAAA,IAAI,EAAC;AAAjB,IADF,eAEE,oBAAC,WAAD,QACGC,QAAQ,iBAAI,oBAAC,QAAD,QAAWA,QAAX,CADf,eAEE,oBAAC,KAAD,QAAQH,KAAR,CAFF,CAFF,CADF,eASE,oBAAC,gBAAD,QACG9B,MAAM,iBAAI,oBAAC,kBAAD,OADb,eAGE,oBAAC,kBAAD;AAAoB,IAAA,SAAS,EAAE,CAAC,CAACA;AAAjC,IAHF,eAIE,oBAAC,gBAAD;AAAkB,IAAA,OAAO,EAAE,CAAC,CAACiC;AAA7B,IAJF,eAKE,oBAAC,oBAAD,OALF,EAOGL,OAPH,eASE,oBAAC,aAAD,OATF,EAWGC,QAXH,CATF,eAuBE,oBAAC,MAAD,qBACE,oBAAC,aAAD,OADF,CAvBF,CADF;AA6BD,CAxCD;;AA0CA,eAAeF,oBAAf","sourcesContent":["import React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { message, ThemeSwitcher } from '@os-design/core';\nimport styled from '@emotion/styled';\nimport { clr } from '@os-design/theming';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport UserAvatar from './UserAvatar';\nimport { useProfile } from './ProfileContext';\nimport ProfileButton from './ProfileButton';\nimport ProfileUpdateNameModal from './ProfileUpdateNameModal';\nimport ProfileUpdatePasswordModal from './ProfileUpdatePasswordModal';\nimport { ProfileDrawerContentSignOutMutation } from './__generated__/ProfileDrawerContentSignOutMutation.graphql';\nimport { ProfileDrawerContentUpdateAvatarMutation } from './__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql';\n\nexport interface ProfileDrawerContentProps {\n /**\n * Additional actions placed under the avatar.\n * @default undefined\n */\n actions?: React.ReactNode;\n}\n\nconst AvatarContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n`;\n\nconst UserContent = styled.div`\n margin-top: 1em;\n`;\n\nconst FullName = styled.div`\n font-size: ${(p) => p.theme.sizes.large}em;\n font-weight: 500;\n text-align: center;\n line-height: 1.2;\n`;\n\nconst Email = styled.div`\n color: ${(p) => clr(p.theme.inputColorPlaceholder)};\n margin-top: 0.2em;\n text-align: center;\n`;\n\nconst ActionsContainer = styled.div`\n margin-top: 1.5em;\n`;\n\nconst Footer = styled.div`\n display: flex;\n justify-content: center;\n margin-top: auto;\n padding-top: 1.5em;\n`;\n\nconst HiddenInput = styled.input`\n display: none;\n`;\n\nconst profileDrawerContentUpdateAvatarMutation = graphql`\n mutation ProfileDrawerContentUpdateAvatarMutation(\n $input: UpdateAvatarInput!\n ) {\n updateAvatar(input: $input) {\n id\n avatar\n }\n }\n`;\n\nconst DeleteAvatarButton: React.FC = () => {\n const { t } = useTranslation('profile');\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentUpdateAvatarMutation>(\n profileDrawerContentUpdateAvatarMutation\n );\n\n const handler = useCallback(() => {\n commit({\n variables: {\n input: { avatar: null },\n },\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n }, [commit, t]);\n\n return (\n <ProfileButton loading={loading} onClick={handler}>\n {t('profile:deleteAvatar')}\n </ProfileButton>\n );\n};\n\ninterface UpdateAvatarButtonProps {\n hasAvatar: boolean;\n}\n\nconst UpdateAvatarButton: React.FC<UpdateAvatarButtonProps> = ({\n hasAvatar,\n}) => {\n const { t } = useTranslation('profile');\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentUpdateAvatarMutation>(\n profileDrawerContentUpdateAvatarMutation\n );\n\n const handler = useCallback(\n (e) => {\n const target = e.target as HTMLInputElement | null;\n if (!target) return;\n\n const { files } = target;\n if (!files) return;\n\n const file = files[0];\n\n commit({\n variables: {\n input: {},\n },\n uploadables: { avatar: file },\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n },\n [commit, t]\n );\n\n return (\n <>\n <ProfileButton\n loading={loading}\n onClick={() => {\n if (!fileInputRef.current) return;\n fileInputRef.current.value = '';\n fileInputRef.current.click();\n }}\n >\n {t(`profile:${hasAvatar ? 'changeAvatar' : 'setAvatar'}`)}\n </ProfileButton>\n\n <HiddenInput\n type='file'\n accept='image/jpeg,image/png,image/webp'\n onChange={handler}\n ref={fileInputRef}\n />\n </>\n );\n};\n\ninterface UpdateNameButtonProps {\n hasName: boolean;\n}\n\nconst UpdateNameButton: React.FC<UpdateNameButtonProps> = ({ hasName }) => {\n const { t } = useTranslation('profile');\n const [modalVisibility, setModalVisibility] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisibility(true)}>\n {t(`profile:${hasName ? 'changeName' : 'setName'}`)}\n </ProfileButton>\n\n <ProfileUpdateNameModal\n visibility={modalVisibility}\n onClose={() => setModalVisibility(false)}\n />\n </>\n );\n};\n\nconst ChangePasswordButton: React.FC = () => {\n const { t } = useTranslation('profile');\n const [modalVisibility, setModalVisibility] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisibility(true)}>\n {t('profile:changePassword')}\n </ProfileButton>\n\n <ProfileUpdatePasswordModal\n visibility={modalVisibility}\n onClose={() => setModalVisibility(false)}\n />\n </>\n );\n};\n\nconst SignOutButton: React.FC = () => {\n const { t } = useTranslation('profile');\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentSignOutMutation>(graphql`\n mutation ProfileDrawerContentSignOutMutation {\n signOut {\n ok\n }\n }\n `);\n\n const handler = useCallback(() => {\n commit({\n variables: {},\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n window.location.href = '/auth/';\n },\n });\n }, [commit]);\n\n return (\n <ProfileButton danger loading={loading} onClick={handler}>\n {t('profile:signOut')}\n </ProfileButton>\n );\n};\n\nconst ProfileDrawerContent: React.FC<ProfileDrawerContentProps> = ({\n actions,\n children,\n}) => {\n const { email, firstName, lastName, avatar } = useProfile();\n\n const fullName = useMemo(\n () => [firstName, lastName].filter((i) => i).join(' '),\n [firstName, lastName]\n );\n\n return (\n <>\n <AvatarContainer>\n <UserAvatar size='10em' />\n <UserContent>\n {fullName && <FullName>{fullName}</FullName>}\n <Email>{email}</Email>\n </UserContent>\n </AvatarContainer>\n\n <ActionsContainer>\n {avatar && <DeleteAvatarButton />}\n\n <UpdateAvatarButton hasAvatar={!!avatar} />\n <UpdateNameButton hasName={!!fullName} />\n <ChangePasswordButton />\n\n {actions}\n\n <SignOutButton />\n\n {children}\n </ActionsContainer>\n\n <Footer>\n <ThemeSwitcher />\n </Footer>\n </>\n );\n};\n\nexport default ProfileDrawerContent;\n"],"file":"ProfileDrawerContent.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"names":["React","useCallback","useMemo","useRef","useState","message","ThemeSwitcher","styled","clr","useTranslation","useMutation","UserAvatar","useProfile","ProfileButton","ProfileUpdateNameModal","ProfileUpdatePasswordModal","AvatarContainer","div","UserContent","FullName","p","theme","sizes","large","Email","inputColorPlaceholder","ActionsContainer","Footer","HiddenInput","input","profileDrawerContentUpdateAvatarMutation","DeleteAvatarButton","t","commit","loading","handler","variables","avatar","onError","error","source","errors","onCompleted","success","UpdateAvatarButton","hasAvatar","fileInputRef","e","target","files","file","uploadables","current","value","click","UpdateNameButton","hasName","modalVisibility","setModalVisibility","ChangePasswordButton","SignOutButton","window","location","href","ProfileDrawerContent","actions","children","email","firstName","lastName","fullName","filter","i","join"],"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,aAAD,OATF,EAWGC,QAXH,CATF,eAuBE,oBAAC,MAAD,qBACE,oBAAC,aAAD,OADF,CAvBF,CADF;AA6BD,CAxCD;;AA0CA,eAAeF,oBAAf","sourcesContent":["import React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { message, ThemeSwitcher } from '@os-design/core';\nimport styled from '@emotion/styled';\nimport { clr } from '@os-design/theming';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport UserAvatar from './UserAvatar';\nimport { useProfile } from './ProfileContext';\nimport ProfileButton from './ProfileButton';\nimport ProfileUpdateNameModal from './ProfileUpdateNameModal';\nimport ProfileUpdatePasswordModal from './ProfileUpdatePasswordModal';\nimport { ProfileDrawerContentSignOutMutation } from './__generated__/ProfileDrawerContentSignOutMutation.graphql';\nimport { ProfileDrawerContentUpdateAvatarMutation } from './__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql';\n\nexport interface ProfileDrawerContentProps {\n /**\n * Additional actions placed under the avatar.\n * @default undefined\n */\n actions?: React.ReactNode;\n /**\n * The children.\n */\n children?: React.ReactNode;\n}\n\nconst AvatarContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n`;\n\nconst UserContent = styled.div`\n margin-top: 1em;\n`;\n\nconst FullName = styled.div`\n font-size: ${(p) => p.theme.sizes.large}em;\n font-weight: 500;\n text-align: center;\n line-height: 1.2;\n`;\n\nconst Email = styled.div`\n color: ${(p) => clr(p.theme.inputColorPlaceholder)};\n margin-top: 0.2em;\n text-align: center;\n`;\n\nconst ActionsContainer = styled.div`\n margin-top: 1.5em;\n`;\n\nconst Footer = styled.div`\n display: flex;\n justify-content: center;\n margin-top: auto;\n padding-top: 1.5em;\n`;\n\nconst HiddenInput = styled.input`\n display: none;\n`;\n\nconst profileDrawerContentUpdateAvatarMutation = graphql`\n mutation ProfileDrawerContentUpdateAvatarMutation(\n $input: UpdateAvatarInput!\n ) {\n updateAvatar(input: $input) {\n id\n avatar\n }\n }\n`;\n\nconst DeleteAvatarButton: React.FC = () => {\n const { t } = useTranslation('profile');\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentUpdateAvatarMutation>(\n profileDrawerContentUpdateAvatarMutation\n );\n\n const handler = useCallback(() => {\n commit({\n variables: {\n input: { avatar: null },\n },\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n }, [commit, t]);\n\n return (\n <ProfileButton loading={loading} onClick={handler}>\n {t('profile:deleteAvatar')}\n </ProfileButton>\n );\n};\n\ninterface UpdateAvatarButtonProps {\n hasAvatar: boolean;\n}\n\nconst UpdateAvatarButton: React.FC<UpdateAvatarButtonProps> = ({\n hasAvatar,\n}) => {\n const { t } = useTranslation('profile');\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentUpdateAvatarMutation>(\n profileDrawerContentUpdateAvatarMutation\n );\n\n const handler = useCallback(\n (e) => {\n const target = e.target as HTMLInputElement | null;\n if (!target) return;\n\n const { files } = target;\n if (!files) return;\n\n const file = files[0];\n\n commit({\n variables: {\n input: {},\n },\n uploadables: { avatar: file },\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n message.success(t('profile:updated'));\n },\n });\n },\n [commit, t]\n );\n\n return (\n <>\n <ProfileButton\n loading={loading}\n onClick={() => {\n if (!fileInputRef.current) return;\n fileInputRef.current.value = '';\n fileInputRef.current.click();\n }}\n >\n {t(`profile:${hasAvatar ? 'changeAvatar' : 'setAvatar'}`)}\n </ProfileButton>\n\n <HiddenInput\n type='file'\n accept='image/jpeg,image/png,image/webp'\n onChange={handler}\n ref={fileInputRef}\n />\n </>\n );\n};\n\ninterface UpdateNameButtonProps {\n hasName: boolean;\n}\n\nconst UpdateNameButton: React.FC<UpdateNameButtonProps> = ({ hasName }) => {\n const { t } = useTranslation('profile');\n const [modalVisibility, setModalVisibility] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisibility(true)}>\n {t(`profile:${hasName ? 'changeName' : 'setName'}`)}\n </ProfileButton>\n\n <ProfileUpdateNameModal\n visibility={modalVisibility}\n onClose={() => setModalVisibility(false)}\n />\n </>\n );\n};\n\nconst ChangePasswordButton: React.FC = () => {\n const { t } = useTranslation('profile');\n const [modalVisibility, setModalVisibility] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisibility(true)}>\n {t('profile:changePassword')}\n </ProfileButton>\n\n <ProfileUpdatePasswordModal\n visibility={modalVisibility}\n onClose={() => setModalVisibility(false)}\n />\n </>\n );\n};\n\nconst SignOutButton: React.FC = () => {\n const { t } = useTranslation('profile');\n\n const [commit, loading] =\n useMutation<ProfileDrawerContentSignOutMutation>(graphql`\n mutation ProfileDrawerContentSignOutMutation {\n signOut {\n ok\n }\n }\n `);\n\n const handler = useCallback(() => {\n commit({\n variables: {},\n onError: (error) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n message.error((error as any).source?.errors?.[0]?.message);\n },\n onCompleted: () => {\n window.location.href = '/auth/';\n },\n });\n }, [commit]);\n\n return (\n <ProfileButton danger loading={loading} onClick={handler}>\n {t('profile:signOut')}\n </ProfileButton>\n );\n};\n\nconst ProfileDrawerContent: React.FC<ProfileDrawerContentProps> = ({\n actions,\n children,\n}) => {\n const { email, firstName, lastName, avatar } = useProfile();\n\n const fullName = useMemo(\n () => [firstName, lastName].filter((i) => i).join(' '),\n [firstName, lastName]\n );\n\n return (\n <>\n <AvatarContainer>\n <UserAvatar size='10em' />\n <UserContent>\n {fullName && <FullName>{fullName}</FullName>}\n <Email>{email}</Email>\n </UserContent>\n </AvatarContainer>\n\n <ActionsContainer>\n {avatar && <DeleteAvatarButton />}\n\n <UpdateAvatarButton hasAvatar={!!avatar} />\n <UpdateNameButton hasName={!!fullName} />\n <ChangePasswordButton />\n\n {actions}\n\n <SignOutButton />\n\n {children}\n </ActionsContainer>\n\n <Footer>\n <ThemeSwitcher />\n </Footer>\n </>\n );\n};\n\nexport default ProfileDrawerContent;\n"],"file":"ProfileDrawerContent.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdateNameForm.tsx"],"names":["React","useForm","useFormItem","Alert","Form","FormItem","Input","useTranslation","ProfileUpdateNameForm","children","t","formError","firstName","lastName"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,qBAArC;AACA,SAASC,KAAT,EAAgBC,IAAhB,EAAsBC,QAAtB,EAAgCC,KAAhC,QAA6C,iBAA7C;AACA,SAASC,cAAT,QAA+B,eAA/B;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdateNameForm.tsx"],"names":["React","useForm","useFormItem","Alert","Form","FormItem","Input","useTranslation","ProfileUpdateNameForm","children","t","formError","firstName","lastName"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,qBAArC;AACA,SAASC,KAAT,EAAgBC,IAAhB,EAAsBC,QAAtB,EAAgCC,KAAhC,QAA6C,iBAA7C;AACA,SAASC,cAAT,QAA+B,eAA/B;;AAWA,MAAMC,qBAA2D,GAAG,CAAC;AACnEC,EAAAA;AADmE,CAAD,KAE9D;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAQH,cAAc,CAAC,SAAD,CAA5B;AACA,QAAM;AAAEI,IAAAA;AAAF,MAAgBV,OAAO,EAA7B;AAEA,QAAMW,SAAS,GAAGV,WAAW,CAAC,WAAD,CAA7B;AACA,QAAMW,QAAQ,GAAGX,WAAW,CAAC,UAAD,CAA5B;AAEA,sBACE,oBAAC,IAAD,qBACE,oBAAC,QAAD;AACE,IAAA,KAAK,EAAEQ,CAAC,CAAC,yCAAD;AADV,KAEME,SAAS,CAAC,CAAD,CAFf,gBAIE,oBAAC,KAAD;AACE,IAAA,WAAW,EAAEF,CAAC,CAAC,+CAAD;AADhB,KAEME,SAAS,CAAC,CAAD,CAFf,EAJF,CADF,eAWE,oBAAC,QAAD;AACE,IAAA,KAAK,EAAEF,CAAC,CAAC,wCAAD;AADV,KAEMG,QAAQ,CAAC,CAAD,CAFd,gBAIE,oBAAC,KAAD;AACE,IAAA,WAAW,EAAEH,CAAC,CAAC,8CAAD;AADhB,KAEMG,QAAQ,CAAC,CAAD,CAFd,EAJF,CAXF,EAqBGF,SAAS,iBAAI,oBAAC,KAAD;AAAO,IAAA,IAAI,EAAC;AAAZ,KAAqBA,SAArB,CArBhB,EAuBGF,QAvBH,CADF;AA2BD,CApCD;;AAsCA,eAAeD,qBAAf","sourcesContent":["import React from 'react';\nimport { useForm, useFormItem } from '@os-team/form-utils';\nimport { Alert, Form, FormItem, Input } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\n\nexport interface ProfileUpdateNameFormData {\n firstName: string;\n lastName: string;\n}\n\ninterface ProfileUpdateNameFormProps {\n children?: React.ReactNode;\n}\n\nconst ProfileUpdateNameForm: React.FC<ProfileUpdateNameFormProps> = ({\n children,\n}) => {\n const { t } = useTranslation('profile');\n const { formError } = useForm();\n\n const firstName = useFormItem('firstName');\n const lastName = useFormItem('lastName');\n\n return (\n <Form>\n <FormItem\n label={t('profile:updateNameModal.firstName.label')}\n {...firstName[0]}\n >\n <Input\n placeholder={t('profile:updateNameModal.firstName.placeholder')}\n {...firstName[1]}\n />\n </FormItem>\n\n <FormItem\n label={t('profile:updateNameModal.lastName.label')}\n {...lastName[0]}\n >\n <Input\n placeholder={t('profile:updateNameModal.lastName.placeholder')}\n {...lastName[1]}\n />\n </FormItem>\n\n {formError && <Alert type='error'>{formError}</Alert>}\n\n {children}\n </Form>\n );\n};\n\nexport default ProfileUpdateNameForm;\n"],"file":"ProfileUpdateNameForm.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdatePasswordForm.tsx"],"names":["React","useForm","useFormItem","Alert","Form","FormItem","InputPassword","useTranslation","ProfileUpdatePasswordForm","children","t","formError","currentPassword","password","returnObjects"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,qBAArC;AACA,SAASC,KAAT,EAAgBC,IAAhB,EAAsBC,QAAtB,EAAgCC,aAAhC,QAAqD,iBAArD;AACA,SAASC,cAAT,QAA+B,eAA/B;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProfileUpdatePasswordForm.tsx"],"names":["React","useForm","useFormItem","Alert","Form","FormItem","InputPassword","useTranslation","ProfileUpdatePasswordForm","children","t","formError","currentPassword","password","returnObjects"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,qBAArC;AACA,SAASC,KAAT,EAAgBC,IAAhB,EAAsBC,QAAtB,EAAgCC,aAAhC,QAAqD,iBAArD;AACA,SAASC,cAAT,QAA+B,eAA/B;;AAWA,MAAMC,yBAAmE,GAAG,CAAC;AAC3EC,EAAAA;AAD2E,CAAD,KAEtE;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAQH,cAAc,CAAC,SAAD,CAA5B;AACA,QAAM;AAAEI,IAAAA;AAAF,MAAgBV,OAAO,EAA7B;AAEA,QAAMW,eAAe,GAAGV,WAAW,CAAC,iBAAD,CAAnC;AACA,QAAMW,QAAQ,GAAGX,WAAW,CAAC,UAAD,CAA5B;AAEA,sBACE,oBAAC,IAAD,qBACE,oBAAC,QAAD;AACE,IAAA,KAAK,EAAEQ,CAAC,CAAC,mDAAD;AADV,KAEME,eAAe,CAAC,CAAD,CAFrB,gBAIE,oBAAC,aAAD;AACE,IAAA,WAAW,EAAEF,CAAC,CACZ,yDADY;AADhB,KAIME,eAAe,CAAC,CAAD,CAJrB,EAJF,CADF,eAaE,oBAAC,QAAD;AACE,IAAA,KAAK,EAAEF,CAAC,CAAC,+CAAD;AADV,KAEMG,QAAQ,CAAC,CAAD,CAFd,gBAIE,oBAAC,aAAD;AACE,IAAA,WAAW,EAAEH,CAAC,CAAC,qDAAD,CADhB;AAEE,IAAA,iBAAiB,MAFnB;AAGE,IAAA,aAAa,EAAEA,CAAC,CACd,mDADc,EAEd;AACEI,MAAAA,aAAa,EAAE;AADjB,KAFc;AAHlB,KASMD,QAAQ,CAAC,CAAD,CATd,EAJF,CAbF,EA8BGF,SAAS,iBAAI,oBAAC,KAAD;AAAO,IAAA,IAAI,EAAC;AAAZ,KAAqBA,SAArB,CA9BhB,EAgCGF,QAhCH,CADF;AAoCD,CA7CD;;AA+CA,eAAeD,yBAAf","sourcesContent":["import React from 'react';\nimport { useForm, useFormItem } from '@os-team/form-utils';\nimport { Alert, Form, FormItem, InputPassword } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\n\nexport interface ProfileUpdatePasswordFormData {\n currentPassword: string;\n password: string;\n}\n\ninterface ProfileUpdatePasswordFormProps {\n children?: React.ReactNode;\n}\n\nconst ProfileUpdatePasswordForm: React.FC<ProfileUpdatePasswordFormProps> = ({\n children,\n}) => {\n const { t } = useTranslation('profile');\n const { formError } = useForm();\n\n const currentPassword = useFormItem('currentPassword');\n const password = useFormItem('password');\n\n return (\n <Form>\n <FormItem\n label={t('profile:updatePasswordModal.currentPassword.label')}\n {...currentPassword[0]}\n >\n <InputPassword\n placeholder={t(\n 'profile:updatePasswordModal.currentPassword.placeholder'\n )}\n {...currentPassword[1]}\n />\n </FormItem>\n\n <FormItem\n label={t('profile:updatePasswordModal.newPassword.label')}\n {...password[0]}\n >\n <InputPassword\n placeholder={t('profile:updatePasswordModal.newPassword.placeholder')}\n showStrengthMeter\n strengthNames={t(\n 'profile:updatePasswordModal.passwordStrengthNames',\n {\n returnObjects: true,\n }\n )}\n {...password[1]}\n />\n </FormItem>\n\n {formError && <Alert type='error'>{formError}</Alert>}\n\n {children}\n </Form>\n );\n};\n\nexport default ProfileUpdatePasswordForm;\n"],"file":"ProfileUpdatePasswordForm.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/ProtectedWrapper.tsx"],"names":["React","useMemo","useLazyLoadQuery","ErrorBoundary","ProfileConfigContext","ProfileContext","ProtectedWrapperLoader","children","profile","fetchPolicy","profileContext","id","email","firstName","undefined","lastName","avatar","ProtectedWrapper","bucketId","profileConfigContext","window","location","href"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,QAA+B,OAA/B;AAEA,SAASC,gBAAT,QAAiC,mBAAjC;AACA,SAASC,aAAT,QAA8B,kBAA9B;AACA,OAAOC,oBAAP,MAAiC,wBAAjC;AACA,OAAOC,cAAP,MAA2B,kBAA3B;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/ProtectedWrapper.tsx"],"names":["React","useMemo","useLazyLoadQuery","ErrorBoundary","ProfileConfigContext","ProfileContext","ProtectedWrapperLoader","children","profile","fetchPolicy","profileContext","id","email","firstName","undefined","lastName","avatar","ProtectedWrapper","bucketId","profileConfigContext","window","location","href"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,QAA+B,OAA/B;AAEA,SAASC,gBAAT,QAAiC,mBAAjC;AACA,SAASC,aAAT,QAA8B,kBAA9B;AACA,OAAOC,oBAAP,MAAiC,wBAAjC;AACA,OAAOC,cAAP,MAA2B,kBAA3B;;AAOA,MAAMC,sBAA6D,GAAG,CAAC;AACrEC,EAAAA;AADqE,CAAD,KAEhE;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAcN,gBAAgB,sbAYlC,EAZkC,EAalC;AAAEO,IAAAA,WAAW,EAAE;AAAf,GAbkC,CAApC;AAgBA,QAAMC,cAAc,GAAGT,OAAO,CAC5B,OAAO;AACLU,IAAAA,EAAE,EAAEH,OAAO,CAACG,EADP;AAELC,IAAAA,KAAK,EAAEJ,OAAO,CAACI,KAFV;AAGLC,IAAAA,SAAS,EAAEL,OAAO,CAACK,SAAR,IAAqBC,SAH3B;AAILC,IAAAA,QAAQ,EAAEP,OAAO,CAACO,QAAR,IAAoBD,SAJzB;AAKLE,IAAAA,MAAM,EAAER,OAAO,CAACQ,MAAR,IAAkBF;AALrB,GAAP,CAD4B,EAQ5B,CACEN,OAAO,CAACQ,MADV,EAEER,OAAO,CAACI,KAFV,EAGEJ,OAAO,CAACK,SAHV,EAIEL,OAAO,CAACG,EAJV,EAKEH,OAAO,CAACO,QALV,CAR4B,CAA9B;AAiBA,sBACE,oBAAC,cAAD,CAAgB,QAAhB;AAAyB,IAAA,KAAK,EAAEL;AAAhC,KACGH,QADH,CADF;AAKD,CAzCD;;AAgDA,MAAMU,gBAAiD,GAAG,CAAC;AACzDC,EAAAA,QADyD;AAEzDX,EAAAA;AAFyD,CAAD,KAGpD;AACJ,QAAMY,oBAAoB,GAAGlB,OAAO,CAAC,OAAO;AAAEiB,IAAAA;AAAF,GAAP,CAAD,EAAuB,CAACA,QAAD,CAAvB,CAApC;AAEA,sBACE,oBAAC,oBAAD,CAAsB,QAAtB;AAA+B,IAAA,KAAK,EAAEC;AAAtC,kBACE,oBAAC,aAAD;AACE,IAAA,QAAQ,EAAE,MAAM;AACdC,MAAAA,MAAM,CAACC,QAAP,CAAgBC,IAAhB,GAAuB,QAAvB;AACA,aAAO,IAAP;AACD;AAJH,kBAME,oBAAC,sBAAD,QAAyBf,QAAzB,CANF,CADF,CADF;AAYD,CAlBD;;AAoBA,eAAeU,gBAAf","sourcesContent":["import React, { useMemo } from 'react';\nimport graphql from 'babel-plugin-relay/macro';\nimport { useLazyLoadQuery } from 'react-relay/hooks';\nimport { ErrorBoundary } from '@os-design/utils';\nimport ProfileConfigContext from './ProfileConfigContext';\nimport ProfileContext from './ProfileContext';\nimport { ProtectedWrapperQuery } from './__generated__/ProtectedWrapperQuery.graphql';\n\ninterface ProtectedWrapperLoaderProps {\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapperLoader: React.FC<ProtectedWrapperLoaderProps> = ({\n children,\n}) => {\n const { profile } = useLazyLoadQuery<ProtectedWrapperQuery>(\n graphql`\n query ProtectedWrapperQuery {\n profile {\n id\n email\n firstName\n lastName\n avatar\n }\n }\n `,\n {},\n { fetchPolicy: 'store-or-network' }\n );\n\n const profileContext = useMemo(\n () => ({\n id: profile.id,\n email: profile.email,\n firstName: profile.firstName || undefined,\n lastName: profile.lastName || undefined,\n avatar: profile.avatar || undefined,\n }),\n [\n profile.avatar,\n profile.email,\n profile.firstName,\n profile.id,\n profile.lastName,\n ]\n );\n\n return (\n <ProfileContext.Provider value={profileContext}>\n {children}\n </ProfileContext.Provider>\n );\n};\n\nexport interface ProtectedWrapperProps {\n bucketId: string;\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapper: React.FC<ProtectedWrapperProps> = ({\n bucketId,\n children,\n}) => {\n const profileConfigContext = useMemo(() => ({ bucketId }), [bucketId]);\n\n return (\n <ProfileConfigContext.Provider value={profileConfigContext}>\n <ErrorBoundary\n fallback={() => {\n window.location.href = '/auth/';\n return null;\n }}\n >\n <ProtectedWrapperLoader>{children}</ProtectedWrapperLoader>\n </ErrorBoundary>\n </ProfileConfigContext.Provider>\n );\n};\n\nexport default ProtectedWrapper;\n"],"file":"ProtectedWrapper.js"}
|
|
@@ -26,7 +26,7 @@ const UserAvatar = props => {
|
|
|
26
26
|
}, [email, firstName, lastName]);
|
|
27
27
|
const image = useMemo(() => {
|
|
28
28
|
if (!avatar) return undefined;
|
|
29
|
-
return `https://storage.
|
|
29
|
+
return `https://storage.yandexcloud.net/${bucketId}/users/${avatar}`;
|
|
30
30
|
}, [avatar, bucketId]);
|
|
31
31
|
return /*#__PURE__*/React.createElement(Avatar, _extends({}, avatarProps, {
|
|
32
32
|
image: image
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/profile/UserAvatar.tsx"],"names":["React","useMemo","Avatar","useProfile","useProfileConfig","UserAvatar","props","email","firstName","lastName","avatar","bucketId","avatarProps","image","undefined"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,QAA+B,OAA/B;AACA,SAASC,MAAT,QAAoC,iBAApC;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,gBAAT,QAAiC,wBAAjC;;AAEA,MAAMC,UAAiC,GAAIC,KAAD,IAAW;AACnD,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,SAAT;AAAoBC,IAAAA,QAApB;AAA8BC,IAAAA;AAA9B,MAAyCP,UAAU,EAAzD;AACA,QAAM;AAAEQ,IAAAA;AAAF,MAAeP,gBAAgB,EAArC;AAEA,QAAMQ,WAAW,GAAGX,OAAO,CAAC,MAAM;AAChC,QAAIO,SAAS,IAAIC,QAAjB,EAA2B,OAAO;AAAED,MAAAA,SAAF;AAAaC,MAAAA;AAAb,KAAP;AAC3B,WAAO;AAAED,MAAAA,SAAS,EAAED;AAAb,KAAP;AACD,GAH0B,EAGxB,CAACA,KAAD,EAAQC,SAAR,EAAmBC,QAAnB,CAHwB,CAA3B;AAKA,QAAMI,KAAK,GAAGZ,OAAO,CAAC,MAAM;AAC1B,QAAI,CAACS,MAAL,EAAa,OAAOI,SAAP;AACb,WAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/profile/UserAvatar.tsx"],"names":["React","useMemo","Avatar","useProfile","useProfileConfig","UserAvatar","props","email","firstName","lastName","avatar","bucketId","avatarProps","image","undefined"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,QAA+B,OAA/B;AACA,SAASC,MAAT,QAAoC,iBAApC;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,gBAAT,QAAiC,wBAAjC;;AAEA,MAAMC,UAAiC,GAAIC,KAAD,IAAW;AACnD,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,SAAT;AAAoBC,IAAAA,QAApB;AAA8BC,IAAAA;AAA9B,MAAyCP,UAAU,EAAzD;AACA,QAAM;AAAEQ,IAAAA;AAAF,MAAeP,gBAAgB,EAArC;AAEA,QAAMQ,WAAW,GAAGX,OAAO,CAAC,MAAM;AAChC,QAAIO,SAAS,IAAIC,QAAjB,EAA2B,OAAO;AAAED,MAAAA,SAAF;AAAaC,MAAAA;AAAb,KAAP;AAC3B,WAAO;AAAED,MAAAA,SAAS,EAAED;AAAb,KAAP;AACD,GAH0B,EAGxB,CAACA,KAAD,EAAQC,SAAR,EAAmBC,QAAnB,CAHwB,CAA3B;AAKA,QAAMI,KAAK,GAAGZ,OAAO,CAAC,MAAM;AAC1B,QAAI,CAACS,MAAL,EAAa,OAAOI,SAAP;AACb,WAAQ,mCAAkCH,QAAS,UAASD,MAAO,EAAnE;AACD,GAHoB,EAGlB,CAACA,MAAD,EAASC,QAAT,CAHkB,CAArB;AAKA,sBAAO,oBAAC,MAAD,eAAYC,WAAZ;AAAyB,IAAA,KAAK,EAAEC;AAAhC,KAA2CP,KAA3C,EAAP;AACD,CAfD;;AAiBA,eAAeD,UAAf","sourcesContent":["import React, { useMemo } from 'react';\nimport { Avatar, AvatarProps } from '@os-design/core';\nimport { useProfile } from './ProfileContext';\nimport { useProfileConfig } from './ProfileConfigContext';\n\nconst UserAvatar: React.FC<AvatarProps> = (props) => {\n const { email, firstName, lastName, avatar } = useProfile();\n const { bucketId } = useProfileConfig();\n\n const avatarProps = useMemo(() => {\n if (firstName || lastName) return { firstName, lastName };\n return { firstName: email };\n }, [email, firstName, lastName]);\n\n const image = useMemo(() => {\n if (!avatar) return undefined;\n return `https://storage.yandexcloud.net/${bucketId}/users/${avatar}`;\n }, [avatar, bucketId]);\n\n return <Avatar {...avatarProps} image={image} {...props} />;\n};\n\nexport default UserAvatar;\n"],"file":"UserAvatar.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawerContent.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAetE,MAAM,WAAW,yBAAyB;IAKxC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ProfileDrawerContent.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAetE,MAAM,WAAW,yBAAyB;IAKxC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAI1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AA2ND,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAwC7D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -3,6 +3,9 @@ export interface ProfileUpdateNameFormData {
|
|
|
3
3
|
firstName: string;
|
|
4
4
|
lastName: string;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
interface ProfileUpdateNameFormProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const ProfileUpdateNameForm: React.FC<ProfileUpdateNameFormProps>;
|
|
7
10
|
export default ProfileUpdateNameForm;
|
|
8
11
|
//# sourceMappingURL=ProfileUpdateNameForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileUpdateNameForm.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/profile/ProfileUpdateNameForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"ProfileUpdateNameForm.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/profile/ProfileUpdateNameForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,0BAA0B;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAoC/D,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -3,6 +3,9 @@ export interface ProfileUpdatePasswordFormData {
|
|
|
3
3
|
currentPassword: string;
|
|
4
4
|
password: string;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
interface ProfileUpdatePasswordFormProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const ProfileUpdatePasswordForm: React.FC<ProfileUpdatePasswordFormProps>;
|
|
7
10
|
export default ProfileUpdatePasswordForm;
|
|
8
11
|
//# sourceMappingURL=ProfileUpdatePasswordForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileUpdatePasswordForm.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/profile/ProfileUpdatePasswordForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,yBAAyB,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"ProfileUpdatePasswordForm.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/profile/ProfileUpdatePasswordForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,8BAA8B;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,QAAA,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CA6CvE,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProtectedWrapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/profile/ProtectedWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ProtectedWrapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/profile/ProtectedWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAuDvC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAkBrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@os-team/profile",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/profile.git",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -41,68 +41,68 @@
|
|
|
41
41
|
"registry": "https://registry.npmjs.org"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@os-design/core": "^1.0.
|
|
45
|
-
"@os-design/icons": "^1.0.
|
|
46
|
-
"@os-design/media": "^1.0.
|
|
47
|
-
"@os-design/styles": "^1.0.
|
|
48
|
-
"@os-design/theming": "^1.0.
|
|
49
|
-
"@os-design/utils": "^1.0.
|
|
50
|
-
"@os-team/form-utils": "^1.0.
|
|
44
|
+
"@os-design/core": "^1.0.120",
|
|
45
|
+
"@os-design/icons": "^1.0.34",
|
|
46
|
+
"@os-design/media": "^1.0.11",
|
|
47
|
+
"@os-design/styles": "^1.0.32",
|
|
48
|
+
"@os-design/theming": "^1.0.30",
|
|
49
|
+
"@os-design/utils": "^1.0.45",
|
|
50
|
+
"@os-team/form-utils": "^1.0.31",
|
|
51
51
|
"@os-team/plural-forms": "^1.0.10"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@babel/cli": "^7.17.
|
|
55
|
-
"@babel/core": "^7.17.
|
|
54
|
+
"@babel/cli": "^7.17.6",
|
|
55
|
+
"@babel/core": "^7.17.9",
|
|
56
56
|
"@babel/preset-env": "^7.16.11",
|
|
57
57
|
"@babel/preset-react": "^7.16.7",
|
|
58
58
|
"@babel/preset-typescript": "^7.16.7",
|
|
59
|
-
"@emotion/react": "^11.
|
|
60
|
-
"@emotion/serialize": "^1.0.
|
|
61
|
-
"@emotion/styled": "^11.
|
|
59
|
+
"@emotion/react": "^11.9.0",
|
|
60
|
+
"@emotion/serialize": "^1.0.3",
|
|
61
|
+
"@emotion/styled": "^11.8.1",
|
|
62
62
|
"@os-team/prettier-config": "1.1.8",
|
|
63
|
-
"@os-team/relay-network-creator": "^1.1.
|
|
64
|
-
"@os-team/relay-network-mw-credentials": "^1.1.
|
|
65
|
-
"@os-team/relay-network-mw-upload": "^1.1.
|
|
66
|
-
"@types/jest": "^27.4.
|
|
67
|
-
"@types/node": "^17.0.
|
|
68
|
-
"@types/react": "^
|
|
69
|
-
"@types/react-dom": "^
|
|
70
|
-
"@types/react-relay": "^13.0.
|
|
63
|
+
"@os-team/relay-network-creator": "^1.1.9",
|
|
64
|
+
"@os-team/relay-network-mw-credentials": "^1.1.15",
|
|
65
|
+
"@os-team/relay-network-mw-upload": "^1.1.15",
|
|
66
|
+
"@types/jest": "^27.4.1",
|
|
67
|
+
"@types/node": "^17.0.25",
|
|
68
|
+
"@types/react": "^18.0.5",
|
|
69
|
+
"@types/react-dom": "^18.0.1",
|
|
70
|
+
"@types/react-relay": "^13.0.2",
|
|
71
71
|
"@types/react-router-dom": "^5.3.3",
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
73
|
-
"@typescript-eslint/parser": "^5.
|
|
74
|
-
"babel-plugin-relay": "^13.
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^5.19.0",
|
|
73
|
+
"@typescript-eslint/parser": "^5.19.0",
|
|
74
|
+
"babel-plugin-relay": "^13.2.0",
|
|
75
75
|
"cross-env": "^7.0.3",
|
|
76
|
-
"eslint": "^8.
|
|
77
|
-
"eslint-config-os-team-react": "1.1.
|
|
78
|
-
"eslint-plugin-import": "^2.
|
|
79
|
-
"eslint-plugin-jest": "^26.1.
|
|
76
|
+
"eslint": "^8.13.0",
|
|
77
|
+
"eslint-config-os-team-react": "1.1.35",
|
|
78
|
+
"eslint-plugin-import": "^2.26.0",
|
|
79
|
+
"eslint-plugin-jest": "^26.1.4",
|
|
80
80
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
81
81
|
"eslint-plugin-promise": "^6.0.0",
|
|
82
|
-
"eslint-plugin-react": "^7.
|
|
83
|
-
"eslint-plugin-react-hooks": "^4.
|
|
82
|
+
"eslint-plugin-react": "^7.29.4",
|
|
83
|
+
"eslint-plugin-react-hooks": "^4.4.0",
|
|
84
84
|
"get-graphql-schema": "^2.1.2",
|
|
85
85
|
"graphql": "^15.7.2",
|
|
86
86
|
"husky": "^7.0.4",
|
|
87
|
-
"i18next": "^21.6.
|
|
88
|
-
"i18next-browser-languagedetector": "^6.1.
|
|
89
|
-
"i18next-http-backend": "^1.
|
|
87
|
+
"i18next": "^21.6.16",
|
|
88
|
+
"i18next-browser-languagedetector": "^6.1.4",
|
|
89
|
+
"i18next-http-backend": "^1.4.0",
|
|
90
90
|
"lazysizes": "^5.3.2",
|
|
91
|
-
"lint-staged": "^12.3.
|
|
91
|
+
"lint-staged": "^12.3.8",
|
|
92
92
|
"npm-run-all": "^4.1.5",
|
|
93
|
-
"prettier": "2.
|
|
93
|
+
"prettier": "2.6.2",
|
|
94
94
|
"progress-bar-webpack-plugin": "^2.1.0",
|
|
95
|
-
"react": "
|
|
96
|
-
"react-dom": "
|
|
97
|
-
"react-i18next": "^11.
|
|
98
|
-
"react-relay": "
|
|
99
|
-
"react-router-dom": "^6.
|
|
95
|
+
"react": "^18.0.0",
|
|
96
|
+
"react-dom": "^18.0.0",
|
|
97
|
+
"react-i18next": "^11.16.6",
|
|
98
|
+
"react-relay": "^13.2.0",
|
|
99
|
+
"react-router-dom": "^6.3.0",
|
|
100
100
|
"react-scripts": "^4.0.3",
|
|
101
|
-
"react-test-renderer": "^
|
|
102
|
-
"relay-compiler": "^13.
|
|
103
|
-
"relay-runtime": "^13.
|
|
104
|
-
"release-it": "^14.
|
|
105
|
-
"typescript": "^4.
|
|
101
|
+
"react-test-renderer": "^18.0.0",
|
|
102
|
+
"relay-compiler": "^13.2.0",
|
|
103
|
+
"relay-runtime": "^13.2.0",
|
|
104
|
+
"release-it": "^14.14.2",
|
|
105
|
+
"typescript": "^4.6.3",
|
|
106
106
|
"webpack-bundle-analyzer": "^4.5.0"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
@@ -118,10 +118,10 @@
|
|
|
118
118
|
"i18next-browser-languagedetector": ">=6",
|
|
119
119
|
"i18next-http-backend": ">=1",
|
|
120
120
|
"lazysizes": ">=5",
|
|
121
|
-
"react": "
|
|
122
|
-
"react-dom": "
|
|
121
|
+
"react": "^18.0.0",
|
|
122
|
+
"react-dom": "^18.0.0",
|
|
123
123
|
"react-i18next": ">=11",
|
|
124
|
-
"react-relay": "
|
|
124
|
+
"react-relay": "^13.2.0",
|
|
125
125
|
"react-router-dom": ">=5",
|
|
126
126
|
"react-scripts": ">=4",
|
|
127
127
|
"relay-compiler": ">=12",
|