@chem-po/firebase-native 0.0.16 → 0.0.18

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 (212) hide show
  1. package/README.md +215 -0
  2. package/lib/commonjs/adapter/auth.js +431 -0
  3. package/lib/commonjs/adapter/auth.js.map +1 -0
  4. package/lib/commonjs/adapter/db.js +103 -0
  5. package/lib/commonjs/adapter/db.js.map +1 -0
  6. package/lib/commonjs/adapter/index.js +16 -0
  7. package/lib/commonjs/adapter/index.js.map +1 -0
  8. package/lib/commonjs/adapter/storage.js +52 -0
  9. package/lib/commonjs/adapter/storage.js.map +1 -0
  10. package/lib/commonjs/auth/functions.js +11 -0
  11. package/lib/commonjs/auth/functions.js.map +1 -0
  12. package/lib/commonjs/auth/index.js +17 -0
  13. package/lib/commonjs/auth/index.js.map +1 -0
  14. package/lib/commonjs/components/AuthenticatorVerify.js +90 -0
  15. package/lib/commonjs/components/AuthenticatorVerify.js.map +1 -0
  16. package/lib/commonjs/components/FirebaseSignIn.js +196 -0
  17. package/lib/commonjs/components/FirebaseSignIn.js.map +1 -0
  18. package/lib/commonjs/components/PhoneVerify.js +123 -0
  19. package/lib/commonjs/components/PhoneVerify.js.map +1 -0
  20. package/lib/commonjs/components/TwoFactorAuthModal.js +118 -0
  21. package/lib/commonjs/components/TwoFactorAuthModal.js.map +1 -0
  22. package/lib/commonjs/components/index.js +28 -0
  23. package/lib/commonjs/components/index.js.map +1 -0
  24. package/lib/commonjs/contexts/FirebaseContext.js +48 -0
  25. package/lib/commonjs/contexts/FirebaseContext.js.map +1 -0
  26. package/lib/commonjs/contexts/index.js +17 -0
  27. package/lib/commonjs/contexts/index.js.map +1 -0
  28. package/lib/commonjs/db/index.js +17 -0
  29. package/lib/commonjs/db/index.js.map +1 -0
  30. package/lib/commonjs/db/utils.js +120 -0
  31. package/lib/commonjs/db/utils.js.map +1 -0
  32. package/lib/commonjs/hooks/backend.js +12 -0
  33. package/lib/commonjs/hooks/backend.js.map +1 -0
  34. package/lib/commonjs/hooks/index.js +17 -0
  35. package/lib/commonjs/hooks/index.js.map +1 -0
  36. package/lib/commonjs/hooks/useAuthenticatorVerify.js +52 -0
  37. package/lib/commonjs/hooks/useAuthenticatorVerify.js.map +1 -0
  38. package/lib/commonjs/hooks/usePhoneVerify.js +83 -0
  39. package/lib/commonjs/hooks/usePhoneVerify.js.map +1 -0
  40. package/lib/commonjs/icons/Google.js +29 -0
  41. package/lib/commonjs/icons/Google.js.map +1 -0
  42. package/lib/commonjs/index.js +105 -0
  43. package/lib/commonjs/index.js.map +1 -0
  44. package/lib/commonjs/storage/index.js +17 -0
  45. package/lib/commonjs/storage/index.js.map +1 -0
  46. package/lib/commonjs/storage/utils.js +37 -0
  47. package/lib/commonjs/storage/utils.js.map +1 -0
  48. package/lib/commonjs/types/adapter.js +6 -0
  49. package/lib/commonjs/types/adapter.js.map +1 -0
  50. package/lib/commonjs/types/auth.js +6 -0
  51. package/lib/commonjs/types/auth.js.map +1 -0
  52. package/lib/commonjs/types/db.js +6 -0
  53. package/lib/commonjs/types/db.js.map +1 -0
  54. package/lib/commonjs/types/functions.js +6 -0
  55. package/lib/commonjs/types/functions.js.map +1 -0
  56. package/lib/commonjs/types/index.js +6 -0
  57. package/lib/commonjs/types/index.js.map +1 -0
  58. package/lib/commonjs/types/storage.js +6 -0
  59. package/lib/commonjs/types/storage.js.map +1 -0
  60. package/lib/commonjs/utils/validation.js +71 -0
  61. package/lib/commonjs/utils/validation.js.map +1 -0
  62. package/lib/module/adapter/auth.js +424 -0
  63. package/lib/module/adapter/auth.js.map +1 -0
  64. package/lib/module/adapter/db.js +96 -0
  65. package/lib/module/adapter/db.js.map +1 -0
  66. package/lib/module/adapter/index.js +9 -0
  67. package/lib/module/adapter/index.js.map +1 -0
  68. package/lib/module/adapter/storage.js +45 -0
  69. package/lib/module/adapter/storage.js.map +1 -0
  70. package/lib/module/auth/functions.js +3 -0
  71. package/lib/module/auth/functions.js.map +1 -0
  72. package/lib/module/auth/index.js +2 -0
  73. package/lib/module/auth/index.js.map +1 -0
  74. package/lib/module/components/AuthenticatorVerify.js +82 -0
  75. package/lib/module/components/AuthenticatorVerify.js.map +1 -0
  76. package/lib/module/components/FirebaseSignIn.js +187 -0
  77. package/lib/module/components/FirebaseSignIn.js.map +1 -0
  78. package/lib/module/components/PhoneVerify.js +116 -0
  79. package/lib/module/components/PhoneVerify.js.map +1 -0
  80. package/lib/module/components/TwoFactorAuthModal.js +110 -0
  81. package/lib/module/components/TwoFactorAuthModal.js.map +1 -0
  82. package/lib/module/components/index.js +3 -0
  83. package/lib/module/components/index.js.map +1 -0
  84. package/lib/module/contexts/FirebaseContext.js +39 -0
  85. package/lib/module/contexts/FirebaseContext.js.map +1 -0
  86. package/lib/module/contexts/index.js +2 -0
  87. package/lib/module/contexts/index.js.map +1 -0
  88. package/lib/module/db/index.js +2 -0
  89. package/lib/module/db/index.js.map +1 -0
  90. package/lib/module/db/utils.js +111 -0
  91. package/lib/module/db/utils.js.map +1 -0
  92. package/lib/module/hooks/backend.js +5 -0
  93. package/lib/module/hooks/backend.js.map +1 -0
  94. package/lib/module/hooks/index.js +2 -0
  95. package/lib/module/hooks/index.js.map +1 -0
  96. package/lib/module/hooks/useAuthenticatorVerify.js +45 -0
  97. package/lib/module/hooks/useAuthenticatorVerify.js.map +1 -0
  98. package/lib/module/hooks/usePhoneVerify.js +76 -0
  99. package/lib/module/hooks/usePhoneVerify.js.map +1 -0
  100. package/lib/module/icons/Google.js +22 -0
  101. package/lib/module/icons/Google.js.map +1 -0
  102. package/lib/module/index.js +10 -0
  103. package/lib/module/index.js.map +1 -0
  104. package/lib/module/storage/index.js +2 -0
  105. package/lib/module/storage/index.js.map +1 -0
  106. package/lib/module/storage/utils.js +30 -0
  107. package/lib/module/storage/utils.js.map +1 -0
  108. package/lib/module/types/adapter.js +2 -0
  109. package/lib/module/types/adapter.js.map +1 -0
  110. package/lib/module/types/auth.js +2 -0
  111. package/lib/module/types/auth.js.map +1 -0
  112. package/lib/module/types/db.js +2 -0
  113. package/lib/module/types/db.js.map +1 -0
  114. package/lib/module/types/functions.js +2 -0
  115. package/lib/module/types/functions.js.map +1 -0
  116. package/lib/module/types/index.js +2 -0
  117. package/lib/module/types/index.js.map +1 -0
  118. package/lib/module/types/storage.js +2 -0
  119. package/lib/module/types/storage.js.map +1 -0
  120. package/lib/module/utils/validation.js +62 -0
  121. package/lib/module/utils/validation.js.map +1 -0
  122. package/lib/typescript/adapter/auth.d.ts +7 -0
  123. package/lib/typescript/adapter/auth.d.ts.map +1 -0
  124. package/lib/typescript/adapter/db.d.ts +5 -0
  125. package/lib/typescript/adapter/db.d.ts.map +1 -0
  126. package/lib/typescript/adapter/index.d.ts +9 -0
  127. package/lib/typescript/adapter/index.d.ts.map +1 -0
  128. package/lib/typescript/adapter/storage.d.ts +4 -0
  129. package/lib/typescript/adapter/storage.d.ts.map +1 -0
  130. package/lib/typescript/auth/functions.d.ts +4 -0
  131. package/lib/typescript/auth/functions.d.ts.map +1 -0
  132. package/lib/typescript/auth/index.d.ts +2 -0
  133. package/lib/typescript/auth/index.d.ts.map +1 -0
  134. package/lib/typescript/components/AuthenticatorVerify.d.ts +3 -0
  135. package/lib/typescript/components/AuthenticatorVerify.d.ts.map +1 -0
  136. package/lib/typescript/components/FirebaseSignIn.d.ts +6 -0
  137. package/lib/typescript/components/FirebaseSignIn.d.ts.map +1 -0
  138. package/lib/typescript/components/PhoneVerify.d.ts +6 -0
  139. package/lib/typescript/components/PhoneVerify.d.ts.map +1 -0
  140. package/lib/typescript/components/TwoFactorAuthModal.d.ts +3 -0
  141. package/lib/typescript/components/TwoFactorAuthModal.d.ts.map +1 -0
  142. package/lib/typescript/components/index.d.ts +3 -0
  143. package/lib/typescript/components/index.d.ts.map +1 -0
  144. package/lib/typescript/contexts/FirebaseContext.d.ts +9 -0
  145. package/lib/typescript/contexts/FirebaseContext.d.ts.map +1 -0
  146. package/lib/typescript/contexts/index.d.ts +2 -0
  147. package/lib/typescript/contexts/index.d.ts.map +1 -0
  148. package/lib/typescript/db/index.d.ts +2 -0
  149. package/lib/typescript/db/index.d.ts.map +1 -0
  150. package/lib/typescript/db/utils.d.ts +6 -0
  151. package/lib/typescript/db/utils.d.ts.map +1 -0
  152. package/lib/typescript/hooks/backend.d.ts +2 -0
  153. package/lib/typescript/hooks/backend.d.ts.map +1 -0
  154. package/lib/typescript/hooks/index.d.ts +2 -0
  155. package/lib/typescript/hooks/index.d.ts.map +1 -0
  156. package/lib/typescript/hooks/useAuthenticatorVerify.d.ts +8 -0
  157. package/lib/typescript/hooks/useAuthenticatorVerify.d.ts.map +1 -0
  158. package/lib/typescript/hooks/usePhoneVerify.d.ts +9 -0
  159. package/lib/typescript/hooks/usePhoneVerify.d.ts.map +1 -0
  160. package/lib/typescript/icons/Google.d.ts +5 -0
  161. package/lib/typescript/icons/Google.d.ts.map +1 -0
  162. package/lib/typescript/index.d.ts +10 -0
  163. package/lib/typescript/index.d.ts.map +1 -0
  164. package/lib/typescript/storage/index.d.ts +2 -0
  165. package/lib/typescript/storage/index.d.ts.map +1 -0
  166. package/lib/typescript/storage/utils.d.ts +4 -0
  167. package/lib/typescript/storage/utils.d.ts.map +1 -0
  168. package/lib/typescript/types/adapter.d.ts +6 -0
  169. package/lib/typescript/types/adapter.d.ts.map +1 -0
  170. package/lib/typescript/types/auth.d.ts +12 -0
  171. package/lib/typescript/types/auth.d.ts.map +1 -0
  172. package/lib/typescript/types/db.d.ts +8 -0
  173. package/lib/typescript/types/db.d.ts.map +1 -0
  174. package/lib/typescript/types/functions.d.ts +3 -0
  175. package/lib/typescript/types/functions.d.ts.map +1 -0
  176. package/lib/typescript/types/index.d.ts +24 -0
  177. package/lib/typescript/types/index.d.ts.map +1 -0
  178. package/lib/typescript/types/storage.d.ts +3 -0
  179. package/lib/typescript/types/storage.d.ts.map +1 -0
  180. package/lib/typescript/utils/validation.d.ts +21 -0
  181. package/lib/typescript/utils/validation.d.ts.map +1 -0
  182. package/package.json +29 -12
  183. package/src/adapter/auth.ts +474 -0
  184. package/src/adapter/db.ts +146 -0
  185. package/src/adapter/index.ts +30 -0
  186. package/src/adapter/storage.ts +58 -0
  187. package/src/auth/functions.ts +7 -0
  188. package/src/auth/index.ts +1 -0
  189. package/src/components/AuthenticatorVerify.tsx +75 -0
  190. package/src/components/FirebaseSignIn.tsx +187 -0
  191. package/src/components/PhoneVerify.tsx +102 -0
  192. package/src/components/TwoFactorAuthModal.tsx +133 -0
  193. package/src/components/index.ts +2 -0
  194. package/src/contexts/FirebaseContext.tsx +54 -0
  195. package/src/contexts/index.ts +1 -0
  196. package/src/db/index.ts +1 -0
  197. package/src/db/utils.ts +142 -0
  198. package/src/hooks/backend.ts +4 -0
  199. package/src/hooks/index.ts +1 -0
  200. package/src/hooks/useAuthenticatorVerify.ts +45 -0
  201. package/src/hooks/usePhoneVerify.ts +76 -0
  202. package/src/icons/Google.tsx +24 -0
  203. package/src/index.ts +9 -0
  204. package/src/storage/index.ts +1 -0
  205. package/src/storage/utils.ts +29 -0
  206. package/src/types/adapter.ts +13 -0
  207. package/src/types/auth.ts +13 -0
  208. package/src/types/db.ts +10 -0
  209. package/src/types/functions.ts +3 -0
  210. package/src/types/index.ts +26 -0
  211. package/src/types/storage.ts +3 -0
  212. package/src/utils/validation.ts +85 -0
@@ -0,0 +1,111 @@
1
+ import { isInequalityOperator, stringTransforms } from '@chem-po/core';
2
+ import { collection, collectionGroup, limit as limitTo, orderBy, query, startAfter, where } from '@react-native-firebase/firestore';
3
+ export const toFirestoreQuery = (db, baseQuery) => {
4
+ var _search$paths;
5
+ const {
6
+ collection: collectionPath,
7
+ filters,
8
+ limit,
9
+ search,
10
+ sort,
11
+ isCollectionGroup,
12
+ cursor: startAfterDoc
13
+ } = baseQuery;
14
+ let q = isCollectionGroup ? collectionGroup(db, collectionPath) : collection(db, collectionPath);
15
+ if (filters) {
16
+ filters.forEach(({
17
+ key,
18
+ operator,
19
+ value
20
+ }) => {
21
+ q = query(q, where(key, operator, value));
22
+ });
23
+ }
24
+ if (sort) {
25
+ q = query(q, orderBy(sort.key, sort.direction));
26
+ }
27
+ if (startAfterDoc) {
28
+ q = query(q, startAfter(startAfterDoc));
29
+ }
30
+ if (search !== null && search !== void 0 && (_search$paths = search.paths) !== null && _search$paths !== void 0 && _search$paths.length && search.query) {
31
+ const trimmed = (search.query || '').trim();
32
+ if (trimmed) {
33
+ q = query(q, where(search.paths[0].prop, '>=', trimmed), where(search.paths[0].prop, '<=', `${trimmed}\uf8ff`));
34
+ }
35
+ }
36
+ return limit ? query(q, limitTo(limit)) : q;
37
+ };
38
+ export const toCursorQuery = (db, baseQuery, cursor) => {
39
+ var _search$paths2;
40
+ const {
41
+ collection: collectionPath,
42
+ filters,
43
+ sort,
44
+ isCollectionGroup,
45
+ search,
46
+ limit
47
+ } = baseQuery;
48
+ let q = isCollectionGroup ? collectionGroup(db, collectionPath) : collection(db, collectionPath);
49
+ if (filters) {
50
+ filters.forEach(({
51
+ key,
52
+ operator,
53
+ value
54
+ }) => {
55
+ q = query(q, where(key, operator, value));
56
+ });
57
+ }
58
+ if (sort) {
59
+ q = query(q, orderBy(sort.key, sort.direction));
60
+ }
61
+ if (search !== null && search !== void 0 && (_search$paths2 = search.paths) !== null && _search$paths2 !== void 0 && _search$paths2.length && search.query) {
62
+ const trimmed = (search.query || '').trim();
63
+ if (trimmed) {
64
+ q = query(q, where(search.paths[0].prop, '>=', trimmed), where(search.paths[0].prop, '<=', `${trimmed}\uf8ff`));
65
+ }
66
+ }
67
+ if (cursor) {
68
+ q = query(q, startAfter(cursor));
69
+ }
70
+ return limit ? query(q, limitTo(limit), limitTo(1)) : q;
71
+ };
72
+ export const toFirestoreQueries = (db, baseQuery, cursors) => {
73
+ var _search$paths3;
74
+ const {
75
+ collection: collectionPath,
76
+ filters,
77
+ limit,
78
+ search,
79
+ sort,
80
+ isCollectionGroup
81
+ } = baseQuery;
82
+ let q = isCollectionGroup ? collectionGroup(db, collectionPath) : collection(db, collectionPath);
83
+ if (filters) {
84
+ let filterSortKey = null;
85
+ filters.forEach(({
86
+ key,
87
+ operator,
88
+ value
89
+ }) => {
90
+ q = query(q, where(key, operator, value));
91
+ if (!filterSortKey && isInequalityOperator(operator) && (!sort || sort.key !== key)) {
92
+ filterSortKey = key;
93
+ q = query(q, orderBy(key, 'asc'));
94
+ }
95
+ });
96
+ }
97
+ if (sort) {
98
+ q = query(q, orderBy(sort.key, sort.direction));
99
+ }
100
+ if (cursors !== null && cursors !== void 0 && cursors.length) {
101
+ q = query(q, startAfter(cursors[cursors.length - 1]));
102
+ }
103
+ const queries = search !== null && search !== void 0 && (_search$paths3 = search.paths) !== null && _search$paths3 !== void 0 && _search$paths3.length && search.query ? search.paths.map(path => {
104
+ let trimmed = (search.query ?? '').trim();
105
+ if (!trimmed) return q;
106
+ if (path.transform) trimmed = stringTransforms[path.transform](trimmed);
107
+ return query(q, where(path.prop, '>=', trimmed), where(path.prop, '<=', `${trimmed}\uf8ff`));
108
+ }) : [q];
109
+ return queries.map(q0 => limit ? query(q0, limitTo(limit)) : q0);
110
+ };
111
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isInequalityOperator","stringTransforms","collection","collectionGroup","limit","limitTo","orderBy","query","startAfter","where","toFirestoreQuery","db","baseQuery","_search$paths","collectionPath","filters","search","sort","isCollectionGroup","cursor","startAfterDoc","q","forEach","key","operator","value","direction","paths","length","trimmed","trim","prop","toCursorQuery","_search$paths2","toFirestoreQueries","cursors","_search$paths3","filterSortKey","queries","map","path","transform","q0"],"sourceRoot":"..\\..\\..\\src","sources":["db/utils.ts"],"mappings":"AAAA,SAA+BA,oBAAoB,EAAEC,gBAAgB,QAAQ,eAAe;AAC5F,SACEC,UAAU,EACVC,eAAe,EACfC,KAAK,IAAIC,OAAO,EAChBC,OAAO,EACPC,KAAK,EACLC,UAAU,EACVC,KAAK,QACA,kCAAkC;AAGzC,OAAO,MAAMC,gBAAgB,GAAGA,C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EAAE,IAAKtC,KAAK,GAAGG,KAAK,CAACmC,EAAE,EAAErC,OAAO,CAACD,KAAK,CAAC,CAAC,GAAGsC,EAAG,CAAC;AACpE,CAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ import { useBackendBase } from '@chem-po/react';
2
+ // import { FirebaseBackendAdapter } from '../types/adapter'
3
+
4
+ export const useBackend = () => useBackendBase();
5
+ //# sourceMappingURL=backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useBackendBase","useBackend"],"sourceRoot":"..\\..\\..\\src","sources":["hooks/backend.ts"],"mappings":"AAAA,SAASA,cAAc,QAAQ,gBAAgB;AAC/C;;AAEA,OAAO,MAAMC,UAAU,GAAGA,CAAA,KAAMD,cAAc,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from './backend';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["hooks/index.ts"],"mappings":"AAAA,cAAc,WAAW","ignoreList":[]}
@@ -0,0 +1,45 @@
1
+ import { useAuth } from '@chem-po/react';
2
+ import { useCallback, useState } from 'react';
3
+ import { useBackend } from './backend';
4
+ export const useAuthenticatorVerify = () => {
5
+ const [code, setCode] = useState('');
6
+ const [verifying, setVerifying] = useState(false);
7
+ const [error, setError] = useState('');
8
+ const twoFactorVerification = useAuth(s => s.multiFactorVerification);
9
+ const {
10
+ auth
11
+ } = useBackend();
12
+ // const { showSuccess, showError, showInfo } = useToast()
13
+
14
+ const handleVerify = useCallback(async () => {
15
+ const verify = auth.verifyMultiFactor;
16
+ if (!verify) {
17
+ setError('Error - Two factor verification is not supported');
18
+ return;
19
+ }
20
+ if (!code) return;
21
+ if (!twoFactorVerification) {
22
+ setError('Error - No session found');
23
+ return;
24
+ }
25
+ const resolver = twoFactorVerification.resolver;
26
+ if (!resolver) {
27
+ setError('Error - No session found');
28
+ return;
29
+ }
30
+ setVerifying(true);
31
+ try {
32
+ await verify(twoFactorVerification, code);
33
+ } catch (error) {
34
+ setError(error instanceof Error ? error.message : 'An unknown error occurred');
35
+ }
36
+ }, [code, auth, twoFactorVerification]);
37
+ return {
38
+ code,
39
+ setCode,
40
+ verifying,
41
+ error,
42
+ handleVerify
43
+ };
44
+ };
45
+ //# sourceMappingURL=useAuthenticatorVerify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useAuth","useCallback","useState","useBackend","useAuthenticatorVerify","code","setCode","verifying","setVerifying","error","setError","twoFactorVerification","s","multiFactorVerification","auth","handleVerify","verify","verifyMultiFactor","resolver","Error","message"],"sourceRoot":"..\\..\\..\\src","sources":["hooks/useAuthenticatorVerify.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,gBAAgB;AAExC,SAASC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAC7C,SAASC,UAAU,QAAQ,WAAW;AAEtC,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EAC1C,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGJ,QAAQ,CAAC,EAAE,CAAC;EACpC,MAAM,CAACK,SAAS,EAAEC,YAAY,CAAC,GAAGN,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM,CAACO,KAAK,EAAEC,QAAQ,CAAC,GAAGR,QAAQ,CAAC,EAAE,CAAC;EACtC,MAAMS,qBAAqB,GAAGX,OAAO,CAACY,CAAC,IAAIA,CAAC,CAACC,uBAAuB,CAAC;EACrE,MAAM;IAAEC;EAAK,CAAC,GAAGX,UAAU,CAAC,CAAC;EAC7B;;EAEA,MAAMY,YAAY,GAAGd,WAAW,CAAC,YAAY;IAC3C,MAAMe,MAAM,GAAGF,IAAI,CAACG,iBAAiB;IACrC,IAAI,CAACD,MAAM,EAAE;MACXN,QAAQ,CAAC,kDAAkD,CAAC;MAC5D;IACF;IACA,IAAI,CAACL,IAAI,EAAE;IACX,IAAI,CAACM,qBAAqB,EAAE;MAC1BD,QAAQ,CAAC,0BAA0B,CAAC;MACpC;IACF;IACA,MAAMQ,QAAQ,GAAGP,qBAAqB,CAACO,QAAiD;IACxF,IAAI,CAACA,QAAQ,EAAE;MACbR,QAAQ,CAAC,0BAA0B,CAAC;MACpC;IACF;IACAF,YAAY,CAAC,IAAI,CAAC;IAClB,IAAI;MACF,MAAMQ,MAAM,CAACL,qBAAqB,EAAEN,IAAI,CAAC;IAC3C,CAAC,CAAC,OAAOI,KAAK,EAAE;MACdC,QAAQ,CAACD,KAAK,YAAYU,KAAK,GAAGV,KAAK,CAACW,OAAO,GAAG,2BAA2B,CAAC;IAChF;EACF,CAAC,EAAE,CAACf,IAAI,EAAES,IAAI,EAAEH,qBAAqB,CAAC,CAAC;EAEvC,OAAO;IACLN,IAAI;IACJC,OAAO;IACPC,SAAS;IACTE,KAAK;IACLM;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,76 @@
1
+ import { useAuth, useToast } from '@chem-po/react';
2
+ import { useCallback, useEffect, useRef, useState } from 'react';
3
+ import { useBackend } from './backend';
4
+ export const usePhoneVerify = (factor, automaticallySendSmsCode) => {
5
+ const [code, setCode] = useState('');
6
+ const [verifying, setVerifying] = useState(false);
7
+ const [error, setError] = useState('');
8
+ const {
9
+ auth
10
+ } = useBackend();
11
+ const {
12
+ multiFactorVerification: twoFactorVerification,
13
+ enrollmentFactors
14
+ } = useAuth();
15
+
16
+ // const [{ automaticallySendSmsCode }, setCookie] = useCookies(['automaticallySendSmsCode'])
17
+
18
+ const initSendCode = useRef(!!automaticallySendSmsCode);
19
+ const {
20
+ showSuccess,
21
+ showError,
22
+ showInfo
23
+ } = useToast();
24
+ const sendCode = useCallback(async () => {
25
+ if (!enrollmentFactors) {
26
+ showError('Error - No session found');
27
+ return;
28
+ }
29
+ await auth.sendMultiFactorCode(factor, enrollmentFactors.multiFactorResolver);
30
+ }, [auth, factor, twoFactorVerification, showError]);
31
+ const initSendCodeFunc = useRef(sendCode);
32
+ useEffect(() => {
33
+ if (initSendCode.current) {
34
+ initSendCodeFunc.current();
35
+ }
36
+ }, []);
37
+ const handleVerify = useCallback(() => {
38
+ setVerifying(true);
39
+ setError('');
40
+ if (!twoFactorVerification) {
41
+ showError('Error - No session found');
42
+ return;
43
+ }
44
+ const resolver = twoFactorVerification.resolver;
45
+ if (!resolver) {
46
+ showError('Error - No resolver found');
47
+ return;
48
+ }
49
+ const verificationId = twoFactorVerification.verificationId;
50
+ if (!verificationId) {
51
+ showError('Error - No verification ID found');
52
+ return;
53
+ }
54
+ const verify = auth.verifyMultiFactor;
55
+ if (!verify) {
56
+ showError('Error - Two factor verification is not supported');
57
+ return;
58
+ }
59
+ verify(twoFactorVerification, code).then(() => {
60
+ setVerifying(false);
61
+ setCode('');
62
+ showSuccess('Verification successful');
63
+ }).catch(e => {
64
+ setVerifying(false);
65
+ setError(e.message || 'An error occurred');
66
+ });
67
+ }, [code, auth, showSuccess, showError]);
68
+ return {
69
+ code,
70
+ setCode,
71
+ verifying,
72
+ error,
73
+ handleVerify
74
+ };
75
+ };
76
+ //# sourceMappingURL=usePhoneVerify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useAuth","useToast","useCallback","useEffect","useRef","useState","useBackend","usePhoneVerify","factor","automaticallySendSmsCode","code","setCode","verifying","setVerifying","error","setError","auth","multiFactorVerification","twoFactorVerification","enrollmentFactors","initSendCode","showSuccess","showError","showInfo","sendCode","sendMultiFactorCode","multiFactorResolver","initSendCodeFunc","current","handleVerify","resolver","verificationId","verify","verifyMultiFactor","then","catch","e","message"],"sourceRoot":"..\\..\\..\\src","sources":["hooks/usePhoneVerify.ts"],"mappings":"AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,gBAAgB;AAClD,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAChE,SAASC,UAAU,QAAQ,WAAW;AAEtC,OAAO,MAAMC,cAAc,GAAGA,CAACC,MAA6B,EAAEC,wBAAiC,KAAK;EAClG,MAA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AGZ,qBAAqB,CAACY,QAAQ;IAC/C,IAAI,CAACA,QAAQ,EAAE;MACbR,SAAS,CAAC,2BAA2B,CAAC;MACtC;IACF;IACA,MAAMS,cAAc,GAAGb,qBAAqB,CAACa,cAAc;IAC3D,IAAI,CAACA,cAAc,EAAE;MACnBT,SAAS,CAAC,kCAAkC,CAAC;MAC7C;IACF;IACA,MAAMU,MAAM,GAAGhB,IAAI,CAACiB,iBAAiB;IACrC,IAAI,CAACD,MAAM,EAAE;MACXV,SAAS,CAAC,kDAAkD,CAAC;MAC7D;IACF;IACAU,MAAM,CAACd,qBAAqB,EAAER,IAAI,CAAC,CAChCwB,IAAI,CAAC,MAAM;MACVrB,YAAY,CAAC,KAAK,CAAC;MACnBF,OAAO,CAAC,EAAE,CAAC;MACXU,WAAW,CAAC,yBAAyB,CAAC;IACxC,CAAC,CAAC,CACDc,KAAK,CAACC,CAAC,IAAI;MACVvB,YAAY,CAAC,KAAK,CAAC;MACnBE,QAAQ,CAACqB,CAAC,CAACC,OAAO,IAAI,mBAAmB,CAAC;IAC5C,CAAC,CAAC;EACN,CAAC,EAAE,CAAC3B,IAAI,EAAEM,IAAI,EAAEK,WAAW,EAAEC,SAAS,CAAC,CAAC;EAExC,OAAO;IACLZ,IAAI;IACJC,OAAO;IACPC,SAAS;IACTE,KAAK;IACLe;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import * as React from 'react';
3
+ import Svg, { Path } from 'react-native-svg';
4
+ const SvgGoogle = props => /*#__PURE__*/React.createElement(Svg, _extends({
5
+ width: 24,
6
+ height: 24,
7
+ viewBox: "0 0 24 24"
8
+ }, props), /*#__PURE__*/React.createElement(Path, {
9
+ fill: "#4285F4",
10
+ d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
11
+ }), /*#__PURE__*/React.createElement(Path, {
12
+ fill: "#34A853",
13
+ d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
14
+ }), /*#__PURE__*/React.createElement(Path, {
15
+ fill: "#FBBC05",
16
+ d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
17
+ }), /*#__PURE__*/React.createElement(Path, {
18
+ fill: "#EA4335",
19
+ d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
20
+ }));
21
+ export default SvgGoogle;
22
+ //# sourceMappingURL=Google.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Svg","Path","SvgGoogle","props","createElement","_extends","width","height","viewBox","fill","d"],"sourceRoot":"..\\..\\..\\src","sources":["icons/Google.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,GAAG,IAAIC,IAAI,QAAkB,kBAAkB;AAEtD,MAAMC,SAAS,GAAIC,KAAe,iBAChCJ,KAAA,CAAAK,aAAA,CAACJ,GAAG,EAAAK,QAAA;EAACC,KAAK,EAAE,EAAG;EAACC,MAAM,EAAE,EAAG;EAACC,OAAO,EAAC;AAAW,GAAKL,KAAK,gBACvDJ,KAAA,CAAAK,aAAA,CAACH,IAAI;EACHQ,IAAI,EAAC,SAAS;EACdC,CAAC,EAAC;AAAyH,CAC5H,CAAC,eACFX,KAAA,CAAAK,aAAA,CAACH,IAAI;EACHQ,IAAI,EAAC,SAAS;EACdC,CAAC,EAAC;AAAuI,CAC1I,CAAC,eACFX,KAAA,CAAAK,aAAA,CAACH,IAAI;EACHQ,IAAI,EAAC,SAAS;EACdC,CAAC,EAAC;AAA+H,CAClI,CAAC,eACFX,KAAA,CAAAK,aAAA,CAACH,IAAI;EACHQ,IAAI,EAAC,SAAS;EACdC,CAAC,EAAC;AAAqI,CACxI,CACE,CACN;AACD,eAAeR,SAAS","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ export * from './adapter';
2
+ export * from './auth';
3
+ export * from './components';
4
+ export * from './contexts';
5
+ export * from './db';
6
+ export * from './hooks';
7
+ export * from './storage';
8
+ export * from './types';
9
+ export * from './utils/validation';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,cAAc,cAAc;AAC5B,cAAc,YAAY;AAC1B,cAAc,MAAM;AACpB,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,oBAAoB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from './utils';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["storage/index.ts"],"mappings":"AAAA,cAAc,SAAS","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ import { ref, uploadString } from '@react-native-firebase/storage';
2
+ export const uploadFileValue = async (storage, path, file, onUploadProgress) => {
3
+ if (!file) return null;
4
+ const {
5
+ dataUrl,
6
+ type,
7
+ filename
8
+ } = file;
9
+ if (!dataUrl) return file;
10
+ const storageRef = ref(storage, path);
11
+ const uploadTask = uploadString(storageRef, dataUrl, 'data_url');
12
+ uploadTask.on('state_changed', snapshot => {
13
+ const percent = snapshot.bytesTransferred / snapshot.totalBytes;
14
+ onUploadProgress({
15
+ total: snapshot.totalBytes,
16
+ loaded: snapshot.bytesTransferred,
17
+ percent
18
+ });
19
+ });
20
+ return new Promise((resolve, reject) => {
21
+ uploadTask.then(() => {
22
+ resolve({
23
+ storagePath: path,
24
+ type,
25
+ filename
26
+ });
27
+ }).catch(reject);
28
+ });
29
+ };
30
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ref","uploadString","uploadFileValue","storage","path","file","onUploadProgress","dataUrl","type","filename","storageRef","uploadTask","on","snapshot","percent","bytesTransferred","totalBytes","total","loaded","Promise","resolve","reject","then","storagePath","catch"],"sourceRoot":"..\\..\\..\\src","sources":["storage/utils.ts"],"mappings":"AACA,SAA+BA,GAAG,EAAEC,YAAY,QAAQ,gCAAgC;AAExF,OAAO,MAAMC,eAAe,GAAG,MAAAA,CAC7BC,OAAoC,EACpCC,IAAY,EACZC,IAAmD,EACnDC,gBAAkC,KACJ;EAC9B,IAAI,CAACD,IAAI,EAAE,OAAO,IAAI;EACtB,MAAM;IAAEE,OAAO;IAAEC,IAAI;IAAEC;EAAS,CAAC,GAAGJ,IAAsB;EAC1D,IAAI,CAACE,OAAO,EAAE,OAAOF,IAAI;EAEzB,MAAMK,UAAU,GAAGV,GAAG,CAACG,OAAO,EAAEC,IAAI,CAAC;EACrC,MAAMO,UAAU,GAAGV,YAAY,CAACS,UAAU,EAAEH,OAAO,EAAE,UAAU,CAAC;EAEhEI,UAAU,CAACC,EAAE,CAAC,eAAe,EAAEC,QAAQ,IAAI;IACzC,MAAMC,OAAO,GAAGD,QAAQ,CAACE,gBAAgB,GAAGF,QAAQ,CAACG,UAAU;IAC/DV,gBAAgB,CAAC;MAAEW,KAAK,EAAEJ,QAAQ,CAACG,UAAU;MAAEE,MAAM,EAAEL,QAAQ,CAACE,gBAAgB;MAAED;IAAQ,CAAC,CAAC;EAC9F,CAAC,CAAC;EAEF,OAAO,IAAIK,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtCV,UAAU,CACPW,IAAI,CAAC,MAAM;MACVF,OAAO,CAAC;QAAEG,WAAW,EAAEnB,IAAI;QAAEI,IAAI;QAAEC;MAAS,CAAC,CAAC;IAChD,CAAC,CAAC,CACDe,KAAK,CAACH,MAAM,CAAC;EAClB,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["types/adapter.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["types/auth.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=db.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["types/db.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["types/functions.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["types/index.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["types/storage.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Validates Firebase authentication configuration to help identify common setup issues
3
+ */
4
+ export const validateAuthConfiguration = providers => {
5
+ var _process$env;
6
+ const errors = [];
7
+ const warnings = [];
8
+
9
+ // Check for Google provider configuration
10
+ const googleProvider = providers.find(p => p.name === 'google');
11
+ if (googleProvider) {
12
+ if (!googleProvider.webClientId) {
13
+ errors.push('Google provider is missing webClientId. ' + 'Get this from Firebase Console > Authentication > Sign-in method > Google > Web SDK configuration');
14
+ } else if (!googleProvider.webClientId.includes('.apps.googleusercontent.com')) {
15
+ warnings.push('Google webClientId format looks incorrect. Expected format: "xxx.apps.googleusercontent.com"');
16
+ }
17
+ }
18
+
19
+ // Check environment
20
+ if (typeof process === 'undefined') {
21
+ warnings.push('Process environment is not available - some features may not work as expected');
22
+ }
23
+
24
+ // Check for Firebase configuration files (platform-specific warnings)
25
+ const isExpo = typeof process !== 'undefined' && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.EXPO_PUBLIC_ENVIRONMENT) !== undefined;
26
+ if (!isExpo) {
27
+ warnings.push('Ensure Firebase configuration files are present:\n' + '- iOS: GoogleService-Info.plist in ios/ directory\n' + '- Android: google-services.json in android/app/ directory');
28
+ }
29
+ return {
30
+ isValid: errors.length === 0,
31
+ errors,
32
+ warnings
33
+ };
34
+ };
35
+
36
+ /**
37
+ * Logs validation results with appropriate console methods
38
+ */
39
+ export const logValidationResults = (result, packageName = '@chem-po/firebase-native') => {
40
+ if (result.errors.length > 0) {
41
+ console.error(`[${packageName}] Configuration errors found:`);
42
+ result.errors.forEach(error => console.error(` ❌ ${error}`));
43
+ }
44
+ if (result.warnings.length > 0) {
45
+ console.warn(`[${packageName}] Configuration warnings:`);
46
+ result.warnings.forEach(warning => console.warn(` ⚠️ ${warning}`));
47
+ }
48
+ if (result.isValid && result.warnings.length === 0) {
49
+ console.log(`[${packageName}] ✅ Configuration validation passed`);
50
+ }
51
+ };
52
+
53
+ /**
54
+ * Validates and logs Firebase auth configuration
55
+ * Call this during development to identify setup issues early
56
+ */
57
+ export const validateAndLogAuthConfig = providers => {
58
+ const result = validateAuthConfiguration(providers);
59
+ logValidationResults(result);
60
+ return result;
61
+ };
62
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["validateAuthConfiguration","providers","_process$env","errors","warnings","googleProvider","find","p","name","webClientId","push","includes","process","isExpo","env","EXPO_PUBLIC_ENVIRONMENT","undefined","isValid","length","logValidationResults","result","packageName","console","error","forEach","warn","warning","log","validateAndLogAuthConfig"],"sourceRoot":"..\\..\\..\\src","sources":["utils/validation.ts"],"mappings":"AAQA;AACA;AACA;AACA,OAAO,MAAMA,yBAAyB,GAAIC,SAA6B,IAAuB;EAAA,IAAAC,YAAA;EAC5F,MAAMC,MAAgB,GAAG,EAAE;EAC3B,MAAMC,QAAkB,GAAG,EAAE;;EAE7B;EACA,MAAMC,cAAc,GAAGJ,SAAS,CAACK,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,IAAI,KAAK,QAAQ,CAAmC;EAEjG,IAAIH,cAAc,EAAE;IAClB,IAAI,CAACA,cAAc,CAACI,WAAW,EAAE;MAC/BN,MAAM,CAACO,IAAI,CACT,0CAA0C,GACxC,mGACJ,CAAC;IACH,CAAC,MAAM,IAAI,CAACL,cAAc,CAACI,WAAW,CAACE,QAAQ,CAAC,6BAA6B,CAAC,EAAE;MAC9EP,QAAQ,CAACM,IAAI,CACX,8FACF,CAAC;IACH;EACF;;EAEA;EACA,IAAI,OAAOE,OAAO,KAAK,WAAW,EAAE;IAClCR,QAAQ,CAACM,IAAI,CAAC,+EAA+E,CAAC;EAChG;;EAEA;EACA,MAAMG,MAAM,GACV,OAAOD,OAAO,KAAK,WAAW,IAAI,EAAAV,YAAA,GAAAU,OAAO,CAACE,GAAG,cAAAZ,YAAA,uBAAXA,YAAA,CAAaa,uBAAuB,MAAKC,SAAS;EACtF,IAAI,CAACH,MAAM,EAAE;IACXT,QAAQ,CAACM,IAAI,CACX,oDAAoD,GAClD,qDAAqD,GACrD,2DACJ,CAAC;EACH;EAEA,OAAO;IACLO,OAAO,EAAEd,MAAM,CAACe,MAAM,KAAK,CAAC;IAC5Bf,MAAM;IACNC;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMe,oBAAoB,GAAGA,CAClCC,MAAwB,EACxBC,WAAW,GAAG,0BAA0B,KACrC;EACH,IAAID,MAAM,CAACjB,MAAM,CAACe,MAAM,GAAG,CAAC,EAAE;IAC5BI,OAAO,CAACC,KAAK,CAAC,IAAIF,WAAW,+BAA+B,CAAC;IAC7DD,MAAM,CAACjB,MAAM,CAACqB,OAAO,CAACD,KAAK,IAAID,OAAO,CAACC,KAAK,CAAC,OAAOA,KAAK,EAAE,CAAC,CAAC;EAC/D;EAEA,IAAIH,MAAM,CAAChB,QAAQ,CAACc,MAAM,GAAG,CAAC,EAAE;IAC9BI,OAAO,CAACG,IAAI,CAAC,IAAIJ,WAAW,2BAA2B,CAAC;IACxDD,MAAM,CAAChB,QAAQ,CAACoB,OAAO,CAACE,OAAO,IAAIJ,OAAO,CAACG,IAAI,CAAC,SAASC,OAAO,EAAE,CAAC,CAAC;EACtE;EAEA,IAAIN,MAAM,CAACH,OAAO,IAAIG,MAAM,CAAChB,QAAQ,CAACc,MAAM,KAAK,CAAC,EAAE;IAClDI,OAAO,CAACK,GAAG,CAAC,IAAIN,WAAW,qCAAqC,CAAC;EACnE;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMO,wBAAwB,GAAI3B,SAA6B,IAAK;EACzE,MAAMmB,MAAM,GAAGpB,yBAAyB,CAACC,SAAS,CAAC;EACnDkB,oBAAoB,CAACC,MAAM,CAAC;EAC5B,OAAOA,MAAM;AACf,CAAC","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { AuthAdapter, BaseAuthProvider } from '@chem-po/core';
2
+ import { Auth, User } from '../types/auth';
3
+ export declare const getFirebaseAuthAdapter: (auth: Auth, twoFactorRequired: boolean) => AuthAdapter<BaseAuthProvider, User, {
4
+ email: string;
5
+ password: string;
6
+ }>;
7
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/adapter/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAQjB,MAAM,eAAe,CAAA;AAiBtB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAkY1C,eAAO,MAAM,sBAAsB,GACjC,MAAM,IAAI,EACV,mBAAmB,OAAO,KACzB,WAAW,CAAC,gBAAgB,EAAE,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAyDzE,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { DatabaseAdapter } from '@chem-po/core';
2
+ import { Firestore, FirestoreCursor } from '../types/db';
3
+ import { Functions } from '../types/functions';
4
+ export declare const getFirebaseDatabaseAdapter: (db: Firestore, functions: Functions) => DatabaseAdapter<FirestoreCursor>;
5
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../src/adapter/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,eAAe,EAMhB,MAAM,eAAe,CAAA;AAatB,OAAO,EAAE,SAAS,EAAsB,eAAe,EAAwB,MAAM,aAAa,CAAA;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AA4G9C,eAAO,MAAM,0BAA0B,GACrC,IAAI,SAAS,EACb,WAAW,SAAS,KACnB,eAAe,CAAC,eAAe,CAUhC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { BackendAdapter, BaseAuthProvider } from '@chem-po/core';
2
+ import { FirebaseStorageTypes } from '@react-native-firebase/storage';
3
+ import { Auth, EmailPasswordLogin, User } from '../types/auth';
4
+ import { Firestore, FirestoreCursor } from '../types/db';
5
+ import { Functions } from '../types/functions';
6
+ import { Storage } from '../types/storage';
7
+ export type FirebaseAdapter<AuthProvider extends BaseAuthProvider> = BackendAdapter<AuthProvider, User, EmailPasswordLogin, FirestoreCursor, Blob, FirebaseStorageTypes.FullMetadata>;
8
+ export declare const getFirebaseAdapter: <AuthProvider extends BaseAuthProvider>(auth: Auth, db: Firestore, storage: Storage, functions: Functions, twoFactorRequired: boolean) => FirebaseAdapter<AuthProvider>;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAK1C,MAAM,MAAM,eAAe,CAAC,YAAY,SAAS,gBAAgB,IAAI,cAAc,CACjF,YAAY,EACZ,IAAI,EACJ,kBAAkB,EAClB,eAAe,EACf,IAAI,EACJ,oBAAoB,CAAC,YAAY,CAClC,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,YAAY,SAAS,gBAAgB,EACtE,MAAM,IAAI,EACV,IAAI,SAAS,EACb,SAAS,OAAO,EAChB,WAAW,SAAS,EACpB,mBAAmB,OAAO,KACzB,eAAe,CAAC,YAAY,CAI7B,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { StorageAdapter } from '@chem-po/core';
2
+ import { Storage } from '../types/storage';
3
+ export declare const getFirebaseStorageAdapter: (storage: Storage) => StorageAdapter<Blob, any>;
4
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/adapter/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAA;AAQjE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,eAAO,MAAM,yBAAyB,GAAI,SAAS,OAAO,KAAG,cAAc,CAAC,IAAI,EAAE,GAAG,CA+CnF,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { FirebaseFunctionsTypes } from '@react-native-firebase/functions';
2
+ export declare const getThirdPartyAuthUrl: (functions: FirebaseFunctionsTypes.Module) => FirebaseFunctionsTypes.HttpsCallable<unknown, unknown>;
3
+ export declare const getThirdPartyAuthToken: (functions: FirebaseFunctionsTypes.Module) => FirebaseFunctionsTypes.HttpsCallable<unknown, unknown>;
4
+ //# sourceMappingURL=functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/auth/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAEzE,eAAO,MAAM,oBAAoB,GAAI,WAAW,sBAAsB,CAAC,MAAM,2DAC5B,CAAA;AAEjD,eAAO,MAAM,sBAAsB,GAAI,WAAW,sBAAsB,CAAC,MAAM,2DAC5B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './functions';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const AuthenticatorVerify: () => React.JSX.Element;
3
+ //# sourceMappingURL=AuthenticatorVerify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthenticatorVerify.d.ts","sourceRoot":"","sources":["../../../src/components/AuthenticatorVerify.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,eAAO,MAAM,mBAAmB,yBAuB/B,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { GoogleAuthProvider } from '@chem-po/core';
2
+ import React from 'react';
3
+ export declare const FirebaseSignIn: ({ googleProvider, }: {
4
+ googleProvider: GoogleAuthProvider | null;
5
+ }) => React.JSX.Element;
6
+ //# sourceMappingURL=FirebaseSignIn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FirebaseSignIn.d.ts","sourceRoot":"","sources":["../../../src/components/FirebaseSignIn.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAGlD,OAAO,KAAgC,MAAM,OAAO,CAAA;AAqFpD,eAAO,MAAM,cAAc,GAAI,qBAE5B;IACD,cAAc,EAAE,kBAAkB,GAAG,IAAI,CAAA;CAC1C,sBAaA,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { PhoneEnrollmentFactor } from '@chem-po/core';
2
+ import React from 'react';
3
+ export declare const PhoneVerify: ({ factor }: {
4
+ factor: PhoneEnrollmentFactor;
5
+ }) => React.JSX.Element;
6
+ //# sourceMappingURL=PhoneVerify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhoneVerify.d.ts","sourceRoot":"","sources":["../../../src/components/PhoneVerify.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAGrD,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,WAAW,GAAI,YAAY;IAAE,MAAM,EAAE,qBAAqB,CAAA;CAAE,sBA+CxE,CAAA"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const TwoFactorAuthModal: () => React.JSX.Element | null;
3
+ //# sourceMappingURL=TwoFactorAuthModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TwoFactorAuthModal.d.ts","sourceRoot":"","sources":["../../../src/components/TwoFactorAuthModal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAuEvC,eAAO,MAAM,kBAAkB,gCAqB9B,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './FirebaseSignIn';
2
+ export * from './TwoFactorAuthModal';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { FirebaseConfig, FirebaseContextValue } from '../types';
3
+ export interface FirebaseProviderProps {
4
+ config: FirebaseConfig;
5
+ children: React.ReactNode;
6
+ }
7
+ export declare function FirebaseProvider({ config, children }: FirebaseProviderProps): React.JSX.Element;
8
+ export declare function useFirebase(): FirebaseContextValue;
9
+ //# sourceMappingURL=FirebaseContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FirebaseContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/FirebaseContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkE,MAAM,OAAO,CAAA;AACtF,OAAO,KAAK,EAEV,cAAc,EACd,oBAAoB,EAGrB,MAAM,UAAU,CAAA;AAIjB,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,cAAc,CAAA;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,qBAAqB,qBA4B3E;AAED,wBAAgB,WAAW,yBAM1B"}
@@ -0,0 +1,2 @@
1
+ export * from './FirebaseContext';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}