Files
kapp/2307.d4d86a5fb1982957.js
2026-05-21 11:19:10 -03:00

1 line
28 KiB
JavaScript

(self.webpackChunkapp=self.webpackChunkapp||[]).push([[2307],{42307:(O,P,c)=>{c.r(P),c.d(P,{StartPageModule:()=>Re});var w=c(69270),a=c(45449),S=c(90944);c(90603);const B=[w.I];let V=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=a.\u0275\u0275defineNgModule({type:o}),o.\u0275inj=a.\u0275\u0275defineInjector({imports:[B]}),o})();var L=c(61380),l=c(15861);let R={};const b={},h={};let m=!1;function d(o,s){return u.apply(this,arguments)}function u(){return(u=(0,l.Z)(function*(o,s){return(yield b[o].get(s))()})).apply(this,arguments)}function M(o,s){return g.apply(this,arguments)}function g(){return(g=(0,l.Z)(function*(o,s){return h[s]||(m||(yield c.I("default"),m=!0),yield o.init(c.S.default),h[s]=!0),o})).apply(this,arguments)}function v(o,s){return E.apply(this,arguments)}function E(){return(E=(0,l.Z)(function*(o,s){if("string"==typeof o)return yield Z(o,s);if("script"===o.type){const e=o;return yield Z(e.remoteEntry,e.remoteName)}"module"===o.type&&(yield K(o.remoteEntry))})).apply(this,arguments)}function K(o){return x.apply(this,arguments)}function x(){return(x=(0,l.Z)(function*(o){return b[o]?Promise.resolve():yield import(o).then(s=>{M(s,o),b[o]=s})})).apply(this,arguments)}function Z(o,s){return j.apply(this,arguments)}function j(){return(j=(0,l.Z)(function*(o,s){return new Promise((e,t)=>{if(b[s])return void e();const r=document.createElement("script");r.src=o,r.onerror=t,r.onload=()=>{const n=window[s];M(n,s),b[s]=n,e()},document.body.appendChild(r)})})).apply(this,arguments)}function oe(o){return X.apply(this,arguments)}function X(){return(X=(0,l.Z)(function*(o){let s,e,t;if(o.type||(o.type="script"),"manifest"===o.type){const r=R[o.remoteName];if(!r)throw new Error("Manifest does not contain "+o.remoteName);o={type:r.type,exposedModule:o.exposedModule,remoteEntry:r.remoteEntry,remoteName:"script"===r.type?o.remoteName:void 0},t=r.remoteEntry}else t=o.remoteEntry;return"script"===o.type?(s={type:"script",remoteEntry:o.remoteEntry,remoteName:o.remoteName},e=o.remoteName):"module"===o.type&&(s={type:"module",remoteEntry:o.remoteEntry},e=o.remoteEntry),t&&(yield v(s)),yield d(e,o.exposedModule)})).apply(this,arguments)}var de=c(47423),T=c(8162),ue=c(84481),he=c(49965),pe=c(8929),ie=c(5254),_=c(21086),se=c(24850),ee=c(22868),me=c(87545),te=c(27221),k=c(47898),fe=c(97880),Q=c(35453),$=c(92340),ge=c(59973),ve=c(39961),ye=c(76733),Se=c(59584);let Ee=(()=>{class o{constructor(e,t,r,n){var i=this;this.bootstrapWcService=e,this.logService=t,this.storageWcService=r,this.http=n,this.env=$.N,this.isInitialized=!1,this.initializationPromise=null,this.getFullUrl=function(){var p=(0,l.Z)(function*(I){try{yield i.ensureInitialized()}catch(f){return i.logService.logError("AppMfeWcService","Falha na inicializa\xe7\xe3o, usando valores padr\xe3o",f),i.getDefaultUrlData()}const y=I||i.getSafeLocatorValue();if(!y)return i.logService.logError("AppMfeWcService","Locator n\xe3o dispon\xedvel, usando valores padr\xe3o"),i.getDefaultUrlData();try{const f=(yield i.getBasePlatformUrlSafely(y))||"/default/",C=i.getDefaultHostForEnvironment(),D=`${C}${f}`;i.logService.logEvent("MfeWcService","FullUrl obtida",{fullUrl:D}),i.storageWcService.setHostUrl(D),i.storageWcService.setAddXrsfHeader(!0);try{yield i.setCsrf(C,f)}catch(W){i.logService.logError("AppMfeWcService","Erro em setCsrf, continuando fluxo",W)}return{fullUrl:D,hostUrl:C,baseUrlContext:f}}catch(f){return i.logService.logError("AppMfeWcService","Erro em getFullUrl",f),i.getDefaultUrlData()}});return function(I){return p.apply(this,arguments)}}()}ensureInitialized(){return this.isInitialized?Promise.resolve():(this.initializationPromise||(this.initializationPromise=new Promise((e,t)=>{try{if(!this.bootstrapWcService)return this.logService.logError("AppMfeWcService","bootstrapWcService n\xe3o dispon\xedvel"),t(new Error("bootstrapWcService n\xe3o dispon\xedvel"));this.logService.logEvent("AppMfeWcService","Inicializa\xe7\xe3o conclu\xedda com sucesso"),this.isInitialized=!0,e()}catch(r){this.logService.logError("AppMfeWcService","Erro na inicializa\xe7\xe3o",r),t(r)}})),this.initializationPromise)}getSafeLocatorValue(){try{return this.bootstrapWcService.locator$.getValue()}catch(e){return this.logService.logError("AppMfeWcService","Erro ao obter locator do BehaviorSubject",e),null}}getBasePlatformUrlSafely(e){var t=this;return(0,l.Z)(function*(){return new Promise((r,n)=>{const i=setTimeout(()=>{t.logService.logError("AppMfeWcService","Timeout ao obter baseUrlPlatform"),n(new Error("Timeout ao obter baseUrlPlatform"))},1e4);t.bootstrapWcService.getBasePlatformUrl(e).pipe((0,ge.X)(3)).subscribe({next:p=>{clearTimeout(i),r(p)},error:p=>{clearTimeout(i),t.logService.logError("AppMfeWcService","Erro ao obter baseUrlPlatform",p),n(p)}})})})()}setCsrf(e,t){var r=this;return(0,l.Z)(function*(){console.log("Aqui 1 csrf");try{const n=yield r.getCsrf().toPromise();if("CSRF_NOT_FOUND"===n?.msgCode)return void r.logService.logError("AppMfeWcService","CSRF n\xe3o encontrado",{});r.storageWcService.setCsrf(n)}catch(n){throw r.logService.logError("AppMfeWcService","Erro ao obter o CSRF",n),n}})()}getCsrf(){const e=`${$.N.protocol}://${$.N.url}:${$.N.port}/api/csrf`,t=this.getCsrfStorage();return this.http.post(`${e}`,{token:t},{headers:{pragma:"no-cache","cache-control":"no-cache"},responseType:"text"}).pipe((0,se.U)(r=>r),(0,ee.b)(r=>console.log("TAP:: csrf:: ",r)),(0,te.K)(r=>(0,_.of)({...r,msgCode:"CSRF_NOT_FOUND",message:"CSRF n\xe3o encontrado"})))}getDefaultUrlData(){const e=this.getDefaultHostForEnvironment(),t="/default/",r=`${e}${t}`;return this.storageWcService.setHostUrl(r),this.logService.logEvent("AppMfeWcService","Usando FullUrl padr\xe3o ap\xf3s erro",{fullUrl:r}),{fullUrl:r,hostUrl:e,baseUrlContext:t}}getDefaultHostForEnvironment(){switch(this.env.type){case"prod":return"https://visitante.in";case"homol":return"https://h.visitante.in";case"dev":return"https://sectotemvirtual.cloud.olimpia"}}getCsrfStorage(){return this.storageWcService.getCsrf()||""}}return o.\u0275fac=function(e){return new(e||o)(a.\u0275\u0275inject(ve.E),a.\u0275\u0275inject(ye.$),a.\u0275\u0275inject(Q.Gj),a.\u0275\u0275inject(Se.HttpClient))},o.\u0275prov=a.\u0275\u0275defineInjectable({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();const Ce=["reactContainerWc"];function De(o,s){1&o&&(a.\u0275\u0275elementStart(0,"div",4),a.\u0275\u0275element(1,"div",5),a.\u0275\u0275elementEnd())}const Pe=[{path:"",component:(()=>{class o{constructor(e,t,r,n,i,p,I,y,f,C,D,A,W,U){this.logService=e,this.authService=t,this.managerTokenUaamobileService=r,this.photoService=n,this.checkinService=i,this.activatedRoute=p,this.apiService=I,this.mfeWcService=y,this.storageWcService=f,this.ngZone=C,this.walletQrCodeWcService=D,this.router=A,this.fcmService=W,this.translateService=U,this.destroy$=new pe.xQ,this.ipMfeRemoteDevLocal="http://10.0.0.149:3000",this.isLoading=!0,this.photoConfig={contentType:"png",defaultSyncState:!1},this.errorLoadReactComponetRemoteEntry=!1,this.root=null,this.reactComponentWc=null,this.loadRemoteModuleConfig={exposedModule:"./App",remoteEntry:"",remoteName:"remote"},this.errorTemplate='\n <div class="react-wrapper-error">\n <div class="title-wrapper-remote-entry">\n <h1>Ops! </h1>\n <p>Ocorreu um erro ao carregar o Web Check-in</p>\n </div>\n <div class="img-error-wrapper-remote-entry">\n <img src="./assets/svg/ops.svg" alt="Erro ao carregar Web Check-in" />\n </div>\n </div>\n',this.errorTemplateFullUrl='\n <div class="react-wrapper-error">\n <div class="title-wrapper-remote-entry">\n <h1>Erro ao carregar Web Check-in</h1>\n <p>N\xe3o foi poss\xedvel obter a URL base do ambiente</p>\n </div>\n <div class="img-error-wrapper-remote-entry">\n <img src="assets/svg/ops.svg" alt="Erro ao carregar Web Check-in" />\n </div>\n </div>\n ',console.log("StartPage","Inicializando StartPage"),this.subscribeToRouteParams(),this.currentLanguage=this.translateService.getCurrentLang()||"en-US",console.log("currentLanguage",this.currentLanguage),this.currentLanguage.includes("pt")?this.currentLanguage="pt-BR":this.currentLanguage.includes("en")?this.currentLanguage="en-US":this.currentLanguage.includes("es")&&(this.currentLanguage="es")}ionViewDidEnter(){this.checkQrCodesForSiteLocator()}ionViewDidLeave(){this.ngZone.run(()=>{console.log("\u{1f9f9} Desmontando React completamente..."),this.root&&(console.log("\u26a0\ufe0f React sendo desmontado..."),this.root?.unmount(),this.root=null),this.reactContainerWc&&(this.reactContainerWc.nativeElement.innerHTML=""),this.onDestroy()})}ngOnDestroy(){this.onDestroy(),this.storageWcService.resetCheckinData()}back(){this.router.navigate(["/home"])}onDestroy(){this.destroy$?.next(),this.destroy$?.complete()}startInitialEssentialData(){var e=this;return(0,l.Z)(function*(){e.isLoading=!0;try{if(!e.locator){e.logService.logError("startInitialEssentialData","Locator n\xe3o dispon\xedvel");const F=yield e.storageWcService.getCheckinData();if(e.locator=F?.locator,!e.locator)throw new Error("Locator n\xe3o dispon\xedvel, imposs\xedvel prosseguir")}const t=yield e.loadEssentialDataApp(),{refId:r,account:n,photoStorage:i,token:p}=t;e.token=p;const I=yield e.getTokenFcm();let y=!1,f=null,C=!1,D=null,A=!1,W=T.x.NONE;if(i?.faceImage)f=i?.faceImage,y=null!==i?.faceImage,C=i?.validated??!1,D=i?.lastModifiedDate??null,A=i?.synchronized??!1,W=i?.validationType??T.x.NONE;else{console.log("\u{1f4f8} Buscando foto remota...");const F=yield e.getPhoto(r);f=F?.faceImageThumbnail,y=null!==F?.faceImageThumbnail,C=F?.validated??!1,D=F?.lastModifiedDate??null}if(!t)return void e.logService.logError("startInitialEssentialData","Dados iniciais n\xe3o carregados");e.initDataLoadStartEssential=t;const U=yield e.storageWcService.getCheckinData(),ce=yield e.getQrCodes(),Me=e.findySiteInstanceByLocator(ce,e.locator),le={refId:r,name:n?.firstName,document:n?.document,isForeign:U?.isForeign??!1,walletQrCodes:ce,siteLocator:U?.siteLocator||null,companyName:U?.companyName||null,companyInstance:U?.companyInstance||null,printed:U?.printed||!1,event:U?.event||null,rememberMe:!0,deepLink:!0,status:e.initDataLoadStartEssential?.foreign?"APPROVED":"",locator:e.locator,siteInstance:Me,qrCode:e.qrCode||null,webToken:I,language:e.currentLanguage,photo:{colaborator:!0,validated:C,hasPhoto:y,faceImage:f,lastModifiedDate:D,synchronized:A,validationType:W}};e.checkinData=le,console.log("checkinData",e.checkinData),e.setCheckinData(le)}catch(t){console.error("\u274c Erro em startInitialEssentialData:",t),e.handleErrorInitialData(t)}finally{e.isLoading=!1}})()}subscribeToRouteParams(){this.activatedRoute.params.pipe((0,se.U)(e=>e?.locator),(0,ee.b)(e=>{const t=this.router.getCurrentNavigation()?.extras;this.dataStateExtrasRouter=t;const r=this.dataStateExtrasRouter?.state?.qrCode;r&&(this.qrCode=r)}),(0,me.w)(e=>this.processLocator(e)),(0,ee.b)(e=>this.handleUrlData(e)),(0,te.K)(e=>(console.error("Erro na subscri\xe7\xe3o de rota:",e),this.handleSubscriptionError(e)))).subscribe({next:e=>console.log("Subscri\xe7\xe3o processada com sucesso",e),error:e=>console.error("Erro na subscri\xe7\xe3o:",e),complete:()=>console.log("Subscri\xe7\xe3o de rota completa")})}processLocator(e){if(!e)return this.logService.logError("processLocator","Locator n\xe3o encontrado"),(0,ie.D)(Promise.resolve({fullUrl:null,hostUrl:null,baseUrlContext:null}));this.locator=e;const t=this.mfeWcService.getFullUrl(e).then(r=>r).catch(r=>{throw r});return(0,ie.D)(t).pipe((0,te.K)(r=>(0,_.of)(r)))}handleUrlData(e){e&&e?.fullUrl&&e?.hostUrl&&e?.baseUrlContext&&this.iniciarFluxoSequencial(e)}iniciarFluxoSequencial(e){var t=this;return(0,l.Z)(function*(){if(t.isLoading=!0,!e?.fullUrl)return t.logService.logError("ERRO_URL","URL base n\xe3o dispon\xedvel"),t.isLoading=!1,t.reactContainerWc.nativeElement.innerHTML=t.errorTemplateFullUrl,void(t.isLoading=!1);try{if(t.storageWcService.setHostUrl(e.fullUrl),!(yield t.loadEssentialDataApp().catch(n=>{throw t.logService.logError("iniciarFluxoSequencial","Erro ao carregar dados essenciais",n),new Error(`Falha ao carregar dados essenciais: ${n.message}`)})))throw new Error("Dados essenciais n\xe3o foram carregados corretamente");if(yield t.startInitialEssentialData().catch(n=>{throw t.logService.logError("iniciarFluxoSequencial","Erro ao inicializar dados essenciais",n),new Error(`Falha ao inicializar dados essenciais: ${n.message}`)}),!t.checkinData)throw new Error("checkinData est\xe1 nulo ou undefined");if("object"!=typeof t.checkinData)throw new Error("checkinData n\xe3o \xe9 um objeto v\xe1lido");try{yield t.loadReactComponent().catch(function(){var n=(0,l.Z)(function*(i){if(i.message?.includes("CORS")||i.message?.includes("csrf"))throw i});return function(i){return n.apply(this,arguments)}}())}catch(n){t.logService.logError("ERRO_REACT","Erro ao carregar componente React",{error:n,url:e.fullUrl}),t.isLoading=!1,t.reactContainerWc.nativeElement.innerHTML=t.errorTemplate,t.errorLoadReactComponetRemoteEntry=!0}finally{t.isLoading=!1}}catch(r){t.logService.logError("ERRO_FLUXO","Erro no fluxo sequencial",{message:r.message,stack:r.stack,phase:"iniciarFluxoSequencial"}),r.message.includes("checkinData")?t.reactContainerWc.nativeElement.innerHTML='\n <div class="react-wrapper-error">\n <div class="title-wrapper-remote-entry">\n <h1>Erro de Dados</h1>\n <p>N\xe3o foi poss\xedvel carregar os dados necess\xe1rios para o check-in</p>\n </div>\n <div class="img-error-wrapper-remote-entry">\n <img src="assets/svg/ops.svg" alt="Erro de dados" />\n </div>\n </div>\n ':(t.reactContainerWc.nativeElement.innerHTML=t.errorTemplate,t.errorLoadReactComponetRemoteEntry=!0)}finally{t.isLoading=!1}})()}handleSubscriptionError(e){return this.logService.logError("subscribeToRouteParams","Erro na subscri\xe7\xe3o principal",e),this.isLoading=!1,this.reactContainerWc.nativeElement.innerHTML=this.errorTemplate,(0,_.of)(e)}handleErrorInitialData(e){const t=e instanceof Error?e.message:"Erro desconhecido";this.logService.logError("startInitialEssentialData",`Erro ao carregar dados iniciais: ${t}`,e)}loadEssentialDataApp(){var e=this;return(0,l.Z)(function*(){const t=[e.managerTokenUaamobileService.initStartGetTokenUaaMobile(),e.getUUID(),e.authService.getRefId(),e.authService.getForeigner(),e.getAccount(),e.authService.getPhoto()],[r,n,i,p,I,y]=yield Promise.all(t);return{token:r,uuid:n,refId:i,foreign:p,account:I,photoStorage:y}})()}getAccount(){var e=this;return(0,l.Z)(function*(){let t=yield e.authService.getAccount(),r=null;try{r=yield e.managerTokenUaamobileService.initStartGetTokenUaaMobile()}catch(n){throw e.logService.logError("http::managerTokenUaamobileService","from getAccount error::token "+JSON.stringify(n.message),n),n}try{if(t&&t?.fullName)return t;t=yield e.apiService.account(r).toPromise(),e.authService.setAccount(t)}catch(n){throw e.logService.logError("http::getAccount","error::getAccount "+JSON.stringify(n.message),n),n}return t})()}getUUID(){var e=this;return(0,l.Z)(function*(){return yield e.authService.getUUID()})()}setCheckinData(e){var t=this;return(0,l.Z)(function*(){try{return e?.qrCodeData&&(yield t.saveQrCodes(e.qrCodeData),delete e.qrCodeData,e.walletQrCodes=yield t.getQrCodes()),yield t.checkinService.updateCheckinData(e),t.checkinService.getCheckinData()}catch(r){throw t.logService.logError("setCheckinData","Erro ao salvar dados",r),r}})()}getPhoto(e){var t=this;return(0,l.Z)(function*(){const r=yield t.authService.getPhoto();console.log("DEBUG","photoInStorage",r);const n=yield t.managerTokenUaamobileService.initStartGetTokenUaaMobile();if(!t.hasValidPhotoInStorage(r))try{const i=yield t.photoService.getPhoto(n,e).toPromise();return i?.faceImageThumbnail?(t.handleSyncSuccess(i),i):(t.handleSyncFailure(),null)}catch(i){const p=i;return 404!==p.status&&t.logService.logError("handleErrorGetPhoto","Erro get photo http",p),null}return yield t.updateUserPhoto(r,e),null})()}updateUserPhoto(e,t){var r=this;return(0,l.Z)(function*(){if(console.log("DEBUG","updateUserPhoto",e),!e)return;const i=r.preparePhotoData(e,{colaborator:!0,refId:t,faceImageContentType:r.photoConfig.contentType,faceImage:e?.faceImage,validated:e?.validated??!1,lastModifiedDate:e?.lastModifiedDate??null,validationType:e?.validationType??T.x.NONE});i.faceImage&&(yield r.updatePhoto(i))})()}preparePhotoData(e,t){const r=e?.faceImage??"";return this.hasFaceImageAndSynchronizedProperties(e)?{...t,faceImage:e.synchronized?"":r}:{...t,faceImage:r}}updatePhoto(e){var t=this;return(0,l.Z)(function*(){try{const r=yield t.managerTokenUaamobileService.initStartGetTokenUaaMobile(),n=yield yield t.photoService.updatePhoto(r,e).toPromise();n&&(yield t.setPhotoStorage({synchronized:!0,faceImage:e.faceImage,validated:e?.validated??n.validated,lastModifiedDate:e?.lastModifiedDate??n.lastModifiedDate,hasPhoto:null!==e?.faceImage,validationType:e?.validationType??T.x.NONE}))}catch(r){throw t.logService.logError("updatePhoto","Erro ao atualizar foto",r),r}})()}hasValidPhotoInStorage(e){return!!e&&(!this.hasFaceImageAndSynchronizedProperties(e)||Boolean(e&&e.faceImage))}hasFaceImageAndSynchronizedProperties(e){return"object"==typeof e&&null!==e&&"faceImage"in e&&"synchronized"in e&&"validated"in e&&"hasPhoto"in e}handleSyncFailure(){this.setPhotoStorage({faceImage:null,synchronized:!1,validated:!1,hasPhoto:!1,lastModifiedDate:null,validationType:T.x.NONE})}handleSyncSuccess(e){this.setPhotoStorage({faceImage:e?.faceImageThumbnail,synchronized:!0,validated:e?.validated??!1,hasPhoto:null!==e?.faceImageThumbnail,lastModifiedDate:e?.lastModifiedDate??null,validationType:e?.validationType??T.x.NONE})}setPhotoStorage(e){var t=this;return(0,l.Z)(function*(){t.authService.clearPhoto(),t.authService.setPhoto({faceImage:e.faceImage??"",synchronized:e.synchronized,validated:e.validated,hasPhoto:e.hasPhoto,lastModifiedDate:e.lastModifiedDate,validationType:e.validationType})})()}getQrCodes(){var e=this;return(0,l.Z)(function*(){return yield e.walletQrCodeWcService.getQRCodes()})()}findySiteInstanceByLocator(e,t){return e.find(n=>n.locator===t)?.siteInstance??null}loadReactComponent(){var e=this;return(0,l.Z)(function*(t=0,r=3){e.isLoading=!0;try{const n=yield e.loadRemoteModuleWithRetry(t,r);yield e.initializeReactComponent(n)}catch(n){throw yield e.handleLoadError(n,t),n}finally{e.isLoading=!1}}).apply(this,arguments)}loadRemoteModuleWithRetry(e,t){var r=this;return(0,l.Z)(function*(){const n=r.configRemote();e>0&&(yield r.delay(1e3*e));try{return yield oe(n)}catch(i){return yield r.handleLoadModuleError(i,e,t,n)}})()}handleLoadModuleError(e,t,r,n){var i=this;return(0,l.Z)(function*(){if(t<r)return i.loadReactComponent(t+1,r);if(i.isCorsOrConnectionError(e))return yield i.tryAlternativeUrl(n);throw e})()}isCorsOrConnectionError(e){return e.message?.includes("CORS")||e.message?.includes("csrf")||e.message?.includes("ERR_ADDRESS_UNREACHABLE")}tryAlternativeUrl(e){var t=this;return(0,l.Z)(function*(){const r=t.configRemote().remoteEntry;e.remoteEntry=r,yield t.delay(1500);try{return yield oe(e)}catch(n){throw new Error(`Falha ao carregar m\xf3dulo remoto ap\xf3s todas as tentativas: ${n.message}`)}})()}initializeReactComponent(e){var t=this;return(0,l.Z)(function*(){if(!e?.default)throw new Error("Componente React inv\xe1lido ou sem exporta\xe7\xe3o default");if(t.reactComponentWc=e,t.storageWcService.setSecurityDataConfig(),!t.storageWcService.getSecurityDataConfig())throw new Error("Configura\xe7\xe3o de seguran\xe7a n\xe3o dispon\xedvel - securityDataConfig");yield t.delay(500),t.renderReactComponent()})()}handleLoadError(e,t){var r=this;return(0,l.Z)(function*(){r.logService.logError("ERRO_REACT","Erro ao carregar componente React",{message:e.message,stack:e.stack,type:e.constructor.name,url:r.storageWcService.getHostUrl(),retryCount:t})})()}delay(e){return new Promise(t=>setTimeout(t,e))}configRemote(){const e=this.storageWcService.getHostUrl();if(!e)throw new Error("URL base do ambiente n\xe3o dispon\xedvel");const t=`${e}remoteEntry.js?v=${Date.now()}`;return{...this.loadRemoteModuleConfig,remoteEntry:t}}renderReactComponent(){try{this.forceUnmount(),setTimeout(()=>{const e=this.reactComponentWc?.default;if(!e)throw new Error("Componente React n\xe3o encontrado");if(!this.reactContainerWc?.nativeElement)throw new Error("Container React n\xe3o encontrado");this.root||(this.root=(0,he.s)(this.reactContainerWc.nativeElement)),this.root.render(ue.createElement(e,this.getProps())),this.errorLoadReactComponetRemoteEntry=!1},1)}catch(e){throw console.log("ERRO_RENDER","Falha ao renderizar componente React",{error:e.message,stack:e.stack}),e}}forceUnmount(){this.root&&(this.root.unmount(),this.root=null)}getProps(){const e=this.checkinData;return console.log("mobileAppData",e),{key:Date.now(),mobileAppData:e,mobileUpdate:r=>{this.ngZone.run(()=>{this.mobileUpdate(r)})}}}mobileUpdate(e){var t=this;return(0,l.Z)(function*(){try{if(!e)throw new Error("Dados de atualiza\xe7\xe3o inv\xe1lidos");const r=yield t.setCheckinData(e);if(r){t.checkinData.walletQrCodes=r?.walletQrCodes??[],t.checkinData.siteInstance=r?.siteInstance,t.checkinData.locatorType=r?.locatorType??null,t.checkinData.siteLocator=r?.siteLocator??null,t.checkinData.companyName=r?.companyName??null,t.checkinData.companyInstance=r.companyInstance??"",t.checkinData.event=r?.event??null,t.checkinData.photo.validated=r?.photo?.validated??!1,t.checkinData.photo.hasPhoto=r?.photo?.hasPhoto??!1,t.checkinData.photo.faceImage=r?.photo?.faceImage??null,t.checkinData.subcategory=r?.subcategory??null,t.checkinData.hasLogisticModule=r?.hasLogisticModule??!1;const n={faceImage:r?.photo?.faceImage??null,synchronized:!1,validated:r?.photo?.validated,validationType:r?.photo?.validationType,lastModifiedDate:r?.photo?.lastModifiedDate??t.checkinData?.photo?.lastModifiedDate};r?.photo?.lastModifiedDate!==t.checkinData?.photo?.lastModifiedDate&&t.updateUserPhoto(n,r?.refId??t.checkinData?.refId),t.getProps()}}catch(r){throw t.logService.logError("onDataUpdate","Erro ao atualizar dados",r),r}})()}checkQrCodesForSiteLocator(){var e=this;return(0,l.Z)(function*(){yield e.getQrCodes()})()}saveQrCodes(e){var t=this;return(0,l.Z)(function*(){try{if(!e?.base64File)return void t.logService.logError("saveQrCodes","Dados do QR Code inv\xe1lidos");const r=yield t.getQrCodes();r.push(e),yield t.walletQrCodeWcService.saveQRCodes(r)}catch(r){throw t.logService.logError("saveQrCodes","Erro ao salvar QR Codes",r),r}})()}getTokenFcm(){var e=this;return(0,l.Z)(function*(){const t="web"===de.dV.getPlatform();try{if(!t)return yield e.fcmService.getTokenFcm()}catch(r){return e.logService.logError("getTokenFcm","Erro ao obter token FCM",r),null}return null})()}}return o.\u0275fac=function(e){return new(e||o)(a.\u0275\u0275directiveInject(k.$V),a.\u0275\u0275directiveInject(k.e8),a.\u0275\u0275directiveInject(k.FB),a.\u0275\u0275directiveInject(fe.T),a.\u0275\u0275directiveInject(Q.O6),a.\u0275\u0275directiveInject(L.ActivatedRoute),a.\u0275\u0275directiveInject(k.sM),a.\u0275\u0275directiveInject(Ee),a.\u0275\u0275directiveInject(Q.Gj),a.\u0275\u0275directiveInject(a.NgZone),a.\u0275\u0275directiveInject(Q.oT),a.\u0275\u0275directiveInject(L.Router),a.\u0275\u0275directiveInject(k.Ei),a.\u0275\u0275directiveInject(k.wK))},o.\u0275cmp=a.\u0275\u0275defineComponent({type:o,selectors:[["app-start"]],viewQuery:function(e,t){if(1&e&&a.\u0275\u0275viewQuery(Ce,7),2&e){let r;a.\u0275\u0275queryRefresh(r=a.\u0275\u0275loadQuery())&&(t.reactContainerWc=r.first)}},decls:4,vars:6,consts:[[1,"start-page-wrapper",2,"height","100%","position","relative"],[1,"container-wrapper-remote-entry",2,"height","100%","overflow","auto","position","relative"],["reactContainerWc",""],["class","loading-container",4,"ngIf"],[1,"loading-container"],[1,"spinner-border","text-primary"]],template:function(e,t){1&e&&(a.\u0275\u0275elementStart(0,"div",0),a.\u0275\u0275element(1,"div",1,2),a.\u0275\u0275template(3,De,2,0,"div",3),a.\u0275\u0275elementEnd()),2&e&&(a.\u0275\u0275advance(1),a.\u0275\u0275classProp("container-loading",t.isLoading)("container-error",t.errorLoadReactComponetRemoteEntry),a.\u0275\u0275attribute("data-state",t.isLoading?"loading":t.errorLoadReactComponetRemoteEntry?"error":"ready"),a.\u0275\u0275advance(2),a.\u0275\u0275property("ngIf",t.isLoading))},dependencies:[S.NgIf],styles:[".container-wrapper-remote-entry .react-wrapper-error{display:flex;flex-direction:column;align-items:center;height:100vh;justify-content:center;padding:1em;text-align:center}.container-wrapper-remote-entry .react-wrapper-error .title-wrapper-remote-entry h1{font-size:2.3rem!important;color:#333!important;font-weight:600}.container-wrapper-remote-entry .react-wrapper-error .title-wrapper-remote-entry p{font-size:1.1rem!important;color:#333!important;line-height:1.5}.container-wrapper-remote-entry .react-wrapper-error .img-error-wrapper-remote-entry{width:100%;display:flex;justify-content:center;align-items:center}.container-wrapper-remote-entry .react-wrapper-error .img-error-wrapper-remote-entry img{width:65vw}.bottom-start-wc{position:absolute;bottom:1em;margin:10px;width:100%;display:flex;justify-content:center;align-items:center;z-index:1000}.loading-container{position:absolute;overflow:visible;top:50%;left:50%;transform:translate(-50%,-50%);z-index:1000}.start-page-wrapper{height:100%;position:relative;overflow:hidden}.container-wrapper-remote-entry{transition:opacity .3s ease}.container-wrapper-remote-entry.container-loading{opacity:.3;pointer-events:none}.container-wrapper-remote-entry.container-error{opacity:.1;pointer-events:none}.loading-overlay{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.loading-overlay app-loading-spinner{transform:scale(1.2)}.error-overlay{-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px)}.error-overlay .error-content{background:white;border-radius:12px;box-shadow:0 4px 20px rgba(0,0,0,.1);max-width:300px;animation:slideIn .3s ease-out}.spinner-border.text-primary{color:var(--ion-color-primary)!important}@keyframes slideIn{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}\n"],encapsulation:2}),o})()}];let we=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=a.\u0275\u0275defineNgModule({type:o}),o.\u0275inj=a.\u0275\u0275defineInjector({imports:[L.RouterModule.forChild(Pe),L.RouterModule]}),o})(),Re=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=a.\u0275\u0275defineNgModule({type:o}),o.\u0275inj=a.\u0275\u0275defineInjector({imports:[w.I,V,we]}),o})()},97880:(O,P,c)=>{c.d(P,{T:()=>b});var w=c(8929),a=c(56498),S=c(20353),N=c(84241),z=c(72866);function H(h=0,m,d){let u=-1;return(0,N.k)(m)?u=Number(m)<1?1:Number(m):(0,z.K)(m)&&(d=m),(0,z.K)(d)||(d=S.P),new a.y(M=>{const g=(0,N.k)(h)?h:+h-d.now();return d.schedule(re,g,{index:0,period:u,subscriber:M})})}function re(h){const{index:m,period:d,subscriber:u}=h;if(u.next(m),!u.closed){if(-1===d)return u.complete();h.index=m+1,this.schedule(h,d)}}var B=c(26582),G=c(87545),V=c(7625),L=c(40537),l=c(45449),R=c(71403);let b=(()=>{class h{constructor(d){this.apiService=d,this.destroy$=new w.xQ}getPhoto(d,u){return this.apiService.getUserThumbnailPhoto(d,u)}updatePhoto(d,u){let M;return new a.y(g=>{M=this.retryUpdatePhoto(d,u).subscribe(v=>{g.next(v),g.complete()},v=>g.error(v))})}retryUpdatePhoto(d,u){return this.updatePhotoSendAPI(d,u).pipe((0,B.a)(M=>M.pipe((0,G.w)((g,v)=>{if(console.log("Erro, Tentativa:",v),v<2)return H(0);{const E=Math.floor(10*Math.random()*60)+60,K=E>=60?Math.floor(E/60):E,x=1e3*E,j=x;return console.log(`Aguardando ${K} ${E>=60?"minuto(s)":"segundo(s)"} (${x} milissegundos) antes de tentar novamente...`),H(j).pipe((0,G.w)(()=>(console.log("Tentando novamente ap\xf3s atraso..."),this.retryUpdatePhoto(d,u))))}}),(0,V.R)(this.destroy$))),(0,L.x)(()=>{this.unsubscribe()}))}updatePhotoSendAPI(d,u){return this.apiService.updatePhoto(d,u)}unsubscribe(){this.destroy$.next(),this.destroy$.complete()}}return h.\u0275fac=function(d){return new(d||h)(l.\u0275\u0275inject(R.s))},h.\u0275prov=l.\u0275\u0275defineInjectable({token:h,factory:h.\u0275fac,providedIn:"root"}),h})()},49965:(O,P,c)=>{var a=c(97170);P.s=a.createRoot},84241:(O,P,c)=>{c.d(P,{k:()=>a});var w=c(66688);function a(S){return!(0,w.k)(S)&&S-parseFloat(S)+1>=0}}}]);