@fortumo/hdcb-lightbox
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -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.5/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}()}])}); | ||
!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}()}])}); |
{ | ||
"name": "@fortumo/hdcb-lightbox", | ||
"author": "Fortumo", | ||
"version": "1.0.5", | ||
"description": | ||
"JavaScript library for creating Fortumo Hosted Direct Carrier Billing payment button(s) that open up the payment widget inside a lightbox.", | ||
"version": "1.0.6", | ||
"description": "JavaScript library for creating Fortumo Hosted Direct Carrier Billing payment button(s) that open up the payment widget inside a lightbox.", | ||
"main": "dist/HdcbLightbox.min.js", | ||
@@ -11,15 +10,11 @@ "scripts": { | ||
"build": "webpack --env build --config config/webpack.config.js", | ||
"dev": | ||
"webpack --progress --colors --watch --env dev --config config/webpack.config.js", | ||
"dev": "webpack --progress --colors --watch --env dev --config config/webpack.config.js", | ||
"build:dev": "webpack --env dev --config config/webpack.config.js", | ||
"demo": | ||
"npm run build:dev && serve -p 5501 . & opn http:/127.0.0.1:5501/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", | ||
"test:watch": "jest --watch --env=jsdom", | ||
"flow": "flow", | ||
"format": | ||
"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", | ||
"format": "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", | ||
"prepublish": | ||
"npm run clean && npm run test && npm run clean && npm run build", | ||
"prepublish": "npm run clean && npm run test && npm run clean && npm run build", | ||
"release:ci": "npm publish", | ||
@@ -31,3 +26,7 @@ "release:interactive": "np" | ||
}, | ||
"files": ["dist", "README.md", "LICENSE"], | ||
"files": [ | ||
"dist", | ||
"README.md", | ||
"LICENSE" | ||
], | ||
"repository": { | ||
@@ -47,3 +46,3 @@ "type": "git", | ||
"devDependencies": { | ||
"babel-core": "^6.26.0", | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^8.0.3", | ||
@@ -54,3 +53,3 @@ "babel-jest": "^21.2.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-preset-flow": "^6.23.0", | ||
@@ -68,3 +67,3 @@ "css-loader": "^0.28.7", | ||
"jest": "^21.2.1", | ||
"node-sass": "^4.7.2", | ||
"node-sass": "^4.12.0", | ||
"np": "^2.17.0", | ||
@@ -90,11 +89,22 @@ "npm-cli-login": "0.0.10", | ||
"targets": { | ||
"browsers": ["last 2 versions", "ie >= 10"] | ||
"browsers": [ | ||
"last 2 versions", | ||
"ie >= 10" | ||
] | ||
} | ||
} | ||
], | ||
["flow"] | ||
[ | ||
"flow" | ||
] | ||
], | ||
"plugins": ["babel-plugin-add-module-exports"] | ||
"plugins": [ | ||
"babel-plugin-add-module-exports" | ||
] | ||
}, | ||
"pre-commit": ["format", "clean", "build"], | ||
"pre-commit": [ | ||
"format", | ||
"clean", | ||
"build" | ||
], | ||
"prettier": { | ||
@@ -101,0 +111,0 @@ "singleQuote": true |
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
13969