@oaknational/google-classroom-addon 1.23.0 → 1.24.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.
@@ -181,6 +181,7 @@ type VerifiedAuthSession = {
181
181
  session: string;
182
182
  token: string;
183
183
  userProfilePicUrl?: string;
184
+ loginHint?: string;
184
185
  };
185
186
  type OakGoogleSignInCallback = {
186
187
  encryptedSession: string;
package/dist/views.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import * as zustand from 'zustand';
2
3
 
3
4
  /**
4
5
  * Types related to the UI layer of the application (components/store/views)
@@ -123,8 +124,9 @@ declare const GoogleClassroomAuthSuccessView: React.FC<Props$9>;
123
124
  type Props$8 = {
124
125
  years: Year[];
125
126
  subjectsUrlTemplate: string;
127
+ onYearSelected?: (year: Year) => void;
126
128
  };
127
- declare const GoogleClassroomBrowseView: ({ years, subjectsUrlTemplate, }: Props$8) => React.JSX.Element;
129
+ declare const GoogleClassroomBrowseView: ({ years, subjectsUrlTemplate, onYearSelected, }: Props$8) => React.JSX.Element;
128
130
 
129
131
  type Props$7 = {
130
132
  children: React.ReactNode;
@@ -133,6 +135,7 @@ type Props$7 = {
133
135
  session?: string;
134
136
  accessToken?: string;
135
137
  userProfilePicUrl?: string;
138
+ loginHint?: string;
136
139
  }>;
137
140
  signInUrl: string;
138
141
  cookieKeys?: [
@@ -143,11 +146,20 @@ type Props$7 = {
143
146
  };
144
147
  declare const WithGoogleClassroomAuth: React.FC<Props$7>;
145
148
 
149
+ type OnLessonAttachedData = {
150
+ lessonName: string;
151
+ unitName: string;
152
+ courseId: string;
153
+ itemId: string;
154
+ gradeSyncEnabled: boolean;
155
+ googleLoginHint?: string;
156
+ };
146
157
  type Props$6 = {
147
158
  children: React.ReactNode;
148
159
  createAttachmentAction: (attachment: NewAttachment) => Promise<void>;
160
+ onLessonAttached?: (data: OnLessonAttachedData) => void;
149
161
  };
150
- declare const BrowseLayout: ({ children, createAttachmentAction }: Props$6) => React.JSX.Element;
162
+ declare const BrowseLayout: ({ children, createAttachmentAction, onLessonAttached, }: Props$6) => React.JSX.Element;
151
163
 
152
164
  type Props$5 = {
153
165
  browseData?: LessonListItem[];
@@ -157,8 +169,10 @@ type Props$5 = {
157
169
  headerLeftSlot?: React.ReactElement;
158
170
  programmeUrlTemplate: string;
159
171
  pupilLessonUrlTemplate: string;
172
+ onLessonSelected?: (lessonSlug: string) => void;
173
+ onLessonPreviewed?: (lessonSlug: string) => void;
160
174
  };
161
- declare const LessonListingView: ({ browseData, programmeSlug, unitData, programmeFields, headerLeftSlot, programmeUrlTemplate, pupilLessonUrlTemplate, }: Props$5) => React.JSX.Element;
175
+ declare const LessonListingView: ({ browseData, programmeSlug, unitData, programmeFields, headerLeftSlot, programmeUrlTemplate, pupilLessonUrlTemplate, onLessonSelected, onLessonPreviewed, }: Props$5) => React.JSX.Element;
162
176
 
163
177
  type Props$4<programme = Programme> = {
164
178
  yearSlug?: string;
@@ -170,15 +184,17 @@ type Props$4<programme = Programme> = {
170
184
  factorPrefix: "tier" | "examboard" | "pathway";
171
185
  programmes: programme[];
172
186
  }) => Promise<FactorData[]>;
187
+ onOptionSelected?: (factorType: "tier" | "examboard" | "pathway", factor: FactorData) => void;
173
188
  };
174
- declare const OptionsView: ({ yearSlug, programmes, baseSlug, programmeUrlTemplate, backUrlTemplate, getAvailableProgrammeFactorAction, }: Props$4<never>) => React.JSX.Element;
189
+ declare const OptionsView: ({ yearSlug, programmes, baseSlug, programmeUrlTemplate, backUrlTemplate, getAvailableProgrammeFactorAction, onOptionSelected, }: Props$4<never>) => React.JSX.Element;
175
190
 
176
191
  type Props$3 = {
177
192
  subjects: Subject[];
178
193
  optionsUrlTemplate: string;
179
194
  unitsUrlTemplate: string;
195
+ onSubjectSelected?: (subject: Subject) => void;
180
196
  };
181
- declare const SubjectsPageView: ({ subjects, optionsUrlTemplate, unitsUrlTemplate, }: Props$3) => React.JSX.Element;
197
+ declare const SubjectsPageView: ({ subjects, optionsUrlTemplate, unitsUrlTemplate, onSubjectSelected, }: Props$3) => React.JSX.Element;
182
198
 
183
199
  type Props$2 = {
184
200
  yearSlug: string;
@@ -202,8 +218,9 @@ type Props = {
202
218
  units: Unit[][];
203
219
  programmeSlug: string;
204
220
  unitsLessonListUrlTemplate: string;
221
+ onUnitSelected?: (unit: Unit) => void;
205
222
  };
206
- declare const UnitCards: ({ units, programmeSlug, unitsLessonListUrlTemplate, }: Props) => React.JSX.Element;
223
+ declare const UnitCards: ({ units, programmeSlug, unitsLessonListUrlTemplate, onUnitSelected, }: Props) => React.JSX.Element;
207
224
 
208
225
  /**
209
226
  * Determines if the browser is in Google Classroom
@@ -211,5 +228,38 @@ declare const UnitCards: ({ units, programmeSlug, unitsLessonListUrlTemplate, }:
211
228
  */
212
229
  declare function isClassroomAssignment(searchParams: URLSearchParams | null): boolean;
213
230
 
214
- export { AuthCookieKeys, BrowseLayout, GoogleClassroomAuthSuccessView, GoogleClassroomBrowseView, GoogleSignInView, LessonListingView, OakGoogleClassroomProvider, OptionsView, SubjectsPageView, UnitCards, UnitsListingView, WithGoogleClassroomAuth, isClassroomAssignment };
215
- export type { FactorData, LessonListItem, NewAttachment, Programme, ProgrammeFields, Subject, Unit, UnitData, Year };
231
+ type Lesson = {
232
+ unitSlug: string;
233
+ lessonSlug: string;
234
+ programmeSlug: string;
235
+ title: string;
236
+ unitTitle: string;
237
+ maxPoints: number;
238
+ };
239
+ type UserSlice = {
240
+ userProfilePicUrl?: string;
241
+ googleLoginHint?: string;
242
+ setUser: (profilePicUrl?: string) => void;
243
+ setGoogleLoginHint: (loginHint: string) => void;
244
+ };
245
+ type BrowseSlice = {
246
+ lessons: Lesson[];
247
+ setLessons: (lessons: Lesson[]) => void;
248
+ unsetLessons: () => void;
249
+ lessonSelected: boolean;
250
+ setLessonSelected: () => void;
251
+ isGradeSynced?: boolean;
252
+ toggleGradeSync: (isSynced: boolean) => void;
253
+ };
254
+ type AddonSlice = {
255
+ courseId?: string;
256
+ itemId?: string;
257
+ addOnToken?: string;
258
+ isInitialised: boolean;
259
+ initialiseAddon: (courseId: string, itemId: string, addOnToken: string) => void;
260
+ };
261
+ type GoogleClassroomAddonStore = UserSlice & BrowseSlice & AddonSlice;
262
+ declare const useGoogleClassroomAddonStore: zustand.UseBoundStore<zustand.StoreApi<GoogleClassroomAddonStore>>;
263
+
264
+ export { AuthCookieKeys, BrowseLayout, GoogleClassroomAuthSuccessView, GoogleClassroomBrowseView, GoogleSignInView, LessonListingView, OakGoogleClassroomProvider, OptionsView, SubjectsPageView, UnitCards, UnitsListingView, WithGoogleClassroomAuth, isClassroomAssignment, useGoogleClassroomAddonStore };
265
+ export type { FactorData, LessonListItem, NewAttachment, OnLessonAttachedData, 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.23.0",
3
+ "version": "1.24.0",
4
4
  "description": "Components and helpers for the Oak Google Classroom Add-on",
5
5
  "exports": {
6
6
  "./ui": {