@veltdev/sdk-staging 6.0.0-beta.11 → 6.0.0-beta.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/comment-events.data.model.d.ts +10 -0
- package/app/models/data/config.data.model.d.ts +121 -0
- package/app/utils/enums.d.ts +1 -0
- package/chunk-3H5W2TGU.js +1 -0
- package/chunk-55YE7G6I.js +13 -0
- package/{chunk-CP4KMRG3.js → chunk-5JIXRA34.js} +1 -1
- package/{chunk-ZHTTBUVQ.js → chunk-7MOQQG4Z.js} +1 -1
- package/{chunk-G3BNRB7R.js → chunk-AIQ4EOVH.js} +1 -1
- package/{chunk-SXJORH53.js → chunk-CZTTDJFW.js} +1 -1
- package/{chunk-NW4FJLNA.js → chunk-DUIGMOMV.js} +4 -4
- package/{chunk-S5GDEY2K.js → chunk-GHVMD37V.js} +1 -1
- package/{chunk-HUBK3P3B.js → chunk-GJ55RHPP.js} +1 -1
- package/{chunk-Y346MJJR.js → chunk-GNMKNWD5.js} +1 -1
- package/{chunk-WV6TZ6ZA.js → chunk-JDZOVFS3.js} +1 -1
- package/{chunk-IOU2B2OU.js → chunk-JPM7CIV3.js} +1 -1
- package/{chunk-N4JJS2HM.js → chunk-JXMMR7DC.js} +1 -1
- package/chunk-MLCIQM44.js +1 -0
- package/{chunk-A6I5J2N4.js → chunk-N2SSZ74J.js} +2 -2
- package/{chunk-D5PWD4RY.js → chunk-N3AV6IGG.js} +1 -1
- package/chunk-NFOSJ24G.js +167 -0
- package/{chunk-QHZMUGU5.js → chunk-OHH7LESC.js} +1 -1
- package/{chunk-CGYAGTFW.js → chunk-OWD3J56P.js} +1 -1
- package/{chunk-7JE6EGDW.js → chunk-P54MO3GU.js} +1 -1
- package/{chunk-YV7SDT6E.js → chunk-Q2QL77LS.js} +1 -1
- package/{chunk-WKIVFT2P.js → chunk-SAPJAJDB.js} +1 -1
- package/{chunk-ZMO3MMN3.js → chunk-SG6UCHMH.js} +1 -1
- package/{chunk-PB4ALOQE.js → chunk-SXYSM6QP.js} +1 -1
- package/{chunk-LCEYWVFK.js → chunk-T4D6QD4H.js} +1 -1
- package/{chunk-PRVNVPMV.js → chunk-TVX75U2C.js} +1 -1
- package/chunk-UF2D32ZI.js +1 -0
- package/{chunk-5IHISLEM.js → chunk-VMH5N5PO.js} +1 -1
- package/chunk-XM2SXO32.js +1 -0
- package/{chunk-XNMJJJRI.js → chunk-XM56PHBZ.js} +1 -1
- package/{chunk-7NW5DBIX.js → chunk-YEQZ76RF.js} +1 -1
- package/{chunk-RGP2XXJF.js → chunk-YFZUZKVN.js} +1 -1
- package/{chunk-X7LR472K.js → chunk-Z77RD4H5.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 +2 -2
- package/velt-comment.js +6 -6
- package/velt-crdt.js +1 -1
- package/velt-cursor.js +2 -2
- package/velt-huddle.js +3 -3
- package/velt-live-state-sync.js +2 -2
- package/velt-notification.js +1 -1
- package/velt-presence.js +1 -1
- package/velt-reaction.js +1 -1
- package/velt-recorder.js +1 -1
- package/velt-rewriter.js +2 -2
- 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 +264 -20
- package/chunk-2CQTKYCO.js +0 -13
- package/chunk-A5F7PTHM.js +0 -167
- package/chunk-CR55B3BL.js +0 -1
- package/chunk-EMJBJXH6.js +0 -1
- package/chunk-NGDGJUUI.js +0 -1
- package/chunk-SQUHH2JX.js +0 -1
package/chunk-2CQTKYCO.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{b as G}from"./chunk-SXJORH53.js";import{$ as O,C as w,Di as _,E as g,Ii as x,L as S,M as P,Pd as W,Qi as Q,Rd as y,Rf as D,Ri as Y,S as j,Sd as U,T as H,Ud as $,W as E,Wd as C,_d as A,ca as u,g as k,l as z,p as B,qi as M,r as h,ri as N,v as b,vi as R,w as F,wi as K,yh as L}from"./chunk-A5F7PTHM.js";var he=(()=>{let m=class m{constructor(e,t,r,s,o,c,n,i,d){this.authService=e,this.commonDbService=t,this.databaseService=r,this.docService=s,this.domService=o,this.loggingService=c,this.metadataService=n,this.commonDbUtils=i,this.configService=d,this.HEARTBEAT_DURATION=5*1e3,this.heartbeatEnabled$=new z(!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(a=>{a?this.setupHeartbeat():this.teardownHeartbeat()}),this.docService.addPreDocumentIdChangeFunction("heartbeat-service",a=>a?.documentId?this.removeDocumentHeartbeat(a):Promise.resolve())}catch(a){this.loggingService.catch("Error in HeartbeatService constructor: ",a)}}setupWebWorker(e){try{let t=`
|
|
2
|
-
let intervalId;
|
|
3
|
-
self.addEventListener('message', (event) => {
|
|
4
|
-
if (event.data === 'start') {
|
|
5
|
-
if (intervalId) clearInterval(intervalId);
|
|
6
|
-
intervalId = setInterval(() => {
|
|
7
|
-
self.postMessage('tick');
|
|
8
|
-
}, ${e});
|
|
9
|
-
} else if (event.data === 'stop') {
|
|
10
|
-
if (intervalId) clearInterval(intervalId);
|
|
11
|
-
}
|
|
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(s=>{s?(this.worker?.postMessage("start"),this.sendHeartbeat()):this.worker?.postMessage("stop")});this.subscriptions.push(r)}else{let r=this.authService.getUser$().pipe(H(s=>s?w(this.HEARTBEAT_DURATION).pipe(j(0)):B)).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=F([this.databaseService.getDb().pipe(g(r=>!!r)),this.authService.getUser$(),this.docService.getDocumentPaths$()]).pipe(P(),E(([[r,s,o],[c,n,i]])=>{if(n&&i){let d=this.domService.getTabId();if(d){let a=this.generateHeartbeatId(n.userId,d),p={id:a,organizationId:i.organizationId},I=this.commonDbUtils.getDocumentPath({feature:"heartbeat",properties:p,defaultDocumentPaths:i,apiKey:this.configService.getApiKey(),useFirestore:!1});if(I&&c&&U(C(c,I)).set(null),i.documentId){let l={id:a,documentId:i.documentId,organizationId:i.organizationId},v=this.commonDbUtils.getDocumentPath({feature:"heartbeatByDocument",properties:l,defaultDocumentPaths:i,apiKey:this.configService.getApiKey(),useFirestore:!1});v&&c&&U(C(c,v)).set(null)}if(o&&o.documentId&&o.documentId!==i.documentId){let l={id:a,documentId:o.documentId,organizationId:o.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 s=Date.now(),o=this.generateHeartbeatId(e.userId,r),c=this.docService.getBaseMetadata("heartbeat"),n=c.documentId,i=t.organizationId,d=`${o}_${i}`,a=n?`${o}_${i}_${n}`:null,p=this.heartbeatCreatedTimestamps.get(d)??s;this.heartbeatCreatedTimestamps.has(d)||this.heartbeatCreatedTimestamps.set(d,p);let I=!this.initializedHeartbeatIds.has(d),l={id:o,createdTimestamp:p,lastUpdatedTimestamp:s,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&&a){let v=this.heartbeatCreatedTimestamps.get(a)??s;this.heartbeatCreatedTimestamps.has(a)||this.heartbeatCreatedTimestamps.set(a,v);let J=!this.initializedHeartbeatIds.has(a),f={id:o,createdTimestamp:v,lastUpdatedTimestamp:s,userId:e.userId,veltUserId:D(e.userId),tabId:r,metadata:c};J?(this.commonDbService.setData({feature:"heartbeatByDocument",properties:{id:f.id,skipFirestore:!0,documentId:n},data:f}),this.initializedHeartbeatIds.add(a)):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,s=e?.documentId,o,c={organizationId:r,skipFirestore:!0,useQuery:!0};if(s?(o="allHeartbeatsByDocument",c.documentId=s):o="allHeartbeats",!t)return h(null);if(e?.userId){let n=e?.limit??50;return c.rtdbQuery=[$("userId"),W(e.userId),y(n)],this.commonDbService.dbListener({feature:o,properties:c}).pipe(g(i=>!!i?.data),b(i=>i?.data),b(i=>i?Object.values(i??{}).map(d=>d):null),b(i=>{if(i){let d=e?.lastUpdatedTimestamp?.$gte??Date.now()-15e3;return i.filter(a=>!(d&&a.lastUpdatedTimestamp<d))}return i}))}else{let n=e?.orderBy??"lastUpdatedTimestamp",i=e?.lastUpdatedTimestamp?.$gte??Date.now()-15e3,d=e?.limit??50;return c.rtdbQuery=[$(n),A(i),y(d)],this.commonDbService.dbListener({feature:o,properties:c}).pipe(g(a=>!!a?.data),b(a=>a?.data),b(a=>a?Object.values(a??{}).map(p=>p):null))}}catch(t){return this.loggingService.catch("Error in HeartbeatService getHeartbeatData: ",t),h(null)}}getSpecificHeartbeat(e){try{let t=this.generateHeartbeatId(e.userId,e.tabId),s=this.docService.getDocumentPaths()?.organizationId;if(!s)return h(null);let o,c={id:t,organizationId:s,skipFirestore:!0};return e.documentId?(o="heartbeatByDocument",c.documentId=e.documentId):o="heartbeat",this.commonDbService.dbListener({feature:o,properties:c}).pipe(g(n=>!!n?.data),b(n=>n?.data),S((n,i)=>n?.lastUpdatedTimestamp===i?.lastUpdatedTimestamp))}catch(t){return this.loggingService.catch("Error in HeartbeatService getSpecificHeartbeat: ",t),h(null)}}removeDocumentHeartbeat(e){return k(this,null,function*(){try{let t=this.authService.getUser()?.userId,r=this.domService.getTabId();if(t&&r&&e?.documentId){let s=this.generateHeartbeatId(t,r),o=`${s}_${e.organizationId}_${e.documentId}`;this.heartbeatCreatedTimestamps.delete(o),this.initializedHeartbeatIds.delete(o),yield this.commonDbService.deleteData({feature:"heartbeatByDocument",properties:{id:s,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?h(e.userId):this.authService.getUser$().pipe(b(r=>r?.userId))).pipe(H(r=>r?this.docService.getDocumentPaths$().pipe(H(s=>s?this.getHeartbeatData({userId:r,documentId:s.documentId,organizationId:s.organizationId}):h(null))):h(null)),b(r=>({data:r})),S(L))}catch(t){return this.loggingService.catch("Error in HeartbeatService getHeartbeat: ",t),h({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),h(!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)}}};m.\u0275fac=function(t){return new(t||m)(u(K),u(Y),u(_),u(x),u(R),u(M),u(G),u(Q),u(N))},m.\u0275prov=O({token:m,factory:m.\u0275fac,providedIn:"root"});let T=m;return T})();export{he as a};
|