Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fortumo/hdcb-lightbox

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fortumo/hdcb-lightbox - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

dist/HdcbLightbox.min.js

@@ -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.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.3/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(3);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});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}),n(5);var o=n(1),r=n(2),i=n(6),u=n(8),a=n(3),s=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),s.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=u.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(2),i=n(0);t.Lightbox=function(){var e={},t=function(e){window.document.body.appendChild(e)};return e.create=function(e){var t=window.document.createElement("div");t.classList.add("hdcb-payment-lightbox");var n=e.domain+"/?merchant="+e.merchant_id+"&token="+e.token,u='<div class="hdcb-payment-lightbox__wrapper">\n <div class="hdcb-payment-lightbox__borders"><iframe id="fortumo-hdcb-iframe" src="'+n+'" title="'+e.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>',a=o.ClosingButton.render();return t.appendChild(a),a.addEventListener("click",function(t){i.Utils.stopEvent(t),r.IframeMessenger.sendMessageToIframe({do:"CLOSE"},e.domain)}),i.Utils.appendNodesFromString(t,u)},e.open=function(e){return t(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="#"><div class="hdcb-payment-lightbox__close-button"></div></a>')},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PaymentButton=void 0;var o=n(1),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.4/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+"/?merchant="+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.3",
"version": "1.0.4",
"description":

@@ -14,3 +14,4 @@ "JavaScript library for creating Fortumo Hosted Direct Carrier Billing payment button(s) that open up the payment widget inside a lightbox.",

"build:dev": "webpack --env dev --config config/webpack.config.js",
"demo": "serve . & opn http://localhost:5000/test/demo.html",
"demo":
"npm run build:dev && serve -p 5501 . & opn http:/127.0.0.1:5501/test/demo.html",
"test": "npm run build:dev && jest --env=jsdom",

@@ -20,3 +21,3 @@ "test:watch": "jest --watch --env=jsdom",

"format":
"git diff --diff-filter=ACM --name-only HEAD | grep \".*\\.ts$\\|.*\\.js$\\|.*\\.json$\" | xargs ./node_modules/.bin/prettier --single-quote --print-width 80 --write && git add -A",
"git diff --diff-filter=ACM --name-only HEAD | grep \".*\\.ts$\\|.*\\.js$\\|.*\\.json$\" | grep -v \".*min\\.js$\" | xargs ./node_modules/.bin/prettier --single-quote --print-width 80 --write && git add -A",
"npm:login": "npm-cli-login",

@@ -94,3 +95,3 @@ "prepublish":

},
"pre-commit": ["format"],
"pre-commit": ["format", "clean", "build"],
"prettier": {

@@ -97,0 +98,0 @@ "singleQuote": true

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc