@kiva/kv-shop 3.0.3 → 3.0.4
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/useBraintreeDropIn.js +38 -38
- package/package.json +3 -5
- package/dist/_virtual/_commonjsHelpers.js +0 -8
- package/dist/_virtual/index.js +0 -11
- package/dist/vendor/braintree-web-drop-in/constants.js +0 -90
- package/dist/vendor/braintree-web-drop-in/dropin-model.js +0 -228
- package/dist/vendor/braintree-web-drop-in/dropin.js +0 -727
- package/dist/vendor/braintree-web-drop-in/index.js +0 -53
- package/dist/vendor/braintree-web-drop-in/lib/add-selection-event-handler.js +0 -14
- package/dist/vendor/braintree-web-drop-in/lib/analytics.js +0 -34
- package/dist/vendor/braintree-web-drop-in/lib/assign.js +0 -22
- package/dist/vendor/braintree-web-drop-in/lib/browser-detection.js +0 -15
- package/dist/vendor/braintree-web-drop-in/lib/create-from-script-tag.js +0 -74
- package/dist/vendor/braintree-web-drop-in/lib/data-collector.js +0 -38
- package/dist/vendor/braintree-web-drop-in/lib/dropin-error.js +0 -15
- package/dist/vendor/braintree-web-drop-in/lib/find-parent-form.js +0 -15
- package/dist/vendor/braintree-web-drop-in/lib/is-guest-checkout.js +0 -14
- package/dist/vendor/braintree-web-drop-in/lib/is-https.js +0 -15
- package/dist/vendor/braintree-web-drop-in/lib/is-utf-8.js +0 -10
- package/dist/vendor/braintree-web-drop-in/lib/kebab-case-to-camel-case.js +0 -15
- package/dist/vendor/braintree-web-drop-in/lib/polyfill.js +0 -26
- package/dist/vendor/braintree-web-drop-in/lib/sanitize-html.js +0 -9
- package/dist/vendor/braintree-web-drop-in/lib/supports-flexbox.js +0 -18
- package/dist/vendor/braintree-web-drop-in/lib/three-d-secure.js +0 -49
- package/dist/vendor/braintree-web-drop-in/lib/transition-helper.js +0 -26
- package/dist/vendor/braintree-web-drop-in/lib/wait.js +0 -16
- package/dist/vendor/braintree-web-drop-in/translations/ar_EG.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/cs_CZ.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/da_DK.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/de_DE.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/el_GR.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/en_AU.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/en_GB.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/en_IN.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/en_US.js +0 -84
- package/dist/vendor/braintree-web-drop-in/translations/es_ES.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/es_XC.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/fi_FI.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/fr_CA.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/fr_FR.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/fr_XC.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/he_IL.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/hu_HU.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/id_ID.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/index.js +0 -108
- package/dist/vendor/braintree-web-drop-in/translations/it_IT.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/ja_JP.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/ko_KR.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/nl_NL.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/no_NO.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/pl_PL.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/pt_BR.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/pt_PT.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/ru_RU.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/sk_SK.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/sv_SE.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/th_TH.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/zh_CN.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/zh_HK.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/zh_TW.js +0 -81
- package/dist/vendor/braintree-web-drop-in/translations/zh_XC.js +0 -81
- package/dist/vendor/braintree-web-drop-in/views/base-view.js +0 -29
- package/dist/vendor/braintree-web-drop-in/views/delete-confirmation-view.js +0 -44
- package/dist/vendor/braintree-web-drop-in/views/main-view.js +0 -152
- package/dist/vendor/braintree-web-drop-in/views/payment-method-view.js +0 -76
- package/dist/vendor/braintree-web-drop-in/views/payment-methods-view.js +0 -72
- package/dist/vendor/braintree-web-drop-in/views/payment-options-view.js +0 -61
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/apple-pay-view.js +0 -59
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/base-paypal-view.js +0 -79
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/card-view.js +0 -324
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/google-pay-view.js +0 -85
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/index.js +0 -17
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/paypal-credit-view.js +0 -20
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/paypal-view.js +0 -20
- package/dist/vendor/braintree-web-drop-in/views/payment-sheet-views/venmo-view.js +0 -50
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { __require as p } from "../lib/analytics.js";
|
|
2
|
-
import { __require as m } from "./base-view.js";
|
|
3
|
-
import { __require as y } from "../constants.js";
|
|
4
|
-
import { __require as g } from "../lib/add-selection-event-handler.js";
|
|
5
|
-
var r, o;
|
|
6
|
-
function M() {
|
|
7
|
-
if (o) return r;
|
|
8
|
-
o = 1;
|
|
9
|
-
var d = p(), s = m(), a = y(), l = g(), h = `<div class="braintree-method__icon-container braintree-method__delete-container">
|
|
10
|
-
<div class="braintree-method__icon braintree-method__delete">
|
|
11
|
-
<svg width="48" height="29">
|
|
12
|
-
<use xlink:href="#iconX"></use>
|
|
13
|
-
</svg>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<div class="braintree-method__logo">
|
|
18
|
-
<svg width="40" height="24" class="@CLASSNAME">
|
|
19
|
-
<use xlink:href="#@ICON"></use>
|
|
20
|
-
</svg>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
<div class="braintree-method__label">@TITLE<br><div class="braintree-method__label--small">@SUBTITLE</div></div>
|
|
24
|
-
|
|
25
|
-
<div class="braintree-method__icon-container braintree-method__check-container">
|
|
26
|
-
<div class="braintree-method__icon braintree-method__check">
|
|
27
|
-
<svg height="100%" width="100%">
|
|
28
|
-
<use xlink:href="#iconCheck"></use>
|
|
29
|
-
</svg>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
`;
|
|
33
|
-
function e() {
|
|
34
|
-
s.apply(this, arguments), this._initialize();
|
|
35
|
-
}
|
|
36
|
-
return e.prototype = Object.create(s.prototype), e.prototype.constructor = e, e.prototype._initialize = function() {
|
|
37
|
-
var n, t = h, c = a.paymentMethodCardTypes, i = a.paymentMethodTypes;
|
|
38
|
-
switch (this.element = document.createElement("div"), this.element.className = "braintree-method", this.element.setAttribute("tabindex", "0"), this.element.setAttribute("role", "button"), l(this.element, (function() {
|
|
39
|
-
this.model.isInEditMode() ? this._selectDelete() : this._choosePaymentMethod();
|
|
40
|
-
}).bind(this)), this.paymentMethod.type) {
|
|
41
|
-
case i.applePay:
|
|
42
|
-
t = t.replace(/@ICON/g, "logoApplePay").replace(/@CLASSNAME/g, "").replace(/@TITLE/g, this.strings["Apple Pay"]).replace(/@SUBTITLE/g, "");
|
|
43
|
-
break;
|
|
44
|
-
case i.card:
|
|
45
|
-
n = this.strings.endingIn.replace("{{lastFourCardDigits}}", this.paymentMethod.details.lastFour), t = t.replace(/@ICON/g, "icon-" + c[this.paymentMethod.details.cardType]).replace(/@CLASSNAME/g, " braintree-icon--bordered").replace(/@TITLE/g, n).replace(/@SUBTITLE/g, this.strings[this.paymentMethod.details.cardType]);
|
|
46
|
-
break;
|
|
47
|
-
case i.googlePay:
|
|
48
|
-
t = t.replace(/@ICON/g, "logoGooglePay").replace(/@CLASSNAME/g, "").replace(/@TITLE/g, this.strings["Google Pay"]).replace(/@SUBTITLE/g, "");
|
|
49
|
-
break;
|
|
50
|
-
case i.paypal:
|
|
51
|
-
t = t.replace(/@ICON/g, "logoPayPal").replace(/@CLASSNAME/g, "").replace(/@TITLE/g, this.paymentMethod.details.email).replace(/@SUBTITLE/g, this.strings.PayPal);
|
|
52
|
-
break;
|
|
53
|
-
case i.venmo:
|
|
54
|
-
t = t.replace(/@ICON/g, "logoVenmo").replace(/@CLASSNAME/g, "").replace(/@TITLE/g, this.paymentMethod.details.username).replace(/@SUBTITLE/g, this.strings.Venmo);
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
this.element.innerHTML = t, this.checkMark = this.element.querySelector(".braintree-method__check-container");
|
|
58
|
-
}, e.prototype.setActive = function(n) {
|
|
59
|
-
setTimeout((function() {
|
|
60
|
-
this.element.classList.toggle("braintree-method--active", n);
|
|
61
|
-
}).bind(this), 0);
|
|
62
|
-
}, e.prototype.enableEditMode = function() {
|
|
63
|
-
this.checkMark.classList.add("braintree-hidden"), this.paymentMethod.hasSubscription && this.element.classList.add("braintree-method--disabled");
|
|
64
|
-
}, e.prototype.disableEditMode = function() {
|
|
65
|
-
this.checkMark.classList.remove("braintree-hidden"), this.element.classList.remove("braintree-method--disabled");
|
|
66
|
-
}, e.prototype.teardown = function() {
|
|
67
|
-
this.element.parentNode && this.element.parentNode.removeChild(this.element);
|
|
68
|
-
}, e.prototype._choosePaymentMethod = function() {
|
|
69
|
-
this.paymentMethod.vaulted && d.sendEvent(this.client, "vaulted-" + a.analyticsKinds[this.paymentMethod.type] + ".select"), this.model.changeActivePaymentMethod(this.paymentMethod);
|
|
70
|
-
}, e.prototype._selectDelete = function() {
|
|
71
|
-
this.model.confirmPaymentMethodDeletion(this.paymentMethod);
|
|
72
|
-
}, r = e, r;
|
|
73
|
-
}
|
|
74
|
-
export {
|
|
75
|
-
M as __require
|
|
76
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { __require as l } from "./base-view.js";
|
|
2
|
-
import { __require as p } from "./payment-method-view.js";
|
|
3
|
-
import { __require as y } from "../lib/dropin-error.js";
|
|
4
|
-
import { __require as M } from "../constants.js";
|
|
5
|
-
import { __require as v } from "../lib/add-selection-event-handler.js";
|
|
6
|
-
var o, r;
|
|
7
|
-
function g() {
|
|
8
|
-
if (r) return o;
|
|
9
|
-
r = 1;
|
|
10
|
-
var s = l(), h = p(), a = y(), d = M().errors, m = v(), c = {
|
|
11
|
-
CreditCard: "Card",
|
|
12
|
-
PayPalAccount: "PayPal",
|
|
13
|
-
ApplePayCard: "Apple Pay",
|
|
14
|
-
AndroidPayCard: "Google Pay",
|
|
15
|
-
VenmoAccount: "Venmo"
|
|
16
|
-
};
|
|
17
|
-
function i() {
|
|
18
|
-
s.apply(this, arguments), this._initialize();
|
|
19
|
-
}
|
|
20
|
-
return i.prototype = Object.create(s.prototype), i.prototype.constructor = i, i.ID = i.prototype.ID = "methods", i.prototype._initialize = function() {
|
|
21
|
-
this.views = [], this.container = this.getElementById("methods-container"), this._headingLabel = this.getElementById("methods-label"), this._editButton = this.getElementById("methods-edit"), this.model.on("addPaymentMethod", this._addPaymentMethod.bind(this)), this.model.on("changeActivePaymentMethod", this._changeActivePaymentMethodView.bind(this)), this.model.on("refreshPaymentMethods", this.refreshPaymentMethods.bind(this)), this.refreshPaymentMethods(), this.model.merchantConfiguration.vaultManager && (this.model.on("removePaymentMethod", this._removePaymentMethod.bind(this)), m(this._editButton, (function() {
|
|
22
|
-
this.model.isInEditMode() ? this.model.disableEditMode() : this.model.enableEditMode();
|
|
23
|
-
}).bind(this)), this._editButton.classList.remove("braintree-hidden"));
|
|
24
|
-
}, i.prototype.removeActivePaymentMethod = function() {
|
|
25
|
-
this.activeMethodView && (this.activeMethodView.setActive(!1), this.activeMethodView = null, this._headingLabel.classList.add("braintree-no-payment-method-selected"));
|
|
26
|
-
}, i.prototype._getPaymentMethodString = function() {
|
|
27
|
-
var t, e;
|
|
28
|
-
return this.activeMethodView ? (t = c[this.activeMethodView.paymentMethod.type], e = this.strings[t], this.strings.payingWith.replace("{{paymentSource}}", e)) : "";
|
|
29
|
-
}, i.prototype.enableEditMode = function() {
|
|
30
|
-
this.container.classList.add("braintree-methods--edit"), this._editButton.innerHTML = this.strings.deleteCancelButton, this._headingLabel.innerHTML = this.strings.editPaymentMethods, this.views.forEach(function(t) {
|
|
31
|
-
t.enableEditMode();
|
|
32
|
-
});
|
|
33
|
-
}, i.prototype.disableEditMode = function() {
|
|
34
|
-
this.container.classList.remove("braintree-methods--edit"), this._editButton.innerHTML = this.strings.edit, this._headingLabel.innerHTML = this._getPaymentMethodString(), this.views.forEach(function(t) {
|
|
35
|
-
t.disableEditMode();
|
|
36
|
-
});
|
|
37
|
-
}, i.prototype._addPaymentMethod = function(t) {
|
|
38
|
-
var e = new h({
|
|
39
|
-
model: this.model,
|
|
40
|
-
paymentMethod: t,
|
|
41
|
-
client: this.client,
|
|
42
|
-
strings: this.strings
|
|
43
|
-
});
|
|
44
|
-
this.model.isGuestCheckout && this.container.firstChild && (this.views[0].teardown(), this.views.pop()), this.container.firstChild ? this.container.insertBefore(e.element, this.container.firstChild) : this.container.appendChild(e.element), this.views.push(e);
|
|
45
|
-
}, i.prototype._removePaymentMethod = function(t) {
|
|
46
|
-
var e;
|
|
47
|
-
for (e = 0; e < this.views.length; e++)
|
|
48
|
-
if (this.views[e].paymentMethod === t) {
|
|
49
|
-
this.views[e].teardown(), this._headingLabel.innerHTML = " ", this.views.splice(e, 1);
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
}, i.prototype._changeActivePaymentMethodView = function(t) {
|
|
53
|
-
var e, n = this.activeMethodView;
|
|
54
|
-
for (e = 0; e < this.views.length; e++)
|
|
55
|
-
if (this.views[e].paymentMethod === t) {
|
|
56
|
-
this.activeMethodView = this.views[e], this._headingLabel.innerHTML = this._getPaymentMethodString();
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
n && n.setActive(!1), this.activeMethodView.setActive(!0), this._headingLabel.classList.remove("braintree-no-payment-method-selected");
|
|
60
|
-
}, i.prototype.requestPaymentMethod = function() {
|
|
61
|
-
return !this.activeMethodView || this.model.isInEditMode() ? Promise.reject(new a(d.NO_PAYMENT_METHOD_ERROR)) : Promise.resolve(this.activeMethodView.paymentMethod);
|
|
62
|
-
}, i.prototype.refreshPaymentMethods = function() {
|
|
63
|
-
var t, e = this.model.getPaymentMethods();
|
|
64
|
-
for (this.views.forEach(function(n) {
|
|
65
|
-
n.teardown();
|
|
66
|
-
}), this.views = [], t = e.length - 1; t >= 0; t--)
|
|
67
|
-
this._addPaymentMethod(e[t]);
|
|
68
|
-
}, o = i, o;
|
|
69
|
-
}
|
|
70
|
-
export {
|
|
71
|
-
g as __require
|
|
72
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { __require as y } from "../lib/analytics.js";
|
|
2
|
-
import { __require as h } from "../lib/add-selection-event-handler.js";
|
|
3
|
-
import { __require as m } from "./base-view.js";
|
|
4
|
-
import { __require as u } from "../constants.js";
|
|
5
|
-
var o, p;
|
|
6
|
-
function C() {
|
|
7
|
-
if (p) return o;
|
|
8
|
-
p = 1;
|
|
9
|
-
var c = y(), d = h(), s = m(), a = u().paymentOptionIDs, g = `<div class="braintree-option__logo">
|
|
10
|
-
<svg width="48" height="29" class="@CLASSNAME">
|
|
11
|
-
<use xlink:href="#@ICON"></use>
|
|
12
|
-
</svg>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<div class="braintree-option__label" aria-label="@OPTION_LABEL">
|
|
16
|
-
@OPTION_TITLE
|
|
17
|
-
<div class="braintree-option__disabled-message"></div>
|
|
18
|
-
</div>
|
|
19
|
-
`;
|
|
20
|
-
function i() {
|
|
21
|
-
s.apply(this, arguments), this._initialize();
|
|
22
|
-
}
|
|
23
|
-
return i.prototype = Object.create(s.prototype), i.prototype.constructor = i, i.ID = i.prototype.ID = "options", i.prototype._initialize = function() {
|
|
24
|
-
this.container = this.getElementById("payment-options-container"), this.elements = {}, this.model.supportedPaymentOptions.forEach((function(t) {
|
|
25
|
-
this._addPaymentOption(t);
|
|
26
|
-
}).bind(this));
|
|
27
|
-
}, i.prototype._addPaymentOption = function(t) {
|
|
28
|
-
var r, n = document.createElement("div"), e = g, l = (function() {
|
|
29
|
-
this.mainView.setPrimaryView(t), this.model.selectPaymentOption(t), c.sendEvent(this.client, "selected." + a[t]);
|
|
30
|
-
}).bind(this);
|
|
31
|
-
switch (n.className = "braintree-option braintree-option__" + t, n.setAttribute("tabindex", "0"), n.setAttribute("role", "button"), t) {
|
|
32
|
-
case a.applePay:
|
|
33
|
-
r = this.strings["Apple Pay"], e = e.replace(/@ICON/g, "logoApplePay");
|
|
34
|
-
break;
|
|
35
|
-
case a.card:
|
|
36
|
-
r = this.strings.Card, e = e.replace(/@ICON/g, "iconCardFront"), e = e.replace(/@CLASSNAME/g, "braintree-icon--bordered");
|
|
37
|
-
break;
|
|
38
|
-
case a.googlePay:
|
|
39
|
-
r = this.strings["Google Pay"], e = e.replace(/@ICON/g, "logoGooglePay");
|
|
40
|
-
break;
|
|
41
|
-
case a.paypal:
|
|
42
|
-
r = this.strings.PayPal, e = e.replace(/@ICON/g, "logoPayPal");
|
|
43
|
-
break;
|
|
44
|
-
case a.paypalCredit:
|
|
45
|
-
r = this.strings["PayPal Credit"], e = e.replace(/@ICON/g, "logoPayPalCredit");
|
|
46
|
-
break;
|
|
47
|
-
case a.venmo:
|
|
48
|
-
r = this.strings.Venmo, e = e.replace(/@ICON/g, "logoVenmo");
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
e = e.replace(/@OPTION_LABEL/g, this._generateOptionLabel(r)), e = e.replace(/@OPTION_TITLE/g, r), e = e.replace(/@CLASSNAME/g, ""), n.innerHTML = e, d(n, l), this.container.appendChild(n), this.elements[t] = {
|
|
52
|
-
div: n,
|
|
53
|
-
clickHandler: l
|
|
54
|
-
};
|
|
55
|
-
}, i.prototype._generateOptionLabel = function(t) {
|
|
56
|
-
return this.strings.payingWith.replace("{{paymentSource}}", t);
|
|
57
|
-
}, o = i, o;
|
|
58
|
-
}
|
|
59
|
-
export {
|
|
60
|
-
C as __require
|
|
61
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { commonjsGlobal as i } from "../../../../_virtual/_commonjsHelpers.js";
|
|
2
|
-
import { __require as d } from "../../lib/assign.js";
|
|
3
|
-
import { __require as h } from "../base-view.js";
|
|
4
|
-
import g from "braintree-web/apple-pay";
|
|
5
|
-
import { __require as S } from "../../lib/dropin-error.js";
|
|
6
|
-
import { __require as v } from "../../lib/is-https.js";
|
|
7
|
-
import { __require as _ } from "../../constants.js";
|
|
8
|
-
var p, y;
|
|
9
|
-
function D() {
|
|
10
|
-
if (y) return p;
|
|
11
|
-
y = 1;
|
|
12
|
-
var u = d().assign, s = h(), P = g, m = S(), c = v(), f = _().paymentOptionIDs, l = 2;
|
|
13
|
-
function a() {
|
|
14
|
-
s.apply(this, arguments);
|
|
15
|
-
}
|
|
16
|
-
return a.prototype = Object.create(s.prototype), a.prototype.constructor = a, a.ID = a.prototype.ID = f.applePay, a.prototype.initialize = function() {
|
|
17
|
-
var e = this;
|
|
18
|
-
return e.applePayConfiguration = u({}, e.model.merchantConfiguration.applePay), e.applePaySessionVersion = e.applePayConfiguration.applePaySessionVersion || l, delete e.applePayConfiguration.applePaySessionVersion, P.create({ client: this.client }).then(function(t) {
|
|
19
|
-
e.buttonDiv = e.getElementById("apple-pay-button"), e.applePayInstance = t, e.buttonDiv.onclick = e._showPaymentSheet.bind(e), e.buttonDiv.style["-apple-pay-button-style"] = e.model.merchantConfiguration.applePay.buttonStyle || "black", e.model.asyncDependencyReady(a.ID);
|
|
20
|
-
}).catch(function(t) {
|
|
21
|
-
e.model.asyncDependencyFailed({
|
|
22
|
-
view: e.ID,
|
|
23
|
-
error: new m(t)
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
}, a.prototype.requestPaymentMethod = function() {
|
|
27
|
-
return this.model.reportError("applePayButtonMustBeUsed"), s.prototype.requestPaymentMethod.call(this);
|
|
28
|
-
}, a.prototype._showPaymentSheet = function() {
|
|
29
|
-
var e = this, t, n;
|
|
30
|
-
return this._sessionInProgress || (this._sessionInProgress = !0, t = this.applePayInstance.createPaymentRequest(this.applePayConfiguration.paymentRequest), n = new i.ApplePaySession(e.applePaySessionVersion, t), n.onvalidatemerchant = function(o) {
|
|
31
|
-
e.applePayInstance.performValidation({
|
|
32
|
-
validationURL: o.validationURL,
|
|
33
|
-
displayName: e.applePayConfiguration.displayName
|
|
34
|
-
}).then(function(r) {
|
|
35
|
-
n.completeMerchantValidation(r);
|
|
36
|
-
}).catch(function(r) {
|
|
37
|
-
e.model.reportError(r), e._sessionInProgress = !1, n.abort();
|
|
38
|
-
});
|
|
39
|
-
}, n.onpaymentauthorized = function(o) {
|
|
40
|
-
e.applePayInstance.tokenize({
|
|
41
|
-
token: o.payment.token
|
|
42
|
-
}).then(function(r) {
|
|
43
|
-
e._sessionInProgress = !1, n.completePayment(i.ApplePaySession.STATUS_SUCCESS), r.rawPaymentData = o.payment, e.model.addPaymentMethod(r);
|
|
44
|
-
}).catch(function(r) {
|
|
45
|
-
e.model.reportError(r), e._sessionInProgress = !1, n.completePayment(i.ApplePaySession.STATUS_FAILURE);
|
|
46
|
-
});
|
|
47
|
-
}, n.oncancel = function() {
|
|
48
|
-
e._sessionInProgress = !1;
|
|
49
|
-
}, n.begin()), !1;
|
|
50
|
-
}, a.prototype.updateConfiguration = function(e, t) {
|
|
51
|
-
this.applePayConfiguration[e] = t;
|
|
52
|
-
}, a.isEnabled = function(e) {
|
|
53
|
-
var t = e.client.getConfiguration().gatewayConfiguration, n = t.applePayWeb && !!e.merchantConfiguration.applePay, o = e.merchantConfiguration.applePay && e.merchantConfiguration.applePay.applePaySessionVersion, r;
|
|
54
|
-
return o = o || l, !n || (r = i.ApplePaySession && c.isHTTPS(), !r) || !i.ApplePaySession.supportsVersion(o) ? Promise.resolve(!1) : Promise.resolve(!!i.ApplePaySession.canMakePayments());
|
|
55
|
-
}, p = a, p;
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
D as __require
|
|
59
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { commonjsGlobal as l } from "../../../../_virtual/_commonjsHelpers.js";
|
|
2
|
-
import { __require as S } from "../../lib/analytics.js";
|
|
3
|
-
import { __require as U } from "../../lib/assign.js";
|
|
4
|
-
import { __require as L } from "../../lib/browser-detection.js";
|
|
5
|
-
import { __require as R } from "../base-view.js";
|
|
6
|
-
import V from "braintree-web/paypal-checkout";
|
|
7
|
-
import { __require as F } from "../../lib/dropin-error.js";
|
|
8
|
-
import { __require as G } from "../../constants.js";
|
|
9
|
-
import M from "@braintree/asset-loader";
|
|
10
|
-
import { __require as Y } from "../../translations/index.js";
|
|
11
|
-
var m, P;
|
|
12
|
-
function X() {
|
|
13
|
-
if (P) return m;
|
|
14
|
-
P = 1;
|
|
15
|
-
var _ = S(), E = U().assign, y = L(), d = R(), w = V, D = F(), v = G(), q = M, b = Y().fiveCharacterLocales, I = 3e4, T = ["offerCredit", "locale"], N = "warn", u;
|
|
16
|
-
function o() {
|
|
17
|
-
d.apply(this, arguments);
|
|
18
|
-
}
|
|
19
|
-
return o.prototype = Object.create(d.prototype), o.prototype.initialize = function() {
|
|
20
|
-
var r, a = !!this._isPayPalCredit, p = !1, e = this, C = a ? "paypalCredit" : "paypal", O = this.model.merchantConfiguration[C], A = "#braintree--dropin__" + this.model.componentID;
|
|
21
|
-
return this.paypalConfiguration = E({}, O), r = setTimeout(function() {
|
|
22
|
-
e.model.asyncDependencyFailed({
|
|
23
|
-
view: e.ID,
|
|
24
|
-
error: new D("There was an error connecting to PayPal.")
|
|
25
|
-
});
|
|
26
|
-
}, I), w.create({ client: this.client }).then(function(i) {
|
|
27
|
-
var t, c = '[data-braintree-id="paypal-button"]', B = e.client.getConfiguration().gatewayConfiguration.environment === "production" ? "production" : "sandbox", f = e.model.merchantConfiguration.locale;
|
|
28
|
-
return e.paypalInstance = i, e.paypalConfiguration.offerCredit = !!a, t = {
|
|
29
|
-
env: B,
|
|
30
|
-
style: e.paypalConfiguration.buttonStyle || {},
|
|
31
|
-
commit: e.paypalConfiguration.commit,
|
|
32
|
-
payment: function() {
|
|
33
|
-
return i.createPayment(e.paypalConfiguration).catch(s);
|
|
34
|
-
},
|
|
35
|
-
onAuthorize: function(n) {
|
|
36
|
-
var g = e.paypalConfiguration.vault && e.paypalConfiguration.vault.vaultPayPal === !1;
|
|
37
|
-
return g && (n.vault = !1), i.tokenizePayment(n).then(function(h) {
|
|
38
|
-
!g && e.paypalConfiguration.flow === "vault" && !e.model.isGuestCheckout && (h.vaulted = !0), e.model.addPaymentMethod(h);
|
|
39
|
-
}).catch(s);
|
|
40
|
-
},
|
|
41
|
-
onError: s
|
|
42
|
-
}, f && f in b && (e.paypalConfiguration.locale = f, t.locale = f), t.funding = {
|
|
43
|
-
disallowed: []
|
|
44
|
-
}, Object.keys(l.paypal.FUNDING).forEach(function(n) {
|
|
45
|
-
n === "PAYPAL" || n === "CREDIT" || t.funding.disallowed.push(l.paypal.FUNDING[n]);
|
|
46
|
-
}), a ? (c = '[data-braintree-id="paypal-credit-button"]', t.style.label = "credit") : t.funding.disallowed.push(l.paypal.FUNDING.CREDIT), c = A + " " + c, l.paypal.Button.render(t, c).then(function() {
|
|
47
|
-
e.model.asyncDependencyReady(C), p = !0, clearTimeout(r);
|
|
48
|
-
});
|
|
49
|
-
}).catch(s);
|
|
50
|
-
function s(i) {
|
|
51
|
-
p ? e.model.reportError(i) : (e.model.asyncDependencyFailed({
|
|
52
|
-
view: e.ID,
|
|
53
|
-
error: i
|
|
54
|
-
}), clearTimeout(r));
|
|
55
|
-
}
|
|
56
|
-
}, o.prototype.requestPaymentMethod = function() {
|
|
57
|
-
return this.model.reportError("paypalButtonMustBeUsed"), d.prototype.requestPaymentMethod.call(this);
|
|
58
|
-
}, o.prototype.updateConfiguration = function(r, a) {
|
|
59
|
-
T.indexOf(r) === -1 && (this.paypalConfiguration[r] = a);
|
|
60
|
-
}, o.isEnabled = function(r) {
|
|
61
|
-
var a = r.client.getConfiguration().gatewayConfiguration, p = r.merchantConfiguration.paypal || r.merchantConfiguration.paypalCredit;
|
|
62
|
-
return a.paypalEnabled ? y.isIe9() || y.isIe10() ? (_.sendEvent(r.client, r.viewID + ".checkout.js-browser-not-supported"), Promise.resolve(!1)) : l.paypal && l.paypal.Button ? Promise.resolve(!0) : u || (u = q.loadScript({
|
|
63
|
-
src: v.CHECKOUT_JS_SOURCE,
|
|
64
|
-
id: v.PAYPAL_CHECKOUT_SCRIPT_ID,
|
|
65
|
-
dataAttributes: {
|
|
66
|
-
"log-level": p.logLevel || N
|
|
67
|
-
}
|
|
68
|
-
}).then(function() {
|
|
69
|
-
return Promise.resolve(!0);
|
|
70
|
-
}).catch(function() {
|
|
71
|
-
return Promise.resolve(!1);
|
|
72
|
-
}).then(function(e) {
|
|
73
|
-
return u = null, Promise.resolve(e);
|
|
74
|
-
}), u) : Promise.resolve(!1);
|
|
75
|
-
}, m = o, m;
|
|
76
|
-
}
|
|
77
|
-
export {
|
|
78
|
-
X as __require
|
|
79
|
-
};
|