2020-01-01 13:55:28 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
import {
|
|
|
|
VISIBILITY_LEVEL_PRIVATE_STRING,
|
|
|
|
VISIBILITY_LEVELS_INTEGER_TO_STRING,
|
|
|
|
} from '~/visibility_level/constants';
|
2021-03-11 19:13:27 +05:30
|
|
|
import Translate from '~/vue_shared/translate';
|
2020-01-01 13:55:28 +05:30
|
|
|
|
|
|
|
Vue.use(VueApollo);
|
|
|
|
Vue.use(Translate);
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
export default function appFactory(el, Component) {
|
2020-01-01 13:55:28 +05:30
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
2021-10-27 15:23:28 +05:30
|
|
|
defaultClient: createDefaultClient(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
batchMax: 1,
|
|
|
|
},
|
|
|
|
),
|
2020-01-01 13:55:28 +05:30
|
|
|
});
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
const {
|
|
|
|
visibilityLevels = '[]',
|
|
|
|
selectedLevel,
|
|
|
|
multipleLevelsRestricted,
|
2021-11-18 22:05:49 +05:30
|
|
|
canReportSpam,
|
2021-10-27 15:23:28 +05:30
|
|
|
reportAbusePath,
|
2020-11-24 15:15:51 +05:30
|
|
|
...restDataset
|
|
|
|
} = el.dataset;
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
apolloProvider,
|
|
|
|
provide: {
|
2020-11-24 15:15:51 +05:30
|
|
|
visibilityLevels: JSON.parse(visibilityLevels),
|
2022-10-11 01:57:18 +05:30
|
|
|
selectedLevel:
|
|
|
|
VISIBILITY_LEVELS_INTEGER_TO_STRING[selectedLevel] ?? VISIBILITY_LEVEL_PRIVATE_STRING,
|
2020-11-24 15:15:51 +05:30
|
|
|
multipleLevelsRestricted: 'multipleLevelsRestricted' in el.dataset,
|
2021-10-27 15:23:28 +05:30
|
|
|
reportAbusePath,
|
2021-11-18 22:05:49 +05:30
|
|
|
canReportSpam,
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
2020-01-01 13:55:28 +05:30
|
|
|
render(createElement) {
|
2020-04-22 19:07:51 +05:30
|
|
|
return createElement(Component, {
|
2020-01-01 13:55:28 +05:30
|
|
|
props: {
|
2020-11-24 15:15:51 +05:30
|
|
|
...restDataset,
|
2020-01-01 13:55:28 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
2020-04-22 19:07:51 +05:30
|
|
|
}
|