@os-team/profile 1.0.47 → 1.0.49
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 +4 -9
- package/dist/cjs/components/profile/ProfileDrawerContent.js.map +1 -1
- package/dist/cjs/components/session/SessionList.js +2 -2
- package/dist/cjs/components/session/SessionList.js.map +1 -1
- package/dist/cjs/components/shared/ErrorResult.js +3 -5
- package/dist/cjs/components/shared/ErrorResult.js.map +1 -1
- package/dist/cjs/utils/getErrorMessage.js +43 -0
- package/dist/cjs/utils/getErrorMessage.js.map +1 -0
- package/dist/esm/components/profile/ProfileDrawerContent.js +4 -15
- package/dist/esm/components/profile/ProfileDrawerContent.js.map +1 -1
- package/dist/esm/components/session/SessionList.js +2 -2
- package/dist/esm/components/session/SessionList.js.map +1 -1
- package/dist/esm/components/shared/ErrorResult.js +3 -5
- package/dist/esm/components/shared/ErrorResult.js.map +1 -1
- package/dist/esm/utils/getErrorMessage.js +36 -0
- package/dist/esm/utils/getErrorMessage.js.map +1 -0
- package/dist/types/src/lib/components/profile/ProfileDrawer.d.ts +1 -1
- package/dist/types/src/lib/components/profile/ProfileDrawer.d.ts.map +1 -1
- package/dist/types/src/lib/components/profile/ProfileDrawerContent.d.ts.map +1 -1
- package/dist/types/src/lib/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.d.ts +3 -3
- package/dist/types/src/lib/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts +4 -4
- package/dist/types/src/lib/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/profile/__generated__/ProfileDrawerSignOutMutation.graphql.d.ts +3 -3
- package/dist/types/src/lib/components/profile/__generated__/ProfileDrawerSignOutMutation.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/profile/__generated__/ProfileDrawerUpdateAvatarMutation.graphql.d.ts +4 -4
- package/dist/types/src/lib/components/profile/__generated__/ProfileDrawerUpdateAvatarMutation.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.d.ts +4 -4
- package/dist/types/src/lib/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.d.ts +4 -4
- package/dist/types/src/lib/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/profile/__generated__/ProtectedWrapperQuery.graphql.d.ts +3 -3
- package/dist/types/src/lib/components/profile/__generated__/ProtectedWrapperQuery.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/session/__generated__/SessionDrawerContentQuery.graphql.d.ts +3 -3
- package/dist/types/src/lib/components/session/__generated__/SessionDrawerContentQuery.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.d.ts +3 -3
- package/dist/types/src/lib/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.d.ts +4 -4
- package/dist/types/src/lib/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/session/__generated__/SessionListItem_session.graphql.d.ts +2 -2
- package/dist/types/src/lib/components/session/__generated__/SessionListItem_session.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/session/__generated__/SessionListRefetchQuery.graphql.d.ts +3 -3
- package/dist/types/src/lib/components/session/__generated__/SessionListRefetchQuery.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/session/__generated__/SessionList_sessions.graphql.d.ts +2 -2
- package/dist/types/src/lib/components/session/__generated__/SessionList_sessions.graphql.d.ts.map +1 -1
- package/dist/types/src/lib/components/shared/ErrorResult.d.ts.map +1 -1
- package/dist/types/src/lib/utils/getErrorMessage.d.ts +3 -0
- package/dist/types/src/lib/utils/getErrorMessage.d.ts.map +1 -0
- package/package.json +31 -33
|
@@ -16,6 +16,7 @@ var _ProfileContext = require("./ProfileContext");
|
|
|
16
16
|
var _ProfileButton = _interopRequireDefault(require("./ProfileButton"));
|
|
17
17
|
var _ProfileUpdateNameModal = _interopRequireDefault(require("./ProfileUpdateNameModal"));
|
|
18
18
|
var _ProfileUpdatePasswordModal = _interopRequireDefault(require("./ProfileUpdatePasswordModal"));
|
|
19
|
+
var _getErrorMessage = _interopRequireDefault(require("../../utils/getErrorMessage"));
|
|
19
20
|
var _ProfileDrawerContentUpdateAvatarMutation, _ProfileDrawerContentSignOutMutation, _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
20
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -54,9 +55,7 @@ var DeleteAvatarButton = function DeleteAvatarButton() {
|
|
|
54
55
|
}
|
|
55
56
|
},
|
|
56
57
|
onError: function onError(error) {
|
|
57
|
-
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
-
_core.message.error((_source = error.source) === null || _source === void 0 ? void 0 : (_source$errors = _source.errors) === null || _source$errors === void 0 ? void 0 : (_source$errors$ = _source$errors[0]) === null || _source$errors$ === void 0 ? void 0 : _source$errors$.message);
|
|
58
|
+
return _core.message.error((0, _getErrorMessage.default)(error));
|
|
60
59
|
},
|
|
61
60
|
onCompleted: function onCompleted() {
|
|
62
61
|
_core.message.success(t('profile:updated'));
|
|
@@ -91,9 +90,7 @@ var UpdateAvatarButton = function UpdateAvatarButton(_ref) {
|
|
|
91
90
|
avatar: file
|
|
92
91
|
},
|
|
93
92
|
onError: function onError(error) {
|
|
94
|
-
|
|
95
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
|
-
_core.message.error((_source2 = error.source) === null || _source2 === void 0 ? void 0 : (_source2$errors = _source2.errors) === null || _source2$errors === void 0 ? void 0 : (_source2$errors$ = _source2$errors[0]) === null || _source2$errors$ === void 0 ? void 0 : _source2$errors$.message);
|
|
93
|
+
return _core.message.error((0, _getErrorMessage.default)(error));
|
|
97
94
|
},
|
|
98
95
|
onCompleted: function onCompleted() {
|
|
99
96
|
_core.message.success(t('profile:updated'));
|
|
@@ -162,9 +159,7 @@ var SignOutButton = function SignOutButton() {
|
|
|
162
159
|
commit({
|
|
163
160
|
variables: {},
|
|
164
161
|
onError: function onError(error) {
|
|
165
|
-
|
|
166
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
167
|
-
_core.message.error((_source3 = error.source) === null || _source3 === void 0 ? void 0 : (_source3$errors = _source3.errors) === null || _source3$errors === void 0 ? void 0 : (_source3$errors$ = _source3$errors[0]) === null || _source3$errors$ === void 0 ? void 0 : _source3$errors$.message);
|
|
162
|
+
return _core.message.error((0, _getErrorMessage.default)(error));
|
|
168
163
|
},
|
|
169
164
|
onCompleted: function onCompleted() {
|
|
170
165
|
window.location.href = '/auth/';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawerContent.js","names":["AvatarContainer","styled","div","UserContent","FullName","p","theme","sizes","large","Email","clr","inputColorPlaceholder","ActionsContainer","Footer","HiddenInput","input","profileDrawerContentUpdateAvatarMutation","DeleteAvatarButton","useTranslation","t","useMutation","commit","loading","handler","useCallback","variables","avatar","onError","error","message","source","errors","onCompleted","success","UpdateAvatarButton","hasAvatar","fileInputRef","useRef","e","target","files","file","uploadables","current","value","click","UpdateNameButton","hasName","useState","modalVisibility","setModalVisibility","ChangePasswordButton","SignOutButton","window","location","href","ProfileDrawerContent","actions","children","useProfile","email","firstName","lastName","fullName","useMemo","filter","i","join"],"sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"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"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAsE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBtE,IAAMA,eAAe,GAAGC,eAAM,CAACC,GAAG,wKAKjC;AAED,IAAMC,WAAW,GAAGF,eAAM,CAACC,GAAG,6FAE7B;AAED,IAAME,QAAQ,GAAGH,eAAM,CAACC,GAAG,iKACZ,UAACG,CAAC;EAAA,OAAKA,CAAC,CAACC,KAAK,CAACC,KAAK,CAACC,KAAK;AAAA,EAIxC;AAED,IAAMC,KAAK,GAAGR,eAAM,CAACC,GAAG,uIACb,UAACG,CAAC;EAAA,OAAK,IAAAK,YAAG,EAACL,CAAC,CAACC,KAAK,CAACK,qBAAqB,CAAC;AAAA,EAGnD;AAED,IAAMC,gBAAgB,GAAGX,eAAM,CAACC,GAAG,+FAElC;AAED,IAAMW,MAAM,GAAGZ,eAAM,CAACC,GAAG,mKAKxB;AAED,IAAMY,WAAW,GAAGb,eAAM,CAACc,KAAK,2FAE/B;AAED,IAAMC,wCAAwC,8kBAS7C;AAED,IAAMC,kBAA4B,GAAG,SAA/BA,kBAA4B,GAAS;EACzC,sBAAc,IAAAC,4BAAc,EAAC,CAAC,SAAS,CAAC,CAAC;IAAjCC,CAAC,mBAADA,CAAC;EAET,mBACE,IAAAC,kBAAW,EACTJ,wCAAwC,CACzC;IAAA;IAHIK,MAAM;IAAEC,OAAO;EAKtB,IAAMC,OAAO,GAAG,IAAAC,kBAAW,EAAC,YAAM;IAChCH,MAAM,CAAC;MACLI,SAAS,E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OAAG,CACV,CACR;AAEP,CAAC;AAAC,eAEaF,oBAAoB;AAAA"}
|
|
1
|
+
{"version":3,"file":"ProfileDrawerContent.js","names":["AvatarContainer","styled","div","UserContent","FullName","p","theme","sizes","large","Email","clr","inputColorPlaceholder","ActionsContainer","Footer","HiddenInput","input","profileDrawerContentUpdateAvatarMutation","DeleteAvatarButton","useTranslation","t","useMutation","commit","loading","handler","useCallback","variables","avatar","onError","error","message","getErrorMessage","onCompleted","success","UpdateAvatarButton","hasAvatar","fileInputRef","useRef","e","target","files","file","uploadables","current","value","click","UpdateNameButton","hasName","useState","modalVisibility","setModalVisibility","ChangePasswordButton","SignOutButton","window","location","href","ProfileDrawerContent","actions","children","useProfile","email","firstName","lastName","fullName","useMemo","filter","i","join"],"sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"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';\nimport getErrorMessage from '../../utils/getErrorMessage';\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) => message.error(getErrorMessage(error)),\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) => message.error(getErrorMessage(error)),\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) => message.error(getErrorMessage(error)),\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"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAGA;AAA0D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAc1D,IAAMA,eAAe,GAAGC,eAAM,CAACC,GAAG,wKAKjC;AAED,IAAMC,WAAW,GAAGF,eAAM,CAACC,GAAG,6FAE7B;AAED,IAAME,QAAQ,GAAGH,eAAM,CAACC,GAAG,iKACZ,UAACG,CAAC;EAAA,OAAKA,CAAC,CAACC,KAAK,CAACC,KAAK,CAACC,KAAK;AAAA,EAIxC;AAED,IAAMC,KAAK,GAAGR,eAAM,CAACC,GAAG,uIACb,UAACG,CAAC;EAAA,OAAK,IAAAK,YAAG,EAACL,CAAC,CAACC,KAAK,CAACK,qBAAqB,CAAC;AAAA,EAGnD;AAED,IAAMC,gBAAgB,GAAGX,eAAM,CAACC,GAAG,+FAElC;AAED,IAAMW,MAAM,GAAGZ,eAAM,CAACC,GAAG,mKAKxB;AAED,IAAMY,WAAW,GAAGb,eAAM,CAACc,KAAK,2FAE/B;AAED,IAAMC,wCAAwC,8kBAS7C;AAED,IAAMC,kBAA4B,GAAG,SAA/BA,kBAA4B,GAAS;EACzC,sBAAc,IAAAC,4BAAc,E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;AAEP,CAAC;AAAC,eAEaF,oBAAoB;AAAA"}
|
|
@@ -23,7 +23,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
23
23
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
24
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
25
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
26
|
-
var
|
|
26
|
+
var sessionsFragment = _SessionList_sessions !== void 0 ? _SessionList_sessions : (_SessionList_sessions = require("./__generated__/SessionList_sessions.graphql"), _SessionList_sessions.hash && _SessionList_sessions.hash !== "1b21c937c7ba795f09bfcb5ada7d2510" && console.error("The definition of 'SessionList_sessions' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _SessionList_sessions);
|
|
27
27
|
var Title = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-weight: 500;\n margin: 1em 1em 0.5em;\n"])));
|
|
28
28
|
exports.Title = Title;
|
|
29
29
|
var List = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border-top: 1px solid ", ";\n border-bottom: 1px solid ", ";\n"])), function (p) {
|
|
@@ -38,7 +38,7 @@ var SESSION_LIST_PADDING_VERTICAL = 0.5;
|
|
|
38
38
|
exports.SESSION_LIST_PADDING_VERTICAL = SESSION_LIST_PADDING_VERTICAL;
|
|
39
39
|
var SessionList = function SessionList(_ref) {
|
|
40
40
|
var sessionsKey = _ref.sessionsKey;
|
|
41
|
-
var _useFragment = (0, _hooks.useFragment)(
|
|
41
|
+
var _useFragment = (0, _hooks.useFragment)(sessionsFragment, sessionsKey),
|
|
42
42
|
sessions = _useFragment.sessions;
|
|
43
43
|
var _useTranslation = (0, _reactI18next.useTranslation)(['profile']),
|
|
44
44
|
t = _useTranslation.t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionList.js","names":["
|
|
1
|
+
{"version":3,"file":"SessionList.js","names":["sessionsFragment","Title","styled","div","List","p","clr","theme","listItemColorBorder","DestroyAllOtherSessionsButton","Button","OtherSessions","SESSION_LIST_PADDING_VERTICAL","SessionList","sessionsKey","useFragment","sessions","useTranslation","t","currentSession","useMemo","find","session","current","otherSessions","filter","sort","a","b","Date","lastSeenAt","getTime","useMutation","commitDestroyAllOtherSessions","loadingDestroyAllOtherSessions","destroyAllOtherSessions","useCallback","variables","updater","store","record","get","sessionRecords","getLinkedRecords","setLinkedRecords","item","getDataID","id","onError","error","message","onCompleted","success","length","map"],"sources":["../../../../src/lib/components/session/SessionList.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport graphql from 'babel-plugin-relay/macro';\nimport { useFragment, useMutation } from 'react-relay/hooks';\nimport { Button, message } from '@os-design/core';\nimport styled from '@emotion/styled';\nimport { useTranslation } from 'react-i18next';\nimport { clr } from '@os-design/theming';\nimport { SessionList_sessions$key } from './__generated__/SessionList_sessions.graphql';\nimport SessionListItem from './SessionListItem';\nimport { SessionListDestroyAllOtherSessionsMutation } from './__generated__/SessionListDestroyAllOtherSessionsMutation.graphql';\n\nconst sessionsFragment = graphql`\n fragment SessionList_sessions on Query\n @refetchable(queryName: \"SessionListRefetchQuery\") {\n sessions {\n id\n current\n lastSeenAt\n ...SessionListItem_session\n }\n }\n`;\n\ninterface SessionListProps {\n sessionsKey: SessionList_sessions$key;\n}\n\nexport const Title = styled.div`\n font-weight: 500;\n margin: 1em 1em 0.5em;\n`;\n\nexport const List = styled.div`\n border-top: 1px solid ${(p) => clr(p.theme.listItemColorBorder)};\n border-bottom: 1px solid ${(p) => clr(p.theme.listItemColorBorder)};\n`;\n\nconst DestroyAllOtherSessionsButton = styled(Button)`\n & > span {\n flex: 1;\n text-align: left;\n }\n`;\n\nconst OtherSessions = styled.div`\n margin-top: 2em;\n`;\n\nexport const SESSION_LIST_PADDING_VERTICAL = 0.5;\n\nconst SessionList: React.FC<SessionListProps> = ({ sessionsKey }) => {\n const { sessions } = useFragment(sessionsFragment, sessionsKey);\n const { t } = useTranslation(['profile']);\n\n const currentSession = useMemo(\n () => sessions.find((session) => session.current),\n [sessions]\n );\n\n const otherSessions = useMemo(\n () =>\n sessions\n .filter((session) => !session.current)\n .sort(\n (a, b) =>\n new Date(b.lastSeenAt).getTime() - new Date(a.lastSeenAt).getTime()\n ),\n [sessions]\n );\n\n const [commitDestroyAllOtherSessions, loadingDestroyAllOtherSessions] =\n useMutation<SessionListDestroyAllOtherSessionsMutation>(graphql`\n mutation SessionListDestroyAllOtherSessionsMutation {\n destroyAllOtherSessions {\n ok\n }\n }\n `);\n\n const destroyAllOtherSessions = useCallback(() => {\n commitDestroyAllOtherSessions({\n variables: {},\n updater: (store) => {\n const record = store.get('client:root');\n if (!record) return;\n\n const sessionRecords = record.getLinkedRecords('sessions');\n if (!sessionRecords) return;\n\n record.setLinkedRecords(\n sessionRecords.filter(\n (item) => item.getDataID() === currentSession?.id\n ),\n 'sessions'\n );\n },\n onError: (error) => {\n message.error(error.message);\n },\n onCompleted: () => {\n message.success(t('profile:sessions.destroyedAllOther'));\n },\n });\n }, [commitDestroyAllOtherSessions, currentSession?.id, t]);\n\n return (\n <>\n {currentSession && (\n <>\n <Title>{t('profile:sessions.current')}</Title>\n <List>\n <SessionListItem sessionKey={currentSession} hideLastSeenAt />\n </List>\n </>\n )}\n\n {otherSessions.length > 0 && (\n <>\n <DestroyAllOtherSessionsButton\n type='ghost'\n danger\n size='small'\n wide='always'\n loading={loadingDestroyAllOtherSessions}\n onClick={destroyAllOtherSessions}\n >\n {t('profile:sessions.destroyAllOther')}\n </DestroyAllOtherSessionsButton>\n\n <OtherSessions>\n <Title>\n {t('profile:sessions.other')} ({otherSessions.length})\n </Title>\n <List>\n {otherSessions.map((session) => (\n <SessionListItem key={session.id} sessionKey={session} />\n ))}\n </List>\n </OtherSessions>\n </>\n )}\n </>\n );\n};\n\nexport default SessionList;\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAAgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGhD,IAAMA,gBAAgB,8aAUrB;AAMM,IAAMC,KAAK,GAAGC,eAAM,CAACC,GAAG,sHAG9B;AAAC;AAEK,IAAMC,IAAI,GAAGF,eAAM,CAACC,GAAG,2IACJ,UAACE,CAAC;EAAA,OAAK,IAAAC,YAAG,EAACD,CAAC,CAACE,KAAK,CAACC,mBAAmB,CAAC;AAAA,GACpC,UAACH,CAAC;EAAA,OAAK,IAAAC,YAAG,EAACD,CAAC,CAACE,KAAK,CAACC,mBAAmB,CAAC;AAAA,EACnE;AAAC;AAEF,IAAMC,6BAA6B,GAAG,IAAAP,eAAM,EAACQ,YAAM,CAAC,iIAKnD;AAED,IAAMC,aAAa,GAAGT,eAAM,CAACC,GAAG,6FAE/B;AAEM,IAAMS,6BAA6B,GAAG,GAAG;AAAC;AAEjD,IAAMC,WAAuC,GAAG,SAA1CA,WAAuC,OAAwB;EAAA,IAAlBC,WAAW,QAAXA,WAAW;EAC5D,mBAAqB,IAAAC,kBAAW,EAACf,gBAAgB,EAAEc,WAAW,CAAC;IAAvDE,QAAQ,gBAARA,QAAQ;EAChB,sBAAc,IAAAC,4BAAc,EAAC,CAAC,SAAS,CAAC,CAAC;IAAjCC,CAAC,mBAADA,CAAC;EAET,IAAMC,cAAc,GAAG,IAAAC,cAAO,EAC5B;IAAA,OAAMJ,QAAQ,CAACK,IAAI,CAAC,UAACC,OA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,CAAC,CAAC,oCAAoC,CAAC,CAAC;MAC1D;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACe,6BAA6B,EAAEd,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAE4B,EAAE,EAAE7B,CAAC,CAAC,CAAC;EAE1D,oBACE,4DACGC,cAAc,iBACb,yEACE,6BAAC,KAAK,QAAED,CAAC,CAAC,0BAA0B,CAAC,CAAS,eAC9C,6BAAC,IAAI,qBACH,6BAAC,wBAAe;IAAC,UAAU,EAAEC,cAAe;IAAC,cAAc;EAAA,EAAG,CACzD,CAEV,EAEAK,aAAa,CAAC6B,MAAM,GAAG,CAAC,iBACvB,yEACE,6BAAC,6BAA6B;IAC5B,IAAI,EAAC,OAAO;IACZ,MAAM;IACN,IAAI,EAAC,OAAO;IACZ,IAAI,EAAC,QAAQ;IACb,OAAO,EAAEnB,8BAA+B;IACxC,OAAO,EAAEC;EAAwB,GAEhCjB,CAAC,CAAC,kCAAkC,CAAC,CACR,eAEhC,6BAAC,aAAa,qBACZ,6BAAC,KAAK,QACHA,CAAC,CAAC,wBAAwB,CAAC,QAAIM,aAAa,CAAC6B,MAAM,MAC9C,eACR,6BAAC,IAAI,QACF7B,aAAa,CAAC8B,GAAG,CAAC,UAAChC,OAAO;IAAA,oBACzB,6BAAC,wBAAe;MAAC,GAAG,EAAEA,OAAO,CAACyB,EAAG;MAAC,UAAU,EAAEzB;IAAQ,EAAG;EAAA,CAC1D,CAAC,CACG,CACO,CAEnB,CACA;AAEP,CAAC;AAAC,eAEaT,WAAW;AAAA"}
|
|
@@ -9,20 +9,18 @@ var _icons = require("@os-design/icons");
|
|
|
9
9
|
var _core = require("@os-design/core");
|
|
10
10
|
var _reactI18next = require("react-i18next");
|
|
11
11
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
12
|
+
var _getErrorMessage = _interopRequireDefault(require("../../utils/getErrorMessage"));
|
|
12
13
|
var _templateObject;
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
15
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
15
16
|
var StyledResult = (0, _styled.default)(_core.Result)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 0 1em;\n"])));
|
|
16
17
|
var ErrorResult = function ErrorResult(_ref) {
|
|
17
|
-
var _source, _source$errors, _source$errors$;
|
|
18
18
|
var error = _ref.error;
|
|
19
19
|
var _useTranslation = (0, _reactI18next.useTranslation)(['common']),
|
|
20
20
|
t = _useTranslation.t;
|
|
21
21
|
return /*#__PURE__*/_react.default.createElement(StyledResult, {
|
|
22
|
-
title: t('common:errorTitle')
|
|
23
|
-
|
|
24
|
-
,
|
|
25
|
-
description: (_source = error.source) === null || _source === void 0 ? void 0 : (_source$errors = _source.errors) === null || _source$errors === void 0 ? void 0 : (_source$errors$ = _source$errors[0]) === null || _source$errors$ === void 0 ? void 0 : _source$errors$.message,
|
|
22
|
+
title: t('common:errorTitle'),
|
|
23
|
+
description: (0, _getErrorMessage.default)(error),
|
|
26
24
|
icon: /*#__PURE__*/_react.default.createElement(_icons.CloseCircle, null)
|
|
27
25
|
});
|
|
28
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorResult.js","names":["StyledResult","styled","Result","ErrorResult","error","useTranslation","t","
|
|
1
|
+
{"version":3,"file":"ErrorResult.js","names":["StyledResult","styled","Result","ErrorResult","error","useTranslation","t","getErrorMessage"],"sources":["../../../../src/lib/components/shared/ErrorResult.tsx"],"sourcesContent":["import React from 'react';\nimport { CloseCircle } from '@os-design/icons';\nimport { Result } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\nimport styled from '@emotion/styled';\nimport getErrorMessage from '../../utils/getErrorMessage';\n\ninterface ErrorResultProps {\n error: Error;\n}\n\nconst StyledResult = styled(Result)`\n margin: 0 1em;\n`;\n\nconst ErrorResult: React.FC<ErrorResultProps> = ({ error }) => {\n const { t } = useTranslation(['common']);\n\n return (\n <StyledResult\n title={t('common:errorTitle')}\n description={getErrorMessage(error)}\n icon={<CloseCircle />}\n />\n );\n};\n\nexport default ErrorResult;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAA0D;AAAA;AAAA;AAM1D,IAAMA,YAAY,GAAG,IAAAC,eAAM,EAACC,YAAM,CAAC,yFAElC;AAED,IAAMC,WAAuC,GAAG,SAA1CA,WAAuC,OAAkB;EAAA,IAAZC,KAAK,QAALA,KAAK;EACtD,sBAAc,IAAAC,4BAAc,EAAC,CAAC,QAAQ,CAAC,CAAC;IAAhCC,CAAC,mBAADA,CAAC;EAET,oBACE,6BAAC,YAAY;IACX,KAAK,EAAEA,CAAC,CAAC,mBAAmB,CAAE;IAC9B,WAAW,EAAE,IAAAC,wBAAe,EAACH,KAAK,CAAE;IACpC,IAAI,eAAE,6BAAC,kBAAW;EAAI,EACtB;AAEN,CAAC;AAAC,eAEaD,WAAW;AAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
9
|
+
|
|
10
|
+
var isObject = function isObject(value) {
|
|
11
|
+
return _typeof(value) === 'object' && !Array.isArray(value) && value !== null;
|
|
12
|
+
};
|
|
13
|
+
var DEFAULT_MESSAGE = 'Error';
|
|
14
|
+
var getErrorMessage = function getErrorMessage(error) {
|
|
15
|
+
if (!isObject(error)) return DEFAULT_MESSAGE;
|
|
16
|
+
var source = error.source;
|
|
17
|
+
var _error$message = error.message,
|
|
18
|
+
message = _error$message === void 0 ? DEFAULT_MESSAGE : _error$message;
|
|
19
|
+
if (!isObject(source) || !Array.isArray(source.errors) || source.errors.length === 0) {
|
|
20
|
+
return message;
|
|
21
|
+
}
|
|
22
|
+
var firstError = source.errors[0];
|
|
23
|
+
if (!isObject(firstError)) {
|
|
24
|
+
return message;
|
|
25
|
+
}
|
|
26
|
+
message = firstError.message || message;
|
|
27
|
+
if (!isObject(firstError.extensions) || !isObject(firstError.extensions.constraints)) {
|
|
28
|
+
return message;
|
|
29
|
+
}
|
|
30
|
+
var constraintKeys = Object.keys(firstError.extensions.constraints);
|
|
31
|
+
if (constraintKeys.length === 0) {
|
|
32
|
+
return message;
|
|
33
|
+
}
|
|
34
|
+
var firstKey = constraintKeys[0];
|
|
35
|
+
var firstConstraint = firstError.extensions.constraints[firstKey];
|
|
36
|
+
if (!isObject(firstConstraint) || typeof firstConstraint.message !== 'string') {
|
|
37
|
+
return message;
|
|
38
|
+
}
|
|
39
|
+
return firstConstraint.message;
|
|
40
|
+
};
|
|
41
|
+
var _default = getErrorMessage;
|
|
42
|
+
exports.default = _default;
|
|
43
|
+
//# sourceMappingURL=getErrorMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getErrorMessage.js","names":["isObject","value","Array","isArray","DEFAULT_MESSAGE","getErrorMessage","error","source","message","errors","length","firstError","extensions","constraints","constraintKeys","Object","keys","firstKey","firstConstraint"],"sources":["../../../src/lib/utils/getErrorMessage.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nconst isObject = (value: any) =>\n typeof value === 'object' && !Array.isArray(value) && value !== null;\n\nconst DEFAULT_MESSAGE = 'Error';\n\nconst getErrorMessage = (error: any) => {\n if (!isObject(error)) return DEFAULT_MESSAGE;\n\n const { source } = error;\n let { message = DEFAULT_MESSAGE } = error;\n if (\n !isObject(source) ||\n !Array.isArray(source.errors) ||\n source.errors.length === 0\n ) {\n return message;\n }\n\n const firstError = source.errors[0];\n if (!isObject(firstError)) {\n return message;\n }\n\n message = firstError.message || message;\n if (\n !isObject(firstError.extensions) ||\n !isObject(firstError.extensions.constraints)\n ) {\n return message;\n }\n\n const constraintKeys = Object.keys(firstError.extensions.constraints);\n if (constraintKeys.length === 0) {\n return message;\n }\n\n const firstKey = constraintKeys[0];\n const firstConstraint = firstError.extensions.constraints[firstKey];\n if (\n !isObject(firstConstraint) ||\n typeof firstConstraint.message !== 'string'\n ) {\n return message;\n }\n\n return firstConstraint.message;\n};\n\nexport default getErrorMessage;\n"],"mappings":";;;;;;;AAAA;;AAEA,IAAMA,QAAQ,GAAG,SAAXA,QAAQ,CAAIC,KAAU;EAAA,OAC1B,QAAOA,KAAK,MAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAIA,KAAK,KAAK,IAAI;AAAA;AAEtE,IAAMG,eAAe,GAAG,OAAO;AAE/B,IAAMC,eAAe,GAAG,SAAlBA,eAAe,CAAIC,KAAU,EAAK;EACtC,IAAI,CAACN,QAAQ,CAACM,KAAK,CAAC,EAAE,OAAOF,eAAe;EAE5C,IAAQG,MAAM,GAAKD,KAAK,CAAhBC,MAAM;EACd,qBAAoCD,KAAK,CAAnCE,OAAO;IAAPA,OAAO,+BAAGJ,eAAe;EAC/B,IACE,CAACJ,QAAQ,CAACO,MAAM,CAAC,IACjB,CAACL,KAAK,CAACC,OAAO,CAACI,MAAM,CAACE,MAAM,CAAC,IAC7BF,MAAM,CAACE,MAAM,CAACC,MAAM,KAAK,CAAC,EAC1B;IACA,OAAOF,OAAO;EAChB;EAEA,IAAMG,UAAU,GAAGJ,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC;EACnC,IAAI,CAACT,QAAQ,CAACW,UAAU,CAAC,EAAE;IACzB,OAAOH,OAAO;EAChB;EAEAA,OAAO,GAAGG,UAAU,CAACH,OAAO,IAAIA,OAAO;EACvC,IACE,CAACR,QAAQ,CAACW,UAAU,CAACC,UAAU,CAAC,IAChC,CAACZ,QAAQ,CAACW,UAAU,CAACC,UAAU,CAACC,WAAW,CAAC,EAC5C;IACA,OAAOL,OAAO;EAChB;EAEA,IAAMM,cAAc,GAAGC,MAAM,CAACC,IAAI,CAACL,UAAU,CAACC,UAAU,CAACC,WAAW,CAAC;EACrE,IAAIC,cAAc,CAACJ,MAAM,KAAK,CAAC,EAAE;IAC/B,OAAOF,OAAO;EAChB;EAEA,IAAMS,QAAQ,GAAGH,cAAc,CAAC,CAAC,CAAC;EAClC,IAAMI,eAAe,GAAGP,UAAU,CAACC,UAAU,CAACC,WAAW,CAACI,QAAQ,CAAC;EACnE,IACE,CAACjB,QAAQ,CAACkB,eAAe,CAAC,IAC1B,OAAOA,eAAe,CAACV,OAAO,KAAK,QAAQ,EAC3C;IACA,OAAOA,OAAO;EAChB;EAEA,OAAOU,eAAe,CAACV,OAAO;AAChC,CAAC;AAAC,eAEaH,eAAe;AAAA"}
|
|
@@ -10,6 +10,7 @@ import { useProfile } from './ProfileContext';
|
|
|
10
10
|
import ProfileButton from './ProfileButton';
|
|
11
11
|
import ProfileUpdateNameModal from './ProfileUpdateNameModal';
|
|
12
12
|
import ProfileUpdatePasswordModal from './ProfileUpdatePasswordModal';
|
|
13
|
+
import getErrorMessage from '../../utils/getErrorMessage';
|
|
13
14
|
const AvatarContainer = styled.div`
|
|
14
15
|
display: flex;
|
|
15
16
|
flex-direction: column;
|
|
@@ -55,11 +56,7 @@ const DeleteAvatarButton = () => {
|
|
|
55
56
|
avatar: null
|
|
56
57
|
}
|
|
57
58
|
},
|
|
58
|
-
onError: error =>
|
|
59
|
-
var _source, _source$errors, _source$errors$;
|
|
60
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
-
message.error((_source = error.source) === null || _source === void 0 ? void 0 : (_source$errors = _source.errors) === null || _source$errors === void 0 ? void 0 : (_source$errors$ = _source$errors[0]) === null || _source$errors$ === void 0 ? void 0 : _source$errors$.message);
|
|
62
|
-
},
|
|
59
|
+
onError: error => message.error(getErrorMessage(error)),
|
|
63
60
|
onCompleted: () => {
|
|
64
61
|
message.success(t('profile:updated'));
|
|
65
62
|
}
|
|
@@ -93,11 +90,7 @@ const UpdateAvatarButton = ({
|
|
|
93
90
|
uploadables: {
|
|
94
91
|
avatar: file
|
|
95
92
|
},
|
|
96
|
-
onError: error =>
|
|
97
|
-
var _source2, _source2$errors, _source2$errors$;
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
-
message.error((_source2 = error.source) === null || _source2 === void 0 ? void 0 : (_source2$errors = _source2.errors) === null || _source2$errors === void 0 ? void 0 : (_source2$errors$ = _source2$errors[0]) === null || _source2$errors$ === void 0 ? void 0 : _source2$errors$.message);
|
|
100
|
-
},
|
|
93
|
+
onError: error => message.error(getErrorMessage(error)),
|
|
101
94
|
onCompleted: () => {
|
|
102
95
|
message.success(t('profile:updated'));
|
|
103
96
|
}
|
|
@@ -151,11 +144,7 @@ const SignOutButton = () => {
|
|
|
151
144
|
const handler = useCallback(() => {
|
|
152
145
|
commit({
|
|
153
146
|
variables: {},
|
|
154
|
-
onError: error =>
|
|
155
|
-
var _source3, _source3$errors, _source3$errors$;
|
|
156
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
157
|
-
message.error((_source3 = error.source) === null || _source3 === void 0 ? void 0 : (_source3$errors = _source3.errors) === null || _source3$errors === void 0 ? void 0 : (_source3$errors$ = _source3$errors[0]) === null || _source3$errors$ === void 0 ? void 0 : _source3$errors$.message);
|
|
158
|
-
},
|
|
147
|
+
onError: error => message.error(getErrorMessage(error)),
|
|
159
148
|
onCompleted: () => {
|
|
160
149
|
window.location.href = '/auth/';
|
|
161
150
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawerContent.js","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"],"sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"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"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACrE,SAASC,OAAO,EAAEC,aAAa,QAAQ,iBAAiB;AACxD,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,GAAG,QAAQ,oBAAoB;AACxC,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,WAAW,QAAQ,mBAAmB;AAE/C,OAAOC,UAAU,MAAM,cAAc;AACrC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,OAAOC,0BAA0B,MAAM,8BAA8B;AAgBrE,MAAMC,eAAe,GAAGT,MAAM,CAACU,GAAI;AACnC;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMC,WAAW,GAAGX,MAAM,CAACU,GAAI;AAC/B;AACA,CAAC;AAED,MAAME,QAAQ,GAAGZ,MAAM,CAACU,GAAI;AAC5B,eAAgBG,CAAC,IAAKA,CAAC,CAACC,KAAK,CAACC,KAAK,CAACC,KAAM;AAC1C;AACA;AACA;AACA,CAAC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ACE,eAElB,oBAAC,gBAAgB,QACd9B,MAAM,iBAAI,oBAAC,kBAAkB,OAAG,eAEjC,oBAAC,kBAAkB;IAAC,SAAS,EAAE,CAAC,CAACA;EAAO,EAAG,eAC3C,oBAAC,gBAAgB;IAAC,OAAO,EAAE,CAAC,CAACiC;EAAS,EAAG,eACzC,oBAAC,oBAAoB,OAAG,EAEvBL,OAAO,eAER,oBAAC,aAAa,OAAG,EAEhBC,QAAQ,CACQ,eAEnB,oBAAC,MAAM,qBACL,oBAAC,aAAa,OAAG,CACV,CACR;AAEP,CAAC;AAED,eAAeF,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"ProfileDrawerContent.js","names":["React","useCallback","useMemo","useRef","useState","message","ThemeSwitcher","styled","clr","useTranslation","useMutation","UserAvatar","useProfile","ProfileButton","ProfileUpdateNameModal","ProfileUpdatePasswordModal","getErrorMessage","AvatarContainer","div","UserContent","FullName","p","theme","sizes","large","Email","inputColorPlaceholder","ActionsContainer","Footer","HiddenInput","input","profileDrawerContentUpdateAvatarMutation","DeleteAvatarButton","t","commit","loading","handler","variables","avatar","onError","error","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"],"sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"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';\nimport getErrorMessage from '../../utils/getErrorMessage';\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) => message.error(getErrorMessage(error)),\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) => message.error(getErrorMessage(error)),\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) => message.error(getErrorMessage(error)),\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"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACrE,SAASC,OAAO,EAAEC,aAAa,QAAQ,iBAAiB;AACxD,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,GAAG,QAAQ,oBAAoB;AACxC,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,WAAW,QAAQ,mBAAmB;AAE/C,OAAOC,UAAU,MAAM,cAAc;AACrC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,sBAAsB,MAAM,0B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AEA,QAAQ,CAAY,eAC5C,oBAAC,KAAK,QAAEH,KAAK,CAAS,CACV,CACE,eAElB,oBAAC,gBAAgB,QACd5B,MAAM,iBAAI,oBAAC,kBAAkB,OAAG,eAEjC,oBAAC,kBAAkB;IAAC,SAAS,EAAE,CAAC,CAACA;EAAO,EAAG,eAC3C,oBAAC,gBAAgB;IAAC,OAAO,EAAE,CAAC,CAAC+B;EAAS,EAAG,eACzC,oBAAC,oBAAoB,OAAG,EAEvBL,OAAO,eAER,oBAAC,aAAa,OAAG,EAEhBC,QAAQ,CACQ,eAEnB,oBAAC,MAAM,qBACL,oBAAC,aAAa,OAAG,CACV,CACR;AAEP,CAAC;AAED,eAAeF,oBAAoB"}
|
|
@@ -6,7 +6,7 @@ import styled from '@emotion/styled';
|
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import { clr } from '@os-design/theming';
|
|
8
8
|
import SessionListItem from './SessionListItem';
|
|
9
|
-
const
|
|
9
|
+
const sessionsFragment = _SessionList_sessions !== void 0 ? _SessionList_sessions : (_SessionList_sessions = require("./__generated__/SessionList_sessions.graphql"), _SessionList_sessions.hash && _SessionList_sessions.hash !== "1b21c937c7ba795f09bfcb5ada7d2510" && console.error("The definition of 'SessionList_sessions' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _SessionList_sessions);
|
|
10
10
|
export const Title = styled.div`
|
|
11
11
|
font-weight: 500;
|
|
12
12
|
margin: 1em 1em 0.5em;
|
|
@@ -30,7 +30,7 @@ const SessionList = ({
|
|
|
30
30
|
}) => {
|
|
31
31
|
const {
|
|
32
32
|
sessions
|
|
33
|
-
} = useFragment(
|
|
33
|
+
} = useFragment(sessionsFragment, sessionsKey);
|
|
34
34
|
const {
|
|
35
35
|
t
|
|
36
36
|
} = useTranslation(['profile']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionList.js","names":["React","useCallback","useMemo","useFragment","useMutation","Button","message","styled","useTranslation","clr","SessionListItem","
|
|
1
|
+
{"version":3,"file":"SessionList.js","names":["React","useCallback","useMemo","useFragment","useMutation","Button","message","styled","useTranslation","clr","SessionListItem","sessionsFragment","Title","div","List","p","theme","listItemColorBorder","DestroyAllOtherSessionsButton","OtherSessions","SESSION_LIST_PADDING_VERTICAL","SessionList","sessionsKey","sessions","t","currentSession","find","session","current","otherSessions","filter","sort","a","b","Date","lastSeenAt","getTime","commitDestroyAllOtherSessions","loadingDestroyAllOtherSessions","destroyAllOtherSessions","variables","updater","store","record","get","sessionRecords","getLinkedRecords","setLinkedRecords","item","getDataID","id","onError","error","onCompleted","success","length","map"],"sources":["../../../../src/lib/components/session/SessionList.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport graphql from 'babel-plugin-relay/macro';\nimport { useFragment, useMutation } from 'react-relay/hooks';\nimport { Button, message } from '@os-design/core';\nimport styled from '@emotion/styled';\nimport { useTranslation } from 'react-i18next';\nimport { clr } from '@os-design/theming';\nimport { SessionList_sessions$key } from './__generated__/SessionList_sessions.graphql';\nimport SessionListItem from './SessionListItem';\nimport { SessionListDestroyAllOtherSessionsMutation } from './__generated__/SessionListDestroyAllOtherSessionsMutation.graphql';\n\nconst sessionsFragment = graphql`\n fragment SessionList_sessions on Query\n @refetchable(queryName: \"SessionListRefetchQuery\") {\n sessions {\n id\n current\n lastSeenAt\n ...SessionListItem_session\n }\n }\n`;\n\ninterface SessionListProps {\n sessionsKey: SessionList_sessions$key;\n}\n\nexport const Title = styled.div`\n font-weight: 500;\n margin: 1em 1em 0.5em;\n`;\n\nexport const List = styled.div`\n border-top: 1px solid ${(p) => clr(p.theme.listItemColorBorder)};\n border-bottom: 1px solid ${(p) => clr(p.theme.listItemColorBorder)};\n`;\n\nconst DestroyAllOtherSessionsButton = styled(Button)`\n & > span {\n flex: 1;\n text-align: left;\n }\n`;\n\nconst OtherSessions = styled.div`\n margin-top: 2em;\n`;\n\nexport const SESSION_LIST_PADDING_VERTICAL = 0.5;\n\nconst SessionList: React.FC<SessionListProps> = ({ sessionsKey }) => {\n const { sessions } = useFragment(sessionsFragment, sessionsKey);\n const { t } = useTranslation(['profile']);\n\n const currentSession = useMemo(\n () => sessions.find((session) => session.current),\n [sessions]\n );\n\n const otherSessions = useMemo(\n () =>\n sessions\n .filter((session) => !session.current)\n .sort(\n (a, b) =>\n new Date(b.lastSeenAt).getTime() - new Date(a.lastSeenAt).getTime()\n ),\n [sessions]\n );\n\n const [commitDestroyAllOtherSessions, loadingDestroyAllOtherSessions] =\n useMutation<SessionListDestroyAllOtherSessionsMutation>(graphql`\n mutation SessionListDestroyAllOtherSessionsMutation {\n destroyAllOtherSessions {\n ok\n }\n }\n `);\n\n const destroyAllOtherSessions = useCallback(() => {\n commitDestroyAllOtherSessions({\n variables: {},\n updater: (store) => {\n const record = store.get('client:root');\n if (!record) return;\n\n const sessionRecords = record.getLinkedRecords('sessions');\n if (!sessionRecords) return;\n\n record.setLinkedRecords(\n sessionRecords.filter(\n (item) => item.getDataID() === currentSession?.id\n ),\n 'sessions'\n );\n },\n onError: (error) => {\n message.error(error.message);\n },\n onCompleted: () => {\n message.success(t('profile:sessions.destroyedAllOther'));\n },\n });\n }, [commitDestroyAllOtherSessions, currentSession?.id, t]);\n\n return (\n <>\n {currentSession && (\n <>\n <Title>{t('profile:sessions.current')}</Title>\n <List>\n <SessionListItem sessionKey={currentSession} hideLastSeenAt />\n </List>\n </>\n )}\n\n {otherSessions.length > 0 && (\n <>\n <DestroyAllOtherSessionsButton\n type='ghost'\n danger\n size='small'\n wide='always'\n loading={loadingDestroyAllOtherSessions}\n onClick={destroyAllOtherSessions}\n >\n {t('profile:sessions.destroyAllOther')}\n </DestroyAllOtherSessionsButton>\n\n <OtherSessions>\n <Title>\n {t('profile:sessions.other')} ({otherSessions.length})\n </Title>\n <List>\n {otherSessions.map((session) => (\n <SessionListItem key={session.id} sessionKey={session} />\n ))}\n </List>\n </OtherSessions>\n </>\n )}\n </>\n );\n};\n\nexport default SessionList;\n"],"mappings":";A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AAC,CAAC,0BAA0B,CAAC,CAAS,eAC9C,oBAAC,IAAI,qBACH,oBAAC,eAAe;IAAC,UAAU,EAAEC,cAAe;IAAC,cAAc;EAAA,EAAG,CACzD,CAEV,EAEAI,aAAa,CAAC0B,MAAM,GAAG,CAAC,iBACvB,uDACE,oBAAC,6BAA6B;IAC5B,IAAI,EAAC,OAAO;IACZ,MAAM;IACN,IAAI,EAAC,OAAO;IACZ,IAAI,EAAC,QAAQ;IACb,OAAO,EAAEjB,8BAA+B;IACxC,OAAO,EAAEC;EAAwB,GAEhCf,CAAC,CAAC,kCAAkC,CAAC,CACR,eAEhC,oBAAC,aAAa,qBACZ,oBAAC,KAAK,QACHA,CAAC,CAAC,wBAAwB,CAAC,QAAIK,aAAa,CAAC0B,MAAM,MAC9C,eACR,oBAAC,IAAI,QACF1B,aAAa,CAAC2B,GAAG,CAAE7B,OAAO,iBACzB,oBAAC,eAAe;IAAC,GAAG,EAAEA,OAAO,CAACuB,EAAG;IAAC,UAAU,EAAEvB;EAAQ,EACvD,CAAC,CACG,CACO,CAEnB,CACA;AAEP,CAAC;AAED,eAAeN,WAAW"}
|
|
@@ -3,21 +3,19 @@ import { CloseCircle } from '@os-design/icons';
|
|
|
3
3
|
import { Result } from '@os-design/core';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import styled from '@emotion/styled';
|
|
6
|
+
import getErrorMessage from '../../utils/getErrorMessage';
|
|
6
7
|
const StyledResult = styled(Result)`
|
|
7
8
|
margin: 0 1em;
|
|
8
9
|
`;
|
|
9
10
|
const ErrorResult = ({
|
|
10
11
|
error
|
|
11
12
|
}) => {
|
|
12
|
-
var _source, _source$errors, _source$errors$;
|
|
13
13
|
const {
|
|
14
14
|
t
|
|
15
15
|
} = useTranslation(['common']);
|
|
16
16
|
return /*#__PURE__*/React.createElement(StyledResult, {
|
|
17
|
-
title: t('common:errorTitle')
|
|
18
|
-
|
|
19
|
-
,
|
|
20
|
-
description: (_source = error.source) === null || _source === void 0 ? void 0 : (_source$errors = _source.errors) === null || _source$errors === void 0 ? void 0 : (_source$errors$ = _source$errors[0]) === null || _source$errors$ === void 0 ? void 0 : _source$errors$.message,
|
|
17
|
+
title: t('common:errorTitle'),
|
|
18
|
+
description: getErrorMessage(error),
|
|
21
19
|
icon: /*#__PURE__*/React.createElement(CloseCircle, null)
|
|
22
20
|
});
|
|
23
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorResult.js","names":["React","CloseCircle","Result","useTranslation","styled","StyledResult","ErrorResult","error","t"
|
|
1
|
+
{"version":3,"file":"ErrorResult.js","names":["React","CloseCircle","Result","useTranslation","styled","getErrorMessage","StyledResult","ErrorResult","error","t"],"sources":["../../../../src/lib/components/shared/ErrorResult.tsx"],"sourcesContent":["import React from 'react';\nimport { CloseCircle } from '@os-design/icons';\nimport { Result } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\nimport styled from '@emotion/styled';\nimport getErrorMessage from '../../utils/getErrorMessage';\n\ninterface ErrorResultProps {\n error: Error;\n}\n\nconst StyledResult = styled(Result)`\n margin: 0 1em;\n`;\n\nconst ErrorResult: React.FC<ErrorResultProps> = ({ error }) => {\n const { t } = useTranslation(['common']);\n\n return (\n <StyledResult\n title={t('common:errorTitle')}\n description={getErrorMessage(error)}\n icon={<CloseCircle />}\n />\n );\n};\n\nexport default ErrorResult;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,cAAc,QAAQ,eAAe;AAC9C,OAAOC,MAAM,MAAM,iBAAiB;AACpC,OAAOC,eAAe,MAAM,6BAA6B;AAMzD,MAAMC,YAAY,GAAGF,MAAM,CAACF,MAAM,CAAE;AACpC;AACA,CAAC;AAED,MAAMK,WAAuC,GAAG,CAAC;EAAEC;AAAM,CAAC,KAAK;EAC7D,MAAM;IAAEC;EAAE,CAAC,GAAGN,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC;EAExC,oBACE,oBAAC,YAAY;IACX,KAAK,EAAEM,CAAC,CAAC,mBAAmB,CAAE;IAC9B,WAAW,EAAEJ,eAAe,CAACG,KAAK,CAAE;IACpC,IAAI,eAAE,oBAAC,WAAW;EAAI,EACtB;AAEN,CAAC;AAED,eAAeD,WAAW"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
const isObject = value => typeof value === 'object' && !Array.isArray(value) && value !== null;
|
|
4
|
+
const DEFAULT_MESSAGE = 'Error';
|
|
5
|
+
const getErrorMessage = error => {
|
|
6
|
+
if (!isObject(error)) return DEFAULT_MESSAGE;
|
|
7
|
+
const {
|
|
8
|
+
source
|
|
9
|
+
} = error;
|
|
10
|
+
let {
|
|
11
|
+
message = DEFAULT_MESSAGE
|
|
12
|
+
} = error;
|
|
13
|
+
if (!isObject(source) || !Array.isArray(source.errors) || source.errors.length === 0) {
|
|
14
|
+
return message;
|
|
15
|
+
}
|
|
16
|
+
const firstError = source.errors[0];
|
|
17
|
+
if (!isObject(firstError)) {
|
|
18
|
+
return message;
|
|
19
|
+
}
|
|
20
|
+
message = firstError.message || message;
|
|
21
|
+
if (!isObject(firstError.extensions) || !isObject(firstError.extensions.constraints)) {
|
|
22
|
+
return message;
|
|
23
|
+
}
|
|
24
|
+
const constraintKeys = Object.keys(firstError.extensions.constraints);
|
|
25
|
+
if (constraintKeys.length === 0) {
|
|
26
|
+
return message;
|
|
27
|
+
}
|
|
28
|
+
const firstKey = constraintKeys[0];
|
|
29
|
+
const firstConstraint = firstError.extensions.constraints[firstKey];
|
|
30
|
+
if (!isObject(firstConstraint) || typeof firstConstraint.message !== 'string') {
|
|
31
|
+
return message;
|
|
32
|
+
}
|
|
33
|
+
return firstConstraint.message;
|
|
34
|
+
};
|
|
35
|
+
export default getErrorMessage;
|
|
36
|
+
//# sourceMappingURL=getErrorMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getErrorMessage.js","names":["isObject","value","Array","isArray","DEFAULT_MESSAGE","getErrorMessage","error","source","message","errors","length","firstError","extensions","constraints","constraintKeys","Object","keys","firstKey","firstConstraint"],"sources":["../../../src/lib/utils/getErrorMessage.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nconst isObject = (value: any) =>\n typeof value === 'object' && !Array.isArray(value) && value !== null;\n\nconst DEFAULT_MESSAGE = 'Error';\n\nconst getErrorMessage = (error: any) => {\n if (!isObject(error)) return DEFAULT_MESSAGE;\n\n const { source } = error;\n let { message = DEFAULT_MESSAGE } = error;\n if (\n !isObject(source) ||\n !Array.isArray(source.errors) ||\n source.errors.length === 0\n ) {\n return message;\n }\n\n const firstError = source.errors[0];\n if (!isObject(firstError)) {\n return message;\n }\n\n message = firstError.message || message;\n if (\n !isObject(firstError.extensions) ||\n !isObject(firstError.extensions.constraints)\n ) {\n return message;\n }\n\n const constraintKeys = Object.keys(firstError.extensions.constraints);\n if (constraintKeys.length === 0) {\n return message;\n }\n\n const firstKey = constraintKeys[0];\n const firstConstraint = firstError.extensions.constraints[firstKey];\n if (\n !isObject(firstConstraint) ||\n typeof firstConstraint.message !== 'string'\n ) {\n return message;\n }\n\n return firstConstraint.message;\n};\n\nexport default getErrorMessage;\n"],"mappings":"AAAA;;AAEA,MAAMA,QAAQ,GAAIC,KAAU,IAC1B,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAIA,KAAK,KAAK,IAAI;AAEtE,MAAMG,eAAe,GAAG,OAAO;AAE/B,MAAMC,eAAe,GAAIC,KAAU,IAAK;EACtC,IAAI,CAACN,QAAQ,CAACM,KAAK,CAAC,EAAE,OAAOF,eAAe;EAE5C,MAAM;IAAEG;EAAO,CAAC,GAAGD,KAAK;EACxB,IAAI;IAAEE,OAAO,GAAGJ;EAAgB,CAAC,GAAGE,KAAK;EACzC,IACE,CAACN,QAAQ,CAACO,MAAM,CAAC,IACjB,CAACL,KAAK,CAACC,OAAO,CAACI,MAAM,CAACE,MAAM,CAAC,IAC7BF,MAAM,CAACE,MAAM,CAACC,MAAM,KAAK,CAAC,EAC1B;IACA,OAAOF,OAAO;EAChB;EAEA,MAAMG,UAAU,GAAGJ,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC;EACnC,IAAI,CAACT,QAAQ,CAACW,UAAU,CAAC,EAAE;IACzB,OAAOH,OAAO;EAChB;EAEAA,OAAO,GAAGG,UAAU,CAACH,OAAO,IAAIA,OAAO;EACvC,IACE,CAACR,QAAQ,CAACW,UAAU,CAACC,UAAU,CAAC,IAChC,CAACZ,QAAQ,CAACW,UAAU,CAACC,UAAU,CAACC,WAAW,CAAC,EAC5C;IACA,OAAOL,OAAO;EAChB;EAEA,MAAMM,cAAc,GAAGC,MAAM,CAACC,IAAI,CAACL,UAAU,CAACC,UAAU,CAACC,WAAW,CAAC;EACrE,IAAIC,cAAc,CAACJ,MAAM,KAAK,CAAC,EAAE;IAC/B,OAAOF,OAAO;EAChB;EAEA,MAAMS,QAAQ,GAAGH,cAAc,CAAC,CAAC,CAAC;EAClC,MAAMI,eAAe,GAAGP,UAAU,CAACC,UAAU,CAACC,WAAW,CAACI,QAAQ,CAAC;EACnE,IACE,CAACjB,QAAQ,CAACkB,eAAe,CAAC,IAC1B,OAAOA,eAAe,CAACV,OAAO,KAAK,QAAQ,EAC3C;IACA,OAAOA,OAAO;EAChB;EAEA,OAAOU,eAAe,CAACV,OAAO;AAChC,CAAC;AAED,eAAeH,eAAe"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DrawerProps } from '@os-design/core';
|
|
3
3
|
import { ProfileDrawerContentProps } from './ProfileDrawerContent';
|
|
4
|
-
export
|
|
4
|
+
export type ProfileDrawerProps = ProfileDrawerContentProps & DrawerProps;
|
|
5
5
|
declare const ProfileDrawer: React.FC<ProfileDrawerProps>;
|
|
6
6
|
export default ProfileDrawer;
|
|
7
7
|
//# sourceMappingURL=ProfileDrawer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawer.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/profile/ProfileDrawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAKnE,
|
|
1
|
+
{"version":3,"file":"ProfileDrawer.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/profile/ProfileDrawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAKnE,MAAM,MAAM,kBAAkB,GAAG,yBAAyB,GAAG,WAAW,CAAC;AAQzE,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAY/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"ProfileDrawerContent.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAgBtE,MAAM,WAAW,yBAAyB;IAKxC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAI1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAkND,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAwC7D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ConcreteRequest } from 'relay-runtime';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type ProfileDrawerContentSignOutMutation$variables = {};
|
|
3
|
+
export type ProfileDrawerContentSignOutMutation$data = {
|
|
4
4
|
readonly signOut: {
|
|
5
5
|
readonly ok: boolean;
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type ProfileDrawerContentSignOutMutation = {
|
|
9
9
|
response: ProfileDrawerContentSignOutMutation$data;
|
|
10
10
|
variables: ProfileDrawerContentSignOutMutation$variables;
|
|
11
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawerContentSignOutMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,
|
|
1
|
+
{"version":3,"file":"ProfileDrawerContentSignOutMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,MAAM,MAAM,6CAA6C,GAAG,EAAE,CAAC;AAC/D,MAAM,MAAM,wCAAwC,GAAG;IACrD,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,mCAAmC,GAAG;IAChD,QAAQ,EAAE,wCAAwC,CAAC;IACnD,SAAS,EAAE,6CAA6C,CAAC;CAC1D,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,eA+CR,CAAC;AAIL,eAAe,IAAI,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ConcreteRequest } from 'relay-runtime';
|
|
2
|
-
export
|
|
2
|
+
export type UpdateAvatarInput = {
|
|
3
3
|
avatar?: any | null;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type ProfileDrawerContentUpdateAvatarMutation$variables = {
|
|
6
6
|
input: UpdateAvatarInput;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type ProfileDrawerContentUpdateAvatarMutation$data = {
|
|
9
9
|
readonly updateAvatar: {
|
|
10
10
|
readonly avatar: string | null;
|
|
11
11
|
readonly id: string;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type ProfileDrawerContentUpdateAvatarMutation = {
|
|
15
15
|
response: ProfileDrawerContentUpdateAvatarMutation$data;
|
|
16
16
|
variables: ProfileDrawerContentUpdateAvatarMutation$variables;
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,
|
|
1
|
+
{"version":3,"file":"ProfileDrawerContentUpdateAvatarMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CACrB,CAAC;AACF,MAAM,MAAM,kDAAkD,GAAG;IAC/D,KAAK,EAAE,iBAAiB,CAAC;CAC1B,CAAC;AACF,MAAM,MAAM,6CAA6C,GAAG;IAC1D,QAAQ,CAAC,YAAY,EAAE;QACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,wCAAwC,GAAG;IACrD,QAAQ,EAAE,6CAA6C,CAAC;IACxD,SAAS,EAAE,kDAAkD,CAAC;CAC/D,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,eAmER,CAAC;AAIL,eAAe,IAAI,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ConcreteRequest } from 'relay-runtime';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type ProfileDrawerSignOutMutation$variables = {};
|
|
3
|
+
export type ProfileDrawerSignOutMutation$data = {
|
|
4
4
|
readonly signOut: {
|
|
5
5
|
readonly ok: boolean;
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type ProfileDrawerSignOutMutation = {
|
|
9
9
|
variables: ProfileDrawerSignOutMutation$variables;
|
|
10
10
|
response: ProfileDrawerSignOutMutation$data;
|
|
11
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawerSignOutMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileDrawerSignOutMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,
|
|
1
|
+
{"version":3,"file":"ProfileDrawerSignOutMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileDrawerSignOutMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,MAAM,MAAM,sCAAsC,GAAG,EAAE,CAAC;AACxD,MAAM,MAAM,iCAAiC,GAAG;IAC9C,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,sCAAsC,CAAC;IAClD,QAAQ,EAAE,iCAAiC,CAAC;CAC7C,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,eA+CR,CAAC;AAIL,eAAe,IAAI,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ConcreteRequest } from 'relay-runtime';
|
|
2
|
-
export
|
|
2
|
+
export type UpdateAvatarInput = {
|
|
3
3
|
avatar?: any | null;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type ProfileDrawerUpdateAvatarMutation$variables = {
|
|
6
6
|
input: UpdateAvatarInput;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type ProfileDrawerUpdateAvatarMutation$data = {
|
|
9
9
|
readonly updateAvatar: {
|
|
10
10
|
readonly id: string;
|
|
11
11
|
readonly avatar: string | null;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type ProfileDrawerUpdateAvatarMutation = {
|
|
15
15
|
variables: ProfileDrawerUpdateAvatarMutation$variables;
|
|
16
16
|
response: ProfileDrawerUpdateAvatarMutation$data;
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawerUpdateAvatarMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileDrawerUpdateAvatarMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,
|
|
1
|
+
{"version":3,"file":"ProfileDrawerUpdateAvatarMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileDrawerUpdateAvatarMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CACrB,CAAC;AACF,MAAM,MAAM,2CAA2C,GAAG;IACxD,KAAK,EAAE,iBAAiB,CAAC;CAC1B,CAAC;AACF,MAAM,MAAM,sCAAsC,GAAG;IACnD,QAAQ,CAAC,YAAY,EAAE;QACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;KAChC,CAAC;CACH,CAAC;AACF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,SAAS,EAAE,2CAA2C,CAAC;IACvD,QAAQ,EAAE,sCAAsC,CAAC;CAClD,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,eAmER,CAAC;AAIL,eAAe,IAAI,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ConcreteRequest } from 'relay-runtime';
|
|
2
|
-
export
|
|
2
|
+
export type UpdateProfileInput = {
|
|
3
3
|
firstName?: string | null;
|
|
4
4
|
lastName?: string | null;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type ProfileUpdateNameModalMutation$variables = {
|
|
7
7
|
input: UpdateProfileInput;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type ProfileUpdateNameModalMutation$data = {
|
|
10
10
|
readonly updateProfile: {
|
|
11
11
|
readonly firstName: string | null;
|
|
12
12
|
readonly lastName: string | null;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type ProfileUpdateNameModalMutation = {
|
|
16
16
|
response: ProfileUpdateNameModalMutation$data;
|
|
17
17
|
variables: ProfileUpdateNameModalMutation$variables;
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileUpdateNameModalMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,
|
|
1
|
+
{"version":3,"file":"ProfileUpdateNameModalMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AACF,MAAM,MAAM,wCAAwC,GAAG;IACrD,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AACF,MAAM,MAAM,mCAAmC,GAAG;IAChD,QAAQ,CAAC,aAAa,EAAE;QACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KAClC,CAAC;CACH,CAAC;AACF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,mCAAmC,CAAC;IAC9C,SAAS,EAAE,wCAAwC,CAAC;CACrD,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,eA0FR,CAAC;AAIL,eAAe,IAAI,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ConcreteRequest } from 'relay-runtime';
|
|
2
|
-
export
|
|
2
|
+
export type UpdatePasswordInput = {
|
|
3
3
|
currentPassword: string;
|
|
4
4
|
password: string;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type ProfileUpdatePasswordModalMutation$variables = {
|
|
7
7
|
input: UpdatePasswordInput;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type ProfileUpdatePasswordModalMutation$data = {
|
|
10
10
|
readonly updatePassword: {
|
|
11
11
|
readonly id: string;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type ProfileUpdatePasswordModalMutation = {
|
|
15
15
|
response: ProfileUpdatePasswordModalMutation$data;
|
|
16
16
|
variables: ProfileUpdatePasswordModalMutation$variables;
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileUpdatePasswordModalMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,
|
|
1
|
+
{"version":3,"file":"ProfileUpdatePasswordModalMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,MAAM,MAAM,mBAAmB,GAAG;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,4CAA4C,GAAG;IACzD,KAAK,EAAE,mBAAmB,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,uCAAuC,GAAG;IACpD,QAAQ,CAAC,cAAc,EAAE;QACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,QAAQ,EAAE,uCAAuC,CAAC;IAClD,SAAS,EAAE,4CAA4C,CAAC;CACzD,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,eA4DR,CAAC;AAIL,eAAe,IAAI,CAAC"}
|
package/dist/types/src/lib/components/profile/__generated__/ProtectedWrapperQuery.graphql.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConcreteRequest } from 'relay-runtime';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type ProtectedWrapperQuery$variables = {};
|
|
3
|
+
export type ProtectedWrapperQuery$data = {
|
|
4
4
|
readonly profile: {
|
|
5
5
|
readonly avatar: string | null;
|
|
6
6
|
readonly email: string;
|
|
@@ -9,7 +9,7 @@ export declare type ProtectedWrapperQuery$data = {
|
|
|
9
9
|
readonly lastName: string | null;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type ProtectedWrapperQuery = {
|
|
13
13
|
response: ProtectedWrapperQuery$data;
|
|
14
14
|
variables: ProtectedWrapperQuery$variables;
|
|
15
15
|
};
|
package/dist/types/src/lib/components/profile/__generated__/ProtectedWrapperQuery.graphql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProtectedWrapperQuery.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProtectedWrapperQuery.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAS,MAAM,eAAe,CAAC;AACvD,
|
|
1
|
+
{"version":3,"file":"ProtectedWrapperQuery.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/profile/__generated__/ProtectedWrapperQuery.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAS,MAAM,eAAe,CAAC;AACvD,MAAM,MAAM,+BAA+B,GAAG,EAAE,CAAC;AACjD,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KAClC,CAAC;CACH,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,0BAA0B,CAAC;IACrC,SAAS,EAAE,+BAA+B,CAAC;CAC5C,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,eA2ER,CAAC;AAIL,eAAe,IAAI,CAAC"}
|
package/dist/types/src/lib/components/session/__generated__/SessionDrawerContentQuery.graphql.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ConcreteRequest } from 'relay-runtime';
|
|
2
2
|
import { FragmentRefs } from "relay-runtime";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type SessionDrawerContentQuery$variables = {};
|
|
4
|
+
export type SessionDrawerContentQuery$data = {
|
|
5
5
|
readonly " $fragmentSpreads": FragmentRefs<"SessionList_sessions">;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type SessionDrawerContentQuery = {
|
|
8
8
|
response: SessionDrawerContentQuery$data;
|
|
9
9
|
variables: SessionDrawerContentQuery$variables;
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionDrawerContentQuery.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionDrawerContentQuery.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAS,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,
|
|
1
|
+
{"version":3,"file":"SessionDrawerContentQuery.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionDrawerContentQuery.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAS,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,MAAM,MAAM,mCAAmC,GAAG,EAAE,CAAC;AACrD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,YAAY,CAAC,sBAAsB,CAAC,CAAC;CACpE,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,8BAA8B,CAAC;IACzC,SAAS,EAAE,mCAAmC,CAAC;CAChD,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,eA2JX,CAAC;AAIF,eAAe,IAAI,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ConcreteRequest } from 'relay-runtime';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type SessionListDestroyAllOtherSessionsMutation$variables = {};
|
|
3
|
+
export type SessionListDestroyAllOtherSessionsMutation$data = {
|
|
4
4
|
readonly destroyAllOtherSessions: {
|
|
5
5
|
readonly ok: boolean;
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type SessionListDestroyAllOtherSessionsMutation = {
|
|
9
9
|
response: SessionListDestroyAllOtherSessionsMutation$data;
|
|
10
10
|
variables: SessionListDestroyAllOtherSessionsMutation$variables;
|
|
11
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionListDestroyAllOtherSessionsMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,
|
|
1
|
+
{"version":3,"file":"SessionListDestroyAllOtherSessionsMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,MAAM,MAAM,oDAAoD,GAAG,EAAE,CAAC;AACtE,MAAM,MAAM,+CAA+C,GAAG;IAC5D,QAAQ,CAAC,uBAAuB,EAAE;QAChC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,0CAA0C,GAAG;IACvD,QAAQ,EAAE,+CAA+C,CAAC;IAC1D,SAAS,EAAE,oDAAoD,CAAC;CACjE,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,eA+CR,CAAC;AAIL,eAAe,IAAI,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ConcreteRequest } from 'relay-runtime';
|
|
2
|
-
export
|
|
2
|
+
export type DestroySessionInput = {
|
|
3
3
|
id: string;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type SessionListItemDestroySessionMutation$variables = {
|
|
6
6
|
input: DestroySessionInput;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type SessionListItemDestroySessionMutation$data = {
|
|
9
9
|
readonly destroySession: {
|
|
10
10
|
readonly ok: boolean;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type SessionListItemDestroySessionMutation = {
|
|
14
14
|
response: SessionListItemDestroySessionMutation$data;
|
|
15
15
|
variables: SessionListItemDestroySessionMutation$variables;
|
|
16
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionListItemDestroySessionMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,
|
|
1
|
+
{"version":3,"file":"SessionListItemDestroySessionMutation.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,eAAe,CAAC;AAC1D,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AACF,MAAM,MAAM,+CAA+C,GAAG;IAC5D,KAAK,EAAE,mBAAmB,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,0CAA0C,GAAG;IACvD,QAAQ,CAAC,cAAc,EAAE;QACvB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,qCAAqC,GAAG;IAClD,QAAQ,EAAE,0CAA0C,CAAC;IACrD,SAAS,EAAE,+CAA+C,CAAC;CAC5D,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,eA4DR,CAAC;AAIL,eAAe,IAAI,CAAC"}
|
package/dist/types/src/lib/components/session/__generated__/SessionListItem_session.graphql.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReaderFragment } from 'relay-runtime';
|
|
2
2
|
import { FragmentRefs } from "relay-runtime";
|
|
3
|
-
export
|
|
3
|
+
export type SessionListItem_session$data = {
|
|
4
4
|
readonly browserName: string | null;
|
|
5
5
|
readonly browserVersion: string | null;
|
|
6
6
|
readonly city: string | null;
|
|
@@ -18,7 +18,7 @@ export declare type SessionListItem_session$data = {
|
|
|
18
18
|
readonly osVersion: string | null;
|
|
19
19
|
readonly " $fragmentType": "SessionListItem_session";
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type SessionListItem_session$key = {
|
|
22
22
|
readonly " $data"?: SessionListItem_session$data;
|
|
23
23
|
readonly " $fragmentSpreads": FragmentRefs<"SessionListItem_session">;
|
|
24
24
|
};
|
package/dist/types/src/lib/components/session/__generated__/SessionListItem_session.graphql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionListItem_session.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionListItem_session.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAY,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,
|
|
1
|
+
{"version":3,"file":"SessionListItem_session.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionListItem_session.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAY,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,gBAAgB,EAAE,yBAAyB,CAAC;CACtD,CAAC;AACF,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,4BAA4B,CAAC;IACjD,QAAQ,CAAC,mBAAmB,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAC;CACvE,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,cAkHX,CAAC;AAIF,eAAe,IAAI,CAAC"}
|
package/dist/types/src/lib/components/session/__generated__/SessionListRefetchQuery.graphql.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ConcreteRequest } from 'relay-runtime';
|
|
2
2
|
import { FragmentRefs } from "relay-runtime";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type SessionListRefetchQuery$variables = {};
|
|
4
|
+
export type SessionListRefetchQuery$data = {
|
|
5
5
|
readonly " $fragmentSpreads": FragmentRefs<"SessionList_sessions">;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type SessionListRefetchQuery = {
|
|
8
8
|
response: SessionListRefetchQuery$data;
|
|
9
9
|
variables: SessionListRefetchQuery$variables;
|
|
10
10
|
};
|
package/dist/types/src/lib/components/session/__generated__/SessionListRefetchQuery.graphql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionListRefetchQuery.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionListRefetchQuery.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAS,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,
|
|
1
|
+
{"version":3,"file":"SessionListRefetchQuery.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionListRefetchQuery.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAS,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,MAAM,MAAM,iCAAiC,GAAG,EAAE,CAAC;AACnD,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,CAAC,mBAAmB,EAAE,YAAY,CAAC,sBAAsB,CAAC,CAAC;CACpE,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,4BAA4B,CAAC;IACvC,SAAS,EAAE,iCAAiC,CAAC;CAC9C,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,eA2JX,CAAC;AAIF,eAAe,IAAI,CAAC"}
|
package/dist/types/src/lib/components/session/__generated__/SessionList_sessions.graphql.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReaderFragment } from 'relay-runtime';
|
|
2
2
|
import { FragmentRefs } from "relay-runtime";
|
|
3
|
-
export
|
|
3
|
+
export type SessionList_sessions$data = {
|
|
4
4
|
readonly sessions: ReadonlyArray<{
|
|
5
5
|
readonly current: boolean;
|
|
6
6
|
readonly id: string;
|
|
@@ -9,7 +9,7 @@ export declare type SessionList_sessions$data = {
|
|
|
9
9
|
}>;
|
|
10
10
|
readonly " $fragmentType": "SessionList_sessions";
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type SessionList_sessions$key = {
|
|
13
13
|
readonly " $data"?: SessionList_sessions$data;
|
|
14
14
|
readonly " $fragmentSpreads": FragmentRefs<"SessionList_sessions">;
|
|
15
15
|
};
|
package/dist/types/src/lib/components/session/__generated__/SessionList_sessions.graphql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionList_sessions.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionList_sessions.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAuB,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,
|
|
1
|
+
{"version":3,"file":"SessionList_sessions.graphql.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/components/session/__generated__/SessionList_sessions.graphql.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAuB,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;QAC/B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;QAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,mBAAmB,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAC;KACvE,CAAC,CAAC;IACH,QAAQ,CAAC,gBAAgB,EAAE,sBAAsB,CAAC;CACnD,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IAC9C,QAAQ,CAAC,mBAAmB,EAAE,YAAY,CAAC,sBAAsB,CAAC,CAAC;CACpE,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,cAoDX,CAAC;AAIF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorResult.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/shared/ErrorResult.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ErrorResult.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/shared/ErrorResult.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,UAAU,gBAAgB;IACxB,KAAK,EAAE,KAAK,CAAC;CACd;AAMD,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAU3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getErrorMessage.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/getErrorMessage.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,eAAe,UAAW,GAAG,QAyClC,CAAC;AAEF,eAAe,eAAe,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.49",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/profile.git",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dev-start": "react-app-rewired start",
|
|
31
31
|
"dev": "yarn relay && npm-run-all dev-start relay:watch",
|
|
32
32
|
"test": "react-app-rewired test --watchAll=false",
|
|
33
|
-
"ncu": "ncu -u
|
|
33
|
+
"ncu": "ncu -u",
|
|
34
34
|
"lint": "eslint --fix .",
|
|
35
35
|
"lint-check": "eslint .",
|
|
36
36
|
"pretty": "prettier --write --ignore-unknown .",
|
|
@@ -42,69 +42,68 @@
|
|
|
42
42
|
"registry": "https://registry.npmjs.org"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@os-design/core": "^1.0.
|
|
46
|
-
"@os-design/icons": "^1.0.
|
|
45
|
+
"@os-design/core": "^1.0.183",
|
|
46
|
+
"@os-design/icons": "^1.0.44",
|
|
47
47
|
"@os-design/media": "^1.0.16",
|
|
48
48
|
"@os-design/styles": "^1.0.41",
|
|
49
49
|
"@os-design/theming": "^1.0.39",
|
|
50
50
|
"@os-design/utils": "^1.0.57",
|
|
51
|
-
"@os-team/form-utils": "^1.0.
|
|
52
|
-
"@os-team/plural-forms": "^1.0.
|
|
51
|
+
"@os-team/form-utils": "^1.0.32",
|
|
52
|
+
"@os-team/plural-forms": "^1.0.11"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@babel/cli": "^7.19.3",
|
|
56
|
-
"@babel/core": "^7.
|
|
57
|
-
"@babel/preset-env": "^7.
|
|
56
|
+
"@babel/core": "^7.20.2",
|
|
57
|
+
"@babel/preset-env": "^7.20.2",
|
|
58
58
|
"@babel/preset-react": "^7.18.6",
|
|
59
59
|
"@babel/preset-typescript": "^7.18.6",
|
|
60
|
-
"@emotion/react": "^11.10.
|
|
61
|
-
"@emotion/serialize": "^1.1.
|
|
62
|
-
"@emotion/styled": "^11.10.
|
|
60
|
+
"@emotion/react": "^11.10.5",
|
|
61
|
+
"@emotion/serialize": "^1.1.1",
|
|
62
|
+
"@emotion/styled": "^11.10.5",
|
|
63
63
|
"@os-team/prettier-config": "1.1.9",
|
|
64
|
-
"@os-team/relay-network-creator": "^1.
|
|
65
|
-
"@os-team/relay-network-mw-
|
|
66
|
-
"@
|
|
67
|
-
"@types/
|
|
68
|
-
"@types/
|
|
69
|
-
"@types/react": "^18.0.
|
|
70
|
-
"@types/react-dom": "^18.0.7",
|
|
64
|
+
"@os-team/relay-network-creator": "^1.2.12",
|
|
65
|
+
"@os-team/relay-network-mw-upload": "^1.2.11",
|
|
66
|
+
"@types/jest": "^29.2.3",
|
|
67
|
+
"@types/node": "^18.11.9",
|
|
68
|
+
"@types/react": "^18.0.25",
|
|
69
|
+
"@types/react-dom": "^18.0.9",
|
|
71
70
|
"@types/react-relay": "^14.1.2",
|
|
72
71
|
"@types/react-router-dom": "^5.3.3",
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
74
|
-
"@typescript-eslint/parser": "^5.
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^5.44.0",
|
|
73
|
+
"@typescript-eslint/parser": "^5.44.0",
|
|
75
74
|
"babel-plugin-relay": "^14.1.0",
|
|
76
75
|
"cross-env": "^7.0.3",
|
|
77
|
-
"eslint": "^8.
|
|
76
|
+
"eslint": "^8.28.0",
|
|
78
77
|
"eslint-config-os-team-react": "1.1.35",
|
|
79
78
|
"eslint-plugin-import": "^2.26.0",
|
|
80
|
-
"eslint-plugin-jest": "^27.1.
|
|
79
|
+
"eslint-plugin-jest": "^27.1.6",
|
|
81
80
|
"eslint-plugin-jsx-a11y": "^6.6.1",
|
|
82
81
|
"eslint-plugin-promise": "^6.1.1",
|
|
83
|
-
"eslint-plugin-react": "^7.31.
|
|
82
|
+
"eslint-plugin-react": "^7.31.11",
|
|
84
83
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
85
84
|
"get-graphql-schema": "^2.1.2",
|
|
86
|
-
"graphql": "^
|
|
87
|
-
"husky": "^8.0.
|
|
88
|
-
"i18next": "^22.0.
|
|
89
|
-
"i18next-browser-languagedetector": "^
|
|
90
|
-
"i18next-http-backend": "^2.0.
|
|
85
|
+
"graphql": "^16.6.0",
|
|
86
|
+
"husky": "^8.0.2",
|
|
87
|
+
"i18next": "^22.0.6",
|
|
88
|
+
"i18next-browser-languagedetector": "^7.0.1",
|
|
89
|
+
"i18next-http-backend": "^2.0.1",
|
|
91
90
|
"lazysizes": "^5.3.2",
|
|
92
|
-
"lint-staged": "^13.0.
|
|
91
|
+
"lint-staged": "^13.0.4",
|
|
93
92
|
"npm-run-all": "^4.1.5",
|
|
94
|
-
"prettier": "2.
|
|
93
|
+
"prettier": "2.8.0",
|
|
95
94
|
"progress-bar-webpack-plugin": "^2.1.0",
|
|
96
95
|
"react": "^18.2.0",
|
|
97
96
|
"react-app-rewired": "^2.2.1",
|
|
98
97
|
"react-dom": "^18.2.0",
|
|
99
98
|
"react-i18next": "^12.0.0",
|
|
100
99
|
"react-relay": "^14.1.0",
|
|
101
|
-
"react-router-dom": "^6.4.
|
|
100
|
+
"react-router-dom": "^6.4.3",
|
|
102
101
|
"react-scripts": "^5.0.1",
|
|
103
102
|
"react-test-renderer": "^18.2.0",
|
|
104
103
|
"relay-compiler": "^14.1.0",
|
|
105
104
|
"relay-runtime": "^14.1.0",
|
|
106
105
|
"release-it": "^15.5.0",
|
|
107
|
-
"typescript": "^4.
|
|
106
|
+
"typescript": "^4.9.3",
|
|
108
107
|
"webpack-bundle-analyzer": "^4.7.0"
|
|
109
108
|
},
|
|
110
109
|
"peerDependencies": {
|
|
@@ -112,7 +111,6 @@
|
|
|
112
111
|
"@emotion/serialize": ">=1",
|
|
113
112
|
"@emotion/styled": ">=11",
|
|
114
113
|
"@os-team/relay-network-creator": ">=1",
|
|
115
|
-
"@os-team/relay-network-mw-credentials": ">=1",
|
|
116
114
|
"@os-team/relay-network-mw-upload": ">=1",
|
|
117
115
|
"babel-plugin-relay": ">=12",
|
|
118
116
|
"graphql": "15",
|