@kiva/kv-shop 1.1.5 → 1.1.7

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.
@@ -97,10 +97,10 @@ async function setTipDonation({ amount, apollo }) {
97
97
  basketId: getBasketID()
98
98
  }
99
99
  });
100
- if (result.error || result.errors.length) {
101
- error = result.error ?? result.errors[0];
100
+ if (result?.error || result?.errors?.length) {
101
+ error = result?.error ?? result?.errors?.[0];
102
102
  } else {
103
- data = result.data;
103
+ data = result?.data;
104
104
  }
105
105
  } catch (e) {
106
106
  error = e;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setTipDonation
3
- } from "./chunk-KSEC5YWO.js";
3
+ } from "./chunk-AEAZBR36.js";
4
4
  import "./chunk-F6QCMBHV.js";
5
5
  import "./chunk-H35VQXDR.js";
6
6
  export {
@@ -32,10 +32,10 @@ async function setTipDonation({ amount, apollo }) {
32
32
  basketId: getBasketID()
33
33
  }
34
34
  });
35
- if (result.error || result.errors.length) {
36
- error = result.error ?? result.errors[0];
35
+ if (result?.error || result?.errors?.length) {
36
+ error = result?.error ?? result?.errors?.[0];
37
37
  } else {
38
- data = result.data;
38
+ data = result?.data;
39
39
  }
40
40
  } catch (e) {
41
41
  error = e;
@@ -17,8 +17,8 @@ async function getClientToken(apollo) {
17
17
  }
18
18
  }`
19
19
  });
20
- if (error || errors.length) {
21
- throw parseShopError(error ?? errors[0]);
20
+ if (error || errors?.length) {
21
+ throw parseShopError(error ?? errors?.[0]);
22
22
  }
23
23
  return data?.shop?.getClientToken;
24
24
  }
@@ -77,10 +77,10 @@ async function executeNewSubscriptionCheckout({
77
77
  }
78
78
  }`
79
79
  });
80
- if (result.error || result.errors.length) {
81
- error = result.error ?? result.errors[0];
80
+ if (result?.error || result?.errors?.length) {
81
+ error = result?.error ?? result?.errors?.[0];
82
82
  } else {
83
- data = result.data;
83
+ data = result?.data;
84
84
  }
85
85
  } catch (e) {
86
86
  error = e;
package/dist/index.cjs CHANGED
@@ -113,10 +113,10 @@ async function setTipDonation({ amount, apollo }) {
113
113
  basketId: getBasketID()
114
114
  }
115
115
  });
116
- if (result.error || result.errors.length) {
117
- error = result.error ?? result.errors[0];
116
+ if (result?.error || result?.errors?.length) {
117
+ error = result?.error ?? result?.errors?.[0];
118
118
  } else {
119
- data = result.data;
119
+ data = result?.data;
120
120
  }
121
121
  } catch (e) {
122
122
  error = e;
@@ -223,10 +223,10 @@ async function executeNewSubscriptionCheckout({
223
223
  }
224
224
  }`
225
225
  });
226
- if (result.error || result.errors.length) {
227
- error = result.error ?? result.errors[0];
226
+ if (result?.error || result?.errors?.length) {
227
+ error = result?.error ?? result?.errors?.[0];
228
228
  } else {
229
- data = result.data;
229
+ data = result?.data;
230
230
  }
231
231
  } catch (e) {
232
232
  error = e;
@@ -258,8 +258,8 @@ async function getClientToken(apollo) {
258
258
  }
259
259
  }`
260
260
  });
261
- if (error || errors.length) {
262
- throw parseShopError(error ?? errors[0]);
261
+ if (error || errors?.length) {
262
+ throw parseShopError(error ?? errors?.[0]);
263
263
  }
264
264
  return data?.shop?.getClientToken;
265
265
  }
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setTipDonation
3
- } from "./chunk-KSEC5YWO.js";
3
+ } from "./chunk-AEAZBR36.js";
4
4
  import {
5
5
  getBasketID,
6
6
  getCookieValue,
@@ -13,12 +13,12 @@ import {
13
13
  import {
14
14
  checkSubscriptionStatus,
15
15
  executeNewSubscriptionCheckout
16
- } from "./chunk-V2I7V4QJ.js";
16
+ } from "./chunk-LWEH4UKM.js";
17
17
  import {
18
18
  defaultPaymentTypes,
19
19
  getClientToken,
20
20
  useBraintreeDropIn
21
- } from "./chunk-R27YZQKP.js";
21
+ } from "./chunk-HWDTIIXN.js";
22
22
  import {
23
23
  ShopError,
24
24
  parseShopError
@@ -125,10 +125,10 @@ async function executeNewSubscriptionCheckout({
125
125
  }
126
126
  }`
127
127
  });
128
- if (result.error || result.errors.length) {
129
- error = result.error ?? result.errors[0];
128
+ if (result?.error || result?.errors?.length) {
129
+ error = result?.error ?? result?.errors?.[0];
130
130
  } else {
131
- data = result.data;
131
+ data = result?.data;
132
132
  }
133
133
  } catch (e) {
134
134
  error = e;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  checkSubscriptionStatus,
3
3
  executeNewSubscriptionCheckout
4
- } from "./chunk-V2I7V4QJ.js";
4
+ } from "./chunk-LWEH4UKM.js";
5
5
  import "./chunk-H35VQXDR.js";
6
6
  export {
7
7
  checkSubscriptionStatus,
@@ -76,8 +76,8 @@ async function getClientToken(apollo) {
76
76
  }
77
77
  }`
78
78
  });
79
- if (error || errors.length) {
80
- throw parseShopError(error ?? errors[0]);
79
+ if (error || errors?.length) {
80
+ throw parseShopError(error ?? errors?.[0]);
81
81
  }
82
82
  return data?.shop?.getClientToken;
83
83
  }
@@ -2,7 +2,7 @@ import {
2
2
  defaultPaymentTypes,
3
3
  getClientToken,
4
4
  useBraintreeDropIn
5
- } from "./chunk-R27YZQKP.js";
5
+ } from "./chunk-HWDTIIXN.js";
6
6
  import "./chunk-H35VQXDR.js";
7
7
  export {
8
8
  useBraintreeDropIn as default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-shop",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
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.22.1",
41
+ "@kiva/kv-components": "^3.22.2",
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": "352f3fda590da17b49c7cc4538228309acbf1da0"
56
+ "gitHead": "c29465a89a0cd252816abf35539038dfa0a6560d"
57
57
  }