@kiva/kv-shop 1.2.33 → 1.3.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 CHANGED
@@ -50,12 +50,18 @@ function parseShopError(error) {
50
50
  original: error
51
51
  }, "There was a problem validating your payment information. Please double-check the details and try again.");
52
52
  }
53
- if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired") {
53
+ if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired" || errorCode === "shop.alreadyCheckedOut") {
54
54
  return new ShopError({
55
55
  code: errorCode,
56
56
  original: error
57
57
  }, "There was a problem with your basket. Please, refresh the page and try again.");
58
58
  }
59
+ if (errorCode === "donationAmountTooLarge") {
60
+ return new ShopError({
61
+ code: errorCode,
62
+ original: error
63
+ }, errorMessage);
64
+ }
59
65
  return new ShopError({
60
66
  code: "shop.unknown",
61
67
  original: error
@@ -93,7 +99,7 @@ async function createBasket(apollo) {
93
99
  }
94
100
  function hasBasketExpired(error) {
95
101
  const errorCode = error?.code ?? error?.extensions?.code ?? error?.name ?? "";
96
- return ["shop.invalidBasketId", "shop.basketRequired"].includes(errorCode);
102
+ return ["shop.invalidBasketId", "shop.basketRequired", "shop.alreadyCheckedOut"].includes(errorCode);
97
103
  }
98
104
  // Annotate the CommonJS export names for ESM import in node:
99
105
  0 && (module.exports = {
package/dist/basket.js CHANGED
@@ -5,8 +5,8 @@ import {
5
5
  hasBasketExpired,
6
6
  setBasketID,
7
7
  setCookieValue
8
- } from "./chunk-RZZTEPBR.js";
9
- import "./chunk-WXX4N673.js";
8
+ } from "./chunk-B7RLQXI6.js";
9
+ import "./chunk-IYCMZ5WV.js";
10
10
  export {
11
11
  createBasket,
12
12
  getBasketID,
@@ -59,12 +59,18 @@ function parseShopError(error) {
59
59
  original: error
60
60
  }, "There was a problem validating your payment information. Please double-check the details and try again.");
61
61
  }
62
- if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired") {
62
+ if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired" || errorCode === "shop.alreadyCheckedOut") {
63
63
  return new ShopError({
64
64
  code: errorCode,
65
65
  original: error
66
66
  }, "There was a problem with your basket. Please, refresh the page and try again.");
67
67
  }
68
+ if (errorCode === "donationAmountTooLarge") {
69
+ return new ShopError({
70
+ code: errorCode,
71
+ original: error
72
+ }, errorMessage);
73
+ }
68
74
  return new ShopError({
69
75
  code: "shop.unknown",
70
76
  original: error
@@ -102,7 +108,7 @@ async function createBasket(apollo) {
102
108
  }
103
109
  function hasBasketExpired(error) {
104
110
  const errorCode = error?.code ?? error?.extensions?.code ?? error?.name ?? "";
105
- return ["shop.invalidBasketId", "shop.basketRequired"].includes(errorCode);
111
+ return ["shop.invalidBasketId", "shop.basketRequired", "shop.alreadyCheckedOut"].includes(errorCode);
106
112
  }
107
113
 
108
114
  // src/basketItems.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  setTipDonation
3
- } from "./chunk-6TIZWV2J.js";
4
- import "./chunk-RZZTEPBR.js";
5
- import "./chunk-WXX4N673.js";
3
+ } from "./chunk-NC7RAUNV.js";
4
+ import "./chunk-B7RLQXI6.js";
5
+ import "./chunk-IYCMZ5WV.js";
6
6
  export {
7
7
  setTipDonation
8
8
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseShopError
3
- } from "./chunk-WXX4N673.js";
3
+ } from "./chunk-IYCMZ5WV.js";
4
4
 
5
5
  // src/basket.ts
6
6
  import { gql } from "@apollo/client/core";
@@ -34,7 +34,7 @@ async function createBasket(apollo) {
34
34
  }
35
35
  function hasBasketExpired(error) {
36
36
  const errorCode = error?.code ?? error?.extensions?.code ?? error?.name ?? "";
37
- return ["shop.invalidBasketId", "shop.basketRequired"].includes(errorCode);
37
+ return ["shop.invalidBasketId", "shop.basketRequired", "shop.alreadyCheckedOut"].includes(errorCode);
38
38
  }
39
39
 
40
40
  export {
@@ -19,12 +19,18 @@ function parseShopError(error) {
19
19
  original: error
20
20
  }, "There was a problem validating your payment information. Please double-check the details and try again.");
21
21
  }
22
- if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired") {
22
+ if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired" || errorCode === "shop.alreadyCheckedOut") {
23
23
  return new ShopError({
24
24
  code: errorCode,
25
25
  original: error
26
26
  }, "There was a problem with your basket. Please, refresh the page and try again.");
27
27
  }
28
+ if (errorCode === "donationAmountTooLarge") {
29
+ return new ShopError({
30
+ code: errorCode,
31
+ original: error
32
+ }, errorMessage);
33
+ }
28
34
  return new ShopError({
29
35
  code: "shop.unknown",
30
36
  original: error
@@ -2,11 +2,11 @@ import {
2
2
  createBasket,
3
3
  getBasketID,
4
4
  hasBasketExpired
5
- } from "./chunk-RZZTEPBR.js";
5
+ } from "./chunk-B7RLQXI6.js";
6
6
  import {
7
7
  ShopError,
8
8
  parseShopError
9
- } from "./chunk-WXX4N673.js";
9
+ } from "./chunk-IYCMZ5WV.js";
10
10
 
11
11
  // src/basketItems.ts
12
12
  import { gql } from "@apollo/client/core";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ShopError,
3
3
  parseShopError
4
- } from "./chunk-WXX4N673.js";
4
+ } from "./chunk-IYCMZ5WV.js";
5
5
 
6
6
  // src/useBraintreeDropIn.ts
7
7
  import { gql } from "@apollo/client/core";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ShopError,
3
3
  parseShopError
4
- } from "./chunk-WXX4N673.js";
4
+ } from "./chunk-IYCMZ5WV.js";
5
5
 
6
6
  // src/subscriptionCheckout.ts
7
7
  import { gql } from "@apollo/client/core";
package/dist/index.cjs CHANGED
@@ -72,12 +72,18 @@ function parseShopError(error) {
72
72
  original: error
73
73
  }, "There was a problem validating your payment information. Please double-check the details and try again.");
74
74
  }
75
- if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired") {
75
+ if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired" || errorCode === "shop.alreadyCheckedOut") {
76
76
  return new ShopError({
77
77
  code: errorCode,
78
78
  original: error
79
79
  }, "There was a problem with your basket. Please, refresh the page and try again.");
80
80
  }
81
+ if (errorCode === "donationAmountTooLarge") {
82
+ return new ShopError({
83
+ code: errorCode,
84
+ original: error
85
+ }, errorMessage);
86
+ }
81
87
  return new ShopError({
82
88
  code: "shop.unknown",
83
89
  original: error
@@ -115,7 +121,7 @@ async function createBasket(apollo) {
115
121
  }
116
122
  function hasBasketExpired(error) {
117
123
  const errorCode = error?.code ?? error?.extensions?.code ?? error?.name ?? "";
118
- return ["shop.invalidBasketId", "shop.basketRequired"].includes(errorCode);
124
+ return ["shop.invalidBasketId", "shop.basketRequired", "shop.alreadyCheckedOut"].includes(errorCode);
119
125
  }
120
126
 
121
127
  // src/basketItems.ts
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setTipDonation
3
- } from "./chunk-6TIZWV2J.js";
3
+ } from "./chunk-NC7RAUNV.js";
4
4
  import {
5
5
  createBasket,
6
6
  getBasketID,
@@ -8,7 +8,7 @@ import {
8
8
  hasBasketExpired,
9
9
  setBasketID,
10
10
  setCookieValue
11
- } from "./chunk-RZZTEPBR.js";
11
+ } from "./chunk-B7RLQXI6.js";
12
12
  import {
13
13
  executeOneTimeCheckout,
14
14
  waitOnTransaction
@@ -16,16 +16,16 @@ import {
16
16
  import {
17
17
  checkSubscriptionStatus,
18
18
  executeNewSubscriptionCheckout
19
- } from "./chunk-O63WXJQ5.js";
19
+ } from "./chunk-TIASV6B2.js";
20
20
  import {
21
21
  defaultPaymentTypes,
22
22
  getClientToken,
23
23
  useBraintreeDropIn
24
- } from "./chunk-VHRGXVDB.js";
24
+ } from "./chunk-SLMBU6L7.js";
25
25
  import {
26
26
  ShopError,
27
27
  parseShopError
28
- } from "./chunk-WXX4N673.js";
28
+ } from "./chunk-IYCMZ5WV.js";
29
29
  export {
30
30
  ShopError,
31
31
  checkSubscriptionStatus,
@@ -43,12 +43,18 @@ function parseShopError(error) {
43
43
  original: error
44
44
  }, "There was a problem validating your payment information. Please double-check the details and try again.");
45
45
  }
46
- if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired") {
46
+ if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired" || errorCode === "shop.alreadyCheckedOut") {
47
47
  return new ShopError({
48
48
  code: errorCode,
49
49
  original: error
50
50
  }, "There was a problem with your basket. Please, refresh the page and try again.");
51
51
  }
52
+ if (errorCode === "donationAmountTooLarge") {
53
+ return new ShopError({
54
+ code: errorCode,
55
+ original: error
56
+ }, errorMessage);
57
+ }
52
58
  return new ShopError({
53
59
  code: "shop.unknown",
54
60
  original: error
package/dist/shopError.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ShopError,
3
3
  parseShopError
4
- } from "./chunk-WXX4N673.js";
4
+ } from "./chunk-IYCMZ5WV.js";
5
5
  export {
6
6
  ShopError,
7
7
  parseShopError
@@ -46,12 +46,18 @@ function parseShopError(error) {
46
46
  original: error
47
47
  }, "There was a problem validating your payment information. Please double-check the details and try again.");
48
48
  }
49
- if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired") {
49
+ if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired" || errorCode === "shop.alreadyCheckedOut") {
50
50
  return new ShopError({
51
51
  code: errorCode,
52
52
  original: error
53
53
  }, "There was a problem with your basket. Please, refresh the page and try again.");
54
54
  }
55
+ if (errorCode === "donationAmountTooLarge") {
56
+ return new ShopError({
57
+ code: errorCode,
58
+ original: error
59
+ }, errorMessage);
60
+ }
55
61
  return new ShopError({
56
62
  code: "shop.unknown",
57
63
  original: error
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  checkSubscriptionStatus,
3
3
  executeNewSubscriptionCheckout
4
- } from "./chunk-O63WXJQ5.js";
5
- import "./chunk-WXX4N673.js";
4
+ } from "./chunk-TIASV6B2.js";
5
+ import "./chunk-IYCMZ5WV.js";
6
6
  export {
7
7
  checkSubscriptionStatus,
8
8
  executeNewSubscriptionCheckout
@@ -59,12 +59,18 @@ function parseShopError(error) {
59
59
  original: error
60
60
  }, "There was a problem validating your payment information. Please double-check the details and try again.");
61
61
  }
62
- if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired") {
62
+ if (errorCode === "shop.invalidBasketId" || errorCode === "shop.basketRequired" || errorCode === "shop.alreadyCheckedOut") {
63
63
  return new ShopError({
64
64
  code: errorCode,
65
65
  original: error
66
66
  }, "There was a problem with your basket. Please, refresh the page and try again.");
67
67
  }
68
+ if (errorCode === "donationAmountTooLarge") {
69
+ return new ShopError({
70
+ code: errorCode,
71
+ original: error
72
+ }, errorMessage);
73
+ }
68
74
  return new ShopError({
69
75
  code: "shop.unknown",
70
76
  original: error
@@ -2,8 +2,8 @@ import {
2
2
  defaultPaymentTypes,
3
3
  getClientToken,
4
4
  useBraintreeDropIn
5
- } from "./chunk-VHRGXVDB.js";
6
- import "./chunk-WXX4N673.js";
5
+ } from "./chunk-SLMBU6L7.js";
6
+ import "./chunk-IYCMZ5WV.js";
7
7
  export {
8
8
  useBraintreeDropIn as default,
9
9
  defaultPaymentTypes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-shop",
3
- "version": "1.2.33",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@apollo/client": "^3.7.14",
41
- "@kiva/kv-components": "^3.46.2",
41
+ "@kiva/kv-components": "^3.46.3",
42
42
  "@types/braintree-web-drop-in": "^1.34.2",
43
43
  "braintree-web-drop-in": "^1.37.0",
44
44
  "numeral": "^2.0.6",
@@ -53,5 +53,5 @@
53
53
  "optional": true
54
54
  }
55
55
  },
56
- "gitHead": "4b787763e203554045ea484e99a4ecb875875442"
56
+ "gitHead": "6fc84d328af54b57e6f9b9b1c409ce4a695d2b10"
57
57
  }