placementt-core 1.20.232 → 1.300.4

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.
Files changed (101) hide show
  1. package/.eslintrc.js +40 -40
  2. package/.gitattributes +2 -2
  3. package/deploy-all.js +75 -0
  4. package/lib/config.d.ts +0 -13
  5. package/lib/config.js +1 -3
  6. package/lib/config.js.map +1 -1
  7. package/lib/constants.d.ts +1 -0
  8. package/lib/constants.js +48 -1
  9. package/lib/constants.js.map +1 -1
  10. package/lib/features/config.d.ts +133 -133
  11. package/lib/features/config.js +35 -35
  12. package/lib/features/contacts/contacts.d.ts +75 -75
  13. package/lib/features/contacts/contacts.js +105 -105
  14. package/lib/features/downtime/useDowntime.d.ts +11 -11
  15. package/lib/features/downtime/useDowntime.js +22 -22
  16. package/lib/features/placements/studentPlacements/activePlacement.js +1 -1
  17. package/lib/features/placements/studentPlacements/activePlacement.js.map +1 -1
  18. package/lib/features/placements/studentPlacements/studentPlacementsSlice.d.ts +63 -63
  19. package/lib/features/placements/studentPlacements/studentPlacementsSlice.js +81 -81
  20. package/lib/features/providerPlacements/providerPlacementsSlice.d.ts +19 -19
  21. package/lib/features/providerPlacements/providerPlacementsSlice.js +24 -24
  22. package/lib/features/studentPlacements/studentPlacementsSlice.d.ts +62 -62
  23. package/lib/features/studentPlacements/studentPlacementsSlice.js +87 -87
  24. package/lib/features/studentPlacements/useStudentPlacements.d.ts +6 -6
  25. package/lib/features/studentPlacements/useStudentPlacements.js +18 -18
  26. package/lib/features/userSlice.d.ts +26 -26
  27. package/lib/features/userSlice.js +23 -23
  28. package/lib/features/users/useUserFunctions.d.ts +25 -25
  29. package/lib/features/users/useUserFunctions.js +124 -124
  30. package/lib/features/users/userSlice.d.ts +46 -46
  31. package/lib/features/users/userSlice.js +48 -48
  32. package/lib/firebase/firebase.d.ts +1 -1
  33. package/lib/firebase/firebase.js +8 -3
  34. package/lib/firebase/firebase.js.map +1 -1
  35. package/lib/firebase/firebaseConfig.js +1 -0
  36. package/lib/firebase/firebaseConfig.js.map +1 -1
  37. package/lib/firebase/readDatabase.js +7 -7
  38. package/lib/firebase/readDatabase.js.map +1 -1
  39. package/lib/hooks.d.ts +85 -192
  40. package/lib/hooks.js +731 -671
  41. package/lib/hooks.js.map +1 -1
  42. package/lib/images/GatsbyBenchmarks.d.ts +1 -2
  43. package/lib/index.d.ts +0 -1
  44. package/lib/index.js +0 -1
  45. package/lib/index.js.map +1 -1
  46. package/lib/reduxHooks.d.ts +9 -41
  47. package/lib/reduxHooks.js +1 -49
  48. package/lib/reduxHooks.js.map +1 -1
  49. package/lib/tasksAndTips.js +368 -418
  50. package/lib/tasksAndTips.js.map +1 -1
  51. package/lib/typeDefinitions.d.ts +162 -83
  52. package/lib/util.d.ts +25 -1
  53. package/lib/util.js +329 -2
  54. package/lib/util.js.map +1 -1
  55. package/package.json +56 -56
  56. package/src/DatabaseDefinitions.ts +18 -18
  57. package/src/apiCalls.ts +128 -128
  58. package/src/config.ts +50 -53
  59. package/src/constants.ts +846 -796
  60. package/src/databaseTypes.ts +42 -42
  61. package/src/features/analytics/useAnalytics.tsx +63 -63
  62. package/src/features/contacts/contactsSlice.ts +147 -147
  63. package/src/features/contacts/useContacts.tsx +73 -73
  64. package/src/features/dropdown/useDropdown.tsx +52 -52
  65. package/src/features/global/downtime/useDowntime.tsx +23 -23
  66. package/src/features/global/users/useUserFunctions.tsx +132 -132
  67. package/src/features/jobs/jobsSlice.ts +71 -71
  68. package/src/features/placements/studentPlacements/activePlacement.ts +68 -68
  69. package/src/features/placements/studentPlacements/completedStudentPlacementsSlice.ts +97 -97
  70. package/src/features/placements/studentPlacements/upcomingStudentPlacementsSlice.ts +108 -108
  71. package/src/features/placements/studentPlacements/useStudentPlacements.tsx +9 -9
  72. package/src/features/placements/types.ts +10 -10
  73. package/src/features/referrals/useReferrals.tsx +56 -56
  74. package/src/features/updates/useUpdates.tsx +38 -38
  75. package/src/firebase/firebase.tsx +158 -153
  76. package/src/firebase/firebaseConfig.tsx +47 -45
  77. package/src/firebase/firebaseQuery.tsx +151 -151
  78. package/src/firebase/persistence.ts +84 -84
  79. package/src/firebase/readDatabase.tsx +236 -236
  80. package/src/firebase/util.tsx +352 -352
  81. package/src/firebase/writeDatabase.tsx +77 -77
  82. package/src/hooks.tsx +4476 -4463
  83. package/src/images/GatsbyBenchmarks.tsx +711 -711
  84. package/src/images/LogFuturePlacement.jsx +64 -64
  85. package/src/images/LogPreviousPlacement.jsx +228 -228
  86. package/src/images/gatsby_benchmarks.svg +466 -466
  87. package/src/images/log_future_placement.svg +114 -114
  88. package/src/images/log_previous_placement.svg +199 -199
  89. package/src/index.ts +34 -35
  90. package/src/readDatabase.tsx +3 -3
  91. package/src/reduxHooks.ts +295 -352
  92. package/src/tasksAndTips.ts +1267 -1267
  93. package/src/tutorialTips.ts +58 -58
  94. package/src/typeDefinitions.ts +1260 -1129
  95. package/src/util.ts +523 -177
  96. package/tsconfig.dev.json +5 -5
  97. package/tsconfig.json +21 -21
  98. package/lib/features/logs/logsSlice.d.ts +0 -93
  99. package/lib/features/logs/logsSlice.js +0 -146
  100. package/lib/features/logs/logsSlice.js.map +0 -1
  101. package/src/features/logs/logsSlice.ts +0 -208
@@ -1,57 +1,57 @@
1
- import { documentId, where } from "firebase/firestore";
2
- import { useState } from "react";
3
- import FirebaseQuery from "../../firebase/firebaseQuery";
4
- import { UserData } from "../../typeDefinitions";
5
-
6
- export function useReferrals({user}: {user: UserData}){
7
- const firebaseQuery = new FirebaseQuery();
8
- const [showNameConsent, setShowNameConsent] = useState<boolean>(user?.shareNameWithReferralLeaderboardConsent === undefined ? true : false);
9
-
10
- const getReferralCode = async (fiveLetterWords: string[]): Promise<string> => {
11
- var potentialWord = fiveLetterWords[Math.floor(Math.random()*fiveLetterWords.length)];
12
- const existingReferral = await firebaseQuery.getDocsWhere("referrals", where(documentId(), "==", potentialWord));
13
-
14
- if (Object.keys(existingReferral || {}).length > 0) {
15
- return await getReferralCode(fiveLetterWords);
16
- }
17
-
18
- await firebaseQuery.set(["referrals", potentialWord], {
19
- name: user?.id,
20
- expiry: new Date(2040,10,30),
21
- volume: 1000,
22
- product: "students"
23
-
24
- }).then(() => {
25
- if (!user) return;
26
- firebaseQuery.update(["users", user.id], {
27
- referralCode: potentialWord
28
- })
29
- //dispatch(updateUser({userId: user.id, attributes: {referralCode: potentialWord}}))
30
- // dispatch(setUser((state: UserData) => ({...state, referralCode: potentialWord})))
31
- })
32
-
33
- return potentialWord;
34
- }
35
-
36
- const consent = async (consent: boolean) => {
37
- if (!user) return
38
-
39
- try {
40
- await firebaseQuery.update(["users", user.id], {
41
- shareNameWithReferralLeaderboardConsent: consent,
42
- shareNameWithReferralLeaderboardConsentDate: (new Date()).toISOString()
43
- })
44
- // dispatch(updateUser({userId: user.id, attributes: {
45
- // shareNameWithReferralLeaderboardConsent: consent,
46
- // shareNameWithReferralLeaderboardConsentDate: (new Date()).toISOString()}
47
- // }))
48
- }
49
- catch(error) {
50
- console.log(error)
51
- }
52
- setShowNameConsent(false);
53
- }
54
-
55
- return ({...{getReferralCode, showNameConsent, setShowNameConsent, consent}})
56
-
1
+ import { documentId, where } from "firebase/firestore";
2
+ import { useState } from "react";
3
+ import FirebaseQuery from "../../firebase/firebaseQuery";
4
+ import { UserData } from "../../typeDefinitions";
5
+
6
+ export function useReferrals({user}: {user: UserData}){
7
+ const firebaseQuery = new FirebaseQuery();
8
+ const [showNameConsent, setShowNameConsent] = useState<boolean>(user?.shareNameWithReferralLeaderboardConsent === undefined ? true : false);
9
+
10
+ const getReferralCode = async (fiveLetterWords: string[]): Promise<string> => {
11
+ var potentialWord = fiveLetterWords[Math.floor(Math.random()*fiveLetterWords.length)];
12
+ const existingReferral = await firebaseQuery.getDocsWhere("referrals", where(documentId(), "==", potentialWord));
13
+
14
+ if (Object.keys(existingReferral || {}).length > 0) {
15
+ return await getReferralCode(fiveLetterWords);
16
+ }
17
+
18
+ await firebaseQuery.set(["referrals", potentialWord], {
19
+ name: user?.id,
20
+ expiry: new Date(2040,10,30),
21
+ volume: 1000,
22
+ product: "students"
23
+
24
+ }).then(() => {
25
+ if (!user) return;
26
+ firebaseQuery.update(["users", user.id], {
27
+ referralCode: potentialWord
28
+ })
29
+ //dispatch(updateUser({userId: user.id, attributes: {referralCode: potentialWord}}))
30
+ // dispatch(setUser((state: UserData) => ({...state, referralCode: potentialWord})))
31
+ })
32
+
33
+ return potentialWord;
34
+ }
35
+
36
+ const consent = async (consent: boolean) => {
37
+ if (!user) return
38
+
39
+ try {
40
+ await firebaseQuery.update(["users", user.id], {
41
+ shareNameWithReferralLeaderboardConsent: consent,
42
+ shareNameWithReferralLeaderboardConsentDate: (new Date()).toISOString()
43
+ })
44
+ // dispatch(updateUser({userId: user.id, attributes: {
45
+ // shareNameWithReferralLeaderboardConsent: consent,
46
+ // shareNameWithReferralLeaderboardConsentDate: (new Date()).toISOString()}
47
+ // }))
48
+ }
49
+ catch(error) {
50
+ console.log(error)
51
+ }
52
+ setShowNameConsent(false);
53
+ }
54
+
55
+ return ({...{getReferralCode, showNameConsent, setShowNameConsent, consent}})
56
+
57
57
  }
@@ -1,38 +1,38 @@
1
- import FirebaseQuery from "../../firebase/firebaseQuery";
2
- import {orderBy, limit, arrayUnion} from "firebase/firestore";
3
- import {useState} from "react";
4
- import { UserData } from "../../typeDefinitions";
5
-
6
- export function useUpdates({user}: {user: UserData}){
7
- const [active, setActive] = useState<{title: string, body: string, id: string}>();
8
- const firebaseQuery = new FirebaseQuery();
9
-
10
- const fetchUpdates = async () => {
11
- try {
12
- const docs = await firebaseQuery.getDocsWhere("updates", [orderBy("created", "desc"), limit(1)])
13
- const item = Object.values(docs as {[key:string]: {title: string, body: string, id: string}})[0];
14
- if (!user?.readUpdates?.includes(item.id)) setActive(item);
15
-
16
- } catch(error) {
17
- console.log(error)
18
- }
19
-
20
- }
21
-
22
-
23
- const dismiss = () => {
24
- if (!user) return
25
-
26
- try {
27
- firebaseQuery.update(["users", user.id], {readUpdates: arrayUnion(active?.id)})
28
- //dispatch(updateUser({userId: user.id, attributes: {readUpdates: arrayUnion(active?.id)}}))
29
- setActive(undefined);
30
- }
31
- catch(error) {
32
- console.log(error)
33
- }
34
- }
35
-
36
- return ({...{active, dismiss, fetchUpdates}})
37
-
38
- }
1
+ import FirebaseQuery from "../../firebase/firebaseQuery";
2
+ import {orderBy, limit, arrayUnion} from "firebase/firestore";
3
+ import {useState} from "react";
4
+ import { UserData } from "../../typeDefinitions";
5
+
6
+ export function useUpdates({user}: {user: UserData}){
7
+ const [active, setActive] = useState<{title: string, body: string, id: string}>();
8
+ const firebaseQuery = new FirebaseQuery();
9
+
10
+ const fetchUpdates = async () => {
11
+ try {
12
+ const docs = await firebaseQuery.getDocsWhere("updates", [orderBy("created", "desc"), limit(1)])
13
+ const item = Object.values(docs as {[key:string]: {title: string, body: string, id: string}})[0];
14
+ if (!user?.readUpdates?.includes(item.id)) setActive(item);
15
+
16
+ } catch(error) {
17
+ console.log(error)
18
+ }
19
+
20
+ }
21
+
22
+
23
+ const dismiss = () => {
24
+ if (!user) return
25
+
26
+ try {
27
+ firebaseQuery.update(["users", user.id], {readUpdates: arrayUnion(active?.id)})
28
+ //dispatch(updateUser({userId: user.id, attributes: {readUpdates: arrayUnion(active?.id)}}))
29
+ setActive(undefined);
30
+ }
31
+ catch(error) {
32
+ console.log(error)
33
+ }
34
+ }
35
+
36
+ return ({...{active, dismiss, fetchUpdates}})
37
+
38
+ }
@@ -1,153 +1,158 @@
1
- import {onAuthStateChanged, signInWithEmailAndPassword} from "firebase/auth";
2
- import {httpsCallable} from "firebase/functions";
3
- import {SetStateAction} from "react";
4
- import {getUser} from "./readDatabase";
5
- import {UserData} from "../typeDefinitions";
6
- import FirebaseQuery from "./firebaseQuery";
7
- import {auth, functions} from "./firebaseConfig";
8
- import {addJob, Job, updateJob} from "../features/jobs/jobsSlice";
9
- import { useAppDispatch } from "../reduxHooks";
10
-
11
-
12
- export const authListener = (setUser: SetStateAction<any>) => {
13
- return onAuthStateChanged(auth, (aUser) => {
14
- if (!aUser) {
15
- console.log("User not logged in.");
16
- setUser(false)
17
- return;
18
- }
19
- console.log("User logged in.");
20
- if (!aUser.email) {
21
- setUser(false);
22
- return;
23
- };
24
- getUser(aUser.uid, setUser);
25
- });
26
- };
27
-
28
- export const login = async (credentials: {email: string, password: string}) => {
29
- return signInWithEmailAndPassword(auth, credentials.email, credentials.password);
30
- };
31
-
32
- export type RegistrationData = {
33
- email: string,
34
- passwordOne: string,
35
- instituteName: string,
36
- "address-line1": string,
37
- "address-line2": string,
38
- locality: string,
39
- postal_code: string,
40
- country: string,
41
- first_name: string,
42
- family_name: string
43
- }
44
-
45
- export const register = async (credentials: RegistrationData, type:"Institute"|"Provider"|"Student") => {
46
- return await executeCallable(`registration-register${type}`, credentials).catch((e) => {
47
- console.log("Error in regsiter", e);
48
- throw e;
49
- }).then(async (res) => {
50
- if (type === "Student") {
51
- await login({email: credentials.email, password: credentials.passwordOne});
52
- }
53
- return (res.data as { msg: {uid: string}}).msg.uid as string;
54
- });
55
- };
56
-
57
- export const executeCallable = async (functionName: string, data: unknown) => {
58
- const funcCallable = httpsCallable(functions, functionName);
59
- const res = await funcCallable(data).catch((e) => {
60
- console.log("callableError", functionName, e);
61
- throw e;
62
- });
63
-
64
- return res as {data: any};
65
- };
66
-
67
-
68
- export function useExecuteCallableJob({user}:{user: UserData}) {
69
- type CallableFunctionJobs = "userManagement-addUsers"|"userManagement-activateUsers"|
70
- "userManagement-deactivateUsers"|"userManagement-deleteUsers"|"admissions-createCohort"|"userManagement-uploadAnalytics"|
71
- "placementListing-add"|"userManagement-sendParentWelcomeEmail"
72
- const dispatch = useAppDispatch();
73
-
74
- const execute = async (functionName:CallableFunctionJobs, data:{[key:string]:unknown}) => {
75
- const getCode = () => {
76
- switch (functionName) {
77
- case "userManagement-addUsers":
78
- return {
79
- title: "Add users",
80
- description: `Adding ${(data as {users:unknown[]}).users.length} ${(data as {userType:string}).userType.toLowerCase()}`,
81
- };
82
- case "userManagement-activateUsers":
83
- return {
84
- title: "Activating users",
85
- description: `Attempting activation of ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
86
- "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length} users.`,
87
- };
88
- case "userManagement-deactivateUsers":
89
- return {
90
- title: "Deactivating users",
91
- description: `Deactivating ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
92
- "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length || "multiple"} users.`,
93
- };
94
- case "userManagement-deleteUsers":
95
- return {
96
- title: "Deleting users",
97
- description: `Attempting deletion of ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
98
- "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length || "multiple"} users.`,
99
- };
100
- case "placementListing-add":
101
- return {
102
- title: "Adding placements",
103
- description: `Attempting addition of ${(data as {data:[]}).data.length} placements`,
104
- };
105
- case "userManagement-sendParentWelcomeEmail":
106
- return {
107
- title: "Sending parent welcome emails",
108
- description: `Sending parent welcome emails to ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
109
- "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length || "multiple"} users.`,
110
- };
111
- default:
112
- return;
113
- }
114
- };
115
-
116
- const date = new Date();
117
- const firebaseQuery = new FirebaseQuery();
118
-
119
- const jobObject = {
120
- title: getCode()?.title,
121
- description: getCode()?.description,
122
- status: "processing",
123
- viewedBy: [],
124
- started: date.toISOString(),
125
- updated: date.toISOString(),
126
- oId: user.oId,
127
- product: user.product,
128
- };
129
-
130
- const jobId = (await firebaseQuery.add(["jobs"], jobObject)).id;
131
-
132
- console.log("jobId", jobId);
133
- dispatch(addJob({
134
- jobId: jobId,
135
- job: jobObject,
136
- }));
137
-
138
- const items = {...data, jobId: jobId};
139
-
140
- const funcCallable = httpsCallable(functions, functionName);
141
- console.log(items);
142
- funcCallable(items).then(async () => {
143
- const jobResolved = await firebaseQuery.getDocData(["jobs", jobId]) as Job;
144
- dispatch(updateJob({
145
- jobId: jobId,
146
- data: jobResolved
147
- } as Partial<Job>));
148
- });
149
- return jobId;
150
- };
151
-
152
- return {execute};
153
- }
1
+ import {onAuthStateChanged, signInWithEmailAndPassword} from "firebase/auth";
2
+ import {httpsCallable} from "firebase/functions";
3
+ import {SetStateAction} from "react";
4
+ import {getUser} from "./readDatabase";
5
+ import {ExternalEvent, UserData} from "../typeDefinitions";
6
+ import FirebaseQuery from "./firebaseQuery";
7
+ import {auth, functions} from "./firebaseConfig";
8
+ import {addJob, Job, updateJob} from "../features/jobs/jobsSlice";
9
+ import { useAppDispatch } from "../reduxHooks";
10
+
11
+
12
+ export const authListener = (setUser: SetStateAction<any>) => {
13
+ return onAuthStateChanged(auth, (aUser) => {
14
+ if (!aUser) {
15
+ console.log("User not logged in.");
16
+ setUser(false)
17
+ return;
18
+ }
19
+ console.log("User logged in.");
20
+ if (!aUser.email) {
21
+ setUser(false);
22
+ return;
23
+ };
24
+ getUser(aUser.uid, setUser);
25
+ });
26
+ };
27
+
28
+ export const login = async (credentials: {email: string, password: string}) => {
29
+ return signInWithEmailAndPassword(auth, credentials.email, credentials.password);
30
+ };
31
+
32
+ export type RegistrationData = {
33
+ email: string,
34
+ passwordOne: string,
35
+ instituteName: string,
36
+ "address-line1": string,
37
+ "address-line2": string,
38
+ locality: string,
39
+ postal_code: string,
40
+ country: string,
41
+ first_name: string,
42
+ family_name: string
43
+ }
44
+
45
+ export const register = async (credentials: RegistrationData, type:"Institute"|"Provider"|"Student") => {
46
+ return await executeCallable(`registration-register${type}`, credentials).catch((e) => {
47
+ console.log("Error in regsiter", e);
48
+ throw e;
49
+ }).then(async (res) => {
50
+ if (type === "Student") {
51
+ await login({email: credentials.email, password: credentials.passwordOne});
52
+ }
53
+ return (res.data as { msg: {uid: string}}).msg.uid as string;
54
+ });
55
+ };
56
+
57
+ export const executeCallable = async (functionName: string, data: unknown) => {
58
+ const funcCallable = httpsCallable(functions, functionName);
59
+ const res = await funcCallable(data).catch((e) => {
60
+ console.log("callableError", functionName, e);
61
+ throw e;
62
+ });
63
+
64
+ return res as {data: any};
65
+ };
66
+
67
+
68
+ export function useExecuteCallableJob({user}:{user: UserData}) {
69
+ type CallableFunctionJobs = "userManagement-addUsers"|"userManagement-activateUsers"|
70
+ "userManagement-deactivateUsers"|"userManagement-deleteUsers"|"admissions-createCohort"|"userManagement-uploadAnalytics"|
71
+ "providerContacts-add"|"userManagement-sendParentWelcomeEmail"|"events-sendExternalEventInvites"
72
+ const dispatch = useAppDispatch();
73
+
74
+ const execute = async (functionName:CallableFunctionJobs, data:{[key:string]:unknown}) => {
75
+ const getCode = () => {
76
+ switch (functionName) {
77
+ case "userManagement-addUsers":
78
+ return {
79
+ title: "Add users",
80
+ description: `Adding ${(data as {users:unknown[]}).users.length} ${(data as {userType:string}).userType.toLowerCase()}`,
81
+ };
82
+ case "userManagement-activateUsers":
83
+ return {
84
+ title: "Activating users",
85
+ description: `Attempting activation of ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
86
+ "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length} users.`,
87
+ };
88
+ case "userManagement-deactivateUsers":
89
+ return {
90
+ title: "Deactivating users",
91
+ description: `Deactivating ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
92
+ "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length || "multiple"} users.`,
93
+ };
94
+ case "userManagement-deleteUsers":
95
+ return {
96
+ title: "Deleting users",
97
+ description: `Attempting deletion of ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
98
+ "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length || "multiple"} users.`,
99
+ };
100
+ case "providerContacts-add":
101
+ return {
102
+ title: "Adding employer contacts",
103
+ description: `Attempting addition of ${(data as {providerContacts:[]}).providerContacts.length} employer contacts`,
104
+ };
105
+ case "userManagement-sendParentWelcomeEmail":
106
+ return {
107
+ title: "Sending parent welcome emails",
108
+ description: `Sending parent welcome emails to ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
109
+ "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length || "multiple"} users.`,
110
+ };
111
+ case "events-sendExternalEventInvites":
112
+ return {
113
+ title: `Sending email invites for event: ${(data as {data:Partial<ExternalEvent>}).data.name}`,
114
+ description: `Sending email invites for your event: '${(data as {data:Partial<ExternalEvent>}).data.name}'. Check the event page to view email interactions.`,
115
+ };
116
+ default:
117
+ return;
118
+ }
119
+ };
120
+
121
+ const date = new Date();
122
+ const firebaseQuery = new FirebaseQuery();
123
+
124
+ const jobObject = {
125
+ title: getCode()?.title,
126
+ description: getCode()?.description,
127
+ status: "processing",
128
+ viewedBy: [],
129
+ started: date.toISOString(),
130
+ updated: date.toISOString(),
131
+ oId: user.oId,
132
+ product: user.product,
133
+ };
134
+
135
+ const jobId = (await firebaseQuery.add(["jobs"], jobObject)).id;
136
+
137
+ console.log("jobId", jobId);
138
+ dispatch(addJob({
139
+ jobId: jobId,
140
+ job: jobObject,
141
+ }));
142
+
143
+ const items = {...data, jobId: jobId};
144
+
145
+ const funcCallable = httpsCallable(functions, functionName);
146
+ console.log(items);
147
+ funcCallable(items).then(async () => {
148
+ const jobResolved = await firebaseQuery.getDocData(["jobs", jobId]) as Job;
149
+ dispatch(updateJob({
150
+ jobId: jobId,
151
+ data: jobResolved
152
+ } as Partial<Job>));
153
+ });
154
+ return jobId;
155
+ };
156
+
157
+ return {execute};
158
+ }
@@ -1,45 +1,47 @@
1
- /* eslint-disable no-multiple-empty-lines */
2
- import AsyncStorage from "@react-native-async-storage/async-storage";
3
- import {getApp, getApps, initializeApp} from "firebase/app";
4
- import {getAuth, initializeAuth} from "firebase/auth";
5
- import {getFirestore, initializeFirestore} from "firebase/firestore";
6
- import {getFunctions} from "firebase/functions";
7
- import {getStorage} from "firebase/storage";
8
- import {getReactNativePersistence} from "./persistence";
9
-
10
- export const credentialsDev = {
11
- apiKey: "AIzaSyBpGWwNsYsitD-yer3bS0jPe1jZgDCvfYI",
12
- authDomain: "placementt-dev.firebaseapp.com",
13
- projectId: "placementt-dev",
14
- storageBucket: "placementt-dev.appspot.com",
15
- messagingSenderId: "735359304180",
16
- appId: "1:735359304180:web:0ffd3bb86db13e140339a1",
17
- measurementId: "G-F34T7Y8YYT"
18
- };
19
-
20
- export const credentialsProd = {
21
- apiKey: "AIzaSyBOSSi4iHxOoAS9tLAJUAC_46HlZ6-D5Ss",
22
- authDomain: "placementt-dfa17.firebaseapp.com",
23
- projectId: "placementt-dfa17",
24
- storageBucket: "placementt-dfa17.appspot.com",
25
- messagingSenderId: "728019353765",
26
- appId: "1:728019353765:web:954b5547d62a6dd6a64d4c",
27
- measurementId: "G-NW5YMC6JN8",
28
- };
29
-
30
- const firebaseConfig = !getApps().length ? initializeApp(process.env.NODE_ENV === "development" ? credentialsDev : credentialsProd) : getApp();
31
-
32
- initializeAuth(firebaseConfig, {
33
- persistence: getReactNativePersistence(AsyncStorage),
34
- });
35
-
36
- initializeFirestore(firebaseConfig, {
37
- ignoreUndefinedProperties: true,
38
- });
39
-
40
- export const auth = getAuth(firebaseConfig);
41
- export const db = getFirestore(firebaseConfig);
42
- export const functions = getFunctions(firebaseConfig, "europe-west2");
43
- export const storage = getStorage(firebaseConfig);
44
-
45
-
1
+ /* eslint-disable no-multiple-empty-lines */
2
+ import AsyncStorage from "@react-native-async-storage/async-storage";
3
+ import {getApp, getApps, initializeApp} from "firebase/app";
4
+ import {getAuth, initializeAuth} from "firebase/auth";
5
+ import {getFirestore, initializeFirestore} from "firebase/firestore";
6
+ import {connectFunctionsEmulator, getFunctions} from "firebase/functions";
7
+ import {getStorage} from "firebase/storage";
8
+ import {getReactNativePersistence} from "./persistence";
9
+
10
+ export const credentialsDev = {
11
+ apiKey: "AIzaSyBpGWwNsYsitD-yer3bS0jPe1jZgDCvfYI",
12
+ authDomain: "placementt-dev.firebaseapp.com",
13
+ projectId: "placementt-dev",
14
+ storageBucket: "placementt-dev.appspot.com",
15
+ messagingSenderId: "735359304180",
16
+ appId: "1:735359304180:web:0ffd3bb86db13e140339a1",
17
+ measurementId: "G-F34T7Y8YYT"
18
+ };
19
+
20
+ export const credentialsProd = {
21
+ apiKey: "AIzaSyBOSSi4iHxOoAS9tLAJUAC_46HlZ6-D5Ss",
22
+ authDomain: "placementt-dfa17.firebaseapp.com",
23
+ projectId: "placementt-dfa17",
24
+ storageBucket: "placementt-dfa17.appspot.com",
25
+ messagingSenderId: "728019353765",
26
+ appId: "1:728019353765:web:954b5547d62a6dd6a64d4c",
27
+ measurementId: "G-NW5YMC6JN8",
28
+ };
29
+
30
+ const firebaseConfig = !getApps().length ? initializeApp(process.env.NODE_ENV === "development" ? credentialsDev : credentialsProd) : getApp();
31
+
32
+ initializeAuth(firebaseConfig, {
33
+ persistence: getReactNativePersistence(AsyncStorage),
34
+ });
35
+
36
+ initializeFirestore(firebaseConfig, {
37
+ ignoreUndefinedProperties: true,
38
+ });
39
+
40
+ export const auth = getAuth(firebaseConfig);
41
+ export const db = getFirestore(firebaseConfig);
42
+ export const functions = getFunctions(firebaseConfig, "europe-west2");
43
+ export const storage = getStorage(firebaseConfig);
44
+
45
+ connectFunctionsEmulator(functions, "localhost", 400);
46
+
47
+