import{t as e}from"./_plugin-vue2_normalizer-BHc2Ljhs.js";import{n as t}from"./get-ztzP-Ywo.js";import{n}from"./vue-composition-api-CTRLR5Xh.js";import{i as r,n as i,s as a}from"./shopeeVideo-BZTdDhQo.js";var o=e(n({data(){return{shopId:``,stats:{campaigns:0,items:0,done:0,error:0,pending:0},campaigns:[],campaignId:``,items:[],loading:!1,columns:[{title:this.$t(`SHOPEE_VIDEO_COL_SOURCE`),key:`source`},{title:this.$t(`SHOPEE_VIDEO_COL_CAPTION`),key:`caption`},{title:this.$t(`SHOPEE_VIDEO_COL_STATUS`),key:`status`},{title:this.$t(`SHOPEE_VIDEO_COL_POSTED`),key:`postedAt`}]}},async created(){let e=await t();e&&e.shop_id&&(this.shopId=`${e.shop_id}`),this.shopId&&(this.stats=await r(this.shopId),this.campaigns=await i(this.shopId),this.campaigns.length&&(this.campaignId=this.campaigns[0]._id,await this.loadItems()))},methods:{async loadItems(){if(!this.campaignId){this.items=[];return}this.loading=!0,this.items=await a(this.campaignId),this.loading=!1}}}),function(){var e=this,t=e._self._c;return e._self._setupProxy,t(`div`,{staticClass:`shopee-video-posts p-3`},[t(`h3`,{staticClass:`mb-2`},[e._v(` `+e._s(e.$t(`SHOPEE_VIDEO_POSTS_TITLE`))+` `)]),t(`Row`,{staticClass:`mb-3`,attrs:{gutter:8}},[t(`Col`,{attrs:{span:`8`}},[t(`Card`,[t(`p`,[e._v(e._s(e.$t(`SHOPEE_VIDEO_STATS_CAMPAIGNS`)))]),t(`h2`,[e._v(e._s(e.stats.campaigns))])])],1),t(`Col`,{attrs:{span:`8`}},[t(`Card`,[t(`p`,[e._v(e._s(e.$t(`SHOPEE_VIDEO_STATS_DONE`)))]),t(`h2`,[e._v(e._s(e.stats.done))])])],1),t(`Col`,{attrs:{span:`8`}},[t(`Card`,[t(`p`,[e._v(e._s(e.$t(`SHOPEE_VIDEO_STATS_ERROR`)))]),t(`h2`,[e._v(e._s(e.stats.error))])])],1)],1),t(`Select`,{staticClass:`mb-2`,on:{"on-change":e.loadItems},model:{value:e.campaignId,callback:function(t){e.campaignId=t},expression:`campaignId`}},e._l(e.campaigns,function(n){return t(`Option`,{key:n._id,attrs:{value:n._id}},[e._v(` `+e._s(n.name)+` `)])}),1),t(`Table`,{attrs:{columns:e.columns,data:e.items,loading:e.loading}})],1)},[],!1,null,null,null,null).exports;export{o as default};