@oaknational/google-classroom-addon 1.5.0 → 1.6.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.
- package/README.md +20 -0
- package/dist/cjs/services/index.js +1 -1
- package/dist/cjs/services/index.js.map +1 -1
- package/dist/cjs/views/index.js +2 -1
- package/dist/cjs/views/index.js.map +1 -1
- package/dist/esm/services/index.js +1 -1
- package/dist/esm/services/index.js.map +1 -1
- package/dist/esm/views/index.js +2 -1
- package/dist/esm/views/index.js.map +1 -1
- package/dist/services.d.ts +15 -2
- package/dist/views.d.ts +167 -9
- package/package.json +10 -6
package/dist/services.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ type CreateAnnouncementAttachmentArgs = {
|
|
|
13
13
|
|
|
14
14
|
type OakGoogleSignInCallback = {
|
|
15
15
|
encryptedSession: string;
|
|
16
|
+
accessToken: string;
|
|
16
17
|
profilePictureUrl?: string;
|
|
17
18
|
};
|
|
18
19
|
declare class OakGoogleClassroomAddOn {
|
|
@@ -33,14 +34,26 @@ declare class OakGoogleClassroomAddOn {
|
|
|
33
34
|
private getOAuthClient;
|
|
34
35
|
getGoogleSignInUrl(loginHint?: string, subscribeToNewsletter?: boolean): Promise<string>;
|
|
35
36
|
handleGoogleSignInCallback(code: string, subscribeToNewsletterFn?: (email: string) => Promise<void>): Promise<OakGoogleSignInCallback>;
|
|
37
|
+
private decryptSession;
|
|
38
|
+
/**
|
|
39
|
+
* Validates an encrypted session and fetches the associated user credentials.
|
|
40
|
+
* Automatically decrypts the user's refresh token.
|
|
41
|
+
* Returns null for an invalid session.
|
|
42
|
+
* @param encryptedSession
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
private getSessionAndUser;
|
|
36
46
|
/**
|
|
37
47
|
* Checks if session exists and is authenticated. It will automatically attempt
|
|
38
48
|
* to refresh the session if it has expired.
|
|
39
49
|
* Returns null for an invalid session.
|
|
40
50
|
* Returns the encrypted session (original or refreshed) if valid.
|
|
41
51
|
*/
|
|
42
|
-
verifyAuthSession(encryptedSession
|
|
43
|
-
|
|
52
|
+
verifyAuthSession(encryptedSession?: string, accessToken?: string): Promise<{
|
|
53
|
+
session: string;
|
|
54
|
+
token: string;
|
|
55
|
+
} | null>;
|
|
56
|
+
createAttachment(args: CreateAnnouncementAttachmentArgs, accessToken: string, session: string): Promise<FirebaseFirestore.DocumentData | null | undefined>;
|
|
44
57
|
}
|
|
45
58
|
|
|
46
59
|
export { OakGoogleClassroomAddOn };
|
package/dist/views.d.ts
CHANGED
|
@@ -1,26 +1,184 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
type Props$
|
|
3
|
+
type Props$9 = {
|
|
4
4
|
getGoogleSignInLink: () => Promise<string | null>;
|
|
5
5
|
onSuccessfulSignIn: (signUpToNewsletter: boolean) => Promise<void> | void;
|
|
6
6
|
privacyPolicyUrl: string;
|
|
7
7
|
};
|
|
8
|
-
declare const GoogleSignInView: ({ getGoogleSignInLink, onSuccessfulSignIn, privacyPolicyUrl, }: Props$
|
|
8
|
+
declare const GoogleSignInView: ({ getGoogleSignInLink, onSuccessfulSignIn, privacyPolicyUrl, }: Props$9) => React.JSX.Element;
|
|
9
9
|
|
|
10
|
-
type Props$
|
|
10
|
+
type Props$8 = {
|
|
11
11
|
session: string;
|
|
12
|
+
accessToken: string;
|
|
13
|
+
};
|
|
14
|
+
declare const GoogleClassroomAuthSuccessView: React.FC<Props$8>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Types related to the UI layer of the application (components/store/views)
|
|
18
|
+
*/
|
|
19
|
+
type LessonListItem = {
|
|
20
|
+
programmeSlug: string;
|
|
21
|
+
unitSlug: string;
|
|
22
|
+
lessonSlug: string;
|
|
23
|
+
isLegacy: boolean;
|
|
24
|
+
lessonData: {
|
|
25
|
+
keyLearningPoints?: {
|
|
26
|
+
keyLearningPoint: string;
|
|
27
|
+
}[] | null;
|
|
28
|
+
keywords?: {
|
|
29
|
+
keyword: string;
|
|
30
|
+
description: string;
|
|
31
|
+
}[] | null;
|
|
32
|
+
misconceptionsAndCommonMistakes?: {
|
|
33
|
+
misconception?: string;
|
|
34
|
+
response?: string;
|
|
35
|
+
}[] | null;
|
|
36
|
+
equipmentAndResources?: {
|
|
37
|
+
equipment: string;
|
|
38
|
+
}[] | null;
|
|
39
|
+
title: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
type ProgrammeFields = {
|
|
43
|
+
optionality?: string;
|
|
44
|
+
year: string;
|
|
45
|
+
yearSlug?: string | null;
|
|
46
|
+
legacy?: string | null;
|
|
47
|
+
tier?: string | null;
|
|
48
|
+
tierSlug?: string | null;
|
|
49
|
+
tierDisplayOrder?: number | null;
|
|
50
|
+
tierDescription?: string | null;
|
|
51
|
+
examboard?: string | null;
|
|
52
|
+
examboardSlug?: string | null;
|
|
53
|
+
examboardDisplayOrder?: number | null;
|
|
54
|
+
pathway?: string | null;
|
|
55
|
+
pathwaySlug?: string | null;
|
|
56
|
+
pathwayDisplayOrder?: number | null;
|
|
57
|
+
subject?: string | null;
|
|
58
|
+
subjectSlug?: string | null;
|
|
59
|
+
subjectDescription: string;
|
|
60
|
+
phase: string;
|
|
61
|
+
phaseSlug?: string | null;
|
|
62
|
+
};
|
|
63
|
+
type UnitData = {
|
|
64
|
+
title: string;
|
|
65
|
+
description?: string | null;
|
|
66
|
+
};
|
|
67
|
+
type Unit = {
|
|
68
|
+
unitData: UnitData;
|
|
69
|
+
lessonCount: number;
|
|
70
|
+
isLegacy: boolean;
|
|
71
|
+
unitSlug: string;
|
|
72
|
+
programmeFields: ProgrammeFields;
|
|
73
|
+
};
|
|
74
|
+
type NewAttachment = {
|
|
75
|
+
courseId: string;
|
|
76
|
+
itemId: string;
|
|
77
|
+
addOnToken: string;
|
|
78
|
+
title: string;
|
|
79
|
+
lessonSlug: string;
|
|
80
|
+
programeSlug: string;
|
|
81
|
+
unitSlug: string;
|
|
82
|
+
maxPoints?: number;
|
|
83
|
+
};
|
|
84
|
+
type FactorData = {
|
|
85
|
+
factor: string | null;
|
|
86
|
+
factorSlug: string | null;
|
|
87
|
+
factorDisplayOrder: number | null;
|
|
88
|
+
factorDescription: string | null;
|
|
89
|
+
isLegacy: boolean;
|
|
90
|
+
};
|
|
91
|
+
type Programme = {
|
|
92
|
+
programmeSlug: string;
|
|
93
|
+
yearSlug: string;
|
|
94
|
+
programmeFields: ProgrammeFields & unknown;
|
|
95
|
+
};
|
|
96
|
+
type Subject = {
|
|
97
|
+
programmeSlug: string;
|
|
98
|
+
baseSlug: string;
|
|
99
|
+
isLegacy: boolean;
|
|
100
|
+
features?: {
|
|
101
|
+
nonCurriculum?: boolean;
|
|
102
|
+
} | null;
|
|
103
|
+
programmeFields: ProgrammeFields;
|
|
104
|
+
};
|
|
105
|
+
type Year = {
|
|
106
|
+
yearSlug: string;
|
|
107
|
+
yearDescription: string;
|
|
108
|
+
phase: "primary" | "secondary";
|
|
12
109
|
};
|
|
13
|
-
declare const GoogleClassroomAuthSuccessView: React.FC<Props$1>;
|
|
14
110
|
|
|
15
|
-
|
|
111
|
+
type Props$7 = {
|
|
112
|
+
years: Year[];
|
|
113
|
+
subjectsUrlTemplate: string;
|
|
114
|
+
};
|
|
115
|
+
declare const GoogleClassroomBrowseView: ({ years, subjectsUrlTemplate, }: Props$7) => React.JSX.Element;
|
|
16
116
|
|
|
17
|
-
type Props = {
|
|
117
|
+
type Props$6 = {
|
|
18
118
|
children: React.ReactNode;
|
|
19
|
-
verifySessionAction: (
|
|
119
|
+
verifySessionAction: () => Promise<{
|
|
20
120
|
authenticated: boolean;
|
|
121
|
+
session?: string;
|
|
122
|
+
accessToken?: string;
|
|
21
123
|
}>;
|
|
22
124
|
signInUrl: string;
|
|
23
125
|
};
|
|
24
|
-
declare const WithGoogleClassroomAuth: React.FC<Props>;
|
|
126
|
+
declare const WithGoogleClassroomAuth: React.FC<Props$6>;
|
|
127
|
+
|
|
128
|
+
type Props$5 = {
|
|
129
|
+
children: React.ReactNode;
|
|
130
|
+
createAttachmentAction: (attachment: NewAttachment) => Promise<void>;
|
|
131
|
+
};
|
|
132
|
+
declare const BrowseLayout: ({ children, createAttachmentAction }: Props$5) => React.JSX.Element;
|
|
133
|
+
|
|
134
|
+
type Props$4 = {
|
|
135
|
+
browseData?: LessonListItem[];
|
|
136
|
+
programmeSlug: string;
|
|
137
|
+
unitData?: UnitData;
|
|
138
|
+
programmeFields?: ProgrammeFields;
|
|
139
|
+
headerLeftSlot?: React.ReactElement;
|
|
140
|
+
programmeUrlTemplate: string;
|
|
141
|
+
pupilLessonUrlTemplate: string;
|
|
142
|
+
};
|
|
143
|
+
declare const LessonListingView: ({ browseData, programmeSlug, unitData, programmeFields, headerLeftSlot, programmeUrlTemplate, pupilLessonUrlTemplate, }: Props$4) => React.JSX.Element;
|
|
144
|
+
|
|
145
|
+
type Props$3<programme = Programme> = {
|
|
146
|
+
yearSlug?: string;
|
|
147
|
+
programmes: Programme[];
|
|
148
|
+
baseSlug: string;
|
|
149
|
+
programmeUrlTemplate: string;
|
|
150
|
+
backUrlTemplate: string;
|
|
151
|
+
getAvailableProgrammeFactorAction: (args: {
|
|
152
|
+
factorPrefix: "tier" | "examboard" | "pathway";
|
|
153
|
+
programmes: programme[];
|
|
154
|
+
}) => Promise<FactorData[]>;
|
|
155
|
+
};
|
|
156
|
+
declare const OptionsView: ({ yearSlug, programmes, baseSlug, programmeUrlTemplate, backUrlTemplate, getAvailableProgrammeFactorAction, }: Props$3<never>) => React.JSX.Element;
|
|
157
|
+
|
|
158
|
+
type Props$2 = {
|
|
159
|
+
subjects: Subject[];
|
|
160
|
+
optionsUrlTemplate: string;
|
|
161
|
+
unitsUrlTemplate: string;
|
|
162
|
+
};
|
|
163
|
+
declare const SubjectsPageView: ({ subjects, optionsUrlTemplate, unitsUrlTemplate, }: Props$2) => React.JSX.Element;
|
|
164
|
+
|
|
165
|
+
type Props$1 = {
|
|
166
|
+
programmeSlug: string;
|
|
167
|
+
yearSlug: string;
|
|
168
|
+
programmeUnits: Unit[][];
|
|
169
|
+
programmeData: ProgrammeFields;
|
|
170
|
+
unitsLessonListUrlTemplate: string;
|
|
171
|
+
subjectsUrlTemplate: string;
|
|
172
|
+
headerLeftSlot?: React.ReactElement;
|
|
173
|
+
};
|
|
174
|
+
declare const UnitsListingView: ({ programmeSlug, programmeUnits, programmeData, yearSlug, unitsLessonListUrlTemplate, subjectsUrlTemplate, headerLeftSlot, }: Props$1) => React.JSX.Element;
|
|
175
|
+
|
|
176
|
+
type Props = {
|
|
177
|
+
children: React.ReactNode;
|
|
178
|
+
courseId: string;
|
|
179
|
+
itemId: string;
|
|
180
|
+
addOnToken: string;
|
|
181
|
+
};
|
|
182
|
+
declare const OakGoogleClassroomProvider: ({ children, courseId, itemId, addOnToken, }: Props) => React.ReactNode;
|
|
25
183
|
|
|
26
|
-
export { GoogleClassroomAuthSuccessView, GoogleClassroomBrowseView, GoogleSignInView, WithGoogleClassroomAuth };
|
|
184
|
+
export { BrowseLayout, GoogleClassroomAuthSuccessView, GoogleClassroomBrowseView, GoogleSignInView, LessonListingView, OakGoogleClassroomProvider, OptionsView, SubjectsPageView, UnitsListingView, WithGoogleClassroomAuth };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oaknational/google-classroom-addon",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Components and helpers for the Oak Google Classroom Add-on",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./ui": {
|
|
@@ -47,20 +47,23 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/oaknational/google-classroom-addon#readme",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@googleapis/classroom": ">=11.0.0",
|
|
51
50
|
"@google-cloud/firestore": ">=7.11.2",
|
|
52
|
-
"@
|
|
53
|
-
"
|
|
51
|
+
"@googleapis/classroom": "4.9.0",
|
|
52
|
+
"@oaknational/oak-components": ">=1.169.0",
|
|
53
|
+
"google-auth-library": "9.15.1",
|
|
54
54
|
"next": ">=15.4.3",
|
|
55
55
|
"react": ">=18.3.1",
|
|
56
|
-
"react-dom": ">=18.3.1"
|
|
56
|
+
"react-dom": ">=18.3.1",
|
|
57
|
+
"zustand": ">=5.0.9"
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
59
|
-
"iron-session": "^8.0.4"
|
|
60
|
+
"iron-session": "^8.0.4",
|
|
61
|
+
"lodash": "^4.17.21"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@commitlint/cli": "^19.8.1",
|
|
63
65
|
"@commitlint/config-conventional": "^19.8.1",
|
|
66
|
+
"@faker-js/faker": "9.9.0",
|
|
64
67
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
65
68
|
"@rollup/plugin-json": "^6.1.0",
|
|
66
69
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
@@ -74,6 +77,7 @@
|
|
|
74
77
|
"@testing-library/react": "^16.3.0",
|
|
75
78
|
"@testing-library/user-event": "^14.6.1",
|
|
76
79
|
"@types/jest": "^30.0.0",
|
|
80
|
+
"@types/lodash": "^4.17.21",
|
|
77
81
|
"eslint": "^9.36.0",
|
|
78
82
|
"eslint-config-prettier": "^10.1.8",
|
|
79
83
|
"eslint-import-resolver-typescript": "^4.4.4",
|