From 23bc65670b80b7f8a6784302935d9867f2609deb Mon Sep 17 00:00:00 2001 From: Rishi Balakrishnan Date: Sat, 4 Apr 2026 22:51:59 -0400 Subject: [PATCH] add stripe checkout and support page --- .env.example | 4 + Dockerfile | 10 + package.json | 2 + src/Navigation.tsx | 6 + src/env/common.ts | 12 + src/lib/routes/types.ts | 1 + src/locale/locales/en/messages.po | 350 +++++++++++------- src/routes.ts | 1 + src/view/screens/Support.tsx | 71 ++-- src/view/screens/SupportReturn.tsx | 125 +++++++ src/view/screens/SupportStripeCheckout.tsx | 3 + .../screens/SupportStripeCheckout.web.tsx | 194 ++++++++++ src/view/shell/Drawer.tsx | 27 +- src/view/shell/desktop/LeftNav.tsx | 22 ++ src/view/shell/desktop/RightNav.tsx | 4 +- yarn.lock | 58 ++- 16 files changed, 717 insertions(+), 173 deletions(-) create mode 100644 src/view/screens/SupportReturn.tsx create mode 100644 src/view/screens/SupportStripeCheckout.tsx create mode 100644 src/view/screens/SupportStripeCheckout.web.tsx diff --git a/.env.example b/.env.example index df3456410..9da4457dd 100644 --- a/.env.example +++ b/.env.example @@ -46,3 +46,7 @@ GEOLOCATION_DEV_URL= # live-events web worker URL LIVE_EVENTS_DEV_URL= + +# Stripe +EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY= +EXPO_PUBLIC_STRIPE_API_URL= diff --git a/Dockerfile b/Dockerfile index f4234351c..7d57c0515 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,6 +60,14 @@ ENV EXPO_PUBLIC_GROWTHBOOK_API_HOST=${EXPO_PUBLIC_GROWTHBOOK_API_HOST:-${EXPO_PU ARG EXPO_PUBLIC_GROWTHBOOK_CLIENT_KEY ENV EXPO_PUBLIC_GROWTHBOOK_CLIENT_KEY=${EXPO_PUBLIC_GROWTHBOOK_CLIENT_KEY:-sdk-7gkUkGy9wguUjyFe} +# +# Stripe +# +ARG EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY +ENV EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY=$EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY +ARG EXPO_PUBLIC_STRIPE_API_URL +ENV EXPO_PUBLIC_STRIPE_API_URL=$EXPO_PUBLIC_STRIPE_API_URL + # # Copy everything into the container # @@ -88,6 +96,8 @@ RUN \. "$NVM_DIR/nvm.sh" && \ echo "EXPO_PUBLIC_METRICS_API_HOST=$EXPO_PUBLIC_METRICS_API_HOST" >> .env && \ echo "EXPO_PUBLIC_GROWTHBOOK_API_HOST=$EXPO_PUBLIC_GROWTHBOOK_API_HOST" >> .env && \ echo "EXPO_PUBLIC_GROWTHBOOK_CLIENT_KEY=$EXPO_PUBLIC_GROWTHBOOK_CLIENT_KEY" >> .env && \ + echo "EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY=$EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY" >> .env && \ + echo "EXPO_PUBLIC_STRIPE_API_URL=$EXPO_PUBLIC_STRIPE_API_URL" >> .env && \ npm install --global yarn && \ yarn && \ yarn intl:build 2>&1 | tee i18n.log && \ diff --git a/package.json b/package.json index ee0b80313..c8fd4e391 100644 --- a/package.json +++ b/package.json @@ -106,6 +106,8 @@ "@react-navigation/native": "^7.1.26", "@react-navigation/native-stack": "^7.9.0", "@sentry/react-native": "~6.20.0", + "@stripe/react-stripe-js": "^6.1.0", + "@stripe/stripe-js": "^9.0.1", "@tanstack/query-async-storage-persister": "^5.25.0", "@tanstack/react-query": "5.25.0", "@tanstack/react-query-persist-client": "^5.25.0", diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 919d35750..35d5cf500 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -68,6 +68,7 @@ import {ProfileScreen} from '#/view/screens/Profile' import {ProfileFeedLikedByScreen} from '#/view/screens/ProfileFeedLikedBy' import {StorybookScreen} from '#/view/screens/Storybook' import {SupportScreen} from '#/view/screens/Support' +import {SupportReturnScreen} from '#/view/screens/SupportReturn' import {TermsOfServiceScreen} from '#/view/screens/TermsOfService' import {BottomBar} from '#/view/shell/bottom-bar/BottomBar' import {createNativeStackNavigatorWithAuth} from '#/view/shell/createNativeStackNavigatorWithAuth' @@ -334,6 +335,11 @@ function commonScreens(Stack: typeof Flat, unreadCountLabel?: string) { getComponent={() => SupportScreen} options={{title: title(msg`Support`)}} /> + SupportReturnScreen} + options={{title: title(msg`Support`)}} + /> PrivacyPolicyScreen} diff --git a/src/env/common.ts b/src/env/common.ts index b751bb04a..66181f947 100644 --- a/src/env/common.ts +++ b/src/env/common.ts @@ -142,3 +142,15 @@ export const LIVE_EVENTS_PROD_URL = `https://live-events.workers.bsky.app` export const LIVE_EVENTS_URL = IS_DEV ? (LIVE_EVENTS_DEV_URL ?? LIVE_EVENTS_PROD_URL) : LIVE_EVENTS_PROD_URL + +/** + * Stripe publishable key for embedded checkout + */ +export const STRIPE_PUBLISHABLE_KEY: string = + process.env.EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY || '' + +/** + * Stripe API URL for creating checkout sessions + */ +export const STRIPE_API_URL: string = + process.env.EXPO_PUBLIC_STRIPE_API_URL || '' diff --git a/src/lib/routes/types.ts b/src/lib/routes/types.ts index 403aadaf1..4911406a8 100644 --- a/src/lib/routes/types.ts +++ b/src/lib/routes/types.ts @@ -38,6 +38,7 @@ export type CommonNavigatorParams = { SharedPreferencesTester: undefined Log: undefined Support: undefined + SupportReturn: {session_id?: string} PrivacyPolicy: undefined TermsOfService: undefined CommunityGuidelines: undefined diff --git a/src/locale/locales/en/messages.po b/src/locale/locales/en/messages.po index b3f4d305a..17dcaaa67 100644 --- a/src/locale/locales/en/messages.po +++ b/src/locale/locales/en/messages.po @@ -80,7 +80,7 @@ msgstr "" #: src/view/shell/bottom-bar/BottomBar.tsx:223 #: src/view/shell/bottom-bar/BottomBar.tsx:255 -#: src/view/shell/Drawer.tsx:517 +#: src/view/shell/Drawer.tsx:523 msgid "{0, plural, one {# unread item} other {# unread items}}" msgstr "" @@ -225,7 +225,7 @@ msgstr "" msgid "{0}s" msgstr "" -#: src/view/shell/desktop/LeftNav.tsx:456 +#: src/view/shell/desktop/LeftNav.tsx:460 msgid "{count, plural, one {# unread item} other {# unread items}}" msgstr "" @@ -485,11 +485,11 @@ msgctxt "feeds" msgid "<0>{0}, <1>{1}, and {2, plural, one {# other} other {# others}} are included in your starter pack" msgstr "" -#: src/view/shell/Drawer.tsx:119 +#: src/view/shell/Drawer.tsx:120 msgid "<0>{0} {1, plural, one {follower} other {followers}}" msgstr "" -#: src/view/shell/Drawer.tsx:130 +#: src/view/shell/Drawer.tsx:131 msgid "<0>{0} {1, plural, one {following} other {following}}" msgstr "" @@ -562,7 +562,7 @@ msgstr "" msgid "A screenshot of the post composer with a new button next to the post button that says \"Drafts\", with a rainbow firework effect. Below, the text in the composer reads \"Hey, did you hear the news? Blacksky has drafts now!!!\"." msgstr "" -#: src/Navigation.tsx:541 +#: src/Navigation.tsx:547 #: src/screens/Settings/AboutSettings.tsx:71 #: src/screens/Settings/Settings.tsx:256 #: src/screens/Settings/Settings.tsx:259 @@ -598,11 +598,11 @@ msgstr "" msgid "Accessibility" msgstr "" -#: src/Navigation.tsx:392 +#: src/Navigation.tsx:398 msgid "Accessibility Settings" msgstr "" -#: src/Navigation.tsx:408 +#: src/Navigation.tsx:414 #: src/screens/Login/LoginForm.tsx:76 #: src/screens/Settings/AccountSettings.tsx:64 #: src/screens/Settings/Settings.tsx:174 @@ -689,7 +689,7 @@ msgstr "" msgid "Activity from others" msgstr "" -#: src/Navigation.tsx:509 +#: src/Navigation.tsx:515 msgid "Activity notifications" msgstr "" @@ -744,8 +744,8 @@ msgstr "" #: src/screens/Settings/Settings.tsx:541 #: src/screens/Settings/Settings.tsx:544 -#: src/view/shell/desktop/LeftNav.tsx:262 #: src/view/shell/desktop/LeftNav.tsx:266 +#: src/view/shell/desktop/LeftNav.tsx:270 msgid "Add another account" msgstr "" @@ -1157,7 +1157,7 @@ msgstr "" msgid "Anyone who follows me" msgstr "" -#: src/Navigation.tsx:549 +#: src/Navigation.tsx:555 #: src/screens/Settings/AppIconSettings/index.tsx:62 #: src/screens/Settings/AppIconSettings/SettingsListItem.tsx:18 #: src/screens/Settings/AppIconSettings/SettingsListItem.tsx:23 @@ -1200,7 +1200,7 @@ msgstr "" msgid "App passwords" msgstr "" -#: src/Navigation.tsx:360 +#: src/Navigation.tsx:366 #: src/screens/Settings/AppPasswords.tsx:86 #: src/screens/Settings/AppPasswords.tsx:140 msgid "App Passwords" @@ -1242,7 +1242,7 @@ msgstr "" msgid "Appeal this decision" msgstr "" -#: src/Navigation.tsx:400 +#: src/Navigation.tsx:406 #: src/screens/Settings/AppearanceSettings.tsx:73 #: src/screens/Settings/Settings.tsx:224 #: src/screens/Settings/Settings.tsx:227 @@ -1362,6 +1362,11 @@ msgstr "" msgid "Back to Chats" msgstr "" +#: src/view/screens/SupportReturn.tsx:114 +#: src/view/screens/SupportReturn.tsx:120 +msgid "Back to Support" +msgstr "" + #: src/screens/Profile/Header/Shell.tsx:376 #: src/screens/Profile/Header/Shell.tsx:405 #: src/screens/Profile/Header/Shell.tsx:414 @@ -1407,7 +1412,7 @@ msgstr "" msgid "Before you can message another user, you must first verify your email." msgstr "" -#: src/view/shell/Drawer.tsx:367 +#: src/view/shell/Drawer.tsx:373 msgid "Begin Discussion" msgstr "" @@ -1525,7 +1530,7 @@ msgstr "" msgid "Blocked accounts" msgstr "" -#: src/Navigation.tsx:201 +#: src/Navigation.tsx:202 #: src/view/screens/ModerationBlockedAccounts.tsx:104 msgid "Blocked Accounts" msgstr "" @@ -1712,7 +1717,7 @@ msgstr "" #: src/view/com/composer/photos/EditImageDialog.web.tsx:43 #: src/view/com/composer/photos/EditImageDialog.web.tsx:52 #: src/view/com/modals/DeleteAccount.tsx:98 -#: src/view/shell/desktop/LeftNav.tsx:213 +#: src/view/shell/desktop/LeftNav.tsx:217 msgid "Cancel" msgstr "" @@ -1821,10 +1826,10 @@ msgid "Changes saved" msgstr "" #: src/lib/hooks/useNotificationHandler.ts:102 -#: src/Navigation.tsx:566 +#: src/Navigation.tsx:572 #: src/view/shell/bottom-bar/BottomBar.tsx:219 -#: src/view/shell/desktop/LeftNav.tsx:610 -#: src/view/shell/Drawer.tsx:485 +#: src/view/shell/desktop/LeftNav.tsx:614 +#: src/view/shell/Drawer.tsx:491 msgid "Chat" msgstr "" @@ -1847,7 +1852,7 @@ msgctxt "toast" msgid "Chat muted" msgstr "" -#: src/Navigation.tsx:576 +#: src/Navigation.tsx:582 #: src/screens/Messages/components/InboxPreview.tsx:22 msgid "Chat request inbox" msgstr "" @@ -1858,7 +1863,7 @@ msgid "Chat requests" msgstr "" #: src/components/dms/ConvoMenu.tsx:78 -#: src/Navigation.tsx:571 +#: src/Navigation.tsx:577 #: src/screens/Messages/ChatList.tsx:354 msgid "Chat settings" msgstr "" @@ -2108,7 +2113,7 @@ msgstr "" msgid "Comics" msgstr "" -#: src/Navigation.tsx:350 +#: src/Navigation.tsx:356 #: src/view/screens/CommunityGuidelines.tsx:37 msgid "Community Guidelines" msgstr "" @@ -2122,7 +2127,7 @@ msgid "Complete the challenge" msgstr "" #: src/view/com/feeds/ComposerPrompt.tsx:146 -#: src/view/shell/desktop/LeftNav.tsx:575 +#: src/view/shell/desktop/LeftNav.tsx:579 msgid "Compose new post" msgstr "" @@ -2206,7 +2211,7 @@ msgstr "" msgid "Content and media" msgstr "" -#: src/Navigation.tsx:525 +#: src/Navigation.tsx:531 msgid "Content and Media" msgstr "" @@ -2398,7 +2403,7 @@ msgstr "" msgid "Copy TXT record value" msgstr "" -#: src/Navigation.tsx:355 +#: src/Navigation.tsx:361 #: src/view/screens/CopyrightPolicy.tsx:34 msgid "Copyright Policy" msgstr "" @@ -2487,7 +2492,7 @@ msgstr "" #: src/components/StarterPack/ProfileStarterPacks.tsx:206 #: src/components/StarterPack/ProfileStarterPacks.tsx:315 -#: src/Navigation.tsx:606 +#: src/Navigation.tsx:612 msgid "Create a starter pack" msgstr "" @@ -2578,6 +2583,11 @@ msgstr "" msgid "Custom" msgstr "" +#: src/view/screens/SupportStripeCheckout.web.tsx:132 +#: src/view/screens/SupportStripeCheckout.web.tsx:139 +msgid "Custom amount" +msgstr "" + #: src/components/dialogs/Embed.tsx:144 msgid "Customization options" msgstr "" @@ -2897,7 +2907,7 @@ msgstr "" #: src/view/shell/desktop/RightNav.tsx:107 #: src/view/shell/desktop/RightNav.tsx:108 -#: src/view/shell/Drawer.tsx:374 +#: src/view/shell/Drawer.tsx:380 msgid "Discussion" msgstr "" @@ -2978,6 +2988,27 @@ msgstr "" msgid "Don't see an email? <0>Click here to resend." msgstr "" +#: src/view/screens/SupportStripeCheckout.web.tsx:100 +msgid "Donate ${0}" +msgstr "" + +#: src/view/screens/SupportStripeCheckout.web.tsx:99 +msgid "Donate ${0}/mo" +msgstr "" + +#: src/view/screens/Support.tsx:63 +#: src/view/screens/Support.tsx:64 +msgid "Donate on OpenCollective" +msgstr "" + +#: src/view/screens/SupportStripeCheckout.web.tsx:113 +msgid "Donate with Card" +msgstr "" + +#: src/view/screens/SupportStripeCheckout.web.tsx:159 +msgid "Donation frequency" +msgstr "" + #: src/components/contacts/components/InviteInfo.tsx:72 #: src/components/contacts/components/InviteInfo.tsx:78 #: src/components/contacts/screens/ViewMatches.tsx:394 @@ -3145,7 +3176,7 @@ msgstr "" msgid "Edit moderation list" msgstr "" -#: src/Navigation.tsx:365 +#: src/Navigation.tsx:371 #: src/view/screens/Feeds.tsx:519 msgid "Edit My Feeds" msgstr "" @@ -3187,7 +3218,7 @@ msgstr "" msgid "Edit who can reply" msgstr "" -#: src/Navigation.tsx:611 +#: src/Navigation.tsx:617 msgid "Edit your starter pack" msgstr "" @@ -3342,6 +3373,10 @@ msgstr "" msgid "Enter a word or tag" msgstr "" +#: src/view/screens/SupportStripeCheckout.web.tsx:146 +msgid "Enter amount" +msgstr "" + #: src/components/dialogs/EmailDialog/screens/Manage2FA/Disable.tsx:201 #: src/components/dialogs/EmailDialog/screens/Verify.tsx:320 #: src/screens/Settings/components/ChangePasswordDialog.tsx:63 @@ -3512,10 +3547,10 @@ msgstr "" msgid "Explicit sexual images." msgstr "" -#: src/Navigation.tsx:795 +#: src/Navigation.tsx:801 #: src/screens/Search/Shell.tsx:327 -#: src/view/shell/desktop/LeftNav.tsx:690 -#: src/view/shell/Drawer.tsx:433 +#: src/view/shell/desktop/LeftNav.tsx:694 +#: src/view/shell/Drawer.tsx:439 msgid "Explore" msgstr "" @@ -3552,7 +3587,7 @@ msgstr "" msgid "External media may allow websites to collect information about you and your device. No information is sent or requested until you press the \"play\" button." msgstr "" -#: src/Navigation.tsx:384 +#: src/Navigation.tsx:390 #: src/screens/Settings/ExternalMediaPreferences.tsx:34 msgid "External Media Preferences" msgstr "" @@ -3780,7 +3815,7 @@ msgstr "" msgid "False information about elections" msgstr "" -#: src/Navigation.tsx:300 +#: src/Navigation.tsx:301 msgid "Feed" msgstr "" @@ -3816,14 +3851,14 @@ msgctxt "toast" msgid "Feedback sent to feed operator" msgstr "" -#: src/Navigation.tsx:591 +#: src/Navigation.tsx:597 #: src/screens/SavedFeeds.tsx:108 #: src/screens/Search/SearchResults.tsx:79 #: src/screens/StarterPack/StarterPackScreen.tsx:193 #: src/view/screens/Feeds.tsx:512 #: src/view/screens/Profile.tsx:239 -#: src/view/shell/desktop/LeftNav.tsx:728 -#: src/view/shell/Drawer.tsx:549 +#: src/view/shell/desktop/LeftNav.tsx:732 +#: src/view/shell/Drawer.tsx:555 msgid "Feeds" msgstr "" @@ -3887,8 +3922,8 @@ msgstr "" msgid "Find accounts to follow" msgstr "" -#: src/Navigation.tsx:432 -#: src/Navigation.tsx:633 +#: src/Navigation.tsx:438 +#: src/Navigation.tsx:639 msgid "Find Contacts" msgstr "" @@ -4026,7 +4061,7 @@ msgstr "" msgid "Followed by <0>{0}, <1>{1}, and {2, plural, one {# other} other {# others}}" msgstr "" -#: src/Navigation.tsx:254 +#: src/Navigation.tsx:255 msgid "Followers of @{0} that you know" msgstr "" @@ -4069,7 +4104,7 @@ msgstr "" msgid "Following feed preferences" msgstr "" -#: src/Navigation.tsx:371 +#: src/Navigation.tsx:377 #: src/screens/Settings/FollowingFeedPreferences.tsx:56 msgid "Following Feed Preferences" msgstr "" @@ -4163,7 +4198,7 @@ msgstr "" msgid "Germ DM reconnected" msgstr "" -#: src/view/shell/Drawer.tsx:378 +#: src/view/shell/Drawer.tsx:384 msgid "Get help" msgstr "" @@ -4333,8 +4368,8 @@ msgid "Go to next" msgstr "" #: src/components/dms/ConvoMenu.tsx:241 -#: src/view/shell/desktop/LeftNav.tsx:317 -#: src/view/shell/desktop/LeftNav.tsx:323 +#: src/view/shell/desktop/LeftNav.tsx:321 +#: src/view/shell/desktop/LeftNav.tsx:327 msgid "Go to profile" msgstr "" @@ -4414,7 +4449,7 @@ msgstr "" msgid "Harming or endangering minors" msgstr "" -#: src/Navigation.tsx:556 +#: src/Navigation.tsx:562 msgid "Hashtag" msgstr "" @@ -4443,7 +4478,7 @@ msgstr "" #: src/screens/Settings/Settings.tsx:252 #: src/view/shell/desktop/RightNav.tsx:125 #: src/view/shell/desktop/RightNav.tsx:126 -#: src/view/shell/Drawer.tsx:387 +#: src/view/shell/Drawer.tsx:393 msgid "Help" msgstr "" @@ -4596,11 +4631,11 @@ msgstr "" msgid "Hold up! We’re gradually giving access to video, and you’re still waiting in line. Check back soon!" msgstr "" -#: src/Navigation.tsx:790 -#: src/Navigation.tsx:810 +#: src/Navigation.tsx:796 +#: src/Navigation.tsx:816 #: src/view/shell/bottom-bar/BottomBar.tsx:176 -#: src/view/shell/desktop/LeftNav.tsx:672 -#: src/view/shell/Drawer.tsx:459 +#: src/view/shell/desktop/LeftNav.tsx:676 +#: src/view/shell/Drawer.tsx:465 msgid "Home" msgstr "" @@ -4676,10 +4711,6 @@ msgstr "" msgid "If you have your own domain, you can use that as your handle. This lets you self-verify your identity. <0>Learn more here." msgstr "" -#: src/view/screens/Support.tsx:40 -msgid "If you need help, please email us at <0/>." -msgstr "" - #: src/components/dialogs/EmailDialog/screens/Verify.tsx:272 msgid "If you need to update your email, <0>click here." msgstr "" @@ -4960,7 +4991,7 @@ msgstr "" msgid "Labels on your content" msgstr "" -#: src/Navigation.tsx:227 +#: src/Navigation.tsx:228 msgid "Language Settings" msgstr "" @@ -5115,7 +5146,7 @@ msgstr "" msgid "Like 10 posts to train the Discover feed" msgstr "" -#: src/Navigation.tsx:469 +#: src/Navigation.tsx:475 msgid "Like notifications" msgstr "" @@ -5127,8 +5158,8 @@ msgstr "" msgid "Like this labeler" msgstr "" -#: src/Navigation.tsx:305 -#: src/Navigation.tsx:310 +#: src/Navigation.tsx:306 +#: src/Navigation.tsx:311 msgid "Liked by" msgstr "" @@ -5163,7 +5194,7 @@ msgstr "" msgid "Likes of your reposts" msgstr "" -#: src/Navigation.tsx:493 +#: src/Navigation.tsx:499 msgid "Likes of your reposts notifications" msgstr "" @@ -5176,7 +5207,7 @@ msgstr "" msgid "Linear" msgstr "" -#: src/Navigation.tsx:260 +#: src/Navigation.tsx:261 msgid "List" msgstr "" @@ -5256,12 +5287,12 @@ msgctxt "toast" msgid "List unmuted" msgstr "" -#: src/Navigation.tsx:181 +#: src/Navigation.tsx:182 #: src/view/screens/Lists.tsx:67 #: src/view/screens/Profile.tsx:233 #: src/view/screens/Profile.tsx:241 -#: src/view/shell/desktop/LeftNav.tsx:746 -#: src/view/shell/Drawer.tsx:564 +#: src/view/shell/desktop/LeftNav.tsx:750 +#: src/view/shell/Drawer.tsx:570 msgid "Lists" msgstr "" @@ -5333,10 +5364,11 @@ msgstr "" #: src/components/Post/Embed/index.tsx:237 #: src/view/com/composer/text-input/mobile/Autocomplete.tsx:61 +#: src/view/screens/SupportReturn.tsx:80 msgid "Loading..." msgstr "" -#: src/Navigation.tsx:330 +#: src/Navigation.tsx:331 msgid "Log" msgstr "" @@ -5353,7 +5385,7 @@ msgstr "" msgid "Login" msgstr "" -#: src/view/shell/Drawer.tsx:728 +#: src/view/shell/Drawer.tsx:747 msgid "Logo by <0>@sawaratsuki.bsky.social" msgstr "" @@ -5418,6 +5450,10 @@ msgstr "" msgid "Marked all as read" msgstr "" +#: src/view/screens/SupportStripeCheckout.web.tsx:44 +msgid "Maximum donation is $1,000" +msgstr "" + #: src/components/dialogs/EmailDialog/screens/VerificationReminder.tsx:90 #: src/components/dialogs/EmailDialog/screens/VerificationReminder.tsx:97 msgid "Maybe later" @@ -5440,7 +5476,7 @@ msgstr "" msgid "Media that may be disturbing or inappropriate for some audiences." msgstr "" -#: src/Navigation.tsx:453 +#: src/Navigation.tsx:459 msgid "Mention notifications" msgstr "" @@ -5493,7 +5529,7 @@ msgstr "" msgid "Message options" msgstr "" -#: src/Navigation.tsx:805 +#: src/Navigation.tsx:811 msgid "Messages" msgstr "" @@ -5501,11 +5537,15 @@ msgstr "" msgid "Migrating from Bluesky? Use <0>move.blacksky.community to move your followers, posts, and media to Blacksky." msgstr "" +#: src/view/screens/SupportStripeCheckout.web.tsx:43 +msgid "Minimum donation is $5" +msgstr "" + #: src/components/moderation/ReportDialog/utils/useReportOptions.ts:177 msgid "Minor harassment or bullying" msgstr "" -#: src/Navigation.tsx:517 +#: src/Navigation.tsx:523 msgid "Miscellaneous notifications" msgstr "" @@ -5517,7 +5557,7 @@ msgstr "" msgid "Missing media" msgstr "" -#: src/Navigation.tsx:186 +#: src/Navigation.tsx:187 #: src/screens/Moderation/index.tsx:94 #: src/screens/Settings/Settings.tsx:188 #: src/screens/Settings/Settings.tsx:191 @@ -5556,7 +5596,7 @@ msgstr "" msgid "Moderation lists" msgstr "" -#: src/Navigation.tsx:191 +#: src/Navigation.tsx:192 #: src/view/screens/ModerationModlists.tsx:67 msgid "Moderation Lists" msgstr "" @@ -5565,7 +5605,7 @@ msgstr "" msgid "moderation settings" msgstr "" -#: src/Navigation.tsx:320 +#: src/Navigation.tsx:321 msgid "Moderation states" msgstr "" @@ -5578,6 +5618,11 @@ msgstr "" msgid "Moderator has chosen to set a general warning on the content." msgstr "" +#: src/view/screens/SupportStripeCheckout.web.tsx:168 +#: src/view/screens/SupportStripeCheckout.web.tsx:170 +msgid "Monthly" +msgstr "" + #: src/view/shell/desktop/Feeds.tsx:106 #: src/view/shell/desktop/Feeds.tsx:153 msgid "More feeds" @@ -5693,7 +5738,7 @@ msgstr "" msgid "Muted accounts" msgstr "" -#: src/Navigation.tsx:196 +#: src/Navigation.tsx:197 #: src/view/screens/ModerationMutedAccounts.tsx:116 msgid "Muted Accounts" msgstr "" @@ -5744,7 +5789,7 @@ msgstr "" msgid "Navigates to the next screen" msgstr "" -#: src/view/shell/Drawer.tsx:80 +#: src/view/shell/Drawer.tsx:81 msgid "Navigates to your profile" msgstr "" @@ -5790,7 +5835,7 @@ msgstr "" msgid "New Feature" msgstr "" -#: src/Navigation.tsx:485 +#: src/Navigation.tsx:491 msgid "New follower notifications" msgstr "" @@ -5835,7 +5880,7 @@ msgctxt "action" msgid "New post" msgstr "" -#: src/view/shell/desktop/LeftNav.tsx:583 +#: src/view/shell/desktop/LeftNav.tsx:587 msgctxt "action" msgid "New Post" msgstr "" @@ -6095,7 +6140,7 @@ msgstr "" msgid "Not followed by anyone you're following" msgstr "" -#: src/Navigation.tsx:176 +#: src/Navigation.tsx:177 #: src/view/screens/Profile.tsx:132 msgid "Not Found" msgstr "" @@ -6125,8 +6170,8 @@ msgstr "" msgid "Nothing saved yet" msgstr "" -#: src/Navigation.tsx:439 -#: src/Navigation.tsx:586 +#: src/Navigation.tsx:445 +#: src/Navigation.tsx:592 #: src/view/screens/Notifications.tsx:135 msgid "Notification settings" msgstr "" @@ -6139,8 +6184,8 @@ msgstr "" msgid "Notification Sounds" msgstr "" -#: src/Navigation.tsx:581 -#: src/Navigation.tsx:800 +#: src/Navigation.tsx:587 +#: src/Navigation.tsx:806 #: src/screens/Notifications/ActivityList.tsx:30 #: src/screens/Settings/NotificationSettings/ActivityNotificationSettings.tsx:90 #: src/screens/Settings/NotificationSettings/index.tsx:92 @@ -6157,8 +6202,8 @@ msgstr "" #: src/screens/Settings/Settings.tsx:199 #: src/view/screens/Notifications.tsx:129 #: src/view/shell/bottom-bar/BottomBar.tsx:250 -#: src/view/shell/desktop/LeftNav.tsx:709 -#: src/view/shell/Drawer.tsx:512 +#: src/view/shell/desktop/LeftNav.tsx:713 +#: src/view/shell/Drawer.tsx:518 msgid "Notifications" msgstr "" @@ -6248,6 +6293,11 @@ msgstr "" msgid "One or more videos is missing alt text." msgstr "" +#: src/view/screens/SupportStripeCheckout.web.tsx:163 +#: src/view/screens/SupportStripeCheckout.web.tsx:165 +msgid "One-time" +msgstr "" + #: src/screens/Onboarding/StepProfile/index.tsx:118 msgid "Only .jpg and .png files are supported" msgstr "" @@ -6385,6 +6435,10 @@ msgstr "" msgid "Open system log" msgstr "" +#: src/view/screens/Support.tsx:52 +msgid "OpenCollective" +msgstr "" + #: src/view/shell/desktop/Feeds.tsx:185 msgid "Opens {0} feed" msgstr "" @@ -6623,11 +6677,11 @@ msgstr "" msgid "People" msgstr "" -#: src/Navigation.tsx:247 +#: src/Navigation.tsx:248 msgid "People followed by @{0}" msgstr "" -#: src/Navigation.tsx:240 +#: src/Navigation.tsx:241 msgid "People following @{0}" msgstr "" @@ -6803,6 +6857,10 @@ msgstr "" msgid "Please enter a valid email address." msgstr "" +#: src/view/screens/SupportStripeCheckout.web.tsx:42 +msgid "Please enter a valid number" +msgstr "" + #: src/components/dialogs/MutedWords.tsx:86 msgid "Please enter a valid word, tag, or phrase to mute" msgstr "" @@ -6945,10 +7003,10 @@ msgstr "" msgid "Post blocked" msgstr "" -#: src/Navigation.tsx:273 -#: src/Navigation.tsx:280 -#: src/Navigation.tsx:287 -#: src/Navigation.tsx:294 +#: src/Navigation.tsx:274 +#: src/Navigation.tsx:281 +#: src/Navigation.tsx:288 +#: src/Navigation.tsx:295 msgid "Post by @{0}" msgstr "" @@ -6982,7 +7040,7 @@ msgstr "" msgid "Post interaction settings" msgstr "" -#: src/Navigation.tsx:207 +#: src/Navigation.tsx:208 #: src/screens/ModerationInteractionSettings/index.tsx:34 msgid "Post Interaction Settings" msgstr "" @@ -7082,8 +7140,8 @@ msgstr "" msgid "Privacy and security" msgstr "" -#: src/Navigation.tsx:416 -#: src/Navigation.tsx:424 +#: src/Navigation.tsx:422 +#: src/Navigation.tsx:430 #: src/screens/Settings/ActivityPrivacySettings.tsx:40 #: src/screens/Settings/PrivacyAndSecuritySettings.tsx:48 msgid "Privacy and Security" @@ -7094,12 +7152,12 @@ msgstr "" msgid "Privacy and Security settings" msgstr "" -#: src/Navigation.tsx:340 +#: src/Navigation.tsx:346 #: src/screens/Settings/AboutSettings.tsx:88 #: src/screens/Settings/AboutSettings.tsx:91 #: src/view/screens/PrivacyPolicy.tsx:34 -#: src/view/shell/Drawer.tsx:723 -#: src/view/shell/Drawer.tsx:724 +#: src/view/shell/Drawer.tsx:742 +#: src/view/shell/Drawer.tsx:743 msgid "Privacy Policy" msgstr "" @@ -7117,6 +7175,7 @@ msgstr "" #: src/lib/api/index.ts:60 #: src/screens/Login/ForgotPasswordForm.tsx:150 +#: src/view/screens/SupportStripeCheckout.web.tsx:189 msgid "Processing..." msgstr "" @@ -7126,9 +7185,9 @@ msgid "profile" msgstr "" #: src/view/shell/bottom-bar/BottomBar.tsx:293 -#: src/view/shell/desktop/LeftNav.tsx:787 -#: src/view/shell/Drawer.tsx:79 -#: src/view/shell/Drawer.tsx:615 +#: src/view/shell/desktop/LeftNav.tsx:791 +#: src/view/shell/Drawer.tsx:80 +#: src/view/shell/Drawer.tsx:621 msgid "Profile" msgstr "" @@ -7206,7 +7265,7 @@ msgstr "" msgid "QR code saved to your camera roll!" msgstr "" -#: src/Navigation.tsx:461 +#: src/Navigation.tsx:467 msgid "Quote notifications" msgstr "" @@ -7582,7 +7641,7 @@ msgstr "" msgid "Reply Hidden by You" msgstr "" -#: src/Navigation.tsx:445 +#: src/Navigation.tsx:451 msgid "Reply notifications" msgstr "" @@ -7703,7 +7762,7 @@ msgstr "" msgid "Repost ({0, plural, one {# repost} other {# reposts}})" msgstr "" -#: src/Navigation.tsx:477 +#: src/Navigation.tsx:483 msgid "Repost notifications" msgstr "" @@ -7744,7 +7803,7 @@ msgstr "" msgid "Reposts of your reposts" msgstr "" -#: src/Navigation.tsx:501 +#: src/Navigation.tsx:507 msgid "Reposts of your reposts notifications" msgstr "" @@ -7953,8 +8012,8 @@ msgstr "" msgid "Save to my feeds" msgstr "" -#: src/view/shell/desktop/LeftNav.tsx:765 -#: src/view/shell/Drawer.tsx:590 +#: src/view/shell/desktop/LeftNav.tsx:769 +#: src/view/shell/Drawer.tsx:596 msgctxt "link to bookmarks screen" msgid "Saved" msgstr "" @@ -7963,7 +8022,7 @@ msgstr "" msgid "Saved Feeds" msgstr "" -#: src/Navigation.tsx:625 +#: src/Navigation.tsx:631 #: src/screens/Bookmarks/index.tsx:61 msgid "Saved Posts" msgstr "" @@ -8009,7 +8068,7 @@ msgstr "" msgid "Search" msgstr "" -#: src/Navigation.tsx:266 +#: src/Navigation.tsx:267 #: src/screens/Profile/ProfileSearch.tsx:37 msgid "Search @{0}'s posts" msgstr "" @@ -8400,10 +8459,10 @@ msgstr "" msgid "Sets email for password reset" msgstr "" -#: src/Navigation.tsx:222 +#: src/Navigation.tsx:223 #: src/screens/Settings/Settings.tsx:101 -#: src/view/shell/desktop/LeftNav.tsx:805 -#: src/view/shell/Drawer.tsx:628 +#: src/view/shell/desktop/LeftNav.tsx:809 +#: src/view/shell/Drawer.tsx:634 msgid "Settings" msgstr "" @@ -8545,7 +8604,7 @@ msgstr "" msgid "Share your favorite feed!" msgstr "" -#: src/Navigation.tsx:325 +#: src/Navigation.tsx:326 msgid "Shared Preferences Tester" msgstr "" @@ -8723,9 +8782,9 @@ msgstr "" #: src/screens/SignupQueued.tsx:93 #: src/screens/SignupQueued.tsx:96 #: src/screens/Takendown.tsx:87 -#: src/view/shell/desktop/LeftNav.tsx:212 -#: src/view/shell/desktop/LeftNav.tsx:269 -#: src/view/shell/desktop/LeftNav.tsx:272 +#: src/view/shell/desktop/LeftNav.tsx:216 +#: src/view/shell/desktop/LeftNav.tsx:273 +#: src/view/shell/desktop/LeftNav.tsx:276 msgid "Sign out" msgstr "" @@ -8734,7 +8793,7 @@ msgid "Sign Out" msgstr "" #: src/screens/Settings/Settings.tsx:297 -#: src/view/shell/desktop/LeftNav.tsx:209 +#: src/view/shell/desktop/LeftNav.tsx:213 msgid "Sign out?" msgstr "" @@ -8748,7 +8807,7 @@ msgstr "" msgid "Signed in as @{0}" msgstr "" -#: src/Navigation.tsx:171 +#: src/Navigation.tsx:172 msgid "Signing in..." msgstr "" @@ -8848,6 +8907,8 @@ msgid "Something went wrong. Please try again in a moment." msgstr "" #: src/components/moderation/ReportDialog/index.tsx:231 +#: src/view/screens/SupportReturn.tsx:107 +#: src/view/screens/SupportStripeCheckout.web.tsx:76 msgid "Something went wrong. Please try again." msgstr "" @@ -8916,8 +8977,8 @@ msgstr "" msgid "Start chat with {displayName}" msgstr "" -#: src/Navigation.tsx:596 -#: src/Navigation.tsx:601 +#: src/Navigation.tsx:602 +#: src/Navigation.tsx:607 #: src/screens/StarterPack/Wizard/index.tsx:207 msgid "Starter Pack" msgstr "" @@ -8972,7 +9033,7 @@ msgstr "" msgid "Stored as part of a secure code for matching with others" msgstr "" -#: src/Navigation.tsx:315 +#: src/Navigation.tsx:316 #: src/screens/Settings/Settings.tsx:457 msgid "Storybook" msgstr "" @@ -9043,9 +9104,12 @@ msgstr "" msgid "Suggestive" msgstr "" -#: src/Navigation.tsx:335 -#: src/view/screens/Support.tsx:34 -#: src/view/screens/Support.tsx:37 +#: src/Navigation.tsx:336 +#: src/Navigation.tsx:341 +#: src/view/screens/Support.tsx:36 +#: src/view/screens/SupportReturn.tsx:71 +#: src/view/shell/desktop/LeftNav.tsx:827 +#: src/view/shell/Drawer.tsx:647 msgid "Support" msgstr "" @@ -9053,21 +9117,21 @@ msgstr "" msgid "Support for this feature in your country has not been enabled yet! Please check back later." msgstr "" +#: src/view/screens/Support.tsx:55 +msgid "Support the Blacksky community through OpenCollective. Your contributions help us maintain and improve the platform." +msgstr "" + #: src/view/shell/desktop/RightNav.tsx:99 #: src/view/shell/desktop/RightNav.tsx:100 -#: src/view/shell/Drawer.tsx:391 -#: src/view/shell/Drawer.tsx:400 +#: src/view/shell/Drawer.tsx:397 +#: src/view/shell/Drawer.tsx:406 msgid "Support Us" msgstr "" -#: src/view/screens/Support.tsx:44 -msgid "support@blacksky.app" -msgstr "" - #: src/screens/Settings/Settings.tsx:123 #: src/screens/Settings/Settings.tsx:137 #: src/screens/Settings/Settings.tsx:581 -#: src/view/shell/desktop/LeftNav.tsx:247 +#: src/view/shell/desktop/LeftNav.tsx:251 msgid "Switch account" msgstr "" @@ -9076,11 +9140,11 @@ msgstr "" msgid "Switch Account" msgstr "" -#: src/view/shell/desktop/LeftNav.tsx:110 +#: src/view/shell/desktop/LeftNav.tsx:114 msgid "Switch accounts" msgstr "" -#: src/view/shell/desktop/LeftNav.tsx:346 +#: src/view/shell/desktop/LeftNav.tsx:350 msgid "Switch to {0}" msgstr "" @@ -9159,12 +9223,12 @@ msgid "Terms" msgstr "" #: src/components/dialogs/BirthDateSettings.tsx:169 -#: src/Navigation.tsx:345 +#: src/Navigation.tsx:351 #: src/screens/Settings/AboutSettings.tsx:80 #: src/screens/Settings/AboutSettings.tsx:83 #: src/view/screens/TermsOfService.tsx:34 -#: src/view/shell/Drawer.tsx:716 -#: src/view/shell/Drawer.tsx:718 +#: src/view/shell/Drawer.tsx:735 +#: src/view/shell/Drawer.tsx:737 msgid "Terms of Service" msgstr "" @@ -9182,6 +9246,10 @@ msgstr "" msgid "Thank you for your feedback! It has been sent to the feed operator." msgstr "" +#: src/view/screens/SupportReturn.tsx:85 +msgid "Thank you for your support!" +msgstr "" + #: src/components/intents/VerifyEmailIntentDialog.tsx:76 msgid "Thanks, you have successfully verified your email address. You can close this dialog." msgstr "" @@ -9714,7 +9782,7 @@ msgstr "" msgid "Threaded" msgstr "" -#: src/Navigation.tsx:378 +#: src/Navigation.tsx:384 msgid "Threads Preferences" msgstr "" @@ -9776,7 +9844,7 @@ msgstr "" msgid "Top replies first" msgstr "" -#: src/Navigation.tsx:561 +#: src/Navigation.tsx:567 msgid "Topic" msgstr "" @@ -10295,7 +10363,7 @@ msgstr "" msgid "Verification settings" msgstr "" -#: src/Navigation.tsx:215 +#: src/Navigation.tsx:216 #: src/screens/Moderation/VerificationSettings.tsx:33 msgid "Verification Settings" msgstr "" @@ -10375,7 +10443,7 @@ msgstr "" msgid "Video failed to process" msgstr "" -#: src/Navigation.tsx:617 +#: src/Navigation.tsx:623 msgid "Video Feed" msgstr "" @@ -11177,7 +11245,7 @@ msgid "You reacted {0} to {1}" msgstr "" #: src/screens/Settings/Settings.tsx:298 -#: src/view/shell/desktop/LeftNav.tsx:210 +#: src/view/shell/desktop/LeftNav.tsx:214 msgid "You will be signed out of all your accounts." msgstr "" @@ -11355,6 +11423,10 @@ msgstr "" msgid "Your current handle <0>{0} will automatically remain reserved for you. You can switch back to it at any time from this account." msgstr "" +#: src/view/screens/SupportReturn.tsx:93 +msgid "Your donation helps us maintain and improve the Blacksky community." +msgstr "" + #: src/screens/Login/ForgotPasswordForm.tsx:52 #: src/screens/Settings/components/ChangePasswordDialog.tsx:81 #: src/screens/Signup/state.ts:284 @@ -11382,7 +11454,7 @@ msgstr "" msgid "Your full handle will be <0>@{0}" msgstr "" -#: src/Navigation.tsx:533 +#: src/Navigation.tsx:539 #: src/screens/Search/modules/ExploreInterestsCard.tsx:67 #: src/screens/Settings/ContentAndMediaSettings.tsx:93 #: src/screens/Settings/ContentAndMediaSettings.tsx:96 @@ -11415,6 +11487,10 @@ msgstr "" msgid "Your password must be at least 8 characters long." msgstr "" +#: src/view/screens/SupportReturn.tsx:101 +msgid "Your payment is still being processed. Please check back later." +msgstr "" + #: src/view/com/composer/Composer.tsx:970 msgid "Your post was sent" msgstr "" diff --git a/src/routes.ts b/src/routes.ts index 7b6279500..2da95d01b 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -73,6 +73,7 @@ export const router = new Router({ FindContactsSettings: '/settings/find-contacts', // support Support: '/support', + SupportReturn: '/return', PrivacyPolicy: '/support/privacy', TermsOfService: '/support/tos', CommunityGuidelines: '/support/community-guidelines', diff --git a/src/view/screens/Support.tsx b/src/view/screens/Support.tsx index 4b9920027..9aa810e28 100644 --- a/src/view/screens/Support.tsx +++ b/src/view/screens/Support.tsx @@ -1,27 +1,25 @@ import React from 'react' +import {View} from 'react-native' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useFocusEffect} from '@react-navigation/native' -import {HELP_DESK_URL} from '#/lib/constants' -import {usePalette} from '#/lib/hooks/usePalette' import { type CommonNavigatorParams, type NativeStackScreenProps, } from '#/lib/routes/types' -import {s} from '#/lib/styles' import {useSetMinimalShellMode} from '#/state/shell' -import {TextLink} from '#/view/com/util/Link' -import {Text} from '#/view/com/util/text/Text' -import {ViewHeader} from '#/view/com/util/ViewHeader' -import {CenteredView} from '#/view/com/util/Views' +import {atoms as a, useTheme} from '#/alf' import * as Layout from '#/components/Layout' +import {InlineLinkText} from '#/components/Link' +import {Text} from '#/components/Typography' +import {SupportStripeCheckout} from './SupportStripeCheckout' type Props = NativeStackScreenProps export const SupportScreen = (_props: Props) => { - const pal = usePalette('default') const setMinimalShellMode = useSetMinimalShellMode() const {_} = useLingui() + const t = useTheme() useFocusEffect( React.useCallback(() => { @@ -31,23 +29,46 @@ export const SupportScreen = (_props: Props) => { return ( - - - - Support - - - - If you need help, please email us at{' '} - - . - - - + + + + + Support + + + + + + + + + OpenCollective + + + + Support the Blacksky community through OpenCollective. Your + contributions help us maintain and improve the platform. + + + + + Donate on OpenCollective + + + + + + + ) } diff --git a/src/view/screens/SupportReturn.tsx b/src/view/screens/SupportReturn.tsx new file mode 100644 index 000000000..46b6d5d3f --- /dev/null +++ b/src/view/screens/SupportReturn.tsx @@ -0,0 +1,125 @@ +import React, {useEffect, useState} from 'react' +import {View} from 'react-native' +import {msg, Trans} from '@lingui/macro' +import {useLingui} from '@lingui/react' +import {useFocusEffect, useNavigation} from '@react-navigation/native' + +import { + type CommonNavigatorParams, + type NativeStackScreenProps, + type NavigationProp, +} from '#/lib/routes/types' +import {useSetMinimalShellMode} from '#/state/shell' +import {atoms as a, useTheme} from '#/alf' +import {Button, ButtonText} from '#/components/Button' +import * as Layout from '#/components/Layout' +import {Text} from '#/components/Typography' +import {IS_WEB} from '#/env' +import {STRIPE_API_URL} from '#/env/common' + +type Props = NativeStackScreenProps +export const SupportReturnScreen = (_props: Props) => { + const setMinimalShellMode = useSetMinimalShellMode() + const {_} = useLingui() + const t = useTheme() + const navigation = useNavigation() + const [status, setStatus] = useState(null) + const [loading, setLoading] = useState(true) + + useFocusEffect( + React.useCallback(() => { + setMinimalShellMode(false) + }, [setMinimalShellMode]), + ) + + useEffect(() => { + if (!IS_WEB || !STRIPE_API_URL) { + setLoading(false) + return + } + + const params = new URLSearchParams(window.location.search) + const sessionId = params.get('session_id') + if (!sessionId) { + setLoading(false) + return + } + + fetch(`${STRIPE_API_URL}/session-status?session_id=${sessionId}`) + .then(res => res.json()) + .then(data => { + setStatus(data.status) + }) + .catch(() => { + setStatus('error') + }) + .finally(() => { + setLoading(false) + }) + }, []) + + const handleBackToHome = React.useCallback(() => { + navigation.navigate('Home') + }, [navigation]) + + return ( + + + + + + Support + + + + + + + {loading ? ( + + Loading... + + ) : status === 'complete' ? ( + <> + + Thank you for your support! + + + + Your donation helps us maintain and improve the Blacksky + community. + + + + ) : status === 'open' ? ( + + + Your payment is still being processed. Please check back later. + + + ) : ( + + Something went wrong. Please try again. + + )} + + + + + + ) +} diff --git a/src/view/screens/SupportStripeCheckout.tsx b/src/view/screens/SupportStripeCheckout.tsx new file mode 100644 index 000000000..91f4da6d2 --- /dev/null +++ b/src/view/screens/SupportStripeCheckout.tsx @@ -0,0 +1,3 @@ +export function SupportStripeCheckout() { + return null +} diff --git a/src/view/screens/SupportStripeCheckout.web.tsx b/src/view/screens/SupportStripeCheckout.web.tsx new file mode 100644 index 000000000..cf038c048 --- /dev/null +++ b/src/view/screens/SupportStripeCheckout.web.tsx @@ -0,0 +1,194 @@ +import React, {useCallback, useMemo, useState} from 'react' +import {View} from 'react-native' +import {msg, Trans} from '@lingui/macro' +import {useLingui} from '@lingui/react' +import { + EmbeddedCheckout, + EmbeddedCheckoutProvider, +} from '@stripe/react-stripe-js' +import {loadStripe} from '@stripe/stripe-js' + +import {atoms as a, useTheme} from '#/alf' +import {Button, ButtonText} from '#/components/Button' +import * as SegmentedControl from '#/components/forms/SegmentedControl' +import * as TextField from '#/components/forms/TextField' +import {Text} from '#/components/Typography' +import {STRIPE_API_URL, STRIPE_PUBLISHABLE_KEY} from '#/env/common' + +const stripePromise = STRIPE_PUBLISHABLE_KEY + ? loadStripe(STRIPE_PUBLISHABLE_KEY) + : null + +const PRESET_AMOUNTS = [5, 10, 25, 50] + +export function SupportStripeCheckout() { + const {_} = useLingui() + const t = useTheme() + const [amount, setAmount] = useState('7') + const [recurring, setRecurring] = useState(false) + const [clientSecret, setClientSecret] = useState(null) + const [error, setError] = useState(null) + const [loading, setLoading] = useState(false) + + const parsedAmount = useMemo(() => { + const num = parseFloat(amount) + return isNaN(num) ? 0 : num + }, [amount]) + + const isValid = parsedAmount >= 5 && parsedAmount <= 1000 + + const validationError = useMemo(() => { + if (!amount) return null + if (isNaN(parseFloat(amount))) return _(msg`Please enter a valid number`) + if (parsedAmount < 5) return _(msg`Minimum donation is $5`) + if (parsedAmount > 1000) return _(msg`Maximum donation is $1,000`) + return null + }, [amount, parsedAmount, _]) + + const handlePresetPress = useCallback((value: number) => { + setAmount(String(value)) + setError(null) + }, []) + + const handleFrequencyChange = useCallback((value: string) => { + setRecurring(value === 'monthly') + }, []) + + const handleSubmit = useCallback(async () => { + if (!isValid || !STRIPE_API_URL) return + setLoading(true) + setError(null) + try { + const res = await fetch(`${STRIPE_API_URL}/create-checkout-session`, { + method: 'POST', + headers: {'Content-Type': 'application/json'}, + body: JSON.stringify({ + amount: Math.round(parsedAmount * 100), + recurring, + }), + }) + if (!res.ok) { + throw new Error('Failed to create checkout session') + } + const data = await res.json() + setClientSecret(data.clientSecret) + } catch (e: any) { + setError(e.message || _(msg`Something went wrong. Please try again.`)) + } finally { + setLoading(false) + } + }, [isValid, parsedAmount, recurring, _]) + + if (!STRIPE_PUBLISHABLE_KEY || !STRIPE_API_URL) { + return null + } + + if (clientSecret && stripePromise) { + return ( + + + + + + ) + } + + const buttonLabel = recurring + ? _(msg`Donate $${parsedAmount.toFixed(2)}/mo`) + : _(msg`Donate $${parsedAmount.toFixed(2)}`) + + return ( + + + Donate with Card + + + + {PRESET_AMOUNTS.map(preset => ( + + ))} + + + + + Custom amount + + + $ + + + { + setAmount(text) + setError(null) + }} + keyboardType="numeric" + placeholder={_(msg`Enter amount`)} + /> + + + + {validationError && ( + + {validationError} + + )} + + + + + + One-time + + + + + Monthly + + + + + {error && ( + + {error} + + )} + + + + ) +} diff --git a/src/view/shell/Drawer.tsx b/src/view/shell/Drawer.tsx index 9dc2cfc85..0af508998 100644 --- a/src/view/shell/Drawer.tsx +++ b/src/view/shell/Drawer.tsx @@ -35,6 +35,7 @@ import { Hashtag_Filled_Corner0_Rounded as HashtagFilled, Hashtag_Stroke2_Corner0_Rounded as Hashtag, } from '#/components/icons/Hashtag' +import {Heart2_Stroke2_Corner0_Rounded as Heart} from '#/components/icons/Heart2' import { HomeOpen_Filled_Corner0_Rounded as HomeFilled, HomeOpen_Stoke2_Corner0_Rounded as Home, @@ -253,11 +254,15 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => { Linking.openURL(HELP_DESK_URL) }, []) + const onPressSupport = React.useCallback(() => { + navigation.navigate('Support') + setDrawerOpen(false) + }, [navigation, setDrawerOpen]) + const onPressContribute = React.useCallback(() => { - Linking.openURL( - 'https://opencollective.com/blacksky/contribute/backer-59760/checkout', - ) - }, []) + navigation.navigate('Support') + setDrawerOpen(false) + }, [navigation, setDrawerOpen]) // rendering // = @@ -311,6 +316,7 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => { onPress={onPressProfile} /> + ) : ( <> @@ -632,6 +638,19 @@ let SettingsMenuItem = ({onPress}: {onPress: () => void}): React.ReactNode => { } SettingsMenuItem = React.memo(SettingsMenuItem) +let SupportMenuItem = ({onPress}: {onPress: () => void}): React.ReactNode => { + const {_} = useLingui() + const t = useTheme() + return ( + } + label={_(msg`Support`)} + onPress={onPress} + /> + ) +} +SupportMenuItem = React.memo(SupportMenuItem) + function MenuItem({icon, label, count, bold, onPress}: MenuItemProps) { const t = useTheme() return ( diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index 1a5d9c9bf..feff7d9bc 100644 --- a/src/view/shell/desktop/LeftNav.tsx +++ b/src/view/shell/desktop/LeftNav.tsx @@ -49,6 +49,10 @@ import { Hashtag_Filled_Corner0_Rounded as HashtagFilled, Hashtag_Stroke2_Corner0_Rounded as Hashtag, } from '#/components/icons/Hashtag' +import { + Heart2_Filled_Stroke2_Corner0_Rounded as HeartFilled, + Heart2_Stroke2_Corner0_Rounded as Heart, +} from '#/components/icons/Heart2' import { HomeOpen_Filled_Corner0_Rounded as HomeFilled, HomeOpen_Stoke2_Corner0_Rounded as Home, @@ -804,6 +808,24 @@ export function DesktopLeftNav() { } label={_(msg`Settings`)} /> + + } + iconFilled={ + + } + label={_(msg`Support`)} + /> diff --git a/src/view/shell/desktop/RightNav.tsx b/src/view/shell/desktop/RightNav.tsx index fd334718b..6ce10595e 100644 --- a/src/view/shell/desktop/RightNav.tsx +++ b/src/view/shell/desktop/RightNav.tsx @@ -94,9 +94,7 @@ export function DesktopRightNav({routeName}: {routeName: string}) { {showTrending && } - + {_(msg`Support Us`)} {' • '} diff --git a/yarn.lock b/yarn.lock index 516910b96..ae0d32eb2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2469,7 +2469,20 @@ "@babel/parser" "^7.28.6" "@babel/types" "^7.28.6" -"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3", "@babel/traverse@^7.25.3", "@babel/traverse@^7.27.1", "@babel/traverse@^7.28.5", "@babel/traverse@^7.28.6", "@babel/traverse@^7.29.0": +"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.29.0.tgz#f323d05001440253eead3c9c858adbe00b90310a" + integrity sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA== + dependencies: + "@babel/code-frame" "^7.29.0" + "@babel/generator" "^7.29.0" + "@babel/helper-globals" "^7.28.0" + "@babel/parser" "^7.29.0" + "@babel/template" "^7.28.6" + "@babel/types" "^7.29.0" + debug "^4.3.1" + +"@babel/traverse@^7.25.3", "@babel/traverse@^7.27.1", "@babel/traverse@^7.28.5", "@babel/traverse@^7.28.6", "@babel/traverse@^7.29.0": version "7.29.0" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.29.0.tgz#f323d05001440253eead3c9c858adbe00b90310a" integrity sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA== @@ -5871,6 +5884,18 @@ dependencies: tslib "^2.6.2" +"@stripe/react-stripe-js@^6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@stripe/react-stripe-js/-/react-stripe-js-6.1.0.tgz#644ff17db8de454d8746ee76f45ee727442512f4" + integrity sha512-LbKbRv4+wUSHLb5VNxqiYcKaqXPvTju0bJaF0RrzH0h4+aKWDXAk4RzUBcpNxxj8KtjuxICElANs1Li7aTv1IQ== + dependencies: + prop-types "^15.7.2" + +"@stripe/stripe-js@^9.0.1": + version "9.0.1" + resolved "https://registry.yarnpkg.com/@stripe/stripe-js/-/stripe-js-9.0.1.tgz#2924ebe40857f934a5348b743fee9ecb993c7cce" + integrity sha512-un0URSosrW7wNr7xZ5iI2mC9mdeXZ3KERoVlA2RdmeLXYxHUPXq0yHzir2n/MtyXXEdSaELtz4WXGS6dzPEeKA== + "@tanstack/query-async-storage-persister@^5.25.0": version "5.90.22" resolved "https://registry.yarnpkg.com/@tanstack/query-async-storage-persister/-/query-async-storage-persister-5.90.22.tgz#24f840293fb4a6a61cf7727fb8ccc54481e11dc6" @@ -16124,7 +16149,16 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -16215,7 +16249,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -16229,6 +16263,13 @@ strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.2" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.2.tgz#132875abde678c7ea8d691533f2e7e22bb744dba" @@ -17432,7 +17473,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -17450,6 +17491,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" -- knotmirror 0.0.1