cozy-ui-plus 1.1.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 +10 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/babel.config.js +24 -0
- package/dist/AppIcon/index.js +265 -0
- package/dist/AppLinker/index.js +159 -0
- package/dist/AppLinker/native.config.js +8 -0
- package/dist/AppLinker/native.js +81 -0
- package/dist/AppSections/Sections.js +461 -0
- package/dist/AppSections/_mockApps.js +210 -0
- package/dist/AppSections/_testApps.js +162 -0
- package/dist/AppSections/categories.js +183 -0
- package/dist/AppSections/components/AppsSection.js +112 -0
- package/dist/AppSections/components/DropdownFilter.js +101 -0
- package/dist/AppSections/constants.js +16 -0
- package/dist/AppSections/generateI18nConfig.js +37 -0
- package/dist/AppSections/helpers.js +28 -0
- package/dist/AppSections/index.js +24 -0
- package/dist/AppSections/search.js +161 -0
- package/dist/AppTile/helpers.js +41 -0
- package/dist/AppTile/index.js +171 -0
- package/dist/CipherIcon/index.js +102 -0
- package/dist/CollectionField/index.js +166 -0
- package/dist/ContactPicker/index.js +129 -0
- package/dist/Contacts/AddModal/ContactAddressDialog/helpers.js +31 -0
- package/dist/Contacts/AddModal/ContactAddressDialog/index.js +106 -0
- package/dist/Contacts/AddModal/ContactAddressDialog/locales/index.js +113 -0
- package/dist/Contacts/AddModal/ContactForm/FieldInput.js +164 -0
- package/dist/Contacts/AddModal/ContactForm/FieldInputAccordion.js +91 -0
- package/dist/Contacts/AddModal/ContactForm/FieldInputArray.js +105 -0
- package/dist/Contacts/AddModal/ContactForm/FieldInputLayout.js +98 -0
- package/dist/Contacts/AddModal/ContactForm/FieldInputWrapper.js +51 -0
- package/dist/Contacts/AddModal/ContactForm/HasValueCondition.js +44 -0
- package/dist/Contacts/AddModal/ContactForm/RelatedContactList.js +55 -0
- package/dist/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.js +104 -0
- package/dist/Contacts/AddModal/ContactForm/TextFieldSelect.js +59 -0
- package/dist/Contacts/AddModal/ContactForm/contactToFormValues.js +119 -0
- package/dist/Contacts/AddModal/ContactForm/fieldsConfig.js +314 -0
- package/dist/Contacts/AddModal/ContactForm/formValuesToContact.js +110 -0
- package/dist/Contacts/AddModal/ContactForm/helpers.js +466 -0
- package/dist/Contacts/AddModal/ContactForm/index.js +184 -0
- package/dist/Contacts/AddModal/ContactForm/locales/index.js +313 -0
- package/dist/Contacts/AddModal/CustomLabelDialog/index.js +138 -0
- package/dist/Contacts/AddModal/CustomLabelDialog/locales/index.js +73 -0
- package/dist/Contacts/AddModal/index.js +134 -0
- package/dist/Contacts/AddModal/locales/index.js +65 -0
- package/dist/Contacts/AddModal/mocks.js +265 -0
- package/dist/Contacts/AddModal/types.js +110 -0
- package/dist/Contacts/GroupsSelect/GroupCreation.js +157 -0
- package/dist/Contacts/GroupsSelect/GroupsSelect.js +207 -0
- package/dist/Contacts/GroupsSelect/GroupsSelectProvider.js +60 -0
- package/dist/Contacts/GroupsSelect/SelectBox/Control.js +54 -0
- package/dist/Contacts/GroupsSelect/SelectBox/EditGroupName.js +89 -0
- package/dist/Contacts/GroupsSelect/SelectBox/Menu.js +49 -0
- package/dist/Contacts/GroupsSelect/SelectBox/Option.js +80 -0
- package/dist/Contacts/GroupsSelect/SelectBox/SelectContainer.js +25 -0
- package/dist/Contacts/GroupsSelect/helpers.js +45 -0
- package/dist/Contacts/GroupsSelect/locales/index.js +97 -0
- package/dist/Contacts/GroupsSelect/useGroupSelect.js +196 -0
- package/dist/Contacts/Header/GroupsSelection.js +101 -0
- package/dist/Contacts/Header/ImportDropdown.js +115 -0
- package/dist/Contacts/Header/SearchInput.js +40 -0
- package/dist/Contacts/Header/index.js +93 -0
- package/dist/Contacts/Header/locales/index.js +73 -0
- package/dist/ContactsList/ContactCell.js +45 -0
- package/dist/ContactsList/ContactRow.js +84 -0
- package/dist/ContactsList/Contacts/ContactCozy.js +44 -0
- package/dist/ContactsList/Contacts/ContactEmail.js +44 -0
- package/dist/ContactsList/Contacts/ContactIdentity.js +86 -0
- package/dist/ContactsList/Contacts/ContactName.js +48 -0
- package/dist/ContactsList/Contacts/ContactPhone.js +44 -0
- package/dist/ContactsList/ContactsList.js +74 -0
- package/dist/ContactsList/helpers.js +156 -0
- package/dist/ContactsList/index.js +13 -0
- package/dist/ContactsList/locales/withContactsListLocales.js +42 -0
- package/dist/ContactsListModal/AddContact/AddContactActions.js +32 -0
- package/dist/ContactsListModal/AddContact/AddContactContent.js +85 -0
- package/dist/ContactsListModal/AddContact/AddContactDialog.js +63 -0
- package/dist/ContactsListModal/AddContact/AddContactTitle.js +21 -0
- package/dist/ContactsListModal/AddContact/helpers.js +61 -0
- package/dist/ContactsListModal/ContactsListContent.js +88 -0
- package/dist/ContactsListModal/ContactsListModal.js +178 -0
- package/dist/ContactsListModal/ContactsListModalWithQuery.js +44 -0
- package/dist/ContactsListModal/EmptyMessage.js +33 -0
- package/dist/ContactsListModal/MobileHeader.js +67 -0
- package/dist/ContactsListModal/index.js +58 -0
- package/dist/ContactsListModal/mockClient.js +2009 -0
- package/dist/ContactsListModal/queries.js +26 -0
- package/dist/ContactsListModal/withContactsListLocales.js +40 -0
- package/dist/Dialogs/AuthenticationDialogs/index.js +139 -0
- package/dist/Field/index.js +297 -0
- package/dist/FileImageLoader/checkImageSource.js +61 -0
- package/dist/FileImageLoader/index.js +394 -0
- package/dist/FilePicker/FilePickerBody.js +108 -0
- package/dist/FilePicker/FilePickerBodyItem.js +132 -0
- package/dist/FilePicker/FilePickerBreadcrumb.js +74 -0
- package/dist/FilePicker/FilePickerFooter.js +91 -0
- package/dist/FilePicker/FilePickerHeader.js +110 -0
- package/dist/FilePicker/docs/DemoProvider.js +280 -0
- package/dist/FilePicker/helpers.js +57 -0
- package/dist/FilePicker/index.js +125 -0
- package/dist/FilePicker/queries.js +61 -0
- package/dist/Intent/IntentDialogOpener/index.js +142 -0
- package/dist/Intent/IntentIframe/index.js +182 -0
- package/dist/ListItem/ExpandedAttributes/ExpandedAttribute.js +64 -0
- package/dist/ListItem/ExpandedAttributes/helpers.js +263 -0
- package/dist/ListItem/ExpandedAttributes/index.js +90 -0
- package/dist/ListItem/ListItemBase/Renaming/RenameDialog.js +52 -0
- package/dist/ListItem/ListItemBase/Renaming/RenameInput.js +319 -0
- package/dist/ListItem/ListItemBase/Renaming/helpers.js +73 -0
- package/dist/ListItem/ListItemBase/index.js +153 -0
- package/dist/ListItem/ListItemByDoc/index.js +109 -0
- package/dist/ListItem/ListItemContact/helpers.js +39 -0
- package/dist/ListItem/ListItemContact/index.js +87 -0
- package/dist/ListItem/ListItemContact/useActions.js +28 -0
- package/dist/ListItem/ListItemFile/ExpirationAnnotation.js +54 -0
- package/dist/ListItem/ListItemFile/ItemIcon.js +61 -0
- package/dist/ListItem/ListItemFile/PrimaryText.js +47 -0
- package/dist/ListItem/ListItemFile/SecondaryText.js +41 -0
- package/dist/ListItem/ListItemFile/index.js +96 -0
- package/dist/ListItem/hoc/withListItemLocales.js +322 -0
- package/dist/Paywall/MaxAccountsByKonnectorPaywall.js +48 -0
- package/dist/Paywall/MaxAccountsPaywall.js +43 -0
- package/dist/Paywall/MaxDaysToCapturePaywall.js +43 -0
- package/dist/Paywall/MaxPapersPaywall.js +44 -0
- package/dist/Paywall/OnlyOfficePaywall.js +41 -0
- package/dist/Paywall/PasswordSharingPaywall.js +34 -0
- package/dist/Paywall/Paywall.js +205 -0
- package/dist/Paywall/QuotaPaywall.js +32 -0
- package/dist/Paywall/helpers.js +31 -0
- package/dist/Paywall/index.js +63 -0
- package/dist/Paywall/locales/withPaywallLocales.js +401 -0
- package/dist/Qualification/QualificationGrid/helpers.js +16 -0
- package/dist/Qualification/QualificationGrid/index.js +136 -0
- package/dist/Qualification/QualificationGrid/locales/withLocales.js +82 -0
- package/dist/Qualification/QualificationIcon/index.js +156 -0
- package/dist/Qualification/QualificationItem/index.js +87 -0
- package/dist/Qualification/QualificationModal/helpers.js +95 -0
- package/dist/Qualification/QualificationModal/index.js +121 -0
- package/dist/Qualification/QualificationModal/locales/index.js +37 -0
- package/dist/ShortcutTile/index.js +68 -0
- package/dist/SquareAppIcon/index.js +262 -0
- package/dist/Storage/StorageButton.js +54 -0
- package/dist/Storage/StorageProgress.js +68 -0
- package/dist/Storage/index.js +49 -0
- package/dist/Storage/locales/index.js +41 -0
- package/dist/UploadQueue/FileUploadProgress.js +86 -0
- package/dist/UploadQueue/Item.js +132 -0
- package/dist/UploadQueue/Pending.js +23 -0
- package/dist/UploadQueue/RemainingTime.js +59 -0
- package/dist/UploadQueue/helpers.js +13 -0
- package/dist/UploadQueue/index.js +277 -0
- package/dist/UploadQueue/useStatusIcon.js +60 -0
- package/dist/hooks/useClientErrors.js +185 -0
- package/dist/proptypes.js +33 -0
- package/dist/providers/CozyTheme/CozyThemeWithQuery.js +41 -0
- package/dist/providers/CozyTheme/index.js +58 -0
- package/dist/providers/CozyTheme/queries.js +25 -0
- package/dist/providers/DemoProvider.js +49 -0
- package/dist/providers/Intent/index.js +130 -0
- package/dist/src/AppIcon/index.d.ts +50 -0
- package/dist/src/AppIcon/index.spec.d.ts +1 -0
- package/dist/src/AppLinker/index.d.ts +35 -0
- package/dist/src/AppLinker/index.spec.d.ts +1 -0
- package/dist/src/AppLinker/native.config.d.ts +1 -0
- package/dist/src/AppLinker/native.d.ts +6 -0
- package/dist/src/AppLinker/native.spec.d.ts +1 -0
- package/dist/src/AppSections/Sections.d.ts +49 -0
- package/dist/src/AppSections/_mockApps.d.ts +242 -0
- package/dist/src/AppSections/_testApps.d.ts +203 -0
- package/dist/src/AppSections/categories.d.ts +7 -0
- package/dist/src/AppSections/categories.spec.d.ts +1 -0
- package/dist/src/AppSections/components/AppsSection.d.ts +20 -0
- package/dist/src/AppSections/components/AppsSection.spec.d.ts +1 -0
- package/dist/src/AppSections/components/DropdownFilter.d.ts +17 -0
- package/dist/src/AppSections/constants.d.ts +8 -0
- package/dist/src/AppSections/generateI18nConfig.d.ts +4 -0
- package/dist/src/AppSections/helpers.d.ts +2 -0
- package/dist/src/AppSections/helpers.spec.d.ts +1 -0
- package/dist/src/AppSections/index.d.ts +3 -0
- package/dist/src/AppSections/index.spec.d.ts +1 -0
- package/dist/src/AppSections/search.d.ts +3 -0
- package/dist/src/AppSections/search.spec.d.ts +1 -0
- package/dist/src/AppTile/AppTile.spec.d.ts +1 -0
- package/dist/src/AppTile/helpers.d.ts +9 -0
- package/dist/src/AppTile/index.d.ts +33 -0
- package/dist/src/CipherIcon/index.d.ts +2 -0
- package/dist/src/CipherIcon/index.spec.d.ts +1 -0
- package/dist/src/CollectionField/index.d.ts +23 -0
- package/dist/src/ContactPicker/index.d.ts +21 -0
- package/dist/src/Contacts/AddModal/ContactAddressDialog/helpers.d.ts +4 -0
- package/dist/src/Contacts/AddModal/ContactAddressDialog/helpers.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactAddressDialog/index.d.ts +39 -0
- package/dist/src/Contacts/AddModal/ContactAddressDialog/locales/index.d.ts +10 -0
- package/dist/src/Contacts/AddModal/ContactForm/FieldInput.d.ts +39 -0
- package/dist/src/Contacts/AddModal/ContactForm/FieldInputAccordion.d.ts +12 -0
- package/dist/src/Contacts/AddModal/ContactForm/FieldInputArray.d.ts +14 -0
- package/dist/src/Contacts/AddModal/ContactForm/FieldInputLayout.d.ts +22 -0
- package/dist/src/Contacts/AddModal/ContactForm/FieldInputWrapper.d.ts +19 -0
- package/dist/src/Contacts/AddModal/ContactForm/HasValueCondition.d.ts +18 -0
- package/dist/src/Contacts/AddModal/ContactForm/HasValueCondition.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactForm/RelatedContactList.d.ts +15 -0
- package/dist/src/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.d.ts +9 -0
- package/dist/src/Contacts/AddModal/ContactForm/TextFieldSelect.d.ts +5 -0
- package/dist/src/Contacts/AddModal/ContactForm/contactToFormValues.d.ts +6 -0
- package/dist/src/Contacts/AddModal/ContactForm/contactToFormValues.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactForm/fieldsConfig.d.ts +4 -0
- package/dist/src/Contacts/AddModal/ContactForm/formValuesToContact.d.ts +7 -0
- package/dist/src/Contacts/AddModal/ContactForm/formValuesToContact.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactForm/helpers.d.ts +35 -0
- package/dist/src/Contacts/AddModal/ContactForm/helpers.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactForm/index.d.ts +17 -0
- package/dist/src/Contacts/AddModal/ContactForm/index.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactForm/locales/index.d.ts +10 -0
- package/dist/src/Contacts/AddModal/CustomLabelDialog/index.d.ts +22 -0
- package/dist/src/Contacts/AddModal/CustomLabelDialog/locales/index.d.ts +10 -0
- package/dist/src/Contacts/AddModal/index.d.ts +8 -0
- package/dist/src/Contacts/AddModal/locales/index.d.ts +10 -0
- package/dist/src/Contacts/AddModal/mocks.d.ts +276 -0
- package/dist/src/Contacts/AddModal/types.d.ts +188 -0
- package/dist/src/Contacts/GroupsSelect/GroupCreation.d.ts +3 -0
- package/dist/src/Contacts/GroupsSelect/GroupsSelect.d.ts +56 -0
- package/dist/src/Contacts/GroupsSelect/GroupsSelect.spec.d.ts +22 -0
- package/dist/src/Contacts/GroupsSelect/GroupsSelectProvider.d.ts +5 -0
- package/dist/src/Contacts/GroupsSelect/SelectBox/Control.d.ts +14 -0
- package/dist/src/Contacts/GroupsSelect/SelectBox/EditGroupName.d.ts +7 -0
- package/dist/src/Contacts/GroupsSelect/SelectBox/Menu.d.ts +7 -0
- package/dist/src/Contacts/GroupsSelect/SelectBox/Option.d.ts +18 -0
- package/dist/src/Contacts/GroupsSelect/SelectBox/SelectContainer.d.ts +2 -0
- package/dist/src/Contacts/GroupsSelect/helpers.d.ts +9 -0
- package/dist/src/Contacts/GroupsSelect/locales/index.d.ts +10 -0
- package/dist/src/Contacts/GroupsSelect/useGroupSelect.d.ts +11 -0
- package/dist/src/Contacts/Header/GroupsSelection.d.ts +7 -0
- package/dist/src/Contacts/Header/ImportDropdown.d.ts +4 -0
- package/dist/src/Contacts/Header/SearchInput.d.ts +4 -0
- package/dist/src/Contacts/Header/index.d.ts +26 -0
- package/dist/src/Contacts/Header/locales/index.d.ts +10 -0
- package/dist/src/ContactsList/ContactCell.d.ts +8 -0
- package/dist/src/ContactsList/ContactRow.d.ts +16 -0
- package/dist/src/ContactsList/ContactRow.spec.d.ts +1 -0
- package/dist/src/ContactsList/Contacts/ContactCozy.d.ts +14 -0
- package/dist/src/ContactsList/Contacts/ContactEmail.d.ts +14 -0
- package/dist/src/ContactsList/Contacts/ContactIdentity.d.ts +10 -0
- package/dist/src/ContactsList/Contacts/ContactName.d.ts +10 -0
- package/dist/src/ContactsList/Contacts/ContactPhone.d.ts +14 -0
- package/dist/src/ContactsList/ContactsList.d.ts +2 -0
- package/dist/src/ContactsList/helpers.d.ts +9 -0
- package/dist/src/ContactsList/helpers.spec.d.ts +1 -0
- package/dist/src/ContactsList/index.d.ts +2 -0
- package/dist/src/ContactsList/locales/withContactsListLocales.d.ts +12 -0
- package/dist/src/ContactsListModal/AddContact/AddContactActions.d.ts +2 -0
- package/dist/src/ContactsListModal/AddContact/AddContactContent.d.ts +2 -0
- package/dist/src/ContactsListModal/AddContact/AddContactDialog.d.ts +6 -0
- package/dist/src/ContactsListModal/AddContact/AddContactTitle.d.ts +2 -0
- package/dist/src/ContactsListModal/AddContact/helpers.d.ts +6 -0
- package/dist/src/ContactsListModal/AddContact/helpers.spec.d.ts +1 -0
- package/dist/src/ContactsListModal/ContactsListContent.d.ts +2 -0
- package/dist/src/ContactsListModal/ContactsListModal.d.ts +20 -0
- package/dist/src/ContactsListModal/ContactsListModalWithQuery.d.ts +12 -0
- package/dist/src/ContactsListModal/EmptyMessage.d.ts +2 -0
- package/dist/src/ContactsListModal/MobileHeader.d.ts +16 -0
- package/dist/src/ContactsListModal/index.d.ts +2 -0
- package/dist/src/ContactsListModal/mockClient.d.ts +3 -0
- package/dist/src/ContactsListModal/queries.d.ts +7 -0
- package/dist/src/ContactsListModal/withContactsListLocales.d.ts +7 -0
- package/dist/src/Dialogs/AuthenticationDialogs/index.d.ts +2 -0
- package/dist/src/Field/index.d.ts +53 -0
- package/dist/src/Field/index.spec.d.ts +1 -0
- package/dist/src/FileImageLoader/checkImageSource.d.ts +1 -0
- package/dist/src/FileImageLoader/index.d.ts +45 -0
- package/dist/src/FileImageLoader/index.spec.d.ts +1 -0
- package/dist/src/FilePicker/FilePickerBody.d.ts +19 -0
- package/dist/src/FilePicker/FilePickerBodyItem.d.ts +22 -0
- package/dist/src/FilePicker/FilePickerBodyItem.spec.d.ts +1 -0
- package/dist/src/FilePicker/FilePickerBreadcrumb.d.ts +13 -0
- package/dist/src/FilePicker/FilePickerFooter.d.ts +15 -0
- package/dist/src/FilePicker/FilePickerFooter.spec.d.ts +1 -0
- package/dist/src/FilePicker/FilePickerHeader.d.ts +14 -0
- package/dist/src/FilePicker/docs/DemoProvider.d.ts +23 -0
- package/dist/src/FilePicker/helpers.d.ts +3 -0
- package/dist/src/FilePicker/helpers.spec.d.ts +1 -0
- package/dist/src/FilePicker/index.d.ts +22 -0
- package/dist/src/FilePicker/queries.d.ts +14 -0
- package/dist/src/Intent/IntentDialogOpener/index.d.ts +32 -0
- package/dist/src/Intent/IntentIframe/index.d.ts +8 -0
- package/dist/src/ListItem/ExpandedAttributes/ExpandedAttribute.d.ts +14 -0
- package/dist/src/ListItem/ExpandedAttributes/helpers.d.ts +43 -0
- package/dist/src/ListItem/ExpandedAttributes/helpers.spec.d.ts +1 -0
- package/dist/src/ListItem/ExpandedAttributes/index.d.ts +2 -0
- package/dist/src/ListItem/ListItemBase/Renaming/RenameDialog.d.ts +2 -0
- package/dist/src/ListItem/ListItemBase/Renaming/RenameInput.d.ts +12 -0
- package/dist/src/ListItem/ListItemBase/Renaming/helpers.d.ts +1 -0
- package/dist/src/ListItem/ListItemBase/index.d.ts +2 -0
- package/dist/src/ListItem/ListItemByDoc/index.d.ts +46 -0
- package/dist/src/ListItem/ListItemContact/helpers.d.ts +1 -0
- package/dist/src/ListItem/ListItemContact/helpers.spec.d.ts +1 -0
- package/dist/src/ListItem/ListItemContact/index.d.ts +35 -0
- package/dist/src/ListItem/ListItemContact/useActions.d.ts +2 -0
- package/dist/src/ListItem/ListItemFile/ExpirationAnnotation.d.ts +2 -0
- package/dist/src/ListItem/ListItemFile/ItemIcon.d.ts +12 -0
- package/dist/src/ListItem/ListItemFile/PrimaryText.d.ts +12 -0
- package/dist/src/ListItem/ListItemFile/SecondaryText.d.ts +12 -0
- package/dist/src/ListItem/ListItemFile/index.d.ts +37 -0
- package/dist/src/ListItem/hoc/withListItemLocales.d.ts +12 -0
- package/dist/src/Paywall/MaxAccountsByKonnectorPaywall.d.ts +2 -0
- package/dist/src/Paywall/MaxAccountsPaywall.d.ts +2 -0
- package/dist/src/Paywall/MaxDaysToCapturePaywall.d.ts +2 -0
- package/dist/src/Paywall/MaxPapersPaywall.d.ts +2 -0
- package/dist/src/Paywall/OnlyOfficePaywall.d.ts +16 -0
- package/dist/src/Paywall/PasswordSharingPaywall.d.ts +10 -0
- package/dist/src/Paywall/Paywall.d.ts +2 -0
- package/dist/src/Paywall/Paywall.spec.d.ts +1 -0
- package/dist/src/Paywall/QuotaPaywall.d.ts +13 -0
- package/dist/src/Paywall/helpers.d.ts +1 -0
- package/dist/src/Paywall/index.d.ts +7 -0
- package/dist/src/Paywall/locales/withPaywallLocales.d.ts +2 -0
- package/dist/src/Qualification/QualificationGrid/helpers.d.ts +1 -0
- package/dist/src/Qualification/QualificationGrid/index.d.ts +2 -0
- package/dist/src/Qualification/QualificationGrid/locales/withLocales.d.ts +12 -0
- package/dist/src/Qualification/QualificationIcon/index.d.ts +13 -0
- package/dist/src/Qualification/QualificationItem/index.d.ts +17 -0
- package/dist/src/Qualification/QualificationModal/helpers.d.ts +14 -0
- package/dist/src/Qualification/QualificationModal/helpers.spec.d.ts +1 -0
- package/dist/src/Qualification/QualificationModal/index.d.ts +16 -0
- package/dist/src/Qualification/QualificationModal/locales/index.d.ts +10 -0
- package/dist/src/ShortcutTile/index.d.ts +13 -0
- package/dist/src/SquareAppIcon/SquareAppIcon.spec.d.ts +1 -0
- package/dist/src/SquareAppIcon/index.d.ts +26 -0
- package/dist/src/Storage/StorageButton.d.ts +4 -0
- package/dist/src/Storage/StorageProgress.d.ts +5 -0
- package/dist/src/Storage/index.d.ts +14 -0
- package/dist/src/Storage/locales/index.d.ts +10 -0
- package/dist/src/UploadQueue/FileUploadProgress.d.ts +4 -0
- package/dist/src/UploadQueue/Item.d.ts +3 -0
- package/dist/src/UploadQueue/Pending.d.ts +3 -0
- package/dist/src/UploadQueue/RemainingTime.d.ts +4 -0
- package/dist/src/UploadQueue/helpers.d.ts +1 -0
- package/dist/src/UploadQueue/index.d.ts +42 -0
- package/dist/src/UploadQueue/index.spec.d.ts +1 -0
- package/dist/src/UploadQueue/useStatusIcon.d.ts +1 -0
- package/dist/src/hooks/useClientErrors.d.ts +29 -0
- package/dist/src/hooks/useClientErrors.spec.d.ts +1 -0
- package/dist/src/proptypes.d.ts +18 -0
- package/dist/src/providers/CozyTheme/CozyThemeWithQuery.d.ts +2 -0
- package/dist/src/providers/CozyTheme/index.d.ts +24 -0
- package/dist/src/providers/CozyTheme/queries.d.ts +8 -0
- package/dist/src/providers/DemoProvider.d.ts +6 -0
- package/dist/src/providers/Intent/index.d.ts +9 -0
- package/dist/stylesheet.css +898 -0
- package/dist/test/I18n.d.ts +6 -0
- package/dist/types.d.js +1 -0
- package/jest.config.js +20 -0
- package/package.json +76 -0
- package/preprocess.js +16 -0
- package/src/AppIcon/Readme.md +96 -0
- package/src/AppIcon/index.jsx +168 -0
- package/src/AppIcon/index.spec.js +145 -0
- package/src/AppIcon/styles.styl +37 -0
- package/src/AppLinker/Readme.md +32 -0
- package/src/AppLinker/__snapshots__/index.spec.jsx.snap +13 -0
- package/src/AppLinker/index.jsx +107 -0
- package/src/AppLinker/index.spec.jsx +60 -0
- package/src/AppLinker/native.config.js +1 -0
- package/src/AppLinker/native.js +57 -0
- package/src/AppLinker/native.spec.js +120 -0
- package/src/AppSections/Readme.md +35 -0
- package/src/AppSections/Sections.jsx +285 -0
- package/src/AppSections/Sections.styl +4 -0
- package/src/AppSections/__snapshots__/search.spec.js.snap +972 -0
- package/src/AppSections/_mockApps.js +197 -0
- package/src/AppSections/_testApps.js +151 -0
- package/src/AppSections/categories.js +138 -0
- package/src/AppSections/categories.spec.js +289 -0
- package/src/AppSections/components/AppsSection.jsx +82 -0
- package/src/AppSections/components/AppsSection.spec.jsx +50 -0
- package/src/AppSections/components/AppsSection.styl +7 -0
- package/src/AppSections/components/DropdownFilter.jsx +50 -0
- package/src/AppSections/components/DropdownFilter.styl +14 -0
- package/src/AppSections/constants.js +9 -0
- package/src/AppSections/generateI18nConfig.ts +23 -0
- package/src/AppSections/helpers.js +16 -0
- package/src/AppSections/helpers.spec.js +40 -0
- package/src/AppSections/index.jsx +3 -0
- package/src/AppSections/index.spec.jsx +137 -0
- package/src/AppSections/locales/en.json +37 -0
- package/src/AppSections/locales/fr.json +37 -0
- package/src/AppSections/locales/ru.json +37 -0
- package/src/AppSections/locales/vi.json +37 -0
- package/src/AppSections/search.js +104 -0
- package/src/AppSections/search.spec.js +158 -0
- package/src/AppTile/AppTile.spec.jsx +117 -0
- package/src/AppTile/Readme.md +24 -0
- package/src/AppTile/helpers.js +25 -0
- package/src/AppTile/index.jsx +139 -0
- package/src/AppTile/locales/en.json +9 -0
- package/src/AppTile/locales/fr.json +9 -0
- package/src/AppTile/locales/ru.json +9 -0
- package/src/AppTile/locales/vi.json +9 -0
- package/src/AppTile/styles.styl +27 -0
- package/src/CipherIcon/Readme.md +14 -0
- package/src/CipherIcon/index.jsx +46 -0
- package/src/CipherIcon/index.spec.jsx +53 -0
- package/src/CollectionField/Readme.md +41 -0
- package/src/CollectionField/index.jsx +141 -0
- package/src/CollectionField/styles.styl +15 -0
- package/src/ContactPicker/Readme.md +26 -0
- package/src/ContactPicker/index.jsx +86 -0
- package/src/ContactPicker/styles.styl +5 -0
- package/src/Contacts/AddModal/ContactAddressDialog/helpers.js +22 -0
- package/src/Contacts/AddModal/ContactAddressDialog/helpers.spec.js +64 -0
- package/src/Contacts/AddModal/ContactAddressDialog/index.jsx +85 -0
- package/src/Contacts/AddModal/ContactAddressDialog/locales/en.json +25 -0
- package/src/Contacts/AddModal/ContactAddressDialog/locales/fr.json +25 -0
- package/src/Contacts/AddModal/ContactAddressDialog/locales/index.jsx +11 -0
- package/src/Contacts/AddModal/ContactAddressDialog/locales/ru.json +25 -0
- package/src/Contacts/AddModal/ContactAddressDialog/locales/vi.json +25 -0
- package/src/Contacts/AddModal/ContactForm/FieldInput.jsx +124 -0
- package/src/Contacts/AddModal/ContactForm/FieldInputAccordion.jsx +58 -0
- package/src/Contacts/AddModal/ContactForm/FieldInputArray.jsx +81 -0
- package/src/Contacts/AddModal/ContactForm/FieldInputLayout.jsx +77 -0
- package/src/Contacts/AddModal/ContactForm/FieldInputWrapper.jsx +44 -0
- package/src/Contacts/AddModal/ContactForm/HasValueCondition.jsx +31 -0
- package/src/Contacts/AddModal/ContactForm/HasValueCondition.spec.jsx +79 -0
- package/src/Contacts/AddModal/ContactForm/RelatedContactList.jsx +37 -0
- package/src/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.jsx +79 -0
- package/src/Contacts/AddModal/ContactForm/TextFieldSelect.jsx +40 -0
- package/src/Contacts/AddModal/ContactForm/__snapshots__/HasValueCondition.spec.jsx.snap +33 -0
- package/src/Contacts/AddModal/ContactForm/contactToFormValues.js +109 -0
- package/src/Contacts/AddModal/ContactForm/contactToFormValues.spec.js +133 -0
- package/src/Contacts/AddModal/ContactForm/fieldsConfig.jsx +357 -0
- package/src/Contacts/AddModal/ContactForm/formValuesToContact.js +111 -0
- package/src/Contacts/AddModal/ContactForm/formValuesToContact.spec.js +557 -0
- package/src/Contacts/AddModal/ContactForm/helpers.js +393 -0
- package/src/Contacts/AddModal/ContactForm/helpers.spec.js +391 -0
- package/src/Contacts/AddModal/ContactForm/index.jsx +138 -0
- package/src/Contacts/AddModal/ContactForm/index.spec.jsx +301 -0
- package/src/Contacts/AddModal/ContactForm/locales/en.json +75 -0
- package/src/Contacts/AddModal/ContactForm/locales/fr.json +75 -0
- package/src/Contacts/AddModal/ContactForm/locales/index.jsx +11 -0
- package/src/Contacts/AddModal/ContactForm/locales/ru.json +75 -0
- package/src/Contacts/AddModal/ContactForm/locales/vi.json +75 -0
- package/src/Contacts/AddModal/ContactForm/styles.styl +2 -0
- package/src/Contacts/AddModal/CustomLabelDialog/index.jsx +109 -0
- package/src/Contacts/AddModal/CustomLabelDialog/locales/en.json +15 -0
- package/src/Contacts/AddModal/CustomLabelDialog/locales/fr.json +15 -0
- package/src/Contacts/AddModal/CustomLabelDialog/locales/index.jsx +11 -0
- package/src/Contacts/AddModal/CustomLabelDialog/locales/ru.json +15 -0
- package/src/Contacts/AddModal/CustomLabelDialog/locales/vi.json +15 -0
- package/src/Contacts/AddModal/Readme.md +55 -0
- package/src/Contacts/AddModal/index.jsx +86 -0
- package/src/Contacts/AddModal/locales/en.json +13 -0
- package/src/Contacts/AddModal/locales/fr.json +13 -0
- package/src/Contacts/AddModal/locales/index.jsx +11 -0
- package/src/Contacts/AddModal/locales/ru.json +13 -0
- package/src/Contacts/AddModal/locales/vi.json +13 -0
- package/src/Contacts/AddModal/mocks.js +299 -0
- package/src/Contacts/AddModal/types.js +102 -0
- package/src/Contacts/GroupsSelect/GroupCreation.jsx +96 -0
- package/src/Contacts/GroupsSelect/GroupsSelect.jsx +159 -0
- package/src/Contacts/GroupsSelect/GroupsSelect.spec.jsx +249 -0
- package/src/Contacts/GroupsSelect/GroupsSelectProvider.jsx +40 -0
- package/src/Contacts/GroupsSelect/Readme.md +1 -0
- package/src/Contacts/GroupsSelect/SelectBox/Control.jsx +37 -0
- package/src/Contacts/GroupsSelect/SelectBox/EditGroupName.jsx +52 -0
- package/src/Contacts/GroupsSelect/SelectBox/Menu.jsx +27 -0
- package/src/Contacts/GroupsSelect/SelectBox/Option.jsx +71 -0
- package/src/Contacts/GroupsSelect/SelectBox/SelectContainer.jsx +15 -0
- package/src/Contacts/GroupsSelect/SelectBox/styles.styl +2 -0
- package/src/Contacts/GroupsSelect/helpers.js +25 -0
- package/src/Contacts/GroupsSelect/locales/en.json +21 -0
- package/src/Contacts/GroupsSelect/locales/fr.json +21 -0
- package/src/Contacts/GroupsSelect/locales/index.jsx +11 -0
- package/src/Contacts/GroupsSelect/locales/ru.json +21 -0
- package/src/Contacts/GroupsSelect/locales/vi.json +21 -0
- package/src/Contacts/GroupsSelect/styles.styl +48 -0
- package/src/Contacts/GroupsSelect/useGroupSelect.jsx +89 -0
- package/src/Contacts/Header/GroupsSelection.jsx +75 -0
- package/src/Contacts/Header/ImportDropdown.jsx +80 -0
- package/src/Contacts/Header/Readme.md +38 -0
- package/src/Contacts/Header/SearchInput.jsx +19 -0
- package/src/Contacts/Header/index.jsx +80 -0
- package/src/Contacts/Header/locales/en.json +15 -0
- package/src/Contacts/Header/locales/fr.json +15 -0
- package/src/Contacts/Header/locales/index.jsx +11 -0
- package/src/Contacts/Header/locales/ru.json +15 -0
- package/src/Contacts/Header/locales/vi.json +15 -0
- package/src/Contacts/Readme.md +1 -0
- package/src/ContactsList/ContactCell.jsx +23 -0
- package/src/ContactsList/ContactRow.jsx +46 -0
- package/src/ContactsList/ContactRow.spec.js +75 -0
- package/src/ContactsList/Contacts/ContactCozy.jsx +23 -0
- package/src/ContactsList/Contacts/ContactEmail.jsx +23 -0
- package/src/ContactsList/Contacts/ContactIdentity.jsx +57 -0
- package/src/ContactsList/Contacts/ContactName.jsx +43 -0
- package/src/ContactsList/Contacts/ContactPhone.jsx +24 -0
- package/src/ContactsList/ContactsList.jsx +52 -0
- package/src/ContactsList/Readme.md +47 -0
- package/src/ContactsList/_mockContacts.json +2494 -0
- package/src/ContactsList/helpers.js +132 -0
- package/src/ContactsList/helpers.spec.js +150 -0
- package/src/ContactsList/index.js +3 -0
- package/src/ContactsList/locales/en.json +5 -0
- package/src/ContactsList/locales/fr.json +5 -0
- package/src/ContactsList/locales/ru.json +5 -0
- package/src/ContactsList/locales/vi.json +5 -0
- package/src/ContactsList/locales/withContactsListLocales.jsx +15 -0
- package/src/ContactsList/styles.styl +35 -0
- package/src/ContactsListModal/AddContact/AddContactActions.jsx +16 -0
- package/src/ContactsListModal/AddContact/AddContactContent.jsx +60 -0
- package/src/ContactsListModal/AddContact/AddContactDialog.jsx +38 -0
- package/src/ContactsListModal/AddContact/AddContactTitle.jsx +9 -0
- package/src/ContactsListModal/AddContact/helpers.js +18 -0
- package/src/ContactsListModal/AddContact/helpers.spec.js +74 -0
- package/src/ContactsListModal/AddContact/styles.styl +2 -0
- package/src/ContactsListModal/ContactsListContent.jsx +74 -0
- package/src/ContactsListModal/ContactsListModal.jsx +143 -0
- package/src/ContactsListModal/ContactsListModalWithQuery.jsx +27 -0
- package/src/ContactsListModal/EmptyMessage.jsx +18 -0
- package/src/ContactsListModal/MobileHeader.jsx +50 -0
- package/src/ContactsListModal/Readme.md +45 -0
- package/src/ContactsListModal/index.jsx +28 -0
- package/src/ContactsListModal/locales/en.json +11 -0
- package/src/ContactsListModal/locales/fr.json +11 -0
- package/src/ContactsListModal/locales/ru.json +11 -0
- package/src/ContactsListModal/locales/vi.json +11 -0
- package/src/ContactsListModal/mockClient.jsx +47 -0
- package/src/ContactsListModal/queries.js +12 -0
- package/src/ContactsListModal/styles.styl +12 -0
- package/src/ContactsListModal/withContactsListLocales.jsx +11 -0
- package/src/Dialogs/AuthenticationDialogs/index.jsx +115 -0
- package/src/Field/Readme.md +357 -0
- package/src/Field/index.jsx +317 -0
- package/src/Field/index.spec.js +59 -0
- package/src/Field/styles.styl +41 -0
- package/src/FileImageLoader/Readme.md +112 -0
- package/src/FileImageLoader/checkImageSource.js +29 -0
- package/src/FileImageLoader/index.jsx +186 -0
- package/src/FileImageLoader/index.spec.jsx +176 -0
- package/src/FilePicker/FilePickerBody.jsx +111 -0
- package/src/FilePicker/FilePickerBodyItem.jsx +126 -0
- package/src/FilePicker/FilePickerBodyItem.spec.jsx +164 -0
- package/src/FilePicker/FilePickerBreadcrumb.jsx +55 -0
- package/src/FilePicker/FilePickerFooter.jsx +42 -0
- package/src/FilePicker/FilePickerFooter.spec.jsx +41 -0
- package/src/FilePicker/FilePickerHeader.jsx +89 -0
- package/src/FilePicker/Readme.md +50 -0
- package/src/FilePicker/docs/DemoProvider.jsx +273 -0
- package/src/FilePicker/helpers.js +46 -0
- package/src/FilePicker/helpers.spec.js +84 -0
- package/src/FilePicker/index.jsx +94 -0
- package/src/FilePicker/locales/en.json +8 -0
- package/src/FilePicker/locales/fr.json +8 -0
- package/src/FilePicker/locales/ru.json +8 -0
- package/src/FilePicker/locales/vi.json +8 -0
- package/src/FilePicker/queries.js +37 -0
- package/src/FilePicker/styles.styl +18 -0
- package/src/Intent/IntentDialogOpener/Readme.md +25 -0
- package/src/Intent/IntentDialogOpener/index.jsx +110 -0
- package/src/Intent/IntentIframe/Readme.md +80 -0
- package/src/Intent/IntentIframe/index.jsx +112 -0
- package/src/Intent/IntentIframe/styles.styl +21 -0
- package/src/ListItem/ExpandedAttributes/ExpandedAttribute.jsx +40 -0
- package/src/ListItem/ExpandedAttributes/helpers.js +214 -0
- package/src/ListItem/ExpandedAttributes/helpers.spec.js +175 -0
- package/src/ListItem/ExpandedAttributes/index.jsx +62 -0
- package/src/ListItem/ListItemBase/Renaming/RenameDialog.jsx +38 -0
- package/src/ListItem/ListItemBase/Renaming/RenameInput.jsx +134 -0
- package/src/ListItem/ListItemBase/Renaming/helpers.js +35 -0
- package/src/ListItem/ListItemBase/index.jsx +116 -0
- package/src/ListItem/ListItemByDoc/index.jsx +103 -0
- package/src/ListItem/ListItemContact/helpers.js +28 -0
- package/src/ListItem/ListItemContact/helpers.spec.js +41 -0
- package/src/ListItem/ListItemContact/index.jsx +68 -0
- package/src/ListItem/ListItemContact/useActions.jsx +22 -0
- package/src/ListItem/ListItemFile/ExpirationAnnotation.jsx +39 -0
- package/src/ListItem/ListItemFile/ItemIcon.jsx +49 -0
- package/src/ListItem/ListItemFile/PrimaryText.jsx +38 -0
- package/src/ListItem/ListItemFile/SecondaryText.jsx +36 -0
- package/src/ListItem/ListItemFile/index.jsx +75 -0
- package/src/ListItem/Readme.md +211 -0
- package/src/ListItem/hoc/withListItemLocales.jsx +15 -0
- package/src/ListItem/locales/en.json +75 -0
- package/src/ListItem/locales/fr.json +75 -0
- package/src/ListItem/locales/ru.json +75 -0
- package/src/ListItem/locales/vi.json +75 -0
- package/src/Paywall/MaxAccountsByKonnectorPaywall.jsx +32 -0
- package/src/Paywall/MaxAccountsPaywall.jsx +27 -0
- package/src/Paywall/MaxDaysToCapturePaywall.jsx +27 -0
- package/src/Paywall/MaxPapersPaywall.jsx +29 -0
- package/src/Paywall/OnlyOfficePaywall.jsx +24 -0
- package/src/Paywall/PasswordSharingPaywall.jsx +20 -0
- package/src/Paywall/Paywall.jsx +130 -0
- package/src/Paywall/Paywall.spec.jsx +228 -0
- package/src/Paywall/QuotaPaywall.jsx +18 -0
- package/src/Paywall/Readme.md +139 -0
- package/src/Paywall/helpers.js +22 -0
- package/src/Paywall/howto.md +28 -0
- package/src/Paywall/index.jsx +7 -0
- package/src/Paywall/locales/en.json +95 -0
- package/src/Paywall/locales/fr.json +95 -0
- package/src/Paywall/locales/ru.json +95 -0
- package/src/Paywall/locales/vi.json +95 -0
- package/src/Paywall/locales/withPaywallLocales.jsx +15 -0
- package/src/Qualification/QualificationGrid/Readme.md +26 -0
- package/src/Qualification/QualificationGrid/helpers.js +4 -0
- package/src/Qualification/QualificationGrid/index.jsx +91 -0
- package/src/Qualification/QualificationGrid/locales/en.json +15 -0
- package/src/Qualification/QualificationGrid/locales/fr.json +15 -0
- package/src/Qualification/QualificationGrid/locales/ru.json +15 -0
- package/src/Qualification/QualificationGrid/locales/vi.json +15 -0
- package/src/Qualification/QualificationGrid/locales/withLocales.jsx +15 -0
- package/src/Qualification/QualificationIcon/Readme.md +14 -0
- package/src/Qualification/QualificationIcon/index.jsx +104 -0
- package/src/Qualification/QualificationItem/Readme.md +8 -0
- package/src/Qualification/QualificationItem/index.jsx +64 -0
- package/src/Qualification/QualificationModal/Readme.md +28 -0
- package/src/Qualification/QualificationModal/helpers.js +63 -0
- package/src/Qualification/QualificationModal/helpers.spec.js +61 -0
- package/src/Qualification/QualificationModal/index.jsx +71 -0
- package/src/Qualification/QualificationModal/locales/en.json +6 -0
- package/src/Qualification/QualificationModal/locales/fr.json +6 -0
- package/src/Qualification/QualificationModal/locales/index.jsx +11 -0
- package/src/Qualification/QualificationModal/locales/ru.json +6 -0
- package/src/Qualification/QualificationModal/locales/vi.json +6 -0
- package/src/ShortcutTile/index.tsx +60 -0
- package/src/SquareAppIcon/Readme.md +185 -0
- package/src/SquareAppIcon/SquareAppIcon.spec.js +86 -0
- package/src/SquareAppIcon/__snapshots__/SquareAppIcon.spec.js.snap +474 -0
- package/src/SquareAppIcon/constants.json +6 -0
- package/src/SquareAppIcon/index.jsx +289 -0
- package/src/SquareAppIcon/styles.styl +141 -0
- package/src/Storage/Readme.md +45 -0
- package/src/Storage/StorageButton.jsx +34 -0
- package/src/Storage/StorageProgress.jsx +52 -0
- package/src/Storage/index.jsx +41 -0
- package/src/Storage/locales/en.json +7 -0
- package/src/Storage/locales/fr.json +7 -0
- package/src/Storage/locales/index.jsx +11 -0
- package/src/Storage/locales/ru.json +7 -0
- package/src/Storage/locales/vi.json +7 -0
- package/src/UploadQueue/FileUploadProgress.jsx +50 -0
- package/src/UploadQueue/Item.jsx +99 -0
- package/src/UploadQueue/Pending.jsx +12 -0
- package/src/UploadQueue/Readme.md +95 -0
- package/src/UploadQueue/RemainingTime.jsx +27 -0
- package/src/UploadQueue/helpers.js +3 -0
- package/src/UploadQueue/index.jsx +161 -0
- package/src/UploadQueue/index.spec.jsx +163 -0
- package/src/UploadQueue/locales/en.json +10 -0
- package/src/UploadQueue/locales/es.json +10 -0
- package/src/UploadQueue/locales/fr.json +10 -0
- package/src/UploadQueue/locales/ru.json +10 -0
- package/src/UploadQueue/locales/vi.json +10 -0
- package/src/UploadQueue/styles.styl +155 -0
- package/src/UploadQueue/useStatusIcon.js +32 -0
- package/src/hooks/useClientErrors.jsx +140 -0
- package/src/hooks/useClientErrors.spec.jsx +94 -0
- package/src/proptypes.js +20 -0
- package/src/providers/CozyTheme/CozyThemeWithQuery.jsx +25 -0
- package/src/providers/CozyTheme/Readme.md +88 -0
- package/src/providers/CozyTheme/index.jsx +35 -0
- package/src/providers/CozyTheme/queries.js +14 -0
- package/src/providers/DemoProvider.jsx +30 -0
- package/src/providers/Intent/index.jsx +83 -0
- package/src/types.d.ts +4 -0
- package/test/I18n.js +13 -0
- package/test/fileMock.js +3 -0
- package/test/jestsetup.js +1 -0
- package/tsconfig-build.json +16 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.validateFields = exports.removeRelatedContactRelationships = exports.removeField = exports.removeAsscociatedData = exports.moveToHead = exports.movePrimaryToHead = exports.makeTypeAndLabel = exports.makeRelatedContact = exports.makeItemLabel = exports.makeInitialCustomValue = exports.makeImppValues = exports.makeFields = exports.makeCustomLabel = exports.hasExtendedAddress = exports.getRelatedContactRelationships = exports.fieldsRequired = exports.createAddress = exports.addField = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
16
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
|
+
|
|
18
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
19
|
+
|
|
20
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
21
|
+
|
|
22
|
+
var _merge = _interopRequireDefault(require("lodash/merge"));
|
|
23
|
+
|
|
24
|
+
var _uniqueId = _interopRequireDefault(require("lodash/uniqueId"));
|
|
25
|
+
|
|
26
|
+
var _cozyClient = require("cozy-client");
|
|
27
|
+
|
|
28
|
+
var _contact = require("cozy-client/dist/models/contact");
|
|
29
|
+
|
|
30
|
+
var _contactToFormValues2 = _interopRequireDefault(require("./contactToFormValues"));
|
|
31
|
+
|
|
32
|
+
var _excluded = ["postcode"];
|
|
33
|
+
|
|
34
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
+
|
|
36
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
37
|
+
|
|
38
|
+
var fieldsRequired = ['givenName', 'familyName', 'email[0].email', 'cozy'];
|
|
39
|
+
/**
|
|
40
|
+
* Returns errors if all required fields are empty
|
|
41
|
+
* @param {object} values - Fields values
|
|
42
|
+
* @param {func} t - Translation function
|
|
43
|
+
* @returns {object} Errors
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
exports.fieldsRequired = fieldsRequired;
|
|
47
|
+
|
|
48
|
+
var validateFields = function validateFields(values, t) {
|
|
49
|
+
var errors = {};
|
|
50
|
+
|
|
51
|
+
if (fieldsRequired.every(function (field) {
|
|
52
|
+
return !(0, _get.default)(values, field);
|
|
53
|
+
})) {
|
|
54
|
+
fieldsRequired.forEach(function (field) {
|
|
55
|
+
errors[field] = t('Contacts.AddModal.ContactForm.fields.required');
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return errors;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* @param {object} [item] - Contact attribute
|
|
63
|
+
* @returns {string} Stringified object
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
exports.validateFields = validateFields;
|
|
68
|
+
|
|
69
|
+
var makeItemLabel = function makeItemLabel(item) {
|
|
70
|
+
if (!item) return undefined;
|
|
71
|
+
var res = item.label || item.type ? JSON.stringify({
|
|
72
|
+
type: item.type,
|
|
73
|
+
label: item.label
|
|
74
|
+
}) : undefined;
|
|
75
|
+
return res;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* @param {string} [itemLabel] - Value of the label for a contact attribute
|
|
80
|
+
* @returns {{ type?: string, label?: string }}
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
exports.makeItemLabel = makeItemLabel;
|
|
85
|
+
|
|
86
|
+
var makeTypeAndLabel = function makeTypeAndLabel(itemLabel) {
|
|
87
|
+
if (!itemLabel) {
|
|
88
|
+
return {
|
|
89
|
+
type: undefined,
|
|
90
|
+
label: undefined
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var itemLabelObj = JSON.parse(itemLabel);
|
|
95
|
+
var res = {
|
|
96
|
+
type: itemLabelObj.type,
|
|
97
|
+
label: itemLabelObj.label
|
|
98
|
+
};
|
|
99
|
+
return res;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* @param {object} addressField
|
|
103
|
+
* @returns {boolean} True if addressField has extended address
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
exports.makeTypeAndLabel = makeTypeAndLabel;
|
|
108
|
+
|
|
109
|
+
var hasExtendedAddress = function hasExtendedAddress(addressField) {
|
|
110
|
+
if (!addressField) return false;
|
|
111
|
+
var extendedAddressKeys = ['addresslocality', 'addressbuilding', 'addressstairs', 'addressfloor', 'addressapartment', 'addressentrycode'];
|
|
112
|
+
return Object.keys(addressField).some(function (ext) {
|
|
113
|
+
return extendedAddressKeys.includes(ext);
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
exports.hasExtendedAddress = hasExtendedAddress;
|
|
118
|
+
|
|
119
|
+
var moveToHead = function moveToHead(shouldBeHead) {
|
|
120
|
+
return function (items) {
|
|
121
|
+
return items.reduce(function (arr, v) {
|
|
122
|
+
return shouldBeHead(v) ? [v].concat((0, _toConsumableArray2.default)(arr)) : [].concat((0, _toConsumableArray2.default)(arr), [v]);
|
|
123
|
+
}, []);
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
exports.moveToHead = moveToHead;
|
|
128
|
+
var movePrimaryToHead = moveToHead(function (v) {
|
|
129
|
+
return v === null || v === void 0 ? void 0 : v.primary;
|
|
130
|
+
});
|
|
131
|
+
exports.movePrimaryToHead = movePrimaryToHead;
|
|
132
|
+
|
|
133
|
+
var createAddress = function createAddress(_ref) {
|
|
134
|
+
var address = _ref.address,
|
|
135
|
+
oldContact = _ref.oldContact,
|
|
136
|
+
t = _ref.t;
|
|
137
|
+
return address ? address.filter(function (val) {
|
|
138
|
+
return val && val.address;
|
|
139
|
+
}).map(function (addressField, index) {
|
|
140
|
+
var _oldContact$address, _contactToFormValues, _contactToFormValues$;
|
|
141
|
+
|
|
142
|
+
var oldContactAddress = oldContact === null || oldContact === void 0 ? void 0 : (_oldContact$address = oldContact.address) === null || _oldContact$address === void 0 ? void 0 : _oldContact$address[index];
|
|
143
|
+
var oldContactFormValues = (_contactToFormValues = (0, _contactToFormValues2.default)({
|
|
144
|
+
contact: oldContact,
|
|
145
|
+
t: t
|
|
146
|
+
})) === null || _contactToFormValues === void 0 ? void 0 : (_contactToFormValues$ = _contactToFormValues.address) === null || _contactToFormValues$ === void 0 ? void 0 : _contactToFormValues$[index];
|
|
147
|
+
var addressHasBeenModified = !(0, _isEqual.default)(addressField, oldContactFormValues);
|
|
148
|
+
|
|
149
|
+
if (addressHasBeenModified) {
|
|
150
|
+
// Use "code" instead "postcode", to be vcard 4.0 rfc 6350 compliant
|
|
151
|
+
// eslint-disable-next-line no-unused-vars
|
|
152
|
+
var _ref2 = oldContactAddress || {},
|
|
153
|
+
postcode = _ref2.postcode,
|
|
154
|
+
oldContactAddressCleaned = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
155
|
+
|
|
156
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, oldContactAddressCleaned), {}, {
|
|
157
|
+
formattedAddress: addressField.address,
|
|
158
|
+
number: addressField.addressnumber,
|
|
159
|
+
street: addressField.addressstreet,
|
|
160
|
+
code: addressField.addresscode,
|
|
161
|
+
city: addressField.addresscity,
|
|
162
|
+
region: addressField.addressregion,
|
|
163
|
+
country: addressField.addresscountry
|
|
164
|
+
}, hasExtendedAddress(addressField) && {
|
|
165
|
+
extendedAddress: _objectSpread(_objectSpread({}, oldContactAddressCleaned.extendedAddress), {}, {
|
|
166
|
+
locality: addressField.addresslocality,
|
|
167
|
+
building: addressField.addressbuilding,
|
|
168
|
+
stairs: addressField.addressstairs,
|
|
169
|
+
floor: addressField.addressfloor,
|
|
170
|
+
apartment: addressField.addressapartment,
|
|
171
|
+
entrycode: addressField.addressentrycode
|
|
172
|
+
})
|
|
173
|
+
}), makeTypeAndLabel(addressField.addressLabel)), {}, {
|
|
174
|
+
primary: index === 0
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return oldContactAddress;
|
|
179
|
+
}) : [];
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* @param {(import('../types').RelatedContact|undefined)[]} relatedContact - The related contacts array
|
|
183
|
+
* @returns {Record<string, { data: { _id: string, _type: string }[] }>} - The related contacts relationships
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
exports.createAddress = createAddress;
|
|
188
|
+
|
|
189
|
+
var getRelatedContactRelationships = function getRelatedContactRelationships(relatedContact) {
|
|
190
|
+
// Tips filter Boolean to remove undefined value from array when relatedContact is empty (see contactToFormValues)
|
|
191
|
+
var data = relatedContact.filter(Boolean).reduce(function (acc, curr) {
|
|
192
|
+
var relationType = curr.relatedContactLabel ? JSON.parse(curr.relatedContactLabel).type : 'related';
|
|
193
|
+
var existingIndex = acc.findIndex(function (item) {
|
|
194
|
+
return item._id === curr.relatedContactId;
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
if (existingIndex !== -1) {
|
|
198
|
+
acc[existingIndex].metadata.relationTypes = Array.from(new Set([].concat((0, _toConsumableArray2.default)(acc[existingIndex].metadata.relationTypes), [relationType])));
|
|
199
|
+
} else {
|
|
200
|
+
acc.push({
|
|
201
|
+
_id: curr.relatedContactId,
|
|
202
|
+
_type: _contact.CONTACTS_DOCTYPE,
|
|
203
|
+
metadata: {
|
|
204
|
+
relationTypes: [relationType]
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return acc;
|
|
210
|
+
}, []); // `data` can be empty, you still have to return an object to override the behavior of the cozy-client store, otherwise it will keep the old value, and without refreshing the page, the data will not be up to date in the store and therefore on the interface
|
|
211
|
+
|
|
212
|
+
return {
|
|
213
|
+
related: {
|
|
214
|
+
data: data
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* When changing the type of relationship, it must be ensured that no empty relationship remains.
|
|
220
|
+
* The old and new ones are merged into `formValuesToContact`.
|
|
221
|
+
*
|
|
222
|
+
* @param {import('cozy-client/types/types').IOCozyContact} contact - The contact object with all relationships
|
|
223
|
+
* @returns {import('cozy-client/types/types').IOCozyContact} - The contact object without the related contacts relationships
|
|
224
|
+
*/
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
exports.getRelatedContactRelationships = getRelatedContactRelationships;
|
|
228
|
+
|
|
229
|
+
var removeRelatedContactRelationships = function removeRelatedContactRelationships(contact) {
|
|
230
|
+
if (!(contact !== null && contact !== void 0 && contact.relationships)) return contact;
|
|
231
|
+
var updatedContact = (0, _merge.default)({}, contact);
|
|
232
|
+
var relationshipsWithoutRelatedContact = Object.entries(updatedContact.relationships).reduce(function (acc, _ref3) {
|
|
233
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
234
|
+
relName = _ref4[0],
|
|
235
|
+
relValue = _ref4[1];
|
|
236
|
+
|
|
237
|
+
if ('related' === relName) {
|
|
238
|
+
acc[relName] = relValue;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return acc;
|
|
242
|
+
}, {});
|
|
243
|
+
updatedContact.relationships = relationshipsWithoutRelatedContact;
|
|
244
|
+
return updatedContact;
|
|
245
|
+
}; // TODO : Update dehydrate function to HasMany class in cozy-client
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* This function is used to clean the contact object from the associated data
|
|
249
|
+
* cozy-client dehydrates the document before saving it (via the `HasMany` method), but by doing it manually, we ensure that all hydrated relationships in the document (and without data of course) are not saved in the `relationships` of the document, which adds unnecessary data.
|
|
250
|
+
*
|
|
251
|
+
* @param {import('cozy-client/types/types').IOCozyContact} contact - The contact object with associated data
|
|
252
|
+
* @returns {import('cozy-client/types/types').IOCozyContact} - The contact object without associated data
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
exports.removeRelatedContactRelationships = removeRelatedContactRelationships;
|
|
257
|
+
|
|
258
|
+
var removeAsscociatedData = function removeAsscociatedData(contact) {
|
|
259
|
+
if (!contact) return {};
|
|
260
|
+
return Object.entries(contact).reduce(function (cleanedContact, _ref5) {
|
|
261
|
+
var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
|
|
262
|
+
key = _ref6[0],
|
|
263
|
+
value = _ref6[1];
|
|
264
|
+
|
|
265
|
+
// Add `groups` condition to keep the old implementation functional, see below
|
|
266
|
+
if (!(value instanceof _cozyClient.Association) || key === 'groups') {
|
|
267
|
+
cleanedContact[key] = value;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return cleanedContact;
|
|
271
|
+
}, {});
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* @param {import('cozy-client/types/types').IOCozyContact} contact
|
|
275
|
+
* @returns {import('../types').RelatedContact[]}
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
exports.removeAsscociatedData = removeAsscociatedData;
|
|
280
|
+
|
|
281
|
+
var makeRelatedContact = function makeRelatedContact(contact) {
|
|
282
|
+
var _contact$relationship;
|
|
283
|
+
|
|
284
|
+
if (!(contact.related instanceof _cozyClient.Association) || !((_contact$relationship = contact.relationships) !== null && _contact$relationship !== void 0 && _contact$relationship.related)) {
|
|
285
|
+
return [undefined];
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
var relatedData = contact.related.data.reduce(function (acc, curr) {
|
|
289
|
+
// Use `makeDisplayName` because if the contact is newly created, it has no `displayName` attribute. (Creation of a contact when selecting a linked contact)
|
|
290
|
+
acc[curr._id] = curr.displayName || (0, _contact.makeDisplayName)(curr);
|
|
291
|
+
return acc;
|
|
292
|
+
}, {});
|
|
293
|
+
var res = contact.relationships.related.data.flatMap(function (item) {
|
|
294
|
+
return item.metadata.relationTypes.map(function (type) {
|
|
295
|
+
return {
|
|
296
|
+
relatedContactId: item._id,
|
|
297
|
+
relatedContact: relatedData[item._id],
|
|
298
|
+
relatedContactLabel: makeItemLabel({
|
|
299
|
+
type: type === 'related' ? '' : type
|
|
300
|
+
})
|
|
301
|
+
};
|
|
302
|
+
});
|
|
303
|
+
}); // Useful because a contact always has at least the `related` relationships (see `getRelatedContactRelationships`)
|
|
304
|
+
|
|
305
|
+
return res.length > 0 ? res : [undefined];
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
exports.makeRelatedContact = makeRelatedContact;
|
|
309
|
+
|
|
310
|
+
var addField = function addField(fields) {
|
|
311
|
+
return fields.push({
|
|
312
|
+
fieldId: (0, _uniqueId.default)('fieldId_')
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
exports.addField = addField;
|
|
317
|
+
|
|
318
|
+
var removeField = function removeField(fields, index) {
|
|
319
|
+
var isLastRemainingField = fields.length === 1;
|
|
320
|
+
|
|
321
|
+
if (isLastRemainingField) {
|
|
322
|
+
fields.update(index, undefined);
|
|
323
|
+
} else {
|
|
324
|
+
fields.remove(index);
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
*
|
|
329
|
+
* @param {string} value
|
|
330
|
+
* @param {func} t
|
|
331
|
+
* @returns {string}
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
exports.removeField = removeField;
|
|
336
|
+
|
|
337
|
+
var makeCustomLabel = function makeCustomLabel(value, t) {
|
|
338
|
+
var _JSON$parse = JSON.parse(value),
|
|
339
|
+
type = _JSON$parse.type,
|
|
340
|
+
label = _JSON$parse.label;
|
|
341
|
+
|
|
342
|
+
var isSupportedLabel = ['home', 'work'].includes(label);
|
|
343
|
+
var firstString = type || '';
|
|
344
|
+
var secondString = label && isSupportedLabel ? type ? " (".concat(t("Contacts.AddModal.ContactForm.label.".concat(label)), ")").toLowerCase() : "label.".concat(label) : '';
|
|
345
|
+
return firstString + secondString || null;
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
*
|
|
349
|
+
* @param {import('cozy-client/types/types').IOCozyContact} oldContact - Contact to be modified
|
|
350
|
+
* @param {string?} value - New URI value to add to the Contact
|
|
351
|
+
* @returns {{ uri: string, protocol: string, label: string, primary?: boolean }[]}
|
|
352
|
+
*/
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
exports.makeCustomLabel = makeCustomLabel;
|
|
356
|
+
|
|
357
|
+
var makeImppValues = function makeImppValues(oldContact, value) {
|
|
358
|
+
var _value = (value === null || value === void 0 ? void 0 : value.trim()) || '';
|
|
359
|
+
|
|
360
|
+
var oldImppValues = oldContact === null || oldContact === void 0 ? void 0 : oldContact.impp;
|
|
361
|
+
|
|
362
|
+
if (_value) {
|
|
363
|
+
if (!oldImppValues || oldImppValues.length === 0) {
|
|
364
|
+
return [{
|
|
365
|
+
uri: _value,
|
|
366
|
+
protocol: 'matrix',
|
|
367
|
+
label: 'work',
|
|
368
|
+
primary: true
|
|
369
|
+
}];
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return oldImppValues.map(function (el) {
|
|
373
|
+
if (el.protocol === 'matrix' && el.label === 'work') {
|
|
374
|
+
return _objectSpread(_objectSpread({}, el), {}, {
|
|
375
|
+
uri: _value
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return el;
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
return (oldImppValues === null || oldImppValues === void 0 ? void 0 : oldImppValues.map(function (el) {
|
|
384
|
+
if (el.protocol !== 'matrix' || el.label !== 'work') {
|
|
385
|
+
return el;
|
|
386
|
+
}
|
|
387
|
+
}).filter(Boolean)) || [];
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
*
|
|
391
|
+
* @param {string} name
|
|
392
|
+
* @param {string} value
|
|
393
|
+
* @returns {string}
|
|
394
|
+
*/
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
exports.makeImppValues = makeImppValues;
|
|
398
|
+
|
|
399
|
+
var makeInitialCustomValue = function makeInitialCustomValue(name, value) {
|
|
400
|
+
// gender input doesn't support custom label
|
|
401
|
+
if (!name || !value || name === 'gender') return undefined;
|
|
402
|
+
var valueObj = JSON.parse(value); // Voluntarily before the "backwards compatibility" condition
|
|
403
|
+
|
|
404
|
+
if (name.includes('relatedContactLabel')) {
|
|
405
|
+
if (!'related' === valueObj.type) {
|
|
406
|
+
return JSON.stringify({
|
|
407
|
+
type: valueObj.type
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return undefined;
|
|
412
|
+
} // for backwards compatiblity - historically there is only type and no label
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
if (valueObj.type && !valueObj.label) {
|
|
416
|
+
return JSON.stringify({
|
|
417
|
+
type: valueObj.type
|
|
418
|
+
});
|
|
419
|
+
} // for phone label
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
if (name.includes('phoneLabel')) {
|
|
423
|
+
// but unsupported one
|
|
424
|
+
if (!['cell', 'voice', 'fax'].includes(valueObj.type)) {
|
|
425
|
+
return JSON.stringify({
|
|
426
|
+
type: valueObj.type,
|
|
427
|
+
label: valueObj.label
|
|
428
|
+
});
|
|
429
|
+
} // we don't want to create a custom label if supported
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
return undefined;
|
|
433
|
+
} // at this point if label and type are both present, it's a custom label
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
if (valueObj.type && valueObj.label) {
|
|
437
|
+
return JSON.stringify({
|
|
438
|
+
type: valueObj.type,
|
|
439
|
+
label: valueObj.label
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
/**
|
|
444
|
+
* @param {(import('../types').Field)[]|undefined} customFields
|
|
445
|
+
* @param {(import('../types').Field)[]} defaultFields
|
|
446
|
+
* @returns {(import('../types').Field)[]}
|
|
447
|
+
*/
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
exports.makeInitialCustomValue = makeInitialCustomValue;
|
|
451
|
+
|
|
452
|
+
var makeFields = function makeFields(customFields, defaultFields) {
|
|
453
|
+
if (!customFields) {
|
|
454
|
+
return defaultFields;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
var fields = (0, _toConsumableArray2.default)(defaultFields);
|
|
458
|
+
customFields.map(function (customField) {
|
|
459
|
+
if (customField.position) {
|
|
460
|
+
fields.splice(customField.position, 0, customField);
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
return fields;
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
exports.makeFields = makeFields;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
exports.getSubmitContactForm = getSubmitContactForm;
|
|
10
|
+
exports.isSameContactProp = void 0;
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _finalFormArrays = _interopRequireDefault(require("final-form-arrays"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _reactFinalForm = require("react-final-form");
|
|
21
|
+
|
|
22
|
+
var _HasMany = require("cozy-client/dist/associations/HasMany");
|
|
23
|
+
|
|
24
|
+
var _Buttons = _interopRequireDefault(require("cozy-ui/transpiled/react/Buttons"));
|
|
25
|
+
|
|
26
|
+
var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
|
|
27
|
+
|
|
28
|
+
var _FieldInputLayout = _interopRequireDefault(require("./FieldInputLayout"));
|
|
29
|
+
|
|
30
|
+
var _contactToFormValues = _interopRequireDefault(require("./contactToFormValues"));
|
|
31
|
+
|
|
32
|
+
var _fieldsConfig = require("./fieldsConfig");
|
|
33
|
+
|
|
34
|
+
var _formValuesToContact = _interopRequireDefault(require("./formValuesToContact"));
|
|
35
|
+
|
|
36
|
+
var _helpers = require("./helpers");
|
|
37
|
+
|
|
38
|
+
var _locales = require("./locales");
|
|
39
|
+
|
|
40
|
+
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); }
|
|
41
|
+
|
|
42
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
|
+
|
|
44
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
45
|
+
|
|
46
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
47
|
+
|
|
48
|
+
// import { fullContactPropTypes } from '../../ContactPropTypes' // !!
|
|
49
|
+
// this variable will be set in the form's render prop
|
|
50
|
+
// and used by the submit button in ContactFormModal
|
|
51
|
+
// to be able to trigger the submit from outside the form
|
|
52
|
+
// See react-final-form examples here: https://www.npmjs.com/package/react-final-form#external-submit
|
|
53
|
+
var _submitContactForm;
|
|
54
|
+
|
|
55
|
+
function setSubmitContactForm(handleSubmit) {
|
|
56
|
+
_submitContactForm = handleSubmit;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function getSubmitContactForm() {
|
|
60
|
+
return _submitContactForm;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @param {object} params
|
|
65
|
+
* @param {{ data: Array<object> }} params.contacts
|
|
66
|
+
* @param {import('cozy-client/types/types').IOCozyContact} params.contact
|
|
67
|
+
* @param {Object} params.customFieldsProps
|
|
68
|
+
* @param {func} params.onSubmit
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
var ContactForm = function ContactForm(_ref) {
|
|
74
|
+
var contacts = _ref.contacts,
|
|
75
|
+
contact = _ref.contact,
|
|
76
|
+
customFieldsProps = _ref.customFieldsProps,
|
|
77
|
+
_onSubmit = _ref.onSubmit;
|
|
78
|
+
|
|
79
|
+
var _useState = (0, _react.useState)(false),
|
|
80
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
81
|
+
showSecondaryFields = _useState2[0],
|
|
82
|
+
setShowSecondaryFields = _useState2[1];
|
|
83
|
+
|
|
84
|
+
(0, _I18n.useExtendI18n)(_locales.locales);
|
|
85
|
+
|
|
86
|
+
var _useI18n = (0, _I18n.useI18n)(),
|
|
87
|
+
t = _useI18n.t;
|
|
88
|
+
|
|
89
|
+
var fields = customFieldsProps.fields,
|
|
90
|
+
makeCustomFieldsFormValues = customFieldsProps.makeCustomFieldsFormValues,
|
|
91
|
+
makeCustomContactValues = customFieldsProps.makeCustomContactValues;
|
|
92
|
+
|
|
93
|
+
var _fields = (0, _helpers.makeFields)(fields, _fieldsConfig.fields);
|
|
94
|
+
|
|
95
|
+
var hasSecondaryFields = _fields.some(function (el) {
|
|
96
|
+
return el.isSecondary;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement(_reactFinalForm.Form, {
|
|
100
|
+
mutators: _objectSpread({}, _finalFormArrays.default),
|
|
101
|
+
initialValues: (0, _contactToFormValues.default)({
|
|
102
|
+
contact: contact,
|
|
103
|
+
makeCustomContactValues: makeCustomContactValues,
|
|
104
|
+
t: t
|
|
105
|
+
}),
|
|
106
|
+
validate: function validate(values) {
|
|
107
|
+
return (0, _helpers.validateFields)(values, t);
|
|
108
|
+
},
|
|
109
|
+
onSubmit: function onSubmit(formValues) {
|
|
110
|
+
return _onSubmit((0, _formValuesToContact.default)({
|
|
111
|
+
formValues: formValues,
|
|
112
|
+
oldContact: contact,
|
|
113
|
+
makeCustomFieldsFormValues: makeCustomFieldsFormValues,
|
|
114
|
+
t: t
|
|
115
|
+
}));
|
|
116
|
+
},
|
|
117
|
+
render: function render(_ref2) {
|
|
118
|
+
var handleSubmit = _ref2.handleSubmit,
|
|
119
|
+
valid = _ref2.valid,
|
|
120
|
+
submitFailed = _ref2.submitFailed,
|
|
121
|
+
errors = _ref2.errors;
|
|
122
|
+
setSubmitContactForm(handleSubmit);
|
|
123
|
+
return /*#__PURE__*/_react.default.createElement("form", {
|
|
124
|
+
role: "form",
|
|
125
|
+
onSubmit: handleSubmit,
|
|
126
|
+
className: "u-flex u-flex-column"
|
|
127
|
+
}, _fields.map(function (attributes, index) {
|
|
128
|
+
return /*#__PURE__*/_react.default.createElement(_FieldInputLayout.default, {
|
|
129
|
+
key: index,
|
|
130
|
+
attributes: attributes,
|
|
131
|
+
contacts: contacts,
|
|
132
|
+
showSecondaryFields: showSecondaryFields,
|
|
133
|
+
formProps: {
|
|
134
|
+
valid: valid,
|
|
135
|
+
submitFailed: submitFailed,
|
|
136
|
+
errors: errors
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}), hasSecondaryFields && !showSecondaryFields && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Buttons.default, {
|
|
140
|
+
className: "u-db u-ml-2 u-mt-1",
|
|
141
|
+
variant: "text",
|
|
142
|
+
label: t('Contacts.AddModal.ContactForm.other-fields'),
|
|
143
|
+
onClick: function onClick() {
|
|
144
|
+
return setShowSecondaryFields(true);
|
|
145
|
+
}
|
|
146
|
+
})));
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
ContactForm.defaultProps = {
|
|
152
|
+
customFieldsProps: {}
|
|
153
|
+
}; // Used to avoid unnecessary multiple rendering of ContactForm when creating a new contact in another way.
|
|
154
|
+
// These unnecessary renderings prevented the addition of a newly created linked contact. (Creation of a contact when selecting a linked contact)
|
|
155
|
+
|
|
156
|
+
var isSameContactProp = function isSameContactProp(prevProps, nextProps) {
|
|
157
|
+
var _prevProps$contact, _nextProps$contact;
|
|
158
|
+
|
|
159
|
+
if (!((_prevProps$contact = prevProps.contact) !== null && _prevProps$contact !== void 0 && _prevProps$contact.relationships) || !((_nextProps$contact = nextProps.contact) !== null && _nextProps$contact !== void 0 && _nextProps$contact.relationships)) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
var prevContactIdsRelated = (0, _HasMany.getHasManyItems)(prevProps.contact, 'related').map(function (r) {
|
|
164
|
+
return r._id;
|
|
165
|
+
});
|
|
166
|
+
var nextContactIdsRelated = (0, _HasMany.getHasManyItems)(nextProps.contact, 'related').map(function (r) {
|
|
167
|
+
return r._id;
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
if (prevContactIdsRelated.length !== nextContactIdsRelated.length || !prevContactIdsRelated.every(function (id) {
|
|
171
|
+
return nextContactIdsRelated.includes(id);
|
|
172
|
+
})) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return true;
|
|
177
|
+
}; // export default ContactForm
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
exports.isSameContactProp = isSameContactProp;
|
|
181
|
+
|
|
182
|
+
var _default = /*#__PURE__*/_react.default.memo(ContactForm, isSameContactProp);
|
|
183
|
+
|
|
184
|
+
exports.default = _default;
|