@bigbinary/neeto-email-delivery-frontend 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/app/javascript/src/translations/en.json +4 -1
- package/dist/EmailDeliveryScreen.js +46 -17
- package/dist/EmailDeliveryScreen.js.map +1 -1
- package/dist/SparkpostDomainSetup.js +1 -1
- package/dist/SparkpostDomainVerify.js +1 -1
- package/dist/cjs/EmailDeliveryScreen.js +45 -16
- package/dist/cjs/EmailDeliveryScreen.js.map +1 -1
- package/dist/cjs/SparkpostDomainSetup.js +1 -1
- package/dist/cjs/SparkpostDomainVerify.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{useSparkpostDomain-DNDqvZtR.js → useSparkpostDomain-DO4bG1HD.js} +2 -1
- package/dist/useSparkpostDomain-DO4bG1HD.js.map +1 -0
- package/dist/{useSparkpostDomain-yQjcPe0y.js → useSparkpostDomain-wsENCoto.js} +2 -1
- package/dist/useSparkpostDomain-wsENCoto.js.map +1 -0
- package/package.json +5 -5
- package/dist/useSparkpostDomain-DNDqvZtR.js.map +0 -1
- package/dist/useSparkpostDomain-yQjcPe0y.js.map +0 -1
package/README.md
CHANGED
|
@@ -94,8 +94,14 @@ SPARKPOST_SENDING_DOMAINS_KEY
|
|
|
94
94
|
APP_LOCAL_TO_INTERNET_PROXY_URL
|
|
95
95
|
CONNECT_PRIVATE_KEY
|
|
96
96
|
CONNECT_PUBLIC_KEY
|
|
97
|
+
MAILGUN_INGRESS_SIGNING_KEY (needed for our custom logic to verify the Outlook account.)
|
|
97
98
|
```
|
|
98
99
|
|
|
100
|
+
9. Ensure that the domain `<app-name>email.com` (production) and
|
|
101
|
+
`<app-name>email.net` (staging) is correctly setup in Mailgun to accept
|
|
102
|
+
incoming emails. Example: For NeetoForm it would be neetoformemail.com
|
|
103
|
+
(production) and neetoformemail.net (staging).
|
|
104
|
+
|
|
99
105
|
### Frontend package
|
|
100
106
|
|
|
101
107
|
#### Installation
|
|
@@ -187,6 +193,39 @@ for step-by-step instructions to develop the frontend package.
|
|
|
187
193
|
- active - The final state. If active, then we will allow sending emails via
|
|
188
194
|
this domain.
|
|
189
195
|
|
|
196
|
+
## Outlook integration flow
|
|
197
|
+
|
|
198
|
+
Ensure that `MAILGUN_INGRESS_SIGNING_KEY` environment variable is set in the
|
|
199
|
+
host application. This is needed for the verification of the Outlook account.
|
|
200
|
+
|
|
201
|
+
1. **Connect Outlook from UI**
|
|
202
|
+
- User clicks the "Connect Outlook" action in the host application.
|
|
203
|
+
- The engine redirects the user to Microsoft OAuth using `User.Read`,
|
|
204
|
+
`Mail.Send`, and `offline_access` scopes so that we can send emails and
|
|
205
|
+
refresh tokens without re‑auth.
|
|
206
|
+
|
|
207
|
+
2. **Store Outlook account and send verification email**
|
|
208
|
+
- After a successful OAuth callback,
|
|
209
|
+
`NeetoEmailDeliveryEngine::Integrations::Outlook::ConnectService` creates
|
|
210
|
+
or updates an `OutlookAccount` and sets its status to `inactive`.
|
|
211
|
+
- The service generates a `test_email_token`, persists it in the account
|
|
212
|
+
metadata (along with timestamp and subject), and sends a test email via
|
|
213
|
+
`NeetoEmailDeliveryEngine::Outlook::SendEmailService` using the Microsoft
|
|
214
|
+
Graph `sendMail` API to a generated verification address like
|
|
215
|
+
`outlook.neetoemaildelivery@<application_name>email.(com|net)`.
|
|
216
|
+
|
|
217
|
+
3. **Inbound verification handling**
|
|
218
|
+
- Incoming emails to the verification address are processed by
|
|
219
|
+
`NeetoEmailDeliveryEngine::InboundMailbox`.
|
|
220
|
+
- The mailbox identifies Outlook verification emails by recipient and
|
|
221
|
+
subject, extracts the `test_email_token` from the subject, and finds the
|
|
222
|
+
corresponding `OutlookAccount`.
|
|
223
|
+
- If the email is from a legitimate user mailbox and the account is not
|
|
224
|
+
already active, the mailbox updates the account status to `active`. If the
|
|
225
|
+
sender looks like an Outlook shadow account (e.g.
|
|
226
|
+
`outlook_...@outlook.com`), the mailbox flags the account as
|
|
227
|
+
`shadow_account` and marks it as `forbidden` instead of activating it.
|
|
228
|
+
|
|
190
229
|
## Instructions for Publishing
|
|
191
230
|
|
|
192
231
|
Consult the
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"invalidClient": "Invalid client error from Outlook.",
|
|
16
16
|
"nilJsonWebToken": "The account is not configured for sending emails from Outlook.",
|
|
17
17
|
"connectOutlook": "Connect Outlook",
|
|
18
|
-
"outlookConfigured": "Outlook is configured for sending emails."
|
|
18
|
+
"outlookConfigured": "Outlook is configured for sending emails.",
|
|
19
|
+
"waitingForTestEmail": "We are waiting for a test email from your account - {{email}}. Once we receive the email, we will mark the email as active.",
|
|
20
|
+
"shadowAccountMessage": "Looks like Outlook mailbox is not configured for your email address - {{email}}. Please configure your Outlook mailbox by logging in to your Outlook account and then try again.",
|
|
21
|
+
"cancel": "Cancel"
|
|
19
22
|
},
|
|
20
23
|
"sparkpost": {
|
|
21
24
|
"ownDomainConfigured": "Own domain is configured for sending emails.",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isPresent, humanize } from '@bigbinary/neeto-cist';
|
|
2
|
-
import {
|
|
2
|
+
import { useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
3
3
|
import { showThumbsUpToastr, buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
4
4
|
import MailSend from '@bigbinary/neeto-icons/MailSend';
|
|
5
5
|
import GmailIcon from '@bigbinary/neeto-icons/misc/Gmail';
|
|
@@ -15,7 +15,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
15
15
|
import { useState, useEffect } from 'react';
|
|
16
16
|
import { useQueryClient } from '@tanstack/react-query';
|
|
17
17
|
import { u as useFetchGmail, b as useDestroyGmail, a as useFetchOutlook, c as useDestroyOutlook } from './useOutlookIntegrationApi-ZgRWrUQN.js';
|
|
18
|
-
import { u as useSparkpostDomain } from './useSparkpostDomain-
|
|
18
|
+
import { u as useSparkpostDomain } from './useSparkpostDomain-DO4bG1HD.js';
|
|
19
19
|
import { t } from 'i18next';
|
|
20
20
|
import Button from '@bigbinary/neetoui/Button';
|
|
21
21
|
import Tag from '@bigbinary/neetoui/Tag';
|
|
@@ -74,6 +74,7 @@ var useGmail = function useGmail(_ref) {
|
|
|
74
74
|
data: data,
|
|
75
75
|
isLoading: isLoading,
|
|
76
76
|
isDestroying: isDestroying,
|
|
77
|
+
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
77
78
|
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
78
79
|
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
79
80
|
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
@@ -132,6 +133,10 @@ var useOutlook = function useOutlook(_ref) {
|
|
|
132
133
|
return {
|
|
133
134
|
data: data,
|
|
134
135
|
isLoading: isLoading,
|
|
136
|
+
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
137
|
+
status: data === null || data === void 0 ? void 0 : data.status,
|
|
138
|
+
shadowAccount: data === null || data === void 0 ? void 0 : data.shadowAccount,
|
|
139
|
+
isWaitingForTestEmail: (data === null || data === void 0 ? void 0 : data.status) === "inactive" && !(data !== null && data !== void 0 && data.connected),
|
|
135
140
|
isDestroying: isDestroying,
|
|
136
141
|
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
137
142
|
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
@@ -149,9 +154,8 @@ var ERROR_MESSAGES = {
|
|
|
149
154
|
outlook_nil_json_web_token: t("neetoEmailDelivery.outlook.nilJsonWebToken")
|
|
150
155
|
};
|
|
151
156
|
|
|
152
|
-
var IntegrationCard =
|
|
153
|
-
var
|
|
154
|
-
Icon = _ref.icon,
|
|
157
|
+
var IntegrationCard = function IntegrationCard(_ref) {
|
|
158
|
+
var Icon = _ref.icon,
|
|
155
159
|
title = _ref.title,
|
|
156
160
|
description = _ref.description,
|
|
157
161
|
isConnected = _ref.isConnected,
|
|
@@ -162,7 +166,12 @@ var IntegrationCard = withT(function (_ref) {
|
|
|
162
166
|
_ref$disconnectButton = _ref.disconnectButtonText,
|
|
163
167
|
disconnectButtonText = _ref$disconnectButton === void 0 ? "neetoEmailDelivery.sparkpost.emailDelivery.disconnect" : _ref$disconnectButton,
|
|
164
168
|
_ref$connectedTagText = _ref.connectedTagText,
|
|
165
|
-
connectedTagText = _ref$connectedTagText === void 0 ? "neetoEmailDelivery.sparkpost.emailDelivery.connected" : _ref$connectedTagText
|
|
169
|
+
connectedTagText = _ref$connectedTagText === void 0 ? "neetoEmailDelivery.sparkpost.emailDelivery.connected" : _ref$connectedTagText,
|
|
170
|
+
_ref$showDisconnect = _ref.showDisconnect,
|
|
171
|
+
showDisconnect = _ref$showDisconnect === void 0 ? false : _ref$showDisconnect;
|
|
172
|
+
var _useTranslation = useTranslation(),
|
|
173
|
+
t = _useTranslation.t;
|
|
174
|
+
var shouldShowDisconnect = isConnected || showDisconnect;
|
|
166
175
|
return /*#__PURE__*/jsx("div", {
|
|
167
176
|
className: "neeto-ui-rounded-lg neeto-ui-shadow-xs neeto-ui-border-gray-300 translate flex flex-col gap-y-4 border p-6 no-underline transition-transform duration-300 ease-in-out outline-none hover:-translate-y-1",
|
|
168
177
|
children: /*#__PURE__*/jsxs("div", {
|
|
@@ -190,7 +199,7 @@ var IntegrationCard = withT(function (_ref) {
|
|
|
190
199
|
children: description
|
|
191
200
|
}), connectButtonText && /*#__PURE__*/jsx("div", {
|
|
192
201
|
className: "flex gap-2",
|
|
193
|
-
children:
|
|
202
|
+
children: shouldShowDisconnect ? /*#__PURE__*/jsx(Button, {
|
|
194
203
|
"data-cy": "disconnect-button",
|
|
195
204
|
label: t(disconnectButtonText),
|
|
196
205
|
loading: isDisconnecting,
|
|
@@ -207,7 +216,7 @@ var IntegrationCard = withT(function (_ref) {
|
|
|
207
216
|
})]
|
|
208
217
|
})
|
|
209
218
|
});
|
|
210
|
-
}
|
|
219
|
+
};
|
|
211
220
|
|
|
212
221
|
var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
213
222
|
var indexRoute = _ref.indexRoute,
|
|
@@ -248,21 +257,29 @@ var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
|
248
257
|
isGmailConnected = gmailIntegration.isConnected,
|
|
249
258
|
isGmailLoading = gmailIntegration.isLoading,
|
|
250
259
|
isGmailDisconnecting = gmailIntegration.isDestroying,
|
|
251
|
-
onGmailDisconnect = gmailIntegration.onDisconnect
|
|
260
|
+
onGmailDisconnect = gmailIntegration.onDisconnect,
|
|
261
|
+
isGmailExists = gmailIntegration.exists;
|
|
252
262
|
var _outlookIntegration$d = outlookIntegration.data,
|
|
253
263
|
outlookData = _outlookIntegration$d === void 0 ? {} : _outlookIntegration$d,
|
|
254
264
|
isOutlookConnected = outlookIntegration.isConnected,
|
|
255
265
|
isOutlookLoading = outlookIntegration.isLoading,
|
|
256
266
|
isOutlookDisconnecting = outlookIntegration.isDestroying,
|
|
257
|
-
|
|
267
|
+
isOutlookWaitingForTestEmail = outlookIntegration.isWaitingForTestEmail,
|
|
268
|
+
isOutlookShadowAccount = outlookIntegration.shadowAccount,
|
|
269
|
+
onOutlookDisconnect = outlookIntegration.onDisconnect,
|
|
270
|
+
isOutlookExists = outlookIntegration.exists;
|
|
258
271
|
var _sparkpostIntegration = sparkpostIntegration.data,
|
|
259
272
|
sparkpostData = _sparkpostIntegration === void 0 ? {} : _sparkpostIntegration,
|
|
260
273
|
isSparkpostConnected = sparkpostIntegration.isConnected,
|
|
261
274
|
isSparkpostLoading = sparkpostIntegration.isLoading,
|
|
262
275
|
onSparkpostDisconnect = sparkpostIntegration.onDisconnect,
|
|
263
|
-
isSparkpostDisconnecting = sparkpostIntegration.isDestroying
|
|
276
|
+
isSparkpostDisconnecting = sparkpostIntegration.isDestroying,
|
|
277
|
+
isSparkpostExists = sparkpostIntegration.exists;
|
|
264
278
|
var isLoading = isGmailLoading || isOutlookLoading || isSparkpostLoading;
|
|
265
|
-
var
|
|
279
|
+
var noneExists = !isGmailExists && !isOutlookExists && !isSparkpostExists;
|
|
280
|
+
var showGmail = noneExists || isGmailExists;
|
|
281
|
+
var showOutlook = noneExists || isOutlookExists;
|
|
282
|
+
var showSparkpost = noneExists || isSparkpostExists;
|
|
266
283
|
var handleGmailConnect = function handleGmailConnect() {
|
|
267
284
|
window.location.href = buildUrl(GMAIL_OAUTH_CONNECT_URL, {
|
|
268
285
|
ownerId: ownerId
|
|
@@ -297,13 +314,14 @@ var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
|
297
314
|
children: /*#__PURE__*/jsx(Spinner, {})
|
|
298
315
|
});
|
|
299
316
|
}
|
|
317
|
+
var activeMessage = isGmailConnected && t("neetoEmailDelivery.gmail.gmailConfigured") || isOutlookConnected && t("neetoEmailDelivery.outlook.outlookConfigured") || isSparkpostConnected && t("neetoEmailDelivery.sparkpost.ownDomainConfigured");
|
|
300
318
|
return /*#__PURE__*/jsx("div", {
|
|
301
319
|
className: "min-h-0 w-full grow",
|
|
302
320
|
children: /*#__PURE__*/jsxs("div", {
|
|
303
321
|
className: "@container mx-auto space-y-6",
|
|
304
322
|
children: [/*#__PURE__*/jsxs("div", {
|
|
305
323
|
className: "grid grid-cols-1 gap-3 py-1 @lg:grid-cols-2 @lg:gap-6 @3xl:grid-cols-3 @7xl:grid-cols-4",
|
|
306
|
-
children: [
|
|
324
|
+
children: [showGmail && /*#__PURE__*/jsx(IntegrationCard, {
|
|
307
325
|
connectButtonText: "neetoEmailDelivery.gmail.connectGmail",
|
|
308
326
|
description: gmailDescription,
|
|
309
327
|
icon: GmailIcon,
|
|
@@ -312,16 +330,17 @@ var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
|
312
330
|
title: gmailTitle,
|
|
313
331
|
onConnect: handleGmailConnect,
|
|
314
332
|
onDisconnect: onGmailDisconnect
|
|
315
|
-
}),
|
|
333
|
+
}), showOutlook && /*#__PURE__*/jsx(IntegrationCard, {
|
|
316
334
|
connectButtonText: "neetoEmailDelivery.outlook.connectOutlook",
|
|
317
335
|
description: outlookDescription,
|
|
318
336
|
icon: OutlookIcon,
|
|
319
337
|
isConnected: isOutlookConnected,
|
|
320
338
|
isDisconnecting: isOutlookDisconnecting,
|
|
321
339
|
title: outlookTitle,
|
|
340
|
+
showDisconnect: isOutlookWaitingForTestEmail || isOutlookShadowAccount,
|
|
322
341
|
onConnect: handleOutlookConnect,
|
|
323
342
|
onDisconnect: onOutlookDisconnect
|
|
324
|
-
}),
|
|
343
|
+
}), showSparkpost && /*#__PURE__*/jsx(IntegrationCard, {
|
|
325
344
|
connectButtonText: "neetoEmailDelivery.sparkpost.emailDelivery.setupDomain",
|
|
326
345
|
description: ownDomainDescription,
|
|
327
346
|
icon: MailSend,
|
|
@@ -331,9 +350,19 @@ var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
|
331
350
|
onConnect: handleOwnDomainConnect,
|
|
332
351
|
onDisconnect: onSparkpostDisconnect
|
|
333
352
|
})]
|
|
334
|
-
}),
|
|
353
|
+
}), activeMessage && /*#__PURE__*/jsx(Callout, {
|
|
335
354
|
style: "success",
|
|
336
|
-
children:
|
|
355
|
+
children: activeMessage
|
|
356
|
+
}), isOutlookWaitingForTestEmail && /*#__PURE__*/jsx(Callout, {
|
|
357
|
+
style: "warning",
|
|
358
|
+
children: t("neetoEmailDelivery.outlook.waitingForTestEmail", {
|
|
359
|
+
email: outlookEmail
|
|
360
|
+
})
|
|
361
|
+
}), isOutlookShadowAccount && /*#__PURE__*/jsx(Callout, {
|
|
362
|
+
style: "warning",
|
|
363
|
+
children: t("neetoEmailDelivery.outlook.shadowAccountMessage", {
|
|
364
|
+
email: outlookEmail
|
|
365
|
+
})
|
|
337
366
|
})]
|
|
338
367
|
})
|
|
339
368
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailDeliveryScreen.js","sources":["../app/javascript/src/hooks/integrations/useGmail.js","../app/javascript/src/hooks/integrations/useOutlook.js","../app/javascript/src/components/EmailDeliveryScreen/constants.js","../app/javascript/src/components/EmailDeliveryScreen/IntegrationCard.jsx","../app/javascript/src/components/EmailDeliveryScreen/index.jsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { showThumbsUpToastr } from \"neetocommons/utils\";\nimport { useHistory } from \"react-router-dom\";\n\nimport {\n useFetchGmail,\n useDestroyGmail,\n} from \"hooks/reactQuery/integrations/useGmailIntegrationApi\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nconst useGmail = ({ ownerId, indexRoute, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n\n const history = useHistory();\n\n const queryClient = useQueryClient();\n\n const {\n isLoading,\n data = {},\n isSuccess: isGmailFetched,\n } = useFetchGmail(ownerId, { enabled: canManageIntegrations });\n\n const { isPending: isDestroying, mutate: destroyIntegration } =\n useDestroyGmail({ ownerId });\n\n const onClose = () => history.replace(indexRoute);\n\n const onDisconnect = () => {\n destroyIntegration(false, {\n onSuccess: () => {\n showThumbsUpToastr();\n setIsDisconnectAlertOpen(false);\n history.replace(indexRoute);\n },\n });\n };\n\n useEffect(() => {\n if (isGmailFetched) {\n queryClient.invalidateQueries({\n predicate: query => {\n const [key, id] = query.queryKey;\n\n return key === QUERY_KEYS.INTEGRATION_GMAIL && id !== ownerId;\n },\n });\n }\n }, [isGmailFetched, queryClient, ownerId]);\n\n return {\n data,\n isLoading,\n isDestroying,\n isConnected: data?.connected,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onDisconnect,\n onClose,\n errorMessage: data?.error,\n };\n};\n\nexport default useGmail;\n","import { useEffect, useState } from \"react\";\n\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { showThumbsUpToastr } from \"neetocommons/utils\";\nimport { useHistory } from \"react-router-dom\";\n\nimport {\n useFetchOutlook,\n useDestroyOutlook,\n} from \"hooks/reactQuery/integrations/useOutlookIntegrationApi\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nconst useOutlook = ({ ownerId, indexRoute, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n\n const history = useHistory();\n\n const queryClient = useQueryClient();\n\n const {\n isLoading,\n data = {},\n isSuccess: isOutlookFetched,\n } = useFetchOutlook(ownerId, { enabled: canManageIntegrations });\n\n const { isPending: isDestroying, mutate: destroyIntegration } =\n useDestroyOutlook({ ownerId });\n\n const onClose = () => history.replace(indexRoute);\n\n const onDisconnect = () => {\n destroyIntegration(false, {\n onSuccess: () => {\n showThumbsUpToastr();\n setIsDisconnectAlertOpen(false);\n history.replace(indexRoute);\n },\n });\n };\n\n useEffect(() => {\n if (isOutlookFetched) {\n queryClient.invalidateQueries({\n predicate: query => {\n const [key, id] = query.queryKey;\n\n return key === QUERY_KEYS.INTEGRATION_OUTLOOK && id !== ownerId;\n },\n });\n }\n }, [isOutlookFetched, queryClient, ownerId]);\n\n return {\n data,\n isLoading,\n isDestroying,\n isConnected: data?.connected,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onDisconnect,\n onClose,\n errorMessage: data?.error,\n };\n};\n\nexport default useOutlook;\n","import { t } from \"i18next\";\n\nexport const ERROR_MESSAGES = {\n gmail_permission_not_given: t(\"neetoEmailDelivery.gmail.permissionNotGiven\"),\n outlook_permission_not_given: t(\n \"neetoEmailDelivery.outlook.permissionNotGiven\"\n ),\n outlook_invalid_client: t(\"neetoEmailDelivery.outlook.invalidClient\"),\n outlook_nil_json_web_token: t(\"neetoEmailDelivery.outlook.nilJsonWebToken\"),\n};\n","import { withT } from \"neetocommons/react-utils\";\nimport { Button, Tag, Typography } from \"neetoui\";\n\nconst IntegrationCard = withT(\n ({\n t,\n icon: Icon,\n title,\n description,\n isConnected,\n isDisconnecting,\n onConnect,\n onDisconnect,\n connectButtonText,\n disconnectButtonText = \"neetoEmailDelivery.sparkpost.emailDelivery.disconnect\",\n connectedTagText = \"neetoEmailDelivery.sparkpost.emailDelivery.connected\",\n }) => (\n <div className=\"neeto-ui-rounded-lg neeto-ui-shadow-xs neeto-ui-border-gray-300 translate flex flex-col gap-y-4 border p-6 no-underline transition-transform duration-300 ease-in-out outline-none hover:-translate-y-1\">\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center gap-3\">\n <Icon className=\"shrink-0\" size={32} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <Typography style=\"h4\" weight=\"semibold\">\n {title}\n </Typography>\n {isConnected && <Tag label={t(connectedTagText)} />}\n </div>\n </div>\n </div>\n <Typography style=\"body2\">{description}</Typography>\n {connectButtonText && (\n <div className=\"flex gap-2\">\n {isConnected ? (\n <Button\n data-cy=\"disconnect-button\"\n label={t(disconnectButtonText)}\n loading={isDisconnecting}\n size=\"small\"\n style=\"danger\"\n onClick={onDisconnect}\n />\n ) : (\n <Button\n data-cy=\"connect-button\"\n label={t(connectButtonText)}\n size=\"small\"\n style=\"primary\"\n onClick={onConnect}\n />\n )}\n </div>\n )}\n </div>\n </div>\n )\n);\n\nexport default IntegrationCard;\n","import { humanize, isPresent } from \"neetocist\";\nimport { useQueryParams } from \"neetocommons/react-utils\";\nimport { buildUrl } from \"neetocommons/utils\";\nimport { MailSend } from \"neetoicons\";\nimport { Gmail as GmailIcon, Outlook as OutlookIcon } from \"neetoicons/misc\";\nimport { Spinner, Callout, Toastr } from \"neetoui\";\nimport { prop } from \"ramda\";\nimport { 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 useGmail from \"hooks/integrations/useGmail\";\nimport useOutlook from \"hooks/integrations/useOutlook\";\nimport useSparkpostDomain from \"hooks/integrations/useSparkpostDomain\";\n\nimport { ERROR_MESSAGES } from \"./constants\";\nimport IntegrationCard from \"./IntegrationCard\";\n\nconst EmailDeliveryScreen = ({\n indexRoute,\n ownerId,\n ownDomainSetupRoute,\n canManageIntegrations,\n}) => {\n const { t } = useTranslation();\n const history = useHistory();\n const { error, errorDescription } = useQueryParams();\n\n if (isPresent(error)) {\n let errorMessage = ERROR_MESSAGES[error];\n if (errorDescription) {\n errorMessage = `${errorMessage} ${errorDescription}`;\n }\n Toastr.error(errorMessage ?? humanize(error));\n\n history.replace(indexRoute);\n }\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 {\n data: gmailData = {},\n isConnected: isGmailConnected,\n isLoading: isGmailLoading,\n isDestroying: isGmailDisconnecting,\n onDisconnect: onGmailDisconnect,\n } = gmailIntegration;\n\n const {\n data: outlookData = {},\n isConnected: isOutlookConnected,\n isLoading: isOutlookLoading,\n isDestroying: isOutlookDisconnecting,\n onDisconnect: onOutlookDisconnect,\n } = outlookIntegration;\n\n const {\n data: sparkpostData = {},\n isConnected: isSparkpostConnected,\n isLoading: isSparkpostLoading,\n onDisconnect: onSparkpostDisconnect,\n isDestroying: isSparkpostDisconnecting,\n } = sparkpostIntegration;\n\n const isLoading = isGmailLoading || isOutlookLoading || isSparkpostLoading;\n const hasActiveIntegration =\n isGmailConnected || isOutlookConnected || isSparkpostConnected;\n\n const handleGmailConnect = () => {\n window.location.href = buildUrl(GMAIL_OAUTH_CONNECT_URL, { ownerId });\n };\n\n const handleOutlookConnect = () => {\n window.location.href = buildUrl(OUTLOOK_OAUTH_CONNECT_URL, { ownerId });\n };\n\n const handleOwnDomainConnect = () => {\n history.push(ownDomainSetupRoute);\n };\n\n const gmailEmail = prop(\"email\", gmailData);\n const outlookEmail = prop(\"email\", outlookData);\n const sparkpostEmail = prop(\"email\", sparkpostData);\n\n const gmailTitle = t(\"neetoEmailDelivery.gmail.title\");\n const gmailDescription = isGmailConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: gmailEmail,\n })\n : t(\"neetoEmailDelivery.gmail.description\");\n\n const outlookTitle = t(\"neetoEmailDelivery.outlook.title\");\n const outlookDescription = isOutlookConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: outlookEmail,\n })\n : t(\"neetoEmailDelivery.outlook.description\");\n\n const ownDomainTitle = t(\n \"neetoEmailDelivery.sparkpost.emailDelivery.ownDomainTitle\"\n );\n\n const ownDomainDescription = isSparkpostConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: sparkpostEmail,\n })\n : t(\"neetoEmailDelivery.sparkpost.emailDelivery.ownDomainDescription\");\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 <div className=\"min-h-0 w-full grow\">\n <div className=\"@container mx-auto space-y-6\">\n <div className=\"grid grid-cols-1 gap-3 py-1 @lg:grid-cols-2 @lg:gap-6 @3xl:grid-cols-3 @7xl:grid-cols-4\">\n {/* Gmail Option */}\n {(!hasActiveIntegration || isGmailConnected) && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.gmail.connectGmail\"\n description={gmailDescription}\n icon={GmailIcon}\n isConnected={isGmailConnected}\n isDisconnecting={isGmailDisconnecting}\n title={gmailTitle}\n onConnect={handleGmailConnect}\n onDisconnect={onGmailDisconnect}\n />\n )}\n {/* Outlook Option */}\n {(!hasActiveIntegration || isOutlookConnected) && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.outlook.connectOutlook\"\n description={outlookDescription}\n icon={OutlookIcon}\n isConnected={isOutlookConnected}\n isDisconnecting={isOutlookDisconnecting}\n title={outlookTitle}\n onConnect={handleOutlookConnect}\n onDisconnect={onOutlookDisconnect}\n />\n )}\n {/* Own Domain (Sparkpost) Option */}\n {(!hasActiveIntegration || isSparkpostConnected) && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.sparkpost.emailDelivery.setupDomain\"\n description={ownDomainDescription}\n icon={MailSend}\n isConnected={isSparkpostConnected}\n isDisconnecting={isSparkpostDisconnecting}\n title={ownDomainTitle}\n onConnect={handleOwnDomainConnect}\n onDisconnect={onSparkpostDisconnect}\n />\n )}\n </div>\n {hasActiveIntegration && (\n <Callout style=\"success\">\n {isGmailConnected\n ? t(\"neetoEmailDelivery.gmail.gmailConfigured\")\n : isOutlookConnected\n ? t(\"neetoEmailDelivery.outlook.outlookConfigured\")\n : t(\"neetoEmailDelivery.sparkpost.ownDomainConfigured\")}\n </Callout>\n )}\n </div>\n </div>\n );\n};\n\nexport default EmailDeliveryScreen;\n"],"names":["useGmail","_ref","ownerId","indexRoute","canManageIntegrations","_useState","useState","_useState2","_slicedToArray","isDisconnectAlertOpen","setIsDisconnectAlertOpen","history","useHistory","queryClient","useQueryClient","_useFetchGmail","useFetchGmail","enabled","isLoading","_useFetchGmail$data","data","isGmailFetched","isSuccess","_useDestroyGmail","useDestroyGmail","isDestroying","isPending","destroyIntegration","mutate","onClose","replace","onDisconnect","onSuccess","showThumbsUpToastr","useEffect","invalidateQueries","predicate","query","_query$queryKey","queryKey","key","id","QUERY_KEYS","INTEGRATION_GMAIL","isConnected","connected","errorMessage","error","useOutlook","_useFetchOutlook","useFetchOutlook","_useFetchOutlook$data","isOutlookFetched","_useDestroyOutlook","useDestroyOutlook","INTEGRATION_OUTLOOK","ERROR_MESSAGES","gmail_permission_not_given","t","outlook_permission_not_given","outlook_invalid_client","outlook_nil_json_web_token","IntegrationCard","withT","Icon","icon","title","description","isDisconnecting","onConnect","connectButtonText","_ref$disconnectButton","disconnectButtonText","_ref$connectedTagText","connectedTagText","_jsx","className","children","_jsxs","size","Typography","style","weight","Tag","label","Button","loading","onClick","EmailDeliveryScreen","ownDomainSetupRoute","_useTranslation","useTranslation","_useQueryParams","useQueryParams","errorDescription","isPresent","_errorMessage","concat","Toastr","humanize","gmailIntegration","outlookIntegration","sparkpostIntegration","useSparkpostDomain","_gmailIntegration$dat","gmailData","isGmailConnected","isGmailLoading","isGmailDisconnecting","onGmailDisconnect","_outlookIntegration$d","outlookData","isOutlookConnected","isOutlookLoading","isOutlookDisconnecting","onOutlookDisconnect","_sparkpostIntegration","sparkpostData","isSparkpostConnected","isSparkpostLoading","onSparkpostDisconnect","isSparkpostDisconnecting","hasActiveIntegration","handleGmailConnect","window","location","href","buildUrl","GMAIL_OAUTH_CONNECT_URL","handleOutlookConnect","OUTLOOK_OAUTH_CONNECT_URL","handleOwnDomainConnect","push","gmailEmail","prop","outlookEmail","sparkpostEmail","gmailTitle","gmailDescription","email","outlookTitle","outlookDescription","ownDomainTitle","ownDomainDescription","Spinner","GmailIcon","OutlookIcon","MailSend","Callout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAAuD;AAAA,EAAA,IAAjDC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEC,UAAU,GAAAF,IAAA,CAAVE,UAAU;IAAEC,qBAAqB,GAAAH,IAAA,CAArBG,qBAAqB;AAC5D,EAAA,IAAAC,SAAA,GAA0DC,QAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlEI,IAAAA,qBAAqB,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,wBAAwB,GAAAH,UAAA,CAAA,CAAA,CAAA;AAEtD,EAAA,IAAMI,OAAO,GAAGC,UAAU,EAAE;AAE5B,EAAA,IAAMC,WAAW,GAAGC,cAAc,EAAE;AAEpC,EAAA,IAAAC,cAAA,GAIIC,aAAa,CAACd,OAAO,EAAE;AAAEe,MAAAA,OAAO,EAAEb;AAAsB,KAAC,CAAC;IAH5Dc,SAAS,GAAAH,cAAA,CAATG,SAAS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AE4E,cAAe;AACtBzE,UAAAA,SAAS,EAAE8D,sBAAuB;AAClCpG,UAAAA,YAAY,EAAEyF;AAAsB,SACrC,CACF;AAAA,OACE,CAAC,EACLE,oBAAoB,iBACnB/C,GAAA,CAACyE,OAAO,EAAA;AAACnE,QAAAA,KAAK,EAAC,SAAS;AAAAJ,QAAAA,QAAA,EACrB6B,gBAAgB,GACbhD,CAAC,CAAC,0CAA0C,CAAC,GAC7CsD,kBAAkB,GAChBtD,CAAC,CAAC,8CAA8C,CAAC,GACjDA,CAAC,CAAC,kDAAkD;AAAC,OACpD,CACV;KACE;AAAC,GACH,CAAC;AAEV;;;;"}
|
|
1
|
+
{"version":3,"file":"EmailDeliveryScreen.js","sources":["../app/javascript/src/hooks/integrations/useGmail.js","../app/javascript/src/hooks/integrations/useOutlook.js","../app/javascript/src/components/EmailDeliveryScreen/constants.js","../app/javascript/src/components/EmailDeliveryScreen/IntegrationCard.jsx","../app/javascript/src/components/EmailDeliveryScreen/index.jsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { showThumbsUpToastr } from \"neetocommons/utils\";\nimport { useHistory } from \"react-router-dom\";\n\nimport {\n useFetchGmail,\n useDestroyGmail,\n} from \"hooks/reactQuery/integrations/useGmailIntegrationApi\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nconst useGmail = ({ ownerId, indexRoute, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n\n const history = useHistory();\n\n const queryClient = useQueryClient();\n\n const {\n isLoading,\n data = {},\n isSuccess: isGmailFetched,\n } = useFetchGmail(ownerId, { enabled: canManageIntegrations });\n\n const { isPending: isDestroying, mutate: destroyIntegration } =\n useDestroyGmail({ ownerId });\n\n const onClose = () => history.replace(indexRoute);\n\n const onDisconnect = () => {\n destroyIntegration(false, {\n onSuccess: () => {\n showThumbsUpToastr();\n setIsDisconnectAlertOpen(false);\n history.replace(indexRoute);\n },\n });\n };\n\n useEffect(() => {\n if (isGmailFetched) {\n queryClient.invalidateQueries({\n predicate: query => {\n const [key, id] = query.queryKey;\n\n return key === QUERY_KEYS.INTEGRATION_GMAIL && id !== ownerId;\n },\n });\n }\n }, [isGmailFetched, queryClient, ownerId]);\n\n return {\n data,\n isLoading,\n isDestroying,\n exists: data?.exists,\n isConnected: data?.connected,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onDisconnect,\n onClose,\n errorMessage: data?.error,\n };\n};\n\nexport default useGmail;\n","import { useEffect, useState } from \"react\";\n\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { showThumbsUpToastr } from \"neetocommons/utils\";\nimport { useHistory } from \"react-router-dom\";\n\nimport {\n useFetchOutlook,\n useDestroyOutlook,\n} from \"hooks/reactQuery/integrations/useOutlookIntegrationApi\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nconst useOutlook = ({ ownerId, indexRoute, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n\n const history = useHistory();\n\n const queryClient = useQueryClient();\n\n const {\n isLoading,\n data = {},\n isSuccess: isOutlookFetched,\n } = useFetchOutlook(ownerId, { enabled: canManageIntegrations });\n\n const { isPending: isDestroying, mutate: destroyIntegration } =\n useDestroyOutlook({ ownerId });\n\n const onClose = () => history.replace(indexRoute);\n\n const onDisconnect = () => {\n destroyIntegration(false, {\n onSuccess: () => {\n showThumbsUpToastr();\n setIsDisconnectAlertOpen(false);\n history.replace(indexRoute);\n },\n });\n };\n\n useEffect(() => {\n if (isOutlookFetched) {\n queryClient.invalidateQueries({\n predicate: query => {\n const [key, id] = query.queryKey;\n\n return key === QUERY_KEYS.INTEGRATION_OUTLOOK && id !== ownerId;\n },\n });\n }\n }, [isOutlookFetched, queryClient, ownerId]);\n\n return {\n data,\n isLoading,\n exists: data?.exists,\n status: data?.status,\n shadowAccount: data?.shadowAccount,\n isWaitingForTestEmail: data?.status === \"inactive\" && !data?.connected,\n isDestroying,\n isConnected: data?.connected,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onDisconnect,\n onClose,\n errorMessage: data?.error,\n };\n};\n\nexport default useOutlook;\n","import { t } from \"i18next\";\n\nexport const ERROR_MESSAGES = {\n gmail_permission_not_given: t(\"neetoEmailDelivery.gmail.permissionNotGiven\"),\n outlook_permission_not_given: t(\n \"neetoEmailDelivery.outlook.permissionNotGiven\"\n ),\n outlook_invalid_client: t(\"neetoEmailDelivery.outlook.invalidClient\"),\n outlook_nil_json_web_token: t(\"neetoEmailDelivery.outlook.nilJsonWebToken\"),\n};\n","import { Button, Tag, Typography } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nconst IntegrationCard = ({\n icon: Icon,\n title,\n description,\n isConnected,\n isDisconnecting,\n onConnect,\n onDisconnect,\n connectButtonText,\n disconnectButtonText = \"neetoEmailDelivery.sparkpost.emailDelivery.disconnect\",\n connectedTagText = \"neetoEmailDelivery.sparkpost.emailDelivery.connected\",\n showDisconnect = false,\n}) => {\n const { t } = useTranslation();\n\n const shouldShowDisconnect = isConnected || showDisconnect;\n\n return (\n <div className=\"neeto-ui-rounded-lg neeto-ui-shadow-xs neeto-ui-border-gray-300 translate flex flex-col gap-y-4 border p-6 no-underline transition-transform duration-300 ease-in-out outline-none hover:-translate-y-1\">\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center gap-3\">\n <Icon className=\"shrink-0\" size={32} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <Typography style=\"h4\" weight=\"semibold\">\n {title}\n </Typography>\n {isConnected && <Tag label={t(connectedTagText)} />}\n </div>\n </div>\n </div>\n <Typography style=\"body2\">{description}</Typography>\n {connectButtonText && (\n <div className=\"flex gap-2\">\n {shouldShowDisconnect ? (\n <Button\n data-cy=\"disconnect-button\"\n label={t(disconnectButtonText)}\n loading={isDisconnecting}\n size=\"small\"\n style=\"danger\"\n onClick={onDisconnect}\n />\n ) : (\n <Button\n data-cy=\"connect-button\"\n label={t(connectButtonText)}\n size=\"small\"\n style=\"primary\"\n onClick={onConnect}\n />\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default IntegrationCard;\n","import { humanize, isPresent } from \"neetocist\";\nimport { useQueryParams } from \"neetocommons/react-utils\";\nimport { buildUrl } from \"neetocommons/utils\";\nimport { MailSend } from \"neetoicons\";\nimport { Gmail as GmailIcon, Outlook as OutlookIcon } from \"neetoicons/misc\";\nimport { Spinner, Callout, Toastr } from \"neetoui\";\nimport { prop } from \"ramda\";\nimport { 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 useGmail from \"hooks/integrations/useGmail\";\nimport useOutlook from \"hooks/integrations/useOutlook\";\nimport useSparkpostDomain from \"hooks/integrations/useSparkpostDomain\";\n\nimport { ERROR_MESSAGES } from \"./constants\";\nimport IntegrationCard from \"./IntegrationCard\";\n\nconst EmailDeliveryScreen = ({\n indexRoute,\n ownerId,\n ownDomainSetupRoute,\n canManageIntegrations,\n}) => {\n const { t } = useTranslation();\n const history = useHistory();\n const { error, errorDescription } = useQueryParams();\n\n if (isPresent(error)) {\n let errorMessage = ERROR_MESSAGES[error];\n if (errorDescription) {\n errorMessage = `${errorMessage} ${errorDescription}`;\n }\n Toastr.error(errorMessage ?? humanize(error));\n\n history.replace(indexRoute);\n }\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 {\n data: gmailData = {},\n isConnected: isGmailConnected,\n isLoading: isGmailLoading,\n isDestroying: isGmailDisconnecting,\n onDisconnect: onGmailDisconnect,\n exists: isGmailExists,\n } = gmailIntegration;\n\n const {\n data: outlookData = {},\n isConnected: isOutlookConnected,\n isLoading: isOutlookLoading,\n isDestroying: isOutlookDisconnecting,\n isWaitingForTestEmail: isOutlookWaitingForTestEmail,\n shadowAccount: isOutlookShadowAccount,\n onDisconnect: onOutlookDisconnect,\n exists: isOutlookExists,\n } = outlookIntegration;\n\n const {\n data: sparkpostData = {},\n isConnected: isSparkpostConnected,\n isLoading: isSparkpostLoading,\n onDisconnect: onSparkpostDisconnect,\n isDestroying: isSparkpostDisconnecting,\n exists: isSparkpostExists,\n } = sparkpostIntegration;\n\n const isLoading = isGmailLoading || isOutlookLoading || isSparkpostLoading;\n const noneExists = !isGmailExists && !isOutlookExists && !isSparkpostExists;\n const showGmail = noneExists || isGmailExists;\n const showOutlook = noneExists || isOutlookExists;\n const showSparkpost = noneExists || isSparkpostExists;\n\n const handleGmailConnect = () => {\n window.location.href = buildUrl(GMAIL_OAUTH_CONNECT_URL, { ownerId });\n };\n\n const handleOutlookConnect = () => {\n window.location.href = buildUrl(OUTLOOK_OAUTH_CONNECT_URL, { ownerId });\n };\n\n const handleOwnDomainConnect = () => {\n history.push(ownDomainSetupRoute);\n };\n\n const gmailEmail = prop(\"email\", gmailData);\n const outlookEmail = prop(\"email\", outlookData);\n const sparkpostEmail = prop(\"email\", sparkpostData);\n\n const gmailTitle = t(\"neetoEmailDelivery.gmail.title\");\n const gmailDescription = isGmailConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: gmailEmail,\n })\n : t(\"neetoEmailDelivery.gmail.description\");\n\n const outlookTitle = t(\"neetoEmailDelivery.outlook.title\");\n const outlookDescription = isOutlookConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: outlookEmail,\n })\n : t(\"neetoEmailDelivery.outlook.description\");\n\n const ownDomainTitle = t(\n \"neetoEmailDelivery.sparkpost.emailDelivery.ownDomainTitle\"\n );\n\n const ownDomainDescription = isSparkpostConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: sparkpostEmail,\n })\n : t(\"neetoEmailDelivery.sparkpost.emailDelivery.ownDomainDescription\");\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 const activeMessage =\n (isGmailConnected && t(\"neetoEmailDelivery.gmail.gmailConfigured\")) ||\n (isOutlookConnected && t(\"neetoEmailDelivery.outlook.outlookConfigured\")) ||\n (isSparkpostConnected &&\n t(\"neetoEmailDelivery.sparkpost.ownDomainConfigured\"));\n\n return (\n <div className=\"min-h-0 w-full grow\">\n <div className=\"@container mx-auto space-y-6\">\n <div className=\"grid grid-cols-1 gap-3 py-1 @lg:grid-cols-2 @lg:gap-6 @3xl:grid-cols-3 @7xl:grid-cols-4\">\n {/* Gmail Option */}\n {showGmail && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.gmail.connectGmail\"\n description={gmailDescription}\n icon={GmailIcon}\n isConnected={isGmailConnected}\n isDisconnecting={isGmailDisconnecting}\n title={gmailTitle}\n onConnect={handleGmailConnect}\n onDisconnect={onGmailDisconnect}\n />\n )}\n {/* Outlook Option */}\n {showOutlook && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.outlook.connectOutlook\"\n description={outlookDescription}\n icon={OutlookIcon}\n isConnected={isOutlookConnected}\n isDisconnecting={isOutlookDisconnecting}\n title={outlookTitle}\n showDisconnect={\n isOutlookWaitingForTestEmail || isOutlookShadowAccount\n }\n onConnect={handleOutlookConnect}\n onDisconnect={onOutlookDisconnect}\n />\n )}\n {/* Own Domain (Sparkpost) Option */}\n {showSparkpost && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.sparkpost.emailDelivery.setupDomain\"\n description={ownDomainDescription}\n icon={MailSend}\n isConnected={isSparkpostConnected}\n isDisconnecting={isSparkpostDisconnecting}\n title={ownDomainTitle}\n onConnect={handleOwnDomainConnect}\n onDisconnect={onSparkpostDisconnect}\n />\n )}\n </div>\n {activeMessage && <Callout style=\"success\">{activeMessage}</Callout>}\n {isOutlookWaitingForTestEmail && (\n <Callout style=\"warning\">\n {t(\"neetoEmailDelivery.outlook.waitingForTestEmail\", {\n email: outlookEmail,\n })}\n </Callout>\n )}\n {isOutlookShadowAccount && (\n <Callout style=\"warning\">\n {t(\"neetoEmailDelivery.outlook.shadowAccountMessage\", {\n email: outlookEmail,\n })}\n </Callout>\n )}\n </div>\n </div>\n );\n};\n\nexport default EmailDeliveryScreen;\n"],"names":["useGmail","_ref","ownerId","indexRoute","canManageIntegrations","_useState","useState","_useState2","_slicedToArray","isDisconnectAlertOpen","setIsDisconnectAlertOpen","history","useHistory","queryClient","useQueryClient","_useFetchGmail","useFetchGmail","enabled","isLoading","_useFetchGmail$data","data","isGmailFetched","isSuccess","_useDestroyGmail","useDestroyGmail","isDestroying","isPending","destroyIntegration","mutate","onClose","replace","onDisconnect","onSuccess","showThumbsUpToastr","useEffect","invalidateQueries","predicate","query","_query$queryKey","queryKey","key","id","QUERY_KEYS","INTEGRATION_GMAIL","exists","isConnected","connected","errorMessage","error","useOutlook","_useFetchOutlook","useFetchOutlook","_useFetchOutlook$data","isOutlookFetched","_useDestroyOutlook","useDestroyOutlook","INTEGRATION_OUTLOOK","status","shadowAccount","isWaitingForTestEmail","ERROR_MESSAGES","gmail_permission_not_given","t","outlook_permission_not_given","outlook_invalid_client","outlook_nil_json_web_token","IntegrationCard","Icon","icon","title","description","isDisconnecting","onConnect","connectButtonText","_ref$disconnectButton","disconnectButtonText","_ref$connectedTagText","connectedTagText","_ref$showDisconnect","showDisconnect","_useTranslation","useTranslation","shouldShowDisconnect","_jsx","className","children","_jsxs","size","Typography","style","weight","Tag","label","Button","loading","onClick","EmailDeliveryScreen","ownDomainSetupRoute","_useQueryParams","useQueryParams","errorDescription","isPresent","_errorMessage","concat","Toastr","humanize","gmailIntegration","outlookIntegration","sparkpostIntegration","useSparkpostDomain","_gmailIntegration$dat","gmailData","isGmailConnected","isGmailLoading","isGmailDisconnecting","onGmailDisconnect","isGmailExists","_outlookIntegration$d","outlookData","isOutlookConnected","isOutlookLoading","isOutlookDisconnecting","isOutlookWaitingForTestEmail","isOutlookShadowAccount","onOutlookDisconnect","isOutlookExists","_sparkpostIntegration","sparkpostData","isSparkpostConnected","isSparkpostLoading","onSparkpostDisconnect","isSparkpostDisconnecting","isSparkpostExists","noneExists","showGmail","showOutlook","showSparkpost","handleGmailConnect","window","location","href","buildUrl","GMAIL_OAUTH_CONNECT_URL","handleOutlookConnect","OUTLOOK_OAUTH_CONNECT_URL","handleOwnDomainConnect","push","gmailEmail","prop","outlookEmail","sparkpostEmail","gmailTitle","gmailDescription","email","outlookTitle","outlookDescription","ownDomainTitle","ownDomainDescription","Spinner","activeMessage","GmailIcon","OutlookIcon","MailSend","Callout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAAuD;AAAA,EAAA,IAAjDC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEC,UAAU,GAAAF,IAAA,CAAVE,UAAU;IAAEC,qBAAqB,GAAAH,IAAA,CAArBG,qBAAqB;AAC5D,EAAA,IAAAC,SAAA,GAA0DC,QAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlEI,IAAAA,qBAAqB,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,wBAAwB,GAAAH,UAAA,CAAA,CAAA,CAAA;AAEtD,EAAA,IAAMI,OAAO,GAAGC,UAAU,EAAE;AAE5B,EAAA,IAAMC,WAAW,GAAGC,cAAc,EAAE;AAEpC,EAAA,IAAAC,cAAA,GAIIC,aAAa,CAACd,OAAO,EAAE;AAAEe,MAAAA,OAAO,EAAEb;AAAsB,KAAC,CAAC;IAH5Dc,SAAS,GAAAH,cAAA,CAATG,SAAS;IAAAC,mBAAA,GAAAJ,cAAA,CACTK,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SACnC,CACF,EAEAY,aAAa,iBACZrD,GAAA,CAACjB,eAAe,EAAA;AACdO,UAAAA,iBAAiB,EAAC,wDAAwD;AAC1EH,UAAAA,WAAW,EAAEuF,oBAAqB;AAClCzF,UAAAA,IAAI,EAAE8F,QAAS;AACfrH,UAAAA,WAAW,EAAEmF,oBAAqB;AAClCzD,UAAAA,eAAe,EAAE4D,wBAAyB;AAC1C9D,UAAAA,KAAK,EAAEuF,cAAe;AACtBpF,UAAAA,SAAS,EAAEyE,sBAAuB;AAClClH,UAAAA,YAAY,EAAEmG;AAAsB,SACrC,CACF;AAAA,OACE,CAAC,EACL6B,aAAa,iBAAI5E,GAAA,CAACgF,OAAO,EAAA;AAAC1E,QAAAA,KAAK,EAAC,SAAS;AAAAJ,QAAAA,QAAA,EAAE0E;AAAa,OAAU,CAAC,EACnErC,4BAA4B,iBAC3BvC,GAAA,CAACgF,OAAO,EAAA;AAAC1E,QAAAA,KAAK,EAAC,SAAS;AAAAJ,QAAAA,QAAA,EACrBvB,CAAC,CAAC,gDAAgD,EAAE;AACnD2F,UAAAA,KAAK,EAAEJ;SACR;AAAC,OACK,CACV,EACA1B,sBAAsB,iBACrBxC,GAAA,CAACgF,OAAO,EAAA;AAAC1E,QAAAA,KAAK,EAAC,SAAS;AAAAJ,QAAAA,QAAA,EACrBvB,CAAC,CAAC,iDAAiD,EAAE;AACpD2F,UAAAA,KAAK,EAAEJ;SACR;AAAC,OACK,CACV;KACE;AAAC,GACH,CAAC;AAEV;;;;"}
|
|
@@ -7,7 +7,7 @@ import Form from '@bigbinary/neetoui/formik/Form';
|
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
import { useHistory } from 'react-router-dom';
|
|
9
9
|
import { P as PageWrapper, a as PageContent, V as VALIDATION_SCHEMA } from './constants-Cvxv8ly7.js';
|
|
10
|
-
import { u as useSparkpostDomain } from './useSparkpostDomain-
|
|
10
|
+
import { u as useSparkpostDomain } from './useSparkpostDomain-DO4bG1HD.js';
|
|
11
11
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
12
12
|
import '@babel/runtime/helpers/defineProperty';
|
|
13
13
|
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
@@ -7,7 +7,7 @@ import { isEmpty, pathOr } from 'ramda';
|
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
import { useHistory } from 'react-router-dom';
|
|
9
9
|
import { b as PURPOSE_COLORS, D as DEFAULT_COLOR, c as VERIFICATION_STATUS_CONFIG, d as VERIFICATION_STATUSES, P as PageWrapper, a as PageContent } from './constants-Cvxv8ly7.js';
|
|
10
|
-
import { u as useSparkpostDomain } from './useSparkpostDomain-
|
|
10
|
+
import { u as useSparkpostDomain } from './useSparkpostDomain-DO4bG1HD.js';
|
|
11
11
|
import { u as useFetchSparkpostDomain } from './useSparkpostApi-W7XibjIp.js';
|
|
12
12
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
13
13
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
@@ -17,7 +17,7 @@ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
|
17
17
|
var react = require('react');
|
|
18
18
|
var reactQuery = require('@tanstack/react-query');
|
|
19
19
|
var useOutlookIntegrationApi = require('../useOutlookIntegrationApi-CtHj_BzG.js');
|
|
20
|
-
var useSparkpostDomain = require('../useSparkpostDomain-
|
|
20
|
+
var useSparkpostDomain = require('../useSparkpostDomain-wsENCoto.js');
|
|
21
21
|
var i18next = require('i18next');
|
|
22
22
|
var Button = require('@bigbinary/neetoui/Button');
|
|
23
23
|
var Tag = require('@bigbinary/neetoui/Tag');
|
|
@@ -76,6 +76,7 @@ var useGmail = function useGmail(_ref) {
|
|
|
76
76
|
data: data,
|
|
77
77
|
isLoading: isLoading,
|
|
78
78
|
isDestroying: isDestroying,
|
|
79
|
+
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
79
80
|
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
80
81
|
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
81
82
|
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
@@ -134,6 +135,10 @@ var useOutlook = function useOutlook(_ref) {
|
|
|
134
135
|
return {
|
|
135
136
|
data: data,
|
|
136
137
|
isLoading: isLoading,
|
|
138
|
+
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
139
|
+
status: data === null || data === void 0 ? void 0 : data.status,
|
|
140
|
+
shadowAccount: data === null || data === void 0 ? void 0 : data.shadowAccount,
|
|
141
|
+
isWaitingForTestEmail: (data === null || data === void 0 ? void 0 : data.status) === "inactive" && !(data !== null && data !== void 0 && data.connected),
|
|
137
142
|
isDestroying: isDestroying,
|
|
138
143
|
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
139
144
|
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
@@ -151,9 +156,8 @@ var ERROR_MESSAGES = {
|
|
|
151
156
|
outlook_nil_json_web_token: i18next.t("neetoEmailDelivery.outlook.nilJsonWebToken")
|
|
152
157
|
};
|
|
153
158
|
|
|
154
|
-
var IntegrationCard =
|
|
155
|
-
var
|
|
156
|
-
Icon = _ref.icon,
|
|
159
|
+
var IntegrationCard = function IntegrationCard(_ref) {
|
|
160
|
+
var Icon = _ref.icon,
|
|
157
161
|
title = _ref.title,
|
|
158
162
|
description = _ref.description,
|
|
159
163
|
isConnected = _ref.isConnected,
|
|
@@ -164,7 +168,12 @@ var IntegrationCard = reactUtils.withT(function (_ref) {
|
|
|
164
168
|
_ref$disconnectButton = _ref.disconnectButtonText,
|
|
165
169
|
disconnectButtonText = _ref$disconnectButton === void 0 ? "neetoEmailDelivery.sparkpost.emailDelivery.disconnect" : _ref$disconnectButton,
|
|
166
170
|
_ref$connectedTagText = _ref.connectedTagText,
|
|
167
|
-
connectedTagText = _ref$connectedTagText === void 0 ? "neetoEmailDelivery.sparkpost.emailDelivery.connected" : _ref$connectedTagText
|
|
171
|
+
connectedTagText = _ref$connectedTagText === void 0 ? "neetoEmailDelivery.sparkpost.emailDelivery.connected" : _ref$connectedTagText,
|
|
172
|
+
_ref$showDisconnect = _ref.showDisconnect,
|
|
173
|
+
showDisconnect = _ref$showDisconnect === void 0 ? false : _ref$showDisconnect;
|
|
174
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
175
|
+
t = _useTranslation.t;
|
|
176
|
+
var shouldShowDisconnect = isConnected || showDisconnect;
|
|
168
177
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
169
178
|
className: "neeto-ui-rounded-lg neeto-ui-shadow-xs neeto-ui-border-gray-300 translate flex flex-col gap-y-4 border p-6 no-underline transition-transform duration-300 ease-in-out outline-none hover:-translate-y-1",
|
|
170
179
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -192,7 +201,7 @@ var IntegrationCard = reactUtils.withT(function (_ref) {
|
|
|
192
201
|
children: description
|
|
193
202
|
}), connectButtonText && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
194
203
|
className: "flex gap-2",
|
|
195
|
-
children:
|
|
204
|
+
children: shouldShowDisconnect ? /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
196
205
|
"data-cy": "disconnect-button",
|
|
197
206
|
label: t(disconnectButtonText),
|
|
198
207
|
loading: isDisconnecting,
|
|
@@ -209,7 +218,7 @@ var IntegrationCard = reactUtils.withT(function (_ref) {
|
|
|
209
218
|
})]
|
|
210
219
|
})
|
|
211
220
|
});
|
|
212
|
-
}
|
|
221
|
+
};
|
|
213
222
|
|
|
214
223
|
var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
215
224
|
var indexRoute = _ref.indexRoute,
|
|
@@ -250,21 +259,29 @@ var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
|
250
259
|
isGmailConnected = gmailIntegration.isConnected,
|
|
251
260
|
isGmailLoading = gmailIntegration.isLoading,
|
|
252
261
|
isGmailDisconnecting = gmailIntegration.isDestroying,
|
|
253
|
-
onGmailDisconnect = gmailIntegration.onDisconnect
|
|
262
|
+
onGmailDisconnect = gmailIntegration.onDisconnect,
|
|
263
|
+
isGmailExists = gmailIntegration.exists;
|
|
254
264
|
var _outlookIntegration$d = outlookIntegration.data,
|
|
255
265
|
outlookData = _outlookIntegration$d === void 0 ? {} : _outlookIntegration$d,
|
|
256
266
|
isOutlookConnected = outlookIntegration.isConnected,
|
|
257
267
|
isOutlookLoading = outlookIntegration.isLoading,
|
|
258
268
|
isOutlookDisconnecting = outlookIntegration.isDestroying,
|
|
259
|
-
|
|
269
|
+
isOutlookWaitingForTestEmail = outlookIntegration.isWaitingForTestEmail,
|
|
270
|
+
isOutlookShadowAccount = outlookIntegration.shadowAccount,
|
|
271
|
+
onOutlookDisconnect = outlookIntegration.onDisconnect,
|
|
272
|
+
isOutlookExists = outlookIntegration.exists;
|
|
260
273
|
var _sparkpostIntegration = sparkpostIntegration.data,
|
|
261
274
|
sparkpostData = _sparkpostIntegration === void 0 ? {} : _sparkpostIntegration,
|
|
262
275
|
isSparkpostConnected = sparkpostIntegration.isConnected,
|
|
263
276
|
isSparkpostLoading = sparkpostIntegration.isLoading,
|
|
264
277
|
onSparkpostDisconnect = sparkpostIntegration.onDisconnect,
|
|
265
|
-
isSparkpostDisconnecting = sparkpostIntegration.isDestroying
|
|
278
|
+
isSparkpostDisconnecting = sparkpostIntegration.isDestroying,
|
|
279
|
+
isSparkpostExists = sparkpostIntegration.exists;
|
|
266
280
|
var isLoading = isGmailLoading || isOutlookLoading || isSparkpostLoading;
|
|
267
|
-
var
|
|
281
|
+
var noneExists = !isGmailExists && !isOutlookExists && !isSparkpostExists;
|
|
282
|
+
var showGmail = noneExists || isGmailExists;
|
|
283
|
+
var showOutlook = noneExists || isOutlookExists;
|
|
284
|
+
var showSparkpost = noneExists || isSparkpostExists;
|
|
268
285
|
var handleGmailConnect = function handleGmailConnect() {
|
|
269
286
|
window.location.href = utils.buildUrl(useSparkpostApi.GMAIL_OAUTH_CONNECT_URL, {
|
|
270
287
|
ownerId: ownerId
|
|
@@ -299,13 +316,14 @@ var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
|
299
316
|
children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
|
|
300
317
|
});
|
|
301
318
|
}
|
|
319
|
+
var activeMessage = isGmailConnected && t("neetoEmailDelivery.gmail.gmailConfigured") || isOutlookConnected && t("neetoEmailDelivery.outlook.outlookConfigured") || isSparkpostConnected && t("neetoEmailDelivery.sparkpost.ownDomainConfigured");
|
|
302
320
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
303
321
|
className: "min-h-0 w-full grow",
|
|
304
322
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
305
323
|
className: "@container mx-auto space-y-6",
|
|
306
324
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
307
325
|
className: "grid grid-cols-1 gap-3 py-1 @lg:grid-cols-2 @lg:gap-6 @3xl:grid-cols-3 @7xl:grid-cols-4",
|
|
308
|
-
children: [
|
|
326
|
+
children: [showGmail && /*#__PURE__*/jsxRuntime.jsx(IntegrationCard, {
|
|
309
327
|
connectButtonText: "neetoEmailDelivery.gmail.connectGmail",
|
|
310
328
|
description: gmailDescription,
|
|
311
329
|
icon: GmailIcon,
|
|
@@ -314,16 +332,17 @@ var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
|
314
332
|
title: gmailTitle,
|
|
315
333
|
onConnect: handleGmailConnect,
|
|
316
334
|
onDisconnect: onGmailDisconnect
|
|
317
|
-
}),
|
|
335
|
+
}), showOutlook && /*#__PURE__*/jsxRuntime.jsx(IntegrationCard, {
|
|
318
336
|
connectButtonText: "neetoEmailDelivery.outlook.connectOutlook",
|
|
319
337
|
description: outlookDescription,
|
|
320
338
|
icon: OutlookIcon,
|
|
321
339
|
isConnected: isOutlookConnected,
|
|
322
340
|
isDisconnecting: isOutlookDisconnecting,
|
|
323
341
|
title: outlookTitle,
|
|
342
|
+
showDisconnect: isOutlookWaitingForTestEmail || isOutlookShadowAccount,
|
|
324
343
|
onConnect: handleOutlookConnect,
|
|
325
344
|
onDisconnect: onOutlookDisconnect
|
|
326
|
-
}),
|
|
345
|
+
}), showSparkpost && /*#__PURE__*/jsxRuntime.jsx(IntegrationCard, {
|
|
327
346
|
connectButtonText: "neetoEmailDelivery.sparkpost.emailDelivery.setupDomain",
|
|
328
347
|
description: ownDomainDescription,
|
|
329
348
|
icon: MailSend,
|
|
@@ -333,9 +352,19 @@ var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
|
333
352
|
onConnect: handleOwnDomainConnect,
|
|
334
353
|
onDisconnect: onSparkpostDisconnect
|
|
335
354
|
})]
|
|
336
|
-
}),
|
|
355
|
+
}), activeMessage && /*#__PURE__*/jsxRuntime.jsx(Callout, {
|
|
337
356
|
style: "success",
|
|
338
|
-
children:
|
|
357
|
+
children: activeMessage
|
|
358
|
+
}), isOutlookWaitingForTestEmail && /*#__PURE__*/jsxRuntime.jsx(Callout, {
|
|
359
|
+
style: "warning",
|
|
360
|
+
children: t("neetoEmailDelivery.outlook.waitingForTestEmail", {
|
|
361
|
+
email: outlookEmail
|
|
362
|
+
})
|
|
363
|
+
}), isOutlookShadowAccount && /*#__PURE__*/jsxRuntime.jsx(Callout, {
|
|
364
|
+
style: "warning",
|
|
365
|
+
children: t("neetoEmailDelivery.outlook.shadowAccountMessage", {
|
|
366
|
+
email: outlookEmail
|
|
367
|
+
})
|
|
339
368
|
})]
|
|
340
369
|
})
|
|
341
370
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailDeliveryScreen.js","sources":["../../app/javascript/src/hooks/integrations/useGmail.js","../../app/javascript/src/hooks/integrations/useOutlook.js","../../app/javascript/src/components/EmailDeliveryScreen/constants.js","../../app/javascript/src/components/EmailDeliveryScreen/IntegrationCard.jsx","../../app/javascript/src/components/EmailDeliveryScreen/index.jsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { showThumbsUpToastr } from \"neetocommons/utils\";\nimport { useHistory } from \"react-router-dom\";\n\nimport {\n useFetchGmail,\n useDestroyGmail,\n} from \"hooks/reactQuery/integrations/useGmailIntegrationApi\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nconst useGmail = ({ ownerId, indexRoute, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n\n const history = useHistory();\n\n const queryClient = useQueryClient();\n\n const {\n isLoading,\n data = {},\n isSuccess: isGmailFetched,\n } = useFetchGmail(ownerId, { enabled: canManageIntegrations });\n\n const { isPending: isDestroying, mutate: destroyIntegration } =\n useDestroyGmail({ ownerId });\n\n const onClose = () => history.replace(indexRoute);\n\n const onDisconnect = () => {\n destroyIntegration(false, {\n onSuccess: () => {\n showThumbsUpToastr();\n setIsDisconnectAlertOpen(false);\n history.replace(indexRoute);\n },\n });\n };\n\n useEffect(() => {\n if (isGmailFetched) {\n queryClient.invalidateQueries({\n predicate: query => {\n const [key, id] = query.queryKey;\n\n return key === QUERY_KEYS.INTEGRATION_GMAIL && id !== ownerId;\n },\n });\n }\n }, [isGmailFetched, queryClient, ownerId]);\n\n return {\n data,\n isLoading,\n isDestroying,\n isConnected: data?.connected,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onDisconnect,\n onClose,\n errorMessage: data?.error,\n };\n};\n\nexport default useGmail;\n","import { useEffect, useState } from \"react\";\n\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { showThumbsUpToastr } from \"neetocommons/utils\";\nimport { useHistory } from \"react-router-dom\";\n\nimport {\n useFetchOutlook,\n useDestroyOutlook,\n} from \"hooks/reactQuery/integrations/useOutlookIntegrationApi\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nconst useOutlook = ({ ownerId, indexRoute, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n\n const history = useHistory();\n\n const queryClient = useQueryClient();\n\n const {\n isLoading,\n data = {},\n isSuccess: isOutlookFetched,\n } = useFetchOutlook(ownerId, { enabled: canManageIntegrations });\n\n const { isPending: isDestroying, mutate: destroyIntegration } =\n useDestroyOutlook({ ownerId });\n\n const onClose = () => history.replace(indexRoute);\n\n const onDisconnect = () => {\n destroyIntegration(false, {\n onSuccess: () => {\n showThumbsUpToastr();\n setIsDisconnectAlertOpen(false);\n history.replace(indexRoute);\n },\n });\n };\n\n useEffect(() => {\n if (isOutlookFetched) {\n queryClient.invalidateQueries({\n predicate: query => {\n const [key, id] = query.queryKey;\n\n return key === QUERY_KEYS.INTEGRATION_OUTLOOK && id !== ownerId;\n },\n });\n }\n }, [isOutlookFetched, queryClient, ownerId]);\n\n return {\n data,\n isLoading,\n isDestroying,\n isConnected: data?.connected,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onDisconnect,\n onClose,\n errorMessage: data?.error,\n };\n};\n\nexport default useOutlook;\n","import { t } from \"i18next\";\n\nexport const ERROR_MESSAGES = {\n gmail_permission_not_given: t(\"neetoEmailDelivery.gmail.permissionNotGiven\"),\n outlook_permission_not_given: t(\n \"neetoEmailDelivery.outlook.permissionNotGiven\"\n ),\n outlook_invalid_client: t(\"neetoEmailDelivery.outlook.invalidClient\"),\n outlook_nil_json_web_token: t(\"neetoEmailDelivery.outlook.nilJsonWebToken\"),\n};\n","import { withT } from \"neetocommons/react-utils\";\nimport { Button, Tag, Typography } from \"neetoui\";\n\nconst IntegrationCard = withT(\n ({\n t,\n icon: Icon,\n title,\n description,\n isConnected,\n isDisconnecting,\n onConnect,\n onDisconnect,\n connectButtonText,\n disconnectButtonText = \"neetoEmailDelivery.sparkpost.emailDelivery.disconnect\",\n connectedTagText = \"neetoEmailDelivery.sparkpost.emailDelivery.connected\",\n }) => (\n <div className=\"neeto-ui-rounded-lg neeto-ui-shadow-xs neeto-ui-border-gray-300 translate flex flex-col gap-y-4 border p-6 no-underline transition-transform duration-300 ease-in-out outline-none hover:-translate-y-1\">\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center gap-3\">\n <Icon className=\"shrink-0\" size={32} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <Typography style=\"h4\" weight=\"semibold\">\n {title}\n </Typography>\n {isConnected && <Tag label={t(connectedTagText)} />}\n </div>\n </div>\n </div>\n <Typography style=\"body2\">{description}</Typography>\n {connectButtonText && (\n <div className=\"flex gap-2\">\n {isConnected ? (\n <Button\n data-cy=\"disconnect-button\"\n label={t(disconnectButtonText)}\n loading={isDisconnecting}\n size=\"small\"\n style=\"danger\"\n onClick={onDisconnect}\n />\n ) : (\n <Button\n data-cy=\"connect-button\"\n label={t(connectButtonText)}\n size=\"small\"\n style=\"primary\"\n onClick={onConnect}\n />\n )}\n </div>\n )}\n </div>\n </div>\n )\n);\n\nexport default IntegrationCard;\n","import { humanize, isPresent } from \"neetocist\";\nimport { useQueryParams } from \"neetocommons/react-utils\";\nimport { buildUrl } from \"neetocommons/utils\";\nimport { MailSend } from \"neetoicons\";\nimport { Gmail as GmailIcon, Outlook as OutlookIcon } from \"neetoicons/misc\";\nimport { Spinner, Callout, Toastr } from \"neetoui\";\nimport { prop } from \"ramda\";\nimport { 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 useGmail from \"hooks/integrations/useGmail\";\nimport useOutlook from \"hooks/integrations/useOutlook\";\nimport useSparkpostDomain from \"hooks/integrations/useSparkpostDomain\";\n\nimport { ERROR_MESSAGES } from \"./constants\";\nimport IntegrationCard from \"./IntegrationCard\";\n\nconst EmailDeliveryScreen = ({\n indexRoute,\n ownerId,\n ownDomainSetupRoute,\n canManageIntegrations,\n}) => {\n const { t } = useTranslation();\n const history = useHistory();\n const { error, errorDescription } = useQueryParams();\n\n if (isPresent(error)) {\n let errorMessage = ERROR_MESSAGES[error];\n if (errorDescription) {\n errorMessage = `${errorMessage} ${errorDescription}`;\n }\n Toastr.error(errorMessage ?? humanize(error));\n\n history.replace(indexRoute);\n }\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 {\n data: gmailData = {},\n isConnected: isGmailConnected,\n isLoading: isGmailLoading,\n isDestroying: isGmailDisconnecting,\n onDisconnect: onGmailDisconnect,\n } = gmailIntegration;\n\n const {\n data: outlookData = {},\n isConnected: isOutlookConnected,\n isLoading: isOutlookLoading,\n isDestroying: isOutlookDisconnecting,\n onDisconnect: onOutlookDisconnect,\n } = outlookIntegration;\n\n const {\n data: sparkpostData = {},\n isConnected: isSparkpostConnected,\n isLoading: isSparkpostLoading,\n onDisconnect: onSparkpostDisconnect,\n isDestroying: isSparkpostDisconnecting,\n } = sparkpostIntegration;\n\n const isLoading = isGmailLoading || isOutlookLoading || isSparkpostLoading;\n const hasActiveIntegration =\n isGmailConnected || isOutlookConnected || isSparkpostConnected;\n\n const handleGmailConnect = () => {\n window.location.href = buildUrl(GMAIL_OAUTH_CONNECT_URL, { ownerId });\n };\n\n const handleOutlookConnect = () => {\n window.location.href = buildUrl(OUTLOOK_OAUTH_CONNECT_URL, { ownerId });\n };\n\n const handleOwnDomainConnect = () => {\n history.push(ownDomainSetupRoute);\n };\n\n const gmailEmail = prop(\"email\", gmailData);\n const outlookEmail = prop(\"email\", outlookData);\n const sparkpostEmail = prop(\"email\", sparkpostData);\n\n const gmailTitle = t(\"neetoEmailDelivery.gmail.title\");\n const gmailDescription = isGmailConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: gmailEmail,\n })\n : t(\"neetoEmailDelivery.gmail.description\");\n\n const outlookTitle = t(\"neetoEmailDelivery.outlook.title\");\n const outlookDescription = isOutlookConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: outlookEmail,\n })\n : t(\"neetoEmailDelivery.outlook.description\");\n\n const ownDomainTitle = t(\n \"neetoEmailDelivery.sparkpost.emailDelivery.ownDomainTitle\"\n );\n\n const ownDomainDescription = isSparkpostConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: sparkpostEmail,\n })\n : t(\"neetoEmailDelivery.sparkpost.emailDelivery.ownDomainDescription\");\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 <div className=\"min-h-0 w-full grow\">\n <div className=\"@container mx-auto space-y-6\">\n <div className=\"grid grid-cols-1 gap-3 py-1 @lg:grid-cols-2 @lg:gap-6 @3xl:grid-cols-3 @7xl:grid-cols-4\">\n {/* Gmail Option */}\n {(!hasActiveIntegration || isGmailConnected) && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.gmail.connectGmail\"\n description={gmailDescription}\n icon={GmailIcon}\n isConnected={isGmailConnected}\n isDisconnecting={isGmailDisconnecting}\n title={gmailTitle}\n onConnect={handleGmailConnect}\n onDisconnect={onGmailDisconnect}\n />\n )}\n {/* Outlook Option */}\n {(!hasActiveIntegration || isOutlookConnected) && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.outlook.connectOutlook\"\n description={outlookDescription}\n icon={OutlookIcon}\n isConnected={isOutlookConnected}\n isDisconnecting={isOutlookDisconnecting}\n title={outlookTitle}\n onConnect={handleOutlookConnect}\n onDisconnect={onOutlookDisconnect}\n />\n )}\n {/* Own Domain (Sparkpost) Option */}\n {(!hasActiveIntegration || isSparkpostConnected) && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.sparkpost.emailDelivery.setupDomain\"\n description={ownDomainDescription}\n icon={MailSend}\n isConnected={isSparkpostConnected}\n isDisconnecting={isSparkpostDisconnecting}\n title={ownDomainTitle}\n onConnect={handleOwnDomainConnect}\n onDisconnect={onSparkpostDisconnect}\n />\n )}\n </div>\n {hasActiveIntegration && (\n <Callout style=\"success\">\n {isGmailConnected\n ? t(\"neetoEmailDelivery.gmail.gmailConfigured\")\n : isOutlookConnected\n ? t(\"neetoEmailDelivery.outlook.outlookConfigured\")\n : t(\"neetoEmailDelivery.sparkpost.ownDomainConfigured\")}\n </Callout>\n )}\n </div>\n </div>\n );\n};\n\nexport default EmailDeliveryScreen;\n"],"names":["useGmail","_ref","ownerId","indexRoute","canManageIntegrations","_useState","useState","_useState2","_slicedToArray","isDisconnectAlertOpen","setIsDisconnectAlertOpen","history","useHistory","queryClient","useQueryClient","_useFetchGmail","useFetchGmail","enabled","isLoading","_useFetchGmail$data","data","isGmailFetched","isSuccess","_useDestroyGmail","useDestroyGmail","isDestroying","isPending","destroyIntegration","mutate","onClose","replace","onDisconnect","onSuccess","showThumbsUpToastr","useEffect","invalidateQueries","predicate","query","_query$queryKey","queryKey","key","id","QUERY_KEYS","INTEGRATION_GMAIL","isConnected","connected","errorMessage","error","useOutlook","_useFetchOutlook","useFetchOutlook","_useFetchOutlook$data","isOutlookFetched","_useDestroyOutlook","useDestroyOutlook","INTEGRATION_OUTLOOK","ERROR_MESSAGES","gmail_permission_not_given","t","outlook_permission_not_given","outlook_invalid_client","outlook_nil_json_web_token","IntegrationCard","withT","Icon","icon","title","description","isDisconnecting","onConnect","connectButtonText","_ref$disconnectButton","disconnectButtonText","_ref$connectedTagText","connectedTagText","_jsx","className","children","_jsxs","size","Typography","style","weight","Tag","label","Button","loading","onClick","EmailDeliveryScreen","ownDomainSetupRoute","_useTranslation","useTranslation","_useQueryParams","useQueryParams","errorDescription","isPresent","_errorMessage","concat","Toastr","humanize","gmailIntegration","outlookIntegration","sparkpostIntegration","useSparkpostDomain","_gmailIntegration$dat","gmailData","isGmailConnected","isGmailLoading","isGmailDisconnecting","onGmailDisconnect","_outlookIntegration$d","outlookData","isOutlookConnected","isOutlookLoading","isOutlookDisconnecting","onOutlookDisconnect","_sparkpostIntegration","sparkpostData","isSparkpostConnected","isSparkpostLoading","onSparkpostDisconnect","isSparkpostDisconnecting","hasActiveIntegration","handleGmailConnect","window","location","href","buildUrl","GMAIL_OAUTH_CONNECT_URL","handleOutlookConnect","OUTLOOK_OAUTH_CONNECT_URL","handleOwnDomainConnect","push","gmailEmail","prop","outlookEmail","sparkpostEmail","gmailTitle","gmailDescription","email","outlookTitle","outlookDescription","ownDomainTitle","ownDomainDescription","Spinner","GmailIcon","OutlookIcon","MailSend","Callout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAAuD;AAAA,EAAA,IAAjDC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEC,UAAU,GAAAF,IAAA,CAAVE,UAAU;IAAEC,qBAAqB,GAAAH,IAAA,CAArBG,qBAAqB;AAC5D,EAAA,IAAAC,SAAA,GAA0DC,cAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlEI,IAAAA,qBAAqB,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,wBAAwB,GAAAH,UAAA,CAAA,CAAA,CAAA;AAEtD,EAAA,IAAMI,OAAO,GAAGC,yBAAU,EAAE;AAE5B,EAAA,IAAMC,WAAW,GAAGC,yBAAc,EAAE;AAEpC,EAAA,IAAAC,cAAA,GAIIC,sCAAa,CAACd,OAAO,EAAE;AAAEe,MAAAA,OAAO,EAAEb;AAAsB,KAAC,CAAC;IAH5Dc,SAAS,GAAAH,cAAA,CAATG,SAAS;IAAAC,mBAAA,GAAAJ,cAAA,CACTK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,mBAAA,KAAA,KAAA,CAAA,GAAG,EAAE,GAAAA,mBAAA;IACEE,cAAc,GAAAN,cAAA,CAAzBO,SAAS;EAGX,IAAAC,gBAAA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AACnE,QAAAA,KAAK,EAAC,SAAS;AAAAJ,QAAAA,QAAA,EACrB6B,gBAAgB,GACbhD,CAAC,CAAC,0CAA0C,CAAC,GAC7CsD,kBAAkB,GAChBtD,CAAC,CAAC,8CAA8C,CAAC,GACjDA,CAAC,CAAC,kDAAkD;AAAC,OACpD,CACV;KACE;AAAC,GACH,CAAC;AAEV;;;;"}
|
|
1
|
+
{"version":3,"file":"EmailDeliveryScreen.js","sources":["../../app/javascript/src/hooks/integrations/useGmail.js","../../app/javascript/src/hooks/integrations/useOutlook.js","../../app/javascript/src/components/EmailDeliveryScreen/constants.js","../../app/javascript/src/components/EmailDeliveryScreen/IntegrationCard.jsx","../../app/javascript/src/components/EmailDeliveryScreen/index.jsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { showThumbsUpToastr } from \"neetocommons/utils\";\nimport { useHistory } from \"react-router-dom\";\n\nimport {\n useFetchGmail,\n useDestroyGmail,\n} from \"hooks/reactQuery/integrations/useGmailIntegrationApi\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nconst useGmail = ({ ownerId, indexRoute, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n\n const history = useHistory();\n\n const queryClient = useQueryClient();\n\n const {\n isLoading,\n data = {},\n isSuccess: isGmailFetched,\n } = useFetchGmail(ownerId, { enabled: canManageIntegrations });\n\n const { isPending: isDestroying, mutate: destroyIntegration } =\n useDestroyGmail({ ownerId });\n\n const onClose = () => history.replace(indexRoute);\n\n const onDisconnect = () => {\n destroyIntegration(false, {\n onSuccess: () => {\n showThumbsUpToastr();\n setIsDisconnectAlertOpen(false);\n history.replace(indexRoute);\n },\n });\n };\n\n useEffect(() => {\n if (isGmailFetched) {\n queryClient.invalidateQueries({\n predicate: query => {\n const [key, id] = query.queryKey;\n\n return key === QUERY_KEYS.INTEGRATION_GMAIL && id !== ownerId;\n },\n });\n }\n }, [isGmailFetched, queryClient, ownerId]);\n\n return {\n data,\n isLoading,\n isDestroying,\n exists: data?.exists,\n isConnected: data?.connected,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onDisconnect,\n onClose,\n errorMessage: data?.error,\n };\n};\n\nexport default useGmail;\n","import { useEffect, useState } from \"react\";\n\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { showThumbsUpToastr } from \"neetocommons/utils\";\nimport { useHistory } from \"react-router-dom\";\n\nimport {\n useFetchOutlook,\n useDestroyOutlook,\n} from \"hooks/reactQuery/integrations/useOutlookIntegrationApi\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nconst useOutlook = ({ ownerId, indexRoute, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n\n const history = useHistory();\n\n const queryClient = useQueryClient();\n\n const {\n isLoading,\n data = {},\n isSuccess: isOutlookFetched,\n } = useFetchOutlook(ownerId, { enabled: canManageIntegrations });\n\n const { isPending: isDestroying, mutate: destroyIntegration } =\n useDestroyOutlook({ ownerId });\n\n const onClose = () => history.replace(indexRoute);\n\n const onDisconnect = () => {\n destroyIntegration(false, {\n onSuccess: () => {\n showThumbsUpToastr();\n setIsDisconnectAlertOpen(false);\n history.replace(indexRoute);\n },\n });\n };\n\n useEffect(() => {\n if (isOutlookFetched) {\n queryClient.invalidateQueries({\n predicate: query => {\n const [key, id] = query.queryKey;\n\n return key === QUERY_KEYS.INTEGRATION_OUTLOOK && id !== ownerId;\n },\n });\n }\n }, [isOutlookFetched, queryClient, ownerId]);\n\n return {\n data,\n isLoading,\n exists: data?.exists,\n status: data?.status,\n shadowAccount: data?.shadowAccount,\n isWaitingForTestEmail: data?.status === \"inactive\" && !data?.connected,\n isDestroying,\n isConnected: data?.connected,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onDisconnect,\n onClose,\n errorMessage: data?.error,\n };\n};\n\nexport default useOutlook;\n","import { t } from \"i18next\";\n\nexport const ERROR_MESSAGES = {\n gmail_permission_not_given: t(\"neetoEmailDelivery.gmail.permissionNotGiven\"),\n outlook_permission_not_given: t(\n \"neetoEmailDelivery.outlook.permissionNotGiven\"\n ),\n outlook_invalid_client: t(\"neetoEmailDelivery.outlook.invalidClient\"),\n outlook_nil_json_web_token: t(\"neetoEmailDelivery.outlook.nilJsonWebToken\"),\n};\n","import { Button, Tag, Typography } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nconst IntegrationCard = ({\n icon: Icon,\n title,\n description,\n isConnected,\n isDisconnecting,\n onConnect,\n onDisconnect,\n connectButtonText,\n disconnectButtonText = \"neetoEmailDelivery.sparkpost.emailDelivery.disconnect\",\n connectedTagText = \"neetoEmailDelivery.sparkpost.emailDelivery.connected\",\n showDisconnect = false,\n}) => {\n const { t } = useTranslation();\n\n const shouldShowDisconnect = isConnected || showDisconnect;\n\n return (\n <div className=\"neeto-ui-rounded-lg neeto-ui-shadow-xs neeto-ui-border-gray-300 translate flex flex-col gap-y-4 border p-6 no-underline transition-transform duration-300 ease-in-out outline-none hover:-translate-y-1\">\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center gap-3\">\n <Icon className=\"shrink-0\" size={32} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <Typography style=\"h4\" weight=\"semibold\">\n {title}\n </Typography>\n {isConnected && <Tag label={t(connectedTagText)} />}\n </div>\n </div>\n </div>\n <Typography style=\"body2\">{description}</Typography>\n {connectButtonText && (\n <div className=\"flex gap-2\">\n {shouldShowDisconnect ? (\n <Button\n data-cy=\"disconnect-button\"\n label={t(disconnectButtonText)}\n loading={isDisconnecting}\n size=\"small\"\n style=\"danger\"\n onClick={onDisconnect}\n />\n ) : (\n <Button\n data-cy=\"connect-button\"\n label={t(connectButtonText)}\n size=\"small\"\n style=\"primary\"\n onClick={onConnect}\n />\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default IntegrationCard;\n","import { humanize, isPresent } from \"neetocist\";\nimport { useQueryParams } from \"neetocommons/react-utils\";\nimport { buildUrl } from \"neetocommons/utils\";\nimport { MailSend } from \"neetoicons\";\nimport { Gmail as GmailIcon, Outlook as OutlookIcon } from \"neetoicons/misc\";\nimport { Spinner, Callout, Toastr } from \"neetoui\";\nimport { prop } from \"ramda\";\nimport { 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 useGmail from \"hooks/integrations/useGmail\";\nimport useOutlook from \"hooks/integrations/useOutlook\";\nimport useSparkpostDomain from \"hooks/integrations/useSparkpostDomain\";\n\nimport { ERROR_MESSAGES } from \"./constants\";\nimport IntegrationCard from \"./IntegrationCard\";\n\nconst EmailDeliveryScreen = ({\n indexRoute,\n ownerId,\n ownDomainSetupRoute,\n canManageIntegrations,\n}) => {\n const { t } = useTranslation();\n const history = useHistory();\n const { error, errorDescription } = useQueryParams();\n\n if (isPresent(error)) {\n let errorMessage = ERROR_MESSAGES[error];\n if (errorDescription) {\n errorMessage = `${errorMessage} ${errorDescription}`;\n }\n Toastr.error(errorMessage ?? humanize(error));\n\n history.replace(indexRoute);\n }\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 {\n data: gmailData = {},\n isConnected: isGmailConnected,\n isLoading: isGmailLoading,\n isDestroying: isGmailDisconnecting,\n onDisconnect: onGmailDisconnect,\n exists: isGmailExists,\n } = gmailIntegration;\n\n const {\n data: outlookData = {},\n isConnected: isOutlookConnected,\n isLoading: isOutlookLoading,\n isDestroying: isOutlookDisconnecting,\n isWaitingForTestEmail: isOutlookWaitingForTestEmail,\n shadowAccount: isOutlookShadowAccount,\n onDisconnect: onOutlookDisconnect,\n exists: isOutlookExists,\n } = outlookIntegration;\n\n const {\n data: sparkpostData = {},\n isConnected: isSparkpostConnected,\n isLoading: isSparkpostLoading,\n onDisconnect: onSparkpostDisconnect,\n isDestroying: isSparkpostDisconnecting,\n exists: isSparkpostExists,\n } = sparkpostIntegration;\n\n const isLoading = isGmailLoading || isOutlookLoading || isSparkpostLoading;\n const noneExists = !isGmailExists && !isOutlookExists && !isSparkpostExists;\n const showGmail = noneExists || isGmailExists;\n const showOutlook = noneExists || isOutlookExists;\n const showSparkpost = noneExists || isSparkpostExists;\n\n const handleGmailConnect = () => {\n window.location.href = buildUrl(GMAIL_OAUTH_CONNECT_URL, { ownerId });\n };\n\n const handleOutlookConnect = () => {\n window.location.href = buildUrl(OUTLOOK_OAUTH_CONNECT_URL, { ownerId });\n };\n\n const handleOwnDomainConnect = () => {\n history.push(ownDomainSetupRoute);\n };\n\n const gmailEmail = prop(\"email\", gmailData);\n const outlookEmail = prop(\"email\", outlookData);\n const sparkpostEmail = prop(\"email\", sparkpostData);\n\n const gmailTitle = t(\"neetoEmailDelivery.gmail.title\");\n const gmailDescription = isGmailConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: gmailEmail,\n })\n : t(\"neetoEmailDelivery.gmail.description\");\n\n const outlookTitle = t(\"neetoEmailDelivery.outlook.title\");\n const outlookDescription = isOutlookConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: outlookEmail,\n })\n : t(\"neetoEmailDelivery.outlook.description\");\n\n const ownDomainTitle = t(\n \"neetoEmailDelivery.sparkpost.emailDelivery.ownDomainTitle\"\n );\n\n const ownDomainDescription = isSparkpostConnected\n ? t(\"neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail\", {\n email: sparkpostEmail,\n })\n : t(\"neetoEmailDelivery.sparkpost.emailDelivery.ownDomainDescription\");\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 const activeMessage =\n (isGmailConnected && t(\"neetoEmailDelivery.gmail.gmailConfigured\")) ||\n (isOutlookConnected && t(\"neetoEmailDelivery.outlook.outlookConfigured\")) ||\n (isSparkpostConnected &&\n t(\"neetoEmailDelivery.sparkpost.ownDomainConfigured\"));\n\n return (\n <div className=\"min-h-0 w-full grow\">\n <div className=\"@container mx-auto space-y-6\">\n <div className=\"grid grid-cols-1 gap-3 py-1 @lg:grid-cols-2 @lg:gap-6 @3xl:grid-cols-3 @7xl:grid-cols-4\">\n {/* Gmail Option */}\n {showGmail && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.gmail.connectGmail\"\n description={gmailDescription}\n icon={GmailIcon}\n isConnected={isGmailConnected}\n isDisconnecting={isGmailDisconnecting}\n title={gmailTitle}\n onConnect={handleGmailConnect}\n onDisconnect={onGmailDisconnect}\n />\n )}\n {/* Outlook Option */}\n {showOutlook && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.outlook.connectOutlook\"\n description={outlookDescription}\n icon={OutlookIcon}\n isConnected={isOutlookConnected}\n isDisconnecting={isOutlookDisconnecting}\n title={outlookTitle}\n showDisconnect={\n isOutlookWaitingForTestEmail || isOutlookShadowAccount\n }\n onConnect={handleOutlookConnect}\n onDisconnect={onOutlookDisconnect}\n />\n )}\n {/* Own Domain (Sparkpost) Option */}\n {showSparkpost && (\n <IntegrationCard\n connectButtonText=\"neetoEmailDelivery.sparkpost.emailDelivery.setupDomain\"\n description={ownDomainDescription}\n icon={MailSend}\n isConnected={isSparkpostConnected}\n isDisconnecting={isSparkpostDisconnecting}\n title={ownDomainTitle}\n onConnect={handleOwnDomainConnect}\n onDisconnect={onSparkpostDisconnect}\n />\n )}\n </div>\n {activeMessage && <Callout style=\"success\">{activeMessage}</Callout>}\n {isOutlookWaitingForTestEmail && (\n <Callout style=\"warning\">\n {t(\"neetoEmailDelivery.outlook.waitingForTestEmail\", {\n email: outlookEmail,\n })}\n </Callout>\n )}\n {isOutlookShadowAccount && (\n <Callout style=\"warning\">\n {t(\"neetoEmailDelivery.outlook.shadowAccountMessage\", {\n email: outlookEmail,\n })}\n </Callout>\n )}\n </div>\n </div>\n );\n};\n\nexport default EmailDeliveryScreen;\n"],"names":["useGmail","_ref","ownerId","indexRoute","canManageIntegrations","_useState","useState","_useState2","_slicedToArray","isDisconnectAlertOpen","setIsDisconnectAlertOpen","history","useHistory","queryClient","useQueryClient","_useFetchGmail","useFetchGmail","enabled","isLoading","_useFetchGmail$data","data","isGmailFetched","isSuccess","_useDestroyGmail","useDestroyGmail","isDestroying","isPending","destroyIntegration","mutate","onClose","replace","onDisconnect","onSuccess","showThumbsUpToastr","useEffect","invalidateQueries","predicate","query","_query$queryKey","queryKey","key","id","QUERY_KEYS","INTEGRATION_GMAIL","exists","isConnected","connected","errorMessage","error","useOutlook","_useFetchOutlook","useFetchOutlook","_useFetchOutlook$data","isOutlookFetched","_useDestroyOutlook","useDestroyOutlook","INTEGRATION_OUTLOOK","status","shadowAccount","isWaitingForTestEmail","ERROR_MESSAGES","gmail_permission_not_given","t","outlook_permission_not_given","outlook_invalid_client","outlook_nil_json_web_token","IntegrationCard","Icon","icon","title","description","isDisconnecting","onConnect","connectButtonText","_ref$disconnectButton","disconnectButtonText","_ref$connectedTagText","connectedTagText","_ref$showDisconnect","showDisconnect","_useTranslation","useTranslation","shouldShowDisconnect","_jsx","className","children","_jsxs","size","Typography","style","weight","Tag","label","Button","loading","onClick","EmailDeliveryScreen","ownDomainSetupRoute","_useQueryParams","useQueryParams","errorDescription","isPresent","_errorMessage","concat","Toastr","humanize","gmailIntegration","outlookIntegration","sparkpostIntegration","useSparkpostDomain","_gmailIntegration$dat","gmailData","isGmailConnected","isGmailLoading","isGmailDisconnecting","onGmailDisconnect","isGmailExists","_outlookIntegration$d","outlookData","isOutlookConnected","isOutlookLoading","isOutlookDisconnecting","isOutlookWaitingForTestEmail","isOutlookShadowAccount","onOutlookDisconnect","isOutlookExists","_sparkpostIntegration","sparkpostData","isSparkpostConnected","isSparkpostLoading","onSparkpostDisconnect","isSparkpostDisconnecting","isSparkpostExists","noneExists","showGmail","showOutlook","showSparkpost","handleGmailConnect","window","location","href","buildUrl","GMAIL_OAUTH_CONNECT_URL","handleOutlookConnect","OUTLOOK_OAUTH_CONNECT_URL","handleOwnDomainConnect","push","gmailEmail","prop","outlookEmail","sparkpostEmail","gmailTitle","gmailDescription","email","outlookTitle","outlookDescription","ownDomainTitle","ownDomainDescription","Spinner","activeMessage","GmailIcon","OutlookIcon","MailSend","Callout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAAuD;AAAA,EAAA,IAAjDC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEC,UAAU,GAAAF,IAAA,CAAVE,UAAU;IAAEC,qBAAqB,GAAAH,IAAA,CAArBG,qBAAqB;AAC5D,EAAA,IAAAC,SAAA,GAA0DC,cAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlEI,IAAAA,qBAAqB,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,wBAAwB,GAAAH,UAAA,CAAA,CAAA,CAAA;AAEtD,EAAA,IAAMI,OAAO,GAAGC,yBAAU,EAAE;AAE5B,EAAA,IAAMC,WAAW,GAAGC,yBAAc,EAAE;AAEpC,EAAA,IAAAC,cAAA,GAIIC,sCAAa,CAACd,OAAO,EAAE;AAAEe,MAAAA,OAAO,EAAEb;AAAsB,KAAC,CAAC;IAH5Dc,SAAS,GAAAH,cAAA,CAATG,SAAS;IAAAC,mBAAA,GAAAJ,cAAA,CACTK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,mBAAA,KAAA,KAAA,CAAA,GAAG,EAAE,GAAAA,mBAAA;IACEE,cAAc,GAAAN,cAAA,CAAzBO,SAAS;EAGX,IAAAC,gBAAA,GACEC,wC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,UAAAA,IAAI,EAAE8F,QAAS;AACfrH,UAAAA,WAAW,EAAEmF,oBAAqB;AAClCzD,UAAAA,eAAe,EAAE4D,wBAAyB;AAC1C9D,UAAAA,KAAK,EAAEuF,cAAe;AACtBpF,UAAAA,SAAS,EAAEyE,sBAAuB;AAClClH,UAAAA,YAAY,EAAEmG;AAAsB,SACrC,CACF;AAAA,OACE,CAAC,EACL6B,aAAa,iBAAI5E,cAAA,CAACgF,OAAO,EAAA;AAAC1E,QAAAA,KAAK,EAAC,SAAS;AAAAJ,QAAAA,QAAA,EAAE0E;AAAa,OAAU,CAAC,EACnErC,4BAA4B,iBAC3BvC,cAAA,CAACgF,OAAO,EAAA;AAAC1E,QAAAA,KAAK,EAAC,SAAS;AAAAJ,QAAAA,QAAA,EACrBvB,CAAC,CAAC,gDAAgD,EAAE;AACnD2F,UAAAA,KAAK,EAAEJ;SACR;AAAC,OACK,CACV,EACA1B,sBAAsB,iBACrBxC,cAAA,CAACgF,OAAO,EAAA;AAAC1E,QAAAA,KAAK,EAAC,SAAS;AAAAJ,QAAAA,QAAA,EACrBvB,CAAC,CAAC,iDAAiD,EAAE;AACpD2F,UAAAA,KAAK,EAAEJ;SACR;AAAC,OACK,CACV;KACE;AAAC,GACH,CAAC;AAEV;;;;"}
|
|
@@ -9,7 +9,7 @@ var Form = require('@bigbinary/neetoui/formik/Form');
|
|
|
9
9
|
var reactI18next = require('react-i18next');
|
|
10
10
|
var reactRouterDom = require('react-router-dom');
|
|
11
11
|
var constants = require('../constants-D3nzz3Te.js');
|
|
12
|
-
var useSparkpostDomain = require('../useSparkpostDomain-
|
|
12
|
+
var useSparkpostDomain = require('../useSparkpostDomain-wsENCoto.js');
|
|
13
13
|
var jsxRuntime = require('react/jsx-runtime');
|
|
14
14
|
require('@babel/runtime/helpers/defineProperty');
|
|
15
15
|
require('@babel/runtime/helpers/objectWithoutProperties');
|
|
@@ -9,7 +9,7 @@ var ramda = require('ramda');
|
|
|
9
9
|
var reactI18next = require('react-i18next');
|
|
10
10
|
var reactRouterDom = require('react-router-dom');
|
|
11
11
|
var constants = require('../constants-D3nzz3Te.js');
|
|
12
|
-
var useSparkpostDomain = require('../useSparkpostDomain-
|
|
12
|
+
var useSparkpostDomain = require('../useSparkpostDomain-wsENCoto.js');
|
|
13
13
|
var useSparkpostApi = require('../useSparkpostApi-pa64NIl6.js');
|
|
14
14
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
15
15
|
var Typography = require('@bigbinary/neetoui/Typography');
|
package/dist/cjs/index.js
CHANGED
|
@@ -22,7 +22,7 @@ require('axios');
|
|
|
22
22
|
require('@babel/runtime/helpers/slicedToArray');
|
|
23
23
|
require('react');
|
|
24
24
|
require('../useOutlookIntegrationApi-CtHj_BzG.js');
|
|
25
|
-
require('../useSparkpostDomain-
|
|
25
|
+
require('../useSparkpostDomain-wsENCoto.js');
|
|
26
26
|
require('i18next');
|
|
27
27
|
require('@bigbinary/neetoui/Button');
|
|
28
28
|
require('@bigbinary/neetoui/Tag');
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import 'axios';
|
|
|
20
20
|
import '@babel/runtime/helpers/slicedToArray';
|
|
21
21
|
import 'react';
|
|
22
22
|
import './useOutlookIntegrationApi-ZgRWrUQN.js';
|
|
23
|
-
import './useSparkpostDomain-
|
|
23
|
+
import './useSparkpostDomain-DO4bG1HD.js';
|
|
24
24
|
import 'i18next';
|
|
25
25
|
import '@bigbinary/neetoui/Button';
|
|
26
26
|
import '@bigbinary/neetoui/Tag';
|
|
@@ -81,6 +81,7 @@ var useSparkpostDomain = function useSparkpostDomain(_ref) {
|
|
|
81
81
|
isCreating: isCreating,
|
|
82
82
|
isVerifying: isVerifying,
|
|
83
83
|
isDestroying: isDestroying,
|
|
84
|
+
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
84
85
|
isConnected: (data === null || data === void 0 ? void 0 : data.connected) || false,
|
|
85
86
|
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
86
87
|
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
@@ -91,4 +92,4 @@ var useSparkpostDomain = function useSparkpostDomain(_ref) {
|
|
|
91
92
|
};
|
|
92
93
|
|
|
93
94
|
export { useSparkpostDomain as u };
|
|
94
|
-
//# sourceMappingURL=useSparkpostDomain-
|
|
95
|
+
//# sourceMappingURL=useSparkpostDomain-DO4bG1HD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSparkpostDomain-DO4bG1HD.js","sources":["../app/javascript/src/hooks/integrations/useSparkpostDomain.js"],"sourcesContent":["import { useState } from \"react\";\n\nimport { Toastr } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n useFetchSparkpostDomain,\n useCreateSparkpostDomain,\n useVerifySparkpostDomain,\n useDestroySparkpostDomain,\n} from \"hooks/reactQuery/integrations/useSparkpostApi\";\n\nconst useSparkpostDomain = ({ ownerId, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n const { t } = useTranslation();\n\n const { isLoading, data = {} } = useFetchSparkpostDomain(ownerId, {\n enabled: canManageIntegrations,\n });\n\n const { isPending: isCreating, mutate: createDomain } =\n useCreateSparkpostDomain({ ownerId });\n\n const { isPending: isVerifying, mutate: verifyDomain } =\n useVerifySparkpostDomain({ ownerId });\n\n const { isPending: isDestroying, mutate: destroyDomain } =\n useDestroySparkpostDomain({ ownerId });\n\n const onCreateDomain = (email, onSuccess, onError) => {\n createDomain(\n { sparkpostDomain: { email } },\n {\n onSuccess: response => {\n if (response?.alreadyVerified) {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainVerifiedConnected\")\n );\n }\n onSuccess?.(response);\n },\n onError: error => {\n onError?.(error);\n },\n }\n );\n };\n\n const onVerifyDomain = (onSuccess, onError) => {\n verifyDomain(false, {\n onSuccess: response => {\n if (response?.verified) {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainVerified\")\n );\n } else {\n Toastr.warning(\n t(\"neetoEmailDelivery.sparkpost.toasts.verificationPending\")\n );\n }\n onSuccess?.(response);\n },\n onError: error => {\n onError?.(error);\n },\n });\n };\n\n const onDisconnect = onSuccess => {\n destroyDomain(false, {\n onSuccess: () => {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainDisconnected\")\n );\n setIsDisconnectAlertOpen(false);\n onSuccess?.();\n },\n });\n };\n\n return {\n data,\n isLoading,\n isCreating,\n isVerifying,\n isDestroying,\n exists: data?.exists,\n isConnected: data?.connected || false,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onCreateDomain,\n onVerifyDomain,\n onDisconnect,\n };\n};\n\nexport default useSparkpostDomain;\n"],"names":["useSparkpostDomain","_ref","ownerId","canManageIntegrations","_useState","useState","_useState2","_slicedToArray","isDisconnectAlertOpen","setIsDisconnectAlertOpen","_useTranslation","useTranslation","t","_useFetchSparkpostDom","useFetchSparkpostDomain","enabled","isLoading","_useFetchSparkpostDom2","data","_useCreateSparkpostDo","useCreateSparkpostDomain","isCreating","isPending","createDomain","mutate","_useVerifySparkpostDo","useVerifySparkpostDomain","isVerifying","verifyDomain","_useDestroySparkpostD","useDestroySparkpostDomain","isDestroying","destroyDomain","onCreateDomain","email","onSuccess","onError","sparkpostDomain","response","alreadyVerified","Toastr","success","error","onVerifyDomain","verified","warning","onDisconnect","exists","isConnected","connected"],"mappings":";;;;;;AAYA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAA2C;AAAA,EAAA,IAArCC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEC,qBAAqB,GAAAF,IAAA,CAArBE,qBAAqB;AAC1D,EAAA,IAAAC,SAAA,GAA0DC,QAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlEI,IAAAA,qBAAqB,GAAAF,UAAA,CAAA,CAAA,C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CACZ7B,CAAC,CAAC,wDAAwD,CAC5D,CAAC;QACDH,wBAAwB,CAAC,KAAK,CAAC;AAC/B0B,QAAAA,WAAS,KAATA,IAAAA,IAAAA,WAAS,KAATA,KAAAA,CAAAA,IAAAA,WAAS,EAAI;AACf;AACF,KAAC,CAAC;GACH;EAED,OAAO;AACLjB,IAAAA,IAAI,EAAJA,IAAI;AACJF,IAAAA,SAAS,EAATA,SAAS;AACTK,IAAAA,UAAU,EAAVA,UAAU;AACVM,IAAAA,WAAW,EAAXA,WAAW;AACXI,IAAAA,YAAY,EAAZA,YAAY;AACZgB,IAAAA,MAAM,EAAE7B,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAJA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,IAAI,CAAE6B,MAAM;IACpBC,WAAW,EAAE,CAAA9B,IAAI,KAAJA,IAAAA,IAAAA,IAAI,uBAAJA,IAAI,CAAE+B,SAAS,KAAI,KAAK;AACrCzC,IAAAA,qBAAqB,EAArBA,qBAAqB;AACrBC,IAAAA,wBAAwB,EAAxBA,wBAAwB;AACxBwB,IAAAA,cAAc,EAAdA,cAAc;AACdU,IAAAA,cAAc,EAAdA,cAAc;AACdG,IAAAA,YAAY,EAAZA;GACD;AACH;;;;"}
|
|
@@ -83,6 +83,7 @@ var useSparkpostDomain = function useSparkpostDomain(_ref) {
|
|
|
83
83
|
isCreating: isCreating,
|
|
84
84
|
isVerifying: isVerifying,
|
|
85
85
|
isDestroying: isDestroying,
|
|
86
|
+
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
86
87
|
isConnected: (data === null || data === void 0 ? void 0 : data.connected) || false,
|
|
87
88
|
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
88
89
|
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
@@ -93,4 +94,4 @@ var useSparkpostDomain = function useSparkpostDomain(_ref) {
|
|
|
93
94
|
};
|
|
94
95
|
|
|
95
96
|
exports.useSparkpostDomain = useSparkpostDomain;
|
|
96
|
-
//# sourceMappingURL=useSparkpostDomain-
|
|
97
|
+
//# sourceMappingURL=useSparkpostDomain-wsENCoto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSparkpostDomain-wsENCoto.js","sources":["../app/javascript/src/hooks/integrations/useSparkpostDomain.js"],"sourcesContent":["import { useState } from \"react\";\n\nimport { Toastr } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n useFetchSparkpostDomain,\n useCreateSparkpostDomain,\n useVerifySparkpostDomain,\n useDestroySparkpostDomain,\n} from \"hooks/reactQuery/integrations/useSparkpostApi\";\n\nconst useSparkpostDomain = ({ ownerId, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n const { t } = useTranslation();\n\n const { isLoading, data = {} } = useFetchSparkpostDomain(ownerId, {\n enabled: canManageIntegrations,\n });\n\n const { isPending: isCreating, mutate: createDomain } =\n useCreateSparkpostDomain({ ownerId });\n\n const { isPending: isVerifying, mutate: verifyDomain } =\n useVerifySparkpostDomain({ ownerId });\n\n const { isPending: isDestroying, mutate: destroyDomain } =\n useDestroySparkpostDomain({ ownerId });\n\n const onCreateDomain = (email, onSuccess, onError) => {\n createDomain(\n { sparkpostDomain: { email } },\n {\n onSuccess: response => {\n if (response?.alreadyVerified) {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainVerifiedConnected\")\n );\n }\n onSuccess?.(response);\n },\n onError: error => {\n onError?.(error);\n },\n }\n );\n };\n\n const onVerifyDomain = (onSuccess, onError) => {\n verifyDomain(false, {\n onSuccess: response => {\n if (response?.verified) {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainVerified\")\n );\n } else {\n Toastr.warning(\n t(\"neetoEmailDelivery.sparkpost.toasts.verificationPending\")\n );\n }\n onSuccess?.(response);\n },\n onError: error => {\n onError?.(error);\n },\n });\n };\n\n const onDisconnect = onSuccess => {\n destroyDomain(false, {\n onSuccess: () => {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainDisconnected\")\n );\n setIsDisconnectAlertOpen(false);\n onSuccess?.();\n },\n });\n };\n\n return {\n data,\n isLoading,\n isCreating,\n isVerifying,\n isDestroying,\n exists: data?.exists,\n isConnected: data?.connected || false,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onCreateDomain,\n onVerifyDomain,\n onDisconnect,\n };\n};\n\nexport default useSparkpostDomain;\n"],"names":["useSparkpostDomain","_ref","ownerId","canManageIntegrations","_useState","useState","_useState2","_slicedToArray","isDisconnectAlertOpen","setIsDisconnectAlertOpen","_useTranslation","useTranslation","t","_useFetchSparkpostDom","useFetchSparkpostDomain","enabled","isLoading","_useFetchSparkpostDom2","data","_useCreateSparkpostDo","useCreateSparkpostDomain","isCreating","isPending","createDomain","mutate","_useVerifySparkpostDo","useVerifySparkpostDomain","isVerifying","verifyDomain","_useDestroySparkpostD","useDestroySparkpostDomain","isDestroying","destroyDomain","onCreateDomain","email","onSuccess","onError","sparkpostDomain","response","alreadyVerified","Toastr","success","error","onVerifyDomain","verified","warning","onDisconnect","exists","isConnected","connected"],"mappings":";;;;;;;;AAYA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAA2C;AAAA,EAAA,IAArCC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEC,qBAAqB,GAAAF,IAAA,CAArBE,qBAAqB;AAC1D,EAAA,IAAAC,SAAA,GAA0DC,cAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlEI,IAAAA,qBAAqB,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,wBAAwB,GAAAH,UAAA,CAAA,CAAA,CAAA;AACtD,EAAA,IAAAI,eAAA,GAAcC,2BAAc,EAAE;IAAtBC,CAAC,GAAAF,eAAA,CAADE,CAAC;AAET,EAAA,I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S,EAAI;AACf;AACF,KAAC,CAAC;GACH;EAED,OAAO;AACLjB,IAAAA,IAAI,EAAJA,IAAI;AACJF,IAAAA,SAAS,EAATA,SAAS;AACTK,IAAAA,UAAU,EAAVA,UAAU;AACVM,IAAAA,WAAW,EAAXA,WAAW;AACXI,IAAAA,YAAY,EAAZA,YAAY;AACZgB,IAAAA,MAAM,EAAE7B,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAJA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,IAAI,CAAE6B,MAAM;IACpBC,WAAW,EAAE,CAAA9B,IAAI,KAAJA,IAAAA,IAAAA,IAAI,uBAAJA,IAAI,CAAE+B,SAAS,KAAI,KAAK;AACrCzC,IAAAA,qBAAqB,EAArBA,qBAAqB;AACrBC,IAAAA,wBAAwB,EAAxBA,wBAAwB;AACxBwB,IAAAA,cAAc,EAAdA,cAAc;AACdU,IAAAA,cAAc,EAAdA,cAAc;AACdG,IAAAA,YAAY,EAAZA;GACD;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-email-delivery-frontend",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "This repo is for implementing custom email delivery functionality for the Neeto platform.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://github.com/bigbinary/neeto-email-delivery-nano",
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"@bigbinary/babel-preset-neeto": "^1.0.3",
|
|
69
69
|
"@bigbinary/eslint-plugin-neeto": "1.8.0",
|
|
70
70
|
"@bigbinary/neeto-cist": "1.0.17",
|
|
71
|
-
"@bigbinary/neeto-commons-frontend": "4.13.
|
|
71
|
+
"@bigbinary/neeto-commons-frontend": "4.13.89",
|
|
72
72
|
"@bigbinary/neeto-filters-frontend": "4.3.27",
|
|
73
73
|
"@bigbinary/neeto-icons": "1.20.67",
|
|
74
74
|
"@bigbinary/neeto-molecules": "4.0.117",
|
|
75
|
-
"@bigbinary/neetoui": "8.3.
|
|
75
|
+
"@bigbinary/neetoui": "8.3.47",
|
|
76
76
|
"@emotion/is-prop-valid": "1.2.0",
|
|
77
77
|
"@faker-js/faker": "8.2.0",
|
|
78
78
|
"@honeybadger-io/js": "6.10.1",
|
|
@@ -178,11 +178,11 @@
|
|
|
178
178
|
"peerDependencies": {
|
|
179
179
|
"@babel/runtime": "7.26.10",
|
|
180
180
|
"@bigbinary/neeto-cist": "1.0.17",
|
|
181
|
-
"@bigbinary/neeto-commons-frontend": "4.13.
|
|
181
|
+
"@bigbinary/neeto-commons-frontend": "4.13.89",
|
|
182
182
|
"@bigbinary/neeto-filters-frontend": "4.3.27",
|
|
183
183
|
"@bigbinary/neeto-icons": "1.20.67",
|
|
184
184
|
"@bigbinary/neeto-molecules": "4.0.117",
|
|
185
|
-
"@bigbinary/neetoui": "8.3.
|
|
185
|
+
"@bigbinary/neetoui": "8.3.47",
|
|
186
186
|
"@honeybadger-io/js": "6.10.1",
|
|
187
187
|
"@honeybadger-io/react": "6.1.25",
|
|
188
188
|
"@tanstack/react-query": "5.59.20",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSparkpostDomain-DNDqvZtR.js","sources":["../app/javascript/src/hooks/integrations/useSparkpostDomain.js"],"sourcesContent":["import { useState } from \"react\";\n\nimport { Toastr } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n useFetchSparkpostDomain,\n useCreateSparkpostDomain,\n useVerifySparkpostDomain,\n useDestroySparkpostDomain,\n} from \"hooks/reactQuery/integrations/useSparkpostApi\";\n\nconst useSparkpostDomain = ({ ownerId, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n const { t } = useTranslation();\n\n const { isLoading, data = {} } = useFetchSparkpostDomain(ownerId, {\n enabled: canManageIntegrations,\n });\n\n const { isPending: isCreating, mutate: createDomain } =\n useCreateSparkpostDomain({ ownerId });\n\n const { isPending: isVerifying, mutate: verifyDomain } =\n useVerifySparkpostDomain({ ownerId });\n\n const { isPending: isDestroying, mutate: destroyDomain } =\n useDestroySparkpostDomain({ ownerId });\n\n const onCreateDomain = (email, onSuccess, onError) => {\n createDomain(\n { sparkpostDomain: { email } },\n {\n onSuccess: response => {\n if (response?.alreadyVerified) {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainVerifiedConnected\")\n );\n }\n onSuccess?.(response);\n },\n onError: error => {\n onError?.(error);\n },\n }\n );\n };\n\n const onVerifyDomain = (onSuccess, onError) => {\n verifyDomain(false, {\n onSuccess: response => {\n if (response?.verified) {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainVerified\")\n );\n } else {\n Toastr.warning(\n t(\"neetoEmailDelivery.sparkpost.toasts.verificationPending\")\n );\n }\n onSuccess?.(response);\n },\n onError: error => {\n onError?.(error);\n },\n });\n };\n\n const onDisconnect = onSuccess => {\n destroyDomain(false, {\n onSuccess: () => {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainDisconnected\")\n );\n setIsDisconnectAlertOpen(false);\n onSuccess?.();\n },\n });\n };\n\n return {\n data,\n isLoading,\n isCreating,\n isVerifying,\n isDestroying,\n isConnected: data?.connected || false,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onCreateDomain,\n onVerifyDomain,\n onDisconnect,\n };\n};\n\nexport default useSparkpostDomain;\n"],"names":["useSparkpostDomain","_ref","ownerId","canManageIntegrations","_useState","useState","_useState2","_slicedToArray","isDisconnectAlertOpen","setIsDisconnectAlertOpen","_useTranslation","useTranslation","t","_useFetchSparkpostDom","useFetchSparkpostDomain","enabled","isLoading","_useFetchSparkpostDom2","data","_useCreateSparkpostDo","useCreateSparkpostDomain","isCreating","isPending","createDomain","mutate","_useVerifySparkpostDo","useVerifySparkpostDomain","isVerifying","verifyDomain","_useDestroySparkpostD","useDestroySparkpostDomain","isDestroying","destroyDomain","onCreateDomain","email","onSuccess","onError","sparkpostDomain","response","alreadyVerified","Toastr","success","error","onVerifyDomain","verified","warning","onDisconnect","isConnected","connected"],"mappings":";;;;;;AAYA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAA2C;AAAA,EAAA,IAArCC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEC,qBAAqB,GAAAF,IAAA,CAArBE,qBAAqB;AAC1D,EAAA,IAAAC,SAAA,GAA0DC,QAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlEI,IAAAA,qBAAqB,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,wBAAwB,GAAAH,UAAA,CAAA,CAAA,CAAA;AACtD,EAAA,IAAAI,eAAA,GAAcC,cAAc,EAAE;IAAtBC,CAAC,GAAAF,eAAA,CAADE,CAAC;AAET,EAAA,IAAAC,qBAAA,GAAiCC,uBAAuB,CAACZ,OAAO,EAAE;AAChEa,MAAAA,OAAO,EAAEZ;AACX,KAAC,CAAC;IAFMa,SAAS,GAAAH,qBAAA,CAATG,SAAS;IAAAC,sBAAA,GAAAJ,qBAAA,CAAEK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,sBAAA,KAAA,KAAA,CAAA,GAAG,EAAE,GAAAA,sBAAA;EAI5B,IAAAE,qBAAA,GACEC,wBAAwB,CAAC;AAAElB,MAAAA,OAAO,EAAPA;AAAQ,KAAC,CAAC;IADpBmB,UAAU,GAAAF,qBAAA,CAArBG,SAAS;IAAsBC,YAAY,GAAAJ,qBAAA,CAApBK,MAAM;EAGrC,IAAAC,qBAAA,GACEC,wBAAwB,CAAC;AAAExB,MAAAA,OAAO,EAAPA;AAAQ,KAAC,CAAC;IADpByB,WAAW,GAAAF,qBAAA,CAAtBH,SAAS;IAAuBM,YAAY,GAAAH,qBAAA,CAApBD,MAAM;EAGtC,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"],"sourcesContent":["import { useState } from \"react\";\n\nimport { Toastr } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n useFetchSparkpostDomain,\n useCreateSparkpostDomain,\n useVerifySparkpostDomain,\n useDestroySparkpostDomain,\n} from \"hooks/reactQuery/integrations/useSparkpostApi\";\n\nconst useSparkpostDomain = ({ ownerId, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n const { t } = useTranslation();\n\n const { isLoading, data = {} } = useFetchSparkpostDomain(ownerId, {\n enabled: canManageIntegrations,\n });\n\n const { isPending: isCreating, mutate: createDomain } =\n useCreateSparkpostDomain({ ownerId });\n\n const { isPending: isVerifying, mutate: verifyDomain } =\n useVerifySparkpostDomain({ ownerId });\n\n const { isPending: isDestroying, mutate: destroyDomain } =\n useDestroySparkpostDomain({ ownerId });\n\n const onCreateDomain = (email, onSuccess, onError) => {\n createDomain(\n { sparkpostDomain: { email } },\n {\n onSuccess: response => {\n if (response?.alreadyVerified) {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainVerifiedConnected\")\n );\n }\n onSuccess?.(response);\n },\n onError: error => {\n onError?.(error);\n },\n }\n );\n };\n\n const onVerifyDomain = (onSuccess, onError) => {\n verifyDomain(false, {\n onSuccess: response => {\n if (response?.verified) {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainVerified\")\n );\n } else {\n Toastr.warning(\n t(\"neetoEmailDelivery.sparkpost.toasts.verificationPending\")\n );\n }\n onSuccess?.(response);\n },\n onError: error => {\n onError?.(error);\n },\n });\n };\n\n const onDisconnect = onSuccess => {\n destroyDomain(false, {\n onSuccess: () => {\n Toastr.success(\n t(\"neetoEmailDelivery.sparkpost.toasts.domainDisconnected\")\n );\n setIsDisconnectAlertOpen(false);\n onSuccess?.();\n },\n });\n };\n\n return {\n data,\n isLoading,\n isCreating,\n isVerifying,\n isDestroying,\n isConnected: data?.connected || false,\n isDisconnectAlertOpen,\n setIsDisconnectAlertOpen,\n onCreateDomain,\n onVerifyDomain,\n onDisconnect,\n };\n};\n\nexport default useSparkpostDomain;\n"],"names":["useSparkpostDomain","_ref","ownerId","canManageIntegrations","_useState","useState","_useState2","_slicedToArray","isDisconnectAlertOpen","setIsDisconnectAlertOpen","_useTranslation","useTranslation","t","_useFetchSparkpostDom","useFetchSparkpostDomain","enabled","isLoading","_useFetchSparkpostDom2","data","_useCreateSparkpostDo","useCreateSparkpostDomain","isCreating","isPending","createDomain","mutate","_useVerifySparkpostDo","useVerifySparkpostDomain","isVerifying","verifyDomain","_useDestroySparkpostD","useDestroySparkpostDomain","isDestroying","destroyDomain","onCreateDomain","email","onSuccess","onError","sparkpostDomain","response","alreadyVerified","Toastr","success","error","onVerifyDomain","verified","warning","onDisconnect","isConnected","connected"],"mappings":";;;;;;;;AAYA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAA2C;AAAA,EAAA,IAArCC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEC,qBAAqB,GAAAF,IAAA,CAArBE,qBAAqB;AAC1D,EAAA,IAAAC,SAAA,GAA0DC,cAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlEI,IAAAA,qBAAqB,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,wBAAwB,GAAAH,UAAA,CAAA,CAAA,CAAA;AACtD,EAAA,IAAAI,eAAA,GAAcC,2BAAc,EAAE;IAAtBC,CAAC,GAAAF,eAAA,CAADE,CAAC;AAET,EAAA,IAAAC,qBAAA,GAAiCC,uCAAuB,CAACZ,OAAO,EAAE;AAChEa,MAAAA,OAAO,EAAEZ;AACX,KAAC,CAAC;IAFMa,SAAS,GAAAH,qBAAA,CAATG,SAAS;IAAAC,sBAAA,GAAAJ,qBAAA,CAAEK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,sBAAA,KAAA,KAAA,C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