@bigbinary/neeto-email-delivery-frontend 1.0.1

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.
Files changed (62) hide show
  1. package/README.md +150 -0
  2. package/app/javascript/src/translations/ar.json +5 -0
  3. package/app/javascript/src/translations/bg.json +5 -0
  4. package/app/javascript/src/translations/ca.json +5 -0
  5. package/app/javascript/src/translations/cs.json +5 -0
  6. package/app/javascript/src/translations/da.json +5 -0
  7. package/app/javascript/src/translations/de.json +5 -0
  8. package/app/javascript/src/translations/en.json +80 -0
  9. package/app/javascript/src/translations/es-MX.json +5 -0
  10. package/app/javascript/src/translations/es.json +5 -0
  11. package/app/javascript/src/translations/et.json +5 -0
  12. package/app/javascript/src/translations/fi.json +5 -0
  13. package/app/javascript/src/translations/fil.json +5 -0
  14. package/app/javascript/src/translations/fr.json +5 -0
  15. package/app/javascript/src/translations/hi.json +5 -0
  16. package/app/javascript/src/translations/hr.json +5 -0
  17. package/app/javascript/src/translations/id.json +5 -0
  18. package/app/javascript/src/translations/index.js +3 -0
  19. package/app/javascript/src/translations/it.json +5 -0
  20. package/app/javascript/src/translations/ja.json +5 -0
  21. package/app/javascript/src/translations/ko.json +5 -0
  22. package/app/javascript/src/translations/nl.json +5 -0
  23. package/app/javascript/src/translations/pl.json +5 -0
  24. package/app/javascript/src/translations/pt-BR.json +5 -0
  25. package/app/javascript/src/translations/pt.json +5 -0
  26. package/app/javascript/src/translations/ro.json +5 -0
  27. package/app/javascript/src/translations/ru.json +5 -0
  28. package/app/javascript/src/translations/sk.json +5 -0
  29. package/app/javascript/src/translations/sl.json +5 -0
  30. package/app/javascript/src/translations/sv.json +5 -0
  31. package/app/javascript/src/translations/th.json +5 -0
  32. package/app/javascript/src/translations/tr.json +5 -0
  33. package/app/javascript/src/translations/uk.json +5 -0
  34. package/app/javascript/src/translations/vi.json +5 -0
  35. package/app/javascript/src/translations/zh-CN.json +5 -0
  36. package/app/javascript/src/translations/zh-TW.json +5 -0
  37. package/dist/EmailDeliveryScreen.js +419 -0
  38. package/dist/EmailDeliveryScreen.js.map +1 -0
  39. package/dist/SparkpostDomainSetup.js +119 -0
  40. package/dist/SparkpostDomainSetup.js.map +1 -0
  41. package/dist/SparkpostDomainVerify.js +265 -0
  42. package/dist/SparkpostDomainVerify.js.map +1 -0
  43. package/dist/cjs/EmailDeliveryScreen.js +421 -0
  44. package/dist/cjs/EmailDeliveryScreen.js.map +1 -0
  45. package/dist/cjs/SparkpostDomainSetup.js +121 -0
  46. package/dist/cjs/SparkpostDomainSetup.js.map +1 -0
  47. package/dist/cjs/SparkpostDomainVerify.js +267 -0
  48. package/dist/cjs/SparkpostDomainVerify.js.map +1 -0
  49. package/dist/cjs/index.js +46 -0
  50. package/dist/cjs/index.js.map +1 -0
  51. package/dist/constants-9aNca_br.js +67 -0
  52. package/dist/constants-9aNca_br.js.map +1 -0
  53. package/dist/constants-DcHGgJC2.js +94 -0
  54. package/dist/constants-DcHGgJC2.js.map +1 -0
  55. package/dist/index.js +38 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/useSparkpostDomain-ByWd7ekp.js +183 -0
  58. package/dist/useSparkpostDomain-ByWd7ekp.js.map +1 -0
  59. package/dist/useSparkpostDomain-DogzCozg.js +193 -0
  60. package/dist/useSparkpostDomain-DogzCozg.js.map +1 -0
  61. package/package.json +235 -0
  62. package/types.d.ts +22 -0
@@ -0,0 +1,265 @@
1
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+ import { useState, useEffect } from 'react';
3
+ import { withT, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
4
+ import CardLayout from '@bigbinary/neeto-molecules/CardLayout';
5
+ import Spinner from '@bigbinary/neetoui/Spinner';
6
+ import { isEmpty, pathOr } from 'ramda';
7
+ import { useTranslation } from 'react-i18next';
8
+ import { useHistory } from 'react-router-dom';
9
+ 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 './constants-9aNca_br.js';
10
+ import { a as useFetchSparkpostDomain, u as useSparkpostDomain } from './useSparkpostDomain-ByWd7ekp.js';
11
+ import Typography from '@bigbinary/neetoui/Typography';
12
+ import Tag from '@bigbinary/neetoui/Tag';
13
+ import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
14
+ import { jsxs, jsx } from 'react/jsx-runtime';
15
+ import Button from '@bigbinary/neetoui/Button';
16
+ import Callout from '@bigbinary/neetoui/Callout';
17
+ import '@babel/runtime/helpers/defineProperty';
18
+ import '@babel/runtime/helpers/objectWithoutProperties';
19
+ import 'classnames';
20
+ import '@bigbinary/neeto-molecules/Container';
21
+ import '@bigbinary/neeto-molecules/Header';
22
+ import 'i18next';
23
+ import 'yup';
24
+ import '@bigbinary/neetoui/Toastr';
25
+ import '@tanstack/react-query';
26
+ import 'axios';
27
+ import '@bigbinary/neeto-commons-frontend/utils';
28
+
29
+ var RecordField = function RecordField(_ref) {
30
+ var label = _ref.label,
31
+ value = _ref.value;
32
+ return /*#__PURE__*/jsxs("div", {
33
+ className: "flex w-full flex-col gap-2",
34
+ children: [/*#__PURE__*/jsx("div", {
35
+ className: "flex items-center justify-between",
36
+ children: /*#__PURE__*/jsx(Typography, {
37
+ style: "h5",
38
+ children: label
39
+ })
40
+ }), /*#__PURE__*/jsxs("code", {
41
+ className: "neeto-ui-text-gray-800 neeto-ui-bg-gray-100 neeto-ui-rounded-md relative block p-4 pr-10 font-mono text-xs break-all",
42
+ children: [value, /*#__PURE__*/jsx(CopyToClipboardButton, {
43
+ value: value,
44
+ className: "absolute top-1 right-1 shrink-0",
45
+ style: "tertiary"
46
+ })]
47
+ })]
48
+ });
49
+ };
50
+
51
+ var DnsRecordsSection = function DnsRecordsSection(_ref) {
52
+ var dnsRecords = _ref.dnsRecords,
53
+ domain = _ref.domain,
54
+ sparkpostData = _ref.sparkpostData;
55
+ var _useTranslation = useTranslation(),
56
+ t = _useTranslation.t;
57
+ var formatPurpose = function formatPurpose(purpose) {
58
+ switch (purpose) {
59
+ case "dkim":
60
+ return t("neetoEmailDelivery.sparkpost.dnsRecords.dkimSigning");
61
+ default:
62
+ return purpose;
63
+ }
64
+ };
65
+ var formatRecordName = function formatRecordName(record) {
66
+ return record.hostname.endsWith(".".concat(domain)) ? record.hostname : "".concat(record.hostname, ".").concat(domain);
67
+ };
68
+ if (isEmpty(dnsRecords)) {
69
+ return /*#__PURE__*/jsx("div", {
70
+ className: "p-8 text-center",
71
+ children: /*#__PURE__*/jsx(Typography, {
72
+ className: "neeto-ui-text-gray-600",
73
+ style: "body2",
74
+ children: sparkpostData !== null && sparkpostData !== void 0 && sparkpostData.connected ? t("neetoEmailDelivery.sparkpost.dnsRecords.alreadyVerified") : t("neetoEmailDelivery.sparkpost.dnsRecords.loading")
75
+ })
76
+ });
77
+ }
78
+ return /*#__PURE__*/jsxs("div", {
79
+ className: "flex flex-col gap-4",
80
+ children: [/*#__PURE__*/jsx(Typography, {
81
+ style: "h4",
82
+ weight: "medium",
83
+ children: t("neetoEmailDelivery.sparkpost.dnsRecords.title")
84
+ }), dnsRecords.map(function (record, index) {
85
+ return /*#__PURE__*/jsxs("div", {
86
+ className: "neeto-ui-rounded-lg neeto-ui-bg-white neeto-ui-border-gray-300 border p-3",
87
+ children: [/*#__PURE__*/jsx("div", {
88
+ className: "mb-4 flex items-center justify-between",
89
+ children: /*#__PURE__*/jsxs("div", {
90
+ className: "flex items-center gap-2",
91
+ children: [/*#__PURE__*/jsx(Tag, {
92
+ label: formatPurpose(record.purpose),
93
+ size: "small",
94
+ style: PURPOSE_COLORS[record.purpose] || DEFAULT_COLOR
95
+ }), /*#__PURE__*/jsx(Tag, {
96
+ label: record.type,
97
+ size: "small",
98
+ style: "secondary"
99
+ })]
100
+ })
101
+ }), /*#__PURE__*/jsxs("div", {
102
+ className: "flex flex-col gap-4",
103
+ children: [/*#__PURE__*/jsx(RecordField, {
104
+ label: t("neetoEmailDelivery.sparkpost.dnsRecords.nameLabel"),
105
+ value: formatRecordName(record)
106
+ }), /*#__PURE__*/jsx(RecordField, {
107
+ label: t("neetoEmailDelivery.sparkpost.dnsRecords.valueLabel"),
108
+ value: record.value
109
+ })]
110
+ })]
111
+ }, index);
112
+ })]
113
+ });
114
+ };
115
+
116
+ var VerificationActions = withT(function (_ref) {
117
+ var t = _ref.t,
118
+ isVerifying = _ref.isVerifying,
119
+ verificationStatus = _ref.verificationStatus,
120
+ onVerify = _ref.onVerify,
121
+ onCancel = _ref.onCancel;
122
+ return /*#__PURE__*/jsxs("div", {
123
+ className: "flex gap-3",
124
+ children: [/*#__PURE__*/jsx(Button, {
125
+ disabled: isVerifying || verificationStatus === "success",
126
+ loading: isVerifying,
127
+ onClick: onVerify,
128
+ children: isVerifying ? t("neetoEmailDelivery.sparkpost.verify.verifying") : t("neetoEmailDelivery.sparkpost.verify.verifyDomain")
129
+ }), /*#__PURE__*/jsx(Button, {
130
+ disabled: isVerifying,
131
+ style: "secondary",
132
+ onClick: onCancel,
133
+ children: t("neetoEmailDelivery.sparkpost.verify.cancel")
134
+ })]
135
+ });
136
+ });
137
+
138
+ var VerificationInstructions = function VerificationInstructions() {
139
+ var _useTranslation = useTranslation(),
140
+ t = _useTranslation.t;
141
+ var instructionText = t("neetoEmailDelivery.sparkpost.instructions.fullText");
142
+ var lines = instructionText.split("\n");
143
+ return /*#__PURE__*/jsx(Callout, {
144
+ style: "info",
145
+ children: /*#__PURE__*/jsx("div", {
146
+ className: "w-full",
147
+ children: /*#__PURE__*/jsx(Typography, {
148
+ style: "body2",
149
+ children: lines.map(function (line, index) {
150
+ return /*#__PURE__*/jsxs("span", {
151
+ children: [line, index < lines.length - 1 && /*#__PURE__*/jsx("br", {})]
152
+ }, index);
153
+ })
154
+ })
155
+ })
156
+ });
157
+ };
158
+
159
+ var VerificationStatusCallout = function VerificationStatusCallout(_ref) {
160
+ var verificationStatus = _ref.verificationStatus;
161
+ var _useTranslation = useTranslation(),
162
+ t = _useTranslation.t;
163
+ var config = VERIFICATION_STATUS_CONFIG[verificationStatus];
164
+ if (!config) return null;
165
+ return /*#__PURE__*/jsx(Callout, {
166
+ style: config.style,
167
+ children: /*#__PURE__*/jsxs("div", {
168
+ className: "space-y-1",
169
+ children: [/*#__PURE__*/jsx(Typography, {
170
+ style: "body2",
171
+ weight: "medium",
172
+ children: t(config.titleKey)
173
+ }), /*#__PURE__*/jsx(Typography, {
174
+ style: "body3",
175
+ children: t(config.descriptionKey)
176
+ })]
177
+ })
178
+ });
179
+ };
180
+
181
+ var SparkpostDomainVerify = function SparkpostDomainVerify(_ref) {
182
+ var ownerId = _ref.ownerId,
183
+ canManageIntegrations = _ref.canManageIntegrations,
184
+ emailDeliveryIndexRoute = _ref.emailDeliveryIndexRoute;
185
+ var _useState = useState(""),
186
+ _useState2 = _slicedToArray(_useState, 2),
187
+ verificationStatus = _useState2[0],
188
+ setVerificationStatus = _useState2[1];
189
+ var _useTranslation = useTranslation(),
190
+ t = _useTranslation.t;
191
+ var history = useHistory();
192
+ var _useQueryParams = useQueryParams(),
193
+ queryDomain = _useQueryParams.domain;
194
+ var _useFetchSparkpostDom = useFetchSparkpostDomain(ownerId),
195
+ sparkpostData = _useFetchSparkpostDom.data,
196
+ isLoading = _useFetchSparkpostDom.isLoading;
197
+ var _useSparkpostDomain = useSparkpostDomain({
198
+ ownerId: ownerId,
199
+ canManageIntegrations: canManageIntegrations
200
+ }),
201
+ onVerifyDomain = _useSparkpostDomain.onVerifyDomain,
202
+ isVerifying = _useSparkpostDomain.isVerifying;
203
+ var domain = pathOr(queryDomain, ["domain"], sparkpostData);
204
+ var dnsRecords = pathOr([], ["verificationRecords"], sparkpostData);
205
+ useEffect(function () {
206
+ // Check if domain is already verified
207
+ if (!(sparkpostData !== null && sparkpostData !== void 0 && sparkpostData.connected)) return;
208
+ setVerificationStatus(VERIFICATION_STATUSES.SUCCESS);
209
+ setTimeout(function () {
210
+ history.push(emailDeliveryIndexRoute);
211
+ }, 5000);
212
+ }, [sparkpostData, emailDeliveryIndexRoute, history]);
213
+ var handleVerify = function handleVerify() {
214
+ onVerifyDomain(function (response) {
215
+ if (response !== null && response !== void 0 && response.verified) {
216
+ setVerificationStatus(VERIFICATION_STATUSES.SUCCESS);
217
+ setTimeout(function () {
218
+ history.push(emailDeliveryIndexRoute);
219
+ }, 3000);
220
+ } else {
221
+ setVerificationStatus(VERIFICATION_STATUSES.PENDING);
222
+ }
223
+ }, function (_error) {
224
+ setVerificationStatus(VERIFICATION_STATUSES.ERROR);
225
+ });
226
+ };
227
+ var handleCancel = function handleCancel() {
228
+ history.push(emailDeliveryIndexRoute);
229
+ };
230
+ if (isLoading) {
231
+ return /*#__PURE__*/jsx("div", {
232
+ className: "flex justify-center p-6",
233
+ children: /*#__PURE__*/jsx(Spinner, {})
234
+ });
235
+ }
236
+ return /*#__PURE__*/jsx(PageWrapper, {
237
+ children: /*#__PURE__*/jsx(PageContent, {
238
+ children: /*#__PURE__*/jsx(CardLayout, {
239
+ title: t("neetoEmailDelivery.sparkpost.verify.title"),
240
+ actionBlock: /*#__PURE__*/jsx(VerificationActions, {
241
+ isVerifying: isVerifying,
242
+ verificationStatus: verificationStatus,
243
+ onCancel: handleCancel,
244
+ onVerify: handleVerify
245
+ }),
246
+ description: t("neetoEmailDelivery.sparkpost.verify.description", {
247
+ domain: domain
248
+ }).replace(/<strong>|<\/strong>/g, ""),
249
+ children: /*#__PURE__*/jsxs("div", {
250
+ className: "flex flex-col gap-4",
251
+ children: [/*#__PURE__*/jsx(VerificationStatusCallout, {
252
+ verificationStatus: verificationStatus
253
+ }), /*#__PURE__*/jsx(DnsRecordsSection, {
254
+ dnsRecords: dnsRecords,
255
+ domain: domain,
256
+ sparkpostData: sparkpostData
257
+ }), /*#__PURE__*/jsx(VerificationInstructions, {})]
258
+ })
259
+ })
260
+ })
261
+ });
262
+ };
263
+
264
+ export { SparkpostDomainVerify as default };
265
+ //# sourceMappingURL=SparkpostDomainVerify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SparkpostDomainVerify.js","sources":["../app/javascript/src/components/SparkpostDomain/RecordField.jsx","../app/javascript/src/components/SparkpostDomain/DnsRecordsSection.jsx","../app/javascript/src/components/SparkpostDomain/VerificationActions.jsx","../app/javascript/src/components/SparkpostDomain/VerificationInstructions.jsx","../app/javascript/src/components/SparkpostDomain/VerificationStatusCallout.jsx","../app/javascript/src/components/SparkpostDomain/Verify.jsx"],"sourcesContent":["import CopyToClipboardButton from \"neetomolecules/CopyToClipboardButton\";\nimport { Typography } from \"neetoui\";\n\nconst RecordField = ({ label, value }) => (\n <div className=\"flex w-full flex-col gap-2\">\n <div className=\"flex items-center justify-between\">\n <Typography style=\"h5\">{label}</Typography>\n </div>\n <code className=\"neeto-ui-text-gray-800 neeto-ui-bg-gray-100 neeto-ui-rounded-md relative block p-4 pr-10 font-mono text-xs break-all\">\n {value}\n <CopyToClipboardButton\n {...{ value }}\n className=\"absolute top-1 right-1 shrink-0\"\n style=\"tertiary\"\n />\n </code>\n </div>\n);\n\nexport default RecordField;\n","import { Typography, Tag } from \"neetoui\";\nimport { isEmpty } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { PURPOSE_COLORS, DEFAULT_COLOR } from \"./constants\";\nimport RecordField from \"./RecordField\";\n\nconst DnsRecordsSection = ({ dnsRecords, domain, sparkpostData }) => {\n const { t } = useTranslation();\n\n const formatPurpose = purpose => {\n switch (purpose) {\n case \"dkim\":\n return t(\"neetoEmailDelivery.sparkpost.dnsRecords.dkimSigning\");\n default:\n return purpose;\n }\n };\n\n const formatRecordName = record =>\n record.hostname.endsWith(`.${domain}`)\n ? record.hostname\n : `${record.hostname}.${domain}`;\n\n if (isEmpty(dnsRecords)) {\n return (\n <div className=\"p-8 text-center\">\n <Typography className=\"neeto-ui-text-gray-600\" style=\"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-4\">\n <Typography style=\"h4\" weight=\"medium\">\n {t(\"neetoEmailDelivery.sparkpost.dnsRecords.title\")}\n </Typography>\n {dnsRecords.map((record, index) => (\n <div\n className=\"neeto-ui-rounded-lg neeto-ui-bg-white neeto-ui-border-gray-300 border p-3\"\n key={index}\n >\n <div className=\"mb-4 flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <Tag\n label={formatPurpose(record.purpose)}\n size=\"small\"\n style={PURPOSE_COLORS[record.purpose] || DEFAULT_COLOR}\n />\n <Tag label={record.type} size=\"small\" style=\"secondary\" />\n </div>\n </div>\n <div className=\"flex flex-col gap-4\">\n <RecordField\n label={t(\"neetoEmailDelivery.sparkpost.dnsRecords.nameLabel\")}\n value={formatRecordName(record)}\n />\n <RecordField\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 { withT } from \"neetocommons/react-utils\";\nimport { Button } from \"neetoui\";\n\nconst VerificationActions = withT(\n ({ t, isVerifying, verificationStatus, onVerify, onCancel }) => (\n <div className=\"flex gap-3\">\n <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 disabled={isVerifying} style=\"secondary\" onClick={onCancel}>\n {t(\"neetoEmailDelivery.sparkpost.verify.cancel\")}\n </Button>\n </div>\n )\n);\n\nexport default VerificationActions;\n","import { Typography, Callout } from \"neetoui\";\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 style=\"info\">\n <div className=\"w-full\">\n <Typography style=\"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 \"neetoui\";\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 style={config.style}>\n <div className=\"space-y-1\">\n <Typography style=\"body2\" weight=\"medium\">\n {t(config.titleKey)}\n </Typography>\n <Typography style=\"body3\">{t(config.descriptionKey)}</Typography>\n </div>\n </Callout>\n );\n};\n\nexport default VerificationStatusCallout;\n","import { useState, useEffect } from \"react\";\n\nimport { useQueryParams } from \"neetocommons/react-utils\";\nimport CardLayout from \"neetomolecules/CardLayout\";\nimport { Spinner } from \"neetoui\";\nimport { pathOr } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\nimport { useHistory } from \"react-router-dom\";\n\nimport { PageContent, PageWrapper } from \"components/PageLayout\";\nimport useSparkpostDomain from \"hooks/integrations/useSparkpostDomain\";\nimport { useFetchSparkpostDomain } from \"hooks/reactQuery/integrations/useSparkpostApi\";\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 { 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?.verified) {\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 handleCancel = () => {\n history.push(emailDeliveryIndexRoute);\n };\n\n if (isLoading) {\n return (\n <div className=\"flex justify-center p-6\">\n <Spinner />\n </div>\n );\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 <DnsRecordsSection {...{ dnsRecords, domain, sparkpostData }} />\n <VerificationInstructions />\n </div>\n </CardLayout>\n </PageContent>\n </PageWrapper>\n );\n};\n\nexport default SparkpostDomainVerify;\n"],"names":["RecordField","_ref","label","value","_jsxs","className","children","_jsx","Typography","style","CopyToClipboardButton","DnsRecordsSection","dnsRecords","domain","sparkpostData","_useTranslation","useTranslation","t","formatPurpose","purpose","formatRecordName","record","hostname","endsWith","concat","isEmpty","connected","weight","map","index","Tag","size","PURPOSE_COLORS","DEFAULT_COLOR","type","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","_useQueryParams","useQueryParams","queryDomain","_useFetchSparkpostDom","useFetchSparkpostDomain","data","isLoading","_useSparkpostDomain","useSparkpostDomain","onVerifyDomain","pathOr","useEffect","VERIFICATION_STATUSES","SUCCESS","setTimeout","push","handleVerify","response","verified","PENDING","_error","ERROR","handleCancel","Spinner","PageWrapper","PageContent","CardLayout","title","actionBlock","description","replace"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;AAAA,EAAA,oBACjCC,IAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,4BAA4B;AAAAC,IAAAA,QAAA,gBACzCC,GAAA,CAAA,KAAA,EAAA;AAAKF,MAAAA,SAAS,EAAC,mCAAmC;MAAAC,QAAA,eAChDC,GAAA,CAACC,UAAU,EAAA;AAACC,QAAAA,KAAK,EAAC,IAAI;AAAAH,QAAAA,QAAA,EAAEJ;OAAkB;KACvC,CAAC,eACNE,IAAA,CAAA,MAAA,EAAA;AAAMC,MAAAA,SAAS,EAAC,sHAAsH;AAAAC,MAAAA,QAAA,EACnIH,CAAAA,KAAK,eACNI,GAAA,CAACG,qBAAqB,EAAA;AACdP,QAAAA,KAAK,EAALA,KAAK;AACXE,QAAAA,SAAS,EAAC,iCAAiC;AAC3CI,QAAAA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