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

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 +16 -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 +424 -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 +408 -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/index.js CHANGED
@@ -1,38 +1,42 @@
1
- export { default as EmailDeliveryScreen } from './EmailDeliveryScreen.js';
1
+ import { u as useGmail, a as useOutlook, b as useSmtp } from './index-BKKcEEt1.js';
2
+ export { E as EmailDeliveryScreen } from './index-BKKcEEt1.js';
3
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
+ import { useState } from 'react';
6
+ import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
7
+ import CheckCircle from '@bigbinary/neeto-icons/CheckCircle';
8
+ import CardLayout from '@bigbinary/neeto-molecules/CardLayout';
9
+ import Button from '@bigbinary/neetoui/Button';
10
+ import Callout from '@bigbinary/neetoui/Callout';
11
+ import Spinner from '@bigbinary/neetoui/Spinner';
12
+ import Typography from '@bigbinary/neetoui/Typography';
13
+ import { useTranslation, Trans } from 'react-i18next';
14
+ import { useHistory, Link } from 'react-router-dom';
15
+ import { g as useCreateSmtp, O as OUTLOOK_OAUTH_CONNECT_URL, G as GMAIL_OAUTH_CONNECT_URL } from './useSparkpostApi-tYImubXZ.js';
16
+ import Pane from '@bigbinary/neetoui/Pane';
17
+ import Form from '@bigbinary/neetoui/formik/Form';
18
+ import Input from '@bigbinary/neetoui/formik/Input';
19
+ import Radio from '@bigbinary/neetoui/formik/Radio';
20
+ import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
21
+ import { t } from 'i18next';
22
+ import * as yup from 'yup';
23
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
24
+ import { u as useSparkpostDomain } from './useSparkpostDomain-CmX8ka38.js';
25
+ import { u as useFetchConnectedIntegration } from './useEmailDeliveryIntegrationApi-NUL8d1xC.js';
26
+ import MailSend from '@bigbinary/neeto-icons/MailSend';
27
+ import GmailIcon from '@bigbinary/neeto-icons/misc/Gmail';
28
+ import OutlookIcon from '@bigbinary/neeto-icons/misc/Outlook';
2
29
  export { default as SparkpostDomainSetup } from './SparkpostDomainSetup.js';
3
30
  export { default as SparkpostDomainVerify } from './SparkpostDomainVerify.js';
4
- import '@babel/runtime/helpers/slicedToArray';
5
- import 'react';
6
31
  import '@bigbinary/neeto-cist';
7
32
  import '@bigbinary/neeto-commons-frontend/react-utils';
8
- import '@bigbinary/neeto-commons-frontend/utils';
9
- import '@bigbinary/neeto-icons/MailSend';
10
- import '@bigbinary/neeto-icons/misc/Gmail';
11
- import '@bigbinary/neeto-icons/misc/Outlook';
12
- import '@bigbinary/neetoui/Spinner';
13
- import '@bigbinary/neetoui/Callout';
14
33
  import '@bigbinary/neetoui/Toastr';
15
- import 'ramda';
16
- import 'react-i18next';
17
- import 'react-router-dom';
18
- import './useSparkpostApi-qpRhsK7H.js';
19
- import '@babel/runtime/helpers/defineProperty';
20
34
  import '@tanstack/react-query';
21
- import 'axios';
22
- import '@bigbinary/neetoui/Pane';
23
- import '@bigbinary/neetoui/Typography';
24
- import '@bigbinary/neetoui/formik/Form';
25
- import '@bigbinary/neetoui/formik/Input';
26
- import '@bigbinary/neetoui/formik/Radio';
27
- import '@bigbinary/neetoui/formik/ActionBlock';
28
- import './useOutlookIntegrationApi-b_mNVfRE.js';
29
- import 'i18next';
30
- import 'yup';
31
- import 'react/jsx-runtime';
32
- import './useSparkpostDomain-De-Fz3ek.js';
33
- import '@bigbinary/neetoui/Button';
35
+ import '@bigbinary/neeto-icons/Check';
36
+ import '@bigbinary/neeto-icons/Warning';
34
37
  import '@bigbinary/neetoui/Tag';
35
- import '@bigbinary/neeto-molecules/CardLayout';
38
+ import 'axios';
39
+ import 'ramda';
36
40
  import './constants-DbB8UFcr.js';
37
41
  import '@babel/runtime/helpers/objectWithoutProperties';
38
42
  import 'classnames';
@@ -40,4 +44,380 @@ import '@bigbinary/neeto-molecules/Container';
40
44
  import '@bigbinary/neeto-molecules/Header';
41
45
  import '@babel/runtime/helpers/toConsumableArray';
42
46
  import '@bigbinary/neeto-molecules/CopyToClipboardButton';
47
+
48
+ var ENCRYPTION_OPTIONS = [{
49
+ label: "None",
50
+ value: "none"
51
+ }, {
52
+ label: "StartTLS",
53
+ value: "starttls"
54
+ }, {
55
+ label: "SSL",
56
+ value: "ssl"
57
+ }];
58
+ var SMTP_ACCOUNT_INITIAL_VALUES = {
59
+ host: "",
60
+ port: 587,
61
+ username: "",
62
+ password: "",
63
+ email: "",
64
+ encryption: "starttls",
65
+ displayName: ""
66
+ };
67
+ var SMTP_ACCOUNT_VALIDATION_SCHEMA = yup.object().shape({
68
+ host: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
69
+ field: t("neetoEmailDelivery.smtp.setup.hostLabel")
70
+ })),
71
+ port: yup.number().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
72
+ field: t("neetoEmailDelivery.smtp.setup.portLabel")
73
+ })),
74
+ username: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
75
+ field: t("neetoEmailDelivery.smtp.setup.usernameLabel")
76
+ })),
77
+ password: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
78
+ field: t("neetoEmailDelivery.smtp.setup.passwordLabel")
79
+ })),
80
+ email: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
81
+ field: t("neetoEmailDelivery.smtp.setup.emailLabel")
82
+ })).email(t("neetoEmailDelivery.smtp.setup.emailInvalid")),
83
+ displayName: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
84
+ field: t("neetoEmailDelivery.smtp.setup.displayNameLabel")
85
+ })),
86
+ encryption: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
87
+ field: t("neetoEmailDelivery.smtp.setup.encryptionLabel")
88
+ }))
89
+ });
90
+
91
+ var SmtpSetup = function SmtpSetup(_ref) {
92
+ var ownerId = _ref.ownerId,
93
+ onDone = _ref.onDone,
94
+ onCancel = _ref.onCancel,
95
+ isOpen = _ref.isOpen;
96
+ var _useTranslation = useTranslation(),
97
+ t = _useTranslation.t;
98
+ var _useCreateSmtp = useCreateSmtp({
99
+ ownerId: ownerId
100
+ }),
101
+ isCreating = _useCreateSmtp.isPending,
102
+ createSmtp = _useCreateSmtp.mutate;
103
+ var handleSubmit = function handleSubmit(values) {
104
+ createSmtp({
105
+ smtp_account: values
106
+ }, {
107
+ onSuccess: onDone
108
+ });
109
+ };
110
+ return /*#__PURE__*/jsxs(Pane, {
111
+ isOpen: isOpen,
112
+ size: "lg",
113
+ onClose: onCancel,
114
+ children: [/*#__PURE__*/jsx(Pane.Header, {
115
+ children: /*#__PURE__*/jsx(Typography, {
116
+ style: "h2",
117
+ weight: "semibold",
118
+ children: t("neetoEmailDelivery.smtp.setup.title")
119
+ })
120
+ }), /*#__PURE__*/jsxs(Form, {
121
+ className: "w-full",
122
+ formikProps: {
123
+ initialValues: SMTP_ACCOUNT_INITIAL_VALUES,
124
+ validationSchema: SMTP_ACCOUNT_VALIDATION_SCHEMA,
125
+ onSubmit: handleSubmit
126
+ },
127
+ children: [/*#__PURE__*/jsx(Pane.Body, {
128
+ className: "space-y-4",
129
+ children: /*#__PURE__*/jsxs("div", {
130
+ className: "flex flex-col gap-6",
131
+ children: [/*#__PURE__*/jsx(Callout, {
132
+ style: "warning",
133
+ children: t("neetoEmailDelivery.smtp.setup.note")
134
+ }), /*#__PURE__*/jsx(Input, {
135
+ required: true,
136
+ label: t("neetoEmailDelivery.smtp.setup.hostLabel"),
137
+ name: "host"
138
+ }), /*#__PURE__*/jsx(Input, {
139
+ required: true,
140
+ label: t("neetoEmailDelivery.smtp.setup.portLabel"),
141
+ name: "port",
142
+ type: "number"
143
+ }), /*#__PURE__*/jsx(Input, {
144
+ required: true,
145
+ label: t("neetoEmailDelivery.smtp.setup.usernameLabel"),
146
+ name: "username"
147
+ }), /*#__PURE__*/jsx(Input, {
148
+ required: true,
149
+ label: t("neetoEmailDelivery.smtp.setup.passwordLabel"),
150
+ name: "password",
151
+ type: "password"
152
+ }), /*#__PURE__*/jsx(Input, {
153
+ required: true,
154
+ label: t("neetoEmailDelivery.smtp.setup.emailLabel"),
155
+ name: "email",
156
+ type: "email"
157
+ }), /*#__PURE__*/jsx(Input, {
158
+ required: true,
159
+ label: t("neetoEmailDelivery.smtp.setup.displayNameLabel"),
160
+ name: "displayName"
161
+ }), /*#__PURE__*/jsx(Radio, {
162
+ label: t("neetoEmailDelivery.smtp.setup.encryptionLabel"),
163
+ name: "encryption",
164
+ children: ENCRYPTION_OPTIONS.map(function (option) {
165
+ return /*#__PURE__*/jsx(Radio.Item, {
166
+ label: option.label,
167
+ value: option.value
168
+ }, option.value);
169
+ })
170
+ })]
171
+ })
172
+ }), /*#__PURE__*/jsx(Pane.Footer, {
173
+ children: /*#__PURE__*/jsx(ActionBlock, {
174
+ cancelButtonProps: {
175
+ onClick: onCancel
176
+ },
177
+ isSubmitting: isCreating,
178
+ submitButtonProps: {
179
+ label: t("neetoEmailDelivery.smtp.setup.saveAndActivate")
180
+ }
181
+ })
182
+ })]
183
+ })]
184
+ });
185
+ };
186
+
187
+ var INTEGRATION_TYPES = {
188
+ GMAIL: "gmail",
189
+ OUTLOOK: "outlook",
190
+ SPARKPOST: "sparkpost",
191
+ SMTP: "smtp"
192
+ };
193
+ 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");
194
+ var PROVIDER_ICONS = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, INTEGRATION_TYPES.GMAIL, GmailIcon), INTEGRATION_TYPES.OUTLOOK, OutlookIcon), INTEGRATION_TYPES.SPARKPOST, MailSend), INTEGRATION_TYPES.SMTP, MailSend);
195
+
196
+ var IntegrationDetailPage = function IntegrationDetailPage(_ref) {
197
+ var type = _ref.type,
198
+ ownerId = _ref.ownerId,
199
+ canManageIntegrations = _ref.canManageIntegrations,
200
+ appName = _ref.appName,
201
+ scopeText = _ref.scopeText,
202
+ connectedScopeText = _ref.connectedScopeText,
203
+ helpArticleUrl = _ref.helpArticleUrl,
204
+ indexRoute = _ref.indexRoute,
205
+ integrationRoutes = _ref.integrationRoutes,
206
+ ownDomainSetupRoute = _ref.ownDomainSetupRoute,
207
+ ownDomainVerifyRoute = _ref.ownDomainVerifyRoute;
208
+ var _useTranslation = useTranslation(),
209
+ t = _useTranslation.t;
210
+ var history = useHistory();
211
+ var _useState = useState(false),
212
+ _useState2 = _slicedToArray(_useState, 2),
213
+ isSmtpPaneOpen = _useState2[0],
214
+ setIsSmtpPaneOpen = _useState2[1];
215
+ var providerLabel = PROVIDER_LABELS[type];
216
+ var Icon = PROVIDER_ICONS[type];
217
+ var description = t("neetoEmailDelivery.".concat(type, ".description"));
218
+ var gmailIntegration = useGmail({
219
+ ownerId: ownerId,
220
+ indexRoute: indexRoute,
221
+ canManageIntegrations: canManageIntegrations
222
+ });
223
+ var outlookIntegration = useOutlook({
224
+ ownerId: ownerId,
225
+ indexRoute: indexRoute,
226
+ canManageIntegrations: canManageIntegrations
227
+ });
228
+ var sparkpostIntegration = useSparkpostDomain({
229
+ ownerId: ownerId,
230
+ canManageIntegrations: canManageIntegrations
231
+ });
232
+ var smtpIntegration = useSmtp({
233
+ ownerId: ownerId,
234
+ canManageIntegrations: canManageIntegrations
235
+ });
236
+ var _useFetchConnectedInt = useFetchConnectedIntegration(ownerId),
237
+ connectedIntegration = _useFetchConnectedInt.integration,
238
+ isIntegrationLoading = _useFetchConnectedInt.isLoading;
239
+ var integrationMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, INTEGRATION_TYPES.GMAIL, gmailIntegration), INTEGRATION_TYPES.OUTLOOK, outlookIntegration), INTEGRATION_TYPES.SPARKPOST, sparkpostIntegration), INTEGRATION_TYPES.SMTP, smtpIntegration);
240
+ var currentIntegration = integrationMap[type];
241
+ var isConnected = currentIntegration.isConnected,
242
+ isDestroying = currentIntegration.isDestroying,
243
+ onDisconnect = currentIntegration.onDisconnect,
244
+ _currentIntegration$d = currentIntegration.data,
245
+ data = _currentIntegration$d === void 0 ? {} : _currentIntegration$d,
246
+ errorMessage = currentIntegration.errorMessage;
247
+ var connectedEmail = data === null || data === void 0 ? void 0 : data.email;
248
+ var isOutlookPending = type === INTEGRATION_TYPES.OUTLOOK && outlookIntegration.isWaitingForTestEmail;
249
+ var isSparkpostPending = type === INTEGRATION_TYPES.SPARKPOST && sparkpostIntegration.exists && !isConnected;
250
+ var isPending = isOutlookPending || isSparkpostPending;
251
+ var isLoading = gmailIntegration.isLoading || outlookIntegration.isLoading || sparkpostIntegration.isLoading || smtpIntegration.isLoading || isIntegrationLoading;
252
+ var isBlocked = connectedIntegration && connectedIntegration.type !== type;
253
+ var activeProviderLabel = isBlocked ? PROVIDER_LABELS[connectedIntegration.type] : null;
254
+ var activeProviderRoute = isBlocked ? integrationRoutes === null || integrationRoutes === void 0 ? void 0 : integrationRoutes[connectedIntegration.type] : null;
255
+ var handleConnect = function handleConnect() {
256
+ switch (type) {
257
+ case INTEGRATION_TYPES.GMAIL:
258
+ window.location.href = buildUrl(GMAIL_OAUTH_CONNECT_URL, {
259
+ ownerId: ownerId
260
+ });
261
+ break;
262
+ case INTEGRATION_TYPES.OUTLOOK:
263
+ window.location.href = buildUrl(OUTLOOK_OAUTH_CONNECT_URL, {
264
+ ownerId: ownerId
265
+ });
266
+ break;
267
+ case INTEGRATION_TYPES.SPARKPOST:
268
+ history.push(ownDomainSetupRoute);
269
+ break;
270
+ case INTEGRATION_TYPES.SMTP:
271
+ setIsSmtpPaneOpen(true);
272
+ break;
273
+ }
274
+ };
275
+ var getConnectButtonLabel = function getConnectButtonLabel() {
276
+ switch (type) {
277
+ case INTEGRATION_TYPES.GMAIL:
278
+ return t("neetoEmailDelivery.integrationDetail.connectGmail");
279
+ case INTEGRATION_TYPES.OUTLOOK:
280
+ return t("neetoEmailDelivery.integrationDetail.connectOutlook");
281
+ case INTEGRATION_TYPES.SPARKPOST:
282
+ return t("neetoEmailDelivery.integrationDetail.setupDomain");
283
+ case INTEGRATION_TYPES.SMTP:
284
+ return t("neetoEmailDelivery.integrationDetail.connectSmtp");
285
+ default:
286
+ return "";
287
+ }
288
+ };
289
+ var renderActionBlock = function renderActionBlock() {
290
+ if (isConnected) {
291
+ return /*#__PURE__*/jsx(Button, {
292
+ "data-testid": "disconnect-button",
293
+ label: t("neetoEmailDelivery.integrationDetail.disconnect"),
294
+ loading: isDestroying,
295
+ style: "danger",
296
+ onClick: onDisconnect
297
+ });
298
+ }
299
+ if (isPending) {
300
+ return /*#__PURE__*/jsxs("div", {
301
+ className: "flex items-center gap-2",
302
+ children: [isSparkpostPending && /*#__PURE__*/jsx(Button, {
303
+ "data-testid": "continue-verification-button",
304
+ to: ownDomainVerifyRoute,
305
+ label: t("neetoEmailDelivery.sparkpost.emailDelivery.continueVerification")
306
+ }), /*#__PURE__*/jsx(Button, {
307
+ "data-testid": "disconnect-button",
308
+ label: t("neetoEmailDelivery.integrationDetail.disconnect"),
309
+ loading: isDestroying,
310
+ style: "danger",
311
+ onClick: onDisconnect
312
+ })]
313
+ });
314
+ }
315
+ if (isBlocked) return null;
316
+ return /*#__PURE__*/jsx(Button, {
317
+ "data-testid": "connect-button",
318
+ label: getConnectButtonLabel(),
319
+ style: "primary",
320
+ onClick: handleConnect
321
+ });
322
+ };
323
+ if (isLoading) {
324
+ return /*#__PURE__*/jsx("div", {
325
+ className: "flex grow items-center justify-center w-full",
326
+ children: /*#__PURE__*/jsx(Spinner, {})
327
+ });
328
+ }
329
+ return /*#__PURE__*/jsxs(Fragment, {
330
+ children: [/*#__PURE__*/jsxs(CardLayout, {
331
+ actionBlock: renderActionBlock(),
332
+ icon: /*#__PURE__*/jsx(Icon, {
333
+ size: 48
334
+ }),
335
+ description: isConnected ? /*#__PURE__*/jsx(Trans, {
336
+ components: {
337
+ bold: /*#__PURE__*/jsx("strong", {})
338
+ },
339
+ i18nKey: "neetoEmailDelivery.integrationDetail.connectedEmail",
340
+ values: {
341
+ email: connectedEmail
342
+ }
343
+ }) : description,
344
+ title: isConnected ? /*#__PURE__*/jsxs("div", {
345
+ className: "flex items-center gap-2",
346
+ children: [/*#__PURE__*/jsx("span", {
347
+ children: t("neetoEmailDelivery.integrationDetail.connectedTitle", {
348
+ provider: providerLabel
349
+ })
350
+ }), /*#__PURE__*/jsx(CheckCircle, {
351
+ color: "#16A34A",
352
+ size: 24
353
+ })]
354
+ }) : t("neetoEmailDelivery.integrationDetail.connectTitle", {
355
+ appName: appName,
356
+ provider: providerLabel
357
+ }),
358
+ children: [(isConnected ? connectedScopeText || scopeText : scopeText) && /*#__PURE__*/jsx(Typography, {
359
+ style: "body1",
360
+ children: isConnected ? connectedScopeText || scopeText : scopeText
361
+ }), !isConnected && helpArticleUrl && /*#__PURE__*/jsx(Typography, {
362
+ className: "my-2",
363
+ style: "body2",
364
+ children: /*#__PURE__*/jsx(Trans, {
365
+ i18nKey: "neetoEmailDelivery.integrationDetail.helpArticleText",
366
+ values: {
367
+ provider: providerLabel
368
+ },
369
+ components: {
370
+ helpLink: /*#__PURE__*/jsx("a", {
371
+ className: "neeto-ui-text-primary-500",
372
+ href: helpArticleUrl,
373
+ rel: "noopener noreferrer",
374
+ target: "_blank"
375
+ })
376
+ }
377
+ })
378
+ }), !isConnected && !isPending && isBlocked && /*#__PURE__*/jsx(Callout, {
379
+ style: connectedIntegration.isPending ? "warning" : "danger",
380
+ children: /*#__PURE__*/jsx("p", {
381
+ children: /*#__PURE__*/jsx(Trans, {
382
+ components: {
383
+ disconnectLink: /*#__PURE__*/jsx(Link, {
384
+ className: "neeto-ui-font-semibold neeto-ui-text-primary-500",
385
+ to: activeProviderRoute
386
+ })
387
+ },
388
+ i18nKey: connectedIntegration.isPending ? "neetoEmailDelivery.integrationDetail.pendingIntegrationBlocked" : "neetoEmailDelivery.integrationDetail.onlyOneIntegration",
389
+ values: {
390
+ activeProvider: activeProviderLabel,
391
+ targetProvider: providerLabel
392
+ }
393
+ })
394
+ })
395
+ }), errorMessage && /*#__PURE__*/jsx(Callout, {
396
+ style: "danger",
397
+ children: errorMessage
398
+ }), isOutlookPending && /*#__PURE__*/jsx(Callout, {
399
+ style: "warning",
400
+ children: t("neetoEmailDelivery.outlook.waitingForTestEmail", {
401
+ email: connectedEmail
402
+ })
403
+ }), isSparkpostPending && /*#__PURE__*/jsx(Callout, {
404
+ style: "warning",
405
+ children: t("neetoEmailDelivery.sparkpost.emailDelivery.verificationPending", {
406
+ domain: data === null || data === void 0 ? void 0 : data.domain
407
+ })
408
+ })]
409
+ }), type === INTEGRATION_TYPES.SMTP && /*#__PURE__*/jsx(SmtpSetup, {
410
+ ownerId: ownerId,
411
+ isOpen: isSmtpPaneOpen,
412
+ onCancel: function onCancel() {
413
+ return setIsSmtpPaneOpen(false);
414
+ },
415
+ onDone: function onDone() {
416
+ return setIsSmtpPaneOpen(false);
417
+ }
418
+ })]
419
+ });
420
+ };
421
+
422
+ export { IntegrationDetailPage };
43
423
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -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 { CheckCircle } from \"neetoicons\";\nimport CardLayout from \"neetomolecules/CardLayout\";\nimport { Button, Callout, Spinner, Typography } from \"neetoui\";\nimport { Trans, useTranslation } from \"react-i18next\";\nimport { useHistory, Link } 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 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 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 title={\n isConnected ? (\n <div className=\"flex items-center gap-2\">\n <span>\n {t(\"neetoEmailDelivery.integrationDetail.connectedTitle\", {\n provider: providerLabel,\n })}\n </span>\n <CheckCircle color=\"#16A34A\" size={24} />\n </div>\n ) : (\n t(\"neetoEmailDelivery.integrationDetail.connectTitle\", {\n appName,\n provider: providerLabel,\n })\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 <a\n className=\"neeto-ui-text-primary-500\"\n href={helpArticleUrl}\n rel=\"noopener noreferrer\"\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 <Link\n className=\"neeto-ui-font-semibold neeto-ui-text-primary-500\"\n to={activeProviderRoute}\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","renderActionBlock","Button","loading","to","Spinner","_Fragment","CardLayout","actionBlock","icon","Trans","components","bold","i18nKey","title","provider","CheckCircle","color","helpLink","rel","target","disconnectLink","Link","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,EA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EuE,cAAe;MACvBxE,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;;;;"}
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ var neetoCist = require('@bigbinary/neeto-cist');
4
+ var ramda = require('ramda');
5
+ var useSparkpostApi = require('./useSparkpostApi-C7cHCa3T.js');
6
+
7
+ var useFetchConnectedIntegration = function useFetchConnectedIntegration(ownerId) {
8
+ var _activeIntegration$ho, _activeIntegration$ho2;
9
+ var gmail = useSparkpostApi.useFetchGmail(ownerId);
10
+ var outlook = useSparkpostApi.useFetchOutlook(ownerId);
11
+ var sparkpost = useSparkpostApi.useFetchSparkpostDomain(ownerId);
12
+ var smtp = useSparkpostApi.useFetchSmtp(ownerId);
13
+ var integrations = [{
14
+ type: "gmail",
15
+ hook: gmail
16
+ }, {
17
+ type: "outlook",
18
+ hook: outlook
19
+ }, {
20
+ type: "sparkpost",
21
+ hook: sparkpost
22
+ }, {
23
+ type: "smtp",
24
+ hook: smtp
25
+ }];
26
+ var hooks = ramda.pluck("hook", integrations);
27
+ var isLoading = neetoCist.existsBy({
28
+ isLoading: true
29
+ }, hooks);
30
+ var isError = neetoCist.existsBy({
31
+ isError: true
32
+ }, hooks);
33
+ var connectedIntegration = integrations.find(function (_ref) {
34
+ var _hook$data;
35
+ var hook = _ref.hook;
36
+ return hook.isSuccess && (hook === null || hook === void 0 || (_hook$data = hook.data) === null || _hook$data === void 0 ? void 0 : _hook$data.connected);
37
+ });
38
+ var pendingIntegration = !connectedIntegration ? integrations.find(function (_ref2) {
39
+ var _hook$data2, _hook$data3;
40
+ var hook = _ref2.hook;
41
+ return hook.isSuccess && (hook === null || hook === void 0 || (_hook$data2 = hook.data) === null || _hook$data2 === void 0 ? void 0 : _hook$data2.exists) && !(hook !== null && hook !== void 0 && (_hook$data3 = hook.data) !== null && _hook$data3 !== void 0 && _hook$data3.connected);
42
+ }) : null;
43
+ var activeIntegration = connectedIntegration || pendingIntegration;
44
+ var integration = activeIntegration ? {
45
+ type: activeIntegration.type,
46
+ data: (_activeIntegration$ho = activeIntegration.hook) === null || _activeIntegration$ho === void 0 ? void 0 : _activeIntegration$ho.data,
47
+ isPending: !((_activeIntegration$ho2 = activeIntegration.hook) !== null && _activeIntegration$ho2 !== void 0 && (_activeIntegration$ho2 = _activeIntegration$ho2.data) !== null && _activeIntegration$ho2 !== void 0 && _activeIntegration$ho2.connected)
48
+ } : null;
49
+ return {
50
+ integration: integration,
51
+ isLoading: isLoading,
52
+ isError: isError
53
+ };
54
+ };
55
+
56
+ exports.useFetchConnectedIntegration = useFetchConnectedIntegration;
57
+ //# sourceMappingURL=useEmailDeliveryIntegrationApi-BD6h2h5w.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEmailDeliveryIntegrationApi-BD6h2h5w.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 pendingIntegration = !connectedIntegration\n ? integrations.find(\n ({ hook }) =>\n hook.isSuccess && hook?.data?.exists && !hook?.data?.connected\n )\n : null;\n\n const activeIntegration = connectedIntegration || pendingIntegration;\n\n const integration = activeIntegration\n ? {\n type: activeIntegration.type,\n data: activeIntegration.hook?.data,\n isPending: !activeIntegration.hook?.data?.connected,\n }\n : null;\n\n return { integration, isLoading, isError };\n};\n"],"names":["useFetchConnectedIntegration","ownerId","_activeIntegration$ho","_activeIntegration$ho2","gmail","useFetchGmail","outlook","useFetchOutlook","sparkpost","useFetchSparkpostDomain","smtp","useFetchSmtp","integrations","type","hook","hooks","pluck","isLoading","existsBy","isError","connectedIntegration","find","_ref","_hook$data","isSuccess","data","connected","pendingIntegration","_ref2","_hook$data2","_hook$data3","exists","activeIntegration","integration","isPending"],"mappings":";;;;;;IAQaA,4BAA4B,GAAG,SAA/BA,4BAA4BA,CAAGC,OAAO,EAAI;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;AACrD,EAAA,IAAMC,KAAK,GAAGC,6BAAa,CAACJ,OAAO,CAAC;AACpC,EAAA,IAAMK,OAAO,GAAGC,+BAAe,CAACN,OAAO,CAAC;AACxC,EAAA,IAAMO,SAAS,GAAGC,uCAAuB,CAACR,OAAO,CAAC;AAClD,EAAA,IAAMS,IAAI,GAAGC,4BAAY,CAACV,OAAO,CAAC;EAElC,IAAMW,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,MAA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AI,MAAAK,IAAAA,IAAAA,WAAA,KAAVA,KAAAA,CAAAA,IAAAA,WAAA,CAAYJ,SAAS,CAAA;GAClE,CAAC,GACD,IAAI;AAER,EAAA,IAAMM,iBAAiB,GAAGZ,oBAAoB,IAAIO,kBAAkB;EAEpE,IAAMM,WAAW,GAAGD,iBAAiB,GACjC;IACEnB,IAAI,EAAEmB,iBAAiB,CAACnB,IAAI;IAC5BY,IAAI,EAAA,CAAAvB,qBAAA,GAAE8B,iBAAiB,CAAClB,IAAI,MAAA,IAAA,IAAAZ,qBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAtBA,qBAAA,CAAwBuB,IAAI;IAClCS,SAAS,EAAE,GAAA/B,sBAAA,GAAC6B,iBAAiB,CAAClB,IAAI,cAAAX,sBAAA,KAAA,KAAA,CAAA,IAAA,CAAAA,sBAAA,GAAtBA,sBAAA,CAAwBsB,IAAI,MAAA,IAAA,IAAAtB,sBAAA,KAA5BA,KAAAA,CAAAA,IAAAA,sBAAA,CAA8BuB,SAAS;AACrD,GAAC,GACD,IAAI;EAER,OAAO;AAAEO,IAAAA,WAAW,EAAXA,WAAW;AAAEhB,IAAAA,SAAS,EAATA,SAAS;AAAEE,IAAAA,OAAO,EAAPA;GAAS;AAC5C;;;;"}
@@ -0,0 +1,55 @@
1
+ import { existsBy } from '@bigbinary/neeto-cist';
2
+ import { pluck } from 'ramda';
3
+ import { u as useFetchGmail, a as useFetchOutlook, b as useFetchSparkpostDomain, c as useFetchSmtp } from './useSparkpostApi-tYImubXZ.js';
4
+
5
+ var useFetchConnectedIntegration = function useFetchConnectedIntegration(ownerId) {
6
+ var _activeIntegration$ho, _activeIntegration$ho2;
7
+ var gmail = useFetchGmail(ownerId);
8
+ var outlook = useFetchOutlook(ownerId);
9
+ var sparkpost = useFetchSparkpostDomain(ownerId);
10
+ var smtp = useFetchSmtp(ownerId);
11
+ var integrations = [{
12
+ type: "gmail",
13
+ hook: gmail
14
+ }, {
15
+ type: "outlook",
16
+ hook: outlook
17
+ }, {
18
+ type: "sparkpost",
19
+ hook: sparkpost
20
+ }, {
21
+ type: "smtp",
22
+ hook: smtp
23
+ }];
24
+ var hooks = pluck("hook", integrations);
25
+ var isLoading = existsBy({
26
+ isLoading: true
27
+ }, hooks);
28
+ var isError = existsBy({
29
+ isError: true
30
+ }, hooks);
31
+ var connectedIntegration = integrations.find(function (_ref) {
32
+ var _hook$data;
33
+ var hook = _ref.hook;
34
+ return hook.isSuccess && (hook === null || hook === void 0 || (_hook$data = hook.data) === null || _hook$data === void 0 ? void 0 : _hook$data.connected);
35
+ });
36
+ var pendingIntegration = !connectedIntegration ? integrations.find(function (_ref2) {
37
+ var _hook$data2, _hook$data3;
38
+ var hook = _ref2.hook;
39
+ return hook.isSuccess && (hook === null || hook === void 0 || (_hook$data2 = hook.data) === null || _hook$data2 === void 0 ? void 0 : _hook$data2.exists) && !(hook !== null && hook !== void 0 && (_hook$data3 = hook.data) !== null && _hook$data3 !== void 0 && _hook$data3.connected);
40
+ }) : null;
41
+ var activeIntegration = connectedIntegration || pendingIntegration;
42
+ var integration = activeIntegration ? {
43
+ type: activeIntegration.type,
44
+ data: (_activeIntegration$ho = activeIntegration.hook) === null || _activeIntegration$ho === void 0 ? void 0 : _activeIntegration$ho.data,
45
+ isPending: !((_activeIntegration$ho2 = activeIntegration.hook) !== null && _activeIntegration$ho2 !== void 0 && (_activeIntegration$ho2 = _activeIntegration$ho2.data) !== null && _activeIntegration$ho2 !== void 0 && _activeIntegration$ho2.connected)
46
+ } : null;
47
+ return {
48
+ integration: integration,
49
+ isLoading: isLoading,
50
+ isError: isError
51
+ };
52
+ };
53
+
54
+ export { useFetchConnectedIntegration as u };
55
+ //# sourceMappingURL=useEmailDeliveryIntegrationApi-NUL8d1xC.js.map