@bigbinary/neeto-integrations-frontend 2.5.2 → 2.6.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/Daily.js ADDED
@@ -0,0 +1,597 @@
1
+ import React, { useState } from 'react';
2
+ import i18next, { t as t$1 } from 'i18next';
3
+ import { isNotPresent, isPresent, noop } from '@bigbinary/neeto-cist';
4
+ import { useMutationWithInvalidation, withTitle, withT } from '@bigbinary/neeto-commons-frontend/react-utils';
5
+ import { DEFAULT_STALE_TIME } from '@bigbinary/neeto-commons-frontend/constants';
6
+ import { useQuery } from 'react-query';
7
+ import axios from 'axios';
8
+ import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
9
+ import { Button, Typography } from '@bigbinary/neetoui';
10
+ import { Form as Form$2, Input } from '@bigbinary/neetoui/formik';
11
+ import { useTranslation, Trans } from 'react-i18next';
12
+ import classnames from 'classnames';
13
+ import '@bigbinary/neeto-molecules/IntegrationCard';
14
+ import DisconnectAlert from '@bigbinary/neeto-molecules/IntegrationDisconnectAlert';
15
+ import WalkthroughModal from '@bigbinary/neeto-molecules/IntegrationWalkthroughModal';
16
+ import 'ramda';
17
+ import * as yup from 'yup';
18
+
19
+ function _typeof(obj) {
20
+ "@babel/helpers - typeof";
21
+
22
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
23
+ return typeof obj;
24
+ } : function (obj) {
25
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
26
+ }, _typeof(obj);
27
+ }
28
+
29
+ function _toPrimitive(input, hint) {
30
+ if (_typeof(input) !== "object" || input === null) return input;
31
+ var prim = input[Symbol.toPrimitive];
32
+ if (prim !== undefined) {
33
+ var res = prim.call(input, hint || "default");
34
+ if (_typeof(res) !== "object") return res;
35
+ throw new TypeError("@@toPrimitive must return a primitive value.");
36
+ }
37
+ return (hint === "string" ? String : Number)(input);
38
+ }
39
+
40
+ function _toPropertyKey(arg) {
41
+ var key = _toPrimitive(arg, "string");
42
+ return _typeof(key) === "symbol" ? key : String(key);
43
+ }
44
+
45
+ function _defineProperty(obj, key, value) {
46
+ key = _toPropertyKey(key);
47
+ if (key in obj) {
48
+ Object.defineProperty(obj, key, {
49
+ value: value,
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true
53
+ });
54
+ } else {
55
+ obj[key] = value;
56
+ }
57
+ return obj;
58
+ }
59
+
60
+ var INTEGRATIONS_ENGINE_BASE_URL = "/neeto_integrations";
61
+ var INTEGRATIONS_ENGINE_DAILY_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/daily");
62
+
63
+ var create = function create(payload) {
64
+ return axios.post(INTEGRATIONS_ENGINE_DAILY_URL, {
65
+ daily: payload
66
+ });
67
+ };
68
+ var show = function show() {
69
+ return axios.get(INTEGRATIONS_ENGINE_DAILY_URL);
70
+ };
71
+ var destroy = function destroy() {
72
+ return axios["delete"](INTEGRATIONS_ENGINE_DAILY_URL);
73
+ };
74
+ var dailiesApi = {
75
+ create: create,
76
+ show: show,
77
+ destroy: destroy
78
+ };
79
+
80
+ var QUERY_KEYS = {
81
+ TWILIO_SMS_CONFIGURATION: "twilio-sms-configuration",
82
+ TWILIO_PHONE_NUMBERS: "twilio-phone-numbers",
83
+ DAILY_CO_DETAILS: "daily-co-details"
84
+ };
85
+
86
+ function ownKeys(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; }
87
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
88
+ var useCreateDaily = function useCreateDaily() {
89
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
90
+ return useMutationWithInvalidation(dailiesApi.create, _objectSpread({
91
+ keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS]
92
+ }, options));
93
+ };
94
+ var useFetchDaily = function useFetchDaily() {
95
+ return useQuery(QUERY_KEYS.DAILY_CO_DETAILS, dailiesApi.show, {
96
+ staleTime: DEFAULT_STALE_TIME
97
+ });
98
+ };
99
+ var useDestroyDaily = function useDestroyDaily(_ref) {
100
+ var onSuccess = _ref.onSuccess;
101
+ return useMutationWithInvalidation(dailiesApi.destroy, {
102
+ keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS],
103
+ onSuccess: onSuccess
104
+ });
105
+ };
106
+
107
+ function _arrayWithHoles(arr) {
108
+ if (Array.isArray(arr)) return arr;
109
+ }
110
+
111
+ function _iterableToArrayLimit(arr, i) {
112
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
113
+ if (null != _i) {
114
+ var _s,
115
+ _e,
116
+ _x,
117
+ _r,
118
+ _arr = [],
119
+ _n = !0,
120
+ _d = !1;
121
+ try {
122
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
123
+ if (Object(_i) !== _i) return;
124
+ _n = !1;
125
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
126
+ } catch (err) {
127
+ _d = !0, _e = err;
128
+ } finally {
129
+ try {
130
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
131
+ } finally {
132
+ if (_d) throw _e;
133
+ }
134
+ }
135
+ return _arr;
136
+ }
137
+ }
138
+
139
+ function _arrayLikeToArray(arr, len) {
140
+ if (len == null || len > arr.length) len = arr.length;
141
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
142
+ return arr2;
143
+ }
144
+
145
+ function _unsupportedIterableToArray(o, minLen) {
146
+ if (!o) return;
147
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
148
+ var n = Object.prototype.toString.call(o).slice(8, -1);
149
+ if (n === "Object" && o.constructor) n = o.constructor.name;
150
+ if (n === "Map" || n === "Set") return Array.from(o);
151
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
152
+ }
153
+
154
+ function _nonIterableRest() {
155
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
156
+ }
157
+
158
+ function _slicedToArray(arr, i) {
159
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
160
+ }
161
+
162
+ function _extends() {
163
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
164
+ for (var i = 1; i < arguments.length; i++) {
165
+ var source = arguments[i];
166
+ for (var key in source) {
167
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
168
+ target[key] = source[key];
169
+ }
170
+ }
171
+ }
172
+ return target;
173
+ };
174
+ return _extends.apply(this, arguments);
175
+ }
176
+
177
+ function _objectWithoutPropertiesLoose(source, excluded) {
178
+ if (source == null) return {};
179
+ var target = {};
180
+ var sourceKeys = Object.keys(source);
181
+ var key, i;
182
+ for (i = 0; i < sourceKeys.length; i++) {
183
+ key = sourceKeys[i];
184
+ if (excluded.indexOf(key) >= 0) continue;
185
+ target[key] = source[key];
186
+ }
187
+ return target;
188
+ }
189
+
190
+ function _objectWithoutProperties(source, excluded) {
191
+ if (source == null) return {};
192
+ var target = _objectWithoutPropertiesLoose(source, excluded);
193
+ var key, i;
194
+ if (Object.getOwnPropertySymbols) {
195
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
196
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
197
+ key = sourceSymbolKeys[i];
198
+ if (excluded.indexOf(key) >= 0) continue;
199
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
200
+ target[key] = source[key];
201
+ }
202
+ }
203
+ return target;
204
+ }
205
+
206
+ var _excluded = ["className", "children"];
207
+ var ExternalLink = function ExternalLink(_ref) {
208
+ var _ref$className = _ref.className,
209
+ className = _ref$className === void 0 ? "" : _ref$className,
210
+ _ref$children = _ref.children,
211
+ children = _ref$children === void 0 ? null : _ref$children,
212
+ props = _objectWithoutProperties(_ref, _excluded);
213
+ return /*#__PURE__*/React.createElement("a", _extends({
214
+ className: classnames(["neeto-ui-text-primary-800 hover:neeto-ui-text-primary-800 visited:neeto-ui-text-primary-600 font-medium", className])
215
+ }, props), children);
216
+ };
217
+ var ExternalLink$1 = /*#__PURE__*/React.memo(ExternalLink);
218
+
219
+ [{
220
+ step: "1",
221
+ label: i18next.t("neetoIntegrations.steps.configure"),
222
+ isActive: true,
223
+ isCompleted: false
224
+ }];
225
+
226
+ var propTypes = {exports: {}};
227
+
228
+ /**
229
+ * Copyright (c) 2013-present, Facebook, Inc.
230
+ *
231
+ * This source code is licensed under the MIT license found in the
232
+ * LICENSE file in the root directory of this source tree.
233
+ */
234
+ var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
235
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
236
+
237
+ /**
238
+ * Copyright (c) 2013-present, Facebook, Inc.
239
+ *
240
+ * This source code is licensed under the MIT license found in the
241
+ * LICENSE file in the root directory of this source tree.
242
+ */
243
+ var ReactPropTypesSecret = ReactPropTypesSecret_1;
244
+ function emptyFunction() {}
245
+ function emptyFunctionWithReset() {}
246
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
247
+ var factoryWithThrowingShims = function factoryWithThrowingShims() {
248
+ function shim(props, propName, componentName, location, propFullName, secret) {
249
+ if (secret === ReactPropTypesSecret) {
250
+ // It is still safe when called from React.
251
+ return;
252
+ }
253
+ var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
254
+ err.name = 'Invariant Violation';
255
+ throw err;
256
+ }
257
+ shim.isRequired = shim;
258
+ function getShim() {
259
+ return shim;
260
+ }
261
+ // Important!
262
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
263
+ var ReactPropTypes = {
264
+ array: shim,
265
+ bigint: shim,
266
+ bool: shim,
267
+ func: shim,
268
+ number: shim,
269
+ object: shim,
270
+ string: shim,
271
+ symbol: shim,
272
+ any: shim,
273
+ arrayOf: getShim,
274
+ element: shim,
275
+ elementType: shim,
276
+ instanceOf: getShim,
277
+ node: shim,
278
+ objectOf: getShim,
279
+ oneOf: getShim,
280
+ oneOfType: getShim,
281
+ shape: getShim,
282
+ exact: getShim,
283
+ checkPropTypes: emptyFunctionWithReset,
284
+ resetWarningCache: emptyFunction
285
+ };
286
+ ReactPropTypes.PropTypes = ReactPropTypes;
287
+ return ReactPropTypes;
288
+ };
289
+
290
+ /**
291
+ * Copyright (c) 2013-present, Facebook, Inc.
292
+ *
293
+ * This source code is licensed under the MIT license found in the
294
+ * LICENSE file in the root directory of this source tree.
295
+ */
296
+ {
297
+ // By explicitly using `prop-types` you are opting into new production behavior.
298
+ // http://fb.me/prop-types-in-prod
299
+ propTypes.exports = factoryWithThrowingShims();
300
+ }
301
+
302
+ ({
303
+ /**
304
+ * To specify the Icon to be shown
305
+ */
306
+ Icon: propTypes.exports.PropTypes.node,
307
+ /**
308
+ * To specify the title of the connect component
309
+ */
310
+ title: propTypes.exports.PropTypes.string,
311
+ /**
312
+ * To specify the description for connect component
313
+ */
314
+ description: propTypes.exports.PropTypes.string,
315
+ /**
316
+ * To specify the props for the connect button
317
+ */
318
+ buttonProps: propTypes.exports.PropTypes.object,
319
+ /**
320
+ * Handler function that is triggered when the connect button is clicked.
321
+ */
322
+ onConnect: propTypes.exports.PropTypes.func
323
+ });
324
+
325
+ ({
326
+ /**
327
+ * To specify whether the integration modal should be opened or closed.
328
+ */
329
+ onClose: propTypes.exports.func,
330
+ /**
331
+ * To specify the walkthrough video link
332
+ */
333
+ videoUrl: propTypes.exports.string,
334
+ /**
335
+ * To specify the title of the demo component
336
+ */
337
+ title: propTypes.exports.string,
338
+ /**
339
+ * To specify the subtitle of the demo component
340
+ */
341
+ subtitle: propTypes.exports.string,
342
+ /**
343
+ * To specify the title of the video in the iframe
344
+ */
345
+ iframeTitle: propTypes.exports.string
346
+ });
347
+
348
+ ({
349
+ /**
350
+ * To specify whether the integration modal should be opened or closed.
351
+ */
352
+ onClick: propTypes.exports.func,
353
+ /**
354
+ * To show the title of the Finish component
355
+ */
356
+ title: propTypes.exports.string,
357
+ /**
358
+ * To specify props for primary button
359
+ */
360
+ buttonProps: propTypes.exports.object,
361
+ /**
362
+ * To specify props for secondary button
363
+ */
364
+ secondaryButtonProps: propTypes.exports.object
365
+ });
366
+
367
+ var e = [],
368
+ t = [];
369
+ function n(n, r) {
370
+ if (n && "undefined" != typeof document) {
371
+ var a,
372
+ s = !0 === r.prepend ? "prepend" : "append",
373
+ d = !0 === r.singleTag,
374
+ i = "string" == typeof r.container ? document.querySelector(r.container) : document.getElementsByTagName("head")[0];
375
+ if (d) {
376
+ var u = e.indexOf(i);
377
+ -1 === u && (u = e.push(i) - 1, t[u] = {}), a = t[u] && t[u][s] ? t[u][s] : t[u][s] = c();
378
+ } else a = c();
379
+ 65279 === n.charCodeAt(0) && (n = n.substring(1)), a.styleSheet ? a.styleSheet.cssText += n : a.appendChild(document.createTextNode(n));
380
+ }
381
+ function c() {
382
+ var e = document.createElement("style");
383
+ if (e.setAttribute("type", "text/css"), r.attributes) for (var t = Object.keys(r.attributes), n = 0; n < t.length; n++) e.setAttribute(t[n], r.attributes[t[n]]);
384
+ var a = "prepend" === s ? "afterbegin" : "beforeend";
385
+ return i.insertAdjacentElement(a, e), e;
386
+ }
387
+ }
388
+
389
+ 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%}";
390
+ n(css,{});
391
+
392
+ var MANAGE_DAILY_CO_FORM_INITIAL_VALUES = {
393
+ apiKey: ""
394
+ };
395
+ var DAILY_CO_VALIDATION_SCHEMA = yup.object().shape({
396
+ apiKey: yup.string().trim().required(t$1("neetoIntegrations.errors.required", {
397
+ entity: t$1("neetoIntegrations.daily.apiKey")
398
+ }))
399
+ });
400
+
401
+ var Form = function Form(_ref) {
402
+ var helpDocUrl = _ref.helpDocUrl,
403
+ videoUrl = _ref.videoUrl,
404
+ onConnect = _ref.onConnect;
405
+ var _useTranslation = useTranslation(),
406
+ t = _useTranslation.t;
407
+ var _useState = useState(false),
408
+ _useState2 = _slicedToArray(_useState, 2),
409
+ isDemoModalOpen = _useState2[0],
410
+ setIsDemoModalOpen = _useState2[1];
411
+ var _useCreateDaily = useCreateDaily({
412
+ onSuccess: function onSuccess() {
413
+ return onConnect === null || onConnect === void 0 ? void 0 : onConnect();
414
+ }
415
+ }),
416
+ createDaily = _useCreateDaily.mutate,
417
+ isConnecting = _useCreateDaily.isLoading;
418
+ var handleSubmit = function handleSubmit(payload) {
419
+ return createDaily(payload);
420
+ };
421
+ if (isConnecting) {
422
+ return /*#__PURE__*/React.createElement(PageLoader, null);
423
+ }
424
+ return /*#__PURE__*/React.createElement("div", {
425
+ className: "mx-auto w-full max-w-md"
426
+ }, /*#__PURE__*/React.createElement(Form$2, {
427
+ formikProps: {
428
+ initialValues: MANAGE_DAILY_CO_FORM_INITIAL_VALUES,
429
+ validationSchema: DAILY_CO_VALIDATION_SCHEMA,
430
+ onSubmit: handleSubmit
431
+ }
432
+ }, function (_ref2) {
433
+ var dirty = _ref2.dirty;
434
+ return /*#__PURE__*/React.createElement("div", {
435
+ className: "mt-10 w-full space-y-5"
436
+ }, /*#__PURE__*/React.createElement("div", {
437
+ className: "block"
438
+ }, /*#__PURE__*/React.createElement(Input, {
439
+ autoFocus: true,
440
+ required: true,
441
+ label: t("neetoIntegrations.daily.apiKey"),
442
+ name: "apiKey",
443
+ helpText: /*#__PURE__*/React.createElement(Trans, {
444
+ i18nKey: "neetoIntegrations.daily.helpDoc",
445
+ components: {
446
+ externalLink: /*#__PURE__*/React.createElement(ExternalLink$1, {
447
+ href: helpDocUrl,
448
+ rel: "noreferrer",
449
+ target: "_blank"
450
+ })
451
+ }
452
+ })
453
+ }), /*#__PURE__*/React.createElement(Button, {
454
+ className: "mt-8",
455
+ label: t("neetoIntegrations.daily.walkthroughText"),
456
+ style: "link",
457
+ onClick: function onClick() {
458
+ return setIsDemoModalOpen(true);
459
+ }
460
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
461
+ disabled: isConnecting || !dirty,
462
+ label: t("neetoIntegrations.common.connect"),
463
+ loading: isConnecting,
464
+ type: "submit"
465
+ })));
466
+ }), /*#__PURE__*/React.createElement(WalkthroughModal, {
467
+ isOpen: isDemoModalOpen,
468
+ videoUrl: videoUrl,
469
+ onClose: function onClose() {
470
+ return setIsDemoModalOpen(false);
471
+ }
472
+ }));
473
+ };
474
+ var Form$1 = withTitle(Form, i18next.t("neetoIntegrations.browserTitles.integrations.dailyco"));
475
+
476
+ var Manage$1 = withT(function (_ref) {
477
+ var t = _ref.t,
478
+ title = _ref.title,
479
+ description = _ref.description,
480
+ integration = _ref.integration,
481
+ isDisconnectAlertOpen = _ref.isDisconnectAlertOpen,
482
+ setIsDisconnectAlertOpen = _ref.setIsDisconnectAlertOpen,
483
+ isDisconnecting = _ref.isDisconnecting,
484
+ onDisconnect = _ref.onDisconnect,
485
+ onClose = _ref.onClose;
486
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
487
+ className: "mx-auto w-full max-w-md"
488
+ }, /*#__PURE__*/React.createElement("div", {
489
+ className: "mt-10 w-full space-y-4"
490
+ }, /*#__PURE__*/React.createElement(Typography, {
491
+ className: "neeto-ui-text-gray-800 mb-0.5",
492
+ style: "h3",
493
+ weight: "semibold"
494
+ }, title), /*#__PURE__*/React.createElement(Typography, {
495
+ className: "neeto-ui-text-gray-600 break-all",
496
+ style: "body1",
497
+ weight: "normal"
498
+ }, description), /*#__PURE__*/React.createElement(Button, {
499
+ label: t("neetoIntegrations.common.disconnect"),
500
+ style: "danger",
501
+ onClick: function onClick() {
502
+ return setIsDisconnectAlertOpen(true);
503
+ }
504
+ }))), /*#__PURE__*/React.createElement(DisconnectAlert, {
505
+ isDisconnecting: isDisconnecting,
506
+ onClose: onClose,
507
+ onDisconnect: onDisconnect,
508
+ isOpen: isDisconnectAlertOpen,
509
+ message: t("neetoIntegrations.".concat(integration, ".disconnect.message")),
510
+ title: t("neetoIntegrations.".concat(integration, ".disconnect.title"))
511
+ }));
512
+ });
513
+
514
+ var Manage = function Manage(_ref) {
515
+ var onDisconnect = _ref.onDisconnect;
516
+ var _useState = useState(false),
517
+ _useState2 = _slicedToArray(_useState, 2),
518
+ isDisconnectAlertOpen = _useState2[0],
519
+ setIsDisconnectAlertOpen = _useState2[1];
520
+ var _useFetchDaily = useFetchDaily(),
521
+ _useFetchDaily$data = _useFetchDaily.data,
522
+ _useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
523
+ _useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
524
+ metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$,
525
+ isLoading = _useFetchDaily.isLoading;
526
+ var _ref2 = metadata || {},
527
+ _ref2$apiKey = _ref2.apiKey,
528
+ apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
529
+ var _useTranslation = useTranslation(),
530
+ t = _useTranslation.t;
531
+ var _useDestroyDaily = useDestroyDaily({
532
+ onSuccess: function onSuccess() {
533
+ setIsDisconnectAlertOpen(false);
534
+ onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
535
+ }
536
+ }),
537
+ destroyIntegration = _useDestroyDaily.mutate,
538
+ isDisconnecting = _useDestroyDaily.isLoading;
539
+ var handleDisconnect = function handleDisconnect() {
540
+ return destroyIntegration("daily");
541
+ };
542
+ if (isLoading || isDisconnecting) {
543
+ return /*#__PURE__*/React.createElement(PageLoader, null);
544
+ }
545
+ if (isNotPresent(apiKey)) {
546
+ onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
547
+ }
548
+ return /*#__PURE__*/React.createElement(Manage$1, {
549
+ isDisconnectAlertOpen: isDisconnectAlertOpen,
550
+ isDisconnecting: isDisconnecting,
551
+ setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
552
+ description: t("neetoIntegrations.daily.yourApiKey", {
553
+ apiKey: apiKey
554
+ }),
555
+ integration: "daily",
556
+ title: t("neetoIntegrations.daily.connected"),
557
+ onClose: function onClose() {
558
+ return setIsDisconnectAlertOpen(false);
559
+ },
560
+ onDisconnect: handleDisconnect
561
+ });
562
+ };
563
+
564
+ var Daily = function Daily(_ref) {
565
+ var _ref$isOnboarding = _ref.isOnboarding,
566
+ isOnboarding = _ref$isOnboarding === void 0 ? false : _ref$isOnboarding,
567
+ _ref$helpDocUrl = _ref.helpDocUrl,
568
+ helpDocUrl = _ref$helpDocUrl === void 0 ? "" : _ref$helpDocUrl,
569
+ _ref$videoUrl = _ref.videoUrl,
570
+ videoUrl = _ref$videoUrl === void 0 ? "" : _ref$videoUrl,
571
+ _ref$onConnect = _ref.onConnect,
572
+ onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect,
573
+ _ref$onDisconnect = _ref.onDisconnect,
574
+ onDisconnect = _ref$onDisconnect === void 0 ? noop : _ref$onDisconnect;
575
+ var _useFetchDaily = useFetchDaily(),
576
+ _useFetchDaily$data = _useFetchDaily.data,
577
+ _useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
578
+ _useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
579
+ metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$;
580
+ var _ref2 = metadata || {},
581
+ _ref2$apiKey = _ref2.apiKey,
582
+ apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
583
+ if (isPresent(apiKey) && !isOnboarding) {
584
+ return /*#__PURE__*/React.createElement(Manage, {
585
+ onDisconnect: onDisconnect
586
+ });
587
+ }
588
+ return /*#__PURE__*/React.createElement(Form$1, {
589
+ onConnect: onConnect,
590
+ helpDocUrl: helpDocUrl,
591
+ videoUrl: videoUrl
592
+ });
593
+ };
594
+ var index = withTitle(Daily, i18next.t("neetoIntegrations.browserTitles.integrations.dailyco"));
595
+
596
+ export { index as default };
597
+ //# sourceMappingURL=Daily.js.map