@usesuperflow/toolbar-staging 1.0.238 → 1.0.239
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 +1 -1
- package/superflow.min.js +1 -1
package/package.json
CHANGED
package/superflow.js
CHANGED
|
@@ -2447,7 +2447,7 @@ class Js extends at{constructor(t){if(super(t),this.it=D,t.type!==st)throw Error
|
|
|
2447
2447
|
${qs(this.wordMark)}
|
|
2448
2448
|
`:F`
|
|
2449
2449
|
<img src=${this.wordMark} />
|
|
2450
|
-
`}catch(t){return console.warn("Error in getWordMark: ",t),F``}},this.generateLocation=()=>{try{if(this.autoLocation){const t=new URL(document.location).searchParams,e=new URL(document.location);e.searchParams.delete("review"),e.searchParams.delete("feedback"),e.searchParams.delete("sreviewId"),e.searchParams.delete("scommentId"),e.searchParams.delete("sprojectInstall"),e.searchParams.delete("sflivedemo");const i=t.get("sversion")||this.projectVersion;e.search="";let o=(t=>{try{return t.replace(/#.*$/,"")}catch(e){return console.warn("Error in removeHashFromUrl: ",e),Ps("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),Ps("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;null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))),Us({clientLocation:this.location}),this.previousLocation=JSON.parse(JSON.stringify(this.location))}}catch(t){console.warn("Error in setLocation: ",t),Ps("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,e;let i="";try{this.invalidApiKey=!1;let e,o={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0};if(e=this.customLoginEnabled&&this.providedUser?this.providedUser:As(),(null==e?void 0:e.email)&&(o=e),o.isAnonymous?delete o.groupId:o.groupId=Snippyly.getDocumentId()+"",this.customLoginEnabledLocally||(null===(t=null==o?void 0:o.contacts)||void 0===t?void 0:t.length)&&(o.contacts=[]),i=null==o?void 0:o.email,(null==o?void 0:o.isAnonymous)&&this.projectId&&this.guestMode){const t=Os();t&&(o=JSON.parse(JSON.stringify(t)))}(null==o?void 0:o.isAnonymous)||(this.loading=!0);const n=await(async(t,e)=>{var i,o;try{const n=Ke(js,bt),s=await n({apiKey:t,userId:e});return null===(o=null===(i=null==s?void 0:s.data)||void 0===i?void 0:i.data)||void 0===o?void 0:o.token}catch(t){return console.warn("Error in generateSuperflowAuthToken: ",t),null}})(this.apiKey,null==o?void 0:o.userId),s={};n&&(s.authToken=n);const r=await Snippyly.identify(o,s);zs(JSON.parse(JSON.stringify(r||{}))),(null==o?void 0:o.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(o)));const a=JSON.parse(JSON.stringify(r||{}));(null==a?void 0:a.userSnippylyId)&&!(null==a?void 0:a.isGuest)&&this.checkToMigrateGuestUser(a),Snippyly.getUserRole$().subscribe((t=>{var e;this.loading=!1,this.snippylyUserRole=t,null===(e=this.commentElement)||void 0===e||e.enablePriority()})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getFeaturesAccessLevelIam$)&&this.subscriptions.push(Snippyly.getFeaturesAccessLevelIam$().subscribe((async t=>{var e,i,o,n,s,r,a,l;this.allFeatureDisabled=!!(null===(e=null==t?void 0:t.all)||void 0===e?void 0:e.disabled),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===(s=null===(n=null==t?void 0:t.all)||void 0===n?void 0:n.guestModeConfig)||void 0===s?void 0:s.allowSignIn),(null===(r=null==t?void 0:t.all)||void 0===r?void 0:r.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),Ms("sfGuestMode",this.guestMode+"",!0),Ms("sfGuestModeAllowSignIn",this.allowGuestModeSignIn+"",!0),Ms("sfPasswordProtected",this.passwordProtected+"",!0)}),(t=>{this.loading=!1,console.warn("Error in getFeaturesAccessLevelIam$: ",t),Ps("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),Ps("Error in isPlanExpired$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCustomerMetadata$)&&(null===Snippyly||void 0===Snippyly||Snippyly.getCustomerMetadata$().subscribe((t=>{Ds(t),t&&(this.customerMetadata=t)}),(t=>{console.warn("Error in getCustomerMetadata$: ",t),Ps("Error in getCustomerMetadata$: ",t)}))),Us({clientUserId:null==o?void 0:o.userId}),this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{_s("sfTourCommentTooltip")||(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,this.projectId&&(async(t,e)=>{try{const i=Ke(js,wt);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("sprojectInstall"))this.isSigningInUserAdmin=!0;else if(_s("sfUserAdmin"))this.isSigningInUserAdmin="true"===_s("sfUserAdmin",!0);else{const t=await(async(t,e,i)=>{try{const o=Ke(js,yt),n=await o({apiKey:t,projectId:e,email:i});return null==n?void 0:n.data}catch(t){return console.warn("Error in iam: ",t),null}})(this.apiKey,this.projectId||"",i);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),Ms("sfUserAdmin",this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),Ps("Error in identifySnippyly: ",t)}},this.checkToMigrateGuestUser=async t=>{try{const e=Os(!1);e&&(await Bs(this.apiKey,this.projectId||"",e,t,!0),Ns("_sfgut"))}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),Ps("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),Ps("Error in getComments: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),Ps("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Ps("Error in toggleSnippylyPluginToolbar: ",t)}},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.commentElement.disablePrivateCommentMode&&this.commentElement.disablePrivateCommentMode(),this.privateCommentModeEnabled=!1):(this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode(),this.privateCommentModeEnabled=!0))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),Ps("Error in togglePrivateCommentMode: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading||this.customLoginEnabledLocally)return;window.open(this.signInUrl,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Ps("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const e=Is(t,mt,gt),i=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getqrcode?text=${encodeURIComponent(e)}`),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),Ps("Error in getQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),Ps("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{this.exitReviewModeCalled=!0,Ns("review"),Ns("feedback"),Ns("sreviewId"),Ns("projectVersionKey","sessionStorage"),Ns("projectVersion","sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete("sreviewId"),e.delete("review"),e.delete("feedback"),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete("sversion"),e.delete("sprojectInstall"),e.delete("sflivedemo"),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),Ps("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),await Snippyly.signOutUser(),Ns("snippyly-user"),Ns("_sfut"),Ns("sfUserAdmin"),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Ps("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),Ps("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),Ps("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${vt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const e=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();e&&(t=`${vt}/dashboard/project/comment/${this.apiKey}/${e}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Ps("Error in goToAdminPortal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${vt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId())&&(t=`${vt}/dashboard`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),Ps("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),Ps("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Ms("sprojectInstall","true");const t=new URL(document.location);t.searchParams.delete("sprojectInstall"),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Ps("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Ms("sflivedemo","true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete("sflivedemo"),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Ps("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete("sffigmademo"),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),Ps("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),Ps("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,Ms("sfTourCommentTooltip","true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Ps("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{Rs(Ys.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),Ps("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,Rs(Ys.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),Ps("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),Ps("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{Rs(Ys.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),Ps("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.showGuestModeNameModal=!0,Rs(Ys.Events.GUEST_MODE_NAME_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeNameModel: ",t),Ps("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),Ps("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{Rs(Ys.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),Ps("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{Rs(Ys.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),Ps("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{Rs(Ys.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),Ps("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,Rs(Ys.Events.GUEST_MODE_SIGN_IN_BANNER_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),Ps("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),Ps("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{Rs(Ys.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),Ps("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=Os();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=Is(e,mt,gt);Ms("_sfgut",i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),Ps("Error in updateGuestUser: ",t)}})(e),await Snippyly.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await Bs(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,Ms("sfGuestUserNameUpdated","true"),Rs(Ys.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),Ps("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(!(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=Ke(js,St),s=await n({apiKey:t,projectId:e,password:i});return null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in validatePassword: ",t),null}})(this.apiKey,this.projectId,this.password),Ms("sfPasswordIsValid",this.isPasswordValid+"",!0),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1):this.showInvalidPassword=!0,this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),Ps("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 Bs(this.apiKey,this.projectId||"",e,i),await Snippyly.updateUser(i),this.snippylyUser=JSON.parse(JSON.stringify(i));const o=As();o.name=i.name;const n=JSON.stringify(o),s=Is(n,mt,gt);Ms("_sfut",s,!0),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),Ps("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),Ps("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?F`
|
|
2450
|
+
`}catch(t){return console.warn("Error in getWordMark: ",t),F``}},this.generateLocation=()=>{try{if(this.autoLocation){const t=new URL(document.location).searchParams,e=new URL(document.location);e.searchParams.delete("review"),e.searchParams.delete("feedback"),e.searchParams.delete("sreviewId"),e.searchParams.delete("scommentId"),e.searchParams.delete("sprojectInstall"),e.searchParams.delete("sflivedemo");const i=t.get("sversion")||this.projectVersion;e.search="";let o=(t=>{try{return t.replace(/#.*$/,"")}catch(e){return console.warn("Error in removeHashFromUrl: ",e),Ps("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),Ps("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;null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))),Us({clientLocation:this.location}),this.previousLocation=JSON.parse(JSON.stringify(this.location))}}catch(t){console.warn("Error in setLocation: ",t),Ps("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,e;let i="";try{this.invalidApiKey=!1;let e,o={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0};if(e=this.customLoginEnabled&&this.providedUser?this.providedUser:As(),(null==e?void 0:e.email)&&(o=e),o.isAnonymous?delete o.groupId:o.groupId=Snippyly.getDocumentId()+"",this.customLoginEnabledLocally||(null===(t=null==o?void 0:o.contacts)||void 0===t?void 0:t.length)&&(o.contacts=[]),i=null==o?void 0:o.email,(null==o?void 0:o.isAnonymous)&&this.projectId&&this.guestMode){const t=Os();t&&(o=JSON.parse(JSON.stringify(t)))}(null==o?void 0:o.isAnonymous)||(this.loading=!0);const n=await(async(t,e)=>{var i,o;try{const n=Ke(js,bt),s=await n({apiKey:t,userId:e});return null===(o=null===(i=null==s?void 0:s.data)||void 0===i?void 0:i.data)||void 0===o?void 0:o.token}catch(t){return console.warn("Error in generateSuperflowAuthToken: ",t),null}})(this.apiKey,null==o?void 0:o.userId),s={};n&&(s.authToken=n);const r=await Snippyly.identify(o,s);zs(JSON.parse(JSON.stringify(r||{}))),(null==o?void 0:o.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(o)));const a=JSON.parse(JSON.stringify(r||{}));(null==a?void 0:a.userSnippylyId)&&!(null==a?void 0:a.isGuest)&&this.checkToMigrateGuestUser(a),Snippyly.getUserRole$().subscribe((t=>{var e;this.loading=!1,this.snippylyUserRole=t,null===(e=this.commentElement)||void 0===e||e.enablePriority()})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getFeaturesAccessLevelIam$)&&this.subscriptions.push(Snippyly.getFeaturesAccessLevelIam$().subscribe((async t=>{var e,i,o,n,s,r,a,l;this.allFeatureDisabled=!!(null===(e=null==t?void 0:t.all)||void 0===e?void 0:e.disabled),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===(s=null===(n=null==t?void 0:t.all)||void 0===n?void 0:n.guestModeConfig)||void 0===s?void 0:s.allowSignIn),(null===(r=null==t?void 0:t.all)||void 0===r?void 0:r.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([])),Ms("sfGuestMode",this.guestMode+"",!0),Ms("sfGuestModeAllowSignIn",this.allowGuestModeSignIn+"",!0),Ms("sfPasswordProtected",this.passwordProtected+"",!0)}),(t=>{this.loading=!1,console.warn("Error in getFeaturesAccessLevelIam$: ",t),Ps("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),Ps("Error in isPlanExpired$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCustomerMetadata$)&&(null===Snippyly||void 0===Snippyly||Snippyly.getCustomerMetadata$().subscribe((t=>{Ds(t),t&&(this.customerMetadata=t)}),(t=>{console.warn("Error in getCustomerMetadata$: ",t),Ps("Error in getCustomerMetadata$: ",t)}))),Us({clientUserId:null==o?void 0:o.userId}),this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{_s("sfTourCommentTooltip")||(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,this.projectId&&(async(t,e)=>{try{const i=Ke(js,wt);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("sprojectInstall"))this.isSigningInUserAdmin=!0;else if(_s("sfUserAdmin"))this.isSigningInUserAdmin="true"===_s("sfUserAdmin",!0);else{const t=await(async(t,e,i)=>{try{const o=Ke(js,yt),n=await o({apiKey:t,projectId:e,email:i});return null==n?void 0:n.data}catch(t){return console.warn("Error in iam: ",t),null}})(this.apiKey,this.projectId||"",i);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),Ms("sfUserAdmin",this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),Ps("Error in identifySnippyly: ",t)}},this.checkToMigrateGuestUser=async t=>{try{const e=Os(!1);e&&(await Bs(this.apiKey,this.projectId||"",e,t,!0),Ns("_sfgut"))}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),Ps("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),Ps("Error in getComments: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),Ps("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Ps("Error in toggleSnippylyPluginToolbar: ",t)}},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.commentElement.disablePrivateCommentMode&&this.commentElement.disablePrivateCommentMode(),this.privateCommentModeEnabled=!1):(this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode(),this.privateCommentModeEnabled=!0))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),Ps("Error in togglePrivateCommentMode: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading||this.customLoginEnabledLocally)return;window.open(this.signInUrl,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Ps("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const e=Is(t,mt,gt),i=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getqrcode?text=${encodeURIComponent(e)}`),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),Ps("Error in getQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),Ps("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{this.exitReviewModeCalled=!0,Ns("review"),Ns("feedback"),Ns("sreviewId"),Ns("projectVersionKey","sessionStorage"),Ns("projectVersion","sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete("sreviewId"),e.delete("review"),e.delete("feedback"),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete("sversion"),e.delete("sprojectInstall"),e.delete("sflivedemo"),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),Ps("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),await Snippyly.signOutUser(),Ns("snippyly-user"),Ns("_sfut"),Ns("sfUserAdmin"),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Ps("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),Ps("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),Ps("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${vt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const e=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();e&&(t=`${vt}/dashboard/project/comment/${this.apiKey}/${e}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Ps("Error in goToAdminPortal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${vt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId())&&(t=`${vt}/dashboard`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),Ps("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),Ps("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Ms("sprojectInstall","true");const t=new URL(document.location);t.searchParams.delete("sprojectInstall"),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Ps("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Ms("sflivedemo","true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete("sflivedemo"),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Ps("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete("sffigmademo"),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),Ps("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),Ps("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,Ms("sfTourCommentTooltip","true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Ps("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{Rs(Ys.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),Ps("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,Rs(Ys.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),Ps("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),Ps("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{Rs(Ys.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),Ps("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.showGuestModeNameModal=!0,Rs(Ys.Events.GUEST_MODE_NAME_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeNameModel: ",t),Ps("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),Ps("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{Rs(Ys.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),Ps("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{Rs(Ys.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),Ps("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{Rs(Ys.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),Ps("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,Rs(Ys.Events.GUEST_MODE_SIGN_IN_BANNER_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),Ps("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),Ps("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{Rs(Ys.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),Ps("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=Os();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=Is(e,mt,gt);Ms("_sfgut",i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),Ps("Error in updateGuestUser: ",t)}})(e),await Snippyly.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await Bs(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,Ms("sfGuestUserNameUpdated","true"),Rs(Ys.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),Ps("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(!(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=Ke(js,St),s=await n({apiKey:t,projectId:e,password:i});return null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in validatePassword: ",t),null}})(this.apiKey,this.projectId,this.password),Ms("sfPasswordIsValid",this.isPasswordValid+"",!0),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,Velt&&Velt.disableFeatures([])):this.showInvalidPassword=!0,this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),Ps("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 Bs(this.apiKey,this.projectId||"",e,i),await Snippyly.updateUser(i),this.snippylyUser=JSON.parse(JSON.stringify(i));const o=As();o.name=i.name;const n=JSON.stringify(o),s=Is(n,mt,gt);Ms("_sfut",s,!0),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),Ps("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),Ps("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?F`
|
|
2451
2451
|
<div class="disable-add-comment-button" @click=${()=>this.disableCommentMode()}>
|
|
2452
2452
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2453
2453
|
<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"/>
|
package/superflow.min.js
CHANGED
|
@@ -2446,7 +2446,7 @@ class Tr extends lt{constructor(t){if(super(t),this.it=$,t.type!==rt)throw Error
|
|
|
2446
2446
|
${Lr(this.wordMark)}
|
|
2447
2447
|
`:O`
|
|
2448
2448
|
<img src=${this.wordMark} />
|
|
2449
|
-
`}catch(t){return console.warn("Error in getWordMark: ",t),O``}},this.generateLocation=()=>{try{if(this.autoLocation){const t=new URL(document.location).searchParams,e=new URL(document.location);e.searchParams.delete(ht),e.searchParams.delete(ut),e.searchParams.delete(pt),e.searchParams.delete(vt),e.searchParams.delete(xt),e.searchParams.delete(Et);const i=t.get(bt)||this.projectVersion;e.search="";let o=(t=>{try{return t.replace(/#.*$/,"")}catch(e){return console.warn("Error in removeHashFromUrl: ",e),Cr("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),Cr("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;null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))),wr({clientLocation:this.location}),this.previousLocation=JSON.parse(JSON.stringify(this.location))}}catch(t){console.warn("Error in setLocation: ",t),Cr("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,e;let i="";try{this.invalidApiKey=!1;let e,o={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0};if(e=this.customLoginEnabled&&this.providedUser?this.providedUser:hr(),(null==e?void 0:e.email)&&(o=e),o.isAnonymous?delete o.groupId:o.groupId=Snippyly.getDocumentId()+"",this.customLoginEnabledLocally||(null===(t=null==o?void 0:o.contacts)||void 0===t?void 0:t.length)&&(o.contacts=[]),i=null==o?void 0:o.email,(null==o?void 0:o.isAnonymous)&&this.projectId&&this.guestMode){const t=pr();t&&(o=JSON.parse(JSON.stringify(t)))}(null==o?void 0:o.isAnonymous)||(this.loading=!0);const n=await(async(t,e)=>{var i,o;try{const n=Mi(mr,Wt),s=await n({apiKey:t,userId:e});return null===(o=null===(i=null==s?void 0:s.data)||void 0===i?void 0:i.data)||void 0===o?void 0:o.token}catch(t){return console.warn("Error in generateSuperflowAuthToken: ",t),null}})(this.apiKey,null==o?void 0:o.userId),s={};n&&(s.authToken=n);const r=await Snippyly.identify(o,s);yr(JSON.parse(JSON.stringify(r||{}))),(null==o?void 0:o.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(o)));const a=JSON.parse(JSON.stringify(r||{}));(null==a?void 0:a.userSnippylyId)&&!(null==a?void 0:a.isGuest)&&this.checkToMigrateGuestUser(a),Snippyly.getUserRole$().subscribe((t=>{var e;this.loading=!1,this.snippylyUserRole=t,null===(e=this.commentElement)||void 0===e||e.enablePriority()})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getFeaturesAccessLevelIam$)&&this.subscriptions.push(Snippyly.getFeaturesAccessLevelIam$().subscribe((async t=>{var e,i,o,n,s,r,a,l;this.allFeatureDisabled=!!(null===(e=null==t?void 0:t.all)||void 0===e?void 0:e.disabled),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===(s=null===(n=null==t?void 0:t.all)||void 0===n?void 0:n.guestModeConfig)||void 0===s?void 0:s.allowSignIn),(null===(r=null==t?void 0:t.all)||void 0===r?void 0:r.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),sr(_t,this.guestMode+"",!0),sr(Lt,this.allowGuestModeSignIn+"",!0),sr(Nt,this.passwordProtected+"",!0)}),(t=>{this.loading=!1,console.warn("Error in getFeaturesAccessLevelIam$: ",t),Cr("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),Cr("Error in isPlanExpired$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCustomerMetadata$)&&(null===Snippyly||void 0===Snippyly||Snippyly.getCustomerMetadata$().subscribe((t=>{vr(t),t&&(this.customerMetadata=t)}),(t=>{console.warn("Error in getCustomerMetadata$: ",t),Cr("Error in getCustomerMetadata$: ",t)}))),wr({clientUserId:null==o?void 0:o.userId}),this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{rr(St)||(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,this.projectId&&(async(t,e)=>{try{const i=Mi(mr,Bt);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(xt))this.isSigningInUserAdmin=!0;else if(rr(Mt))this.isSigningInUserAdmin="true"===rr(Mt,!0);else{const t=await(async(t,e,i)=>{try{const o=Mi(mr,Zt),n=await o({apiKey:t,projectId:e,email:i});return null==n?void 0:n.data}catch(t){return console.warn("Error in iam: ",t),null}})(this.apiKey,this.projectId||"",i);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),sr(Mt,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),Cr("Error in identifySnippyly: ",t)}},this.checkToMigrateGuestUser=async t=>{try{const e=pr(!1);e&&(await Er(this.apiKey,this.projectId||"",e,t,!0),ar(wt))}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),Cr("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),Cr("Error in getComments: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),Cr("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Cr("Error in toggleSnippylyPluginToolbar: ",t)}},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.commentElement.disablePrivateCommentMode&&this.commentElement.disablePrivateCommentMode(),this.privateCommentModeEnabled=!1):(this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode(),this.privateCommentModeEnabled=!0))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),Cr("Error in togglePrivateCommentMode: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading||this.customLoginEnabledLocally)return;window.open(this.signInUrl,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Cr("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const e=cr(t,Rt,Pt),i=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getqrcode?text=${encodeURIComponent(e)}`),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),Cr("Error in getQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),Cr("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{this.exitReviewModeCalled=!0,ar(ht),ar(ut),ar(pt),ar(yt,"sessionStorage"),ar(Ct,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(pt),e.delete(ht),e.delete(ut),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(bt),e.delete(xt),e.delete(Et),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),Cr("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),await Snippyly.signOutUser(),ar(mt),ar(ft),ar(Mt),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Cr("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),Cr("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),Cr("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${zt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const e=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();e&&(t=`${zt}/dashboard/project/comment/${this.apiKey}/${e}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Cr("Error in goToAdminPortal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${zt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId())&&(t=`${zt}/dashboard`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),Cr("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),Cr("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,sr(xt,"true");const t=new URL(document.location);t.searchParams.delete(xt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Cr("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,sr(Et,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(Et),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Cr("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(kt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),Cr("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),Cr("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,sr(St,"true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Cr("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{br(Nr.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),Cr("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,br(Nr.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),Cr("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),Cr("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{br(Nr.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),Cr("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.showGuestModeNameModal=!0,br(Nr.Events.GUEST_MODE_NAME_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeNameModel: ",t),Cr("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),Cr("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{br(Nr.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),Cr("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{br(Nr.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),Cr("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{br(Nr.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),Cr("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,br(Nr.Events.GUEST_MODE_SIGN_IN_BANNER_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),Cr("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),Cr("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{br(Nr.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),Cr("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=pr();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=cr(e,Rt,Pt);sr(wt,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),Cr("Error in updateGuestUser: ",t)}})(e),await Snippyly.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await Er(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,sr(At,"true"),br(Nr.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),Cr("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(!(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=Mi(mr,qt),s=await n({apiKey:t,projectId:e,password:i});return null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in validatePassword: ",t),null}})(this.apiKey,this.projectId,this.password),sr(Tt,this.isPasswordValid+"",!0),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1):this.showInvalidPassword=!0,this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),Cr("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 Er(this.apiKey,this.projectId||"",e,i),await Snippyly.updateUser(i),this.snippylyUser=JSON.parse(JSON.stringify(i));const o=hr();o.name=i.name;const n=JSON.stringify(o),s=cr(n,Rt,Pt);sr(ft,s,!0),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),Cr("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),Cr("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?O`
|
|
2449
|
+
`}catch(t){return console.warn("Error in getWordMark: ",t),O``}},this.generateLocation=()=>{try{if(this.autoLocation){const t=new URL(document.location).searchParams,e=new URL(document.location);e.searchParams.delete(ht),e.searchParams.delete(ut),e.searchParams.delete(pt),e.searchParams.delete(vt),e.searchParams.delete(xt),e.searchParams.delete(Et);const i=t.get(bt)||this.projectVersion;e.search="";let o=(t=>{try{return t.replace(/#.*$/,"")}catch(e){return console.warn("Error in removeHashFromUrl: ",e),Cr("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),Cr("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;null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))),wr({clientLocation:this.location}),this.previousLocation=JSON.parse(JSON.stringify(this.location))}}catch(t){console.warn("Error in setLocation: ",t),Cr("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,e;let i="";try{this.invalidApiKey=!1;let e,o={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0};if(e=this.customLoginEnabled&&this.providedUser?this.providedUser:hr(),(null==e?void 0:e.email)&&(o=e),o.isAnonymous?delete o.groupId:o.groupId=Snippyly.getDocumentId()+"",this.customLoginEnabledLocally||(null===(t=null==o?void 0:o.contacts)||void 0===t?void 0:t.length)&&(o.contacts=[]),i=null==o?void 0:o.email,(null==o?void 0:o.isAnonymous)&&this.projectId&&this.guestMode){const t=pr();t&&(o=JSON.parse(JSON.stringify(t)))}(null==o?void 0:o.isAnonymous)||(this.loading=!0);const n=await(async(t,e)=>{var i,o;try{const n=Mi(mr,Wt),s=await n({apiKey:t,userId:e});return null===(o=null===(i=null==s?void 0:s.data)||void 0===i?void 0:i.data)||void 0===o?void 0:o.token}catch(t){return console.warn("Error in generateSuperflowAuthToken: ",t),null}})(this.apiKey,null==o?void 0:o.userId),s={};n&&(s.authToken=n);const r=await Snippyly.identify(o,s);yr(JSON.parse(JSON.stringify(r||{}))),(null==o?void 0:o.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(o)));const a=JSON.parse(JSON.stringify(r||{}));(null==a?void 0:a.userSnippylyId)&&!(null==a?void 0:a.isGuest)&&this.checkToMigrateGuestUser(a),Snippyly.getUserRole$().subscribe((t=>{var e;this.loading=!1,this.snippylyUserRole=t,null===(e=this.commentElement)||void 0===e||e.enablePriority()})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getFeaturesAccessLevelIam$)&&this.subscriptions.push(Snippyly.getFeaturesAccessLevelIam$().subscribe((async t=>{var e,i,o,n,s,r,a,l;this.allFeatureDisabled=!!(null===(e=null==t?void 0:t.all)||void 0===e?void 0:e.disabled),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===(s=null===(n=null==t?void 0:t.all)||void 0===n?void 0:n.guestModeConfig)||void 0===s?void 0:s.allowSignIn),(null===(r=null==t?void 0:t.all)||void 0===r?void 0:r.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([])),sr(_t,this.guestMode+"",!0),sr(Lt,this.allowGuestModeSignIn+"",!0),sr(Nt,this.passwordProtected+"",!0)}),(t=>{this.loading=!1,console.warn("Error in getFeaturesAccessLevelIam$: ",t),Cr("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),Cr("Error in isPlanExpired$: ",t)}))),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCustomerMetadata$)&&(null===Snippyly||void 0===Snippyly||Snippyly.getCustomerMetadata$().subscribe((t=>{vr(t),t&&(this.customerMetadata=t)}),(t=>{console.warn("Error in getCustomerMetadata$: ",t),Cr("Error in getCustomerMetadata$: ",t)}))),wr({clientUserId:null==o?void 0:o.userId}),this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{rr(St)||(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,this.projectId&&(async(t,e)=>{try{const i=Mi(mr,Bt);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(xt))this.isSigningInUserAdmin=!0;else if(rr(Mt))this.isSigningInUserAdmin="true"===rr(Mt,!0);else{const t=await(async(t,e,i)=>{try{const o=Mi(mr,Zt),n=await o({apiKey:t,projectId:e,email:i});return null==n?void 0:n.data}catch(t){return console.warn("Error in iam: ",t),null}})(this.apiKey,this.projectId||"",i);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),sr(Mt,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),Cr("Error in identifySnippyly: ",t)}},this.checkToMigrateGuestUser=async t=>{try{const e=pr(!1);e&&(await Er(this.apiKey,this.projectId||"",e,t,!0),ar(wt))}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),Cr("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),Cr("Error in getComments: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),Cr("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Cr("Error in toggleSnippylyPluginToolbar: ",t)}},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.commentElement.disablePrivateCommentMode&&this.commentElement.disablePrivateCommentMode(),this.privateCommentModeEnabled=!1):(this.commentElement.enablePrivateCommentMode&&this.commentElement.enablePrivateCommentMode(),this.privateCommentModeEnabled=!0))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),Cr("Error in togglePrivateCommentMode: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading||this.customLoginEnabledLocally)return;window.open(this.signInUrl,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Cr("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const e=cr(t,Rt,Pt),i=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getqrcode?text=${encodeURIComponent(e)}`),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),Cr("Error in getQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),Cr("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{this.exitReviewModeCalled=!0,ar(ht),ar(ut),ar(pt),ar(yt,"sessionStorage"),ar(Ct,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(pt),e.delete(ht),e.delete(ut),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(bt),e.delete(xt),e.delete(Et),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),Cr("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),await Snippyly.signOutUser(),ar(mt),ar(ft),ar(Mt),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Cr("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),Cr("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),Cr("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${zt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const e=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();e&&(t=`${zt}/dashboard/project/comment/${this.apiKey}/${e}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Cr("Error in goToAdminPortal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${zt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId())&&(t=`${zt}/dashboard`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),Cr("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),Cr("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,sr(xt,"true");const t=new URL(document.location);t.searchParams.delete(xt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Cr("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,sr(Et,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(Et),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Cr("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(kt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),Cr("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),Cr("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,sr(St,"true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Cr("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{br(Nr.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),Cr("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,br(Nr.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),Cr("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),Cr("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{br(Nr.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),Cr("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.showGuestModeNameModal=!0,br(Nr.Events.GUEST_MODE_NAME_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeNameModel: ",t),Cr("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),Cr("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{br(Nr.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),Cr("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{br(Nr.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),Cr("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{br(Nr.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),Cr("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,br(Nr.Events.GUEST_MODE_SIGN_IN_BANNER_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),Cr("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),Cr("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{br(Nr.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),Cr("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=pr();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=cr(e,Rt,Pt);sr(wt,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),Cr("Error in updateGuestUser: ",t)}})(e),await Snippyly.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await Er(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,sr(At,"true"),br(Nr.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),Cr("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(!(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=Mi(mr,qt),s=await n({apiKey:t,projectId:e,password:i});return null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in validatePassword: ",t),null}})(this.apiKey,this.projectId,this.password),sr(Tt,this.isPasswordValid+"",!0),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,Velt&&Velt.disableFeatures([])):this.showInvalidPassword=!0,this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),Cr("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 Er(this.apiKey,this.projectId||"",e,i),await Snippyly.updateUser(i),this.snippylyUser=JSON.parse(JSON.stringify(i));const o=hr();o.name=i.name;const n=JSON.stringify(o),s=cr(n,Rt,Pt);sr(ft,s,!0),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),Cr("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),Cr("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?O`
|
|
2450
2450
|
<div class="disable-add-comment-button" @click=${()=>this.disableCommentMode()}>
|
|
2451
2451
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2452
2452
|
<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"/>
|