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