@bigbinary/neeto-email-delivery-frontend 1.0.33 → 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/app/javascript/src/translations/ar.json +4 -3
- package/app/javascript/src/translations/bg.json +4 -3
- package/app/javascript/src/translations/ca.json +4 -3
- package/app/javascript/src/translations/cs.json +4 -3
- package/app/javascript/src/translations/da.json +4 -3
- package/app/javascript/src/translations/de.json +4 -3
- package/app/javascript/src/translations/en.json +1 -1
- package/app/javascript/src/translations/es-MX.json +4 -3
- package/app/javascript/src/translations/es.json +4 -3
- package/app/javascript/src/translations/et.json +4 -3
- package/app/javascript/src/translations/fi.json +4 -3
- package/app/javascript/src/translations/fil.json +4 -3
- package/app/javascript/src/translations/fr.json +4 -3
- package/app/javascript/src/translations/he.json +4 -3
- package/app/javascript/src/translations/hi.json +4 -3
- package/app/javascript/src/translations/hr.json +4 -3
- package/app/javascript/src/translations/hu.json +4 -3
- package/app/javascript/src/translations/id.json +4 -3
- package/app/javascript/src/translations/it.json +4 -3
- package/app/javascript/src/translations/ja.json +4 -3
- package/app/javascript/src/translations/ko.json +4 -3
- package/app/javascript/src/translations/nl.json +4 -3
- package/app/javascript/src/translations/pl.json +4 -3
- package/app/javascript/src/translations/pt-BR.json +4 -3
- package/app/javascript/src/translations/pt.json +4 -3
- package/app/javascript/src/translations/ro.json +4 -3
- package/app/javascript/src/translations/ru.json +4 -3
- package/app/javascript/src/translations/sk.json +4 -3
- package/app/javascript/src/translations/sl.json +4 -3
- package/app/javascript/src/translations/sv.json +4 -3
- package/app/javascript/src/translations/th.json +4 -3
- package/app/javascript/src/translations/tr.json +4 -3
- package/app/javascript/src/translations/uk.json +4 -3
- package/app/javascript/src/translations/vi.json +4 -3
- package/app/javascript/src/translations/zh-CN.json +4 -3
- package/app/javascript/src/translations/zh-TW.json +4 -3
- 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,201 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var neetoAtoms = require('@bigbinary/neeto-atoms');
|
|
4
|
+
var MailSend = require('@bigbinary/neeto-icons/MailSend');
|
|
5
|
+
var GmailIcon = require('@bigbinary/neeto-icons/misc/Gmail');
|
|
6
|
+
var OutlookIcon = require('@bigbinary/neeto-icons/misc/Outlook');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
8
|
+
var useSmtp = require('../../useSmtp-BCcRaVYr.js');
|
|
9
|
+
var useSparkpostDomain = require('../../useSparkpostDomain-IJPoCQ0f.js');
|
|
10
|
+
var reactRouterDom = require('react-router-dom');
|
|
11
|
+
var Check = require('@bigbinary/neeto-icons/Check');
|
|
12
|
+
var Warning = require('@bigbinary/neeto-icons/Warning');
|
|
13
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
14
|
+
require('@babel/runtime/helpers/slicedToArray');
|
|
15
|
+
require('react');
|
|
16
|
+
require('@tanstack/react-query');
|
|
17
|
+
require('@bigbinary/neeto-commons-frontend/utils');
|
|
18
|
+
require('../../useSparkpostApi-DlgW14Wu.js');
|
|
19
|
+
require('@babel/runtime/helpers/defineProperty');
|
|
20
|
+
require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
21
|
+
require('axios');
|
|
22
|
+
|
|
23
|
+
var STATUS_TAG_CONFIG = {
|
|
24
|
+
connected: {
|
|
25
|
+
labelKey: "neetoEmailDelivery.sparkpost.emailDelivery.connected",
|
|
26
|
+
variant: "green",
|
|
27
|
+
icon: Check
|
|
28
|
+
},
|
|
29
|
+
pending: {
|
|
30
|
+
labelKey: "neetoEmailDelivery.integrationDetail.pending",
|
|
31
|
+
variant: "amber",
|
|
32
|
+
icon: Warning
|
|
33
|
+
},
|
|
34
|
+
error: {
|
|
35
|
+
labelKey: "neetoEmailDelivery.integrationDetail.error",
|
|
36
|
+
variant: "red",
|
|
37
|
+
icon: Warning
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var IntegrationCard = function IntegrationCard(_ref) {
|
|
42
|
+
var Icon = _ref.icon,
|
|
43
|
+
title = _ref.title,
|
|
44
|
+
description = _ref.description,
|
|
45
|
+
status = _ref.status,
|
|
46
|
+
path = _ref.path,
|
|
47
|
+
dataTestId = _ref["data-testid"];
|
|
48
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
49
|
+
t = _useTranslation.t;
|
|
50
|
+
var tagConfig = STATUS_TAG_CONFIG[status];
|
|
51
|
+
return /*#__PURE__*/jsxRuntime.jsxs(reactRouterDom.Link, {
|
|
52
|
+
className: "border-border flex cursor-pointer flex-col gap-y-4 rounded-lg border p-6 no-underline outline-none transition-shadow duration-300 ease-in-out",
|
|
53
|
+
"data-testid": dataTestId,
|
|
54
|
+
to: path,
|
|
55
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
56
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
57
|
+
className: "mb-2.5 flex items-center gap-3",
|
|
58
|
+
children: [Icon && /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
59
|
+
className: "text-muted-foreground",
|
|
60
|
+
size: 24
|
|
61
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
62
|
+
className: "text-foreground text-lg leading-6",
|
|
63
|
+
variant: "h3",
|
|
64
|
+
weight: "semibold",
|
|
65
|
+
children: title
|
|
66
|
+
})]
|
|
67
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
68
|
+
className: "text-muted-foreground",
|
|
69
|
+
variant: "body2",
|
|
70
|
+
children: description
|
|
71
|
+
})]
|
|
72
|
+
}), tagConfig && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
73
|
+
className: "border-border border-t pt-3",
|
|
74
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Badge, {
|
|
75
|
+
icon: tagConfig.icon,
|
|
76
|
+
iconPosition: "right",
|
|
77
|
+
label: t(tagConfig.labelKey),
|
|
78
|
+
variant: tagConfig.variant
|
|
79
|
+
})
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
var EmailDeliveryScreen = function EmailDeliveryScreen(_ref) {
|
|
85
|
+
var indexRoute = _ref.indexRoute,
|
|
86
|
+
ownerId = _ref.ownerId,
|
|
87
|
+
canManageIntegrations = _ref.canManageIntegrations,
|
|
88
|
+
gmailRoute = _ref.gmailRoute,
|
|
89
|
+
outlookRoute = _ref.outlookRoute,
|
|
90
|
+
customEmailProviderRoute = _ref.customEmailProviderRoute,
|
|
91
|
+
smtpRoute = _ref.smtpRoute;
|
|
92
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
93
|
+
t = _useTranslation.t;
|
|
94
|
+
var gmailIntegration = useSmtp.useGmail({
|
|
95
|
+
ownerId: ownerId,
|
|
96
|
+
indexRoute: indexRoute,
|
|
97
|
+
canManageIntegrations: canManageIntegrations
|
|
98
|
+
});
|
|
99
|
+
var outlookIntegration = useSmtp.useOutlook({
|
|
100
|
+
ownerId: ownerId,
|
|
101
|
+
indexRoute: indexRoute,
|
|
102
|
+
canManageIntegrations: canManageIntegrations
|
|
103
|
+
});
|
|
104
|
+
var sparkpostIntegration = useSparkpostDomain.useSparkpostDomain({
|
|
105
|
+
ownerId: ownerId,
|
|
106
|
+
canManageIntegrations: canManageIntegrations
|
|
107
|
+
});
|
|
108
|
+
var smtpIntegration = useSmtp.useSmtp({
|
|
109
|
+
ownerId: ownerId,
|
|
110
|
+
canManageIntegrations: canManageIntegrations
|
|
111
|
+
});
|
|
112
|
+
var isGmailConnected = gmailIntegration.isConnected,
|
|
113
|
+
isGmailLoading = gmailIntegration.isLoading,
|
|
114
|
+
gmailError = gmailIntegration.errorMessage;
|
|
115
|
+
var isOutlookConnected = outlookIntegration.isConnected,
|
|
116
|
+
isOutlookLoading = outlookIntegration.isLoading,
|
|
117
|
+
isOutlookPending = outlookIntegration.isWaitingForTestEmail,
|
|
118
|
+
outlookError = outlookIntegration.errorMessage;
|
|
119
|
+
var isSparkpostConnected = sparkpostIntegration.isConnected,
|
|
120
|
+
isSparkpostLoading = sparkpostIntegration.isLoading,
|
|
121
|
+
sparkpostExists = sparkpostIntegration.exists;
|
|
122
|
+
var isSmtpConnected = smtpIntegration.isConnected,
|
|
123
|
+
isSmtpLoading = smtpIntegration.isLoading;
|
|
124
|
+
var getCardStatus = function getCardStatus(_ref2) {
|
|
125
|
+
var isConnected = _ref2.isConnected,
|
|
126
|
+
isPending = _ref2.isPending,
|
|
127
|
+
hasError = _ref2.hasError;
|
|
128
|
+
if (isConnected) return "connected";
|
|
129
|
+
if (hasError) return "error";
|
|
130
|
+
if (isPending) return "pending";
|
|
131
|
+
return null;
|
|
132
|
+
};
|
|
133
|
+
var isLoading = isGmailLoading || isOutlookLoading || isSparkpostLoading || isSmtpLoading;
|
|
134
|
+
var gmailTitle = t("neetoEmailDelivery.gmail.title");
|
|
135
|
+
var gmailDescription = t("neetoEmailDelivery.gmail.description");
|
|
136
|
+
var outlookTitle = t("neetoEmailDelivery.outlook.title");
|
|
137
|
+
var outlookDescription = t("neetoEmailDelivery.outlook.description");
|
|
138
|
+
var ownDomainTitle = t("neetoEmailDelivery.sparkpost.emailDelivery.ownDomainTitle");
|
|
139
|
+
var ownDomainDescription = t("neetoEmailDelivery.sparkpost.emailDelivery.ownDomainDescription");
|
|
140
|
+
var smtpTitle = t("neetoEmailDelivery.smtp.title");
|
|
141
|
+
var smtpDescription = t("neetoEmailDelivery.smtp.description");
|
|
142
|
+
if (isLoading) {
|
|
143
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
144
|
+
className: "flex grow items-center justify-center w-full",
|
|
145
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Spinner, {})
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
149
|
+
className: "min-h-0 w-full grow",
|
|
150
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
151
|
+
className: "@container mx-auto space-y-6",
|
|
152
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
153
|
+
className: "grid grid-cols-1 gap-3 py-1 @lg:grid-cols-2 @lg:gap-6 @3xl:grid-cols-3 @7xl:grid-cols-4",
|
|
154
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(IntegrationCard, {
|
|
155
|
+
"data-testid": "gmail-integration-card",
|
|
156
|
+
description: gmailDescription,
|
|
157
|
+
icon: GmailIcon,
|
|
158
|
+
path: gmailRoute,
|
|
159
|
+
title: gmailTitle,
|
|
160
|
+
status: getCardStatus({
|
|
161
|
+
isConnected: isGmailConnected,
|
|
162
|
+
hasError: !!gmailError
|
|
163
|
+
})
|
|
164
|
+
}), /*#__PURE__*/jsxRuntime.jsx(IntegrationCard, {
|
|
165
|
+
"data-testid": "outlook-integration-card",
|
|
166
|
+
description: outlookDescription,
|
|
167
|
+
icon: OutlookIcon,
|
|
168
|
+
path: outlookRoute,
|
|
169
|
+
title: outlookTitle,
|
|
170
|
+
status: getCardStatus({
|
|
171
|
+
isConnected: isOutlookConnected,
|
|
172
|
+
isPending: isOutlookPending,
|
|
173
|
+
hasError: !!outlookError
|
|
174
|
+
})
|
|
175
|
+
}), /*#__PURE__*/jsxRuntime.jsx(IntegrationCard, {
|
|
176
|
+
"data-testid": "custom-email-provider-integration-card",
|
|
177
|
+
description: ownDomainDescription,
|
|
178
|
+
icon: MailSend,
|
|
179
|
+
path: customEmailProviderRoute,
|
|
180
|
+
title: ownDomainTitle,
|
|
181
|
+
status: getCardStatus({
|
|
182
|
+
isConnected: isSparkpostConnected,
|
|
183
|
+
isPending: sparkpostExists && !isSparkpostConnected
|
|
184
|
+
})
|
|
185
|
+
}), /*#__PURE__*/jsxRuntime.jsx(IntegrationCard, {
|
|
186
|
+
"data-testid": "smtp-integration-card",
|
|
187
|
+
description: smtpDescription,
|
|
188
|
+
icon: MailSend,
|
|
189
|
+
path: smtpRoute,
|
|
190
|
+
status: getCardStatus({
|
|
191
|
+
isConnected: isSmtpConnected
|
|
192
|
+
}),
|
|
193
|
+
title: smtpTitle
|
|
194
|
+
})]
|
|
195
|
+
})
|
|
196
|
+
})
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
module.exports = EmailDeliveryScreen;
|
|
201
|
+
//# sourceMappingURL=EmailDeliveryScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailDeliveryScreen.js","sources":["../../../app/javascript/src/v2/components/EmailDeliveryScreen/constants.js","../../../app/javascript/src/v2/components/EmailDeliveryScreen/IntegrationCard.jsx","../../../app/javascript/src/v2/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 variant: \"green\",\n icon: Check,\n },\n pending: {\n labelKey: \"neetoEmailDelivery.integrationDetail.pending\",\n variant: \"amber\",\n icon: Warning,\n },\n error: {\n labelKey: \"neetoEmailDelivery.integrationDetail.error\",\n variant: \"red\",\n icon: Warning,\n },\n};\n","import { Badge, Typography } from \"@bigbinary/neeto-atoms\";\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=\"border-border flex cursor-pointer flex-col gap-y-4 rounded-lg 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=\"text-muted-foreground\" size={24} />}\n <Typography\n className=\"text-foreground text-lg leading-6\"\n variant=\"h3\"\n weight=\"semibold\"\n >\n {title}\n </Typography>\n </div>\n <Typography className=\"text-muted-foreground\" variant=\"body2\">\n {description}\n </Typography>\n </div>\n {tagConfig && (\n <div className=\"border-border border-t pt-3\">\n <Badge\n icon={tagConfig.icon}\n iconPosition=\"right\"\n label={t(tagConfig.labelKey)}\n variant={tagConfig.variant}\n />\n </div>\n )}\n </Link>\n );\n};\n\nexport default IntegrationCard;\n","import { Spinner } from \"@bigbinary/neeto-atoms\";\nimport { MailSend } from \"neetoicons\";\nimport { Gmail as GmailIcon, Outlook as OutlookIcon } from \"neetoicons/misc\";\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 \"v2/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","variant","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","Badge","iconPosition","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,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,sDAAsD;AAChEC,IAAAA,OAAO,EAAE,OAAO;AAChBC,IAAAA,IAAI,EAAEC;GACP;AACDC,EAAAA,OAAO,EAAE;AACPJ,IAAAA,QAAQ,EAAE,8CAA8C;AACxDC,IAAAA,OAAO,EAAE,OAAO;AAChBC,IAAAA,IAAI,EAAEG;GACP;AACDC,EAAAA,KAAK,EAAE;AACLN,IAAAA,QAAQ,EAAE,4CAA4C;AACtDC,IAAAA,OAAO,EAAE,KAAK;AACdC,IAAAA,IAAI,EAAEG;AACR;AACF,CAAC;;ACZD,IAAME,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAOf;AAAA,EAAA,IANEC,IAAI,GAAAD,IAAA,CAAVN,IAAI;IACJQ,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IACNC,IAAI,GAAAL,IAAA,CAAJK,IAAI;IACWC,UAAU,GAAAN,IAAA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,EAAEK,kBAAkB;AAC/Ba,YAAAA,SAAS,EAAEX,gBAAgB;YAC3BY,QAAQ,EAAE,CAAC,CAACV;WACb;AAAE,SACJ,CAAC,eACFjC,cAAA,CAACjB,eAAe,EAAA;AACd,UAAA,aAAA,EAAY,wCAAwC;AACpDI,UAAAA,WAAW,EAAE8D,oBAAqB;AAClCvE,UAAAA,IAAI,EAAE6E,QAAS;AACflE,UAAAA,IAAI,EAAEwB,wBAAyB;AAC/B3B,UAAAA,KAAK,EAAE8D,cAAe;UACtB5D,MAAM,EAAEoD,aAAa,CAAC;AACpBhB,YAAAA,WAAW,EAAEU,oBAAoB;YACjCQ,SAAS,EAAEN,eAAe,IAAI,CAACF;WAChC;AAAE,SACJ,CAAC,eACFlC,cAAA,CAACjB,eAAe,EAAA;AACd,UAAA,aAAA,EAAY,uBAAuB;AACnCI,UAAAA,WAAW,EAAEgE,eAAgB;AAC7BzE,UAAAA,IAAI,EAAE6E,QAAS;AACflE,UAAAA,IAAI,EAAEyB,SAAU;UAChB1B,MAAM,EAAEoD,aAAa,CAAC;AAAEhB,YAAAA,WAAW,EAAEc;AAAgB,WAAC,CAAE;AACxDpD,UAAAA,KAAK,EAAEgE;AAAU,SAClB,CAAC;OACC;KACF;AAAC,GACH,CAAC;AAEV;;;;"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var neetoAtoms = require('@bigbinary/neeto-atoms');
|
|
4
|
+
var formik = require('@bigbinary/neeto-atoms/formik');
|
|
5
|
+
var utils = require('@bigbinary/neeto-commons-frontend/v2/utils');
|
|
6
|
+
var CardLayout = require('@bigbinary/neeto-molecules/v2/CardLayout');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
8
|
+
var reactRouterDom = require('react-router-dom');
|
|
9
|
+
var useEmailDeliveryIntegrationApi = require('../../useEmailDeliveryIntegrationApi-BcQDhMIH.js');
|
|
10
|
+
var PageLayout = require('../../PageLayout-pMKr_80l.js');
|
|
11
|
+
var useSparkpostDomain = require('../../useSparkpostDomain-IJPoCQ0f.js');
|
|
12
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
+
require('@bigbinary/neeto-cist');
|
|
14
|
+
require('ramda');
|
|
15
|
+
require('../../useSparkpostApi-DlgW14Wu.js');
|
|
16
|
+
require('@babel/runtime/helpers/defineProperty');
|
|
17
|
+
require('@tanstack/react-query');
|
|
18
|
+
require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
19
|
+
require('axios');
|
|
20
|
+
require('@bigbinary/neeto-commons-frontend/utils');
|
|
21
|
+
require('@babel/runtime/helpers/slicedToArray');
|
|
22
|
+
require('i18next');
|
|
23
|
+
require('yup');
|
|
24
|
+
require('@babel/runtime/helpers/objectWithoutProperties');
|
|
25
|
+
require('react');
|
|
26
|
+
require('classnames');
|
|
27
|
+
require('@bigbinary/neeto-molecules/v2/Container');
|
|
28
|
+
require('@bigbinary/neeto-molecules/v2/Header');
|
|
29
|
+
|
|
30
|
+
var getDomainFromEmail = function getDomainFromEmail(email) {
|
|
31
|
+
return email.trim().split("@")[1];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var SparkpostDomainSetup = function SparkpostDomainSetup(_ref) {
|
|
35
|
+
var ownerId = _ref.ownerId,
|
|
36
|
+
alreadyVerifiedRoute = _ref.alreadyVerifiedRoute,
|
|
37
|
+
verifyRoute = _ref.verifyRoute,
|
|
38
|
+
onCancelRoute = _ref.onCancelRoute,
|
|
39
|
+
canManageIntegrations = _ref.canManageIntegrations;
|
|
40
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
41
|
+
t = _useTranslation.t;
|
|
42
|
+
var history = reactRouterDom.useHistory();
|
|
43
|
+
var _useFetchConnectedInt = useEmailDeliveryIntegrationApi.useFetchConnectedIntegration(ownerId),
|
|
44
|
+
integration = _useFetchConnectedInt.integration,
|
|
45
|
+
isIntegrationLoading = _useFetchConnectedInt.isLoading;
|
|
46
|
+
var hasConnectedIntegration = integration && !integration.isPending;
|
|
47
|
+
var _useSparkpostDomain = useSparkpostDomain.useSparkpostDomain({
|
|
48
|
+
ownerId: ownerId,
|
|
49
|
+
canManageIntegrations: canManageIntegrations
|
|
50
|
+
}),
|
|
51
|
+
onCreateDomain = _useSparkpostDomain.onCreateDomain,
|
|
52
|
+
isCreating = _useSparkpostDomain.isCreating;
|
|
53
|
+
var handleSubmit = function handleSubmit(values, _ref2) {
|
|
54
|
+
var setFieldError = _ref2.setFieldError;
|
|
55
|
+
onCreateDomain(values.email.trim(), values.displayName.trim(), function (response) {
|
|
56
|
+
if (response !== null && response !== void 0 && response.alreadyVerified) {
|
|
57
|
+
// Domain is already verified, go back to email delivery settings
|
|
58
|
+
history.push(alreadyVerifiedRoute);
|
|
59
|
+
} else {
|
|
60
|
+
// Navigate to verification page with domain query parameter
|
|
61
|
+
var domain = getDomainFromEmail(values.email);
|
|
62
|
+
history.push(utils.buildUrl(verifyRoute, {
|
|
63
|
+
domain: domain,
|
|
64
|
+
email: values.email.trim()
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
}, function (error) {
|
|
68
|
+
var _error$response;
|
|
69
|
+
var errorMessage = (error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 || (_error$response = _error$response.data) === null || _error$response === void 0 ? void 0 : _error$response.error) || t("neetoEmailDelivery.sparkpost.setup.validation.setupFailed");
|
|
70
|
+
setFieldError("email", errorMessage);
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
var handleCancel = function handleCancel() {
|
|
74
|
+
history.push(onCancelRoute);
|
|
75
|
+
};
|
|
76
|
+
if (isIntegrationLoading) {
|
|
77
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
78
|
+
className: "flex justify-center p-6",
|
|
79
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Spinner, {})
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (hasConnectedIntegration) {
|
|
83
|
+
history.replace(onCancelRoute);
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return /*#__PURE__*/jsxRuntime.jsx(PageLayout.PageWrapper, {
|
|
87
|
+
children: /*#__PURE__*/jsxRuntime.jsx(PageLayout.PageContent, {
|
|
88
|
+
children: /*#__PURE__*/jsxRuntime.jsx(formik.Form, {
|
|
89
|
+
className: "w-full",
|
|
90
|
+
formikProps: {
|
|
91
|
+
initialValues: PageLayout.INITIAL_VALUES,
|
|
92
|
+
validationSchema: PageLayout.VALIDATION_SCHEMA,
|
|
93
|
+
onSubmit: handleSubmit
|
|
94
|
+
},
|
|
95
|
+
children: function children(_ref3) {
|
|
96
|
+
var values = _ref3.values;
|
|
97
|
+
var domain = values.email ? getDomainFromEmail(values.email) : t("neetoEmailDelivery.sparkpost.customDomain");
|
|
98
|
+
return /*#__PURE__*/jsxRuntime.jsx(CardLayout, {
|
|
99
|
+
title: String(t("neetoEmailDelivery.sparkpost.setup.title")),
|
|
100
|
+
actionBlock: /*#__PURE__*/jsxRuntime.jsx(formik.ActionBlock, {
|
|
101
|
+
cancelButtonProps: {
|
|
102
|
+
onClick: handleCancel
|
|
103
|
+
},
|
|
104
|
+
isSubmitting: isCreating,
|
|
105
|
+
submitButtonProps: {
|
|
106
|
+
label: t("neetoEmailDelivery.sparkpost.setup.setupEmail")
|
|
107
|
+
}
|
|
108
|
+
}),
|
|
109
|
+
description: String(t("neetoEmailDelivery.sparkpost.setup.description")),
|
|
110
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
111
|
+
className: "flex flex-col gap-6",
|
|
112
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Callout, {
|
|
113
|
+
variant: "warning",
|
|
114
|
+
children: t("neetoEmailDelivery.sparkpost.setup.note")
|
|
115
|
+
}), /*#__PURE__*/jsxRuntime.jsx(formik.Input, {
|
|
116
|
+
required: true,
|
|
117
|
+
unlimitedChars: true,
|
|
118
|
+
label: t("neetoEmailDelivery.sparkpost.setup.emailLabel"),
|
|
119
|
+
name: "email",
|
|
120
|
+
type: "email",
|
|
121
|
+
helpText: t("neetoEmailDelivery.sparkpost.setup.emailHelp", {
|
|
122
|
+
domain: domain
|
|
123
|
+
}),
|
|
124
|
+
placeholder: t("neetoEmailDelivery.sparkpost.setup.emailPlaceholder")
|
|
125
|
+
}), /*#__PURE__*/jsxRuntime.jsx(formik.Input, {
|
|
126
|
+
required: true,
|
|
127
|
+
name: "displayName",
|
|
128
|
+
helpText: t("neetoEmailDelivery.sparkpost.setup.displayNameHelp"),
|
|
129
|
+
label: t("neetoEmailDelivery.sparkpost.setup.displayNameLabel")
|
|
130
|
+
})]
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
module.exports = SparkpostDomainSetup;
|
|
140
|
+
//# sourceMappingURL=SparkpostDomainSetup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparkpostDomainSetup.js","sources":["../../../app/javascript/src/v2/components/SparkpostDomain/utils.js","../../../app/javascript/src/v2/components/SparkpostDomain/Setup.jsx"],"sourcesContent":["const getDomainFromEmail = email => email.trim().split(\"@\")[1];\n\nexport { getDomainFromEmail };\n","import { Callout, Spinner } from \"@bigbinary/neeto-atoms\";\nimport { Input, ActionBlock, Form } from \"@bigbinary/neeto-atoms/formik\";\nimport { buildUrl } from \"neetocommons/v2/utils\";\nimport CardLayout from \"neetomolecules/v2/CardLayout\";\nimport { useTranslation } from \"react-i18next\";\nimport { useHistory } from \"react-router-dom\";\n\nimport { useFetchConnectedIntegration } from \"hooks/reactQuery/integrations/useEmailDeliveryIntegrationApi\";\nimport { PageContent, PageWrapper } from \"v2/components/PageLayout\";\nimport useSparkpostDomain from \"v2/hooks/integrations/useSparkpostDomain\";\n\nimport { VALIDATION_SCHEMA, INITIAL_VALUES } from \"./constants\";\nimport { getDomainFromEmail } from \"./utils\";\n\nconst SparkpostDomainSetup = ({\n ownerId,\n alreadyVerifiedRoute,\n verifyRoute,\n onCancelRoute,\n canManageIntegrations,\n}) => {\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 { onCreateDomain, isCreating } = useSparkpostDomain({\n ownerId,\n canManageIntegrations,\n });\n\n const handleSubmit = (values, { setFieldError }) => {\n onCreateDomain(\n values.email.trim(),\n values.displayName.trim(),\n response => {\n if (response?.alreadyVerified) {\n // Domain is already verified, go back to email delivery settings\n history.push(alreadyVerifiedRoute);\n } else {\n // Navigate to verification page with domain query parameter\n const domain = getDomainFromEmail(values.email);\n history.push(\n buildUrl(verifyRoute, { domain, email: values.email.trim() })\n );\n }\n },\n error => {\n const errorMessage =\n error?.response?.data?.error ||\n t(\"neetoEmailDelivery.sparkpost.setup.validation.setupFailed\");\n setFieldError(\"email\", errorMessage);\n }\n );\n };\n\n const handleCancel = () => {\n history.push(onCancelRoute);\n };\n\n if (isIntegrationLoading) {\n return (\n <div className=\"flex justify-center p-6\">\n <Spinner />\n </div>\n );\n }\n\n if (hasConnectedIntegration) {\n history.replace(onCancelRoute);\n\n return null;\n }\n\n return (\n <PageWrapper>\n <PageContent>\n <Form\n className=\"w-full\"\n formikProps={{\n initialValues: INITIAL_VALUES,\n validationSchema: VALIDATION_SCHEMA,\n onSubmit: handleSubmit,\n }}\n >\n {({ values }) => {\n const domain = values.email\n ? getDomainFromEmail(values.email)\n : t(\"neetoEmailDelivery.sparkpost.customDomain\");\n\n return (\n <CardLayout\n title={String(t(\"neetoEmailDelivery.sparkpost.setup.title\"))}\n actionBlock={\n <ActionBlock\n cancelButtonProps={{ onClick: handleCancel }}\n isSubmitting={isCreating}\n submitButtonProps={{\n label: t(\"neetoEmailDelivery.sparkpost.setup.setupEmail\"),\n }}\n />\n }\n description={String(\n t(\"neetoEmailDelivery.sparkpost.setup.description\")\n )}\n >\n <div className=\"flex flex-col gap-6\">\n <Callout variant=\"warning\">\n {t(\"neetoEmailDelivery.sparkpost.setup.note\")}\n </Callout>\n <Input\n required\n unlimitedChars\n label={t(\"neetoEmailDelivery.sparkpost.setup.emailLabel\")}\n name=\"email\"\n type=\"email\"\n helpText={t(\n \"neetoEmailDelivery.sparkpost.setup.emailHelp\",\n { domain }\n )}\n placeholder={t(\n \"neetoEmailDelivery.sparkpost.setup.emailPlaceholder\"\n )}\n />\n <Input\n required\n name=\"displayName\"\n helpText={t(\n \"neetoEmailDelivery.sparkpost.setup.displayNameHelp\"\n )}\n label={t(\n \"neetoEmailDelivery.sparkpost.setup.displayNameLabel\"\n )}\n />\n </div>\n </CardLayout>\n );\n }}\n </Form>\n </PageContent>\n </PageWrapper>\n );\n};\n\nexport default SparkpostDomainSetup;\n"],"names":["getDomainFromEmail","email","trim","split","SparkpostDomainSetup","_ref","ownerId","alreadyVerifiedRoute","verifyRoute","onCancelRoute","canManageIntegrations","_useTranslation","useTranslation","t","history","useHistory","_useFetchConnectedInt","useFetchConnectedIntegration","integration","isIntegrationLoading","isLoading","hasConnectedIntegration","isPending","_useSparkpostDomain","useSparkpostDomain","onCreateDomain","isCreating","handleSubmit","values","_ref2","setFieldError","displayName","response","alreadyVerified","push","domain","buildUrl","error","_error$response","errorMessage","data","handleCancel","_jsx","className","children","Spinner","replace","PageWrapper","PageContent","Form","formikProps","initialValues","INITIAL_VALUES","validationSchema","VALIDATION_SCHEMA","onSubmit","_ref3","CardLayout","title","String","actionBlock","ActionBlock","cancelButtonProps","onClick","isSubmitting","submitButtonProps","label","description","_jsxs","Callout","variant","Input","required","unlimitedChars","name","type","helpText","placeholder"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAGC,KAAK,EAAA;AAAA,EAAA,OAAIA,KAAK,CAACC,IAAI,EAAE,CAACC,KAAK,CAAC,GAAG,CA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AC,eACtC,CAAC,eACV6B,cAAA,CAAC6B,YAAK,EAAA;gBACJC,QAAQ,EAAA,IAAA;gBACRC,cAAc,EAAA,IAAA;AACdP,gBAAAA,KAAK,EAAErD,CAAC,CAAC,+CAA+C,CAAE;AAC1D6D,gBAAAA,IAAI,EAAC,OAAO;AACZC,gBAAAA,IAAI,EAAC,OAAO;AACZC,gBAAAA,QAAQ,EAAE/D,CAAC,CACT,8CAA8C,EAC9C;AAAEsB,kBAAAA,MAAM,EAANA;AAAO,iBACX,CAAE;gBACF0C,WAAW,EAAEhE,CAAC,CACZ,qDACF;AAAE,eACH,CAAC,eACF6B,cAAA,CAAC6B,YAAK,EAAA;gBACJC,QAAQ,EAAA,IAAA;AACRE,gBAAAA,IAAI,EAAC,aAAa;AAClBE,gBAAAA,QAAQ,EAAE/D,CAAC,CACT,oDACF,CAAE;gBACFqD,KAAK,EAAErD,CAAC,CACN,qDACF;AAAE,eACH,CAAC;aACC;AAAC,WACI,CAAC;AAEjB,QAAA;OACI;KACK;AAAC,GACH,CAAC;AAElB;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
+
require('react');
|
|
5
|
+
require('@bigbinary/neeto-atoms');
|
|
6
|
+
require('@bigbinary/neeto-commons-frontend/v2/react-utils');
|
|
7
|
+
require('@bigbinary/neeto-molecules/v2/CardLayout');
|
|
8
|
+
require('ramda');
|
|
9
|
+
require('react-i18next');
|
|
10
|
+
require('react-router-dom');
|
|
11
|
+
require('../../useEmailDeliveryIntegrationApi-BcQDhMIH.js');
|
|
12
|
+
require('../../useSparkpostApi-DlgW14Wu.js');
|
|
13
|
+
require('../../PageLayout-pMKr_80l.js');
|
|
14
|
+
require('../../useSparkpostDomain-IJPoCQ0f.js');
|
|
15
|
+
var v2_SparkpostDomainVerify = require('../../Verify-80b6NK1q.js');
|
|
16
|
+
require('react/jsx-runtime');
|
|
17
|
+
require('@bigbinary/neeto-cist');
|
|
18
|
+
require('@babel/runtime/helpers/defineProperty');
|
|
19
|
+
require('@tanstack/react-query');
|
|
20
|
+
require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
21
|
+
require('axios');
|
|
22
|
+
require('@bigbinary/neeto-commons-frontend/utils');
|
|
23
|
+
require('i18next');
|
|
24
|
+
require('yup');
|
|
25
|
+
require('@babel/runtime/helpers/objectWithoutProperties');
|
|
26
|
+
require('classnames');
|
|
27
|
+
require('@bigbinary/neeto-molecules/v2/Container');
|
|
28
|
+
require('@bigbinary/neeto-molecules/v2/Header');
|
|
29
|
+
require('@babel/runtime/helpers/toConsumableArray');
|
|
30
|
+
require('@bigbinary/neeto-molecules/v2/CopyToClipboardButton');
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
module.exports = v2_SparkpostDomainVerify.SparkpostDomainVerify;
|
|
35
|
+
//# sourceMappingURL=SparkpostDomainVerify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparkpostDomainVerify.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var useEmailDeliveryIntegrationApi = require('../../useEmailDeliveryIntegrationApi-BcQDhMIH.js');
|
|
4
|
+
require('@bigbinary/neeto-cist');
|
|
5
|
+
require('ramda');
|
|
6
|
+
require('../../useSparkpostApi-DlgW14Wu.js');
|
|
7
|
+
require('@babel/runtime/helpers/defineProperty');
|
|
8
|
+
require('@tanstack/react-query');
|
|
9
|
+
require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
10
|
+
require('axios');
|
|
11
|
+
require('@bigbinary/neeto-commons-frontend/utils');
|
|
12
|
+
require('@babel/runtime/helpers/slicedToArray');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.useFetchConnectedIntegration = useEmailDeliveryIntegrationApi.useFetchConnectedIntegration;
|
|
17
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|