| 1 |
import{u as m}from"./app.js?ver=2.10.0";import{C as g}from"./CustomizerShell.js?ver=2.10.0";import{E as o,I as c,O as _,ae as p,D as h,S as f,M as S,G as v,aA as b}from"./vue.js?ver=2.10.0";import{_ as d}from"./emoji-picker.js?ver=2.10.0";import"./vue-router.js?ver=2.10.0";import"./element-plus.js?ver=2.10.0";import"./fcom-utils.js?ver=2.10.0";import"./dayjs.js?ver=2.10.0";import"./vendor.js?ver=2.10.0";import"./pinia.js?ver=2.10.0";import"./milkdown.js?ver=2.10.0";const k={data(){return{originRoute:null}},beforeRouteEnter(e,s,t){t(i=>i.rememberOrigin(e,s))},methods:{rememberOrigin(e,s){var i;if(!s||!s.name)return;const t=(i=e.matched[0])==null?void 0:i.path;t&&s.matched.some(r=>r.path===t)||(this.originRoute={name:s.name,params:s.params,query:s.query})},goBackToOrigin(e){this.$router.push(this.originRoute||e)}}},$={name:"SpaceSettingsRoute",inheritAttrs:!1,mixins:[k],components:{CustomizerShell:g},setup(){return{spaceStore:m()}},props:["space"],data(){return{saving:!1,savingCount:0,space_profile:null}},computed:{hasLockScreenTab(){var e,s,t;return((e=this.space_profile)==null?void 0:e.privacy)=="private"&&((t=(s=this.space_profile)==null?void 0:s.settings)==null?void 0:t.custom_lock_screen)=="yes"},hasPagesTab(){var e,s;return!this.has_pro||!!((s=(e=this.space_profile)==null?void 0:e.permissions)!=null&&s.can_manage_pages)},isPagesTab(){return this.$route.name=="space_settings_pages"},tabs(){const e={space:this.space},s=[{name:"general",title:this.$t("General Settings"),route:{name:"space_settings_general",params:e}},{name:"paywalls",title:this.$t("Paywalls"),route:{name:"space_settings_paywalls",params:e}}];return this.hasLockScreenTab&&s.push({name:"lock_screen",title:this.$t("Lock Screen"),route:{name:"space_settings_lockscreen",params:e}}),s.push({name:"manage_links",title:this.$t("Space Links"),route:{name:"space_settings_links",params:e}}),this.hasPagesTab&&s.push({name:"manage_pages",title:this.$t("Pages"),route:{name:"space_settings_pages",params:e}}),s},isLockScreenTab(){return this.$route.name=="space_settings_lockscreen"},saveLabel(){return!this.has_pro&&this.isLockScreenTab?this.$t("Save Changes (Pro Required)"):this.$t("Save Changes")},childProps(){return this.$route.name=="space_settings_general"?{savingCount:this.savingCount,community:this.space_profile}:{savingCount:this.savingCount,spaceProfile:this.space_profile}},childListeners(){return this.$route.name=="space_settings_general"?{completed:this.spaceUpdated}:{close:this.goBack}}},watch:{space(){this.fetchSpace()},hasLockScreenTab(e){!e&&this.isLockScreenTab&&this.$router.replace({name:"space_settings_general",params:{space:this.space}})},hasPagesTab(e){!e&&this.isPagesTab&&this.$router.replace({name:"space_settings_general",params:{space:this.space}})}},methods:{async fetchSpace(){try{const e=await this.spaceStore.fetchSpace(this.space,!0);if(!this.hasSpaceAdminAccess(e)){this.$notify.error(this.$t("You do not have permission to manage this space")),this.goBack();return}this.space_profile=e,this.changeTitle(e.title),this.isLockScreenTab&&!this.hasLockScreenTab&&this.$router.replace({name:"space_settings_general",params:{space:this.space}})}catch(e){this.$handleError(e),this.goBack()}},saveChanges(){if(!this.has_pro&&this.isLockScreenTab){this.$notify({title:this.$t("Pro Required"),message:this.$t("This feature is only available in the pro version."),type:"error"});return}this.savingCount=this.savingCount+1},async spaceUpdated(e){if(e!=null&&e.slug&&e.slug!=this.space){this.$router.replace({name:this.$route.name,params:{...this.$route.params,space:e.slug}});return}this.spaceStore.invalidateSpace(this.space);try{this.space_profile=await this.spaceStore.fetchSpace(this.space,!0)}catch{e&&(this.space_profile=e)}},goBack(){const e=this.$route.meta.back_route||"space_feeds",s=this.$route.meta.back_with_space===!1?{}:{space:this.space};this.goBackToOrigin({name:e,params:s})}},mounted(){this.fetchSpace()},beforeUnmount(){this.spaceStore.clearCurrentSpace()}};function T(e,s,t,i,r,a){const l=p("router-view"),u=p("customizer-shell");return r.space_profile?(h(),o(u,{key:0,back_title:r.space_profile.title,tabs:a.tabs,saving:r.saving,save_label:a.saveLabel,show_save:!a.isPagesTab,header_class:"fcom_space_settings_nav",container_class:"editor_customizer_container",onBack:s[0]||(s[0]=n=>a.goBack()),onSave:s[1]||(s[1]=n=>a.saveChanges())},{default:c(()=>[f(l,null,{default:c(({Component:n})=>[(h(),o(S(n),v(a.childProps,b(a.childListeners)),null,16))]),_:1})]),_:1},8,["back_title","tabs","saving","save_label","show_save"])):_("",!0)}const A=d($,[["render",T]]);export{A as default}; |