@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.cjs.js CHANGED
@@ -3,20 +3,22 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var IntegrationCard = require('@bigbinary/neeto-molecules/IntegrationCard');
6
- var IntegrationDisconnectAlert = require('@bigbinary/neeto-molecules/IntegrationDisconnectAlert');
7
- var IntegrationWalkthroughModal = require('@bigbinary/neeto-molecules/IntegrationWalkthroughModal');
6
+ var DisconnectAlert = require('@bigbinary/neeto-molecules/IntegrationDisconnectAlert');
7
+ var WalkthroughModal = require('@bigbinary/neeto-molecules/IntegrationWalkthroughModal');
8
8
  var React = require('react');
9
- var neetoCist = require('@bigbinary/neeto-cist');
10
9
  var i18next = require('i18next');
11
- var neetoui = require('@bigbinary/neetoui');
12
- var formik = require('@bigbinary/neetoui/formik');
13
- var ramda = require('ramda');
14
- var reactI18next = require('react-i18next');
10
+ var neetoCist = require('@bigbinary/neeto-cist');
15
11
  var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
12
+ var constants = require('@bigbinary/neeto-commons-frontend/constants');
16
13
  var reactQuery = require('react-query');
17
14
  var axios = require('axios');
18
- var yup = require('yup');
15
+ var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
16
+ var neetoui = require('@bigbinary/neetoui');
17
+ var formik = require('@bigbinary/neetoui/formik');
18
+ var reactI18next = require('react-i18next');
19
19
  var classnames = require('classnames');
20
+ var ramda = require('ramda');
21
+ var yup = require('yup');
20
22
 
21
23
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
24
 
@@ -39,14 +41,106 @@ function _interopNamespace(e) {
39
41
  }
40
42
 
41
43
  var IntegrationCard__default = /*#__PURE__*/_interopDefaultLegacy(IntegrationCard);
42
- var IntegrationDisconnectAlert__default = /*#__PURE__*/_interopDefaultLegacy(IntegrationDisconnectAlert);
43
- var IntegrationWalkthroughModal__default = /*#__PURE__*/_interopDefaultLegacy(IntegrationWalkthroughModal);
44
+ var DisconnectAlert__default = /*#__PURE__*/_interopDefaultLegacy(DisconnectAlert);
45
+ var WalkthroughModal__default = /*#__PURE__*/_interopDefaultLegacy(WalkthroughModal);
44
46
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
45
47
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
46
48
  var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
47
49
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
48
- var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
50
+ var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
49
51
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
52
+ var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
53
+
54
+ function _typeof(obj) {
55
+ "@babel/helpers - typeof";
56
+
57
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
58
+ return typeof obj;
59
+ } : function (obj) {
60
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
61
+ }, _typeof(obj);
62
+ }
63
+
64
+ function _toPrimitive(input, hint) {
65
+ if (_typeof(input) !== "object" || input === null) return input;
66
+ var prim = input[Symbol.toPrimitive];
67
+ if (prim !== undefined) {
68
+ var res = prim.call(input, hint || "default");
69
+ if (_typeof(res) !== "object") return res;
70
+ throw new TypeError("@@toPrimitive must return a primitive value.");
71
+ }
72
+ return (hint === "string" ? String : Number)(input);
73
+ }
74
+
75
+ function _toPropertyKey(arg) {
76
+ var key = _toPrimitive(arg, "string");
77
+ return _typeof(key) === "symbol" ? key : String(key);
78
+ }
79
+
80
+ function _defineProperty(obj, key, value) {
81
+ key = _toPropertyKey(key);
82
+ if (key in obj) {
83
+ Object.defineProperty(obj, key, {
84
+ value: value,
85
+ enumerable: true,
86
+ configurable: true,
87
+ writable: true
88
+ });
89
+ } else {
90
+ obj[key] = value;
91
+ }
92
+ return obj;
93
+ }
94
+
95
+ var INTEGRATIONS_ENGINE_BASE_URL = "/neeto_integrations";
96
+ var TWILIO_CONFIGURATION_BASE_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/twilio/sms_configurations");
97
+ var INTEGRATIONS_ENGINE_DAILY_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/daily");
98
+ var INTEGRATIONS_ENGINE_ZOOM_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/zoom");
99
+
100
+ var create = function create(payload) {
101
+ return axios__default["default"].post(INTEGRATIONS_ENGINE_DAILY_URL, {
102
+ daily: payload
103
+ });
104
+ };
105
+ var show$1 = function show() {
106
+ return axios__default["default"].get(INTEGRATIONS_ENGINE_DAILY_URL);
107
+ };
108
+ var destroy$1 = function destroy() {
109
+ return axios__default["default"]["delete"](INTEGRATIONS_ENGINE_DAILY_URL);
110
+ };
111
+ var dailiesApi = {
112
+ create: create,
113
+ show: show$1,
114
+ destroy: destroy$1
115
+ };
116
+
117
+ var QUERY_KEYS = {
118
+ TWILIO_SMS_CONFIGURATION: "twilio-sms-configuration",
119
+ TWILIO_PHONE_NUMBERS: "twilio-phone-numbers",
120
+ DAILY_CO_DETAILS: "daily-co-details",
121
+ ZOOM_DETAILS: "zoom-details"
122
+ };
123
+
124
+ 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; }
125
+ 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; }
126
+ var useCreateDaily = function useCreateDaily() {
127
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
128
+ return reactUtils.useMutationWithInvalidation(dailiesApi.create, _objectSpread$3({
129
+ keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS]
130
+ }, options));
131
+ };
132
+ var useFetchDaily = function useFetchDaily() {
133
+ return reactQuery.useQuery(QUERY_KEYS.DAILY_CO_DETAILS, dailiesApi.show, {
134
+ staleTime: constants.DEFAULT_STALE_TIME
135
+ });
136
+ };
137
+ var useDestroyDaily = function useDestroyDaily(_ref) {
138
+ var onSuccess = _ref.onSuccess;
139
+ return reactUtils.useMutationWithInvalidation(dailiesApi.destroy, {
140
+ keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS],
141
+ onSuccess: onSuccess
142
+ });
143
+ };
50
144
 
51
145
  function _arrayWithHoles(arr) {
52
146
  if (Array.isArray(arr)) return arr;
@@ -103,53 +197,273 @@ function _slicedToArray(arr, i) {
103
197
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
104
198
  }
105
199
 
106
- var TWILIO_INTEGRATION_STEPS = [{
107
- step: "1",
108
- label: i18next__default["default"].t("neetoIntegrations.steps.configure"),
109
- isActive: true,
110
- isCompleted: false
111
- }];
112
-
113
- function _typeof(obj) {
114
- "@babel/helpers - typeof";
115
-
116
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
117
- return typeof obj;
118
- } : function (obj) {
119
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
120
- }, _typeof(obj);
200
+ function _extends$1() {
201
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
202
+ for (var i = 1; i < arguments.length; i++) {
203
+ var source = arguments[i];
204
+ for (var key in source) {
205
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
206
+ target[key] = source[key];
207
+ }
208
+ }
209
+ }
210
+ return target;
211
+ };
212
+ return _extends$1.apply(this, arguments);
121
213
  }
122
214
 
123
- function _toPrimitive(input, hint) {
124
- if (_typeof(input) !== "object" || input === null) return input;
125
- var prim = input[Symbol.toPrimitive];
126
- if (prim !== undefined) {
127
- var res = prim.call(input, hint || "default");
128
- if (_typeof(res) !== "object") return res;
129
- throw new TypeError("@@toPrimitive must return a primitive value.");
215
+ function _objectWithoutPropertiesLoose(source, excluded) {
216
+ if (source == null) return {};
217
+ var target = {};
218
+ var sourceKeys = Object.keys(source);
219
+ var key, i;
220
+ for (i = 0; i < sourceKeys.length; i++) {
221
+ key = sourceKeys[i];
222
+ if (excluded.indexOf(key) >= 0) continue;
223
+ target[key] = source[key];
130
224
  }
131
- return (hint === "string" ? String : Number)(input);
225
+ return target;
132
226
  }
133
227
 
134
- function _toPropertyKey(arg) {
135
- var key = _toPrimitive(arg, "string");
136
- return _typeof(key) === "symbol" ? key : String(key);
228
+ function _objectWithoutProperties(source, excluded) {
229
+ if (source == null) return {};
230
+ var target = _objectWithoutPropertiesLoose(source, excluded);
231
+ var key, i;
232
+ if (Object.getOwnPropertySymbols) {
233
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
234
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
235
+ key = sourceSymbolKeys[i];
236
+ if (excluded.indexOf(key) >= 0) continue;
237
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
238
+ target[key] = source[key];
239
+ }
240
+ }
241
+ return target;
137
242
  }
138
243
 
139
- function _defineProperty(obj, key, value) {
140
- key = _toPropertyKey(key);
141
- if (key in obj) {
142
- Object.defineProperty(obj, key, {
143
- value: value,
144
- enumerable: true,
145
- configurable: true,
146
- writable: true
244
+ var _excluded = ["className", "children"];
245
+ var ExternalLink = function ExternalLink(_ref) {
246
+ var _ref$className = _ref.className,
247
+ className = _ref$className === void 0 ? "" : _ref$className,
248
+ _ref$children = _ref.children,
249
+ children = _ref$children === void 0 ? null : _ref$children,
250
+ props = _objectWithoutProperties(_ref, _excluded);
251
+ return /*#__PURE__*/React__default["default"].createElement("a", _extends$1({
252
+ className: classnames__default["default"](["neeto-ui-text-primary-800 hover:neeto-ui-text-primary-800 visited:neeto-ui-text-primary-600 font-medium", className])
253
+ }, props), children);
254
+ };
255
+ var ExternalLink$1 = /*#__PURE__*/React__default["default"].memo(ExternalLink);
256
+
257
+ var MANAGE_DAILY_CO_FORM_INITIAL_VALUES = {
258
+ apiKey: ""
259
+ };
260
+ var DAILY_CO_VALIDATION_SCHEMA = yup__namespace.object().shape({
261
+ apiKey: yup__namespace.string().trim().required(i18next.t("neetoIntegrations.errors.required", {
262
+ entity: i18next.t("neetoIntegrations.daily.apiKey")
263
+ }))
264
+ });
265
+
266
+ var Form = function Form(_ref) {
267
+ var helpDocUrl = _ref.helpDocUrl,
268
+ videoUrl = _ref.videoUrl,
269
+ onConnect = _ref.onConnect;
270
+ var _useTranslation = reactI18next.useTranslation(),
271
+ t = _useTranslation.t;
272
+ var _useState = React.useState(false),
273
+ _useState2 = _slicedToArray(_useState, 2),
274
+ isDemoModalOpen = _useState2[0],
275
+ setIsDemoModalOpen = _useState2[1];
276
+ var _useCreateDaily = useCreateDaily({
277
+ onSuccess: function onSuccess() {
278
+ return onConnect === null || onConnect === void 0 ? void 0 : onConnect();
279
+ }
280
+ }),
281
+ createDaily = _useCreateDaily.mutate,
282
+ isConnecting = _useCreateDaily.isLoading;
283
+ var handleSubmit = function handleSubmit(payload) {
284
+ return createDaily(payload);
285
+ };
286
+ if (isConnecting) {
287
+ return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
288
+ }
289
+ return /*#__PURE__*/React__default["default"].createElement("div", {
290
+ className: "mx-auto w-full max-w-md"
291
+ }, /*#__PURE__*/React__default["default"].createElement(formik.Form, {
292
+ formikProps: {
293
+ initialValues: MANAGE_DAILY_CO_FORM_INITIAL_VALUES,
294
+ validationSchema: DAILY_CO_VALIDATION_SCHEMA,
295
+ onSubmit: handleSubmit
296
+ }
297
+ }, function (_ref2) {
298
+ var dirty = _ref2.dirty;
299
+ return /*#__PURE__*/React__default["default"].createElement("div", {
300
+ className: "mt-10 w-full space-y-5"
301
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
302
+ className: "block"
303
+ }, /*#__PURE__*/React__default["default"].createElement(formik.Input, {
304
+ autoFocus: true,
305
+ required: true,
306
+ label: t("neetoIntegrations.daily.apiKey"),
307
+ name: "apiKey",
308
+ helpText: /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
309
+ i18nKey: "neetoIntegrations.daily.helpDoc",
310
+ components: {
311
+ externalLink: /*#__PURE__*/React__default["default"].createElement(ExternalLink$1, {
312
+ href: helpDocUrl,
313
+ rel: "noreferrer",
314
+ target: "_blank"
315
+ })
316
+ }
317
+ })
318
+ }), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
319
+ className: "mt-8",
320
+ label: t("neetoIntegrations.daily.walkthroughText"),
321
+ style: "link",
322
+ onClick: function onClick() {
323
+ return setIsDemoModalOpen(true);
324
+ }
325
+ })), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
326
+ disabled: isConnecting || !dirty,
327
+ label: t("neetoIntegrations.common.connect"),
328
+ loading: isConnecting,
329
+ type: "submit"
330
+ })));
331
+ }), /*#__PURE__*/React__default["default"].createElement(WalkthroughModal__default["default"], {
332
+ isOpen: isDemoModalOpen,
333
+ videoUrl: videoUrl,
334
+ onClose: function onClose() {
335
+ return setIsDemoModalOpen(false);
336
+ }
337
+ }));
338
+ };
339
+ var Form$1 = reactUtils.withTitle(Form, i18next__default["default"].t("neetoIntegrations.browserTitles.integrations.dailyco"));
340
+
341
+ var Manage$1 = reactUtils.withT(function (_ref) {
342
+ var t = _ref.t,
343
+ title = _ref.title,
344
+ description = _ref.description,
345
+ integration = _ref.integration,
346
+ isDisconnectAlertOpen = _ref.isDisconnectAlertOpen,
347
+ setIsDisconnectAlertOpen = _ref.setIsDisconnectAlertOpen,
348
+ isDisconnecting = _ref.isDisconnecting,
349
+ onDisconnect = _ref.onDisconnect,
350
+ onClose = _ref.onClose;
351
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
352
+ className: "mx-auto w-full max-w-md"
353
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
354
+ className: "mt-10 w-full space-y-4"
355
+ }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
356
+ className: "neeto-ui-text-gray-800 mb-0.5",
357
+ style: "h3",
358
+ weight: "semibold"
359
+ }, title), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
360
+ className: "neeto-ui-text-gray-600 break-all",
361
+ style: "body1",
362
+ weight: "normal"
363
+ }, description), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
364
+ label: t("neetoIntegrations.common.disconnect"),
365
+ style: "danger",
366
+ onClick: function onClick() {
367
+ return setIsDisconnectAlertOpen(true);
368
+ }
369
+ }))), /*#__PURE__*/React__default["default"].createElement(DisconnectAlert__default["default"], {
370
+ isDisconnecting: isDisconnecting,
371
+ onClose: onClose,
372
+ onDisconnect: onDisconnect,
373
+ isOpen: isDisconnectAlertOpen,
374
+ message: t("neetoIntegrations.".concat(integration, ".disconnect.message")),
375
+ title: t("neetoIntegrations.".concat(integration, ".disconnect.title"))
376
+ }));
377
+ });
378
+
379
+ var Manage = function Manage(_ref) {
380
+ var onDisconnect = _ref.onDisconnect;
381
+ var _useState = React.useState(false),
382
+ _useState2 = _slicedToArray(_useState, 2),
383
+ isDisconnectAlertOpen = _useState2[0],
384
+ setIsDisconnectAlertOpen = _useState2[1];
385
+ var _useFetchDaily = useFetchDaily(),
386
+ _useFetchDaily$data = _useFetchDaily.data,
387
+ _useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
388
+ _useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
389
+ metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$,
390
+ isLoading = _useFetchDaily.isLoading;
391
+ var _ref2 = metadata || {},
392
+ _ref2$apiKey = _ref2.apiKey,
393
+ apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
394
+ var _useTranslation = reactI18next.useTranslation(),
395
+ t = _useTranslation.t;
396
+ var _useDestroyDaily = useDestroyDaily({
397
+ onSuccess: function onSuccess() {
398
+ setIsDisconnectAlertOpen(false);
399
+ onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
400
+ }
401
+ }),
402
+ destroyIntegration = _useDestroyDaily.mutate,
403
+ isDisconnecting = _useDestroyDaily.isLoading;
404
+ var handleDisconnect = function handleDisconnect() {
405
+ return destroyIntegration("daily");
406
+ };
407
+ if (isLoading || isDisconnecting) {
408
+ return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
409
+ }
410
+ if (neetoCist.isNotPresent(apiKey)) {
411
+ onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
412
+ }
413
+ return /*#__PURE__*/React__default["default"].createElement(Manage$1, {
414
+ isDisconnectAlertOpen: isDisconnectAlertOpen,
415
+ isDisconnecting: isDisconnecting,
416
+ setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
417
+ description: t("neetoIntegrations.daily.yourApiKey", {
418
+ apiKey: apiKey
419
+ }),
420
+ integration: "daily",
421
+ title: t("neetoIntegrations.daily.connected"),
422
+ onClose: function onClose() {
423
+ return setIsDisconnectAlertOpen(false);
424
+ },
425
+ onDisconnect: handleDisconnect
426
+ });
427
+ };
428
+
429
+ var Daily = function Daily(_ref) {
430
+ var _ref$isOnboarding = _ref.isOnboarding,
431
+ isOnboarding = _ref$isOnboarding === void 0 ? false : _ref$isOnboarding,
432
+ _ref$helpDocUrl = _ref.helpDocUrl,
433
+ helpDocUrl = _ref$helpDocUrl === void 0 ? "" : _ref$helpDocUrl,
434
+ _ref$videoUrl = _ref.videoUrl,
435
+ videoUrl = _ref$videoUrl === void 0 ? "" : _ref$videoUrl,
436
+ _ref$onConnect = _ref.onConnect,
437
+ onConnect = _ref$onConnect === void 0 ? neetoCist.noop : _ref$onConnect,
438
+ _ref$onDisconnect = _ref.onDisconnect,
439
+ onDisconnect = _ref$onDisconnect === void 0 ? neetoCist.noop : _ref$onDisconnect;
440
+ var _useFetchDaily = useFetchDaily(),
441
+ _useFetchDaily$data = _useFetchDaily.data,
442
+ _useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
443
+ _useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
444
+ metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$;
445
+ var _ref2 = metadata || {},
446
+ _ref2$apiKey = _ref2.apiKey,
447
+ apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
448
+ if (neetoCist.isPresent(apiKey) && !isOnboarding) {
449
+ return /*#__PURE__*/React__default["default"].createElement(Manage, {
450
+ onDisconnect: onDisconnect
147
451
  });
148
- } else {
149
- obj[key] = value;
150
452
  }
151
- return obj;
152
- }
453
+ return /*#__PURE__*/React__default["default"].createElement(Form$1, {
454
+ onConnect: onConnect,
455
+ helpDocUrl: helpDocUrl,
456
+ videoUrl: videoUrl
457
+ });
458
+ };
459
+ var index = reactUtils.withTitle(Daily, i18next__default["default"].t("neetoIntegrations.browserTitles.integrations.dailyco"));
460
+
461
+ var TWILIO_INTEGRATION_STEPS = [{
462
+ step: "1",
463
+ label: i18next__default["default"].t("neetoIntegrations.steps.configure"),
464
+ isActive: true,
465
+ isCompleted: false
466
+ }];
153
467
 
154
468
  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; }
155
469
  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; }
@@ -224,8 +538,6 @@ function _toConsumableArray(arr) {
224
538
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
225
539
  }
226
540
 
227
- var TWILIO_CONFIGURATION_BASE_URL = "/neeto_integrations/twilio/sms_configurations";
228
-
229
541
  var twilioApi = {
230
542
  fetchTwilioSmsConfiguration: function fetchTwilioSmsConfiguration() {
231
543
  return axios__default["default"].get(TWILIO_CONFIGURATION_BASE_URL);
@@ -243,11 +555,6 @@ var twilioApi = {
243
555
  }
244
556
  };
245
557
 
246
- var QUERY_KEYS = {
247
- TWILIO_SMS_CONFIGURATION: "twilio-sms-configuration",
248
- TWILIO_PHONE_NUMBERS: "twilio-phone-numbers"
249
- };
250
-
251
558
  var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration() {
252
559
  return reactQuery.useQuery(QUERY_KEYS.TWILIO_SMS_CONFIGURATION, twilioApi.fetchTwilioSmsConfiguration, {
253
560
  select: function select(response) {
@@ -471,6 +778,84 @@ var Twilio = function Twilio(_ref) {
471
778
  }));
472
779
  };
473
780
 
781
+ var show = function show() {
782
+ return axios__default["default"].get(INTEGRATIONS_ENGINE_ZOOM_URL);
783
+ };
784
+ var destroy = function destroy() {
785
+ return axios__default["default"]["delete"]("".concat(INTEGRATIONS_ENGINE_ZOOM_URL, "/oauth"));
786
+ };
787
+ var zoomApi = {
788
+ show: show,
789
+ destroy: destroy
790
+ };
791
+
792
+ var useShowZoom = function useShowZoom() {
793
+ return reactQuery.useQuery(QUERY_KEYS.ZOOM_DETAILS, zoomApi.show, {
794
+ staleTime: constants.DEFAULT_STALE_TIME
795
+ });
796
+ };
797
+ var useDestroyZoom = function useDestroyZoom(_ref) {
798
+ var _onSuccess = _ref.onSuccess;
799
+ return reactUtils.useMutationWithInvalidation(zoomApi.destroy, {
800
+ keysToInvalidate: [QUERY_KEYS.ZOOM_DETAILS],
801
+ onSuccess: function onSuccess() {
802
+ return _onSuccess === null || _onSuccess === void 0 ? void 0 : _onSuccess();
803
+ }
804
+ });
805
+ };
806
+
807
+ var Zoom = function Zoom(_ref) {
808
+ var _ref$onDisconnect = _ref.onDisconnect,
809
+ onDisconnect = _ref$onDisconnect === void 0 ? neetoCist.noop : _ref$onDisconnect;
810
+ var _useTranslation = reactI18next.useTranslation(),
811
+ t = _useTranslation.t;
812
+ var _useState = React.useState(false),
813
+ _useState2 = _slicedToArray(_useState, 2),
814
+ isDisconnectAlertOpen = _useState2[0],
815
+ setIsDisconnectAlertOpen = _useState2[1];
816
+ var _useShowZoom = useShowZoom(),
817
+ _useShowZoom$data = _useShowZoom.data,
818
+ _useShowZoom$data2 = _useShowZoom$data === void 0 ? {} : _useShowZoom$data,
819
+ _useShowZoom$data2$me = _useShowZoom$data2.metadata,
820
+ _useShowZoom$data2$me2 = _useShowZoom$data2$me === void 0 ? {} : _useShowZoom$data2$me,
821
+ _useShowZoom$data2$me3 = _useShowZoom$data2$me2.email,
822
+ email = _useShowZoom$data2$me3 === void 0 ? "" : _useShowZoom$data2$me3,
823
+ isLoading = _useShowZoom.isLoading;
824
+ var _useDestroyZoom = useDestroyZoom({
825
+ onSuccess: function onSuccess() {
826
+ setIsDisconnectAlertOpen(false);
827
+ onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
828
+ }
829
+ }),
830
+ destroyIntegration = _useDestroyZoom.mutate,
831
+ isDisconnecting = _useDestroyZoom.isLoading;
832
+ var handleDisconnect = function handleDisconnect() {
833
+ return destroyIntegration("zoom");
834
+ };
835
+ if (isLoading) {
836
+ return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
837
+ }
838
+ if (neetoCist.isNotPresent(email)) {
839
+ onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
840
+ }
841
+ return /*#__PURE__*/React__default["default"].createElement(Manage$1, {
842
+ isDisconnectAlertOpen: isDisconnectAlertOpen,
843
+ isDisconnecting: isDisconnecting,
844
+ setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
845
+ description: t("neetoIntegrations.zoom.account", {
846
+ email: email
847
+ }),
848
+ integration: "zoom",
849
+ title: t("neetoIntegrations.zoom.connected"),
850
+ onClose: function onClose() {
851
+ return setIsDisconnectAlertOpen(false);
852
+ },
853
+ onDisconnect: function onDisconnect() {
854
+ return handleDisconnect();
855
+ }
856
+ });
857
+ };
858
+
474
859
  var Stepper = function Stepper(_ref) {
475
860
  var _ref$steps = _ref.steps,
476
861
  steps = _ref$steps === void 0 ? {} : _ref$steps;
@@ -537,21 +922,6 @@ var Modal = function Modal(_ref) {
537
922
  }, children)));
538
923
  };
539
924
 
540
- function _extends$1() {
541
- _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
542
- for (var i = 1; i < arguments.length; i++) {
543
- var source = arguments[i];
544
- for (var key in source) {
545
- if (Object.prototype.hasOwnProperty.call(source, key)) {
546
- target[key] = source[key];
547
- }
548
- }
549
- }
550
- return target;
551
- };
552
- return _extends$1.apply(this, arguments);
553
- }
554
-
555
925
  var propTypes = {exports: {}};
556
926
 
557
927
  /**
@@ -868,15 +1238,17 @@ Object.defineProperty(exports, 'Card', {
868
1238
  });
869
1239
  Object.defineProperty(exports, 'DisconnectAlert', {
870
1240
  enumerable: true,
871
- get: function () { return IntegrationDisconnectAlert__default["default"]; }
1241
+ get: function () { return DisconnectAlert__default["default"]; }
872
1242
  });
873
1243
  Object.defineProperty(exports, 'WalkthroughModal', {
874
1244
  enumerable: true,
875
- get: function () { return IntegrationWalkthroughModal__default["default"]; }
1245
+ get: function () { return WalkthroughModal__default["default"]; }
876
1246
  });
877
1247
  exports.Connect = Connect;
1248
+ exports.Daily = index;
878
1249
  exports.Demo = Demo;
879
1250
  exports.Finish = Finish;
880
1251
  exports.Modal = Modal;
881
1252
  exports.Twilio = Twilio;
1253
+ exports.Zoom = Zoom;
882
1254
  //# sourceMappingURL=index.cjs.js.map