@kiva/kv-shop 3.7.103 → 3.8.0
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/givingFunds.js +56 -23
- package/dist/index.d.ts +22 -2
- package/dist/index.js +40 -38
- package/dist/oneTimeCheckout.js +98 -86
- package/package.json +4 -4
package/dist/givingFunds.js
CHANGED
|
@@ -1,36 +1,69 @@
|
|
|
1
|
-
import { gql as
|
|
2
|
-
import { getVisitorID as
|
|
3
|
-
import { parseShopError as
|
|
4
|
-
const
|
|
1
|
+
import { gql as e } from "@apollo/client/core";
|
|
2
|
+
import { getVisitorID as m } from "./util/visitorId.js";
|
|
3
|
+
import { parseShopError as v } from "./shopError.js";
|
|
4
|
+
const g = e`
|
|
5
5
|
mutation AddGivingFund($fund: GivingFundInput!) {
|
|
6
6
|
addGivingFund(fund: $fund) {
|
|
7
7
|
id
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
`;
|
|
11
|
-
async function
|
|
12
|
-
apollo:
|
|
13
|
-
fundTarget:
|
|
14
|
-
userId:
|
|
15
|
-
organizationId:
|
|
11
|
+
async function C({
|
|
12
|
+
apollo: u,
|
|
13
|
+
fundTarget: o,
|
|
14
|
+
userId: r,
|
|
15
|
+
organizationId: i
|
|
16
16
|
}) {
|
|
17
|
-
var
|
|
18
|
-
const
|
|
19
|
-
userId:
|
|
20
|
-
target:
|
|
21
|
-
visitorId:
|
|
22
|
-
...
|
|
23
|
-
},
|
|
24
|
-
mutation:
|
|
17
|
+
var t;
|
|
18
|
+
const d = {
|
|
19
|
+
userId: r,
|
|
20
|
+
target: o,
|
|
21
|
+
visitorId: m(),
|
|
22
|
+
...i ? { organizationId: i } : {}
|
|
23
|
+
}, n = await u.mutate({
|
|
24
|
+
mutation: g,
|
|
25
25
|
variables: {
|
|
26
|
-
fund:
|
|
26
|
+
fund: d
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
if (
|
|
30
|
-
throw
|
|
31
|
-
return (
|
|
29
|
+
if (n.errors)
|
|
30
|
+
throw n.errors.map((a) => v(a))[0];
|
|
31
|
+
return (t = n.data) == null ? void 0 : t.addGivingFund;
|
|
32
|
+
}
|
|
33
|
+
const c = e`
|
|
34
|
+
mutation AddCustomGivingFund($fund: CustomGivingFundInput!) {
|
|
35
|
+
addCustomGivingFund(fund: $fund) {
|
|
36
|
+
id
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
async function l({
|
|
41
|
+
apollo: u,
|
|
42
|
+
savedSearchId: o,
|
|
43
|
+
name: r,
|
|
44
|
+
userId: i,
|
|
45
|
+
organizationId: d
|
|
46
|
+
}) {
|
|
47
|
+
var s;
|
|
48
|
+
const n = {
|
|
49
|
+
userId: i,
|
|
50
|
+
savedSearchId: o,
|
|
51
|
+
visitorId: m(),
|
|
52
|
+
...r ? { name: r } : {},
|
|
53
|
+
...d ? { organizationId: d } : {}
|
|
54
|
+
}, t = await u.mutate({
|
|
55
|
+
mutation: c,
|
|
56
|
+
variables: {
|
|
57
|
+
fund: n
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
if (t.errors)
|
|
61
|
+
throw t.errors.map((f) => v(f))[0];
|
|
62
|
+
return (s = t.data) == null ? void 0 : s.addCustomGivingFund;
|
|
32
63
|
}
|
|
33
64
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
65
|
+
l as addCustomGivingFund,
|
|
66
|
+
c as addCustomGivingFundMutation,
|
|
67
|
+
C as addGivingFund,
|
|
68
|
+
g as addGivingFundMutation
|
|
36
69
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,24 @@ import { Ref } from 'vue';
|
|
|
10
10
|
import { TransactionData } from '@kiva/kv-analytics';
|
|
11
11
|
import { WatchQueryOptions } from '@apollo/client/core';
|
|
12
12
|
|
|
13
|
+
export declare function addCustomGivingFund({ apollo, savedSearchId, name, userId, organizationId, }: AddCustomGivingFundOptions): Promise<any>;
|
|
14
|
+
|
|
15
|
+
export declare interface AddCustomGivingFundData {
|
|
16
|
+
addCustomGivingFund: {
|
|
17
|
+
id: string;
|
|
18
|
+
} | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare const addCustomGivingFundMutation: DocumentNode;
|
|
22
|
+
|
|
23
|
+
export declare interface AddCustomGivingFundOptions {
|
|
24
|
+
apollo: ApolloClient<any>;
|
|
25
|
+
savedSearchId: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
userId?: string;
|
|
28
|
+
organizationId?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
13
31
|
export declare function addGivingFund({ apollo, fundTarget, userId, organizationId, }: AddGivingFundOptions): Promise<any>;
|
|
14
32
|
|
|
15
33
|
export declare interface AddGivingFundData {
|
|
@@ -129,7 +147,7 @@ export declare function executeNewSubscriptionCheckout({ amount, apollo, dayOfMo
|
|
|
129
147
|
|
|
130
148
|
export declare function executeOneTimeCheckout({ apollo, braintree, emailAddress, emailOptIn, valetInviter, deactivateRedirect, }: OneTimeCheckoutOptions): Promise<CheckoutStatusQueryResult>;
|
|
131
149
|
|
|
132
|
-
export declare function executeOneTimeCheckoutForGivingFund({ amount, apollo, braintree, emailAddress, emailOptIn, fundTarget, userId, useKivaCredit, }: OneTimeCheckoutForGivingFundOptions): Promise<OneTimeCheckoutForGivingFundResult>;
|
|
150
|
+
export declare function executeOneTimeCheckoutForGivingFund({ amount, apollo, braintree, emailAddress, emailOptIn, fundTarget, savedSearchId, name, userId, useKivaCredit, }: OneTimeCheckoutForGivingFundOptions): Promise<OneTimeCheckoutForGivingFundResult>;
|
|
133
151
|
|
|
134
152
|
export declare function getBasketID(): string;
|
|
135
153
|
|
|
@@ -193,7 +211,9 @@ export declare interface OneTimeCheckoutForGivingFundOptions {
|
|
|
193
211
|
braintree?: DropInWrapper;
|
|
194
212
|
emailAddress?: string;
|
|
195
213
|
emailOptIn?: boolean;
|
|
196
|
-
fundTarget
|
|
214
|
+
fundTarget?: string;
|
|
215
|
+
savedSearchId?: string;
|
|
216
|
+
name?: string;
|
|
197
217
|
userId?: string;
|
|
198
218
|
useKivaCredit?: boolean;
|
|
199
219
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,60 +1,62 @@
|
|
|
1
1
|
import { createBasket as o, getBasketID as r, hasBasketExpired as a, setBasketID as i } from "./basket.js";
|
|
2
|
-
import { applyKivaCredit as n, applyPromoCredit as u, removeKivaCredit as s, removePromoCredit as
|
|
2
|
+
import { applyKivaCredit as n, applyPromoCredit as u, removeKivaCredit as s, removePromoCredit as m } from "./basketCredits.js";
|
|
3
3
|
import { KivaCardDeliveryTypeEnum as d, addKivaCardToBasket as f, setTipDonation as k } from "./basketItems.js";
|
|
4
4
|
import { basketTotalsQuery as l, watchBasketTotals as h } from "./basketTotals.js";
|
|
5
|
-
import { VerificationState as v, isBasketVerified as
|
|
5
|
+
import { VerificationState as v, isBasketVerified as g } from "./basketVerification.js";
|
|
6
6
|
import { getCheckoutStatus as S, pollForFinishedCheckout as y } from "./checkoutStatus.js";
|
|
7
|
-
import { addGivingFund as
|
|
8
|
-
import { getPromoFromBasket as
|
|
9
|
-
import { executeOneTimeCheckout as I, executeOneTimeCheckoutForGivingFund as
|
|
10
|
-
import { getCheckoutTrackingData as
|
|
11
|
-
import { ShopError as
|
|
12
|
-
import { callShopMutation as
|
|
13
|
-
import { checkSubscriptionStatus as
|
|
14
|
-
import { trackTransactionEvent as
|
|
15
|
-
import { defaultPaymentTypes as
|
|
16
|
-
import { validatePreCheckout as
|
|
17
|
-
import { default as
|
|
7
|
+
import { addCustomGivingFund as B, addCustomGivingFundMutation as D, addGivingFund as P, addGivingFundMutation as E } from "./givingFunds.js";
|
|
8
|
+
import { getPromoFromBasket as K } from "./managedAccount.js";
|
|
9
|
+
import { executeOneTimeCheckout as I, executeOneTimeCheckoutForGivingFund as b } from "./oneTimeCheckout.js";
|
|
10
|
+
import { getCheckoutTrackingData as Q, getFTDStatus as O, getReceiptItems as R, getReceiptTotals as V } from "./receipt.js";
|
|
11
|
+
import { ShopError as j, parseShopError as q } from "./shopError.js";
|
|
12
|
+
import { callShopMutation as A, callShopQuery as H, watchShopQuery as J } from "./shopQueries.js";
|
|
13
|
+
import { checkSubscriptionStatus as U, executeNewSubscriptionCheckout as W } from "./subscriptionCheckout.js";
|
|
14
|
+
import { trackTransactionEvent as Y, trackTransactionMutation as Z } from "./trackTransaction.js";
|
|
15
|
+
import { defaultPaymentTypes as $, getClientToken as ee, default as te } from "./useBraintreeDropIn.js";
|
|
16
|
+
import { validatePreCheckout as re, validatePreCheckoutMutation as ae } from "./validatePreCheckout.js";
|
|
17
|
+
import { default as pe } from "./components/KvPaymentSelect.js";
|
|
18
18
|
export {
|
|
19
19
|
d as KivaCardDeliveryTypeEnum,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
pe as KvPaymentSelect,
|
|
21
|
+
j as ShopError,
|
|
22
22
|
v as VerificationState,
|
|
23
|
-
|
|
24
|
-
D as
|
|
23
|
+
B as addCustomGivingFund,
|
|
24
|
+
D as addCustomGivingFundMutation,
|
|
25
|
+
P as addGivingFund,
|
|
26
|
+
E as addGivingFundMutation,
|
|
25
27
|
f as addKivaCardToBasket,
|
|
26
28
|
n as applyKivaCredit,
|
|
27
29
|
u as applyPromoCredit,
|
|
28
30
|
l as basketTotalsQuery,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
A as callShopMutation,
|
|
32
|
+
H as callShopQuery,
|
|
33
|
+
U as checkSubscriptionStatus,
|
|
32
34
|
o as createBasket,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
$ as defaultPaymentTypes,
|
|
36
|
+
W as executeNewSubscriptionCheckout,
|
|
35
37
|
I as executeOneTimeCheckout,
|
|
36
|
-
|
|
38
|
+
b as executeOneTimeCheckoutForGivingFund,
|
|
37
39
|
r as getBasketID,
|
|
38
40
|
S as getCheckoutStatus,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
Q as getCheckoutTrackingData,
|
|
42
|
+
ee as getClientToken,
|
|
43
|
+
O as getFTDStatus,
|
|
44
|
+
K as getPromoFromBasket,
|
|
45
|
+
R as getReceiptItems,
|
|
46
|
+
V as getReceiptTotals,
|
|
45
47
|
a as hasBasketExpired,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
g as isBasketVerified,
|
|
49
|
+
q as parseShopError,
|
|
48
50
|
y as pollForFinishedCheckout,
|
|
49
51
|
s as removeKivaCredit,
|
|
50
|
-
|
|
52
|
+
m as removePromoCredit,
|
|
51
53
|
i as setBasketID,
|
|
52
54
|
k as setTipDonation,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
Y as trackTransactionEvent,
|
|
56
|
+
Z as trackTransactionMutation,
|
|
57
|
+
te as useBraintreeDropIn,
|
|
58
|
+
re as validatePreCheckout,
|
|
59
|
+
ae as validatePreCheckoutMutation,
|
|
58
60
|
h as watchBasketTotals,
|
|
59
|
-
|
|
61
|
+
J as watchShopQuery
|
|
60
62
|
};
|
package/dist/oneTimeCheckout.js
CHANGED
|
@@ -3,18 +3,18 @@ import { trackTransaction as E } from "@kiva/kv-analytics";
|
|
|
3
3
|
import R from "numeral";
|
|
4
4
|
import { pollForFinishedCheckout as D } from "./checkoutStatus.js";
|
|
5
5
|
import { ShopError as v, parseShopError as S } from "./shopError.js";
|
|
6
|
-
import { callShopQuery as
|
|
6
|
+
import { callShopQuery as O, callShopMutation as N } from "./shopQueries.js";
|
|
7
7
|
import { validatePreCheckout as P } from "./validatePreCheckout.js";
|
|
8
|
-
import { wait as
|
|
9
|
-
import { getVisitorID as
|
|
10
|
-
import { redirectTo as
|
|
11
|
-
import { getCheckoutTrackingData as
|
|
12
|
-
import { addGivingFund as
|
|
13
|
-
import { setTipDonation as
|
|
14
|
-
import { removeKivaCredit as
|
|
15
|
-
async function
|
|
16
|
-
var r,
|
|
17
|
-
const t = await
|
|
8
|
+
import { wait as _ } from "./util/poll.js";
|
|
9
|
+
import { getVisitorID as A } from "./util/visitorId.js";
|
|
10
|
+
import { redirectTo as K } from "./util/redirect.js";
|
|
11
|
+
import { getCheckoutTrackingData as Q } from "./receipt.js";
|
|
12
|
+
import { addCustomGivingFund as U, addGivingFund as V } from "./givingFunds.js";
|
|
13
|
+
import { setTipDonation as j } from "./basketItems.js";
|
|
14
|
+
import { removeKivaCredit as z } from "./basketCredits.js";
|
|
15
|
+
async function l(e) {
|
|
16
|
+
var r, i, o;
|
|
17
|
+
const t = await O(e, {
|
|
18
18
|
query: $`
|
|
19
19
|
query creditAmountNeeded($basketId: String) {
|
|
20
20
|
shop (basketId: $basketId) {
|
|
@@ -30,9 +30,9 @@ async function A(e) {
|
|
|
30
30
|
`,
|
|
31
31
|
fetchPolicy: "network-only"
|
|
32
32
|
}, 0);
|
|
33
|
-
return (
|
|
33
|
+
return (o = (i = (r = t == null ? void 0 : t.shop) == null ? void 0 : r.basket) == null ? void 0 : i.totals) == null ? void 0 : o.creditAmountNeeded;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const H = $`
|
|
36
36
|
mutation creditCheckout(
|
|
37
37
|
$basketId: String,
|
|
38
38
|
$visitorId: String
|
|
@@ -42,7 +42,7 @@ const j = $`
|
|
|
42
42
|
transactionId: checkoutAsync (visitorId: $visitorId)
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`, J = $`
|
|
46
46
|
mutation depositCheckout(
|
|
47
47
|
$basketId: String,
|
|
48
48
|
$amount: Money!,
|
|
@@ -63,164 +63,176 @@ const j = $`
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
`;
|
|
66
|
-
function
|
|
66
|
+
function x(e) {
|
|
67
67
|
return N(e, {
|
|
68
|
-
mutation:
|
|
68
|
+
mutation: H,
|
|
69
69
|
variables: {
|
|
70
|
-
visitorId:
|
|
70
|
+
visitorId: A()
|
|
71
71
|
}
|
|
72
72
|
}, 0);
|
|
73
73
|
}
|
|
74
|
-
async function
|
|
74
|
+
async function G({
|
|
75
75
|
apollo: e,
|
|
76
76
|
braintree: t,
|
|
77
77
|
amount: r
|
|
78
78
|
}) {
|
|
79
79
|
try {
|
|
80
|
-
const
|
|
81
|
-
if (!
|
|
80
|
+
const i = await t.requestPaymentMethod();
|
|
81
|
+
if (!i)
|
|
82
82
|
throw new v(
|
|
83
83
|
{ code: "shop.dropinNoPaymentMethod" },
|
|
84
84
|
"No payment method returned from braintree dropin"
|
|
85
85
|
);
|
|
86
|
-
const { nonce:
|
|
86
|
+
const { nonce: o, deviceData: s, type: c } = i;
|
|
87
87
|
return {
|
|
88
|
-
paymentType:
|
|
88
|
+
paymentType: c,
|
|
89
89
|
mutation: N(e, {
|
|
90
|
-
mutation:
|
|
90
|
+
mutation: J,
|
|
91
91
|
variables: {
|
|
92
|
-
nonce:
|
|
92
|
+
nonce: o,
|
|
93
93
|
amount: r,
|
|
94
94
|
savePaymentMethod: !1,
|
|
95
95
|
// save payment methods handled by braintree drop in UI
|
|
96
|
-
deviceData:
|
|
97
|
-
visitorId:
|
|
96
|
+
deviceData: s,
|
|
97
|
+
visitorId: A()
|
|
98
98
|
}
|
|
99
99
|
}, 0)
|
|
100
100
|
};
|
|
101
|
-
} catch (
|
|
102
|
-
throw S(
|
|
101
|
+
} catch (i) {
|
|
102
|
+
throw S(i);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
async function B(e, t, r) {
|
|
106
106
|
try {
|
|
107
|
-
const
|
|
107
|
+
const i = await Q(
|
|
108
108
|
e,
|
|
109
109
|
t,
|
|
110
110
|
r
|
|
111
111
|
);
|
|
112
|
-
E(
|
|
113
|
-
} catch (
|
|
114
|
-
console.error("Error tracking transaction",
|
|
112
|
+
E(i), await _(800);
|
|
113
|
+
} catch (i) {
|
|
114
|
+
console.error("Error tracking transaction", i);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
async function
|
|
117
|
+
async function ut({
|
|
118
118
|
apollo: e,
|
|
119
119
|
braintree: t,
|
|
120
120
|
emailAddress: r,
|
|
121
|
-
emailOptIn:
|
|
122
|
-
valetInviter:
|
|
123
|
-
deactivateRedirect:
|
|
121
|
+
emailOptIn: i,
|
|
122
|
+
valetInviter: o,
|
|
123
|
+
deactivateRedirect: s
|
|
124
124
|
}) {
|
|
125
|
-
var h,
|
|
125
|
+
var h, d, p, g, a;
|
|
126
126
|
await P({
|
|
127
127
|
apollo: e,
|
|
128
128
|
emailAddress: r,
|
|
129
|
-
emailOptIn:
|
|
130
|
-
valetInviter:
|
|
129
|
+
emailOptIn: i,
|
|
130
|
+
valetInviter: o
|
|
131
131
|
});
|
|
132
|
-
const
|
|
132
|
+
const c = await l(e), k = R(c).value() > 0;
|
|
133
133
|
if (k && !t)
|
|
134
134
|
throw new v({ code: "shop.dropinRequired" }, "Braintree dropin required for credit deposit checkout");
|
|
135
135
|
let n, f = "";
|
|
136
136
|
if (k) {
|
|
137
|
-
const
|
|
137
|
+
const I = await G({
|
|
138
138
|
apollo: e,
|
|
139
139
|
braintree: t,
|
|
140
|
-
amount:
|
|
140
|
+
amount: c
|
|
141
141
|
});
|
|
142
|
-
f =
|
|
142
|
+
f = I.paymentType, n = await I.mutation;
|
|
143
143
|
} else
|
|
144
|
-
n = await
|
|
145
|
-
const
|
|
144
|
+
n = await x(e);
|
|
145
|
+
const w = (h = n == null ? void 0 : n.shop) == null ? void 0 : h.transactionId, u = await D({
|
|
146
146
|
apollo: e,
|
|
147
|
-
transactionSagaId:
|
|
147
|
+
transactionSagaId: w,
|
|
148
148
|
timeout: 3e5
|
|
149
149
|
// five minutes
|
|
150
150
|
});
|
|
151
|
-
if ((
|
|
152
|
-
throw S(
|
|
153
|
-
const
|
|
154
|
-
if (await B(e,
|
|
155
|
-
return
|
|
156
|
-
let
|
|
157
|
-
|
|
151
|
+
if ((d = u.errors) != null && d.length)
|
|
152
|
+
throw S(u.errors[0]);
|
|
153
|
+
const y = (a = (g = (p = u.data) == null ? void 0 : p.checkoutStatus) == null ? void 0 : g.receipt) == null ? void 0 : a.checkoutId;
|
|
154
|
+
if (await B(e, y, f), s)
|
|
155
|
+
return u;
|
|
156
|
+
let m = `/checkout/post-purchase?kiva_transaction_id=${y}`;
|
|
157
|
+
o != null && o.inviterId && (m += `&valet_inviter=${o.inviterId}`), await K(m);
|
|
158
158
|
}
|
|
159
|
-
async function
|
|
159
|
+
async function mt({
|
|
160
160
|
amount: e,
|
|
161
161
|
apollo: t,
|
|
162
162
|
braintree: r,
|
|
163
|
-
emailAddress:
|
|
164
|
-
emailOptIn:
|
|
165
|
-
fundTarget:
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
emailAddress: i,
|
|
164
|
+
emailOptIn: o,
|
|
165
|
+
fundTarget: s,
|
|
166
|
+
savedSearchId: c,
|
|
167
|
+
name: k,
|
|
168
|
+
userId: n,
|
|
169
|
+
useKivaCredit: f = !0
|
|
168
170
|
}) {
|
|
169
|
-
var
|
|
170
|
-
await P({
|
|
171
|
+
var C, b, q, T, F;
|
|
172
|
+
if (await P({
|
|
171
173
|
apollo: t,
|
|
172
|
-
emailAddress:
|
|
173
|
-
emailOptIn:
|
|
174
|
-
})
|
|
175
|
-
|
|
174
|
+
emailAddress: i,
|
|
175
|
+
emailOptIn: o
|
|
176
|
+
}), !s && !c)
|
|
177
|
+
throw new v(
|
|
178
|
+
{ code: "shop.givingFundIdentifierRequired" },
|
|
179
|
+
"executeOneTimeCheckoutForGivingFund requires either fundTarget or savedSearchId"
|
|
180
|
+
);
|
|
181
|
+
const w = c ? await U({
|
|
182
|
+
apollo: t,
|
|
183
|
+
savedSearchId: c,
|
|
184
|
+
name: k,
|
|
185
|
+
userId: n ? `${n}` : void 0
|
|
186
|
+
}) : await V({
|
|
176
187
|
apollo: t,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
188
|
+
// guaranteed present by the runtime guard above when savedSearchId is absent
|
|
189
|
+
fundTarget: s,
|
|
190
|
+
userId: n ? `${n}` : void 0
|
|
191
|
+
}), u = `campaignId: ${w.id}`, y = await j({
|
|
180
192
|
amount: e,
|
|
181
|
-
metadata:
|
|
193
|
+
metadata: u,
|
|
182
194
|
apollo: t
|
|
183
195
|
});
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
196
|
+
f || await z(t);
|
|
197
|
+
const m = await l(t), h = R(m).value() > 0;
|
|
198
|
+
if (h && !r)
|
|
187
199
|
throw new v({ code: "shop.dropinRequired" }, "Braintree dropin required for credit deposit checkout");
|
|
188
|
-
let
|
|
189
|
-
if (
|
|
190
|
-
const
|
|
200
|
+
let d, p = "";
|
|
201
|
+
if (h) {
|
|
202
|
+
const M = await G({
|
|
191
203
|
apollo: t,
|
|
192
204
|
braintree: r,
|
|
193
|
-
amount:
|
|
205
|
+
amount: m
|
|
194
206
|
});
|
|
195
|
-
|
|
207
|
+
p = M.paymentType, d = await M.mutation;
|
|
196
208
|
} else
|
|
197
|
-
|
|
198
|
-
const
|
|
209
|
+
d = await x(t);
|
|
210
|
+
const g = (C = d == null ? void 0 : d.shop) == null ? void 0 : C.transactionId, a = await D({
|
|
199
211
|
apollo: t,
|
|
200
|
-
transactionSagaId:
|
|
212
|
+
transactionSagaId: g,
|
|
201
213
|
timeout: 3e5
|
|
202
214
|
// five minutes
|
|
203
215
|
});
|
|
204
216
|
if ((b = a.errors) != null && b.length)
|
|
205
217
|
throw S(a.errors[0]);
|
|
206
|
-
const
|
|
207
|
-
return await B(t,
|
|
218
|
+
const I = (F = (T = (q = a.data) == null ? void 0 : q.checkoutStatus) == null ? void 0 : T.receipt) == null ? void 0 : F.checkoutId;
|
|
219
|
+
return await B(t, I, p), {
|
|
208
220
|
data: {
|
|
209
221
|
...a.data,
|
|
210
222
|
checkoutStatus: {
|
|
211
223
|
...a.data.checkoutStatus
|
|
212
224
|
},
|
|
213
225
|
donation: {
|
|
214
|
-
...
|
|
226
|
+
...y
|
|
215
227
|
},
|
|
216
228
|
givingFund: {
|
|
217
|
-
id:
|
|
229
|
+
id: w.id
|
|
218
230
|
}
|
|
219
231
|
},
|
|
220
232
|
errors: a.errors ?? []
|
|
221
233
|
};
|
|
222
234
|
}
|
|
223
235
|
export {
|
|
224
|
-
|
|
225
|
-
|
|
236
|
+
ut as executeOneTimeCheckout,
|
|
237
|
+
mt as executeOneTimeCheckoutForGivingFund
|
|
226
238
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-shop",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"homepage": "https://github.com/kiva/kv-ui-elements/tree/main/%40kiva/kv-shop#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@apollo/client": "^3.13.1",
|
|
36
|
-
"@kiva/kv-analytics": "^1.3.
|
|
37
|
-
"@kiva/kv-components": "^8.22.
|
|
36
|
+
"@kiva/kv-analytics": "^1.3.5",
|
|
37
|
+
"@kiva/kv-components": "^8.22.4",
|
|
38
38
|
"@kiva/vite-plugin-vue-lib-css": "^2.0.0",
|
|
39
39
|
"@types/braintree-web-drop-in": "^1.39.3",
|
|
40
40
|
"braintree-web-drop-in": "^1.44.1",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"numeral": "2.x",
|
|
50
50
|
"vue": "3.x"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "8e9b03ba9345e8193f6efe8af79462c1bca126ff"
|
|
53
53
|
}
|