quidproquo-web-admin 0.0.263 → 0.1.0

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 (184) hide show
  1. package/README.md +53 -41
  2. package/lib/commonjs/App/App.d.ts +2 -0
  3. package/lib/commonjs/App/App.js +3 -2
  4. package/lib/commonjs/Auth/Auth.d.ts +1 -1
  5. package/lib/commonjs/Auth/Auth.js +12 -4
  6. package/lib/commonjs/Auth/AuthChallengeMfaSetup/AuthChallengeMfaSetup.d.ts +6 -0
  7. package/lib/commonjs/Auth/AuthChallengeMfaSetup/AuthChallengeMfaSetup.js +50 -0
  8. package/lib/commonjs/Auth/AuthChallengeMfaSetup/index.d.ts +1 -0
  9. package/lib/commonjs/Auth/AuthChallengeMfaSetup/index.js +17 -0
  10. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/authActionCreator.d.ts +3 -0
  11. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/authActionCreator.js +15 -0
  12. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/authChallengeReducer.d.ts +3 -0
  13. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/authChallengeReducer.js +19 -0
  14. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/authChallengeTypes.d.ts +25 -0
  15. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/authChallengeTypes.js +8 -0
  16. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/index.d.ts +4 -0
  17. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/index.js +20 -0
  18. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/runtime/askAuthChallengeAssociateSoftwareToken.d.ts +2 -0
  19. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/runtime/askAuthChallengeAssociateSoftwareToken.js +18 -0
  20. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/runtime/askAuthChallengeSendMfaSetupCode.d.ts +2 -0
  21. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/runtime/askAuthChallengeSendMfaSetupCode.js +24 -0
  22. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/runtime/authChallengeLogic.d.ts +8 -0
  23. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/runtime/authChallengeLogic.js +11 -0
  24. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/runtime/index.d.ts +1 -0
  25. package/lib/commonjs/Auth/AuthChallengeMfaSetup/logic/runtime/index.js +17 -0
  26. package/lib/commonjs/Auth/AuthChallengeNewPasswordRequired/AuthChallengeNewPasswordRequired.d.ts +1 -1
  27. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa.d.ts +6 -0
  28. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa.js +36 -0
  29. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/index.d.ts +1 -0
  30. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/index.js +17 -0
  31. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/authActionCreator.d.ts +2 -0
  32. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/authActionCreator.js +8 -0
  33. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/authChallengeReducer.d.ts +3 -0
  34. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/authChallengeReducer.js +13 -0
  35. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/authChallengeTypes.d.ts +15 -0
  36. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/authChallengeTypes.js +7 -0
  37. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/index.d.ts +4 -0
  38. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/index.js +20 -0
  39. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/askAuthChallengeSendMfaCode.d.ts +2 -0
  40. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/askAuthChallengeSendMfaCode.js +22 -0
  41. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/authChallengeLogic.d.ts +6 -0
  42. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/authChallengeLogic.js +9 -0
  43. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/index.d.ts +1 -0
  44. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/index.js +17 -0
  45. package/lib/commonjs/Auth/Login.d.ts +1 -1
  46. package/lib/commonjs/Config/Config.d.ts +2 -1
  47. package/lib/commonjs/FederatedAddon.d.ts +6 -0
  48. package/lib/commonjs/FederatedAddonProvider.d.ts +8 -0
  49. package/lib/commonjs/FederatedAddonProvider.js +21 -0
  50. package/lib/commonjs/LogViewer/ActionHistoryItem.d.ts +1 -1
  51. package/lib/commonjs/LogViewer/ActionHistoryItemTimeStamp.d.ts +1 -1
  52. package/lib/commonjs/LogViewer/ActionRender/ActionRender.d.ts +2 -2
  53. package/lib/commonjs/LogViewer/AdminLogs/AdminLogGrid/AdminLogGrid.d.ts +1 -1
  54. package/lib/commonjs/LogViewer/AdminLogs/AdminLogSearchBar/AdminLogSearchBar.d.ts +1 -1
  55. package/lib/commonjs/LogViewer/AdminLogs/AdminLogs.d.ts +1 -1
  56. package/lib/commonjs/LogViewer/ConsoleLogViewer.d.ts +2 -2
  57. package/lib/commonjs/LogViewer/LogCorrelationTree.d.ts +1 -1
  58. package/lib/commonjs/LogViewer/LogCorrelationTree.js +9 -1
  59. package/lib/commonjs/LogViewer/LogCorrelations.d.ts +1 -1
  60. package/lib/commonjs/LogViewer/LogDetails.d.ts +1 -1
  61. package/lib/commonjs/LogViewer/LogDialog/LogDialog.d.ts +1 -1
  62. package/lib/commonjs/LogViewer/LogMetadataGrid.d.ts +1 -1
  63. package/lib/commonjs/LogViewer/LogRawJson.d.ts +1 -1
  64. package/lib/commonjs/LogViewer/LogSearch.d.ts +1 -1
  65. package/lib/commonjs/LogViewer/LogSummary.d.ts +1 -1
  66. package/lib/commonjs/LogViewer/LogSummaryDetails.d.ts +1 -1
  67. package/lib/commonjs/LogViewer/LogSummaryDetails.js +8 -1
  68. package/lib/commonjs/LogViewer/LogSummaryReturn.d.ts +1 -1
  69. package/lib/commonjs/LogViewer/LogSummaryReturn.js +8 -1
  70. package/lib/commonjs/LogViewer/TopSection.d.ts +1 -1
  71. package/lib/commonjs/LogViewer/TruncatedText.d.ts +1 -1
  72. package/lib/commonjs/LogViewer/actionComponents/genericActionRenderer/AnyVariableView/AnyVariableView.d.ts +8 -8
  73. package/lib/commonjs/LogViewer/actionComponents/genericActionRenderer/AnyVariableView/AnyVariableView.js +47 -9
  74. package/lib/commonjs/LogViewer/charts/CostPerService.d.ts +1 -1
  75. package/lib/commonjs/LogViewer/charts/ErrorsByType.d.ts +1 -1
  76. package/lib/commonjs/LogViewer/charts/ErrorsOverTime.d.ts +1 -1
  77. package/lib/commonjs/LogViewer/charts/RequestsByService.d.ts +1 -1
  78. package/lib/commonjs/LogViewer/logic/index.d.ts +0 -1
  79. package/lib/commonjs/LogViewer/logic/index.js +0 -1
  80. package/lib/commonjs/components/AdminDialog.d.ts +1 -1
  81. package/lib/commonjs/components/AsyncButton.d.ts +2 -2
  82. package/lib/commonjs/components/DataGrid.d.ts +1 -1
  83. package/lib/commonjs/components/DataGridPagination/DataGridPagination.d.ts +1 -1
  84. package/lib/commonjs/components/LastSeen/LastSeen.d.ts +1 -1
  85. package/lib/commonjs/components/LoadingBox/LoadingBox.d.ts +1 -1
  86. package/lib/commonjs/components/MainLayout/MainLayout.d.ts +1 -1
  87. package/lib/commonjs/index.d.ts +2 -0
  88. package/lib/commonjs/index.js +2 -0
  89. package/lib/commonjs/logic/platform/apiRequest.js +29 -19
  90. package/lib/commonjs/useFederatedAddon.js +4 -33
  91. package/lib/esm/App/App.d.ts +2 -0
  92. package/lib/esm/App/App.js +3 -2
  93. package/lib/esm/Auth/Auth.d.ts +1 -1
  94. package/lib/esm/Auth/Auth.js +8 -0
  95. package/lib/esm/Auth/AuthChallengeMfaSetup/AuthChallengeMfaSetup.d.ts +6 -0
  96. package/lib/esm/Auth/AuthChallengeMfaSetup/AuthChallengeMfaSetup.js +43 -0
  97. package/lib/esm/Auth/AuthChallengeMfaSetup/index.d.ts +1 -0
  98. package/lib/esm/Auth/AuthChallengeMfaSetup/index.js +1 -0
  99. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/authActionCreator.d.ts +3 -0
  100. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/authActionCreator.js +11 -0
  101. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/authChallengeReducer.d.ts +3 -0
  102. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/authChallengeReducer.js +16 -0
  103. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/authChallengeTypes.d.ts +25 -0
  104. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/authChallengeTypes.js +5 -0
  105. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/index.d.ts +4 -0
  106. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/index.js +4 -0
  107. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/runtime/askAuthChallengeAssociateSoftwareToken.d.ts +2 -0
  108. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/runtime/askAuthChallengeAssociateSoftwareToken.js +15 -0
  109. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/runtime/askAuthChallengeSendMfaSetupCode.d.ts +2 -0
  110. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/runtime/askAuthChallengeSendMfaSetupCode.js +21 -0
  111. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/runtime/authChallengeLogic.d.ts +8 -0
  112. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/runtime/authChallengeLogic.js +8 -0
  113. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/runtime/index.d.ts +1 -0
  114. package/lib/esm/Auth/AuthChallengeMfaSetup/logic/runtime/index.js +1 -0
  115. package/lib/esm/Auth/AuthChallengeNewPasswordRequired/AuthChallengeNewPasswordRequired.d.ts +1 -1
  116. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa.d.ts +6 -0
  117. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa.js +27 -0
  118. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/index.d.ts +1 -0
  119. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/index.js +1 -0
  120. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/authActionCreator.d.ts +2 -0
  121. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/authActionCreator.js +5 -0
  122. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/authChallengeReducer.d.ts +3 -0
  123. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/authChallengeReducer.js +10 -0
  124. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/authChallengeTypes.d.ts +15 -0
  125. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/authChallengeTypes.js +4 -0
  126. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/index.d.ts +4 -0
  127. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/index.js +4 -0
  128. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/askAuthChallengeSendMfaCode.d.ts +2 -0
  129. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/askAuthChallengeSendMfaCode.js +19 -0
  130. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/authChallengeLogic.d.ts +6 -0
  131. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/authChallengeLogic.js +6 -0
  132. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/index.d.ts +1 -0
  133. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/logic/runtime/index.js +1 -0
  134. package/lib/esm/Auth/Login.d.ts +1 -1
  135. package/lib/esm/Config/Config.d.ts +2 -1
  136. package/lib/esm/FederatedAddon.d.ts +6 -0
  137. package/lib/esm/FederatedAddonProvider.d.ts +8 -0
  138. package/lib/esm/FederatedAddonProvider.js +7 -0
  139. package/lib/esm/LogViewer/ActionHistoryItem.d.ts +1 -1
  140. package/lib/esm/LogViewer/ActionHistoryItemTimeStamp.d.ts +1 -1
  141. package/lib/esm/LogViewer/ActionRender/ActionRender.d.ts +2 -2
  142. package/lib/esm/LogViewer/AdminLogs/AdminLogGrid/AdminLogGrid.d.ts +1 -1
  143. package/lib/esm/LogViewer/AdminLogs/AdminLogSearchBar/AdminLogSearchBar.d.ts +1 -1
  144. package/lib/esm/LogViewer/AdminLogs/AdminLogs.d.ts +1 -1
  145. package/lib/esm/LogViewer/ConsoleLogViewer.d.ts +2 -2
  146. package/lib/esm/LogViewer/LogCorrelationTree.d.ts +1 -1
  147. package/lib/esm/LogViewer/LogCorrelationTree.js +9 -1
  148. package/lib/esm/LogViewer/LogCorrelations.d.ts +1 -1
  149. package/lib/esm/LogViewer/LogDetails.d.ts +1 -1
  150. package/lib/esm/LogViewer/LogDialog/LogDialog.d.ts +1 -1
  151. package/lib/esm/LogViewer/LogMetadataGrid.d.ts +1 -1
  152. package/lib/esm/LogViewer/LogRawJson.d.ts +1 -1
  153. package/lib/esm/LogViewer/LogSearch.d.ts +1 -1
  154. package/lib/esm/LogViewer/LogSummary.d.ts +1 -1
  155. package/lib/esm/LogViewer/LogSummaryDetails.d.ts +1 -1
  156. package/lib/esm/LogViewer/LogSummaryDetails.js +6 -2
  157. package/lib/esm/LogViewer/LogSummaryReturn.d.ts +1 -1
  158. package/lib/esm/LogViewer/LogSummaryReturn.js +6 -2
  159. package/lib/esm/LogViewer/TopSection.d.ts +1 -1
  160. package/lib/esm/LogViewer/TruncatedText.d.ts +1 -1
  161. package/lib/esm/LogViewer/actionComponents/genericActionRenderer/AnyVariableView/AnyVariableView.d.ts +8 -8
  162. package/lib/esm/LogViewer/actionComponents/genericActionRenderer/AnyVariableView/AnyVariableView.js +47 -9
  163. package/lib/esm/LogViewer/charts/CostPerService.d.ts +1 -1
  164. package/lib/esm/LogViewer/charts/ErrorsByType.d.ts +1 -1
  165. package/lib/esm/LogViewer/charts/ErrorsOverTime.d.ts +1 -1
  166. package/lib/esm/LogViewer/charts/RequestsByService.d.ts +1 -1
  167. package/lib/esm/LogViewer/logic/index.d.ts +0 -1
  168. package/lib/esm/LogViewer/logic/index.js +0 -1
  169. package/lib/esm/components/AdminDialog.d.ts +1 -1
  170. package/lib/esm/components/AsyncButton.d.ts +2 -2
  171. package/lib/esm/components/DataGrid.d.ts +1 -1
  172. package/lib/esm/components/DataGridPagination/DataGridPagination.d.ts +1 -1
  173. package/lib/esm/components/LastSeen/LastSeen.d.ts +1 -1
  174. package/lib/esm/components/LoadingBox/LoadingBox.d.ts +1 -1
  175. package/lib/esm/components/MainLayout/MainLayout.d.ts +1 -1
  176. package/lib/esm/index.d.ts +2 -0
  177. package/lib/esm/index.js +2 -0
  178. package/lib/esm/logic/platform/apiRequest.js +29 -16
  179. package/lib/esm/useFederatedAddon.js +4 -33
  180. package/package.json +11 -23
  181. package/lib/commonjs/LogViewer/logic/getFederationManifestUrl.d.ts +0 -3
  182. package/lib/commonjs/LogViewer/logic/getFederationManifestUrl.js +0 -19
  183. package/lib/esm/LogViewer/logic/getFederationManifestUrl.d.ts +0 -3
  184. package/lib/esm/LogViewer/logic/getFederationManifestUrl.js +0 -5
package/README.md CHANGED
@@ -1,64 +1,76 @@
1
- # Quidproquo Web Logs - WIP - Not for production
1
+ # quidproquo-web-admin WIP, not for production
2
2
 
3
- Welcome to Quidproquo Web Logs, an interface for viewing logs that happen in your server! This project is part of the Quidproquo platform, which
4
- deploys web servers to AWS but is platform independent.
3
+ A React admin UI for Quidproquo backends log viewing, config inspection, and
4
+ auth, wired to your deployed QPQ services.
5
5
 
6
- ## Features
6
+ This package is a **React component library**, not a standalone app. It ships
7
+ dual CommonJS/ESM builds (plus type declarations) compiled with `tsc`. There is
8
+ no bundler — you import `<App />` into your own host application and build/serve
9
+ it however you like. React (`>=18.3.1`) is a peer dependency, so the host owns
10
+ the React instance.
7
11
 
8
- With Quidproquo Web Logs, you can:
12
+ ## Install
9
13
 
10
- - View a list of logs.
11
- - Filter logs by date and time.
12
- - Search logs by keyword.
13
- - View detailed information for each log entry.
14
+ ```bash
15
+ npm install quidproquo-web-admin
16
+ ```
14
17
 
15
- ## Technologies Used
18
+ ## Usage
16
19
 
17
- Quidproquo Web Logs is built using React, a popular JavaScript library for building user interfaces. It uses Axios for making HTTP requests to the
18
- server and Moment.js for parsing and formatting dates.
20
+ Mount `<App />`, telling it how to resolve the URLs of your deployed QPQ
21
+ services:
19
22
 
20
- ## Installation
23
+ ```tsx
24
+ import { App } from 'quidproquo-web-admin';
25
+ import { BaseUrlResolvers } from 'quidproquo-web-react';
26
+ import { createRoot } from 'react-dom/client';
21
27
 
22
- To install Quidproquo Web Logs, follow these steps:
28
+ const urlResolvers: BaseUrlResolvers = {
29
+ getApiUrl: () => 'https://api.example.com',
30
+ getWsUrl: () => 'wss://ws.example.com',
31
+ };
23
32
 
24
- 1. Clone this repository to your local machine.
25
- 2. Navigate to the project directory.
26
- 3. Run `npm install` to install the required dependencies.
27
- 4. Run `npm start` to start the development server.
33
+ createRoot(document.getElementById('root')!).render(<App urlResolvers={urlResolvers} />);
34
+ ```
28
35
 
29
- ## Usage
36
+ ## Addons
30
37
 
31
- To use Quidproquo Web Logs, follow these steps:
38
+ The admin UI can be extended with addon tabs. `quidproquo-web-admin` does not
39
+ own the loading mechanism — the host application supplies a `loadAddons`
40
+ function (module federation, dynamic `import()`, a static array, whatever you
41
+ like), and the admin renders whatever addons it returns.
32
42
 
33
- 1. Open your web browser and navigate to the URL of the Quidproquo Web Logs interface.
34
- 2. Log in with your Quidproquo credentials.
35
- 3. Select the web server whose logs you want to view.
36
- 4. Use the date and time filters to narrow down the list of logs.
37
- 5. Use the search bar to search for logs by keyword.
38
- 6. Click on a log entry to view detailed information about it.
43
+ ```tsx
44
+ import { App, createAddon, LoadFederatedAddons } from 'quidproquo-web-admin';
39
45
 
40
- ## Contributing
46
+ const MyTab = () => <div>Hello from an addon</div>;
41
47
 
42
- If you'd like to contribute to Quidproquo Web Logs, please follow these steps:
48
+ const loadAddons: LoadFederatedAddons = async ({ baseUrlResolvers, accessToken }) => [
49
+ createAddon('My Tab', MyTab),
50
+ ];
43
51
 
44
- 1. Fork this repository to your own GitHub account.
45
- 2. Clone your forked repository to your local machine.
46
- 3. Make your changes and test them locally.
47
- 4. Push your changes to your forked repository on GitHub.
48
- 5. Submit a pull request to the original repository.
52
+ <App urlResolvers={urlResolvers} loadAddons={loadAddons} />;
53
+ ```
49
54
 
50
- ## License
55
+ When `loadAddons` is omitted, no addons are loaded.
51
56
 
52
- Quidproquo Web Logs is licensed under the MIT License. See `LICENSE` for more information.
57
+ ## Build
53
58
 
54
- ## Acknowledgments
59
+ ```bash
60
+ # from the repo root
61
+ npm run build -w quidproquo-web-admin
62
+ ```
55
63
 
56
- - The Quidproquo team for their support and feedback.
64
+ This runs `tsc` twice, emitting:
57
65
 
58
- ### Note
66
+ - `lib/esm` — ES modules (`module`, `types`)
67
+ - `lib/commonjs` — CommonJS (`main`)
59
68
 
60
- Currently under development ~ Not for production
69
+ ```bash
70
+ # watch ESM during development
71
+ npm run watch -w quidproquo-web-admin
72
+ ```
61
73
 
62
- ### References
74
+ ## License
63
75
 
64
- https://levelup.gitconnected.com/full-guide-start-react-app-from-scratch-2e1579ac6868
76
+ MIT
@@ -1,6 +1,8 @@
1
1
  import { BaseUrlResolvers } from 'quidproquo-web-react';
2
2
  import React from 'react';
3
+ import { LoadFederatedAddons } from '../FederatedAddon';
3
4
  export type AppProps = {
4
5
  urlResolvers: BaseUrlResolvers;
6
+ loadAddons?: LoadFederatedAddons;
5
7
  };
6
8
  export declare const App: React.FC<AppProps>;
@@ -12,6 +12,7 @@ const CssBaseline_1 = __importDefault(require("@mui/material/CssBaseline"));
12
12
  const styles_1 = require("@mui/material/styles");
13
13
  const Auth_1 = require("../Auth/Auth");
14
14
  const components_1 = require("../components");
15
+ const FederatedAddonProvider_1 = require("../FederatedAddonProvider");
15
16
  const contexts_1 = require("../platformLogic/contexts");
16
17
  const view_1 = require("../view");
17
18
  const WebSocketAuthProvider_1 = require("../WebSocketAuthProvider");
@@ -20,11 +21,11 @@ const darkTheme = (0, styles_1.createTheme)({
20
21
  mode: 'light',
21
22
  },
22
23
  });
23
- const App = ({ urlResolvers }) => {
24
+ const App = ({ urlResolvers, loadAddons }) => {
24
25
  const baseUrls = (0, react_1.useMemo)(() => ({
25
26
  api: urlResolvers.getApiUrl(),
26
27
  ws: urlResolvers.getWsUrl(),
27
28
  }), [urlResolvers]);
28
- return ((0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqContextProvider, { contextIdentifier: contexts_1.baseUrlsContext, value: baseUrls, children: (0, jsx_runtime_1.jsx)(react_router_dom_1.BrowserRouter, { children: (0, jsx_runtime_1.jsx)(quidproquo_web_react_1.BaseUrlProvider, { urlResolvers: urlResolvers, children: (0, jsx_runtime_1.jsxs)(styles_1.ThemeProvider, { theme: darkTheme, children: [(0, jsx_runtime_1.jsx)(CssBaseline_1.default, {}), (0, jsx_runtime_1.jsx)(view_1.LoadingProvider, { children: (0, jsx_runtime_1.jsx)(Auth_1.Auth, { children: (0, jsx_runtime_1.jsx)(quidproquo_web_react_1.WebsocketProvider, { wsUrl: urlResolvers.getWsUrl(), children: (0, jsx_runtime_1.jsx)(WebSocketAuthProvider_1.WebSocketAuthProvider, { children: (0, jsx_runtime_1.jsx)(components_1.MainLayout, {}) }) }) }) })] }) }) }) }));
29
+ return ((0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqContextProvider, { contextIdentifier: contexts_1.baseUrlsContext, value: baseUrls, children: (0, jsx_runtime_1.jsx)(react_router_dom_1.BrowserRouter, { children: (0, jsx_runtime_1.jsx)(quidproquo_web_react_1.BaseUrlProvider, { urlResolvers: urlResolvers, children: (0, jsx_runtime_1.jsxs)(styles_1.ThemeProvider, { theme: darkTheme, children: [(0, jsx_runtime_1.jsx)(CssBaseline_1.default, {}), (0, jsx_runtime_1.jsx)(view_1.LoadingProvider, { children: (0, jsx_runtime_1.jsx)(Auth_1.Auth, { children: (0, jsx_runtime_1.jsx)(quidproquo_web_react_1.WebsocketProvider, { wsUrl: urlResolvers.getWsUrl(), children: (0, jsx_runtime_1.jsx)(WebSocketAuthProvider_1.WebSocketAuthProvider, { children: (0, jsx_runtime_1.jsx)(FederatedAddonProvider_1.FederatedAddonProvider, { loadAddons: loadAddons, children: (0, jsx_runtime_1.jsx)(components_1.MainLayout, {}) }) }) }) }) })] }) }) }) }));
29
30
  };
30
31
  exports.App = App;
@@ -2,5 +2,5 @@ import { ReactNode } from 'react';
2
2
  interface AuthProps {
3
3
  children?: ReactNode;
4
4
  }
5
- export declare function Auth({ children }: AuthProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function Auth({ children }: AuthProps): import("react").JSX.Element;
6
6
  export {};
@@ -4,24 +4,32 @@ exports.Auth = Auth;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const quidproquo_core_1 = require("quidproquo-core");
6
6
  const quidproquo_web_react_1 = require("quidproquo-web-react");
7
+ const AuthChallengeMfaSetup_1 = require("./AuthChallengeMfaSetup/AuthChallengeMfaSetup");
7
8
  const AuthChallengeNewPasswordRequired_1 = require("./AuthChallengeNewPasswordRequired/AuthChallengeNewPasswordRequired");
9
+ const AuthChallengeSoftwareTokenMfa_1 = require("./AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa");
8
10
  const isLoggedOn_1 = require("./logic/isLoggedOn");
9
11
  const askAuthMain_1 = require("./logic/runtime/askAuthMain");
10
12
  const logic_1 = require("./logic");
11
13
  const Login_1 = require("./Login");
12
14
  const authRuntime = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)(logic_1.authLogic, logic_1.authInitalState, logic_1.authReducer);
13
15
  function Auth({ children }) {
14
- var _a, _b, _c, _d;
16
+ var _a, _b, _c, _d, _e, _f;
15
17
  const [api, state, dispatch] = (0, quidproquo_web_react_1.useQpqRuntime)(authRuntime, askAuthMain_1.askAuthMain);
16
18
  const isAuthenticated = (0, isLoggedOn_1.isLoggedOn)(state);
17
19
  if (((_a = state.authenticateUserResponse) === null || _a === void 0 ? void 0 : _a.challenge) === quidproquo_core_1.AuthenticateUserChallenge.NEW_PASSWORD_REQUIRED) {
18
20
  return ((0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqRuntimeEffectCatcher, { runtime: authRuntime, children: (0, jsx_runtime_1.jsx)(AuthChallengeNewPasswordRequired_1.AuthChallengeNewPasswordRequired, { authState: state }) }));
19
21
  }
22
+ if (((_b = state.authenticateUserResponse) === null || _b === void 0 ? void 0 : _b.challenge) === quidproquo_core_1.AuthenticateUserChallenge.SOFTWARE_TOKEN_MFA) {
23
+ return ((0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqRuntimeEffectCatcher, { runtime: authRuntime, children: (0, jsx_runtime_1.jsx)(AuthChallengeSoftwareTokenMfa_1.AuthChallengeSoftwareTokenMfa, { authState: state }) }));
24
+ }
25
+ if (((_c = state.authenticateUserResponse) === null || _c === void 0 ? void 0 : _c.challenge) === quidproquo_core_1.AuthenticateUserChallenge.MFA_SETUP) {
26
+ return ((0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqRuntimeEffectCatcher, { runtime: authRuntime, children: (0, jsx_runtime_1.jsx)(AuthChallengeMfaSetup_1.AuthChallengeMfaSetup, { authState: state }) }));
27
+ }
20
28
  return ((0, jsx_runtime_1.jsxs)(quidproquo_web_react_1.QpqRuntimeEffectCatcher, { runtime: authRuntime, children: [!isAuthenticated && ((0, jsx_runtime_1.jsx)(Login_1.Login, { setUsername: api.authUISetUsername, setPassword: api.authUISetPassword, username: state.username, password: state.password, onLogin: api.authLogin })), isAuthenticated && ((0, jsx_runtime_1.jsx)(quidproquo_web_react_1.authContext.Provider, { value: {
21
- challenge: (_b = state.authenticateUserResponse) === null || _b === void 0 ? void 0 : _b.challenge,
22
- session: (_c = state.authenticateUserResponse) === null || _c === void 0 ? void 0 : _c.session,
29
+ challenge: (_d = state.authenticateUserResponse) === null || _d === void 0 ? void 0 : _d.challenge,
30
+ session: (_e = state.authenticateUserResponse) === null || _e === void 0 ? void 0 : _e.session,
23
31
  username: state.username,
24
32
  password: state.password,
25
- authenticationInfo: (_d = state.authenticateUserResponse) === null || _d === void 0 ? void 0 : _d.authenticationInfo,
33
+ authenticationInfo: (_f = state.authenticateUserResponse) === null || _f === void 0 ? void 0 : _f.authenticationInfo,
26
34
  }, children: children }))] }));
27
35
  }
@@ -0,0 +1,6 @@
1
+ import { AuthState } from '../logic';
2
+ interface AuthChallengeMfaSetupProps {
3
+ authState: AuthState;
4
+ }
5
+ export declare function AuthChallengeMfaSetup({ authState }: AuthChallengeMfaSetupProps): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AuthChallengeMfaSetup = AuthChallengeMfaSetup;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const quidproquo_web_react_1 = require("quidproquo-web-react");
9
+ const react_1 = require("react");
10
+ const Lock_1 = __importDefault(require("@mui/icons-material/Lock"));
11
+ const Box_1 = __importDefault(require("@mui/material/Box"));
12
+ const Grid_1 = __importDefault(require("@mui/material/Grid"));
13
+ const TextField_1 = __importDefault(require("@mui/material/TextField"));
14
+ const Typography_1 = __importDefault(require("@mui/material/Typography"));
15
+ const components_1 = require("../../components");
16
+ const logic_1 = require("./logic");
17
+ const atom = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)(logic_1.authChallengeMfaSetupLogic, logic_1.authChallengeMfaSetupInitalState, logic_1.authChallengeMfaSetupReducer);
18
+ // otpauth:// URI consumed by authenticator apps when scanning / importing.
19
+ const buildOtpAuthUri = (email, secretCode) => {
20
+ const issuer = window.location.host;
21
+ const label = encodeURIComponent(`${issuer}:${email}`);
22
+ return `otpauth://totp/${label}?secret=${secretCode}&issuer=${encodeURIComponent(issuer)}`;
23
+ };
24
+ function AuthChallengeMfaSetup({ authState }) {
25
+ var _a, _b;
26
+ const [api, state] = (0, quidproquo_web_react_1.useQpqRuntime)(atom);
27
+ const isCodeValid = /^\d{6}$/.test(state.mfaCode);
28
+ const challenge = (_a = authState.authenticateUserResponse) === null || _a === void 0 ? void 0 : _a.challenge;
29
+ const session = (_b = authState.authenticateUserResponse) === null || _b === void 0 ? void 0 : _b.session;
30
+ // Associate a software token once, using the MFA_SETUP challenge session.
31
+ const hasAssociated = (0, react_1.useRef)(false);
32
+ (0, react_1.useEffect)(() => {
33
+ if (!hasAssociated.current && session) {
34
+ hasAssociated.current = true;
35
+ api.authChallengeAssociateSoftwareToken(session);
36
+ }
37
+ }, [api, session]);
38
+ if (!challenge || !session) {
39
+ return (0, jsx_runtime_1.jsx)("div", { children: "Error, missing challenge / session" });
40
+ }
41
+ return ((0, jsx_runtime_1.jsx)(Box_1.default, { sx: {
42
+ height: '100vh',
43
+ width: '100%',
44
+ p: 2,
45
+ display: 'flex',
46
+ flexDirection: 'column',
47
+ justifyContent: 'center',
48
+ alignItems: 'center',
49
+ }, children: (0, jsx_runtime_1.jsx)(Box_1.default, { component: "form", sx: { width: '100%', maxWidth: 360 }, children: (0, jsx_runtime_1.jsxs)(Grid_1.default, { container: true, spacing: 2, children: [(0, jsx_runtime_1.jsx)(Grid_1.default, { item: true, xs: 12, children: (0, jsx_runtime_1.jsxs)(Typography_1.default, { variant: "h5", gutterBottom: true, sx: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)(Lock_1.default, { sx: { marginRight: 1 } }), "Set Up Authenticator"] }) }), (0, jsx_runtime_1.jsx)(Grid_1.default, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "body2", color: "text.secondary", children: "Add this account to your authenticator app, then enter the 6-digit code it generates." }) }), (0, jsx_runtime_1.jsxs)(Grid_1.default, { item: true, xs: 12, children: [(0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "caption", color: "text.secondary", children: "Secret key" }), (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "body1", sx: { fontFamily: 'monospace', wordBreak: 'break-all' }, children: state.secretCode || 'Loading…' })] }), state.secretCode && ((0, jsx_runtime_1.jsx)(Grid_1.default, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "caption", color: "text.secondary", sx: { wordBreak: 'break-all' }, children: buildOtpAuthUri(authState.username, state.secretCode) }) })), (0, jsx_runtime_1.jsx)(Grid_1.default, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)(TextField_1.default, { required: true, fullWidth: true, id: "mfaCode", label: "Authentication Code", autoFocus: true, inputProps: { inputMode: 'numeric', pattern: '[0-9]*', maxLength: 6 }, value: state.mfaCode, onChange: (event) => api.authChallengeSetMfaSetupCode(event.target.value.replace(/\D/g, '')) }) }), (0, jsx_runtime_1.jsx)(Grid_1.default, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)(components_1.AsyncButton, { onClick: () => api.authChallengeSendMfaSetupCode(challenge, authState.username), disabled: !isCodeValid || !state.secretCode, children: "Verify" }) })] }) }) }));
50
+ }
@@ -0,0 +1 @@
1
+ export * from './AuthChallengeMfaSetup';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./AuthChallengeMfaSetup"), exports);
@@ -0,0 +1,3 @@
1
+ import { AskResponse } from 'quidproquo-core';
2
+ export declare function askAuthChallengeSetMfaSetupCode(mfaCode: string): AskResponse<void>;
3
+ export declare function askAuthChallengeSetMfaSetupAssociation(secretCode: string, session: string): AskResponse<void>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.askAuthChallengeSetMfaSetupCode = askAuthChallengeSetMfaSetupCode;
4
+ exports.askAuthChallengeSetMfaSetupAssociation = askAuthChallengeSetMfaSetupAssociation;
5
+ const quidproquo_core_1 = require("quidproquo-core");
6
+ const authChallengeTypes_1 = require("./authChallengeTypes");
7
+ function* askAuthChallengeSetMfaSetupCode(mfaCode) {
8
+ yield* (0, quidproquo_core_1.askStateDispatchEffect)(authChallengeTypes_1.AuthChallengeMfaSetupEffect.SetMfaCode, mfaCode);
9
+ }
10
+ function* askAuthChallengeSetMfaSetupAssociation(secretCode, session) {
11
+ yield* (0, quidproquo_core_1.askStateDispatchEffect)(authChallengeTypes_1.AuthChallengeMfaSetupEffect.SetAssociation, {
12
+ secretCode,
13
+ session,
14
+ });
15
+ }
@@ -0,0 +1,3 @@
1
+ import { AuthChallengeMfaSetupEffects, AuthChallengeMfaSetupState } from './authChallengeTypes';
2
+ export declare const authChallengeMfaSetupInitalState: AuthChallengeMfaSetupState;
3
+ export declare const authChallengeMfaSetupReducer: (state: AuthChallengeMfaSetupState, effect: AuthChallengeMfaSetupEffects) => [AuthChallengeMfaSetupState, boolean];
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.authChallengeMfaSetupReducer = exports.authChallengeMfaSetupInitalState = void 0;
4
+ const quidproquo_core_1 = require("quidproquo-core");
5
+ const authChallengeTypes_1 = require("./authChallengeTypes");
6
+ exports.authChallengeMfaSetupInitalState = {
7
+ secretCode: '',
8
+ session: '',
9
+ mfaCode: '',
10
+ };
11
+ exports.authChallengeMfaSetupReducer = (0, quidproquo_core_1.buildMutableEffectReducer)({
12
+ [authChallengeTypes_1.AuthChallengeMfaSetupEffect.SetMfaCode]: (state, mfaCode) => {
13
+ state.mfaCode = mfaCode;
14
+ },
15
+ [authChallengeTypes_1.AuthChallengeMfaSetupEffect.SetAssociation]: (state, { secretCode, session }) => {
16
+ state.secretCode = secretCode;
17
+ state.session = session;
18
+ },
19
+ });
@@ -0,0 +1,25 @@
1
+ import { Effect } from 'quidproquo-core';
2
+ export type AuthChallengeMfaSetupState = {
3
+ secretCode: string;
4
+ session: string;
5
+ mfaCode: string;
6
+ };
7
+ export declare enum AuthChallengeMfaSetupEffect {
8
+ SetMfaCode = "authMfaSetup/SetMfaCode",
9
+ SetAssociation = "authMfaSetup/SetAssociation"
10
+ }
11
+ export type AuthChallengeMfaSetupSetMfaCodeEffect = Effect<AuthChallengeMfaSetupEffect.SetMfaCode, string>;
12
+ export type AuthChallengeMfaSetupSetAssociationEffect = Effect<AuthChallengeMfaSetupEffect.SetAssociation, {
13
+ secretCode: string;
14
+ session: string;
15
+ }>;
16
+ export type AuthChallengeMfaSetupEffects = AuthChallengeMfaSetupSetMfaCodeEffect | AuthChallengeMfaSetupSetAssociationEffect;
17
+ export type AuthChallengeAssociateSoftwareTokenPayload = {
18
+ session: string;
19
+ };
20
+ export type AuthChallengeSendMfaSetupCodePayload = {
21
+ email: string;
22
+ session: string;
23
+ challenge: string;
24
+ mfaCode: string;
25
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthChallengeMfaSetupEffect = void 0;
4
+ var AuthChallengeMfaSetupEffect;
5
+ (function (AuthChallengeMfaSetupEffect) {
6
+ AuthChallengeMfaSetupEffect["SetMfaCode"] = "authMfaSetup/SetMfaCode";
7
+ AuthChallengeMfaSetupEffect["SetAssociation"] = "authMfaSetup/SetAssociation";
8
+ })(AuthChallengeMfaSetupEffect || (exports.AuthChallengeMfaSetupEffect = AuthChallengeMfaSetupEffect = {}));
@@ -0,0 +1,4 @@
1
+ export * from './authActionCreator';
2
+ export * from './authChallengeReducer';
3
+ export * from './authChallengeTypes';
4
+ export * from './runtime';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./authActionCreator"), exports);
18
+ __exportStar(require("./authChallengeReducer"), exports);
19
+ __exportStar(require("./authChallengeTypes"), exports);
20
+ __exportStar(require("./runtime"), exports);
@@ -0,0 +1,2 @@
1
+ import { AskResponse } from 'quidproquo-core';
2
+ export declare function askAuthChallengeAssociateSoftwareToken(session: string): AskResponse<void>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.askAuthChallengeAssociateSoftwareToken = askAuthChallengeAssociateSoftwareToken;
4
+ const platformLogic_1 = require("../../../../platformLogic");
5
+ const authActionCreator_1 = require("../authActionCreator");
6
+ // Kicks off TOTP enrollment: trades the MFA_SETUP challenge session for the
7
+ // shared secret (to show as a QR / manual key) and a refreshed session.
8
+ function* askAuthChallengeAssociateSoftwareToken(session) {
9
+ const response = yield* (0, platformLogic_1.askPlatformRequest)('POST', '/associateSoftwareToken', {
10
+ body: {
11
+ session,
12
+ },
13
+ });
14
+ if (response.status < 200 || response.status >= 300) {
15
+ return;
16
+ }
17
+ yield* (0, authActionCreator_1.askAuthChallengeSetMfaSetupAssociation)(response.data.secretCode, response.data.session);
18
+ }
@@ -0,0 +1,2 @@
1
+ import { AskResponse } from 'quidproquo-core';
2
+ export declare function askAuthChallengeSendMfaSetupCode(challenge: string, email: string): AskResponse<void>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.askAuthChallengeSendMfaSetupCode = askAuthChallengeSendMfaSetupCode;
4
+ const quidproquo_core_1 = require("quidproquo-core");
5
+ const platformLogic_1 = require("../../../../platformLogic");
6
+ const logic_1 = require("../../../logic");
7
+ // Completes MFA_SETUP. Sends the first TOTP code together with the refreshed
8
+ // session from the associate step; the server verifies the code and finishes login.
9
+ function* askAuthChallengeSendMfaSetupCode(challenge, email) {
10
+ const { mfaCode, session } = yield* (0, quidproquo_core_1.askStateRead)('');
11
+ const response = yield* (0, platformLogic_1.askPlatformRequest)('POST', '/challenge', {
12
+ body: {
13
+ challenge,
14
+ email,
15
+ mfaCode,
16
+ session,
17
+ },
18
+ });
19
+ if (response.status < 200 || response.status >= 300) {
20
+ return;
21
+ }
22
+ yield* (0, platformLogic_1.askSaveAuthToken)(response.data);
23
+ yield* (0, logic_1.askAuthUISetAuthInfo)(response.data);
24
+ }
@@ -0,0 +1,8 @@
1
+ import { askAuthChallengeSetMfaSetupCode } from '../authActionCreator';
2
+ import { askAuthChallengeAssociateSoftwareToken } from './askAuthChallengeAssociateSoftwareToken';
3
+ import { askAuthChallengeSendMfaSetupCode } from './askAuthChallengeSendMfaSetupCode';
4
+ export declare const authChallengeMfaSetupLogic: {
5
+ askAuthChallengeSetMfaSetupCode: typeof askAuthChallengeSetMfaSetupCode;
6
+ askAuthChallengeAssociateSoftwareToken: typeof askAuthChallengeAssociateSoftwareToken;
7
+ askAuthChallengeSendMfaSetupCode: typeof askAuthChallengeSendMfaSetupCode;
8
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.authChallengeMfaSetupLogic = void 0;
4
+ const authActionCreator_1 = require("../authActionCreator");
5
+ const askAuthChallengeAssociateSoftwareToken_1 = require("./askAuthChallengeAssociateSoftwareToken");
6
+ const askAuthChallengeSendMfaSetupCode_1 = require("./askAuthChallengeSendMfaSetupCode");
7
+ exports.authChallengeMfaSetupLogic = {
8
+ askAuthChallengeSetMfaSetupCode: authActionCreator_1.askAuthChallengeSetMfaSetupCode,
9
+ askAuthChallengeAssociateSoftwareToken: askAuthChallengeAssociateSoftwareToken_1.askAuthChallengeAssociateSoftwareToken,
10
+ askAuthChallengeSendMfaSetupCode: askAuthChallengeSendMfaSetupCode_1.askAuthChallengeSendMfaSetupCode,
11
+ };
@@ -0,0 +1 @@
1
+ export * from './authChallengeLogic';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./authChallengeLogic"), exports);
@@ -2,5 +2,5 @@ import { AuthState } from '../logic';
2
2
  interface AuthChallengeNewPasswordRequiredProps {
3
3
  authState: AuthState;
4
4
  }
5
- export declare function AuthChallengeNewPasswordRequired({ authState }: AuthChallengeNewPasswordRequiredProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function AuthChallengeNewPasswordRequired({ authState }: AuthChallengeNewPasswordRequiredProps): import("react").JSX.Element;
6
6
  export {};
@@ -0,0 +1,6 @@
1
+ import { AuthState } from '../logic';
2
+ interface AuthChallengeSoftwareTokenMfaProps {
3
+ authState: AuthState;
4
+ }
5
+ export declare function AuthChallengeSoftwareTokenMfa({ authState }: AuthChallengeSoftwareTokenMfaProps): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AuthChallengeSoftwareTokenMfa = AuthChallengeSoftwareTokenMfa;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ /* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
9
+ const quidproquo_web_react_1 = require("quidproquo-web-react");
10
+ const Lock_1 = __importDefault(require("@mui/icons-material/Lock"));
11
+ const Box_1 = __importDefault(require("@mui/material/Box"));
12
+ const Grid_1 = __importDefault(require("@mui/material/Grid"));
13
+ const TextField_1 = __importDefault(require("@mui/material/TextField"));
14
+ const Typography_1 = __importDefault(require("@mui/material/Typography"));
15
+ const components_1 = require("../../components");
16
+ const logic_1 = require("./logic");
17
+ const atom = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)(logic_1.authChallengeMfaLogic, logic_1.authChallengeMfaInitalState, logic_1.authChallengeMfaReducer);
18
+ function AuthChallengeSoftwareTokenMfa({ authState }) {
19
+ const [api, state] = (0, quidproquo_web_react_1.useQpqRuntime)(atom);
20
+ const isCodeValid = /^\d{6}$/.test(state.mfaCode);
21
+ if (!authState.authenticateUserResponse || !authState.authenticateUserResponse.challenge || !authState.authenticateUserResponse.session) {
22
+ return (0, jsx_runtime_1.jsx)("div", { children: "Error, missing challenge / session" });
23
+ }
24
+ return ((0, jsx_runtime_1.jsx)(Box_1.default, { sx: {
25
+ height: '100vh',
26
+ width: '100%',
27
+ p: 2,
28
+ display: 'flex',
29
+ flexDirection: 'column',
30
+ justifyContent: 'center',
31
+ alignItems: 'center',
32
+ }, children: (0, jsx_runtime_1.jsx)(Box_1.default, { component: "form", sx: { width: '100%', maxWidth: 360 }, children: (0, jsx_runtime_1.jsxs)(Grid_1.default, { container: true, spacing: 2, children: [(0, jsx_runtime_1.jsx)(Grid_1.default, { item: true, xs: 12, children: (0, jsx_runtime_1.jsxs)(Typography_1.default, { variant: "h5", gutterBottom: true, sx: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)(Lock_1.default, { sx: { marginRight: 1 } }), "Verification Code"] }) }), (0, jsx_runtime_1.jsx)(Grid_1.default, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "body2", color: "text.secondary", children: "Enter the 6-digit code from your authenticator app." }) }), (0, jsx_runtime_1.jsx)(Grid_1.default, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)(TextField_1.default, { required: true, fullWidth: true, id: "mfaCode", label: "Authentication Code", autoFocus: true, inputProps: { inputMode: 'numeric', pattern: '[0-9]*', maxLength: 6 }, value: state.mfaCode, onChange: (event) => api.authChallengeSetMfaCode(event.target.value.replace(/\D/g, '')) }) }), (0, jsx_runtime_1.jsx)(Grid_1.default, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)(components_1.AsyncButton, { onClick: () => {
33
+ var _a, _b;
34
+ return api.authChallengeSendMfaCode((_a = authState.authenticateUserResponse) === null || _a === void 0 ? void 0 : _a.challenge, (_b = authState.authenticateUserResponse) === null || _b === void 0 ? void 0 : _b.session, authState.username);
35
+ }, disabled: !isCodeValid, children: "Verify" }) })] }) }) }));
36
+ }
@@ -0,0 +1 @@
1
+ export * from './AuthChallengeSoftwareTokenMfa';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./AuthChallengeSoftwareTokenMfa"), exports);
@@ -0,0 +1,2 @@
1
+ import { AskResponse } from 'quidproquo-core';
2
+ export declare function askAuthChallengeSetMfaCode(mfaCode: string): AskResponse<void>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.askAuthChallengeSetMfaCode = askAuthChallengeSetMfaCode;
4
+ const quidproquo_core_1 = require("quidproquo-core");
5
+ const authChallengeTypes_1 = require("./authChallengeTypes");
6
+ function* askAuthChallengeSetMfaCode(mfaCode) {
7
+ yield* (0, quidproquo_core_1.askStateDispatchEffect)(authChallengeTypes_1.AuthChallengeMfaEffect.SetMfaCode, mfaCode);
8
+ }
@@ -0,0 +1,3 @@
1
+ import { AuthChallengeMfaState } from './authChallengeTypes';
2
+ export declare const authChallengeMfaInitalState: AuthChallengeMfaState;
3
+ export declare const authChallengeMfaReducer: (state: AuthChallengeMfaState, effect: import("./authChallengeTypes").AuthChallengeSetMfaCodeEffect) => [AuthChallengeMfaState, boolean];
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.authChallengeMfaReducer = exports.authChallengeMfaInitalState = void 0;
4
+ const quidproquo_core_1 = require("quidproquo-core");
5
+ const authChallengeTypes_1 = require("./authChallengeTypes");
6
+ exports.authChallengeMfaInitalState = {
7
+ mfaCode: '',
8
+ };
9
+ exports.authChallengeMfaReducer = (0, quidproquo_core_1.buildMutableEffectReducer)({
10
+ [authChallengeTypes_1.AuthChallengeMfaEffect.SetMfaCode]: (state, mfaCode) => {
11
+ state.mfaCode = mfaCode;
12
+ },
13
+ });
@@ -0,0 +1,15 @@
1
+ import { Effect } from 'quidproquo-core';
2
+ export type AuthChallengeMfaState = {
3
+ mfaCode: string;
4
+ };
5
+ export declare enum AuthChallengeMfaEffect {
6
+ SetMfaCode = "authMfa/SetMfaCode"
7
+ }
8
+ export type AuthChallengeSetMfaCodeEffect = Effect<AuthChallengeMfaEffect.SetMfaCode, string>;
9
+ export type AuthChallengeMfaEffects = AuthChallengeSetMfaCodeEffect;
10
+ export type AuthChallengeSendMfaCodePayload = {
11
+ email: string;
12
+ session: string;
13
+ challenge: string;
14
+ mfaCode: string;
15
+ };