stockor 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +15 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +97 -193
- data/client/skr/Extension.coffee +8 -4
- data/client/skr/api.js +21 -0
- data/client/skr/api.scss +148 -0
- data/client/skr/api/Components/AddressForm.cjsx +47 -0
- data/client/skr/api/Components/Base.coffee +7 -0
- data/client/skr/api/Components/SaleHistory.cjsx +32 -0
- data/client/skr/api/Components/SingleItemCart.cjsx +30 -0
- data/client/skr/api/Models/Base.coffee +10 -0
- data/client/skr/api/Models/Cart.coffee +40 -0
- data/client/skr/api/Models/Sale.coffee +43 -0
- data/client/skr/api/Models/SalesHistory.coffee +17 -0
- data/client/skr/api/Models/Sku.coffee +16 -0
- data/client/skr/api/SingleItemCheckout.cjsx +99 -0
- data/client/skr/api/namespace.js +6 -0
- data/client/skr/api/onReady.coffee +23 -0
- data/client/skr/components/CreditCardForm.cjsx +35 -0
- data/client/skr/components/CustomerFinder.cjsx +0 -3
- data/client/skr/components/InvoiceFinder.cjsx +1 -0
- data/client/skr/components/LatexSnippets.cjsx +65 -0
- data/client/skr/components/LocationChooser.cjsx +5 -1
- data/client/skr/components/PrintButton.cjsx +33 -0
- data/client/skr/components/PrintFormChooser.cjsx +10 -10
- data/client/skr/components/SalesOrderFinder.cjsx +2 -1
- data/client/skr/components/SystemSettings.cjsx +69 -9
- data/client/skr/components/address/index.js +1 -0
- data/client/skr/models/Address.coffee +3 -0
- data/client/skr/models/CreditCard.coffee +49 -0
- data/client/skr/models/CreditCardGateway.coffee +27 -0
- data/client/skr/models/Invoice.coffee +13 -5
- data/client/skr/models/Location.coffee +6 -4
- data/client/skr/models/Payment.coffee +33 -13
- data/client/skr/models/SalesOrder.coffee +7 -3
- data/client/skr/models/SequentialId.coffee +17 -0
- data/client/skr/models/Sku.coffee +1 -1
- data/client/skr/models/TimeEntry.coffee +3 -4
- data/client/skr/models/mixins/PrintSupport.coffee +4 -1
- data/client/skr/models/mixins/SkuLine.coffee +1 -1
- data/client/skr/screens/customer-maint/CustomerMaint.cjsx +1 -2
- data/client/skr/screens/customer-projects/CustomerProjects.cjsx +7 -3
- data/client/skr/screens/customer-projects/index.scss +1 -0
- data/client/skr/screens/fresh-books-import/ApiInfo.cjsx +1 -1
- data/client/skr/screens/gl-accounts/GlAccounts.cjsx +1 -1
- data/client/skr/screens/gl-transactions/GlTransactions.cjsx +1 -1
- data/client/skr/screens/invoice/Invoice.cjsx +9 -17
- data/client/skr/screens/invoice/Payment.cjsx +94 -13
- data/client/skr/screens/invoice/index.scss +32 -0
- data/client/skr/screens/locations/Locations.cjsx +3 -2
- data/client/skr/screens/payment-category/PaymentCategory.cjsx +1 -1
- data/client/skr/screens/payments/Payments.cjsx +5 -4
- data/client/skr/screens/sale-report/SaleReport.cjsx +73 -0
- data/client/skr/screens/sale-report/index.js +5 -0
- data/client/skr/screens/sale-report/index.scss +9 -0
- data/client/skr/screens/sales-order/SalesOrder.cjsx +4 -4
- data/client/skr/screens/sku-maint/SkuMaint.cjsx +5 -0
- data/client/skr/screens/sku-maint/SkuUomList.cjsx +45 -56
- data/client/skr/screens/sku-maint/index.scss +33 -13
- data/client/skr/screens/time-invoicing/TimeInvoicing.cjsx +2 -2
- data/client/skr/screens/time-tracking/EditEntry.cjsx +2 -4
- data/client/skr/screens/time-tracking/TimeTracking.cjsx +1 -1
- data/client/skr/screens/vendor-maint/VendorMaint.cjsx +1 -1
- data/client/skr/vendor/index.js +2438 -0
- data/config/lanes.rb +10 -3
- data/config/routes.rb +9 -7
- data/config/screens.rb +39 -13
- data/db/migrate/20160517032350_create_remove_location_logos.rb +11 -0
- data/db/migrate/20160531014306_create_public_skus.rb +7 -0
- data/db/migrate/20160604195848_create_null_addresses.rb +9 -0
- data/db/migrate/20160605024432_create_sku_associations_views.rb +48 -0
- data/db/migrate/20160608023553_create_invoice_payments.rb +9 -0
- data/db/migrate/20160620010455_add_payments_to_inv_details.rb +54 -0
- data/db/schema.sql +206 -38
- data/db/seed.rb +6 -0
- data/lib/skr.rb +1 -1
- data/lib/skr/access_roles.rb +6 -1
- data/lib/skr/concerns/has_gl_transaction.rb +8 -0
- data/lib/skr/concerns/inv_extensions.rb +11 -0
- data/lib/skr/concerns/is_order_like.rb +3 -3
- data/lib/skr/concerns/visible_id_identifier.rb +3 -8
- data/lib/skr/configuration.rb +2 -0
- data/lib/skr/extension.rb +6 -0
- data/lib/skr/handlers/credit_card_gateway.rb +31 -0
- data/lib/skr/handlers/invoice_from_time_entries.rb +12 -26
- data/lib/skr/handlers/sales.rb +44 -0
- data/lib/skr/handlers/sequential_ids.rb +46 -0
- data/lib/skr/handlers/skus.rb +36 -0
- data/lib/skr/jobs/fresh_books/import.rb +3 -1
- data/lib/skr/merchant_gateway.rb +37 -0
- data/lib/skr/models/address.rb +7 -5
- data/lib/skr/models/bank_account.rb +12 -0
- data/lib/skr/models/business_entity.rb +1 -1
- data/lib/skr/models/gl_transaction.rb +3 -0
- data/lib/skr/models/inv_line.rb +7 -2
- data/lib/skr/models/inventory_adjustment.rb +0 -5
- data/lib/skr/models/invoice.rb +25 -36
- data/lib/skr/models/location.rb +1 -1
- data/lib/skr/models/payment.rb +56 -10
- data/lib/skr/models/po_receipt.rb +0 -8
- data/lib/skr/models/sales_order.rb +7 -2
- data/lib/skr/models/sequential_id.rb +6 -1
- data/lib/skr/models/sku.rb +3 -0
- data/lib/skr/print.rb +1 -0
- data/lib/skr/print/context.rb +19 -0
- data/lib/skr/print/form.rb +7 -1
- data/lib/skr/version.rb +1 -1
- data/npm-build/package.json +26 -0
- data/npm-build/vendor.js +10 -0
- data/npm-build/webpack.config.js +25 -0
- data/spec/fixtures/skr/bank_account.yml +9 -0
- data/spec/fixtures/skr/customer.yml +10 -0
- data/spec/fixtures/skr/inv_line.yml +12 -0
- data/spec/fixtures/skr/invoice.yml +17 -0
- data/spec/fixtures/skr/payment_category.yml +6 -0
- data/spec/fixtures/skr/sales_order.yml +1 -1
- data/spec/fixtures/skr/sku.yml +10 -0
- data/spec/fixtures/skr/sku_loc.yml +4 -0
- data/spec/fixtures/skr/uom.yml +6 -0
- data/spec/server/handlers/invoice_from_time_entries_spec.rb +13 -6
- data/spec/server/handlers/sequential_ids_spec.rb +22 -0
- data/spec/server/models/invoice_spec.rb +36 -0
- data/spec/server/models/payment_spec.rb +50 -22
- data/spec/server/models/sales_order_spec.rb +12 -0
- data/spec/server/print/form_spec.rb +20 -4
- data/spec/skr/api/SingleItemCheckoutSpec.cjsx +10 -0
- data/spec/skr/screens/sale-report/SaleReportSpec.coffee +5 -0
- data/stockor.gemspec +5 -4
- data/templates/print/layout.tex.erb +1 -1
- data/templates/print/packages/INSTALL +7 -0
- data/templates/print/packages/qrcode.sty +3051 -0
- data/templates/print/packages/svgnam.def +186 -0
- data/templates/print/packages/x11nam.def +352 -0
- data/templates/print/packages/xcolor.pro +58 -0
- data/templates/print/packages/xcolor.sty +1460 -0
- data/templates/print/types/invoice/default.tex.erb +2 -0
- data/templates/print/types/invoice/labor.tex.erb +2 -1
- data/templates/print/types/invoice/ticket.tex.erb +41 -0
- data/templates/print/types/payment/default.tex.erb +13 -12
- metadata +78 -12
@@ -1,21 +1,39 @@
|
|
1
1
|
.sku-maint {
|
2
2
|
|
3
3
|
.sku-uom-list {
|
4
|
+
|
5
|
+
display: flex;
|
6
|
+
|
4
7
|
.value.read-only {padding-top: 2px; }
|
5
8
|
ul {
|
6
|
-
|
7
|
-
padding
|
8
|
-
|
9
|
-
|
9
|
+
flex: 1;
|
10
|
+
padding: 0;
|
11
|
+
display: flex;
|
12
|
+
align-items: center;
|
13
|
+
|
14
|
+
/* margin: 0; */
|
15
|
+
/* padding-left: 0; */
|
16
|
+
/* list-style: none; */
|
17
|
+
/* padding-right: 0; */
|
10
18
|
|
11
19
|
> li {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
20
|
+
height: 85%;
|
21
|
+
|
22
|
+
list-style-type: none;
|
23
|
+
margin-left: 4px;
|
24
|
+
|
25
|
+
display: flex;
|
26
|
+
justify-content: center;
|
27
|
+
align-items: center;
|
28
|
+
padding: 5px;
|
29
|
+
|
30
|
+
/* float: left; */
|
31
|
+
/* display: inline-block; */
|
32
|
+
/* padding-left: 5px; */
|
33
|
+
/* padding-right: 5px; */
|
34
|
+
/* margin: 1px; */
|
35
|
+
/* padding: 0.214em 0.15em 0.214em 0.4em; */
|
36
|
+
/* line-height: 1.4em; */
|
19
37
|
text-align: center;
|
20
38
|
vertical-align: middle;
|
21
39
|
white-space: nowrap;
|
@@ -31,9 +49,11 @@
|
|
31
49
|
}
|
32
50
|
}
|
33
51
|
}
|
34
|
-
|
52
|
+
.popover {
|
53
|
+
max-width: inherit;
|
54
|
+
}
|
35
55
|
.sku-uom-edit {
|
36
|
-
width:
|
56
|
+
width: 320px;
|
37
57
|
}
|
38
58
|
|
39
59
|
}
|
@@ -15,10 +15,10 @@ class Skr.Screens.TimeInvoicing extends Skr.Screens.Base
|
|
15
15
|
@gridSelections
|
16
16
|
{
|
17
17
|
id: 'start_at', fixedWidth: 200,
|
18
|
-
format: Lanes.u.format.
|
18
|
+
format: Lanes.u.format.shortDateTime
|
19
19
|
}, {
|
20
20
|
id: 'end_at', fixedWidth: 200,
|
21
|
-
format: Lanes.u.format.
|
21
|
+
format: Lanes.u.format.shortDateTime
|
22
22
|
}, {
|
23
23
|
id: 'hours', fixedWidth: 80, textAlign: 'center', editable: false,
|
24
24
|
query: false, format: (v, row) -> hoursForRow(row)
|
@@ -37,13 +37,11 @@ class Skr.Screens.TimeTracking.EditEntry extends Lanes.React.Component
|
|
37
37
|
</BS.Row><BS.Row>
|
38
38
|
<LC.DateTime {...props} step={15} name="end_at"/>
|
39
39
|
</BS.Row><BS.Row>
|
40
|
-
<LC.
|
40
|
+
<LC.TextArea sm={12}
|
41
|
+
selectOnFocus editOnly
|
41
42
|
model={@entry}
|
42
|
-
ref='textarea'
|
43
43
|
onEnter={@onSave}
|
44
|
-
selectOnFocus editOnly
|
45
44
|
name="description"
|
46
|
-
type="textarea"
|
47
45
|
label='Description'
|
48
46
|
/>
|
49
47
|
</BS.Row>
|
@@ -26,7 +26,7 @@ class Skr.Screens.VendorMaint extends Lanes.React.Screen
|
|
26
26
|
<LC.Input sm=8 name="name" model={@vendor} />
|
27
27
|
</BS.Row>
|
28
28
|
<BS.Row>
|
29
|
-
<LC.
|
29
|
+
<LC.TextArea sm=12 name="notes" model={@vendor} />
|
30
30
|
</BS.Row>
|
31
31
|
<BS.Row>
|
32
32
|
<SC.GlAccountChooser sm=4 label="Payables Account"
|
@@ -0,0 +1,2438 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
/* WEBPACK VAR INJECTION */(function(global) {var previousLanes = global.Lanes;
|
48
|
+
|
49
|
+
var Lanes = ( global.Lanes || (global.Lanes = {}) );
|
50
|
+
|
51
|
+
Lanes.Skr = ( Lanes.Skr || {} );
|
52
|
+
|
53
|
+
Lanes.Skr.Vendor = ( Lanes.Skr.Vendor || {} );
|
54
|
+
|
55
|
+
Lanes.Skr.Vendor.Card = __webpack_require__(1);
|
56
|
+
Lanes.Skr.Vendor.Payment = __webpack_require__(7);
|
57
|
+
|
58
|
+
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
59
|
+
|
60
|
+
/***/ },
|
61
|
+
/* 1 */
|
62
|
+
/***/ function(module, exports, __webpack_require__) {
|
63
|
+
|
64
|
+
/* WEBPACK VAR INJECTION */(function(global) {var Card, QJ, extend, payment;
|
65
|
+
|
66
|
+
__webpack_require__(2);
|
67
|
+
|
68
|
+
QJ = __webpack_require__(6);
|
69
|
+
|
70
|
+
payment = __webpack_require__(7);
|
71
|
+
|
72
|
+
extend = __webpack_require__(8);
|
73
|
+
|
74
|
+
Card = (function() {
|
75
|
+
var bindVal;
|
76
|
+
|
77
|
+
Card.prototype.initializedDataAttr = "data-jp-card-initialized";
|
78
|
+
|
79
|
+
Card.prototype.cardTemplate = '' + '<div class="jp-card-container">' + '<div class="jp-card">' + '<div class="jp-card-front">' + '<div class="jp-card-logo jp-card-elo">' + '<div class="e">e</div>' + '<div class="l">l</div>' + '<div class="o">o</div>' + '</div>' + '<div class="jp-card-logo jp-card-visa">visa</div>' + '<div class="jp-card-logo jp-card-mastercard">MasterCard</div>' + '<div class="jp-card-logo jp-card-maestro">Maestro</div>' + '<div class="jp-card-logo jp-card-amex"></div>' + '<div class="jp-card-logo jp-card-discover">discover</div>' + '<div class="jp-card-logo jp-card-dankort"><div class="dk"><div class="d"></div><div class="k"></div></div></div>' + '<div class="jp-card-lower">' + '<div class="jp-card-shiny"></div>' + '<div class="jp-card-cvc jp-card-display">{{cvc}}</div>' + '<div class="jp-card-number jp-card-display">{{number}}</div>' + '<div class="jp-card-name jp-card-display">{{name}}</div>' + '<div class="jp-card-expiry jp-card-display" data-before="{{monthYear}}" data-after="{{validDate}}">{{expiry}}</div>' + '</div>' + '</div>' + '<div class="jp-card-back">' + '<div class="jp-card-bar"></div>' + '<div class="jp-card-cvc jp-card-display">{{cvc}}</div>' + '<div class="jp-card-shiny"></div>' + '</div>' + '</div>' + '</div>';
|
80
|
+
|
81
|
+
Card.prototype.template = function(tpl, data) {
|
82
|
+
return tpl.replace(/\{\{(.*?)\}\}/g, function(match, key, str) {
|
83
|
+
return data[key];
|
84
|
+
});
|
85
|
+
};
|
86
|
+
|
87
|
+
Card.prototype.cardTypes = ['jp-card-amex', 'jp-card-dankort', 'jp-card-dinersclub', 'jp-card-discover', 'jp-card-jcb', 'jp-card-laser', 'jp-card-maestro', 'jp-card-mastercard', 'jp-card-unionpay', 'jp-card-visa', 'jp-card-visaelectron', 'jp-card-elo'];
|
88
|
+
|
89
|
+
Card.prototype.defaults = {
|
90
|
+
formatting: true,
|
91
|
+
formSelectors: {
|
92
|
+
numberInput: 'input[name="number"]',
|
93
|
+
expiryInput: 'input[name="expiry"]',
|
94
|
+
cvcInput: 'input[name="cvc"]',
|
95
|
+
nameInput: 'input[name="name"]'
|
96
|
+
},
|
97
|
+
cardSelectors: {
|
98
|
+
cardContainer: '.jp-card-container',
|
99
|
+
card: '.jp-card',
|
100
|
+
numberDisplay: '.jp-card-number',
|
101
|
+
expiryDisplay: '.jp-card-expiry',
|
102
|
+
cvcDisplay: '.jp-card-cvc',
|
103
|
+
nameDisplay: '.jp-card-name'
|
104
|
+
},
|
105
|
+
messages: {
|
106
|
+
validDate: 'valid\nthru',
|
107
|
+
monthYear: 'month/year'
|
108
|
+
},
|
109
|
+
placeholders: {
|
110
|
+
number: '•••• •••• •••• ••••',
|
111
|
+
cvc: '•••',
|
112
|
+
expiry: '••/••',
|
113
|
+
name: 'Full Name'
|
114
|
+
},
|
115
|
+
classes: {
|
116
|
+
valid: 'jp-card-valid',
|
117
|
+
invalid: 'jp-card-invalid'
|
118
|
+
},
|
119
|
+
debug: false
|
120
|
+
};
|
121
|
+
|
122
|
+
function Card(opts) {
|
123
|
+
var toInitialize;
|
124
|
+
this.options = extend(true, this.defaults, opts);
|
125
|
+
if (!this.options.form) {
|
126
|
+
console.log("Please provide a form");
|
127
|
+
return;
|
128
|
+
}
|
129
|
+
this.$el = QJ(this.options.form);
|
130
|
+
if (!this.options.container) {
|
131
|
+
console.log("Please provide a container");
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
this.$container = QJ(this.options.container);
|
135
|
+
toInitialize = QJ.isDOMElement(this.$container) ? this.$container : this.$container[0];
|
136
|
+
if (toInitialize.getAttribute(this.initializedDataAttr)) {
|
137
|
+
return;
|
138
|
+
}
|
139
|
+
toInitialize.setAttribute(this.initializedDataAttr, true);
|
140
|
+
this.render();
|
141
|
+
this.attachHandlers();
|
142
|
+
this.handleInitialPlaceholders();
|
143
|
+
}
|
144
|
+
|
145
|
+
Card.prototype.render = function() {
|
146
|
+
var $cardContainer, baseWidth, name, obj, ref, ref1, selector, ua;
|
147
|
+
QJ.append(this.$container, this.template(this.cardTemplate, extend({}, this.options.messages, this.options.placeholders)));
|
148
|
+
ref = this.options.cardSelectors;
|
149
|
+
for (name in ref) {
|
150
|
+
selector = ref[name];
|
151
|
+
this["$" + name] = QJ.find(this.$container, selector);
|
152
|
+
}
|
153
|
+
ref1 = this.options.formSelectors;
|
154
|
+
for (name in ref1) {
|
155
|
+
selector = ref1[name];
|
156
|
+
selector = this.options[name] ? this.options[name] : selector;
|
157
|
+
obj = QJ.find(this.$el, selector);
|
158
|
+
if (!obj.length && this.options.debug) {
|
159
|
+
console.error("Card can't find a " + name + " in your form.");
|
160
|
+
}
|
161
|
+
this["$" + name] = obj;
|
162
|
+
}
|
163
|
+
if (this.options.formatting) {
|
164
|
+
Payment.formatCardNumber(this.$numberInput);
|
165
|
+
Payment.formatCardCVC(this.$cvcInput);
|
166
|
+
Payment.formatCardExpiry(this.$expiryInput);
|
167
|
+
}
|
168
|
+
if (this.options.width) {
|
169
|
+
$cardContainer = QJ(this.options.cardSelectors.cardContainer)[0];
|
170
|
+
baseWidth = parseInt($cardContainer.clientWidth);
|
171
|
+
$cardContainer.style.transform = "scale(" + (this.options.width / baseWidth) + ")";
|
172
|
+
}
|
173
|
+
if (typeof navigator !== "undefined" && navigator !== null ? navigator.userAgent : void 0) {
|
174
|
+
ua = navigator.userAgent.toLowerCase();
|
175
|
+
if (ua.indexOf('safari') !== -1 && ua.indexOf('chrome') === -1) {
|
176
|
+
QJ.addClass(this.$card, 'jp-card-safari');
|
177
|
+
}
|
178
|
+
}
|
179
|
+
if (/MSIE 10\./i.test(navigator.userAgent)) {
|
180
|
+
QJ.addClass(this.$card, 'jp-card-ie-10');
|
181
|
+
}
|
182
|
+
if (/rv:11.0/i.test(navigator.userAgent)) {
|
183
|
+
return QJ.addClass(this.$card, 'jp-card-ie-11');
|
184
|
+
}
|
185
|
+
};
|
186
|
+
|
187
|
+
Card.prototype.attachHandlers = function() {
|
188
|
+
var expiryFilters;
|
189
|
+
bindVal(this.$numberInput, this.$numberDisplay, {
|
190
|
+
fill: false,
|
191
|
+
filters: this.validToggler('cardNumber')
|
192
|
+
});
|
193
|
+
QJ.on(this.$numberInput, 'payment.cardType', this.handle('setCardType'));
|
194
|
+
expiryFilters = [
|
195
|
+
function(val) {
|
196
|
+
return val.replace(/(\s+)/g, '');
|
197
|
+
}
|
198
|
+
];
|
199
|
+
expiryFilters.push(this.validToggler('cardExpiry'));
|
200
|
+
bindVal(this.$expiryInput, this.$expiryDisplay, {
|
201
|
+
join: function(text) {
|
202
|
+
if (text[0].length === 2 || text[1]) {
|
203
|
+
return "/";
|
204
|
+
} else {
|
205
|
+
return "";
|
206
|
+
}
|
207
|
+
},
|
208
|
+
filters: expiryFilters
|
209
|
+
});
|
210
|
+
bindVal(this.$cvcInput, this.$cvcDisplay, {
|
211
|
+
filters: this.validToggler('cardCVC')
|
212
|
+
});
|
213
|
+
QJ.on(this.$cvcInput, 'focus', this.handle('flipCard'));
|
214
|
+
QJ.on(this.$cvcInput, 'blur', this.handle('unflipCard'));
|
215
|
+
return bindVal(this.$nameInput, this.$nameDisplay, {
|
216
|
+
fill: false,
|
217
|
+
filters: this.validToggler('cardHolderName'),
|
218
|
+
join: ' '
|
219
|
+
});
|
220
|
+
};
|
221
|
+
|
222
|
+
Card.prototype.handleInitialPlaceholders = function() {
|
223
|
+
var el, name, ref, results, selector;
|
224
|
+
ref = this.options.formSelectors;
|
225
|
+
results = [];
|
226
|
+
for (name in ref) {
|
227
|
+
selector = ref[name];
|
228
|
+
el = this["$" + name];
|
229
|
+
if (QJ.val(el)) {
|
230
|
+
QJ.trigger(el, 'paste');
|
231
|
+
results.push(setTimeout(function() {
|
232
|
+
return QJ.trigger(el, 'keyup');
|
233
|
+
}));
|
234
|
+
} else {
|
235
|
+
results.push(void 0);
|
236
|
+
}
|
237
|
+
}
|
238
|
+
return results;
|
239
|
+
};
|
240
|
+
|
241
|
+
Card.prototype.handle = function(fn) {
|
242
|
+
return (function(_this) {
|
243
|
+
return function(e) {
|
244
|
+
var args;
|
245
|
+
args = Array.prototype.slice.call(arguments);
|
246
|
+
args.unshift(e.target);
|
247
|
+
return _this.handlers[fn].apply(_this, args);
|
248
|
+
};
|
249
|
+
})(this);
|
250
|
+
};
|
251
|
+
|
252
|
+
Card.prototype.validToggler = function(validatorName) {
|
253
|
+
var isValid;
|
254
|
+
if (validatorName === "cardExpiry") {
|
255
|
+
isValid = function(val) {
|
256
|
+
var objVal;
|
257
|
+
objVal = Payment.fns.cardExpiryVal(val);
|
258
|
+
return Payment.fns.validateCardExpiry(objVal.month, objVal.year);
|
259
|
+
};
|
260
|
+
} else if (validatorName === "cardCVC") {
|
261
|
+
isValid = (function(_this) {
|
262
|
+
return function(val) {
|
263
|
+
return Payment.fns.validateCardCVC(val, _this.cardType);
|
264
|
+
};
|
265
|
+
})(this);
|
266
|
+
} else if (validatorName === "cardNumber") {
|
267
|
+
isValid = function(val) {
|
268
|
+
return Payment.fns.validateCardNumber(val);
|
269
|
+
};
|
270
|
+
} else if (validatorName === "cardHolderName") {
|
271
|
+
isValid = function(val) {
|
272
|
+
return val !== "";
|
273
|
+
};
|
274
|
+
}
|
275
|
+
return (function(_this) {
|
276
|
+
return function(val, $in, $out) {
|
277
|
+
var result;
|
278
|
+
result = isValid(val);
|
279
|
+
_this.toggleValidClass($in, result);
|
280
|
+
_this.toggleValidClass($out, result);
|
281
|
+
return val;
|
282
|
+
};
|
283
|
+
})(this);
|
284
|
+
};
|
285
|
+
|
286
|
+
Card.prototype.toggleValidClass = function(el, test) {
|
287
|
+
QJ.toggleClass(el, this.options.classes.valid, test);
|
288
|
+
return QJ.toggleClass(el, this.options.classes.invalid, !test);
|
289
|
+
};
|
290
|
+
|
291
|
+
Card.prototype.handlers = {
|
292
|
+
setCardType: function($el, e) {
|
293
|
+
var cardType;
|
294
|
+
cardType = e.data;
|
295
|
+
if (!QJ.hasClass(this.$card, cardType)) {
|
296
|
+
QJ.removeClass(this.$card, 'jp-card-unknown');
|
297
|
+
QJ.removeClass(this.$card, this.cardTypes.join(' '));
|
298
|
+
QJ.addClass(this.$card, "jp-card-" + cardType);
|
299
|
+
QJ.toggleClass(this.$card, 'jp-card-identified', cardType !== 'unknown');
|
300
|
+
return this.cardType = cardType;
|
301
|
+
}
|
302
|
+
},
|
303
|
+
flipCard: function() {
|
304
|
+
return QJ.addClass(this.$card, 'jp-card-flipped');
|
305
|
+
},
|
306
|
+
unflipCard: function() {
|
307
|
+
return QJ.removeClass(this.$card, 'jp-card-flipped');
|
308
|
+
}
|
309
|
+
};
|
310
|
+
|
311
|
+
bindVal = function(el, out, opts) {
|
312
|
+
var joiner, o, outDefaults;
|
313
|
+
if (opts == null) {
|
314
|
+
opts = {};
|
315
|
+
}
|
316
|
+
opts.fill = opts.fill || false;
|
317
|
+
opts.filters = opts.filters || [];
|
318
|
+
if (!(opts.filters instanceof Array)) {
|
319
|
+
opts.filters = [opts.filters];
|
320
|
+
}
|
321
|
+
opts.join = opts.join || "";
|
322
|
+
if (!(typeof opts.join === "function")) {
|
323
|
+
joiner = opts.join;
|
324
|
+
opts.join = function() {
|
325
|
+
return joiner;
|
326
|
+
};
|
327
|
+
}
|
328
|
+
outDefaults = (function() {
|
329
|
+
var j, len, results;
|
330
|
+
results = [];
|
331
|
+
for (j = 0, len = out.length; j < len; j++) {
|
332
|
+
o = out[j];
|
333
|
+
results.push(o.textContent);
|
334
|
+
}
|
335
|
+
return results;
|
336
|
+
})();
|
337
|
+
QJ.on(el, 'focus', function() {
|
338
|
+
return QJ.addClass(out, 'jp-card-focused');
|
339
|
+
});
|
340
|
+
QJ.on(el, 'blur', function() {
|
341
|
+
return QJ.removeClass(out, 'jp-card-focused');
|
342
|
+
});
|
343
|
+
QJ.on(el, 'keyup change paste', function(e) {
|
344
|
+
var elem, filter, i, j, join, k, len, len1, outEl, outVal, ref, results, val;
|
345
|
+
val = (function() {
|
346
|
+
var j, len, results;
|
347
|
+
results = [];
|
348
|
+
for (j = 0, len = el.length; j < len; j++) {
|
349
|
+
elem = el[j];
|
350
|
+
results.push(QJ.val(elem));
|
351
|
+
}
|
352
|
+
return results;
|
353
|
+
})();
|
354
|
+
join = opts.join(val);
|
355
|
+
val = val.join(join);
|
356
|
+
if (val === join) {
|
357
|
+
val = "";
|
358
|
+
}
|
359
|
+
ref = opts.filters;
|
360
|
+
for (j = 0, len = ref.length; j < len; j++) {
|
361
|
+
filter = ref[j];
|
362
|
+
val = filter(val, el, out);
|
363
|
+
}
|
364
|
+
results = [];
|
365
|
+
for (i = k = 0, len1 = out.length; k < len1; i = ++k) {
|
366
|
+
outEl = out[i];
|
367
|
+
if (opts.fill) {
|
368
|
+
outVal = val + outDefaults[i].substring(val.length);
|
369
|
+
} else {
|
370
|
+
outVal = val || outDefaults[i];
|
371
|
+
}
|
372
|
+
results.push(outEl.textContent = outVal);
|
373
|
+
}
|
374
|
+
return results;
|
375
|
+
});
|
376
|
+
return el;
|
377
|
+
};
|
378
|
+
|
379
|
+
return Card;
|
380
|
+
|
381
|
+
})();
|
382
|
+
|
383
|
+
module.exports = Card;
|
384
|
+
|
385
|
+
global.Card = Card;
|
386
|
+
|
387
|
+
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
388
|
+
|
389
|
+
/***/ },
|
390
|
+
/* 2 */
|
391
|
+
/***/ function(module, exports, __webpack_require__) {
|
392
|
+
|
393
|
+
// style-loader: Adds some css to the DOM by adding a <style> tag
|
394
|
+
|
395
|
+
// load the styles
|
396
|
+
var content = __webpack_require__(3);
|
397
|
+
if(typeof content === 'string') content = [[module.id, content, '']];
|
398
|
+
// add the styles to the DOM
|
399
|
+
var update = __webpack_require__(5)(content, {});
|
400
|
+
if(content.locals) module.exports = content.locals;
|
401
|
+
// Hot Module Replacement
|
402
|
+
if(false) {
|
403
|
+
// When the styles change, update the <style> tags
|
404
|
+
if(!content.locals) {
|
405
|
+
module.hot.accept("!!./../../../css-loader/index.js!./../../../sass-loader/index.js?includePaths[]=./node_modules!./card.scss", function() {
|
406
|
+
var newContent = require("!!./../../../css-loader/index.js!./../../../sass-loader/index.js?includePaths[]=./node_modules!./card.scss");
|
407
|
+
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
|
408
|
+
update(newContent);
|
409
|
+
});
|
410
|
+
}
|
411
|
+
// When the module is disposed, remove the <style> tags
|
412
|
+
module.hot.dispose(function() { update(); });
|
413
|
+
}
|
414
|
+
|
415
|
+
/***/ },
|
416
|
+
/* 3 */
|
417
|
+
/***/ function(module, exports, __webpack_require__) {
|
418
|
+
|
419
|
+
exports = module.exports = __webpack_require__(4)();
|
420
|
+
// imports
|
421
|
+
|
422
|
+
|
423
|
+
// module
|
424
|
+
exports.push([module.id, ".jp-card.jp-card-safari.jp-card-identified .jp-card-front:before, .jp-card.jp-card-safari.jp-card-identified .jp-card-back:before {\n background-image: -webkit-linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n background-image: linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%); }\n\n.jp-card.jp-card-ie-10.jp-card-flipped, .jp-card.jp-card-ie-11.jp-card-flipped {\n -webkit-transform: 0deg;\n -moz-transform: 0deg;\n -ms-transform: 0deg;\n -o-transform: 0deg;\n transform: 0deg; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-front, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-front {\n -webkit-transform: rotateY(0deg);\n -moz-transform: rotateY(0deg);\n -ms-transform: rotateY(0deg);\n -o-transform: rotateY(0deg);\n transform: rotateY(0deg); }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back {\n -webkit-transform: rotateY(0deg);\n -moz-transform: rotateY(0deg);\n -ms-transform: rotateY(0deg);\n -o-transform: rotateY(0deg);\n transform: rotateY(0deg); }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back:after, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back:after {\n left: 18%; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back .jp-card-cvc, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back .jp-card-cvc {\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg);\n left: 5%; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back .jp-card-shiny, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back .jp-card-shiny {\n left: 84%; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back .jp-card-shiny:after, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back .jp-card-shiny:after {\n left: -480%;\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg); }\n\n.jp-card.jp-card-ie-10.jp-card-amex .jp-card-back, .jp-card.jp-card-ie-11.jp-card-amex .jp-card-back {\n display: none; }\n\n.jp-card-logo {\n height: 36px;\n width: 60px;\n font-style: italic; }\n .jp-card-logo, .jp-card-logo:before, .jp-card-logo:after {\n box-sizing: border-box; }\n\n.jp-card-logo.jp-card-amex {\n text-transform: uppercase;\n font-size: 4px;\n font-weight: bold;\n color: white;\n border: 1px solid #EEE; }\n .jp-card-logo.jp-card-amex:before, .jp-card-logo.jp-card-amex:after {\n width: 28px;\n display: block;\n position: absolute;\n left: 16px; }\n .jp-card-logo.jp-card-amex:before {\n height: 28px;\n content: \"american\";\n top: 3px;\n text-align: left;\n padding-left: 2px;\n padding-top: 11px;\n background: #267AC3; }\n .jp-card-logo.jp-card-amex:after {\n content: \"express\";\n bottom: 11px;\n text-align: right;\n padding-right: 2px; }\n\n.jp-card.jp-card-amex.jp-card-flipped {\n -webkit-transform: none;\n -moz-transform: none;\n -ms-transform: none;\n -o-transform: none;\n transform: none; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front:before, .jp-card.jp-card-amex.jp-card-identified .jp-card-back:before {\n background-color: #108168; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front .jp-card-logo.jp-card-amex {\n opacity: 1; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front .jp-card-cvc {\n visibility: visible; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front:after {\n opacity: 1; }\n\n.jp-card-logo.jp-card-discover {\n background: #FF6600;\n color: #111;\n text-transform: uppercase;\n font-style: normal;\n font-weight: bold;\n font-size: 10px;\n text-align: center;\n overflow: hidden;\n z-index: 1;\n padding-top: 9px;\n letter-spacing: .03em;\n border: 1px solid #EEE; }\n .jp-card-logo.jp-card-discover:before, .jp-card-logo.jp-card-discover:after {\n content: \" \";\n display: block;\n position: absolute; }\n .jp-card-logo.jp-card-discover:before {\n background: white;\n width: 200px;\n height: 200px;\n border-radius: 200px;\n bottom: -5%;\n right: -80%;\n z-index: -1; }\n .jp-card-logo.jp-card-discover:after {\n width: 8px;\n height: 8px;\n border-radius: 4px;\n top: 10px;\n left: 27px;\n background-color: #FF6600;\n background-image: -webkit-radial-gradient(#FF6600, #fff);\n background-image: radial-gradient( #FF6600, #fff);\n content: \"network\";\n font-size: 4px;\n line-height: 24px;\n text-indent: -7px; }\n\n.jp-card .jp-card-front .jp-card-logo.jp-card-discover {\n right: 12%;\n top: 18%; }\n\n.jp-card.jp-card-discover.jp-card-identified .jp-card-front:before, .jp-card.jp-card-discover.jp-card-identified .jp-card-back:before {\n background-color: #86B8CF; }\n\n.jp-card.jp-card-discover.jp-card-identified .jp-card-logo.jp-card-discover {\n opacity: 1; }\n\n.jp-card.jp-card-discover.jp-card-identified .jp-card-front:after {\n -webkit-transition: 400ms;\n -moz-transition: 400ms;\n transition: 400ms;\n content: \" \";\n display: block;\n background-color: #FF6600;\n background-image: -webkit-linear-gradient(#FF6600, #ffa366, #FF6600);\n background-image: linear-gradient(#FF6600, #ffa366, #FF6600);\n height: 50px;\n width: 50px;\n border-radius: 25px;\n position: absolute;\n left: 100%;\n top: 15%;\n margin-left: -25px;\n box-shadow: inset 1px 1px 3px 1px rgba(0, 0, 0, 0.5); }\n\n.jp-card-logo.jp-card-visa {\n background: white;\n text-transform: uppercase;\n color: #1A1876;\n text-align: center;\n font-weight: bold;\n font-size: 15px;\n line-height: 18px; }\n .jp-card-logo.jp-card-visa:before, .jp-card-logo.jp-card-visa:after {\n content: \" \";\n display: block;\n width: 100%;\n height: 25%; }\n .jp-card-logo.jp-card-visa:before {\n background: #1A1876; }\n .jp-card-logo.jp-card-visa:after {\n background: #E79800; }\n\n.jp-card.jp-card-visa.jp-card-identified .jp-card-front:before, .jp-card.jp-card-visa.jp-card-identified .jp-card-back:before {\n background-color: #191278; }\n\n.jp-card.jp-card-visa.jp-card-identified .jp-card-logo.jp-card-visa {\n opacity: 1; }\n\n.jp-card-logo.jp-card-mastercard {\n color: white;\n font-weight: bold;\n text-align: center;\n font-size: 9px;\n line-height: 36px;\n z-index: 1;\n text-shadow: 1px 1px rgba(0, 0, 0, 0.6); }\n .jp-card-logo.jp-card-mastercard:before, .jp-card-logo.jp-card-mastercard:after {\n content: \" \";\n display: block;\n width: 36px;\n top: 0;\n position: absolute;\n height: 36px;\n border-radius: 18px; }\n .jp-card-logo.jp-card-mastercard:before {\n left: 0;\n background: #FF0000;\n z-index: -1; }\n .jp-card-logo.jp-card-mastercard:after {\n right: 0;\n background: #FFAB00;\n z-index: -2; }\n\n.jp-card.jp-card-mastercard.jp-card-identified .jp-card-front .jp-card-logo.jp-card-mastercard, .jp-card.jp-card-mastercard.jp-card-identified .jp-card-back .jp-card-logo.jp-card-mastercard {\n box-shadow: none; }\n\n.jp-card.jp-card-mastercard.jp-card-identified .jp-card-front:before, .jp-card.jp-card-mastercard.jp-card-identified .jp-card-back:before {\n background-color: #0061A8; }\n\n.jp-card.jp-card-mastercard.jp-card-identified .jp-card-logo.jp-card-mastercard {\n opacity: 1; }\n\n.jp-card-logo.jp-card-maestro {\n color: white;\n font-weight: bold;\n text-align: center;\n font-size: 14px;\n line-height: 36px;\n z-index: 1;\n text-shadow: 1px 1px rgba(0, 0, 0, 0.6); }\n .jp-card-logo.jp-card-maestro:before, .jp-card-logo.jp-card-maestro:after {\n content: \" \";\n display: block;\n width: 36px;\n top: 0;\n position: absolute;\n height: 36px;\n border-radius: 18px; }\n .jp-card-logo.jp-card-maestro:before {\n left: 0;\n background: #0064CB;\n z-index: -1; }\n .jp-card-logo.jp-card-maestro:after {\n right: 0;\n background: #CC0000;\n z-index: -2; }\n\n.jp-card.jp-card-maestro.jp-card-identified .jp-card-front .jp-card-logo.jp-card-maestro, .jp-card.jp-card-maestro.jp-card-identified .jp-card-back .jp-card-logo.jp-card-maestro {\n box-shadow: none; }\n\n.jp-card.jp-card-maestro.jp-card-identified .jp-card-front:before, .jp-card.jp-card-maestro.jp-card-identified .jp-card-back:before {\n background-color: #0B2C5F; }\n\n.jp-card.jp-card-maestro.jp-card-identified .jp-card-logo.jp-card-maestro {\n opacity: 1; }\n\n.jp-card-logo.jp-card-dankort {\n width: 60px;\n height: 36px;\n padding: 3px;\n border-radius: 8px;\n border: #000000 1px solid;\n background-color: #FFFFFF; }\n .jp-card-logo.jp-card-dankort .dk {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden; }\n .jp-card-logo.jp-card-dankort .dk:before {\n background-color: #ED1C24;\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n display: block;\n border-radius: 6px; }\n .jp-card-logo.jp-card-dankort .dk:after {\n content: '';\n position: absolute;\n top: 50%;\n margin-top: -7.7px;\n right: 0;\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 7px 7px 10px 0;\n border-color: transparent #ED1C24 transparent transparent;\n z-index: 1; }\n .jp-card-logo.jp-card-dankort .d, .jp-card-logo.jp-card-dankort .k {\n position: absolute;\n top: 50%;\n width: 50%;\n display: block;\n height: 15.4px;\n margin-top: -7.7px;\n background: white; }\n .jp-card-logo.jp-card-dankort .d {\n left: 0;\n border-radius: 0 8px 10px 0; }\n .jp-card-logo.jp-card-dankort .d:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n display: block;\n background: #ED1C24;\n border-radius: 2px 4px 6px 0px;\n height: 5px;\n width: 7px;\n margin: -3px 0 0 -4px; }\n .jp-card-logo.jp-card-dankort .k {\n right: 0; }\n .jp-card-logo.jp-card-dankort .k:before, .jp-card-logo.jp-card-dankort .k:after {\n content: '';\n position: absolute;\n right: 50%;\n width: 0;\n height: 0;\n border-style: solid;\n margin-right: -1px; }\n .jp-card-logo.jp-card-dankort .k:before {\n top: 0;\n border-width: 8px 5px 0 0;\n border-color: #ED1C24 transparent transparent transparent; }\n .jp-card-logo.jp-card-dankort .k:after {\n bottom: 0;\n border-width: 0 5px 8px 0;\n border-color: transparent transparent #ED1C24 transparent; }\n\n.jp-card.jp-card-dankort.jp-card-identified .jp-card-front:before, .jp-card.jp-card-dankort.jp-card-identified .jp-card-back:before {\n background-color: #0055C7; }\n\n.jp-card.jp-card-dankort.jp-card-identified .jp-card-logo.jp-card-dankort {\n opacity: 1; }\n\n.jp-card-logo.jp-card-elo {\n height: 50px;\n width: 50px;\n border-radius: 100%;\n background: black;\n color: white;\n text-align: center;\n text-transform: lowercase;\n font-size: 21px;\n font-style: normal;\n letter-spacing: 1px;\n font-weight: bold;\n padding-top: 13px; }\n .jp-card-logo.jp-card-elo .e, .jp-card-logo.jp-card-elo .l, .jp-card-logo.jp-card-elo .o {\n display: inline-block;\n position: relative; }\n .jp-card-logo.jp-card-elo .e {\n -webkit-transform: rotate(-15deg);\n -moz-transform: rotate(-15deg);\n -ms-transform: rotate(-15deg);\n -o-transform: rotate(-15deg);\n transform: rotate(-15deg); }\n .jp-card-logo.jp-card-elo .o {\n position: relative;\n display: inline-block;\n width: 12px;\n height: 12px;\n right: 0;\n top: 7px;\n border-radius: 100%;\n background-image: -webkit-linear-gradient(yellow 50%, red 50%);\n background-image: linear-gradient(to , red 50%);\n -webkit-transform: rotate(40deg);\n -moz-transform: rotate(40deg);\n -ms-transform: rotate(40deg);\n -o-transform: rotate(40deg);\n transform: rotate(40deg);\n text-indent: -9999px; }\n .jp-card-logo.jp-card-elo .o:before {\n content: \"\";\n position: absolute;\n width: 49%;\n height: 49%;\n background: black;\n border-radius: 100%;\n text-indent: -99999px;\n top: 25%;\n left: 25%; }\n\n.jp-card.jp-card-elo.jp-card-identified .jp-card-front:before, .jp-card.jp-card-elo.jp-card-identified .jp-card-back:before {\n background-color: #6F6969; }\n\n.jp-card.jp-card-elo.jp-card-identified .jp-card-logo.jp-card-elo {\n opacity: 1; }\n\n.jp-card-container {\n -webkit-perspective: 1000px;\n -moz-perspective: 1000px;\n perspective: 1000px;\n width: 350px;\n max-width: 100%;\n height: 200px;\n margin: auto;\n z-index: 1;\n position: relative; }\n\n.jp-card {\n font-family: \"Helvetica Neue\";\n line-height: 1;\n position: relative;\n width: 100%;\n height: 100%;\n min-width: 315px;\n border-radius: 10px;\n -webkit-transform-style: preserve-3d;\n -moz-transform-style: preserve-3d;\n -ms-transform-style: preserve-3d;\n -o-transform-style: preserve-3d;\n transform-style: preserve-3d;\n -webkit-transition: all 400ms linear;\n -moz-transition: all 400ms linear;\n transition: all 400ms linear; }\n .jp-card > *, .jp-card > *:before, .jp-card > *:after {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-family: inherit; }\n .jp-card.jp-card-flipped {\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg); }\n .jp-card .jp-card-front, .jp-card .jp-card-back {\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform-style: preserve-3d;\n -moz-transform-style: preserve-3d;\n -ms-transform-style: preserve-3d;\n -o-transform-style: preserve-3d;\n transform-style: preserve-3d;\n -webkit-transition: all 400ms linear;\n -moz-transition: all 400ms linear;\n transition: all 400ms linear;\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n overflow: hidden;\n border-radius: 10px;\n background: #DDD; }\n .jp-card .jp-card-front:before, .jp-card .jp-card-back:before {\n content: \" \";\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n opacity: 0;\n border-radius: 10px;\n -webkit-transition: all 400ms ease;\n -moz-transition: all 400ms ease;\n transition: all 400ms ease; }\n .jp-card .jp-card-front:after, .jp-card .jp-card-back:after {\n content: \" \";\n display: block; }\n .jp-card .jp-card-front .jp-card-display, .jp-card .jp-card-back .jp-card-display {\n color: white;\n font-weight: normal;\n opacity: 0.5;\n -webkit-transition: opacity 400ms linear;\n -moz-transition: opacity 400ms linear;\n transition: opacity 400ms linear; }\n .jp-card .jp-card-front .jp-card-display.jp-card-focused, .jp-card .jp-card-back .jp-card-display.jp-card-focused {\n opacity: 1;\n font-weight: 700; }\n .jp-card .jp-card-front .jp-card-cvc, .jp-card .jp-card-back .jp-card-cvc {\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n font-size: 14px; }\n .jp-card .jp-card-front .jp-card-shiny, .jp-card .jp-card-back .jp-card-shiny {\n width: 50px;\n height: 35px;\n border-radius: 5px;\n background: #CCC;\n position: relative; }\n .jp-card .jp-card-front .jp-card-shiny:before, .jp-card .jp-card-back .jp-card-shiny:before {\n content: \" \";\n display: block;\n width: 70%;\n height: 60%;\n border-top-right-radius: 5px;\n border-bottom-right-radius: 5px;\n background: #d9d9d9;\n position: absolute;\n top: 20%; }\n .jp-card .jp-card-front .jp-card-logo {\n position: absolute;\n opacity: 0;\n right: 5%;\n top: 8%;\n -webkit-transition: 400ms;\n -moz-transition: 400ms;\n transition: 400ms; }\n .jp-card .jp-card-front .jp-card-lower {\n width: 80%;\n position: absolute;\n left: 10%;\n bottom: 30px; }\n @media only screen and (max-width: 480px) {\n .jp-card .jp-card-front .jp-card-lower {\n width: 90%;\n left: 5%; } }\n .jp-card .jp-card-front .jp-card-lower .jp-card-cvc {\n visibility: hidden;\n float: right;\n position: relative;\n bottom: 5px; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-number {\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n font-size: 24px;\n clear: both;\n margin-bottom: 30px; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry {\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n letter-spacing: 0em;\n position: relative;\n float: right;\n width: 25%; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:before, .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:after {\n font-family: \"Helvetica Neue\";\n font-weight: bold;\n font-size: 7px;\n white-space: pre;\n display: block;\n opacity: .5; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:before {\n content: attr(data-before);\n margin-bottom: 2px;\n font-size: 7px;\n text-transform: uppercase; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:after {\n position: absolute;\n content: attr(data-after);\n text-align: right;\n right: 100%;\n margin-right: 5px;\n margin-top: 2px;\n bottom: 0; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-name {\n text-transform: uppercase;\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n font-size: 20px;\n max-height: 45px;\n position: absolute;\n bottom: 0;\n width: 190px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: horizontal;\n overflow: hidden;\n text-overflow: ellipsis; }\n .jp-card .jp-card-back {\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg); }\n .jp-card .jp-card-back .jp-card-bar {\n background-color: #444;\n background-image: -webkit-linear-gradient(#444, #333);\n background-image: linear-gradient(#444, #333);\n width: 100%;\n height: 20%;\n position: absolute;\n top: 10%; }\n .jp-card .jp-card-back:after {\n content: \" \";\n display: block;\n background-color: #FFF;\n background-image: -webkit-linear-gradient(#FFF, #FFF);\n background-image: linear-gradient(#FFF, #FFF);\n width: 80%;\n height: 16%;\n position: absolute;\n top: 40%;\n left: 2%; }\n .jp-card .jp-card-back .jp-card-cvc {\n position: absolute;\n top: 40%;\n left: 85%;\n -webkit-transition-delay: 600ms;\n -moz-transition-delay: 600ms;\n transition-delay: 600ms; }\n .jp-card .jp-card-back .jp-card-shiny {\n position: absolute;\n top: 66%;\n left: 2%; }\n .jp-card .jp-card-back .jp-card-shiny:after {\n content: \"This card has been issued by Jesse Pollak and is licensed for anyone to use anywhere for free.AIt comes with no warranty.A For support issues, please visit: github.com/jessepollak/card.\";\n position: absolute;\n left: 120%;\n top: 5%;\n color: white;\n font-size: 7px;\n width: 230px;\n opacity: .5; }\n .jp-card.jp-card-identified {\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.3); }\n .jp-card.jp-card-identified .jp-card-front, .jp-card.jp-card-identified .jp-card-back {\n background-color: #000;\n background-color: rgba(0, 0, 0, 0.5); }\n .jp-card.jp-card-identified .jp-card-front:before, .jp-card.jp-card-identified .jp-card-back:before {\n -webkit-transition: all 400ms ease;\n -moz-transition: all 400ms ease;\n transition: all 400ms ease;\n background-image: -webkit-linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n background-image: linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n opacity: 1; }\n .jp-card.jp-card-identified .jp-card-front .jp-card-logo, .jp-card.jp-card-identified .jp-card-back .jp-card-logo {\n box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3); }\n .jp-card.jp-card-identified.no-radial-gradient .jp-card-front:before, .jp-card.jp-card-identified.no-radial-gradient .jp-card-back:before {\n background-image: -webkit-linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n background-image: linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%); }\n", ""]);
|
425
|
+
|
426
|
+
// exports
|
427
|
+
|
428
|
+
|
429
|
+
/***/ },
|
430
|
+
/* 4 */
|
431
|
+
/***/ function(module, exports) {
|
432
|
+
|
433
|
+
/*
|
434
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
435
|
+
Author Tobias Koppers @sokra
|
436
|
+
*/
|
437
|
+
// css base code, injected by the css-loader
|
438
|
+
module.exports = function() {
|
439
|
+
var list = [];
|
440
|
+
|
441
|
+
// return the list of modules as css string
|
442
|
+
list.toString = function toString() {
|
443
|
+
var result = [];
|
444
|
+
for(var i = 0; i < this.length; i++) {
|
445
|
+
var item = this[i];
|
446
|
+
if(item[2]) {
|
447
|
+
result.push("@media " + item[2] + "{" + item[1] + "}");
|
448
|
+
} else {
|
449
|
+
result.push(item[1]);
|
450
|
+
}
|
451
|
+
}
|
452
|
+
return result.join("");
|
453
|
+
};
|
454
|
+
|
455
|
+
// import a list of modules into the list
|
456
|
+
list.i = function(modules, mediaQuery) {
|
457
|
+
if(typeof modules === "string")
|
458
|
+
modules = [[null, modules, ""]];
|
459
|
+
var alreadyImportedModules = {};
|
460
|
+
for(var i = 0; i < this.length; i++) {
|
461
|
+
var id = this[i][0];
|
462
|
+
if(typeof id === "number")
|
463
|
+
alreadyImportedModules[id] = true;
|
464
|
+
}
|
465
|
+
for(i = 0; i < modules.length; i++) {
|
466
|
+
var item = modules[i];
|
467
|
+
// skip already imported module
|
468
|
+
// this implementation is not 100% perfect for weird media query combinations
|
469
|
+
// when a module is imported multiple times with different media queries.
|
470
|
+
// I hope this will never occur (Hey this way we have smaller bundles)
|
471
|
+
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
|
472
|
+
if(mediaQuery && !item[2]) {
|
473
|
+
item[2] = mediaQuery;
|
474
|
+
} else if(mediaQuery) {
|
475
|
+
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
|
476
|
+
}
|
477
|
+
list.push(item);
|
478
|
+
}
|
479
|
+
}
|
480
|
+
};
|
481
|
+
return list;
|
482
|
+
};
|
483
|
+
|
484
|
+
|
485
|
+
/***/ },
|
486
|
+
/* 5 */
|
487
|
+
/***/ function(module, exports, __webpack_require__) {
|
488
|
+
|
489
|
+
/*
|
490
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
491
|
+
Author Tobias Koppers @sokra
|
492
|
+
*/
|
493
|
+
var stylesInDom = {},
|
494
|
+
memoize = function(fn) {
|
495
|
+
var memo;
|
496
|
+
return function () {
|
497
|
+
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
|
498
|
+
return memo;
|
499
|
+
};
|
500
|
+
},
|
501
|
+
isOldIE = memoize(function() {
|
502
|
+
return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase());
|
503
|
+
}),
|
504
|
+
getHeadElement = memoize(function () {
|
505
|
+
return document.head || document.getElementsByTagName("head")[0];
|
506
|
+
}),
|
507
|
+
singletonElement = null,
|
508
|
+
singletonCounter = 0,
|
509
|
+
styleElementsInsertedAtTop = [];
|
510
|
+
|
511
|
+
module.exports = function(list, options) {
|
512
|
+
if(false) {
|
513
|
+
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
|
514
|
+
}
|
515
|
+
|
516
|
+
options = options || {};
|
517
|
+
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
|
518
|
+
// tags it will allow on a page
|
519
|
+
if (typeof options.singleton === "undefined") options.singleton = isOldIE();
|
520
|
+
|
521
|
+
// By default, add <style> tags to the bottom of <head>.
|
522
|
+
if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
|
523
|
+
|
524
|
+
var styles = listToStyles(list);
|
525
|
+
addStylesToDom(styles, options);
|
526
|
+
|
527
|
+
return function update(newList) {
|
528
|
+
var mayRemove = [];
|
529
|
+
for(var i = 0; i < styles.length; i++) {
|
530
|
+
var item = styles[i];
|
531
|
+
var domStyle = stylesInDom[item.id];
|
532
|
+
domStyle.refs--;
|
533
|
+
mayRemove.push(domStyle);
|
534
|
+
}
|
535
|
+
if(newList) {
|
536
|
+
var newStyles = listToStyles(newList);
|
537
|
+
addStylesToDom(newStyles, options);
|
538
|
+
}
|
539
|
+
for(var i = 0; i < mayRemove.length; i++) {
|
540
|
+
var domStyle = mayRemove[i];
|
541
|
+
if(domStyle.refs === 0) {
|
542
|
+
for(var j = 0; j < domStyle.parts.length; j++)
|
543
|
+
domStyle.parts[j]();
|
544
|
+
delete stylesInDom[domStyle.id];
|
545
|
+
}
|
546
|
+
}
|
547
|
+
};
|
548
|
+
}
|
549
|
+
|
550
|
+
function addStylesToDom(styles, options) {
|
551
|
+
for(var i = 0; i < styles.length; i++) {
|
552
|
+
var item = styles[i];
|
553
|
+
var domStyle = stylesInDom[item.id];
|
554
|
+
if(domStyle) {
|
555
|
+
domStyle.refs++;
|
556
|
+
for(var j = 0; j < domStyle.parts.length; j++) {
|
557
|
+
domStyle.parts[j](item.parts[j]);
|
558
|
+
}
|
559
|
+
for(; j < item.parts.length; j++) {
|
560
|
+
domStyle.parts.push(addStyle(item.parts[j], options));
|
561
|
+
}
|
562
|
+
} else {
|
563
|
+
var parts = [];
|
564
|
+
for(var j = 0; j < item.parts.length; j++) {
|
565
|
+
parts.push(addStyle(item.parts[j], options));
|
566
|
+
}
|
567
|
+
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
|
568
|
+
}
|
569
|
+
}
|
570
|
+
}
|
571
|
+
|
572
|
+
function listToStyles(list) {
|
573
|
+
var styles = [];
|
574
|
+
var newStyles = {};
|
575
|
+
for(var i = 0; i < list.length; i++) {
|
576
|
+
var item = list[i];
|
577
|
+
var id = item[0];
|
578
|
+
var css = item[1];
|
579
|
+
var media = item[2];
|
580
|
+
var sourceMap = item[3];
|
581
|
+
var part = {css: css, media: media, sourceMap: sourceMap};
|
582
|
+
if(!newStyles[id])
|
583
|
+
styles.push(newStyles[id] = {id: id, parts: [part]});
|
584
|
+
else
|
585
|
+
newStyles[id].parts.push(part);
|
586
|
+
}
|
587
|
+
return styles;
|
588
|
+
}
|
589
|
+
|
590
|
+
function insertStyleElement(options, styleElement) {
|
591
|
+
var head = getHeadElement();
|
592
|
+
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
|
593
|
+
if (options.insertAt === "top") {
|
594
|
+
if(!lastStyleElementInsertedAtTop) {
|
595
|
+
head.insertBefore(styleElement, head.firstChild);
|
596
|
+
} else if(lastStyleElementInsertedAtTop.nextSibling) {
|
597
|
+
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
|
598
|
+
} else {
|
599
|
+
head.appendChild(styleElement);
|
600
|
+
}
|
601
|
+
styleElementsInsertedAtTop.push(styleElement);
|
602
|
+
} else if (options.insertAt === "bottom") {
|
603
|
+
head.appendChild(styleElement);
|
604
|
+
} else {
|
605
|
+
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
|
606
|
+
}
|
607
|
+
}
|
608
|
+
|
609
|
+
function removeStyleElement(styleElement) {
|
610
|
+
styleElement.parentNode.removeChild(styleElement);
|
611
|
+
var idx = styleElementsInsertedAtTop.indexOf(styleElement);
|
612
|
+
if(idx >= 0) {
|
613
|
+
styleElementsInsertedAtTop.splice(idx, 1);
|
614
|
+
}
|
615
|
+
}
|
616
|
+
|
617
|
+
function createStyleElement(options) {
|
618
|
+
var styleElement = document.createElement("style");
|
619
|
+
styleElement.type = "text/css";
|
620
|
+
insertStyleElement(options, styleElement);
|
621
|
+
return styleElement;
|
622
|
+
}
|
623
|
+
|
624
|
+
function createLinkElement(options) {
|
625
|
+
var linkElement = document.createElement("link");
|
626
|
+
linkElement.rel = "stylesheet";
|
627
|
+
insertStyleElement(options, linkElement);
|
628
|
+
return linkElement;
|
629
|
+
}
|
630
|
+
|
631
|
+
function addStyle(obj, options) {
|
632
|
+
var styleElement, update, remove;
|
633
|
+
|
634
|
+
if (options.singleton) {
|
635
|
+
var styleIndex = singletonCounter++;
|
636
|
+
styleElement = singletonElement || (singletonElement = createStyleElement(options));
|
637
|
+
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
|
638
|
+
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
|
639
|
+
} else if(obj.sourceMap &&
|
640
|
+
typeof URL === "function" &&
|
641
|
+
typeof URL.createObjectURL === "function" &&
|
642
|
+
typeof URL.revokeObjectURL === "function" &&
|
643
|
+
typeof Blob === "function" &&
|
644
|
+
typeof btoa === "function") {
|
645
|
+
styleElement = createLinkElement(options);
|
646
|
+
update = updateLink.bind(null, styleElement);
|
647
|
+
remove = function() {
|
648
|
+
removeStyleElement(styleElement);
|
649
|
+
if(styleElement.href)
|
650
|
+
URL.revokeObjectURL(styleElement.href);
|
651
|
+
};
|
652
|
+
} else {
|
653
|
+
styleElement = createStyleElement(options);
|
654
|
+
update = applyToTag.bind(null, styleElement);
|
655
|
+
remove = function() {
|
656
|
+
removeStyleElement(styleElement);
|
657
|
+
};
|
658
|
+
}
|
659
|
+
|
660
|
+
update(obj);
|
661
|
+
|
662
|
+
return function updateStyle(newObj) {
|
663
|
+
if(newObj) {
|
664
|
+
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
|
665
|
+
return;
|
666
|
+
update(obj = newObj);
|
667
|
+
} else {
|
668
|
+
remove();
|
669
|
+
}
|
670
|
+
};
|
671
|
+
}
|
672
|
+
|
673
|
+
var replaceText = (function () {
|
674
|
+
var textStore = [];
|
675
|
+
|
676
|
+
return function (index, replacement) {
|
677
|
+
textStore[index] = replacement;
|
678
|
+
return textStore.filter(Boolean).join('\n');
|
679
|
+
};
|
680
|
+
})();
|
681
|
+
|
682
|
+
function applyToSingletonTag(styleElement, index, remove, obj) {
|
683
|
+
var css = remove ? "" : obj.css;
|
684
|
+
|
685
|
+
if (styleElement.styleSheet) {
|
686
|
+
styleElement.styleSheet.cssText = replaceText(index, css);
|
687
|
+
} else {
|
688
|
+
var cssNode = document.createTextNode(css);
|
689
|
+
var childNodes = styleElement.childNodes;
|
690
|
+
if (childNodes[index]) styleElement.removeChild(childNodes[index]);
|
691
|
+
if (childNodes.length) {
|
692
|
+
styleElement.insertBefore(cssNode, childNodes[index]);
|
693
|
+
} else {
|
694
|
+
styleElement.appendChild(cssNode);
|
695
|
+
}
|
696
|
+
}
|
697
|
+
}
|
698
|
+
|
699
|
+
function applyToTag(styleElement, obj) {
|
700
|
+
var css = obj.css;
|
701
|
+
var media = obj.media;
|
702
|
+
|
703
|
+
if(media) {
|
704
|
+
styleElement.setAttribute("media", media)
|
705
|
+
}
|
706
|
+
|
707
|
+
if(styleElement.styleSheet) {
|
708
|
+
styleElement.styleSheet.cssText = css;
|
709
|
+
} else {
|
710
|
+
while(styleElement.firstChild) {
|
711
|
+
styleElement.removeChild(styleElement.firstChild);
|
712
|
+
}
|
713
|
+
styleElement.appendChild(document.createTextNode(css));
|
714
|
+
}
|
715
|
+
}
|
716
|
+
|
717
|
+
function updateLink(linkElement, obj) {
|
718
|
+
var css = obj.css;
|
719
|
+
var sourceMap = obj.sourceMap;
|
720
|
+
|
721
|
+
if(sourceMap) {
|
722
|
+
// http://stackoverflow.com/a/26603875
|
723
|
+
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
|
724
|
+
}
|
725
|
+
|
726
|
+
var blob = new Blob([css], { type: "text/css" });
|
727
|
+
|
728
|
+
var oldSrc = linkElement.href;
|
729
|
+
|
730
|
+
linkElement.href = URL.createObjectURL(blob);
|
731
|
+
|
732
|
+
if(oldSrc)
|
733
|
+
URL.revokeObjectURL(oldSrc);
|
734
|
+
}
|
735
|
+
|
736
|
+
|
737
|
+
/***/ },
|
738
|
+
/* 6 */
|
739
|
+
/***/ function(module, exports) {
|
740
|
+
|
741
|
+
var QJ, rreturn, rtrim;
|
742
|
+
|
743
|
+
QJ = function(selector) {
|
744
|
+
if (QJ.isDOMElement(selector)) {
|
745
|
+
return selector;
|
746
|
+
}
|
747
|
+
return document.querySelectorAll(selector);
|
748
|
+
};
|
749
|
+
|
750
|
+
QJ.isDOMElement = function(el) {
|
751
|
+
return el && (el.nodeName != null);
|
752
|
+
};
|
753
|
+
|
754
|
+
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
|
755
|
+
|
756
|
+
QJ.trim = function(text) {
|
757
|
+
if (text === null) {
|
758
|
+
return "";
|
759
|
+
} else {
|
760
|
+
return (text + "").replace(rtrim, "");
|
761
|
+
}
|
762
|
+
};
|
763
|
+
|
764
|
+
rreturn = /\r/g;
|
765
|
+
|
766
|
+
QJ.val = function(el, val) {
|
767
|
+
var ret;
|
768
|
+
if (arguments.length > 1) {
|
769
|
+
return el.value = val;
|
770
|
+
} else {
|
771
|
+
ret = el.value;
|
772
|
+
if (typeof ret === "string") {
|
773
|
+
return ret.replace(rreturn, "");
|
774
|
+
} else {
|
775
|
+
if (ret === null) {
|
776
|
+
return "";
|
777
|
+
} else {
|
778
|
+
return ret;
|
779
|
+
}
|
780
|
+
}
|
781
|
+
}
|
782
|
+
};
|
783
|
+
|
784
|
+
QJ.preventDefault = function(eventObject) {
|
785
|
+
if (typeof eventObject.preventDefault === "function") {
|
786
|
+
eventObject.preventDefault();
|
787
|
+
return;
|
788
|
+
}
|
789
|
+
eventObject.returnValue = false;
|
790
|
+
return false;
|
791
|
+
};
|
792
|
+
|
793
|
+
QJ.normalizeEvent = function(e) {
|
794
|
+
var original;
|
795
|
+
original = e;
|
796
|
+
e = {
|
797
|
+
which: original.which != null ? original.which : void 0,
|
798
|
+
target: original.target || original.srcElement,
|
799
|
+
preventDefault: function() {
|
800
|
+
return QJ.preventDefault(original);
|
801
|
+
},
|
802
|
+
originalEvent: original,
|
803
|
+
data: original.data || original.detail
|
804
|
+
};
|
805
|
+
if (e.which == null) {
|
806
|
+
e.which = original.charCode != null ? original.charCode : original.keyCode;
|
807
|
+
}
|
808
|
+
return e;
|
809
|
+
};
|
810
|
+
|
811
|
+
QJ.on = function(element, eventName, callback) {
|
812
|
+
var el, i, j, len, len1, multEventName, originalCallback, ref;
|
813
|
+
if (element.length) {
|
814
|
+
for (i = 0, len = element.length; i < len; i++) {
|
815
|
+
el = element[i];
|
816
|
+
QJ.on(el, eventName, callback);
|
817
|
+
}
|
818
|
+
return;
|
819
|
+
}
|
820
|
+
if (eventName.match(" ")) {
|
821
|
+
ref = eventName.split(" ");
|
822
|
+
for (j = 0, len1 = ref.length; j < len1; j++) {
|
823
|
+
multEventName = ref[j];
|
824
|
+
QJ.on(element, multEventName, callback);
|
825
|
+
}
|
826
|
+
return;
|
827
|
+
}
|
828
|
+
originalCallback = callback;
|
829
|
+
callback = function(e) {
|
830
|
+
e = QJ.normalizeEvent(e);
|
831
|
+
return originalCallback(e);
|
832
|
+
};
|
833
|
+
if (element.addEventListener) {
|
834
|
+
return element.addEventListener(eventName, callback, false);
|
835
|
+
}
|
836
|
+
if (element.attachEvent) {
|
837
|
+
eventName = "on" + eventName;
|
838
|
+
return element.attachEvent(eventName, callback);
|
839
|
+
}
|
840
|
+
element['on' + eventName] = callback;
|
841
|
+
};
|
842
|
+
|
843
|
+
QJ.addClass = function(el, className) {
|
844
|
+
var e;
|
845
|
+
if (el.length) {
|
846
|
+
return (function() {
|
847
|
+
var i, len, results;
|
848
|
+
results = [];
|
849
|
+
for (i = 0, len = el.length; i < len; i++) {
|
850
|
+
e = el[i];
|
851
|
+
results.push(QJ.addClass(e, className));
|
852
|
+
}
|
853
|
+
return results;
|
854
|
+
})();
|
855
|
+
}
|
856
|
+
if (el.classList) {
|
857
|
+
return el.classList.add(className);
|
858
|
+
} else {
|
859
|
+
return el.className += ' ' + className;
|
860
|
+
}
|
861
|
+
};
|
862
|
+
|
863
|
+
QJ.hasClass = function(el, className) {
|
864
|
+
var e, hasClass, i, len;
|
865
|
+
if (el.length) {
|
866
|
+
hasClass = true;
|
867
|
+
for (i = 0, len = el.length; i < len; i++) {
|
868
|
+
e = el[i];
|
869
|
+
hasClass = hasClass && QJ.hasClass(e, className);
|
870
|
+
}
|
871
|
+
return hasClass;
|
872
|
+
}
|
873
|
+
if (el.classList) {
|
874
|
+
return el.classList.contains(className);
|
875
|
+
} else {
|
876
|
+
return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
|
877
|
+
}
|
878
|
+
};
|
879
|
+
|
880
|
+
QJ.removeClass = function(el, className) {
|
881
|
+
var cls, e, i, len, ref, results;
|
882
|
+
if (el.length) {
|
883
|
+
return (function() {
|
884
|
+
var i, len, results;
|
885
|
+
results = [];
|
886
|
+
for (i = 0, len = el.length; i < len; i++) {
|
887
|
+
e = el[i];
|
888
|
+
results.push(QJ.removeClass(e, className));
|
889
|
+
}
|
890
|
+
return results;
|
891
|
+
})();
|
892
|
+
}
|
893
|
+
if (el.classList) {
|
894
|
+
ref = className.split(' ');
|
895
|
+
results = [];
|
896
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
897
|
+
cls = ref[i];
|
898
|
+
results.push(el.classList.remove(cls));
|
899
|
+
}
|
900
|
+
return results;
|
901
|
+
} else {
|
902
|
+
return el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
|
903
|
+
}
|
904
|
+
};
|
905
|
+
|
906
|
+
QJ.toggleClass = function(el, className, bool) {
|
907
|
+
var e;
|
908
|
+
if (el.length) {
|
909
|
+
return (function() {
|
910
|
+
var i, len, results;
|
911
|
+
results = [];
|
912
|
+
for (i = 0, len = el.length; i < len; i++) {
|
913
|
+
e = el[i];
|
914
|
+
results.push(QJ.toggleClass(e, className, bool));
|
915
|
+
}
|
916
|
+
return results;
|
917
|
+
})();
|
918
|
+
}
|
919
|
+
if (bool) {
|
920
|
+
if (!QJ.hasClass(el, className)) {
|
921
|
+
return QJ.addClass(el, className);
|
922
|
+
}
|
923
|
+
} else {
|
924
|
+
return QJ.removeClass(el, className);
|
925
|
+
}
|
926
|
+
};
|
927
|
+
|
928
|
+
QJ.append = function(el, toAppend) {
|
929
|
+
var e;
|
930
|
+
if (el.length) {
|
931
|
+
return (function() {
|
932
|
+
var i, len, results;
|
933
|
+
results = [];
|
934
|
+
for (i = 0, len = el.length; i < len; i++) {
|
935
|
+
e = el[i];
|
936
|
+
results.push(QJ.append(e, toAppend));
|
937
|
+
}
|
938
|
+
return results;
|
939
|
+
})();
|
940
|
+
}
|
941
|
+
return el.insertAdjacentHTML('beforeend', toAppend);
|
942
|
+
};
|
943
|
+
|
944
|
+
QJ.find = function(el, selector) {
|
945
|
+
if (el instanceof NodeList || el instanceof Array) {
|
946
|
+
el = el[0];
|
947
|
+
}
|
948
|
+
return el.querySelectorAll(selector);
|
949
|
+
};
|
950
|
+
|
951
|
+
QJ.trigger = function(el, name, data) {
|
952
|
+
var e, error, ev;
|
953
|
+
try {
|
954
|
+
ev = new CustomEvent(name, {
|
955
|
+
detail: data
|
956
|
+
});
|
957
|
+
} catch (error) {
|
958
|
+
e = error;
|
959
|
+
ev = document.createEvent('CustomEvent');
|
960
|
+
if (ev.initCustomEvent) {
|
961
|
+
ev.initCustomEvent(name, true, true, data);
|
962
|
+
} else {
|
963
|
+
ev.initEvent(name, true, true, data);
|
964
|
+
}
|
965
|
+
}
|
966
|
+
return el.dispatchEvent(ev);
|
967
|
+
};
|
968
|
+
|
969
|
+
module.exports = QJ;
|
970
|
+
|
971
|
+
|
972
|
+
/***/ },
|
973
|
+
/* 7 */
|
974
|
+
/***/ function(module, exports, __webpack_require__) {
|
975
|
+
|
976
|
+
/* WEBPACK VAR INJECTION */(function(global) {var Payment, QJ, cardFromNumber, cardFromType, cards, defaultFormat, formatBackCardNumber, formatBackExpiry, formatCardNumber, formatExpiry, formatForwardExpiry, formatForwardSlash, formatMonthExpiry, hasTextSelected, luhnCheck, reFormatCardNumber, restrictCVC, restrictCardNumber, restrictCombinedExpiry, restrictExpiry, restrictMonthExpiry, restrictNumeric, restrictYearExpiry, setCardType,
|
977
|
+
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
978
|
+
|
979
|
+
QJ = __webpack_require__(6);
|
980
|
+
|
981
|
+
defaultFormat = /(\d{1,4})/g;
|
982
|
+
|
983
|
+
cards = [
|
984
|
+
{
|
985
|
+
type: 'amex',
|
986
|
+
pattern: /^3[47]/,
|
987
|
+
format: /(\d{1,4})(\d{1,6})?(\d{1,5})?/,
|
988
|
+
length: [15],
|
989
|
+
cvcLength: [4],
|
990
|
+
luhn: true
|
991
|
+
}, {
|
992
|
+
type: 'dankort',
|
993
|
+
pattern: /^5019/,
|
994
|
+
format: defaultFormat,
|
995
|
+
length: [16],
|
996
|
+
cvcLength: [3],
|
997
|
+
luhn: true
|
998
|
+
}, {
|
999
|
+
type: 'dinersclub',
|
1000
|
+
pattern: /^(36|38|30[0-5])/,
|
1001
|
+
format: defaultFormat,
|
1002
|
+
length: [14],
|
1003
|
+
cvcLength: [3],
|
1004
|
+
luhn: true
|
1005
|
+
}, {
|
1006
|
+
type: 'discover',
|
1007
|
+
pattern: /^(6011|65|64[4-9]|622)/,
|
1008
|
+
format: defaultFormat,
|
1009
|
+
length: [16],
|
1010
|
+
cvcLength: [3],
|
1011
|
+
luhn: true
|
1012
|
+
}, {
|
1013
|
+
type: 'jcb',
|
1014
|
+
pattern: /^35/,
|
1015
|
+
format: defaultFormat,
|
1016
|
+
length: [16],
|
1017
|
+
cvcLength: [3],
|
1018
|
+
luhn: true
|
1019
|
+
}, {
|
1020
|
+
type: 'laser',
|
1021
|
+
pattern: /^(6706|6771|6709)/,
|
1022
|
+
format: defaultFormat,
|
1023
|
+
length: [16, 17, 18, 19],
|
1024
|
+
cvcLength: [3],
|
1025
|
+
luhn: true
|
1026
|
+
}, {
|
1027
|
+
type: 'maestro',
|
1028
|
+
pattern: /^(5018|5020|5038|6304|6703|6759|676[1-3])/,
|
1029
|
+
format: defaultFormat,
|
1030
|
+
length: [12, 13, 14, 15, 16, 17, 18, 19],
|
1031
|
+
cvcLength: [3],
|
1032
|
+
luhn: true
|
1033
|
+
}, {
|
1034
|
+
type: 'mastercard',
|
1035
|
+
pattern: /^5[1-5]/,
|
1036
|
+
format: defaultFormat,
|
1037
|
+
length: [16],
|
1038
|
+
cvcLength: [3],
|
1039
|
+
luhn: true
|
1040
|
+
}, {
|
1041
|
+
type: 'unionpay',
|
1042
|
+
pattern: /^62/,
|
1043
|
+
format: defaultFormat,
|
1044
|
+
length: [16, 17, 18, 19],
|
1045
|
+
cvcLength: [3],
|
1046
|
+
luhn: false
|
1047
|
+
}, {
|
1048
|
+
type: 'visaelectron',
|
1049
|
+
pattern: /^4(026|17500|405|508|844|91[37])/,
|
1050
|
+
format: defaultFormat,
|
1051
|
+
length: [16],
|
1052
|
+
cvcLength: [3],
|
1053
|
+
luhn: true
|
1054
|
+
}, {
|
1055
|
+
type: 'elo',
|
1056
|
+
pattern: /^4011|438935|45(1416|76|7393)|50(4175|6699|67|90[4-7])|63(6297|6368)/,
|
1057
|
+
format: defaultFormat,
|
1058
|
+
length: [16],
|
1059
|
+
cvcLength: [3],
|
1060
|
+
luhn: true
|
1061
|
+
}, {
|
1062
|
+
type: 'visa',
|
1063
|
+
pattern: /^4/,
|
1064
|
+
format: defaultFormat,
|
1065
|
+
length: [13, 16, 19],
|
1066
|
+
cvcLength: [3],
|
1067
|
+
luhn: true
|
1068
|
+
}
|
1069
|
+
];
|
1070
|
+
|
1071
|
+
cardFromNumber = function(num) {
|
1072
|
+
var card, i, len;
|
1073
|
+
num = (num + '').replace(/\D/g, '');
|
1074
|
+
for (i = 0, len = cards.length; i < len; i++) {
|
1075
|
+
card = cards[i];
|
1076
|
+
if (card.pattern.test(num)) {
|
1077
|
+
return card;
|
1078
|
+
}
|
1079
|
+
}
|
1080
|
+
};
|
1081
|
+
|
1082
|
+
cardFromType = function(type) {
|
1083
|
+
var card, i, len;
|
1084
|
+
for (i = 0, len = cards.length; i < len; i++) {
|
1085
|
+
card = cards[i];
|
1086
|
+
if (card.type === type) {
|
1087
|
+
return card;
|
1088
|
+
}
|
1089
|
+
}
|
1090
|
+
};
|
1091
|
+
|
1092
|
+
luhnCheck = function(num) {
|
1093
|
+
var digit, digits, i, len, odd, sum;
|
1094
|
+
odd = true;
|
1095
|
+
sum = 0;
|
1096
|
+
digits = (num + '').split('').reverse();
|
1097
|
+
for (i = 0, len = digits.length; i < len; i++) {
|
1098
|
+
digit = digits[i];
|
1099
|
+
digit = parseInt(digit, 10);
|
1100
|
+
if ((odd = !odd)) {
|
1101
|
+
digit *= 2;
|
1102
|
+
}
|
1103
|
+
if (digit > 9) {
|
1104
|
+
digit -= 9;
|
1105
|
+
}
|
1106
|
+
sum += digit;
|
1107
|
+
}
|
1108
|
+
return sum % 10 === 0;
|
1109
|
+
};
|
1110
|
+
|
1111
|
+
hasTextSelected = function(target) {
|
1112
|
+
var e, error, ref;
|
1113
|
+
try {
|
1114
|
+
if ((target.selectionStart != null) && target.selectionStart !== target.selectionEnd) {
|
1115
|
+
return true;
|
1116
|
+
}
|
1117
|
+
if ((typeof document !== "undefined" && document !== null ? (ref = document.selection) != null ? ref.createRange : void 0 : void 0) != null) {
|
1118
|
+
if (document.selection.createRange().text) {
|
1119
|
+
return true;
|
1120
|
+
}
|
1121
|
+
}
|
1122
|
+
} catch (error) {
|
1123
|
+
e = error;
|
1124
|
+
false;
|
1125
|
+
}
|
1126
|
+
return false;
|
1127
|
+
};
|
1128
|
+
|
1129
|
+
reFormatCardNumber = function(e) {
|
1130
|
+
return setTimeout((function(_this) {
|
1131
|
+
return function() {
|
1132
|
+
var target, value;
|
1133
|
+
target = e.target;
|
1134
|
+
value = QJ.val(target);
|
1135
|
+
value = Payment.fns.formatCardNumber(value);
|
1136
|
+
QJ.val(target, value);
|
1137
|
+
return QJ.trigger(target, 'change');
|
1138
|
+
};
|
1139
|
+
})(this));
|
1140
|
+
};
|
1141
|
+
|
1142
|
+
formatCardNumber = function(e) {
|
1143
|
+
var card, digit, length, re, target, upperLength, value;
|
1144
|
+
digit = String.fromCharCode(e.which);
|
1145
|
+
if (!/^\d+$/.test(digit)) {
|
1146
|
+
return;
|
1147
|
+
}
|
1148
|
+
target = e.target;
|
1149
|
+
value = QJ.val(target);
|
1150
|
+
card = cardFromNumber(value + digit);
|
1151
|
+
length = (value.replace(/\D/g, '') + digit).length;
|
1152
|
+
upperLength = 16;
|
1153
|
+
if (card) {
|
1154
|
+
upperLength = card.length[card.length.length - 1];
|
1155
|
+
}
|
1156
|
+
if (length >= upperLength) {
|
1157
|
+
return;
|
1158
|
+
}
|
1159
|
+
if (hasTextSelected(target)) {
|
1160
|
+
return;
|
1161
|
+
}
|
1162
|
+
if (card && card.type === 'amex') {
|
1163
|
+
re = /^(\d{4}|\d{4}\s\d{6})$/;
|
1164
|
+
} else {
|
1165
|
+
re = /(?:^|\s)(\d{4})$/;
|
1166
|
+
}
|
1167
|
+
if (re.test(value)) {
|
1168
|
+
e.preventDefault();
|
1169
|
+
return QJ.val(target, value + ' ' + digit);
|
1170
|
+
} else if (re.test(value + digit)) {
|
1171
|
+
e.preventDefault();
|
1172
|
+
return QJ.val(target, value + digit + ' ');
|
1173
|
+
}
|
1174
|
+
};
|
1175
|
+
|
1176
|
+
formatBackCardNumber = function(e) {
|
1177
|
+
var target, value;
|
1178
|
+
target = e.target;
|
1179
|
+
value = QJ.val(target);
|
1180
|
+
if (e.meta) {
|
1181
|
+
return;
|
1182
|
+
}
|
1183
|
+
if (e.which !== 8) {
|
1184
|
+
return;
|
1185
|
+
}
|
1186
|
+
if (hasTextSelected(target)) {
|
1187
|
+
return;
|
1188
|
+
}
|
1189
|
+
if (/\d\s$/.test(value)) {
|
1190
|
+
e.preventDefault();
|
1191
|
+
return QJ.val(target, value.replace(/\d\s$/, ''));
|
1192
|
+
} else if (/\s\d?$/.test(value)) {
|
1193
|
+
e.preventDefault();
|
1194
|
+
return QJ.val(target, value.replace(/\s\d?$/, ''));
|
1195
|
+
}
|
1196
|
+
};
|
1197
|
+
|
1198
|
+
formatExpiry = function(e) {
|
1199
|
+
var digit, target, val;
|
1200
|
+
digit = String.fromCharCode(e.which);
|
1201
|
+
if (!/^\d+$/.test(digit)) {
|
1202
|
+
return;
|
1203
|
+
}
|
1204
|
+
target = e.target;
|
1205
|
+
val = QJ.val(target) + digit;
|
1206
|
+
if (/^\d$/.test(val) && (val !== '0' && val !== '1')) {
|
1207
|
+
e.preventDefault();
|
1208
|
+
return QJ.val(target, "0" + val + " / ");
|
1209
|
+
} else if (/^\d\d$/.test(val)) {
|
1210
|
+
e.preventDefault();
|
1211
|
+
return QJ.val(target, val + " / ");
|
1212
|
+
}
|
1213
|
+
};
|
1214
|
+
|
1215
|
+
formatMonthExpiry = function(e) {
|
1216
|
+
var digit, target, val;
|
1217
|
+
digit = String.fromCharCode(e.which);
|
1218
|
+
if (!/^\d+$/.test(digit)) {
|
1219
|
+
return;
|
1220
|
+
}
|
1221
|
+
target = e.target;
|
1222
|
+
val = QJ.val(target) + digit;
|
1223
|
+
if (/^\d$/.test(val) && (val !== '0' && val !== '1')) {
|
1224
|
+
e.preventDefault();
|
1225
|
+
return QJ.val(target, "0" + val);
|
1226
|
+
} else if (/^\d\d$/.test(val)) {
|
1227
|
+
e.preventDefault();
|
1228
|
+
return QJ.val(target, "" + val);
|
1229
|
+
}
|
1230
|
+
};
|
1231
|
+
|
1232
|
+
formatForwardExpiry = function(e) {
|
1233
|
+
var digit, target, val;
|
1234
|
+
digit = String.fromCharCode(e.which);
|
1235
|
+
if (!/^\d+$/.test(digit)) {
|
1236
|
+
return;
|
1237
|
+
}
|
1238
|
+
target = e.target;
|
1239
|
+
val = QJ.val(target);
|
1240
|
+
if (/^\d\d$/.test(val)) {
|
1241
|
+
return QJ.val(target, val + " / ");
|
1242
|
+
}
|
1243
|
+
};
|
1244
|
+
|
1245
|
+
formatForwardSlash = function(e) {
|
1246
|
+
var slash, target, val;
|
1247
|
+
slash = String.fromCharCode(e.which);
|
1248
|
+
if (slash !== '/') {
|
1249
|
+
return;
|
1250
|
+
}
|
1251
|
+
target = e.target;
|
1252
|
+
val = QJ.val(target);
|
1253
|
+
if (/^\d$/.test(val) && val !== '0') {
|
1254
|
+
return QJ.val(target, "0" + val + " / ");
|
1255
|
+
}
|
1256
|
+
};
|
1257
|
+
|
1258
|
+
formatBackExpiry = function(e) {
|
1259
|
+
var target, value;
|
1260
|
+
if (e.metaKey) {
|
1261
|
+
return;
|
1262
|
+
}
|
1263
|
+
target = e.target;
|
1264
|
+
value = QJ.val(target);
|
1265
|
+
if (e.which !== 8) {
|
1266
|
+
return;
|
1267
|
+
}
|
1268
|
+
if (hasTextSelected(target)) {
|
1269
|
+
return;
|
1270
|
+
}
|
1271
|
+
if (/\d(\s|\/)+$/.test(value)) {
|
1272
|
+
e.preventDefault();
|
1273
|
+
return QJ.val(target, value.replace(/\d(\s|\/)*$/, ''));
|
1274
|
+
} else if (/\s\/\s?\d?$/.test(value)) {
|
1275
|
+
e.preventDefault();
|
1276
|
+
return QJ.val(target, value.replace(/\s\/\s?\d?$/, ''));
|
1277
|
+
}
|
1278
|
+
};
|
1279
|
+
|
1280
|
+
restrictNumeric = function(e) {
|
1281
|
+
var input;
|
1282
|
+
if (e.metaKey || e.ctrlKey) {
|
1283
|
+
return true;
|
1284
|
+
}
|
1285
|
+
if (e.which === 32) {
|
1286
|
+
return e.preventDefault();
|
1287
|
+
}
|
1288
|
+
if (e.which === 0) {
|
1289
|
+
return true;
|
1290
|
+
}
|
1291
|
+
if (e.which < 33) {
|
1292
|
+
return true;
|
1293
|
+
}
|
1294
|
+
input = String.fromCharCode(e.which);
|
1295
|
+
if (!/[\d\s]/.test(input)) {
|
1296
|
+
return e.preventDefault();
|
1297
|
+
}
|
1298
|
+
};
|
1299
|
+
|
1300
|
+
restrictCardNumber = function(e) {
|
1301
|
+
var card, digit, target, value;
|
1302
|
+
target = e.target;
|
1303
|
+
digit = String.fromCharCode(e.which);
|
1304
|
+
if (!/^\d+$/.test(digit)) {
|
1305
|
+
return;
|
1306
|
+
}
|
1307
|
+
if (hasTextSelected(target)) {
|
1308
|
+
return;
|
1309
|
+
}
|
1310
|
+
value = (QJ.val(target) + digit).replace(/\D/g, '');
|
1311
|
+
card = cardFromNumber(value);
|
1312
|
+
if (card) {
|
1313
|
+
if (!(value.length <= card.length[card.length.length - 1])) {
|
1314
|
+
return e.preventDefault();
|
1315
|
+
}
|
1316
|
+
} else {
|
1317
|
+
if (!(value.length <= 16)) {
|
1318
|
+
return e.preventDefault();
|
1319
|
+
}
|
1320
|
+
}
|
1321
|
+
};
|
1322
|
+
|
1323
|
+
restrictExpiry = function(e, length) {
|
1324
|
+
var digit, target, value;
|
1325
|
+
target = e.target;
|
1326
|
+
digit = String.fromCharCode(e.which);
|
1327
|
+
if (!/^\d+$/.test(digit)) {
|
1328
|
+
return;
|
1329
|
+
}
|
1330
|
+
if (hasTextSelected(target)) {
|
1331
|
+
return;
|
1332
|
+
}
|
1333
|
+
value = QJ.val(target) + digit;
|
1334
|
+
value = value.replace(/\D/g, '');
|
1335
|
+
if (value.length > length) {
|
1336
|
+
return e.preventDefault();
|
1337
|
+
}
|
1338
|
+
};
|
1339
|
+
|
1340
|
+
restrictCombinedExpiry = function(e) {
|
1341
|
+
return restrictExpiry(e, 6);
|
1342
|
+
};
|
1343
|
+
|
1344
|
+
restrictMonthExpiry = function(e) {
|
1345
|
+
return restrictExpiry(e, 2);
|
1346
|
+
};
|
1347
|
+
|
1348
|
+
restrictYearExpiry = function(e) {
|
1349
|
+
return restrictExpiry(e, 4);
|
1350
|
+
};
|
1351
|
+
|
1352
|
+
restrictCVC = function(e) {
|
1353
|
+
var digit, target, val;
|
1354
|
+
target = e.target;
|
1355
|
+
digit = String.fromCharCode(e.which);
|
1356
|
+
if (!/^\d+$/.test(digit)) {
|
1357
|
+
return;
|
1358
|
+
}
|
1359
|
+
if (hasTextSelected(target)) {
|
1360
|
+
return;
|
1361
|
+
}
|
1362
|
+
val = QJ.val(target) + digit;
|
1363
|
+
if (!(val.length <= 4)) {
|
1364
|
+
return e.preventDefault();
|
1365
|
+
}
|
1366
|
+
};
|
1367
|
+
|
1368
|
+
setCardType = function(e) {
|
1369
|
+
var allTypes, card, cardType, target, val;
|
1370
|
+
target = e.target;
|
1371
|
+
val = QJ.val(target);
|
1372
|
+
cardType = Payment.fns.cardType(val) || 'unknown';
|
1373
|
+
if (!QJ.hasClass(target, cardType)) {
|
1374
|
+
allTypes = (function() {
|
1375
|
+
var i, len, results;
|
1376
|
+
results = [];
|
1377
|
+
for (i = 0, len = cards.length; i < len; i++) {
|
1378
|
+
card = cards[i];
|
1379
|
+
results.push(card.type);
|
1380
|
+
}
|
1381
|
+
return results;
|
1382
|
+
})();
|
1383
|
+
QJ.removeClass(target, 'unknown');
|
1384
|
+
QJ.removeClass(target, allTypes.join(' '));
|
1385
|
+
QJ.addClass(target, cardType);
|
1386
|
+
QJ.toggleClass(target, 'identified', cardType !== 'unknown');
|
1387
|
+
return QJ.trigger(target, 'payment.cardType', cardType);
|
1388
|
+
}
|
1389
|
+
};
|
1390
|
+
|
1391
|
+
Payment = (function() {
|
1392
|
+
function Payment() {}
|
1393
|
+
|
1394
|
+
Payment.fns = {
|
1395
|
+
cardExpiryVal: function(value) {
|
1396
|
+
var month, prefix, ref, year;
|
1397
|
+
value = value.replace(/\s/g, '');
|
1398
|
+
ref = value.split('/', 2), month = ref[0], year = ref[1];
|
1399
|
+
if ((year != null ? year.length : void 0) === 2 && /^\d+$/.test(year)) {
|
1400
|
+
prefix = (new Date).getFullYear();
|
1401
|
+
prefix = prefix.toString().slice(0, 2);
|
1402
|
+
year = prefix + year;
|
1403
|
+
}
|
1404
|
+
month = parseInt(month, 10);
|
1405
|
+
year = parseInt(year, 10);
|
1406
|
+
return {
|
1407
|
+
month: month,
|
1408
|
+
year: year
|
1409
|
+
};
|
1410
|
+
},
|
1411
|
+
validateCardNumber: function(num) {
|
1412
|
+
var card, ref;
|
1413
|
+
num = (num + '').replace(/\s+|-/g, '');
|
1414
|
+
if (!/^\d+$/.test(num)) {
|
1415
|
+
return false;
|
1416
|
+
}
|
1417
|
+
card = cardFromNumber(num);
|
1418
|
+
if (!card) {
|
1419
|
+
return false;
|
1420
|
+
}
|
1421
|
+
return (ref = num.length, indexOf.call(card.length, ref) >= 0) && (card.luhn === false || luhnCheck(num));
|
1422
|
+
},
|
1423
|
+
validateCardExpiry: function(month, year) {
|
1424
|
+
var currentTime, expiry, prefix, ref;
|
1425
|
+
if (typeof month === 'object' && 'month' in month) {
|
1426
|
+
ref = month, month = ref.month, year = ref.year;
|
1427
|
+
}
|
1428
|
+
if (!(month && year)) {
|
1429
|
+
return false;
|
1430
|
+
}
|
1431
|
+
month = QJ.trim(month);
|
1432
|
+
year = QJ.trim(year);
|
1433
|
+
if (!/^\d+$/.test(month)) {
|
1434
|
+
return false;
|
1435
|
+
}
|
1436
|
+
if (!/^\d+$/.test(year)) {
|
1437
|
+
return false;
|
1438
|
+
}
|
1439
|
+
month = parseInt(month, 10);
|
1440
|
+
if (!(month && month <= 12)) {
|
1441
|
+
return false;
|
1442
|
+
}
|
1443
|
+
if (year.length === 2) {
|
1444
|
+
prefix = (new Date).getFullYear();
|
1445
|
+
prefix = prefix.toString().slice(0, 2);
|
1446
|
+
year = prefix + year;
|
1447
|
+
}
|
1448
|
+
expiry = new Date(year, month);
|
1449
|
+
currentTime = new Date;
|
1450
|
+
expiry.setMonth(expiry.getMonth() - 1);
|
1451
|
+
expiry.setMonth(expiry.getMonth() + 1, 1);
|
1452
|
+
return expiry > currentTime;
|
1453
|
+
},
|
1454
|
+
validateCardCVC: function(cvc, type) {
|
1455
|
+
var ref, ref1;
|
1456
|
+
cvc = QJ.trim(cvc);
|
1457
|
+
if (!/^\d+$/.test(cvc)) {
|
1458
|
+
return false;
|
1459
|
+
}
|
1460
|
+
if (type && cardFromType(type)) {
|
1461
|
+
return ref = cvc.length, indexOf.call((ref1 = cardFromType(type)) != null ? ref1.cvcLength : void 0, ref) >= 0;
|
1462
|
+
} else {
|
1463
|
+
return cvc.length >= 3 && cvc.length <= 4;
|
1464
|
+
}
|
1465
|
+
},
|
1466
|
+
cardType: function(num) {
|
1467
|
+
var ref;
|
1468
|
+
if (!num) {
|
1469
|
+
return null;
|
1470
|
+
}
|
1471
|
+
return ((ref = cardFromNumber(num)) != null ? ref.type : void 0) || null;
|
1472
|
+
},
|
1473
|
+
formatCardNumber: function(num) {
|
1474
|
+
var card, groups, ref, upperLength;
|
1475
|
+
card = cardFromNumber(num);
|
1476
|
+
if (!card) {
|
1477
|
+
return num;
|
1478
|
+
}
|
1479
|
+
upperLength = card.length[card.length.length - 1];
|
1480
|
+
num = num.replace(/\D/g, '');
|
1481
|
+
num = num.slice(0, +upperLength + 1 || 9e9);
|
1482
|
+
if (card.format.global) {
|
1483
|
+
return (ref = num.match(card.format)) != null ? ref.join(' ') : void 0;
|
1484
|
+
} else {
|
1485
|
+
groups = card.format.exec(num);
|
1486
|
+
if (groups != null) {
|
1487
|
+
groups.shift();
|
1488
|
+
}
|
1489
|
+
return groups != null ? groups.join(' ') : void 0;
|
1490
|
+
}
|
1491
|
+
}
|
1492
|
+
};
|
1493
|
+
|
1494
|
+
Payment.restrictNumeric = function(el) {
|
1495
|
+
return QJ.on(el, 'keypress', restrictNumeric);
|
1496
|
+
};
|
1497
|
+
|
1498
|
+
Payment.cardExpiryVal = function(el) {
|
1499
|
+
return Payment.fns.cardExpiryVal(QJ.val(el));
|
1500
|
+
};
|
1501
|
+
|
1502
|
+
Payment.formatCardCVC = function(el) {
|
1503
|
+
Payment.restrictNumeric(el);
|
1504
|
+
QJ.on(el, 'keypress', restrictCVC);
|
1505
|
+
return el;
|
1506
|
+
};
|
1507
|
+
|
1508
|
+
Payment.formatCardExpiry = function(el) {
|
1509
|
+
var month, year;
|
1510
|
+
Payment.restrictNumeric(el);
|
1511
|
+
if (el.length && el.length === 2) {
|
1512
|
+
month = el[0], year = el[1];
|
1513
|
+
this.formatCardExpiryMultiple(month, year);
|
1514
|
+
} else {
|
1515
|
+
QJ.on(el, 'keypress', restrictCombinedExpiry);
|
1516
|
+
QJ.on(el, 'keypress', formatExpiry);
|
1517
|
+
QJ.on(el, 'keypress', formatForwardSlash);
|
1518
|
+
QJ.on(el, 'keypress', formatForwardExpiry);
|
1519
|
+
QJ.on(el, 'keydown', formatBackExpiry);
|
1520
|
+
}
|
1521
|
+
return el;
|
1522
|
+
};
|
1523
|
+
|
1524
|
+
Payment.formatCardExpiryMultiple = function(month, year) {
|
1525
|
+
QJ.on(month, 'keypress', restrictMonthExpiry);
|
1526
|
+
QJ.on(month, 'keypress', formatMonthExpiry);
|
1527
|
+
return QJ.on(year, 'keypress', restrictYearExpiry);
|
1528
|
+
};
|
1529
|
+
|
1530
|
+
Payment.formatCardNumber = function(el) {
|
1531
|
+
Payment.restrictNumeric(el);
|
1532
|
+
QJ.on(el, 'keypress', restrictCardNumber);
|
1533
|
+
QJ.on(el, 'keypress', formatCardNumber);
|
1534
|
+
QJ.on(el, 'keydown', formatBackCardNumber);
|
1535
|
+
QJ.on(el, 'keyup', setCardType);
|
1536
|
+
QJ.on(el, 'paste', reFormatCardNumber);
|
1537
|
+
return el;
|
1538
|
+
};
|
1539
|
+
|
1540
|
+
Payment.getCardArray = function() {
|
1541
|
+
return cards;
|
1542
|
+
};
|
1543
|
+
|
1544
|
+
Payment.setCardArray = function(cardArray) {
|
1545
|
+
cards = cardArray;
|
1546
|
+
return true;
|
1547
|
+
};
|
1548
|
+
|
1549
|
+
Payment.addToCardArray = function(cardObject) {
|
1550
|
+
return cards.push(cardObject);
|
1551
|
+
};
|
1552
|
+
|
1553
|
+
Payment.removeFromCardArray = function(type) {
|
1554
|
+
var key, value;
|
1555
|
+
for (key in cards) {
|
1556
|
+
value = cards[key];
|
1557
|
+
if (value.type === type) {
|
1558
|
+
cards.splice(key, 1);
|
1559
|
+
}
|
1560
|
+
}
|
1561
|
+
return true;
|
1562
|
+
};
|
1563
|
+
|
1564
|
+
return Payment;
|
1565
|
+
|
1566
|
+
})();
|
1567
|
+
|
1568
|
+
module.exports = Payment;
|
1569
|
+
|
1570
|
+
global.Payment = Payment;
|
1571
|
+
|
1572
|
+
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
1573
|
+
|
1574
|
+
/***/ },
|
1575
|
+
/* 8 */
|
1576
|
+
/***/ function(module, exports, __webpack_require__) {
|
1577
|
+
|
1578
|
+
module.exports = __webpack_require__(9);
|
1579
|
+
|
1580
|
+
|
1581
|
+
|
1582
|
+
/***/ },
|
1583
|
+
/* 9 */
|
1584
|
+
/***/ function(module, exports, __webpack_require__) {
|
1585
|
+
|
1586
|
+
/*!
|
1587
|
+
* node.extend
|
1588
|
+
* Copyright 2011, John Resig
|
1589
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
1590
|
+
* http://jquery.org/license
|
1591
|
+
*
|
1592
|
+
* @fileoverview
|
1593
|
+
* Port of jQuery.extend that actually works on node.js
|
1594
|
+
*/
|
1595
|
+
var is = __webpack_require__(10);
|
1596
|
+
|
1597
|
+
function extend() {
|
1598
|
+
var target = arguments[0] || {};
|
1599
|
+
var i = 1;
|
1600
|
+
var length = arguments.length;
|
1601
|
+
var deep = false;
|
1602
|
+
var options, name, src, copy, copy_is_array, clone;
|
1603
|
+
|
1604
|
+
// Handle a deep copy situation
|
1605
|
+
if (typeof target === 'boolean') {
|
1606
|
+
deep = target;
|
1607
|
+
target = arguments[1] || {};
|
1608
|
+
// skip the boolean and the target
|
1609
|
+
i = 2;
|
1610
|
+
}
|
1611
|
+
|
1612
|
+
// Handle case when target is a string or something (possible in deep copy)
|
1613
|
+
if (typeof target !== 'object' && !is.fn(target)) {
|
1614
|
+
target = {};
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
for (; i < length; i++) {
|
1618
|
+
// Only deal with non-null/undefined values
|
1619
|
+
options = arguments[i]
|
1620
|
+
if (options != null) {
|
1621
|
+
if (typeof options === 'string') {
|
1622
|
+
options = options.split('');
|
1623
|
+
}
|
1624
|
+
// Extend the base object
|
1625
|
+
for (name in options) {
|
1626
|
+
src = target[name];
|
1627
|
+
copy = options[name];
|
1628
|
+
|
1629
|
+
// Prevent never-ending loop
|
1630
|
+
if (target === copy) {
|
1631
|
+
continue;
|
1632
|
+
}
|
1633
|
+
|
1634
|
+
// Recurse if we're merging plain objects or arrays
|
1635
|
+
if (deep && copy && (is.hash(copy) || (copy_is_array = is.array(copy)))) {
|
1636
|
+
if (copy_is_array) {
|
1637
|
+
copy_is_array = false;
|
1638
|
+
clone = src && is.array(src) ? src : [];
|
1639
|
+
} else {
|
1640
|
+
clone = src && is.hash(src) ? src : {};
|
1641
|
+
}
|
1642
|
+
|
1643
|
+
// Never move original objects, clone them
|
1644
|
+
target[name] = extend(deep, clone, copy);
|
1645
|
+
|
1646
|
+
// Don't bring in undefined values
|
1647
|
+
} else if (typeof copy !== 'undefined') {
|
1648
|
+
target[name] = copy;
|
1649
|
+
}
|
1650
|
+
}
|
1651
|
+
}
|
1652
|
+
}
|
1653
|
+
|
1654
|
+
// Return the modified object
|
1655
|
+
return target;
|
1656
|
+
};
|
1657
|
+
|
1658
|
+
/**
|
1659
|
+
* @public
|
1660
|
+
*/
|
1661
|
+
extend.version = '1.1.3';
|
1662
|
+
|
1663
|
+
/**
|
1664
|
+
* Exports module.
|
1665
|
+
*/
|
1666
|
+
module.exports = extend;
|
1667
|
+
|
1668
|
+
|
1669
|
+
|
1670
|
+
/***/ },
|
1671
|
+
/* 10 */
|
1672
|
+
/***/ function(module, exports) {
|
1673
|
+
|
1674
|
+
/* globals window, HTMLElement */
|
1675
|
+
/**!
|
1676
|
+
* is
|
1677
|
+
* the definitive JavaScript type testing library
|
1678
|
+
*
|
1679
|
+
* @copyright 2013-2014 Enrico Marino / Jordan Harband
|
1680
|
+
* @license MIT
|
1681
|
+
*/
|
1682
|
+
|
1683
|
+
var objProto = Object.prototype;
|
1684
|
+
var owns = objProto.hasOwnProperty;
|
1685
|
+
var toStr = objProto.toString;
|
1686
|
+
var symbolValueOf;
|
1687
|
+
if (typeof Symbol === 'function') {
|
1688
|
+
symbolValueOf = Symbol.prototype.valueOf;
|
1689
|
+
}
|
1690
|
+
var isActualNaN = function (value) {
|
1691
|
+
return value !== value;
|
1692
|
+
};
|
1693
|
+
var NON_HOST_TYPES = {
|
1694
|
+
'boolean': 1,
|
1695
|
+
number: 1,
|
1696
|
+
string: 1,
|
1697
|
+
undefined: 1
|
1698
|
+
};
|
1699
|
+
|
1700
|
+
var base64Regex = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/;
|
1701
|
+
var hexRegex = /^[A-Fa-f0-9]+$/;
|
1702
|
+
|
1703
|
+
/**
|
1704
|
+
* Expose `is`
|
1705
|
+
*/
|
1706
|
+
|
1707
|
+
var is = module.exports = {};
|
1708
|
+
|
1709
|
+
/**
|
1710
|
+
* Test general.
|
1711
|
+
*/
|
1712
|
+
|
1713
|
+
/**
|
1714
|
+
* is.type
|
1715
|
+
* Test if `value` is a type of `type`.
|
1716
|
+
*
|
1717
|
+
* @param {Mixed} value value to test
|
1718
|
+
* @param {String} type type
|
1719
|
+
* @return {Boolean} true if `value` is a type of `type`, false otherwise
|
1720
|
+
* @api public
|
1721
|
+
*/
|
1722
|
+
|
1723
|
+
is.a = is.type = function (value, type) {
|
1724
|
+
return typeof value === type;
|
1725
|
+
};
|
1726
|
+
|
1727
|
+
/**
|
1728
|
+
* is.defined
|
1729
|
+
* Test if `value` is defined.
|
1730
|
+
*
|
1731
|
+
* @param {Mixed} value value to test
|
1732
|
+
* @return {Boolean} true if 'value' is defined, false otherwise
|
1733
|
+
* @api public
|
1734
|
+
*/
|
1735
|
+
|
1736
|
+
is.defined = function (value) {
|
1737
|
+
return typeof value !== 'undefined';
|
1738
|
+
};
|
1739
|
+
|
1740
|
+
/**
|
1741
|
+
* is.empty
|
1742
|
+
* Test if `value` is empty.
|
1743
|
+
*
|
1744
|
+
* @param {Mixed} value value to test
|
1745
|
+
* @return {Boolean} true if `value` is empty, false otherwise
|
1746
|
+
* @api public
|
1747
|
+
*/
|
1748
|
+
|
1749
|
+
is.empty = function (value) {
|
1750
|
+
var type = toStr.call(value);
|
1751
|
+
var key;
|
1752
|
+
|
1753
|
+
if (type === '[object Array]' || type === '[object Arguments]' || type === '[object String]') {
|
1754
|
+
return value.length === 0;
|
1755
|
+
}
|
1756
|
+
|
1757
|
+
if (type === '[object Object]') {
|
1758
|
+
for (key in value) {
|
1759
|
+
if (owns.call(value, key)) { return false; }
|
1760
|
+
}
|
1761
|
+
return true;
|
1762
|
+
}
|
1763
|
+
|
1764
|
+
return !value;
|
1765
|
+
};
|
1766
|
+
|
1767
|
+
/**
|
1768
|
+
* is.equal
|
1769
|
+
* Test if `value` is equal to `other`.
|
1770
|
+
*
|
1771
|
+
* @param {Mixed} value value to test
|
1772
|
+
* @param {Mixed} other value to compare with
|
1773
|
+
* @return {Boolean} true if `value` is equal to `other`, false otherwise
|
1774
|
+
*/
|
1775
|
+
|
1776
|
+
is.equal = function equal(value, other) {
|
1777
|
+
if (value === other) {
|
1778
|
+
return true;
|
1779
|
+
}
|
1780
|
+
|
1781
|
+
var type = toStr.call(value);
|
1782
|
+
var key;
|
1783
|
+
|
1784
|
+
if (type !== toStr.call(other)) {
|
1785
|
+
return false;
|
1786
|
+
}
|
1787
|
+
|
1788
|
+
if (type === '[object Object]') {
|
1789
|
+
for (key in value) {
|
1790
|
+
if (!is.equal(value[key], other[key]) || !(key in other)) {
|
1791
|
+
return false;
|
1792
|
+
}
|
1793
|
+
}
|
1794
|
+
for (key in other) {
|
1795
|
+
if (!is.equal(value[key], other[key]) || !(key in value)) {
|
1796
|
+
return false;
|
1797
|
+
}
|
1798
|
+
}
|
1799
|
+
return true;
|
1800
|
+
}
|
1801
|
+
|
1802
|
+
if (type === '[object Array]') {
|
1803
|
+
key = value.length;
|
1804
|
+
if (key !== other.length) {
|
1805
|
+
return false;
|
1806
|
+
}
|
1807
|
+
while (--key) {
|
1808
|
+
if (!is.equal(value[key], other[key])) {
|
1809
|
+
return false;
|
1810
|
+
}
|
1811
|
+
}
|
1812
|
+
return true;
|
1813
|
+
}
|
1814
|
+
|
1815
|
+
if (type === '[object Function]') {
|
1816
|
+
return value.prototype === other.prototype;
|
1817
|
+
}
|
1818
|
+
|
1819
|
+
if (type === '[object Date]') {
|
1820
|
+
return value.getTime() === other.getTime();
|
1821
|
+
}
|
1822
|
+
|
1823
|
+
return false;
|
1824
|
+
};
|
1825
|
+
|
1826
|
+
/**
|
1827
|
+
* is.hosted
|
1828
|
+
* Test if `value` is hosted by `host`.
|
1829
|
+
*
|
1830
|
+
* @param {Mixed} value to test
|
1831
|
+
* @param {Mixed} host host to test with
|
1832
|
+
* @return {Boolean} true if `value` is hosted by `host`, false otherwise
|
1833
|
+
* @api public
|
1834
|
+
*/
|
1835
|
+
|
1836
|
+
is.hosted = function (value, host) {
|
1837
|
+
var type = typeof host[value];
|
1838
|
+
return type === 'object' ? !!host[value] : !NON_HOST_TYPES[type];
|
1839
|
+
};
|
1840
|
+
|
1841
|
+
/**
|
1842
|
+
* is.instance
|
1843
|
+
* Test if `value` is an instance of `constructor`.
|
1844
|
+
*
|
1845
|
+
* @param {Mixed} value value to test
|
1846
|
+
* @return {Boolean} true if `value` is an instance of `constructor`
|
1847
|
+
* @api public
|
1848
|
+
*/
|
1849
|
+
|
1850
|
+
is.instance = is['instanceof'] = function (value, constructor) {
|
1851
|
+
return value instanceof constructor;
|
1852
|
+
};
|
1853
|
+
|
1854
|
+
/**
|
1855
|
+
* is.nil / is.null
|
1856
|
+
* Test if `value` is null.
|
1857
|
+
*
|
1858
|
+
* @param {Mixed} value value to test
|
1859
|
+
* @return {Boolean} true if `value` is null, false otherwise
|
1860
|
+
* @api public
|
1861
|
+
*/
|
1862
|
+
|
1863
|
+
is.nil = is['null'] = function (value) {
|
1864
|
+
return value === null;
|
1865
|
+
};
|
1866
|
+
|
1867
|
+
/**
|
1868
|
+
* is.undef / is.undefined
|
1869
|
+
* Test if `value` is undefined.
|
1870
|
+
*
|
1871
|
+
* @param {Mixed} value value to test
|
1872
|
+
* @return {Boolean} true if `value` is undefined, false otherwise
|
1873
|
+
* @api public
|
1874
|
+
*/
|
1875
|
+
|
1876
|
+
is.undef = is.undefined = function (value) {
|
1877
|
+
return typeof value === 'undefined';
|
1878
|
+
};
|
1879
|
+
|
1880
|
+
/**
|
1881
|
+
* Test arguments.
|
1882
|
+
*/
|
1883
|
+
|
1884
|
+
/**
|
1885
|
+
* is.args
|
1886
|
+
* Test if `value` is an arguments object.
|
1887
|
+
*
|
1888
|
+
* @param {Mixed} value value to test
|
1889
|
+
* @return {Boolean} true if `value` is an arguments object, false otherwise
|
1890
|
+
* @api public
|
1891
|
+
*/
|
1892
|
+
|
1893
|
+
is.args = is.arguments = function (value) {
|
1894
|
+
var isStandardArguments = toStr.call(value) === '[object Arguments]';
|
1895
|
+
var isOldArguments = !is.array(value) && is.arraylike(value) && is.object(value) && is.fn(value.callee);
|
1896
|
+
return isStandardArguments || isOldArguments;
|
1897
|
+
};
|
1898
|
+
|
1899
|
+
/**
|
1900
|
+
* Test array.
|
1901
|
+
*/
|
1902
|
+
|
1903
|
+
/**
|
1904
|
+
* is.array
|
1905
|
+
* Test if 'value' is an array.
|
1906
|
+
*
|
1907
|
+
* @param {Mixed} value value to test
|
1908
|
+
* @return {Boolean} true if `value` is an array, false otherwise
|
1909
|
+
* @api public
|
1910
|
+
*/
|
1911
|
+
|
1912
|
+
is.array = Array.isArray || function (value) {
|
1913
|
+
return toStr.call(value) === '[object Array]';
|
1914
|
+
};
|
1915
|
+
|
1916
|
+
/**
|
1917
|
+
* is.arguments.empty
|
1918
|
+
* Test if `value` is an empty arguments object.
|
1919
|
+
*
|
1920
|
+
* @param {Mixed} value value to test
|
1921
|
+
* @return {Boolean} true if `value` is an empty arguments object, false otherwise
|
1922
|
+
* @api public
|
1923
|
+
*/
|
1924
|
+
is.args.empty = function (value) {
|
1925
|
+
return is.args(value) && value.length === 0;
|
1926
|
+
};
|
1927
|
+
|
1928
|
+
/**
|
1929
|
+
* is.array.empty
|
1930
|
+
* Test if `value` is an empty array.
|
1931
|
+
*
|
1932
|
+
* @param {Mixed} value value to test
|
1933
|
+
* @return {Boolean} true if `value` is an empty array, false otherwise
|
1934
|
+
* @api public
|
1935
|
+
*/
|
1936
|
+
is.array.empty = function (value) {
|
1937
|
+
return is.array(value) && value.length === 0;
|
1938
|
+
};
|
1939
|
+
|
1940
|
+
/**
|
1941
|
+
* is.arraylike
|
1942
|
+
* Test if `value` is an arraylike object.
|
1943
|
+
*
|
1944
|
+
* @param {Mixed} value value to test
|
1945
|
+
* @return {Boolean} true if `value` is an arguments object, false otherwise
|
1946
|
+
* @api public
|
1947
|
+
*/
|
1948
|
+
|
1949
|
+
is.arraylike = function (value) {
|
1950
|
+
return !!value && !is.bool(value)
|
1951
|
+
&& owns.call(value, 'length')
|
1952
|
+
&& isFinite(value.length)
|
1953
|
+
&& is.number(value.length)
|
1954
|
+
&& value.length >= 0;
|
1955
|
+
};
|
1956
|
+
|
1957
|
+
/**
|
1958
|
+
* Test boolean.
|
1959
|
+
*/
|
1960
|
+
|
1961
|
+
/**
|
1962
|
+
* is.bool
|
1963
|
+
* Test if `value` is a boolean.
|
1964
|
+
*
|
1965
|
+
* @param {Mixed} value value to test
|
1966
|
+
* @return {Boolean} true if `value` is a boolean, false otherwise
|
1967
|
+
* @api public
|
1968
|
+
*/
|
1969
|
+
|
1970
|
+
is.bool = is['boolean'] = function (value) {
|
1971
|
+
return toStr.call(value) === '[object Boolean]';
|
1972
|
+
};
|
1973
|
+
|
1974
|
+
/**
|
1975
|
+
* is.false
|
1976
|
+
* Test if `value` is false.
|
1977
|
+
*
|
1978
|
+
* @param {Mixed} value value to test
|
1979
|
+
* @return {Boolean} true if `value` is false, false otherwise
|
1980
|
+
* @api public
|
1981
|
+
*/
|
1982
|
+
|
1983
|
+
is['false'] = function (value) {
|
1984
|
+
return is.bool(value) && Boolean(Number(value)) === false;
|
1985
|
+
};
|
1986
|
+
|
1987
|
+
/**
|
1988
|
+
* is.true
|
1989
|
+
* Test if `value` is true.
|
1990
|
+
*
|
1991
|
+
* @param {Mixed} value value to test
|
1992
|
+
* @return {Boolean} true if `value` is true, false otherwise
|
1993
|
+
* @api public
|
1994
|
+
*/
|
1995
|
+
|
1996
|
+
is['true'] = function (value) {
|
1997
|
+
return is.bool(value) && Boolean(Number(value)) === true;
|
1998
|
+
};
|
1999
|
+
|
2000
|
+
/**
|
2001
|
+
* Test date.
|
2002
|
+
*/
|
2003
|
+
|
2004
|
+
/**
|
2005
|
+
* is.date
|
2006
|
+
* Test if `value` is a date.
|
2007
|
+
*
|
2008
|
+
* @param {Mixed} value value to test
|
2009
|
+
* @return {Boolean} true if `value` is a date, false otherwise
|
2010
|
+
* @api public
|
2011
|
+
*/
|
2012
|
+
|
2013
|
+
is.date = function (value) {
|
2014
|
+
return toStr.call(value) === '[object Date]';
|
2015
|
+
};
|
2016
|
+
|
2017
|
+
/**
|
2018
|
+
* Test element.
|
2019
|
+
*/
|
2020
|
+
|
2021
|
+
/**
|
2022
|
+
* is.element
|
2023
|
+
* Test if `value` is an html element.
|
2024
|
+
*
|
2025
|
+
* @param {Mixed} value value to test
|
2026
|
+
* @return {Boolean} true if `value` is an HTML Element, false otherwise
|
2027
|
+
* @api public
|
2028
|
+
*/
|
2029
|
+
|
2030
|
+
is.element = function (value) {
|
2031
|
+
return value !== undefined
|
2032
|
+
&& typeof HTMLElement !== 'undefined'
|
2033
|
+
&& value instanceof HTMLElement
|
2034
|
+
&& value.nodeType === 1;
|
2035
|
+
};
|
2036
|
+
|
2037
|
+
/**
|
2038
|
+
* Test error.
|
2039
|
+
*/
|
2040
|
+
|
2041
|
+
/**
|
2042
|
+
* is.error
|
2043
|
+
* Test if `value` is an error object.
|
2044
|
+
*
|
2045
|
+
* @param {Mixed} value value to test
|
2046
|
+
* @return {Boolean} true if `value` is an error object, false otherwise
|
2047
|
+
* @api public
|
2048
|
+
*/
|
2049
|
+
|
2050
|
+
is.error = function (value) {
|
2051
|
+
return toStr.call(value) === '[object Error]';
|
2052
|
+
};
|
2053
|
+
|
2054
|
+
/**
|
2055
|
+
* Test function.
|
2056
|
+
*/
|
2057
|
+
|
2058
|
+
/**
|
2059
|
+
* is.fn / is.function (deprecated)
|
2060
|
+
* Test if `value` is a function.
|
2061
|
+
*
|
2062
|
+
* @param {Mixed} value value to test
|
2063
|
+
* @return {Boolean} true if `value` is a function, false otherwise
|
2064
|
+
* @api public
|
2065
|
+
*/
|
2066
|
+
|
2067
|
+
is.fn = is['function'] = function (value) {
|
2068
|
+
var isAlert = typeof window !== 'undefined' && value === window.alert;
|
2069
|
+
return isAlert || toStr.call(value) === '[object Function]';
|
2070
|
+
};
|
2071
|
+
|
2072
|
+
/**
|
2073
|
+
* Test number.
|
2074
|
+
*/
|
2075
|
+
|
2076
|
+
/**
|
2077
|
+
* is.number
|
2078
|
+
* Test if `value` is a number.
|
2079
|
+
*
|
2080
|
+
* @param {Mixed} value value to test
|
2081
|
+
* @return {Boolean} true if `value` is a number, false otherwise
|
2082
|
+
* @api public
|
2083
|
+
*/
|
2084
|
+
|
2085
|
+
is.number = function (value) {
|
2086
|
+
return toStr.call(value) === '[object Number]';
|
2087
|
+
};
|
2088
|
+
|
2089
|
+
/**
|
2090
|
+
* is.infinite
|
2091
|
+
* Test if `value` is positive or negative infinity.
|
2092
|
+
*
|
2093
|
+
* @param {Mixed} value value to test
|
2094
|
+
* @return {Boolean} true if `value` is positive or negative Infinity, false otherwise
|
2095
|
+
* @api public
|
2096
|
+
*/
|
2097
|
+
is.infinite = function (value) {
|
2098
|
+
return value === Infinity || value === -Infinity;
|
2099
|
+
};
|
2100
|
+
|
2101
|
+
/**
|
2102
|
+
* is.decimal
|
2103
|
+
* Test if `value` is a decimal number.
|
2104
|
+
*
|
2105
|
+
* @param {Mixed} value value to test
|
2106
|
+
* @return {Boolean} true if `value` is a decimal number, false otherwise
|
2107
|
+
* @api public
|
2108
|
+
*/
|
2109
|
+
|
2110
|
+
is.decimal = function (value) {
|
2111
|
+
return is.number(value) && !isActualNaN(value) && !is.infinite(value) && value % 1 !== 0;
|
2112
|
+
};
|
2113
|
+
|
2114
|
+
/**
|
2115
|
+
* is.divisibleBy
|
2116
|
+
* Test if `value` is divisible by `n`.
|
2117
|
+
*
|
2118
|
+
* @param {Number} value value to test
|
2119
|
+
* @param {Number} n dividend
|
2120
|
+
* @return {Boolean} true if `value` is divisible by `n`, false otherwise
|
2121
|
+
* @api public
|
2122
|
+
*/
|
2123
|
+
|
2124
|
+
is.divisibleBy = function (value, n) {
|
2125
|
+
var isDividendInfinite = is.infinite(value);
|
2126
|
+
var isDivisorInfinite = is.infinite(n);
|
2127
|
+
var isNonZeroNumber = is.number(value) && !isActualNaN(value) && is.number(n) && !isActualNaN(n) && n !== 0;
|
2128
|
+
return isDividendInfinite || isDivisorInfinite || (isNonZeroNumber && value % n === 0);
|
2129
|
+
};
|
2130
|
+
|
2131
|
+
/**
|
2132
|
+
* is.integer
|
2133
|
+
* Test if `value` is an integer.
|
2134
|
+
*
|
2135
|
+
* @param value to test
|
2136
|
+
* @return {Boolean} true if `value` is an integer, false otherwise
|
2137
|
+
* @api public
|
2138
|
+
*/
|
2139
|
+
|
2140
|
+
is.integer = is['int'] = function (value) {
|
2141
|
+
return is.number(value) && !isActualNaN(value) && value % 1 === 0;
|
2142
|
+
};
|
2143
|
+
|
2144
|
+
/**
|
2145
|
+
* is.maximum
|
2146
|
+
* Test if `value` is greater than 'others' values.
|
2147
|
+
*
|
2148
|
+
* @param {Number} value value to test
|
2149
|
+
* @param {Array} others values to compare with
|
2150
|
+
* @return {Boolean} true if `value` is greater than `others` values
|
2151
|
+
* @api public
|
2152
|
+
*/
|
2153
|
+
|
2154
|
+
is.maximum = function (value, others) {
|
2155
|
+
if (isActualNaN(value)) {
|
2156
|
+
throw new TypeError('NaN is not a valid value');
|
2157
|
+
} else if (!is.arraylike(others)) {
|
2158
|
+
throw new TypeError('second argument must be array-like');
|
2159
|
+
}
|
2160
|
+
var len = others.length;
|
2161
|
+
|
2162
|
+
while (--len >= 0) {
|
2163
|
+
if (value < others[len]) {
|
2164
|
+
return false;
|
2165
|
+
}
|
2166
|
+
}
|
2167
|
+
|
2168
|
+
return true;
|
2169
|
+
};
|
2170
|
+
|
2171
|
+
/**
|
2172
|
+
* is.minimum
|
2173
|
+
* Test if `value` is less than `others` values.
|
2174
|
+
*
|
2175
|
+
* @param {Number} value value to test
|
2176
|
+
* @param {Array} others values to compare with
|
2177
|
+
* @return {Boolean} true if `value` is less than `others` values
|
2178
|
+
* @api public
|
2179
|
+
*/
|
2180
|
+
|
2181
|
+
is.minimum = function (value, others) {
|
2182
|
+
if (isActualNaN(value)) {
|
2183
|
+
throw new TypeError('NaN is not a valid value');
|
2184
|
+
} else if (!is.arraylike(others)) {
|
2185
|
+
throw new TypeError('second argument must be array-like');
|
2186
|
+
}
|
2187
|
+
var len = others.length;
|
2188
|
+
|
2189
|
+
while (--len >= 0) {
|
2190
|
+
if (value > others[len]) {
|
2191
|
+
return false;
|
2192
|
+
}
|
2193
|
+
}
|
2194
|
+
|
2195
|
+
return true;
|
2196
|
+
};
|
2197
|
+
|
2198
|
+
/**
|
2199
|
+
* is.nan
|
2200
|
+
* Test if `value` is not a number.
|
2201
|
+
*
|
2202
|
+
* @param {Mixed} value value to test
|
2203
|
+
* @return {Boolean} true if `value` is not a number, false otherwise
|
2204
|
+
* @api public
|
2205
|
+
*/
|
2206
|
+
|
2207
|
+
is.nan = function (value) {
|
2208
|
+
return !is.number(value) || value !== value;
|
2209
|
+
};
|
2210
|
+
|
2211
|
+
/**
|
2212
|
+
* is.even
|
2213
|
+
* Test if `value` is an even number.
|
2214
|
+
*
|
2215
|
+
* @param {Number} value value to test
|
2216
|
+
* @return {Boolean} true if `value` is an even number, false otherwise
|
2217
|
+
* @api public
|
2218
|
+
*/
|
2219
|
+
|
2220
|
+
is.even = function (value) {
|
2221
|
+
return is.infinite(value) || (is.number(value) && value === value && value % 2 === 0);
|
2222
|
+
};
|
2223
|
+
|
2224
|
+
/**
|
2225
|
+
* is.odd
|
2226
|
+
* Test if `value` is an odd number.
|
2227
|
+
*
|
2228
|
+
* @param {Number} value value to test
|
2229
|
+
* @return {Boolean} true if `value` is an odd number, false otherwise
|
2230
|
+
* @api public
|
2231
|
+
*/
|
2232
|
+
|
2233
|
+
is.odd = function (value) {
|
2234
|
+
return is.infinite(value) || (is.number(value) && value === value && value % 2 !== 0);
|
2235
|
+
};
|
2236
|
+
|
2237
|
+
/**
|
2238
|
+
* is.ge
|
2239
|
+
* Test if `value` is greater than or equal to `other`.
|
2240
|
+
*
|
2241
|
+
* @param {Number} value value to test
|
2242
|
+
* @param {Number} other value to compare with
|
2243
|
+
* @return {Boolean}
|
2244
|
+
* @api public
|
2245
|
+
*/
|
2246
|
+
|
2247
|
+
is.ge = function (value, other) {
|
2248
|
+
if (isActualNaN(value) || isActualNaN(other)) {
|
2249
|
+
throw new TypeError('NaN is not a valid value');
|
2250
|
+
}
|
2251
|
+
return !is.infinite(value) && !is.infinite(other) && value >= other;
|
2252
|
+
};
|
2253
|
+
|
2254
|
+
/**
|
2255
|
+
* is.gt
|
2256
|
+
* Test if `value` is greater than `other`.
|
2257
|
+
*
|
2258
|
+
* @param {Number} value value to test
|
2259
|
+
* @param {Number} other value to compare with
|
2260
|
+
* @return {Boolean}
|
2261
|
+
* @api public
|
2262
|
+
*/
|
2263
|
+
|
2264
|
+
is.gt = function (value, other) {
|
2265
|
+
if (isActualNaN(value) || isActualNaN(other)) {
|
2266
|
+
throw new TypeError('NaN is not a valid value');
|
2267
|
+
}
|
2268
|
+
return !is.infinite(value) && !is.infinite(other) && value > other;
|
2269
|
+
};
|
2270
|
+
|
2271
|
+
/**
|
2272
|
+
* is.le
|
2273
|
+
* Test if `value` is less than or equal to `other`.
|
2274
|
+
*
|
2275
|
+
* @param {Number} value value to test
|
2276
|
+
* @param {Number} other value to compare with
|
2277
|
+
* @return {Boolean} if 'value' is less than or equal to 'other'
|
2278
|
+
* @api public
|
2279
|
+
*/
|
2280
|
+
|
2281
|
+
is.le = function (value, other) {
|
2282
|
+
if (isActualNaN(value) || isActualNaN(other)) {
|
2283
|
+
throw new TypeError('NaN is not a valid value');
|
2284
|
+
}
|
2285
|
+
return !is.infinite(value) && !is.infinite(other) && value <= other;
|
2286
|
+
};
|
2287
|
+
|
2288
|
+
/**
|
2289
|
+
* is.lt
|
2290
|
+
* Test if `value` is less than `other`.
|
2291
|
+
*
|
2292
|
+
* @param {Number} value value to test
|
2293
|
+
* @param {Number} other value to compare with
|
2294
|
+
* @return {Boolean} if `value` is less than `other`
|
2295
|
+
* @api public
|
2296
|
+
*/
|
2297
|
+
|
2298
|
+
is.lt = function (value, other) {
|
2299
|
+
if (isActualNaN(value) || isActualNaN(other)) {
|
2300
|
+
throw new TypeError('NaN is not a valid value');
|
2301
|
+
}
|
2302
|
+
return !is.infinite(value) && !is.infinite(other) && value < other;
|
2303
|
+
};
|
2304
|
+
|
2305
|
+
/**
|
2306
|
+
* is.within
|
2307
|
+
* Test if `value` is within `start` and `finish`.
|
2308
|
+
*
|
2309
|
+
* @param {Number} value value to test
|
2310
|
+
* @param {Number} start lower bound
|
2311
|
+
* @param {Number} finish upper bound
|
2312
|
+
* @return {Boolean} true if 'value' is is within 'start' and 'finish'
|
2313
|
+
* @api public
|
2314
|
+
*/
|
2315
|
+
is.within = function (value, start, finish) {
|
2316
|
+
if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) {
|
2317
|
+
throw new TypeError('NaN is not a valid value');
|
2318
|
+
} else if (!is.number(value) || !is.number(start) || !is.number(finish)) {
|
2319
|
+
throw new TypeError('all arguments must be numbers');
|
2320
|
+
}
|
2321
|
+
var isAnyInfinite = is.infinite(value) || is.infinite(start) || is.infinite(finish);
|
2322
|
+
return isAnyInfinite || (value >= start && value <= finish);
|
2323
|
+
};
|
2324
|
+
|
2325
|
+
/**
|
2326
|
+
* Test object.
|
2327
|
+
*/
|
2328
|
+
|
2329
|
+
/**
|
2330
|
+
* is.object
|
2331
|
+
* Test if `value` is an object.
|
2332
|
+
*
|
2333
|
+
* @param {Mixed} value value to test
|
2334
|
+
* @return {Boolean} true if `value` is an object, false otherwise
|
2335
|
+
* @api public
|
2336
|
+
*/
|
2337
|
+
|
2338
|
+
is.object = function (value) {
|
2339
|
+
return toStr.call(value) === '[object Object]';
|
2340
|
+
};
|
2341
|
+
|
2342
|
+
/**
|
2343
|
+
* is.hash
|
2344
|
+
* Test if `value` is a hash - a plain object literal.
|
2345
|
+
*
|
2346
|
+
* @param {Mixed} value value to test
|
2347
|
+
* @return {Boolean} true if `value` is a hash, false otherwise
|
2348
|
+
* @api public
|
2349
|
+
*/
|
2350
|
+
|
2351
|
+
is.hash = function (value) {
|
2352
|
+
return is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;
|
2353
|
+
};
|
2354
|
+
|
2355
|
+
/**
|
2356
|
+
* Test regexp.
|
2357
|
+
*/
|
2358
|
+
|
2359
|
+
/**
|
2360
|
+
* is.regexp
|
2361
|
+
* Test if `value` is a regular expression.
|
2362
|
+
*
|
2363
|
+
* @param {Mixed} value value to test
|
2364
|
+
* @return {Boolean} true if `value` is a regexp, false otherwise
|
2365
|
+
* @api public
|
2366
|
+
*/
|
2367
|
+
|
2368
|
+
is.regexp = function (value) {
|
2369
|
+
return toStr.call(value) === '[object RegExp]';
|
2370
|
+
};
|
2371
|
+
|
2372
|
+
/**
|
2373
|
+
* Test string.
|
2374
|
+
*/
|
2375
|
+
|
2376
|
+
/**
|
2377
|
+
* is.string
|
2378
|
+
* Test if `value` is a string.
|
2379
|
+
*
|
2380
|
+
* @param {Mixed} value value to test
|
2381
|
+
* @return {Boolean} true if 'value' is a string, false otherwise
|
2382
|
+
* @api public
|
2383
|
+
*/
|
2384
|
+
|
2385
|
+
is.string = function (value) {
|
2386
|
+
return toStr.call(value) === '[object String]';
|
2387
|
+
};
|
2388
|
+
|
2389
|
+
/**
|
2390
|
+
* Test base64 string.
|
2391
|
+
*/
|
2392
|
+
|
2393
|
+
/**
|
2394
|
+
* is.base64
|
2395
|
+
* Test if `value` is a valid base64 encoded string.
|
2396
|
+
*
|
2397
|
+
* @param {Mixed} value value to test
|
2398
|
+
* @return {Boolean} true if 'value' is a base64 encoded string, false otherwise
|
2399
|
+
* @api public
|
2400
|
+
*/
|
2401
|
+
|
2402
|
+
is.base64 = function (value) {
|
2403
|
+
return is.string(value) && (!value.length || base64Regex.test(value));
|
2404
|
+
};
|
2405
|
+
|
2406
|
+
/**
|
2407
|
+
* Test base64 string.
|
2408
|
+
*/
|
2409
|
+
|
2410
|
+
/**
|
2411
|
+
* is.hex
|
2412
|
+
* Test if `value` is a valid hex encoded string.
|
2413
|
+
*
|
2414
|
+
* @param {Mixed} value value to test
|
2415
|
+
* @return {Boolean} true if 'value' is a hex encoded string, false otherwise
|
2416
|
+
* @api public
|
2417
|
+
*/
|
2418
|
+
|
2419
|
+
is.hex = function (value) {
|
2420
|
+
return is.string(value) && (!value.length || hexRegex.test(value));
|
2421
|
+
};
|
2422
|
+
|
2423
|
+
/**
|
2424
|
+
* is.symbol
|
2425
|
+
* Test if `value` is an ES6 Symbol
|
2426
|
+
*
|
2427
|
+
* @param {Mixed} value value to test
|
2428
|
+
* @return {Boolean} true if `value` is a Symbol, false otherise
|
2429
|
+
* @api public
|
2430
|
+
*/
|
2431
|
+
|
2432
|
+
is.symbol = function (value) {
|
2433
|
+
return typeof Symbol === 'function' && toStr.call(value) === '[object Symbol]' && typeof symbolValueOf.call(value) === 'symbol';
|
2434
|
+
};
|
2435
|
+
|
2436
|
+
|
2437
|
+
/***/ }
|
2438
|
+
/******/ ]);
|