cozy-ui-plus 5.2.0 → 5.2.2
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/CHANGELOG.md +10 -0
- package/dist/AppSections/Sections.js +2 -2
- package/dist/AppTile/index.js +2 -2
- package/dist/Contacts/AddModal/ContactAddressDialog/index.js +2 -2
- package/dist/Contacts/AddModal/ContactForm/FieldInputAccordion.js +2 -2
- package/dist/Contacts/AddModal/ContactForm/FieldInputArray.js +2 -2
- package/dist/Contacts/AddModal/ContactForm/FieldInputLayout.js +2 -2
- package/dist/Contacts/AddModal/ContactForm/TextFieldSelect.js +2 -2
- package/dist/Contacts/AddModal/ContactForm/formValuesToContact.js +1 -1
- package/dist/Contacts/AddModal/ContactForm/helpers.js +30 -3
- package/dist/Contacts/AddModal/ContactForm/index.js +2 -2
- package/dist/Contacts/AddModal/CustomLabelDialog/index.js +2 -2
- package/dist/Contacts/AddModal/index.js +2 -2
- package/dist/Contacts/GroupsSelect/GroupCreation.js +2 -2
- package/dist/Contacts/GroupsSelect/SelectBox/Control.js +2 -2
- package/dist/Contacts/GroupsSelect/useGroupSelect.js +2 -2
- package/dist/Contacts/Header/GroupsSelection.js +2 -2
- package/dist/Contacts/Header/ImportDropdown.js +2 -2
- package/dist/Contacts/Header/index.js +2 -2
- package/dist/ContactsList/Contacts/ContactIdentity.js +2 -2
- package/dist/ContactsList/ContactsList.js +2 -2
- package/dist/ContactsListModal/ContactsListContent.js +2 -2
- package/dist/ContactsListModal/ContactsListModal.js +2 -2
- package/dist/FilePicker/FilePickerBodyItem.js +2 -2
- package/dist/FilePicker/FilePickerFooter.js +2 -2
- package/dist/FilePicker/docs/DemoProvider.js +2 -2
- package/dist/ListItem/ExpandedAttributes/ExpandedAttribute.js +2 -2
- package/dist/ListItem/ExpandedAttributes/index.js +2 -2
- package/dist/ListItem/ListItemBase/Renaming/RenameDialog.js +2 -2
- package/dist/ListItem/ListItemFile/ExpirationAnnotation.js +2 -2
- package/dist/ListItem/ListItemFile/SecondaryText.js +2 -2
- package/dist/Paywall/Paywall.js +2 -2
- package/dist/Qualification/QualificationGrid/index.js +2 -2
- package/dist/Qualification/QualificationModal/index.js +2 -2
- package/dist/SquareAppIcon/index.js +4 -2
- package/dist/Storage/StorageButton.js +2 -2
- package/dist/Storage/StorageProgress.js +2 -2
- package/dist/UploadQueue/Item.js +2 -2
- package/dist/UploadQueue/Pending.js +2 -2
- package/dist/UploadQueue/RemainingTime.js +2 -2
- package/dist/UploadQueue/index.js +2 -2
- package/dist/hooks/useClientErrors.js +1 -0
- package/dist/src/Contacts/AddModal/ContactForm/helpers.d.ts +3 -0
- package/package.json +4 -4
- package/src/AppIcon/index.spec.js +0 -1
- package/src/AppSections/Sections.jsx +1 -1
- package/src/AppSections/categories.spec.js +0 -2
- package/src/AppSections/components/AppsSection.spec.jsx +0 -2
- package/src/AppSections/index.spec.jsx +0 -2
- package/src/AppSections/search.spec.js +0 -2
- package/src/AppTile/AppTile.spec.jsx +1 -2
- package/src/AppTile/index.jsx +3 -3
- package/src/ContactPicker/index.jsx +1 -1
- package/src/Contacts/AddModal/ContactAddressDialog/index.jsx +1 -1
- package/src/Contacts/AddModal/ContactForm/FieldInput.jsx +1 -0
- package/src/Contacts/AddModal/ContactForm/FieldInputAccordion.jsx +1 -1
- package/src/Contacts/AddModal/ContactForm/FieldInputArray.jsx +1 -1
- package/src/Contacts/AddModal/ContactForm/FieldInputLayout.jsx +1 -1
- package/src/Contacts/AddModal/ContactForm/FieldInputWrapper.jsx +6 -6
- package/src/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.jsx +1 -0
- package/src/Contacts/AddModal/ContactForm/TextFieldSelect.jsx +1 -1
- package/src/Contacts/AddModal/ContactForm/contactToFormValues.spec.js +0 -1
- package/src/Contacts/AddModal/ContactForm/formValuesToContact.js +2 -1
- package/src/Contacts/AddModal/ContactForm/helpers.js +24 -1
- package/src/Contacts/AddModal/ContactForm/helpers.spec.js +40 -0
- package/src/Contacts/AddModal/ContactForm/index.jsx +1 -1
- package/src/Contacts/AddModal/CustomLabelDialog/index.jsx +1 -1
- package/src/Contacts/AddModal/index.jsx +1 -1
- package/src/Contacts/GroupsSelect/GroupCreation.jsx +1 -1
- package/src/Contacts/GroupsSelect/GroupsSelectProvider.jsx +1 -0
- package/src/Contacts/GroupsSelect/SelectBox/Control.jsx +1 -1
- package/src/Contacts/GroupsSelect/useGroupSelect.jsx +1 -1
- package/src/Contacts/Header/GroupsSelection.jsx +1 -1
- package/src/Contacts/Header/ImportDropdown.jsx +1 -1
- package/src/Contacts/Header/index.jsx +1 -1
- package/src/ContactsList/Contacts/ContactIdentity.jsx +1 -1
- package/src/ContactsList/ContactsList.jsx +1 -1
- package/src/ContactsListModal/ContactsListContent.jsx +1 -1
- package/src/ContactsListModal/ContactsListModal.jsx +1 -1
- package/src/FilePicker/FilePickerBodyItem.jsx +1 -1
- package/src/FilePicker/FilePickerFooter.jsx +1 -1
- package/src/FilePicker/docs/DemoProvider.jsx +1 -1
- package/src/ListItem/ExpandedAttributes/ExpandedAttribute.jsx +1 -1
- package/src/ListItem/ExpandedAttributes/helpers.js +1 -1
- package/src/ListItem/ExpandedAttributes/index.jsx +1 -1
- package/src/ListItem/ListItemBase/Renaming/RenameDialog.jsx +1 -1
- package/src/ListItem/ListItemFile/ExpirationAnnotation.jsx +1 -1
- package/src/ListItem/ListItemFile/SecondaryText.jsx +1 -1
- package/src/Paywall/Paywall.jsx +3 -3
- package/src/Qualification/QualificationGrid/index.jsx +1 -1
- package/src/Qualification/QualificationIcon/index.jsx +2 -2
- package/src/Qualification/QualificationModal/index.jsx +1 -1
- package/src/SquareAppIcon/SquareAppIcon.spec.js +0 -2
- package/src/SquareAppIcon/index.jsx +2 -0
- package/src/Storage/StorageButton.jsx +1 -1
- package/src/Storage/StorageProgress.jsx +1 -1
- package/src/UploadQueue/Item.jsx +1 -1
- package/src/UploadQueue/Pending.jsx +1 -1
- package/src/UploadQueue/RemainingTime.jsx +1 -1
- package/src/UploadQueue/index.jsx +1 -1
- package/src/hooks/useClientErrors.jsx +1 -0
|
@@ -11,8 +11,6 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
|
|
14
|
-
var _twakeI18n = require("twake-i18n");
|
|
15
|
-
|
|
16
14
|
var _cozyClient = require("cozy-client");
|
|
17
15
|
|
|
18
16
|
var _instance = require("cozy-client/dist/models/instance");
|
|
@@ -23,6 +21,8 @@ var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
|
|
|
23
21
|
|
|
24
22
|
var _TwakeWorkplace = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/TwakeWorkplace"));
|
|
25
23
|
|
|
24
|
+
var _twakeI18n = require("twake-i18n");
|
|
25
|
+
|
|
26
26
|
var _locales = require("./locales");
|
|
27
27
|
|
|
28
28
|
var StorageButton = function StorageButton(_ref) {
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
var _twakeI18n = require("twake-i18n");
|
|
13
|
-
|
|
14
12
|
var _cozyClient = require("cozy-client");
|
|
15
13
|
|
|
16
14
|
var _instance = require("cozy-client/dist/models/instance");
|
|
@@ -23,6 +21,8 @@ var _LinearProgress = _interopRequireDefault(require("cozy-ui/transpiled/react/L
|
|
|
23
21
|
|
|
24
22
|
var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
|
|
25
23
|
|
|
24
|
+
var _twakeI18n = require("twake-i18n");
|
|
25
|
+
|
|
26
26
|
var _locales = require("./locales");
|
|
27
27
|
|
|
28
28
|
/**
|
package/dist/UploadQueue/Item.js
CHANGED
|
@@ -13,8 +13,6 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
|
|
16
|
-
var _twakeI18n = require("twake-i18n");
|
|
17
|
-
|
|
18
16
|
var _file = require("cozy-client/dist/models/file");
|
|
19
17
|
|
|
20
18
|
var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
|
|
@@ -29,6 +27,8 @@ var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typog
|
|
|
29
27
|
|
|
30
28
|
var _Media = require("cozy-ui/transpiled/react/deprecated/Media");
|
|
31
29
|
|
|
30
|
+
var _twakeI18n = require("twake-i18n");
|
|
31
|
+
|
|
32
32
|
var _FileUploadProgress = _interopRequireDefault(require("./FileUploadProgress"));
|
|
33
33
|
|
|
34
34
|
var _Pending = _interopRequireDefault(require("./Pending"));
|
|
@@ -9,10 +9,10 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
var _twakeI18n = require("twake-i18n");
|
|
13
|
-
|
|
14
12
|
var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
|
|
15
13
|
|
|
14
|
+
var _twakeI18n = require("twake-i18n");
|
|
15
|
+
|
|
16
16
|
var Pending = (0, _twakeI18n.translate)()(function (props) {
|
|
17
17
|
return /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
18
18
|
variant: "subtitle1",
|
|
@@ -11,10 +11,10 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
|
|
14
|
-
var _twakeI18n = require("twake-i18n");
|
|
15
|
-
|
|
16
14
|
var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
|
|
17
15
|
|
|
16
|
+
var _twakeI18n = require("twake-i18n");
|
|
17
|
+
|
|
18
18
|
var _helpers = require("./helpers");
|
|
19
19
|
|
|
20
20
|
var _index = require("./index");
|
|
@@ -27,8 +27,6 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
27
27
|
|
|
28
28
|
var _react = _interopRequireWildcard(require("react"));
|
|
29
29
|
|
|
30
|
-
var _twakeI18n = require("twake-i18n");
|
|
31
|
-
|
|
32
30
|
var _LinearProgress = _interopRequireDefault(require("cozy-ui/transpiled/react/LinearProgress"));
|
|
33
31
|
|
|
34
32
|
var _List = _interopRequireDefault(require("cozy-ui/transpiled/react/List"));
|
|
@@ -39,6 +37,8 @@ var _Button = _interopRequireDefault(require("cozy-ui/transpiled/react/deprecate
|
|
|
39
37
|
|
|
40
38
|
var _styles = require("cozy-ui/transpiled/react/styles");
|
|
41
39
|
|
|
40
|
+
var _twakeI18n = require("twake-i18n");
|
|
41
|
+
|
|
42
42
|
var _Item = _interopRequireDefault(require("./Item"));
|
|
43
43
|
|
|
44
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -177,6 +177,7 @@ function useClientErrors() {
|
|
|
177
177
|
var ClientErrors = (0, _react.useCallback)(function () {
|
|
178
178
|
return renderErrors(errorStack, setErrorStack);
|
|
179
179
|
}, [errorStack, setErrorStack]); // @ts-ignore
|
|
180
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
180
181
|
|
|
181
182
|
ClientErrors.displayName = 'ClientErrors';
|
|
182
183
|
return {
|
|
@@ -43,3 +43,6 @@ export function makeImppValues(oldContact: import("cozy-client/types/types").IOC
|
|
|
43
43
|
export function initializationFieldValues(fields: any): any;
|
|
44
44
|
export function makeInitialCustomValue(name: string, value: string): string;
|
|
45
45
|
export function makeFields(customFields: (import("../types").Field)[] | undefined, defaultFields: (import("../types").Field)[]): (import("../types").Field)[];
|
|
46
|
+
export function excludedCountryCode(val: {
|
|
47
|
+
phone: string;
|
|
48
|
+
}): string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-ui-plus",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2",
|
|
4
4
|
"description": "Cozy-ui-plus is an extension of cozy-ui and provides components based on cozy-client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"babel-preset-cozy-app": "^2.8.4",
|
|
35
35
|
"cozy-client": "^60.21.3",
|
|
36
36
|
"cozy-device-helper": "2.0.0",
|
|
37
|
-
"cozy-intent": "^2.30.
|
|
37
|
+
"cozy-intent": "^2.30.4",
|
|
38
38
|
"cozy-logger": "^1.17.1",
|
|
39
39
|
"cozy-stack-client": "^60.21.1",
|
|
40
40
|
"cozy-ui": "^135.0.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"react-dom": "16.12.0",
|
|
48
48
|
"react-test-renderer": "16.12.0",
|
|
49
49
|
"stylus": "0.64.0",
|
|
50
|
-
"twake-i18n": "^0.3.
|
|
50
|
+
"twake-i18n": "^0.3.3",
|
|
51
51
|
"typescript": "5.5.2"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"react-dom": "^16 || ^17 || ^18",
|
|
74
74
|
"twake-i18n": ">=0.3.0"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "81041f18f0134c0ead8f325adc27e6182965c875"
|
|
77
77
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import cx from 'classnames'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import React, { Component } from 'react'
|
|
4
|
-
import { useI18n, useExtendI18n, withOnlyLocales } from 'twake-i18n'
|
|
5
4
|
|
|
6
5
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
7
6
|
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
7
|
+
import { useI18n, useExtendI18n, withOnlyLocales } from 'twake-i18n'
|
|
8
8
|
|
|
9
9
|
import styles from './Sections.styl'
|
|
10
10
|
import * as catUtils from './categories'
|
package/src/AppTile/index.jsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import cx from 'classnames'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import { createUseI18n } from 'twake-i18n'
|
|
5
4
|
|
|
6
5
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
7
6
|
import WrenchCircleIcon from 'cozy-ui/transpiled/react/Icons/WrenchCircle'
|
|
@@ -12,6 +11,7 @@ import Tile, {
|
|
|
12
11
|
TileIcon,
|
|
13
12
|
TileDescription
|
|
14
13
|
} from 'cozy-ui/transpiled/react/Tile'
|
|
14
|
+
import { createUseI18n } from 'twake-i18n'
|
|
15
15
|
|
|
16
16
|
import { APP_STATUS, getCurrentStatusLabel } from './helpers'
|
|
17
17
|
import en from './locales/en.json'
|
|
@@ -64,8 +64,8 @@ export const AppTile = ({
|
|
|
64
64
|
isShortcutFile(app) && statusLabel === APP_STATUS.installed
|
|
65
65
|
? 'favorite'
|
|
66
66
|
: isStatusArray
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
? showStatus.indexOf(statusLabel) > -1 && statusLabel
|
|
68
|
+
: showStatus && statusLabel
|
|
69
69
|
|
|
70
70
|
const IconComponent = IconComponentProp || AppIcon
|
|
71
71
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import PropTypes from 'prop-types'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { Field, useForm } from 'react-final-form'
|
|
4
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
5
4
|
|
|
6
5
|
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
7
6
|
import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
|
|
7
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
8
8
|
|
|
9
9
|
import { makeFormattedAddressWithSubFields } from './helpers'
|
|
10
10
|
import { locales } from './locales'
|
|
@@ -3,6 +3,7 @@ import uniqueId from 'lodash/uniqueId'
|
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import React, { useState } from 'react'
|
|
5
5
|
import { Field } from 'react-final-form'
|
|
6
|
+
|
|
6
7
|
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
7
8
|
|
|
8
9
|
import FieldInputWrapper from './FieldInputWrapper'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
3
2
|
|
|
4
3
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
5
4
|
import IconButton from 'cozy-ui/transpiled/react/IconButton'
|
|
6
5
|
import DropdownIcon from 'cozy-ui/transpiled/react/Icons/Dropdown'
|
|
7
6
|
import DropupIcon from 'cozy-ui/transpiled/react/Icons/Dropup'
|
|
7
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
8
8
|
|
|
9
9
|
import FieldInput from './FieldInput'
|
|
10
10
|
import { locales } from './locales'
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import cx from 'classnames'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { FieldArray } from 'react-final-form-arrays'
|
|
4
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
5
4
|
|
|
6
5
|
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
7
6
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
@@ -9,6 +8,7 @@ import IconButton from 'cozy-ui/transpiled/react/IconButton'
|
|
|
9
8
|
import CrossCircleIcon from 'cozy-ui/transpiled/react/Icons/CrossCircle'
|
|
10
9
|
import PlusIcon from 'cozy-ui/transpiled/react/Icons/Plus'
|
|
11
10
|
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
11
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
12
12
|
|
|
13
13
|
import FieldInput from './FieldInput'
|
|
14
14
|
import { addField, removeField, makeIsRequiredError } from './helpers'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import cx from 'classnames'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
5
4
|
|
|
6
5
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
6
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
7
7
|
|
|
8
8
|
import FieldInput from './FieldInput'
|
|
9
9
|
import FieldInputAccordion from './FieldInputAccordion'
|
|
@@ -12,10 +12,10 @@ const FieldInputWrapper = ({
|
|
|
12
12
|
input,
|
|
13
13
|
attributes: {
|
|
14
14
|
component,
|
|
15
|
-
layout,
|
|
16
|
-
icon,
|
|
17
|
-
isSecondary,
|
|
18
|
-
validate,
|
|
15
|
+
layout,
|
|
16
|
+
icon,
|
|
17
|
+
isSecondary,
|
|
18
|
+
validate,
|
|
19
19
|
...restAttributes
|
|
20
20
|
}, // ⚠️ `layout` `icon` `isSecondary` `validate` are removed from attributes to avoid DOM propagration, only used for business rules
|
|
21
21
|
variant,
|
|
@@ -27,8 +27,8 @@ const FieldInputWrapper = ({
|
|
|
27
27
|
(restAttributes.customLabelOptions
|
|
28
28
|
? TextFieldCustomLabelSelect
|
|
29
29
|
: restAttributes?.select
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
? TextFieldSelect
|
|
31
|
+
: TextField)
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<Component
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
3
2
|
|
|
4
3
|
import MenuItem from 'cozy-ui/transpiled/react/MenuItem'
|
|
5
4
|
import TextField from 'cozy-ui/transpiled/react/TextField'
|
|
5
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
6
6
|
|
|
7
7
|
import { locales } from './locales'
|
|
8
8
|
import { FieldInputWrapperPropTypes } from '../types'
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
createAddress,
|
|
7
7
|
getRelatedContactRelationships,
|
|
8
8
|
makeImppValues,
|
|
9
|
+
excludedCountryCode,
|
|
9
10
|
makeTypeAndLabel
|
|
10
11
|
} from './helpers'
|
|
11
12
|
|
|
@@ -76,7 +77,7 @@ const formValuesToContact = ({
|
|
|
76
77
|
address: createAddress({ address, oldContact: oldContactCleaned, t }),
|
|
77
78
|
phone: phone
|
|
78
79
|
? phone
|
|
79
|
-
.filter(val => val
|
|
80
|
+
.filter(val => (val?.phone ? excludedCountryCode(val) : undefined))
|
|
80
81
|
.map(({ phone, phoneLabel }, index) => ({
|
|
81
82
|
number: phone,
|
|
82
83
|
...makeTypeAndLabel(phoneLabel),
|
|
@@ -2,6 +2,7 @@ import get from 'lodash/get'
|
|
|
2
2
|
import isEqual from 'lodash/isEqual'
|
|
3
3
|
import merge from 'lodash/merge'
|
|
4
4
|
import uniqueId from 'lodash/uniqueId'
|
|
5
|
+
import { defaultCountries, parseCountry } from 'react-international-phone'
|
|
5
6
|
|
|
6
7
|
import { Association } from 'cozy-client'
|
|
7
8
|
import { makeDisplayName } from 'cozy-client/dist/models/contact'
|
|
@@ -171,7 +172,7 @@ export const createAddress = ({ address, oldContact, t }) => {
|
|
|
171
172
|
|
|
172
173
|
if (addressHasBeenModified) {
|
|
173
174
|
// Use "code" instead "postcode", to be vcard 4.0 rfc 6350 compliant
|
|
174
|
-
|
|
175
|
+
|
|
175
176
|
const { postcode, ...oldContactAddressCleaned } =
|
|
176
177
|
oldContactAddress || {}
|
|
177
178
|
return {
|
|
@@ -480,3 +481,25 @@ export const makeFields = (customFields, defaultFields) => {
|
|
|
480
481
|
|
|
481
482
|
return fields
|
|
482
483
|
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Excludes phone numbers that consist only of a country code.
|
|
487
|
+
* If the provided phone value matches only a country code (e.g., "+33"),
|
|
488
|
+
* returns undefined. Otherwise, returns the phone value.
|
|
489
|
+
*
|
|
490
|
+
* @param {Object} val - An object containing the phone number.
|
|
491
|
+
* @param {string} val.phone - The phone number string, possibly starting with "+" and a country code.
|
|
492
|
+
* @returns {string|undefined} The phone number if it is not just a country code, otherwise undefined.
|
|
493
|
+
*/
|
|
494
|
+
export const excludedCountryCode = val => {
|
|
495
|
+
const phoneWithoutPrefix = val.phone.split('+')[1]
|
|
496
|
+
|
|
497
|
+
const isOnlyCountryCode = defaultCountries.some(country => {
|
|
498
|
+
const { dialCode } = parseCountry(country)
|
|
499
|
+
return phoneWithoutPrefix === dialCode
|
|
500
|
+
})
|
|
501
|
+
|
|
502
|
+
if (isOnlyCountryCode) return undefined
|
|
503
|
+
|
|
504
|
+
return val.phone
|
|
505
|
+
}
|
|
@@ -12,10 +12,20 @@ import {
|
|
|
12
12
|
getFirstValueIfArray,
|
|
13
13
|
validateFields
|
|
14
14
|
} from './helpers'
|
|
15
|
+
import { excludedCountryCode } from './helpers'
|
|
15
16
|
import { locales } from './locales'
|
|
16
17
|
|
|
17
18
|
const t = x => get(locales.en, x, x)
|
|
18
19
|
|
|
20
|
+
jest.mock('react-international-phone', () => ({
|
|
21
|
+
...jest.requireActual('react-international-phone'),
|
|
22
|
+
defaultCountries: [
|
|
23
|
+
['France', 'fr', '33'],
|
|
24
|
+
['United States', 'us', '1'],
|
|
25
|
+
['Germany', 'de', '49']
|
|
26
|
+
]
|
|
27
|
+
}))
|
|
28
|
+
|
|
19
29
|
describe('makeCustomLabel', () => {
|
|
20
30
|
it('should return custom type and supported label', () => {
|
|
21
31
|
const resForWork = makeCustomLabel('{"type":"someType","label":"work"}', t)
|
|
@@ -741,3 +751,33 @@ describe('validateFields', () => {
|
|
|
741
751
|
expect(res).toEqual({ mail: 'Some fields are not filled correctly' })
|
|
742
752
|
})
|
|
743
753
|
})
|
|
754
|
+
|
|
755
|
+
describe('excludedCountryCode', () => {
|
|
756
|
+
it('returns undefined for country code only (+33)', () => {
|
|
757
|
+
expect(excludedCountryCode({ phone: '+33' })).toBeUndefined()
|
|
758
|
+
})
|
|
759
|
+
|
|
760
|
+
it('preserves full number for Germany (+4930123456)', () => {
|
|
761
|
+
expect(excludedCountryCode({ phone: '+4930123456' })).toBe('+4930123456')
|
|
762
|
+
})
|
|
763
|
+
|
|
764
|
+
it('returns undefined for country code only (+1)', () => {
|
|
765
|
+
expect(excludedCountryCode({ phone: '+1' })).toBeUndefined()
|
|
766
|
+
})
|
|
767
|
+
|
|
768
|
+
it('preserves full French mobile (+33612345678)', () => {
|
|
769
|
+
expect(excludedCountryCode({ phone: '+33612345678' })).toBe('+33612345678')
|
|
770
|
+
})
|
|
771
|
+
|
|
772
|
+
it('preserves value not matching country code (+490)', () => {
|
|
773
|
+
expect(excludedCountryCode({ phone: '+490' })).toBe('+490')
|
|
774
|
+
})
|
|
775
|
+
|
|
776
|
+
it('preserves numbers with no country code (12345)', () => {
|
|
777
|
+
expect(excludedCountryCode({ phone: '12345' })).toBe('12345')
|
|
778
|
+
})
|
|
779
|
+
|
|
780
|
+
it('returns undefined for country code only (+49)', () => {
|
|
781
|
+
expect(excludedCountryCode({ phone: '+49' })).toBeUndefined()
|
|
782
|
+
})
|
|
783
|
+
})
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import arrayMutators from 'final-form-arrays'
|
|
2
2
|
import React, { useState } from 'react'
|
|
3
3
|
import { Form } from 'react-final-form'
|
|
4
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
5
4
|
|
|
6
5
|
import { getHasManyItems } from 'cozy-client/dist/associations/HasMany'
|
|
7
6
|
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
7
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
8
8
|
|
|
9
9
|
import FieldInputLayout from './FieldInputLayout'
|
|
10
10
|
import contactToFormValues from './contactToFormValues'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types'
|
|
2
2
|
import React, { useState } from 'react'
|
|
3
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
4
3
|
|
|
5
4
|
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
6
5
|
import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
|
|
@@ -9,6 +8,7 @@ import RadioGroup from 'cozy-ui/transpiled/react/RadioGroup'
|
|
|
9
8
|
import Radio from 'cozy-ui/transpiled/react/Radios'
|
|
10
9
|
import TextField from 'cozy-ui/transpiled/react/TextField'
|
|
11
10
|
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
11
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
12
12
|
|
|
13
13
|
import { locales } from './locales'
|
|
14
14
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
3
2
|
|
|
4
3
|
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
5
4
|
import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
|
|
6
5
|
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
|
|
6
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
7
7
|
|
|
8
8
|
import ContactForm, { getSubmitContactForm } from './ContactForm'
|
|
9
9
|
import { locales } from './locales'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import classNames from 'classnames'
|
|
2
2
|
import React, { Component } from 'react'
|
|
3
|
-
import { translate } from 'twake-i18n'
|
|
4
3
|
|
|
5
4
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
6
5
|
import PlusIcon from 'cozy-ui/transpiled/react/Icons/Plus'
|
|
7
6
|
import Input from 'cozy-ui/transpiled/react/legacy/Input'
|
|
7
|
+
import { translate } from 'twake-i18n'
|
|
8
8
|
|
|
9
9
|
import styles from './styles.styl'
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import PropTypes from 'prop-types'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
4
3
|
|
|
5
4
|
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
6
5
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
7
6
|
import BottomSelectIcon from 'cozy-ui/transpiled/react/Icons/BottomSelect'
|
|
7
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
8
8
|
|
|
9
9
|
import { locales } from '../locales'
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import get from 'lodash/get'
|
|
2
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
3
2
|
|
|
4
3
|
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
|
|
4
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
5
5
|
|
|
6
6
|
import { useSelectedGroup } from './GroupsSelectProvider'
|
|
7
7
|
import { isExistingGroup } from './helpers'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
3
2
|
|
|
4
3
|
import { ControlDefault } from 'cozy-ui/transpiled/react/SelectBox'
|
|
5
4
|
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
5
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
6
6
|
|
|
7
7
|
import { locales } from './locales'
|
|
8
8
|
import GroupsSelect from '../GroupsSelect/GroupsSelect'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useState, useRef } from 'react'
|
|
2
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
3
2
|
|
|
4
3
|
import { useClient, generateWebLink } from 'cozy-client'
|
|
5
4
|
import { CONTACTS_DOCTYPE } from 'cozy-client/dist/models/contact'
|
|
@@ -11,6 +10,7 @@ import Link from 'cozy-ui/transpiled/react/Link'
|
|
|
11
10
|
import ActionMenu, {
|
|
12
11
|
ActionMenuItem
|
|
13
12
|
} from 'cozy-ui/transpiled/react/deprecated/ActionMenu'
|
|
13
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
14
14
|
|
|
15
15
|
import { locales } from './locales'
|
|
16
16
|
import AppIcon from '../../AppIcon'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import cx from 'classnames'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
5
4
|
|
|
6
5
|
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
7
6
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
8
7
|
import PersonAddIcon from 'cozy-ui/transpiled/react/Icons/PersonAdd'
|
|
9
8
|
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
9
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
10
10
|
|
|
11
11
|
import GroupsSelection from './GroupsSelection'
|
|
12
12
|
import ImportDropdown from './ImportDropdown'
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import cx from 'classnames'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
5
4
|
|
|
6
5
|
import { getInitials } from 'cozy-client/dist/models/contact'
|
|
7
6
|
import Avatar from 'cozy-ui/transpiled/react/Avatar'
|
|
8
7
|
import { TableCell } from 'cozy-ui/transpiled/react/deprecated/Table'
|
|
8
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
9
9
|
|
|
10
10
|
import ContactName from './ContactName'
|
|
11
11
|
import { locales } from '../locales/withContactsListLocales'
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import PropTypes from 'prop-types'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { useI18n } from 'twake-i18n'
|
|
4
3
|
|
|
5
4
|
import List from 'cozy-ui/transpiled/react/List'
|
|
6
5
|
import ListSubheader from 'cozy-ui/transpiled/react/ListSubheader'
|
|
7
6
|
import { Table } from 'cozy-ui/transpiled/react/deprecated/Table'
|
|
8
7
|
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
8
|
+
import { useI18n } from 'twake-i18n'
|
|
9
9
|
|
|
10
10
|
import ContactRow from './ContactRow'
|
|
11
11
|
import { sortContacts, categorizeContacts, sortHeaders } from './helpers'
|