1import{I as e,Q as a,V as t,_ as o,d as s,f as l,i as n,it as i,l as c,t as d,u as r,y as u}from"./_plugin-vue_export-helper-BOtcModL.js";import{l as p}from"./runtime-dom.esm-bundler-CC6M3s8d.js";import{In as h,Ma as b,Un as g,Wa as m,Wn as C,a as A,o as S,yr as y,za as f}from"./vue-router-sH2p8H80.js";import{t as L}from"./LbrLabel-DQSFTYQR.js";import{t as E}from"./LbrValue-DZL5jupJ.js";import{Mn as w,Nn as I,On as U,_n as M,ln as P,nt as N,pn as v,qn as _,t as T}from"./index-CPP0TwgC.js";import{t as D}from"./LbrCheckbox-CjR2SR5Y.js";var O=u({name:"LbrSelectAccountModal",components:{LbrTable:N,LbrBtn:I,LbrValue:E,LbrLabel:L,LbrModal:M,LbrCaptcha:T},extends:_,props:{accounts:{type:Array}},emits:["accountSelected","closeModal"],setup:()=>({isCaptchaInvalid:g,ENABLE_CAPTCHA_GET_MY_ACCOUNT:y}),data(){const e=new b;return e.push(new f({labelId:"modal-selection-user-action",width:"7rem",attribute:"id",isKey:!0,slot:"selectionSlot",sortable:!1})),e.push(new f({labelId:"modal-selection-user-type",width:"9rem",attribute:"isGdo",slot:"typeSlot",sortable:!1})),e.push(new f({labelId:"modal-selection-user-id",width:"9rem",attribute:"id",sortable:!1})),e.push(new f({labelId:"modal-selection-user-number",width:"9rem",attribute:"gdoNumber",sortable:!1})),e.push(new f({labelId:"modal-selection-user-name",attribute:"gdoName",sortable:!1})),{pageId:"UC-PORT-HEAD.EC-HEAD-01",accountsRadio:[],accountSelected:"",headers:e,uuid:crypto.randomUUID()}},watch:{accountSelected(e){if(this.accounts){const a=this.accounts.find(a=>a.account?.id===e);w(a,this.uuid).then(()=>{this.$emit("accountSelected",a)}).catch(()=>{this.$emit("accountSelected",a)})}}},beforeMount(){this.accounts&&this.accounts.length>1&&this.accounts.forEach(e=>{this.accountsRadio.push({id:e.account?.id??"",isGdo:!!e.regularClient?.code,gdoNumber:e.regularClient?.code,gdoName:e.regularClient?.name})})},methods:{selectUser(e){this.accountSelected=e}}}),k={class:"w-100"},H=["onClick"],x={key:1},G="anonymousGeneralConditionsVersion",R="VERSION_CONDITIONS_GENERALES",V=u({name:"AuthenticateView",components:{ShadowDom:P,LbrCheckbox:D,LbrLabel:L,LbrModal:M,LbrSelectAccountModal:d(O,[["render",function(s,n,i,d,u,h){const b=t("lbr-label"),g=t("LbrValue"),m=t("lbr-table"),C=t("lbr-captcha"),A=t("lbr-btn"),S=t("lbr-modal");return e(),r(S,{"page-id":s.pageId,"label-id":"","classic-modal":!1,"closable-outside":!1},{title:a(()=>[o(b,{"page-id":s.pageId,"label-id":"modal-selection-user-title"},null,8,["page-id"])]),body:a(()=>[c("div",k,[o(m,{rows:s.accountsRadio,header:s.headers,"page-id":s.pageId,"label-id":"","onUpdate:radioValue":n[0]||(n[0]=e=>s.accountSelected=e)},{selectionSlot:a(({value:a})=>[s.isCaptchaInvalid(s.uuid,s.ENABLE_CAPTCHA_GET_MY_ACCOUNT)?(e(),l("span",x,"-")):(e(),l("a",{key:0,href:"#",onClick:p(e=>s.selectUser(a),["prevent"])},[o(g,{"page-id":s.pageId,"label-id":"modal-selection-user-select"},null,8,["page-id"])],8,H))]),typeSlot:a(({value:a})=>[a?(e(),r(g,{key:0,"page-id":s.pageId,"label-id":"gdo"},null,8,["page-id"])):(e(),r(g,{key:1,"page-id":s.pageId,"label-id":"non-gdo"},null,8,["page-id"]))]),_:1},8,["rows","header","page-id"]),o(C,{"captcha-key":s.uuid},null,8,["captcha-key"])])]),footer:a(()=>[o(A,{size:"small fixed-width","page-id":s.pageId,"label-id":"modal-selection-user-confirm-cancel",onClick:n[1]||(n[1]=e=>s.$emit("closeModal"))},null,8,["page-id"])]),_:1},8,["page-id"])}]]),LbrSpinner:v,LbrCaptcha:T},props:{certLogin:{type:Boolean,default:!1}},setup:()=>({isCaptchaInvalidForAllUsers:C,ENABLE_CAPTCHA_GET_MY_ACCOUNT:y}),data:()=>({accounts:new Array,displaySelectAccountModal:!1,displayGeneralConditionsModal:!1,cmsPageId:"UC-PORT-HEAD.EC-HEAD-01",cmsPage:"/informations/conditions-generales.html",cmsPageSearch:"",uuid:crypto.randomUUID()}),computed:{...m(S),lang(){return this.lbrStore.getLang},conditionsDescriptionField(){return this.lbrStore.getField("UC-PORT-HEAD.EC-HEAD-01","conditions-description")}},mounted(){this.lbrStore.changeForbiddenModal(!1),U(!1).then(e=>{e&&e.length>1&&!this.lbrStore.getAccountSelected&&(this.accounts=e,this.displaySelectAccountModal=!0)}).catch(e=>{}).finally(async()=>{this.displaySelectAccountModal||await this.goNext(this.lbrStore.getAccountSelected)})},beforeUnmount(){const e=this.lbrStore.getAccountSelected;e?.account?.preferredLanguage&&this.lbrStore.changeLang(e.account.preferredLanguage.toUpperCase())},methods:{async goNext(e){await this.hasAcceptedGeneralConditions(e)?this.replaceLastPath(void 0,!0):(this.displayGeneralConditionsModal=!0,this.displaySelectAccountModal=!1)},async accept(e){if(e){const a=this.lbrStore.getAccountSelected;if(!a)return void this.replaceLastPath(void 0,!0);const t=await h(R);if("ANONYMOUS"===a?.account?.authType)return sessionStorage.setItem(G,t??""),void this.replaceLastPath(void 0,!0);a.status&&(a.status.generalConditions=e,a.status.generalConditionsVersion=t),w(a,this.uuid).then(()=>{this.lbrStore.changeUserId(a),this.replaceLastPath(void 0,!1)}).catch(()=>{this.replaceLastPath(void 0,!0)})}},replaceLastPath(e,a){U(a).then(a=>{if(a&&e){const t=a.find(a=>a.account?.id===e.account?.id);this.lbrStore.changeUserId(t)}});const t=localStorage.getItem("lastPath");if(t){const e=JSON.parse(t);this.$router.replace(e)}},async hasAcceptedGeneralConditions(e){const a=await h(R);if("ANONYMOUS"===e?.account?.authType){const e=sessionStorage.getItem(G);return e&&e===a}return e?.status?.generalConditions&&e?.status?.generalConditionsVersion&&e?.status?.generalConditionsVersion===a}}}),j={class:"fw-bold"},F={style:{"max-height":"40vh","overflow-y":"auto","overflow-x":"hidden"}},B={class:"mt-3"},Y={class:"mt-3"},$=d(V,[["render",function(d,u,p,h,b,g){const m=t("lbr-select-account-modal"),C=t("lbr-label"),A=t("shadow-dom"),S=t("lbr-captcha"),y=t("lbr-checkbox"),f=t("lbr-modal"),L=t("lbr-spinner");return e(),l(n,null,[d.accounts&&d.accounts.length?(e(),r(m,{key:0,show:d.displaySelectAccountModal,"onUpdate:show":u[0]||(u[0]=e=>d.displaySelectAccountModal=e),accounts:d.accounts,onCloseModal:u[1]||(u[1]=()=>d.displaySelectAccountModal=!1),onAccountSelected:u[2]||(u[2]=async e=>await d.goNext(e))},null,8,["show","accounts"])):s("",!0),o(f,{"page-id":"UC-PORT-HEAD.EC-HEAD-01","label-id":"modal-conditions",show:d.displayGeneralConditionsModal,closable:!1,"classic-modal":!1},{title:a(()=>[o(C,{"page-id":"UC-PORT-HEAD.EC-HEAD-01","label-id":"conditions-title"})]),body:a(()=>[c("p",j,i(d.conditionsDescriptionField?.labelName),1),c("p",null,i(d.conditionsDescriptionField?.fieldDescription),1),c("div",F,[d.lang?(e(),r(A,{key:d.lang+d.cmsPage+d.cmsPageSearch,"page-id":d.cmsPageId,url:d.lang.toLowerCase()+d.cmsPage+d.cmsPageSearch,onUrlChange:u[3]||(u[3]=e=>{d.cmsPage=e.path,d.cmsPageSearch=e.search})},null,8,["page-id","url"])):s("",!0)]),c("div",B,[o(S,{"captcha-key":d.uuid,"disabled-for":[]},null,8,["captcha-key"])]),c("div",Y,[o(y,{disabled:d.isCaptchaInvalidForAllUsers(d.uuid,d.ENABLE_CAPTCHA_GET_MY_ACCOUNT),"page-id":"UC-PORT-HEAD.EC-HEAD-01","label-id":"conditions-accept",name:"conditions-accept","onUpdate:value":u[4]||(u[4]=e=>d.accept(e))},null,8,["disabled"])])]),_:1},8,["show"]),o(L)],64)}]]);export{$ as default};
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.