@bigbinary/neeto-integrations-frontend 2.5.2 → 2.6.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/Daily.cjs.js +628 -0
- package/dist/Daily.cjs.js.map +1 -0
- package/dist/Daily.js +597 -0
- package/dist/Daily.js.map +1 -0
- package/dist/Twilio.cjs.js +385 -77
- package/dist/Twilio.cjs.js.map +1 -1
- package/dist/Twilio.js +386 -81
- package/dist/Twilio.js.map +1 -1
- package/dist/index.cjs.js +386 -94
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +384 -92
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +21 -0
- package/types.d.ts +10 -1
package/dist/Twilio.cjs.js
CHANGED
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
5
5
|
require('@bigbinary/neeto-molecules/IntegrationCard');
|
|
6
|
-
require('@bigbinary/neeto-molecules/IntegrationDisconnectAlert');
|
|
7
|
-
require('@bigbinary/neeto-molecules/IntegrationWalkthroughModal');
|
|
8
|
-
var neetoui = require('@bigbinary/neetoui');
|
|
9
|
-
var classnames = require('classnames');
|
|
10
|
-
var reactI18next = require('react-i18next');
|
|
11
|
-
var ramda = require('ramda');
|
|
6
|
+
var DisconnectAlert = require('@bigbinary/neeto-molecules/IntegrationDisconnectAlert');
|
|
7
|
+
var WalkthroughModal = require('@bigbinary/neeto-molecules/IntegrationWalkthroughModal');
|
|
12
8
|
var i18next = require('i18next');
|
|
13
|
-
var formik = require('@bigbinary/neetoui/formik');
|
|
14
9
|
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
10
|
+
var constants = require('@bigbinary/neeto-commons-frontend/constants');
|
|
15
11
|
var reactQuery = require('react-query');
|
|
16
12
|
var axios = require('axios');
|
|
13
|
+
var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
|
|
14
|
+
var neetoui = require('@bigbinary/neetoui');
|
|
15
|
+
var formik = require('@bigbinary/neetoui/formik');
|
|
16
|
+
var reactI18next = require('react-i18next');
|
|
17
|
+
var classnames = require('classnames');
|
|
18
|
+
var ramda = require('ramda');
|
|
17
19
|
var yup = require('yup');
|
|
18
20
|
|
|
19
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -37,9 +39,12 @@ function _interopNamespace(e) {
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
40
|
-
var
|
|
42
|
+
var DisconnectAlert__default = /*#__PURE__*/_interopDefaultLegacy(DisconnectAlert);
|
|
43
|
+
var WalkthroughModal__default = /*#__PURE__*/_interopDefaultLegacy(WalkthroughModal);
|
|
41
44
|
var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
|
|
42
45
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
46
|
+
var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
|
|
47
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
43
48
|
var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
|
|
44
49
|
|
|
45
50
|
function _arrayWithHoles(arr) {
|
|
@@ -97,6 +102,356 @@ function _slicedToArray(arr, i) {
|
|
|
97
102
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
98
103
|
}
|
|
99
104
|
|
|
105
|
+
function _typeof(obj) {
|
|
106
|
+
"@babel/helpers - typeof";
|
|
107
|
+
|
|
108
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
109
|
+
return typeof obj;
|
|
110
|
+
} : function (obj) {
|
|
111
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
112
|
+
}, _typeof(obj);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function _toPrimitive(input, hint) {
|
|
116
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
117
|
+
var prim = input[Symbol.toPrimitive];
|
|
118
|
+
if (prim !== undefined) {
|
|
119
|
+
var res = prim.call(input, hint || "default");
|
|
120
|
+
if (_typeof(res) !== "object") return res;
|
|
121
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
122
|
+
}
|
|
123
|
+
return (hint === "string" ? String : Number)(input);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function _toPropertyKey(arg) {
|
|
127
|
+
var key = _toPrimitive(arg, "string");
|
|
128
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function _defineProperty(obj, key, value) {
|
|
132
|
+
key = _toPropertyKey(key);
|
|
133
|
+
if (key in obj) {
|
|
134
|
+
Object.defineProperty(obj, key, {
|
|
135
|
+
value: value,
|
|
136
|
+
enumerable: true,
|
|
137
|
+
configurable: true,
|
|
138
|
+
writable: true
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
obj[key] = value;
|
|
142
|
+
}
|
|
143
|
+
return obj;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
var INTEGRATIONS_ENGINE_BASE_URL = "/neeto_integrations";
|
|
147
|
+
var TWILIO_CONFIGURATION_BASE_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/twilio/sms_configurations");
|
|
148
|
+
var INTEGRATIONS_ENGINE_DAILY_URL = "".concat(INTEGRATIONS_ENGINE_BASE_URL, "/daily");
|
|
149
|
+
|
|
150
|
+
var create = function create(payload) {
|
|
151
|
+
return axios__default["default"].post(INTEGRATIONS_ENGINE_DAILY_URL, {
|
|
152
|
+
daily: payload
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
var show = function show() {
|
|
156
|
+
return axios__default["default"].get(INTEGRATIONS_ENGINE_DAILY_URL);
|
|
157
|
+
};
|
|
158
|
+
var destroy = function destroy() {
|
|
159
|
+
return axios__default["default"]["delete"](INTEGRATIONS_ENGINE_DAILY_URL);
|
|
160
|
+
};
|
|
161
|
+
var dailiesApi = {
|
|
162
|
+
create: create,
|
|
163
|
+
show: show,
|
|
164
|
+
destroy: destroy
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
var QUERY_KEYS = {
|
|
168
|
+
TWILIO_SMS_CONFIGURATION: "twilio-sms-configuration",
|
|
169
|
+
TWILIO_PHONE_NUMBERS: "twilio-phone-numbers",
|
|
170
|
+
DAILY_CO_DETAILS: "daily-co-details"
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
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; }
|
|
174
|
+
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; }
|
|
175
|
+
var useCreateDaily = function useCreateDaily() {
|
|
176
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
177
|
+
return reactUtils.useMutationWithInvalidation(dailiesApi.create, _objectSpread$3({
|
|
178
|
+
keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS]
|
|
179
|
+
}, options));
|
|
180
|
+
};
|
|
181
|
+
var useFetchDaily = function useFetchDaily() {
|
|
182
|
+
return reactQuery.useQuery(QUERY_KEYS.DAILY_CO_DETAILS, dailiesApi.show, {
|
|
183
|
+
staleTime: constants.DEFAULT_STALE_TIME
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
var useDestroyDaily = function useDestroyDaily(_ref) {
|
|
187
|
+
var onSuccess = _ref.onSuccess;
|
|
188
|
+
return reactUtils.useMutationWithInvalidation(dailiesApi.destroy, {
|
|
189
|
+
keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS],
|
|
190
|
+
onSuccess: onSuccess
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
function _extends() {
|
|
195
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
196
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
197
|
+
var source = arguments[i];
|
|
198
|
+
for (var key in source) {
|
|
199
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
200
|
+
target[key] = source[key];
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return target;
|
|
205
|
+
};
|
|
206
|
+
return _extends.apply(this, arguments);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
210
|
+
if (source == null) return {};
|
|
211
|
+
var target = {};
|
|
212
|
+
var sourceKeys = Object.keys(source);
|
|
213
|
+
var key, i;
|
|
214
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
215
|
+
key = sourceKeys[i];
|
|
216
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
217
|
+
target[key] = source[key];
|
|
218
|
+
}
|
|
219
|
+
return target;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function _objectWithoutProperties(source, excluded) {
|
|
223
|
+
if (source == null) return {};
|
|
224
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
225
|
+
var key, i;
|
|
226
|
+
if (Object.getOwnPropertySymbols) {
|
|
227
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
228
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
229
|
+
key = sourceSymbolKeys[i];
|
|
230
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
231
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
232
|
+
target[key] = source[key];
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return target;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
var _excluded = ["className", "children"];
|
|
239
|
+
var ExternalLink = function ExternalLink(_ref) {
|
|
240
|
+
var _ref$className = _ref.className,
|
|
241
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
242
|
+
_ref$children = _ref.children,
|
|
243
|
+
children = _ref$children === void 0 ? null : _ref$children,
|
|
244
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
245
|
+
return /*#__PURE__*/React__default["default"].createElement("a", _extends({
|
|
246
|
+
className: classnames__default["default"](["neeto-ui-text-primary-800 hover:neeto-ui-text-primary-800 visited:neeto-ui-text-primary-600 font-medium", className])
|
|
247
|
+
}, props), children);
|
|
248
|
+
};
|
|
249
|
+
var ExternalLink$1 = /*#__PURE__*/React__default["default"].memo(ExternalLink);
|
|
250
|
+
|
|
251
|
+
var MANAGE_DAILY_CO_FORM_INITIAL_VALUES = {
|
|
252
|
+
apiKey: ""
|
|
253
|
+
};
|
|
254
|
+
var DAILY_CO_VALIDATION_SCHEMA = yup__namespace.object().shape({
|
|
255
|
+
apiKey: yup__namespace.string().trim().required(i18next.t("neetoIntegrations.errors.required", {
|
|
256
|
+
entity: i18next.t("neetoIntegrations.daily.apiKey")
|
|
257
|
+
}))
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
var Form = function Form(_ref) {
|
|
261
|
+
var helpDocUrl = _ref.helpDocUrl,
|
|
262
|
+
videoUrl = _ref.videoUrl,
|
|
263
|
+
onConnect = _ref.onConnect;
|
|
264
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
265
|
+
t = _useTranslation.t;
|
|
266
|
+
var _useState = React.useState(false),
|
|
267
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
268
|
+
isDemoModalOpen = _useState2[0],
|
|
269
|
+
setIsDemoModalOpen = _useState2[1];
|
|
270
|
+
var _useCreateDaily = useCreateDaily({
|
|
271
|
+
onSuccess: function onSuccess() {
|
|
272
|
+
return onConnect === null || onConnect === void 0 ? void 0 : onConnect();
|
|
273
|
+
}
|
|
274
|
+
}),
|
|
275
|
+
createDaily = _useCreateDaily.mutate,
|
|
276
|
+
isConnecting = _useCreateDaily.isLoading;
|
|
277
|
+
var handleSubmit = function handleSubmit(payload) {
|
|
278
|
+
return createDaily(payload);
|
|
279
|
+
};
|
|
280
|
+
if (isConnecting) {
|
|
281
|
+
return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
|
|
282
|
+
}
|
|
283
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
284
|
+
className: "mx-auto w-full max-w-md"
|
|
285
|
+
}, /*#__PURE__*/React__default["default"].createElement(formik.Form, {
|
|
286
|
+
formikProps: {
|
|
287
|
+
initialValues: MANAGE_DAILY_CO_FORM_INITIAL_VALUES,
|
|
288
|
+
validationSchema: DAILY_CO_VALIDATION_SCHEMA,
|
|
289
|
+
onSubmit: handleSubmit
|
|
290
|
+
}
|
|
291
|
+
}, function (_ref2) {
|
|
292
|
+
var dirty = _ref2.dirty;
|
|
293
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
294
|
+
className: "mt-10 w-full space-y-5"
|
|
295
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
296
|
+
className: "block"
|
|
297
|
+
}, /*#__PURE__*/React__default["default"].createElement(formik.Input, {
|
|
298
|
+
autoFocus: true,
|
|
299
|
+
required: true,
|
|
300
|
+
label: t("neetoIntegrations.daily.apiKey"),
|
|
301
|
+
name: "apiKey",
|
|
302
|
+
helpText: /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
|
|
303
|
+
i18nKey: "neetoIntegrations.daily.helpDoc",
|
|
304
|
+
components: {
|
|
305
|
+
externalLink: /*#__PURE__*/React__default["default"].createElement(ExternalLink$1, {
|
|
306
|
+
href: helpDocUrl,
|
|
307
|
+
rel: "noreferrer",
|
|
308
|
+
target: "_blank"
|
|
309
|
+
})
|
|
310
|
+
}
|
|
311
|
+
})
|
|
312
|
+
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
313
|
+
className: "mt-8",
|
|
314
|
+
label: t("neetoIntegrations.daily.walkthroughText"),
|
|
315
|
+
style: "link",
|
|
316
|
+
onClick: function onClick() {
|
|
317
|
+
return setIsDemoModalOpen(true);
|
|
318
|
+
}
|
|
319
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
320
|
+
disabled: isConnecting || !dirty,
|
|
321
|
+
label: t("neetoIntegrations.common.connect"),
|
|
322
|
+
loading: isConnecting,
|
|
323
|
+
type: "submit"
|
|
324
|
+
})));
|
|
325
|
+
}), /*#__PURE__*/React__default["default"].createElement(WalkthroughModal__default["default"], {
|
|
326
|
+
isOpen: isDemoModalOpen,
|
|
327
|
+
videoUrl: videoUrl,
|
|
328
|
+
onClose: function onClose() {
|
|
329
|
+
return setIsDemoModalOpen(false);
|
|
330
|
+
}
|
|
331
|
+
}));
|
|
332
|
+
};
|
|
333
|
+
var Form$1 = reactUtils.withTitle(Form, i18next__default["default"].t("neetoIntegrations.browserTitles.integrations.dailyco"));
|
|
334
|
+
|
|
335
|
+
var Manage$1 = reactUtils.withT(function (_ref) {
|
|
336
|
+
var t = _ref.t,
|
|
337
|
+
title = _ref.title,
|
|
338
|
+
description = _ref.description,
|
|
339
|
+
integration = _ref.integration,
|
|
340
|
+
isDisconnectAlertOpen = _ref.isDisconnectAlertOpen,
|
|
341
|
+
setIsDisconnectAlertOpen = _ref.setIsDisconnectAlertOpen,
|
|
342
|
+
isDisconnecting = _ref.isDisconnecting,
|
|
343
|
+
onDisconnect = _ref.onDisconnect,
|
|
344
|
+
onClose = _ref.onClose;
|
|
345
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
346
|
+
className: "mx-auto w-full max-w-md"
|
|
347
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
348
|
+
className: "mt-10 w-full space-y-4"
|
|
349
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
350
|
+
className: "neeto-ui-text-gray-800 mb-0.5",
|
|
351
|
+
style: "h3",
|
|
352
|
+
weight: "semibold"
|
|
353
|
+
}, title), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
354
|
+
className: "neeto-ui-text-gray-600 break-all",
|
|
355
|
+
style: "body1",
|
|
356
|
+
weight: "normal"
|
|
357
|
+
}, description), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
358
|
+
label: t("neetoIntegrations.common.disconnect"),
|
|
359
|
+
style: "danger",
|
|
360
|
+
onClick: function onClick() {
|
|
361
|
+
return setIsDisconnectAlertOpen(true);
|
|
362
|
+
}
|
|
363
|
+
}))), /*#__PURE__*/React__default["default"].createElement(DisconnectAlert__default["default"], {
|
|
364
|
+
isDisconnecting: isDisconnecting,
|
|
365
|
+
onClose: onClose,
|
|
366
|
+
onDisconnect: onDisconnect,
|
|
367
|
+
isOpen: isDisconnectAlertOpen,
|
|
368
|
+
message: t("neetoIntegrations.".concat(integration, ".disconnect.message")),
|
|
369
|
+
title: t("neetoIntegrations.".concat(integration, ".disconnect.title"))
|
|
370
|
+
}));
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
var Manage = function Manage(_ref) {
|
|
374
|
+
var onDisconnect = _ref.onDisconnect;
|
|
375
|
+
var _useState = React.useState(false),
|
|
376
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
377
|
+
isDisconnectAlertOpen = _useState2[0],
|
|
378
|
+
setIsDisconnectAlertOpen = _useState2[1];
|
|
379
|
+
var _useFetchDaily = useFetchDaily(),
|
|
380
|
+
_useFetchDaily$data = _useFetchDaily.data,
|
|
381
|
+
_useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
|
|
382
|
+
_useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
|
|
383
|
+
metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$,
|
|
384
|
+
isLoading = _useFetchDaily.isLoading;
|
|
385
|
+
var _ref2 = metadata || {},
|
|
386
|
+
_ref2$apiKey = _ref2.apiKey,
|
|
387
|
+
apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
|
|
388
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
389
|
+
t = _useTranslation.t;
|
|
390
|
+
var _useDestroyDaily = useDestroyDaily({
|
|
391
|
+
onSuccess: function onSuccess() {
|
|
392
|
+
setIsDisconnectAlertOpen(false);
|
|
393
|
+
onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
|
|
394
|
+
}
|
|
395
|
+
}),
|
|
396
|
+
destroyIntegration = _useDestroyDaily.mutate,
|
|
397
|
+
isDisconnecting = _useDestroyDaily.isLoading;
|
|
398
|
+
var handleDisconnect = function handleDisconnect() {
|
|
399
|
+
return destroyIntegration("daily");
|
|
400
|
+
};
|
|
401
|
+
if (isLoading || isDisconnecting) {
|
|
402
|
+
return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
|
|
403
|
+
}
|
|
404
|
+
if (neetoCist.isNotPresent(apiKey)) {
|
|
405
|
+
onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
|
|
406
|
+
}
|
|
407
|
+
return /*#__PURE__*/React__default["default"].createElement(Manage$1, {
|
|
408
|
+
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
409
|
+
isDisconnecting: isDisconnecting,
|
|
410
|
+
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
411
|
+
description: t("neetoIntegrations.daily.yourApiKey", {
|
|
412
|
+
apiKey: apiKey
|
|
413
|
+
}),
|
|
414
|
+
integration: "daily",
|
|
415
|
+
title: t("neetoIntegrations.daily.connected"),
|
|
416
|
+
onClose: function onClose() {
|
|
417
|
+
return setIsDisconnectAlertOpen(false);
|
|
418
|
+
},
|
|
419
|
+
onDisconnect: handleDisconnect
|
|
420
|
+
});
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
var Daily = function Daily(_ref) {
|
|
424
|
+
var _ref$isOnboarding = _ref.isOnboarding,
|
|
425
|
+
isOnboarding = _ref$isOnboarding === void 0 ? false : _ref$isOnboarding,
|
|
426
|
+
_ref$helpDocUrl = _ref.helpDocUrl,
|
|
427
|
+
helpDocUrl = _ref$helpDocUrl === void 0 ? "" : _ref$helpDocUrl,
|
|
428
|
+
_ref$videoUrl = _ref.videoUrl,
|
|
429
|
+
videoUrl = _ref$videoUrl === void 0 ? "" : _ref$videoUrl,
|
|
430
|
+
_ref$onConnect = _ref.onConnect,
|
|
431
|
+
onConnect = _ref$onConnect === void 0 ? neetoCist.noop : _ref$onConnect,
|
|
432
|
+
_ref$onDisconnect = _ref.onDisconnect,
|
|
433
|
+
onDisconnect = _ref$onDisconnect === void 0 ? neetoCist.noop : _ref$onDisconnect;
|
|
434
|
+
var _useFetchDaily = useFetchDaily(),
|
|
435
|
+
_useFetchDaily$data = _useFetchDaily.data,
|
|
436
|
+
_useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
|
|
437
|
+
_useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
|
|
438
|
+
metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$;
|
|
439
|
+
var _ref2 = metadata || {},
|
|
440
|
+
_ref2$apiKey = _ref2.apiKey,
|
|
441
|
+
apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
|
|
442
|
+
if (neetoCist.isPresent(apiKey) && !isOnboarding) {
|
|
443
|
+
return /*#__PURE__*/React__default["default"].createElement(Manage, {
|
|
444
|
+
onDisconnect: onDisconnect
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
return /*#__PURE__*/React__default["default"].createElement(Form$1, {
|
|
448
|
+
onConnect: onConnect,
|
|
449
|
+
helpDocUrl: helpDocUrl,
|
|
450
|
+
videoUrl: videoUrl
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
reactUtils.withTitle(Daily, i18next__default["default"].t("neetoIntegrations.browserTitles.integrations.dailyco"));
|
|
454
|
+
|
|
100
455
|
var Stepper = function Stepper(_ref) {
|
|
101
456
|
var _ref$steps = _ref.steps,
|
|
102
457
|
steps = _ref$steps === void 0 ? {} : _ref$steps;
|
|
@@ -336,47 +691,6 @@ var TWILIO_INTEGRATION_STEPS = [{
|
|
|
336
691
|
isCompleted: false
|
|
337
692
|
}];
|
|
338
693
|
|
|
339
|
-
function _typeof(obj) {
|
|
340
|
-
"@babel/helpers - typeof";
|
|
341
|
-
|
|
342
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
343
|
-
return typeof obj;
|
|
344
|
-
} : function (obj) {
|
|
345
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
346
|
-
}, _typeof(obj);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
function _toPrimitive(input, hint) {
|
|
350
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
351
|
-
var prim = input[Symbol.toPrimitive];
|
|
352
|
-
if (prim !== undefined) {
|
|
353
|
-
var res = prim.call(input, hint || "default");
|
|
354
|
-
if (_typeof(res) !== "object") return res;
|
|
355
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
356
|
-
}
|
|
357
|
-
return (hint === "string" ? String : Number)(input);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function _toPropertyKey(arg) {
|
|
361
|
-
var key = _toPrimitive(arg, "string");
|
|
362
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function _defineProperty(obj, key, value) {
|
|
366
|
-
key = _toPropertyKey(key);
|
|
367
|
-
if (key in obj) {
|
|
368
|
-
Object.defineProperty(obj, key, {
|
|
369
|
-
value: value,
|
|
370
|
-
enumerable: true,
|
|
371
|
-
configurable: true,
|
|
372
|
-
writable: true
|
|
373
|
-
});
|
|
374
|
-
} else {
|
|
375
|
-
obj[key] = value;
|
|
376
|
-
}
|
|
377
|
-
return obj;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
694
|
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; }
|
|
381
695
|
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; }
|
|
382
696
|
var ConfigurationForm = function ConfigurationForm(_ref) {
|
|
@@ -450,8 +764,6 @@ function _toConsumableArray(arr) {
|
|
|
450
764
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
451
765
|
}
|
|
452
766
|
|
|
453
|
-
var TWILIO_CONFIGURATION_BASE_URL = "/neeto_integrations/twilio/sms_configurations";
|
|
454
|
-
|
|
455
767
|
var twilioApi = {
|
|
456
768
|
fetchTwilioSmsConfiguration: function fetchTwilioSmsConfiguration() {
|
|
457
769
|
return axios__default["default"].get(TWILIO_CONFIGURATION_BASE_URL);
|
|
@@ -469,11 +781,6 @@ var twilioApi = {
|
|
|
469
781
|
}
|
|
470
782
|
};
|
|
471
783
|
|
|
472
|
-
var QUERY_KEYS = {
|
|
473
|
-
TWILIO_SMS_CONFIGURATION: "twilio-sms-configuration",
|
|
474
|
-
TWILIO_PHONE_NUMBERS: "twilio-phone-numbers"
|
|
475
|
-
};
|
|
476
|
-
|
|
477
784
|
var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration() {
|
|
478
785
|
return reactQuery.useQuery(QUERY_KEYS.TWILIO_SMS_CONFIGURATION, twilioApi.fetchTwilioSmsConfiguration, {
|
|
479
786
|
select: function select(response) {
|
|
@@ -488,13 +795,15 @@ var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration() {
|
|
|
488
795
|
});
|
|
489
796
|
};
|
|
490
797
|
var useFetchTwilioPhoneNumbers = function useFetchTwilioPhoneNumbers(_ref) {
|
|
491
|
-
var
|
|
798
|
+
var _formRef$current, _formRef$current$valu, _formRef$current2, _formRef$current2$val;
|
|
799
|
+
var credentials = _ref.credentials,
|
|
800
|
+
formRef = _ref.formRef;
|
|
492
801
|
return reactQuery.useQuery([QUERY_KEYS.TWILIO_PHONE_NUMBERS, {
|
|
493
802
|
credentials: credentials
|
|
494
803
|
}], function () {
|
|
495
804
|
return twilioApi.getTwilioPhoneNumbers(neetoCist.keysToSnakeCase(credentials));
|
|
496
805
|
}, {
|
|
497
|
-
enabled: !!(credentials !== null && credentials !== void 0 && credentials.twilio_sid) || !!(credentials !== null && credentials !== void 0 && credentials.twilioSid),
|
|
806
|
+
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$valu = _formRef$current.values) !== null && _formRef$current$valu !== void 0 && _formRef$current$valu.twilioSid) || !!(formRef !== null && formRef !== void 0 && (_formRef$current2 = formRef.current) !== null && _formRef$current2 !== void 0 && (_formRef$current2$val = _formRef$current2.values) !== null && _formRef$current2$val !== void 0 && _formRef$current2$val.twilioAuthToken),
|
|
498
807
|
select: ramda.prop("phoneNumbers"),
|
|
499
808
|
retry: false
|
|
500
809
|
});
|
|
@@ -512,8 +821,10 @@ var useTwilio = function useTwilio(_ref) {
|
|
|
512
821
|
onSave = _ref$onSave === void 0 ? neetoCist.noop : _ref$onSave,
|
|
513
822
|
_ref$setSteps = _ref.setSteps,
|
|
514
823
|
setSteps = _ref$setSteps === void 0 ? neetoCist.noop : _ref$setSteps,
|
|
515
|
-
_ref$
|
|
516
|
-
|
|
824
|
+
_ref$onConnect = _ref.onConnect,
|
|
825
|
+
onConnect = _ref$onConnect === void 0 ? neetoCist.noop : _ref$onConnect,
|
|
826
|
+
_ref$formRef = _ref.formRef,
|
|
827
|
+
formRef = _ref$formRef === void 0 ? null : _ref$formRef;
|
|
517
828
|
var _useFetchTwilioSmsCon = useFetchTwilioSmsConfiguration(),
|
|
518
829
|
configuration = _useFetchTwilioSmsCon.data,
|
|
519
830
|
isConfigurationLoading = _useFetchTwilioSmsCon.isLoading,
|
|
@@ -523,20 +834,14 @@ var useTwilio = function useTwilio(_ref) {
|
|
|
523
834
|
credentials = _useStateWithDependen2[0],
|
|
524
835
|
setCredentials = _useStateWithDependen2[1];
|
|
525
836
|
var _useFetchTwilioPhoneN = useFetchTwilioPhoneNumbers({
|
|
526
|
-
credentials: credentials
|
|
837
|
+
credentials: credentials,
|
|
838
|
+
formRef: formRef
|
|
527
839
|
}),
|
|
528
840
|
phoneNumbers = _useFetchTwilioPhoneN.data,
|
|
529
841
|
isPhoneNumbersLoading = _useFetchTwilioPhoneN.isLoading;
|
|
530
842
|
var _useCreateTwilioConfi = useCreateTwilioConfiguration(),
|
|
531
843
|
saveConfiguration = _useCreateTwilioConfi.mutate,
|
|
532
844
|
isSubmitting = _useCreateTwilioConfi.isLoading;
|
|
533
|
-
var _useConnect = useConnect(),
|
|
534
|
-
installIntegration = _useConnect.mutate;
|
|
535
|
-
var connectTwilioApp = function connectTwilioApp() {
|
|
536
|
-
return installIntegration({
|
|
537
|
-
id: "twilio"
|
|
538
|
-
}, {});
|
|
539
|
-
};
|
|
540
845
|
React.useEffect(function () {
|
|
541
846
|
if (!(configuration !== null && configuration !== void 0 && configuration.twilioPhoneNumber)) return;
|
|
542
847
|
setSteps(function (steps) {
|
|
@@ -561,8 +866,8 @@ var useTwilio = function useTwilio(_ref) {
|
|
|
561
866
|
saveConfiguration(payload, {
|
|
562
867
|
onSuccess: function onSuccess() {
|
|
563
868
|
onSave();
|
|
564
|
-
connectTwilioApp();
|
|
565
869
|
refetchTwilioSmsConfiguration();
|
|
870
|
+
onConnect === null || onConnect === void 0 ? void 0 : onConnect();
|
|
566
871
|
}
|
|
567
872
|
});
|
|
568
873
|
};
|
|
@@ -596,17 +901,19 @@ var TwilioConfiguration = function TwilioConfiguration(_ref) {
|
|
|
596
901
|
onSave = _ref$onSave === void 0 ? neetoCist.noop : _ref$onSave,
|
|
597
902
|
_ref$setSteps = _ref.setSteps,
|
|
598
903
|
setSteps = _ref$setSteps === void 0 ? neetoCist.noop : _ref$setSteps,
|
|
599
|
-
_ref$
|
|
600
|
-
|
|
904
|
+
_ref$onConnect = _ref.onConnect,
|
|
905
|
+
onConnect = _ref$onConnect === void 0 ? neetoCist.noop : _ref$onConnect,
|
|
601
906
|
_ref$isModal = _ref.isModal,
|
|
602
907
|
isModal = _ref$isModal === void 0 ? false : _ref$isModal;
|
|
603
908
|
var _useTranslation = reactI18next.useTranslation(),
|
|
604
909
|
t = _useTranslation.t;
|
|
605
910
|
var initialFocusRef = React.useRef();
|
|
911
|
+
var formRef = React.useRef();
|
|
606
912
|
var _useTwilio = useTwilio({
|
|
607
913
|
onSave: onSave,
|
|
608
914
|
setSteps: setSteps,
|
|
609
|
-
|
|
915
|
+
onConnect: onConnect,
|
|
916
|
+
formRef: formRef
|
|
610
917
|
}),
|
|
611
918
|
handleSubmit = _useTwilio.handleSubmit,
|
|
612
919
|
phoneNumbers = _useTwilio.phoneNumbers,
|
|
@@ -647,7 +954,7 @@ var TwilioConfiguration = function TwilioConfiguration(_ref) {
|
|
|
647
954
|
submitButtonProps: {
|
|
648
955
|
label: phoneNumberOptions ? t("neetoIntegrations.common.saveChanges") : t("neetoIntegrations.common.verify"),
|
|
649
956
|
disabled: isSubmitDisabled(values),
|
|
650
|
-
loading: isSubmitting || isPhoneNumbersLoading && !configuration.twilioAuthToken
|
|
957
|
+
loading: isSubmitting || isPhoneNumbersLoading && !(configuration !== null && configuration !== void 0 && configuration.twilioAuthToken)
|
|
651
958
|
}
|
|
652
959
|
});
|
|
653
960
|
};
|
|
@@ -666,6 +973,7 @@ var TwilioConfiguration = function TwilioConfiguration(_ref) {
|
|
|
666
973
|
enableReinitialize: true,
|
|
667
974
|
validationSchema: buildTwilioConfigurationValidationSchema(!!phoneNumbers),
|
|
668
975
|
initialValues: configuration,
|
|
976
|
+
innerRef: formRef,
|
|
669
977
|
onSubmit: handleSubmit
|
|
670
978
|
}
|
|
671
979
|
}, function (formikProps) {
|
|
@@ -678,8 +986,8 @@ var TwilioConfiguration = function TwilioConfiguration(_ref) {
|
|
|
678
986
|
var Twilio = function Twilio(_ref) {
|
|
679
987
|
var _ref$onClose = _ref.onClose,
|
|
680
988
|
onClose = _ref$onClose === void 0 ? neetoCist.noop : _ref$onClose,
|
|
681
|
-
_ref$
|
|
682
|
-
|
|
989
|
+
_ref$onConnect = _ref.onConnect,
|
|
990
|
+
onConnect = _ref$onConnect === void 0 ? neetoCist.noop : _ref$onConnect;
|
|
683
991
|
var _useState = React.useState(TWILIO_INTEGRATION_STEPS),
|
|
684
992
|
_useState2 = _slicedToArray(_useState, 2),
|
|
685
993
|
steps = _useState2[0],
|
|
@@ -691,8 +999,8 @@ var Twilio = function Twilio(_ref) {
|
|
|
691
999
|
}, /*#__PURE__*/React__default["default"].createElement(TwilioConfiguration, {
|
|
692
1000
|
isModal: true,
|
|
693
1001
|
setSteps: setSteps,
|
|
694
|
-
|
|
695
|
-
|
|
1002
|
+
onCancel: onClose,
|
|
1003
|
+
onConnect: onConnect
|
|
696
1004
|
}));
|
|
697
1005
|
};
|
|
698
1006
|
|