@veltdev/sdk-staging 6.0.11 → 6.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/models/data/config.data.model.d.ts +18 -0
- package/app/models/data/user.data.model.d.ts +13 -0
- package/{chunk-F4PYCUAT.js → chunk-2LJHR77K.js} +1 -1
- package/chunk-4BAHMWIE.js +2 -0
- package/{chunk-IU25BW6T.js → chunk-4VEJIKFU.js} +1 -1
- package/{chunk-F36WWKDQ.js → chunk-4YEJYNMX.js} +1 -1
- package/chunk-5XJDGVGO.js +1 -0
- package/chunk-6YGRELTV.js +2 -0
- package/{chunk-BJRSXB3P.js → chunk-7TNGPXR5.js} +1 -1
- package/{chunk-JHMDMOHO.js → chunk-A4HLP4VU.js} +1 -1
- package/{chunk-QTF4Y24I.js → chunk-A6I23DJF.js} +1 -1
- package/chunk-DAUJEOMM.js +193 -0
- package/{chunk-FUYX2CTL.js → chunk-DZYVUUMS.js} +1 -1
- package/{chunk-VMW7PJFD.js → chunk-EMCGVIKG.js} +2 -2
- package/chunk-GHWFNVK2.js +1 -0
- package/chunk-IEOSSENF.js +1 -0
- package/chunk-IKXUU4LK.js +1 -0
- package/chunk-IQIWMWKJ.js +1 -0
- package/chunk-KJN6PDWN.js +93 -0
- package/chunk-KKKGHIG4.js +1 -0
- package/{chunk-EQBACTBQ.js → chunk-LOLURD74.js} +1 -1
- package/chunk-MUMFBRNH.js +2 -0
- package/{chunk-XISY42XO.js → chunk-NFQ33NZA.js} +1 -1
- package/{chunk-7RRXZUH7.js → chunk-NYRQTKJA.js} +1 -1
- package/{chunk-SYSCTHS4.js → chunk-Q2XHYKCH.js} +1 -1
- package/chunk-RSCWN2VG.js +1 -0
- package/chunk-STNBRDN3.js +1 -0
- package/chunk-SYWOQU23.js +174 -0
- package/{chunk-3ORHWUHZ.js → chunk-SZUD6M7J.js} +2 -2
- package/chunk-TE4S24VF.js +2 -0
- package/chunk-TG2UOHTU.js +1 -0
- package/chunk-UY5BYX47.js +1 -0
- package/chunk-V32SISMC.js +1 -0
- package/{chunk-UKJTOZK4.js → chunk-XXU7YXMF.js} +1 -1
- package/{chunk-SY46UNW5.js → chunk-YTVKKNRL.js} +1 -1
- package/{chunk-TW7O56QU.js → chunk-ZUQTUSHK.js} +1 -1
- package/package.json +1 -1
- package/velt-activity-log.js +1 -1
- package/velt-area.js +1 -1
- package/velt-arrow.js +1 -1
- package/velt-comment.js +7 -7
- package/velt-crdt.js +1 -1
- package/velt-cursor.js +1 -1
- package/velt-huddle.js +1 -1
- package/velt-live-state-sync.js +1 -1
- package/velt-notification.js +1 -1
- package/velt-portable.js +1 -0
- package/velt-presence.js +1 -1
- package/velt-reaction.js +1 -1
- package/velt-recorder.js +1 -1
- package/velt-rewriter.js +1 -1
- package/velt-selection.js +1 -1
- package/velt-tag.js +1 -1
- package/velt-user-invite.js +1 -1
- package/velt-user-request.js +1 -1
- package/velt-video-player.js +1 -1
- package/velt-views.js +3 -3
- package/velt.js +2 -2
- package/chunk-5R5ZQKPN.js +0 -1
- package/chunk-6RWQRJ7Z.js +0 -1
- package/chunk-AOHWVH4J.js +0 -193
- package/chunk-CI2SH5RY.js +0 -1
- package/chunk-CQX575C2.js +0 -1
- package/chunk-F44SU3DK.js +0 -2
- package/chunk-F6CKB7IS.js +0 -2
- package/chunk-F7SQEW6P.js +0 -93
- package/chunk-FVDWCK7Z.js +0 -1
- package/chunk-IBGPKEZW.js +0 -2
- package/chunk-ID3E7CBZ.js +0 -1
- package/chunk-M6DAI5DP.js +0 -1
- package/chunk-RLD74EXO.js +0 -1
- package/chunk-VKGZ33MA.js +0 -167
- package/chunk-VMY3F7K3.js +0 -2
- package/chunk-WFO2GRDO.js +0 -1
- package/chunk-ZJH32HDL.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Si as e,Ti as a,a as i,b as r}from"./chunk-SYWOQU23.js";var h=class{constructor(t){this.injector=t,this.hideAnalytics=!1}ha(t){try{this.hideAnalytics=t}catch{}}getService(t){return this.injector.get(t)}trackEvent(t,c={},n=!0){try{this.hideAnalytics||(c||(c={}),c=r(i({},c),{source:"external"}),this.getService(e).trackAuthenticatedEvent(t,c,n))}catch(s){this.getService(a).catch("Error in _trackEvent: ",s);return}}};export{h as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as Y}from"./chunk-
|
|
1
|
+
import{b as Y}from"./chunk-TG2UOHTU.js";import{e as _,s as x,t as Q}from"./chunk-KKKGHIG4.js";import{C as A,E as g,Ld as w,M as S,Nd as y,O as B,Od as U,Pd as O,Ti as W,U as F,Uh as P,Ui as L,V as H,Y as E,Yf as D,ba as j,ea as b,g as $,jj as R,l as C,mj as M,p as k,r as u,v as m,w as z,wj as N,xj as K}from"./chunk-SYWOQU23.js";var he=(()=>{let p=class p{constructor(e,t,r,a,s,c,n,i,d,o){this.authService=e,this.commonDbService=t,this.databaseService=r,this.docService=a,this.domService=s,this.loggingService=c,this.metadataService=n,this.commonDbUtils=i,this.configService=d,this.realtimeAdapter=o,this.HEARTBEAT_DURATION=5*1e3,this.heartbeatEnabled$=new C(!1),this.subscriptions=[],this.heartbeatCreatedTimestamps=new Map,this.initializedHeartbeatIds=new Set;try{this.loggingService.log("%c[WB] Creating CLASS: HeartbeatService","color: blue;"),this.heartbeatEnabled$.pipe(S()).subscribe(h=>{h?this.setupHeartbeat():this.teardownHeartbeat()}),this.docService.addPreDocumentIdChangeFunction("heartbeat-service",h=>h?.documentId?this.removeDocumentHeartbeat(h):Promise.resolve())}catch(h){this.loggingService.catch("Error in HeartbeatService constructor: ",h)}}setupWebWorker(e){try{let t=`
|
|
2
2
|
let intervalId;
|
|
3
3
|
self.addEventListener('message', (event) => {
|
|
4
4
|
if (event.data === 'start') {
|
|
@@ -10,4 +10,4 @@ import{b as Y}from"./chunk-CI2SH5RY.js";import{$ as j,Ai as N,C as A,Cf as D,E a
|
|
|
10
10
|
if (intervalId) clearInterval(intervalId);
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
`;if(typeof Worker<"u"){let r=new Blob([t],{type:"application/javascript"});return new Worker(URL.createObjectURL(r))}return}catch(t){this.loggingService.catch("Error in HeartbeatService setupWebWorker: ",t);return}}setupHeartbeat(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setupHeartbeat","color: green;"),this.worker=this.setupWebWorker(this.HEARTBEAT_DURATION),this.worker){this.worker.onmessage=()=>{this.authService.getUser()&&this.sendHeartbeat()};let r=this.authService.getUser$().subscribe(a=>{a?(this.worker?.postMessage("start"),this.sendHeartbeat()):this.worker?.postMessage("stop")});this.subscriptions.push(r)}else{let r=this.authService.getUser$().pipe(H(a=>a?A(this.HEARTBEAT_DURATION).pipe(F(0)):k)).subscribe(()=>this.sendHeartbeat());this.subscriptions.push(r)}let e=this.docService.getDocumentPaths$().pipe(g(r=>!!r),E(()=>this.sendHeartbeat())).subscribe();this.subscriptions.push(e);let t=z([this.databaseService.getDb().pipe(g(r=>!!r)),this.authService.getUser$(),this.docService.getDocumentPaths$()]).pipe(B(),E(([[r,a,s],[c,n,i]])=>{if(n&&i){let d=this.domService.getTabId();if(d){let o=this.generateHeartbeatId(n.userId,d),h={id:o,organizationId:i.organizationId},I=this.commonDbUtils.getDocumentPath({feature:"heartbeat",properties:h,defaultDocumentPaths:i,apiKey:this.configService.getApiKey(),useFirestore:!1});if(I&&c&&this.realtimeAdapter.rtdbOnDisconnectSet("heartbeat",this.realtimeAdapter.rtdbRef(c,I),null),i.documentId){let l={id:o,documentId:i.documentId,organizationId:i.organizationId},v=this.commonDbUtils.getDocumentPath({feature:"heartbeatByDocument",properties:l,defaultDocumentPaths:i,apiKey:this.configService.getApiKey(),useFirestore:!1});v&&c&&this.realtimeAdapter.rtdbOnDisconnectSet("heartbeat",this.realtimeAdapter.rtdbRef(c,v),null)}if(s&&s.documentId&&s.documentId!==i.documentId){let l={id:o,documentId:s.documentId,organizationId:s.organizationId,skipFirestore:!0};this.commonDbService.deleteData({feature:"heartbeatByDocument",properties:l})}}}})).subscribe();this.subscriptions.push(t)}catch(e){this.loggingService.catch("Error in HeartbeatService setupHeartbeat: ",e)}}teardownHeartbeat(){try{this.loggingService.log("%c[WB] Calling FUNCTION: teardownHeartbeat","color: green;"),this.worker&&(this.worker.postMessage("stop"),this.worker.terminate(),this.worker=void 0),this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.heartbeatCreatedTimestamps.clear(),this.initializedHeartbeatIds.clear()}catch(e){this.loggingService.catch("Error in HeartbeatService teardownHeartbeat: ",e)}}sendHeartbeat(){try{this.loggingService.log("%c[WB] Calling HeartbeatService FUNCTION: sendHeartbeat","color: green;");let e=this.authService.getUser(),t=this.docService.getDocumentPaths(),r=this.domService.getTabId();if(e&&t&&r){let a=Date.now(),s=this.generateHeartbeatId(e.userId,r),c=this.docService.getBaseMetadata("heartbeat"),n=c.documentId,i=t.organizationId,d=`${s}_${i}`,o=n?`${s}_${i}_${n}`:null,h=this.heartbeatCreatedTimestamps.get(d)??a;this.heartbeatCreatedTimestamps.has(d)||this.heartbeatCreatedTimestamps.set(d,h);let I=!this.initializedHeartbeatIds.has(d),l={id:s,createdTimestamp:h,lastUpdatedTimestamp:a,userId:e.userId,veltUserId:D(e.userId),tabId:r,metadata:c};if(I?(this.commonDbService.setData({feature:"heartbeat",properties:{id:l.id,skipFirestore:!0},data:l}),this.initializedHeartbeatIds.add(d)):this.commonDbService.updateData({feature:"heartbeat",properties:{id:l.id,skipFirestore:!0},data:l}),n&&o){let v=this.heartbeatCreatedTimestamps.get(o)??a;this.heartbeatCreatedTimestamps.has(o)||this.heartbeatCreatedTimestamps.set(o,v);let G=!this.initializedHeartbeatIds.has(o),f={id:s,createdTimestamp:v,lastUpdatedTimestamp:a,userId:e.userId,veltUserId:D(e.userId),tabId:r,metadata:c};G?(this.commonDbService.setData({feature:"heartbeatByDocument",properties:{id:f.id,skipFirestore:!0,documentId:n},data:f}),this.initializedHeartbeatIds.add(o)):this.commonDbService.updateData({feature:"heartbeatByDocument",properties:{id:f.id,skipFirestore:!0,documentId:n},data:f})}}}catch(e){this.loggingService.catch("Error in HeartbeatService sendHeartbeat: ",e)}}generateHeartbeatId(e,t){return D(e+"_"+t)}getHeartbeatData(e){try{let t=this.docService.getDocumentPaths(),r=e?.organizationId||t?.organizationId,a=e?.documentId,s,c={organizationId:r,skipFirestore:!0,useQuery:!0};if(a?(s="allHeartbeatsByDocument",c.documentId=a):s="allHeartbeats",!t)return u(null);if(e?.userId){let n=e?.limit??50;return c.rtdbQuery=[U("userId"),w(e.userId),y(n)],this.commonDbService.dbListener({feature:s,properties:c}).pipe(g(i=>!!i?.data),m(i=>i?.data),m(i=>i?Object.values(i??{}).map(d=>d):null),m(i=>{if(i){let d=e?.lastUpdatedTimestamp?.$gte??Date.now()-15e3;return i.filter(o=>!(d&&o.lastUpdatedTimestamp<d))}return i}))}else{let n=e?.orderBy??"lastUpdatedTimestamp",i=e?.lastUpdatedTimestamp?.$gte??Date.now()-15e3,d=e?.limit??50;return c.rtdbQuery=[U(n),O(i),y(d)],this.commonDbService.dbListener({feature:s,properties:c}).pipe(g(o=>!!o?.data),m(o=>o?.data),m(o=>o?Object.values(o??{}).map(h=>h):null))}}catch(t){return this.loggingService.catch("Error in HeartbeatService getHeartbeatData: ",t),u(null)}}getSpecificHeartbeat(e){try{let t=this.generateHeartbeatId(e.userId,e.tabId),a=this.docService.getDocumentPaths()?.organizationId;if(!a)return u(null);let s,c={id:t,organizationId:a,skipFirestore:!0};return e.documentId?(s="heartbeatByDocument",c.documentId=e.documentId):s="heartbeat",this.commonDbService.dbListener({feature:s,properties:c}).pipe(g(n=>!!n?.data),m(n=>n?.data),S((n,i)=>n?.lastUpdatedTimestamp===i?.lastUpdatedTimestamp))}catch(t){return this.loggingService.catch("Error in HeartbeatService getSpecificHeartbeat: ",t),u(null)}}removeDocumentHeartbeat(e){return $(this,null,function*(){try{let t=this.authService.getUser()?.userId,r=this.domService.getTabId();if(t&&r&&e?.documentId){let a=this.generateHeartbeatId(t,r),s=`${a}_${e.organizationId}_${e.documentId}`;this.heartbeatCreatedTimestamps.delete(s),this.initializedHeartbeatIds.delete(s),yield this.commonDbService.deleteData({feature:"heartbeatByDocument",properties:{id:a,documentId:e.documentId,organizationId:e.organizationId,skipFirestore:!0}})}return Promise.resolve()}catch(t){return this.loggingService.catch("Error in HeartbeatService removeDocumentHeartbeat: ",t),Promise.resolve()}})}getHeartbeat(e){try{return(e?.userId?u(e.userId):this.authService.getUser$().pipe(m(r=>r?.userId))).pipe(H(r=>r?this.docService.getDocumentPaths$().pipe(H(a=>a?this.getHeartbeatData({userId:r,documentId:a.documentId,organizationId:a.organizationId}):u(null))):u(null)),m(r=>({data:r})),S(P))}catch(t){return this.loggingService.catch("Error in HeartbeatService getHeartbeat: ",t),u({data:null})}}enableHeartbeat(){try{if(this.heartbeatEnabled$.value===!0)return;this.heartbeatEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in HeartbeatService enableHeartbeat: ",e)}}disableHeartbeat(){try{if(this.heartbeatEnabled$.value===!1)return;this.heartbeatEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in HeartbeatService disableHeartbeat: ",e)}}getHeartbeatEnabled$(){try{return this.heartbeatEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in HeartbeatService getHeartbeatEnabled$: ",e),u(!1)}}getHeartbeatEnabled(){try{return this.heartbeatEnabled$.value}catch(e){return this.loggingService.catch("Error in HeartbeatService getHeartbeatEnabled: ",e),!1}}ngOnDestroy(){try{this.teardownHeartbeat()}catch(e){this.loggingService.catch("Error in HeartbeatService ngOnDestroy: ",e)}}};p.\u0275fac=function(t){return new(t||p)(b(
|
|
13
|
+
`;if(typeof Worker<"u"){let r=new Blob([t],{type:"application/javascript"});return new Worker(URL.createObjectURL(r))}return}catch(t){this.loggingService.catch("Error in HeartbeatService setupWebWorker: ",t);return}}setupHeartbeat(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setupHeartbeat","color: green;"),this.worker=this.setupWebWorker(this.HEARTBEAT_DURATION),this.worker){this.worker.onmessage=()=>{this.authService.getUser()&&this.sendHeartbeat()};let r=this.authService.getUser$().subscribe(a=>{a?(this.worker?.postMessage("start"),this.sendHeartbeat()):this.worker?.postMessage("stop")});this.subscriptions.push(r)}else{let r=this.authService.getUser$().pipe(H(a=>a?A(this.HEARTBEAT_DURATION).pipe(F(0)):k)).subscribe(()=>this.sendHeartbeat());this.subscriptions.push(r)}let e=this.docService.getDocumentPaths$().pipe(g(r=>!!r),E(()=>this.sendHeartbeat())).subscribe();this.subscriptions.push(e);let t=z([this.databaseService.getDb().pipe(g(r=>!!r)),this.authService.getUser$(),this.docService.getDocumentPaths$()]).pipe(B(),E(([[r,a,s],[c,n,i]])=>{if(n&&i){let d=this.domService.getTabId();if(d){let o=this.generateHeartbeatId(n.userId,d),h={id:o,organizationId:i.organizationId},I=this.commonDbUtils.getDocumentPath({feature:"heartbeat",properties:h,defaultDocumentPaths:i,apiKey:this.configService.getApiKey(),useFirestore:!1});if(I&&c&&this.realtimeAdapter.rtdbOnDisconnectSet("heartbeat",this.realtimeAdapter.rtdbRef(c,I),null),i.documentId){let l={id:o,documentId:i.documentId,organizationId:i.organizationId},v=this.commonDbUtils.getDocumentPath({feature:"heartbeatByDocument",properties:l,defaultDocumentPaths:i,apiKey:this.configService.getApiKey(),useFirestore:!1});v&&c&&this.realtimeAdapter.rtdbOnDisconnectSet("heartbeat",this.realtimeAdapter.rtdbRef(c,v),null)}if(s&&s.documentId&&s.documentId!==i.documentId){let l={id:o,documentId:s.documentId,organizationId:s.organizationId,skipFirestore:!0};this.commonDbService.deleteData({feature:"heartbeatByDocument",properties:l})}}}})).subscribe();this.subscriptions.push(t)}catch(e){this.loggingService.catch("Error in HeartbeatService setupHeartbeat: ",e)}}teardownHeartbeat(){try{this.loggingService.log("%c[WB] Calling FUNCTION: teardownHeartbeat","color: green;"),this.worker&&(this.worker.postMessage("stop"),this.worker.terminate(),this.worker=void 0),this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.heartbeatCreatedTimestamps.clear(),this.initializedHeartbeatIds.clear()}catch(e){this.loggingService.catch("Error in HeartbeatService teardownHeartbeat: ",e)}}sendHeartbeat(){try{this.loggingService.log("%c[WB] Calling HeartbeatService FUNCTION: sendHeartbeat","color: green;");let e=this.authService.getUser(),t=this.docService.getDocumentPaths(),r=this.domService.getTabId();if(e&&t&&r){let a=Date.now(),s=this.generateHeartbeatId(e.userId,r),c=this.docService.getBaseMetadata("heartbeat"),n=c.documentId,i=t.organizationId,d=`${s}_${i}`,o=n?`${s}_${i}_${n}`:null,h=this.heartbeatCreatedTimestamps.get(d)??a;this.heartbeatCreatedTimestamps.has(d)||this.heartbeatCreatedTimestamps.set(d,h);let I=!this.initializedHeartbeatIds.has(d),l={id:s,createdTimestamp:h,lastUpdatedTimestamp:a,userId:e.userId,veltUserId:D(e.userId),tabId:r,metadata:c};if(I?(this.commonDbService.setData({feature:"heartbeat",properties:{id:l.id,skipFirestore:!0},data:l}),this.initializedHeartbeatIds.add(d)):this.commonDbService.updateData({feature:"heartbeat",properties:{id:l.id,skipFirestore:!0},data:l}),n&&o){let v=this.heartbeatCreatedTimestamps.get(o)??a;this.heartbeatCreatedTimestamps.has(o)||this.heartbeatCreatedTimestamps.set(o,v);let G=!this.initializedHeartbeatIds.has(o),f={id:s,createdTimestamp:v,lastUpdatedTimestamp:a,userId:e.userId,veltUserId:D(e.userId),tabId:r,metadata:c};G?(this.commonDbService.setData({feature:"heartbeatByDocument",properties:{id:f.id,skipFirestore:!0,documentId:n},data:f}),this.initializedHeartbeatIds.add(o)):this.commonDbService.updateData({feature:"heartbeatByDocument",properties:{id:f.id,skipFirestore:!0,documentId:n},data:f})}}}catch(e){this.loggingService.catch("Error in HeartbeatService sendHeartbeat: ",e)}}generateHeartbeatId(e,t){return D(e+"_"+t)}getHeartbeatData(e){try{let t=this.docService.getDocumentPaths(),r=e?.organizationId||t?.organizationId,a=e?.documentId,s,c={organizationId:r,skipFirestore:!0,useQuery:!0};if(a?(s="allHeartbeatsByDocument",c.documentId=a):s="allHeartbeats",!t)return u(null);if(e?.userId){let n=e?.limit??50;return c.rtdbQuery=[U("userId"),w(e.userId),y(n)],this.commonDbService.dbListener({feature:s,properties:c}).pipe(g(i=>!!i?.data),m(i=>i?.data),m(i=>i?Object.values(i??{}).map(d=>d):null),m(i=>{if(i){let d=e?.lastUpdatedTimestamp?.$gte??Date.now()-15e3;return i.filter(o=>!(d&&o.lastUpdatedTimestamp<d))}return i}))}else{let n=e?.orderBy??"lastUpdatedTimestamp",i=e?.lastUpdatedTimestamp?.$gte??Date.now()-15e3,d=e?.limit??50;return c.rtdbQuery=[U(n),O(i),y(d)],this.commonDbService.dbListener({feature:s,properties:c}).pipe(g(o=>!!o?.data),m(o=>o?.data),m(o=>o?Object.values(o??{}).map(h=>h):null))}}catch(t){return this.loggingService.catch("Error in HeartbeatService getHeartbeatData: ",t),u(null)}}getSpecificHeartbeat(e){try{let t=this.generateHeartbeatId(e.userId,e.tabId),a=this.docService.getDocumentPaths()?.organizationId;if(!a)return u(null);let s,c={id:t,organizationId:a,skipFirestore:!0};return e.documentId?(s="heartbeatByDocument",c.documentId=e.documentId):s="heartbeat",this.commonDbService.dbListener({feature:s,properties:c}).pipe(g(n=>!!n?.data),m(n=>n?.data),S((n,i)=>n?.lastUpdatedTimestamp===i?.lastUpdatedTimestamp))}catch(t){return this.loggingService.catch("Error in HeartbeatService getSpecificHeartbeat: ",t),u(null)}}removeDocumentHeartbeat(e){return $(this,null,function*(){try{let t=this.authService.getUser()?.userId,r=this.domService.getTabId();if(t&&r&&e?.documentId){let a=this.generateHeartbeatId(t,r),s=`${a}_${e.organizationId}_${e.documentId}`;this.heartbeatCreatedTimestamps.delete(s),this.initializedHeartbeatIds.delete(s),yield this.commonDbService.deleteData({feature:"heartbeatByDocument",properties:{id:a,documentId:e.documentId,organizationId:e.organizationId,skipFirestore:!0}})}return Promise.resolve()}catch(t){return this.loggingService.catch("Error in HeartbeatService removeDocumentHeartbeat: ",t),Promise.resolve()}})}getHeartbeat(e){try{return(e?.userId?u(e.userId):this.authService.getUser$().pipe(m(r=>r?.userId))).pipe(H(r=>r?this.docService.getDocumentPaths$().pipe(H(a=>a?this.getHeartbeatData({userId:r,documentId:a.documentId,organizationId:a.organizationId}):u(null))):u(null)),m(r=>({data:r})),S(P))}catch(t){return this.loggingService.catch("Error in HeartbeatService getHeartbeat: ",t),u({data:null})}}enableHeartbeat(){try{if(this.heartbeatEnabled$.value===!0)return;this.heartbeatEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in HeartbeatService enableHeartbeat: ",e)}}disableHeartbeat(){try{if(this.heartbeatEnabled$.value===!1)return;this.heartbeatEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in HeartbeatService disableHeartbeat: ",e)}}getHeartbeatEnabled$(){try{return this.heartbeatEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in HeartbeatService getHeartbeatEnabled$: ",e),u(!1)}}getHeartbeatEnabled(){try{return this.heartbeatEnabled$.value}catch(e){return this.loggingService.catch("Error in HeartbeatService getHeartbeatEnabled: ",e),!1}}ngOnDestroy(){try{this.teardownHeartbeat()}catch(e){this.loggingService.catch("Error in HeartbeatService ngOnDestroy: ",e)}}};p.\u0275fac=function(t){return new(t||p)(b(K),b(Q),b(R),b(_),b(N),b(W),b(Y),b(x),b(L),b(M))},p.\u0275prov=j({token:p,factory:p.\u0275fac,providedIn:"root"});let T=p;return T})();export{he as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as x,c as R,d as f,e as F,f as k}from"./chunk-XXU7YXMF.js";import{c as N}from"./chunk-KKKGHIG4.js";import{He as I,Ie as C,Ti as L,Ui as O,Yd as u,_d as y,ba as v,bf as S,ea as d,ee as A,g,ji as E,rg as w,uj as D,vj as P,xj as j}from"./chunk-SYWOQU23.js";var z=l=>{try{let n={USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmouseenter","onmouseleave","onmousemove","onmousedown","onmouseup","onwheel","onscroll","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","onsubmit","on*"],FORBID_TAGS:["script","style","iframe","object","embed","form"]};return P.sanitize(l,n)}catch(n){return u.catch("Error in File utils sanitizeSvg: ",n),""}},U=l=>{try{return l.name.split(".").slice(0,-1).join(".")}catch(n){u.catch("Error in File utils getFileName: ",n);return}},T=l=>{try{return/(?:\.([^.]+))?$/.exec(l?.name)[1]}catch(n){u.catch("Error in File utils getFileExtension: ",n);return}},M=(l,n)=>{try{let h=l.slice(0,-1,l.type);return new File([h],n+"."+T(l),{type:l.type})}catch(h){u.catch("Error in File utils updateFile: ",h);return}};var b={mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",webm:"video/webm",mkv:"video/x-matroska",m4v:"video/x-m4v",m4a:"audio/x-m4a",aac:"audio/aac","3gp":"video/3gpp","3g2":"video/3gpp2",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",zip:"application/zip",rar:"application/x-rar-compressed",txt:"text/plain",rtf:"application/rtf",html:"text/html",htm:"text/html",csv:"text/csv",ics:"text/calendar",vcf:"text/x-vcard",js:"application/javascript",css:"text/css",json:"application/json",xml:"application/xml",swf:"application/x-shockwave-flash"};var _=(()=>{let n=class n{getStorageInstance(t){return t?f(void 0,t):f()}ref(t,e){return F(t,e)}uploadBytesResumable(t,e,o){return k(t,e,o)}getDownloadURL(t){return R(t)}deleteObject(t){return x(t)}};n.\u0275fac=function(e){return new(e||n)},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();var ae=(()=>{let n=class n{constructor(t,e,o,a,c,s){this.authService=t,this.configService=e,this.coreActionsService=o,this.loggingService=a,this.attachmentResolverService=c,this.storageAdapter=s,this.storage=this.storageAdapter.getStorageInstance();try{this.configService.getApiKey$().subscribe(r=>{this.apiKey=r}),this.authService.getFirebaseConfig$().subscribe(r=>{if(r&&r.firebaseOptions?.storageBucket){this.storage=this.storageAdapter.getStorageInstance(r?.firebaseOptions?.storageBucket);let i=this.configService.getProxyConfig();i?.storageHost&&(this.storage.host=i.storageHost)}},r=>{this.loggingService.catch("Error in StorageService constructor: ",r)})}catch(r){this.loggingService.catch("Error in StorageService constructor:",r)}}createAttachment({path:t,file:e}){try{let o=new C;o.name=e.name;let a=M(e,`${o.attachmentId}_${U(e)}`),c=`${this.apiKey}/${t}/${a?.name}`;return o.bucketPath=c,o.size=e.size,o.type=T(e),o?.type&&(o.mimeType=b[o?.type]),o}catch(o){return this.loggingService.catch("Error in StorageService createAttachment: ",o),null}}sanitizeSvgFile(t){return g(this,null,function*(){if(t.type===b.svg)try{let e=yield t.text(),o=z(e);return new File([o],t.name,{type:t.type})}catch(e){return this.loggingService.catch("Error in StorageService sanitizeSvgFile: ",e),t}return t})}uploadAttachmentToStorage(c){return g(this,arguments,function*({attachment:t,file:e,resolve:o,reject:a}){try{let s=this.storageAdapter.ref(this.storage,t.bucketPath),r=this.storageAdapter.uploadBytesResumable(s,e,{cacheControl:"public,max-age=3600"});r.on("state_changed",i=>{let m=i.bytesTransferred/i.totalBytes*100},i=>{a(i)},()=>{this.storageAdapter.getDownloadURL(r.snapshot.ref).then(i=>{t.url=i,o(t)})})}catch(s){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",s),a(s)}})}uploadToResolver(r){return g(this,arguments,function*({file:t,attachment:e,metadata:o,resolve:a,reject:c,scope:s}){try{o.attachmentId=e.attachmentId;let i={attachmentId:e.attachmentId,name:e.name,file:t,metadata:o,mimeType:e.mimeType},m=w();this.coreActionsService.triggerAction(A.ATTACHMENT_RESOLVER,{event:E.Events.Resolver.ATTACHMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:m,methodName:S.UPLOAD_TO_RESOLVER,source:"internal",payload:{attachment:i,eventType:y.ATTACHMENT_ADD}});let p=yield this.attachmentResolverService.saveAttachment({attachment:i,eventType:y.ATTACHMENT_ADD},m,s);p&&p.data?.url?(e.url=p.data?.url,a(e)):c(new Error("Failed to upload attachment to resolver"))}catch(i){this.loggingService.catch("Error in StorageService uploadToResolver: ",i),c(i)}})}uploadFile({path:t,file:e,useAttachmentResolver:o,metadata:a,attachmentScope:c}){return new Promise((s,r)=>g(this,null,function*(){try{if(!this.apiKey)throw new Error("API key not configured");let i=yield this.sanitizeSvgFile(e),m=this.createAttachment({path:t,file:i});if(!m)throw new Error("Attachment not created");o?this.uploadToResolver({file:i,attachment:m,metadata:a,resolve:s,reject:r,scope:c}):this.uploadAttachmentToStorage({attachment:m,file:i,resolve:s,reject:r})}catch(i){this.loggingService.catch("Error in StorageService uploadFile:",i),r(i)}}))}uploadChunk(t,e,o,a){return new Promise((c,s)=>{try{if(a?.useAttachmentResolver){let r=this.createAttachment({path:t,file:e});if(!r){s(new Error("Attachment not created for chunk upload"));return}this.uploadToResolver({file:e,attachment:r,metadata:a.metadata,resolve:i=>c(i.url),reject:s,scope:a.attachmentScope});return}if(this.apiKey){let r=`${this.apiKey}/${t}/${e.name}`,i=this.storageAdapter.ref(this.storage,r),m=this.storageAdapter.uploadBytesResumable(i,e,{cacheControl:"public,max-age=3600"});m.on("state_changed",p=>{let H=p.bytesTransferred/p.totalBytes*100},p=>{s(p)},()=>{this.storageAdapter.getDownloadURL(m.snapshot.ref).then(p=>{c(p)}).catch(p=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${o}:`,p),s(p)})})}else{let r=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",r),s(r)}}catch(r){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${o}: `,r),s(r)}})}downloadAttachment(t){try{if(t.url){let e=new XMLHttpRequest;e.responseType="blob",e.onload=()=>{let o=e.response,a=document.createElement("a"),c=window.URL.createObjectURL(o);a.setAttribute("type","hidden"),a.setAttribute(I.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=c,t?.name&&(a.download=t?.name),document.body.appendChild(a);let s=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(s),window.URL.revokeObjectURL(c),a.remove()},e.onerror=()=>{window.open(t.url,"_blank")},e.open("GET",t.url),e.send()}}catch(e){this.loggingService.catch("Error in StorageService downloadAttachment: ",e)}}deleteAttachment({attachment:t,metadata:e,useAttachmentResolver:o,attachmentScope:a}){return new Promise((c,s)=>{if(o){let r=w();this.coreActionsService.triggerAction(A.ATTACHMENT_RESOLVER,{event:E.Events.Resolver.ATTACHMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:r,methodName:S.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:t.attachmentId,metadata:e}}),this.attachmentResolverService.deleteAttachment({attachmentId:t.attachmentId,metadata:e},r,a).then(()=>{c(null)}).catch(i=>{s(i)})}else{let r=this.storageAdapter.ref(this.storage,t.bucketPath);this.storageAdapter.deleteObject(r).then(()=>{c(null)}).catch(i=>{c(null)})}})}deleteFileFromPath(t){return new Promise((e,o)=>{let a=this.storageAdapter.ref(this.storage,t);this.storageAdapter.deleteObject(a).then(()=>{e(null)}).catch(c=>{o(c)})})}};n.\u0275fac=function(e){return new(e||n)(d(j),d(O),d(D),d(L),d(N),d(_))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();export{ae as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{W as B,X as F,da as k,ea as z,ga as Z}from"./chunk-SZUD6M7J.js";import{Bb as s,Ha as c,Kb as j,Ra as g,Ti as b,Wa as W,_a as T,a as x,ab as p,ac as H,ba as I,dc as w,ea as D,ec as R,fb as C,hc as L,l as _,nb as v,ob as y,pb as M,qb as S,sa as E,ub as h,v as O,vb as u,ya as P}from"./chunk-SYWOQU23.js";var A=(()=>{let a=class a{constructor(e){this.loggingService=e,this.wireframeMap=new _(new Map);try{this.loggingService.log("%c[WB] Creating CLASS: WireframeService","color: blue;")}catch(t){this.loggingService.catch("Error in WireframeService constructor: ",t)}}setWireframe(e,t){try{let r=this.wireframeMap.value,o=r.get(e),i=t.children.length>0||t.innerHTML?.trim()?.length>0,d=o&&(o.children.length>0||o.innerHTML?.trim()?.length>0);(!o||i&&!d)&&(r.set(e,t),this.wireframeMap.next(r))}catch(r){this.loggingService.catch("Error in WireframeService setWireframe: ",r)}}setWireframeMap(e){try{let t=this.wireframeMap.value;e.forEach((r,o)=>{let i=t.get(o),d=r.children.length>0||r.innerHTML?.trim()?.length>0,f=i&&(i.children.length>0||i.innerHTML?.trim()?.length>0);(!i||d&&!f)&&t.set(o,r)}),this.wireframeMap.next(t)}catch(t){this.loggingService.catch("Error in WireframeService setWireframeMap: ",t)}}getWireframe(e,t=!0){try{let r=this.wireframeMap.value,o=r.get(e);if(!o&&t){let i=e?.split("---")[0];i&&(o=r.get(i))}return o&&(o?.children?.length>0||o?.innerHTML?.trim()?.length>0)?o:void 0}catch(r){this.loggingService.catch("Error in WireframeService getWireframe: ",r);return}}getConditionElement(e,t=!0){try{let r=this.wireframeMap.value,o=r.get(e);if(!o&&t){let i=e?.split("---")[0];i&&(o=r.get(i))}return o}catch(r){this.loggingService.catch("Error in WireframeService getConditionElement: ",r);return}}getWireframe$(e,t=!0){return this.wireframeMap.asObservable().pipe(O(r=>this.getWireframe(e,t)))}setChildren(e){try{this.wireframeMap.next(e)}catch(t){this.loggingService.catch("Error in WireframeService setChildren: ",t)}}getWireframeMap(){return this.wireframeMap.value}};a.\u0275fac=function(t){return new(t||a)(D(b))},a.\u0275prov=I({token:a,factory:a.\u0275fac,providedIn:"root"});let n=a;return n})();var N=n=>({componentConfigSignal:n}),U=(n,a)=>({condition:n,data:a}),q=(n,a,l,e,t)=>({template:n,context:a,componentName:"velt-confirm-dialog-wireframe",variant:l,setIfCondition:e,componentElementRef:t});function J(n,a){if(n&1&&(h(0),S(1,"app-confirm-dialog-title",5)(2,"app-confirm-dialog-message",5)(3,"app-confirm-dialog-preview",5),y(4,"div",6),S(5,"app-confirm-dialog-reject",5)(6,"app-confirm-dialog-approve",5),M(),u()),n&2){let l=s(3);c(),v("componentConfigSignal",l.componentConfigSignal),c(),v("componentConfigSignal",l.componentConfigSignal),c(),v("componentConfigSignal",l.componentConfigSignal),c(2),v("componentConfigSignal",l.componentConfigSignal),c(),v("componentConfigSignal",l.componentConfigSignal)}}function K(n,a){if(n&1&&(h(0),p(1,J,7,5,"ng-container",4),u()),n&2){let l=s().ngIf,e=s();c(),v("veltDynamicTemplate",L(3,q,e.template,w(1,N,e.componentConfigSignal),l==null?null:l.variant,e.setIfCondition.bind(e),e.elementRef))}}function Q(n,a){if(n&1&&(h(0),p(1,K,2,9,"ng-container",3),u()),n&2){let l=s();c(),v("veltIf",R(3,U,l.conditionSignal(),w(1,N,l.componentConfigSignal)))}}var pe=(()=>{let a=class a extends Z{constructor(e,t,r,o,i,d,f){super(i,o,void 0,void 0,void 0,f,e),this.loggingService=e,this.dialogRef=t,this.wireframeService=r,this.themeService=o,this.elementRef=i,this.dynamicDataService=f,this.subscriptions=[],this.componentConfigSignal=E({title:"",message:"",yesButton:"",noButton:"",variant:"",type:"",closeDialog:this.closeDialog.bind(this)}),this.componentId="velt-confirm-dialog",this.veltElement=!0;try{d&&(this.componentConfigSignal.update(m=>(m=x(x({},m),d),m)),d?.darkMode&&[!0,!1].includes(d?.darkMode)&&super.setComponentDarkMode(d?.darkMode)),this.setZIndex()}catch(m){this.loggingService.catch("Error in ConfirmDialogComponent constructor: ",m)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-confirm-dialog-wireframe";super.ngOnInit(),this.componentConfigSignal()?.variant&&(e+=`---${this.componentConfigSignal()?.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}}))}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnInit: ",e)}}ngOnDestroy(){super.ngOnDestroy();try{this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnDestroy: ",e)}}setZIndex(){try{if(this.dialogRef){let e=this.dialogRef._overlayRef;e&&(e.backdropElement&&(e.backdropElement.style.zIndex="2147483647"),e.hostElement&&(e.hostElement.style.zIndex="2147483647"))}}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent setZIndex: ",e)}}closeDialog(e){try{this.dialogRef.close(e)}catch(t){this.loggingService.catch("Error in ConfirmDialogComponent closeDialog: ",t)}}get variantClass(){return X(this.componentConfigSignal()?.type)}};a.\u0275fac=function(t){return new(t||a)(g(b),g(B),g(A),g(z),g(P),g(F,8),g(k))},a.\u0275cmp=W({type:a,selectors:[["snippyly-confirm-dialog"]],hostVars:1,hostBindings:function(t,r){t&2&&C("data-velt-element",r.veltElement)},standalone:!1,features:[H([k]),T],decls:3,vars:6,consts:[["floatingConfirmationRef",""],[1,"velt-confirm-dialog",3,"ngClass","snippylyOverlay","snippylyOverlayZIndex","snippylyOverlayBackdropZIndex"],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],["mat-dialog-actions","",1,"velt-confirm-dialog-actions"]],template:function(t,r){if(t&1&&(y(0,"div",1,0),p(2,Q,2,6,"ng-container",2),M()),t&2){let o=j(1);v("ngClass",r.variantClass)("snippylyOverlay",o)("snippylyOverlayZIndex",1200)("snippylyOverlayBackdropZIndex",1100),C("data-testid",r.componentId),c(2),v("ngIf",r.componentConfigSignal())}},styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%] *[_ngcontent-%COMP%]{outline:0}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-confirm-dialog[_ngcontent-%COMP%]{width:455px;padding:40px;display:block;box-sizing:border-box;background-color:var(--velt-background-0)}.velt-confirm-dialog-actions[_ngcontent-%COMP%]{justify-content:space-between;gap:var(--velt-spacing-md);min-height:auto} .velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface:has(snippyly-confirm-dialog){border-radius:var(--velt-border-radius-xl);padding:0}@media(max-width:768px){.velt-confirm-dialog[_ngcontent-%COMP%]{width:auto;max-width:455px;padding:24px}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-actions[_ngcontent-%COMP%]{flex-direction:column}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--approve, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--reject{min-height:44px}}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-title, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-message, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-preview{padding-left:0;padding-right:0;text-align:left}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-title{font-size:var(--velt-font-size-xl);line-height:1.3;padding-top:0;padding-bottom:0;margin-bottom:var(--velt-spacing-sm)}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-message{margin:0 0 var(--velt-spacing-lg);padding-top:0;padding-bottom:0;color:var(--velt-text-1)}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-preview{margin-bottom:var(--velt-spacing-lg)}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-actions[_ngcontent-%COMP%]{gap:var(--velt-spacing-md);margin:0;padding:0}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--approve, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--reject{border-radius:999px;min-height:48px;font-size:var(--velt-font-size-md);font-weight:600}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--approve:focus-visible, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--reject:focus-visible{outline:2px solid var(--velt-text-0);outline-offset:2px}"],changeDetection:0});let n=a;return n})();function X(n){return n?`velt-confirm-dialog--${n}`:""}export{A as a,pe as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as N}from"./chunk-2LJHR77K.js";import{e as K,t as W}from"./chunk-KKKGHIG4.js";import{E as P,G as x,He as m,J as C,K as f,Kg as T,Oa as j,Pg as k,Ti as g,ba as v,db as X,ea as a,jj as G,l as p,mj as B,na as M,r as A,rg as $,uh as V,vh as L,w as D,wh as H,wj as J,xh as z,xj as b,yh as R,z as y,zh as F}from"./chunk-SYWOQU23.js";var h=(function(l){return l.CLICK="click",l.HOVER="hover",l.SCROLL="scroll",l.NAVIGATE="navigate",l})(h||{}),u=class{constructor(){this.type=h.HOVER,this.data=null,this.pageInfo=k(),this.timestamp=Date.now()}},U=class{constructor(n,w){this.targetXpath=n,this.xpath=w}};var E=class{constructor(){this.sessionId=null,this.isLeader=!1,this.lastProcessedActionTimestamp=null}};var S=class{constructor(n){this.snippylyId=n,this.joinTimestamp=Date.now()}};var I=class{constructor(n,w,e){this.followers=[],this.actionStack=[],this.id=$(),this.leaderId=n,this.leaderName=w,this.followers.push(new S(e))}};var Q=(()=>{let n=class n{constructor(e,t,r,i,o,s){this.databaseService=e,this.docService=t,this.loggingService=r,this.authService=i,this.commonDbService=o,this.realtimeAdapter=s,this.currentUser$=new p(null),this.currentSession$=new p(null);try{this.databaseService.getDb().pipe(P(c=>!!c),f(1)).subscribe(c=>{c&&(this.db=c)},c=>{this.loggingService.catch("Error in FlockSessionService getDb subscription: ",c)}),this.authService.getUser$().subscribe(c=>{c&&c.userSnippylyId&&(this.user=c)})}catch(c){this.loggingService.catch("Error in FlockSessionService constructor: ",c)}}startCurrentFlockUserSubscription(e){try{this.currentUserSub?.unsubscribe(),e&&e.userSnippylyId&&(this.user=e,this.subscribeToCurrentFlockUser(e?.userSnippylyId))}catch(t){this.loggingService.catch("Error in FlockSessionService startCurrentFlockUserSubscription: ",t)}}stopCurrentFlockUserSubscription(){try{this.currentUserSub?.unsubscribe()}catch(e){this.loggingService.catch("Error in FlockSessionService stopCurrentFlockUserSubscription: ",e)}}provisionFlockSession(e,t,r){try{let i=this.docService.getDocumentPaths();i&&this.db&&this.commonDbService.dbListener({feature:"flockUser",properties:{documentId:i?.documentId,organizationId:i?.organizationId,id:e,skipFirestore:!0}}).pipe(f(1)).subscribe(o=>{o?.data&&o?.data?.sessionId?this.subscribeToCurrentSession(o?.data?.sessionId,r):this.createFlockSession(e,t,r)})}catch(i){this.loggingService.catch("Error in FlockSessionService provisionFlockSession: ",i)}return null}swapLeader(e,t,r){try{if(this.updateRemoteFlockUser(e,{isLeader:!1}),this.updateRemoteFlockUser(t,{isLeader:!0}),this.currentSession){this.currentSession.leaderId=t,this.currentSession.leaderName=r,this.currentSession.followers.push(new S(e));let i=this.currentSession.followers.findIndex(o=>o.snippylyId===t);i>-1&&this.currentSession.followers.splice(i,1),this.updateSession(this.currentSession.id,this.currentSession)}}catch(i){this.loggingService.catch("Error in FlockSessionService swapLeader: ",i)}}createFlockSession(e,t,r){try{let i=new I(e,t,r);return this.updateRemoteFlockUser(e,{snippylyId:e,sessionId:i.id,isLeader:!0}),this.updateSession(i.id,i),this.subscribeToCurrentSession(i.id),i.id}catch(i){this.loggingService.catch("Error in FlockSessionService createFlockSession: ",i)}return null}removeFollowerFromCurrentSession(e){try{if(this.currentSession){this.updateRemoteFlockUser(e,{sessionId:null,lastProcessedActionTimestamp:null});let t=this.currentSession.followers.findIndex(r=>r.snippylyId===e);if(t>-1){if(this.currentSession.followers.splice(t,1),this.currentSession.followers.length===0){this.deleteSession(this.currentSession.id);return}this.updateSession(this.currentSession.id,this.currentSession),this.user&&this.user.userSnippylyId&&this.user.userSnippylyId===e&&(this.sessionSub?.unsubscribe(),this.currentSession=void 0,this.currentSession$?.next(null))}}}catch(t){this.loggingService.catch("Error in FlockSessionService removeFollowerFromSession: ",t)}}updateRemoteFlockUser(e,t={}){try{if(!e)return;let r=this.docService.getDocumentPaths();for(let i in t)t.hasOwnProperty(i)&&t[i]===void 0&&delete t[i];r&&this.db&&this.commonDbService.updateData({feature:"flockUser",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:e,skipFirestore:!0},data:JSON.parse(JSON.stringify(t))})}catch(r){this.loggingService.catch("Error in FlockSessionService updateRemoteFlockUser: ",r)}}subscribeToCurrentSession(e,t=void 0){try{let r=this.docService.getDocumentPaths();r&&this.db&&(this.sessionSub&&this.sessionSub.unsubscribe(),this.sessionSub=this.commonDbService.dbListener({feature:"flockSession",properties:{documentId:r?.documentId,organizationId:r?.organizationId,id:e,skipFirestore:!0}}).subscribe(i=>{i?.data&&typeof i?.data=="object"&&Object.keys(i?.data)?.length>0?(this.currentSession=i?.data,t!==void 0&&this.currentSession?.followers.findIndex(o=>o.snippylyId===t)===-1&&(this.currentSession.followers.push(new S(t)),this.updateSession(this.currentSession.id,this.currentSession)),this.currentSession$.next(this.currentSession??null)):(this.currentSession=void 0,this.currentSession$.next(null))}))}catch(r){this.loggingService.catch("Error in FlockSessionService subscribeToCurrentSession: ",r)}}subscribeToCurrentFlockUser(e){try{let t=this.docService.getDocumentPaths();t&&this.db&&(this.currentUserSub&&this.currentUserSub.unsubscribe(),this.currentUserSub=this.commonDbService.dbListener({feature:"flockUser",properties:{documentId:t?.documentId,organizationId:t?.organizationId,id:e,skipFirestore:!0}}).pipe(x(r=>(this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser: ",r),A(null)))).subscribe(r=>{r?.data&&typeof r?.data=="object"&&Object.keys(r?.data)?.length>0&&(this.currentUser$.next(r?.data),r?.data?.sessionId&&this.subscribeToCurrentSession(r?.data?.sessionId))},r=>{this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser subscription: ",r)}))}catch(t){this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser: ",t)}}updateSession(e,t={}){try{if(!e)return;let r=this.docService.getDocumentPaths();for(let i in t)t.hasOwnProperty(i)&&t[i]===void 0&&delete t[i];r&&this.db&&this.commonDbService.updateData({feature:"flockSession",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:e,skipFirestore:!0},data:JSON.parse(JSON.stringify(t))})}catch(r){this.loggingService.catch("Error in FlockSessionService updateSession: ",r)}}deleteSession(e){try{let t=this.docService.getDocumentPaths();t&&this.db&&(this.commonDbService.deleteData({feature:"flockSession",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:e,skipFirestore:!0}}),this.currentSession&&e===this.currentSession.id&&(this.updateRemoteFlockUser(this.currentSession.leaderId,{sessionId:null,isLeader:!1,lastProcessedActionTimestamp:null}),this.currentSession.followers.forEach(r=>{this.updateRemoteFlockUser(r.snippylyId,{sessionId:null,lastProcessedActionTimestamp:null})}),this.currentSession=void 0,this.currentSession$.next(null),this.sessionSub?.unsubscribe()))}catch(t){this.loggingService.catch("Error in FlockSessionService deleteSession: ",t)}}addActionToStack(e,t){try{t=t&&JSON.parse(JSON.stringify(t));let r=this.docService.getDocumentPaths();if(r&&this.db&&e){let i=this.realtimeAdapter.rtdbRef(this.db,`${r.flock}/sessions/${e}/actionStack`);this.realtimeAdapter.rtdbRunTransaction("flockSession",i,o=>o?(o.unshift(t),o.slice(0,5)):[t]),t.type===h.NAVIGATE&&this.updateSession(e,{pageInfo:t.pageInfo})}}catch(r){this.loggingService.catch("Error in FlockSessionService addActionToStack: ",r)}}};n.\u0275fac=function(t){return new(t||n)(a(G),a(K),a(g),a(b),a(W),a(B))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();var Z=(()=>{let n=class n{constructor(e,t,r,i){this.componentFactoryResolver=e,this.applicationRef=t,this.injector=r,this.loggingService=i,this.darkMode=!1}createFollowOverlay(e,t){try{let i=this.componentFactoryResolver.resolveComponentFactory(N).create(this.injector);i.instance.setLeaderName(e),i.instance.closeOverlayEvent.pipe(f(1)).subscribe(()=>{this.removeOverlay(),t()}),this.applicationRef.attachView(i.hostView),this.overlayRef=i,this.overlayRef.instance.darkMode=this.darkMode;let o=this.overlayRef.location.nativeElement;o.id="snippyly-follow-overlay",o.setAttribute(m.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(o)}catch(r){this.loggingService.catch("Error in FlockOverlayService createFollowOverlay: ",r)}}createLeaderOverlay(e){let r=this.componentFactoryResolver.resolveComponentFactory(N).create(this.injector);r.instance.setType("leading"),r.instance.closeOverlayEvent.pipe(f(1)).subscribe(()=>{this.removeOverlay(),e()}),this.applicationRef.attachView(r.hostView),this.overlayRef=r,this.overlayRef.instance.darkMode=this.darkMode;let i=this.overlayRef.location.nativeElement;i.id="snippyly-follow-overlay",i.setAttribute(m.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(i)}changeLeaderName(e){this.overlayRef&&this.overlayRef.instance.setLeaderName(e)}getLeaderName(){return this.overlayRef?this.overlayRef.instance.getLeaderName():null}removeOverlay(){if(this.overlayRef){let e=this.overlayRef.location.nativeElement;this.applicationRef.detachView(this.overlayRef.hostView),this.overlayRef.destroy(),e.shadowRoot&&e.shadowRoot.removeChild(e.shadowRoot.childNodes[0]),e.remove(),this.overlayRef=void 0}}setDarkMode(e){try{this.darkMode=e,this.overlayRef&&(this.overlayRef.instance.darkMode=e)}catch(t){this.loggingService.catch("Error in FlockOverlayService setDarkMode: ",t)}}};n.\u0275fac=function(t){return new(t||n)(a(j),a(X),a(M),a(g))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();var Ce=(()=>{let n=class n{constructor(e,t,r,i,o){this.authService=e,this.domService=t,this.loggingService=r,this.flockSessionService=i,this.flockOverlayService=o,this.flockLeader$=new p({userId:"",name:""}),this.flockMode$=new p(!1),this.currentFlockUser=null,this.localScrollData=[],this.domSubscriptions=[],this.followOverlayCreated=!1,this.leaderOverlayCreated=!1,this.windowFocused=!0,this.tabFocused=!0,this.useHistoryAPI=!0,this.disableDefaultNavigation=!1;try{this.flockLeader$.subscribe(s=>{let{userId:c,name:d}=s,O=c;if(this.provisionFollowUser(),O&&this.currentFlockUser&&this.currentFlockUser.snippylyId)if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,O,d);return}this.removeCurrentUserFromSession()}else this.flockSessionService.provisionFlockSession(O,d,this.currentFlockUser.snippylyId)},s=>{this.loggingService.catch("Error in FlockService flockLeader$ subscription: ",s)}),this.flockSessionService.currentSession$.subscribe(s=>{if(s!==null){if(this.currentFlockUser&&(this.currentFlockUser.sessionId===null||this.currentFlockUser.sessionId===void 0)&&this.currentFlockUser.snippylyId&&(this.currentFlockUser.sessionId=s.id,this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,this.currentFlockUser)),this.currentFlockUser&&!this.currentFlockUser.isLeader&&!this.followOverlayCreated&&(this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.followOverlayCreated=!0,this.flockOverlayService.createFollowOverlay(s.leaderName,()=>{this.removeCurrentUserFromSession(),this.followOverlayCreated=!1})),this.currentFlockUser&&this.currentFlockUser.isLeader&&!this.leaderOverlayCreated&&(this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1),this.leaderOverlayCreated=!0,this.flockOverlayService.createLeaderOverlay(()=>{this.removeCurrentUserFromSession(),this.leaderOverlayCreated=!1})),this.currentFlockUser&&!this.currentFlockUser.isLeader&&s.actionStack){let c=s.actionStack[0];c&&this.currentFlockUser.lastProcessedActionTimestamp!==c.timestamp&&this.processAction(c)}if(this.currentFlockUser&&!this.currentFlockUser.isLeader&&this.followOverlayCreated&&this.flockOverlayService.getLeaderName()!==null&&s.leaderName!==this.flockOverlayService.getLeaderName()&&this.flockOverlayService.changeLeaderName(s.leaderName),this.currentFlockUser&&this.currentFlockUser.isLeader){let c=k();if(s.pageInfo){if(c&&c.url!==s.pageInfo.url){let d=new u;d.type=h.NAVIGATE,this.flockSessionService.addActionToStack(s.id,d)}}else{this.flockSessionService.updateSession(s.id,{pageInfo:c});let d=new u;d.type=h.NAVIGATE,this.flockSessionService.addActionToStack(s.id,d)}}}else this.currentFlockUser&&this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.currentFlockUser&&this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1)}),this.flockSessionService.currentUser$.subscribe(s=>{if(s!==null&&(this.currentFlockUser&&this.currentFlockUser.isLeader!==s.isLeader&&(this.domSubscriptions.forEach(c=>c.unsubscribe()),this.domSubscriptions=[]),this.currentFlockUser=s,s.sessionId&&this.domSubscriptions.length===0))if(s.isLeader){if(!this.tabFocused||!this.windowFocused)return;this.subscribeToLeaderDOMEvents()}else this.subscribeToFollowerDOMEvents()}),D([this.authService.getUser$(),this.getFlockMode$()]).subscribe(([s,c])=>{s&&s.userSnippylyId&&c?this.flockSessionService.startCurrentFlockUserSubscription(s):this.flockSessionService.stopCurrentFlockUserSubscription()})}catch(s){this.loggingService.catch("Error in FlockService constructor: ",s)}}provisionFollowUser(){try{if(this.currentFlockUser===null){let e=this.authService.getUser();e&&e.userSnippylyId&&(this.currentFlockUser=new E,this.currentFlockUser.snippylyId=e.userSnippylyId)}}catch(e){this.loggingService.catch("Error in FlockService provisionFollowUser: ",e)}}startFollowingUser(e,t){try{if(this.provisionFollowUser(),e&&this.currentFlockUser&&this.currentFlockUser.snippylyId){if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,e,t);return}this.removeCurrentUserFromSession()}this.flockSessionService.provisionFlockSession(e,t,this.currentFlockUser.snippylyId)}}catch(r){this.loggingService.catch("Error in FlockService startFollowingUser: ",r)}}stopFollowingUser(){try{this.removeCurrentUserFromSession()}catch(e){this.loggingService.catch("Error in FlockService stopFollowingUser: ",e)}}subscribeToUrlChanges(){try{if(this.useHistoryAPI){let e=window.history.pushState,t=window.history.replaceState;window.history.pushState=(...r)=>{e.apply(window.history,r),this.onUrlChange()},window.history.replaceState=(...r)=>{t.apply(window.history,r),this.onUrlChange()},this.domSubscriptions.push({unsubscribe:()=>{window.history.pushState=e,window.history.replaceState=t}}),this.domSubscriptions.push(y(window,"popstate").subscribe(()=>{this.onUrlChange()}))}}catch(e){this.loggingService.catch("Error in FlockService subscribeToUrlChanges: ",e)}}onUrlChange(){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader){let e=new u;e.type=h.NAVIGATE,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,e)}}catch(e){this.loggingService.catch("Error in FlockService onUrlChange: ",e)}}processAction(e){try{switch(e.type){case h.CLICK:this.clickUserElement(e.data);break;case h.HOVER:this.scrollToHoveredElement(e.data);break;case h.SCROLL:this.scrollToFollowedUser(e.data);break;case h.NAVIGATE:this.checkMatchingUrl(e.pageInfo);break}this.currentFlockUser&&this.currentFlockUser.snippylyId&&this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,{lastProcessedActionTimestamp:e.timestamp})}catch(t){this.loggingService.catch("Error in FlockService processAction: ",t)}}subscribeToLeaderDOMEvents(){try{this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[]),this.domSubscriptions.push(y(window,"mouseover").pipe(C(500)).subscribe(e=>{let t=e?.target;if(t){let r=window.getComputedStyle(t);if(r.position==="fixed"||r.position==="sticky"||t.hasAttribute(m.ATTRIBUTES.VELT_IGNORE))return;t=L(t,{x:e.clientX,y:e.clientY}),this.updateHoveredElement(t)}})),this.domSubscriptions.push(this.domService.onWindowClick$().subscribe(e=>{let t=e?.target;if(t){if(t.hasAttribute(m.ATTRIBUTES.VELT_IGNORE))return;this.updateClickedElement(t)}})),this.subscribeToUrlChanges(),this.subscribeToScrollables()}catch(e){this.loggingService.catch("Error in FlockService subscribeToLeaderDOMEvents: ",e)}}subscribeToFollowerDOMEvents(){}updateClickedElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=this.domService.getXPath(e),r=T(e),i=this.domService.getXPath(r),o={id:Math.random().toString(36).substring(2),xpath:t,parentXpath:i},s=new u;s.type=h.CLICK,s.data=o,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,s)}}catch(t){this.loggingService.catch("Error in FlockService updateClickedElement: ",t)}}updateHoveredElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=this.domService.getXPath(e),r=T(e),i=this.domService.getXPath(r),o={id:Math.random().toString(36).substring(2),xpath:t,parentXpath:i},s=new u;s.type=h.HOVER,s.data=o,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,s)}}catch(t){this.loggingService.catch("Error in FlockService updateHoveredElement: ",t)}}subscribeToScrollables(){try{let e=V();e.push(document),e?.forEach(t=>{this.domSubscriptions.push(y(t,"scroll").pipe(C(100)).subscribe(r=>{this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader&&this.updateScrollPositionOfElement(t)}))})}catch(e){this.loggingService.catch("Error in FlockService getScrollableElements: ",e)}}updateScrollPositionOfElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=new U("","");if(e===document){let o=z();if(o){let s=L(o);s&&(t.targetXpath=this.domService.getXPath(s))}t.xpath=""}else{let o=H(e);t.targetXpath=this.domService.getXPath(o),t.xpath=this.domService.getXPath(e)}let r=!1,i=!1;if(this.localScrollData.forEach((o,s)=>{o.xpath===o.xpath&&(t.targetXpath!==o.targetXpath&&(r=!0),this.localScrollData[s]=Object.assign(o,t),i=!0)}),i||this.localScrollData.push(t),r||!i){let o=new u;o.type=h.SCROLL,o.data=t,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,o)}}}catch(t){this.loggingService.catch("Error in FlockService calculateScrollPositionOfAnElement: ",t)}}enableFlockMode(e){try{if(this.flockMode$.next(!0),e){let{useHistoryAPI:t,onNavigate:r,disableDefaultNavigation:i,darkMode:o}=e;t!==void 0&&(this.useHistoryAPI=t),r!==void 0&&typeof r=="function"&&(this.onNavigate=r),i!==void 0&&(this.disableDefaultNavigation=i),this.flockOverlayService.setDarkMode(o)}}catch(t){this.loggingService.catch("Error in FlockService enableFlockMode: ",t)}}disableFlockMode(){try{this.flockMode$.next(!1),this.onNavigateEmitter=void 0,this.useHistoryAPI=!0,this.onNavigate=void 0}catch(e){this.loggingService.catch("Error in FlockService disableFlockMode: ",e)}}setDisableFlockNavigation(e){try{this.disableDefaultNavigation=e}catch(t){this.loggingService.catch("Error in FlockService setDisableFlockNavigation: ",t)}}getFlockMode$(){return this.flockMode$.asObservable()}getFlockMode(){return this.flockMode$.value}setNavigateEmitter(e){try{this.onNavigateEmitter=e}catch(t){this.loggingService.catch("Error in FlockService setNavigateEmitter: ",t)}}setTabFocused(e){try{if(this.tabFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.tabFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.tabFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(t){this.loggingService.catch("Error in FlockService setTabFocused: ",t)}}setWindowFocused(e){try{if(this.windowFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.windowFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.windowFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(t){this.loggingService.catch("Error in FlockService setWindowFocused: ",t)}}setFlockLeader(e,t){try{this.flockLeader$.next({userId:e,name:t})}catch(r){this.loggingService.catch("Error in FlockService setFlockLeader: ",r)}}isInSession(){try{return!!(this.currentFlockUser&&this.currentFlockUser.sessionId)}catch(e){this.loggingService.catch("Error in FlockService isFollowing: ",e)}return!1}removeCurrentUserFromSession(){try{this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[],this.currentFlockUser&&(this.currentFlockUser.isLeader?this.currentFlockUser.sessionId&&this.flockSessionService.deleteSession(this.currentFlockUser.sessionId):this.currentFlockUser.snippylyId&&this.flockSessionService.removeFollowerFromCurrentSession(this.currentFlockUser.snippylyId))}catch(e){this.loggingService.catch("Error in FlockService removeCurrentUserFromSession: ",e)}}checkMatchingUrl(e){try{let r=k()?.url,i=e.url;if(r!==i&&i!==void 0){let{url:o,path:s,baseUrl:c}=e;if(this.onNavigate!==void 0&&typeof this.onNavigate=="function"){this.onNavigate({url:o,path:s,baseUrl:c});return}if(this.onNavigateEmitter&&this.onNavigateEmitter.emit({url:o,path:s,baseUrl:c}),this.disableDefaultNavigation)return;window.location.href=i}}catch(t){this.loggingService.catch("Error in FlockService checkMatchingUrl: ",t)}}scrollToFollowedUser(e){try{if(e.xpath===""){let t=this.domService.getElementFromXPath(e.targetXpath);t&&F(t)}else{let t=this.domService.getElementFromXPath(e.xpath),r=this.domService.getElementFromXPath(e.targetXpath);t&&r&&(F(t),R(t,r))}}catch(t){this.loggingService.catch("Error in FlockService scrollToFollowedUser: ",t)}}clickUserElement(e){try{let t=this.domService.getElementFromXPath(e.xpath);t&&this.lastClickedElement?.id!==e.id&&(t?.click(),this.lastClickedElement=e)}catch(t){this.loggingService.catch("Error in FlockService clickUserElement: ",t)}}scrollToHoveredElement(e){try{let t=this.domService.getElementFromXPath(e.xpath);if(t&&e.parentXpath)if(e.parentXpath==="/html")F(t);else{let r=this.domService.getElementFromXPath(e.parentXpath);r&&R(r,t,!0)}}catch(t){this.loggingService.catch("Error in FlockService clickUserElement: ",t)}}};n.\u0275fac=function(t){return new(t||n)(a(b),a(J),a(g),a(Q),a(Z))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();export{Ce as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as s,K as a,Ti as h,ba as c,ea as n,l as o}from"./chunk-SYWOQU23.js";var u=(()=>{let r=class r{constructor(t){this.loggingService=t,this.toasts$=new o([])}setToast(t){try{t.id||(t.id=Math.random()),this.toasts$.next([...this.toasts$.value,t]),t.duration&&t.duration>0&&s(t.duration).pipe(a(1)).subscribe(()=>{this.removeToast(t)},i=>{this.loggingService.catch("Error in ToastService setToast timer subscription: ",i)})}catch(i){this.loggingService.catch("Error in ToastService setToast: ",i)}}removeToast(t){try{this.toasts$.next(this.toasts$.value.filter(i=>i.id!==t.id))}catch(i){this.loggingService.catch("Error in ToastService removeToast: ",i)}}getToasts$(){return this.toasts$.asObservable()}};r.\u0275fac=function(i){return new(i||r)(n(h))},r.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"});let e=r;return e})();export{u as a};
|