@os-team/profile 1.0.49 → 1.1.0
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 +2 -2
- package/dist/cjs/components/profile/ProfileUpdateNameModal.js +44 -46
- package/dist/cjs/components/profile/ProfileUpdateNameModal.js.map +1 -1
- package/dist/cjs/components/profile/ProfileUpdatePasswordModal.js +45 -46
- package/dist/cjs/components/profile/ProfileUpdatePasswordModal.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/session/SessionListItem.js +2 -2
- package/dist/cjs/components/shared/FormError.js +21 -0
- package/dist/cjs/components/shared/FormError.js.map +1 -0
- package/dist/cjs/utils/handleFormErrors.js +47 -0
- package/dist/cjs/utils/handleFormErrors.js.map +1 -0
- package/dist/esm/components/profile/ProfileUpdateNameModal.js +40 -36
- package/dist/esm/components/profile/ProfileUpdateNameModal.js.map +1 -1
- package/dist/esm/components/profile/ProfileUpdatePasswordModal.js +43 -36
- package/dist/esm/components/profile/ProfileUpdatePasswordModal.js.map +1 -1
- package/dist/esm/components/session/SessionList.js.map +1 -1
- package/dist/esm/components/shared/FormError.js +14 -0
- package/dist/esm/components/shared/FormError.js.map +1 -0
- package/dist/esm/utils/handleFormErrors.js +32 -0
- package/dist/esm/utils/handleFormErrors.js.map +1 -0
- package/dist/types/src/lib/components/profile/ProfileUpdateNameModal.d.ts.map +1 -1
- package/dist/types/src/lib/components/profile/ProfileUpdatePasswordModal.d.ts.map +1 -1
- package/dist/types/src/lib/components/shared/FormError.d.ts +4 -0
- package/dist/types/src/lib/components/shared/FormError.d.ts.map +1 -0
- package/dist/types/src/lib/utils/handleFormErrors.d.ts +9 -0
- package/dist/types/src/lib/utils/handleFormErrors.d.ts.map +1 -0
- package/package.json +27 -27
- package/dist/cjs/components/profile/ProfileUpdateNameForm.js +0 -35
- package/dist/cjs/components/profile/ProfileUpdateNameForm.js.map +0 -1
- package/dist/cjs/components/profile/ProfileUpdatePasswordForm.js +0 -39
- package/dist/cjs/components/profile/ProfileUpdatePasswordForm.js.map +0 -1
- package/dist/esm/components/profile/ProfileUpdateNameForm.js +0 -30
- package/dist/esm/components/profile/ProfileUpdateNameForm.js.map +0 -1
- package/dist/esm/components/profile/ProfileUpdatePasswordForm.js +0 -34
- package/dist/esm/components/profile/ProfileUpdatePasswordForm.js.map +0 -1
- package/dist/types/src/lib/components/profile/ProfileUpdateNameForm.d.ts +0 -11
- package/dist/types/src/lib/components/profile/ProfileUpdateNameForm.d.ts.map +0 -1
- package/dist/types/src/lib/components/profile/ProfileUpdatePasswordForm.d.ts +0 -11
- package/dist/types/src/lib/components/profile/ProfileUpdatePasswordForm.d.ts.map +0 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
var _ProfileUpdateNameModalMutation;
|
|
2
|
-
|
|
3
|
-
import { message, Modal } from '@os-design/core';
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
import { Form, FormItem, Input, message, Modal } from '@os-design/core';
|
|
4
|
+
import { FormProvider, useForm } from '@os-design/form';
|
|
5
|
+
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
4
6
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { handleFormErrors, FormContext } from '@os-team/form-utils';
|
|
6
7
|
import { useMutation } from 'react-relay/hooks';
|
|
7
|
-
import
|
|
8
|
+
import handleFormErrors from '../../utils/handleFormErrors';
|
|
9
|
+
import FormError from '../shared/FormError';
|
|
8
10
|
import { useProfile } from './ProfileContext';
|
|
9
11
|
const ProfileUpdateNameModal = ({
|
|
10
12
|
visibility,
|
|
@@ -17,50 +19,32 @@ const ProfileUpdateNameModal = ({
|
|
|
17
19
|
firstName,
|
|
18
20
|
lastName
|
|
19
21
|
} = useProfile();
|
|
20
|
-
const
|
|
21
|
-
const [formError, setFormError] = useState();
|
|
22
|
-
const [data, setData] = useState({
|
|
22
|
+
const initValues = useMemo(() => ({
|
|
23
23
|
firstName: firstName || '',
|
|
24
24
|
lastName: lastName || ''
|
|
25
|
-
});
|
|
25
|
+
}), [firstName, lastName]);
|
|
26
|
+
const {
|
|
27
|
+
form,
|
|
28
|
+
Field
|
|
29
|
+
} = useForm(initValues);
|
|
26
30
|
const [commit, loading] = useMutation(_ProfileUpdateNameModalMutation !== void 0 ? _ProfileUpdateNameModalMutation : (_ProfileUpdateNameModalMutation = require("./__generated__/ProfileUpdateNameModalMutation.graphql"), _ProfileUpdateNameModalMutation.hash && _ProfileUpdateNameModalMutation.hash !== "7264a05b6738d5417df9f1dc462486aa" && console.error("The definition of 'ProfileUpdateNameModalMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _ProfileUpdateNameModalMutation));
|
|
27
31
|
|
|
28
32
|
// Reset the data if the modal is visible
|
|
29
33
|
useEffect(() => {
|
|
30
|
-
if (visibility)
|
|
31
|
-
|
|
32
|
-
firstName: firstName || '',
|
|
33
|
-
lastName: lastName || ''
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}, [firstName, lastName, visibility]);
|
|
34
|
+
if (visibility) form.reset();
|
|
35
|
+
}, [form, visibility]);
|
|
37
36
|
const onSubmit = useCallback(() => {
|
|
38
37
|
commit({
|
|
39
38
|
variables: {
|
|
40
|
-
input:
|
|
41
|
-
},
|
|
42
|
-
onError: error => {
|
|
43
|
-
handleFormErrors(error, {
|
|
44
|
-
setFieldErrors,
|
|
45
|
-
setFormError
|
|
46
|
-
});
|
|
39
|
+
input: form.values.getAll()
|
|
47
40
|
},
|
|
41
|
+
onError: error => handleFormErrors(form, error),
|
|
48
42
|
onCompleted: () => {
|
|
49
|
-
setFieldErrors({});
|
|
50
|
-
setFormError(undefined);
|
|
51
43
|
message.success(t('profile:updated'));
|
|
52
44
|
onClose();
|
|
53
45
|
}
|
|
54
46
|
});
|
|
55
|
-
}, [commit,
|
|
56
|
-
const formContext = useMemo(() => ({
|
|
57
|
-
data,
|
|
58
|
-
setData,
|
|
59
|
-
fieldErrors,
|
|
60
|
-
setFieldErrors,
|
|
61
|
-
formError,
|
|
62
|
-
setFormError
|
|
63
|
-
}), [data, fieldErrors, formError]);
|
|
47
|
+
}, [commit, form, onClose, t]);
|
|
64
48
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
65
49
|
title: t('profile:updateNameModal.title'),
|
|
66
50
|
visible: visibility,
|
|
@@ -68,9 +52,29 @@ const ProfileUpdateNameModal = ({
|
|
|
68
52
|
okLoading: loading,
|
|
69
53
|
onOk: onSubmit,
|
|
70
54
|
onClose: onClose
|
|
71
|
-
}, /*#__PURE__*/React.createElement(
|
|
72
|
-
|
|
73
|
-
}, /*#__PURE__*/React.createElement(
|
|
55
|
+
}, /*#__PURE__*/React.createElement(FormProvider, {
|
|
56
|
+
form: form
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(Field, {
|
|
58
|
+
name: "firstName",
|
|
59
|
+
render: (props, {
|
|
60
|
+
error
|
|
61
|
+
}) => /*#__PURE__*/React.createElement(FormItem, {
|
|
62
|
+
label: t('profile:updateNameModal.firstName.label'),
|
|
63
|
+
error: error
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Input, _extends({
|
|
65
|
+
placeholder: t('profile:updateNameModal.firstName.placeholder')
|
|
66
|
+
}, props)))
|
|
67
|
+
}), /*#__PURE__*/React.createElement(Field, {
|
|
68
|
+
name: "lastName",
|
|
69
|
+
render: (props, {
|
|
70
|
+
error
|
|
71
|
+
}) => /*#__PURE__*/React.createElement(FormItem, {
|
|
72
|
+
label: t('profile:updateNameModal.lastName.label'),
|
|
73
|
+
error: error
|
|
74
|
+
}, /*#__PURE__*/React.createElement(Input, _extends({
|
|
75
|
+
placeholder: t('profile:updateNameModal.lastName.placeholder')
|
|
76
|
+
}, props)))
|
|
77
|
+
}), /*#__PURE__*/React.createElement(FormError, null))));
|
|
74
78
|
};
|
|
75
79
|
export default ProfileUpdateNameModal;
|
|
76
80
|
//# sourceMappingURL=ProfileUpdateNameModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileUpdateNameModal.js","names":["
|
|
1
|
+
{"version":3,"file":"ProfileUpdateNameModal.js","names":["Form","FormItem","Input","message","Modal","FormProvider","useForm","React","useCallback","useEffect","useMemo","useTranslation","useMutation","handleFormErrors","FormError","useProfile","ProfileUpdateNameModal","visibility","onClose","t","firstName","lastName","initValues","form","Field","commit","loading","reset","onSubmit","variables","input","values","getAll","onError","error","onCompleted","success","props"],"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 { useProfile } from './ProfileContext';\nimport { ProfileUpdateNameModalMutation } from './__generated__/ProfileUpdateNameModalMutation.graphql';\n\ninterface ProfileUpdateNameFormData {\n firstName: string;\n lastName: string;\n}\n\ninterface ProfileUpdateNameModalProps {\n visibility: boolean;\n onClose: () => void;\n}\n\nconst ProfileUpdateNameModal: React.FC<ProfileUpdateNameModalProps> = ({\n visibility,\n onClose,\n}) => {\n const { t } = useTranslation(['profile']);\n const { firstName, lastName } = useProfile();\n\n const initValues = useMemo(\n () => ({ firstName: firstName || '', lastName: lastName || '' }),\n [firstName, lastName]\n );\n\n const { form, Field } = useForm<ProfileUpdateNameFormData>(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 data if the modal is visible\n useEffect(() => {\n if (visibility) form.reset();\n }, [form, visibility]);\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 return (\n <Modal\n title={t('profile:updateNameModal.title')}\n visible={visibility}\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 render={(props, { error }) => (\n <FormItem\n label={t('profile:updateNameModal.firstName.label')}\n error={error}\n >\n <Input\n placeholder={t(\n 'profile:updateNameModal.firstName.placeholder'\n )}\n {...props}\n />\n </FormItem>\n )}\n />\n\n <Field\n name='lastName'\n render={(props, { error }) => (\n <FormItem\n label={t('profile:updateNameModal.lastName.label')}\n error={error}\n >\n <Input\n placeholder={t(\n 'profile:updateNameModal.lastName.placeholder'\n )}\n {...props}\n />\n </FormItem>\n )}\n />\n\n <FormError />\n </Form>\n </FormProvider>\n </Modal>\n );\n};\n\nexport default ProfileUpdateNameModal;\n"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,OAAO,EAAEC,KAAK,QAAQ,iBAAiB;AACvE,SAASC,YAAY,EAAEC,OAAO,QAAQ,iBAAiB;AAEvD,OAAOC,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAC9D,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,OAAOC,gBAAgB,MAAM,8BAA8B;AAC3D,OAAOC,SAAS,MAAM,qBAAqB;AAC3C,SAASC,UAAU,QAAQ,kBAAkB;AAa7C,MAAMC,sBAA6D,GAAG,CAAC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,SAAS,EAAEO,OAAQ;IACnB,IAAI,EAAEE,QAAS;IACf,OAAO,EAAEV;EAAQ,gBAEjB,oBAAC,YAAY;IAAC,IAAI,EAAEK;EAAK,gBACvB,oBAAC,IAAI,qBACH,oBAAC,KAAK;IACJ,IAAI,EAAC,WAAW;IAChB,MAAM,EAAE,CAACc,KAAK,EAAE;MAAEH;IAAM,CAAC,kBACvB,oBAAC,QAAQ;MACP,KAAK,EAAEf,CAAC,CAAC,yCAAyC,CAAE;MACpD,KAAK,EAAEe;IAAM,gBAEb,oBAAC,KAAK;MACJ,WAAW,EAAEf,CAAC,CACZ,+CAA+C;IAC/C,GACEkB,KAAK,EACT;EAEJ,EACF,eAEF,oBAAC,KAAK;IACJ,IAAI,EAAC,UAAU;IACf,MAAM,EAAE,CAACA,KAAK,EAAE;MAAEH;IAAM,CAAC,kBACvB,oBAAC,QAAQ;MACP,KAAK,EAAEf,CAAC,CAAC,wCAAwC,CAAE;MACnD,KAAK,EAAEe;IAAM,gBAEb,oBAAC,KAAK;MACJ,WAAW,EAAEf,CAAC,CACZ,8CAA8C;IAC9C,GACEkB,KAAK,EACT;EAEJ,EACF,eAEF,oBAAC,SAAS,OAAG,CACR,CACM,CACT;AAEZ,CAAC;AAED,eAAerB,sBAAsB"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
var _ProfileUpdatePasswordModalMutation;
|
|
2
|
-
|
|
3
|
-
import { message, Modal } from '@os-design/core';
|
|
4
|
-
import {
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
import { Form, FormItem, InputPassword, message, Modal } from '@os-design/core';
|
|
4
|
+
import { FormProvider, useForm } from '@os-design/form';
|
|
5
|
+
import React, { useCallback, useEffect } from 'react';
|
|
5
6
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
7
|
+
import { useMutation } from 'react-relay/hooks';
|
|
8
|
+
import handleFormErrors from '../../utils/handleFormErrors';
|
|
9
|
+
import FormError from '../shared/FormError';
|
|
8
10
|
const ProfileUpdatePasswordModal = ({
|
|
9
11
|
visibility,
|
|
10
12
|
onClose
|
|
@@ -12,9 +14,10 @@ const ProfileUpdatePasswordModal = ({
|
|
|
12
14
|
const {
|
|
13
15
|
t
|
|
14
16
|
} = useTranslation(['profile']);
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
const {
|
|
18
|
+
form,
|
|
19
|
+
Field
|
|
20
|
+
} = useForm({
|
|
18
21
|
currentPassword: '',
|
|
19
22
|
password: ''
|
|
20
23
|
});
|
|
@@ -22,40 +25,20 @@ const ProfileUpdatePasswordModal = ({
|
|
|
22
25
|
|
|
23
26
|
// Reset the data if the modal is visible
|
|
24
27
|
useEffect(() => {
|
|
25
|
-
if (visibility)
|
|
26
|
-
|
|
27
|
-
currentPassword: '',
|
|
28
|
-
password: ''
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}, [visibility]);
|
|
28
|
+
if (visibility) form.reset();
|
|
29
|
+
}, [form, visibility]);
|
|
32
30
|
const onSubmit = useCallback(() => {
|
|
33
31
|
commit({
|
|
34
32
|
variables: {
|
|
35
|
-
input:
|
|
36
|
-
},
|
|
37
|
-
onError: error => {
|
|
38
|
-
handleFormErrors(error, {
|
|
39
|
-
setFieldErrors,
|
|
40
|
-
setFormError
|
|
41
|
-
});
|
|
33
|
+
input: form.values.getAll()
|
|
42
34
|
},
|
|
35
|
+
onError: error => handleFormErrors(form, error),
|
|
43
36
|
onCompleted: () => {
|
|
44
|
-
setFieldErrors({});
|
|
45
|
-
setFormError(undefined);
|
|
46
37
|
message.success(t('profile:updatePasswordModal.success'));
|
|
47
38
|
onClose();
|
|
48
39
|
}
|
|
49
40
|
});
|
|
50
|
-
}, [commit,
|
|
51
|
-
const formContext = useMemo(() => ({
|
|
52
|
-
data,
|
|
53
|
-
setData,
|
|
54
|
-
fieldErrors,
|
|
55
|
-
setFieldErrors,
|
|
56
|
-
formError,
|
|
57
|
-
setFormError
|
|
58
|
-
}), [data, fieldErrors, formError]);
|
|
41
|
+
}, [commit, form, onClose, t]);
|
|
59
42
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
60
43
|
title: t('profile:updatePasswordModal.title'),
|
|
61
44
|
visible: visibility,
|
|
@@ -63,9 +46,33 @@ const ProfileUpdatePasswordModal = ({
|
|
|
63
46
|
okLoading: loading,
|
|
64
47
|
onOk: onSubmit,
|
|
65
48
|
onClose: onClose
|
|
66
|
-
}, /*#__PURE__*/React.createElement(
|
|
67
|
-
|
|
68
|
-
}, /*#__PURE__*/React.createElement(
|
|
49
|
+
}, /*#__PURE__*/React.createElement(FormProvider, {
|
|
50
|
+
form: form
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(Field, {
|
|
52
|
+
name: "currentPassword",
|
|
53
|
+
render: (props, {
|
|
54
|
+
error
|
|
55
|
+
}) => /*#__PURE__*/React.createElement(FormItem, {
|
|
56
|
+
label: t('profile:updatePasswordModal.currentPassword.label'),
|
|
57
|
+
error: error
|
|
58
|
+
}, /*#__PURE__*/React.createElement(InputPassword, _extends({
|
|
59
|
+
placeholder: t('profile:updatePasswordModal.currentPassword.placeholder')
|
|
60
|
+
}, props)))
|
|
61
|
+
}), /*#__PURE__*/React.createElement(Field, {
|
|
62
|
+
name: "password",
|
|
63
|
+
render: (props, {
|
|
64
|
+
error
|
|
65
|
+
}) => /*#__PURE__*/React.createElement(FormItem, {
|
|
66
|
+
label: t('profile:updatePasswordModal.newPassword.label'),
|
|
67
|
+
error: error
|
|
68
|
+
}, /*#__PURE__*/React.createElement(InputPassword, _extends({
|
|
69
|
+
placeholder: t('profile:updatePasswordModal.newPassword.placeholder'),
|
|
70
|
+
showStrengthMeter: true,
|
|
71
|
+
strengthNames: t('profile:updatePasswordModal.passwordStrengthNames', {
|
|
72
|
+
returnObjects: true
|
|
73
|
+
})
|
|
74
|
+
}, props)))
|
|
75
|
+
}), /*#__PURE__*/React.createElement(FormError, null))));
|
|
69
76
|
};
|
|
70
77
|
export default ProfileUpdatePasswordModal;
|
|
71
78
|
//# sourceMappingURL=ProfileUpdatePasswordModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileUpdatePasswordModal.js","names":["
|
|
1
|
+
{"version":3,"file":"ProfileUpdatePasswordModal.js","names":["Form","FormItem","InputPassword","message","Modal","FormProvider","useForm","React","useCallback","useEffect","useTranslation","useMutation","handleFormErrors","FormError","ProfileUpdatePasswordModal","visibility","onClose","t","form","Field","currentPassword","password","commit","loading","reset","onSubmit","variables","input","values","getAll","onError","error","onCompleted","success","props","returnObjects"],"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 } 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 visibility: boolean;\n onClose: () => void;\n}\n\nconst ProfileUpdatePasswordModal: React.FC<ProfileUpdatePasswordModalProps> = ({\n visibility,\n onClose,\n}) => {\n const { t } = useTranslation(['profile']);\n\n const { form, Field } = useForm<ProfileUpdatePasswordFormData>({\n currentPassword: '',\n password: '',\n });\n\n const [commit, loading] =\n useMutation<ProfileUpdatePasswordModalMutation>(graphql`\n mutation ProfileUpdatePasswordModalMutation(\n $input: UpdatePasswordInput!\n ) {\n updatePassword(input: $input) {\n id\n }\n }\n `);\n\n // Reset the data if the modal is visible\n useEffect(() => {\n if (visibility) form.reset();\n }, [form, visibility]);\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 return (\n <Modal\n title={t('profile:updatePasswordModal.title')}\n visible={visibility}\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 render={(props, { error }) => (\n <FormItem\n label={t('profile:updatePasswordModal.currentPassword.label')}\n error={error}\n >\n <InputPassword\n placeholder={t(\n 'profile:updatePasswordModal.currentPassword.placeholder'\n )}\n {...props}\n />\n </FormItem>\n )}\n />\n\n <Field\n name='password'\n render={(props, { error }) => (\n <FormItem\n label={t('profile:updatePasswordModal.newPassword.label')}\n error={error}\n >\n <InputPassword\n placeholder={t(\n 'profile:updatePasswordModal.newPassword.placeholder'\n )}\n showStrengthMeter\n strengthNames={t(\n 'profile:updatePasswordModal.passwordStrengthNames',\n { returnObjects: true }\n )}\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,SAASA,IAAI,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,OAAO,EAAEC,KAAK,QAAQ,iBAAiB;AAC/E,SAASC,YAAY,EAAEC,OAAO,QAAQ,iBAAiB;AAEvD,OAAOC,KAAK,IAAIC,WAAW,EAAEC,SAAS,QAAQ,OAAO;AACrD,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,OAAOC,gBAAgB,MAAM,8BAA8B;AAC3D,OAAOC,SAAS,M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AAC,KAAK;IACJ,IAAI,EAAC,iBAAiB;IACtB,MAAM,EAAE,CAACgB,KAAK,EAAE;MAAEH;IAAM,CAAC,kBACvB,oBAAC,QAAQ;MACP,KAAK,EAAEd,CAAC,CAAC,mDAAmD,CAAE;MAC9D,KAAK,EAAEc;IAAM,gBAEb,oBAAC,aAAa;MACZ,WAAW,EAAEd,CAAC,CACZ,yDAAyD;IACzD,GACEiB,KAAK,EACT;EAEJ,EACF,eAEF,oBAAC,KAAK;IACJ,IAAI,EAAC,UAAU;IACf,MAAM,EAAE,CAACA,KAAK,EAAE;MAAEH;IAAM,CAAC,kBACvB,oBAAC,QAAQ;MACP,KAAK,EAAEd,CAAC,CAAC,+CAA+C,CAAE;MAC1D,KAAK,EAAEc;IAAM,gBAEb,oBAAC,aAAa;MACZ,WAAW,EAAEd,CAAC,CACZ,qDAAqD,CACrD;MACF,iBAAiB;MACjB,aAAa,EAAEA,CAAC,CACd,mDAAmD,EACnD;QAAEkB,aAAa,EAAE;MAAK,CAAC;IACvB,GACED,KAAK,EACT;EAEJ,EACF,eAEF,oBAAC,SAAS,OAAG,CACR,CACM,CACT;AAEZ,CAAC;AAED,eAAepB,0BAA0B"}
|
|
@@ -1 +1 @@
|
|
|
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":";AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAEnD,SAASC,WAAW,EAAEC,WAAW,QAAQ,mBAAmB;AAC5D,SAASC,MAAM,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,GAAG,QAAQ,oBAAoB;AAExC,OAAOC,eAAe,MAAM,mBAAmB;AAG/C,MAAMC,gBAAgB,8aAUrB;AAMD,OAAO,MAAMC,KAAK,GAAGL,MAAM,CAACM,GAAI;AAChC;AACA;AACA,CAAC;AAED,OAAO,MAAMC,IAAI,GAAGP,MAAM,CAACM,GAAI;AAC/B,0BAA2BE,CAAC,IAAKN,G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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":";AAAA,OAAOA,KAAK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B,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,EAAC,IAAE,EAACK,aAAa,CAAC0B,MAAM,EAAC,GACvD,CAAQ,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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Alert } from '@os-design/core';
|
|
2
|
+
import { useExistingForm } from '@os-design/form';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
const FormError = () => {
|
|
5
|
+
const {
|
|
6
|
+
useError
|
|
7
|
+
} = useExistingForm();
|
|
8
|
+
const error = useError('_error');
|
|
9
|
+
return error ? /*#__PURE__*/React.createElement(Alert, {
|
|
10
|
+
type: "error"
|
|
11
|
+
}, error) : null;
|
|
12
|
+
};
|
|
13
|
+
export default FormError;
|
|
14
|
+
//# sourceMappingURL=FormError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormError.js","names":["Alert","useExistingForm","React","FormError","useError","error"],"sources":["../../../../src/lib/components/shared/FormError.tsx"],"sourcesContent":["import { Alert } from '@os-design/core';\nimport { useExistingForm } from '@os-design/form';\nimport React from 'react';\n\nconst FormError: React.FC = () => {\n const { useError } = useExistingForm();\n const error = useError('_error');\n return error ? <Alert type='error'>{error}</Alert> : null;\n};\n\nexport default FormError;\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,iBAAiB;AACvC,SAASC,eAAe,QAAQ,iBAAiB;AACjD,OAAOC,KAAK,MAAM,OAAO;AAEzB,MAAMC,SAAmB,GAAG,MAAM;EAChC,MAAM;IAAEC;EAAS,CAAC,GAAGH,eAAe,EAAE;EACtC,MAAMI,KAAK,GAAGD,QAAQ,CAAC,QAAQ,CAAC;EAChC,OAAOC,KAAK,gBAAG,oBAAC,KAAK;IAAC,IAAI,EAAC;EAAO,GAAEA,KAAK,CAAS,GAAG,IAAI;AAC3D,CAAC;AAED,eAAeF,SAAS"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
const NO_CONSTRAINTS = {};
|
|
4
|
+
export const getErrorConstraints = error => {
|
|
5
|
+
const e = error;
|
|
6
|
+
if (!e.source || !Array.isArray(e.source.errors) || e.source.errors.length === 0 || !e.source.errors[0].extensions || !e.source.errors[0].extensions.code) {
|
|
7
|
+
return NO_CONSTRAINTS;
|
|
8
|
+
}
|
|
9
|
+
if (e.source.errors[0].extensions.code !== 'BAD_ARGUMENTS') {
|
|
10
|
+
return NO_CONSTRAINTS;
|
|
11
|
+
}
|
|
12
|
+
return e.source.errors[0].extensions.constraints;
|
|
13
|
+
};
|
|
14
|
+
const handleFormErrors = (form, error) => {
|
|
15
|
+
const e = error;
|
|
16
|
+
if (!e.source || !Array.isArray(e.source.errors) || e.source.errors.length === 0 || !e.source.errors[0].extensions || !e.source.errors[0].extensions.code) {
|
|
17
|
+
form.errors.set('_error', e.message);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (e.source.errors[0].extensions.code === 'BAD_ARGUMENTS') {
|
|
21
|
+
const constraints = getErrorConstraints(error);
|
|
22
|
+
Object.entries(constraints).forEach(([fieldName, {
|
|
23
|
+
message
|
|
24
|
+
}]) => {
|
|
25
|
+
form.errors.set(fieldName, message);
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
form.errors.set('_error', e.source.errors[0].message);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export default handleFormErrors;
|
|
32
|
+
//# sourceMappingURL=handleFormErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleFormErrors.js","names":["NO_CONSTRAINTS","getErrorConstraints","error","e","source","Array","isArray","errors","length","extensions","code","constraints","handleFormErrors","form","set","message","Object","entries","forEach","fieldName"],"sources":["../../../src/lib/utils/handleFormErrors.ts"],"sourcesContent":["import { Form } from '@os-design/form';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\ninterface Constraint {\n name: string;\n message: string;\n}\n\nconst NO_CONSTRAINTS = {};\n\nexport const getErrorConstraints = (\n error: Error\n): Record<string, Constraint> => {\n const e = error as any;\n\n if (\n !e.source ||\n !Array.isArray(e.source.errors) ||\n e.source.errors.length === 0 ||\n !e.source.errors[0].extensions ||\n !e.source.errors[0].extensions.code\n ) {\n return NO_CONSTRAINTS;\n }\n if (e.source.errors[0].extensions.code !== 'BAD_ARGUMENTS') {\n return NO_CONSTRAINTS;\n }\n\n return e.source.errors[0].extensions.constraints;\n};\n\nconst handleFormErrors = (form: Form<any>, error: Error): void => {\n const e = error as any;\n\n if (\n !e.source ||\n !Array.isArray(e.source.errors) ||\n e.source.errors.length === 0 ||\n !e.source.errors[0].extensions ||\n !e.source.errors[0].extensions.code\n ) {\n form.errors.set('_error', e.message);\n return;\n }\n\n if (e.source.errors[0].extensions.code === 'BAD_ARGUMENTS') {\n const constraints = getErrorConstraints(error);\n Object.entries(constraints).forEach(([fieldName, { message }]) => {\n form.errors.set(fieldName, message);\n });\n } else {\n form.errors.set('_error', e.source.errors[0].message);\n }\n};\n\n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,OAAO,CAAC;IACpC;EACF;EAEA,IAAIZ,CAAC,CAACC,MAAM,CAACG,MAAM,CAAC,CAAC,CAAC,CAACE,UAAU,CAACC,IAAI,KAAK,eAAe,EAAE;IAC1D,MAAMC,WAAW,GAAGV,mBAAmB,CAACC,KAAK,CAAC;IAC9Cc,MAAM,CAACC,OAAO,CAACN,WAAW,CAAC,CAACO,OAAO,CAAC,CAAC,CAACC,SAAS,EAAE;MAAEJ;IAAQ,CAAC,CAAC,KAAK;MAChEF,IAAI,CAACN,MAAM,CAACO,GAAG,CAACK,SAAS,EAAEJ,OAAO,CAAC;IACrC,CAAC,CAAC;EACJ,CAAC,MAAM;IACLF,IAAI,CAACN,MAAM,CAACO,GAAG,CAAC,QAAQ,EAAEX,CAAC,CAACC,MAAM,CAACG,MAAM,CAAC,CAAC,CAAC,CAACQ,OAAO,CAAC;EACvD;AACF,CAAC;AAED,eAAeH,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileUpdateNameModal.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/profile/ProfileUpdateNameModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProfileUpdateNameModal.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/profile/ProfileUpdateNameModal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAa/D,UAAU,2BAA2B;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CA2FjE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileUpdatePasswordModal.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/profile/ProfileUpdatePasswordModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProfileUpdatePasswordModal.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/profile/ProfileUpdatePasswordModal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAYtD,UAAU,+BAA+B;IACvC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,+BAA+B,CA+FzE,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormError.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/shared/FormError.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAItB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Form } from '@os-design/form';
|
|
2
|
+
interface Constraint {
|
|
3
|
+
name: string;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const getErrorConstraints: (error: Error) => Record<string, Constraint>;
|
|
7
|
+
declare const handleFormErrors: (form: Form<any>, error: Error) => void;
|
|
8
|
+
export default handleFormErrors;
|
|
9
|
+
//# sourceMappingURL=handleFormErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleFormErrors.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/handleFormErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAIvC,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,eAAO,MAAM,mBAAmB,UACvB,KAAK,KACX,OAAO,MAAM,EAAE,UAAU,CAiB3B,CAAC;AAEF,QAAA,MAAM,gBAAgB,SAAU,KAAK,GAAG,CAAC,SAAS,KAAK,KAAG,IAsBzD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@os-team/profile",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/profile.git",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -42,18 +42,18 @@
|
|
|
42
42
|
"registry": "https://registry.npmjs.org"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@os-design/core": "^1.0.
|
|
46
|
-
"@os-design/
|
|
47
|
-
"@os-design/
|
|
48
|
-
"@os-design/
|
|
49
|
-
"@os-design/
|
|
50
|
-
"@os-design/
|
|
51
|
-
"@os-
|
|
45
|
+
"@os-design/core": "^1.0.191",
|
|
46
|
+
"@os-design/form": "^1.0.15",
|
|
47
|
+
"@os-design/icons": "^1.0.46",
|
|
48
|
+
"@os-design/media": "^1.0.18",
|
|
49
|
+
"@os-design/styles": "^1.0.43",
|
|
50
|
+
"@os-design/theming": "^1.0.41",
|
|
51
|
+
"@os-design/utils": "^1.0.59",
|
|
52
52
|
"@os-team/plural-forms": "^1.0.11"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@babel/cli": "^7.
|
|
56
|
-
"@babel/core": "^7.20.
|
|
55
|
+
"@babel/cli": "^7.20.7",
|
|
56
|
+
"@babel/core": "^7.20.7",
|
|
57
57
|
"@babel/preset-env": "^7.20.2",
|
|
58
58
|
"@babel/preset-react": "^7.18.6",
|
|
59
59
|
"@babel/preset-typescript": "^7.18.6",
|
|
@@ -61,22 +61,22 @@
|
|
|
61
61
|
"@emotion/serialize": "^1.1.1",
|
|
62
62
|
"@emotion/styled": "^11.10.5",
|
|
63
63
|
"@os-team/prettier-config": "1.1.9",
|
|
64
|
-
"@os-team/relay-network-creator": "^1.2.
|
|
65
|
-
"@os-team/relay-network-mw-upload": "^1.2.
|
|
66
|
-
"@types/jest": "^29.2.
|
|
67
|
-
"@types/node": "^18.11.
|
|
68
|
-
"@types/react": "^18.0.
|
|
64
|
+
"@os-team/relay-network-creator": "^1.2.13",
|
|
65
|
+
"@os-team/relay-network-mw-upload": "^1.2.12",
|
|
66
|
+
"@types/jest": "^29.2.4",
|
|
67
|
+
"@types/node": "^18.11.17",
|
|
68
|
+
"@types/react": "^18.0.26",
|
|
69
69
|
"@types/react-dom": "^18.0.9",
|
|
70
70
|
"@types/react-relay": "^14.1.2",
|
|
71
71
|
"@types/react-router-dom": "^5.3.3",
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
73
|
-
"@typescript-eslint/parser": "^5.
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
|
73
|
+
"@typescript-eslint/parser": "^5.47.0",
|
|
74
74
|
"babel-plugin-relay": "^14.1.0",
|
|
75
75
|
"cross-env": "^7.0.3",
|
|
76
|
-
"eslint": "^8.
|
|
76
|
+
"eslint": "^8.30.0",
|
|
77
77
|
"eslint-config-os-team-react": "1.1.35",
|
|
78
78
|
"eslint-plugin-import": "^2.26.0",
|
|
79
|
-
"eslint-plugin-jest": "^27.1.
|
|
79
|
+
"eslint-plugin-jest": "^27.1.7",
|
|
80
80
|
"eslint-plugin-jsx-a11y": "^6.6.1",
|
|
81
81
|
"eslint-plugin-promise": "^6.1.1",
|
|
82
82
|
"eslint-plugin-react": "^7.31.11",
|
|
@@ -84,26 +84,26 @@
|
|
|
84
84
|
"get-graphql-schema": "^2.1.2",
|
|
85
85
|
"graphql": "^16.6.0",
|
|
86
86
|
"husky": "^8.0.2",
|
|
87
|
-
"i18next": "^22.
|
|
87
|
+
"i18next": "^22.4.6",
|
|
88
88
|
"i18next-browser-languagedetector": "^7.0.1",
|
|
89
|
-
"i18next-http-backend": "^2.
|
|
89
|
+
"i18next-http-backend": "^2.1.1",
|
|
90
90
|
"lazysizes": "^5.3.2",
|
|
91
|
-
"lint-staged": "^13.0
|
|
91
|
+
"lint-staged": "^13.1.0",
|
|
92
92
|
"npm-run-all": "^4.1.5",
|
|
93
|
-
"prettier": "2.8.
|
|
93
|
+
"prettier": "2.8.1",
|
|
94
94
|
"progress-bar-webpack-plugin": "^2.1.0",
|
|
95
95
|
"react": "^18.2.0",
|
|
96
96
|
"react-app-rewired": "^2.2.1",
|
|
97
97
|
"react-dom": "^18.2.0",
|
|
98
|
-
"react-i18next": "^12.
|
|
98
|
+
"react-i18next": "^12.1.1",
|
|
99
99
|
"react-relay": "^14.1.0",
|
|
100
|
-
"react-router-dom": "^6.
|
|
100
|
+
"react-router-dom": "^6.6.0",
|
|
101
101
|
"react-scripts": "^5.0.1",
|
|
102
102
|
"react-test-renderer": "^18.2.0",
|
|
103
103
|
"relay-compiler": "^14.1.0",
|
|
104
104
|
"relay-runtime": "^14.1.0",
|
|
105
|
-
"release-it": "^15.5.
|
|
106
|
-
"typescript": "^4.9.
|
|
105
|
+
"release-it": "^15.5.1",
|
|
106
|
+
"typescript": "^4.9.4",
|
|
107
107
|
"webpack-bundle-analyzer": "^4.7.0"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _formUtils = require("@os-team/form-utils");
|
|
9
|
-
var _core = require("@os-design/core");
|
|
10
|
-
var _reactI18next = require("react-i18next");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
-
var ProfileUpdateNameForm = function ProfileUpdateNameForm(_ref) {
|
|
14
|
-
var children = _ref.children;
|
|
15
|
-
var _useTranslation = (0, _reactI18next.useTranslation)(['profile']),
|
|
16
|
-
t = _useTranslation.t;
|
|
17
|
-
var _useForm = (0, _formUtils.useForm)(),
|
|
18
|
-
formError = _useForm.formError;
|
|
19
|
-
var firstName = (0, _formUtils.useFormItem)('firstName');
|
|
20
|
-
var lastName = (0, _formUtils.useFormItem)('lastName');
|
|
21
|
-
return /*#__PURE__*/_react.default.createElement(_core.Form, null, /*#__PURE__*/_react.default.createElement(_core.FormItem, _extends({
|
|
22
|
-
label: t('profile:updateNameModal.firstName.label')
|
|
23
|
-
}, firstName[0]), /*#__PURE__*/_react.default.createElement(_core.Input, _extends({
|
|
24
|
-
placeholder: t('profile:updateNameModal.firstName.placeholder')
|
|
25
|
-
}, firstName[1]))), /*#__PURE__*/_react.default.createElement(_core.FormItem, _extends({
|
|
26
|
-
label: t('profile:updateNameModal.lastName.label')
|
|
27
|
-
}, lastName[0]), /*#__PURE__*/_react.default.createElement(_core.Input, _extends({
|
|
28
|
-
placeholder: t('profile:updateNameModal.lastName.placeholder')
|
|
29
|
-
}, lastName[1]))), formError && /*#__PURE__*/_react.default.createElement(_core.Alert, {
|
|
30
|
-
type: "error"
|
|
31
|
-
}, formError), children);
|
|
32
|
-
};
|
|
33
|
-
var _default = ProfileUpdateNameForm;
|
|
34
|
-
exports.default = _default;
|
|
35
|
-
//# sourceMappingURL=ProfileUpdateNameForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileUpdateNameForm.js","names":["ProfileUpdateNameForm","children","useTranslation","t","useForm","formError","firstName","useFormItem","lastName"],"sources":["../../../../src/lib/components/profile/ProfileUpdateNameForm.tsx"],"sourcesContent":["import React from 'react';\nimport { useForm, useFormItem } from '@os-team/form-utils';\nimport { Alert, Form, FormItem, Input } from '@os-design/core';\nimport { useTranslation } from 'react-i18next';\n\nexport interface ProfileUpdateNameFormData {\n firstName: string;\n lastName: string;\n}\n\ninterface ProfileUpdateNameFormProps {\n children?: React.ReactNode;\n}\n\nconst ProfileUpdateNameForm: React.FC<ProfileUpdateNameFormProps> = ({\n children,\n}) => {\n const { t } = useTranslation(['profile']);\n const { formError } = useForm();\n\n const firstName = useFormItem('firstName');\n const lastName = useFormItem('lastName');\n\n return (\n <Form>\n <FormItem\n label={t('profile:updateNameModal.firstName.label')}\n {...firstName[0]}\n >\n <Input\n placeholder={t('profile:updateNameModal.firstName.placeholder')}\n {...firstName[1]}\n />\n </FormItem>\n\n <FormItem\n label={t('profile:updateNameModal.lastName.label')}\n {...lastName[0]}\n >\n <Input\n placeholder={t('profile:updateNameModal.lastName.placeholder')}\n {...lastName[1]}\n />\n </FormItem>\n\n {formError && <Alert type='error'>{formError}</Alert>}\n\n {children}\n </Form>\n );\n};\n\nexport default ProfileUpdateNameForm;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAA+C;AAAA;AAW/C,IAAMA,qBAA2D,GAAG,SAA9DA,qBAA2D,OAE3D;EAAA,IADJC,QAAQ,QAARA,QAAQ;EAER,sBAAc,IAAAC,4BAAc,EAAC,CAAC,SAAS,CAAC,CAAC;IAAjCC,CAAC,mBAADA,CAAC;EACT,eAAsB,IAAAC,kBAAO,GAAE;IAAvBC,SAAS,YAATA,SAAS;EAEjB,IAAMC,SAAS,GAAG,IAAAC,sBAAW,EAAC,WAAW,CAAC;EAC1C,IAAMC,QAAQ,GAAG,IAAAD,sBAAW,EAAC,UAAU,CAAC;EAExC,oBACE,6BAAC,UAAI,qBACH,6BAAC,cAAQ;IACP,KAAK,EAAEJ,CAAC,CAAC,yCAAyC;EAAE,GAChDG,SAAS,CAAC,CAAC,CAAC,gBAEhB,6BAAC,WAAK;IACJ,WAAW,EAAEH,CAAC,CAAC,+CAA+C;EAAE,GAC5DG,SAAS,CAAC,CAAC,CAAC,EAChB,CACO,eAEX,6BAAC,cAAQ;IACP,KAAK,EAAEH,CAAC,CAAC,wCAAwC;EAAE,GAC/CK,QAAQ,CAAC,CAAC,CAAC,gBAEf,6BAAC,WAAK;IACJ,WAAW,EAAEL,CAAC,CAAC,8CAA8C;EAAE,GAC3DK,QAAQ,CAAC,CAAC,CAAC,EACf,CACO,EAEVH,SAAS,iBAAI,6BAAC,WAAK;IAAC,IAAI,EAAC;EAAO,GAAEA,SAAS,CAAS,EAEpDJ,QAAQ,CACJ;AAEX,CAAC;AAAC,eAEaD,qBAAqB;AAAA"}
|