Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | 12x 33x 33x 16x 1x 15x 3x 12x | import DocumentViewer from "@pages/AcquirerPortal/LegalDocuments/LegalDocumentDetail/components/DocumentViewer";
import type { DocumentVersion } from "@pages/AcquirerPortal/LegalDocuments/types";
import TermsOfServiceContentVersion from "@pages/TermsOfService/TermsOfServiceContentVersion";
import { TermsOfService } from "@pages/TermsOfService";
import { formatPublishedDate } from "@pages/AcquirerPortal/LegalDocuments/publishedDate";
import AgreementLogoHeader from "@components/PublishedLegalContent/AgreementLogoHeader";
import AgreementDocumentLoader from "@components/PublishedLegalContent/AgreementDocumentLoader";
import { useGetFeatureFlagValues } from "FeatureFlags/useGetFeatureFlagValues";
type Props = {
/** The acquirer's currently-published agreement document, if any. */
publishedDoc?: DocumentVersion;
/** Version to show when there is no published document (legacy path). */
fallbackVersion: string;
/** "Last updated" to show when there is no published document. */
fallbackLastUpdated: string;
isEnterprise: boolean;
/**
* True while the parent is still determining whether a published document
* exists (flags resolving or the fetch in flight). Show a loader instead of
* the legacy Terms of Service so it does not flash before the published
* agreement resolves.
*/
isResolving?: boolean;
};
/**
* The agreement body shown in the re-consent ("Check Update") modal.
*
* When the acquirer has published a legal document, render ITS content, version
* and real published date — this is the agreement the merchant is actually
* consenting to. Otherwise fall back to the legacy hardcoded Terms of Service
* (acquirers who have not adopted the Legal Documents feature keep working).
*
* fe_static_merchant_agreement overrides the published path for MERCHANT
* agreements: the hardcoded v3.5 agreement (TermsOfServiceContentMerchant,
* incl. the fee-schedule tables) renders regardless of what is published, so
* legal can ship the exact reviewed text without editor-authored content.
*/
export const MerchantAgreementDocument = ({
publishedDoc,
fallbackVersion,
fallbackLastUpdated,
isEnterprise,
isResolving,
}: Props) => {
const { isStaticMerchantAgreementEnabled } = useGetFeatureFlagValues();
if (isResolving) return <AgreementDocumentLoader />;
if (isStaticMerchantAgreementEnabled && !isEnterprise) {
// Version + date stay data-driven (same values the legacy fallback shows);
// only the PROSE is forced to the hardcoded v3.5 content.
return (
<TermsOfService
merchantAgreementVersion={{
version: fallbackVersion,
lastUpdated: fallbackLastUpdated,
}}
isEnterPrise={false}
/>
);
}
if (publishedDoc?.content) {
return (
<>
{/* GiveCorporation branding — the legacy Terms of Service (fallback
below) carries this logo in its own header; the published document is
rendered through DocumentViewer, which has none, so add it here. */}
<AgreementLogoHeader />
<TermsOfServiceContentVersion
merchantAgreementVersion={{
version: publishedDoc.version,
// published_at is a calendar date (midnight UTC) — format in UTC,
// or it renders as the previous day. See publishedDate.ts.
lastUpdated: publishedDoc.publishedDate
? formatPublishedDate(publishedDoc.publishedDate, "MMMM dd, yyyy")
: fallbackLastUpdated,
}}
/>
<DocumentViewer content={publishedDoc.content} />
</>
);
}
return (
<TermsOfService
merchantAgreementVersion={{
version: fallbackVersion,
lastUpdated: fallbackLastUpdated,
}}
isEnterPrise={isEnterprise}
/>
);
};
|