├── .babelrc ├── webpack.config.js ├── .eslintrc ├── .gitignore ├── src └── index.js ├── LICENSE ├── dist └── mono.min.js ├── package.json └── README.md /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"] 3 | } 4 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | function buildConfig(env) { 2 | return require('./build/' + env + '.js'); 3 | } 4 | 5 | module.exports = buildConfig; -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["plugin:vue/recommended"], 3 | "rules": { 4 | "space-before-function-paren": [2, "never"], 5 | "indent": ["error",4], 6 | "camelcase": [2, {"properties": "never"}] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | 4 | # local env files 5 | .env.local 6 | .env.*.local 7 | 8 | # Log files 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | pnpm-debug.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | const MonoJS = { 2 | install(Vue, { publicKey }) { 3 | Vue.mixin({ 4 | mounted() { 5 | const monoJS = "https://connect.withmono.com/connect.js"; 6 | const script = document.createElement("script"); 7 | script.src = monoJS; 8 | // Only run if mono script has not been added to the body 9 | if (!document.querySelector(`[src="${monoJS}"]`)) { 10 | document.body.appendChild(script); 11 | } 12 | }, 13 | 14 | methods: { 15 | $launchMono(options) { 16 | const connect = new Connect({ key: publicKey, ...options }); 17 | connect.setup(); 18 | connect.open(); 19 | }, 20 | $reAuthorise(options, token) { 21 | const connect = new Connect({ key: publicKey, ...options }); 22 | connect.reauthorise(token); 23 | connect.open(); 24 | }, 25 | }, 26 | }); 27 | }, 28 | }; 29 | 30 | export default MonoJS; 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Oluwole Adebiyi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dist/mono.min.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("VueMono",[],t):"object"==typeof exports?exports.VueMono=t():e.VueMono=t()}(window,function(){return o={},r.m=n=[function(e,t,n){"use strict";n.r(t),t.default={install:function(e,t){var n=t.publicKey;e.mixin({mounted:function(){var e="https://connect.withmono.com/connect.js",t=document.createElement("script");t.src=e,document.querySelector('[src="'.concat(e,'"]'))||document.body.appendChild(t)},methods:{$launchMono:function(e){var t=new Connect(n,e);t.setup(),t.open()}}})}}}],r.c=o,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/dist/",r(r.s=0);function r(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}var n,o}); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-mono", 3 | "version": "1.0.2", 4 | "description": "This is a Vue Package that helps you integrate Mono - https://withmono.com/ easily", 5 | "main": "dist/mono.min.js", 6 | "scripts": { 7 | "lint": "eslint src --ext=js,vue || exit 0", 8 | "lint:fix": "eslint src --ext=js,vue --fix || exit 0", 9 | "dist": "webpack --env=webpack.dist" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/kingflamez/vue-mono.git" 14 | }, 15 | "dependencies": { 16 | "vue": "^2.6.7" 17 | }, 18 | "devDependencies": { 19 | "@babel/cli": "^7.2.3", 20 | "@babel/core": "^7.3.4", 21 | "@babel/preset-env": "^7.3.4", 22 | "babel-loader": "^8.0.5", 23 | "css-loader": "^2.1.0", 24 | "eslint-config-vue": "^2.0.2", 25 | "eslint-loader": "^2.1.2", 26 | "eslint-plugin-vue": "^5.2.2", 27 | "standard": "^12.0.1", 28 | "uglifyjs-webpack-plugin": "^2.2.0", 29 | "vue": "^2.6.7", 30 | "vue-loader": "^15.6.4", 31 | "vue-template-compiler": "^2.6.7", 32 | "webpack": "^4.29.6", 33 | "webpack-cli": "^3.2.3", 34 | "webpack-dev-server": "^3.2.1" 35 | }, 36 | "keywords": [ 37 | "mono", 38 | "fintech", 39 | "withmono", 40 | "vue", 41 | "kingflamez" 42 | ], 43 | "author": "Oluwole Adebiyi - @kingflamez", 44 | "license": "MIT", 45 | "bugs": { 46 | "url": "https://github.com/kingflamez/vue-mono/issues" 47 | }, 48 | "homepage": "https://github.com/kingflamez/vue-mono#readme" 49 | } 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mono for Vue 2.x 2 | 3 | > This is a Vue Package that helps you integrate Mono - https://withmono.com/ easily" 4 | 5 | [![NPM](https://img.shields.io/npm/v/vue-mono.svg)](https://www.npmjs.com/package/vue-mono) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) 6 | 7 | ## Install 8 | 9 | ### Vue 10 | 11 | Install the npm package: 12 | 13 | ```bash 14 | npm install --save vue-mono 15 | # OR 16 | yarn add vue-mono 17 | ``` 18 | 19 | Add the Vue plugin in your main.js and pass your [connect public key](#): 20 | 21 | ```javascript 22 | import Vue from "vue"; 23 | import Mono from "vue-mono"; 24 | 25 | Vue.use(Mono, { publicKey: "YOUR CONNECT PUBLIC KEY" }); 26 | ``` 27 | 28 | ### Nuxt 29 | 30 | Install the npm package: 31 | 32 | ```bash 33 | npm install --save vue-mono 34 | # OR 35 | yarn add vue-mono 36 | ``` 37 | 38 | Create a `mono.js` file in your `plugins` folder and add the Vue plugin: 39 | 40 | ```javascript 41 | // plugins/mono.js 42 | 43 | import Vue from "vue"; 44 | import Mono from "vue-mono"; 45 | 46 | Vue.use(Mono, { publicKey: "YOUR CONNECT PUBLIC KEY" }); 47 | ``` 48 | 49 | Go to your `nuxt.config.js` and add it to your plugin section 50 | 51 | ```javascript 52 | /* 53 | ** Plugins to load before mounting the App 54 | ** https://nuxtjs.org/guide/plugins 55 | */ 56 | ............ 57 | plugins: [{src: '~/plugins/mono', ssr: false},], 58 | ........... 59 | 60 | ``` 61 | 62 | ## Usage 63 | 64 | Mono can be launched using `$launchMono()` method, see example below 65 | 66 | ```vue 67 | 72 | 73 | 101 | ``` 102 | 103 | Mono account-reauthorisation can be launched using `$reAuthorise(options, token)` method, see example below 104 | 105 | ```vue 106 | 111 | 112 | 138 | ``` 139 | 140 | Please checkout 141 | [Mono Documentation](https://docs.mono.co/docs) for more explanation. 142 | 143 | Follow on Twitter [@mrflamez\_](https://twitter.com/mrflamez_) 144 | 145 | ## License 146 | 147 | This project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details 148 | --------------------------------------------------------------------------------