@os-team/profile 1.2.0 → 1.2.1
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/@types/emotion.d.js.map +1 -1
- package/dist/cjs/@types/i18next.d.js.map +1 -1
- package/dist/cjs/components/profile/ProfileButton.js +2 -2
- package/dist/cjs/components/profile/ProfileButton.js.map +1 -1
- package/dist/cjs/components/profile/ProfileConfigContext.js +1 -1
- package/dist/cjs/components/profile/ProfileConfigContext.js.map +1 -1
- package/dist/cjs/components/profile/ProfileContext.js +1 -1
- package/dist/cjs/components/profile/ProfileContext.js.map +1 -1
- package/dist/cjs/components/profile/ProfileDrawer.js +4 -4
- package/dist/cjs/components/profile/ProfileDrawer.js.map +1 -1
- package/dist/cjs/components/profile/ProfileDrawerContent.js +3 -3
- package/dist/cjs/components/profile/ProfileDrawerContent.js.map +1 -1
- package/dist/cjs/components/profile/ProfileNavigationItem.js +2 -2
- package/dist/cjs/components/profile/ProfileNavigationItem.js.map +1 -1
- package/dist/cjs/components/profile/ProfileUpdateNameModal.js +3 -3
- package/dist/cjs/components/profile/ProfileUpdateNameModal.js.map +1 -1
- package/dist/cjs/components/profile/ProfileUpdatePasswordModal.js +3 -3
- package/dist/cjs/components/profile/ProfileUpdatePasswordModal.js.map +1 -1
- package/dist/cjs/components/profile/ProtectedWrapper.js +2 -2
- package/dist/cjs/components/profile/ProtectedWrapper.js.map +1 -1
- package/dist/cjs/components/profile/UserAvatar.js +2 -2
- package/dist/cjs/components/profile/UserAvatar.js.map +1 -1
- package/dist/cjs/components/profile/UserAvatarAddon.js +3 -3
- package/dist/cjs/components/profile/UserAvatarAddon.js.map +1 -1
- package/dist/cjs/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js.map +1 -1
- package/dist/cjs/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js.map +1 -1
- package/dist/cjs/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.js.map +1 -1
- package/dist/cjs/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.js.map +1 -1
- package/dist/cjs/components/profile/__generated__/ProtectedWrapperQuery.graphql.js.map +1 -1
- package/dist/cjs/components/session/SessionDrawer.js +4 -4
- package/dist/cjs/components/session/SessionDrawer.js.map +1 -1
- package/dist/cjs/components/session/SessionDrawerContent.js +2 -2
- package/dist/cjs/components/session/SessionDrawerContent.js.map +1 -1
- package/dist/cjs/components/session/SessionList.js +3 -3
- package/dist/cjs/components/session/SessionList.js.map +1 -1
- package/dist/cjs/components/session/SessionListItem.js +3 -3
- package/dist/cjs/components/session/SessionListItem.js.map +1 -1
- package/dist/cjs/components/session/SessionListSkeleton.js +2 -2
- package/dist/cjs/components/session/SessionListSkeleton.js.map +1 -1
- package/dist/cjs/components/session/__generated__/SessionDrawerContentQuery.graphql.js.map +1 -1
- package/dist/cjs/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.js.map +1 -1
- package/dist/cjs/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.js.map +1 -1
- package/dist/cjs/components/session/__generated__/SessionListItem_session.graphql.js.map +1 -1
- package/dist/cjs/components/session/__generated__/SessionListRefetchQuery.graphql.js.map +1 -1
- package/dist/cjs/components/session/__generated__/SessionList_sessions.graphql.js.map +1 -1
- package/dist/cjs/components/session/formatDate.js.map +1 -1
- package/dist/cjs/components/session/getLastSeen.js.map +1 -1
- package/dist/cjs/components/shared/ButtonUpdate.js +1 -1
- package/dist/cjs/components/shared/ButtonUpdate.js.map +1 -1
- package/dist/cjs/components/shared/ErrorResult.js +2 -2
- package/dist/cjs/components/shared/ErrorResult.js.map +1 -1
- package/dist/cjs/components/shared/FormError.js +1 -1
- package/dist/cjs/components/shared/FormError.js.map +1 -1
- package/dist/cjs/components/shared/MainLoader.js +2 -2
- package/dist/cjs/components/shared/MainLoader.js.map +1 -1
- package/dist/cjs/components/shared/icons/AndroidIcon.js +2 -2
- package/dist/cjs/components/shared/icons/AndroidIcon.js.map +1 -1
- package/dist/cjs/components/shared/icons/AppleIcon.js +2 -2
- package/dist/cjs/components/shared/icons/AppleIcon.js.map +1 -1
- package/dist/cjs/components/shared/icons/BrowserIcon.js +2 -2
- package/dist/cjs/components/shared/icons/BrowserIcon.js.map +1 -1
- package/dist/cjs/components/shared/icons/ProfileIcon.js +2 -2
- package/dist/cjs/components/shared/icons/ProfileIcon.js.map +1 -1
- package/dist/cjs/components/shared/icons/UnknownDeviceIcon.js +2 -2
- package/dist/cjs/components/shared/icons/UnknownDeviceIcon.js.map +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/getError.js.map +1 -1
- package/dist/cjs/utils/getUserFullName.js.map +1 -1
- package/dist/cjs/utils/handleFormErrors.js +1 -1
- package/dist/cjs/utils/handleFormErrors.js.map +1 -1
- package/dist/esm/@types/emotion.d.js.map +1 -1
- package/dist/esm/@types/i18next.d.js.map +1 -1
- package/dist/esm/components/profile/ProfileButton.js +1 -1
- package/dist/esm/components/profile/ProfileButton.js.map +1 -1
- package/dist/esm/components/profile/ProfileConfigContext.js.map +1 -1
- package/dist/esm/components/profile/ProfileContext.js.map +1 -1
- package/dist/esm/components/profile/ProfileDrawer.js +1 -1
- package/dist/esm/components/profile/ProfileDrawer.js.map +1 -1
- package/dist/esm/components/profile/ProfileDrawerContent.js.map +1 -1
- package/dist/esm/components/profile/ProfileNavigationItem.js +1 -1
- package/dist/esm/components/profile/ProfileNavigationItem.js.map +1 -1
- package/dist/esm/components/profile/ProfileUpdateNameModal.js +1 -1
- package/dist/esm/components/profile/ProfileUpdateNameModal.js.map +1 -1
- package/dist/esm/components/profile/ProfileUpdatePasswordModal.js +1 -1
- package/dist/esm/components/profile/ProfileUpdatePasswordModal.js.map +1 -1
- package/dist/esm/components/profile/ProtectedWrapper.js.map +1 -1
- package/dist/esm/components/profile/UserAvatar.js +1 -1
- package/dist/esm/components/profile/UserAvatar.js.map +1 -1
- package/dist/esm/components/profile/UserAvatarAddon.js +1 -1
- package/dist/esm/components/profile/UserAvatarAddon.js.map +1 -1
- package/dist/esm/components/profile/__generated__/ProfileDrawerContentSignOutMutation.graphql.js.map +1 -1
- package/dist/esm/components/profile/__generated__/ProfileDrawerContentUpdateAvatarMutation.graphql.js.map +1 -1
- package/dist/esm/components/profile/__generated__/ProfileUpdateNameModalMutation.graphql.js.map +1 -1
- package/dist/esm/components/profile/__generated__/ProfileUpdatePasswordModalMutation.graphql.js.map +1 -1
- package/dist/esm/components/profile/__generated__/ProtectedWrapperQuery.graphql.js.map +1 -1
- package/dist/esm/components/session/SessionDrawer.js +1 -1
- package/dist/esm/components/session/SessionDrawer.js.map +1 -1
- package/dist/esm/components/session/SessionDrawerContent.js.map +1 -1
- package/dist/esm/components/session/SessionList.js.map +1 -1
- package/dist/esm/components/session/SessionListItem.js.map +1 -1
- package/dist/esm/components/session/SessionListSkeleton.js.map +1 -1
- package/dist/esm/components/session/__generated__/SessionDrawerContentQuery.graphql.js.map +1 -1
- package/dist/esm/components/session/__generated__/SessionListDestroyAllOtherSessionsMutation.graphql.js.map +1 -1
- package/dist/esm/components/session/__generated__/SessionListItemDestroySessionMutation.graphql.js.map +1 -1
- package/dist/esm/components/session/__generated__/SessionListItem_session.graphql.js.map +1 -1
- package/dist/esm/components/session/__generated__/SessionListRefetchQuery.graphql.js.map +1 -1
- package/dist/esm/components/session/__generated__/SessionList_sessions.graphql.js.map +1 -1
- package/dist/esm/components/session/formatDate.js.map +1 -1
- package/dist/esm/components/session/getLastSeen.js.map +1 -1
- package/dist/esm/components/shared/ButtonUpdate.js.map +1 -1
- package/dist/esm/components/shared/ErrorResult.js.map +1 -1
- package/dist/esm/components/shared/FormError.js.map +1 -1
- package/dist/esm/components/shared/MainLoader.js.map +1 -1
- package/dist/esm/components/shared/icons/AndroidIcon.js +1 -1
- package/dist/esm/components/shared/icons/AndroidIcon.js.map +1 -1
- package/dist/esm/components/shared/icons/AppleIcon.js +1 -1
- package/dist/esm/components/shared/icons/AppleIcon.js.map +1 -1
- package/dist/esm/components/shared/icons/BrowserIcon.js +1 -1
- package/dist/esm/components/shared/icons/BrowserIcon.js.map +1 -1
- package/dist/esm/components/shared/icons/ProfileIcon.js +1 -1
- package/dist/esm/components/shared/icons/ProfileIcon.js.map +1 -1
- package/dist/esm/components/shared/icons/UnknownDeviceIcon.js +1 -1
- package/dist/esm/components/shared/icons/UnknownDeviceIcon.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/getError.js.map +1 -1
- package/dist/esm/utils/getUserFullName.js.map +1 -1
- package/dist/esm/utils/handleFormErrors.js.map +1 -1
- package/package.json +38 -38
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emotion.d.js","names":["require"],"sources":["../../../src/lib/@types/emotion.d.ts"],"sourcesContent":["import '@emotion/react';\nimport { Theme as BaseTheme } from '@os-design/theming';\n\ndeclare module '@emotion/react' {\n // eslint-disable-next-line @typescript-eslint/no-empty-interface\n export interface Theme extends BaseTheme {}\n}\n"],"mappings":";;AAAAA,OAAA"}
|
|
1
|
+
{"version":3,"file":"emotion.d.js","names":["require"],"sources":["../../../src/lib/@types/emotion.d.ts"],"sourcesContent":["import '@emotion/react';\nimport { Theme as BaseTheme } from '@os-design/theming';\n\ndeclare module '@emotion/react' {\n // eslint-disable-next-line @typescript-eslint/no-empty-interface\n export interface Theme extends BaseTheme {}\n}\n"],"mappings":";;AAAAA,OAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18next.d.js","names":["require"],"sources":["../../../src/lib/@types/i18next.d.ts"],"sourcesContent":["import 'i18next';\nimport common from '../../../public/locales/en/common.json';\nimport profile from '../../../public/locales/en/profile.json';\n\ndeclare module 'i18next' {\n interface CustomTypeOptions {\n resources: {\n common: typeof common;\n profile: typeof profile;\n };\n }\n}\n"],"mappings":";;AAAAA,OAAA"}
|
|
1
|
+
{"version":3,"file":"i18next.d.js","names":["require"],"sources":["../../../src/lib/@types/i18next.d.ts"],"sourcesContent":["import 'i18next';\nimport common from '../../../public/locales/en/common.json';\nimport profile from '../../../public/locales/en/profile.json';\n\ndeclare module 'i18next' {\n interface CustomTypeOptions {\n resources: {\n common: typeof common;\n profile: typeof profile;\n };\n }\n}\n"],"mappings":";;AAAAA,OAAA","ignoreList":[]}
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _core = require("@os-design/core");
|
|
9
|
-
function _interopRequireDefault(
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
11
|
const ProfileButton = props => /*#__PURE__*/_react.default.createElement(_core.Button, _extends({
|
|
12
12
|
type: "ghost",
|
|
13
13
|
wide: "always"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileButton.js","names":["_react","_interopRequireDefault","require","_core","
|
|
1
|
+
{"version":3,"file":"ProfileButton.js","names":["_react","_interopRequireDefault","require","_core","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","ProfileButton","props","createElement","Button","type","wide","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileButton.tsx"],"sourcesContent":["import React from 'react';\nimport { Button, ButtonProps } from '@os-design/core';\n\nconst ProfileButton: React.FC<ButtonProps> = (props) => (\n <Button type='ghost' wide='always' {...props} />\n);\n\nexport default ProfileButton;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAsD,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAEtD,MAAMO,aAAoC,GAAIC,KAAK,iBACjDpB,MAAA,CAAAM,OAAA,CAAAe,aAAA,CAAClB,KAAA,CAAAmB,MAAM,EAAAf,QAAA;EAACgB,IAAI,EAAC,OAAO;EAACC,IAAI,EAAC;AAAQ,GAAKJ,KAAK,CAAG,CAChD;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAApB,OAAA,GAEaa,aAAa","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useProfileConfig = exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
10
|
const ProfileConfig = /*#__PURE__*/_react.default.createContext({
|
|
11
11
|
bucketId: ''
|
|
12
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileConfigContext.js","names":["_react","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","
|
|
1
|
+
{"version":3,"file":"ProfileConfigContext.js","names":["_react","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ProfileConfig","React","createContext","bucketId","displayName","useProfileConfig","useContext","exports","_default"],"sources":["../../../../src/lib/components/profile/ProfileConfigContext.ts"],"sourcesContent":["import React, { useContext } from 'react';\n\nexport interface ProfileConfigProps {\n bucketId: string;\n}\n\nconst ProfileConfig = React.createContext<ProfileConfigProps>({\n bucketId: '',\n});\n\nProfileConfig.displayName = 'ProfileConfig';\n\nexport const useProfileConfig = (): ProfileConfigProps =>\n useContext(ProfileConfig);\n\nexport default ProfileConfig;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0C,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA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GAAAD,OAAA,CAAArB,OAAA,GAEbc,aAAa","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useProfile = exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
10
|
const ProfileContext = /*#__PURE__*/_react.default.createContext({
|
|
11
11
|
id: '',
|
|
12
12
|
email: ''
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileContext.js","names":["_react","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","
|
|
1
|
+
{"version":3,"file":"ProfileContext.js","names":["_react","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ProfileContext","React","createContext","id","email","displayName","useProfile","useContext","exports","_default"],"sources":["../../../../src/lib/components/profile/ProfileContext.ts"],"sourcesContent":["import React, { useContext } from 'react';\n\nexport interface ProfileContextProps {\n id: string;\n email: string;\n firstName?: string;\n lastName?: string;\n avatar?: string;\n}\n\nconst ProfileContext = React.createContext<ProfileContextProps>({\n id: '',\n email: '',\n});\n\nProfileContext.displayName = 'ProfileContext';\n\nexport const useProfile = (): ProfileContextProps => useContext(ProfileContext);\n\nexport default ProfileContext;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0C,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAU1C,MAAMW,cAAc,gBAAGC,cAAK,CAACC,aAAa,CAAsB;EAC9DC,EAAE,EAAE,EAAE;EACNC,KAAK,EAAE;AACT,CAAC,CAAC;AAEFJ,cAAc,CAACK,WAAW,GAAG,gBAAgB;AAEtC,MAAMC,UAAU,GAAGA,CAAA,KAA2B,IAAAC,iBAAU,EAACP,cAAc,CAAC;AAACQ,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAAA,IAAAG,QAAA,GAAAD,OAAA,CAAAtB,OAAA,GAEjEc,cAAc","ignoreList":[]}
|
|
@@ -9,11 +9,11 @@ var _core = require("@os-design/core");
|
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
10
|
var _MainLoader = _interopRequireDefault(require("../shared/MainLoader"));
|
|
11
11
|
var _templateObject;
|
|
12
|
-
function _interopRequireDefault(
|
|
13
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
14
|
-
function _taggedTemplateLiteral(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
const LazyProfileDrawerContent = /*#__PURE__*/(0, _react.lazy)(() => Promise.resolve().then(() => _interopRequireWildcard(require('./ProfileDrawerContent'))));
|
|
18
18
|
const StyledDrawer = (0, _styled.default)(_core.Drawer)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n padding: 2em 1em;\n"])));
|
|
19
19
|
const ProfileDrawer = _ref => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawer.js","names":["_react","_interopRequireWildcard","require","_core","_styled","_interopRequireDefault","_MainLoader","_templateObject","
|
|
1
|
+
{"version":3,"file":"ProfileDrawer.js","names":["_react","_interopRequireWildcard","require","_core","_styled","_interopRequireDefault","_MainLoader","_templateObject","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_taggedTemplateLiteral","slice","freeze","defineProperties","raw","value","_getRequireWildcardCache","WeakMap","has","get","__proto__","a","defineProperty","getOwnPropertyDescriptor","u","i","set","LazyProfileDrawerContent","lazy","Promise","resolve","then","StyledDrawer","styled","Drawer","ProfileDrawer","_ref","actions","children","rest","createElement","placement","width","Suspense","fallback","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileDrawer.tsx"],"sourcesContent":["import React, { lazy, Suspense } from 'react';\nimport { Drawer, DrawerProps } from '@os-design/core';\nimport styled from '@emotion/styled';\nimport { ProfileDrawerContentProps } from './ProfileDrawerContent';\nimport MainLoader from '../shared/MainLoader';\n\nconst LazyProfileDrawerContent = lazy(() => import('./ProfileDrawerContent'));\n\nexport type ProfileDrawerProps = ProfileDrawerContentProps & DrawerProps;\n\nconst StyledDrawer = styled(Drawer)`\n display: flex;\n flex-direction: column;\n padding: 2em 1em;\n`;\n\nconst ProfileDrawer: React.FC<ProfileDrawerProps> = ({\n actions,\n children,\n ...rest\n}) => (\n <StyledDrawer placement='right' width='15em' {...rest}>\n <Suspense fallback={<MainLoader />}>\n <LazyProfileDrawerContent actions={actions}>\n {children}\n </LazyProfileDrawerContent>\n </Suspense>\n </StyledDrawer>\n);\n\nexport default ProfileDrawer;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AAA8C,IAAAK,eAAA;AAAA,SAAAF,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH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uB,cAAA,CAAApB,CAAA,EAAAsB,CAAA,EAAAC,CAAA,IAAAvB,CAAA,CAAAsB,CAAA,IAAA7B,CAAA,CAAA6B,CAAA,YAAAtB,CAAA,CAAAL,OAAA,GAAAF,CAAA,EAAAU,CAAA,IAAAA,CAAA,CAAAqB,GAAA,CAAA/B,CAAA,EAAAO,CAAA,GAAAA,CAAA;AAE9C,MAAMyB,wBAAwB,gBAAG,IAAAC,WAAI,EAAC,MAAAC,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAA3C,uBAAA,CAAAC,OAAA,CAAa,wBAAwB,GAAC,CAAC;AAI7E,MAAM2C,YAAY,GAAG,IAAAC,eAAM,EAACC,YAAM,CAAC,CAAAxC,eAAA,KAAAA,eAAA,GAAAgB,sBAAA,4EAIlC;AAED,MAAMyB,aAA2C,GAAGC,IAAA;EAAA,IAAC;IACnDC,OAAO;IACPC,QAAQ;IACR,GAAGC;EACL,CAAC,GAAAH,IAAA;EAAA,oBACCjD,MAAA,CAAAU,OAAA,CAAA2C,aAAA,CAACR,YAAY,EAAAlC,QAAA;IAAC2C,SAAS,EAAC,OAAO;IAACC,KAAK,EAAC;EAAM,GAAKH,IAAI,gBACnDpD,MAAA,CAAAU,OAAA,CAAA2C,aAAA,CAACrD,MAAA,CAAAwD,QAAQ;IAACC,QAAQ,eAAEzD,MAAA,CAAAU,OAAA,CAAA2C,aAAA,CAAC/C,WAAA,CAAAI,OAAU,MAAE;EAAE,gBACjCV,MAAA,CAAAU,OAAA,CAAA2C,aAAA,CAACb,wBAAwB;IAACU,OAAO,EAAEA;EAAQ,GACxCC,QACuB,CAClB,CACE,CAAC;AAAA,CAChB;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAjD,OAAA,GAEasC,aAAa","ignoreList":[]}
|
|
@@ -18,9 +18,9 @@ var _ProfileUpdatePasswordModal = _interopRequireDefault(require("./ProfileUpdat
|
|
|
18
18
|
var _UserAvatar = _interopRequireDefault(require("./UserAvatar"));
|
|
19
19
|
var _ProfileDrawerContentUpdateAvatarMutation, _ProfileDrawerContentSignOutMutation, _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
22
|
-
function _interopRequireDefault(
|
|
23
|
-
function _taggedTemplateLiteral(
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
24
24
|
const AvatarContainer = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"])));
|
|
25
25
|
const UserContent = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-top: 1em;\n"])));
|
|
26
26
|
const FullName = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: ", "em;\n font-weight: 500;\n text-align: center;\n line-height: 1.2;\n"])), p => p.theme.sizes.large);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileDrawerContent.js","names":["_styled","_interopRequireDefault","require","_core","_theming","_react","_interopRequireWildcard","_reactI18next","_hooks","_getError","_ProfileButton","_ProfileContext","_ProfileUpdateNameModal","_ProfileUpdatePasswordModal","_UserAvatar","_ProfileDrawerContentUpdateAvatarMutation","_ProfileDrawerContentSignOutMutation","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","_taggedTemplateLiteral","strings","raw","slice","freeze","defineProperties","value","AvatarContainer","styled","div","UserContent","FullName","p","theme","sizes","large","Email","clr","inputColorPlaceholder","ActionsContainer","Footer","HiddenInput","input","query","hash","console","error","DeleteAvatarButton","useTranslation","commit","loading","useMutation","handler","useCallback","variables","avatar","onError","message","getError","onCompleted","success","createElement","onClick","UpdateAvatarButton","_ref","hasAvatar","fileInputRef","useRef","target","files","file","uploadables","Fragment","current","click","concat","type","accept","onChange","ref","UpdateNameButton","_ref2","hasName","modalVisible","setModalVisible","useState","visible","onClose","ChangePasswordButton","SignOutButton","window","location","href","danger","ProfileDrawerContent","_ref3","actions","children","email","firstName","lastName","useProfile","fullName","useMemo","filter","join","size","ThemeSwitcher","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { ThemeSwitcher, message } from '@os-design/core';\nimport { clr } from '@os-design/theming';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport getError from '../../utils/getError';\nimport ProfileButton from './ProfileButton';\nimport { useProfile } from './ProfileContext';\nimport ProfileUpdateNameModal from './ProfileUpdateNameModal';\nimport ProfileUpdatePasswordModal from './ProfileUpdatePasswordModal';\nimport UserAvatar from './UserAvatar';\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 query = 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>(query);\n\n const handler = useCallback(() => {\n commit({\n variables: {\n input: { avatar: null },\n },\n onError: (e) => message.error(getError(e).message),\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>(query);\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(getError(error).message),\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 [modalVisible, setModalVisible] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisible(true)}>\n {t(`profile:${hasName ? 'changeName' : 'setName'}`)}\n </ProfileButton>\n\n <ProfileUpdateNameModal\n visible={modalVisible}\n onClose={() => setModalVisible(false)}\n />\n </>\n );\n};\n\nconst ChangePasswordButton: React.FC = () => {\n const { t } = useTranslation(['profile']);\n const [modalVisible, setModalVisible] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisible(true)}>\n {t('profile:changePassword')}\n </ProfileButton>\n\n <ProfileUpdatePasswordModal\n visible={modalVisible}\n onClose={() => setModalVisible(false)}\n />\n </>\n );\n};\n\nconst SignOutButton: React.FC = () => {\n const { t } = useTranslation(['profile']);\n\n const [commit, loading] = useMutation<ProfileDrawerContentSignOutMutation>(\n graphql`\n mutation ProfileDrawerContentSignOutMutation {\n signOut {\n ok\n }\n }\n `\n );\n\n const handler = useCallback(() => {\n commit({\n variables: {},\n onError: (e) => message.error(getError(e).message),\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,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,cAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,2BAAA,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AyD,aAAA,CAACE,kBAAkB;IAACE,SAAS,EAAE,CAAC,CAACV;EAAO,CAAE,CAAC,eAC3C5E,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAACmB,gBAAgB;IAACE,OAAO,EAAE,CAAC,CAACoB;EAAS,CAAE,CAAC,eACzC3H,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAAC2B,oBAAoB,MAAE,CAAC,EAEvBQ,OAAO,eAERrH,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAAC4B,aAAa,MAAE,CAAC,EAEhBQ,QACe,CAAC,eAEnBtH,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAACrB,MAAM,qBACL7D,MAAA,CAAAyB,OAAA,CAAAyD,aAAA,CAACpF,KAAA,CAAAkI,aAAa,MAAE,CACV,CACR,CAAC;AAEP,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzG,OAAA,GAEa0F,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"ProfileDrawerContent.js","names":["_styled","_interopRequireDefault","require","_core","_theming","_react","_interopRequireWildcard","_reactI18next","_hooks","_getError","_ProfileButton","_ProfileContext","_ProfileUpdateNameModal","_ProfileUpdatePasswordModal","_UserAvatar","_ProfileDrawerContentUpdateAvatarMutation","_ProfileDrawerContentSignOutMutation","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_taggedTemplateLiteral","slice","freeze","defineProperties","raw","value","AvatarContainer","styled","div","UserContent","FullName","p","theme","sizes","large","Email","clr","inputColorPlaceholder","ActionsContainer","Footer","HiddenInput","input","query","hash","console","error","DeleteAvatarButton","useTranslation","commit","loading","useMutation","handler","useCallback","variables","avatar","onError","message","getError","onCompleted","success","createElement","onClick","UpdateAvatarButton","_ref","hasAvatar","fileInputRef","useRef","target","files","file","uploadables","Fragment","current","click","concat","type","accept","onChange","ref","UpdateNameButton","_ref2","hasName","modalVisible","setModalVisible","useState","visible","onClose","ChangePasswordButton","SignOutButton","window","location","href","danger","ProfileDrawerContent","_ref3","actions","children","email","firstName","lastName","useProfile","fullName","useMemo","filter","join","size","ThemeSwitcher","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileDrawerContent.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { ThemeSwitcher, message } from '@os-design/core';\nimport { clr } from '@os-design/theming';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport getError from '../../utils/getError';\nimport ProfileButton from './ProfileButton';\nimport { useProfile } from './ProfileContext';\nimport ProfileUpdateNameModal from './ProfileUpdateNameModal';\nimport ProfileUpdatePasswordModal from './ProfileUpdatePasswordModal';\nimport UserAvatar from './UserAvatar';\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 query = 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>(query);\n\n const handler = useCallback(() => {\n commit({\n variables: {\n input: { avatar: null },\n },\n onError: (e) => message.error(getError(e).message),\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>(query);\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(getError(error).message),\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 [modalVisible, setModalVisible] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisible(true)}>\n {t(`profile:${hasName ? 'changeName' : 'setName'}`)}\n </ProfileButton>\n\n <ProfileUpdateNameModal\n visible={modalVisible}\n onClose={() => setModalVisible(false)}\n />\n </>\n );\n};\n\nconst ChangePasswordButton: React.FC = () => {\n const { t } = useTranslation(['profile']);\n const [modalVisible, setModalVisible] = useState(false);\n\n return (\n <>\n <ProfileButton onClick={() => setModalVisible(true)}>\n {t('profile:changePassword')}\n </ProfileButton>\n\n <ProfileUpdatePasswordModal\n visible={modalVisible}\n onClose={() => setModalVisible(false)}\n />\n </>\n );\n};\n\nconst SignOutButton: React.FC = () => {\n const { t } = useTranslation(['profile']);\n\n const [commit, loading] = useMutation<ProfileDrawerContentSignOutMutation>(\n graphql`\n mutation ProfileDrawerContentSignOutMutation {\n signOut {\n ok\n }\n }\n `\n );\n\n const handler = useCallback(() => {\n commit({\n variables: {},\n onError: (e) => message.error(getError(e).message),\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 <ThemeS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C;EAAM,CAAE,CAAC,eAC1B5H,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAAC/B,WAAW,QACTwE,QAAQ,iBAAIxH,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAAC9B,QAAQ,QAAEuE,QAAmB,CAAC,eAC5CxH,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAACzB,KAAK,QAAE8D,KAAa,CACV,CACE,CAAC,eAElBpH,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAACtB,gBAAgB,QACdgB,MAAM,iBAAIzE,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAACd,kBAAkB,MAAE,CAAC,eAEjCjE,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAACE,kBAAkB;IAACE,SAAS,EAAE,CAAC,CAACV;EAAO,CAAE,CAAC,eAC3CzE,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAACmB,gBAAgB;IAACE,OAAO,EAAE,CAAC,CAACoB;EAAS,CAAE,CAAC,eACzCxH,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAAC2B,oBAAoB,MAAE,CAAC,EAEvBQ,OAAO,eAERlH,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAAC4B,aAAa,MAAE,CAAC,EAEhBQ,QACe,CAAC,eAEnBnH,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAACrB,MAAM,qBACL1D,MAAA,CAAAyB,OAAA,CAAAsD,aAAA,CAACjF,KAAA,CAAA+H,aAAa,MAAE,CACV,CACR,CAAC;AAEP,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAtG,OAAA,GAEauF,oBAAoB","ignoreList":[]}
|
|
@@ -9,8 +9,8 @@ var _media = require("@os-design/media");
|
|
|
9
9
|
var _core = require("@os-design/core");
|
|
10
10
|
var _reactI18next = require("react-i18next");
|
|
11
11
|
var _ProfileIcon = _interopRequireDefault(require("../shared/icons/ProfileIcon"));
|
|
12
|
-
function _interopRequireDefault(
|
|
13
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
14
|
const ProfileNavigationItem = _ref => {
|
|
15
15
|
let {
|
|
16
16
|
onClick = () => {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileNavigationItem.js","names":["_react","_interopRequireDefault","require","_media","_core","_reactI18next","_ProfileIcon","
|
|
1
|
+
{"version":3,"file":"ProfileNavigationItem.js","names":["_react","_interopRequireDefault","require","_media","_core","_reactI18next","_ProfileIcon","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","ProfileNavigationItem","_ref","onClick","rest","useTranslation","isMinMd","useIsMinWidth","createElement","NavigationItem","href","icon","onKeyDown","key","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileNavigationItem.tsx"],"sourcesContent":["import React from 'react';\nimport { useIsMinWidth } from '@os-design/media';\nimport { NavigationItem, NavigationItemProps } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\nimport ProfileIcon from '../shared/icons/ProfileIcon';\n\nexport interface ProfileNavigationItemProps\n extends Partial<NavigationItemProps> {\n onClick?: () => void;\n}\n\nconst ProfileNavigationItem: React.FC<ProfileNavigationItemProps> = ({\n onClick = () => {},\n ...rest\n}) => {\n const { t } = useTranslation(['profile']);\n const isMinMd = useIsMinWidth('md');\n\n if (isMinMd) return null;\n\n return (\n <NavigationItem\n href='#' // To make focusable\n icon={<ProfileIcon />}\n onClick={onClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter') onClick();\n }}\n {...rest}\n >\n {t('profile:menu')}\n </NavigationItem>\n );\n};\n\nexport default ProfileNavigationItem;\n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,OAAW,MAAE,CAAE;IACtBe,OAAO,EAAEA,OAAQ;IACjBS,SAAS,EAAG1B,CAAC,IAAK;MAChB,IAAIA,CAAC,CAAC2B,GAAG,KAAK,OAAO,EAAEV,OAAO,CAAC,CAAC;IAClC;EAAE,GACEC,IAAI,GAEPR,CAAC,CAAC,cAAc,CACH,CAAC;AAErB,CAAC;AAAC,IAAAkB,QAAA,GAAAC,OAAA,CAAA3B,OAAA,GAEaa,qBAAqB","ignoreList":[]}
|
|
@@ -13,10 +13,10 @@ var _handleFormErrors = _interopRequireDefault(require("../../utils/handleFormEr
|
|
|
13
13
|
var _FormError = _interopRequireDefault(require("../shared/FormError"));
|
|
14
14
|
var _ProfileContext = require("./ProfileContext");
|
|
15
15
|
var _ProfileUpdateNameModalMutation;
|
|
16
|
-
function _interopRequireDefault(
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
19
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20
20
|
const ProfileUpdateNameModal = _ref => {
|
|
21
21
|
let {
|
|
22
22
|
visible,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileUpdateNameModal.js","names":["_core","require","_form","_react","_interopRequireWildcard","_reactI18next","_hooks","_handleFormErrors","_interopRequireDefault","_FormError","_ProfileContext","_ProfileUpdateNameModalMutation","
|
|
1
|
+
{"version":3,"file":"ProfileUpdateNameModal.js","names":["_core","require","_form","_react","_interopRequireWildcard","_reactI18next","_hooks","_handleFormErrors","_interopRequireDefault","_FormError","_ProfileContext","_ProfileUpdateNameModalMutation","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","ProfileUpdateNameModal","_ref","visible","onClose","useTranslation","firstName","lastName","useProfile","initValues","useMemo","form","Field","useForm","commit","loading","useMutation","hash","console","error","useEffect","reset","onSubmit","useCallback","variables","input","values","getAll","onError","handleFormErrors","onCompleted","message","success","firstNameData","label","placeholder","lastNameData","createElement","Modal","title","okText","okLoading","onOk","FormProvider","Form","name","data","render","props","_ref2","FormItem","Input","_ref3","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileUpdateNameModal.tsx"],"sourcesContent":["import { Form, FormItem, Input, message, Modal } from '@os-design/core';\nimport { FormProvider, useForm } from '@os-design/form';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport handleFormErrors from '../../utils/handleFormErrors';\nimport FormError from '../shared/FormError';\nimport { ProfileUpdateNameModalMutation } from './__generated__/ProfileUpdateNameModalMutation.graphql';\nimport { useProfile } from './ProfileContext';\n\ninterface ProfileUpdateNameFormData {\n firstName: string;\n lastName: string;\n}\n\ninterface ProfileUpdateNameModalProps {\n visible: boolean;\n onClose: () => void;\n}\n\nconst ProfileUpdateNameModal: React.FC<ProfileUpdateNameModalProps> = ({\n visible,\n onClose,\n}) => {\n const { t } = useTranslation(['profile']);\n const { firstName = '', lastName = '' } = useProfile();\n\n const initValues = useMemo<ProfileUpdateNameFormData>(\n () => ({ firstName, lastName }),\n [firstName, lastName]\n );\n\n const { form, Field } = useForm(initValues);\n\n const [commit, loading] = useMutation<ProfileUpdateNameModalMutation>(graphql`\n mutation ProfileUpdateNameModalMutation($input: UpdateProfileInput!) {\n updateProfile(input: $input) {\n firstName\n lastName\n }\n }\n `);\n\n // Reset the form when the modal is opened\n useEffect(() => {\n if (visible) form.reset();\n }, [form, visible]);\n\n const onSubmit = useCallback(() => {\n commit({\n variables: {\n input: form.values.getAll(),\n },\n onError: (error) => handleFormErrors(form, error),\n onCompleted: () => {\n message.success(t('profile:updated'));\n onClose();\n },\n });\n }, [commit, form, onClose, t]);\n\n const firstNameData = useMemo(\n () => ({\n label: t('profile:updateNameModal.firstName.label'),\n placeholder: t('profile:updateNameModal.firstName.placeholder'),\n }),\n [t]\n );\n\n const lastNameData = useMemo(\n () => ({\n label: t('profile:updateNameModal.lastName.label'),\n placeholder: t('profile:updateNameModal.lastName.placeholder'),\n }),\n [t]\n );\n\n return (\n <Modal\n title={t('profile:updateNameModal.title')}\n visible={visible}\n okText={t('profile:update')}\n okLoading={loading}\n onOk={onSubmit}\n onClose={onClose}\n >\n <FormProvider form={form}>\n <Form>\n <Field\n name='firstName'\n data={firstNameData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <Input placeholder={data.placeholder} {...props} />\n </FormItem>\n )}\n />\n\n <Field\n name='lastName'\n data={lastNameData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <Input placeholder={data.placeholder} {...props} />\n </FormItem>\n )}\n />\n\n <FormError />\n </Form>\n </FormProvider>\n </Modal>\n );\n};\n\nexport default ProfileUpdateNameModal;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAD,sBAAA,CAAAP,OAAA;AAEA,IAAAS,eAAA,GAAAT,OAAA;AAA8C,IAAAU,+BAAA;AAAA,SAAAH,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,CAAA,oBAAAe,CAAA,OAAAC,cAAA,CAAA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,EAAEA,CAACC,KAAK,EAAAI,KAAA,EAAaN,IAAI;MAAA,IAAf;QAAE3B;MAAM,CAAC,GAAAiC,KAAA;MAAA,oBACvBtF,MAAA,CAAAW,OAAA,CAAA4D,aAAA,CAAC1E,KAAA,CAAAuF,QAAQ;QAAChB,KAAK,EAAEY,IAAI,CAACZ,KAAM;QAACf,KAAK,EAAEA;MAAM,gBACxCrD,MAAA,CAAAW,OAAA,CAAA4D,aAAA,CAAC1E,KAAA,CAAAwF,KAAK,EAAAxD,QAAA;QAACwC,WAAW,EAAEW,IAAI,CAACX;MAAY,GAAKa,KAAK,CAAG,CAC1C,CAAC;IAAA;EACX,CACH,CAAC,eAEFlF,MAAA,CAAAW,OAAA,CAAA4D,aAAA,CAACjE,UAAA,CAAAK,OAAS,MAAE,CACR,CACM,CACT,CAAC;AAEZ,CAAC;AAAC,IAAA4E,QAAA,GAAAC,OAAA,CAAA7E,OAAA,GAEawB,sBAAsB","ignoreList":[]}
|
|
@@ -12,10 +12,10 @@ var _hooks = require("react-relay/hooks");
|
|
|
12
12
|
var _handleFormErrors = _interopRequireDefault(require("../../utils/handleFormErrors"));
|
|
13
13
|
var _FormError = _interopRequireDefault(require("../shared/FormError"));
|
|
14
14
|
var _ProfileUpdatePasswordModalMutation;
|
|
15
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
18
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
19
19
|
const ProfileUpdatePasswordModal = _ref => {
|
|
20
20
|
let {
|
|
21
21
|
visible,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileUpdatePasswordModal.js","names":["_core","require","_form","_react","_interopRequireWildcard","_reactI18next","_hooks","_handleFormErrors","_interopRequireDefault","_FormError","_ProfileUpdatePasswordModalMutation","
|
|
1
|
+
{"version":3,"file":"ProfileUpdatePasswordModal.js","names":["_core","require","_form","_react","_interopRequireWildcard","_reactI18next","_hooks","_handleFormErrors","_interopRequireDefault","_FormError","_ProfileUpdatePasswordModalMutation","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","ProfileUpdatePasswordModal","_ref","visible","onClose","useTranslation","initValues","useMemo","currentPassword","password","form","Field","useForm","commit","loading","useMutation","hash","console","error","useEffect","reset","onSubmit","useCallback","variables","input","values","getAll","onError","handleFormErrors","onCompleted","message","success","currentPasswordData","label","placeholder","passwordData","strengthNames","returnObjects","createElement","Modal","title","okText","okLoading","onOk","FormProvider","Form","name","data","render","props","_ref2","FormItem","InputPassword","_ref3","showStrengthMeter","_default","exports"],"sources":["../../../../src/lib/components/profile/ProfileUpdatePasswordModal.tsx"],"sourcesContent":["import { Form, FormItem, InputPassword, message, Modal } from '@os-design/core';\nimport { FormProvider, useForm } from '@os-design/form';\nimport { graphql } from 'babel-plugin-relay/macro';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useMutation } from 'react-relay/hooks';\nimport handleFormErrors from '../../utils/handleFormErrors';\nimport FormError from '../shared/FormError';\nimport { ProfileUpdatePasswordModalMutation } from './__generated__/ProfileUpdatePasswordModalMutation.graphql';\n\ninterface ProfileUpdatePasswordFormData {\n currentPassword: string;\n password: string;\n}\n\ninterface ProfileUpdatePasswordModalProps {\n visible: boolean;\n onClose: () => void;\n}\n\nconst ProfileUpdatePasswordModal: React.FC<ProfileUpdatePasswordModalProps> = ({\n visible,\n onClose,\n}) => {\n const { t } = useTranslation(['profile']);\n\n const initValues = useMemo<ProfileUpdatePasswordFormData>(\n () => ({\n currentPassword: '',\n password: '',\n }),\n []\n );\n\n const { form, Field } = useForm(initValues);\n\n const [commit, loading] = useMutation<ProfileUpdatePasswordModalMutation>(\n graphql`\n mutation ProfileUpdatePasswordModalMutation(\n $input: UpdatePasswordInput!\n ) {\n updatePassword(input: $input) {\n id\n }\n }\n `\n );\n\n // Reset the form when the modal is opened\n useEffect(() => {\n if (visible) form.reset();\n }, [form, visible]);\n\n const onSubmit = useCallback(() => {\n commit({\n variables: {\n input: form.values.getAll(),\n },\n onError: (error) => handleFormErrors(form, error),\n onCompleted: () => {\n message.success(t('profile:updatePasswordModal.success'));\n onClose();\n },\n });\n }, [commit, form, onClose, t]);\n\n const currentPasswordData = useMemo(\n () => ({\n label: t('profile:updatePasswordModal.currentPassword.label'),\n placeholder: t('profile:updatePasswordModal.currentPassword.placeholder'),\n }),\n [t]\n );\n\n const passwordData = useMemo(\n () => ({\n label: t('profile:updatePasswordModal.newPassword.label'),\n placeholder: t('profile:updatePasswordModal.newPassword.placeholder'),\n strengthNames: t('profile:updatePasswordModal.passwordStrengthNames', {\n returnObjects: true,\n }),\n }),\n [t]\n );\n\n return (\n <Modal\n title={t('profile:updatePasswordModal.title')}\n visible={visible}\n okText={t('profile:updatePasswordModal.button')}\n okLoading={loading}\n onOk={onSubmit}\n onClose={onClose}\n >\n <FormProvider form={form}>\n <Form>\n <Field\n name='currentPassword'\n data={currentPasswordData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <InputPassword placeholder={data.placeholder} {...props} />\n </FormItem>\n )}\n />\n\n <Field\n name='password'\n data={passwordData}\n render={(props, { error }, data) => (\n <FormItem label={data.label} error={error}>\n <InputPassword\n placeholder={data.placeholder}\n showStrengthMeter\n strengthNames={data.strengthNames}\n {...props}\n />\n </FormItem>\n )}\n />\n\n <FormError />\n </Form>\n </FormProvider>\n </Modal>\n );\n};\n\nexport default ProfileUpdatePasswordModal;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAD,sBAAA,CAAAP,OAAA;AAA4C,IAAAS,mCAAA;AAAA,SAAAF,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAK,CAAA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AA,CAAA6D,aAAA,CAAC1E,KAAA,CAAAuF,QAAQ;QAAClB,KAAK,EAAEc,IAAI,CAACd,KAAM;QAACf,KAAK,EAAEA;MAAM,gBACxCnD,MAAA,CAAAU,OAAA,CAAA6D,aAAA,CAAC1E,KAAA,CAAAwF,aAAa,EAAAzD,QAAA;QAACuC,WAAW,EAAEa,IAAI,CAACb;MAAY,GAAKe,KAAK,CAAG,CAClD,CAAC;IAAA;EACX,CACH,CAAC,eAEFlF,MAAA,CAAAU,OAAA,CAAA6D,aAAA,CAAC3B,KAAK;IACJmC,IAAI,EAAC,UAAU;IACfC,IAAI,EAAEZ,YAAa;IACnBa,MAAM,EAAEA,CAACC,KAAK,EAAAI,KAAA,EAAaN,IAAI;MAAA,IAAf;QAAE7B;MAAM,CAAC,GAAAmC,KAAA;MAAA,oBACvBtF,MAAA,CAAAU,OAAA,CAAA6D,aAAA,CAAC1E,KAAA,CAAAuF,QAAQ;QAAClB,KAAK,EAAEc,IAAI,CAACd,KAAM;QAACf,KAAK,EAAEA;MAAM,gBACxCnD,MAAA,CAAAU,OAAA,CAAA6D,aAAA,CAAC1E,KAAA,CAAAwF,aAAa,EAAAzD,QAAA;QACZuC,WAAW,EAAEa,IAAI,CAACb,WAAY;QAC9BoB,iBAAiB;QACjBlB,aAAa,EAAEW,IAAI,CAACX;MAAc,GAC9Ba,KAAK,CACV,CACO,CAAC;IAAA;EACX,CACH,CAAC,eAEFlF,MAAA,CAAAU,OAAA,CAAA6D,aAAA,CAACjE,UAAA,CAAAI,OAAS,MAAE,CACR,CACM,CACT,CAAC;AAEZ,CAAC;AAAC,IAAA8E,QAAA,GAAAC,OAAA,CAAA/E,OAAA,GAEawB,0BAA0B","ignoreList":[]}
|
|
@@ -10,9 +10,9 @@ var _utils = require("@os-design/utils");
|
|
|
10
10
|
var _ProfileConfigContext = _interopRequireDefault(require("./ProfileConfigContext"));
|
|
11
11
|
var _ProfileContext = _interopRequireDefault(require("./ProfileContext"));
|
|
12
12
|
var _ProtectedWrapperQuery;
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
const ProtectedWrapperLoader = _ref => {
|
|
17
17
|
let {
|
|
18
18
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProtectedWrapper.js","names":["_react","_interopRequireWildcard","require","_hooks","_utils","_ProfileConfigContext","_interopRequireDefault","_ProfileContext","_ProtectedWrapperQuery","
|
|
1
|
+
{"version":3,"file":"ProtectedWrapper.js","names":["_react","_interopRequireWildcard","require","_hooks","_utils","_ProfileConfigContext","_interopRequireDefault","_ProfileContext","_ProtectedWrapperQuery","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ProtectedWrapperLoader","_ref","children","profile","useLazyLoadQuery","hash","console","error","fetchPolicy","profileContext","useMemo","id","email","firstName","undefined","lastName","avatar","createElement","Provider","value","ProtectedWrapper","_ref2","bucketId","profileConfigContext","ErrorBoundary","fallback","window","location","href","_default","exports"],"sources":["../../../../src/lib/components/profile/ProtectedWrapper.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport graphql from 'babel-plugin-relay/macro';\nimport { useLazyLoadQuery } from 'react-relay/hooks';\nimport { ErrorBoundary } from '@os-design/utils';\nimport ProfileConfigContext from './ProfileConfigContext';\nimport ProfileContext from './ProfileContext';\nimport { ProtectedWrapperQuery } from './__generated__/ProtectedWrapperQuery.graphql';\n\ninterface ProtectedWrapperLoaderProps {\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapperLoader: React.FC<ProtectedWrapperLoaderProps> = ({\n children,\n}) => {\n const { profile } = useLazyLoadQuery<ProtectedWrapperQuery>(\n graphql`\n query ProtectedWrapperQuery {\n profile {\n id\n email\n firstName\n lastName\n avatar\n }\n }\n `,\n {},\n { fetchPolicy: 'store-or-network' }\n );\n\n const profileContext = useMemo(\n () => ({\n id: profile.id,\n email: profile.email,\n firstName: profile.firstName || undefined,\n lastName: profile.lastName || undefined,\n avatar: profile.avatar || undefined,\n }),\n [\n profile.avatar,\n profile.email,\n profile.firstName,\n profile.id,\n profile.lastName,\n ]\n );\n\n return (\n <ProfileContext.Provider value={profileContext}>\n {children}\n </ProfileContext.Provider>\n );\n};\n\nexport interface ProtectedWrapperProps {\n bucketId: string;\n children?: React.ReactNode;\n}\n\nconst ProtectedWrapper: React.FC<ProtectedWrapperProps> = ({\n bucketId,\n children,\n}) => {\n const profileConfigContext = useMemo(() => ({ bucketId }), [bucketId]);\n\n return (\n <ProfileConfigContext.Provider value={profileConfigContext}>\n <ErrorBoundary\n fallback={() => {\n window.location.href = '/auth/';\n return null;\n }}\n >\n <ProtectedWrapperLoader>{children}</ProtectedWrapperLoader>\n </ErrorBoundary>\n </ProfileConfigContext.Provider>\n );\n};\n\nexport default ProtectedW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AC,GAAAmB,KAAA;EACC,MAAME,oBAAoB,GAAG,IAAAb,cAAO,EAAC,OAAO;IAAEY;EAAS,CAAC,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEtE,oBACEnD,MAAA,CAAAW,OAAA,CAAAmC,aAAA,CAACzC,qBAAA,CAAAM,OAAoB,CAACoC,QAAQ;IAACC,KAAK,EAAEI;EAAqB,gBACzDpD,MAAA,CAAAW,OAAA,CAAAmC,aAAA,CAAC1C,MAAA,CAAAiD,aAAa;IACZC,QAAQ,EAAEA,CAAA,KAAM;MACdC,MAAM,CAACC,QAAQ,CAACC,IAAI,GAAG,QAAQ;MAC/B,OAAO,IAAI;IACb;EAAE,gBAEFzD,MAAA,CAAAW,OAAA,CAAAmC,aAAA,CAACjB,sBAAsB,QAAEE,QAAiC,CAC7C,CACc,CAAC;AAEpC,CAAC;AAAC,IAAA2B,QAAA,GAAAC,OAAA,CAAAhD,OAAA,GAEasC,gBAAgB","ignoreList":[]}
|
|
@@ -9,8 +9,8 @@ var _core = require("@os-design/core");
|
|
|
9
9
|
var _ProfileContext = require("./ProfileContext");
|
|
10
10
|
var _ProfileConfigContext = require("./ProfileConfigContext");
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
13
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
14
|
const UserAvatar = props => {
|
|
15
15
|
const {
|
|
16
16
|
email,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAvatar.js","names":["_react","_interopRequireWildcard","require","_core","_ProfileContext","_ProfileConfigContext","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","
|
|
1
|
+
{"version":3,"file":"UserAvatar.js","names":["_react","_interopRequireWildcard","require","_core","_ProfileContext","_ProfileConfigContext","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","UserAvatar","props","email","firstName","lastName","avatar","useProfile","bucketId","useProfileConfig","avatarProps","useMemo","image","undefined","concat","createElement","Avatar","_default","exports"],"sources":["../../../../src/lib/components/profile/UserAvatar.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Avatar, AvatarProps } from '@os-design/core';\nimport { useProfile } from './ProfileContext';\nimport { useProfileConfig } from './ProfileConfigContext';\n\nconst UserAvatar: React.FC<AvatarProps> = (props) => {\n const { email, firstName, lastName, avatar } = useProfile();\n const { bucketId } = useProfileConfig();\n\n const avatarProps = useMemo(() => {\n if (firstName || lastName) return { firstName, lastName };\n return { firstName: email };\n }, [email, firstName, lastName]);\n\n const image = useMemo(() => {\n if (!avatar) return undefined;\n return `https://storage.yandexcloud.net/${bucketId}/users/${avatar}`;\n }, [avatar, bucketId]);\n\n return <Avatar {...avatarProps} image={image} {...props} />;\n};\n\nexport default UserAvatar;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAA0D,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,I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