@bigbinary/neeto-email-delivery-frontend 1.0.26 → 1.0.28

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 (46) hide show
  1. package/app/javascript/src/translations/en.json +17 -0
  2. package/dist/EmailDeliveryScreen.js +22 -584
  3. package/dist/EmailDeliveryScreen.js.map +1 -1
  4. package/dist/SparkpostDomainSetup.js +20 -2
  5. package/dist/SparkpostDomainSetup.js.map +1 -1
  6. package/dist/SparkpostDomainVerify.js +13 -3
  7. package/dist/SparkpostDomainVerify.js.map +1 -1
  8. package/dist/cjs/EmailDeliveryScreen.js +23 -600
  9. package/dist/cjs/EmailDeliveryScreen.js.map +1 -1
  10. package/dist/cjs/SparkpostDomainSetup.js +20 -2
  11. package/dist/cjs/SparkpostDomainSetup.js.map +1 -1
  12. package/dist/cjs/SparkpostDomainVerify.js +13 -3
  13. package/dist/cjs/SparkpostDomainVerify.js.map +1 -1
  14. package/dist/cjs/hooks.js +6 -46
  15. package/dist/cjs/hooks.js.map +1 -1
  16. package/dist/cjs/index.js +447 -29
  17. package/dist/cjs/index.js.map +1 -1
  18. package/dist/hooks.js +4 -48
  19. package/dist/hooks.js.map +1 -1
  20. package/dist/index-BKKcEEt1.js +337 -0
  21. package/dist/index-BKKcEEt1.js.map +1 -0
  22. package/dist/index-C7KroEtv.js +342 -0
  23. package/dist/index-C7KroEtv.js.map +1 -0
  24. package/dist/index.js +431 -28
  25. package/dist/index.js.map +1 -1
  26. package/dist/useEmailDeliveryIntegrationApi-BD6h2h5w.js +57 -0
  27. package/dist/useEmailDeliveryIntegrationApi-BD6h2h5w.js.map +1 -0
  28. package/dist/useEmailDeliveryIntegrationApi-NUL8d1xC.js +55 -0
  29. package/dist/useEmailDeliveryIntegrationApi-NUL8d1xC.js.map +1 -0
  30. package/dist/useSparkpostApi-C7cHCa3T.js +253 -0
  31. package/dist/useSparkpostApi-C7cHCa3T.js.map +1 -0
  32. package/dist/{useOutlookIntegrationApi-b_mNVfRE.js → useSparkpostApi-tYImubXZ.js} +150 -53
  33. package/dist/useSparkpostApi-tYImubXZ.js.map +1 -0
  34. package/dist/{useSparkpostDomain-DtEcunpG.js → useSparkpostDomain-BiZb7l8r.js} +2 -2
  35. package/dist/{useSparkpostDomain-DtEcunpG.js.map → useSparkpostDomain-BiZb7l8r.js.map} +1 -1
  36. package/dist/{useSparkpostDomain-De-Fz3ek.js → useSparkpostDomain-CmX8ka38.js} +2 -2
  37. package/dist/{useSparkpostDomain-De-Fz3ek.js.map → useSparkpostDomain-CmX8ka38.js.map} +1 -1
  38. package/package.json +12 -13
  39. package/types.d.ts +23 -2
  40. package/dist/useOutlookIntegrationApi-BC-RPHmJ.js +0 -149
  41. package/dist/useOutlookIntegrationApi-BC-RPHmJ.js.map +0 -1
  42. package/dist/useOutlookIntegrationApi-b_mNVfRE.js.map +0 -1
  43. package/dist/useSparkpostApi-D9NOjTNA.js +0 -120
  44. package/dist/useSparkpostApi-D9NOjTNA.js.map +0 -1
  45. package/dist/useSparkpostApi-qpRhsK7H.js +0 -106
  46. package/dist/useSparkpostApi-qpRhsK7H.js.map +0 -1
package/dist/cjs/index.js CHANGED
@@ -1,40 +1,42 @@
1
1
  'use strict';
2
2
 
3
- var EmailDeliveryScreen = require('./EmailDeliveryScreen.js');
3
+ var EmailDeliveryScreen = require('../index-C7KroEtv.js');
4
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
5
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
+ var react = require('react');
7
+ var utils = require('@bigbinary/neeto-commons-frontend/utils');
8
+ var Check = require('@bigbinary/neeto-icons/Check');
9
+ var Warning = require('@bigbinary/neeto-icons/Warning');
10
+ var CardLayout = require('@bigbinary/neeto-molecules/CardLayout');
11
+ var Button = require('@bigbinary/neetoui/Button');
12
+ var Callout = require('@bigbinary/neetoui/Callout');
13
+ var Spinner = require('@bigbinary/neetoui/Spinner');
14
+ var Typography = require('@bigbinary/neetoui/Typography');
15
+ var reactI18next = require('react-i18next');
16
+ var reactRouterDom = require('react-router-dom');
17
+ var useSparkpostApi = require('../useSparkpostApi-C7cHCa3T.js');
18
+ var Pane = require('@bigbinary/neetoui/Pane');
19
+ var Form = require('@bigbinary/neetoui/formik/Form');
20
+ var Input = require('@bigbinary/neetoui/formik/Input');
21
+ var Radio = require('@bigbinary/neetoui/formik/Radio');
22
+ var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
23
+ var i18next = require('i18next');
24
+ var yup = require('yup');
25
+ var jsxRuntime = require('react/jsx-runtime');
26
+ var useSparkpostDomain = require('../useSparkpostDomain-BiZb7l8r.js');
27
+ var useEmailDeliveryIntegrationApi = require('../useEmailDeliveryIntegrationApi-BD6h2h5w.js');
28
+ var MailSend = require('@bigbinary/neeto-icons/MailSend');
29
+ var GmailIcon = require('@bigbinary/neeto-icons/misc/Gmail');
30
+ var OutlookIcon = require('@bigbinary/neeto-icons/misc/Outlook');
4
31
  var SparkpostDomainSetup = require('./SparkpostDomainSetup.js');
5
32
  var SparkpostDomainVerify = require('./SparkpostDomainVerify.js');
6
- require('@babel/runtime/helpers/slicedToArray');
7
- require('react');
8
33
  require('@bigbinary/neeto-cist');
9
34
  require('@bigbinary/neeto-commons-frontend/react-utils');
10
- require('@bigbinary/neeto-commons-frontend/utils');
11
- require('@bigbinary/neeto-icons/MailSend');
12
- require('@bigbinary/neeto-icons/misc/Gmail');
13
- require('@bigbinary/neeto-icons/misc/Outlook');
14
- require('@bigbinary/neetoui/Spinner');
15
- require('@bigbinary/neetoui/Callout');
16
35
  require('@bigbinary/neetoui/Toastr');
17
- require('ramda');
18
- require('react-i18next');
19
- require('react-router-dom');
20
- require('../useSparkpostApi-D9NOjTNA.js');
21
- require('@babel/runtime/helpers/defineProperty');
22
36
  require('@tanstack/react-query');
23
- require('axios');
24
- require('@bigbinary/neetoui/Pane');
25
- require('@bigbinary/neetoui/Typography');
26
- require('@bigbinary/neetoui/formik/Form');
27
- require('@bigbinary/neetoui/formik/Input');
28
- require('@bigbinary/neetoui/formik/Radio');
29
- require('@bigbinary/neetoui/formik/ActionBlock');
30
- require('../useOutlookIntegrationApi-BC-RPHmJ.js');
31
- require('i18next');
32
- require('yup');
33
- require('react/jsx-runtime');
34
- require('../useSparkpostDomain-DtEcunpG.js');
35
- require('@bigbinary/neetoui/Button');
36
37
  require('@bigbinary/neetoui/Tag');
37
- require('@bigbinary/neeto-molecules/CardLayout');
38
+ require('axios');
39
+ require('ramda');
38
40
  require('../constants-DPhFGbtO.js');
39
41
  require('@babel/runtime/helpers/objectWithoutProperties');
40
42
  require('classnames');
@@ -43,9 +45,425 @@ require('@bigbinary/neeto-molecules/Header');
43
45
  require('@babel/runtime/helpers/toConsumableArray');
44
46
  require('@bigbinary/neeto-molecules/CopyToClipboardButton');
45
47
 
48
+ function _interopNamespaceDefault(e) {
49
+ var n = Object.create(null);
50
+ if (e) {
51
+ Object.keys(e).forEach(function (k) {
52
+ if (k !== 'default') {
53
+ var d = Object.getOwnPropertyDescriptor(e, k);
54
+ Object.defineProperty(n, k, d.get ? d : {
55
+ enumerable: true,
56
+ get: function () { return e[k]; }
57
+ });
58
+ }
59
+ });
60
+ }
61
+ n.default = e;
62
+ return Object.freeze(n);
63
+ }
64
+
65
+ var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
66
+
67
+ var ENCRYPTION_OPTIONS = [{
68
+ label: "None",
69
+ value: "none"
70
+ }, {
71
+ label: "StartTLS",
72
+ value: "starttls"
73
+ }, {
74
+ label: "SSL",
75
+ value: "ssl"
76
+ }];
77
+ var SMTP_ACCOUNT_INITIAL_VALUES = {
78
+ host: "",
79
+ port: 587,
80
+ username: "",
81
+ password: "",
82
+ email: "",
83
+ encryption: "starttls",
84
+ displayName: ""
85
+ };
86
+ var SMTP_ACCOUNT_VALIDATION_SCHEMA = yup__namespace.object().shape({
87
+ host: yup__namespace.string().trim().required(i18next.t("neetoEmailDelivery.smtp.setup.requiredField", {
88
+ field: i18next.t("neetoEmailDelivery.smtp.setup.hostLabel")
89
+ })),
90
+ port: yup__namespace.number().required(i18next.t("neetoEmailDelivery.smtp.setup.requiredField", {
91
+ field: i18next.t("neetoEmailDelivery.smtp.setup.portLabel")
92
+ })),
93
+ username: yup__namespace.string().trim().required(i18next.t("neetoEmailDelivery.smtp.setup.requiredField", {
94
+ field: i18next.t("neetoEmailDelivery.smtp.setup.usernameLabel")
95
+ })),
96
+ password: yup__namespace.string().trim().required(i18next.t("neetoEmailDelivery.smtp.setup.requiredField", {
97
+ field: i18next.t("neetoEmailDelivery.smtp.setup.passwordLabel")
98
+ })),
99
+ email: yup__namespace.string().trim().required(i18next.t("neetoEmailDelivery.smtp.setup.requiredField", {
100
+ field: i18next.t("neetoEmailDelivery.smtp.setup.emailLabel")
101
+ })).email(i18next.t("neetoEmailDelivery.smtp.setup.emailInvalid")),
102
+ displayName: yup__namespace.string().trim().required(i18next.t("neetoEmailDelivery.smtp.setup.requiredField", {
103
+ field: i18next.t("neetoEmailDelivery.smtp.setup.displayNameLabel")
104
+ })),
105
+ encryption: yup__namespace.string().trim().required(i18next.t("neetoEmailDelivery.smtp.setup.requiredField", {
106
+ field: i18next.t("neetoEmailDelivery.smtp.setup.encryptionLabel")
107
+ }))
108
+ });
109
+
110
+ var SmtpSetup = function SmtpSetup(_ref) {
111
+ var ownerId = _ref.ownerId,
112
+ onDone = _ref.onDone,
113
+ onCancel = _ref.onCancel,
114
+ isOpen = _ref.isOpen;
115
+ var _useTranslation = reactI18next.useTranslation(),
116
+ t = _useTranslation.t;
117
+ var _useCreateSmtp = useSparkpostApi.useCreateSmtp({
118
+ ownerId: ownerId
119
+ }),
120
+ isCreating = _useCreateSmtp.isPending,
121
+ createSmtp = _useCreateSmtp.mutate;
122
+ var handleSubmit = function handleSubmit(values) {
123
+ createSmtp({
124
+ smtp_account: values
125
+ }, {
126
+ onSuccess: onDone
127
+ });
128
+ };
129
+ return /*#__PURE__*/jsxRuntime.jsxs(Pane, {
130
+ isOpen: isOpen,
131
+ size: "lg",
132
+ onClose: onCancel,
133
+ children: [/*#__PURE__*/jsxRuntime.jsx(Pane.Header, {
134
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
135
+ style: "h2",
136
+ weight: "semibold",
137
+ children: t("neetoEmailDelivery.smtp.setup.title")
138
+ })
139
+ }), /*#__PURE__*/jsxRuntime.jsxs(Form, {
140
+ className: "w-full",
141
+ formikProps: {
142
+ initialValues: SMTP_ACCOUNT_INITIAL_VALUES,
143
+ validationSchema: SMTP_ACCOUNT_VALIDATION_SCHEMA,
144
+ onSubmit: handleSubmit
145
+ },
146
+ children: [/*#__PURE__*/jsxRuntime.jsx(Pane.Body, {
147
+ className: "space-y-4",
148
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
149
+ className: "flex flex-col gap-6",
150
+ children: [/*#__PURE__*/jsxRuntime.jsx(Callout, {
151
+ style: "warning",
152
+ children: t("neetoEmailDelivery.smtp.setup.note")
153
+ }), /*#__PURE__*/jsxRuntime.jsx(Input, {
154
+ required: true,
155
+ label: t("neetoEmailDelivery.smtp.setup.hostLabel"),
156
+ name: "host"
157
+ }), /*#__PURE__*/jsxRuntime.jsx(Input, {
158
+ required: true,
159
+ label: t("neetoEmailDelivery.smtp.setup.portLabel"),
160
+ name: "port",
161
+ type: "number"
162
+ }), /*#__PURE__*/jsxRuntime.jsx(Input, {
163
+ required: true,
164
+ label: t("neetoEmailDelivery.smtp.setup.usernameLabel"),
165
+ name: "username"
166
+ }), /*#__PURE__*/jsxRuntime.jsx(Input, {
167
+ required: true,
168
+ label: t("neetoEmailDelivery.smtp.setup.passwordLabel"),
169
+ name: "password",
170
+ type: "password"
171
+ }), /*#__PURE__*/jsxRuntime.jsx(Input, {
172
+ required: true,
173
+ label: t("neetoEmailDelivery.smtp.setup.emailLabel"),
174
+ name: "email",
175
+ type: "email"
176
+ }), /*#__PURE__*/jsxRuntime.jsx(Input, {
177
+ required: true,
178
+ label: t("neetoEmailDelivery.smtp.setup.displayNameLabel"),
179
+ name: "displayName"
180
+ }), /*#__PURE__*/jsxRuntime.jsx(Radio, {
181
+ label: t("neetoEmailDelivery.smtp.setup.encryptionLabel"),
182
+ name: "encryption",
183
+ children: ENCRYPTION_OPTIONS.map(function (option) {
184
+ return /*#__PURE__*/jsxRuntime.jsx(Radio.Item, {
185
+ label: option.label,
186
+ value: option.value
187
+ }, option.value);
188
+ })
189
+ })]
190
+ })
191
+ }), /*#__PURE__*/jsxRuntime.jsx(Pane.Footer, {
192
+ children: /*#__PURE__*/jsxRuntime.jsx(ActionBlock, {
193
+ cancelButtonProps: {
194
+ onClick: onCancel
195
+ },
196
+ isSubmitting: isCreating,
197
+ submitButtonProps: {
198
+ label: t("neetoEmailDelivery.smtp.setup.saveAndActivate")
199
+ }
200
+ })
201
+ })]
202
+ })]
203
+ });
204
+ };
205
+
206
+ var INTEGRATION_TYPES = {
207
+ GMAIL: "gmail",
208
+ OUTLOOK: "outlook",
209
+ SPARKPOST: "sparkpost",
210
+ SMTP: "smtp"
211
+ };
212
+ var PROVIDER_LABELS = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, INTEGRATION_TYPES.GMAIL, "Gmail"), INTEGRATION_TYPES.OUTLOOK, "Outlook"), INTEGRATION_TYPES.SPARKPOST, "Custom email provider"), INTEGRATION_TYPES.SMTP, "SMTP");
213
+ var PROVIDER_ICONS = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, INTEGRATION_TYPES.GMAIL, GmailIcon), INTEGRATION_TYPES.OUTLOOK, OutlookIcon), INTEGRATION_TYPES.SPARKPOST, MailSend), INTEGRATION_TYPES.SMTP, MailSend);
46
214
 
215
+ var IntegrationDetailPage = function IntegrationDetailPage(_ref) {
216
+ var type = _ref.type,
217
+ ownerId = _ref.ownerId,
218
+ canManageIntegrations = _ref.canManageIntegrations,
219
+ appName = _ref.appName,
220
+ scopeText = _ref.scopeText,
221
+ connectedScopeText = _ref.connectedScopeText,
222
+ helpArticleUrl = _ref.helpArticleUrl,
223
+ indexRoute = _ref.indexRoute,
224
+ integrationRoutes = _ref.integrationRoutes,
225
+ ownDomainSetupRoute = _ref.ownDomainSetupRoute,
226
+ ownDomainVerifyRoute = _ref.ownDomainVerifyRoute;
227
+ var _useTranslation = reactI18next.useTranslation(),
228
+ t = _useTranslation.t;
229
+ var history = reactRouterDom.useHistory();
230
+ var _useState = react.useState(false),
231
+ _useState2 = _slicedToArray(_useState, 2),
232
+ isSmtpPaneOpen = _useState2[0],
233
+ setIsSmtpPaneOpen = _useState2[1];
234
+ var providerLabel = PROVIDER_LABELS[type];
235
+ var Icon = PROVIDER_ICONS[type];
236
+ var description = t("neetoEmailDelivery.".concat(type, ".description"));
237
+ var gmailIntegration = EmailDeliveryScreen.useGmail({
238
+ ownerId: ownerId,
239
+ indexRoute: indexRoute,
240
+ canManageIntegrations: canManageIntegrations
241
+ });
242
+ var outlookIntegration = EmailDeliveryScreen.useOutlook({
243
+ ownerId: ownerId,
244
+ indexRoute: indexRoute,
245
+ canManageIntegrations: canManageIntegrations
246
+ });
247
+ var sparkpostIntegration = useSparkpostDomain.useSparkpostDomain({
248
+ ownerId: ownerId,
249
+ canManageIntegrations: canManageIntegrations
250
+ });
251
+ var smtpIntegration = EmailDeliveryScreen.useSmtp({
252
+ ownerId: ownerId,
253
+ canManageIntegrations: canManageIntegrations
254
+ });
255
+ var _useFetchConnectedInt = useEmailDeliveryIntegrationApi.useFetchConnectedIntegration(ownerId),
256
+ connectedIntegration = _useFetchConnectedInt.integration,
257
+ isIntegrationLoading = _useFetchConnectedInt.isLoading;
258
+ var integrationMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, INTEGRATION_TYPES.GMAIL, gmailIntegration), INTEGRATION_TYPES.OUTLOOK, outlookIntegration), INTEGRATION_TYPES.SPARKPOST, sparkpostIntegration), INTEGRATION_TYPES.SMTP, smtpIntegration);
259
+ var currentIntegration = integrationMap[type];
260
+ var isConnected = currentIntegration.isConnected,
261
+ isDestroying = currentIntegration.isDestroying,
262
+ onDisconnect = currentIntegration.onDisconnect,
263
+ _currentIntegration$d = currentIntegration.data,
264
+ data = _currentIntegration$d === void 0 ? {} : _currentIntegration$d,
265
+ errorMessage = currentIntegration.errorMessage;
266
+ var connectedEmail = data === null || data === void 0 ? void 0 : data.email;
267
+ var isOutlookPending = type === INTEGRATION_TYPES.OUTLOOK && outlookIntegration.isWaitingForTestEmail;
268
+ var isSparkpostPending = type === INTEGRATION_TYPES.SPARKPOST && sparkpostIntegration.exists && !isConnected;
269
+ var isPending = isOutlookPending || isSparkpostPending;
270
+ var isLoading = gmailIntegration.isLoading || outlookIntegration.isLoading || sparkpostIntegration.isLoading || smtpIntegration.isLoading || isIntegrationLoading;
271
+ var isBlocked = connectedIntegration && connectedIntegration.type !== type;
272
+ var activeProviderLabel = isBlocked ? PROVIDER_LABELS[connectedIntegration.type] : null;
273
+ var activeProviderRoute = isBlocked ? integrationRoutes === null || integrationRoutes === void 0 ? void 0 : integrationRoutes[connectedIntegration.type] : null;
274
+ var handleConnect = function handleConnect() {
275
+ switch (type) {
276
+ case INTEGRATION_TYPES.GMAIL:
277
+ window.location.href = utils.buildUrl(useSparkpostApi.GMAIL_OAUTH_CONNECT_URL, {
278
+ ownerId: ownerId
279
+ });
280
+ break;
281
+ case INTEGRATION_TYPES.OUTLOOK:
282
+ window.location.href = utils.buildUrl(useSparkpostApi.OUTLOOK_OAUTH_CONNECT_URL, {
283
+ ownerId: ownerId
284
+ });
285
+ break;
286
+ case INTEGRATION_TYPES.SPARKPOST:
287
+ history.push(ownDomainSetupRoute);
288
+ break;
289
+ case INTEGRATION_TYPES.SMTP:
290
+ setIsSmtpPaneOpen(true);
291
+ break;
292
+ }
293
+ };
294
+ var getConnectButtonLabel = function getConnectButtonLabel() {
295
+ switch (type) {
296
+ case INTEGRATION_TYPES.GMAIL:
297
+ return t("neetoEmailDelivery.integrationDetail.connectGmail");
298
+ case INTEGRATION_TYPES.OUTLOOK:
299
+ return t("neetoEmailDelivery.integrationDetail.connectOutlook");
300
+ case INTEGRATION_TYPES.SPARKPOST:
301
+ return t("neetoEmailDelivery.integrationDetail.setupDomain");
302
+ case INTEGRATION_TYPES.SMTP:
303
+ return t("neetoEmailDelivery.integrationDetail.connectSmtp");
304
+ default:
305
+ return "";
306
+ }
307
+ };
308
+ var renderTitle = function renderTitle() {
309
+ if (isConnected) {
310
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
311
+ className: "flex items-center gap-2",
312
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
313
+ children: t("neetoEmailDelivery.integrationDetail.connectedTitle", {
314
+ provider: providerLabel
315
+ })
316
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
317
+ className: "neeto-ui-bg-success-500 neeto-ui-text-white neeto-ui-rounded-full flex items-center justify-center p-1",
318
+ children: /*#__PURE__*/jsxRuntime.jsx(Check, {
319
+ size: 24
320
+ })
321
+ })]
322
+ });
323
+ }
324
+ if (isPending) {
325
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
326
+ className: "flex items-center gap-2",
327
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
328
+ children: t("neetoEmailDelivery.integrationDetail.pendingTitle", {
329
+ provider: providerLabel
330
+ })
331
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
332
+ className: "neeto-ui-text-warning-500 flex items-center justify-center p-1",
333
+ children: /*#__PURE__*/jsxRuntime.jsx(Warning, {
334
+ size: 24
335
+ })
336
+ })]
337
+ });
338
+ }
339
+ return t("neetoEmailDelivery.integrationDetail.connectTitle", {
340
+ appName: appName,
341
+ provider: providerLabel
342
+ });
343
+ };
344
+ var renderActionBlock = function renderActionBlock() {
345
+ if (isConnected) {
346
+ return /*#__PURE__*/jsxRuntime.jsx(Button, {
347
+ "data-testid": "disconnect-button",
348
+ label: t("neetoEmailDelivery.integrationDetail.disconnect"),
349
+ loading: isDestroying,
350
+ style: "danger",
351
+ onClick: onDisconnect
352
+ });
353
+ }
354
+ if (isPending) {
355
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
356
+ className: "flex items-center gap-2",
357
+ children: [isSparkpostPending && /*#__PURE__*/jsxRuntime.jsx(Button, {
358
+ "data-testid": "continue-verification-button",
359
+ to: ownDomainVerifyRoute,
360
+ label: t("neetoEmailDelivery.sparkpost.emailDelivery.continueVerification")
361
+ }), /*#__PURE__*/jsxRuntime.jsx(Button, {
362
+ "data-testid": "disconnect-button",
363
+ label: t("neetoEmailDelivery.integrationDetail.disconnect"),
364
+ loading: isDestroying,
365
+ style: "danger",
366
+ onClick: onDisconnect
367
+ })]
368
+ });
369
+ }
370
+ if (isBlocked) return null;
371
+ return /*#__PURE__*/jsxRuntime.jsx(Button, {
372
+ "data-testid": "connect-button",
373
+ label: getConnectButtonLabel(),
374
+ style: "primary",
375
+ onClick: handleConnect
376
+ });
377
+ };
378
+ if (isLoading) {
379
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
380
+ className: "flex grow items-center justify-center w-full",
381
+ children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
382
+ });
383
+ }
384
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
385
+ children: [/*#__PURE__*/jsxRuntime.jsxs(CardLayout, {
386
+ actionBlock: renderActionBlock(),
387
+ icon: /*#__PURE__*/jsxRuntime.jsx(Icon, {
388
+ size: 48
389
+ }),
390
+ title: renderTitle(),
391
+ description: isConnected ? /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
392
+ components: {
393
+ bold: /*#__PURE__*/jsxRuntime.jsx("strong", {})
394
+ },
395
+ i18nKey: "neetoEmailDelivery.integrationDetail.connectedEmail",
396
+ values: {
397
+ email: connectedEmail
398
+ }
399
+ }) : description,
400
+ children: [(isConnected ? connectedScopeText || scopeText : scopeText) && /*#__PURE__*/jsxRuntime.jsx(Typography, {
401
+ style: "body1",
402
+ children: isConnected ? connectedScopeText || scopeText : scopeText
403
+ }), !isConnected && helpArticleUrl && /*#__PURE__*/jsxRuntime.jsx(Typography, {
404
+ className: "my-2",
405
+ style: "body2",
406
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
407
+ i18nKey: "neetoEmailDelivery.integrationDetail.helpArticleText",
408
+ values: {
409
+ provider: providerLabel
410
+ },
411
+ components: {
412
+ helpLink: /*#__PURE__*/jsxRuntime.jsx(Button, {
413
+ "data-testid": "help-doc-link",
414
+ href: helpArticleUrl,
415
+ style: "link",
416
+ target: "_blank"
417
+ })
418
+ }
419
+ })
420
+ }), !isConnected && !isPending && isBlocked && /*#__PURE__*/jsxRuntime.jsx(Callout, {
421
+ style: connectedIntegration.isPending ? "warning" : "danger",
422
+ children: /*#__PURE__*/jsxRuntime.jsx("p", {
423
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
424
+ components: {
425
+ disconnectLink: /*#__PURE__*/jsxRuntime.jsx(Button, {
426
+ "data-testid": "disconnect-link",
427
+ href: activeProviderRoute,
428
+ style: "link"
429
+ })
430
+ },
431
+ i18nKey: connectedIntegration.isPending ? "neetoEmailDelivery.integrationDetail.pendingIntegrationBlocked" : "neetoEmailDelivery.integrationDetail.onlyOneIntegration",
432
+ values: {
433
+ activeProvider: activeProviderLabel,
434
+ targetProvider: providerLabel
435
+ }
436
+ })
437
+ })
438
+ }), errorMessage && /*#__PURE__*/jsxRuntime.jsx(Callout, {
439
+ style: "danger",
440
+ children: errorMessage
441
+ }), isOutlookPending && /*#__PURE__*/jsxRuntime.jsx(Callout, {
442
+ style: "warning",
443
+ children: t("neetoEmailDelivery.outlook.waitingForTestEmail", {
444
+ email: connectedEmail
445
+ })
446
+ }), isSparkpostPending && /*#__PURE__*/jsxRuntime.jsx(Callout, {
447
+ style: "warning",
448
+ children: t("neetoEmailDelivery.sparkpost.emailDelivery.verificationPending", {
449
+ domain: data === null || data === void 0 ? void 0 : data.domain
450
+ })
451
+ })]
452
+ }), type === INTEGRATION_TYPES.SMTP && /*#__PURE__*/jsxRuntime.jsx(SmtpSetup, {
453
+ ownerId: ownerId,
454
+ isOpen: isSmtpPaneOpen,
455
+ onCancel: function onCancel() {
456
+ return setIsSmtpPaneOpen(false);
457
+ },
458
+ onDone: function onDone() {
459
+ return setIsSmtpPaneOpen(false);
460
+ }
461
+ })]
462
+ });
463
+ };
47
464
 
48
- exports.EmailDeliveryScreen = EmailDeliveryScreen;
465
+ exports.EmailDeliveryScreen = EmailDeliveryScreen.EmailDeliveryScreen;
49
466
  exports.SparkpostDomainSetup = SparkpostDomainSetup;
50
467
  exports.SparkpostDomainVerify = SparkpostDomainVerify;
468
+ exports.IntegrationDetailPage = IntegrationDetailPage;
51
469
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../app/javascript/src/components/Smtp/constants.js","../../app/javascript/src/components/Smtp/Setup.jsx","../../app/javascript/src/components/IntegrationDetailPage/constants.js","../../app/javascript/src/components/IntegrationDetailPage/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const ENCRYPTION_OPTIONS = [\n { label: \"None\", value: \"none\" },\n { label: \"StartTLS\", value: \"starttls\" },\n { label: \"SSL\", value: \"ssl\" },\n];\n\nexport const SMTP_ACCOUNT_INITIAL_VALUES = {\n host: \"\",\n port: 587,\n username: \"\",\n password: \"\",\n email: \"\",\n encryption: \"starttls\",\n displayName: \"\",\n};\n\nexport const SMTP_ACCOUNT_VALIDATION_SCHEMA = yup.object().shape({\n host: yup\n .string()\n .trim()\n .required(\n t(\"neetoEmailDelivery.smtp.setup.requiredField\", {\n field: t(\"neetoEmailDelivery.smtp.setup.hostLabel\"),\n })\n ),\n port: yup.number().required(\n t(\"neetoEmailDelivery.smtp.setup.requiredField\", {\n field: t(\"neetoEmailDelivery.smtp.setup.portLabel\"),\n })\n ),\n username: yup\n .string()\n .trim()\n .required(\n t(\"neetoEmailDelivery.smtp.setup.requiredField\", {\n field: t(\"neetoEmailDelivery.smtp.setup.usernameLabel\"),\n })\n ),\n password: yup\n .string()\n .trim()\n .required(\n t(\"neetoEmailDelivery.smtp.setup.requiredField\", {\n field: t(\"neetoEmailDelivery.smtp.setup.passwordLabel\"),\n })\n ),\n email: yup\n .string()\n .trim()\n .required(\n t(\"neetoEmailDelivery.smtp.setup.requiredField\", {\n field: t(\"neetoEmailDelivery.smtp.setup.emailLabel\"),\n })\n )\n .email(t(\"neetoEmailDelivery.smtp.setup.emailInvalid\")),\n displayName: yup\n .string()\n .trim()\n .required(\n t(\"neetoEmailDelivery.smtp.setup.requiredField\", {\n field: t(\"neetoEmailDelivery.smtp.setup.displayNameLabel\"),\n })\n ),\n encryption: yup\n .string()\n .trim()\n .required(\n t(\"neetoEmailDelivery.smtp.setup.requiredField\", {\n field: t(\"neetoEmailDelivery.smtp.setup.encryptionLabel\"),\n })\n ),\n});\n","import { Callout, Pane, Typography } from \"neetoui\";\nimport { Form, Input, Radio, ActionBlock } from \"neetoui/formik\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateSmtp } from \"hooks/reactQuery/integrations/useSmtpIntegrationApi\";\n\nimport {\n SMTP_ACCOUNT_INITIAL_VALUES,\n SMTP_ACCOUNT_VALIDATION_SCHEMA,\n ENCRYPTION_OPTIONS,\n} from \"./constants\";\n\nconst SmtpSetup = ({ ownerId, onDone, onCancel, isOpen }) => {\n const { t } = useTranslation();\n\n const { isPending: isCreating, mutate: createSmtp } = useCreateSmtp({\n ownerId,\n });\n\n const handleSubmit = values => {\n createSmtp({ smtp_account: values }, { onSuccess: onDone });\n };\n\n return (\n <Pane {...{ isOpen }} size=\"lg\" onClose={onCancel}>\n <Pane.Header>\n <Typography style=\"h2\" weight=\"semibold\">\n {t(\"neetoEmailDelivery.smtp.setup.title\")}\n </Typography>\n </Pane.Header>\n <Form\n className=\"w-full\"\n formikProps={{\n initialValues: SMTP_ACCOUNT_INITIAL_VALUES,\n validationSchema: SMTP_ACCOUNT_VALIDATION_SCHEMA,\n onSubmit: handleSubmit,\n }}\n >\n <Pane.Body className=\"space-y-4\">\n <div className=\"flex flex-col gap-6\">\n <Callout style=\"warning\">\n {t(\"neetoEmailDelivery.smtp.setup.note\")}\n </Callout>\n <Input\n required\n label={t(\"neetoEmailDelivery.smtp.setup.hostLabel\")}\n name=\"host\"\n />\n <Input\n required\n label={t(\"neetoEmailDelivery.smtp.setup.portLabel\")}\n name=\"port\"\n type=\"number\"\n />\n <Input\n required\n label={t(\"neetoEmailDelivery.smtp.setup.usernameLabel\")}\n name=\"username\"\n />\n <Input\n required\n label={t(\"neetoEmailDelivery.smtp.setup.passwordLabel\")}\n name=\"password\"\n type=\"password\"\n />\n <Input\n required\n label={t(\"neetoEmailDelivery.smtp.setup.emailLabel\")}\n name=\"email\"\n type=\"email\"\n />\n <Input\n required\n label={t(\"neetoEmailDelivery.smtp.setup.displayNameLabel\")}\n name=\"displayName\"\n />\n <Radio\n label={t(\"neetoEmailDelivery.smtp.setup.encryptionLabel\")}\n name=\"encryption\"\n >\n {ENCRYPTION_OPTIONS.map(option => (\n <Radio.Item\n key={option.value}\n label={option.label}\n value={option.value}\n />\n ))}\n </Radio>\n </div>\n </Pane.Body>\n <Pane.Footer>\n <ActionBlock\n cancelButtonProps={{ onClick: onCancel }}\n isSubmitting={isCreating}\n submitButtonProps={{\n label: t(\"neetoEmailDelivery.smtp.setup.saveAndActivate\"),\n }}\n />\n </Pane.Footer>\n </Form>\n </Pane>\n );\n};\n\nexport default SmtpSetup;\n","import { MailSend } from \"neetoicons\";\nimport { Gmail as GmailIcon, Outlook as OutlookIcon } from \"neetoicons/misc\";\n\nexport const INTEGRATION_TYPES = {\n GMAIL: \"gmail\",\n OUTLOOK: \"outlook\",\n SPARKPOST: \"sparkpost\",\n SMTP: \"smtp\",\n};\n\nexport const PROVIDER_LABELS = {\n [INTEGRATION_TYPES.GMAIL]: \"Gmail\",\n [INTEGRATION_TYPES.OUTLOOK]: \"Outlook\",\n [INTEGRATION_TYPES.SPARKPOST]: \"Custom email provider\",\n [INTEGRATION_TYPES.SMTP]: \"SMTP\",\n};\n\nexport const PROVIDER_ICONS = {\n [INTEGRATION_TYPES.GMAIL]: GmailIcon,\n [INTEGRATION_TYPES.OUTLOOK]: OutlookIcon,\n [INTEGRATION_TYPES.SPARKPOST]: MailSend,\n [INTEGRATION_TYPES.SMTP]: MailSend,\n};\n","import { useState } from \"react\";\n\nimport { buildUrl } from \"neetocommons/utils\";\nimport { Check, Warning } from \"neetoicons\";\nimport CardLayout from \"neetomolecules/CardLayout\";\nimport { Button, Callout, Spinner, Typography } from \"neetoui\";\nimport { Trans, useTranslation } from \"react-i18next\";\nimport { useHistory } from \"react-router-dom\";\n\nimport {\n GMAIL_OAUTH_CONNECT_URL,\n OUTLOOK_OAUTH_CONNECT_URL,\n} from \"apis/integrations/constants\";\nimport SmtpSetup from \"components/Smtp/Setup\";\nimport useGmail from \"hooks/integrations/useGmail\";\nimport useOutlook from \"hooks/integrations/useOutlook\";\nimport useSmtp from \"hooks/integrations/useSmtp\";\nimport useSparkpostDomain from \"hooks/integrations/useSparkpostDomain\";\nimport { useFetchConnectedIntegration } from \"hooks/reactQuery/integrations/useEmailDeliveryIntegrationApi\";\n\nimport {\n INTEGRATION_TYPES,\n PROVIDER_LABELS,\n PROVIDER_ICONS,\n} from \"./constants\";\n\nconst IntegrationDetailPage = ({\n type,\n ownerId,\n canManageIntegrations,\n appName,\n scopeText,\n connectedScopeText,\n helpArticleUrl,\n indexRoute,\n integrationRoutes,\n ownDomainSetupRoute,\n ownDomainVerifyRoute,\n}) => {\n const { t } = useTranslation();\n const history = useHistory();\n const [isSmtpPaneOpen, setIsSmtpPaneOpen] = useState(false);\n\n const providerLabel = PROVIDER_LABELS[type];\n const Icon = PROVIDER_ICONS[type];\n const description = t(`neetoEmailDelivery.${type}.description`);\n\n const gmailIntegration = useGmail({\n ownerId,\n indexRoute,\n canManageIntegrations,\n });\n\n const outlookIntegration = useOutlook({\n ownerId,\n indexRoute,\n canManageIntegrations,\n });\n\n const sparkpostIntegration = useSparkpostDomain({\n ownerId,\n canManageIntegrations,\n });\n\n const smtpIntegration = useSmtp({ ownerId, canManageIntegrations });\n\n const { integration: connectedIntegration, isLoading: isIntegrationLoading } =\n useFetchConnectedIntegration(ownerId);\n\n const integrationMap = {\n [INTEGRATION_TYPES.GMAIL]: gmailIntegration,\n [INTEGRATION_TYPES.OUTLOOK]: outlookIntegration,\n [INTEGRATION_TYPES.SPARKPOST]: sparkpostIntegration,\n [INTEGRATION_TYPES.SMTP]: smtpIntegration,\n };\n\n const currentIntegration = integrationMap[type];\n const {\n isConnected,\n isDestroying,\n onDisconnect,\n data = {},\n errorMessage,\n } = currentIntegration;\n\n const connectedEmail = data?.email;\n\n const isOutlookPending =\n type === INTEGRATION_TYPES.OUTLOOK &&\n outlookIntegration.isWaitingForTestEmail;\n\n const isSparkpostPending =\n type === INTEGRATION_TYPES.SPARKPOST &&\n sparkpostIntegration.exists &&\n !isConnected;\n\n const isPending = isOutlookPending || isSparkpostPending;\n\n const isLoading =\n gmailIntegration.isLoading ||\n outlookIntegration.isLoading ||\n sparkpostIntegration.isLoading ||\n smtpIntegration.isLoading ||\n isIntegrationLoading;\n\n const isBlocked = connectedIntegration && connectedIntegration.type !== type;\n\n const activeProviderLabel = isBlocked\n ? PROVIDER_LABELS[connectedIntegration.type]\n : null;\n\n const activeProviderRoute = isBlocked\n ? integrationRoutes?.[connectedIntegration.type]\n : null;\n\n const handleConnect = () => {\n switch (type) {\n case INTEGRATION_TYPES.GMAIL:\n window.location.href = buildUrl(GMAIL_OAUTH_CONNECT_URL, { ownerId });\n break;\n case INTEGRATION_TYPES.OUTLOOK:\n window.location.href = buildUrl(OUTLOOK_OAUTH_CONNECT_URL, {\n ownerId,\n });\n break;\n case INTEGRATION_TYPES.SPARKPOST:\n history.push(ownDomainSetupRoute);\n break;\n case INTEGRATION_TYPES.SMTP:\n setIsSmtpPaneOpen(true);\n break;\n default:\n break;\n }\n };\n\n const getConnectButtonLabel = () => {\n switch (type) {\n case INTEGRATION_TYPES.GMAIL:\n return t(\"neetoEmailDelivery.integrationDetail.connectGmail\");\n case INTEGRATION_TYPES.OUTLOOK:\n return t(\"neetoEmailDelivery.integrationDetail.connectOutlook\");\n case INTEGRATION_TYPES.SPARKPOST:\n return t(\"neetoEmailDelivery.integrationDetail.setupDomain\");\n case INTEGRATION_TYPES.SMTP:\n return t(\"neetoEmailDelivery.integrationDetail.connectSmtp\");\n default:\n return \"\";\n }\n };\n\n const renderTitle = () => {\n if (isConnected) {\n return (\n <div className=\"flex items-center gap-2\">\n <span>\n {t(\"neetoEmailDelivery.integrationDetail.connectedTitle\", {\n provider: providerLabel,\n })}\n </span>\n <div className=\"neeto-ui-bg-success-500 neeto-ui-text-white neeto-ui-rounded-full flex items-center justify-center p-1\">\n <Check size={24} />\n </div>\n </div>\n );\n }\n\n if (isPending) {\n return (\n <div className=\"flex items-center gap-2\">\n <span>\n {t(\"neetoEmailDelivery.integrationDetail.pendingTitle\", {\n provider: providerLabel,\n })}\n </span>\n <div className=\"neeto-ui-text-warning-500 flex items-center justify-center p-1\">\n <Warning size={24} />\n </div>\n </div>\n );\n }\n\n return t(\"neetoEmailDelivery.integrationDetail.connectTitle\", {\n appName,\n provider: providerLabel,\n });\n };\n\n const renderActionBlock = () => {\n if (isConnected) {\n return (\n <Button\n data-testid=\"disconnect-button\"\n label={t(\"neetoEmailDelivery.integrationDetail.disconnect\")}\n loading={isDestroying}\n style=\"danger\"\n onClick={onDisconnect}\n />\n );\n }\n\n if (isPending) {\n return (\n <div className=\"flex items-center gap-2\">\n {isSparkpostPending && (\n <Button\n data-testid=\"continue-verification-button\"\n to={ownDomainVerifyRoute}\n label={t(\n \"neetoEmailDelivery.sparkpost.emailDelivery.continueVerification\"\n )}\n />\n )}\n <Button\n data-testid=\"disconnect-button\"\n label={t(\"neetoEmailDelivery.integrationDetail.disconnect\")}\n loading={isDestroying}\n style=\"danger\"\n onClick={onDisconnect}\n />\n </div>\n );\n }\n\n if (isBlocked) return null;\n\n return (\n <Button\n data-testid=\"connect-button\"\n label={getConnectButtonLabel()}\n style=\"primary\"\n onClick={handleConnect}\n />\n );\n };\n\n if (isLoading) {\n return (\n <div className=\"flex grow items-center justify-center w-full\">\n <Spinner />\n </div>\n );\n }\n\n return (\n <>\n <CardLayout\n actionBlock={renderActionBlock()}\n icon={<Icon size={48} />}\n title={renderTitle()}\n description={\n isConnected ? (\n <Trans\n components={{ bold: <strong /> }}\n i18nKey=\"neetoEmailDelivery.integrationDetail.connectedEmail\"\n values={{ email: connectedEmail }}\n />\n ) : (\n description\n )\n }\n >\n {(isConnected ? connectedScopeText || scopeText : scopeText) && (\n <Typography style=\"body1\">\n {isConnected ? connectedScopeText || scopeText : scopeText}\n </Typography>\n )}\n {!isConnected && helpArticleUrl && (\n <Typography className=\"my-2\" style=\"body2\">\n <Trans\n i18nKey=\"neetoEmailDelivery.integrationDetail.helpArticleText\"\n values={{ provider: providerLabel }}\n components={{\n helpLink: (\n <Button\n data-testid=\"help-doc-link\"\n href={helpArticleUrl}\n style=\"link\"\n target=\"_blank\"\n />\n ),\n }}\n />\n </Typography>\n )}\n {!isConnected && !isPending && isBlocked && (\n <Callout\n style={connectedIntegration.isPending ? \"warning\" : \"danger\"}\n >\n <p>\n <Trans\n components={{\n disconnectLink: (\n <Button\n data-testid=\"disconnect-link\"\n href={activeProviderRoute}\n style=\"link\"\n />\n ),\n }}\n i18nKey={\n connectedIntegration.isPending\n ? \"neetoEmailDelivery.integrationDetail.pendingIntegrationBlocked\"\n : \"neetoEmailDelivery.integrationDetail.onlyOneIntegration\"\n }\n values={{\n activeProvider: activeProviderLabel,\n targetProvider: providerLabel,\n }}\n />\n </p>\n </Callout>\n )}\n {errorMessage && <Callout style=\"danger\">{errorMessage}</Callout>}\n {isOutlookPending && (\n <Callout style=\"warning\">\n {t(\"neetoEmailDelivery.outlook.waitingForTestEmail\", {\n email: connectedEmail,\n })}\n </Callout>\n )}\n {isSparkpostPending && (\n <Callout style=\"warning\">\n {t(\n \"neetoEmailDelivery.sparkpost.emailDelivery.verificationPending\",\n { domain: data?.domain }\n )}\n </Callout>\n )}\n </CardLayout>\n {type === INTEGRATION_TYPES.SMTP && (\n <SmtpSetup\n {...{ ownerId }}\n isOpen={isSmtpPaneOpen}\n onCancel={() => setIsSmtpPaneOpen(false)}\n onDone={() => setIsSmtpPaneOpen(false)}\n />\n )}\n </>\n );\n};\n\nexport default IntegrationDetailPage;\n"],"names":["ENCRYPTION_OPTIONS","label","value","SMTP_ACCOUNT_INITIAL_VALUES","host","port","username","password","email","encryption","displayName","SMTP_ACCOUNT_VALIDATION_SCHEMA","yup","object","shape","string","trim","required","t","field","number","SmtpSetup","_ref","ownerId","onDone","onCancel","isOpen","_useTranslation","useTranslation","_useCreateSmtp","useCreateSmtp","isCreating","isPending","createSmtp","mutate","handleSubmit","values","smtp_account","onSuccess","_jsxs","Pane","size","onClose","children","_jsx","Header","Typography","style","weight","Form","className","formikProps","initialValues","validationSchema","onSubmit","Body","Callout","Input","name","type","Radio","map","option","Item","Footer","ActionBlock","cancelButtonProps","onClick","isSubmitting","submitButtonProps","INTEGRATION_TYPES","GMAIL","OUTLOOK","SPARKPOST","SMTP","PROVIDER_LABELS","_defineProperty","PROVIDER_ICONS","GmailIcon","OutlookIcon","MailSend","IntegrationDetailPage","canManageIntegrations","appName","scopeText","connectedScopeText","helpArticleUrl","indexRoute","integrationRoutes","ownDomainSetupRoute","ownDomainVerifyRoute","history","useHistory","_useState","useState","_useState2","_slicedToArray","isSmtpPaneOpen","setIsSmtpPaneOpen","providerLabel","Icon","description","concat","gmailIntegration","useGmail","outlookIntegration","useOutlook","sparkpostIntegration","useSparkpostDomain","smtpIntegration","useSmtp","_useFetchConnectedInt","useFetchConnectedIntegration","connectedIntegration","integration","isIntegrationLoading","isLoading","integrationMap","currentIntegration","isConnected","isDestroying","onDisconnect","_currentIntegration$d","data","errorMessage","connectedEmail","isOutlookPending","isWaitingForTestEmail","isSparkpostPending","exists","isBlocked","activeProviderLabel","activeProviderRoute","handleConnect","window","location","href","buildUrl","GMAIL_OAUTH_CONNECT_URL","OUTLOOK_OAUTH_CONNECT_URL","push","getConnectButtonLabel","renderTitle","provider","Check","Warning","renderActionBlock","Button","loading","to","Spinner","_Fragment","CardLayout","actionBlock","icon","title","Trans","components","bold","i18nKey","helpLink","target","disconnectLink","activeProvider","targetProvider","domain"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,kBAAkB,GAAG,CAChC;AAAEC,EAAAA,KAAK,EAAE,MAAM;AAAEC,EAAAA,KAAK,EAAE;AAAO,CAAC,EAChC;AAAED,EAAAA,KAAK,EAAE,UAAU;AAAEC,EAAAA,KAAK,EAAE;AAAW,CAAC,EACxC;AAAED,EAAAA,KAAK,EAAE,KAAK;AAAEC,EAAAA,KAAK,EAAE;AAAM,CAAC,CAC/B;AAEM,IAAMC,2BAA2B,GAAG;AACzCC,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,IAAI,EAAE,GAAG;AACTC,EAAAA,QAAQ,EAAE,EAAE;AACZC,EAAAA,QAAQ,EAAE,EAAE;AACZC,EAAAA,KAAK,EAAE,EAAE;AACTC,EAAAA,UAAU,EAAE,UAAU;AACtBC,EAAAA,WAAW,EAAE;AACf,CAAC;AAEM,IAAMC,8BAA8B,GAAGC,cAAG,CAACC,MAAM,EAAE,CAACC,KAAK,CAAC;AAC/DV,EAAAA,IAAI,EAAEQ,cAAG,CACNG,MAAM,EAAE,CACRC,IAAI,EAAE,CACNC,QAAQ,CACPC,SAAC,CAAC,6CAA6C,EAAE;IAC/CC,KAAK,EAAED,SAAC,CAAC,yCAAyC;AACpD,GAAC,CACH,CAAC;AACHb,EAAAA,IAAI,EAAEO,cAAG,CAACQ,MAAM,EAAE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E,QAAQ,EAAE,SAAVA,QAAQA,GAAA;QAAA,OAAQyE,iBAAiB,CAAC,KAAK,CAAC;OAAC;MACzC1E,MAAM,EAAE,SAARA,MAAMA,GAAA;QAAA,OAAQ0E,iBAAiB,CAAC,KAAK,CAAC;AAAA;AAAC,KACxC,CACF;AAAA,GACD,CAAC;AAEP;;;;;;;"}
package/dist/hooks.js CHANGED
@@ -1,55 +1,11 @@
1
- import { existsBy } from '@bigbinary/neeto-cist';
2
- import { pluck } from 'ramda';
3
- import { u as useFetchGmail, a as useFetchOutlook, b as useFetchSmtp } from './useOutlookIntegrationApi-b_mNVfRE.js';
4
- import { u as useFetchSparkpostDomain } from './useSparkpostApi-qpRhsK7H.js';
1
+ export { u as useFetchConnectedIntegration } from './useEmailDeliveryIntegrationApi-NUL8d1xC.js';
2
+ import '@bigbinary/neeto-cist';
3
+ import 'ramda';
4
+ import './useSparkpostApi-tYImubXZ.js';
5
5
  import '@babel/runtime/helpers/defineProperty';
6
6
  import '@tanstack/react-query';
7
7
  import '@bigbinary/neeto-commons-frontend/react-utils';
8
8
  import 'axios';
9
9
  import '@bigbinary/neeto-commons-frontend/utils';
10
10
  import '@babel/runtime/helpers/slicedToArray';
11
-
12
- var useFetchConnectedIntegration = function useFetchConnectedIntegration(ownerId) {
13
- var _connectedIntegration;
14
- var gmail = useFetchGmail(ownerId);
15
- var outlook = useFetchOutlook(ownerId);
16
- var sparkpost = useFetchSparkpostDomain(ownerId);
17
- var smtp = useFetchSmtp(ownerId);
18
- var integrations = [{
19
- type: "gmail",
20
- hook: gmail
21
- }, {
22
- type: "outlook",
23
- hook: outlook
24
- }, {
25
- type: "sparkpost",
26
- hook: sparkpost
27
- }, {
28
- type: "smtp",
29
- hook: smtp
30
- }];
31
- var hooks = pluck("hook", integrations);
32
- var isLoading = existsBy({
33
- isLoading: true
34
- }, hooks);
35
- var isError = existsBy({
36
- isError: true
37
- }, hooks);
38
- var connectedIntegration = integrations.find(function (_ref) {
39
- var _hook$data;
40
- var hook = _ref.hook;
41
- return hook.isSuccess && (hook === null || hook === void 0 || (_hook$data = hook.data) === null || _hook$data === void 0 ? void 0 : _hook$data.connected);
42
- });
43
- var integration = connectedIntegration ? {
44
- type: connectedIntegration.type,
45
- data: (_connectedIntegration = connectedIntegration.hook) === null || _connectedIntegration === void 0 ? void 0 : _connectedIntegration.data
46
- } : null;
47
- return {
48
- integration: integration,
49
- isLoading: isLoading,
50
- isError: isError
51
- };
52
- };
53
-
54
- export { useFetchConnectedIntegration };
55
11
  //# sourceMappingURL=hooks.js.map
package/dist/hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sources":["../app/javascript/src/hooks/reactQuery/integrations/useEmailDeliveryIntegrationApi.js"],"sourcesContent":["import { existsBy } from \"neetocist\";\nimport { pluck } from \"ramda\";\n\nimport { useFetchGmail } from \"./useGmailIntegrationApi\";\nimport { useFetchOutlook } from \"./useOutlookIntegrationApi\";\nimport { useFetchSmtp } from \"./useSmtpIntegrationApi\";\nimport { useFetchSparkpostDomain } from \"./useSparkpostApi\";\n\nexport const useFetchConnectedIntegration = ownerId => {\n const gmail = useFetchGmail(ownerId);\n const outlook = useFetchOutlook(ownerId);\n const sparkpost = useFetchSparkpostDomain(ownerId);\n const smtp = useFetchSmtp(ownerId);\n\n const integrations = [\n { type: \"gmail\", hook: gmail },\n { type: \"outlook\", hook: outlook },\n { type: \"sparkpost\", hook: sparkpost },\n { type: \"smtp\", hook: smtp },\n ];\n\n const hooks = pluck(\"hook\", integrations);\n\n const isLoading = existsBy({ isLoading: true }, hooks);\n const isError = existsBy({ isError: true }, hooks);\n\n const connectedIntegration = integrations.find(\n ({ hook }) => hook.isSuccess && hook?.data?.connected\n );\n\n const integration = connectedIntegration\n ? {\n type: connectedIntegration.type,\n data: connectedIntegration.hook?.data,\n }\n : null;\n\n return { integration, isLoading, isError };\n};\n"],"names":["useFetchConnectedIntegration","ownerId","_connectedIntegration","gmail","useFetchGmail","outlook","useFetchOutlook","sparkpost","useFetchSparkpostDomain","smtp","useFetchSmtp","integrations","type","hook","hooks","pluck","isLoading","existsBy","isError","connectedIntegration","find","_ref","_hook$data","isSuccess","data","connected","integration"],"mappings":";;;;;;;;;;;IAQaA,4BAA4B,GAAG,SAA/BA,4BAA4BA,CAAGC,OAAO,EAAI;AAAA,EAAA,IAAAC,qBAAA;AACrD,EAAA,IAAMC,KAAK,GAAGC,aAAa,CAACH,OAAO,CAAC;AACpC,EAAA,IAAMI,OAAO,GAAGC,eAAe,CAACL,OAAO,CAAC;AACxC,EAAA,IAAMM,SAAS,GAAGC,uBAAuB,CAACP,OAAO,CAAC;AAClD,EAAA,IAAMQ,IAAI,GAAGC,YAAY,CAACT,OAAO,CAAC;EAElC,IAAMU,YAAY,GAAG,CACnB;AAAEC,IAAAA,IAAI,EAAE,OAAO;AAAEC,IAAAA,IAAI,EAAEV;AAAM,GAAC,EAC9B;AAAES,IAAAA,IAAI,EAAE,SAAS;AAAEC,IAAAA,IAAI,EAAER;AAAQ,GAAC,EAClC;AAAEO,IAAAA,IAAI,EAAE,WAAW;AAAEC,IAAAA,IAAI,EAAEN;AAAU,GAAC,EACtC;AAAEK,IAAAA,IAAI,EAAE,MAAM;AAAEC,IAAAA,IAAI,EAAEJ;AAAK,GAAC,CAC7B;AAED,EAAA,IAAMK,KAAK,GAAGC,KAAK,CAAC,MAAM,EAAEJ,YAAY,CAAC;EAEzC,IAAMK,SAAS,GAAGC,QAAQ,CAAC;AAAED,IAAAA,SAAS,EAAE;GAAM,EAAEF,KAAK,CAAC;EACtD,IAAMI,OAAO,GAAGD,QAAQ,CAAC;AAAEC,IAAAA,OAAO,EAAE;GAAM,EAAEJ,KAAK,CAAC;AAElD,EAAA,IAAMK,oBAAoB,GAAGR,YAAY,CAACS,IAAI,CAC5C,UAAAC,IAAA,EAAA;AAAA,IAAA,IAAAC,UAAA;AAAA,IAAA,IAAGT,IAAI,GAAAQ,IAAA,CAAJR,IAAI;AAAA,IAAA,OAAOA,IAA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