From bc7a5e1e4db46acf68ddac6aae9068fb4940ec1e Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Thu, 14 Sep 2023 23:04:51 +0100 Subject: [PATCH] CLASSROOMIO-T-152: Add payment link + reload on org login --- .../components/People/InviationModal.svelte | 18 +-- src/lib/components/Course/store.ts | 1 + .../components/Editor/PricingForm.svelte | 112 ++++++++++-------- .../components/PricingSection.svelte | 29 +++-- .../components/CourseLandingPage/index.svelte | 5 + src/lib/components/Form/TextField.svelte | 4 +- src/lib/components/TextEditor/index.svelte | 4 +- src/lib/utils/functions/course.ts | 18 +++ .../utils/functions/getCurrencyFormatter.ts | 5 +- src/lib/utils/services/sendgrid.ts | 2 +- src/lib/utils/types/index.ts | 3 +- .../email/course/student_welcome/+server.js | 4 +- .../course/teacher_student_joined/+server.js | 4 +- .../email/course/teacher_welcome/+server.js | 4 +- src/routes/api/email/invite/+server.js | 4 +- src/routes/login/+page.svelte | 7 ++ 16 files changed, 133 insertions(+), 91 deletions(-) create mode 100644 src/lib/utils/functions/course.ts diff --git a/src/lib/components/Course/components/People/InviationModal.svelte b/src/lib/components/Course/components/People/InviationModal.svelte index 65bfa2d2..1957f44f 100644 --- a/src/lib/components/Course/components/People/InviationModal.svelte +++ b/src/lib/components/Course/components/People/InviationModal.svelte @@ -15,6 +15,7 @@ import { sendTeacherCourseWelcome } from './utils'; import type { Course } from '$lib/utils/types'; import { VARIANTS } from '$lib/components/PrimaryButton/constants'; + import { getStudentInviteLink } from '$lib/utils/functions/course'; interface Tutor { id: number; @@ -109,21 +110,6 @@ isLoadingTutors = false; } - function getInviteLink(_course: Course, siteName: string) { - const hash = encodeURIComponent( - btoa( - JSON.stringify({ - groupId: _course.group?.id, - name: _course.title, - description: _course.description, - orgSiteName: siteName - }) - ) - ); - - return `https://${siteName}.classroomio.com/invite/s/${hash}`; - } - function copyLink() { copy(link); copied = true; @@ -139,7 +125,7 @@ $: setTutors($currentOrg.id, $invitationModal.open); - $: link = getInviteLink($course, $currentOrg.siteName); + $: link = getStudentInviteLink($course, $currentOrg.siteName); = writable({ videoUrl: '', showDiscount: false, discount: 0, + paymentLink: '', reward: { show: false, description: '' diff --git a/src/lib/components/CourseLandingPage/components/Editor/PricingForm.svelte b/src/lib/components/CourseLandingPage/components/Editor/PricingForm.svelte index 1120e981..f555b361 100644 --- a/src/lib/components/CourseLandingPage/components/Editor/PricingForm.svelte +++ b/src/lib/components/CourseLandingPage/components/Editor/PricingForm.svelte @@ -1,32 +1,36 @@ - - +{#if typeof course !== 'undefined'} + - - -
- - - No - Yes - -
- -{#if showDiscount} -{/if} -
- - - No - Yes - -
+ {#if !isCourseFree(course.cost || 0)} + + {/if} -{#if giftToggled} -

About Gift

- -
- +
+ + + No + Yes +
+ + {#if showDiscount} + + {/if} + +
+ + + No + Yes + +
+ + {#if giftToggled} +

About Gift

+ +
+ +
+ {/if} {/if} diff --git a/src/lib/components/CourseLandingPage/components/PricingSection.svelte b/src/lib/components/CourseLandingPage/components/PricingSection.svelte index 54951a14..11fb2aff 100644 --- a/src/lib/components/CourseLandingPage/components/PricingSection.svelte +++ b/src/lib/components/CourseLandingPage/components/PricingSection.svelte @@ -1,11 +1,12 @@ @@ -44,6 +56,9 @@

{formatter?.format(calculatedCost) || calculatedCost} + {#if isFree} + (Free) + {/if}

{#if courseData?.metadata?.showDiscount}

@@ -58,15 +73,9 @@

-

Early bird offer. Buy ASAP

diff --git a/src/lib/components/CourseLandingPage/index.svelte b/src/lib/components/CourseLandingPage/index.svelte index 4f4e47cc..a78c7889 100644 --- a/src/lib/components/CourseLandingPage/index.svelte +++ b/src/lib/components/CourseLandingPage/index.svelte @@ -25,6 +25,7 @@ dayjs.extend(relativeTime); + export let editMode = false; export let courseData: Course = { id: '', title: '', @@ -164,7 +165,11 @@ {/if}
+<<<<<<< Updated upstream +======= + +>>>>>>> Stashed changes
+