pushfeedback 0.1.62 → 0.1.63

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.
@@ -60,7 +60,7 @@ const FeedbackButton = class {
60
60
  const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
61
61
  let adjustement = 0;
62
62
  if (this.isSafariBrowser()) {
63
- adjustement = 10;
63
+ adjustement = 5;
64
64
  }
65
65
  buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
66
66
  }
@@ -50,7 +50,7 @@ export class FeedbackButton {
50
50
  const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
51
51
  let adjustement = 0;
52
52
  if (this.isSafariBrowser()) {
53
- adjustement = 10;
53
+ adjustement = 5;
54
54
  }
55
55
  buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
56
56
  }
@@ -59,7 +59,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
59
59
  const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
60
60
  let adjustement = 0;
61
61
  if (this.isSafariBrowser()) {
62
- adjustement = 10;
62
+ adjustement = 5;
63
63
  }
64
64
  buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
65
65
  }
@@ -56,7 +56,7 @@ const FeedbackButton = class {
56
56
  const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
57
57
  let adjustement = 0;
58
58
  if (this.isSafariBrowser()) {
59
- adjustement = 10;
59
+ adjustement = 5;
60
60
  }
61
61
  buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
62
62
  }
@@ -1,4 +1,4 @@
1
- import{r as A,c as e,h as t,H as B,g as r}from"./p-af2a1f7f.js";const n=class{constructor(t){A(this,t),this.feedbackSent=e(this,"feedbackSent",7),this.feedbackError=e(this,"feedbackError",7),this.sessionId="",this.customFont=!1,this.errorMessage="Please try again later.",this.errorMessage403="The request URL does not match the one defined in PushFeedback for this project.",this.errorMessage404="We could not find the provided project id in PushFeedback.",this.modalTitle="Share your feedback",this.modalTitleSuccess="Thanks for your feedback!",this.modalTitleError="Oops!",this.modalPosition="center",this.sendButtonText="Send",this.successMessage="",this.project="",this.screenshotButtonText="Add a screenshot",this.screenshotTopbarText="Select an element on this page",this.hideEmail=!1,this.emailAddress="",this.emailPlaceholder="Email address (optional)",this.messagePlaceholder="Comments",this.hideRating=!1,this.rating=void 0,this.ratingMode="thumbs",this.ratingPlaceholder="Was this page helpful?",this.ratingStarsPlaceholder="How would you rate this page?",this.footerText="",this.buttonStyle="default",this.buttonPosition="default",this.hideIcon=!1,this.hideScreenshotButton=!1,this.hidePrivacyPolicy=!0,this.hideMobile=!1,this.privacyPolicyText="I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.",this.fetchData=!0,this.submit=!1}componentWillLoad(){if(!this.sessionId){let A=localStorage.getItem("pushfeedback_sessionid");A||(A=this.generateRandomSessionId(),localStorage.setItem("pushfeedback_sessionid",A),this.sessionId=A)}}componentDidLoad(){if("center-right"===this.buttonPosition){const A=this.el.shadowRoot.querySelector(".feedback-button-content");let e=0;this.isSafariBrowser()&&(e=10),A.style.right=(A.offsetWidth+e)/2*-1+"px"}this.customFont||this.loadInterFont()}connectedCallback(){this.feedbackModal=document.createElement("feedback-modal"),["customFont","errorMessage","errorMessage403","errorMessage404","modalTitle","modalTitleSuccess","modalTitleError","modalPosition","sendButtonText","successMessage","project","screenshotButtonText","screenshotTopbarText","hideEmail","emailAddress","emailPlaceholder","messagePlaceholder","hideRating","rating","ratingMode","ratingPlaceholder","ratingStarsPlaceholder","footerText","hideScreenshotButton","hidePrivacyPolicy","privacyPolicyText","fetchData"].forEach((A=>{this.feedbackModal[A]=this[A]})),document.body.appendChild(this.feedbackModal)}disconnectedCallback(){document.body.removeChild(this.feedbackModal)}generateRandomSessionId(A=16){return Math.random().toString(36).substr(2,A)}isSafariBrowser(){return/safari/i.test(navigator.userAgent)&&!/chrome/i.test(navigator.userAgent)}loadInterFont(){const A=document.createElement("link");A.href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap",A.rel="stylesheet",document.head.appendChild(A)}showModal(){this.submit?this.submitRatingFeedback():this.feedbackModal.openModal()}async submitRatingFeedback(){try{const A={url:window.location.href,project:this.project,rating:this.rating||-1,ratingMode:this.ratingMode,message:"",session:localStorage.getItem("pushfeedback_sessionid")||""},e=await fetch("https://app.pushfeedback.com/api/feedback/",{method:"POST",body:JSON.stringify(A),headers:{"Content-Type":"application/json"}});if(201===e.status){const t=Object.assign(Object.assign({},A),{id:await e.json()});this.feedbackSent.emit({feedback:t})}else{const A=await e.text();this.feedbackError.emit({error:{status:e.status,message:A}})}}catch(A){this.feedbackError.emit({error:{status:500,message:A}})}}render(){return t(B,null,t("a",{class:`feedback-button-content feedback-button-content--${this.buttonStyle} feedback-button-content--${this.buttonPosition} ${this.customFont?"feedback-button-content--custom-font":""} ${this.hideMobile?"feedback-button-content--hide-mobile":""}`,onClick:()=>this.showModal()},!this.hideIcon&&"default"!=this.buttonStyle&&t("span",{class:"feedback-button-content-icon"},t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#fff","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon-edit"},t("path",{d:"M12 20h9"}),t("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"}))),t("slot",null)))}get el(){return r(this)}};n.style=".feedback-button-content{cursor:pointer;max-width:fit-content;z-index:var(--feedback-button-z-index);font-family:var(--feedback-font-family)}.feedback-button-content--custom-font{font-family:inherit}.feedback-button-content--light{align-items:center;background-color:var(--feedback-button-light-bg-color);border-radius:var(--feedback-button-border-radius);box-shadow:rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;box-sizing:border-box;color:var(--feedback-button-light-text-color);display:flex;font-size:var(--feedback-button-text-font-size);font-weight:var(--feedback-button-text-font-weight);padding:8px 15px}.feedback-button-content--dark{align-items:center;background-color:var(--feedback-button-dark-bg-color);border-radius:var(--feedback-button-border-radius);box-shadow:rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;box-sizing:border-box;color:var(--feedback-button-dark-text-color);display:flex;font-weight:var(--feedback-button-text-font-weight);font-size:var(--feedback-button-text-font-size);padding:8px 15px}.icon-edit{stroke:var(--feedback-button-light-icon-color)}.feedback-button-content--dark .icon-edit{stroke:var(--feedback-button-dark-icon-color)}.feedback-button-content--bottom-right{bottom:10px;position:fixed;right:10px}.feedback-button-content--center-right{position:fixed;transform:rotate(-90deg) translateY(-50%);top:50%}.feedback-button-content--center-right.feedback-button-content--dark,.feedback-button-content--center-right.feedback-button-content--light{border-radius:4px;border-bottom-left-radius:0px;border-bottom-right-radius:0px}.feedback-button-content-icon{height:16px;margin-right:5px;width:16px}.feedback-button-content--center-right .feedback-button-content-icon{rotate:90deg}@media screen and (max-width: 767px){.feedback-button-content--hide-mobile{display:none}}","undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var s,i,Q=(s=function(A){
1
+ import{r as A,c as e,h as t,H as B,g as r}from"./p-af2a1f7f.js";const n=class{constructor(t){A(this,t),this.feedbackSent=e(this,"feedbackSent",7),this.feedbackError=e(this,"feedbackError",7),this.sessionId="",this.customFont=!1,this.errorMessage="Please try again later.",this.errorMessage403="The request URL does not match the one defined in PushFeedback for this project.",this.errorMessage404="We could not find the provided project id in PushFeedback.",this.modalTitle="Share your feedback",this.modalTitleSuccess="Thanks for your feedback!",this.modalTitleError="Oops!",this.modalPosition="center",this.sendButtonText="Send",this.successMessage="",this.project="",this.screenshotButtonText="Add a screenshot",this.screenshotTopbarText="Select an element on this page",this.hideEmail=!1,this.emailAddress="",this.emailPlaceholder="Email address (optional)",this.messagePlaceholder="Comments",this.hideRating=!1,this.rating=void 0,this.ratingMode="thumbs",this.ratingPlaceholder="Was this page helpful?",this.ratingStarsPlaceholder="How would you rate this page?",this.footerText="",this.buttonStyle="default",this.buttonPosition="default",this.hideIcon=!1,this.hideScreenshotButton=!1,this.hidePrivacyPolicy=!0,this.hideMobile=!1,this.privacyPolicyText="I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.",this.fetchData=!0,this.submit=!1}componentWillLoad(){if(!this.sessionId){let A=localStorage.getItem("pushfeedback_sessionid");A||(A=this.generateRandomSessionId(),localStorage.setItem("pushfeedback_sessionid",A),this.sessionId=A)}}componentDidLoad(){if("center-right"===this.buttonPosition){const A=this.el.shadowRoot.querySelector(".feedback-button-content");let e=0;this.isSafariBrowser()&&(e=5),A.style.right=(A.offsetWidth+e)/2*-1+"px"}this.customFont||this.loadInterFont()}connectedCallback(){this.feedbackModal=document.createElement("feedback-modal"),["customFont","errorMessage","errorMessage403","errorMessage404","modalTitle","modalTitleSuccess","modalTitleError","modalPosition","sendButtonText","successMessage","project","screenshotButtonText","screenshotTopbarText","hideEmail","emailAddress","emailPlaceholder","messagePlaceholder","hideRating","rating","ratingMode","ratingPlaceholder","ratingStarsPlaceholder","footerText","hideScreenshotButton","hidePrivacyPolicy","privacyPolicyText","fetchData"].forEach((A=>{this.feedbackModal[A]=this[A]})),document.body.appendChild(this.feedbackModal)}disconnectedCallback(){document.body.removeChild(this.feedbackModal)}generateRandomSessionId(A=16){return Math.random().toString(36).substr(2,A)}isSafariBrowser(){return/safari/i.test(navigator.userAgent)&&!/chrome/i.test(navigator.userAgent)}loadInterFont(){const A=document.createElement("link");A.href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap",A.rel="stylesheet",document.head.appendChild(A)}showModal(){this.submit?this.submitRatingFeedback():this.feedbackModal.openModal()}async submitRatingFeedback(){try{const A={url:window.location.href,project:this.project,rating:this.rating||-1,ratingMode:this.ratingMode,message:"",session:localStorage.getItem("pushfeedback_sessionid")||""},e=await fetch("https://app.pushfeedback.com/api/feedback/",{method:"POST",body:JSON.stringify(A),headers:{"Content-Type":"application/json"}});if(201===e.status){const t=Object.assign(Object.assign({},A),{id:await e.json()});this.feedbackSent.emit({feedback:t})}else{const A=await e.text();this.feedbackError.emit({error:{status:e.status,message:A}})}}catch(A){this.feedbackError.emit({error:{status:500,message:A}})}}render(){return t(B,null,t("a",{class:`feedback-button-content feedback-button-content--${this.buttonStyle} feedback-button-content--${this.buttonPosition} ${this.customFont?"feedback-button-content--custom-font":""} ${this.hideMobile?"feedback-button-content--hide-mobile":""}`,onClick:()=>this.showModal()},!this.hideIcon&&"default"!=this.buttonStyle&&t("span",{class:"feedback-button-content-icon"},t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#fff","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon-edit"},t("path",{d:"M12 20h9"}),t("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"}))),t("slot",null)))}get el(){return r(this)}};n.style=".feedback-button-content{cursor:pointer;max-width:fit-content;z-index:var(--feedback-button-z-index);font-family:var(--feedback-font-family)}.feedback-button-content--custom-font{font-family:inherit}.feedback-button-content--light{align-items:center;background-color:var(--feedback-button-light-bg-color);border-radius:var(--feedback-button-border-radius);box-shadow:rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;box-sizing:border-box;color:var(--feedback-button-light-text-color);display:flex;font-size:var(--feedback-button-text-font-size);font-weight:var(--feedback-button-text-font-weight);padding:8px 15px}.feedback-button-content--dark{align-items:center;background-color:var(--feedback-button-dark-bg-color);border-radius:var(--feedback-button-border-radius);box-shadow:rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;box-sizing:border-box;color:var(--feedback-button-dark-text-color);display:flex;font-weight:var(--feedback-button-text-font-weight);font-size:var(--feedback-button-text-font-size);padding:8px 15px}.icon-edit{stroke:var(--feedback-button-light-icon-color)}.feedback-button-content--dark .icon-edit{stroke:var(--feedback-button-dark-icon-color)}.feedback-button-content--bottom-right{bottom:10px;position:fixed;right:10px}.feedback-button-content--center-right{position:fixed;transform:rotate(-90deg) translateY(-50%);top:50%}.feedback-button-content--center-right.feedback-button-content--dark,.feedback-button-content--center-right.feedback-button-content--light{border-radius:4px;border-bottom-left-radius:0px;border-bottom-right-radius:0px}.feedback-button-content-icon{height:16px;margin-right:5px;width:16px}.feedback-button-content--center-right .feedback-button-content-icon{rotate:90deg}@media screen and (max-width: 767px){.feedback-button-content--hide-mobile{display:none}}","undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var s,i,Q=(s=function(A){
2
2
  /*!
3
3
  * html2canvas-pro 1.5.8 <https://yorickshan.github.io/html2canvas-pro/>
4
4
  * Copyright (c) 2024 yorickshan <https://github.com/yorickshan>
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-af2a1f7f.js";export{s as setNonce}from"./p-af2a1f7f.js";(()=>{const t=import.meta.url,o={};return""!==t&&(o.resourcesUrl=new URL(".",t).href),e(o)})().then((e=>t([["p-c1607f8d",[[1,"feedback-button",{sessionId:[1537,"session-id"],customFont:[4,"custom-font"],errorMessage:[1,"error-message"],errorMessage403:[1,"error-message-4-0-3"],errorMessage404:[1,"error-message-4-0-4"],modalTitle:[1,"modal-title"],modalTitleSuccess:[1,"modal-title-success"],modalTitleError:[1,"modal-title-error"],modalPosition:[1,"modal-position"],sendButtonText:[1,"send-button-text"],successMessage:[1,"success-message"],project:[1],screenshotButtonText:[1,"screenshot-button-text"],screenshotTopbarText:[1,"screenshot-topbar-text"],hideEmail:[4,"hide-email"],emailAddress:[1,"email-address"],emailPlaceholder:[1,"email-placeholder"],messagePlaceholder:[1,"message-placeholder"],hideRating:[4,"hide-rating"],rating:[2],ratingMode:[1,"rating-mode"],ratingPlaceholder:[1,"rating-placeholder"],ratingStarsPlaceholder:[1,"rating-stars-placeholder"],footerText:[1,"footer-text"],buttonStyle:[1,"button-style"],buttonPosition:[1,"button-position"],hideIcon:[4,"hide-icon"],hideScreenshotButton:[4,"hide-screenshot-button"],hidePrivacyPolicy:[4,"hide-privacy-policy"],hideMobile:[4,"hide-mobile"],privacyPolicyText:[1,"privacy-policy-text"],fetchData:[4,"fetch-data"],submit:[4]}],[1,"feedback-modal",{customFont:[4,"custom-font"],errorMessage:[1,"error-message"],errorMessage403:[1,"error-message-4-0-3"],errorMessage404:[1,"error-message-4-0-4"],modalTitle:[1,"modal-title"],modalTitleSuccess:[1,"modal-title-success"],modalTitleError:[1,"modal-title-error"],modalPosition:[1,"modal-position"],sendButtonText:[1,"send-button-text"],successMessage:[1,"success-message"],project:[1],screenshotButtonText:[1,"screenshot-button-text"],screenshotTopbarText:[1,"screenshot-topbar-text"],hideEmail:[4,"hide-email"],emailAddress:[1,"email-address"],emailPlaceholder:[1,"email-placeholder"],messagePlaceholder:[1,"message-placeholder"],hideRating:[4,"hide-rating"],rating:[2],ratingMode:[1,"rating-mode"],ratingPlaceholder:[1,"rating-placeholder"],ratingStarsPlaceholder:[1,"rating-stars-placeholder"],footerText:[1,"footer-text"],showModal:[1540,"show-modal"],showScreenshotMode:[1540,"show-screenshot-mode"],showScreenshotTopBar:[1540,"show-screenshot-top-bar"],hasSelectedElement:[1540,"has-selected-element"],hideScreenshotButton:[4,"hide-screenshot-button"],hidePrivacyPolicy:[4,"hide-privacy-policy"],privacyPolicyText:[1,"privacy-policy-text"],fetchData:[4,"fetch-data"],sending:[32],formMessage:[32],formEmail:[32],formSuccess:[32],formVerification:[32],formError:[32],formErrorStatus:[32],encodedScreenshot:[32],isPrivacyChecked:[32],whitelabel:[32],selectedRating:[32],overlayVisible:[32],isAnimating:[32],openModal:[64]}]]]],e)));
1
+ import{p as e,b as t}from"./p-af2a1f7f.js";export{s as setNonce}from"./p-af2a1f7f.js";(()=>{const t=import.meta.url,o={};return""!==t&&(o.resourcesUrl=new URL(".",t).href),e(o)})().then((e=>t([["p-90a99a78",[[1,"feedback-button",{sessionId:[1537,"session-id"],customFont:[4,"custom-font"],errorMessage:[1,"error-message"],errorMessage403:[1,"error-message-4-0-3"],errorMessage404:[1,"error-message-4-0-4"],modalTitle:[1,"modal-title"],modalTitleSuccess:[1,"modal-title-success"],modalTitleError:[1,"modal-title-error"],modalPosition:[1,"modal-position"],sendButtonText:[1,"send-button-text"],successMessage:[1,"success-message"],project:[1],screenshotButtonText:[1,"screenshot-button-text"],screenshotTopbarText:[1,"screenshot-topbar-text"],hideEmail:[4,"hide-email"],emailAddress:[1,"email-address"],emailPlaceholder:[1,"email-placeholder"],messagePlaceholder:[1,"message-placeholder"],hideRating:[4,"hide-rating"],rating:[2],ratingMode:[1,"rating-mode"],ratingPlaceholder:[1,"rating-placeholder"],ratingStarsPlaceholder:[1,"rating-stars-placeholder"],footerText:[1,"footer-text"],buttonStyle:[1,"button-style"],buttonPosition:[1,"button-position"],hideIcon:[4,"hide-icon"],hideScreenshotButton:[4,"hide-screenshot-button"],hidePrivacyPolicy:[4,"hide-privacy-policy"],hideMobile:[4,"hide-mobile"],privacyPolicyText:[1,"privacy-policy-text"],fetchData:[4,"fetch-data"],submit:[4]}],[1,"feedback-modal",{customFont:[4,"custom-font"],errorMessage:[1,"error-message"],errorMessage403:[1,"error-message-4-0-3"],errorMessage404:[1,"error-message-4-0-4"],modalTitle:[1,"modal-title"],modalTitleSuccess:[1,"modal-title-success"],modalTitleError:[1,"modal-title-error"],modalPosition:[1,"modal-position"],sendButtonText:[1,"send-button-text"],successMessage:[1,"success-message"],project:[1],screenshotButtonText:[1,"screenshot-button-text"],screenshotTopbarText:[1,"screenshot-topbar-text"],hideEmail:[4,"hide-email"],emailAddress:[1,"email-address"],emailPlaceholder:[1,"email-placeholder"],messagePlaceholder:[1,"message-placeholder"],hideRating:[4,"hide-rating"],rating:[2],ratingMode:[1,"rating-mode"],ratingPlaceholder:[1,"rating-placeholder"],ratingStarsPlaceholder:[1,"rating-stars-placeholder"],footerText:[1,"footer-text"],showModal:[1540,"show-modal"],showScreenshotMode:[1540,"show-screenshot-mode"],showScreenshotTopBar:[1540,"show-screenshot-top-bar"],hasSelectedElement:[1540,"has-selected-element"],hideScreenshotButton:[4,"hide-screenshot-button"],hidePrivacyPolicy:[4,"hide-privacy-policy"],privacyPolicyText:[1,"privacy-policy-text"],fetchData:[4,"fetch-data"],sending:[32],formMessage:[32],formEmail:[32],formSuccess:[32],formVerification:[32],formError:[32],formErrorStatus:[32],encodedScreenshot:[32],isPrivacyChecked:[32],whitelabel:[32],selectedRating:[32],overlayVisible:[32],isAnimating:[32],openModal:[64]}]]]],e)));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "pushfeedback",
3
3
  "author": "TechDocs Studio <hi@techdocs.studio>",
4
4
  "homepage": "https://pushfeedback.com/",
5
- "version": "0.1.62",
5
+ "version": "0.1.63",
6
6
  "description": "Feedback widget for websites.",
7
7
  "main": "dist/index.cjs.js",
8
8
  "module": "dist/index.js",