@tribe-nest/forge 3.59.0 → 3.61.0
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/package.json +2 -1
- package/src/_tests/testCommunity.tsx +28 -0
- package/src/contexts/CartContext.tsx +34 -1
- package/src/contexts/CommunityContext.tsx +192 -0
- package/src/contexts/PublicAuthContext.tsx +15 -3
- package/src/data/queries/_tests/metaSignals.spec.tsx +130 -0
- package/src/data/queries/useAccount.ts +33 -2
- package/src/data/queries/useAnalytics.ts +6 -6
- package/src/data/queries/useCallChat.ts +2 -2
- package/src/data/queries/useChat.ts +52 -40
- package/src/data/queries/useCheckouts.ts +2 -1
- package/src/data/queries/useCoachingAvailability.ts +10 -1
- package/src/data/queries/useCommunities.ts +345 -0
- package/src/data/queries/useCommunity.ts +450 -102
- package/src/data/queries/useCommunityAgent.ts +247 -0
- package/src/data/queries/useCommunityCalendar.ts +150 -0
- package/src/data/queries/useCommunityClassroom.ts +75 -0
- package/src/data/queries/useCommunityMembers.ts +108 -0
- package/src/data/queries/useCommunityModeration.ts +327 -0
- package/src/data/queries/useCommunityWiki.ts +137 -0
- package/src/data/queries/useCourses.ts +2 -0
- package/src/data/queries/useEmailSignIn.ts +79 -0
- package/src/data/queries/useEvents.ts +6 -1
- package/src/data/queries/useForms.ts +5 -1
- package/src/data/queries/useLeadMagnet.ts +6 -2
- package/src/data/queries/useMembership.ts +32 -7
- package/src/data/queries/useMembershipCalls.ts +116 -7
- package/src/data/queries/useMyBookings.ts +24 -1
- package/src/data/queries/useMyTickets.ts +24 -1
- package/src/data/queries/useNotifications.ts +6 -2
- package/src/data/queries/useOrders.ts +2 -1
- package/src/data/queries/usePWA.ts +111 -35
- package/src/data/queries/usePostCollections.ts +28 -16
- package/src/data/queries/usePosts.ts +16 -14
- package/src/data/queries/useSiteApp.ts +130 -0
- package/src/data/queries/useSubscriptions.ts +28 -9
- package/src/i18n/de.json +891 -2
- package/src/i18n/en.json +891 -2
- package/src/index.ts +36 -7
- package/src/runtime/pages.spec.ts +36 -0
- package/src/runtime/pages.ts +52 -27
- package/src/server/_tests/buildWebManifest.spec.ts +1 -1
- package/src/server/_tests/forgeServiceWorkerScript.spec.ts +4 -4
- package/src/types/models.ts +11 -0
- package/src/ui/analytics/ForgeAnalytics.tsx +64 -34
- package/src/ui/analytics/PageMetaPixel.tsx +23 -8
- package/src/ui/analytics/_tests/ForgeAnalytics.meta.spec.tsx +129 -0
- package/src/ui/analytics/_tests/metaCommerceEvents.spec.tsx +159 -0
- package/src/ui/analytics/useMetaEvents.ts +78 -0
- package/src/ui/format/_tests/membershipGate.spec.ts +6 -6
- package/src/ui/format/membershipGate.ts +19 -15
- package/src/ui/headless/_tests/communityAgent.spec.tsx +519 -0
- package/src/ui/headless/_tests/communityCalendar.spec.tsx +195 -0
- package/src/ui/headless/_tests/communityClassroom.spec.tsx +120 -0
- package/src/ui/headless/_tests/communityGate.spec.tsx +80 -0
- package/src/ui/headless/_tests/communityHarness.tsx +212 -0
- package/src/ui/headless/_tests/communityMembers.spec.tsx +316 -0
- package/src/ui/headless/_tests/communityPoll.spec.tsx +389 -0
- package/src/ui/headless/_tests/communityProvider.spec.tsx +151 -0
- package/src/ui/headless/_tests/memberHomeBar.spec.ts +84 -0
- package/src/ui/headless/_tests/siteAppBar.spec.ts +83 -0
- package/src/ui/headless/_tests/siteAppHarness.ts +19 -0
- package/src/ui/headless/_tests/siteAppHome.spec.ts +226 -0
- package/src/ui/headless/_tests/siteAppPrompts.spec.ts +185 -0
- package/src/ui/headless/_tests/useCommunityInvite.spec.tsx +104 -0
- package/src/ui/headless/_tests/useCommunityJoin.spec.tsx +596 -0
- package/src/ui/headless/_tests/useCommunityMembership.spec.tsx +179 -0
- package/src/ui/headless/_tests/useCommunityModeration.spec.tsx +420 -0
- package/src/ui/headless/_tests/useCommunityReads.spec.tsx +295 -0
- package/src/ui/headless/_tests/useCommunityUpgrade.spec.tsx +157 -0
- package/src/ui/headless/_tests/useCommunityWiki.spec.tsx +224 -0
- package/src/ui/headless/_tests/useSiteApp.spec.tsx +52 -0
- package/src/ui/headless/_tests/wikiMediaImage.spec.tsx +132 -0
- package/src/ui/headless/auth/useEmailCodeSignIn.ts +186 -0
- package/src/ui/headless/auth/useSignupForm.ts +30 -3
- package/src/ui/headless/chat/useChatAttachmentUpload.ts +9 -6
- package/src/ui/headless/chat/useChatRoom.ts +35 -1
- package/src/ui/headless/communities/CommunityGate.tsx +67 -0
- package/src/ui/headless/communities/index.ts +96 -0
- package/src/ui/headless/communities/paths.ts +36 -0
- package/src/ui/headless/communities/useCommunity.ts +140 -0
- package/src/ui/headless/communities/useCommunityAbout.ts +71 -0
- package/src/ui/headless/communities/useCommunityCalendar.ts +156 -0
- package/src/ui/headless/communities/useCommunityClassroom.ts +84 -0
- package/src/ui/headless/communities/useCommunityHome.ts +91 -0
- package/src/ui/headless/communities/useCommunityInvite.ts +116 -0
- package/src/ui/headless/communities/useCommunityJoin.ts +494 -0
- package/src/ui/headless/communities/useCommunityMembership.ts +182 -0
- package/src/ui/headless/communities/useCommunityUpgrade.ts +213 -0
- package/src/ui/headless/communities/useCommunityWiki.ts +266 -0
- package/src/ui/headless/communities/useMyMemberships.ts +59 -0
- package/src/ui/headless/community/communityPoll.ts +297 -0
- package/src/ui/headless/community/countries.ts +123 -0
- package/src/ui/headless/community/index.ts +81 -1
- package/src/ui/headless/community/linkPreview.ts +71 -0
- package/src/ui/headless/community/richLexical.ts +27 -2
- package/src/ui/headless/community/useCommunityAgent.ts +285 -0
- package/src/ui/headless/community/useCommunityAttachmentUpload.ts +7 -3
- package/src/ui/headless/community/useCommunityMembers.ts +175 -0
- package/src/ui/headless/community/useCommunityModeration.ts +300 -0
- package/src/ui/headless/community/useCommunitySpaceFeed.ts +22 -4
- package/src/ui/headless/community/useCommunityThread.ts +16 -3
- package/src/ui/headless/community/useMentionComposer.ts +17 -9
- package/src/ui/headless/community/useRichMentionComposer.ts +21 -5
- package/src/ui/headless/downloads/index.ts +8 -0
- package/src/ui/headless/downloads/useDownloadPage.ts +134 -0
- package/src/ui/headless/index.ts +21 -4
- package/src/ui/headless/memberHome/index.ts +11 -1
- package/src/ui/headless/memberHome/memberHomeBar.ts +91 -0
- package/src/ui/headless/memberHome/useMemberHomeNav.ts +84 -44
- package/src/ui/headless/membership/_tests/membershipCheckoutRefetch.spec.tsx +8 -0
- package/src/ui/headless/membership/_tests/useMembershipCheckoutApplication.spec.tsx +5 -4
- package/src/ui/headless/membership/_tests/useMembershipCheckoutQuestionnaire.spec.tsx +1 -1
- package/src/ui/headless/membership/_tests/useMembershipCheckoutTrial.spec.tsx +1 -1
- package/src/ui/headless/membership/useMembershipCheckout.ts +89 -22
- package/src/ui/headless/membership/useMembershipGateNotice.ts +25 -7
- package/src/ui/headless/portal/index.ts +57 -0
- package/src/ui/headless/portal/usePortal.ts +274 -0
- package/src/ui/headless/portal/usePortalFiles.ts +68 -0
- package/src/ui/headless/portal/usePortalMessages.ts +189 -0
- package/src/ui/headless/portal/usePortalPreview.ts +142 -0
- package/src/ui/headless/posts/upsell.ts +54 -8
- package/src/ui/headless/posts/useMemberPostsFeed.ts +6 -5
- package/src/ui/headless/posts/usePostCollectionDetail.ts +7 -4
- package/src/ui/headless/posts/usePostCollectionsList.ts +6 -5
- package/src/ui/headless/posts/usePostItem.ts +6 -5
- package/src/ui/headless/siteApp/appBar.ts +102 -0
- package/src/ui/headless/siteApp/appHome.ts +344 -0
- package/src/ui/headless/siteApp/appPrompts.ts +229 -0
- package/src/ui/headless/siteApp/index.ts +58 -0
- package/src/ui/headless/siteApp/useAppHome.ts +210 -0
- package/src/ui/headless/siteApp/useAppInstallRequest.ts +16 -0
- package/src/ui/headless/work/index.ts +2 -0
- package/src/ui/headless/work/useWorkPortal.ts +37 -26
- package/src/ui/index.ts +28 -12
- package/src/ui/styled/AccountDashboard.tsx +754 -602
- package/src/ui/styled/AiAgentWidget.tsx +13 -1
- package/src/ui/styled/ChatRoom.tsx +126 -16
- package/src/ui/styled/Checkout.tsx +8 -0
- package/src/ui/styled/CheckoutConfirmation.tsx +8 -0
- package/src/ui/styled/CoachingConfirmation.tsx +8 -0
- package/src/ui/styled/CoachingDetail.tsx +2 -0
- package/src/ui/styled/CourseConfirmation.tsx +5 -0
- package/src/ui/styled/CourseDetail.tsx +2 -0
- package/src/ui/styled/DownloadPage.tsx +263 -0
- package/src/ui/styled/EventConfirmation.tsx +10 -0
- package/src/ui/styled/EventDetail.tsx +10 -0
- package/src/ui/styled/FilmLibrary.tsx +22 -9
- package/src/ui/styled/MembershipCheckout.tsx +37 -17
- package/src/ui/styled/MembershipTierCallout.tsx +20 -1
- package/src/ui/styled/MembershipTiers.tsx +49 -11
- package/src/ui/styled/MusicLinkPage.tsx +5 -5
- package/src/ui/styled/Paywall.tsx +1 -1
- package/src/ui/styled/ProductDetail.tsx +12 -0
- package/src/ui/styled/PwaRegistration.tsx +5 -1
- package/src/ui/styled/SignupForm.tsx +18 -3
- package/src/ui/styled/_tests/AccountDashboardBookingCall.spec.tsx +6 -6
- package/src/ui/styled/_tests/AccountDashboardMemberships.spec.tsx +151 -0
- package/src/ui/styled/_tests/AccountDashboardRentals.spec.tsx +1 -1
- package/src/ui/styled/_tests/AccountNotifications.spec.tsx +135 -0
- package/src/ui/styled/_tests/CourseCallsSection.spec.tsx +7 -1
- package/src/ui/styled/_tests/DownloadPage.spec.tsx +68 -0
- package/src/ui/styled/_tests/MembershipCheckout.spec.tsx +54 -11
- package/src/ui/styled/_tests/membershipTierCallout.spec.tsx +1 -1
- package/src/ui/styled/_tests/membershipTiersCuratedAccess.spec.tsx +1 -1
- package/src/ui/styled/app/AppBar.tsx +298 -0
- package/src/ui/styled/app/AppHome.tsx +1139 -0
- package/src/ui/styled/app/AppHomeMark.tsx +66 -0
- package/src/ui/styled/app/AppPrompts.tsx +464 -0
- package/src/ui/styled/app/_tests/AppBar.spec.tsx +96 -0
- package/src/ui/styled/app/_tests/AppHome.spec.tsx +209 -0
- package/src/ui/styled/app/_tests/AppPrompts.spec.tsx +232 -0
- package/src/ui/styled/app/index.ts +7 -0
- package/src/ui/styled/chat/ChatThreadPanel.tsx +29 -4
- package/src/ui/styled/chat/MessageBubble.tsx +43 -6
- package/src/ui/styled/communities/CommunitiesList.tsx +88 -0
- package/src/ui/styled/communities/CommunityAbout.tsx +145 -0
- package/src/ui/styled/communities/CommunityCalendar.tsx +484 -0
- package/src/ui/styled/communities/CommunityClassroom.tsx +302 -0
- package/src/ui/styled/communities/CommunityHome.tsx +298 -0
- package/src/ui/styled/communities/CommunityJoinSheet.tsx +544 -0
- package/src/ui/styled/communities/CommunityMembershipMenu.tsx +249 -0
- package/src/ui/styled/communities/CommunityPending.tsx +49 -0
- package/src/ui/styled/communities/CommunityPublicWiki.tsx +75 -0
- package/src/ui/styled/communities/CommunityUpgradeSheet.tsx +137 -0
- package/src/ui/styled/communities/CommunityWiki.tsx +289 -0
- package/src/ui/styled/communities/MyMembershipsList.tsx +115 -0
- package/src/ui/styled/communities/_tests/CommunityAppHome.spec.tsx +92 -0
- package/src/ui/styled/communities/_tests/CommunityClassroomCalendar.spec.tsx +453 -0
- package/src/ui/styled/communities/_tests/CommunityMobile.spec.tsx +399 -0
- package/src/ui/styled/communities/_tests/CommunityPages.spec.tsx +102 -0
- package/src/ui/styled/communities/_tests/CommunityWiki.spec.tsx +223 -0
- package/src/ui/styled/communities/index.ts +19 -0
- package/src/ui/styled/communities/shared.tsx +177 -0
- package/src/ui/styled/community/CommunityAgent.tsx +286 -0
- package/src/ui/styled/community/CommunityComposer.tsx +266 -15
- package/src/ui/styled/community/CommunityFeed.tsx +50 -1
- package/src/ui/styled/community/CommunityLinkPreview.tsx +159 -0
- package/src/ui/styled/community/CommunityMemberGlobe.tsx +171 -0
- package/src/ui/styled/community/CommunityMemberProfile.tsx +137 -4
- package/src/ui/styled/community/CommunityMembers.tsx +387 -0
- package/src/ui/styled/community/CommunityModeration.tsx +587 -0
- package/src/ui/styled/community/CommunityModerationState.tsx +127 -0
- package/src/ui/styled/community/CommunityModeratorMenu.tsx +317 -0
- package/src/ui/styled/community/CommunityNotifications.tsx +52 -6
- package/src/ui/styled/community/CommunityPollCard.tsx +250 -0
- package/src/ui/styled/community/CommunityPostCard.tsx +110 -34
- package/src/ui/styled/community/CommunityPostDetail.tsx +157 -71
- package/src/ui/styled/community/CommunityRichText.tsx +177 -32
- package/src/ui/styled/community/CommunitySpaces.tsx +49 -14
- package/src/ui/styled/community/_tests/CommunityAgent.spec.tsx +571 -0
- package/src/ui/styled/community/_tests/CommunityComposer.spec.tsx +4 -1
- package/src/ui/styled/community/_tests/CommunityLinkPreview.spec.tsx +167 -0
- package/src/ui/styled/community/_tests/CommunityMembers.spec.tsx +137 -0
- package/src/ui/styled/community/_tests/CommunityModeration.spec.tsx +291 -0
- package/src/ui/styled/community/_tests/CommunityPoll.spec.tsx +386 -0
- package/src/ui/styled/community/_tests/CommunityPostDetail.spec.tsx +4 -1
- package/src/ui/styled/community/index.ts +37 -2
- package/src/ui/styled/forge-utilities.css +253 -0
- package/src/ui/styled/members/CallRecordingActions.tsx +182 -0
- package/src/ui/styled/members/CallTranscriptViewer.tsx +424 -0
- package/src/ui/styled/members/MemberCallsCalendar.tsx +41 -54
- package/src/ui/styled/members/MemberHomeLayout.tsx +327 -29
- package/src/ui/styled/members/MemberPostCard.tsx +9 -5
- package/src/ui/styled/members/MemberPostsFeed.tsx +3 -2
- package/src/ui/styled/members/PostCollectionDetail.tsx +18 -10
- package/src/ui/styled/members/PostCollectionsGrid.tsx +24 -10
- package/src/ui/styled/members/_tests/MemberCallsCalendar.spec.tsx +167 -8
- package/src/ui/styled/members/callTranscriptText.ts +67 -0
- package/src/ui/styled/members/index.ts +8 -0
- package/src/ui/styled/portal/PortalAccountSection.tsx +61 -0
- package/src/ui/styled/portal/PortalActivity.tsx +167 -0
- package/src/ui/styled/portal/PortalBilling.tsx +197 -0
- package/src/ui/styled/portal/PortalFiles.tsx +279 -0
- package/src/ui/styled/portal/PortalHome.tsx +401 -0
- package/src/ui/styled/portal/PortalMessages.tsx +300 -0
- package/src/ui/styled/portal/PortalPreviewBanner.tsx +75 -0
- package/src/ui/styled/portal/PortalProjects.tsx +407 -0
- package/src/ui/styled/portal/PortalShell.tsx +397 -0
- package/src/ui/styled/portal/_tests/PortalAppHome.spec.tsx +90 -0
- package/src/ui/styled/portal/_tests/PortalFiles.spec.tsx +159 -0
- package/src/ui/styled/portal/_tests/PortalHome.spec.tsx +148 -0
- package/src/ui/styled/portal/_tests/PortalMessages.spec.tsx +168 -0
- package/src/ui/styled/portal/_tests/PortalPreviewBanner.spec.tsx +132 -0
- package/src/ui/styled/portal/_tests/portalNav.spec.ts +123 -0
- package/src/ui/styled/portal/index.ts +13 -0
- package/src/ui/styled/portal/portalNav.ts +260 -0
- package/src/ui/styled/portal/shared.tsx +206 -0
- package/src/ui/styled/work/WorkInviteAccept.tsx +228 -168
- package/src/ui/styled/work/WorkPortalProjects.tsx +68 -120
- package/src/ui/styled/work/WorkProjectDocuments.tsx +99 -128
- package/src/ui/styled/work/WorkProjectInvoices.tsx +91 -86
- package/src/ui/styled/work/WorkProjectReport.tsx +11 -17
- package/src/ui/styled/work/WorkReportBody.tsx +223 -248
- package/src/ui/styled/work/WorkTaskAttachments.tsx +23 -29
- package/src/ui/styled/work/WorkTaskComments.tsx +75 -102
- package/src/ui/styled/work/WorkTaskDetail.tsx +48 -59
- package/src/ui/styled/work/WorkTokenReport.tsx +8 -16
- package/src/ui/styled/work/index.ts +1 -1
- package/src/utils/_tests/metaEvents.spec.ts +264 -0
- package/src/utils/_tests/safeRedirect.spec.ts +2 -2
- package/src/utils/landing.ts +19 -6
- package/src/utils/metaEvents.ts +302 -0
- package/src/ui/headless/membership/MembershipGate.tsx +0 -44
- package/src/ui/styled/_tests/AccountDashboardCommunity.spec.tsx +0 -149
- package/src/ui/styled/_tests/AccountDashboardTrial.spec.tsx +0 -105
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import { useCommunityJoin, type UseCommunityJoinOptions } from "../../headless/communities/useCommunityJoin";
|
|
3
|
+
import type { PublicTier } from "../../../data/queries/useCommunities";
|
|
4
|
+
import type { CommunityInviteProblem } from "../../headless/communities/useCommunityInvite";
|
|
5
|
+
import { useSiteConfig } from "../../../data/queries/useWebsite";
|
|
6
|
+
import { useForgeLocale, useForgeT, type ForgeT } from "../../../i18n";
|
|
7
|
+
import { usePaymentRenderer } from "../../payment/ForgePaymentProvider";
|
|
8
|
+
import { formatCurrency } from "../../format/useFormatCurrency";
|
|
9
|
+
import { cycleFloor, cycleIsFree, type BillingCycle } from "../../format/membershipPwyw";
|
|
10
|
+
import { membershipPriceLabel } from "../../format/membershipPriceLabel";
|
|
11
|
+
import { formatTrialDate } from "../../headless/membership/membershipTrial";
|
|
12
|
+
import { CallHelpHint } from "../../media/CallHelpHint";
|
|
13
|
+
import { Loading } from "../Loading";
|
|
14
|
+
import { PaystackPayButton } from "../PaystackPayButton";
|
|
15
|
+
import { CommunitySheet, useCommunityStyles } from "./shared";
|
|
16
|
+
|
|
17
|
+
export interface CommunityJoinSheetProps extends Omit<UseCommunityJoinOptions, "tierId"> {
|
|
18
|
+
open: boolean;
|
|
19
|
+
onOpenChange: (open: boolean) => void;
|
|
20
|
+
/** The tier the sheet opens on (`?tier=`, or a tier card's own Join). An invite's tier wins. */
|
|
21
|
+
tierId?: string | null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The join sheet: the About page's Join, in place. Every step is
|
|
26
|
+
* `useCommunityJoin` plus markup; the step order, what is skipped, invites and
|
|
27
|
+
* provider differences all live in the hook.
|
|
28
|
+
*/
|
|
29
|
+
export function CommunityJoinSheet({ open, onOpenChange, ...options }: CommunityJoinSheetProps) {
|
|
30
|
+
const tr = useForgeT();
|
|
31
|
+
// The flow lives HERE, outside the dialog content, so a Paystack stand-down
|
|
32
|
+
// that remounts the content does not reset it.
|
|
33
|
+
const join = useCommunityJoin(options);
|
|
34
|
+
return (
|
|
35
|
+
<CommunitySheet
|
|
36
|
+
open={open}
|
|
37
|
+
onOpenChange={onOpenChange}
|
|
38
|
+
testId="community-join-sheet"
|
|
39
|
+
title={join.community ? tr("forge.community_join_sheet.title", { community_name: join.community.name }) : tr("forge.community_join_sheet.title_plain")}
|
|
40
|
+
closeLabel={tr("forge.community_join_sheet.aria_close")}
|
|
41
|
+
>
|
|
42
|
+
<JoinBody join={join} />
|
|
43
|
+
</CommunitySheet>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type Join = ReturnType<typeof useCommunityJoin>;
|
|
48
|
+
|
|
49
|
+
/** Why an invite link cannot be used, said plainly. The normal Join still works underneath. */
|
|
50
|
+
const INVITE_PROBLEM_KEYS: Record<CommunityInviteProblem, string> = {
|
|
51
|
+
expired: "forge.community_join_sheet.invite_expired",
|
|
52
|
+
revoked: "forge.community_join_sheet.invite_revoked",
|
|
53
|
+
used: "forge.community_join_sheet.invite_used",
|
|
54
|
+
used_up: "forge.community_join_sheet.invite_used_up",
|
|
55
|
+
not_found: "forge.community_join_sheet.invite_not_found",
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
function JoinBody({ join }: { join: Join }) {
|
|
59
|
+
const tr = useForgeT();
|
|
60
|
+
const { t, button, ghostButton, input, muted, errorText } = useCommunityStyles();
|
|
61
|
+
const locale = useForgeLocale();
|
|
62
|
+
const renderPayment = usePaymentRenderer();
|
|
63
|
+
const currency = useSiteConfig().data?.currency;
|
|
64
|
+
const money = (amount: number) => formatCurrency(amount, currency);
|
|
65
|
+
const field: CSSProperties = { display: "flex", flexDirection: "column", gap: 6, fontSize: 14 };
|
|
66
|
+
const linkButton: CSSProperties = {
|
|
67
|
+
alignSelf: "center",
|
|
68
|
+
background: "transparent",
|
|
69
|
+
border: "none",
|
|
70
|
+
padding: 4,
|
|
71
|
+
color: t.primary,
|
|
72
|
+
fontFamily: t.fontFamily,
|
|
73
|
+
fontSize: 14,
|
|
74
|
+
fontWeight: 600,
|
|
75
|
+
cursor: "pointer",
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
if (join.isLoading) return <Loading />;
|
|
79
|
+
|
|
80
|
+
const problem = join.inviteProblem && (
|
|
81
|
+
<p role="alert" data-testid="community-join-invite-problem" style={{ ...muted, fontWeight: 600, marginBottom: 12 }}>
|
|
82
|
+
{tr(INVITE_PROBLEM_KEYS[join.inviteProblem])}
|
|
83
|
+
</p>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
switch (join.step) {
|
|
87
|
+
case "email": {
|
|
88
|
+
if (join.emailMismatch) {
|
|
89
|
+
return (
|
|
90
|
+
<div data-testid="community-join-email-mismatch" className="fg:flex fg:flex-col fg:gap-3">
|
|
91
|
+
<p role="alert" style={{ fontWeight: 600 }}>
|
|
92
|
+
{tr("forge.community_join_sheet.email_mismatch", {
|
|
93
|
+
email: join.emailMismatch.invitedEmail,
|
|
94
|
+
signed_in_email: join.emailMismatch.signedInEmail,
|
|
95
|
+
})}
|
|
96
|
+
</p>
|
|
97
|
+
<button type="button" style={button} onClick={() => void join.signInAsInvited()}>
|
|
98
|
+
{tr("forge.community_join_sheet.sign_in_as", { email: join.emailMismatch.invitedEmail })}
|
|
99
|
+
</button>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
if (join.mode === "email") {
|
|
104
|
+
return (
|
|
105
|
+
<form
|
|
106
|
+
data-testid="community-join-email"
|
|
107
|
+
className="fg:flex fg:flex-col fg:gap-3"
|
|
108
|
+
onSubmit={(e) => {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
void join.next();
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
{problem}
|
|
114
|
+
<label style={field}>
|
|
115
|
+
{tr("forge.community_join_sheet.email")}
|
|
116
|
+
<input
|
|
117
|
+
style={{ ...input, opacity: join.emailLocked ? 0.75 : 1 }}
|
|
118
|
+
type="email"
|
|
119
|
+
inputMode="email"
|
|
120
|
+
value={join.emailFlow.email}
|
|
121
|
+
readOnly={join.emailLocked}
|
|
122
|
+
aria-readonly={join.emailLocked}
|
|
123
|
+
onChange={(e) => join.emailFlow.setEmail(e.target.value)}
|
|
124
|
+
autoComplete="email"
|
|
125
|
+
autoFocus={!join.emailLocked}
|
|
126
|
+
/>
|
|
127
|
+
</label>
|
|
128
|
+
{join.error && <p role="alert" style={errorText}>{join.error}</p>}
|
|
129
|
+
<button type="submit" disabled={join.isSubmitting} style={button}>
|
|
130
|
+
{join.isSubmitting ? tr("forge.community_join_sheet.working") : tr("forge.community_join_sheet.continue")}
|
|
131
|
+
</button>
|
|
132
|
+
<button type="button" data-testid="community-join-use-password" style={linkButton} onClick={join.switchToPassword}>
|
|
133
|
+
{tr("forge.community_join_sheet.use_password")}
|
|
134
|
+
</button>
|
|
135
|
+
</form>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
const signup = join.mode === "signup";
|
|
139
|
+
return (
|
|
140
|
+
<form
|
|
141
|
+
className="fg:flex fg:flex-col fg:gap-3"
|
|
142
|
+
onSubmit={(e) => {
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
void join.next();
|
|
145
|
+
}}
|
|
146
|
+
>
|
|
147
|
+
{problem}
|
|
148
|
+
{signup && (
|
|
149
|
+
<div className="fg:flex fg:gap-2">
|
|
150
|
+
<label style={{ ...field, flex: 1 }}>
|
|
151
|
+
{tr("forge.community_join_sheet.first_name")}
|
|
152
|
+
<input style={input} value={join.signup.firstName} onChange={(e) => join.signup.setFirstName(e.target.value)} autoComplete="given-name" />
|
|
153
|
+
</label>
|
|
154
|
+
<label style={{ ...field, flex: 1 }}>
|
|
155
|
+
{tr("forge.community_join_sheet.last_name")}
|
|
156
|
+
<input style={input} value={join.signup.lastName} onChange={(e) => join.signup.setLastName(e.target.value)} autoComplete="family-name" />
|
|
157
|
+
</label>
|
|
158
|
+
</div>
|
|
159
|
+
)}
|
|
160
|
+
<label style={field}>
|
|
161
|
+
{tr("forge.community_join_sheet.email")}
|
|
162
|
+
<input
|
|
163
|
+
style={{ ...input, opacity: join.emailLocked ? 0.75 : 1 }}
|
|
164
|
+
type="email"
|
|
165
|
+
value={signup ? join.signup.email : join.login.email}
|
|
166
|
+
readOnly={join.emailLocked}
|
|
167
|
+
aria-readonly={join.emailLocked}
|
|
168
|
+
onChange={(e) => (signup ? join.signup.setEmail(e.target.value) : join.login.setEmail(e.target.value))}
|
|
169
|
+
autoComplete="email"
|
|
170
|
+
/>
|
|
171
|
+
</label>
|
|
172
|
+
<label style={field}>
|
|
173
|
+
{tr("forge.community_join_sheet.password")}
|
|
174
|
+
<input
|
|
175
|
+
style={input}
|
|
176
|
+
type="password"
|
|
177
|
+
value={signup ? join.signup.password : join.login.password}
|
|
178
|
+
onChange={(e) => (signup ? join.signup.setPassword(e.target.value) : join.login.setPassword(e.target.value))}
|
|
179
|
+
autoComplete={signup ? "new-password" : "current-password"}
|
|
180
|
+
/>
|
|
181
|
+
</label>
|
|
182
|
+
{signup && (
|
|
183
|
+
<label className="fg:flex fg:items-center fg:gap-2" style={{ fontSize: 13 }}>
|
|
184
|
+
<input
|
|
185
|
+
type="checkbox"
|
|
186
|
+
checked={join.signup.acceptedTerms}
|
|
187
|
+
onChange={(e) => join.signup.setAcceptedTerms(e.target.checked)}
|
|
188
|
+
style={{ accentColor: t.primary }}
|
|
189
|
+
/>
|
|
190
|
+
{tr("forge.community_join_sheet.accept_terms")}
|
|
191
|
+
</label>
|
|
192
|
+
)}
|
|
193
|
+
{join.error && <p role="alert" style={errorText}>{join.error}</p>}
|
|
194
|
+
<button type="submit" disabled={join.isSubmitting} style={button}>
|
|
195
|
+
{join.isSubmitting ? tr("forge.community_join_sheet.working") : tr("forge.community_join_sheet.continue")}
|
|
196
|
+
</button>
|
|
197
|
+
<button type="button" data-testid="community-join-use-code" style={linkButton} onClick={join.switchToEmailCode}>
|
|
198
|
+
{tr("forge.community_join_sheet.use_code")}
|
|
199
|
+
</button>
|
|
200
|
+
</form>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
case "code":
|
|
205
|
+
return (
|
|
206
|
+
<form
|
|
207
|
+
className="fg:flex fg:flex-col fg:gap-3"
|
|
208
|
+
onSubmit={(e) => {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
void join.next();
|
|
211
|
+
}}
|
|
212
|
+
>
|
|
213
|
+
<p>{tr("forge.community_join_sheet.code_sent", { email: join.codeEmail })}</p>
|
|
214
|
+
<label style={field}>
|
|
215
|
+
{tr("forge.community_join_sheet.code")}
|
|
216
|
+
<input
|
|
217
|
+
style={{ ...input, letterSpacing: 4 }}
|
|
218
|
+
inputMode="numeric"
|
|
219
|
+
autoComplete="one-time-code"
|
|
220
|
+
maxLength={6}
|
|
221
|
+
value={join.code}
|
|
222
|
+
onChange={(e) => join.setCode(e.target.value.replace(/\D/g, ""))}
|
|
223
|
+
autoFocus
|
|
224
|
+
/>
|
|
225
|
+
</label>
|
|
226
|
+
{join.error && <p role="alert" style={errorText}>{join.error}</p>}
|
|
227
|
+
{join.mode === "email" && join.emailFlow.resent && !join.error && (
|
|
228
|
+
<p role="status" data-testid="community-join-code-resent" style={muted}>
|
|
229
|
+
{tr("forge.community_join_sheet.code_resent")}
|
|
230
|
+
</p>
|
|
231
|
+
)}
|
|
232
|
+
<button type="submit" disabled={join.isSubmitting} style={button}>
|
|
233
|
+
{join.isSubmitting ? tr("forge.community_join_sheet.working") : tr("forge.community_join_sheet.verify")}
|
|
234
|
+
</button>
|
|
235
|
+
<div className="fg:flex fg:flex-wrap fg:justify-between fg:gap-2">
|
|
236
|
+
<button type="button" data-testid="community-join-change-email" style={linkButton} onClick={join.back}>
|
|
237
|
+
{join.mode === "email" ? tr("forge.community_join_sheet.different_email") : tr("forge.community_join_sheet.back")}
|
|
238
|
+
</button>
|
|
239
|
+
<button
|
|
240
|
+
type="button"
|
|
241
|
+
data-testid="community-join-resend"
|
|
242
|
+
style={linkButton}
|
|
243
|
+
disabled={join.isSubmitting}
|
|
244
|
+
onClick={() => void join.resendCode()}
|
|
245
|
+
>
|
|
246
|
+
{tr("forge.community_join_sheet.resend")}
|
|
247
|
+
</button>
|
|
248
|
+
</div>
|
|
249
|
+
</form>
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
case "profile":
|
|
253
|
+
return (
|
|
254
|
+
<form
|
|
255
|
+
data-testid="community-join-profile"
|
|
256
|
+
className="fg:flex fg:flex-col fg:gap-3"
|
|
257
|
+
onSubmit={(e) => {
|
|
258
|
+
e.preventDefault();
|
|
259
|
+
void join.next();
|
|
260
|
+
}}
|
|
261
|
+
>
|
|
262
|
+
<p style={{ fontWeight: 600 }}>{tr("forge.community_join_sheet.new_here", { email: join.emailFlow.email })}</p>
|
|
263
|
+
<div className="fg:flex fg:gap-2">
|
|
264
|
+
<label style={{ ...field, flex: 1, minWidth: 0 }}>
|
|
265
|
+
{tr("forge.community_join_sheet.first_name")}
|
|
266
|
+
<input
|
|
267
|
+
style={input}
|
|
268
|
+
value={join.emailFlow.firstName}
|
|
269
|
+
maxLength={100}
|
|
270
|
+
onChange={(e) => join.emailFlow.setFirstName(e.target.value)}
|
|
271
|
+
autoComplete="given-name"
|
|
272
|
+
autoFocus
|
|
273
|
+
/>
|
|
274
|
+
</label>
|
|
275
|
+
<label style={{ ...field, flex: 1, minWidth: 0 }}>
|
|
276
|
+
{tr("forge.community_join_sheet.last_name")}
|
|
277
|
+
<input
|
|
278
|
+
style={input}
|
|
279
|
+
value={join.emailFlow.lastName}
|
|
280
|
+
maxLength={100}
|
|
281
|
+
onChange={(e) => join.emailFlow.setLastName(e.target.value)}
|
|
282
|
+
autoComplete="family-name"
|
|
283
|
+
/>
|
|
284
|
+
</label>
|
|
285
|
+
</div>
|
|
286
|
+
<label className="fg:flex fg:items-center fg:gap-2" style={{ fontSize: 13 }}>
|
|
287
|
+
<input
|
|
288
|
+
type="checkbox"
|
|
289
|
+
checked={join.emailFlow.acceptedTerms}
|
|
290
|
+
onChange={(e) => join.emailFlow.setAcceptedTerms(e.target.checked)}
|
|
291
|
+
style={{ accentColor: t.primary }}
|
|
292
|
+
/>
|
|
293
|
+
{tr("forge.community_join_sheet.accept_terms")}
|
|
294
|
+
</label>
|
|
295
|
+
{join.error && <p role="alert" style={errorText}>{join.error}</p>}
|
|
296
|
+
<button type="submit" disabled={join.isSubmitting} style={button}>
|
|
297
|
+
{join.isSubmitting ? tr("forge.community_join_sheet.working") : tr("forge.community_join_sheet.continue")}
|
|
298
|
+
</button>
|
|
299
|
+
<button type="button" data-testid="community-join-start-again" style={linkButton} onClick={join.back}>
|
|
300
|
+
{tr("forge.community_join_sheet.start_again")}
|
|
301
|
+
</button>
|
|
302
|
+
</form>
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
case "tier":
|
|
306
|
+
return (
|
|
307
|
+
<div className="fg:flex fg:flex-col fg:gap-4" data-testid="community-join-tier">
|
|
308
|
+
{problem}
|
|
309
|
+
{join.hasTierChoice && (
|
|
310
|
+
<div className="fg:flex fg:flex-col fg:gap-2" role="radiogroup" aria-label={tr("forge.community_join_sheet.choose_tier")}>
|
|
311
|
+
{join.tiers.map((tier) => (
|
|
312
|
+
<TierOption key={tier.id} tier={tier} selected={join.selectedTier?.id === tier.id} onSelect={() => join.selectTier(tier)} t={tr} money={money} />
|
|
313
|
+
))}
|
|
314
|
+
</div>
|
|
315
|
+
)}
|
|
316
|
+
{join.selectedTier && (
|
|
317
|
+
<div className="fg:flex fg:flex-col fg:gap-3">
|
|
318
|
+
{!join.hasTierChoice && (
|
|
319
|
+
<div>
|
|
320
|
+
<p style={{ fontWeight: 700 }}>{join.selectedTier.name}</p>
|
|
321
|
+
<p style={muted}>{membershipPriceLabel(join.selectedTier, tr, money)}</p>
|
|
322
|
+
</div>
|
|
323
|
+
)}
|
|
324
|
+
{join.cycles.month && join.cycles.year && (
|
|
325
|
+
<div className="fg:flex fg:flex-wrap fg:gap-4" role="radiogroup" aria-label={tr("forge.community_join_sheet.billing_cycle")}>
|
|
326
|
+
{(["month", "year"] as const).map((cycle) => (
|
|
327
|
+
<label key={cycle} className="fg:flex fg:items-center fg:gap-2" style={{ cursor: "pointer", fontSize: 14 }}>
|
|
328
|
+
<input
|
|
329
|
+
type="radio"
|
|
330
|
+
checked={join.billingCycle === cycle}
|
|
331
|
+
onChange={() => join.setBillingCycle(cycle)}
|
|
332
|
+
style={{ accentColor: t.primary }}
|
|
333
|
+
/>
|
|
334
|
+
{cycleLabel(join.selectedTier!, cycle, tr, money)}
|
|
335
|
+
</label>
|
|
336
|
+
))}
|
|
337
|
+
</div>
|
|
338
|
+
)}
|
|
339
|
+
{join.selectedTier.payWhatYouWant && (
|
|
340
|
+
<label style={field}>
|
|
341
|
+
{tr("forge.community_join_sheet.amount_label", { minimum: money(join.minimumAmount) })}
|
|
342
|
+
<input
|
|
343
|
+
style={{ ...input, borderColor: join.amountRefusal ? "#ef4444" : undefined }}
|
|
344
|
+
type="number"
|
|
345
|
+
min={join.minimumAmount}
|
|
346
|
+
step="any"
|
|
347
|
+
value={join.customAmount || ""}
|
|
348
|
+
aria-invalid={!!join.amountRefusal}
|
|
349
|
+
onChange={(e) => join.setCustomAmount(Number(e.target.value))}
|
|
350
|
+
/>
|
|
351
|
+
</label>
|
|
352
|
+
)}
|
|
353
|
+
{join.amountRefusal && (
|
|
354
|
+
<p role="alert" style={errorText}>
|
|
355
|
+
{join.amountRefusal.reason === "below_minimum"
|
|
356
|
+
? tr("forge.community_join_sheet.amount_below_minimum", { minimum: money(join.amountRefusal.minimum) })
|
|
357
|
+
: tr("forge.community_join_sheet.amount_not_positive")}
|
|
358
|
+
</p>
|
|
359
|
+
)}
|
|
360
|
+
{join.trialDays > 0 && join.trialEndsAt && (
|
|
361
|
+
<p data-testid="community-join-trial" style={{ fontSize: 14, fontWeight: 600 }}>
|
|
362
|
+
{tr("forge.community_join_sheet.trial_line", { days: join.trialDays, date: formatTrialDate(join.trialEndsAt, locale) })}
|
|
363
|
+
</p>
|
|
364
|
+
)}
|
|
365
|
+
</div>
|
|
366
|
+
)}
|
|
367
|
+
{join.error && <p role="alert" style={errorText}>{join.error}</p>}
|
|
368
|
+
<button type="button" disabled={!join.selectedTier || join.isSubmitting} style={button} onClick={() => void join.next()}>
|
|
369
|
+
{submitLabel(join, tr, money)}
|
|
370
|
+
</button>
|
|
371
|
+
</div>
|
|
372
|
+
);
|
|
373
|
+
|
|
374
|
+
case "questions":
|
|
375
|
+
return (
|
|
376
|
+
<form
|
|
377
|
+
className="fg:flex fg:flex-col fg:gap-3"
|
|
378
|
+
data-testid="community-join-questions"
|
|
379
|
+
onSubmit={(e) => {
|
|
380
|
+
e.preventDefault();
|
|
381
|
+
void join.next();
|
|
382
|
+
}}
|
|
383
|
+
>
|
|
384
|
+
{join.questionnaire.map((q) => {
|
|
385
|
+
const value = join.questionnaireAnswers[q.id] ?? "";
|
|
386
|
+
const missing = !!join.questionnaireRefusal && !q.optional && !value.trim();
|
|
387
|
+
const style = { ...input, borderColor: missing ? "#ef4444" : undefined };
|
|
388
|
+
return (
|
|
389
|
+
<label key={q.id} style={field}>
|
|
390
|
+
<span>
|
|
391
|
+
{q.question}
|
|
392
|
+
{!q.optional && <span aria-hidden="true" style={{ color: "#ef4444" }}> *</span>}
|
|
393
|
+
</span>
|
|
394
|
+
{q.type === "select" && q.options?.length ? (
|
|
395
|
+
<select style={style} value={value} aria-invalid={missing} onChange={(e) => join.setQuestionnaireAnswer(q.id, e.target.value)}>
|
|
396
|
+
<option value="">{tr("forge.community_join_sheet.select_placeholder")}</option>
|
|
397
|
+
{q.options.map((option) => (
|
|
398
|
+
<option key={option} value={option}>
|
|
399
|
+
{option}
|
|
400
|
+
</option>
|
|
401
|
+
))}
|
|
402
|
+
</select>
|
|
403
|
+
) : q.type === "textarea" ? (
|
|
404
|
+
<textarea
|
|
405
|
+
style={{ ...style, height: "auto", resize: "vertical" }}
|
|
406
|
+
rows={3}
|
|
407
|
+
value={value}
|
|
408
|
+
aria-invalid={missing}
|
|
409
|
+
onChange={(e) => join.setQuestionnaireAnswer(q.id, e.target.value)}
|
|
410
|
+
/>
|
|
411
|
+
) : (
|
|
412
|
+
<input style={style} value={value} aria-invalid={missing} onChange={(e) => join.setQuestionnaireAnswer(q.id, e.target.value)} />
|
|
413
|
+
)}
|
|
414
|
+
</label>
|
|
415
|
+
);
|
|
416
|
+
})}
|
|
417
|
+
{join.questionnaireRefusal && (
|
|
418
|
+
<p role="alert" style={errorText}>
|
|
419
|
+
{tr("forge.community_join_sheet.answer_required", { question: join.questionnaireRefusal.question })}
|
|
420
|
+
</p>
|
|
421
|
+
)}
|
|
422
|
+
{join.error && <p role="alert" style={errorText}>{join.error}</p>}
|
|
423
|
+
<div className="fg:flex fg:gap-2">
|
|
424
|
+
<button type="button" style={ghostButton} onClick={join.back}>
|
|
425
|
+
{tr("forge.community_join_sheet.back")}
|
|
426
|
+
</button>
|
|
427
|
+
<button type="submit" disabled={join.isSubmitting} style={{ ...button, flex: 1 }}>
|
|
428
|
+
{submitLabel(join, tr, money)}
|
|
429
|
+
</button>
|
|
430
|
+
</div>
|
|
431
|
+
</form>
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
case "payment":
|
|
435
|
+
return (
|
|
436
|
+
<div className="fg:flex fg:flex-col fg:gap-3" data-testid="community-join-payment">
|
|
437
|
+
<p style={{ fontWeight: 700 }}>
|
|
438
|
+
{join.setupPurpose === "application"
|
|
439
|
+
? tr("forge.community_join_sheet.card_application")
|
|
440
|
+
: join.setupPurpose === "trial"
|
|
441
|
+
? tr("forge.community_join_sheet.card_trial")
|
|
442
|
+
: tr("forge.community_join_sheet.card_payment", { amount: money(join.amount) })}
|
|
443
|
+
{join.setupPurpose === "application" && (
|
|
444
|
+
<CallHelpHint label={tr("forge.community_join_sheet.card_application_help_label")}>
|
|
445
|
+
{tr("forge.community_join_sheet.card_application_help")}
|
|
446
|
+
</CallHelpHint>
|
|
447
|
+
)}
|
|
448
|
+
</p>
|
|
449
|
+
{join.isPaystack ? (
|
|
450
|
+
<PaystackPayButton onPay={join.openPaystackCheckout} label={tr("forge.community_join_sheet.pay", { amount: money(join.amount) })} />
|
|
451
|
+
) : (
|
|
452
|
+
join.clientSecret &&
|
|
453
|
+
renderPayment({
|
|
454
|
+
clientSecret: join.clientSecret,
|
|
455
|
+
returnUrl: join.returnUrl,
|
|
456
|
+
amount: join.amount,
|
|
457
|
+
currency,
|
|
458
|
+
mode: "manual",
|
|
459
|
+
trial: join.trial,
|
|
460
|
+
onSucceeded: () => void join.onPaymentSucceeded(),
|
|
461
|
+
onFailed: () => {},
|
|
462
|
+
})
|
|
463
|
+
)}
|
|
464
|
+
{join.error && <p role="alert" style={errorText}>{join.error}</p>}
|
|
465
|
+
<button type="button" style={ghostButton} onClick={join.back}>
|
|
466
|
+
{tr("forge.community_join_sheet.back")}
|
|
467
|
+
</button>
|
|
468
|
+
</div>
|
|
469
|
+
);
|
|
470
|
+
|
|
471
|
+
case "submitting":
|
|
472
|
+
return (
|
|
473
|
+
<div className="fg:flex fg:flex-col fg:items-center fg:gap-3" style={{ padding: 16 }}>
|
|
474
|
+
<Loading />
|
|
475
|
+
<p style={muted}>{tr("forge.community_join_sheet.joining")}</p>
|
|
476
|
+
</div>
|
|
477
|
+
);
|
|
478
|
+
|
|
479
|
+
case "pending":
|
|
480
|
+
return (
|
|
481
|
+
<div data-testid="community-join-pending" className="fg:flex fg:flex-col fg:gap-2">
|
|
482
|
+
<p style={{ fontWeight: 700 }}>{tr("forge.community_join_sheet.pending_title")}</p>
|
|
483
|
+
<p style={muted}>{tr("forge.community_join_sheet.pending_body")}</p>
|
|
484
|
+
</div>
|
|
485
|
+
);
|
|
486
|
+
|
|
487
|
+
case "joined":
|
|
488
|
+
return (
|
|
489
|
+
<div data-testid="community-join-joined" className="fg:flex fg:flex-col fg:gap-2">
|
|
490
|
+
<p style={{ fontWeight: 700 }}>
|
|
491
|
+
{join.alreadyMember ? tr("forge.community_join_sheet.already_member") : tr("forge.community_join_sheet.joined_title")}
|
|
492
|
+
</p>
|
|
493
|
+
<p style={muted}>{tr("forge.community_join_sheet.taking_you_inside")}</p>
|
|
494
|
+
</div>
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function TierOption({
|
|
500
|
+
tier,
|
|
501
|
+
selected,
|
|
502
|
+
onSelect,
|
|
503
|
+
t,
|
|
504
|
+
money,
|
|
505
|
+
}: {
|
|
506
|
+
tier: PublicTier;
|
|
507
|
+
selected: boolean;
|
|
508
|
+
onSelect: () => void;
|
|
509
|
+
t: ForgeT;
|
|
510
|
+
money: (amount: number) => string;
|
|
511
|
+
}) {
|
|
512
|
+
const { t: tokens, card } = useCommunityStyles();
|
|
513
|
+
return (
|
|
514
|
+
<button
|
|
515
|
+
type="button"
|
|
516
|
+
role="radio"
|
|
517
|
+
aria-checked={selected}
|
|
518
|
+
onClick={onSelect}
|
|
519
|
+
className="fg:flex fg:flex-col fg:gap-1 fg:text-left"
|
|
520
|
+
style={{ ...card, padding: 14, cursor: "pointer", font: "inherit", borderColor: selected ? tokens.primary : tokens.border }}
|
|
521
|
+
>
|
|
522
|
+
<span style={{ fontWeight: 700 }}>{tier.name}</span>
|
|
523
|
+
<span style={{ fontSize: 13, color: tokens.muted }}>{membershipPriceLabel(tier, t, money)}</span>
|
|
524
|
+
{!!tier.benefits?.length && (
|
|
525
|
+
<span style={{ fontSize: 13 }}>{tier.benefits.slice(0, 3).map((benefit) => benefit.title).join(", ")}</span>
|
|
526
|
+
)}
|
|
527
|
+
</button>
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
function cycleLabel(tier: PublicTier, cycle: BillingCycle, t: ForgeT, money: (amount: number) => string): string {
|
|
532
|
+
const amount = money(cycleFloor(tier, cycle));
|
|
533
|
+
if (cycleIsFree(tier, cycle)) return t(cycle === "month" ? "forge.community_join_sheet.monthly" : "forge.community_join_sheet.yearly");
|
|
534
|
+
return t(cycle === "month" ? "forge.community_join_sheet.monthly_price" : "forge.community_join_sheet.yearly_price", { amount });
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function submitLabel(join: Join, t: ForgeT, money: (amount: number) => string): string {
|
|
538
|
+
if (join.isSubmitting) return t("forge.community_join_sheet.working");
|
|
539
|
+
if (join.isApplication) return t("forge.community_join_sheet.apply");
|
|
540
|
+
if (join.isChange) return t("forge.community_join_sheet.change_tier");
|
|
541
|
+
if (join.isFreeCycle) return t("forge.community_join_sheet.join_free");
|
|
542
|
+
if (join.trialDays > 0) return t("forge.community_join_sheet.start_trial");
|
|
543
|
+
return t("forge.community_join_sheet.join_for", { amount: money(join.amount) });
|
|
544
|
+
}
|