@kiva/kv-shop 3.0.2 → 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/_commonjs-dynamic-modules.js +0 -6
- package/dist/_virtual/_commonjsHelpers.js +0 -8
- 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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { gql as C } from "@apollo/client/core";
|
|
2
|
-
import
|
|
2
|
+
import p from "numeral";
|
|
3
3
|
import { ref as b } from "vue";
|
|
4
4
|
import { parseShopError as A, ShopError as I } from "./shopError.js";
|
|
5
5
|
const w = ["paypal", "card", "applePay", "googlePay"];
|
|
6
6
|
async function T(e) {
|
|
7
|
-
var
|
|
8
|
-
const { data: t, error:
|
|
7
|
+
var n;
|
|
8
|
+
const { data: t, error: a, errors: o } = await e.query({
|
|
9
9
|
query: C`query getClientToken {
|
|
10
10
|
shop {
|
|
11
11
|
id
|
|
@@ -13,13 +13,13 @@ async function T(e) {
|
|
|
13
13
|
}
|
|
14
14
|
}`
|
|
15
15
|
});
|
|
16
|
-
if (
|
|
17
|
-
throw A(
|
|
18
|
-
return (
|
|
16
|
+
if (a || o != null && o.length)
|
|
17
|
+
throw A(a ?? (o == null ? void 0 : o[0]));
|
|
18
|
+
return (n = t == null ? void 0 : t.shop) == null ? void 0 : n.getClientToken;
|
|
19
19
|
}
|
|
20
20
|
function D() {
|
|
21
21
|
let e, t = "";
|
|
22
|
-
const
|
|
22
|
+
const a = b(!1);
|
|
23
23
|
function o(r) {
|
|
24
24
|
return {
|
|
25
25
|
countryCode: "US",
|
|
@@ -33,7 +33,7 @@ function D() {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function n(r) {
|
|
37
37
|
return {
|
|
38
38
|
totalPriceStatus: "FINAL",
|
|
39
39
|
totalPrice: r,
|
|
@@ -41,26 +41,26 @@ function D() {
|
|
|
41
41
|
countryCode: "US"
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
e.isPaymentMethodRequestable() && (
|
|
46
|
-
|
|
44
|
+
function s() {
|
|
45
|
+
e.isPaymentMethodRequestable() && (a.value = !0), e.on("paymentMethodRequestable", (r) => {
|
|
46
|
+
a.value = !0;
|
|
47
47
|
}), e.on("noPaymentMethodRequestable", () => {
|
|
48
|
-
|
|
48
|
+
a.value = !1;
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
async function
|
|
51
|
+
async function d({
|
|
52
52
|
amount: r,
|
|
53
53
|
authToken: u,
|
|
54
54
|
container: i,
|
|
55
|
-
googlePayMerchantId:
|
|
56
|
-
paymentTypes:
|
|
57
|
-
preselectVaultedPaymentMethod:
|
|
58
|
-
paypalFlow:
|
|
55
|
+
googlePayMerchantId: f,
|
|
56
|
+
paymentTypes: m = [...w],
|
|
57
|
+
preselectVaultedPaymentMethod: g = !0,
|
|
58
|
+
paypalFlow: h = "checkout"
|
|
59
59
|
}) {
|
|
60
|
-
t =
|
|
61
|
-
const { default:
|
|
60
|
+
t = p(r).format("0.00");
|
|
61
|
+
const { default: P } = await import("braintree-web-drop-in/index.js");
|
|
62
62
|
try {
|
|
63
|
-
e = await
|
|
63
|
+
e = await P.create({
|
|
64
64
|
authorization: u,
|
|
65
65
|
container: i,
|
|
66
66
|
dataCollector: {
|
|
@@ -68,15 +68,15 @@ function D() {
|
|
|
68
68
|
// Required if Kount fraud data collection is enabled
|
|
69
69
|
},
|
|
70
70
|
// vaultManager: true, - Useful for testing and removing payment methods easily.
|
|
71
|
-
paymentOptionPriority:
|
|
72
|
-
preselectVaultedPaymentMethod:
|
|
71
|
+
paymentOptionPriority: m,
|
|
72
|
+
preselectVaultedPaymentMethod: g,
|
|
73
73
|
card: {
|
|
74
74
|
vault: {
|
|
75
75
|
allowVaultCardOverride: !0
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
paypal: {
|
|
79
|
-
flow:
|
|
79
|
+
flow: h,
|
|
80
80
|
amount: t,
|
|
81
81
|
currency: "USD",
|
|
82
82
|
buttonStyle: {
|
|
@@ -90,8 +90,8 @@ function D() {
|
|
|
90
90
|
},
|
|
91
91
|
googlePay: {
|
|
92
92
|
googlePayVersion: 2,
|
|
93
|
-
merchantId:
|
|
94
|
-
transactionInfo:
|
|
93
|
+
merchantId: f,
|
|
94
|
+
transactionInfo: n(t),
|
|
95
95
|
button: {
|
|
96
96
|
allowedPaymentMethods: [{
|
|
97
97
|
type: "CARD",
|
|
@@ -111,34 +111,34 @@ function D() {
|
|
|
111
111
|
displayName: "Kiva",
|
|
112
112
|
paymentRequest: o(t)
|
|
113
113
|
}
|
|
114
|
-
}),
|
|
115
|
-
} catch (
|
|
114
|
+
}), s();
|
|
115
|
+
} catch (q) {
|
|
116
116
|
throw new I({
|
|
117
117
|
code: "shop.braintreeDropinInitError",
|
|
118
|
-
original:
|
|
118
|
+
original: q
|
|
119
119
|
}, "An Error has occured. Please refresh the page and try again.");
|
|
120
120
|
}
|
|
121
121
|
return e;
|
|
122
122
|
}
|
|
123
|
-
async function
|
|
123
|
+
async function c() {
|
|
124
124
|
if (e.isPaymentMethodRequestable())
|
|
125
125
|
return e.requestPaymentMethod();
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function y(r) {
|
|
128
128
|
var i;
|
|
129
|
-
const u =
|
|
130
|
-
u !== t && (t = u, e == null || e.updateConfiguration("paypal", "amount", t), e == null || e.updateConfiguration("googlePay", "transactionInfo",
|
|
129
|
+
const u = p(r).format("0.00");
|
|
130
|
+
u !== t && (t = u, e == null || e.updateConfiguration("paypal", "amount", t), e == null || e.updateConfiguration("googlePay", "transactionInfo", n(t)), (i = e == null ? void 0 : e.updateConfiguration) == null || i.call(e, "applePay", "paymentRequest", o(t)));
|
|
131
131
|
}
|
|
132
132
|
return {
|
|
133
|
-
initDropIn:
|
|
134
|
-
paymentMethodRequestable:
|
|
135
|
-
requestPaymentMethod:
|
|
136
|
-
updateAmount:
|
|
133
|
+
initDropIn: d,
|
|
134
|
+
paymentMethodRequestable: a,
|
|
135
|
+
requestPaymentMethod: c,
|
|
136
|
+
updateAmount: y
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
const
|
|
139
|
+
const l = {};
|
|
140
140
|
function U(e = "default") {
|
|
141
|
-
return
|
|
141
|
+
return l[e] || (l[e] = D()), l[e];
|
|
142
142
|
}
|
|
143
143
|
export {
|
|
144
144
|
U as default,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-shop",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -51,11 +51,9 @@
|
|
|
51
51
|
"@apollo/client": "3.x",
|
|
52
52
|
"@kiva/kv-analytics": "1.x",
|
|
53
53
|
"@kiva/kv-components": "5 || 6",
|
|
54
|
+
"braintree-web-drop-in": "1.x",
|
|
54
55
|
"numeral": "2.x",
|
|
55
56
|
"vue": "3.x"
|
|
56
57
|
},
|
|
57
|
-
"
|
|
58
|
-
"braintree-web-drop-in"
|
|
59
|
-
],
|
|
60
|
-
"gitHead": "128eeda9edbeb21b2e4756f52006689eb9760ae4"
|
|
58
|
+
"gitHead": "ec33189a47e173db05c396f1b09dda8fa1f19ce7"
|
|
61
59
|
}
|
|
@@ -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
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var o = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
-
function l(e) {
|
|
3
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
-
}
|
|
5
|
-
export {
|
|
6
|
-
o as commonjsGlobal,
|
|
7
|
-
l as getDefaultExportFromCjs
|
|
8
|
-
};
|
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