@usesuperflow/toolbar-staging 1.0.9 → 1.0.10
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
|
@@ -1261,7 +1261,7 @@ class hn extends oi{}hn.Encryptor=class extends hn{processBlock(t,e){const i=t,o
|
|
|
1261
1261
|
line-height: 1;
|
|
1262
1262
|
cursor: pointer;
|
|
1263
1263
|
}
|
|
1264
|
-
`;!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._expanded=!0,this.loading=!1,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!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 _e(Ln,"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(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(ht)){const t=document.createElement(ht);window.document.body.appendChild(t)}if(!document.querySelector(dt)){const t=document.createElement(dt);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;try{if(await e(this.apiKey,{options:{staging:this.staging,version:"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&&$n({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();const e=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;e&&"object"==typeof e&&(null===(s=this.commentElement)||void 0===s?void 0:s.setCustomStatuses)&&this.commentElement.setCustomStatuses(e)}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(r=this.rewriterElement)||void 0===r||r.enableRewriter()),this.presenceElement&&(null===(l=this.presenceElement)||void 0===l?void 0:l.enableFlockMode)&&(null===(a=this.presenceElement)||void 0===a||a.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,i;this.loading=!1,this.snippylyUserRole||"Admin"!==t||this.setViewMode("All"),this.snippylyUserRole=t,this.snippylyUserRole||this.setViewMode(null),"Admin"===this.snippylyUserRole?null===(e=this.commentElement)||void 0===e||e.enablePriority():null===(i=this.commentElement)||void 0===i||i.disablePriority()})),(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)}))),$n({clientUserId:null==i?void 0:i.userId}),this.getComments(),this.checkGlobalUserContact()}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.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)}},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,h;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===(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(),$n({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?_`
|
|
1264
|
+
`;!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._expanded=!0,this.loading=!1,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!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 _e(Ln,"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(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(ht)){const t=document.createElement(ht);window.document.body.appendChild(t)}if(!document.querySelector(dt)){const t=document.createElement(dt);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;try{if(await e(this.apiKey,{options:{staging:this.staging,version:"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&&$n({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();const e=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;e&&"object"==typeof e&&(null===(s=this.commentElement)||void 0===s?void 0:s.setCustomStatuses)&&this.commentElement.setCustomStatuses(e)}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(r=this.rewriterElement)||void 0===r||r.enableRewriter()),this.presenceElement&&(null===(l=this.presenceElement)||void 0===l?void 0:l.enableFlockMode)&&(null===(a=this.presenceElement)||void 0===a||a.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)}))),$n({clientUserId:null==i?void 0:i.userId}),this.getComments(),this.checkGlobalUserContact()}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.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)}},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,h;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===(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(),$n({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?_`
|
|
1265
1265
|
<div class="snippyly-plugin-container">
|
|
1266
1266
|
<div class="toolbar" id="smallToolbar">
|
|
1267
1267
|
<!-- <div class="toolbar-section">
|
package/superflow.min.js
CHANGED
|
@@ -1260,7 +1260,7 @@ class Fn extends xe{}Fn.Encryptor=class extends Fn{processBlock(t,i){const e=t,o
|
|
|
1260
1260
|
line-height: 1;
|
|
1261
1261
|
cursor: pointer;
|
|
1262
1262
|
}
|
|
1263
|
-
`;!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 is=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._expanded=!0,this.loading=!1,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!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),Gn("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const i=await(t=>{const i={apiKey:t};return Yi(zn,"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),Gn("Error in checkCustomLoginEnabled: ",t)}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(Un(ut),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),Gn("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),Gn("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Gn("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Gn("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),Gn("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),i=t.searchParams;if((null==i?void 0:i.has(gt))&&!Zn(gt)?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==i?void 0:i.has(mt))if(Zn(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(i.has(pt)||i.has("snippyly_google_token")){if(i.has(pt)){const t=decodeURIComponent(i.get(pt)),e=Nn(t,Lt,Ft),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=jn(i,Lt,Ft);Tn(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,Tn(dt,JSON.stringify(e),!0)}i.delete(pt),i.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}i.has(at)?(Tn(at,"true",!1),Un(ct),"true"!==i.get(at)&&(i.delete(at),i.append(at,"true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has(ct)||Zn(at,!1)&&(i.append(at,"true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),i.has(ct)?(Tn(ct,"true",!1),Un(at),"true"!==i.get(ct)&&(i.delete(ct),i.append(ct,"true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has(at)||Zn(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),Gn("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&&Tn(ft,this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has(at)||t.has(ct))&&t.has(wt)&&(Tn(vt,wt,!1,"sessionStorage"),this.projectVersion=t.get(wt),this.projectVersion&&Tn(ft,this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Gn("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||Zn(vt,!1,"sessionStorage"),i=this.projectVersion||Zn(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),Gn("Error in setVersionInUrl: ",t)}},this.loadPluginUI=()=>{try{if(!this.apiKey)return;if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);const t=Rn();if(t&&!(null==t?void 0:t.isAnonymous)&&(this.loading=!0),this.loadPlugin=!0,!document.querySelector(yt)){const t=document.createElement(yt);null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),window.document.body.appendChild(t)}if(!document.querySelector(bt)){const t=document.createElement(bt);t.setAttribute($t,"true"),window.document.body.appendChild(t)}if(!document.querySelector(Ct)){const t=document.createElement(Ct);window.document.body.appendChild(t)}if(!document.querySelector(xt)){const t=document.createElement(xt);window.document.body.appendChild(t)}if(!document.querySelector(Et)){const t=document.createElement(Et);window.document.body.appendChild(t)}if(!document.querySelector(St)){const t=document.createElement(St);window.document.body.appendChild(t)}if(!document.querySelector(kt)){const t=document.createElement(kt);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Gn("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var t,i,o,n,s,r,l,a;try{if(await e(this.apiKey,{options:{staging:this.staging,version:"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),Gn("Error in loadPoppinsFont: ",t)}})()}if(Snippyly&&Jn({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),Gn("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();const e=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;e&&"object"==typeof e&&(null===(s=this.commentElement)||void 0===s?void 0:s.setCustomStatuses)&&this.commentElement.setCustomStatuses(e)}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(r=this.rewriterElement)||void 0===r||r.enableRewriter()),this.presenceElement&&(null===(l=this.presenceElement)||void 0===l?void 0:l.enableFlockMode)&&(null===(a=this.presenceElement)||void 0===a||a.enableFlockMode(!0)),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Gn("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),Gn("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),Gn("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),Gn("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),Gn("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:Rn(),(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);Wn(o),(null==e?void 0:e.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(e))),Snippyly.getUserRole$().subscribe((t=>{var i,e;this.loading=!1,this.snippylyUserRole||"Admin"!==t||this.setViewMode("All"),this.snippylyUserRole=t,this.snippylyUserRole||this.setViewMode(null),"Admin"===this.snippylyUserRole?null===(i=this.commentElement)||void 0===i||i.enablePriority():null===(e=this.commentElement)||void 0===e||e.disablePriority()})),(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),Gn("Error in isPlanExpired$: ",t)}))),Jn({clientUserId:null==e?void 0:e.userId}),this.getComments(),this.checkGlobalUserContact()}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),Gn("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),Gn("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),Gn("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Gn("Error in toggleSnippylyPluginToolbar: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading||this.customLoginEnabledLocally)return;window.open(`${Mt}/signup?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Gn("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const i=jn(t,Lt,Ft),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),Gn("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),Gn("Error in toggleQRCodeVisibility: ",t)}},this.removeSnippyly=async()=>{try{this.exitReviewModeCalled=!0,Un(at),Un(ct),Un(ht),Un(vt,"sessionStorage"),Un(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),Gn("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),Un(dt),Un(ut),this.snippylyUser=void 0,window.open(`${Mt}/signout?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Gn("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),Gn("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),Gn("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),Gn("Error in setViewMode: ",t)}},this.goToAdminPortal=()=>{try{let t=`${Mt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const i=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();i&&(t=`${Mt}/dashboard/project/comment/${this.apiKey}/${i}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Gn("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),Gn("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Tn(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),Gn("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Tn(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),Gn("Error in onLiveDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://snippyly-self-serve-platform.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Gn("Error in onUpgradePlanClick: ",t)}},window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,Un(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),Gn("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(),Jn({apiKey:this.apiKey}),this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&Tn(vt,this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Gn("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?D`
|
|
1263
|
+
`;!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 is=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._expanded=!0,this.loading=!1,this._isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!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),Gn("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const i=await(t=>{const i={apiKey:t};return Yi(zn,"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),Gn("Error in checkCustomLoginEnabled: ",t)}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(Un(ut),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),Gn("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),Gn("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Gn("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Gn("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),Gn("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),i=t.searchParams;if((null==i?void 0:i.has(gt))&&!Zn(gt)?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==i?void 0:i.has(mt))if(Zn(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(i.has(pt)||i.has("snippyly_google_token")){if(i.has(pt)){const t=decodeURIComponent(i.get(pt)),e=Nn(t,Lt,Ft),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=jn(i,Lt,Ft);Tn(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,Tn(dt,JSON.stringify(e),!0)}i.delete(pt),i.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}i.has(at)?(Tn(at,"true",!1),Un(ct),"true"!==i.get(at)&&(i.delete(at),i.append(at,"true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has(ct)||Zn(at,!1)&&(i.append(at,"true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),i.has(ct)?(Tn(ct,"true",!1),Un(at),"true"!==i.get(ct)&&(i.delete(ct),i.append(ct,"true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has(at)||Zn(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),Gn("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&&Tn(ft,this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has(at)||t.has(ct))&&t.has(wt)&&(Tn(vt,wt,!1,"sessionStorage"),this.projectVersion=t.get(wt),this.projectVersion&&Tn(ft,this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Gn("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||Zn(vt,!1,"sessionStorage"),i=this.projectVersion||Zn(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),Gn("Error in setVersionInUrl: ",t)}},this.loadPluginUI=()=>{try{if(!this.apiKey)return;if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);const t=Rn();if(t&&!(null==t?void 0:t.isAnonymous)&&(this.loading=!0),this.loadPlugin=!0,!document.querySelector(yt)){const t=document.createElement(yt);null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),window.document.body.appendChild(t)}if(!document.querySelector(bt)){const t=document.createElement(bt);t.setAttribute($t,"true"),window.document.body.appendChild(t)}if(!document.querySelector(Ct)){const t=document.createElement(Ct);window.document.body.appendChild(t)}if(!document.querySelector(xt)){const t=document.createElement(xt);window.document.body.appendChild(t)}if(!document.querySelector(Et)){const t=document.createElement(Et);window.document.body.appendChild(t)}if(!document.querySelector(St)){const t=document.createElement(St);window.document.body.appendChild(t)}if(!document.querySelector(kt)){const t=document.createElement(kt);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Gn("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var t,i,o,n,s,r,l,a;try{if(await e(this.apiKey,{options:{staging:this.staging,version:"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),Gn("Error in loadPoppinsFont: ",t)}})()}if(Snippyly&&Jn({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),Gn("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();const e=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;e&&"object"==typeof e&&(null===(s=this.commentElement)||void 0===s?void 0:s.setCustomStatuses)&&this.commentElement.setCustomStatuses(e)}this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(r=this.rewriterElement)||void 0===r||r.enableRewriter()),this.presenceElement&&(null===(l=this.presenceElement)||void 0===l?void 0:l.enableFlockMode)&&(null===(a=this.presenceElement)||void 0===a||a.enableFlockMode(!0)),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Gn("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),Gn("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),Gn("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),Gn("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),Gn("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:Rn(),(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);Wn(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),Gn("Error in isPlanExpired$: ",t)}))),Jn({clientUserId:null==e?void 0:e.userId}),this.getComments(),this.checkGlobalUserContact()}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),Gn("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),Gn("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),Gn("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Gn("Error in toggleSnippylyPluginToolbar: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading||this.customLoginEnabledLocally)return;window.open(`${Mt}/signup?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Gn("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const i=jn(t,Lt,Ft),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),Gn("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),Gn("Error in toggleQRCodeVisibility: ",t)}},this.removeSnippyly=async()=>{try{this.exitReviewModeCalled=!0,Un(at),Un(ct),Un(ht),Un(vt,"sessionStorage"),Un(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),Gn("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),Un(dt),Un(ut),this.snippylyUser=void 0,window.open(`${Mt}/signout?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Gn("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),Gn("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),Gn("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),Gn("Error in setViewMode: ",t)}},this.goToAdminPortal=()=>{try{let t=`${Mt}`;if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const i=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();i&&(t=`${Mt}/dashboard/project/comment/${this.apiKey}/${i}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Gn("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),Gn("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Tn(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),Gn("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Tn(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),Gn("Error in onLiveDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://snippyly-self-serve-platform.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Gn("Error in onUpgradePlanClick: ",t)}},window.Superflow={enableCustomLogin:async()=>{this.customLoginEnabledLocally=!0,Un(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),Gn("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(),Jn({apiKey:this.apiKey}),this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&Tn(vt,this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Gn("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?D`
|
|
1264
1264
|
<div class="snippyly-plugin-container">
|
|
1265
1265
|
<div class="toolbar" id="smallToolbar">
|
|
1266
1266
|
<!-- <div class="toolbar-section">
|