@bigbinary/neeto-email-delivery-frontend 1.0.33 → 1.0.35
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 +4 -4
- package/app/javascript/src/translations/ar.json +4 -3
- package/app/javascript/src/translations/bg.json +4 -3
- package/app/javascript/src/translations/ca.json +4 -3
- package/app/javascript/src/translations/cs.json +4 -3
- package/app/javascript/src/translations/da.json +4 -3
- package/app/javascript/src/translations/de.json +4 -3
- package/app/javascript/src/translations/en.json +1 -1
- package/app/javascript/src/translations/es-MX.json +4 -3
- package/app/javascript/src/translations/es.json +4 -3
- package/app/javascript/src/translations/et.json +4 -3
- package/app/javascript/src/translations/fi.json +4 -3
- package/app/javascript/src/translations/fil.json +4 -3
- package/app/javascript/src/translations/fr.json +4 -3
- package/app/javascript/src/translations/he.json +4 -3
- package/app/javascript/src/translations/hi.json +4 -3
- package/app/javascript/src/translations/hr.json +4 -3
- package/app/javascript/src/translations/hu.json +4 -3
- package/app/javascript/src/translations/id.json +4 -3
- package/app/javascript/src/translations/it.json +4 -3
- package/app/javascript/src/translations/ja.json +4 -3
- package/app/javascript/src/translations/ko.json +4 -3
- package/app/javascript/src/translations/nl.json +4 -3
- package/app/javascript/src/translations/pl.json +4 -3
- package/app/javascript/src/translations/pt-BR.json +4 -3
- package/app/javascript/src/translations/pt.json +4 -3
- package/app/javascript/src/translations/ro.json +4 -3
- package/app/javascript/src/translations/ru.json +4 -3
- package/app/javascript/src/translations/sk.json +4 -3
- package/app/javascript/src/translations/sl.json +4 -3
- package/app/javascript/src/translations/sv.json +4 -3
- package/app/javascript/src/translations/th.json +4 -3
- package/app/javascript/src/translations/tr.json +4 -3
- package/app/javascript/src/translations/uk.json +4 -3
- package/app/javascript/src/translations/vi.json +4 -3
- package/app/javascript/src/translations/zh-CN.json +4 -3
- package/app/javascript/src/translations/zh-TW.json +4 -3
- package/dist/.ready +1 -1
- package/dist/EmailDeliveryScreen.js +193 -14
- package/dist/EmailDeliveryScreen.js.map +1 -1
- package/dist/PageLayout-B_USy8hj.js +75 -0
- package/dist/PageLayout-B_USy8hj.js.map +1 -0
- package/dist/PageLayout-pMKr_80l.js +103 -0
- package/dist/PageLayout-pMKr_80l.js.map +1 -0
- package/dist/SparkpostDomainSetup.js +3 -3
- package/dist/SparkpostDomainVerify.js +4 -4
- package/dist/Verify-80b6NK1q.js +295 -0
- package/dist/Verify-80b6NK1q.js.map +1 -0
- package/dist/{Verify-Cbn8WE7T.js → Verify-D0bZSCRH.js} +4 -4
- package/dist/{Verify-Cbn8WE7T.js.map → Verify-D0bZSCRH.js.map} +1 -1
- package/dist/Verify-Dnvx5OTi.js +292 -0
- package/dist/Verify-Dnvx5OTi.js.map +1 -0
- package/dist/cjs/EmailDeliveryScreen.js +189 -14
- package/dist/cjs/EmailDeliveryScreen.js.map +1 -1
- package/dist/cjs/index.js +7 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/v2/EmailDeliveryScreen.js +201 -0
- package/dist/cjs/v2/EmailDeliveryScreen.js.map +1 -0
- package/dist/cjs/v2/SparkpostDomainSetup.js +140 -0
- package/dist/cjs/v2/SparkpostDomainSetup.js.map +1 -0
- package/dist/cjs/v2/SparkpostDomainVerify.js +35 -0
- package/dist/cjs/v2/SparkpostDomainVerify.js.map +1 -0
- package/dist/cjs/v2/hooks.js +17 -0
- package/dist/cjs/v2/hooks.js.map +1 -0
- package/dist/cjs/v2/index.js +522 -0
- package/dist/cjs/v2/index.js.map +1 -0
- package/dist/hooks.js +2 -2
- package/dist/index.js +8 -8
- package/dist/{useEmailDeliveryIntegrationApi-Dk9WPotT.js → useEmailDeliveryIntegrationApi-CfgmbuRA.js} +2 -2
- package/dist/{useEmailDeliveryIntegrationApi-Dk9WPotT.js.map → useEmailDeliveryIntegrationApi-CfgmbuRA.js.map} +1 -1
- package/dist/useSmtp-BCcRaVYr.js +136 -0
- package/dist/useSmtp-BCcRaVYr.js.map +1 -0
- package/dist/useSmtp-DxZlXdtr.js +132 -0
- package/dist/useSmtp-DxZlXdtr.js.map +1 -0
- package/dist/{useSparkpostApi-B-D8RNRF.js → useSparkpostApi-CQT4JD8-.js} +2 -2
- package/dist/{useSparkpostApi-B-D8RNRF.js.map → useSparkpostApi-CQT4JD8-.js.map} +1 -1
- package/dist/useSparkpostDomain-DDjj-dyF.js +99 -0
- package/dist/useSparkpostDomain-DDjj-dyF.js.map +1 -0
- package/dist/{useSparkpostDomain-DA1nrWS3.js → useSparkpostDomain-Dt4Q3GSP.js} +2 -2
- package/dist/{useSparkpostDomain-DA1nrWS3.js.map → useSparkpostDomain-Dt4Q3GSP.js.map} +1 -1
- package/dist/useSparkpostDomain-IJPoCQ0f.js +101 -0
- package/dist/useSparkpostDomain-IJPoCQ0f.js.map +1 -0
- package/dist/{index-BbOAmk2e.js → v2/EmailDeliveryScreen.js} +27 -148
- package/dist/v2/EmailDeliveryScreen.js.map +1 -0
- package/dist/v2/SparkpostDomainSetup.js +138 -0
- package/dist/v2/SparkpostDomainSetup.js.map +1 -0
- package/dist/v2/SparkpostDomainVerify.js +29 -0
- package/dist/v2/SparkpostDomainVerify.js.map +1 -0
- package/dist/v2/hooks.js +11 -0
- package/dist/v2/hooks.js.map +1 -0
- package/dist/v2/index.js +499 -0
- package/dist/v2/index.js.map +1 -0
- package/package.json +34 -22
- package/dist/index-BbOAmk2e.js.map +0 -1
- package/dist/index-YMe54v79.js +0 -325
- package/dist/index-YMe54v79.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export { E as EmailDeliveryScreen } from './index-BbOAmk2e.js';
|
|
1
|
+
export { default as EmailDeliveryScreen } from './EmailDeliveryScreen.js';
|
|
3
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
3
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
4
|
import { useState } from 'react';
|
|
@@ -16,7 +15,7 @@ import Toastr from '@bigbinary/neetoui/Toastr';
|
|
|
16
15
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
17
16
|
import { useTranslation, Trans } from 'react-i18next';
|
|
18
17
|
import { useHistory } from 'react-router-dom';
|
|
19
|
-
import {
|
|
18
|
+
import { k as useCreateSmtp, O as OUTLOOK_OAUTH_CONNECT_URL, G as GMAIL_OAUTH_CONNECT_URL } from './useSparkpostApi-CQT4JD8-.js';
|
|
20
19
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
21
20
|
import Form from '@bigbinary/neetoui/formik/Form';
|
|
22
21
|
import Input from '@bigbinary/neetoui/formik/Input';
|
|
@@ -25,16 +24,17 @@ import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
|
25
24
|
import { t } from 'i18next';
|
|
26
25
|
import * as yup from 'yup';
|
|
27
26
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
28
|
-
import { D as DnsRecordsSection } from './Verify-
|
|
29
|
-
export { S as SparkpostDomainVerify } from './Verify-
|
|
30
|
-
import { u as
|
|
31
|
-
import { u as
|
|
27
|
+
import { D as DnsRecordsSection } from './Verify-D0bZSCRH.js';
|
|
28
|
+
export { S as SparkpostDomainVerify } from './Verify-D0bZSCRH.js';
|
|
29
|
+
import { u as useGmail, a as useOutlook, b as useSmtp } from './useSmtp-DxZlXdtr.js';
|
|
30
|
+
import { u as useSparkpostDomain } from './useSparkpostDomain-Dt4Q3GSP.js';
|
|
31
|
+
import { u as useFetchConnectedIntegration } from './useEmailDeliveryIntegrationApi-CfgmbuRA.js';
|
|
32
32
|
import MailSend from '@bigbinary/neeto-icons/MailSend';
|
|
33
33
|
import GmailIcon from '@bigbinary/neeto-icons/misc/Gmail';
|
|
34
34
|
import OutlookIcon from '@bigbinary/neeto-icons/misc/Outlook';
|
|
35
35
|
export { default as SparkpostDomainSetup } from './SparkpostDomainSetup.js';
|
|
36
|
-
import '@tanstack/react-query';
|
|
37
36
|
import '@bigbinary/neetoui/Tag';
|
|
37
|
+
import '@tanstack/react-query';
|
|
38
38
|
import 'axios';
|
|
39
39
|
import 'ramda';
|
|
40
40
|
import './PageLayout-RWJHf21f.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsBy } from '@bigbinary/neeto-cist';
|
|
2
2
|
import { pluck } from 'ramda';
|
|
3
|
-
import {
|
|
3
|
+
import { d as useFetchGmail, e as useFetchOutlook, u as useFetchSparkpostDomain, f as useFetchSmtp } from './useSparkpostApi-CQT4JD8-.js';
|
|
4
4
|
|
|
5
5
|
var useFetchConnectedIntegration = function useFetchConnectedIntegration(ownerId) {
|
|
6
6
|
var _activeIntegration$ho, _activeIntegration$ho2;
|
|
@@ -52,4 +52,4 @@ var useFetchConnectedIntegration = function useFetchConnectedIntegration(ownerId
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
export { useFetchConnectedIntegration as u };
|
|
55
|
-
//# sourceMappingURL=useEmailDeliveryIntegrationApi-
|
|
55
|
+
//# sourceMappingURL=useEmailDeliveryIntegrationApi-CfgmbuRA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEmailDeliveryIntegrationApi-
|
|
1
|
+
{"version":3,"file":"useEmailDeliveryIntegrationApi-CfgmbuRA.js","sources":["../app/javascript/src/hooks/reactQuery/integrations/useEmailDeliveryIntegrationApi.js"],"sourcesContent":["import { existsBy } from \"neetocist\";\nimport { pluck } from \"ramda\";\n\nimport { useFetchGmail } from \"./useGmailIntegrationApi\";\nimport { useFetchOutlook } from \"./useOutlookIntegrationApi\";\nimport { useFetchSmtp } from \"./useSmtpIntegrationApi\";\nimport { useFetchSparkpostDomain } from \"./useSparkpostApi\";\n\nexport const useFetchConnectedIntegration = ownerId => {\n const gmail = useFetchGmail(ownerId);\n const outlook = useFetchOutlook(ownerId);\n const sparkpost = useFetchSparkpostDomain(ownerId);\n const smtp = useFetchSmtp(ownerId);\n\n const integrations = [\n { type: \"gmail\", hook: gmail },\n { type: \"outlook\", hook: outlook },\n { type: \"sparkpost\", hook: sparkpost },\n { type: \"smtp\", hook: smtp },\n ];\n\n const hooks = pluck(\"hook\", integrations);\n\n const isLoading = existsBy({ isLoading: true }, hooks);\n const isError = existsBy({ isError: true }, hooks);\n\n const connectedIntegration = integrations.find(\n ({ hook }) => hook.isSuccess && hook?.data?.connected\n );\n\n const pendingIntegration = !connectedIntegration\n ? integrations.find(\n ({ hook }) =>\n hook.isSuccess && hook?.data?.exists && !hook?.data?.connected\n )\n : null;\n\n const activeIntegration = connectedIntegration || pendingIntegration;\n\n const integration = activeIntegration\n ? {\n type: activeIntegration.type,\n data: activeIntegration.hook?.data,\n isPending: !activeIntegration.hook?.data?.connected,\n }\n : null;\n\n return { integration, isLoading, isError };\n};\n"],"names":["useFetchConnectedIntegration","ownerId","_activeIntegration$ho","_activeIntegration$ho2","gmail","useFetchGmail","outlook","useFetchOutlook","sparkpost","useFetchSparkpostDomain","smtp","useFetchSmtp","integrations","type","hook","hooks","pluck","isLoading","existsBy","isError","connectedIntegration","find","_ref","_hook$data","isSuccess","data","connected","pendingIntegration","_ref2","_hook$data2","_hook$data3","exists","activeIntegration","integration","isPending"],"mappings":";;;;IAQaA,4BAA4B,GAAG,SAA/BA,4BAA4BA,CAAGC,OAAO,EAAI;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;AACrD,EAAA,IAAMC,KAAK,GAAGC,aAAa,CAACJ,OAAO,CAAC;AACpC,EAAA,IAAMK,OAAO,GAAGC,eAAe,CAACN,OAAO,CAAC;AACxC,EAAA,IAAMO,SAAS,GAAGC,uBAAuB,CAACR,OAAO,CAAC;AAClD,EAAA,IAAMS,IAAI,GAAGC,YAAY,CAACV,OAAO,CAAC;EAElC,IAAMW,YAAY,GAAG,CACnB;AAAEC,IAAAA,IAAI,EAAE,OAAO;AAAEC,IAAAA,IAAI,EAAEV;AAAM,GAAC,EAC9B;AAAES,IAAAA,IAAI,EAAE,SAAS;AAAEC,IAAAA,IAAI,EAAER;AAAQ,GAAC,EAClC;AAA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AI,gBAAAgB,WAAA,GAAJhB,IAAI,CAAEW,IAAI,MAAA,IAAA,IAAAK,WAAA,KAAA,MAAA,IAAVA,WAAA,CAAYJ,SAAS,CAAA;EAAA,CAClE,CAAC,GACD,IAAI;AAER,EAAA,IAAMM,iBAAiB,GAAGZ,oBAAoB,IAAIO,kBAAkB;EAEpE,IAAMM,WAAW,GAAGD,iBAAiB,GACjC;IACEnB,IAAI,EAAEmB,iBAAiB,CAACnB,IAAI;IAC5BY,IAAI,EAAA,CAAAvB,qBAAA,GAAE8B,iBAAiB,CAAClB,IAAI,MAAA,IAAA,IAAAZ,qBAAA,KAAA,MAAA,GAAA,MAAA,GAAtBA,qBAAA,CAAwBuB,IAAI;IAClCS,SAAS,EAAE,GAAA/B,sBAAA,GAAC6B,iBAAiB,CAAClB,IAAI,cAAAX,sBAAA,KAAA,MAAA,IAAA,CAAAA,sBAAA,GAAtBA,sBAAA,CAAwBsB,IAAI,MAAA,IAAA,IAAAtB,sBAAA,KAAA,MAAA,IAA5BA,sBAAA,CAA8BuB,SAAS;AACrD,GAAC,GACD,IAAI;EAER,OAAO;AAAEO,IAAAA,WAAW,EAAXA,WAAW;AAAEhB,IAAAA,SAAS,EAATA,SAAS;AAAEE,IAAAA,OAAO,EAAPA;GAAS;AAC5C;;;;"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var reactQuery = require('@tanstack/react-query');
|
|
6
|
+
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
7
|
+
var reactRouterDom = require('react-router-dom');
|
|
8
|
+
var useSparkpostApi = require('./useSparkpostApi-DlgW14Wu.js');
|
|
9
|
+
|
|
10
|
+
var useGmail = function useGmail(_ref) {
|
|
11
|
+
var ownerId = _ref.ownerId,
|
|
12
|
+
indexRoute = _ref.indexRoute,
|
|
13
|
+
canManageIntegrations = _ref.canManageIntegrations;
|
|
14
|
+
var _useState = react.useState(false),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
isDisconnectAlertOpen = _useState2[0],
|
|
17
|
+
setIsDisconnectAlertOpen = _useState2[1];
|
|
18
|
+
var history = reactRouterDom.useHistory();
|
|
19
|
+
var queryClient = reactQuery.useQueryClient();
|
|
20
|
+
var _useFetchGmail = useSparkpostApi.useFetchGmail(ownerId, {
|
|
21
|
+
enabled: canManageIntegrations
|
|
22
|
+
}),
|
|
23
|
+
isLoading = _useFetchGmail.isLoading,
|
|
24
|
+
_useFetchGmail$data = _useFetchGmail.data,
|
|
25
|
+
data = _useFetchGmail$data === void 0 ? {} : _useFetchGmail$data;
|
|
26
|
+
var _useDestroyGmail = useSparkpostApi.useDestroyGmail({
|
|
27
|
+
ownerId: ownerId
|
|
28
|
+
}),
|
|
29
|
+
isDestroying = _useDestroyGmail.isPending,
|
|
30
|
+
destroyIntegration = _useDestroyGmail.mutate;
|
|
31
|
+
var onClose = function onClose() {
|
|
32
|
+
return history.replace(indexRoute);
|
|
33
|
+
};
|
|
34
|
+
var onDisconnect = function onDisconnect() {
|
|
35
|
+
destroyIntegration(false, {
|
|
36
|
+
onSuccess: function onSuccess() {
|
|
37
|
+
utils.showThumbsUpToastr();
|
|
38
|
+
setIsDisconnectAlertOpen(false);
|
|
39
|
+
useSparkpostApi.invalidateAllIntegrationQueries(queryClient, ownerId);
|
|
40
|
+
history.replace(indexRoute);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
data: data,
|
|
46
|
+
isLoading: isLoading,
|
|
47
|
+
isDestroying: isDestroying,
|
|
48
|
+
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
49
|
+
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
50
|
+
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
51
|
+
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
52
|
+
onDisconnect: onDisconnect,
|
|
53
|
+
onClose: onClose,
|
|
54
|
+
errorMessage: data === null || data === void 0 ? void 0 : data.error
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var useOutlook = function useOutlook(_ref) {
|
|
59
|
+
var ownerId = _ref.ownerId,
|
|
60
|
+
indexRoute = _ref.indexRoute,
|
|
61
|
+
canManageIntegrations = _ref.canManageIntegrations;
|
|
62
|
+
var _useState = react.useState(false),
|
|
63
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
64
|
+
isDisconnectAlertOpen = _useState2[0],
|
|
65
|
+
setIsDisconnectAlertOpen = _useState2[1];
|
|
66
|
+
var history = reactRouterDom.useHistory();
|
|
67
|
+
var queryClient = reactQuery.useQueryClient();
|
|
68
|
+
var _useFetchOutlook = useSparkpostApi.useFetchOutlook(ownerId, {
|
|
69
|
+
enabled: canManageIntegrations
|
|
70
|
+
}),
|
|
71
|
+
isLoading = _useFetchOutlook.isLoading,
|
|
72
|
+
_useFetchOutlook$data = _useFetchOutlook.data,
|
|
73
|
+
data = _useFetchOutlook$data === void 0 ? {} : _useFetchOutlook$data;
|
|
74
|
+
var _useDestroyOutlook = useSparkpostApi.useDestroyOutlook({
|
|
75
|
+
ownerId: ownerId
|
|
76
|
+
}),
|
|
77
|
+
isDestroying = _useDestroyOutlook.isPending,
|
|
78
|
+
destroyIntegration = _useDestroyOutlook.mutate;
|
|
79
|
+
var onClose = function onClose() {
|
|
80
|
+
return history.replace(indexRoute);
|
|
81
|
+
};
|
|
82
|
+
var onDisconnect = function onDisconnect() {
|
|
83
|
+
destroyIntegration(false, {
|
|
84
|
+
onSuccess: function onSuccess() {
|
|
85
|
+
utils.showThumbsUpToastr();
|
|
86
|
+
setIsDisconnectAlertOpen(false);
|
|
87
|
+
useSparkpostApi.invalidateAllIntegrationQueries(queryClient, ownerId);
|
|
88
|
+
history.replace(indexRoute);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
return {
|
|
93
|
+
data: data,
|
|
94
|
+
isLoading: isLoading,
|
|
95
|
+
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
96
|
+
status: data === null || data === void 0 ? void 0 : data.status,
|
|
97
|
+
shadowAccount: data === null || data === void 0 ? void 0 : data.shadowAccount,
|
|
98
|
+
isWaitingForTestEmail: (data === null || data === void 0 ? void 0 : data.status) === "inactive" && !(data !== null && data !== void 0 && data.connected),
|
|
99
|
+
isDestroying: isDestroying,
|
|
100
|
+
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
101
|
+
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
102
|
+
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
103
|
+
onDisconnect: onDisconnect,
|
|
104
|
+
onClose: onClose,
|
|
105
|
+
errorMessage: data === null || data === void 0 ? void 0 : data.error
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var useSmtp = function useSmtp(_ref) {
|
|
110
|
+
var ownerId = _ref.ownerId,
|
|
111
|
+
canManageIntegrations = _ref.canManageIntegrations;
|
|
112
|
+
var _useFetchSmtp = useSparkpostApi.useFetchSmtp(ownerId, {
|
|
113
|
+
enabled: canManageIntegrations
|
|
114
|
+
}),
|
|
115
|
+
isLoading = _useFetchSmtp.isLoading,
|
|
116
|
+
_useFetchSmtp$data = _useFetchSmtp.data,
|
|
117
|
+
data = _useFetchSmtp$data === void 0 ? {} : _useFetchSmtp$data;
|
|
118
|
+
var _useDestroySmtp = useSparkpostApi.useDestroySmtp({
|
|
119
|
+
ownerId: ownerId
|
|
120
|
+
}),
|
|
121
|
+
isDestroying = _useDestroySmtp.isPending,
|
|
122
|
+
onDisconnect = _useDestroySmtp.mutate;
|
|
123
|
+
return {
|
|
124
|
+
data: data,
|
|
125
|
+
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
126
|
+
isLoading: isLoading,
|
|
127
|
+
isDestroying: isDestroying,
|
|
128
|
+
onDisconnect: onDisconnect,
|
|
129
|
+
exists: data === null || data === void 0 ? void 0 : data.exists
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
exports.useGmail = useGmail;
|
|
134
|
+
exports.useOutlook = useOutlook;
|
|
135
|
+
exports.useSmtp = useSmtp;
|
|
136
|
+
//# sourceMappingURL=useSmtp-BCcRaVYr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSmtp-BCcRaVYr.js","sources":["../app/javascript/src/hooks/integrations/useGmail.js","../app/javascript/src/hooks/integrations/useOutlook.js","../app/javascript/src/hooks/integrations/useSmtp.js"],"sourcesContent":["import { 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 { invalidateAllIntegrationQueries } from \"src/utils\";\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 { isLoading, data = {} } = useFetchGmail(ownerId, {\n enabled: canManageIntegrations,\n });\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 invalidateAllIntegrationQueries(queryClient, ownerId);\n history.replace(indexRoute);\n },\n });\n };\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 { 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 { invalidateAllIntegrationQueries } from \"src/utils\";\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 { isLoading, data = {} } = useFetchOutlook(ownerId, {\n enabled: canManageIntegrations,\n });\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 invalidateAllIntegrationQueries(queryClient, ownerId);\n history.replace(indexRoute);\n },\n });\n };\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 {\n useFetchSmtp,\n useDestroySmtp,\n} from \"hooks/reactQuery/integrations/useSmtpIntegrationApi\";\n\nconst useSmtp = ({ ownerId, canManageIntegrations }) => {\n const { isLoading, data = {} } = useFetchSmtp(ownerId, {\n enabled: canManageIntegrations,\n });\n\n const { isPending: isDestroying, mutate: onDisconnect } = useDestroySmtp({\n ownerId,\n });\n\n return {\n data,\n isConnected: data?.connected,\n isLoading,\n isDestroying,\n onDisconnect,\n exists: data?.exists,\n };\n};\n\nexport default useSmtp;\n"],"names":["useGmail","_ref","ownerId","indexRoute","canManageIntegrations","_useState","useState","_useState2","_slicedToArray","isDisconnectAlertOpen","setIsDisconnectAlertOpen","history","useHistory","queryClient","useQueryClient","_useFetchGmail","useFetchGmail","enabled","isLoading","_useFetchGmail$data","data","_useDestroyGmail","useDestroyGmail","isDestroying","isPending","destroyIntegration","mutate","onClose","replace","onDisconnect","onSuccess","showThumbsUpToastr","invalidateAllIntegrationQueries","exists","isConnected","connected","errorMessage","error","useOutlook","_useFetchOutlook","useFetchOutlook","_useFetchOutlook$data","_useDestroyOutlook","useDestroyOutlook","status","shadowAccount","isWaitingForTestEmail","useSmtp","_useFetchSmtp","useFetchSmtp","_useFetchSmtp$data","_useDestroySmtp","useDestroySmtp"],"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,GAAiCC,6BAAa,CAACd,OAAO,EAAE;AACtDe,MAAAA,OAAO,EAAEb;AACX,KAAC,CAAC;IAFMc,SAAS,GAAAH,cAAA,CAATG,SAAS;IAAAC,mBAAA,GAAAJ,cAAA,CAAEK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,mBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,mBAAA;EAI5B,IAAAE,gBAAA,GACEC,+BAAe,CAAC;AA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OAAO,GAAG,SAAVA,OAAOA,CAAA9C,IAAA,EAA2C;AAAA,EAAA,IAArCC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEE,qBAAqB,GAAAH,IAAA,CAArBG,qBAAqB;AAC/C,EAAA,IAAA4C,aAAA,GAAiCC,4BAAY,CAAC/C,OAAO,EAAE;AACrDe,MAAAA,OAAO,EAAEb;AACX,KAAC,CAAC;IAFMc,SAAS,GAAA8B,aAAA,CAAT9B,SAAS;IAAAgC,kBAAA,GAAAF,aAAA,CAAE5B,IAAI;AAAJA,IAAAA,IAAI,GAAA8B,kBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,kBAAA;EAI5B,IAAAC,eAAA,GAA0DC,8BAAc,CAAC;AACvElD,MAAAA,OAAO,EAAPA;AACF,KAAC,CAAC;IAFiBqB,YAAY,GAAA4B,eAAA,CAAvB3B,SAAS;IAAwBK,YAAY,GAAAsB,eAAA,CAApBzB,MAAM;EAIvC,OAAO;AACLN,IAAAA,IAAI,EAAJA,IAAI;AACJc,IAAAA,WAAW,EAAEd,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEe,SAAS;AAC5BjB,IAAAA,SAAS,EAATA,SAAS;AACTK,IAAAA,YAAY,EAAZA,YAAY;AACZM,IAAAA,YAAY,EAAZA,YAAY;AACZI,IAAAA,MAAM,EAAEb,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEa;GACf;AACH;;;;;;"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
4
|
+
import { showThumbsUpToastr } from '@bigbinary/neeto-commons-frontend/utils';
|
|
5
|
+
import { useHistory } from 'react-router-dom';
|
|
6
|
+
import { d as useFetchGmail, g as useDestroyGmail, i as invalidateAllIntegrationQueries, e as useFetchOutlook, h as useDestroyOutlook, f as useFetchSmtp, j as useDestroySmtp } from './useSparkpostApi-CQT4JD8-.js';
|
|
7
|
+
|
|
8
|
+
var useGmail = function useGmail(_ref) {
|
|
9
|
+
var ownerId = _ref.ownerId,
|
|
10
|
+
indexRoute = _ref.indexRoute,
|
|
11
|
+
canManageIntegrations = _ref.canManageIntegrations;
|
|
12
|
+
var _useState = useState(false),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
isDisconnectAlertOpen = _useState2[0],
|
|
15
|
+
setIsDisconnectAlertOpen = _useState2[1];
|
|
16
|
+
var history = useHistory();
|
|
17
|
+
var queryClient = useQueryClient();
|
|
18
|
+
var _useFetchGmail = useFetchGmail(ownerId, {
|
|
19
|
+
enabled: canManageIntegrations
|
|
20
|
+
}),
|
|
21
|
+
isLoading = _useFetchGmail.isLoading,
|
|
22
|
+
_useFetchGmail$data = _useFetchGmail.data,
|
|
23
|
+
data = _useFetchGmail$data === void 0 ? {} : _useFetchGmail$data;
|
|
24
|
+
var _useDestroyGmail = useDestroyGmail({
|
|
25
|
+
ownerId: ownerId
|
|
26
|
+
}),
|
|
27
|
+
isDestroying = _useDestroyGmail.isPending,
|
|
28
|
+
destroyIntegration = _useDestroyGmail.mutate;
|
|
29
|
+
var onClose = function onClose() {
|
|
30
|
+
return history.replace(indexRoute);
|
|
31
|
+
};
|
|
32
|
+
var onDisconnect = function onDisconnect() {
|
|
33
|
+
destroyIntegration(false, {
|
|
34
|
+
onSuccess: function onSuccess() {
|
|
35
|
+
showThumbsUpToastr();
|
|
36
|
+
setIsDisconnectAlertOpen(false);
|
|
37
|
+
invalidateAllIntegrationQueries(queryClient, ownerId);
|
|
38
|
+
history.replace(indexRoute);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
data: data,
|
|
44
|
+
isLoading: isLoading,
|
|
45
|
+
isDestroying: isDestroying,
|
|
46
|
+
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
47
|
+
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
48
|
+
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
49
|
+
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
50
|
+
onDisconnect: onDisconnect,
|
|
51
|
+
onClose: onClose,
|
|
52
|
+
errorMessage: data === null || data === void 0 ? void 0 : data.error
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var useOutlook = function useOutlook(_ref) {
|
|
57
|
+
var ownerId = _ref.ownerId,
|
|
58
|
+
indexRoute = _ref.indexRoute,
|
|
59
|
+
canManageIntegrations = _ref.canManageIntegrations;
|
|
60
|
+
var _useState = useState(false),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
isDisconnectAlertOpen = _useState2[0],
|
|
63
|
+
setIsDisconnectAlertOpen = _useState2[1];
|
|
64
|
+
var history = useHistory();
|
|
65
|
+
var queryClient = useQueryClient();
|
|
66
|
+
var _useFetchOutlook = useFetchOutlook(ownerId, {
|
|
67
|
+
enabled: canManageIntegrations
|
|
68
|
+
}),
|
|
69
|
+
isLoading = _useFetchOutlook.isLoading,
|
|
70
|
+
_useFetchOutlook$data = _useFetchOutlook.data,
|
|
71
|
+
data = _useFetchOutlook$data === void 0 ? {} : _useFetchOutlook$data;
|
|
72
|
+
var _useDestroyOutlook = useDestroyOutlook({
|
|
73
|
+
ownerId: ownerId
|
|
74
|
+
}),
|
|
75
|
+
isDestroying = _useDestroyOutlook.isPending,
|
|
76
|
+
destroyIntegration = _useDestroyOutlook.mutate;
|
|
77
|
+
var onClose = function onClose() {
|
|
78
|
+
return history.replace(indexRoute);
|
|
79
|
+
};
|
|
80
|
+
var onDisconnect = function onDisconnect() {
|
|
81
|
+
destroyIntegration(false, {
|
|
82
|
+
onSuccess: function onSuccess() {
|
|
83
|
+
showThumbsUpToastr();
|
|
84
|
+
setIsDisconnectAlertOpen(false);
|
|
85
|
+
invalidateAllIntegrationQueries(queryClient, ownerId);
|
|
86
|
+
history.replace(indexRoute);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
data: data,
|
|
92
|
+
isLoading: isLoading,
|
|
93
|
+
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
94
|
+
status: data === null || data === void 0 ? void 0 : data.status,
|
|
95
|
+
shadowAccount: data === null || data === void 0 ? void 0 : data.shadowAccount,
|
|
96
|
+
isWaitingForTestEmail: (data === null || data === void 0 ? void 0 : data.status) === "inactive" && !(data !== null && data !== void 0 && data.connected),
|
|
97
|
+
isDestroying: isDestroying,
|
|
98
|
+
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
99
|
+
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
100
|
+
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
101
|
+
onDisconnect: onDisconnect,
|
|
102
|
+
onClose: onClose,
|
|
103
|
+
errorMessage: data === null || data === void 0 ? void 0 : data.error
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
var useSmtp = function useSmtp(_ref) {
|
|
108
|
+
var ownerId = _ref.ownerId,
|
|
109
|
+
canManageIntegrations = _ref.canManageIntegrations;
|
|
110
|
+
var _useFetchSmtp = useFetchSmtp(ownerId, {
|
|
111
|
+
enabled: canManageIntegrations
|
|
112
|
+
}),
|
|
113
|
+
isLoading = _useFetchSmtp.isLoading,
|
|
114
|
+
_useFetchSmtp$data = _useFetchSmtp.data,
|
|
115
|
+
data = _useFetchSmtp$data === void 0 ? {} : _useFetchSmtp$data;
|
|
116
|
+
var _useDestroySmtp = useDestroySmtp({
|
|
117
|
+
ownerId: ownerId
|
|
118
|
+
}),
|
|
119
|
+
isDestroying = _useDestroySmtp.isPending,
|
|
120
|
+
onDisconnect = _useDestroySmtp.mutate;
|
|
121
|
+
return {
|
|
122
|
+
data: data,
|
|
123
|
+
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
124
|
+
isLoading: isLoading,
|
|
125
|
+
isDestroying: isDestroying,
|
|
126
|
+
onDisconnect: onDisconnect,
|
|
127
|
+
exists: data === null || data === void 0 ? void 0 : data.exists
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { useOutlook as a, useSmtp as b, useGmail as u };
|
|
132
|
+
//# sourceMappingURL=useSmtp-DxZlXdtr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSmtp-DxZlXdtr.js","sources":["../app/javascript/src/hooks/integrations/useGmail.js","../app/javascript/src/hooks/integrations/useOutlook.js","../app/javascript/src/hooks/integrations/useSmtp.js"],"sourcesContent":["import { 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 { invalidateAllIntegrationQueries } from \"src/utils\";\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 { isLoading, data = {} } = useFetchGmail(ownerId, {\n enabled: canManageIntegrations,\n });\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 invalidateAllIntegrationQueries(queryClient, ownerId);\n history.replace(indexRoute);\n },\n });\n };\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 { 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 { invalidateAllIntegrationQueries } from \"src/utils\";\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 { isLoading, data = {} } = useFetchOutlook(ownerId, {\n enabled: canManageIntegrations,\n });\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 invalidateAllIntegrationQueries(queryClient, ownerId);\n history.replace(indexRoute);\n },\n });\n };\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 {\n useFetchSmtp,\n useDestroySmtp,\n} from \"hooks/reactQuery/integrations/useSmtpIntegrationApi\";\n\nconst useSmtp = ({ ownerId, canManageIntegrations }) => {\n const { isLoading, data = {} } = useFetchSmtp(ownerId, {\n enabled: canManageIntegrations,\n });\n\n const { isPending: isDestroying, mutate: onDisconnect } = useDestroySmtp({\n ownerId,\n });\n\n return {\n data,\n isConnected: data?.connected,\n isLoading,\n isDestroying,\n onDisconnect,\n exists: data?.exists,\n };\n};\n\nexport default useSmtp;\n"],"names":["useGmail","_ref","ownerId","indexRoute","canManageIntegrations","_useState","useState","_useState2","_slicedToArray","isDisconnectAlertOpen","setIsDisconnectAlertOpen","history","useHistory","queryClient","useQueryClient","_useFetchGmail","useFetchGmail","enabled","isLoading","_useFetchGmail$data","data","_useDestroyGmail","useDestroyGmail","isDestroying","isPending","destroyIntegration","mutate","onClose","replace","onDisconnect","onSuccess","showThumbsUpToastr","invalidateAllIntegrationQueries","exists","isConnected","connected","errorMessage","error","useOutlook","_useFetchOutlook","useFetchOutlook","_useFetchOutlook$data","_useDestroyOutlook","useDestroyOutlook","status","shadowAccount","isWaitingForTestEmail","useSmtp","_useFetchSmtp","useFetchSmtp","_useFetchSmtp$data","_useDestroySmtp","useDestroySmtp"],"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,GAAiCC,aAAa,CAACd,OAAO,EAAE;AACtDe,MAAAA,OAAO,EAAEb;AACX,KAAC,CAAC;IAFMc,SAAS,GAAAH,cAAA,CAATG,SAAS;IAAAC,mBAAA,GAAAJ,cAAA,CAAEK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,mBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,mBAA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IAAI,CAAEiB;GACrB;AACH;;ACjDA,IAAMU,OAAO,GAAG,SAAVA,OAAOA,CAAA9C,IAAA,EAA2C;AAAA,EAAA,IAArCC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEE,qBAAqB,GAAAH,IAAA,CAArBG,qBAAqB;AAC/C,EAAA,IAAA4C,aAAA,GAAiCC,YAAY,CAAC/C,OAAO,EAAE;AACrDe,MAAAA,OAAO,EAAEb;AACX,KAAC,CAAC;IAFMc,SAAS,GAAA8B,aAAA,CAAT9B,SAAS;IAAAgC,kBAAA,GAAAF,aAAA,CAAE5B,IAAI;AAAJA,IAAAA,IAAI,GAAA8B,kBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,kBAAA;EAI5B,IAAAC,eAAA,GAA0DC,cAAc,CAAC;AACvElD,MAAAA,OAAO,EAAPA;AACF,KAAC,CAAC;IAFiBqB,YAAY,GAAA4B,eAAA,CAAvB3B,SAAS;IAAwBK,YAAY,GAAAsB,eAAA,CAApBzB,MAAM;EAIvC,OAAO;AACLN,IAAAA,IAAI,EAAJA,IAAI;AACJc,IAAAA,WAAW,EAAEd,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEe,SAAS;AAC5BjB,IAAAA,SAAS,EAATA,SAAS;AACTK,IAAAA,YAAY,EAAZA,YAAY;AACZM,IAAAA,YAAY,EAAZA,YAAY;AACZI,IAAAA,MAAM,EAAEb,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEa;GACf;AACH;;;;"}
|
|
@@ -234,5 +234,5 @@ var useDestroySparkpostDomain = function useDestroySparkpostDomain(_ref3) {
|
|
|
234
234
|
});
|
|
235
235
|
};
|
|
236
236
|
|
|
237
|
-
export { GMAIL_OAUTH_CONNECT_URL as G, OUTLOOK_OAUTH_CONNECT_URL as O,
|
|
238
|
-
//# sourceMappingURL=useSparkpostApi-
|
|
237
|
+
export { GMAIL_OAUTH_CONNECT_URL as G, OUTLOOK_OAUTH_CONNECT_URL as O, useCreateSparkpostDomain as a, useVerifySparkpostDomain as b, useDestroySparkpostDomain as c, useFetchGmail as d, useFetchOutlook as e, useFetchSmtp as f, useDestroyGmail as g, useDestroyOutlook as h, invalidateAllIntegrationQueries as i, useDestroySmtp as j, useCreateSmtp as k, useFetchSparkpostDomain as u };
|
|
238
|
+
//# sourceMappingURL=useSparkpostApi-CQT4JD8-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSparkpostApi-B-D8RNRF.js","sources":["../app/javascript/src/apis/integrations/constants.js","../app/javascript/src/apis/integrations/gmail.js","../app/javascript/src/constants/query.js","../app/javascript/src/hooks/reactQuery/integrations/useGmailIntegrationApi.js","../app/javascript/src/utils.js","../app/javascript/src/apis/integrations/outlook.js","../app/javascript/src/hooks/reactQuery/integrations/useOutlookIntegrationApi.js","../app/javascript/src/apis/integrations/smtp.js","../app/javascript/src/hooks/reactQuery/integrations/useSmtpIntegrationApi.js","../app/javascript/src/apis/integrations/sparkpost_domains.js","../app/javascript/src/hooks/reactQuery/integrations/useSparkpostApi.js"],"sourcesContent":["/* eslint-disable @bigbinary/neeto/api-connector-should-use-default-export */\n\nconst NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL = \"/neeto_email_delivery/api/v1\";\n\nexport const GMAIL_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/gmail`;\nexport const GMAIL_OAUTH_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/integrations/gmail/oauth/:ownerId`;\nexport const GMAIL_OAUTH_CONNECT_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/integrations/gmail/oauth/connect`;\n\nexport const OUTLOOK_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/outlook`;\nexport const OUTLOOK_OAUTH_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/integrations/outlook/oauth/:ownerId`;\nexport const OUTLOOK_OAUTH_CONNECT_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/integrations/outlook/oauth/connect`;\n\nexport const SPARKPOST_DOMAINS_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/sparkpost_domains`;\nexport const SPARKPOST_DOMAINS_INTEGRATIONS_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/integrations/sparkpost_domains`;\nexport const SPARKPOST_DOMAINS_VERIFY_URL = `${SPARKPOST_DOMAINS_INTEGRATIONS_URL}/verify`;\n\nexport const SMTP_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/smtp`;\n","import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport { GMAIL_URL, GMAIL_OAUTH_URL } from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(GMAIL_URL, { ownerId }), { showToastr: false });\n\nconst destroy = ownerId => {\n axios.delete(buildUrl(GMAIL_OAUTH_URL, { ownerId }), { showToastr: false });\n};\n\nconst gmailApi = { get, destroy };\n\nexport default gmailApi;\n","export const QUERY_KEYS = {\n INTEGRATION_GMAIL: \"integration-gmail\",\n INTEGRATION_OUTLOOK: \"integration-outlook\",\n INTEGRATION_SPARKPOST: \"integration-sparkpost\",\n INTEGRATION_SMTP: \"integration-smtp\",\n};\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport gmailApi from \"apis/integrations/gmail\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchGmail = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_GMAIL, ownerId],\n queryFn: () => gmailApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useDestroyGmail = ({ ownerId }) =>\n useMutationWithInvalidation(() => gmailApi.destroy(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_GMAIL, ownerId]],\n });\n","import { QUERY_KEYS } from \"src/constants/query\";\n\nexport const invalidateAllIntegrationQueries = (queryClient, ownerId) => {\n queryClient.invalidateQueries({\n predicate: query => {\n const [key, id] = query.queryKey;\n\n return (\n id === ownerId &&\n [\n QUERY_KEYS.INTEGRATION_GMAIL,\n QUERY_KEYS.INTEGRATION_OUTLOOK,\n QUERY_KEYS.INTEGRATION_SPARKPOST,\n QUERY_KEYS.INTEGRATION_SMTP,\n ].includes(key)\n );\n },\n });\n};\n","import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport { OUTLOOK_URL, OUTLOOK_OAUTH_URL } from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(OUTLOOK_URL, { ownerId }), { showToastr: false });\n\nconst destroy = ownerId => {\n axios.delete(buildUrl(OUTLOOK_OAUTH_URL, { ownerId }), { showToastr: false });\n};\n\nconst outlookApi = { get, destroy };\n\nexport default outlookApi;\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport outlookApi from \"apis/integrations/outlook\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchOutlook = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId],\n queryFn: () => outlookApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useDestroyOutlook = ({ ownerId }) =>\n useMutationWithInvalidation(() => outlookApi.destroy(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId]],\n });\n","import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport { SMTP_URL } from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(SMTP_URL, { ownerId }), { showToastr: false });\n\nconst create = (ownerId, payload) =>\n axios.post(buildUrl(SMTP_URL, { ownerId }), payload);\n\nconst destroy = ownerId => axios.delete(buildUrl(SMTP_URL, { ownerId }));\n\nconst smtpApi = { get, create, destroy };\n\nexport default smtpApi;\n","import { useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport smtpApi from \"apis/integrations/smtp\";\nimport { QUERY_KEYS } from \"src/constants/query\";\nimport { invalidateAllIntegrationQueries } from \"utils\";\n\nexport const useFetchSmtp = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_SMTP, ownerId],\n queryFn: () => smtpApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useCreateSmtp = ({ ownerId }) =>\n useMutationWithInvalidation(payload => smtpApi.create(ownerId, payload), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_SMTP, ownerId]],\n });\n\nexport const useDestroySmtp = ({ ownerId }) => {\n const queryClient = useQueryClient();\n\n return useMutationWithInvalidation(() => smtpApi.destroy(ownerId), {\n keysToInvalidate: [\n [QUERY_KEYS.INTEGRATION_SMTP, ownerId],\n () => invalidateAllIntegrationQueries(queryClient, ownerId),\n ],\n });\n};\n","import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport {\n SPARKPOST_DOMAINS_URL,\n SPARKPOST_DOMAINS_VERIFY_URL,\n SPARKPOST_DOMAINS_INTEGRATIONS_URL,\n} from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(SPARKPOST_DOMAINS_URL, { ownerId }), {\n showToastr: false,\n });\n\nconst create = (ownerId, payload) =>\n axios.post(\n buildUrl(SPARKPOST_DOMAINS_INTEGRATIONS_URL, { ownerId }),\n payload\n );\n\nconst verify = ownerId =>\n axios.post(buildUrl(SPARKPOST_DOMAINS_VERIFY_URL, { ownerId }));\n\nconst destroy = ownerId =>\n axios.delete(buildUrl(SPARKPOST_DOMAINS_INTEGRATIONS_URL, { ownerId }));\n\nconst sparkpostDomainsApi = { get, create, verify, destroy };\n\nexport default sparkpostDomainsApi;\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport sparkpostDomainsApi from \"apis/integrations/sparkpost_domains\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchSparkpostDomain = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_SPARKPOST, ownerId],\n queryFn: () => sparkpostDomainsApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useCreateSparkpostDomain = ({ ownerId }) =>\n useMutationWithInvalidation(\n payload => sparkpostDomainsApi.create(ownerId, payload),\n { keysToInvalidate: [[QUERY_KEYS.INTEGRATION_SPARKPOST, ownerId]] }\n );\n\nexport const useVerifySparkpostDomain = ({ ownerId }) =>\n useMutationWithInvalidation(() => sparkpostDomainsApi.verify(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_SPARKPOST, ownerId]],\n });\n\nexport const useDestroySparkpostDomain = ({ ownerId }) =>\n useMutationWithInvalidation(() => sparkpostDomainsApi.destroy(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_SPARKPOST, ownerId]],\n });\n"],"names":["NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL","GMAIL_URL","concat","GMAIL_OAUTH_URL","GMAIL_OAUTH_CONNECT_URL","OUTLOOK_URL","OUTLOOK_OAUTH_URL","OUTLOOK_OAUTH_CONNECT_URL","SPARKPOST_DOMAINS_URL","SPARKPOST_DOMAINS_INTEGRATIONS_URL","SPARKPOST_DOMAINS_VERIFY_URL","SMTP_URL","get","ownerId","axios","buildUrl","showToastr","destroy","gmailApi","QUERY_KEYS","INTEGRATION_GMAIL","INTEGRATION_OUTLOOK","INTEGRATION_SPARKPOST","INTEGRATION_SMTP","useFetchGmail","options","useQuery","_objectSpread","queryKey","queryFn","retry","useDestroyGmail","_ref","useMutationWithInvalidation","keysToInvalidate","invalidateAllIntegrationQueries","queryClient","invalidateQueries","predicate","query","_query$queryKey","_slicedToArray","key","id","includes","outlookApi","useFetchOutlook","useDestroyOutlook","create","payload","post","smtpApi","useFetchSmtp","useCreateSmtp","useDestroySmtp","_ref2","useQueryClient","verify","sparkpostDomainsApi","useFetchSparkpostDomain","useCreateSparkpostDomain","useVerifySparkpostDomain","useDestroySparkpostDomain","_ref3"],"mappings":";;;;;;;AAAA;;AAEA,IAAMA,oCAAoC,GAAG,8BAA8B;AAEpE,IAAMC,SAAS,GAAA,EAAA,CAAAC,MAAA,CAAMF,oCAAoC,EAAA,QAAA,CAAQ;AACjE,IAAMG,eAAe,GAAA,EAAA,CAAAD,MAAA,CAAMF,oCAAoC,EAAA,oCAAA,CAAoC;IAC7FI,uBAAuB,GAAA,EAAA,CAAAF,MAAA,CAAMF,oCAAoC,EAAA,mCAAA;AAEvE,IAAMK,WAAW,GAAA,EAAA,CAAAH,MAAA,CAAMF,oCAAoC,EAAA,UAAA,CAAU;AACrE,IAAMM,iBAAiB,GAAA,EAAA,CAAAJ,MAAA,CAAMF,oCAAoC,EAAA,sCAAA,CAAsC;IACjGO,yBAAyB,GAAA,EAAA,CAAAL,MAAA,CAAMF,oCAAoC,EAAA,qCAAA;AAEzE,IAAMQ,qBAAqB,GAAA,EAAA,CAAAN,MAAA,CAAMF,oCAAoC,EAAA,oBAAA,CAAoB;AACzF,IAAMS,kCAAkC,GAAA,EAAA,CAAAP,MAAA,CAAMF,oCAAoC,EAAA,iCAAA,CAAiC;AACnH,IAAMU,4BAA4B,GAAA,EAAA,CAAAR,MAAA,CAAMO,kCAAkC,EAAA,SAAA,CAAS;AAEnF,IAAME,QAAQ,GAAA,EAAA,CAAAT,MAAA,CAAMF,oCAAoC,EAAA,OAAA,CAAO;;ACXtE,IAAMY,KAAG,GAAG,SAANA,GAAGA,CAAGC,OAAO,EAAA;AAAA,EAAA,OACjBC,KAAK,CAACF,GAAG,CAACG,QAAQ,CAACd,SAAS,EAAE;AAAEY,IAAAA,OAAO,EAAPA;AAAQ,GAAC,CAAC,EAAE;AAAEG,IAAAA,UAAU,EAAE;AAAM,GAAC,CAAC;AAAA,CAA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OAAO,CAAC;EAAA,CAAA,EAAE;IACtEqB,gBAAgB,EAAE,CAAC,CAACf,UAAU,CAACG,qBAAqB,EAAET,OAAO,CAAC;AAChE,GAAC,CAAC;AAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"useSparkpostApi-CQT4JD8-.js","sources":["../app/javascript/src/apis/integrations/constants.js","../app/javascript/src/apis/integrations/gmail.js","../app/javascript/src/constants/query.js","../app/javascript/src/hooks/reactQuery/integrations/useGmailIntegrationApi.js","../app/javascript/src/utils.js","../app/javascript/src/apis/integrations/outlook.js","../app/javascript/src/hooks/reactQuery/integrations/useOutlookIntegrationApi.js","../app/javascript/src/apis/integrations/smtp.js","../app/javascript/src/hooks/reactQuery/integrations/useSmtpIntegrationApi.js","../app/javascript/src/apis/integrations/sparkpost_domains.js","../app/javascript/src/hooks/reactQuery/integrations/useSparkpostApi.js"],"sourcesContent":["/* eslint-disable @bigbinary/neeto/api-connector-should-use-default-export */\n\nconst NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL = \"/neeto_email_delivery/api/v1\";\n\nexport const GMAIL_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/gmail`;\nexport const GMAIL_OAUTH_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/integrations/gmail/oauth/:ownerId`;\nexport const GMAIL_OAUTH_CONNECT_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/integrations/gmail/oauth/connect`;\n\nexport const OUTLOOK_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/outlook`;\nexport const OUTLOOK_OAUTH_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/integrations/outlook/oauth/:ownerId`;\nexport const OUTLOOK_OAUTH_CONNECT_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/integrations/outlook/oauth/connect`;\n\nexport const SPARKPOST_DOMAINS_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/sparkpost_domains`;\nexport const SPARKPOST_DOMAINS_INTEGRATIONS_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/integrations/sparkpost_domains`;\nexport const SPARKPOST_DOMAINS_VERIFY_URL = `${SPARKPOST_DOMAINS_INTEGRATIONS_URL}/verify`;\n\nexport const SMTP_URL = `${NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL}/smtp`;\n","import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport { GMAIL_URL, GMAIL_OAUTH_URL } from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(GMAIL_URL, { ownerId }), { showToastr: false });\n\nconst destroy = ownerId => {\n axios.delete(buildUrl(GMAIL_OAUTH_URL, { ownerId }), { showToastr: false });\n};\n\nconst gmailApi = { get, destroy };\n\nexport default gmailApi;\n","export const QUERY_KEYS = {\n INTEGRATION_GMAIL: \"integration-gmail\",\n INTEGRATION_OUTLOOK: \"integration-outlook\",\n INTEGRATION_SPARKPOST: \"integration-sparkpost\",\n INTEGRATION_SMTP: \"integration-smtp\",\n};\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport gmailApi from \"apis/integrations/gmail\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchGmail = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_GMAIL, ownerId],\n queryFn: () => gmailApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useDestroyGmail = ({ ownerId }) =>\n useMutationWithInvalidation(() => gmailApi.destroy(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_GMAIL, ownerId]],\n });\n","import { QUERY_KEYS } from \"src/constants/query\";\n\nexport const invalidateAllIntegrationQueries = (queryClient, ownerId) => {\n queryClient.invalidateQueries({\n predicate: query => {\n const [key, id] = query.queryKey;\n\n return (\n id === ownerId &&\n [\n QUERY_KEYS.INTEGRATION_GMAIL,\n QUERY_KEYS.INTEGRATION_OUTLOOK,\n QUERY_KEYS.INTEGRATION_SPARKPOST,\n QUERY_KEYS.INTEGRATION_SMTP,\n ].includes(key)\n );\n },\n });\n};\n","import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport { OUTLOOK_URL, OUTLOOK_OAUTH_URL } from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(OUTLOOK_URL, { ownerId }), { showToastr: false });\n\nconst destroy = ownerId => {\n axios.delete(buildUrl(OUTLOOK_OAUTH_URL, { ownerId }), { showToastr: false });\n};\n\nconst outlookApi = { get, destroy };\n\nexport default outlookApi;\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport outlookApi from \"apis/integrations/outlook\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchOutlook = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId],\n queryFn: () => outlookApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useDestroyOutlook = ({ ownerId }) =>\n useMutationWithInvalidation(() => outlookApi.destroy(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId]],\n });\n","import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport { SMTP_URL } from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(SMTP_URL, { ownerId }), { showToastr: false });\n\nconst create = (ownerId, payload) =>\n axios.post(buildUrl(SMTP_URL, { ownerId }), payload);\n\nconst destroy = ownerId => axios.delete(buildUrl(SMTP_URL, { ownerId }));\n\nconst smtpApi = { get, create, destroy };\n\nexport default smtpApi;\n","import { useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport smtpApi from \"apis/integrations/smtp\";\nimport { QUERY_KEYS } from \"src/constants/query\";\nimport { invalidateAllIntegrationQueries } from \"utils\";\n\nexport const useFetchSmtp = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_SMTP, ownerId],\n queryFn: () => smtpApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useCreateSmtp = ({ ownerId }) =>\n useMutationWithInvalidation(payload => smtpApi.create(ownerId, payload), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_SMTP, ownerId]],\n });\n\nexport const useDestroySmtp = ({ ownerId }) => {\n const queryClient = useQueryClient();\n\n return useMutationWithInvalidation(() => smtpApi.destroy(ownerId), {\n keysToInvalidate: [\n [QUERY_KEYS.INTEGRATION_SMTP, ownerId],\n () => invalidateAllIntegrationQueries(queryClient, ownerId),\n ],\n });\n};\n","import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport {\n SPARKPOST_DOMAINS_URL,\n SPARKPOST_DOMAINS_VERIFY_URL,\n SPARKPOST_DOMAINS_INTEGRATIONS_URL,\n} from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(SPARKPOST_DOMAINS_URL, { ownerId }), {\n showToastr: false,\n });\n\nconst create = (ownerId, payload) =>\n axios.post(\n buildUrl(SPARKPOST_DOMAINS_INTEGRATIONS_URL, { ownerId }),\n payload\n );\n\nconst verify = ownerId =>\n axios.post(buildUrl(SPARKPOST_DOMAINS_VERIFY_URL, { ownerId }));\n\nconst destroy = ownerId =>\n axios.delete(buildUrl(SPARKPOST_DOMAINS_INTEGRATIONS_URL, { ownerId }));\n\nconst sparkpostDomainsApi = { get, create, verify, destroy };\n\nexport default sparkpostDomainsApi;\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport sparkpostDomainsApi from \"apis/integrations/sparkpost_domains\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchSparkpostDomain = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_SPARKPOST, ownerId],\n queryFn: () => sparkpostDomainsApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useCreateSparkpostDomain = ({ ownerId }) =>\n useMutationWithInvalidation(\n payload => sparkpostDomainsApi.create(ownerId, payload),\n { keysToInvalidate: [[QUERY_KEYS.INTEGRATION_SPARKPOST, ownerId]] }\n );\n\nexport const useVerifySparkpostDomain = ({ ownerId }) =>\n useMutationWithInvalidation(() => sparkpostDomainsApi.verify(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_SPARKPOST, ownerId]],\n });\n\nexport const useDestroySparkpostDomain = ({ ownerId }) =>\n useMutationWithInvalidation(() => sparkpostDomainsApi.destroy(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_SPARKPOST, ownerId]],\n });\n"],"names":["NEETO_EMAIL_DELIVERY_ENGINE_BASE_URL","GMAIL_URL","concat","GMAIL_OAUTH_URL","GMAIL_OAUTH_CONNECT_URL","OUTLOOK_URL","OUTLOOK_OAUTH_URL","OUTLOOK_OAUTH_CONNECT_URL","SPARKPOST_DOMAINS_URL","SPARKPOST_DOMAINS_INTEGRATIONS_URL","SPARKPOST_DOMAINS_VERIFY_URL","SMTP_URL","get","ownerId","axios","buildUrl","showToastr","destroy","gmailApi","QUERY_KEYS","INTEGRATION_GMAIL","INTEGRATION_OUTLOOK","INTEGRATION_SPARKPOST","INTEGRATION_SMTP","useFetchGmail","options","useQuery","_objectSpread","queryKey","queryFn","retry","useDestroyGmail","_ref","useMutationWithInvalidation","keysToInvalidate","invalidateAllIntegrationQueries","queryClient","invalidateQueries","predicate","query","_query$queryKey","_slicedToArray","key","id","includes","outlookApi","useFetchOutlook","useDestroyOutlook","create","payload","post","smtpApi","useFetchSmtp","useCreateSmtp","useDestroySmtp","_ref2","useQueryClient","verify","sparkpostDomainsApi","useFetchSparkpostDomain","useCreateSparkpostDomain","useVerifySparkpostDomain","useDestroySparkpostDomain","_ref3"],"mappings":";;;;;;;AAAA;;AAEA,IAAMA,oCAAo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@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Toastr } from '@bigbinary/neeto-atoms';
|
|
4
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { u as useFetchSparkpostDomain, a as useCreateSparkpostDomain, b as useVerifySparkpostDomain, c as useDestroySparkpostDomain, i as invalidateAllIntegrationQueries } from './useSparkpostApi-CQT4JD8-.js';
|
|
7
|
+
|
|
8
|
+
var useSparkpostDomain = function useSparkpostDomain(_ref) {
|
|
9
|
+
var ownerId = _ref.ownerId,
|
|
10
|
+
canManageIntegrations = _ref.canManageIntegrations;
|
|
11
|
+
var _useState = useState(false),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
isDisconnectAlertOpen = _useState2[0],
|
|
14
|
+
setIsDisconnectAlertOpen = _useState2[1];
|
|
15
|
+
var _useTranslation = useTranslation(),
|
|
16
|
+
t = _useTranslation.t;
|
|
17
|
+
var queryClient = useQueryClient();
|
|
18
|
+
var _useFetchSparkpostDom = useFetchSparkpostDomain(ownerId, {
|
|
19
|
+
enabled: canManageIntegrations
|
|
20
|
+
}),
|
|
21
|
+
isLoading = _useFetchSparkpostDom.isLoading,
|
|
22
|
+
_useFetchSparkpostDom2 = _useFetchSparkpostDom.data,
|
|
23
|
+
data = _useFetchSparkpostDom2 === void 0 ? {} : _useFetchSparkpostDom2;
|
|
24
|
+
var _useCreateSparkpostDo = useCreateSparkpostDomain({
|
|
25
|
+
ownerId: ownerId
|
|
26
|
+
}),
|
|
27
|
+
isCreating = _useCreateSparkpostDo.isPending,
|
|
28
|
+
createDomain = _useCreateSparkpostDo.mutate;
|
|
29
|
+
var _useVerifySparkpostDo = useVerifySparkpostDomain({
|
|
30
|
+
ownerId: ownerId
|
|
31
|
+
}),
|
|
32
|
+
isVerifying = _useVerifySparkpostDo.isPending,
|
|
33
|
+
verifyDomain = _useVerifySparkpostDo.mutate;
|
|
34
|
+
var _useDestroySparkpostD = useDestroySparkpostDomain({
|
|
35
|
+
ownerId: ownerId
|
|
36
|
+
}),
|
|
37
|
+
isDestroying = _useDestroySparkpostD.isPending,
|
|
38
|
+
destroyDomain = _useDestroySparkpostD.mutate;
|
|
39
|
+
var onCreateDomain = function onCreateDomain(email, displayName, _onSuccess, _onError) {
|
|
40
|
+
createDomain({
|
|
41
|
+
sparkpostDomain: {
|
|
42
|
+
email: email,
|
|
43
|
+
displayName: displayName
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
onSuccess: function onSuccess(response) {
|
|
47
|
+
if (response !== null && response !== void 0 && response.alreadyVerified) {
|
|
48
|
+
Toastr.success(t("neetoEmailDelivery.sparkpost.toasts.domainVerifiedConnected"));
|
|
49
|
+
}
|
|
50
|
+
_onSuccess === null || _onSuccess === void 0 || _onSuccess(response);
|
|
51
|
+
},
|
|
52
|
+
onError: function onError(error) {
|
|
53
|
+
_onError === null || _onError === void 0 || _onError(error);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
var onVerifyDomain = function onVerifyDomain(_onSuccess2, _onError2) {
|
|
58
|
+
verifyDomain(false, {
|
|
59
|
+
onSuccess: function onSuccess(response) {
|
|
60
|
+
if (response !== null && response !== void 0 && response.verified) {
|
|
61
|
+
Toastr.success(t("neetoEmailDelivery.sparkpost.toasts.domainVerified"));
|
|
62
|
+
} else {
|
|
63
|
+
Toastr.warning(t("neetoEmailDelivery.sparkpost.toasts.verificationPending"));
|
|
64
|
+
}
|
|
65
|
+
_onSuccess2 === null || _onSuccess2 === void 0 || _onSuccess2(response);
|
|
66
|
+
},
|
|
67
|
+
onError: function onError(error) {
|
|
68
|
+
_onError2 === null || _onError2 === void 0 || _onError2(error);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
var onDisconnect = function onDisconnect(_onSuccess3) {
|
|
73
|
+
destroyDomain(false, {
|
|
74
|
+
onSuccess: function onSuccess() {
|
|
75
|
+
Toastr.success(t("neetoEmailDelivery.sparkpost.toasts.domainDisconnected"));
|
|
76
|
+
setIsDisconnectAlertOpen(false);
|
|
77
|
+
invalidateAllIntegrationQueries(queryClient, ownerId);
|
|
78
|
+
_onSuccess3 === null || _onSuccess3 === void 0 || _onSuccess3();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
data: data,
|
|
84
|
+
isLoading: isLoading,
|
|
85
|
+
isCreating: isCreating,
|
|
86
|
+
isVerifying: isVerifying,
|
|
87
|
+
isDestroying: isDestroying,
|
|
88
|
+
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
89
|
+
isConnected: (data === null || data === void 0 ? void 0 : data.connected) || false,
|
|
90
|
+
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
91
|
+
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
92
|
+
onCreateDomain: onCreateDomain,
|
|
93
|
+
onVerifyDomain: onVerifyDomain,
|
|
94
|
+
onDisconnect: onDisconnect
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { useSparkpostDomain as u };
|
|
99
|
+
//# sourceMappingURL=useSparkpostDomain-DDjj-dyF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSparkpostDomain-DDjj-dyF.js","sources":["../app/javascript/src/v2/hooks/integrations/useSparkpostDomain.js"],"sourcesContent":["import { useState } from \"react\";\n\nimport { Toastr } from \"@bigbinary/neeto-atoms\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n useFetchSparkpostDomain,\n useCreateSparkpostDomain,\n useVerifySparkpostDomain,\n useDestroySparkpostDomain,\n} from \"hooks/reactQuery/integrations/useSparkpostApi\";\nimport { invalidateAllIntegrationQueries } from \"src/utils\";\n\nconst useSparkpostDomain = ({ ownerId, canManageIntegrations }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n const { t } = useTranslation();\n const queryClient = useQueryClient();\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, displayName, onSuccess, onError) => {\n createDomain(\n { sparkpostDomain: { email, displayName } },\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 invalidateAllIntegrationQueries(queryClient, ownerId);\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","queryClient","useQueryClient","_useFetchSparkpostDom","useFetchSparkpostDomain","enabled","isLoading","_useFetchSparkpostDom2","data","_useCreateSparkpostDo","useCreateSparkpostDomain","isCreating","isPending","createDomain","mutate","_useVerifySparkpostDo","useVerifySparkpostDomain","isVerifying","verifyDomain","_useDestroySparkpostD","useDestroySparkpostDomain","isDestroying","destroyDomain","onCreateDomain","email","displayName","onSuccess","onError","sparkpostDomain","response","alreadyVerified","Toastr","success","error","onVerifyDomain","verified","warning","onDisconnect","invalidateAllIntegrationQueries","exists","isConnected","connected"],"mappings":";;;;;;;AAcA,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;AACT,EAAA,IAAMC,WAAW,GAAGC,cAAc,EAAE;AAEpC,EAAA,IAAAC,qBAAA,GAAiCC,uBAAuB,CAACd,OAAO,EAAE;AAChEe,MAAAA,OAAO,EAAEd;AACX,KAAC,CAAC;IAFMe,SAAS,GAAAH,qBAAA,CAATG,SAAS;IAAAC,sBAAA,GAAAJ,qBAAA,CAAEK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,sBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,sBAAA;EAI5B,IAAAE,qBAAA,GACEC,wBAAwB,CAAC;AAAEpB,MAAAA,OAAO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I,IAAAA,YAAY,EAAZA,YAAY;AACZkB,IAAAA,MAAM,EAAE/B,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAE+B,MAAM;IACpBC,WAAW,EAAE,CAAAhC,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEiC,SAAS,KAAI,KAAK;AACrC7C,IAAAA,qBAAqB,EAArBA,qBAAqB;AACrBC,IAAAA,wBAAwB,EAAxBA,wBAAwB;AACxB0B,IAAAA,cAAc,EAAdA,cAAc;AACdW,IAAAA,cAAc,EAAdA,cAAc;AACdG,IAAAA,YAAY,EAAZA;GACD;AACH;;;;"}
|
|
@@ -3,7 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
import { useQueryClient } from '@tanstack/react-query';
|
|
4
4
|
import Toastr from '@bigbinary/neetoui/Toastr';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import {
|
|
6
|
+
import { u as useFetchSparkpostDomain, a as useCreateSparkpostDomain, b as useVerifySparkpostDomain, c as useDestroySparkpostDomain, i as invalidateAllIntegrationQueries } from './useSparkpostApi-CQT4JD8-.js';
|
|
7
7
|
|
|
8
8
|
var useSparkpostDomain = function useSparkpostDomain(_ref) {
|
|
9
9
|
var ownerId = _ref.ownerId,
|
|
@@ -96,4 +96,4 @@ var useSparkpostDomain = function useSparkpostDomain(_ref) {
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
export { useSparkpostDomain as u };
|
|
99
|
-
//# sourceMappingURL=useSparkpostDomain-
|
|
99
|
+
//# sourceMappingURL=useSparkpostDomain-Dt4Q3GSP.js.map
|