fs-feedback-creator
Advanced tools
Comparing version 2.0.8 to 2.0.9
@@ -1,3 +0,3 @@ | ||
import { FeedbackResource } from "./resources/feedback.resource"; | ||
import { ResponseResource } from "./resources/response.resource"; | ||
import { FeedbackResource } from './resources/feedback.resource'; | ||
import { ResponseResource } from './resources/response.resource'; | ||
export declare class FeedbackCreator { | ||
@@ -13,3 +13,4 @@ language_map: Map<any, any>; | ||
animationValue: string; | ||
constructor(fb: FeedbackResource, parentElement: HTMLElement); | ||
elementsPosition: string; | ||
constructor(fb: FeedbackResource, parentElement: HTMLElement, position: string); | ||
setFbData(data: FeedbackResource): void; | ||
@@ -16,0 +17,0 @@ renderButton(): void; |
export class FeedbackCreator { | ||
constructor(fb, parentElement) { | ||
constructor(fb, parentElement, position) { | ||
this.language_map = new Map(); | ||
@@ -7,12 +7,16 @@ this.style_map = new Map(); | ||
this.trianglePosition = new Map(); | ||
this.textColor = ""; | ||
this.root = document.createElement("div"); | ||
this.responseData = { reactionType: 1, comment: "", email: "" }; | ||
this.textColor = ''; | ||
this.root = document.createElement('div'); | ||
this.responseData = { reactionType: 1, comment: '', email: '' }; | ||
this.elementsPosition = ''; | ||
this.fb = fb; | ||
this.root.id = "fb-root"; | ||
this.elementsPosition = 'position: ' + position; | ||
this.root.id = 'fb-root' + this.fb.id.toString(); | ||
if (typeof parentElement === 'undefined' || parentElement === null) { | ||
document.body.appendChild(this.root); | ||
console.log('body'); | ||
} | ||
else { | ||
parentElement.appendChild(this.root); | ||
console.log('parent element'); | ||
} | ||
@@ -28,18 +32,19 @@ this.setMapsValues(); | ||
return; | ||
this.responseData.comment = ""; | ||
this.responseData.comment = ''; | ||
if (this.fb.wgAlternateColor == true) | ||
this.textColor = "white"; | ||
this.textColor = 'white'; | ||
else | ||
this.textColor = "black"; | ||
if (this.fb.wgPosition == "0" || "2") | ||
this.animationValue = "0%{transform: translate(500px)}"; | ||
this.textColor = 'black'; | ||
if (this.fb.wgPosition == '0' || '2') | ||
this.animationValue = '0%{transform: translate(500px)}'; | ||
else | ||
this.animationValue = "0%{transform: translate(-500px)}"; | ||
this.animationValue = '0%{transform: translate(-500px)}'; | ||
const html = ` | ||
<div id="feedbackButton" title="Give feedback"> | ||
<div id="iconContainer"> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" id="widgetButtonIcon"> <g fill="none" fill-rule="evenodd"> <g fill="${this.textColor}" fill-rule="nonzero"> <g transform="translate(-198 -779) translate(198 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z" /> <circle cx="7" cy="9" r="1" /> <circle cx="15" cy="9" r="1" /> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" /> </g> </g> </g> </svg> | ||
<div id="feedbackButton${this.fb.id.toString()}" title="Give feedback"> | ||
<div id="iconContainer${this.fb.id.toString()}"> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" id="widgetButtonIcon${this.fb.id.toString()}"> <g fill="none" fill-rule="evenodd"> <g fill="${this | ||
.textColor}" fill-rule="nonzero"> <g transform="translate(-198 -779) translate(198 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z" /> <circle cx="7" cy="9" r="1" /> <circle cx="15" cy="9" r="1" /> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" /> </g> </g> </g> </svg> | ||
</div> | ||
<div id="widgetButtonTextContainer"> | ||
<p id="widgetButtonText">${this.language_map.get(this.fb.wgLanguage)}</p> | ||
<div id="widgetButtonTextContainer${this.fb.id.toString()}"> | ||
<p id="widgetButtonText${this.fb.id.toString()}">${this.language_map.get(this.fb.wgLanguage)}</p> | ||
</div> | ||
@@ -49,5 +54,8 @@ </div> | ||
this.root.innerHTML = html; | ||
this.root.style.cssText = "position: fixed; width: 100%; display: flex; transform: translate(0, -50%);" + this.style_map.get(this.fb.wgPosition); | ||
const button = document.getElementById("feedbackButton"); | ||
button.addEventListener("click", () => { | ||
this.root.style.cssText = | ||
'width: 100%; display: flex; transform: translate(0, -50%);' + | ||
this.style_map.get(this.fb.wgPosition) + | ||
this.elementsPosition; | ||
const button = document.getElementById('feedbackButton' + this.fb.id.toString()); | ||
button.addEventListener('click', () => { | ||
this.renderModal(); | ||
@@ -58,26 +66,26 @@ }); | ||
const html = ` | ||
<div id="reactionModal"> | ||
<div class="modalsTriangle" id="reactionModalTriangle"></div> | ||
<p id="widgetHeader">Give a Feedback</p> | ||
<p id="widgetQuestion">${this.fb.wgQuestion}</p> | ||
<div class="modalReaction"> | ||
<div id="reactionModal${this.fb.id.toString()}"> | ||
<div class="modalsTriangle${this.fb.id.toString()}" id="reactionModalTriangle${this.fb.id.toString()}"></div> | ||
<p id="widgetHeader${this.fb.id.toString()}">Give a Feedback</p> | ||
<p id="widgetQuestion${this.fb.id.toString()}">${this.fb.wgQuestion}</p> | ||
<div class="modalReaction${this.fb.id.toString()}"> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" width = "35px" viewBox="0 0 22 22" style="margin-left:18px;" id="loveIcon"> <g fill="none" fill - rule="evenodd" > <g fill="#42CA4A" fill - rule="nonzero" > <g transform="translate(-161 -779) translate(161 779)" > <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z" /> <ellipse cx="13.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 13.932 8.652)" /> <ellipse cx="6.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 6.932 8.652)" /> <ellipse cx="15.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 15.325 8.897)" /> <ellipse cx="8.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 8.325 8.897)" /> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" /> </g> < /g> < /g> < /svg> | ||
<svg xmlns="http://www.w3.org/2000/svg" width = "35px" viewBox="0 0 22 22" style="margin-left:18px;" id="loveIcon${this.fb.id.toString()}"> <g fill="none" fill - rule="evenodd" > <g fill="#42CA4A" fill - rule="nonzero" > <g transform="translate(-161 -779) translate(161 779)" > <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z" /> <ellipse cx="13.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 13.932 8.652)" /> <ellipse cx="6.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 6.932 8.652)" /> <ellipse cx="15.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 15.325 8.897)" /> <ellipse cx="8.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 8.325 8.897)" /> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" /> </g> < /g> < /g> < /svg> | ||
</div> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="likeIcon"> <g fill="none" fill-rule="evenodd"> <g fill="#42CA4A" fill-rule="nonzero"> <g transform="translate(-198 -779) translate(198 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z"/> </g> </g> </g> </svg> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="likeIcon${this.fb.id.toString()}"> <g fill="none" fill-rule="evenodd"> <g fill="#42CA4A" fill-rule="nonzero"> <g transform="translate(-198 -779) translate(198 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z"/> </g> </g> </g> </svg> | ||
</div> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="neutralIcon"> <g fill="none" fill-rule="evenodd"> <g fill="#90A3B5" fill-rule="nonzero"> <g transform="translate(-235 -779) translate(235 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> </g> </g> </g> </svg> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="neutralIcon${this.fb.id.toString()}"> <g fill="none" fill-rule="evenodd"> <g fill="#90A3B5" fill-rule="nonzero"> <g transform="translate(-235 -779) translate(235 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> </g> </g> </g> </svg> | ||
</div> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="dislikeIcon"> <g fill="none" fill-rule="evenodd"> <g fill="#FF0101" fill-rule="nonzero"> <g transform="translate(-272 -779) translate(272 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" transform="rotate(-180 10.5 15)"/> </g> </g> </g> </svg> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="dislikeIcon${this.fb.id.toString()}"> <g fill="none" fill-rule="evenodd"> <g fill="#FF0101" fill-rule="nonzero"> <g transform="translate(-272 -779) translate(272 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" transform="rotate(-180 10.5 15)"/> </g> </g> </g> </svg> | ||
</div> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="hateIcon"> <g fill="none" fill-rule="evenodd"> <g> <g transform="translate(-306 -779) translate(306 779)"> <path fill="#FF9E31" fill-rule="nonzero" d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <path fill="#FF9E31" fill-rule="nonzero" d="M11.48 14c2.202 0 4.312-1.247 5.52-3.316L16.044 10c-1.11 1.9-3.139 2.961-5.17 2.702C9.29 12.499 7.824 11.489 6.955 10L6 10.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z"/> <circle cx="7" cy="7" r="1" fill="#D8D8D8" stroke="#FFA642"/> <circle cx="15" cy="7" r="1" fill="#D8D8D8" stroke="#FFA642"/> <path fill="#FF9E31" fill-rule="nonzero" d="M11.48 16c2.202 0 4.312-1.247 5.52-3.316L16.044 12c-1.11 1.9-3.139 2.961-5.17 2.702C9.29 14.499 7.824 13.489 6.955 12L6 12.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" transform="rotate(-180 11.5 14)"/> </g> </g> </g> </svg> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="hateIcon${this.fb.id.toString()}"> <g fill="none" fill-rule="evenodd"> <g> <g transform="translate(-306 -779) translate(306 779)"> <path fill="#FF9E31" fill-rule="nonzero" d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <path fill="#FF9E31" fill-rule="nonzero" d="M11.48 14c2.202 0 4.312-1.247 5.52-3.316L16.044 10c-1.11 1.9-3.139 2.961-5.17 2.702C9.29 12.499 7.824 11.489 6.955 10L6 10.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z"/> <circle cx="7" cy="7" r="1" fill="#D8D8D8" stroke="#FFA642"/> <circle cx="15" cy="7" r="1" fill="#D8D8D8" stroke="#FFA642"/> <path fill="#FF9E31" fill-rule="nonzero" d="M11.48 16c2.202 0 4.312-1.247 5.52-3.316L16.044 12c-1.11 1.9-3.139 2.961-5.17 2.702C9.29 14.499 7.824 13.489 6.955 12L6 12.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" transform="rotate(-180 11.5 14)"/> </g> </g> </g> </svg> | ||
</div> | ||
</div> | ||
<div class="actionButtons"> | ||
<button class="button close" id="closeModal">CLOSE</button> | ||
<button class="button next" id="nextToTheForm">NEXT</button> | ||
<div class="actionButtons${this.fb.id.toString()}"> | ||
<button class="button${this.fb.id.toString()} close${this.fb.id.toString()}" id="closeModal${this.fb.id.toString()}">CLOSE</button> | ||
<button class="button${this.fb.id.toString()} next${this.fb.id.toString()}" id="nextToTheForm${this.fb.id.toString()}">NEXT</button> | ||
</div> | ||
@@ -87,29 +95,30 @@ </div> | ||
this.root.innerHTML = html; | ||
this.root.style.cssText = "position: fixed; width: 100%; display: flex;" + this.modalViews.get(this.fb.wgPosition); | ||
const closeButton = document.getElementById("closeModal"); | ||
closeButton.addEventListener("click", () => { | ||
this.root.style.cssText = | ||
'width: 100%; display: flex;' + this.modalViews.get(this.fb.wgPosition) + this.elementsPosition; | ||
const closeButton = document.getElementById('closeModal' + this.fb.id.toString()); | ||
closeButton.addEventListener('click', () => { | ||
this.renderButton(); | ||
}); | ||
const next = document.getElementById("nextToTheForm"); | ||
next.addEventListener("click", () => { | ||
const next = document.getElementById('nextToTheForm' + this.fb.id.toString()); | ||
next.addEventListener('click', () => { | ||
this.renderForm(); | ||
}); | ||
const loveIcon = document.getElementById("loveIcon"); | ||
loveIcon.addEventListener("click", () => { | ||
const loveIcon = document.getElementById('loveIcon' + this.fb.id.toString()); | ||
loveIcon.addEventListener('click', () => { | ||
this.responseData.reactionType = 5; | ||
}); | ||
const likeIcon = document.getElementById("likeIcon"); | ||
likeIcon.addEventListener("click", () => { | ||
const likeIcon = document.getElementById('likeIcon' + this.fb.id.toString()); | ||
likeIcon.addEventListener('click', () => { | ||
this.responseData.reactionType = 4; | ||
}); | ||
const neutralIcon = document.getElementById("neutralIcon"); | ||
neutralIcon.addEventListener("click", () => { | ||
const neutralIcon = document.getElementById('neutralIcon' + this.fb.id.toString()); | ||
neutralIcon.addEventListener('click', () => { | ||
this.responseData.reactionType = 3; | ||
}); | ||
const dislikeIcon = document.getElementById("dislikeIcon"); | ||
dislikeIcon.addEventListener("click", () => { | ||
const dislikeIcon = document.getElementById('dislikeIcon' + this.fb.id.toString()); | ||
dislikeIcon.addEventListener('click', () => { | ||
this.responseData.reactionType = 2; | ||
}); | ||
const hateIcon = document.getElementById("hateIcon"); | ||
hateIcon.addEventListener("click", () => { | ||
const hateIcon = document.getElementById('hateIcon' + this.fb.id.toString()); | ||
hateIcon.addEventListener('click', () => { | ||
this.responseData.reactionType = 1; | ||
@@ -120,52 +129,54 @@ }); | ||
const html = ` | ||
<div id="commentViewModal"> | ||
<p id="widgetHeader">Give a Feedback</p> | ||
<p id="widgetQuestion">${this.fb.wgQuestion}</p> | ||
<div class="commentModalReaction"> | ||
<div id="commentViewModal${this.fb.id.toString()}"> | ||
<p id="widgetHeader${this.fb.id.toString()}">Give a Feedback</p> | ||
<p id="widgetQuestion${this.fb.id.toString()}">${this.fb.wgQuestion}</p> | ||
<div class="commentModalReaction${this.fb.id.toString()}"> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" width = "35px" viewBox="0 0 22 22" style="margin-left:18px;" id="commentLoveIcon"> <g fill="none" fill - rule="evenodd" > <g fill="#42CA4A" fill - rule="nonzero" > <g transform="translate(-161 -779) translate(161 779)" > <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z" /> <ellipse cx="13.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 13.932 8.652)" /> <ellipse cx="6.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 6.932 8.652)" /> <ellipse cx="15.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 15.325 8.897)" /> <ellipse cx="8.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 8.325 8.897)" /> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" /> </g> < /g> < /g> < /svg> | ||
<svg xmlns="http://www.w3.org/2000/svg" width = "35px" viewBox="0 0 22 22" style="margin-left:18px;" id="commentLoveIcon${this.fb.id.toString()}"> <g fill="none" fill - rule="evenodd" > <g fill="#42CA4A" fill - rule="nonzero" > <g transform="translate(-161 -779) translate(161 779)" > <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z" /> <ellipse cx="13.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 13.932 8.652)" /> <ellipse cx="6.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 6.932 8.652)" /> <ellipse cx="15.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 15.325 8.897)" /> <ellipse cx="8.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 8.325 8.897)" /> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" /> </g> < /g> < /g> < /svg> | ||
</div> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="commentLikeIcon"> <g fill="none" fill-rule="evenodd"> <g fill="#42CA4A" fill-rule="nonzero"> <g transform="translate(-198 -779) translate(198 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z"/> </g> </g> </g> </svg> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="commentLikeIcon${this.fb.id.toString()}"> <g fill="none" fill-rule="evenodd"> <g fill="#42CA4A" fill-rule="nonzero"> <g transform="translate(-198 -779) translate(198 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z"/> </g> </g> </g> </svg> | ||
</div> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="commentNeutralIcon"> <g fill="none" fill-rule="evenodd"> <g fill="#90A3B5" fill-rule="nonzero"> <g transform="translate(-235 -779) translate(235 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> </g> </g> </g> </svg> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="commentNeutralIcon${this.fb.id.toString()}"> <g fill="none" fill-rule="evenodd"> <g fill="#90A3B5" fill-rule="nonzero"> <g transform="translate(-235 -779) translate(235 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> </g> </g> </g> </svg> | ||
</div> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="commentDislikeIcon"> <g fill="none" fill-rule="evenodd"> <g fill="#FF0101" fill-rule="nonzero"> <g transform="translate(-272 -779) translate(272 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" transform="rotate(-180 10.5 15)"/> </g> </g> </g> </svg> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="commentDislikeIcon${this.fb.id.toString()}"> <g fill="none" fill-rule="evenodd"> <g fill="#FF0101" fill-rule="nonzero"> <g transform="translate(-272 -779) translate(272 779)"> <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <circle cx="7" cy="9" r="1"/> <circle cx="15" cy="9" r="1"/> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" transform="rotate(-180 10.5 15)"/> </g> </g> </g> </svg> | ||
</div> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="commentHateIcon"> <g fill="none" fill-rule="evenodd"> <g> <g transform="translate(-306 -779) translate(306 779)"> <path fill="#FF9E31" fill-rule="nonzero" d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <path fill="#FF9E31" fill-rule="nonzero" d="M11.48 14c2.202 0 4.312-1.247 5.52-3.316L16.044 10c-1.11 1.9-3.139 2.961-5.17 2.702C9.29 12.499 7.824 11.489 6.955 10L6 10.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z"/> <circle cx="7" cy="7" r="1" fill="#D8D8D8" stroke="#FFA642"/> <circle cx="15" cy="7" r="1" fill="#D8D8D8" stroke="#FFA642"/> <path fill="#FF9E31" fill-rule="nonzero" d="M11.48 16c2.202 0 4.312-1.247 5.52-3.316L16.044 12c-1.11 1.9-3.139 2.961-5.17 2.702C9.29 14.499 7.824 13.489 6.955 12L6 12.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" transform="rotate(-180 11.5 14)"/> </g> </g> </g> </svg> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="35px" viewBox="0 0 22 22" style="margin-left:25px;" id="commentHateIcon${this.fb.id.toString()}"> <g fill="none" fill-rule="evenodd"> <g> <g transform="translate(-306 -779) translate(306 779)"> <path fill="#FF9E31" fill-rule="nonzero" d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z"/> <path fill="#FF9E31" fill-rule="nonzero" d="M11.48 14c2.202 0 4.312-1.247 5.52-3.316L16.044 10c-1.11 1.9-3.139 2.961-5.17 2.702C9.29 12.499 7.824 11.489 6.955 10L6 10.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z"/> <circle cx="7" cy="7" r="1" fill="#D8D8D8" stroke="#FFA642"/> <circle cx="15" cy="7" r="1" fill="#D8D8D8" stroke="#FFA642"/> <path fill="#FF9E31" fill-rule="nonzero" d="M11.48 16c2.202 0 4.312-1.247 5.52-3.316L16.044 12c-1.11 1.9-3.139 2.961-5.17 2.702C9.29 14.499 7.824 13.489 6.955 12L6 12.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" transform="rotate(-180 11.5 14)"/> </g> </g> </g> </svg> | ||
</div> | ||
</div> | ||
<div id="textareaWithAdditionalMessage"> | ||
<textarea id="commentTextArea" placeholder="Tell us about your experience..." name="commentTextArea">${this.responseData.comment}</textarea> | ||
<div id="textareaWithAdditionalMessage${this.fb.id.toString()}"> | ||
<textarea id="commentTextArea${this.fb.id.toString()}" placeholder="Tell us about your experience..." name="commentTextArea">${this | ||
.responseData.comment}</textarea> | ||
</div> | ||
<p id="textUnderTextarea">${this.fb.wgAdditionalMsg}</p> | ||
<div class="actionButtons" id="formActionButtons"> | ||
<button class="button close" id="closeForm">CLOSE</button> | ||
<button id="commentSendButton" class="button next" disabled>NEXT</button> | ||
<p id="textUnderTextarea${this.fb.id.toString()}">${this.fb.wgAdditionalMsg}</p> | ||
<div class="actionButtons${this.fb.id.toString()}" id="formActionButtons${this.fb.id.toString()}"> | ||
<button class="button${this.fb.id.toString()} close${this.fb.id.toString()}" id="closeForm${this.fb.id.toString()}">CLOSE</button> | ||
<button id="commentSendButton${this.fb.id.toString()}" class="button${this.fb.id.toString()} next${this.fb.id.toString()}" disabled>NEXT</button> | ||
</div> | ||
<div class="modalsTriangle" id="formModalTriangle"></div> | ||
<div class="modalsTriangle${this.fb.id.toString()}" id="formModalTriangle${this.fb.id.toString()}"></div> | ||
</div> | ||
`; | ||
this.root.innerHTML = html; | ||
this.root.style.cssText = "position: fixed; width: 100%; display: flex;" + this.modalViews.get(this.fb.wgPosition); | ||
let comment = ""; | ||
const closeButton = document.getElementById("closeForm"); | ||
closeButton.addEventListener("click", () => { | ||
this.root.style.cssText = | ||
'width: 100%; display: flex;' + this.modalViews.get(this.fb.wgPosition) + this.elementsPosition; | ||
let comment = ''; | ||
const closeButton = document.getElementById('closeForm' + this.fb.id.toString()); | ||
closeButton.addEventListener('click', () => { | ||
this.renderButton(); | ||
}); | ||
const sendButton = document.getElementById("commentSendButton"); | ||
const sendButton = document.getElementById('commentSendButton' + this.fb.id.toString()); | ||
let checkTextAreaInterval = setInterval(() => { | ||
comment = (document.getElementById("commentTextArea")).value; | ||
if (comment == "") { | ||
comment = document.getElementById('commentTextArea' + this.fb.id.toString()).value; | ||
if (comment == '') { | ||
sendButton.disabled = true; | ||
sendButton.style.backgroundColor = "#eaeaeb"; | ||
sendButton.style.cursor = "not-allowed"; | ||
sendButton.style.color = "#333333"; | ||
sendButton.style.backgroundColor = '#eaeaeb'; | ||
sendButton.style.cursor = 'not-allowed'; | ||
sendButton.style.color = '#333333'; | ||
} | ||
else { | ||
sendButton.disabled = false; | ||
sendButton.style.cursor = "pointer"; | ||
sendButton.style.cursor = 'pointer'; | ||
sendButton.style.backgroundColor = this.fb.wgAccentColor; | ||
@@ -175,3 +186,3 @@ sendButton.style.color = this.textColor; | ||
}, 500); | ||
sendButton.addEventListener("click", () => { | ||
sendButton.addEventListener('click', () => { | ||
this.setCommentValue(); | ||
@@ -188,4 +199,4 @@ clearInterval(checkTextAreaInterval); | ||
}); | ||
const loveIcon = document.getElementById("commentLoveIcon"); | ||
loveIcon.addEventListener("click", () => { | ||
const loveIcon = document.getElementById('commentLoveIcon' + this.fb.id.toString()); | ||
loveIcon.addEventListener('click', () => { | ||
this.responseData.reactionType = 5; | ||
@@ -195,4 +206,4 @@ this.setCommentValue(); | ||
}); | ||
const likeIcon = document.getElementById("commentLikeIcon"); | ||
likeIcon.addEventListener("click", () => { | ||
const likeIcon = document.getElementById('commentLikeIcon' + this.fb.id.toString()); | ||
likeIcon.addEventListener('click', () => { | ||
this.responseData.reactionType = 4; | ||
@@ -202,4 +213,4 @@ this.setCommentValue(); | ||
}); | ||
const neutralIcon = document.getElementById("commentNeutralIcon"); | ||
neutralIcon.addEventListener("click", () => { | ||
const neutralIcon = document.getElementById('commentNeutralIcon' + this.fb.id.toString()); | ||
neutralIcon.addEventListener('click', () => { | ||
this.responseData.reactionType = 3; | ||
@@ -209,4 +220,4 @@ this.setCommentValue(); | ||
}); | ||
const dislikeIcon = document.getElementById("commentDislikeIcon"); | ||
dislikeIcon.addEventListener("click", () => { | ||
const dislikeIcon = document.getElementById('commentDislikeIcon' + this.fb.id.toString()); | ||
dislikeIcon.addEventListener('click', () => { | ||
this.responseData.reactionType = 2; | ||
@@ -216,4 +227,4 @@ this.setCommentValue(); | ||
}); | ||
const hateIcon = document.getElementById("commentHateIcon"); | ||
hateIcon.addEventListener("click", () => { | ||
const hateIcon = document.getElementById('commentHateIcon' + this.fb.id.toString()); | ||
hateIcon.addEventListener('click', () => { | ||
this.responseData.reactionType = 1; | ||
@@ -225,3 +236,3 @@ this.setCommentValue(); | ||
setCommentValue() { | ||
let comment = (document.getElementById("commentTextArea")).value; | ||
let comment = document.getElementById('commentTextArea' + this.fb.id.toString()).value; | ||
this.responseData.comment = comment; | ||
@@ -231,17 +242,18 @@ } | ||
const html = ` | ||
<div id="emailModal"> | ||
<p id="emailModalText">We may wish to follow up with<br> you. Enter your email if you're<br> happy for us to contact you.</p> | ||
<input id="emailInput" placeholder="\n email@domain.com"/> | ||
<div class="actionButtons"> | ||
<button class="button close" id="closeEmailModal">SKIP</button> | ||
<button class="button next" id="emailSendButton">SEND</button> | ||
<div id="emailModal${this.fb.id.toString()}"> | ||
<p id="emailModalText${this.fb.id.toString()}">${this.fb.wgEmailReqMsg}</p> | ||
<input id="emailInput${this.fb.id.toString()}" placeholder="\n email@domain.com"/> | ||
<div class="actionButtons${this.fb.id.toString()}"> | ||
<button class="button${this.fb.id.toString()} close${this.fb.id.toString()}" id="closeEmailModal${this.fb.id.toString()}">SKIP</button> | ||
<button class="button${this.fb.id.toString()} next${this.fb.id.toString()}" id="emailSendButton${this.fb.id.toString()}">SEND</button> | ||
</div> | ||
<div class="modalsTriangle" id="emailModalTriangle"></div> | ||
<div class="modalsTriangle${this.fb.id.toString()}" id="emailModalTriangle${this.fb.id.toString()}"></div> | ||
</div> | ||
`; | ||
this.root.innerHTML = html; | ||
this.root.style.cssText = "position: fixed; width: 100%; display: flex;" + this.modalViews.get(this.fb.wgPosition); | ||
let visitorEmail = ""; | ||
const closeButton = document.getElementById("closeEmailModal"); | ||
closeButton.addEventListener("click", () => { | ||
this.root.style.cssText = | ||
'width: 100%; display: flex;' + this.modalViews.get(this.fb.wgPosition) + this.elementsPosition; | ||
let visitorEmail = ''; | ||
const closeButton = document.getElementById('closeEmailModal' + this.fb.id.toString()); | ||
closeButton.addEventListener('click', () => { | ||
let event = new CustomEvent('fbEvent', { bubbles: false, detail: this.responseData }); | ||
@@ -255,13 +267,5 @@ window.dispatchEvent(event); | ||
}); | ||
// const skipButton = document.getElementById("skipEmailModal")!; | ||
// skipButton.addEventListener("click", () => { | ||
// let event = new CustomEvent('fbEvent', { bubbles: false, detail: this.responseData }); | ||
// window.dispatchEvent(event); | ||
// if (this.fb.wgThanksMsgActivation == true) { | ||
// this.renderThanksModal(); | ||
// } else this.renderButton(); | ||
// }); | ||
const sendButton = document.getElementById("emailSendButton"); | ||
sendButton.addEventListener("click", () => { | ||
visitorEmail = (document.getElementById("emailInput")).value; | ||
const sendButton = document.getElementById('emailSendButton' + this.fb.id.toString()); | ||
sendButton.addEventListener('click', () => { | ||
visitorEmail = document.getElementById('emailInput' + this.fb.id.toString()).value; | ||
this.responseData.email = visitorEmail; | ||
@@ -279,17 +283,18 @@ let event = new CustomEvent('fbEvent', { bubbles: false, detail: this.responseData }); | ||
const html = ` | ||
<div id="thanksModal"> | ||
<div id="thxIconContainer"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width = "62px" viewBox="0 0 22 22" id="commentLoveIcon"> <g fill="none" fill - rule="evenodd" > <g fill="#42CA4A" fill - rule="nonzero" > <g transform="translate(-161 -779) translate(161 779)" > <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z" /> <ellipse cx="13.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 13.932 8.652)" /> <ellipse cx="6.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 6.932 8.652)" /> <ellipse cx="15.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 15.325 8.897)" /> <ellipse cx="8.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 8.325 8.897)" /> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" /> </g> < /g> < /g> < /svg> | ||
<div id="thanksModal${this.fb.id.toString()}"> | ||
<div id="thxIconContainer${this.fb.id.toString()}"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width = "62px" viewBox="0 0 22 22" id="commentLoveIcon${this.fb.id.toString()}"> <g fill="none" fill - rule="evenodd" > <g fill="#42CA4A" fill - rule="nonzero" > <g transform="translate(-161 -779) translate(161 779)" > <path d="M11 0C4.935 0 0 4.935 0 11s4.935 11 11 11 11-4.935 11-11S17.065 0 11 0zm0 20.81c-2.695 0-5.14-1.091-6.914-2.856-.709-.705-1.31-1.517-1.779-2.41C1.594 14.184 1.19 12.64 1.19 11 1.19 5.59 5.59 1.19 11 1.19c2.566 0 4.905.99 6.655 2.608.907.84 1.656 1.847 2.196 2.973.615 1.281.96 2.716.96 4.229 0 5.41-4.401 9.81-9.811 9.81z" /> <ellipse cx="13.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 13.932 8.652)" /> <ellipse cx="6.932" cy = "8.652" rx = "1" ry = "2" transform = "rotate(-35 6.932 8.652)" /> <ellipse cx="15.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 15.325 8.897)" /> <ellipse cx="8.325" cy = "8.897" rx = "1" ry = "2" transform = "rotate(25 8.325 8.897)" /> <path d="M10.48 17c2.202 0 4.312-1.247 5.52-3.316L15.044 13c-1.11 1.9-3.139 2.961-5.17 2.702C8.29 15.499 6.824 14.489 5.955 13L5 13.684c1.052 1.802 2.825 3.024 4.743 3.27.246.03.492.046.737.046z" /> </g> < /g> < /g> < /svg> | ||
</div> | ||
<p id="thanksMessage">${this.fb.wgThanksMsg}</p> | ||
<div class="actionButtons"> | ||
<button class="button" id="thxClose">CLOSE</button> | ||
<p id="thanksMessage${this.fb.id.toString()}">${this.fb.wgThanksMsg}</p> | ||
<div class="actionButtons${this.fb.id.toString()}"> | ||
<button class="button${this.fb.id.toString()}" id="thxClose${this.fb.id.toString()}">CLOSE</button> | ||
</div> | ||
<div class="modalsTriangle" id="thxModalTriangle"></div> | ||
<div class="modalsTriangle${this.fb.id.toString()}" id="thxModalTriangle${this.fb.id.toString()}"></div> | ||
</div> | ||
`; | ||
this.root.innerHTML = html; | ||
this.root.style.cssText = "position: fixed; width: 100%; display: flex;" + this.modalViews.get(this.fb.wgPosition); | ||
const closeButton = document.getElementById("thxClose"); | ||
closeButton.addEventListener("click", () => { | ||
this.root.style.cssText = | ||
'width: 100%; display: flex;' + this.modalViews.get(this.fb.wgPosition) + this.elementsPosition; | ||
const closeButton = document.getElementById('thxClose' + this.fb.id.toString()); | ||
closeButton.addEventListener('click', () => { | ||
this.renderButton(); | ||
@@ -300,10 +305,10 @@ }); | ||
const css = ` | ||
#thxIconContainer{ | ||
#thxIconContainer${this.fb.id.toString()}{ | ||
margin-top: 38px; | ||
} | ||
#thxClose{ | ||
#thxClose${this.fb.id.toString()}{ | ||
padding: 10px 105px 11px 99px; | ||
background-color: black; | ||
} | ||
#feedbackButton{ | ||
#feedbackButton${this.fb.id.toString()}{ | ||
height: 140px; | ||
@@ -318,7 +323,7 @@ width: 40px; | ||
} | ||
#feedbackButton:hover { | ||
#feedbackButton${this.fb.id.toString()}:hover { | ||
box-shadow: 0 0 30px rgba(33,33,33,.3); | ||
width: 42px; | ||
} | ||
#widgetButtonIcon{ | ||
#widgetButtonIcon${this.fb.id.toString()}{ | ||
width: 20px; | ||
@@ -329,3 +334,3 @@ height: 26px; | ||
} | ||
#widgetButtonText{ | ||
#widgetButtonText${this.fb.id.toString()}{ | ||
font-weight: normal; | ||
@@ -338,3 +343,3 @@ letter-spacing: 0.2px; | ||
} | ||
.closeButton{ | ||
.closeButton${this.fb.id.toString()}{ | ||
padding:3px; cursor: pointer; float:right; height:20px; width:20px; margin-top:-12px; margin-right:17px; border-radius:50%; | ||
@@ -344,3 +349,3 @@ background-color: ${this.fb.wgAccentColor}; | ||
} | ||
#reactionModal{ | ||
#reactionModal${this.fb.id.toString()}{ | ||
height: auto; width: 404px; z-index: 1000; border-radius: 10px; border: solid 2px #d6eaf3; background-color: #f1f5f9; text-align: -webkit-center; | ||
@@ -350,3 +355,3 @@ ${this.modalViews.get(this.fb.wgPosition)}; | ||
} | ||
.modalsTriangle{ | ||
.modalsTriangle${this.fb.id.toString()}{ | ||
clip-path: polygon(50% 10%, 0% 100%,100% 100%); | ||
@@ -360,12 +365,12 @@ background-color: #f1f5f9; | ||
} | ||
#reactionModalTriangle{ | ||
#reactionModalTriangle${this.fb.id.toString()}{ | ||
margin-top: 210px; | ||
} | ||
#formModalTriangle{ | ||
#formModalTriangle${this.fb.id.toString()}{ | ||
margin-top: -51px; | ||
} | ||
@keyframes reactionModal{ | ||
@keyframes reactionModal${this.fb.id.toString()}{ | ||
${this.animationValue}; | ||
} | ||
.modalReaction{ | ||
.modalReaction${this.fb.id.toString()}{ | ||
display: flex; | ||
@@ -380,3 +385,3 @@ flex-direction: row; | ||
} | ||
.commentModalReaction{ | ||
.commentModalReaction${this.fb.id.toString()}{ | ||
display:flex; | ||
@@ -392,3 +397,3 @@ flex-direction:row; | ||
} | ||
#widgetHeader{ | ||
#widgetHeader${this.fb.id.toString()}{ | ||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important; | ||
@@ -398,3 +403,3 @@ font-size: 20px; | ||
} | ||
#widgetQuestion{ | ||
#widgetQuestion${this.fb.id.toString()}{ | ||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important; | ||
@@ -407,7 +412,7 @@ font-size: 18px; | ||
} | ||
#commentViewModal{ | ||
#commentViewModal${this.fb.id.toString()}{ | ||
width: 404px; height: auto; z-index: 1000; text-align: -webkit-center; border-radius: 10px; border: solid 2px #d6eaf3; background-color: #f1f5f9; | ||
${this.modalViews.get(this.fb.wgPosition)}; | ||
} | ||
#commentTextArea{ | ||
#commentTextArea${this.fb.id.toString()}{ | ||
width: 295px; height: 132px; | ||
@@ -422,6 +427,6 @@ border-radius: 10px; | ||
} | ||
textarea:focus{ | ||
textarea${this.fb.id.toString()}:focus{ | ||
outline: none; | ||
} | ||
#textUnderTextarea{ | ||
#textUnderTextarea${this.fb.id.toString()}{ | ||
font-size: 13px; | ||
@@ -433,3 +438,3 @@ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important; | ||
} | ||
#textareaWithAdditionalMessage{ | ||
#textareaWithAdditionalMessage${this.fb.id.toString()}{ | ||
width: 100%; | ||
@@ -440,19 +445,19 @@ display: flex; | ||
} | ||
#emailModal{ | ||
#emailModal${this.fb.id.toString()}{ | ||
width: 404px; height: auto; z-index: 1000; border-radius: 10px; background-color: #f1f5f9; text-align: -webkit-center; border: solid 2px #d6eaf3; | ||
${this.modalViews.get(this.fb.wgPosition)}; | ||
} | ||
#emailModalText{ | ||
#emailModalText${this.fb.id.toString()}{ | ||
margin-top: 25px;font-size: 17px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important; font-weight: 400; | ||
} | ||
#emailInput{ | ||
#emailInput${this.fb.id.toString()}{ | ||
width: 80%; border-radius: 10px; background-color: white; height: 46px; border: 0px; text-align: center; margin-top: 20px; | ||
} | ||
input:focus{ | ||
input${this.fb.id.toString()}:focus{ | ||
outline: none; | ||
} | ||
#emailModalActions{ | ||
#emailModalActions${this.fb.id.toString()}{ | ||
float: right; margin-top: 11px; margin-right: 20px; | ||
} | ||
#skipEmailModal{ | ||
#skipEmailModal${this.fb.id.toString()}{ | ||
margin-right: 10px; | ||
@@ -466,10 +471,10 @@ font-size: 13px; | ||
} | ||
#skipEmailModal:hover{ | ||
#skipEmailModal${this.fb.id.toString()}:hover{ | ||
color: black; | ||
} | ||
#thanksModal{ | ||
#thanksModal${this.fb.id.toString()}{ | ||
width: 404px; height: auto; z-index: 1000; border-radius: 10px; background-color: #f1f5f9; text-align: -webkit-center; border: solid 2px #d6eaf3; | ||
${this.modalViews.get(this.fb.wgPosition)}; | ||
} | ||
#thanksMessage{ | ||
#thanksMessage${this.fb.id.toString()}{ | ||
margin-top: 15px; | ||
@@ -483,6 +488,6 @@ font-size: 20px; | ||
} | ||
.closeIcon{ | ||
.closeIcon${this.fb.id.toString()}{ | ||
margin: -8px; | ||
} | ||
.button{ | ||
.button${this.fb.id.toString()}{ | ||
float: right; | ||
@@ -500,9 +505,9 @@ border: none; | ||
} | ||
.close{ | ||
.close${this.fb.id.toString()}{ | ||
background-color: rgba(68, 142, 225, 0.2); | ||
} | ||
.next{ | ||
.next${this.fb.id.toString()}{ | ||
background-color: #e72d44; | ||
} | ||
.actionButtons{ | ||
.actionButtons${this.fb.id.toString()}{ | ||
display: flex; | ||
@@ -514,67 +519,35 @@ flex-direction: row; | ||
} | ||
#formActionButtons{ | ||
#formActionButtons${this.fb.id.toString()}{ | ||
padding-bottom: 28px; | ||
} | ||
#emailModalTriangle{ | ||
#emailModalTriangle${this.fb.id.toString()}{ | ||
margin-top: -47px; | ||
} | ||
#thxModalTriangle{ | ||
#thxModalTriangle${this.fb.id.toString()}{ | ||
margin-top: -50px; | ||
} | ||
`; | ||
const linkElement = document.createElement("link"); | ||
linkElement.setAttribute("rel", "stylesheet"); | ||
linkElement.setAttribute("type", "text/css"); | ||
linkElement.setAttribute("href", "data:text/css;charset=UTF-8," + encodeURIComponent(css)); | ||
const linkElement = document.createElement('link'); | ||
linkElement.setAttribute('rel', 'stylesheet'); | ||
linkElement.setAttribute('type', 'text/css'); | ||
linkElement.setAttribute('href', 'data:text/css;charset=UTF-8,' + encodeURIComponent(css)); | ||
document.head.appendChild(linkElement); | ||
} | ||
setMapsValues() { | ||
this.language_map.set("ar", "رأي"); | ||
this.language_map.set("en", "Feedback"); | ||
this.language_map.set("fr", "Rétroaction"); | ||
this.style_map.set("0", "flex-direction: row-reverse; top:50%; border-top-left-radius: 3px; border-bottom-left-radius: 3px;"); | ||
this.style_map.set("1", "flex-direction: row; top:50%; border-top-right-radius: 3px; border-bottom-right-radius: 3px;"); | ||
this.style_map.set("2", "flex-direction: row-reverse; top:70%; border-top-left-radius: 3px; border-bottom-left-radius: 3px;"); | ||
this.style_map.set("3", "flex-direction: row; top:70%; border-top-right-radius: 3px; border-bottom-right-radius: 3px;"); | ||
this.modalViews.set("0", "right: 70px; flex-direction: row-reverse; top:50%; transform: translate(0, -25%);"); | ||
this.modalViews.set("1", "left: 70px; flex-direction: row; top:50%; transform: translate(0, -25%);"); | ||
this.modalViews.set("2", "right: 70px; flex-direction: row-reverse; top:70%; transform: translate(0, -35%);"); | ||
this.modalViews.set("3", "left: 70px; flex-direction: row; top:70%; transform: translate(0, -35%);"); | ||
this.trianglePosition.set("0", "float: right; margin-right: -8%;"); | ||
this.trianglePosition.set("1", "float: left; margin-left: -8%; transform: rotate(-90deg);"); | ||
this.trianglePosition.set("2", "float: right; margin-right: -8%;"); | ||
this.trianglePosition.set("3", "float: left; margin-left: -8%; transform: rotate(-90deg);"); | ||
this.language_map.set('ar', 'رأي'); | ||
this.language_map.set('en', 'Feedback'); | ||
this.language_map.set('fr', 'Rétroaction'); | ||
this.style_map.set('0', 'flex-direction: row-reverse; top:50%; border-top-left-radius: 3px; border-bottom-left-radius: 3px; right: 0;'); | ||
this.style_map.set('1', 'flex-direction: row; top:50%; border-top-right-radius: 3px; border-bottom-right-radius: 3px; left: 0;'); | ||
this.style_map.set('2', 'flex-direction: row-reverse; top:80%; border-top-left-radius: 3px; border-bottom-left-radius: 3px; right: 0;'); | ||
this.style_map.set('3', 'flex-direction: row; top:80%; border-top-right-radius: 3px; border-bottom-right-radius: 3px; left: 0;'); | ||
this.modalViews.set('0', 'right: 70px; flex-direction: row-reverse; top:50%; transform: translate(0, -25%);'); | ||
this.modalViews.set('1', 'left: 70px; flex-direction: row; top:50%; transform: translate(0, -25%);'); | ||
this.modalViews.set('2', 'right: 70px; flex-direction: row-reverse; top:80%; transform: translate(0, -40%);'); | ||
this.modalViews.set('3', 'left: 70px; flex-direction: row; top:80%; transform: translate(0, -40%);'); | ||
this.trianglePosition.set('0', 'float: right; margin-right: -8%;'); | ||
this.trianglePosition.set('1', 'float: left; margin-left: -8%; transform: rotate(-90deg);'); | ||
this.trianglePosition.set('2', 'float: right; margin-right: -8%;'); | ||
this.trianglePosition.set('3', 'float: left; margin-left: -8%; transform: rotate(-90deg);'); | ||
} | ||
} | ||
window.addEventListener('DOMContentLoaded', (event) => { | ||
let widget = new FeedbackCreator({ | ||
id: 0, | ||
wgResponses: 0, | ||
wgUpdTime: new Date(), | ||
SiteId: "31", | ||
UserId: "47", | ||
wgLanguage: 'en', | ||
wgPosition: "1", | ||
wgAccentColor: '#e72d44', | ||
wgAlternateColor: true, | ||
wgQuestion: 'Tell us about web site experience.', | ||
wgUserScreenshot: false, | ||
wgEmailReqMsg: 'Widget email request message', | ||
wgEmailReqActivation: true, | ||
wgAdditionalMsg: 'Widget additional message', | ||
wgAdditionalMsgActivation: false, | ||
wgThanksMsg: 'Thank your for Give a Feedback', | ||
wgThanksMsgActivation: true, | ||
wgDesktop: false, | ||
wgPhone: false, | ||
wgTablet: false, | ||
wgPages: '*', | ||
wgWidgetToUsers: null, | ||
wgPercentage: 50, | ||
wgEmail: false, | ||
wgWidgetToAllPages: true, | ||
wgReactionStyle: 0, | ||
wgResponseViaEmail: "" | ||
}, null); | ||
widget.renderButton(); | ||
}); |
{ | ||
"name": "fs-feedback-creator", | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"description": "web-based module that's responsible to inject fullsession feedback modal", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
38491
628