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