@bigbinary/neeto-team-members-frontend 4.4.26 → 4.5.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/app/javascript/src/translations/en.json +36 -6
- package/dist/Groups.js +2 -2
- package/dist/ManageMember.js +5 -5
- package/dist/Profile.js +318 -140
- package/dist/Profile.js.map +1 -1
- package/dist/Roles.js +2 -2
- package/dist/{RolesRadioGroup-Cwdovd4_.js → RolesRadioGroup-Bxt7zZkh.js} +2 -2
- package/dist/{RolesRadioGroup-Cwdovd4_.js.map → RolesRadioGroup-Bxt7zZkh.js.map} +1 -1
- package/dist/{RolesRadioGroup-Cj_ehpnj.js → RolesRadioGroup-CGjcYVyV.js} +2 -2
- package/dist/{RolesRadioGroup-Cj_ehpnj.js.map → RolesRadioGroup-CGjcYVyV.js.map} +1 -1
- package/dist/RolesRadioGroup.js +2 -2
- package/dist/TeamMembers.js +175 -24
- package/dist/TeamMembers.js.map +1 -1
- package/dist/cjs/Groups.js +2 -2
- package/dist/cjs/ManageMember.js +5 -5
- package/dist/cjs/Profile.js +316 -138
- package/dist/cjs/Profile.js.map +1 -1
- package/dist/cjs/Roles.js +2 -2
- package/dist/cjs/RolesRadioGroup.js +2 -2
- package/dist/cjs/TeamMembers.js +174 -23
- package/dist/cjs/TeamMembers.js.map +1 -1
- package/dist/cjs/constants.js +5 -2
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/hooks.js +3 -3
- package/dist/cjs/index.js +12 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils.js +2 -2
- package/dist/{constants-BYGIelYc.js → constants-BdTiHt55.js} +3 -3
- package/dist/{constants-BYGIelYc.js.map → constants-BdTiHt55.js.map} +1 -1
- package/dist/{constants-CmhmtttG.js → constants-CVJk8LWV.js} +3 -3
- package/dist/{constants-CmhmtttG.js.map → constants-CVJk8LWV.js.map} +1 -1
- package/dist/constants.js +7 -1
- package/dist/constants.js.map +1 -1
- package/dist/hooks.js +3 -3
- package/dist/{index-DIett4kG.js → index-BEa7d06u.js} +4 -4
- package/dist/{index-DIett4kG.js.map → index-BEa7d06u.js.map} +1 -1
- package/dist/{index-C54nXmSx.js → index-CWyeI4Kz.js} +2 -2
- package/dist/{index-C54nXmSx.js.map → index-CWyeI4Kz.js.map} +1 -1
- package/dist/{index-BzXDzsrQ.js → index-CjxpjqPH.js} +4 -4
- package/dist/{index-BzXDzsrQ.js.map → index-CjxpjqPH.js.map} +1 -1
- package/dist/{index-C3B4Tkzb.js → index-Dvjcz-b3.js} +2 -2
- package/dist/{index-C3B4Tkzb.js.map → index-Dvjcz-b3.js.map} +1 -1
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/dist/{useMembersSidenav-Cr62csJp.js → useMembersSidenav-DZL248nl.js} +2 -2
- package/dist/{useMembersSidenav-Cr62csJp.js.map → useMembersSidenav-DZL248nl.js.map} +1 -1
- package/dist/{useMembersSidenav-DF1oXHi4.js → useMembersSidenav-DoqlX-eu.js} +2 -2
- package/dist/{useMembersSidenav-DF1oXHi4.js.map → useMembersSidenav-DoqlX-eu.js.map} +1 -1
- package/dist/{useTeamsApi-1Zy6Vd6v.js → useTeamsApi-DLoZKPuX.js} +15 -4
- package/dist/useTeamsApi-DLoZKPuX.js.map +1 -0
- package/dist/{useTeamsApi-BC2K4Ol1.js → useTeamsApi-DqizqY5S.js} +15 -3
- package/dist/useTeamsApi-DqizqY5S.js.map +1 -0
- package/dist/utils.js +2 -2
- package/package.json +1 -1
- package/dist/useTeamsApi-1Zy6Vd6v.js.map +0 -1
- package/dist/useTeamsApi-BC2K4Ol1.js.map +0 -1
package/dist/Profile.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import { useState, useMemo, useRef, useCallback, useEffect } from 'react';
|
|
3
|
+
import MenuHorizontal from '@bigbinary/neeto-icons/MenuHorizontal';
|
|
4
|
+
import Dropdown from '@bigbinary/neetoui/Dropdown';
|
|
2
5
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
3
6
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
4
7
|
import { useTranslation, Trans } from 'react-i18next';
|
|
@@ -6,14 +9,10 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
6
9
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
7
10
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
8
11
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
9
|
-
import { useState, useMemo, useCallback, useEffect, createElement } from 'react';
|
|
10
12
|
import { useProfileImageUpload } from '@bigbinary/neeto-image-uploader-frontend/hooks';
|
|
11
|
-
import { NeetoTimezoneSelector } from '@bigbinary/neeto-time-zones';
|
|
12
|
-
import { findById,
|
|
13
|
-
import Button from '@bigbinary/neetoui/Button';
|
|
14
|
-
import Callout from '@bigbinary/neetoui/Callout';
|
|
13
|
+
import { NeetoTimezoneSelector, ianaTimezoneToHumanReadable } from '@bigbinary/neeto-time-zones';
|
|
14
|
+
import { findById, findBy, noop, capitalize } from '@bigbinary/neeto-cist';
|
|
15
15
|
import Label from '@bigbinary/neetoui/Label';
|
|
16
|
-
import Radio from '@bigbinary/neetoui/Radio';
|
|
17
16
|
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
18
17
|
import Toastr from '@bigbinary/neetoui/Toastr';
|
|
19
18
|
import Input from '@bigbinary/neetoui/formik/Input';
|
|
@@ -21,7 +20,7 @@ import Select from '@bigbinary/neetoui/formik/Select';
|
|
|
21
20
|
import Form from '@bigbinary/neetoui/formik/Form';
|
|
22
21
|
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
23
22
|
import { isNotNil } from 'ramda';
|
|
24
|
-
import { B as BASE_URL, Q as QUERY_KEYS, T as TIME_FORMAT_OPTIONS, D as DATE_FORMAT_OPTIONS } from './constants-
|
|
23
|
+
import { B as BASE_URL, Q as QUERY_KEYS, T as TIME_FORMAT_OPTIONS, D as DATE_FORMAT_OPTIONS } from './constants-BdTiHt55.js';
|
|
25
24
|
import { useQuery } from '@tanstack/react-query';
|
|
26
25
|
import { DEFAULT_STALE_TIME } from '@bigbinary/neeto-commons-frontend/constants';
|
|
27
26
|
import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
@@ -30,13 +29,14 @@ import { t } from 'i18next';
|
|
|
30
29
|
import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
31
30
|
import * as yup from 'yup';
|
|
32
31
|
import { useField } from 'formik';
|
|
33
|
-
import
|
|
32
|
+
import Edit from '@bigbinary/neeto-icons/Edit';
|
|
34
33
|
import Avatar from '@bigbinary/neetoui/Avatar';
|
|
35
34
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
36
35
|
import { n } from './inject-css-DmrvuTKK.js';
|
|
37
36
|
import withImmutableActions from '@bigbinary/neeto-commons-frontend/react-utils/withImmutableActions';
|
|
38
37
|
import { create } from 'zustand';
|
|
39
38
|
import { shallow } from 'zustand/shallow';
|
|
39
|
+
import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
|
|
40
40
|
|
|
41
41
|
var fetchCountries = function fetchCountries() {
|
|
42
42
|
return axios.get("".concat(BASE_URL, "/profile/countries"));
|
|
@@ -81,7 +81,6 @@ var PROFILE_VALIDATION_SCHEMA = yup.object().shape({
|
|
|
81
81
|
});
|
|
82
82
|
var MY_PROFILE_PATH = "/auth/profile/edit";
|
|
83
83
|
var ALLOWED_PROFILE_IMAGE_MIME_TYPES = ["image/jpeg", "image/png"];
|
|
84
|
-
var IMAGE_DELETE_BUTTON_SIZE = 16;
|
|
85
84
|
var STATIC_PROFILE_IMAGE_MAX_SIZE_IN_BYTES = globalProps.endUserUploadedFileSizeLimitInMb * 1024 * 1024;
|
|
86
85
|
var VALIDATION_ERRORS = {
|
|
87
86
|
invalid_type: t("neetoTeamMembers.profile.file.invalidType.image"),
|
|
@@ -136,9 +135,12 @@ var useCountries = function useCountries() {
|
|
|
136
135
|
};
|
|
137
136
|
};
|
|
138
137
|
|
|
138
|
+
var Menu$1 = Dropdown.Menu,
|
|
139
|
+
MenuItem$1 = Dropdown.MenuItem;
|
|
139
140
|
var ProfileImage = function ProfileImage() {
|
|
140
141
|
var _useTranslation = useTranslation(),
|
|
141
142
|
t = _useTranslation.t;
|
|
143
|
+
var fileInputRef = useRef(null);
|
|
142
144
|
var _useField = useField("avatar"),
|
|
143
145
|
_useField2 = _slicedToArray(_useField, 3),
|
|
144
146
|
field = _useField2[0];
|
|
@@ -160,6 +162,10 @@ var ProfileImage = function ProfileImage() {
|
|
|
160
162
|
file: imageFile
|
|
161
163
|
});
|
|
162
164
|
};
|
|
165
|
+
var handleChangeImage = function handleChangeImage() {
|
|
166
|
+
var _fileInputRef$current;
|
|
167
|
+
return (_fileInputRef$current = fileInputRef.current) === null || _fileInputRef$current === void 0 ? void 0 : _fileInputRef$current.click();
|
|
168
|
+
};
|
|
163
169
|
var handleRemoveImage = function handleRemoveImage() {
|
|
164
170
|
return setValue({
|
|
165
171
|
imageUrl: "",
|
|
@@ -179,17 +185,30 @@ var ProfileImage = function ProfileImage() {
|
|
|
179
185
|
return null;
|
|
180
186
|
};
|
|
181
187
|
return /*#__PURE__*/jsxs("div", {
|
|
182
|
-
className: "mb-
|
|
188
|
+
className: "mb-4 flex flex-col items-center gap-2",
|
|
183
189
|
children: [/*#__PURE__*/jsxs("div", {
|
|
184
|
-
className: "flex-shrink-0",
|
|
185
|
-
children: [
|
|
186
|
-
className: "
|
|
187
|
-
children: /*#__PURE__*/jsx(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
className: "relative flex-shrink-0",
|
|
191
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
192
|
+
className: "absolute bottom-0 right-0 z-10",
|
|
193
|
+
children: /*#__PURE__*/jsx(Dropdown
|
|
194
|
+
// eslint-disable-next-line @bigbinary/neeto/use-neetoui-classes
|
|
195
|
+
, {
|
|
196
|
+
buttonProps: {
|
|
197
|
+
className: "rounded-full"
|
|
198
|
+
},
|
|
199
|
+
buttonSize: "small",
|
|
200
|
+
buttonStyle: "tertiary",
|
|
201
|
+
icon: Edit,
|
|
202
|
+
children: /*#__PURE__*/jsxs(Menu$1, {
|
|
203
|
+
children: [/*#__PURE__*/jsx(MenuItem$1.Button, {
|
|
204
|
+
"data-cy": "profile-image-upload-button",
|
|
205
|
+
onClick: handleChangeImage,
|
|
206
|
+
children: avatarDetails !== null && avatarDetails !== void 0 && avatarDetails.imageUrl ? t("neetoTeamMembers.profile.avatar.changeProfilePicture") : t("neetoTeamMembers.profile.avatar.uploadProfilePicture")
|
|
207
|
+
}), /*#__PURE__*/jsx(MenuItem$1.Button, {
|
|
208
|
+
"data-cy": "profile-image-remove-button",
|
|
209
|
+
onClick: handleRemoveImage,
|
|
210
|
+
children: t("neetoTeamMembers.buttons.remove")
|
|
211
|
+
})]
|
|
193
212
|
})
|
|
194
213
|
})
|
|
195
214
|
}), /*#__PURE__*/jsx(Avatar, {
|
|
@@ -197,40 +216,26 @@ var ProfileImage = function ProfileImage() {
|
|
|
197
216
|
user: avatarDetails
|
|
198
217
|
})]
|
|
199
218
|
}), /*#__PURE__*/jsxs("div", {
|
|
200
|
-
className: "
|
|
201
|
-
children: [/*#__PURE__*/jsx(
|
|
202
|
-
className: "neeto-ui-text-
|
|
203
|
-
children: t("neetoTeamMembers.profile.avatar.profilePicture")
|
|
204
|
-
}), /*#__PURE__*/jsx(Typography, {
|
|
205
|
-
className: "neeto-ui-text-gray-700 mb-2",
|
|
219
|
+
className: "flex flex-col items-center",
|
|
220
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
221
|
+
className: "neeto-ui-text-gray-600 text-center",
|
|
206
222
|
style: "body3",
|
|
207
223
|
children: /*#__PURE__*/jsx(Trans, {
|
|
208
|
-
components: {
|
|
209
|
-
code: /*#__PURE__*/jsx("code", {})
|
|
210
|
-
},
|
|
211
224
|
i18nKey: "neetoTeamMembers.profile.avatar.profilePictureUploadMessage",
|
|
212
225
|
values: {
|
|
213
226
|
limit: globalProps.endUserUploadedFileSizeLimitInMb
|
|
214
227
|
}
|
|
215
228
|
})
|
|
216
|
-
}), /*#__PURE__*/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
accept: "image/*",
|
|
227
|
-
"data-cy": "profile-image-upload-file-field",
|
|
228
|
-
id: "uploadProfileImage",
|
|
229
|
-
name: "profile_image_path",
|
|
230
|
-
type: "file",
|
|
231
|
-
onChange: onProfileImageChange
|
|
232
|
-
}, avatarDetails === null || avatarDetails === void 0 ? void 0 : avatarDetails.imageUrl)]
|
|
233
|
-
})]
|
|
229
|
+
}), /*#__PURE__*/jsx("input", {
|
|
230
|
+
hidden: true,
|
|
231
|
+
accept: "image/*",
|
|
232
|
+
"data-cy": "profile-image-upload-file-field",
|
|
233
|
+
id: "uploadProfileImage",
|
|
234
|
+
name: "profile_image_path",
|
|
235
|
+
ref: fileInputRef,
|
|
236
|
+
type: "file",
|
|
237
|
+
onChange: onProfileImageChange
|
|
238
|
+
}, avatarDetails === null || avatarDetails === void 0 ? void 0 : avatarDetails.imageUrl)]
|
|
234
239
|
})]
|
|
235
240
|
});
|
|
236
241
|
};
|
|
@@ -406,16 +411,15 @@ var ChangeProfile = function ChangeProfile(_ref) {
|
|
|
406
411
|
},
|
|
407
412
|
children: function children(_ref5) {
|
|
408
413
|
var setFieldValue = _ref5.setFieldValue,
|
|
409
|
-
values = _ref5.values,
|
|
410
414
|
errors = _ref5.errors,
|
|
411
415
|
touched = _ref5.touched;
|
|
412
416
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
413
|
-
children: [/*#__PURE__*/
|
|
417
|
+
children: [/*#__PURE__*/jsx(Pane.Body, {
|
|
414
418
|
className: "w-full",
|
|
415
|
-
children:
|
|
416
|
-
className: "w-full
|
|
419
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
420
|
+
className: "w-full pb-6",
|
|
417
421
|
children: [/*#__PURE__*/jsx(ProfileImage, {}), /*#__PURE__*/jsxs("div", {
|
|
418
|
-
className: "
|
|
422
|
+
className: "neeto-ui-border-gray-200 mt-4 w-full space-y-4 border-t pt-4",
|
|
419
423
|
children: [/*#__PURE__*/jsx(Input, {
|
|
420
424
|
autoFocus: true,
|
|
421
425
|
required: true,
|
|
@@ -434,92 +438,67 @@ var ChangeProfile = function ChangeProfile(_ref) {
|
|
|
434
438
|
type: "text",
|
|
435
439
|
placeholder: t("neetoTeamMembers.profile.inputs.placeholder.lastName")
|
|
436
440
|
})]
|
|
437
|
-
}), /*#__PURE__*/jsx(Select, {
|
|
438
|
-
required: true,
|
|
439
|
-
"data-cy": "ntm-profile-country-select",
|
|
440
|
-
label: t("neetoTeamMembers.profile.inputs.label.selectCountry"),
|
|
441
|
-
name: "countryId",
|
|
442
|
-
options: countryDropdownOptions,
|
|
443
|
-
value: selectedCountryOption,
|
|
444
|
-
onChange: function onChange(option) {
|
|
445
|
-
var dependentFields = handleCountryChange(option);
|
|
446
|
-
setFieldValue("dateFormat", dependentFields === null || dependentFields === void 0 ? void 0 : dependentFields.dateFormat);
|
|
447
|
-
setFieldValue("countryId", option === null || option === void 0 ? void 0 : option.value);
|
|
448
|
-
}
|
|
449
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
450
|
-
className: "space-y-2",
|
|
451
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
452
|
-
children: [/*#__PURE__*/jsx(Label, {
|
|
453
|
-
required: true,
|
|
454
|
-
className: "mb-2",
|
|
455
|
-
children: t("neetoTeamMembers.profile.inputs.label.selectTimeZone")
|
|
456
|
-
}), /*#__PURE__*/jsx("div", {
|
|
457
|
-
className: "w-full flex-grow",
|
|
458
|
-
"data-cy": "ntm-profile-time-zone-select",
|
|
459
|
-
ref: function ref(node) {
|
|
460
|
-
return timezoneRef({
|
|
461
|
-
node: node,
|
|
462
|
-
setFieldValue: setFieldValue
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
})]
|
|
466
|
-
}), touched.timeZone && errors.timeZone && /*#__PURE__*/jsx(Typography, {
|
|
467
|
-
children: errors.timeZone
|
|
468
|
-
})]
|
|
469
|
-
}), /*#__PURE__*/jsx(Select, {
|
|
470
|
-
required: true,
|
|
471
|
-
"data-cy": "ntm-time-format-select",
|
|
472
|
-
name: "timeFormat",
|
|
473
|
-
options: TIME_FORMAT_OPTIONS,
|
|
474
|
-
label: t("neetoTeamMembers.profile.inputs.label.selectTimeFormat"),
|
|
475
|
-
onChange: function onChange(option) {
|
|
476
|
-
setFieldValue("timeFormat", option.value);
|
|
477
|
-
}
|
|
478
441
|
}), /*#__PURE__*/jsxs("div", {
|
|
479
|
-
|
|
442
|
+
className: "neeto-ui-border-gray-200 mt-4 w-full space-y-4 border-t pt-4",
|
|
443
|
+
children: [/*#__PURE__*/jsx(Select, {
|
|
480
444
|
required: true,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
445
|
+
"data-cy": "ntm-profile-country-select",
|
|
446
|
+
name: "countryId",
|
|
447
|
+
options: countryDropdownOptions,
|
|
448
|
+
value: selectedCountryOption,
|
|
449
|
+
label: t("neetoTeamMembers.profile.inputs.label.selectCountry"),
|
|
450
|
+
onChange: function onChange(option) {
|
|
451
|
+
var dependentFields = handleCountryChange(option);
|
|
452
|
+
setFieldValue("dateFormat", dependentFields === null || dependentFields === void 0 ? void 0 : dependentFields.dateFormat);
|
|
453
|
+
setFieldValue("countryId", option === null || option === void 0 ? void 0 : option.value);
|
|
454
|
+
}
|
|
455
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
456
|
+
className: "space-y-2",
|
|
457
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
458
|
+
className: "space-y-2",
|
|
459
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
460
|
+
required: true,
|
|
461
|
+
children: t("neetoTeamMembers.profile.inputs.label.selectTimeZone")
|
|
462
|
+
}), /*#__PURE__*/jsx("div", {
|
|
463
|
+
className: "w-full flex-grow",
|
|
464
|
+
"data-cy": "ntm-profile-time-zone-select",
|
|
465
|
+
ref: function ref(node) {
|
|
466
|
+
return timezoneRef({
|
|
467
|
+
node: node,
|
|
468
|
+
setFieldValue: setFieldValue
|
|
469
|
+
});
|
|
496
470
|
}
|
|
497
|
-
})
|
|
471
|
+
})]
|
|
472
|
+
}), touched.timeZone && errors.timeZone && /*#__PURE__*/jsx(Typography, {
|
|
473
|
+
className: "neeto-ui-text-error-800",
|
|
474
|
+
lineHeight: "none",
|
|
475
|
+
style: "body3",
|
|
476
|
+
children: errors.timeZone
|
|
477
|
+
})]
|
|
478
|
+
}), /*#__PURE__*/jsx(Select, {
|
|
479
|
+
required: true,
|
|
480
|
+
"data-cy": "ntm-time-format-select",
|
|
481
|
+
name: "timeFormat",
|
|
482
|
+
options: TIME_FORMAT_OPTIONS,
|
|
483
|
+
label: t("neetoTeamMembers.profile.inputs.label.selectTimeFormat"),
|
|
484
|
+
onChange: function onChange(option) {
|
|
485
|
+
setFieldValue("timeFormat", option.value);
|
|
486
|
+
}
|
|
487
|
+
}), /*#__PURE__*/jsx("div", {
|
|
488
|
+
className: "space-y-2",
|
|
489
|
+
children: /*#__PURE__*/jsx(Select, {
|
|
490
|
+
required: true,
|
|
491
|
+
"data-cy": "ntm-date-format-select",
|
|
492
|
+
name: "dateFormat",
|
|
493
|
+
options: DATE_FORMAT_OPTIONS,
|
|
494
|
+
label: t("neetoTeamMembers.profile.inputs.label.dateFormat"),
|
|
495
|
+
onChange: function onChange(option) {
|
|
496
|
+
setFieldValue("dateFormat", option.value);
|
|
497
|
+
}
|
|
498
498
|
})
|
|
499
499
|
})]
|
|
500
500
|
})]
|
|
501
|
-
})
|
|
502
|
-
className: "neeto-ui-border-gray-200 w-full"
|
|
503
|
-
}), /*#__PURE__*/jsx(Callout, {
|
|
504
|
-
className: "neeto-ui-bg-gray-100 neeto-ui-border-gray-300 mt-8 w-full",
|
|
505
|
-
children: /*#__PURE__*/jsx(Typography, {
|
|
506
|
-
style: "body2",
|
|
507
|
-
weight: "light",
|
|
508
|
-
children: /*#__PURE__*/jsx(Trans, {
|
|
509
|
-
i18nKey: "neetoTeamMembers.profile.common.toUpdateProfile",
|
|
510
|
-
components: {
|
|
511
|
-
button: /*#__PURE__*/jsx(Button, {
|
|
512
|
-
className: "neeto-ui-font-size-inherit",
|
|
513
|
-
"data-cy": "ntm-visit-auth-button",
|
|
514
|
-
"data-test-id": "ntm-visit-auth-button",
|
|
515
|
-
href: MY_PROFILE_PATH,
|
|
516
|
-
style: "link",
|
|
517
|
-
target: "_blank"
|
|
518
|
-
})
|
|
519
|
-
}
|
|
520
|
-
})
|
|
521
|
-
})
|
|
522
|
-
})]
|
|
501
|
+
})
|
|
523
502
|
}), /*#__PURE__*/jsx(Pane.Footer, {
|
|
524
503
|
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
525
504
|
isSubmitting: isUpdatingProfile || isUploading,
|
|
@@ -566,30 +545,229 @@ var useProfileUpdatePaneState = function useProfileUpdatePaneState() {
|
|
|
566
545
|
}, shallow);
|
|
567
546
|
};
|
|
568
547
|
|
|
548
|
+
var Preview = function Preview() {
|
|
549
|
+
var _findBy, _findBy2, _globalProps$user;
|
|
550
|
+
var _useTranslation = useTranslation(),
|
|
551
|
+
t = _useTranslation.t;
|
|
552
|
+
var _useState = useState(""),
|
|
553
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
554
|
+
time = _useState2[0],
|
|
555
|
+
setTime = _useState2[1];
|
|
556
|
+
var _useFetchProfile = useFetchProfile(),
|
|
557
|
+
_useFetchProfile$data = _useFetchProfile.data,
|
|
558
|
+
_useFetchProfile$data2 = _useFetchProfile$data === void 0 ? {} : _useFetchProfile$data,
|
|
559
|
+
_useFetchProfile$data3 = _useFetchProfile$data2.user,
|
|
560
|
+
user = _useFetchProfile$data3 === void 0 ? {} : _useFetchProfile$data3,
|
|
561
|
+
isFetchingUserDetails = _useFetchProfile.isFetching;
|
|
562
|
+
var _user$firstName = user.firstName,
|
|
563
|
+
firstName = _user$firstName === void 0 ? "" : _user$firstName,
|
|
564
|
+
_user$lastName = user.lastName,
|
|
565
|
+
lastName = _user$lastName === void 0 ? "" : _user$lastName,
|
|
566
|
+
_user$email = user.email,
|
|
567
|
+
email = _user$email === void 0 ? "" : _user$email,
|
|
568
|
+
_user$dateFormat = user.dateFormat,
|
|
569
|
+
dateFormat = _user$dateFormat === void 0 ? user.dateFormat || DATE_FORMAT_OPTIONS[0].value : _user$dateFormat,
|
|
570
|
+
_user$timeZone = user.timeZone,
|
|
571
|
+
timeZone = _user$timeZone === void 0 ? "" : _user$timeZone,
|
|
572
|
+
_user$profileImageUrl = user.profileImageUrl,
|
|
573
|
+
profileImageUrl = _user$profileImageUrl === void 0 ? "" : _user$profileImageUrl,
|
|
574
|
+
_user$countryName = user.countryName,
|
|
575
|
+
countryName = _user$countryName === void 0 ? "" : _user$countryName,
|
|
576
|
+
_user$timeFormat = user.timeFormat,
|
|
577
|
+
timeFormat = _user$timeFormat === void 0 ? user.timeFormat || TIME_FORMAT_OPTIONS[0].value : _user$timeFormat;
|
|
578
|
+
var name = "".concat(firstName, " ").concat(lastName).trim();
|
|
579
|
+
useEffect(function () {
|
|
580
|
+
var updateTime = function updateTime() {
|
|
581
|
+
var now = new Date();
|
|
582
|
+
var options = {
|
|
583
|
+
timeZone: timeZone,
|
|
584
|
+
hour: "2-digit",
|
|
585
|
+
minute: "2-digit",
|
|
586
|
+
hour12: timeFormat === "12h" || true
|
|
587
|
+
};
|
|
588
|
+
var formattedTime = new Intl.DateTimeFormat("en-US", options).format(now);
|
|
589
|
+
setTime(formattedTime);
|
|
590
|
+
};
|
|
591
|
+
var interval = setInterval(updateTime, 1000);
|
|
592
|
+
return function () {
|
|
593
|
+
return clearInterval(interval);
|
|
594
|
+
};
|
|
595
|
+
}, [timeZone]);
|
|
596
|
+
if (!time || isFetchingUserDetails) {
|
|
597
|
+
return /*#__PURE__*/jsx("div", {
|
|
598
|
+
className: "flex h-full w-full items-center justify-center",
|
|
599
|
+
children: /*#__PURE__*/jsx(Spinner, {})
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
return /*#__PURE__*/jsx(Pane.Body, {
|
|
603
|
+
className: "w-full",
|
|
604
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
605
|
+
className: "w-full",
|
|
606
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
607
|
+
className: "mb-4 flex flex-col items-center justify-center",
|
|
608
|
+
children: [/*#__PURE__*/jsx(Avatar, {
|
|
609
|
+
className: "mb-1",
|
|
610
|
+
size: "extraLarge",
|
|
611
|
+
user: {
|
|
612
|
+
name: name,
|
|
613
|
+
imageUrl: profileImageUrl
|
|
614
|
+
}
|
|
615
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
616
|
+
style: "h3",
|
|
617
|
+
weight: "semibold",
|
|
618
|
+
children: name
|
|
619
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
620
|
+
className: "flex items-center gap-1",
|
|
621
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
622
|
+
className: "neeto-ui-text-gray-600",
|
|
623
|
+
style: "body2",
|
|
624
|
+
children: email
|
|
625
|
+
}), /*#__PURE__*/jsx(CopyToClipboardButton, {
|
|
626
|
+
size: "small",
|
|
627
|
+
style: "text",
|
|
628
|
+
value: email
|
|
629
|
+
})]
|
|
630
|
+
})]
|
|
631
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
632
|
+
className: "neeto-ui-border-gray-200 space-y-4 border-t py-4",
|
|
633
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
634
|
+
className: "flex flex-col gap-1",
|
|
635
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
636
|
+
children: t("neetoTeamMembers.labels.firstName")
|
|
637
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
638
|
+
className: "neeto-ui-text-gray-600",
|
|
639
|
+
style: "body2",
|
|
640
|
+
children: firstName
|
|
641
|
+
})]
|
|
642
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
643
|
+
className: "flex flex-col gap-1",
|
|
644
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
645
|
+
children: t("neetoTeamMembers.labels.lastName")
|
|
646
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
647
|
+
className: "neeto-ui-text-gray-600",
|
|
648
|
+
style: "body2",
|
|
649
|
+
children: lastName
|
|
650
|
+
})]
|
|
651
|
+
})]
|
|
652
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
653
|
+
className: "neeto-ui-border-gray-200 space-y-4 border-t py-4",
|
|
654
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
655
|
+
className: "flex flex-col gap-1",
|
|
656
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
657
|
+
children: t("neetoTeamMembers.labels.country")
|
|
658
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
659
|
+
className: "neeto-ui-text-gray-600",
|
|
660
|
+
style: "body2",
|
|
661
|
+
children: countryName || "-"
|
|
662
|
+
})]
|
|
663
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
664
|
+
className: "flex flex-col gap-1",
|
|
665
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
666
|
+
children: t("neetoTeamMembers.labels.timeZone")
|
|
667
|
+
}), /*#__PURE__*/jsxs(Typography, {
|
|
668
|
+
className: "neeto-ui-text-gray-600",
|
|
669
|
+
style: "body2",
|
|
670
|
+
children: [ianaTimezoneToHumanReadable(timeZone), " - ", time]
|
|
671
|
+
})]
|
|
672
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
673
|
+
className: "flex flex-col gap-1",
|
|
674
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
675
|
+
children: t("neetoTeamMembers.labels.preferredTimeFormat")
|
|
676
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
677
|
+
className: "neeto-ui-text-gray-600",
|
|
678
|
+
style: "body2",
|
|
679
|
+
children: ((_findBy = findBy({
|
|
680
|
+
value: timeFormat
|
|
681
|
+
}, TIME_FORMAT_OPTIONS)) === null || _findBy === void 0 ? void 0 : _findBy.label) || "-"
|
|
682
|
+
})]
|
|
683
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
684
|
+
className: "flex flex-col gap-1",
|
|
685
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
686
|
+
children: t("neetoTeamMembers.labels.preferredDateFormat")
|
|
687
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
688
|
+
className: "neeto-ui-text-gray-600",
|
|
689
|
+
style: "body2",
|
|
690
|
+
children: ((_findBy2 = findBy({
|
|
691
|
+
value: dateFormat
|
|
692
|
+
}, DATE_FORMAT_OPTIONS)) === null || _findBy2 === void 0 ? void 0 : _findBy2.label) || "-"
|
|
693
|
+
})]
|
|
694
|
+
})]
|
|
695
|
+
}), /*#__PURE__*/jsx("div", {
|
|
696
|
+
className: "neeto-ui-border-gray-200 space-y-4 border-t py-4",
|
|
697
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
698
|
+
className: "flex flex-col gap-1",
|
|
699
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
700
|
+
children: t("neetoTeamMembers.labels.billingAndSubscriptions")
|
|
701
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
702
|
+
className: "neeto-ui-text-gray-700",
|
|
703
|
+
style: "body2",
|
|
704
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
705
|
+
i18nKey: "neetoTeamMembers.common.subscriptionType",
|
|
706
|
+
values: {
|
|
707
|
+
subscription: capitalize((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.subscriptionPlan)
|
|
708
|
+
}
|
|
709
|
+
})
|
|
710
|
+
})]
|
|
711
|
+
})
|
|
712
|
+
})]
|
|
713
|
+
})
|
|
714
|
+
});
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
var Menu = Dropdown.Menu,
|
|
718
|
+
MenuItem = Dropdown.MenuItem;
|
|
569
719
|
var Profile = function Profile() {
|
|
720
|
+
var _useTranslation = useTranslation(),
|
|
721
|
+
t = _useTranslation.t;
|
|
570
722
|
var _useProfileUpdatePane = useProfileUpdatePaneState(),
|
|
571
723
|
_useProfileUpdatePane2 = _slicedToArray(_useProfileUpdatePane, 2),
|
|
572
724
|
isOpen = _useProfileUpdatePane2[0],
|
|
573
725
|
setIsOpen = _useProfileUpdatePane2[1];
|
|
574
|
-
var
|
|
575
|
-
|
|
726
|
+
var _useState = useState(false),
|
|
727
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
728
|
+
isEditMode = _useState2[0],
|
|
729
|
+
setIsEditMode = _useState2[1];
|
|
576
730
|
var onClose = function onClose() {
|
|
577
|
-
|
|
731
|
+
setIsOpen(false);
|
|
732
|
+
setIsEditMode(false);
|
|
733
|
+
};
|
|
734
|
+
var enableEditMode = function enableEditMode() {
|
|
735
|
+
return setIsEditMode(true);
|
|
578
736
|
};
|
|
579
737
|
return /*#__PURE__*/jsx("div", {
|
|
580
738
|
className: "w-full",
|
|
581
739
|
children: /*#__PURE__*/jsxs(Pane, {
|
|
582
740
|
isOpen: isOpen,
|
|
583
741
|
onClose: onClose,
|
|
742
|
+
className: "max-w-96",
|
|
584
743
|
children: [/*#__PURE__*/jsx(Pane.Header, {
|
|
585
|
-
children: /*#__PURE__*/
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
744
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
745
|
+
className: "flex justify-between",
|
|
746
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
747
|
+
style: "h2",
|
|
748
|
+
weight: "semibold",
|
|
749
|
+
children: t("neetoTeamMembers.profile.common.myProfile")
|
|
750
|
+
}), !isEditMode && /*#__PURE__*/jsx(Dropdown, {
|
|
751
|
+
buttonSize: "small",
|
|
752
|
+
buttonStyle: "secondary",
|
|
753
|
+
icon: MenuHorizontal,
|
|
754
|
+
children: /*#__PURE__*/jsxs(Menu, {
|
|
755
|
+
children: [/*#__PURE__*/jsx(MenuItem.Button, {
|
|
756
|
+
onClick: enableEditMode,
|
|
757
|
+
children: t("neetoTeamMembers.buttons.editBasicInfo")
|
|
758
|
+
}), /*#__PURE__*/jsx(MenuItem.Button, {
|
|
759
|
+
href: MY_PROFILE_PATH,
|
|
760
|
+
children: t("neetoTeamMembers.buttons.updateEmail")
|
|
761
|
+
}), /*#__PURE__*/jsx(MenuItem.Button, {
|
|
762
|
+
href: MY_PROFILE_PATH,
|
|
763
|
+
children: t("neetoTeamMembers.buttons.manageBillingAndSubscriptions")
|
|
764
|
+
})]
|
|
765
|
+
})
|
|
766
|
+
})]
|
|
589
767
|
})
|
|
590
|
-
}), /*#__PURE__*/jsx(ChangeProfile, {
|
|
768
|
+
}), isEditMode ? /*#__PURE__*/jsx(ChangeProfile, {
|
|
591
769
|
onClose: onClose
|
|
592
|
-
})]
|
|
770
|
+
}) : /*#__PURE__*/jsx(Preview, {})]
|
|
593
771
|
})
|
|
594
772
|
});
|
|
595
773
|
};
|