@kiva/kv-shop 1.3.2 → 1.4.1
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/basket.cjs +44 -15
- package/dist/basket.d.ts +4 -4
- package/dist/basket.js +5 -8
- package/dist/basketCredits.cjs +197 -0
- package/dist/basketCredits.d.ts +18 -0
- package/dist/basketCredits.js +12 -0
- package/dist/basketItems.cjs +70 -33
- package/dist/basketItems.d.ts +11 -1
- package/dist/basketItems.js +5 -3
- package/dist/basketTotals.cjs +228 -0
- package/dist/basketTotals.d.ts +37 -0
- package/dist/basketTotals.js +12 -0
- package/dist/basketVerification.cjs +41 -0
- package/dist/basketVerification.d.ts +10 -0
- package/dist/basketVerification.js +8 -0
- package/dist/checkoutStatus.cjs +110 -0
- package/dist/checkoutStatus.d.ts +20 -0
- package/dist/checkoutStatus.js +10 -0
- package/dist/{chunk-B7RLQXI6.js → chunk-2NC7LGGO.js} +14 -12
- package/dist/{chunk-IYCMZ5WV.js → chunk-4ODZGLWK.js} +21 -0
- package/dist/chunk-AI6E33YE.js +33 -0
- package/dist/chunk-CBJJUUVR.js +121 -0
- package/dist/chunk-DZGZX4F6.js +45 -0
- package/dist/chunk-EJ5NGYPO.js +145 -0
- package/dist/chunk-FCAOCO7O.js +17 -0
- package/dist/chunk-JBQ2KNMP.js +50 -0
- package/dist/{chunk-SLMBU6L7.js → chunk-JXQPCEKG.js} +9 -2
- package/dist/{chunk-TIASV6B2.js → chunk-KV4SOUVF.js} +1 -1
- package/dist/chunk-LZ4UMRCV.js +16 -0
- package/dist/chunk-MRCBNXPS.js +35 -0
- package/dist/chunk-PC4WUPYU.js +78 -0
- package/dist/chunk-TPJPGUO7.js +12 -0
- package/dist/components/KvPaymentSelect.vue +8 -1
- package/dist/index.cjs +489 -56
- package/dist/index.d.ts +12 -5
- package/dist/index.js +55 -21
- package/dist/oneTimeCheckout.cjs +396 -9
- package/dist/oneTimeCheckout.d.ts +11 -10
- package/dist/oneTimeCheckout.js +10 -5
- package/dist/shopError.cjs +21 -0
- package/dist/shopError.d.ts +2 -0
- package/dist/shopError.js +1 -1
- package/dist/shopQueries.cjs +248 -0
- package/dist/shopQueries.d.ts +8 -0
- package/dist/shopQueries.js +13 -0
- package/dist/subscriptionCheckout.cjs +21 -0
- package/dist/subscriptionCheckout.js +2 -2
- package/dist/useBraintreeDropIn.cjs +29 -1
- package/dist/useBraintreeDropIn.d.ts +9 -9
- package/dist/useBraintreeDropIn.js +2 -2
- package/dist/validatePreCheckout.cjs +210 -0
- package/dist/validatePreCheckout.d.ts +22 -0
- package/dist/validatePreCheckout.js +13 -0
- package/package.json +3 -3
- package/dist/chunk-M4CJOCIQ.js +0 -26
- package/dist/chunk-NC7RAUNV.js +0 -66
package/dist/chunk-M4CJOCIQ.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// src/oneTimeCheckout.ts
|
|
2
|
-
import { gql } from "@apollo/client/core";
|
|
3
|
-
async function executeOneTimeCheckout({ apollo }) {
|
|
4
|
-
}
|
|
5
|
-
async function waitOnTransaction({ apollo, transactionId }) {
|
|
6
|
-
const result = await apollo.query({
|
|
7
|
-
query: gql`
|
|
8
|
-
query checkoutStatus($transactionId: String!, $visitorId: string) {
|
|
9
|
-
checkoutStatus(transactionId: $transactionId, visitorId: $visitorId) {
|
|
10
|
-
errorCode
|
|
11
|
-
errorMessage
|
|
12
|
-
status
|
|
13
|
-
transactionId
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
`,
|
|
17
|
-
variables: {
|
|
18
|
-
transactionId
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
executeOneTimeCheckout,
|
|
25
|
-
waitOnTransaction
|
|
26
|
-
};
|
package/dist/chunk-NC7RAUNV.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createBasket,
|
|
3
|
-
getBasketID,
|
|
4
|
-
hasBasketExpired
|
|
5
|
-
} from "./chunk-B7RLQXI6.js";
|
|
6
|
-
import {
|
|
7
|
-
ShopError,
|
|
8
|
-
parseShopError
|
|
9
|
-
} from "./chunk-IYCMZ5WV.js";
|
|
10
|
-
|
|
11
|
-
// src/basketItems.ts
|
|
12
|
-
import { gql } from "@apollo/client/core";
|
|
13
|
-
import numeral from "numeral";
|
|
14
|
-
async function callShopMutation(apollo, mutation, variables, maxretries = 2) {
|
|
15
|
-
try {
|
|
16
|
-
const result = await apollo.mutate({
|
|
17
|
-
mutation,
|
|
18
|
-
variables: {
|
|
19
|
-
...variables,
|
|
20
|
-
basketId: getBasketID()
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
if (result?.errors?.length) {
|
|
24
|
-
const basketErrors = result?.errors.filter((err) => hasBasketExpired(err));
|
|
25
|
-
if (basketErrors.length) {
|
|
26
|
-
if (maxretries > 0) {
|
|
27
|
-
await createBasket(apollo);
|
|
28
|
-
return callShopMutation(apollo, mutation, variables, maxretries - 1);
|
|
29
|
-
}
|
|
30
|
-
throw basketErrors[0];
|
|
31
|
-
}
|
|
32
|
-
const otherErrors = result?.errors?.filter((err) => !hasBasketExpired(err));
|
|
33
|
-
if (otherErrors.length) {
|
|
34
|
-
throw otherErrors[0];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return result?.data;
|
|
38
|
-
} catch (e) {
|
|
39
|
-
if (e instanceof ShopError) {
|
|
40
|
-
throw e;
|
|
41
|
-
}
|
|
42
|
-
throw parseShopError(e);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async function setTipDonation({ amount, apollo }) {
|
|
46
|
-
const donationAmount = numeral(amount).format("0.00");
|
|
47
|
-
const data = await callShopMutation(apollo, gql`mutation setTipDonation($price: Money!, $basketId: String) {
|
|
48
|
-
shop (basketId: $basketId) {
|
|
49
|
-
id
|
|
50
|
-
updateDonation (donation: {
|
|
51
|
-
price: $price,
|
|
52
|
-
isTip: true
|
|
53
|
-
})
|
|
54
|
-
{
|
|
55
|
-
id
|
|
56
|
-
price
|
|
57
|
-
isTip
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}`, { price: donationAmount });
|
|
61
|
-
return data?.shop?.updateDonation;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
setTipDonation
|
|
66
|
-
};
|