placementt-core 1.20.196 → 11.0.533

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 (135) hide show
  1. package/.eslintrc.js +40 -40
  2. package/.gitattributes +2 -2
  3. package/lib/config.d.ts +0 -1
  4. package/lib/constants.d.ts +5 -2
  5. package/lib/constants.js +130 -136
  6. package/lib/constants.js.map +1 -1
  7. package/lib/features/analytics/useAnalytics.d.ts +0 -1
  8. package/lib/features/analytics/useAnalytics.js +3 -4
  9. package/lib/features/analytics/useAnalytics.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/contacts/contactsSlice.d.ts +5 -5
  15. package/lib/features/contacts/useContacts.js +1 -2
  16. package/lib/features/contacts/useContacts.js.map +1 -1
  17. package/lib/features/downtime/useDowntime.d.ts +11 -11
  18. package/lib/features/downtime/useDowntime.js +22 -22
  19. package/lib/features/dropdown/useDropdown.d.ts +2 -3
  20. package/lib/features/dropdown/useDropdown.js +1 -2
  21. package/lib/features/dropdown/useDropdown.js.map +1 -1
  22. package/lib/features/global/downtime/useDowntime.d.ts +0 -1
  23. package/lib/features/global/downtime/useDowntime.js +3 -2
  24. package/lib/features/global/downtime/useDowntime.js.map +1 -1
  25. package/lib/features/global/users/useUserFunctions.d.ts +0 -1
  26. package/lib/features/global/users/useUserFunctions.js +6 -7
  27. package/lib/features/global/users/useUserFunctions.js.map +1 -1
  28. package/lib/features/placements/studentPlacements/activePlacement.d.ts +1 -1
  29. package/lib/features/placements/studentPlacements/activePlacement.js +1 -1
  30. package/lib/features/placements/studentPlacements/activePlacement.js.map +1 -1
  31. package/lib/features/placements/studentPlacements/completedStudentPlacementsSlice.d.ts +4 -5
  32. package/lib/features/placements/studentPlacements/completedStudentPlacementsSlice.js +1 -4
  33. package/lib/features/placements/studentPlacements/completedStudentPlacementsSlice.js.map +1 -1
  34. package/lib/features/placements/studentPlacements/studentPlacementsSlice.d.ts +63 -63
  35. package/lib/features/placements/studentPlacements/studentPlacementsSlice.js +81 -81
  36. package/lib/features/placements/studentPlacements/upcomingStudentPlacementsSlice.d.ts +4 -4
  37. package/lib/features/placements/studentPlacements/upcomingStudentPlacementsSlice.js +1 -1
  38. package/lib/features/placements/studentPlacements/upcomingStudentPlacementsSlice.js.map +1 -1
  39. package/lib/features/placements/studentPlacements/useStudentPlacements.d.ts +0 -1
  40. package/lib/features/placements/studentPlacements/useStudentPlacements.js +1 -2
  41. package/lib/features/placements/studentPlacements/useStudentPlacements.js.map +1 -1
  42. package/lib/features/providerPlacements/providerPlacementsSlice.d.ts +19 -19
  43. package/lib/features/providerPlacements/providerPlacementsSlice.js +24 -24
  44. package/lib/features/referrals/useReferrals.d.ts +0 -1
  45. package/lib/features/referrals/useReferrals.js +1 -2
  46. package/lib/features/referrals/useReferrals.js.map +1 -1
  47. package/lib/features/studentPlacements/studentPlacementsSlice.d.ts +62 -62
  48. package/lib/features/studentPlacements/studentPlacementsSlice.js +87 -87
  49. package/lib/features/studentPlacements/useStudentPlacements.d.ts +6 -6
  50. package/lib/features/studentPlacements/useStudentPlacements.js +18 -18
  51. package/lib/features/updates/useUpdates.js +1 -2
  52. package/lib/features/updates/useUpdates.js.map +1 -1
  53. package/lib/features/userSlice.d.ts +26 -26
  54. package/lib/features/userSlice.js +23 -23
  55. package/lib/features/users/useUserFunctions.d.ts +25 -25
  56. package/lib/features/users/useUserFunctions.js +124 -124
  57. package/lib/features/users/userSlice.d.ts +46 -46
  58. package/lib/features/users/userSlice.js +48 -48
  59. package/lib/firebase/firebase.d.ts +1 -1
  60. package/lib/firebase/firebase.js +9 -4
  61. package/lib/firebase/firebase.js.map +1 -1
  62. package/lib/firebase/firebaseConfig.js +3 -0
  63. package/lib/firebase/firebaseConfig.js.map +1 -1
  64. package/lib/firebase/firebaseQuery.js +3 -0
  65. package/lib/firebase/firebaseQuery.js.map +1 -1
  66. package/lib/firebase/persistence.js +2 -2
  67. package/lib/firebase/persistence.js.map +1 -1
  68. package/lib/firebase/readDatabase.d.ts +9 -6
  69. package/lib/firebase/readDatabase.js +16 -6
  70. package/lib/firebase/readDatabase.js.map +1 -1
  71. package/lib/firebase/util.d.ts +3 -4
  72. package/lib/firebase/util.js +49 -4
  73. package/lib/firebase/util.js.map +1 -1
  74. package/lib/firebase/writeDatabase.d.ts +3 -3
  75. package/lib/firebase/writeDatabase.js +7 -1
  76. package/lib/firebase/writeDatabase.js.map +1 -1
  77. package/lib/hooks.d.ts +384 -23
  78. package/lib/hooks.js +1342 -223
  79. package/lib/hooks.js.map +1 -1
  80. package/lib/images/GatsbyBenchmarks.d.ts +0 -1
  81. package/lib/images/GatsbyBenchmarks.js +1 -1
  82. package/lib/images/GatsbyBenchmarks.js.map +1 -1
  83. package/lib/reduxHooks.d.ts +11 -20
  84. package/lib/reduxHooks.js +28 -18
  85. package/lib/reduxHooks.js.map +1 -1
  86. package/lib/tasksAndTips.d.ts +25 -5
  87. package/lib/tasksAndTips.js +346 -48
  88. package/lib/tasksAndTips.js.map +1 -1
  89. package/lib/typeDefinitions.d.ts +478 -53
  90. package/lib/util.d.ts +1 -0
  91. package/lib/util.js +78 -6
  92. package/lib/util.js.map +1 -1
  93. package/package.json +52 -49
  94. package/src/DatabaseDefinitions.ts +18 -18
  95. package/src/apiCalls.ts +128 -128
  96. package/src/config.ts +50 -50
  97. package/src/constants.ts +708 -707
  98. package/src/databaseTypes.ts +42 -42
  99. package/src/features/analytics/useAnalytics.tsx +55 -55
  100. package/src/features/contacts/contactsSlice.ts +147 -147
  101. package/src/features/contacts/useContacts.tsx +73 -73
  102. package/src/features/dropdown/useDropdown.tsx +52 -52
  103. package/src/features/global/downtime/useDowntime.tsx +19 -18
  104. package/src/features/global/users/useUserFunctions.tsx +132 -132
  105. package/src/features/jobs/jobsSlice.ts +65 -65
  106. package/src/features/placements/studentPlacements/activePlacement.ts +63 -63
  107. package/src/features/placements/studentPlacements/completedStudentPlacementsSlice.ts +94 -97
  108. package/src/features/placements/studentPlacements/upcomingStudentPlacementsSlice.ts +108 -108
  109. package/src/features/placements/studentPlacements/useStudentPlacements.tsx +33 -33
  110. package/src/features/placements/types.ts +10 -10
  111. package/src/features/referrals/useReferrals.tsx +56 -56
  112. package/src/features/updates/useUpdates.tsx +36 -36
  113. package/src/firebase/firebase.tsx +142 -138
  114. package/src/firebase/firebaseConfig.tsx +45 -42
  115. package/src/firebase/firebaseQuery.tsx +143 -140
  116. package/src/firebase/persistence.ts +84 -84
  117. package/src/firebase/readDatabase.tsx +208 -197
  118. package/src/firebase/util.tsx +352 -308
  119. package/src/firebase/writeDatabase.tsx +75 -68
  120. package/src/hooks.tsx +3395 -1943
  121. package/src/images/GatsbyBenchmarks.tsx +711 -711
  122. package/src/images/LogFuturePlacement.jsx +64 -64
  123. package/src/images/LogPreviousPlacement.jsx +228 -228
  124. package/src/images/gatsby_benchmarks.svg +466 -466
  125. package/src/images/log_future_placement.svg +114 -114
  126. package/src/images/log_previous_placement.svg +199 -199
  127. package/src/index.ts +34 -34
  128. package/src/readDatabase.tsx +3 -3
  129. package/src/reduxHooks.ts +183 -170
  130. package/src/tasksAndTips.ts +744 -410
  131. package/src/tutorialTips.ts +58 -58
  132. package/src/typeDefinitions.ts +899 -503
  133. package/src/util.ts +132 -47
  134. package/tsconfig.dev.json +5 -5
  135. package/tsconfig.json +21 -21
@@ -1,36 +1,36 @@
1
- import FirebaseQuery from "../../firebase/firebaseQuery";
2
- import {orderBy, limit, arrayUnion} from "firebase/firestore";
3
- import {useState, useEffect} 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
- useEffect(() => {
11
- setTimeout(() => {
12
- firebaseQuery.getDocsWhere("updates", [orderBy("created", "desc"), limit(1)]).then((result) => {
13
- const item = Object.values(result as {[key:string]: {title: string, body: string, id: string}})[0];
14
- if (!user?.readUpdates?.includes(item.id)) {
15
- setActive(item);
16
- }
17
- })
18
- }, 1000);
19
- }, []);
20
-
21
- const dismiss = () => {
22
- if (!user) return
23
-
24
- try {
25
- firebaseQuery.update(["users", user.id], {readUpdates: arrayUnion(active?.id)})
26
- //dispatch(updateUser({userId: user.id, attributes: {readUpdates: arrayUnion(active?.id)}}))
27
- setActive(undefined);
28
- }
29
- catch(error) {
30
- console.log(error)
31
- }
32
- }
33
-
34
- return ({...{active, dismiss}})
35
-
36
- }
1
+ import FirebaseQuery from "../../firebase/firebaseQuery";
2
+ import {orderBy, limit, arrayUnion} from "firebase/firestore";
3
+ import {useState, useEffect} 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
+ useEffect(() => {
11
+ setTimeout(() => {
12
+ firebaseQuery.getDocsWhere("updates", [orderBy("created", "desc"), limit(1)]).then((result) => {
13
+ const item = Object.values(result as {[key:string]: {title: string, body: string, id: string}})[0];
14
+ if (!user?.readUpdates?.includes(item.id)) {
15
+ setActive(item);
16
+ }
17
+ })
18
+ }, 1000);
19
+ }, []);
20
+
21
+ const dismiss = () => {
22
+ if (!user) return
23
+
24
+ try {
25
+ firebaseQuery.update(["users", user.id], {readUpdates: arrayUnion(active?.id)})
26
+ //dispatch(updateUser({userId: user.id, attributes: {readUpdates: arrayUnion(active?.id)}}))
27
+ setActive(undefined);
28
+ }
29
+ catch(error) {
30
+ console.log(error)
31
+ }
32
+ }
33
+
34
+ return ({...{active, dismiss}})
35
+
36
+ }
@@ -1,138 +1,142 @@
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, setJobStatus} 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
- setUser(false)
16
- return;
17
- }
18
-
19
- getUser(aUser.uid, setUser);
20
- });
21
- };
22
-
23
- export const login = async (credentials: {email: string, password: string}) => {
24
- console.log("creds", credentials);
25
- return signInWithEmailAndPassword(auth, credentials.email, credentials.password);
26
- };
27
-
28
- export type RegistrationData = {
29
- email: string,
30
- passwordOne: string,
31
- instituteName: string,
32
- "address-line1": string,
33
- "address-line2": string,
34
- locality: string,
35
- postal_code: string,
36
- country: string,
37
- first_name: string,
38
- family_name: string
39
- }
40
-
41
- export const register = async (credentials: RegistrationData, type:"Institute"|"Provider"|"Student") => {
42
- console.log("creds", credentials);
43
- return await executeCallable(`registration-register${type}`, credentials).catch((e) => {
44
- console.log("Error in regsiter", e);
45
- throw e;
46
- }).then(async (res) => {
47
- if (type === "Student") {
48
- await login({email: credentials.email, password: credentials.passwordOne});
49
- }
50
- return (res.data as {msg: {uid: string}}).msg.uid as string;
51
- });
52
- };
53
-
54
- export const executeCallable = async (functionName: string, data: unknown) => {
55
- const funcCallable = httpsCallable(functions, functionName);
56
- return await funcCallable(data);
57
- };
58
-
59
-
60
- export function useExecuteCallableJob({user}:{user: UserData}) {
61
- type CallableFunctionJobs = "userManagement-addUsers"|"userManagement-activateUsers"|
62
- "userManagement-deactivateUsers"|"userManagement-deleteUsers"|"admissions-createCohort"|"userManagement-uploadAnalytics"|
63
- "placementListing-add"
64
- const dispatch = useAppDispatch();
65
-
66
- const execute = async (functionName:CallableFunctionJobs, data:{[key:string]:unknown}) => {
67
- const getCode = () => {
68
- switch (functionName) {
69
- case "userManagement-addUsers":
70
- return {
71
- title: "Add users",
72
- description: `Adding ${(data as {users:unknown[]}).users.length} ${(data as {userType:string}).userType.toLowerCase()}`,
73
- };
74
- case "userManagement-activateUsers":
75
- return {
76
- title: "Activating users",
77
- description: `Attempting activation of ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
78
- "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length} users.`,
79
- };
80
- case "userManagement-deactivateUsers":
81
- return {
82
- title: "Deactivating users",
83
- description: `Deactivating ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
84
- "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length || "multiple"} users.`,
85
- };
86
- case "userManagement-deleteUsers":
87
- return {
88
- title: "Deleting users",
89
- description: `Attempting deletion of ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
90
- "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length || "multiple"} users.`,
91
- };
92
- case "placementListing-add":
93
- return {
94
- title: "Adding placements",
95
- description: `Attempting addition of ${(data as {data:[]}).data.length} placements`,
96
- };
97
- default:
98
- return;
99
- }
100
- };
101
-
102
- const date = new Date();
103
- const firebaseQuery = new FirebaseQuery();
104
-
105
- const jobObject = {
106
- title: getCode()?.title,
107
- description: getCode()?.description,
108
- status: "processing",
109
- viewedBy: [],
110
- started: date.toISOString(),
111
- updated: date.toISOString(),
112
- oId: user.oId,
113
- product: user.product,
114
- };
115
-
116
- const jobId = (await firebaseQuery.add(["jobs"], jobObject)).id;
117
-
118
- console.log("jobId", jobId);
119
- dispatch(addJob({
120
- jobId: jobId,
121
- job: jobObject,
122
- }));
123
-
124
- const items = {...data, jobId: jobId};
125
-
126
- const funcCallable = httpsCallable(functions, functionName);
127
- console.log(items);
128
- funcCallable(items).then(() => {
129
- dispatch(setJobStatus({
130
- jobId: jobId,
131
- status: "success",
132
- }));
133
- });
134
- return;
135
- };
136
-
137
- return {execute};
138
- }
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, setJobStatus} 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
+ getUser(aUser.uid, setUser);
21
+ });
22
+ };
23
+
24
+ export const login = async (credentials: {email: string, password: string}) => {
25
+ console.log("creds", credentials);
26
+ return signInWithEmailAndPassword(auth, credentials.email, credentials.password);
27
+ };
28
+
29
+ export type RegistrationData = {
30
+ email: string,
31
+ passwordOne: string,
32
+ instituteName: string,
33
+ "address-line1": string,
34
+ "address-line2": string,
35
+ locality: string,
36
+ postal_code: string,
37
+ country: string,
38
+ first_name: string,
39
+ family_name: string
40
+ }
41
+
42
+ export const register = async (credentials: RegistrationData, type:"Institute"|"Provider"|"Student") => {
43
+ console.log("creds", credentials);
44
+ return await executeCallable(`registration-register${type}`, credentials).catch((e) => {
45
+ console.log("Error in regsiter", e);
46
+ throw e;
47
+ }).then(async (res) => {
48
+ if (type === "Student") {
49
+ await login({email: credentials.email, password: credentials.passwordOne});
50
+ }
51
+ return (res.data as { message: {uid: string}}).message.uid as string;
52
+ });
53
+ };
54
+
55
+ export const executeCallable = async (functionName: string, data: unknown) => {
56
+ const funcCallable = httpsCallable(functions, functionName);
57
+ return await funcCallable(data).catch((e) => {
58
+ console.log("callableError", functionName, e);
59
+ return e;
60
+ });
61
+ };
62
+
63
+
64
+ export function useExecuteCallableJob({user}:{user: UserData}) {
65
+ type CallableFunctionJobs = "userManagement-addUsers"|"userManagement-activateUsers"|
66
+ "userManagement-deactivateUsers"|"userManagement-deleteUsers"|"admissions-createCohort"|"userManagement-uploadAnalytics"|
67
+ "placementListing-add"
68
+ const dispatch = useAppDispatch();
69
+
70
+ const execute = async (functionName:CallableFunctionJobs, data:{[key:string]:unknown}) => {
71
+ const getCode = () => {
72
+ switch (functionName) {
73
+ case "userManagement-addUsers":
74
+ return {
75
+ title: "Add users",
76
+ description: `Adding ${(data as {users:unknown[]}).users.length} ${(data as {userType:string}).userType.toLowerCase()}`,
77
+ };
78
+ case "userManagement-activateUsers":
79
+ return {
80
+ title: "Activating users",
81
+ description: `Attempting activation of ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
82
+ "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length} users.`,
83
+ };
84
+ case "userManagement-deactivateUsers":
85
+ return {
86
+ title: "Deactivating users",
87
+ description: `Deactivating ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
88
+ "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length || "multiple"} users.`,
89
+ };
90
+ case "userManagement-deleteUsers":
91
+ return {
92
+ title: "Deleting users",
93
+ description: `Attempting deletion of ${Array.isArray((data as {users:{[key:string]:unknown}}).users) ?
94
+ "multiple" : Object.entries((data as {users:{[key: string]: UserData}}).users).length || "multiple"} users.`,
95
+ };
96
+ case "placementListing-add":
97
+ return {
98
+ title: "Adding placements",
99
+ description: `Attempting addition of ${(data as {data:[]}).data.length} placements`,
100
+ };
101
+ default:
102
+ return;
103
+ }
104
+ };
105
+
106
+ const date = new Date();
107
+ const firebaseQuery = new FirebaseQuery();
108
+
109
+ const jobObject = {
110
+ title: getCode()?.title,
111
+ description: getCode()?.description,
112
+ status: "processing",
113
+ viewedBy: [],
114
+ started: date.toISOString(),
115
+ updated: date.toISOString(),
116
+ oId: user.oId,
117
+ product: user.product,
118
+ };
119
+
120
+ const jobId = (await firebaseQuery.add(["jobs"], jobObject)).id;
121
+
122
+ console.log("jobId", jobId);
123
+ dispatch(addJob({
124
+ jobId: jobId,
125
+ job: jobObject,
126
+ }));
127
+
128
+ const items = {...data, jobId: jobId};
129
+
130
+ const funcCallable = httpsCallable(functions, functionName);
131
+ console.log(items);
132
+ funcCallable(items).then(() => {
133
+ dispatch(setJobStatus({
134
+ jobId: jobId,
135
+ status: "success",
136
+ }));
137
+ });
138
+ return;
139
+ };
140
+
141
+ return {execute};
142
+ }
@@ -1,42 +1,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} 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
-
37
- export const auth = getAuth(firebaseConfig);
38
- export const db = getFirestore(firebaseConfig);
39
- export const functions = getFunctions(firebaseConfig, "europe-west2");
40
- export const storage = getStorage(firebaseConfig);
41
-
42
-
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
+