@bigbinary/neeto-email-delivery-frontend 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/javascript/src/translations/en.json +17 -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 +447 -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 +431 -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
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"sparkpost": {
|
|
48
48
|
"ownDomainConfigured": "Own domain is configured for sending emails.",
|
|
49
49
|
"customDomain": "Custom domain",
|
|
50
|
+
"description": "Configure your DKIM and DNS settings to send emails from your custom email provider and not from Neeto.",
|
|
50
51
|
"setup": {
|
|
51
52
|
"title": "Setup own domain for outgoing emails",
|
|
52
53
|
"description": "Enter the email address you want to use for sending emails",
|
|
@@ -108,6 +109,22 @@
|
|
|
108
109
|
"verificationPending": "Verification in progress. DNS records propagation may take up to 24 hours.",
|
|
109
110
|
"domainDisconnected": "Domain disconnected successfully!"
|
|
110
111
|
}
|
|
112
|
+
},
|
|
113
|
+
"integrationDetail": {
|
|
114
|
+
"connectTitle": "Connect {{appName, anyCase}} with {{provider, anyCase}}.",
|
|
115
|
+
"connectedTitle": "Your {{provider, anyCase}} account is connected now.",
|
|
116
|
+
"pendingTitle": "Your {{provider, anyCase}} setup is pending.",
|
|
117
|
+
"connectedEmail": "Connected email: <bold>{{email}}</bold>",
|
|
118
|
+
"onlyOneIntegration": "Currently, you can connect only one email integration at a time. Either Gmail, Outlook, Custom email provider, or SMTP. Please disconnect your <disconnectLink>{{activeProvider, anyCase}}</disconnectLink> integration to connect {{targetProvider, anyCase}}.",
|
|
119
|
+
"pendingIntegrationBlocked": "You have a pending <disconnectLink>{{activeProvider, anyCase}}</disconnectLink> integration. Please disconnect it before connecting {{targetProvider, anyCase}}.",
|
|
120
|
+
"helpArticleText": "To learn how to connect with {{provider, anyCase}}, read this <helpLink>help article</helpLink>.",
|
|
121
|
+
"pending": "Pending",
|
|
122
|
+
"error": "Error",
|
|
123
|
+
"disconnect": "Disconnect",
|
|
124
|
+
"setupDomain": "Set-up domain",
|
|
125
|
+
"connectSmtp": "Connect SMTP",
|
|
126
|
+
"connectGmail": "Connect Gmail",
|
|
127
|
+
"connectOutlook": "Connect Outlook"
|
|
111
128
|
}
|
|
112
129
|
}
|
|
113
130
|
}
|
|
@@ -1,587 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import Form from '@bigbinary/neetoui/formik/Form';
|
|
19
|
-
import Input from '@bigbinary/neetoui/formik/Input';
|
|
20
|
-
import Radio from '@bigbinary/neetoui/formik/Radio';
|
|
21
|
-
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
22
|
-
import { c as useCreateSmtp, u as useFetchGmail, d as useDestroyGmail, a as useFetchOutlook, e as useDestroyOutlook, b as useFetchSmtp, f as useDestroySmtp } from './useOutlookIntegrationApi-b_mNVfRE.js';
|
|
23
|
-
import { t } from 'i18next';
|
|
24
|
-
import * as yup from 'yup';
|
|
25
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
26
|
-
import { useQueryClient } from '@tanstack/react-query';
|
|
27
|
-
import { u as useSparkpostDomain } from './useSparkpostDomain-De-Fz3ek.js';
|
|
28
|
-
import Button from '@bigbinary/neetoui/Button';
|
|
29
|
-
import Tag from '@bigbinary/neetoui/Tag';
|
|
1
|
+
import '@bigbinary/neeto-cist';
|
|
2
|
+
import '@bigbinary/neeto-commons-frontend/react-utils';
|
|
3
|
+
import '@bigbinary/neeto-icons/MailSend';
|
|
4
|
+
import '@bigbinary/neeto-icons/misc/Gmail';
|
|
5
|
+
import '@bigbinary/neeto-icons/misc/Outlook';
|
|
6
|
+
import '@bigbinary/neetoui/Spinner';
|
|
7
|
+
import '@bigbinary/neetoui/Toastr';
|
|
8
|
+
import 'react-i18next';
|
|
9
|
+
import 'react-router-dom';
|
|
10
|
+
export { E as default } from './index-BKKcEEt1.js';
|
|
11
|
+
import './useSparkpostDomain-CmX8ka38.js';
|
|
12
|
+
import 'react/jsx-runtime';
|
|
13
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
14
|
+
import 'react';
|
|
15
|
+
import '@tanstack/react-query';
|
|
16
|
+
import '@bigbinary/neeto-commons-frontend/utils';
|
|
17
|
+
import './useSparkpostApi-tYImubXZ.js';
|
|
30
18
|
import '@babel/runtime/helpers/defineProperty';
|
|
31
19
|
import 'axios';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
label: "StartTLS",
|
|
38
|
-
value: "starttls"
|
|
39
|
-
}, {
|
|
40
|
-
label: "SSL",
|
|
41
|
-
value: "ssl"
|
|
42
|
-
}];
|
|
43
|
-
var SMTP_ACCOUNT_INITIAL_VALUES = {
|
|
44
|
-
host: "",
|
|
45
|
-
port: 587,
|
|
46
|
-
username: "",
|
|
47
|
-
password: "",
|
|
48
|
-
email: "",
|
|
49
|
-
encryption: "starttls",
|
|
50
|
-
displayName: ""
|
|
51
|
-
};
|
|
52
|
-
var SMTP_ACCOUNT_VALIDATION_SCHEMA = yup.object().shape({
|
|
53
|
-
host: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
|
|
54
|
-
field: t("neetoEmailDelivery.smtp.setup.hostLabel")
|
|
55
|
-
})),
|
|
56
|
-
port: yup.number().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
|
|
57
|
-
field: t("neetoEmailDelivery.smtp.setup.portLabel")
|
|
58
|
-
})),
|
|
59
|
-
username: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
|
|
60
|
-
field: t("neetoEmailDelivery.smtp.setup.usernameLabel")
|
|
61
|
-
})),
|
|
62
|
-
password: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
|
|
63
|
-
field: t("neetoEmailDelivery.smtp.setup.passwordLabel")
|
|
64
|
-
})),
|
|
65
|
-
email: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
|
|
66
|
-
field: t("neetoEmailDelivery.smtp.setup.emailLabel")
|
|
67
|
-
})).email(t("neetoEmailDelivery.smtp.setup.emailInvalid")),
|
|
68
|
-
displayName: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
|
|
69
|
-
field: t("neetoEmailDelivery.smtp.setup.displayNameLabel")
|
|
70
|
-
})),
|
|
71
|
-
encryption: yup.string().trim().required(t("neetoEmailDelivery.smtp.setup.requiredField", {
|
|
72
|
-
field: t("neetoEmailDelivery.smtp.setup.encryptionLabel")
|
|
73
|
-
}))
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
var SmtpSetup = function SmtpSetup(_ref) {
|
|
77
|
-
var ownerId = _ref.ownerId,
|
|
78
|
-
onDone = _ref.onDone,
|
|
79
|
-
onCancel = _ref.onCancel,
|
|
80
|
-
isOpen = _ref.isOpen;
|
|
81
|
-
var _useTranslation = useTranslation(),
|
|
82
|
-
t = _useTranslation.t;
|
|
83
|
-
var _useCreateSmtp = useCreateSmtp({
|
|
84
|
-
ownerId: ownerId
|
|
85
|
-
}),
|
|
86
|
-
isCreating = _useCreateSmtp.isPending,
|
|
87
|
-
createSmtp = _useCreateSmtp.mutate;
|
|
88
|
-
var handleSubmit = function handleSubmit(values) {
|
|
89
|
-
createSmtp({
|
|
90
|
-
smtp_account: values
|
|
91
|
-
}, {
|
|
92
|
-
onSuccess: onDone
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
return /*#__PURE__*/jsxs(Pane, {
|
|
96
|
-
isOpen: isOpen,
|
|
97
|
-
size: "lg",
|
|
98
|
-
onClose: onCancel,
|
|
99
|
-
children: [/*#__PURE__*/jsx(Pane.Header, {
|
|
100
|
-
children: /*#__PURE__*/jsx(Typography, {
|
|
101
|
-
style: "h2",
|
|
102
|
-
weight: "semibold",
|
|
103
|
-
children: t("neetoEmailDelivery.smtp.setup.title")
|
|
104
|
-
})
|
|
105
|
-
}), /*#__PURE__*/jsxs(Form, {
|
|
106
|
-
className: "w-full",
|
|
107
|
-
formikProps: {
|
|
108
|
-
initialValues: SMTP_ACCOUNT_INITIAL_VALUES,
|
|
109
|
-
validationSchema: SMTP_ACCOUNT_VALIDATION_SCHEMA,
|
|
110
|
-
onSubmit: handleSubmit
|
|
111
|
-
},
|
|
112
|
-
children: [/*#__PURE__*/jsx(Pane.Body, {
|
|
113
|
-
className: "space-y-4",
|
|
114
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
115
|
-
className: "flex flex-col gap-6",
|
|
116
|
-
children: [/*#__PURE__*/jsx(Callout, {
|
|
117
|
-
style: "warning",
|
|
118
|
-
children: t("neetoEmailDelivery.smtp.setup.note")
|
|
119
|
-
}), /*#__PURE__*/jsx(Input, {
|
|
120
|
-
required: true,
|
|
121
|
-
label: t("neetoEmailDelivery.smtp.setup.hostLabel"),
|
|
122
|
-
name: "host"
|
|
123
|
-
}), /*#__PURE__*/jsx(Input, {
|
|
124
|
-
required: true,
|
|
125
|
-
label: t("neetoEmailDelivery.smtp.setup.portLabel"),
|
|
126
|
-
name: "port",
|
|
127
|
-
type: "number"
|
|
128
|
-
}), /*#__PURE__*/jsx(Input, {
|
|
129
|
-
required: true,
|
|
130
|
-
label: t("neetoEmailDelivery.smtp.setup.usernameLabel"),
|
|
131
|
-
name: "username"
|
|
132
|
-
}), /*#__PURE__*/jsx(Input, {
|
|
133
|
-
required: true,
|
|
134
|
-
label: t("neetoEmailDelivery.smtp.setup.passwordLabel"),
|
|
135
|
-
name: "password",
|
|
136
|
-
type: "password"
|
|
137
|
-
}), /*#__PURE__*/jsx(Input, {
|
|
138
|
-
required: true,
|
|
139
|
-
label: t("neetoEmailDelivery.smtp.setup.emailLabel"),
|
|
140
|
-
name: "email",
|
|
141
|
-
type: "email"
|
|
142
|
-
}), /*#__PURE__*/jsx(Input, {
|
|
143
|
-
required: true,
|
|
144
|
-
label: t("neetoEmailDelivery.smtp.setup.displayNameLabel"),
|
|
145
|
-
name: "displayName"
|
|
146
|
-
}), /*#__PURE__*/jsx(Radio, {
|
|
147
|
-
label: t("neetoEmailDelivery.smtp.setup.encryptionLabel"),
|
|
148
|
-
name: "encryption",
|
|
149
|
-
children: ENCRYPTION_OPTIONS.map(function (option) {
|
|
150
|
-
return /*#__PURE__*/jsx(Radio.Item, {
|
|
151
|
-
label: option.label,
|
|
152
|
-
value: option.value
|
|
153
|
-
}, option.value);
|
|
154
|
-
})
|
|
155
|
-
})]
|
|
156
|
-
})
|
|
157
|
-
}), /*#__PURE__*/jsx(Pane.Footer, {
|
|
158
|
-
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
159
|
-
cancelButtonProps: {
|
|
160
|
-
onClick: onCancel
|
|
161
|
-
},
|
|
162
|
-
isSubmitting: isCreating,
|
|
163
|
-
submitButtonProps: {
|
|
164
|
-
label: t("neetoEmailDelivery.smtp.setup.saveAndActivate")
|
|
165
|
-
}
|
|
166
|
-
})
|
|
167
|
-
})]
|
|
168
|
-
})]
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
var useGmail = function useGmail(_ref) {
|
|
173
|
-
var ownerId = _ref.ownerId,
|
|
174
|
-
indexRoute = _ref.indexRoute,
|
|
175
|
-
canManageIntegrations = _ref.canManageIntegrations;
|
|
176
|
-
var _useState = useState(false),
|
|
177
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
178
|
-
isDisconnectAlertOpen = _useState2[0],
|
|
179
|
-
setIsDisconnectAlertOpen = _useState2[1];
|
|
180
|
-
var history = useHistory();
|
|
181
|
-
var queryClient = useQueryClient();
|
|
182
|
-
var _useFetchGmail = useFetchGmail(ownerId, {
|
|
183
|
-
enabled: canManageIntegrations
|
|
184
|
-
}),
|
|
185
|
-
isLoading = _useFetchGmail.isLoading,
|
|
186
|
-
_useFetchGmail$data = _useFetchGmail.data,
|
|
187
|
-
data = _useFetchGmail$data === void 0 ? {} : _useFetchGmail$data;
|
|
188
|
-
var _useDestroyGmail = useDestroyGmail({
|
|
189
|
-
ownerId: ownerId
|
|
190
|
-
}),
|
|
191
|
-
isDestroying = _useDestroyGmail.isPending,
|
|
192
|
-
destroyIntegration = _useDestroyGmail.mutate;
|
|
193
|
-
var onClose = function onClose() {
|
|
194
|
-
return history.replace(indexRoute);
|
|
195
|
-
};
|
|
196
|
-
var onDisconnect = function onDisconnect() {
|
|
197
|
-
destroyIntegration(false, {
|
|
198
|
-
onSuccess: function onSuccess() {
|
|
199
|
-
showThumbsUpToastr();
|
|
200
|
-
setIsDisconnectAlertOpen(false);
|
|
201
|
-
invalidateAllIntegrationQueries(queryClient, ownerId);
|
|
202
|
-
history.replace(indexRoute);
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
return {
|
|
207
|
-
data: data,
|
|
208
|
-
isLoading: isLoading,
|
|
209
|
-
isDestroying: isDestroying,
|
|
210
|
-
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
211
|
-
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
212
|
-
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
213
|
-
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
214
|
-
onDisconnect: onDisconnect,
|
|
215
|
-
onClose: onClose,
|
|
216
|
-
errorMessage: data === null || data === void 0 ? void 0 : data.error
|
|
217
|
-
};
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
var useOutlook = function useOutlook(_ref) {
|
|
221
|
-
var ownerId = _ref.ownerId,
|
|
222
|
-
indexRoute = _ref.indexRoute,
|
|
223
|
-
canManageIntegrations = _ref.canManageIntegrations;
|
|
224
|
-
var _useState = useState(false),
|
|
225
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
226
|
-
isDisconnectAlertOpen = _useState2[0],
|
|
227
|
-
setIsDisconnectAlertOpen = _useState2[1];
|
|
228
|
-
var history = useHistory();
|
|
229
|
-
var queryClient = useQueryClient();
|
|
230
|
-
var _useFetchOutlook = useFetchOutlook(ownerId, {
|
|
231
|
-
enabled: canManageIntegrations
|
|
232
|
-
}),
|
|
233
|
-
isLoading = _useFetchOutlook.isLoading,
|
|
234
|
-
_useFetchOutlook$data = _useFetchOutlook.data,
|
|
235
|
-
data = _useFetchOutlook$data === void 0 ? {} : _useFetchOutlook$data;
|
|
236
|
-
var _useDestroyOutlook = useDestroyOutlook({
|
|
237
|
-
ownerId: ownerId
|
|
238
|
-
}),
|
|
239
|
-
isDestroying = _useDestroyOutlook.isPending,
|
|
240
|
-
destroyIntegration = _useDestroyOutlook.mutate;
|
|
241
|
-
var onClose = function onClose() {
|
|
242
|
-
return history.replace(indexRoute);
|
|
243
|
-
};
|
|
244
|
-
var onDisconnect = function onDisconnect() {
|
|
245
|
-
destroyIntegration(false, {
|
|
246
|
-
onSuccess: function onSuccess() {
|
|
247
|
-
showThumbsUpToastr();
|
|
248
|
-
setIsDisconnectAlertOpen(false);
|
|
249
|
-
invalidateAllIntegrationQueries(queryClient, ownerId);
|
|
250
|
-
history.replace(indexRoute);
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
};
|
|
254
|
-
return {
|
|
255
|
-
data: data,
|
|
256
|
-
isLoading: isLoading,
|
|
257
|
-
exists: data === null || data === void 0 ? void 0 : data.exists,
|
|
258
|
-
status: data === null || data === void 0 ? void 0 : data.status,
|
|
259
|
-
shadowAccount: data === null || data === void 0 ? void 0 : data.shadowAccount,
|
|
260
|
-
isWaitingForTestEmail: (data === null || data === void 0 ? void 0 : data.status) === "inactive" && !(data !== null && data !== void 0 && data.connected),
|
|
261
|
-
isDestroying: isDestroying,
|
|
262
|
-
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
263
|
-
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
264
|
-
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
265
|
-
onDisconnect: onDisconnect,
|
|
266
|
-
onClose: onClose,
|
|
267
|
-
errorMessage: data === null || data === void 0 ? void 0 : data.error
|
|
268
|
-
};
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
var useSmtp = function useSmtp(_ref) {
|
|
272
|
-
var ownerId = _ref.ownerId,
|
|
273
|
-
canManageIntegrations = _ref.canManageIntegrations;
|
|
274
|
-
var _useFetchSmtp = useFetchSmtp(ownerId, {
|
|
275
|
-
enabled: canManageIntegrations
|
|
276
|
-
}),
|
|
277
|
-
isLoading = _useFetchSmtp.isLoading,
|
|
278
|
-
_useFetchSmtp$data = _useFetchSmtp.data,
|
|
279
|
-
data = _useFetchSmtp$data === void 0 ? {} : _useFetchSmtp$data;
|
|
280
|
-
var _useDestroySmtp = useDestroySmtp({
|
|
281
|
-
ownerId: ownerId
|
|
282
|
-
}),
|
|
283
|
-
isDestroying = _useDestroySmtp.isPending,
|
|
284
|
-
onDisconnect = _useDestroySmtp.mutate;
|
|
285
|
-
return {
|
|
286
|
-
data: data,
|
|
287
|
-
isConnected: data === null || data === void 0 ? void 0 : data.connected,
|
|
288
|
-
isLoading: isLoading,
|
|
289
|
-
isDestroying: isDestroying,
|
|
290
|
-
onDisconnect: onDisconnect,
|
|
291
|
-
exists: data === null || data === void 0 ? void 0 : data.exists
|
|
292
|
-
};
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
var ERROR_MESSAGES = {
|
|
296
|
-
gmail_permission_not_given: t("neetoEmailDelivery.gmail.permissionNotGiven"),
|
|
297
|
-
outlook_permission_not_given: t("neetoEmailDelivery.outlook.permissionNotGiven"),
|
|
298
|
-
outlook_invalid_client: t("neetoEmailDelivery.outlook.invalidClient"),
|
|
299
|
-
outlook_nil_json_web_token: t("neetoEmailDelivery.outlook.nilJsonWebToken")
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
var IntegrationCard = function IntegrationCard(_ref) {
|
|
303
|
-
var Icon = _ref.icon,
|
|
304
|
-
title = _ref.title,
|
|
305
|
-
description = _ref.description,
|
|
306
|
-
isConnected = _ref.isConnected,
|
|
307
|
-
isDisconnecting = _ref.isDisconnecting,
|
|
308
|
-
onConnect = _ref.onConnect,
|
|
309
|
-
onDisconnect = _ref.onDisconnect,
|
|
310
|
-
connectButtonText = _ref.connectButtonText,
|
|
311
|
-
_ref$disconnectButton = _ref.disconnectButtonText,
|
|
312
|
-
disconnectButtonText = _ref$disconnectButton === void 0 ? "neetoEmailDelivery.sparkpost.emailDelivery.disconnect" : _ref$disconnectButton,
|
|
313
|
-
_ref$connectedTagText = _ref.connectedTagText,
|
|
314
|
-
connectedTagText = _ref$connectedTagText === void 0 ? "neetoEmailDelivery.sparkpost.emailDelivery.connected" : _ref$connectedTagText,
|
|
315
|
-
_ref$showDisconnect = _ref.showDisconnect,
|
|
316
|
-
showDisconnect = _ref$showDisconnect === void 0 ? false : _ref$showDisconnect,
|
|
317
|
-
_ref$showManageButton = _ref.showManageButton,
|
|
318
|
-
showManageButton = _ref$showManageButton === void 0 ? false : _ref$showManageButton,
|
|
319
|
-
manageButtonText = _ref.manageButtonText,
|
|
320
|
-
onManage = _ref.onManage;
|
|
321
|
-
var _useTranslation = useTranslation(),
|
|
322
|
-
t = _useTranslation.t;
|
|
323
|
-
var shouldShowDisconnect = isConnected || showDisconnect;
|
|
324
|
-
return /*#__PURE__*/jsx("div", {
|
|
325
|
-
className: "neeto-ui-rounded-lg neeto-ui-shadow-xs neeto-ui-border-gray-300 translate flex flex-col gap-y-4 border p-6 no-underline transition-transform duration-300 ease-in-out outline-none hover:-translate-y-1",
|
|
326
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
327
|
-
className: "flex flex-col gap-4 grow min-h-0",
|
|
328
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
329
|
-
className: "flex items-center gap-3",
|
|
330
|
-
children: [/*#__PURE__*/jsx(Icon, {
|
|
331
|
-
className: "shrink-0",
|
|
332
|
-
size: 32
|
|
333
|
-
}), /*#__PURE__*/jsx("div", {
|
|
334
|
-
className: "min-w-0 flex-1",
|
|
335
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
336
|
-
className: "flex items-center gap-2",
|
|
337
|
-
children: [/*#__PURE__*/jsx(Typography, {
|
|
338
|
-
style: "h4",
|
|
339
|
-
weight: "semibold",
|
|
340
|
-
children: title
|
|
341
|
-
}), isConnected && /*#__PURE__*/jsx(Tag, {
|
|
342
|
-
label: t(connectedTagText)
|
|
343
|
-
})]
|
|
344
|
-
})
|
|
345
|
-
})]
|
|
346
|
-
}), /*#__PURE__*/jsx(Typography, {
|
|
347
|
-
className: "min-w-0 break-words",
|
|
348
|
-
style: "body2",
|
|
349
|
-
children: description
|
|
350
|
-
}), connectButtonText && /*#__PURE__*/jsxs("div", {
|
|
351
|
-
className: "flex gap-2 mt-auto",
|
|
352
|
-
children: [showManageButton && /*#__PURE__*/jsx(Button, {
|
|
353
|
-
"data-testid": "manage-button",
|
|
354
|
-
label: t(manageButtonText),
|
|
355
|
-
size: "small",
|
|
356
|
-
style: "secondary",
|
|
357
|
-
onClick: onManage
|
|
358
|
-
}), shouldShowDisconnect ? /*#__PURE__*/jsx(Button, {
|
|
359
|
-
"data-testid": "disconnect-button",
|
|
360
|
-
label: t(disconnectButtonText),
|
|
361
|
-
loading: isDisconnecting,
|
|
362
|
-
size: "small",
|
|
363
|
-
style: "danger",
|
|
364
|
-
onClick: onDisconnect
|
|
365
|
-
}) : /*#__PURE__*/jsx(Button, {
|
|
366
|
-
"data-testid": "connect-button",
|
|
367
|
-
label: t(connectButtonText),
|
|
368
|
-
size: "small",
|
|
369
|
-
style: "primary",
|
|
370
|
-
onClick: onConnect
|
|
371
|
-
})]
|
|
372
|
-
})]
|
|
373
|
-
})
|
|
374
|
-
});
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
378
|
-
var indexRoute = _ref.indexRoute,
|
|
379
|
-
ownerId = _ref.ownerId,
|
|
380
|
-
ownDomainSetupRoute = _ref.ownDomainSetupRoute,
|
|
381
|
-
ownDomainVerifyRoute = _ref.ownDomainVerifyRoute,
|
|
382
|
-
canManageIntegrations = _ref.canManageIntegrations;
|
|
383
|
-
var _useTranslation = useTranslation(),
|
|
384
|
-
t = _useTranslation.t;
|
|
385
|
-
var history = useHistory();
|
|
386
|
-
var _useState = useState(false),
|
|
387
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
388
|
-
isSmtpPaneOpen = _useState2[0],
|
|
389
|
-
setIsSmtpPaneOpen = _useState2[1];
|
|
390
|
-
var _useQueryParams = useQueryParams(),
|
|
391
|
-
error = _useQueryParams.error,
|
|
392
|
-
errorDescription = _useQueryParams.errorDescription;
|
|
393
|
-
if (isPresent(error)) {
|
|
394
|
-
var _errorMessage;
|
|
395
|
-
var errorMessage = ERROR_MESSAGES[error];
|
|
396
|
-
if (errorDescription) {
|
|
397
|
-
errorMessage = "".concat(errorMessage, " ").concat(errorDescription);
|
|
398
|
-
}
|
|
399
|
-
Toastr.error((_errorMessage = errorMessage) !== null && _errorMessage !== void 0 ? _errorMessage : humanize(error));
|
|
400
|
-
history.replace(indexRoute);
|
|
401
|
-
}
|
|
402
|
-
var gmailIntegration = useGmail({
|
|
403
|
-
ownerId: ownerId,
|
|
404
|
-
indexRoute: indexRoute,
|
|
405
|
-
canManageIntegrations: canManageIntegrations
|
|
406
|
-
});
|
|
407
|
-
var outlookIntegration = useOutlook({
|
|
408
|
-
ownerId: ownerId,
|
|
409
|
-
indexRoute: indexRoute,
|
|
410
|
-
canManageIntegrations: canManageIntegrations
|
|
411
|
-
});
|
|
412
|
-
var sparkpostIntegration = useSparkpostDomain({
|
|
413
|
-
ownerId: ownerId,
|
|
414
|
-
canManageIntegrations: canManageIntegrations
|
|
415
|
-
});
|
|
416
|
-
var smtpIntegration = useSmtp({
|
|
417
|
-
ownerId: ownerId,
|
|
418
|
-
canManageIntegrations: canManageIntegrations
|
|
419
|
-
});
|
|
420
|
-
var _gmailIntegration$dat = gmailIntegration.data,
|
|
421
|
-
gmailData = _gmailIntegration$dat === void 0 ? {} : _gmailIntegration$dat,
|
|
422
|
-
isGmailConnected = gmailIntegration.isConnected,
|
|
423
|
-
isGmailLoading = gmailIntegration.isLoading,
|
|
424
|
-
isGmailDisconnecting = gmailIntegration.isDestroying,
|
|
425
|
-
onGmailDisconnect = gmailIntegration.onDisconnect,
|
|
426
|
-
isGmailExists = gmailIntegration.exists;
|
|
427
|
-
var _outlookIntegration$d = outlookIntegration.data,
|
|
428
|
-
outlookData = _outlookIntegration$d === void 0 ? {} : _outlookIntegration$d,
|
|
429
|
-
isOutlookConnected = outlookIntegration.isConnected,
|
|
430
|
-
isOutlookLoading = outlookIntegration.isLoading,
|
|
431
|
-
isOutlookDisconnecting = outlookIntegration.isDestroying,
|
|
432
|
-
isOutlookWaitingForTestEmail = outlookIntegration.isWaitingForTestEmail,
|
|
433
|
-
isOutlookShadowAccount = outlookIntegration.shadowAccount,
|
|
434
|
-
onOutlookDisconnect = outlookIntegration.onDisconnect,
|
|
435
|
-
isOutlookExists = outlookIntegration.exists;
|
|
436
|
-
var _sparkpostIntegration = sparkpostIntegration.data,
|
|
437
|
-
sparkpostData = _sparkpostIntegration === void 0 ? {} : _sparkpostIntegration,
|
|
438
|
-
isSparkpostConnected = sparkpostIntegration.isConnected,
|
|
439
|
-
isSparkpostLoading = sparkpostIntegration.isLoading,
|
|
440
|
-
onSparkpostDisconnect = sparkpostIntegration.onDisconnect,
|
|
441
|
-
isSparkpostDisconnecting = sparkpostIntegration.isDestroying,
|
|
442
|
-
isSparkpostExists = sparkpostIntegration.exists;
|
|
443
|
-
var _smtpIntegration$data = smtpIntegration.data,
|
|
444
|
-
smtpData = _smtpIntegration$data === void 0 ? {} : _smtpIntegration$data,
|
|
445
|
-
isSmtpConnected = smtpIntegration.isConnected,
|
|
446
|
-
isSmtpLoading = smtpIntegration.isLoading,
|
|
447
|
-
isSmtpDisconnecting = smtpIntegration.isDestroying,
|
|
448
|
-
onSmtpDisconnect = smtpIntegration.onDisconnect,
|
|
449
|
-
isSmtpExists = smtpIntegration.exists;
|
|
450
|
-
var isLoading = isGmailLoading || isOutlookLoading || isSparkpostLoading || isSmtpLoading;
|
|
451
|
-
var noneExists = !isGmailExists && !isOutlookExists && !isSparkpostExists && !isSmtpExists;
|
|
452
|
-
var showGmail = noneExists || isGmailExists;
|
|
453
|
-
var showOutlook = noneExists || isOutlookExists;
|
|
454
|
-
var showSparkpost = noneExists || isSparkpostExists;
|
|
455
|
-
var showSmtp = noneExists || isSmtpExists;
|
|
456
|
-
var sparkpostVerificationPending = isSparkpostExists && !isSparkpostConnected;
|
|
457
|
-
var handleGmailConnect = function handleGmailConnect() {
|
|
458
|
-
window.location.href = buildUrl(GMAIL_OAUTH_CONNECT_URL, {
|
|
459
|
-
ownerId: ownerId
|
|
460
|
-
});
|
|
461
|
-
};
|
|
462
|
-
var handleOutlookConnect = function handleOutlookConnect() {
|
|
463
|
-
window.location.href = buildUrl(OUTLOOK_OAUTH_CONNECT_URL, {
|
|
464
|
-
ownerId: ownerId
|
|
465
|
-
});
|
|
466
|
-
};
|
|
467
|
-
var handleOwnDomainConnect = function handleOwnDomainConnect() {
|
|
468
|
-
history.push(ownDomainSetupRoute);
|
|
469
|
-
};
|
|
470
|
-
var handleSmtpConnect = function handleSmtpConnect() {
|
|
471
|
-
setIsSmtpPaneOpen(true);
|
|
472
|
-
};
|
|
473
|
-
var handleSmtpPaneClose = function handleSmtpPaneClose() {
|
|
474
|
-
setIsSmtpPaneOpen(false);
|
|
475
|
-
};
|
|
476
|
-
var gmailEmail = prop("email", gmailData);
|
|
477
|
-
var outlookEmail = prop("email", outlookData);
|
|
478
|
-
var sparkpostEmail = prop("email", sparkpostData);
|
|
479
|
-
var sparkpostDomain = prop("domain", sparkpostData);
|
|
480
|
-
var smtpEmail = prop("email", smtpData);
|
|
481
|
-
var showVerificationPage = function showVerificationPage() {
|
|
482
|
-
history.push(buildUrl(ownDomainVerifyRoute, {
|
|
483
|
-
domain: sparkpostDomain,
|
|
484
|
-
email: sparkpostEmail
|
|
485
|
-
}));
|
|
486
|
-
};
|
|
487
|
-
var gmailTitle = t("neetoEmailDelivery.gmail.title");
|
|
488
|
-
var gmailDescription = isGmailConnected ? t("neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail", {
|
|
489
|
-
email: gmailEmail
|
|
490
|
-
}) : t("neetoEmailDelivery.gmail.description");
|
|
491
|
-
var outlookTitle = t("neetoEmailDelivery.outlook.title");
|
|
492
|
-
var outlookDescription = isOutlookConnected ? t("neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail", {
|
|
493
|
-
email: outlookEmail
|
|
494
|
-
}) : t("neetoEmailDelivery.outlook.description");
|
|
495
|
-
var ownDomainTitle = t("neetoEmailDelivery.sparkpost.emailDelivery.ownDomainTitle");
|
|
496
|
-
var ownDomainDescription = isSparkpostConnected ? t("neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail", {
|
|
497
|
-
email: sparkpostEmail
|
|
498
|
-
}) : t("neetoEmailDelivery.sparkpost.emailDelivery.ownDomainDescription");
|
|
499
|
-
var smtpTitle = t("neetoEmailDelivery.smtp.title");
|
|
500
|
-
var smtpDescription = isSmtpConnected ? t("neetoEmailDelivery.sparkpost.emailDelivery.connectedEmail", {
|
|
501
|
-
email: smtpEmail
|
|
502
|
-
}) : t("neetoEmailDelivery.smtp.description");
|
|
503
|
-
if (isLoading) {
|
|
504
|
-
return /*#__PURE__*/jsx("div", {
|
|
505
|
-
className: "flex grow items-center justify-center w-full",
|
|
506
|
-
children: /*#__PURE__*/jsx(Spinner, {})
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
var activeMessage = isGmailConnected && t("neetoEmailDelivery.gmail.gmailConfigured") || isOutlookConnected && t("neetoEmailDelivery.outlook.outlookConfigured") || isSparkpostConnected && t("neetoEmailDelivery.sparkpost.ownDomainConfigured") || isSmtpConnected && t("neetoEmailDelivery.smtp.smtpConfigured");
|
|
510
|
-
return /*#__PURE__*/jsxs("div", {
|
|
511
|
-
className: "min-h-0 w-full grow",
|
|
512
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
513
|
-
className: "@container mx-auto space-y-6",
|
|
514
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
515
|
-
className: "grid grid-cols-1 gap-3 py-1 @lg:grid-cols-2 @lg:gap-6 @3xl:grid-cols-3 @7xl:grid-cols-4",
|
|
516
|
-
children: [showGmail && /*#__PURE__*/jsx(IntegrationCard, {
|
|
517
|
-
connectButtonText: "neetoEmailDelivery.gmail.connectGmail",
|
|
518
|
-
description: gmailDescription,
|
|
519
|
-
icon: GmailIcon,
|
|
520
|
-
isConnected: isGmailConnected,
|
|
521
|
-
isDisconnecting: isGmailDisconnecting,
|
|
522
|
-
title: gmailTitle,
|
|
523
|
-
onConnect: handleGmailConnect,
|
|
524
|
-
onDisconnect: onGmailDisconnect
|
|
525
|
-
}), showOutlook && /*#__PURE__*/jsx(IntegrationCard, {
|
|
526
|
-
connectButtonText: "neetoEmailDelivery.outlook.connectOutlook",
|
|
527
|
-
description: outlookDescription,
|
|
528
|
-
icon: OutlookIcon,
|
|
529
|
-
isConnected: isOutlookConnected,
|
|
530
|
-
isDisconnecting: isOutlookDisconnecting,
|
|
531
|
-
title: outlookTitle,
|
|
532
|
-
showDisconnect: isOutlookWaitingForTestEmail || isOutlookShadowAccount,
|
|
533
|
-
onConnect: handleOutlookConnect,
|
|
534
|
-
onDisconnect: onOutlookDisconnect
|
|
535
|
-
}), showSparkpost && /*#__PURE__*/jsx(IntegrationCard, {
|
|
536
|
-
connectButtonText: "neetoEmailDelivery.sparkpost.emailDelivery.setupDomain",
|
|
537
|
-
description: ownDomainDescription,
|
|
538
|
-
icon: MailSend,
|
|
539
|
-
isConnected: isSparkpostConnected,
|
|
540
|
-
isDisconnecting: isSparkpostDisconnecting,
|
|
541
|
-
manageButtonText: "neetoEmailDelivery.sparkpost.emailDelivery.continueVerification",
|
|
542
|
-
showManageButton: sparkpostVerificationPending,
|
|
543
|
-
title: ownDomainTitle,
|
|
544
|
-
showDisconnect: sparkpostVerificationPending || isSparkpostConnected,
|
|
545
|
-
onConnect: handleOwnDomainConnect,
|
|
546
|
-
onDisconnect: onSparkpostDisconnect,
|
|
547
|
-
onManage: showVerificationPage
|
|
548
|
-
}), showSmtp && /*#__PURE__*/jsx(IntegrationCard, {
|
|
549
|
-
connectButtonText: "neetoEmailDelivery.smtp.connectSmtp",
|
|
550
|
-
description: smtpDescription,
|
|
551
|
-
icon: MailSend,
|
|
552
|
-
isConnected: isSmtpConnected,
|
|
553
|
-
isDisconnecting: isSmtpDisconnecting,
|
|
554
|
-
title: smtpTitle,
|
|
555
|
-
onConnect: handleSmtpConnect,
|
|
556
|
-
onDisconnect: onSmtpDisconnect
|
|
557
|
-
})]
|
|
558
|
-
}), activeMessage && /*#__PURE__*/jsx(Callout, {
|
|
559
|
-
style: "success",
|
|
560
|
-
children: activeMessage
|
|
561
|
-
}), isOutlookWaitingForTestEmail && /*#__PURE__*/jsx(Callout, {
|
|
562
|
-
style: "warning",
|
|
563
|
-
children: t("neetoEmailDelivery.outlook.waitingForTestEmail", {
|
|
564
|
-
email: outlookEmail
|
|
565
|
-
})
|
|
566
|
-
}), sparkpostVerificationPending && /*#__PURE__*/jsx(Callout, {
|
|
567
|
-
style: "warning",
|
|
568
|
-
children: t("neetoEmailDelivery.sparkpost.emailDelivery.verificationPending", {
|
|
569
|
-
domain: sparkpostDomain
|
|
570
|
-
})
|
|
571
|
-
}), isOutlookShadowAccount && /*#__PURE__*/jsx(Callout, {
|
|
572
|
-
style: "warning",
|
|
573
|
-
children: t("neetoEmailDelivery.outlook.shadowAccountMessage", {
|
|
574
|
-
email: outlookEmail
|
|
575
|
-
})
|
|
576
|
-
})]
|
|
577
|
-
}), /*#__PURE__*/jsx(SmtpSetup, {
|
|
578
|
-
ownerId: ownerId,
|
|
579
|
-
isOpen: isSmtpPaneOpen,
|
|
580
|
-
onCancel: handleSmtpPaneClose,
|
|
581
|
-
onDone: handleSmtpPaneClose
|
|
582
|
-
})]
|
|
583
|
-
});
|
|
584
|
-
};
|
|
585
|
-
|
|
586
|
-
export { EmailDeliveryScreen as default };
|
|
20
|
+
import 'i18next';
|
|
21
|
+
import '@bigbinary/neeto-icons/Check';
|
|
22
|
+
import '@bigbinary/neeto-icons/Warning';
|
|
23
|
+
import '@bigbinary/neetoui/Tag';
|
|
24
|
+
import '@bigbinary/neetoui/Typography';
|
|
587
25
|
//# sourceMappingURL=EmailDeliveryScreen.js.map
|