@bigbinary/neeto-integrations-frontend 2.7.1 → 2.9.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.
@@ -2,20 +2,13 @@
2
2
 
3
3
  var React = require('react');
4
4
  var neetoCist = require('@bigbinary/neeto-cist');
5
- require('@bigbinary/neeto-molecules/IntegrationCard');
6
- var DisconnectAlert = require('@bigbinary/neeto-molecules/IntegrationDisconnectAlert');
7
- var WalkthroughModal = require('@bigbinary/neeto-molecules/IntegrationWalkthroughModal');
8
- var i18next = require('i18next');
5
+ var formik = require('@bigbinary/neetoui/formik');
6
+ var ramda = require('ramda');
7
+ var reactI18next = require('react-i18next');
9
8
  var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
10
- var constants = require('@bigbinary/neeto-commons-frontend/constants');
11
9
  var reactQuery = require('react-query');
12
10
  var axios = require('axios');
13
- var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
14
- var neetoui = require('@bigbinary/neetoui');
15
- var formik = require('@bigbinary/neetoui/formik');
16
- var reactI18next = require('react-i18next');
17
- var classnames = require('classnames');
18
- var ramda = require('ramda');
11
+ var i18next = require('i18next');
19
12
  var yup = require('yup');
20
13
 
21
14
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -39,69 +32,10 @@ function _interopNamespace(e) {
39
32
  }
40
33
 
41
34
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
42
- var DisconnectAlert__default = /*#__PURE__*/_interopDefaultLegacy(DisconnectAlert);
43
- var WalkthroughModal__default = /*#__PURE__*/_interopDefaultLegacy(WalkthroughModal);
44
- var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
45
35
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
46
- var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
47
- var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
36
+ var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
48
37
  var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
49
38
 
50
- function _arrayWithHoles(arr) {
51
- if (Array.isArray(arr)) return arr;
52
- }
53
-
54
- function _iterableToArrayLimit(arr, i) {
55
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
56
- if (null != _i) {
57
- var _s,
58
- _e,
59
- _x,
60
- _r,
61
- _arr = [],
62
- _n = !0,
63
- _d = !1;
64
- try {
65
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
66
- if (Object(_i) !== _i) return;
67
- _n = !1;
68
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
69
- } catch (err) {
70
- _d = !0, _e = err;
71
- } finally {
72
- try {
73
- if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
74
- } finally {
75
- if (_d) throw _e;
76
- }
77
- }
78
- return _arr;
79
- }
80
- }
81
-
82
- function _arrayLikeToArray(arr, len) {
83
- if (len == null || len > arr.length) len = arr.length;
84
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
85
- return arr2;
86
- }
87
-
88
- function _unsupportedIterableToArray(o, minLen) {
89
- if (!o) return;
90
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
91
- var n = Object.prototype.toString.call(o).slice(8, -1);
92
- if (n === "Object" && o.constructor) n = o.constructor.name;
93
- if (n === "Map" || n === "Set") return Array.from(o);
94
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
95
- }
96
-
97
- function _nonIterableRest() {
98
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
99
- }
100
-
101
- function _slicedToArray(arr, i) {
102
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
103
- }
104
-
105
39
  function _typeof(obj) {
106
40
  "@babel/helpers - typeof";
107
41
 
@@ -143,555 +77,6 @@ function _defineProperty(obj, key, value) {
143
77
  return obj;
144
78
  }
145
79
 
146
- var INTEGRATIONS_ENGINE_BASE_URL = "/neeto_integrations";
147
- var TWILIO_CONFIGURATION_BASE_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/twilio/sms_configurations");
148
- var INTEGRATIONS_ENGINE_DAILY_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/daily");
149
-
150
- var create = function create(payload) {
151
- return axios__default["default"].post(INTEGRATIONS_ENGINE_DAILY_URL, {
152
- daily: payload
153
- });
154
- };
155
- var show = function show() {
156
- return axios__default["default"].get(INTEGRATIONS_ENGINE_DAILY_URL);
157
- };
158
- var destroy = function destroy() {
159
- return axios__default["default"]["delete"](INTEGRATIONS_ENGINE_DAILY_URL);
160
- };
161
- var dailiesApi = {
162
- create: create,
163
- show: show,
164
- destroy: destroy
165
- };
166
-
167
- var QUERY_KEYS = {
168
- TWILIO_SMS_CONFIGURATION: "twilio-sms-configuration",
169
- TWILIO_PHONE_NUMBERS: "twilio-phone-numbers",
170
- DAILY_CO_DETAILS: "daily-co-details",
171
- ZOOM_DETAILS: "zoom-details"
172
- };
173
-
174
- 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; }
175
- 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; }
176
- var useCreateDaily = function useCreateDaily() {
177
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
178
- return reactUtils.useMutationWithInvalidation(dailiesApi.create, _objectSpread$3({
179
- keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS]
180
- }, options));
181
- };
182
- var useFetchDaily = function useFetchDaily() {
183
- return reactQuery.useQuery(QUERY_KEYS.DAILY_CO_DETAILS, dailiesApi.show, {
184
- staleTime: constants.DEFAULT_STALE_TIME
185
- });
186
- };
187
- var useDestroyDaily = function useDestroyDaily(_ref) {
188
- var onSuccess = _ref.onSuccess;
189
- return reactUtils.useMutationWithInvalidation(dailiesApi.destroy, {
190
- keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS],
191
- onSuccess: onSuccess
192
- });
193
- };
194
-
195
- function _extends() {
196
- _extends = Object.assign ? Object.assign.bind() : function (target) {
197
- for (var i = 1; i < arguments.length; i++) {
198
- var source = arguments[i];
199
- for (var key in source) {
200
- if (Object.prototype.hasOwnProperty.call(source, key)) {
201
- target[key] = source[key];
202
- }
203
- }
204
- }
205
- return target;
206
- };
207
- return _extends.apply(this, arguments);
208
- }
209
-
210
- function _objectWithoutPropertiesLoose(source, excluded) {
211
- if (source == null) return {};
212
- var target = {};
213
- var sourceKeys = Object.keys(source);
214
- var key, i;
215
- for (i = 0; i < sourceKeys.length; i++) {
216
- key = sourceKeys[i];
217
- if (excluded.indexOf(key) >= 0) continue;
218
- target[key] = source[key];
219
- }
220
- return target;
221
- }
222
-
223
- function _objectWithoutProperties(source, excluded) {
224
- if (source == null) return {};
225
- var target = _objectWithoutPropertiesLoose(source, excluded);
226
- var key, i;
227
- if (Object.getOwnPropertySymbols) {
228
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
229
- for (i = 0; i < sourceSymbolKeys.length; i++) {
230
- key = sourceSymbolKeys[i];
231
- if (excluded.indexOf(key) >= 0) continue;
232
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
233
- target[key] = source[key];
234
- }
235
- }
236
- return target;
237
- }
238
-
239
- var _excluded = ["className", "children"];
240
- var ExternalLink = function ExternalLink(_ref) {
241
- var _ref$className = _ref.className,
242
- className = _ref$className === void 0 ? "" : _ref$className,
243
- _ref$children = _ref.children,
244
- children = _ref$children === void 0 ? null : _ref$children,
245
- props = _objectWithoutProperties(_ref, _excluded);
246
- return /*#__PURE__*/React__default["default"].createElement("a", _extends({
247
- className: classnames__default["default"](["neeto-ui-text-primary-800 hover:neeto-ui-text-primary-800 visited:neeto-ui-text-primary-600 font-medium", className])
248
- }, props), children);
249
- };
250
- var ExternalLink$1 = /*#__PURE__*/React__default["default"].memo(ExternalLink);
251
-
252
- var MANAGE_DAILY_CO_FORM_INITIAL_VALUES = {
253
- apiKey: ""
254
- };
255
- var DAILY_CO_VALIDATION_SCHEMA = yup__namespace.object().shape({
256
- apiKey: yup__namespace.string().trim().required(i18next.t("neetoIntegrations.errors.required", {
257
- entity: i18next.t("neetoIntegrations.daily.apiKey")
258
- }))
259
- });
260
-
261
- var Form = function Form(_ref) {
262
- var helpDocUrl = _ref.helpDocUrl,
263
- videoUrl = _ref.videoUrl,
264
- onConnect = _ref.onConnect;
265
- var _useTranslation = reactI18next.useTranslation(),
266
- t = _useTranslation.t;
267
- var _useState = React.useState(false),
268
- _useState2 = _slicedToArray(_useState, 2),
269
- isDemoModalOpen = _useState2[0],
270
- setIsDemoModalOpen = _useState2[1];
271
- var _useCreateDaily = useCreateDaily({
272
- onSuccess: function onSuccess() {
273
- return onConnect === null || onConnect === void 0 ? void 0 : onConnect();
274
- }
275
- }),
276
- createDaily = _useCreateDaily.mutate,
277
- isConnecting = _useCreateDaily.isLoading;
278
- var handleSubmit = function handleSubmit(payload) {
279
- return createDaily(payload);
280
- };
281
- if (isConnecting) {
282
- return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
283
- }
284
- return /*#__PURE__*/React__default["default"].createElement("div", {
285
- className: "mx-auto w-full max-w-md"
286
- }, /*#__PURE__*/React__default["default"].createElement(formik.Form, {
287
- formikProps: {
288
- initialValues: MANAGE_DAILY_CO_FORM_INITIAL_VALUES,
289
- validationSchema: DAILY_CO_VALIDATION_SCHEMA,
290
- onSubmit: handleSubmit
291
- }
292
- }, function (_ref2) {
293
- var dirty = _ref2.dirty;
294
- return /*#__PURE__*/React__default["default"].createElement("div", {
295
- className: "mt-10 w-full space-y-5"
296
- }, /*#__PURE__*/React__default["default"].createElement("div", {
297
- className: "block"
298
- }, /*#__PURE__*/React__default["default"].createElement(formik.Input, {
299
- autoFocus: true,
300
- required: true,
301
- label: t("neetoIntegrations.daily.apiKey"),
302
- name: "apiKey",
303
- helpText: /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
304
- i18nKey: "neetoIntegrations.daily.helpDoc",
305
- components: {
306
- externalLink: /*#__PURE__*/React__default["default"].createElement(ExternalLink$1, {
307
- href: helpDocUrl,
308
- rel: "noreferrer",
309
- target: "_blank"
310
- })
311
- }
312
- })
313
- }), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
314
- className: "mt-8",
315
- label: t("neetoIntegrations.daily.walkthroughText"),
316
- style: "link",
317
- onClick: function onClick() {
318
- return setIsDemoModalOpen(true);
319
- }
320
- })), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
321
- disabled: isConnecting || !dirty,
322
- label: t("neetoIntegrations.common.connect"),
323
- loading: isConnecting,
324
- type: "submit"
325
- })));
326
- }), /*#__PURE__*/React__default["default"].createElement(WalkthroughModal__default["default"], {
327
- isOpen: isDemoModalOpen,
328
- videoUrl: videoUrl,
329
- onClose: function onClose() {
330
- return setIsDemoModalOpen(false);
331
- }
332
- }));
333
- };
334
- var Form$1 = reactUtils.withTitle(Form, i18next__default["default"].t("neetoIntegrations.browserTitles.integrations.dailyco"));
335
-
336
- var Manage$1 = reactUtils.withT(function (_ref) {
337
- var t = _ref.t,
338
- title = _ref.title,
339
- description = _ref.description,
340
- integration = _ref.integration,
341
- isDisconnectAlertOpen = _ref.isDisconnectAlertOpen,
342
- setIsDisconnectAlertOpen = _ref.setIsDisconnectAlertOpen,
343
- isDisconnecting = _ref.isDisconnecting,
344
- onDisconnect = _ref.onDisconnect,
345
- onClose = _ref.onClose;
346
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
347
- className: "mx-auto w-full max-w-md"
348
- }, /*#__PURE__*/React__default["default"].createElement("div", {
349
- className: "mt-10 w-full space-y-4"
350
- }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
351
- className: "neeto-ui-text-gray-800 mb-0.5",
352
- style: "h3",
353
- weight: "semibold"
354
- }, title), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
355
- className: "neeto-ui-text-gray-600 break-all",
356
- style: "body1",
357
- weight: "normal"
358
- }, description), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
359
- label: t("neetoIntegrations.common.disconnect"),
360
- style: "danger",
361
- onClick: function onClick() {
362
- return setIsDisconnectAlertOpen(true);
363
- }
364
- }))), /*#__PURE__*/React__default["default"].createElement(DisconnectAlert__default["default"], {
365
- isDisconnecting: isDisconnecting,
366
- onClose: onClose,
367
- onDisconnect: onDisconnect,
368
- isOpen: isDisconnectAlertOpen,
369
- message: t("neetoIntegrations.".concat(integration, ".disconnect.message")),
370
- title: t("neetoIntegrations.".concat(integration, ".disconnect.title"))
371
- }));
372
- });
373
-
374
- var Manage = function Manage(_ref) {
375
- var onDisconnect = _ref.onDisconnect;
376
- var _useState = React.useState(false),
377
- _useState2 = _slicedToArray(_useState, 2),
378
- isDisconnectAlertOpen = _useState2[0],
379
- setIsDisconnectAlertOpen = _useState2[1];
380
- var _useFetchDaily = useFetchDaily(),
381
- _useFetchDaily$data = _useFetchDaily.data,
382
- _useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
383
- _useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
384
- metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$,
385
- isLoading = _useFetchDaily.isLoading;
386
- var _ref2 = metadata || {},
387
- _ref2$apiKey = _ref2.apiKey,
388
- apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
389
- var _useTranslation = reactI18next.useTranslation(),
390
- t = _useTranslation.t;
391
- var _useDestroyDaily = useDestroyDaily({
392
- onSuccess: function onSuccess() {
393
- setIsDisconnectAlertOpen(false);
394
- onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
395
- }
396
- }),
397
- destroyIntegration = _useDestroyDaily.mutate,
398
- isDisconnecting = _useDestroyDaily.isLoading;
399
- var handleDisconnect = function handleDisconnect() {
400
- return destroyIntegration("daily");
401
- };
402
- if (isLoading || isDisconnecting) {
403
- return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
404
- }
405
- if (neetoCist.isNotPresent(apiKey)) {
406
- onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
407
- }
408
- return /*#__PURE__*/React__default["default"].createElement(Manage$1, {
409
- isDisconnectAlertOpen: isDisconnectAlertOpen,
410
- isDisconnecting: isDisconnecting,
411
- setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
412
- description: t("neetoIntegrations.daily.yourApiKey", {
413
- apiKey: apiKey
414
- }),
415
- integration: "daily",
416
- title: t("neetoIntegrations.daily.connected"),
417
- onClose: function onClose() {
418
- return setIsDisconnectAlertOpen(false);
419
- },
420
- onDisconnect: handleDisconnect
421
- });
422
- };
423
-
424
- var Daily = function Daily(_ref) {
425
- var _ref$isOnboarding = _ref.isOnboarding,
426
- isOnboarding = _ref$isOnboarding === void 0 ? false : _ref$isOnboarding,
427
- _ref$helpDocUrl = _ref.helpDocUrl,
428
- helpDocUrl = _ref$helpDocUrl === void 0 ? "" : _ref$helpDocUrl,
429
- _ref$videoUrl = _ref.videoUrl,
430
- videoUrl = _ref$videoUrl === void 0 ? "" : _ref$videoUrl,
431
- _ref$onConnect = _ref.onConnect,
432
- onConnect = _ref$onConnect === void 0 ? neetoCist.noop : _ref$onConnect,
433
- _ref$onDisconnect = _ref.onDisconnect,
434
- onDisconnect = _ref$onDisconnect === void 0 ? neetoCist.noop : _ref$onDisconnect;
435
- var _useFetchDaily = useFetchDaily(),
436
- _useFetchDaily$data = _useFetchDaily.data,
437
- _useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
438
- _useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
439
- metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$;
440
- var _ref2 = metadata || {},
441
- _ref2$apiKey = _ref2.apiKey,
442
- apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
443
- if (neetoCist.isPresent(apiKey) && !isOnboarding) {
444
- return /*#__PURE__*/React__default["default"].createElement(Manage, {
445
- onDisconnect: onDisconnect
446
- });
447
- }
448
- return /*#__PURE__*/React__default["default"].createElement(Form$1, {
449
- onConnect: onConnect,
450
- helpDocUrl: helpDocUrl,
451
- videoUrl: videoUrl
452
- });
453
- };
454
- reactUtils.withTitle(Daily, i18next__default["default"].t("neetoIntegrations.browserTitles.integrations.dailyco"));
455
-
456
- var Stepper = function Stepper(_ref) {
457
- var _ref$steps = _ref.steps,
458
- steps = _ref$steps === void 0 ? {} : _ref$steps;
459
- var isActiveOrCompleted = function isActiveOrCompleted(activeStatus, completedStatus) {
460
- return activeStatus || completedStatus;
461
- };
462
- return /*#__PURE__*/React__default["default"].createElement("ul", {
463
- className: "flex gap-4"
464
- }, steps === null || steps === void 0 ? void 0 : steps.map(function (_ref2) {
465
- var step = _ref2.step,
466
- label = _ref2.label,
467
- isActive = _ref2.isActive,
468
- isCompleted = _ref2.isCompleted;
469
- return /*#__PURE__*/React__default["default"].createElement("li", {
470
- className: "flex items-center gap-4",
471
- key: step
472
- }, step !== "1" && /*#__PURE__*/React__default["default"].createElement("div", {
473
- className: classnames__default["default"]("w-10 border-b", {
474
- "neeto-ui-border-gray-800": isActiveOrCompleted(isActive, isCompleted),
475
- "neeto-ui-border-gray-400": !isActiveOrCompleted(isActive, isCompleted)
476
- })
477
- }), /*#__PURE__*/React__default["default"].createElement("div", {
478
- className: "flex items-center gap-2"
479
- }, /*#__PURE__*/React__default["default"].createElement("div", {
480
- className: classnames__default["default"]("neeto-ui-rounded-full neeto-ui-gray-600 flex h-6 w-6 items-center justify-center border", {
481
- "neeto-ui-bg-success-600 neeto-ui-border-success-600 neeto-ui-text-white": isActive,
482
- "neeto-ui-bg-primary-600 neeto-ui-border-primary-600 neeto-ui-text-white": isCompleted,
483
- "neeto-ui-border-gray-400": !isActiveOrCompleted(isActive, isCompleted)
484
- })
485
- }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
486
- component: "span",
487
- style: "body2",
488
- weight: "normal"
489
- }, step)), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
490
- style: "body2",
491
- weight: "normal",
492
- className: classnames__default["default"]({
493
- "neeto-ui-text-gray-800": isActiveOrCompleted(isActive, isCompleted),
494
- "neeto-ui-text-gray-600": !isActiveOrCompleted(isActive, isCompleted)
495
- })
496
- }, label)));
497
- }));
498
- };
499
-
500
- var Modal = function Modal(_ref) {
501
- var _ref$isOpen = _ref.isOpen,
502
- isOpen = _ref$isOpen === void 0 ? neetoCist.noop : _ref$isOpen,
503
- _ref$onClose = _ref.onClose,
504
- onClose = _ref$onClose === void 0 ? neetoCist.noop : _ref$onClose,
505
- _ref$steps = _ref.steps,
506
- steps = _ref$steps === void 0 ? {} : _ref$steps,
507
- children = _ref.children;
508
- return /*#__PURE__*/React__default["default"].createElement(neetoui.Modal, {
509
- className: "neeto-ui-flex neeto-ui-flex-col neeto-ui-transform-none w-screen overflow-y-auto",
510
- isOpen: isOpen,
511
- size: "fullScreen",
512
- onClose: onClose
513
- }, /*#__PURE__*/React__default["default"].createElement(neetoui.Modal.Header, null, /*#__PURE__*/React__default["default"].createElement(Stepper, {
514
- steps: steps
515
- })), /*#__PURE__*/React__default["default"].createElement(neetoui.Modal.Body, {
516
- className: "neeto-ui-flex neeto-ui-justify-center neeto-ui-items-center neeto-ui-flex-grow"
517
- }, /*#__PURE__*/React__default["default"].createElement("div", {
518
- className: "neeto-ui-w-full py-10"
519
- }, children)));
520
- };
521
-
522
- var propTypes = {exports: {}};
523
-
524
- /**
525
- * Copyright (c) 2013-present, Facebook, Inc.
526
- *
527
- * This source code is licensed under the MIT license found in the
528
- * LICENSE file in the root directory of this source tree.
529
- */
530
- var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
531
- var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
532
-
533
- /**
534
- * Copyright (c) 2013-present, Facebook, Inc.
535
- *
536
- * This source code is licensed under the MIT license found in the
537
- * LICENSE file in the root directory of this source tree.
538
- */
539
- var ReactPropTypesSecret = ReactPropTypesSecret_1;
540
- function emptyFunction() {}
541
- function emptyFunctionWithReset() {}
542
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
543
- var factoryWithThrowingShims = function factoryWithThrowingShims() {
544
- function shim(props, propName, componentName, location, propFullName, secret) {
545
- if (secret === ReactPropTypesSecret) {
546
- // It is still safe when called from React.
547
- return;
548
- }
549
- 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');
550
- err.name = 'Invariant Violation';
551
- throw err;
552
- }
553
- shim.isRequired = shim;
554
- function getShim() {
555
- return shim;
556
- }
557
- // Important!
558
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
559
- var ReactPropTypes = {
560
- array: shim,
561
- bigint: shim,
562
- bool: shim,
563
- func: shim,
564
- number: shim,
565
- object: shim,
566
- string: shim,
567
- symbol: shim,
568
- any: shim,
569
- arrayOf: getShim,
570
- element: shim,
571
- elementType: shim,
572
- instanceOf: getShim,
573
- node: shim,
574
- objectOf: getShim,
575
- oneOf: getShim,
576
- oneOfType: getShim,
577
- shape: getShim,
578
- exact: getShim,
579
- checkPropTypes: emptyFunctionWithReset,
580
- resetWarningCache: emptyFunction
581
- };
582
- ReactPropTypes.PropTypes = ReactPropTypes;
583
- return ReactPropTypes;
584
- };
585
-
586
- /**
587
- * Copyright (c) 2013-present, Facebook, Inc.
588
- *
589
- * This source code is licensed under the MIT license found in the
590
- * LICENSE file in the root directory of this source tree.
591
- */
592
- {
593
- // By explicitly using `prop-types` you are opting into new production behavior.
594
- // http://fb.me/prop-types-in-prod
595
- propTypes.exports = factoryWithThrowingShims();
596
- }
597
-
598
- ({
599
- /**
600
- * To specify the Icon to be shown
601
- */
602
- Icon: propTypes.exports.PropTypes.node,
603
- /**
604
- * To specify the title of the connect component
605
- */
606
- title: propTypes.exports.PropTypes.string,
607
- /**
608
- * To specify the description for connect component
609
- */
610
- description: propTypes.exports.PropTypes.string,
611
- /**
612
- * To specify the props for the connect button
613
- */
614
- buttonProps: propTypes.exports.PropTypes.object,
615
- /**
616
- * Handler function that is triggered when the connect button is clicked.
617
- */
618
- onConnect: propTypes.exports.PropTypes.func
619
- });
620
-
621
- ({
622
- /**
623
- * To specify whether the integration modal should be opened or closed.
624
- */
625
- onClose: propTypes.exports.func,
626
- /**
627
- * To specify the walkthrough video link
628
- */
629
- videoUrl: propTypes.exports.string,
630
- /**
631
- * To specify the title of the demo component
632
- */
633
- title: propTypes.exports.string,
634
- /**
635
- * To specify the subtitle of the demo component
636
- */
637
- subtitle: propTypes.exports.string,
638
- /**
639
- * To specify the title of the video in the iframe
640
- */
641
- iframeTitle: propTypes.exports.string
642
- });
643
-
644
- ({
645
- /**
646
- * To specify whether the integration modal should be opened or closed.
647
- */
648
- onClick: propTypes.exports.func,
649
- /**
650
- * To show the title of the Finish component
651
- */
652
- title: propTypes.exports.string,
653
- /**
654
- * To specify props for primary button
655
- */
656
- buttonProps: propTypes.exports.object,
657
- /**
658
- * To specify props for secondary button
659
- */
660
- secondaryButtonProps: propTypes.exports.object
661
- });
662
-
663
- var e = [],
664
- t = [];
665
- function n(n, r) {
666
- if (n && "undefined" != typeof document) {
667
- var a,
668
- s = !0 === r.prepend ? "prepend" : "append",
669
- d = !0 === r.singleTag,
670
- i = "string" == typeof r.container ? document.querySelector(r.container) : document.getElementsByTagName("head")[0];
671
- if (d) {
672
- var u = e.indexOf(i);
673
- -1 === u && (u = e.push(i) - 1, t[u] = {}), a = t[u] && t[u][s] ? t[u][s] : t[u][s] = c();
674
- } else a = c();
675
- 65279 === n.charCodeAt(0) && (n = n.substring(1)), a.styleSheet ? a.styleSheet.cssText += n : a.appendChild(document.createTextNode(n));
676
- }
677
- function c() {
678
- var e = document.createElement("style");
679
- 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]]);
680
- var a = "prepend" === s ? "afterbegin" : "beforeend";
681
- return i.insertAdjacentElement(a, e), e;
682
- }
683
- }
684
-
685
- 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%}";
686
- n(css,{});
687
-
688
- var TWILIO_INTEGRATION_STEPS = [{
689
- step: "1",
690
- label: i18next__default["default"].t("neetoIntegrations.steps.configure"),
691
- isActive: true,
692
- isCompleted: false
693
- }];
694
-
695
80
  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; }
696
81
  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; }
697
82
  var ConfigurationForm = function ConfigurationForm(_ref) {
@@ -749,41 +134,101 @@ var ConfigurationForm = function ConfigurationForm(_ref) {
749
134
  })));
750
135
  };
751
136
 
752
- function _arrayWithoutHoles(arr) {
753
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
137
+ function _arrayWithHoles(arr) {
138
+ if (Array.isArray(arr)) return arr;
139
+ }
140
+
141
+ function _iterableToArrayLimit(arr, i) {
142
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
143
+ if (null != _i) {
144
+ var _s,
145
+ _e,
146
+ _x,
147
+ _r,
148
+ _arr = [],
149
+ _n = !0,
150
+ _d = !1;
151
+ try {
152
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
153
+ if (Object(_i) !== _i) return;
154
+ _n = !1;
155
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
156
+ } catch (err) {
157
+ _d = !0, _e = err;
158
+ } finally {
159
+ try {
160
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
161
+ } finally {
162
+ if (_d) throw _e;
163
+ }
164
+ }
165
+ return _arr;
166
+ }
167
+ }
168
+
169
+ function _arrayLikeToArray(arr, len) {
170
+ if (len == null || len > arr.length) len = arr.length;
171
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
172
+ return arr2;
754
173
  }
755
174
 
756
- function _iterableToArray(iter) {
757
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
175
+ function _unsupportedIterableToArray(o, minLen) {
176
+ if (!o) return;
177
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
178
+ var n = Object.prototype.toString.call(o).slice(8, -1);
179
+ if (n === "Object" && o.constructor) n = o.constructor.name;
180
+ if (n === "Map" || n === "Set") return Array.from(o);
181
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
758
182
  }
759
183
 
760
- function _nonIterableSpread() {
761
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
184
+ function _nonIterableRest() {
185
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
762
186
  }
763
187
 
764
- function _toConsumableArray(arr) {
765
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
188
+ function _slicedToArray(arr, i) {
189
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
766
190
  }
767
191
 
192
+ var INTEGRATIONS_ENGINE_BASE_URL = "/neeto_integrations";
193
+ var TWILIO_CONFIGURATION_BASE_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/twilio/sms_configurations");
194
+
195
+ function ownKeys$1(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; }
196
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
197
+ var fetchTwilioSmsConfiguration = function fetchTwilioSmsConfiguration(integrable) {
198
+ return axios__default["default"].get(TWILIO_CONFIGURATION_BASE_URL, {
199
+ params: integrable
200
+ });
201
+ };
202
+ var removeTwilioConfiguration = function removeTwilioConfiguration() {
203
+ return axios__default["default"]["delete"](TWILIO_CONFIGURATION_BASE_URL);
204
+ };
205
+ var getTwilioPhoneNumbers = function getTwilioPhoneNumbers(data) {
206
+ return axios__default["default"].get("".concat(TWILIO_CONFIGURATION_BASE_URL, "/new"), {
207
+ params: data
208
+ });
209
+ };
210
+ var createTwilioConfiguration = function createTwilioConfiguration(payload, integrable) {
211
+ return axios__default["default"].post(TWILIO_CONFIGURATION_BASE_URL, _objectSpread$1(_objectSpread$1({}, payload), integrable));
212
+ };
768
213
  var twilioApi = {
769
- fetchTwilioSmsConfiguration: function fetchTwilioSmsConfiguration() {
770
- return axios__default["default"].get(TWILIO_CONFIGURATION_BASE_URL);
771
- },
772
- removeTwilioConfiguration: function removeTwilioConfiguration() {
773
- return axios__default["default"]["delete"](TWILIO_CONFIGURATION_BASE_URL);
774
- },
775
- getTwilioPhoneNumbers: function getTwilioPhoneNumbers(data) {
776
- return axios__default["default"].get("".concat(TWILIO_CONFIGURATION_BASE_URL, "/new"), {
777
- params: data
778
- });
779
- },
780
- createTwilioConfiguration: function createTwilioConfiguration(payload) {
781
- return axios__default["default"].post(TWILIO_CONFIGURATION_BASE_URL, payload);
782
- }
214
+ fetchTwilioSmsConfiguration: fetchTwilioSmsConfiguration,
215
+ removeTwilioConfiguration: removeTwilioConfiguration,
216
+ getTwilioPhoneNumbers: getTwilioPhoneNumbers,
217
+ createTwilioConfiguration: createTwilioConfiguration
218
+ };
219
+
220
+ var QUERY_KEYS = {
221
+ TWILIO_SMS_CONFIGURATION: "twilio-sms-configuration",
222
+ TWILIO_PHONE_NUMBERS: "twilio-phone-numbers",
223
+ DAILY_CO_DETAILS: "daily-co-details",
224
+ ZOOM_DETAILS: "zoom-details"
783
225
  };
784
226
 
785
- var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration() {
786
- return reactQuery.useQuery(QUERY_KEYS.TWILIO_SMS_CONFIGURATION, twilioApi.fetchTwilioSmsConfiguration, {
227
+ var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration(_ref) {
228
+ var integrable = _ref.integrable;
229
+ return reactQuery.useQuery([QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId], function () {
230
+ return twilioApi.fetchTwilioSmsConfiguration(integrable);
231
+ }, {
787
232
  select: function select(response) {
788
233
  var _smsConfiguration$twi, _smsConfiguration$twi2, _smsConfiguration$twi3;
789
234
  var smsConfiguration = response.smsConfiguration;
@@ -795,10 +240,10 @@ var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration() {
795
240
  }
796
241
  });
797
242
  };
798
- var useFetchTwilioPhoneNumbers = function useFetchTwilioPhoneNumbers(_ref) {
243
+ var useFetchTwilioPhoneNumbers = function useFetchTwilioPhoneNumbers(_ref2) {
799
244
  var _formRef$current, _formRef$current$valu, _formRef$current2, _formRef$current2$val;
800
- var credentials = _ref.credentials,
801
- formRef = _ref.formRef;
245
+ var credentials = _ref2.credentials,
246
+ formRef = _ref2.formRef;
802
247
  return reactQuery.useQuery([QUERY_KEYS.TWILIO_PHONE_NUMBERS, {
803
248
  credentials: credentials
804
249
  }], function () {
@@ -809,27 +254,28 @@ var useFetchTwilioPhoneNumbers = function useFetchTwilioPhoneNumbers(_ref) {
809
254
  retry: false
810
255
  });
811
256
  };
812
- var useCreateTwilioConfiguration = function useCreateTwilioConfiguration() {
813
- return reactUtils.useMutationWithInvalidation(twilioApi.createTwilioConfiguration, {
814
- keysToInvalidate: [QUERY_KEYS.TWILIO_SMS_CONFIGURATION]
257
+ var useCreateTwilioConfiguration = function useCreateTwilioConfiguration(_ref3) {
258
+ var integrable = _ref3.integrable;
259
+ return reactUtils.useMutationWithInvalidation(function (payload) {
260
+ return twilioApi.createTwilioConfiguration(payload, integrable);
261
+ }, {
262
+ keysToInvalidate: [QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId]
815
263
  });
816
264
  };
817
265
 
818
- function ownKeys$1(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; }
819
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
820
266
  var useTwilio = function useTwilio(_ref) {
821
- var _ref$onSave = _ref.onSave,
822
- onSave = _ref$onSave === void 0 ? neetoCist.noop : _ref$onSave,
823
- _ref$setSteps = _ref.setSteps,
824
- setSteps = _ref$setSteps === void 0 ? neetoCist.noop : _ref$setSteps,
825
- _ref$onConnect = _ref.onConnect,
267
+ var _ref$onConnect = _ref.onConnect,
826
268
  onConnect = _ref$onConnect === void 0 ? neetoCist.noop : _ref$onConnect,
827
269
  _ref$formRef = _ref.formRef,
828
- formRef = _ref$formRef === void 0 ? null : _ref$formRef;
829
- var _useFetchTwilioSmsCon = useFetchTwilioSmsConfiguration(),
830
- configuration = _useFetchTwilioSmsCon.data,
831
- isConfigurationLoading = _useFetchTwilioSmsCon.isLoading,
832
- refetchTwilioSmsConfiguration = _useFetchTwilioSmsCon.refetch;
270
+ formRef = _ref$formRef === void 0 ? null : _ref$formRef,
271
+ _ref$integrable = _ref.integrable,
272
+ integrable = _ref$integrable === void 0 ? null : _ref$integrable;
273
+ var _useFetchTwilioSmsCon = useFetchTwilioSmsConfiguration({
274
+ integrable: integrable
275
+ }),
276
+ _useFetchTwilioSmsCon2 = _useFetchTwilioSmsCon.data,
277
+ configuration = _useFetchTwilioSmsCon2 === void 0 ? {} : _useFetchTwilioSmsCon2,
278
+ isConfigurationLoading = _useFetchTwilioSmsCon.isLoading;
833
279
  var _useStateWithDependen = reactUtils.useStateWithDependency(configuration),
834
280
  _useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
835
281
  credentials = _useStateWithDependen2[0],
@@ -840,19 +286,11 @@ var useTwilio = function useTwilio(_ref) {
840
286
  }),
841
287
  phoneNumbers = _useFetchTwilioPhoneN.data,
842
288
  isPhoneNumbersLoading = _useFetchTwilioPhoneN.isLoading;
843
- var _useCreateTwilioConfi = useCreateTwilioConfiguration(),
289
+ var _useCreateTwilioConfi = useCreateTwilioConfiguration({
290
+ integrable: integrable
291
+ }),
844
292
  saveConfiguration = _useCreateTwilioConfi.mutate,
845
293
  isSubmitting = _useCreateTwilioConfi.isLoading;
846
- React.useEffect(function () {
847
- if (!(configuration !== null && configuration !== void 0 && configuration.twilioPhoneNumber)) return;
848
- setSteps(function (steps) {
849
- var stepsClone = _toConsumableArray(steps);
850
- stepsClone[0] = _objectSpread$1(_objectSpread$1({}, steps[0]), {}, {
851
- isCompleted: true
852
- });
853
- return stepsClone;
854
- });
855
- }, [configuration]);
856
294
  var handleSubmit = function handleSubmit(values) {
857
295
  var _values$twilioPhoneNu;
858
296
  var payload = {
@@ -865,11 +303,7 @@ var useTwilio = function useTwilio(_ref) {
865
303
  return;
866
304
  }
867
305
  saveConfiguration(payload, {
868
- onSuccess: function onSuccess() {
869
- onSave();
870
- refetchTwilioSmsConfiguration();
871
- onConnect === null || onConnect === void 0 ? void 0 : onConnect();
872
- }
306
+ onSuccess: onConnect
873
307
  });
874
308
  };
875
309
  return {
@@ -895,26 +329,21 @@ var buildTwilioConfigurationValidationSchema = function buildTwilioConfiguration
895
329
 
896
330
  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; }
897
331
  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; }
898
- var TwilioConfiguration = function TwilioConfiguration(_ref) {
899
- var _ref$onCancel = _ref.onCancel,
900
- onCancel = _ref$onCancel === void 0 ? neetoCist.noop : _ref$onCancel,
901
- _ref$onSave = _ref.onSave,
902
- onSave = _ref$onSave === void 0 ? neetoCist.noop : _ref$onSave,
903
- _ref$setSteps = _ref.setSteps,
904
- setSteps = _ref$setSteps === void 0 ? neetoCist.noop : _ref$setSteps,
332
+ var Twilio = function Twilio(_ref) {
333
+ var _ref$integrable = _ref.integrable,
334
+ integrable = _ref$integrable === void 0 ? null : _ref$integrable,
335
+ _ref$onClose = _ref.onClose,
336
+ onClose = _ref$onClose === void 0 ? neetoCist.noop : _ref$onClose,
905
337
  _ref$onConnect = _ref.onConnect,
906
- onConnect = _ref$onConnect === void 0 ? neetoCist.noop : _ref$onConnect,
907
- _ref$isModal = _ref.isModal,
908
- isModal = _ref$isModal === void 0 ? false : _ref$isModal;
338
+ onConnect = _ref$onConnect === void 0 ? neetoCist.noop : _ref$onConnect;
909
339
  var _useTranslation = reactI18next.useTranslation(),
910
340
  t = _useTranslation.t;
911
341
  var initialFocusRef = React.useRef();
912
342
  var formRef = React.useRef();
913
343
  var _useTwilio = useTwilio({
914
- onSave: onSave,
915
- setSteps: setSteps,
916
344
  onConnect: onConnect,
917
- formRef: formRef
345
+ formRef: formRef,
346
+ integrable: integrable
918
347
  }),
919
348
  handleSubmit = _useTwilio.handleSubmit,
920
349
  phoneNumbers = _useTwilio.phoneNumbers,
@@ -933,43 +362,14 @@ var TwilioConfiguration = function TwilioConfiguration(_ref) {
933
362
  var selectedPhoneNumber = neetoCist._findBy({
934
363
  label: configuration === null || configuration === void 0 ? void 0 : configuration.twilioPhoneNumber
935
364
  }, phoneNumberOptions);
936
- var wrapInModalBody = function wrapInModalBody(children) {
937
- return /*#__PURE__*/React__default["default"].createElement(neetoui.Modal.Body, null, children);
938
- };
939
- var wrapInModalFooter = function wrapInModalFooter(children) {
940
- return /*#__PURE__*/React__default["default"].createElement(neetoui.Modal.Footer, null, children);
941
- };
942
365
  var isLoading = isPhoneNumbersLoading || isConfigurationLoading;
943
366
  var isSubmitDisabled = function isSubmitDisabled(values) {
944
367
  return ramda.equals(_objectSpread(_objectSpread({}, configuration), {}, {
945
368
  twilioPhoneNumber: selectedPhoneNumber
946
369
  }), values) || isLoading;
947
370
  };
948
- var renderActionBlock = function renderActionBlock(values) {
949
- return /*#__PURE__*/React__default["default"].createElement(formik.ActionBlock, {
950
- cancelButtonProps: {
951
- onClick: onCancel,
952
- disabled: false
953
- },
954
- className: "space-x-3",
955
- submitButtonProps: {
956
- label: phoneNumberOptions ? t("neetoIntegrations.common.saveChanges") : t("neetoIntegrations.common.verify"),
957
- disabled: isSubmitDisabled(values),
958
- loading: isSubmitting || isPhoneNumbersLoading && !(configuration !== null && configuration !== void 0 && configuration.twilioAuthToken)
959
- }
960
- });
961
- };
962
- var renderForm = function renderForm(formikProps) {
963
- return /*#__PURE__*/React__default["default"].createElement(ConfigurationForm, {
964
- formikProps: formikProps,
965
- initialFocusRef: initialFocusRef,
966
- isUsingOverlay: isModal,
967
- phoneNumberOptions: phoneNumberOptions,
968
- selectedPhoneNumber: selectedPhoneNumber
969
- });
970
- };
971
371
  return /*#__PURE__*/React__default["default"].createElement(formik.Form, {
972
- className: "mx-auto flex w-full max-w-md flex-col",
372
+ className: "mx-auto flex w-full max-w-md flex-col p-5",
973
373
  formikProps: {
974
374
  enableReinitialize: true,
975
375
  validationSchema: buildTwilioConfigurationValidationSchema(!!phoneNumbers),
@@ -978,32 +378,27 @@ var TwilioConfiguration = function TwilioConfiguration(_ref) {
978
378
  onSubmit: handleSubmit
979
379
  }
980
380
  }, function (formikProps) {
981
- return isModal ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, wrapInModalBody(renderForm(formikProps)), wrapInModalFooter(renderActionBlock(formikProps.values))) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, "renderForm(formikProps)", /*#__PURE__*/React__default["default"].createElement("div", {
381
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(ConfigurationForm, {
382
+ formikProps: formikProps,
383
+ initialFocusRef: initialFocusRef,
384
+ phoneNumberOptions: phoneNumberOptions,
385
+ selectedPhoneNumber: selectedPhoneNumber
386
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
982
387
  className: "mt-4 flex items-center gap-x-2"
983
- }, renderActionBlock(formikProps.values)));
388
+ }, /*#__PURE__*/React__default["default"].createElement(formik.ActionBlock, {
389
+ cancelButtonProps: {
390
+ onClick: onClose,
391
+ disabled: false
392
+ },
393
+ className: "space-x-3",
394
+ submitButtonProps: {
395
+ label: phoneNumberOptions ? t("neetoIntegrations.common.saveChanges") : t("neetoIntegrations.common.verify"),
396
+ disabled: isSubmitDisabled(formikProps.values),
397
+ loading: isSubmitting || isPhoneNumbersLoading && !(configuration !== null && configuration !== void 0 && configuration.twilioAuthToken)
398
+ }
399
+ })));
984
400
  });
985
401
  };
986
402
 
987
- var Twilio = function Twilio(_ref) {
988
- var _ref$onClose = _ref.onClose,
989
- onClose = _ref$onClose === void 0 ? neetoCist.noop : _ref$onClose,
990
- _ref$onConnect = _ref.onConnect,
991
- onConnect = _ref$onConnect === void 0 ? neetoCist.noop : _ref$onConnect;
992
- var _useState = React.useState(TWILIO_INTEGRATION_STEPS),
993
- _useState2 = _slicedToArray(_useState, 2),
994
- steps = _useState2[0],
995
- setSteps = _useState2[1];
996
- return /*#__PURE__*/React__default["default"].createElement(Modal, {
997
- isOpen: true,
998
- steps: steps,
999
- onClose: onClose
1000
- }, /*#__PURE__*/React__default["default"].createElement(TwilioConfiguration, {
1001
- isModal: true,
1002
- setSteps: setSteps,
1003
- onCancel: onClose,
1004
- onConnect: onConnect
1005
- }));
1006
- };
1007
-
1008
403
  module.exports = Twilio;
1009
404
  //# sourceMappingURL=Twilio.cjs.js.map