From 7af423173cd7d0ed5e7bca1a66cc6da291357df0 Mon Sep 17 00:00:00 2001 From: M Fahru Date: Thu, 23 Jan 2025 06:36:25 -0700 Subject: [PATCH] Merge pull request #22475 from overleaf/rh-student-hurdle [web] Add friction to student plans GitOrigin-RevId: 506f1e96a8430069ba5e9f7bfd6c709124e7857c --- .../web/frontend/extracted-translations.json | 3 +++ .../frontend/js/shared/components/history.ts | 7 +++++++ .../frontend/js/shared/components/location.js | 4 ++++ .../app/plans/plans-new-design.less | 6 ++++++ .../bootstrap-5/pages/subscription.scss | 21 +++++++++++++++++++ services/web/locales/en.json | 4 ++++ .../subscription/payment-context-value.tsx | 4 ++++ 7 files changed, 49 insertions(+) create mode 100644 services/web/frontend/js/shared/components/history.ts diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index d9140714aa..6e69194ae4 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -709,6 +709,7 @@ "how_to_insert_images": "", "how_we_use_your_data": "", "how_we_use_your_data_explanation": "", + "i_confirm_am_student": "", "i_want_to_stay": "", "id": "", "if_you_need_to_customize_your_table_further_you_can": "", @@ -1025,6 +1026,7 @@ "normal": "", "normally_x_price_per_month": "", "normally_x_price_per_year": "", + "not_a_student": "", "not_managed": "", "not_now": "", "notification_personal_and_group_subscriptions": "", @@ -1567,6 +1569,7 @@ "switch_plan": "", "switch_to_editor": "", "switch_to_pdf": "", + "switch_to_standard": "", "symbol_palette": "", "sync": "", "sync_dropbox_github": "", diff --git a/services/web/frontend/js/shared/components/history.ts b/services/web/frontend/js/shared/components/history.ts new file mode 100644 index 0000000000..44d801d973 --- /dev/null +++ b/services/web/frontend/js/shared/components/history.ts @@ -0,0 +1,7 @@ +// window.history-related functions in a separate module so they can be mocked/stubbed in tests + +export const history = { + pushState(data: any, unused: string, url?: string | URL | null) { + window.history.pushState(data, unused, url) + }, +} diff --git a/services/web/frontend/js/shared/components/location.js b/services/web/frontend/js/shared/components/location.js index 0c4d5d3436..287bba2bfe 100644 --- a/services/web/frontend/js/shared/components/location.js +++ b/services/web/frontend/js/shared/components/location.js @@ -1,6 +1,10 @@ // window location-related functions in a separate module so they can be mocked/stubbed in tests export const location = { + get href() { + // eslint-disable-next-line no-restricted-syntax + return window.location.href + }, assign(url) { // eslint-disable-next-line no-restricted-syntax window.location.assign(url) diff --git a/services/web/frontend/stylesheets/app/plans/plans-new-design.less b/services/web/frontend/stylesheets/app/plans/plans-new-design.less index 77a277b8e4..73e9eb761c 100644 --- a/services/web/frontend/stylesheets/app/plans/plans-new-design.less +++ b/services/web/frontend/stylesheets/app/plans/plans-new-design.less @@ -344,6 +344,12 @@ margin-left: @table-4-column-width / 2; } + .plans-new-table-student-verification { + font-weight: 600; + font-size: var(--font-size-01); + text-align: center; + } + .plans-new-table-group { margin-top: @spacing-11 + @highlighted-heading-height; } diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/subscription.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/subscription.scss index 9241b68bcc..c1b3ee8115 100644 --- a/services/web/frontend/stylesheets/bootstrap-5/pages/subscription.scss +++ b/services/web/frontend/stylesheets/bootstrap-5/pages/subscription.scss @@ -416,3 +416,24 @@ font-weight: 600; } + +.not-student-switch { + font-size: var(--font-size-02); + margin-left: var(--spacing-08); + + label { + font-weight: normal; + } + + button { + margin: 0 0 0 var(--spacing-03); + padding: 0; + color: var(--link-web); + font-size: var(--font-size-02); + vertical-align: inherit; + + .button-content { + color: var(--link-web); + } + } +} diff --git a/services/web/locales/en.json b/services/web/locales/en.json index cd5b68da76..a12954096c 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -932,6 +932,7 @@ "how_we_use_your_data": "How we use your data", "how_we_use_your_data_explanation": "<0>Please help us continue to improve Overleaf by answering a few quick questions. Your answers will help us and our corporate group understand more about our user base. We may use this information to improve your Overleaf experience, for example by providing personalized onboarding, upgrade prompts, help suggestions, and tailored marketing communications (if you’ve opted-in to receive them).<1>For more details on how we use your personal data, please see our <0>Privacy Notice.", "hundreds_templates_info": "Produce beautiful documents starting from our gallery of LaTeX templates for journals, conferences, theses, reports, CVs and much more.", + "i_confirm_am_student": "I confirm that I am currently a student.", "i_want_to_stay": "I want to stay", "id": "ID", "if_have_existing_can_link": "If you have an existing __appName__ account on another email, you can link it to your __institutionName__ account by clicking __clickText__.", @@ -1368,6 +1369,7 @@ "normal": "Normal", "normally_x_price_per_month": "Normally __price__ per month", "normally_x_price_per_year": "Normally __price__ per year", + "not_a_student": "Not a student?", "not_found_error_from_the_supplied_url": "The link to open this content on Overleaf pointed to a file that could not be found. If this keeps happening for links on a particular site, please report this to them.", "not_managed": "Not managed", "not_now": "Not now", @@ -2027,6 +2029,7 @@ "stretch_width_to_text": "Stretch width to text", "student": "Student", "student_disclaimer": "The educational discount applies to all students at secondary and postsecondary institutions (schools and universities). We may contact you to confirm that you’re eligible for the discount.", + "student_verification_required": "Student verification required", "students": "Students", "subject": "Subject", "subject_area": "Subject area", @@ -2059,6 +2062,7 @@ "switch_plan": "Switch plan", "switch_to_editor": "Switch to editor", "switch_to_pdf": "Switch to PDF", + "switch_to_standard": "Switch to standard", "symbol_palette": "Symbol palette", "symbol_palette_highlighted": "<0>Symbol palette", "symbol_palette_info_new": "Insert math symbols into your document with the click of a button.", diff --git a/services/web/types/subscription/payment-context-value.tsx b/services/web/types/subscription/payment-context-value.tsx index 07472efb28..16384b655f 100644 --- a/services/web/types/subscription/payment-context-value.tsx +++ b/services/web/types/subscription/payment-context-value.tsx @@ -30,6 +30,9 @@ export type PaymentContextValue = { > plan: Plan planCode: string + setPlanCode: React.Dispatch< + React.SetStateAction + > planName: string planOffersFreeTrial: boolean pricing: React.MutableRefObject @@ -65,4 +68,5 @@ export type PaymentContextValue = { changeCurrency: (newCurrency: CurrencyCode) => void updateCountry: (country: PricingFormState['country']) => void userCanNotStartRequestedTrial: boolean + showStudentConfirmation: boolean }