@smartbills/react-hooks-sdk 0.0.2-alpha.27 → 0.0.2-alpha.29

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.
Files changed (58) hide show
  1. package/dist/@types/index.d.ts +6 -6
  2. package/dist/cjs/apis/bank-accounts/BankAccountAPI.cjs +4 -4
  3. package/dist/cjs/apis/bank-accounts/BankAccountAPI.cjs.map +1 -1
  4. package/dist/cjs/apis/bank-transactions/BankTransactionAPI.cjs +2 -2
  5. package/dist/cjs/apis/bank-transactions/BankTransactionAPI.cjs.map +1 -1
  6. package/dist/cjs/apis/banks/BanksAPI.cjs +2 -2
  7. package/dist/cjs/apis/banks/BanksAPI.cjs.map +1 -1
  8. package/dist/cjs/apis/customers/CustomerAPI.cjs +16 -26
  9. package/dist/cjs/apis/customers/CustomerAPI.cjs.map +1 -1
  10. package/dist/cjs/apis/domains/DomainAPI.cjs +2 -2
  11. package/dist/cjs/apis/domains/DomainAPI.cjs.map +1 -1
  12. package/dist/cjs/apis/locations/LocationsAPI.cjs +2 -2
  13. package/dist/cjs/apis/locations/LocationsAPI.cjs.map +1 -1
  14. package/dist/cjs/apis/merchants/MerchantAPI.cjs +2 -2
  15. package/dist/cjs/apis/merchants/MerchantAPI.cjs.map +1 -1
  16. package/dist/cjs/apis/organizations/OrganizationsAPI.cjs +4 -4
  17. package/dist/cjs/apis/organizations/OrganizationsAPI.cjs.map +1 -1
  18. package/dist/cjs/apis/payment-methods/PaymentMethodsAPI.cjs +6 -6
  19. package/dist/cjs/apis/payment-methods/PaymentMethodsAPI.cjs.map +1 -1
  20. package/dist/cjs/apis/promo-codes/PromoCodesAPI.cjs +2 -2
  21. package/dist/cjs/apis/promo-codes/PromoCodesAPI.cjs.map +1 -1
  22. package/dist/cjs/apis/receipts/ReceiptAPI.cjs +2 -2
  23. package/dist/cjs/apis/receipts/ReceiptAPI.cjs.map +1 -1
  24. package/dist/cjs/apis/reviews/ReviewsAPI.cjs +2 -2
  25. package/dist/cjs/apis/reviews/ReviewsAPI.cjs.map +1 -1
  26. package/dist/cjs/apis/users/UsersAPI.cjs +2 -2
  27. package/dist/cjs/apis/users/UsersAPI.cjs.map +1 -1
  28. package/dist/cjs/index.cjs +3 -3
  29. package/dist/esm/apis/bank-accounts/BankAccountAPI.mjs +4 -4
  30. package/dist/esm/apis/bank-accounts/BankAccountAPI.mjs.map +1 -1
  31. package/dist/esm/apis/bank-transactions/BankTransactionAPI.mjs +2 -2
  32. package/dist/esm/apis/bank-transactions/BankTransactionAPI.mjs.map +1 -1
  33. package/dist/esm/apis/banks/BanksAPI.mjs +2 -2
  34. package/dist/esm/apis/banks/BanksAPI.mjs.map +1 -1
  35. package/dist/esm/apis/customers/CustomerAPI.mjs +16 -26
  36. package/dist/esm/apis/customers/CustomerAPI.mjs.map +1 -1
  37. package/dist/esm/apis/domains/DomainAPI.mjs +2 -2
  38. package/dist/esm/apis/domains/DomainAPI.mjs.map +1 -1
  39. package/dist/esm/apis/locations/LocationsAPI.mjs +2 -2
  40. package/dist/esm/apis/locations/LocationsAPI.mjs.map +1 -1
  41. package/dist/esm/apis/merchants/MerchantAPI.mjs +2 -2
  42. package/dist/esm/apis/merchants/MerchantAPI.mjs.map +1 -1
  43. package/dist/esm/apis/organizations/OrganizationsAPI.mjs +4 -4
  44. package/dist/esm/apis/organizations/OrganizationsAPI.mjs.map +1 -1
  45. package/dist/esm/apis/payment-methods/PaymentMethodsAPI.mjs +4 -4
  46. package/dist/esm/apis/payment-methods/PaymentMethodsAPI.mjs.map +1 -1
  47. package/dist/esm/apis/promo-codes/PromoCodesAPI.mjs +2 -2
  48. package/dist/esm/apis/promo-codes/PromoCodesAPI.mjs.map +1 -1
  49. package/dist/esm/apis/receipts/ReceiptAPI.mjs +2 -2
  50. package/dist/esm/apis/receipts/ReceiptAPI.mjs.map +1 -1
  51. package/dist/esm/apis/reviews/ReviewsAPI.mjs +2 -2
  52. package/dist/esm/apis/reviews/ReviewsAPI.mjs.map +1 -1
  53. package/dist/esm/apis/users/UsersAPI.mjs +2 -2
  54. package/dist/esm/apis/users/UsersAPI.mjs.map +1 -1
  55. package/dist/esm/index.mjs +1 -1
  56. package/dist/umd/index.js +48 -58
  57. package/dist/umd/index.js.map +1 -1
  58. package/package.json +4 -4
package/dist/umd/index.js CHANGED
@@ -89,16 +89,16 @@
89
89
  return client.bankAccounts.listTransactions(id, request, options, config);
90
90
  },
91
91
  getPreviousPageParam: firstPage => {
92
- if (firstPage.metadata.currentPage === 1) {
92
+ if (firstPage.pagination.currentPage === 1) {
93
93
  return 1;
94
94
  }
95
- return firstPage.metadata.currentPage - 1;
95
+ return firstPage.pagination.currentPage - 1;
96
96
  },
97
97
  getNextPageParam: lastPage => {
98
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
98
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
99
99
  return undefined;
100
100
  }
101
- return lastPage.metadata.currentPage + 1;
101
+ return lastPage.pagination.currentPage + 1;
102
102
  }
103
103
  });
104
104
  };
@@ -117,10 +117,10 @@
117
117
  });
118
118
  },
119
119
  getNextPageParam: lastPage => {
120
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
120
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
121
121
  return undefined;
122
122
  }
123
- return lastPage.metadata.currentPage + 1;
123
+ return lastPage.pagination.currentPage + 1;
124
124
  }
125
125
  });
126
126
  };
@@ -300,10 +300,10 @@
300
300
  });
301
301
  },
302
302
  getNextPageParam: lastPage => {
303
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
303
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
304
304
  return undefined;
305
305
  }
306
- return lastPage.metadata.currentPage + 1;
306
+ return lastPage.pagination.currentPage + 1;
307
307
  }
308
308
  });
309
309
  };
@@ -579,10 +579,10 @@
579
579
  }, options, config);
580
580
  },
581
581
  getNextPageParam: lastPage => {
582
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
582
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
583
583
  return undefined;
584
584
  }
585
- return lastPage.metadata.currentPage + 1;
585
+ return lastPage.pagination.currentPage + 1;
586
586
  }
587
587
  });
588
588
  };
@@ -664,40 +664,28 @@
664
664
  const client = useApiClient();
665
665
  return reactQuery.useInfiniteQuery({
666
666
  queryKey: [CUSTOMER_KEY],
667
- queryFn: async () => {
668
- try {
669
- return await client.customers.list(request, options);
670
- } catch (exception) {
671
- throw exception;
672
- }
673
- },
667
+ queryFn: client.customers.list,
674
668
  initialPageParam: 1,
675
669
  getNextPageParam: (lastPage, allPages, lastPageParam) => {
676
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
670
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
677
671
  return undefined;
678
672
  }
679
673
  return lastPageParam + 1;
680
674
  },
681
675
  getPreviousPageParam: (firstPage, allPages, firstPageParam) => {
682
- if (firstPage.metadata.currentPage <= 1) {
676
+ if (firstPage.pagination.currentPage <= 1) {
683
677
  return undefined;
684
678
  }
685
679
  return firstPageParam - 1;
686
680
  }
687
681
  });
688
682
  };
689
- const useCreateCustomerMutation = (request, options) => {
683
+ const useCreateCustomerMutation = () => {
690
684
  const client = useApiClient();
691
685
  return reactQuery.useMutation({
692
686
  mutationKey: [CUSTOMER_KEY],
693
- mutationFn: async () => {
694
- try {
695
- return await client.customers.create(request, options);
696
- } catch (exception) {
697
- throw exception;
698
- }
699
- },
700
- onMutate: async Customer => {
687
+ mutationFn: client.customers.create,
688
+ onMutate: async customer => {
701
689
  await queryClient.cancelQueries({
702
690
  queryKey: [CUSTOMER_KEY]
703
691
  });
@@ -718,16 +706,18 @@
718
706
  }
719
707
  });
720
708
  };
721
- const useDeleteCustomerMutation = (id, options) => {
709
+ const useDeleteCustomerMutation = () => {
722
710
  const client = useApiClient();
723
711
  return reactQuery.useMutation({
724
- mutationKey: [CUSTOMER_KEY, id],
725
- mutationFn: async () => {
726
- try {
727
- return await client.customers.delete(id, options);
728
- } catch (exception) {
729
- throw exception;
730
- }
712
+ mutationKey: [CUSTOMER_KEY],
713
+ mutationFn: client.customers.delete,
714
+ onSuccess: async (response, id) => {
715
+ await queryClient.invalidateQueries({
716
+ queryKey: [CUSTOMER_KEY, id]
717
+ });
718
+ queryClient.removeQueries({
719
+ queryKey: [CUSTOMER_KEY, id]
720
+ });
731
721
  },
732
722
  onMutate: async Customer => {
733
723
  await queryClient.cancelQueries({
@@ -765,10 +755,10 @@
765
755
  }, options, config);
766
756
  },
767
757
  getNextPageParam: lastPage => {
768
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
758
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
769
759
  return undefined;
770
760
  }
771
- return lastPage.metadata.currentPage + 1;
761
+ return lastPage.pagination.currentPage + 1;
772
762
  }
773
763
  });
774
764
  };
@@ -824,10 +814,10 @@
824
814
  }, options, config);
825
815
  },
826
816
  getNextPageParam: lastPage => {
827
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
817
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
828
818
  return undefined;
829
819
  }
830
- return lastPage.metadata.currentPage + 1;
820
+ return lastPage.pagination.currentPage + 1;
831
821
  }
832
822
  });
833
823
  };
@@ -942,16 +932,16 @@
942
932
  }, options, config);
943
933
  },
944
934
  getPreviousPageParam: firstPage => {
945
- if (firstPage.metadata.currentPage === 1) {
935
+ if (firstPage.pagination.currentPage === 1) {
946
936
  return undefined;
947
937
  }
948
- return firstPage.metadata.currentPage - 1;
938
+ return firstPage.pagination.currentPage - 1;
949
939
  },
950
940
  getNextPageParam: lastPage => {
951
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
941
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
952
942
  return undefined;
953
943
  }
954
- return lastPage.metadata.currentPage + 1;
944
+ return lastPage.pagination.currentPage + 1;
955
945
  }
956
946
  });
957
947
  };
@@ -1051,7 +1041,7 @@
1051
1041
  });
1052
1042
  };
1053
1043
 
1054
- const useCreatePaymentMethod = () => {
1044
+ const useCreatePaymentMethodMutation = () => {
1055
1045
  const client = useApiClient();
1056
1046
  return reactQuery.useMutation({
1057
1047
  mutationFn: async (request, options, config) => {
@@ -1082,7 +1072,7 @@
1082
1072
  }
1083
1073
  });
1084
1074
  };
1085
- const useDeletePaymentMethod = () => {
1075
+ const useDeletePaymentMethodMutation = () => {
1086
1076
  const client = useApiClient();
1087
1077
  return reactQuery.useMutation({
1088
1078
  mutationFn: async (id, options, config) => {
@@ -1095,7 +1085,7 @@
1095
1085
  }
1096
1086
  });
1097
1087
  };
1098
- const useSetupPaymentMethod = () => {
1088
+ const useSetupPaymentMethodMutation = () => {
1099
1089
  const client = useApiClient();
1100
1090
  return reactQuery.useMutation({
1101
1091
  mutationFn: async (_, options, config) => {
@@ -1118,10 +1108,10 @@
1118
1108
  }, options, config);
1119
1109
  },
1120
1110
  getNextPageParam: lastPage => {
1121
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
1111
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
1122
1112
  return undefined;
1123
1113
  }
1124
- return lastPage.metadata.currentPage + 1;
1114
+ return lastPage.pagination.currentPage + 1;
1125
1115
  }
1126
1116
  });
1127
1117
  };
@@ -1212,13 +1202,13 @@
1212
1202
  },
1213
1203
  initialPageParam: 1,
1214
1204
  getNextPageParam: (lastPage, allPages, lastPageParam) => {
1215
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
1205
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
1216
1206
  return undefined;
1217
1207
  }
1218
1208
  return lastPageParam + 1;
1219
1209
  },
1220
1210
  getPreviousPageParam: (firstPage, allPages, firstPageParam) => {
1221
- if (firstPage.metadata.currentPage == 1) {
1211
+ if (firstPage.pagination.currentPage == 1) {
1222
1212
  return undefined;
1223
1213
  }
1224
1214
  return firstPageParam - 1;
@@ -1277,10 +1267,10 @@
1277
1267
  }
1278
1268
  },
1279
1269
  getNextPageParam: lastPage => {
1280
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
1270
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
1281
1271
  return undefined;
1282
1272
  }
1283
- return lastPage.metadata.currentPage + 1;
1273
+ return lastPage.pagination.currentPage + 1;
1284
1274
  }
1285
1275
  });
1286
1276
  };
@@ -1459,10 +1449,10 @@
1459
1449
  }, options, config);
1460
1450
  },
1461
1451
  getNextPageParam: lastPage => {
1462
- if (lastPage.metadata.currentPage === lastPage.metadata.pageCount) {
1452
+ if (lastPage.pagination.currentPage === lastPage.pagination.pageCount) {
1463
1453
  return undefined;
1464
1454
  }
1465
- return lastPage.metadata.currentPage + 1;
1455
+ return lastPage.pagination.currentPage + 1;
1466
1456
  }
1467
1457
  });
1468
1458
  };
@@ -1488,7 +1478,7 @@
1488
1478
  exports.useCreateLocationMutation = useCreateLocationMutation;
1489
1479
  exports.useCreateMerchantMutation = useCreateMerchantMutation;
1490
1480
  exports.useCreateOrganizationMutation = useCreateOrganizationMutation;
1491
- exports.useCreatePaymentMethod = useCreatePaymentMethod;
1481
+ exports.useCreatePaymentMethodMutation = useCreatePaymentMethodMutation;
1492
1482
  exports.useCreatePromoCodeMutation = useCreatePromoCodeMutation;
1493
1483
  exports.useCreateReviewMutation = useCreateReviewMutation;
1494
1484
  exports.useCreateTaxMutation = useCreateTaxMutation;
@@ -1501,7 +1491,7 @@
1501
1491
  exports.useDeleteMerchantMutation = useDeleteMerchantMutation;
1502
1492
  exports.useDeleteOrganizationMember = useDeleteOrganizationMember;
1503
1493
  exports.useDeleteOrganizationMutation = useDeleteOrganizationMutation;
1504
- exports.useDeletePaymentMethod = useDeletePaymentMethod;
1494
+ exports.useDeletePaymentMethodMutation = useDeletePaymentMethodMutation;
1505
1495
  exports.useDeletePromoCodeMutation = useDeletePromoCodeMutation;
1506
1496
  exports.useDeleteReceiptMutation = useDeleteReceiptMutation;
1507
1497
  exports.useDeleteReviewMutation = useDeleteReviewMutation;
@@ -1554,7 +1544,7 @@
1554
1544
  exports.useListTaxes = useListTaxes;
1555
1545
  exports.useRefreshTokenMutation = useRefreshTokenMutation;
1556
1546
  exports.useSearchUsers = useSearchUsers;
1557
- exports.useSetupPaymentMethod = useSetupPaymentMethod;
1547
+ exports.useSetupPaymentMethodMutation = useSetupPaymentMethodMutation;
1558
1548
  exports.useUpdateLocationMutation = useUpdateLocationMutation;
1559
1549
  exports.useUpdateMerchantMutation = useUpdateMerchantMutation;
1560
1550
  exports.useUpdateOrganizationMutation = useUpdateOrganizationMutation;