@bigbinary/neeto-integrations-frontend 4.0.31 → 4.0.33

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.
Files changed (67) hide show
  1. package/app/javascript/src/translations/en.json +23 -2
  2. package/dist/.ready +1 -1
  3. package/dist/Daily.js +2 -2
  4. package/dist/DailyForm.js +2 -2
  5. package/dist/Manage.js +4 -1
  6. package/dist/Manage.js.map +1 -1
  7. package/dist/Telnyx.js +2 -2
  8. package/dist/Twilio.js +200 -68
  9. package/dist/Twilio.js.map +1 -1
  10. package/dist/Zoom.js +2 -2
  11. package/dist/cjs/Daily.js +2 -2
  12. package/dist/cjs/DailyForm.js +2 -2
  13. package/dist/cjs/Manage.js +4 -1
  14. package/dist/cjs/Manage.js.map +1 -1
  15. package/dist/cjs/Telnyx.js +2 -2
  16. package/dist/cjs/Twilio.js +199 -67
  17. package/dist/cjs/Twilio.js.map +1 -1
  18. package/dist/cjs/Zoom.js +2 -2
  19. package/dist/cjs/index.js +15 -15
  20. package/dist/cjs/index.js.map +1 -1
  21. package/dist/cjs/v2/Daily.js +2 -2
  22. package/dist/cjs/v2/DailyForm.js +2 -2
  23. package/dist/cjs/v2/DisconnectedIntegrationsRibbon.js +2 -2
  24. package/dist/cjs/v2/Telnyx.js +2 -2
  25. package/dist/cjs/v2/Twilio.js +199 -67
  26. package/dist/cjs/v2/Twilio.js.map +1 -1
  27. package/dist/cjs/v2/Zoom.js +2 -2
  28. package/dist/cjs/v2/index.js +6 -6
  29. package/dist/index.js +14 -14
  30. package/dist/index.js.map +1 -1
  31. package/dist/{query-CySi2Ki7.js → query-BF3HFRA7.js} +2 -2
  32. package/dist/query-BF3HFRA7.js.map +1 -0
  33. package/dist/{query-B3RhGrNb.js → query-gurbhBqu.js} +2 -2
  34. package/dist/query-gurbhBqu.js.map +1 -0
  35. package/dist/{useDailiesApi-BjcmweuZ.js → useDailiesApi-CEJPknLb.js} +2 -2
  36. package/dist/{useDailiesApi-BjcmweuZ.js.map → useDailiesApi-CEJPknLb.js.map} +1 -1
  37. package/dist/{useDailiesApi-C78LSYFo.js → useDailiesApi-aQmuxf-5.js} +2 -2
  38. package/dist/{useDailiesApi-C78LSYFo.js.map → useDailiesApi-aQmuxf-5.js.map} +1 -1
  39. package/dist/{useDisconnectionAlertsApi-BnfMKA7s.js → useDisconnectionAlertsApi-BOc2pEP_.js} +2 -2
  40. package/dist/{useDisconnectionAlertsApi-BnfMKA7s.js.map → useDisconnectionAlertsApi-BOc2pEP_.js.map} +1 -1
  41. package/dist/{useDisconnectionAlertsApi-C8Q2wbVl.js → useDisconnectionAlertsApi-CWMlpOJD.js} +2 -2
  42. package/dist/{useDisconnectionAlertsApi-C8Q2wbVl.js.map → useDisconnectionAlertsApi-CWMlpOJD.js.map} +1 -1
  43. package/dist/{useTelnyxApi-DnNSPd-d.js → useTelnyxApi-Cv5cIiuo.js} +2 -2
  44. package/dist/{useTelnyxApi-DnNSPd-d.js.map → useTelnyxApi-Cv5cIiuo.js.map} +1 -1
  45. package/dist/{useTelnyxApi-DDTzGMgk.js → useTelnyxApi-DS3IVijP.js} +2 -2
  46. package/dist/{useTelnyxApi-DDTzGMgk.js.map → useTelnyxApi-DS3IVijP.js.map} +1 -1
  47. package/dist/{useTwilioApi-D5HpIaB2.js → useTwilioApi-C57UuOda.js} +20 -12
  48. package/dist/useTwilioApi-C57UuOda.js.map +1 -0
  49. package/dist/{useTwilioApi-DPyyUWOs.js → useTwilioApi-CUL0-Xgf.js} +20 -12
  50. package/dist/useTwilioApi-CUL0-Xgf.js.map +1 -0
  51. package/dist/{useZoomApi-B127NAGl.js → useZoomApi-C8AUYMlp.js} +2 -2
  52. package/dist/{useZoomApi-B127NAGl.js.map → useZoomApi-C8AUYMlp.js.map} +1 -1
  53. package/dist/{useZoomApi-CazQYmYH.js → useZoomApi-CkhVE1e8.js} +2 -2
  54. package/dist/{useZoomApi-CazQYmYH.js.map → useZoomApi-CkhVE1e8.js.map} +1 -1
  55. package/dist/v2/Daily.js +2 -2
  56. package/dist/v2/DailyForm.js +2 -2
  57. package/dist/v2/DisconnectedIntegrationsRibbon.js +2 -2
  58. package/dist/v2/Telnyx.js +2 -2
  59. package/dist/v2/Twilio.js +200 -68
  60. package/dist/v2/Twilio.js.map +1 -1
  61. package/dist/v2/Zoom.js +2 -2
  62. package/dist/v2/index.js +6 -6
  63. package/package.json +14 -14
  64. package/dist/query-B3RhGrNb.js.map +0 -1
  65. package/dist/query-CySi2Ki7.js.map +0 -1
  66. package/dist/useTwilioApi-D5HpIaB2.js.map +0 -1
  67. package/dist/useTwilioApi-DPyyUWOs.js.map +0 -1
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
3
  var React = require('react');
5
4
  var neetoCist = require('@bigbinary/neeto-cist');
6
5
  var CardLayout = require('@bigbinary/neeto-molecules/CardLayout');
@@ -10,15 +9,17 @@ var ramda = require('ramda');
10
9
  var reactI18next = require('react-i18next');
11
10
  var Input = require('@bigbinary/neetoui/formik/Input');
12
11
  var Select = require('@bigbinary/neetoui/formik/Select');
12
+ var Tag = require('@bigbinary/neetoui/Tag');
13
13
  var jsxRuntime = require('react/jsx-runtime');
14
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
14
15
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
15
16
  var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
16
- var useTwilioApi = require('../useTwilioApi-DPyyUWOs.js');
17
+ var useTwilioApi = require('../useTwilioApi-CUL0-Xgf.js');
17
18
  var i18next = require('i18next');
18
19
  var yup = require('yup');
19
20
  require('@tanstack/react-query');
20
21
  require('axios');
21
- require('../query-CySi2Ki7.js');
22
+ require('../query-BF3HFRA7.js');
22
23
 
23
24
  function _interopNamespaceDefault(e) {
24
25
  var n = Object.create(null);
@@ -39,13 +40,60 @@ function _interopNamespaceDefault(e) {
39
40
 
40
41
  var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
41
42
 
42
- function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
43
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
43
+ var CONNECTION_TYPES = {
44
+ PHONE_NUMBER: "phone_number",
45
+ MESSAGING_SERVICE: "messaging_service"
46
+ };
47
+
48
+ var ConnectionTypeCard = function ConnectionTypeCard(_ref) {
49
+ var value = _ref.value,
50
+ selected = _ref.selected,
51
+ title = _ref.title,
52
+ description = _ref.description,
53
+ _ref$recommended = _ref.recommended,
54
+ recommended = _ref$recommended === void 0 ? false : _ref$recommended,
55
+ onSelect = _ref.onSelect,
56
+ children = _ref.children;
57
+ var _useTranslation = reactI18next.useTranslation(),
58
+ t = _useTranslation.t;
59
+ var isSelected = selected === value;
60
+ var cardClass = "flex w-full cursor-pointer flex-col gap-y-2 neeto-ui-rounded border p-4 ".concat(isSelected ? "neeto-ui-border-success-500 neeto-ui-bg-success-100" : "neeto-ui-border-gray-200");
61
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
62
+ className: cardClass,
63
+ onClick: function onClick() {
64
+ return onSelect(value);
65
+ },
66
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
67
+ className: "flex items-center gap-x-2",
68
+ children: [/*#__PURE__*/jsxRuntime.jsx("input", {
69
+ value: value,
70
+ checked: isSelected,
71
+ name: "connectionType",
72
+ type: "radio",
73
+ onChange: function onChange() {
74
+ return onSelect(value);
75
+ },
76
+ onClick: function onClick(e) {
77
+ return e.stopPropagation();
78
+ }
79
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
80
+ className: "font-semibold",
81
+ children: title
82
+ }), recommended && /*#__PURE__*/jsxRuntime.jsx(Tag, {
83
+ style: "success",
84
+ label: t("neetoIntegrations.twilio.connectionType.messagingService.recommendedBadge")
85
+ })]
86
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
87
+ className: "text-sm neeto-ui-text-gray-600",
88
+ children: description
89
+ }), isSelected && children]
90
+ });
91
+ };
92
+
44
93
  var ConfigurationForm = function ConfigurationForm(_ref) {
45
- var _errors$twilioPhoneNu;
94
+ var _errors$twilioPhoneNu, _errors$twilioMessagi;
46
95
  var phoneNumberOptions = _ref.phoneNumberOptions,
47
- _ref$selectedPhoneNum = _ref.selectedPhoneNumber,
48
- selectedPhoneNumber = _ref$selectedPhoneNum === void 0 ? null : _ref$selectedPhoneNum,
96
+ messagingServiceOptions = _ref.messagingServiceOptions,
49
97
  _ref$initialFocusRef = _ref.initialFocusRef,
50
98
  initialFocusRef = _ref$initialFocusRef === void 0 ? null : _ref$initialFocusRef,
51
99
  _ref$isUsingOverlay = _ref.isUsingOverlay,
@@ -55,51 +103,88 @@ var ConfigurationForm = function ConfigurationForm(_ref) {
55
103
  var _useTranslation = reactI18next.useTranslation(),
56
104
  t = _useTranslation.t;
57
105
  var setFieldValue = formikProps.setFieldValue,
58
- setValues = formikProps.setValues,
59
- errors = formikProps.errors,
60
106
  values = formikProps.values,
61
- initialValues = formikProps.initialValues;
62
- React.useEffect(function () {
63
- selectedPhoneNumber && setFieldValue("twilioPhoneNumber", selectedPhoneNumber);
64
- }, [selectedPhoneNumber, initialValues]);
107
+ errors = formikProps.errors;
108
+ var handleConnectionTypeChange = function handleConnectionTypeChange(nextType) {
109
+ setFieldValue("connectionType", nextType);
110
+ if (nextType === CONNECTION_TYPES.PHONE_NUMBER) {
111
+ setFieldValue("twilioMessagingService", null);
112
+ } else {
113
+ setFieldValue("twilioPhoneNumber", null);
114
+ }
115
+ };
116
+ var senderOptionsAvailable = phoneNumberOptions !== null || messagingServiceOptions !== null;
65
117
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
66
- className: "flex w-full flex-col gap-y-4",
67
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
68
- className: "flex w-full",
69
- children: /*#__PURE__*/jsxRuntime.jsx(Input, {
118
+ className: "flex w-full flex-col gap-y-6",
119
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
120
+ className: "flex w-full flex-col gap-y-4",
121
+ children: [/*#__PURE__*/jsxRuntime.jsx(Input, {
70
122
  required: true,
71
123
  autoFocus: !isUsingOverlay,
72
124
  "data-testid": "integrations-twilio-sid",
73
125
  label: t("neetoIntegrations.twilio.sid"),
74
126
  name: "twilioSid",
75
127
  ref: initialFocusRef
76
- })
77
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
78
- className: "flex w-full",
79
- children: /*#__PURE__*/jsxRuntime.jsx(Input, {
128
+ }), /*#__PURE__*/jsxRuntime.jsx(Input, {
80
129
  required: true,
81
130
  "data-testid": "integrations-twilio-auth-token",
82
131
  label: t("neetoIntegrations.twilio.authToken"),
83
132
  name: "twilioAuthToken"
84
- })
85
- }), phoneNumberOptions && /*#__PURE__*/jsxRuntime.jsx("div", {
86
- className: "flex w-full",
87
- children: /*#__PURE__*/jsxRuntime.jsx(Select, {
88
- error: (_errors$twilioPhoneNu = errors.twilioPhoneNumber) === null || _errors$twilioPhoneNu === void 0 ? void 0 : _errors$twilioPhoneNu.value,
89
- label: t("neetoIntegrations.common.phNo"),
90
- name: "twilioPhoneNumber",
91
- options: phoneNumberOptions,
92
- size: "large",
93
- onChange: function onChange(selected) {
94
- return setValues(_objectSpread$1(_objectSpread$1({}, values), {}, {
95
- twilioPhoneNumber: selected
96
- }));
97
- }
98
- })
133
+ })]
134
+ }), senderOptionsAvailable && /*#__PURE__*/jsxRuntime.jsxs("div", {
135
+ className: "flex w-full flex-col gap-y-4",
136
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
137
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
138
+ className: "font-semibold",
139
+ children: t("neetoIntegrations.twilio.smsSendingMethod.title")
140
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
141
+ className: "text-sm neeto-ui-text-gray-600",
142
+ children: t("neetoIntegrations.twilio.smsSendingMethod.subtitle")
143
+ })]
144
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
145
+ className: "flex w-full flex-col gap-y-3",
146
+ children: [/*#__PURE__*/jsxRuntime.jsx(ConnectionTypeCard, {
147
+ selected: values.connectionType,
148
+ value: CONNECTION_TYPES.PHONE_NUMBER,
149
+ description: t("neetoIntegrations.twilio.connectionType.phoneNumber.description"),
150
+ title: t("neetoIntegrations.twilio.connectionType.phoneNumber.label"),
151
+ onSelect: handleConnectionTypeChange,
152
+ children: /*#__PURE__*/jsxRuntime.jsx(Select, {
153
+ error: (_errors$twilioPhoneNu = errors.twilioPhoneNumber) === null || _errors$twilioPhoneNu === void 0 ? void 0 : _errors$twilioPhoneNu.value,
154
+ label: t("neetoIntegrations.common.phNo"),
155
+ name: "twilioPhoneNumber",
156
+ options: phoneNumberOptions !== null && phoneNumberOptions !== void 0 ? phoneNumberOptions : [],
157
+ size: "large",
158
+ onChange: function onChange(selected) {
159
+ return setFieldValue("twilioPhoneNumber", selected);
160
+ }
161
+ })
162
+ }), /*#__PURE__*/jsxRuntime.jsx(ConnectionTypeCard, {
163
+ recommended: true,
164
+ selected: values.connectionType,
165
+ value: CONNECTION_TYPES.MESSAGING_SERVICE,
166
+ description: t("neetoIntegrations.twilio.connectionType.messagingService.description"),
167
+ title: t("neetoIntegrations.twilio.connectionType.messagingService.label"),
168
+ onSelect: handleConnectionTypeChange,
169
+ children: /*#__PURE__*/jsxRuntime.jsx(Select, {
170
+ error: (_errors$twilioMessagi = errors.twilioMessagingService) === null || _errors$twilioMessagi === void 0 ? void 0 : _errors$twilioMessagi.value,
171
+ label: t("neetoIntegrations.twilio.messagingService.label"),
172
+ name: "twilioMessagingService",
173
+ options: messagingServiceOptions !== null && messagingServiceOptions !== void 0 ? messagingServiceOptions : [],
174
+ size: "large",
175
+ placeholder: t("neetoIntegrations.twilio.messagingService.placeholder"),
176
+ onChange: function onChange(selected) {
177
+ return setFieldValue("twilioMessagingService", selected);
178
+ }
179
+ })
180
+ })]
181
+ })]
99
182
  })]
100
183
  });
101
184
  };
102
185
 
186
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
187
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
103
188
  var useTwilio = function useTwilio(_ref) {
104
189
  var _ref$onConnect = _ref.onConnect,
105
190
  onConnect = _ref$onConnect === void 0 ? neetoCist.noop : _ref$onConnect,
@@ -117,28 +202,37 @@ var useTwilio = function useTwilio(_ref) {
117
202
  _useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
118
203
  credentials = _useStateWithDependen2[0],
119
204
  setCredentials = _useStateWithDependen2[1];
120
- var _useFetchTwilioPhoneN = useTwilioApi.useFetchTwilioPhoneNumbers({
205
+ var _useFetchTwilioSender = useTwilioApi.useFetchTwilioSenderOptions({
121
206
  credentials: credentials,
122
207
  formRef: formRef
123
208
  }),
124
- phoneNumbers = _useFetchTwilioPhoneN.data,
125
- isPhoneNumbersLoading = _useFetchTwilioPhoneN.isLoading;
209
+ senderOptions = _useFetchTwilioSender.data,
210
+ isSenderOptionsLoading = _useFetchTwilioSender.isLoading;
211
+ var phoneNumbers = senderOptions === null || senderOptions === void 0 ? void 0 : senderOptions.phoneNumbers;
212
+ var messagingServices = senderOptions === null || senderOptions === void 0 ? void 0 : senderOptions.messagingServices;
126
213
  var _useCreateTwilioConfi = useTwilioApi.useCreateTwilioConfiguration({
127
214
  integrable: integrable
128
215
  }),
129
216
  saveConfiguration = _useCreateTwilioConfi.mutate,
130
217
  isSubmitting = _useCreateTwilioConfi.isPending;
131
218
  var handleSubmit = function handleSubmit(values) {
132
- var _values$twilioPhoneNu;
133
- var payload = {
219
+ var _values$twilioMessagi, _values$twilioMessagi2, _values$twilioPhoneNu;
220
+ var credentialsPayload = {
134
221
  twilio_sid: values.twilioSid,
135
- twilio_auth_token: values.twilioAuthToken,
136
- twilio_phone_number_sid: (_values$twilioPhoneNu = values.twilioPhoneNumber) === null || _values$twilioPhoneNu === void 0 ? void 0 : _values$twilioPhoneNu.value
222
+ twilio_auth_token: values.twilioAuthToken
137
223
  };
138
- if (!phoneNumbers && !(configuration !== null && configuration !== void 0 && configuration.twilioPhoneNumber)) {
139
- setCredentials(payload);
224
+ if (!senderOptions && !(configuration !== null && configuration !== void 0 && configuration.connectionType)) {
225
+ setCredentials(credentialsPayload);
140
226
  return;
141
227
  }
228
+ var payload = values.connectionType === CONNECTION_TYPES.MESSAGING_SERVICE ? _objectSpread(_objectSpread({}, credentialsPayload), {}, {
229
+ connection_type: CONNECTION_TYPES.MESSAGING_SERVICE,
230
+ twilio_messaging_service_sid: (_values$twilioMessagi = values.twilioMessagingService) === null || _values$twilioMessagi === void 0 ? void 0 : _values$twilioMessagi.value,
231
+ twilio_messaging_service_friendly_name: (_values$twilioMessagi2 = values.twilioMessagingService) === null || _values$twilioMessagi2 === void 0 ? void 0 : _values$twilioMessagi2.label
232
+ }) : _objectSpread(_objectSpread({}, credentialsPayload), {}, {
233
+ connection_type: CONNECTION_TYPES.PHONE_NUMBER,
234
+ twilio_phone_number_sid: (_values$twilioPhoneNu = values.twilioPhoneNumber) === null || _values$twilioPhoneNu === void 0 ? void 0 : _values$twilioPhoneNu.value
235
+ });
142
236
  saveConfiguration(payload, {
143
237
  onSuccess: onConnect
144
238
  });
@@ -146,37 +240,64 @@ var useTwilio = function useTwilio(_ref) {
146
240
  return {
147
241
  handleSubmit: handleSubmit,
148
242
  phoneNumbers: phoneNumbers,
243
+ messagingServices: messagingServices,
149
244
  isConfigurationLoading: isConfigurationLoading,
150
- isPhoneNumbersLoading: isPhoneNumbersLoading,
245
+ isSenderOptionsLoading: isSenderOptionsLoading,
151
246
  isSubmitting: isSubmitting,
152
247
  configuration: configuration
153
248
  };
154
249
  };
155
250
 
156
- var buildTwilioConfigurationValidationSchema = function buildTwilioConfigurationValidationSchema(isTwilioPhoneRequired) {
251
+ var buildTwilioConfigurationValidationSchema = function buildTwilioConfigurationValidationSchema() {
157
252
  return yup__namespace.object().shape({
158
253
  twilioSid: yup__namespace.string().required(i18next.t("neetoIntegrations.twilio.validations.sidReq")),
159
254
  twilioAuthToken: yup__namespace.string().required(i18next.t("neetoIntegrations.twilio.validations.authTokenReq")),
160
- twilioPhoneNumber: isTwilioPhoneRequired ? yup__namespace.object().shape({
161
- label: yup__namespace.string(),
162
- value: yup__namespace.string().required(i18next.t("neetoIntegrations.twilio.validations.phNumReq"))
163
- }) : null
255
+ connectionType: yup__namespace.string().oneOf([CONNECTION_TYPES.PHONE_NUMBER, CONNECTION_TYPES.MESSAGING_SERVICE]).required(),
256
+ twilioPhoneNumber: yup__namespace.object().nullable().when("connectionType", {
257
+ is: CONNECTION_TYPES.PHONE_NUMBER,
258
+ then: function then(schema) {
259
+ return schema.shape({
260
+ label: yup__namespace.string(),
261
+ value: yup__namespace.string().required(i18next.t("neetoIntegrations.twilio.validations.phNumReq"))
262
+ });
263
+ }
264
+ }),
265
+ twilioMessagingService: yup__namespace.object().nullable().when("connectionType", {
266
+ is: CONNECTION_TYPES.MESSAGING_SERVICE,
267
+ then: function then(schema) {
268
+ return schema.shape({
269
+ label: yup__namespace.string(),
270
+ value: yup__namespace.string().required(i18next.t("neetoIntegrations.twilio.validations.messagingServiceReq"))
271
+ });
272
+ }
273
+ })
164
274
  });
165
275
  };
166
276
  var buildPhoneNumberOptions = function buildPhoneNumberOptions(phoneNumbers) {
167
- return phoneNumbers === null || phoneNumbers === void 0 ? void 0 : phoneNumbers.map(function (_ref) {
277
+ var _phoneNumbers$map;
278
+ return (_phoneNumbers$map = phoneNumbers === null || phoneNumbers === void 0 ? void 0 : phoneNumbers.map(function (_ref) {
168
279
  var phoneNumber = _ref.phoneNumber,
169
280
  sid = _ref.sid;
170
281
  return {
171
282
  label: phoneNumber,
172
283
  value: sid
173
284
  };
174
- });
285
+ })) !== null && _phoneNumbers$map !== void 0 ? _phoneNumbers$map : [];
286
+ };
287
+ var buildMessagingServiceOptions = function buildMessagingServiceOptions(messagingServices) {
288
+ var _messagingServices$ma;
289
+ return (_messagingServices$ma = messagingServices === null || messagingServices === void 0 ? void 0 : messagingServices.map(function (_ref2) {
290
+ var sid = _ref2.sid,
291
+ friendlyName = _ref2.friendlyName;
292
+ return {
293
+ label: friendlyName,
294
+ value: sid
295
+ };
296
+ })) !== null && _messagingServices$ma !== void 0 ? _messagingServices$ma : [];
175
297
  };
176
298
 
177
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
178
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
179
299
  var Twilio = function Twilio(_ref) {
300
+ var _configuration$twilio, _configuration$twilio2;
180
301
  var _ref$integrable = _ref.integrable,
181
302
  integrable = _ref$integrable === void 0 ? null : _ref$integrable,
182
303
  _ref$onClose = _ref.onClose,
@@ -194,26 +315,37 @@ var Twilio = function Twilio(_ref) {
194
315
  }),
195
316
  handleSubmit = _useTwilio.handleSubmit,
196
317
  phoneNumbers = _useTwilio.phoneNumbers,
318
+ messagingServices = _useTwilio.messagingServices,
197
319
  isConfigurationLoading = _useTwilio.isConfigurationLoading,
198
- isPhoneNumbersLoading = _useTwilio.isPhoneNumbersLoading,
320
+ isSenderOptionsLoading = _useTwilio.isSenderOptionsLoading,
199
321
  isSubmitting = _useTwilio.isSubmitting,
200
322
  configuration = _useTwilio.configuration;
201
323
  var phoneNumberOptions = buildPhoneNumberOptions(phoneNumbers);
324
+ var messagingServiceOptions = buildMessagingServiceOptions(messagingServices);
202
325
  var selectedPhoneNumber = neetoCist._findBy({
203
326
  label: configuration === null || configuration === void 0 ? void 0 : configuration.twilioPhoneNumber
204
327
  }, phoneNumberOptions);
205
- var isLoading = isPhoneNumbersLoading || isConfigurationLoading;
328
+ var selectedMessagingService = neetoCist._findBy({
329
+ value: configuration === null || configuration === void 0 ? void 0 : configuration.twilioMessagingServiceSid
330
+ }, messagingServiceOptions);
331
+ var initialValues = {
332
+ twilioSid: (_configuration$twilio = configuration === null || configuration === void 0 ? void 0 : configuration.twilioSid) !== null && _configuration$twilio !== void 0 ? _configuration$twilio : "",
333
+ twilioAuthToken: (_configuration$twilio2 = configuration === null || configuration === void 0 ? void 0 : configuration.twilioAuthToken) !== null && _configuration$twilio2 !== void 0 ? _configuration$twilio2 : "",
334
+ connectionType: (configuration === null || configuration === void 0 ? void 0 : configuration.connectionType) || CONNECTION_TYPES.PHONE_NUMBER,
335
+ twilioPhoneNumber: selectedPhoneNumber !== null && selectedPhoneNumber !== void 0 ? selectedPhoneNumber : null,
336
+ twilioMessagingService: selectedMessagingService !== null && selectedMessagingService !== void 0 ? selectedMessagingService : null
337
+ };
338
+ var senderOptionsAvailable = !!phoneNumbers || !!messagingServices;
339
+ var isLoading = isSenderOptionsLoading || isConfigurationLoading;
206
340
  var isSubmitDisabled = function isSubmitDisabled(values) {
207
- return ramda.equals(_objectSpread(_objectSpread({}, configuration), {}, {
208
- twilioPhoneNumber: selectedPhoneNumber
209
- }), values) || isLoading;
341
+ return ramda.equals(initialValues, values) || isLoading;
210
342
  };
211
343
  return /*#__PURE__*/jsxRuntime.jsx(Form, {
212
344
  className: "w-full",
213
345
  formikProps: {
214
346
  enableReinitialize: true,
215
- validationSchema: buildTwilioConfigurationValidationSchema(!!phoneNumbers),
216
- initialValues: configuration,
347
+ validationSchema: buildTwilioConfigurationValidationSchema(),
348
+ initialValues: initialValues,
217
349
  innerRef: formRef,
218
350
  onSubmit: handleSubmit
219
351
  },
@@ -225,16 +357,16 @@ var Twilio = function Twilio(_ref) {
225
357
  onClick: onClose
226
358
  },
227
359
  submitButtonProps: {
228
- label: phoneNumberOptions ? t("neetoIntegrations.common.saveChanges") : t("neetoIntegrations.common.verify"),
360
+ label: senderOptionsAvailable ? t("neetoIntegrations.common.saveChanges") : t("neetoIntegrations.common.verify"),
229
361
  disabled: isSubmitDisabled(formikProps.values) || isSubmitting,
230
- loading: isSubmitting || isPhoneNumbersLoading && !(configuration !== null && configuration !== void 0 && configuration.twilioAuthToken)
362
+ loading: isSubmitting || isSenderOptionsLoading && !(configuration !== null && configuration !== void 0 && configuration.twilioAuthToken)
231
363
  }
232
364
  }),
233
365
  children: /*#__PURE__*/jsxRuntime.jsx(ConfigurationForm, {
234
366
  formikProps: formikProps,
235
367
  initialFocusRef: initialFocusRef,
236
- phoneNumberOptions: phoneNumberOptions,
237
- selectedPhoneNumber: selectedPhoneNumber
368
+ messagingServiceOptions: senderOptionsAvailable ? messagingServiceOptions : null,
369
+ phoneNumberOptions: senderOptionsAvailable ? phoneNumberOptions : null
238
370
  })
239
371
  });
240
372
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Twilio.js","sources":["../../app/javascript/src/components/Integrations/Twilio/Form.jsx","../../app/javascript/src/components/Integrations/Twilio/hooks/useTwilio.js","../../app/javascript/src/components/Integrations/Twilio/utils.js","../../app/javascript/src/components/Integrations/Twilio/index.jsx"],"sourcesContent":["import { useEffect } from \"react\";\n\nimport { Input, Select } from \"neetoui/formik\";\nimport { useTranslation } from \"react-i18next\";\n\nconst ConfigurationForm = ({\n phoneNumberOptions,\n selectedPhoneNumber = null,\n initialFocusRef = null,\n isUsingOverlay = false,\n formikProps = {},\n}) => {\n const { t } = useTranslation();\n const { setFieldValue, setValues, errors, values, initialValues } =\n formikProps;\n\n useEffect(() => {\n selectedPhoneNumber &&\n setFieldValue(\"twilioPhoneNumber\", selectedPhoneNumber);\n }, [selectedPhoneNumber, initialValues]);\n\n return (\n <div className=\"flex w-full flex-col gap-y-4\">\n <div className=\"flex w-full\">\n <Input\n required\n autoFocus={!isUsingOverlay}\n data-testid=\"integrations-twilio-sid\"\n label={t(\"neetoIntegrations.twilio.sid\")}\n name=\"twilioSid\"\n ref={initialFocusRef}\n />\n </div>\n <div className=\"flex w-full\">\n <Input\n required\n data-testid=\"integrations-twilio-auth-token\"\n label={t(\"neetoIntegrations.twilio.authToken\")}\n name=\"twilioAuthToken\"\n />\n </div>\n {phoneNumberOptions && (\n <div className=\"flex w-full\">\n <Select\n error={errors.twilioPhoneNumber?.value}\n label={t(\"neetoIntegrations.common.phNo\")}\n name=\"twilioPhoneNumber\"\n options={phoneNumberOptions}\n size=\"large\"\n onChange={selected =>\n setValues({ ...values, twilioPhoneNumber: selected })\n }\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default ConfigurationForm;\n","import { noop } from \"neetocist\";\nimport { useStateWithDependency } from \"neetocommons/react-utils\";\n\nimport {\n useFetchTwilioPhoneNumbers,\n useCreateTwilioConfiguration,\n useFetchTwilioSmsConfiguration,\n} from \"hooks/reactQuery/useTwilioApi\";\n\nconst useTwilio = ({ onConnect = noop, formRef = null, integrable = null }) => {\n const { data: configuration = {}, isLoading: isConfigurationLoading } =\n useFetchTwilioSmsConfiguration({ integrable });\n const [credentials, setCredentials] = useStateWithDependency(configuration);\n const { data: phoneNumbers, isLoading: isPhoneNumbersLoading } =\n useFetchTwilioPhoneNumbers({ credentials, formRef });\n\n const { mutate: saveConfiguration, isPending: isSubmitting } =\n useCreateTwilioConfiguration({ integrable });\n\n const handleSubmit = values => {\n const payload = {\n twilio_sid: values.twilioSid,\n twilio_auth_token: values.twilioAuthToken,\n twilio_phone_number_sid: values.twilioPhoneNumber?.value,\n };\n\n if (!phoneNumbers && !configuration?.twilioPhoneNumber) {\n setCredentials(payload);\n\n return;\n }\n\n saveConfiguration(payload, { onSuccess: onConnect });\n };\n\n return {\n handleSubmit,\n phoneNumbers,\n isConfigurationLoading,\n isPhoneNumbersLoading,\n isSubmitting,\n configuration,\n };\n};\n\nexport default useTwilio;\n","import i18next from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const buildTwilioConfigurationValidationSchema = isTwilioPhoneRequired =>\n yup.object().shape({\n twilioSid: yup\n .string()\n .required(i18next.t(\"neetoIntegrations.twilio.validations.sidReq\")),\n twilioAuthToken: yup\n .string()\n .required(i18next.t(\"neetoIntegrations.twilio.validations.authTokenReq\")),\n twilioPhoneNumber: isTwilioPhoneRequired\n ? yup.object().shape({\n label: yup.string(),\n value: yup\n .string()\n .required(\n i18next.t(\"neetoIntegrations.twilio.validations.phNumReq\")\n ),\n })\n : null,\n });\n\nexport const buildPhoneNumberOptions = phoneNumbers =>\n phoneNumbers?.map(({ phoneNumber, sid }) => ({\n label: phoneNumber,\n value: sid,\n }));\n","import { useRef } from \"react\";\n\nimport { noop, _findBy } from \"neetocist\";\nimport CardLayout from \"neetomolecules/CardLayout\";\nimport { ActionBlock, Form as FormikFormWrapper } from \"neetoui/formik\";\nimport { equals } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport Form from \"./Form\";\nimport useTwilio from \"./hooks/useTwilio\";\nimport {\n buildPhoneNumberOptions,\n buildTwilioConfigurationValidationSchema,\n} from \"./utils\";\n\nconst Twilio = ({ integrable = null, onClose = noop, onConnect = noop }) => {\n const { t } = useTranslation();\n const initialFocusRef = useRef();\n const formRef = useRef();\n\n const {\n handleSubmit,\n phoneNumbers,\n isConfigurationLoading,\n isPhoneNumbersLoading,\n isSubmitting,\n configuration,\n } = useTwilio({ onConnect, formRef, integrable });\n\n const phoneNumberOptions = buildPhoneNumberOptions(phoneNumbers);\n\n const selectedPhoneNumber = _findBy(\n { label: configuration?.twilioPhoneNumber },\n phoneNumberOptions\n );\n\n const isLoading = isPhoneNumbersLoading || isConfigurationLoading;\n\n const isSubmitDisabled = values =>\n equals(\n { ...configuration, twilioPhoneNumber: selectedPhoneNumber },\n values\n ) || isLoading;\n\n return (\n <FormikFormWrapper\n className=\"w-full\"\n formikProps={{\n enableReinitialize: true,\n validationSchema: buildTwilioConfigurationValidationSchema(\n !!phoneNumbers\n ),\n initialValues: configuration,\n innerRef: formRef,\n onSubmit: handleSubmit,\n }}\n >\n {formikProps => (\n <CardLayout\n actionBlock={\n <ActionBlock\n {...{ isSubmitting }}\n cancelButtonProps={{ onClick: onClose }}\n submitButtonProps={{\n label: phoneNumberOptions\n ? t(\"neetoIntegrations.common.saveChanges\")\n : t(\"neetoIntegrations.common.verify\"),\n disabled: isSubmitDisabled(formikProps.values) || isSubmitting,\n loading:\n isSubmitting ||\n (isPhoneNumbersLoading && !configuration?.twilioAuthToken),\n }}\n />\n }\n >\n <Form\n {...{\n formikProps,\n initialFocusRef,\n phoneNumberOptions,\n selectedPhoneNumber,\n }}\n />\n </CardLayout>\n )}\n </FormikFormWrapper>\n );\n};\n\nexport default Twilio;\n"],"names":["ConfigurationForm","_ref","_errors$twilioPhoneNu","phoneNumberOptions","_ref$selectedPhoneNum","selectedPhoneNumber","_ref$initialFocusRef","initialFocusRef","_ref$isUsingOverlay","isUsingOverlay","_ref$formikProps","formikProps","_useTranslation","useTranslation","t","setFieldValue","setValues","errors","values","initialValues","useEffect","_jsxs","className","children","_jsx","Input","required","autoFocus","label","name","ref","Select","error","twilioPhoneNumber","value","options","size","onChange","selected","_objectSpread","useTwilio","_ref$onConnect","onConnect","noop","_ref$formRef","formRef","_ref$integrable","integrable","_useFetchTwilioSmsCon","useFetchTwilioSmsConfiguration","_useFetchTwilioSmsCon2","data","configuration","isConfigurationLoading","isLoading","_useStateWithDependen","useStateWithDependency","_useStateWithDependen2","_slicedToArray","credentials","setCredentials","_useFetchTwilioPhoneN","useFetchTwilioPhoneNumbers","phoneNumbers","isPhoneNumbersLoading","_useCreateTwilioConfi","useCreateTwilioConfiguration","saveConfiguration","mutate","isSubmitting","isPending","handleSubmit","_values$twilioPhoneNu","payload","twilio_sid","twilioSid","twilio_auth_token","twilioAuthToken","twilio_phone_number_sid","onSuccess","buildTwilioConfigurationValidationSchema","isTwilioPhoneRequired","yup","object","shape","string","i18next","buildPhoneNumberOptions","map","phoneNumber","sid","Twilio","_ref$onClose","onClose","useRef","_useTwilio","_findBy","isSubmitDisabled","equals","FormikFormWrapper","enableReinitialize","validationSchema","innerRef","onSubmit","CardLayout","actionBlock","ActionBlock","cancelButtonProps","onClick","submitButtonProps","disabled","loading","Form"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAMjB;AAAA,EAAA,IAAAC,qBAAA;AAAA,EAAA,IALJC,kBAAkB,GAAAF,IAAA,CAAlBE,kBAAkB;IAAAC,qBAAA,GAAAH,IAAA,CAClBI,mBAAmB;AAAnBA,IAAAA,mBAAmB,GAAAD,qBAAA,KAAA,MAAA,GAAG,IAAI,GAAAA,qBAAA;IAAAE,oBAAA,GAAAL,IAAA,CAC1BM,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAA,MAAA,GAAG,IAAI,GAAAA,oBAAA;IAAAE,mBAAA,G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AAY;AAClBsC,UAAAA,iBAAiB,EAAE;AAAEC,YAAAA,OAAO,EAAEf;WAAU;AACxCgB,UAAAA,iBAAiB,EAAE;YACjBjF,KAAK,EAAEzB,kBAAkB,GACrBW,CAAC,CAAC,sCAAsC,CAAC,GACzCA,CAAC,CAAC,iCAAiC,CAAC;YACxCgG,QAAQ,EAAEb,gBAAgB,CAACtF,WAAW,CAACO,MAAM,CAAC,IAAImD,YAAY;AAC9D0C,YAAAA,OAAO,EACL1C,YAAY,IACXL,qBAAqB,IAAI,EAACZ,aAAa,KAAA,IAAA,IAAbA,aAAa,KAAA,MAAA,IAAbA,aAAa,CAAEyB,eAAe;AAC7D;AAAE,SACH,CACF;QAAAtD,QAAA,eAEDC,cAAA,CAACwF,iBAAI,EAAA;AAEDrG,UAAAA,WAAW,EAAXA,WAAW;AACXJ,UAAAA,eAAe,EAAfA,eAAe;AACfJ,UAAAA,kBAAkB,EAAlBA,kBAAkB;AAClBE,UAAAA,mBAAmB,EAAnBA;SAEH;AAAC,OACQ,CAAC;AAAA,IAAA;AACd,GACgB,CAAC;AAExB;;;;"}
1
+ {"version":3,"file":"Twilio.js","sources":["../../app/javascript/src/components/Integrations/Twilio/constants.js","../../app/javascript/src/components/Integrations/Twilio/ConnectionTypeCard.jsx","../../app/javascript/src/components/Integrations/Twilio/Form.jsx","../../app/javascript/src/components/Integrations/Twilio/hooks/useTwilio.js","../../app/javascript/src/components/Integrations/Twilio/utils.js","../../app/javascript/src/components/Integrations/Twilio/index.jsx"],"sourcesContent":["export const CONNECTION_TYPES = {\n PHONE_NUMBER: \"phone_number\",\n MESSAGING_SERVICE: \"messaging_service\",\n};\n","import { Tag } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nconst ConnectionTypeCard = ({\n value,\n selected,\n title,\n description,\n recommended = false,\n onSelect,\n children,\n}) => {\n const { t } = useTranslation();\n const isSelected = selected === value;\n const cardClass = `flex w-full cursor-pointer flex-col gap-y-2 neeto-ui-rounded border p-4 ${\n isSelected\n ? \"neeto-ui-border-success-500 neeto-ui-bg-success-100\"\n : \"neeto-ui-border-gray-200\"\n }`;\n\n return (\n <div className={cardClass} onClick={() => onSelect(value)}>\n <div className=\"flex items-center gap-x-2\">\n <input\n {...{ value }}\n checked={isSelected}\n name=\"connectionType\"\n type=\"radio\"\n onChange={() => onSelect(value)}\n onClick={e => e.stopPropagation()}\n />\n <div className=\"font-semibold\">{title}</div>\n {recommended && (\n <Tag\n style=\"success\"\n label={t(\n \"neetoIntegrations.twilio.connectionType.messagingService.recommendedBadge\"\n )}\n />\n )}\n </div>\n <div className=\"text-sm neeto-ui-text-gray-600\">{description}</div>\n {isSelected && children}\n </div>\n );\n};\n\nexport default ConnectionTypeCard;\n","import { Input, Select } from \"neetoui/formik\";\nimport { useTranslation } from \"react-i18next\";\n\nimport ConnectionTypeCard from \"./ConnectionTypeCard\";\nimport { CONNECTION_TYPES } from \"./constants\";\n\nconst ConfigurationForm = ({\n phoneNumberOptions,\n messagingServiceOptions,\n initialFocusRef = null,\n isUsingOverlay = false,\n formikProps = {},\n}) => {\n const { t } = useTranslation();\n const { setFieldValue, values, errors } = formikProps;\n\n const handleConnectionTypeChange = nextType => {\n setFieldValue(\"connectionType\", nextType);\n\n if (nextType === CONNECTION_TYPES.PHONE_NUMBER) {\n setFieldValue(\"twilioMessagingService\", null);\n } else {\n setFieldValue(\"twilioPhoneNumber\", null);\n }\n };\n\n const senderOptionsAvailable =\n phoneNumberOptions !== null || messagingServiceOptions !== null;\n\n return (\n <div className=\"flex w-full flex-col gap-y-6\">\n <div className=\"flex w-full flex-col gap-y-4\">\n <Input\n required\n autoFocus={!isUsingOverlay}\n data-testid=\"integrations-twilio-sid\"\n label={t(\"neetoIntegrations.twilio.sid\")}\n name=\"twilioSid\"\n ref={initialFocusRef}\n />\n <Input\n required\n data-testid=\"integrations-twilio-auth-token\"\n label={t(\"neetoIntegrations.twilio.authToken\")}\n name=\"twilioAuthToken\"\n />\n </div>\n {senderOptionsAvailable && (\n <div className=\"flex w-full flex-col gap-y-4\">\n <div>\n <div className=\"font-semibold\">\n {t(\"neetoIntegrations.twilio.smsSendingMethod.title\")}\n </div>\n <div className=\"text-sm neeto-ui-text-gray-600\">\n {t(\"neetoIntegrations.twilio.smsSendingMethod.subtitle\")}\n </div>\n </div>\n <div className=\"flex w-full flex-col gap-y-3\">\n <ConnectionTypeCard\n selected={values.connectionType}\n value={CONNECTION_TYPES.PHONE_NUMBER}\n description={t(\n \"neetoIntegrations.twilio.connectionType.phoneNumber.description\"\n )}\n title={t(\n \"neetoIntegrations.twilio.connectionType.phoneNumber.label\"\n )}\n onSelect={handleConnectionTypeChange}\n >\n <Select\n error={errors.twilioPhoneNumber?.value}\n label={t(\"neetoIntegrations.common.phNo\")}\n name=\"twilioPhoneNumber\"\n options={phoneNumberOptions ?? []}\n size=\"large\"\n onChange={selected =>\n setFieldValue(\"twilioPhoneNumber\", selected)\n }\n />\n </ConnectionTypeCard>\n <ConnectionTypeCard\n recommended\n selected={values.connectionType}\n value={CONNECTION_TYPES.MESSAGING_SERVICE}\n description={t(\n \"neetoIntegrations.twilio.connectionType.messagingService.description\"\n )}\n title={t(\n \"neetoIntegrations.twilio.connectionType.messagingService.label\"\n )}\n onSelect={handleConnectionTypeChange}\n >\n <Select\n error={errors.twilioMessagingService?.value}\n label={t(\"neetoIntegrations.twilio.messagingService.label\")}\n name=\"twilioMessagingService\"\n options={messagingServiceOptions ?? []}\n size=\"large\"\n placeholder={t(\n \"neetoIntegrations.twilio.messagingService.placeholder\"\n )}\n onChange={selected =>\n setFieldValue(\"twilioMessagingService\", selected)\n }\n />\n </ConnectionTypeCard>\n </div>\n </div>\n )}\n </div>\n );\n};\n\nexport default ConfigurationForm;\n","import { noop } from \"neetocist\";\nimport { useStateWithDependency } from \"neetocommons/react-utils\";\n\nimport {\n useFetchTwilioSenderOptions,\n useCreateTwilioConfiguration,\n useFetchTwilioSmsConfiguration,\n} from \"hooks/reactQuery/useTwilioApi\";\n\nimport { CONNECTION_TYPES } from \"../constants\";\n\nconst useTwilio = ({ onConnect = noop, formRef = null, integrable = null }) => {\n const { data: configuration = {}, isLoading: isConfigurationLoading } =\n useFetchTwilioSmsConfiguration({ integrable });\n const [credentials, setCredentials] = useStateWithDependency(configuration);\n const { data: senderOptions, isLoading: isSenderOptionsLoading } =\n useFetchTwilioSenderOptions({ credentials, formRef });\n\n const phoneNumbers = senderOptions?.phoneNumbers;\n const messagingServices = senderOptions?.messagingServices;\n\n const { mutate: saveConfiguration, isPending: isSubmitting } =\n useCreateTwilioConfiguration({ integrable });\n\n const handleSubmit = values => {\n const credentialsPayload = {\n twilio_sid: values.twilioSid,\n twilio_auth_token: values.twilioAuthToken,\n };\n\n if (!senderOptions && !configuration?.connectionType) {\n setCredentials(credentialsPayload);\n\n return;\n }\n\n const payload =\n values.connectionType === CONNECTION_TYPES.MESSAGING_SERVICE\n ? {\n ...credentialsPayload,\n connection_type: CONNECTION_TYPES.MESSAGING_SERVICE,\n twilio_messaging_service_sid: values.twilioMessagingService?.value,\n twilio_messaging_service_friendly_name:\n values.twilioMessagingService?.label,\n }\n : {\n ...credentialsPayload,\n connection_type: CONNECTION_TYPES.PHONE_NUMBER,\n twilio_phone_number_sid: values.twilioPhoneNumber?.value,\n };\n\n saveConfiguration(payload, { onSuccess: onConnect });\n };\n\n return {\n handleSubmit,\n phoneNumbers,\n messagingServices,\n isConfigurationLoading,\n isSenderOptionsLoading,\n isSubmitting,\n configuration,\n };\n};\n\nexport default useTwilio;\n","import i18next from \"i18next\";\nimport * as yup from \"yup\";\n\nimport { CONNECTION_TYPES } from \"./constants\";\n\nexport const buildTwilioConfigurationValidationSchema = () =>\n yup.object().shape({\n twilioSid: yup\n .string()\n .required(i18next.t(\"neetoIntegrations.twilio.validations.sidReq\")),\n twilioAuthToken: yup\n .string()\n .required(i18next.t(\"neetoIntegrations.twilio.validations.authTokenReq\")),\n connectionType: yup\n .string()\n .oneOf([\n CONNECTION_TYPES.PHONE_NUMBER,\n CONNECTION_TYPES.MESSAGING_SERVICE,\n ])\n .required(),\n twilioPhoneNumber: yup\n .object()\n .nullable()\n .when(\"connectionType\", {\n is: CONNECTION_TYPES.PHONE_NUMBER,\n then: schema =>\n schema.shape({\n label: yup.string(),\n value: yup\n .string()\n .required(\n i18next.t(\"neetoIntegrations.twilio.validations.phNumReq\")\n ),\n }),\n }),\n twilioMessagingService: yup\n .object()\n .nullable()\n .when(\"connectionType\", {\n is: CONNECTION_TYPES.MESSAGING_SERVICE,\n then: schema =>\n schema.shape({\n label: yup.string(),\n value: yup\n .string()\n .required(\n i18next.t(\n \"neetoIntegrations.twilio.validations.messagingServiceReq\"\n )\n ),\n }),\n }),\n });\n\nexport const buildPhoneNumberOptions = phoneNumbers =>\n phoneNumbers?.map(({ phoneNumber, sid }) => ({\n label: phoneNumber,\n value: sid,\n })) ?? [];\n\nexport const buildMessagingServiceOptions = messagingServices =>\n messagingServices?.map(({ sid, friendlyName }) => ({\n label: friendlyName,\n value: sid,\n })) ?? [];\n","import { useRef } from \"react\";\n\nimport { noop, _findBy } from \"neetocist\";\nimport CardLayout from \"neetomolecules/CardLayout\";\nimport { ActionBlock, Form as FormikFormWrapper } from \"neetoui/formik\";\nimport { equals } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { CONNECTION_TYPES } from \"./constants\";\nimport Form from \"./Form\";\nimport useTwilio from \"./hooks/useTwilio\";\nimport {\n buildMessagingServiceOptions,\n buildPhoneNumberOptions,\n buildTwilioConfigurationValidationSchema,\n} from \"./utils\";\n\nconst Twilio = ({ integrable = null, onClose = noop, onConnect = noop }) => {\n const { t } = useTranslation();\n const initialFocusRef = useRef();\n const formRef = useRef();\n\n const {\n handleSubmit,\n phoneNumbers,\n messagingServices,\n isConfigurationLoading,\n isSenderOptionsLoading,\n isSubmitting,\n configuration,\n } = useTwilio({ onConnect, formRef, integrable });\n\n const phoneNumberOptions = buildPhoneNumberOptions(phoneNumbers);\n const messagingServiceOptions =\n buildMessagingServiceOptions(messagingServices);\n\n const selectedPhoneNumber = _findBy(\n { label: configuration?.twilioPhoneNumber },\n phoneNumberOptions\n );\n\n const selectedMessagingService = _findBy(\n { value: configuration?.twilioMessagingServiceSid },\n messagingServiceOptions\n );\n\n const initialValues = {\n twilioSid: configuration?.twilioSid ?? \"\",\n twilioAuthToken: configuration?.twilioAuthToken ?? \"\",\n connectionType:\n configuration?.connectionType || CONNECTION_TYPES.PHONE_NUMBER,\n twilioPhoneNumber: selectedPhoneNumber ?? null,\n twilioMessagingService: selectedMessagingService ?? null,\n };\n\n const senderOptionsAvailable = !!phoneNumbers || !!messagingServices;\n const isLoading = isSenderOptionsLoading || isConfigurationLoading;\n\n const isSubmitDisabled = values => equals(initialValues, values) || isLoading;\n\n return (\n <FormikFormWrapper\n className=\"w-full\"\n formikProps={{\n enableReinitialize: true,\n validationSchema: buildTwilioConfigurationValidationSchema(),\n initialValues,\n innerRef: formRef,\n onSubmit: handleSubmit,\n }}\n >\n {formikProps => (\n <CardLayout\n actionBlock={\n <ActionBlock\n {...{ isSubmitting }}\n cancelButtonProps={{ onClick: onClose }}\n submitButtonProps={{\n label: senderOptionsAvailable\n ? t(\"neetoIntegrations.common.saveChanges\")\n : t(\"neetoIntegrations.common.verify\"),\n disabled: isSubmitDisabled(formikProps.values) || isSubmitting,\n loading:\n isSubmitting ||\n (isSenderOptionsLoading && !configuration?.twilioAuthToken),\n }}\n />\n }\n >\n <Form\n {...{ formikProps, initialFocusRef }}\n messagingServiceOptions={\n senderOptionsAvailable ? messagingServiceOptions : null\n }\n phoneNumberOptions={\n senderOptionsAvailable ? phoneNumberOptions : null\n }\n />\n </CardLayout>\n )}\n </FormikFormWrapper>\n );\n};\n\nexport default Twilio;\n"],"names":["CONNECTION_TYPES","PHONE_NUMBER","MESSAGING_SERVICE","ConnectionTypeCard","_ref","value","selected","title","description","_ref$recommended","recommended","onSelect","children","_useTranslation","useTranslation","t","isSelected","cardClass","concat","_jsxs","className","onClick","_jsx","checked","name","type","onChange","e","stopPropagation","Tag","style","label","ConfigurationForm","_errors$twilioPhoneNu","_errors$twilioMessagi","phoneNumberOptions","messagingServiceOptions","_ref$initialFocusRef","initialFocusRef","_ref$isUsingOverlay","isUsingOverlay","_ref$formikProps","formikProps","setFieldValue","values","errors","handleConnectionTypeChange","nextType","senderOptionsAvailable","Input","required","autoFocus","ref","connectionType","Select","error","twilioPhoneNumber","options","size","twilioMessagingService","placeholder","useTwilio","_ref$onConnect","onConnect","noop","_ref$formRef","formRef","_ref$integrable","integrable","_useFetchTwilioSmsCon","useFetchTwilioSmsConfiguration","_useFetchTwilioSmsCon2","data","configuration","isConfigurationLoading","isLoading","_useStateWithDependen","useStateWithDependency","_useStateWithDependen2","_slicedToArray","credentials","setCredentials","_useFetchTwilioSender","useFetchTwilioSenderOptions","senderOptions","isSenderOptionsLoading","phoneNumbers","messagingServices","_useCreateTwilioConfi","useCreateTwilioConfiguration","saveConfiguration","mutate","isSubmitting","isPending","handleSubmit","_values$twilioMessagi","_values$twilioMessagi2","_values$twilioPhoneNu","credentialsPayload","twilio_sid","twilioSid","twilio_auth_token","twilioAuthToken","payload","_objectSpread","connection_type","twilio_messaging_service_sid","twilio_messaging_service_friendly_name","twilio_phone_number_sid","onSuccess","buildTwilioConfigurationValidationSchema","yup","object","shape","string","i18next","oneOf","nullable","when","is","then","schema","buildPhoneNumberOptions","_phoneNumbers$map","map","phoneNumber","sid","buildMessagingServiceOptions","_messagingServices$ma","_ref2","friendlyName","Twilio","_configuration$twilio","_configuration$twilio2","_ref$onClose","onClose","useRef","_useTwilio","selectedPhoneNumber","_findBy","selectedMessagingService","twilioMessagingServiceSid","initialValues","isSubmitDisabled","equals","FormikFormWrapper","enableReinitialize","validationSchema","innerRef","onSubmit","CardLayout","actionBlock","ActionBlock","cancelButtonProps","submitButtonProps","disabled","loading","Form"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAMA,gBAAgB,GAAG;AAC9BC,E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mB,UAAAA,iBAAiB,EAAE;YACjB3H,KAAK,EAAEiB,sBAAsB,GACzBjC,CAAC,CAAC,sCAAsC,CAAC,GACzCA,CAAC,CAAC,iCAAiC,CAAC;YACxC4I,QAAQ,EAAEZ,gBAAgB,CAACrG,WAAW,CAACE,MAAM,CAAC,IAAIgD,YAAY;AAC9DgE,YAAAA,OAAO,EACLhE,YAAY,IACXP,sBAAsB,IAAI,EAACZ,aAAa,KAAA,IAAA,IAAbA,aAAa,KAAA,MAAA,IAAbA,aAAa,CAAE6B,eAAe;AAC9D;AAAE,SACH,CACF;QAAA1F,QAAA,eAEDU,cAAA,CAACuI,iBAAI,EAAA;AACGnH,UAAAA,WAAW,EAAXA,WAAW;AAAEJ,UAAAA,eAAe,EAAfA,eAAe;AAClCF,UAAAA,uBAAuB,EACrBY,sBAAsB,GAAGZ,uBAAuB,GAAG,IACpD;AACDD,UAAAA,kBAAkB,EAChBa,sBAAsB,GAAGb,kBAAkB,GAAG;SAEjD;AAAC,OACQ,CAAC;AAAA,IAAA;AACd,GACgB,CAAC;AAExB;;;;"}
package/dist/cjs/Zoom.js CHANGED
@@ -8,7 +8,7 @@ var Spinner = require('@bigbinary/neetoui/Spinner');
8
8
  var Typography = require('@bigbinary/neetoui/Typography');
9
9
  var reactI18next = require('react-i18next');
10
10
  var Manage = require('./Manage.js');
11
- var useZoomApi = require('../useZoomApi-B127NAGl.js');
11
+ var useZoomApi = require('../useZoomApi-C8AUYMlp.js');
12
12
  var jsxRuntime = require('react/jsx-runtime');
13
13
  require('@babel/runtime/helpers/defineProperty');
14
14
  require('@bigbinary/neeto-commons-frontend/react-utils');
@@ -24,7 +24,7 @@ require('@bigbinary/neetoui/Alert');
24
24
  require('@tanstack/react-query');
25
25
  require('@bigbinary/neeto-commons-frontend/constants');
26
26
  require('axios');
27
- require('../query-CySi2Ki7.js');
27
+ require('../query-BF3HFRA7.js');
28
28
 
29
29
  var Zoom = function Zoom(_ref) {
30
30
  var _ref$connectUrl = _ref.connectUrl,
package/dist/cjs/index.js CHANGED
@@ -2,11 +2,13 @@
2
2
 
3
3
  var Manage = require('./Manage.js');
4
4
  var DisconnectAlert = require('./DisconnectAlert.js');
5
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
+ var React = require('react');
5
7
  var Tag = require('@bigbinary/neetoui/Tag');
6
8
  var ramda = require('ramda');
7
9
  var reactI18next = require('react-i18next');
8
10
  var reactRouterDom = require('react-router-dom');
9
- var useDisconnectionAlertsApi = require('../useDisconnectionAlertsApi-C8Q2wbVl.js');
11
+ var useDisconnectionAlertsApi = require('../useDisconnectionAlertsApi-CWMlpOJD.js');
10
12
  var jsxRuntime = require('react/jsx-runtime');
11
13
  var Daily = require('./Daily.js');
12
14
  var DailyForm = require('./DailyForm.js');
@@ -14,12 +16,12 @@ var GoogleCalendar = require('./GoogleCalendar.js');
14
16
  var Telnyx = require('./Telnyx.js');
15
17
  var Twilio = require('./Twilio.js');
16
18
  var Zoom = require('./Zoom.js');
17
- var query = require('../query-CySi2Ki7.js');
18
19
  var Modal = require('./Modal.js');
19
20
  var Connect = require('./Connect.js');
20
21
  var Demo = require('./Demo.js');
21
22
  var Finish = require('./Finish.js');
22
23
  var WalkthroughModal = require('./WalkthroughModal.js');
24
+ var query = require('../query-BF3HFRA7.js');
23
25
  require('@babel/runtime/helpers/defineProperty');
24
26
  require('@bigbinary/neeto-cist');
25
27
  require('@bigbinary/neeto-commons-frontend/react-utils');
@@ -36,9 +38,7 @@ require('@tanstack/react-query');
36
38
  require('@bigbinary/neeto-commons-frontend/constants');
37
39
  require('axios');
38
40
  require('i18next');
39
- require('../useDailiesApi-BjcmweuZ.js');
40
- require('@babel/runtime/helpers/slicedToArray');
41
- require('react');
41
+ require('../useDailiesApi-CEJPknLb.js');
42
42
  require('@bigbinary/neeto-commons-frontend/utils');
43
43
  require('@bigbinary/neeto-icons/misc/Daily');
44
44
  require('@bigbinary/neeto-molecules/CopyToClipboardButton');
@@ -55,10 +55,10 @@ require('@bigbinary/neeto-icons/misc/GoogleCalendar');
55
55
  require('@bigbinary/neeto-icons/misc/Google');
56
56
  require('@bigbinary/neeto-molecules/PageLoader');
57
57
  require('@bigbinary/neetoui/formik/Select');
58
- require('../useTelnyxApi-DDTzGMgk.js');
59
- require('../useTwilioApi-DPyyUWOs.js');
58
+ require('../useTelnyxApi-DS3IVijP.js');
59
+ require('../useTwilioApi-CUL0-Xgf.js');
60
60
  require('@bigbinary/neeto-icons/misc/Zoom');
61
- require('../useZoomApi-B127NAGl.js');
61
+ require('../useZoomApi-C8AUYMlp.js');
62
62
  require('@bigbinary/neetoui/Modal');
63
63
  require('classnames');
64
64
  require('../index-dxk7jTL7.js');
@@ -84,27 +84,27 @@ var IntegrationLinks = function IntegrationLinks(_ref) {
84
84
  var DisconnectedIntegrationsRibbon = function DisconnectedIntegrationsRibbon(_ref2) {
85
85
  var _ref2$integrationRout = _ref2.integrationRouteMap,
86
86
  integrationRouteMap = _ref2$integrationRout === void 0 ? {} : _ref2$integrationRout;
87
+ var _useState = React.useState(false),
88
+ _useState2 = _slicedToArray(_useState, 2),
89
+ isClosed = _useState2[0],
90
+ setIsClosed = _useState2[1];
87
91
  reactI18next.useTranslation();
88
92
  var _useFetchDisconnectio = useDisconnectionAlertsApi.useFetchDisconnectionAlerts(),
89
93
  _useFetchDisconnectio2 = _useFetchDisconnectio.data,
90
94
  _useFetchDisconnectio3 = _useFetchDisconnectio2 === void 0 ? {} : _useFetchDisconnectio2,
91
95
  _useFetchDisconnectio4 = _useFetchDisconnectio3.disconnectionAlerts,
92
96
  alerts = _useFetchDisconnectio4 === void 0 ? [] : _useFetchDisconnectio4;
93
- var _useDismissDisconnect = useDisconnectionAlertsApi.useDismissDisconnectionAlerts(),
94
- dismissAlerts = _useDismissDisconnect.mutate;
95
97
  var knownAlerts = alerts.filter(function (alert) {
96
98
  return integrationRouteMap[alert.serviceName];
97
99
  });
98
- if (ramda.isEmpty(knownAlerts)) return null;
100
+ if (isClosed || ramda.isEmpty(knownAlerts)) return null;
99
101
  return /*#__PURE__*/jsxRuntime.jsx(Tag, {
100
102
  className: "neeto-molecules-sticky-ribbon w-full p-2.5 text-center",
101
103
  "data-testid": "disconnected-integrations-ribbon",
102
104
  size: "large",
103
105
  style: "warning",
104
106
  onClose: function onClose() {
105
- return dismissAlerts(knownAlerts.map(function (alert) {
106
- return alert.id;
107
- }));
107
+ return setIsClosed(true);
108
108
  },
109
109
  children: /*#__PURE__*/jsxRuntime.jsx("span", {
110
110
  className: "w-full",
@@ -131,11 +131,11 @@ exports.GoogleCalendar = GoogleCalendar;
131
131
  exports.Telnyx = Telnyx;
132
132
  exports.Twilio = Twilio;
133
133
  exports.Zoom = Zoom;
134
- exports.disconnectionAlertsQueryKey = query.disconnectionAlertsQueryKey;
135
134
  exports.Modal = Modal;
136
135
  exports.Connect = Connect;
137
136
  exports.Demo = Demo;
138
137
  exports.Finish = Finish;
139
138
  exports.WalkthroughModal = WalkthroughModal;
139
+ exports.disconnectionAlertsQueryKey = query.disconnectionAlertsQueryKey;
140
140
  exports.DisconnectedIntegrationsRibbon = DisconnectedIntegrationsRibbon;
141
141
  //# sourceMappingURL=index.js.map