@bigbinary/neeto-email-delivery-frontend 1.0.34 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/.ready +1 -1
- package/dist/EmailDeliveryScreen.js +193 -14
- package/dist/EmailDeliveryScreen.js.map +1 -1
- package/dist/PageLayout-B_USy8hj.js +75 -0
- package/dist/PageLayout-B_USy8hj.js.map +1 -0
- package/dist/PageLayout-pMKr_80l.js +103 -0
- package/dist/PageLayout-pMKr_80l.js.map +1 -0
- package/dist/SparkpostDomainSetup.js +3 -3
- package/dist/SparkpostDomainVerify.js +4 -4
- package/dist/Verify-80b6NK1q.js +295 -0
- package/dist/Verify-80b6NK1q.js.map +1 -0
- package/dist/{Verify-Cbn8WE7T.js → Verify-D0bZSCRH.js} +4 -4
- package/dist/{Verify-Cbn8WE7T.js.map → Verify-D0bZSCRH.js.map} +1 -1
- package/dist/Verify-Dnvx5OTi.js +292 -0
- package/dist/Verify-Dnvx5OTi.js.map +1 -0
- package/dist/cjs/EmailDeliveryScreen.js +189 -14
- package/dist/cjs/EmailDeliveryScreen.js.map +1 -1
- package/dist/cjs/index.js +7 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/v2/EmailDeliveryScreen.js +201 -0
- package/dist/cjs/v2/EmailDeliveryScreen.js.map +1 -0
- package/dist/cjs/v2/SparkpostDomainSetup.js +140 -0
- package/dist/cjs/v2/SparkpostDomainSetup.js.map +1 -0
- package/dist/cjs/v2/SparkpostDomainVerify.js +35 -0
- package/dist/cjs/v2/SparkpostDomainVerify.js.map +1 -0
- package/dist/cjs/v2/hooks.js +17 -0
- package/dist/cjs/v2/hooks.js.map +1 -0
- package/dist/cjs/v2/index.js +522 -0
- package/dist/cjs/v2/index.js.map +1 -0
- package/dist/hooks.js +2 -2
- package/dist/index.js +8 -8
- package/dist/{useEmailDeliveryIntegrationApi-Dk9WPotT.js → useEmailDeliveryIntegrationApi-CfgmbuRA.js} +2 -2
- package/dist/{useEmailDeliveryIntegrationApi-Dk9WPotT.js.map → useEmailDeliveryIntegrationApi-CfgmbuRA.js.map} +1 -1
- package/dist/useSmtp-BCcRaVYr.js +136 -0
- package/dist/useSmtp-BCcRaVYr.js.map +1 -0
- package/dist/useSmtp-DxZlXdtr.js +132 -0
- package/dist/useSmtp-DxZlXdtr.js.map +1 -0
- package/dist/{useSparkpostApi-B-D8RNRF.js → useSparkpostApi-CQT4JD8-.js} +2 -2
- package/dist/{useSparkpostApi-B-D8RNRF.js.map → useSparkpostApi-CQT4JD8-.js.map} +1 -1
- package/dist/useSparkpostDomain-DDjj-dyF.js +99 -0
- package/dist/useSparkpostDomain-DDjj-dyF.js.map +1 -0
- package/dist/{useSparkpostDomain-DA1nrWS3.js → useSparkpostDomain-Dt4Q3GSP.js} +2 -2
- package/dist/{useSparkpostDomain-DA1nrWS3.js.map → useSparkpostDomain-Dt4Q3GSP.js.map} +1 -1
- package/dist/useSparkpostDomain-IJPoCQ0f.js +101 -0
- package/dist/useSparkpostDomain-IJPoCQ0f.js.map +1 -0
- package/dist/{index-BbOAmk2e.js → v2/EmailDeliveryScreen.js} +27 -148
- package/dist/v2/EmailDeliveryScreen.js.map +1 -0
- package/dist/v2/SparkpostDomainSetup.js +138 -0
- package/dist/v2/SparkpostDomainSetup.js.map +1 -0
- package/dist/v2/SparkpostDomainVerify.js +29 -0
- package/dist/v2/SparkpostDomainVerify.js.map +1 -0
- package/dist/v2/hooks.js +11 -0
- package/dist/v2/hooks.js.map +1 -0
- package/dist/v2/index.js +499 -0
- package/dist/v2/index.js.map +1 -0
- package/package.json +34 -22
- package/dist/index-BbOAmk2e.js.map +0 -1
- package/dist/index-YMe54v79.js +0 -325
- package/dist/index-YMe54v79.js.map +0 -1
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { Typography, Badge, Button, Callout, Spinner } from '@bigbinary/neeto-atoms';
|
|
4
|
+
import { withT, useQueryParams } from '@bigbinary/neeto-commons-frontend/v2/react-utils';
|
|
5
|
+
import CardLayout from '@bigbinary/neeto-molecules/v2/CardLayout';
|
|
6
|
+
import { isEmpty, pathOr } from 'ramda';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { useHistory } from 'react-router-dom';
|
|
9
|
+
import { u as useFetchConnectedIntegration } from './useEmailDeliveryIntegrationApi-CfgmbuRA.js';
|
|
10
|
+
import { u as useFetchSparkpostDomain } from './useSparkpostApi-CQT4JD8-.js';
|
|
11
|
+
import { b as PURPOSE_COLORS, D as DEFAULT_COLOR, c as VERIFICATION_STATUS_CONFIG, d as VERIFICATION_STATUSES, P as PageWrapper, a as PageContent } from './PageLayout-B_USy8hj.js';
|
|
12
|
+
import { u as useSparkpostDomain } from './useSparkpostDomain-DDjj-dyF.js';
|
|
13
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
14
|
+
import CopyToClipboardButton from '@bigbinary/neeto-molecules/v2/CopyToClipboardButton';
|
|
15
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
16
|
+
|
|
17
|
+
var RecordField = function RecordField(_ref) {
|
|
18
|
+
var label = _ref.label,
|
|
19
|
+
value = _ref.value,
|
|
20
|
+
dataTestid = _ref.dataTestid;
|
|
21
|
+
return /*#__PURE__*/jsxs("div", {
|
|
22
|
+
className: "flex w-full flex-col gap-1",
|
|
23
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
24
|
+
className: "flex items-center justify-between",
|
|
25
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
26
|
+
variant: "h6",
|
|
27
|
+
children: label
|
|
28
|
+
})
|
|
29
|
+
}), /*#__PURE__*/jsxs("code", {
|
|
30
|
+
className: "text-foreground bg-muted relative block rounded-md p-2 pe-10 font-mono text-xs break-all",
|
|
31
|
+
"data-testid": dataTestid,
|
|
32
|
+
children: [value, /*#__PURE__*/jsx(CopyToClipboardButton, {
|
|
33
|
+
value: value,
|
|
34
|
+
className: "absolute top-1 end-1 shrink-0",
|
|
35
|
+
variant: "outline"
|
|
36
|
+
})]
|
|
37
|
+
})]
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var DnsRecordsSection = function DnsRecordsSection(_ref) {
|
|
42
|
+
var dnsRecords = _ref.dnsRecords,
|
|
43
|
+
domain = _ref.domain,
|
|
44
|
+
sparkpostData = _ref.sparkpostData,
|
|
45
|
+
_ref$showTitle = _ref.showTitle,
|
|
46
|
+
showTitle = _ref$showTitle === void 0 ? true : _ref$showTitle;
|
|
47
|
+
var _useTranslation = useTranslation(),
|
|
48
|
+
t = _useTranslation.t;
|
|
49
|
+
var formatPurpose = function formatPurpose(purpose) {
|
|
50
|
+
switch (purpose) {
|
|
51
|
+
case "dkim":
|
|
52
|
+
return t("neetoEmailDelivery.sparkpost.dnsRecords.dkimSigning");
|
|
53
|
+
case "txt":
|
|
54
|
+
return t("neetoEmailDelivery.sparkpost.dnsRecords.txtVerification");
|
|
55
|
+
default:
|
|
56
|
+
return purpose;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var formatRecordName = function formatRecordName(hostname) {
|
|
60
|
+
if (!hostname) return "";
|
|
61
|
+
return hostname.endsWith(".".concat(domain)) ? hostname : "".concat(hostname, ".").concat(domain);
|
|
62
|
+
};
|
|
63
|
+
var status = sparkpostData.status,
|
|
64
|
+
txtVerificationValue = sparkpostData.txtVerificationValue,
|
|
65
|
+
txtVerificationHostname = sparkpostData.txtVerificationHostname;
|
|
66
|
+
var allRecords = [];
|
|
67
|
+
var isTxtUnverified = status === "txt_unverified";
|
|
68
|
+
if (isTxtUnverified) {
|
|
69
|
+
if (txtVerificationValue && txtVerificationHostname) {
|
|
70
|
+
allRecords.push({
|
|
71
|
+
type: "TXT",
|
|
72
|
+
purpose: "txt",
|
|
73
|
+
hostname: txtVerificationHostname,
|
|
74
|
+
value: txtVerificationValue
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
allRecords.push.apply(allRecords, _toConsumableArray(dnsRecords));
|
|
79
|
+
}
|
|
80
|
+
if (isEmpty(allRecords)) {
|
|
81
|
+
return /*#__PURE__*/jsx("div", {
|
|
82
|
+
className: "p-8 text-center",
|
|
83
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
84
|
+
className: "text-muted-foreground",
|
|
85
|
+
variant: "body2",
|
|
86
|
+
children: sparkpostData !== null && sparkpostData !== void 0 && sparkpostData.connected ? t("neetoEmailDelivery.sparkpost.dnsRecords.alreadyVerified") : t("neetoEmailDelivery.sparkpost.dnsRecords.loading")
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return /*#__PURE__*/jsxs("div", {
|
|
91
|
+
className: "flex flex-col gap-2",
|
|
92
|
+
children: [showTitle && /*#__PURE__*/jsx(Typography, {
|
|
93
|
+
variant: "h4",
|
|
94
|
+
weight: "medium",
|
|
95
|
+
children: t("neetoEmailDelivery.sparkpost.dnsRecords.title")
|
|
96
|
+
}), allRecords.map(function (record, index) {
|
|
97
|
+
return /*#__PURE__*/jsxs("div", {
|
|
98
|
+
className: "bg-background border-border rounded-lg border p-2",
|
|
99
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
100
|
+
className: "mb-2 flex items-center justify-between",
|
|
101
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
102
|
+
className: "flex items-center gap-2",
|
|
103
|
+
children: [/*#__PURE__*/jsx(Badge, {
|
|
104
|
+
label: formatPurpose(record.purpose),
|
|
105
|
+
size: "sm",
|
|
106
|
+
variant: PURPOSE_COLORS[record.purpose] || DEFAULT_COLOR
|
|
107
|
+
}), /*#__PURE__*/jsx(Badge, {
|
|
108
|
+
label: record.type,
|
|
109
|
+
size: "sm",
|
|
110
|
+
variant: "secondary"
|
|
111
|
+
})]
|
|
112
|
+
})
|
|
113
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
114
|
+
className: "flex flex-col gap-2",
|
|
115
|
+
children: [/*#__PURE__*/jsx(RecordField, {
|
|
116
|
+
dataTestid: "record-name",
|
|
117
|
+
label: t("neetoEmailDelivery.sparkpost.dnsRecords.nameLabel"),
|
|
118
|
+
value: formatRecordName(record.hostname)
|
|
119
|
+
}), /*#__PURE__*/jsx(RecordField, {
|
|
120
|
+
dataTestid: "record-value",
|
|
121
|
+
label: t("neetoEmailDelivery.sparkpost.dnsRecords.valueLabel"),
|
|
122
|
+
value: record.value
|
|
123
|
+
})]
|
|
124
|
+
})]
|
|
125
|
+
}, index);
|
|
126
|
+
})]
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
var VerificationActions = withT(function (_ref) {
|
|
131
|
+
var t = _ref.t,
|
|
132
|
+
isVerifying = _ref.isVerifying,
|
|
133
|
+
verificationStatus = _ref.verificationStatus,
|
|
134
|
+
onVerify = _ref.onVerify,
|
|
135
|
+
onCancel = _ref.onCancel;
|
|
136
|
+
return /*#__PURE__*/jsxs("div", {
|
|
137
|
+
className: "flex gap-3",
|
|
138
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
139
|
+
"data-testid": "verify-domain-button",
|
|
140
|
+
disabled: isVerifying || verificationStatus === "success",
|
|
141
|
+
loading: isVerifying,
|
|
142
|
+
onClick: onVerify,
|
|
143
|
+
children: isVerifying ? t("neetoEmailDelivery.sparkpost.verify.verifying") : t("neetoEmailDelivery.sparkpost.verify.verifyDomain")
|
|
144
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
145
|
+
"data-testid": "cancel-button",
|
|
146
|
+
disabled: isVerifying,
|
|
147
|
+
variant: "outline",
|
|
148
|
+
onClick: onCancel,
|
|
149
|
+
children: t("neetoEmailDelivery.sparkpost.verify.cancel")
|
|
150
|
+
})]
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
var VerificationInstructions = function VerificationInstructions() {
|
|
155
|
+
var _useTranslation = useTranslation(),
|
|
156
|
+
t = _useTranslation.t;
|
|
157
|
+
var instructionText = t("neetoEmailDelivery.sparkpost.instructions.fullText");
|
|
158
|
+
var lines = instructionText.split("\n");
|
|
159
|
+
return /*#__PURE__*/jsx(Callout, {
|
|
160
|
+
variant: "info",
|
|
161
|
+
children: /*#__PURE__*/jsx("div", {
|
|
162
|
+
className: "w-full",
|
|
163
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
164
|
+
variant: "body2",
|
|
165
|
+
children: lines.map(function (line, index) {
|
|
166
|
+
return /*#__PURE__*/jsxs("span", {
|
|
167
|
+
children: [line, index < lines.length - 1 && /*#__PURE__*/jsx("br", {})]
|
|
168
|
+
}, index);
|
|
169
|
+
})
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
var VerificationStatusCallout = function VerificationStatusCallout(_ref) {
|
|
176
|
+
var verificationStatus = _ref.verificationStatus;
|
|
177
|
+
var _useTranslation = useTranslation(),
|
|
178
|
+
t = _useTranslation.t;
|
|
179
|
+
var config = VERIFICATION_STATUS_CONFIG[verificationStatus];
|
|
180
|
+
if (!config) return null;
|
|
181
|
+
return /*#__PURE__*/jsx(Callout, {
|
|
182
|
+
variant: config.variant,
|
|
183
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
184
|
+
className: "space-y-1",
|
|
185
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
186
|
+
variant: "body2",
|
|
187
|
+
weight: "medium",
|
|
188
|
+
children: t(config.titleKey)
|
|
189
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
190
|
+
variant: "body3",
|
|
191
|
+
children: t(config.descriptionKey)
|
|
192
|
+
})]
|
|
193
|
+
})
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
var SparkpostDomainVerify = function SparkpostDomainVerify(_ref) {
|
|
198
|
+
var ownerId = _ref.ownerId,
|
|
199
|
+
canManageIntegrations = _ref.canManageIntegrations,
|
|
200
|
+
emailDeliveryIndexRoute = _ref.emailDeliveryIndexRoute;
|
|
201
|
+
var _useState = useState(""),
|
|
202
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
203
|
+
verificationStatus = _useState2[0],
|
|
204
|
+
setVerificationStatus = _useState2[1];
|
|
205
|
+
var _useTranslation = useTranslation(),
|
|
206
|
+
t = _useTranslation.t;
|
|
207
|
+
var history = useHistory();
|
|
208
|
+
var _useFetchConnectedInt = useFetchConnectedIntegration(ownerId),
|
|
209
|
+
integration = _useFetchConnectedInt.integration,
|
|
210
|
+
isIntegrationLoading = _useFetchConnectedInt.isLoading;
|
|
211
|
+
var hasConnectedIntegration = integration && !integration.isPending;
|
|
212
|
+
var _useQueryParams = useQueryParams(),
|
|
213
|
+
queryDomain = _useQueryParams.domain;
|
|
214
|
+
var _useFetchSparkpostDom = useFetchSparkpostDomain(ownerId),
|
|
215
|
+
sparkpostData = _useFetchSparkpostDom.data,
|
|
216
|
+
isLoading = _useFetchSparkpostDom.isLoading;
|
|
217
|
+
var _useSparkpostDomain = useSparkpostDomain({
|
|
218
|
+
ownerId: ownerId,
|
|
219
|
+
canManageIntegrations: canManageIntegrations
|
|
220
|
+
}),
|
|
221
|
+
onVerifyDomain = _useSparkpostDomain.onVerifyDomain,
|
|
222
|
+
isVerifying = _useSparkpostDomain.isVerifying;
|
|
223
|
+
var domain = pathOr(queryDomain, ["domain"], sparkpostData);
|
|
224
|
+
var dnsRecords = pathOr([], ["verificationRecords"], sparkpostData);
|
|
225
|
+
useEffect(function () {
|
|
226
|
+
// Check if domain is already verified
|
|
227
|
+
if (!(sparkpostData !== null && sparkpostData !== void 0 && sparkpostData.connected)) return;
|
|
228
|
+
setVerificationStatus(VERIFICATION_STATUSES.SUCCESS);
|
|
229
|
+
setTimeout(function () {
|
|
230
|
+
history.push(emailDeliveryIndexRoute);
|
|
231
|
+
}, 5000);
|
|
232
|
+
}, [sparkpostData, emailDeliveryIndexRoute, history]);
|
|
233
|
+
var handleVerify = function handleVerify() {
|
|
234
|
+
onVerifyDomain(function (response) {
|
|
235
|
+
if ((response === null || response === void 0 ? void 0 : response.status) === "active") {
|
|
236
|
+
setVerificationStatus(VERIFICATION_STATUSES.SUCCESS);
|
|
237
|
+
setTimeout(function () {
|
|
238
|
+
history.push(emailDeliveryIndexRoute);
|
|
239
|
+
}, 3000);
|
|
240
|
+
} else {
|
|
241
|
+
setVerificationStatus(VERIFICATION_STATUSES.PENDING);
|
|
242
|
+
}
|
|
243
|
+
}, function (_error) {
|
|
244
|
+
setVerificationStatus(VERIFICATION_STATUSES.ERROR);
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
var isVerificationSuccessful = verificationStatus === VERIFICATION_STATUSES.SUCCESS;
|
|
248
|
+
var handleCancel = function handleCancel() {
|
|
249
|
+
history.push(emailDeliveryIndexRoute);
|
|
250
|
+
};
|
|
251
|
+
if (isLoading || isIntegrationLoading) {
|
|
252
|
+
return /*#__PURE__*/jsx("div", {
|
|
253
|
+
className: "flex justify-center p-6",
|
|
254
|
+
children: /*#__PURE__*/jsx(Spinner, {})
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
if (hasConnectedIntegration) {
|
|
258
|
+
history.replace(emailDeliveryIndexRoute);
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
return /*#__PURE__*/jsx(PageWrapper, {
|
|
262
|
+
children: /*#__PURE__*/jsx(PageContent, {
|
|
263
|
+
children: /*#__PURE__*/jsx(CardLayout, {
|
|
264
|
+
title: t("neetoEmailDelivery.sparkpost.verify.title"),
|
|
265
|
+
actionBlock: /*#__PURE__*/jsx(VerificationActions, {
|
|
266
|
+
isVerifying: isVerifying,
|
|
267
|
+
verificationStatus: verificationStatus,
|
|
268
|
+
onCancel: handleCancel,
|
|
269
|
+
onVerify: handleVerify
|
|
270
|
+
}),
|
|
271
|
+
description: t("neetoEmailDelivery.sparkpost.verify.description", {
|
|
272
|
+
domain: domain
|
|
273
|
+
}).replace(/<strong>|<\/strong>/g, ""),
|
|
274
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
275
|
+
className: "flex flex-col gap-4",
|
|
276
|
+
children: [/*#__PURE__*/jsx(VerificationStatusCallout, {
|
|
277
|
+
verificationStatus: verificationStatus
|
|
278
|
+
}), !isVerificationSuccessful && /*#__PURE__*/jsxs(Fragment, {
|
|
279
|
+
children: [/*#__PURE__*/jsx(DnsRecordsSection, {
|
|
280
|
+
dnsRecords: dnsRecords,
|
|
281
|
+
domain: domain,
|
|
282
|
+
sparkpostData: sparkpostData
|
|
283
|
+
}), /*#__PURE__*/jsx(VerificationInstructions, {})]
|
|
284
|
+
})]
|
|
285
|
+
})
|
|
286
|
+
})
|
|
287
|
+
})
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
export { DnsRecordsSection as D, SparkpostDomainVerify as S };
|
|
292
|
+
//# sourceMappingURL=Verify-Dnvx5OTi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Verify-Dnvx5OTi.js","sources":["../app/javascript/src/v2/components/SparkpostDomain/RecordField.jsx","../app/javascript/src/v2/components/SparkpostDomain/DnsRecordsSection.jsx","../app/javascript/src/v2/components/SparkpostDomain/VerificationActions.jsx","../app/javascript/src/v2/components/SparkpostDomain/VerificationInstructions.jsx","../app/javascript/src/v2/components/SparkpostDomain/VerificationStatusCallout.jsx","../app/javascript/src/v2/components/SparkpostDomain/Verify.jsx"],"sourcesContent":["import { Typography } from \"@bigbinary/neeto-atoms\";\nimport CopyToClipboardButton from \"neetomolecules/v2/CopyToClipboardButton\";\n\nconst RecordField = ({ label, value, dataTestid }) => (\n <div className=\"flex w-full flex-col gap-1\">\n <div className=\"flex items-center justify-between\">\n <Typography variant=\"h6\">{label}</Typography>\n </div>\n <code\n className=\"text-foreground bg-muted relative block rounded-md p-2 pe-10 font-mono text-xs break-all\"\n data-testid={dataTestid}\n >\n {value}\n <CopyToClipboardButton\n {...{ value }}\n className=\"absolute top-1 end-1 shrink-0\"\n variant=\"outline\"\n />\n </code>\n </div>\n);\n\nexport default RecordField;\n","import { Badge, Typography } from \"@bigbinary/neeto-atoms\";\nimport { isEmpty } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { PURPOSE_COLORS, DEFAULT_COLOR } from \"./constants\";\nimport RecordField from \"./RecordField\";\n\nconst DnsRecordsSection = ({\n dnsRecords,\n domain,\n sparkpostData,\n showTitle = true,\n}) => {\n const { t } = useTranslation();\n\n const formatPurpose = purpose => {\n switch (purpose) {\n case \"dkim\":\n return t(\"neetoEmailDelivery.sparkpost.dnsRecords.dkimSigning\");\n case \"txt\":\n return t(\"neetoEmailDelivery.sparkpost.dnsRecords.txtVerification\");\n default:\n return purpose;\n }\n };\n\n const formatRecordName = hostname => {\n if (!hostname) return \"\";\n\n return hostname.endsWith(`.${domain}`) ? hostname : `${hostname}.${domain}`;\n };\n\n const { status, txtVerificationValue, txtVerificationHostname } =\n sparkpostData;\n\n const allRecords = [];\n const isTxtUnverified = status === \"txt_unverified\";\n\n if (isTxtUnverified) {\n if (txtVerificationValue && txtVerificationHostname) {\n allRecords.push({\n type: \"TXT\",\n purpose: \"txt\",\n hostname: txtVerificationHostname,\n value: txtVerificationValue,\n });\n }\n } else {\n allRecords.push(...dnsRecords);\n }\n\n if (isEmpty(allRecords)) {\n return (\n <div className=\"p-8 text-center\">\n <Typography className=\"text-muted-foreground\" variant=\"body2\">\n {sparkpostData?.connected\n ? t(\"neetoEmailDelivery.sparkpost.dnsRecords.alreadyVerified\")\n : t(\"neetoEmailDelivery.sparkpost.dnsRecords.loading\")}\n </Typography>\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col gap-2\">\n {showTitle && (\n <Typography variant=\"h4\" weight=\"medium\">\n {t(\"neetoEmailDelivery.sparkpost.dnsRecords.title\")}\n </Typography>\n )}\n {allRecords.map((record, index) => (\n <div\n className=\"bg-background border-border rounded-lg border p-2\"\n key={index}\n >\n <div className=\"mb-2 flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <Badge\n label={formatPurpose(record.purpose)}\n size=\"sm\"\n variant={PURPOSE_COLORS[record.purpose] || DEFAULT_COLOR}\n />\n <Badge label={record.type} size=\"sm\" variant=\"secondary\" />\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n <RecordField\n dataTestid=\"record-name\"\n label={t(\"neetoEmailDelivery.sparkpost.dnsRecords.nameLabel\")}\n value={formatRecordName(record.hostname)}\n />\n <RecordField\n dataTestid=\"record-value\"\n label={t(\"neetoEmailDelivery.sparkpost.dnsRecords.valueLabel\")}\n value={record.value}\n />\n </div>\n </div>\n ))}\n </div>\n );\n};\n\nexport default DnsRecordsSection;\n","import { Button } from \"@bigbinary/neeto-atoms\";\nimport { withT } from \"neetocommons/v2/react-utils\";\n\nconst VerificationActions = withT(\n ({ t, isVerifying, verificationStatus, onVerify, onCancel }) => (\n <div className=\"flex gap-3\">\n <Button\n data-testid=\"verify-domain-button\"\n disabled={isVerifying || verificationStatus === \"success\"}\n loading={isVerifying}\n onClick={onVerify}\n >\n {isVerifying\n ? t(\"neetoEmailDelivery.sparkpost.verify.verifying\")\n : t(\"neetoEmailDelivery.sparkpost.verify.verifyDomain\")}\n </Button>\n <Button\n data-testid=\"cancel-button\"\n disabled={isVerifying}\n variant=\"outline\"\n onClick={onCancel}\n >\n {t(\"neetoEmailDelivery.sparkpost.verify.cancel\")}\n </Button>\n </div>\n )\n);\n\nexport default VerificationActions;\n","import { Callout, Typography } from \"@bigbinary/neeto-atoms\";\nimport { useTranslation } from \"react-i18next\";\n\nconst VerificationInstructions = () => {\n const { t } = useTranslation();\n\n const instructionText = t(\n \"neetoEmailDelivery.sparkpost.instructions.fullText\"\n );\n const lines = instructionText.split(\"\\n\");\n\n return (\n <Callout variant=\"info\">\n <div className=\"w-full\">\n <Typography variant=\"body2\">\n {lines.map((line, index) => (\n <span key={index}>\n {line}\n {index < lines.length - 1 && <br />}\n </span>\n ))}\n </Typography>\n </div>\n </Callout>\n );\n};\n\nexport default VerificationInstructions;\n","import { Callout, Typography } from \"@bigbinary/neeto-atoms\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { VERIFICATION_STATUS_CONFIG } from \"./constants\";\n\nconst VerificationStatusCallout = ({ verificationStatus }) => {\n const { t } = useTranslation();\n\n const config = VERIFICATION_STATUS_CONFIG[verificationStatus];\n\n if (!config) return null;\n\n return (\n <Callout variant={config.variant}>\n <div className=\"space-y-1\">\n <Typography variant=\"body2\" weight=\"medium\">\n {t(config.titleKey)}\n </Typography>\n <Typography variant=\"body3\">{t(config.descriptionKey)}</Typography>\n </div>\n </Callout>\n );\n};\n\nexport default VerificationStatusCallout;\n","import { useState, useEffect } from \"react\";\n\nimport { Spinner } from \"@bigbinary/neeto-atoms\";\nimport { useQueryParams } from \"neetocommons/v2/react-utils\";\nimport CardLayout from \"neetomolecules/v2/CardLayout\";\nimport { pathOr } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\nimport { useHistory } from \"react-router-dom\";\n\nimport { useFetchConnectedIntegration } from \"hooks/reactQuery/integrations/useEmailDeliveryIntegrationApi\";\nimport { useFetchSparkpostDomain } from \"hooks/reactQuery/integrations/useSparkpostApi\";\nimport { PageContent, PageWrapper } from \"v2/components/PageLayout\";\nimport useSparkpostDomain from \"v2/hooks/integrations/useSparkpostDomain\";\n\nimport { VERIFICATION_STATUSES } from \"./constants\";\nimport DnsRecordsSection from \"./DnsRecordsSection\";\nimport VerificationActions from \"./VerificationActions\";\nimport VerificationInstructions from \"./VerificationInstructions\";\nimport VerificationStatusCallout from \"./VerificationStatusCallout\";\n\nconst SparkpostDomainVerify = ({\n ownerId,\n canManageIntegrations,\n emailDeliveryIndexRoute,\n}) => {\n const [verificationStatus, setVerificationStatus] = useState(\"\");\n const { t } = useTranslation();\n\n const history = useHistory();\n\n const { integration, isLoading: isIntegrationLoading } =\n useFetchConnectedIntegration(ownerId);\n\n const hasConnectedIntegration = integration && !integration.isPending;\n\n const { domain: queryDomain } = useQueryParams();\n\n const { data: sparkpostData, isLoading } = useFetchSparkpostDomain(ownerId);\n const { onVerifyDomain, isVerifying } = useSparkpostDomain({\n ownerId,\n canManageIntegrations,\n });\n\n const domain = pathOr(queryDomain, [\"domain\"], sparkpostData);\n const dnsRecords = pathOr([], [\"verificationRecords\"], sparkpostData);\n\n useEffect(() => {\n // Check if domain is already verified\n if (!sparkpostData?.connected) return;\n setVerificationStatus(VERIFICATION_STATUSES.SUCCESS);\n setTimeout(() => {\n history.push(emailDeliveryIndexRoute);\n }, 5000);\n }, [sparkpostData, emailDeliveryIndexRoute, history]);\n\n const handleVerify = () => {\n onVerifyDomain(\n response => {\n if (response?.status === \"active\") {\n setVerificationStatus(VERIFICATION_STATUSES.SUCCESS);\n setTimeout(() => {\n history.push(emailDeliveryIndexRoute);\n }, 3000);\n } else {\n setVerificationStatus(VERIFICATION_STATUSES.PENDING);\n }\n },\n _error => {\n setVerificationStatus(VERIFICATION_STATUSES.ERROR);\n }\n );\n };\n\n const isVerificationSuccessful =\n verificationStatus === VERIFICATION_STATUSES.SUCCESS;\n\n const handleCancel = () => {\n history.push(emailDeliveryIndexRoute);\n };\n\n if (isLoading || isIntegrationLoading) {\n return (\n <div className=\"flex justify-center p-6\">\n <Spinner />\n </div>\n );\n }\n\n if (hasConnectedIntegration) {\n history.replace(emailDeliveryIndexRoute);\n\n return null;\n }\n\n return (\n <PageWrapper>\n <PageContent>\n <CardLayout\n title={t(\"neetoEmailDelivery.sparkpost.verify.title\")}\n actionBlock={\n <VerificationActions\n {...{ isVerifying, verificationStatus }}\n onCancel={handleCancel}\n onVerify={handleVerify}\n />\n }\n description={t(\"neetoEmailDelivery.sparkpost.verify.description\", {\n domain,\n }).replace(/<strong>|<\\/strong>/g, \"\")}\n >\n <div className=\"flex flex-col gap-4\">\n <VerificationStatusCallout {...{ verificationStatus }} />\n {!isVerificationSuccessful && (\n <>\n <DnsRecordsSection {...{ dnsRecords, domain, sparkpostData }} />\n <VerificationInstructions />\n </>\n )}\n </div>\n </CardLayout>\n </PageContent>\n </PageWrapper>\n );\n};\n\nexport default SparkpostDomainVerify;\n"],"names":["RecordField","_ref","label","value","dataTestid","_jsxs","className","children","_jsx","Typography","variant","CopyToClipboardButton","DnsRecordsSection","dnsRecords","domain","sparkpostData","_ref$showTitle","showTitle","_useTranslation","useTranslation","t","formatPurpose","purpose","formatRecordName","hostname","endsWith","concat","status","txtVerificationValue","txtVerificationHostname","allRecords","isTxtUnverified","push","type","apply","_toConsumableArray","isEmpty","connected","weight","map","record","index","Badge","size","PURPOSE_COLORS","DEFAULT_COLOR","VerificationActions","withT","isVerifying","verificationStatus","onVerify","onCancel","Button","disabled","loading","onClick","VerificationInstructions","instructionText","lines","split","Callout","line","length","VerificationStatusCallout","config","VERIFICATION_STATUS_CONFIG","titleKey","descriptionKey","SparkpostDomainVerify","ownerId","canManageIntegrations","emailDeliveryIndexRoute","_useState","useState","_useState2","_slicedToArray","setVerificationStatus","history","useHistory","_useFetchConnectedInt","useFetchConnectedIntegration","integration","isIntegrationLoading","isLoading","hasConnectedIntegration","isPending","_useQueryParams","useQueryParams","queryDomain","_useFetchSparkpostDom","useFetchSparkpostDomain","data","_useSparkpostDomain","useSparkpostDomain","onVerifyDomain","pathOr","useEffect","VERIFICATION_STATUSES","SUCCESS","setTimeout","handleVerify","response","PENDING","_error","ERROR","isVerificationSuccessful","handleCancel","Spinner","replace","PageWrapper","PageContent","CardLayout","title","actionBlock","description","_Fragment"],"mappings":";;;;;;;;;;;;;;;;AAGA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,UAAU,GAAAH,IAAA,CAAVG,UAAU;AAAA,EAAA,oBAC7CC,IAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,4B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,QAAAA,KAAK,EAAE5F,CAAC,CAAC,2CAA2C,CAAE;QACtD6F,WAAW,eACTzG,GAAA,CAACsC,mBAAmB,EAAA;AACZE,UAAAA,WAAW,EAAXA,WAAW;AAAEC,UAAAA,kBAAkB,EAAlBA,kBAAkB;AACrCE,UAAAA,QAAQ,EAAEuD,YAAa;AACvBxD,UAAAA,QAAQ,EAAEkD;AAAa,SACxB,CACF;AACDc,QAAAA,WAAW,EAAE9F,CAAC,CAAC,iDAAiD,EAAE;AAChEN,UAAAA,MAAM,EAANA;AACF,SAAC,CAAC,CAAC8F,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAE;AAAArG,QAAAA,QAAA,eAEvCF,IAAA,CAAA,KAAA,EAAA;AAAKC,UAAAA,SAAS,EAAC,qBAAqB;UAAAC,QAAA,EAAA,cAClCC,GAAA,CAACuD,yBAAyB,EAAA;AAAOd,YAAAA,kBAAkB,EAAlBA;AAAkB,WAAK,CAAC,EACxD,CAACwD,wBAAwB,iBACxBpG,IAAA,CAAA8G,QAAA,EAAA;YAAA5G,QAAA,EAAA,cACEC,GAAA,CAACI,iBAAiB,EAAA;AAAOC,cAAAA,UAAU,EAAVA,UAAU;AAAEC,cAAAA,MAAM,EAANA,MAAM;AAAEC,cAAAA,aAAa,EAAbA;AAAa,aAAK,CAAC,eAChEP,GAAA,CAACgD,wBAAwB,IAAE,CAAC;AAAA,WAC5B,CACH;SACE;OACK;KACD;AAAC,GACH,CAAC;AAElB;;;;"}
|
|
@@ -1,29 +1,204 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('@bigbinary/neeto-icons/MailSend');
|
|
4
|
-
require('@bigbinary/neeto-icons/misc/Gmail');
|
|
5
|
-
require('@bigbinary/neeto-icons/misc/Outlook');
|
|
6
|
-
require('@bigbinary/neetoui/Spinner');
|
|
7
|
-
require('react-i18next');
|
|
8
|
-
var
|
|
9
|
-
require('../useSparkpostDomain-CXs_VuGP.js');
|
|
10
|
-
require('
|
|
3
|
+
var MailSend = require('@bigbinary/neeto-icons/MailSend');
|
|
4
|
+
var GmailIcon = require('@bigbinary/neeto-icons/misc/Gmail');
|
|
5
|
+
var OutlookIcon = require('@bigbinary/neeto-icons/misc/Outlook');
|
|
6
|
+
var Spinner = require('@bigbinary/neetoui/Spinner');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
8
|
+
var useSmtp = require('../useSmtp-BCcRaVYr.js');
|
|
9
|
+
var useSparkpostDomain = require('../useSparkpostDomain-CXs_VuGP.js');
|
|
10
|
+
var Tag = require('@bigbinary/neetoui/Tag');
|
|
11
|
+
var Typography = require('@bigbinary/neetoui/Typography');
|
|
12
|
+
var reactRouterDom = require('react-router-dom');
|
|
13
|
+
var Check = require('@bigbinary/neeto-icons/Check');
|
|
14
|
+
var Warning = require('@bigbinary/neeto-icons/Warning');
|
|
15
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
16
|
require('@babel/runtime/helpers/slicedToArray');
|
|
12
17
|
require('react');
|
|
13
18
|
require('@tanstack/react-query');
|
|
14
19
|
require('@bigbinary/neeto-commons-frontend/utils');
|
|
15
|
-
require('react-router-dom');
|
|
16
20
|
require('../useSparkpostApi-DlgW14Wu.js');
|
|
17
21
|
require('@babel/runtime/helpers/defineProperty');
|
|
18
22
|
require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
19
23
|
require('axios');
|
|
20
|
-
require('@bigbinary/neetoui/Tag');
|
|
21
|
-
require('@bigbinary/neetoui/Typography');
|
|
22
|
-
require('@bigbinary/neeto-icons/Check');
|
|
23
|
-
require('@bigbinary/neeto-icons/Warning');
|
|
24
24
|
require('@bigbinary/neetoui/Toastr');
|
|
25
25
|
|
|
26
|
+
var STATUS_TAG_CONFIG = {
|
|
27
|
+
connected: {
|
|
28
|
+
labelKey: "neetoEmailDelivery.sparkpost.emailDelivery.connected",
|
|
29
|
+
style: "success",
|
|
30
|
+
icon: Check
|
|
31
|
+
},
|
|
32
|
+
pending: {
|
|
33
|
+
labelKey: "neetoEmailDelivery.integrationDetail.pending",
|
|
34
|
+
style: "warning",
|
|
35
|
+
icon: Warning
|
|
36
|
+
},
|
|
37
|
+
error: {
|
|
38
|
+
labelKey: "neetoEmailDelivery.integrationDetail.error",
|
|
39
|
+
style: "danger",
|
|
40
|
+
icon: Warning
|
|
41
|
+
}
|
|
42
|
+
};
|
|
26
43
|
|
|
44
|
+
var IntegrationCard = function IntegrationCard(_ref) {
|
|
45
|
+
var Icon = _ref.icon,
|
|
46
|
+
title = _ref.title,
|
|
47
|
+
description = _ref.description,
|
|
48
|
+
status = _ref.status,
|
|
49
|
+
path = _ref.path,
|
|
50
|
+
dataTestId = _ref["data-testid"];
|
|
51
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
52
|
+
t = _useTranslation.t;
|
|
53
|
+
var tagConfig = STATUS_TAG_CONFIG[status];
|
|
54
|
+
return /*#__PURE__*/jsxRuntime.jsxs(reactRouterDom.Link, {
|
|
55
|
+
className: "neeto-ui-rounded-lg neeto-ui-border-gray-200 flex cursor-pointer flex-col gap-y-4 border p-6 no-underline outline-none transition-shadow duration-300 ease-in-out",
|
|
56
|
+
"data-testid": dataTestId,
|
|
57
|
+
to: path,
|
|
58
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
59
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
60
|
+
className: "mb-2.5 flex items-center gap-3",
|
|
61
|
+
children: [Icon && /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
62
|
+
className: "neeto-ui-text-gray-500",
|
|
63
|
+
size: 24
|
|
64
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
65
|
+
className: "neeto-ui-text-black text-lg leading-6",
|
|
66
|
+
style: "h3",
|
|
67
|
+
weight: "semibold",
|
|
68
|
+
children: title
|
|
69
|
+
})]
|
|
70
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
71
|
+
className: "neeto-ui-text-gray-600",
|
|
72
|
+
style: "body2",
|
|
73
|
+
children: description
|
|
74
|
+
})]
|
|
75
|
+
}), tagConfig && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
76
|
+
className: "neeto-ui-border-gray-300 border-t pt-3",
|
|
77
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Tag, {
|
|
78
|
+
className: "flex-row-reverse",
|
|
79
|
+
icon: tagConfig.icon,
|
|
80
|
+
label: t(tagConfig.labelKey),
|
|
81
|
+
style: tagConfig.style
|
|
82
|
+
})
|
|
83
|
+
})]
|
|
84
|
+
});
|
|
85
|
+
};
|
|
27
86
|
|
|
28
|
-
|
|
87
|
+
var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
88
|
+
var indexRoute = _ref.indexRoute,
|
|
89
|
+
ownerId = _ref.ownerId,
|
|
90
|
+
canManageIntegrations = _ref.canManageIntegrations,
|
|
91
|
+
gmailRoute = _ref.gmailRoute,
|
|
92
|
+
outlookRoute = _ref.outlookRoute,
|
|
93
|
+
customEmailProviderRoute = _ref.customEmailProviderRoute,
|
|
94
|
+
smtpRoute = _ref.smtpRoute;
|
|
95
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
96
|
+
t = _useTranslation.t;
|
|
97
|
+
var gmailIntegration = useSmtp.useGmail({
|
|
98
|
+
ownerId: ownerId,
|
|
99
|
+
indexRoute: indexRoute,
|
|
100
|
+
canManageIntegrations: canManageIntegrations
|
|
101
|
+
});
|
|
102
|
+
var outlookIntegration = useSmtp.useOutlook({
|
|
103
|
+
ownerId: ownerId,
|
|
104
|
+
indexRoute: indexRoute,
|
|
105
|
+
canManageIntegrations: canManageIntegrations
|
|
106
|
+
});
|
|
107
|
+
var sparkpostIntegration = useSparkpostDomain.useSparkpostDomain({
|
|
108
|
+
ownerId: ownerId,
|
|
109
|
+
canManageIntegrations: canManageIntegrations
|
|
110
|
+
});
|
|
111
|
+
var smtpIntegration = useSmtp.useSmtp({
|
|
112
|
+
ownerId: ownerId,
|
|
113
|
+
canManageIntegrations: canManageIntegrations
|
|
114
|
+
});
|
|
115
|
+
var isGmailConnected = gmailIntegration.isConnected,
|
|
116
|
+
isGmailLoading = gmailIntegration.isLoading,
|
|
117
|
+
gmailError = gmailIntegration.errorMessage;
|
|
118
|
+
var isOutlookConnected = outlookIntegration.isConnected,
|
|
119
|
+
isOutlookLoading = outlookIntegration.isLoading,
|
|
120
|
+
isOutlookPending = outlookIntegration.isWaitingForTestEmail,
|
|
121
|
+
outlookError = outlookIntegration.errorMessage;
|
|
122
|
+
var isSparkpostConnected = sparkpostIntegration.isConnected,
|
|
123
|
+
isSparkpostLoading = sparkpostIntegration.isLoading,
|
|
124
|
+
sparkpostExists = sparkpostIntegration.exists;
|
|
125
|
+
var isSmtpConnected = smtpIntegration.isConnected,
|
|
126
|
+
isSmtpLoading = smtpIntegration.isLoading;
|
|
127
|
+
var getCardStatus = function getCardStatus(_ref2) {
|
|
128
|
+
var isConnected = _ref2.isConnected,
|
|
129
|
+
isPending = _ref2.isPending,
|
|
130
|
+
hasError = _ref2.hasError;
|
|
131
|
+
if (isConnected) return "connected";
|
|
132
|
+
if (hasError) return "error";
|
|
133
|
+
if (isPending) return "pending";
|
|
134
|
+
return null;
|
|
135
|
+
};
|
|
136
|
+
var isLoading = isGmailLoading || isOutlookLoading || isSparkpostLoading || isSmtpLoading;
|
|
137
|
+
var gmailTitle = t("neetoEmailDelivery.gmail.title");
|
|
138
|
+
var gmailDescription = t("neetoEmailDelivery.gmail.description");
|
|
139
|
+
var outlookTitle = t("neetoEmailDelivery.outlook.title");
|
|
140
|
+
var outlookDescription = t("neetoEmailDelivery.outlook.description");
|
|
141
|
+
var ownDomainTitle = t("neetoEmailDelivery.sparkpost.emailDelivery.ownDomainTitle");
|
|
142
|
+
var ownDomainDescription = t("neetoEmailDelivery.sparkpost.emailDelivery.ownDomainDescription");
|
|
143
|
+
var smtpTitle = t("neetoEmailDelivery.smtp.title");
|
|
144
|
+
var smtpDescription = t("neetoEmailDelivery.smtp.description");
|
|
145
|
+
if (isLoading) {
|
|
146
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
147
|
+
className: "flex grow items-center justify-center w-full",
|
|
148
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
152
|
+
className: "min-h-0 w-full grow",
|
|
153
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
154
|
+
className: "@container mx-auto space-y-6",
|
|
155
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
156
|
+
className: "grid grid-cols-1 gap-3 py-1 @lg:grid-cols-2 @lg:gap-6 @3xl:grid-cols-3 @7xl:grid-cols-4",
|
|
157
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(IntegrationCard, {
|
|
158
|
+
"data-testid": "gmail-integration-card",
|
|
159
|
+
description: gmailDescription,
|
|
160
|
+
icon: GmailIcon,
|
|
161
|
+
path: gmailRoute,
|
|
162
|
+
title: gmailTitle,
|
|
163
|
+
status: getCardStatus({
|
|
164
|
+
isConnected: isGmailConnected,
|
|
165
|
+
hasError: !!gmailError
|
|
166
|
+
})
|
|
167
|
+
}), /*#__PURE__*/jsxRuntime.jsx(IntegrationCard, {
|
|
168
|
+
"data-testid": "outlook-integration-card",
|
|
169
|
+
description: outlookDescription,
|
|
170
|
+
icon: OutlookIcon,
|
|
171
|
+
path: outlookRoute,
|
|
172
|
+
title: outlookTitle,
|
|
173
|
+
status: getCardStatus({
|
|
174
|
+
isConnected: isOutlookConnected,
|
|
175
|
+
isPending: isOutlookPending,
|
|
176
|
+
hasError: !!outlookError
|
|
177
|
+
})
|
|
178
|
+
}), /*#__PURE__*/jsxRuntime.jsx(IntegrationCard, {
|
|
179
|
+
"data-testid": "custom-email-provider-integration-card",
|
|
180
|
+
description: ownDomainDescription,
|
|
181
|
+
icon: MailSend,
|
|
182
|
+
path: customEmailProviderRoute,
|
|
183
|
+
title: ownDomainTitle,
|
|
184
|
+
status: getCardStatus({
|
|
185
|
+
isConnected: isSparkpostConnected,
|
|
186
|
+
isPending: sparkpostExists && !isSparkpostConnected
|
|
187
|
+
})
|
|
188
|
+
}), /*#__PURE__*/jsxRuntime.jsx(IntegrationCard, {
|
|
189
|
+
"data-testid": "smtp-integration-card",
|
|
190
|
+
description: smtpDescription,
|
|
191
|
+
icon: MailSend,
|
|
192
|
+
path: smtpRoute,
|
|
193
|
+
status: getCardStatus({
|
|
194
|
+
isConnected: isSmtpConnected
|
|
195
|
+
}),
|
|
196
|
+
title: smtpTitle
|
|
197
|
+
})]
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
module.exports = EmailDeliveryScreen;
|
|
29
204
|
//# sourceMappingURL=EmailDeliveryScreen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailDeliveryScreen.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"EmailDeliveryScreen.js","sources":["../../app/javascript/src/components/EmailDeliveryScreen/constants.js","../../app/javascript/src/components/EmailDeliveryScreen/IntegrationCard.jsx","../../app/javascript/src/components/EmailDeliveryScreen/index.jsx"],"sourcesContent":["import { Check, Warning } from \"neetoicons\";\n\nexport const STATUS_TAG_CONFIG = {\n connected: {\n labelKey: \"neetoEmailDelivery.sparkpost.emailDelivery.connected\",\n style: \"success\",\n icon: Check,\n },\n pending: {\n labelKey: \"neetoEmailDelivery.integrationDetail.pending\",\n style: \"warning\",\n icon: Warning,\n },\n error: {\n labelKey: \"neetoEmailDelivery.integrationDetail.error\",\n style: \"danger\",\n icon: Warning,\n },\n};\n","import { Tag, Typography } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\nimport { Link } from \"react-router-dom\";\n\nimport { STATUS_TAG_CONFIG } from \"./constants\";\n\nconst IntegrationCard = ({\n icon: Icon,\n title,\n description,\n status,\n path,\n \"data-testid\": dataTestId,\n}) => {\n const { t } = useTranslation();\n\n const tagConfig = STATUS_TAG_CONFIG[status];\n\n return (\n <Link\n className=\"neeto-ui-rounded-lg neeto-ui-border-gray-200 flex cursor-pointer flex-col gap-y-4 border p-6 no-underline outline-none transition-shadow duration-300 ease-in-out\"\n data-testid={dataTestId}\n to={path}\n >\n <div>\n <div className=\"mb-2.5 flex items-center gap-3\">\n {Icon && <Icon className=\"neeto-ui-text-gray-500\" size={24} />}\n <Typography\n className=\"neeto-ui-text-black text-lg leading-6\"\n style=\"h3\"\n weight=\"semibold\"\n >\n {title}\n </Typography>\n </div>\n <Typography className=\"neeto-ui-text-gray-600\" style=\"body2\">\n {description}\n </Typography>\n </div>\n {tagConfig && (\n <div className=\"neeto-ui-border-gray-300 border-t pt-3\">\n <Tag\n className=\"flex-row-reverse\"\n icon={tagConfig.icon}\n label={t(tagConfig.labelKey)}\n style={tagConfig.style}\n />\n </div>\n )}\n </Link>\n );\n};\n\nexport default IntegrationCard;\n","import { MailSend } from \"neetoicons\";\nimport { Gmail as GmailIcon, Outlook as OutlookIcon } from \"neetoicons/misc\";\nimport { Spinner } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nimport useGmail from \"hooks/integrations/useGmail\";\nimport useOutlook from \"hooks/integrations/useOutlook\";\nimport useSmtp from \"hooks/integrations/useSmtp\";\nimport useSparkpostDomain from \"hooks/integrations/useSparkpostDomain\";\n\nimport IntegrationCard from \"./IntegrationCard\";\n\nconst EmailDeliveryScreen = ({\n indexRoute,\n ownerId,\n canManageIntegrations,\n gmailRoute,\n outlookRoute,\n customEmailProviderRoute,\n smtpRoute,\n}) => {\n const { t } = useTranslation();\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 {\n isConnected: isGmailConnected,\n isLoading: isGmailLoading,\n errorMessage: gmailError,\n } = gmailIntegration;\n\n const {\n isConnected: isOutlookConnected,\n isLoading: isOutlookLoading,\n isWaitingForTestEmail: isOutlookPending,\n errorMessage: outlookError,\n } = outlookIntegration;\n\n const {\n isConnected: isSparkpostConnected,\n isLoading: isSparkpostLoading,\n exists: sparkpostExists,\n } = sparkpostIntegration;\n\n const { isConnected: isSmtpConnected, isLoading: isSmtpLoading } =\n smtpIntegration;\n\n const getCardStatus = ({ isConnected, isPending, hasError }) => {\n if (isConnected) return \"connected\";\n\n if (hasError) return \"error\";\n\n if (isPending) return \"pending\";\n\n return null;\n };\n\n const isLoading =\n isGmailLoading || isOutlookLoading || isSparkpostLoading || isSmtpLoading;\n\n const gmailTitle = t(\"neetoEmailDelivery.gmail.title\");\n const gmailDescription = t(\"neetoEmailDelivery.gmail.description\");\n\n const outlookTitle = t(\"neetoEmailDelivery.outlook.title\");\n const outlookDescription = t(\"neetoEmailDelivery.outlook.description\");\n\n const ownDomainTitle = t(\n \"neetoEmailDelivery.sparkpost.emailDelivery.ownDomainTitle\"\n );\n\n const ownDomainDescription = t(\n \"neetoEmailDelivery.sparkpost.emailDelivery.ownDomainDescription\"\n );\n\n const smtpTitle = t(\"neetoEmailDelivery.smtp.title\");\n const smtpDescription = t(\"neetoEmailDelivery.smtp.description\");\n\n if (isLoading) {\n return (\n <div className=\"flex grow items-center justify-center w-full\">\n <Spinner />\n </div>\n );\n }\n\n return (\n <div className=\"min-h-0 w-full grow\">\n <div className=\"@container mx-auto space-y-6\">\n <div className=\"grid grid-cols-1 gap-3 py-1 @lg:grid-cols-2 @lg:gap-6 @3xl:grid-cols-3 @7xl:grid-cols-4\">\n <IntegrationCard\n data-testid=\"gmail-integration-card\"\n description={gmailDescription}\n icon={GmailIcon}\n path={gmailRoute}\n title={gmailTitle}\n status={getCardStatus({\n isConnected: isGmailConnected,\n hasError: !!gmailError,\n })}\n />\n <IntegrationCard\n data-testid=\"outlook-integration-card\"\n description={outlookDescription}\n icon={OutlookIcon}\n path={outlookRoute}\n title={outlookTitle}\n status={getCardStatus({\n isConnected: isOutlookConnected,\n isPending: isOutlookPending,\n hasError: !!outlookError,\n })}\n />\n <IntegrationCard\n data-testid=\"custom-email-provider-integration-card\"\n description={ownDomainDescription}\n icon={MailSend}\n path={customEmailProviderRoute}\n title={ownDomainTitle}\n status={getCardStatus({\n isConnected: isSparkpostConnected,\n isPending: sparkpostExists && !isSparkpostConnected,\n })}\n />\n <IntegrationCard\n data-testid=\"smtp-integration-card\"\n description={smtpDescription}\n icon={MailSend}\n path={smtpRoute}\n status={getCardStatus({ isConnected: isSmtpConnected })}\n title={smtpTitle}\n />\n </div>\n </div>\n </div>\n );\n};\n\nexport default EmailDeliveryScreen;\n"],"names":["STATUS_TAG_CONFIG","connected","labelKey","style","icon","Check","pending","Warning","error","IntegrationCard","_ref","Icon","title","description","status","path","dataTestId","_useTranslation","useTranslation","t","tagConfig","_jsxs","Link","className","to","children","_jsx","size","Typography","weight","Tag","label","EmailDeliveryScreen","indexRoute","ownerId","canManageIntegrations","gmailRoute","outlookRoute","customEmailProviderRoute","smtpRoute","gmailIntegration","useGmail","outlookIntegration","useOutlook","sparkpostIntegration","useSparkpostDomain","smtpIntegration","useSmtp","isGmailConnected","isConnected","isGmailLoading","isLoading","gmailError","errorMessage","isOutlookConnected","isOutlookLoading","isOutlookPending","isWaitingForTestEmail","outlookError","isSparkpostConnected","isSparkpostLoading","sparkpostExists","exists","isSmtpConnected","isSmtpLoading","getCardStatus","_ref2","isPending","hasError","gmailTitle","gmailDescription","outlookTitle","outlookDescription","ownDomainTitle","ownDomainDescription","smtpTitle","smtpDescription","Spinner","GmailIcon","OutlookIcon","MailSend"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAMA,iBAAiB,GAAG;AAC/BC,EA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AAA,IAAI,EAAE4E,QAAS;AACfjE,UAAAA,IAAI,EAAEwB,SAAU;UAChBzB,MAAM,EAAEmD,aAAa,CAAC;AAAEhB,YAAAA,WAAW,EAAEc;AAAgB,WAAC,CAAE;AACxDnD,UAAAA,KAAK,EAAE+D;AAAU,SAClB,CAAC;OACC;KACF;AAAC,GACH,CAAC;AAEV;;;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var EmailDeliveryScreen = require('
|
|
3
|
+
var EmailDeliveryScreen = require('./EmailDeliveryScreen.js');
|
|
4
4
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
5
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
6
6
|
var react = require('react');
|
|
@@ -27,14 +27,15 @@ var i18next = require('i18next');
|
|
|
27
27
|
var yup = require('yup');
|
|
28
28
|
var jsxRuntime = require('react/jsx-runtime');
|
|
29
29
|
var SparkpostDomainVerify = require('../Verify-BDOXn-By.js');
|
|
30
|
+
var useSmtp = require('../useSmtp-BCcRaVYr.js');
|
|
30
31
|
var useSparkpostDomain = require('../useSparkpostDomain-CXs_VuGP.js');
|
|
31
32
|
var useEmailDeliveryIntegrationApi = require('../useEmailDeliveryIntegrationApi-BcQDhMIH.js');
|
|
32
33
|
var MailSend = require('@bigbinary/neeto-icons/MailSend');
|
|
33
34
|
var GmailIcon = require('@bigbinary/neeto-icons/misc/Gmail');
|
|
34
35
|
var OutlookIcon = require('@bigbinary/neeto-icons/misc/Outlook');
|
|
35
36
|
var SparkpostDomainSetup = require('./SparkpostDomainSetup.js');
|
|
36
|
-
require('@tanstack/react-query');
|
|
37
37
|
require('@bigbinary/neetoui/Tag');
|
|
38
|
+
require('@tanstack/react-query');
|
|
38
39
|
require('axios');
|
|
39
40
|
require('ramda');
|
|
40
41
|
require('../PageLayout-CUMq2CmP.js');
|
|
@@ -253,12 +254,12 @@ var IntegrationDetailPage = function IntegrationDetailPage(_ref) {
|
|
|
253
254
|
var providerLabel = PROVIDER_LABELS[type];
|
|
254
255
|
var Icon = PROVIDER_ICONS[type];
|
|
255
256
|
var description = t("neetoEmailDelivery.".concat(type, ".description"));
|
|
256
|
-
var gmailIntegration =
|
|
257
|
+
var gmailIntegration = useSmtp.useGmail({
|
|
257
258
|
ownerId: ownerId,
|
|
258
259
|
indexRoute: indexRoute,
|
|
259
260
|
canManageIntegrations: canManageIntegrations
|
|
260
261
|
});
|
|
261
|
-
var outlookIntegration =
|
|
262
|
+
var outlookIntegration = useSmtp.useOutlook({
|
|
262
263
|
ownerId: ownerId,
|
|
263
264
|
indexRoute: indexRoute,
|
|
264
265
|
canManageIntegrations: canManageIntegrations
|
|
@@ -267,7 +268,7 @@ var IntegrationDetailPage = function IntegrationDetailPage(_ref) {
|
|
|
267
268
|
ownerId: ownerId,
|
|
268
269
|
canManageIntegrations: canManageIntegrations
|
|
269
270
|
});
|
|
270
|
-
var smtpIntegration =
|
|
271
|
+
var smtpIntegration = useSmtp.useSmtp({
|
|
271
272
|
ownerId: ownerId,
|
|
272
273
|
canManageIntegrations: canManageIntegrations
|
|
273
274
|
});
|
|
@@ -519,7 +520,7 @@ var IntegrationDetailPage = function IntegrationDetailPage(_ref) {
|
|
|
519
520
|
});
|
|
520
521
|
};
|
|
521
522
|
|
|
522
|
-
exports.EmailDeliveryScreen = EmailDeliveryScreen
|
|
523
|
+
exports.EmailDeliveryScreen = EmailDeliveryScreen;
|
|
523
524
|
exports.SparkpostDomainVerify = SparkpostDomainVerify.SparkpostDomainVerify;
|
|
524
525
|
exports.SparkpostDomainSetup = SparkpostDomainSetup;
|
|
525
526
|
exports.IntegrationDetailPage = IntegrationDetailPage;
|