@bigbinary/neeto-integrations-frontend 2.12.8 → 3.1.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
@@ -3,20 +3,20 @@ import DisconnectAlert from '@bigbinary/neeto-molecules/IntegrationDisconnectAle
3
3
  export { default as DisconnectAlert } from '@bigbinary/neeto-molecules/IntegrationDisconnectAlert';
4
4
  import WalkthroughModal from '@bigbinary/neeto-molecules/IntegrationWalkthroughModal';
5
5
  export { default as WalkthroughModal } from '@bigbinary/neeto-molecules/IntegrationWalkthroughModal';
6
- import * as React from 'react';
7
- import React__default, { useState, useEffect, useRef } from 'react';
8
6
  import classnames from 'classnames';
9
7
  import { humanize, noop, isPresent, keysToSnakeCase, _findBy, isNotEmpty } from '@bigbinary/neeto-cist';
10
8
  import { withT, useMutationWithInvalidation, withTitle, useQueryParams, useStateWithDependency } from '@bigbinary/neeto-commons-frontend/react-utils';
11
- import { Check } from '@bigbinary/neeto-icons';
9
+ import Check from '@bigbinary/neeto-icons/Check';
12
10
  import Button from '@bigbinary/neetoui/Button';
13
11
  import Tooltip from '@bigbinary/neetoui/Tooltip';
14
12
  import Typography from '@bigbinary/neetoui/Typography';
15
13
  import { Trans, useTranslation } from 'react-i18next';
16
14
  import i18next, { t as t$1 } from 'i18next';
15
+ import { useQuery } from '@tanstack/react-query';
17
16
  import { DEFAULT_STALE_TIME } from '@bigbinary/neeto-commons-frontend/constants';
18
- import { useQuery } from 'react-query';
19
17
  import axios from 'axios';
18
+ import * as React from 'react';
19
+ import { useState, useEffect, useRef } from 'react';
20
20
  import Container from '@bigbinary/neeto-molecules/Container';
21
21
  import Header from '@bigbinary/neeto-molecules/Header';
22
22
  import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
@@ -25,14 +25,17 @@ import Input from '@bigbinary/neetoui/formik/Input';
25
25
  import FormikForm from '@bigbinary/neetoui/formik/Form';
26
26
  import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
27
27
  import { useHistory } from 'react-router-dom';
28
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
29
28
  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';
29
+ import GoogleCalendarIcon from '@bigbinary/neeto-icons/misc/GoogleCalendar';
30
+ import Google from '@bigbinary/neeto-icons/misc/Google';
31
31
  import Callout from '@bigbinary/neetoui/Callout';
32
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
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) {
@@ -76,8 +79,8 @@ function _defineProperty(obj, key, value) {
76
79
  return obj;
77
80
  }
78
81
 
79
- function ownKeys$8(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
80
- function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
82
+ function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
83
+ function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
81
84
  var Manage$1 = withT(function (_ref) {
82
85
  var t = _ref.t,
83
86
  _ref$title = _ref.title,
@@ -176,7 +179,7 @@ var Manage$1 = withT(function (_ref) {
176
179
  })]
177
180
  }), isConnected ? /*#__PURE__*/jsxs("div", {
178
181
  className: "space-x-2",
179
- children: [(managePath || manageUrl) && /*#__PURE__*/jsx(Button, _objectSpread$8({
182
+ children: [(managePath || manageUrl) && /*#__PURE__*/jsx(Button, _objectSpread$7({
180
183
  "data-cy": "manage-button",
181
184
  href: manageUrl,
182
185
  target: manageUrl ? "_blank" : "_self",
@@ -184,7 +187,7 @@ var Manage$1 = withT(function (_ref) {
184
187
  label: t("neetoIntegrations.common.manageIntegration", {
185
188
  integration: integrationName || humanize(integration)
186
189
  })
187
- }, buttonProps)), onDisconnect && /*#__PURE__*/jsx(Button, _objectSpread$8({
190
+ }, buttonProps)), onDisconnect && /*#__PURE__*/jsx(Button, _objectSpread$7({
188
191
  "data-cy": "disconnect-button",
189
192
  style: "secondary",
190
193
  label: t("neetoIntegrations.common.disconnectIntegration", {
@@ -195,11 +198,11 @@ var Manage$1 = withT(function (_ref) {
195
198
  }
196
199
  }, secondaryButtonProps))]
197
200
  }) : /*#__PURE__*/jsx("div", {
198
- children: /*#__PURE__*/jsx(Tooltip, _objectSpread$8(_objectSpread$8({
201
+ children: /*#__PURE__*/jsx(Tooltip, _objectSpread$7(_objectSpread$7({
199
202
  disabled: !isConnectDisabled
200
203
  }, connectTooltipProps), {}, {
201
204
  children: /*#__PURE__*/jsx("span", {
202
- children: (connectPath || connectUrl || onConnect) && /*#__PURE__*/jsx(Button, _objectSpread$8({
205
+ children: (connectPath || connectUrl || onConnect) && /*#__PURE__*/jsx(Button, _objectSpread$7({
203
206
  "data-cy": "connect-button",
204
207
  disabled: isConnectDisabled,
205
208
  href: connectUrl,
@@ -254,23 +257,25 @@ var QUERY_KEYS = {
254
257
  ZOOM_DETAILS: "zoom-details"
255
258
  };
256
259
 
257
- function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
258
- function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
260
+ function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
261
+ function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
259
262
  var useCreateDaily = function useCreateDaily() {
260
263
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
261
- return useMutationWithInvalidation(dailiesApi.create, _objectSpread$7({
262
- keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS]
264
+ return useMutationWithInvalidation(dailiesApi.create, _objectSpread$6({
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
  };
@@ -330,52 +335,6 @@ function _slicedToArray(arr, i) {
330
335
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
331
336
  }
332
337
 
333
- function _objectWithoutPropertiesLoose(source, excluded) {
334
- if (source == null) return {};
335
- var target = {};
336
- var sourceKeys = Object.keys(source);
337
- var key, i;
338
- for (i = 0; i < sourceKeys.length; i++) {
339
- key = sourceKeys[i];
340
- if (excluded.indexOf(key) >= 0) continue;
341
- target[key] = source[key];
342
- }
343
- return target;
344
- }
345
-
346
- function _objectWithoutProperties(source, excluded) {
347
- if (source == null) return {};
348
- var target = _objectWithoutPropertiesLoose(source, excluded);
349
- var key, i;
350
- if (Object.getOwnPropertySymbols) {
351
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
352
- for (i = 0; i < sourceSymbolKeys.length; i++) {
353
- key = sourceSymbolKeys[i];
354
- if (excluded.indexOf(key) >= 0) continue;
355
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
356
- target[key] = source[key];
357
- }
358
- }
359
- return target;
360
- }
361
-
362
- var _excluded = ["className", "children"];
363
- function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
364
- function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
365
- var ExternalLink = function ExternalLink(_ref) {
366
- var _ref$className = _ref.className,
367
- className = _ref$className === void 0 ? "" : _ref$className,
368
- _ref$children = _ref.children,
369
- children = _ref$children === void 0 ? null : _ref$children,
370
- props = _objectWithoutProperties(_ref, _excluded);
371
- return /*#__PURE__*/jsx("a", _objectSpread$6(_objectSpread$6({
372
- className: classnames(["neeto-ui-text-primary-800 hover:neeto-ui-text-primary-800 visited:neeto-ui-text-primary-600 font-medium", className])
373
- }, props), {}, {
374
- children: children
375
- }));
376
- };
377
- var ExternalLink$1 = /*#__PURE__*/React__default.memo(ExternalLink);
378
-
379
338
  var MANAGE_DAILY_CO_FORM_INITIAL_VALUES = {
380
339
  apiKey: ""
381
340
  };
@@ -403,7 +362,7 @@ var Form = function Form(_ref) {
403
362
  }
404
363
  }),
405
364
  createDaily = _useCreateDaily.mutate,
406
- isConnecting = _useCreateDaily.isLoading;
365
+ isConnecting = _useCreateDaily.isPending;
407
366
  var handleSubmit = function handleSubmit(payload) {
408
367
  return createDaily(payload);
409
368
  };
@@ -418,26 +377,24 @@ var Form = function Form(_ref) {
418
377
  className: "flex items-center gap-2",
419
378
  children: [t("neetoIntegrations.daily.connect.title"), /*#__PURE__*/jsx(HelpPopover, {
420
379
  title: t("neetoIntegrations.daily.connect.title"),
421
- description: /*#__PURE__*/jsx(Trans, {
422
- i18nKey: "neetoIntegrations.daily.helpDoc",
423
- components: {
424
- externalLink: /*#__PURE__*/jsx(ExternalLink$1, {
425
- "data-cy": "api-key-help-doc-link",
426
- href: helpDocUrl,
427
- rel: "noreferrer",
428
- target: "_blank"
429
- })
430
- }
431
- }),
432
- helpLinkProps: {
433
- label: /*#__PURE__*/jsx(Button, {
434
- className: "mt-8",
435
- label: t("neetoIntegrations.daily.walkthroughText"),
436
- style: "link",
437
- onClick: function onClick() {
438
- return setIsDemoModalOpen(true);
380
+ description: /*#__PURE__*/jsx(Typography, {
381
+ lineHeight: "normal",
382
+ style: "body2",
383
+ children: /*#__PURE__*/jsx(Trans, {
384
+ i18nKey: "neetoIntegrations.daily.helpDoc",
385
+ components: {
386
+ videoLink: /*#__PURE__*/jsx(Button, {
387
+ style: "link",
388
+ onClick: function onClick() {
389
+ return setIsDemoModalOpen(true);
390
+ }
391
+ })
439
392
  }
440
393
  })
394
+ }),
395
+ helpLinkProps: {
396
+ href: helpDocUrl,
397
+ "data-cy": "api-key-help-doc-link"
441
398
  }
442
399
  })]
443
400
  })
@@ -508,7 +465,7 @@ var Manage = function Manage(_ref) {
508
465
  }
509
466
  }),
510
467
  destroyIntegration = _useDestroyDaily.mutate,
511
- isDisconnecting = _useDestroyDaily.isLoading;
468
+ isDisconnecting = _useDestroyDaily.isPending;
512
469
  var isConnected = isPresent(apiKey);
513
470
  var handleDisconnect = function handleDisconnect() {
514
471
  return destroyIntegration("daily");
@@ -519,7 +476,7 @@ var Manage = function Manage(_ref) {
519
476
  isDisconnectAlertOpen: isDisconnectAlertOpen,
520
477
  isDisconnecting: isDisconnecting,
521
478
  setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
522
- Icon: Daily$1,
479
+ Icon: DailyIcon,
523
480
  connectPath: buildUrl(window.location.pathname, {
524
481
  connect: true
525
482
  }),
@@ -656,7 +613,7 @@ var GoogleCalendar = function GoogleCalendar(_ref) {
656
613
  onClose: handleClose,
657
614
  children: [activeTab === STEPS.connect && /*#__PURE__*/jsxs("div", {
658
615
  className: "mx-auto w-full max-w-3xl",
659
- children: [/*#__PURE__*/jsx(GoogleCalendar$1, {
616
+ children: [/*#__PURE__*/jsx(GoogleCalendarIcon, {
660
617
  size: 48
661
618
  }), /*#__PURE__*/jsx(Typography, {
662
619
  className: "mb-4 mt-2",
@@ -781,9 +738,11 @@ var twilioApi = {
781
738
 
782
739
  var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration(_ref) {
783
740
  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
- }, {
741
+ return useQuery({
742
+ queryKey: [QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableType, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId],
743
+ queryFn: function queryFn() {
744
+ return twilioApi.fetchTwilioSmsConfiguration(integrable);
745
+ },
787
746
  select: function select(response) {
788
747
  var _smsConfiguration$twi, _smsConfiguration$twi2, _smsConfiguration$twi3;
789
748
  var smsConfiguration = response.smsConfiguration;
@@ -799,11 +758,13 @@ var useFetchTwilioPhoneNumbers = function useFetchTwilioPhoneNumbers(_ref2) {
799
758
  var _formRef$current, _formRef$current2;
800
759
  var credentials = _ref2.credentials,
801
760
  formRef = _ref2.formRef;
802
- return useQuery([QUERY_KEYS.TWILIO_PHONE_NUMBERS, {
803
- credentials: credentials
804
- }], function () {
805
- return twilioApi.getTwilioPhoneNumbers(keysToSnakeCase(credentials));
806
- }, {
761
+ return useQuery({
762
+ queryKey: [QUERY_KEYS.TWILIO_PHONE_NUMBERS, {
763
+ credentials: credentials
764
+ }],
765
+ queryFn: function queryFn() {
766
+ return twilioApi.getTwilioPhoneNumbers(keysToSnakeCase(credentials));
767
+ },
807
768
  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
769
  select: prop("phoneNumbers"),
809
770
  retry: false
@@ -814,7 +775,7 @@ var useCreateTwilioConfiguration = function useCreateTwilioConfiguration(_ref3)
814
775
  return useMutationWithInvalidation(function (payload) {
815
776
  return twilioApi.createTwilioConfiguration(payload, integrable);
816
777
  }, {
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]
778
+ 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
779
  });
819
780
  };
820
781
 
@@ -845,7 +806,7 @@ var useTwilio = function useTwilio(_ref) {
845
806
  integrable: integrable
846
807
  }),
847
808
  saveConfiguration = _useCreateTwilioConfi.mutate,
848
- isSubmitting = _useCreateTwilioConfi.isLoading;
809
+ isSubmitting = _useCreateTwilioConfi.isPending;
849
810
  var handleSubmit = function handleSubmit(values) {
850
811
  var _values$twilioPhoneNu;
851
812
  var payload = {
@@ -978,14 +939,16 @@ var zoomApi = {
978
939
  };
979
940
 
980
941
  var useShowZoom = function useShowZoom() {
981
- return useQuery(QUERY_KEYS.ZOOM_DETAILS, zoomApi.show, {
942
+ return useQuery({
943
+ queryKey: [QUERY_KEYS.ZOOM_DETAILS],
944
+ queryFn: zoomApi.show,
982
945
  staleTime: DEFAULT_STALE_TIME
983
946
  });
984
947
  };
985
948
  var useDestroyZoom = function useDestroyZoom(_ref) {
986
949
  var _onSuccess = _ref.onSuccess;
987
950
  return useMutationWithInvalidation(zoomApi.destroy, {
988
- keysToInvalidate: [QUERY_KEYS.ZOOM_DETAILS],
951
+ keysToInvalidate: [[QUERY_KEYS.ZOOM_DETAILS]],
989
952
  onSuccess: function onSuccess() {
990
953
  return _onSuccess === null || _onSuccess === void 0 ? void 0 : _onSuccess();
991
954
  }
@@ -1020,7 +983,7 @@ var Zoom = function Zoom(_ref) {
1020
983
  }
1021
984
  }),
1022
985
  destroyIntegration = _useDestroyZoom.mutate,
1023
- isDisconnecting = _useDestroyZoom.isLoading;
986
+ isDisconnecting = _useDestroyZoom.isPending;
1024
987
  var isConnected = isPresent(email);
1025
988
  var handleDisconnect = function handleDisconnect() {
1026
989
  return destroyIntegration("zoom");
@@ -1032,7 +995,7 @@ var Zoom = function Zoom(_ref) {
1032
995
  isDisconnectAlertOpen: isDisconnectAlertOpen,
1033
996
  isDisconnecting: isDisconnecting,
1034
997
  setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
1035
- Icon: Zoom$1,
998
+ Icon: ZoomIcon,
1036
999
  integration: "zoom",
1037
1000
  description: isConnected ? /*#__PURE__*/jsx(Trans, {
1038
1001
  components: {