@bigbinary/neeto-webhooks-frontend 1.6.20 → 1.6.21

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/index.js CHANGED
@@ -121,21 +121,17 @@ var withReactQuery = function withReactQuery(Component) {
121
121
  return QueryWrapper;
122
122
  };
123
123
 
124
- var baseUrl$2 = "/webhooks/deliveries";
125
- var fetch$1 = function fetch(params) {
126
- return axios.get(baseUrl$2, {
124
+ var baseUrl$2 = "/webhooks";
125
+ var fetch$1 = function fetch(webhookId, params) {
126
+ return axios.get("".concat(baseUrl$2, "/webhooks/").concat(webhookId, "/deliveries"), {
127
127
  params: params
128
128
  });
129
129
  };
130
- var show$1 = function show(id) {
131
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
132
- return axios.get("".concat(baseUrl$2, "/").concat(id), {
133
- params: params
134
- });
130
+ var show$1 = function show(id, webhookId) {
131
+ return axios.get("".concat(baseUrl$2, "/webhooks/").concat(webhookId, "/deliveries/").concat(id));
135
132
  };
136
- var redeliver = function redeliver(delivery_id) {
137
- var payload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
138
- return axios.post("".concat(baseUrl$2, "/").concat(delivery_id, "/redeliver"), payload);
133
+ var redeliver = function redeliver(delivery_id, webhookId) {
134
+ return axios.post("".concat(baseUrl$2, "/webhooks/").concat(webhookId, "/deliveries/").concat(delivery_id, "/redeliver"));
139
135
  };
140
136
  var deliveriesApi = {
141
137
  fetch: fetch$1,
@@ -154,27 +150,25 @@ var DELIVERY_STALE_TIME = 3200000; // 1 hour
154
150
  var WEBHOOK_STALE_TIME = 3200000; // 1 hour
155
151
  var POST_REDELIVERY_ON_SUCCESS_TIMEOUT = 5000; // 5 seconds
156
152
 
157
- var useFetchDeliveries = function useFetchDeliveries(params) {
158
- return useQuery([QUERY_KEYS.DELIVERY_LIST, params], function () {
159
- return deliveriesApi.fetch(params);
153
+ var useFetchDeliveries = function useFetchDeliveries(webhookId, params) {
154
+ return useQuery([QUERY_KEYS.DELIVERY_LIST, webhookId, params], function () {
155
+ return deliveriesApi.fetch(webhookId, params);
160
156
  }, {
161
157
  staleTime: DELIVERY_STALE_TIME
162
158
  });
163
159
  };
164
- var useShowDelivery = function useShowDelivery(id) {
165
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
166
- return useQuery([QUERY_KEYS.DELIVERY_DETAILS, id], function () {
167
- return deliveriesApi.show(id, params);
160
+ var useShowDelivery = function useShowDelivery(id, webhookId) {
161
+ return useQuery([QUERY_KEYS.DELIVERY_DETAILS, id, webhookId], function () {
162
+ return deliveriesApi.show(id, webhookId);
168
163
  }, {
169
164
  staleTime: DELIVERY_STALE_TIME,
170
165
  enabled: !!id
171
166
  });
172
167
  };
173
- var useRedeliverWebhook = function useRedeliverWebhook(deliveryId) {
174
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
168
+ var useRedeliverWebhook = function useRedeliverWebhook(deliveryId, webhookSid) {
175
169
  var queryClient = useQueryClient();
176
170
  return useMutation(function () {
177
- return deliveriesApi.redeliver(deliveryId, params);
171
+ return deliveriesApi.redeliver(deliveryId, webhookSid);
178
172
  }, {
179
173
  onSuccess: function onSuccess() {
180
174
  setTimeout(function () {
@@ -660,14 +654,10 @@ var Details = function Details(_ref) {
660
654
  webhookSid = _ref.webhookSid;
661
655
  var _useTranslation = useTranslation(),
662
656
  t = _useTranslation.t;
663
- var _useRedeliverWebhook = useRedeliverWebhook(deliveryId, {
664
- webhookSid: webhookSid
665
- }),
657
+ var _useRedeliverWebhook = useRedeliverWebhook(deliveryId, webhookSid),
666
658
  isRedelivering = _useRedeliverWebhook.isLoading,
667
659
  redeliverWebhook = _useRedeliverWebhook.mutateAsync;
668
- var _useShowDelivery = useShowDelivery(deliveryId, {
669
- webhookSid: webhookSid
670
- }),
660
+ var _useShowDelivery = useShowDelivery(deliveryId, webhookSid),
671
661
  isLoading = _useShowDelivery.isLoading,
672
662
  _useShowDelivery$data = _useShowDelivery.data,
673
663
  _useShowDelivery$data2 = _useShowDelivery$data === void 0 ? {} : _useShowDelivery$data,
@@ -805,8 +795,7 @@ var Deliveries = function Deliveries(_ref) {
805
795
  deliveryId = _useParams.deliveryId;
806
796
  var deliveriesPath = getDeliveriesPath(webhooksUrl);
807
797
  var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesUrl);
808
- var _useFetchDeliveries = useFetchDeliveries({
809
- webhookSid: webhookId,
798
+ var _useFetchDeliveries = useFetchDeliveries(webhookId, {
810
799
  page: pageNumber,
811
800
  pageSize: DEFAULT_PAGE_SIZE
812
801
  }),