@fortumo/hdcb-lightbox
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -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.2/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.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}()}])}); |
{ | ||
"name": "@fortumo/hdcb-lightbox", | ||
"author": "Fortumo", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": | ||
@@ -6,0 +6,0 @@ "JavaScript library for creating Fortumo Hosted Direct Carrier Billing payment button(s) that open up the payment widget inside a lightbox.", |
# About | ||
Fortumo Hosted DCB: https://fortumo.com/products/dcb/ | ||
Fortumo Hosted DCB: https://fortumo.com/products/dcb/ | ||
Developer documentation: https://merchants.fortumo.com/integration-and-testing/hosted-dcb/ | ||
Developer documentation: | ||
https://merchants.fortumo.com/integration-and-testing/hosted-dcb/ | ||
@@ -62,32 +63,49 @@ # Usage | ||
**Your merchant ID from Fortumo:** | ||
```javascript | ||
merchant_id = '' | ||
merchant_id: ''; | ||
``` | ||
**Your integration parameters JWT token:** | ||
```javascript | ||
token = '' | ||
token: ''; | ||
``` | ||
**`<iframe title="{value here}">` for better accessibility:** | ||
```javascript | ||
iframe_title = 'Fortumo Hosted DCB' | ||
iframe_title: 'Fortumo Hosted DCB'; | ||
``` | ||
**Fortumo HDCB widget's domain. Also can be set to Fortumo test environment's domain:** | ||
**Fortumo HDCB widget's domain. Also can be set to Fortumo test environment's | ||
domain:** | ||
```javascript | ||
domain = 'https://dcb.fortumo.com' | ||
domain: 'https://dcb.fortumo.com'; | ||
``` | ||
**Stylesheet used by this library for payment button and lightbox:** | ||
```javascript | ||
stylesheet_url = 'https://unpkg.com/@fortumo/hdcb-lightbox@{LIBRARY-VERSION}/dist/HdcbLightbox.min.css' | ||
stylesheet_url: 'https://unpkg.com/@fortumo/hdcb-lightbox@{LIBRARY-VERSION}/dist/HdcbLightbox.min.css'; | ||
``` | ||
**Payment button's `alt` parameter value:** | ||
```javascript | ||
button_alt = 'Mobile Payments by Fortumo"' | ||
button_alt: 'Mobile Payments by Fortumo"'; | ||
``` | ||
**Payment button's image location:** | ||
```javascript | ||
button_img_src = 'https://assets.fortumo.com/fmp/fortumopay_150x50_red.png' | ||
button_img_src: 'https://assets.fortumo.com/fmp/fortumopay_150x50_red.png'; | ||
``` | ||
**Element ID of the payment button that is created. Not used for styling. Should be set for each button if there exists more than one:** | ||
**Element ID of the payment button that is created. Not used for styling. Should | ||
be set for each button if there exists more than one:** | ||
```javascript | ||
button_el_id = 'hdcb-payment-button' | ||
button_el_id: 'hdcb-payment-button'; | ||
``` |
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
111
13249