@bigbinary/neeto-integrations-frontend 2.5.3 → 2.7.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
@@ -1,19 +1,114 @@
1
1
  export { default as Card } from '@bigbinary/neeto-molecules/IntegrationCard';
2
+ import DisconnectAlert from '@bigbinary/neeto-molecules/IntegrationDisconnectAlert';
2
3
  export { default as DisconnectAlert } from '@bigbinary/neeto-molecules/IntegrationDisconnectAlert';
4
+ import WalkthroughModal from '@bigbinary/neeto-molecules/IntegrationWalkthroughModal';
3
5
  export { default as WalkthroughModal } from '@bigbinary/neeto-molecules/IntegrationWalkthroughModal';
4
6
  import * as React from 'react';
5
- import React__default, { useEffect, useRef, useState } from 'react';
6
- import { keysToSnakeCase, noop, _findBy, isNotEmpty } from '@bigbinary/neeto-cist';
7
- import i18next from 'i18next';
8
- import { Modal as Modal$1, Typography, Button } from '@bigbinary/neetoui';
9
- import { Input, Select, Form, ActionBlock } from '@bigbinary/neetoui/formik';
10
- import { prop, equals, isEmpty } from 'ramda';
11
- import { useTranslation } from 'react-i18next';
12
- import { useMutationWithInvalidation, useStateWithDependency } from '@bigbinary/neeto-commons-frontend/react-utils';
7
+ import React__default, { useState, useEffect, useRef } from 'react';
8
+ import i18next, { t as t$1 } from 'i18next';
9
+ import { isNotPresent, isPresent, noop, keysToSnakeCase, _findBy, isNotEmpty } from '@bigbinary/neeto-cist';
10
+ import { useMutationWithInvalidation, withTitle, withT, useStateWithDependency } from '@bigbinary/neeto-commons-frontend/react-utils';
11
+ import { DEFAULT_STALE_TIME } from '@bigbinary/neeto-commons-frontend/constants';
13
12
  import { useQuery } from 'react-query';
14
13
  import axios from 'axios';
15
- import * as yup from 'yup';
14
+ import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
15
+ import { Button, Typography, Modal as Modal$1 } from '@bigbinary/neetoui';
16
+ import { Form as Form$2, Input, Select, ActionBlock } from '@bigbinary/neetoui/formik';
17
+ import { useTranslation, Trans } from 'react-i18next';
16
18
  import classnames from 'classnames';
19
+ import { prop, equals, isEmpty } from 'ramda';
20
+ import * as yup from 'yup';
21
+
22
+ function _typeof(obj) {
23
+ "@babel/helpers - typeof";
24
+
25
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
26
+ return typeof obj;
27
+ } : function (obj) {
28
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
29
+ }, _typeof(obj);
30
+ }
31
+
32
+ function _toPrimitive(input, hint) {
33
+ if (_typeof(input) !== "object" || input === null) return input;
34
+ var prim = input[Symbol.toPrimitive];
35
+ if (prim !== undefined) {
36
+ var res = prim.call(input, hint || "default");
37
+ if (_typeof(res) !== "object") return res;
38
+ throw new TypeError("@@toPrimitive must return a primitive value.");
39
+ }
40
+ return (hint === "string" ? String : Number)(input);
41
+ }
42
+
43
+ function _toPropertyKey(arg) {
44
+ var key = _toPrimitive(arg, "string");
45
+ return _typeof(key) === "symbol" ? key : String(key);
46
+ }
47
+
48
+ function _defineProperty(obj, key, value) {
49
+ key = _toPropertyKey(key);
50
+ if (key in obj) {
51
+ Object.defineProperty(obj, key, {
52
+ value: value,
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true
56
+ });
57
+ } else {
58
+ obj[key] = value;
59
+ }
60
+ return obj;
61
+ }
62
+
63
+ var INTEGRATIONS_ENGINE_BASE_URL = "/neeto_integrations";
64
+ var TWILIO_CONFIGURATION_BASE_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/twilio/sms_configurations");
65
+ var INTEGRATIONS_ENGINE_DAILY_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/daily");
66
+ var INTEGRATIONS_ENGINE_ZOOM_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/zoom");
67
+
68
+ var create = function create(payload) {
69
+ return axios.post(INTEGRATIONS_ENGINE_DAILY_URL, {
70
+ daily: payload
71
+ });
72
+ };
73
+ var show$1 = function show() {
74
+ return axios.get(INTEGRATIONS_ENGINE_DAILY_URL);
75
+ };
76
+ var destroy$1 = function destroy() {
77
+ return axios["delete"](INTEGRATIONS_ENGINE_DAILY_URL);
78
+ };
79
+ var dailiesApi = {
80
+ create: create,
81
+ show: show$1,
82
+ destroy: destroy$1
83
+ };
84
+
85
+ var QUERY_KEYS = {
86
+ TWILIO_SMS_CONFIGURATION: "twilio-sms-configuration",
87
+ TWILIO_PHONE_NUMBERS: "twilio-phone-numbers",
88
+ DAILY_CO_DETAILS: "daily-co-details",
89
+ ZOOM_DETAILS: "zoom-details"
90
+ };
91
+
92
+ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
93
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
94
+ var useCreateDaily = function useCreateDaily() {
95
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
96
+ return useMutationWithInvalidation(dailiesApi.create, _objectSpread$3({
97
+ keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS]
98
+ }, options));
99
+ };
100
+ var useFetchDaily = function useFetchDaily() {
101
+ return useQuery(QUERY_KEYS.DAILY_CO_DETAILS, dailiesApi.show, {
102
+ staleTime: DEFAULT_STALE_TIME
103
+ });
104
+ };
105
+ var useDestroyDaily = function useDestroyDaily(_ref) {
106
+ var onSuccess = _ref.onSuccess;
107
+ return useMutationWithInvalidation(dailiesApi.destroy, {
108
+ keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS],
109
+ onSuccess: onSuccess
110
+ });
111
+ };
17
112
 
18
113
  function _arrayWithHoles(arr) {
19
114
  if (Array.isArray(arr)) return arr;
@@ -70,53 +165,273 @@ function _slicedToArray(arr, i) {
70
165
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
71
166
  }
72
167
 
73
- var TWILIO_INTEGRATION_STEPS = [{
74
- step: "1",
75
- label: i18next.t("neetoIntegrations.steps.configure"),
76
- isActive: true,
77
- isCompleted: false
78
- }];
79
-
80
- function _typeof(obj) {
81
- "@babel/helpers - typeof";
82
-
83
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
84
- return typeof obj;
85
- } : function (obj) {
86
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
87
- }, _typeof(obj);
168
+ function _extends$1() {
169
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
170
+ for (var i = 1; i < arguments.length; i++) {
171
+ var source = arguments[i];
172
+ for (var key in source) {
173
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
174
+ target[key] = source[key];
175
+ }
176
+ }
177
+ }
178
+ return target;
179
+ };
180
+ return _extends$1.apply(this, arguments);
88
181
  }
89
182
 
90
- function _toPrimitive(input, hint) {
91
- if (_typeof(input) !== "object" || input === null) return input;
92
- var prim = input[Symbol.toPrimitive];
93
- if (prim !== undefined) {
94
- var res = prim.call(input, hint || "default");
95
- if (_typeof(res) !== "object") return res;
96
- throw new TypeError("@@toPrimitive must return a primitive value.");
183
+ function _objectWithoutPropertiesLoose(source, excluded) {
184
+ if (source == null) return {};
185
+ var target = {};
186
+ var sourceKeys = Object.keys(source);
187
+ var key, i;
188
+ for (i = 0; i < sourceKeys.length; i++) {
189
+ key = sourceKeys[i];
190
+ if (excluded.indexOf(key) >= 0) continue;
191
+ target[key] = source[key];
97
192
  }
98
- return (hint === "string" ? String : Number)(input);
193
+ return target;
99
194
  }
100
195
 
101
- function _toPropertyKey(arg) {
102
- var key = _toPrimitive(arg, "string");
103
- return _typeof(key) === "symbol" ? key : String(key);
196
+ function _objectWithoutProperties(source, excluded) {
197
+ if (source == null) return {};
198
+ var target = _objectWithoutPropertiesLoose(source, excluded);
199
+ var key, i;
200
+ if (Object.getOwnPropertySymbols) {
201
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
202
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
203
+ key = sourceSymbolKeys[i];
204
+ if (excluded.indexOf(key) >= 0) continue;
205
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
206
+ target[key] = source[key];
207
+ }
208
+ }
209
+ return target;
104
210
  }
105
211
 
106
- function _defineProperty(obj, key, value) {
107
- key = _toPropertyKey(key);
108
- if (key in obj) {
109
- Object.defineProperty(obj, key, {
110
- value: value,
111
- enumerable: true,
112
- configurable: true,
113
- writable: true
212
+ var _excluded = ["className", "children"];
213
+ var ExternalLink = function ExternalLink(_ref) {
214
+ var _ref$className = _ref.className,
215
+ className = _ref$className === void 0 ? "" : _ref$className,
216
+ _ref$children = _ref.children,
217
+ children = _ref$children === void 0 ? null : _ref$children,
218
+ props = _objectWithoutProperties(_ref, _excluded);
219
+ return /*#__PURE__*/React__default.createElement("a", _extends$1({
220
+ className: classnames(["neeto-ui-text-primary-800 hover:neeto-ui-text-primary-800 visited:neeto-ui-text-primary-600 font-medium", className])
221
+ }, props), children);
222
+ };
223
+ var ExternalLink$1 = /*#__PURE__*/React__default.memo(ExternalLink);
224
+
225
+ var MANAGE_DAILY_CO_FORM_INITIAL_VALUES = {
226
+ apiKey: ""
227
+ };
228
+ var DAILY_CO_VALIDATION_SCHEMA = yup.object().shape({
229
+ apiKey: yup.string().trim().required(t$1("neetoIntegrations.errors.required", {
230
+ entity: t$1("neetoIntegrations.daily.apiKey")
231
+ }))
232
+ });
233
+
234
+ var Form = function Form(_ref) {
235
+ var helpDocUrl = _ref.helpDocUrl,
236
+ videoUrl = _ref.videoUrl,
237
+ onConnect = _ref.onConnect;
238
+ var _useTranslation = useTranslation(),
239
+ t = _useTranslation.t;
240
+ var _useState = useState(false),
241
+ _useState2 = _slicedToArray(_useState, 2),
242
+ isDemoModalOpen = _useState2[0],
243
+ setIsDemoModalOpen = _useState2[1];
244
+ var _useCreateDaily = useCreateDaily({
245
+ onSuccess: function onSuccess() {
246
+ return onConnect === null || onConnect === void 0 ? void 0 : onConnect();
247
+ }
248
+ }),
249
+ createDaily = _useCreateDaily.mutate,
250
+ isConnecting = _useCreateDaily.isLoading;
251
+ var handleSubmit = function handleSubmit(payload) {
252
+ return createDaily(payload);
253
+ };
254
+ if (isConnecting) {
255
+ return /*#__PURE__*/React__default.createElement(PageLoader, null);
256
+ }
257
+ return /*#__PURE__*/React__default.createElement("div", {
258
+ className: "mx-auto w-full max-w-md"
259
+ }, /*#__PURE__*/React__default.createElement(Form$2, {
260
+ formikProps: {
261
+ initialValues: MANAGE_DAILY_CO_FORM_INITIAL_VALUES,
262
+ validationSchema: DAILY_CO_VALIDATION_SCHEMA,
263
+ onSubmit: handleSubmit
264
+ }
265
+ }, function (_ref2) {
266
+ var dirty = _ref2.dirty;
267
+ return /*#__PURE__*/React__default.createElement("div", {
268
+ className: "mt-10 w-full space-y-5"
269
+ }, /*#__PURE__*/React__default.createElement("div", {
270
+ className: "block"
271
+ }, /*#__PURE__*/React__default.createElement(Input, {
272
+ autoFocus: true,
273
+ required: true,
274
+ label: t("neetoIntegrations.daily.apiKey"),
275
+ name: "apiKey",
276
+ helpText: /*#__PURE__*/React__default.createElement(Trans, {
277
+ i18nKey: "neetoIntegrations.daily.helpDoc",
278
+ components: {
279
+ externalLink: /*#__PURE__*/React__default.createElement(ExternalLink$1, {
280
+ href: helpDocUrl,
281
+ rel: "noreferrer",
282
+ target: "_blank"
283
+ })
284
+ }
285
+ })
286
+ }), /*#__PURE__*/React__default.createElement(Button, {
287
+ className: "mt-8",
288
+ label: t("neetoIntegrations.daily.walkthroughText"),
289
+ style: "link",
290
+ onClick: function onClick() {
291
+ return setIsDemoModalOpen(true);
292
+ }
293
+ })), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Button, {
294
+ disabled: isConnecting || !dirty,
295
+ label: t("neetoIntegrations.common.connect"),
296
+ loading: isConnecting,
297
+ type: "submit"
298
+ })));
299
+ }), /*#__PURE__*/React__default.createElement(WalkthroughModal, {
300
+ isOpen: isDemoModalOpen,
301
+ videoUrl: videoUrl,
302
+ onClose: function onClose() {
303
+ return setIsDemoModalOpen(false);
304
+ }
305
+ }));
306
+ };
307
+ var Form$1 = withTitle(Form, i18next.t("neetoIntegrations.browserTitles.integrations.dailyco"));
308
+
309
+ var Manage$1 = withT(function (_ref) {
310
+ var t = _ref.t,
311
+ title = _ref.title,
312
+ description = _ref.description,
313
+ integration = _ref.integration,
314
+ isDisconnectAlertOpen = _ref.isDisconnectAlertOpen,
315
+ setIsDisconnectAlertOpen = _ref.setIsDisconnectAlertOpen,
316
+ isDisconnecting = _ref.isDisconnecting,
317
+ onDisconnect = _ref.onDisconnect,
318
+ onClose = _ref.onClose;
319
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
320
+ className: "mx-auto w-full max-w-md"
321
+ }, /*#__PURE__*/React__default.createElement("div", {
322
+ className: "mt-10 w-full space-y-4"
323
+ }, /*#__PURE__*/React__default.createElement(Typography, {
324
+ className: "neeto-ui-text-gray-800 mb-0.5",
325
+ style: "h3",
326
+ weight: "semibold"
327
+ }, title), /*#__PURE__*/React__default.createElement(Typography, {
328
+ className: "neeto-ui-text-gray-600 break-all",
329
+ style: "body1",
330
+ weight: "normal"
331
+ }, description), /*#__PURE__*/React__default.createElement(Button, {
332
+ label: t("neetoIntegrations.common.disconnect"),
333
+ style: "danger",
334
+ onClick: function onClick() {
335
+ return setIsDisconnectAlertOpen(true);
336
+ }
337
+ }))), /*#__PURE__*/React__default.createElement(DisconnectAlert, {
338
+ isDisconnecting: isDisconnecting,
339
+ onClose: onClose,
340
+ onDisconnect: onDisconnect,
341
+ isOpen: isDisconnectAlertOpen,
342
+ message: t("neetoIntegrations.".concat(integration, ".disconnect.message")),
343
+ title: t("neetoIntegrations.".concat(integration, ".disconnect.title"))
344
+ }));
345
+ });
346
+
347
+ var Manage = function Manage(_ref) {
348
+ var onDisconnect = _ref.onDisconnect;
349
+ var _useState = useState(false),
350
+ _useState2 = _slicedToArray(_useState, 2),
351
+ isDisconnectAlertOpen = _useState2[0],
352
+ setIsDisconnectAlertOpen = _useState2[1];
353
+ var _useFetchDaily = useFetchDaily(),
354
+ _useFetchDaily$data = _useFetchDaily.data,
355
+ _useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
356
+ _useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
357
+ metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$,
358
+ isLoading = _useFetchDaily.isLoading;
359
+ var _ref2 = metadata || {},
360
+ _ref2$apiKey = _ref2.apiKey,
361
+ apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
362
+ var _useTranslation = useTranslation(),
363
+ t = _useTranslation.t;
364
+ var _useDestroyDaily = useDestroyDaily({
365
+ onSuccess: function onSuccess() {
366
+ setIsDisconnectAlertOpen(false);
367
+ onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
368
+ }
369
+ }),
370
+ destroyIntegration = _useDestroyDaily.mutate,
371
+ isDisconnecting = _useDestroyDaily.isLoading;
372
+ var handleDisconnect = function handleDisconnect() {
373
+ return destroyIntegration("daily");
374
+ };
375
+ if (isLoading || isDisconnecting) {
376
+ return /*#__PURE__*/React__default.createElement(PageLoader, null);
377
+ }
378
+ if (isNotPresent(apiKey)) {
379
+ onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
380
+ }
381
+ return /*#__PURE__*/React__default.createElement(Manage$1, {
382
+ isDisconnectAlertOpen: isDisconnectAlertOpen,
383
+ isDisconnecting: isDisconnecting,
384
+ setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
385
+ description: t("neetoIntegrations.daily.yourApiKey", {
386
+ apiKey: apiKey
387
+ }),
388
+ integration: "daily",
389
+ title: t("neetoIntegrations.daily.connected"),
390
+ onClose: function onClose() {
391
+ return setIsDisconnectAlertOpen(false);
392
+ },
393
+ onDisconnect: handleDisconnect
394
+ });
395
+ };
396
+
397
+ var Daily = function Daily(_ref) {
398
+ var _ref$isOnboarding = _ref.isOnboarding,
399
+ isOnboarding = _ref$isOnboarding === void 0 ? false : _ref$isOnboarding,
400
+ _ref$helpDocUrl = _ref.helpDocUrl,
401
+ helpDocUrl = _ref$helpDocUrl === void 0 ? "" : _ref$helpDocUrl,
402
+ _ref$videoUrl = _ref.videoUrl,
403
+ videoUrl = _ref$videoUrl === void 0 ? "" : _ref$videoUrl,
404
+ _ref$onConnect = _ref.onConnect,
405
+ onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect,
406
+ _ref$onDisconnect = _ref.onDisconnect,
407
+ onDisconnect = _ref$onDisconnect === void 0 ? noop : _ref$onDisconnect;
408
+ var _useFetchDaily = useFetchDaily(),
409
+ _useFetchDaily$data = _useFetchDaily.data,
410
+ _useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
411
+ _useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
412
+ metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$;
413
+ var _ref2 = metadata || {},
414
+ _ref2$apiKey = _ref2.apiKey,
415
+ apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
416
+ if (isPresent(apiKey) && !isOnboarding) {
417
+ return /*#__PURE__*/React__default.createElement(Manage, {
418
+ onDisconnect: onDisconnect
114
419
  });
115
- } else {
116
- obj[key] = value;
117
420
  }
118
- return obj;
119
- }
421
+ return /*#__PURE__*/React__default.createElement(Form$1, {
422
+ onConnect: onConnect,
423
+ helpDocUrl: helpDocUrl,
424
+ videoUrl: videoUrl
425
+ });
426
+ };
427
+ var index = withTitle(Daily, i18next.t("neetoIntegrations.browserTitles.integrations.dailyco"));
428
+
429
+ var TWILIO_INTEGRATION_STEPS = [{
430
+ step: "1",
431
+ label: i18next.t("neetoIntegrations.steps.configure"),
432
+ isActive: true,
433
+ isCompleted: false
434
+ }];
120
435
 
121
436
  function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
122
437
  function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -191,8 +506,6 @@ function _toConsumableArray(arr) {
191
506
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
192
507
  }
193
508
 
194
- var TWILIO_CONFIGURATION_BASE_URL = "/neeto_integrations/twilio/sms_configurations";
195
-
196
509
  var twilioApi = {
197
510
  fetchTwilioSmsConfiguration: function fetchTwilioSmsConfiguration() {
198
511
  return axios.get(TWILIO_CONFIGURATION_BASE_URL);
@@ -210,11 +523,6 @@ var twilioApi = {
210
523
  }
211
524
  };
212
525
 
213
- var QUERY_KEYS = {
214
- TWILIO_SMS_CONFIGURATION: "twilio-sms-configuration",
215
- TWILIO_PHONE_NUMBERS: "twilio-phone-numbers"
216
- };
217
-
218
526
  var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration() {
219
527
  return useQuery(QUERY_KEYS.TWILIO_SMS_CONFIGURATION, twilioApi.fetchTwilioSmsConfiguration, {
220
528
  select: function select(response) {
@@ -401,7 +709,7 @@ var TwilioConfiguration = function TwilioConfiguration(_ref) {
401
709
  selectedPhoneNumber: selectedPhoneNumber
402
710
  });
403
711
  };
404
- return /*#__PURE__*/React__default.createElement(Form, {
712
+ return /*#__PURE__*/React__default.createElement(Form$2, {
405
713
  className: "mx-auto flex w-full max-w-md flex-col",
406
714
  formikProps: {
407
715
  enableReinitialize: true,
@@ -438,6 +746,84 @@ var Twilio = function Twilio(_ref) {
438
746
  }));
439
747
  };
440
748
 
749
+ var show = function show() {
750
+ return axios.get(INTEGRATIONS_ENGINE_ZOOM_URL);
751
+ };
752
+ var destroy = function destroy() {
753
+ return axios["delete"]("".concat(INTEGRATIONS_ENGINE_ZOOM_URL, "/oauth"));
754
+ };
755
+ var zoomApi = {
756
+ show: show,
757
+ destroy: destroy
758
+ };
759
+
760
+ var useShowZoom = function useShowZoom() {
761
+ return useQuery(QUERY_KEYS.ZOOM_DETAILS, zoomApi.show, {
762
+ staleTime: DEFAULT_STALE_TIME
763
+ });
764
+ };
765
+ var useDestroyZoom = function useDestroyZoom(_ref) {
766
+ var _onSuccess = _ref.onSuccess;
767
+ return useMutationWithInvalidation(zoomApi.destroy, {
768
+ keysToInvalidate: [QUERY_KEYS.ZOOM_DETAILS],
769
+ onSuccess: function onSuccess() {
770
+ return _onSuccess === null || _onSuccess === void 0 ? void 0 : _onSuccess();
771
+ }
772
+ });
773
+ };
774
+
775
+ var Zoom = function Zoom(_ref) {
776
+ var _ref$onDisconnect = _ref.onDisconnect,
777
+ onDisconnect = _ref$onDisconnect === void 0 ? noop : _ref$onDisconnect;
778
+ var _useTranslation = useTranslation(),
779
+ t = _useTranslation.t;
780
+ var _useState = useState(false),
781
+ _useState2 = _slicedToArray(_useState, 2),
782
+ isDisconnectAlertOpen = _useState2[0],
783
+ setIsDisconnectAlertOpen = _useState2[1];
784
+ var _useShowZoom = useShowZoom(),
785
+ _useShowZoom$data = _useShowZoom.data,
786
+ _useShowZoom$data2 = _useShowZoom$data === void 0 ? {} : _useShowZoom$data,
787
+ _useShowZoom$data2$me = _useShowZoom$data2.metadata,
788
+ _useShowZoom$data2$me2 = _useShowZoom$data2$me === void 0 ? {} : _useShowZoom$data2$me,
789
+ _useShowZoom$data2$me3 = _useShowZoom$data2$me2.email,
790
+ email = _useShowZoom$data2$me3 === void 0 ? "" : _useShowZoom$data2$me3,
791
+ isLoading = _useShowZoom.isLoading;
792
+ var _useDestroyZoom = useDestroyZoom({
793
+ onSuccess: function onSuccess() {
794
+ setIsDisconnectAlertOpen(false);
795
+ onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
796
+ }
797
+ }),
798
+ destroyIntegration = _useDestroyZoom.mutate,
799
+ isDisconnecting = _useDestroyZoom.isLoading;
800
+ var handleDisconnect = function handleDisconnect() {
801
+ return destroyIntegration("zoom");
802
+ };
803
+ if (isLoading) {
804
+ return /*#__PURE__*/React__default.createElement(PageLoader, null);
805
+ }
806
+ if (isNotPresent(email)) {
807
+ onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
808
+ }
809
+ return /*#__PURE__*/React__default.createElement(Manage$1, {
810
+ isDisconnectAlertOpen: isDisconnectAlertOpen,
811
+ isDisconnecting: isDisconnecting,
812
+ setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
813
+ description: t("neetoIntegrations.zoom.account", {
814
+ email: email
815
+ }),
816
+ integration: "zoom",
817
+ title: t("neetoIntegrations.zoom.connected"),
818
+ onClose: function onClose() {
819
+ return setIsDisconnectAlertOpen(false);
820
+ },
821
+ onDisconnect: function onDisconnect() {
822
+ return handleDisconnect();
823
+ }
824
+ });
825
+ };
826
+
441
827
  var Stepper = function Stepper(_ref) {
442
828
  var _ref$steps = _ref.steps,
443
829
  steps = _ref$steps === void 0 ? {} : _ref$steps;
@@ -504,21 +890,6 @@ var Modal = function Modal(_ref) {
504
890
  }, children)));
505
891
  };
506
892
 
507
- function _extends$1() {
508
- _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
509
- for (var i = 1; i < arguments.length; i++) {
510
- var source = arguments[i];
511
- for (var key in source) {
512
- if (Object.prototype.hasOwnProperty.call(source, key)) {
513
- target[key] = source[key];
514
- }
515
- }
516
- }
517
- return target;
518
- };
519
- return _extends$1.apply(this, arguments);
520
- }
521
-
522
893
  var propTypes = {exports: {}};
523
894
 
524
895
  /**
@@ -829,5 +1200,5 @@ function n(n, r) {
829
1200
  var css = ".intrinsic-container{height:0;overflow:hidden;position:relative}.intrinsic-container-16x9{padding-bottom:56.25%}.intrinsic-container-4x3{padding-bottom:75%}.intrinsic-container iframe{height:100%;left:0;position:absolute;top:0;width:100%}";
830
1201
  n(css,{});
831
1202
 
832
- export { Connect, Demo, Finish, Modal, Twilio };
1203
+ export { Connect, index as Daily, Demo, Finish, Modal, Twilio, Zoom };
833
1204
  //# sourceMappingURL=index.js.map