@conduction/nextcloud-vue 2.155.0 → 2.157.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/dist/esm/components/CnAiCompanion/CnAiInput.vue2.js +3 -1
- package/dist/esm/components/CnAiCompanion/CnAiInput.vue2.js.map +1 -1
- package/dist/esm/components/CnAiCompanion/CnAiInput.vue3.js.map +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue.js +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue.js +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue.js +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDuplicateWarning/CnDuplicateWarning.vue.js +1 -1
- package/dist/esm/components/CnDuplicateWarning/CnDuplicateWarning.vue2.js +2 -1
- package/dist/esm/components/CnDuplicateWarning/CnDuplicateWarning.vue2.js.map +1 -1
- package/dist/esm/components/CnDuplicateWarning/CnDuplicateWarning.vue3.js +10 -3
- package/dist/esm/components/CnDuplicateWarning/CnDuplicateWarning.vue3.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +14 -4
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js +3 -3
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue.js +1 -1
- package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue2.js.map +1 -1
- package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue3.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js +2 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js +13 -4
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue3.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue.js +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js +91 -7
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnMailTab/CnMailTab.vue.js +1 -1
- package/dist/esm/components/CnMailTab/CnMailTab.vue2.js +4 -4
- package/dist/esm/components/CnMailTab/CnMailTab.vue2.js.map +1 -1
- package/dist/esm/components/CnMailTab/CnMailTab.vue3.js.map +1 -1
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue.js +1 -1
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue2.js +3 -0
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue2.js.map +1 -1
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue3.js +10 -2
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue3.js.map +1 -1
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue.js +1 -1
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue2.js +6 -0
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue2.js.map +1 -1
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue3.js +2 -1
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue3.js.map +1 -1
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue.js +1 -1
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue2.js.map +1 -1
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue3.js +27 -24
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue3.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue2.js +25 -0
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue2.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue3.js +40 -8
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue3.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue2.js +10 -0
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnSearchSelect/CnSearchSelect.vue.js +1 -1
- package/dist/esm/components/CnSearchSelect/CnSearchSelect.vue2.js.map +1 -1
- package/dist/esm/components/CnSearchSelect/CnSearchSelect.vue3.js.map +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue.js +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js +24 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js.map +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js +9 -0
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js.map +1 -1
- package/dist/esm/components/CnStagesWidget/CnStagesWidget.vue.js +1 -1
- package/dist/esm/components/CnStagesWidget/CnStagesWidget.vue2.js +4 -1
- package/dist/esm/components/CnStagesWidget/CnStagesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnStagesWidget/CnStagesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnStagesWidget/stagesModel.js +10 -2
- package/dist/esm/components/CnStagesWidget/stagesModel.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue.js +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue2.js +61 -2
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue2.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js +68 -44
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js +13 -3
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue3.js.map +1 -1
- package/dist/esm/l10n/en.json.js +12 -7
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +14 -9
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +777 -469
- package/dist/esm/utils/dynamicProperties.js +14 -2
- package/dist/esm/utils/dynamicProperties.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +2472 -2120
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +777 -469
- package/l10n/en.json +12 -7
- package/l10n/nl.json +14 -9
- package/package.json +1 -1
- package/src/components/CnAiCompanion/CnAiInput.vue +3 -1
- package/src/components/CnBannerWidget/CnBannerWidget.vue +5 -1
- package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +12 -5
- package/src/components/CnCountdownWidget/CnCountdownWidget.vue +12 -0
- package/src/components/CnDashboardPage/CnDashboardPage.vue +3 -1
- package/src/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue +1 -0
- package/src/components/CnDuplicateWarning/CnDuplicateWarning.vue +8 -4
- package/src/components/CnFactsWidget/CnFactsWidget.vue +31 -6
- package/src/components/CnFeaturesBoard/CnFeaturesBoard.vue +4 -2
- package/src/components/CnFormDialog/CnFormDialog.vue +1 -0
- package/src/components/CnIndexSidebar/CnIndexSidebar.vue +13 -4
- package/src/components/CnLinkedWidget/CnLinkedWidget.vue +91 -7
- package/src/components/CnMailTab/CnMailTab.vue +4 -4
- package/src/components/CnNotificationMatrix/CnNotificationMatrix.vue +20 -0
- package/src/components/CnPartyPicker/CnPartyPicker.vue +7 -0
- package/src/components/CnSavedViewLookFields/CnSavedViewLookFields.vue +27 -20
- package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +42 -0
- package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +10 -0
- package/src/components/CnSearchSelect/CnSearchSelect.vue +3 -1
- package/src/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue +37 -1
- package/src/components/CnStagesWidget/CnStagesWidget.vue +4 -1
- package/src/components/CnStagesWidget/stagesModel.js +10 -2
- package/src/components/CnTimelineWidget/CnTimelineManage.vue +69 -4
- package/src/css/dialog.css +33 -0
- package/src/css/look-board-detail.css +4 -3
- package/src/css/look-board-index.css +34 -3
- package/src/css/look-board.css +181 -4
- package/src/integrations/builtin/email/CnEmailTab.vue +13 -3
- package/src/utils/dynamicProperties.js +13 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnTimelineManage.vue3.js","sources":["../../../../src/components/CnTimelineWidget/CnTimelineManage.vue?vue&type=template&id=702cb3dc&lang.js"],"sourcesContent":["<!--\n SPDX-FileCopyrightText: 2026 Conduction B.V.\n SPDX-License-Identifier: EUPL-1.2\n\n CnTimelineManage — the `manage` mode of CnTimelineWidget: one chronological\n read of OpenRegister's timeline on an object (notes, calls, messages), newest\n first with pinned entries on top, plus what a reader who may manage it can do\n there: filter by kind and visibility, pin, close a follow-up, write a note\n (optionally from a standard text block, optionally visible outside), export\n the shown entries as CSV, and run configured entry actions such as a reply\n dialog.\n\n The list read is filtered by OpenRegister whether or not a filter is asked\n for; the response says whether the reader may manage (`canManage`), and the\n controls are drawn from that rather than guessed. A failed read is not an\n empty history.\n-->\n<template>\n\t<div class=\"cn-timeline-manage\"\n\t\t:class=\"{ 'cn-timeline-manage--composer-only': composerOnly }\"\n\t\tdata-testid=\"cn-timeline-manage\">\n\t\t<template v-if=\"!composerOnly\">\n\t\t\t<div class=\"cn-timeline-manage__header\">\n\t\t\t\t<div class=\"cn-timeline-manage__heading\">\n\t\t\t\t\t<h3 class=\"cn-timeline-manage__title\">\n\t\t\t\t\t\t{{ titleText }}\n\t\t\t\t\t</h3>\n\t\t\t\t\t<p class=\"cn-timeline-manage__subtitle\">\n\t\t\t\t\t\t{{ subtitleText }}\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"cn-timeline-manage__header-actions\">\n\t\t\t\t\t<NcButton v-if=\"canManage && (composerEnabled || composerSeparate)\"\n\t\t\t\t\t\tdata-testid=\"cn-timeline-add-note\"\n\t\t\t\t\t\t@click=\"focusComposer\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<Plus :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Add note') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t\t<NcButton data-testid=\"cn-timeline-export\" @click=\"exportEntries\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<Download :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Export') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"cn-timeline-manage__chips\"\n\t\t\t\trole=\"group\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Kind')\"\n\t\t\t\tdata-testid=\"cn-timeline-kind-filter\">\n\t\t\t\t<button v-for=\"chip in kindChips\"\n\t\t\t\t\t:key=\"chip.key\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-timeline-manage__chip\"\n\t\t\t\t\t:class=\"{ 'cn-timeline-manage__chip--active': chip.active }\"\n\t\t\t\t\t:aria-pressed=\"chip.active ? 'true' : 'false'\"\n\t\t\t\t\t:data-testid=\"'cn-timeline-chip-' + chip.key\"\n\t\t\t\t\t@click=\"chooseKind(chip.id)\">\n\t\t\t\t\t{{ chip.label }}\n\t\t\t\t\t<span class=\"cn-timeline-manage__chip-count\">{{ chip.count }}</span>\n\t\t\t\t</button>\n\t\t\t</div>\n\n\t\t\t<div class=\"cn-timeline-manage__controls\">\n\t\t\t\t<NcSelect v-if=\"canManage\"\n\t\t\t\t\tv-model=\"visibilityFilter\"\n\t\t\t\t\tclass=\"cn-timeline-manage__filter\"\n\t\t\t\t\t:options=\"visibilityOptions\"\n\t\t\t\t\t:clearable=\"true\"\n\t\t\t\t\tlabel=\"label\"\n\t\t\t\t\t:inputLabel=\"visibilityLabelShown ? t('nextcloud-vue', 'Visibility') : undefined\"\n\t\t\t\t\t:labelOutside=\"!visibilityLabelShown\"\n\t\t\t\t\t:ariaLabelCombobox=\"t('nextcloud-vue', 'Visibility')\"\n\t\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Internal and public')\"\n\t\t\t\t\tdata-testid=\"cn-timeline-visibility-filter\"\n\t\t\t\t\t@update:modelValue=\"load\" />\n\t\t\t</div>\n\n\t\t\t<NcLoadingIcon v-if=\"loading\" :size=\"32\" />\n\n\t\t\t<NcNoteCard v-else-if=\"error\" type=\"error\" data-testid=\"cn-timeline-error\">\n\t\t\t\t{{ error }}\n\t\t\t</NcNoteCard>\n\n\t\t\t<NcEmptyContent v-else-if=\"entries.length === 0\"\n\t\t\t\t:name=\"t('nextcloud-vue', 'Nothing recorded yet')\"\n\t\t\t\t:description=\"t('nextcloud-vue', 'Notes, calls and messages appear here in the order they happened.')\"\n\t\t\t\tdata-testid=\"cn-timeline-empty\" />\n\n\t\t\t<ul v-else class=\"cn-timeline-manage__list\" data-testid=\"cn-timeline-list\">\n\t\t\t\t<li v-for=\"entry in entries\"\n\t\t\t\t\t:key=\"entry.id\"\n\t\t\t\t\tclass=\"cn-timeline-manage__entry\"\n\t\t\t\t\t:class=\"{ 'cn-timeline-manage__entry--pinned': entry.pinned }\"\n\t\t\t\t\t:data-kind=\"entry.kind || 'note'\"\n\t\t\t\t\tdata-testid=\"cn-timeline-entry\">\n\t\t\t\t\t<p class=\"cn-timeline-manage__message\">\n\t\t\t\t\t\t{{ entry.message }}\n\t\t\t\t\t</p>\n\n\t\t\t\t\t<div class=\"cn-timeline-manage__head\">\n\t\t\t\t\t\t<span class=\"cn-timeline-manage__kind\">{{ kindLabel(entry) }}</span>\n\t\t\t\t\t\t<span class=\"cn-timeline-manage__author\">{{ entry.author }}</span>\n\t\t\t\t\t\t<span class=\"cn-timeline-manage__moment\">{{ moment(entry.created) }}</span>\n\t\t\t\t\t\t<span v-if=\"entry.visibility === 'public'\"\n\t\t\t\t\t\t\tclass=\"cn-timeline-manage__badge cn-timeline-manage__badge--public\"\n\t\t\t\t\t\t\tdata-testid=\"cn-timeline-public\">\n\t\t\t\t\t\t\t{{ publicLabel }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span v-if=\"entry.followUp === 'open'\"\n\t\t\t\t\t\t\tclass=\"cn-timeline-manage__badge cn-timeline-manage__badge--open\"\n\t\t\t\t\t\t\tdata-testid=\"cn-timeline-followup-open\">\n\t\t\t\t\t\t\t{{ t('nextcloud-vue', 'Needs an answer') }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<p v-if=\"entry.siblings && entry.siblings.length\"\n\t\t\t\t\t\tclass=\"cn-timeline-manage__siblings\"\n\t\t\t\t\t\tdata-testid=\"cn-timeline-siblings\">\n\t\t\t\t\t\t{{ n('nextcloud-vue', 'Also written on %n other record', 'Also written on %n other records', entry.siblings.length) }}\n\t\t\t\t\t</p>\n\n\t\t\t\t\t<div v-if=\"canManage && !entry.isRead\" class=\"cn-timeline-manage__actions\">\n\t\t\t\t\t\t<NcButton variant=\"tertiary\"\n\t\t\t\t\t\t\t:data-testid=\"'cn-timeline-pin-' + entry.id\"\n\t\t\t\t\t\t\t@click=\"togglePin(entry)\">\n\t\t\t\t\t\t\t{{ entry.pinned ? t('nextcloud-vue', 'Unpin') : t('nextcloud-vue', 'Pin') }}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t\t<NcButton v-for=\"action in actionsFor(entry)\"\n\t\t\t\t\t\t\t:key=\"action.id\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t:data-testid=\"'cn-timeline-action-' + action.id + '-' + entry.id\"\n\t\t\t\t\t\t\t@click=\"openAction(action, entry)\">\n\t\t\t\t\t\t\t{{ translate(action.label) }}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t\t<NcButton v-if=\"entry.followUp === 'open'\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t:data-testid=\"'cn-timeline-followup-' + entry.id\"\n\t\t\t\t\t\t\t@click=\"closeFollowUp(entry)\">\n\t\t\t\t\t\t\t{{ t('nextcloud-vue', 'Mark as answered') }}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t</ul>\n\n\t\t\t<div v-if=\"(!loading && !error && allEntries.length > 0) || auditTrailLinkLabel || readsToggleLabel\"\n\t\t\t\tclass=\"cn-timeline-manage__footer\">\n\t\t\t\t<p v-if=\"!loading && !error && allEntries.length > 0\"\n\t\t\t\t\tclass=\"cn-timeline-manage__count\"\n\t\t\t\t\tdata-testid=\"cn-timeline-count\">\n\t\t\t\t\t{{ countLine }}\n\t\t\t\t</p>\n\t\t\t\t<NcCheckboxRadioSwitch v-if=\"readsToggleLabel && readsAllowed\"\n\t\t\t\t\tv-model=\"includeReads\"\n\t\t\t\t\tdata-testid=\"cn-timeline-include-reads\"\n\t\t\t\t\t@update:modelValue=\"load\">\n\t\t\t\t\t{{ readsToggleLabel }}\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t\t<NcButton v-if=\"auditTrailLinkLabel\"\n\t\t\t\t\tvariant=\"tertiary-no-background\"\n\t\t\t\t\tclass=\"cn-timeline-manage__audit-link\"\n\t\t\t\t\tdata-testid=\"cn-timeline-audit-link\"\n\t\t\t\t\t@click=\"openAuditTrail\">\n\t\t\t\t\t{{ auditTrailLinkLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</template>\n\n\t\t<div v-if=\"composerOnly && canManage && composerEnabled\"\n\t\t\tclass=\"cn-timeline-manage__header\"\n\t\t\tdata-testid=\"cn-timeline-composer-heading\">\n\t\t\t<div class=\"cn-timeline-manage__heading\">\n\t\t\t\t<h3 class=\"cn-timeline-manage__title\">\n\t\t\t\t\t{{ composerTitleText }}\n\t\t\t\t</h3>\n\t\t\t\t<p class=\"cn-timeline-manage__subtitle\">\n\t\t\t\t\t{{ composerSubtitleText }}\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<NcNoteCard v-if=\"composerOnly && error\" type=\"error\" data-testid=\"cn-timeline-error\">\n\t\t\t{{ error }}\n\t\t</NcNoteCard>\n\n\t\t<form v-if=\"canManage && composerEnabled\"\n\t\t\tref=\"composer\"\n\t\t\tclass=\"cn-timeline-manage__composer\"\n\t\t\tdata-testid=\"cn-timeline-composer\"\n\t\t\t@submit.prevent=\"submit\">\n\t\t\t<template v-if=\"!composerOnly\">\n\t\t\t\t<h3 class=\"cn-timeline-manage__composer-title\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Add note') }}\n\t\t\t\t</h3>\n\t\t\t\t<p class=\"cn-timeline-manage__composer-hint\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Goes on the timeline above, internal unless you make it visible') }}\n\t\t\t\t</p>\n\t\t\t</template>\n\t\t\t<label v-if=\"textBlocks.length\" class=\"cn-timeline-manage__draft-label\" :for=\"blockId\">\n\t\t\t\t{{ t('nextcloud-vue', 'Template') }}\n\t\t\t</label>\n\t\t\t<NcSelect v-if=\"textBlocks.length\"\n\t\t\t\tv-model=\"chosenBlock\"\n\t\t\t\tclass=\"cn-timeline-manage__filter\"\n\t\t\t\t:options=\"blockOptions\"\n\t\t\t\t:clearable=\"true\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\t:inputId=\"blockId\"\n\t\t\t\t:labelOutside=\"true\"\n\t\t\t\t:ariaLabelCombobox=\"t('nextcloud-vue', 'Template')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Write your own')\"\n\t\t\t\tdata-testid=\"cn-timeline-block\"\n\t\t\t\t@update:modelValue=\"pickBlock\" />\n\n\t\t\t<label class=\"cn-timeline-manage__draft-label\" :for=\"draftId\">\n\t\t\t\t{{ t('nextcloud-vue', 'Note') }}\n\t\t\t</label>\n\t\t\t<textarea :id=\"draftId\"\n\t\t\t\tv-model=\"draft\"\n\t\t\t\tclass=\"cn-timeline-manage__draft\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Write a note on this record')\"\n\t\t\t\tdata-testid=\"cn-timeline-draft\" />\n\n\t\t\t<div class=\"cn-timeline-manage__composer-foot\">\n\t\t\t\t<NcCheckboxRadioSwitch v-model=\"draftIsPublic\" data-testid=\"cn-timeline-draft-public\">\n\t\t\t\t\t{{ publicLabel }}\n\t\t\t\t</NcCheckboxRadioSwitch>\n\n\t\t\t\t<NcButton variant=\"primary\"\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t:disabled=\"saving || !draft.trim()\"\n\t\t\t\t\tdata-testid=\"cn-timeline-save\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Add it to the timeline') }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</form>\n\n\t\t<component :is=\"activeModal.component\"\n\t\t\tv-if=\"activeModal\"\n\t\t\tv-bind=\"activeModal.props\"\n\t\t\tv-on=\"activeModal.listeners\" />\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'\nimport { translatePlural as n, translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcCheckboxRadioSwitch, NcEmptyContent, NcLoadingIcon, NcNoteCard, NcSelect } from '@nextcloud/vue'\nimport Download from 'vue-material-design-icons/Download.vue'\nimport Plus from 'vue-material-design-icons/Plus.vue'\nimport { prefixUrl } from '../../utils/headers.js'\n\nlet instanceCount = 0\n\n/** The kind of a read row (`readsToggle`), never a kind OpenRegister declares. */\nconst READ_KIND = 'cn-read'\n\n/** Event-bus channel: a note was added to an object's timeline (`{ objectId, source }`). */\nconst TIMELINE_CHANGED = 'cn:timeline:changed'\n\n/** Event-bus channel: the list's \"Add note\" asks the separate form card to take focus (`{ objectId }`). */\nconst TIMELINE_COMPOSE = 'cn:timeline:compose'\n\n/**\n * Read a dotted path off a value.\n *\n * @param {object} value The value.\n * @param {string} path The path.\n * @return {unknown} What is there, or undefined.\n */\nfunction readPath(value, path) {\n\treturn String(path).split('.').reduce((at, key) => (at === null || at === undefined ? undefined : at[key]), value)\n}\n\nexport default {\n\tname: 'CnTimelineManage',\n\n\tcomponents: { Download, NcButton, NcCheckboxRadioSwitch, NcEmptyContent, NcLoadingIcon, NcNoteCard, NcSelect, Plus },\n\n\tinject: {\n\t\t/** The app's component registry; entry actions resolve their modal here. */\n\t\tcnRegistry: { default: () => ({}) },\n\t\t/** Consumer translation function; manifest labels are authored in English. */\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** The page's object sidebar channel; the audit trail link opens its tab. */\n\t\tobjectSidebarState: { default: null },\n\t},\n\n\tprops: {\n\t\t/** Register slug. */\n\t\tregister: { type: String, default: '' },\n\t\t/** Schema slug. */\n\t\tschema: { type: String, default: '' },\n\t\t/** The object's id. */\n\t\tobjectId: { type: String, default: '' },\n\t\t/** OpenRegister API base. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t\t/**\n\t\t * The widget content: `{ title?, subtitle?, publicLabel?, exportName?,\n\t\t * composer?, textBlocks?, entryActions?, auditTrailLink? }`.\n\t\t * `composer`: `true` (default) draws the note form under the list,\n\t\t * `false` none, `\"separate\"` none but keeps the \"Add note\" button,\n\t\t * which brings a `\"only\"` instance (the form alone, a card of its own\n\t\t * in a stack) into view; a note saved there reloads the list.\n\t\t * `readsToggle` (`true` or a label) adds a footer switch, off by\n\t\t * default, that puts who read the record (its audit trail's reads)\n\t\t * among the entries; the count then says \"changes only\" while it is off.\n\t\t * `auditTrailLink` (`true` or a label) draws a footer link that opens\n\t\t * the object sidebar on its audit trail tab, `auditTrailTab` when the\n\t\t * page declares that tab under its own id.\n\t\t */\n\t\tcontent: { type: Object, default: () => ({}) },\n\t},\n\n\tdata() {\n\t\tinstanceCount += 1\n\t\treturn {\n\t\t\tuid: instanceCount,\n\t\t\tallEntries: [],\n\t\t\tentries: [],\n\t\t\tkinds: [],\n\t\t\tloading: false,\n\t\t\terror: '',\n\t\t\tcanManage: false,\n\t\t\tkindFilter: null,\n\t\t\tvisibilityFilter: null,\n\t\t\ttextBlocks: [],\n\t\t\tchosenBlock: null,\n\t\t\tdraft: '',\n\t\t\tdraftIsPublic: false,\n\t\t\tsaving: false,\n\t\t\tactiveModal: null,\n\t\t\t/** Whether the list also shows who read the record (`readsToggle`). */\n\t\t\tincludeReads: false,\n\t\t\t/** Whether OpenRegister gives this reader read entries (`readEventsVisible`); null until asked. */\n\t\t\treadsAllowed: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\ttitleText() {\n\t\t\treturn this.content.title ? this.translate(this.content.title) : t('nextcloud-vue', 'History')\n\t\t},\n\n\t\tsubtitleText() {\n\t\t\treturn this.content.subtitle ? this.translate(this.content.subtitle) : t('nextcloud-vue', 'What happened, who did it and when, newest first')\n\t\t},\n\n\t\t/** @return {string} The title of the note form's own card (`composer: \"only\"`): `content.title`, else Add note. */\n\t\tcomposerTitleText() {\n\t\t\treturn this.content.title ? this.translate(this.content.title) : t('nextcloud-vue', 'Add note')\n\t\t},\n\n\t\t/** @return {string} The line under that title: `content.subtitle`, else where the note goes. */\n\t\tcomposerSubtitleText() {\n\t\t\treturn this.content.subtitle ? this.translate(this.content.subtitle) : t('nextcloud-vue', 'Goes on the timeline above, internal unless you make it visible')\n\t\t},\n\n\t\tpublicLabel() {\n\t\t\treturn this.content.publicLabel ? this.translate(this.content.publicLabel) : t('nextcloud-vue', 'Visible to the requester')\n\t\t},\n\n\t\t/**\n\t\t * The audit trail link's words, or '' when it is not drawn.\n\t\t *\n\t\t * @spec openspec/changes/timeline-audit-trail-link/specs/timeline/spec.md#requirement-the-manage-timeline-can-point-at-the-audit-trail-in-the-sidebar\n\t\t * @return {string}\n\t\t */\n\t\tauditTrailLinkLabel() {\n\t\t\tconst link = this.content.auditTrailLink\n\t\t\tif (!link || !this.objectSidebarState) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn typeof link === 'string' ? this.translate(link) : t('nextcloud-vue', 'Full audit trail in the sidebar')\n\t\t},\n\n\t\t/**\n\t\t * Whether this instance draws the note form: inline (`composer` true or\n\t\t * unset) or as the whole widget (`\"only\"`).\n\t\t *\n\t\t * @spec openspec/changes/timeline-composer-card/specs/timeline/spec.md#requirement-the-note-form-can-be-its-own-card\n\t\t * @return {boolean}\n\t\t */\n\t\tcomposerEnabled() {\n\t\t\treturn this.content.composer !== false && this.content.composer !== 'separate'\n\t\t},\n\n\t\t/**\n\t\t * The words of the \"also who read it\" switch, or '' when the widget\n\t\t * does not offer it (`readsToggle`: true or a label).\n\t\t *\n\t\t * @spec openspec/changes/timeline-reads-toggle/specs/timeline/spec.md#requirement-the-history-can-show-who-read-the-record\n\t\t * @return {string}\n\t\t */\n\t\treadsToggleLabel() {\n\t\t\tconst toggle = this.content.readsToggle\n\t\t\tif (!toggle) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn typeof toggle === 'string' ? this.translate(toggle) : t('nextcloud-vue', 'Also who read it')\n\t\t},\n\n\t\t/**\n\t\t * \"3 of 10 events\", and \", changes only\" while reads can be shown but are not.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tcountLine() {\n\t\t\tconst values = { shown: this.entries.length, total: this.allEntries.length }\n\t\t\treturn this.readsToggleLabel && this.readsAllowed && !this.includeReads\n\t\t\t\t? t('nextcloud-vue', '{shown} of {total} events, changes only', values)\n\t\t\t\t: t('nextcloud-vue', '{shown} of {total} events', values)\n\t\t},\n\n\t\t/**\n\t\t * Whether the visibility filter shows its \"Visibility\" label. With\n\t\t * `visibilityLabel: false` it keeps only its accessible name and the\n\t\t * select reads \"Internal and public\" on its own (board DqZaakHistorie).\n\t\t *\n\t\t * @spec openspec/changes/timeline-visibility-filter-unlabelled/specs/timeline/spec.md#requirement-the-visibility-filter-can-go-without-a-visible-label\n\t\t * @return {boolean}\n\t\t */\n\t\tvisibilityLabelShown() {\n\t\t\treturn this.content.visibilityLabel !== false\n\t\t},\n\n\t\t/** @return {boolean} The widget is the note form alone (`composer: \"only\"`), a card of its own beside the list. */\n\t\tcomposerOnly() {\n\t\t\treturn this.content.composer === 'only'\n\t\t},\n\n\t\t/** @return {boolean} The list draws no form; its \"Add note\" brings the separate form card into view (`composer: \"separate\"`). */\n\t\tcomposerSeparate() {\n\t\t\treturn this.content.composer === 'separate'\n\t\t},\n\n\t\tdraftId() {\n\t\t\treturn `cn-timeline-draft-${this.uid}`\n\t\t},\n\n\t\tblockId() {\n\t\t\treturn `cn-timeline-block-${this.uid}`\n\t\t},\n\n\t\t/**\n\t\t * The kind options, the plain note first. A note is an entry with NO\n\t\t * kind, so \"Note\" filters on its absence.\n\t\t *\n\t\t * @return {Array<object>} The options.\n\t\t */\n\t\tkindOptions() {\n\t\t\tconst options = [{ id: '', label: t('nextcloud-vue', 'Note') }].concat(this.kinds.map((kind) => ({ id: kind.slug, label: kind.title || kind.slug })))\n\t\t\treturn this.includeReads ? options.concat([{ id: READ_KIND, label: t('nextcloud-vue', 'Viewed') }]) : options\n\t\t},\n\n\t\t/**\n\t\t * All, then every kind the object has entries of, each with its count.\n\t\t *\n\t\t * @spec openspec/changes/timeline-all-chip-host-label/specs/timeline/spec.md#requirement-the-timelines-all-chip-reads-the-hosts-word\n\t\t * @return {Array<object>} The chips.\n\t\t */\n\t\tkindChips() {\n\t\t\tconst chosen = this.kindFilter ? (this.kindFilter.id || '') : null\n\t\t\tconst counts = new Map()\n\t\t\tfor (const entry of this.allEntries) {\n\t\t\t\tconst kind = entry.kind || ''\n\t\t\t\tcounts.set(kind, (counts.get(kind) || 0) + 1)\n\t\t\t}\n\t\t\t// The host's word first, as its own filter chips read (\"Alles\"), then the library's.\n\t\t\tconst hostAll = typeof this.cnTranslate === 'function' ? this.cnTranslate('All') : 'All'\n\t\t\tconst allLabel = typeof hostAll === 'string' && hostAll !== '' && hostAll !== 'All' ? hostAll : t('nextcloud-vue', 'All')\n\t\t\tconst chips = [{ key: 'all', id: null, label: allLabel, count: this.allEntries.length, active: chosen === null }]\n\t\t\tfor (const option of this.kindOptions) {\n\t\t\t\tconst count = counts.get(option.id) || 0\n\t\t\t\tif (count > 0) {\n\t\t\t\t\tchips.push({ key: option.id || 'note', id: option.id, label: option.label, count, active: chosen === option.id })\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn chips\n\t\t},\n\n\t\tblockOptions() {\n\t\t\treturn this.textBlocks.map((block) => ({ id: block.slug, label: block.title || block.slug }))\n\t\t},\n\n\t\tvisibilityOptions() {\n\t\t\treturn [\n\t\t\t\t{ id: 'internal', label: t('nextcloud-vue', 'Internal only') },\n\t\t\t\t{ id: 'public', label: this.publicLabel },\n\t\t\t]\n\t\t},\n\n\t\tbase() {\n\t\t\treturn this.apiBase.replace(/\\/$/, '')\n\t\t},\n\n\t\ttimelineUrl() {\n\t\t\tif (!this.objectId || !this.register || !this.schema) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn prefixUrl(`${this.base}/objects/${this.register}/${this.schema}/${this.objectId}/timeline`)\n\t\t},\n\n\t\tentryActions() {\n\t\t\treturn Array.isArray(this.content.entryActions) ? this.content.entryActions.filter((action) => action && action.id) : []\n\t\t},\n\t},\n\n\twatch: {\n\t\tobjectId: 'load',\n\t},\n\n\tcreated() {\n\t\tthis.onTimelineChanged = (payload) => {\n\t\t\tif (!payload || payload.objectId !== this.objectId || payload.source === this.uid || this.composerOnly) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.load()\n\t\t}\n\t\tthis.onComposeRequested = (payload) => {\n\t\t\tif (this.composerOnly && payload && payload.objectId === this.objectId) {\n\t\t\t\tthis.focusComposer()\n\t\t\t}\n\t\t}\n\t\tsubscribe(TIMELINE_CHANGED, this.onTimelineChanged)\n\t\tsubscribe(TIMELINE_COMPOSE, this.onComposeRequested)\n\t},\n\n\tbeforeUnmount() {\n\t\tunsubscribe(TIMELINE_CHANGED, this.onTimelineChanged)\n\t\tunsubscribe(TIMELINE_COMPOSE, this.onComposeRequested)\n\t},\n\n\tmounted() {\n\t\tthis.loadKinds()\n\t\tif (this.content.textBlocks !== false) {\n\t\t\tthis.loadTextBlocks()\n\t\t}\n\t\tthis.load()\n\t},\n\n\tmethods: {\n\t\tt,\n\t\tn,\n\n\t\ttranslate(text) {\n\t\t\treturn text ? this.cnTranslate(text) : ''\n\t\t},\n\n\t\t/** Read the declared kinds, so the filter names them as administered. */\n\t\tasync loadKinds() {\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(prefixUrl(`${this.base}/timeline/kinds`))\n\t\t\t\tthis.kinds = response.data?.results || []\n\t\t\t} catch {\n\t\t\t\tthis.kinds = []\n\t\t\t}\n\t\t},\n\n\t\t/** Read the seeded standard notes. */\n\t\tasync loadTextBlocks() {\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(prefixUrl(`${this.base}/timeline/text-blocks`))\n\t\t\t\tthis.textBlocks = response.data?.results || []\n\t\t\t} catch {\n\t\t\t\tthis.textBlocks = []\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Note which standard note was picked. The BLOCK is sent, not its body:\n\t\t * OpenRegister fills the object's own values into it on the way in.\n\t\t *\n\t\t * @param {object|null} block The picked option.\n\t\t */\n\t\tpickBlock(block) {\n\t\t\tthis.chosenBlock = block || null\n\t\t\tif (block) {\n\t\t\t\tconst declared = this.textBlocks.find((entry) => entry.slug === block.id)\n\t\t\t\tthis.draft = declared?.title || block.label\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Write the drafted note onto this object.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync submit() {\n\t\t\tif (!this.draft.trim() || !this.timelineUrl) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst payload = { visibility: this.draftIsPublic ? 'public' : 'internal' }\n\t\t\t\tif (this.chosenBlock?.id) {\n\t\t\t\t\tpayload.textBlock = this.chosenBlock.id\n\t\t\t\t} else {\n\t\t\t\t\tpayload.message = this.draft\n\t\t\t\t}\n\t\t\t\tawait axios.post(this.timelineUrl, payload)\n\t\t\t\tthis.draft = ''\n\t\t\t\tthis.chosenBlock = null\n\t\t\t\tthis.draftIsPublic = false\n\t\t\t\temit(TIMELINE_CHANGED, { objectId: this.objectId, source: this.uid })\n\t\t\t\tawait this.load()\n\t\t\t} catch {\n\t\t\t\tthis.error = t('nextcloud-vue', 'That note could not be saved.')\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Read the timeline with the visibility filter, if one is set.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync load() {\n\t\t\tif (!this.timelineUrl) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst params = {}\n\t\t\t\tif (this.visibilityFilter?.id) {\n\t\t\t\t\tparams.visibility = this.visibilityFilter.id\n\t\t\t\t}\n\t\t\t\tconst response = await axios.get(this.timelineUrl, { params })\n\t\t\t\tthis.canManage = response.data?.canManage === true\n\t\t\t\tconst entries = response.data?.results || []\n\t\t\t\tif (this.readsToggleLabel && this.readsAllowed === null) {\n\t\t\t\t\tawait this.readEntries()\n\t\t\t\t}\n\t\t\t\tthis.allEntries = this.readsToggleLabel && this.readsAllowed && this.includeReads ? this.withReads(entries, await this.readEntries()) : entries\n\t\t\t\tthis.entries = this.applyKindFilter(this.allEntries)\n\t\t\t} catch {\n\t\t\t\tthis.allEntries = []\n\t\t\t\tthis.entries = []\n\t\t\t\tthis.error = t('nextcloud-vue', 'The timeline could not be read. Try again, or ask an administrator to check OpenRegister.')\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Who read the record, from its audit trail (`action=read`), as timeline\n\t\t * rows. OpenRegister gives read entries only to the groups named for\n\t\t * them and says so in `readEventsVisible`, which decides whether the\n\t\t * switch is offered at all; a read it refuses or that fails leaves the\n\t\t * reads out and offers no switch.\n\t\t *\n\t\t * @spec openspec/changes/timeline-reads-toggle/specs/timeline/spec.md#requirement-the-history-can-show-who-read-the-record\n\t\t * @return {Promise<Array<object>>} The read rows.\n\t\t */\n\t\tasync readEntries() {\n\t\t\ttry {\n\t\t\t\tconst url = prefixUrl(`${this.base}/objects/${this.register}/${this.schema}/${this.objectId}/audit-trails`)\n\t\t\t\tconst response = await axios.get(url, { params: { action: 'read', limit: 50 } })\n\t\t\t\tthis.readsAllowed = response.data?.readEventsVisible === true\n\t\t\t\tif (!this.readsAllowed) {\n\t\t\t\t\treturn []\n\t\t\t\t}\n\t\t\t\tconst list = response.data?.results || []\n\t\t\t\treturn list\n\t\t\t\t\t.filter((entry) => String(entry.action || '').toLowerCase() === 'read')\n\t\t\t\t\t.map((entry) => ({\n\t\t\t\t\t\tid: `read-${entry.id}`,\n\t\t\t\t\t\tkind: READ_KIND,\n\t\t\t\t\t\tisRead: true,\n\t\t\t\t\t\tauthor: entry.actorDisplayName || entry.userName || entry.user || '',\n\t\t\t\t\t\tcreated: entry.created || entry.creationDateTime || '',\n\t\t\t\t\t\tmessage: t('nextcloud-vue', 'Opened the record'),\n\t\t\t\t\t}))\n\t\t\t} catch {\n\t\t\t\tthis.readsAllowed = false\n\t\t\t\treturn []\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The timeline's entries with the reads among them, newest first; the\n\t\t * pinned entries stay on top.\n\t\t *\n\t\t * @param {Array<object>} entries The timeline's entries.\n\t\t * @param {Array<object>} reads The read rows.\n\t\t * @return {Array<object>} The merged list.\n\t\t */\n\t\twithReads(entries, reads) {\n\t\t\tconst time = (entry) => new Date(entry.created || 0).getTime() || 0\n\t\t\tconst pinned = entries.filter((entry) => entry.pinned)\n\t\t\tconst rest = [...entries.filter((entry) => !entry.pinned), ...reads].sort((a, b) => time(b) - time(a))\n\t\t\treturn [...pinned, ...rest]\n\t\t},\n\n\t\t/**\n\t\t * Show one kind, or every kind for `null`, without reading again.\n\t\t *\n\t\t * @param {string|null} id The kind slug, '' for a note, null for all.\n\t\t */\n\t\tchooseKind(id) {\n\t\t\tthis.kindFilter = id === null ? null : { id }\n\t\t\tthis.entries = this.applyKindFilter(this.allEntries)\n\t\t},\n\n\t\t/**\n\t\t * The kind filter is applied in the reading: the list endpoint does not\n\t\t * read a kind parameter, so sending one would be dropped in silence.\n\t\t *\n\t\t * @param {Array<object>} results The entries as read.\n\t\t * @return {Array<object>} The entries to show.\n\t\t */\n\t\tapplyKindFilter(results) {\n\t\t\tif (!this.kindFilter) {\n\t\t\t\treturn results\n\t\t\t}\n\t\t\tconst wanted = this.kindFilter.id || ''\n\t\t\treturn results.filter((entry) => (entry.kind || '') === wanted)\n\t\t},\n\n\t\t/**\n\t\t * The shown entries as CSV: when, kind, who, visibility and what.\n\t\t *\n\t\t * @return {string} The CSV text.\n\t\t */\n\t\tentriesCsv() {\n\t\t\tconst cell = (value) => `\"${String(value ?? '').replace(/\"/g, '\"\"')}\"`\n\t\t\tconst rows = [[t('nextcloud-vue', 'When'), t('nextcloud-vue', 'Kind'), t('nextcloud-vue', 'Who'), t('nextcloud-vue', 'Visibility'), t('nextcloud-vue', 'Message')]]\n\t\t\tfor (const entry of this.entries) {\n\t\t\t\trows.push([entry.created, this.kindLabel(entry), entry.author, entry.visibility, entry.message])\n\t\t\t}\n\t\t\treturn rows.map((row) => row.map(cell).join(',')).join('\\r\\n')\n\t\t},\n\n\t\t/** Download the shown entries as a CSV file. */\n\t\texportEntries() {\n\t\t\tconst blob = new Blob([this.entriesCsv()], { type: 'text/csv;charset=utf-8' })\n\t\t\tconst url = URL.createObjectURL(blob)\n\t\t\tconst link = document.createElement('a')\n\t\t\tlink.href = url\n\t\t\tlink.download = `${this.content.exportName || 'history'}-${this.objectId || 'record'}.csv`\n\t\t\tdocument.body.appendChild(link)\n\t\t\tlink.click()\n\t\t\tlink.remove()\n\t\t\tURL.revokeObjectURL(url)\n\t\t},\n\n\t\t/**\n\t\t * Open the object sidebar on its audit trail tab.\n\t\t *\n\t\t * @spec openspec/changes/timeline-audit-trail-link/specs/timeline/spec.md#requirement-the-manage-timeline-can-point-at-the-audit-trail-in-the-sidebar\n\t\t */\n\t\topenAuditTrail() {\n\t\t\tthis.objectSidebarState.open = true\n\t\t\tthis.objectSidebarState.requestedTab = this.content.auditTrailTab || 'auditTrail'\n\t\t},\n\n\t\t/** Bring the composer into view and focus its text; a separate form card is asked to do so. */\n\t\tfocusComposer() {\n\t\t\tif (this.composerSeparate) {\n\t\t\t\temit(TIMELINE_COMPOSE, { objectId: this.objectId })\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst form = this.$refs.composer\n\t\t\tif (!form) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tform.scrollIntoView?.({ behavior: 'smooth', block: 'center' })\n\t\t\tform.querySelector('textarea')?.focus()\n\t\t},\n\n\t\t/**\n\t\t * The label of one entry's kind, falling back to \"Note\".\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The label.\n\t\t */\n\t\tkindLabel(entry) {\n\t\t\tif (entry.kind === READ_KIND) {\n\t\t\t\treturn t('nextcloud-vue', 'Viewed')\n\t\t\t}\n\t\t\tif (!entry.kind) {\n\t\t\t\treturn t('nextcloud-vue', 'Note')\n\t\t\t}\n\t\t\tconst declared = this.kinds.find((kind) => kind.slug === entry.kind)\n\t\t\treturn declared?.title || entry.kind\n\t\t},\n\n\t\t/**\n\t\t * One moment in the reader's locale.\n\t\t *\n\t\t * @param {string} value An ISO 8601 stamp.\n\t\t * @return {string} The moment, or the raw value.\n\t\t */\n\t\tmoment(value) {\n\t\t\tif (!value) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst parsed = new Date(value)\n\t\t\treturn isNaN(parsed.getTime()) ? value : parsed.toLocaleString()\n\t\t},\n\n\t\tasync togglePin(entry) {\n\t\t\tawait this.patch(entry, { pinned: !entry.pinned })\n\t\t},\n\n\t\tasync closeFollowUp(entry) {\n\t\t\tawait this.patch(entry, { followUp: 'done' })\n\t\t},\n\n\t\t/**\n\t\t * Write one change onto one entry and read the timeline back (pinning\n\t\t * changes the order, so patching in place would look like nothing).\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @param {object} changes The fields to write.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync patch(entry, changes) {\n\t\t\ttry {\n\t\t\t\tawait axios.patch(`${this.timelineUrl}/${entry.id}`, changes)\n\t\t\t\tawait this.load()\n\t\t\t} catch {\n\t\t\t\tthis.error = t('nextcloud-vue', 'That change could not be saved.')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The configured entry actions that apply to one entry (`kinds` limits\n\t\t * an action to entries of those kinds).\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {Array<object>} The actions.\n\t\t */\n\t\tactionsFor(entry) {\n\t\t\treturn this.entryActions.filter((action) => !Array.isArray(action.kinds) || action.kinds.includes(entry.kind || ''))\n\t\t},\n\n\t\t/**\n\t\t * Resolve `@objectId` and `@row.<path>` tokens in an action's props.\n\t\t *\n\t\t * @param {object} props The props as declared.\n\t\t * @param {object} entry The entry.\n\t\t * @return {object} The resolved props.\n\t\t */\n\t\tresolveProps(props, entry) {\n\t\t\tconst out = {}\n\t\t\tfor (const [key, value] of Object.entries(props || {})) {\n\t\t\t\tif (value === '@objectId') {\n\t\t\t\t\tout[key] = this.objectId\n\t\t\t\t} else if (typeof value === 'string' && value.startsWith('@row.')) {\n\t\t\t\t\tconst found = readPath(entry, value.slice('@row.'.length))\n\t\t\t\t\tout[key] = found === undefined || found === null ? '' : found\n\t\t\t\t} else {\n\t\t\t\t\tout[key] = value\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/**\n\t\t * Open an entry action's modal from the app's registry. On its\n\t\t * `doneEvent` (default `done`) the entry's open follow-up is closed when\n\t\t * the action says so; otherwise the timeline is read again.\n\t\t *\n\t\t * @param {object} action The action.\n\t\t * @param {object} entry The entry.\n\t\t */\n\t\topenAction(action, entry) {\n\t\t\tconst registered = (this.cnRegistry || {})[action.modal]\n\t\t\tconst component = registered && (registered.component || registered)\n\t\t\tif (!component) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.warn(`[CnTimelineWidget] entry action \"${action.id}\" names modal \"${action.modal}\", which the registry does not hold.`)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst close = () => {\n\t\t\t\tthis.activeModal = null\n\t\t\t}\n\t\t\tconst done = async () => {\n\t\t\t\tthis.activeModal = null\n\t\t\t\tif (action.closesFollowUp === true && entry.followUp === 'open') {\n\t\t\t\t\tawait this.closeFollowUp(entry)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tawait this.load()\n\t\t\t}\n\t\t\tthis.activeModal = {\n\t\t\t\tcomponent,\n\t\t\t\tprops: this.resolveProps(action.props, entry),\n\t\t\t\tlisteners: { [action.doneEvent || 'done']: done, close },\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-timeline-manage__header {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tjustify-content: space-between;\n\tgap: 12px;\n\tmargin-block-end: 16px;\n}\n\n.cn-timeline-manage__heading {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.cn-timeline-manage__header-actions {\n\tdisplay: flex;\n\tgap: 8px;\n}\n\n.cn-timeline-manage__title {\n\tmargin: 0;\n\tfont-size: 17px;\n\tfont-weight: 700;\n\tline-height: 1.2;\n}\n\n.cn-timeline-manage__subtitle {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 14px;\n}\n\n.cn-timeline-manage__chips {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tmargin-block-end: 12px;\n}\n\n.cn-timeline-manage__chip {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 8px;\n\tbox-sizing: border-box;\n\theight: 36px;\n\tpadding: 0 12px;\n\tborder: 1px solid var(--color-border-dark);\n\tborder-radius: 18px;\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tcursor: pointer;\n}\n\n/* The chosen kind is a filled chip with no outline. */\n.cn-timeline-manage__chip--active {\n\tborder: 0;\n\tbackground: var(--color-main-text);\n\tcolor: var(--color-main-background);\n}\n\n.cn-timeline-manage__chip-count {\n\tpadding: 1px 7px;\n\tborder-radius: 10px;\n\tbackground: var(--color-border);\n\tcolor: var(--color-main-text);\n\tfont-size: 12px;\n}\n\n/* On the filled chip the count is a lighter ink bubble with light text. */\n.cn-timeline-manage__chip--active .cn-timeline-manage__chip-count {\n\tbackground: color-mix(in srgb, var(--color-main-background) 18%, var(--color-main-text));\n\tcolor: var(--color-main-background);\n}\n\n.cn-timeline-manage__footer {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n\tmargin: 12px 0 0;\n}\n\n.cn-timeline-manage__count {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-timeline-manage__composer {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tmargin-block-start: 24px;\n\tpadding-block-start: 16px;\n\tborder-block-start: 1px solid var(--color-border);\n}\n\n.cn-timeline-manage--composer-only .cn-timeline-manage__composer {\n\tmargin-block-start: 0;\n\tpadding-block-start: 0;\n\tborder-block-start: none;\n}\n\n/* The checkbox at the start, the button at the end, as one row. */\n.cn-timeline-manage__composer-foot {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n}\n\n.cn-timeline-manage__composer-title {\n\tmargin: 0;\n\tfont-size: 16px;\n\tfont-weight: bold;\n}\n\n.cn-timeline-manage__composer-hint {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-timeline-manage__draft-label {\n\tfont-weight: bold;\n}\n\n.cn-timeline-manage__draft {\n\twidth: 100%;\n\tmin-height: 70px;\n}\n\n.cn-timeline-manage__controls {\n\tdisplay: flex;\n\tgap: 12px;\n\tflex-wrap: wrap;\n\tmargin-block-end: 12px;\n}\n\n.cn-timeline-manage__filter {\n\tmin-width: 200px;\n}\n\n.cn-timeline-manage__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.cn-timeline-manage__entry {\n\tdisplay: flex;\n\tflex-direction: column;\n\tborder-block-end: 1px solid var(--color-border);\n\tpadding-block: 12px;\n}\n\n.cn-timeline-manage__entry--pinned {\n\tborder-inline-start: 3px solid var(--color-primary-element);\n\tpadding-inline-start: 8px;\n}\n\n/* The message comes first in the markup (a reader hears what happened\n before who and when); this look shows the head above it. */\n.cn-timeline-manage__head {\n\torder: -1;\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\talign-items: baseline;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-timeline-manage__kind {\n\tfont-weight: bold;\n\tcolor: var(--color-main-text);\n}\n\n.cn-timeline-manage__badge {\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 0 6px;\n}\n\n.cn-timeline-manage__badge--open {\n\tborder-color: var(--color-warning);\n\tcolor: var(--color-warning-text);\n}\n\n.cn-timeline-manage__message {\n\tmargin-block: 4px 0;\n\twhite-space: pre-wrap;\n}\n\n.cn-timeline-manage__siblings {\n\tmargin-block: 4px 0;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-timeline-manage__actions {\n\tdisplay: flex;\n\tgap: 8px;\n\tmargin-block-start: 4px;\n}\n</style>\n"],"names":["_createElementBlock","_normalizeClass","_Fragment","_createElementVNode","_toDisplayString","_createBlock","_createVNode","_createTextVNode","_openBlock","_renderList"],"mappings":";;AAuCQ,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,4BAAC,GAAA;AACN,MAAA,UAAA,GAAA,EAAA,KAAI,EAAE,6BAA6B,GAAA;AACnC,MAAA,UAAA,GAAA,EAAA,KAAK,EAAA,2BAAO,GAAA;AAGZ,MAAA,UAAA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AA;AAChB,gBAAA,YAAY,EAAC,IAAG;AAChB,gBAAA,iBAAiB,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,UAAA,CAAA;;AAErB,gBAAA,aAAW,EAAC,mBAAc;;;UAGzBF,kBAEM,CAAA,OAAA,EAAA;AAFD,YAAA,KAAK,EAAC,iCAAmB;AAAA,YAAA,GAAA,EAAA,QAAA,CAAA,OAAA;qCAC3B,CAAA,CAAA,CAAA,eAAA,EAAA,MAAA,CAAA,CAAA,EAAA,CAAA,oBAAA,WAAA,CAAA;yBAELA,kBAIiB,CAAA,UAAA,EAAA;AAJZ,YAAA,EAAA,EAAA,QAAA,CAAA,OAAA;yEACA,KAAA,CAAA,KAAA,IAAA,MAAA,CAAA,CAAA;;AAEH,YAAA,WAAW,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,6BAAA,CAAA;AACf,YAAA,aAAW,EAAC,mBAAI;;yBAHZ,KAAA,CAAA,KAAA,CAAA;;AAKL,UAAAA,kBAAA,QAAA;YACCG;0BAAE,KAAA,CAAA,aAAA;2EAAA,KAAA,CAAA,aAAA,IAAA,MAAA,CAAA,CAAA;AAAA,cAAA,aAAA,EAAA,0BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnTimelineManage.vue3.js","sources":["../../../../src/components/CnTimelineWidget/CnTimelineManage.vue?vue&type=template&id=163187a1&lang.js"],"sourcesContent":["<!--\n SPDX-FileCopyrightText: 2026 Conduction B.V.\n SPDX-License-Identifier: EUPL-1.2\n\n CnTimelineManage — the `manage` mode of CnTimelineWidget: one chronological\n read of OpenRegister's timeline on an object (notes, calls, messages), newest\n first with pinned entries on top, plus what a reader who may manage it can do\n there: filter by kind and visibility, pin, close a follow-up, write a note\n (optionally from a standard text block, optionally visible outside), export\n the shown entries as CSV, and run configured entry actions such as a reply\n dialog.\n\n The list read is filtered by OpenRegister whether or not a filter is asked\n for; the response says whether the reader may manage (`canManage`), and the\n controls are drawn from that rather than guessed. A failed read is not an\n empty history.\n-->\n<template>\n\t<div class=\"cn-timeline-manage\"\n\t\t:class=\"{ 'cn-timeline-manage--composer-only': composerOnly }\"\n\t\tdata-testid=\"cn-timeline-manage\">\n\t\t<template v-if=\"!composerOnly\">\n\t\t\t<div class=\"cn-timeline-manage__header\">\n\t\t\t\t<div class=\"cn-timeline-manage__heading\">\n\t\t\t\t\t<h3 class=\"cn-timeline-manage__title\">\n\t\t\t\t\t\t{{ titleText }}\n\t\t\t\t\t</h3>\n\t\t\t\t\t<p class=\"cn-timeline-manage__subtitle\">\n\t\t\t\t\t\t{{ subtitleText }}\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"cn-timeline-manage__header-actions\">\n\t\t\t\t\t<NcButton v-if=\"canManage && (composerEnabled || composerSeparate)\"\n\t\t\t\t\t\tdata-testid=\"cn-timeline-add-note\"\n\t\t\t\t\t\t@click=\"focusComposer\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<Plus :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Add note') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t\t<NcButton data-testid=\"cn-timeline-export\" @click=\"exportEntries\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<Download :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Export') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"cn-timeline-manage__chips\"\n\t\t\t\trole=\"group\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Kind')\"\n\t\t\t\tdata-testid=\"cn-timeline-kind-filter\">\n\t\t\t\t<button v-for=\"chip in kindChips\"\n\t\t\t\t\t:key=\"chip.key\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-timeline-manage__chip\"\n\t\t\t\t\t:class=\"{ 'cn-timeline-manage__chip--active': chip.active }\"\n\t\t\t\t\t:aria-pressed=\"chip.active ? 'true' : 'false'\"\n\t\t\t\t\t:data-testid=\"'cn-timeline-chip-' + chip.key\"\n\t\t\t\t\t@click=\"chooseKind(chip.id)\">\n\t\t\t\t\t{{ chip.label }}\n\t\t\t\t\t<span class=\"cn-timeline-manage__chip-count\">{{ chip.count }}</span>\n\t\t\t\t</button>\n\t\t\t</div>\n\n\t\t\t<div class=\"cn-timeline-manage__controls\">\n\t\t\t\t<NcSelect v-if=\"canManage\"\n\t\t\t\t\tv-model=\"visibilityFilter\"\n\t\t\t\t\tclass=\"cn-timeline-manage__filter\"\n\t\t\t\t\t:options=\"visibilityOptions\"\n\t\t\t\t\t:clearable=\"true\"\n\t\t\t\t\tlabel=\"label\"\n\t\t\t\t\t:inputLabel=\"visibilityLabelShown ? t('nextcloud-vue', 'Visibility') : undefined\"\n\t\t\t\t\t:labelOutside=\"!visibilityLabelShown\"\n\t\t\t\t\t:ariaLabelCombobox=\"t('nextcloud-vue', 'Visibility')\"\n\t\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Internal and public')\"\n\t\t\t\t\tdata-testid=\"cn-timeline-visibility-filter\"\n\t\t\t\t\t@update:modelValue=\"load\" />\n\t\t\t</div>\n\n\t\t\t<NcLoadingIcon v-if=\"loading\" :size=\"32\" />\n\n\t\t\t<NcNoteCard v-else-if=\"error\" type=\"error\" data-testid=\"cn-timeline-error\">\n\t\t\t\t{{ error }}\n\t\t\t</NcNoteCard>\n\n\t\t\t<NcEmptyContent v-else-if=\"entries.length === 0\"\n\t\t\t\t:name=\"t('nextcloud-vue', 'Nothing recorded yet')\"\n\t\t\t\t:description=\"t('nextcloud-vue', 'Notes, calls and messages appear here in the order they happened.')\"\n\t\t\t\tdata-testid=\"cn-timeline-empty\" />\n\n\t\t\t<ul v-else class=\"cn-timeline-manage__list\" data-testid=\"cn-timeline-list\">\n\t\t\t\t<li v-for=\"entry in entries\"\n\t\t\t\t\t:key=\"entry.id\"\n\t\t\t\t\tclass=\"cn-timeline-manage__entry\"\n\t\t\t\t\t:class=\"{ 'cn-timeline-manage__entry--pinned': entry.pinned }\"\n\t\t\t\t\t:data-kind=\"entry.kind || 'note'\"\n\t\t\t\t\tdata-testid=\"cn-timeline-entry\">\n\t\t\t\t\t<span v-if=\"kindIcon(entry)\"\n\t\t\t\t\t\tclass=\"cn-timeline-manage__entry-icon\"\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tdata-testid=\"cn-timeline-entry-icon\">\n\t\t\t\t\t\t<CnIcon :name=\"kindIcon(entry)\" :size=\"16\" />\n\t\t\t\t\t</span>\n\t\t\t\t\t<p class=\"cn-timeline-manage__message\">\n\t\t\t\t\t\t{{ entry.message }}<span v-if=\"entryDetail(entry)\" class=\"cn-timeline-manage__detail\">: {{ entryDetail(entry) }}</span>\n\t\t\t\t\t</p>\n\n\t\t\t\t\t<div class=\"cn-timeline-manage__head\">\n\t\t\t\t\t\t<span class=\"cn-timeline-manage__kind\">{{ kindLabel(entry) }}</span>\n\t\t\t\t\t\t<span class=\"cn-timeline-manage__author\">{{ authorName(entry.author) }}</span>\n\t\t\t\t\t\t<span class=\"cn-timeline-manage__moment\">{{ moment(entry.created) }}</span>\n\t\t\t\t\t\t<span v-if=\"entry.visibility === 'public'\"\n\t\t\t\t\t\t\tclass=\"cn-timeline-manage__badge cn-timeline-manage__badge--public\"\n\t\t\t\t\t\t\tdata-testid=\"cn-timeline-public\">\n\t\t\t\t\t\t\t{{ publicLabel }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span v-if=\"entry.followUp === 'open'\"\n\t\t\t\t\t\t\tclass=\"cn-timeline-manage__badge cn-timeline-manage__badge--open\"\n\t\t\t\t\t\t\tdata-testid=\"cn-timeline-followup-open\">\n\t\t\t\t\t\t\t{{ t('nextcloud-vue', 'Needs an answer') }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<p v-if=\"entry.siblings && entry.siblings.length\"\n\t\t\t\t\t\tclass=\"cn-timeline-manage__siblings\"\n\t\t\t\t\t\tdata-testid=\"cn-timeline-siblings\">\n\t\t\t\t\t\t{{ n('nextcloud-vue', 'Also written on %n other record', 'Also written on %n other records', entry.siblings.length) }}\n\t\t\t\t\t</p>\n\n\t\t\t\t\t<div v-if=\"canManage && !entry.isRead\" class=\"cn-timeline-manage__actions\">\n\t\t\t\t\t\t<NcButton variant=\"tertiary\"\n\t\t\t\t\t\t\t:data-testid=\"'cn-timeline-pin-' + entry.id\"\n\t\t\t\t\t\t\t@click=\"togglePin(entry)\">\n\t\t\t\t\t\t\t{{ entry.pinned ? t('nextcloud-vue', 'Unpin') : t('nextcloud-vue', 'Pin') }}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t\t<NcButton v-for=\"action in actionsFor(entry)\"\n\t\t\t\t\t\t\t:key=\"action.id\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t:data-testid=\"'cn-timeline-action-' + action.id + '-' + entry.id\"\n\t\t\t\t\t\t\t@click=\"openAction(action, entry)\">\n\t\t\t\t\t\t\t{{ translate(action.label) }}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t\t<NcButton v-if=\"entry.followUp === 'open'\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t:data-testid=\"'cn-timeline-followup-' + entry.id\"\n\t\t\t\t\t\t\t@click=\"closeFollowUp(entry)\">\n\t\t\t\t\t\t\t{{ t('nextcloud-vue', 'Mark as answered') }}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t</ul>\n\n\t\t\t<div v-if=\"(!loading && !error && allEntries.length > 0) || auditTrailLinkLabel || readsToggleLabel\"\n\t\t\t\tclass=\"cn-timeline-manage__footer\">\n\t\t\t\t<p v-if=\"!loading && !error && allEntries.length > 0\"\n\t\t\t\t\tclass=\"cn-timeline-manage__count\"\n\t\t\t\t\tdata-testid=\"cn-timeline-count\">\n\t\t\t\t\t{{ countLine }}\n\t\t\t\t</p>\n\t\t\t\t<NcCheckboxRadioSwitch v-if=\"readsToggleLabel && readsAllowed\"\n\t\t\t\t\tv-model=\"includeReads\"\n\t\t\t\t\tdata-testid=\"cn-timeline-include-reads\"\n\t\t\t\t\t@update:modelValue=\"load\">\n\t\t\t\t\t{{ readsToggleLabel }}\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t\t<NcButton v-if=\"auditTrailLinkLabel\"\n\t\t\t\t\tvariant=\"tertiary-no-background\"\n\t\t\t\t\tclass=\"cn-timeline-manage__audit-link\"\n\t\t\t\t\tdata-testid=\"cn-timeline-audit-link\"\n\t\t\t\t\t@click=\"openAuditTrail\">\n\t\t\t\t\t{{ auditTrailLinkLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</template>\n\n\t\t<div v-if=\"composerOnly && canManage && composerEnabled\"\n\t\t\tclass=\"cn-timeline-manage__header\"\n\t\t\tdata-testid=\"cn-timeline-composer-heading\">\n\t\t\t<div class=\"cn-timeline-manage__heading\">\n\t\t\t\t<h3 class=\"cn-timeline-manage__title\">\n\t\t\t\t\t{{ composerTitleText }}\n\t\t\t\t</h3>\n\t\t\t\t<p class=\"cn-timeline-manage__subtitle\">\n\t\t\t\t\t{{ composerSubtitleText }}\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<NcNoteCard v-if=\"composerOnly && error\" type=\"error\" data-testid=\"cn-timeline-error\">\n\t\t\t{{ error }}\n\t\t</NcNoteCard>\n\n\t\t<form v-if=\"canManage && composerEnabled\"\n\t\t\tref=\"composer\"\n\t\t\tclass=\"cn-timeline-manage__composer\"\n\t\t\tdata-testid=\"cn-timeline-composer\"\n\t\t\t@submit.prevent=\"submit\">\n\t\t\t<template v-if=\"!composerOnly\">\n\t\t\t\t<h3 class=\"cn-timeline-manage__composer-title\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Add note') }}\n\t\t\t\t</h3>\n\t\t\t\t<p class=\"cn-timeline-manage__composer-hint\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Goes on the timeline above, internal unless you make it visible') }}\n\t\t\t\t</p>\n\t\t\t</template>\n\t\t\t<label v-if=\"textBlocks.length\" class=\"cn-timeline-manage__draft-label\" :for=\"blockId\">\n\t\t\t\t{{ t('nextcloud-vue', 'Template') }}\n\t\t\t</label>\n\t\t\t<NcSelect v-if=\"textBlocks.length\"\n\t\t\t\tv-model=\"chosenBlock\"\n\t\t\t\tclass=\"cn-timeline-manage__filter\"\n\t\t\t\t:options=\"blockOptions\"\n\t\t\t\t:clearable=\"true\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\t:inputId=\"blockId\"\n\t\t\t\t:labelOutside=\"true\"\n\t\t\t\t:ariaLabelCombobox=\"t('nextcloud-vue', 'Template')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Write your own')\"\n\t\t\t\tdata-testid=\"cn-timeline-block\"\n\t\t\t\t@update:modelValue=\"pickBlock\" />\n\n\t\t\t<label class=\"cn-timeline-manage__draft-label\" :for=\"draftId\">\n\t\t\t\t{{ t('nextcloud-vue', 'Note') }}\n\t\t\t</label>\n\t\t\t<textarea :id=\"draftId\"\n\t\t\t\tv-model=\"draft\"\n\t\t\t\tclass=\"cn-timeline-manage__draft\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Write a note on this record')\"\n\t\t\t\tdata-testid=\"cn-timeline-draft\" />\n\n\t\t\t<div class=\"cn-timeline-manage__composer-foot\">\n\t\t\t\t<NcCheckboxRadioSwitch v-model=\"draftIsPublic\" data-testid=\"cn-timeline-draft-public\">\n\t\t\t\t\t{{ publicLabel }}\n\t\t\t\t</NcCheckboxRadioSwitch>\n\n\t\t\t\t<NcButton variant=\"primary\"\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t:disabled=\"saving || !draft.trim()\"\n\t\t\t\t\tdata-testid=\"cn-timeline-save\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Add it to the timeline') }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</form>\n\n\t\t<component :is=\"activeModal.component\"\n\t\t\tv-if=\"activeModal\"\n\t\t\tv-bind=\"activeModal.props\"\n\t\t\tv-on=\"activeModal.listeners\" />\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'\nimport { translatePlural as n, translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcCheckboxRadioSwitch, NcEmptyContent, NcLoadingIcon, NcNoteCard, NcSelect } from '@nextcloud/vue'\nimport Download from 'vue-material-design-icons/Download.vue'\nimport Plus from 'vue-material-design-icons/Plus.vue'\nimport CnIcon from '../CnIcon/CnIcon.vue'\nimport { prefixUrl } from '../../utils/headers.js'\nimport { userDisplayName } from '../../utils/userDisplayName.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\nlet instanceCount = 0\n\n/** The kind of a read row (`readsToggle`), never a kind OpenRegister declares. */\nconst READ_KIND = 'cn-read'\n\n/** Event-bus channel: a note was added to an object's timeline (`{ objectId, source }`). */\nconst TIMELINE_CHANGED = 'cn:timeline:changed'\n\n/** Event-bus channel: the list's \"Add note\" asks the separate form card to take focus (`{ objectId }`). */\nconst TIMELINE_COMPOSE = 'cn:timeline:compose'\n\n/**\n * Read a dotted path off a value.\n *\n * @param {object} value The value.\n * @param {string} path The path.\n * @return {unknown} What is there, or undefined.\n */\nfunction readPath(value, path) {\n\treturn String(path).split('.').reduce((at, key) => (at === null || at === undefined ? undefined : at[key]), value)\n}\n\nexport default {\n\tname: 'CnTimelineManage',\n\n\tcomponents: { CnIcon, Download, NcButton, NcCheckboxRadioSwitch, NcEmptyContent, NcLoadingIcon, NcNoteCard, NcSelect, Plus },\n\n\tinject: {\n\t\t/** The app's component registry; entry actions resolve their modal here. */\n\t\tcnRegistry: { default: () => ({}) },\n\t\t/** Consumer translation function; manifest labels are authored in English. */\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** The page's object sidebar channel; the audit trail link opens its tab. */\n\t\tobjectSidebarState: { default: null },\n\t},\n\n\tprops: {\n\t\t/** Register slug. */\n\t\tregister: { type: String, default: '' },\n\t\t/** Schema slug. */\n\t\tschema: { type: String, default: '' },\n\t\t/** The object's id. */\n\t\tobjectId: { type: String, default: '' },\n\t\t/** OpenRegister API base. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t\t/**\n\t\t * The widget content: `{ title?, subtitle?, publicLabel?, exportName?,\n\t\t * composer?, textBlocks?, entryActions?, auditTrailLink? }`.\n\t\t * `composer`: `true` (default) draws the note form under the list,\n\t\t * `false` none, `\"separate\"` none but keeps the \"Add note\" button,\n\t\t * which brings a `\"only\"` instance (the form alone, a card of its own\n\t\t * in a stack) into view; a note saved there reloads the list.\n\t\t * `readsToggle` (`true` or a label) adds a footer switch, off by\n\t\t * default, that puts who read the record (its audit trail's reads)\n\t\t * among the entries; the count then says \"changes only\" while it is off.\n\t\t * `auditTrailLink` (`true` or a label) draws a footer link that opens\n\t\t * the object sidebar on its audit trail tab, `auditTrailTab` when the\n\t\t * page declares that tab under its own id.\n\t\t * `momentFormat: \"short\"` writes an entry's moment as \"6 okt, 15:40\"\n\t\t * (day, short month and time in the reader's locale).\n\t\t * An entry shows its `fields.title` after the message (\"Document\n\t\t * beoordeeld: Mail aannemer over planning\"), its author by display\n\t\t * name, and its kind's icon in the rail circle: `kindIcons`\n\t\t * (`{ kind: iconName }`), else the `icon` the kind declares.\n\t\t */\n\t\tcontent: { type: Object, default: () => ({}) },\n\t},\n\n\tdata() {\n\t\tinstanceCount += 1\n\t\treturn {\n\t\t\tuid: instanceCount,\n\t\t\tallEntries: [],\n\t\t\tentries: [],\n\t\t\tkinds: [],\n\t\t\tloading: false,\n\t\t\terror: '',\n\t\t\tcanManage: false,\n\t\t\tkindFilter: null,\n\t\t\tvisibilityFilter: null,\n\t\t\ttextBlocks: [],\n\t\t\tchosenBlock: null,\n\t\t\tdraft: '',\n\t\t\tdraftIsPublic: false,\n\t\t\tsaving: false,\n\t\t\tactiveModal: null,\n\t\t\t/** Whether the list also shows who read the record (`readsToggle`). */\n\t\t\tincludeReads: false,\n\t\t\t/** Whether OpenRegister gives this reader read entries (`readEventsVisible`); null until asked. */\n\t\t\treadsAllowed: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\ttitleText() {\n\t\t\treturn this.content.title ? this.translate(this.content.title) : t('nextcloud-vue', 'History')\n\t\t},\n\n\t\tsubtitleText() {\n\t\t\treturn this.content.subtitle ? this.translate(this.content.subtitle) : t('nextcloud-vue', 'What happened, who did it and when, newest first')\n\t\t},\n\n\t\t/** @return {string} The title of the note form's own card (`composer: \"only\"`): `content.title`, else Add note. */\n\t\tcomposerTitleText() {\n\t\t\treturn this.content.title ? this.translate(this.content.title) : t('nextcloud-vue', 'Add note')\n\t\t},\n\n\t\t/** @return {string} The line under that title: `content.subtitle`, else where the note goes. */\n\t\tcomposerSubtitleText() {\n\t\t\treturn this.content.subtitle ? this.translate(this.content.subtitle) : t('nextcloud-vue', 'Goes on the timeline above, internal unless you make it visible')\n\t\t},\n\n\t\tpublicLabel() {\n\t\t\treturn this.content.publicLabel ? this.translate(this.content.publicLabel) : t('nextcloud-vue', 'Visible to the requester')\n\t\t},\n\n\t\t/**\n\t\t * The audit trail link's words, or '' when it is not drawn.\n\t\t *\n\t\t * @spec openspec/changes/timeline-audit-trail-link/specs/timeline/spec.md#requirement-the-manage-timeline-can-point-at-the-audit-trail-in-the-sidebar\n\t\t * @return {string}\n\t\t */\n\t\tauditTrailLinkLabel() {\n\t\t\tconst link = this.content.auditTrailLink\n\t\t\tif (!link || !this.objectSidebarState) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn typeof link === 'string' ? this.translate(link) : t('nextcloud-vue', 'Full audit trail in the sidebar')\n\t\t},\n\n\t\t/**\n\t\t * Whether this instance draws the note form: inline (`composer` true or\n\t\t * unset) or as the whole widget (`\"only\"`).\n\t\t *\n\t\t * @spec openspec/changes/timeline-composer-card/specs/timeline/spec.md#requirement-the-note-form-can-be-its-own-card\n\t\t * @return {boolean}\n\t\t */\n\t\tcomposerEnabled() {\n\t\t\treturn this.content.composer !== false && this.content.composer !== 'separate'\n\t\t},\n\n\t\t/**\n\t\t * The words of the \"also who read it\" switch, or '' when the widget\n\t\t * does not offer it (`readsToggle`: true or a label).\n\t\t *\n\t\t * @spec openspec/changes/timeline-reads-toggle/specs/timeline/spec.md#requirement-the-history-can-show-who-read-the-record\n\t\t * @return {string}\n\t\t */\n\t\treadsToggleLabel() {\n\t\t\tconst toggle = this.content.readsToggle\n\t\t\tif (!toggle) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn typeof toggle === 'string' ? this.translate(toggle) : t('nextcloud-vue', 'Also who read it')\n\t\t},\n\n\t\t/**\n\t\t * \"3 of 10 events\", and \", changes only\" while reads can be shown but are not.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tcountLine() {\n\t\t\tconst values = { shown: this.entries.length, total: this.allEntries.length }\n\t\t\treturn this.readsToggleLabel && this.readsAllowed && !this.includeReads\n\t\t\t\t? t('nextcloud-vue', '{shown} of {total} events, changes only', values)\n\t\t\t\t: t('nextcloud-vue', '{shown} of {total} events', values)\n\t\t},\n\n\t\t/**\n\t\t * Whether the visibility filter shows its \"Visibility\" label. With\n\t\t * `visibilityLabel: false` it keeps only its accessible name and the\n\t\t * select reads \"Internal and public\" on its own (board DqZaakHistorie).\n\t\t *\n\t\t * @spec openspec/changes/timeline-visibility-filter-unlabelled/specs/timeline/spec.md#requirement-the-visibility-filter-can-go-without-a-visible-label\n\t\t * @return {boolean}\n\t\t */\n\t\tvisibilityLabelShown() {\n\t\t\treturn this.content.visibilityLabel !== false\n\t\t},\n\n\t\t/** @return {boolean} The widget is the note form alone (`composer: \"only\"`), a card of its own beside the list. */\n\t\tcomposerOnly() {\n\t\t\treturn this.content.composer === 'only'\n\t\t},\n\n\t\t/** @return {boolean} The list draws no form; its \"Add note\" brings the separate form card into view (`composer: \"separate\"`). */\n\t\tcomposerSeparate() {\n\t\t\treturn this.content.composer === 'separate'\n\t\t},\n\n\t\tdraftId() {\n\t\t\treturn `cn-timeline-draft-${this.uid}`\n\t\t},\n\n\t\tblockId() {\n\t\t\treturn `cn-timeline-block-${this.uid}`\n\t\t},\n\n\t\t/**\n\t\t * The kind options, the plain note first. A note is an entry with NO\n\t\t * kind, so \"Note\" filters on its absence.\n\t\t *\n\t\t * @return {Array<object>} The options.\n\t\t */\n\t\tkindOptions() {\n\t\t\tconst options = [{ id: '', label: t('nextcloud-vue', 'Note') }].concat(this.kinds.map((kind) => ({ id: kind.slug, label: kind.title || kind.slug })))\n\t\t\treturn this.includeReads ? options.concat([{ id: READ_KIND, label: t('nextcloud-vue', 'Viewed') }]) : options\n\t\t},\n\n\t\t/**\n\t\t * All, then every kind the object has entries of, each with its count.\n\t\t *\n\t\t * @spec openspec/changes/timeline-all-chip-host-label/specs/timeline/spec.md#requirement-the-timelines-all-chip-reads-the-hosts-word\n\t\t * @return {Array<object>} The chips.\n\t\t */\n\t\tkindChips() {\n\t\t\tconst chosen = this.kindFilter ? (this.kindFilter.id || '') : null\n\t\t\tconst counts = new Map()\n\t\t\tfor (const entry of this.allEntries) {\n\t\t\t\tconst kind = entry.kind || ''\n\t\t\t\tcounts.set(kind, (counts.get(kind) || 0) + 1)\n\t\t\t}\n\t\t\t// The host's word first, as its own filter chips read (\"Alles\"), then the library's.\n\t\t\tconst hostAll = typeof this.cnTranslate === 'function' ? this.cnTranslate('All') : 'All'\n\t\t\tconst allLabel = typeof hostAll === 'string' && hostAll !== '' && hostAll !== 'All' ? hostAll : t('nextcloud-vue', 'All')\n\t\t\tconst chips = [{ key: 'all', id: null, label: allLabel, count: this.allEntries.length, active: chosen === null }]\n\t\t\tfor (const option of this.kindOptions) {\n\t\t\t\tconst count = counts.get(option.id) || 0\n\t\t\t\tif (count > 0) {\n\t\t\t\t\tchips.push({ key: option.id || 'note', id: option.id, label: option.label, count, active: chosen === option.id })\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn chips\n\t\t},\n\n\t\tblockOptions() {\n\t\t\treturn this.textBlocks.map((block) => ({ id: block.slug, label: block.title || block.slug }))\n\t\t},\n\n\t\tvisibilityOptions() {\n\t\t\treturn [\n\t\t\t\t{ id: 'internal', label: t('nextcloud-vue', 'Internal only') },\n\t\t\t\t{ id: 'public', label: this.publicLabel },\n\t\t\t]\n\t\t},\n\n\t\tbase() {\n\t\t\treturn this.apiBase.replace(/\\/$/, '')\n\t\t},\n\n\t\ttimelineUrl() {\n\t\t\tif (!this.objectId || !this.register || !this.schema) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn prefixUrl(`${this.base}/objects/${this.register}/${this.schema}/${this.objectId}/timeline`)\n\t\t},\n\n\t\tentryActions() {\n\t\t\treturn Array.isArray(this.content.entryActions) ? this.content.entryActions.filter((action) => action && action.id) : []\n\t\t},\n\t},\n\n\twatch: {\n\t\tobjectId: 'load',\n\t},\n\n\tcreated() {\n\t\tthis.onTimelineChanged = (payload) => {\n\t\t\tif (!payload || payload.objectId !== this.objectId || payload.source === this.uid || this.composerOnly) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.load()\n\t\t}\n\t\tthis.onComposeRequested = (payload) => {\n\t\t\tif (this.composerOnly && payload && payload.objectId === this.objectId) {\n\t\t\t\tthis.focusComposer()\n\t\t\t}\n\t\t}\n\t\tsubscribe(TIMELINE_CHANGED, this.onTimelineChanged)\n\t\tsubscribe(TIMELINE_COMPOSE, this.onComposeRequested)\n\t},\n\n\tbeforeUnmount() {\n\t\tunsubscribe(TIMELINE_CHANGED, this.onTimelineChanged)\n\t\tunsubscribe(TIMELINE_COMPOSE, this.onComposeRequested)\n\t},\n\n\tmounted() {\n\t\tthis.loadKinds()\n\t\tif (this.content.textBlocks !== false) {\n\t\t\tthis.loadTextBlocks()\n\t\t}\n\t\tthis.load()\n\t},\n\n\tmethods: {\n\t\tt,\n\t\tn,\n\n\t\ttranslate(text) {\n\t\t\treturn text ? this.cnTranslate(text) : ''\n\t\t},\n\n\t\t/** Read the declared kinds, so the filter names them as administered. */\n\t\tasync loadKinds() {\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(prefixUrl(`${this.base}/timeline/kinds`))\n\t\t\t\tthis.kinds = response.data?.results || []\n\t\t\t} catch {\n\t\t\t\tthis.kinds = []\n\t\t\t}\n\t\t},\n\n\t\t/** Read the seeded standard notes. */\n\t\tasync loadTextBlocks() {\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(prefixUrl(`${this.base}/timeline/text-blocks`))\n\t\t\t\tthis.textBlocks = response.data?.results || []\n\t\t\t} catch {\n\t\t\t\tthis.textBlocks = []\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Note which standard note was picked. The BLOCK is sent, not its body:\n\t\t * OpenRegister fills the object's own values into it on the way in.\n\t\t *\n\t\t * @param {object|null} block The picked option.\n\t\t */\n\t\tpickBlock(block) {\n\t\t\tthis.chosenBlock = block || null\n\t\t\tif (block) {\n\t\t\t\tconst declared = this.textBlocks.find((entry) => entry.slug === block.id)\n\t\t\t\tthis.draft = declared?.title || block.label\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Write the drafted note onto this object.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync submit() {\n\t\t\tif (!this.draft.trim() || !this.timelineUrl) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst payload = { visibility: this.draftIsPublic ? 'public' : 'internal' }\n\t\t\t\tif (this.chosenBlock?.id) {\n\t\t\t\t\tpayload.textBlock = this.chosenBlock.id\n\t\t\t\t} else {\n\t\t\t\t\tpayload.message = this.draft\n\t\t\t\t}\n\t\t\t\tawait axios.post(this.timelineUrl, payload)\n\t\t\t\tthis.draft = ''\n\t\t\t\tthis.chosenBlock = null\n\t\t\t\tthis.draftIsPublic = false\n\t\t\t\temit(TIMELINE_CHANGED, { objectId: this.objectId, source: this.uid })\n\t\t\t\tawait this.load()\n\t\t\t} catch {\n\t\t\t\tthis.error = t('nextcloud-vue', 'That note could not be saved.')\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Read the timeline with the visibility filter, if one is set.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync load() {\n\t\t\tif (!this.timelineUrl) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst params = {}\n\t\t\t\tif (this.visibilityFilter?.id) {\n\t\t\t\t\tparams.visibility = this.visibilityFilter.id\n\t\t\t\t}\n\t\t\t\tconst response = await axios.get(this.timelineUrl, { params })\n\t\t\t\tthis.canManage = response.data?.canManage === true\n\t\t\t\tconst entries = response.data?.results || []\n\t\t\t\tif (this.readsToggleLabel && this.readsAllowed === null) {\n\t\t\t\t\tawait this.readEntries()\n\t\t\t\t}\n\t\t\t\tthis.allEntries = this.readsToggleLabel && this.readsAllowed && this.includeReads ? this.withReads(entries, await this.readEntries()) : entries\n\t\t\t\tthis.entries = this.applyKindFilter(this.allEntries)\n\t\t\t} catch {\n\t\t\t\tthis.allEntries = []\n\t\t\t\tthis.entries = []\n\t\t\t\tthis.error = t('nextcloud-vue', 'The timeline could not be read. Try again, or ask an administrator to check OpenRegister.')\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Who read the record, from its audit trail (`action=read`), as timeline\n\t\t * rows. OpenRegister gives read entries only to the groups named for\n\t\t * them and says so in `readEventsVisible`, which decides whether the\n\t\t * switch is offered at all; a read it refuses or that fails leaves the\n\t\t * reads out and offers no switch.\n\t\t *\n\t\t * @spec openspec/changes/timeline-reads-toggle/specs/timeline/spec.md#requirement-the-history-can-show-who-read-the-record\n\t\t * @return {Promise<Array<object>>} The read rows.\n\t\t */\n\t\tasync readEntries() {\n\t\t\ttry {\n\t\t\t\tconst url = prefixUrl(`${this.base}/objects/${this.register}/${this.schema}/${this.objectId}/audit-trails`)\n\t\t\t\tconst response = await axios.get(url, { params: { action: 'read', limit: 50 } })\n\t\t\t\tthis.readsAllowed = response.data?.readEventsVisible === true\n\t\t\t\tif (!this.readsAllowed) {\n\t\t\t\t\treturn []\n\t\t\t\t}\n\t\t\t\tconst list = response.data?.results || []\n\t\t\t\treturn list\n\t\t\t\t\t.filter((entry) => String(entry.action || '').toLowerCase() === 'read')\n\t\t\t\t\t.map((entry) => ({\n\t\t\t\t\t\tid: `read-${entry.id}`,\n\t\t\t\t\t\tkind: READ_KIND,\n\t\t\t\t\t\tisRead: true,\n\t\t\t\t\t\tauthor: entry.actorDisplayName || entry.userName || entry.user || '',\n\t\t\t\t\t\tcreated: entry.created || entry.creationDateTime || '',\n\t\t\t\t\t\tmessage: t('nextcloud-vue', 'Opened the record'),\n\t\t\t\t\t}))\n\t\t\t} catch {\n\t\t\t\tthis.readsAllowed = false\n\t\t\t\treturn []\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The timeline's entries with the reads among them, newest first; the\n\t\t * pinned entries stay on top.\n\t\t *\n\t\t * @param {Array<object>} entries The timeline's entries.\n\t\t * @param {Array<object>} reads The read rows.\n\t\t * @return {Array<object>} The merged list.\n\t\t */\n\t\twithReads(entries, reads) {\n\t\t\tconst time = (entry) => new Date(entry.created || 0).getTime() || 0\n\t\t\tconst pinned = entries.filter((entry) => entry.pinned)\n\t\t\tconst rest = [...entries.filter((entry) => !entry.pinned), ...reads].sort((a, b) => time(b) - time(a))\n\t\t\treturn [...pinned, ...rest]\n\t\t},\n\n\t\t/**\n\t\t * Show one kind, or every kind for `null`, without reading again.\n\t\t *\n\t\t * @param {string|null} id The kind slug, '' for a note, null for all.\n\t\t */\n\t\tchooseKind(id) {\n\t\t\tthis.kindFilter = id === null ? null : { id }\n\t\t\tthis.entries = this.applyKindFilter(this.allEntries)\n\t\t},\n\n\t\t/**\n\t\t * The kind filter is applied in the reading: the list endpoint does not\n\t\t * read a kind parameter, so sending one would be dropped in silence.\n\t\t *\n\t\t * @param {Array<object>} results The entries as read.\n\t\t * @return {Array<object>} The entries to show.\n\t\t */\n\t\tapplyKindFilter(results) {\n\t\t\tif (!this.kindFilter) {\n\t\t\t\treturn results\n\t\t\t}\n\t\t\tconst wanted = this.kindFilter.id || ''\n\t\t\treturn results.filter((entry) => (entry.kind || '') === wanted)\n\t\t},\n\n\t\t/**\n\t\t * The shown entries as CSV: when, kind, who, visibility and what.\n\t\t *\n\t\t * @return {string} The CSV text.\n\t\t */\n\t\tentriesCsv() {\n\t\t\tconst cell = (value) => `\"${String(value ?? '').replace(/\"/g, '\"\"')}\"`\n\t\t\tconst rows = [[t('nextcloud-vue', 'When'), t('nextcloud-vue', 'Kind'), t('nextcloud-vue', 'Who'), t('nextcloud-vue', 'Visibility'), t('nextcloud-vue', 'Message')]]\n\t\t\tfor (const entry of this.entries) {\n\t\t\t\trows.push([entry.created, this.kindLabel(entry), entry.author, entry.visibility, entry.message])\n\t\t\t}\n\t\t\treturn rows.map((row) => row.map(cell).join(',')).join('\\r\\n')\n\t\t},\n\n\t\t/** Download the shown entries as a CSV file. */\n\t\texportEntries() {\n\t\t\tconst blob = new Blob([this.entriesCsv()], { type: 'text/csv;charset=utf-8' })\n\t\t\tconst url = URL.createObjectURL(blob)\n\t\t\tconst link = document.createElement('a')\n\t\t\tlink.href = url\n\t\t\tlink.download = `${this.content.exportName || 'history'}-${this.objectId || 'record'}.csv`\n\t\t\tdocument.body.appendChild(link)\n\t\t\tlink.click()\n\t\t\tlink.remove()\n\t\t\tURL.revokeObjectURL(url)\n\t\t},\n\n\t\t/**\n\t\t * Open the object sidebar on its audit trail tab.\n\t\t *\n\t\t * @spec openspec/changes/timeline-audit-trail-link/specs/timeline/spec.md#requirement-the-manage-timeline-can-point-at-the-audit-trail-in-the-sidebar\n\t\t */\n\t\topenAuditTrail() {\n\t\t\tthis.objectSidebarState.open = true\n\t\t\tthis.objectSidebarState.requestedTab = this.content.auditTrailTab || 'auditTrail'\n\t\t},\n\n\t\t/** Bring the composer into view and focus its text; a separate form card is asked to do so. */\n\t\tfocusComposer() {\n\t\t\tif (this.composerSeparate) {\n\t\t\t\temit(TIMELINE_COMPOSE, { objectId: this.objectId })\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst form = this.$refs.composer\n\t\t\tif (!form) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tform.scrollIntoView?.({ behavior: 'smooth', block: 'center' })\n\t\t\tform.querySelector('textarea')?.focus()\n\t\t},\n\n\t\t/**\n\t\t * The icon of the entry's kind: `content.kindIcons[kind]`, else the\n\t\t * `icon` the kind declares, or ''.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} An icon name for CnIcon.\n\t\t */\n\t\tkindIcon(entry) {\n\t\t\tif (!entry.kind) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst configured = this.content?.kindIcons?.[entry.kind]\n\t\t\tif (typeof configured === 'string' && configured !== '') {\n\t\t\t\treturn configured\n\t\t\t}\n\t\t\tconst declared = this.kinds.find((kind) => kind.slug === entry.kind)\n\t\t\treturn declared && typeof declared.icon === 'string' ? declared.icon : ''\n\t\t},\n\n\t\t/**\n\t\t * What the entry is about, written after its message: `fields.title`.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The detail, or ''.\n\t\t */\n\t\tentryDetail(entry) {\n\t\t\tconst title = entry.fields && typeof entry.fields.title === 'string' ? entry.fields.title.trim() : ''\n\t\t\treturn title\n\t\t},\n\n\t\t/**\n\t\t * An author's display name; the user id while it is looked up or\n\t\t * when it names no user.\n\t\t *\n\t\t * @param {string} author The author as stored.\n\t\t * @return {string} The name.\n\t\t */\n\t\tauthorName(author) {\n\t\t\treturn userDisplayName(author) || author || ''\n\t\t},\n\n\t\t/**\n\t\t * The label of one entry's kind, falling back to \"Note\".\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The label.\n\t\t */\n\t\tkindLabel(entry) {\n\t\t\tif (entry.kind === READ_KIND) {\n\t\t\t\treturn t('nextcloud-vue', 'Viewed')\n\t\t\t}\n\t\t\tif (!entry.kind) {\n\t\t\t\treturn t('nextcloud-vue', 'Note')\n\t\t\t}\n\t\t\tconst declared = this.kinds.find((kind) => kind.slug === entry.kind)\n\t\t\treturn declared?.title || entry.kind\n\t\t},\n\n\t\t/**\n\t\t * One moment in the reader's locale.\n\t\t *\n\t\t * @param {string} value An ISO 8601 stamp.\n\t\t * @return {string} The moment, or the raw value.\n\t\t */\n\t\tmoment(value) {\n\t\t\tif (!value) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst parsed = new Date(value)\n\t\t\tif (isNaN(parsed.getTime())) {\n\t\t\t\treturn value\n\t\t\t}\n\t\t\tif (this.content?.momentFormat === 'short') {\n\t\t\t\tconst locale = userLocale()\n\t\t\t\tconst day = parsed.toLocaleDateString(locale, { day: 'numeric', month: 'short' }).replace(/\\.$/, '')\n\t\t\t\tconst time = parsed.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hourCycle: 'h23' })\n\t\t\t\treturn `${day}, ${time}`\n\t\t\t}\n\t\t\treturn parsed.toLocaleString()\n\t\t},\n\n\t\tasync togglePin(entry) {\n\t\t\tawait this.patch(entry, { pinned: !entry.pinned })\n\t\t},\n\n\t\tasync closeFollowUp(entry) {\n\t\t\tawait this.patch(entry, { followUp: 'done' })\n\t\t},\n\n\t\t/**\n\t\t * Write one change onto one entry and read the timeline back (pinning\n\t\t * changes the order, so patching in place would look like nothing).\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @param {object} changes The fields to write.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync patch(entry, changes) {\n\t\t\ttry {\n\t\t\t\tawait axios.patch(`${this.timelineUrl}/${entry.id}`, changes)\n\t\t\t\tawait this.load()\n\t\t\t} catch {\n\t\t\t\tthis.error = t('nextcloud-vue', 'That change could not be saved.')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The configured entry actions that apply to one entry (`kinds` limits\n\t\t * an action to entries of those kinds).\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {Array<object>} The actions.\n\t\t */\n\t\tactionsFor(entry) {\n\t\t\treturn this.entryActions.filter((action) => !Array.isArray(action.kinds) || action.kinds.includes(entry.kind || ''))\n\t\t},\n\n\t\t/**\n\t\t * Resolve `@objectId` and `@row.<path>` tokens in an action's props.\n\t\t *\n\t\t * @param {object} props The props as declared.\n\t\t * @param {object} entry The entry.\n\t\t * @return {object} The resolved props.\n\t\t */\n\t\tresolveProps(props, entry) {\n\t\t\tconst out = {}\n\t\t\tfor (const [key, value] of Object.entries(props || {})) {\n\t\t\t\tif (value === '@objectId') {\n\t\t\t\t\tout[key] = this.objectId\n\t\t\t\t} else if (typeof value === 'string' && value.startsWith('@row.')) {\n\t\t\t\t\tconst found = readPath(entry, value.slice('@row.'.length))\n\t\t\t\t\tout[key] = found === undefined || found === null ? '' : found\n\t\t\t\t} else {\n\t\t\t\t\tout[key] = value\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/**\n\t\t * Open an entry action's modal from the app's registry. On its\n\t\t * `doneEvent` (default `done`) the entry's open follow-up is closed when\n\t\t * the action says so; otherwise the timeline is read again.\n\t\t *\n\t\t * @param {object} action The action.\n\t\t * @param {object} entry The entry.\n\t\t */\n\t\topenAction(action, entry) {\n\t\t\tconst registered = (this.cnRegistry || {})[action.modal]\n\t\t\tconst component = registered && (registered.component || registered)\n\t\t\tif (!component) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.warn(`[CnTimelineWidget] entry action \"${action.id}\" names modal \"${action.modal}\", which the registry does not hold.`)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst close = () => {\n\t\t\t\tthis.activeModal = null\n\t\t\t}\n\t\t\tconst done = async () => {\n\t\t\t\tthis.activeModal = null\n\t\t\t\tif (action.closesFollowUp === true && entry.followUp === 'open') {\n\t\t\t\t\tawait this.closeFollowUp(entry)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tawait this.load()\n\t\t\t}\n\t\t\tthis.activeModal = {\n\t\t\t\tcomponent,\n\t\t\t\tprops: this.resolveProps(action.props, entry),\n\t\t\t\tlisteners: { [action.doneEvent || 'done']: done, close },\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-timeline-manage__header {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tjustify-content: space-between;\n\tgap: 12px;\n\tmargin-block-end: 16px;\n}\n\n.cn-timeline-manage__heading {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.cn-timeline-manage__header-actions {\n\tdisplay: flex;\n\tgap: 8px;\n}\n\n.cn-timeline-manage__title {\n\tmargin: 0;\n\tfont-size: 17px;\n\tfont-weight: 700;\n\tline-height: 1.2;\n}\n\n.cn-timeline-manage__subtitle {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 14px;\n}\n\n.cn-timeline-manage__chips {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tmargin-block-end: 12px;\n}\n\n.cn-timeline-manage__chip {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 8px;\n\tbox-sizing: border-box;\n\theight: 36px;\n\tpadding: 0 12px;\n\tborder: 1px solid var(--color-border-dark);\n\tborder-radius: 18px;\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tcursor: pointer;\n}\n\n/* The chosen kind is a filled chip with no outline. */\n.cn-timeline-manage__chip--active {\n\tborder: 0;\n\tbackground: var(--color-main-text);\n\tcolor: var(--color-main-background);\n}\n\n.cn-timeline-manage__chip-count {\n\tpadding: 1px 7px;\n\tborder-radius: 10px;\n\tbackground: var(--color-border);\n\tcolor: var(--color-main-text);\n\tfont-size: 12px;\n}\n\n/* On the filled chip the count is a lighter ink bubble with light text. */\n.cn-timeline-manage__chip--active .cn-timeline-manage__chip-count {\n\tbackground: color-mix(in srgb, var(--color-main-background) 18%, var(--color-main-text));\n\tcolor: var(--color-main-background);\n}\n\n.cn-timeline-manage__footer {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n\tmargin: 12px 0 0;\n}\n\n.cn-timeline-manage__count {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-timeline-manage__composer {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tmargin-block-start: 24px;\n\tpadding-block-start: 16px;\n\tborder-block-start: 1px solid var(--color-border);\n}\n\n.cn-timeline-manage--composer-only .cn-timeline-manage__composer {\n\tmargin-block-start: 0;\n\tpadding-block-start: 0;\n\tborder-block-start: none;\n}\n\n/* The checkbox at the start, the button at the end, as one row. */\n.cn-timeline-manage__composer-foot {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n}\n\n.cn-timeline-manage__composer-title {\n\tmargin: 0;\n\tfont-size: 16px;\n\tfont-weight: bold;\n}\n\n.cn-timeline-manage__composer-hint {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-timeline-manage__draft-label {\n\tfont-weight: bold;\n}\n\n.cn-timeline-manage__draft {\n\twidth: 100%;\n\tmin-height: 70px;\n}\n\n.cn-timeline-manage__controls {\n\tdisplay: flex;\n\tgap: 12px;\n\tflex-wrap: wrap;\n\tmargin-block-end: 12px;\n}\n\n.cn-timeline-manage__filter {\n\tmin-width: 200px;\n}\n\n.cn-timeline-manage__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.cn-timeline-manage__entry {\n\tdisplay: flex;\n\tflex-direction: column;\n\tborder-block-end: 1px solid var(--color-border);\n\tpadding-block: 12px;\n}\n\n.cn-timeline-manage__entry--pinned {\n\tborder-inline-start: 3px solid var(--color-primary-element);\n\tpadding-inline-start: 8px;\n}\n\n/* The message comes first in the markup (a reader hears what happened\n before who and when); this look shows the head above it. */\n.cn-timeline-manage__head {\n\torder: -1;\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\talign-items: baseline;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-timeline-manage__kind {\n\tfont-weight: bold;\n\tcolor: var(--color-main-text);\n}\n\n.cn-timeline-manage__badge {\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 0 6px;\n}\n\n.cn-timeline-manage__badge--open {\n\tborder-color: var(--color-warning);\n\tcolor: var(--color-warning-text);\n}\n\n.cn-timeline-manage__message {\n\tmargin-block: 4px 0;\n\twhite-space: pre-wrap;\n}\n\n.cn-timeline-manage__siblings {\n\tmargin-block: 4px 0;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-timeline-manage__actions {\n\tdisplay: flex;\n\tgap: 8px;\n\tmargin-block-start: 4px;\n}\n</style>\n"],"names":["_createElementBlock","_normalizeClass","_Fragment","_createElementVNode","_toDisplayString","_createBlock","_createVNode","_createTextVNode","_openBlock","_renderList"],"mappings":";;AAuCQ,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,4BAAC,GAAA;AACN,MAAA,UAAA,GAAA,EAAA,KAAI,EAAE,6BAA6B,GAAA;AACnC,MAAA,UAAA,GAAA,EAAA,KAAK,EAAA,2BAAO,GAAA;AAGZ,MAAA,UAAA,GAAA,EAAA,KAAI,EAAC,8BAAyB,GAAA;;;;AAmC/B,MAAA,UAAA,GAAA,EAAA,KAAA,EAAA,gCAAA,GAAA;AAIA,MAAA,UAAA,GAAA,EAAA,KAAK,EAAE,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;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -137,6 +137,11 @@ var script = {
|
|
|
137
137
|
*
|
|
138
138
|
* @return {string} The composer URL.
|
|
139
139
|
*/
|
|
140
|
+
/** @return {string} The record, register and schema the list is for. */
|
|
141
|
+
bindingKey() {
|
|
142
|
+
return [this.register, this.schema, this.objectId].join('/')
|
|
143
|
+
},
|
|
144
|
+
|
|
140
145
|
composeUrl() {
|
|
141
146
|
return (typeof OC !== 'undefined' && typeof OC.generateUrl === 'function')
|
|
142
147
|
? OC.generateUrl('/apps/mail/box/draft')
|
|
@@ -145,10 +150,15 @@ var script = {
|
|
|
145
150
|
},
|
|
146
151
|
|
|
147
152
|
watch: {
|
|
148
|
-
|
|
153
|
+
/*
|
|
154
|
+
* The record, its register and its schema together: on a detail page
|
|
155
|
+
* the id is known first and the register and schema follow, and the
|
|
156
|
+
* list loads once all three are there.
|
|
157
|
+
*/
|
|
158
|
+
bindingKey: {
|
|
149
159
|
immediate: true,
|
|
150
|
-
handler(
|
|
151
|
-
if (
|
|
160
|
+
handler() {
|
|
161
|
+
if (this.register && this.schema && this.objectId) {
|
|
152
162
|
this.reset();
|
|
153
163
|
this.fetchMessages();
|
|
154
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnEmailTab.vue2.js","sources":["../../../../../src/integrations/builtin/email/CnEmailTab.vue"],"sourcesContent":["<!--\n CnEmailTab — sidebar tab for the `email` integration.\n\n Renders the full list of Nextcloud Mail messages linked to an OR\n object. Backed by `EmailService` via the registry endpoint\n (`/integrations/email`). Paged via load-more; rows deep-link into the\n NC Mail app per AD-2 (Mail owns compose, OR owns the link).\n\n Visual fidelity: mirrors the real NC Mail message list — a sender\n avatar, a bold subject, a \"sender · date\" subline, a one-line snippet\n preview, and an unread indicator (accent dot + bold subject) when the\n message has not been read.\n\n Storage strategy: link-table (`openregister_email_links`). Per design\n AD-1 the tab does NOT compose — users open Mail, send, return and\n link via the \"Link existing\" picker (compose UI tracked separately).\n-->\n<template>\n\t<div class=\"cn-sidebar-tab cn-email-tab\">\n\t\t<div v-if=\"showActions\" class=\"cn-email-tab__actions\">\n\t\t\t<NcButton variant=\"secondary\" @click=\"openPicker\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<LinkVariant :size=\"18\" />\n\t\t\t\t</template>\n\t\t\t\t{{ linkExistingLabel }}\n\t\t\t</NcButton>\n\t\t\t<NcButton\n\t\t\t\tvariant=\"primary\"\n\t\t\t\t:href=\"composeUrl\"\n\t\t\t\ttarget=\"_blank\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<EmailEditOutline :size=\"18\" />\n\t\t\t\t</template>\n\t\t\t\t{{ composeLabel }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<div v-if=\"loading\" class=\"cn-sidebar-tab__loading\">\n\t\t\t<NcLoadingIcon />\n\t\t</div>\n\t\t<div v-else-if=\"errored === true\" class=\"cn-sidebar-tab__empty cn-sidebar-tab__empty--error\">\n\t\t\t{{ errorLabel }}\n\t\t</div>\n\t\t<div v-else-if=\"messages.length === 0\" class=\"cn-sidebar-tab__empty\">\n\t\t\t{{ noMessagesLabel }}\n\t\t</div>\n\t\t<ul v-else class=\"cn-email-tab__list\">\n\t\t\t<li\n\t\t\t\tv-for=\"row in rows\"\n\t\t\t\t:key=\"row.id\"\n\t\t\t\tclass=\"cn-email-tab__item\">\n\t\t\t\t<component\n\t\t\t\t\t:is=\"row.href ? 'a' : 'div'\"\n\t\t\t\t\tclass=\"cn-email-tab__row\"\n\t\t\t\t\t:class=\"{ 'cn-email-tab__row--unread': row.unread }\"\n\t\t\t\t\tv-bind=\"row.href ? { href: row.href, target: '_blank', rel: 'noopener noreferrer' } : {}\">\n\t\t\t\t\t<span class=\"cn-email-tab__unread-dot\" :class=\"{ 'is-shown': row.unread }\" />\n\t\t\t\t\t<NcAvatar\n\t\t\t\t\t\tclass=\"cn-email-tab__avatar\"\n\t\t\t\t\t\t:size=\"36\"\n\t\t\t\t\t\t:displayName=\"row.avatarName\"\n\t\t\t\t\t\t:user=\"row.avatarUser\"\n\t\t\t\t\t\t:isNoUser=\"true\" />\n\t\t\t\t\t<div class=\"cn-email-tab__body\">\n\t\t\t\t\t\t<div class=\"cn-email-tab__line\">\n\t\t\t\t\t\t\t<span class=\"cn-email-tab__subject\" :title=\"row.subject\">{{ row.subject }}</span>\n\t\t\t\t\t\t\t<span class=\"cn-email-tab__date\">\n\t\t\t\t\t\t\t\t<NcDateTime\n\t\t\t\t\t\t\t\t\tv-if=\"row.dateValid\"\n\t\t\t\t\t\t\t\t\t:timestamp=\"row.dateMs\"\n\t\t\t\t\t\t\t\t\trelativeTime=\"short\" />\n\t\t\t\t\t\t\t\t<template v-else>{{ row.dateRaw }}</template>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"cn-email-tab__sender\" :title=\"row.sender\">\n\t\t\t\t\t\t\t{{ row.sender }}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div v-if=\"row.snippet\" class=\"cn-email-tab__snippet\" :title=\"row.snippet\">\n\t\t\t\t\t\t\t{{ row.snippet }}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</component>\n\t\t\t</li>\n\t\t</ul>\n\t\t<NcButton\n\t\t\tv-if=\"hasMore === true\"\n\t\t\tvariant=\"tertiary\"\n\t\t\t:wide=\"true\"\n\t\t\t:disabled=\"loadingMore\"\n\t\t\tclass=\"cn-sidebar-tab__load-more\"\n\t\t\t@click=\"loadMore\">\n\t\t\t<template v-if=\"loadingMore\" #icon>\n\t\t\t\t<NcLoadingIcon :size=\"20\" />\n\t\t\t</template>\n\t\t\t{{ loadMoreLabel }}\n\t\t</NcButton>\n\n\t\t<CnEmailPicker\n\t\t\tv-if=\"pickerOpen\"\n\t\t\t:apiBase=\"apiBase\"\n\t\t\t@close=\"pickerOpen = false\"\n\t\t\t@link=\"onLinkPick\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcAvatar, NcButton, NcDateTime, NcLoadingIcon } from '@nextcloud/vue'\nimport EmailEditOutline from 'vue-material-design-icons/EmailEditOutline.vue'\nimport LinkVariant from 'vue-material-design-icons/LinkVariant.vue'\nimport CnEmailPicker from '../../../components/CnEmailPicker/CnEmailPicker.vue'\nimport { buildHeaders, prefixUrl } from '../../../utils/index.js'\n\n/**\n * CnEmailTab — sidebar tab rendering the full list of Nextcloud Mail\n * messages linked to an OpenRegister object.\n *\n * Basic usage\n * ```vue\n * <CnEmailTab\n * :object-id=\"objectId\"\n * :register=\"registerId\"\n * :schema=\"schemaId\" />\n * ```\n */\nexport default {\n\tname: 'CnEmailTab',\n\n\tcomponents: {\n\t\tNcAvatar,\n\t\tNcButton,\n\t\tNcDateTime,\n\t\tNcLoadingIcon,\n\t\tEmailEditOutline,\n\t\tLinkVariant,\n\t\tCnEmailPicker,\n\t},\n\n\tprops: {\n\t\t/** Parent object id. */\n\t\tobjectId: { type: String, required: true },\n\t\t/** OpenRegister register id (slug or uuid). */\n\t\tregister: { type: String, default: '' },\n\t\t/** OpenRegister schema id (slug or uuid). */\n\t\tschema: { type: String, default: '' },\n\t\t/** Base API URL. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t\t/** Page size for paged fetches. */\n\t\tpageSize: { type: Number, default: 25 },\n\t\t/** Pre-translated empty label. */\n\t\tnoMessagesLabel: { type: String, default: () => t('nextcloud-vue', 'No linked emails yet') },\n\t\t/** Pre-translated error label. */\n\t\terrorLabel: { type: String, default: () => t('nextcloud-vue', 'Could not load emails') },\n\t\t/** Pre-translated load-more label. */\n\t\tloadMoreLabel: { type: String, default: () => t('nextcloud-vue', 'Load more') },\n\t\t/** Pre-translated fallback subject label. */\n\t\tnoSubjectLabel: { type: String, default: () => t('nextcloud-vue', '(no subject)') },\n\t\t/** Pre-translated fallback sender label. */\n\t\tunknownSenderLabel: { type: String, default: () => t('nextcloud-vue', 'Unknown sender') },\n\t\t/** Pre-translated link-existing CTA label. */\n\t\tlinkExistingLabel: { type: String, default: () => t('nextcloud-vue', 'Link existing email') },\n\t\t/** Pre-translated compose-in-Mail CTA label. */\n\t\tcomposeLabel: { type: String, default: () => t('nextcloud-vue', 'Compose in Mail') },\n\t\t/** Base path for the Mail app (for the compose deep-link). */\n\t\tmailAppPath: { type: String, default: '/index.php/apps/mail' },\n\t\t/**\n\t\t * Whether the tab draws its own \"Link existing email\" and \"Compose in\n\t\t * Mail\" buttons. Off when a host draws them (CnMailTab\n\t\t * `headerActions`) and opens the picker through `openPicker()`.\n\t\t */\n\t\tshowActions: { type: Boolean, default: true },\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tmessages: [],\n\t\t\ttotal: 0,\n\t\t\tnextCursor: null,\n\t\t\tloading: false,\n\t\t\tloadingMore: false,\n\t\t\terrored: false,\n\t\t\tpickerOpen: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Whether a further page is available.\n\t\t *\n\t\t * Prefers the backend's `nextCursor` (Tier-3 standardized\n\t\t * `{items, total, nextCursor}` envelope from the generic\n\t\t * integrations endpoint). Falls back to the count comparison\n\t\t * for any backend that still omits the cursor.\n\t\t *\n\t\t * @return {boolean} True when more messages can be loaded.\n\t\t */\n\t\thasMore() {\n\t\t\tif (this.nextCursor !== null) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn this.messages.length < this.total\n\t\t},\n\n\t\t/**\n\t\t * Pre-computed, template-safe view rows mirroring NC Mail.\n\t\t *\n\t\t * All optional-chaining / nullish logic lives here (in JS) so the\n\t\t * buble-compiled Vue 2 template stays free of `?.` / `??`.\n\t\t *\n\t\t * @return {object[]} One descriptor per message.\n\t\t */\n\t\trows() {\n\t\t\treturn this.messages.map((message) => {\n\t\t\t\tconst dateRaw = this.rawWhen(message)\n\t\t\t\tconst d = dateRaw === '' ? null : new Date(dateRaw)\n\t\t\t\tconst dateValid = d !== null && Number.isNaN(d.getTime()) === false\n\t\t\t\tconst sender = this.formatSender(message)\n\t\t\t\treturn {\n\t\t\t\t\tid: message.id,\n\t\t\t\t\tmessage,\n\t\t\t\t\tsubject: this.formatSubject(message),\n\t\t\t\t\tsender,\n\t\t\t\t\tsnippet: this.formatSnippet(message),\n\t\t\t\t\tunread: this.isUnread(message),\n\t\t\t\t\tdateValid,\n\t\t\t\t\tdateMs: dateValid ? d.getTime() : 0,\n\t\t\t\t\tdateRaw: String(dateRaw),\n\t\t\t\t\tavatarName: sender,\n\t\t\t\t\tavatarUser: this.senderEmail(message),\n\t\t\t\t\thref: this.threadUrl(message),\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Deep-link into NC Mail's new-message composer.\n\t\t *\n\t\t * AD-2 (Mail owns compose / OR owns the link): we do NOT\n\t\t * implement an in-app composer. \"Compose in Mail\" opens NC Mail\n\t\t * in a new tab with the new-message view; once the user has\n\t\t * sent, they return to OR and link the sent message via the\n\t\t * picker.\n\t\t *\n\t\t * @return {string} The composer URL.\n\t\t */\n\t\tcomposeUrl() {\n\t\t\treturn (typeof OC !== 'undefined' && typeof OC.generateUrl === 'function')\n\t\t\t\t? OC.generateUrl('/apps/mail/box/draft')\n\t\t\t\t: `${this.mailAppPath}/box/draft`\n\t\t},\n\t},\n\n\twatch: {\n\t\tobjectId: {\n\t\t\timmediate: true,\n\t\t\thandler(id) {\n\t\t\t\tif (id) {\n\t\t\t\t\tthis.reset()\n\t\t\t\t\tthis.fetchMessages()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\treset() {\n\t\t\tthis.messages = []\n\t\t\tthis.total = 0\n\t\t\tthis.nextCursor = null\n\t\t\tthis.errored = false\n\t\t},\n\n\t\tasync fetchMessages(append = false) {\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (append === true) {\n\t\t\t\tthis.loadingMore = true\n\t\t\t} else {\n\t\t\t\tthis.loading = true\n\t\t\t}\n\t\t\tthis.errored = false\n\t\t\ttry {\n\t\t\t\tconst params = new URLSearchParams({ _limit: String(this.pageSize) })\n\t\t\t\t// The Tier-3 envelope's `nextCursor` is the next zero-indexed\n\t\t\t\t// page number consumed by `_page`; walk it on append.\n\t\t\t\tif (append === true && this.nextCursor !== null) {\n\t\t\t\t\tparams.set('_page', String(this.nextCursor))\n\t\t\t\t} else {\n\t\t\t\t\tparams.set('_page', '0')\n\t\t\t\t}\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/integrations/email?${params.toString()}`),\n\t\t\t\t\t{ headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tif (response.ok === true) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tconst list = data.items || data.results || (Array.isArray(data) ? data : []) || []\n\t\t\t\t\tconst items = Array.isArray(list) === true ? list : []\n\t\t\t\t\tthis.messages = append === true ? [...this.messages, ...items] : items\n\t\t\t\t\tthis.total = typeof data.total === 'number' ? data.total : this.messages.length\n\t\t\t\t\tconst next = data.nextCursor\n\t\t\t\t\tthis.nextCursor = (next === null || next === undefined) ? null : next\n\t\t\t\t} else {\n\t\t\t\t\tthis.errored = true\n\t\t\t\t\tif (append !== true) {\n\t\t\t\t\t\tthis.messages = []\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnEmailTab] failed to fetch linked emails', err)\n\t\t\t\tthis.errored = true\n\t\t\t\tif (append !== true) {\n\t\t\t\t\tthis.messages = []\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t\tthis.loadingMore = false\n\t\t\t}\n\t\t},\n\n\t\tloadMore() {\n\t\t\tif (this.nextCursor === null && this.messages.length >= this.total) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.fetchMessages(true)\n\t\t},\n\n\t\tformatSubject(message) {\n\t\t\tconst raw = message.subject\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn this.noSubjectLabel\n\t\t},\n\n\t\tformatSender(message) {\n\t\t\tconst raw = message.senderName || message.fromName || message.sender || message.from\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn this.unknownSenderLabel\n\t\t},\n\n\t\t/**\n\t\t * Best-effort bare email address for the NcAvatar `user` seed so\n\t\t * gravatar/initials are stable per correspondent.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {string} An email-ish identifier, or '' when unknown.\n\t\t */\n\t\tsenderEmail(message) {\n\t\t\tconst candidate = message.senderEmail || message.fromEmail || message.sender || message.from\n\t\t\tif (typeof candidate === 'string' && candidate.indexOf('@') !== -1) {\n\t\t\t\treturn candidate.trim()\n\t\t\t}\n\t\t\treturn ''\n\t\t},\n\n\t\t/**\n\t\t * One-line preview snippet, mirroring NC Mail's message list.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {string} A trimmed snippet, or '' when none is available.\n\t\t */\n\t\tformatSnippet(message) {\n\t\t\tconst raw = message.preview || message.snippet || message.summary || message.bodyPreview\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw.trim()\n\t\t\t}\n\t\t\treturn ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the message is unread, tolerant of the several shapes\n\t\t * the backend may report read-state in.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {boolean} True when the message has not been read.\n\t\t */\n\t\tisUnread(message) {\n\t\t\tif (typeof message.unread === 'boolean') {\n\t\t\t\treturn message.unread\n\t\t\t}\n\t\t\tif (typeof message.isRead === 'boolean') {\n\t\t\t\treturn message.isRead === false\n\t\t\t}\n\t\t\tif (typeof message.seen === 'boolean') {\n\t\t\t\treturn message.seen === false\n\t\t\t}\n\t\t\tif (Array.isArray(message.flags)) {\n\t\t\t\treturn message.flags.indexOf('seen') === -1 && message.flags.indexOf('\\\\Seen') === -1\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\n\t\trawWhen(message) {\n\t\t\tconst raw = message.mailDate || message.date || message.linkedAt\n\t\t\tif (raw === undefined || raw === null || raw === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn raw\n\t\t},\n\n\t\t// Thread deep-link into NC Mail; undefined when the row lacks ids.\n\t\tthreadUrl(message) {\n\t\t\tconst accountId = message.mailAccountId\n\t\t\tconst messageId = message.mailMessageId\n\t\t\tif (accountId === undefined || accountId === null || messageId === undefined || messageId === null) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\treturn (typeof OC !== 'undefined' && typeof OC.generateUrl === 'function')\n\t\t\t\t? OC.generateUrl(`/apps/mail/box/${accountId}/thread/${messageId}`)\n\t\t\t\t: `/index.php/apps/mail/box/${accountId}/thread/${messageId}`\n\t\t},\n\n\t\topenPicker() {\n\t\t\tthis.pickerOpen = true\n\t\t},\n\n\t\tasync onLinkPick(payload) {\n\t\t\tthis.pickerOpen = false\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/emails`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: { ...buildHeaders(), 'Content-Type': 'application/json' },\n\t\t\t\t\t\tbody: JSON.stringify(payload),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tif (response.ok === true || response.status === 409) {\n\t\t\t\t\t// 409 = already-linked; treated as success since the row\n\t\t\t\t\t// already exists for this object.\n\t\t\t\t\tthis.reset()\n\t\t\t\t\tawait this.fetchMessages()\n\t\t\t\t} else {\n\t\t\t\t\tthis.errored = true\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnEmailTab] link failed', err)\n\t\t\t\tthis.errored = true\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-sidebar-tab {\n\tpadding: 12px;\n\toverflow-x: hidden;\n}\n\n.cn-sidebar-tab__loading {\n\tdisplay: flex;\n\tjustify-content: center;\n\tpadding: 24px 0;\n}\n\n.cn-sidebar-tab__empty {\n\ttext-align: center;\n\tpadding: 24px 12px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-sidebar-tab__empty--error {\n\tcolor: var(--color-error);\n}\n\n.cn-sidebar-tab__load-more {\n\tmargin-top: 8px;\n}\n\n.cn-email-tab__actions {\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\tmargin-bottom: 8px;\n}\n\n/* NC-Mail-style message list */\n.cn-email-tab__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n.cn-email-tab__row {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 10px;\n\tpadding: 8px 6px;\n\tborder-radius: var(--border-radius-large, 8px);\n\tcolor: inherit;\n\ttext-decoration: none;\n\tposition: relative;\n}\n\n/* Only a row with Mail ids is a link; the rest must not look clickable. */\na.cn-email-tab__row {\n\tcursor: pointer;\n}\n\na.cn-email-tab__row:hover {\n\tbackground-color: var(--color-background-hover);\n}\n\n.cn-email-tab__unread-dot {\n\tflex: 0 0 auto;\n\twidth: 8px;\n\talign-self: center;\n\tvisibility: hidden;\n}\n\n.cn-email-tab__unread-dot.is-shown {\n\tvisibility: visible;\n}\n\n.cn-email-tab__unread-dot.is-shown::before {\n\tcontent: '';\n\tdisplay: block;\n\twidth: 8px;\n\theight: 8px;\n\tborder-radius: 50%;\n\tbackground-color: var(--cn-email-accent, var(--color-primary-element));\n}\n\n.cn-email-tab__avatar {\n\tflex: 0 0 auto;\n}\n\n.cn-email-tab__body {\n\tflex: 1 1 auto;\n\tmin-width: 0;\n}\n\n.cn-email-tab__line {\n\tdisplay: flex;\n\talign-items: baseline;\n\tgap: 8px;\n}\n\n.cn-email-tab__subject {\n\tflex: 1 1 auto;\n\tmin-width: 0;\n\tcolor: var(--color-main-text);\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__row--unread .cn-email-tab__subject {\n\tfont-weight: bold;\n}\n\n.cn-email-tab__date {\n\tflex: 0 0 auto;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.8em;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__sender {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__snippet {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\tmargin-top: 1px;\n}\n</style>\n"],"names":["CnEmailPicker","t"],"mappings":";;;;;;;AAiHA;;AAEC;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,YAAY;;CAElB,UAAU,EAAE;AACX,EAAA,QAAQ;AACR,EAAA,QAAQ;EACR,UAAU;EACV,aAAa;AACb,EAAA,gBAAgB;EAChB,WAAW;iBACXA,UAAa;EACb;;AAED,CAAA,KAAK,EAAE;AACN;AACA,EAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;AAC1C;AACA,EAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AACvC;AACA,EAAA,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AACrC;EACA,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,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ACzB,GAAA,IAAI,CAAC,UAAS,GAAI,MAAI;GACtB,IAAI,CAAC,IAAI,CAAC,QAAO,IAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE;IACrD,MAAK;AACN,IAAA;AACA,GAAA,IAAI;IACH,MAAM,WAAW,MAAM,KAAK;AAC3B,KAAA,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC5F,KAAA;MACC,MAAM,EAAE,MAAM;MACd,OAAO,EAAE,EAAE,GAAG,YAAY,EAAE,EAAE,cAAc,EAAE,kBAAiB,EAAG;MAClE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;MAC7B;AACF,MAAA;AACA,IAAA,IAAI,QAAQ,CAAC,OAAO,IAAK,IAAG,QAAQ,CAAC,WAAW,GAAG,EAAE;;;KAGpD,IAAI,CAAC,KAAK,GAAC;KACX,MAAM,IAAI,CAAC,aAAa,GAAC;KACxB,MAAK;AACN,KAAA,IAAI,CAAC,OAAM,GAAI,KAAG;AACnB,KAAA;IACC,CAAA,OAAO,GAAG,EAAE;AACb;AACA,IAAA,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,GAAG,EAAA;AAC7C,IAAA,IAAI,CAAC,OAAM,GAAI,KAAG;AACnB,IAAA;GACA;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnEmailTab.vue2.js","sources":["../../../../../src/integrations/builtin/email/CnEmailTab.vue"],"sourcesContent":["<!--\n CnEmailTab — sidebar tab for the `email` integration.\n\n Renders the full list of Nextcloud Mail messages linked to an OR\n object. Backed by `EmailService` via the registry endpoint\n (`/integrations/email`). Paged via load-more; rows deep-link into the\n NC Mail app per AD-2 (Mail owns compose, OR owns the link).\n\n Visual fidelity: mirrors the real NC Mail message list — a sender\n avatar, a bold subject, a \"sender · date\" subline, a one-line snippet\n preview, and an unread indicator (accent dot + bold subject) when the\n message has not been read.\n\n Storage strategy: link-table (`openregister_email_links`). Per design\n AD-1 the tab does NOT compose — users open Mail, send, return and\n link via the \"Link existing\" picker (compose UI tracked separately).\n-->\n<template>\n\t<div class=\"cn-sidebar-tab cn-email-tab\">\n\t\t<div v-if=\"showActions\" class=\"cn-email-tab__actions\">\n\t\t\t<NcButton variant=\"secondary\" @click=\"openPicker\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<LinkVariant :size=\"18\" />\n\t\t\t\t</template>\n\t\t\t\t{{ linkExistingLabel }}\n\t\t\t</NcButton>\n\t\t\t<NcButton\n\t\t\t\tvariant=\"primary\"\n\t\t\t\t:href=\"composeUrl\"\n\t\t\t\ttarget=\"_blank\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<EmailEditOutline :size=\"18\" />\n\t\t\t\t</template>\n\t\t\t\t{{ composeLabel }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<div v-if=\"loading\" class=\"cn-sidebar-tab__loading\">\n\t\t\t<NcLoadingIcon />\n\t\t</div>\n\t\t<div v-else-if=\"errored === true\" class=\"cn-sidebar-tab__empty cn-sidebar-tab__empty--error\">\n\t\t\t{{ errorLabel }}\n\t\t</div>\n\t\t<div v-else-if=\"messages.length === 0\" class=\"cn-sidebar-tab__empty\">\n\t\t\t{{ noMessagesLabel }}\n\t\t</div>\n\t\t<ul v-else class=\"cn-email-tab__list\">\n\t\t\t<li\n\t\t\t\tv-for=\"row in rows\"\n\t\t\t\t:key=\"row.id\"\n\t\t\t\tclass=\"cn-email-tab__item\">\n\t\t\t\t<component\n\t\t\t\t\t:is=\"row.href ? 'a' : 'div'\"\n\t\t\t\t\tclass=\"cn-email-tab__row\"\n\t\t\t\t\t:class=\"{ 'cn-email-tab__row--unread': row.unread }\"\n\t\t\t\t\tv-bind=\"row.href ? { href: row.href, target: '_blank', rel: 'noopener noreferrer' } : {}\">\n\t\t\t\t\t<span class=\"cn-email-tab__unread-dot\" :class=\"{ 'is-shown': row.unread }\" />\n\t\t\t\t\t<NcAvatar\n\t\t\t\t\t\tclass=\"cn-email-tab__avatar\"\n\t\t\t\t\t\t:size=\"36\"\n\t\t\t\t\t\t:displayName=\"row.avatarName\"\n\t\t\t\t\t\t:user=\"row.avatarUser\"\n\t\t\t\t\t\t:isNoUser=\"true\" />\n\t\t\t\t\t<div class=\"cn-email-tab__body\">\n\t\t\t\t\t\t<div class=\"cn-email-tab__line\">\n\t\t\t\t\t\t\t<span class=\"cn-email-tab__subject\" :title=\"row.subject\">{{ row.subject }}</span>\n\t\t\t\t\t\t\t<span class=\"cn-email-tab__date\">\n\t\t\t\t\t\t\t\t<NcDateTime\n\t\t\t\t\t\t\t\t\tv-if=\"row.dateValid\"\n\t\t\t\t\t\t\t\t\t:timestamp=\"row.dateMs\"\n\t\t\t\t\t\t\t\t\trelativeTime=\"short\" />\n\t\t\t\t\t\t\t\t<template v-else>{{ row.dateRaw }}</template>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"cn-email-tab__sender\" :title=\"row.sender\">\n\t\t\t\t\t\t\t{{ row.sender }}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div v-if=\"row.snippet\" class=\"cn-email-tab__snippet\" :title=\"row.snippet\">\n\t\t\t\t\t\t\t{{ row.snippet }}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</component>\n\t\t\t</li>\n\t\t</ul>\n\t\t<NcButton\n\t\t\tv-if=\"hasMore === true\"\n\t\t\tvariant=\"tertiary\"\n\t\t\t:wide=\"true\"\n\t\t\t:disabled=\"loadingMore\"\n\t\t\tclass=\"cn-sidebar-tab__load-more\"\n\t\t\t@click=\"loadMore\">\n\t\t\t<template v-if=\"loadingMore\" #icon>\n\t\t\t\t<NcLoadingIcon :size=\"20\" />\n\t\t\t</template>\n\t\t\t{{ loadMoreLabel }}\n\t\t</NcButton>\n\n\t\t<CnEmailPicker\n\t\t\tv-if=\"pickerOpen\"\n\t\t\t:apiBase=\"apiBase\"\n\t\t\t@close=\"pickerOpen = false\"\n\t\t\t@link=\"onLinkPick\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcAvatar, NcButton, NcDateTime, NcLoadingIcon } from '@nextcloud/vue'\nimport EmailEditOutline from 'vue-material-design-icons/EmailEditOutline.vue'\nimport LinkVariant from 'vue-material-design-icons/LinkVariant.vue'\nimport CnEmailPicker from '../../../components/CnEmailPicker/CnEmailPicker.vue'\nimport { buildHeaders, prefixUrl } from '../../../utils/index.js'\n\n/**\n * CnEmailTab — sidebar tab rendering the full list of Nextcloud Mail\n * messages linked to an OpenRegister object.\n *\n * Basic usage\n * ```vue\n * <CnEmailTab\n * :object-id=\"objectId\"\n * :register=\"registerId\"\n * :schema=\"schemaId\" />\n * ```\n */\nexport default {\n\tname: 'CnEmailTab',\n\n\tcomponents: {\n\t\tNcAvatar,\n\t\tNcButton,\n\t\tNcDateTime,\n\t\tNcLoadingIcon,\n\t\tEmailEditOutline,\n\t\tLinkVariant,\n\t\tCnEmailPicker,\n\t},\n\n\tprops: {\n\t\t/** Parent object id. */\n\t\tobjectId: { type: String, required: true },\n\t\t/** OpenRegister register id (slug or uuid). */\n\t\tregister: { type: String, default: '' },\n\t\t/** OpenRegister schema id (slug or uuid). */\n\t\tschema: { type: String, default: '' },\n\t\t/** Base API URL. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t\t/** Page size for paged fetches. */\n\t\tpageSize: { type: Number, default: 25 },\n\t\t/** Pre-translated empty label. */\n\t\tnoMessagesLabel: { type: String, default: () => t('nextcloud-vue', 'No linked emails yet') },\n\t\t/** Pre-translated error label. */\n\t\terrorLabel: { type: String, default: () => t('nextcloud-vue', 'Could not load emails') },\n\t\t/** Pre-translated load-more label. */\n\t\tloadMoreLabel: { type: String, default: () => t('nextcloud-vue', 'Load more') },\n\t\t/** Pre-translated fallback subject label. */\n\t\tnoSubjectLabel: { type: String, default: () => t('nextcloud-vue', '(no subject)') },\n\t\t/** Pre-translated fallback sender label. */\n\t\tunknownSenderLabel: { type: String, default: () => t('nextcloud-vue', 'Unknown sender') },\n\t\t/** Pre-translated link-existing CTA label. */\n\t\tlinkExistingLabel: { type: String, default: () => t('nextcloud-vue', 'Link existing email') },\n\t\t/** Pre-translated compose-in-Mail CTA label. */\n\t\tcomposeLabel: { type: String, default: () => t('nextcloud-vue', 'Compose in Mail') },\n\t\t/** Base path for the Mail app (for the compose deep-link). */\n\t\tmailAppPath: { type: String, default: '/index.php/apps/mail' },\n\t\t/**\n\t\t * Whether the tab draws its own \"Link existing email\" and \"Compose in\n\t\t * Mail\" buttons. Off when a host draws them (CnMailTab\n\t\t * `headerActions`) and opens the picker through `openPicker()`.\n\t\t */\n\t\tshowActions: { type: Boolean, default: true },\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tmessages: [],\n\t\t\ttotal: 0,\n\t\t\tnextCursor: null,\n\t\t\tloading: false,\n\t\t\tloadingMore: false,\n\t\t\terrored: false,\n\t\t\tpickerOpen: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Whether a further page is available.\n\t\t *\n\t\t * Prefers the backend's `nextCursor` (Tier-3 standardized\n\t\t * `{items, total, nextCursor}` envelope from the generic\n\t\t * integrations endpoint). Falls back to the count comparison\n\t\t * for any backend that still omits the cursor.\n\t\t *\n\t\t * @return {boolean} True when more messages can be loaded.\n\t\t */\n\t\thasMore() {\n\t\t\tif (this.nextCursor !== null) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn this.messages.length < this.total\n\t\t},\n\n\t\t/**\n\t\t * Pre-computed, template-safe view rows mirroring NC Mail.\n\t\t *\n\t\t * All optional-chaining / nullish logic lives here (in JS) so the\n\t\t * buble-compiled Vue 2 template stays free of `?.` / `??`.\n\t\t *\n\t\t * @return {object[]} One descriptor per message.\n\t\t */\n\t\trows() {\n\t\t\treturn this.messages.map((message) => {\n\t\t\t\tconst dateRaw = this.rawWhen(message)\n\t\t\t\tconst d = dateRaw === '' ? null : new Date(dateRaw)\n\t\t\t\tconst dateValid = d !== null && Number.isNaN(d.getTime()) === false\n\t\t\t\tconst sender = this.formatSender(message)\n\t\t\t\treturn {\n\t\t\t\t\tid: message.id,\n\t\t\t\t\tmessage,\n\t\t\t\t\tsubject: this.formatSubject(message),\n\t\t\t\t\tsender,\n\t\t\t\t\tsnippet: this.formatSnippet(message),\n\t\t\t\t\tunread: this.isUnread(message),\n\t\t\t\t\tdateValid,\n\t\t\t\t\tdateMs: dateValid ? d.getTime() : 0,\n\t\t\t\t\tdateRaw: String(dateRaw),\n\t\t\t\t\tavatarName: sender,\n\t\t\t\t\tavatarUser: this.senderEmail(message),\n\t\t\t\t\thref: this.threadUrl(message),\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Deep-link into NC Mail's new-message composer.\n\t\t *\n\t\t * AD-2 (Mail owns compose / OR owns the link): we do NOT\n\t\t * implement an in-app composer. \"Compose in Mail\" opens NC Mail\n\t\t * in a new tab with the new-message view; once the user has\n\t\t * sent, they return to OR and link the sent message via the\n\t\t * picker.\n\t\t *\n\t\t * @return {string} The composer URL.\n\t\t */\n\t\t/** @return {string} The record, register and schema the list is for. */\n\t\tbindingKey() {\n\t\t\treturn [this.register, this.schema, this.objectId].join('/')\n\t\t},\n\n\t\tcomposeUrl() {\n\t\t\treturn (typeof OC !== 'undefined' && typeof OC.generateUrl === 'function')\n\t\t\t\t? OC.generateUrl('/apps/mail/box/draft')\n\t\t\t\t: `${this.mailAppPath}/box/draft`\n\t\t},\n\t},\n\n\twatch: {\n\t\t/*\n\t\t * The record, its register and its schema together: on a detail page\n\t\t * the id is known first and the register and schema follow, and the\n\t\t * list loads once all three are there.\n\t\t */\n\t\tbindingKey: {\n\t\t\timmediate: true,\n\t\t\thandler() {\n\t\t\t\tif (this.register && this.schema && this.objectId) {\n\t\t\t\t\tthis.reset()\n\t\t\t\t\tthis.fetchMessages()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\treset() {\n\t\t\tthis.messages = []\n\t\t\tthis.total = 0\n\t\t\tthis.nextCursor = null\n\t\t\tthis.errored = false\n\t\t},\n\n\t\tasync fetchMessages(append = false) {\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (append === true) {\n\t\t\t\tthis.loadingMore = true\n\t\t\t} else {\n\t\t\t\tthis.loading = true\n\t\t\t}\n\t\t\tthis.errored = false\n\t\t\ttry {\n\t\t\t\tconst params = new URLSearchParams({ _limit: String(this.pageSize) })\n\t\t\t\t// The Tier-3 envelope's `nextCursor` is the next zero-indexed\n\t\t\t\t// page number consumed by `_page`; walk it on append.\n\t\t\t\tif (append === true && this.nextCursor !== null) {\n\t\t\t\t\tparams.set('_page', String(this.nextCursor))\n\t\t\t\t} else {\n\t\t\t\t\tparams.set('_page', '0')\n\t\t\t\t}\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/integrations/email?${params.toString()}`),\n\t\t\t\t\t{ headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tif (response.ok === true) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tconst list = data.items || data.results || (Array.isArray(data) ? data : []) || []\n\t\t\t\t\tconst items = Array.isArray(list) === true ? list : []\n\t\t\t\t\tthis.messages = append === true ? [...this.messages, ...items] : items\n\t\t\t\t\tthis.total = typeof data.total === 'number' ? data.total : this.messages.length\n\t\t\t\t\tconst next = data.nextCursor\n\t\t\t\t\tthis.nextCursor = (next === null || next === undefined) ? null : next\n\t\t\t\t} else {\n\t\t\t\t\tthis.errored = true\n\t\t\t\t\tif (append !== true) {\n\t\t\t\t\t\tthis.messages = []\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnEmailTab] failed to fetch linked emails', err)\n\t\t\t\tthis.errored = true\n\t\t\t\tif (append !== true) {\n\t\t\t\t\tthis.messages = []\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t\tthis.loadingMore = false\n\t\t\t}\n\t\t},\n\n\t\tloadMore() {\n\t\t\tif (this.nextCursor === null && this.messages.length >= this.total) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.fetchMessages(true)\n\t\t},\n\n\t\tformatSubject(message) {\n\t\t\tconst raw = message.subject\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn this.noSubjectLabel\n\t\t},\n\n\t\tformatSender(message) {\n\t\t\tconst raw = message.senderName || message.fromName || message.sender || message.from\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn this.unknownSenderLabel\n\t\t},\n\n\t\t/**\n\t\t * Best-effort bare email address for the NcAvatar `user` seed so\n\t\t * gravatar/initials are stable per correspondent.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {string} An email-ish identifier, or '' when unknown.\n\t\t */\n\t\tsenderEmail(message) {\n\t\t\tconst candidate = message.senderEmail || message.fromEmail || message.sender || message.from\n\t\t\tif (typeof candidate === 'string' && candidate.indexOf('@') !== -1) {\n\t\t\t\treturn candidate.trim()\n\t\t\t}\n\t\t\treturn ''\n\t\t},\n\n\t\t/**\n\t\t * One-line preview snippet, mirroring NC Mail's message list.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {string} A trimmed snippet, or '' when none is available.\n\t\t */\n\t\tformatSnippet(message) {\n\t\t\tconst raw = message.preview || message.snippet || message.summary || message.bodyPreview\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw.trim()\n\t\t\t}\n\t\t\treturn ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the message is unread, tolerant of the several shapes\n\t\t * the backend may report read-state in.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {boolean} True when the message has not been read.\n\t\t */\n\t\tisUnread(message) {\n\t\t\tif (typeof message.unread === 'boolean') {\n\t\t\t\treturn message.unread\n\t\t\t}\n\t\t\tif (typeof message.isRead === 'boolean') {\n\t\t\t\treturn message.isRead === false\n\t\t\t}\n\t\t\tif (typeof message.seen === 'boolean') {\n\t\t\t\treturn message.seen === false\n\t\t\t}\n\t\t\tif (Array.isArray(message.flags)) {\n\t\t\t\treturn message.flags.indexOf('seen') === -1 && message.flags.indexOf('\\\\Seen') === -1\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\n\t\trawWhen(message) {\n\t\t\tconst raw = message.mailDate || message.date || message.linkedAt\n\t\t\tif (raw === undefined || raw === null || raw === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn raw\n\t\t},\n\n\t\t// Thread deep-link into NC Mail; undefined when the row lacks ids.\n\t\tthreadUrl(message) {\n\t\t\tconst accountId = message.mailAccountId\n\t\t\tconst messageId = message.mailMessageId\n\t\t\tif (accountId === undefined || accountId === null || messageId === undefined || messageId === null) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\treturn (typeof OC !== 'undefined' && typeof OC.generateUrl === 'function')\n\t\t\t\t? OC.generateUrl(`/apps/mail/box/${accountId}/thread/${messageId}`)\n\t\t\t\t: `/index.php/apps/mail/box/${accountId}/thread/${messageId}`\n\t\t},\n\n\t\topenPicker() {\n\t\t\tthis.pickerOpen = true\n\t\t},\n\n\t\tasync onLinkPick(payload) {\n\t\t\tthis.pickerOpen = false\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/emails`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: { ...buildHeaders(), 'Content-Type': 'application/json' },\n\t\t\t\t\t\tbody: JSON.stringify(payload),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tif (response.ok === true || response.status === 409) {\n\t\t\t\t\t// 409 = already-linked; treated as success since the row\n\t\t\t\t\t// already exists for this object.\n\t\t\t\t\tthis.reset()\n\t\t\t\t\tawait this.fetchMessages()\n\t\t\t\t} else {\n\t\t\t\t\tthis.errored = true\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnEmailTab] link failed', err)\n\t\t\t\tthis.errored = true\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-sidebar-tab {\n\tpadding: 12px;\n\toverflow-x: hidden;\n}\n\n.cn-sidebar-tab__loading {\n\tdisplay: flex;\n\tjustify-content: center;\n\tpadding: 24px 0;\n}\n\n.cn-sidebar-tab__empty {\n\ttext-align: center;\n\tpadding: 24px 12px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-sidebar-tab__empty--error {\n\tcolor: var(--color-error);\n}\n\n.cn-sidebar-tab__load-more {\n\tmargin-top: 8px;\n}\n\n.cn-email-tab__actions {\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\tmargin-bottom: 8px;\n}\n\n/* NC-Mail-style message list */\n.cn-email-tab__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n.cn-email-tab__row {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 10px;\n\tpadding: 8px 6px;\n\tborder-radius: var(--border-radius-large, 8px);\n\tcolor: inherit;\n\ttext-decoration: none;\n\tposition: relative;\n}\n\n/* Only a row with Mail ids is a link; the rest must not look clickable. */\na.cn-email-tab__row {\n\tcursor: pointer;\n}\n\na.cn-email-tab__row:hover {\n\tbackground-color: var(--color-background-hover);\n}\n\n.cn-email-tab__unread-dot {\n\tflex: 0 0 auto;\n\twidth: 8px;\n\talign-self: center;\n\tvisibility: hidden;\n}\n\n.cn-email-tab__unread-dot.is-shown {\n\tvisibility: visible;\n}\n\n.cn-email-tab__unread-dot.is-shown::before {\n\tcontent: '';\n\tdisplay: block;\n\twidth: 8px;\n\theight: 8px;\n\tborder-radius: 50%;\n\tbackground-color: var(--cn-email-accent, var(--color-primary-element));\n}\n\n.cn-email-tab__avatar {\n\tflex: 0 0 auto;\n}\n\n.cn-email-tab__body {\n\tflex: 1 1 auto;\n\tmin-width: 0;\n}\n\n.cn-email-tab__line {\n\tdisplay: flex;\n\talign-items: baseline;\n\tgap: 8px;\n}\n\n.cn-email-tab__subject {\n\tflex: 1 1 auto;\n\tmin-width: 0;\n\tcolor: var(--color-main-text);\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__row--unread .cn-email-tab__subject {\n\tfont-weight: bold;\n}\n\n.cn-email-tab__date {\n\tflex: 0 0 auto;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.8em;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__sender {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__snippet {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\tmargin-top: 1px;\n}\n</style>\n"],"names":["CnEmailPicker","t"],"mappings":";;;;;;;AAiHA;;AAEC;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,YAAY;;CAElB,UAAU,EAAE;AACX,EAAA,QAAQ;AACR,EAAA,QAAQ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C,WAAW,GAAG,EAAE;;;KAGpD,IAAI,CAAC,KAAK,GAAC;KACX,MAAM,IAAI,CAAC,aAAa,GAAC;KACxB,MAAK;AACN,KAAA,IAAI,CAAC,OAAM,GAAI,KAAG;AACnB,KAAA;IACC,CAAA,OAAO,GAAG,EAAE;AACb;AACA,IAAA,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,GAAG,EAAA;AAC7C,IAAA,IAAI,CAAC,OAAM,GAAI,KAAG;AACnB,IAAA;GACA;EACD;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnEmailTab.vue3.js","sources":["../../../../../src/integrations/builtin/email/CnEmailTab.vue?vue&type=template&id=51ed88c0&lang.js"],"sourcesContent":["<!--\n CnEmailTab — sidebar tab for the `email` integration.\n\n Renders the full list of Nextcloud Mail messages linked to an OR\n object. Backed by `EmailService` via the registry endpoint\n (`/integrations/email`). Paged via load-more; rows deep-link into the\n NC Mail app per AD-2 (Mail owns compose, OR owns the link).\n\n Visual fidelity: mirrors the real NC Mail message list — a sender\n avatar, a bold subject, a \"sender · date\" subline, a one-line snippet\n preview, and an unread indicator (accent dot + bold subject) when the\n message has not been read.\n\n Storage strategy: link-table (`openregister_email_links`). Per design\n AD-1 the tab does NOT compose — users open Mail, send, return and\n link via the \"Link existing\" picker (compose UI tracked separately).\n-->\n<template>\n\t<div class=\"cn-sidebar-tab cn-email-tab\">\n\t\t<div v-if=\"showActions\" class=\"cn-email-tab__actions\">\n\t\t\t<NcButton variant=\"secondary\" @click=\"openPicker\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<LinkVariant :size=\"18\" />\n\t\t\t\t</template>\n\t\t\t\t{{ linkExistingLabel }}\n\t\t\t</NcButton>\n\t\t\t<NcButton\n\t\t\t\tvariant=\"primary\"\n\t\t\t\t:href=\"composeUrl\"\n\t\t\t\ttarget=\"_blank\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<EmailEditOutline :size=\"18\" />\n\t\t\t\t</template>\n\t\t\t\t{{ composeLabel }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<div v-if=\"loading\" class=\"cn-sidebar-tab__loading\">\n\t\t\t<NcLoadingIcon />\n\t\t</div>\n\t\t<div v-else-if=\"errored === true\" class=\"cn-sidebar-tab__empty cn-sidebar-tab__empty--error\">\n\t\t\t{{ errorLabel }}\n\t\t</div>\n\t\t<div v-else-if=\"messages.length === 0\" class=\"cn-sidebar-tab__empty\">\n\t\t\t{{ noMessagesLabel }}\n\t\t</div>\n\t\t<ul v-else class=\"cn-email-tab__list\">\n\t\t\t<li\n\t\t\t\tv-for=\"row in rows\"\n\t\t\t\t:key=\"row.id\"\n\t\t\t\tclass=\"cn-email-tab__item\">\n\t\t\t\t<component\n\t\t\t\t\t:is=\"row.href ? 'a' : 'div'\"\n\t\t\t\t\tclass=\"cn-email-tab__row\"\n\t\t\t\t\t:class=\"{ 'cn-email-tab__row--unread': row.unread }\"\n\t\t\t\t\tv-bind=\"row.href ? { href: row.href, target: '_blank', rel: 'noopener noreferrer' } : {}\">\n\t\t\t\t\t<span class=\"cn-email-tab__unread-dot\" :class=\"{ 'is-shown': row.unread }\" />\n\t\t\t\t\t<NcAvatar\n\t\t\t\t\t\tclass=\"cn-email-tab__avatar\"\n\t\t\t\t\t\t:size=\"36\"\n\t\t\t\t\t\t:displayName=\"row.avatarName\"\n\t\t\t\t\t\t:user=\"row.avatarUser\"\n\t\t\t\t\t\t:isNoUser=\"true\" />\n\t\t\t\t\t<div class=\"cn-email-tab__body\">\n\t\t\t\t\t\t<div class=\"cn-email-tab__line\">\n\t\t\t\t\t\t\t<span class=\"cn-email-tab__subject\" :title=\"row.subject\">{{ row.subject }}</span>\n\t\t\t\t\t\t\t<span class=\"cn-email-tab__date\">\n\t\t\t\t\t\t\t\t<NcDateTime\n\t\t\t\t\t\t\t\t\tv-if=\"row.dateValid\"\n\t\t\t\t\t\t\t\t\t:timestamp=\"row.dateMs\"\n\t\t\t\t\t\t\t\t\trelativeTime=\"short\" />\n\t\t\t\t\t\t\t\t<template v-else>{{ row.dateRaw }}</template>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"cn-email-tab__sender\" :title=\"row.sender\">\n\t\t\t\t\t\t\t{{ row.sender }}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div v-if=\"row.snippet\" class=\"cn-email-tab__snippet\" :title=\"row.snippet\">\n\t\t\t\t\t\t\t{{ row.snippet }}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</component>\n\t\t\t</li>\n\t\t</ul>\n\t\t<NcButton\n\t\t\tv-if=\"hasMore === true\"\n\t\t\tvariant=\"tertiary\"\n\t\t\t:wide=\"true\"\n\t\t\t:disabled=\"loadingMore\"\n\t\t\tclass=\"cn-sidebar-tab__load-more\"\n\t\t\t@click=\"loadMore\">\n\t\t\t<template v-if=\"loadingMore\" #icon>\n\t\t\t\t<NcLoadingIcon :size=\"20\" />\n\t\t\t</template>\n\t\t\t{{ loadMoreLabel }}\n\t\t</NcButton>\n\n\t\t<CnEmailPicker\n\t\t\tv-if=\"pickerOpen\"\n\t\t\t:apiBase=\"apiBase\"\n\t\t\t@close=\"pickerOpen = false\"\n\t\t\t@link=\"onLinkPick\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcAvatar, NcButton, NcDateTime, NcLoadingIcon } from '@nextcloud/vue'\nimport EmailEditOutline from 'vue-material-design-icons/EmailEditOutline.vue'\nimport LinkVariant from 'vue-material-design-icons/LinkVariant.vue'\nimport CnEmailPicker from '../../../components/CnEmailPicker/CnEmailPicker.vue'\nimport { buildHeaders, prefixUrl } from '../../../utils/index.js'\n\n/**\n * CnEmailTab — sidebar tab rendering the full list of Nextcloud Mail\n * messages linked to an OpenRegister object.\n *\n * Basic usage\n * ```vue\n * <CnEmailTab\n * :object-id=\"objectId\"\n * :register=\"registerId\"\n * :schema=\"schemaId\" />\n * ```\n */\nexport default {\n\tname: 'CnEmailTab',\n\n\tcomponents: {\n\t\tNcAvatar,\n\t\tNcButton,\n\t\tNcDateTime,\n\t\tNcLoadingIcon,\n\t\tEmailEditOutline,\n\t\tLinkVariant,\n\t\tCnEmailPicker,\n\t},\n\n\tprops: {\n\t\t/** Parent object id. */\n\t\tobjectId: { type: String, required: true },\n\t\t/** OpenRegister register id (slug or uuid). */\n\t\tregister: { type: String, default: '' },\n\t\t/** OpenRegister schema id (slug or uuid). */\n\t\tschema: { type: String, default: '' },\n\t\t/** Base API URL. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t\t/** Page size for paged fetches. */\n\t\tpageSize: { type: Number, default: 25 },\n\t\t/** Pre-translated empty label. */\n\t\tnoMessagesLabel: { type: String, default: () => t('nextcloud-vue', 'No linked emails yet') },\n\t\t/** Pre-translated error label. */\n\t\terrorLabel: { type: String, default: () => t('nextcloud-vue', 'Could not load emails') },\n\t\t/** Pre-translated load-more label. */\n\t\tloadMoreLabel: { type: String, default: () => t('nextcloud-vue', 'Load more') },\n\t\t/** Pre-translated fallback subject label. */\n\t\tnoSubjectLabel: { type: String, default: () => t('nextcloud-vue', '(no subject)') },\n\t\t/** Pre-translated fallback sender label. */\n\t\tunknownSenderLabel: { type: String, default: () => t('nextcloud-vue', 'Unknown sender') },\n\t\t/** Pre-translated link-existing CTA label. */\n\t\tlinkExistingLabel: { type: String, default: () => t('nextcloud-vue', 'Link existing email') },\n\t\t/** Pre-translated compose-in-Mail CTA label. */\n\t\tcomposeLabel: { type: String, default: () => t('nextcloud-vue', 'Compose in Mail') },\n\t\t/** Base path for the Mail app (for the compose deep-link). */\n\t\tmailAppPath: { type: String, default: '/index.php/apps/mail' },\n\t\t/**\n\t\t * Whether the tab draws its own \"Link existing email\" and \"Compose in\n\t\t * Mail\" buttons. Off when a host draws them (CnMailTab\n\t\t * `headerActions`) and opens the picker through `openPicker()`.\n\t\t */\n\t\tshowActions: { type: Boolean, default: true },\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tmessages: [],\n\t\t\ttotal: 0,\n\t\t\tnextCursor: null,\n\t\t\tloading: false,\n\t\t\tloadingMore: false,\n\t\t\terrored: false,\n\t\t\tpickerOpen: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Whether a further page is available.\n\t\t *\n\t\t * Prefers the backend's `nextCursor` (Tier-3 standardized\n\t\t * `{items, total, nextCursor}` envelope from the generic\n\t\t * integrations endpoint). Falls back to the count comparison\n\t\t * for any backend that still omits the cursor.\n\t\t *\n\t\t * @return {boolean} True when more messages can be loaded.\n\t\t */\n\t\thasMore() {\n\t\t\tif (this.nextCursor !== null) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn this.messages.length < this.total\n\t\t},\n\n\t\t/**\n\t\t * Pre-computed, template-safe view rows mirroring NC Mail.\n\t\t *\n\t\t * All optional-chaining / nullish logic lives here (in JS) so the\n\t\t * buble-compiled Vue 2 template stays free of `?.` / `??`.\n\t\t *\n\t\t * @return {object[]} One descriptor per message.\n\t\t */\n\t\trows() {\n\t\t\treturn this.messages.map((message) => {\n\t\t\t\tconst dateRaw = this.rawWhen(message)\n\t\t\t\tconst d = dateRaw === '' ? null : new Date(dateRaw)\n\t\t\t\tconst dateValid = d !== null && Number.isNaN(d.getTime()) === false\n\t\t\t\tconst sender = this.formatSender(message)\n\t\t\t\treturn {\n\t\t\t\t\tid: message.id,\n\t\t\t\t\tmessage,\n\t\t\t\t\tsubject: this.formatSubject(message),\n\t\t\t\t\tsender,\n\t\t\t\t\tsnippet: this.formatSnippet(message),\n\t\t\t\t\tunread: this.isUnread(message),\n\t\t\t\t\tdateValid,\n\t\t\t\t\tdateMs: dateValid ? d.getTime() : 0,\n\t\t\t\t\tdateRaw: String(dateRaw),\n\t\t\t\t\tavatarName: sender,\n\t\t\t\t\tavatarUser: this.senderEmail(message),\n\t\t\t\t\thref: this.threadUrl(message),\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Deep-link into NC Mail's new-message composer.\n\t\t *\n\t\t * AD-2 (Mail owns compose / OR owns the link): we do NOT\n\t\t * implement an in-app composer. \"Compose in Mail\" opens NC Mail\n\t\t * in a new tab with the new-message view; once the user has\n\t\t * sent, they return to OR and link the sent message via the\n\t\t * picker.\n\t\t *\n\t\t * @return {string} The composer URL.\n\t\t */\n\t\tcomposeUrl() {\n\t\t\treturn (typeof OC !== 'undefined' && typeof OC.generateUrl === 'function')\n\t\t\t\t? OC.generateUrl('/apps/mail/box/draft')\n\t\t\t\t: `${this.mailAppPath}/box/draft`\n\t\t},\n\t},\n\n\twatch: {\n\t\tobjectId: {\n\t\t\timmediate: true,\n\t\t\thandler(id) {\n\t\t\t\tif (id) {\n\t\t\t\t\tthis.reset()\n\t\t\t\t\tthis.fetchMessages()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\treset() {\n\t\t\tthis.messages = []\n\t\t\tthis.total = 0\n\t\t\tthis.nextCursor = null\n\t\t\tthis.errored = false\n\t\t},\n\n\t\tasync fetchMessages(append = false) {\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (append === true) {\n\t\t\t\tthis.loadingMore = true\n\t\t\t} else {\n\t\t\t\tthis.loading = true\n\t\t\t}\n\t\t\tthis.errored = false\n\t\t\ttry {\n\t\t\t\tconst params = new URLSearchParams({ _limit: String(this.pageSize) })\n\t\t\t\t// The Tier-3 envelope's `nextCursor` is the next zero-indexed\n\t\t\t\t// page number consumed by `_page`; walk it on append.\n\t\t\t\tif (append === true && this.nextCursor !== null) {\n\t\t\t\t\tparams.set('_page', String(this.nextCursor))\n\t\t\t\t} else {\n\t\t\t\t\tparams.set('_page', '0')\n\t\t\t\t}\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/integrations/email?${params.toString()}`),\n\t\t\t\t\t{ headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tif (response.ok === true) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tconst list = data.items || data.results || (Array.isArray(data) ? data : []) || []\n\t\t\t\t\tconst items = Array.isArray(list) === true ? list : []\n\t\t\t\t\tthis.messages = append === true ? [...this.messages, ...items] : items\n\t\t\t\t\tthis.total = typeof data.total === 'number' ? data.total : this.messages.length\n\t\t\t\t\tconst next = data.nextCursor\n\t\t\t\t\tthis.nextCursor = (next === null || next === undefined) ? null : next\n\t\t\t\t} else {\n\t\t\t\t\tthis.errored = true\n\t\t\t\t\tif (append !== true) {\n\t\t\t\t\t\tthis.messages = []\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnEmailTab] failed to fetch linked emails', err)\n\t\t\t\tthis.errored = true\n\t\t\t\tif (append !== true) {\n\t\t\t\t\tthis.messages = []\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t\tthis.loadingMore = false\n\t\t\t}\n\t\t},\n\n\t\tloadMore() {\n\t\t\tif (this.nextCursor === null && this.messages.length >= this.total) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.fetchMessages(true)\n\t\t},\n\n\t\tformatSubject(message) {\n\t\t\tconst raw = message.subject\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn this.noSubjectLabel\n\t\t},\n\n\t\tformatSender(message) {\n\t\t\tconst raw = message.senderName || message.fromName || message.sender || message.from\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn this.unknownSenderLabel\n\t\t},\n\n\t\t/**\n\t\t * Best-effort bare email address for the NcAvatar `user` seed so\n\t\t * gravatar/initials are stable per correspondent.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {string} An email-ish identifier, or '' when unknown.\n\t\t */\n\t\tsenderEmail(message) {\n\t\t\tconst candidate = message.senderEmail || message.fromEmail || message.sender || message.from\n\t\t\tif (typeof candidate === 'string' && candidate.indexOf('@') !== -1) {\n\t\t\t\treturn candidate.trim()\n\t\t\t}\n\t\t\treturn ''\n\t\t},\n\n\t\t/**\n\t\t * One-line preview snippet, mirroring NC Mail's message list.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {string} A trimmed snippet, or '' when none is available.\n\t\t */\n\t\tformatSnippet(message) {\n\t\t\tconst raw = message.preview || message.snippet || message.summary || message.bodyPreview\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw.trim()\n\t\t\t}\n\t\t\treturn ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the message is unread, tolerant of the several shapes\n\t\t * the backend may report read-state in.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {boolean} True when the message has not been read.\n\t\t */\n\t\tisUnread(message) {\n\t\t\tif (typeof message.unread === 'boolean') {\n\t\t\t\treturn message.unread\n\t\t\t}\n\t\t\tif (typeof message.isRead === 'boolean') {\n\t\t\t\treturn message.isRead === false\n\t\t\t}\n\t\t\tif (typeof message.seen === 'boolean') {\n\t\t\t\treturn message.seen === false\n\t\t\t}\n\t\t\tif (Array.isArray(message.flags)) {\n\t\t\t\treturn message.flags.indexOf('seen') === -1 && message.flags.indexOf('\\\\Seen') === -1\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\n\t\trawWhen(message) {\n\t\t\tconst raw = message.mailDate || message.date || message.linkedAt\n\t\t\tif (raw === undefined || raw === null || raw === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn raw\n\t\t},\n\n\t\t// Thread deep-link into NC Mail; undefined when the row lacks ids.\n\t\tthreadUrl(message) {\n\t\t\tconst accountId = message.mailAccountId\n\t\t\tconst messageId = message.mailMessageId\n\t\t\tif (accountId === undefined || accountId === null || messageId === undefined || messageId === null) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\treturn (typeof OC !== 'undefined' && typeof OC.generateUrl === 'function')\n\t\t\t\t? OC.generateUrl(`/apps/mail/box/${accountId}/thread/${messageId}`)\n\t\t\t\t: `/index.php/apps/mail/box/${accountId}/thread/${messageId}`\n\t\t},\n\n\t\topenPicker() {\n\t\t\tthis.pickerOpen = true\n\t\t},\n\n\t\tasync onLinkPick(payload) {\n\t\t\tthis.pickerOpen = false\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/emails`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: { ...buildHeaders(), 'Content-Type': 'application/json' },\n\t\t\t\t\t\tbody: JSON.stringify(payload),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tif (response.ok === true || response.status === 409) {\n\t\t\t\t\t// 409 = already-linked; treated as success since the row\n\t\t\t\t\t// already exists for this object.\n\t\t\t\t\tthis.reset()\n\t\t\t\t\tawait this.fetchMessages()\n\t\t\t\t} else {\n\t\t\t\t\tthis.errored = true\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnEmailTab] link failed', err)\n\t\t\t\tthis.errored = true\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-sidebar-tab {\n\tpadding: 12px;\n\toverflow-x: hidden;\n}\n\n.cn-sidebar-tab__loading {\n\tdisplay: flex;\n\tjustify-content: center;\n\tpadding: 24px 0;\n}\n\n.cn-sidebar-tab__empty {\n\ttext-align: center;\n\tpadding: 24px 12px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-sidebar-tab__empty--error {\n\tcolor: var(--color-error);\n}\n\n.cn-sidebar-tab__load-more {\n\tmargin-top: 8px;\n}\n\n.cn-email-tab__actions {\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\tmargin-bottom: 8px;\n}\n\n/* NC-Mail-style message list */\n.cn-email-tab__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n.cn-email-tab__row {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 10px;\n\tpadding: 8px 6px;\n\tborder-radius: var(--border-radius-large, 8px);\n\tcolor: inherit;\n\ttext-decoration: none;\n\tposition: relative;\n}\n\n/* Only a row with Mail ids is a link; the rest must not look clickable. */\na.cn-email-tab__row {\n\tcursor: pointer;\n}\n\na.cn-email-tab__row:hover {\n\tbackground-color: var(--color-background-hover);\n}\n\n.cn-email-tab__unread-dot {\n\tflex: 0 0 auto;\n\twidth: 8px;\n\talign-self: center;\n\tvisibility: hidden;\n}\n\n.cn-email-tab__unread-dot.is-shown {\n\tvisibility: visible;\n}\n\n.cn-email-tab__unread-dot.is-shown::before {\n\tcontent: '';\n\tdisplay: block;\n\twidth: 8px;\n\theight: 8px;\n\tborder-radius: 50%;\n\tbackground-color: var(--cn-email-accent, var(--color-primary-element));\n}\n\n.cn-email-tab__avatar {\n\tflex: 0 0 auto;\n}\n\n.cn-email-tab__body {\n\tflex: 1 1 auto;\n\tmin-width: 0;\n}\n\n.cn-email-tab__line {\n\tdisplay: flex;\n\talign-items: baseline;\n\tgap: 8px;\n}\n\n.cn-email-tab__subject {\n\tflex: 1 1 auto;\n\tmin-width: 0;\n\tcolor: var(--color-main-text);\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__row--unread .cn-email-tab__subject {\n\tfont-weight: bold;\n}\n\n.cn-email-tab__date {\n\tflex: 0 0 auto;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.8em;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__sender {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__snippet {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\tmargin-top: 1px;\n}\n</style>\n"],"names":["_createVNode","_createTextVNode","_createElementBlock","_toDisplayString","_openBlock","_Fragment","_renderList","_createBlock","_resolveDynamicComponent","_mergeProps","_normalizeClass","_createElementVNode"],"mappings":";;AAmCM,MAAA,UAAA,GAAA,EAAA,KAAC,EAAA,6BAAA,GAAA;;;;;;;AAmBe,EAAA,KAAK,EAAC,yBAAyB;;;;AAGxC,EAAA,KAAA,EAAA,oDAAA;;;;AAGqB,EAAA,KAAA,EAAA,uBAAA;;;;AAGrB,EAAA,KAAK,EAAC,oBAAiB;;AAiB1B,MAAA,UAAA,GAAA,EAAA,KAAA,EAAA,oBAAA,GAAA;AACC,MAAA,UAAA,GAAA,EAAA,KAAI,EAAA,oBAAA,GAAA;;AAET,MAAA,WAAA,GAAA,EAAA,KAAA,EAAA,oBAAA,GAAA;;;;;;;;;;;;;;;yCA/BE,iBAAA,EAAA;UAfLA,WAKI,CAAA,mBAAA,EAAA;AALM,YAAA,OAAO,aAAY;AAAE,YAAA,OAAK,EAAE,QAAU,CAAA,UAAA;;AACpC,YAAA,IAAI,UACd,MAAE;cAAFA,WAAE,CAAA,sBAAA,EAAA,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;;6BACQ,MACX;AADW,cAAAC,eAAA,CAAA,GACX,mBAAG,MAAW,CAAA,iBAAA,CAAA,EAAA,CAAA,YAAA;;;;UAEfD,WAQU,CAAA,mBAAA,EAAA;AAPT,YAAA,OAAO,EAAC;AACP,YAAA,IAAE,EAAA,QAAA,CAAA,UAAA;AACH,YAAA,MAAM,EAAC,QAAQ;;AACd,YAAA,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AA,OAAA;AACX,6BAAA,EAAAC,eAAA,CAAA,GAAE,CAAA,OAAA,CAAA,EAAA,CAAA,oBAAA,WAAA,CAAA;;;;;;;;;KAON,QAAA,CAAA,OAAA,KAAA,IAAA;sBADHI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnEmailTab.vue3.js","sources":["../../../../../src/integrations/builtin/email/CnEmailTab.vue?vue&type=template&id=037e1455&lang.js"],"sourcesContent":["<!--\n CnEmailTab — sidebar tab for the `email` integration.\n\n Renders the full list of Nextcloud Mail messages linked to an OR\n object. Backed by `EmailService` via the registry endpoint\n (`/integrations/email`). Paged via load-more; rows deep-link into the\n NC Mail app per AD-2 (Mail owns compose, OR owns the link).\n\n Visual fidelity: mirrors the real NC Mail message list — a sender\n avatar, a bold subject, a \"sender · date\" subline, a one-line snippet\n preview, and an unread indicator (accent dot + bold subject) when the\n message has not been read.\n\n Storage strategy: link-table (`openregister_email_links`). Per design\n AD-1 the tab does NOT compose — users open Mail, send, return and\n link via the \"Link existing\" picker (compose UI tracked separately).\n-->\n<template>\n\t<div class=\"cn-sidebar-tab cn-email-tab\">\n\t\t<div v-if=\"showActions\" class=\"cn-email-tab__actions\">\n\t\t\t<NcButton variant=\"secondary\" @click=\"openPicker\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<LinkVariant :size=\"18\" />\n\t\t\t\t</template>\n\t\t\t\t{{ linkExistingLabel }}\n\t\t\t</NcButton>\n\t\t\t<NcButton\n\t\t\t\tvariant=\"primary\"\n\t\t\t\t:href=\"composeUrl\"\n\t\t\t\ttarget=\"_blank\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<EmailEditOutline :size=\"18\" />\n\t\t\t\t</template>\n\t\t\t\t{{ composeLabel }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<div v-if=\"loading\" class=\"cn-sidebar-tab__loading\">\n\t\t\t<NcLoadingIcon />\n\t\t</div>\n\t\t<div v-else-if=\"errored === true\" class=\"cn-sidebar-tab__empty cn-sidebar-tab__empty--error\">\n\t\t\t{{ errorLabel }}\n\t\t</div>\n\t\t<div v-else-if=\"messages.length === 0\" class=\"cn-sidebar-tab__empty\">\n\t\t\t{{ noMessagesLabel }}\n\t\t</div>\n\t\t<ul v-else class=\"cn-email-tab__list\">\n\t\t\t<li\n\t\t\t\tv-for=\"row in rows\"\n\t\t\t\t:key=\"row.id\"\n\t\t\t\tclass=\"cn-email-tab__item\">\n\t\t\t\t<component\n\t\t\t\t\t:is=\"row.href ? 'a' : 'div'\"\n\t\t\t\t\tclass=\"cn-email-tab__row\"\n\t\t\t\t\t:class=\"{ 'cn-email-tab__row--unread': row.unread }\"\n\t\t\t\t\tv-bind=\"row.href ? { href: row.href, target: '_blank', rel: 'noopener noreferrer' } : {}\">\n\t\t\t\t\t<span class=\"cn-email-tab__unread-dot\" :class=\"{ 'is-shown': row.unread }\" />\n\t\t\t\t\t<NcAvatar\n\t\t\t\t\t\tclass=\"cn-email-tab__avatar\"\n\t\t\t\t\t\t:size=\"36\"\n\t\t\t\t\t\t:displayName=\"row.avatarName\"\n\t\t\t\t\t\t:user=\"row.avatarUser\"\n\t\t\t\t\t\t:isNoUser=\"true\" />\n\t\t\t\t\t<div class=\"cn-email-tab__body\">\n\t\t\t\t\t\t<div class=\"cn-email-tab__line\">\n\t\t\t\t\t\t\t<span class=\"cn-email-tab__subject\" :title=\"row.subject\">{{ row.subject }}</span>\n\t\t\t\t\t\t\t<span class=\"cn-email-tab__date\">\n\t\t\t\t\t\t\t\t<NcDateTime\n\t\t\t\t\t\t\t\t\tv-if=\"row.dateValid\"\n\t\t\t\t\t\t\t\t\t:timestamp=\"row.dateMs\"\n\t\t\t\t\t\t\t\t\trelativeTime=\"short\" />\n\t\t\t\t\t\t\t\t<template v-else>{{ row.dateRaw }}</template>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"cn-email-tab__sender\" :title=\"row.sender\">\n\t\t\t\t\t\t\t{{ row.sender }}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div v-if=\"row.snippet\" class=\"cn-email-tab__snippet\" :title=\"row.snippet\">\n\t\t\t\t\t\t\t{{ row.snippet }}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</component>\n\t\t\t</li>\n\t\t</ul>\n\t\t<NcButton\n\t\t\tv-if=\"hasMore === true\"\n\t\t\tvariant=\"tertiary\"\n\t\t\t:wide=\"true\"\n\t\t\t:disabled=\"loadingMore\"\n\t\t\tclass=\"cn-sidebar-tab__load-more\"\n\t\t\t@click=\"loadMore\">\n\t\t\t<template v-if=\"loadingMore\" #icon>\n\t\t\t\t<NcLoadingIcon :size=\"20\" />\n\t\t\t</template>\n\t\t\t{{ loadMoreLabel }}\n\t\t</NcButton>\n\n\t\t<CnEmailPicker\n\t\t\tv-if=\"pickerOpen\"\n\t\t\t:apiBase=\"apiBase\"\n\t\t\t@close=\"pickerOpen = false\"\n\t\t\t@link=\"onLinkPick\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcAvatar, NcButton, NcDateTime, NcLoadingIcon } from '@nextcloud/vue'\nimport EmailEditOutline from 'vue-material-design-icons/EmailEditOutline.vue'\nimport LinkVariant from 'vue-material-design-icons/LinkVariant.vue'\nimport CnEmailPicker from '../../../components/CnEmailPicker/CnEmailPicker.vue'\nimport { buildHeaders, prefixUrl } from '../../../utils/index.js'\n\n/**\n * CnEmailTab — sidebar tab rendering the full list of Nextcloud Mail\n * messages linked to an OpenRegister object.\n *\n * Basic usage\n * ```vue\n * <CnEmailTab\n * :object-id=\"objectId\"\n * :register=\"registerId\"\n * :schema=\"schemaId\" />\n * ```\n */\nexport default {\n\tname: 'CnEmailTab',\n\n\tcomponents: {\n\t\tNcAvatar,\n\t\tNcButton,\n\t\tNcDateTime,\n\t\tNcLoadingIcon,\n\t\tEmailEditOutline,\n\t\tLinkVariant,\n\t\tCnEmailPicker,\n\t},\n\n\tprops: {\n\t\t/** Parent object id. */\n\t\tobjectId: { type: String, required: true },\n\t\t/** OpenRegister register id (slug or uuid). */\n\t\tregister: { type: String, default: '' },\n\t\t/** OpenRegister schema id (slug or uuid). */\n\t\tschema: { type: String, default: '' },\n\t\t/** Base API URL. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t\t/** Page size for paged fetches. */\n\t\tpageSize: { type: Number, default: 25 },\n\t\t/** Pre-translated empty label. */\n\t\tnoMessagesLabel: { type: String, default: () => t('nextcloud-vue', 'No linked emails yet') },\n\t\t/** Pre-translated error label. */\n\t\terrorLabel: { type: String, default: () => t('nextcloud-vue', 'Could not load emails') },\n\t\t/** Pre-translated load-more label. */\n\t\tloadMoreLabel: { type: String, default: () => t('nextcloud-vue', 'Load more') },\n\t\t/** Pre-translated fallback subject label. */\n\t\tnoSubjectLabel: { type: String, default: () => t('nextcloud-vue', '(no subject)') },\n\t\t/** Pre-translated fallback sender label. */\n\t\tunknownSenderLabel: { type: String, default: () => t('nextcloud-vue', 'Unknown sender') },\n\t\t/** Pre-translated link-existing CTA label. */\n\t\tlinkExistingLabel: { type: String, default: () => t('nextcloud-vue', 'Link existing email') },\n\t\t/** Pre-translated compose-in-Mail CTA label. */\n\t\tcomposeLabel: { type: String, default: () => t('nextcloud-vue', 'Compose in Mail') },\n\t\t/** Base path for the Mail app (for the compose deep-link). */\n\t\tmailAppPath: { type: String, default: '/index.php/apps/mail' },\n\t\t/**\n\t\t * Whether the tab draws its own \"Link existing email\" and \"Compose in\n\t\t * Mail\" buttons. Off when a host draws them (CnMailTab\n\t\t * `headerActions`) and opens the picker through `openPicker()`.\n\t\t */\n\t\tshowActions: { type: Boolean, default: true },\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tmessages: [],\n\t\t\ttotal: 0,\n\t\t\tnextCursor: null,\n\t\t\tloading: false,\n\t\t\tloadingMore: false,\n\t\t\terrored: false,\n\t\t\tpickerOpen: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Whether a further page is available.\n\t\t *\n\t\t * Prefers the backend's `nextCursor` (Tier-3 standardized\n\t\t * `{items, total, nextCursor}` envelope from the generic\n\t\t * integrations endpoint). Falls back to the count comparison\n\t\t * for any backend that still omits the cursor.\n\t\t *\n\t\t * @return {boolean} True when more messages can be loaded.\n\t\t */\n\t\thasMore() {\n\t\t\tif (this.nextCursor !== null) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn this.messages.length < this.total\n\t\t},\n\n\t\t/**\n\t\t * Pre-computed, template-safe view rows mirroring NC Mail.\n\t\t *\n\t\t * All optional-chaining / nullish logic lives here (in JS) so the\n\t\t * buble-compiled Vue 2 template stays free of `?.` / `??`.\n\t\t *\n\t\t * @return {object[]} One descriptor per message.\n\t\t */\n\t\trows() {\n\t\t\treturn this.messages.map((message) => {\n\t\t\t\tconst dateRaw = this.rawWhen(message)\n\t\t\t\tconst d = dateRaw === '' ? null : new Date(dateRaw)\n\t\t\t\tconst dateValid = d !== null && Number.isNaN(d.getTime()) === false\n\t\t\t\tconst sender = this.formatSender(message)\n\t\t\t\treturn {\n\t\t\t\t\tid: message.id,\n\t\t\t\t\tmessage,\n\t\t\t\t\tsubject: this.formatSubject(message),\n\t\t\t\t\tsender,\n\t\t\t\t\tsnippet: this.formatSnippet(message),\n\t\t\t\t\tunread: this.isUnread(message),\n\t\t\t\t\tdateValid,\n\t\t\t\t\tdateMs: dateValid ? d.getTime() : 0,\n\t\t\t\t\tdateRaw: String(dateRaw),\n\t\t\t\t\tavatarName: sender,\n\t\t\t\t\tavatarUser: this.senderEmail(message),\n\t\t\t\t\thref: this.threadUrl(message),\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Deep-link into NC Mail's new-message composer.\n\t\t *\n\t\t * AD-2 (Mail owns compose / OR owns the link): we do NOT\n\t\t * implement an in-app composer. \"Compose in Mail\" opens NC Mail\n\t\t * in a new tab with the new-message view; once the user has\n\t\t * sent, they return to OR and link the sent message via the\n\t\t * picker.\n\t\t *\n\t\t * @return {string} The composer URL.\n\t\t */\n\t\t/** @return {string} The record, register and schema the list is for. */\n\t\tbindingKey() {\n\t\t\treturn [this.register, this.schema, this.objectId].join('/')\n\t\t},\n\n\t\tcomposeUrl() {\n\t\t\treturn (typeof OC !== 'undefined' && typeof OC.generateUrl === 'function')\n\t\t\t\t? OC.generateUrl('/apps/mail/box/draft')\n\t\t\t\t: `${this.mailAppPath}/box/draft`\n\t\t},\n\t},\n\n\twatch: {\n\t\t/*\n\t\t * The record, its register and its schema together: on a detail page\n\t\t * the id is known first and the register and schema follow, and the\n\t\t * list loads once all three are there.\n\t\t */\n\t\tbindingKey: {\n\t\t\timmediate: true,\n\t\t\thandler() {\n\t\t\t\tif (this.register && this.schema && this.objectId) {\n\t\t\t\t\tthis.reset()\n\t\t\t\t\tthis.fetchMessages()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\treset() {\n\t\t\tthis.messages = []\n\t\t\tthis.total = 0\n\t\t\tthis.nextCursor = null\n\t\t\tthis.errored = false\n\t\t},\n\n\t\tasync fetchMessages(append = false) {\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (append === true) {\n\t\t\t\tthis.loadingMore = true\n\t\t\t} else {\n\t\t\t\tthis.loading = true\n\t\t\t}\n\t\t\tthis.errored = false\n\t\t\ttry {\n\t\t\t\tconst params = new URLSearchParams({ _limit: String(this.pageSize) })\n\t\t\t\t// The Tier-3 envelope's `nextCursor` is the next zero-indexed\n\t\t\t\t// page number consumed by `_page`; walk it on append.\n\t\t\t\tif (append === true && this.nextCursor !== null) {\n\t\t\t\t\tparams.set('_page', String(this.nextCursor))\n\t\t\t\t} else {\n\t\t\t\t\tparams.set('_page', '0')\n\t\t\t\t}\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/integrations/email?${params.toString()}`),\n\t\t\t\t\t{ headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tif (response.ok === true) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tconst list = data.items || data.results || (Array.isArray(data) ? data : []) || []\n\t\t\t\t\tconst items = Array.isArray(list) === true ? list : []\n\t\t\t\t\tthis.messages = append === true ? [...this.messages, ...items] : items\n\t\t\t\t\tthis.total = typeof data.total === 'number' ? data.total : this.messages.length\n\t\t\t\t\tconst next = data.nextCursor\n\t\t\t\t\tthis.nextCursor = (next === null || next === undefined) ? null : next\n\t\t\t\t} else {\n\t\t\t\t\tthis.errored = true\n\t\t\t\t\tif (append !== true) {\n\t\t\t\t\t\tthis.messages = []\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnEmailTab] failed to fetch linked emails', err)\n\t\t\t\tthis.errored = true\n\t\t\t\tif (append !== true) {\n\t\t\t\t\tthis.messages = []\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t\tthis.loadingMore = false\n\t\t\t}\n\t\t},\n\n\t\tloadMore() {\n\t\t\tif (this.nextCursor === null && this.messages.length >= this.total) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.fetchMessages(true)\n\t\t},\n\n\t\tformatSubject(message) {\n\t\t\tconst raw = message.subject\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn this.noSubjectLabel\n\t\t},\n\n\t\tformatSender(message) {\n\t\t\tconst raw = message.senderName || message.fromName || message.sender || message.from\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn this.unknownSenderLabel\n\t\t},\n\n\t\t/**\n\t\t * Best-effort bare email address for the NcAvatar `user` seed so\n\t\t * gravatar/initials are stable per correspondent.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {string} An email-ish identifier, or '' when unknown.\n\t\t */\n\t\tsenderEmail(message) {\n\t\t\tconst candidate = message.senderEmail || message.fromEmail || message.sender || message.from\n\t\t\tif (typeof candidate === 'string' && candidate.indexOf('@') !== -1) {\n\t\t\t\treturn candidate.trim()\n\t\t\t}\n\t\t\treturn ''\n\t\t},\n\n\t\t/**\n\t\t * One-line preview snippet, mirroring NC Mail's message list.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {string} A trimmed snippet, or '' when none is available.\n\t\t */\n\t\tformatSnippet(message) {\n\t\t\tconst raw = message.preview || message.snippet || message.summary || message.bodyPreview\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw.trim()\n\t\t\t}\n\t\t\treturn ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the message is unread, tolerant of the several shapes\n\t\t * the backend may report read-state in.\n\t\t *\n\t\t * @param {object} message The message record.\n\t\t * @return {boolean} True when the message has not been read.\n\t\t */\n\t\tisUnread(message) {\n\t\t\tif (typeof message.unread === 'boolean') {\n\t\t\t\treturn message.unread\n\t\t\t}\n\t\t\tif (typeof message.isRead === 'boolean') {\n\t\t\t\treturn message.isRead === false\n\t\t\t}\n\t\t\tif (typeof message.seen === 'boolean') {\n\t\t\t\treturn message.seen === false\n\t\t\t}\n\t\t\tif (Array.isArray(message.flags)) {\n\t\t\t\treturn message.flags.indexOf('seen') === -1 && message.flags.indexOf('\\\\Seen') === -1\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\n\t\trawWhen(message) {\n\t\t\tconst raw = message.mailDate || message.date || message.linkedAt\n\t\t\tif (raw === undefined || raw === null || raw === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn raw\n\t\t},\n\n\t\t// Thread deep-link into NC Mail; undefined when the row lacks ids.\n\t\tthreadUrl(message) {\n\t\t\tconst accountId = message.mailAccountId\n\t\t\tconst messageId = message.mailMessageId\n\t\t\tif (accountId === undefined || accountId === null || messageId === undefined || messageId === null) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\treturn (typeof OC !== 'undefined' && typeof OC.generateUrl === 'function')\n\t\t\t\t? OC.generateUrl(`/apps/mail/box/${accountId}/thread/${messageId}`)\n\t\t\t\t: `/index.php/apps/mail/box/${accountId}/thread/${messageId}`\n\t\t},\n\n\t\topenPicker() {\n\t\t\tthis.pickerOpen = true\n\t\t},\n\n\t\tasync onLinkPick(payload) {\n\t\t\tthis.pickerOpen = false\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/emails`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: { ...buildHeaders(), 'Content-Type': 'application/json' },\n\t\t\t\t\t\tbody: JSON.stringify(payload),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tif (response.ok === true || response.status === 409) {\n\t\t\t\t\t// 409 = already-linked; treated as success since the row\n\t\t\t\t\t// already exists for this object.\n\t\t\t\t\tthis.reset()\n\t\t\t\t\tawait this.fetchMessages()\n\t\t\t\t} else {\n\t\t\t\t\tthis.errored = true\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnEmailTab] link failed', err)\n\t\t\t\tthis.errored = true\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-sidebar-tab {\n\tpadding: 12px;\n\toverflow-x: hidden;\n}\n\n.cn-sidebar-tab__loading {\n\tdisplay: flex;\n\tjustify-content: center;\n\tpadding: 24px 0;\n}\n\n.cn-sidebar-tab__empty {\n\ttext-align: center;\n\tpadding: 24px 12px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-sidebar-tab__empty--error {\n\tcolor: var(--color-error);\n}\n\n.cn-sidebar-tab__load-more {\n\tmargin-top: 8px;\n}\n\n.cn-email-tab__actions {\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\tmargin-bottom: 8px;\n}\n\n/* NC-Mail-style message list */\n.cn-email-tab__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n.cn-email-tab__row {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 10px;\n\tpadding: 8px 6px;\n\tborder-radius: var(--border-radius-large, 8px);\n\tcolor: inherit;\n\ttext-decoration: none;\n\tposition: relative;\n}\n\n/* Only a row with Mail ids is a link; the rest must not look clickable. */\na.cn-email-tab__row {\n\tcursor: pointer;\n}\n\na.cn-email-tab__row:hover {\n\tbackground-color: var(--color-background-hover);\n}\n\n.cn-email-tab__unread-dot {\n\tflex: 0 0 auto;\n\twidth: 8px;\n\talign-self: center;\n\tvisibility: hidden;\n}\n\n.cn-email-tab__unread-dot.is-shown {\n\tvisibility: visible;\n}\n\n.cn-email-tab__unread-dot.is-shown::before {\n\tcontent: '';\n\tdisplay: block;\n\twidth: 8px;\n\theight: 8px;\n\tborder-radius: 50%;\n\tbackground-color: var(--cn-email-accent, var(--color-primary-element));\n}\n\n.cn-email-tab__avatar {\n\tflex: 0 0 auto;\n}\n\n.cn-email-tab__body {\n\tflex: 1 1 auto;\n\tmin-width: 0;\n}\n\n.cn-email-tab__line {\n\tdisplay: flex;\n\talign-items: baseline;\n\tgap: 8px;\n}\n\n.cn-email-tab__subject {\n\tflex: 1 1 auto;\n\tmin-width: 0;\n\tcolor: var(--color-main-text);\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__row--unread .cn-email-tab__subject {\n\tfont-weight: bold;\n}\n\n.cn-email-tab__date {\n\tflex: 0 0 auto;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.8em;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__sender {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-email-tab__snippet {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\tmargin-top: 1px;\n}\n</style>\n"],"names":["_createVNode","_createTextVNode","_createElementBlock","_toDisplayString","_openBlock","_Fragment","_renderList","_createBlock","_resolveDynamicComponent","_mergeProps","_normalizeClass","_createElementVNode"],"mappings":";;AAmCM,MAAA,UAAA,GAAA,EAAA,KAAC,EAAA,6BAAA,GAAA;;;;;;;AAmBe,EAAA,KAAK,EAAC,yBAAyB;;;;AAGxC,EAAA,KAAA,EAAA,oDAAA;;;;AAGqB,EAAA,KAAA,EAAA,uBAAA;;;;AAGrB,EAAA,KAAK,EAAC,oBAAiB;;AAiB1B,MAAA,UAAA,GAAA,EAAA,KAAA,EAAA,oBAAA,GAAA;AACC,MAAA,UAAA,GAAA,EAAA,KAAI,EAAA,oBAAA,GAAA;;AAET,MAAA,WAAA,GAAA,EAAA,KAAA,EAAA,oBAAA,GAAA;;;;;;;;;;;;;;;yCA/BE,iBAAA,EAAA;UAfLA,WAKI,CAAA,mBAAA,EAAA;AALM,YAAA,OAAO,aAAY;AAAE,YAAA,OAAK,EAAE,QAAU,CAAA,UAAA;;AACpC,YAAA,IAAI,UACd,MAAE;cAAFA,WAAE,CAAA,sBAAA,EAAA,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;;6BACQ,MACX;AADW,cAAAC,eAAA,CAAA,GACX,mBAAG,MAAW,CAAA,iBAAA,CAAA,EAAA,CAAA,YAAA;;;;UAEfD,WAQU,CAAA,mBAAA,EAAA;AAPT,YAAA,OAAO,EAAC;AACP,YAAA,IAAE,EAAA,QAAA,CAAA,UA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