@rownd/react-native 0.1.1

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 (175) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +213 -0
  3. package/android/build.gradle +59 -0
  4. package/android/src/main/AndroidManifest.xml +4 -0
  5. package/android/src/main/java/com/reactnative/ReactNativePackage.java +22 -0
  6. package/android/src/main/java/com/reactnative/ReactNativeViewManager.java +31 -0
  7. package/ios/ReactNative.xcodeproj/project.pbxproj +282 -0
  8. package/ios/ReactNative.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
  9. package/ios/ReactNativeViewManager.m +34 -0
  10. package/lib/commonjs/assets/images/checkmark--filled.svg +12 -0
  11. package/lib/commonjs/assets/images/email-verify-waiting.svg +36 -0
  12. package/lib/commonjs/assets/images/phone-verify-waiting.svg +26 -0
  13. package/lib/commonjs/components/AuthenticatedComponent.js +35 -0
  14. package/lib/commonjs/components/AuthenticatedComponent.js.map +1 -0
  15. package/lib/commonjs/components/AutoSigninDialog.js +119 -0
  16. package/lib/commonjs/components/AutoSigninDialog.js.map +1 -0
  17. package/lib/commonjs/components/DefaultContext.js +269 -0
  18. package/lib/commonjs/components/DefaultContext.js.map +1 -0
  19. package/lib/commonjs/components/GlobalContext.js +340 -0
  20. package/lib/commonjs/components/GlobalContext.js.map +1 -0
  21. package/lib/commonjs/components/RowndComponents.js +29 -0
  22. package/lib/commonjs/components/RowndComponents.js.map +1 -0
  23. package/lib/commonjs/components/RowndProvider.js +55 -0
  24. package/lib/commonjs/components/RowndProvider.js.map +1 -0
  25. package/lib/commonjs/components/SignIn.js +622 -0
  26. package/lib/commonjs/components/SignIn.js.map +1 -0
  27. package/lib/commonjs/data/actions.js +26 -0
  28. package/lib/commonjs/data/actions.js.map +1 -0
  29. package/lib/commonjs/hooks/api.js +157 -0
  30. package/lib/commonjs/hooks/api.js.map +1 -0
  31. package/lib/commonjs/hooks/debounce.js +38 -0
  32. package/lib/commonjs/hooks/debounce.js.map +1 -0
  33. package/lib/commonjs/hooks/fingerprint.js +176 -0
  34. package/lib/commonjs/hooks/fingerprint.js.map +1 -0
  35. package/lib/commonjs/hooks/index.js +48 -0
  36. package/lib/commonjs/hooks/index.js.map +1 -0
  37. package/lib/commonjs/hooks/interval.js +31 -0
  38. package/lib/commonjs/hooks/interval.js.map +1 -0
  39. package/lib/commonjs/hooks/nav.js +39 -0
  40. package/lib/commonjs/hooks/nav.js.map +1 -0
  41. package/lib/commonjs/hooks/rownd.js +163 -0
  42. package/lib/commonjs/hooks/rownd.js.map +1 -0
  43. package/lib/commonjs/index.js +32 -0
  44. package/lib/commonjs/index.js.map +1 -0
  45. package/lib/commonjs/index.tsx.bak +26 -0
  46. package/lib/commonjs/types.js +2 -0
  47. package/lib/commonjs/types.js.map +1 -0
  48. package/lib/commonjs/utils/config.js +28 -0
  49. package/lib/commonjs/utils/config.js.map +1 -0
  50. package/lib/commonjs/utils/events.js +57 -0
  51. package/lib/commonjs/utils/events.js.map +1 -0
  52. package/lib/commonjs/utils/form.js +46 -0
  53. package/lib/commonjs/utils/form.js.map +1 -0
  54. package/lib/commonjs/utils/queue.js +117 -0
  55. package/lib/commonjs/utils/queue.js.map +1 -0
  56. package/lib/commonjs/utils/storage.js +15 -0
  57. package/lib/commonjs/utils/storage.js.map +1 -0
  58. package/lib/commonjs/utils/tailwind.js +17 -0
  59. package/lib/commonjs/utils/tailwind.js.map +1 -0
  60. package/lib/commonjs/utils/tokens.js +35 -0
  61. package/lib/commonjs/utils/tokens.js.map +1 -0
  62. package/lib/commonjs/utils/user-data.js +21 -0
  63. package/lib/commonjs/utils/user-data.js.map +1 -0
  64. package/lib/module/assets/images/checkmark--filled.svg +12 -0
  65. package/lib/module/assets/images/email-verify-waiting.svg +36 -0
  66. package/lib/module/assets/images/phone-verify-waiting.svg +26 -0
  67. package/lib/module/components/AuthenticatedComponent.js +24 -0
  68. package/lib/module/components/AuthenticatedComponent.js.map +1 -0
  69. package/lib/module/components/AutoSigninDialog.js +100 -0
  70. package/lib/module/components/AutoSigninDialog.js.map +1 -0
  71. package/lib/module/components/DefaultContext.js +244 -0
  72. package/lib/module/components/DefaultContext.js.map +1 -0
  73. package/lib/module/components/GlobalContext.js +318 -0
  74. package/lib/module/components/GlobalContext.js.map +1 -0
  75. package/lib/module/components/RowndComponents.js +14 -0
  76. package/lib/module/components/RowndComponents.js.map +1 -0
  77. package/lib/module/components/RowndProvider.js +39 -0
  78. package/lib/module/components/RowndProvider.js.map +1 -0
  79. package/lib/module/components/SignIn.js +593 -0
  80. package/lib/module/components/SignIn.js.map +1 -0
  81. package/lib/module/data/actions.js +19 -0
  82. package/lib/module/data/actions.js.map +1 -0
  83. package/lib/module/hooks/api.js +138 -0
  84. package/lib/module/hooks/api.js.map +1 -0
  85. package/lib/module/hooks/debounce.js +29 -0
  86. package/lib/module/hooks/debounce.js.map +1 -0
  87. package/lib/module/hooks/fingerprint.js +157 -0
  88. package/lib/module/hooks/fingerprint.js.map +1 -0
  89. package/lib/module/hooks/index.js +7 -0
  90. package/lib/module/hooks/index.js.map +1 -0
  91. package/lib/module/hooks/interval.js +23 -0
  92. package/lib/module/hooks/interval.js.map +1 -0
  93. package/lib/module/hooks/nav.js +30 -0
  94. package/lib/module/hooks/nav.js.map +1 -0
  95. package/lib/module/hooks/rownd.js +148 -0
  96. package/lib/module/hooks/rownd.js.map +1 -0
  97. package/lib/module/index.js +6 -0
  98. package/lib/module/index.js.map +1 -0
  99. package/lib/module/index.tsx.bak +26 -0
  100. package/lib/module/types.js +2 -0
  101. package/lib/module/types.js.map +1 -0
  102. package/lib/module/utils/config.js +17 -0
  103. package/lib/module/utils/config.js.map +1 -0
  104. package/lib/module/utils/events.js +45 -0
  105. package/lib/module/utils/events.js.map +1 -0
  106. package/lib/module/utils/form.js +34 -0
  107. package/lib/module/utils/form.js.map +1 -0
  108. package/lib/module/utils/queue.js +109 -0
  109. package/lib/module/utils/queue.js.map +1 -0
  110. package/lib/module/utils/storage.js +6 -0
  111. package/lib/module/utils/storage.js.map +1 -0
  112. package/lib/module/utils/tailwind.js +5 -0
  113. package/lib/module/utils/tailwind.js.map +1 -0
  114. package/lib/module/utils/tokens.js +24 -0
  115. package/lib/module/utils/tokens.js.map +1 -0
  116. package/lib/module/utils/user-data.js +14 -0
  117. package/lib/module/utils/user-data.js.map +1 -0
  118. package/lib/typescript/example2/App.d.ts +11 -0
  119. package/lib/typescript/src/components/AuthenticatedComponent.d.ts +7 -0
  120. package/lib/typescript/src/components/AutoSigninDialog.d.ts +1 -0
  121. package/lib/typescript/src/components/DefaultContext.d.ts +12 -0
  122. package/lib/typescript/src/components/GlobalContext.d.ts +111 -0
  123. package/lib/typescript/src/components/RowndComponents.d.ts +1 -0
  124. package/lib/typescript/src/components/RowndProvider.d.ts +8 -0
  125. package/lib/typescript/src/components/SignIn.d.ts +1 -0
  126. package/lib/typescript/src/data/actions.d.ts +20 -0
  127. package/lib/typescript/src/hooks/api.d.ts +12 -0
  128. package/lib/typescript/src/hooks/debounce.d.ts +5 -0
  129. package/lib/typescript/src/hooks/fingerprint.d.ts +12 -0
  130. package/lib/typescript/src/hooks/index.d.ts +6 -0
  131. package/lib/typescript/src/hooks/interval.d.ts +2 -0
  132. package/lib/typescript/src/hooks/nav.d.ts +6 -0
  133. package/lib/typescript/src/hooks/rownd.d.ts +37 -0
  134. package/lib/typescript/src/index.d.ts +4 -0
  135. package/lib/typescript/src/types.d.ts +26 -0
  136. package/lib/typescript/src/utils/config.d.ts +18 -0
  137. package/lib/typescript/src/utils/events.d.ts +22 -0
  138. package/lib/typescript/src/utils/form.d.ts +17 -0
  139. package/lib/typescript/src/utils/queue.d.ts +21 -0
  140. package/lib/typescript/src/utils/storage.d.ts +3 -0
  141. package/lib/typescript/src/utils/tailwind.d.ts +2 -0
  142. package/lib/typescript/src/utils/tokens.d.ts +4 -0
  143. package/lib/typescript/src/utils/user-data.d.ts +3 -0
  144. package/lib/typescript/tailwind.config.d.ts +10 -0
  145. package/package.json +177 -0
  146. package/react-native.podspec +19 -0
  147. package/src/assets/images/checkmark--filled.svg +12 -0
  148. package/src/assets/images/email-verify-waiting.svg +36 -0
  149. package/src/assets/images/phone-verify-waiting.svg +26 -0
  150. package/src/components/AuthenticatedComponent.tsx +30 -0
  151. package/src/components/AutoSigninDialog.tsx +125 -0
  152. package/src/components/DefaultContext.tsx +278 -0
  153. package/src/components/GlobalContext.tsx +485 -0
  154. package/src/components/RowndComponents.tsx +21 -0
  155. package/src/components/RowndProvider.tsx +56 -0
  156. package/src/components/SignIn.tsx +770 -0
  157. package/src/data/actions.ts +21 -0
  158. package/src/hooks/api.ts +163 -0
  159. package/src/hooks/debounce.ts +36 -0
  160. package/src/hooks/fingerprint.ts +217 -0
  161. package/src/hooks/index.ts +7 -0
  162. package/src/hooks/interval.ts +25 -0
  163. package/src/hooks/nav.tsx +29 -0
  164. package/src/hooks/rownd.ts +184 -0
  165. package/src/index.tsx +6 -0
  166. package/src/index.tsx.bak +26 -0
  167. package/src/types.ts +27 -0
  168. package/src/utils/config.ts +36 -0
  169. package/src/utils/events.ts +54 -0
  170. package/src/utils/form.tsx +64 -0
  171. package/src/utils/queue.ts +75 -0
  172. package/src/utils/storage.ts +7 -0
  173. package/src/utils/tailwind.ts +6 -0
  174. package/src/utils/tokens.ts +26 -0
  175. package/src/utils/user-data.ts +15 -0
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getAppId = getAppId;
7
+ exports.getUserId = getUserId;
8
+
9
+ var _jwtDecode = _interopRequireDefault(require("jwt-decode"));
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
13
+ // Make sure token is always in a decoded form
14
+ function normalizeToken(token) {
15
+ if (typeof token === 'string') {
16
+ return (0, _jwtDecode.default)(token);
17
+ }
18
+
19
+ return token;
20
+ }
21
+
22
+ function getAppId(token) {
23
+ var _token, _token$aud, _token$aud$find;
24
+
25
+ token = normalizeToken(token);
26
+ return (_token = token) === null || _token === void 0 ? void 0 : (_token$aud = _token.aud) === null || _token$aud === void 0 ? void 0 : (_token$aud$find = _token$aud.find(aud => aud.startsWith('app:'))) === null || _token$aud$find === void 0 ? void 0 : _token$aud$find.substring(4);
27
+ }
28
+
29
+ function getUserId(token) {
30
+ var _token2;
31
+
32
+ token = normalizeToken(token);
33
+ return (_token2 = token) === null || _token2 === void 0 ? void 0 : _token2.sub;
34
+ }
35
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeToken","token","jwt_decode","getAppId","aud","find","startsWith","substring","getUserId","sub"],"sources":["tokens.ts"],"sourcesContent":["import jwt_decode from 'jwt-decode';\n\ntype TokenInput = Record<string, any> | string;\n\n// Make sure token is always in a decoded form\nfunction normalizeToken(token: TokenInput): Record<string, any> {\n if (typeof token === 'string') {\n return jwt_decode(token);\n }\n\n return token;\n}\n\nexport function getAppId(token: TokenInput) {\n token = normalizeToken(token);\n\n return token?.aud\n ?.find((aud: string) => aud.startsWith('app:'))\n ?.substring(4);\n}\n\nexport function getUserId(token: TokenInput) {\n token = normalizeToken(token);\n\n return token?.sub;\n}\n"],"mappings":";;;;;;;;AAAA;;;;AAIA;AACA,SAASA,cAAT,CAAwBC,KAAxB,EAAgE;EAC9D,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;IAC7B,OAAO,IAAAC,kBAAA,EAAWD,KAAX,CAAP;EACD;;EAED,OAAOA,KAAP;AACD;;AAEM,SAASE,QAAT,CAAkBF,KAAlB,EAAqC;EAAA;;EAC1CA,KAAK,GAAGD,cAAc,CAACC,KAAD,CAAtB;EAEA,iBAAOA,KAAP,yDAAO,OAAOG,GAAd,kEAAO,WACHC,IADG,CACGD,GAAD,IAAiBA,GAAG,CAACE,UAAJ,CAAe,MAAf,CADnB,CAAP,oDAAO,gBAEHC,SAFG,CAEO,CAFP,CAAP;AAGD;;AAEM,SAASC,SAAT,CAAmBP,KAAnB,EAAsC;EAAA;;EAC3CA,KAAK,GAAGD,cAAc,CAACC,KAAD,CAAtB;EAEA,kBAAOA,KAAP,4CAAO,QAAOQ,GAAd;AACD"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.redactUserDataWithAcls = redactUserDataWithAcls;
7
+
8
+ function redactUserDataWithAcls(userData, acls) {
9
+ if (!userData) {
10
+ return {};
11
+ }
12
+
13
+ return Object.entries(userData).reduce((acc, _ref) => {
14
+ var _acls$key;
15
+
16
+ let [key, value] = _ref;
17
+ acc[key] = !(acls !== null && acls !== void 0 && acls[key]) || acls !== null && acls !== void 0 && (_acls$key = acls[key]) !== null && _acls$key !== void 0 && _acls$key.shared ? value : 'ROWND_REDACTED';
18
+ return acc;
19
+ }, {});
20
+ }
21
+ //# sourceMappingURL=user-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["redactUserDataWithAcls","userData","acls","Object","entries","reduce","acc","key","value","shared"],"sources":["user-data.ts"],"sourcesContent":["export function redactUserDataWithAcls(\n userData: Record<string, any> | undefined | null,\n acls: Record<string, { shared: boolean }> | undefined | null\n): Record<string, any> {\n if (!userData) {\n return {};\n }\n return Object.entries(userData).reduce(\n (acc: Record<string, any>, [key, value]) => {\n acc[key] = !acls?.[key] || acls?.[key]?.shared ? value : 'ROWND_REDACTED';\n return acc;\n },\n {}\n );\n}\n"],"mappings":";;;;;;;AAAO,SAASA,sBAAT,CACLC,QADK,EAELC,IAFK,EAGgB;EACrB,IAAI,CAACD,QAAL,EAAe;IACb,OAAO,EAAP;EACD;;EACD,OAAOE,MAAM,CAACC,OAAP,CAAeH,QAAf,EAAyBI,MAAzB,CACL,CAACC,GAAD,WAA4C;IAAA;;IAAA,IAAjB,CAACC,GAAD,EAAMC,KAAN,CAAiB;IAC1CF,GAAG,CAACC,GAAD,CAAH,GAAW,EAACL,IAAD,aAACA,IAAD,eAACA,IAAI,CAAGK,GAAH,CAAL,KAAgBL,IAAhB,aAAgBA,IAAhB,4BAAgBA,IAAI,CAAGK,GAAH,CAApB,sCAAgB,UAAaE,MAA7B,GAAsCD,KAAtC,GAA8C,gBAAzD;IACA,OAAOF,GAAP;EACD,CAJI,EAKL,EALK,CAAP;AAOD"}
@@ -0,0 +1,12 @@
1
+ <svg id="icon" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
2
+ <defs>
3
+ <style>
4
+ .cls-1 {
5
+ fill: none;
6
+ }
7
+ </style>
8
+ </defs>
9
+ <path d="M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2ZM14,21.5908l-5-5L10.5906,15,14,18.4092,21.41,11l1.5957,1.5859Z"/>
10
+ <polygon id="inner-path" class="cls-1" points="14 21.591 9 16.591 10.591 15 14 18.409 21.41 11 23.005 12.585 14 21.591"/>
11
+ <rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" class="cls-1" width="32" height="32"/>
12
+ </svg>
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="79px" height="68px" viewBox="0 0 79 68" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>Group</title>
4
+ <defs>
5
+ <rect id="path-1" x="9.69736842" y="6.17105263" width="53.7763158" height="45.8421053" rx="8"></rect>
6
+ <filter x="-27.0%" y="-20.7%" width="153.9%" height="163.3%" filterUnits="objectBoundingBox" id="filter-2">
7
+ <feOffset dx="0" dy="5" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
8
+ <feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
9
+ <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
10
+ </filter>
11
+ <path d="M1.49198314,22.8826009 L27.3602885,37.5009111 C33.5004408,40.9707422 41.014234,40.9500831 47.1352131,37.4465401 L72.5558685,22.8961951 C73.0351888,22.6218404 73.6461631,22.7879979 73.9205178,23.2673182 C74.007089,23.4185653 74.0526316,23.5898106 74.0526316,23.7640813 L74.0526316,63 C74.0526316,65.209139 72.2617706,67 70.0526316,67 L4,67 C1.790861,67 2.705415e-16,65.209139 0,63 L0,23.7532056 C8.43762138e-16,23.2009209 0.44771525,22.7532056 1,22.7532056 C1.17240673,22.7532056 1.34188502,22.7977797 1.49198314,22.8826009 Z" id="path-3"></path>
12
+ <filter x="-4.7%" y="-8.4%" width="109.5%" height="114.0%" filterUnits="objectBoundingBox" id="filter-4">
13
+ <feOffset dx="0" dy="-1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
14
+ <feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
15
+ <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
16
+ </filter>
17
+ </defs>
18
+ <g id="V2-post--feedback" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
19
+ <g id="xlg-1312px-16-column-copy-96" transform="translate(-616.000000, -265.000000)">
20
+ <g id="Group" transform="translate(618.000000, 265.000000)">
21
+ <path d="M1.1333848,21.7417845 L33.0948714,2.49908682 C35.6464021,0.96291506 38.8400625,0.97130271 41.383489,2.52085558 L72.9358668,21.743773 C73.4075139,22.0311185 73.5569199,22.6464036 73.2695744,23.1180507 C73.2235298,23.1936281 73.1676563,23.2627588 73.1034181,23.3236315 L37.2457723,57.3026316 L37.2457723,57.3026316 L0.965647178,23.3284209 C0.562522036,22.9509179 0.54175124,22.3180937 0.919254307,21.9149685 C0.982302388,21.8476412 1.0543624,21.7893607 1.1333848,21.7417845 Z" id="Path-28" fill="#545454"></path>
22
+ <g id="Rectangle">
23
+ <use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
24
+ <use fill="#FFFFFF" fill-rule="evenodd" xlink:href="#path-1"></use>
25
+ </g>
26
+ <rect id="Rectangle" fill-opacity="0.4" fill="#D8D8D8" x="18.5131579" y="19.3947368" width="36.1447368" height="3.52631579"></rect>
27
+ <rect id="Rectangle-Copy" fill-opacity="0.4" fill="#D8D8D8" x="18.5131579" y="27.3289474" width="36.1447368" height="26.4473684"></rect>
28
+ <g id="Rectangle">
29
+ <use fill="black" fill-opacity="1" filter="url(#filter-4)" xlink:href="#path-3"></use>
30
+ <use fill="#646464" fill-rule="evenodd" xlink:href="#path-3"></use>
31
+ </g>
32
+ <path d="M23.2845382,51.744338 L1.76315789,67 L1.76315789,67 L71.4078947,67 L49.8865144,51.744338 C41.9186006,46.0961966 31.252452,46.0961966 23.2845382,51.744338 Z" id="Path-29" fill="#545454"></path>
33
+ </g>
34
+ </g>
35
+ </g>
36
+ </svg>
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="62px" height="100px" viewBox="0 0 62 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>unverified-phone</title>
4
+ <defs>
5
+ <rect id="path-1" x="0" y="0" width="58" height="96" rx="8"></rect>
6
+ <filter x="-5.2%" y="-3.1%" width="110.3%" height="106.2%" filterUnits="objectBoundingBox" id="filter-2">
7
+ <feOffset dx="0" dy="0" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
8
+ <feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
9
+ <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
10
+ </filter>
11
+ </defs>
12
+ <g id="SMS-verify-from-web-stay-on-web-(BR)" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g id="xlg-1312px-16-column-copy-51" transform="translate(-625.000000, -259.000000)">
14
+ <g id="unverified-phone" transform="translate(627.000000, 261.000000)">
15
+ <g id="Rectangle">
16
+ <use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
17
+ <use fill="#444444" fill-rule="evenodd" xlink:href="#path-1"></use>
18
+ </g>
19
+ <circle id="Oval" fill="#000000" cx="29" cy="89" r="5"></circle>
20
+ <rect id="Rectangle" fill="#FFFFFF" x="5" y="11" width="48" height="71" rx="2"></rect>
21
+ <rect id="Rectangle" fill-opacity="0.4" fill="#D8D8D8" x="10" y="20" width="38" height="5"></rect>
22
+ <rect id="Rectangle-Copy" fill-opacity="0.4" fill="#D8D8D8" x="10" y="31" width="38" height="36"></rect>
23
+ </g>
24
+ </g>
25
+ </g>
26
+ </svg>
@@ -0,0 +1,24 @@
1
+ import React, { useEffect } from 'react';
2
+
3
+ const {
4
+ useRownd
5
+ } = require('../hooks/rownd');
6
+
7
+ export default function (_ref) {
8
+ let {
9
+ shouldRequestSignIn,
10
+ renderContentWhenUnauthenticated,
11
+ children
12
+ } = _ref;
13
+ const {
14
+ is_authenticated,
15
+ requestSignIn
16
+ } = useRownd();
17
+ useEffect(() => {
18
+ if (shouldRequestSignIn && !is_authenticated) {
19
+ requestSignIn();
20
+ }
21
+ }, [is_authenticated, requestSignIn, shouldRequestSignIn]);
22
+ return /*#__PURE__*/React.createElement(React.Fragment, null, (is_authenticated || renderContentWhenUnauthenticated) && /*#__PURE__*/React.createElement(React.Fragment, null, children));
23
+ }
24
+ //# sourceMappingURL=AuthenticatedComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useEffect","useRownd","require","shouldRequestSignIn","renderContentWhenUnauthenticated","children","is_authenticated","requestSignIn"],"sources":["AuthenticatedComponent.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\n\nconst { useRownd } = require('../hooks/rownd');\n\ninterface IAuthenticatedComponentProps {\n shouldRequestSignIn?: boolean;\n renderContentWhenUnauthenticated?: boolean;\n}\n\nexport default function ({\n shouldRequestSignIn,\n renderContentWhenUnauthenticated,\n children,\n}: React.PropsWithChildren<IAuthenticatedComponentProps>) {\n const { is_authenticated, requestSignIn } = useRownd();\n\n useEffect(() => {\n if (shouldRequestSignIn && !is_authenticated) {\n requestSignIn();\n }\n }, [is_authenticated, requestSignIn, shouldRequestSignIn]);\n\n return (\n <>\n {(is_authenticated || renderContentWhenUnauthenticated) && (\n <>{children}</>\n )}\n </>\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;;AAEA,MAAM;EAAEC;AAAF,IAAeC,OAAO,CAAC,gBAAD,CAA5B;;AAOA,eAAe,gBAI2C;EAAA,IAJjC;IACvBC,mBADuB;IAEvBC,gCAFuB;IAGvBC;EAHuB,CAIiC;EACxD,MAAM;IAAEC,gBAAF;IAAoBC;EAApB,IAAsCN,QAAQ,EAApD;EAEAD,SAAS,CAAC,MAAM;IACd,IAAIG,mBAAmB,IAAI,CAACG,gBAA5B,EAA8C;MAC5CC,aAAa;IACd;EACF,CAJQ,EAIN,CAACD,gBAAD,EAAmBC,aAAnB,EAAkCJ,mBAAlC,CAJM,CAAT;EAMA,oBACE,0CACG,CAACG,gBAAgB,IAAIF,gCAArB,kBACC,0CAAGC,QAAH,CAFJ,CADF;AAOD"}
@@ -0,0 +1,100 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import React, { useMemo, useCallback, useEffect, useRef } from 'react';
4
+ import { View, Text, StyleSheet, ActivityIndicator } from 'react-native';
5
+ import { BottomSheetBackdrop, BottomSheetModal } from '@gorhom/bottom-sheet';
6
+ import { useTimeout } from 'usehooks-ts';
7
+ import { MaterialIcons } from '@expo/vector-icons';
8
+ import { useNav } from '../hooks';
9
+ import { useGlobalContext } from './GlobalContext';
10
+ export function AutoSigninDialog() {
11
+ const navTo = useNav();
12
+ const {
13
+ state
14
+ } = useGlobalContext(); // Let the user know they're auto signing-in, then close when done
15
+
16
+ useTimeout(() => {
17
+ if (state.nav.options.type === 'error') {
18
+ return;
19
+ }
20
+
21
+ handleClose();
22
+ }, 3000);
23
+ const bottomSheetModalRef = useRef(null);
24
+ useEffect(() => {
25
+ if (bottomSheetModalRef.current) {
26
+ bottomSheetModalRef.current.present();
27
+ }
28
+ }, []);
29
+ const handleClose = useCallback(() => {
30
+ setTimeout(() => {
31
+ navTo({
32
+ hide: true
33
+ });
34
+ }, 150);
35
+ }, [navTo]);
36
+ const snapPoints = useMemo(() => ['30%', '60%'], []);
37
+ const renderBackdrop = useCallback(props => /*#__PURE__*/React.createElement(BottomSheetBackdrop, _extends({}, props, {
38
+ pressBehavior: "none"
39
+ })), []);
40
+ return /*#__PURE__*/React.createElement(BottomSheetModal, {
41
+ snapPoints: snapPoints,
42
+ index: 0,
43
+ backdropComponent: renderBackdrop,
44
+ keyboardBehavior: "fillParent",
45
+ android_keyboardInputMode: "adjustResize",
46
+ enablePanDownToClose: state.nav.options.type === 'error',
47
+ onDismiss: handleClose,
48
+ style: styles.bottomSheet,
49
+ ref: bottomSheetModalRef
50
+ }, /*#__PURE__*/React.createElement(View, {
51
+ style: styles.innerContainer
52
+ }, state.nav.options.type === 'error' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MaterialIcons, {
53
+ name: "error",
54
+ size: 24,
55
+ color: "#DA1E28",
56
+ style: styles.errorIcon
57
+ }), /*#__PURE__*/React.createElement(Text, {
58
+ style: styles.errorMessage
59
+ }, state.nav.options.message || 'An error occurred. Please try again.')), state.nav.options.type === 'sign-in' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ActivityIndicator, {
60
+ size: "large",
61
+ color: "#5b0ae0"
62
+ }), /*#__PURE__*/React.createElement(Text, {
63
+ style: styles.signInMessage
64
+ }, "Automatically signing you in. Just a sec..."))));
65
+ }
66
+ const styles = StyleSheet.create({
67
+ modal: {// flex: 1,
68
+ },
69
+ bottomSheet: {
70
+ shadowColor: '#000',
71
+ shadowOffset: {
72
+ width: 0,
73
+ height: 12
74
+ },
75
+ shadowOpacity: 0.58,
76
+ shadowRadius: 16.0,
77
+ elevation: 24
78
+ },
79
+ innerContainer: {
80
+ borderRadius: 20,
81
+ borderColor: 'transparent',
82
+ borderWidth: 0,
83
+ padding: 25,
84
+ textAlign: 'center'
85
+ },
86
+ signInMessage: {
87
+ textAlign: 'center',
88
+ fontSize: 24,
89
+ padding: 20
90
+ },
91
+ errorMessage: {
92
+ textAlign: 'center',
93
+ fontSize: 24,
94
+ padding: 20
95
+ },
96
+ errorIcon: {
97
+ textAlign: 'center'
98
+ }
99
+ });
100
+ //# sourceMappingURL=AutoSigninDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useMemo","useCallback","useEffect","useRef","View","Text","StyleSheet","ActivityIndicator","BottomSheetBackdrop","BottomSheetModal","useTimeout","MaterialIcons","useNav","useGlobalContext","AutoSigninDialog","navTo","state","nav","options","type","handleClose","bottomSheetModalRef","current","present","setTimeout","hide","snapPoints","renderBackdrop","props","styles","bottomSheet","innerContainer","errorIcon","errorMessage","message","signInMessage","create","modal","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","borderRadius","borderColor","borderWidth","padding","textAlign","fontSize"],"sources":["AutoSigninDialog.tsx"],"sourcesContent":["import React, { useMemo, useCallback, useEffect, useRef } from 'react';\nimport { View, Text, StyleSheet, ActivityIndicator } from 'react-native';\nimport {\n BottomSheetBackdrop,\n BottomSheetBackdropProps,\n BottomSheetModal,\n} from '@gorhom/bottom-sheet';\nimport { useTimeout } from 'usehooks-ts';\nimport { MaterialIcons } from '@expo/vector-icons';\n\nimport { useNav } from '../hooks';\nimport { useGlobalContext } from './GlobalContext';\n\nexport function AutoSigninDialog() {\n const navTo = useNav();\n const { state } = useGlobalContext();\n\n // Let the user know they're auto signing-in, then close when done\n useTimeout(() => {\n if (state.nav.options.type === 'error') {\n return;\n }\n\n handleClose();\n }, 3000);\n\n const bottomSheetModalRef = useRef<BottomSheetModal>(null);\n useEffect(() => {\n if (bottomSheetModalRef.current) {\n bottomSheetModalRef.current.present();\n }\n }, []);\n\n const handleClose = useCallback(() => {\n setTimeout(() => {\n navTo({ hide: true });\n }, 150);\n }, [navTo]);\n\n const snapPoints = useMemo(() => ['30%', '60%'], []);\n\n const renderBackdrop = useCallback(\n (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop {...props} pressBehavior=\"none\" />\n ),\n []\n );\n\n return (\n <BottomSheetModal\n snapPoints={snapPoints}\n index={0}\n backdropComponent={renderBackdrop}\n keyboardBehavior=\"fillParent\"\n android_keyboardInputMode=\"adjustResize\"\n enablePanDownToClose={state.nav.options.type === 'error'}\n onDismiss={handleClose}\n style={styles.bottomSheet}\n ref={bottomSheetModalRef}\n >\n <View style={styles.innerContainer}>\n {state.nav.options.type === 'error' && (\n <>\n <MaterialIcons\n name=\"error\"\n size={24}\n color=\"#DA1E28\"\n style={styles.errorIcon}\n />\n <Text style={styles.errorMessage}>\n {state.nav.options.message ||\n 'An error occurred. Please try again.'}\n </Text>\n </>\n )}\n\n {state.nav.options.type === 'sign-in' && (\n <>\n <ActivityIndicator size=\"large\" color=\"#5b0ae0\" />\n <Text style={styles.signInMessage}>\n Automatically signing you in. Just a sec...\n </Text>\n </>\n )}\n </View>\n </BottomSheetModal>\n );\n}\n\nconst styles = StyleSheet.create({\n modal: {\n // flex: 1,\n },\n bottomSheet: {\n shadowColor: '#000',\n shadowOffset: {\n width: 0,\n height: 12,\n },\n shadowOpacity: 0.58,\n shadowRadius: 16.0,\n\n elevation: 24,\n },\n innerContainer: {\n borderRadius: 20,\n borderColor: 'transparent',\n borderWidth: 0,\n padding: 25,\n textAlign: 'center',\n },\n signInMessage: {\n textAlign: 'center',\n fontSize: 24,\n padding: 20,\n },\n errorMessage: {\n textAlign: 'center',\n fontSize: 24,\n padding: 20,\n },\n errorIcon: {\n textAlign: 'center',\n },\n});\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,EAAyBC,WAAzB,EAAsCC,SAAtC,EAAiDC,MAAjD,QAA+D,OAA/D;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,UAArB,EAAiCC,iBAAjC,QAA0D,cAA1D;AACA,SACEC,mBADF,EAGEC,gBAHF,QAIO,sBAJP;AAKA,SAASC,UAAT,QAA2B,aAA3B;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,gBAAT,QAAiC,iBAAjC;AAEA,OAAO,SAASC,gBAAT,GAA4B;EACjC,MAAMC,KAAK,GAAGH,MAAM,EAApB;EACA,MAAM;IAAEI;EAAF,IAAYH,gBAAgB,EAAlC,CAFiC,CAIjC;;EACAH,UAAU,CAAC,MAAM;IACf,IAAIM,KAAK,CAACC,GAAN,CAAUC,OAAV,CAAkBC,IAAlB,KAA2B,OAA/B,EAAwC;MACtC;IACD;;IAEDC,WAAW;EACZ,CANS,EAMP,IANO,CAAV;EAQA,MAAMC,mBAAmB,GAAGlB,MAAM,CAAmB,IAAnB,CAAlC;EACAD,SAAS,CAAC,MAAM;IACd,IAAImB,mBAAmB,CAACC,OAAxB,EAAiC;MAC/BD,mBAAmB,CAACC,OAApB,CAA4BC,OAA5B;IACD;EACF,CAJQ,EAIN,EAJM,CAAT;EAMA,MAAMH,WAAW,GAAGnB,WAAW,CAAC,MAAM;IACpCuB,UAAU,CAAC,MAAM;MACfT,KAAK,CAAC;QAAEU,IAAI,EAAE;MAAR,CAAD,CAAL;IACD,CAFS,EAEP,GAFO,CAAV;EAGD,CAJ8B,EAI5B,CAACV,KAAD,CAJ4B,CAA/B;EAMA,MAAMW,UAAU,GAAG1B,OAAO,CAAC,MAAM,CAAC,KAAD,EAAQ,KAA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EAI/BP,WAAW,EAAE;IACXQ,WAAW,EAAE,MADF;IAEXC,YAAY,EAAE;MACZC,KAAK,EAAE,CADK;MAEZC,MAAM,EAAE;IAFI,CAFH;IAMXC,aAAa,EAAE,IANJ;IAOXC,YAAY,EAAE,IAPH;IASXC,SAAS,EAAE;EATA,CAJkB;EAe/Bb,cAAc,EAAE;IACdc,YAAY,EAAE,EADA;IAEdC,WAAW,EAAE,aAFC;IAGdC,WAAW,EAAE,CAHC;IAIdC,OAAO,EAAE,EAJK;IAKdC,SAAS,EAAE;EALG,CAfe;EAsB/Bd,aAAa,EAAE;IACbc,SAAS,EAAE,QADE;IAEbC,QAAQ,EAAE,EAFG;IAGbF,OAAO,EAAE;EAHI,CAtBgB;EA2B/Bf,YAAY,EAAE;IACZgB,SAAS,EAAE,QADC;IAEZC,QAAQ,EAAE,EAFE;IAGZF,OAAO,EAAE;EAHG,CA3BiB;EAgC/BhB,SAAS,EAAE;IACTiB,SAAS,EAAE;EADF;AAhCoB,CAAlB,CAAf"}
@@ -0,0 +1,244 @@
1
+ import { useEffect, useCallback, useRef } from 'react';
2
+ import isEqual from 'lodash-es/isEqual';
3
+ import { useDebounce, useApi, useDeviceFingerprint } from '../hooks';
4
+ import { DEFAULT_USER_AGENT } from '../hooks/api';
5
+ import { useGlobalContext } from './GlobalContext';
6
+ import { ActionType } from '../data/actions';
7
+ import ky from 'ky';
8
+ import * as Clipboard from 'expo-clipboard';
9
+ import base64 from 'react-native-base64';
10
+ import { Linking } from 'react-native';
11
+ import { events, EventType } from '../utils/events';
12
+ export function DefaultContext(_ref) {
13
+ let {
14
+ config
15
+ } = _ref;
16
+ const {
17
+ state,
18
+ dispatch
19
+ } = useGlobalContext();
20
+ const {
21
+ client: api
22
+ } = useApi();
23
+ useDeviceFingerprint(); // Fetch app schema and config
24
+
25
+ useEffect(() => {
26
+ (async () => {
27
+ try {
28
+ var _resp$app;
29
+
30
+ const resp = await api.get('hub/app-config', {
31
+ headers: {
32
+ 'x-rownd-app-key': config.appKey
33
+ }
34
+ }).json();
35
+
36
+ if (resp !== null && resp !== void 0 && (_resp$app = resp.app) !== null && _resp$app !== void 0 && _resp$app.icon) {
37
+ const iconMeta = await ky.head(resp.app.icon);
38
+ resp.app.icon_content_type = iconMeta.headers.get('content-type');
39
+ }
40
+
41
+ dispatch({
42
+ type: ActionType.SET_APP_CONFIG,
43
+ payload: resp.app
44
+ });
45
+ } catch (err) {
46
+ console.error('Failed to fetch app config:', err);
47
+ }
48
+ })();
49
+ }, [api, config.appKey, dispatch]);
50
+ /**
51
+ * If not signed in, check the clipboard for an init hash or auth link we can use to auto-auth the user
52
+ */
53
+
54
+ useEffect(() => {
55
+ if (state.auth.access_token || !state.app.id) {
56
+ return;
57
+ }
58
+
59
+ (async () => {
60
+ try {
61
+ let authData = null;
62
+ let authLink = (await Linking.getInitialURL()) || (await Clipboard.getStringAsync());
63
+
64
+ if (authLink.includes('rownd.link')) {
65
+ dispatch({
66
+ type: ActionType.CHANGE_ROUTE,
67
+ payload: {
68
+ route: '/account/auto-signin',
69
+ opts: {
70
+ type: 'sign-in'
71
+ }
72
+ }
73
+ });
74
+ authData = await ky.get(authLink, {
75
+ headers: {
76
+ 'User-Agent': DEFAULT_USER_AGENT
77
+ }
78
+ }).json();
79
+ } else if (authLink.startsWith('rph_init=')) {
80
+ const authStr = authLink.split('rph_init=')[1];
81
+ authData = JSON.parse(base64.decode(authStr));
82
+ } else {
83
+ return;
84
+ } // Clear the clipboard value so we don't leak any creds
85
+
86
+
87
+ await Clipboard.setStringAsync('');
88
+ dispatch({
89
+ type: ActionType.LOGIN_SUCCESS,
90
+ payload: authData
91
+ });
92
+ } catch (err) {
93
+ console.error('We found an auth link or string, but failed to authenticate with it because:', err);
94
+ }
95
+ })();
96
+ }, [state.auth.access_token, state.app.id, dispatch]);
97
+ const retrieveUserInfo = useCallback(() => {
98
+ if (!state.auth.access_token || !state.app.id) {
99
+ return;
100
+ }
101
+
102
+ (async () => {
103
+ const userInfo = await api.get(`me/applications/${state.app.id}/data`, {
104
+ headers: {
105
+ Authorization: `Bearer ${state.auth.access_token}`
106
+ }
107
+ }).json();
108
+ dispatch({
109
+ type: ActionType.LOAD_USER,
110
+ payload: userInfo
111
+ });
112
+ dispatch({
113
+ type: ActionType.UPDATE_LOCAL_ACLS,
114
+ payload: userInfo.redacted.reduce((acc, field) => {
115
+ acc[field] = {
116
+ shared: false
117
+ };
118
+ return acc;
119
+ }, {})
120
+ });
121
+ })();
122
+ }, [api, dispatch, state.app.id, state.auth.access_token]);
123
+ const retrieveAcls = useCallback(() => {
124
+ if (!state.app.id || !state.auth.access_token) {
125
+ return;
126
+ }
127
+
128
+ (async () => {
129
+ try {
130
+ const appUserAcls = await api.get(`me/applications/${state.app.id}/acls`, {
131
+ headers: {
132
+ Authorization: `Bearer ${state.auth.access_token}`
133
+ }
134
+ }).json();
135
+ dispatch({
136
+ type: ActionType.UPDATE_LOCAL_ACLS,
137
+ payload: appUserAcls.acls
138
+ });
139
+ } catch (err) {
140
+ if (err instanceof Error) {
141
+ // const unsharedAcls = reduceSchemaToUnsharedAcls();
142
+ dispatch({
143
+ type: ActionType.UPDATE_LOCAL_ACLS,
144
+ payload: {}
145
+ });
146
+ }
147
+ }
148
+ })();
149
+ }, [api, dispatch, state.app.id, state.auth.access_token]);
150
+ useEffect(retrieveUserInfo, [retrieveUserInfo]);
151
+ useEffect(retrieveAcls, [retrieveAcls]);
152
+ useEffect(() => {
153
+ if (!state.user.needs_refresh) {
154
+ return;
155
+ }
156
+
157
+ retrieveUserInfo();
158
+ dispatch({
159
+ type: ActionType.SET_REFRESH_USER_DATA,
160
+ payload: {
161
+ needs_refresh: false
162
+ }
163
+ });
164
+ }, [dispatch, retrieveUserInfo, state.user.needs_refresh]);
165
+ const saveAclsDebounced = useDebounce(saveAcls, 2000); // 2s
166
+
167
+ async function saveAcls() {
168
+ if (state.app.id && state.local_acls) {
169
+ await api.put(`me/applications/${state.app.id}/acls`, {
170
+ headers: {
171
+ Authorization: `Bearer ${state.auth.access_token}`
172
+ },
173
+ json: {
174
+ acls: state.local_acls
175
+ }
176
+ }).json();
177
+ }
178
+ }
179
+
180
+ const localAclsRef = useRef(state.local_acls);
181
+ useEffect(() => {
182
+ // Don't save acls if they were just loaded for the first time or they haven't changed
183
+ if (!localAclsRef.current || isEqual(localAclsRef.current, state.local_acls)) {
184
+ return;
185
+ }
186
+
187
+ saveAclsDebounced();
188
+ }, [saveAclsDebounced, state.local_acls]);
189
+ const saveUserDataDebounced = useDebounce(saveUserData, 2000); // 2s
190
+ // Save user data in the application state to the API server
191
+
192
+ async function saveUserData() {
193
+ if (state.app.id && state.user.data && state.auth.access_token) {
194
+ dispatch({
195
+ type: ActionType.SET_IS_SAVING_USER_DATA,
196
+ payload: {
197
+ saving: true
198
+ }
199
+ });
200
+ const eventDetails = {};
201
+
202
+ try {
203
+ eventDetails.data = await api.put(`me/applications/${state.app.id}/data`, {
204
+ headers: {
205
+ Authorization: `Bearer ${state.auth.access_token}`
206
+ },
207
+ json: {
208
+ data: state.user.data
209
+ }
210
+ }).json();
211
+ } catch (err) {
212
+ eventDetails.error = err; // Get the latest user info from Rownd. Something was probably bad
213
+ // with the data we just tried to save.
214
+ // This is a bit hacky. We should be able to reset the state without
215
+ // calling rownd again by rolling back to a previously good state...
216
+
217
+ retrieveUserInfo(); // TODO: Set some error state
218
+ } finally {
219
+ events.dispatch(EventType.USER_DATA_SAVED, eventDetails);
220
+ dispatch({
221
+ type: ActionType.SET_IS_SAVING_USER_DATA,
222
+ payload: {
223
+ saving: false
224
+ }
225
+ });
226
+ }
227
+ }
228
+ }
229
+
230
+ const userDataRef = useRef(state.user.data);
231
+ useEffect(() => {
232
+ var _state$user$data;
233
+
234
+ // Don't update the user data in the API server if the email is unknown or the data hasn't changed
235
+ if (!((_state$user$data = state.user.data) !== null && _state$user$data !== void 0 && _state$user$data.email) && !state.user.data.phone_number || isEqual(userDataRef.current, state.user.data)) {
236
+ return;
237
+ }
238
+
239
+ saveUserDataDebounced();
240
+ userDataRef.current = state.user.data;
241
+ }, [dispatch, saveUserDataDebounced, state.user.data]);
242
+ return null;
243
+ }
244
+ //# sourceMappingURL=DefaultContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useCallback","useRef","isEqual","useDebounce","useApi","useDeviceFingerprint","DEFAULT_USER_AGENT","useGlobalContext","ActionType","ky","Clipboard","base64","Linking","events","EventType","DefaultContext","config","state","dispatch","client","api","resp","get","headers","appKey","json","app","icon","iconMeta","head","icon_content_type","type","SET_APP_CONFIG","payload","err","console","error","auth","access_token","id","authData","authLink","getInitialURL","getStringAsync","includes","CHANGE_ROUTE","route","opts","startsWith","authStr","split","JSON","parse","decode","setStringAsync","LOGIN_SUCCESS","retrieveUserInfo","userInfo","Authorization","LOAD_USER","UPDATE_LOCAL_ACLS","redacted","reduce","acc","field","shared","retrieveAcls","appUserAcls","acls","Error","user","needs_refresh","SET_REFRESH_USER_DATA","saveAclsDebounced","saveAcls","local_acls","put","localAclsRef","current","saveUserDataDebounced","saveUserData","data","SET_IS_SAVING_USER_DATA","saving","eventDetails","USER_DATA_SAVED","userDataRef","email","phone_number"],"sources":["DefaultContext.tsx"],"sourcesContent":["import { useEffect, useCallback, useRef } from 'react';\nimport isEqual from 'lodash-es/isEqual';\nimport { useDebounce, useApi, useDeviceFingerprint } from '../hooks';\nimport { DEFAULT_USER_AGENT } from '../hooks/api';\nimport type { IConfig } from '../utils/config';\nimport { useGlobalContext } from './GlobalContext';\nimport { ActionType } from '../data/actions';\nimport ky from 'ky';\nimport * as Clipboard from 'expo-clipboard';\nimport base64 from 'react-native-base64';\nimport { Linking } from 'react-native';\nimport { events, EventType } from '../utils/events';\n\nexport type UserInfoResp = {\n data: {\n [key: string]: any;\n };\n redacted: string[];\n};\n\ninterface UserAclsResponse {\n acls: Record<string, { shared: boolean }>;\n}\n\ntype DefaultContextProps = {\n config: IConfig;\n};\n\nexport function DefaultContext({ config }: DefaultContextProps) {\n const { state, dispatch } = useGlobalContext();\n const { client: api } = useApi();\n useDeviceFingerprint();\n\n // Fetch app schema and config\n useEffect(() => {\n (async () => {\n try {\n const resp: any = await api\n .get('hub/app-config', {\n headers: {\n 'x-rownd-app-key': config.appKey,\n },\n })\n .json();\n\n if (resp?.app?.icon) {\n const iconMeta = await ky.head(resp.app.icon);\n resp.app.icon_content_type = iconMeta.headers.get('content-type');\n }\n\n dispatch({\n type: ActionType.SET_APP_CONFIG,\n payload: resp.app,\n });\n } catch (err) {\n console.error('Failed to fetch app config:', err);\n }\n })();\n }, [api, config.appKey, dispatch]);\n\n /**\n * If not signed in, check the clipboard for an init hash or auth link we can use to auto-auth the user\n */\n useEffect(() => {\n if (state.auth.access_token || !state.app.id) {\n return;\n }\n\n (async () => {\n try {\n let authData = null;\n\n let authLink =\n (await Linking.getInitialURL()) || (await Clipboard.getStringAsync());\n if (authLink.includes('rownd.link')) {\n dispatch({\n type: ActionType.CHANGE_ROUTE,\n payload: {\n route: '/account/auto-signin',\n opts: {\n type: 'sign-in',\n },\n },\n });\n\n authData = await ky\n .get(authLink, {\n headers: {\n 'User-Agent': DEFAULT_USER_AGENT,\n },\n })\n .json();\n } else if (authLink.startsWith('rph_init=')) {\n const authStr = authLink.split('rph_init=')[1];\n authData = JSON.parse(base64.decode(authStr));\n } else {\n return;\n }\n\n // Clear the clipboard value so we don't leak any creds\n await Clipboard.setStringAsync('');\n\n dispatch({\n type: ActionType.LOGIN_SUCCESS,\n payload: authData,\n });\n } catch (err) {\n console.error(\n 'We found an auth link or string, but failed to authenticate with it because:',\n err\n );\n }\n })();\n }, [state.auth.access_token, state.app.id, dispatch]);\n\n const retrieveUserInfo = useCallback(() => {\n if (!state.auth.access_token || !state.app.id) {\n return;\n }\n\n (async () => {\n const userInfo: UserInfoResp = await api\n .get(`me/applications/${state.app.id}/data`, {\n headers: {\n Authorization: `Bearer ${state.auth.access_token}`,\n },\n })\n .json();\n dispatch({\n type: ActionType.LOAD_USER,\n payload: userInfo,\n });\n\n dispatch({\n type: ActionType.UPDATE_LOCAL_ACLS,\n payload: userInfo.redacted.reduce(\n (acc: Record<string, any>, field: string) => {\n acc[field] = { shared: false };\n return acc;\n },\n {}\n ),\n });\n })();\n }, [api, dispatch, state.app.id, state.auth.access_token]);\n\n const retrieveAcls = useCallback(() => {\n if (!state.app.id || !state.auth.access_token) {\n return;\n }\n\n (async () => {\n try {\n const appUserAcls: UserAclsResponse = await api\n .get(`me/applications/${state.app.id}/acls`, {\n headers: {\n Authorization: `Bearer ${state.auth.access_token}`,\n },\n })\n .json();\n dispatch({\n type: ActionType.UPDATE_LOCAL_ACLS,\n payload: appUserAcls.acls,\n });\n } catch (err) {\n if (err instanceof Error) {\n // const unsharedAcls = reduceSchemaToUnsharedAcls();\n dispatch({\n type: ActionType.UPDATE_LOCAL_ACLS,\n payload: {},\n });\n }\n }\n })();\n }, [api, dispatch, state.app.id, state.auth.access_token]);\n\n useEffect(retrieveUserInfo, [retrieveUserInfo]);\n useEffect(retrieveAcls, [retrieveAcls]);\n\n useEffect(() => {\n if (!state.user.needs_refresh) {\n return;\n }\n retrieveUserInfo();\n dispatch({\n type: ActionType.SET_REFRESH_USER_DATA,\n payload: { needs_refresh: false },\n });\n }, [dispatch, retrieveUserInfo, state.user.needs_refresh]);\n\n const saveAclsDebounced = useDebounce(saveAcls, 2000); // 2s\n\n async function saveAcls() {\n if (state.app.id && state.local_acls) {\n await api\n .put(`me/applications/${state.app.id}/acls`, {\n headers: {\n Authorization: `Bearer ${state.auth.access_token}`,\n },\n json: {\n acls: state.local_acls,\n },\n })\n .json();\n }\n }\n\n const localAclsRef = useRef(state.local_acls);\n useEffect(() => {\n // Don't save acls if they were just loaded for the first time or they haven't changed\n if (\n !localAclsRef.current ||\n isEqual(localAclsRef.current, state.local_acls)\n ) {\n return;\n }\n saveAclsDebounced();\n }, [saveAclsDebounced, state.local_acls]);\n\n const saveUserDataDebounced = useDebounce(saveUserData, 2000); // 2s\n\n // Save user data in the application state to the API server\n async function saveUserData() {\n if (state.app.id && state.user.data && state.auth.access_token) {\n dispatch({\n type: ActionType.SET_IS_SAVING_USER_DATA,\n payload: {\n saving: true,\n },\n });\n\n const eventDetails: Record<string, any> = {};\n try {\n eventDetails.data = await api\n .put(`me/applications/${state.app.id}/data`, {\n headers: {\n Authorization: `Bearer ${state.auth.access_token}`,\n },\n json: {\n data: state.user.data,\n },\n })\n .json();\n } catch (err) {\n eventDetails.error = err;\n // Get the latest user info from Rownd. Something was probably bad\n // with the data we just tried to save.\n // This is a bit hacky. We should be able to reset the state without\n // calling rownd again by rolling back to a previously good state...\n retrieveUserInfo();\n // TODO: Set some error state\n } finally {\n events.dispatch(EventType.USER_DATA_SAVED, eventDetails);\n dispatch({\n type: ActionType.SET_IS_SAVING_USER_DATA,\n payload: {\n saving: false,\n },\n });\n }\n }\n }\n\n const userDataRef = useRef(state.user.data);\n useEffect(() => {\n // Don't update the user data in the API server if the email is unknown or the data hasn't changed\n if (\n (!state.user.data?.email && !state.user.data.phone_number) ||\n isEqual(userDataRef.current, state.user.data)\n ) {\n return;\n }\n saveUserDataDebounced();\n userDataRef.current = state.user.data;\n }, [dispatch, saveUserDataDebounced, state.user.data]);\n\n return null;\n}\n"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,WAApB,EAAiCC,MAAjC,QAA+C,OAA/C;AACA,OAAOC,OAAP,MAAoB,mBAApB;AACA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,oBAA9B,QAA0D,UAA1D;AACA,SAASC,kBAAT,QAAmC,cAAnC;AAEA,SAASC,gBAAT,QAAiC,iBAAjC;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,OAAOC,EAAP,MAAe,IAAf;AACA,OAAO,KAAKC,SAAZ,MAA2B,gBAA3B;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,SAASC,OAAT,QAAwB,cAAxB;AACA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,iBAAlC;AAiBA,OAAO,SAASC,cAAT,OAAyD;EAA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