Skip to content

Commit f0d8e07

Browse files
authored
Merge pull request #4731 from nextcloud/fix/oca-mount-contact-details-return-type
fix: restore breaking changes of OCA.Contacts.mountContactDetails
2 parents fa2214c + 84233f8 commit f0d8e07

File tree

4 files changed

+61
-58
lines changed

4 files changed

+61
-58
lines changed

src/oca.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/oca.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
6+
// eslint-disable-next-line import/no-unresolved, n/no-missing-import
7+
import 'vite/modulepreload-polyfill'
8+
9+
// Global scss sheets
10+
import './css/contacts.scss'
11+
12+
// Dialogs css
13+
import '@nextcloud/dialogs/style.css'
14+
15+
import { createApp } from 'vue'
16+
import ReadOnlyContactDetails from './views/ReadOnlyContactDetails.vue'
17+
import { createPinia } from 'pinia'
18+
import store from './store/index.js'
19+
import LegacyGlobalMixin from './mixins/LegacyGlobalMixin.js'
20+
21+
declare global {
22+
interface Window {
23+
OCA: {
24+
Contacts?: {
25+
/**
26+
* Mount the contact details component at the given DOM element.
27+
*
28+
* @param el Html element to mount the component at.
29+
* @param contactEmailAddress Email address of the contact whose details to display.
30+
* @return Component handle with a basic API to control it.
31+
*/
32+
mountContactDetails(
33+
el: HTMLElement,
34+
contactEmailAddress: string,
35+
): Promise<{ $destroy(): void }>,
36+
},
37+
},
38+
}
39+
}
40+
41+
window.OCA ??= {}
42+
window.OCA.Contacts = {
43+
async mountContactDetails(el, contactEmailAddress) {
44+
const app = createApp(ReadOnlyContactDetails, {
45+
contactEmailAddress,
46+
})
47+
48+
const pinia = createPinia()
49+
app.use(pinia)
50+
app.use(store)
51+
52+
app.mixin(LegacyGlobalMixin)
53+
54+
app.mount(el)
55+
56+
return {
57+
$destroy: () => app.unmount(),
58+
}
59+
},
60+
}

src/oca/mountContactDetails.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

vite.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default createAppConfig({
1010
'main': path.join(__dirname, 'src', 'main.js'),
1111
'files-action': path.join(__dirname, 'src', 'files-action.js'),
1212
'admin-settings': path.join(__dirname, 'src', 'admin-settings.js'),
13-
'oca': path.join(__dirname, 'src', 'oca.js'),
13+
'oca': path.join(__dirname, 'src', 'oca.ts'),
1414
}, {
1515
inlineCSS: false,
1616
})

0 commit comments

Comments
 (0)