@bigbinary/neeto-integrations-frontend 2.8.0 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -39
- package/{src → app/javascript/src}/translations/en.json +13 -0
- package/dist/Daily.cjs.js +185 -85
- package/dist/Daily.cjs.js.map +1 -1
- package/dist/Daily.js +206 -106
- package/dist/Daily.js.map +1 -1
- package/dist/GoogleCalender.cjs.js +879 -0
- package/dist/GoogleCalender.cjs.js.map +1 -0
- package/dist/GoogleCalender.js +848 -0
- package/dist/GoogleCalender.js.map +1 -0
- package/dist/Twilio.cjs.js +111 -733
- package/dist/Twilio.cjs.js.map +1 -1
- package/dist/Twilio.js +114 -732
- package/dist/Twilio.js.map +1 -1
- package/dist/ZapierForm.cjs.js +48 -47
- package/dist/ZapierForm.cjs.js.map +1 -1
- package/dist/ZapierForm.js +49 -48
- package/dist/ZapierForm.js.map +1 -1
- package/dist/Zoom.cjs.js +129 -29
- package/dist/Zoom.cjs.js.map +1 -1
- package/dist/Zoom.js +154 -54
- package/dist/Zoom.js.map +1 -1
- package/dist/index.cjs.js +192 -163
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +192 -164
- package/dist/index.js.map +1 -1
- package/package.json +122 -90
- package/types.d.ts +8 -2
- /package/{src → app/javascript/src}/translations/index.js +0 -0
package/dist/Twilio.js
CHANGED
|
@@ -1,76 +1,14 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import '@bigbinary/
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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
|
|
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,557 +50,8 @@ function _defineProperty(obj, key, value) {
|
|
|
112
50
|
return obj;
|
|
113
51
|
}
|
|
114
52
|
|
|
115
|
-
var
|
|
116
|
-
var
|
|
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$4(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$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(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$4({
|
|
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
|
-
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; }
|
|
665
|
-
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; }
|
|
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; }
|
|
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) {
|
|
667
56
|
var _errors$twilioPhoneNu;
|
|
668
57
|
var phoneNumberOptions = _ref.phoneNumberOptions,
|
|
@@ -711,31 +100,73 @@ var ConfigurationForm = function ConfigurationForm(_ref) {
|
|
|
711
100
|
options: phoneNumberOptions,
|
|
712
101
|
size: "large",
|
|
713
102
|
onChange: function onChange(selected) {
|
|
714
|
-
return setValues(_objectSpread$
|
|
103
|
+
return setValues(_objectSpread$2(_objectSpread$2({}, values), {}, {
|
|
715
104
|
twilioPhoneNumber: selected
|
|
716
105
|
}));
|
|
717
106
|
}
|
|
718
107
|
})));
|
|
719
108
|
};
|
|
720
109
|
|
|
721
|
-
function
|
|
722
|
-
if (Array.isArray(arr)) return
|
|
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
|
|
726
|
-
if (
|
|
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
|
|
730
|
-
throw new TypeError("Invalid attempt to
|
|
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
|
|
734
|
-
return
|
|
161
|
+
function _slicedToArray(arr, i) {
|
|
162
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
735
163
|
}
|
|
736
164
|
|
|
737
|
-
|
|
738
|
-
|
|
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; }
|
|
739
170
|
var fetchTwilioSmsConfiguration = function fetchTwilioSmsConfiguration(integrable) {
|
|
740
171
|
return axios.get(TWILIO_CONFIGURATION_BASE_URL, {
|
|
741
172
|
params: integrable
|
|
@@ -750,7 +181,7 @@ var getTwilioPhoneNumbers = function getTwilioPhoneNumbers(data) {
|
|
|
750
181
|
});
|
|
751
182
|
};
|
|
752
183
|
var createTwilioConfiguration = function createTwilioConfiguration(payload, integrable) {
|
|
753
|
-
return axios.post(TWILIO_CONFIGURATION_BASE_URL, _objectSpread$
|
|
184
|
+
return axios.post(TWILIO_CONFIGURATION_BASE_URL, _objectSpread$1(_objectSpread$1({}, payload), integrable));
|
|
754
185
|
};
|
|
755
186
|
var twilioApi = {
|
|
756
187
|
fetchTwilioSmsConfiguration: fetchTwilioSmsConfiguration,
|
|
@@ -759,9 +190,16 @@ var twilioApi = {
|
|
|
759
190
|
createTwilioConfiguration: createTwilioConfiguration
|
|
760
191
|
};
|
|
761
192
|
|
|
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
|
+
|
|
762
200
|
var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration(_ref) {
|
|
763
201
|
var integrable = _ref.integrable;
|
|
764
|
-
return useQuery([QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId], function () {
|
|
202
|
+
return useQuery([QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableType, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId], function () {
|
|
765
203
|
return twilioApi.fetchTwilioSmsConfiguration(integrable);
|
|
766
204
|
}, {
|
|
767
205
|
select: function select(response) {
|
|
@@ -776,7 +214,7 @@ var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration(_re
|
|
|
776
214
|
});
|
|
777
215
|
};
|
|
778
216
|
var useFetchTwilioPhoneNumbers = function useFetchTwilioPhoneNumbers(_ref2) {
|
|
779
|
-
var _formRef$current, _formRef$
|
|
217
|
+
var _formRef$current, _formRef$current2;
|
|
780
218
|
var credentials = _ref2.credentials,
|
|
781
219
|
formRef = _ref2.formRef;
|
|
782
220
|
return useQuery([QUERY_KEYS.TWILIO_PHONE_NUMBERS, {
|
|
@@ -784,7 +222,7 @@ var useFetchTwilioPhoneNumbers = function useFetchTwilioPhoneNumbers(_ref2) {
|
|
|
784
222
|
}], function () {
|
|
785
223
|
return twilioApi.getTwilioPhoneNumbers(keysToSnakeCase(credentials));
|
|
786
224
|
}, {
|
|
787
|
-
enabled: !!(credentials !== null && credentials !== void 0 && credentials.twilio_sid) || !!(credentials !== null && credentials !== void 0 && credentials.twilioSid) || !!(formRef !== null && formRef !== void 0 && (_formRef$current = formRef.current) !== null && _formRef$current !== void 0 && (_formRef$current
|
|
225
|
+
enabled: !!(credentials !== null && credentials !== void 0 && credentials.twilio_sid) || !!(credentials !== null && credentials !== void 0 && credentials.twilioSid) || !!(formRef !== null && formRef !== void 0 && (_formRef$current = formRef.current) !== null && _formRef$current !== void 0 && (_formRef$current = _formRef$current.values) !== null && _formRef$current !== void 0 && _formRef$current.twilioSid) || !!(formRef !== null && formRef !== void 0 && (_formRef$current2 = formRef.current) !== null && _formRef$current2 !== void 0 && (_formRef$current2 = _formRef$current2.values) !== null && _formRef$current2 !== void 0 && _formRef$current2.twilioAuthToken),
|
|
788
226
|
select: prop("phoneNumbers"),
|
|
789
227
|
retry: false
|
|
790
228
|
});
|
|
@@ -794,16 +232,12 @@ var useCreateTwilioConfiguration = function useCreateTwilioConfiguration(_ref3)
|
|
|
794
232
|
return useMutationWithInvalidation(function (payload) {
|
|
795
233
|
return twilioApi.createTwilioConfiguration(payload, integrable);
|
|
796
234
|
}, {
|
|
797
|
-
keysToInvalidate: [QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId]
|
|
235
|
+
keysToInvalidate: [QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableType, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId]
|
|
798
236
|
});
|
|
799
237
|
};
|
|
800
238
|
|
|
801
|
-
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; }
|
|
802
|
-
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; }
|
|
803
239
|
var useTwilio = function useTwilio(_ref) {
|
|
804
|
-
var _ref$
|
|
805
|
-
setSteps = _ref$setSteps === void 0 ? noop : _ref$setSteps,
|
|
806
|
-
_ref$onConnect = _ref.onConnect,
|
|
240
|
+
var _ref$onConnect = _ref.onConnect,
|
|
807
241
|
onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect,
|
|
808
242
|
_ref$formRef = _ref.formRef,
|
|
809
243
|
formRef = _ref$formRef === void 0 ? null : _ref$formRef,
|
|
@@ -812,7 +246,8 @@ var useTwilio = function useTwilio(_ref) {
|
|
|
812
246
|
var _useFetchTwilioSmsCon = useFetchTwilioSmsConfiguration({
|
|
813
247
|
integrable: integrable
|
|
814
248
|
}),
|
|
815
|
-
|
|
249
|
+
_useFetchTwilioSmsCon2 = _useFetchTwilioSmsCon.data,
|
|
250
|
+
configuration = _useFetchTwilioSmsCon2 === void 0 ? {} : _useFetchTwilioSmsCon2,
|
|
816
251
|
isConfigurationLoading = _useFetchTwilioSmsCon.isLoading;
|
|
817
252
|
var _useStateWithDependen = useStateWithDependency(configuration),
|
|
818
253
|
_useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
|
|
@@ -829,16 +264,6 @@ var useTwilio = function useTwilio(_ref) {
|
|
|
829
264
|
}),
|
|
830
265
|
saveConfiguration = _useCreateTwilioConfi.mutate,
|
|
831
266
|
isSubmitting = _useCreateTwilioConfi.isLoading;
|
|
832
|
-
useEffect(function () {
|
|
833
|
-
if (!(configuration !== null && configuration !== void 0 && configuration.twilioPhoneNumber)) return;
|
|
834
|
-
setSteps(function (steps) {
|
|
835
|
-
var stepsClone = _toConsumableArray(steps);
|
|
836
|
-
stepsClone[0] = _objectSpread$1(_objectSpread$1({}, steps[0]), {}, {
|
|
837
|
-
isCompleted: true
|
|
838
|
-
});
|
|
839
|
-
return stepsClone;
|
|
840
|
-
});
|
|
841
|
-
}, [configuration]);
|
|
842
267
|
var handleSubmit = function handleSubmit(values) {
|
|
843
268
|
var _values$twilioPhoneNu;
|
|
844
269
|
var payload = {
|
|
@@ -874,26 +299,31 @@ var buildTwilioConfigurationValidationSchema = function buildTwilioConfiguration
|
|
|
874
299
|
}) : null
|
|
875
300
|
});
|
|
876
301
|
};
|
|
302
|
+
var buildPhoneNumberOptions = function buildPhoneNumberOptions(phoneNumbers) {
|
|
303
|
+
return phoneNumbers === null || phoneNumbers === void 0 ? void 0 : phoneNumbers.map(function (_ref) {
|
|
304
|
+
var phoneNumber = _ref.phoneNumber,
|
|
305
|
+
sid = _ref.sid;
|
|
306
|
+
return {
|
|
307
|
+
label: phoneNumber,
|
|
308
|
+
value: sid
|
|
309
|
+
};
|
|
310
|
+
});
|
|
311
|
+
};
|
|
877
312
|
|
|
878
313
|
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; }
|
|
879
314
|
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; }
|
|
880
|
-
var
|
|
881
|
-
var _ref$
|
|
882
|
-
|
|
883
|
-
_ref$
|
|
884
|
-
|
|
315
|
+
var Twilio = function Twilio(_ref) {
|
|
316
|
+
var _ref$integrable = _ref.integrable,
|
|
317
|
+
integrable = _ref$integrable === void 0 ? null : _ref$integrable,
|
|
318
|
+
_ref$onClose = _ref.onClose,
|
|
319
|
+
onClose = _ref$onClose === void 0 ? noop : _ref$onClose,
|
|
885
320
|
_ref$onConnect = _ref.onConnect,
|
|
886
|
-
onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect
|
|
887
|
-
_ref$isModal = _ref.isModal,
|
|
888
|
-
isModal = _ref$isModal === void 0 ? false : _ref$isModal,
|
|
889
|
-
_ref$integrable = _ref.integrable,
|
|
890
|
-
integrable = _ref$integrable === void 0 ? null : _ref$integrable;
|
|
321
|
+
onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect;
|
|
891
322
|
var _useTranslation = useTranslation(),
|
|
892
323
|
t = _useTranslation.t;
|
|
893
324
|
var initialFocusRef = useRef();
|
|
894
325
|
var formRef = useRef();
|
|
895
326
|
var _useTwilio = useTwilio({
|
|
896
|
-
setSteps: setSteps,
|
|
897
327
|
onConnect: onConnect,
|
|
898
328
|
formRef: formRef,
|
|
899
329
|
integrable: integrable
|
|
@@ -904,54 +334,18 @@ var TwilioConfiguration = function TwilioConfiguration(_ref) {
|
|
|
904
334
|
isPhoneNumbersLoading = _useTwilio.isPhoneNumbersLoading,
|
|
905
335
|
isSubmitting = _useTwilio.isSubmitting,
|
|
906
336
|
configuration = _useTwilio.configuration;
|
|
907
|
-
var phoneNumberOptions = phoneNumbers
|
|
908
|
-
var phoneNumber = _ref2.phoneNumber,
|
|
909
|
-
sid = _ref2.sid;
|
|
910
|
-
return {
|
|
911
|
-
label: phoneNumber,
|
|
912
|
-
value: sid
|
|
913
|
-
};
|
|
914
|
-
});
|
|
337
|
+
var phoneNumberOptions = buildPhoneNumberOptions(phoneNumbers);
|
|
915
338
|
var selectedPhoneNumber = _findBy({
|
|
916
339
|
label: configuration === null || configuration === void 0 ? void 0 : configuration.twilioPhoneNumber
|
|
917
340
|
}, phoneNumberOptions);
|
|
918
|
-
var wrapInModalBody = function wrapInModalBody(children) {
|
|
919
|
-
return /*#__PURE__*/React.createElement(Modal$1.Body, null, children);
|
|
920
|
-
};
|
|
921
|
-
var wrapInModalFooter = function wrapInModalFooter(children) {
|
|
922
|
-
return /*#__PURE__*/React.createElement(Modal$1.Footer, null, children);
|
|
923
|
-
};
|
|
924
341
|
var isLoading = isPhoneNumbersLoading || isConfigurationLoading;
|
|
925
342
|
var isSubmitDisabled = function isSubmitDisabled(values) {
|
|
926
343
|
return equals(_objectSpread(_objectSpread({}, configuration), {}, {
|
|
927
344
|
twilioPhoneNumber: selectedPhoneNumber
|
|
928
345
|
}), values) || isLoading;
|
|
929
346
|
};
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
cancelButtonProps: {
|
|
933
|
-
onClick: onCancel,
|
|
934
|
-
disabled: false
|
|
935
|
-
},
|
|
936
|
-
className: "space-x-3",
|
|
937
|
-
submitButtonProps: {
|
|
938
|
-
label: phoneNumberOptions ? t("neetoIntegrations.common.saveChanges") : t("neetoIntegrations.common.verify"),
|
|
939
|
-
disabled: isSubmitDisabled(values),
|
|
940
|
-
loading: isSubmitting || isPhoneNumbersLoading && !(configuration !== null && configuration !== void 0 && configuration.twilioAuthToken)
|
|
941
|
-
}
|
|
942
|
-
});
|
|
943
|
-
};
|
|
944
|
-
var renderForm = function renderForm(formikProps) {
|
|
945
|
-
return /*#__PURE__*/React.createElement(ConfigurationForm, {
|
|
946
|
-
formikProps: formikProps,
|
|
947
|
-
initialFocusRef: initialFocusRef,
|
|
948
|
-
isUsingOverlay: isModal,
|
|
949
|
-
phoneNumberOptions: phoneNumberOptions,
|
|
950
|
-
selectedPhoneNumber: selectedPhoneNumber
|
|
951
|
-
});
|
|
952
|
-
};
|
|
953
|
-
return /*#__PURE__*/React.createElement(Form$2, {
|
|
954
|
-
className: "mx-auto flex w-full max-w-md flex-col",
|
|
347
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
348
|
+
className: "mx-auto flex w-full max-w-md flex-col p-5",
|
|
955
349
|
formikProps: {
|
|
956
350
|
enableReinitialize: true,
|
|
957
351
|
validationSchema: buildTwilioConfigurationValidationSchema(!!phoneNumbers),
|
|
@@ -960,39 +354,27 @@ var TwilioConfiguration = function TwilioConfiguration(_ref) {
|
|
|
960
354
|
onSubmit: handleSubmit
|
|
961
355
|
}
|
|
962
356
|
}, function (formikProps) {
|
|
963
|
-
return
|
|
357
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ConfigurationForm, {
|
|
358
|
+
formikProps: formikProps,
|
|
359
|
+
initialFocusRef: initialFocusRef,
|
|
360
|
+
phoneNumberOptions: phoneNumberOptions,
|
|
361
|
+
selectedPhoneNumber: selectedPhoneNumber
|
|
362
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
964
363
|
className: "mt-4 flex items-center gap-x-2"
|
|
965
|
-
},
|
|
364
|
+
}, /*#__PURE__*/React.createElement(ActionBlock, {
|
|
365
|
+
cancelButtonProps: {
|
|
366
|
+
onClick: onClose,
|
|
367
|
+
disabled: false
|
|
368
|
+
},
|
|
369
|
+
className: "space-x-3",
|
|
370
|
+
submitButtonProps: {
|
|
371
|
+
label: phoneNumberOptions ? t("neetoIntegrations.common.saveChanges") : t("neetoIntegrations.common.verify"),
|
|
372
|
+
disabled: isSubmitDisabled(formikProps.values),
|
|
373
|
+
loading: isSubmitting || isPhoneNumbersLoading && !(configuration !== null && configuration !== void 0 && configuration.twilioAuthToken)
|
|
374
|
+
}
|
|
375
|
+
})));
|
|
966
376
|
});
|
|
967
377
|
};
|
|
968
378
|
|
|
969
|
-
var Twilio = function Twilio(_ref) {
|
|
970
|
-
var _ref$integrable = _ref.integrable,
|
|
971
|
-
integrable = _ref$integrable === void 0 ? null : _ref$integrable,
|
|
972
|
-
_ref$isModal = _ref.isModal,
|
|
973
|
-
isModal = _ref$isModal === void 0 ? true : _ref$isModal,
|
|
974
|
-
_ref$isModalOpen = _ref.isModalOpen,
|
|
975
|
-
isModalOpen = _ref$isModalOpen === void 0 ? true : _ref$isModalOpen,
|
|
976
|
-
_ref$onClose = _ref.onClose,
|
|
977
|
-
onClose = _ref$onClose === void 0 ? noop : _ref$onClose,
|
|
978
|
-
_ref$onConnect = _ref.onConnect,
|
|
979
|
-
onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect;
|
|
980
|
-
var _useState = useState(TWILIO_INTEGRATION_STEPS),
|
|
981
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
982
|
-
steps = _useState2[0],
|
|
983
|
-
setSteps = _useState2[1];
|
|
984
|
-
return /*#__PURE__*/React.createElement(Modal, {
|
|
985
|
-
isOpen: isModalOpen,
|
|
986
|
-
steps: steps,
|
|
987
|
-
onClose: onClose
|
|
988
|
-
}, /*#__PURE__*/React.createElement(TwilioConfiguration, {
|
|
989
|
-
integrable: integrable,
|
|
990
|
-
isModal: isModal,
|
|
991
|
-
setSteps: setSteps,
|
|
992
|
-
onCancel: onClose,
|
|
993
|
-
onConnect: onConnect
|
|
994
|
-
}));
|
|
995
|
-
};
|
|
996
|
-
|
|
997
379
|
export { Twilio as default };
|
|
998
380
|
//# sourceMappingURL=Twilio.js.map
|