@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,11 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
|
|
2
|
+
import { __require as r } from "../vendor/braintree-web-drop-in/index.js";
|
|
3
|
+
var t = r();
|
|
4
|
+
const o = /* @__PURE__ */ e(t), n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5
|
+
__proto__: null,
|
|
6
|
+
default: o
|
|
7
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
8
|
+
export {
|
|
9
|
+
o as default,
|
|
10
|
+
n as i
|
|
11
|
+
};
|
|
@@ -58,7 +58,7 @@ function D() {
|
|
|
58
58
|
paypalFlow: P = "checkout"
|
|
59
59
|
}) {
|
|
60
60
|
t = s(r).format("0.00");
|
|
61
|
-
const { default: q } = await import("./_virtual/
|
|
61
|
+
const { default: q } = await import("./_virtual/index.js").then((l) => l.i);
|
|
62
62
|
try {
|
|
63
63
|
e = await q.create({
|
|
64
64
|
authorization: u,
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var e, a;
|
|
2
|
+
function r() {
|
|
3
|
+
return a || (a = 1, e = {
|
|
4
|
+
paymentOptionIDs: {
|
|
5
|
+
card: "card",
|
|
6
|
+
paypal: "paypal",
|
|
7
|
+
paypalCredit: "paypalCredit",
|
|
8
|
+
applePay: "applePay",
|
|
9
|
+
venmo: "venmo",
|
|
10
|
+
googlePay: "googlePay"
|
|
11
|
+
},
|
|
12
|
+
paymentMethodTypes: {
|
|
13
|
+
card: "CreditCard",
|
|
14
|
+
paypal: "PayPalAccount",
|
|
15
|
+
paypalCredit: "PayPalAccount",
|
|
16
|
+
applePay: "ApplePayCard",
|
|
17
|
+
venmo: "VenmoAccount",
|
|
18
|
+
googlePay: "AndroidPayCard"
|
|
19
|
+
},
|
|
20
|
+
analyticsKinds: {
|
|
21
|
+
CreditCard: "card",
|
|
22
|
+
PayPalAccount: "paypal",
|
|
23
|
+
ApplePayCard: "applepay",
|
|
24
|
+
VenmoAccount: "venmo",
|
|
25
|
+
AndroidPayCard: "googlepay"
|
|
26
|
+
},
|
|
27
|
+
paymentMethodCardTypes: {
|
|
28
|
+
Visa: "visa",
|
|
29
|
+
MasterCard: "master-card",
|
|
30
|
+
"American Express": "american-express",
|
|
31
|
+
"Diners Club": "diners-club",
|
|
32
|
+
Discover: "discover",
|
|
33
|
+
JCB: "jcb",
|
|
34
|
+
UnionPay: "unionpay",
|
|
35
|
+
Maestro: "maestro",
|
|
36
|
+
Elo: "elo",
|
|
37
|
+
Hiper: "hiper",
|
|
38
|
+
Hipercard: "hipercard"
|
|
39
|
+
},
|
|
40
|
+
cardTypeIcons: {
|
|
41
|
+
visa: "visa",
|
|
42
|
+
mastercard: "master-card",
|
|
43
|
+
"american-express": "american-express",
|
|
44
|
+
"diners-club": "diners-club",
|
|
45
|
+
discover: "discover",
|
|
46
|
+
jcb: "jcb",
|
|
47
|
+
"union-pay": "unionpay",
|
|
48
|
+
maestro: "maestro",
|
|
49
|
+
elo: "elo",
|
|
50
|
+
hiper: "hiper",
|
|
51
|
+
hipercard: "hipercard"
|
|
52
|
+
},
|
|
53
|
+
configurationCardTypes: {
|
|
54
|
+
visa: "Visa",
|
|
55
|
+
"master-card": "MasterCard",
|
|
56
|
+
"american-express": "American Express",
|
|
57
|
+
"diners-club": "Discover",
|
|
58
|
+
discover: "Discover",
|
|
59
|
+
jcb: "JCB",
|
|
60
|
+
unionpay: "UnionPay",
|
|
61
|
+
maestro: "Maestro",
|
|
62
|
+
elo: "Elo",
|
|
63
|
+
hiper: "Hiper",
|
|
64
|
+
hipercard: "Hipercard"
|
|
65
|
+
},
|
|
66
|
+
dependencySetupStates: {
|
|
67
|
+
DONE: "done",
|
|
68
|
+
FAILED: "failed",
|
|
69
|
+
INITIALIZING: "initializing",
|
|
70
|
+
NOT_ENABLED: "not-enabled"
|
|
71
|
+
},
|
|
72
|
+
errors: {
|
|
73
|
+
NO_PAYMENT_METHOD_ERROR: "No payment method is available.",
|
|
74
|
+
DEVELOPER_MISCONFIGURATION_MESSAGE: "Developer Error: Something went wrong. Check the console for details."
|
|
75
|
+
},
|
|
76
|
+
ANALYTICS_REQUEST_TIMEOUT_MS: 2e3,
|
|
77
|
+
ANALYTICS_PREFIX: "web.dropin.",
|
|
78
|
+
CHANGE_ACTIVE_PAYMENT_METHOD_TIMEOUT: 200,
|
|
79
|
+
CHECKOUT_JS_SOURCE: "https://www.paypalobjects.com/api/checkout.min.js",
|
|
80
|
+
GOOGLE_PAYMENT_SOURCE: "https://pay.google.com/gp/p/js/pay.js",
|
|
81
|
+
INTEGRATION: "dropin2",
|
|
82
|
+
PAYPAL_CHECKOUT_SCRIPT_ID: "braintree-dropin-paypal-checkout-script",
|
|
83
|
+
GOOGLE_PAYMENT_SCRIPT_ID: "braintree-dropin-google-payment-script",
|
|
84
|
+
DATA_COLLECTOR_SCRIPT_ID: "braintree-dropin-data-collector-script",
|
|
85
|
+
STYLESHEET_ID: "braintree-dropin-stylesheet"
|
|
86
|
+
}), e;
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
r as __require
|
|
90
|
+
};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { __require as A } from "./lib/analytics.js";
|
|
2
|
+
import { __require as S } from "./lib/dropin-error.js";
|
|
3
|
+
import b from "@braintree/event-emitter";
|
|
4
|
+
import { __require as C } from "./constants.js";
|
|
5
|
+
import { __require as R } from "./lib/is-guest-checkout.js";
|
|
6
|
+
import { __require as V } from "./views/payment-sheet-views/index.js";
|
|
7
|
+
import T from "braintree-web/vault-manager";
|
|
8
|
+
import { __require as L } from "./views/payment-options-view.js";
|
|
9
|
+
var y, f;
|
|
10
|
+
function $() {
|
|
11
|
+
if (f) return y;
|
|
12
|
+
f = 1;
|
|
13
|
+
var P = A(), h = S(), m = b, p = C(), u = p.paymentMethodTypes, s = p.paymentOptionIDs, d = p.dependencySetupStates, _ = R(), v = V(), M = T, E = L().ID, I = [
|
|
14
|
+
u.applePay,
|
|
15
|
+
u.googlePay,
|
|
16
|
+
u.venmo
|
|
17
|
+
], c = [
|
|
18
|
+
s.card,
|
|
19
|
+
s.paypal,
|
|
20
|
+
s.paypalCredit,
|
|
21
|
+
s.venmo,
|
|
22
|
+
s.applePay,
|
|
23
|
+
s.googlePay
|
|
24
|
+
], l = ["threeDSecure", "dataCollector"], g = c.concat(l), D = 200;
|
|
25
|
+
function n(e) {
|
|
26
|
+
for (this.rootNode = e.container, this.componentID = e.componentID, this.merchantConfiguration = e.merchantConfiguration, this.isGuestCheckout = _(e.client), this.dependencyStates = g.reduce((function(t, i) {
|
|
27
|
+
return this._shouldIncludeDependency(i) && (t[i] = d.INITIALIZING), t;
|
|
28
|
+
}).bind(this), {}), this.hiddenVaultedPaymentMethodTypes = N(
|
|
29
|
+
e.merchantConfiguration.hiddenVaultedPaymentMethodTypes
|
|
30
|
+
), this.failedDependencies = {}, this._options = e, this._setupComplete = !1, this.shouldWaitForVerifyCard = !1; this.rootNode.parentNode; )
|
|
31
|
+
this.rootNode = this.rootNode.parentNode;
|
|
32
|
+
this.isInShadowDom = this.rootNode.toString() === "[object ShadowRoot]", m.call(this);
|
|
33
|
+
}
|
|
34
|
+
m.createChild(n), n.prototype.initialize = function() {
|
|
35
|
+
var e, t = this, i = setInterval(function() {
|
|
36
|
+
for (e in t.dependencyStates)
|
|
37
|
+
if (t.dependencyStates[e] === d.INITIALIZING)
|
|
38
|
+
return;
|
|
39
|
+
clearInterval(i), t._emit("asyncDependenciesReady");
|
|
40
|
+
}, D);
|
|
41
|
+
return M.create({
|
|
42
|
+
client: t._options.client
|
|
43
|
+
}).then(function(r) {
|
|
44
|
+
return t._vaultManager = r, t._getSupportedPaymentOptions(t._options);
|
|
45
|
+
}).then(function(r) {
|
|
46
|
+
return t.supportedPaymentOptions = r, t.getVaultedPaymentMethods();
|
|
47
|
+
}).then(function(r) {
|
|
48
|
+
t._paymentMethods = r, t._paymentMethodIsRequestable = t._paymentMethods.length > 0;
|
|
49
|
+
});
|
|
50
|
+
}, n.prototype.confirmDropinReady = function() {
|
|
51
|
+
this._setupComplete = !0;
|
|
52
|
+
}, n.prototype.isPaymentMethodRequestable = function() {
|
|
53
|
+
return !!this._paymentMethodIsRequestable;
|
|
54
|
+
}, n.prototype.addPaymentMethod = function(e) {
|
|
55
|
+
this._paymentMethods.push(e), this._emit("addPaymentMethod", e), this.changeActivePaymentMethod(e);
|
|
56
|
+
}, n.prototype.removePaymentMethod = function(e) {
|
|
57
|
+
var t = this._paymentMethods.indexOf(e);
|
|
58
|
+
t !== -1 && (this._paymentMethods.splice(t, 1), this._emit("removePaymentMethod", e));
|
|
59
|
+
}, n.prototype.refreshPaymentMethods = function() {
|
|
60
|
+
var e = this;
|
|
61
|
+
return e.getVaultedPaymentMethods().then(function(t) {
|
|
62
|
+
e._paymentMethods = t, e._emit("refreshPaymentMethods");
|
|
63
|
+
});
|
|
64
|
+
}, n.prototype.changeActivePaymentMethod = function(e) {
|
|
65
|
+
this._activePaymentMethod = e, this._emit("changeActivePaymentMethod", e);
|
|
66
|
+
}, n.prototype.changeActiveView = function(e) {
|
|
67
|
+
var t = this._activePaymentViewId;
|
|
68
|
+
this._activePaymentViewId = e, this._emit("changeActiveView", {
|
|
69
|
+
previousViewId: t,
|
|
70
|
+
newViewId: e
|
|
71
|
+
});
|
|
72
|
+
}, n.prototype.removeActivePaymentMethod = function() {
|
|
73
|
+
this._activePaymentMethod = null, this._emit("removeActivePaymentMethod"), this.setPaymentMethodRequestable({
|
|
74
|
+
isRequestable: !1
|
|
75
|
+
});
|
|
76
|
+
}, n.prototype.selectPaymentOption = function(e) {
|
|
77
|
+
this._emit("paymentOptionSelected", {
|
|
78
|
+
paymentOption: e
|
|
79
|
+
});
|
|
80
|
+
}, n.prototype.enableEditMode = function() {
|
|
81
|
+
P.sendEvent(this._options.client, "manager.appeared"), this._isInEditMode = !0, this._emit("enableEditMode");
|
|
82
|
+
}, n.prototype.disableEditMode = function() {
|
|
83
|
+
this._isInEditMode = !1, this._emit("disableEditMode");
|
|
84
|
+
}, n.prototype.isInEditMode = function() {
|
|
85
|
+
return !!this._isInEditMode;
|
|
86
|
+
}, n.prototype.confirmPaymentMethodDeletion = function(e) {
|
|
87
|
+
this._paymentMethodWaitingToBeDeleted = e, this._emit("confirmPaymentMethodDeletion", e);
|
|
88
|
+
}, n.prototype._shouldIncludeDependency = function(e) {
|
|
89
|
+
if (e === "card") {
|
|
90
|
+
if (this.merchantConfiguration.card === !1)
|
|
91
|
+
return !1;
|
|
92
|
+
} else if (!this.merchantConfiguration[e])
|
|
93
|
+
return !1;
|
|
94
|
+
return l.indexOf(e) > -1 ? !0 : this.merchantConfiguration.paymentOptionPriority ? this.merchantConfiguration.paymentOptionPriority.indexOf(e) > -1 : c.indexOf(e) > -1;
|
|
95
|
+
}, n.prototype._shouldEmitRequestableEvent = function(e) {
|
|
96
|
+
var t = this.isPaymentMethodRequestable() === e.isRequestable, i = e.selectedPaymentMethod && e.selectedPaymentMethod.nonce, r = i === this._paymentMethodRequestableNonce;
|
|
97
|
+
return !(!this._setupComplete || this.shouldWaitForVerifyCard || t && (!e.isRequestable || r));
|
|
98
|
+
}, n.prototype.setPaymentMethodRequestable = function(e) {
|
|
99
|
+
var t = this._shouldEmitRequestableEvent(e), i = {
|
|
100
|
+
paymentMethodIsSelected: !!e.selectedPaymentMethod,
|
|
101
|
+
type: e.type
|
|
102
|
+
};
|
|
103
|
+
this._paymentMethodIsRequestable = e.isRequestable, e.isRequestable ? this._paymentMethodRequestableNonce = e.selectedPaymentMethod && e.selectedPaymentMethod.nonce : delete this._paymentMethodRequestableNonce, t && (e.isRequestable ? this._emit("paymentMethodRequestable", i) : this._emit("noPaymentMethodRequestable"));
|
|
104
|
+
}, n.prototype.getPaymentMethods = function() {
|
|
105
|
+
return this._paymentMethods.slice();
|
|
106
|
+
}, n.prototype.getActivePaymentMethod = function() {
|
|
107
|
+
return this._activePaymentMethod;
|
|
108
|
+
}, n.prototype.hasPaymentMethods = function() {
|
|
109
|
+
return this.getPaymentMethods().length > 0;
|
|
110
|
+
}, n.prototype.getInitialViewId = function() {
|
|
111
|
+
return this.supportedPaymentOptions.length > 1 ? E : this.supportedPaymentOptions[0];
|
|
112
|
+
}, n.prototype.getActivePaymentViewId = function() {
|
|
113
|
+
return this._activePaymentViewId;
|
|
114
|
+
}, n.prototype.reportAppSwitchPayload = function(e) {
|
|
115
|
+
this.appSwitchPayload = e;
|
|
116
|
+
}, n.prototype.reportAppSwitchError = function(e, t) {
|
|
117
|
+
this.appSwitchError = {
|
|
118
|
+
id: e,
|
|
119
|
+
error: t
|
|
120
|
+
};
|
|
121
|
+
}, n.prototype.hasAtLeastOneAvailablePaymentOption = function() {
|
|
122
|
+
var e = this, t;
|
|
123
|
+
for (t = 0; t < this.supportedPaymentOptions.length; t++)
|
|
124
|
+
if (e.dependencyStates[this.supportedPaymentOptions[t]] === d.DONE)
|
|
125
|
+
return !0;
|
|
126
|
+
return !1;
|
|
127
|
+
}, n.prototype.asyncDependencyReady = function(e) {
|
|
128
|
+
this.dependencyStates[e] = d.DONE;
|
|
129
|
+
}, n.prototype.asyncDependencyFailed = function(e) {
|
|
130
|
+
this.failedDependencies.hasOwnProperty(e.view) || (this.failedDependencies[e.view] = e.error, this.dependencyStates[e.view] = d.FAILED);
|
|
131
|
+
}, n.prototype.cancelInitialization = function(e) {
|
|
132
|
+
this._emit("cancelInitialization", e);
|
|
133
|
+
}, n.prototype.reportError = function(e) {
|
|
134
|
+
this._emit("errorOccurred", e);
|
|
135
|
+
}, n.prototype.clearError = function() {
|
|
136
|
+
this._emit("errorCleared");
|
|
137
|
+
}, n.prototype.preventUserAction = function() {
|
|
138
|
+
this._emit("preventUserAction");
|
|
139
|
+
}, n.prototype.allowUserAction = function() {
|
|
140
|
+
this._emit("allowUserAction");
|
|
141
|
+
}, n.prototype.deleteVaultedPaymentMethod = function() {
|
|
142
|
+
var e = this, t = Promise.resolve(), i;
|
|
143
|
+
return this._emit("startVaultedPaymentMethodDeletion"), e.isGuestCheckout || (t = this._vaultManager.deletePaymentMethod(this._paymentMethodWaitingToBeDeleted.nonce).catch(function(r) {
|
|
144
|
+
i = r;
|
|
145
|
+
})), t.then(function() {
|
|
146
|
+
return delete e._paymentMethodWaitingToBeDeleted, e.refreshPaymentMethods();
|
|
147
|
+
}).then(function() {
|
|
148
|
+
e.disableEditMode(), e._emit("finishVaultedPaymentMethodDeletion", i);
|
|
149
|
+
});
|
|
150
|
+
}, n.prototype.cancelDeleteVaultedPaymentMethod = function() {
|
|
151
|
+
this._emit("cancelVaultedPaymentMethodDeletion"), delete this._paymentMethodWaitingToBeDeleted;
|
|
152
|
+
}, n.prototype.getVaultedPaymentMethods = function() {
|
|
153
|
+
var e = this;
|
|
154
|
+
return e.isGuestCheckout ? Promise.resolve([]) : e._vaultManager.fetchPaymentMethods({
|
|
155
|
+
defaultFirst: this.merchantConfiguration.showDefaultPaymentMethodFirst !== !1
|
|
156
|
+
}).then(function(t) {
|
|
157
|
+
return e._getSupportedPaymentMethods(t).map(function(i) {
|
|
158
|
+
return i.vaulted = !0, i;
|
|
159
|
+
});
|
|
160
|
+
}).catch(function() {
|
|
161
|
+
return Promise.resolve([]);
|
|
162
|
+
});
|
|
163
|
+
}, n.prototype._getSupportedPaymentMethods = function(e) {
|
|
164
|
+
var t = this, i = this.supportedPaymentOptions.reduce(
|
|
165
|
+
function(r, a) {
|
|
166
|
+
var o = u[a];
|
|
167
|
+
return w(
|
|
168
|
+
o,
|
|
169
|
+
t.hiddenVaultedPaymentMethodTypes
|
|
170
|
+
) && r.push(o), r;
|
|
171
|
+
},
|
|
172
|
+
[]
|
|
173
|
+
);
|
|
174
|
+
return e.filter(function(r) {
|
|
175
|
+
return i.indexOf(r.type) > -1;
|
|
176
|
+
});
|
|
177
|
+
}, n.prototype._getSupportedPaymentOptions = function(e) {
|
|
178
|
+
var t = this, i = e.merchantConfiguration.paymentOptionPriority || c, r;
|
|
179
|
+
if (!(i instanceof Array))
|
|
180
|
+
throw new h("paymentOptionPriority must be an array.");
|
|
181
|
+
return i = i.filter(function(a, o) {
|
|
182
|
+
return i.indexOf(a) === o;
|
|
183
|
+
}), r = i.map(function(a) {
|
|
184
|
+
return O(a, e).then(function(o) {
|
|
185
|
+
return o.success || (t.dependencyStates[o.id] = d.NOT_ENABLED), o;
|
|
186
|
+
});
|
|
187
|
+
}), Promise.all(r).then(function(a) {
|
|
188
|
+
return a = a.filter(function(o) {
|
|
189
|
+
return o.success;
|
|
190
|
+
}), a.length === 0 ? Promise.reject(new h("No valid payment options available.")) : a.map(function(o) {
|
|
191
|
+
return o.id;
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
function O(e, t) {
|
|
196
|
+
return q(e, t).then(function(i) {
|
|
197
|
+
return {
|
|
198
|
+
success: i,
|
|
199
|
+
id: s[e]
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function q(e, t) {
|
|
204
|
+
var i = v[s[e]];
|
|
205
|
+
return i ? i.isEnabled({
|
|
206
|
+
client: t.client,
|
|
207
|
+
merchantConfiguration: t.merchantConfiguration
|
|
208
|
+
}).catch(function(r) {
|
|
209
|
+
return console.error(i.ID + " view errored when checking if it was supported."), console.error(r), Promise.resolve(!1);
|
|
210
|
+
}) : Promise.reject(new h("paymentOptionPriority: Invalid payment option specified."));
|
|
211
|
+
}
|
|
212
|
+
function w(e, t) {
|
|
213
|
+
return e && t.indexOf(e) === -1;
|
|
214
|
+
}
|
|
215
|
+
function N(e) {
|
|
216
|
+
var t = [].concat(
|
|
217
|
+
I
|
|
218
|
+
);
|
|
219
|
+
return Array.isArray(e) && e.forEach(function(i) {
|
|
220
|
+
var r = u[i];
|
|
221
|
+
r && (t.indexOf(r) > -1 || t.push(r));
|
|
222
|
+
}), t;
|
|
223
|
+
}
|
|
224
|
+
return y = n, y;
|
|
225
|
+
}
|
|
226
|
+
export {
|
|
227
|
+
$ as __require
|
|
228
|
+
};
|