1import{a as oe}from"./chunk-UXAEONSH.js";import{a as ne}from"./chunk-RGWTER5P.js";import{a as X,f as Z}from"./chunk-JDYWGDNH.js";import"./chunk-IRONFM6M.js";import"./chunk-VHX354RR.js";import{a as ee,b as te}from"./chunk-22WJKAIZ.js";import{b as ie}from"./chunk-SLWPYULI.js";import"./chunk-RPDGXIQT.js";import"./chunk-RFHORXFH.js";import"./chunk-44BDWJO3.js";import"./chunk-YPSMJDVJ.js";import"./chunk-F6HJUGGY.js";import"./chunk-W6FQLWKF.js";import"./chunk-6MXSXX3N.js";import"./chunk-MT62CIDI.js";import"./chunk-BXNQRMY5.js";import"./chunk-RFCDL6VX.js";import"./chunk-XWDSR7V3.js";import"./chunk-3THAQ3J3.js";import{a as J,b as Q}from"./chunk-OAED5FIG.js";import{a as U,b as W}from"./chunk-P37GQ53N.js";import"./chunk-YK3HMHC4.js";import"./chunk-2DRXLVRR.js";import{c as j,e as q}from"./chunk-OFHUO5H7.js";import"./chunk-M3XSAKW4.js";import"./chunk-H76LZNGX.js";import"./chunk-PGR2NPNS.js";import"./chunk-OZD37XM5.js";import"./chunk-DLIVM562.js";import"./chunk-CV2ZWZQE.js";import"./chunk-AVEXXPAT.js";import{ja as $}from"./chunk-FHU4TM37.js";import{D as Y,c as k,g as F,l as K}from"./chunk-Q2KKZV5J.js";import{a as D}from"./chunk-JICM7NVH.js";import{a as z}from"./chunk-BD6EMWWF.js";import"./chunk-AB6CKZTE.js";import{c as B,d as G,e as H}from"./chunk-DIGPPQJE.js";import{r as N,s as b,x as R}from"./chunk-EU6HCBUP.js";import"./chunk-KAJMKXZ6.js";import{D as P}from"./chunk-ZAQTNZYS.js";import"./chunk-SRTXE2HR.js";import{Dc as w,Ec as V,Fc as y,Jb as x,Kc as O,Rb as I,Uc as m,Vc as d,Wb as n,Xb as o,Yb as C,ac as f,da as M,db as a,gc as u,hc as p,la as S,ma as E,sb as A,uc as r,vc as h,wc as _,yb as g}from"./chunk-NTTV6FWH.js";import{g as L}from"./chunk-W7GRJBO5.js";var se=()=>[10,20,50];function re(t,i){t&1&&C(0,"app-widget-loading")}function le(t,i){if(t&1){let e=f();n(0,"app-widget-api-error",3),u("retry",function(){S(e);let l=p();return E(l.loadSessions())}),o()}if(t&2){let e=p();x("message",e.error)}}function pe(t,i){if(t&1){let e=f();n(0,"app-widget-manager-empty-state",4),u("ctaClick",function(){S(e);let l=p();return E(l.goLive())}),o()}if(t&2){let e=p();x("features",e.emptyFeatures)}}function _e(t,i){t&1&&(n(0,"tr")(1,"th"),r(2),m(3,"translate"),o(),n(4,"th"),r(5),m(6,"translate"),o(),n(7,"th"),r(8),m(9,"translate"),o(),n(10,"th",16),r(11),m(12,"translate"),o(),n(13,"th",17),r(14),m(15,"translate"),o(),n(16,"th",17),r(17),m(18,"translate"),o(),n(19,"th",17),r(20),m(21,"translate"),o(),n(22,"th",16),r(23),m(24,"translate"),o(),n(25,"th"),r(26),m(27,"translate"),o(),n(28,"th"),r(29),m(30,"translate"),o()()),t&2&&(a(2),_(" ",d(3,10,"MANAGER.SHOP_LIVE.SESSION_DATE")," "),a(3),_(" ",d(6,12,"MANAGER.SHOP_LIVE.SESSION_LABEL_COL")," "),a(3),_(" ",d(9,14,"MANAGER.SHOP_LIVE.SESSION_DURATION")," "),a(3),_(" ",d(12,16,"MANAGER.SHOP_LIVE.SESSION_REVENUE")," "),a(3),_(" ",d(15,18,"MANAGER.SHOP_LIVE.SESSION_ORDERS")," "),a(3),_(" ",d(18,20,"MANAGER.SHOP_LIVE.SESSION_BUYERS")," "),a(3),_(" ",d(21,22,"MANAGER.SHOP_LIVE.SESSION_NEW_BUYERS")," "),a(3),_(" ",d(24,24,"MANAGER.SHOP_LIVE.SESSION_AVG_CART")," "),a(3),_(" ",d(27,26,"MANAGER.SHOP_LIVE.SESSION_TOP_PRODUCT")," "),a(3),_(" ",d(30,28,"MANAGER.SHOP_LIVE.SESSION_STATUS")," "))}function me(t,i){if(t&1){let e=f();n(0,"div",19)(1,"input",26),y("ngModelChange",function(l){S(e);let c=p(3);return V(c.editLabel,l)||(c.editLabel=l),E(l)}),u("keyup.enter",function(){S(e);let l=p().$implicit,c=p(2);return E(c.saveLabel(l))})("keyup.escape",function(){S(e);let l=p(3);return E(l.cancelEditLabel())}),o(),n(2,"button",27),u("click",function(){S(e);let l=p().$implicit,c=p(2);return E(c.saveLabel(l))}),o(),n(3,"button",28),u("click",function(){S(e);let l=p(3);return E(l.cancelEditLabel())}),o()()}if(t&2){let e=p(3);a(),w("ngModel",e.editLabel)}}function de(t,i){if(t&1&&r(0),t&2){let e=p(2).$implicit;_(" ",e.label," ")}}function ce(t,i){t&1&&(n(0,"span",30),r(1,"-"),o())}function Se(t,i){if(t&1){let e=f();n(0,"span",29),m(1,"translate"),u("click",function(){S(e);let l=p().$implicit,c=p(2);return E(c.startEditLabel(l))}),g(2,de,1,1)(3,ce,2,0,"span",30),C(4,"i",31),o()}if(t&2){let e=p().$implicit;x("pTooltip",d(1,2,"MANAGER.SHOP_LIVE.SESSION_CLICK_EDIT")),a(2),I(e.label?2:3)}}function Ee(t,i){if(t&1&&(n(0,"span",22),r(1),o()),t&2){let e=p().$implicit;a(),h(e.topProduct)}}function ue(t,i){t&1&&(n(0,"span",23),r(1,"-"),o())}function ge(t,i){t&1&&(C(0,"p-tag",24),m(1,"translate")),t&2&&x("value",d(1,1,"MANAGER.SHOP_LIVE.SESSION_ACTIVE"))}function xe(t,i){t&1&&(C(0,"p-tag",25),m(1,"translate")),t&2&&x("value",d(1,1,"MANAGER.SHOP_LIVE.SESSION_ENDED"))}function Ce(t,i){if(t&1&&(n(0,"tr")(1,"td",18),r(2),o(),n(3,"td"),g(4,me,4,1,"div",19)(5,Se,5,4,"span",20),o(),n(6,"td",18),r(7),o(),n(8,"td",21),r(9),o(),n(10,"td",17),r(11),o(),n(12,"td",17),r(13),o(),n(14,"td",17),r(15),o(),n(16,"td",16),r(17),o(),n(18,"td"),g(19,Ee,2,1,"span",22)(20,ue,2,0,"span",23),o(),n(21,"td"),g(22,ge,2,3,"p-tag",24)(23,xe,2,3,"p-tag",25),o()()),t&2){let e=i.$implicit,s=p(2);a(2),_(" ",s.formatDate(e.startedAt)," "),a(2),I(s.editingSessionId===e.id?4:5),a(3),_(" ",s.formatDuration(e)," "),a(2),_(" ",s.formatRevenue(e.revenueCents)," "),a(2),h(e.orderCount),a(2),_(" ",e.distinctBuyerCount," "),a(2),h(e.newBuyerCount),a(2),_(" ",s.formatRevenue(e.averageCartCents)," "),a(2),I(e.topProduct?19:20),a(3),I(e.endedAt?23:22)}}function Ie(t,i){t&1&&(n(0,"tr")(1,"td",32),r(2),m(3,"translate"),o()()),t&2&&(a(2),_(" ",d(3,1,"MANAGER.SHOP_LIVE.SESSIONS_EMPTY")," "))}function fe(t,i){if(t&1){let e=f();n(0,"div",2)(1,"div",5)(2,"div")(3,"h5",6),C(4,"i",7),r(5),m(6,"translate"),o(),n(7,"p",8),r(8),m(9,"translate"),o()(),n(10,"div",9)(11,"a",10),C(12,"i",11),r(13),m(14,"translate"),o()()(),n(15,"p-table",12),u("onLazyLoad",function(l){S(e);let c=p();return E(c.onPageChange(l))}),g(16,_e,31,30,"ng-template",13)(17,Ce,24,10,"ng-template",14)(18,Ie,4,3,"ng-template",15),o()()}if(t&2){let e=p();a(5),_(" ",d(6,10,"MANAGER.SHOP_LIVE.SESSIONS_TITLE")," "),a(3),_(" ",d(9,12,"MANAGER.SHOP_LIVE.SESSIONS_SUBTITLE")," "),a(5),_(" ",d(14,14,"MANAGER.SHOP_LIVE.SESSIONS_GO_LIVE")," "),a(2),x("value",e.sessions)("loading",e.loading)("paginator",!0)("rows",e.limit)("totalRecords",e.total)("lazy",!0)("rowsPerPageOptions",O(16,se))}}var ae=class t{liveService=M(oe);toastService=M(D);t=M(B);router=M(N);loaded=!1;loading=!0;error=null;sessions=[];total=0;page=1;limit=20;editingSessionId=null;editLabel="";emptyFeatures=[{icon:"pi pi-chart-line",labelKey:"MANAGER.SHOP_LIVE.EMPTY_FEAT_KPI_LABEL",descKey:"MANAGER.SHOP_LIVE.EMPTY_FEAT_KPI_DESC"},{icon:"pi pi-users",labelKey:"MANAGER.SHOP_LIVE.EMPTY_FEAT_CLIENTS_LABEL",descKey:"MANAGER.SHOP_LIVE.EMPTY_FEAT_CLIENTS_DESC"},{icon:"pi pi-history",labelKey:"MANAGER.SHOP_LIVE.EMPTY_FEAT_HISTORY_LABEL",descKey:"MANAGER.SHOP_LIVE.EMPTY_FEAT_HISTORY_DESC"}];ngOnInit(){this.loadSessions()}loadSessions(){return L(this,null,function*(){this.loading=!0,this.error=null;try{let i=yield this.liveService.listSessions(this.page,this.limit);this.sessions=i.items,this.total=i.total}catch(i){this.error=i?.message||"Error"}finally{this.loading=!1,this.loaded=!0}})}onPageChange(i){let e=Math.floor(i.first/i.rows)+1,s=i.rows;e===this.page&&s===this.limit||(this.page=e,this.limit=s,this.loadSessions())}formatDuration(i){if(!i.endedAt)return"-";let e=new Date(i.startedAt).getTime(),s=new Date(i.endedAt).getTime(),l=Math.max(0,s-e),c=Math.floor(l/6e4),T=Math.floor(c/60),v=c%60;return T>0?`${T}h${v>0?String(v).padStart(2,"0")+"min":""}`:`${v}min`}formatRevenue(i){return(i/100).toFixed(2).replace(".",",")+" \u20AC"}formatDate(i){let e=new Date(i);return e.toLocaleDateString("fr-FR",{day:"2-digit",month:"2-digit",year:"numeric"})+" "+e.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})}startEditLabel(i){this.editingSessionId=i.id,this.editLabel=i.label||""}saveLabel(i){return L(this,null,function*(){try{yield this.liveService.updateSessionLabel(i.id,this.editLabel),i.label=this.editLabel||null,this.toastService.success(this.t.instant("MANAGER.SHOP_LIVE.SESSION_LABEL_SAVED"))}catch{this.toastService.error(this.t.instant("MANAGER.SHOP_LIVE.SESSION_LABEL_ERROR"))}this.editingSessionId=null})}cancelEditLabel(){this.editingSessionId=null}goLive(){this.router.navigate(["/studio/shop/live"])}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=A({type:t,selectors:[["app-view-manager-shop-sessions"]],decls:4,vars:1,consts:[[3,"message"],["icon","pi pi-video","titleKey","MANAGER.SHOP_LIVE.EMPTY_TITLE","descriptionKey","MANAGER.SHOP_LIVE.EMPTY_DESC","ctaLabelKey","MANAGER.SHOP_LIVE.SESSIONS_START_FIRST","ctaIcon","pi pi-play",3,"features"],[1,"sessions-container","p-3"],[3,"retry","message"],["icon","pi pi-video","titleKey","MANAGER.SHOP_LIVE.EMPTY_TITLE","descriptionKey","MANAGER.SHOP_LIVE.EMPTY_DESC","ctaLabelKey","MANAGER.SHOP_LIVE.SESSIONS_START_FIRST","ctaIcon","pi pi-play",3,"ctaClick","features"],[1,"d-flex","align-items-center","justify-content-between","mb-3"],[1,"mb-1","fw-bold"],[1,"pi","pi-history","me-2"],[1,"text-muted","mb-0","small"],[1,"d-flex","align-items-center","gap-2"],["routerLink","/studio/shop/live",1,"p-button","p-button-sm","p-button-outlined"],[1,"pi","pi-play","me-1"],["styleClass","p-datatable-sm p-datatable-striped","responsiveLayout","scroll",3,"onLazyLoad","value","loading","paginator","rows","totalRecords","lazy","rowsPerPageOptions"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"text-end"],[1,"text-center"],[1,"text-nowrap"],[1,"d-flex","align-items-center","gap-1"],["tooltipPosition","top",1,"session-label-cell",3,"pTooltip"],[1,"text-end","fw-bold","text-success"],[1,"text-truncate","d-inline-block",2,"max-width","150px"],[1,"text-muted"],["severity","success",3,"value"],["severity","secondary",3,"value"],["pInputText","",1,"p-inputtext-sm",2,"width","140px",3,"ngModelChange","keyup.enter","keyup.escape","ngModel"],["pButton","","icon","pi pi-check",1,"p-button-text","p-button-sm","p-button-success",3,"click"],["pButton","","icon","pi pi-times",1,"p-button-text","p-button-sm",3,"click"],["tooltipPosition","top",1,"session-label-cell",3,"click","pTooltip"],[1,"text-muted","fst-italic"],[1,"pi","pi-pencil","ms-1","edit-icon"],["colspan","10",1,"text-center","text-muted","py-4"]],template:function(e,s){e&1&&g(0,re,1,0,"app-widget-loading")(1,le,1,1,"app-widget-api-error",0)(2,pe,1,1,"app-widget-manager-empty-state",1)(3,fe,19,17,"div",2),e&2&&I(!s.loaded&&s.loading?0:s.error?1:s.loaded&&s.sessions.length===0&&!s.loading?2:3)},dependencies:[P,Y,k,F,K,R,b,H,G,q,j,$,Z,X,te,ee,W,U,Q,J,z,ie,ne],styles:[".sessions-container[_ngcontent-%COMP%] .session-label-cell[_ngcontent-%COMP%]{cursor:pointer;display:inline-flex;align-items:center;gap:.25rem}.sessions-container[_ngcontent-%COMP%] .session-label-cell[_ngcontent-%COMP%] .edit-icon[_ngcontent-%COMP%]{font-size:.7rem;opacity:0;transition:opacity .15s;color:var(--p-text-muted-color)}.sessions-container[_ngcontent-%COMP%] .session-label-cell[_ngcontent-%COMP%]:hover .edit-icon[_ngcontent-%COMP%]{opacity:1}"]}
1)};export{ae as ViewManagerShopSessionsComponent};
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.