Repository: jessepollak/card Branch: master Commit: fb006e9773b5 Files: 50 Total size: 197.9 KB Directory structure: gitextract_km5b62gn/ ├── .github/ │ └── dependabot.yml ├── .gitignore ├── .gitmodules ├── .npmignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── bower.json ├── dist/ │ ├── card.css │ ├── card.js │ ├── card.js.LICENSE.txt │ ├── jquery.card.js │ └── jquery.card.js.LICENSE.txt ├── package.json ├── public/ │ └── index.html ├── src/ │ ├── coffee/ │ │ ├── card.coffee │ │ └── jquery.card.coffee │ └── scss/ │ ├── _mixins.scss │ ├── browsers/ │ │ ├── _ie.scss │ │ └── _safari.scss │ ├── card.scss │ ├── cards/ │ │ ├── _amex.scss │ │ ├── _card.scss │ │ ├── _dankort.scss │ │ ├── _dinersclub.scss │ │ ├── _discover.scss │ │ ├── _elo.scss │ │ ├── _hipercard.scss │ │ ├── _jcb.scss │ │ ├── _maestro.scss │ │ ├── _mastercard.scss │ │ ├── _troy.scss │ │ ├── _unionpay.scss │ │ ├── _visa.scss │ │ └── _visaelectron.scss │ └── logos/ │ ├── _amex.scss │ ├── _dankort.scss │ ├── _dinersclub.scss │ ├── _discover.scss │ ├── _elo.scss │ ├── _hipercard.scss │ ├── _jcb.scss │ ├── _logo.scss │ ├── _maestro.scss │ ├── _mastercard.scss │ ├── _troy.scss │ ├── _unionpay.scss │ ├── _visa.scss │ └── _visaelectron.scss └── webpack.config.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/dependabot.yml ================================================ version: 2 updates: - package-ecosystem: "npm" directory: "/" schedule: interval: "daily" ================================================ FILE: .gitignore ================================================ bower_components .tmp .idea coverage node_modules lib ================================================ FILE: .gitmodules ================================================ [submodule "src/scss/bourbon"] path = src/scss/bourbon url = https://github.com/thoughtbot/bourbon.git [submodule "src/coffee/payment"] path = src/coffee/payment url = https://github.com/jessepollak/payment ================================================ FILE: .npmignore ================================================ # Automatically ignored per: # https://www.npmjs.org/doc/developers.html#Keeping-files-out-of-your-package # # .*.swp # ._* # .DS_Store # .git # .hg # .lock-wscript # .svn # .wafpickle-* # CVS # npm-debug.log # node_modules *.seed *.log *.csv *.dat *.out *.pid *.gz *.orig *.jql.js work build src test spec pids logs results coverage lib-cov html-report xunit.xml .project .idea .settings .iml *.sublime-workspace *.sublime-project ehthumbs.db Icon? Thumbs.db .AppleDouble .LSOverride .Spotlight-V100 .Trashes ================================================ FILE: CONTRIBUTING.md ================================================ # Welcome Welcome to the Card contributor guidelines. We are *so happy to have you*. No matter who you are or what your contributing background is, we want this to be a safe, fun place for you to help out. Card follows the [Clef code of conduct](https://github.com/clef/code-of-conduct) and violations are taken very seriously. If you seem something wrong, please don't hesitate to reach out to [@jessepollak](http://twitter.com/jessepollak) through their email on Github. There is also a strict *no meanness* rule. At every step, please be kind and inclusive, even if people are asking not-so-informed questions. # How do I set up for development? Here's how you can get started developing locally: $ git clone --recursive https://github.com/jessepollak/card.git $ cd card $ git submodule init && git submodule update $ npm install $ npm start Now, if you go to localhost:8080/example in your browser, you should see the demo page. # How to contribute Here are the basic steps to get started contributing: 1. Fork then clone the repo and get development running on your computer. You can find instructions for setting up your development environment above. 2. Replicate the issue you're trying to fix or spec out the feature you're trying to add. Understanding the scope of what you're fixing or adding is important and upfront thought helps. 3. Change the code to fix the bug or add the feature. All changes should happen in the relevant `*.coffee` and `*.scss` files. All `*.js` files are automatically build. 4. Verify that your fix or feature works. 5. Run `NODE_ENV=production gulp build` to build your changes in the production build 6. Commit your changes with an informative description 7. Open a pull request to [the primary repo](https://github.com/jessepollak/card) with your new commit and a descriptive message about what the PR does. # What can I contribute? Check out the [issues](http://github.com/jessepollak/card/issues) for a comprehensive list of unfixed bugs and desired features. ## Are you new? If you're new to open source software, it can be really scary to get started. Believe me, we've all been there. To make it a little less scary, we've tagged a bunch of issues with `good-first-PR` tags. These issues or features are ones that we think will be approachable for a new contributor to the project (or to open source in general). They have a ton of information in the issue that should make it easy to get started. If you want to tackle one of these issues, we are here to help you! Ping [@jessepollak](http://twitter.com/jessepollak) and he'll walk you through everything you need to know to get started. ================================================ FILE: LICENSE ================================================ Copyright (c) 2014 Jesse Pollak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================  # Card - check out the **[demo](https://jessepollak.github.io/card)** ### A better credit card form in one line of code Card will take *any* credit card form and make it the best part of the checkout process (without you changing anything). Everything is created with pure CSS, HTML, and Javascript — no images required.  ## Usage (without jQuery) To use, you'll need to include the Card JavaScript files into your HTML, no CSS link is necessary as the JavaScript file does this for you. You can find the necessary file at `/dist/card.js` and include it in your HTML like so. ```html ``` Once you've included those files, you can initialize Card. ```javascript var card = new Card({ // a selector or DOM element for the form where users will // be entering their information form: 'form', // *required* // a selector or DOM element for the container // where you want the card to appear container: '.card-wrapper', // *required* formSelectors: { numberInput: 'input#number', // optional — default input[name="number"] expiryInput: 'input#expiry', // optional — default input[name="expiry"] cvcInput: 'input#cvc', // optional — default input[name="cvc"] nameInput: 'input#name' // optional - defaults input[name="name"] }, width: 200, // optional — default 350px formatting: true, // optional - default true // Strings for translation - optional messages: { validDate: 'valid\ndate', // optional - default 'valid\nthru' monthYear: 'mm/yyyy', // optional - default 'month/year' }, // Default placeholders for rendered fields - optional placeholders: { number: '•••• •••• •••• ••••', name: 'Full Name', expiry: '••/••', cvc: '•••' }, masks: { cardNumber: '•' // optional - mask card number }, // if true, will log helpful messages for setting up Card debug: false // optional - default false }); ``` ### Installing card from bower If you're using bower, you can install card.js with: bower install card --save ### Installing card from npm If you're using npm, you can install card.js with: npm install --save card var $ = require("jquery"); // The current card.js code does not explictly require jQuery, but instead uses the global, so this line is needed. window.jQuery = $; var card = require("card"); ### Using multiple inputs for one field Card can be used in forms where you have multiple inputs that render to a single field (i.e. you have a first and last name input). To use Card with this functionality, just pass in a selector that selects the fields in the correct order. For example, ```html
``` ### Rendering with different initial card placeholders Card renders with default placeholders for card `name`, `number`, `expiry`, and `cvc`. To override these placeholders, you can pass in a `placeholders` object. ```html ``` ### Translation To render the card with the strings in a different language, you can pass in a `messages` object. ```html ``` ## Using with jQuery To use with jQuery, you'll need to include the `jquery.card.js` file into your HTML. You can find the necessary file at `/dist/jquery.card.js` and include it in your HTML like so. ```html ``` Once you've included those files, you can initialize Card with jQuery. ```javascript $('form').card({ // a selector or DOM element for the container // where you want the card to appear container: '.card-wrapper', // *required* // all of the other options from above }); ``` ## Using with other javascript libraries Card has wrappers that make it easy to use with other javascript libraries: ### Angular 1.x * [angular-card](https://github.com/gavruk/angular-card) ### Angular 2+ * [ngx-card](https://github.com/ihym/ngx-card) ### Ember * [ember-credit-card](https://github.com/esbanarango/ember-credit-card) ### React * [react-credit-card](https://github.com/JohnyDays/react-credit-card) * [card-react](https://github.com/shatran/card-react) * [react-plastic](https://github.com/armsteadj1/react-plastic) - static CSS only version. ### Vue For use with VueJs, install card.js from npm: ```bash npm install card --save ``` Add in your component an Div with class 'card-wrapper', just pass in a selector that selects the fields in the correct order. Import the component card.js and add the object in instance mounted like this example: ```html ``` ## Development To contribute, follow this steps: ```bash $ git clone --recursive https://github.com/jessepollak/card.git $ cd card $ git submodule init && git submodule update $ npm install $ npm run development ``` Now, if you go to localhost:8080/example in your browser, you should see the demo page. ## Places using Card Card is used in the wild in these places: * [InspectAll](http://www.inspectall.com/) * [PennyWhale](https://www.pennywhale.com/) * [MakeSpace](https://www.makespace.com/) * [Blumpa](http://www.blumpa.com/) * [CourseLoads](http://www.courseloads.com/) * [PubNub](http://pubnub.com/) * [GigSalad](https://www.gigsalad.com) * [Boligninja](http://www.boligninja.dk) * [EasyCarros](http://www.easycarros.com/) * [Sintelle](http://www.sintelleparapharmacie.com/) * [Wevorce](http://wevorce.com/) * [PayumServer](https://github.com/Payum/PayumServer) * [Paribus](https://paribus.co) * [Bizzabo](https://www.bizzabo.com) * [Tortuba](https://www.tortuba.com) * [Netlify](https://www.netlify.com) * [The Spice House](https://www.thespicehouse.com/) * [Touts](https://www.touts.com.br/) * [Ryman Limited](http://www.ryman.co.uk) * [Robert Dyas](http://www.robertdyas.co.uk) * [ROKA](https://www.rokahub.com) * [LeSalon](https://lesalon.com) * [Kenyan Directorate Of Immigration And Citizen Service](https://dis.ecitizen.go.ke) Are you using Card in production? If so, we'd love to link to you from this page. Open a PR or drop [@jessepollak](http://twitter.com/jessepollak) a line on [Twitter](http://twitter.com/jessepollak) and we'll add you right away! ## Project scope The project scope is to improve the capture of payment cards on websites. Issues and fixes related to the user interface and validating of payment cards are in scope. For questions on how to use Card in your particular project, please ask on Stack Overflow or similar forum. ## Donations If you'd like to donate to help support development of Card, send Bitcoin directly to `17NUKd3v7GWben18kGhmFafa4ZpWrXpQSC` or through Coinbase [here](https://coinbase.com/jessepollak). ================================================ FILE: bower.json ================================================ { "name": "card", "homepage": "https://github.com/jessepollak/card", "authors": ["Jesse Pollak{"use strict";var a=t(648);r.exports=Function.prototype.bind||a},221:r=>{"use strict";"undefined"!=typeof self?r.exports=self:"undefined"!=typeof window?r.exports=window:r.exports=Function("return this")()},168:(r,e,t)=>{"use strict";var a=t(221);r.exports=function(){return"object"==typeof t.g&&t.g&&t.g.Math===Math&&t.g.Array===Array?t.g:a}},642:(r,e,t)=>{"use strict";var a=t(612);r.exports=a.call(Function.call,Object.prototype.hasOwnProperty)},452:r=>{"use strict";var e,t,a=Object.prototype,n=a.hasOwnProperty,o=a.toString;"function"==typeof Symbol&&(e=Symbol.prototype.valueOf),"function"==typeof BigInt&&(t=BigInt.prototype.valueOf);var i=function(r){return r!=r},d={boolean:1,number:1,string:1,undefined:1},c=/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/,p=/^[A-Fa-f0-9]+$/,l={};l.a=l.type=function(r,e){return typeof r===e},l.defined=function(r){return void 0!==r},l.empty=function(r){var e,t=o.call(r);if("[object Array]"===t||"[object Arguments]"===t||"[object String]"===t)return 0===r.length;if("[object Object]"===t){for(e in r)if(n.call(r,e))return!1;return!0}return!r},l.equal=function(r,e){if(r===e)return!0;var t,a=o.call(r);if(a!==o.call(e))return!1;if("[object Object]"===a){for(t in r)if(!l.equal(r[t],e[t])||!(t in e))return!1;for(t in e)if(!l.equal(r[t],e[t])||!(t in r))return!1;return!0}if("[object Array]"===a){if((t=r.length)!==e.length)return!1;for(;t--;)if(!l.equal(r[t],e[t]))return!1;return!0}return"[object Function]"===a?r.prototype===e.prototype:"[object Date]"===a&&r.getTime()===e.getTime()},l.hosted=function(r,e){var t=typeof e[r];return"object"===t?!!e[r]:!d[t]},l.instance=l.instanceof=function(r,e){return r instanceof e},l.nil=l.null=function(r){return null===r},l.undef=l.undefined=function(r){return void 0===r},l.args=l.arguments=function(r){var e="[object Arguments]"===o.call(r),t=!l.array(r)&&l.arraylike(r)&&l.object(r)&&l.fn(r.callee);return e||t},l.array=Array.isArray||function(r){return"[object Array]"===o.call(r)},l.args.empty=function(r){return l.args(r)&&0===r.length},l.array.empty=function(r){return l.array(r)&&0===r.length},l.arraylike=function(r){return!!r&&!l.bool(r)&&n.call(r,"length")&&isFinite(r.length)&&l.number(r.length)&&r.length>=0},l.bool=l.boolean=function(r){return"[object Boolean]"===o.call(r)},l.false=function(r){return l.bool(r)&&!1===Boolean(Number(r))},l.true=function(r){return l.bool(r)&&!0===Boolean(Number(r))},l.date=function(r){return"[object Date]"===o.call(r)},l.date.valid=function(r){return l.date(r)&&!isNaN(Number(r))},l.element=function(r){return void 0!==r&&"undefined"!=typeof HTMLElement&&r instanceof HTMLElement&&1===r.nodeType},l.error=function(r){return"[object Error]"===o.call(r)},l.fn=l.function=function(r){if("undefined"!=typeof window&&r===window.alert)return!0;var e=o.call(r);return"[object Function]"===e||"[object GeneratorFunction]"===e||"[object AsyncFunction]"===e},l.number=function(r){return"[object Number]"===o.call(r)},l.infinite=function(r){return r===1/0||r===-1/0},l.decimal=function(r){return l.number(r)&&!i(r)&&!l.infinite(r)&&r%1!=0},l.divisibleBy=function(r,e){var t=l.infinite(r),a=l.infinite(e),n=l.number(r)&&!i(r)&&l.number(e)&&!i(e)&&0!==e;return t||a||n&&r%e==0},l.integer=l.int=function(r){return l.number(r)&&!i(r)&&r%1==0},l.maximum=function(r,e){if(i(r))throw new TypeError("NaN is not a valid value");if(!l.arraylike(e))throw new TypeError("second argument must be array-like");for(var t=e.length;--t>=0;)if(r {"use strict";var a=t(648);r.exports=Function.prototype.bind||a},221:r=>{"use strict";"undefined"!=typeof self?r.exports=self:"undefined"!=typeof window?r.exports=window:r.exports=Function("return this")()},168:(r,e,t)=>{"use strict";var a=t(221);r.exports=function(){return"object"==typeof t.g&&t.g&&t.g.Math===Math&&t.g.Array===Array?t.g:a}},642:(r,e,t)=>{"use strict";var a=t(612);r.exports=a.call(Function.call,Object.prototype.hasOwnProperty)},452:r=>{"use strict";var e,t,a=Object.prototype,n=a.hasOwnProperty,o=a.toString;"function"==typeof Symbol&&(e=Symbol.prototype.valueOf),"function"==typeof BigInt&&(t=BigInt.prototype.valueOf);var i=function(r){return r!=r},d={boolean:1,number:1,string:1,undefined:1},c=/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/,p=/^[A-Fa-f0-9]+$/,l={};l.a=l.type=function(r,e){return typeof r===e},l.defined=function(r){return void 0!==r},l.empty=function(r){var e,t=o.call(r);if("[object Array]"===t||"[object Arguments]"===t||"[object String]"===t)return 0===r.length;if("[object Object]"===t){for(e in r)if(n.call(r,e))return!1;return!0}return!r},l.equal=function(r,e){if(r===e)return!0;var t,a=o.call(r);if(a!==o.call(e))return!1;if("[object Object]"===a){for(t in r)if(!l.equal(r[t],e[t])||!(t in e))return!1;for(t in e)if(!l.equal(r[t],e[t])||!(t in r))return!1;return!0}if("[object Array]"===a){if((t=r.length)!==e.length)return!1;for(;t--;)if(!l.equal(r[t],e[t]))return!1;return!0}return"[object Function]"===a?r.prototype===e.prototype:"[object Date]"===a&&r.getTime()===e.getTime()},l.hosted=function(r,e){var t=typeof e[r];return"object"===t?!!e[r]:!d[t]},l.instance=l.instanceof=function(r,e){return r instanceof e},l.nil=l.null=function(r){return null===r},l.undef=l.undefined=function(r){return void 0===r},l.args=l.arguments=function(r){var e="[object Arguments]"===o.call(r),t=!l.array(r)&&l.arraylike(r)&&l.object(r)&&l.fn(r.callee);return e||t},l.array=Array.isArray||function(r){return"[object Array]"===o.call(r)},l.args.empty=function(r){return l.args(r)&&0===r.length},l.array.empty=function(r){return l.array(r)&&0===r.length},l.arraylike=function(r){return!!r&&!l.bool(r)&&n.call(r,"length")&&isFinite(r.length)&&l.number(r.length)&&r.length>=0},l.bool=l.boolean=function(r){return"[object Boolean]"===o.call(r)},l.false=function(r){return l.bool(r)&&!1===Boolean(Number(r))},l.true=function(r){return l.bool(r)&&!0===Boolean(Number(r))},l.date=function(r){return"[object Date]"===o.call(r)},l.date.valid=function(r){return l.date(r)&&!isNaN(Number(r))},l.element=function(r){return void 0!==r&&"undefined"!=typeof HTMLElement&&r instanceof HTMLElement&&1===r.nodeType},l.error=function(r){return"[object Error]"===o.call(r)},l.fn=l.function=function(r){if("undefined"!=typeof window&&r===window.alert)return!0;var e=o.call(r);return"[object Function]"===e||"[object GeneratorFunction]"===e||"[object AsyncFunction]"===e},l.number=function(r){return"[object Number]"===o.call(r)},l.infinite=function(r){return r===1/0||r===-1/0},l.decimal=function(r){return l.number(r)&&!i(r)&&!l.infinite(r)&&r%1!=0},l.divisibleBy=function(r,e){var t=l.infinite(r),a=l.infinite(e),n=l.number(r)&&!i(r)&&l.number(e)&&!i(e)&&0!==e;return t||a||n&&r%e==0},l.integer=l.int=function(r){return l.number(r)&&!i(r)&&r%1==0},l.maximum=function(r,e){if(i(r))throw new TypeError("NaN is not a valid value");if(!l.arraylike(e))throw new TypeError("second argument must be array-like");for(var t=e.length;--t>=0;)if(r