@kiva/kv-shop 1.6.1 → 1.6.3

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.
@@ -26,7 +26,7 @@ async function getReceiptItems(apollo, checkoutId) {
26
26
  let offset = 0;
27
27
  const observer = apollo.watchQuery({
28
28
  query: gql`
29
- query receiptItems($checkoutId: String, $visitorId: String, $limit: Int, $offset: Int) {
29
+ query receiptItems($checkoutId: Int, $visitorId: String, $limit: Int, $offset: Int) {
30
30
  shop {
31
31
  id
32
32
  receipt(checkoutId: $checkoutId, visitorId: $visitorId) {
@@ -114,10 +114,11 @@ async function getReceiptTotals(apollo, checkoutId) {
114
114
  return result.data?.shop?.receipt?.totals;
115
115
  }
116
116
  async function getCheckoutTrackingData(apollo, checkoutId, paymentType) {
117
+ const checkoutIdInt = parseInt(checkoutId, 10);
117
118
  const [isFTD, items, totals] = await Promise.all([
118
119
  getFTDStatus(apollo),
119
- getReceiptItems(apollo, checkoutId),
120
- getReceiptTotals(apollo, checkoutId)
120
+ getReceiptItems(apollo, checkoutIdInt),
121
+ getReceiptTotals(apollo, checkoutIdInt)
121
122
  ]);
122
123
  const loans = items.filter((item) => item.__typename === "LoanReservation");
123
124
  const donations = items.filter((item) => item.__typename === "Donation");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getCheckoutTrackingData
3
- } from "./chunk-5V5F6M6B.js";
3
+ } from "./chunk-2NBRXSIM.js";
4
4
  import {
5
5
  validatePreCheckout
6
6
  } from "./chunk-JBQ2KNMP.js";
@@ -115,13 +115,17 @@ async function depositCheckout({
115
115
  }
116
116
  }
117
117
  async function trackSuccess(apollo, checkoutId, paymentType) {
118
- const transactionData = await getCheckoutTrackingData(
119
- apollo,
120
- checkoutId,
121
- paymentType
122
- );
123
- trackTransaction(transactionData);
124
- await wait(800);
118
+ try {
119
+ const transactionData = await getCheckoutTrackingData(
120
+ apollo,
121
+ checkoutId,
122
+ paymentType
123
+ );
124
+ trackTransaction(transactionData);
125
+ await wait(800);
126
+ } catch (e) {
127
+ console.error("Error tracking transaction", e);
128
+ }
125
129
  }
126
130
  async function executeOneTimeCheckout({
127
131
  apollo,
package/dist/index.cjs CHANGED
@@ -522,7 +522,7 @@ async function getReceiptItems(apollo, checkoutId) {
522
522
  let offset = 0;
523
523
  const observer = apollo.watchQuery({
524
524
  query: import_core7.gql`
525
- query receiptItems($checkoutId: String, $visitorId: String, $limit: Int, $offset: Int) {
525
+ query receiptItems($checkoutId: Int, $visitorId: String, $limit: Int, $offset: Int) {
526
526
  shop {
527
527
  id
528
528
  receipt(checkoutId: $checkoutId, visitorId: $visitorId) {
@@ -610,10 +610,11 @@ async function getReceiptTotals(apollo, checkoutId) {
610
610
  return result.data?.shop?.receipt?.totals;
611
611
  }
612
612
  async function getCheckoutTrackingData(apollo, checkoutId, paymentType) {
613
+ const checkoutIdInt = parseInt(checkoutId, 10);
613
614
  const [isFTD, items, totals] = await Promise.all([
614
615
  getFTDStatus(apollo),
615
- getReceiptItems(apollo, checkoutId),
616
- getReceiptTotals(apollo, checkoutId)
616
+ getReceiptItems(apollo, checkoutIdInt),
617
+ getReceiptTotals(apollo, checkoutIdInt)
617
618
  ]);
618
619
  const loans = items.filter((item) => item.__typename === "LoanReservation");
619
620
  const donations = items.filter((item) => item.__typename === "Donation");
@@ -734,13 +735,17 @@ async function depositCheckout({
734
735
  }
735
736
  }
736
737
  async function trackSuccess(apollo, checkoutId, paymentType) {
737
- const transactionData = await getCheckoutTrackingData(
738
- apollo,
739
- checkoutId,
740
- paymentType
741
- );
742
- (0, import_kv_analytics.trackTransaction)(transactionData);
743
- await wait(800);
738
+ try {
739
+ const transactionData = await getCheckoutTrackingData(
740
+ apollo,
741
+ checkoutId,
742
+ paymentType
743
+ );
744
+ (0, import_kv_analytics.trackTransaction)(transactionData);
745
+ await wait(800);
746
+ } catch (e) {
747
+ console.error("Error tracking transaction", e);
748
+ }
744
749
  }
745
750
  async function executeOneTimeCheckout({
746
751
  apollo,
package/dist/index.js CHANGED
@@ -24,13 +24,13 @@ import {
24
24
  } from "./chunk-FCAOCO7O.js";
25
25
  import {
26
26
  executeOneTimeCheckout
27
- } from "./chunk-6BO6KDZ5.js";
27
+ } from "./chunk-IQRID7QX.js";
28
28
  import {
29
29
  getCheckoutTrackingData,
30
30
  getFTDStatus,
31
31
  getReceiptItems,
32
32
  getReceiptTotals
33
- } from "./chunk-5V5F6M6B.js";
33
+ } from "./chunk-2NBRXSIM.js";
34
34
  import {
35
35
  validatePreCheckout,
36
36
  validatePreCheckoutMutation
@@ -335,7 +335,7 @@ async function getReceiptItems(apollo, checkoutId) {
335
335
  let offset = 0;
336
336
  const observer = apollo.watchQuery({
337
337
  query: import_core4.gql`
338
- query receiptItems($checkoutId: String, $visitorId: String, $limit: Int, $offset: Int) {
338
+ query receiptItems($checkoutId: Int, $visitorId: String, $limit: Int, $offset: Int) {
339
339
  shop {
340
340
  id
341
341
  receipt(checkoutId: $checkoutId, visitorId: $visitorId) {
@@ -423,10 +423,11 @@ async function getReceiptTotals(apollo, checkoutId) {
423
423
  return result.data?.shop?.receipt?.totals;
424
424
  }
425
425
  async function getCheckoutTrackingData(apollo, checkoutId, paymentType) {
426
+ const checkoutIdInt = parseInt(checkoutId, 10);
426
427
  const [isFTD, items, totals] = await Promise.all([
427
428
  getFTDStatus(apollo),
428
- getReceiptItems(apollo, checkoutId),
429
- getReceiptTotals(apollo, checkoutId)
429
+ getReceiptItems(apollo, checkoutIdInt),
430
+ getReceiptTotals(apollo, checkoutIdInt)
430
431
  ]);
431
432
  const loans = items.filter((item) => item.__typename === "LoanReservation");
432
433
  const donations = items.filter((item) => item.__typename === "Donation");
@@ -547,13 +548,17 @@ async function depositCheckout({
547
548
  }
548
549
  }
549
550
  async function trackSuccess(apollo, checkoutId, paymentType) {
550
- const transactionData = await getCheckoutTrackingData(
551
- apollo,
552
- checkoutId,
553
- paymentType
554
- );
555
- (0, import_kv_analytics.trackTransaction)(transactionData);
556
- await wait(800);
551
+ try {
552
+ const transactionData = await getCheckoutTrackingData(
553
+ apollo,
554
+ checkoutId,
555
+ paymentType
556
+ );
557
+ (0, import_kv_analytics.trackTransaction)(transactionData);
558
+ await wait(800);
559
+ } catch (e) {
560
+ console.error("Error tracking transaction", e);
561
+ }
557
562
  }
558
563
  async function executeOneTimeCheckout({
559
564
  apollo,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeOneTimeCheckout
3
- } from "./chunk-6BO6KDZ5.js";
4
- import "./chunk-5V5F6M6B.js";
3
+ } from "./chunk-IQRID7QX.js";
4
+ import "./chunk-2NBRXSIM.js";
5
5
  import "./chunk-JBQ2KNMP.js";
6
6
  import "./chunk-CBJJUUVR.js";
7
7
  import "./chunk-2NC7LGGO.js";
package/dist/receipt.cjs CHANGED
@@ -62,7 +62,7 @@ async function getReceiptItems(apollo, checkoutId) {
62
62
  let offset = 0;
63
63
  const observer = apollo.watchQuery({
64
64
  query: import_core.gql`
65
- query receiptItems($checkoutId: String, $visitorId: String, $limit: Int, $offset: Int) {
65
+ query receiptItems($checkoutId: Int, $visitorId: String, $limit: Int, $offset: Int) {
66
66
  shop {
67
67
  id
68
68
  receipt(checkoutId: $checkoutId, visitorId: $visitorId) {
@@ -150,10 +150,11 @@ async function getReceiptTotals(apollo, checkoutId) {
150
150
  return result.data?.shop?.receipt?.totals;
151
151
  }
152
152
  async function getCheckoutTrackingData(apollo, checkoutId, paymentType) {
153
+ const checkoutIdInt = parseInt(checkoutId, 10);
153
154
  const [isFTD, items, totals] = await Promise.all([
154
155
  getFTDStatus(apollo),
155
- getReceiptItems(apollo, checkoutId),
156
- getReceiptTotals(apollo, checkoutId)
156
+ getReceiptItems(apollo, checkoutIdInt),
157
+ getReceiptTotals(apollo, checkoutIdInt)
157
158
  ]);
158
159
  const loans = items.filter((item) => item.__typename === "LoanReservation");
159
160
  const donations = items.filter((item) => item.__typename === "Donation");
package/dist/receipt.d.ts CHANGED
@@ -9,8 +9,8 @@ interface ReceiptItem {
9
9
  isTip?: boolean;
10
10
  isUserEdited?: boolean;
11
11
  }
12
- declare function getReceiptItems(apollo: ApolloClient<any>, checkoutId: string): Promise<ReceiptItem[]>;
13
- declare function getReceiptTotals(apollo: ApolloClient<any>, checkoutId: string): Promise<any>;
12
+ declare function getReceiptItems(apollo: ApolloClient<any>, checkoutId: number): Promise<ReceiptItem[]>;
13
+ declare function getReceiptTotals(apollo: ApolloClient<any>, checkoutId: number): Promise<any>;
14
14
  declare function getCheckoutTrackingData(apollo: ApolloClient<any>, checkoutId: string, paymentType: string): Promise<TransactionData>;
15
15
 
16
16
  export { getCheckoutTrackingData, getFTDStatus, getReceiptItems, getReceiptTotals };
package/dist/receipt.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  getFTDStatus,
4
4
  getReceiptItems,
5
5
  getReceiptTotals
6
- } from "./chunk-5V5F6M6B.js";
6
+ } from "./chunk-2NBRXSIM.js";
7
7
  import "./chunk-TPJPGUO7.js";
8
8
  import "./chunk-LZ4UMRCV.js";
9
9
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-shop",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -54,5 +54,5 @@
54
54
  "optional": true
55
55
  }
56
56
  },
57
- "gitHead": "dc15f1e63ad5077e854b8a033138a3a575608d7e"
57
+ "gitHead": "2493533dd1efd2bd1ad3cc7d43c7a510be3624ba"
58
58
  }