2020-10-01 17:08:36 -04:00
|
|
|
import Vue from 'vue';
|
2020-10-08 20:08:41 -04:00
|
|
|
import Vuex from 'vuex';
|
2020-10-01 17:08:36 -04:00
|
|
|
import csrf from '~/lib/utils/csrf';
|
2020-10-08 20:08:41 -04:00
|
|
|
import FeatureFlagsComponent from './components/feature_flags.vue';
|
|
|
|
import createStore from './store/index';
|
2020-10-01 17:08:36 -04:00
|
|
|
|
2020-10-08 20:08:41 -04:00
|
|
|
Vue.use(Vuex);
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const el = document.querySelector('#feature-flags-vue');
|
|
|
|
|
|
|
|
const {
|
|
|
|
projectName,
|
|
|
|
featureFlagsHelpPagePath,
|
|
|
|
errorStateSvgPath,
|
|
|
|
endpoint,
|
|
|
|
projectId,
|
|
|
|
unleashApiInstanceId,
|
|
|
|
rotateInstanceIdPath,
|
2020-10-15 05:08:41 -04:00
|
|
|
featureFlagsClientLibrariesHelpPagePath,
|
|
|
|
featureFlagsClientExampleHelpPagePath,
|
|
|
|
unleashApiUrl,
|
|
|
|
canUserAdminFeatureFlag,
|
|
|
|
newFeatureFlagPath,
|
2021-05-26 08:10:41 -04:00
|
|
|
userListPath,
|
2020-10-15 05:08:41 -04:00
|
|
|
featureFlagsLimitExceeded,
|
2021-05-14 14:10:34 -04:00
|
|
|
featureFlagsLimit,
|
2020-10-08 20:08:41 -04:00
|
|
|
} = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
store: createStore({ endpoint, projectId, unleashApiInstanceId, rotateInstanceIdPath }),
|
2020-10-15 05:08:41 -04:00
|
|
|
provide: {
|
|
|
|
projectName,
|
|
|
|
featureFlagsHelpPagePath,
|
|
|
|
errorStateSvgPath,
|
|
|
|
featureFlagsClientLibrariesHelpPagePath,
|
|
|
|
featureFlagsClientExampleHelpPagePath,
|
|
|
|
unleashApiUrl,
|
|
|
|
csrfToken: csrf.token,
|
|
|
|
canUserConfigure: canUserAdminFeatureFlag !== undefined,
|
|
|
|
newFeatureFlagPath,
|
2021-05-14 14:10:34 -04:00
|
|
|
featureFlagsLimitExceeded: featureFlagsLimitExceeded !== undefined,
|
|
|
|
featureFlagsLimit,
|
2021-05-26 08:10:41 -04:00
|
|
|
userListPath,
|
2020-10-01 17:08:36 -04:00
|
|
|
},
|
|
|
|
render(createElement) {
|
2020-10-15 05:08:41 -04:00
|
|
|
return createElement(FeatureFlagsComponent);
|
2020-10-01 17:08:36 -04:00
|
|
|
},
|
|
|
|
});
|
2020-10-08 20:08:41 -04:00
|
|
|
};
|