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