@usesuperflow/toolbar-staging 1.0.248 → 1.0.250
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 +4 -4
- package/superflow.min.js +4 -4
package/package.json
CHANGED
package/superflow.js
CHANGED
|
@@ -2447,7 +2447,7 @@ class ws extends uo{}ws.Encryptor=class extends ws{processBlock(t,e){const i=t,o
|
|
|
2447
2447
|
* Copyright 2017 Google LLC
|
|
2448
2448
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2449
2449
|
*/
|
|
2450
|
-
class Js extends at{constructor(t){if(super(t),this.it=D,t.type!==st)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this.ft=void 0,this.it=t;if(t===O)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.ft;this.it=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Js.directiveName="unsafeHTML",Js.resultType=1;const qs=rt(Js);var Qs=function(t,e,i,o){for(var n,s=arguments.length,r=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(e,i,r):n(e,i))||r);return s>3&&r&&Object.defineProperty(e,i,r),r};class Xs extends Q{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this.showTourCommentTooltip=!1,this.allFeatureDisabled=!1,this.allFeatureRestricted=!1,this.guestMode=!1,this._expanded=!0,this.loading=!0,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!1,this.showFigmaDemoModal=!1,this.showGuestModeSignInModal=!1,this.defaultGuestModeSignInModalConfig={title:"Sign in to notify your team",description:"Notify your team about your latest comments.",closeOnClickOutside:!1,showLeaveCommentButton:!0},this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig)),this.showGuestModeNameModal=!1,this.guestModeSignInBannerVisible=!1,this.guestUserNameInput="",this.guestUserModelOpened=!1,this.guestUserNameUpdated=!1,this.guestUserNameUpdateLoading=!1,this.staging=true,this._autoLocation=!0,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this._isUserGlobalContact=!1,this.showQrCode=!1,this.customLoginEnabledLocally=null,this.customLoginEnabled=null,this.exitReviewModeCalled=!1,this.addCommentCount=0,this._privateCommentModeEnabled=!1,this.superflowToolbarMoved=!1,this._darkMode=!1,this.allowGuestModeSignIn=!0,this.toolbarEnabled=!1,this.toolbarEnabledApiCalled=!1,this.passwordProtected=!1,this.isPasswordValid=!1,this.password="",this.validatingPasswordLoading=!1,this.showPasswordProtectedModal=!1,this.showInvalidPassword=!1,this._totalViews={},this.totalViewsCount=0,this.subscriptions=[],this.onApiKeyChange=()=>{try{this.apiKey&&(null===window||void 0===window?void 0:window.onSuperflowLoad)&&"function"==typeof window.onSuperflowLoad&&window.onSuperflowLoad()}catch(t){console.warn("Error in onApiKeyChange: ",t),Ps("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const e=await(t=>{const e={apiKey:t};return Ke($s,Et)(e)})(this.apiKey);this.customLoginEnabled=!!(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.customLoginEnabled),this.customLoginEnabled&&this.loginWithCustomUser()}catch(t){this.customLoginEnabled=!1,console.warn("Error in checkCustomLoginEnabled: ",t),Ps("Error in checkCustomLoginEnabled: ",t)}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(Ns("_sfut"),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),Ps("Error in loginWithCustomUser: ",t)}},this.addWindowClickEventListener=()=>{try{this.windowClickEventListener||(this.windowClickEventListener=()=>{this.menuOpenedId&&(this.menuOpenedId=void 0)},window.addEventListener("click",this.windowClickEventListener))}catch(t){console.warn("Error in addWindowClickEventListener: ",t),Ps("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Ps("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Ps("Error in setWindowEventListner: ",t)}},this.urlChangeListener=()=>{try{const t=history.pushState;history.pushState=function(){const e=t.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),e};const e=history.replaceState;history.replaceState=function(){const t=e.apply(this,arguments);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),t},window.addEventListener("popstate",(()=>{window.dispatchEvent(new Event("locationchange"))}))}catch(t){console.warn("Error in urlChangeListener: ",t),Ps("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),e=t.searchParams;if((null==e?void 0:e.has("sprojectInstall"))&&!_s("sprojectInstall")?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==e?void 0:e.has("sflivedemo"))if(_s("sflivedemo",!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete("sflivedemo"),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showLiveDemoModal=!0;else this.showLiveDemoModal=!1;if(null==e?void 0:e.has("sffigmademo"))if(_s("sffigmademo",!1)){this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete("sffigmademo"),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showFigmaDemoModal=!0;else this.showFigmaDemoModal=!1;if(e.has("st")||e.has("snippyly_google_token")){if(e.has("st")){const t=decodeURIComponent(e.get("st")),i=Ls(t,mt,gt),o=i&&JSON.parse(i);if(o){const t={};t.userId=o.uid,t.name=o.displayName,t.email=o.email,t.photoUrl=null==o?void 0:o.photoURL;const e=JSON.stringify(t),i=Is(e,mt,gt);Ms("_sfut",i,!0),Ns("sfUserAdmin")}}else if(e.has("snippyly_google_token")){const t=JSON.parse(atob(e.get("snippyly_google_token"))),i={};i.userId=t.uid,i.name=t.displayName,i.email=t.email,i.photoUrl=null==t?void 0:t.photoURL,Ms("snippyly-user",JSON.stringify(i),!0)}e.delete("st"),e.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}e.has("review")?(Ms("review","true",!1),Ns("feedback"),e.delete("review"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has("feedback")||_s("review",!1)&&this.loadPluginUI(),e.has("feedback")?(Ms("feedback","true",!1),Ns("review"),e.delete("feedback"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has("review")||_s("feedback",!1)&&this.loadPluginUI(),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t),Ps("Error in checkUrl: ",t)}},this.detectVersion=()=>{try{if(this.projectVersionKey){const t=new URL(document.location).searchParams;if(t.get(this.projectVersionKey))this.projectVersion=t.get(this.projectVersionKey);else if(window.snippylyInitialLoadUrl){const t=new URL(window.snippylyInitialLoadUrl).searchParams;t.get(this.projectVersionKey)&&(this.projectVersion=t.get(this.projectVersionKey))}this.projectVersion&&Ms("projectVersion",this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has("review")||t.has("feedback"))&&t.has("sversion")&&(Ms("projectVersionKey","sversion",!1,"sessionStorage"),this.projectVersion=t.get("sversion"),this.projectVersion&&Ms("projectVersion",this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Ps("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||_s("projectVersionKey",!1,"sessionStorage"),e=this.projectVersion||_s("projectVersion",!1,"sessionStorage");if(t&&e){const i=new URL(document.location),o=i.searchParams;o.get(t)||(o.set(t,e),window.history.replaceState({},document.title,i.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),Ps("Error in setVersionInUrl: ",t)}},this.loadPluginUI=async()=>{var t,e,i,o,n,s,r;try{if(!this.apiKey)return;if(!this.projectId)return;if(this.loadPlugin)return this.generateLocation(),void this.setLocation();if(this.toolbarEnabledApiCalled||await this.detectToolbarEnabled(),!this.toolbarEnabled)return;const a=As();if(a&&!(null==a?void 0:a.isAnonymous)&&(this.loading=!0),null===(t=this.getCustomerMetadata())||void 0===t||t.then((t=>{this.customerMetadata=t})).catch((t=>{console.warn("Error in getCustomerMetadata: ",t),Ps("Error in getCustomerMetadata: ",t)})),_s("sfPasswordIsValid",!0)&&(this.isPasswordValid="true"===_s("sfPasswordIsValid",!0)),_s("sfGuestMode",!0)&&_s("sfGuestModeAllowSignIn",!0)&&_s("sfPasswordProtected",!0)?(this.guestMode="true"===_s("sfGuestMode",!0),this.allowGuestModeSignIn="true"===_s("sfGuestModeAllowSignIn",!0),this.passwordProtected="true"===_s("sfPasswordProtected",!0)):(this.projectConfig=await(async(t,e)=>{var i;try{const o=Ke($s,kt),n=await o({apiKey:t,projectId:e});return null===(i=null==n?void 0:n.data)||void 0===i?void 0:i.data}catch(t){return console.warn("Error in getProjectConfig: ",t),null}})(this.apiKey,this.projectId),this.guestMode=!!(null===(e=this.projectConfig)||void 0===e?void 0:e.guestMode)||this.guestMode,this.allowGuestModeSignIn=!!(null===(o=null===(i=this.projectConfig)||void 0===i?void 0:i.guestModeConfig)||void 0===o?void 0:o.allowSignIn),(null===(n=this.projectConfig)||void 0===n?void 0:n.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(r=null===(s=this.projectConfig)||void 0===s?void 0:s.passwordProtected)||void 0===r?void 0:r.enabled),Ms("sfGuestMode",this.guestMode+"",!0),Ms("sfGuestModeAllowSignIn",this.allowGuestModeSignIn+"",!0),Ms("sfPasswordProtected",this.passwordProtected+"",!0)),this.loadPlugin=!0,!document.querySelector(ct.VELT_COMMENTS)){const t=document.createElement(ct.VELT_COMMENTS);null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),t.addEventListener("onCommentAdd",(t=>{console.log("Comment added: ",null==t?void 0:t.detail),this.addCommentCount++})),t.addEventListener("onCommentUpdate",(t=>{var e,i;console.log("Comment updated: ",t.detail),(null===(e=this.snippylyUser)||void 0===e?void 0:e.isGuest)&&"newlyAdded"===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&(console.log(this.addCommentCount),this.addCommentCount>=2&&!_s("sfGuestUserModelOpened")&&(this.allowGuestModeSignIn?this.openGuestModeSignInModal():this.openGuestModeNameModel(),Ms("sfGuestUserModelOpened","true")),this.addCommentCount>=5&&!_s("sfGuestUserBannerOpened",!1,"sessionStorage")&&(this.showGuestModeSignInBanner(),Ms("sfGuestUserBannerOpened","true",!1,"sessionStorage")))})),window.document.body.appendChild(t)}if(!document.querySelector(ct.VELT_CURSOR)){const t=document.createElement(ct.VELT_CURSOR);window.document.body.appendChild(t)}if(!document.querySelector(ct.VELT_HUDDLE)){const t=document.createElement(ct.VELT_HUDDLE);window.document.body.appendChild(t)}if(!document.querySelector(ct.VELT_RECORDER_NOTES)){const t=document.createElement(ct.VELT_RECORDER_NOTES);window.document.body.appendChild(t)}if(!document.querySelector(ct.VELT_RECORDER_CONTROL_PANEL)){const t=document.createElement(ct.VELT_RECORDER_CONTROL_PANEL);window.document.body.appendChild(t)}if(!document.querySelector(ct.VELT_ARROWS)){const t=document.createElement(ct.VELT_ARROWS);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Ps("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var t,i,o,n,s,r,a,l,c,d,h,u,p,v,m,g,f,w,y;try{if(await e(this.apiKey,{options:{develop:this.staging,version:this.staging?"1.0.333":"latest",velt:!0}}),!window.Snippyly)return;if(this.autoTranslation&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.enableAutoTranslation)&&(null===Snippyly||void 0===Snippyly||Snippyly.enableAutoTranslation()),!document.querySelector(ct.VELT_COMMENTS_SIDEBAR)){const t=document.createElement(ct.VELT_COMMENTS_SIDEBAR);t.setAttribute(dt.ENABLE_URL_NAVIGATION,"true"),t.setAttribute(dt.CURRENT_LOCATION_SUFFIX,"true"),window.document.body.appendChild(t)}if(Snippyly){null===Snippyly||void 0===Snippyly||Snippyly.sf(!0);try{(null===window||void 0===window?void 0:window.onSnippylyLoad)&&(null===window||void 0===window||window.onSnippylyLoad(Snippyly))}catch(t){}document.body.style.setProperty("--velt-default-font-family","'Poppins', sans-serif"),(()=>{try{if(!document.getElementById("superflowFontLink1")){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",t.id="superflowFontLink1",document.head.appendChild(t)}if(!document.getElementById("superflowFontLink2")){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="anonymous",t.id="superflowFontLink2",document.head.appendChild(t)}if(!document.getElementById("superflowFontLink3")){const t=document.createElement("link");t.rel="stylesheet",t.href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap",t.id="superflowFontLink3",document.head.appendChild(t)}}catch(t){console.warn("Error in loadPoppinsFont: ",t),Ps("Error in loadPoppinsFont: ",t)}})()}Snippyly&&Us({sdkVersion:null===Snippyly||void 0===Snippyly?void 0:Snippyly.version,sdkType:"client"}),this.documentId=((t,e=0)=>{try{let i=3735928559^e,o=1103547991^e;for(let e,n=0;n<t.length;n++)e=t.charCodeAt(n),i=Math.imul(i^e,2654435761),o=Math.imul(o^e,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&o)+(i>>>0)}catch(t){return console.warn("Error in cyrb53: ",t),Ps("Error in cyrb53: ",t),0}})((t=>{let e;return e=t.includes("http")?new URL(t):new URL("http://"+t),e.hostname.replace("www.","")})(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setDocumentId(this.documentId+""));const C=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();if(Us({documentId:C,clientDocumentId:this.documentId}),this.generateLocation(),this.setLocation(),this.commentElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCommentElement(),this.contactElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getContactElement(),this.rewriterElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getRewriterElement(),this.presenceElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getPresenceElement(),this.commentElement){this.commentElement.enableTextComments(!0),this.customLoginEnabledLocally||this.commentElement.enableSignInButton(!0),this.commentElement.enableAttachments(!0),(null===(t=this.commentElement)||void 0===t?void 0:t.showScreenSizeInfo)&&this.commentElement.showScreenSizeInfo(!0),(null===(i=this.commentElement)||void 0===i?void 0:i.enableDeviceInfo)&&this.commentElement.enableDeviceInfo(!0),this.commentElement.enableCommentIndex(!0),this.commentElement.onCommentModeChange&&this.commentElement.onCommentModeChange().subscribe((t=>{this.addCommentMode=t})),(null===(o=this.commentElement)||void 0===o?void 0:o.enableOrphanComments)&&this.commentElement.enableOrphanComments(),(null===(n=this.commentElement)||void 0===n?void 0:n.enableAutoCategorize)&&this.commentElement.enableAutoCategorize(),(null===(s=this.commentElement)||void 0===s?void 0:s.enablePersistentCommentMode)&&this.commentElement.enablePersistentCommentMode(),(null===(r=this.commentElement)||void 0===r?void 0:r.enableGhostComments)&&this.commentElement.enableGhostComments();const e=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;e&&"object"==typeof e&&(null===(a=this.commentElement)||void 0===a?void 0:a.setCustomStatus)&&this.commentElement.setCustomStatus(e),(null===(l=this.commentElement)||void 0===l?void 0:l.enableMinimap)&&this.commentElement.enableMinimap(),(null===(c=this.commentElement)||void 0===c?void 0:c.setDStrategy)&&(null===(d=this.commentElement)||void 0===d||d.setDStrategy("dynamicId")),(null===(h=this.commentElement)||void 0===h?void 0:h.enableSidebarButtonOnCommentDialog)&&this.commentElement.enableSidebarButtonOnCommentDialog(),(null===(u=this.commentElement)||void 0===u?void 0:u.enableHotkey)&&this.commentElement.enableHotkey()}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(p=this.rewriterElement)||void 0===p||p.enableRewriter()),this.presenceElement&&(null===(v=this.presenceElement)||void 0===v?void 0:v.enableFlockMode)&&(null===(m=this.presenceElement)||void 0===m||m.enableFlockMode(!0)),null===(g=null===Snippyly||void 0===Snippyly?void 0:Snippyly.docService)||void 0===g||g.getDocumentMetadata$().subscribe((t=>{const e=(null==t?void 0:t.versions)?Object.values(null==t?void 0:t.versions):[],i=new URL(document.location).searchParams.get("version");if(i){const t=e.find((t=>t.versionId===i));t&&(this.version={id:t.versionId,name:t.versionName||t.versionId},this.setLocation())}})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getViewsElement)&&(this.viewsElement=Snippyly.getViewsElement()),(null===(f=this.viewsElement)||void 0===f?void 0:f.getUniqueViewsByUser)&&(null===(y=null===(w=this.viewsElement)||void 0===w?void 0:w.getUniqueViewsByUser())||void 0===y||y.subscribe((t=>{this.totalViews=t}))),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Ps("Error in initializeSnippyly: ",t)}},this.checkToEnableUpgradeButton=()=>{var t,e;try{this.isPlanExpired&&this.isUserGlobalContact?(null===(t=this.commentElement)||void 0===t?void 0:t.enableUpgradeButton)&&this.commentElement.enableUpgradeButton():(null===(e=this.commentElement)||void 0===e?void 0:e.disableUpgradeButton)&&this.commentElement.disableUpgradeButton()}catch(t){console.warn("Error in checkToEnableUpgradeButton: ",t),Ps("Error in checkToEnableUpgradeButton: ",t)}},this.getCustomerMetadata=async()=>{try{let t=(()=>{try{const t=_s("sfCustomerMetadata");return t?"false"===t?JSON.parse(JSON.stringify(ht)):JSON.parse(t):null}catch(t){return console.warn("Error in getCustomerMetadataFromStorage: ",t),Ps("Error in getCustomerMetadataFromStorage: ",t),null}})();return t||(t=await(async t=>{try{const e=Ke($s,Ct),i=await e({apiKey:t});return null==i?void 0:i.data}catch(t){return console.warn("Error in getCustomerMetadata: ",t),null}})(this.apiKey),Ds(t)),t}catch(t){console.warn("Error in getCustomerMetadata: ",t),Ps("Error in getCustomerMetadata: ",t)}},this.setLogos=()=>{var t,e,i,o,n,s,r,a,l,c,d,h;try{let u="light";this.privateCommentModeEnabled&&(u="dark");const p=null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.customBranding)||void 0===e?void 0:e.logo)||void 0===i?void 0:i.logoMark,v=null===(s=null===(n=null===(o=null==pt?void 0:ht)||void 0===o?void 0:o.customBranding)||void 0===n?void 0:n.logo)||void 0===s?void 0:s.logoMark,m=null===(l=null===(a=null===(r=this.customerMetadata)||void 0===r?void 0:r.customBranding)||void 0===a?void 0:a.logo)||void 0===l?void 0:l.wordMark,g=null===(h=null===(d=null===(c=null==pt?void 0:ht)||void 0===c?void 0:c.customBranding)||void 0===d?void 0:d.logo)||void 0===h?void 0:h.wordMark;switch(u){case"light":this.logoMark=(null==p?void 0:p.lightUrl)||(null==p?void 0:p.darkUrl)||(null==v?void 0:v.lightUrl),this.wordMark=(null==m?void 0:m.lightUrl)||(null==m?void 0:m.darkUrl)||(null==g?void 0:g.lightUrl);break;case"dark":this.logoMark=(null==p?void 0:p.darkUrl)||(null==p?void 0:p.lightUrl)||(null==v?void 0:v.darkUrl),this.wordMark=(null==m?void 0:m.darkUrl)||(null==m?void 0:m.lightUrl)||(null==g?void 0:g.darkUrl)}}catch(t){console.warn("Error in setLogos: ",t),Ps("Error in setLogos: ",t)}},this.getLogoMark=()=>{var t;try{return(null===(t=this.logoMark)||void 0===t?void 0:t.includes("<svg"))?F`
|
|
2450
|
+
class Js extends at{constructor(t){if(super(t),this.it=D,t.type!==st)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this.ft=void 0,this.it=t;if(t===O)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.ft;this.it=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Js.directiveName="unsafeHTML",Js.resultType=1;const qs=rt(Js);var Qs=function(t,e,i,o){for(var n,s=arguments.length,r=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(e,i,r):n(e,i))||r);return s>3&&r&&Object.defineProperty(e,i,r),r};class Xs extends Q{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this.showTourCommentTooltip=!1,this.allFeatureDisabled=!1,this.allFeatureRestricted=!1,this.guestMode=!1,this._expanded=!0,this.loading=!0,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!1,this.showFigmaDemoModal=!1,this.showGuestModeSignInModal=!1,this.defaultGuestModeSignInModalConfig={title:"Sign in to notify your team",description:"Notify your team about your latest comments.",closeOnClickOutside:!1,showLeaveCommentButton:!0},this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig)),this.showGuestModeNameModal=!1,this.guestModeSignInBannerVisible=!1,this.guestUserNameInput="",this.guestUserModelOpened=!1,this.guestUserNameUpdated=!1,this.guestUserNameUpdateLoading=!1,this.staging=true,this._autoLocation=!0,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this._isUserGlobalContact=!1,this.showQrCode=!1,this.customLoginEnabledLocally=null,this.customLoginEnabled=null,this.exitReviewModeCalled=!1,this.addCommentCount=0,this._privateCommentModeEnabled=!1,this.superflowToolbarMoved=!1,this._darkMode=!1,this.allowGuestModeSignIn=!0,this.toolbarEnabled=!1,this.toolbarEnabledApiCalled=!1,this.passwordProtected=!1,this.isPasswordValid=!1,this.password="",this.validatingPasswordLoading=!1,this.showPasswordProtectedModal=!1,this.showInvalidPassword=!1,this.skipGuestNameModal=!1,this._totalViews={},this.totalViewsCount=0,this.subscriptions=[],this.onApiKeyChange=()=>{try{this.apiKey&&(null===window||void 0===window?void 0:window.onSuperflowLoad)&&"function"==typeof window.onSuperflowLoad&&window.onSuperflowLoad()}catch(t){console.warn("Error in onApiKeyChange: ",t),Ps("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const e=await(t=>{const e={apiKey:t};return Ke($s,Et)(e)})(this.apiKey);this.customLoginEnabled=!!(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.customLoginEnabled),this.customLoginEnabled&&this.loginWithCustomUser()}catch(t){this.customLoginEnabled=!1,console.warn("Error in checkCustomLoginEnabled: ",t),Ps("Error in checkCustomLoginEnabled: ",t)}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(Ns("_sfut"),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),Ps("Error in loginWithCustomUser: ",t)}},this.addWindowClickEventListener=()=>{try{this.windowClickEventListener||(this.windowClickEventListener=()=>{this.menuOpenedId&&(this.menuOpenedId=void 0)},window.addEventListener("click",this.windowClickEventListener))}catch(t){console.warn("Error in addWindowClickEventListener: ",t),Ps("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Ps("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Ps("Error in setWindowEventListner: ",t)}},this.urlChangeListener=()=>{try{const t=history.pushState;history.pushState=function(){const e=t.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),e};const e=history.replaceState;history.replaceState=function(){const t=e.apply(this,arguments);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),t},window.addEventListener("popstate",(()=>{window.dispatchEvent(new Event("locationchange"))}))}catch(t){console.warn("Error in urlChangeListener: ",t),Ps("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),e=t.searchParams;if((null==e?void 0:e.has("sprojectInstall"))&&!_s("sprojectInstall")?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==e?void 0:e.has("sflivedemo"))if(_s("sflivedemo",!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete("sflivedemo"),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showLiveDemoModal=!0;else this.showLiveDemoModal=!1;if(null==e?void 0:e.has("sffigmademo"))if(_s("sffigmademo",!1)){this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete("sffigmademo"),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showFigmaDemoModal=!0;else this.showFigmaDemoModal=!1;if(e.has("st")||e.has("snippyly_google_token")){if(e.has("st")){const t=decodeURIComponent(e.get("st")),i=Ls(t,mt,gt),o=i&&JSON.parse(i);if(o){const t={};t.userId=o.uid,t.name=o.displayName,t.email=o.email,t.photoUrl=null==o?void 0:o.photoURL;const e=JSON.stringify(t),i=Is(e,mt,gt);Ms("_sfut",i,!0),Ns("sfUserAdmin")}}else if(e.has("snippyly_google_token")){const t=JSON.parse(atob(e.get("snippyly_google_token"))),i={};i.userId=t.uid,i.name=t.displayName,i.email=t.email,i.photoUrl=null==t?void 0:t.photoURL,Ms("snippyly-user",JSON.stringify(i),!0)}e.delete("st"),e.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}e.has("review")?(Ms("review","true",!1),Ns("feedback"),e.delete("review"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has("feedback")||_s("review",!1)&&this.loadPluginUI(),e.has("feedback")?(Ms("feedback","true",!1),Ns("review"),e.delete("feedback"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has("review")||_s("feedback",!1)&&this.loadPluginUI(),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t),Ps("Error in checkUrl: ",t)}},this.detectVersion=()=>{try{if(this.projectVersionKey){const t=new URL(document.location).searchParams;if(t.get(this.projectVersionKey))this.projectVersion=t.get(this.projectVersionKey);else if(window.snippylyInitialLoadUrl){const t=new URL(window.snippylyInitialLoadUrl).searchParams;t.get(this.projectVersionKey)&&(this.projectVersion=t.get(this.projectVersionKey))}this.projectVersion&&Ms("projectVersion",this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has("review")||t.has("feedback"))&&t.has("sversion")&&(Ms("projectVersionKey","sversion",!1,"sessionStorage"),this.projectVersion=t.get("sversion"),this.projectVersion&&Ms("projectVersion",this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Ps("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||_s("projectVersionKey",!1,"sessionStorage"),e=this.projectVersion||_s("projectVersion",!1,"sessionStorage");if(t&&e){const i=new URL(document.location),o=i.searchParams;o.get(t)||(o.set(t,e),window.history.replaceState({},document.title,i.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),Ps("Error in setVersionInUrl: ",t)}},this.loadPluginUI=async()=>{var t,e,i,o,n,s,r;try{if(!this.apiKey)return;if(!this.projectId)return;if(this.loadPlugin)return this.generateLocation(),void this.setLocation();if(this.toolbarEnabledApiCalled||await this.detectToolbarEnabled(),!this.toolbarEnabled)return;const a=As();if(a&&!(null==a?void 0:a.isAnonymous)&&(this.loading=!0),null===(t=this.getCustomerMetadata())||void 0===t||t.then((t=>{this.customerMetadata=t})).catch((t=>{console.warn("Error in getCustomerMetadata: ",t),Ps("Error in getCustomerMetadata: ",t)})),_s("sfPasswordIsValid",!0)&&(this.isPasswordValid="true"===_s("sfPasswordIsValid",!0)),_s("sfGuestMode",!0)&&_s("sfGuestModeAllowSignIn",!0)&&_s("sfPasswordProtected",!0)?(this.guestMode="true"===_s("sfGuestMode",!0),this.allowGuestModeSignIn="true"===_s("sfGuestModeAllowSignIn",!0),this.passwordProtected="true"===_s("sfPasswordProtected",!0)):(this.projectConfig=await(async(t,e)=>{var i;try{const o=Ke($s,kt),n=await o({apiKey:t,projectId:e});return null===(i=null==n?void 0:n.data)||void 0===i?void 0:i.data}catch(t){return console.warn("Error in getProjectConfig: ",t),null}})(this.apiKey,this.projectId),this.guestMode=!!(null===(e=this.projectConfig)||void 0===e?void 0:e.guestMode)||this.guestMode,this.allowGuestModeSignIn=!!(null===(o=null===(i=this.projectConfig)||void 0===i?void 0:i.guestModeConfig)||void 0===o?void 0:o.allowSignIn),(null===(n=this.projectConfig)||void 0===n?void 0:n.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(r=null===(s=this.projectConfig)||void 0===s?void 0:s.passwordProtected)||void 0===r?void 0:r.enabled),Ms("sfGuestMode",this.guestMode+"",!0),Ms("sfGuestModeAllowSignIn",this.allowGuestModeSignIn+"",!0),Ms("sfPasswordProtected",this.passwordProtected+"",!0)),this.loadPlugin=!0,!document.querySelector(ct.VELT_COMMENTS)){const t=document.createElement(ct.VELT_COMMENTS);null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),t.addEventListener("onCommentAdd",(()=>{this.addCommentCount++})),t.addEventListener("onCommentUpdate",(t=>{var e,i;(null===(e=this.snippylyUser)||void 0===e?void 0:e.isGuest)&&"newlyAdded"===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&(this.addCommentCount>=2&&!_s("sfGuestUserModelOpened")&&(this.allowGuestModeSignIn?this.openGuestModeSignInModal():this.openGuestModeNameModel(),Ms("sfGuestUserModelOpened","true")),this.addCommentCount>=5&&!_s("sfGuestUserBannerOpened",!1,"sessionStorage")&&(this.showGuestModeSignInBanner(),Ms("sfGuestUserBannerOpened","true",!1,"sessionStorage")))})),window.document.body.appendChild(t)}if(!document.querySelector(ct.VELT_CURSOR)){const t=document.createElement(ct.VELT_CURSOR);window.document.body.appendChild(t)}if(!document.querySelector(ct.VELT_HUDDLE)){const t=document.createElement(ct.VELT_HUDDLE);window.document.body.appendChild(t)}if(!document.querySelector(ct.VELT_RECORDER_NOTES)){const t=document.createElement(ct.VELT_RECORDER_NOTES);window.document.body.appendChild(t)}if(!document.querySelector(ct.VELT_RECORDER_CONTROL_PANEL)){const t=document.createElement(ct.VELT_RECORDER_CONTROL_PANEL);window.document.body.appendChild(t)}if(!document.querySelector(ct.VELT_ARROWS)){const t=document.createElement(ct.VELT_ARROWS);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Ps("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var t,i,o,n,s,r,a,l,c,d,h,u,p,v,m,g,f,w,y;try{if(await e(this.apiKey,{options:{develop:this.staging,version:this.staging?"1.0.333":"latest",velt:!0}}),!window.Snippyly)return;if(this.autoTranslation&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.enableAutoTranslation)&&(null===Snippyly||void 0===Snippyly||Snippyly.enableAutoTranslation()),!document.querySelector(ct.VELT_COMMENTS_SIDEBAR)){const t=document.createElement(ct.VELT_COMMENTS_SIDEBAR);t.setAttribute(dt.ENABLE_URL_NAVIGATION,"true"),t.setAttribute(dt.CURRENT_LOCATION_SUFFIX,"true"),window.document.body.appendChild(t)}if(Snippyly){null===Snippyly||void 0===Snippyly||Snippyly.sf(!0);try{(null===window||void 0===window?void 0:window.onSnippylyLoad)&&(null===window||void 0===window||window.onSnippylyLoad(Snippyly))}catch(t){}document.body.style.setProperty("--velt-default-font-family","'Poppins', sans-serif"),(()=>{try{if(!document.getElementById("superflowFontLink1")){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",t.id="superflowFontLink1",document.head.appendChild(t)}if(!document.getElementById("superflowFontLink2")){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="anonymous",t.id="superflowFontLink2",document.head.appendChild(t)}if(!document.getElementById("superflowFontLink3")){const t=document.createElement("link");t.rel="stylesheet",t.href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap",t.id="superflowFontLink3",document.head.appendChild(t)}}catch(t){console.warn("Error in loadPoppinsFont: ",t),Ps("Error in loadPoppinsFont: ",t)}})()}Snippyly&&Us({sdkVersion:null===Snippyly||void 0===Snippyly?void 0:Snippyly.version,sdkType:"client"}),this.documentId=((t,e=0)=>{try{let i=3735928559^e,o=1103547991^e;for(let e,n=0;n<t.length;n++)e=t.charCodeAt(n),i=Math.imul(i^e,2654435761),o=Math.imul(o^e,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&o)+(i>>>0)}catch(t){return console.warn("Error in cyrb53: ",t),Ps("Error in cyrb53: ",t),0}})((t=>{let e;return e=t.includes("http")?new URL(t):new URL("http://"+t),e.hostname.replace("www.","")})(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setDocumentId(this.documentId+""));const C=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();if(Us({documentId:C,clientDocumentId:this.documentId}),this.generateLocation(),this.setLocation(),this.commentElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCommentElement(),this.contactElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getContactElement(),this.rewriterElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getRewriterElement(),this.presenceElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getPresenceElement(),this.commentElement){this.commentElement.enableTextComments(!0),this.customLoginEnabledLocally||this.commentElement.enableSignInButton(!0),this.commentElement.enableAttachments(!0),(null===(t=this.commentElement)||void 0===t?void 0:t.showScreenSizeInfo)&&this.commentElement.showScreenSizeInfo(!0),(null===(i=this.commentElement)||void 0===i?void 0:i.enableDeviceInfo)&&this.commentElement.enableDeviceInfo(!0),this.commentElement.enableCommentIndex(!0),this.commentElement.onCommentModeChange&&this.commentElement.onCommentModeChange().subscribe((t=>{this.addCommentMode=t})),(null===(o=this.commentElement)||void 0===o?void 0:o.enableOrphanComments)&&this.commentElement.enableOrphanComments(),(null===(n=this.commentElement)||void 0===n?void 0:n.enableAutoCategorize)&&this.commentElement.enableAutoCategorize(),(null===(s=this.commentElement)||void 0===s?void 0:s.enablePersistentCommentMode)&&this.commentElement.enablePersistentCommentMode(),(null===(r=this.commentElement)||void 0===r?void 0:r.enableGhostComments)&&this.commentElement.enableGhostComments();const e=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;e&&"object"==typeof e&&(null===(a=this.commentElement)||void 0===a?void 0:a.setCustomStatus)&&this.commentElement.setCustomStatus(e),(null===(l=this.commentElement)||void 0===l?void 0:l.enableMinimap)&&this.commentElement.enableMinimap(),(null===(c=this.commentElement)||void 0===c?void 0:c.setDStrategy)&&(null===(d=this.commentElement)||void 0===d||d.setDStrategy("dynamicId")),(null===(h=this.commentElement)||void 0===h?void 0:h.enableSidebarButtonOnCommentDialog)&&this.commentElement.enableSidebarButtonOnCommentDialog(),(null===(u=this.commentElement)||void 0===u?void 0:u.enableHotkey)&&this.commentElement.enableHotkey()}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(p=this.rewriterElement)||void 0===p||p.enableRewriter()),this.presenceElement&&(null===(v=this.presenceElement)||void 0===v?void 0:v.enableFlockMode)&&(null===(m=this.presenceElement)||void 0===m||m.enableFlockMode(!0)),null===(g=null===Snippyly||void 0===Snippyly?void 0:Snippyly.docService)||void 0===g||g.getDocumentMetadata$().subscribe((t=>{const e=(null==t?void 0:t.versions)?Object.values(null==t?void 0:t.versions):[],i=new URL(document.location).searchParams.get("version");if(i){const t=e.find((t=>t.versionId===i));t&&(this.version={id:t.versionId,name:t.versionName||t.versionId},this.setLocation())}})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getViewsElement)&&(this.viewsElement=Snippyly.getViewsElement()),(null===(f=this.viewsElement)||void 0===f?void 0:f.getUniqueViewsByUser)&&(null===(y=null===(w=this.viewsElement)||void 0===w?void 0:w.getUniqueViewsByUser())||void 0===y||y.subscribe((t=>{this.totalViews=t}))),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Ps("Error in initializeSnippyly: ",t)}},this.checkToEnableUpgradeButton=()=>{var t,e;try{this.isPlanExpired&&this.isUserGlobalContact?(null===(t=this.commentElement)||void 0===t?void 0:t.enableUpgradeButton)&&this.commentElement.enableUpgradeButton():(null===(e=this.commentElement)||void 0===e?void 0:e.disableUpgradeButton)&&this.commentElement.disableUpgradeButton()}catch(t){console.warn("Error in checkToEnableUpgradeButton: ",t),Ps("Error in checkToEnableUpgradeButton: ",t)}},this.getCustomerMetadata=async()=>{try{let t=(()=>{try{const t=_s("sfCustomerMetadata");return t?"false"===t?JSON.parse(JSON.stringify(ht)):JSON.parse(t):null}catch(t){return console.warn("Error in getCustomerMetadataFromStorage: ",t),Ps("Error in getCustomerMetadataFromStorage: ",t),null}})();return t||(t=await(async t=>{try{const e=Ke($s,Ct),i=await e({apiKey:t});return null==i?void 0:i.data}catch(t){return console.warn("Error in getCustomerMetadata: ",t),null}})(this.apiKey),Ds(t)),t}catch(t){console.warn("Error in getCustomerMetadata: ",t),Ps("Error in getCustomerMetadata: ",t)}},this.setLogos=()=>{var t,e,i,o,n,s,r,a,l,c,d,h;try{let u="light";this.privateCommentModeEnabled&&(u="dark");const p=null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.customBranding)||void 0===e?void 0:e.logo)||void 0===i?void 0:i.logoMark,v=null===(s=null===(n=null===(o=null==pt?void 0:ht)||void 0===o?void 0:o.customBranding)||void 0===n?void 0:n.logo)||void 0===s?void 0:s.logoMark,m=null===(l=null===(a=null===(r=this.customerMetadata)||void 0===r?void 0:r.customBranding)||void 0===a?void 0:a.logo)||void 0===l?void 0:l.wordMark,g=null===(h=null===(d=null===(c=null==pt?void 0:ht)||void 0===c?void 0:c.customBranding)||void 0===d?void 0:d.logo)||void 0===h?void 0:h.wordMark;switch(u){case"light":this.logoMark=(null==p?void 0:p.lightUrl)||(null==p?void 0:p.darkUrl)||(null==v?void 0:v.lightUrl),this.wordMark=(null==m?void 0:m.lightUrl)||(null==m?void 0:m.darkUrl)||(null==g?void 0:g.lightUrl);break;case"dark":this.logoMark=(null==p?void 0:p.darkUrl)||(null==p?void 0:p.lightUrl)||(null==v?void 0:v.darkUrl),this.wordMark=(null==m?void 0:m.darkUrl)||(null==m?void 0:m.lightUrl)||(null==g?void 0:g.darkUrl)}}catch(t){console.warn("Error in setLogos: ",t),Ps("Error in setLogos: ",t)}},this.getLogoMark=()=>{var t;try{return(null===(t=this.logoMark)||void 0===t?void 0:t.includes("<svg"))?F`
|
|
2451
2451
|
${qs(this.logoMark)}
|
|
2452
2452
|
`:F`
|
|
2453
2453
|
<img src=${this.logoMark} />
|
|
@@ -2455,13 +2455,13 @@ class Js extends at{constructor(t){if(super(t),this.it=D,t.type!==st)throw Error
|
|
|
2455
2455
|
${qs(this.wordMark)}
|
|
2456
2456
|
`:F`
|
|
2457
2457
|
<img src=${this.wordMark} />
|
|
2458
|
-
`}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($s,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($s,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($s,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($s,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`
|
|
2458
|
+
`}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($s,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($s,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($s,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.skipGuestNameModal||(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($s,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`
|
|
2459
2459
|
<div class="disable-add-comment-button" @click=${()=>this.disableCommentMode()}>
|
|
2460
2460
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2461
2461
|
<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"/>
|
|
2462
2462
|
</svg>
|
|
2463
2463
|
</div>
|
|
2464
|
-
`:F``}catch(t){return console.warn("Error in disableAddCommentModeButton: ",t),Ps("Error in disableAddCommentModeButton: ",t),F``}},this.addStyles=()=>{var t,e;try{const i=document.createElement("style");i.textContent=Zs.cssText,null===(t=this.shadowRoot)||void 0===t||t.appendChild(i);const o=document.createElement("style");o.textContent=Gs.cssText,null===(e=this.shadowRoot)||void 0===e||e.appendChild(o)}catch(t){console.warn("Error in addStyles: ",t),Ps("Error in addStyles: ",t)}},this.guestUserNameUpdated=!!_s("sfGuestUserNameUpdated");const t=new URL(document.location);t.searchParams.has("st")&&t.searchParams.delete("st"),this.signInUrl=`${vt}/signin?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,this.signOutUrl=`${vt}/signout?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,Ns("_sfut"),await this.checkCustomLoginEnabled()},identify:async t=>{this.providedUser=t,this.customLoginEnabled&&this.loginWithCustomUser()},signInUrl:this.signInUrl,signOutUrl:this.signOutUrl,openGuestModeSignInModal:
|
|
2464
|
+
`:F``}catch(t){return console.warn("Error in disableAddCommentModeButton: ",t),Ps("Error in disableAddCommentModeButton: ",t),F``}},this.addStyles=()=>{var t,e;try{const i=document.createElement("style");i.textContent=Zs.cssText,null===(t=this.shadowRoot)||void 0===t||t.appendChild(i);const o=document.createElement("style");o.textContent=Gs.cssText,null===(e=this.shadowRoot)||void 0===e||e.appendChild(o)}catch(t){console.warn("Error in addStyles: ",t),Ps("Error in addStyles: ",t)}},this.guestUserNameUpdated=!!_s("sfGuestUserNameUpdated");const t=new URL(document.location);t.searchParams.has("st")&&t.searchParams.delete("st"),this.signInUrl=`${vt}/signin?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,this.signOutUrl=`${vt}/signout?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,Ns("_sfut"),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()}};try{this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Ps("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){var e,i,o,n,s,r,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===(s=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===s||s.setProperty("transform","none","important"),null===(a=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.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(),Us({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&&Ms("projectVersionKey",this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Ps("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 darkMode(){return this._darkMode}set darkMode(t){this._darkMode=t,this.setLogos()}get totalViews(){return this._totalViews}set totalViews(t){this._totalViews=t,this.totalViewsCount=Object.keys(this.totalViews||{}).length}connectedCallback(){super.connectedCallback(),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.")}),1e3)}async detectToolbarEnabled(){try{if(this.projectId&&this.apiKey){this.toolbarEnabledApiCalled=!0;const t=document.location.toString();this.toolbarEnabled=await(async(t,e,i)=>{var o;try{const n=Ke($s,Mt),s=await n({apiKey:t,projectId:e,url:i});return null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in checkToolbarEnabled: ",t),null}})(this.apiKey,this.projectId,t)}}catch(t){console.warn("Error in detectToolbarEnabled: ",t),Ps("Error in detectToolbarEnabled: ",t)}}render(){var t,e,i,o,n,s,r,a,l,c,d,h,u,p,v,m,g,f;return this.loadPlugin&&this.toolbarEnabled?!this.snippylyUser||this.loading||null===this.isPlanExpired?F`
|
|
2465
2465
|
<div class="snippyly-plugin-container" part="superflow-toolbar-container">
|
|
2466
2466
|
<div class="toolbar" id="smallToolbar">
|
|
2467
2467
|
<!-- <div class="toolbar-section">
|
|
@@ -3285,4 +3285,4 @@ class Js extends at{constructor(t){if(super(t),this.it=D,t.type!==st)throw Error
|
|
|
3285
3285
|
</div>
|
|
3286
3286
|
</div>
|
|
3287
3287
|
`:F``}
|
|
3288
|
-
`:F``}}Xs.styles=[Zs,Gs],Qs([it()],Xs.prototype,"loadPlugin",null),Qs([it()],Xs.prototype,"comments",void 0),Qs([it()],Xs.prototype,"commentElement",void 0),Qs([it()],Xs.prototype,"contactElement",void 0),Qs([it()],Xs.prototype,"rewriterElement",void 0),Qs([it()],Xs.prototype,"presenceElement",void 0),Qs([it()],Xs.prototype,"commentSubscription",void 0),Qs([it()],Xs.prototype,"selectionElement",void 0),Qs([it()],Xs.prototype,"viewsElement",void 0),Qs([it()],Xs.prototype,"addCommentMode",void 0),Qs([it()],Xs.prototype,"showTourCommentTooltip",void 0),Qs([it()],Xs.prototype,"allFeatureDisabled",void 0),Qs([it()],Xs.prototype,"allFeatureRestricted",void 0),Qs([it()],Xs.prototype,"guestMode",void 0),Qs([it()],Xs.prototype,"_expanded",void 0),Qs([it()],Xs.prototype,"loading",void 0),Qs([it()],Xs.prototype,"signInError",void 0),Qs([it()],Xs.prototype,"snippylyUser",void 0),Qs([it()],Xs.prototype,"snippylyUserRole",void 0),Qs([it()],Xs.prototype,"_isPlanExpired",void 0),Qs([it()],Xs.prototype,"showOnboardingModal",void 0),Qs([it()],Xs.prototype,"showLiveDemoModal",void 0),Qs([it()],Xs.prototype,"showFigmaDemoModal",void 0),Qs([it()],Xs.prototype,"showGuestModeSignInModal",void 0),Qs([it()],Xs.prototype,"guestModeSignInModalConfig",void 0),Qs([it()],Xs.prototype,"showGuestModeNameModal",void 0),Qs([it()],Xs.prototype,"guestModeSignInBannerVisible",void 0),Qs([it()],Xs.prototype,"guestUserNameInput",void 0),Qs([it()],Xs.prototype,"guestUserModelOpened",void 0),Qs([it()],Xs.prototype,"guestUserNameUpdated",void 0),Qs([it()],Xs.prototype,"guestUserNameUpdateLoading",void 0),Qs([et()],Xs.prototype,"apiKey",null),Qs([et()],Xs.prototype,"projectId",null),Qs([it()],Xs.prototype,"staging",void 0),Qs([et()],Xs.prototype,"projectVersionKey",null),Qs([it()],Xs.prototype,"projectVersion",void 0),Qs([it()],Xs.prototype,"version",void 0),Qs([et()],Xs.prototype,"autoLocation",null),Qs([it()],Xs.prototype,"_menuOpenedId",void 0),Qs([it()],Xs.prototype,"copyLinkTooltip",void 0),Qs([it()],Xs.prototype,"invalidApiKey",void 0),Qs([it()],Xs.prototype,"documentId",void 0),Qs([it()],Xs.prototype,"_isUserGlobalContact",void 0),Qs([it()],Xs.prototype,"location",void 0),Qs([it()],Xs.prototype,"qrCode",void 0),Qs([it()],Xs.prototype,"showQrCode",void 0),Qs([it()],Xs.prototype,"customLoginEnabledLocally",void 0),Qs([et()],Xs.prototype,"customLoginEnabled",void 0),Qs([it()],Xs.prototype,"providedUser",void 0),Qs([it()],Xs.prototype,"autoTranslation",void 0),Qs([it()],Xs.prototype,"addCommentCount",void 0),Qs([it()],Xs.prototype,"isSigningInUserAdmin",void 0),Qs([it()],Xs.prototype,"_privateCommentModeEnabled",void 0),Qs([it()],Xs.prototype,"superflowToolbarMoved",void 0),Qs([it()],Xs.prototype,"_customerMetadata",void 0),Qs([it()],Xs.prototype,"logoMark",void 0),Qs([it()],Xs.prototype,"wordMark",void 0),Qs([it()],Xs.prototype,"_darkMode",void 0),Qs([it()],Xs.prototype,"projectConfig",void 0),Qs([it()],Xs.prototype,"allowGuestModeSignIn",void 0),Qs([it()],Xs.prototype,"toolbarEnabled",void 0),Qs([it()],Xs.prototype,"toolbarEnabledApiCalled",void 0),Qs([it()],Xs.prototype,"passwordProtected",void 0),Qs([it()],Xs.prototype,"isPasswordValid",void 0),Qs([it()],Xs.prototype,"password",void 0),Qs([it()],Xs.prototype,"validatingPasswordLoading",void 0),Qs([it()],Xs.prototype,"showPasswordProtectedModal",void 0),Qs([it()],Xs.prototype,"showInvalidPassword",void 0),Qs([it()],Xs.prototype,"_totalViews",void 0),Qs([it()],Xs.prototype,"totalViewsCount",void 0),(t=>{if(customElements.get("superflow-toolbar")||customElements.get("snippyly-plugin"))return;const e={allow:["sdkUrl","windowVariables","snippylyPlugin"],loaders:{windowVariables:()=>{const t=null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_API_KEY;return{valid:!!t,type:"windowVariables",apiKey:t,staging:!!(null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_STAGING),projectVersionKey:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,projectId:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_ID,autoLocation:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_AUTO_LOCATION}},snippylyPlugin:()=>{const t=document.querySelector("snippyly-plugin");if(!t)return;const e=t.getAttribute("apiKey"),i=!!t.getAttribute("staging"),o=t.getAttribute("projectVersionKey"),n=t.getAttribute("projectId"),s=t.getAttribute("autoLocation");return null==t||t.remove(),{valid:!!e,type:"snippylyPlugin",apiKey:e,staging:i,projectVersionKey:o,projectId:n,autoLocation:s}},sdkUrl:()=>{const t=document.getElementById("superflowToolbarScript");if(!t)return;const e=null==t?void 0:t.src,i=new URL(e).searchParams,o=i.has("apiKey")?i.get("apiKey"):void 0;return{valid:!!o,type:"sdkUrl",apiKey:o,staging:void 0,projectVersionKey:void 0,projectId:i.has("projectId")?i.get("projectId"):void 0,autoLocation:i.has("autoLocation")?i.get("autoLocation"):void 0}}},load:()=>{for(let t=0;t<e.allow.length;t++){const i=e.allow[t],o=e.loaders[i]();if(o&&o.valid)return o}}},i=()=>{try{const i=e.load();if(customElements.define("superflow-toolbar",t),i&&i.valid){(()=>{try{document.querySelectorAll("superflow-toolbar").forEach((t=>{t.remove()})),document.querySelectorAll("snippyly-plugin").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const t={};return t.apiKey=i.apiKey,i.staging&&(t.staging="true"),i.projectVersionKey&&(t.projectVersionKey=i.projectVersionKey),i.projectId&&(t.projectId=i.projectId),(null==i?void 0:i.autoLocation)&&(t.autoLocation=i.autoLocation),void((t={})=>{try{const e=document.createElement("superflow-toolbar");Object.keys(t||{}).forEach((i=>{e.setAttribute(i,t[i])})),document.body.appendChild(e)}catch(t){console.warn("Error in loadSuperflowToolbarTag: ",t)}})(t)}}catch(t){console.warn("Error in initSuperflow: ",t)}};(null===document||void 0===document?void 0:document.body)?i():null===document||void 0===document||document.addEventListener("DOMContentLoaded",(()=>{i()}))})(Xs);class tr extends Q{}customElements.get("snippyly-plugin")||customElements.define("snippyly-plugin",tr);export{tr as SnippylyPlugin,Xs as SuperflowToolbar};
|
|
3288
|
+
`:F``}}Xs.styles=[Zs,Gs],Qs([it()],Xs.prototype,"loadPlugin",null),Qs([it()],Xs.prototype,"comments",void 0),Qs([it()],Xs.prototype,"commentElement",void 0),Qs([it()],Xs.prototype,"contactElement",void 0),Qs([it()],Xs.prototype,"rewriterElement",void 0),Qs([it()],Xs.prototype,"presenceElement",void 0),Qs([it()],Xs.prototype,"commentSubscription",void 0),Qs([it()],Xs.prototype,"selectionElement",void 0),Qs([it()],Xs.prototype,"viewsElement",void 0),Qs([it()],Xs.prototype,"addCommentMode",void 0),Qs([it()],Xs.prototype,"showTourCommentTooltip",void 0),Qs([it()],Xs.prototype,"allFeatureDisabled",void 0),Qs([it()],Xs.prototype,"allFeatureRestricted",void 0),Qs([it()],Xs.prototype,"guestMode",void 0),Qs([it()],Xs.prototype,"_expanded",void 0),Qs([it()],Xs.prototype,"loading",void 0),Qs([it()],Xs.prototype,"signInError",void 0),Qs([it()],Xs.prototype,"snippylyUser",void 0),Qs([it()],Xs.prototype,"snippylyUserRole",void 0),Qs([it()],Xs.prototype,"_isPlanExpired",void 0),Qs([it()],Xs.prototype,"showOnboardingModal",void 0),Qs([it()],Xs.prototype,"showLiveDemoModal",void 0),Qs([it()],Xs.prototype,"showFigmaDemoModal",void 0),Qs([it()],Xs.prototype,"showGuestModeSignInModal",void 0),Qs([it()],Xs.prototype,"guestModeSignInModalConfig",void 0),Qs([it()],Xs.prototype,"showGuestModeNameModal",void 0),Qs([it()],Xs.prototype,"guestModeSignInBannerVisible",void 0),Qs([it()],Xs.prototype,"guestUserNameInput",void 0),Qs([it()],Xs.prototype,"guestUserModelOpened",void 0),Qs([it()],Xs.prototype,"guestUserNameUpdated",void 0),Qs([it()],Xs.prototype,"guestUserNameUpdateLoading",void 0),Qs([et()],Xs.prototype,"apiKey",null),Qs([et()],Xs.prototype,"projectId",null),Qs([it()],Xs.prototype,"staging",void 0),Qs([et()],Xs.prototype,"projectVersionKey",null),Qs([it()],Xs.prototype,"projectVersion",void 0),Qs([it()],Xs.prototype,"version",void 0),Qs([et()],Xs.prototype,"autoLocation",null),Qs([it()],Xs.prototype,"_menuOpenedId",void 0),Qs([it()],Xs.prototype,"copyLinkTooltip",void 0),Qs([it()],Xs.prototype,"invalidApiKey",void 0),Qs([it()],Xs.prototype,"documentId",void 0),Qs([it()],Xs.prototype,"_isUserGlobalContact",void 0),Qs([it()],Xs.prototype,"location",void 0),Qs([it()],Xs.prototype,"qrCode",void 0),Qs([it()],Xs.prototype,"showQrCode",void 0),Qs([it()],Xs.prototype,"customLoginEnabledLocally",void 0),Qs([et()],Xs.prototype,"customLoginEnabled",void 0),Qs([it()],Xs.prototype,"providedUser",void 0),Qs([it()],Xs.prototype,"autoTranslation",void 0),Qs([it()],Xs.prototype,"addCommentCount",void 0),Qs([it()],Xs.prototype,"isSigningInUserAdmin",void 0),Qs([it()],Xs.prototype,"_privateCommentModeEnabled",void 0),Qs([it()],Xs.prototype,"superflowToolbarMoved",void 0),Qs([it()],Xs.prototype,"_customerMetadata",void 0),Qs([it()],Xs.prototype,"logoMark",void 0),Qs([it()],Xs.prototype,"wordMark",void 0),Qs([it()],Xs.prototype,"_darkMode",void 0),Qs([it()],Xs.prototype,"projectConfig",void 0),Qs([it()],Xs.prototype,"allowGuestModeSignIn",void 0),Qs([it()],Xs.prototype,"toolbarEnabled",void 0),Qs([it()],Xs.prototype,"toolbarEnabledApiCalled",void 0),Qs([it()],Xs.prototype,"passwordProtected",void 0),Qs([it()],Xs.prototype,"isPasswordValid",void 0),Qs([it()],Xs.prototype,"password",void 0),Qs([it()],Xs.prototype,"validatingPasswordLoading",void 0),Qs([it()],Xs.prototype,"showPasswordProtectedModal",void 0),Qs([it()],Xs.prototype,"showInvalidPassword",void 0),Qs([it()],Xs.prototype,"skipGuestNameModal",void 0),Qs([it()],Xs.prototype,"_totalViews",void 0),Qs([it()],Xs.prototype,"totalViewsCount",void 0),(t=>{if(customElements.get("superflow-toolbar")||customElements.get("snippyly-plugin"))return;const e={allow:["sdkUrl","windowVariables","snippylyPlugin"],loaders:{windowVariables:()=>{const t=null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_API_KEY;return{valid:!!t,type:"windowVariables",apiKey:t,staging:!!(null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_STAGING),projectVersionKey:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,projectId:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_ID,autoLocation:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_AUTO_LOCATION}},snippylyPlugin:()=>{const t=document.querySelector("snippyly-plugin");if(!t)return;const e=t.getAttribute("apiKey"),i=!!t.getAttribute("staging"),o=t.getAttribute("projectVersionKey"),n=t.getAttribute("projectId"),s=t.getAttribute("autoLocation");return null==t||t.remove(),{valid:!!e,type:"snippylyPlugin",apiKey:e,staging:i,projectVersionKey:o,projectId:n,autoLocation:s}},sdkUrl:()=>{const t=document.getElementById("superflowToolbarScript");if(!t)return;const e=null==t?void 0:t.src,i=new URL(e).searchParams,o=i.has("apiKey")?i.get("apiKey"):void 0;return{valid:!!o,type:"sdkUrl",apiKey:o,staging:void 0,projectVersionKey:void 0,projectId:i.has("projectId")?i.get("projectId"):void 0,autoLocation:i.has("autoLocation")?i.get("autoLocation"):void 0}}},load:()=>{for(let t=0;t<e.allow.length;t++){const i=e.allow[t],o=e.loaders[i]();if(o&&o.valid)return o}}},i=()=>{try{const i=e.load();if(customElements.define("superflow-toolbar",t),i&&i.valid){(()=>{try{document.querySelectorAll("superflow-toolbar").forEach((t=>{t.remove()})),document.querySelectorAll("snippyly-plugin").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const t={};return t.apiKey=i.apiKey,i.staging&&(t.staging="true"),i.projectVersionKey&&(t.projectVersionKey=i.projectVersionKey),i.projectId&&(t.projectId=i.projectId),(null==i?void 0:i.autoLocation)&&(t.autoLocation=i.autoLocation),void((t={})=>{try{const e=document.createElement("superflow-toolbar");Object.keys(t||{}).forEach((i=>{e.setAttribute(i,t[i])})),document.body.appendChild(e)}catch(t){console.warn("Error in loadSuperflowToolbarTag: ",t)}})(t)}}catch(t){console.warn("Error in initSuperflow: ",t)}};(null===document||void 0===document?void 0:document.body)?i():null===document||void 0===document||document.addEventListener("DOMContentLoaded",(()=>{i()}))})(Xs);class tr extends Q{}customElements.get("snippyly-plugin")||customElements.define("snippyly-plugin",tr);export{tr as SnippylyPlugin,Xs as SuperflowToolbar};
|
package/superflow.min.js
CHANGED
|
@@ -2446,7 +2446,7 @@ class qs extends Zo{}qs.Encryptor=class extends qs{processBlock(t,e){const i=t,o
|
|
|
2446
2446
|
* Copyright 2017 Google LLC
|
|
2447
2447
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2448
2448
|
*/
|
|
2449
|
-
class Tr extends lt{constructor(t){if(super(t),this.it=$,t.type!==rt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===$||null==t)return this.ft=void 0,this.it=t;if(t===D)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.ft;this.it=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Tr.directiveName="unsafeHTML",Tr.resultType=1;const Lr=at(Tr);var Ir=function(t,e,i,o){for(var n,s=arguments.length,r=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(e,i,r):n(e,i))||r);return s>3&&r&&Object.defineProperty(e,i,r),r};class Ar extends X{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this.showTourCommentTooltip=!1,this.allFeatureDisabled=!1,this.allFeatureRestricted=!1,this.guestMode=!1,this._expanded=!0,this.loading=!0,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!1,this.showFigmaDemoModal=!1,this.showGuestModeSignInModal=!1,this.defaultGuestModeSignInModalConfig={title:"Sign in to notify your team",description:"Notify your team about your latest comments.",closeOnClickOutside:!1,showLeaveCommentButton:!0},this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig)),this.showGuestModeNameModal=!1,this.guestModeSignInBannerVisible=!1,this.guestUserNameInput="",this.guestUserModelOpened=!1,this.guestUserNameUpdated=!1,this.guestUserNameUpdateLoading=!1,this.staging=true,this._autoLocation=!0,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this._isUserGlobalContact=!1,this.showQrCode=!1,this.customLoginEnabledLocally=null,this.customLoginEnabled=null,this.exitReviewModeCalled=!1,this.addCommentCount=0,this._privateCommentModeEnabled=!1,this.superflowToolbarMoved=!1,this._darkMode=!1,this.allowGuestModeSignIn=!0,this.toolbarEnabled=!1,this.toolbarEnabledApiCalled=!1,this.passwordProtected=!1,this.isPasswordValid=!1,this.password="",this.validatingPasswordLoading=!1,this.showPasswordProtectedModal=!1,this.showInvalidPassword=!1,this._totalViews={},this.totalViewsCount=0,this.subscriptions=[],this.onApiKeyChange=()=>{try{this.apiKey&&(null===window||void 0===window?void 0:window.onSuperflowLoad)&&"function"==typeof window.onSuperflowLoad&&window.onSuperflowLoad()}catch(t){console.warn("Error in onApiKeyChange: ",t),Cr("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const e=await(t=>{const e={apiKey:t};return Mi(mr,Jt)(e)})(this.apiKey);this.customLoginEnabled=!!(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.customLoginEnabled),this.customLoginEnabled&&this.loginWithCustomUser()}catch(t){this.customLoginEnabled=!1,console.warn("Error in checkCustomLoginEnabled: ",t),Cr("Error in checkCustomLoginEnabled: ",t)}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(ar(ft),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),Cr("Error in loginWithCustomUser: ",t)}},this.addWindowClickEventListener=()=>{try{this.windowClickEventListener||(this.windowClickEventListener=()=>{this.menuOpenedId&&(this.menuOpenedId=void 0)},window.addEventListener("click",this.windowClickEventListener))}catch(t){console.warn("Error in addWindowClickEventListener: ",t),Cr("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Cr("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Cr("Error in setWindowEventListner: ",t)}},this.urlChangeListener=()=>{try{const t=history.pushState;history.pushState=function(){const e=t.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),e};const e=history.replaceState;history.replaceState=function(){const t=e.apply(this,arguments);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),t},window.addEventListener("popstate",(()=>{window.dispatchEvent(new Event("locationchange"))}))}catch(t){console.warn("Error in urlChangeListener: ",t),Cr("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),e=t.searchParams;if((null==e?void 0:e.has(xt))&&!rr(xt)?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==e?void 0:e.has(Et))if(rr(Et,!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Et),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showLiveDemoModal=!0;else this.showLiveDemoModal=!1;if(null==e?void 0:e.has(kt))if(rr(kt,!1)){this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(kt),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showFigmaDemoModal=!0;else this.showFigmaDemoModal=!1;if(e.has(gt)||e.has("snippyly_google_token")){if(e.has(gt)){const t=decodeURIComponent(e.get(gt)),i=dr(t,Rt,Pt),o=i&&JSON.parse(i);if(o){const t={};t.userId=o.uid,t.name=o.displayName,t.email=o.email,t.photoUrl=null==o?void 0:o.photoURL;const e=JSON.stringify(t),i=cr(e,Rt,Pt);sr(ft,i,!0),ar(Mt)}}else if(e.has("snippyly_google_token")){const t=JSON.parse(atob(e.get("snippyly_google_token"))),i={};i.userId=t.uid,i.name=t.displayName,i.email=t.email,i.photoUrl=null==t?void 0:t.photoURL,sr(mt,JSON.stringify(i),!0)}e.delete(gt),e.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}e.has(ht)?(sr(ht,"true",!1),ar(ut),e.delete(ht),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(ut)||rr(ht,!1)&&this.loadPluginUI(),e.has(ut)?(sr(ut,"true",!1),ar(ht),e.delete(ut),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(ht)||rr(ut,!1)&&this.loadPluginUI(),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t),Cr("Error in checkUrl: ",t)}},this.detectVersion=()=>{try{if(this.projectVersionKey){const t=new URL(document.location).searchParams;if(t.get(this.projectVersionKey))this.projectVersion=t.get(this.projectVersionKey);else if(window.snippylyInitialLoadUrl){const t=new URL(window.snippylyInitialLoadUrl).searchParams;t.get(this.projectVersionKey)&&(this.projectVersion=t.get(this.projectVersionKey))}this.projectVersion&&sr(Ct,this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has(ht)||t.has(ut))&&t.has(bt)&&(sr(yt,bt,!1,"sessionStorage"),this.projectVersion=t.get(bt),this.projectVersion&&sr(Ct,this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Cr("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||rr(yt,!1,"sessionStorage"),e=this.projectVersion||rr(Ct,!1,"sessionStorage");if(t&&e){const i=new URL(document.location),o=i.searchParams;o.get(t)||(o.set(t,e),window.history.replaceState({},document.title,i.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),Cr("Error in setVersionInUrl: ",t)}},this.loadPluginUI=async()=>{var t,e,i,o,n,s,r;try{if(!this.apiKey)return;if(!this.projectId)return;if(this.loadPlugin)return this.generateLocation(),void this.setLocation();if(this.toolbarEnabledApiCalled||await this.detectToolbarEnabled(),!this.toolbarEnabled)return;const a=hr();if(a&&!(null==a?void 0:a.isAnonymous)&&(this.loading=!0),null===(t=this.getCustomerMetadata())||void 0===t||t.then((t=>{this.customerMetadata=t})).catch((t=>{console.warn("Error in getCustomerMetadata: ",t),Cr("Error in getCustomerMetadata: ",t)})),rr(Tt,!0)&&(this.isPasswordValid="true"===rr(Tt,!0)),rr(_t,!0)&&rr(Lt,!0)&&rr(Nt,!0)?(this.guestMode="true"===rr(_t,!0),this.allowGuestModeSignIn="true"===rr(Lt,!0),this.passwordProtected="true"===rr(Nt,!0)):(this.projectConfig=await(async(t,e)=>{var i;try{const o=Mi(mr,Kt),n=await o({apiKey:t,projectId:e});return null===(i=null==n?void 0:n.data)||void 0===i?void 0:i.data}catch(t){return console.warn("Error in getProjectConfig: ",t),null}})(this.apiKey,this.projectId),this.guestMode=!!(null===(e=this.projectConfig)||void 0===e?void 0:e.guestMode)||this.guestMode,this.allowGuestModeSignIn=!!(null===(o=null===(i=this.projectConfig)||void 0===i?void 0:i.guestModeConfig)||void 0===o?void 0:o.allowSignIn),(null===(n=this.projectConfig)||void 0===n?void 0:n.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(r=null===(s=this.projectConfig)||void 0===s?void 0:s.passwordProtected)||void 0===r?void 0:r.enabled),sr(_t,this.guestMode+"",!0),sr(Lt,this.allowGuestModeSignIn+"",!0),sr(Nt,this.passwordProtected+"",!0)),this.loadPlugin=!0,!document.querySelector(Dt.VELT_COMMENTS)){const t=document.createElement(Dt.VELT_COMMENTS);null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),t.addEventListener("onCommentAdd",(t=>{console.log("Comment added: ",null==t?void 0:t.detail),this.addCommentCount++})),t.addEventListener("onCommentUpdate",(t=>{var e,i;console.log("Comment updated: ",t.detail),(null===(e=this.snippylyUser)||void 0===e?void 0:e.isGuest)&&"newlyAdded"===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&(console.log(this.addCommentCount),this.addCommentCount>=2&&!rr(It)&&(this.allowGuestModeSignIn?this.openGuestModeSignInModal():this.openGuestModeNameModel(),sr(It,"true")),this.addCommentCount>=5&&!rr(Ft,!1,"sessionStorage")&&(this.showGuestModeSignInBanner(),sr(Ft,"true",!1,"sessionStorage")))})),window.document.body.appendChild(t)}if(!document.querySelector(Dt.VELT_CURSOR)){const t=document.createElement(Dt.VELT_CURSOR);window.document.body.appendChild(t)}if(!document.querySelector(Dt.VELT_HUDDLE)){const t=document.createElement(Dt.VELT_HUDDLE);window.document.body.appendChild(t)}if(!document.querySelector(Dt.VELT_RECORDER_NOTES)){const t=document.createElement(Dt.VELT_RECORDER_NOTES);window.document.body.appendChild(t)}if(!document.querySelector(Dt.VELT_RECORDER_CONTROL_PANEL)){const t=document.createElement(Dt.VELT_RECORDER_CONTROL_PANEL);window.document.body.appendChild(t)}if(!document.querySelector(Dt.VELT_ARROWS)){const t=document.createElement(Dt.VELT_ARROWS);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Cr("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var t,e,o,n,s,r,a,l,c,d,h,u,p,v,m,g,f,w,y;try{if(await i(this.apiKey,{options:{develop:this.staging,version:this.staging?dt:"latest",velt:!0}}),!window.Snippyly)return;if(this.autoTranslation&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.enableAutoTranslation)&&(null===Snippyly||void 0===Snippyly||Snippyly.enableAutoTranslation()),!document.querySelector(Dt.VELT_COMMENTS_SIDEBAR)){const t=document.createElement(Dt.VELT_COMMENTS_SIDEBAR);t.setAttribute($t.ENABLE_URL_NAVIGATION,"true"),t.setAttribute($t.CURRENT_LOCATION_SUFFIX,"true"),window.document.body.appendChild(t)}if(Snippyly){null===Snippyly||void 0===Snippyly||Snippyly.sf(!0);try{(null===window||void 0===window?void 0:window.onSnippylyLoad)&&(null===window||void 0===window||window.onSnippylyLoad(Snippyly))}catch(t){}document.body.style.setProperty("--velt-default-font-family","'Poppins', sans-serif"),(()=>{try{if(!document.getElementById("superflowFontLink1")){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",t.id="superflowFontLink1",document.head.appendChild(t)}if(!document.getElementById("superflowFontLink2")){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="anonymous",t.id="superflowFontLink2",document.head.appendChild(t)}if(!document.getElementById("superflowFontLink3")){const t=document.createElement("link");t.rel="stylesheet",t.href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap",t.id="superflowFontLink3",document.head.appendChild(t)}}catch(t){console.warn("Error in loadPoppinsFont: ",t),Cr("Error in loadPoppinsFont: ",t)}})()}Snippyly&&wr({sdkVersion:null===Snippyly||void 0===Snippyly?void 0:Snippyly.version,sdkType:"client"}),this.documentId=((t,e=0)=>{try{let i=3735928559^e,o=1103547991^e;for(let e,n=0;n<t.length;n++)e=t.charCodeAt(n),i=Math.imul(i^e,2654435761),o=Math.imul(o^e,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&o)+(i>>>0)}catch(t){return console.warn("Error in cyrb53: ",t),Cr("Error in cyrb53: ",t),0}})((t=>{let e;return e=t.includes("http")?new URL(t):new URL("http://"+t),e.hostname.replace("www.","")})(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setDocumentId(this.documentId+""));const C=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();if(wr({documentId:C,clientDocumentId:this.documentId}),this.generateLocation(),this.setLocation(),this.commentElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCommentElement(),this.contactElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getContactElement(),this.rewriterElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getRewriterElement(),this.presenceElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getPresenceElement(),this.commentElement){this.commentElement.enableTextComments(!0),this.customLoginEnabledLocally||this.commentElement.enableSignInButton(!0),this.commentElement.enableAttachments(!0),(null===(t=this.commentElement)||void 0===t?void 0:t.showScreenSizeInfo)&&this.commentElement.showScreenSizeInfo(!0),(null===(e=this.commentElement)||void 0===e?void 0:e.enableDeviceInfo)&&this.commentElement.enableDeviceInfo(!0),this.commentElement.enableCommentIndex(!0),this.commentElement.onCommentModeChange&&this.commentElement.onCommentModeChange().subscribe((t=>{this.addCommentMode=t})),(null===(o=this.commentElement)||void 0===o?void 0:o.enableOrphanComments)&&this.commentElement.enableOrphanComments(),(null===(n=this.commentElement)||void 0===n?void 0:n.enableAutoCategorize)&&this.commentElement.enableAutoCategorize(),(null===(s=this.commentElement)||void 0===s?void 0:s.enablePersistentCommentMode)&&this.commentElement.enablePersistentCommentMode(),(null===(r=this.commentElement)||void 0===r?void 0:r.enableGhostComments)&&this.commentElement.enableGhostComments();const i=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;i&&"object"==typeof i&&(null===(a=this.commentElement)||void 0===a?void 0:a.setCustomStatus)&&this.commentElement.setCustomStatus(i),(null===(l=this.commentElement)||void 0===l?void 0:l.enableMinimap)&&this.commentElement.enableMinimap(),(null===(c=this.commentElement)||void 0===c?void 0:c.setDStrategy)&&(null===(d=this.commentElement)||void 0===d||d.setDStrategy("dynamicId")),(null===(h=this.commentElement)||void 0===h?void 0:h.enableSidebarButtonOnCommentDialog)&&this.commentElement.enableSidebarButtonOnCommentDialog(),(null===(u=this.commentElement)||void 0===u?void 0:u.enableHotkey)&&this.commentElement.enableHotkey()}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(p=this.rewriterElement)||void 0===p||p.enableRewriter()),this.presenceElement&&(null===(v=this.presenceElement)||void 0===v?void 0:v.enableFlockMode)&&(null===(m=this.presenceElement)||void 0===m||m.enableFlockMode(!0)),null===(g=null===Snippyly||void 0===Snippyly?void 0:Snippyly.docService)||void 0===g||g.getDocumentMetadata$().subscribe((t=>{const e=(null==t?void 0:t.versions)?Object.values(null==t?void 0:t.versions):[],i=new URL(document.location).searchParams.get("version");if(i){const t=e.find((t=>t.versionId===i));t&&(this.version={id:t.versionId,name:t.versionName||t.versionId},this.setLocation())}})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getViewsElement)&&(this.viewsElement=Snippyly.getViewsElement()),(null===(f=this.viewsElement)||void 0===f?void 0:f.getUniqueViewsByUser)&&(null===(y=null===(w=this.viewsElement)||void 0===w?void 0:w.getUniqueViewsByUser())||void 0===y||y.subscribe((t=>{this.totalViews=t}))),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Cr("Error in initializeSnippyly: ",t)}},this.checkToEnableUpgradeButton=()=>{var t,e;try{this.isPlanExpired&&this.isUserGlobalContact?(null===(t=this.commentElement)||void 0===t?void 0:t.enableUpgradeButton)&&this.commentElement.enableUpgradeButton():(null===(e=this.commentElement)||void 0===e?void 0:e.disableUpgradeButton)&&this.commentElement.disableUpgradeButton()}catch(t){console.warn("Error in checkToEnableUpgradeButton: ",t),Cr("Error in checkToEnableUpgradeButton: ",t)}},this.getCustomerMetadata=async()=>{try{let t=(()=>{try{const t=rr(Ot);return t?"false"===t?JSON.parse(JSON.stringify(jt)):JSON.parse(t):null}catch(t){return console.warn("Error in getCustomerMetadataFromStorage: ",t),Cr("Error in getCustomerMetadataFromStorage: ",t),null}})();return t||(t=await(async t=>{try{const e=Mi(mr,Gt),i=await e({apiKey:t});return null==i?void 0:i.data}catch(t){return console.warn("Error in getCustomerMetadata: ",t),null}})(this.apiKey),vr(t)),t}catch(t){console.warn("Error in getCustomerMetadata: ",t),Cr("Error in getCustomerMetadata: ",t)}},this.setLogos=()=>{var t,e,i,o,n,s,r,a,l,c,d,h;try{let u="light";this.privateCommentModeEnabled&&(u="dark");const p=null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.customBranding)||void 0===e?void 0:e.logo)||void 0===i?void 0:i.logoMark,v=null===(s=null===(n=null===(o=null==Ut?void 0:jt)||void 0===o?void 0:o.customBranding)||void 0===n?void 0:n.logo)||void 0===s?void 0:s.logoMark,m=null===(l=null===(a=null===(r=this.customerMetadata)||void 0===r?void 0:r.customBranding)||void 0===a?void 0:a.logo)||void 0===l?void 0:l.wordMark,g=null===(h=null===(d=null===(c=null==Ut?void 0:jt)||void 0===c?void 0:c.customBranding)||void 0===d?void 0:d.logo)||void 0===h?void 0:h.wordMark;switch(u){case"light":this.logoMark=(null==p?void 0:p.lightUrl)||(null==p?void 0:p.darkUrl)||(null==v?void 0:v.lightUrl),this.wordMark=(null==m?void 0:m.lightUrl)||(null==m?void 0:m.darkUrl)||(null==g?void 0:g.lightUrl);break;case"dark":this.logoMark=(null==p?void 0:p.darkUrl)||(null==p?void 0:p.lightUrl)||(null==v?void 0:v.darkUrl),this.wordMark=(null==m?void 0:m.darkUrl)||(null==m?void 0:m.lightUrl)||(null==g?void 0:g.darkUrl)}}catch(t){console.warn("Error in setLogos: ",t),Cr("Error in setLogos: ",t)}},this.getLogoMark=()=>{var t;try{return(null===(t=this.logoMark)||void 0===t?void 0:t.includes("<svg"))?O`
|
|
2449
|
+
class Tr extends lt{constructor(t){if(super(t),this.it=$,t.type!==rt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===$||null==t)return this.ft=void 0,this.it=t;if(t===D)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.ft;this.it=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Tr.directiveName="unsafeHTML",Tr.resultType=1;const Lr=at(Tr);var Ir=function(t,e,i,o){for(var n,s=arguments.length,r=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(e,i,r):n(e,i))||r);return s>3&&r&&Object.defineProperty(e,i,r),r};class Ar extends X{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this.showTourCommentTooltip=!1,this.allFeatureDisabled=!1,this.allFeatureRestricted=!1,this.guestMode=!1,this._expanded=!0,this.loading=!0,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!1,this.showFigmaDemoModal=!1,this.showGuestModeSignInModal=!1,this.defaultGuestModeSignInModalConfig={title:"Sign in to notify your team",description:"Notify your team about your latest comments.",closeOnClickOutside:!1,showLeaveCommentButton:!0},this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig)),this.showGuestModeNameModal=!1,this.guestModeSignInBannerVisible=!1,this.guestUserNameInput="",this.guestUserModelOpened=!1,this.guestUserNameUpdated=!1,this.guestUserNameUpdateLoading=!1,this.staging=true,this._autoLocation=!0,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this._isUserGlobalContact=!1,this.showQrCode=!1,this.customLoginEnabledLocally=null,this.customLoginEnabled=null,this.exitReviewModeCalled=!1,this.addCommentCount=0,this._privateCommentModeEnabled=!1,this.superflowToolbarMoved=!1,this._darkMode=!1,this.allowGuestModeSignIn=!0,this.toolbarEnabled=!1,this.toolbarEnabledApiCalled=!1,this.passwordProtected=!1,this.isPasswordValid=!1,this.password="",this.validatingPasswordLoading=!1,this.showPasswordProtectedModal=!1,this.showInvalidPassword=!1,this.skipGuestNameModal=!1,this._totalViews={},this.totalViewsCount=0,this.subscriptions=[],this.onApiKeyChange=()=>{try{this.apiKey&&(null===window||void 0===window?void 0:window.onSuperflowLoad)&&"function"==typeof window.onSuperflowLoad&&window.onSuperflowLoad()}catch(t){console.warn("Error in onApiKeyChange: ",t),Cr("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const e=await(t=>{const e={apiKey:t};return Mi(mr,Jt)(e)})(this.apiKey);this.customLoginEnabled=!!(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.customLoginEnabled),this.customLoginEnabled&&this.loginWithCustomUser()}catch(t){this.customLoginEnabled=!1,console.warn("Error in checkCustomLoginEnabled: ",t),Cr("Error in checkCustomLoginEnabled: ",t)}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(ar(ft),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),Cr("Error in loginWithCustomUser: ",t)}},this.addWindowClickEventListener=()=>{try{this.windowClickEventListener||(this.windowClickEventListener=()=>{this.menuOpenedId&&(this.menuOpenedId=void 0)},window.addEventListener("click",this.windowClickEventListener))}catch(t){console.warn("Error in addWindowClickEventListener: ",t),Cr("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Cr("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Cr("Error in setWindowEventListner: ",t)}},this.urlChangeListener=()=>{try{const t=history.pushState;history.pushState=function(){const e=t.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),e};const e=history.replaceState;history.replaceState=function(){const t=e.apply(this,arguments);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),t},window.addEventListener("popstate",(()=>{window.dispatchEvent(new Event("locationchange"))}))}catch(t){console.warn("Error in urlChangeListener: ",t),Cr("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),e=t.searchParams;if((null==e?void 0:e.has(xt))&&!rr(xt)?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==e?void 0:e.has(Et))if(rr(Et,!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Et),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showLiveDemoModal=!0;else this.showLiveDemoModal=!1;if(null==e?void 0:e.has(kt))if(rr(kt,!1)){this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(kt),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showFigmaDemoModal=!0;else this.showFigmaDemoModal=!1;if(e.has(gt)||e.has("snippyly_google_token")){if(e.has(gt)){const t=decodeURIComponent(e.get(gt)),i=dr(t,Rt,Pt),o=i&&JSON.parse(i);if(o){const t={};t.userId=o.uid,t.name=o.displayName,t.email=o.email,t.photoUrl=null==o?void 0:o.photoURL;const e=JSON.stringify(t),i=cr(e,Rt,Pt);sr(ft,i,!0),ar(Mt)}}else if(e.has("snippyly_google_token")){const t=JSON.parse(atob(e.get("snippyly_google_token"))),i={};i.userId=t.uid,i.name=t.displayName,i.email=t.email,i.photoUrl=null==t?void 0:t.photoURL,sr(mt,JSON.stringify(i),!0)}e.delete(gt),e.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}e.has(ht)?(sr(ht,"true",!1),ar(ut),e.delete(ht),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(ut)||rr(ht,!1)&&this.loadPluginUI(),e.has(ut)?(sr(ut,"true",!1),ar(ht),e.delete(ut),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(ht)||rr(ut,!1)&&this.loadPluginUI(),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t),Cr("Error in checkUrl: ",t)}},this.detectVersion=()=>{try{if(this.projectVersionKey){const t=new URL(document.location).searchParams;if(t.get(this.projectVersionKey))this.projectVersion=t.get(this.projectVersionKey);else if(window.snippylyInitialLoadUrl){const t=new URL(window.snippylyInitialLoadUrl).searchParams;t.get(this.projectVersionKey)&&(this.projectVersion=t.get(this.projectVersionKey))}this.projectVersion&&sr(Ct,this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has(ht)||t.has(ut))&&t.has(bt)&&(sr(yt,bt,!1,"sessionStorage"),this.projectVersion=t.get(bt),this.projectVersion&&sr(Ct,this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Cr("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||rr(yt,!1,"sessionStorage"),e=this.projectVersion||rr(Ct,!1,"sessionStorage");if(t&&e){const i=new URL(document.location),o=i.searchParams;o.get(t)||(o.set(t,e),window.history.replaceState({},document.title,i.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),Cr("Error in setVersionInUrl: ",t)}},this.loadPluginUI=async()=>{var t,e,i,o,n,s,r;try{if(!this.apiKey)return;if(!this.projectId)return;if(this.loadPlugin)return this.generateLocation(),void this.setLocation();if(this.toolbarEnabledApiCalled||await this.detectToolbarEnabled(),!this.toolbarEnabled)return;const a=hr();if(a&&!(null==a?void 0:a.isAnonymous)&&(this.loading=!0),null===(t=this.getCustomerMetadata())||void 0===t||t.then((t=>{this.customerMetadata=t})).catch((t=>{console.warn("Error in getCustomerMetadata: ",t),Cr("Error in getCustomerMetadata: ",t)})),rr(Tt,!0)&&(this.isPasswordValid="true"===rr(Tt,!0)),rr(_t,!0)&&rr(Lt,!0)&&rr(Nt,!0)?(this.guestMode="true"===rr(_t,!0),this.allowGuestModeSignIn="true"===rr(Lt,!0),this.passwordProtected="true"===rr(Nt,!0)):(this.projectConfig=await(async(t,e)=>{var i;try{const o=Mi(mr,Kt),n=await o({apiKey:t,projectId:e});return null===(i=null==n?void 0:n.data)||void 0===i?void 0:i.data}catch(t){return console.warn("Error in getProjectConfig: ",t),null}})(this.apiKey,this.projectId),this.guestMode=!!(null===(e=this.projectConfig)||void 0===e?void 0:e.guestMode)||this.guestMode,this.allowGuestModeSignIn=!!(null===(o=null===(i=this.projectConfig)||void 0===i?void 0:i.guestModeConfig)||void 0===o?void 0:o.allowSignIn),(null===(n=this.projectConfig)||void 0===n?void 0:n.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(r=null===(s=this.projectConfig)||void 0===s?void 0:s.passwordProtected)||void 0===r?void 0:r.enabled),sr(_t,this.guestMode+"",!0),sr(Lt,this.allowGuestModeSignIn+"",!0),sr(Nt,this.passwordProtected+"",!0)),this.loadPlugin=!0,!document.querySelector(Dt.VELT_COMMENTS)){const t=document.createElement(Dt.VELT_COMMENTS);null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),t.addEventListener("onCommentAdd",(()=>{this.addCommentCount++})),t.addEventListener("onCommentUpdate",(t=>{var e,i;(null===(e=this.snippylyUser)||void 0===e?void 0:e.isGuest)&&"newlyAdded"===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&(this.addCommentCount>=2&&!rr(It)&&(this.allowGuestModeSignIn?this.openGuestModeSignInModal():this.openGuestModeNameModel(),sr(It,"true")),this.addCommentCount>=5&&!rr(Ft,!1,"sessionStorage")&&(this.showGuestModeSignInBanner(),sr(Ft,"true",!1,"sessionStorage")))})),window.document.body.appendChild(t)}if(!document.querySelector(Dt.VELT_CURSOR)){const t=document.createElement(Dt.VELT_CURSOR);window.document.body.appendChild(t)}if(!document.querySelector(Dt.VELT_HUDDLE)){const t=document.createElement(Dt.VELT_HUDDLE);window.document.body.appendChild(t)}if(!document.querySelector(Dt.VELT_RECORDER_NOTES)){const t=document.createElement(Dt.VELT_RECORDER_NOTES);window.document.body.appendChild(t)}if(!document.querySelector(Dt.VELT_RECORDER_CONTROL_PANEL)){const t=document.createElement(Dt.VELT_RECORDER_CONTROL_PANEL);window.document.body.appendChild(t)}if(!document.querySelector(Dt.VELT_ARROWS)){const t=document.createElement(Dt.VELT_ARROWS);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Cr("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var t,e,o,n,s,r,a,l,c,d,h,u,p,v,m,g,f,w,y;try{if(await i(this.apiKey,{options:{develop:this.staging,version:this.staging?dt:"latest",velt:!0}}),!window.Snippyly)return;if(this.autoTranslation&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.enableAutoTranslation)&&(null===Snippyly||void 0===Snippyly||Snippyly.enableAutoTranslation()),!document.querySelector(Dt.VELT_COMMENTS_SIDEBAR)){const t=document.createElement(Dt.VELT_COMMENTS_SIDEBAR);t.setAttribute($t.ENABLE_URL_NAVIGATION,"true"),t.setAttribute($t.CURRENT_LOCATION_SUFFIX,"true"),window.document.body.appendChild(t)}if(Snippyly){null===Snippyly||void 0===Snippyly||Snippyly.sf(!0);try{(null===window||void 0===window?void 0:window.onSnippylyLoad)&&(null===window||void 0===window||window.onSnippylyLoad(Snippyly))}catch(t){}document.body.style.setProperty("--velt-default-font-family","'Poppins', sans-serif"),(()=>{try{if(!document.getElementById("superflowFontLink1")){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",t.id="superflowFontLink1",document.head.appendChild(t)}if(!document.getElementById("superflowFontLink2")){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="anonymous",t.id="superflowFontLink2",document.head.appendChild(t)}if(!document.getElementById("superflowFontLink3")){const t=document.createElement("link");t.rel="stylesheet",t.href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap",t.id="superflowFontLink3",document.head.appendChild(t)}}catch(t){console.warn("Error in loadPoppinsFont: ",t),Cr("Error in loadPoppinsFont: ",t)}})()}Snippyly&&wr({sdkVersion:null===Snippyly||void 0===Snippyly?void 0:Snippyly.version,sdkType:"client"}),this.documentId=((t,e=0)=>{try{let i=3735928559^e,o=1103547991^e;for(let e,n=0;n<t.length;n++)e=t.charCodeAt(n),i=Math.imul(i^e,2654435761),o=Math.imul(o^e,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&o)+(i>>>0)}catch(t){return console.warn("Error in cyrb53: ",t),Cr("Error in cyrb53: ",t),0}})((t=>{let e;return e=t.includes("http")?new URL(t):new URL("http://"+t),e.hostname.replace("www.","")})(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setDocumentId(this.documentId+""));const C=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();if(wr({documentId:C,clientDocumentId:this.documentId}),this.generateLocation(),this.setLocation(),this.commentElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCommentElement(),this.contactElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getContactElement(),this.rewriterElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getRewriterElement(),this.presenceElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getPresenceElement(),this.commentElement){this.commentElement.enableTextComments(!0),this.customLoginEnabledLocally||this.commentElement.enableSignInButton(!0),this.commentElement.enableAttachments(!0),(null===(t=this.commentElement)||void 0===t?void 0:t.showScreenSizeInfo)&&this.commentElement.showScreenSizeInfo(!0),(null===(e=this.commentElement)||void 0===e?void 0:e.enableDeviceInfo)&&this.commentElement.enableDeviceInfo(!0),this.commentElement.enableCommentIndex(!0),this.commentElement.onCommentModeChange&&this.commentElement.onCommentModeChange().subscribe((t=>{this.addCommentMode=t})),(null===(o=this.commentElement)||void 0===o?void 0:o.enableOrphanComments)&&this.commentElement.enableOrphanComments(),(null===(n=this.commentElement)||void 0===n?void 0:n.enableAutoCategorize)&&this.commentElement.enableAutoCategorize(),(null===(s=this.commentElement)||void 0===s?void 0:s.enablePersistentCommentMode)&&this.commentElement.enablePersistentCommentMode(),(null===(r=this.commentElement)||void 0===r?void 0:r.enableGhostComments)&&this.commentElement.enableGhostComments();const i=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;i&&"object"==typeof i&&(null===(a=this.commentElement)||void 0===a?void 0:a.setCustomStatus)&&this.commentElement.setCustomStatus(i),(null===(l=this.commentElement)||void 0===l?void 0:l.enableMinimap)&&this.commentElement.enableMinimap(),(null===(c=this.commentElement)||void 0===c?void 0:c.setDStrategy)&&(null===(d=this.commentElement)||void 0===d||d.setDStrategy("dynamicId")),(null===(h=this.commentElement)||void 0===h?void 0:h.enableSidebarButtonOnCommentDialog)&&this.commentElement.enableSidebarButtonOnCommentDialog(),(null===(u=this.commentElement)||void 0===u?void 0:u.enableHotkey)&&this.commentElement.enableHotkey()}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(p=this.rewriterElement)||void 0===p||p.enableRewriter()),this.presenceElement&&(null===(v=this.presenceElement)||void 0===v?void 0:v.enableFlockMode)&&(null===(m=this.presenceElement)||void 0===m||m.enableFlockMode(!0)),null===(g=null===Snippyly||void 0===Snippyly?void 0:Snippyly.docService)||void 0===g||g.getDocumentMetadata$().subscribe((t=>{const e=(null==t?void 0:t.versions)?Object.values(null==t?void 0:t.versions):[],i=new URL(document.location).searchParams.get("version");if(i){const t=e.find((t=>t.versionId===i));t&&(this.version={id:t.versionId,name:t.versionName||t.versionId},this.setLocation())}})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getViewsElement)&&(this.viewsElement=Snippyly.getViewsElement()),(null===(f=this.viewsElement)||void 0===f?void 0:f.getUniqueViewsByUser)&&(null===(y=null===(w=this.viewsElement)||void 0===w?void 0:w.getUniqueViewsByUser())||void 0===y||y.subscribe((t=>{this.totalViews=t}))),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Cr("Error in initializeSnippyly: ",t)}},this.checkToEnableUpgradeButton=()=>{var t,e;try{this.isPlanExpired&&this.isUserGlobalContact?(null===(t=this.commentElement)||void 0===t?void 0:t.enableUpgradeButton)&&this.commentElement.enableUpgradeButton():(null===(e=this.commentElement)||void 0===e?void 0:e.disableUpgradeButton)&&this.commentElement.disableUpgradeButton()}catch(t){console.warn("Error in checkToEnableUpgradeButton: ",t),Cr("Error in checkToEnableUpgradeButton: ",t)}},this.getCustomerMetadata=async()=>{try{let t=(()=>{try{const t=rr(Ot);return t?"false"===t?JSON.parse(JSON.stringify(jt)):JSON.parse(t):null}catch(t){return console.warn("Error in getCustomerMetadataFromStorage: ",t),Cr("Error in getCustomerMetadataFromStorage: ",t),null}})();return t||(t=await(async t=>{try{const e=Mi(mr,Gt),i=await e({apiKey:t});return null==i?void 0:i.data}catch(t){return console.warn("Error in getCustomerMetadata: ",t),null}})(this.apiKey),vr(t)),t}catch(t){console.warn("Error in getCustomerMetadata: ",t),Cr("Error in getCustomerMetadata: ",t)}},this.setLogos=()=>{var t,e,i,o,n,s,r,a,l,c,d,h;try{let u="light";this.privateCommentModeEnabled&&(u="dark");const p=null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.customBranding)||void 0===e?void 0:e.logo)||void 0===i?void 0:i.logoMark,v=null===(s=null===(n=null===(o=null==Ut?void 0:jt)||void 0===o?void 0:o.customBranding)||void 0===n?void 0:n.logo)||void 0===s?void 0:s.logoMark,m=null===(l=null===(a=null===(r=this.customerMetadata)||void 0===r?void 0:r.customBranding)||void 0===a?void 0:a.logo)||void 0===l?void 0:l.wordMark,g=null===(h=null===(d=null===(c=null==Ut?void 0:jt)||void 0===c?void 0:c.customBranding)||void 0===d?void 0:d.logo)||void 0===h?void 0:h.wordMark;switch(u){case"light":this.logoMark=(null==p?void 0:p.lightUrl)||(null==p?void 0:p.darkUrl)||(null==v?void 0:v.lightUrl),this.wordMark=(null==m?void 0:m.lightUrl)||(null==m?void 0:m.darkUrl)||(null==g?void 0:g.lightUrl);break;case"dark":this.logoMark=(null==p?void 0:p.darkUrl)||(null==p?void 0:p.lightUrl)||(null==v?void 0:v.darkUrl),this.wordMark=(null==m?void 0:m.darkUrl)||(null==m?void 0:m.lightUrl)||(null==g?void 0:g.darkUrl)}}catch(t){console.warn("Error in setLogos: ",t),Cr("Error in setLogos: ",t)}},this.getLogoMark=()=>{var t;try{return(null===(t=this.logoMark)||void 0===t?void 0:t.includes("<svg"))?O`
|
|
2450
2450
|
${Lr(this.logoMark)}
|
|
2451
2451
|
`:O`
|
|
2452
2452
|
<img src=${this.logoMark} />
|
|
@@ -2454,13 +2454,13 @@ class Tr extends lt{constructor(t){if(super(t),this.it=$,t.type!==rt)throw Error
|
|
|
2454
2454
|
${Lr(this.wordMark)}
|
|
2455
2455
|
`:O`
|
|
2456
2456
|
<img src=${this.wordMark} />
|
|
2457
|
-
`}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`
|
|
2457
|
+
`}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.skipGuestNameModal||(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`
|
|
2458
2458
|
<div class="disable-add-comment-button" @click=${()=>this.disableCommentMode()}>
|
|
2459
2459
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2460
2460
|
<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"/>
|
|
2461
2461
|
</svg>
|
|
2462
2462
|
</div>
|
|
2463
|
-
`:O``}catch(t){return console.warn("Error in disableAddCommentModeButton: ",t),Cr("Error in disableAddCommentModeButton: ",t),O``}},this.addStyles=()=>{var t,e;try{const i=document.createElement("style");i.textContent=kr.cssText,null===(t=this.shadowRoot)||void 0===t||t.appendChild(i);const o=document.createElement("style");o.textContent=Sr.cssText,null===(e=this.shadowRoot)||void 0===e||e.appendChild(o)}catch(t){console.warn("Error in addStyles: ",t),Cr("Error in addStyles: ",t)}},this.guestUserNameUpdated=!!rr(At);const t=new URL(document.location);t.searchParams.has(gt)&&t.searchParams.delete(gt),this.signInUrl=`${zt}/signin?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,this.signOutUrl=`${zt}/signout?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,ar(ft),await this.checkCustomLoginEnabled()},identify:async t=>{this.providedUser=t,this.customLoginEnabled&&this.loginWithCustomUser()},signInUrl:this.signInUrl,signOutUrl:this.signOutUrl,openGuestModeSignInModal:
|
|
2463
|
+
`:O``}catch(t){return console.warn("Error in disableAddCommentModeButton: ",t),Cr("Error in disableAddCommentModeButton: ",t),O``}},this.addStyles=()=>{var t,e;try{const i=document.createElement("style");i.textContent=kr.cssText,null===(t=this.shadowRoot)||void 0===t||t.appendChild(i);const o=document.createElement("style");o.textContent=Sr.cssText,null===(e=this.shadowRoot)||void 0===e||e.appendChild(o)}catch(t){console.warn("Error in addStyles: ",t),Cr("Error in addStyles: ",t)}},this.guestUserNameUpdated=!!rr(At);const t=new URL(document.location);t.searchParams.has(gt)&&t.searchParams.delete(gt),this.signInUrl=`${zt}/signin?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,this.signOutUrl=`${zt}/signout?redirect_url=${encodeURIComponent(null==t?void 0:t.toString())}&source=sf`,window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,ar(ft),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()}};try{this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Cr("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){var e,i,o,n,s,r,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===(s=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===s||s.setProperty("transform","none","important"),null===(a=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.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(),wr({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&&sr(yt,this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Cr("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 darkMode(){return this._darkMode}set darkMode(t){this._darkMode=t,this.setLogos()}get totalViews(){return this._totalViews}set totalViews(t){this._totalViews=t,this.totalViewsCount=Object.keys(this.totalViews||{}).length}connectedCallback(){super.connectedCallback(),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.")}),1e3)}async detectToolbarEnabled(){try{if(this.projectId&&this.apiKey){this.toolbarEnabledApiCalled=!0;const t=document.location.toString();this.toolbarEnabled=await(async(t,e,i)=>{var o;try{const n=Mi(mr,Qt),s=await n({apiKey:t,projectId:e,url:i});return null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.data}catch(t){return console.warn("Error in checkToolbarEnabled: ",t),null}})(this.apiKey,this.projectId,t)}}catch(t){console.warn("Error in detectToolbarEnabled: ",t),Cr("Error in detectToolbarEnabled: ",t)}}render(){var t,e,i,o,n,s,r,a,l,c,d,h,u,p,v,m,g,f;return this.loadPlugin&&this.toolbarEnabled?!this.snippylyUser||this.loading||null===this.isPlanExpired?O`
|
|
2464
2464
|
<div class="snippyly-plugin-container" part="superflow-toolbar-container">
|
|
2465
2465
|
<div class="toolbar" id="smallToolbar">
|
|
2466
2466
|
<!-- <div class="toolbar-section">
|
|
@@ -3284,4 +3284,4 @@ class Tr extends lt{constructor(t){if(super(t),this.it=$,t.type!==rt)throw Error
|
|
|
3284
3284
|
</div>
|
|
3285
3285
|
</div>
|
|
3286
3286
|
`:O``}
|
|
3287
|
-
`:O``}}Ar.styles=[kr,Sr],Ir([ot()],Ar.prototype,"loadPlugin",null),Ir([ot()],Ar.prototype,"comments",void 0),Ir([ot()],Ar.prototype,"commentElement",void 0),Ir([ot()],Ar.prototype,"contactElement",void 0),Ir([ot()],Ar.prototype,"rewriterElement",void 0),Ir([ot()],Ar.prototype,"presenceElement",void 0),Ir([ot()],Ar.prototype,"commentSubscription",void 0),Ir([ot()],Ar.prototype,"selectionElement",void 0),Ir([ot()],Ar.prototype,"viewsElement",void 0),Ir([ot()],Ar.prototype,"addCommentMode",void 0),Ir([ot()],Ar.prototype,"showTourCommentTooltip",void 0),Ir([ot()],Ar.prototype,"allFeatureDisabled",void 0),Ir([ot()],Ar.prototype,"allFeatureRestricted",void 0),Ir([ot()],Ar.prototype,"guestMode",void 0),Ir([ot()],Ar.prototype,"_expanded",void 0),Ir([ot()],Ar.prototype,"loading",void 0),Ir([ot()],Ar.prototype,"signInError",void 0),Ir([ot()],Ar.prototype,"snippylyUser",void 0),Ir([ot()],Ar.prototype,"snippylyUserRole",void 0),Ir([ot()],Ar.prototype,"_isPlanExpired",void 0),Ir([ot()],Ar.prototype,"showOnboardingModal",void 0),Ir([ot()],Ar.prototype,"showLiveDemoModal",void 0),Ir([ot()],Ar.prototype,"showFigmaDemoModal",void 0),Ir([ot()],Ar.prototype,"showGuestModeSignInModal",void 0),Ir([ot()],Ar.prototype,"guestModeSignInModalConfig",void 0),Ir([ot()],Ar.prototype,"showGuestModeNameModal",void 0),Ir([ot()],Ar.prototype,"guestModeSignInBannerVisible",void 0),Ir([ot()],Ar.prototype,"guestUserNameInput",void 0),Ir([ot()],Ar.prototype,"guestUserModelOpened",void 0),Ir([ot()],Ar.prototype,"guestUserNameUpdated",void 0),Ir([ot()],Ar.prototype,"guestUserNameUpdateLoading",void 0),Ir([it()],Ar.prototype,"apiKey",null),Ir([it()],Ar.prototype,"projectId",null),Ir([ot()],Ar.prototype,"staging",void 0),Ir([it()],Ar.prototype,"projectVersionKey",null),Ir([ot()],Ar.prototype,"projectVersion",void 0),Ir([ot()],Ar.prototype,"version",void 0),Ir([it()],Ar.prototype,"autoLocation",null),Ir([ot()],Ar.prototype,"_menuOpenedId",void 0),Ir([ot()],Ar.prototype,"copyLinkTooltip",void 0),Ir([ot()],Ar.prototype,"invalidApiKey",void 0),Ir([ot()],Ar.prototype,"documentId",void 0),Ir([ot()],Ar.prototype,"_isUserGlobalContact",void 0),Ir([ot()],Ar.prototype,"location",void 0),Ir([ot()],Ar.prototype,"qrCode",void 0),Ir([ot()],Ar.prototype,"showQrCode",void 0),Ir([ot()],Ar.prototype,"customLoginEnabledLocally",void 0),Ir([it()],Ar.prototype,"customLoginEnabled",void 0),Ir([ot()],Ar.prototype,"providedUser",void 0),Ir([ot()],Ar.prototype,"autoTranslation",void 0),Ir([ot()],Ar.prototype,"addCommentCount",void 0),Ir([ot()],Ar.prototype,"isSigningInUserAdmin",void 0),Ir([ot()],Ar.prototype,"_privateCommentModeEnabled",void 0),Ir([ot()],Ar.prototype,"superflowToolbarMoved",void 0),Ir([ot()],Ar.prototype,"_customerMetadata",void 0),Ir([ot()],Ar.prototype,"logoMark",void 0),Ir([ot()],Ar.prototype,"wordMark",void 0),Ir([ot()],Ar.prototype,"_darkMode",void 0),Ir([ot()],Ar.prototype,"projectConfig",void 0),Ir([ot()],Ar.prototype,"allowGuestModeSignIn",void 0),Ir([ot()],Ar.prototype,"toolbarEnabled",void 0),Ir([ot()],Ar.prototype,"toolbarEnabledApiCalled",void 0),Ir([ot()],Ar.prototype,"passwordProtected",void 0),Ir([ot()],Ar.prototype,"isPasswordValid",void 0),Ir([ot()],Ar.prototype,"password",void 0),Ir([ot()],Ar.prototype,"validatingPasswordLoading",void 0),Ir([ot()],Ar.prototype,"showPasswordProtectedModal",void 0),Ir([ot()],Ar.prototype,"showInvalidPassword",void 0),Ir([ot()],Ar.prototype,"_totalViews",void 0),Ir([ot()],Ar.prototype,"totalViewsCount",void 0),(t=>{if(customElements.get("superflow-toolbar")||customElements.get("snippyly-plugin"))return;const e={allow:["sdkUrl","windowVariables","snippylyPlugin"],loaders:{windowVariables:()=>{const t=null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_API_KEY;return{valid:!!t,type:"windowVariables",apiKey:t,staging:!!(null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_STAGING),projectVersionKey:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,projectId:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_ID,autoLocation:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_AUTO_LOCATION}},snippylyPlugin:()=>{const t=document.querySelector("snippyly-plugin");if(!t)return;const e=t.getAttribute("apiKey"),i=!!t.getAttribute("staging"),o=t.getAttribute("projectVersionKey"),n=t.getAttribute("projectId"),s=t.getAttribute("autoLocation");return null==t||t.remove(),{valid:!!e,type:"snippylyPlugin",apiKey:e,staging:i,projectVersionKey:o,projectId:n,autoLocation:s}},sdkUrl:()=>{const t=document.getElementById("superflowToolbarScript");if(!t)return;const e=null==t?void 0:t.src,i=new URL(e).searchParams,o=i.has("apiKey")?i.get("apiKey"):void 0;return{valid:!!o,type:"sdkUrl",apiKey:o,staging:void 0,projectVersionKey:void 0,projectId:i.has("projectId")?i.get("projectId"):void 0,autoLocation:i.has("autoLocation")?i.get("autoLocation"):void 0}}},load:()=>{for(let t=0;t<e.allow.length;t++){const i=e.allow[t],o=e.loaders[i]();if(o&&o.valid)return o}}},i=()=>{try{const i=e.load();if(customElements.define("superflow-toolbar",t),i&&i.valid){(()=>{try{document.querySelectorAll("superflow-toolbar").forEach((t=>{t.remove()})),document.querySelectorAll("snippyly-plugin").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const t={};return t.apiKey=i.apiKey,i.staging&&(t.staging="true"),i.projectVersionKey&&(t.projectVersionKey=i.projectVersionKey),i.projectId&&(t.projectId=i.projectId),(null==i?void 0:i.autoLocation)&&(t.autoLocation=i.autoLocation),void((t={})=>{try{const e=document.createElement("superflow-toolbar");Object.keys(t||{}).forEach((i=>{e.setAttribute(i,t[i])})),document.body.appendChild(e)}catch(t){console.warn("Error in loadSuperflowToolbarTag: ",t)}})(t)}}catch(t){console.warn("Error in initSuperflow: ",t)}};(null===document||void 0===document?void 0:document.body)?i():null===document||void 0===document||document.addEventListener("DOMContentLoaded",(()=>{i()}))})(Ar);class Fr extends X{}customElements.get("snippyly-plugin")||customElements.define("snippyly-plugin",Fr),t.SnippylyPlugin=Fr,t.SuperflowToolbar=Ar,Object.defineProperty(t,"u",{value:!0})}({});
|
|
3287
|
+
`:O``}}Ar.styles=[kr,Sr],Ir([ot()],Ar.prototype,"loadPlugin",null),Ir([ot()],Ar.prototype,"comments",void 0),Ir([ot()],Ar.prototype,"commentElement",void 0),Ir([ot()],Ar.prototype,"contactElement",void 0),Ir([ot()],Ar.prototype,"rewriterElement",void 0),Ir([ot()],Ar.prototype,"presenceElement",void 0),Ir([ot()],Ar.prototype,"commentSubscription",void 0),Ir([ot()],Ar.prototype,"selectionElement",void 0),Ir([ot()],Ar.prototype,"viewsElement",void 0),Ir([ot()],Ar.prototype,"addCommentMode",void 0),Ir([ot()],Ar.prototype,"showTourCommentTooltip",void 0),Ir([ot()],Ar.prototype,"allFeatureDisabled",void 0),Ir([ot()],Ar.prototype,"allFeatureRestricted",void 0),Ir([ot()],Ar.prototype,"guestMode",void 0),Ir([ot()],Ar.prototype,"_expanded",void 0),Ir([ot()],Ar.prototype,"loading",void 0),Ir([ot()],Ar.prototype,"signInError",void 0),Ir([ot()],Ar.prototype,"snippylyUser",void 0),Ir([ot()],Ar.prototype,"snippylyUserRole",void 0),Ir([ot()],Ar.prototype,"_isPlanExpired",void 0),Ir([ot()],Ar.prototype,"showOnboardingModal",void 0),Ir([ot()],Ar.prototype,"showLiveDemoModal",void 0),Ir([ot()],Ar.prototype,"showFigmaDemoModal",void 0),Ir([ot()],Ar.prototype,"showGuestModeSignInModal",void 0),Ir([ot()],Ar.prototype,"guestModeSignInModalConfig",void 0),Ir([ot()],Ar.prototype,"showGuestModeNameModal",void 0),Ir([ot()],Ar.prototype,"guestModeSignInBannerVisible",void 0),Ir([ot()],Ar.prototype,"guestUserNameInput",void 0),Ir([ot()],Ar.prototype,"guestUserModelOpened",void 0),Ir([ot()],Ar.prototype,"guestUserNameUpdated",void 0),Ir([ot()],Ar.prototype,"guestUserNameUpdateLoading",void 0),Ir([it()],Ar.prototype,"apiKey",null),Ir([it()],Ar.prototype,"projectId",null),Ir([ot()],Ar.prototype,"staging",void 0),Ir([it()],Ar.prototype,"projectVersionKey",null),Ir([ot()],Ar.prototype,"projectVersion",void 0),Ir([ot()],Ar.prototype,"version",void 0),Ir([it()],Ar.prototype,"autoLocation",null),Ir([ot()],Ar.prototype,"_menuOpenedId",void 0),Ir([ot()],Ar.prototype,"copyLinkTooltip",void 0),Ir([ot()],Ar.prototype,"invalidApiKey",void 0),Ir([ot()],Ar.prototype,"documentId",void 0),Ir([ot()],Ar.prototype,"_isUserGlobalContact",void 0),Ir([ot()],Ar.prototype,"location",void 0),Ir([ot()],Ar.prototype,"qrCode",void 0),Ir([ot()],Ar.prototype,"showQrCode",void 0),Ir([ot()],Ar.prototype,"customLoginEnabledLocally",void 0),Ir([it()],Ar.prototype,"customLoginEnabled",void 0),Ir([ot()],Ar.prototype,"providedUser",void 0),Ir([ot()],Ar.prototype,"autoTranslation",void 0),Ir([ot()],Ar.prototype,"addCommentCount",void 0),Ir([ot()],Ar.prototype,"isSigningInUserAdmin",void 0),Ir([ot()],Ar.prototype,"_privateCommentModeEnabled",void 0),Ir([ot()],Ar.prototype,"superflowToolbarMoved",void 0),Ir([ot()],Ar.prototype,"_customerMetadata",void 0),Ir([ot()],Ar.prototype,"logoMark",void 0),Ir([ot()],Ar.prototype,"wordMark",void 0),Ir([ot()],Ar.prototype,"_darkMode",void 0),Ir([ot()],Ar.prototype,"projectConfig",void 0),Ir([ot()],Ar.prototype,"allowGuestModeSignIn",void 0),Ir([ot()],Ar.prototype,"toolbarEnabled",void 0),Ir([ot()],Ar.prototype,"toolbarEnabledApiCalled",void 0),Ir([ot()],Ar.prototype,"passwordProtected",void 0),Ir([ot()],Ar.prototype,"isPasswordValid",void 0),Ir([ot()],Ar.prototype,"password",void 0),Ir([ot()],Ar.prototype,"validatingPasswordLoading",void 0),Ir([ot()],Ar.prototype,"showPasswordProtectedModal",void 0),Ir([ot()],Ar.prototype,"showInvalidPassword",void 0),Ir([ot()],Ar.prototype,"skipGuestNameModal",void 0),Ir([ot()],Ar.prototype,"_totalViews",void 0),Ir([ot()],Ar.prototype,"totalViewsCount",void 0),(t=>{if(customElements.get("superflow-toolbar")||customElements.get("snippyly-plugin"))return;const e={allow:["sdkUrl","windowVariables","snippylyPlugin"],loaders:{windowVariables:()=>{const t=null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_API_KEY;return{valid:!!t,type:"windowVariables",apiKey:t,staging:!!(null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_STAGING),projectVersionKey:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,projectId:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_ID,autoLocation:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_AUTO_LOCATION}},snippylyPlugin:()=>{const t=document.querySelector("snippyly-plugin");if(!t)return;const e=t.getAttribute("apiKey"),i=!!t.getAttribute("staging"),o=t.getAttribute("projectVersionKey"),n=t.getAttribute("projectId"),s=t.getAttribute("autoLocation");return null==t||t.remove(),{valid:!!e,type:"snippylyPlugin",apiKey:e,staging:i,projectVersionKey:o,projectId:n,autoLocation:s}},sdkUrl:()=>{const t=document.getElementById("superflowToolbarScript");if(!t)return;const e=null==t?void 0:t.src,i=new URL(e).searchParams,o=i.has("apiKey")?i.get("apiKey"):void 0;return{valid:!!o,type:"sdkUrl",apiKey:o,staging:void 0,projectVersionKey:void 0,projectId:i.has("projectId")?i.get("projectId"):void 0,autoLocation:i.has("autoLocation")?i.get("autoLocation"):void 0}}},load:()=>{for(let t=0;t<e.allow.length;t++){const i=e.allow[t],o=e.loaders[i]();if(o&&o.valid)return o}}},i=()=>{try{const i=e.load();if(customElements.define("superflow-toolbar",t),i&&i.valid){(()=>{try{document.querySelectorAll("superflow-toolbar").forEach((t=>{t.remove()})),document.querySelectorAll("snippyly-plugin").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const t={};return t.apiKey=i.apiKey,i.staging&&(t.staging="true"),i.projectVersionKey&&(t.projectVersionKey=i.projectVersionKey),i.projectId&&(t.projectId=i.projectId),(null==i?void 0:i.autoLocation)&&(t.autoLocation=i.autoLocation),void((t={})=>{try{const e=document.createElement("superflow-toolbar");Object.keys(t||{}).forEach((i=>{e.setAttribute(i,t[i])})),document.body.appendChild(e)}catch(t){console.warn("Error in loadSuperflowToolbarTag: ",t)}})(t)}}catch(t){console.warn("Error in initSuperflow: ",t)}};(null===document||void 0===document?void 0:document.body)?i():null===document||void 0===document||document.addEventListener("DOMContentLoaded",(()=>{i()}))})(Ar);class Fr extends X{}customElements.get("snippyly-plugin")||customElements.define("snippyly-plugin",Fr),t.SnippylyPlugin=Fr,t.SuperflowToolbar=Ar,Object.defineProperty(t,"u",{value:!0})}({});
|