1import{b as g}from"./date-V67yhMnj.js";import{_ as w,S as y,t as k}from"./index-BV6QtbyE.js";import{t as C}from"./tablePagination-BYx0ftkr.js";import"./vue-core-BJYLVuRU.js";import{o as p,q as i,t as c,y as t,J as x,D as l,z as f,B as b,E as r}from"./vendor-C61o6woY.js";import"./toastr-ZJ-XgUIA.js";import"./tables-Zwqw6ld6.js";import"./bootstrap-82v6EwEu.js";import"./jarallax-DStYVGbw.js";import"./highlight-CohLJnU_.js";import"./typed-D7S6yrmg.js";import"./mitt-DJ65BbbF.js";import"./axios-42ANG6Sg.js";const P={components:{Spinner:y},mixins:[C],data(){return{disabled:!1,loaded:!1,columns:[{label:"Name",field:"name",sortable:!1},{label:"Code",field:"code",sortable:!1},{label:"Invite Link",field:"link",sortable:!1},{label:"Invited",field:"invited",sortable:!1},{label:"Date of creation",field:"created_at",formatFn:g,sortable:!1},{label:"Actions",field:"actions",sortable:!1}],rows:[]}},methods:{fetch(o){o=o||{},o.per_page=100,this.$services.PromoCode().get(o).then(e=>{const m=e.body.data||[];m.forEach(d=>{const a=window.location;d.link=`${a.protocol}//${a.host}/p/${d.code}`,d.linkName=`${a.hostname}/p/${d.code}`}),this.rows=m}).finally(()=>{this.loaded=!0})},create(){this.disabled=!0,this.$services.PromoCode().save().then(o=>{o.body.state&&k("affiliate_promo_create"),this.fetch()}).finally(()=>{this.disabled=!1})},edit(o){let e=prompt("Change name",o.name);e&&this.$services.PromoCode().update({id:o.id,name:e}).then(m=>{this.fetch()})},remove(o){confirm("Are you sure?")&&this.$services.PromoCode().delete({id:o.id}).then(e=>{this.fetch()})},onPageChange(o){this.fetch({page:o.currentPage})},copyLink(o){this.$methods.copyToClipboard(o),this.$notify.success({title:"Copied",message:"Invite link copied"})}},created(){this.fetch()}},$={class:"pt-8 pt-md-5 pb-8 pb-md-14"},A={class:"container"},V={key:1,class:"row"},B={class:"col-12"},N={class:"alert alert-success d-flex flex-wrap align-items-center justify-content-between gap-2 mb-6",role:"alert"},S={class:"row mb-5"},D={class:"col"},I={class:"mb-0"},z={class:"text-gray-700"},E={class:"text-gray-700"},L={class:"col-auto d-flex flex-wrap gap-2"},R={class:"table-responsive"},T={key:0},H=["href"],M=["onClick"],O={key:1},j=["onClick"],q=["onClick"],F={key:2},J=["disabled"];function Y(o,e,m,d,a,n){const u=p("Spinner"),h=p("router-link"),v=p("vue-good-table");return i(),c("section",$,[t("div",A,[a.loaded?(i(),c("div",V,[t("div",B,[e[7]||(e[7]=t("h1",{class:"mb-0 fw-bold"},"Affiliate program",-1)),e[8]||(e[8]=t("p",{class:"mb-4 text-muted"},[l(" Read the terms of our affiliate program "),t("a",{href:"/help/affiliate"},"here"),t("br")],-1)),t("div",N,[e[2]||(e[2]=t("span",null,"ð You can also earn API credits by sharing your experience â $3 to start, and up to $50 if your post stays live for 2 weeks.",-1)),f(h,{to:{path:"/rewards"},class:"btn btn-sm btn-success"},{default:b(()=>[...e[1]||(e[1]=[l("See how it works â",-1)])]),_:1})]),t("div",S,[t("div",D,[t("h4",I,[e[3]||(e[3]=l(" Affiliate balance for all time ",-1)),t("small",z,r(o.$state.context.currency_symbol),1),l(r(o.$state.context.affiliate_amount),1)]),t("small",E,"Available "+r(o.$state.context.currency_symbol)+r(o.$state.context.available_affiliate_amount)+" (minus API costs)",1)]),t("div",L,[f(h,{to:{path:"/rewards"},class:"btn btn-xl btn-white"},{default:b(()=>[...e[4]||(e[4]=[l(" Reward Program ",-1)])]),_:1}),f(h,{to:{path:"/affiliate/order"},class:"btn btn-xl btn-primary"},{default:b(()=>[...e[5]||(e[5]=[l(" Order payout ",-1)])]),_:1})])]),t("div",R,[f(v,{columns:a.columns,rows:a.rows,"pagination-options":o.paginationOptions,onPageChange:n.onPageChange},{"table-row":b(s=>[s.column.field==="link"?(i(),c("span",T,[t("a",{href:s.row.link,target:"_blank"},r(s.row.linkName),9,H),t("button",{class:"btn-copy-inline",onClick:_=>n.copyLink(s.row.link),title:"Copy"},[...e[6]||(e[6]=[t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",fill:"currentColor",viewBox:"0 0 16 16"},[t("path",{d:"M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"}),t("path",{d:"M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"}
1)],-1)])],8,M)])):s.column.field==="actions"?(i(),c("span",O,[t("button",{class:"btn btn-primary mb-1 me-1 btn-xs",onClick:_=>n.edit(s.row)},"Edit",8,j),t("button",{class:"btn btn-danger mb-1 btn-xs",onClick:_=>n.remove(s.row)},"Delete",8,q)])):(i(),c("span",F,r(s.formattedRow[s.column.field]),1))]),_:1},8,["columns","rows","pagination-options","onPageChange"])]),t("button",{class:"btn btn-primary mb-1 btn-xs mt-3",onClick:e[0]||(e[0]=(...s)=>n.create&&n.create(...s)),disabled:a.disabled},"Create a promocode",8,J)])])):(i(),x(u,{key:0}))])])}const ie=w(P,[["render",Y],["__file","/app/src/components/inner/AffPromoCodes.vue"]]);export{ie as default}; 2//# sourceMappingURL=AffPromoCodes-DXNy1lW_.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.