@trii/components 2.0.31 → 2.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +53 -55
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/EditContactModal/components/Section/AddressInformation/AddressInformation.d.ts +2 -1
- package/dist/cjs/types/components/EditContactModal/components/Section/General/General.d.ts +1 -0
- package/dist/cjs/types/components/EditContactModal/hooks/useEditContact/types/UseEditContact.d.ts +0 -3
- package/dist/cjs/types/components/EditContactModal/shared/BusinessInfoLabel/BusinessInfoLabel.d.ts +2 -1
- package/dist/cjs/types/components/EditContactModal/shared/ContactInfoLabel/ContactInfoLabel.d.ts +1 -0
- package/dist/cjs/types/components/EditContactModal/shared/ContactInfoLabel/components/index.d.ts +0 -1
- package/dist/cjs/types/components/EditContactModal/shared/EntityCustomFieldLabel/EntityCustomFieldLabel.d.ts +2 -1
- package/dist/cjs/types/components/EditContactModal/shared/EntityInfoLabel/EntityInfoLabel.d.ts +1 -0
- package/dist/esm/index.js +53 -55
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/EditContactModal/components/Section/AddressInformation/AddressInformation.d.ts +2 -1
- package/dist/esm/types/components/EditContactModal/components/Section/General/General.d.ts +1 -0
- package/dist/esm/types/components/EditContactModal/hooks/useEditContact/types/UseEditContact.d.ts +0 -3
- package/dist/esm/types/components/EditContactModal/shared/BusinessInfoLabel/BusinessInfoLabel.d.ts +2 -1
- package/dist/esm/types/components/EditContactModal/shared/ContactInfoLabel/ContactInfoLabel.d.ts +1 -0
- package/dist/esm/types/components/EditContactModal/shared/ContactInfoLabel/components/index.d.ts +0 -1
- package/dist/esm/types/components/EditContactModal/shared/EntityCustomFieldLabel/EntityCustomFieldLabel.d.ts +2 -1
- package/dist/esm/types/components/EditContactModal/shared/EntityInfoLabel/EntityInfoLabel.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -4,12 +4,6 @@ var React$1 = require('react');
|
|
|
4
4
|
var material = require('@mui/material');
|
|
5
5
|
var react = require('@emotion/react');
|
|
6
6
|
var ReactDOM = require('react-dom');
|
|
7
|
-
require('react-i18next');
|
|
8
|
-
require('features/Views/BusinessCreate/hooks/useCreateBusiness/useCreateBusiness');
|
|
9
|
-
require('react-redux');
|
|
10
|
-
require('hooks/useAppDispatch');
|
|
11
|
-
require('ReduxToolkit/features/businessSlice/businessSlice');
|
|
12
|
-
require('ReduxToolkit/features/contactsSlice/contactsSlice');
|
|
13
7
|
|
|
14
8
|
function _interopNamespaceDefault(e) {
|
|
15
9
|
var n = Object.create(null);
|
|
@@ -25858,7 +25852,7 @@ const useEditContact = ({ contact, customContactFields, baseUrl, spaceId }) => {
|
|
|
25858
25852
|
const apiDispatch = async (maybePromise) => maybePromise;
|
|
25859
25853
|
const { getEditedField } = editContactHelper;
|
|
25860
25854
|
const [customProperties, setCustomProperties] = React$1.useState([]);
|
|
25861
|
-
const [selectedBusiness, setSelectedBusiness] =
|
|
25855
|
+
// const [selectedBusiness, setSelectedBusiness] = useState<SimplifiedBusiness[]>([]);
|
|
25862
25856
|
const contactFirstname = useField$1('text', contact?.firstName || '');
|
|
25863
25857
|
const contactLastname = useField$1('text', contact?.lastName || '');
|
|
25864
25858
|
const contactImage = useImage({
|
|
@@ -25937,8 +25931,8 @@ const useEditContact = ({ contact, customContactFields, baseUrl, spaceId }) => {
|
|
|
25937
25931
|
? contactImage.removeParams(contactImage.imageUrl)
|
|
25938
25932
|
: null,
|
|
25939
25933
|
properties: customProperties,
|
|
25940
|
-
businessId: selectedBusiness[0]?.businessId || '',
|
|
25941
|
-
businessName: selectedBusiness[0]?.businessName || '',
|
|
25934
|
+
// businessId: selectedBusiness[0]?.businessId || '',
|
|
25935
|
+
// businessName: selectedBusiness[0]?.businessName || '',
|
|
25942
25936
|
birthDate: birthDate?.toDate(),
|
|
25943
25937
|
};
|
|
25944
25938
|
return editedContact;
|
|
@@ -25948,12 +25942,12 @@ const useEditContact = ({ contact, customContactFields, baseUrl, spaceId }) => {
|
|
|
25948
25942
|
if (!contact)
|
|
25949
25943
|
return;
|
|
25950
25944
|
if (!contact.businessId || !contact.businessName) {
|
|
25951
|
-
setSelectedBusiness([]);
|
|
25945
|
+
// setSelectedBusiness([]);
|
|
25952
25946
|
return;
|
|
25953
25947
|
}
|
|
25954
|
-
setSelectedBusiness([
|
|
25955
|
-
|
|
25956
|
-
]);
|
|
25948
|
+
// setSelectedBusiness([
|
|
25949
|
+
// { businessId: contact.businessId, businessName: contact.businessName },
|
|
25950
|
+
// ]);
|
|
25957
25951
|
}
|
|
25958
25952
|
function resetBirthDate() {
|
|
25959
25953
|
setBirthDate(contact?.birthDate ? dayjs(contact.birthDate) : null);
|
|
@@ -26007,14 +26001,7 @@ const useEditContact = ({ contact, customContactFields, baseUrl, spaceId }) => {
|
|
|
26007
26001
|
if (contact?.tags) {
|
|
26008
26002
|
labelMultipleSelect.actions.setValue(contact.tags);
|
|
26009
26003
|
}
|
|
26010
|
-
if (contact?.businessId && contact.businessName)
|
|
26011
|
-
setSelectedBusiness([
|
|
26012
|
-
{ businessId: contact.businessId, businessName: contact.businessName },
|
|
26013
|
-
]);
|
|
26014
|
-
}
|
|
26015
|
-
else {
|
|
26016
|
-
setSelectedBusiness([]);
|
|
26017
|
-
}
|
|
26004
|
+
if (contact?.businessId && contact.businessName) ;
|
|
26018
26005
|
}, [contact]);
|
|
26019
26006
|
return {
|
|
26020
26007
|
field: {
|
|
@@ -26043,7 +26030,7 @@ const useEditContact = ({ contact, customContactFields, baseUrl, spaceId }) => {
|
|
|
26043
26030
|
secondaryCountry,
|
|
26044
26031
|
customProperties,
|
|
26045
26032
|
labelMultipleSelect,
|
|
26046
|
-
selectedBusiness,
|
|
26033
|
+
// selectedBusiness,
|
|
26047
26034
|
},
|
|
26048
26035
|
action: {
|
|
26049
26036
|
setBirthDate,
|
|
@@ -26057,7 +26044,7 @@ const useEditContact = ({ contact, customContactFields, baseUrl, spaceId }) => {
|
|
|
26057
26044
|
addWhatsapp,
|
|
26058
26045
|
addRCS,
|
|
26059
26046
|
replaceAddress,
|
|
26060
|
-
setSelectedBusiness,
|
|
26047
|
+
// setSelectedBusiness,
|
|
26061
26048
|
addWhatsappVerified,
|
|
26062
26049
|
resetToInitialContactInformation,
|
|
26063
26050
|
resetSelectedBusiness,
|
|
@@ -26080,13 +26067,6 @@ const resolveUserLabel = ({ userId, users, currentUser, }) => {
|
|
|
26080
26067
|
return fromUsers?.name?.trim() || fromUsers?.email || null;
|
|
26081
26068
|
};
|
|
26082
26069
|
|
|
26083
|
-
material.styled('div')({
|
|
26084
|
-
display: 'flex',
|
|
26085
|
-
alignItems: 'center',
|
|
26086
|
-
justifyContent: 'space-around',
|
|
26087
|
-
padding: '16px',
|
|
26088
|
-
});
|
|
26089
|
-
|
|
26090
26070
|
var weekOfYear = {exports: {}};
|
|
26091
26071
|
|
|
26092
26072
|
(function (module, exports) {
|
|
@@ -52202,7 +52182,7 @@ const StyledSaveCancelButton$1 = material.styled(material.IconButton)({
|
|
|
52202
52182
|
},
|
|
52203
52183
|
});
|
|
52204
52184
|
const EntityInfoLabel = (props) => {
|
|
52205
|
-
const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, } = props;
|
|
52185
|
+
const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated, } = props;
|
|
52206
52186
|
const inputType = props.inputType ?? 'text';
|
|
52207
52187
|
const [isEditing, setIsEditing] = React$1.useState(false);
|
|
52208
52188
|
const [isSaving, setIsSaving] = React$1.useState(false);
|
|
@@ -52268,13 +52248,14 @@ const EntityInfoLabel = (props) => {
|
|
|
52268
52248
|
if (!entityId) {
|
|
52269
52249
|
throw new Error('Missing contactId for updateEntity');
|
|
52270
52250
|
}
|
|
52271
|
-
await updateEntity({
|
|
52251
|
+
const updated = await updateEntity({
|
|
52272
52252
|
baseUrl,
|
|
52273
52253
|
spaceId,
|
|
52274
52254
|
entityType: 'contact',
|
|
52275
52255
|
entityId,
|
|
52276
52256
|
body: updatedContactData,
|
|
52277
52257
|
});
|
|
52258
|
+
onEntityUpdated?.(updated);
|
|
52278
52259
|
}
|
|
52279
52260
|
else {
|
|
52280
52261
|
const updatedBusinessData = props.constructUpdateObject(inputValue);
|
|
@@ -52282,13 +52263,14 @@ const EntityInfoLabel = (props) => {
|
|
|
52282
52263
|
if (!entityId) {
|
|
52283
52264
|
throw new Error('Missing businessId for updateEntity');
|
|
52284
52265
|
}
|
|
52285
|
-
await updateEntity({
|
|
52266
|
+
const updated = await updateEntity({
|
|
52286
52267
|
baseUrl,
|
|
52287
52268
|
spaceId,
|
|
52288
52269
|
entityType: 'business',
|
|
52289
52270
|
entityId,
|
|
52290
52271
|
body: updatedBusinessData,
|
|
52291
52272
|
});
|
|
52273
|
+
onEntityUpdated?.(updated);
|
|
52292
52274
|
}
|
|
52293
52275
|
}
|
|
52294
52276
|
finally {
|
|
@@ -52319,12 +52301,12 @@ const EntityInfoLabel = (props) => {
|
|
|
52319
52301
|
};
|
|
52320
52302
|
|
|
52321
52303
|
const ContactInfoLabel = (props) => {
|
|
52322
|
-
const { title, value, isNotEditable, options = [], displayValue, constructUpdateObject, businessId, baseUrl, spaceId, contactId, t, } = props;
|
|
52304
|
+
const { title, value, isNotEditable, options = [], displayValue, constructUpdateObject, businessId, baseUrl, spaceId, contactId, t, onEntityUpdated, } = props;
|
|
52323
52305
|
if (props.inputType === 'birthday') {
|
|
52324
|
-
return (jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", entityId: contactId, title: title, value: value, isNotEditable: isNotEditable, inputType: "birthday", options: options, displayValue: displayValue, constructUpdateObject: constructUpdateObject, contact: props.contact, businessId: businessId, baseUrl: baseUrl, spaceId: spaceId, t: t, dateFormat: props.dateFormat }));
|
|
52306
|
+
return (jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", entityId: contactId, title: title, value: value, isNotEditable: isNotEditable, inputType: "birthday", options: options, displayValue: displayValue, constructUpdateObject: constructUpdateObject, contact: props.contact, businessId: businessId, baseUrl: baseUrl, spaceId: spaceId, t: t, dateFormat: props.dateFormat, onEntityUpdated: onEntityUpdated }));
|
|
52325
52307
|
}
|
|
52326
52308
|
const inputType = props.inputType ?? 'text';
|
|
52327
|
-
return (jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", entityId: contactId, title: title, value: value, isNotEditable: isNotEditable, inputType: inputType, options: options, displayValue: displayValue, constructUpdateObject: constructUpdateObject, businessId: businessId, baseUrl: baseUrl, spaceId: spaceId, t: t }));
|
|
52309
|
+
return (jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", entityId: contactId, title: title, value: value, isNotEditable: isNotEditable, inputType: inputType, options: options, displayValue: displayValue, constructUpdateObject: constructUpdateObject, businessId: businessId, baseUrl: baseUrl, spaceId: spaceId, t: t, onEntityUpdated: onEntityUpdated }));
|
|
52328
52310
|
};
|
|
52329
52311
|
|
|
52330
52312
|
const CustomPropertyInput = ({ nameKey, value, onChange, type, }) => {
|
|
@@ -54160,7 +54142,7 @@ const FieldValue = material.styled(material.Typography)(({ theme }) => ({
|
|
|
54160
54142
|
overflow: 'auto',
|
|
54161
54143
|
whiteSpace: 'break-spaces',
|
|
54162
54144
|
}));
|
|
54163
|
-
const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, customContactFields, userTrii, baseUrl, spaceId, t, }) => {
|
|
54145
|
+
const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, customContactFields, userTrii, baseUrl, spaceId, t, onEntityUpdated, }) => {
|
|
54164
54146
|
const { customProperties } = entity.field;
|
|
54165
54147
|
const { setCustomProperties } = entity.action;
|
|
54166
54148
|
const [isEditing, setIsEditing] = React$1.useState(false);
|
|
@@ -54245,13 +54227,22 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
|
|
|
54245
54227
|
],
|
|
54246
54228
|
};
|
|
54247
54229
|
try {
|
|
54248
|
-
await updateEntity({
|
|
54230
|
+
const updated = await updateEntity({
|
|
54249
54231
|
baseUrl,
|
|
54250
54232
|
spaceId,
|
|
54251
54233
|
entityType,
|
|
54252
54234
|
entityId,
|
|
54253
54235
|
body: updatedContactData,
|
|
54254
54236
|
});
|
|
54237
|
+
const nextProperties = customProperties.map((p) => p.nameKey === nameKey
|
|
54238
|
+
? {
|
|
54239
|
+
...p,
|
|
54240
|
+
type: effectiveType,
|
|
54241
|
+
value: finalValue,
|
|
54242
|
+
}
|
|
54243
|
+
: p);
|
|
54244
|
+
setCustomProperties(nextProperties);
|
|
54245
|
+
onEntityUpdated?.(updated);
|
|
54255
54246
|
}
|
|
54256
54247
|
finally {
|
|
54257
54248
|
setIsSaving(false);
|
|
@@ -54370,7 +54361,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
|
|
|
54370
54361
|
};
|
|
54371
54362
|
|
|
54372
54363
|
const ContactGeneral = (props) => {
|
|
54373
|
-
const { dateFormat, entityData, customContactFields, baseUrl, spaceId, t, currentUser } = props;
|
|
54364
|
+
const { dateFormat, entityData, customContactFields, baseUrl, spaceId, t, currentUser, onEntityUpdated } = props;
|
|
54374
54365
|
const [users, setUsers] = React$1.useState([]);
|
|
54375
54366
|
const [owner, setOwner] = React$1.useState(null);
|
|
54376
54367
|
const [updatedBy, setUpdatedBy] = React$1.useState(null);
|
|
@@ -54452,9 +54443,9 @@ const ContactGeneral = (props) => {
|
|
|
54452
54443
|
};
|
|
54453
54444
|
return (jsxRuntimeExports.jsx(Section, { title: "General", children: jsxRuntimeExports.jsxs(SectionContent, { children: [jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.contactOwner'), displayValue: owner || '-', value: entityData.owner, inputType: "select", options: users, constructUpdateObject: (value) => ({
|
|
54454
54445
|
owner: typeof value === 'string' ? value : '',
|
|
54455
|
-
}), contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.business'), displayValue: entityData.businessName || '-', value: entityData.businessId, inputType: "selectBusiness", businessId: entityData.businessId, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.createdBy'), value: createdBy || '-', isNotEditable: true, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.modifiedBy'), value: updatedBy || '-', isNotEditable: true, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('global.birthdate'), inputType: "birthday", displayValue: birthDate ? `${dateOnlyString} (${calculateAge(birthDate.toDate())})` : '-', value: birthDate ? birthDate.toISOString() : '', constructUpdateObject: (value) => ({
|
|
54446
|
+
}), contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.business'), displayValue: entityData.businessName || '-', value: entityData.businessId, inputType: "selectBusiness", businessId: entityData.businessId, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.createdBy'), value: createdBy || '-', isNotEditable: true, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.modifiedBy'), value: updatedBy || '-', isNotEditable: true, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('global.birthdate'), inputType: "birthday", displayValue: birthDate ? `${dateOnlyString} (${calculateAge(birthDate.toDate())})` : '-', value: birthDate ? birthDate.toISOString() : '', constructUpdateObject: (value) => ({
|
|
54456
54447
|
birthDate: value,
|
|
54457
|
-
}), contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t, dateFormat: dateFormat }), editContact.field.customProperties.map((property) => (jsxRuntimeExports.jsx(EntityCustomFieldLabel, { property: property, entity: editContact, entityType: "contact", entityId: String(entityData.id), customContactFields: customContactFields, userTrii: currentUser, baseUrl: baseUrl, spaceId: spaceId, t: t }, property.nameKey)))] }) }));
|
|
54448
|
+
}), contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t, dateFormat: dateFormat, onEntityUpdated: onEntityUpdated }), editContact.field.customProperties.map((property) => (jsxRuntimeExports.jsx(EntityCustomFieldLabel, { property: property, entity: editContact, entityType: "contact", entityId: String(entityData.id), customContactFields: customContactFields, userTrii: currentUser, baseUrl: baseUrl, spaceId: spaceId, t: t, onEntityUpdated: onEntityUpdated }, property.nameKey)))] }) }));
|
|
54458
54449
|
};
|
|
54459
54450
|
|
|
54460
54451
|
const useEditBusiness = ({ business, customContactFields, baseUrl, spaceId }) => {
|
|
@@ -54637,12 +54628,12 @@ const useEditBusiness = ({ business, customContactFields, baseUrl, spaceId }) =>
|
|
|
54637
54628
|
};
|
|
54638
54629
|
};
|
|
54639
54630
|
|
|
54640
|
-
const BusinessInfoLabel = ({ title, value, isNotEditable, inputType = 'text', options = [], displayValue, constructUpdateObject, baseUrl, spaceId, businessId, }) => {
|
|
54641
|
-
return (jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", entityId: businessId, title: title, value: value, isNotEditable: isNotEditable, inputType: inputType, options: options, displayValue: displayValue, constructUpdateObject: constructUpdateObject, baseUrl: baseUrl, spaceId: spaceId }));
|
|
54631
|
+
const BusinessInfoLabel = ({ title, value, isNotEditable, inputType = 'text', options = [], displayValue, constructUpdateObject, baseUrl, spaceId, businessId, onEntityUpdated, }) => {
|
|
54632
|
+
return (jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", entityId: businessId, title: title, value: value, isNotEditable: isNotEditable, inputType: inputType, options: options, displayValue: displayValue, constructUpdateObject: constructUpdateObject, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: onEntityUpdated }));
|
|
54642
54633
|
};
|
|
54643
54634
|
|
|
54644
54635
|
const BusinessGeneral = (props) => {
|
|
54645
|
-
const { entityData, customContactFields, baseUrl, spaceId, t, currentUser } = props;
|
|
54636
|
+
const { entityData, customContactFields, baseUrl, spaceId, t, currentUser, onEntityUpdated } = props;
|
|
54646
54637
|
const [users, setUsers] = React$1.useState([]);
|
|
54647
54638
|
const [owner, setOwner] = React$1.useState(null);
|
|
54648
54639
|
const [updatedBy, setUpdatedBy] = React$1.useState(null);
|
|
@@ -54712,7 +54703,7 @@ const BusinessGeneral = (props) => {
|
|
|
54712
54703
|
}, [entityData, users, currentUser, baseUrl, spaceId]);
|
|
54713
54704
|
return (jsxRuntimeExports.jsx(Section, { title: "General", children: jsxRuntimeExports.jsxs(SectionContent, { children: [jsxRuntimeExports.jsx(BusinessInfoLabel, { title: t('businessDetails.businessOwner'), value: entityData.owner, displayValue: owner || '-', inputType: "select", options: users, constructUpdateObject: (value) => ({
|
|
54714
54705
|
owner: typeof value === 'string' ? value : '',
|
|
54715
|
-
}), baseUrl: baseUrl, spaceId: spaceId, businessId: entityData.id }), jsxRuntimeExports.jsx(BusinessInfoLabel, { title: t('contactDetails.createdBy'), value: createdBy || '-', isNotEditable: true }), jsxRuntimeExports.jsx(BusinessInfoLabel, { title: t('contactDetails.modifiedBy'), value: updatedBy || '-', isNotEditable: true }), editBusiness.field.customProperties.map((property) => (jsxRuntimeExports.jsx(EntityCustomFieldLabel, { property: property, entity: editBusiness, entityType: "business", entityId: String(entityData.id), customContactFields: customContactFields, userTrii: currentUser, baseUrl: baseUrl, spaceId: spaceId, t: t }, property.nameKey)))] }) }));
|
|
54706
|
+
}), baseUrl: baseUrl, spaceId: spaceId, businessId: entityData.id, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(BusinessInfoLabel, { title: t('contactDetails.createdBy'), value: createdBy || '-', isNotEditable: true }), jsxRuntimeExports.jsx(BusinessInfoLabel, { title: t('contactDetails.modifiedBy'), value: updatedBy || '-', isNotEditable: true }), editBusiness.field.customProperties.map((property) => (jsxRuntimeExports.jsx(EntityCustomFieldLabel, { property: property, entity: editBusiness, entityType: "business", entityId: String(entityData.id), customContactFields: customContactFields, userTrii: currentUser, baseUrl: baseUrl, spaceId: spaceId, t: t, onEntityUpdated: onEntityUpdated }, property.nameKey)))] }) }));
|
|
54716
54707
|
};
|
|
54717
54708
|
|
|
54718
54709
|
const General = (props) => {
|
|
@@ -54725,11 +54716,12 @@ const General = (props) => {
|
|
|
54725
54716
|
return normalizedEntityType === 'contact' ? (jsxRuntimeExports.jsx(ContactGeneral, { ...props, entityData: entityData, entityType: "contact" })) : (jsxRuntimeExports.jsx(BusinessGeneral, { ...props, entityData: entityData, entityType: "business" }));
|
|
54726
54717
|
};
|
|
54727
54718
|
|
|
54728
|
-
const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, t }) => {
|
|
54719
|
+
const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, t, onEntityUpdated, }) => {
|
|
54729
54720
|
const commonProps = {
|
|
54730
54721
|
baseUrl,
|
|
54731
54722
|
spaceId,
|
|
54732
54723
|
entityId: String(entityData.id),
|
|
54724
|
+
onEntityUpdated,
|
|
54733
54725
|
};
|
|
54734
54726
|
const maybeTitle = t('contactDetails.addressInformation');
|
|
54735
54727
|
const sectionTitle = maybeTitle === 'contactDetails.addressInformation' ? 'Address Information' : maybeTitle;
|
|
@@ -54793,6 +54785,18 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }
|
|
|
54793
54785
|
setTagsEditorInitialized(false);
|
|
54794
54786
|
setIsSavingTags(false);
|
|
54795
54787
|
}, []);
|
|
54788
|
+
const handleEntityUpdated = React$1.useCallback((entity) => {
|
|
54789
|
+
if (!entity || typeof entity !== 'object')
|
|
54790
|
+
return;
|
|
54791
|
+
const hasId = 'id' in entity;
|
|
54792
|
+
if (hasId) {
|
|
54793
|
+
actions.setContactData(entity);
|
|
54794
|
+
return;
|
|
54795
|
+
}
|
|
54796
|
+
if (state.contactData) {
|
|
54797
|
+
actions.setContactData({ ...state.contactData, ...entity });
|
|
54798
|
+
}
|
|
54799
|
+
}, [actions, state.contactData]);
|
|
54796
54800
|
const image = useImage({
|
|
54797
54801
|
baseUrl,
|
|
54798
54802
|
spaceId,
|
|
@@ -54801,13 +54805,7 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }
|
|
|
54801
54805
|
: undefined,
|
|
54802
54806
|
entityId: state.contactData ? String(state.contactData.id) : undefined,
|
|
54803
54807
|
initialImageUrl: state.contactData?.imageUrl,
|
|
54804
|
-
onEntityUpdated:
|
|
54805
|
-
if (!entity || typeof entity !== 'object')
|
|
54806
|
-
return;
|
|
54807
|
-
if (!state.contactData)
|
|
54808
|
-
return;
|
|
54809
|
-
actions.setContactData({ ...state.contactData, ...entity });
|
|
54810
|
-
},
|
|
54808
|
+
onEntityUpdated: handleEntityUpdated,
|
|
54811
54809
|
});
|
|
54812
54810
|
React$1.useEffect(() => {
|
|
54813
54811
|
if (!open) {
|
|
@@ -54898,9 +54896,9 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }
|
|
|
54898
54896
|
setView('tags');
|
|
54899
54897
|
}, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting }), jsxRuntimeExports.jsxs(material.Box, { sx: { px: 1, pb: 2 }, children: [jsxRuntimeExports.jsx(General, { dateFormat: selectors.userTrii?.regCon_dateFormat || 'MM/dd/yyyy', entityType: selectors.contactType === 'contact' || selectors.contactType === 'business'
|
|
54900
54898
|
? selectors.contactType
|
|
54901
|
-
: 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, t: t, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' || selectors.contactType === 'business'
|
|
54899
|
+
: 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, t: t, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' || selectors.contactType === 'business'
|
|
54902
54900
|
? selectors.contactType
|
|
54903
|
-
: 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, t: t }), jsxRuntimeExports.jsx(Section, { title: "Contact Information", children: "C" })] })] }) }), jsxRuntimeExports.jsx(material.Fade, { in: view === 'tags', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(material.Box, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: jsxRuntimeExports.jsx(TagsEditor, { value: draftLabels, options: selectors.labels, onChange: setDraftLabels, onBack: () => setView('main'), onSave: handleSaveTags, isSaving: isSavingTags, t: t }) }) })] }) })) : null }) }) }));
|
|
54901
|
+
: 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, t: t }), jsxRuntimeExports.jsx(Section, { title: "Contact Information", children: "C" })] })] }) }), jsxRuntimeExports.jsx(material.Fade, { in: view === 'tags', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(material.Box, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: jsxRuntimeExports.jsx(TagsEditor, { value: draftLabels, options: selectors.labels, onChange: setDraftLabels, onBack: () => setView('main'), onSave: handleSaveTags, isSaving: isSavingTags, t: t }) }) })] }) })) : null }) }) }));
|
|
54904
54902
|
};
|
|
54905
54903
|
|
|
54906
54904
|
exports.ContactInfoPopup = ContactInfoPopup;
|