cozy-ui 128.9.0 → 128.10.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/CHANGELOG.md +8 -0
- package/assets/icons/ui/matrix.svg +1 -0
- package/package.json +1 -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/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
|
@@ -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',
|