@bigbinary/neeto-email-delivery-frontend 1.0.7 → 1.0.9
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 +39 -0
- package/app/javascript/src/translations/en.json +4 -1
- package/dist/EmailDeliveryScreen.js +52 -99
- package/dist/EmailDeliveryScreen.js.map +1 -1
- package/dist/SparkpostDomainSetup.js +2 -1
- package/dist/SparkpostDomainSetup.js.map +1 -1
- package/dist/SparkpostDomainVerify.js +2 -1
- package/dist/SparkpostDomainVerify.js.map +1 -1
- package/dist/cjs/EmailDeliveryScreen.js +57 -104
- package/dist/cjs/EmailDeliveryScreen.js.map +1 -1
- package/dist/cjs/SparkpostDomainSetup.js +2 -1
- package/dist/cjs/SparkpostDomainSetup.js.map +1 -1
- package/dist/cjs/SparkpostDomainVerify.js +3 -2
- package/dist/cjs/SparkpostDomainVerify.js.map +1 -1
- package/dist/cjs/hooks.js +52 -0
- package/dist/cjs/hooks.js.map +1 -0
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/hooks.js +50 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/useOutlookIntegrationApi-CtHj_BzG.js +92 -0
- package/dist/useOutlookIntegrationApi-CtHj_BzG.js.map +1 -0
- package/dist/useOutlookIntegrationApi-ZgRWrUQN.js +87 -0
- package/dist/useOutlookIntegrationApi-ZgRWrUQN.js.map +1 -0
- package/dist/{useSparkpostDomain-DdG5InhX.js → useSparkpostApi-W7XibjIp.js} +2 -92
- package/dist/useSparkpostApi-W7XibjIp.js.map +1 -0
- package/dist/{useSparkpostDomain-qxCkAS6s.js → useSparkpostApi-pa64NIl6.js} +4 -92
- package/dist/useSparkpostApi-pa64NIl6.js.map +1 -0
- package/dist/useSparkpostDomain-DO4bG1HD.js +95 -0
- package/dist/useSparkpostDomain-DO4bG1HD.js.map +1 -0
- package/dist/useSparkpostDomain-wsENCoto.js +97 -0
- package/dist/useSparkpostDomain-wsENCoto.js.map +1 -0
- package/hooks.d.ts +21 -0
- package/package.json +8 -7
- package/dist/useSparkpostDomain-DdG5InhX.js.map +0 -1
- package/dist/useSparkpostDomain-qxCkAS6s.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SparkpostDomainSetup.js","sources":["../../app/javascript/src/components/SparkpostDomain/utils.js","../../app/javascript/src/components/SparkpostDomain/Setup.jsx"],"sourcesContent":["const getDomainFromEmail = email => email.trim().split(\"@\")[1];\n\nexport { getDomainFromEmail };\n","import { buildUrl } from \"neetocommons/utils\";\nimport CardLayout from \"neetomolecules/CardLayout\";\nimport { Callout } from \"neetoui\";\nimport { Input, ActionBlock, Form } from \"neetoui/formik\";\nimport { useTranslation } from \"react-i18next\";\nimport { useHistory } from \"react-router-dom\";\n\nimport { PageContent, PageWrapper } from \"components/PageLayout\";\nimport useSparkpostDomain from \"hooks/integrations/useSparkpostDomain\";\n\nimport { VALIDATION_SCHEMA } 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 { onCreateDomain, isCreating } = useSparkpostDomain({\n ownerId,\n canManageIntegrations,\n });\n\n const handleSubmit = (values, { setFieldError }) => {\n onCreateDomain(\n values.email.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 return (\n <PageWrapper>\n <PageContent>\n <Form\n className=\"w-full\"\n formikProps={{\n initialValues: { email: \"\" },\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 style=\"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 </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","_useSparkpostDomain","useSparkpostDomain","onCreateDomain","isCreating","handleSubmit","values","_ref2","setFieldError","response","alreadyVerified","push","domain","buildUrl","error","_error$response","errorMessage","data","handleCancel","_jsx","PageWrapper","children","PageContent","Form","className","formikProps","initialValues","validationSchema","VALIDATION_SCHEMA","onSubmit","_ref3","CardLayout","title","String","actionBlock","ActionBlock","cancelButtonProps","onClick","isSubmitting","submitButtonProps","label","description","_jsxs","Callout","style","Input","required","unlimitedChars","name","type","helpText","placeholder"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SparkpostDomainSetup.js","sources":["../../app/javascript/src/components/SparkpostDomain/utils.js","../../app/javascript/src/components/SparkpostDomain/Setup.jsx"],"sourcesContent":["const getDomainFromEmail = email => email.trim().split(\"@\")[1];\n\nexport { getDomainFromEmail };\n","import { buildUrl } from \"neetocommons/utils\";\nimport CardLayout from \"neetomolecules/CardLayout\";\nimport { Callout } from \"neetoui\";\nimport { Input, ActionBlock, Form } from \"neetoui/formik\";\nimport { useTranslation } from \"react-i18next\";\nimport { useHistory } from \"react-router-dom\";\n\nimport { PageContent, PageWrapper } from \"components/PageLayout\";\nimport useSparkpostDomain from \"hooks/integrations/useSparkpostDomain\";\n\nimport { VALIDATION_SCHEMA } 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 { onCreateDomain, isCreating } = useSparkpostDomain({\n ownerId,\n canManageIntegrations,\n });\n\n const handleSubmit = (values, { setFieldError }) => {\n onCreateDomain(\n values.email.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 return (\n <PageWrapper>\n <PageContent>\n <Form\n className=\"w-full\"\n formikProps={{\n initialValues: { email: \"\" },\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 style=\"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 </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","_useSparkpostDomain","useSparkpostDomain","onCreateDomain","isCreating","handleSubmit","values","_ref2","setFieldError","response","alreadyVerified","push","domain","buildUrl","error","_error$response","errorMessage","data","handleCancel","_jsx","PageWrapper","children","PageContent","Form","className","formikProps","initialValues","validationSchema","VALIDATION_SCHEMA","onSubmit","_ref3","CardLayout","title","String","actionBlock","ActionBlock","cancelButtonProps","onClick","isSubmitting","submitButtonProps","label","description","_jsxs","Callout","style","Input","required","unlimitedChars","name","type","helpText","placeholder"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAGC,KAAK,EA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|
|
10
10
|
var reactRouterDom = require('react-router-dom');
|
|
11
11
|
var constants = require('../constants-D3nzz3Te.js');
|
|
12
|
-
var useSparkpostDomain = require('../useSparkpostDomain-
|
|
12
|
+
var useSparkpostDomain = require('../useSparkpostDomain-wsENCoto.js');
|
|
13
|
+
var useSparkpostApi = require('../useSparkpostApi-pa64NIl6.js');
|
|
13
14
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
14
15
|
var Typography = require('@bigbinary/neetoui/Typography');
|
|
15
16
|
var Tag = require('@bigbinary/neetoui/Tag');
|
|
@@ -214,7 +215,7 @@ var SparkpostDomainVerify = function SparkpostDomainVerify(_ref) {
|
|
|
214
215
|
var history = reactRouterDom.useHistory();
|
|
215
216
|
var _useQueryParams = reactUtils.useQueryParams(),
|
|
216
217
|
queryDomain = _useQueryParams.domain;
|
|
217
|
-
var _useFetchSparkpostDom =
|
|
218
|
+
var _useFetchSparkpostDom = useSparkpostApi.useFetchSparkpostDomain(ownerId),
|
|
218
219
|
sparkpostData = _useFetchSparkpostDom.data,
|
|
219
220
|
isLoading = _useFetchSparkpostDom.isLoading;
|
|
220
221
|
var _useSparkpostDomain = useSparkpostDomain.useSparkpostDomain({
|
|
@@ -1 +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 pe-10 font-mono text-xs break-all\">\n {value}\n <CopyToClipboardButton\n {...{ value }}\n className=\"absolute top-1 end-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 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=\"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 {allRecords.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.hostname)}\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?.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) {\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 {!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","_jsxs","className","children","_jsx","Typography","style","CopyToClipboardButton","DnsRecordsSection","dnsRecords","domain","sparkpostData","_useTranslation","useTranslation","t","formatPurpose","purpose","formatRecordName","hostname","endsWith","concat","status","txtVerificationValue","txtVerificationHostname","allRecords","isTxtUnverified","push","type","apply","_toConsumableArray","isEmpty","connected","weight","map","record","index","Tag","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","_useQueryParams","useQueryParams","queryDomain","_useFetchSparkpostDom","useFetchSparkpostDomain","data","isLoading","_useSparkpostDomain","useSparkpostDomain","onVerifyDomain","pathOr","useEffect","VERIFICATION_STATUSES","SUCCESS","setTimeout","handleVerify","response","PENDING","_error","ERROR","isVerificationSuccessful","handleCancel","Spinner","PageWrapper","PageContent","CardLayout","title","actionBlock","description","replace","_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;AAAA,EAAA,oBACjCC,eAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,4BAA4B;AAAAC,IAAAA,QAAA,gBACzCC,cAAA,CAAA,KAAA,EAAA;AAAKF,MAAAA,SAAS,EAAC,mCAAmC;MAAAC,QAAA,eAChDC,cAAA,CAACC,UAAU,EAAA;AAACC,QAAAA,KAAK,EAAC,IAAI;AAAAH,QAAAA,QAAA,EAAEJ;OAAkB;KACvC,CAAC,eACNE,eAAA,CAAA,MAAA,EAAA;AAAMC,MAAAA,SAAS,EAAC,sHAAsH;AAAAC,MAAAA,QAAA,EACnIH,CAAAA,KAAK,eACNI,cAAA,CAACG,qBAAqB,EAAA;AACdP,QAAAA,KAAK,EAALA,KAAK;AACXE,QAAAA,SAAS,EAA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AAW,EAAA;IAAA7F,QAAA,eACVC,cAAA,CAAC6F,qBAAW,EAAA;MAAA9F,QAAA,eACVC,cAAA,CAAC8F,UAAU,EAAA;AACTC,QAAAA,KAAK,EAAErF,CAAC,CAAC,2CAA2C,CAAE;QACtDsF,WAAW,eACThG,cAAA,CAACoC,mBAAmB,EAAA;AACZE,UAAAA,WAAW,EAAXA,WAAW;AAAEC,UAAAA,kBAAkB,EAAlBA,kBAAkB;AACrCE,UAAAA,QAAQ,EAAEiD,YAAa;AACvBlD,UAAAA,QAAQ,EAAE4C;AAAa,SACxB,CACF;AACDa,QAAAA,WAAW,EAAEvF,CAAC,CAAC,iDAAiD,EAAE;AAChEJ,UAAAA,MAAM,EAANA;AACF,SAAC,CAAC,CAAC4F,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAE;AAAAnG,QAAAA,QAAA,eAEvCF,eAAA,CAAA,KAAA,EAAA;AAAKC,UAAAA,SAAS,EAAC,qBAAqB;UAAAC,QAAA,EAAA,cAClCC,cAAA,CAACqD,yBAAyB,EAAA;AAAOd,YAAAA,kBAAkB,EAAlBA;AAAkB,WAAK,CAAC,EACxD,CAACkD,wBAAwB,iBACxB5F,eAAA,CAAAsG,mBAAA,EAAA;YAAApG,QAAA,EAAA,cACEC,cAAA,CAACI,iBAAiB,EAAA;AAAOC,cAAAA,UAAU,EAAVA,UAAU;AAAEC,cAAAA,MAAM,EAANA,MAAM;AAAEC,cAAAA,aAAa,EAAbA;AAAa,aAAK,CAAC,eAChEP,cAAA,CAAC8C,wBAAwB,IAAE,CAAC;AAAA,WAC5B,CACH;SACE;OACK;KACD;AAAC,GACH,CAAC;AAElB;;;;"}
|
|
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 pe-10 font-mono text-xs break-all\">\n {value}\n <CopyToClipboardButton\n {...{ value }}\n className=\"absolute top-1 end-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 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=\"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 {allRecords.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.hostname)}\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?.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) {\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 {!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","_jsxs","className","children","_jsx","Typography","style","CopyToClipboardButton","DnsRecordsSection","dnsRecords","domain","sparkpostData","_useTranslation","useTranslation","t","formatPurpose","purpose","formatRecordName","hostname","endsWith","concat","status","txtVerificationValue","txtVerificationHostname","allRecords","isTxtUnverified","push","type","apply","_toConsumableArray","isEmpty","connected","weight","map","record","index","Tag","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","_useQueryParams","useQueryParams","queryDomain","_useFetchSparkpostDom","useFetchSparkpostDomain","data","isLoading","_useSparkpostDomain","useSparkpostDomain","onVerifyDomain","pathOr","useEffect","VERIFICATION_STATUSES","SUCCESS","setTimeout","handleVerify","response","PENDING","_error","ERROR","isVerificationSuccessful","handleCancel","Spinner","PageWrapper","PageContent","CardLayout","title","actionBlock","description","replace","_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;AAAA,EAAA,oBACjCC,eAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,4BAA4B;AAAAC,IAAAA,QAAA,gBACzCC,cAAA,CAAA,KAAA,EAAA;AAAKF,MAAAA,SAAS,EAAC,mCAAmC;MAAAC,QAAA,eAChDC,cAAA,CAACC,UAAU,EAAA;AAACC,QAAAA,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WAC5B,CACH;SACE;OACK;KACD;AAAC,GACH,CAAC;AAElB;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
4
|
+
var ramda = require('ramda');
|
|
5
|
+
var useOutlookIntegrationApi = require('../useOutlookIntegrationApi-CtHj_BzG.js');
|
|
6
|
+
var useSparkpostApi = require('../useSparkpostApi-pa64NIl6.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
|
+
|
|
13
|
+
var useFetchConnectedIntegration = function useFetchConnectedIntegration(ownerId) {
|
|
14
|
+
var _connectedIntegration;
|
|
15
|
+
var gmail = useOutlookIntegrationApi.useFetchGmail(ownerId);
|
|
16
|
+
var outlook = useOutlookIntegrationApi.useFetchOutlook(ownerId);
|
|
17
|
+
var sparkpost = useSparkpostApi.useFetchSparkpostDomain(ownerId);
|
|
18
|
+
var integrations = [{
|
|
19
|
+
type: "gmail",
|
|
20
|
+
hook: gmail
|
|
21
|
+
}, {
|
|
22
|
+
type: "outlook",
|
|
23
|
+
hook: outlook
|
|
24
|
+
}, {
|
|
25
|
+
type: "sparkpost",
|
|
26
|
+
hook: sparkpost
|
|
27
|
+
}];
|
|
28
|
+
var hooks = ramda.pluck("hook", integrations);
|
|
29
|
+
var isLoading = neetoCist.existsBy({
|
|
30
|
+
isLoading: true
|
|
31
|
+
}, hooks);
|
|
32
|
+
var isError = neetoCist.existsBy({
|
|
33
|
+
isError: true
|
|
34
|
+
}, hooks);
|
|
35
|
+
var connectedIntegration = integrations.find(function (_ref) {
|
|
36
|
+
var _hook$data;
|
|
37
|
+
var hook = _ref.hook;
|
|
38
|
+
return hook.isSuccess && (hook === null || hook === void 0 || (_hook$data = hook.data) === null || _hook$data === void 0 ? void 0 : _hook$data.connected);
|
|
39
|
+
});
|
|
40
|
+
var integration = connectedIntegration ? {
|
|
41
|
+
type: connectedIntegration.type,
|
|
42
|
+
data: (_connectedIntegration = connectedIntegration.hook) === null || _connectedIntegration === void 0 ? void 0 : _connectedIntegration.data
|
|
43
|
+
} : null;
|
|
44
|
+
return {
|
|
45
|
+
integration: integration,
|
|
46
|
+
isLoading: isLoading,
|
|
47
|
+
isError: isError
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.useFetchConnectedIntegration = useFetchConnectedIntegration;
|
|
52
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":["../../app/javascript/src/hooks/reactQuery/integrations/useEmailDeliveryIntegrationApi.js"],"sourcesContent":["import { existsBy } from \"neetocist\";\nimport { pluck } from \"ramda\";\n\nimport { useFetchGmail } from \"./useGmailIntegrationApi\";\nimport { useFetchOutlook } from \"./useOutlookIntegrationApi\";\nimport { useFetchSparkpostDomain } from \"./useSparkpostApi\";\n\nexport const useFetchConnectedIntegration = ownerId => {\n const gmail = useFetchGmail(ownerId);\n const outlook = useFetchOutlook(ownerId);\n const sparkpost = useFetchSparkpostDomain(ownerId);\n\n const integrations = [\n { type: \"gmail\", hook: gmail },\n { type: \"outlook\", hook: outlook },\n { type: \"sparkpost\", hook: sparkpost },\n ];\n\n const hooks = pluck(\"hook\", integrations);\n\n const isLoading = existsBy({ isLoading: true }, hooks);\n const isError = existsBy({ isError: true }, hooks);\n\n const connectedIntegration = integrations.find(\n ({ hook }) => hook.isSuccess && hook?.data?.connected\n );\n\n const integration = connectedIntegration\n ? {\n type: connectedIntegration.type,\n data: connectedIntegration.hook?.data,\n }\n : null;\n\n return { integration, isLoading, isError };\n};\n"],"names":["useFetchConnectedIntegration","ownerId","_connectedIntegration","gmail","useFetchGmail","outlook","useFetchOutlook","sparkpost","useFetchSparkpostDomain","integrations","type","hook","hooks","pluck","isLoading","existsBy","isError","connectedIntegration","find","_ref","_hook$data","isSuccess","data","connected","integration"],"mappings":";;;;;;;;;;;;IAOaA,4BAA4B,GAAG,SAA/BA,4BAA4BA,CAAGC,OAAO,EAAI;AAAA,EAAA,IAAAC,qBAAA;AACrD,EAAA,IAAMC,KAAK,GAAGC,sCAAa,CAACH,OAAO,CAAC;AACpC,EAAA,IAAMI,OAAO,GAAGC,wCAAe,CAACL,OAAO,CAAC;AACxC,EAAA,IAAMM,SAAS,GAAGC,uCAAuB,CAACP,OAAO,CAAC;EAElD,IAAMQ,YAAY,GAAG,CACnB;AAAEC,IAAAA,IAAI,EAAE,OAAO;AAAEC,IAAAA,IAAI,EAAER;AAAM,GAAC,EAC9B;AAAEO,IAAAA,IAAI,EAAE,SAAS;AAAEC,IAAAA,IAAI,EAAEN;AAAQ,GAAC,EAClC;AAAEK,IAAAA,IAAI,EAAE,WAAW;AAAEC,IAAAA,IAAI,EAAEJ;AAAU,GAAC,CACvC;AAED,EAAA,IAAMK,KAAK,GAAGC,WAAK,CAAC,MAAM,EAAEJ,YAAY,CAAC;EAEzC,IAAMK,SAAS,GAAGC,kBAAQ,CAAC;AAAED,IAAAA,SAAS,EAAE;GAAM,EAAEF,KAAK,CAAC;EACtD,IAAMI,OAAO,GAAGD,kBAAQ,CAAC;AAAEC,IAAAA,OAAO,EAAE;GAAM,EAAEJ,KAAK,CAAC;AAElD,EAAA,IAAMK,oBAAoB,GAAGR,YAAY,CAACS,IAAI,CAC5C,UAAAC,IAAA,EAAA;AAAA,IAAA,IAAAC,UAAA;AAAA,IAAA,IAAGT,IAAI,GAAAQ,IAAA,CAAJR,IAAI;AAAA,IAAA,OAAOA,IAAI,CAACU,SAAS,KAAIV,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAAS,KAAAA,CAAAA,IAAAA,CAAAA,UAAA,GAAJT,IAAI,CAAEW,IAAI,MAAA,IAAA,IAAAF,UAAA,KAAVA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,UAAA,CAAYG,SAAS,CAAA;AAAA,GACvD,CAAC;EAED,IAAMC,WAAW,GAAGP,oBAAoB,GACpC;IACEP,IAAI,EAAEO,oBAAoB,CAACP,IAAI;IAC/BY,IAAI,EAAA,CAAApB,qBAAA,GAAEe,oBAAoB,CAACN,IAAI,MAAAT,IAAAA,IAAAA,qBAAA,KAAzBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,qBAAA,CAA2BoB;AACnC,GAAC,GACD,IAAI;EAER,OAAO;AAAEE,IAAAA,WAAW,EAAXA,WAAW;AAAEV,IAAAA,SAAS,EAATA,SAAS;AAAEE,IAAAA,OAAO,EAAPA;GAAS;AAC5C;;;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -15,12 +15,14 @@ require('@bigbinary/neetoui/Toastr');
|
|
|
15
15
|
require('ramda');
|
|
16
16
|
require('react-i18next');
|
|
17
17
|
require('react-router-dom');
|
|
18
|
-
require('../
|
|
19
|
-
require('@babel/runtime/helpers/slicedToArray');
|
|
20
|
-
require('react');
|
|
18
|
+
require('../useSparkpostApi-pa64NIl6.js');
|
|
21
19
|
require('@babel/runtime/helpers/defineProperty');
|
|
22
20
|
require('@tanstack/react-query');
|
|
23
21
|
require('axios');
|
|
22
|
+
require('@babel/runtime/helpers/slicedToArray');
|
|
23
|
+
require('react');
|
|
24
|
+
require('../useOutlookIntegrationApi-CtHj_BzG.js');
|
|
25
|
+
require('../useSparkpostDomain-wsENCoto.js');
|
|
24
26
|
require('i18next');
|
|
25
27
|
require('@bigbinary/neetoui/Button');
|
|
26
28
|
require('@bigbinary/neetoui/Tag');
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { existsBy } from '@bigbinary/neeto-cist';
|
|
2
|
+
import { pluck } from 'ramda';
|
|
3
|
+
import { u as useFetchGmail, a as useFetchOutlook } from './useOutlookIntegrationApi-ZgRWrUQN.js';
|
|
4
|
+
import { u as useFetchSparkpostDomain } from './useSparkpostApi-W7XibjIp.js';
|
|
5
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
6
|
+
import '@tanstack/react-query';
|
|
7
|
+
import '@bigbinary/neeto-commons-frontend/react-utils';
|
|
8
|
+
import 'axios';
|
|
9
|
+
import '@bigbinary/neeto-commons-frontend/utils';
|
|
10
|
+
|
|
11
|
+
var useFetchConnectedIntegration = function useFetchConnectedIntegration(ownerId) {
|
|
12
|
+
var _connectedIntegration;
|
|
13
|
+
var gmail = useFetchGmail(ownerId);
|
|
14
|
+
var outlook = useFetchOutlook(ownerId);
|
|
15
|
+
var sparkpost = useFetchSparkpostDomain(ownerId);
|
|
16
|
+
var integrations = [{
|
|
17
|
+
type: "gmail",
|
|
18
|
+
hook: gmail
|
|
19
|
+
}, {
|
|
20
|
+
type: "outlook",
|
|
21
|
+
hook: outlook
|
|
22
|
+
}, {
|
|
23
|
+
type: "sparkpost",
|
|
24
|
+
hook: sparkpost
|
|
25
|
+
}];
|
|
26
|
+
var hooks = pluck("hook", integrations);
|
|
27
|
+
var isLoading = existsBy({
|
|
28
|
+
isLoading: true
|
|
29
|
+
}, hooks);
|
|
30
|
+
var isError = existsBy({
|
|
31
|
+
isError: true
|
|
32
|
+
}, hooks);
|
|
33
|
+
var connectedIntegration = integrations.find(function (_ref) {
|
|
34
|
+
var _hook$data;
|
|
35
|
+
var hook = _ref.hook;
|
|
36
|
+
return hook.isSuccess && (hook === null || hook === void 0 || (_hook$data = hook.data) === null || _hook$data === void 0 ? void 0 : _hook$data.connected);
|
|
37
|
+
});
|
|
38
|
+
var integration = connectedIntegration ? {
|
|
39
|
+
type: connectedIntegration.type,
|
|
40
|
+
data: (_connectedIntegration = connectedIntegration.hook) === null || _connectedIntegration === void 0 ? void 0 : _connectedIntegration.data
|
|
41
|
+
} : null;
|
|
42
|
+
return {
|
|
43
|
+
integration: integration,
|
|
44
|
+
isLoading: isLoading,
|
|
45
|
+
isError: isError
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { useFetchConnectedIntegration };
|
|
50
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":["../app/javascript/src/hooks/reactQuery/integrations/useEmailDeliveryIntegrationApi.js"],"sourcesContent":["import { existsBy } from \"neetocist\";\nimport { pluck } from \"ramda\";\n\nimport { useFetchGmail } from \"./useGmailIntegrationApi\";\nimport { useFetchOutlook } from \"./useOutlookIntegrationApi\";\nimport { useFetchSparkpostDomain } from \"./useSparkpostApi\";\n\nexport const useFetchConnectedIntegration = ownerId => {\n const gmail = useFetchGmail(ownerId);\n const outlook = useFetchOutlook(ownerId);\n const sparkpost = useFetchSparkpostDomain(ownerId);\n\n const integrations = [\n { type: \"gmail\", hook: gmail },\n { type: \"outlook\", hook: outlook },\n { type: \"sparkpost\", hook: sparkpost },\n ];\n\n const hooks = pluck(\"hook\", integrations);\n\n const isLoading = existsBy({ isLoading: true }, hooks);\n const isError = existsBy({ isError: true }, hooks);\n\n const connectedIntegration = integrations.find(\n ({ hook }) => hook.isSuccess && hook?.data?.connected\n );\n\n const integration = connectedIntegration\n ? {\n type: connectedIntegration.type,\n data: connectedIntegration.hook?.data,\n }\n : null;\n\n return { integration, isLoading, isError };\n};\n"],"names":["useFetchConnectedIntegration","ownerId","_connectedIntegration","gmail","useFetchGmail","outlook","useFetchOutlook","sparkpost","useFetchSparkpostDomain","integrations","type","hook","hooks","pluck","isLoading","existsBy","isError","connectedIntegration","find","_ref","_hook$data","isSuccess","data","connected","integration"],"mappings":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GAAGP,oBAAoB,GACpC;IACEP,IAAI,EAAEO,oBAAoB,CAACP,IAAI;IAC/BY,IAAI,EAAA,CAAApB,qBAAA,GAAEe,oBAAoB,CAACN,IAAI,MAAAT,IAAAA,IAAAA,qBAAA,KAAzBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,qBAAA,CAA2BoB;AACnC,GAAC,GACD,IAAI;EAER,OAAO;AAAEE,IAAAA,WAAW,EAAXA,WAAW;AAAEV,IAAAA,SAAS,EAATA,SAAS;AAAEE,IAAAA,OAAO,EAAPA;GAAS;AAC5C;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -13,12 +13,14 @@ import '@bigbinary/neetoui/Toastr';
|
|
|
13
13
|
import 'ramda';
|
|
14
14
|
import 'react-i18next';
|
|
15
15
|
import 'react-router-dom';
|
|
16
|
-
import './
|
|
17
|
-
import '@babel/runtime/helpers/slicedToArray';
|
|
18
|
-
import 'react';
|
|
16
|
+
import './useSparkpostApi-W7XibjIp.js';
|
|
19
17
|
import '@babel/runtime/helpers/defineProperty';
|
|
20
18
|
import '@tanstack/react-query';
|
|
21
19
|
import 'axios';
|
|
20
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
21
|
+
import 'react';
|
|
22
|
+
import './useOutlookIntegrationApi-ZgRWrUQN.js';
|
|
23
|
+
import './useSparkpostDomain-DO4bG1HD.js';
|
|
22
24
|
import 'i18next';
|
|
23
25
|
import '@bigbinary/neetoui/Button';
|
|
24
26
|
import '@bigbinary/neetoui/Tag';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var reactQuery = require('@tanstack/react-query');
|
|
5
|
+
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
6
|
+
var axios = require('axios');
|
|
7
|
+
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
8
|
+
var useSparkpostApi = require('./useSparkpostApi-pa64NIl6.js');
|
|
9
|
+
|
|
10
|
+
var get$1 = function get(ownerId) {
|
|
11
|
+
return axios.get(utils.buildUrl(useSparkpostApi.GMAIL_URL, {
|
|
12
|
+
ownerId: ownerId
|
|
13
|
+
}), {
|
|
14
|
+
showToastr: false
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var destroy$1 = function destroy(ownerId) {
|
|
18
|
+
axios["delete"](utils.buildUrl(useSparkpostApi.GMAIL_OAUTH_URL, {
|
|
19
|
+
ownerId: ownerId
|
|
20
|
+
}), {
|
|
21
|
+
showToastr: false
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var gmailApi = {
|
|
25
|
+
get: get$1,
|
|
26
|
+
destroy: destroy$1
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
30
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
31
|
+
var useFetchGmail = function useFetchGmail(ownerId, options) {
|
|
32
|
+
return reactQuery.useQuery(_objectSpread$1({
|
|
33
|
+
queryKey: [useSparkpostApi.QUERY_KEYS.INTEGRATION_GMAIL, ownerId],
|
|
34
|
+
queryFn: function queryFn() {
|
|
35
|
+
return gmailApi.get(ownerId);
|
|
36
|
+
},
|
|
37
|
+
retry: 1
|
|
38
|
+
}, options));
|
|
39
|
+
};
|
|
40
|
+
var useDestroyGmail = function useDestroyGmail(_ref) {
|
|
41
|
+
var ownerId = _ref.ownerId;
|
|
42
|
+
return reactUtils.useMutationWithInvalidation(function () {
|
|
43
|
+
return gmailApi.destroy(ownerId);
|
|
44
|
+
}, {
|
|
45
|
+
keysToInvalidate: [[useSparkpostApi.QUERY_KEYS.INTEGRATION_GMAIL, ownerId]]
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var get = function get(ownerId) {
|
|
50
|
+
return axios.get(utils.buildUrl(useSparkpostApi.OUTLOOK_URL, {
|
|
51
|
+
ownerId: ownerId
|
|
52
|
+
}), {
|
|
53
|
+
showToastr: false
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var destroy = function destroy(ownerId) {
|
|
57
|
+
axios["delete"](utils.buildUrl(useSparkpostApi.OUTLOOK_OAUTH_URL, {
|
|
58
|
+
ownerId: ownerId
|
|
59
|
+
}), {
|
|
60
|
+
showToastr: false
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
var outlookApi = {
|
|
64
|
+
get: get,
|
|
65
|
+
destroy: destroy
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
69
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
70
|
+
var useFetchOutlook = function useFetchOutlook(ownerId, options) {
|
|
71
|
+
return reactQuery.useQuery(_objectSpread({
|
|
72
|
+
queryKey: [useSparkpostApi.QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId],
|
|
73
|
+
queryFn: function queryFn() {
|
|
74
|
+
return outlookApi.get(ownerId);
|
|
75
|
+
},
|
|
76
|
+
retry: 1
|
|
77
|
+
}, options));
|
|
78
|
+
};
|
|
79
|
+
var useDestroyOutlook = function useDestroyOutlook(_ref) {
|
|
80
|
+
var ownerId = _ref.ownerId;
|
|
81
|
+
return reactUtils.useMutationWithInvalidation(function () {
|
|
82
|
+
return outlookApi.destroy(ownerId);
|
|
83
|
+
}, {
|
|
84
|
+
keysToInvalidate: [[useSparkpostApi.QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId]]
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
exports.useDestroyGmail = useDestroyGmail;
|
|
89
|
+
exports.useDestroyOutlook = useDestroyOutlook;
|
|
90
|
+
exports.useFetchGmail = useFetchGmail;
|
|
91
|
+
exports.useFetchOutlook = useFetchOutlook;
|
|
92
|
+
//# sourceMappingURL=useOutlookIntegrationApi-CtHj_BzG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOutlookIntegrationApi-CtHj_BzG.js","sources":["../app/javascript/src/apis/integrations/gmail.js","../app/javascript/src/hooks/reactQuery/integrations/useGmailIntegrationApi.js","../app/javascript/src/apis/integrations/outlook.js","../app/javascript/src/hooks/reactQuery/integrations/useOutlookIntegrationApi.js"],"sourcesContent":["import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport { GMAIL_URL, GMAIL_OAUTH_URL } from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(GMAIL_URL, { ownerId }), { showToastr: false });\n\nconst destroy = ownerId => {\n axios.delete(buildUrl(GMAIL_OAUTH_URL, { ownerId }), { showToastr: false });\n};\n\nconst gmailApi = { get, destroy };\n\nexport default gmailApi;\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport gmailApi from \"apis/integrations/gmail\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchGmail = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_GMAIL, ownerId],\n queryFn: () => gmailApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useDestroyGmail = ({ ownerId }) =>\n useMutationWithInvalidation(() => gmailApi.destroy(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_GMAIL, ownerId]],\n });\n","import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport { OUTLOOK_URL, OUTLOOK_OAUTH_URL } from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(OUTLOOK_URL, { ownerId }), { showToastr: false });\n\nconst destroy = ownerId => {\n axios.delete(buildUrl(OUTLOOK_OAUTH_URL, { ownerId }), { showToastr: false });\n};\n\nconst outlookApi = { get, destroy };\n\nexport default outlookApi;\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport outlookApi from \"apis/integrations/outlook\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchOutlook = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId],\n queryFn: () => outlookApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useDestroyOutlook = ({ ownerId }) =>\n useMutationWithInvalidation(() => outlookApi.destroy(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId]],\n });\n"],"names":["get","ownerId","axios","buildUrl","GMAIL_URL","showToastr","destroy","GMAIL_OAUTH_URL","gmailApi","useFetchGmail","options","useQuery","_objectSpread","queryKey","QUERY_KEYS","INTEGRATION_GMAIL","queryFn","retry","useDestroyGmail","_ref","useMutationWithInvalidation","keysToInvalidate","OUTLOOK_URL","OUTLOOK_OAUTH_URL","outlookApi","useFetchOutlook","INTEGRATION_OUTLOOK","useDestroyOutlook"],"mappings":";;;;;;;;;AAKA,IAAMA,KAAG,GAAG,SAANA,GAAGA,CAAGC,OAAO,EAAA;AAAA,EAAA,OACjBC,KAAK,CAACF,GAAG,CAACG,cAAQ,CAACC,yBAAS,EAAE;AAAEH,IAAAA,OAAO,EAAPA;AAAQ,GAAC,CAAC,EAAE;AAAEI,IAAAA,UAAU,EAAE;AAAM,GAAC,CAAC;AAAA,CAAA;AAEpE,IAAMC,SAAO,GAAG,SAAVA,OAAOA,CAAGL,OAAO,EAAI;AACzBC,EAAAA,KAAK,CAAO,QAAA,CAAA,CAACC,cAAQ,CAACI,+BAAe,EAAE;AAAEN,IAAAA,OAAO,EAAPA;AAAQ,GAAC,CAAC,EAAE;AAAEI,IAAAA,UAAU,EAAE;AAAM,GAAC,CAAC;AAC7E,CAAC;AAED,IAAMG,QAAQ,GAAG;AAAER,EAAAA,GAAG,EAAHA,KAAG;AAAEM,EAAAA,OAAO,EAAPA;AAAQ,CAAC;;;;ACN1B,IAAMG,aAAa,GAAG,SAAhBA,aAAaA,CAAIR,OAAO,EAAES,OAAO,EAAA;EAAA,OAC5CC,mBAAQ,CAAAC,eAAA,CAAA;AACNC,IAAAA,QAAQ,EAAE,CAACC,0BAAU,CAACC,iBAAiB,EAAEd,OAAO,CAAC;IACjDe,OAAO,EAAE,SAATA,OAAOA,GAAA;AAAA,MAAA,OAAQR,QAAQ,CAACR,GAAG,CAACC,OAAO,CAAC;AAAA,KAAA;AACpCgB,IAAAA,KAAK,EAAE;GACJP,EAAAA,OAAO,CACX,CAAC;AAAA;IAESQ,eAAe,GAAG,SAA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AAO,CACX,CAAC;AAAA;IAESiB,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAR,IAAA,EAAA;AAAA,EAAA,IAAMlB,OAAO,GAAAkB,IAAA,CAAPlB,OAAO;AAAA,EAAA,OACzCmB,sCAA2B,CAAC,YAAA;AAAA,IAAA,OAAMI,UAAU,CAAClB,OAAO,CAACL,OAAO,CAAC;GAAE,EAAA;IAC7DoB,gBAAgB,EAAE,CAAC,CAACP,0BAAU,CAACY,mBAAmB,EAAEzB,OAAO,CAAC;AAC9D,GAAC,CAAC;AAAA;;;;;;;"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
6
|
+
import { G as GMAIL_URL, d as GMAIL_OAUTH_URL, Q as QUERY_KEYS, O as OUTLOOK_URL, e as OUTLOOK_OAUTH_URL } from './useSparkpostApi-W7XibjIp.js';
|
|
7
|
+
|
|
8
|
+
var get$1 = function get(ownerId) {
|
|
9
|
+
return axios.get(buildUrl(GMAIL_URL, {
|
|
10
|
+
ownerId: ownerId
|
|
11
|
+
}), {
|
|
12
|
+
showToastr: false
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var destroy$1 = function destroy(ownerId) {
|
|
16
|
+
axios["delete"](buildUrl(GMAIL_OAUTH_URL, {
|
|
17
|
+
ownerId: ownerId
|
|
18
|
+
}), {
|
|
19
|
+
showToastr: false
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var gmailApi = {
|
|
23
|
+
get: get$1,
|
|
24
|
+
destroy: destroy$1
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
|
+
var useFetchGmail = function useFetchGmail(ownerId, options) {
|
|
30
|
+
return useQuery(_objectSpread$1({
|
|
31
|
+
queryKey: [QUERY_KEYS.INTEGRATION_GMAIL, ownerId],
|
|
32
|
+
queryFn: function queryFn() {
|
|
33
|
+
return gmailApi.get(ownerId);
|
|
34
|
+
},
|
|
35
|
+
retry: 1
|
|
36
|
+
}, options));
|
|
37
|
+
};
|
|
38
|
+
var useDestroyGmail = function useDestroyGmail(_ref) {
|
|
39
|
+
var ownerId = _ref.ownerId;
|
|
40
|
+
return useMutationWithInvalidation(function () {
|
|
41
|
+
return gmailApi.destroy(ownerId);
|
|
42
|
+
}, {
|
|
43
|
+
keysToInvalidate: [[QUERY_KEYS.INTEGRATION_GMAIL, ownerId]]
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var get = function get(ownerId) {
|
|
48
|
+
return axios.get(buildUrl(OUTLOOK_URL, {
|
|
49
|
+
ownerId: ownerId
|
|
50
|
+
}), {
|
|
51
|
+
showToastr: false
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
var destroy = function destroy(ownerId) {
|
|
55
|
+
axios["delete"](buildUrl(OUTLOOK_OAUTH_URL, {
|
|
56
|
+
ownerId: ownerId
|
|
57
|
+
}), {
|
|
58
|
+
showToastr: false
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
var outlookApi = {
|
|
62
|
+
get: get,
|
|
63
|
+
destroy: destroy
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
67
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
68
|
+
var useFetchOutlook = function useFetchOutlook(ownerId, options) {
|
|
69
|
+
return useQuery(_objectSpread({
|
|
70
|
+
queryKey: [QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId],
|
|
71
|
+
queryFn: function queryFn() {
|
|
72
|
+
return outlookApi.get(ownerId);
|
|
73
|
+
},
|
|
74
|
+
retry: 1
|
|
75
|
+
}, options));
|
|
76
|
+
};
|
|
77
|
+
var useDestroyOutlook = function useDestroyOutlook(_ref) {
|
|
78
|
+
var ownerId = _ref.ownerId;
|
|
79
|
+
return useMutationWithInvalidation(function () {
|
|
80
|
+
return outlookApi.destroy(ownerId);
|
|
81
|
+
}, {
|
|
82
|
+
keysToInvalidate: [[QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId]]
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export { useFetchOutlook as a, useDestroyGmail as b, useDestroyOutlook as c, useFetchGmail as u };
|
|
87
|
+
//# sourceMappingURL=useOutlookIntegrationApi-ZgRWrUQN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOutlookIntegrationApi-ZgRWrUQN.js","sources":["../app/javascript/src/apis/integrations/gmail.js","../app/javascript/src/hooks/reactQuery/integrations/useGmailIntegrationApi.js","../app/javascript/src/apis/integrations/outlook.js","../app/javascript/src/hooks/reactQuery/integrations/useOutlookIntegrationApi.js"],"sourcesContent":["import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport { GMAIL_URL, GMAIL_OAUTH_URL } from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(GMAIL_URL, { ownerId }), { showToastr: false });\n\nconst destroy = ownerId => {\n axios.delete(buildUrl(GMAIL_OAUTH_URL, { ownerId }), { showToastr: false });\n};\n\nconst gmailApi = { get, destroy };\n\nexport default gmailApi;\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport gmailApi from \"apis/integrations/gmail\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchGmail = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_GMAIL, ownerId],\n queryFn: () => gmailApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useDestroyGmail = ({ ownerId }) =>\n useMutationWithInvalidation(() => gmailApi.destroy(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_GMAIL, ownerId]],\n });\n","import axios from \"axios\";\nimport { buildUrl } from \"neetocommons/utils\";\n\nimport { OUTLOOK_URL, OUTLOOK_OAUTH_URL } from \"./constants\";\n\nconst get = ownerId =>\n axios.get(buildUrl(OUTLOOK_URL, { ownerId }), { showToastr: false });\n\nconst destroy = ownerId => {\n axios.delete(buildUrl(OUTLOOK_OAUTH_URL, { ownerId }), { showToastr: false });\n};\n\nconst outlookApi = { get, destroy };\n\nexport default outlookApi;\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport outlookApi from \"apis/integrations/outlook\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchOutlook = (ownerId, options) =>\n useQuery({\n queryKey: [QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId],\n queryFn: () => outlookApi.get(ownerId),\n retry: 1,\n ...options,\n });\n\nexport const useDestroyOutlook = ({ ownerId }) =>\n useMutationWithInvalidation(() => outlookApi.destroy(ownerId), {\n keysToInvalidate: [[QUERY_KEYS.INTEGRATION_OUTLOOK, ownerId]],\n });\n"],"names":["get","ownerId","axios","buildUrl","GMAIL_URL","showToastr","destroy","GMAIL_OAUTH_URL","gmailApi","useFetchGmail","options","useQuery","_objectSpread","queryKey","QUERY_KEYS","INTEGRATION_GMAIL","queryFn","retry","useDestroyGmail","_ref","useMutationWithInvalidation","keysToInvalidate","OUTLOOK_URL","OUTLOOK_OAUTH_URL","outlookApi","useFetchOutlook","INTEGRATION_OUTLOOK","useDestroyOutlook"],"mappings":";;;;;;;AAKA,IAAMA,KAAG,GAAG,SAANA,GAAGA,CAAGC,OAAO,EAAA;AAAA,EAAA,OACjBC,KAAK,CAACF,GAAG,CAACG,QAAQ,CAACC,SAAS,EAAE;AAAEH,IAAAA,OAAO,EAAPA;AAAQ,GAAC,CAAC,EAAE;AAAEI,IAAAA,UAAU,EAAE;AAAM,GAAC,CAAC;AAAA,CAAA;AAEpE,IAAMC,SAAO,GAAG,SAAVA,OAAOA,CAAGL,OAAO,EAAI;AACzBC,EAAAA,KAAK,CAAO,QAAA,CAAA,CAACC,QAAQ,CAACI,eAAe,EAAE;AAAEN,IAAAA,OAAO,EAAPA;AAAQ,GAAC,CAAC,EAAE;AAAEI,IAAAA,UAAU,EAAE;AAAM,GAAC,CAAC;AAC7E,CAAC;AAED,IAAMG,QAAQ,GAAG;AAAER,EAAAA,GAAG,EAAHA,KAAG;AAAEM,EAAAA,OAAO,EAAPA;AAAQ,CAAC;;;;ACN1B,IAAMG,aAAa,GAAG,SAAhBA,aAAaA,CAAIR,OAAO,EAAES,OAAO,EAAA;EAAA,OAC5CC,QAAQ,CAAAC,eAA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