@veltdev/sdk-dev 6.0.8-beta.5 → 6.0.9-beta.1

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.
Files changed (55) hide show
  1. package/app/models/element/comment-element.model.d.ts +19 -2
  2. package/{chunk-S4QHENVI.js → chunk-2K2XEJWM.js} +1 -1
  3. package/{chunk-2H6D2UE5.js → chunk-4WD366X6.js} +1 -1
  4. package/{chunk-TRPKCRP6.js → chunk-4Z6NNDYV.js} +1 -1
  5. package/{chunk-QYY5QDZZ.js → chunk-7RRXZUH7.js} +1 -1
  6. package/{chunk-CLE4JZBV.js → chunk-AAD7TO6X.js} +1 -1
  7. package/{chunk-ICDRH3KF.js → chunk-BX4TSYIT.js} +1 -1
  8. package/{chunk-XZUEYYE3.js → chunk-BYLLW3IQ.js} +1 -1
  9. package/{chunk-OEOE4TD6.js → chunk-EJ332HKA.js} +1 -1
  10. package/{chunk-SHXQBB7N.js → chunk-EQBACTBQ.js} +1 -1
  11. package/{chunk-KPCULYW2.js → chunk-F6CKB7IS.js} +1 -1
  12. package/{chunk-MUZB4ZRW.js → chunk-FUYX2CTL.js} +1 -1
  13. package/{chunk-R4Z2NW35.js → chunk-GTSIWRGU.js} +1 -1
  14. package/{chunk-7AHH7XWM.js → chunk-ID3E7CBZ.js} +1 -1
  15. package/{chunk-W2OE7HCO.js → chunk-IM25G5ZA.js} +1 -1
  16. package/{chunk-CQ2PFN5H.js → chunk-IU25BW6T.js} +1 -1
  17. package/{chunk-XJUXSAIL.js → chunk-JPNIBNJC.js} +1 -1
  18. package/{chunk-XFL4XVS4.js → chunk-LG5WHFSD.js} +1 -1
  19. package/{chunk-PX2LBUTF.js → chunk-NU5FBCN4.js} +1 -1
  20. package/{chunk-N6XSJOCG.js → chunk-P5SWOPSS.js} +1 -1
  21. package/{chunk-WLT43RAI.js → chunk-Q245RDEX.js} +1 -1
  22. package/{chunk-UORQ3B6S.js → chunk-SMA3X24S.js} +1 -1
  23. package/{chunk-A2DMYJYR.js → chunk-SPYRQOBV.js} +1 -1
  24. package/{chunk-2N7F6RD7.js → chunk-SY46UNW5.js} +1 -1
  25. package/{chunk-6AS4UBOQ.js → chunk-SYSCTHS4.js} +1 -1
  26. package/{chunk-4ZVKEG33.js → chunk-TW7O56QU.js} +1 -1
  27. package/{chunk-PPWVFIE5.js → chunk-UKJTOZK4.js} +1 -1
  28. package/{chunk-4EV2AXDK.js → chunk-VKGZ33MA.js} +1 -1
  29. package/{chunk-3BKUZ65V.js → chunk-XJ6VFULL.js} +1 -1
  30. package/{chunk-55ARQKHV.js → chunk-Y3IPC356.js} +1 -1
  31. package/{chunk-IHGYXGQ3.js → chunk-YNPH7CSB.js} +1 -1
  32. package/{chunk-HAKNI7BB.js → chunk-YOW3SSZH.js} +1 -1
  33. package/{chunk-F7UEUUNI.js → chunk-ZJH32HDL.js} +1 -1
  34. package/{chunk-MCPBCPXB.js → chunk-ZMDRNPLQ.js} +1 -1
  35. package/package.json +1 -1
  36. package/velt-activity-log.js +1 -1
  37. package/velt-area.js +1 -1
  38. package/velt-arrow.js +1 -1
  39. package/velt-comment.js +6 -6
  40. package/velt-crdt.js +1 -1
  41. package/velt-cursor.js +1 -1
  42. package/velt-huddle.js +1 -1
  43. package/velt-live-state-sync.js +1 -1
  44. package/velt-notification.js +1 -1
  45. package/velt-presence.js +1 -1
  46. package/velt-reaction.js +1 -1
  47. package/velt-recorder.js +1 -1
  48. package/velt-rewriter.js +1 -1
  49. package/velt-selection.js +1 -1
  50. package/velt-tag.js +1 -1
  51. package/velt-user-invite.js +1 -1
  52. package/velt-user-request.js +1 -1
  53. package/velt-video-player.js +1 -1
  54. package/velt-views.js +1 -1
  55. package/velt.js +3 -3
@@ -1,2 +1,2 @@
1
- import{b as L}from"./chunk-KPCULYW2.js";import{Ga as z,Ia as B}from"./chunk-OEOE4TD6.js";import{Fa as r,Ga as S,Gc as N,Kb as T,Nb as f,Ob as D,Pa as s,Qb as h,Ua as I,Ya as O,_a as m,a as y,b as u,ha as w,ia as _,kc as v,ki as j,lb as p,lc as g,mb as a,nb as d,qa as C,sb as E,si as V,tb as k,vb as F,wa as b,xb as x,zb as c}from"./chunk-4EV2AXDK.js";function A(t,i){if(t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2){let o=c(2).ngIf;r(),h("",g(2,2,"You are following")," ",o.leaderName)}}function P(t,i){t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2&&(r(),D(g(2,1,"You are leading.")))}function R(t,i){if(t&1){let o=F();a(0,"div",2),x("click",function(){w(o);let e=c().ngIf,l=c();return _(e.type==="following"?l.closeOverlay():void 0)}),a(1,"div",3),m(2,A,3,4,"span",4)(3,P,3,3,"span",4),a(4,"button",5),x("click",function(){w(o);let e=c(2);return _(e.closeOverlay())}),f(5),v(6,"translate"),v(7,"translate"),d()()()}if(t&2){let o=c().ngIf;T("no-pointer",o.type==="leading"),r(2),p("ngIf",o.type==="following"),r(),p("ngIf",o.type==="leading"),r(2),h("",g(6,6,"Stop")," ",g(7,8,o.type))}}function Y(t,i){if(t&1&&(E(0),m(1,R,8,10,"div",1),k()),t&2){let o=i.ngIf;r(),p("ngIf",o.leaderName!==""||o.type==="leading")}}var te=(()=>{let i=class i extends B{closeOverlay(){this.closeOverlayEvent.emit()}constructor(n,e,l,M){super(e,l),this.loggingService=n,this.elementRef=e,this.themeService=l,this.domService=M,this.closeOverlayEvent=new S,this.componentConfigSignal=C({leaderName:"",type:"following"})}ngOnInit(){}ngAfterViewInit(){try{this.customCssSubscription=this.domService.subscribeInjectCustomCss(this.elementRef)}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngAfterViewInit: ",n)}}setLeaderName(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{leaderName:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setLeaderName: ",e)}}getLeaderName(){return this.componentConfigSignal().leaderName}setType(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{type:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setType: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.customCssSubscription?.unsubscribe()}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngOnDestroy: ",n)}}};i.\u0275fac=function(e){return new(e||i)(s(j),s(b),s(z),s(V))},i.\u0275cmp=I({type:i,selectors:[["snippyly-follow-overlay"]],outputs:{closeOverlayEvent:"closeOverlayEvent"},standalone:!1,features:[O],decls:1,vars:1,consts:[[4,"ngIf"],["data-velt-ignore","","class","follow-overlay-container",3,"no-pointer","click",4,"ngIf"],["data-velt-ignore","",1,"follow-overlay-container",3,"click"],["data-velt-ignore","",1,"follow-dialog"],["data-velt-ignore","","class","follow-text",4,"ngIf"],["data-velt-ignore","",1,"follow-btn",3,"click"],["data-velt-ignore","",1,"follow-text"]],template:function(e,l){e&1&&m(0,Y,2,1,"ng-container",0),e&2&&p("ngIf",l.componentConfigSignal())},dependencies:[N,L],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}body.velt-pin-dragging iframe{pointer-events:none!important}.follow-overlay-container{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:var(--velt-follow-mode-overlay-z-index);display:flex;justify-content:center;align-items:flex-end}.follow-overlay-container .follow-dialog{background-color:var(--legacy-velt-follow-overlay-bg-color);color:var(--legacy-velt-follow-overlay-text-color);font-size:12px;display:flex;justify-content:center;align-items:center;gap:calc((1.2rem + 0px) * var(--velt-base-rem-unit));padding:calc((.9rem + 0px) * var(--velt-base-rem-unit)) calc((1.1rem + 0px) * var(--velt-base-rem-unit));border-radius:90px;margin-bottom:calc((2rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 8px 16px -8px #0f0f0f1a;border:1px solid var(--legacy-velt-follow-overlay-border-color)}.follow-overlay-container .follow-dialog .follow-btn{background-color:var(--legacy-velt-follow-overlay-btn-color);padding:8px 12px;border-radius:90px;display:inline-flex;justify-content:center;align-items:center;border:none;font-weight:600;font-size:14px;cursor:pointer;pointer-events:all}.follow-overlay-container .follow-dialog .follow-btn:hover{transition:background-color .5s;background-color:var(--legacy-velt-follow-overlay-btn-hover-color)}.follow-overlay-container.no-pointer{pointer-events:none}
1
+ import{b as L}from"./chunk-F6CKB7IS.js";import{Ga as z,Ia as B}from"./chunk-EJ332HKA.js";import{Fa as r,Ga as S,Gc as N,Kb as T,Nb as f,Ob as D,Pa as s,Qb as h,Ua as I,Ya as O,_a as m,a as y,b as u,ha as w,ia as _,kc as v,ki as j,lb as p,lc as g,mb as a,nb as d,qa as C,sb as E,si as V,tb as k,vb as F,wa as b,xb as x,zb as c}from"./chunk-VKGZ33MA.js";function A(t,i){if(t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2){let o=c(2).ngIf;r(),h("",g(2,2,"You are following")," ",o.leaderName)}}function P(t,i){t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2&&(r(),D(g(2,1,"You are leading.")))}function R(t,i){if(t&1){let o=F();a(0,"div",2),x("click",function(){w(o);let e=c().ngIf,l=c();return _(e.type==="following"?l.closeOverlay():void 0)}),a(1,"div",3),m(2,A,3,4,"span",4)(3,P,3,3,"span",4),a(4,"button",5),x("click",function(){w(o);let e=c(2);return _(e.closeOverlay())}),f(5),v(6,"translate"),v(7,"translate"),d()()()}if(t&2){let o=c().ngIf;T("no-pointer",o.type==="leading"),r(2),p("ngIf",o.type==="following"),r(),p("ngIf",o.type==="leading"),r(2),h("",g(6,6,"Stop")," ",g(7,8,o.type))}}function Y(t,i){if(t&1&&(E(0),m(1,R,8,10,"div",1),k()),t&2){let o=i.ngIf;r(),p("ngIf",o.leaderName!==""||o.type==="leading")}}var te=(()=>{let i=class i extends B{closeOverlay(){this.closeOverlayEvent.emit()}constructor(n,e,l,M){super(e,l),this.loggingService=n,this.elementRef=e,this.themeService=l,this.domService=M,this.closeOverlayEvent=new S,this.componentConfigSignal=C({leaderName:"",type:"following"})}ngOnInit(){}ngAfterViewInit(){try{this.customCssSubscription=this.domService.subscribeInjectCustomCss(this.elementRef)}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngAfterViewInit: ",n)}}setLeaderName(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{leaderName:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setLeaderName: ",e)}}getLeaderName(){return this.componentConfigSignal().leaderName}setType(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{type:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setType: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.customCssSubscription?.unsubscribe()}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngOnDestroy: ",n)}}};i.\u0275fac=function(e){return new(e||i)(s(j),s(b),s(z),s(V))},i.\u0275cmp=I({type:i,selectors:[["snippyly-follow-overlay"]],outputs:{closeOverlayEvent:"closeOverlayEvent"},standalone:!1,features:[O],decls:1,vars:1,consts:[[4,"ngIf"],["data-velt-ignore","","class","follow-overlay-container",3,"no-pointer","click",4,"ngIf"],["data-velt-ignore","",1,"follow-overlay-container",3,"click"],["data-velt-ignore","",1,"follow-dialog"],["data-velt-ignore","","class","follow-text",4,"ngIf"],["data-velt-ignore","",1,"follow-btn",3,"click"],["data-velt-ignore","",1,"follow-text"]],template:function(e,l){e&1&&m(0,Y,2,1,"ng-container",0),e&2&&p("ngIf",l.componentConfigSignal())},dependencies:[N,L],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}body.velt-pin-dragging iframe{pointer-events:none!important}.follow-overlay-container{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:var(--velt-follow-mode-overlay-z-index);display:flex;justify-content:center;align-items:flex-end}.follow-overlay-container .follow-dialog{background-color:var(--legacy-velt-follow-overlay-bg-color);color:var(--legacy-velt-follow-overlay-text-color);font-size:12px;display:flex;justify-content:center;align-items:center;gap:calc((1.2rem + 0px) * var(--velt-base-rem-unit));padding:calc((.9rem + 0px) * var(--velt-base-rem-unit)) calc((1.1rem + 0px) * var(--velt-base-rem-unit));border-radius:90px;margin-bottom:calc((2rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 8px 16px -8px #0f0f0f1a;border:1px solid var(--legacy-velt-follow-overlay-border-color)}.follow-overlay-container .follow-dialog .follow-btn{background-color:var(--legacy-velt-follow-overlay-btn-color);padding:8px 12px;border-radius:90px;display:inline-flex;justify-content:center;align-items:center;border:none;font-weight:600;font-size:14px;cursor:pointer;pointer-events:all}.follow-overlay-container .follow-dialog .follow-btn:hover{transition:background-color .5s;background-color:var(--legacy-velt-follow-overlay-btn-hover-color)}.follow-overlay-container.no-pointer{pointer-events:none}
2
2
  `],encapsulation:3,changeDetection:0});let t=i;return t})();export{te as a};
@@ -1 +1 @@
1
- import{$ as c,B as s,J as a,ca as n,ki as h,l as o}from"./chunk-4EV2AXDK.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};
1
+ import{$ as c,B as s,J as a,ca as n,ki as h,l as o}from"./chunk-VKGZ33MA.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};
@@ -1 +1 @@
1
- import{Ea as F}from"./chunk-OEOE4TD6.js";import{$ as A,Ai as U,Cf as g,Ch as D,E as h,Ee as $,Fi as C,G as d,J as v,L as l,Pi as w,T as n,Xe as M,ca as s,ji as E,ki as R,l as p,li as y,qh as I,r as u,te as a,ti as k,ue as m,v as c}from"./chunk-4EV2AXDK.js";var Z=(()=>{let o=class o{constructor(e,t,r,b,f,W,T,j){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=b,this.docService=f,this.configService=W,this.loggingService=T,this.commonDbService=j,this.documentIAM$=new p(null),this.workspaceIAM$=new p(null),this.roles$=new p([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(h(i=>!!i),v(1)).subscribe(i=>{i&&(this.getUser(),this.getDocumentPaths())},i=>{this.loggingService.catch("Error in CommentService getDb subscription: ",i)}),this.getRole$().pipe(v(1)).subscribe(i=>{this.authService?.getUser()&&!i&&this.analyticsService.trackEvent(D.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(i=>{i?.accessType&&this.contactService.setDocumentAccessType(i.accessType)})}catch(i){this.loggingService.catch("Error in IamService constructor: ",i)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(h(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(h(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let t=e||new M;this.documentIAM$.next(t)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(d(e=>u(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(c(e=>!!e),l())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(c(e=>e?.length?e:$.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(c(e=>e?.features),n(e=>this.getRole$().pipe(c(t=>(t===a.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(n(()=>this.documentIAM$.pipe(h(t=>!!t),n(()=>this.workspaceIAM$.pipe(c(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),u(!1)}}getRole$(){try{return this.authService.getUser$().pipe(n(()=>this.configService.getSF$()),n(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():u(null)),n(()=>this.configService.getSF()?this.documentIAM$.pipe(h(e=>!!e),l(I)):u(null)),n(()=>this.workspaceIAM$.pipe(l(I))),c(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),u(null)}}getRole(){try{let e=this.configService.getSF();if(this.user?.isAdmin)return a.ADMIN;return a.COMMENTER;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?m.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||m.PUBLIC:null){case m.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||a.COMMENTER;break;case m.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||null;break;default:break}}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(c(e=>e===a.ADMIN),l())}isUserAdmin(){try{return this.getRole()===a.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let r;return e&&(r=this.documentIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let r;return e&&(r=this.workspaceIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(s(E),s(k),s(F),s(U),s(C),s(y),s(R),s(w))},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let S=o;return S})();export{Z as a};
1
+ import{Ea as F}from"./chunk-EJ332HKA.js";import{$ as A,Ai as U,Cf as g,Ch as D,E as h,Ee as $,Fi as C,G as d,J as v,L as l,Pi as w,T as n,Xe as M,ca as s,ji as E,ki as R,l as p,li as y,qh as I,r as u,te as a,ti as k,ue as m,v as c}from"./chunk-VKGZ33MA.js";var Z=(()=>{let o=class o{constructor(e,t,r,b,f,W,T,j){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=b,this.docService=f,this.configService=W,this.loggingService=T,this.commonDbService=j,this.documentIAM$=new p(null),this.workspaceIAM$=new p(null),this.roles$=new p([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(h(i=>!!i),v(1)).subscribe(i=>{i&&(this.getUser(),this.getDocumentPaths())},i=>{this.loggingService.catch("Error in CommentService getDb subscription: ",i)}),this.getRole$().pipe(v(1)).subscribe(i=>{this.authService?.getUser()&&!i&&this.analyticsService.trackEvent(D.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(i=>{i?.accessType&&this.contactService.setDocumentAccessType(i.accessType)})}catch(i){this.loggingService.catch("Error in IamService constructor: ",i)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(h(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(h(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let t=e||new M;this.documentIAM$.next(t)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(d(e=>u(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(c(e=>!!e),l())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(c(e=>e?.length?e:$.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(c(e=>e?.features),n(e=>this.getRole$().pipe(c(t=>(t===a.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(n(()=>this.documentIAM$.pipe(h(t=>!!t),n(()=>this.workspaceIAM$.pipe(c(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),u(!1)}}getRole$(){try{return this.authService.getUser$().pipe(n(()=>this.configService.getSF$()),n(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():u(null)),n(()=>this.configService.getSF()?this.documentIAM$.pipe(h(e=>!!e),l(I)):u(null)),n(()=>this.workspaceIAM$.pipe(l(I))),c(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),u(null)}}getRole(){try{let e=this.configService.getSF();if(this.user?.isAdmin)return a.ADMIN;return a.COMMENTER;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?m.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||m.PUBLIC:null){case m.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||a.COMMENTER;break;case m.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||null;break;default:break}}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(c(e=>e===a.ADMIN),l())}isUserAdmin(){try{return this.getRole()===a.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let r;return e&&(r=this.documentIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let r;return e&&(r=this.workspaceIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(s(E),s(k),s(F),s(U),s(C),s(y),s(R),s(w))},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let S=o;return S})();export{Z as a};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/sdk-dev",
3
- "version": "6.0.8-beta.5",
3
+ "version": "6.0.9-beta.1",
4
4
  "description": "Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.",
5
5
  "homepage": "https://velt.dev",
6
6
  "keywords": [