@fortumo/hdcb-lightbox
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -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.0/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.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.1/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}()}])}); |
{ | ||
"name": "@fortumo/hdcb-lightbox", | ||
"author": "Fortumo", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": | ||
@@ -15,3 +15,3 @@ "JavaScript library for creating Fortumo Hosted Direct Carrier Billing payment button(s) that open up the payment widget inside a lightbox.", | ||
"demo": "serve . & opn http://localhost:5000/test/demo.html", | ||
"test": "jest --env=jsdom", | ||
"test": "npm run build:dev && jest --env=jsdom", | ||
"test:watch": "jest --watch --env=jsdom", | ||
@@ -21,4 +21,5 @@ "flow": "flow", | ||
"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", | ||
"npm:login": "npm-cli-login", | ||
"prepublish": | ||
"npm run clean && npm run build:dev && npm run test && npm run clean && npm run build", | ||
"npm run clean && npm run test && npm run clean && npm run build", | ||
"release:ci": "npm publish", | ||
@@ -66,2 +67,3 @@ "release:interactive": "np" | ||
"np": "^2.17.0", | ||
"npm-cli-login": "0.0.10", | ||
"object-assign": "^4.1.1", | ||
@@ -68,0 +70,0 @@ "opn-cli": "^3.1.0", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
13254
33
2