@usesuperflow/toolbar-staging 1.0.521 → 1.0.522
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/package.json +1 -1
- package/superflow.js +5 -5
- package/superflow.min.js +5 -5
package/package.json
CHANGED
package/superflow.js
CHANGED
|
@@ -2659,13 +2659,13 @@ class ca extends Jn{}ca.Encryptor=class extends ca{processBlock(t,e){const i=t,o
|
|
|
2659
2659
|
${dt(this.wordMark)}
|
|
2660
2660
|
`:L`
|
|
2661
2661
|
<img src=${this.wordMark} />
|
|
2662
|
-
`}catch(t){return console.warn("Error in getWordMark: ",t),L``}},this.generateLocation=()=>{try{if(this.autoLocation){const t=new URL(document.location).searchParams,e=new URL(document.location);e.searchParams.delete(mt),e.searchParams.delete(gt),e.searchParams.delete(ft),e.searchParams.delete(wt),e.searchParams.delete(Mt),e.searchParams.delete(_t);const i=t.get(kt)||this.projectVersion;this.queryParamsComments||(e.search="");let o=(t=>{try{return t.replace(/#.*$/,"")}catch(e){return console.warn("Error in removeHashFromUrl: ",e),Pa("Error in removeHashFromUrl: ",e),t}})(e.href);this.projectId&&(o=null==o?void 0:o.replace(window.location.origin,"")),this.location={url:o,version:i}}}catch(t){console.warn("Error in generateLocation: ",t),Pa("Error in generateLocation: ",t)}},this.setLocation=()=>{var t,e,i,o;try{if(this.autoLocation&&window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)){if(this.version?(this.location||(this.location={}),this.location.version=this.version):this.location&&delete this.location.version,this.previousLocation&&(null===(t=this.previousLocation)||void 0===t?void 0:t.url)===(null===(e=this.location)||void 0===e?void 0:e.url)&&(null===(i=this.previousLocation)||void 0===i?void 0:i.version)===(null===(o=this.location)||void 0===o?void 0:o.version))return;const n=(t=>{try{const e=ba(t);return ya(JSON.stringify(e))}catch(t){return}})(JSON.parse(JSON.stringify(this.location)));if(n?this.location.id=`${n}`:delete this.location.id,this.usePageTitleAsLocationName){const t=document.title;t&&(this.location.locationName=t)}null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))),$a({clientLocation:this.location}),this.previousLocation=JSON.parse(JSON.stringify(this.location)),this.onVeltLocationChange()}}catch(t){console.warn("Error in setLocation: ",t),Pa("Error in setLocation: ",t)}},this.onVeltLocationChange=()=>{try{window.dispatchEvent(new CustomEvent("veltLocationChange",{detail:this.location}))}catch(t){console.warn("Error in onVeltLocationChange: ",t),Pa("Error in onVeltLocationChange: ",t)}},this.identifySnippyly=async()=>{var t,e;let i="",o="";try{this.invalidApiKey=!1;let e,n={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0};e=this.customLoginEnabled&&this.providedUser?this.providedUser:Ta();const r=await this.getSamlConfig();if(r&&(this.signInUrl=`${qt}saml/${r.slug}/login?source=sf`),(null==e?void 0:e.email)&&(n=e),n.isAnonymous)delete n.groupId;else{const t=Snippyly.getDocumentId()||this.serverDocumentId;t&&(n.groupId=t+"")}if(this.customLoginEnabledLocally||(null===(t=null==n?void 0:n.contacts)||void 0===t?void 0:t.length)&&(n.contacts=[]),i=null==n?void 0:n.email,o=null==n?void 0:n.userId,(null==n?void 0:n.isAnonymous)&&this.projectId&&this.guestMode){const t=Aa();t&&(n=JSON.parse(JSON.stringify(t)))}let s;(null==n?void 0:n.isAnonymous)||(this.loading=!0),(null==n?void 0:n.groupId)&&(s||(s={}),s.groupId=null==n?void 0:n.groupId);const a=await(async(t,e,i)=>{var o,n;try{const r=yo(La,ne,{timeout:12e5}),s=await r({apiKey:t,userId:e,userProperties:i});return null===(n=null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.data)||void 0===n?void 0:n.token}catch(t){return console.warn("Error in generateSuperflowAuthToken: ",t),null}})(this.apiKey,null==n?void 0:n.userId,s),l={};a&&(l.authToken=a);const c=await Snippyly.identify(n,l);ja(JSON.parse(JSON.stringify(c||{}))),(null==n?void 0:n.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(n)));const d=JSON.parse(JSON.stringify(c||{}));(null==d?void 0:d.userSnippylyId)&&!(null==d?void 0:d.isGuest)&&this.checkToMigrateGuestUser(d),Snippyly.getUserRole$().subscribe((t=>{var e;this.loading=!1,this.snippylyUserRole=t,"Admin"===this.snippylyUserRole&&this.allFeatureDisabled&&(this.allFeatureDisabled=!1),this.snippylyUserRole||Ra(ht.Events.USER_EMAIL_NOT_WHITELISTED),null===(e=this.commentElement)||void 0===e||e.enablePriority(),this.checkPrivateCommentModeFromStorage()})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getFeaturesAccessLevelIam$)&&this.subscriptions.push(Snippyly.getFeaturesAccessLevelIam$().subscribe((async t=>{var e,i,o,n,r,s,a,l;this.allFeatureDisabled=!!(null===(e=null==t?void 0:t.all)||void 0===e?void 0:e.disabled)&&"Admin"!==this.snippylyUserRole,this.allFeatureRestricted=!!(null===(i=null==t?void 0:t.all)||void 0===i?void 0:i.restricted),this.guestMode=!!(null===(o=null==t?void 0:t.all)||void 0===o?void 0:o.guestMode),this.allowGuestModeSignIn=!!(null===(r=null===(n=null==t?void 0:t.all)||void 0===n?void 0:n.guestModeConfig)||void 0===r?void 0:r.allowSignIn),this.guestMode&&Ra(ht.Events.GUEST_MODE_PRESENT),(null===(s=null==t?void 0:t.all)||void 0===s?void 0:s.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(l=null===(a=null==t?void 0:t.all)||void 0===a?void 0:a.passwordProtected)||void 0===l?void 0:l.enabled),Velt&&(t&&this.passwordProtected&&!this.isPasswordValid?Velt.disableFeatures(["area","arrow","audioHuddle","cursor","huddle","liveStateSync","presence","tag","recorder","comment"]):Velt.disableFeatures([]),Velt.getCommentElement().onCommentModeChange().subscribe((t=>{0==t&&1==this.privateCommentModeEnabled&&this.togglePrivateCommentMode()}))),Ea(At,this.guestMode+"",!0),Ea(jt,this.allowGuestModeSignIn+"",!0),Ea(Ot,this.passwordProtected+"",!0)}),(t=>{this.loading=!1,console.warn("Error in getFeaturesAccessLevelIam$: ",t),Pa("Error in getFeaturesAccessLevelIam$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.isPlanExpired$)&&(null===Snippyly||void 0===Snippyly||Snippyly.isPlanExpired$().subscribe((t=>{this.isPlanExpired=t}),(t=>{this.isPlanExpired=!1,console.warn("Error in isPlanExpired$: ",t),Pa("Error in isPlanExpired$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCustomerMetadata$)&&(null===Snippyly||void 0===Snippyly||Snippyly.getCustomerMetadata$().subscribe((t=>{Oa(t),t&&(this.customerMetadata=t)}),(t=>{console.warn("Error in getCustomerMetadata$: ",t),Pa("Error in getCustomerMetadata$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentMetadata)&&(null===Snippyly||void 0===Snippyly||Snippyly.getDocumentMetadata().subscribe((t=>{var e,i;t&&(this.queryParamsComments=!!(null===(e=null==t?void 0:t.extraConfig)||void 0===e?void 0:e.queryParamsComments),Ea(Lt,this.queryParamsComments+"",!0),this.usePageTitleAsLocationName=!!(null===(i=null==t?void 0:t.extraConfig)||void 0===i?void 0:i.usePageTitleAsLocationName),Ea(Dt,this.usePageTitleAsLocationName+"",!0))}),(t=>{console.warn("Error in getDocumentMetadata: ",t),Pa("Error in getDocumentMetadata: ",t)}))),$a({clientUserId:null==n?void 0:n.userId});try{(t=>{var e,i,o,n,r,s,a,l,c,d,h,u;const p={properties:{apiKey:null!==(e=null==Fa?void 0:Fa.apiKey)&&void 0!==e?e:"",name:null!==(i=null==t?void 0:t.name)&&void 0!==i?i:"",firstName:(null==t?void 0:t.name)?null===(o=null==t?void 0:t.name)||void 0===o?void 0:o.split(" ")[0]:"",lastName:(null==t?void 0:t.name)?null===(n=null==t?void 0:t.name)||void 0===n?void 0:n.split(" ")[1]:"",email:null!==(r=null==t?void 0:t.email)&&void 0!==r?r:"",clientUserId:null!==(s=null==t?void 0:t.userId)&&void 0!==s?s:"",snippylyUserId:null!==(a=null==t?void 0:t.userSnippylyId)&&void 0!==a?a:"",groupId:null!==(l=null==t?void 0:t.groupId)&&void 0!==l?l:"",isOwner:"",plan:"",sdkVersion:null!==(c=null==Fa?void 0:Fa.sdkVersion)&&void 0!==c?c:"",sdkType:null!==(d=null==Fa?void 0:Fa.sdkType)&&void 0!==d?d:"",sourcePlatform:null!==(h=null==Fa?void 0:Fa.sourcePlatform)&&void 0!==h?h:"",website:null===(u=null===window||void 0===window?void 0:window.location)||void 0===u?void 0:u.href},context:{userAgent:null===navigator||void 0===navigator?void 0:navigator.userAgent},userId:null==t?void 0:t.userSnippylyId,sf:!0};Va("identify",p)})(n)}catch(t){console.warn("Error in trackIdentifyEvent: ",t)}this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{Sa(Tt)||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){if(this.loading=!1,this.signInError=!0,t&&"string"==typeof t&&(null===(e=null==t?void 0:t.toLowerCase())||void 0===e?void 0:e.includes("invalid"))){this.invalidApiKey=!0,Ra(ht.Events.DOMAIN_NOT_WHITELISTED),this.projectId&&(async(t,e)=>{try{const i=yo(La,ee,{timeout:12e5});await i({apiKey:t,projectId:e})}catch(t){console.warn("Error in checkDomainWhitelisted: ",t)}})(this.apiKey,this.projectId);if(new URL(document.location).searchParams.has(Mt))this.isSigningInUserAdmin=!0;else if(Sa(It))this.isSigningInUserAdmin="true"===Sa(It,!0);else{const t=await(async(t,e,i,o)=>{try{const n=yo(La,ie,{timeout:12e5}),r=await n({apiKey:t,projectId:e,email:i,userId:o});return null==r?void 0:r.data}catch(t){return console.warn("Error in iam: ",t),null}})(this.apiKey,this.projectId||"",i,o);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),Ea(It,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),Pa("Error in identifySnippyly: ",t)}},this.checkToMigrateGuestUser=async t=>{try{const e=Aa(!1);e&&(await Ua(this.apiKey,this.projectId||"",e,t,!0),ka(xt))}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),Pa("Error in checkToMigrationGuestUser: ",t)}},this.getComments=()=>{try{this.commentElement&&(this.commentSubscription&&this.commentSubscription.unsubscribe(),this.commentSubscription=this.commentElement.getAllCommentAnnotations(this.documentId).subscribe((t=>{this.comments=null==t?void 0:t.filter((t=>{var e;return["open","inProgress"].includes(null==t?void 0:t.status)||["default","ongoing"].includes(null===(e=null==t?void 0:t.status)||void 0===e?void 0:e.type)}))})))}catch(t){console.warn("Error in getComments: ",t),Pa("Error in getComments: ",t)}},this.setQueryParamsCommentsInSdk=()=>{var t,e,i,o;try{this.commentElement&&(this.queryParamsComments&&(null===(t=this.commentElement)||void 0===t?void 0:t.enableQueryParamsComments)?null===(e=this.commentElement)||void 0===e||e.enableQueryParamsComments():!this.queryParamsComments&&(null===(i=this.commentElement)||void 0===i?void 0:i.disableQueryParamsComments)&&(null===(o=this.commentElement)||void 0===o||o.disableQueryParamsComments()))}catch(t){console.warn("Error in setQueryParamsCommentsInSdk: ",t),Pa("Error in setQueryParamsCommentsInSdk: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),Pa("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded,this.expanded?Ra(ht.Events.TOOLBAR_EXPANDED):Ra(ht.Events.TOOLBAR_COLLAPSED)}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Pa("Error in toggleSnippylyPluginToolbar: ",t)}},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.commentElement.disablePrivateCommentMode&&this.commentElement.disablePrivateCommentMode(),this.privateCommentModeEnabled=!1,Ra(ht.Events.PRIVATE_MODE_DISABLED)):(this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode(),this.privateCommentModeEnabled=!0,Ra(ht.Events.PRIVATE_MODE_ENABLED)),Ea($t,this.privateCommentModeEnabled.toString()))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),Pa("Error in togglePrivateCommentMode: ",t)}},this.checkPrivateCommentModeFromStorage=()=>{try{this.allFeatureDisabled||"Admin"!==this.snippylyUserRole||Sa($t)&&(this.privateCommentModeEnabled="true"===Sa($t),this.privateCommentModeEnabled&&this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode())}catch(t){console.warn("Error in checkPrivateCommentModeFromStorage: ",t),Pa("Error in checkPrivateCommentModeFromStorage: ",t)}},this.loginWithGoogle=()=>{try{if(Ra(ht.Events.SIGNIN_CLICKED),this.loading||this.customLoginEnabledLocally)return;window.open(this.signInUrl,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Pa("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=new URL(window.location.href);null==t||t.searchParams.set("review","true");const e=null==t?void 0:t.toString();if(e){const t=_a(e,Qt,Xt),i=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getqrcode?text=${encodeURIComponent(t)}`),o=await i.json();(null==o?void 0:o.qrcode)&&(this.qrCode=null==o?void 0:o.qrcode)}}catch(t){console.warn("Error in getQRCode: ",t),Pa("Error in getQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{Ra(ht.Events.OPEN_MOBILE_CLICKED),this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),Pa("Error in toggleQRCodeVisibility: ",t)}},this.onUserInviteToolClick=()=>{var t;(null===(t=this.snippylyUser)||void 0===t?void 0:t.isGuest)&&(this.guestModeSignInModalConfig.title="Sign in to invite others.",this.guestModeSignInModalConfig.description="Invite team members to comment on this project.",this.guestModeSignInModalConfig.showLeaveCommentButton=!1,this.guestModeSignInModalConfig.closeOnClickOutside=!0,this.openGuestModeSignInModal())},this.removeSnippyly=async()=>{try{Ra(ht.Events.EXIT_REVIEW_MODE_CLICKED),this.exitReviewModeCalled=!0,ka(mt),ka(gt),ka(ft),ka(Et,"sessionStorage"),ka(St,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(ft),e.delete(mt),e.delete(wt),e.delete(gt),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(kt),e.delete(Mt),e.delete(_t),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,t.href),window.location.reload()}catch(t){console.warn("Error in removeSnippyly: ",t),Pa("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{Ra(ht.Events.SIGNOUT_CLICKED),this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),await Snippyly.signOutUser(),ka(yt),ka(Ct),ka(It),ka($t),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Pa("Error in signOutUser: ",t)}},this.toggleMenu=(t,e)=>{try{t.stopPropagation(),this.menuOpenedId===e?this.menuOpenedId=void 0:this.menuOpenedId=e}catch(t){console.warn("Error in toggleMenu: ",t),Pa("Error in toggleMenu: ",t)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(t){console.warn("Error in copyLink: ",t),Pa("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${qt}`;Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)&&this.serverDocumentId&&(t=`${qt}/dashboard/project/comment/${this.apiKey}/${this.serverDocumentId}`),Ra(ht.Events.VIEW_PROJECT_CLICKED),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Pa("Error in goToAdminPortal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${qt}`;Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)&&this.serverDocumentId&&(t=`${qt}/dashboard`),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),Pa("Error in goToAdminPortalDashboard: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1q3jzsddt-NEb~uu9RXscLfxOIDGQXJw","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),Pa("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Ea(Mt,"true");const t=new URL(document.location);t.searchParams.delete(Mt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Pa("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Ea(_t,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(_t),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Pa("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Nt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),Pa("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://superflow-portal-staging-2023.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Pa("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,Ea(Tt,"true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Pa("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{Ra(ht.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),Pa("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,Ra(ht.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),Pa("Error in openGuestModeSignInModal: ",t)}},this.closeGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!1,this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig))}catch(t){console.warn("Error in closeGuestModeSignInModal: ",t),Pa("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{Ra(ht.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),Pa("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.skipGuestNameModal||(this.showGuestModeNameModal=!0,Ra(ht.Events.GUEST_MODE_NAME_NUDGE_SHOWN))}catch(t){console.warn("Error in openGuestModeNameModel: ",t),Pa("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),Pa("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{Ra(ht.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),Pa("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{Ra(ht.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),Pa("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{Ra(ht.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),Pa("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,Ra(ht.Events.GUEST_MODE_SIGN_IN_NUDGE_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),Pa("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),Pa("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{Ra(ht.Events.GUEST_MODE_SIGN_IN_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),Pa("Error in onGuestModeBannerSignInButtonClick: ",t)}},this.updateGuestUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;const e=Aa();if(e){const t=JSON.parse(JSON.stringify(e));e.name=this.guestUserNameInput,e.photoUrl=null,this.guestUserNameUpdateLoading=!0,(t=>{try{const e=JSON.stringify(t),i=_a(e,Qt,Xt);Ea(xt,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),Pa("Error in updateGuestUser: ",t)}})(e),await Snippyly.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await Ua(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,Ea(Rt,"true"),Ra(ht.Events.GUEST_MODE_NAME_ADDED,{oldName:null==t?void 0:t.name,newName:null==e?void 0:e.name})}this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateGuestUserName: ",t),Pa("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(Ra(ht.Events.REVIEW_PASSWORD_ADDED),!(null===(t=this.password)||void 0===t?void 0:t.trim()))return;if(this.validatingPasswordLoading)return;this.validatingPasswordLoading=!0,this.isPasswordValid=await(async(t,e,i)=>{var o;try{const n=yo(La,le,{timeout:12e5}),r=await n({apiKey:t,projectId:e,password:i});return null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in validatePassword: ",t),null}})(this.apiKey,this.projectId,this.password),function(t,e){try{const i="object"==typeof e?JSON.stringify(e):e;localStorage.setItem(t,i)}catch(t){console.warn("Error in setLocalStorage: ",t)}}(Ft,this.isPasswordValid),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,Velt&&Velt.disableFeatures([]),Ra(ht.Events.REVIEW_PASSWORD_ACCEPTED)):(this.showInvalidPassword=!0,Ra(ht.Events.REVIEW_PASSWORD_REJECTED)),this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),Pa("Error in submitPassword: ",t)}},this.updateUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;this.guestUserNameUpdateLoading=!0;const e=JSON.parse(JSON.stringify(this.snippylyUser)),i=JSON.parse(JSON.stringify(this.snippylyUser));i.name=this.guestUserNameInput,await Ua(this.apiKey,this.projectId||"",e,i),await Snippyly.updateUser(i),this.snippylyUser=JSON.parse(JSON.stringify(i));const o=Ta();o.name=i.name;const n=JSON.stringify(o),r=_a(n,Qt,Xt);Ea(Ct,r,!0),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),Pa("Error in updateUserName: ",t)}},this.disableCommentMode=()=>{var t;try{(null===(t=this.commentElement)||void 0===t?void 0:t.disableCommentMode)&&this.commentElement.disableCommentMode()}catch(t){console.warn("Error in disableAddCommentMode: ",t),Pa("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?L`
|
|
2662
|
+
`}catch(t){return console.warn("Error in getWordMark: ",t),L``}},this.generateLocation=()=>{try{if(this.autoLocation){const t=new URL(document.location).searchParams,e=new URL(document.location);e.searchParams.delete(mt),e.searchParams.delete(gt),e.searchParams.delete(ft),e.searchParams.delete(wt),e.searchParams.delete(Mt),e.searchParams.delete(_t);const i=t.get(kt)||this.projectVersion;this.queryParamsComments||(e.search="");let o=(t=>{try{return t.replace(/#.*$/,"")}catch(e){return console.warn("Error in removeHashFromUrl: ",e),Pa("Error in removeHashFromUrl: ",e),t}})(e.href);this.projectId&&(o=null==o?void 0:o.replace(window.location.origin,"")),this.location={url:o,version:i}}}catch(t){console.warn("Error in generateLocation: ",t),Pa("Error in generateLocation: ",t)}},this.setLocation=()=>{var t,e,i,o;try{if(this.autoLocation&&window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)){if(this.version?(this.location||(this.location={}),this.location.version=this.version):this.location&&delete this.location.version,this.previousLocation&&(null===(t=this.previousLocation)||void 0===t?void 0:t.url)===(null===(e=this.location)||void 0===e?void 0:e.url)&&(null===(i=this.previousLocation)||void 0===i?void 0:i.version)===(null===(o=this.location)||void 0===o?void 0:o.version))return;const n=(t=>{try{const e=ba(t);return ya(JSON.stringify(e))}catch(t){return}})(JSON.parse(JSON.stringify(this.location)));if(n?this.location.id=`${n}`:delete this.location.id,this.usePageTitleAsLocationName){const t=document.title;t&&(this.location.locationName=t)}null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))),$a({clientLocation:this.location}),this.previousLocation=JSON.parse(JSON.stringify(this.location)),this.onVeltLocationChange()}}catch(t){console.warn("Error in setLocation: ",t),Pa("Error in setLocation: ",t)}},this.onVeltLocationChange=()=>{try{window.dispatchEvent(new CustomEvent("veltLocationChange",{detail:this.location}))}catch(t){console.warn("Error in onVeltLocationChange: ",t),Pa("Error in onVeltLocationChange: ",t)}},this.identifySnippyly=async()=>{var t,e;let i="",o="";try{this.invalidApiKey=!1;let e,n={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0};e=this.customLoginEnabled&&this.providedUser?this.providedUser:Ta();const r=await this.getSamlConfig();if(r&&(this.signInUrl=`${qt}saml/${r.slug}/login?source=sf`),(null==e?void 0:e.email)&&(n=e),n.isAnonymous)delete n.groupId;else{const t=Snippyly.getDocumentId()||this.serverDocumentId;t&&(n.groupId=t+"")}if(this.customLoginEnabledLocally||(null===(t=null==n?void 0:n.contacts)||void 0===t?void 0:t.length)&&(n.contacts=[]),i=null==n?void 0:n.email,o=null==n?void 0:n.userId,(null==n?void 0:n.isAnonymous)&&this.projectId&&this.guestMode){const t=Aa();t&&(n=JSON.parse(JSON.stringify(t)))}let s;(null==n?void 0:n.isAnonymous)||(this.loading=!0),(null==n?void 0:n.groupId)&&(s||(s={}),s.groupId=null==n?void 0:n.groupId);const a=await(async(t,e,i)=>{var o,n;try{const r=yo(La,ne,{timeout:12e5}),s=await r({apiKey:t,userId:e,userProperties:i});return null===(n=null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.data)||void 0===n?void 0:n.token}catch(t){return console.warn("Error in generateSuperflowAuthToken: ",t),null}})(this.apiKey,null==n?void 0:n.userId,s),l={};a&&(l.authToken=a);const c=await Snippyly.identify(n,l);ja(JSON.parse(JSON.stringify(c||{}))),(null==n?void 0:n.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(n)));const d=JSON.parse(JSON.stringify(c||{}));(null==d?void 0:d.userSnippylyId)&&!(null==d?void 0:d.isGuest)&&this.checkToMigrateGuestUser(d),Snippyly.getUserRole$().subscribe((t=>{var e;this.loading=!1,this.snippylyUserRole=t,"Admin"===this.snippylyUserRole&&this.allFeatureDisabled&&(this.allFeatureDisabled=!1),this.snippylyUserRole||Ra(ht.Events.USER_EMAIL_NOT_WHITELISTED),null===(e=this.commentElement)||void 0===e||e.enablePriority(),this.checkPrivateCommentModeFromStorage()})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getFeaturesAccessLevelIam$)&&this.subscriptions.push(Snippyly.getFeaturesAccessLevelIam$().subscribe((async t=>{var e,i,o,n,r,s,a,l;this.allFeatureDisabled=!!(null===(e=null==t?void 0:t.all)||void 0===e?void 0:e.disabled)&&"Admin"!==this.snippylyUserRole,this.allFeatureRestricted=!!(null===(i=null==t?void 0:t.all)||void 0===i?void 0:i.restricted),this.guestMode=!!(null===(o=null==t?void 0:t.all)||void 0===o?void 0:o.guestMode),this.allowGuestModeSignIn=!!(null===(r=null===(n=null==t?void 0:t.all)||void 0===n?void 0:n.guestModeConfig)||void 0===r?void 0:r.allowSignIn),this.guestMode&&Ra(ht.Events.GUEST_MODE_PRESENT),(null===(s=null==t?void 0:t.all)||void 0===s?void 0:s.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(l=null===(a=null==t?void 0:t.all)||void 0===a?void 0:a.passwordProtected)||void 0===l?void 0:l.enabled),Velt&&(t&&this.passwordProtected&&!this.isPasswordValid?Velt.disableFeatures(["area","arrow","audioHuddle","cursor","huddle","liveStateSync","presence","tag","recorder","comment"]):Velt.disableFeatures([])),Ea(At,this.guestMode+"",!0),Ea(jt,this.allowGuestModeSignIn+"",!0),Ea(Ot,this.passwordProtected+"",!0)}),(t=>{this.loading=!1,console.warn("Error in getFeaturesAccessLevelIam$: ",t),Pa("Error in getFeaturesAccessLevelIam$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.isPlanExpired$)&&(null===Snippyly||void 0===Snippyly||Snippyly.isPlanExpired$().subscribe((t=>{this.isPlanExpired=t}),(t=>{this.isPlanExpired=!1,console.warn("Error in isPlanExpired$: ",t),Pa("Error in isPlanExpired$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCustomerMetadata$)&&(null===Snippyly||void 0===Snippyly||Snippyly.getCustomerMetadata$().subscribe((t=>{Oa(t),t&&(this.customerMetadata=t)}),(t=>{console.warn("Error in getCustomerMetadata$: ",t),Pa("Error in getCustomerMetadata$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentMetadata)&&(null===Snippyly||void 0===Snippyly||Snippyly.getDocumentMetadata().subscribe((t=>{var e,i;t&&(this.queryParamsComments=!!(null===(e=null==t?void 0:t.extraConfig)||void 0===e?void 0:e.queryParamsComments),Ea(Lt,this.queryParamsComments+"",!0),this.usePageTitleAsLocationName=!!(null===(i=null==t?void 0:t.extraConfig)||void 0===i?void 0:i.usePageTitleAsLocationName),Ea(Dt,this.usePageTitleAsLocationName+"",!0))}),(t=>{console.warn("Error in getDocumentMetadata: ",t),Pa("Error in getDocumentMetadata: ",t)}))),$a({clientUserId:null==n?void 0:n.userId});try{(t=>{var e,i,o,n,r,s,a,l,c,d,h,u;const p={properties:{apiKey:null!==(e=null==Fa?void 0:Fa.apiKey)&&void 0!==e?e:"",name:null!==(i=null==t?void 0:t.name)&&void 0!==i?i:"",firstName:(null==t?void 0:t.name)?null===(o=null==t?void 0:t.name)||void 0===o?void 0:o.split(" ")[0]:"",lastName:(null==t?void 0:t.name)?null===(n=null==t?void 0:t.name)||void 0===n?void 0:n.split(" ")[1]:"",email:null!==(r=null==t?void 0:t.email)&&void 0!==r?r:"",clientUserId:null!==(s=null==t?void 0:t.userId)&&void 0!==s?s:"",snippylyUserId:null!==(a=null==t?void 0:t.userSnippylyId)&&void 0!==a?a:"",groupId:null!==(l=null==t?void 0:t.groupId)&&void 0!==l?l:"",isOwner:"",plan:"",sdkVersion:null!==(c=null==Fa?void 0:Fa.sdkVersion)&&void 0!==c?c:"",sdkType:null!==(d=null==Fa?void 0:Fa.sdkType)&&void 0!==d?d:"",sourcePlatform:null!==(h=null==Fa?void 0:Fa.sourcePlatform)&&void 0!==h?h:"",website:null===(u=null===window||void 0===window?void 0:window.location)||void 0===u?void 0:u.href},context:{userAgent:null===navigator||void 0===navigator?void 0:navigator.userAgent},userId:null==t?void 0:t.userSnippylyId,sf:!0};Va("identify",p)})(n)}catch(t){console.warn("Error in trackIdentifyEvent: ",t)}this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{Sa(Tt)||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){if(this.loading=!1,this.signInError=!0,t&&"string"==typeof t&&(null===(e=null==t?void 0:t.toLowerCase())||void 0===e?void 0:e.includes("invalid"))){this.invalidApiKey=!0,Ra(ht.Events.DOMAIN_NOT_WHITELISTED),this.projectId&&(async(t,e)=>{try{const i=yo(La,ee,{timeout:12e5});await i({apiKey:t,projectId:e})}catch(t){console.warn("Error in checkDomainWhitelisted: ",t)}})(this.apiKey,this.projectId);if(new URL(document.location).searchParams.has(Mt))this.isSigningInUserAdmin=!0;else if(Sa(It))this.isSigningInUserAdmin="true"===Sa(It,!0);else{const t=await(async(t,e,i,o)=>{try{const n=yo(La,ie,{timeout:12e5}),r=await n({apiKey:t,projectId:e,email:i,userId:o});return null==r?void 0:r.data}catch(t){return console.warn("Error in iam: ",t),null}})(this.apiKey,this.projectId||"",i,o);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),Ea(It,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),Pa("Error in identifySnippyly: ",t)}},this.checkToMigrateGuestUser=async t=>{try{const e=Aa(!1);e&&(await Ua(this.apiKey,this.projectId||"",e,t,!0),ka(xt))}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),Pa("Error in checkToMigrationGuestUser: ",t)}},this.getComments=()=>{try{this.commentElement&&(this.commentSubscription&&this.commentSubscription.unsubscribe(),this.commentSubscription=this.commentElement.getAllCommentAnnotations(this.documentId).subscribe((t=>{this.comments=null==t?void 0:t.filter((t=>{var e;return["open","inProgress"].includes(null==t?void 0:t.status)||["default","ongoing"].includes(null===(e=null==t?void 0:t.status)||void 0===e?void 0:e.type)}))})))}catch(t){console.warn("Error in getComments: ",t),Pa("Error in getComments: ",t)}},this.setQueryParamsCommentsInSdk=()=>{var t,e,i,o;try{this.commentElement&&(this.queryParamsComments&&(null===(t=this.commentElement)||void 0===t?void 0:t.enableQueryParamsComments)?null===(e=this.commentElement)||void 0===e||e.enableQueryParamsComments():!this.queryParamsComments&&(null===(i=this.commentElement)||void 0===i?void 0:i.disableQueryParamsComments)&&(null===(o=this.commentElement)||void 0===o||o.disableQueryParamsComments()))}catch(t){console.warn("Error in setQueryParamsCommentsInSdk: ",t),Pa("Error in setQueryParamsCommentsInSdk: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),Pa("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded,this.expanded?Ra(ht.Events.TOOLBAR_EXPANDED):Ra(ht.Events.TOOLBAR_COLLAPSED)}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Pa("Error in toggleSnippylyPluginToolbar: ",t)}},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.commentElement.disablePrivateCommentMode&&this.commentElement.disablePrivateCommentMode(),this.privateCommentModeEnabled=!1,Ra(ht.Events.PRIVATE_MODE_DISABLED)):(this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode(),this.privateCommentModeEnabled=!0,Ra(ht.Events.PRIVATE_MODE_ENABLED)),Ea($t,this.privateCommentModeEnabled.toString()))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),Pa("Error in togglePrivateCommentMode: ",t)}},this.checkPrivateCommentModeFromStorage=()=>{try{this.allFeatureDisabled||"Admin"!==this.snippylyUserRole||Sa($t)&&(this.privateCommentModeEnabled="true"===Sa($t),this.privateCommentModeEnabled&&this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode())}catch(t){console.warn("Error in checkPrivateCommentModeFromStorage: ",t),Pa("Error in checkPrivateCommentModeFromStorage: ",t)}},this.loginWithGoogle=()=>{try{if(Ra(ht.Events.SIGNIN_CLICKED),this.loading||this.customLoginEnabledLocally)return;window.open(this.signInUrl,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Pa("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=new URL(window.location.href);null==t||t.searchParams.set("review","true");const e=null==t?void 0:t.toString();if(e){const t=_a(e,Qt,Xt),i=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getqrcode?text=${encodeURIComponent(t)}`),o=await i.json();(null==o?void 0:o.qrcode)&&(this.qrCode=null==o?void 0:o.qrcode)}}catch(t){console.warn("Error in getQRCode: ",t),Pa("Error in getQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{Ra(ht.Events.OPEN_MOBILE_CLICKED),this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),Pa("Error in toggleQRCodeVisibility: ",t)}},this.onUserInviteToolClick=()=>{var t;(null===(t=this.snippylyUser)||void 0===t?void 0:t.isGuest)&&(this.guestModeSignInModalConfig.title="Sign in to invite others.",this.guestModeSignInModalConfig.description="Invite team members to comment on this project.",this.guestModeSignInModalConfig.showLeaveCommentButton=!1,this.guestModeSignInModalConfig.closeOnClickOutside=!0,this.openGuestModeSignInModal())},this.removeSnippyly=async()=>{try{Ra(ht.Events.EXIT_REVIEW_MODE_CLICKED),this.exitReviewModeCalled=!0,ka(mt),ka(gt),ka(ft),ka(Et,"sessionStorage"),ka(St,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(ft),e.delete(mt),e.delete(wt),e.delete(gt),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(kt),e.delete(Mt),e.delete(_t),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,t.href),window.location.reload()}catch(t){console.warn("Error in removeSnippyly: ",t),Pa("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{Ra(ht.Events.SIGNOUT_CLICKED),this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),await Snippyly.signOutUser(),ka(yt),ka(Ct),ka(It),ka($t),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Pa("Error in signOutUser: ",t)}},this.toggleMenu=(t,e)=>{try{t.stopPropagation(),this.menuOpenedId===e?this.menuOpenedId=void 0:this.menuOpenedId=e}catch(t){console.warn("Error in toggleMenu: ",t),Pa("Error in toggleMenu: ",t)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(t){console.warn("Error in copyLink: ",t),Pa("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${qt}`;Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)&&this.serverDocumentId&&(t=`${qt}/dashboard/project/comment/${this.apiKey}/${this.serverDocumentId}`),Ra(ht.Events.VIEW_PROJECT_CLICKED),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Pa("Error in goToAdminPortal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${qt}`;Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)&&this.serverDocumentId&&(t=`${qt}/dashboard`),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),Pa("Error in goToAdminPortalDashboard: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1q3jzsddt-NEb~uu9RXscLfxOIDGQXJw","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),Pa("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Ea(Mt,"true");const t=new URL(document.location);t.searchParams.delete(Mt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Pa("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Ea(_t,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(_t),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Pa("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Nt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),Pa("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://superflow-portal-staging-2023.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Pa("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,Ea(Tt,"true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Pa("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{Ra(ht.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),Pa("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,Ra(ht.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),Pa("Error in openGuestModeSignInModal: ",t)}},this.closeGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!1,this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig))}catch(t){console.warn("Error in closeGuestModeSignInModal: ",t),Pa("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{Ra(ht.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),Pa("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.skipGuestNameModal||(this.showGuestModeNameModal=!0,Ra(ht.Events.GUEST_MODE_NAME_NUDGE_SHOWN))}catch(t){console.warn("Error in openGuestModeNameModel: ",t),Pa("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),Pa("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{Ra(ht.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),Pa("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{Ra(ht.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),Pa("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{Ra(ht.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),Pa("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,Ra(ht.Events.GUEST_MODE_SIGN_IN_NUDGE_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),Pa("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),Pa("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{Ra(ht.Events.GUEST_MODE_SIGN_IN_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),Pa("Error in onGuestModeBannerSignInButtonClick: ",t)}},this.updateGuestUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;const e=Aa();if(e){const t=JSON.parse(JSON.stringify(e));e.name=this.guestUserNameInput,e.photoUrl=null,this.guestUserNameUpdateLoading=!0,(t=>{try{const e=JSON.stringify(t),i=_a(e,Qt,Xt);Ea(xt,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),Pa("Error in updateGuestUser: ",t)}})(e),await Snippyly.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await Ua(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,Ea(Rt,"true"),Ra(ht.Events.GUEST_MODE_NAME_ADDED,{oldName:null==t?void 0:t.name,newName:null==e?void 0:e.name})}this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateGuestUserName: ",t),Pa("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(Ra(ht.Events.REVIEW_PASSWORD_ADDED),!(null===(t=this.password)||void 0===t?void 0:t.trim()))return;if(this.validatingPasswordLoading)return;this.validatingPasswordLoading=!0,this.isPasswordValid=await(async(t,e,i)=>{var o;try{const n=yo(La,le,{timeout:12e5}),r=await n({apiKey:t,projectId:e,password:i});return null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in validatePassword: ",t),null}})(this.apiKey,this.projectId,this.password),function(t,e){try{const i="object"==typeof e?JSON.stringify(e):e;localStorage.setItem(t,i)}catch(t){console.warn("Error in setLocalStorage: ",t)}}(Ft,this.isPasswordValid),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,Velt&&Velt.disableFeatures([]),Ra(ht.Events.REVIEW_PASSWORD_ACCEPTED)):(this.showInvalidPassword=!0,Ra(ht.Events.REVIEW_PASSWORD_REJECTED)),this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),Pa("Error in submitPassword: ",t)}},this.updateUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;this.guestUserNameUpdateLoading=!0;const e=JSON.parse(JSON.stringify(this.snippylyUser)),i=JSON.parse(JSON.stringify(this.snippylyUser));i.name=this.guestUserNameInput,await Ua(this.apiKey,this.projectId||"",e,i),await Snippyly.updateUser(i),this.snippylyUser=JSON.parse(JSON.stringify(i));const o=Ta();o.name=i.name;const n=JSON.stringify(o),r=_a(n,Qt,Xt);Ea(Ct,r,!0),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),Pa("Error in updateUserName: ",t)}},this.disableCommentMode=()=>{var t;try{(null===(t=this.commentElement)||void 0===t?void 0:t.disableCommentMode)&&this.commentElement.disableCommentMode()}catch(t){console.warn("Error in disableAddCommentMode: ",t),Pa("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?L`
|
|
2663
2663
|
<div class="disable-add-comment-button" @click=${()=>this.disableCommentMode()}>
|
|
2664
2664
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2665
2665
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.52861 3.52858C3.78896 3.26823 4.21107 3.26823 4.47141 3.52858L8.00001 7.05717L11.5286 3.52858C11.789 3.26823 12.2111 3.26823 12.4714 3.52858C12.7318 3.78892 12.7318 4.21103 12.4714 4.47138L8.94282 7.99998L12.4714 11.5286C12.7318 11.7889 12.7318 12.211 12.4714 12.4714C12.2111 12.7317 11.789 12.7317 11.5286 12.4714L8.00001 8.94279L4.47141 12.4714C4.21107 12.7317 3.78896 12.7317 3.52861 12.4714C3.26826 12.211 3.26826 11.7889 3.52861 11.5286L7.0572 7.99998L3.52861 4.47138C3.26826 4.21103 3.26826 3.78892 3.52861 3.52858Z" fill="#FAFBFF"/>
|
|
2666
2666
|
</svg>
|
|
2667
2667
|
</div>
|
|
2668
|
-
`:L``}catch(t){return console.warn("Error in disableAddCommentModeButton: ",t),Pa("Error in disableAddCommentModeButton: ",t),L``}},this.addStyles=()=>{var t,e;try{const i=document.createElement("style");i.textContent=Ha.cssText,null===(t=this.shadowRoot)||void 0===t||t.appendChild(i);const o=document.createElement("style");o.textContent=Ga.cssText,null===(e=this.shadowRoot)||void 0===e||e.appendChild(o)}catch(t){console.warn("Error in addStyles: ",t),Pa("Error in addStyles: ",t)}},this._dragX=0,this._dragY=0,this._isDragging=!1,this._startX=0,this._startY=0,this.mouseMove=t=>{var e;if(this._isDragging){let i,o;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container");if(n){if(i=t.clientX-this._startX,o=t.clientY-this._startY,i>20||o>40)return;if(window.innerWidth-n.getBoundingClientRect().width- -1*i<20)return;if(window.innerHeight-n.getBoundingClientRect().height- -1*o<n.getBoundingClientRect().height)return;n.style.transform=`translate(${i}px, ${o}px)`}}},this.mouseDown=t=>{var e;const i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container");if(i){this._isDragging=!0;const e=window.getComputedStyle(i),o=new WebKitCSSMatrix(e.transform);this._startX=t.clientX-o.m41,this._startY=t.clientY-o.m42}},this.mouseUp=t=>{t&&(this._isDragging=!1)},this.mouseLeave=t=>{t&&(this._isDragging=!1)},this.guestUserNameUpdated=!!Sa(Rt);const t=new URL(document.location);t.searchParams.has(bt)&&t.searchParams.delete(bt),this.signInUrl=`${qt}/signin?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,this.signOutUrl=`${qt}/signout?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,ka(Ct),await this.checkCustomLoginEnabled()},identify:async t=>{this.providedUser=t,this.customLoginEnabled&&this.loginWithCustomUser()},signInUrl:this.signInUrl,signOutUrl:this.signOutUrl,openGuestModeSignInModal:t=>{this.skipGuestNameModal=t,this.openGuestModeSignInModal()},onPasswordProtectedModalOpenButtonClick:()=>{this.onPasswordProtectedModalOpenButtonClick()}};try{this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Pa("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){var e,i,o,n,r,s,a,l,c,d;this._loadPlugin=t,this.loadPlugin?(this.classList.add("visible"),null===(i=null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.style)||void 0===i||i.setProperty("transform","none","important"),null===(r=null===(n=null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.parentElement)||void 0===n?void 0:n.style)||void 0===r||r.setProperty("transform","none","important"),null===(a=null===(s=null===document||void 0===document?void 0:document.body)||void 0===s?void 0:s.style)||void 0===a||a.setProperty("perspective","none","important"),null===(d=null===(c=null===(l=null===document||void 0===document?void 0:document.body)||void 0===l?void 0:l.parentElement)||void 0===c?void 0:c.style)||void 0===d||d.setProperty("perspective","none","important")):this.classList.remove("visible")}get expanded(){return this._expanded}set expanded(t){this._expanded=t,this.expanded?this.classList.add("expanded"):this.classList.remove("expanded")}get isPlanExpired(){return this._isPlanExpired}set isPlanExpired(t){this._isPlanExpired=t,this.checkToEnableUpgradeButton()}get apiKey(){return this._apiKey}set apiKey(t){this._apiKey=t,this.onApiKeyChange(),$a({apiKey:this.apiKey}),this.checkUrl()}get projectId(){return this._projectId}set projectId(t){this._projectId=t,this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&Ea(Et,this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Pa("Error in set projectVersionKey: ",t)}}get autoLocation(){return this._autoLocation}set autoLocation(t){this._autoLocation="true"===t||!0===t}get menuOpenedId(){return this._menuOpenedId}set menuOpenedId(t){this._menuOpenedId=t,this.menuOpenedId?this.addWindowClickEventListener():this.removeWindowClickEventListener()}get isUserGlobalContact(){return this._isUserGlobalContact}set isUserGlobalContact(t){this._isUserGlobalContact=t,this.checkToEnableUpgradeButton()}get privateCommentModeEnabled(){return this._privateCommentModeEnabled}set privateCommentModeEnabled(t){this._privateCommentModeEnabled=t,this.darkMode=!!this.privateCommentModeEnabled}get customerMetadata(){return this._customerMetadata}set customerMetadata(t){this._customerMetadata=t,this.setLogos()}get documentMetadata(){return this._documentMetadata}set documentMetadata(t){this._documentMetadata=t}get darkMode(){return this._darkMode}set darkMode(t){this._darkMode=t,this.setLogos()}get queryParamsComments(){return this._queryParamsComments}set queryParamsComments(t){this._queryParamsComments=t,this.setQueryParamsCommentsInSdk()}get usePageTitleAsLocationName(){return this._usePageTitleAsLocationName}set usePageTitleAsLocationName(t){this._usePageTitleAsLocationName=t}get totalViews(){return this._totalViews}set totalViews(t){this._totalViews=t,this.totalViewsCount=Object.keys(this.totalViews||{}).length}connectedCallback(){super.connectedCallback(),this.getAttribute("apiKey")&&!this.getAttribute("projectId")&&(this.projectId=ya(Ca(window.location.origin))+""),this.expanded=!0,this.setAttribute("data-velt-comment-disabled","true"),this.style.zIndex="2147483647",setTimeout((()=>{if(!this.superflowToolbarMoved){this.superflowToolbarMoved=!0,document.body.appendChild(this);const t=document.querySelector(".cdk-overlay-container");t&&document.body.appendChild(t)}}),5e3);const t=document.createElement("style");t.innerHTML='body[data-velt-ongoing-recording="screen"] superflow-toolbar { display: none !important; }',document.head.appendChild(t),this.addStyles(),setTimeout((()=>{const t=document.querySelectorAll('script[src*="snippyly.min.js"]');(null==t?void 0:t.length)>1&&(console.warn("Multiple superflow scripts installed."),Ra(ht.Events.DUPLICATE_SCRIPT_INSTALLED))}),1e3)}async detectToolbarEnabled(){try{if(this.projectId&&this.apiKey){this.toolbarEnabledApiCalled=!0;const t=document.location.toString();t.includes(Ht)||t.includes(Bt)?this.toolbarEnabled=!0:this.toolbarEnabled=await(async(t,e,i)=>{var o;try{const n=yo(La,ce,{timeout:12e5}),r=await n({apiKey:t,projectId:e,url:i});return null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in checkToolbarEnabled: ",t),null}})(this.apiKey,this.projectId,t),this.toolbarEnabled||Ra(ht.Events.TOOLBAR_DISABLED)}}catch(t){console.warn("Error in detectToolbarEnabled: ",t),Pa("Error in detectToolbarEnabled: ",t)}}render(){var t,e,i,o,n,r,s,a,l,c,d,h,u,p,v,m,g,f;return this.loadPlugin&&this.toolbarEnabled?!this.snippylyUser||this.loading||null===this.isPlanExpired?L`
|
|
2668
|
+
`:L``}catch(t){return console.warn("Error in disableAddCommentModeButton: ",t),Pa("Error in disableAddCommentModeButton: ",t),L``}},this.addStyles=()=>{var t,e;try{const i=document.createElement("style");i.textContent=Ha.cssText,null===(t=this.shadowRoot)||void 0===t||t.appendChild(i);const o=document.createElement("style");o.textContent=Ga.cssText,null===(e=this.shadowRoot)||void 0===e||e.appendChild(o)}catch(t){console.warn("Error in addStyles: ",t),Pa("Error in addStyles: ",t)}},this.checkToolbarPosition=()=>{var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".snippyly-plugin-container");e&&requestAnimationFrame((()=>{var t;const{x:i}=e.getBoundingClientRect();if(i>=0)return;const o=e.style.transform,[n,r]=(null===(t=o.match(/translate\(([-\d.]+)px,\s*([-\d.]+)px\)/))||void 0===t?void 0:t.slice(1))||[],s=parseInt(n)-i;e.style.transform=`translate(${s||0}px, ${r||0}px)`}))},this._dragX=0,this._dragY=0,this._isDragging=!1,this._startX=0,this._startY=0,this.mouseMove=t=>{var e;if(this._isDragging){let i,o;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container");if(n){if(i=t.clientX-this._startX,o=t.clientY-this._startY,i>20||o>40)return;if(window.innerWidth-n.getBoundingClientRect().width- -1*i<20)return;if(window.innerHeight-n.getBoundingClientRect().height- -1*o<n.getBoundingClientRect().height)return;n.style.transform=`translate(${i}px, ${o}px)`}}},this.mouseDown=t=>{var e;const i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container");if(i){this._isDragging=!0;const e=window.getComputedStyle(i),o=new WebKitCSSMatrix(e.transform);this._startX=t.clientX-o.m41,this._startY=t.clientY-o.m42}},this.mouseUp=t=>{t&&(this._isDragging=!1)},this.mouseLeave=t=>{t&&(this._isDragging=!1)},this.guestUserNameUpdated=!!Sa(Rt);const t=new URL(document.location);t.searchParams.has(bt)&&t.searchParams.delete(bt),this.signInUrl=`${qt}/signin?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,this.signOutUrl=`${qt}/signout?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,ka(Ct),await this.checkCustomLoginEnabled()},identify:async t=>{this.providedUser=t,this.customLoginEnabled&&this.loginWithCustomUser()},signInUrl:this.signInUrl,signOutUrl:this.signOutUrl,openGuestModeSignInModal:t=>{this.skipGuestNameModal=t,this.openGuestModeSignInModal()},onPasswordProtectedModalOpenButtonClick:()=>{this.onPasswordProtectedModalOpenButtonClick()}};try{this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Pa("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){var e,i,o,n,r,s,a,l,c,d;this._loadPlugin=t,this.loadPlugin?(this.classList.add("visible"),null===(i=null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.style)||void 0===i||i.setProperty("transform","none","important"),null===(r=null===(n=null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.parentElement)||void 0===n?void 0:n.style)||void 0===r||r.setProperty("transform","none","important"),null===(a=null===(s=null===document||void 0===document?void 0:document.body)||void 0===s?void 0:s.style)||void 0===a||a.setProperty("perspective","none","important"),null===(d=null===(c=null===(l=null===document||void 0===document?void 0:document.body)||void 0===l?void 0:l.parentElement)||void 0===c?void 0:c.style)||void 0===d||d.setProperty("perspective","none","important")):this.classList.remove("visible")}get expanded(){return this._expanded}set expanded(t){this._expanded=t,this.expanded?this.classList.add("expanded"):this.classList.remove("expanded")}get isPlanExpired(){return this._isPlanExpired}set isPlanExpired(t){this._isPlanExpired=t,this.checkToEnableUpgradeButton()}get apiKey(){return this._apiKey}set apiKey(t){this._apiKey=t,this.onApiKeyChange(),$a({apiKey:this.apiKey}),this.checkUrl()}get projectId(){return this._projectId}set projectId(t){this._projectId=t,this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&Ea(Et,this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Pa("Error in set projectVersionKey: ",t)}}get autoLocation(){return this._autoLocation}set autoLocation(t){this._autoLocation="true"===t||!0===t}get menuOpenedId(){return this._menuOpenedId}set menuOpenedId(t){this._menuOpenedId=t,this.menuOpenedId?this.addWindowClickEventListener():this.removeWindowClickEventListener()}get isUserGlobalContact(){return this._isUserGlobalContact}set isUserGlobalContact(t){this._isUserGlobalContact=t,this.checkToEnableUpgradeButton()}get privateCommentModeEnabled(){return this._privateCommentModeEnabled}set privateCommentModeEnabled(t){this._privateCommentModeEnabled=t,this.darkMode=!!this.privateCommentModeEnabled}get customerMetadata(){return this._customerMetadata}set customerMetadata(t){this._customerMetadata=t,this.setLogos()}get documentMetadata(){return this._documentMetadata}set documentMetadata(t){this._documentMetadata=t}get darkMode(){return this._darkMode}set darkMode(t){this._darkMode=t,this.setLogos()}get queryParamsComments(){return this._queryParamsComments}set queryParamsComments(t){this._queryParamsComments=t,this.setQueryParamsCommentsInSdk()}get usePageTitleAsLocationName(){return this._usePageTitleAsLocationName}set usePageTitleAsLocationName(t){this._usePageTitleAsLocationName=t}get totalViews(){return this._totalViews}set totalViews(t){this._totalViews=t,this.totalViewsCount=Object.keys(this.totalViews||{}).length}connectedCallback(){super.connectedCallback(),this.getAttribute("apiKey")&&!this.getAttribute("projectId")&&(this.projectId=ya(Ca(window.location.origin))+""),this.expanded=!0,this.setAttribute("data-velt-comment-disabled","true"),this.style.zIndex="2147483647",setTimeout((()=>{if(!this.superflowToolbarMoved){this.superflowToolbarMoved=!0,document.body.appendChild(this);const t=document.querySelector(".cdk-overlay-container");t&&document.body.appendChild(t)}}),5e3);const t=document.createElement("style");t.innerHTML='body[data-velt-ongoing-recording="screen"] superflow-toolbar { display: none !important; }',document.head.appendChild(t),this.addStyles(),setTimeout((()=>{const t=document.querySelectorAll('script[src*="snippyly.min.js"]');(null==t?void 0:t.length)>1&&(console.warn("Multiple superflow scripts installed."),Ra(ht.Events.DUPLICATE_SCRIPT_INSTALLED))}),1e3)}async detectToolbarEnabled(){try{if(this.projectId&&this.apiKey){this.toolbarEnabledApiCalled=!0;const t=document.location.toString();t.includes(Ht)||t.includes(Bt)?this.toolbarEnabled=!0:this.toolbarEnabled=await(async(t,e,i)=>{var o;try{const n=yo(La,ce,{timeout:12e5}),r=await n({apiKey:t,projectId:e,url:i});return null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in checkToolbarEnabled: ",t),null}})(this.apiKey,this.projectId,t),this.toolbarEnabled||Ra(ht.Events.TOOLBAR_DISABLED)}}catch(t){console.warn("Error in detectToolbarEnabled: ",t),Pa("Error in detectToolbarEnabled: ",t)}}render(){var t,e,i,o,n,r,s,a,l,c,d,h,u,p,v,m,g,f;return this.loadPlugin&&this.toolbarEnabled?!this.snippylyUser||this.loading||null===this.isPlanExpired?L`
|
|
2669
2669
|
<div class="snippyly-plugin-container" part="superflow-toolbar-container">
|
|
2670
2670
|
<div class="toolbar" id="smallToolbar"
|
|
2671
2671
|
@mousemove=${t=>this.mouseMove(t)}
|
|
@@ -2890,7 +2890,7 @@ class ca extends Jn{}ca.Encryptor=class extends ca{processBlock(t,e){const i=t,o
|
|
|
2890
2890
|
`:L`
|
|
2891
2891
|
<div class="snippyly-plugin-container" part="superflow-toolbar-container">
|
|
2892
2892
|
${this.disableCommentModeButton()}
|
|
2893
|
-
<div class="toolbar ${lt({expanded:this.expanded,"add-comment-mode":this.addCommentMode,"private-comment-mode":!!this.privateCommentModeEnabled})}"
|
|
2893
|
+
<div class="toolbar ${lt({expanded:this.expanded,"add-comment-mode":this.addCommentMode,"private-comment-mode":!!this.privateCommentModeEnabled})}" @resize=${this.checkToolbarPosition()}
|
|
2894
2894
|
@mousemove=${t=>this.mouseMove(t)}
|
|
2895
2895
|
@mousedown=${t=>this.mouseDown(t)}
|
|
2896
2896
|
@mouseup=${t=>this.mouseUp(t)}
|
|
@@ -2919,7 +2919,7 @@ class ca extends Jn{}ca.Encryptor=class extends ca{processBlock(t,e){const i=t,o
|
|
|
2919
2919
|
|
|
2920
2920
|
</div>
|
|
2921
2921
|
`:L`
|
|
2922
|
-
<div class="toolbar-section snippyly-logo ${lt({"d-xs-none":this.expanded
|
|
2922
|
+
<div class="toolbar-section snippyly-logo ${lt({"d-xs-none":this.expanded})}" @click=${()=>this.toggleSnippylyPluginToolbar()}>
|
|
2923
2923
|
<div class="toolbar-logo">
|
|
2924
2924
|
${this.getLogoMark()}
|
|
2925
2925
|
</div>
|
|
@@ -2963,7 +2963,7 @@ class ca extends Jn{}ca.Encryptor=class extends ca{processBlock(t,e){const i=t,o
|
|
|
2963
2963
|
<!-- actions -->
|
|
2964
2964
|
<div class="toolbar-section huddle-recorder-section ${lt({"d-none":!this.expanded})}">
|
|
2965
2965
|
<div class="toolbar-actions">
|
|
2966
|
-
${this.allFeatureDisabled||"Admin"!==this.snippylyUserRole?null:L`<div class="action tooltip private-comment-mode-switch-container ${lt({enabled:!!this.privateCommentModeEnabled,"d-none"
|
|
2966
|
+
${this.allFeatureDisabled||"Admin"!==this.snippylyUserRole?null:L`<div class="action tooltip private-comment-mode-switch-container ${lt({enabled:!!this.privateCommentModeEnabled,"d-none":this.addCommentMode})}" @click=${()=>this.togglePrivateCommentMode()}>
|
|
2967
2967
|
<div class="tooltiptext">
|
|
2968
2968
|
<h3 class="title">Private Mode</h3>
|
|
2969
2969
|
<p class="body">By enabling this Only admins <br/> can view your new comment</p>
|
package/superflow.min.js
CHANGED
|
@@ -2659,13 +2659,13 @@ class da extends Yn{}da.Encryptor=class extends da{processBlock(t,e){const i=t,o
|
|
|
2659
2659
|
${ht(this.wordMark)}
|
|
2660
2660
|
`:D`
|
|
2661
2661
|
<img src=${this.wordMark} />
|
|
2662
|
-
`}catch(t){return console.warn("Error in getWordMark: ",t),D``}},this.generateLocation=()=>{try{if(this.autoLocation){const t=new URL(document.location).searchParams,e=new URL(document.location);e.searchParams.delete(gt),e.searchParams.delete(ft),e.searchParams.delete(wt),e.searchParams.delete(yt),e.searchParams.delete(_t),e.searchParams.delete(Nt);const i=t.get(Mt)||this.projectVersion;this.queryParamsComments||(e.search="");let o=(t=>{try{return t.replace(/#.*$/,"")}catch(e){return console.warn("Error in removeHashFromUrl: ",e),Ra("Error in removeHashFromUrl: ",e),t}})(e.href);this.projectId&&(o=null==o?void 0:o.replace(window.location.origin,"")),this.location={url:o,version:i}}}catch(t){console.warn("Error in generateLocation: ",t),Ra("Error in generateLocation: ",t)}},this.setLocation=()=>{var t,e,i,o;try{if(this.autoLocation&&window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)){if(this.version?(this.location||(this.location={}),this.location.version=this.version):this.location&&delete this.location.version,this.previousLocation&&(null===(t=this.previousLocation)||void 0===t?void 0:t.url)===(null===(e=this.location)||void 0===e?void 0:e.url)&&(null===(i=this.previousLocation)||void 0===i?void 0:i.version)===(null===(o=this.location)||void 0===o?void 0:o.version))return;const n=(t=>{try{const e=Ca(t);return ba(JSON.stringify(e))}catch(t){return}})(JSON.parse(JSON.stringify(this.location)));if(n?this.location.id=`${n}`:delete this.location.id,this.usePageTitleAsLocationName){const t=document.title;t&&(this.location.locationName=t)}null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))),ja({clientLocation:this.location}),this.previousLocation=JSON.parse(JSON.stringify(this.location)),this.onVeltLocationChange()}}catch(t){console.warn("Error in setLocation: ",t),Ra("Error in setLocation: ",t)}},this.onVeltLocationChange=()=>{try{window.dispatchEvent(new CustomEvent("veltLocationChange",{detail:this.location}))}catch(t){console.warn("Error in onVeltLocationChange: ",t),Ra("Error in onVeltLocationChange: ",t)}},this.identifySnippyly=async()=>{var t,e;let i="",o="";try{this.invalidApiKey=!1;let e,n={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0};e=this.customLoginEnabled&&this.providedUser?this.providedUser:Ia();const r=await this.getSamlConfig();if(r&&(this.signInUrl=`${Qt}saml/${r.slug}/login?source=sf`),(null==e?void 0:e.email)&&(n=e),n.isAnonymous)delete n.groupId;else{const t=Snippyly.getDocumentId()||this.serverDocumentId;t&&(n.groupId=t+"")}if(this.customLoginEnabledLocally||(null===(t=null==n?void 0:n.contacts)||void 0===t?void 0:t.length)&&(n.contacts=[]),i=null==n?void 0:n.email,o=null==n?void 0:n.userId,(null==n?void 0:n.isAnonymous)&&this.projectId&&this.guestMode){const t=Oa();t&&(n=JSON.parse(JSON.stringify(t)))}let s;(null==n?void 0:n.isAnonymous)||(this.loading=!0),(null==n?void 0:n.groupId)&&(s||(s={}),s.groupId=null==n?void 0:n.groupId);const a=await(async(t,e,i)=>{var o,n;try{const r=bo(Da,re,{timeout:12e5}),s=await r({apiKey:t,userId:e,userProperties:i});return null===(n=null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.data)||void 0===n?void 0:n.token}catch(t){return console.warn("Error in generateSuperflowAuthToken: ",t),null}})(this.apiKey,null==n?void 0:n.userId,s),l={};a&&(l.authToken=a);const c=await Snippyly.identify(n,l);Pa(JSON.parse(JSON.stringify(c||{}))),(null==n?void 0:n.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(n)));const d=JSON.parse(JSON.stringify(c||{}));(null==d?void 0:d.userSnippylyId)&&!(null==d?void 0:d.isGuest)&&this.checkToMigrateGuestUser(d),Snippyly.getUserRole$().subscribe((t=>{var e;this.loading=!1,this.snippylyUserRole=t,"Admin"===this.snippylyUserRole&&this.allFeatureDisabled&&(this.allFeatureDisabled=!1),this.snippylyUserRole||Va(ut.Events.USER_EMAIL_NOT_WHITELISTED),null===(e=this.commentElement)||void 0===e||e.enablePriority(),this.checkPrivateCommentModeFromStorage()})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getFeaturesAccessLevelIam$)&&this.subscriptions.push(Snippyly.getFeaturesAccessLevelIam$().subscribe((async t=>{var e,i,o,n,r,s,a,l;this.allFeatureDisabled=!!(null===(e=null==t?void 0:t.all)||void 0===e?void 0:e.disabled)&&"Admin"!==this.snippylyUserRole,this.allFeatureRestricted=!!(null===(i=null==t?void 0:t.all)||void 0===i?void 0:i.restricted),this.guestMode=!!(null===(o=null==t?void 0:t.all)||void 0===o?void 0:o.guestMode),this.allowGuestModeSignIn=!!(null===(r=null===(n=null==t?void 0:t.all)||void 0===n?void 0:n.guestModeConfig)||void 0===r?void 0:r.allowSignIn),this.guestMode&&Va(ut.Events.GUEST_MODE_PRESENT),(null===(s=null==t?void 0:t.all)||void 0===s?void 0:s.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(l=null===(a=null==t?void 0:t.all)||void 0===a?void 0:a.passwordProtected)||void 0===l?void 0:l.enabled),Velt&&(t&&this.passwordProtected&&!this.isPasswordValid?Velt.disableFeatures(["area","arrow","audioHuddle","cursor","huddle","liveStateSync","presence","tag","recorder","comment"]):Velt.disableFeatures([]),Velt.getCommentElement().onCommentModeChange().subscribe((t=>{0==t&&1==this.privateCommentModeEnabled&&this.togglePrivateCommentMode()}))),Sa(Ot,this.guestMode+"",!0),Sa(Pt,this.allowGuestModeSignIn+"",!0),Sa(Lt,this.passwordProtected+"",!0)}),(t=>{this.loading=!1,console.warn("Error in getFeaturesAccessLevelIam$: ",t),Ra("Error in getFeaturesAccessLevelIam$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.isPlanExpired$)&&(null===Snippyly||void 0===Snippyly||Snippyly.isPlanExpired$().subscribe((t=>{this.isPlanExpired=t}),(t=>{this.isPlanExpired=!1,console.warn("Error in isPlanExpired$: ",t),Ra("Error in isPlanExpired$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCustomerMetadata$)&&(null===Snippyly||void 0===Snippyly||Snippyly.getCustomerMetadata$().subscribe((t=>{La(t),t&&(this.customerMetadata=t)}),(t=>{console.warn("Error in getCustomerMetadata$: ",t),Ra("Error in getCustomerMetadata$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentMetadata)&&(null===Snippyly||void 0===Snippyly||Snippyly.getDocumentMetadata().subscribe((t=>{var e,i;t&&(this.queryParamsComments=!!(null===(e=null==t?void 0:t.extraConfig)||void 0===e?void 0:e.queryParamsComments),Sa(Dt,this.queryParamsComments+"",!0),this.usePageTitleAsLocationName=!!(null===(i=null==t?void 0:t.extraConfig)||void 0===i?void 0:i.usePageTitleAsLocationName),Sa(Ft,this.usePageTitleAsLocationName+"",!0))}),(t=>{console.warn("Error in getDocumentMetadata: ",t),Ra("Error in getDocumentMetadata: ",t)}))),ja({clientUserId:null==n?void 0:n.userId});try{(t=>{var e,i,o,n,r,s,a,l,c,d,h,u;const p={properties:{apiKey:null!==(e=null==$a?void 0:$a.apiKey)&&void 0!==e?e:"",name:null!==(i=null==t?void 0:t.name)&&void 0!==i?i:"",firstName:(null==t?void 0:t.name)?null===(o=null==t?void 0:t.name)||void 0===o?void 0:o.split(" ")[0]:"",lastName:(null==t?void 0:t.name)?null===(n=null==t?void 0:t.name)||void 0===n?void 0:n.split(" ")[1]:"",email:null!==(r=null==t?void 0:t.email)&&void 0!==r?r:"",clientUserId:null!==(s=null==t?void 0:t.userId)&&void 0!==s?s:"",snippylyUserId:null!==(a=null==t?void 0:t.userSnippylyId)&&void 0!==a?a:"",groupId:null!==(l=null==t?void 0:t.groupId)&&void 0!==l?l:"",isOwner:"",plan:"",sdkVersion:null!==(c=null==$a?void 0:$a.sdkVersion)&&void 0!==c?c:"",sdkType:null!==(d=null==$a?void 0:$a.sdkType)&&void 0!==d?d:"",sourcePlatform:null!==(h=null==$a?void 0:$a.sourcePlatform)&&void 0!==h?h:"",website:null===(u=null===window||void 0===window?void 0:window.location)||void 0===u?void 0:u.href},context:{userAgent:null===navigator||void 0===navigator?void 0:navigator.userAgent},userId:null==t?void 0:t.userSnippylyId,sf:!0};Ua("identify",p)})(n)}catch(t){console.warn("Error in trackIdentifyEvent: ",t)}this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{ka(It)||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){if(this.loading=!1,this.signInError=!0,t&&"string"==typeof t&&(null===(e=null==t?void 0:t.toLowerCase())||void 0===e?void 0:e.includes("invalid"))){this.invalidApiKey=!0,Va(ut.Events.DOMAIN_NOT_WHITELISTED),this.projectId&&(async(t,e)=>{try{const i=bo(Da,ie,{timeout:12e5});await i({apiKey:t,projectId:e})}catch(t){console.warn("Error in checkDomainWhitelisted: ",t)}})(this.apiKey,this.projectId);if(new URL(document.location).searchParams.has(_t))this.isSigningInUserAdmin=!0;else if(ka(At))this.isSigningInUserAdmin="true"===ka(At,!0);else{const t=await(async(t,e,i,o)=>{try{const n=bo(Da,oe,{timeout:12e5}),r=await n({apiKey:t,projectId:e,email:i,userId:o});return null==r?void 0:r.data}catch(t){return console.warn("Error in iam: ",t),null}})(this.apiKey,this.projectId||"",i,o);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),Sa(At,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),Ra("Error in identifySnippyly: ",t)}},this.checkToMigrateGuestUser=async t=>{try{const e=Oa(!1);e&&(await za(this.apiKey,this.projectId||"",e,t,!0),Ma(Et))}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),Ra("Error in checkToMigrationGuestUser: ",t)}},this.getComments=()=>{try{this.commentElement&&(this.commentSubscription&&this.commentSubscription.unsubscribe(),this.commentSubscription=this.commentElement.getAllCommentAnnotations(this.documentId).subscribe((t=>{this.comments=null==t?void 0:t.filter((t=>{var e;return["open","inProgress"].includes(null==t?void 0:t.status)||["default","ongoing"].includes(null===(e=null==t?void 0:t.status)||void 0===e?void 0:e.type)}))})))}catch(t){console.warn("Error in getComments: ",t),Ra("Error in getComments: ",t)}},this.setQueryParamsCommentsInSdk=()=>{var t,e,i,o;try{this.commentElement&&(this.queryParamsComments&&(null===(t=this.commentElement)||void 0===t?void 0:t.enableQueryParamsComments)?null===(e=this.commentElement)||void 0===e||e.enableQueryParamsComments():!this.queryParamsComments&&(null===(i=this.commentElement)||void 0===i?void 0:i.disableQueryParamsComments)&&(null===(o=this.commentElement)||void 0===o||o.disableQueryParamsComments()))}catch(t){console.warn("Error in setQueryParamsCommentsInSdk: ",t),Ra("Error in setQueryParamsCommentsInSdk: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),Ra("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded,this.expanded?Va(ut.Events.TOOLBAR_EXPANDED):Va(ut.Events.TOOLBAR_COLLAPSED)}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Ra("Error in toggleSnippylyPluginToolbar: ",t)}},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.commentElement.disablePrivateCommentMode&&this.commentElement.disablePrivateCommentMode(),this.privateCommentModeEnabled=!1,Va(ut.Events.PRIVATE_MODE_DISABLED)):(this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode(),this.privateCommentModeEnabled=!0,Va(ut.Events.PRIVATE_MODE_ENABLED)),Sa(jt,this.privateCommentModeEnabled.toString()))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),Ra("Error in togglePrivateCommentMode: ",t)}},this.checkPrivateCommentModeFromStorage=()=>{try{this.allFeatureDisabled||"Admin"!==this.snippylyUserRole||ka(jt)&&(this.privateCommentModeEnabled="true"===ka(jt),this.privateCommentModeEnabled&&this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode())}catch(t){console.warn("Error in checkPrivateCommentModeFromStorage: ",t),Ra("Error in checkPrivateCommentModeFromStorage: ",t)}},this.loginWithGoogle=()=>{try{if(Va(ut.Events.SIGNIN_CLICKED),this.loading||this.customLoginEnabledLocally)return;window.open(this.signInUrl,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Ra("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=new URL(window.location.href);null==t||t.searchParams.set("review","true");const e=null==t?void 0:t.toString();if(e){const t=Na(e,Xt,te),i=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getqrcode?text=${encodeURIComponent(t)}`),o=await i.json();(null==o?void 0:o.qrcode)&&(this.qrCode=null==o?void 0:o.qrcode)}}catch(t){console.warn("Error in getQRCode: ",t),Ra("Error in getQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{Va(ut.Events.OPEN_MOBILE_CLICKED),this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),Ra("Error in toggleQRCodeVisibility: ",t)}},this.onUserInviteToolClick=()=>{var t;(null===(t=this.snippylyUser)||void 0===t?void 0:t.isGuest)&&(this.guestModeSignInModalConfig.title="Sign in to invite others.",this.guestModeSignInModalConfig.description="Invite team members to comment on this project.",this.guestModeSignInModalConfig.showLeaveCommentButton=!1,this.guestModeSignInModalConfig.closeOnClickOutside=!0,this.openGuestModeSignInModal())},this.removeSnippyly=async()=>{try{Va(ut.Events.EXIT_REVIEW_MODE_CLICKED),this.exitReviewModeCalled=!0,Ma(gt),Ma(ft),Ma(wt),Ma(St,"sessionStorage"),Ma(kt,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(wt),e.delete(gt),e.delete(yt),e.delete(ft),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(Mt),e.delete(_t),e.delete(Nt),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,t.href),window.location.reload()}catch(t){console.warn("Error in removeSnippyly: ",t),Ra("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{Va(ut.Events.SIGNOUT_CLICKED),this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),await Snippyly.signOutUser(),Ma(bt),Ma(xt),Ma(At),Ma(jt),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Ra("Error in signOutUser: ",t)}},this.toggleMenu=(t,e)=>{try{t.stopPropagation(),this.menuOpenedId===e?this.menuOpenedId=void 0:this.menuOpenedId=e}catch(t){console.warn("Error in toggleMenu: ",t),Ra("Error in toggleMenu: ",t)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(t){console.warn("Error in copyLink: ",t),Ra("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${Qt}`;Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)&&this.serverDocumentId&&(t=`${Qt}/dashboard/project/comment/${this.apiKey}/${this.serverDocumentId}`),Va(ut.Events.VIEW_PROJECT_CLICKED),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Ra("Error in goToAdminPortal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${Qt}`;Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)&&this.serverDocumentId&&(t=`${Qt}/dashboard`),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),Ra("Error in goToAdminPortalDashboard: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1q3jzsddt-NEb~uu9RXscLfxOIDGQXJw","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),Ra("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Sa(_t,"true");const t=new URL(document.location);t.searchParams.delete(_t),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Ra("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Sa(Nt,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(Nt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Ra("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Tt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),Ra("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://superflow-portal-staging-2023.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Ra("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,Sa(It,"true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Ra("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{Va(ut.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),Ra("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,Va(ut.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),Ra("Error in openGuestModeSignInModal: ",t)}},this.closeGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!1,this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig))}catch(t){console.warn("Error in closeGuestModeSignInModal: ",t),Ra("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{Va(ut.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),Ra("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.skipGuestNameModal||(this.showGuestModeNameModal=!0,Va(ut.Events.GUEST_MODE_NAME_NUDGE_SHOWN))}catch(t){console.warn("Error in openGuestModeNameModel: ",t),Ra("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),Ra("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{Va(ut.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),Ra("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{Va(ut.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),Ra("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{Va(ut.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),Ra("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,Va(ut.Events.GUEST_MODE_SIGN_IN_NUDGE_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),Ra("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),Ra("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{Va(ut.Events.GUEST_MODE_SIGN_IN_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),Ra("Error in onGuestModeBannerSignInButtonClick: ",t)}},this.updateGuestUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;const e=Oa();if(e){const t=JSON.parse(JSON.stringify(e));e.name=this.guestUserNameInput,e.photoUrl=null,this.guestUserNameUpdateLoading=!0,(t=>{try{const e=JSON.stringify(t),i=Na(e,Xt,te);Sa(Et,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),Ra("Error in updateGuestUser: ",t)}})(e),await Snippyly.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await za(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,Sa(Vt,"true"),Va(ut.Events.GUEST_MODE_NAME_ADDED,{oldName:null==t?void 0:t.name,newName:null==e?void 0:e.name})}this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateGuestUserName: ",t),Ra("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(Va(ut.Events.REVIEW_PASSWORD_ADDED),!(null===(t=this.password)||void 0===t?void 0:t.trim()))return;if(this.validatingPasswordLoading)return;this.validatingPasswordLoading=!0,this.isPasswordValid=await(async(t,e,i)=>{var o;try{const n=bo(Da,ce,{timeout:12e5}),r=await n({apiKey:t,projectId:e,password:i});return null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in validatePassword: ",t),null}})(this.apiKey,this.projectId,this.password),function(t,e){try{const i="object"==typeof e?JSON.stringify(e):e;localStorage.setItem(t,i)}catch(t){console.warn("Error in setLocalStorage: ",t)}}($t,this.isPasswordValid),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,Velt&&Velt.disableFeatures([]),Va(ut.Events.REVIEW_PASSWORD_ACCEPTED)):(this.showInvalidPassword=!0,Va(ut.Events.REVIEW_PASSWORD_REJECTED)),this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),Ra("Error in submitPassword: ",t)}},this.updateUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;this.guestUserNameUpdateLoading=!0;const e=JSON.parse(JSON.stringify(this.snippylyUser)),i=JSON.parse(JSON.stringify(this.snippylyUser));i.name=this.guestUserNameInput,await za(this.apiKey,this.projectId||"",e,i),await Snippyly.updateUser(i),this.snippylyUser=JSON.parse(JSON.stringify(i));const o=Ia();o.name=i.name;const n=JSON.stringify(o),r=Na(n,Xt,te);Sa(xt,r,!0),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),Ra("Error in updateUserName: ",t)}},this.disableCommentMode=()=>{var t;try{(null===(t=this.commentElement)||void 0===t?void 0:t.disableCommentMode)&&this.commentElement.disableCommentMode()}catch(t){console.warn("Error in disableAddCommentMode: ",t),Ra("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?D`
|
|
2662
|
+
`}catch(t){return console.warn("Error in getWordMark: ",t),D``}},this.generateLocation=()=>{try{if(this.autoLocation){const t=new URL(document.location).searchParams,e=new URL(document.location);e.searchParams.delete(gt),e.searchParams.delete(ft),e.searchParams.delete(wt),e.searchParams.delete(yt),e.searchParams.delete(_t),e.searchParams.delete(Nt);const i=t.get(Mt)||this.projectVersion;this.queryParamsComments||(e.search="");let o=(t=>{try{return t.replace(/#.*$/,"")}catch(e){return console.warn("Error in removeHashFromUrl: ",e),Ra("Error in removeHashFromUrl: ",e),t}})(e.href);this.projectId&&(o=null==o?void 0:o.replace(window.location.origin,"")),this.location={url:o,version:i}}}catch(t){console.warn("Error in generateLocation: ",t),Ra("Error in generateLocation: ",t)}},this.setLocation=()=>{var t,e,i,o;try{if(this.autoLocation&&window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)){if(this.version?(this.location||(this.location={}),this.location.version=this.version):this.location&&delete this.location.version,this.previousLocation&&(null===(t=this.previousLocation)||void 0===t?void 0:t.url)===(null===(e=this.location)||void 0===e?void 0:e.url)&&(null===(i=this.previousLocation)||void 0===i?void 0:i.version)===(null===(o=this.location)||void 0===o?void 0:o.version))return;const n=(t=>{try{const e=Ca(t);return ba(JSON.stringify(e))}catch(t){return}})(JSON.parse(JSON.stringify(this.location)));if(n?this.location.id=`${n}`:delete this.location.id,this.usePageTitleAsLocationName){const t=document.title;t&&(this.location.locationName=t)}null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))),ja({clientLocation:this.location}),this.previousLocation=JSON.parse(JSON.stringify(this.location)),this.onVeltLocationChange()}}catch(t){console.warn("Error in setLocation: ",t),Ra("Error in setLocation: ",t)}},this.onVeltLocationChange=()=>{try{window.dispatchEvent(new CustomEvent("veltLocationChange",{detail:this.location}))}catch(t){console.warn("Error in onVeltLocationChange: ",t),Ra("Error in onVeltLocationChange: ",t)}},this.identifySnippyly=async()=>{var t,e;let i="",o="";try{this.invalidApiKey=!1;let e,n={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0};e=this.customLoginEnabled&&this.providedUser?this.providedUser:Ia();const r=await this.getSamlConfig();if(r&&(this.signInUrl=`${Qt}saml/${r.slug}/login?source=sf`),(null==e?void 0:e.email)&&(n=e),n.isAnonymous)delete n.groupId;else{const t=Snippyly.getDocumentId()||this.serverDocumentId;t&&(n.groupId=t+"")}if(this.customLoginEnabledLocally||(null===(t=null==n?void 0:n.contacts)||void 0===t?void 0:t.length)&&(n.contacts=[]),i=null==n?void 0:n.email,o=null==n?void 0:n.userId,(null==n?void 0:n.isAnonymous)&&this.projectId&&this.guestMode){const t=Oa();t&&(n=JSON.parse(JSON.stringify(t)))}let s;(null==n?void 0:n.isAnonymous)||(this.loading=!0),(null==n?void 0:n.groupId)&&(s||(s={}),s.groupId=null==n?void 0:n.groupId);const a=await(async(t,e,i)=>{var o,n;try{const r=bo(Da,re,{timeout:12e5}),s=await r({apiKey:t,userId:e,userProperties:i});return null===(n=null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.data)||void 0===n?void 0:n.token}catch(t){return console.warn("Error in generateSuperflowAuthToken: ",t),null}})(this.apiKey,null==n?void 0:n.userId,s),l={};a&&(l.authToken=a);const c=await Snippyly.identify(n,l);Pa(JSON.parse(JSON.stringify(c||{}))),(null==n?void 0:n.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(n)));const d=JSON.parse(JSON.stringify(c||{}));(null==d?void 0:d.userSnippylyId)&&!(null==d?void 0:d.isGuest)&&this.checkToMigrateGuestUser(d),Snippyly.getUserRole$().subscribe((t=>{var e;this.loading=!1,this.snippylyUserRole=t,"Admin"===this.snippylyUserRole&&this.allFeatureDisabled&&(this.allFeatureDisabled=!1),this.snippylyUserRole||Va(ut.Events.USER_EMAIL_NOT_WHITELISTED),null===(e=this.commentElement)||void 0===e||e.enablePriority(),this.checkPrivateCommentModeFromStorage()})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getFeaturesAccessLevelIam$)&&this.subscriptions.push(Snippyly.getFeaturesAccessLevelIam$().subscribe((async t=>{var e,i,o,n,r,s,a,l;this.allFeatureDisabled=!!(null===(e=null==t?void 0:t.all)||void 0===e?void 0:e.disabled)&&"Admin"!==this.snippylyUserRole,this.allFeatureRestricted=!!(null===(i=null==t?void 0:t.all)||void 0===i?void 0:i.restricted),this.guestMode=!!(null===(o=null==t?void 0:t.all)||void 0===o?void 0:o.guestMode),this.allowGuestModeSignIn=!!(null===(r=null===(n=null==t?void 0:t.all)||void 0===n?void 0:n.guestModeConfig)||void 0===r?void 0:r.allowSignIn),this.guestMode&&Va(ut.Events.GUEST_MODE_PRESENT),(null===(s=null==t?void 0:t.all)||void 0===s?void 0:s.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(l=null===(a=null==t?void 0:t.all)||void 0===a?void 0:a.passwordProtected)||void 0===l?void 0:l.enabled),Velt&&(t&&this.passwordProtected&&!this.isPasswordValid?Velt.disableFeatures(["area","arrow","audioHuddle","cursor","huddle","liveStateSync","presence","tag","recorder","comment"]):Velt.disableFeatures([])),Sa(Ot,this.guestMode+"",!0),Sa(Pt,this.allowGuestModeSignIn+"",!0),Sa(Lt,this.passwordProtected+"",!0)}),(t=>{this.loading=!1,console.warn("Error in getFeaturesAccessLevelIam$: ",t),Ra("Error in getFeaturesAccessLevelIam$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.isPlanExpired$)&&(null===Snippyly||void 0===Snippyly||Snippyly.isPlanExpired$().subscribe((t=>{this.isPlanExpired=t}),(t=>{this.isPlanExpired=!1,console.warn("Error in isPlanExpired$: ",t),Ra("Error in isPlanExpired$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCustomerMetadata$)&&(null===Snippyly||void 0===Snippyly||Snippyly.getCustomerMetadata$().subscribe((t=>{La(t),t&&(this.customerMetadata=t)}),(t=>{console.warn("Error in getCustomerMetadata$: ",t),Ra("Error in getCustomerMetadata$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentMetadata)&&(null===Snippyly||void 0===Snippyly||Snippyly.getDocumentMetadata().subscribe((t=>{var e,i;t&&(this.queryParamsComments=!!(null===(e=null==t?void 0:t.extraConfig)||void 0===e?void 0:e.queryParamsComments),Sa(Dt,this.queryParamsComments+"",!0),this.usePageTitleAsLocationName=!!(null===(i=null==t?void 0:t.extraConfig)||void 0===i?void 0:i.usePageTitleAsLocationName),Sa(Ft,this.usePageTitleAsLocationName+"",!0))}),(t=>{console.warn("Error in getDocumentMetadata: ",t),Ra("Error in getDocumentMetadata: ",t)}))),ja({clientUserId:null==n?void 0:n.userId});try{(t=>{var e,i,o,n,r,s,a,l,c,d,h,u;const p={properties:{apiKey:null!==(e=null==$a?void 0:$a.apiKey)&&void 0!==e?e:"",name:null!==(i=null==t?void 0:t.name)&&void 0!==i?i:"",firstName:(null==t?void 0:t.name)?null===(o=null==t?void 0:t.name)||void 0===o?void 0:o.split(" ")[0]:"",lastName:(null==t?void 0:t.name)?null===(n=null==t?void 0:t.name)||void 0===n?void 0:n.split(" ")[1]:"",email:null!==(r=null==t?void 0:t.email)&&void 0!==r?r:"",clientUserId:null!==(s=null==t?void 0:t.userId)&&void 0!==s?s:"",snippylyUserId:null!==(a=null==t?void 0:t.userSnippylyId)&&void 0!==a?a:"",groupId:null!==(l=null==t?void 0:t.groupId)&&void 0!==l?l:"",isOwner:"",plan:"",sdkVersion:null!==(c=null==$a?void 0:$a.sdkVersion)&&void 0!==c?c:"",sdkType:null!==(d=null==$a?void 0:$a.sdkType)&&void 0!==d?d:"",sourcePlatform:null!==(h=null==$a?void 0:$a.sourcePlatform)&&void 0!==h?h:"",website:null===(u=null===window||void 0===window?void 0:window.location)||void 0===u?void 0:u.href},context:{userAgent:null===navigator||void 0===navigator?void 0:navigator.userAgent},userId:null==t?void 0:t.userSnippylyId,sf:!0};Ua("identify",p)})(n)}catch(t){console.warn("Error in trackIdentifyEvent: ",t)}this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{ka(It)||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){if(this.loading=!1,this.signInError=!0,t&&"string"==typeof t&&(null===(e=null==t?void 0:t.toLowerCase())||void 0===e?void 0:e.includes("invalid"))){this.invalidApiKey=!0,Va(ut.Events.DOMAIN_NOT_WHITELISTED),this.projectId&&(async(t,e)=>{try{const i=bo(Da,ie,{timeout:12e5});await i({apiKey:t,projectId:e})}catch(t){console.warn("Error in checkDomainWhitelisted: ",t)}})(this.apiKey,this.projectId);if(new URL(document.location).searchParams.has(_t))this.isSigningInUserAdmin=!0;else if(ka(At))this.isSigningInUserAdmin="true"===ka(At,!0);else{const t=await(async(t,e,i,o)=>{try{const n=bo(Da,oe,{timeout:12e5}),r=await n({apiKey:t,projectId:e,email:i,userId:o});return null==r?void 0:r.data}catch(t){return console.warn("Error in iam: ",t),null}})(this.apiKey,this.projectId||"",i,o);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),Sa(At,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),Ra("Error in identifySnippyly: ",t)}},this.checkToMigrateGuestUser=async t=>{try{const e=Oa(!1);e&&(await za(this.apiKey,this.projectId||"",e,t,!0),Ma(Et))}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),Ra("Error in checkToMigrationGuestUser: ",t)}},this.getComments=()=>{try{this.commentElement&&(this.commentSubscription&&this.commentSubscription.unsubscribe(),this.commentSubscription=this.commentElement.getAllCommentAnnotations(this.documentId).subscribe((t=>{this.comments=null==t?void 0:t.filter((t=>{var e;return["open","inProgress"].includes(null==t?void 0:t.status)||["default","ongoing"].includes(null===(e=null==t?void 0:t.status)||void 0===e?void 0:e.type)}))})))}catch(t){console.warn("Error in getComments: ",t),Ra("Error in getComments: ",t)}},this.setQueryParamsCommentsInSdk=()=>{var t,e,i,o;try{this.commentElement&&(this.queryParamsComments&&(null===(t=this.commentElement)||void 0===t?void 0:t.enableQueryParamsComments)?null===(e=this.commentElement)||void 0===e||e.enableQueryParamsComments():!this.queryParamsComments&&(null===(i=this.commentElement)||void 0===i?void 0:i.disableQueryParamsComments)&&(null===(o=this.commentElement)||void 0===o||o.disableQueryParamsComments()))}catch(t){console.warn("Error in setQueryParamsCommentsInSdk: ",t),Ra("Error in setQueryParamsCommentsInSdk: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),Ra("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded,this.expanded?Va(ut.Events.TOOLBAR_EXPANDED):Va(ut.Events.TOOLBAR_COLLAPSED)}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Ra("Error in toggleSnippylyPluginToolbar: ",t)}},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.commentElement.disablePrivateCommentMode&&this.commentElement.disablePrivateCommentMode(),this.privateCommentModeEnabled=!1,Va(ut.Events.PRIVATE_MODE_DISABLED)):(this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode(),this.privateCommentModeEnabled=!0,Va(ut.Events.PRIVATE_MODE_ENABLED)),Sa(jt,this.privateCommentModeEnabled.toString()))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),Ra("Error in togglePrivateCommentMode: ",t)}},this.checkPrivateCommentModeFromStorage=()=>{try{this.allFeatureDisabled||"Admin"!==this.snippylyUserRole||ka(jt)&&(this.privateCommentModeEnabled="true"===ka(jt),this.privateCommentModeEnabled&&this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode())}catch(t){console.warn("Error in checkPrivateCommentModeFromStorage: ",t),Ra("Error in checkPrivateCommentModeFromStorage: ",t)}},this.loginWithGoogle=()=>{try{if(Va(ut.Events.SIGNIN_CLICKED),this.loading||this.customLoginEnabledLocally)return;window.open(this.signInUrl,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Ra("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=new URL(window.location.href);null==t||t.searchParams.set("review","true");const e=null==t?void 0:t.toString();if(e){const t=Na(e,Xt,te),i=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getqrcode?text=${encodeURIComponent(t)}`),o=await i.json();(null==o?void 0:o.qrcode)&&(this.qrCode=null==o?void 0:o.qrcode)}}catch(t){console.warn("Error in getQRCode: ",t),Ra("Error in getQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{Va(ut.Events.OPEN_MOBILE_CLICKED),this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),Ra("Error in toggleQRCodeVisibility: ",t)}},this.onUserInviteToolClick=()=>{var t;(null===(t=this.snippylyUser)||void 0===t?void 0:t.isGuest)&&(this.guestModeSignInModalConfig.title="Sign in to invite others.",this.guestModeSignInModalConfig.description="Invite team members to comment on this project.",this.guestModeSignInModalConfig.showLeaveCommentButton=!1,this.guestModeSignInModalConfig.closeOnClickOutside=!0,this.openGuestModeSignInModal())},this.removeSnippyly=async()=>{try{Va(ut.Events.EXIT_REVIEW_MODE_CLICKED),this.exitReviewModeCalled=!0,Ma(gt),Ma(ft),Ma(wt),Ma(St,"sessionStorage"),Ma(kt,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(wt),e.delete(gt),e.delete(yt),e.delete(ft),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(Mt),e.delete(_t),e.delete(Nt),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,t.href),window.location.reload()}catch(t){console.warn("Error in removeSnippyly: ",t),Ra("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{Va(ut.Events.SIGNOUT_CLICKED),this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),await Snippyly.signOutUser(),Ma(bt),Ma(xt),Ma(At),Ma(jt),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Ra("Error in signOutUser: ",t)}},this.toggleMenu=(t,e)=>{try{t.stopPropagation(),this.menuOpenedId===e?this.menuOpenedId=void 0:this.menuOpenedId=e}catch(t){console.warn("Error in toggleMenu: ",t),Ra("Error in toggleMenu: ",t)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(t){console.warn("Error in copyLink: ",t),Ra("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${Qt}`;Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)&&this.serverDocumentId&&(t=`${Qt}/dashboard/project/comment/${this.apiKey}/${this.serverDocumentId}`),Va(ut.Events.VIEW_PROJECT_CLICKED),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Ra("Error in goToAdminPortal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${Qt}`;Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)&&this.serverDocumentId&&(t=`${Qt}/dashboard`),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),Ra("Error in goToAdminPortalDashboard: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1q3jzsddt-NEb~uu9RXscLfxOIDGQXJw","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),Ra("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Sa(_t,"true");const t=new URL(document.location);t.searchParams.delete(_t),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Ra("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Sa(Nt,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(Nt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Ra("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Tt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),Ra("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://superflow-portal-staging-2023.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Ra("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,Sa(It,"true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Ra("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{Va(ut.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),Ra("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,Va(ut.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),Ra("Error in openGuestModeSignInModal: ",t)}},this.closeGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!1,this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig))}catch(t){console.warn("Error in closeGuestModeSignInModal: ",t),Ra("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{Va(ut.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),Ra("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.skipGuestNameModal||(this.showGuestModeNameModal=!0,Va(ut.Events.GUEST_MODE_NAME_NUDGE_SHOWN))}catch(t){console.warn("Error in openGuestModeNameModel: ",t),Ra("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),Ra("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{Va(ut.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),Ra("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{Va(ut.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),Ra("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{Va(ut.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),Ra("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,Va(ut.Events.GUEST_MODE_SIGN_IN_NUDGE_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),Ra("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),Ra("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{Va(ut.Events.GUEST_MODE_SIGN_IN_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),Ra("Error in onGuestModeBannerSignInButtonClick: ",t)}},this.updateGuestUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;const e=Oa();if(e){const t=JSON.parse(JSON.stringify(e));e.name=this.guestUserNameInput,e.photoUrl=null,this.guestUserNameUpdateLoading=!0,(t=>{try{const e=JSON.stringify(t),i=Na(e,Xt,te);Sa(Et,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),Ra("Error in updateGuestUser: ",t)}})(e),await Snippyly.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await za(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,Sa(Vt,"true"),Va(ut.Events.GUEST_MODE_NAME_ADDED,{oldName:null==t?void 0:t.name,newName:null==e?void 0:e.name})}this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateGuestUserName: ",t),Ra("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(Va(ut.Events.REVIEW_PASSWORD_ADDED),!(null===(t=this.password)||void 0===t?void 0:t.trim()))return;if(this.validatingPasswordLoading)return;this.validatingPasswordLoading=!0,this.isPasswordValid=await(async(t,e,i)=>{var o;try{const n=bo(Da,ce,{timeout:12e5}),r=await n({apiKey:t,projectId:e,password:i});return null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in validatePassword: ",t),null}})(this.apiKey,this.projectId,this.password),function(t,e){try{const i="object"==typeof e?JSON.stringify(e):e;localStorage.setItem(t,i)}catch(t){console.warn("Error in setLocalStorage: ",t)}}($t,this.isPasswordValid),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,Velt&&Velt.disableFeatures([]),Va(ut.Events.REVIEW_PASSWORD_ACCEPTED)):(this.showInvalidPassword=!0,Va(ut.Events.REVIEW_PASSWORD_REJECTED)),this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),Ra("Error in submitPassword: ",t)}},this.updateUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;this.guestUserNameUpdateLoading=!0;const e=JSON.parse(JSON.stringify(this.snippylyUser)),i=JSON.parse(JSON.stringify(this.snippylyUser));i.name=this.guestUserNameInput,await za(this.apiKey,this.projectId||"",e,i),await Snippyly.updateUser(i),this.snippylyUser=JSON.parse(JSON.stringify(i));const o=Ia();o.name=i.name;const n=JSON.stringify(o),r=Na(n,Xt,te);Sa(xt,r,!0),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),Ra("Error in updateUserName: ",t)}},this.disableCommentMode=()=>{var t;try{(null===(t=this.commentElement)||void 0===t?void 0:t.disableCommentMode)&&this.commentElement.disableCommentMode()}catch(t){console.warn("Error in disableAddCommentMode: ",t),Ra("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?D`
|
|
2663
2663
|
<div class="disable-add-comment-button" @click=${()=>this.disableCommentMode()}>
|
|
2664
2664
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2665
2665
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.52861 3.52858C3.78896 3.26823 4.21107 3.26823 4.47141 3.52858L8.00001 7.05717L11.5286 3.52858C11.789 3.26823 12.2111 3.26823 12.4714 3.52858C12.7318 3.78892 12.7318 4.21103 12.4714 4.47138L8.94282 7.99998L12.4714 11.5286C12.7318 11.7889 12.7318 12.211 12.4714 12.4714C12.2111 12.7317 11.789 12.7317 11.5286 12.4714L8.00001 8.94279L4.47141 12.4714C4.21107 12.7317 3.78896 12.7317 3.52861 12.4714C3.26826 12.211 3.26826 11.7889 3.52861 11.5286L7.0572 7.99998L3.52861 4.47138C3.26826 4.21103 3.26826 3.78892 3.52861 3.52858Z" fill="#FAFBFF"/>
|
|
2666
2666
|
</svg>
|
|
2667
2667
|
</div>
|
|
2668
|
-
`:D``}catch(t){return console.warn("Error in disableAddCommentModeButton: ",t),Ra("Error in disableAddCommentModeButton: ",t),D``}},this.addStyles=()=>{var t,e;try{const i=document.createElement("style");i.textContent=Ga.cssText,null===(t=this.shadowRoot)||void 0===t||t.appendChild(i);const o=document.createElement("style");o.textContent=Za.cssText,null===(e=this.shadowRoot)||void 0===e||e.appendChild(o)}catch(t){console.warn("Error in addStyles: ",t),Ra("Error in addStyles: ",t)}},this._dragX=0,this._dragY=0,this._isDragging=!1,this._startX=0,this._startY=0,this.mouseMove=t=>{var e;if(this._isDragging){let i,o;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container");if(n){if(i=t.clientX-this._startX,o=t.clientY-this._startY,i>20||o>40)return;if(window.innerWidth-n.getBoundingClientRect().width- -1*i<20)return;if(window.innerHeight-n.getBoundingClientRect().height- -1*o<n.getBoundingClientRect().height)return;n.style.transform=`translate(${i}px, ${o}px)`}}},this.mouseDown=t=>{var e;const i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container");if(i){this._isDragging=!0;const e=window.getComputedStyle(i),o=new WebKitCSSMatrix(e.transform);this._startX=t.clientX-o.m41,this._startY=t.clientY-o.m42}},this.mouseUp=t=>{t&&(this._isDragging=!1)},this.mouseLeave=t=>{t&&(this._isDragging=!1)},this.guestUserNameUpdated=!!ka(Vt);const t=new URL(document.location);t.searchParams.has(Ct)&&t.searchParams.delete(Ct),this.signInUrl=`${Qt}/signin?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,this.signOutUrl=`${Qt}/signout?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,Ma(xt),await this.checkCustomLoginEnabled()},identify:async t=>{this.providedUser=t,this.customLoginEnabled&&this.loginWithCustomUser()},signInUrl:this.signInUrl,signOutUrl:this.signOutUrl,openGuestModeSignInModal:t=>{this.skipGuestNameModal=t,this.openGuestModeSignInModal()},onPasswordProtectedModalOpenButtonClick:()=>{this.onPasswordProtectedModalOpenButtonClick()}};try{this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Ra("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){var e,i,o,n,r,s,a,l,c,d;this._loadPlugin=t,this.loadPlugin?(this.classList.add("visible"),null===(i=null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.style)||void 0===i||i.setProperty("transform","none","important"),null===(r=null===(n=null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.parentElement)||void 0===n?void 0:n.style)||void 0===r||r.setProperty("transform","none","important"),null===(a=null===(s=null===document||void 0===document?void 0:document.body)||void 0===s?void 0:s.style)||void 0===a||a.setProperty("perspective","none","important"),null===(d=null===(c=null===(l=null===document||void 0===document?void 0:document.body)||void 0===l?void 0:l.parentElement)||void 0===c?void 0:c.style)||void 0===d||d.setProperty("perspective","none","important")):this.classList.remove("visible")}get expanded(){return this._expanded}set expanded(t){this._expanded=t,this.expanded?this.classList.add("expanded"):this.classList.remove("expanded")}get isPlanExpired(){return this._isPlanExpired}set isPlanExpired(t){this._isPlanExpired=t,this.checkToEnableUpgradeButton()}get apiKey(){return this._apiKey}set apiKey(t){this._apiKey=t,this.onApiKeyChange(),ja({apiKey:this.apiKey}),this.checkUrl()}get projectId(){return this._projectId}set projectId(t){this._projectId=t,this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&Sa(St,this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Ra("Error in set projectVersionKey: ",t)}}get autoLocation(){return this._autoLocation}set autoLocation(t){this._autoLocation="true"===t||!0===t}get menuOpenedId(){return this._menuOpenedId}set menuOpenedId(t){this._menuOpenedId=t,this.menuOpenedId?this.addWindowClickEventListener():this.removeWindowClickEventListener()}get isUserGlobalContact(){return this._isUserGlobalContact}set isUserGlobalContact(t){this._isUserGlobalContact=t,this.checkToEnableUpgradeButton()}get privateCommentModeEnabled(){return this._privateCommentModeEnabled}set privateCommentModeEnabled(t){this._privateCommentModeEnabled=t,this.darkMode=!!this.privateCommentModeEnabled}get customerMetadata(){return this._customerMetadata}set customerMetadata(t){this._customerMetadata=t,this.setLogos()}get documentMetadata(){return this._documentMetadata}set documentMetadata(t){this._documentMetadata=t}get darkMode(){return this._darkMode}set darkMode(t){this._darkMode=t,this.setLogos()}get queryParamsComments(){return this._queryParamsComments}set queryParamsComments(t){this._queryParamsComments=t,this.setQueryParamsCommentsInSdk()}get usePageTitleAsLocationName(){return this._usePageTitleAsLocationName}set usePageTitleAsLocationName(t){this._usePageTitleAsLocationName=t}get totalViews(){return this._totalViews}set totalViews(t){this._totalViews=t,this.totalViewsCount=Object.keys(this.totalViews||{}).length}connectedCallback(){super.connectedCallback(),this.getAttribute("apiKey")&&!this.getAttribute("projectId")&&(this.projectId=ba(xa(window.location.origin))+""),this.expanded=!0,this.setAttribute("data-velt-comment-disabled","true"),this.style.zIndex="2147483647",setTimeout((()=>{if(!this.superflowToolbarMoved){this.superflowToolbarMoved=!0,document.body.appendChild(this);const t=document.querySelector(".cdk-overlay-container");t&&document.body.appendChild(t)}}),5e3);const t=document.createElement("style");t.innerHTML='body[data-velt-ongoing-recording="screen"] superflow-toolbar { display: none !important; }',document.head.appendChild(t),this.addStyles(),setTimeout((()=>{const t=document.querySelectorAll('script[src*="snippyly.min.js"]');(null==t?void 0:t.length)>1&&(console.warn("Multiple superflow scripts installed."),Va(ut.Events.DUPLICATE_SCRIPT_INSTALLED))}),1e3)}async detectToolbarEnabled(){try{if(this.projectId&&this.apiKey){this.toolbarEnabledApiCalled=!0;const t=document.location.toString();t.includes(Gt)||t.includes(Ht)?this.toolbarEnabled=!0:this.toolbarEnabled=await(async(t,e,i)=>{var o;try{const n=bo(Da,de,{timeout:12e5}),r=await n({apiKey:t,projectId:e,url:i});return null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in checkToolbarEnabled: ",t),null}})(this.apiKey,this.projectId,t),this.toolbarEnabled||Va(ut.Events.TOOLBAR_DISABLED)}}catch(t){console.warn("Error in detectToolbarEnabled: ",t),Ra("Error in detectToolbarEnabled: ",t)}}render(){var t,e,i,o,n,r,s,a,l,c,d,h,u,p,v,m,g,f;return this.loadPlugin&&this.toolbarEnabled?!this.snippylyUser||this.loading||null===this.isPlanExpired?D`
|
|
2668
|
+
`:D``}catch(t){return console.warn("Error in disableAddCommentModeButton: ",t),Ra("Error in disableAddCommentModeButton: ",t),D``}},this.addStyles=()=>{var t,e;try{const i=document.createElement("style");i.textContent=Ga.cssText,null===(t=this.shadowRoot)||void 0===t||t.appendChild(i);const o=document.createElement("style");o.textContent=Za.cssText,null===(e=this.shadowRoot)||void 0===e||e.appendChild(o)}catch(t){console.warn("Error in addStyles: ",t),Ra("Error in addStyles: ",t)}},this.checkToolbarPosition=()=>{var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".snippyly-plugin-container");e&&requestAnimationFrame((()=>{var t;const{x:i}=e.getBoundingClientRect();if(i>=0)return;const o=e.style.transform,[n,r]=(null===(t=o.match(/translate\(([-\d.]+)px,\s*([-\d.]+)px\)/))||void 0===t?void 0:t.slice(1))||[],s=parseInt(n)-i;e.style.transform=`translate(${s||0}px, ${r||0}px)`}))},this._dragX=0,this._dragY=0,this._isDragging=!1,this._startX=0,this._startY=0,this.mouseMove=t=>{var e;if(this._isDragging){let i,o;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container");if(n){if(i=t.clientX-this._startX,o=t.clientY-this._startY,i>20||o>40)return;if(window.innerWidth-n.getBoundingClientRect().width- -1*i<20)return;if(window.innerHeight-n.getBoundingClientRect().height- -1*o<n.getBoundingClientRect().height)return;n.style.transform=`translate(${i}px, ${o}px)`}}},this.mouseDown=t=>{var e;const i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container");if(i){this._isDragging=!0;const e=window.getComputedStyle(i),o=new WebKitCSSMatrix(e.transform);this._startX=t.clientX-o.m41,this._startY=t.clientY-o.m42}},this.mouseUp=t=>{t&&(this._isDragging=!1)},this.mouseLeave=t=>{t&&(this._isDragging=!1)},this.guestUserNameUpdated=!!ka(Vt);const t=new URL(document.location);t.searchParams.has(Ct)&&t.searchParams.delete(Ct),this.signInUrl=`${Qt}/signin?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,this.signOutUrl=`${Qt}/signout?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,Ma(xt),await this.checkCustomLoginEnabled()},identify:async t=>{this.providedUser=t,this.customLoginEnabled&&this.loginWithCustomUser()},signInUrl:this.signInUrl,signOutUrl:this.signOutUrl,openGuestModeSignInModal:t=>{this.skipGuestNameModal=t,this.openGuestModeSignInModal()},onPasswordProtectedModalOpenButtonClick:()=>{this.onPasswordProtectedModalOpenButtonClick()}};try{this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Ra("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){var e,i,o,n,r,s,a,l,c,d;this._loadPlugin=t,this.loadPlugin?(this.classList.add("visible"),null===(i=null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.style)||void 0===i||i.setProperty("transform","none","important"),null===(r=null===(n=null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.parentElement)||void 0===n?void 0:n.style)||void 0===r||r.setProperty("transform","none","important"),null===(a=null===(s=null===document||void 0===document?void 0:document.body)||void 0===s?void 0:s.style)||void 0===a||a.setProperty("perspective","none","important"),null===(d=null===(c=null===(l=null===document||void 0===document?void 0:document.body)||void 0===l?void 0:l.parentElement)||void 0===c?void 0:c.style)||void 0===d||d.setProperty("perspective","none","important")):this.classList.remove("visible")}get expanded(){return this._expanded}set expanded(t){this._expanded=t,this.expanded?this.classList.add("expanded"):this.classList.remove("expanded")}get isPlanExpired(){return this._isPlanExpired}set isPlanExpired(t){this._isPlanExpired=t,this.checkToEnableUpgradeButton()}get apiKey(){return this._apiKey}set apiKey(t){this._apiKey=t,this.onApiKeyChange(),ja({apiKey:this.apiKey}),this.checkUrl()}get projectId(){return this._projectId}set projectId(t){this._projectId=t,this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&Sa(St,this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Ra("Error in set projectVersionKey: ",t)}}get autoLocation(){return this._autoLocation}set autoLocation(t){this._autoLocation="true"===t||!0===t}get menuOpenedId(){return this._menuOpenedId}set menuOpenedId(t){this._menuOpenedId=t,this.menuOpenedId?this.addWindowClickEventListener():this.removeWindowClickEventListener()}get isUserGlobalContact(){return this._isUserGlobalContact}set isUserGlobalContact(t){this._isUserGlobalContact=t,this.checkToEnableUpgradeButton()}get privateCommentModeEnabled(){return this._privateCommentModeEnabled}set privateCommentModeEnabled(t){this._privateCommentModeEnabled=t,this.darkMode=!!this.privateCommentModeEnabled}get customerMetadata(){return this._customerMetadata}set customerMetadata(t){this._customerMetadata=t,this.setLogos()}get documentMetadata(){return this._documentMetadata}set documentMetadata(t){this._documentMetadata=t}get darkMode(){return this._darkMode}set darkMode(t){this._darkMode=t,this.setLogos()}get queryParamsComments(){return this._queryParamsComments}set queryParamsComments(t){this._queryParamsComments=t,this.setQueryParamsCommentsInSdk()}get usePageTitleAsLocationName(){return this._usePageTitleAsLocationName}set usePageTitleAsLocationName(t){this._usePageTitleAsLocationName=t}get totalViews(){return this._totalViews}set totalViews(t){this._totalViews=t,this.totalViewsCount=Object.keys(this.totalViews||{}).length}connectedCallback(){super.connectedCallback(),this.getAttribute("apiKey")&&!this.getAttribute("projectId")&&(this.projectId=ba(xa(window.location.origin))+""),this.expanded=!0,this.setAttribute("data-velt-comment-disabled","true"),this.style.zIndex="2147483647",setTimeout((()=>{if(!this.superflowToolbarMoved){this.superflowToolbarMoved=!0,document.body.appendChild(this);const t=document.querySelector(".cdk-overlay-container");t&&document.body.appendChild(t)}}),5e3);const t=document.createElement("style");t.innerHTML='body[data-velt-ongoing-recording="screen"] superflow-toolbar { display: none !important; }',document.head.appendChild(t),this.addStyles(),setTimeout((()=>{const t=document.querySelectorAll('script[src*="snippyly.min.js"]');(null==t?void 0:t.length)>1&&(console.warn("Multiple superflow scripts installed."),Va(ut.Events.DUPLICATE_SCRIPT_INSTALLED))}),1e3)}async detectToolbarEnabled(){try{if(this.projectId&&this.apiKey){this.toolbarEnabledApiCalled=!0;const t=document.location.toString();t.includes(Gt)||t.includes(Ht)?this.toolbarEnabled=!0:this.toolbarEnabled=await(async(t,e,i)=>{var o;try{const n=bo(Da,de,{timeout:12e5}),r=await n({apiKey:t,projectId:e,url:i});return null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in checkToolbarEnabled: ",t),null}})(this.apiKey,this.projectId,t),this.toolbarEnabled||Va(ut.Events.TOOLBAR_DISABLED)}}catch(t){console.warn("Error in detectToolbarEnabled: ",t),Ra("Error in detectToolbarEnabled: ",t)}}render(){var t,e,i,o,n,r,s,a,l,c,d,h,u,p,v,m,g,f;return this.loadPlugin&&this.toolbarEnabled?!this.snippylyUser||this.loading||null===this.isPlanExpired?D`
|
|
2669
2669
|
<div class="snippyly-plugin-container" part="superflow-toolbar-container">
|
|
2670
2670
|
<div class="toolbar" id="smallToolbar"
|
|
2671
2671
|
@mousemove=${t=>this.mouseMove(t)}
|
|
@@ -2890,7 +2890,7 @@ class da extends Yn{}da.Encryptor=class extends da{processBlock(t,e){const i=t,o
|
|
|
2890
2890
|
`:D`
|
|
2891
2891
|
<div class="snippyly-plugin-container" part="superflow-toolbar-container">
|
|
2892
2892
|
${this.disableCommentModeButton()}
|
|
2893
|
-
<div class="toolbar ${ct({expanded:this.expanded,"add-comment-mode":this.addCommentMode,"private-comment-mode":!!this.privateCommentModeEnabled})}"
|
|
2893
|
+
<div class="toolbar ${ct({expanded:this.expanded,"add-comment-mode":this.addCommentMode,"private-comment-mode":!!this.privateCommentModeEnabled})}" @resize=${this.checkToolbarPosition()}
|
|
2894
2894
|
@mousemove=${t=>this.mouseMove(t)}
|
|
2895
2895
|
@mousedown=${t=>this.mouseDown(t)}
|
|
2896
2896
|
@mouseup=${t=>this.mouseUp(t)}
|
|
@@ -2919,7 +2919,7 @@ class da extends Yn{}da.Encryptor=class extends da{processBlock(t,e){const i=t,o
|
|
|
2919
2919
|
|
|
2920
2920
|
</div>
|
|
2921
2921
|
`:D`
|
|
2922
|
-
<div class="toolbar-section snippyly-logo ${ct({"d-xs-none":this.expanded
|
|
2922
|
+
<div class="toolbar-section snippyly-logo ${ct({"d-xs-none":this.expanded})}" @click=${()=>this.toggleSnippylyPluginToolbar()}>
|
|
2923
2923
|
<div class="toolbar-logo">
|
|
2924
2924
|
${this.getLogoMark()}
|
|
2925
2925
|
</div>
|
|
@@ -2963,7 +2963,7 @@ class da extends Yn{}da.Encryptor=class extends da{processBlock(t,e){const i=t,o
|
|
|
2963
2963
|
<!-- actions -->
|
|
2964
2964
|
<div class="toolbar-section huddle-recorder-section ${ct({"d-none":!this.expanded})}">
|
|
2965
2965
|
<div class="toolbar-actions">
|
|
2966
|
-
${this.allFeatureDisabled||"Admin"!==this.snippylyUserRole?null:D`<div class="action tooltip private-comment-mode-switch-container ${ct({enabled:!!this.privateCommentModeEnabled,"d-none"
|
|
2966
|
+
${this.allFeatureDisabled||"Admin"!==this.snippylyUserRole?null:D`<div class="action tooltip private-comment-mode-switch-container ${ct({enabled:!!this.privateCommentModeEnabled,"d-none":this.addCommentMode})}" @click=${()=>this.togglePrivateCommentMode()}>
|
|
2967
2967
|
<div class="tooltiptext">
|
|
2968
2968
|
<h3 class="title">Private Mode</h3>
|
|
2969
2969
|
<p class="body">By enabling this Only admins <br/> can view your new comment</p>
|