@speakableio/core 0.1.14 → 0.1.16

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/dist/index.d.mts CHANGED
@@ -911,6 +911,7 @@ declare function createFsClient({ db, platform, httpsCallable, }: {
911
911
  }>;
912
912
 
913
913
  interface UserProfile {
914
+ googleClassroomUserId: string;
914
915
  image: {
915
916
  url: string;
916
917
  path: string;
package/dist/index.d.ts CHANGED
@@ -911,6 +911,7 @@ declare function createFsClient({ db, platform, httpsCallable, }: {
911
911
  }>;
912
912
 
913
913
  interface UserProfile {
914
+ googleClassroomUserId: string;
914
915
  image: {
915
916
  url: string;
916
917
  path: string;
package/dist/index.js CHANGED
@@ -87,6 +87,8 @@ var FirebaseAPI = class _FirebaseAPI {
87
87
  id: docSnap.id,
88
88
  ...docSnap.data()
89
89
  } : null;
90
+ console.log("getDoc", path);
91
+ console.log("getDoc db", this.db);
90
92
  return {
91
93
  id: docSnap.id,
92
94
  data
@@ -97,6 +99,8 @@ var FirebaseAPI = class _FirebaseAPI {
97
99
  const collectionRef = collection(this.db, path);
98
100
  const q = queryConstraints.length > 0 ? query(collectionRef, ...queryConstraints) : collectionRef;
99
101
  const querySnapshot = await getDocs(q);
102
+ console.log("getDocs", path, queryConstraints);
103
+ console.log("getDocs db", this.db);
100
104
  const data = querySnapshot.docs.map((doc) => ({
101
105
  id: doc.id,
102
106
  data: doc.data()
@@ -118,16 +122,22 @@ var FirebaseAPI = class _FirebaseAPI {
118
122
  async setDoc(path, data, options = {}) {
119
123
  const { setDoc, doc } = this.helpers;
120
124
  const docRef = doc(this.db, path);
125
+ console.log("setDoc", path, data);
126
+ console.log("setDoc db", this.db);
121
127
  await setDoc(docRef, data, options);
122
128
  }
123
129
  async updateDoc(path, data) {
124
130
  const { updateDoc, doc } = this.helpers;
131
+ console.log("updateDoc", path, data);
132
+ console.log("updateDoc db", this.db);
125
133
  const docRef = doc(this.db, path);
126
134
  await updateDoc(docRef, data);
127
135
  }
128
136
  async deleteDoc(path) {
129
137
  const { deleteDoc, doc } = this.helpers;
130
138
  const docRef = doc(this.db, path);
139
+ console.log("deleteDoc", path);
140
+ console.log("deleteDoc db", this.db);
131
141
  await deleteDoc(docRef);
132
142
  }
133
143
  async runTransaction(updateFunction) {
@@ -1612,6 +1622,12 @@ function useUpdateCardScore({
1612
1622
  const mutation = _reactquery.useMutation.call(void 0, {
1613
1623
  mutationFn: async ({ cardId, cardScore }) => {
1614
1624
  const previousScores = queryClient.getQueryData(queryKey);
1625
+ console.log({
1626
+ previousScores,
1627
+ cardId,
1628
+ cardScore,
1629
+ dataCurrentSet
1630
+ });
1615
1631
  const { progress, score, newScoreUpdated, updatedCardScore } = getScoreUpdated({
1616
1632
  previousScores: _nullishCoalesce(previousScores, () => ( {})),
1617
1633
  cardId,
@@ -1646,7 +1662,8 @@ function useUpdateCardScore({
1646
1662
  });
1647
1663
  },
1648
1664
  // eslint-disable-next-line no-unused-vars
1649
- onError: () => {
1665
+ onError: (error) => {
1666
+ console.log(error.message);
1650
1667
  const previousData = queryClient.getQueryData(queryKey);
1651
1668
  if (previousData) {
1652
1669
  queryClient.setQueryData(queryKey, previousData);
@@ -1875,8 +1892,7 @@ function useActivity({
1875
1892
  activityId: id,
1876
1893
  userId,
1877
1894
  courseId: _optionalChain([activeAssignment, 'optionalAccess', _64 => _64.courseId]),
1878
- googleClassroomUserId: "",
1879
- // TODO
1895
+ googleClassroomUserId: user.profile.googleClassroomUserId,
1880
1896
  enabled: isAssignment ? assignmentQuery.isSuccess : querySet.isSuccess
1881
1897
  });
1882
1898
  const { mutationUpdateScore } = useUpdateScore();
package/dist/index.mjs CHANGED
@@ -87,6 +87,8 @@ var FirebaseAPI = class _FirebaseAPI {
87
87
  id: docSnap.id,
88
88
  ...docSnap.data()
89
89
  } : null;
90
+ console.log("getDoc", path);
91
+ console.log("getDoc db", this.db);
90
92
  return {
91
93
  id: docSnap.id,
92
94
  data
@@ -97,6 +99,8 @@ var FirebaseAPI = class _FirebaseAPI {
97
99
  const collectionRef = collection(this.db, path);
98
100
  const q = queryConstraints.length > 0 ? query(collectionRef, ...queryConstraints) : collectionRef;
99
101
  const querySnapshot = await getDocs(q);
102
+ console.log("getDocs", path, queryConstraints);
103
+ console.log("getDocs db", this.db);
100
104
  const data = querySnapshot.docs.map((doc) => ({
101
105
  id: doc.id,
102
106
  data: doc.data()
@@ -118,16 +122,22 @@ var FirebaseAPI = class _FirebaseAPI {
118
122
  async setDoc(path, data, options = {}) {
119
123
  const { setDoc, doc } = this.helpers;
120
124
  const docRef = doc(this.db, path);
125
+ console.log("setDoc", path, data);
126
+ console.log("setDoc db", this.db);
121
127
  await setDoc(docRef, data, options);
122
128
  }
123
129
  async updateDoc(path, data) {
124
130
  const { updateDoc, doc } = this.helpers;
131
+ console.log("updateDoc", path, data);
132
+ console.log("updateDoc db", this.db);
125
133
  const docRef = doc(this.db, path);
126
134
  await updateDoc(docRef, data);
127
135
  }
128
136
  async deleteDoc(path) {
129
137
  const { deleteDoc, doc } = this.helpers;
130
138
  const docRef = doc(this.db, path);
139
+ console.log("deleteDoc", path);
140
+ console.log("deleteDoc db", this.db);
131
141
  await deleteDoc(docRef);
132
142
  }
133
143
  async runTransaction(updateFunction) {
@@ -1612,6 +1622,12 @@ function useUpdateCardScore({
1612
1622
  const mutation = useMutation2({
1613
1623
  mutationFn: async ({ cardId, cardScore }) => {
1614
1624
  const previousScores = queryClient.getQueryData(queryKey);
1625
+ console.log({
1626
+ previousScores,
1627
+ cardId,
1628
+ cardScore,
1629
+ dataCurrentSet
1630
+ });
1615
1631
  const { progress, score, newScoreUpdated, updatedCardScore } = getScoreUpdated({
1616
1632
  previousScores: previousScores ?? {},
1617
1633
  cardId,
@@ -1646,7 +1662,8 @@ function useUpdateCardScore({
1646
1662
  });
1647
1663
  },
1648
1664
  // eslint-disable-next-line no-unused-vars
1649
- onError: () => {
1665
+ onError: (error) => {
1666
+ console.log(error.message);
1650
1667
  const previousData = queryClient.getQueryData(queryKey);
1651
1668
  if (previousData) {
1652
1669
  queryClient.setQueryData(queryKey, previousData);
@@ -1875,8 +1892,7 @@ function useActivity({
1875
1892
  activityId: id,
1876
1893
  userId,
1877
1894
  courseId: activeAssignment?.courseId,
1878
- googleClassroomUserId: "",
1879
- // TODO
1895
+ googleClassroomUserId: user.profile.googleClassroomUserId,
1880
1896
  enabled: isAssignment ? assignmentQuery.isSuccess : querySet.isSuccess
1881
1897
  });
1882
1898
  const { mutationUpdateScore } = useUpdateScore();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speakableio/core",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Speakable-io/speakable-core.git"