@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,148 @@
1
+ import { useGlobalContext } from '../components/GlobalContext';
2
+ import { ActionType } from '../data/actions';
3
+ import useApi from './api';
4
+ import { events, EventType } from '../utils/events';
5
+ // const RowndContext = createContext<TRowndContext | null>(null);
6
+ export function useRownd() {
7
+ var _state$auth, _state$user, _state$user2;
8
+
9
+ const {
10
+ state,
11
+ dispatch
12
+ } = useGlobalContext();
13
+ const {
14
+ isNewAccessTokenNeeded,
15
+ newAccessTokenFromRefreshToken
16
+ } = useApi();
17
+ const stateCopy = JSON.parse(JSON.stringify(state));
18
+
19
+ const requestSignIn = opts => {
20
+ dispatch({
21
+ type: ActionType.CHANGE_ROUTE,
22
+ payload: {
23
+ route: '/account/login',
24
+ options: opts
25
+ }
26
+ });
27
+ };
28
+
29
+ const signOut = () => {
30
+ dispatch({
31
+ type: ActionType.SIGN_OUT
32
+ });
33
+ };
34
+
35
+ const getAccessToken = async opts => {
36
+ const {
37
+ waitForToken
38
+ } = opts || {};
39
+ let accessToken = state === null || state === void 0 ? void 0 : state.auth.access_token; // Wait for an access token to be available if none exists yet
40
+
41
+ if (!accessToken && waitForToken) {
42
+ return new Promise((resolve, _reject) => {
43
+ console.debug('auth_wait: waiting for access token');
44
+
45
+ const listener = evt => {
46
+ console.debug('auth_wait: received access token');
47
+ const data = evt.detail;
48
+ resolve(data.access_token);
49
+ };
50
+
51
+ events.addEventListener(EventType.AUTH, listener, {
52
+ once: true
53
+ });
54
+ });
55
+ }
56
+
57
+ if (isNewAccessTokenNeeded(undefined)) {
58
+ const resp = await newAccessTokenFromRefreshToken(stateCopy);
59
+ accessToken = resp.access_token;
60
+ }
61
+
62
+ return accessToken;
63
+ };
64
+
65
+ const setUserData = data => {
66
+ return new Promise((resolve, reject) => {
67
+ console.debug('user_data_save_wait: waiting for data to be saved');
68
+
69
+ const listener = evt => {
70
+ console.debug('user_data_save_wait: received data saved event');
71
+
72
+ if (evt.error) {
73
+ return reject(evt.error);
74
+ }
75
+
76
+ resolve(evt.data);
77
+ };
78
+
79
+ events.addEventListener(EventType.USER_DATA_SAVED, listener, {
80
+ once: true
81
+ });
82
+ dispatch({
83
+ type: ActionType.SET_USER_DATA,
84
+ payload: {
85
+ data
86
+ }
87
+ });
88
+ });
89
+ };
90
+
91
+ const setUserDataValue = (key, value) => {
92
+ return new Promise((resolve, reject) => {
93
+ console.debug('user_data_save_wait: waiting for data to be saved');
94
+
95
+ const listener = evt => {
96
+ console.debug('user_data_save_wait: received data saved event');
97
+
98
+ if (evt.error) {
99
+ return reject(evt.error);
100
+ }
101
+
102
+ resolve(evt.data);
103
+ };
104
+
105
+ events.addEventListener(EventType.USER_DATA_SAVED, listener, {
106
+ once: true
107
+ });
108
+ dispatch({
109
+ type: ActionType.SET_USER_DATA_FIELD,
110
+ payload: {
111
+ field: key,
112
+ value
113
+ }
114
+ });
115
+
116
+ if (value) {
117
+ return;
118
+ }
119
+
120
+ const valueAcl = {
121
+ [key]: {
122
+ shared: true
123
+ }
124
+ };
125
+ dispatch({
126
+ type: ActionType.UPDATE_LOCAL_ACLS,
127
+ payload: valueAcl
128
+ });
129
+ });
130
+ };
131
+
132
+ return {
133
+ requestSignIn,
134
+ signOut,
135
+ getAccessToken,
136
+ is_authenticated: !!state.auth.access_token,
137
+ is_initializing: !!state.app.id,
138
+ access_token: (_state$auth = state.auth) === null || _state$auth === void 0 ? void 0 : _state$auth.access_token,
139
+ auth: state.auth,
140
+ user: {
141
+ data: (_state$user = state.user) === null || _state$user === void 0 ? void 0 : _state$user.data,
142
+ redacted_fields: (_state$user2 = state.user) === null || _state$user2 === void 0 ? void 0 : _state$user2.redacted,
143
+ set: setUserData,
144
+ setValue: setUserDataValue
145
+ }
146
+ };
147
+ }
148
+ //# sourceMappingURL=rownd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useGlobalContext","ActionType","useApi","events","EventType","useRownd","state","dispatch","isNewAccessTokenNeeded","newAccessTokenFromRefreshToken","stateCopy","JSON","parse","stringify","requestSignIn","opts","type","CHANGE_ROUTE","payload","route","options","signOut","SIGN_OUT","getAccessToken","waitForToken","accessToken","auth","access_token","Promise","resolve","_reject","console","debug","listener","evt","data","detail","addEventListener","AUTH","once","undefined","resp","setUserData","reject","error","USER_DATA_SAVED","SET_USER_DATA","setUserDataValue","key","value","SET_USER_DATA_FIELD","field","valueAcl","shared","UPDATE_LOCAL_ACLS","is_authenticated","is_initializing","app","id","user","redacted_fields","redacted","set","setValue"],"sources":["rownd.ts"],"sourcesContent":["import { useGlobalContext } from '../components/GlobalContext';\nimport { ActionType } from '../data/actions';\nimport useApi from './api';\nimport { events, EventType } from '../utils/events';\n\nexport type TRowndContext = {\n requestSignIn: (opts?: RequestSignInOpts) => void;\n signOut: () => void;\n getAccessToken: (opts?: GetAccessTokenOpts) => Promise<string | null>;\n is_authenticated: boolean;\n is_initializing: boolean;\n access_token: string | null;\n auth: AuthContext;\n user: UserContext;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\ntype UserContext = {\n data: {\n id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n redacted_fields: string[];\n set: (data: Record<string, any>) => Promise<Record<string, any>>;\n setValue: (key: string, value: any) => Promise<Record<string, any>>;\n};\n\ntype RequestSignInOpts = {\n identifier?: string;\n auto_sign_in?: boolean;\n init_data?: Record<string, any>;\n post_login_redirect?: string;\n};\n\ntype GetAccessTokenOpts = {\n waitForToken?: boolean;\n};\n\n// const RowndContext = createContext<TRowndContext | null>(null);\n\nexport function useRownd(): TRowndContext {\n const { state, dispatch } = useGlobalContext();\n const { isNewAccessTokenNeeded, newAccessTokenFromRefreshToken } = useApi();\n\n const stateCopy = JSON.parse(JSON.stringify(state));\n\n const requestSignIn = (opts?: RequestSignInOpts): void => {\n dispatch({\n type: ActionType.CHANGE_ROUTE,\n payload: {\n route: '/account/login',\n options: opts,\n },\n });\n };\n\n const signOut = () => {\n dispatch({\n type: ActionType.SIGN_OUT,\n });\n };\n\n const getAccessToken = async (\n opts?: GetAccessTokenOpts\n ): Promise<string | null> => {\n const { waitForToken } = opts || {};\n let accessToken = state?.auth.access_token;\n\n // Wait for an access token to be available if none exists yet\n if (!accessToken && waitForToken) {\n return new Promise((resolve, _reject) => {\n console.debug('auth_wait: waiting for access token');\n const listener = (evt: any) => {\n console.debug('auth_wait: received access token');\n const data = evt.detail;\n resolve(data.access_token);\n };\n\n events.addEventListener(EventType.AUTH, listener, { once: true });\n });\n }\n\n if (isNewAccessTokenNeeded(undefined)) {\n const resp = await newAccessTokenFromRefreshToken(stateCopy);\n accessToken = resp.access_token;\n }\n\n return accessToken;\n };\n\n const setUserData = (\n data: Record<string, any>\n ): Promise<Record<string, any>> => {\n return new Promise((resolve, reject) => {\n console.debug('user_data_save_wait: waiting for data to be saved');\n const listener = (evt: any) => {\n console.debug('user_data_save_wait: received data saved event');\n if (evt.error) {\n return reject(evt.error);\n }\n\n resolve(evt.data);\n };\n\n events.addEventListener(EventType.USER_DATA_SAVED, listener, {\n once: true,\n });\n\n dispatch({\n type: ActionType.SET_USER_DATA,\n payload: {\n data,\n },\n });\n });\n };\n\n const setUserDataValue = (\n key: string,\n value: any\n ): Promise<Record<string, any>> => {\n return new Promise((resolve, reject) => {\n console.debug('user_data_save_wait: waiting for data to be saved');\n const listener = (evt: any) => {\n console.debug('user_data_save_wait: received data saved event');\n if (evt.error) {\n return reject(evt.error);\n }\n\n resolve(evt.data);\n };\n\n events.addEventListener(EventType.USER_DATA_SAVED, listener, {\n once: true,\n });\n\n dispatch({\n type: ActionType.SET_USER_DATA_FIELD,\n payload: {\n field: key,\n value,\n },\n });\n\n if (value) {\n return;\n }\n\n const valueAcl = {\n [key]: {\n shared: true,\n },\n };\n\n dispatch({\n type: ActionType.UPDATE_LOCAL_ACLS,\n payload: valueAcl,\n });\n });\n };\n\n return {\n requestSignIn,\n signOut,\n getAccessToken,\n is_authenticated: !!state.auth.access_token,\n is_initializing: !!state.app.id,\n access_token: state.auth?.access_token,\n auth: state.auth,\n user: {\n data: state.user?.data,\n redacted_fields: state.user?.redacted,\n set: setUserData,\n setValue: setUserDataValue,\n },\n };\n}\n"],"mappings":"AAAA,SAASA,gBAAT,QAAiC,6BAAjC;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,OAAOC,MAAP,MAAmB,OAAnB;AACA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,iBAAlC;AA0CA;AAEA,OAAO,SAASC,QAAT,GAAmC;EAAA;;EACxC,MAAM;IAAEC,KAAF;IAASC;EAAT,IAAsBP,gBAAgB,EAA5C;EACA,MAAM;IAAEQ,sBAAF;IA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PS,IAAI,EAAEf,UAAU,CAACiD,mBADV;QAEPhC,OAAO,EAAE;UACPiC,KAAK,EAAEH,GADA;UAEPC;QAFO;MAFF,CAAD,CAAR;;MAQA,IAAIA,KAAJ,EAAW;QACT;MACD;;MAED,MAAMG,QAAQ,GAAG;QACf,CAACJ,GAAD,GAAO;UACLK,MAAM,EAAE;QADH;MADQ,CAAjB;MAMA9C,QAAQ,CAAC;QACPS,IAAI,EAAEf,UAAU,CAACqD,iBADV;QAEPpC,OAAO,EAAEkC;MAFF,CAAD,CAAR;IAID,CArCM,CAAP;EAsCD,CA1CD;;EA4CA,OAAO;IACLtC,aADK;IAELO,OAFK;IAGLE,cAHK;IAILgC,gBAAgB,EAAE,CAAC,CAACjD,KAAK,CAACoB,IAAN,CAAWC,YAJ1B;IAKL6B,eAAe,EAAE,CAAC,CAAClD,KAAK,CAACmD,GAAN,CAAUC,EALxB;IAML/B,YAAY,iBAAErB,KAAK,CAACoB,IAAR,gDAAE,YAAYC,YANrB;IAOLD,IAAI,EAAEpB,KAAK,CAACoB,IAPP;IAQLiC,IAAI,EAAE;MACJxB,IAAI,iBAAE7B,KAAK,CAACqD,IAAR,gDAAE,YAAYxB,IADd;MAEJyB,eAAe,kBAAEtD,KAAK,CAACqD,IAAR,iDAAE,aAAYE,QAFzB;MAGJC,GAAG,EAAEpB,WAHD;MAIJqB,QAAQ,EAAEhB;IAJN;EARD,CAAP;AAeD"}
@@ -0,0 +1,6 @@
1
+ // import { requestSignIn } from './components/SignIn';
2
+ import { RowndProvider } from './components/RowndProvider';
3
+ import { useRownd } from './hooks/rownd';
4
+ import AuthenticatedComponent from './components/AuthenticatedComponent';
5
+ export { RowndProvider, useRownd, AuthenticatedComponent };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RowndProvider","useRownd","AuthenticatedComponent"],"sources":["index.tsx"],"sourcesContent":["// import { requestSignIn } from './components/SignIn';\nimport { RowndProvider } from './components/RowndProvider';\nimport { useRownd } from './hooks/rownd';\nimport AuthenticatedComponent from './components/AuthenticatedComponent';\n\nexport { RowndProvider, useRownd, AuthenticatedComponent };\n"],"mappings":"AAAA;AACA,SAASA,aAAT,QAA8B,4BAA9B;AACA,SAASC,QAAT,QAAyB,eAAzB;AACA,OAAOC,sBAAP,MAAmC,qCAAnC;AAEA,SAASF,aAAT,EAAwBC,QAAxB,EAAkCC,sBAAlC"}
@@ -0,0 +1,26 @@
1
+ import {
2
+ requireNativeComponent,
3
+ UIManager,
4
+ Platform,
5
+ ViewStyle,
6
+ } from 'react-native';
7
+
8
+ const LINKING_ERROR =
9
+ `The package '@rownd/react-native' doesn't seem to be linked. Make sure: \n\n` +
10
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
11
+ '- You rebuilt the app after installing the package\n' +
12
+ '- You are not using Expo managed workflow\n';
13
+
14
+ type ReactNativeProps = {
15
+ color: string;
16
+ style: ViewStyle;
17
+ };
18
+
19
+ const ComponentName = 'ReactNativeView';
20
+
21
+ export const ReactNativeView =
22
+ UIManager.getViewManagerConfig(ComponentName) != null
23
+ ? requireNativeComponent<ReactNativeProps>(ComponentName)
24
+ : () => {
25
+ throw new Error(LINKING_ERROR);
26
+ };
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type TRowndContext = {\n requestSignIn: Function;\n signOut: Function;\n getAccessToken: Function;\n is_authenticated: boolean;\n is_initializing: boolean;\n access_token: string | null;\n auth: AuthContext;\n user: UserContext;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id?: string;\n is_authenticated: boolean;\n is_verified_user?: boolean;\n};\n\ntype UserContext = {\n data: {\n id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n redacted_fields: string[];\n};"],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import pickBy from 'lodash-es/pickBy';
2
+ const config = {
3
+ baseUrl: 'https://hub.rownd.io',
4
+ apiUrl: 'https://api.rownd.io',
5
+ pdcBaseUrl: 'https://mydata.rownd.io',
6
+ appKey: '',
7
+ postLoginUrl: null,
8
+ postRegistrationUrl: null,
9
+ locationHash: null,
10
+ postAuthenticationApi: null
11
+ };
12
+ export function createConfig(opts) {
13
+ return { ...config,
14
+ ...pickBy(opts)
15
+ };
16
+ }
17
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["pickBy","config","baseUrl","apiUrl","pdcBaseUrl","appKey","postLoginUrl","postRegistrationUrl","locationHash","postAuthenticationApi","createConfig","opts"],"sources":["config.ts"],"sourcesContent":["import pickBy from 'lodash-es/pickBy';\n\nexport interface IConfig {\n baseUrl: string;\n apiUrl: string;\n pdcBaseUrl: string;\n appKey: string;\n postLoginUrl: null | string;\n postRegistrationUrl: null | string;\n locationHash: null | string;\n postAuthenticationApi: null | PostAuthApiSpec;\n}\n\nconst config: IConfig = {\n baseUrl: 'https://hub.rownd.io',\n apiUrl: 'https://api.rownd.io',\n pdcBaseUrl: 'https://mydata.rownd.io',\n appKey: '',\n postLoginUrl: null,\n postRegistrationUrl: null,\n locationHash: null,\n postAuthenticationApi: null,\n};\n\nexport type PostAuthApiSpec = {\n method: 'post' | 'put';\n url: string;\n extra_headers: { [key: string]: string };\n};\n\nexport function createConfig(opts: Partial<IConfig>): IConfig {\n return {\n ...config,\n ...pickBy(opts),\n };\n}\n"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,kBAAnB;AAaA,MAAMC,MAAe,GAAG;EACtBC,OAAO,EAAE,sBADa;EAEtBC,MAAM,EAAE,sBAFc;EAGtBC,UAAU,EAAE,yBAHU;EAItBC,MAAM,EAAE,EAJc;EAKtBC,YAAY,EAAE,IALQ;EAMtBC,mBAAmB,EAAE,IANC;EAOtBC,YAAY,EAAE,IAPQ;EAQtBC,qBAAqB,EAAE;AARD,CAAxB;AAiBA,OAAO,SAASC,YAAT,CAAsBC,IAAtB,EAAuD;EAC5D,OAAO,EACL,GAAGV,MADE;IAEL,GAAGD,MAAM,CAACW,IAAD;EAFJ,CAAP;AAID"}
@@ -0,0 +1,45 @@
1
+ import EventEmitter from 'eventemitter3';
2
+ const bus = new EventEmitter();
3
+ export let EventType;
4
+
5
+ (function (EventType) {
6
+ EventType["AUTH"] = "auth";
7
+ EventType["SIGN_OUT"] = "sign_out";
8
+ EventType["USER_DATA"] = "user_data";
9
+ EventType["USER_DATA_SAVED"] = "user_data_saved";
10
+ })(EventType || (EventType = {}));
11
+
12
+ export const events = {
13
+ addEventListener: (type, callback, options) => {
14
+ if (!Object.values(EventType).includes(type)) {
15
+ console.warn(`Unknown event type: ${type}`);
16
+ return;
17
+ }
18
+
19
+ let busFn = bus.on;
20
+
21
+ if (options === true || options !== null && options !== void 0 && options.once) {
22
+ busFn = bus.once;
23
+ }
24
+
25
+ busFn.apply(bus, [type, callback, options]);
26
+ },
27
+ removeEventListener: bus.removeListener,
28
+ dispatchEvent: event => {
29
+ if (!Object.values(EventType).includes(event.type)) {
30
+ throw new Error(`Unknown event type: ${event.type}`);
31
+ }
32
+
33
+ return bus.emit(event.type, event.detail);
34
+ },
35
+
36
+ dispatch(type, data) {
37
+ if (!Object.values(EventType).includes(type)) {
38
+ throw new Error(`Unknown event type: ${type}`);
39
+ }
40
+
41
+ return bus.emit(type, data);
42
+ }
43
+
44
+ };
45
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EventEmitter","bus","EventType","events","addEventListener","type","callback","options","Object","values","includes","console","warn","busFn","on","once","apply","removeEventListener","removeListener","dispatchEvent","event","Error","emit","detail","dispatch","data"],"sources":["events.ts"],"sourcesContent":["import EventEmitter from 'eventemitter3';\nconst bus = new EventEmitter();\n\nexport enum EventType {\n AUTH = 'auth',\n SIGN_OUT = 'sign_out',\n USER_DATA = 'user_data',\n USER_DATA_SAVED = 'user_data_saved',\n}\n\nexport type TAuthEvent = {\n access_token: string;\n user_id: string;\n app_id: string;\n};\n\ntype EventListenerOptions = {\n once?: boolean;\n};\n\nexport const events = {\n addEventListener: (\n type: string,\n callback: (...args: any[]) => void | null,\n options?: boolean | EventListenerOptions | undefined\n ): void => {\n if (!Object.values<string>(EventType).includes(type)) {\n console.warn(`Unknown event type: ${type}`);\n return;\n }\n\n let busFn = bus.on;\n if (options === true || (options as EventListenerOptions)?.once) {\n busFn = bus.once;\n }\n\n busFn.apply(bus, [type, callback, options]);\n },\n removeEventListener: bus.removeListener,\n dispatchEvent: (event: CustomEvent): boolean => {\n if (!Object.values<string>(EventType).includes(event.type)) {\n throw new Error(`Unknown event type: ${event.type}`);\n }\n\n return bus.emit(event.type, event.detail);\n },\n dispatch(type: EventType, data: any): boolean {\n if (!Object.values<string>(EventType).includes(type)) {\n throw new Error(`Unknown event type: ${type}`);\n }\n\n return bus.emit(type, data);\n },\n};\n"],"mappings":"AAAA,OAAOA,YAAP,MAAyB,eAAzB;AACA,MAAMC,GAAG,GAAG,IAAID,YAAJ,EAAZ;AAEA,WAAYE,SAAZ;;WAAYA,S;EAAAA,S;EAAAA,S;EAAAA,S;EAAAA,S;GAAAA,S,KAAAA,S;;AAiBZ,OAAO,MAAMC,MAAM,GAAG;EACpBC,gBAAgB,EAAE,CAChBC,IADgB,EAEhBC,QAFgB,EAGhBC,OAHgB,KAIP;IACT,IAAI,CAACC,MAAM,CAACC,MAAP,CAAsBP,SAAtB,EAAiCQ,QAAjC,CAA0CL,IAA1C,CAAL,EAAsD;MACpDM,OAAO,CAACC,IAAR,CAAc,uBAAsBP,IAAK,EAAzC;MACA;IACD;;IAED,IAAIQ,KAAK,GAAGZ,GAAG,CAACa,EAAhB;;IACA,IAAIP,OAAO,KAAK,IAAZ,IAAqBA,OAArB,aAAqBA,OAArB,eAAqBA,OAAD,CAAmCQ,IAA3D,EAAiE;MAC/DF,KAAK,GAAGZ,GAAG,CAACc,IAAZ;IACD;;IAEDF,KAAK,CAACG,KAAN,CAAYf,GAAZ,EAAiB,CAACI,IAAD,EAAOC,QAAP,EAAiBC,OAAjB,CAAjB;EACD,CAjBmB;EAkBpBU,mBAAmB,EAAEhB,GAAG,CAACiB,cAlBL;EAmBpBC,aAAa,EAAGC,KAAD,IAAiC;IAC9C,IAAI,CAACZ,MAAM,CAACC,MAAP,CAAsBP,SAAtB,EAAiCQ,QAAjC,CAA0CU,KAAK,CAACf,IAAhD,CAAL,EAA4D;MAC1D,MAAM,IAAIgB,KAAJ,CAAW,uBAAsBD,KAAK,CAACf,IAAK,EAA5C,CAAN;IACD;;IAED,OAAOJ,GAAG,CAACqB,IAAJ,CAASF,KAAK,CAACf,IAAf,EAAqBe,KAAK,CAACG,MAA3B,CAAP;EACD,CAzBmB;;EA0BpBC,QAAQ,CAACnB,IAAD,EAAkBoB,IAAlB,EAAsC;IAC5C,IAAI,CAACjB,MAAM,CAACC,MAAP,CAAsBP,SAAtB,EAAiCQ,QAAjC,CAA0CL,IAA1C,CAAL,EAAsD;MACpD,MAAM,IAAIgB,KAAJ,CAAW,uBAAsBhB,IAAK,EAAtC,CAAN;IACD;;IAED,OAAOJ,GAAG,CAACqB,IAAJ,CAASjB,IAAT,EAAeoB,IAAf,CAAP;EACD;;AAhCmB,CAAf"}
@@ -0,0 +1,34 @@
1
+ import { Text, TextInput } from 'react-native';
2
+ import { Picker } from '@react-native-picker/picker';
3
+ import React from 'react';
4
+ export function renderField(_ref) {
5
+ var _options$;
6
+
7
+ let {
8
+ id,
9
+ label = '',
10
+ name,
11
+ type = 'input',
12
+ value,
13
+ placeholder,
14
+ options = null,
15
+ onChange
16
+ } = _ref;
17
+
18
+ if (!id) {
19
+ id = `rph-input-${name}`;
20
+ }
21
+
22
+ return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(Text, null, label), type === 'select' && /*#__PURE__*/React.createElement(Picker, {
23
+ onValueChange: onChange,
24
+ selectedValue: value || (options === null || options === void 0 ? void 0 : (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.value)
25
+ }, options === null || options === void 0 ? void 0 : options.map(opt => /*#__PURE__*/React.createElement(Picker.Item, {
26
+ value: opt.value,
27
+ key: opt.value
28
+ }, ' ', opt.label, ' '))), type === 'input' && /*#__PURE__*/React.createElement(TextInput, {
29
+ value: value,
30
+ placeholder: placeholder,
31
+ onChangeText: onChange
32
+ }));
33
+ }
34
+ //# sourceMappingURL=form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Text","TextInput","Picker","React","renderField","id","label","name","type","value","placeholder","options","onChange","map","opt"],"sources":["form.tsx"],"sourcesContent":["import { Text, TextInput } from 'react-native';\nimport { Picker } from '@react-native-picker/picker';\nimport React from 'react';\n\ntype FormFieldProps = {\n id?: string;\n name: string;\n value?: string;\n type?: string;\n label?: string;\n placeholder?: string;\n options?:\n | [\n {\n value: string;\n label: string;\n }\n ]\n | null;\n onChange?: (value: string) => void;\n};\n\nexport function renderField({\n id,\n label = '',\n name,\n type = 'input',\n value,\n placeholder,\n options = null,\n onChange,\n}: FormFieldProps) {\n if (!id) {\n id = `rph-input-${name}`;\n }\n\n return (\n <>\n {label && <Text>{label}</Text>}\n\n {type === 'select' && (\n <Picker\n onValueChange={onChange}\n selectedValue={value || options?.[0]?.value}\n >\n {options?.map((opt) => (\n <Picker.Item value={opt.value} key={opt.value}>\n {' '}\n {opt.label}{' '}\n </Picker.Item>\n ))}\n </Picker>\n )}\n\n {type === 'input' && (\n <TextInput\n value={value}\n placeholder={placeholder}\n onChangeText={onChange}\n />\n )}\n </>\n );\n}\n"],"mappings":"AAAA,SAASA,IAAT,EAAeC,SAAf,QAAgC,cAAhC;AACA,SAASC,MAAT,QAAuB,6BAAvB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AAoBA,OAAO,SAASC,WAAT,OASY;EAAA;;EAAA,IATS;IAC1BC,EAD0B;IAE1BC,KAAK,GAAG,EAFkB;IAG1BC,IAH0B;IAI1BC,IAAI,GAAG,OAJmB;IAK1BC,KAL0B;IAM1BC,WAN0B;IAO1BC,OAAO,GAAG,IAPgB;IAQ1BC;EAR0B,CAST;;EACjB,IAAI,CAACP,EAAL,EAAS;IACPA,EAAE,GAAI,aAAYE,IAAK,EAAvB;EACD;;EAED,oBACE,0CACGD,KAAK,iBAAI,oBAAC,IAAD,QAAOA,KAAP,CADZ,EAGGE,IAAI,KAAK,QAAT,iBACC,oBAAC,MAAD;IACE,aAAa,EAAEI,QADjB;IAEE,aAAa,EAAEH,KAAK,KAAIE,OAAJ,aAAIA,OAAJ,oCAAIA,OAAO,CAAG,CAAH,CAAX,8CAAI,UAAcF,KAAlB;EAFtB,GAIGE,OAJH,aAIGA,OAJH,uBAIGA,OAAO,CAAEE,GAAT,CAAcC,GAAD,iBACZ,oBAAC,MAAD,CAAQ,IAAR;IAAa,KAAK,EAAEA,GAAG,CAACL,KAAxB;IAA+B,GAAG,EAAEK,GAAG,CAACL;EAAxC,GACG,GADH,EAEGK,GAAG,CAACR,KAFP,EAEc,GAFd,CADD,CAJH,CAJJ,EAiBGE,IAAI,KAAK,OAAT,iBACC,oBAAC,SAAD;IACE,KAAK,EAAEC,KADT;IAEE,WAAW,EAAEC,WAFf;IAGE,YAAY,EAAEE;EAHhB,EAlBJ,CADF;AA2BD"}
@@ -0,0 +1,109 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
4
+
5
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
6
+
7
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
8
+
9
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
10
+
11
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
12
+
13
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
14
+
15
+ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
16
+
17
+ // import { logger } from "./utils/log";
18
+ let count = 0;
19
+
20
+ var _items = /*#__PURE__*/new WeakMap();
21
+
22
+ class Queue {
23
+ constructor() {
24
+ _classPrivateFieldInitSpec(this, _items, {
25
+ writable: true,
26
+ value: void 0
27
+ });
28
+
29
+ _classPrivateFieldSet(this, _items, []);
30
+ }
31
+
32
+ enqueue(item) {
33
+ _classPrivateFieldGet(this, _items).push(item);
34
+ }
35
+
36
+ dequeue() {
37
+ return _classPrivateFieldGet(this, _items).shift();
38
+ }
39
+
40
+ get size() {
41
+ return _classPrivateFieldGet(this, _items).length;
42
+ }
43
+
44
+ }
45
+
46
+ var _pendingPromise = /*#__PURE__*/new WeakMap();
47
+
48
+ class AutoQueue extends Queue {
49
+ constructor() {
50
+ super();
51
+
52
+ _defineProperty(this, "_cache", void 0);
53
+
54
+ _classPrivateFieldInitSpec(this, _pendingPromise, {
55
+ writable: true,
56
+ value: void 0
57
+ });
58
+
59
+ _classPrivateFieldSet(this, _pendingPromise, false);
60
+
61
+ this._cache = {};
62
+ }
63
+
64
+ enqueue(action) {
65
+ return new Promise((resolve, reject) => {
66
+ super.enqueue({
67
+ action,
68
+ resolve,
69
+ reject,
70
+ count: count++
71
+ }); // logger.log('queued', count);
72
+
73
+ this.dequeue();
74
+ });
75
+ }
76
+
77
+ async dequeue() {
78
+ if (_classPrivateFieldGet(this, _pendingPromise)) return false;
79
+ const item = super.dequeue();
80
+
81
+ if (!item) {
82
+ this._cache = {};
83
+ return false;
84
+ } // logger.log('dequeued', item.count);
85
+
86
+
87
+ try {
88
+ _classPrivateFieldSet(this, _pendingPromise, true);
89
+
90
+ const payload = await item.action(this);
91
+
92
+ _classPrivateFieldSet(this, _pendingPromise, false);
93
+
94
+ item.resolve(payload);
95
+ } catch (e) {
96
+ _classPrivateFieldSet(this, _pendingPromise, false);
97
+
98
+ item.reject(e);
99
+ } finally {
100
+ this.dequeue();
101
+ }
102
+
103
+ return true;
104
+ }
105
+
106
+ }
107
+
108
+ export default AutoQueue;
109
+ //# sourceMappingURL=queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["count","Queue","constructor","enqueue","item","push","dequeue","shift","size","length","AutoQueue","_cache","action","Promise","resolve","reject","payload","e"],"sources":["queue.ts"],"sourcesContent":["// import { logger } from \"./utils/log\";\n\nlet count = 0;\n\ntype QueueItem = {\n action: () => Promise<any>;\n resolve: (value?: any) => void;\n reject: (reason?: any) => void;\n count: number;\n};\n\nclass Queue {\n #_items: any[];\n constructor() {\n this.#_items = [];\n }\n enqueue(item: QueueItem | (() => Promise<any>)) {\n this.#_items.push(item);\n }\n dequeue(): any {\n return this.#_items.shift();\n }\n get size() {\n return this.#_items.length;\n }\n}\n\nclass AutoQueue<T> extends Queue {\n _cache: Record<string, unknown>;\n #_pendingPromise: boolean;\n constructor() {\n super();\n this.#_pendingPromise = false;\n this._cache = {};\n }\n\n enqueue(action: () => Promise<any>): Promise<T> {\n return new Promise((resolve, reject) => {\n super.enqueue({ action, resolve, reject, count: count++ });\n // logger.log('queued', count);\n this.dequeue();\n });\n }\n\n async dequeue() {\n if (this.#_pendingPromise) return false;\n\n const item = super.dequeue();\n\n if (!item) {\n this._cache = {};\n return false;\n }\n\n // logger.log('dequeued', item.count);\n\n try {\n this.#_pendingPromise = true;\n\n const payload = await item.action(this);\n\n this.#_pendingPromise = false;\n item.resolve(payload);\n } catch (e) {\n this.#_pendingPromise = false;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D,CAPD,CAOE,OAAOC,CAAP,EAAU;MACV,6CAAwB,KAAxB;;MACAb,IAAI,CAACW,MAAL,CAAYE,CAAZ;IACD,CAVD,SAUU;MACR,KAAKX,OAAL;IACD;;IAED,OAAO,IAAP;EACD;;AA5C8B;;AA+CjC,eAAeI,SAAf"}
@@ -0,0 +1,6 @@
1
+ import { MMKV } from 'react-native-mmkv';
2
+ const storage = new MMKV({
3
+ id: 'rownd-storage'
4
+ });
5
+ export default storage;
6
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MMKV","storage","id"],"sources":["storage.ts"],"sourcesContent":["import { MMKV } from 'react-native-mmkv';\n\nconst storage = new MMKV({\n id: 'rownd-storage',\n});\n\nexport default storage;\n"],"mappings":"AAAA,SAASA,IAAT,QAAqB,mBAArB;AAEA,MAAMC,OAAO,GAAG,IAAID,IAAJ,CAAS;EACvBE,EAAE,EAAE;AADmB,CAAT,CAAhB;AAIA,eAAeD,OAAf"}
@@ -0,0 +1,5 @@
1
+ import { create } from 'twrnc';
2
+ import twConfig from '../../tailwind.config.js';
3
+ const tw = create(twConfig);
4
+ export default tw;
5
+ //# sourceMappingURL=tailwind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["create","twConfig","tw"],"sources":["tailwind.ts"],"sourcesContent":["import { create } from 'twrnc';\nimport twConfig from '../../tailwind.config.js';\n\nconst tw = create(twConfig);\n\nexport default tw;\n"],"mappings":"AAAA,SAASA,MAAT,QAAuB,OAAvB;AACA,OAAOC,QAAP,MAAqB,0BAArB;AAEA,MAAMC,EAAE,GAAGF,MAAM,CAACC,QAAD,CAAjB;AAEA,eAAeC,EAAf"}
@@ -0,0 +1,24 @@
1
+ import jwt_decode from 'jwt-decode';
2
+
3
+ // Make sure token is always in a decoded form
4
+ function normalizeToken(token) {
5
+ if (typeof token === 'string') {
6
+ return jwt_decode(token);
7
+ }
8
+
9
+ return token;
10
+ }
11
+
12
+ export function getAppId(token) {
13
+ var _token, _token$aud, _token$aud$find;
14
+
15
+ token = normalizeToken(token);
16
+ 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);
17
+ }
18
+ export function getUserId(token) {
19
+ var _token2;
20
+
21
+ token = normalizeToken(token);
22
+ return (_token2 = token) === null || _token2 === void 0 ? void 0 : _token2.sub;
23
+ }
24
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["jwt_decode","normalizeToken","token","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,OAAOA,UAAP,MAAuB,YAAvB;;AAIA;AACA,SAASC,cAAT,CAAwBC,KAAxB,EAAgE;EAC9D,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;IAC7B,OAAOF,UAAU,CAACE,KAAD,CAAjB;EACD;;EAED,OAAOA,KAAP;AACD;;AAED,OAAO,SAASC,QAAT,CAAkBD,KAAlB,EAAqC;EAAA;;EAC1CA,KAAK,GAAGD,cAAc,CAACC,KAAD,CAAtB;EAEA,iBAAOA,KAAP,yDAAO,OAAOE,GAAd,kEAAO,WACHC,IADG,CACGD,GAAD,IAAiBA,GAAG,CAACE,UAAJ,CAAe,MAAf,CADnB,CAAP,oDAAO,gBAEHC,SAFG,CAEO,CAFP,CAAP;AAGD;AAED,OAAO,SAASC,SAAT,CAAmBN,KAAnB,EAAsC;EAAA;;EAC3CA,KAAK,GAAGD,cAAc,CAACC,KAAD,CAAtB;EAEA,kBAAOA,KAAP,4CAAO,QAAOO,GAAd;AACD"}
@@ -0,0 +1,14 @@
1
+ export function redactUserDataWithAcls(userData, acls) {
2
+ if (!userData) {
3
+ return {};
4
+ }
5
+
6
+ return Object.entries(userData).reduce((acc, _ref) => {
7
+ var _acls$key;
8
+
9
+ let [key, value] = _ref;
10
+ 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';
11
+ return acc;
12
+ }, {});
13
+ }
14
+ //# 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":"AAAA,OAAO,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,11 @@
1
+ /**
2
+ * Sample React Native App
3
+ * https://github.com/facebook/react-native
4
+ *
5
+ * Generated with the TypeScript template
6
+ * https://github.com/react-native-community/react-native-template-typescript
7
+ *
8
+ * @format
9
+ */
10
+ declare const App: () => JSX.Element;
11
+ export default App;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface IAuthenticatedComponentProps {
3
+ shouldRequestSignIn?: boolean;
4
+ renderContentWhenUnauthenticated?: boolean;
5
+ }
6
+ export default function ({ shouldRequestSignIn, renderContentWhenUnauthenticated, children, }: React.PropsWithChildren<IAuthenticatedComponentProps>): JSX.Element;
7
+ export {};
@@ -0,0 +1 @@
1
+ export declare function AutoSigninDialog(): JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { IConfig } from '../utils/config';
2
+ export declare type UserInfoResp = {
3
+ data: {
4
+ [key: string]: any;
5
+ };
6
+ redacted: string[];
7
+ };
8
+ declare type DefaultContextProps = {
9
+ config: IConfig;
10
+ };
11
+ export declare function DefaultContext({ config }: DefaultContextProps): null;
12
+ export {};