@bigbinary/neeto-integrations-frontend 2.6.0 → 2.7.1

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