@usesuperflow/toolbar-staging 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/superflow.js +1 -1
- package/superflow.min.js +1 -1
package/package.json
CHANGED
package/superflow.js
CHANGED
|
@@ -1321,7 +1321,7 @@ class dn extends oi{}dn.Encryptor=class extends dn{processBlock(t,e){const i=t,o
|
|
|
1321
1321
|
line-height: 1;
|
|
1322
1322
|
cursor: pointer;
|
|
1323
1323
|
}
|
|
1324
|
-
`;!function(){const t=()=>{try{let t=window.SUPERFLOW_TOOLBAR_API_KEY,e=!!window.SUPERFLOW_TOOLBAR_STAGING,i=window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,o=window.SUPERFLOW_TOOLBAR_PROJECT_ID;if(!t){const n=document.querySelector("snippyly-plugin");n&&(t=n.getAttribute("apiKey"),e=!!n.getAttribute("staging"),i=n.getAttribute("projectVersionKey"),o=n.getAttribute("projectId"),null==n||n.remove())}if(t){(()=>{try{document.querySelectorAll("superflow-toolbar").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const n={};n.apiKey=t,e&&(n.staging="true"),i&&(n.projectVersionKey=i),o&&(n.projectId=o),((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)}})(n)}}catch(t){console.warn("Error in initSuperflow: ",t)}};(null===document||void 0===document?void 0:document.body)?t():null===document||void 0===document||document.addEventListener("DOMContentLoaded",(()=>{t()}))}();var Vn=function(t,e,i,o){for(var n,s=arguments.length,r=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(n=t[l])&&(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};let Tn=class extends Y{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this.showTourCommentTooltip=!1,this._expanded=!0,this.loading=!1,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!1,this.showFigmaDemoModal=!1,this.staging=true,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this._isUserGlobalContact=!1,this.showQrCode=!1,this.customLoginEnabledLocally=null,this.customLoginEnabled=null,this.exitReviewModeCalled=!1,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),Hn("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const e=await(t=>{const e={apiKey:t};return De($n,"customLoginEnabled")(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),Hn("Error in checkCustomLoginEnabled: ",t)}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(yn("_sfut"),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),Hn("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),Hn("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Hn("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Hn("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),Hn("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),e=t.searchParams;if((null==e?void 0:e.has("sprojectInstall"))&&!Cn("sprojectInstall")?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==e?void 0:e.has("sflivedemo"))if(Cn("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(Cn("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=En(t,ft,wt),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=xn(e,ft,wt);mn("_sfut",i,!0)}}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,mn("snippyly-user",JSON.stringify(i),!0)}e.delete("st"),e.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}e.has("review")?(mn("review","true",!1),yn("feedback"),"true"!==e.get("review")&&(e.delete("review"),e.append("review","true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):e.has("feedback")||Cn("review",!1)&&(e.append("review","true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),e.has("feedback")?(mn("feedback","true",!1),yn("review"),"true"!==e.get("feedback")&&(e.delete("feedback"),e.append("feedback","true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):e.has("review")||Cn("feedback",!1)&&(e.append("feedback","true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t),Hn("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&&mn("projectVersion",this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has("review")||t.has("feedback"))&&t.has("sversion")&&(mn("projectVersionKey","sversion",!1,"sessionStorage"),this.projectVersion=t.get("sversion"),this.projectVersion&&mn("projectVersion",this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Hn("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||Cn("projectVersionKey",!1,"sessionStorage"),e=this.projectVersion||Cn("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),Hn("Error in setVersionInUrl: ",t)}},this.loadPluginUI=()=>{try{if(!this.apiKey)return;if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);const t=kn();if(t&&!(null==t?void 0:t.isAnonymous)&&(this.loading=!0),this.loadPlugin=!0,!document.querySelector(at)){const t=document.createElement(at);null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),window.document.body.appendChild(t)}if(!document.querySelector(ct)){const t=document.createElement(ct);t.setAttribute(vt,"true"),window.document.body.appendChild(t)}if(!document.querySelector(lt)){const t=document.createElement(lt);window.document.body.appendChild(t)}if(!document.querySelector(dt)){const t=document.createElement(dt);window.document.body.appendChild(t)}if(!document.querySelector(ht)){const t=document.createElement(ht);window.document.body.appendChild(t)}if(!document.querySelector(pt)){const t=document.createElement(pt);window.document.body.appendChild(t)}if(!document.querySelector(ut)){const t=document.createElement(ut);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Hn("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var t,i,o,n,s,r,l,a,c;try{if(await e(this.apiKey,{options:{staging:this.staging,version:this.staging?"1.0.41":"latest",velt:!0}}),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),Hn("Error in loadPoppinsFont: ",t)}})()}if(Snippyly&&Mn({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),Hn("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+"")),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.enableAttachment(!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.showDeviceInfo)&&this.commentElement.showDeviceInfo(!0),this.commentElement.showCommentIndex(!0),this.commentElement.addCommentModeChange&&this.commentElement.addCommentModeChange().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();const e=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;e&&"object"==typeof e&&(null===(r=this.commentElement)||void 0===r?void 0:r.setCustomStatuses)&&this.commentElement.setCustomStatuses(e)}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(l=this.rewriterElement)||void 0===l||l.enableRewriter()),this.presenceElement&&(null===(a=this.presenceElement)||void 0===a?void 0:a.enableFlockMode)&&(null===(c=this.presenceElement)||void 0===c||c.enableFlockMode(!0)),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Hn("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),Hn("Error in checkToEnableUpgradeButton: ",t)}},this.generateLocation=()=>{try{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),Hn("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),Hn("Error in generateLocation: ",t)}},this.setLocation=()=>{var t,e,i,o;try{if(window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)){if(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))),this.previousLocation=JSON.parse(JSON.stringify(this.location))}}catch(t){console.warn("Error in setLocation: ",t),Hn("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,e;try{this.invalidApiKey=!1;let e,i={name:"Anonymous User",email:"anonymous@snippyly.com",userId:"anonymous",isAnonymous:!0};e=this.customLoginEnabled&&this.providedUser?this.providedUser:kn(),(null==e?void 0:e.email)&&(i=e),i.isAnonymous?delete i.groupId:i.groupId=Snippyly.getDocumentId()+"",this.customLoginEnabledLocally||(null===(t=null==i?void 0:i.contacts)||void 0===t?void 0:t.length)&&(i.contacts=[]),(null==i?void 0:i.isAnonymous)||(this.loading=!0);const o=await Snippyly.identify(i);An(o),(null==i?void 0:i.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(i))),Snippyly.getUserRole$().subscribe((t=>{var e;this.loading=!1,this.snippylyUserRole||"Admin"!==t||this.setViewMode("All"),this.snippylyUserRole=t,this.snippylyUserRole||this.setViewMode(null),null===(e=this.commentElement)||void 0===e||e.enablePriority()})),(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),Hn("Error in isPlanExpired$: ",t)}))),Mn({clientUserId:null==i?void 0:i.userId}),this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{Cn("sfTourCommentTooltip")||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){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),console.warn("Error in identifySnippyly: ",t),Hn("Error in identifySnippyly: ",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)})),"All"!==this.viewMode&&(this.viewMode?this.comments=this.comments.filter((t=>{var e;return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.view)===this.viewMode})):this.comments=this.comments.filter((t=>{var e;return!(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.view)})))})))}catch(t){console.warn("Error in getComments: ",t),Hn("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),Hn("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Hn("Error in toggleSnippylyPluginToolbar: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading||this.customLoginEnabledLocally)return;window.open(`https://snippyly-self-serve-platform.web.app//signup?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Hn("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const e=xn(t,ft,wt),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),Hn("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),Hn("Error in toggleQRCodeVisibility: ",t)}},this.removeSnippyly=async()=>{try{this.exitReviewModeCalled=!0,yn("review"),yn("feedback"),yn("sreviewId"),yn("projectVersionKey","sessionStorage"),yn("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),Hn("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),yn("snippyly-user"),yn("_sfut"),this.snippylyUser=void 0,window.open(`https://snippyly-self-serve-platform.web.app//signout?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Hn("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),Hn("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),Hn("Error in copyLink: ",t)}},this.setViewMode=t=>{try{this.viewMode=t,t?this.location.view=t:delete this.location.view,this.setLocation(),this.getComments()}catch(t){console.warn("Error in setViewMode: ",t),Hn("Error in setViewMode: ",t)}},this.goToAdminPortal=()=>{try{let t="https://snippyly-self-serve-platform.web.app/";if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const e=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();e&&(t=`https://snippyly-self-serve-platform.web.app//dashboard/project/comment/${this.apiKey}/${e}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Hn("Error in goToAdminPortal: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1pdbjok4g-0sRhuBwPVC73eO9KVGDtag","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),Hn("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,mn("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),Hn("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,mn("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),Hn("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),Hn("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://snippyly-self-serve-platform.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Hn("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,mn("sfTourCommentTooltip","true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Hn("Error in onTourCommentTooltipClick: ",t)}},window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,yn("_sfut"),await this.checkCustomLoginEnabled()},identify:async t=>{this.providedUser=t,this.customLoginEnabled&&this.loginWithCustomUser()}};try{this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Hn("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){var e,i,o,n,s,r,l,a,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===(l=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.style)||void 0===l||l.setProperty("perspective","none","important"),null===(d=null===(c=null===(a=null===document||void 0===document?void 0:document.body)||void 0===a?void 0:a.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(),Mn({apiKey:this.apiKey}),this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&mn("projectVersionKey",this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Hn("Error in set projectVersionKey: ",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()}connectedCallback(){super.connectedCallback(),this.expanded=!0,this.setAttribute("data-velt-comment-disabled","true"),this.style.zIndex="2147483577",setTimeout((()=>{const t=document.querySelectorAll('script[src*="snippyly.min.js"]');(null==t?void 0:t.length)>1&&console.warn("Multiple superflow scripts installed.")}),1e3)}render(){var t,e,i,o,n,s,r,l,a;return this.loadPlugin?!this.snippylyUser||this.loading||null===this.isPlanExpired?D`
|
|
1324
|
+
`;!function(){const t=()=>{try{let t=window.SUPERFLOW_TOOLBAR_API_KEY,e=!!window.SUPERFLOW_TOOLBAR_STAGING,i=window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,o=window.SUPERFLOW_TOOLBAR_PROJECT_ID;if(!t){const n=document.querySelector("snippyly-plugin");n&&(t=n.getAttribute("apiKey"),e=!!n.getAttribute("staging"),i=n.getAttribute("projectVersionKey"),o=n.getAttribute("projectId"),null==n||n.remove())}if(t){(()=>{try{document.querySelectorAll("superflow-toolbar").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const n={};n.apiKey=t,e&&(n.staging="true"),i&&(n.projectVersionKey=i),o&&(n.projectId=o),((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)}})(n)}}catch(t){console.warn("Error in initSuperflow: ",t)}};(null===document||void 0===document?void 0:document.body)?t():null===document||void 0===document||document.addEventListener("DOMContentLoaded",(()=>{t()}))}();var Vn=function(t,e,i,o){for(var n,s=arguments.length,r=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(n=t[l])&&(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};let Tn=class extends Y{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this.showTourCommentTooltip=!1,this._expanded=!0,this.loading=!1,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!1,this.showFigmaDemoModal=!1,this.staging=true,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this._isUserGlobalContact=!1,this.showQrCode=!1,this.customLoginEnabledLocally=null,this.customLoginEnabled=null,this.exitReviewModeCalled=!1,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),Hn("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const e=await(t=>{const e={apiKey:t};return De($n,"customLoginEnabled")(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),Hn("Error in checkCustomLoginEnabled: ",t)}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(yn("_sfut"),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),Hn("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),Hn("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Hn("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Hn("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),Hn("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),e=t.searchParams;if((null==e?void 0:e.has("sprojectInstall"))&&!Cn("sprojectInstall")?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==e?void 0:e.has("sflivedemo"))if(Cn("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(Cn("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=En(t,ft,wt),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=xn(e,ft,wt);mn("_sfut",i,!0)}}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,mn("snippyly-user",JSON.stringify(i),!0)}e.delete("st"),e.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}e.has("review")?(mn("review","true",!1),yn("feedback"),"true"!==e.get("review")&&(e.delete("review"),e.append("review","true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):e.has("feedback")||Cn("review",!1)&&(e.append("review","true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),e.has("feedback")?(mn("feedback","true",!1),yn("review"),"true"!==e.get("feedback")&&(e.delete("feedback"),e.append("feedback","true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):e.has("review")||Cn("feedback",!1)&&(e.append("feedback","true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t),Hn("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&&mn("projectVersion",this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has("review")||t.has("feedback"))&&t.has("sversion")&&(mn("projectVersionKey","sversion",!1,"sessionStorage"),this.projectVersion=t.get("sversion"),this.projectVersion&&mn("projectVersion",this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Hn("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||Cn("projectVersionKey",!1,"sessionStorage"),e=this.projectVersion||Cn("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),Hn("Error in setVersionInUrl: ",t)}},this.loadPluginUI=()=>{try{if(!this.apiKey)return;if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);const t=kn();if(t&&!(null==t?void 0:t.isAnonymous)&&(this.loading=!0),this.loadPlugin=!0,!document.querySelector(at)){const t=document.createElement(at);null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),window.document.body.appendChild(t)}if(!document.querySelector(ct)){const t=document.createElement(ct);t.setAttribute(vt,"true"),window.document.body.appendChild(t)}if(!document.querySelector(lt)){const t=document.createElement(lt);window.document.body.appendChild(t)}if(!document.querySelector(dt)){const t=document.createElement(dt);window.document.body.appendChild(t)}if(!document.querySelector(ht)){const t=document.createElement(ht);window.document.body.appendChild(t)}if(!document.querySelector(pt)){const t=document.createElement(pt);window.document.body.appendChild(t)}if(!document.querySelector(ut)){const t=document.createElement(ut);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Hn("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var t,i,o,n,s,r,l,a,c;try{if(await e(this.apiKey,{options:{staging:this.staging,version:this.staging?"1.0.43":"latest",velt:!0}}),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),Hn("Error in loadPoppinsFont: ",t)}})()}if(Snippyly&&Mn({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),Hn("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+"")),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.enableAttachment(!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.showDeviceInfo)&&this.commentElement.showDeviceInfo(!0),this.commentElement.showCommentIndex(!0),this.commentElement.addCommentModeChange&&this.commentElement.addCommentModeChange().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();const e=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;e&&"object"==typeof e&&(null===(r=this.commentElement)||void 0===r?void 0:r.setCustomStatuses)&&this.commentElement.setCustomStatuses(e)}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(l=this.rewriterElement)||void 0===l||l.enableRewriter()),this.presenceElement&&(null===(a=this.presenceElement)||void 0===a?void 0:a.enableFlockMode)&&(null===(c=this.presenceElement)||void 0===c||c.enableFlockMode(!0)),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Hn("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),Hn("Error in checkToEnableUpgradeButton: ",t)}},this.generateLocation=()=>{try{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),Hn("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),Hn("Error in generateLocation: ",t)}},this.setLocation=()=>{var t,e,i,o;try{if(window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)){if(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))),this.previousLocation=JSON.parse(JSON.stringify(this.location))}}catch(t){console.warn("Error in setLocation: ",t),Hn("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,e;try{this.invalidApiKey=!1;let e,i={name:"Anonymous User",email:"anonymous@snippyly.com",userId:"anonymous",isAnonymous:!0};e=this.customLoginEnabled&&this.providedUser?this.providedUser:kn(),(null==e?void 0:e.email)&&(i=e),i.isAnonymous?delete i.groupId:i.groupId=Snippyly.getDocumentId()+"",this.customLoginEnabledLocally||(null===(t=null==i?void 0:i.contacts)||void 0===t?void 0:t.length)&&(i.contacts=[]),(null==i?void 0:i.isAnonymous)||(this.loading=!0);const o=await Snippyly.identify(i);An(o),(null==i?void 0:i.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(i))),Snippyly.getUserRole$().subscribe((t=>{var e;this.loading=!1,this.snippylyUserRole||"Admin"!==t||this.setViewMode("All"),this.snippylyUserRole=t,this.snippylyUserRole||this.setViewMode(null),null===(e=this.commentElement)||void 0===e||e.enablePriority()})),(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),Hn("Error in isPlanExpired$: ",t)}))),Mn({clientUserId:null==i?void 0:i.userId}),this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{Cn("sfTourCommentTooltip")||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){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),console.warn("Error in identifySnippyly: ",t),Hn("Error in identifySnippyly: ",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)})),"All"!==this.viewMode&&(this.viewMode?this.comments=this.comments.filter((t=>{var e;return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.view)===this.viewMode})):this.comments=this.comments.filter((t=>{var e;return!(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.view)})))})))}catch(t){console.warn("Error in getComments: ",t),Hn("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),Hn("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Hn("Error in toggleSnippylyPluginToolbar: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading||this.customLoginEnabledLocally)return;window.open(`https://snippyly-self-serve-platform.web.app//signup?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Hn("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const e=xn(t,ft,wt),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),Hn("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),Hn("Error in toggleQRCodeVisibility: ",t)}},this.removeSnippyly=async()=>{try{this.exitReviewModeCalled=!0,yn("review"),yn("feedback"),yn("sreviewId"),yn("projectVersionKey","sessionStorage"),yn("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),Hn("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),yn("snippyly-user"),yn("_sfut"),this.snippylyUser=void 0,window.open(`https://snippyly-self-serve-platform.web.app//signout?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Hn("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),Hn("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),Hn("Error in copyLink: ",t)}},this.setViewMode=t=>{try{this.viewMode=t,t?this.location.view=t:delete this.location.view,this.setLocation(),this.getComments()}catch(t){console.warn("Error in setViewMode: ",t),Hn("Error in setViewMode: ",t)}},this.goToAdminPortal=()=>{try{let t="https://snippyly-self-serve-platform.web.app/";if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const e=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();e&&(t=`https://snippyly-self-serve-platform.web.app//dashboard/project/comment/${this.apiKey}/${e}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Hn("Error in goToAdminPortal: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1pdbjok4g-0sRhuBwPVC73eO9KVGDtag","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),Hn("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,mn("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),Hn("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,mn("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),Hn("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),Hn("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://snippyly-self-serve-platform.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Hn("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,mn("sfTourCommentTooltip","true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Hn("Error in onTourCommentTooltipClick: ",t)}},window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,yn("_sfut"),await this.checkCustomLoginEnabled()},identify:async t=>{this.providedUser=t,this.customLoginEnabled&&this.loginWithCustomUser()}};try{this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Hn("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){var e,i,o,n,s,r,l,a,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===(l=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.style)||void 0===l||l.setProperty("perspective","none","important"),null===(d=null===(c=null===(a=null===document||void 0===document?void 0:document.body)||void 0===a?void 0:a.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(),Mn({apiKey:this.apiKey}),this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&mn("projectVersionKey",this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Hn("Error in set projectVersionKey: ",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()}connectedCallback(){super.connectedCallback(),this.expanded=!0,this.setAttribute("data-velt-comment-disabled","true"),this.style.zIndex="2147483577",setTimeout((()=>{const t=document.querySelectorAll('script[src*="snippyly.min.js"]');(null==t?void 0:t.length)>1&&console.warn("Multiple superflow scripts installed.")}),1e3)}render(){var t,e,i,o,n,s,r,l,a;return this.loadPlugin?!this.snippylyUser||this.loading||null===this.isPlanExpired?D`
|
|
1325
1325
|
<div class="snippyly-plugin-container">
|
|
1326
1326
|
<div class="toolbar" id="smallToolbar">
|
|
1327
1327
|
<!-- <div class="toolbar-section">
|
package/superflow.min.js
CHANGED
|
@@ -1320,7 +1320,7 @@ class Hn extends ke{}Hn.Encryptor=class extends Hn{processBlock(t,i){const e=t,o
|
|
|
1320
1320
|
line-height: 1;
|
|
1321
1321
|
cursor: pointer;
|
|
1322
1322
|
}
|
|
1323
|
-
`;!function(){const t=()=>{try{let t=window.SUPERFLOW_TOOLBAR_API_KEY,i=!!window.SUPERFLOW_TOOLBAR_STAGING,e=window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,o=window.SUPERFLOW_TOOLBAR_PROJECT_ID;if(!t){const n=document.querySelector("snippyly-plugin");n&&(t=n.getAttribute("apiKey"),i=!!n.getAttribute("staging"),e=n.getAttribute("projectVersionKey"),o=n.getAttribute("projectId"),null==n||n.remove())}if(t){(()=>{try{document.querySelectorAll("superflow-toolbar").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const n={};n.apiKey=t,i&&(n.staging="true"),e&&(n.projectVersionKey=e),o&&(n.projectId=o),((t={})=>{try{const i=document.createElement("superflow-toolbar");Object.keys(t||{}).forEach((e=>{i.setAttribute(e,t[e])})),document.body.appendChild(i)}catch(t){console.warn("Error in loadSuperflowToolbarTag: ",t)}})(n)}}catch(t){console.warn("Error in initSuperflow: ",t)}};(null===document||void 0===document?void 0:document.body)?t():null===document||void 0===document||document.addEventListener("DOMContentLoaded",(()=>{t()}))}();var os=function(t,i,e,o){for(var n,s=arguments.length,r=s<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(s<3?n(r):s>3?n(i,e,r):n(i,e))||r);return s>3&&r&&Object.defineProperty(i,e,r),r};t.SuperflowToolbar=class extends Q{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this.showTourCommentTooltip=!1,this._expanded=!0,this.loading=!1,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!1,this.showFigmaDemoModal=!1,this.staging=true,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this._isUserGlobalContact=!1,this.showQrCode=!1,this.customLoginEnabledLocally=null,this.customLoginEnabled=null,this.exitReviewModeCalled=!1,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),Yn("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const i=await(t=>{const i={apiKey:t};return te(Kn,"customLoginEnabled")(i)})(this.apiKey);this.customLoginEnabled=!!(null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.customLoginEnabled),this.customLoginEnabled&&this.loginWithCustomUser()}catch(t){this.customLoginEnabled=!1,console.warn("Error in checkCustomLoginEnabled: ",t),Yn("Error in checkCustomLoginEnabled: ",t)}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(Nn(ut),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),Yn("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),Yn("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Yn("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Yn("Error in setWindowEventListner: ",t)}},this.urlChangeListener=()=>{try{const t=history.pushState;history.pushState=function(){const i=t.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),i};const i=history.replaceState;history.replaceState=function(){const t=i.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),Yn("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),i=t.searchParams;if((null==i?void 0:i.has(gt))&&!On(gt)?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==i?void 0:i.has(mt))if(On(mt,!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(mt),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showLiveDemoModal=!0;else this.showLiveDemoModal=!1;if(null==i?void 0:i.has(Ct))if(On(Ct,!1)){this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Ct),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showFigmaDemoModal=!0;else this.showFigmaDemoModal=!1;if(i.has(pt)||i.has("snippyly_google_token")){if(i.has(pt)){const t=decodeURIComponent(i.get(pt)),e=Pn(t,At,Ht),o=e&&JSON.parse(e);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 i=JSON.stringify(t),e=Rn(i,At,Ht);Un(ut,e,!0)}}else if(i.has("snippyly_google_token")){const t=JSON.parse(atob(i.get("snippyly_google_token"))),e={};e.userId=t.uid,e.name=t.displayName,e.email=t.email,e.photoUrl=null==t?void 0:t.photoURL,Un(dt,JSON.stringify(e),!0)}i.delete(pt),i.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}i.has(at)?(Un(at,"true",!1),Nn(ct),"true"!==i.get(at)&&(i.delete(at),i.append(at,"true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has(ct)||On(at,!1)&&(i.append(at,"true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),i.has(ct)?(Un(ct,"true",!1),Nn(at),"true"!==i.get(ct)&&(i.delete(ct),i.append(ct,"true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has(at)||On(ct,!1)&&(i.append(ct,"true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t),Yn("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&&Un(ft,this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has(at)||t.has(ct))&&t.has(wt)&&(Un(vt,wt,!1,"sessionStorage"),this.projectVersion=t.get(wt),this.projectVersion&&Un(ft,this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Yn("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||On(vt,!1,"sessionStorage"),i=this.projectVersion||On(ft,!1,"sessionStorage");if(t&&i){const e=new URL(document.location),o=e.searchParams;o.get(t)||(o.set(t,i),window.history.replaceState({},document.title,e.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),Yn("Error in setVersionInUrl: ",t)}},this.loadPluginUI=()=>{try{if(!this.apiKey)return;if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);const t=zn();if(t&&!(null==t?void 0:t.isAnonymous)&&(this.loading=!0),this.loadPlugin=!0,!document.querySelector(xt)){const t=document.createElement(xt);null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),window.document.body.appendChild(t)}if(!document.querySelector(Et)){const t=document.createElement(Et);t.setAttribute(Mt,"true"),window.document.body.appendChild(t)}if(!document.querySelector(bt)){const t=document.createElement(bt);window.document.body.appendChild(t)}if(!document.querySelector(kt)){const t=document.createElement(kt);window.document.body.appendChild(t)}if(!document.querySelector(St)){const t=document.createElement(St);window.document.body.appendChild(t)}if(!document.querySelector($t)){const t=document.createElement($t);window.document.body.appendChild(t)}if(!document.querySelector(Ft)){const t=document.createElement(Ft);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Yn("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var t,i,o,n,s,r,l,a,c;try{if(await e(this.apiKey,{options:{staging:this.staging,version:this.staging?"1.0.41":"latest",velt:!0}}),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),Yn("Error in loadPoppinsFont: ",t)}})()}if(Snippyly&&Gn({sdkVersion:null===Snippyly||void 0===Snippyly?void 0:Snippyly.version,sdkType:"client"}),this.documentId=((t,i=0)=>{try{let e=3735928559^i,o=1103547991^i;for(let i,n=0;n<t.length;n++)i=t.charCodeAt(n),e=Math.imul(e^i,2654435761),o=Math.imul(o^i,1597334677);return e=Math.imul(e^e>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),4294967296*(2097151&o)+(e>>>0)}catch(t){return console.warn("Error in cyrb53: ",t),Yn("Error in cyrb53: ",t),0}})((t=>{let i;return i=t.includes("http")?new URL(t):new URL("http://"+t),i.hostname.replace("www.","")})(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setDocumentId(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.enableAttachment(!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.showDeviceInfo)&&this.commentElement.showDeviceInfo(!0),this.commentElement.showCommentIndex(!0),this.commentElement.addCommentModeChange&&this.commentElement.addCommentModeChange().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();const e=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;e&&"object"==typeof e&&(null===(r=this.commentElement)||void 0===r?void 0:r.setCustomStatuses)&&this.commentElement.setCustomStatuses(e)}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(l=this.rewriterElement)||void 0===l||l.enableRewriter()),this.presenceElement&&(null===(a=this.presenceElement)||void 0===a?void 0:a.enableFlockMode)&&(null===(c=this.presenceElement)||void 0===c||c.enableFlockMode(!0)),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Yn("Error in initializeSnippyly: ",t)}},this.checkToEnableUpgradeButton=()=>{var t,i;try{this.isPlanExpired&&this.isUserGlobalContact?(null===(t=this.commentElement)||void 0===t?void 0:t.enableUpgradeButton)&&this.commentElement.enableUpgradeButton():(null===(i=this.commentElement)||void 0===i?void 0:i.disableUpgradeButton)&&this.commentElement.disableUpgradeButton()}catch(t){console.warn("Error in checkToEnableUpgradeButton: ",t),Yn("Error in checkToEnableUpgradeButton: ",t)}},this.generateLocation=()=>{try{const t=new URL(document.location).searchParams,i=new URL(document.location);i.searchParams.delete(at),i.searchParams.delete(ct),i.searchParams.delete(ht),i.searchParams.delete("scommentId"),i.searchParams.delete(gt),i.searchParams.delete(mt);const e=t.get(wt)||this.projectVersion;i.search="";let o=(t=>{try{return t.replace(/#.*$/,"")}catch(i){return console.warn("Error in removeHashFromUrl: ",i),Yn("Error in removeHashFromUrl: ",i),t}})(i.href);this.projectId&&(o=null==o?void 0:o.replace(window.location.origin,"")),this.location={url:o,version:e}}catch(t){console.warn("Error in generateLocation: ",t),Yn("Error in generateLocation: ",t)}},this.setLocation=()=>{var t,i,e,o;try{if(window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)){if(this.previousLocation&&(null===(t=this.previousLocation)||void 0===t?void 0:t.url)===(null===(i=this.location)||void 0===i?void 0:i.url)&&(null===(e=this.previousLocation)||void 0===e?void 0:e.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))),this.previousLocation=JSON.parse(JSON.stringify(this.location))}}catch(t){console.warn("Error in setLocation: ",t),Yn("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,i;try{this.invalidApiKey=!1;let i,e={name:"Anonymous User",email:"anonymous@snippyly.com",userId:"anonymous",isAnonymous:!0};i=this.customLoginEnabled&&this.providedUser?this.providedUser:zn(),(null==i?void 0:i.email)&&(e=i),e.isAnonymous?delete e.groupId:e.groupId=Snippyly.getDocumentId()+"",this.customLoginEnabledLocally||(null===(t=null==e?void 0:e.contacts)||void 0===t?void 0:t.length)&&(e.contacts=[]),(null==e?void 0:e.isAnonymous)||(this.loading=!0);const o=await Snippyly.identify(e);Xn(o),(null==e?void 0:e.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(e))),Snippyly.getUserRole$().subscribe((t=>{var i;this.loading=!1,this.snippylyUserRole||"Admin"!==t||this.setViewMode("All"),this.snippylyUserRole=t,this.snippylyUserRole||this.setViewMode(null),null===(i=this.commentElement)||void 0===i||i.enablePriority()})),(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),Yn("Error in isPlanExpired$: ",t)}))),Gn({clientUserId:null==e?void 0:e.userId}),this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{On(yt)||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){this.loading=!1,this.signInError=!0,t&&"string"==typeof t&&(null===(i=null==t?void 0:t.toLowerCase())||void 0===i?void 0:i.includes("invalid"))&&(this.invalidApiKey=!0),console.warn("Error in identifySnippyly: ",t),Yn("Error in identifySnippyly: ",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 i;return["open","inProgress"].includes(null==t?void 0:t.status)||["default","ongoing"].includes(null===(i=null==t?void 0:t.status)||void 0===i?void 0:i.type)})),"All"!==this.viewMode&&(this.viewMode?this.comments=this.comments.filter((t=>{var i;return(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)===this.viewMode})):this.comments=this.comments.filter((t=>{var i;return!(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)})))})))}catch(t){console.warn("Error in getComments: ",t),Yn("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),Yn("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Yn("Error in toggleSnippylyPluginToolbar: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading||this.customLoginEnabledLocally)return;window.open(`${Lt}/signup?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Yn("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const i=Rn(t,At,Ht),e=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getQRCode?text=${encodeURIComponent(i)}`),o=await e.json();(null==o?void 0:o.qrcode)&&(this.qrCode=null==o?void 0:o.qrcode)}}catch(t){console.warn("Error in getQRCode: ",t),Yn("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),Yn("Error in toggleQRCodeVisibility: ",t)}},this.removeSnippyly=async()=>{try{this.exitReviewModeCalled=!0,Nn(at),Nn(ct),Nn(ht),Nn(vt,"sessionStorage"),Nn(ft,"sessionStorage");const t=new URL(document.location),i=t.searchParams;i.delete(ht),i.delete(at),i.delete(ct),this.projectVersionKey&&i.delete(this.projectVersionKey),i.delete(wt),i.delete(gt),i.delete(mt),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),Yn("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),Nn(dt),Nn(ut),this.snippylyUser=void 0,window.open(`${Lt}/signout?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Yn("Error in signOutUser: ",t)}},this.toggleMenu=(t,i)=>{try{t.stopPropagation(),this.menuOpenedId===i?this.menuOpenedId=void 0:this.menuOpenedId=i}catch(t){console.warn("Error in toggleMenu: ",t),Yn("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),Yn("Error in copyLink: ",t)}},this.setViewMode=t=>{try{this.viewMode=t,t?this.location.view=t:delete this.location.view,this.setLocation(),this.getComments()}catch(t){console.warn("Error in setViewMode: ",t),Yn("Error in setViewMode: ",t)}},this.goToAdminPortal=()=>{try{let t=`${Lt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const i=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();i&&(t=`${Lt}/dashboard/project/comment/${this.apiKey}/${i}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Yn("Error in goToAdminPortal: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1pdbjok4g-0sRhuBwPVC73eO9KVGDtag","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),Yn("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Un(gt,"true");const t=new URL(document.location);t.searchParams.delete(gt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Yn("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Un(mt,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(mt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Yn("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Ct),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),Yn("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://snippyly-self-serve-platform.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Yn("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,Un(yt,"true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Yn("Error in onTourCommentTooltipClick: ",t)}},window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,Nn(ut),await this.checkCustomLoginEnabled()},identify:async t=>{this.providedUser=t,this.customLoginEnabled&&this.loginWithCustomUser()}};try{this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Yn("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){var i,e,o,n,s,r,l,a,c,h;this._loadPlugin=t,this.loadPlugin?(this.classList.add("visible"),null===(e=null===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.style)||void 0===e||e.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===(l=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.style)||void 0===l||l.setProperty("perspective","none","important"),null===(h=null===(c=null===(a=null===document||void 0===document?void 0:document.body)||void 0===a?void 0:a.parentElement)||void 0===c?void 0:c.style)||void 0===h||h.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(),Gn({apiKey:this.apiKey}),this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&Un(vt,this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Yn("Error in set projectVersionKey: ",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()}connectedCallback(){super.connectedCallback(),this.expanded=!0,this.setAttribute("data-velt-comment-disabled","true"),this.style.zIndex="2147483577",setTimeout((()=>{const t=document.querySelectorAll('script[src*="snippyly.min.js"]');(null==t?void 0:t.length)>1&&console.warn("Multiple superflow scripts installed.")}),1e3)}render(){var t,i,e,o,n,s,r,l,a;return this.loadPlugin?!this.snippylyUser||this.loading||null===this.isPlanExpired?_`
|
|
1323
|
+
`;!function(){const t=()=>{try{let t=window.SUPERFLOW_TOOLBAR_API_KEY,i=!!window.SUPERFLOW_TOOLBAR_STAGING,e=window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,o=window.SUPERFLOW_TOOLBAR_PROJECT_ID;if(!t){const n=document.querySelector("snippyly-plugin");n&&(t=n.getAttribute("apiKey"),i=!!n.getAttribute("staging"),e=n.getAttribute("projectVersionKey"),o=n.getAttribute("projectId"),null==n||n.remove())}if(t){(()=>{try{document.querySelectorAll("superflow-toolbar").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const n={};n.apiKey=t,i&&(n.staging="true"),e&&(n.projectVersionKey=e),o&&(n.projectId=o),((t={})=>{try{const i=document.createElement("superflow-toolbar");Object.keys(t||{}).forEach((e=>{i.setAttribute(e,t[e])})),document.body.appendChild(i)}catch(t){console.warn("Error in loadSuperflowToolbarTag: ",t)}})(n)}}catch(t){console.warn("Error in initSuperflow: ",t)}};(null===document||void 0===document?void 0:document.body)?t():null===document||void 0===document||document.addEventListener("DOMContentLoaded",(()=>{t()}))}();var os=function(t,i,e,o){for(var n,s=arguments.length,r=s<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(s<3?n(r):s>3?n(i,e,r):n(i,e))||r);return s>3&&r&&Object.defineProperty(i,e,r),r};t.SuperflowToolbar=class extends Q{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this.showTourCommentTooltip=!1,this._expanded=!0,this.loading=!1,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!1,this.showFigmaDemoModal=!1,this.staging=true,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this._isUserGlobalContact=!1,this.showQrCode=!1,this.customLoginEnabledLocally=null,this.customLoginEnabled=null,this.exitReviewModeCalled=!1,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),Yn("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const i=await(t=>{const i={apiKey:t};return te(Kn,"customLoginEnabled")(i)})(this.apiKey);this.customLoginEnabled=!!(null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.customLoginEnabled),this.customLoginEnabled&&this.loginWithCustomUser()}catch(t){this.customLoginEnabled=!1,console.warn("Error in checkCustomLoginEnabled: ",t),Yn("Error in checkCustomLoginEnabled: ",t)}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(Nn(ut),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),Yn("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),Yn("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Yn("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Yn("Error in setWindowEventListner: ",t)}},this.urlChangeListener=()=>{try{const t=history.pushState;history.pushState=function(){const i=t.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),i};const i=history.replaceState;history.replaceState=function(){const t=i.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),Yn("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),i=t.searchParams;if((null==i?void 0:i.has(gt))&&!On(gt)?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==i?void 0:i.has(mt))if(On(mt,!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(mt),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showLiveDemoModal=!0;else this.showLiveDemoModal=!1;if(null==i?void 0:i.has(Ct))if(On(Ct,!1)){this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Ct),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showFigmaDemoModal=!0;else this.showFigmaDemoModal=!1;if(i.has(pt)||i.has("snippyly_google_token")){if(i.has(pt)){const t=decodeURIComponent(i.get(pt)),e=Pn(t,At,Ht),o=e&&JSON.parse(e);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 i=JSON.stringify(t),e=Rn(i,At,Ht);Un(ut,e,!0)}}else if(i.has("snippyly_google_token")){const t=JSON.parse(atob(i.get("snippyly_google_token"))),e={};e.userId=t.uid,e.name=t.displayName,e.email=t.email,e.photoUrl=null==t?void 0:t.photoURL,Un(dt,JSON.stringify(e),!0)}i.delete(pt),i.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}i.has(at)?(Un(at,"true",!1),Nn(ct),"true"!==i.get(at)&&(i.delete(at),i.append(at,"true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has(ct)||On(at,!1)&&(i.append(at,"true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),i.has(ct)?(Un(ct,"true",!1),Nn(at),"true"!==i.get(ct)&&(i.delete(ct),i.append(ct,"true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has(at)||On(ct,!1)&&(i.append(ct,"true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t),Yn("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&&Un(ft,this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has(at)||t.has(ct))&&t.has(wt)&&(Un(vt,wt,!1,"sessionStorage"),this.projectVersion=t.get(wt),this.projectVersion&&Un(ft,this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Yn("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||On(vt,!1,"sessionStorage"),i=this.projectVersion||On(ft,!1,"sessionStorage");if(t&&i){const e=new URL(document.location),o=e.searchParams;o.get(t)||(o.set(t,i),window.history.replaceState({},document.title,e.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),Yn("Error in setVersionInUrl: ",t)}},this.loadPluginUI=()=>{try{if(!this.apiKey)return;if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);const t=zn();if(t&&!(null==t?void 0:t.isAnonymous)&&(this.loading=!0),this.loadPlugin=!0,!document.querySelector(xt)){const t=document.createElement(xt);null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),window.document.body.appendChild(t)}if(!document.querySelector(Et)){const t=document.createElement(Et);t.setAttribute(Mt,"true"),window.document.body.appendChild(t)}if(!document.querySelector(bt)){const t=document.createElement(bt);window.document.body.appendChild(t)}if(!document.querySelector(kt)){const t=document.createElement(kt);window.document.body.appendChild(t)}if(!document.querySelector(St)){const t=document.createElement(St);window.document.body.appendChild(t)}if(!document.querySelector($t)){const t=document.createElement($t);window.document.body.appendChild(t)}if(!document.querySelector(Ft)){const t=document.createElement(Ft);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Yn("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var t,i,o,n,s,r,l,a,c;try{if(await e(this.apiKey,{options:{staging:this.staging,version:this.staging?"1.0.43":"latest",velt:!0}}),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),Yn("Error in loadPoppinsFont: ",t)}})()}if(Snippyly&&Gn({sdkVersion:null===Snippyly||void 0===Snippyly?void 0:Snippyly.version,sdkType:"client"}),this.documentId=((t,i=0)=>{try{let e=3735928559^i,o=1103547991^i;for(let i,n=0;n<t.length;n++)i=t.charCodeAt(n),e=Math.imul(e^i,2654435761),o=Math.imul(o^i,1597334677);return e=Math.imul(e^e>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),4294967296*(2097151&o)+(e>>>0)}catch(t){return console.warn("Error in cyrb53: ",t),Yn("Error in cyrb53: ",t),0}})((t=>{let i;return i=t.includes("http")?new URL(t):new URL("http://"+t),i.hostname.replace("www.","")})(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setDocumentId(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.enableAttachment(!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.showDeviceInfo)&&this.commentElement.showDeviceInfo(!0),this.commentElement.showCommentIndex(!0),this.commentElement.addCommentModeChange&&this.commentElement.addCommentModeChange().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();const e=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;e&&"object"==typeof e&&(null===(r=this.commentElement)||void 0===r?void 0:r.setCustomStatuses)&&this.commentElement.setCustomStatuses(e)}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(l=this.rewriterElement)||void 0===l||l.enableRewriter()),this.presenceElement&&(null===(a=this.presenceElement)||void 0===a?void 0:a.enableFlockMode)&&(null===(c=this.presenceElement)||void 0===c||c.enableFlockMode(!0)),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Yn("Error in initializeSnippyly: ",t)}},this.checkToEnableUpgradeButton=()=>{var t,i;try{this.isPlanExpired&&this.isUserGlobalContact?(null===(t=this.commentElement)||void 0===t?void 0:t.enableUpgradeButton)&&this.commentElement.enableUpgradeButton():(null===(i=this.commentElement)||void 0===i?void 0:i.disableUpgradeButton)&&this.commentElement.disableUpgradeButton()}catch(t){console.warn("Error in checkToEnableUpgradeButton: ",t),Yn("Error in checkToEnableUpgradeButton: ",t)}},this.generateLocation=()=>{try{const t=new URL(document.location).searchParams,i=new URL(document.location);i.searchParams.delete(at),i.searchParams.delete(ct),i.searchParams.delete(ht),i.searchParams.delete("scommentId"),i.searchParams.delete(gt),i.searchParams.delete(mt);const e=t.get(wt)||this.projectVersion;i.search="";let o=(t=>{try{return t.replace(/#.*$/,"")}catch(i){return console.warn("Error in removeHashFromUrl: ",i),Yn("Error in removeHashFromUrl: ",i),t}})(i.href);this.projectId&&(o=null==o?void 0:o.replace(window.location.origin,"")),this.location={url:o,version:e}}catch(t){console.warn("Error in generateLocation: ",t),Yn("Error in generateLocation: ",t)}},this.setLocation=()=>{var t,i,e,o;try{if(window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)){if(this.previousLocation&&(null===(t=this.previousLocation)||void 0===t?void 0:t.url)===(null===(i=this.location)||void 0===i?void 0:i.url)&&(null===(e=this.previousLocation)||void 0===e?void 0:e.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))),this.previousLocation=JSON.parse(JSON.stringify(this.location))}}catch(t){console.warn("Error in setLocation: ",t),Yn("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,i;try{this.invalidApiKey=!1;let i,e={name:"Anonymous User",email:"anonymous@snippyly.com",userId:"anonymous",isAnonymous:!0};i=this.customLoginEnabled&&this.providedUser?this.providedUser:zn(),(null==i?void 0:i.email)&&(e=i),e.isAnonymous?delete e.groupId:e.groupId=Snippyly.getDocumentId()+"",this.customLoginEnabledLocally||(null===(t=null==e?void 0:e.contacts)||void 0===t?void 0:t.length)&&(e.contacts=[]),(null==e?void 0:e.isAnonymous)||(this.loading=!0);const o=await Snippyly.identify(e);Xn(o),(null==e?void 0:e.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(e))),Snippyly.getUserRole$().subscribe((t=>{var i;this.loading=!1,this.snippylyUserRole||"Admin"!==t||this.setViewMode("All"),this.snippylyUserRole=t,this.snippylyUserRole||this.setViewMode(null),null===(i=this.commentElement)||void 0===i||i.enablePriority()})),(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),Yn("Error in isPlanExpired$: ",t)}))),Gn({clientUserId:null==e?void 0:e.userId}),this.getComments(),this.checkGlobalUserContact(),setTimeout((()=>{On(yt)||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){this.loading=!1,this.signInError=!0,t&&"string"==typeof t&&(null===(i=null==t?void 0:t.toLowerCase())||void 0===i?void 0:i.includes("invalid"))&&(this.invalidApiKey=!0),console.warn("Error in identifySnippyly: ",t),Yn("Error in identifySnippyly: ",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 i;return["open","inProgress"].includes(null==t?void 0:t.status)||["default","ongoing"].includes(null===(i=null==t?void 0:t.status)||void 0===i?void 0:i.type)})),"All"!==this.viewMode&&(this.viewMode?this.comments=this.comments.filter((t=>{var i;return(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)===this.viewMode})):this.comments=this.comments.filter((t=>{var i;return!(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)})))})))}catch(t){console.warn("Error in getComments: ",t),Yn("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),Yn("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Yn("Error in toggleSnippylyPluginToolbar: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading||this.customLoginEnabledLocally)return;window.open(`${Lt}/signup?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Yn("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const i=Rn(t,At,Ht),e=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getQRCode?text=${encodeURIComponent(i)}`),o=await e.json();(null==o?void 0:o.qrcode)&&(this.qrCode=null==o?void 0:o.qrcode)}}catch(t){console.warn("Error in getQRCode: ",t),Yn("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),Yn("Error in toggleQRCodeVisibility: ",t)}},this.removeSnippyly=async()=>{try{this.exitReviewModeCalled=!0,Nn(at),Nn(ct),Nn(ht),Nn(vt,"sessionStorage"),Nn(ft,"sessionStorage");const t=new URL(document.location),i=t.searchParams;i.delete(ht),i.delete(at),i.delete(ct),this.projectVersionKey&&i.delete(this.projectVersionKey),i.delete(wt),i.delete(gt),i.delete(mt),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),Yn("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),Nn(dt),Nn(ut),this.snippylyUser=void 0,window.open(`${Lt}/signout?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Yn("Error in signOutUser: ",t)}},this.toggleMenu=(t,i)=>{try{t.stopPropagation(),this.menuOpenedId===i?this.menuOpenedId=void 0:this.menuOpenedId=i}catch(t){console.warn("Error in toggleMenu: ",t),Yn("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),Yn("Error in copyLink: ",t)}},this.setViewMode=t=>{try{this.viewMode=t,t?this.location.view=t:delete this.location.view,this.setLocation(),this.getComments()}catch(t){console.warn("Error in setViewMode: ",t),Yn("Error in setViewMode: ",t)}},this.goToAdminPortal=()=>{try{let t=`${Lt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const i=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();i&&(t=`${Lt}/dashboard/project/comment/${this.apiKey}/${i}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Yn("Error in goToAdminPortal: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1pdbjok4g-0sRhuBwPVC73eO9KVGDtag","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),Yn("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Un(gt,"true");const t=new URL(document.location);t.searchParams.delete(gt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Yn("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Un(mt,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(mt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Yn("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Ct),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),Yn("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://snippyly-self-serve-platform.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Yn("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,Un(yt,"true")}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),Yn("Error in onTourCommentTooltipClick: ",t)}},window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,Nn(ut),await this.checkCustomLoginEnabled()},identify:async t=>{this.providedUser=t,this.customLoginEnabled&&this.loginWithCustomUser()}};try{this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Yn("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){var i,e,o,n,s,r,l,a,c,h;this._loadPlugin=t,this.loadPlugin?(this.classList.add("visible"),null===(e=null===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.style)||void 0===e||e.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===(l=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.style)||void 0===l||l.setProperty("perspective","none","important"),null===(h=null===(c=null===(a=null===document||void 0===document?void 0:document.body)||void 0===a?void 0:a.parentElement)||void 0===c?void 0:c.style)||void 0===h||h.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(),Gn({apiKey:this.apiKey}),this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&Un(vt,this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Yn("Error in set projectVersionKey: ",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()}connectedCallback(){super.connectedCallback(),this.expanded=!0,this.setAttribute("data-velt-comment-disabled","true"),this.style.zIndex="2147483577",setTimeout((()=>{const t=document.querySelectorAll('script[src*="snippyly.min.js"]');(null==t?void 0:t.length)>1&&console.warn("Multiple superflow scripts installed.")}),1e3)}render(){var t,i,e,o,n,s,r,l,a;return this.loadPlugin?!this.snippylyUser||this.loading||null===this.isPlanExpired?_`
|
|
1324
1324
|
<div class="snippyly-plugin-container">
|
|
1325
1325
|
<div class="toolbar" id="smallToolbar">
|
|
1326
1326
|
<!-- <div class="toolbar-section">
|