be-components 0.1.2 → 0.1.3

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 (221) hide show
  1. package/lib/commonjs/ApiOverrides/index.js +179 -0
  2. package/lib/commonjs/ApiOverrides/index.js.map +1 -0
  3. package/lib/commonjs/ApiOverrides/types.d.js.map +1 -0
  4. package/lib/commonjs/Assets/images/powered_by_be.webp +0 -0
  5. package/lib/commonjs/Authenticator/Components/LoginForm.js +491 -0
  6. package/lib/commonjs/Authenticator/Components/LoginForm.js.map +1 -0
  7. package/lib/commonjs/{AuthenticateWizard → Authenticator}/Components/StrategyForm.js +81 -58
  8. package/lib/commonjs/Authenticator/Components/StrategyForm.js.map +1 -0
  9. package/lib/commonjs/{AuthenticateWizard → Authenticator}/api/index.js +31 -36
  10. package/lib/commonjs/Authenticator/api/index.js.map +1 -0
  11. package/lib/commonjs/Authenticator/api/types.d.js +2 -0
  12. package/lib/commonjs/Authenticator/api/types.d.js.map +1 -0
  13. package/lib/commonjs/{AuthenticateWizard → Authenticator}/index.js +69 -25
  14. package/lib/commonjs/Authenticator/index.js.map +1 -0
  15. package/lib/commonjs/Components/Button.js +1 -1
  16. package/lib/commonjs/Components/Button.js.map +1 -1
  17. package/lib/commonjs/Components/Icons.js +115 -0
  18. package/lib/commonjs/Components/Icons.js.map +1 -1
  19. package/lib/commonjs/Components/ImageUploader.js +86 -0
  20. package/lib/commonjs/Components/ImageUploader.js.map +1 -0
  21. package/lib/commonjs/Components/Spring.js +16 -6
  22. package/lib/commonjs/Components/Spring.js.map +1 -1
  23. package/lib/commonjs/Components/TextInput.js +9 -3
  24. package/lib/commonjs/Components/TextInput.js.map +1 -1
  25. package/lib/commonjs/Font.css +4 -4
  26. package/lib/commonjs/ProfileManager/Components/BasicInfoManager.js +250 -0
  27. package/lib/commonjs/ProfileManager/Components/BasicInfoManager.js.map +1 -0
  28. package/lib/commonjs/ProfileManager/Components/BasicStatus.js +135 -0
  29. package/lib/commonjs/ProfileManager/Components/BasicStatus.js.map +1 -0
  30. package/lib/commonjs/ProfileManager/Components/CodeRedeem.js +361 -0
  31. package/lib/commonjs/ProfileManager/Components/CodeRedeem.js.map +1 -0
  32. package/lib/commonjs/ProfileManager/Components/DOBManager.js +195 -0
  33. package/lib/commonjs/ProfileManager/Components/DOBManager.js.map +1 -0
  34. package/lib/commonjs/ProfileManager/Components/EmailManager.js +287 -0
  35. package/lib/commonjs/ProfileManager/Components/EmailManager.js.map +1 -0
  36. package/lib/commonjs/ProfileManager/Components/PasswordManager.js +334 -0
  37. package/lib/commonjs/ProfileManager/Components/PasswordManager.js.map +1 -0
  38. package/lib/commonjs/ProfileManager/Components/PhoneManager.js +291 -0
  39. package/lib/commonjs/ProfileManager/Components/PhoneManager.js.map +1 -0
  40. package/lib/commonjs/ProfileManager/Components/ProfilePicManager.js +114 -0
  41. package/lib/commonjs/ProfileManager/Components/ProfilePicManager.js.map +1 -0
  42. package/lib/commonjs/ProfileManager/Components/ProfileWelcome.js +80 -0
  43. package/lib/commonjs/ProfileManager/Components/ProfileWelcome.js.map +1 -0
  44. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js +545 -0
  45. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js.map +1 -0
  46. package/lib/commonjs/ProfileManager/Components/VouchCard.js +454 -0
  47. package/lib/commonjs/ProfileManager/Components/VouchCard.js.map +1 -0
  48. package/lib/commonjs/ProfileManager/api/index.js +400 -0
  49. package/lib/commonjs/ProfileManager/api/index.js.map +1 -0
  50. package/lib/commonjs/ProfileManager/api/types.d.js +2 -0
  51. package/lib/commonjs/ProfileManager/api/types.d.js.map +1 -0
  52. package/lib/commonjs/ProfileManager/index.js +128 -0
  53. package/lib/commonjs/ProfileManager/index.js.map +1 -0
  54. package/lib/commonjs/constants/styles.js +10 -0
  55. package/lib/commonjs/constants/styles.js.map +1 -1
  56. package/lib/commonjs/index.js +24 -10
  57. package/lib/commonjs/index.js.map +1 -1
  58. package/lib/module/ApiOverrides/index.js +173 -0
  59. package/lib/module/ApiOverrides/index.js.map +1 -0
  60. package/lib/module/ApiOverrides/types.d.js.map +1 -0
  61. package/lib/module/Assets/images/powered_by_be.webp +0 -0
  62. package/lib/module/Authenticator/Components/LoginForm.js +482 -0
  63. package/lib/module/Authenticator/Components/LoginForm.js.map +1 -0
  64. package/lib/module/{AuthenticateWizard → Authenticator}/Components/StrategyForm.js +82 -59
  65. package/lib/module/Authenticator/Components/StrategyForm.js.map +1 -0
  66. package/lib/module/{AuthenticateWizard → Authenticator}/api/index.js +31 -36
  67. package/lib/module/Authenticator/api/index.js.map +1 -0
  68. package/lib/module/Authenticator/api/types.d.js +2 -0
  69. package/lib/module/Authenticator/api/types.d.js.map +1 -0
  70. package/lib/module/Authenticator/index.js +121 -0
  71. package/lib/module/Authenticator/index.js.map +1 -0
  72. package/lib/module/Components/Button.js +1 -1
  73. package/lib/module/Components/Button.js.map +1 -1
  74. package/lib/module/Components/Icons.js +115 -0
  75. package/lib/module/Components/Icons.js.map +1 -1
  76. package/lib/module/Components/ImageUploader.js +78 -0
  77. package/lib/module/Components/ImageUploader.js.map +1 -0
  78. package/lib/module/Components/Spring.js +17 -7
  79. package/lib/module/Components/Spring.js.map +1 -1
  80. package/lib/module/Components/TextInput.js +9 -3
  81. package/lib/module/Components/TextInput.js.map +1 -1
  82. package/lib/module/Font.css +4 -4
  83. package/lib/module/ProfileManager/Components/BasicInfoManager.js +241 -0
  84. package/lib/module/ProfileManager/Components/BasicInfoManager.js.map +1 -0
  85. package/lib/module/ProfileManager/Components/BasicStatus.js +128 -0
  86. package/lib/module/ProfileManager/Components/BasicStatus.js.map +1 -0
  87. package/lib/module/ProfileManager/Components/CodeRedeem.js +352 -0
  88. package/lib/module/ProfileManager/Components/CodeRedeem.js.map +1 -0
  89. package/lib/module/ProfileManager/Components/DOBManager.js +186 -0
  90. package/lib/module/ProfileManager/Components/DOBManager.js.map +1 -0
  91. package/lib/module/ProfileManager/Components/EmailManager.js +278 -0
  92. package/lib/module/ProfileManager/Components/EmailManager.js.map +1 -0
  93. package/lib/module/ProfileManager/Components/PasswordManager.js +325 -0
  94. package/lib/module/ProfileManager/Components/PasswordManager.js.map +1 -0
  95. package/lib/module/ProfileManager/Components/PhoneManager.js +282 -0
  96. package/lib/module/ProfileManager/Components/PhoneManager.js.map +1 -0
  97. package/lib/module/ProfileManager/Components/ProfilePicManager.js +107 -0
  98. package/lib/module/ProfileManager/Components/ProfilePicManager.js.map +1 -0
  99. package/lib/module/ProfileManager/Components/ProfileWelcome.js +73 -0
  100. package/lib/module/ProfileManager/Components/ProfileWelcome.js.map +1 -0
  101. package/lib/module/ProfileManager/Components/ProfileWizard.js +537 -0
  102. package/lib/module/ProfileManager/Components/ProfileWizard.js.map +1 -0
  103. package/lib/module/ProfileManager/Components/VouchCard.js +445 -0
  104. package/lib/module/ProfileManager/Components/VouchCard.js.map +1 -0
  105. package/lib/module/ProfileManager/api/index.js +394 -0
  106. package/lib/module/ProfileManager/api/index.js.map +1 -0
  107. package/lib/module/ProfileManager/api/types.d.js +2 -0
  108. package/lib/module/ProfileManager/api/types.d.js.map +1 -0
  109. package/lib/module/ProfileManager/index.js +119 -0
  110. package/lib/module/ProfileManager/index.js.map +1 -0
  111. package/lib/module/constants/styles.js +10 -0
  112. package/lib/module/constants/styles.js.map +1 -1
  113. package/lib/module/index.js +7 -3
  114. package/lib/module/index.js.map +1 -1
  115. package/lib/typescript/src/ApiOverrides/index.d.ts +24 -0
  116. package/lib/typescript/src/ApiOverrides/index.d.ts.map +1 -0
  117. package/lib/typescript/src/Authenticator/Components/LoginForm.d.ts +10 -0
  118. package/lib/typescript/src/Authenticator/Components/LoginForm.d.ts.map +1 -0
  119. package/lib/typescript/src/{AuthenticateWizard → Authenticator}/Components/StrategyForm.d.ts +2 -1
  120. package/lib/typescript/src/Authenticator/Components/StrategyForm.d.ts.map +1 -0
  121. package/lib/typescript/src/{AuthenticateWizard → Authenticator}/api/index.d.ts +16 -8
  122. package/lib/typescript/src/Authenticator/api/index.d.ts.map +1 -0
  123. package/lib/typescript/src/Authenticator/index.d.ts +16 -0
  124. package/lib/typescript/src/Authenticator/index.d.ts.map +1 -0
  125. package/lib/typescript/src/Components/Icons.d.ts +3 -0
  126. package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
  127. package/lib/typescript/src/Components/ImageUploader.d.ts +11 -0
  128. package/lib/typescript/src/Components/ImageUploader.d.ts.map +1 -0
  129. package/lib/typescript/src/Components/Spring.d.ts +2 -1
  130. package/lib/typescript/src/Components/Spring.d.ts.map +1 -1
  131. package/lib/typescript/src/Components/TextInput.d.ts +4 -1
  132. package/lib/typescript/src/Components/TextInput.d.ts.map +1 -1
  133. package/lib/typescript/src/ProfileManager/Components/BasicInfoManager.d.ts +12 -0
  134. package/lib/typescript/src/ProfileManager/Components/BasicInfoManager.d.ts.map +1 -0
  135. package/lib/typescript/src/ProfileManager/Components/BasicStatus.d.ts +10 -0
  136. package/lib/typescript/src/ProfileManager/Components/BasicStatus.d.ts.map +1 -0
  137. package/lib/typescript/src/ProfileManager/Components/CodeRedeem.d.ts +11 -0
  138. package/lib/typescript/src/ProfileManager/Components/CodeRedeem.d.ts.map +1 -0
  139. package/lib/typescript/src/ProfileManager/Components/DOBManager.d.ts +12 -0
  140. package/lib/typescript/src/ProfileManager/Components/DOBManager.d.ts.map +1 -0
  141. package/lib/typescript/src/ProfileManager/Components/EmailManager.d.ts +12 -0
  142. package/lib/typescript/src/ProfileManager/Components/EmailManager.d.ts.map +1 -0
  143. package/lib/typescript/src/ProfileManager/Components/PasswordManager.d.ts +12 -0
  144. package/lib/typescript/src/ProfileManager/Components/PasswordManager.d.ts.map +1 -0
  145. package/lib/typescript/src/ProfileManager/Components/PhoneManager.d.ts +12 -0
  146. package/lib/typescript/src/ProfileManager/Components/PhoneManager.d.ts.map +1 -0
  147. package/lib/typescript/src/ProfileManager/Components/ProfilePicManager.d.ts +12 -0
  148. package/lib/typescript/src/ProfileManager/Components/ProfilePicManager.d.ts.map +1 -0
  149. package/lib/typescript/src/ProfileManager/Components/ProfileWelcome.d.ts +11 -0
  150. package/lib/typescript/src/ProfileManager/Components/ProfileWelcome.d.ts.map +1 -0
  151. package/lib/typescript/src/ProfileManager/Components/ProfileWizard.d.ts +14 -0
  152. package/lib/typescript/src/ProfileManager/Components/ProfileWizard.d.ts.map +1 -0
  153. package/lib/typescript/src/ProfileManager/Components/VouchCard.d.ts +9 -0
  154. package/lib/typescript/src/ProfileManager/Components/VouchCard.d.ts.map +1 -0
  155. package/lib/typescript/src/ProfileManager/api/index.d.ts +104 -0
  156. package/lib/typescript/src/ProfileManager/api/index.d.ts.map +1 -0
  157. package/lib/typescript/src/ProfileManager/index.d.ts +11 -0
  158. package/lib/typescript/src/ProfileManager/index.d.ts.map +1 -0
  159. package/lib/typescript/src/constants/styles.d.ts +10 -0
  160. package/lib/typescript/src/constants/styles.d.ts.map +1 -1
  161. package/lib/typescript/src/index.d.ts +7 -3
  162. package/lib/typescript/src/index.d.ts.map +1 -1
  163. package/package.json +7 -2
  164. package/src/ApiOverrides/index.ts +135 -0
  165. package/src/ApiOverrides/types.d.ts +7 -0
  166. package/src/Assets/images/powered_by_be.webp +0 -0
  167. package/src/Authenticator/Components/LoginForm.tsx +298 -0
  168. package/src/{AuthenticateWizard → Authenticator}/Components/StrategyForm.tsx +54 -40
  169. package/src/{AuthenticateWizard → Authenticator}/api/index.ts +27 -31
  170. package/src/{AuthenticateWizard → Authenticator}/api/types.d.ts +11 -28
  171. package/src/Authenticator/index.tsx +109 -0
  172. package/src/Components/Button.tsx +1 -1
  173. package/src/Components/Icons.tsx +59 -0
  174. package/src/Components/ImageUploader.tsx +104 -0
  175. package/src/Components/Spring.tsx +16 -11
  176. package/src/Components/TextInput.tsx +9 -3
  177. package/src/Font.css +4 -4
  178. package/src/ProfileManager/Components/BasicInfoManager.tsx +157 -0
  179. package/src/ProfileManager/Components/BasicStatus.tsx +81 -0
  180. package/src/ProfileManager/Components/CodeRedeem.tsx +234 -0
  181. package/src/ProfileManager/Components/DOBManager.tsx +154 -0
  182. package/src/ProfileManager/Components/EmailManager.tsx +205 -0
  183. package/src/ProfileManager/Components/PasswordManager.tsx +198 -0
  184. package/src/ProfileManager/Components/PhoneManager.tsx +210 -0
  185. package/src/ProfileManager/Components/ProfilePicManager.tsx +81 -0
  186. package/src/ProfileManager/Components/ProfileWelcome.tsx +53 -0
  187. package/src/ProfileManager/Components/ProfileWizard.tsx +385 -0
  188. package/src/ProfileManager/Components/VouchCard.tsx +265 -0
  189. package/src/ProfileManager/api/index.ts +250 -0
  190. package/src/ProfileManager/api/types.d.ts +138 -0
  191. package/src/ProfileManager/index.tsx +84 -0
  192. package/src/constants/styles.ts +10 -0
  193. package/src/index.tsx +12 -6
  194. package/lib/commonjs/AuthenticateWizard/Components/StrategyForm.js.map +0 -1
  195. package/lib/commonjs/AuthenticateWizard/api/index.js.map +0 -1
  196. package/lib/commonjs/AuthenticateWizard/api/types.d.js.map +0 -1
  197. package/lib/commonjs/AuthenticateWizard/index.js.map +0 -1
  198. package/lib/module/AuthenticateWizard/Components/StrategyForm.js.map +0 -1
  199. package/lib/module/AuthenticateWizard/api/index.js.map +0 -1
  200. package/lib/module/AuthenticateWizard/api/types.d.js.map +0 -1
  201. package/lib/module/AuthenticateWizard/index.js +0 -77
  202. package/lib/module/AuthenticateWizard/index.js.map +0 -1
  203. package/lib/typescript/src/AuthenticateWizard/Components/StrategyForm.d.ts.map +0 -1
  204. package/lib/typescript/src/AuthenticateWizard/api/index.d.ts.map +0 -1
  205. package/lib/typescript/src/AuthenticateWizard/index.d.ts +0 -15
  206. package/lib/typescript/src/AuthenticateWizard/index.d.ts.map +0 -1
  207. package/src/AuthenticateWizard/index.tsx +0 -84
  208. /package/lib/commonjs/{AuthenticateWizard/api → ApiOverrides}/types.d.js +0 -0
  209. /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-Bold.ttf +0 -0
  210. /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-Light.ttf +0 -0
  211. /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-Regular.ttf +0 -0
  212. /package/lib/commonjs/{fonts → Assets/fonts}/Barlow-SemiBold.ttf +0 -0
  213. /package/lib/module/{AuthenticateWizard/api → ApiOverrides}/types.d.js +0 -0
  214. /package/lib/module/{fonts → Assets/fonts}/Barlow-Bold.ttf +0 -0
  215. /package/lib/module/{fonts → Assets/fonts}/Barlow-Light.ttf +0 -0
  216. /package/lib/module/{fonts → Assets/fonts}/Barlow-Regular.ttf +0 -0
  217. /package/lib/module/{fonts → Assets/fonts}/Barlow-SemiBold.ttf +0 -0
  218. /package/src/{fonts → Assets/fonts}/Barlow-Bold.ttf +0 -0
  219. /package/src/{fonts → Assets/fonts}/Barlow-Light.ttf +0 -0
  220. /package/src/{fonts → Assets/fonts}/Barlow-Regular.ttf +0 -0
  221. /package/src/{fonts → Assets/fonts}/Barlow-SemiBold.ttf +0 -0
@@ -0,0 +1,173 @@
1
+ import AsyncStorage from '@react-native-async-storage/async-storage';
2
+ import axios from 'axios';
3
+ import moment from 'moment-mini';
4
+ import { v4 } from 'uuid';
5
+ const ENVIRONMENT_ENDPOINTS = {
6
+ DEVELOPMENT: {
7
+ AUTH_SVC_API: 'http://localhost:5000',
8
+ VOUCH_ID: 'adqEZph8t*_NBFy6u_l4!t~Hin6kpK'
9
+ },
10
+ STAGING: {
11
+ AUTH_SVC_API: 'https://stage-be-auth-svc.herokuapp.com',
12
+ VOUCH_ID: 'adqEZph8t*_NBFy6u_l4!t~Hin6kpK'
13
+ },
14
+ PRODUCTION: {
15
+ AUTH_SVC_API: 'https://api.players.bettoredge.com',
16
+ VOUCH_ID: 'Q3tmJ3r9FnkN*n-MqS-!j0NS*k!mdo'
17
+ }
18
+ };
19
+ let ENDPOINTS = {};
20
+ let auth_state = {
21
+ authenticated: false,
22
+ distinct_id: ''
23
+ };
24
+ export { APIOverrides };
25
+ const APIOverrides = {
26
+ start: async (env, no_cache) => {
27
+ APIOverrides.setEnvironment(env);
28
+ let distinct_id = await APIOverrides.getDistinctID();
29
+ auth_state = {
30
+ authenticated: false,
31
+ distinct_id
32
+ };
33
+ if (no_cache) {
34
+ return auth_state;
35
+ }
36
+ let cached_token = await AsyncStorage.getItem('access_token');
37
+ if (!cached_token) {
38
+ return {
39
+ authenticated: false,
40
+ distinct_id
41
+ };
42
+ }
43
+ let cached_refresh_token = await AsyncStorage.getItem('refresh_token');
44
+ if (!cached_refresh_token) {
45
+ return {
46
+ authenticated: false,
47
+ distinct_id
48
+ };
49
+ }
50
+ let expire_datetime = await AsyncStorage.getItem('auth_expire_time');
51
+ if (!expire_datetime) {
52
+ return {
53
+ authenticated: false,
54
+ distinct_id
55
+ };
56
+ }
57
+ if (moment().isAfter(moment(expire_datetime))) {
58
+ //Try to get a new one
59
+ const refresh_resp = await APIOverrides.refreshToken(cached_refresh_token, distinct_id);
60
+ if (!refresh_resp) {
61
+ //This failed - so lets clear out our stored tokens
62
+ await AsyncStorage.removeItem('access_token');
63
+ await AsyncStorage.removeItem('refresh_token');
64
+ await AsyncStorage.removeItem('auth_expire_time');
65
+ return {
66
+ authenticated: false,
67
+ distinct_id
68
+ };
69
+ }
70
+ cached_token = refresh_resp.access_token;
71
+ cached_refresh_token = refresh_resp.refresh_token;
72
+ expire_datetime = refresh_resp.expire_datetime;
73
+ await AsyncStorage.setItem('access_token', cached_token);
74
+ await AsyncStorage.setItem('refresh_token', cached_refresh_token);
75
+ await AsyncStorage.setItem('auth_expire_time', expire_datetime);
76
+ }
77
+ APIOverrides.setBearerToken(cached_token);
78
+ APIOverrides.setRefreshTokenInterceptor(cached_refresh_token, distinct_id);
79
+ auth_state = {
80
+ authenticated: true,
81
+ distinct_id,
82
+ access_token: cached_token,
83
+ refresh_token: cached_refresh_token,
84
+ expire_datetime
85
+ };
86
+ return auth_state;
87
+ },
88
+ setEnvironment: env => {
89
+ ENDPOINTS = ENVIRONMENT_ENDPOINTS[env];
90
+ },
91
+ getEndpoints: () => {
92
+ return ENDPOINTS;
93
+ },
94
+ cacheTokens: async (access_token, refresh_token, expire_datetime) => {
95
+ await AsyncStorage.setItem('access_token', access_token);
96
+ if (refresh_token) {
97
+ await AsyncStorage.setItem('refresh_token', refresh_token);
98
+ }
99
+ if (expire_datetime) {
100
+ await AsyncStorage.setItem('auth_expire_time', expire_datetime);
101
+ }
102
+ },
103
+ getDistinctID: async () => {
104
+ let distinct_id = await AsyncStorage.getItem('distinct_id');
105
+ if (!distinct_id) {
106
+ distinct_id = v4();
107
+ AsyncStorage.setItem('distinct_id', distinct_id);
108
+ }
109
+ return distinct_id;
110
+ },
111
+ setBearerToken: token => {
112
+ if (token) {
113
+ axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
114
+ } else {
115
+ delete axios.defaults.headers.common['Authorization'];
116
+ }
117
+ },
118
+ refreshToken: async (token, distinct_id) => {
119
+ try {
120
+ let AUTH_SVC_API = ENDPOINTS['AUTH_SVC_API'];
121
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/players/tokens/token/refresh`, {
122
+ refresh_token: token,
123
+ device_id: distinct_id
124
+ });
125
+ return resp.data;
126
+ } catch (error) {
127
+ return undefined;
128
+ }
129
+ },
130
+ setRefreshTokenInterceptor: async (token, distinct_id, cache) => {
131
+ //Set the endpoint based on the environment that is past
132
+ axios.interceptors.response.use(response => {
133
+ return response;
134
+ }, async error => {
135
+ const originalRequest = error.config;
136
+ //If the user gets a 403 - sign them out if they haven't been signed out yet
137
+ if (error?.response?.status === 403) {
138
+ //if(store.getState().auth.isAuthenticated){ store.dispatch(auth_logout()); throw new Error(error); }
139
+ return Promise.reject({
140
+ message: 'Authenication session has expired.'
141
+ });
142
+ }
143
+ //If the user gets a 401 - check for a refresh_token and attempt to get another access token to use the request
144
+ if (error?.response?.status === 401 && !originalRequest._retry) {
145
+ originalRequest._retry = true;
146
+ let refresh_resp = await APIOverrides.refreshToken(token, distinct_id);
147
+ if (!refresh_resp) {
148
+ return Promise.reject({
149
+ message: 'Unable to authenticate request'
150
+ });
151
+ }
152
+ const {
153
+ access_token,
154
+ refresh_token,
155
+ expire_datetime
156
+ } = refresh_resp;
157
+ APIOverrides.setBearerToken(access_token);
158
+ if (cache) {
159
+ await APIOverrides.cacheTokens(access_token, refresh_token, expire_datetime);
160
+ }
161
+ return Promise.resolve(axios({
162
+ ...originalRequest,
163
+ headers: {
164
+ ...originalRequest.headers,
165
+ Authorization: `Bearer ${access_token}`
166
+ }
167
+ }));
168
+ }
169
+ return Promise.reject(error);
170
+ });
171
+ }
172
+ };
173
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AsyncStorage","axios","moment","v4","ENVIRONMENT_ENDPOINTS","DEVELOPMENT","AUTH_SVC_API","VOUCH_ID","STAGING","PRODUCTION","ENDPOINTS","auth_state","authenticated","distinct_id","APIOverrides","start","env","no_cache","setEnvironment","getDistinctID","cached_token","getItem","cached_refresh_token","expire_datetime","isAfter","refresh_resp","refreshToken","removeItem","access_token","refresh_token","setItem","setBearerToken","setRefreshTokenInterceptor","getEndpoints","cacheTokens","token","defaults","headers","common","resp","post","device_id","data","error","undefined","cache","interceptors","response","use","originalRequest","config","status","Promise","reject","message","_retry","resolve","Authorization"],"sourceRoot":"../../../src","sources":["ApiOverrides/index.ts"],"mappings":"AAAA,OAAOA,YAAY,MAAM,2CAA2C;AACpE,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,aAAa;AAChC,SAASC,EAAE,QAAQ,MAAM;AAGzB,MAAMC,qBAAqB,GAAG;EAC1BC,WAAW,EAAE;IACTC,YAAY,EAAE,uBAAuB;IACrCC,QAAQ,EAAE;EACd,CAAC;EACDC,OAAO,EAAE;IACLF,YAAY,EAAE,yCAAyC;IACvDC,QAAQ,EAAE;EACd,CAAC;EACDE,UAAU,EAAE;IACRH,YAAY,EAAE,oCAAoC;IAClDC,QAAQ,EAAE;EACd;AACJ,CAAC;AAED,IAAIG,SAAkC,GAAG,CAAC,C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K,GAAG,EAAE;QAChC;QACA,OAAOC,OAAO,CAACC,MAAM,CAAC;UAAEC,OAAO,EAAE;QAAqC,CAAC,CAAC;MAC5E;MACA;MACA,IAAGX,KAAK,EAAEI,QAAQ,EAAEI,MAAM,KAAK,GAAG,IAAI,CAACF,eAAe,CAACM,MAAM,EAAE;QAC3DN,eAAe,CAACM,MAAM,GAAG,IAAI;QAC7B,IAAI9B,YAAY,GAAG,MAAMX,YAAY,CAACY,YAAY,CAACS,KAAK,EAAEtB,WAAW,CAAC;QACtE,IAAG,CAACY,YAAY,EAAC;UACb,OAAO2B,OAAO,CAACC,MAAM,CAAC;YAAEC,OAAO,EAAE;UAAiC,CAAC,CAAC;QACxE;QACA,MAAM;UAAE1B,YAAY;UAAEC,aAAa;UAAEN;QAAgB,CAAC,GAAGE,YAAY;QACrEX,YAAY,CAACiB,cAAc,CAACH,YAAY,CAAC;QACzC,IAAGiB,KAAK,EAAC;UACL,MAAM/B,YAAY,CAACoB,WAAW,CAACN,YAAY,EAAEC,aAAa,EAAEN,eAAe,CAAC;QAChF;QACA,OAAO6B,OAAO,CAACI,OAAO,CAACvD,KAAK,CAAC;UAAE,GAAGgD,eAAe;UAAEZ,OAAO,EAAE;YAAE,GAAGY,eAAe,CAACZ,OAAO;YAAEoB,aAAa,EAAG,UAAS7B,YAAa;UAAE;QAAC,CAAC,CAAC,CAAC;MAC1I;MACA,OAAOwB,OAAO,CAACC,MAAM,CAACV,KAAK,CAAC;IAChC,CAAC,CAAC;EACN;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["ApiOverrides/types.d.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,482 @@
1
+ import React, { useState } from 'react';
2
+ import { View, TouchableOpacity } from "react-native";
3
+ import { Button, Icons, Text, TextInput } from '../../Components';
4
+ import Colors from '../../constants/colors';
5
+ import { AuthenticateApi, AuthenticateHelpers } from '../api';
6
+ const attribute_options = ['username', 'email', 'phone'];
7
+ const LoginForm = ({
8
+ width,
9
+ visible,
10
+ onRegister,
11
+ onAuthenticated
12
+ }) => {
13
+ const [authenticated, setAuthenticated] = useState(false);
14
+ const [auth_check, setAuthCheck] = useState({
15
+ loading: false,
16
+ attribute: 'username',
17
+ value: 'james'
18
+ });
19
+ const [halted, setHalted] = useState(false);
20
+ const [login_try, setLoginTry] = useState({
21
+ pass_token: '',
22
+ loading: false,
23
+ visible: false,
24
+ type: 'password'
25
+ });
26
+ const [auth_check_error, setAuthCheckError] = useState();
27
+ const {
28
+ loading,
29
+ attribute,
30
+ value
31
+ } = auth_check;
32
+ const {
33
+ pass_token,
34
+ type,
35
+ verification_session_id
36
+ } = login_try;
37
+ const handleAuthCheck = async () => {
38
+ console.log(authenticated);
39
+ if (loading) {
40
+ return;
41
+ } //No mashy mashy
42
+ setAuthCheck({
43
+ ...auth_check,
44
+ loading: true
45
+ });
46
+ const {
47
+ result,
48
+ message,
49
+ verification_session_id,
50
+ next
51
+ } = await AuthenticateApi.authCheck(attribute, value);
52
+ if (result == 'fail') {
53
+ setAuthCheckError(message);
54
+ } else {
55
+ setLoginTry({
56
+ pass_token: '',
57
+ verification_session_id: verification_session_id,
58
+ visible: true,
59
+ loading: false,
60
+ type: next ?? 'password'
61
+ });
62
+ }
63
+ setAuthCheck({
64
+ ...auth_check,
65
+ loading: false
66
+ });
67
+ };
68
+ const handleForgot = async () => {
69
+ const resp = await AuthenticateApi.authForgot(attribute, value);
70
+ if (resp.result == 'fail') {
71
+ setAuthCheckError(resp.message);
72
+ } else {
73
+ setLoginTry({
74
+ pass_token: '',
75
+ verification_session_id: resp.verification_session_id,
76
+ visible: true,
77
+ loading: false,
78
+ type: resp.next ?? 'password'
79
+ });
80
+ }
81
+ };
82
+ const handleLogin = async () => {
83
+ setLoginTry({
84
+ ...login_try,
85
+ loading: true
86
+ });
87
+ const {
88
+ result,
89
+ message,
90
+ access_token,
91
+ refresh_token,
92
+ expire_datetime
93
+ } = await AuthenticateApi.authLogin(attribute, value, pass_token, verification_session_id);
94
+ if (result == 'fail' || !access_token || !refresh_token) {
95
+ setLoginTry({
96
+ ...login_try,
97
+ error: message,
98
+ loading: false
99
+ });
100
+ setHalted(true);
101
+ return setTimeout(() => {
102
+ setHalted(false);
103
+ }, 5000);
104
+ }
105
+ setLoginTry({
106
+ ...login_try,
107
+ loading: false,
108
+ error: undefined
109
+ });
110
+ setAuthenticated(true);
111
+ return onAuthenticated(access_token, refresh_token, expire_datetime);
112
+ };
113
+ const getAttributeIcon = () => {
114
+ switch (attribute) {
115
+ case 'email':
116
+ return /*#__PURE__*/React.createElement(Icons.EmailIcon, {
117
+ size: 20,
118
+ color: Colors.brand.midnight
119
+ });
120
+ case 'phone':
121
+ return /*#__PURE__*/React.createElement(Icons.PhoneIcon, {
122
+ size: 20,
123
+ color: Colors.brand.midnight
124
+ });
125
+ case 'username':
126
+ return /*#__PURE__*/React.createElement(Icons.UserIcon, {
127
+ size: 20,
128
+ color: Colors.brand.midnight
129
+ });
130
+ default:
131
+ return /*#__PURE__*/React.createElement(Icons.UserIcon, {
132
+ size: 20,
133
+ color: Colors.brand.midnight
134
+ });
135
+ }
136
+ };
137
+ const {
138
+ valid
139
+ } = AuthenticateHelpers.isAttributeValid(attribute, value);
140
+ const login_valid = pass_token.length > 0 && !halted ? true : false;
141
+ if (!visible) {
142
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
143
+ }
144
+ return /*#__PURE__*/React.createElement(View, {
145
+ style: {
146
+ flex: 1,
147
+ width
148
+ }
149
+ }, !login_try.visible ? /*#__PURE__*/React.createElement(View, {
150
+ style: {
151
+ flex: 1
152
+ }
153
+ }, /*#__PURE__*/React.createElement(View, {
154
+ style: {
155
+ padding: 30
156
+ }
157
+ }, /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Text, {
158
+ size: 18,
159
+ color: Colors.brand.midnight,
160
+ weight: "bold"
161
+ }, "Login Using My:")), /*#__PURE__*/React.createElement(View, {
162
+ nativeID: "attribute_toggle",
163
+ style: {
164
+ marginTop: 10,
165
+ flexDirection: 'row',
166
+ borderRadius: 22,
167
+ borderWidth: 1,
168
+ backgroundColor: Colors.shades.shade400,
169
+ borderColor: Colors.shades.shade600
170
+ }
171
+ }, attribute_options.map((a, i) => {
172
+ const selected = a == attribute ? true : false;
173
+ return /*#__PURE__*/React.createElement(Button, {
174
+ style: {
175
+ flex: 1
176
+ },
177
+ title: a.toUpperCase(),
178
+ borderRadiusOverride: {
179
+ borderTopLeftRadius: i == 0 ? 22 : 0,
180
+ borderBottomLeftRadius: i == 0 ? 22 : 0,
181
+ borderTopRightRadius: i == attribute_options.length - 1 ? 22 : 0,
182
+ borderBottomRightRadius: i == attribute_options.length - 1 ? 22 : 0
183
+ },
184
+ title_color: selected ? Colors.shades.white : Colors.brand.electric,
185
+ padding: 15,
186
+ title_weight: selected ? 'bold' : 'regular',
187
+ backgroundColor: selected ? Colors.brand.electric : 'transparent',
188
+ onPress: () => setAuthCheck({
189
+ attribute: a,
190
+ value: '',
191
+ loading: false
192
+ })
193
+ });
194
+ }))), /*#__PURE__*/React.createElement(View, {
195
+ style: {
196
+ flex: 1
197
+ }
198
+ }, /*#__PURE__*/React.createElement(View, {
199
+ style: {
200
+ backgroundColor: Colors.shades.shade100,
201
+ borderRadius: 8,
202
+ padding: 30
203
+ }
204
+ }, /*#__PURE__*/React.createElement(View, {
205
+ style: {
206
+ marginBottom: 10
207
+ }
208
+ }, /*#__PURE__*/React.createElement(Text, {
209
+ size: 18,
210
+ color: Colors.brand.midnight,
211
+ weight: "bold"
212
+ }, "ENTER ", attribute.toUpperCase()), /*#__PURE__*/React.createElement(Text, {
213
+ style: {
214
+ marginTop: 5
215
+ },
216
+ size: 14,
217
+ color: Colors.brand.midnight,
218
+ weight: "regular"
219
+ }, "Please enter your ", attribute, " to continue.")), /*#__PURE__*/React.createElement(View, {
220
+ style: {
221
+ marginTop: 5,
222
+ flexDirection: 'row',
223
+ alignItems: 'center',
224
+ borderRadius: 22,
225
+ borderWidth: 1,
226
+ borderColor: Colors.shades.shade600
227
+ }
228
+ }, /*#__PURE__*/React.createElement(View, {
229
+ style: {
230
+ paddingLeft: 10,
231
+ paddingRight: 15
232
+ }
233
+ }, getAttributeIcon()), /*#__PURE__*/React.createElement(TextInput, {
234
+ style: {
235
+ flex: 1
236
+ },
237
+ value: value,
238
+ placeholder: attribute.toUpperCase(),
239
+ autoFocus: true,
240
+ placeholderTextColor: Colors.brand.slate,
241
+ onChangeText: text => {
242
+ setAuthCheck({
243
+ ...auth_check,
244
+ value: text
245
+ });
246
+ }
247
+ }), /*#__PURE__*/React.createElement(View, {
248
+ style: {
249
+ padding: 10
250
+ }
251
+ }, valid ? /*#__PURE__*/React.createElement(Icons.CheckCirlceIcon, {
252
+ color: Colors.utility.success,
253
+ size: 14
254
+ }) : /*#__PURE__*/React.createElement(Icons.AlertIcon, {
255
+ color: Colors.utility.warning,
256
+ size: 14
257
+ }))), auth_check_error ? /*#__PURE__*/React.createElement(TouchableOpacity, {
258
+ style: {
259
+ marginTop: 10,
260
+ padding: 10,
261
+ backgroundColor: Colors.shades.white,
262
+ borderRadius: 8
263
+ },
264
+ onPress: () => onRegister()
265
+ }, /*#__PURE__*/React.createElement(Text, {
266
+ size: 14,
267
+ color: Colors.utility.error,
268
+ weight: "semibold",
269
+ textAlign: "center"
270
+ }, auth_check_error), /*#__PURE__*/React.createElement(Text, {
271
+ style: {
272
+ marginTop: 5
273
+ },
274
+ size: 14,
275
+ color: Colors.brand.electric,
276
+ weight: "bold",
277
+ textAlign: "center"
278
+ }, "SIGN UP HERE")) : /*#__PURE__*/React.createElement(React.Fragment, null))), /*#__PURE__*/React.createElement(View, {
279
+ style: {
280
+ padding: 20
281
+ }
282
+ }, /*#__PURE__*/React.createElement(Button, {
283
+ title: "LOGIN",
284
+ style: {
285
+ opacity: !valid || loading ? 0.5 : 1
286
+ },
287
+ title_color: Colors.shades.white,
288
+ loading: loading,
289
+ backgroundColor: Colors.brand.electric,
290
+ disabled: !valid || loading,
291
+ padding: 15,
292
+ onPress: () => handleAuthCheck()
293
+ })), /*#__PURE__*/React.createElement(View, {
294
+ style: {
295
+ padding: 15,
296
+ backgroundColor: Colors.shades.shade100
297
+ }
298
+ }, /*#__PURE__*/React.createElement(Button, {
299
+ title: "Are You New? Sign Up Here",
300
+ title_color: Colors.brand.electric,
301
+ backgroundColor: "transparent",
302
+ onPress: () => onRegister()
303
+ }))) : /*#__PURE__*/React.createElement(View, {
304
+ style: {
305
+ flex: 1
306
+ }
307
+ }, /*#__PURE__*/React.createElement(View, {
308
+ style: {
309
+ flex: 1
310
+ }
311
+ }, /*#__PURE__*/React.createElement(View, {
312
+ style: {
313
+ borderRadius: 8,
314
+ padding: 30
315
+ }
316
+ }, /*#__PURE__*/React.createElement(View, {
317
+ style: {
318
+ marginBottom: 10
319
+ }
320
+ }, /*#__PURE__*/React.createElement(Text, {
321
+ size: 18,
322
+ color: Colors.brand.midnight,
323
+ weight: "bold"
324
+ }, "MY ", attribute.toUpperCase())), /*#__PURE__*/React.createElement(View, {
325
+ style: {
326
+ flexDirection: 'row',
327
+ alignItems: 'center',
328
+ borderRadius: 22,
329
+ borderWidth: 1,
330
+ borderColor: Colors.shades.shade600
331
+ }
332
+ }, /*#__PURE__*/React.createElement(View, {
333
+ style: {
334
+ paddingLeft: 10,
335
+ paddingRight: 15
336
+ }
337
+ }, getAttributeIcon()), /*#__PURE__*/React.createElement(TextInput, {
338
+ value: value,
339
+ editable: false,
340
+ style: {
341
+ flex: 1,
342
+ backgroundColor: Colors.shades.shade100
343
+ },
344
+ placeholderTextColor: Colors.brand.slate,
345
+ onChangeText: () => console.log('')
346
+ }), /*#__PURE__*/React.createElement(View, {
347
+ style: {
348
+ padding: 10
349
+ }
350
+ }, /*#__PURE__*/React.createElement(Icons.CheckCirlceIcon, {
351
+ color: Colors.utility.success,
352
+ size: 14
353
+ })))), /*#__PURE__*/React.createElement(View, {
354
+ style: {
355
+ borderRadius: 8,
356
+ padding: 30,
357
+ backgroundColor: Colors.shades.shade100
358
+ }
359
+ }, /*#__PURE__*/React.createElement(View, {
360
+ style: {
361
+ marginBottom: 10
362
+ }
363
+ }, /*#__PURE__*/React.createElement(Text, {
364
+ size: 18,
365
+ color: Colors.brand.midnight,
366
+ weight: "bold"
367
+ }, "ENTER ", type.toUpperCase()), type == 'token' ? /*#__PURE__*/React.createElement(Text, {
368
+ style: {
369
+ marginTop: 5
370
+ },
371
+ size: 14,
372
+ color: Colors.brand.midnight,
373
+ weight: "regular"
374
+ }, "We sent a one-time token to ", value, ". Please enter it below.") : /*#__PURE__*/React.createElement(Text, {
375
+ style: {
376
+ marginTop: 5
377
+ },
378
+ size: 14,
379
+ color: Colors.brand.midnight,
380
+ weight: "regular"
381
+ }, "Please enter the password associated with the ", attribute, " ", value, ".")), /*#__PURE__*/React.createElement(View, {
382
+ style: {
383
+ flexDirection: 'row',
384
+ alignItems: 'center',
385
+ borderRadius: 22,
386
+ borderWidth: 1,
387
+ borderColor: Colors.shades.shade600
388
+ }
389
+ }, /*#__PURE__*/React.createElement(View, {
390
+ style: {
391
+ paddingLeft: 10,
392
+ paddingRight: 15
393
+ }
394
+ }, /*#__PURE__*/React.createElement(Icons.LockClosedIcon, {
395
+ size: 20,
396
+ color: Colors.brand.midnight
397
+ })), /*#__PURE__*/React.createElement(TextInput, {
398
+ style: {
399
+ flex: 1
400
+ },
401
+ value: pass_token,
402
+ placeholder: `Enter ${type}`,
403
+ autoFocus: true,
404
+ secureTextEntry: true,
405
+ textContentType: type == 'password' ? 'password' : 'oneTimeCode',
406
+ placeholderTextColor: Colors.brand.slate,
407
+ onChangeText: text => {
408
+ setLoginTry({
409
+ ...login_try,
410
+ pass_token: text
411
+ });
412
+ }
413
+ }), /*#__PURE__*/React.createElement(View, {
414
+ style: {
415
+ padding: 10
416
+ }
417
+ }, login_valid ? /*#__PURE__*/React.createElement(Icons.CheckCirlceIcon, {
418
+ color: Colors.utility.success,
419
+ size: 14
420
+ }) : /*#__PURE__*/React.createElement(Icons.AlertIcon, {
421
+ color: Colors.utility.warning,
422
+ size: 14
423
+ }))), login_try.error ? /*#__PURE__*/React.createElement(TouchableOpacity, {
424
+ style: {
425
+ marginTop: 10,
426
+ padding: 10,
427
+ backgroundColor: Colors.shades.white,
428
+ borderRadius: 8
429
+ },
430
+ onPress: () => handleForgot()
431
+ }, /*#__PURE__*/React.createElement(Text, {
432
+ size: 14,
433
+ color: Colors.utility.error,
434
+ weight: "semibold",
435
+ textAlign: "center"
436
+ }, login_try.error), /*#__PURE__*/React.createElement(Text, {
437
+ style: {
438
+ marginTop: 5
439
+ },
440
+ size: 14,
441
+ color: Colors.brand.electric,
442
+ weight: "bold",
443
+ textAlign: "center"
444
+ }, "SEND ME A CODE INSTEAD")) : /*#__PURE__*/React.createElement(React.Fragment, null))), /*#__PURE__*/React.createElement(View, {
445
+ style: {
446
+ padding: 20,
447
+ flexDirection: 'row'
448
+ }
449
+ }, /*#__PURE__*/React.createElement(Button, {
450
+ title: "BACK",
451
+ style: {
452
+ marginRight: 5,
453
+ flex: 1
454
+ },
455
+ title_color: Colors.brand.electric,
456
+ backgroundColor: Colors.shades.white,
457
+ borderWidth: 1,
458
+ borderColor: Colors.brand.electric,
459
+ padding: 15,
460
+ onPress: () => {
461
+ setLoginTry({
462
+ ...login_try,
463
+ pass_token: '',
464
+ visible: false
465
+ });
466
+ }
467
+ }), /*#__PURE__*/React.createElement(Button, {
468
+ title: halted ? 'Try again in 5 seconds' : 'LOGIN',
469
+ style: {
470
+ flex: 3,
471
+ opacity: !login_valid || loading ? 0.5 : 1
472
+ },
473
+ title_color: Colors.shades.white,
474
+ loading: login_try.loading,
475
+ backgroundColor: Colors.brand.electric,
476
+ disabled: !login_valid || loading,
477
+ padding: 15,
478
+ onPress: () => handleLogin()
479
+ }))));
480
+ };
481
+ export default LoginForm;
482
+ //# sourceMappingURL=LoginForm.js.map