PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.3.25
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.3.25
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
fluent-cart / assets / addon-assets.js

addon-assets.js in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.3.25, at assets/addon-assets.js

2 lines 7.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import{_ as U}from"./chunks/FileUploaderDialog.js?ver=1.3.25";import{t as C}from"./chunks/Translator.js?ver=1.3.25";import{r as f,e as _,o as u,d as i,b as h,a as l,t as r,w as o,f as y,c as A,F as B,g as N}from"./chunks/vue.esm-bundler.js?ver=1.3.25";import{_ as D}from"./chunks/_plugin-vue_export-helper.js?ver=1.3.25";import"./chunks/common.js?ver=1.3.25";import"./chunks/dayjs.min.js?ver=1.3.25";import"./chunks/Str.js?ver=1.3.25";import"./chunks/timezone.js?ver=1.3.25";import"./chunks/IconButton.js?ver=1.3.25";import"./chunks/Arr.js?ver=1.3.25";import"./chunks/index.js?ver=1.3.25";import"./chunks/DynamicIcon.js?ver=1.3.25";import"./chunks/Rest.js?ver=1.3.25";import"./chunks/Notify.js?ver=1.3.25";import"./chunks/Model.js?ver=1.3.25";const E={name:"AddonAssetsSettings",components:{FileUploaderDialog:U},props:["product_id"],data(){return{addons:[],loading:!0,saving:!1}},methods:{translate:C,formatSize(e){if(!e)return"";const s=["Bytes","KB","MB","GB"],d=Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,d)).toFixed(d>0?1:0)+" "+s[d]},fetchData(){this.loading=!0,this.$get("addon-assets/products/"+this.product_id+"/settings").then(e=>{const s=e.addons||[];s.forEach(d=>{d.file||(d.file={file_name:"",file_path:"",driver:"local",file_size:0})}),this.addons=s}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1})},save(){this.saving=!0,this.$post("addon-assets/products/"+this.product_id+"/settings",{addons:this.addons}).then(e=>{this.handleSuccess(e.message),e.addons&&(e.addons.forEach(s=>{s.file||(s.file={file_name:"",file_path:"",driver:"local",file_size:0})}),this.addons=e.addons)}).catch(e=>{this.handleError(e)}).finally(()=>{this.saving=!1})},addAddon(){this.addons.push({slug:"",title:"",version:"",verify_license:!0,changelog:"",file:{file_name:"",file_path:"",driver:"local",file_size:0}})},removeAddon(e){this.addons.splice(e,1)},sanitizeSlug(e){e.slug&&(e.slug=e.slug.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""))},onFileSelected(e,s){const d=e&&e.value?e.value:e;if(!d||!d.length)return;const p=d[0],c=this.addons[s];c.file={file_name:p.title||p.file_name,file_path:p.file_name,driver:p.driver||"local",file_size:p.file_size||0}}},mounted(){this.fetchData();const e=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");if(e){const s=document.querySelector("#fluent_cart_plugin_app");s&&s.prepend(e)}}},M={class:"fct-addon-assets-settings fct-layout-width"},O={class:"fct_card"},q={class:"fct_card_head",style:{display:"flex","justify-content":"space-between","align-items":"center",padding:"16px 20px","border-bottom":"1px solid var(--fct-border-color, #ebeef5)"}},R={style:{margin:"0","font-size":"16px","font-weight":"600"}},j={class:"fct_card_body",style:{padding:"20px"}},L={key:1,style:{"text-align":"center",padding:"40px 20px"}},T={style:{"font-size":"14px",color:"#606266"}},G={style:{color:"#909399","font-size":"13px"}},K={style:{display:"flex","justify-content":"space-between","align-items":"center","margin-bottom":"16px"}},H={style:{"font-size":"14px"}},I={key:0,style:{display:"flex","align-items":"center",gap:"12px"}},J={style:{display:"flex","align-items":"center",gap:"10px",padding:"10px 14px",background:"var(--fct-bg-color, #f5f7fa)","border-radius":"4px",border:"1px solid var(--fct-border-color, #ebeef5)",flex:"1","min-width":"0"}},P={style:{flex:"1","min-width":"0"}},Q={style:{"font-weight":"500","font-size":"13px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},W={style:{"font-size":"12px",color:"#909399"}},X={key:0,class:"setting-save-action"};function Y(e,s,d,p,c,t){const b=f("el-button"),k=f("el-skeleton"),V=f("el-popconfirm"),x=f("el-input"),g=f("el-form-item"),m=f("el-col"),w=f("el-row"),z=f("FileUploaderDialog"),F=f("el-checkbox"),S=f("el-form");return u(),_("div",M,[i("div",O,[i("div",q,[i("h3",R,r(t.translate("Addon Assets")),1),l(b,{type:"primary",size:"small",onClick:t.addAddon},{default:o(()=>[y(" + "+r(t.translate("Add Addon Asset")),1)]),_:1},8,["onClick"])]),i("div",j,[c.loading?(u(),A(k,{key:0,rows:4,animated:!0})):h("",!0),!c.loading&&c.addons.length===0?(u(),_("div",L,[i("p",T,r(t.translate("No addon assets configured for this product.")),1),i("p",G,r(t.translate("Addon assets allow you to distribute additional downloadable packages (e.g., payment gateway addons) that share this product's license.")),1)])):h("",!0),(u(!0),_(B,null,N(c.addons,(a,v)=>(u(),_("div",{key:v,style:{border:"1px solid var(--fct-border-color, #ebeef5)","border-radius":"6px",padding:"20px","margin-bottom":"16px",background:"#fff"}},[i("div",K,[i("strong",H,r(a.title||t.translate("New Addon Asset")),1),l(V,{title:t.translate("Are you sure you want to remove this addon?"),onConfirm:n=>t.removeAddon(v)},{reference:o(()=>[l(b,{type:"danger",size:"small",text:""},{default:o(()=>[y(r(t.translate("Remove")),1)]),_:1})]),_:2},1032,["title","onConfirm"])]),l(S,{"label-position":"top"},{default:o(()=>[l(w,{gutter:20},{default:o(()=>[l(m,{lg:8,md:12},{default:o(()=>[l(g,{label:t.translate("Addon Slug")},{default:o(()=>[l(x,{modelValue:a.slug,"onUpdate:modelValue":n=>a.slug=n,placeholder:t.translate("e.g., flutterwave-for-fluent-cart"),onBlur:n=>t.sanitizeSlug(a)},null,8,["modelValue","onUpdate:modelValue","placeholder","onBlur"])]),_:2},1032,["label"])]),_:2},1024),l(m,{lg:8,md:12},{default:o(()=>[l(g,{label:t.translate("Title")},{default:o(()=>[l(x,{modelValue:a.title,"onUpdate:modelValue":n=>a.title=n,placeholder:t.translate("e.g., Flutterwave for FluentCart")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1032,["label"])]),_:2},1024),l(m,{lg:8,md:12},{default:o(()=>[l(g,{label:t.translate("Version Number")},{default:o(()=>[l(x,{modelValue:a.version,"onUpdate:modelValue":n=>a.version=n,placeholder:t.translate("e.g., 2.0.0")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1032,["label"])]),_:2},1024)]),_:2},1024),l(w,{gutter:20},{default:o(()=>[l(m,{lg:16,md:24},{default:o(()=>[l(g,{label:t.translate("Update File")},{default:o(()=>[a.file&&a.file.file_name?(u(),_("div",I,[i("div",J,[s[0]||(s[0]=i("span",{style:{"font-size":"20px"}},"📦",-1)),i("div",P,[i("div",Q,r(a.file.file_name),1),i("div",W,r(t.formatSize(a.file.file_size))+" · "+r(a.file.driver),1)])]),l(z,{"is-multiple":!1,"upload-btn-text":t.translate("Replace File"),"upload-btn-icon":"Upload","upload-btn-size":"default",onOnFileSelected:n=>t.onFileSelected(n,v)},null,8,["upload-btn-text","onOnFileSelected"])])):h("",!0),!a.file||!a.file.file_name?(u(),A(z,{key:1,"is-multiple":!1,"upload-btn-text":t.translate("Choose File"),"upload-btn-icon":"Upload","upload-btn-size":"default",onOnFileSelected:n=>t.onFileSelected(n,v)},null,8,["upload-btn-text","onOnFileSelected"])):h("",!0)]),_:2},1032,["label"])]),_:2},1024),l(m,{lg:8,md:12,style:{display:"flex","align-items":"flex-end","padding-bottom":"18px"}},{default:o(()=>[l(F,{modelValue:a.verify_license,"onUpdate:modelValue":n=>a.verify_license=n},{default:o(()=>[y(r(t.translate("Require an active parent product license for updates")),1)]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1024)]),_:2},1024)]))),128))])]),!c.loading&&c.addons.length>0?(u(),_("div",X,[l(b,{onClick:t.save,loading:c.saving,disabled:c.saving,type:"primary"},{default:o(()=>[y(r(t.translate("Save Addon Assets")),1)]),_:1},8,["onClick","loading","disabled"])])):h("",!0)])}const Z=D(E,[["render",Y]]);window.fluent_cart_admin.hooks.addFilter("fluent_cart_routes","fluent_cart_addon_assets",function(e){return e.product_route.children.push({name:"addon_assets",path:"addon_assets",props:!0,component:Z,meta:{active_menu:"products",title:"Addon Assets",permission:"store/sensitive"}}),e});
2