blob: d90680a9bacc2499072be9a297b5ffd26743fb99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import Vue from 'vue';
import FormUrlApp from './components/form_url_app.vue';
export default () => {
const el = document.querySelector('.js-vue-webhook-form');
if (!el) {
return null;
}
const { url: initialUrl, urlVariables } = el.dataset;
// Convert the array of 'key' strings to array of { key } objects
const initialUrlVariables = urlVariables
? JSON.parse(urlVariables)?.map((key) => ({ key }))
: undefined;
return new Vue({
el,
name: 'WebhookFormRoot',
render(createElement) {
return createElement(FormUrlApp, {
props: {
initialUrl,
initialUrlVariables,
},
});
},
});
};
|