@anzusystems/common-admin 2.0.0-rc.25 → 2.0.0-rc.27

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.
Files changed (319) hide show
  1. package/dist/AnzuSystemsCommonAdmin.d.ts +22 -1
  2. package/dist/AnzuSystemsCommonAdmin.js.map +1 -1
  3. package/dist/common-admin.css +1 -1
  4. package/dist/common-admin.js +185 -181
  5. package/dist/domains/anzuUser/components/AAnzuUserDatatable.vue_vue_type_script_setup_true_lang.js +101 -100
  6. package/dist/domains/anzuUser/components/AAnzuUserDatatable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  7. package/dist/domains/anzuUser/components/AUserCreateInSystemButton.vue_vue_type_script_setup_true_lang.js +4 -4
  8. package/dist/domains/anzuUser/components/AUserMetadataRepairDialog.vue_vue_type_script_setup_true_lang.js +4 -4
  9. package/dist/domains/anzuUser/components/AUserMetadataRepairDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  10. package/dist/domains/anzuUser/components/AUserSystemOverview.vue_vue_type_script_setup_true_lang.js +4 -4
  11. package/dist/domains/auth/composables/refreshSession.d.ts +7 -0
  12. package/dist/domains/auth/composables/refreshSession.js +26 -19
  13. package/dist/domains/auth/composables/refreshSession.js.map +1 -1
  14. package/dist/domains/auth/composables/sessionEnd.d.ts +37 -0
  15. package/dist/domains/auth/composables/sessionEnd.js +65 -0
  16. package/dist/domains/auth/composables/sessionEnd.js.map +1 -0
  17. package/dist/domains/collab/components/ACollabCountdown.vue_vue_type_script_setup_true_lang.js +3 -3
  18. package/dist/domains/collab/components/ACollabCountdown.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/domains/collab/composables/collabInit.js +13 -13
  20. package/dist/domains/collab/composables/collabInit.js.map +1 -1
  21. package/dist/domains/collab/composables/collabRoom.js +98 -96
  22. package/dist/domains/collab/composables/collabRoom.js.map +1 -1
  23. package/dist/domains/collab/composables/collabState.d.ts +1 -0
  24. package/dist/domains/collab/composables/collabState.js +6 -5
  25. package/dist/domains/collab/composables/collabState.js.map +1 -1
  26. package/dist/domains/customDataForm/components/ACustomDataForm.vue_vue_type_script_setup_true_lang.js +53 -52
  27. package/dist/domains/customDataForm/components/ACustomDataForm.vue_vue_type_script_setup_true_lang.js.map +1 -1
  28. package/dist/domains/customDataForm/components/ACustomDataFormElement.vue_vue_type_script_setup_true_lang.js +78 -77
  29. package/dist/domains/customDataForm/components/ACustomDataFormElement.vue_vue_type_script_setup_true_lang.js.map +1 -1
  30. package/dist/domains/customDataForm/types/CustomDataForm.d.ts +3 -0
  31. package/dist/domains/customDataForm/utils/customDataFormElementName.d.ts +18 -0
  32. package/dist/domains/customDataForm/utils/customDataFormElementName.js +9 -0
  33. package/dist/domains/customDataForm/utils/customDataFormElementName.js.map +1 -0
  34. package/dist/domains/dam/api/damAssetApi.d.ts +1 -1
  35. package/dist/domains/dam/api/damAssetApi.js +90 -85
  36. package/dist/domains/dam/api/damAssetApi.js.map +1 -1
  37. package/dist/domains/dam/assetDetail/components/AssetImage.vue.d.ts +11 -1
  38. package/dist/domains/dam/assetDetail/components/AssetImage.vue_vue_type_script_setup_true_lang.js +31 -7
  39. package/dist/domains/dam/assetDetail/components/AssetImage.vue_vue_type_script_setup_true_lang.js.map +1 -1
  40. package/dist/domains/dam/assetDetail/components/AssetImageMetaIcons.vue.d.ts +10 -0
  41. package/dist/domains/dam/assetDetail/components/AssetImageMetaIcons.vue_vue_type_script_setup_true_lang.js +59 -32
  42. package/dist/domains/dam/assetDetail/components/AssetImageMetaIcons.vue_vue_type_script_setup_true_lang.js.map +1 -1
  43. package/dist/domains/dam/assetDetail/store/assetDetailStore.d.ts +8 -0
  44. package/dist/domains/dam/assetSelect/components/AAssetListInner.vue.d.ts +8 -0
  45. package/dist/domains/dam/assetSelect/components/AAssetSelect.vue.d.ts +10 -2
  46. package/dist/domains/dam/assetSelect/components/AAssetSelect.vue_vue_type_script_setup_true_lang.js +148 -113
  47. package/dist/domains/dam/assetSelect/components/AAssetSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  48. package/dist/domains/dam/assetSelect/components/AAssetSelectMedia.vue.d.ts +6 -2
  49. package/dist/domains/dam/assetSelect/components/AAssetSelectMedia.vue_vue_type_script_setup_true_lang.js +143 -108
  50. package/dist/domains/dam/assetSelect/components/AAssetSelectMedia.vue_vue_type_script_setup_true_lang.js.map +1 -1
  51. package/dist/domains/dam/assetSelect/components/AssetImagePreview.vue.d.ts +9 -2
  52. package/dist/domains/dam/assetSelect/components/AssetImagePreview.vue_vue_type_script_setup_true_lang.js +23 -5
  53. package/dist/domains/dam/assetSelect/components/AssetImagePreview.vue_vue_type_script_setup_true_lang.js.map +1 -1
  54. package/dist/domains/dam/assetSelect/components/AssetSelectDetailTabs.js +6 -0
  55. package/dist/domains/dam/assetSelect/components/AssetSelectDetailTabs.js.map +1 -0
  56. package/dist/domains/dam/assetSelect/components/AssetSelectDetailTabs.vue.d.ts +25 -0
  57. package/dist/domains/dam/assetSelect/components/AssetSelectDetailTabs.vue_vue_type_script_setup_true_lang.js +59 -0
  58. package/dist/domains/dam/assetSelect/components/AssetSelectDetailTabs.vue_vue_type_script_setup_true_lang.js.map +1 -0
  59. package/dist/domains/dam/assetSelect/components/AssetSelectListTable.js +1 -0
  60. package/dist/domains/dam/assetSelect/components/AssetSelectListTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  61. package/dist/domains/dam/assetSelect/components/AssetSelectListTiles.vue_vue_type_script_setup_true_lang.js.map +1 -1
  62. package/dist/domains/dam/assetSelect/components/AssetSelectSingleUseUsage.js +6 -0
  63. package/dist/domains/dam/assetSelect/components/AssetSelectSingleUseUsage.js.map +1 -0
  64. package/dist/domains/dam/assetSelect/components/AssetSelectSingleUseUsage.vue.d.ts +11 -0
  65. package/dist/domains/dam/assetSelect/components/AssetSelectSingleUseUsage.vue_vue_type_script_setup_true_lang.js +92 -0
  66. package/dist/domains/dam/assetSelect/components/AssetSelectSingleUseUsage.vue_vue_type_script_setup_true_lang.js.map +1 -0
  67. package/dist/domains/dam/assetSelect/components/AssetSelectTableRowItem.vue_vue_type_script_setup_true_lang.js +35 -27
  68. package/dist/domains/dam/assetSelect/components/AssetSelectTableRowItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  69. package/dist/domains/dam/assetSelect/components/AssetSelectTilesItem.vue_vue_type_script_setup_true_lang.js +35 -27
  70. package/dist/domains/dam/assetSelect/components/AssetSelectTilesItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  71. package/dist/domains/dam/assetSelect/composables/assetSelectDisabledReason.d.ts +18 -0
  72. package/dist/domains/dam/assetSelect/composables/assetSelectDisabledReason.js +28 -0
  73. package/dist/domains/dam/assetSelect/composables/assetSelectDisabledReason.js.map +1 -0
  74. package/dist/domains/dam/assetSelect/composables/assetSelectItemActions.d.ts +4 -0
  75. package/dist/domains/dam/assetSelect/composables/assetSelectItemActions.js +37 -28
  76. package/dist/domains/dam/assetSelect/composables/assetSelectItemActions.js.map +1 -1
  77. package/dist/domains/dam/assetSelect/composables/assetSelectListActions.d.ts +46 -3
  78. package/dist/domains/dam/assetSelect/composables/assetSelectListActions.js +136 -93
  79. package/dist/domains/dam/assetSelect/composables/assetSelectListActions.js.map +1 -1
  80. package/dist/domains/dam/assetSelect/composables/assetSelectSingleUseUsage.d.ts +848 -0
  81. package/dist/domains/dam/assetSelect/composables/assetSelectSingleUseUsage.js +83 -0
  82. package/dist/domains/dam/assetSelect/composables/assetSelectSingleUseUsage.js.map +1 -0
  83. package/dist/domains/dam/assetSelect/composables/assetSelectTakeOver.d.ts +17 -0
  84. package/dist/domains/dam/assetSelect/composables/assetSelectTakeOver.js +23 -0
  85. package/dist/domains/dam/assetSelect/composables/assetSelectTakeOver.js.map +1 -0
  86. package/dist/domains/dam/assetSelect/filter/AssetFilter.d.ts +3 -3
  87. package/dist/domains/dam/assetSelect/filter/AssetFilter.js +1 -1
  88. package/dist/domains/dam/assetSelect/filter/AssetFilter.js.map +1 -1
  89. package/dist/domains/dam/assetSelect/store/assetSelectStore.d.ts +118 -4
  90. package/dist/domains/dam/assetSelect/store/assetSelectStore.js +135 -87
  91. package/dist/domains/dam/assetSelect/store/assetSelectStore.js.map +1 -1
  92. package/dist/domains/dam/author/composables/authorActions.js +3 -1
  93. package/dist/domains/dam/author/composables/authorActions.js.map +1 -1
  94. package/dist/domains/dam/author/composables/cachedAuthors.js +6 -2
  95. package/dist/domains/dam/author/composables/cachedAuthors.js.map +1 -1
  96. package/dist/domains/dam/author/composables/damCredit.d.ts +3 -1
  97. package/dist/domains/dam/author/composables/damCredit.js +13 -12
  98. package/dist/domains/dam/author/composables/damCredit.js.map +1 -1
  99. package/dist/domains/dam/author/composables/damSourceBadge.d.ts +13 -0
  100. package/dist/domains/dam/author/composables/damSourceBadge.js +11 -0
  101. package/dist/domains/dam/author/composables/damSourceBadge.js.map +1 -0
  102. package/dist/domains/dam/author/factory/AuthorFactory.js +2 -0
  103. package/dist/domains/dam/author/factory/AuthorFactory.js.map +1 -1
  104. package/dist/domains/dam/author/types/DamAuthor.d.ts +8 -0
  105. package/dist/domains/dam/composables/commonAdminCoreDamOptions.d.ts +3 -0
  106. package/dist/domains/dam/composables/commonAdminCoreDamOptions.js +4 -1
  107. package/dist/domains/dam/composables/commonAdminCoreDamOptions.js.map +1 -1
  108. package/dist/domains/dam/config/api/damAssetCustomFormApi.js +17 -16
  109. package/dist/domains/dam/config/api/damAssetCustomFormApi.js.map +1 -1
  110. package/dist/domains/dam/cropper/components/DamAssetImageRoiSelect.vue_vue_type_script_setup_true_lang.js +62 -48
  111. package/dist/domains/dam/cropper/components/DamAssetImageRoiSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  112. package/dist/domains/dam/cropper/store/imageRoiStore.d.ts +2 -0
  113. package/dist/domains/dam/imageWidget/components/AImageMediaWidget.vue.d.ts +14 -1
  114. package/dist/domains/dam/imageWidget/components/AImageMediaWidget.vue_vue_type_script_setup_true_lang.js +7 -1
  115. package/dist/domains/dam/imageWidget/components/AImageMediaWidget.vue_vue_type_script_setup_true_lang.js.map +1 -1
  116. package/dist/domains/dam/imageWidget/components/AImagePublicInput.vue.d.ts +6 -1
  117. package/dist/domains/dam/imageWidget/components/AImagePublicInput.vue_vue_type_script_setup_true_lang.js +91 -88
  118. package/dist/domains/dam/imageWidget/components/AImagePublicInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  119. package/dist/domains/dam/imageWidget/components/AImageWidget.vue.d.ts +14 -1
  120. package/dist/domains/dam/imageWidget/components/AImageWidget.vue_vue_type_script_setup_true_lang.js +7 -1
  121. package/dist/domains/dam/imageWidget/components/AImageWidget.vue_vue_type_script_setup_true_lang.js.map +1 -1
  122. package/dist/domains/dam/imageWidget/components/AImageWidgetMultiple.vue.d.ts +14 -0
  123. package/dist/domains/dam/imageWidget/components/AImageWidgetMultiple.vue_vue_type_script_setup_true_lang.js +7 -1
  124. package/dist/domains/dam/imageWidget/components/AImageWidgetMultiple.vue_vue_type_script_setup_true_lang.js.map +1 -1
  125. package/dist/domains/dam/imageWidget/components/AImageWidgetSimple.vue.d.ts +6 -0
  126. package/dist/domains/dam/imageWidget/components/ImageDetailDialogMetadata.vue.d.ts +7 -0
  127. package/dist/domains/dam/imageWidget/components/ImageDetailDialogMetadata.vue_vue_type_script_setup_true_lang.js +123 -111
  128. package/dist/domains/dam/imageWidget/components/ImageDetailDialogMetadata.vue_vue_type_script_setup_true_lang.js.map +1 -1
  129. package/dist/domains/dam/imageWidget/components/ImageDetailSingleUseWarning.js +6 -0
  130. package/dist/domains/dam/imageWidget/components/ImageDetailSingleUseWarning.js.map +1 -0
  131. package/dist/domains/dam/imageWidget/components/ImageDetailSingleUseWarning.vue.d.ts +11 -0
  132. package/dist/domains/dam/imageWidget/components/ImageDetailSingleUseWarning.vue_vue_type_script_setup_true_lang.js +59 -0
  133. package/dist/domains/dam/imageWidget/components/ImageDetailSingleUseWarning.vue_vue_type_script_setup_true_lang.js.map +1 -0
  134. package/dist/domains/dam/imageWidget/components/ImageMediaWidgetInner.vue.d.ts +18 -1
  135. package/dist/domains/dam/imageWidget/components/ImageMediaWidgetInner.vue_vue_type_script_setup_true_lang.js +338 -337
  136. package/dist/domains/dam/imageWidget/components/ImageMediaWidgetInner.vue_vue_type_script_setup_true_lang.js.map +1 -1
  137. package/dist/domains/dam/imageWidget/components/ImageWidgetInner.vue.d.ts +22 -1
  138. package/dist/domains/dam/imageWidget/components/ImageWidgetInner.vue_vue_type_script_setup_true_lang.js +366 -363
  139. package/dist/domains/dam/imageWidget/components/ImageWidgetInner.vue_vue_type_script_setup_true_lang.js.map +1 -1
  140. package/dist/domains/dam/imageWidget/components/ImageWidgetMultipleInner.vue.d.ts +18 -0
  141. package/dist/domains/dam/imageWidget/components/ImageWidgetMultipleInner.vue_vue_type_script_setup_true_lang.js +376 -311
  142. package/dist/domains/dam/imageWidget/components/ImageWidgetMultipleInner.vue_vue_type_script_setup_true_lang.js.map +1 -1
  143. package/dist/domains/dam/imageWidget/composables/commonAdminImageOptions.d.ts +9 -0
  144. package/dist/domains/dam/imageWidget/composables/commonAdminImageOptions.js +19 -17
  145. package/dist/domains/dam/imageWidget/composables/commonAdminImageOptions.js.map +1 -1
  146. package/dist/domains/dam/imageWidget/composables/imageApiCms.d.ts +36 -1
  147. package/dist/domains/dam/imageWidget/composables/imageApiCms.js +84 -36
  148. package/dist/domains/dam/imageWidget/composables/imageApiCms.js.map +1 -1
  149. package/dist/domains/dam/imageWidget/composables/imageDialogDamAuthors.d.ts +5 -0
  150. package/dist/domains/dam/imageWidget/composables/imageDialogDamAuthors.js +93 -80
  151. package/dist/domains/dam/imageWidget/composables/imageDialogDamAuthors.js.map +1 -1
  152. package/dist/domains/dam/imageWidget/composables/imageSaveErrors.d.ts +8 -0
  153. package/dist/domains/dam/imageWidget/composables/imageSaveErrors.js +22 -0
  154. package/dist/domains/dam/imageWidget/composables/imageSaveErrors.js.map +1 -0
  155. package/dist/domains/dam/imageWidget/composables/imageSingleUseUsageFetch.d.ts +11 -0
  156. package/dist/domains/dam/imageWidget/composables/imageSingleUseUsageFetch.js +15 -0
  157. package/dist/domains/dam/imageWidget/composables/imageSingleUseUsageFetch.js.map +1 -0
  158. package/dist/domains/dam/imageWidget/store/imageMediaWidgetStore.d.ts +8 -0
  159. package/dist/domains/dam/imageWidget/store/imageStore.d.ts +15 -0
  160. package/dist/domains/dam/imageWidget/store/imageStore.js +24 -14
  161. package/dist/domains/dam/imageWidget/store/imageStore.js.map +1 -1
  162. package/dist/domains/dam/imageWidget/utils/damImage.d.ts +10 -1
  163. package/dist/domains/dam/imageWidget/utils/damImage.js +24 -12
  164. package/dist/domains/dam/imageWidget/utils/damImage.js.map +1 -1
  165. package/dist/domains/dam/types/Asset.d.ts +29 -1
  166. package/dist/domains/dam/types/Asset.js +9 -2
  167. package/dist/domains/dam/types/Asset.js.map +1 -1
  168. package/dist/domains/dam/types/AssetFile.d.ts +1 -0
  169. package/dist/domains/dam/types/AssetFile.js.map +1 -1
  170. package/dist/domains/dam/types/AssetLicence.d.ts +6 -1
  171. package/dist/domains/dam/types/AssetSelect.d.ts +9 -4
  172. package/dist/domains/dam/types/AssetSelect.js.map +1 -1
  173. package/dist/domains/dam/types/ImageAware.d.ts +9 -0
  174. package/dist/domains/dam/types/ImageAware.js +7 -0
  175. package/dist/domains/dam/types/ImageAware.js.map +1 -0
  176. package/dist/domains/dam/uploadQueue/components/AssetCustomMetadataFormMassOperations.vue_vue_type_script_setup_true_lang.js +42 -41
  177. package/dist/domains/dam/uploadQueue/components/AssetCustomMetadataFormMassOperations.vue_vue_type_script_setup_true_lang.js.map +1 -1
  178. package/dist/domains/dam/uploadQueue/components/UploadQueueDialog.vue_vue_type_script_setup_true_lang.js +4 -4
  179. package/dist/domains/dam/uploadQueue/components/UploadQueueEditable.vue_vue_type_script_setup_true_lang.js +59 -58
  180. package/dist/domains/dam/uploadQueue/components/UploadQueueEditable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  181. package/dist/domains/dam/uploadQueue/components/UploadQueueItemErrorOverlay.vue_vue_type_script_setup_true_lang.js +8 -8
  182. package/dist/domains/dam/uploadQueue/components/UploadQueueItemErrorOverlay.vue_vue_type_script_setup_true_lang.js.map +1 -1
  183. package/dist/domains/dam/uploadQueue/composables/uploadService.d.ts +6 -0
  184. package/dist/domains/dam/uploadQueue/composables/uploadService.js +69 -55
  185. package/dist/domains/dam/uploadQueue/composables/uploadService.js.map +1 -1
  186. package/dist/domains/dam/uploadQueue/presets/queuePresets.js +21 -17
  187. package/dist/domains/dam/uploadQueue/presets/queuePresets.js.map +1 -1
  188. package/dist/domains/dam/uploadQueue/presets/uploadPresets.d.ts +4 -0
  189. package/dist/domains/dam/uploadQueue/presets/uploadPresets.js +15 -14
  190. package/dist/domains/dam/uploadQueue/presets/uploadPresets.js.map +1 -1
  191. package/dist/domains/dam/user/composables/cachedAssetLicences.d.ts +2 -0
  192. package/dist/domains/dam/user/composables/cachedAssetLicences.js +11 -8
  193. package/dist/domains/dam/user/composables/cachedAssetLicences.js.map +1 -1
  194. package/dist/domains/filters/bookmarks/components/FilterBookmarkDialog.vue_vue_type_script_setup_true_lang.js +190 -184
  195. package/dist/domains/filters/bookmarks/components/FilterBookmarkDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  196. package/dist/domains/filters/components/AFilterTimeInterval.js +1 -1
  197. package/dist/domains/filters/components/AFilterTimeInterval.vue_vue_type_script_setup_true_lang.js +85 -84
  198. package/dist/domains/filters/components/AFilterTimeInterval.vue_vue_type_script_setup_true_lang.js.map +1 -1
  199. package/dist/domains/filters/composables/filterFactory.d.ts +13 -1
  200. package/dist/domains/filters/composables/filterFactory.js +171 -120
  201. package/dist/domains/filters/composables/filterFactory.js.map +1 -1
  202. package/dist/domains/filters/composables/filterTimeIntervalTools.js +6 -6
  203. package/dist/domains/filters/composables/filterTimeIntervalTools.js.map +1 -1
  204. package/dist/domains/filters/datatable/components/ADatatableOrdering.vue_vue_type_script_setup_true_lang.js +1 -1
  205. package/dist/domains/filters/datatable/components/ADatatableOrdering.vue_vue_type_script_setup_true_lang.js.map +1 -1
  206. package/dist/domains/filters/datatable/components/ADatatablePagination.vue_vue_type_script_setup_true_lang.js +49 -49
  207. package/dist/domains/filters/datatable/components/ADatatablePagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  208. package/dist/domains/filters/datatable/components/ALiveListingPill.vue.d.ts +3 -0
  209. package/dist/domains/filters/datatable/components/ALiveListingPill.vue_vue_type_script_setup_true_lang.js +54 -27
  210. package/dist/domains/filters/datatable/components/ALiveListingPill.vue_vue_type_script_setup_true_lang.js.map +1 -1
  211. package/dist/domains/filters/utils/filterInjectionKeys.d.ts +1 -0
  212. package/dist/domains/filters/utils/filterInjectionKeys.js +2 -2
  213. package/dist/domains/filters/utils/filterInjectionKeys.js.map +1 -1
  214. package/dist/domains/job/api/jobApi.js +3 -3
  215. package/dist/domains/job/api/jobApi.js.map +1 -1
  216. package/dist/domains/listEditor/components/ANestedSortableListEditor.vue.d.ts +1 -1
  217. package/dist/domains/listEditor/components/ANestedSortableListEditor.vue_vue_type_script_setup_true_lang.js +385 -351
  218. package/dist/domains/listEditor/components/ANestedSortableListEditor.vue_vue_type_script_setup_true_lang.js.map +1 -1
  219. package/dist/domains/listEditor/components/ASortableListEditor.vue_vue_type_script_setup_true_lang.js +277 -260
  220. package/dist/domains/listEditor/components/ASortableListEditor.vue_vue_type_script_setup_true_lang.js.map +1 -1
  221. package/dist/domains/listEditor/composables/useKeyboardNav.d.ts +4 -0
  222. package/dist/domains/listEditor/composables/useKeyboardNav.js +33 -20
  223. package/dist/domains/listEditor/composables/useKeyboardNav.js.map +1 -1
  224. package/dist/domains/log/components/ALogDatatable.vue.d.ts +1 -0
  225. package/dist/domains/log/components/ALogDatatable.vue_vue_type_script_setup_true_lang.js +70 -66
  226. package/dist/domains/log/components/ALogDatatable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  227. package/dist/domains/log/components/ALogListView.vue_vue_type_script_setup_true_lang.js +1 -1
  228. package/dist/domains/log/components/ALogListView.vue_vue_type_script_setup_true_lang.js.map +1 -1
  229. package/dist/domains/log/filter/logFilter.d.ts +5 -0
  230. package/dist/domains/log/filter/logFilter.js +2 -2
  231. package/dist/domains/log/filter/logFilter.js.map +1 -1
  232. package/dist/domains/remoteAutocomplete/components/AFilterRemoteAutocomplete.vue_vue_type_script_setup_true_lang.js +89 -92
  233. package/dist/domains/remoteAutocomplete/components/AFilterRemoteAutocomplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
  234. package/dist/domains/remoteAutocomplete/components/AFilterRemoteAutocompleteWithMinimal.vue_vue_type_script_setup_true_lang.js +123 -119
  235. package/dist/domains/remoteAutocomplete/components/AFilterRemoteAutocompleteWithMinimal.vue_vue_type_script_setup_true_lang.js.map +1 -1
  236. package/dist/domains/remoteAutocomplete/components/AFormRemoteAutocomplete.vue_vue_type_script_setup_true_lang.js +26 -24
  237. package/dist/domains/remoteAutocomplete/components/AFormRemoteAutocomplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
  238. package/dist/domains/system/appShell/components/ALayoutSwitch.js +1 -0
  239. package/dist/domains/system/appShell/components/ALayoutSwitch.vue.d.ts +3 -0
  240. package/dist/domains/system/appShell/components/ALayoutSwitch.vue_vue_type_script_setup_true_lang.js +38 -16
  241. package/dist/domains/system/appShell/components/ALayoutSwitch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  242. package/dist/domains/system/composables/alerts.js +57 -40
  243. package/dist/domains/system/composables/alerts.js.map +1 -1
  244. package/dist/domains/system/systemBar/components/ASystemBar.vue_vue_type_script_setup_true_lang.js +39 -38
  245. package/dist/domains/system/systemBar/components/ASystemBar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  246. package/dist/domains/system/systemBar/components/ASystemBarSessionEnded.js +6 -0
  247. package/dist/domains/system/systemBar/components/ASystemBarSessionEnded.js.map +1 -0
  248. package/dist/domains/system/systemBar/components/ASystemBarSessionEnded.vue.d.ts +3 -0
  249. package/dist/domains/system/systemBar/components/ASystemBarSessionEnded.vue_vue_type_script_setup_true_lang.js +53 -0
  250. package/dist/domains/system/systemBar/components/ASystemBarSessionEnded.vue_vue_type_script_setup_true_lang.js.map +1 -0
  251. package/dist/domains/ui/datetime/components/ADatetimePicker.js +1 -1
  252. package/dist/domains/ui/datetime/components/ADatetimePicker.vue_vue_type_script_setup_true_lang.js +1 -1
  253. package/dist/domains/ui/datetime/components/ADatetimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  254. package/dist/domains/ui/file/composables/formatAndSizeCheck.js +1 -1
  255. package/dist/domains/ui/file/composables/formatAndSizeCheck.js.map +1 -1
  256. package/dist/domains/ui/view/components/ALogoutView.vue_vue_type_script_setup_true_lang.js +9 -8
  257. package/dist/domains/ui/view/components/ALogoutView.vue_vue_type_script_setup_true_lang.js.map +1 -1
  258. package/dist/lib.d.ts +9 -5
  259. package/dist/locales/cs/common/alert.js +8 -0
  260. package/dist/locales/cs/common/alert.js.map +1 -1
  261. package/dist/locales/cs/common/assetSelect.js +361 -0
  262. package/dist/locales/cs/common/assetSelect.js.map +1 -1
  263. package/dist/locales/cs/common/damCustomFormElement.js +258 -0
  264. package/dist/locales/cs/common/damCustomFormElement.js.map +1 -0
  265. package/dist/locales/cs/common/damImage.js +237 -1
  266. package/dist/locales/cs/common/damImage.js.map +1 -1
  267. package/dist/locales/cs/common/filter.js +1 -9
  268. package/dist/locales/cs/common/filter.js.map +1 -1
  269. package/dist/locales/cs/common/system.js +26 -0
  270. package/dist/locales/cs/common/system.js.map +1 -1
  271. package/dist/locales/cs/error/apiForbiddenOperation.js +113 -7
  272. package/dist/locales/cs/error/apiForbiddenOperation.js.map +1 -1
  273. package/dist/locales/cs/error/apiValidation.js +8 -0
  274. package/dist/locales/cs/error/apiValidation.js.map +1 -1
  275. package/dist/locales/cs.d.ts +120 -1
  276. package/dist/locales/cs.js +20 -18
  277. package/dist/locales/cs.js.map +1 -1
  278. package/dist/locales/en/common/alert.js +8 -0
  279. package/dist/locales/en/common/alert.js.map +1 -1
  280. package/dist/locales/en/common/assetSelect.js +361 -0
  281. package/dist/locales/en/common/assetSelect.js.map +1 -1
  282. package/dist/locales/en/common/damCustomFormElement.js +258 -0
  283. package/dist/locales/en/common/damCustomFormElement.js.map +1 -0
  284. package/dist/locales/en/common/damImage.js +237 -1
  285. package/dist/locales/en/common/damImage.js.map +1 -1
  286. package/dist/locales/en/common/filter.js +1 -9
  287. package/dist/locales/en/common/filter.js.map +1 -1
  288. package/dist/locales/en/common/system.js +26 -0
  289. package/dist/locales/en/common/system.js.map +1 -1
  290. package/dist/locales/en/error/apiForbiddenOperation.js +113 -7
  291. package/dist/locales/en/error/apiForbiddenOperation.js.map +1 -1
  292. package/dist/locales/en/error/apiValidation.js +8 -0
  293. package/dist/locales/en/error/apiValidation.js.map +1 -1
  294. package/dist/locales/en.d.ts +120 -1
  295. package/dist/locales/en.js +20 -18
  296. package/dist/locales/en.js.map +1 -1
  297. package/dist/locales/sk/common/alert.js +8 -0
  298. package/dist/locales/sk/common/alert.js.map +1 -1
  299. package/dist/locales/sk/common/assetSelect.js +361 -0
  300. package/dist/locales/sk/common/assetSelect.js.map +1 -1
  301. package/dist/locales/sk/common/damCustomFormElement.js +258 -0
  302. package/dist/locales/sk/common/damCustomFormElement.js.map +1 -0
  303. package/dist/locales/sk/common/damImage.js +237 -1
  304. package/dist/locales/sk/common/damImage.js.map +1 -1
  305. package/dist/locales/sk/common/filter.js +1 -9
  306. package/dist/locales/sk/common/filter.js.map +1 -1
  307. package/dist/locales/sk/common/system.js +26 -0
  308. package/dist/locales/sk/common/system.js.map +1 -1
  309. package/dist/locales/sk/error/apiForbiddenOperation.js +113 -7
  310. package/dist/locales/sk/error/apiForbiddenOperation.js.map +1 -1
  311. package/dist/locales/sk/error/apiValidation.js +8 -0
  312. package/dist/locales/sk/error/apiValidation.js.map +1 -1
  313. package/dist/locales/sk.d.ts +120 -1
  314. package/dist/locales/sk.js +20 -18
  315. package/dist/locales/sk.js.map +1 -1
  316. package/dist/plugins/i18n.d.ts +120 -1
  317. package/dist/shared/utils/datetimePickerValue.js +9 -6
  318. package/dist/shared/utils/datetimePickerValue.js.map +1 -1
  319. package/package.json +2 -2
@@ -1,67 +1,115 @@
1
1
  import "../../../../shared/statusCodes.js";
2
2
  import { useApiFetchByIds as e } from "../../../api/composables/useApiFetchByIds.js";
3
- import { useApiCommand as t, useApiRequest as n } from "../../../api/composables/useApiRequest.js";
3
+ import { useApiFetchItems as t } from "../../../api/composables/useApiFetchItems.js";
4
+ import { useApiCommand as n, useApiRequest as r } from "../../../api/composables/useApiRequest.js";
5
+ import { isAnzuFatalError as i } from "../../../../shared/error/AnzuFatalError.js";
6
+ import { isAnzuApiAxiosError as a } from "../../../../shared/error/AnzuApiAxiosError.js";
7
+ import { isUndefined as o } from "../../../../shared/utils/common.js";
8
+ import s from "axios";
4
9
  // src/domains/dam/imageWidget/composables/imageApiCms.ts
5
- var r = "/adm/v1/image", i = "image", a = 20, o = (t, n) => {
6
- let { execute: a } = e({
10
+ var c = "/adm/v1/image", l = "image", u = 20, d = 100, f = (t, n) => {
11
+ let { execute: r } = e({
7
12
  client: t,
8
13
  system: "cms",
9
- entity: i,
10
- urlTemplate: r
14
+ entity: l,
15
+ urlTemplate: c
11
16
  });
12
- return a(n);
13
- }, s = async (e, t) => {
14
- let { execute: a } = n({
17
+ return r(n);
18
+ }, p = async (e, t) => {
19
+ let { execute: n } = r({
15
20
  client: e,
16
21
  method: "GET",
17
22
  system: "cms",
18
- entity: i,
19
- urlTemplate: r + "/:id",
23
+ entity: l,
24
+ urlTemplate: c + "/:id",
20
25
  optionalBody: !0
21
26
  });
22
- return await a({ urlParams: { id: t } }) ?? null;
23
- }, c = (e, t) => {
24
- let { execute: a } = n({
27
+ return await n({ urlParams: { id: t } }) ?? null;
28
+ }, m = (e, t) => {
29
+ let { execute: n } = r({
25
30
  client: e,
26
31
  method: "POST",
27
32
  system: "cms",
28
- entity: i,
29
- urlTemplate: r
33
+ entity: l,
34
+ urlTemplate: c
30
35
  });
31
- return a({ body: t });
32
- }, l = (e, t, a) => {
33
- let { execute: o } = n({
36
+ return n({ body: t });
37
+ }, h = (e, t, n) => {
38
+ let { execute: i } = r({
34
39
  client: e,
35
40
  method: "PUT",
36
41
  system: "cms",
37
- entity: i,
38
- urlTemplate: r + "/:id"
42
+ entity: l,
43
+ urlTemplate: c + "/:id"
39
44
  });
40
- return o({
45
+ return i({
41
46
  urlParams: { id: t },
42
- body: a
47
+ body: n
43
48
  });
44
- }, u = (e, n) => {
45
- let { execute: a } = t({
49
+ }, g = (e, t) => {
50
+ let { execute: r } = n({
46
51
  client: e,
47
52
  method: "DELETE",
48
53
  system: "cms",
49
- entity: i,
50
- urlTemplate: r + "/:id"
54
+ entity: l,
55
+ urlTemplate: c + "/:id"
51
56
  });
52
- return a({ urlParams: { id: n } });
53
- }, d = (e, t) => new Promise((n, r) => {
54
- f(e, t).then((e) => t.length === 0 ? n([]) : e.length === 0 ? r(e) : e.every((e) => e.status === 200) ? n(e.flatMap((e) => e.data.images)) : r(e)).catch((e) => r(e));
57
+ return r({ urlParams: { id: t } });
58
+ }, _ = async (e, n, r) => {
59
+ let i = [];
60
+ for (let a = 0; a < n.length; a += d) {
61
+ let { execute: o } = t({
62
+ client: e,
63
+ system: "cms",
64
+ entity: l,
65
+ urlTemplate: c + "/single-use-usage",
66
+ options: { params: {
67
+ groupIds: n.slice(a, a + d).join(","),
68
+ ...r ? {
69
+ holderResourceName: r.resourceName,
70
+ holderResourceId: r.resourceId
71
+ } : {}
72
+ } }
73
+ });
74
+ i.push(o());
75
+ }
76
+ let a = {};
77
+ for (let e of await Promise.all(i)) for (let { groupId: t, ...n } of e) a[t] = n;
78
+ return a;
79
+ }, v = {
80
+ TakeOverFailed: "image_take_over_failed",
81
+ SingleUseViolation: "image_single_use_violation"
82
+ }, y = {
83
+ ExclusivityConflict: "exclusivity_conflict",
84
+ SharedGallery: "shared_gallery",
85
+ InvalidOwner: "invalid_owner",
86
+ GalleryCopy: "gallery_copy",
87
+ RestoreConflict: "restore_conflict",
88
+ TakeOverRejected: "take_over_rejected",
89
+ TakeOverException: "take_over_exception"
90
+ }, b = (e) => {
91
+ let t = i(e) || a(e) ? e.cause : s.isAxiosError(e) ? e : void 0;
92
+ if (!s.isAxiosError(t)) return;
93
+ let n = t.response?.data, r = Object.values(v).find((e) => e === n?.error);
94
+ if (!o(r)) return {
95
+ code: r,
96
+ reason: Object.values(y).find((e) => e === n.reason),
97
+ damId: typeof n.damId == "string" ? n.damId : void 0,
98
+ holderResourceName: typeof n.holderResourceName == "string" ? n.holderResourceName : void 0,
99
+ holderResourceId: typeof n.holderResourceId == "string" || typeof n.holderResourceId == "number" ? String(n.holderResourceId) : void 0
100
+ };
101
+ }, x = (e, t) => new Promise((n, r) => {
102
+ S(e, t).then((e) => t.length === 0 ? n([]) : e.length === 0 ? r(e) : e.every((e) => e.status === 200) ? n(e.flatMap((e) => e.data.images)) : r(e)).catch((e) => r(e));
55
103
  });
56
- async function f(e, t) {
57
- let n = Math.ceil(t.length / a), i = [];
104
+ async function S(e, t) {
105
+ let n = Math.ceil(t.length / u), r = [];
58
106
  if (t.length === 0) return Promise.resolve([]);
59
- for (let o = 0; o < n; o++) {
60
- let n = o * a, s = { images: t.slice(n, n + a) }, c = await e().put(r, JSON.stringify(s));
61
- i.push(c);
107
+ for (let i = 0; i < n; i++) {
108
+ let n = i * u, a = { images: t.slice(n, n + u) }, o = await e().put(c, JSON.stringify(a));
109
+ r.push(o);
62
110
  }
63
- return i;
111
+ return r;
64
112
  }
65
- export { i as ENTITY, d as bulkUpdateImages, c as createImage, u as deleteImage, s as fetchImage, o as fetchImageListByIds, l as updateImage };
113
+ export { l as ENTITY, v as ImageSaveErrorCode, y as ImageSaveErrorReason, x as bulkUpdateImages, m as createImage, g as deleteImage, b as extractImageSaveErrorInfo, p as fetchImage, f as fetchImageListByIds, _ as fetchSingleUseUsage, h as updateImage };
66
114
 
67
115
  //# sourceMappingURL=imageApiCms.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"imageApiCms.js","names":["END_POINT","ENTITY","BULK_METADATA_LIMIT","fetchImageListByIds","useApiFetchByIds","execute","ids","fetchImage","useApiRequest","createImage","data","updateImage","deleteImage","useApiCommand","bulkUpdateImages","client","items","resolve","responses","reject","res","response","err","updateImagesSequence","totalCalls","i","offset","reqData"],"sources":["../../../../../src/domains/dam/imageWidget/composables/imageApiCms.ts"],"sourcesContent":["import type { AxiosInstance, AxiosResponse } from 'axios'\nimport type { IntegerId } from '@/shared/types/common'\nimport type { ImageAware, ImageCreateUpdateAware } from '@/domains/dam/types/ImageAware'\nimport { HTTP_STATUS_OK } from '@/shared/statusCodes'\nimport { useApiFetchByIds } from '@/domains/api/composables/useApiFetchByIds'\nimport { useApiCommand, useApiRequest } from '@/domains/api/composables/useApiRequest'\n\nconst END_POINT = '/adm/v1/image'\nexport const ENTITY = 'image'\nexport const SYSTEM_CMS = 'cms'\n\nconst BULK_METADATA_LIMIT = 20\n\nexport const fetchImageListByIds = (client: () => AxiosInstance, ids: IntegerId[]) => {\n const { execute } = useApiFetchByIds<ImageAware>({\n client,\n system: SYSTEM_CMS,\n entity: ENTITY,\n urlTemplate: END_POINT,\n })\n\n return execute(ids)\n}\n\n// `optionalBody`: a body-less answer here means there is no image, not a broken endpoint.\n// Callers guard the result with a strict `isNull`, so it is normalised to `null`.\nexport const fetchImage = async (client: () => AxiosInstance, id: IntegerId) => {\n const { execute } = useApiRequest<ImageAware, null>({\n client,\n method: 'GET',\n system: SYSTEM_CMS,\n entity: ENTITY,\n urlTemplate: END_POINT + '/:id',\n optionalBody: true,\n })\n\n return (await execute({ urlParams: { id } })) ?? null\n}\n\nexport const createImage = (client: () => AxiosInstance, data: ImageCreateUpdateAware) => {\n const { execute } = useApiRequest<ImageAware, ImageCreateUpdateAware>({\n client,\n method: 'POST',\n system: SYSTEM_CMS,\n entity: ENTITY,\n urlTemplate: END_POINT,\n })\n\n return execute({ body: data })\n}\n\nexport const updateImage = (client: () => AxiosInstance, id: IntegerId, data: ImageCreateUpdateAware) => {\n const { execute } = useApiRequest<ImageAware, ImageCreateUpdateAware>({\n client,\n method: 'PUT',\n system: SYSTEM_CMS,\n entity: ENTITY,\n urlTemplate: END_POINT + '/:id',\n })\n\n return execute({ urlParams: { id }, body: data })\n}\n\nexport const deleteImage = (client: () => AxiosInstance, id: IntegerId) => {\n const { execute } = useApiCommand({\n client,\n method: 'DELETE',\n system: SYSTEM_CMS,\n entity: ENTITY,\n urlTemplate: END_POINT + '/:id',\n })\n\n return execute({ urlParams: { id } })\n}\n\nexport const bulkUpdateImages = (client: () => AxiosInstance, items: ImageCreateUpdateAware[]) => {\n return new Promise<ImageAware[]>((resolve, reject) => {\n updateImagesSequence(client, items)\n .then((responses) => {\n if (items.length === 0) {\n return resolve([])\n } else if (responses.length === 0) {\n return reject(responses)\n } else if (\n responses.every((res) => {\n return res.status === HTTP_STATUS_OK\n })\n ) {\n const images: ImageAware[] = responses.flatMap((response) => response.data.images)\n return resolve(images)\n } else {\n return reject(responses)\n }\n })\n .catch((err) => {\n //\n return reject(err)\n })\n })\n}\n\nasync function updateImagesSequence(client: () => AxiosInstance, items: ImageCreateUpdateAware[]) {\n const totalCalls = Math.ceil(items.length / BULK_METADATA_LIMIT)\n const responses: AxiosResponse[] = []\n if (items.length === 0) return Promise.resolve([])\n\n for (let i = 0; i < totalCalls; i++) {\n const offset = i * BULK_METADATA_LIMIT\n const reduced = items.slice(offset, offset + BULK_METADATA_LIMIT)\n const reqData = { images: reduced }\n const res = await client().put(END_POINT, JSON.stringify(reqData))\n responses.push(res)\n }\n return responses\n}\n"],"mappings":";;;;AAOA,IAAMA,IAAY,iBACLC,IAAS,SAGhBC,IAAsB,IAEfC,KAAuB,GAA6B,MAAqB;CACpF,IAAM,EAAE,eAAYC,EAA6B;EAC/C;EACA,QAAA;EACA,QAAQH;EACR,aAAaD;CACf,CAAC;CAED,OAAOK,EAAQC,CAAG;AACpB,GAIaC,IAA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M,SAASd,CAAmB,GACzDgB,IAA6B,CAAC;CACpC,IAAIF,EAAM,WAAW,GAAG,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAEjD,KAAK,IAAIS,IAAI,GAAGA,IAAID,GAAY,KAAK;EACnC,IAAME,IAASD,IAAIvB,GAEbyB,IAAU,EAAE,QADFX,EAAM,MAAMU,GAAQA,IAASxB,CACnB,EAAQ,GAC5BkB,IAAM,MAAML,EAAO,CAAC,CAAC,IAAIf,GAAW,KAAK,UAAU2B,CAAO,CAAC;EACjE,EAAU,KAAKP,CAAG;CACpB;CACA,OAAOF;AACT"}
1
+ {"version":3,"file":"imageApiCms.js","names":["axios","END_POINT","ENTITY","BULK_METADATA_LIMIT","SINGLE_USE_USAGE_GROUP_LIMIT","fetchImageListByIds","useApiFetchByIds","execute","ids","fetchImage","useApiRequest","createImage","data","updateImage","deleteImage","useApiCommand","fetchSingleUseUsage","requests","offset","groupIds","useApiFetchItems","usageHolder","usages","items","usage","groupId","ImageSaveErrorCode","ImageSaveErrorReason","extractImageSaveErrorInfo","axiosError","isAnzuFatalError","error","isAnzuApiAxiosError","code","value","bulkUpdateImages","client","resolve","responses","reject","res","response","err","updateImagesSequence","totalCalls","reqData"],"sources":["../../../../../src/domains/dam/imageWidget/composables/imageApiCms.ts"],"sourcesContent":["import axios, { type AxiosInstance, type AxiosResponse } from 'axios'\nimport type { DocId, IntegerId } from '@/shared/types/common'\nimport type { ImageAware, ImageCreateUpdateAware } from '@/domains/dam/types/ImageAware'\nimport type { AssetSingleUseUsage } from '@/domains/dam/types/Asset'\nimport type { AssetSelectUsageHolder } from '@/domains/dam/types/AssetSelect'\nimport { HTTP_STATUS_OK } from '@/shared/statusCodes'\nimport { useApiFetchByIds } from '@/domains/api/composables/useApiFetchByIds'\nimport { useApiFetchItems } from '@/domains/api/composables/useApiFetchItems'\nimport { useApiCommand, useApiRequest } from '@/domains/api/composables/useApiRequest'\nimport { isAnzuFatalError } from '@/shared/error/AnzuFatalError'\nimport { isAnzuApiAxiosError } from '@/shared/error/AnzuApiAxiosError'\nimport { isUndefined } from '@/shared/utils/common'\n\nconst END_POINT = '/adm/v1/image'\nexport const ENTITY = 'image'\nexport const SYSTEM_CMS = 'cms'\n\nconst BULK_METADATA_LIMIT = 20\nconst SINGLE_USE_USAGE_GROUP_LIMIT = 100\n\nexport const fetchImageListByIds = (client: () => AxiosInstance, ids: IntegerId[]) => {\n const { execute } = useApiFetchByIds<ImageAware>({\n client,\n system: SYSTEM_CMS,\n entity: ENTITY,\n urlTemplate: END_POINT,\n })\n\n return execute(ids)\n}\n\n// `optionalBody`: a body-less answer here means there is no image, not a broken endpoint.\n// Callers guard the result with a strict `isNull`, so it is normalised to `null`.\nexport const fetchImage = async (client: () => AxiosInstance, id: IntegerId) => {\n const { execute } = useApiRequest<ImageAware, null>({\n client,\n method: 'GET',\n system: SYSTEM_CMS,\n entity: ENTITY,\n urlTemplate: END_POINT + '/:id',\n optionalBody: true,\n })\n\n return (await execute({ urlParams: { id } })) ?? null\n}\n\nexport const createImage = (client: () => AxiosInstance, data: ImageCreateUpdateAware) => {\n const { execute } = useApiRequest<ImageAware, ImageCreateUpdateAware>({\n client,\n method: 'POST',\n system: SYSTEM_CMS,\n entity: ENTITY,\n urlTemplate: END_POINT,\n })\n\n return execute({ body: data })\n}\n\nexport const updateImage = (client: () => AxiosInstance, id: IntegerId, data: ImageCreateUpdateAware) => {\n const { execute } = useApiRequest<ImageAware, ImageCreateUpdateAware>({\n client,\n method: 'PUT',\n system: SYSTEM_CMS,\n entity: ENTITY,\n urlTemplate: END_POINT + '/:id',\n })\n\n return execute({ urlParams: { id }, body: data })\n}\n\nexport const deleteImage = (client: () => AxiosInstance, id: IntegerId) => {\n const { execute } = useApiCommand({\n client,\n method: 'DELETE',\n system: SYSTEM_CMS,\n entity: ENTITY,\n urlTemplate: END_POINT + '/:id',\n })\n\n return execute({ urlParams: { id } })\n}\n\ninterface SingleUseUsageItem extends AssetSingleUseUsage {\n groupId: DocId\n}\n\n/**\n * Where each photo group is used, for the record `usageHolder` that picks (none: for no record), keyed by group id.\n * A group is the root file of a photo with the files taken over from it. Asked 100 groups per request, in parallel.\n */\nexport const fetchSingleUseUsage = async (\n client: () => AxiosInstance,\n groupIds: DocId[],\n usageHolder: AssetSelectUsageHolder | null\n): Promise<Record<DocId, AssetSingleUseUsage>> => {\n const requests: Promise<SingleUseUsageItem[]>[] = []\n for (let offset = 0; offset < groupIds.length; offset += SINGLE_USE_USAGE_GROUP_LIMIT) {\n const { execute } = useApiFetchItems<SingleUseUsageItem>({\n client,\n system: SYSTEM_CMS,\n entity: ENTITY,\n urlTemplate: END_POINT + '/single-use-usage',\n options: {\n params: {\n groupIds: groupIds.slice(offset, offset + SINGLE_USE_USAGE_GROUP_LIMIT).join(','),\n ...(usageHolder\n ? { holderResourceName: usageHolder.resourceName, holderResourceId: usageHolder.resourceId }\n : {}),\n },\n },\n })\n requests.push(execute())\n }\n const usages: Record<DocId, AssetSingleUseUsage> = {}\n for (const items of await Promise.all(requests)) {\n for (const { groupId, ...usage } of items) {\n usages[groupId] = usage\n }\n }\n return usages\n}\n\n/** Error codes of core-cms refusing an image save (an image row of any record: article, gallery, person...). */\nexport const ImageSaveErrorCode = {\n TakeOverFailed: 'image_take_over_failed',\n SingleUseViolation: 'image_single_use_violation',\n} as const\nexport type ImageSaveErrorCodeType = (typeof ImageSaveErrorCode)[keyof typeof ImageSaveErrorCode]\n\n// Mirrors the reasons of core-cms; an unknown reason falls back to the generic wording.\nexport const ImageSaveErrorReason = {\n ExclusivityConflict: 'exclusivity_conflict',\n SharedGallery: 'shared_gallery',\n InvalidOwner: 'invalid_owner',\n GalleryCopy: 'gallery_copy',\n RestoreConflict: 'restore_conflict',\n TakeOverRejected: 'take_over_rejected',\n TakeOverException: 'take_over_exception',\n} as const\nexport type ImageSaveErrorReasonType = (typeof ImageSaveErrorReason)[keyof typeof ImageSaveErrorReason]\n\nexport interface ImageSaveErrorInfo {\n code: ImageSaveErrorCodeType\n reason?: ImageSaveErrorReasonType\n damId?: DocId\n holderResourceName?: string\n holderResourceId?: string\n}\n\n/**\n * The refusal of an image save by core-cms, from what a save rejected with: an error of the api helpers\n * (`AnzuApiAxiosError`, `AnzuFatalError`) or a bare axios error (`bulkUpdateImages`). `undefined` for any other.\n */\nexport const extractImageSaveErrorInfo = (error: unknown): ImageSaveErrorInfo | undefined => {\n const axiosError =\n isAnzuFatalError(error) || isAnzuApiAxiosError(error) ? error.cause : axios.isAxiosError(error) ? error : undefined\n if (!axios.isAxiosError(axiosError)) return undefined\n const data = axiosError.response?.data\n const code = Object.values(ImageSaveErrorCode).find((value) => value === data?.error)\n if (isUndefined(code)) return undefined\n return {\n code,\n reason: Object.values(ImageSaveErrorReason).find((value) => value === data.reason),\n damId: typeof data.damId === 'string' ? data.damId : undefined,\n holderResourceName: typeof data.holderResourceName === 'string' ? data.holderResourceName : undefined,\n holderResourceId:\n typeof data.holderResourceId === 'string' || typeof data.holderResourceId === 'number'\n ? String(data.holderResourceId)\n : undefined,\n }\n}\n\nexport const bulkUpdateImages = (client: () => AxiosInstance, items: ImageCreateUpdateAware[]) => {\n return new Promise<ImageAware[]>((resolve, reject) => {\n updateImagesSequence(client, items)\n .then((responses) => {\n if (items.length === 0) {\n return resolve([])\n } else if (responses.length === 0) {\n return reject(responses)\n } else if (\n responses.every((res) => {\n return res.status === HTTP_STATUS_OK\n })\n ) {\n const images: ImageAware[] = responses.flatMap((response) => response.data.images)\n return resolve(images)\n } else {\n return reject(responses)\n }\n })\n .catch((err) => {\n //\n return reject(err)\n })\n })\n}\n\nasync function updateImagesSequence(client: () => AxiosInstance, items: ImageCreateUpdateAware[]) {\n const totalCalls = Math.ceil(items.length / BULK_METADATA_LIMIT)\n const responses: AxiosResponse[] = []\n if (items.length === 0) return Promise.resolve([])\n\n for (let i = 0; i < totalCalls; i++) {\n const offset = i * BULK_METADATA_LIMIT\n const reduced = items.slice(offset, offset + BULK_METADATA_LIMIT)\n const reqData = { images: reduced }\n const res = await client().put(END_POINT, JSON.stringify(reqData))\n responses.push(res)\n }\n return responses\n}\n"],"mappings":";;;;;;;;;AAaA,IAAMC,IAAY,iBACLC,IAAS,SAGhBC,IAAsB,IACtBC,IAA+B,KAExBC,KAAuB,GAA6B,MAAqB;CACpF,IAAM,EAAE,eAAYC,EAA6B;EAC/C;EACA,QAAA;EACA,QAAQJ;EACR,aAAaD;CACf,CAAC;CAED,OAAOM,EAAQC,CAAG;AACpB,GAIaC,IAAa,OAAO,GAA6B,MAAkB;CAC9E,IAAM,EAAE,eAAYC,EAAgC;EAClD;EACA,QAAQ;EACR,QAAA;EACA,QAAQR;EACR,aAAaD,IAAY;EACzB,cAAc;CAChB,CAAC;CAED,OAAQ,MAAMM,EAAQ,EAAE,WAAW,EAAE,MAAG,EAAE,CAAC,KAAM;AACnD,GAEaI,KAAe,GAA6B,MAAiC;CACxF,IAAM,EAAE,eAAYD,EAAkD;EACpE;EACA,QAAQ;EACR,QAAA;EACA,QAAQR;EACR,aAAaD;CACf,CAAC;CAED,OAAOM,EAAQ,EAAE,MAAMK,EAAK,CAAC;AAC/B,GAEaC,KAAe,GAA6B,GAAe,MAAiC;CACvG,IAAM,EAAE,eAAYH,EAAkD;EACpE;EACA,QAAQ;EACR,QAAA;EACA,QAAQR;EACR,aAAaD,IAAY;CAC3B,CAAC;CAED,OAAOM,EAAQ;EAAE,WAAW,EAAE,MAAG;EAAG,MAAMK;CAAK,CAAC;AAClD,GAEaE,KAAe,GAA6B,MAAkB;CACzE,IAAM,EAAE,eAAYC,EAAc;EAChC;EACA,QAAQ;EACR,QAAA;EACA,QAAQb;EACR,aAAaD,IAAY;CAC3B,CAAC;CAED,OAAOM,EAAQ,EAAE,WAAW,EAAE,MAAG,EAAE,CAAC;AACtC,GAUaS,IAAsB,OACjC,GACA,GACA,MACgD;CAChD,IAAMC,IAA4C,CAAC;CACnD,KAAK,IAAIC,IAAS,GAAGA,IAASC,EAAS,QAAQ,KAAUf,GAA8B;EACrF,IAAM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BAAqB,WAC1E,OAAOA,EAAK,gBAAgB,IAC5B,KAAA;CACR;AACF,GAEauB,KAAoB,GAA6B,MACrD,IAAI,SAAuB,GAAS,MAAW;CACpD,EAAqBC,GAAQb,CAAK,CAAC,CAChC,MAAM,MACDA,EAAM,WAAW,IACZc,EAAQ,CAAC,CAAC,IACRC,EAAU,WAAW,IACvBC,EAAOD,CAAS,IAEvBA,EAAU,OAAO,MACRE,EAAI,WAAA,GACZ,IAGMH,EADsBC,EAAU,SAAS,MAAaG,EAAS,KAAK,MAC5D,CAAM,IAEdF,EAAOD,CAAS,CAE1B,CAAC,CACD,OAAO,MAECC,EAAOG,CAAG,CAClB;AACL,CAAC;AAGH,eAAeC,EAAqB,GAA6B,GAAiC;CAChG,IAAMC,IAAa,KAAK,KAAKrB,EAAM,SAASpB,CAAmB,GACzDmC,IAA6B,CAAC;CACpC,IAAIf,EAAM,WAAW,GAAG,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAEjD,KAAK,IAAI,IAAI,GAAG,IAAIqB,GAAY,KAAK;EACnC,IAAM1B,IAAS,IAAIf,GAEb0C,IAAU,EAAE,QADFtB,EAAM,MAAML,GAAQA,IAASf,CACnB,EAAQ,GAC5BqC,IAAM,MAAMJ,EAAO,CAAC,CAAC,IAAInC,GAAW,KAAK,UAAU4C,CAAO,CAAC;EACjE,EAAU,KAAKL,CAAG;CACpB;CACA,OAAOF;AACT"}
@@ -54,6 +54,7 @@ export declare function useImageDialogDamAuthors(configName: string, shownImage:
54
54
  originFileName: string;
55
55
  originUrl: string;
56
56
  failReason: import('../../types/AssetFile').AssetFileFailReasonType;
57
+ takenOverFromId: DocId;
57
58
  };
58
59
  imageAttributes: {
59
60
  ratioWidth: number;
@@ -149,6 +150,7 @@ export declare function useImageDialogDamAuthors(configName: string, shownImage:
149
150
  originFileName: string;
150
151
  originUrl: string;
151
152
  failReason: import('../../types/AssetFile').AssetFileFailReasonType;
153
+ takenOverFromId: DocId;
152
154
  };
153
155
  audioAttributes: {
154
156
  duration: number;
@@ -235,6 +237,7 @@ export declare function useImageDialogDamAuthors(configName: string, shownImage:
235
237
  originFileName: string;
236
238
  originUrl: string;
237
239
  failReason: import('../../types/AssetFile').AssetFileFailReasonType;
240
+ takenOverFromId: DocId;
238
241
  };
239
242
  videoAttributes: {
240
243
  bitrate: number;
@@ -319,6 +322,7 @@ export declare function useImageDialogDamAuthors(configName: string, shownImage:
319
322
  originFileName: string;
320
323
  originUrl: string;
321
324
  failReason: import('../../types/AssetFile').AssetFileFailReasonType;
325
+ takenOverFromId: DocId;
322
326
  };
323
327
  documentAttributes: {
324
328
  pageCount: number;
@@ -430,6 +434,7 @@ export declare function useImageDialogDamAuthors(configName: string, shownImage:
430
434
  takeHeldAnew: (anew: HeldAssetAnew | null, image: ImageCreateUpdateAware | null) => void;
431
435
  letGoOnceSavedWithSource: (image: ImageCreateUpdateAware) => () => void;
432
436
  authorsGivenMeanwhile: (asset: AssetDetailItemDto) => Promise<string | null>;
437
+ writeCreditToSavedAsset: (damId: DocId, authors: DocId[], sources: DocId[], pageExtSystem: IntegerId) => Promise<void>;
433
438
  /** A confirm waits for the read of a just-closed detail's asset. Its button spins. */
434
439
  confirmWaits: import('vue').Ref<boolean, boolean>;
435
440
  };
@@ -1,107 +1,107 @@
1
- import { fetchAsset as e } from "../../api/damAssetApi.js";
2
- import { useAssetDetailStore as t } from "../../assetDetail/store/assetDetailStore.js";
3
- import { fetchDamCredit as n, hasNoDamCredit as r, useDamCreditConfig as i } from "../../author/composables/damCredit.js";
4
- import { useCommonAdminCoreDamOptions as a } from "../../composables/commonAdminCoreDamOptions.js";
5
- import { useExtSystemIdForCached as o } from "../../composables/extSystemIdForCached.js";
6
- import { useDamConfigState as s } from "../../config/composables/damConfigState.js";
7
- import { useAlerts as c } from "../../../system/composables/alerts.js";
8
- import { isNull as l } from "../../../../shared/utils/common.js";
9
- import { WAIT_RAN_OUT as u, withinWaitLimit as d } from "../utils/waitLimit.js";
10
- import { computed as f, onBeforeUnmount as p, ref as m, shallowRef as h, watch as g } from "vue";
1
+ import { fetchAsset as e, fetchAssetByFileId as t, showMetadataSaveError as n, updateAssetAuthors as r } from "../../api/damAssetApi.js";
2
+ import { useAssetDetailStore as i } from "../../assetDetail/store/assetDetailStore.js";
3
+ import { fetchDamCredit as a, hasNoDamCredit as o, useDamCreditConfig as s } from "../../author/composables/damCredit.js";
4
+ import { useCommonAdminCoreDamOptions as c } from "../../composables/commonAdminCoreDamOptions.js";
5
+ import { useExtSystemIdForCached as l } from "../../composables/extSystemIdForCached.js";
6
+ import { useDamConfigState as u } from "../../config/composables/damConfigState.js";
7
+ import { useAlerts as d } from "../../../system/composables/alerts.js";
8
+ import { isNull as f } from "../../../../shared/utils/common.js";
9
+ import { WAIT_RAN_OUT as p, withinWaitLimit as m } from "../utils/waitLimit.js";
10
+ import { computed as h, onBeforeUnmount as g, ref as _, shallowRef as v, watch as y } from "vue";
11
11
  // src/domains/dam/imageWidget/composables/imageDialogDamAuthors.ts
12
- var _ = 4, v = (e, t) => {
12
+ var b = 4, x = (e, t) => {
13
13
  e.texts.source.trim().length === 0 && (e.texts.source = t);
14
14
  };
15
- function y(y, b, x) {
16
- let { damClient: S, endPointAsset: C, endPointAuthor: w } = a(y), { getExtSystemByLicence: T } = s(S, y), E = i(y), { cachedExtSystemId: D } = o(y), O = t(), { showErrorsDefault: k, showErrorT: A, showUnknownError: j } = c(), M = m(null), N = !1;
17
- p(() => {
18
- N = !0;
15
+ function S(S, C, w) {
16
+ let { damClient: T, endPointAsset: E, endPointAuthor: D } = c(S), { getExtSystemByLicence: O } = u(T, S), k = s(S), { cachedExtSystemId: A } = l(S), j = i(), { showErrorsDefault: M, showErrorT: N, showUnknownError: P } = d(), F = _(null), I = !1;
17
+ g(() => {
18
+ I = !0;
19
19
  });
20
- let P = () => {
21
- let e = b();
22
- return !l(M.value) && !l(e) && e.dam.damId === M.value.file ? e : null;
23
- }, F = h(null), I = f(() => {
24
- if (l(M.value)) return null;
25
- let e = P();
26
- return l(e) || e === F.value ? null : M.value.asset;
27
- }), L = (e, t) => {
28
- M.value = {
20
+ let L = () => {
21
+ let e = C();
22
+ return !f(F.value) && !f(e) && e.dam.damId === F.value.file ? e : null;
23
+ }, R = v(null), z = h(() => {
24
+ if (f(F.value)) return null;
25
+ let e = L();
26
+ return f(e) || e === R.value ? null : F.value.asset;
27
+ }), B = (e, t) => {
28
+ F.value = {
29
29
  asset: e,
30
30
  file: t
31
31
  };
32
- }, R = () => {
33
- M.value = null;
34
- }, z = (e) => {
35
- let t = I.value;
32
+ }, V = () => {
33
+ F.value = null;
34
+ }, H = (e) => {
35
+ let t = z.value;
36
36
  t && (t.authors = e);
37
- }, B = (e) => {
38
- let t = I.value;
37
+ }, U = (e) => {
38
+ let t = z.value;
39
39
  t && (t.sources = e);
40
- }, V = async (e, t) => {
41
- let r = await T(e.licence) ?? t;
42
- return n(S, w, r, e.sources, e.authors, E(r, t));
43
- }, H = async (t, n, i) => {
40
+ }, W = async (e, t) => {
41
+ let n = await O(e.licence) ?? t;
42
+ return a(T, D, n, e.sources, e.authors, k(n, t));
43
+ }, G = async (t, n, r) => {
44
44
  try {
45
45
  await n;
46
- let a = await e(S, C, t.asset.id), o = r(a.authors, a.sources) ? "" : await V(a, i), s = {
46
+ let i = await e(T, E, t.asset.id), a = o(i.authors, i.sources) ? "" : await W(i, r), s = {
47
47
  of: t,
48
- asset: a,
49
- names: o
48
+ asset: i,
49
+ names: a
50
50
  };
51
- if (N || x() || M.value !== t) return s;
52
- if (r(a.authors, a.sources)) return t.asset = {
53
- ...a,
51
+ if (I || w() || F.value !== t) return s;
52
+ if (o(i.authors, i.sources)) return t.asset = {
53
+ ...i,
54
54
  authors: t.asset.authors,
55
55
  sources: t.asset.sources
56
56
  }, s;
57
- let c = P();
58
- return l(c) || (M.value = null, v(c, o)), s;
57
+ let c = L();
58
+ return f(c) || (F.value = null, x(c, a)), s;
59
59
  } catch (e) {
60
- if (N) return null;
61
- k(e);
62
- let n = M.value === t ? P() : null;
63
- return n && (F.value = n), null;
60
+ if (I) return null;
61
+ M(e);
62
+ let n = F.value === t ? L() : null;
63
+ return n && (R.value = n), null;
64
64
  }
65
- }, U = null, W = /* @__PURE__ */ new Map(), G = null, K = m(!1), q = () => {
66
- G = null, K.value = !1;
65
+ }, K = null, q = /* @__PURE__ */ new Map(), J = null, Y = _(!1), X = () => {
66
+ J = null, Y.value = !1;
67
67
  };
68
- return g(b, (e) => {
69
- q(), e !== F.value && (F.value = null);
68
+ return y(C, (e) => {
69
+ X(), e !== R.value && (R.value = null);
70
70
  }, { flush: "sync" }), {
71
- damAuthorsAsset: I,
72
- offerDamAuthorsOf: L,
73
- offerNoDamAuthors: R,
74
- pickDamAuthors: z,
75
- pickDamSources: B,
71
+ damAuthorsAsset: z,
72
+ offerDamAuthorsOf: B,
73
+ offerNoDamAuthors: V,
74
+ pickDamAuthors: H,
75
+ pickDamSources: U,
76
76
  onAssetDetailClose: (e) => {
77
- let t = M.value;
78
- if (l(e) || l(t) || l(P()) || x()) return;
79
- let n = t.asset.id, r = O.savingOf(n, y), i = D.value, a = (W.get(n) ?? Promise.resolve()).then(() => H(t, r, i));
80
- W.set(n, a), U = a, a.then(() => {
81
- W.get(n) === a && W.delete(n), U === a && (U = null);
77
+ let t = F.value;
78
+ if (f(e) || f(t) || f(L()) || w()) return;
79
+ let n = t.asset.id, r = j.savingOf(n, S), i = A.value, a = (q.get(n) ?? Promise.resolve()).then(() => G(t, r, i));
80
+ q.set(n, a), K = a, a.then(() => {
81
+ q.get(n) === a && q.delete(n), K === a && (K = null);
82
82
  });
83
83
  },
84
84
  holdConfirmForDetailAssetRead: (e, t) => {
85
- let n = U;
86
- if (l(n)) return !1;
87
- if (e || !l(G)) return !0;
88
- let r = G = Symbol("confirm");
89
- return K.value = !0, d(n, _, y).then((e) => {
90
- G === r && (q(), e === u ? N || A("error.apiTimedOut.message") : l(e) || t());
85
+ let n = K;
86
+ if (f(n)) return !1;
87
+ if (e || !f(J)) return !0;
88
+ let r = J = Symbol("confirm");
89
+ return Y.value = !0, m(n, b, S).then((e) => {
90
+ J === r && (X(), e === p ? I || N("error.apiTimedOut.message") : f(e) || t());
91
91
  }), !0;
92
92
  },
93
93
  readHeldAnew: (t) => {
94
- let n = M.value;
95
- if (l(n) || n.file !== t || x()) return null;
96
- let i = D.value;
97
- return (U ?? Promise.resolve(null)).then(async (t) => {
94
+ let n = F.value;
95
+ if (f(n) || n.file !== t || w()) return null;
96
+ let r = A.value;
97
+ return (K ?? Promise.resolve(null)).then(async (t) => {
98
98
  if (t?.of === n) return t;
99
99
  try {
100
- let t = await e(S, C, n.asset.id);
100
+ let t = await e(T, E, n.asset.id);
101
101
  return {
102
102
  of: n,
103
103
  asset: t,
104
- names: r(t.authors, t.sources) ? "" : await V(t, i)
104
+ names: o(t.authors, t.sources) ? "" : await W(t, r)
105
105
  };
106
106
  } catch (e) {
107
107
  return {
@@ -112,21 +112,34 @@ function y(y, b, x) {
112
112
  });
113
113
  },
114
114
  takeHeldAnew: (e, t) => {
115
- l(e) || N || x() || l(t) || t.dam.damId !== e.of.file || ("failure" in e ? (k(e.failure) || j(), M.value === e.of && (F.value = t)) : r(e.asset.authors, e.asset.sources) ? M.value === e.of && (e.of.asset = e.asset) : (M.value === e.of && (M.value = null), v(t, e.names)));
115
+ f(e) || I || w() || f(t) || t.dam.damId !== e.of.file || ("failure" in e ? (M(e.failure) || P(), F.value === e.of && (R.value = t)) : o(e.asset.authors, e.asset.sources) ? F.value === e.of && (e.of.asset = e.asset) : (F.value === e.of && (F.value = null), x(t, e.names)));
116
116
  },
117
117
  letGoOnceSavedWithSource: (e) => {
118
- let t = M.value;
119
- return l(t) || t.file !== e.dam.damId || !l(I.value) ? () => void 0 : () => {
120
- M.value === t && (M.value = null);
118
+ let t = F.value;
119
+ return f(t) || t.file !== e.dam.damId || !f(z.value) ? () => void 0 : () => {
120
+ F.value === t && (F.value = null);
121
121
  };
122
122
  },
123
123
  authorsGivenMeanwhile: async (t) => {
124
- let n = D.value, i = await e(S, C, t.id);
125
- return r(i.authors, i.sources) ? null : V(i, n);
124
+ let n = A.value, r = await e(T, E, t.id);
125
+ return o(r.authors, r.sources) ? null : W(r, n);
126
126
  },
127
- confirmWaits: K
127
+ writeCreditToSavedAsset: async (e, i, a, o) => {
128
+ let s = o;
129
+ try {
130
+ let n = await t(T, E, e);
131
+ s = await O(n.licence) ?? o, await r(T, E, {
132
+ ...n,
133
+ authors: i,
134
+ sources: a
135
+ }, s, S);
136
+ } catch (e) {
137
+ n(e, s, S);
138
+ }
139
+ },
140
+ confirmWaits: Y
128
141
  };
129
142
  }
130
- export { v as giveNamesToEmptySource, y as useImageDialogDamAuthors };
143
+ export { x as giveNamesToEmptySource, S as useImageDialogDamAuthors };
131
144
 
132
145
  //# sourceMappingURL=imageDialogDamAuthors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"imageDialogDamAuthors.js","names":["REQUESTS_OF_A_DETAIL_ASSET_READ","giveNamesToEmptySource","image","names","useImageDialogDamAuthors","useCommonAdminCoreDamOptions","configName","useDamConfigState","damClient","creditConfigOf","useDamCreditConfig","useExtSystemIdForCached","assetDetailStore","useAssetDetailStore","useAlerts","held","ref","unmounted","imageOfHeld","shownImage","isNull","staleIn","shallowRef","damAuthorsAsset","computed","offerDamAuthorsOf","offerNoDamAuthors","pickDamAuthors","asset","authors","pickDamSources","sources","namesOf","extSystem","getExtSystemByLicence","pageExtSystem","fetchDamCredit","endPointAuthor","takeAuthorsOfDetailAsset","detailSave","fetchAsset","endPointAsset","of","source","hasNoDamCredit","read","readonly","detailAssetRead","detailAssetReads","waitingConfirm","confirmWaits","dropWaitingConfirm","watch","shown","assetId","cachedExtSystemId","saving","waiting","withinWaitLimit","answer","WAIT_RAN_OUT","showErrorT","again","file","afterDetail","failure","anew","showErrorsDefault","showUnknownError"],"sources":["../../../../../src/domains/dam/imageWidget/composables/imageDialogDamAuthors.ts"],"sourcesContent":["import { computed, onBeforeUnmount, ref, shallowRef, watch } from 'vue'\nimport { fetchAsset } from '@/domains/dam/api/damAssetApi'\nimport { useAssetDetailStore } from '@/domains/dam/assetDetail/store/assetDetailStore'\nimport { fetchDamCredit, hasNoDamCredit, useDamCreditConfig } from '@/domains/dam/author/composables/damCredit'\nimport { useCommonAdminCoreDamOptions } from '@/domains/dam/composables/commonAdminCoreDamOptions'\nimport { useExtSystemIdForCached } from '@/domains/dam/composables/extSystemIdForCached'\nimport { useDamConfigState } from '@/domains/dam/config/composables/damConfigState'\nimport type { AssetDetailItemDto } from '@/domains/dam/types/Asset'\nimport type { ImageCreateUpdateAware } from '@/domains/dam/types/ImageAware'\nimport { useAlerts } from '@/domains/system/composables/alerts'\nimport type { DocId, IntegerId } from '@/shared/types/common'\nimport { isNull } from '@/shared/utils/common'\nimport { WAIT_RAN_OUT, withinWaitLimit } from '@/domains/dam/imageWidget/utils/waitLimit'\n\ninterface HeldAsset {\n asset: AssetDetailItemDto\n /** The file the asset was read for, i.e. the file of the image made from that pick. */\n file: DocId\n}\n\n/** Result of re-reading the held asset: the asset with its credit, or the failure. */\nexport type HeldAssetAnew =\n | { of: HeldAsset; asset: AssetDetailItemDto; names: string }\n | { of: HeldAsset; failure: unknown }\n\n/** Result of reading a held asset after its detail closed. */\ntype DetailAssetRead = { of: HeldAsset; asset: AssetDetailItemDto; names: string }\n\n// Sequential requests of a read after a detail closes: the rest of the detail save, the asset,\n// the asset licence (once per page), and the names of its sources and authors.\nconst REQUESTS_OF_A_DETAIL_ASSET_READ = 4\n\n/**\n * Fills an empty source with the credit once the held asset turns out to have sources or authors.\n * The pick creates the image with an empty source, and the dialog hides the source while it offers the pick.\n * So an empty or whitespace-only source belongs to the pick. A non-empty source came from a save elsewhere and stays.\n */\nexport const giveNamesToEmptySource = (image: ImageCreateUpdateAware, names: string) => {\n if (image.texts.source.trim().length === 0) image.texts.source = names\n}\n\n/**\n * DAM sources and authors the single-image widget dialog offers in place of a source,\n * for a library-picked asset that has neither.\n * The widget holds the asset and the file it was read for, and offers its authors only in that file's image dialog.\n * Do not use the asset detail store: it is shared per page by the picker,\n * detail and other widgets, which caused wrong authors to be saved.\n * `shownImage`: the image the widget dialog shows, or none.\n */\nexport function useImageDialogDamAuthors(\n configName: string,\n shownImage: () => ImageCreateUpdateAware | null,\n readonly: () => boolean\n) {\n const { damClient, endPointAsset, endPointAuthor } = useCommonAdminCoreDamOptions(configName)\n const { getExtSystemByLicence } = useDamConfigState(damClient, configName)\n const creditConfigOf = useDamCreditConfig(configName)\n const { cachedExtSystemId } = useExtSystemIdForCached(configName)\n const assetDetailStore = useAssetDetailStore()\n const { showErrorsDefault, showErrorT, showUnknownError } = useAlerts()\n\n const held = ref<HeldAsset | null>(null)\n // A read may end once the widget is gone.\n let unmounted = false\n onBeforeUnmount(() => {\n unmounted = true\n })\n\n /** The image the dialog shows, when it is the one the held asset was read for. */\n const imageOfHeld = () => {\n const image = shownImage()\n return !isNull(held.value) && !isNull(image) && image.dam.damId === held.value.file ? image : null\n }\n\n // The shown image after a read of the held asset for it failed. The held asset may then be stale.\n // The dialog shows the image source instead of the pick until it shows an image again.\n // Otherwise it kept offering the stale pick, and its confirm wrote nothing only after the user had picked.\n const staleIn = shallowRef<ImageCreateUpdateAware | null>(null)\n\n /**\n * The asset whose authors the dialog offers.\n * Null unless the dialog shows the image the asset was read for and the last read for that image has not failed.\n */\n const damAuthorsAsset = computed(() => {\n if (isNull(held.value)) return null\n const image = imageOfHeld()\n return isNull(image) || image === staleIn.value ? null : held.value.asset\n })\n\n const offerDamAuthorsOf = (asset: AssetDetailItemDto, file: DocId) => {\n held.value = { asset, file }\n }\n\n const offerNoDamAuthors = () => {\n held.value = null\n }\n\n const pickDamAuthors = (authors: DocId[]) => {\n const asset = damAuthorsAsset.value\n if (asset) asset.authors = authors\n }\n\n const pickDamSources = (sources: DocId[]) => {\n const asset = damAuthorsAsset.value\n if (asset) asset.sources = sources\n }\n\n /**\n * The credit resolves under the ext system of the asset licence: its names, and its format once loaded.\n * Falls back to `pageExtSystem` when the licence has none.\n */\n const namesOf = async (asset: AssetDetailItemDto, pageExtSystem: IntegerId) => {\n const extSystem = (await getExtSystemByLicence(asset.licence)) ?? pageExtSystem\n return fetchDamCredit(\n damClient,\n endPointAuthor,\n extSystem,\n asset.sources,\n asset.authors,\n creditConfigOf(extSystem, pageExtSystem)\n )\n }\n\n /**\n * The \"edit asset\" detail may have added sources or authors, so the asset is read again.\n * The read waits for the detail save that was pending on close. An earlier read returns the old asset.\n * If the asset now has either, the pick is dropped and an\n * empty image source takes their credit. An existing source stays.\n * `pageExtSystem` is the ext system configured when the detail closed. It is used when the licence gives none.\n */\n const takeAuthorsOfDetailAsset = async (\n of: HeldAsset,\n detailSave: Promise<void> | null,\n pageExtSystem: IntegerId\n ): Promise<DetailAssetRead | null> => {\n try {\n await detailSave\n const asset = await fetchAsset(damClient, endPointAsset, of.asset.id)\n const source = hasNoDamCredit(asset.authors, asset.sources) ? '' : await namesOf(asset, pageExtSystem)\n const read = { of, asset, names: source }\n // Unmounted, turned read-only, or now holding another pick's asset: write nothing.\n if (unmounted || readonly() || held.value !== of) return read\n if (hasNoDamCredit(asset.authors, asset.sources)) {\n of.asset = { ...asset, authors: of.asset.authors, sources: of.asset.sources }\n return read\n }\n // Write only into the image the asset was read for. The dialog may have closed or show another image.\n // The widget keeps holding the asset, so \"edit image\" of that file re-reads\n // it and fills the empty source. Dropping it here left that source empty.\n const image = imageOfHeld()\n if (isNull(image)) return read\n held.value = null\n giveNamesToEmptySource(image, source)\n return read\n } catch (e) {\n if (unmounted) return null\n showErrorsDefault(e)\n const image = held.value === of ? imageOfHeld() : null\n if (image) staleIn.value = image\n return null\n }\n }\n\n // The latest pending read of an asset whose detail closed. \"Confirm\" waits for it, and \"edit image\" uses its result.\n let detailAssetRead: Promise<DetailAssetRead | null> | null = null\n // Pending detail-close reads, chained per asset. A read of another asset does not wait for them.\n const detailAssetReads = new Map<DocId, Promise<DetailAssetRead | null>>()\n // The confirm currently waiting for that read, if any.\n let waitingConfirm: symbol | null = null\n const confirmWaits = ref(false)\n const dropWaitingConfirm = () => {\n waitingConfirm = null\n confirmWaits.value = false\n }\n // A confirm belongs to the dialog opening it was pressed in. Drop it when the dialog closes or shows a new image.\n // Otherwise the read could answer after a reopen and confirm and save that opening without a press.\n watch(\n shownImage,\n (image) => {\n dropWaitingConfirm()\n if (image !== staleIn.value) staleIn.value = null\n },\n { flush: 'sync' }\n )\n\n /**\n * \"Confirm\" pressed while a just-closed detail's asset is still read. The read may change what\n * the form asks for, so the confirm waits (`true`) and `again` re-runs it after the read.\n * Repeated presses, or presses while `saving`, are ignored.\n * The wait is limited by `withinWaitLimit` over the read's sequential requests, so a slow\n * but answering DAM does not time out. On timeout the press is dropped and the user is told.\n * A failed read also drops the press. Otherwise it saved the image with the shown source, without the picked authors.\n */\n const holdConfirmForDetailAssetRead = (saving: boolean, again: () => void) => {\n const read = detailAssetRead\n if (isNull(read)) return false\n if (saving || !isNull(waitingConfirm)) return true\n const waiting = (waitingConfirm = Symbol('confirm'))\n confirmWaits.value = true\n void withinWaitLimit(read, REQUESTS_OF_A_DETAIL_ASSET_READ, configName).then((answer) => {\n if (waitingConfirm !== waiting) return\n dropWaitingConfirm()\n if (answer === WAIT_RAN_OUT) {\n if (!unmounted) showErrorT('error.apiTimedOut.message')\n return\n }\n if (isNull(answer)) return\n again()\n })\n return true\n }\n\n /**\n * `shown`: the asset the detail showed; none if it closed from its loader or after a failed read.\n * Reads only if the dialog offers this asset's authors. The read's inputs are captured before any await.\n */\n const onAssetDetailClose = (shown: AssetDetailItemDto | null) => {\n const of = held.value\n if (isNull(shown) || isNull(of) || isNull(imageOfHeld()) || readonly()) return\n const assetId = of.asset.id\n const detailSave = assetDetailStore.savingOf(assetId, configName)\n const pageExtSystem = cachedExtSystemId.value\n const read = (detailAssetReads.get(assetId) ?? Promise.resolve()).then(() =>\n takeAuthorsOfDetailAsset(of, detailSave, pageExtSystem)\n )\n detailAssetReads.set(assetId, read)\n detailAssetRead = read\n void read.then(() => {\n if (detailAssetReads.get(assetId) === read) detailAssetReads.delete(assetId)\n if (detailAssetRead === read) detailAssetRead = null\n })\n }\n\n /**\n * \"Edit image\" of `file`. The held asset is as it was at pick time and may have\n * gained authors since; confirming would overwrite them, so it is re-read first.\n * A pending detail-close read is newer and is reused. A failed one is retried.\n * Inputs are captured at the press because the read may drop the held asset.\n * Returns `null` if no asset is held for that file or the widget is read-only.\n */\n const readHeldAnew = (file: DocId | undefined): Promise<HeldAssetAnew> | null => {\n const of = held.value\n if (isNull(of) || of.file !== file || readonly()) return null\n const pageExtSystem = cachedExtSystemId.value\n return (detailAssetRead ?? Promise.resolve(null)).then(async (afterDetail) => {\n if (afterDetail?.of === of) return afterDetail\n try {\n const asset = await fetchAsset(damClient, endPointAsset, of.asset.id)\n return {\n of,\n asset,\n names: hasNoDamCredit(asset.authors, asset.sources) ? '' : await namesOf(asset, pageExtSystem),\n }\n } catch (failure) {\n return { of, failure }\n }\n })\n }\n\n /**\n * Applies a `readHeldAnew` result to the shown image of that file.\n * Without sources and authors the fresh asset becomes the held one, so picks from a dialog closed without\n * confirm do not return. With either the pick goes and an empty source takes their credit (`giveNamesToEmptySource`).\n * A failed read is reported once and the dialog shows the source until\n * a new image is shown. The asset stays held for the next \"edit image\".\n */\n const takeHeldAnew = (anew: HeldAssetAnew | null, image: ImageCreateUpdateAware | null) => {\n if (isNull(anew) || unmounted || readonly()) return\n if (isNull(image) || image.dam.damId !== anew.of.file) return\n if ('failure' in anew) {\n if (!showErrorsDefault(anew.failure)) showUnknownError()\n if (held.value === anew.of) staleIn.value = image\n return\n }\n if (hasNoDamCredit(anew.asset.authors, anew.asset.sources)) {\n if (held.value === anew.of) anew.of.asset = anew.asset\n return\n }\n if (held.value === anew.of) held.value = null\n giveNamesToEmptySource(image, anew.names)\n }\n\n /**\n * On confirm of `image`: release the held asset after save if the dialog showed the source because a read failed.\n * Otherwise the next \"edit image\" re-read the asset, showed the pick again, and a confirm replaced the user's source.\n */\n const letGoOnceSavedWithSource = (image: ImageCreateUpdateAware) => {\n const of = held.value\n if (isNull(of) || of.file !== image.dam.damId || !isNull(damAuthorsAsset.value)) return () => undefined\n return () => {\n if (held.value === of) held.value = null\n }\n }\n\n /**\n * Read right before picked sources and authors are written into `asset`. Returns the credit of those\n * given elsewhere meanwhile, or `null` if none. Throws if they cannot be read.\n * Not atomic: one added between this read and the write is still overwritten.\n */\n const authorsGivenMeanwhile = async (asset: AssetDetailItemDto) => {\n const pageExtSystem = cachedExtSystemId.value\n const read = await fetchAsset(damClient, endPointAsset, asset.id)\n return hasNoDamCredit(read.authors, read.sources) ? null : namesOf(read, pageExtSystem)\n }\n\n return {\n damAuthorsAsset,\n offerDamAuthorsOf,\n offerNoDamAuthors,\n pickDamAuthors,\n pickDamSources,\n onAssetDetailClose,\n holdConfirmForDetailAssetRead,\n readHeldAnew,\n takeHeldAnew,\n letGoOnceSavedWithSource,\n authorsGivenMeanwhile,\n /** A confirm waits for the read of a just-closed detail's asset. Its button spins. */\n confirmWaits,\n }\n}\n"],"mappings":";;;;;;;;;;;AA8BA,IAAMA,IAAkC,GAO3BC,KAA0B,GAA+B,MAAkB;CACtF,AAAIC,EAAM,MAAM,OAAO,KAAK,CAAC,CAAC,WAAW,MAAG,EAAM,MAAM,SAASC;AACnE;AAUA,SAAgBC,EACd,GACA,GACA,GACA;CACA,IAAM,EAAE,cAAW,kBAAe,sBAAmBC,EAA6BC,CAAU,GACtF,EAAE,6BAA0BC,EAAkBC,GAAWF,CAAU,GACnEG,IAAiBC,EAAmBJ,CAAU,GAC9C,EAAE,yBAAsBK,EAAwBL,CAAU,GAC1DM,IAAmBC,EAAoB,GACvC,EAAE,sBAAmB,eAAY,wBAAqBC,EAAU,GAEhEC,IAAOC,EAAsB,IAAI,GAEnCC,IAAY;CAChB,QAAsB;EACpB,IAAY;CACd,CAAC;CAGD,IAAMC,UAAoB;EACxB,IAAMhB,IAAQiB,EAAW;EACzB,OAAO,CAACC,EAAOL,EAAK,KAAK,KAA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K,GAAG,QAAQA,EAAK,UAG/CnD,EAAK,UAAUmD,EAAK,OAAI,EAAK,QAAQ,OACzCjE,EAAuBC,GAAOgE,EAAK,KAAK;EAC1C;EAmCE,2BA7BgC,MAAkC;GAClE,IAAMxB,IAAK3B,EAAK;GAEhB,OADIK,EAAOsB,CAAE,KAAKA,EAAG,SAASxC,EAAM,IAAI,SAAS,CAACkB,EAAOG,EAAgB,KAAK,UAAgB,KAAA,UACjF;IACX,AAAIR,EAAK,UAAU2B,MAAI,EAAK,QAAQ;GACtC;EACF;EAwBE,8BAjBmC,MAA8B;GACjE,IAAMP,IAAgBoB,EAAkB,OAClCV,IAAO,MAAML,EAAWhC,GAAWiC,GAAeb,EAAM,EAAE;GAChE,OAAOgB,EAAeC,EAAK,SAASA,EAAK,OAAO,IAAI,OAAOb,EAAQa,GAAMV,CAAa;EACxF;EAeE;CACF;AACF"}
1
+ {"version":3,"file":"imageDialogDamAuthors.js","names":["REQUESTS_OF_A_DETAIL_ASSET_READ","giveNamesToEmptySource","image","names","useImageDialogDamAuthors","useCommonAdminCoreDamOptions","configName","useDamConfigState","damClient","creditConfigOf","useDamCreditConfig","useExtSystemIdForCached","assetDetailStore","useAssetDetailStore","useAlerts","held","ref","unmounted","imageOfHeld","shownImage","isNull","staleIn","shallowRef","damAuthorsAsset","computed","offerDamAuthorsOf","offerNoDamAuthors","pickDamAuthors","asset","authors","pickDamSources","sources","namesOf","extSystem","getExtSystemByLicence","pageExtSystem","fetchDamCredit","endPointAuthor","takeAuthorsOfDetailAsset","detailSave","fetchAsset","endPointAsset","of","source","hasNoDamCredit","read","readonly","detailAssetRead","detailAssetReads","waitingConfirm","confirmWaits","dropWaitingConfirm","watch","shown","assetId","cachedExtSystemId","saving","waiting","withinWaitLimit","answer","WAIT_RAN_OUT","showErrorT","again","file","afterDetail","failure","anew","showErrorsDefault","showUnknownError","saved","fetchAssetByFileId","damId","updateAssetAuthors"],"sources":["../../../../../src/domains/dam/imageWidget/composables/imageDialogDamAuthors.ts"],"sourcesContent":["import { computed, onBeforeUnmount, ref, shallowRef, watch } from 'vue'\nimport {\n fetchAsset,\n fetchAssetByFileId,\n showMetadataSaveError,\n updateAssetAuthors,\n} from '@/domains/dam/api/damAssetApi'\nimport { useAssetDetailStore } from '@/domains/dam/assetDetail/store/assetDetailStore'\nimport { fetchDamCredit, hasNoDamCredit, useDamCreditConfig } from '@/domains/dam/author/composables/damCredit'\nimport { useCommonAdminCoreDamOptions } from '@/domains/dam/composables/commonAdminCoreDamOptions'\nimport { useExtSystemIdForCached } from '@/domains/dam/composables/extSystemIdForCached'\nimport { useDamConfigState } from '@/domains/dam/config/composables/damConfigState'\nimport type { AssetDetailItemDto } from '@/domains/dam/types/Asset'\nimport type { ImageCreateUpdateAware } from '@/domains/dam/types/ImageAware'\nimport { useAlerts } from '@/domains/system/composables/alerts'\nimport type { DocId, IntegerId } from '@/shared/types/common'\nimport { isNull } from '@/shared/utils/common'\nimport { WAIT_RAN_OUT, withinWaitLimit } from '@/domains/dam/imageWidget/utils/waitLimit'\n\ninterface HeldAsset {\n asset: AssetDetailItemDto\n /** The file the asset was read for, i.e. the file of the image made from that pick. */\n file: DocId\n}\n\n/** Result of re-reading the held asset: the asset with its credit, or the failure. */\nexport type HeldAssetAnew =\n | { of: HeldAsset; asset: AssetDetailItemDto; names: string }\n | { of: HeldAsset; failure: unknown }\n\n/** Result of reading a held asset after its detail closed. */\ntype DetailAssetRead = { of: HeldAsset; asset: AssetDetailItemDto; names: string }\n\n// Sequential requests of a read after a detail closes: the rest of the detail save, the asset,\n// the asset licence (once per page), and the names of its sources and authors.\nconst REQUESTS_OF_A_DETAIL_ASSET_READ = 4\n\n/**\n * Fills an empty source with the credit once the held asset turns out to have sources or authors.\n * The pick creates the image with an empty source, and the dialog hides the source while it offers the pick.\n * So an empty or whitespace-only source belongs to the pick. A non-empty source came from a save elsewhere and stays.\n */\nexport const giveNamesToEmptySource = (image: ImageCreateUpdateAware, names: string) => {\n if (image.texts.source.trim().length === 0) image.texts.source = names\n}\n\n/**\n * DAM sources and authors the single-image widget dialog offers in place of a source,\n * for a library-picked asset that has neither.\n * The widget holds the asset and the file it was read for, and offers its authors only in that file's image dialog.\n * Do not use the asset detail store: it is shared per page by the picker,\n * detail and other widgets, which caused wrong authors to be saved.\n * `shownImage`: the image the widget dialog shows, or none.\n */\nexport function useImageDialogDamAuthors(\n configName: string,\n shownImage: () => ImageCreateUpdateAware | null,\n readonly: () => boolean\n) {\n const { damClient, endPointAsset, endPointAuthor } = useCommonAdminCoreDamOptions(configName)\n const { getExtSystemByLicence } = useDamConfigState(damClient, configName)\n const creditConfigOf = useDamCreditConfig(configName)\n const { cachedExtSystemId } = useExtSystemIdForCached(configName)\n const assetDetailStore = useAssetDetailStore()\n const { showErrorsDefault, showErrorT, showUnknownError } = useAlerts()\n\n const held = ref<HeldAsset | null>(null)\n // A read may end once the widget is gone.\n let unmounted = false\n onBeforeUnmount(() => {\n unmounted = true\n })\n\n /** The image the dialog shows, when it is the one the held asset was read for. */\n const imageOfHeld = () => {\n const image = shownImage()\n return !isNull(held.value) && !isNull(image) && image.dam.damId === held.value.file ? image : null\n }\n\n // The shown image after a read of the held asset for it failed. The held asset may then be stale.\n // The dialog shows the image source instead of the pick until it shows an image again.\n // Otherwise it kept offering the stale pick, and its confirm wrote nothing only after the user had picked.\n const staleIn = shallowRef<ImageCreateUpdateAware | null>(null)\n\n /**\n * The asset whose authors the dialog offers.\n * Null unless the dialog shows the image the asset was read for and the last read for that image has not failed.\n */\n const damAuthorsAsset = computed(() => {\n if (isNull(held.value)) return null\n const image = imageOfHeld()\n return isNull(image) || image === staleIn.value ? null : held.value.asset\n })\n\n const offerDamAuthorsOf = (asset: AssetDetailItemDto, file: DocId) => {\n held.value = { asset, file }\n }\n\n const offerNoDamAuthors = () => {\n held.value = null\n }\n\n const pickDamAuthors = (authors: DocId[]) => {\n const asset = damAuthorsAsset.value\n if (asset) asset.authors = authors\n }\n\n const pickDamSources = (sources: DocId[]) => {\n const asset = damAuthorsAsset.value\n if (asset) asset.sources = sources\n }\n\n /**\n * The credit resolves under the ext system of the asset licence: its names, and its format once loaded.\n * Falls back to `pageExtSystem` when the licence has none.\n */\n const namesOf = async (asset: AssetDetailItemDto, pageExtSystem: IntegerId) => {\n const extSystem = (await getExtSystemByLicence(asset.licence)) ?? pageExtSystem\n return fetchDamCredit(\n damClient,\n endPointAuthor,\n extSystem,\n asset.sources,\n asset.authors,\n creditConfigOf(extSystem, pageExtSystem)\n )\n }\n\n /**\n * The \"edit asset\" detail may have added sources or authors, so the asset is read again.\n * The read waits for the detail save that was pending on close. An earlier read returns the old asset.\n * If the asset now has either, the pick is dropped and an\n * empty image source takes their credit. An existing source stays.\n * `pageExtSystem` is the ext system configured when the detail closed. It is used when the licence gives none.\n */\n const takeAuthorsOfDetailAsset = async (\n of: HeldAsset,\n detailSave: Promise<void> | null,\n pageExtSystem: IntegerId\n ): Promise<DetailAssetRead | null> => {\n try {\n await detailSave\n const asset = await fetchAsset(damClient, endPointAsset, of.asset.id)\n const source = hasNoDamCredit(asset.authors, asset.sources) ? '' : await namesOf(asset, pageExtSystem)\n const read = { of, asset, names: source }\n // Unmounted, turned read-only, or now holding another pick's asset: write nothing.\n if (unmounted || readonly() || held.value !== of) return read\n if (hasNoDamCredit(asset.authors, asset.sources)) {\n of.asset = { ...asset, authors: of.asset.authors, sources: of.asset.sources }\n return read\n }\n // Write only into the image the asset was read for. The dialog may have closed or show another image.\n // The widget keeps holding the asset, so \"edit image\" of that file re-reads\n // it and fills the empty source. Dropping it here left that source empty.\n const image = imageOfHeld()\n if (isNull(image)) return read\n held.value = null\n giveNamesToEmptySource(image, source)\n return read\n } catch (e) {\n if (unmounted) return null\n showErrorsDefault(e)\n const image = held.value === of ? imageOfHeld() : null\n if (image) staleIn.value = image\n return null\n }\n }\n\n // The latest pending read of an asset whose detail closed. \"Confirm\" waits for it, and \"edit image\" uses its result.\n let detailAssetRead: Promise<DetailAssetRead | null> | null = null\n // Pending detail-close reads, chained per asset. A read of another asset does not wait for them.\n const detailAssetReads = new Map<DocId, Promise<DetailAssetRead | null>>()\n // The confirm currently waiting for that read, if any.\n let waitingConfirm: symbol | null = null\n const confirmWaits = ref(false)\n const dropWaitingConfirm = () => {\n waitingConfirm = null\n confirmWaits.value = false\n }\n // A confirm belongs to the dialog opening it was pressed in. Drop it when the dialog closes or shows a new image.\n // Otherwise the read could answer after a reopen and confirm and save that opening without a press.\n watch(\n shownImage,\n (image) => {\n dropWaitingConfirm()\n if (image !== staleIn.value) staleIn.value = null\n },\n { flush: 'sync' }\n )\n\n /**\n * \"Confirm\" pressed while a just-closed detail's asset is still read. The read may change what\n * the form asks for, so the confirm waits (`true`) and `again` re-runs it after the read.\n * Repeated presses, or presses while `saving`, are ignored.\n * The wait is limited by `withinWaitLimit` over the read's sequential requests, so a slow\n * but answering DAM does not time out. On timeout the press is dropped and the user is told.\n * A failed read also drops the press. Otherwise it saved the image with the shown source, without the picked authors.\n */\n const holdConfirmForDetailAssetRead = (saving: boolean, again: () => void) => {\n const read = detailAssetRead\n if (isNull(read)) return false\n if (saving || !isNull(waitingConfirm)) return true\n const waiting = (waitingConfirm = Symbol('confirm'))\n confirmWaits.value = true\n void withinWaitLimit(read, REQUESTS_OF_A_DETAIL_ASSET_READ, configName).then((answer) => {\n if (waitingConfirm !== waiting) return\n dropWaitingConfirm()\n if (answer === WAIT_RAN_OUT) {\n if (!unmounted) showErrorT('error.apiTimedOut.message')\n return\n }\n if (isNull(answer)) return\n again()\n })\n return true\n }\n\n /**\n * `shown`: the asset the detail showed; none if it closed from its loader or after a failed read.\n * Reads only if the dialog offers this asset's authors. The read's inputs are captured before any await.\n */\n const onAssetDetailClose = (shown: AssetDetailItemDto | null) => {\n const of = held.value\n if (isNull(shown) || isNull(of) || isNull(imageOfHeld()) || readonly()) return\n const assetId = of.asset.id\n const detailSave = assetDetailStore.savingOf(assetId, configName)\n const pageExtSystem = cachedExtSystemId.value\n const read = (detailAssetReads.get(assetId) ?? Promise.resolve()).then(() =>\n takeAuthorsOfDetailAsset(of, detailSave, pageExtSystem)\n )\n detailAssetReads.set(assetId, read)\n detailAssetRead = read\n void read.then(() => {\n if (detailAssetReads.get(assetId) === read) detailAssetReads.delete(assetId)\n if (detailAssetRead === read) detailAssetRead = null\n })\n }\n\n /**\n * \"Edit image\" of `file`. The held asset is as it was at pick time and may have\n * gained authors since; confirming would overwrite them, so it is re-read first.\n * A pending detail-close read is newer and is reused. A failed one is retried.\n * Inputs are captured at the press because the read may drop the held asset.\n * Returns `null` if no asset is held for that file or the widget is read-only.\n */\n const readHeldAnew = (file: DocId | undefined): Promise<HeldAssetAnew> | null => {\n const of = held.value\n if (isNull(of) || of.file !== file || readonly()) return null\n const pageExtSystem = cachedExtSystemId.value\n return (detailAssetRead ?? Promise.resolve(null)).then(async (afterDetail) => {\n if (afterDetail?.of === of) return afterDetail\n try {\n const asset = await fetchAsset(damClient, endPointAsset, of.asset.id)\n return {\n of,\n asset,\n names: hasNoDamCredit(asset.authors, asset.sources) ? '' : await namesOf(asset, pageExtSystem),\n }\n } catch (failure) {\n return { of, failure }\n }\n })\n }\n\n /**\n * Applies a `readHeldAnew` result to the shown image of that file.\n * Without sources and authors the fresh asset becomes the held one, so picks from a dialog closed without\n * confirm do not return. With either the pick goes and an empty source takes their credit (`giveNamesToEmptySource`).\n * A failed read is reported once and the dialog shows the source until\n * a new image is shown. The asset stays held for the next \"edit image\".\n */\n const takeHeldAnew = (anew: HeldAssetAnew | null, image: ImageCreateUpdateAware | null) => {\n if (isNull(anew) || unmounted || readonly()) return\n if (isNull(image) || image.dam.damId !== anew.of.file) return\n if ('failure' in anew) {\n if (!showErrorsDefault(anew.failure)) showUnknownError()\n if (held.value === anew.of) staleIn.value = image\n return\n }\n if (hasNoDamCredit(anew.asset.authors, anew.asset.sources)) {\n if (held.value === anew.of) anew.of.asset = anew.asset\n return\n }\n if (held.value === anew.of) held.value = null\n giveNamesToEmptySource(image, anew.names)\n }\n\n /**\n * On confirm of `image`: release the held asset after save if the dialog showed the source because a read failed.\n * Otherwise the next \"edit image\" re-read the asset, showed the pick again, and a confirm replaced the user's source.\n */\n const letGoOnceSavedWithSource = (image: ImageCreateUpdateAware) => {\n const of = held.value\n if (isNull(of) || of.file !== image.dam.damId || !isNull(damAuthorsAsset.value)) return () => undefined\n return () => {\n if (held.value === of) held.value = null\n }\n }\n\n /**\n * Writes picked sources and authors into the asset of the saved image's file `damId`, once the image is saved.\n * For a photo of another licence than the upload licence: the save may take it over into a copy in the upload\n * licence, and the credit belongs to that copy, not to the picked asset.\n * Under the ext system of the saved asset's licence, else `pageExtSystem`. A failed write is shown; the image stays.\n */\n const writeCreditToSavedAsset = async (\n damId: DocId,\n authors: DocId[],\n sources: DocId[],\n pageExtSystem: IntegerId\n ) => {\n let extSystem = pageExtSystem\n try {\n const saved = await fetchAssetByFileId(damClient, endPointAsset, damId)\n extSystem = (await getExtSystemByLicence(saved.licence)) ?? pageExtSystem\n await updateAssetAuthors(damClient, endPointAsset, { ...saved, authors, sources }, extSystem, configName)\n } catch (e) {\n showMetadataSaveError(e, extSystem, configName)\n }\n }\n\n /**\n * Read right before picked sources and authors are written into `asset`. Returns the credit of those\n * given elsewhere meanwhile, or `null` if none. Throws if they cannot be read.\n * Not atomic: one added between this read and the write is still overwritten.\n */\n const authorsGivenMeanwhile = async (asset: AssetDetailItemDto) => {\n const pageExtSystem = cachedExtSystemId.value\n const read = await fetchAsset(damClient, endPointAsset, asset.id)\n return hasNoDamCredit(read.authors, read.sources) ? null : namesOf(read, pageExtSystem)\n }\n\n return {\n damAuthorsAsset,\n offerDamAuthorsOf,\n offerNoDamAuthors,\n pickDamAuthors,\n pickDamSources,\n onAssetDetailClose,\n holdConfirmForDetailAssetRead,\n readHeldAnew,\n takeHeldAnew,\n letGoOnceSavedWithSource,\n authorsGivenMeanwhile,\n writeCreditToSavedAsset,\n /** A confirm waits for the read of a just-closed detail's asset. Its button spins. */\n confirmWaits,\n }\n}\n"],"mappings":";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8B,CAAK;IAEtE,AADA,IAAa,MAAMrC,EAAsBmC,EAAM,OAAO,KAAMlC,GAC5D,MAAMqC,EAAmBhE,GAAWiC,GAAe;KAAE,GAAG4B;KAAO;KAAS;IAAQ,GAAGpC,GAAW3B,CAAU;GAC1G,SAAS,GAAG;IACV,EAAsB,GAAG2B,GAAW3B,CAAU;GAChD;EACF;EA2BE;CACF;AACF"}
@@ -0,0 +1,8 @@
1
+ import { ImageSaveErrorInfo } from './imageApiCms';
2
+ type Translate = (key: string, named?: Record<string, unknown>) => string;
3
+ /**
4
+ * The message of an image save core-cms refused (`extractImageSaveErrorInfo`), naming the photo and its holder
5
+ * where the answer does. `undefined` for any other error. `showErrorsDefault` shows it for every save.
6
+ */
7
+ export declare function resolveImageSaveErrorMessage(errorInfo: ImageSaveErrorInfo | undefined, t: Translate): string | undefined;
8
+ export {};
@@ -0,0 +1,22 @@
1
+ import { ImageSaveErrorCode as e, ImageSaveErrorReason as t } from "./imageApiCms.js";
2
+ import { resolveHolderLabel as n } from "../../assetSelect/composables/assetSelectDisabledReason.js";
3
+ // src/domains/dam/imageWidget/composables/imageSaveErrors.ts
4
+ var r = {
5
+ [t.SharedGallery]: "common.damImage.image.error.sharedGallery",
6
+ [t.InvalidOwner]: "common.damImage.image.error.invalidOwner",
7
+ [t.GalleryCopy]: "common.damImage.image.error.galleryCopy"
8
+ };
9
+ function i(i, a) {
10
+ if (i?.code === e.TakeOverFailed) return i.reason === t.TakeOverRejected ? a("common.damImage.image.error.takeOverRejected") : a("common.damImage.image.error.takeOverUnavailable");
11
+ if (i?.code !== e.SingleUseViolation) return;
12
+ let o = i.reason ? r[i.reason] : void 0;
13
+ if (o) return a(o);
14
+ let s = i.damId ?? "", c = i.holderResourceName ? n(i.holderResourceName) : "", l = i.reason === t.RestoreConflict ? "common.damImage.image.error.restoreConflict" : "common.damImage.image.error.singleUseViolation";
15
+ return s ? c ? a(l, {
16
+ damId: s,
17
+ holder: c
18
+ }) : a(`${l}UnknownHolder`, { damId: s }) : c ? a(`${l}UnknownImage`, { holder: c }) : a(`${l}Unidentified`);
19
+ }
20
+ export { i as resolveImageSaveErrorMessage };
21
+
22
+ //# sourceMappingURL=imageSaveErrors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imageSaveErrors.js","names":["SINGLE_USE_REASON_MESSAGE","ImageSaveErrorReason","resolveImageSaveErrorMessage","errorInfo","ImageSaveErrorCode","t","fixedMessage","damId","holder","resolveHolderLabel","key"],"sources":["../../../../../src/domains/dam/imageWidget/composables/imageSaveErrors.ts"],"sourcesContent":["import {\n ImageSaveErrorCode,\n type ImageSaveErrorInfo,\n ImageSaveErrorReason,\n type ImageSaveErrorReasonType,\n} from '@/domains/dam/imageWidget/composables/imageApiCms'\nimport { resolveHolderLabel } from '@/domains/dam/assetSelect/composables/assetSelectDisabledReason'\n\ntype Translate = (key: string, named?: Record<string, unknown>) => string\n\nconst SINGLE_USE_REASON_MESSAGE: Partial<Record<ImageSaveErrorReasonType, string>> = {\n [ImageSaveErrorReason.SharedGallery]: 'common.damImage.image.error.sharedGallery',\n [ImageSaveErrorReason.InvalidOwner]: 'common.damImage.image.error.invalidOwner',\n [ImageSaveErrorReason.GalleryCopy]: 'common.damImage.image.error.galleryCopy',\n}\n\n/**\n * The message of an image save core-cms refused (`extractImageSaveErrorInfo`), naming the photo and its holder\n * where the answer does. `undefined` for any other error. `showErrorsDefault` shows it for every save.\n */\nexport function resolveImageSaveErrorMessage(\n errorInfo: ImageSaveErrorInfo | undefined,\n t: Translate\n): string | undefined {\n if (errorInfo?.code === ImageSaveErrorCode.TakeOverFailed) {\n return errorInfo.reason === ImageSaveErrorReason.TakeOverRejected\n ? t('common.damImage.image.error.takeOverRejected')\n : t('common.damImage.image.error.takeOverUnavailable')\n }\n if (errorInfo?.code !== ImageSaveErrorCode.SingleUseViolation) {\n return undefined\n }\n\n const fixedMessage = errorInfo.reason ? SINGLE_USE_REASON_MESSAGE[errorInfo.reason] : undefined\n if (fixedMessage) {\n return t(fixedMessage)\n }\n\n const damId = errorInfo.damId ?? ''\n const holder = errorInfo.holderResourceName ? resolveHolderLabel(errorInfo.holderResourceName) : ''\n const key =\n errorInfo.reason === ImageSaveErrorReason.RestoreConflict\n ? 'common.damImage.image.error.restoreConflict'\n : 'common.damImage.image.error.singleUseViolation'\n\n if (!damId) {\n return holder ? t(`${key}UnknownImage`, { holder }) : t(`${key}Unidentified`)\n }\n return holder ? t(key, { damId, holder }) : t(`${key}UnknownHolder`, { damId })\n}\n"],"mappings":";;;AAUA,IAAMA,IAA+E;EAClFC,EAAqB,gBAAgB;EACrCA,EAAqB,eAAe;EACpCA,EAAqB,cAAc;AACtC;AAMA,SAAgBC,EACd,GACA,GACoB;CACpB,IAAIC,GAAW,SAASC,EAAmB,gBACzC,OAAOD,EAAU,WAAWF,EAAqB,mBAC7CI,EAAE,8CAA8C,IAChDA,EAAE,iDAAiD;CAEzD,IAAIF,GAAW,SAASC,EAAmB,oBACzC;CAGF,IAAME,IAAeH,EAAU,SAASH,EAA0BG,EAAU,UAAU,KAAA;CACtF,IAAIG,GACF,OAAOD,EAAEC,CAAY;CAGvB,IAAMC,IAAQJ,EAAU,SAAS,IAC3BK,IAASL,EAAU,qBAAqBM,EAAmBN,EAAU,kBAAkB,IAAI,IAC3FO,IACJP,EAAU,WAAWF,EAAqB,kBACtC,gDACA;CAKN,OAHKM,IAGEC,IAASH,EAAEK,GAAK;EAAE;EAAO;CAAO,CAAC,IAAIL,EAAE,GAAGK,EAAI,gBAAgB,EAAE,SAAM,CAAC,IAFrEF,IAASH,EAAE,GAAGK,EAAI,eAAe,EAAE,UAAO,CAAC,IAAIL,EAAE,GAAGK,EAAI,aAAa;AAGhF"}
@@ -0,0 +1,11 @@
1
+ import { DocId } from '../../../../shared/types/common';
2
+ import { AssetSingleUseUsage } from '../../types/Asset';
3
+ import { AssetSelectUsageHolder } from '../../types/AssetSelect';
4
+ /**
5
+ * How the asset picker of DAM configuration `configName` asks the CMS where single use photos are used: through the
6
+ * image configuration of the same name, its `imageApi.fetchSingleUseUsage`, else core-cms when it has no `imageApi`.
7
+ * `undefined` asks nobody: a DAM configuration without `singleUseUsageEnabled` (all but admin-cms: their backends,
8
+ * daily tools of admin-inhouse too, have no usage check), no image configuration of that name (the DAM admin), or
9
+ * an own `imageApi` without `fetchSingleUseUsage`.
10
+ */
11
+ export declare function useImageSingleUseUsageFetch(configName: string): ((groupIds: DocId[], usageHolder: AssetSelectUsageHolder | null) => Promise<Record<DocId, AssetSingleUseUsage>>) | undefined;