@oaknational/google-classroom-addon 1.17.0 → 1.18.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.
@@ -54,10 +54,17 @@ declare class OakGoogleClassroomAddOn {
54
54
  constructor(encryptionSecret: string, firestore: Firestore, googleOAuthClientId: string, googleOAuthClientSecret: string, googleOAuthCallbackApiRoute: string, sessionSecret: string, baseUrl: string);
55
55
  /**
56
56
  * Generates the Google OAuth sign-in URL for user authentication.
57
+ * This requests the scopes for a teacher account
57
58
  * @param loginHint - Optional login hint to attach to generated url
58
59
  * @param subscribeToNewsletter - Whether the user opted in to the newsletter
59
60
  */
60
61
  getGoogleSignInUrl(loginHint?: string, subscribeToNewsletter?: boolean): Promise<string>;
62
+ /**
63
+ * Generates the Google OAuth sign-in URL for pupil authentication.
64
+ * This requests the scopes for a pupil, which are more limited than the teacher scopes.
65
+ * @param loginHint
66
+ */
67
+ getPupilGoogleSignInUrl(loginHint?: string): Promise<string>;
61
68
  /**
62
69
  * Handles the Google OAuth callback by exchanging the authorization code for tokens,
63
70
  * creating an encrypted session, and persisting user credentials.
package/dist/views.d.ts CHANGED
@@ -1,19 +1,5 @@
1
1
  import React from 'react';
2
2
 
3
- type Props$9 = {
4
- getGoogleSignInLink: (subscribeToNewsletter?: boolean) => Promise<string | null>;
5
- onSuccessfulSignIn: (signUpToNewsletter: boolean) => Promise<void> | void;
6
- privacyPolicyUrl: string;
7
- showMailingListOption?: boolean;
8
- };
9
- declare const GoogleSignInView: ({ getGoogleSignInLink, onSuccessfulSignIn, privacyPolicyUrl, showMailingListOption, }: Props$9) => React.JSX.Element;
10
-
11
- type Props$8 = {
12
- session: string;
13
- accessToken: string;
14
- };
15
- declare const GoogleClassroomAuthSuccessView: React.FC<Props$8>;
16
-
17
3
  /**
18
4
  * Types related to the UI layer of the application (components/store/views)
19
5
  */
@@ -108,6 +94,30 @@ type Year = {
108
94
  yearDescription: string;
109
95
  phase: "primary" | "secondary";
110
96
  };
97
+ declare enum AuthCookieKeys {
98
+ AccessToken = "oak-gclassroom-session",
99
+ Session = "oak-gclassroom-token",
100
+ PupilAccessToken = "oak-gclassroom-pupil-token",
101
+ PupilSession = "oak-gclassroom-pupil-session"
102
+ }
103
+
104
+ type Props$9 = {
105
+ getGoogleSignInLink: (subscribeToNewsletter?: boolean) => Promise<string | null>;
106
+ onSuccessfulSignIn: (signUpToNewsletter: boolean) => Promise<void> | void;
107
+ privacyPolicyUrl: string;
108
+ showMailingListOption?: boolean;
109
+ cookieKeys?: [
110
+ AuthCookieKeys.AccessToken | AuthCookieKeys.PupilAccessToken,
111
+ AuthCookieKeys.Session | AuthCookieKeys.PupilSession
112
+ ];
113
+ };
114
+ declare const GoogleSignInView: ({ getGoogleSignInLink, onSuccessfulSignIn, privacyPolicyUrl, showMailingListOption, cookieKeys, }: Props$9) => React.JSX.Element;
115
+
116
+ type Props$8 = {
117
+ session: string;
118
+ accessToken: string;
119
+ };
120
+ declare const GoogleClassroomAuthSuccessView: React.FC<Props$8>;
111
121
 
112
122
  type Props$7 = {
113
123
  years: Year[];
@@ -124,6 +134,11 @@ type Props$6 = {
124
134
  userProfilePicUrl?: string;
125
135
  }>;
126
136
  signInUrl: string;
137
+ cookieKeys?: [
138
+ AuthCookieKeys.AccessToken | AuthCookieKeys.PupilAccessToken,
139
+ AuthCookieKeys.Session | AuthCookieKeys.PupilSession
140
+ ];
141
+ onVerifySuccess?: () => void | Promise<void>;
127
142
  };
128
143
  declare const WithGoogleClassroomAuth: React.FC<Props$6>;
129
144
 
@@ -183,4 +198,5 @@ type Props = {
183
198
  };
184
199
  declare const OakGoogleClassroomProvider: ({ children, courseId, itemId, addOnToken, }: Props) => React.ReactNode;
185
200
 
186
- export { BrowseLayout, GoogleClassroomAuthSuccessView, GoogleClassroomBrowseView, GoogleSignInView, LessonListingView, OakGoogleClassroomProvider, OptionsView, SubjectsPageView, UnitsListingView, WithGoogleClassroomAuth };
201
+ export { AuthCookieKeys, BrowseLayout, GoogleClassroomAuthSuccessView, GoogleClassroomBrowseView, GoogleSignInView, LessonListingView, OakGoogleClassroomProvider, OptionsView, SubjectsPageView, UnitsListingView, WithGoogleClassroomAuth };
202
+ export type { FactorData, LessonListItem, NewAttachment, Programme, ProgrammeFields, Subject, Unit, UnitData, Year };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oaknational/google-classroom-addon",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "Components and helpers for the Oak Google Classroom Add-on",
5
5
  "exports": {
6
6
  "./ui": {