@fortumo/hdcb-lightbox
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("HdcbLightbox",[],t):"object"==typeof exports?exports.HdcbLightbox=t():e.HdcbLightbox=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Utils=function(){var e={};return e.stopEvent=function(e){"function"==typeof e.stopPropagation&&e.stopPropagation(),"function"==typeof e.preventDefault&&e.preventDefault()},e.appendNodesFromString=function(e,t){var n=window.document.createElement("div");n.innerHTML=t;var o=n.firstChild;return e.appendChild(o),e},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Store=function(){var e={},t=void 0,n=[],o=function(e,t){switch(e||(e={message_from_iframe:{}}),t||(t={type:"",payload:{}}),t.type){case"RECEIVED_MESSAGE_FROM_IFRAME":return Object.assign({},e,{message_from_iframe:Object.assign({},t.payload)});default:return e}};return e.getState=function(){return t},e.getListeners=function(){return n},e.subscribe=function(e){return n.push(e),function(){n=n.filter(function(e){})}},e.dispatch=function(e){t=o(t,e),n.forEach(function(n){n(t,e)})},e.dispatch({}),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Config=function(){var e={},t={};return t.iframe_title="Fortumo Hosted DCB",t.domain="https://dcb.fortumo.com",t.token="",t.merchant_id="",t.stylesheet_url="https://unpkg.com/@fortumo/hdcb-lightbox@1.0.6/dist/HdcbLightbox.min.css",t.button_alt='Mobile Payments by Fortumo"',t.button_img_src="https://assets.fortumo.com/fmp/fortumopay_150x50_red.png",t.button_el_id="hdcb-payment-button",e.overwriteWith=function(e){return t=Object.assign({},t,e)},e.getOptions=function(){return t},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IframeMessenger=void 0;var o=n(1);t.IframeMessenger=function(){var e={},t=function(e){return function(t){t.origin===e.domain&&o.Store.dispatch({type:"RECEIVED_MESSAGE_FROM_IFRAME",payload:t.data})}};return e.sendMessageToIframe=function(e,t){window.document.getElementById("fortumo-hdcb-iframe").contentWindow.postMessage(e,t)},e.subscribeToMessagesFromIframe=function(e){window.addEventListener("message",t(e),!1)},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(5);var o=n(2),r=n(3),i=n(6),s=n(8),a=n(1),u=n(0),c=function(){var e={},t=void 0;!function(){var e=document.getElementsByTagName("head")[0],t=document.createElement("link");t.href=o.Config.getOptions().stylesheet_url,t.rel="stylesheet",e.appendChild(t)}();var n=function(e){return function(n){t=i.Lightbox.create(e),u.Utils.stopEvent(n),i.Lightbox.open(t),r.IframeMessenger.subscribeToMessagesFromIframe(e)}},c=function(t,n){"RECEIVED_MESSAGE_FROM_IFRAME"===n.type&&"CLOSE_LIGHTBOX_AND_REDIRECT"===n.payload.do&&n.payload.redirect_url&&(e.closePaymentOverlay(),window.location.href=n.payload.redirect_url)};a.Store.subscribe(c);var d=function(e,t){e.addEventListener("click",n(t))};return e.addPaymentButton=function(e,t){var n=o.Config.overwriteWith(t),r=window.document.getElementById(e),i=s.PaymentButton.render(r);d(i,n)},e.closePaymentOverlay=function(){i.Lightbox.close(t)},e}();t.default=c,e.exports=t.default},function(e,t){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Lightbox=void 0;var o=n(7),r=n(3),i=n(1),s=n(0);t.Lightbox=function(){var e={},t=void 0,n=void 0,a=void 0,u=function(e){window.document.body.appendChild(e)};return e.create=function(u){var c=window.document.createElement("div");c.classList.add("hdcb-payment-lightbox"),n=u.domain+"/"+u.merchant_id+"/?token="+u.token;var d='<div class="hdcb-payment-lightbox__wrapper">\n <div class="hdcb-payment-lightbox__borders"><iframe id="fortumo-hdcb-iframe" src="'+n+'" title="'+u.iframe_title+'"\n frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="600"\n width="400">\n <p>Your browser does not support iframes.</p>\n </iframe>\n </div>\n </div>',f=o.ClosingButton.render();c.appendChild(f),f.addEventListener("click",function(n){s.Utils.stopEvent(n),a="WAITING_FOR_ECHO",r.IframeMessenger.sendMessageToIframe({do:"CLOSE"},u.domain),setTimeout(function(){"ECHO_RECEIVED"!==a&&(console.error("[HDCBLightbox] Integration error: It seems that the 'postmessage_target' parameter specified in the DCB widget's JWT does not match with the current domain. As a result, it is not possible to communicate cross-origin. Please see the integration documentation at https://merchants.fortumo.com/integration-and-testing/hosted-dcb/"),e.close(t))},100)});var l=function(e,t){"RECEIVED_MESSAGE_FROM_IFRAME"===t.type&&t.payload.echo&&"CLOSE"===t.payload.echo.do&&(a="ECHO_RECEIVED")};return i.Store.subscribe(l),t=s.Utils.appendNodesFromString(c,d)},e.open=function(e){return screen.width&&screen.width<=700&&(window.location=n),u(e),setTimeout(function(){requestAnimationFrame(function(){e.classList.add("hdcb-payment-lightbox--visible")})},20),!0},e.close=function(e){return e&&e.classList.remove("hdcb-payment-lightbox--visible"),setTimeout(function(){requestAnimationFrame(function(){e.parentElement&&e.parentElement.removeChild(e)})},400),!0},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClosingButton=void 0;var o=n(0);t.ClosingButton=function(){var e={};return e.render=function(){var e=window.document.createElement("div");e.classList.add("hdcb-payment-lightbox__close-button-wrapper");return o.Utils.appendNodesFromString(e,'<a href="#" alt="close" class="hdcb-payment-lightbox__close-button">X</a>')},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PaymentButton=void 0;var o=n(2),r=n(0);t.PaymentButton=function(){var e={};return e.render=function(e){var t=o.Config.getOptions(),n='<a id="'+t.button_el_id+'" href="#"><img src="'+t.button_img_src+'" alt="'+t.button_alt+'" border="0"/></a>';return r.Utils.appendNodesFromString(e,n).firstElementChild},e}()}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("HdcbLightbox",[],t):"object"==typeof exports?exports.HdcbLightbox=t():e.HdcbLightbox=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Utils=function(){var e={};return e.stopEvent=function(e){"function"==typeof e.stopPropagation&&e.stopPropagation(),"function"==typeof e.preventDefault&&e.preventDefault()},e.appendNodesFromString=function(e,t){var n=window.document.createElement("div");n.innerHTML=t;var o=n.firstChild;return e.appendChild(o),e},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Store=function(){var e={},t=void 0,n=[],o=function(e,t){switch(e||(e={message_from_iframe:{}}),t||(t={type:"",payload:{}}),t.type){case"RECEIVED_MESSAGE_FROM_IFRAME":return Object.assign({},e,{message_from_iframe:Object.assign({},t.payload)});default:return e}};return e.getState=function(){return t},e.getListeners=function(){return n},e.subscribe=function(e){return n.push(e),function(){n=n.filter(function(e){})}},e.dispatch=function(e){t=o(t,e),n.forEach(function(n){n(t,e)})},e.dispatch({}),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Config=function(){var e={},t={};return t.iframe_title="Fortumo Hosted DCB",t.domain="https://dcb.fortumo.com",t.token="",t.merchant_id="",t.stylesheet_url="https://unpkg.com/@fortumo/hdcb-lightbox@1.0.7/dist/HdcbLightbox.min.css",t.button_alt='Mobile Payments by Fortumo"',t.button_img_src="https://assets.fortumo.com/fmp/fortumopay_150x50_red.png",t.button_el_id="hdcb-payment-button",e.overwriteWith=function(e){return t=Object.assign({},t,e)},e.getOptions=function(){return t},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IframeMessenger=void 0;var o=n(1);t.IframeMessenger=function(){var e={},t=function(e){return function(t){t.origin===e.domain&&o.Store.dispatch({type:"RECEIVED_MESSAGE_FROM_IFRAME",payload:t.data})}};return e.sendMessageToIframe=function(e,t){window.document.getElementById("fortumo-hdcb-iframe").contentWindow.postMessage(e,t)},e.subscribeToMessagesFromIframe=function(e){window.addEventListener("message",t(e),!1)},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(5);var o=n(2),r=n(3),i=n(6),s=n(8),a=n(1),u=n(0),c=function(){var e={},t=void 0;!function(){var e=document.getElementsByTagName("head")[0],t=document.createElement("link");t.href=o.Config.getOptions().stylesheet_url,t.rel="stylesheet",e.appendChild(t)}();var n=function(e){return function(n){t=i.Lightbox.create(e),u.Utils.stopEvent(n),i.Lightbox.open(t),r.IframeMessenger.subscribeToMessagesFromIframe(e)}},c=function(t,n){"RECEIVED_MESSAGE_FROM_IFRAME"===n.type&&"CLOSE_LIGHTBOX_AND_REDIRECT"===n.payload.do&&n.payload.redirect_url&&(e.closePaymentOverlay(),window.location.href=n.payload.redirect_url)};a.Store.subscribe(c);var d=function(e,t){e.addEventListener("click",n(t))};return e.addPaymentButton=function(e,t){var n=o.Config.overwriteWith(t),r=window.document.getElementById(e),i=s.PaymentButton.render(r);d(i,n)},e.closePaymentOverlay=function(){i.Lightbox.close(t)},e}();t.default=c,e.exports=t.default},function(e,t){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Lightbox=void 0;var o=n(7),r=n(3),i=n(1),s=n(0);t.Lightbox=function(){var e={},t=void 0,n=void 0,a=void 0,u=function(e){window.document.body.appendChild(e)};return e.create=function(u){var c=window.document.createElement("div");c.classList.add("hdcb-payment-lightbox"),n=u.domain+"/"+u.merchant_id+"/?token="+u.token;var d='<div class="hdcb-payment-lightbox__wrapper">\n <div class="hdcb-payment-lightbox__borders"><iframe id="fortumo-hdcb-iframe" src="'+n+'" title="'+u.iframe_title+'"\n frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="600"\n width="400">\n <p>Your browser does not support iframes.</p>\n </iframe>\n </div>\n </div>',f=o.ClosingButton.render();c.appendChild(f),f.addEventListener("click",function(n){s.Utils.stopEvent(n),a="WAITING_FOR_ECHO",r.IframeMessenger.sendMessageToIframe({do:"CLOSE"},u.domain),setTimeout(function(){"ECHO_RECEIVED"!==a&&(console.error("[HDCBLightbox] Integration error: It seems that the 'postmessage_target' parameter specified in the DCB widget's JWT does not match with the current domain. As a result, it is not possible to communicate cross-origin. Please see the integration documentation at https://merchants.fortumo.com/integration-and-testing/hosted-dcb/"),e.close(t))},100)});var l=function(e,t){"RECEIVED_MESSAGE_FROM_IFRAME"===t.type&&t.payload.echo&&"CLOSE"===t.payload.echo.do&&(a="ECHO_RECEIVED")};return i.Store.subscribe(l),t=s.Utils.appendNodesFromString(c,d)},e.open=function(e){return screen.width&&screen.width<=700&&(window.location=n),u(e),setTimeout(function(){requestAnimationFrame(function(){e.classList.add("hdcb-payment-lightbox--visible")})},20),!0},e.close=function(e){return e&&e.classList.remove("hdcb-payment-lightbox--visible"),setTimeout(function(){requestAnimationFrame(function(){e.parentElement&&e.parentElement.removeChild(e)})},400),!0},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClosingButton=void 0;var o=n(0);t.ClosingButton=function(){var e={};return e.render=function(){var e=window.document.createElement("div");e.classList.add("hdcb-payment-lightbox__close-button-wrapper");return o.Utils.appendNodesFromString(e,'<a href="#" alt="close" class="hdcb-payment-lightbox__close-button">X</a>')},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PaymentButton=void 0;var o=n(2),r=n(0);t.PaymentButton=function(){var e={};return e.render=function(e){var t=o.Config.getOptions(),n='<a id="'+t.button_el_id+'" href="#"><img src="'+t.button_img_src+'" alt="'+t.button_alt+'" border="0"/></a>';return r.Utils.appendNodesFromString(e,n).firstElementChild},e}()}])}); |
{ | ||
"name": "@fortumo/hdcb-lightbox", | ||
"author": "Fortumo", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "JavaScript library for creating Fortumo Hosted Direct Carrier Billing payment button(s) that open up the payment widget inside a lightbox.", | ||
@@ -6,0 +6,0 @@ "main": "dist/HdcbLightbox.min.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package