cozy-ui 128.9.0 → 128.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/assets/icons/ui/matrix.svg +1 -0
- package/package.json +1 -1
- package/react/Contacts/AddModal/ContactForm/FieldInput.jsx +5 -2
- package/react/Contacts/AddModal/ContactForm/FieldInputAccordion.jsx +2 -2
- package/react/Contacts/AddModal/ContactForm/FieldInputLayout.jsx +2 -1
- package/react/Contacts/AddModal/ContactForm/contactToFormValues.js +7 -0
- package/react/Contacts/AddModal/ContactForm/contactToFormValues.spec.js +5 -0
- package/react/Contacts/AddModal/ContactForm/fieldsConfig.jsx +6 -0
- package/react/Contacts/AddModal/ContactForm/formValuesToContact.js +3 -0
- package/react/Contacts/AddModal/ContactForm/formValuesToContact.spec.js +57 -0
- package/react/Contacts/AddModal/ContactForm/helpers.js +41 -0
- package/react/Contacts/AddModal/ContactForm/helpers.spec.js +138 -0
- package/react/Contacts/AddModal/ContactForm/index.spec.jsx +12 -0
- package/react/Contacts/AddModal/ContactForm/locales/en.json +1 -0
- package/react/Contacts/AddModal/ContactForm/locales/fr.json +1 -0
- package/react/Contacts/AddModal/Readme.md +1 -1
- package/react/Contacts/AddModal/mocks.js +40 -1
- package/react/Icon/Readme.md +3 -1
- package/react/Icons/Matrix.jsx +12 -0
- package/transpiled/react/Contacts/AddModal/ContactForm/FieldInput.d.ts +3 -1
- package/transpiled/react/Contacts/AddModal/ContactForm/FieldInput.js +8 -1
- package/transpiled/react/Contacts/AddModal/ContactForm/FieldInputAccordion.js +2 -4
- package/transpiled/react/Contacts/AddModal/ContactForm/FieldInputLayout.js +2 -1
- package/transpiled/react/Contacts/AddModal/ContactForm/contactToFormValues.js +7 -0
- package/transpiled/react/Contacts/AddModal/ContactForm/fieldsConfig.js +5 -0
- package/transpiled/react/Contacts/AddModal/ContactForm/formValuesToContact.js +3 -1
- package/transpiled/react/Contacts/AddModal/ContactForm/helpers.d.ts +6 -0
- package/transpiled/react/Contacts/AddModal/ContactForm/helpers.js +39 -0
- package/transpiled/react/Contacts/AddModal/ContactForm/locales/index.js +2 -0
- package/transpiled/react/Contacts/AddModal/mocks.d.ts +19 -0
- package/transpiled/react/Contacts/AddModal/mocks.js +32 -0
- package/transpiled/react/Icon/icons-sprite.d.ts +1 -1
- package/transpiled/react/Icon/icons-sprite.js +1 -1
- package/transpiled/react/Icons/Matrix.d.ts +2 -0
- package/transpiled/react/Icons/Matrix.js +13 -0
package/react/Icon/Readme.md
CHANGED
|
@@ -229,6 +229,7 @@ import Logout from 'cozy-ui/transpiled/react/Icons/Logout'
|
|
|
229
229
|
import MagicTrick from 'cozy-ui/transpiled/react/Icons/MagicTrick'
|
|
230
230
|
import Magnet from 'cozy-ui/transpiled/react/Icons/Magnet'
|
|
231
231
|
import Magnifier from 'cozy-ui/transpiled/react/Icons/Magnifier'
|
|
232
|
+
import Matrix from 'cozy-ui/transpiled/react/Icons/Matrix'
|
|
232
233
|
import Merge from 'cozy-ui/transpiled/react/Icons/Merge'
|
|
233
234
|
import Moped from 'cozy-ui/transpiled/react/Icons/Moped'
|
|
234
235
|
import Mosaic from 'cozy-ui/transpiled/react/Icons/Mosaic'
|
|
@@ -512,6 +513,7 @@ const icons = [
|
|
|
512
513
|
MagicTrick,
|
|
513
514
|
Magnet,
|
|
514
515
|
Magnifier,
|
|
516
|
+
Matrix,
|
|
515
517
|
Merge,
|
|
516
518
|
Moped,
|
|
517
519
|
Mosaic,
|
|
@@ -992,7 +994,7 @@ import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
|
992
994
|
|
|
993
995
|
const colors = ['#297EF2', '#08b442', '#B449E7', '#F52D2D', '#FF962F']
|
|
994
996
|
let i = 0
|
|
995
|
-
const availableIcons = ['album-add','album-remove','album','answer','apple','archive','arrowUp','assign-admin','assign-moderator','attachment','attention','bank-check','bank','banking-add','banking','bell','benefit','bike','bill','bottom','browser-brave','browser-chrome','browser-duckduckgo','browser-edge','browser-edge-chromium','browser-firefox','browser-ie','browser-opera','browser-safari','burger','bus','calendar','camera','car','carbonCopy','carpooling','categories','certified','check-circle','check-list','check-square','check','checkbox','chess','child','circle-filled','clock','clock-outline','cloud-happy','cloud-rainbow','cloud-plus-outlined','cloud','cloud2','collect','cocktail','comment','company','compare','compass','connector','contract','contrast','copy','cozy-circle','cozy-laugh', 'cozy-lock', 'cozy-text', 'cozy-release', 'credit-card-add','credit-card','credit','crop','cross-circle-outline','cross-circle','cross-medium','cross-small','cross','cube','dash','dashboard','data-control','debit','desktop-download','devices','discuss','dots','down','download','drawing-arrow-up','dropdown-close','dropdown-open','dropdown','dropup','electric-bike','electric-car','electric-scooter','email-notification','email-open','email','eu','euro','exchange','eye-closed','eye','face-id','file-add','file-duotone','file-new','file-none','file-outline','file','filter','fingerprint','fitness','flag-outlined','flag','flash-auto','flashlight','folder-add','folder-moveto','folder-open','folder','forbidden','from-user','gear','globe','gouv','graph-circle','grid','group-list','groups','growth','hand','heart','help','help-outlined','history','home','hourglass','image','info-outlined','info','justice','key','key2','label-outlined','laudry','laptop','left','library','lightbulb','lightning','link-out','link','list','list-min','location','lock', 'lock-screen', 'logout','magic-trick','magnet','magnifier','merge','moped','mosaic','mosaic-min','motorcycle','mountain','movement-in','movement-out','mouvement','moveto','multi-files','music','new','next','note','notification-email','number','offline','online', 'openapp', 'openwith','palette','paper','paperplane','password','pen','people','peoples','percent-circle','percent','person-add','personal-data','phone-download','phone-upload','phone','pie-chart','pin','plane','plus-small','plus', 'pop-inside', 'previous','printer','qualify','radio-checked','radio-unchecked','refresh','relationship','remboursement','rename','repare','reply','restaurant','restore-straight','restore','right','rise','rotate-left','rotate-right','sad-cozy','safe','school','scooter','secutiry','select-all','server','setting','share-circle','share','shield','shop','sound','spinner','sport-bag','stack','star','star-outline','stats','stop', 'subway', 'support', 'swap', 'sync-cozy','sync','tab','tag','target','task','team','telecom','telephone','text','text-info','to-the-cloud','top','train','tram','trash','trophy', 'uncloud', 'unknow','unlink','unlock','up','upload','videos','walk','wallet-add','wallet-new','wallet','warn','warning-circle','warning','water','wrench-circle','work']
|
|
997
|
+
const availableIcons = ['album-add','album-remove','album','answer','apple','archive','arrowUp','assign-admin','assign-moderator','attachment','attention','bank-check','bank','banking-add','banking','bell','benefit','bike','bill','bottom','browser-brave','browser-chrome','browser-duckduckgo','browser-edge','browser-edge-chromium','browser-firefox','browser-ie','browser-opera','browser-safari','burger','bus','calendar','camera','car','carbonCopy','carpooling','categories','certified','check-circle','check-list','check-square','check','checkbox','chess','child','circle-filled','clock','clock-outline','cloud-happy','cloud-rainbow','cloud-plus-outlined','cloud','cloud2','collect','cocktail','comment','company','compare','compass','connector','contract','contrast','copy','cozy-circle','cozy-laugh', 'cozy-lock', 'cozy-text', 'cozy-release', 'credit-card-add','credit-card','credit','crop','cross-circle-outline','cross-circle','cross-medium','cross-small','cross','cube','dash','dashboard','data-control','debit','desktop-download','devices','discuss','dots','down','download','drawing-arrow-up','dropdown-close','dropdown-open','dropdown','dropup','electric-bike','electric-car','electric-scooter','email-notification','email-open','email','eu','euro','exchange','eye-closed','eye','face-id','file-add','file-duotone','file-new','file-none','file-outline','file','filter','fingerprint','fitness','flag-outlined','flag','flash-auto','flashlight','folder-add','folder-moveto','folder-open','folder','forbidden','from-user','gear','globe','gouv','graph-circle','grid','group-list','groups','growth','hand','heart','help','help-outlined','history','home','hourglass','image','info-outlined','info','justice','key','key2','label-outlined','laudry','laptop','left','library','lightbulb','lightning','link-out','link','list','list-min','location','lock', 'lock-screen', 'logout','magic-trick','magnet','magnifier','matrix','merge','moped','mosaic','mosaic-min','motorcycle','mountain','movement-in','movement-out','mouvement','moveto','multi-files','music','new','next','note','notification-email','number','offline','online', 'openapp', 'openwith','palette','paper','paperplane','password','pen','people','peoples','percent-circle','percent','person-add','personal-data','phone-download','phone-upload','phone','pie-chart','pin','plane','plus-small','plus', 'pop-inside', 'previous','printer','qualify','radio-checked','radio-unchecked','refresh','relationship','remboursement','rename','repare','reply','restaurant','restore-straight','restore','right','rise','rotate-left','rotate-right','sad-cozy','safe','school','scooter','secutiry','select-all','server','setting','share-circle','share','shield','shop','sound','spinner','sport-bag','stack','star','star-outline','stats','stop', 'subway', 'support', 'swap', 'sync-cozy','sync','tab','tag','target','task','team','telecom','telephone','text','text-info','to-the-cloud','top','train','tram','trash','trophy', 'uncloud', 'unknow','unlink','unlock','up','upload','videos','walk','wallet-add','wallet-new','wallet','warn','warning-circle','warning','water','wrench-circle','work']
|
|
996
998
|
;
|
|
997
999
|
|
|
998
1000
|
<Grid container spacing={2}>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/ui/matrix.svg` to regenerate;
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
function SvgMatrix(props) {
|
|
5
|
+
return (
|
|
6
|
+
<svg viewBox="0 0 16 10" {...props}>
|
|
7
|
+
<path d="M3 1.111H1.333V8.89H3V10H0V0h3v1.111zM16 10h-3V8.889h1.667V1.11H13V0h3v10zM9.807 3.667c.587 0 1.043.167 1.368.503.328.332.492.79.492 1.374V9h-1.23V5.72c0-.688-.311-1.032-.931-1.032a.983.983 0 00-.531.162.945.945 0 00-.36.372V9h-1.23V5.53c0-.258-.08-.462-.241-.612-.161-.153-.387-.23-.68-.23-.153 0-.323.057-.507.171-.18.114-.312.24-.394.377V9h-1.23V3.765h.847l.25.459c.342-.372.784-.557 1.325-.557.699 0 1.226.188 1.58.566.154-.172.369-.309.644-.41.276-.104.552-.156.828-.156z" />
|
|
8
|
+
</svg>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default SvgMatrix
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default FieldInput;
|
|
2
|
-
declare function FieldInput({ name, labelProps, className, attributes: { subFields, ...restAttributes }, contacts, error, helperText, label, required }: {
|
|
2
|
+
declare function FieldInput({ name, labelProps, className, attributes: { subFields, ...restAttributes }, contacts, error, helperText, label, isInvisible, required }: {
|
|
3
3
|
name: any;
|
|
4
4
|
labelProps: any;
|
|
5
5
|
className: any;
|
|
@@ -11,6 +11,7 @@ declare function FieldInput({ name, labelProps, className, attributes: { subFiel
|
|
|
11
11
|
error: any;
|
|
12
12
|
helperText: any;
|
|
13
13
|
label: any;
|
|
14
|
+
isInvisible: any;
|
|
14
15
|
required: any;
|
|
15
16
|
}): JSX.Element;
|
|
16
17
|
declare namespace FieldInput {
|
|
@@ -19,6 +20,7 @@ declare namespace FieldInput {
|
|
|
19
20
|
export const className: PropTypes.Requireable<string>;
|
|
20
21
|
export { labelPropTypes as labelProps };
|
|
21
22
|
export { fieldInputAttributesTypes as attributes };
|
|
23
|
+
export const isInvisible: PropTypes.Requireable<boolean>;
|
|
22
24
|
export const contacts: PropTypes.Requireable<PropTypes.InferProps<{
|
|
23
25
|
data: PropTypes.Requireable<(object | null)[]>;
|
|
24
26
|
}>>;
|
|
@@ -28,6 +28,7 @@ var FieldInput = function FieldInput(_ref) {
|
|
|
28
28
|
error = _ref.error,
|
|
29
29
|
helperText = _ref.helperText,
|
|
30
30
|
label = _ref.label,
|
|
31
|
+
isInvisible = _ref.isInvisible,
|
|
31
32
|
required = _ref.required;
|
|
32
33
|
|
|
33
34
|
var _useState = useState(uniqueId('field_')),
|
|
@@ -70,7 +71,10 @@ var FieldInput = function FieldInput(_ref) {
|
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
-
className: cx(className, styles['contact-form-field__wrapper'], 'u-flex
|
|
74
|
+
className: cx(className, styles['contact-form-field__wrapper'], 'u-flex-column-s', {
|
|
75
|
+
'u-flex': !isInvisible,
|
|
76
|
+
'u-dn': isInvisible
|
|
77
|
+
})
|
|
74
78
|
}, /*#__PURE__*/React.createElement(Field, {
|
|
75
79
|
required: required,
|
|
76
80
|
error: error,
|
|
@@ -113,6 +117,9 @@ FieldInput.propTypes = {
|
|
|
113
117
|
className: PropTypes.string,
|
|
114
118
|
labelProps: labelPropTypes,
|
|
115
119
|
attributes: fieldInputAttributesTypes,
|
|
120
|
+
|
|
121
|
+
/** Whether the field is visible by the user or not (still in the DOM anyway) */
|
|
122
|
+
isInvisible: PropTypes.bool,
|
|
116
123
|
contacts: PropTypes.shape({
|
|
117
124
|
data: PropTypes.arrayOf(PropTypes.object)
|
|
118
125
|
}),
|
|
@@ -2,7 +2,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["name", "label", "subFields"],
|
|
4
4
|
_excluded2 = ["name"];
|
|
5
|
-
import cx from 'classnames';
|
|
6
5
|
import React, { useState } from 'react';
|
|
7
6
|
import FieldInput from "cozy-ui/transpiled/react/Contacts/AddModal/ContactForm/FieldInput";
|
|
8
7
|
import { locales } from "cozy-ui/transpiled/react/Contacts/AddModal/ContactForm/locales";
|
|
@@ -58,11 +57,10 @@ var FieldInputAccordion = function FieldInputAccordion(_ref) {
|
|
|
58
57
|
|
|
59
58
|
return /*#__PURE__*/React.createElement(FieldInput, {
|
|
60
59
|
key: index,
|
|
61
|
-
className:
|
|
62
|
-
'u-dn': !showExtended
|
|
63
|
-
}),
|
|
60
|
+
className: "u-mt-1",
|
|
64
61
|
attributes: attributes,
|
|
65
62
|
name: name,
|
|
63
|
+
isInvisible: !showExtended,
|
|
66
64
|
label: t("Contacts.AddModal.ContactForm.fields.".concat(name))
|
|
67
65
|
});
|
|
68
66
|
}));
|
|
@@ -37,9 +37,10 @@ var FieldInputLayout = function FieldInputLayout(_ref) {
|
|
|
37
37
|
|
|
38
38
|
var isError = fieldsRequired.includes(name) && !valid && submitFailed;
|
|
39
39
|
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
-
className: cx('u-
|
|
40
|
+
className: cx('u-mt-1', {
|
|
41
41
|
'u-flex-items-center': !layout,
|
|
42
42
|
'u-flex-items-baseline': !!layout,
|
|
43
|
+
'u-flex': !isSecondary || showSecondaryFields,
|
|
43
44
|
'u-dn': isSecondary && !showSecondaryFields
|
|
44
45
|
})
|
|
45
46
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -13,6 +13,8 @@ var contactToFormValues = function contactToFormValues(contact, t) {
|
|
|
13
13
|
}, {});
|
|
14
14
|
|
|
15
15
|
if (contact) {
|
|
16
|
+
var _impp$find;
|
|
17
|
+
|
|
16
18
|
var gender = contact.gender,
|
|
17
19
|
address = contact.address,
|
|
18
20
|
birthday = contact.birthday,
|
|
@@ -21,6 +23,7 @@ var contactToFormValues = function contactToFormValues(contact, t) {
|
|
|
21
23
|
jobTitle = contact.jobTitle,
|
|
22
24
|
cozy = contact.cozy,
|
|
23
25
|
email = contact.email,
|
|
26
|
+
impp = contact.impp,
|
|
24
27
|
name = contact.name,
|
|
25
28
|
note = contact.note,
|
|
26
29
|
phone = contact.phone;
|
|
@@ -54,6 +57,9 @@ var contactToFormValues = function contactToFormValues(contact, t) {
|
|
|
54
57
|
emailLabel: makeItemLabel(item)
|
|
55
58
|
};
|
|
56
59
|
}) : [undefined];
|
|
60
|
+
var matrixValue = impp && impp.length > 0 ? ((_impp$find = impp.find(function (item) {
|
|
61
|
+
return item.label === 'work' && item.protocol === 'matrix';
|
|
62
|
+
})) === null || _impp$find === void 0 ? void 0 : _impp$find.uri) || undefined : undefined;
|
|
57
63
|
var phoneValue = phone && phone.length > 0 ? movePrimaryToHead(phone).map(function (item) {
|
|
58
64
|
return {
|
|
59
65
|
fieldId: uniqueId('fieldId_'),
|
|
@@ -70,6 +76,7 @@ var contactToFormValues = function contactToFormValues(contact, t) {
|
|
|
70
76
|
familyName: name === null || name === void 0 ? void 0 : name.familyName,
|
|
71
77
|
phone: phoneValue,
|
|
72
78
|
email: emailValue,
|
|
79
|
+
matrix: matrixValue,
|
|
73
80
|
address: addressValue,
|
|
74
81
|
cozy: cozyValue,
|
|
75
82
|
cozyLabel: cozyLabel,
|
|
@@ -7,6 +7,7 @@ import CommentIcon from "cozy-ui/transpiled/react/Icons/Comment";
|
|
|
7
7
|
import CompanyIcon from "cozy-ui/transpiled/react/Icons/Company";
|
|
8
8
|
import EmailIcon from "cozy-ui/transpiled/react/Icons/Email";
|
|
9
9
|
import LocationIcon from "cozy-ui/transpiled/react/Icons/Location";
|
|
10
|
+
import MatrixIcon from "cozy-ui/transpiled/react/Icons/Matrix";
|
|
10
11
|
import PeopleIcon from "cozy-ui/transpiled/react/Icons/People";
|
|
11
12
|
import RelationshipIcon from "cozy-ui/transpiled/react/Icons/Relationship";
|
|
12
13
|
import TelephoneIcon from "cozy-ui/transpiled/react/Icons/Telephone";
|
|
@@ -112,6 +113,10 @@ export var fields = [{
|
|
|
112
113
|
label: 'Contacts.AddModal.ContactForm.label.work'
|
|
113
114
|
}]
|
|
114
115
|
}
|
|
116
|
+
}, {
|
|
117
|
+
name: 'matrix',
|
|
118
|
+
icon: MatrixIcon,
|
|
119
|
+
type: 'text'
|
|
115
120
|
}, {
|
|
116
121
|
name: 'address',
|
|
117
122
|
icon: LocationIcon,
|
|
@@ -5,7 +5,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
|
|
7
7
|
import { updateIndexFullNameAndDisplayName } from 'cozy-client/dist/models/contact';
|
|
8
|
-
import { removeAsscociatedData, removeRelatedContactRelationships, createAddress, getRelatedContactRelationships, makeTypeAndLabel } from "cozy-ui/transpiled/react/Contacts/AddModal/ContactForm/helpers";
|
|
8
|
+
import { removeAsscociatedData, removeRelatedContactRelationships, createAddress, getRelatedContactRelationships, makeImppValues, makeTypeAndLabel } from "cozy-ui/transpiled/react/Contacts/AddModal/ContactForm/helpers";
|
|
9
9
|
|
|
10
10
|
var formValuesToContact = function formValuesToContact(_ref) {
|
|
11
11
|
var formValues = _ref.formValues,
|
|
@@ -19,6 +19,7 @@ var formValuesToContact = function formValuesToContact(_ref) {
|
|
|
19
19
|
phone = formValues.phone,
|
|
20
20
|
email = formValues.email,
|
|
21
21
|
address = formValues.address,
|
|
22
|
+
matrix = formValues.matrix,
|
|
22
23
|
cozy = formValues.cozy,
|
|
23
24
|
company = formValues.company,
|
|
24
25
|
jobTitle = formValues.jobTitle,
|
|
@@ -55,6 +56,7 @@ var formValuesToContact = function formValuesToContact(_ref) {
|
|
|
55
56
|
primary: index === 0
|
|
56
57
|
});
|
|
57
58
|
}) : [],
|
|
59
|
+
impp: makeImppValues(oldContactCleaned, matrix),
|
|
58
60
|
address: createAddress({
|
|
59
61
|
address: address,
|
|
60
62
|
oldContact: oldContactCleaned,
|
|
@@ -25,4 +25,10 @@ export function makeRelatedContact(contact: import('cozy-client/types/types').IO
|
|
|
25
25
|
export function addField(fields: any): any;
|
|
26
26
|
export function removeField(fields: any, index: any): void;
|
|
27
27
|
export function makeCustomLabel(value: string, t: func): string;
|
|
28
|
+
export function makeImppValues(oldContact: import('cozy-client/types/types').IOCozyContact, value: string | null): {
|
|
29
|
+
uri: string;
|
|
30
|
+
protocol: string;
|
|
31
|
+
label: string;
|
|
32
|
+
primary?: boolean;
|
|
33
|
+
}[];
|
|
28
34
|
export function makeInitialCustomValue(name: string, value: string): string;
|
|
@@ -282,6 +282,45 @@ export var makeCustomLabel = function makeCustomLabel(value, t) {
|
|
|
282
282
|
var secondString = label ? type ? " (".concat(t("Contacts.AddModal.ContactForm.label.".concat(label)), ")").toLowerCase() : "label.".concat(label) : '';
|
|
283
283
|
return firstString + secondString || null;
|
|
284
284
|
};
|
|
285
|
+
/**
|
|
286
|
+
*
|
|
287
|
+
* @param {import('cozy-client/types/types').IOCozyContact} oldContact - Contact to be modified
|
|
288
|
+
* @param {string?} value - New URI value to add to the Contact
|
|
289
|
+
* @returns {{ uri: string, protocol: string, label: string, primary?: boolean }[]}
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
export var makeImppValues = function makeImppValues(oldContact, value) {
|
|
293
|
+
var _value = (value === null || value === void 0 ? void 0 : value.trim()) || '';
|
|
294
|
+
|
|
295
|
+
var oldImppValues = oldContact === null || oldContact === void 0 ? void 0 : oldContact.impp;
|
|
296
|
+
|
|
297
|
+
if (_value) {
|
|
298
|
+
if (!oldImppValues || oldImppValues.length === 0) {
|
|
299
|
+
return [{
|
|
300
|
+
uri: _value,
|
|
301
|
+
protocol: 'matrix',
|
|
302
|
+
label: 'work',
|
|
303
|
+
primary: true
|
|
304
|
+
}];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return oldImppValues.map(function (el) {
|
|
308
|
+
if (el.protocol === 'matrix' && el.label === 'work') {
|
|
309
|
+
return _objectSpread(_objectSpread({}, el), {}, {
|
|
310
|
+
uri: _value
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return el;
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return (oldImppValues === null || oldImppValues === void 0 ? void 0 : oldImppValues.map(function (el) {
|
|
319
|
+
if (el.protocol !== 'matrix' || el.label !== 'work') {
|
|
320
|
+
return el;
|
|
321
|
+
}
|
|
322
|
+
}).filter(Boolean)) || [];
|
|
323
|
+
};
|
|
285
324
|
/**
|
|
286
325
|
*
|
|
287
326
|
* @param {string} name
|
|
@@ -15,6 +15,7 @@ var en = {
|
|
|
15
15
|
familyName: "Lastname",
|
|
16
16
|
phone: "Phone",
|
|
17
17
|
email: "Email",
|
|
18
|
+
matrix: "Matrix ID",
|
|
18
19
|
address: "Address",
|
|
19
20
|
cozy: "Twake URL",
|
|
20
21
|
company: "Company",
|
|
@@ -90,6 +91,7 @@ var fr = {
|
|
|
90
91
|
phone: "T\xE9l\xE9phone",
|
|
91
92
|
email: "Email",
|
|
92
93
|
address: "Adresse",
|
|
94
|
+
matrix: "ID Matrix",
|
|
93
95
|
cozy: "URL du Twake",
|
|
94
96
|
company: "Entreprise",
|
|
95
97
|
jobTitle: "Fonction",
|
|
@@ -33,6 +33,17 @@ export namespace johnDoeContact {
|
|
|
33
33
|
primary: boolean;
|
|
34
34
|
type?: undefined;
|
|
35
35
|
})[];
|
|
36
|
+
const impp: ({
|
|
37
|
+
uri: string;
|
|
38
|
+
protocol: string;
|
|
39
|
+
label: string;
|
|
40
|
+
primary: boolean;
|
|
41
|
+
} | {
|
|
42
|
+
uri: string;
|
|
43
|
+
protocol: string;
|
|
44
|
+
label: string;
|
|
45
|
+
primary?: undefined;
|
|
46
|
+
})[];
|
|
36
47
|
const birthday: string;
|
|
37
48
|
const birthplace: string;
|
|
38
49
|
const gender: string;
|
|
@@ -70,6 +81,7 @@ export namespace johnDoeFormValues {
|
|
|
70
81
|
const cozy_2: string;
|
|
71
82
|
export { cozy_2 as cozy };
|
|
72
83
|
export const cozyLabel: string;
|
|
84
|
+
export const matrix: string;
|
|
73
85
|
const address_1: ({
|
|
74
86
|
fieldId: string;
|
|
75
87
|
address: string;
|
|
@@ -168,6 +180,13 @@ export namespace johnDoeContactWithRelated {
|
|
|
168
180
|
primary?: undefined;
|
|
169
181
|
})[];
|
|
170
182
|
export { address_2 as address };
|
|
183
|
+
const impp_1: {
|
|
184
|
+
uri: string;
|
|
185
|
+
protocol: string;
|
|
186
|
+
label: string;
|
|
187
|
+
primary: boolean;
|
|
188
|
+
}[];
|
|
189
|
+
export { impp_1 as impp };
|
|
171
190
|
const email_2: ({
|
|
172
191
|
address: string;
|
|
173
192
|
type: string;
|
|
@@ -24,6 +24,26 @@ export var johnDoeContact = {
|
|
|
24
24
|
address: 'john.doe@cozycloud.cc',
|
|
25
25
|
primary: true
|
|
26
26
|
}],
|
|
27
|
+
impp: [{
|
|
28
|
+
uri: 'john.doe@xmpp.net',
|
|
29
|
+
protocol: 'xmpp',
|
|
30
|
+
label: 'home',
|
|
31
|
+
primary: false
|
|
32
|
+
}, {
|
|
33
|
+
uri: 'john.doe@xmpp.net',
|
|
34
|
+
protocol: 'xmpp',
|
|
35
|
+
label: 'work',
|
|
36
|
+
primary: false
|
|
37
|
+
}, {
|
|
38
|
+
uri: 'john@doe.matrix.net',
|
|
39
|
+
protocol: 'matrix',
|
|
40
|
+
label: 'work',
|
|
41
|
+
primary: true
|
|
42
|
+
}, {
|
|
43
|
+
uri: 'john@doe.matrix.home',
|
|
44
|
+
protocol: 'matrix',
|
|
45
|
+
label: 'home'
|
|
46
|
+
}],
|
|
27
47
|
birthday: '1999-5-1',
|
|
28
48
|
birthplace: 'somewhere',
|
|
29
49
|
gender: 'male',
|
|
@@ -59,6 +79,7 @@ export var johnDoeFormValues = {
|
|
|
59
79
|
gender: 'male',
|
|
60
80
|
cozy: 'https://johndoe.mycozy.cloud',
|
|
61
81
|
cozyLabel: '{"type":"MyCozy"}',
|
|
82
|
+
matrix: 'john@doe.matrix.net',
|
|
62
83
|
address: [{
|
|
63
84
|
fieldId: 'fieldId_1',
|
|
64
85
|
address: '94 Hinton Road 05034 Fresno, Singapore',
|
|
@@ -139,6 +160,17 @@ export var johnDoeContactWithRelated = {
|
|
|
139
160
|
postcode: '84573',
|
|
140
161
|
type: 'Work'
|
|
141
162
|
}],
|
|
163
|
+
impp: [{
|
|
164
|
+
uri: 'john.doe@xmpp.net',
|
|
165
|
+
protocol: 'xmpp',
|
|
166
|
+
label: 'home',
|
|
167
|
+
primary: false
|
|
168
|
+
}, {
|
|
169
|
+
uri: 'john@doe.matrix.net',
|
|
170
|
+
protocol: 'matrix',
|
|
171
|
+
label: 'work',
|
|
172
|
+
primary: true
|
|
173
|
+
}],
|
|
142
174
|
email: [{
|
|
143
175
|
address: 'john.doe@posteo.net',
|
|
144
176
|
type: 'personal',
|