@kiva/kv-shop 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index.js +11 -0
- package/dist/useBraintreeDropIn.js +1 -1
- package/dist/vendor/braintree-web-drop-in/constants.js +90 -0
- package/dist/vendor/braintree-web-drop-in/dropin-model.js +228 -0
- package/dist/vendor/braintree-web-drop-in/dropin.js +727 -0
- package/dist/vendor/braintree-web-drop-in/index.js +53 -0
- package/dist/vendor/braintree-web-drop-in/lib/add-selection-event-handler.js +14 -0
- package/dist/vendor/braintree-web-drop-in/lib/analytics.js +34 -0
- package/dist/vendor/braintree-web-drop-in/lib/assign.js +22 -0
- package/dist/vendor/braintree-web-drop-in/lib/browser-detection.js +15 -0
- package/dist/vendor/braintree-web-drop-in/lib/create-from-script-tag.js +74 -0
- package/dist/vendor/braintree-web-drop-in/lib/data-collector.js +38 -0
- package/dist/vendor/braintree-web-drop-in/lib/dropin-error.js +15 -0
- package/dist/vendor/braintree-web-drop-in/lib/find-parent-form.js +15 -0
- package/dist/vendor/braintree-web-drop-in/lib/is-guest-checkout.js +14 -0
- package/dist/vendor/braintree-web-drop-in/lib/is-https.js +15 -0
- package/dist/vendor/braintree-web-drop-in/lib/is-utf-8.js +10 -0
- package/dist/vendor/braintree-web-drop-in/lib/kebab-case-to-camel-case.js +15 -0
- package/dist/vendor/braintree-web-drop-in/lib/polyfill.js +26 -0
- package/dist/vendor/braintree-web-drop-in/lib/sanitize-html.js +9 -0
- package/dist/vendor/braintree-web-drop-in/lib/supports-flexbox.js +18 -0
- package/dist/vendor/braintree-web-drop-in/lib/three-d-secure.js +49 -0
- package/dist/vendor/braintree-web-drop-in/lib/transition-helper.js +26 -0
- package/dist/vendor/braintree-web-drop-in/lib/wait.js +16 -0
- package/dist/vendor/braintree-web-drop-in/translations/ar_EG.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/cs_CZ.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/da_DK.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/de_DE.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/el_GR.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/en_AU.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/en_GB.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/en_IN.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/en_US.js +84 -0
- package/dist/vendor/braintree-web-drop-in/translations/es_ES.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/es_XC.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/fi_FI.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/fr_CA.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/fr_FR.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/fr_XC.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/he_IL.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/hu_HU.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/id_ID.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/index.js +108 -0
- package/dist/vendor/braintree-web-drop-in/translations/it_IT.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/ja_JP.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/ko_KR.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/nl_NL.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/no_NO.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/pl_PL.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/pt_BR.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/pt_PT.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/ru_RU.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/sk_SK.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/sv_SE.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/th_TH.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/zh_CN.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/zh_HK.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/zh_TW.js +81 -0
- package/dist/vendor/braintree-web-drop-in/translations/zh_XC.js +81 -0
- package/dist/vendor/braintree-web-drop-in/views/base-view.js +29 -0
- package/dist/vendor/braintree-web-drop-in/views/delete-confirmation-view.js +44 -0
- package/dist/vendor/braintree-web-drop-in/views/main-view.js +152 -0
- package/dist/vendor/braintree-web-drop-in/views/payment-method-view.js +76 -0
- package/dist/vendor/braintree-web-drop-in/views/payment-methods-view.js +72 -0
- package/dist/vendor/braintree-web-drop-in/views/payment-options-view.js +61 -0
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/apple-pay-view.js +59 -0
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/base-paypal-view.js +79 -0
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/card-view.js +324 -0
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/google-pay-view.js +85 -0
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/index.js +17 -0
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/paypal-credit-view.js +20 -0
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/paypal-view.js +20 -0
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/venmo-view.js +50 -0
- package/package.json +2 -2
- package/dist/_virtual/_commonjs-dynamic-modules.js +0 -6
- package/dist/_virtual/dropin.js +0 -11
- package/dist/_virtual/dropin2.js +0 -4
- package/dist/vendor/braintree-web-drop-in/dist/browser/dropin.js +0 -12223
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { __require as k } from "../../lib/assign.js";
|
|
2
|
+
import { __require as V } from "../base-view.js";
|
|
3
|
+
import { __require as O } from "../../constants.js";
|
|
4
|
+
import { __require as q } from "../../lib/dropin-error.js";
|
|
5
|
+
import x from "braintree-web/hosted-fields";
|
|
6
|
+
import { __require as S } from "../../lib/is-utf-8.js";
|
|
7
|
+
import { __require as A } from "../../lib/transition-helper.js";
|
|
8
|
+
var p, b;
|
|
9
|
+
function j() {
|
|
10
|
+
if (b) return p;
|
|
11
|
+
b = 1;
|
|
12
|
+
var m = k().assign, v = V(), d = O(), g = q(), C = x, _ = S(), E = A(), I = `<div data-braintree-id="visa-card-icon" class="braintree-sheet__card-icon">
|
|
13
|
+
<svg width="40" height="24">
|
|
14
|
+
<use xlink:href="#icon-visa"></use>
|
|
15
|
+
</svg>
|
|
16
|
+
</div>
|
|
17
|
+
<div data-braintree-id="master-card-card-icon" class="braintree-sheet__card-icon">
|
|
18
|
+
<svg width="40" height="24">
|
|
19
|
+
<use xlink:href="#icon-master-card"></use>
|
|
20
|
+
</svg>
|
|
21
|
+
</div>
|
|
22
|
+
<div data-braintree-id="unionpay-card-icon" class="braintree-sheet__card-icon">
|
|
23
|
+
<svg width="40" height="24">
|
|
24
|
+
<use xlink:href="#icon-unionpay"></use>
|
|
25
|
+
</svg>
|
|
26
|
+
</div>
|
|
27
|
+
<div data-braintree-id="american-express-card-icon" class="braintree-sheet__card-icon">
|
|
28
|
+
<svg width="40" height="24">
|
|
29
|
+
<use xlink:href="#icon-american-express"></use>
|
|
30
|
+
</svg>
|
|
31
|
+
</div>
|
|
32
|
+
<div data-braintree-id="jcb-card-icon" class="braintree-sheet__card-icon">
|
|
33
|
+
<svg width="40" height="24">
|
|
34
|
+
<use xlink:href="#icon-jcb"></use>
|
|
35
|
+
</svg>
|
|
36
|
+
</div>
|
|
37
|
+
<!--Elo, Hiper, and Hipercard currently use the generic icon.
|
|
38
|
+
The braintree-hidden class should be removed here once we get icons for these cards-->
|
|
39
|
+
<div data-braintree-id="elo-card-icon" class="braintree-sheet__card-icon braintree-hidden">
|
|
40
|
+
<svg width="40" height="24">
|
|
41
|
+
<use xlink:href="#icon-elo"></use>
|
|
42
|
+
</svg>
|
|
43
|
+
</div>
|
|
44
|
+
<div data-braintree-id="hiper-card-icon" class="braintree-sheet__card-icon braintree-hidden">
|
|
45
|
+
<svg width="40" height="24">
|
|
46
|
+
<use xlink:href="#icon-hiper"></use>
|
|
47
|
+
</svg>
|
|
48
|
+
</div>
|
|
49
|
+
<div data-braintree-id="hipercard-card-icon" class="braintree-sheet__card-icon braintree-hidden">
|
|
50
|
+
<svg width="40" height="24">
|
|
51
|
+
<use xlink:href="#icon-hipercard"></use>
|
|
52
|
+
</svg>
|
|
53
|
+
</div>
|
|
54
|
+
<!-- Remove braintree-hidden class when supportedCardType accurately indicates Diners Club support -->
|
|
55
|
+
<div data-braintree-id="diners-club-card-icon" class="braintree-sheet__card-icon braintree-hidden">
|
|
56
|
+
<svg width="40" height="24">
|
|
57
|
+
<use xlink:href="#icon-diners-club"></use>
|
|
58
|
+
</svg>
|
|
59
|
+
</div>
|
|
60
|
+
<div data-braintree-id="discover-card-icon" class="braintree-sheet__card-icon">
|
|
61
|
+
<svg width="40" height="24">
|
|
62
|
+
<use xlink:href="#icon-discover"></use>
|
|
63
|
+
</svg>
|
|
64
|
+
</div>
|
|
65
|
+
<div data-braintree-id="maestro-card-icon" class="braintree-sheet__card-icon">
|
|
66
|
+
<svg width="40" height="24">
|
|
67
|
+
<use xlink:href="#icon-maestro"></use>
|
|
68
|
+
</svg>
|
|
69
|
+
</div>
|
|
70
|
+
`, F = [
|
|
71
|
+
"empty",
|
|
72
|
+
// TODO should intercept this event and call tokenize
|
|
73
|
+
"inputSubmitRequest",
|
|
74
|
+
"binAvailable"
|
|
75
|
+
], l = [
|
|
76
|
+
"number",
|
|
77
|
+
"expirationDate",
|
|
78
|
+
"cvv",
|
|
79
|
+
"postalCode",
|
|
80
|
+
"cardholderName"
|
|
81
|
+
];
|
|
82
|
+
function a() {
|
|
83
|
+
v.apply(this, arguments);
|
|
84
|
+
}
|
|
85
|
+
a.prototype = Object.create(v.prototype), a.prototype.constructor = a, a.ID = a.prototype.ID = d.paymentOptionIDs.card, a.prototype.initialize = function() {
|
|
86
|
+
var e, t, r, s = this.getElementById("cardholder-name-field-group");
|
|
87
|
+
return this.model.merchantConfiguration.card && this.model.merchantConfiguration.card !== !0 ? this.merchantConfiguration = this.model.merchantConfiguration.card : this.merchantConfiguration = {}, this.merchantConfiguration.vault = this.merchantConfiguration.vault || {}, this.hasCardholderName = !!this.merchantConfiguration.cardholderName, this.cardholderNameRequired = this.hasCardholderName && this.merchantConfiguration.cardholderName.required === !0, r = this._generateHostedFieldsOptions(), this._renderCardIcons(), this._hideUnsupportedCardIcons(), this.hasCVV = r.fields.cvv, this.saveCardInput = this.getElementById("save-card-input"), this.cardNumberIcon = this.getElementById("card-number-icon"), this.cardNumberIconSvg = this.getElementById("card-number-icon-svg"), this.cvvIcon = this.getElementById("cvv-icon"), this.cvvIconSvg = this.getElementById("cvv-icon-svg"), this.cvvLabelDescriptor = this.getElementById("cvv-label-descriptor"), this.fieldErrors = {}, this.hasCardholderName || (s.parentNode.removeChild(s), l = l.filter(function(i) {
|
|
88
|
+
return i !== "cardholderName";
|
|
89
|
+
})), this.hasCVV || (e = this.getElementById("cvv-field-group"), e.parentNode.removeChild(e), l = l.filter(function(i) {
|
|
90
|
+
return i !== "cvv";
|
|
91
|
+
})), r.fields.postalCode || (t = this.getElementById("postal-code-field-group"), t.parentNode.removeChild(t), l = l.filter(function(i) {
|
|
92
|
+
return i !== "postalCode";
|
|
93
|
+
})), !this.model.isGuestCheckout && this.merchantConfiguration.vault.allowVaultCardOverride === !0 && this.getElementById("save-card-field-group").classList.remove("braintree-hidden"), this.merchantConfiguration.vault.vaultCard === !1 && (this.saveCardInput.checked = !1), C.create(r).then((function(i) {
|
|
94
|
+
this.hostedFieldsInstance = i, this.hostedFieldsInstance.on("blur", this._onBlurEvent.bind(this)), this.hostedFieldsInstance.on("cardTypeChange", this._onCardTypeChangeEvent.bind(this)), this.hostedFieldsInstance.on("focus", this._onFocusEvent.bind(this)), this.hostedFieldsInstance.on("notEmpty", this._onNotEmptyEvent.bind(this)), this.hostedFieldsInstance.on("validityChange", this._onValidityChangeEvent.bind(this)), l.forEach((function(n) {
|
|
95
|
+
this.hostedFieldsInstance.setAttribute({
|
|
96
|
+
field: n,
|
|
97
|
+
attribute: "aria-required",
|
|
98
|
+
value: !0
|
|
99
|
+
});
|
|
100
|
+
}).bind(this)), F.forEach((function(n) {
|
|
101
|
+
this.hostedFieldsInstance.on(n, (function(o) {
|
|
102
|
+
this.model._emit("card:" + n, o);
|
|
103
|
+
}).bind(this));
|
|
104
|
+
}).bind(this)), this.model.asyncDependencyReady(a.ID);
|
|
105
|
+
}).bind(this)).catch((function(i) {
|
|
106
|
+
this.model.asyncDependencyFailed({
|
|
107
|
+
view: this.ID,
|
|
108
|
+
error: i
|
|
109
|
+
});
|
|
110
|
+
}).bind(this));
|
|
111
|
+
}, a.prototype._sendRequestableEvent = function() {
|
|
112
|
+
this._isTokenizing || this.model.setPaymentMethodRequestable({
|
|
113
|
+
isRequestable: this._validateForm(),
|
|
114
|
+
type: d.paymentMethodTypes.card
|
|
115
|
+
});
|
|
116
|
+
}, a.prototype._renderCardIcons = function() {
|
|
117
|
+
var e = this.merchantConfiguration.overrides, t = this.getElementById("card-view-icons"), r = e && e.fields && e.fields.number && e.fields.number.supportedCardBrands;
|
|
118
|
+
t.innerHTML = I, r && Object.keys(r).forEach(function(s) {
|
|
119
|
+
var i = r[s], n, o;
|
|
120
|
+
i === !1 && (n = 'div[data-braintree-id="' + d.cardTypeIcons[s] + '-card-icon"]', o = document.querySelector(n), T(o));
|
|
121
|
+
});
|
|
122
|
+
}, a.prototype._generateHostedFieldsOptions = function() {
|
|
123
|
+
var e = this.client.getConfiguration().gatewayConfiguration.challenges, t = e.indexOf("cvv") !== -1, r = e.indexOf("postal_code") !== -1, s = this.merchantConfiguration.overrides, i = {
|
|
124
|
+
client: this.client,
|
|
125
|
+
fields: {
|
|
126
|
+
cardholderName: {
|
|
127
|
+
container: this._getFieldContainer("cardholder-name"),
|
|
128
|
+
placeholder: this.strings.cardholderNamePlaceholder
|
|
129
|
+
},
|
|
130
|
+
number: {
|
|
131
|
+
container: this._getFieldContainer("number"),
|
|
132
|
+
placeholder: N()
|
|
133
|
+
},
|
|
134
|
+
expirationDate: {
|
|
135
|
+
container: this._getFieldContainer("expiration"),
|
|
136
|
+
placeholder: this.strings.expirationDatePlaceholder
|
|
137
|
+
},
|
|
138
|
+
cvv: {
|
|
139
|
+
container: this._getFieldContainer("cvv"),
|
|
140
|
+
placeholder: f(3)
|
|
141
|
+
},
|
|
142
|
+
postalCode: {
|
|
143
|
+
container: this._getFieldContainer("postal-code")
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
styles: {
|
|
147
|
+
input: {
|
|
148
|
+
"font-size": "16px",
|
|
149
|
+
"font-family": '-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
|
|
150
|
+
color: "#000"
|
|
151
|
+
},
|
|
152
|
+
":focus": {
|
|
153
|
+
color: "black"
|
|
154
|
+
},
|
|
155
|
+
"::-webkit-input-placeholder": {
|
|
156
|
+
color: "#6a6a6a"
|
|
157
|
+
},
|
|
158
|
+
":-moz-placeholder": {
|
|
159
|
+
color: "#6a6a6a"
|
|
160
|
+
},
|
|
161
|
+
"::-moz-placeholder": {
|
|
162
|
+
color: "#6a6a6a"
|
|
163
|
+
},
|
|
164
|
+
":-ms-input-placeholder ": {
|
|
165
|
+
color: "#6a6a6a"
|
|
166
|
+
},
|
|
167
|
+
"input::-ms-clear": {
|
|
168
|
+
color: "transparent"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
return this.hasCardholderName || delete i.fields.cardholderName, t || delete i.fields.cvv, r || delete i.fields.postalCode, s && (s.fields && (s.fields.cvv && typeof s.fields.cvv.placeholder < "u" && (this._hasCustomCVVPlaceholder = !0), Object.keys(s.fields).forEach(function(n) {
|
|
173
|
+
if ((n === "cvv" || n === "postalCode") && s.fields[n] === null) {
|
|
174
|
+
delete i.fields[n];
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
i.fields[n] && m(i.fields[n], s.fields[n], {
|
|
178
|
+
selector: i.fields[n].selector
|
|
179
|
+
});
|
|
180
|
+
})), s.styles && Object.keys(s.styles).forEach(function(n) {
|
|
181
|
+
if (s.styles[n] === null) {
|
|
182
|
+
delete i.styles[n];
|
|
183
|
+
return;
|
|
184
|
+
} else if (typeof s.styles[n] == "string") {
|
|
185
|
+
i.styles[n] = s.styles[n];
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
w(s.styles[n]), i.styles[n] = i.styles[n] || {}, m(i.styles[n], s.styles[n]);
|
|
189
|
+
})), i;
|
|
190
|
+
}, a.prototype._validateForm = function(e) {
|
|
191
|
+
var t, r, s, i, n = !0, o = this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes;
|
|
192
|
+
return this.hostedFieldsInstance ? (i = this.hostedFieldsInstance.getState(), Object.keys(i.fields).forEach((function(h) {
|
|
193
|
+
var y = i.fields[h];
|
|
194
|
+
!e && !n || (y.isEmpty ? !this.cardholderNameRequired && h === "cardholderName" ? n = !0 : (n = !1, e && this.showFieldError(h, this.strings["fieldEmptyFor" + u(h)])) : y.isValid || (n = !1, e && this.showFieldError(h, this.strings["fieldInvalidFor" + u(h)])));
|
|
195
|
+
}).bind(this)), i.fields.number.isValid && (t = i.cards[0], r = t && d.configurationCardTypes[t.type], s = r && o.indexOf(r) !== -1, s || (n = !1, e && this.showFieldError("number", this.strings.unsupportedCardTypeError))), n) : !1;
|
|
196
|
+
}, a.prototype.getPaymentMethod = function() {
|
|
197
|
+
var e = this._validateForm();
|
|
198
|
+
if (e)
|
|
199
|
+
return {
|
|
200
|
+
type: d.paymentMethodTypes.card
|
|
201
|
+
};
|
|
202
|
+
}, a.prototype.tokenize = function() {
|
|
203
|
+
var e, t = this, r = t.hostedFieldsInstance.getState(), s = {
|
|
204
|
+
vault: this._shouldVault()
|
|
205
|
+
};
|
|
206
|
+
return this.model.clearError(), this._validateForm(!0) ? (!this.cardholderNameRequired && r.fields.cardholderName && r.fields.cardholderName.isEmpty && (s.fieldsToTokenize = Object.keys(r.fields).filter(function(i) {
|
|
207
|
+
return i !== "cardholderName";
|
|
208
|
+
})), t._isTokenizing = !0, t.hostedFieldsInstance.tokenize(s).then(function(i) {
|
|
209
|
+
var n = t.merchantConfiguration.clearFieldsAfterTokenization === !1;
|
|
210
|
+
return n || Object.keys(r.fields).forEach(function(o) {
|
|
211
|
+
t.hostedFieldsInstance.clear(o);
|
|
212
|
+
}), t._shouldVault() && (i.vaulted = !0), new Promise(function(o) {
|
|
213
|
+
e = function() {
|
|
214
|
+
setTimeout(function() {
|
|
215
|
+
t.model.addPaymentMethod(i), o(i), t.element.classList.remove("braintree-sheet--tokenized");
|
|
216
|
+
}, 0);
|
|
217
|
+
}, E.onTransitionEnd(t.element, "max-height", e), setTimeout(function() {
|
|
218
|
+
t.allowUserAction(), t._isTokenizing = !1;
|
|
219
|
+
}, d.CHANGE_ACTIVE_PAYMENT_METHOD_TIMEOUT), t.element.classList.add("braintree-sheet--tokenized");
|
|
220
|
+
});
|
|
221
|
+
}).catch(function(i) {
|
|
222
|
+
return t._isTokenizing = !1, t.model.reportError(i), t.allowUserAction(), Promise.reject(new g({
|
|
223
|
+
message: d.errors.NO_PAYMENT_METHOD_ERROR,
|
|
224
|
+
braintreeWebError: i
|
|
225
|
+
}));
|
|
226
|
+
})) : (t.model.reportError("hostedFieldsFieldsInvalidError"), t.allowUserAction(), Promise.reject(new g(d.errors.NO_PAYMENT_METHOD_ERROR)));
|
|
227
|
+
}, a.prototype.showFieldError = function(e, t) {
|
|
228
|
+
var r, s = this.getElementById(c(e) + "-field-group"), i = s.querySelector("input");
|
|
229
|
+
this.fieldErrors.hasOwnProperty(e) || (this.fieldErrors[e] = this.getElementById(c(e) + "-field-error")), s.classList.add("braintree-form__field-group--has-error"), r = this.fieldErrors[e], r.innerHTML = t, i ? i.setAttribute("aria-invalid", !0) : (this.hostedFieldsInstance.setAttribute({
|
|
230
|
+
field: e,
|
|
231
|
+
attribute: "aria-invalid",
|
|
232
|
+
value: !0
|
|
233
|
+
}), this.hostedFieldsInstance.setMessage({
|
|
234
|
+
field: e,
|
|
235
|
+
message: t
|
|
236
|
+
}));
|
|
237
|
+
}, a.prototype.hideFieldError = function(e) {
|
|
238
|
+
var t = this.getElementById(c(e) + "-field-group"), r = t.querySelector("input");
|
|
239
|
+
this.fieldErrors.hasOwnProperty(e) || (this.fieldErrors[e] = this.getElementById(c(e) + "-field-error")), t.classList.remove("braintree-form__field-group--has-error"), r ? r.removeAttribute("aria-invalid") : (this.hostedFieldsInstance.removeAttribute({
|
|
240
|
+
field: e,
|
|
241
|
+
attribute: "aria-invalid"
|
|
242
|
+
}), this.hostedFieldsInstance.setMessage({
|
|
243
|
+
field: e,
|
|
244
|
+
message: ""
|
|
245
|
+
}));
|
|
246
|
+
}, a.prototype.teardown = function() {
|
|
247
|
+
return this.hostedFieldsInstance.teardown();
|
|
248
|
+
}, a.prototype._shouldVault = function() {
|
|
249
|
+
return !this.model.isGuestCheckout && this.saveCardInput.checked;
|
|
250
|
+
}, a.prototype._getFieldContainer = function(e) {
|
|
251
|
+
return e === "expiration" && (e = "expiration-date"), this.getElementById(e + "-field-group").querySelector(".braintree-form__hosted-field");
|
|
252
|
+
}, a.prototype._onBlurEvent = function(e) {
|
|
253
|
+
var t = e.fields[e.emittedBy], r = this.getElementById(c(e.emittedBy) + "-field-group");
|
|
254
|
+
r.classList.remove("braintree-form__field-group--is-focused"), t.isPotentiallyValid && this.hideFieldError(e.emittedBy), this._shouldApplyFieldEmptyError(e.emittedBy, t) ? this.showFieldError(e.emittedBy, this.strings["fieldEmptyFor" + u(e.emittedBy)]) : !t.isEmpty && !t.isValid ? this.showFieldError(e.emittedBy, this.strings["fieldInvalidFor" + u(e.emittedBy)]) : e.emittedBy === "number" && !this._isCardTypeSupported(e.cards[0]) && this.showFieldError("number", this.strings.unsupportedCardTypeError), this.model._emit("card:blur", e), setTimeout((function() {
|
|
255
|
+
this._shouldApplyFieldEmptyError(e.emittedBy, t) && this.showFieldError(e.emittedBy, this.strings["fieldEmptyFor" + u(e.emittedBy)]);
|
|
256
|
+
}).bind(this), 150);
|
|
257
|
+
}, a.prototype._onCardTypeChangeEvent = function(e) {
|
|
258
|
+
var t, r = "#iconCardFront", s = "#iconCVVBack", i = this.strings.cvvThreeDigitLabelSubheading, n = f(3), o = this.getElementById("number-field-group");
|
|
259
|
+
e.cards.length === 1 ? (t = e.cards[0].type, r = "#icon-" + t, t === "american-express" && (s = "#iconCVVFront", i = this.strings.cvvFourDigitLabelSubheading, n = f(4)), o.classList.add("braintree-form__field-group--card-type-known")) : o.classList.remove("braintree-form__field-group--card-type-known"), e.emittedBy === "number" && this._isCardTypeSupported(e.cards[0]) && this.hideFieldError(e.emittedBy), this.cardNumberIconSvg.setAttribute("xlink:href", r), this.hasCVV && (this.cvvIconSvg.setAttribute("xlink:href", s), this.cvvLabelDescriptor.innerHTML = i, this._hasCustomCVVPlaceholder || this.hostedFieldsInstance.setAttribute({
|
|
260
|
+
field: "cvv",
|
|
261
|
+
attribute: "placeholder",
|
|
262
|
+
value: n
|
|
263
|
+
})), this.model._emit("card:cardTypeChange", e);
|
|
264
|
+
}, a.prototype._onFocusEvent = function(e) {
|
|
265
|
+
var t = this.getElementById(c(e.emittedBy) + "-field-group");
|
|
266
|
+
t.classList.add("braintree-form__field-group--is-focused"), this.model._emit("card:focus", e);
|
|
267
|
+
}, a.prototype._onNotEmptyEvent = function(e) {
|
|
268
|
+
this.hideFieldError(e.emittedBy), this.model._emit("card:notEmpty", e);
|
|
269
|
+
}, a.prototype._onValidityChangeEvent = function(e) {
|
|
270
|
+
var t, r = e.fields[e.emittedBy];
|
|
271
|
+
e.emittedBy === "number" && e.cards[0] ? t = r.isValid && this._isCardTypeSupported(e.cards[0]) : t = r.isValid, r.container.classList.toggle("braintree-form__field--valid", t), r.isPotentiallyValid && this.hideFieldError(e.emittedBy), this._sendRequestableEvent(), this.model._emit("card:validityChange", e);
|
|
272
|
+
}, a.prototype.requestPaymentMethod = function() {
|
|
273
|
+
return this.preventUserAction(), this.tokenize();
|
|
274
|
+
}, a.prototype.onSelection = function() {
|
|
275
|
+
this.hostedFieldsInstance && (setTimeout((function() {
|
|
276
|
+
this.hasCardholderName ? this.hostedFieldsInstance.focus("cardholderName") : this.hostedFieldsInstance.focus("number");
|
|
277
|
+
}).bind(this), 50), this._sendRequestableEvent());
|
|
278
|
+
}, a.prototype._hideUnsupportedCardIcons = function() {
|
|
279
|
+
var e = this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes;
|
|
280
|
+
Object.keys(d.configurationCardTypes).forEach((function(t) {
|
|
281
|
+
var r, s = d.configurationCardTypes[t];
|
|
282
|
+
e.indexOf(s) === -1 && (r = this.getElementById(t + "-card-icon"), r.classList.add("braintree-hidden"));
|
|
283
|
+
}).bind(this));
|
|
284
|
+
}, a.prototype._isCardTypeSupported = function(e) {
|
|
285
|
+
var t = e && e.type, r = d.configurationCardTypes[t], s = this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes;
|
|
286
|
+
return s.indexOf(r) !== -1;
|
|
287
|
+
}, a.isEnabled = function(e) {
|
|
288
|
+
var t = e.client.getConfiguration().gatewayConfiguration, r = e.merchantConfiguration.card === !1;
|
|
289
|
+
return Promise.resolve(!r && t.creditCards.supportedCardTypes.length > 0);
|
|
290
|
+
}, a.prototype._shouldApplyFieldEmptyError = function(e, t) {
|
|
291
|
+
return !t.isEmpty || e === "cardholderName" && !this.cardholderNameRequired ? !1 : B();
|
|
292
|
+
};
|
|
293
|
+
function T(e) {
|
|
294
|
+
e && e.classList.add("braintree-hidden");
|
|
295
|
+
}
|
|
296
|
+
function B() {
|
|
297
|
+
var e = document.activeElement && document.activeElement.id, t = document.activeElement instanceof HTMLIFrameElement && e.indexOf("braintree-hosted-field") !== -1, r = document.activeElement && document.activeElement.parentElement.className === "braintree-form__notice-of-collection";
|
|
298
|
+
return r ? !0 : t;
|
|
299
|
+
}
|
|
300
|
+
function c(e) {
|
|
301
|
+
return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
302
|
+
}
|
|
303
|
+
function u(e) {
|
|
304
|
+
return e[0].toUpperCase() + e.substr(1);
|
|
305
|
+
}
|
|
306
|
+
function w(e) {
|
|
307
|
+
Object.keys(e).forEach(function(t) {
|
|
308
|
+
var r = c(t);
|
|
309
|
+
e[r] = e[t];
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function f(e) {
|
|
313
|
+
var t = _() ? "•" : "*";
|
|
314
|
+
return Array(e + 1).join(t);
|
|
315
|
+
}
|
|
316
|
+
function N() {
|
|
317
|
+
var e = f(4);
|
|
318
|
+
return [e, e, e, e].join(" ");
|
|
319
|
+
}
|
|
320
|
+
return p = a, p;
|
|
321
|
+
}
|
|
322
|
+
export {
|
|
323
|
+
j as __require
|
|
324
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { commonjsGlobal as i } from "../../../../_virtual/_commonjsHelpers.js";
|
|
2
|
+
import { __require as P } from "../../lib/assign.js";
|
|
3
|
+
import { __require as C } from "../base-view.js";
|
|
4
|
+
import v from "braintree-web/google-payment";
|
|
5
|
+
import { __require as h } from "../../lib/dropin-error.js";
|
|
6
|
+
import { __require as D } from "../../constants.js";
|
|
7
|
+
import E from "@braintree/asset-loader";
|
|
8
|
+
import { __require as _ } from "../../lib/analytics.js";
|
|
9
|
+
var l, p;
|
|
10
|
+
function G() {
|
|
11
|
+
if (p) return l;
|
|
12
|
+
p = 1;
|
|
13
|
+
var s = P().assign, u = C(), m = v, f = h(), g = D(), d = E, y = _();
|
|
14
|
+
function t() {
|
|
15
|
+
u.apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
t.prototype = Object.create(u.prototype), t.prototype.constructor = t, t.ID = t.prototype.ID = g.paymentOptionIDs.googlePay, t.prototype.initialize = function() {
|
|
18
|
+
var e = this, a, r, o;
|
|
19
|
+
return e.googlePayConfiguration = s({}, e.model.merchantConfiguration.googlePay), r = e.googlePayConfiguration.googlePayVersion, o = e.googlePayConfiguration.merchantId, a = s({
|
|
20
|
+
buttonType: "short"
|
|
21
|
+
}, e.googlePayConfiguration.button, {
|
|
22
|
+
onClick: function(n) {
|
|
23
|
+
n.preventDefault(), e.preventUserAction(), e.tokenize().then(function() {
|
|
24
|
+
e.allowUserAction();
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}), delete e.googlePayConfiguration.googlePayVersion, delete e.googlePayConfiguration.merchantId, delete e.googlePayConfiguration.button, m.create({
|
|
28
|
+
client: e.client,
|
|
29
|
+
googlePayVersion: r,
|
|
30
|
+
googleMerchantId: o
|
|
31
|
+
}).then(function(n) {
|
|
32
|
+
e.googlePayInstance = n, e.paymentsClient = c(e.client);
|
|
33
|
+
}).then(function() {
|
|
34
|
+
var n = e.getElementById("google-pay-button");
|
|
35
|
+
n.appendChild(e.paymentsClient.createButton(a)), e.model.asyncDependencyReady(t.ID);
|
|
36
|
+
}).catch(function(n) {
|
|
37
|
+
e.model.asyncDependencyFailed({
|
|
38
|
+
view: e.ID,
|
|
39
|
+
error: new f(n)
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}, t.prototype.tokenize = function() {
|
|
43
|
+
var e = this, a = e.googlePayInstance.createPaymentDataRequest(e.googlePayConfiguration), r;
|
|
44
|
+
return e.paymentsClient.loadPaymentData(a).then(function(o) {
|
|
45
|
+
return r = o, e.googlePayInstance.parseResponse(o);
|
|
46
|
+
}).then(function(o) {
|
|
47
|
+
o.rawPaymentData = r, e.model.addPaymentMethod(o);
|
|
48
|
+
}).catch(function(o) {
|
|
49
|
+
var n = o;
|
|
50
|
+
if (o.statusCode === "DEVELOPER_ERROR")
|
|
51
|
+
console.error(o), n = "developerError";
|
|
52
|
+
else if (o.statusCode === "CANCELED") {
|
|
53
|
+
y.sendEvent(e.client, "googlepay.loadPaymentData.canceled");
|
|
54
|
+
return;
|
|
55
|
+
} else o.statusCode && y.sendEvent(e.client, "googlepay.loadPaymentData.failed");
|
|
56
|
+
e.model.reportError(n);
|
|
57
|
+
});
|
|
58
|
+
}, t.prototype.updateConfiguration = function(e, a) {
|
|
59
|
+
this.googlePayConfiguration[e] = a;
|
|
60
|
+
}, t.isEnabled = function(e) {
|
|
61
|
+
var a = e.client.getConfiguration().gatewayConfiguration;
|
|
62
|
+
return a.androidPay && e.merchantConfiguration.googlePay ? Promise.resolve().then(function() {
|
|
63
|
+
return i.google && i.google.payments && i.google.payments.api && i.google.payments.api.PaymentsClient ? Promise.resolve() : d.loadScript({
|
|
64
|
+
id: g.GOOGLE_PAYMENT_SCRIPT_ID,
|
|
65
|
+
src: g.GOOGLE_PAYMENT_SOURCE
|
|
66
|
+
});
|
|
67
|
+
}).then(function() {
|
|
68
|
+
var r = c(e.client);
|
|
69
|
+
return r.isReadyToPay({
|
|
70
|
+
allowedPaymentMethods: ["CARD", "TOKENIZED_CARD"]
|
|
71
|
+
});
|
|
72
|
+
}).then(function(r) {
|
|
73
|
+
return !!r.result;
|
|
74
|
+
}) : Promise.resolve(!1);
|
|
75
|
+
};
|
|
76
|
+
function c(e) {
|
|
77
|
+
return new i.google.payments.api.PaymentsClient({
|
|
78
|
+
environment: e.getConfiguration().gatewayConfiguration.environment === "production" ? "PRODUCTION" : "TEST"
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return l = t, l;
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
G as __require
|
|
85
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __require as t } from "../../constants.js";
|
|
2
|
+
import { __require as o } from "./apple-pay-view.js";
|
|
3
|
+
import { __require as p } from "./card-view.js";
|
|
4
|
+
import { __require as m } from "./google-pay-view.js";
|
|
5
|
+
import { __require as u } from "./paypal-view.js";
|
|
6
|
+
import { __require as q } from "./paypal-credit-view.js";
|
|
7
|
+
import { __require as s } from "./venmo-view.js";
|
|
8
|
+
var i, a;
|
|
9
|
+
function P() {
|
|
10
|
+
if (a) return i;
|
|
11
|
+
a = 1;
|
|
12
|
+
var r = t().paymentOptionIDs, e = {};
|
|
13
|
+
return e[r.applePay] = o(), e[r.card] = p(), e[r.googlePay] = m(), e[r.paypal] = u(), e[r.paypalCredit] = q(), e[r.venmo] = s(), i = e, i;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
P as __require
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __require as n } from "../../lib/assign.js";
|
|
2
|
+
import { __require as o } from "../../constants.js";
|
|
3
|
+
import { __require as u } from "./base-paypal-view.js";
|
|
4
|
+
var a, t;
|
|
5
|
+
function d() {
|
|
6
|
+
if (t) return a;
|
|
7
|
+
t = 1;
|
|
8
|
+
var p = n().assign, s = o().paymentOptionIDs, r = u();
|
|
9
|
+
function e() {
|
|
10
|
+
r.apply(this, arguments), this._isPayPalCredit = !0;
|
|
11
|
+
}
|
|
12
|
+
return e.prototype = Object.create(r.prototype), e.prototype.constructor = e, e.ID = e.prototype.ID = s.paypalCredit, e.isEnabled = function(i) {
|
|
13
|
+
return i.merchantConfiguration.paypalCredit ? r.isEnabled(p({
|
|
14
|
+
viewID: e.ID
|
|
15
|
+
}, i)) : Promise.resolve(!1);
|
|
16
|
+
}, a = e, a;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
d as __require
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __require as o } from "../../lib/assign.js";
|
|
2
|
+
import { __require as s } from "../../constants.js";
|
|
3
|
+
import { __require as u } from "./base-paypal-view.js";
|
|
4
|
+
var a, t;
|
|
5
|
+
function f() {
|
|
6
|
+
if (t) return a;
|
|
7
|
+
t = 1;
|
|
8
|
+
var p = o().assign, n = s().paymentOptionIDs, r = u();
|
|
9
|
+
function e() {
|
|
10
|
+
r.apply(this, arguments);
|
|
11
|
+
}
|
|
12
|
+
return e.prototype = Object.create(r.prototype), e.prototype.constructor = e, e.ID = e.prototype.ID = n.paypal, e.isEnabled = function(i) {
|
|
13
|
+
return i.merchantConfiguration.paypal ? r.isEnabled(p({
|
|
14
|
+
viewID: e.ID
|
|
15
|
+
}, i)) : Promise.resolve(!1);
|
|
16
|
+
}, a = e, a;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
f as __require
|
|
20
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __require as l } from "../../lib/assign.js";
|
|
2
|
+
import { __require as v } from "../base-view.js";
|
|
3
|
+
import d from "braintree-web/venmo";
|
|
4
|
+
import { __require as h } from "../../lib/dropin-error.js";
|
|
5
|
+
import { __require as y } from "../../constants.js";
|
|
6
|
+
var u, c;
|
|
7
|
+
function D() {
|
|
8
|
+
if (c) return u;
|
|
9
|
+
c = 1;
|
|
10
|
+
var p = l().assign, i = v(), s = d, f = h(), m = y().paymentOptionIDs;
|
|
11
|
+
function r() {
|
|
12
|
+
i.apply(this, arguments);
|
|
13
|
+
}
|
|
14
|
+
return r.prototype = Object.create(i.prototype), r.prototype.constructor = r, r.ID = r.prototype.ID = m.venmo, r.prototype.initialize = function() {
|
|
15
|
+
var e = this, a = p({}, e.model.merchantConfiguration.venmo, { client: this.client });
|
|
16
|
+
return s.create(a).then(function(n) {
|
|
17
|
+
return e.venmoInstance = n, e.venmoInstance.hasTokenizationResult() ? e.venmoInstance.tokenize().then(function(t) {
|
|
18
|
+
e.model.reportAppSwitchPayload(t);
|
|
19
|
+
}).catch(function(t) {
|
|
20
|
+
e._isIgnorableError(t) || e.model.reportAppSwitchError(m.venmo, t);
|
|
21
|
+
}) : Promise.resolve();
|
|
22
|
+
}).then(function() {
|
|
23
|
+
var n = e.getElementById("venmo-button");
|
|
24
|
+
n.addEventListener("click", function(t) {
|
|
25
|
+
return t.preventDefault(), e.preventUserAction(), e.venmoInstance.tokenize().then(function(o) {
|
|
26
|
+
e.model.addPaymentMethod(o);
|
|
27
|
+
}).catch(function(o) {
|
|
28
|
+
e._isIgnorableError(o) || e.model.reportError(o);
|
|
29
|
+
}).then(function() {
|
|
30
|
+
e.allowUserAction();
|
|
31
|
+
});
|
|
32
|
+
}), e.model.asyncDependencyReady(r.ID);
|
|
33
|
+
}).catch(function(n) {
|
|
34
|
+
e.model.asyncDependencyFailed({
|
|
35
|
+
view: e.ID,
|
|
36
|
+
error: new f(n)
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}, r.prototype.requestPaymentMethod = function() {
|
|
40
|
+
return this.model.reportError("venmoButtonMustBeUsed"), i.prototype.requestPaymentMethod.call(this);
|
|
41
|
+
}, r.prototype._isIgnorableError = function(e) {
|
|
42
|
+
return e.code === "VENMO_APP_CANCELED" || e.code === "VENMO_DESKTOP_CANCELED";
|
|
43
|
+
}, r.isEnabled = function(e) {
|
|
44
|
+
var a = e.client.getConfiguration().gatewayConfiguration, n = a.payWithVenmo && !!e.merchantConfiguration.venmo;
|
|
45
|
+
return n ? Promise.resolve(s.isBrowserSupported(e.merchantConfiguration.venmo)) : Promise.resolve(!1);
|
|
46
|
+
}, u = r, u;
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
D as __require
|
|
50
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-shop",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"bundleDependencies": [
|
|
58
58
|
"braintree-web-drop-in"
|
|
59
59
|
],
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "39f5590acca695adfd392a3e80f1f8d376fff685"
|
|
61
61
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
function r(o) {
|
|
2
|
-
throw new Error('Could not dynamically require "' + o + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
3
|
-
}
|
|
4
|
-
export {
|
|
5
|
-
r as commonjsRequire
|
|
6
|
-
};
|
package/dist/_virtual/dropin.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
2
|
-
import { __require as o } from "../vendor/braintree-web-drop-in/dist/browser/dropin.js";
|
|
3
|
-
var e = o();
|
|
4
|
-
const t = /* @__PURE__ */ r(e), a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5
|
-
__proto__: null,
|
|
6
|
-
default: t
|
|
7
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
8
|
-
export {
|
|
9
|
-
a as d,
|
|
10
|
-
t as default
|
|
11
|
-
};
|
package/dist/_virtual/dropin2.js
DELETED