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