@bigbinary/neeto-integrations-frontend 2.12.8 → 3.0.0

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
@@ -8,14 +8,14 @@ import React__default, { useState, useEffect, useRef } from 'react';
8
8
  import classnames from 'classnames';
9
9
  import { humanize, noop, isPresent, keysToSnakeCase, _findBy, isNotEmpty } from '@bigbinary/neeto-cist';
10
10
  import { withT, useMutationWithInvalidation, withTitle, useQueryParams, useStateWithDependency } from '@bigbinary/neeto-commons-frontend/react-utils';
11
- import { Check } from '@bigbinary/neeto-icons';
11
+ import Check from '@bigbinary/neeto-icons/Check';
12
12
  import Button from '@bigbinary/neetoui/Button';
13
13
  import Tooltip from '@bigbinary/neetoui/Tooltip';
14
14
  import Typography from '@bigbinary/neetoui/Typography';
15
15
  import { Trans, useTranslation } from 'react-i18next';
16
16
  import i18next, { t as t$1 } from 'i18next';
17
+ import { useQuery } from '@tanstack/react-query';
17
18
  import { DEFAULT_STALE_TIME } from '@bigbinary/neeto-commons-frontend/constants';
18
- import { useQuery } from 'react-query';
19
19
  import axios from 'axios';
20
20
  import Container from '@bigbinary/neeto-molecules/Container';
21
21
  import Header from '@bigbinary/neeto-molecules/Header';
@@ -27,12 +27,15 @@ import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
27
27
  import { useHistory } from 'react-router-dom';
28
28
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
29
29
  import { buildUrl, getQueryParams } from '@bigbinary/neeto-commons-frontend/utils';
30
- import { Daily as Daily$1, GoogleCalendar as GoogleCalendar$1, Google, Zoom as Zoom$1 } from '@bigbinary/neeto-icons/misc';
30
+ import GoogleCalendarIcon from '@bigbinary/neeto-icons/misc/GoogleCalendar';
31
+ import Google from '@bigbinary/neeto-icons/misc/Google';
31
32
  import Callout from '@bigbinary/neetoui/Callout';
32
33
  import { prop, equals, isEmpty } from 'ramda';
33
34
  import Select from '@bigbinary/neetoui/formik/Select';
34
35
  import * as yup from 'yup';
36
+ import ZoomIcon from '@bigbinary/neeto-icons/misc/Zoom';
35
37
  import NeetoUIModal from '@bigbinary/neetoui/Modal';
38
+ import DailyIcon from '@bigbinary/neeto-icons/misc/Daily';
36
39
  import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
37
40
 
38
41
  function _typeof(o) {
@@ -259,18 +262,20 @@ function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t
259
262
  var useCreateDaily = function useCreateDaily() {
260
263
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
261
264
  return useMutationWithInvalidation(dailiesApi.create, _objectSpread$7({
262
- keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS]
265
+ keysToInvalidate: [[QUERY_KEYS.DAILY_CO_DETAILS]]
263
266
  }, options));
264
267
  };
265
268
  var useFetchDaily = function useFetchDaily() {
266
- return useQuery(QUERY_KEYS.DAILY_CO_DETAILS, dailiesApi.show, {
269
+ return useQuery({
270
+ queryKey: [QUERY_KEYS.DAILY_CO_DETAILS],
271
+ queryFn: dailiesApi.show,
267
272
  staleTime: DEFAULT_STALE_TIME
268
273
  });
269
274
  };
270
275
  var useDestroyDaily = function useDestroyDaily(_ref) {
271
276
  var onSuccess = _ref.onSuccess;
272
277
  return useMutationWithInvalidation(dailiesApi.destroy, {
273
- keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS],
278
+ keysToInvalidate: [[QUERY_KEYS.DAILY_CO_DETAILS]],
274
279
  onSuccess: onSuccess
275
280
  });
276
281
  };
@@ -403,7 +408,7 @@ var Form = function Form(_ref) {
403
408
  }
404
409
  }),
405
410
  createDaily = _useCreateDaily.mutate,
406
- isConnecting = _useCreateDaily.isLoading;
411
+ isConnecting = _useCreateDaily.isPending;
407
412
  var handleSubmit = function handleSubmit(payload) {
408
413
  return createDaily(payload);
409
414
  };
@@ -508,7 +513,7 @@ var Manage = function Manage(_ref) {
508
513
  }
509
514
  }),
510
515
  destroyIntegration = _useDestroyDaily.mutate,
511
- isDisconnecting = _useDestroyDaily.isLoading;
516
+ isDisconnecting = _useDestroyDaily.isPending;
512
517
  var isConnected = isPresent(apiKey);
513
518
  var handleDisconnect = function handleDisconnect() {
514
519
  return destroyIntegration("daily");
@@ -519,7 +524,7 @@ var Manage = function Manage(_ref) {
519
524
  isDisconnectAlertOpen: isDisconnectAlertOpen,
520
525
  isDisconnecting: isDisconnecting,
521
526
  setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
522
- Icon: Daily$1,
527
+ Icon: DailyIcon,
523
528
  connectPath: buildUrl(window.location.pathname, {
524
529
  connect: true
525
530
  }),
@@ -656,7 +661,7 @@ var GoogleCalendar = function GoogleCalendar(_ref) {
656
661
  onClose: handleClose,
657
662
  children: [activeTab === STEPS.connect && /*#__PURE__*/jsxs("div", {
658
663
  className: "mx-auto w-full max-w-3xl",
659
- children: [/*#__PURE__*/jsx(GoogleCalendar$1, {
664
+ children: [/*#__PURE__*/jsx(GoogleCalendarIcon, {
660
665
  size: 48
661
666
  }), /*#__PURE__*/jsx(Typography, {
662
667
  className: "mb-4 mt-2",
@@ -781,9 +786,11 @@ var twilioApi = {
781
786
 
782
787
  var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration(_ref) {
783
788
  var integrable = _ref.integrable;
784
- return useQuery([QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableType, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId], function () {
785
- return twilioApi.fetchTwilioSmsConfiguration(integrable);
786
- }, {
789
+ return useQuery({
790
+ queryKey: [QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableType, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId],
791
+ queryFn: function queryFn() {
792
+ return twilioApi.fetchTwilioSmsConfiguration(integrable);
793
+ },
787
794
  select: function select(response) {
788
795
  var _smsConfiguration$twi, _smsConfiguration$twi2, _smsConfiguration$twi3;
789
796
  var smsConfiguration = response.smsConfiguration;
@@ -799,11 +806,13 @@ var useFetchTwilioPhoneNumbers = function useFetchTwilioPhoneNumbers(_ref2) {
799
806
  var _formRef$current, _formRef$current2;
800
807
  var credentials = _ref2.credentials,
801
808
  formRef = _ref2.formRef;
802
- return useQuery([QUERY_KEYS.TWILIO_PHONE_NUMBERS, {
803
- credentials: credentials
804
- }], function () {
805
- return twilioApi.getTwilioPhoneNumbers(keysToSnakeCase(credentials));
806
- }, {
809
+ return useQuery({
810
+ queryKey: [QUERY_KEYS.TWILIO_PHONE_NUMBERS, {
811
+ credentials: credentials
812
+ }],
813
+ queryFn: function queryFn() {
814
+ return twilioApi.getTwilioPhoneNumbers(keysToSnakeCase(credentials));
815
+ },
807
816
  enabled: !!(credentials !== null && credentials !== void 0 && credentials.twilio_sid) || !!(credentials !== null && credentials !== void 0 && credentials.twilioSid) || !!(formRef !== null && formRef !== void 0 && (_formRef$current = formRef.current) !== null && _formRef$current !== void 0 && (_formRef$current = _formRef$current.values) !== null && _formRef$current !== void 0 && _formRef$current.twilioSid) || !!(formRef !== null && formRef !== void 0 && (_formRef$current2 = formRef.current) !== null && _formRef$current2 !== void 0 && (_formRef$current2 = _formRef$current2.values) !== null && _formRef$current2 !== void 0 && _formRef$current2.twilioAuthToken),
808
817
  select: prop("phoneNumbers"),
809
818
  retry: false
@@ -814,7 +823,7 @@ var useCreateTwilioConfiguration = function useCreateTwilioConfiguration(_ref3)
814
823
  return useMutationWithInvalidation(function (payload) {
815
824
  return twilioApi.createTwilioConfiguration(payload, integrable);
816
825
  }, {
817
- keysToInvalidate: [QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableType, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId]
826
+ keysToInvalidate: [[QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableType, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId]]
818
827
  });
819
828
  };
820
829
 
@@ -845,7 +854,7 @@ var useTwilio = function useTwilio(_ref) {
845
854
  integrable: integrable
846
855
  }),
847
856
  saveConfiguration = _useCreateTwilioConfi.mutate,
848
- isSubmitting = _useCreateTwilioConfi.isLoading;
857
+ isSubmitting = _useCreateTwilioConfi.isPending;
849
858
  var handleSubmit = function handleSubmit(values) {
850
859
  var _values$twilioPhoneNu;
851
860
  var payload = {
@@ -978,14 +987,16 @@ var zoomApi = {
978
987
  };
979
988
 
980
989
  var useShowZoom = function useShowZoom() {
981
- return useQuery(QUERY_KEYS.ZOOM_DETAILS, zoomApi.show, {
990
+ return useQuery({
991
+ queryKey: [QUERY_KEYS.ZOOM_DETAILS],
992
+ queryFn: zoomApi.show,
982
993
  staleTime: DEFAULT_STALE_TIME
983
994
  });
984
995
  };
985
996
  var useDestroyZoom = function useDestroyZoom(_ref) {
986
997
  var _onSuccess = _ref.onSuccess;
987
998
  return useMutationWithInvalidation(zoomApi.destroy, {
988
- keysToInvalidate: [QUERY_KEYS.ZOOM_DETAILS],
999
+ keysToInvalidate: [[QUERY_KEYS.ZOOM_DETAILS]],
989
1000
  onSuccess: function onSuccess() {
990
1001
  return _onSuccess === null || _onSuccess === void 0 ? void 0 : _onSuccess();
991
1002
  }
@@ -1020,7 +1031,7 @@ var Zoom = function Zoom(_ref) {
1020
1031
  }
1021
1032
  }),
1022
1033
  destroyIntegration = _useDestroyZoom.mutate,
1023
- isDisconnecting = _useDestroyZoom.isLoading;
1034
+ isDisconnecting = _useDestroyZoom.isPending;
1024
1035
  var isConnected = isPresent(email);
1025
1036
  var handleDisconnect = function handleDisconnect() {
1026
1037
  return destroyIntegration("zoom");
@@ -1032,7 +1043,7 @@ var Zoom = function Zoom(_ref) {
1032
1043
  isDisconnectAlertOpen: isDisconnectAlertOpen,
1033
1044
  isDisconnecting: isDisconnecting,
1034
1045
  setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
1035
- Icon: Zoom$1,
1046
+ Icon: ZoomIcon,
1036
1047
  integration: "zoom",
1037
1048
  description: isConnected ? /*#__PURE__*/jsx(Trans, {
1038
1049
  components: {