web-push-notifications 3.55.0 → 3.57.0
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/core/Pushwoosh.types.d.ts +2 -2
- package/core/events.types.d.ts +2 -2
- package/modules/Api/Api.d.ts +1 -0
- package/modules/Data/Data.d.ts +4 -2
- package/npm.js +1 -1
- package/npm.js.map +1 -1
- package/package.json +1 -1
- package/pushwoosh-web-notifications.d.ts +1 -0
- package/pushwoosh-widget-inbox.d.ts +1 -0
- package/pushwoosh-widget-subscribe-popup.d.ts +1 -0
- package/pushwoosh-widget-subscription-button.d.ts +1 -0
- package/pushwoosh-widget-subscription-prompt.d.ts +1 -0
- package/pushwoosh-widget-web-popups.d.ts +1 -0
- package/service-worker.js +1 -1
- package/service-worker.js.map +1 -1
- package/widget-subscription-button.js +1 -1
- package/widget-subscription-button.js.map +1 -1
- package/widget-web-popups.d.ts +1 -0
- package/widgets/{PopupForms/PopupFormsWidget.d.ts → WebPopups/WebPopupsWidget.d.ts} +3 -3
- package/widgets/{PopupForms → WebPopups}/constants.d.ts +1 -1
- package/widgets/WebPopups/helpers.d.ts +2 -0
- package/widgets/WebPopups/renderer.d.ts +2 -0
- package/widgets/{PopupForms → WebPopups}/types.d.ts +3 -3
- package/widgets/PopupForms/helpers.d.ts +0 -2
- package/widgets/PopupForms/renderer.d.ts +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var i in o)("object"==typeof exports?exports:t)[i]=o[i]}}(this,()=>(()=>{"use strict";var t={d:(e,o)=>{for(var i in o)t.o(o,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:o[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{PWSubscriptionButtonWidget:()=>l});const o="denied",i="granted",s="default",n=(t,e)=>`<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:cc="http://creativecommons.org/ns#"\n xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n version="1.1"\n id="Capa_1"\n x="0px"\n y="0px"\n viewBox="0 0 346.013 346.013"\n style="enable-background:new 0 0 346.013 346.013;width: 80%; height: auto; vertical-align: middle;"\n xml:space="preserve"\n inkscape:version="0.91 r13725"\n sodipodi:docname="alarm_white.svg"><metadata\n id="metadata51"><rdf:RDF><cc:Work\n rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type\n rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\n id="defs49" /><sodipodi:namedview\n borderopacity="1"\n objecttolerance="10"\n gridtolerance="10"\n guidetolerance="10"\n inkscape:pageopacity="0"\n inkscape:pageshadow="2"\n inkscape:window-width="1618"\n inkscape:window-height="828"\n id="namedview47"\n showgrid="false"\n inkscape:zoom="0.6820553"\n inkscape:cx="173.0065"\n inkscape:cy="173.0065"\n inkscape:window-x="0"\n inkscape:window-y="0"\n inkscape:window-maximized="0"\n inkscape:current-layer="g3" /><g\n id="g3"><path\n d="m 256.76227,220.19006 c -1.77513,-2.69766 -3.45154,-5.24564 -3.98966,-7.46382 -0.042,-0.17861 -0.0911,-0.36128 -0.16237,-0.61436 -2.28354,-7.67647 0.69147,-24.43921 2.46886,-34.45124 0.26788,-1.50394 0.52274,-2.94197 0.75286,-4.29035 0.0232,-0.13675 0.044,-0.27211 0.0724,-0.48006 1.95582,-15.28051 2.58811,-37.91956 -5.51044,-58.99147 -5.6032,-14.57978 -14.45978,-25.82612 -26.3559,-33.48393 1.26598,-9.812938 -4.85967,-19.343691 -14.66682,-22.0511 -9.80715,-2.70741 -19.95724,2.33226 -23.90298,11.405413 -14.1382,0.467533 -27.51111,5.577097 -39.80114,15.219267 -17.76129,13.9298 -28.83431,33.68757 -34.99389,47.80757 l -0.0479,0.11335 c -0.0512,0.12175 -0.0998,0.24114 -0.13249,0.32962 -0.49733,1.28292 -1.01552,2.64514 -1.55689,4.07255 -3.61311,9.51043 -9.66004,25.42824 -15.611995,30.89342 -0.106524,0.10027 -0.208228,0.20187 -0.362362,0.35435 -1.636243,1.66563 -4.382941,2.99463 -7.288979,4.40101 -7.145531,3.45301 -22.013613,10.64166 -17.206389,31.67844 0.929154,4.07105 4.008437,7.29057 8.033861,8.40185 l 167.570804,46.2604 c 4.02253,1.11048 8.31521,-0.0729 11.2052,-3.08958 14.91617,-15.58874 5.84693,-29.38668 1.48625,-36.02133 z"\n id="path5"\n inkscape:connector-curvature="0"\n vector-effect="non-scaling-stroke"\n style="fill:${t}; stroke: ${e}; stroke-width: 1; " /><path\n vector-effect="non-scaling-stroke"\n d="m 174.26737,259.72378 -38.76399,-10.70137 c -1.59243,-0.43962 -3.28183,-0.15596 -4.63548,0.7754 -2.53909,1.7494 -2.84182,4.93159 -3.02304,6.83188 l -0.0151,0.15247 c -1.22819,12.67106 6.79854,24.33046 19.08688,27.72284 12.51583,3.45518 25.8324,-2.91586 30.9681,-14.80385 l 0.0935,-0.19205 c 0.52305,-1.06418 1.74613,-3.55554 0.50882,-6.31116 -0.44302,-0.98439 -1.5794,-2.74529 -4.21964,-3.47416 z"\n id="path7"\n inkscape:connector-curvature="0"\n style="fill:${t}; stroke: ${e}; stroke-width: 1;" /></g><g\n id="g17" /><g\n id="g19" /><g\n id="g21" /><g\n id="g23" /><g\n id="g25" /><g\n id="g27" /><g\n id="g29" /><g\n id="g31" /><g\n id="g33" /><g\n id="g35" /><g\n id="g37" /><g\n id="g39" /><g\n id="g41" /><g\n id="g43" /><g\n id="g45" /></svg>`;(Object.getOwnPropertyDescriptor(n,"name")||{}).writable||Object.defineProperty(n,"name",{value:"default",configurable:!0});const r="bottomRight",a="bottomLeft",p="topRight",c="topLeft",d={position:a,bgColor:"#12AE7E",bellColor:"white",bellStrokeColor:"#08754f",bellButtonBorder:"1px solid #379676",shadow:"0px 0px 6px rgba(0, 0, 0, 0.75)",size:"48px",indent:"20px",zIndex:"999999",tooltipText:{successSubscribe:"You are successfully subscribed!",needSubscribe:"Get notifications about important news!",blockSubscribe:"Click to see how to get notifications",alreadySubscribed:"You are already subscribed"}};class b{static getBellPosition(t,e){let o;switch(t){case r:o={top:"auto",left:"auto",bottom:e,right:e};break;case a:o={top:"auto",left:e,bottom:e,right:"auto"};break;case c:o={top:e,left:e,bottom:"auto",right:"auto"};break;case p:o={top:e,left:"auto",bottom:"auto",right:e};break;default:o={top:"auto",left:"auto",bottom:e,right:e}}return o}static getTooltipPosition(t,e){let o,i;const s=parseInt(e)+12+"px";switch(t){case r:o={right:s},i="right";break;case a:case c:o={left:s},i="left";break;default:o={right:s},i="right"}return[o,i]}static getPopoverPosition(t,e){let o,i;const s=parseInt(e)+15+"px";switch(t){case r:o={bottom:s,right:"0",left:"auto",top:"auto"},i="bottom";break;case a:o={bottom:s,left:"0",right:"auto",top:"auto"},i="bottom";break;case c:o={top:s,left:"0",right:"auto",bottom:"auto"},i="top";break;case p:o={top:s,right:"0",left:"auto",bottom:"auto"},i="top";break;default:o={bottom:s,right:"0",left:"auto",top:"auto"},i="bottom"}return[o,i]}static getPopoverArrowPosition(t,e){let o;switch(t){case r:o="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: "+(parseInt(e)/2-4+"px");break;case a:o="\n.pushwoosh-subscribe-widget__popover__bottom:after {right: auto; left: "+(parseInt(e)/2-12+"px");break;case c:o="\n.pushwoosh-subscribe-widget__popover__top:after {right: auto; left: "+(parseInt(e)/2-12+"px");break;case p:o="\n.pushwoosh-subscribe-widget__popover__top:after {left: auto; right: "+(parseInt(e)/2-4+"px");break;default:o="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: "+(parseInt(e)/2-4+"px")}return o}}class l{constructor(t){if(this.pw=t,!t.platformChecker.isAvailableNotifications)return void console.warn("Browser does not support push notifications");this.clickBell=this.clickBell.bind(this),this.onSubscribeEvent=this.onSubscribeEvent.bind(this),this.onUnsubscribeEvent=this.onUnsubscribeEvent.bind(this),this.onPermissionDeniedEvent=this.onPermissionDeniedEvent.bind(this),this.clickOutOfPopover=this.clickOutOfPopover.bind(this);const e=Object.assign(d.tooltipText,t.initParams.subscribeWidget.tooltipText);this.config=Object.assign({},d,t.initParams.subscribeWidget),this.config.tooltipText=e}async run(){await this.pw.isSubscribed()||await this.render()}addStylesToElement(t,e){Object.keys(t).forEach(o=>{e.style[o]=t[o]})}createContainer(){const t=document.createElement("div");t.id="pushwooshBellWidget",t.className="pushwoosh-subscribe-widget";const e=b.getBellPosition(this.config.position,this.config.indent),o=Object.assign({zIndex:this.config.zIndex},e);return this.addStylesToElement(o,t),t}createStyle(){const t=document.createElement("style");return t.innerHTML='/* Widget */\n.pushwoosh-subscribe-widget {\n position: fixed;\n display: block;\n transform: translate3d(0, 0, 0);\n}\n\n.pushwoosh-subscribe-widget__subscribed {\n display: none;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button {\n border-radius: 50%;\n cursor: pointer;\n font-size: 0;\n text-align: center;\n transform: scale(0.9) translate3d(0, 0, 0);\n transition: transform .3s ease-in-out;\n position: relative;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button:hover {\n transform: scale(1);\n}\n\n/* Tooltip */\n.pushwoosh-subscribe-widget__tooltip {\n position: absolute;\n height: 48px;\n max-width: 300px;\n min-width: 200px;\n padding: 5px 7px;\n background-color: #3b444b;\n color: #ffffff;\n text-align: center;\n vertical-align: middle;\n box-sizing: border-box;\n line-height: 38px;\n font-size: 0;\n font-weight: normal;\n visibility: hidden;\n opacity: 0;\n transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n top: 50%;\n transform: translate(0, -50%);\n box-shadow: 1px 1px 5px 0 rgba(0,0,0,0.5);\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after,\n.pushwoosh-subscribe-widget__tooltip__left:after {\n content: "";\n top: 50%;\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n background: #3b444b;\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after {\n left: calc(100% - 7px);\n border-top: 5px solid #3b444b;\n border-left: 5px solid #3b444b;\n border-right: 5px solid transparent;\n box-sizing: border-box;\n transform-origin: 0 0;\n transform: rotate(-45deg);\n box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__tooltip__left:after {\n left: -7px;\n border-top: 5px solid #3b444b;\n border-right: 5px solid #3b444b;\n border-left: 5px solid transparent;\n box-sizing: border-box;\n transform-origin: 0 0;\n transform: rotate(-45deg);\n box-shadow: -2px -2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__bell-button:hover + .pushwoosh-subscribe-widget__tooltip,\n.pushwoosh-subscribe-widget__tooltip.pushwoosh-subscribe-widget__tooltip__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__tooltip-content {\n display: inline-block;\n vertical-align: middle;\n font-size: 14px;\n line-height: 1.4;\n white-space: nowrap;\n overflow: hidden;\n padding-right: 5px;\n text-overflow: ellipsis;\n max-width: 100%;\n}\n\n/* Popover */\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover {\n position: absolute;\n right: auto;\n box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.5);\n box-sizing: border-box;\n background: #9ca8b1;\n visibility: hidden;\n opacity: 0;\n transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after,\n.pushwoosh-subscribe-widget__popover__top:after {\n content: "";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-right: 8px solid transparent;\n border-left: 8px solid #9ca8b1;\n background: #9ca8b1;\n transform-origin: 0 0;\n transform: rotate(-45deg);\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after {\n border-bottom: 8px solid #9ca8b1;\n border-top: 8px solid transparent;\n box-sizing: border-box;\n box-shadow: -2px 2px 1px 0 rgba(0, 0, 0, 0.25);\n bottom: -16px;\n}\n\n.pushwoosh-subscribe-widget__popover__top:after {\n top: 0;\n border-top: 8px solid #9ca8b1;\n border-bottom: 8px solid transparent;\n box-sizing: border-box;\n box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__popover-content-wrapper {\n overflow: auto;\n max-width: 100%;\n}\n\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n display: flex;\n flex-direction: column;\n padding: 14px;\n box-sizing: border-box;\n float: left;\n min-width: 100%;\n align-items: center;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n display: block;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-bottom: 14px;\n}\n\n@media (max-width: 767px) and (orientation: portrait) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n flex-direction: column;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 0;\n margin-bottom: 14px;\n }\n}\n@media (max-width: 767px) and (orientation: landscape) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n flex-direction: row;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 14px;\n margin-bottom: 0;\n }\n}\n',t}createBell(){const{config:t}=this;let e;return t.buttonImage?(e=document.createElement("img"),e.src=t.buttonImage):(e=document.createElement("div"),this.addStylesToElement({backgroundColor:t.bgColor,boxShadow:t.shadow,lineHeight:t.size,border:t.bellButtonBorder},e),e.innerHTML=n(t.bellColor,t.bellStrokeColor)),this.addStylesToElement({width:t.size,height:t.size},e),e.className="pushwoosh-subscribe-widget__bell-button",e}async createTooltip(){const t=document.createElement("div"),[e,o]=b.getTooltipPosition(this.config.position,this.config.size);return t.className=`pushwoosh-subscribe-widget__tooltip pushwoosh-subscribe-widget__tooltip__${o}`,this.addStylesToElement(e,t),t.appendChild(await this.createTooltipContent()),t}async createTooltipContent(){const t=document.createElement("div");return t.innerText=await this.tooltipTextFactory(),t.className="pushwoosh-subscribe-widget__tooltip-content",t}async tooltipTextFactory(){const t=this.pw.driver.getPermission(),{tooltipText:e}=this.config,n=await this.pw.data.getStatusManualUnsubscribed();switch(t){case i:return n?e.needSubscribe:e.alreadySubscribed;case s:return e.needSubscribe;case o:return e.blockSubscribe;default:return e.needSubscribe}}createPopover(){const t=document.createElement("div"),e=document.createElement("div"),[o,i]=b.getPopoverPosition(this.config.position,this.config.size);e.className=`pushwoosh-subscribe-widget__popover pushwoosh-subscribe-widget__popover__${i}`,t.className="pushwoosh-subscribe-widget__popover-content-wrapper",this.style.innerHTML+=b.getPopoverArrowPosition(this.config.position,this.config.size);const s=Object.assign({maxWidth:`calc(100vw - ${this.config.indent} - ${this.config.indent})`},o);return this.addStylesToElement(s,e),t.appendChild(this.createPopoverContent()),e.appendChild(t),e}getBrowserName(){const t=this.pw.platformChecker;let e;return e=t.isOpera?"opera":11===t.platform&&navigator.userAgent.match(/Android/i)?"mobileChrome":12===t.platform?"firefox":10===t.platform?"safari":150===t.platform?"edge":"chrome",e}createPopoverContent(){const{config:t}=this,e=document.createElement("div");e.className="pushwoosh-subscribe-widget__popover-content";const o=this.getBrowserName(),i=t.contentImages&&t.contentImages[o];if(i){const t=document.createElement("img");t.src=i,e.appendChild(t)}else{const t={opera:"opera",mobileChrome:"mobile_chrome",firefox:"FF",safari:"safari"}[o]||"chrome";[{src:this.getImageSrc(t),width:500,height:130},{src:this.getImageSrc(`${t}_unlock`),width:500,height:230}].forEach(t=>{const o=document.createElement("img");Object.assign(o,t),e.appendChild(o)})}return e}getImageSrc(t){return`https://cdn.pushwoosh.com/webpush/img/${t}.jpg`}async render(){this.widget=this.createContainer(),this.style=this.createStyle();const t=this.createBell();this.tooltip=await this.createTooltip(),this.popover=await this.createPopover(),this.widget.appendChild(this.style),this.widget.appendChild(t),this.widget.appendChild(this.tooltip),this.widget.appendChild(this.popover),document.body.appendChild(this.widget),this.pw.push(["onSubscribe",this.onSubscribeEvent]),this.pw.push(["onUnsubscribe",this.onUnsubscribeEvent]),this.pw.push(["onPermissionDenied",this.onPermissionDeniedEvent]),this.addEventListeners()}addEventListeners(){this.widget.addEventListener("click",this.clickBell),window.addEventListener("click",this.clickOutOfPopover)}toggleHelpPopover(){this.popover.classList.toggle("pushwoosh-subscribe-widget__popover__visible")}async clickBell(){switch(this.pw.driver.getPermission()){case i:case s:await this.pw.subscribe();break;case o:this.toggleHelpPopover();break;default:console.warn("Unknown browser notification permission")}}async onSubscribeEvent(){const t=this.tooltip.querySelector("div");null!==t&&(t.innerText=this.config.tooltipText.successSubscribe,this.tooltip.classList.add("pushwoosh-subscribe-widget__tooltip__visible"),setTimeout(async()=>{this.tooltip.classList.remove("pushwoosh-subscribe-widget__tooltip__visible"),t.innerText=await this.tooltipTextFactory(),this.widget.classList.add("pushwoosh-subscribe-widget__subscribed")},2e3))}async onPermissionDeniedEvent(){this.addEventListeners();const t=this.tooltip.querySelector("div");null!==t&&(t.innerText=await this.tooltipTextFactory())}clickOutOfPopover(t){this.popover.classList.contains("pushwoosh-subscribe-widget__popover__visible")&&!t.target.classList.contains("pushwoosh-subscribe-widget__popover")&&null===t.target.closest(".pushwoosh-subscribe-widget__popover")&&!t.target.classList.contains("pushwoosh-subscribe-widget__bell-button")&&null===t.target.closest(".pushwoosh-subscribe-widget__bell-button")&&this.popover.classList.remove("pushwoosh-subscribe-widget__popover__visible")}async onUnsubscribeEvent(){const t=this.tooltip.querySelector("div");null!==t&&(t.innerText=await this.tooltipTextFactory())}}return e})());
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var i in o)("object"==typeof exports?exports:t)[i]=o[i]}}(this,()=>(()=>{"use strict";var t={d:(e,o)=>{for(var i in o)t.o(o,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:o[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{PWSubscriptionButtonWidget:()=>b});const o="denied",i="granted",s="default",n="bottomRight",r="bottomLeft",a="topRight",p="topLeft",c={position:r,bgColor:"#12AE7E",bellColor:"white",bellStrokeColor:"#08754f",bellButtonBorder:"1px solid #379676",shadow:"0px 0px 6px rgba(0, 0, 0, 0.75)",size:"48px",indent:"20px",zIndex:"999999",tooltipText:{successSubscribe:"You are successfully subscribed!",needSubscribe:"Get notifications about important news!",blockSubscribe:"Click to see how to get notifications",alreadySubscribed:"You are already subscribed"}};class d{static getBellPosition(t,e){let o;switch(t){case n:o={top:"auto",left:"auto",bottom:e,right:e};break;case r:o={top:"auto",left:e,bottom:e,right:"auto"};break;case p:o={top:e,left:e,bottom:"auto",right:"auto"};break;case a:o={top:e,left:"auto",bottom:"auto",right:e};break;default:o={top:"auto",left:"auto",bottom:e,right:e}}return o}static getTooltipPosition(t,e){let o,i;const s=parseInt(e)+12+"px";switch(t){case n:o={right:s},i="right";break;case r:case p:o={left:s},i="left";break;default:o={right:s},i="right"}return[o,i]}static getPopoverPosition(t,e){let o,i;const s=parseInt(e)+15+"px";switch(t){case n:o={bottom:s,right:"0",left:"auto",top:"auto"},i="bottom";break;case r:o={bottom:s,left:"0",right:"auto",top:"auto"},i="bottom";break;case p:o={top:s,left:"0",right:"auto",bottom:"auto"},i="top";break;case a:o={top:s,right:"0",left:"auto",bottom:"auto"},i="top";break;default:o={bottom:s,right:"0",left:"auto",top:"auto"},i="bottom"}return[o,i]}static getPopoverArrowPosition(t,e){let o;switch(t){case n:o="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: "+(parseInt(e)/2-4+"px");break;case r:o="\n.pushwoosh-subscribe-widget__popover__bottom:after {right: auto; left: "+(parseInt(e)/2-12+"px");break;case p:o="\n.pushwoosh-subscribe-widget__popover__top:after {right: auto; left: "+(parseInt(e)/2-12+"px");break;case a:o="\n.pushwoosh-subscribe-widget__popover__top:after {left: auto; right: "+(parseInt(e)/2-4+"px");break;default:o="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: "+(parseInt(e)/2-4+"px")}return o}}class b{constructor(t){if(this.pw=t,!t.platformChecker.isAvailableNotifications)return void console.warn("Browser does not support push notifications");this.clickBell=this.clickBell.bind(this),this.onSubscribeEvent=this.onSubscribeEvent.bind(this),this.onUnsubscribeEvent=this.onUnsubscribeEvent.bind(this),this.onPermissionDeniedEvent=this.onPermissionDeniedEvent.bind(this),this.clickOutOfPopover=this.clickOutOfPopover.bind(this);const e=Object.assign(c.tooltipText,t.initParams.subscribeWidget.tooltipText);this.config=Object.assign({},c,t.initParams.subscribeWidget),this.config.tooltipText=e}async run(){await this.pw.isSubscribed()||await this.render()}addStylesToElement(t,e){Object.keys(t).forEach(o=>{e.style[o]=t[o]})}createContainer(){const t=document.createElement("div");t.id="pushwooshBellWidget",t.className="pushwoosh-subscribe-widget";const e=d.getBellPosition(this.config.position,this.config.indent),o=Object.assign({zIndex:this.config.zIndex},e);return this.addStylesToElement(o,t),t}createStyle(){const t=document.createElement("style");return t.innerHTML='/* Widget */\n.pushwoosh-subscribe-widget {\n position: fixed;\n display: block;\n transform: translate3d(0, 0, 0);\n}\n\n.pushwoosh-subscribe-widget__subscribed {\n display: none;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button {\n border-radius: 50%;\n cursor: pointer;\n font-size: 0;\n text-align: center;\n transform: scale(0.9) translate3d(0, 0, 0);\n transition: transform .3s ease-in-out;\n position: relative;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button:hover {\n transform: scale(1);\n}\n\n/* Tooltip */\n.pushwoosh-subscribe-widget__tooltip {\n position: absolute;\n height: 48px;\n max-width: 300px;\n min-width: 200px;\n padding: 5px 7px;\n background-color: #3b444b;\n color: #ffffff;\n text-align: center;\n vertical-align: middle;\n box-sizing: border-box;\n line-height: 38px;\n font-size: 0;\n font-weight: normal;\n visibility: hidden;\n opacity: 0;\n transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n top: 50%;\n transform: translate(0, -50%);\n box-shadow: 1px 1px 5px 0 rgba(0,0,0,0.5);\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after,\n.pushwoosh-subscribe-widget__tooltip__left:after {\n content: "";\n top: 50%;\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n background: #3b444b;\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after {\n left: calc(100% - 7px);\n border-top: 5px solid #3b444b;\n border-left: 5px solid #3b444b;\n border-right: 5px solid transparent;\n box-sizing: border-box;\n transform-origin: 0 0;\n transform: rotate(-45deg);\n box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__tooltip__left:after {\n left: -7px;\n border-top: 5px solid #3b444b;\n border-right: 5px solid #3b444b;\n border-left: 5px solid transparent;\n box-sizing: border-box;\n transform-origin: 0 0;\n transform: rotate(-45deg);\n box-shadow: -2px -2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__bell-button:hover + .pushwoosh-subscribe-widget__tooltip,\n.pushwoosh-subscribe-widget__tooltip.pushwoosh-subscribe-widget__tooltip__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__tooltip-content {\n display: inline-block;\n vertical-align: middle;\n font-size: 14px;\n line-height: 1.4;\n white-space: nowrap;\n overflow: hidden;\n padding-right: 5px;\n text-overflow: ellipsis;\n max-width: 100%;\n}\n\n/* Popover */\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover {\n position: absolute;\n right: auto;\n box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.5);\n box-sizing: border-box;\n background: #9ca8b1;\n visibility: hidden;\n opacity: 0;\n transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after,\n.pushwoosh-subscribe-widget__popover__top:after {\n content: "";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-right: 8px solid transparent;\n border-left: 8px solid #9ca8b1;\n background: #9ca8b1;\n transform-origin: 0 0;\n transform: rotate(-45deg);\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after {\n border-bottom: 8px solid #9ca8b1;\n border-top: 8px solid transparent;\n box-sizing: border-box;\n box-shadow: -2px 2px 1px 0 rgba(0, 0, 0, 0.25);\n bottom: -16px;\n}\n\n.pushwoosh-subscribe-widget__popover__top:after {\n top: 0;\n border-top: 8px solid #9ca8b1;\n border-bottom: 8px solid transparent;\n box-sizing: border-box;\n box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__popover-content-wrapper {\n overflow: auto;\n max-width: 100%;\n}\n\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n display: flex;\n flex-direction: column;\n padding: 14px;\n box-sizing: border-box;\n float: left;\n min-width: 100%;\n align-items: center;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n display: block;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-bottom: 14px;\n}\n\n@media (max-width: 767px) and (orientation: portrait) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n flex-direction: column;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 0;\n margin-bottom: 14px;\n }\n}\n@media (max-width: 767px) and (orientation: landscape) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n flex-direction: row;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 14px;\n margin-bottom: 0;\n }\n}\n',t}createBell(){const{config:t}=this;let e;var o,i;return t.buttonImage?(e=document.createElement("img"),e.src=t.buttonImage):(e=document.createElement("div"),this.addStylesToElement({backgroundColor:t.bgColor,boxShadow:t.shadow,lineHeight:t.size,border:t.bellButtonBorder},e),e.innerHTML=(o=t.bellColor,i=t.bellStrokeColor,`<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:cc="http://creativecommons.org/ns#"\n xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n version="1.1"\n id="Capa_1"\n x="0px"\n y="0px"\n viewBox="0 0 346.013 346.013"\n style="enable-background:new 0 0 346.013 346.013;width: 80%; height: auto; vertical-align: middle;"\n xml:space="preserve"\n inkscape:version="0.91 r13725"\n sodipodi:docname="alarm_white.svg"><metadata\n id="metadata51"><rdf:RDF><cc:Work\n rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type\n rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\n id="defs49" /><sodipodi:namedview\n borderopacity="1"\n objecttolerance="10"\n gridtolerance="10"\n guidetolerance="10"\n inkscape:pageopacity="0"\n inkscape:pageshadow="2"\n inkscape:window-width="1618"\n inkscape:window-height="828"\n id="namedview47"\n showgrid="false"\n inkscape:zoom="0.6820553"\n inkscape:cx="173.0065"\n inkscape:cy="173.0065"\n inkscape:window-x="0"\n inkscape:window-y="0"\n inkscape:window-maximized="0"\n inkscape:current-layer="g3" /><g\n id="g3"><path\n d="m 256.76227,220.19006 c -1.77513,-2.69766 -3.45154,-5.24564 -3.98966,-7.46382 -0.042,-0.17861 -0.0911,-0.36128 -0.16237,-0.61436 -2.28354,-7.67647 0.69147,-24.43921 2.46886,-34.45124 0.26788,-1.50394 0.52274,-2.94197 0.75286,-4.29035 0.0232,-0.13675 0.044,-0.27211 0.0724,-0.48006 1.95582,-15.28051 2.58811,-37.91956 -5.51044,-58.99147 -5.6032,-14.57978 -14.45978,-25.82612 -26.3559,-33.48393 1.26598,-9.812938 -4.85967,-19.343691 -14.66682,-22.0511 -9.80715,-2.70741 -19.95724,2.33226 -23.90298,11.405413 -14.1382,0.467533 -27.51111,5.577097 -39.80114,15.219267 -17.76129,13.9298 -28.83431,33.68757 -34.99389,47.80757 l -0.0479,0.11335 c -0.0512,0.12175 -0.0998,0.24114 -0.13249,0.32962 -0.49733,1.28292 -1.01552,2.64514 -1.55689,4.07255 -3.61311,9.51043 -9.66004,25.42824 -15.611995,30.89342 -0.106524,0.10027 -0.208228,0.20187 -0.362362,0.35435 -1.636243,1.66563 -4.382941,2.99463 -7.288979,4.40101 -7.145531,3.45301 -22.013613,10.64166 -17.206389,31.67844 0.929154,4.07105 4.008437,7.29057 8.033861,8.40185 l 167.570804,46.2604 c 4.02253,1.11048 8.31521,-0.0729 11.2052,-3.08958 14.91617,-15.58874 5.84693,-29.38668 1.48625,-36.02133 z"\n id="path5"\n inkscape:connector-curvature="0"\n vector-effect="non-scaling-stroke"\n style="fill:${o}; stroke: ${i}; stroke-width: 1; " /><path\n vector-effect="non-scaling-stroke"\n d="m 174.26737,259.72378 -38.76399,-10.70137 c -1.59243,-0.43962 -3.28183,-0.15596 -4.63548,0.7754 -2.53909,1.7494 -2.84182,4.93159 -3.02304,6.83188 l -0.0151,0.15247 c -1.22819,12.67106 6.79854,24.33046 19.08688,27.72284 12.51583,3.45518 25.8324,-2.91586 30.9681,-14.80385 l 0.0935,-0.19205 c 0.52305,-1.06418 1.74613,-3.55554 0.50882,-6.31116 -0.44302,-0.98439 -1.5794,-2.74529 -4.21964,-3.47416 z"\n id="path7"\n inkscape:connector-curvature="0"\n style="fill:${o}; stroke: ${i}; stroke-width: 1;" /></g><g\n id="g17" /><g\n id="g19" /><g\n id="g21" /><g\n id="g23" /><g\n id="g25" /><g\n id="g27" /><g\n id="g29" /><g\n id="g31" /><g\n id="g33" /><g\n id="g35" /><g\n id="g37" /><g\n id="g39" /><g\n id="g41" /><g\n id="g43" /><g\n id="g45" /></svg>`)),this.addStylesToElement({width:t.size,height:t.size},e),e.className="pushwoosh-subscribe-widget__bell-button",e}async createTooltip(){const t=document.createElement("div"),[e,o]=d.getTooltipPosition(this.config.position,this.config.size);return t.className=`pushwoosh-subscribe-widget__tooltip pushwoosh-subscribe-widget__tooltip__${o}`,this.addStylesToElement(e,t),t.appendChild(await this.createTooltipContent()),t}async createTooltipContent(){const t=document.createElement("div");return t.innerText=await this.tooltipTextFactory(),t.className="pushwoosh-subscribe-widget__tooltip-content",t}async tooltipTextFactory(){const t=this.pw.driver.getPermission(),{tooltipText:e}=this.config,n=await this.pw.data.getStatusManualUnsubscribed();switch(t){case i:return n?e.needSubscribe:e.alreadySubscribed;case s:return e.needSubscribe;case o:return e.blockSubscribe;default:return e.needSubscribe}}createPopover(){const t=document.createElement("div"),e=document.createElement("div"),[o,i]=d.getPopoverPosition(this.config.position,this.config.size);e.className=`pushwoosh-subscribe-widget__popover pushwoosh-subscribe-widget__popover__${i}`,t.className="pushwoosh-subscribe-widget__popover-content-wrapper",this.style.innerHTML+=d.getPopoverArrowPosition(this.config.position,this.config.size);const s=Object.assign({maxWidth:`calc(100vw - ${this.config.indent} - ${this.config.indent})`},o);return this.addStylesToElement(s,e),t.appendChild(this.createPopoverContent()),e.appendChild(t),e}getBrowserName(){const t=this.pw.platformChecker;let e;return e=t.isOpera?"opera":11===t.platform&&navigator.userAgent.match(/Android/i)?"mobileChrome":12===t.platform?"firefox":10===t.platform?"safari":150===t.platform?"edge":"chrome",e}createPopoverContent(){const{config:t}=this,e=document.createElement("div");e.className="pushwoosh-subscribe-widget__popover-content";const o=this.getBrowserName(),i=t.contentImages&&t.contentImages[o];if(i){const t=document.createElement("img");t.src=i,e.appendChild(t)}else{const t={opera:"opera",mobileChrome:"mobile_chrome",firefox:"FF",safari:"safari"}[o]||"chrome";[{src:this.getImageSrc(t),width:500,height:130},{src:this.getImageSrc(`${t}_unlock`),width:500,height:230}].forEach(t=>{const o=document.createElement("img");Object.assign(o,t),e.appendChild(o)})}return e}getImageSrc(t){return`https://cdn.pushwoosh.com/webpush/img/${t}.jpg`}async render(){this.widget=this.createContainer(),this.style=this.createStyle();const t=this.createBell();this.tooltip=await this.createTooltip(),this.popover=await this.createPopover(),this.widget.appendChild(this.style),this.widget.appendChild(t),this.widget.appendChild(this.tooltip),this.widget.appendChild(this.popover),document.body.appendChild(this.widget),this.pw.push(["onSubscribe",this.onSubscribeEvent]),this.pw.push(["onUnsubscribe",this.onUnsubscribeEvent]),this.pw.push(["onPermissionDenied",this.onPermissionDeniedEvent]),this.addEventListeners()}addEventListeners(){this.widget.addEventListener("click",this.clickBell),window.addEventListener("click",this.clickOutOfPopover)}toggleHelpPopover(){this.popover.classList.toggle("pushwoosh-subscribe-widget__popover__visible")}async clickBell(){switch(this.pw.driver.getPermission()){case i:case s:await this.pw.subscribe();break;case o:this.toggleHelpPopover();break;default:console.warn("Unknown browser notification permission")}}async onSubscribeEvent(){const t=this.tooltip.querySelector("div");null!==t&&(t.innerText=this.config.tooltipText.successSubscribe,this.tooltip.classList.add("pushwoosh-subscribe-widget__tooltip__visible"),setTimeout(async()=>{this.tooltip.classList.remove("pushwoosh-subscribe-widget__tooltip__visible"),t.innerText=await this.tooltipTextFactory(),this.widget.classList.add("pushwoosh-subscribe-widget__subscribed")},2e3))}async onPermissionDeniedEvent(){this.addEventListeners();const t=this.tooltip.querySelector("div");null!==t&&(t.innerText=await this.tooltipTextFactory())}clickOutOfPopover(t){this.popover.classList.contains("pushwoosh-subscribe-widget__popover__visible")&&!t.target.classList.contains("pushwoosh-subscribe-widget__popover")&&null===t.target.closest(".pushwoosh-subscribe-widget__popover")&&!t.target.classList.contains("pushwoosh-subscribe-widget__bell-button")&&null===t.target.closest(".pushwoosh-subscribe-widget__bell-button")&&this.popover.classList.remove("pushwoosh-subscribe-widget__popover__visible")}async onUnsubscribeEvent(){const t=this.tooltip.querySelector("div");null!==t&&(t.innerText=await this.tooltipTextFactory())}}return e})());
|
|
2
2
|
//# sourceMappingURL=widget-subscription-button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-subscription-button.js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JA,EAAeC,gBAAkBlH,KAAKmH,qBACxC","sources":["webpack://web-push-notifications/webpack/universalModuleDefinition","webpack://web-push-notifications/webpack/bootstrap","webpack://web-push-notifications/webpack/runtime/define property getters","webpack://web-push-notifications/webpack/runtime/hasOwnProperty shorthand","webpack://web-push-notifications/webpack/runtime/make namespace object","webpack://web-push-notifications/./src/core/constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/bell.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/positioning.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const DEFAULT_SERVICE_WORKER_URL = '/pushwoosh-service-worker.js';\nexport const DEFAULT_API_URL = 'https://api.pushwoosh.com/json/1.3/';\n\nexport const PERIOD_SEND_APP_OPEN = 3600000;\nexport const PERIOD_GOAL_EVENT = 86400000;\n\nexport const DEFAULT_NOTIFICATION_TITLE = 'Pushwoosh notification';\nexport const DEFAULT_NOTIFICATION_IMAGE = 'https://cp.pushwoosh.com/img/logo-medium.png';\n\n// Keys\nexport const KEY_SHOW_SUBSCRIBE_WIDGET = 'WIDGET_SHOWED';\nexport const KEY_CLICK_SUBSCRIBE_WIDGET = 'WIDGET_CLICKED';\n\n// Local storage keys\nexport const KEY_DEVICE_REGISTRATION_STATUS: string = 'deviceRegistrationStatus';\nexport const KEY_SAFARI_PREVIOUS_PERMISSION = 'safariPreviousPermission';\nexport const MANUAL_SET_LOGGER_LEVEL = 'PW_SET_LOGGER_LEVEL';\n\n// Device registration status\nexport const DEVICE_REGISTRATION_STATUS_REGISTERED: string = 'registered';\nexport const DEVICE_REGISTRATION_STATUS_UNREGISTERED: string = 'unregistered';\n\n// Permissions\nexport const PERMISSION_DENIED = 'denied';\nexport const PERMISSION_GRANTED = 'granted';\nexport const PERMISSION_PROMPT = 'default';\n\n// Events\nexport const LEGACY_EVENT_ON_LOAD = 'onLoad';\nexport const LEGACY_EVENT_ON_READY = 'onReady';\nexport const LEGACY_EVENT_ON_SUBSCRIBE = 'onSubscribe';\nexport const LEGACY_EVENT_ON_UNSUBSCRIBE = 'onUnsubscribe';\nexport const LEGACY_EVENT_ON_REGISTER = 'onRegister';\nexport const LEGACY_EVENT_ON_PERMISSION_PROMPT = 'onPermissionPrompt';\nexport const LEGACY_EVENT_ON_PERMISSION_DENIED = 'onPermissionDenied';\nexport const LEGACY_EVENT_ON_PERMISSION_GRANTED = 'onPermissionGranted';\nexport const LEGACY_EVENT_ON_SW_INIT_ERROR = 'onSWInitError';\nexport const LEGACY_EVENT_ON_PUSH_DELIVERY = 'onPushDelivery';\nexport const LEGACY_EVENT_ON_NOTIFICATION_CLICK = 'onNotificationClick';\nexport const LEGACY_EVENT_ON_NOTIFICATION_CLOSE = 'onNotificationClose';\nexport const LEGACY_EVENT_ON_CHANGE_COMMUNICATION_ENABLED = 'onChangeCommunicationEnabled';\nexport const LEGACY_EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE = 'onPutNewMessageToInboxStore';\nexport const LEGACY_EVENT_ON_UPDATE_INBOX_MESSAGES = 'onUpdateInboxMessages';\nexport const LEGACY_EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG = 'onShowNotificationPermissionDialog';\nexport const LEGACY_EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG = 'onHideNotificationPermissionDialog';\n\nexport const LEGACY_EVENT_ON_SHOW_SUBSCRIPTION_WIDGET = 'onShowSubscriptionWidget';\nexport const LEGACY_EVENT_ON_HIDE_SUBSCRIPTION_WIDGET = 'onHideSubscriptionWidget';\n\n// Post Events\nexport const EVENT_SHOW_SUBSCRIBE_BUTTON = 'showSubscribeButton';\nexport const EVENT_CLICK_SUBSCRIBE_BUTTON = 'clickSubscribeButton';\nexport const EVENT_GDPR_CONSENT = 'GDPRConsent';\nexport const EVENT_GDPR_DELETE = 'GDPRDelete';\nexport const EVENT_PW_SITE_OPENED = 'PW_SiteOpened'; // for default events\n\n// Page visited\nexport const PAGE_VISITED_URL = 'PAGE_VISITED_URL';\n","export default (fillColor: string, strokeColor: string) => {\n return '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\\n'\n + '<svg\\n'\n + ' xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\\n'\n + ' xmlns:cc=\"http://creativecommons.org/ns#\"\\n'\n + ' xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\\n'\n + ' xmlns:svg=\"http://www.w3.org/2000/svg\"\\n'\n + ' xmlns=\"http://www.w3.org/2000/svg\"\\n'\n + ' xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\\n'\n + ' xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\\n'\n + ' version=\"1.1\"\\n'\n + ' id=\"Capa_1\"\\n'\n + ' x=\"0px\"\\n'\n + ' y=\"0px\"\\n'\n + ' viewBox=\"0 0 346.013 346.013\"\\n'\n + ' style=\"enable-background:new 0 0 346.013 346.013;width: 80%; height: auto; vertical-align: middle;\"\\n'\n + ' xml:space=\"preserve\"\\n'\n + ' inkscape:version=\"0.91 r13725\"\\n'\n + ' sodipodi:docname=\"alarm_white.svg\"><metadata\\n'\n + ' id=\"metadata51\"><rdf:RDF><cc:Work\\n'\n + ' rdf:about=\"\"><dc:format>image/svg+xml</dc:format><dc:type\\n'\n + ' rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\\n'\n + ' id=\"defs49\" /><sodipodi:namedview\\n'\n + ' borderopacity=\"1\"\\n'\n + ' objecttolerance=\"10\"\\n'\n + ' gridtolerance=\"10\"\\n'\n + ' guidetolerance=\"10\"\\n'\n + ' inkscape:pageopacity=\"0\"\\n'\n + ' inkscape:pageshadow=\"2\"\\n'\n + ' inkscape:window-width=\"1618\"\\n'\n + ' inkscape:window-height=\"828\"\\n'\n + ' id=\"namedview47\"\\n'\n + ' showgrid=\"false\"\\n'\n + ' inkscape:zoom=\"0.6820553\"\\n'\n + ' inkscape:cx=\"173.0065\"\\n'\n + ' inkscape:cy=\"173.0065\"\\n'\n + ' inkscape:window-x=\"0\"\\n'\n + ' inkscape:window-y=\"0\"\\n'\n + ' inkscape:window-maximized=\"0\"\\n'\n + ' inkscape:current-layer=\"g3\" /><g\\n'\n + ' id=\"g3\"><path\\n'\n + ' d=\"m 256.76227,220.19006 c -1.77513,-2.69766 -3.45154,-5.24564 -3.98966,-7.46382 -0.042,-0.17861 -0.0911,-0.36128 -0.16237,-0.61436 -2.28354,-7.67647 0.69147,-24.43921 2.46886,-34.45124 0.26788,-1.50394 0.52274,-2.94197 0.75286,-4.29035 0.0232,-0.13675 0.044,-0.27211 0.0724,-0.48006 1.95582,-15.28051 2.58811,-37.91956 -5.51044,-58.99147 -5.6032,-14.57978 -14.45978,-25.82612 -26.3559,-33.48393 1.26598,-9.812938 -4.85967,-19.343691 -14.66682,-22.0511 -9.80715,-2.70741 -19.95724,2.33226 -23.90298,11.405413 -14.1382,0.467533 -27.51111,5.577097 -39.80114,15.219267 -17.76129,13.9298 -28.83431,33.68757 -34.99389,47.80757 l -0.0479,0.11335 c -0.0512,0.12175 -0.0998,0.24114 -0.13249,0.32962 -0.49733,1.28292 -1.01552,2.64514 -1.55689,4.07255 -3.61311,9.51043 -9.66004,25.42824 -15.611995,30.89342 -0.106524,0.10027 -0.208228,0.20187 -0.362362,0.35435 -1.636243,1.66563 -4.382941,2.99463 -7.288979,4.40101 -7.145531,3.45301 -22.013613,10.64166 -17.206389,31.67844 0.929154,4.07105 4.008437,7.29057 8.033861,8.40185 l 167.570804,46.2604 c 4.02253,1.11048 8.31521,-0.0729 11.2052,-3.08958 14.91617,-15.58874 5.84693,-29.38668 1.48625,-36.02133 z\"\\n'\n + ' id=\"path5\"\\n'\n + ' inkscape:connector-curvature=\"0\"\\n'\n + ' vector-effect=\"non-scaling-stroke\"\\n'\n + ` style=\"fill:${fillColor}; stroke: ${strokeColor}; stroke-width: 1; \" /><path\\n`\n + ' vector-effect=\"non-scaling-stroke\"\\n'\n + ' d=\"m 174.26737,259.72378 -38.76399,-10.70137 c -1.59243,-0.43962 -3.28183,-0.15596 -4.63548,0.7754 -2.53909,1.7494 -2.84182,4.93159 -3.02304,6.83188 l -0.0151,0.15247 c -1.22819,12.67106 6.79854,24.33046 19.08688,27.72284 12.51583,3.45518 25.8324,-2.91586 30.9681,-14.80385 l 0.0935,-0.19205 c 0.52305,-1.06418 1.74613,-3.55554 0.50882,-6.31116 -0.44302,-0.98439 -1.5794,-2.74529 -4.21964,-3.47416 z\"\\n'\n + ' id=\"path7\"\\n'\n + ' inkscape:connector-curvature=\"0\"\\n'\n + ` style=\"fill:${fillColor}; stroke: ${strokeColor}; stroke-width: 1;\" /></g><g\\n`\n + ' id=\"g17\" /><g\\n'\n + ' id=\"g19\" /><g\\n'\n + ' id=\"g21\" /><g\\n'\n + ' id=\"g23\" /><g\\n'\n + ' id=\"g25\" /><g\\n'\n + ' id=\"g27\" /><g\\n'\n + ' id=\"g29\" /><g\\n'\n + ' id=\"g31\" /><g\\n'\n + ' id=\"g33\" /><g\\n'\n + ' id=\"g35\" /><g\\n'\n + ' id=\"g37\" /><g\\n'\n + ' id=\"g39\" /><g\\n'\n + ' id=\"g41\" /><g\\n'\n + ' id=\"g43\" /><g\\n'\n + ' id=\"g45\" /></svg>';\n};\n","// Bell\nimport { type TBellConfig } from './subscribe_widget.types';\n\nexport const BELL_POSITION_BOTTOM_RIGHT = 'bottomRight';\nexport const BELL_POSITION_BOTTOM_LEFT = 'bottomLeft';\nexport const BELL_POSITION_TOP_RIGHT = 'topRight';\nexport const BELL_POSITION_TOP_LEFT = 'topLeft';\n\n// Common\nexport const WIDGET_CONTAINER_ID = 'pushwooshBellWidget';\n\nexport const SUBSCRIBE_WIDGET_DEFAULT_CONFIG: TBellConfig = {\n position: BELL_POSITION_BOTTOM_LEFT,\n bgColor: '#12AE7E',\n bellColor: 'white',\n bellStrokeColor: '#08754f',\n bellButtonBorder: '1px solid #379676',\n shadow: '0px 0px 6px rgba(0, 0, 0, 0.75)',\n size: '48px',\n indent: '20px',\n zIndex: '999999',\n tooltipText: {\n successSubscribe: 'You are successfully subscribed!',\n needSubscribe: 'Get notifications about important news!',\n blockSubscribe: 'Click to see how to get notifications',\n alreadySubscribed: 'You are already subscribed',\n },\n};\n","import {\n BELL_POSITION_TOP_RIGHT,\n BELL_POSITION_TOP_LEFT,\n BELL_POSITION_BOTTOM_LEFT,\n BELL_POSITION_BOTTOM_RIGHT,\n} from './constants';\nimport { type TBellPosition, type TPositionStyles } from './subscribe_widget.types';\n\nexport default class Positioning {\n public static getBellPosition(position: TBellPosition, indent: string): TPositionStyles {\n let positionStyles: TPositionStyles;\n\n switch (position) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = {\n top: 'auto',\n left: 'auto',\n bottom: indent,\n right: indent,\n };\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = {\n top: 'auto',\n left: indent,\n bottom: indent,\n right: 'auto',\n };\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = {\n top: indent,\n left: indent,\n bottom: 'auto',\n right: 'auto',\n };\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = {\n top: indent,\n left: 'auto',\n bottom: 'auto',\n right: indent,\n };\n break;\n default:\n positionStyles = {\n top: 'auto',\n left: 'auto',\n bottom: indent,\n right: indent,\n };\n }\n\n return positionStyles;\n }\n\n public static getTooltipPosition(bellPosition: TBellPosition, bellSize: string): [{ left: string } | { right: string }, string] {\n let positionStyles;\n let tooltipModification;\n const increaseIndent = (parseInt(bellSize) + 12) + 'px';\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = { left: increaseIndent };\n tooltipModification = 'left';\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = { left: increaseIndent };\n tooltipModification = 'left';\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n break;\n default:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n }\n\n return [positionStyles, tooltipModification];\n }\n\n public static getPopoverPosition(bellPosition: TBellPosition, bellSize: string): [TPositionStyles, string] {\n let positionStyles;\n let popoverModification;\n const increaseIndent = (parseInt(bellSize) + 15) + 'px';\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = {\n bottom: increaseIndent,\n right: '0',\n left: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = {\n bottom: increaseIndent,\n left: '0',\n right: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = {\n top: increaseIndent,\n left: '0',\n right: 'auto',\n bottom: 'auto',\n };\n popoverModification = 'top';\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = {\n top: increaseIndent,\n right: '0',\n left: 'auto',\n bottom: 'auto',\n };\n popoverModification = 'top';\n break;\n default:\n positionStyles = {\n bottom: increaseIndent,\n right: '0',\n left: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n }\n\n return [positionStyles, popoverModification];\n }\n\n public static getPopoverArrowPosition(bellPosition: TBellPosition, bellSize: string) {\n let arrowAdditionalStyles;\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {right: auto; left: ${(parseInt(bellSize) / 2 - 12) + 'px'}`;\n break;\n case BELL_POSITION_TOP_LEFT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__top:after {right: auto; left: ${(parseInt(bellSize) / 2 - 12) + 'px'}`;\n break;\n case BELL_POSITION_TOP_RIGHT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__top:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n break;\n default:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n }\n\n return arrowAdditionalStyles;\n }\n}\n","import {\n PERMISSION_GRANTED,\n PERMISSION_DENIED,\n PERMISSION_PROMPT,\n} from '../../core/constants';\nimport mainCss from './assets/css/main.css';\nimport bellSVG from './bell';\nimport {\n SUBSCRIBE_WIDGET_DEFAULT_CONFIG,\n WIDGET_CONTAINER_ID,\n} from './constants';\nimport Positioning from './positioning';\nimport { type TBellConfig, type TCSSStylesObject, type TStyleKeys } from './subscribe_widget.types';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\nimport {\n type TPlatformChrome,\n type TPlatformEdge,\n type TPlatformFirefox,\n type TPlatformSafari,\n} from '../../modules/PlatformChecker/PlatformChecker.types';\n\nexport class PWSubscriptionButtonWidget {\n widget: HTMLElement;\n tooltip: HTMLElement;\n popover: HTMLElement;\n style: HTMLElement;\n pw: Pushwoosh;\n config: TBellConfig;\n\n constructor(pw: Pushwoosh) {\n // Set Pushwoosh object\n this.pw = pw;\n if (!pw.platformChecker.isAvailableNotifications) {\n console.warn('Browser does not support push notifications');\n return;\n }\n\n // Bindings\n this.clickBell = this.clickBell.bind(this);\n this.onSubscribeEvent = this.onSubscribeEvent.bind(this);\n this.onUnsubscribeEvent = this.onUnsubscribeEvent.bind(this);\n this.onPermissionDeniedEvent = this.onPermissionDeniedEvent.bind(this);\n this.clickOutOfPopover = this.clickOutOfPopover.bind(this);\n\n // Config\n const tooltipText = Object.assign(SUBSCRIBE_WIDGET_DEFAULT_CONFIG.tooltipText, pw.initParams.subscribeWidget!.tooltipText);\n this.config = Object.assign({}, SUBSCRIBE_WIDGET_DEFAULT_CONFIG, pw.initParams.subscribeWidget);\n this.config.tooltipText = tooltipText;\n }\n\n public async run() {\n const isSubscribed = await this.pw.isSubscribed();\n if (!isSubscribed) {\n await this.render();\n }\n }\n\n /**\n * Apply styles to element\n * @param styles\n * @param {HTMLElement} element\n */\n private addStylesToElement(styles: TCSSStylesObject, element: HTMLElement) {\n Object.keys(styles).forEach((st: TStyleKeys) => {\n element.style[st] = styles[st];\n });\n }\n\n /**\n * Create container element\n * @returns {HTMLElement}\n */\n private createContainer(): HTMLElement {\n const container = document.createElement('div');\n container.id = WIDGET_CONTAINER_ID;\n container.className = 'pushwoosh-subscribe-widget';\n const position = Positioning.getBellPosition(this.config.position, this.config.indent);\n const styles = Object.assign({\n zIndex: this.config.zIndex,\n }, position);\n this.addStylesToElement(styles, container);\n return container;\n }\n\n /**\n * Create styles element\n * @returns {HTMLElement}\n */\n private createStyle(): HTMLElement {\n const styleNode = document.createElement('style');\n styleNode.innerHTML = mainCss;\n return styleNode;\n }\n\n /**\n * Create cell button element\n * @returns {HTMLElement}\n */\n private createBell(): HTMLElement {\n const { config } = this;\n let bell;\n if (config.buttonImage) {\n bell = document.createElement('img') as HTMLImageElement;\n bell.src = config.buttonImage;\n } else {\n bell = document.createElement('div');\n this.addStylesToElement({\n backgroundColor: config.bgColor,\n boxShadow: config.shadow,\n lineHeight: config.size,\n border: config.bellButtonBorder,\n }, bell);\n\n bell.innerHTML = bellSVG(config.bellColor, config.bellStrokeColor);\n }\n this.addStylesToElement({\n width: config.size,\n height: config.size,\n }, bell);\n bell.className = 'pushwoosh-subscribe-widget__bell-button';\n return bell;\n }\n\n /**\n * Create tooltip element\n * @returns {Promise<HTMLElement>}\n */\n private async createTooltip(): Promise<HTMLElement> {\n const tooltip = document.createElement('div');\n const [position, modification] = Positioning.getTooltipPosition(this.config.position, this.config.size);\n tooltip.className = `pushwoosh-subscribe-widget__tooltip pushwoosh-subscribe-widget__tooltip__${modification}`;\n this.addStylesToElement(position, tooltip);\n\n tooltip.appendChild(await this.createTooltipContent());\n return tooltip;\n }\n\n /**\n * Create tooltip content element\n * @returns {Promise<HTMLElement>}\n */\n private async createTooltipContent(): Promise<HTMLElement> {\n const tooltipContent = document.createElement('div');\n tooltipContent.innerText = await this.tooltipTextFactory();\n tooltipContent.className = 'pushwoosh-subscribe-widget__tooltip-content';\n return tooltipContent;\n }\n\n /**\n * Tooltip text content depending of the permissions\n * @returns {Promise<string>}\n */\n private async tooltipTextFactory(): Promise<string> {\n const permission = this.pw.driver.getPermission();\n const { tooltipText } = this.config;\n const isManuallyUnsubscribed = await this.pw.data.getStatusManualUnsubscribed();\n\n switch (permission) {\n case PERMISSION_GRANTED:\n return isManuallyUnsubscribed ? tooltipText.needSubscribe : tooltipText.alreadySubscribed;\n case PERMISSION_PROMPT:\n return tooltipText.needSubscribe;\n case PERMISSION_DENIED:\n return tooltipText.blockSubscribe;\n default:\n return tooltipText.needSubscribe;\n }\n }\n\n /**\n * Create permission denied popover element\n * @returns {HTMLElement}\n */\n private createPopover(): HTMLElement {\n const popoverContentWrapper = document.createElement('div');\n const popover = document.createElement('div');\n const [position, modification] = Positioning.getPopoverPosition(this.config.position, this.config.size);\n popover.className = `pushwoosh-subscribe-widget__popover pushwoosh-subscribe-widget__popover__${modification}`;\n popoverContentWrapper.className = 'pushwoosh-subscribe-widget__popover-content-wrapper';\n\n this.style.innerHTML += Positioning.getPopoverArrowPosition(this.config.position, this.config.size);\n\n const styles = Object.assign({\n maxWidth: `calc(100vw - ${this.config.indent} - ${this.config.indent})`,\n }, position);\n this.addStylesToElement(styles, popover);\n\n popoverContentWrapper.appendChild(this.createPopoverContent());\n popover.appendChild(popoverContentWrapper);\n return popover;\n }\n\n private getBrowserName() {\n const platformChecker = this.pw.platformChecker;\n let browser;\n if (platformChecker.isOpera) {\n browser = 'opera';\n } else if (<TPlatformChrome>platformChecker.platform === 11 && navigator.userAgent.match(/Android/i)) {\n browser = 'mobileChrome';\n } else if (<TPlatformFirefox>platformChecker.platform === 12) {\n browser = 'firefox';\n } else if (<TPlatformSafari>platformChecker.platform === 10) {\n browser = 'safari';\n } else if (<TPlatformEdge>platformChecker.platform === 150) {\n browser = 'edge';\n } else {\n browser = 'chrome';\n }\n return browser;\n }\n\n /**\n * Create permission denied popover content element\n * @returns {HTMLElement}\n */\n private createPopoverContent(): HTMLElement {\n const { config } = this;\n const popoverContent = document.createElement('div');\n popoverContent.className = 'pushwoosh-subscribe-widget__popover-content';\n\n const browser = this.getBrowserName();\n\n const userImageSrc = config.contentImages && config.contentImages[browser];\n if (userImageSrc) {\n const image = document.createElement('img') as HTMLImageElement;\n image.src = userImageSrc;\n popoverContent.appendChild(image);\n } else {\n const standardImagesMap: Record<string, string> = {\n opera: 'opera',\n mobileChrome: 'mobile_chrome',\n firefox: 'FF',\n safari: 'safari',\n };\n const standardImage = standardImagesMap[browser] || 'chrome';\n [{\n src: this.getImageSrc(standardImage),\n width: 500,\n height: 130,\n }, {\n src: this.getImageSrc(`${standardImage}_unlock`),\n width: 500,\n height: 230,\n }].forEach((imageAttrs) => {\n const image = document.createElement('img');\n Object.assign(image, imageAttrs);\n popoverContent.appendChild(image);\n });\n }\n\n return popoverContent;\n }\n\n /**\n * Return source of help images depending of the browser\n * @returns {string}\n */\n getImageSrc(img: string): string {\n return `https://cdn.pushwoosh.com/webpush/img/${img}.jpg`;\n }\n\n private async render() {\n this.widget = this.createContainer();\n this.style = this.createStyle();\n const bell = this.createBell();\n this.tooltip = await this.createTooltip();\n this.popover = await this.createPopover();\n\n this.widget.appendChild(this.style);\n this.widget.appendChild(bell);\n this.widget.appendChild(this.tooltip);\n this.widget.appendChild(this.popover);\n\n document.body.appendChild(this.widget);\n\n this.pw.push(['onSubscribe', this.onSubscribeEvent]);\n this.pw.push(['onUnsubscribe', this.onUnsubscribeEvent]);\n this.pw.push(['onPermissionDenied', this.onPermissionDeniedEvent]);\n\n this.addEventListeners();\n }\n\n addEventListeners() {\n this.widget.addEventListener('click', this.clickBell);\n window.addEventListener('click', this.clickOutOfPopover);\n }\n\n /**\n * Toggle visibility of popover\n */\n toggleHelpPopover() {\n this.popover.classList.toggle('pushwoosh-subscribe-widget__popover__visible');\n }\n\n /**\n * Click bell button event callback\n * @returns {Promise<void>}\n */\n private async clickBell() {\n const permission = this.pw.driver.getPermission();\n\n switch (permission) {\n case PERMISSION_GRANTED:\n await this.pw.subscribe();\n\n break;\n case PERMISSION_PROMPT:\n await this.pw.subscribe();\n\n break;\n case PERMISSION_DENIED:\n this.toggleHelpPopover();\n\n break;\n default:\n console.warn('Unknown browser notification permission');\n }\n }\n\n /**\n * On subscribe event callback\n * @returns {Promise<void>}\n */\n private async onSubscribeEvent() {\n const tooltipContent = this.tooltip.querySelector('div');\n\n if (tooltipContent === null) {\n return;\n }\n\n tooltipContent.innerText = this.config.tooltipText.successSubscribe;\n this.tooltip.classList.add('pushwoosh-subscribe-widget__tooltip__visible');\n\n setTimeout(async () => {\n this.tooltip.classList.remove('pushwoosh-subscribe-widget__tooltip__visible');\n tooltipContent.innerText = await this.tooltipTextFactory();\n\n this.widget.classList.add('pushwoosh-subscribe-widget__subscribed');\n }, 2000);\n }\n\n /**\n * On permission denied event\n * @returns {Promise<void>}\n */\n private async onPermissionDeniedEvent(): Promise<void> {\n this.addEventListeners();\n\n const tooltipContent = this.tooltip.querySelector('div');\n if (tooltipContent === null) return;\n tooltipContent.innerText = await this.tooltipTextFactory();\n }\n\n /**\n * Out of popover click event\n * @param {MessageEvent} ev\n */\n clickOutOfPopover(ev: MessageEvent) {\n const closeRule = this.popover.classList.contains('pushwoosh-subscribe-widget__popover__visible')\n && !(ev.target as any).classList.contains('pushwoosh-subscribe-widget__popover')\n && (ev.target as any).closest('.pushwoosh-subscribe-widget__popover') === null\n && !(ev.target as any).classList.contains('pushwoosh-subscribe-widget__bell-button')\n && (ev.target as any).closest('.pushwoosh-subscribe-widget__bell-button') === null;\n\n if (closeRule) this.popover.classList.remove('pushwoosh-subscribe-widget__popover__visible');\n }\n\n private async onUnsubscribeEvent() {\n const tooltipContent = this.tooltip.querySelector('div');\n\n if (tooltipContent === null) {\n return;\n }\n\n tooltipContent.innerText = await this.tooltipTextFactory();\n }\n}\n"],"names":["root","factory","exports","module","define","amd","a","i","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","PERMISSION_DENIED","PERMISSION_GRANTED","PERMISSION_PROMPT","SubscriptionButton_bell","fillColor","strokeColor","getOwnPropertyDescriptor","writable","configurable","BELL_POSITION_BOTTOM_RIGHT","BELL_POSITION_BOTTOM_LEFT","BELL_POSITION_TOP_RIGHT","BELL_POSITION_TOP_LEFT","SUBSCRIBE_WIDGET_DEFAULT_CONFIG","position","bgColor","bellColor","bellStrokeColor","bellButtonBorder","shadow","size","indent","zIndex","tooltipText","successSubscribe","needSubscribe","blockSubscribe","alreadySubscribed","Positioning","getBellPosition","positionStyles","top","left","bottom","right","getTooltipPosition","bellPosition","bellSize","tooltipModification","increaseIndent","parseInt","getPopoverPosition","popoverModification","getPopoverArrowPosition","arrowAdditionalStyles","PWSubscriptionButtonWidget","constructor","pw","platformChecker","isAvailableNotifications","console","warn","clickBell","bind","onSubscribeEvent","onUnsubscribeEvent","onPermissionDeniedEvent","clickOutOfPopover","assign","initParams","subscribeWidget","config","run","isSubscribed","render","addStylesToElement","styles","element","keys","forEach","st","style","createContainer","container","document","createElement","id","className","createStyle","styleNode","innerHTML","createBell","bell","buttonImage","src","backgroundColor","boxShadow","lineHeight","border","width","height","createTooltip","tooltip","modification","appendChild","createTooltipContent","tooltipContent","innerText","tooltipTextFactory","permission","driver","getPermission","isManuallyUnsubscribed","data","getStatusManualUnsubscribed","createPopover","popoverContentWrapper","popover","maxWidth","createPopoverContent","getBrowserName","browser","isOpera","platform","navigator","userAgent","match","popoverContent","userImageSrc","contentImages","image","standardImage","opera","mobileChrome","firefox","safari","getImageSrc","imageAttrs","img","widget","body","push","addEventListeners","addEventListener","window","toggleHelpPopover","classList","toggle","subscribe","querySelector","add","setTimeout","async","remove","ev","contains","target","closest"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"widget-subscription-button.js","mappings":"CAAA,SAAAA,EAAAC,GACA,oBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,SACA,sBAAAG,QAAAA,OAAAC,IACAD,OAAA,GAAAH,OACA,CACA,IAAAK,EAAAL,IACA,QAAAM,KAAAD,GAAA,iBAAAJ,QAAAA,QAAAF,GAAAO,GAAAD,EAAAC,EACA,CACC,CATD,CASCC,KAAA,uBCRD,IAAAC,EAAA,CCAAA,EAAA,CAAAP,EAAAQ,KACA,QAAAC,KAAAD,EACAD,EAAAG,EAAAF,EAAAC,KAAAF,EAAAG,EAAAV,EAAAS,IACAE,OAAAC,eAAAZ,EAAAS,EAAA,CAAyCI,YAAA,EAAAC,IAAAN,EAAAC,MCJz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YAAYC,iBACnDnC,KAAKyG,QAAQ4C,UAAUI,IAAI,gDAE3BC,WAAWC,UACT3J,KAAKyG,QAAQ4C,UAAUO,OAAO,gDAC9B/C,EAAeC,gBAAkB9G,KAAK+G,qBAEtC/G,KAAK8I,OAAOO,UAAUI,IAAI,2CACzB,KACL,CAMQ,6BAAMtF,GACZnE,KAAKiJ,oBAEL,MAAMpC,EAAiB7G,KAAKyG,QAAQ+C,cAAc,OAC3B,OAAnB3C,IACJA,EAAeC,gBAAkB9G,KAAK+G,qBACxC,CAMA,iBAAA3C,CAAkByF,GACE7J,KAAKwH,QAAQ6B,UAAUS,SAAS,kDAC3CD,EAAGE,OAAeV,UAAUS,SAAS,wCACgC,OAAtED,EAAGE,OAAeC,QAAQ,0CACzBH,EAAGE,OAAeV,UAAUS,SAAS,4CACoC,OAA1ED,EAAGE,OAAeC,QAAQ,6CAEjBhK,KAAKwH,QAAQ6B,UAAUO,OAAO,+CAC/C,CAEQ,wBAAM1F,GACZ,MAAM2C,EAAiB7G,KAAKyG,QAAQ+C,cAAc,OAE3B,OAAnB3C,IAIJA,EAAeC,gBAAkB9G,KAAK+G,qBACxC","sources":["webpack://web-push-notifications/webpack/universalModuleDefinition","webpack://web-push-notifications/webpack/bootstrap","webpack://web-push-notifications/webpack/runtime/define property getters","webpack://web-push-notifications/webpack/runtime/hasOwnProperty shorthand","webpack://web-push-notifications/webpack/runtime/make namespace object","webpack://web-push-notifications/./src/core/constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/constants.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/positioning.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/index.ts","webpack://web-push-notifications/./src/widgets/SubscriptionButton/bell.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const DEFAULT_SERVICE_WORKER_URL = '/pushwoosh-service-worker.js';\nexport const DEFAULT_API_URL = 'https://api.pushwoosh.com/json/1.3/';\n\nexport const PERIOD_SEND_APP_OPEN = 3600000;\nexport const PERIOD_GOAL_EVENT = 86400000;\n\nexport const DEFAULT_NOTIFICATION_TITLE = 'Pushwoosh notification';\nexport const DEFAULT_NOTIFICATION_IMAGE = 'https://cp.pushwoosh.com/img/logo-medium.png';\n\n// Keys\nexport const KEY_SHOW_SUBSCRIBE_WIDGET = 'WIDGET_SHOWED';\nexport const KEY_CLICK_SUBSCRIBE_WIDGET = 'WIDGET_CLICKED';\n\n// Local storage keys\nexport const KEY_DEVICE_REGISTRATION_STATUS: string = 'deviceRegistrationStatus';\nexport const KEY_SAFARI_PREVIOUS_PERMISSION = 'safariPreviousPermission';\nexport const MANUAL_SET_LOGGER_LEVEL = 'PW_SET_LOGGER_LEVEL';\n\n// Device registration status\nexport const DEVICE_REGISTRATION_STATUS_REGISTERED: string = 'registered';\nexport const DEVICE_REGISTRATION_STATUS_UNREGISTERED: string = 'unregistered';\n\n// Permissions\nexport const PERMISSION_DENIED = 'denied';\nexport const PERMISSION_GRANTED = 'granted';\nexport const PERMISSION_PROMPT = 'default';\n\n// Events\nexport const LEGACY_EVENT_ON_LOAD = 'onLoad';\nexport const LEGACY_EVENT_ON_READY = 'onReady';\nexport const LEGACY_EVENT_ON_SUBSCRIBE = 'onSubscribe';\nexport const LEGACY_EVENT_ON_UNSUBSCRIBE = 'onUnsubscribe';\nexport const LEGACY_EVENT_ON_REGISTER = 'onRegister';\nexport const LEGACY_EVENT_ON_PERMISSION_PROMPT = 'onPermissionPrompt';\nexport const LEGACY_EVENT_ON_PERMISSION_DENIED = 'onPermissionDenied';\nexport const LEGACY_EVENT_ON_PERMISSION_GRANTED = 'onPermissionGranted';\nexport const LEGACY_EVENT_ON_SW_INIT_ERROR = 'onSWInitError';\nexport const LEGACY_EVENT_ON_PUSH_DELIVERY = 'onPushDelivery';\nexport const LEGACY_EVENT_ON_NOTIFICATION_CLICK = 'onNotificationClick';\nexport const LEGACY_EVENT_ON_NOTIFICATION_CLOSE = 'onNotificationClose';\nexport const LEGACY_EVENT_ON_CHANGE_COMMUNICATION_ENABLED = 'onChangeCommunicationEnabled';\nexport const LEGACY_EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE = 'onPutNewMessageToInboxStore';\nexport const LEGACY_EVENT_ON_UPDATE_INBOX_MESSAGES = 'onUpdateInboxMessages';\nexport const LEGACY_EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG = 'onShowNotificationPermissionDialog';\nexport const LEGACY_EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG = 'onHideNotificationPermissionDialog';\n\nexport const LEGACY_EVENT_ON_SHOW_SUBSCRIPTION_WIDGET = 'onShowSubscriptionWidget';\nexport const LEGACY_EVENT_ON_HIDE_SUBSCRIPTION_WIDGET = 'onHideSubscriptionWidget';\n\n// Post Events\nexport const EVENT_SHOW_SUBSCRIBE_BUTTON = 'showSubscribeButton';\nexport const EVENT_CLICK_SUBSCRIBE_BUTTON = 'clickSubscribeButton';\nexport const EVENT_GDPR_CONSENT = 'GDPRConsent';\nexport const EVENT_GDPR_DELETE = 'GDPRDelete';\nexport const EVENT_PW_SITE_OPENED = 'PW_SiteOpened'; // for default events\n\n// Page visited\nexport const PAGE_VISITED_URL = 'PAGE_VISITED_URL';\n","// Bell\nimport { type TBellConfig } from './subscribe_widget.types';\n\nexport const BELL_POSITION_BOTTOM_RIGHT = 'bottomRight';\nexport const BELL_POSITION_BOTTOM_LEFT = 'bottomLeft';\nexport const BELL_POSITION_TOP_RIGHT = 'topRight';\nexport const BELL_POSITION_TOP_LEFT = 'topLeft';\n\n// Common\nexport const WIDGET_CONTAINER_ID = 'pushwooshBellWidget';\n\nexport const SUBSCRIBE_WIDGET_DEFAULT_CONFIG: TBellConfig = {\n position: BELL_POSITION_BOTTOM_LEFT,\n bgColor: '#12AE7E',\n bellColor: 'white',\n bellStrokeColor: '#08754f',\n bellButtonBorder: '1px solid #379676',\n shadow: '0px 0px 6px rgba(0, 0, 0, 0.75)',\n size: '48px',\n indent: '20px',\n zIndex: '999999',\n tooltipText: {\n successSubscribe: 'You are successfully subscribed!',\n needSubscribe: 'Get notifications about important news!',\n blockSubscribe: 'Click to see how to get notifications',\n alreadySubscribed: 'You are already subscribed',\n },\n};\n","import {\n BELL_POSITION_TOP_RIGHT,\n BELL_POSITION_TOP_LEFT,\n BELL_POSITION_BOTTOM_LEFT,\n BELL_POSITION_BOTTOM_RIGHT,\n} from './constants';\nimport { type TBellPosition, type TPositionStyles } from './subscribe_widget.types';\n\nexport default class Positioning {\n public static getBellPosition(position: TBellPosition, indent: string): TPositionStyles {\n let positionStyles: TPositionStyles;\n\n switch (position) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = {\n top: 'auto',\n left: 'auto',\n bottom: indent,\n right: indent,\n };\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = {\n top: 'auto',\n left: indent,\n bottom: indent,\n right: 'auto',\n };\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = {\n top: indent,\n left: indent,\n bottom: 'auto',\n right: 'auto',\n };\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = {\n top: indent,\n left: 'auto',\n bottom: 'auto',\n right: indent,\n };\n break;\n default:\n positionStyles = {\n top: 'auto',\n left: 'auto',\n bottom: indent,\n right: indent,\n };\n }\n\n return positionStyles;\n }\n\n public static getTooltipPosition(bellPosition: TBellPosition, bellSize: string): [{ left: string } | { right: string }, string] {\n let positionStyles;\n let tooltipModification;\n const increaseIndent = (parseInt(bellSize) + 12) + 'px';\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = { left: increaseIndent };\n tooltipModification = 'left';\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = { left: increaseIndent };\n tooltipModification = 'left';\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n break;\n default:\n positionStyles = { right: increaseIndent };\n tooltipModification = 'right';\n }\n\n return [positionStyles, tooltipModification];\n }\n\n public static getPopoverPosition(bellPosition: TBellPosition, bellSize: string): [TPositionStyles, string] {\n let positionStyles;\n let popoverModification;\n const increaseIndent = (parseInt(bellSize) + 15) + 'px';\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n positionStyles = {\n bottom: increaseIndent,\n right: '0',\n left: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n positionStyles = {\n bottom: increaseIndent,\n left: '0',\n right: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n break;\n case BELL_POSITION_TOP_LEFT:\n positionStyles = {\n top: increaseIndent,\n left: '0',\n right: 'auto',\n bottom: 'auto',\n };\n popoverModification = 'top';\n break;\n case BELL_POSITION_TOP_RIGHT:\n positionStyles = {\n top: increaseIndent,\n right: '0',\n left: 'auto',\n bottom: 'auto',\n };\n popoverModification = 'top';\n break;\n default:\n positionStyles = {\n bottom: increaseIndent,\n right: '0',\n left: 'auto',\n top: 'auto',\n };\n popoverModification = 'bottom';\n }\n\n return [positionStyles, popoverModification];\n }\n\n public static getPopoverArrowPosition(bellPosition: TBellPosition, bellSize: string) {\n let arrowAdditionalStyles;\n\n switch (bellPosition) {\n case BELL_POSITION_BOTTOM_RIGHT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n break;\n case BELL_POSITION_BOTTOM_LEFT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {right: auto; left: ${(parseInt(bellSize) / 2 - 12) + 'px'}`;\n break;\n case BELL_POSITION_TOP_LEFT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__top:after {right: auto; left: ${(parseInt(bellSize) / 2 - 12) + 'px'}`;\n break;\n case BELL_POSITION_TOP_RIGHT:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__top:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n break;\n default:\n arrowAdditionalStyles = `\\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: ${(parseInt(bellSize) / 2 - 4) + 'px'}`;\n }\n\n return arrowAdditionalStyles;\n }\n}\n","import {\n PERMISSION_GRANTED,\n PERMISSION_DENIED,\n PERMISSION_PROMPT,\n} from '../../core/constants';\nimport mainCss from './assets/css/main.css';\nimport bellSVG from './bell';\nimport {\n SUBSCRIBE_WIDGET_DEFAULT_CONFIG,\n WIDGET_CONTAINER_ID,\n} from './constants';\nimport Positioning from './positioning';\nimport { type TBellConfig, type TCSSStylesObject, type TStyleKeys } from './subscribe_widget.types';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\nimport {\n type TPlatformChrome,\n type TPlatformEdge,\n type TPlatformFirefox,\n type TPlatformSafari,\n} from '../../modules/PlatformChecker/PlatformChecker.types';\n\nexport class PWSubscriptionButtonWidget {\n widget: HTMLElement;\n tooltip: HTMLElement;\n popover: HTMLElement;\n style: HTMLElement;\n pw: Pushwoosh;\n config: TBellConfig;\n\n constructor(pw: Pushwoosh) {\n // Set Pushwoosh object\n this.pw = pw;\n if (!pw.platformChecker.isAvailableNotifications) {\n console.warn('Browser does not support push notifications');\n return;\n }\n\n // Bindings\n this.clickBell = this.clickBell.bind(this);\n this.onSubscribeEvent = this.onSubscribeEvent.bind(this);\n this.onUnsubscribeEvent = this.onUnsubscribeEvent.bind(this);\n this.onPermissionDeniedEvent = this.onPermissionDeniedEvent.bind(this);\n this.clickOutOfPopover = this.clickOutOfPopover.bind(this);\n\n // Config\n const tooltipText = Object.assign(SUBSCRIBE_WIDGET_DEFAULT_CONFIG.tooltipText, pw.initParams.subscribeWidget!.tooltipText);\n this.config = Object.assign({}, SUBSCRIBE_WIDGET_DEFAULT_CONFIG, pw.initParams.subscribeWidget);\n this.config.tooltipText = tooltipText;\n }\n\n public async run() {\n const isSubscribed = await this.pw.isSubscribed();\n if (!isSubscribed) {\n await this.render();\n }\n }\n\n /**\n * Apply styles to element\n * @param styles\n * @param {HTMLElement} element\n */\n private addStylesToElement(styles: TCSSStylesObject, element: HTMLElement) {\n Object.keys(styles).forEach((st: TStyleKeys) => {\n element.style[st] = styles[st];\n });\n }\n\n /**\n * Create container element\n * @returns {HTMLElement}\n */\n private createContainer(): HTMLElement {\n const container = document.createElement('div');\n container.id = WIDGET_CONTAINER_ID;\n container.className = 'pushwoosh-subscribe-widget';\n const position = Positioning.getBellPosition(this.config.position, this.config.indent);\n const styles = Object.assign({\n zIndex: this.config.zIndex,\n }, position);\n this.addStylesToElement(styles, container);\n return container;\n }\n\n /**\n * Create styles element\n * @returns {HTMLElement}\n */\n private createStyle(): HTMLElement {\n const styleNode = document.createElement('style');\n styleNode.innerHTML = mainCss;\n return styleNode;\n }\n\n /**\n * Create cell button element\n * @returns {HTMLElement}\n */\n private createBell(): HTMLElement {\n const { config } = this;\n let bell;\n if (config.buttonImage) {\n bell = document.createElement('img') as HTMLImageElement;\n bell.src = config.buttonImage;\n } else {\n bell = document.createElement('div');\n this.addStylesToElement({\n backgroundColor: config.bgColor,\n boxShadow: config.shadow,\n lineHeight: config.size,\n border: config.bellButtonBorder,\n }, bell);\n\n bell.innerHTML = bellSVG(config.bellColor, config.bellStrokeColor);\n }\n this.addStylesToElement({\n width: config.size,\n height: config.size,\n }, bell);\n bell.className = 'pushwoosh-subscribe-widget__bell-button';\n return bell;\n }\n\n /**\n * Create tooltip element\n * @returns {Promise<HTMLElement>}\n */\n private async createTooltip(): Promise<HTMLElement> {\n const tooltip = document.createElement('div');\n const [position, modification] = Positioning.getTooltipPosition(this.config.position, this.config.size);\n tooltip.className = `pushwoosh-subscribe-widget__tooltip pushwoosh-subscribe-widget__tooltip__${modification}`;\n this.addStylesToElement(position, tooltip);\n\n tooltip.appendChild(await this.createTooltipContent());\n return tooltip;\n }\n\n /**\n * Create tooltip content element\n * @returns {Promise<HTMLElement>}\n */\n private async createTooltipContent(): Promise<HTMLElement> {\n const tooltipContent = document.createElement('div');\n tooltipContent.innerText = await this.tooltipTextFactory();\n tooltipContent.className = 'pushwoosh-subscribe-widget__tooltip-content';\n return tooltipContent;\n }\n\n /**\n * Tooltip text content depending of the permissions\n * @returns {Promise<string>}\n */\n private async tooltipTextFactory(): Promise<string> {\n const permission = this.pw.driver.getPermission();\n const { tooltipText } = this.config;\n const isManuallyUnsubscribed = await this.pw.data.getStatusManualUnsubscribed();\n\n switch (permission) {\n case PERMISSION_GRANTED:\n return isManuallyUnsubscribed ? tooltipText.needSubscribe : tooltipText.alreadySubscribed;\n case PERMISSION_PROMPT:\n return tooltipText.needSubscribe;\n case PERMISSION_DENIED:\n return tooltipText.blockSubscribe;\n default:\n return tooltipText.needSubscribe;\n }\n }\n\n /**\n * Create permission denied popover element\n * @returns {HTMLElement}\n */\n private createPopover(): HTMLElement {\n const popoverContentWrapper = document.createElement('div');\n const popover = document.createElement('div');\n const [position, modification] = Positioning.getPopoverPosition(this.config.position, this.config.size);\n popover.className = `pushwoosh-subscribe-widget__popover pushwoosh-subscribe-widget__popover__${modification}`;\n popoverContentWrapper.className = 'pushwoosh-subscribe-widget__popover-content-wrapper';\n\n this.style.innerHTML += Positioning.getPopoverArrowPosition(this.config.position, this.config.size);\n\n const styles = Object.assign({\n maxWidth: `calc(100vw - ${this.config.indent} - ${this.config.indent})`,\n }, position);\n this.addStylesToElement(styles, popover);\n\n popoverContentWrapper.appendChild(this.createPopoverContent());\n popover.appendChild(popoverContentWrapper);\n return popover;\n }\n\n private getBrowserName() {\n const platformChecker = this.pw.platformChecker;\n let browser;\n if (platformChecker.isOpera) {\n browser = 'opera';\n } else if (<TPlatformChrome>platformChecker.platform === 11 && navigator.userAgent.match(/Android/i)) {\n browser = 'mobileChrome';\n } else if (<TPlatformFirefox>platformChecker.platform === 12) {\n browser = 'firefox';\n } else if (<TPlatformSafari>platformChecker.platform === 10) {\n browser = 'safari';\n } else if (<TPlatformEdge>platformChecker.platform === 150) {\n browser = 'edge';\n } else {\n browser = 'chrome';\n }\n return browser;\n }\n\n /**\n * Create permission denied popover content element\n * @returns {HTMLElement}\n */\n private createPopoverContent(): HTMLElement {\n const { config } = this;\n const popoverContent = document.createElement('div');\n popoverContent.className = 'pushwoosh-subscribe-widget__popover-content';\n\n const browser = this.getBrowserName();\n\n const userImageSrc = config.contentImages && config.contentImages[browser];\n if (userImageSrc) {\n const image = document.createElement('img') as HTMLImageElement;\n image.src = userImageSrc;\n popoverContent.appendChild(image);\n } else {\n const standardImagesMap: Record<string, string> = {\n opera: 'opera',\n mobileChrome: 'mobile_chrome',\n firefox: 'FF',\n safari: 'safari',\n };\n const standardImage = standardImagesMap[browser] || 'chrome';\n [{\n src: this.getImageSrc(standardImage),\n width: 500,\n height: 130,\n }, {\n src: this.getImageSrc(`${standardImage}_unlock`),\n width: 500,\n height: 230,\n }].forEach((imageAttrs) => {\n const image = document.createElement('img');\n Object.assign(image, imageAttrs);\n popoverContent.appendChild(image);\n });\n }\n\n return popoverContent;\n }\n\n /**\n * Return source of help images depending of the browser\n * @returns {string}\n */\n getImageSrc(img: string): string {\n return `https://cdn.pushwoosh.com/webpush/img/${img}.jpg`;\n }\n\n private async render() {\n this.widget = this.createContainer();\n this.style = this.createStyle();\n const bell = this.createBell();\n this.tooltip = await this.createTooltip();\n this.popover = await this.createPopover();\n\n this.widget.appendChild(this.style);\n this.widget.appendChild(bell);\n this.widget.appendChild(this.tooltip);\n this.widget.appendChild(this.popover);\n\n document.body.appendChild(this.widget);\n\n this.pw.push(['onSubscribe', this.onSubscribeEvent]);\n this.pw.push(['onUnsubscribe', this.onUnsubscribeEvent]);\n this.pw.push(['onPermissionDenied', this.onPermissionDeniedEvent]);\n\n this.addEventListeners();\n }\n\n addEventListeners() {\n this.widget.addEventListener('click', this.clickBell);\n window.addEventListener('click', this.clickOutOfPopover);\n }\n\n /**\n * Toggle visibility of popover\n */\n toggleHelpPopover() {\n this.popover.classList.toggle('pushwoosh-subscribe-widget__popover__visible');\n }\n\n /**\n * Click bell button event callback\n * @returns {Promise<void>}\n */\n private async clickBell() {\n const permission = this.pw.driver.getPermission();\n\n switch (permission) {\n case PERMISSION_GRANTED:\n await this.pw.subscribe();\n\n break;\n case PERMISSION_PROMPT:\n await this.pw.subscribe();\n\n break;\n case PERMISSION_DENIED:\n this.toggleHelpPopover();\n\n break;\n default:\n console.warn('Unknown browser notification permission');\n }\n }\n\n /**\n * On subscribe event callback\n * @returns {Promise<void>}\n */\n private async onSubscribeEvent() {\n const tooltipContent = this.tooltip.querySelector('div');\n\n if (tooltipContent === null) {\n return;\n }\n\n tooltipContent.innerText = this.config.tooltipText.successSubscribe;\n this.tooltip.classList.add('pushwoosh-subscribe-widget__tooltip__visible');\n\n setTimeout(async () => {\n this.tooltip.classList.remove('pushwoosh-subscribe-widget__tooltip__visible');\n tooltipContent.innerText = await this.tooltipTextFactory();\n\n this.widget.classList.add('pushwoosh-subscribe-widget__subscribed');\n }, 2000);\n }\n\n /**\n * On permission denied event\n * @returns {Promise<void>}\n */\n private async onPermissionDeniedEvent(): Promise<void> {\n this.addEventListeners();\n\n const tooltipContent = this.tooltip.querySelector('div');\n if (tooltipContent === null) return;\n tooltipContent.innerText = await this.tooltipTextFactory();\n }\n\n /**\n * Out of popover click event\n * @param {MessageEvent} ev\n */\n clickOutOfPopover(ev: MessageEvent) {\n const closeRule = this.popover.classList.contains('pushwoosh-subscribe-widget__popover__visible')\n && !(ev.target as any).classList.contains('pushwoosh-subscribe-widget__popover')\n && (ev.target as any).closest('.pushwoosh-subscribe-widget__popover') === null\n && !(ev.target as any).classList.contains('pushwoosh-subscribe-widget__bell-button')\n && (ev.target as any).closest('.pushwoosh-subscribe-widget__bell-button') === null;\n\n if (closeRule) this.popover.classList.remove('pushwoosh-subscribe-widget__popover__visible');\n }\n\n private async onUnsubscribeEvent() {\n const tooltipContent = this.tooltip.querySelector('div');\n\n if (tooltipContent === null) {\n return;\n }\n\n tooltipContent.innerText = await this.tooltipTextFactory();\n }\n}\n","export default (fillColor: string, strokeColor: string) => {\n return '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\\n'\n + '<svg\\n'\n + ' xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\\n'\n + ' xmlns:cc=\"http://creativecommons.org/ns#\"\\n'\n + ' xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\\n'\n + ' xmlns:svg=\"http://www.w3.org/2000/svg\"\\n'\n + ' xmlns=\"http://www.w3.org/2000/svg\"\\n'\n + ' xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\\n'\n + ' xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\\n'\n + ' version=\"1.1\"\\n'\n + ' id=\"Capa_1\"\\n'\n + ' x=\"0px\"\\n'\n + ' y=\"0px\"\\n'\n + ' viewBox=\"0 0 346.013 346.013\"\\n'\n + ' style=\"enable-background:new 0 0 346.013 346.013;width: 80%; height: auto; vertical-align: middle;\"\\n'\n + ' xml:space=\"preserve\"\\n'\n + ' inkscape:version=\"0.91 r13725\"\\n'\n + ' sodipodi:docname=\"alarm_white.svg\"><metadata\\n'\n + ' id=\"metadata51\"><rdf:RDF><cc:Work\\n'\n + ' rdf:about=\"\"><dc:format>image/svg+xml</dc:format><dc:type\\n'\n + ' rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\\n'\n + ' id=\"defs49\" /><sodipodi:namedview\\n'\n + ' borderopacity=\"1\"\\n'\n + ' objecttolerance=\"10\"\\n'\n + ' gridtolerance=\"10\"\\n'\n + ' guidetolerance=\"10\"\\n'\n + ' inkscape:pageopacity=\"0\"\\n'\n + ' inkscape:pageshadow=\"2\"\\n'\n + ' inkscape:window-width=\"1618\"\\n'\n + ' inkscape:window-height=\"828\"\\n'\n + ' id=\"namedview47\"\\n'\n + ' showgrid=\"false\"\\n'\n + ' inkscape:zoom=\"0.6820553\"\\n'\n + ' inkscape:cx=\"173.0065\"\\n'\n + ' inkscape:cy=\"173.0065\"\\n'\n + ' inkscape:window-x=\"0\"\\n'\n + ' inkscape:window-y=\"0\"\\n'\n + ' inkscape:window-maximized=\"0\"\\n'\n + ' inkscape:current-layer=\"g3\" /><g\\n'\n + ' id=\"g3\"><path\\n'\n + ' d=\"m 256.76227,220.19006 c -1.77513,-2.69766 -3.45154,-5.24564 -3.98966,-7.46382 -0.042,-0.17861 -0.0911,-0.36128 -0.16237,-0.61436 -2.28354,-7.67647 0.69147,-24.43921 2.46886,-34.45124 0.26788,-1.50394 0.52274,-2.94197 0.75286,-4.29035 0.0232,-0.13675 0.044,-0.27211 0.0724,-0.48006 1.95582,-15.28051 2.58811,-37.91956 -5.51044,-58.99147 -5.6032,-14.57978 -14.45978,-25.82612 -26.3559,-33.48393 1.26598,-9.812938 -4.85967,-19.343691 -14.66682,-22.0511 -9.80715,-2.70741 -19.95724,2.33226 -23.90298,11.405413 -14.1382,0.467533 -27.51111,5.577097 -39.80114,15.219267 -17.76129,13.9298 -28.83431,33.68757 -34.99389,47.80757 l -0.0479,0.11335 c -0.0512,0.12175 -0.0998,0.24114 -0.13249,0.32962 -0.49733,1.28292 -1.01552,2.64514 -1.55689,4.07255 -3.61311,9.51043 -9.66004,25.42824 -15.611995,30.89342 -0.106524,0.10027 -0.208228,0.20187 -0.362362,0.35435 -1.636243,1.66563 -4.382941,2.99463 -7.288979,4.40101 -7.145531,3.45301 -22.013613,10.64166 -17.206389,31.67844 0.929154,4.07105 4.008437,7.29057 8.033861,8.40185 l 167.570804,46.2604 c 4.02253,1.11048 8.31521,-0.0729 11.2052,-3.08958 14.91617,-15.58874 5.84693,-29.38668 1.48625,-36.02133 z\"\\n'\n + ' id=\"path5\"\\n'\n + ' inkscape:connector-curvature=\"0\"\\n'\n + ' vector-effect=\"non-scaling-stroke\"\\n'\n + ` style=\"fill:${fillColor}; stroke: ${strokeColor}; stroke-width: 1; \" /><path\\n`\n + ' vector-effect=\"non-scaling-stroke\"\\n'\n + ' d=\"m 174.26737,259.72378 -38.76399,-10.70137 c -1.59243,-0.43962 -3.28183,-0.15596 -4.63548,0.7754 -2.53909,1.7494 -2.84182,4.93159 -3.02304,6.83188 l -0.0151,0.15247 c -1.22819,12.67106 6.79854,24.33046 19.08688,27.72284 12.51583,3.45518 25.8324,-2.91586 30.9681,-14.80385 l 0.0935,-0.19205 c 0.52305,-1.06418 1.74613,-3.55554 0.50882,-6.31116 -0.44302,-0.98439 -1.5794,-2.74529 -4.21964,-3.47416 z\"\\n'\n + ' id=\"path7\"\\n'\n + ' inkscape:connector-curvature=\"0\"\\n'\n + ` style=\"fill:${fillColor}; stroke: ${strokeColor}; stroke-width: 1;\" /></g><g\\n`\n + ' id=\"g17\" /><g\\n'\n + ' id=\"g19\" /><g\\n'\n + ' id=\"g21\" /><g\\n'\n + ' id=\"g23\" /><g\\n'\n + ' id=\"g25\" /><g\\n'\n + ' id=\"g27\" /><g\\n'\n + ' id=\"g29\" /><g\\n'\n + ' id=\"g31\" /><g\\n'\n + ' id=\"g33\" /><g\\n'\n + ' id=\"g35\" /><g\\n'\n + ' id=\"g37\" /><g\\n'\n + ' id=\"g39\" /><g\\n'\n + ' id=\"g41\" /><g\\n'\n + ' id=\"g43\" /><g\\n'\n + ' id=\"g45\" /></svg>';\n};\n"],"names":["root","factory","exports","module","define","amd","a","i","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","PERMISSION_DENIED","PERMISSION_GRANTED","PERMISSION_PROMPT","BELL_POSITION_BOTTOM_RIGHT","BELL_POSITION_BOTTOM_LEFT","BELL_POSITION_TOP_RIGHT","BELL_POSITION_TOP_LEFT","SUBSCRIBE_WIDGET_DEFAULT_CONFIG","position","bgColor","bellColor","bellStrokeColor","bellButtonBorder","shadow","size","indent","zIndex","tooltipText","successSubscribe","needSubscribe","blockSubscribe","alreadySubscribed","Positioning","getBellPosition","positionStyles","top","left","bottom","right","getTooltipPosition","bellPosition","bellSize","tooltipModification","increaseIndent","parseInt","getPopoverPosition","popoverModification","getPopoverArrowPosition","arrowAdditionalStyles","PWSubscriptionButtonWidget","constructor","pw","platformChecker","isAvailableNotifications","console","warn","clickBell","bind","onSubscribeEvent","onUnsubscribeEvent","onPermissionDeniedEvent","clickOutOfPopover","assign","initParams","subscribeWidget","config","run","isSubscribed","render","addStylesToElement","styles","element","keys","forEach","st","style","createContainer","container","document","createElement","id","className","createStyle","styleNode","innerHTML","createBell","bell","fillColor","strokeColor","buttonImage","src","backgroundColor","boxShadow","lineHeight","border","width","height","createTooltip","tooltip","modification","appendChild","createTooltipContent","tooltipContent","innerText","tooltipTextFactory","permission","driver","getPermission","isManuallyUnsubscribed","data","getStatusManualUnsubscribed","createPopover","popoverContentWrapper","popover","maxWidth","createPopoverContent","getBrowserName","browser","isOpera","platform","navigator","userAgent","match","popoverContent","userImageSrc","contentImages","image","standardImage","opera","mobileChrome","firefox","safari","getImageSrc","imageAttrs","img","widget","body","push","addEventListeners","addEventListener","window","toggleHelpPopover","classList","toggle","subscribe","querySelector","add","setTimeout","async","remove","ev","contains","target","closest"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WebPopupsWidget } from './widgets/WebPopups/WebPopupsWidget';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Pushwoosh } from '../../core/Pushwoosh';
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class WebPopupsWidget {
|
|
3
3
|
private readonly pw;
|
|
4
4
|
private isRecurringVisitor;
|
|
5
|
-
private readonly
|
|
5
|
+
private readonly loadedPopups;
|
|
6
6
|
private readonly pendingTimers;
|
|
7
7
|
private isNavigationSubscribed;
|
|
8
8
|
private openPopupsCount;
|
|
@@ -11,7 +11,7 @@ export declare class PopupFormsWidget {
|
|
|
11
11
|
private unlockBodyScroll;
|
|
12
12
|
constructor(pw: Pushwoosh);
|
|
13
13
|
run(): Promise<void>;
|
|
14
|
-
private
|
|
14
|
+
private loadWebPopup;
|
|
15
15
|
private renderForCurrentPage;
|
|
16
16
|
private cancelPendingForUnmatchedPages;
|
|
17
17
|
private subscribeToNavigation;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const WEB_POPUPS_WIDGET_NAMESPACE = "pushwoosh-web-popups";
|
|
2
2
|
export declare const DEFAULT_DOCUMENT_WIDTH = 600;
|
|
3
3
|
export declare const POPUP_HOST_Z_INDEX = 2147483647;
|
|
4
4
|
export declare const POPUP_STYLES = "\n .close {\n position: fixed;\n top: 16px;\n right: 16px;\n width: 32px;\n height: 32px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: rgba(255, 255, 255, 0.9);\n cursor: pointer;\n font-size: 24px;\n line-height: 1;\n color: #333;\n }\n";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type IWebPopupsConfig = {
|
|
2
2
|
enable: boolean;
|
|
3
3
|
};
|
|
4
|
-
export type
|
|
4
|
+
export type WebPopup = {
|
|
5
5
|
code: string;
|
|
6
6
|
popup_form_content_code: string;
|
|
7
7
|
device_type: 'ALL' | 'DESKTOP' | 'MOBILE';
|
|
@@ -10,7 +10,7 @@ export type PopupForm = {
|
|
|
10
10
|
delay: number;
|
|
11
11
|
frequency: 'ONCE' | 'ONCE_PER_SESSION' | 'EVERY_VISIT';
|
|
12
12
|
};
|
|
13
|
-
export type
|
|
13
|
+
export type WebPopupContent = {
|
|
14
14
|
code: string;
|
|
15
15
|
json: string;
|
|
16
16
|
html: string | null;
|