quidproquo-web-admin 0.1.12 → 0.1.14

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 (65) hide show
  1. package/lib/commonjs/App/App.js +4 -1
  2. package/lib/commonjs/App/App.js.map +1 -1
  3. package/lib/commonjs/Auth/Auth.js +1 -2
  4. package/lib/commonjs/Auth/Auth.js.map +1 -1
  5. package/lib/commonjs/Auth/AuthChallengeMfaSetup/AuthChallengeMfaSetup.js +7 -2
  6. package/lib/commonjs/Auth/AuthChallengeMfaSetup/AuthChallengeMfaSetup.js.map +1 -1
  7. package/lib/commonjs/Auth/AuthChallengeNewPasswordRequired/AuthChallengeNewPasswordRequired.js +7 -2
  8. package/lib/commonjs/Auth/AuthChallengeNewPasswordRequired/AuthChallengeNewPasswordRequired.js.map +1 -1
  9. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa.js +7 -2
  10. package/lib/commonjs/Auth/AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa.js.map +1 -1
  11. package/lib/commonjs/Auth/logic/authRuntime.d.ts +2 -1
  12. package/lib/commonjs/Auth/logic/authRuntime.js +8 -1
  13. package/lib/commonjs/Auth/logic/authRuntime.js.map +1 -1
  14. package/lib/commonjs/LogViewer/LogChat/LogChat.js +1 -2
  15. package/lib/commonjs/LogViewer/LogChat/LogChat.js.map +1 -1
  16. package/lib/commonjs/LogViewer/LogChat/eventDocAiLogChatRuntime.js +11 -3
  17. package/lib/commonjs/LogViewer/LogChat/eventDocAiLogChatRuntime.js.map +1 -1
  18. package/lib/commonjs/adminApp/actions/askApplySessionEventToLog.js +3 -1
  19. package/lib/commonjs/adminApp/actions/askApplySessionEventToLog.js.map +1 -1
  20. package/lib/commonjs/adminApp/adminAppRuntime.js +13 -1
  21. package/lib/commonjs/adminApp/adminAppRuntime.js.map +1 -1
  22. package/lib/commonjs/adminApp/components/AdminAppProvider/AdminAppProvider.js +5 -10
  23. package/lib/commonjs/adminApp/components/AdminAppProvider/AdminAppProvider.js.map +1 -1
  24. package/lib/commonjs/adminApp/hooks/useAdminApp.d.ts +1 -1
  25. package/lib/commonjs/adminApp/hooks/useAdminApp.js +3 -4
  26. package/lib/commonjs/adminApp/hooks/useAdminApp.js.map +1 -1
  27. package/lib/commonjs/adminApp/stateUpdaters/sessionLog/eventAppended.js +7 -8
  28. package/lib/commonjs/adminApp/stateUpdaters/sessionLog/eventAppended.js.map +1 -1
  29. package/lib/commonjs/adminApp/stateUpdaters/sessionLog/eventSaved.js +3 -2
  30. package/lib/commonjs/adminApp/stateUpdaters/sessionLog/eventSaved.js.map +1 -1
  31. package/lib/commonjs/adminApp/testHelpers/makeSessionEvent.js +2 -1
  32. package/lib/commonjs/adminApp/testHelpers/makeSessionEvent.js.map +1 -1
  33. package/lib/esm/App/App.js +5 -2
  34. package/lib/esm/App/App.js.map +1 -1
  35. package/lib/esm/Auth/Auth.js +1 -2
  36. package/lib/esm/Auth/Auth.js.map +1 -1
  37. package/lib/esm/Auth/AuthChallengeMfaSetup/AuthChallengeMfaSetup.js +7 -2
  38. package/lib/esm/Auth/AuthChallengeMfaSetup/AuthChallengeMfaSetup.js.map +1 -1
  39. package/lib/esm/Auth/AuthChallengeNewPasswordRequired/AuthChallengeNewPasswordRequired.js +7 -2
  40. package/lib/esm/Auth/AuthChallengeNewPasswordRequired/AuthChallengeNewPasswordRequired.js.map +1 -1
  41. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa.js +7 -2
  42. package/lib/esm/Auth/AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa.js.map +1 -1
  43. package/lib/esm/Auth/logic/authRuntime.d.ts +2 -1
  44. package/lib/esm/Auth/logic/authRuntime.js +8 -1
  45. package/lib/esm/Auth/logic/authRuntime.js.map +1 -1
  46. package/lib/esm/LogViewer/LogChat/LogChat.js +1 -2
  47. package/lib/esm/LogViewer/LogChat/LogChat.js.map +1 -1
  48. package/lib/esm/LogViewer/LogChat/eventDocAiLogChatRuntime.js +11 -3
  49. package/lib/esm/LogViewer/LogChat/eventDocAiLogChatRuntime.js.map +1 -1
  50. package/lib/esm/adminApp/actions/askApplySessionEventToLog.js +4 -2
  51. package/lib/esm/adminApp/actions/askApplySessionEventToLog.js.map +1 -1
  52. package/lib/esm/adminApp/adminAppRuntime.js +13 -1
  53. package/lib/esm/adminApp/adminAppRuntime.js.map +1 -1
  54. package/lib/esm/adminApp/components/AdminAppProvider/AdminAppProvider.js +6 -11
  55. package/lib/esm/adminApp/components/AdminAppProvider/AdminAppProvider.js.map +1 -1
  56. package/lib/esm/adminApp/hooks/useAdminApp.d.ts +1 -1
  57. package/lib/esm/adminApp/hooks/useAdminApp.js +3 -4
  58. package/lib/esm/adminApp/hooks/useAdminApp.js.map +1 -1
  59. package/lib/esm/adminApp/stateUpdaters/sessionLog/eventAppended.js +6 -13
  60. package/lib/esm/adminApp/stateUpdaters/sessionLog/eventAppended.js.map +1 -1
  61. package/lib/esm/adminApp/stateUpdaters/sessionLog/eventSaved.js +3 -8
  62. package/lib/esm/adminApp/stateUpdaters/sessionLog/eventSaved.js.map +1 -1
  63. package/lib/esm/adminApp/testHelpers/makeSessionEvent.js +2 -1
  64. package/lib/esm/adminApp/testHelpers/makeSessionEvent.js.map +1 -1
  65. package/package.json +7 -7
@@ -21,12 +21,15 @@ const darkTheme = (0, styles_1.createTheme)({
21
21
  mode: 'light',
22
22
  },
23
23
  });
24
+ // Owned here (not by the provider) so the Redux DevTools bridge wires up once
25
+ // at module load; the extension shows the whole admin state as one object.
26
+ const adminQpqStore = (0, quidproquo_web_react_1.createQpqStore)({ devToolsName: 'qpq-admin' });
24
27
  const App = ({ urlResolvers, loadAddons }) => {
25
28
  const baseUrls = (0, react_1.useMemo)(() => ({
26
29
  api: urlResolvers.getApiUrl(),
27
30
  ws: urlResolvers.getWsUrl(),
28
31
  }), [urlResolvers]);
29
- return ((0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqContextProvider, { contextIdentifier: contexts_1.baseUrlsContext, value: baseUrls, 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)(adminApp_1.AdminAppProvider, { 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, {}) }) }) }) }) }) })] }) }) }));
32
+ return ((0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqStoreProvider, { store: adminQpqStore, children: (0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqContextProvider, { contextIdentifier: contexts_1.baseUrlsContext, value: baseUrls, 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)(adminApp_1.AdminAppProvider, { 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, {}) }) }) }) }) }) })] }) }) }) }));
30
33
  };
31
34
  exports.App = App;
32
35
  //# sourceMappingURL=App.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"App.js","sourceRoot":"","sources":["../../../src/App/App.tsx"],"names":[],"mappings":";;;;;;;AAAA,+DAAgH;AAEhH,iCAAuC;AACvC,4EAAoD;AACpD,iDAAkE;AAElE,0CAA+C;AAC/C,uCAAoC;AACpC,8CAA2C;AAE3C,sEAAmE;AACnE,wDAAsE;AACtE,kCAA0C;AAC1C,oEAAiE;AAEjE,MAAM,SAAS,GAAG,IAAA,oBAAW,EAAC;IAC5B,OAAO,EAAE;QACP,IAAI,EAAE,OAAO;KACd;CACF,CAAC,CAAC;AAUI,MAAM,GAAG,GAAuB,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE;IACtE,MAAM,QAAQ,GAAa,IAAA,eAAO,EAChC,GAAG,EAAE,CAAC,CAAC;QACL,GAAG,EAAE,YAAY,CAAC,SAAS,EAAE;QAC7B,EAAE,EAAE,YAAY,CAAC,QAAQ,EAAE;KAC5B,CAAC,EACF,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,OAAO,CACL,uBAAC,yCAAkB,IAAC,iBAAiB,EAAE,0BAAe,EAAE,KAAK,EAAE,QAAQ,YACrE,uBAAC,sCAAe,IAAC,YAAY,EAAE,YAAY,YACzC,wBAAC,sBAAa,IAAC,KAAK,EAAE,SAAS,aAC7B,uBAAC,qBAAW,KAAG,EACf,uBAAC,sBAAe,cACd,uBAAC,WAAI,cACH,uBAAC,2BAAgB,cACf,uBAAC,wCAAiB,IAAC,KAAK,EAAE,YAAY,CAAC,QAAQ,EAAE,YAC/C,uBAAC,6CAAqB,cACpB,uBAAC,+CAAsB,IAAC,UAAU,EAAE,UAAU,YAC5C,uBAAC,uBAAU,KAAG,GACS,GACH,GACN,GACH,GACd,GACS,IACJ,GACA,GACC,CACtB,CAAC;AACJ,CAAC,CAAC;AA/BW,QAAA,GAAG,OA+Bd","sourcesContent":["import { BaseUrlProvider, BaseUrlResolvers, QpqContextProvider, WebsocketProvider } from 'quidproquo-web-react';\n\nimport React, { useMemo } from 'react';\nimport CssBaseline from '@mui/material/CssBaseline';\nimport { createTheme, ThemeProvider } from '@mui/material/styles';\n\nimport { AdminAppProvider } from '../adminApp';\nimport { Auth } from '../Auth/Auth';\nimport { MainLayout } from '../components';\nimport { LoadFederatedAddons } from '../FederatedAddon';\nimport { FederatedAddonProvider } from '../FederatedAddonProvider';\nimport { BaseUrls, baseUrlsContext } from '../platformLogic/contexts';\nimport { LoadingProvider } from '../view';\nimport { WebSocketAuthProvider } from '../WebSocketAuthProvider';\n\nconst darkTheme = createTheme({\n palette: {\n mode: 'light',\n },\n});\n\nexport type AppProps = {\n urlResolvers: BaseUrlResolvers;\n\n // Optional hook for the host application to federate / load admin addons.\n // When omitted, no addons are loaded.\n loadAddons?: LoadFederatedAddons;\n};\n\nexport const App: React.FC<AppProps> = ({ urlResolvers, loadAddons }) => {\n const baseUrls: BaseUrls = useMemo(\n () => ({\n api: urlResolvers.getApiUrl(),\n ws: urlResolvers.getWsUrl(),\n }),\n [urlResolvers],\n );\n\n return (\n <QpqContextProvider contextIdentifier={baseUrlsContext} value={baseUrls}>\n <BaseUrlProvider urlResolvers={urlResolvers}>\n <ThemeProvider theme={darkTheme}>\n <CssBaseline />\n <LoadingProvider>\n <Auth>\n <AdminAppProvider>\n <WebsocketProvider wsUrl={urlResolvers.getWsUrl()}>\n <WebSocketAuthProvider>\n <FederatedAddonProvider loadAddons={loadAddons}>\n <MainLayout />\n </FederatedAddonProvider>\n </WebSocketAuthProvider>\n </WebsocketProvider>\n </AdminAppProvider>\n </Auth>\n </LoadingProvider>\n </ThemeProvider>\n </BaseUrlProvider>\n </QpqContextProvider>\n );\n};\n"]}
1
+ {"version":3,"file":"App.js","sourceRoot":"","sources":["../../../src/App/App.ts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C;AAjCW,QAAA,GAAG,OAiCd","sourcesContent":["import { BaseUrlProvider, BaseUrlResolvers, createQpqStore, QpqContextProvider, QpqStoreProvider, WebsocketProvider } from 'quidproquo-web-react';\n\nimport React, { useMemo } from 'react';\nimport CssBaseline from '@mui/material/CssBaseline';\nimport { createTheme, ThemeProvider } from '@mui/material/styles';\n\nimport { AdminAppProvider } from '../adminApp';\nimport { Auth } from '../Auth/Auth';\nimport { MainLayout } from '../components';\nimport { LoadFederatedAddons } from '../FederatedAddon';\nimport { FederatedAddonProvider } from '../FederatedAddonProvider';\nimport { BaseUrls, baseUrlsContext } from '../platformLogic/contexts';\nimport { LoadingProvider } from '../view';\nimport { WebSocketAuthProvider } from '../WebSocketAuthProvider';\n\nconst darkTheme = createTheme({\n palette: {\n mode: 'light',\n },\n});\n\n// Owned here (not by the provider) so the Redux DevTools bridge wires up once\n// at module load; the extension shows the whole admin state as one object.\nconst adminQpqStore = createQpqStore({ devToolsName: 'qpq-admin' });\n\nexport type AppProps = {\n urlResolvers: BaseUrlResolvers;\n\n // Optional hook for the host application to federate / load admin addons.\n // When omitted, no addons are loaded.\n loadAddons?: LoadFederatedAddons;\n};\n\nexport const App: React.FC<AppProps> = ({ urlResolvers, loadAddons }) => {\n const baseUrls: BaseUrls = useMemo(\n () => ({\n api: urlResolvers.getApiUrl(),\n ws: urlResolvers.getWsUrl(),\n }),\n [urlResolvers],\n );\n\n return (\n <QpqStoreProvider store={adminQpqStore}>\n <QpqContextProvider contextIdentifier={baseUrlsContext} value={baseUrls}>\n <BaseUrlProvider urlResolvers={urlResolvers}>\n <ThemeProvider theme={darkTheme}>\n <CssBaseline />\n <LoadingProvider>\n <Auth>\n <AdminAppProvider>\n <WebsocketProvider wsUrl={urlResolvers.getWsUrl()}>\n <WebSocketAuthProvider>\n <FederatedAddonProvider loadAddons={loadAddons}>\n <MainLayout />\n </FederatedAddonProvider>\n </WebSocketAuthProvider>\n </WebsocketProvider>\n </AdminAppProvider>\n </Auth>\n </LoadingProvider>\n </ThemeProvider>\n </BaseUrlProvider>\n </QpqContextProvider>\n </QpqStoreProvider>\n );\n};\n"]}
@@ -8,12 +8,11 @@ const AuthChallengeMfaSetup_1 = require("./AuthChallengeMfaSetup/AuthChallengeMf
8
8
  const AuthChallengeNewPasswordRequired_1 = require("./AuthChallengeNewPasswordRequired/AuthChallengeNewPasswordRequired");
9
9
  const AuthChallengeSoftwareTokenMfa_1 = require("./AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa");
10
10
  const isLoggedOn_1 = require("./logic/isLoggedOn");
11
- const askAuthMain_1 = require("./logic/runtime/askAuthMain");
12
11
  const logic_1 = require("./logic");
13
12
  const Login_1 = require("./Login");
14
13
  function Auth({ children }) {
15
14
  var _a, _b, _c, _d, _e, _f;
16
- const [api, state, dispatch] = (0, quidproquo_web_react_1.useQpqRuntime)(logic_1.authRuntime, askAuthMain_1.askAuthMain);
15
+ const [api, state] = (0, quidproquo_web_react_1.useQpqRuntime)(logic_1.authRuntime);
17
16
  const isAuthenticated = (0, isLoggedOn_1.isLoggedOn)(state);
18
17
  if (((_a = state.authenticateUserResponse) === null || _a === void 0 ? void 0 : _a.challenge) === quidproquo_core_1.AuthenticateUserChallenge.NEW_PASSWORD_REQUIRED) {
19
18
  return ((0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqRuntimeEffectCatcher, { runtime: logic_1.authRuntime, children: (0, jsx_runtime_1.jsx)(AuthChallengeNewPasswordRequired_1.AuthChallengeNewPasswordRequired, { authState: state }) }));
@@ -1 +1 @@
1
- {"version":3,"file":"Auth.js","sourceRoot":"","sources":["../../../src/Auth/Auth.tsx"],"names":[],"mappings":";;AAiBA,oBAuDC;;AAxED,qDAA4D;AAC5D,+DAA2F;AAI3F,yFAAsF;AACtF,0HAAuH;AACvH,iHAA8G;AAC9G,mDAAgD;AAChD,6DAA0D;AAC1D,mCAAsC;AACtC,mCAAgC;AAMhC,SAAgB,IAAI,CAAC,EAAE,QAAQ,EAAa;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C,kCAAW,CAAC,QAAQ,IACnB,KAAK,EAAE;oBACL,SAAS,EAAE,MAAA,KAAK,CAAC,wBAAwB,0CAAE,SAAS;oBACpD,OAAO,EAAE,MAAA,KAAK,CAAC,wBAAwB,0CAAE,OAAO;oBAChD,QAAQ,EAAE,KAAK,CAAC,QAAQ;oBACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;oBACxB,kBAAkB,EAAE,MAAA,KAAK,CAAC,wBAAwB,0CAAE,kBAAkB;iBACvE,YAEA,QAAQ,GACY,CACxB,IACuB,CAC3B,CAAC;AACJ,CAAC","sourcesContent":["import { AuthenticateUserChallenge } from 'quidproquo-core';\nimport { authContext, QpqRuntimeEffectCatcher, useQpqRuntime } from 'quidproquo-web-react';\n\nimport { ReactNode, useEffect } from 'react';\n\nimport { AuthChallengeMfaSetup } from './AuthChallengeMfaSetup/AuthChallengeMfaSetup';\nimport { AuthChallengeNewPasswordRequired } from './AuthChallengeNewPasswordRequired/AuthChallengeNewPasswordRequired';\nimport { AuthChallengeSoftwareTokenMfa } from './AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa';\nimport { isLoggedOn } from './logic/isLoggedOn';\nimport { askAuthMain } from './logic/runtime/askAuthMain';\nimport { authRuntime } from './logic';\nimport { Login } from './Login';\n\ninterface AuthProps {\n children?: ReactNode;\n}\n\nexport function Auth({ children }: AuthProps) {\n const [api, state, dispatch] = useQpqRuntime(authRuntime, askAuthMain);\n\n const isAuthenticated = isLoggedOn(state);\n\n if (state.authenticateUserResponse?.challenge === AuthenticateUserChallenge.NEW_PASSWORD_REQUIRED) {\n return (\n <QpqRuntimeEffectCatcher runtime={authRuntime}>\n <AuthChallengeNewPasswordRequired authState={state}></AuthChallengeNewPasswordRequired>\n </QpqRuntimeEffectCatcher>\n );\n }\n\n if (state.authenticateUserResponse?.challenge === AuthenticateUserChallenge.SOFTWARE_TOKEN_MFA) {\n return (\n <QpqRuntimeEffectCatcher runtime={authRuntime}>\n <AuthChallengeSoftwareTokenMfa authState={state}></AuthChallengeSoftwareTokenMfa>\n </QpqRuntimeEffectCatcher>\n );\n }\n\n if (state.authenticateUserResponse?.challenge === AuthenticateUserChallenge.MFA_SETUP) {\n return (\n <QpqRuntimeEffectCatcher runtime={authRuntime}>\n <AuthChallengeMfaSetup authState={state}></AuthChallengeMfaSetup>\n </QpqRuntimeEffectCatcher>\n );\n }\n\n return (\n <QpqRuntimeEffectCatcher runtime={authRuntime}>\n {!isAuthenticated && (\n <Login\n onLogin={api.authLogin}\n password={state.password}\n setPassword={api.authUISetPassword}\n setUsername={api.authUISetUsername}\n username={state.username}\n />\n )}\n {isAuthenticated && (\n <authContext.Provider\n value={{\n challenge: state.authenticateUserResponse?.challenge,\n session: state.authenticateUserResponse?.session,\n username: state.username,\n password: state.password,\n authenticationInfo: state.authenticateUserResponse?.authenticationInfo,\n }}\n >\n {children}\n </authContext.Provider>\n )}\n </QpqRuntimeEffectCatcher>\n );\n}\n"]}
1
+ {"version":3,"file":"Auth.js","sourceRoot":"","sources":["../../../src/Auth/Auth.tsx"],"names":[],"mappings":";;AAgBA,oBAuDC;;AAvED,qDAA4D;AAC5D,+DAA2F;AAI3F,yFAAsF;AACtF,0HAAuH;AACvH,iHAA8G;AAC9G,mDAAgD;AAChD,mCAAsC;AACtC,mCAAgC;AAMhC,SAAgB,IAAI,CAAC,EAAE,QAAQ,EAAa;;IAC1C,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAAA,oCAAa,EAAC,mBAAW,CAAC,CAAC;IAEhD,MAAM,eAAe,GAAG,IAAA,uBAAU,EAAC,KAAK,CAAC,CAAC;IAE1C,IAAI,CAAA,MAAA,KAAK,CAAC,wBAAwB,0CAAE,SAAS,MAAK,2CAAyB,CAAC,qBAAqB,EAAE,CAAC;QAClG,OAAO,CACL,uBAAC,8CAAuB,IAAC,OAAO,EAAE,mBAAW,YAC3C,uBAAC,mEAAgC,IAAC,SAAS,EAAE,KAAK,GAAqC,GAC/D,CAC3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core';\nimport { authContext, QpqRuntimeEffectCatcher, useQpqRuntime } from 'quidproquo-web-react';\n\nimport { ReactNode } from 'react';\n\nimport { AuthChallengeMfaSetup } from './AuthChallengeMfaSetup/AuthChallengeMfaSetup';\nimport { AuthChallengeNewPasswordRequired } from './AuthChallengeNewPasswordRequired/AuthChallengeNewPasswordRequired';\nimport { AuthChallengeSoftwareTokenMfa } from './AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa';\nimport { isLoggedOn } from './logic/isLoggedOn';\nimport { authRuntime } from './logic';\nimport { Login } from './Login';\n\ninterface AuthProps {\n children?: ReactNode;\n}\n\nexport function Auth({ children }: AuthProps) {\n const [api, state] = useQpqRuntime(authRuntime);\n\n const isAuthenticated = isLoggedOn(state);\n\n if (state.authenticateUserResponse?.challenge === AuthenticateUserChallenge.NEW_PASSWORD_REQUIRED) {\n return (\n <QpqRuntimeEffectCatcher runtime={authRuntime}>\n <AuthChallengeNewPasswordRequired authState={state}></AuthChallengeNewPasswordRequired>\n </QpqRuntimeEffectCatcher>\n );\n }\n\n if (state.authenticateUserResponse?.challenge === AuthenticateUserChallenge.SOFTWARE_TOKEN_MFA) {\n return (\n <QpqRuntimeEffectCatcher runtime={authRuntime}>\n <AuthChallengeSoftwareTokenMfa authState={state}></AuthChallengeSoftwareTokenMfa>\n </QpqRuntimeEffectCatcher>\n );\n }\n\n if (state.authenticateUserResponse?.challenge === AuthenticateUserChallenge.MFA_SETUP) {\n return (\n <QpqRuntimeEffectCatcher runtime={authRuntime}>\n <AuthChallengeMfaSetup authState={state}></AuthChallengeMfaSetup>\n </QpqRuntimeEffectCatcher>\n );\n }\n\n return (\n <QpqRuntimeEffectCatcher runtime={authRuntime}>\n {!isAuthenticated && (\n <Login\n onLogin={api.authLogin}\n password={state.password}\n setPassword={api.authUISetPassword}\n setUsername={api.authUISetUsername}\n username={state.username}\n />\n )}\n {isAuthenticated && (\n <authContext.Provider\n value={{\n challenge: state.authenticateUserResponse?.challenge,\n session: state.authenticateUserResponse?.session,\n username: state.username,\n password: state.password,\n authenticationInfo: state.authenticateUserResponse?.authenticationInfo,\n }}\n >\n {children}\n </authContext.Provider>\n )}\n </QpqRuntimeEffectCatcher>\n );\n}\n"]}
@@ -14,7 +14,12 @@ const TextField_1 = __importDefault(require("@mui/material/TextField"));
14
14
  const Typography_1 = __importDefault(require("@mui/material/Typography"));
15
15
  const components_1 = require("../../components");
16
16
  const logic_1 = require("./logic");
17
- const atom = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)(logic_1.authChallengeMfaSetupLogic, logic_1.authChallengeMfaSetupInitalState, logic_1.authChallengeMfaSetupReducer);
17
+ const challengeRuntime = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)({
18
+ uniqueName: 'qpq/admin/authChallengeMfaSetup',
19
+ api: logic_1.authChallengeMfaSetupLogic,
20
+ initialState: logic_1.authChallengeMfaSetupInitalState,
21
+ reducer: logic_1.authChallengeMfaSetupReducer,
22
+ });
18
23
  // otpauth:// URI consumed by authenticator apps when scanning / importing.
19
24
  const buildOtpAuthUri = (email, secretCode) => {
20
25
  const issuer = window.location.host;
@@ -23,7 +28,7 @@ const buildOtpAuthUri = (email, secretCode) => {
23
28
  };
24
29
  function AuthChallengeMfaSetup({ authState }) {
25
30
  var _a, _b;
26
- const [api, state] = (0, quidproquo_web_react_1.useQpqRuntime)(atom);
31
+ const [api, state] = (0, quidproquo_web_react_1.useQpqRuntime)(challengeRuntime);
27
32
  const isCodeValid = /^\d{6}$/.test(state.mfaCode);
28
33
  const challenge = (_a = authState.authenticateUserResponse) === null || _a === void 0 ? void 0 : _a.challenge;
29
34
  const session = (_b = authState.authenticateUserResponse) === null || _b === void 0 ? void 0 : _b.session;
@@ -1 +1 @@
1
- {"version":3,"file":"AuthChallengeMfaSetup.js","sourceRoot":"","sources":["../../../../src/Auth/AuthChallengeMfaSetup/AuthChallengeMfaSetup.tsx"],"names":[],"mappings":";;;;;AA0BA,sDAoFC;;AA9GD,+DAAiF;AAE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,IAAI,QAAC,EAAE,EAAE,EAAE,YACf,uBAAC,oBAAU,IAAC,KAAK,EAAC,gBAAgB,EAAC,EAAE,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,OAAO,EAAC,SAAS,YACjF,eAAe,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,GAC3C,GACR,CACR,EACD,uBAAC,cAAI,IAAC,IAAI,QAAC,EAAE,EAAE,EAAE,YACf,uBAAC,mBAAS,IACR,SAAS,QACT,SAAS,QACT,EAAE,EAAC,SAAS,EACZ,UAAU,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,EACrE,KAAK,EAAC,qBAAqB,EAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,4BAA4B,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAC5F,QAAQ,QACR,KAAK,EAAE,KAAK,CAAC,OAAO,GACpB,GACG,EACP,uBAAC,cAAI,IAAC,IAAI,QAAC,EAAE,EAAE,EAAE,YACf,uBAAC,wBAAW,IACV,QAAQ,EAAE,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,UAAU,EAC3C,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,uBAGnE,GACT,IACF,GACH,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { createQpqRuntimeDefinition, useQpqRuntime } from 'quidproquo-web-react';\n\nimport { useEffect, useRef } from 'react';\nimport LockIcon from '@mui/icons-material/Lock';\nimport Box from '@mui/material/Box';\nimport Grid from '@mui/material/Grid';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { AsyncButton } from '../../components';\nimport { AuthState } from '../logic';\nimport { authChallengeMfaSetupInitalState, authChallengeMfaSetupLogic, authChallengeMfaSetupReducer } from './logic';\n\ninterface AuthChallengeMfaSetupProps {\n authState: AuthState;\n}\n\nconst atom = createQpqRuntimeDefinition(authChallengeMfaSetupLogic, authChallengeMfaSetupInitalState, authChallengeMfaSetupReducer);\n\n// otpauth:// URI consumed by authenticator apps when scanning / importing.\nconst buildOtpAuthUri = (email: string, secretCode: string): string => {\n const issuer = window.location.host;\n const label = encodeURIComponent(`${issuer}:${email}`);\n return `otpauth://totp/${label}?secret=${secretCode}&issuer=${encodeURIComponent(issuer)}`;\n};\n\nexport function AuthChallengeMfaSetup({ authState }: AuthChallengeMfaSetupProps) {\n const [api, state] = useQpqRuntime(atom);\n const isCodeValid = /^\\d{6}$/.test(state.mfaCode);\n\n const challenge = authState.authenticateUserResponse?.challenge;\n const session = authState.authenticateUserResponse?.session;\n\n // Associate a software token once, using the MFA_SETUP challenge session.\n const hasAssociated = useRef(false);\n useEffect(() => {\n if (!hasAssociated.current && session) {\n hasAssociated.current = true;\n api.authChallengeAssociateSoftwareToken(session);\n }\n }, [api, session]);\n\n if (!challenge || !session) {\n return <div>Error, missing challenge / session</div>;\n }\n\n return (\n <Box\n sx={{\n height: '100vh',\n width: '100%',\n p: 2,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Box component=\"form\" sx={{ width: '100%', maxWidth: 360 }}>\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography gutterBottom sx={{ display: 'flex', alignItems: 'center' }} variant=\"h5\">\n <LockIcon sx={{ marginRight: 1 }} />\n Set Up Authenticator\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography color=\"text.secondary\" variant=\"body2\">\n Add this account to your authenticator app, then enter the 6-digit code it generates.\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography color=\"text.secondary\" variant=\"caption\">\n Secret key\n </Typography>\n <Typography sx={{ fontFamily: 'monospace', wordBreak: 'break-all' }} variant=\"body1\">\n {state.secretCode || 'Loading…'}\n </Typography>\n </Grid>\n {state.secretCode && (\n <Grid item xs={12}>\n <Typography color=\"text.secondary\" sx={{ wordBreak: 'break-all' }} variant=\"caption\">\n {buildOtpAuthUri(authState.username, state.secretCode)}\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n <TextField\n autoFocus\n fullWidth\n id=\"mfaCode\"\n inputProps={{ inputMode: 'numeric', pattern: '[0-9]*', maxLength: 6 }}\n label=\"Authentication Code\"\n onChange={(event) => api.authChallengeSetMfaSetupCode(event.target.value.replace(/\\D/g, ''))}\n required\n value={state.mfaCode}\n />\n </Grid>\n <Grid item xs={12}>\n <AsyncButton\n disabled={!isCodeValid || !state.secretCode}\n onClick={() => api.authChallengeSendMfaSetupCode(challenge, authState.username)}\n >\n Verify\n </AsyncButton>\n </Grid>\n </Grid>\n </Box>\n </Box>\n );\n}\n"]}
1
+ {"version":3,"file":"AuthChallengeMfaSetup.js","sourceRoot":"","sources":["../../../../src/Auth/AuthChallengeMfaSetup/AuthChallengeMfaSetup.tsx"],"names":[],"mappings":";;;;;AA+BA,sDAoFC;;AAnHD,+DAAiF;AAEjF,iCAA0C;AAC1C,oEAAgD;AAChD,4DAAoC;AACpC,8DAAsC;AACtC,wEAAgD;AAChD,0EAAkD;AAElD,iDAA+C;AAE/C,mCAAqH;AAMrH,MAAM,gBAAgB,GAAG,IAAA,iDAA0B,EAAC;IAClD,UAAU,EAAE,iCAAiC;IAC7C,GAAG,EAAE,kCAA0B;IAC/B,YAAY,EAAE,wCAAgC;IAC9C,OAAO,EAAE,oCAA4B;CACtC,CAAC,CAAC;AAEH,2EAA2E;AAC3E,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,UAAkB,EAAU,EAAE;IACpE,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IACpC,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC;IACvD,OAAO,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C,EAAE,EACrE,KAAK,EAAC,qBAAqB,EAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,4BAA4B,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAC5F,QAAQ,QACR,KAAK,EAAE,KAAK,CAAC,OAAO,GACpB,GACG,EACP,uBAAC,cAAI,IAAC,IAAI,QAAC,EAAE,EAAE,EAAE,YACf,uBAAC,wBAAW,IACV,QAAQ,EAAE,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,UAAU,EAC3C,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,uBAGnE,GACT,IACF,GACH,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { createQpqRuntimeDefinition, useQpqRuntime } from 'quidproquo-web-react';\n\nimport { useEffect, useRef } from 'react';\nimport LockIcon from '@mui/icons-material/Lock';\nimport Box from '@mui/material/Box';\nimport Grid from '@mui/material/Grid';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { AsyncButton } from '../../components';\nimport { AuthState } from '../logic';\nimport { authChallengeMfaSetupInitalState, authChallengeMfaSetupLogic, authChallengeMfaSetupReducer } from './logic';\n\ninterface AuthChallengeMfaSetupProps {\n authState: AuthState;\n}\n\nconst challengeRuntime = createQpqRuntimeDefinition({\n uniqueName: 'qpq/admin/authChallengeMfaSetup',\n api: authChallengeMfaSetupLogic,\n initialState: authChallengeMfaSetupInitalState,\n reducer: authChallengeMfaSetupReducer,\n});\n\n// otpauth:// URI consumed by authenticator apps when scanning / importing.\nconst buildOtpAuthUri = (email: string, secretCode: string): string => {\n const issuer = window.location.host;\n const label = encodeURIComponent(`${issuer}:${email}`);\n return `otpauth://totp/${label}?secret=${secretCode}&issuer=${encodeURIComponent(issuer)}`;\n};\n\nexport function AuthChallengeMfaSetup({ authState }: AuthChallengeMfaSetupProps) {\n const [api, state] = useQpqRuntime(challengeRuntime);\n const isCodeValid = /^\\d{6}$/.test(state.mfaCode);\n\n const challenge = authState.authenticateUserResponse?.challenge;\n const session = authState.authenticateUserResponse?.session;\n\n // Associate a software token once, using the MFA_SETUP challenge session.\n const hasAssociated = useRef(false);\n useEffect(() => {\n if (!hasAssociated.current && session) {\n hasAssociated.current = true;\n api.authChallengeAssociateSoftwareToken(session);\n }\n }, [api, session]);\n\n if (!challenge || !session) {\n return <div>Error, missing challenge / session</div>;\n }\n\n return (\n <Box\n sx={{\n height: '100vh',\n width: '100%',\n p: 2,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Box component=\"form\" sx={{ width: '100%', maxWidth: 360 }}>\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography gutterBottom sx={{ display: 'flex', alignItems: 'center' }} variant=\"h5\">\n <LockIcon sx={{ marginRight: 1 }} />\n Set Up Authenticator\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography color=\"text.secondary\" variant=\"body2\">\n Add this account to your authenticator app, then enter the 6-digit code it generates.\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography color=\"text.secondary\" variant=\"caption\">\n Secret key\n </Typography>\n <Typography sx={{ fontFamily: 'monospace', wordBreak: 'break-all' }} variant=\"body1\">\n {state.secretCode || 'Loading…'}\n </Typography>\n </Grid>\n {state.secretCode && (\n <Grid item xs={12}>\n <Typography color=\"text.secondary\" sx={{ wordBreak: 'break-all' }} variant=\"caption\">\n {buildOtpAuthUri(authState.username, state.secretCode)}\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n <TextField\n autoFocus\n fullWidth\n id=\"mfaCode\"\n inputProps={{ inputMode: 'numeric', pattern: '[0-9]*', maxLength: 6 }}\n label=\"Authentication Code\"\n onChange={(event) => api.authChallengeSetMfaSetupCode(event.target.value.replace(/\\D/g, ''))}\n required\n value={state.mfaCode}\n />\n </Grid>\n <Grid item xs={12}>\n <AsyncButton\n disabled={!isCodeValid || !state.secretCode}\n onClick={() => api.authChallengeSendMfaSetupCode(challenge, authState.username)}\n >\n Verify\n </AsyncButton>\n </Grid>\n </Grid>\n </Box>\n </Box>\n );\n}\n"]}
@@ -14,9 +14,14 @@ const TextField_1 = __importDefault(require("@mui/material/TextField"));
14
14
  const Typography_1 = __importDefault(require("@mui/material/Typography"));
15
15
  const components_1 = require("../../components");
16
16
  const logic_1 = require("./logic");
17
- const atom = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)(logic_1.authChallengeLogic, logic_1.authChallengeInitalState, logic_1.authChallengeReducer);
17
+ const challengeRuntime = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)({
18
+ uniqueName: 'qpq/admin/authChallengeNewPasswordRequired',
19
+ api: logic_1.authChallengeLogic,
20
+ initialState: logic_1.authChallengeInitalState,
21
+ reducer: logic_1.authChallengeReducer,
22
+ });
18
23
  function AuthChallengeNewPasswordRequired({ authState }) {
19
- const [api, state] = (0, quidproquo_web_react_1.useQpqRuntime)(atom);
24
+ const [api, state] = (0, quidproquo_web_react_1.useQpqRuntime)(challengeRuntime);
20
25
  const arePasswordsMatching = state.passwordA === state.passwordB && state.passwordA !== '';
21
26
  if (!authState.authenticateUserResponse || !authState.authenticateUserResponse.challenge || !authState.authenticateUserResponse.session) {
22
27
  return (0, jsx_runtime_1.jsx)("div", { children: "Error, missing challenge / session" });
@@ -1 +1 @@
1
- {"version":3,"file":"AuthChallengeNewPasswordRequired.js","sourceRoot":"","sources":["../../../../src/Auth/AuthChallengeNewPasswordRequired/AuthChallengeNewPasswordRequired.tsx"],"names":[],"mappings":";;;;;AAmBA,4EAqEC;;AAxFD,2EAA2E;AAC3E,+DAAiF;AAEjF,oEAAgD;AAChD,4DAAoC;AACpC,8DAAsC;AACtC,wEAAgD;AAChD,0EAAkD;AAElD,iDAA+C;AAE/C,mCAA6F;AAM7F,MAAM,IAAI,GAAG,IA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AAS,QACT,SAAS,QACT,EAAE,EAAC,aAAa,EAChB,KAAK,EAAC,cAAc,EACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,yBAAyB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACtE,QAAQ,QACR,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,KAAK,CAAC,SAAS,GACtB,GACG,EACP,uBAAC,cAAI,IAAC,IAAI,QAAC,EAAE,EAAE,EAAE,YACf,uBAAC,mBAAS,IACR,SAAS,QACT,EAAE,EAAC,iBAAiB,EACpB,KAAK,EAAC,kBAAkB,EACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,yBAAyB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACtE,QAAQ,QACR,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,KAAK,CAAC,SAAS,GACtB,GACG,EACP,uBAAC,cAAI,IAAC,IAAI,QAAC,EAAE,EAAE,EAAE,YACf,uBAAC,wBAAW,IACV,QAAQ,EAAE,CAAC,oBAAoB,EAC/B,OAAO,EAAE,GAAG,EAAE;;gCACZ,OAAA,GAAG,CAAC,0BAA0B,CAC5B,MAAA,SAAS,CAAC,wBAAwB,0CAAE,SAAU,EAC9C,MAAA,SAAS,CAAC,wBAAwB,0CAAE,OAAQ,EAC5C,SAAS,CAAC,QAAQ,CACnB,CAAA;6BAAA,gCAIS,GACT,IACF,GACH,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */\nimport { createQpqRuntimeDefinition, useQpqRuntime } from 'quidproquo-web-react';\n\nimport LockIcon from '@mui/icons-material/Lock';\nimport Box from '@mui/material/Box';\nimport Grid from '@mui/material/Grid';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { AsyncButton } from '../../components';\nimport { AuthState } from '../logic';\nimport { authChallengeInitalState, authChallengeLogic, authChallengeReducer } from './logic';\n\ninterface AuthChallengeNewPasswordRequiredProps {\n authState: AuthState;\n}\n\nconst atom = createQpqRuntimeDefinition(authChallengeLogic, authChallengeInitalState, authChallengeReducer);\n\nexport function AuthChallengeNewPasswordRequired({ authState }: AuthChallengeNewPasswordRequiredProps) {\n const [api, state] = useQpqRuntime(atom);\n const arePasswordsMatching = state.passwordA === state.passwordB && state.passwordA !== '';\n\n if (!authState.authenticateUserResponse || !authState.authenticateUserResponse.challenge || !authState.authenticateUserResponse.session) {\n return <div>Error, missing challenge / session</div>;\n }\n\n return (\n <Box\n sx={{\n height: '100vh',\n width: '100%',\n p: 2,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Box component=\"form\" sx={{ width: '100%', maxWidth: 360 }}>\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography gutterBottom sx={{ display: 'flex', alignItems: 'center' }} variant=\"h5\">\n <LockIcon sx={{ marginRight: 1 }} />\n Password Change Required\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <TextField\n autoFocus\n fullWidth\n id=\"newPassword\"\n label=\"New Password\"\n onChange={(event) => api.authChallengeSetPasswordA(event.target.value)}\n required\n type=\"password\"\n value={state.passwordA}\n />\n </Grid>\n <Grid item xs={12}>\n <TextField\n fullWidth\n id=\"confirmPassword\"\n label=\"Confirm Password\"\n onChange={(event) => api.authChallengeSetPasswordB(event.target.value)}\n required\n type=\"password\"\n value={state.passwordB}\n />\n </Grid>\n <Grid item xs={12}>\n <AsyncButton\n disabled={!arePasswordsMatching}\n onClick={() =>\n api.authChallengeSendPasswords(\n authState.authenticateUserResponse?.challenge!,\n authState.authenticateUserResponse?.session!,\n authState.username,\n )\n }\n >\n Update Password\n </AsyncButton>\n </Grid>\n </Grid>\n </Box>\n </Box>\n );\n}\n"]}
1
+ {"version":3,"file":"AuthChallengeNewPasswordRequired.js","sourceRoot":"","sources":["../../../../src/Auth/AuthChallengeNewPassword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,CACP,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */\nimport { createQpqRuntimeDefinition, useQpqRuntime } from 'quidproquo-web-react';\n\nimport LockIcon from '@mui/icons-material/Lock';\nimport Box from '@mui/material/Box';\nimport Grid from '@mui/material/Grid';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { AsyncButton } from '../../components';\nimport { AuthState } from '../logic';\nimport { authChallengeInitalState, authChallengeLogic, authChallengeReducer } from './logic';\n\ninterface AuthChallengeNewPasswordRequiredProps {\n authState: AuthState;\n}\n\nconst challengeRuntime = createQpqRuntimeDefinition({\n uniqueName: 'qpq/admin/authChallengeNewPasswordRequired',\n api: authChallengeLogic,\n initialState: authChallengeInitalState,\n reducer: authChallengeReducer,\n});\n\nexport function AuthChallengeNewPasswordRequired({ authState }: AuthChallengeNewPasswordRequiredProps) {\n const [api, state] = useQpqRuntime(challengeRuntime);\n const arePasswordsMatching = state.passwordA === state.passwordB && state.passwordA !== '';\n\n if (!authState.authenticateUserResponse || !authState.authenticateUserResponse.challenge || !authState.authenticateUserResponse.session) {\n return <div>Error, missing challenge / session</div>;\n }\n\n return (\n <Box\n sx={{\n height: '100vh',\n width: '100%',\n p: 2,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Box component=\"form\" sx={{ width: '100%', maxWidth: 360 }}>\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography gutterBottom sx={{ display: 'flex', alignItems: 'center' }} variant=\"h5\">\n <LockIcon sx={{ marginRight: 1 }} />\n Password Change Required\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <TextField\n autoFocus\n fullWidth\n id=\"newPassword\"\n label=\"New Password\"\n onChange={(event) => api.authChallengeSetPasswordA(event.target.value)}\n required\n type=\"password\"\n value={state.passwordA}\n />\n </Grid>\n <Grid item xs={12}>\n <TextField\n fullWidth\n id=\"confirmPassword\"\n label=\"Confirm Password\"\n onChange={(event) => api.authChallengeSetPasswordB(event.target.value)}\n required\n type=\"password\"\n value={state.passwordB}\n />\n </Grid>\n <Grid item xs={12}>\n <AsyncButton\n disabled={!arePasswordsMatching}\n onClick={() =>\n api.authChallengeSendPasswords(\n authState.authenticateUserResponse?.challenge!,\n authState.authenticateUserResponse?.session!,\n authState.username,\n )\n }\n >\n Update Password\n </AsyncButton>\n </Grid>\n </Grid>\n </Box>\n </Box>\n );\n}\n"]}
@@ -14,9 +14,14 @@ const TextField_1 = __importDefault(require("@mui/material/TextField"));
14
14
  const Typography_1 = __importDefault(require("@mui/material/Typography"));
15
15
  const components_1 = require("../../components");
16
16
  const logic_1 = require("./logic");
17
- const atom = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)(logic_1.authChallengeMfaLogic, logic_1.authChallengeMfaInitalState, logic_1.authChallengeMfaReducer);
17
+ const challengeRuntime = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)({
18
+ uniqueName: 'qpq/admin/authChallengeSoftwareTokenMfa',
19
+ api: logic_1.authChallengeMfaLogic,
20
+ initialState: logic_1.authChallengeMfaInitalState,
21
+ reducer: logic_1.authChallengeMfaReducer,
22
+ });
18
23
  function AuthChallengeSoftwareTokenMfa({ authState }) {
19
- const [api, state] = (0, quidproquo_web_react_1.useQpqRuntime)(atom);
24
+ const [api, state] = (0, quidproquo_web_react_1.useQpqRuntime)(challengeRuntime);
20
25
  const isCodeValid = /^\d{6}$/.test(state.mfaCode);
21
26
  if (!authState.authenticateUserResponse || !authState.authenticateUserResponse.challenge || !authState.authenticateUserResponse.session) {
22
27
  return (0, jsx_runtime_1.jsx)("div", { children: "Error, missing challenge / session" });
@@ -1 +1 @@
1
- {"version":3,"file":"AuthChallengeSoftwareTokenMfa.js","sourceRoot":"","sources":["../../../../src/Auth/AuthChallengeSoftwareTokenMfa/AuthChallengeSoftwareTokenMfa.tsx"],"names":[],"mappings":";;;;;AAmBA,sEA+DC;;AAlFD,2EAA2E;AAC3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AC,EAAE,GAAI,yBAEzB,GACR,EACP,uBAAC,cAAI,IAAC,IAAI,QAAC,EAAE,EAAE,EAAE,YACf,uBAAC,oBAAU,IAAC,KAAK,EAAC,gBAAgB,EAAC,OAAO,EAAC,OAAO,oEAErC,GACR,EACP,uBAAC,cAAI,IAAC,IAAI,QAAC,EAAE,EAAE,EAAE,YACf,uBAAC,mBAAS,IACR,SAAS,QACT,SAAS,QACT,EAAE,EAAC,SAAS,EACZ,UAAU,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,EACrE,KAAK,EAAC,qBAAqB,EAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EACvF,QAAQ,QACR,KAAK,EAAE,KAAK,CAAC,OAAO,GACpB,GACG,EACP,uBAAC,cAAI,IAAC,IAAI,QAAC,EAAE,EAAE,EAAE,YACf,uBAAC,wBAAW,IACV,QAAQ,EAAE,CAAC,WAAW,EACtB,OAAO,EAAE,GAAG,EAAE;;gCACZ,OAAA,GAAG,CAAC,wBAAwB,CAC1B,MAAA,SAAS,CAAC,wBAAwB,0CAAE,SAAU,EAC9C,MAAA,SAAS,CAAC,wBAAwB,0CAAE,OAAQ,EAC5C,SAAS,CAAC,QAAQ,CACnB,CAAA;6BAAA,uBAIS,GACT,IACF,GACH,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */\nimport { createQpqRuntimeDefinition, useQpqRuntime } from 'quidproquo-web-react';\n\nimport LockIcon from '@mui/icons-material/Lock';\nimport Box from '@mui/material/Box';\nimport Grid from '@mui/material/Grid';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { AsyncButton } from '../../components';\nimport { AuthState } from '../logic';\nimport { authChallengeMfaInitalState, authChallengeMfaLogic, authChallengeMfaReducer } from './logic';\n\ninterface AuthChallengeSoftwareTokenMfaProps {\n authState: AuthState;\n}\n\nconst atom = createQpqRuntimeDefinition(authChallengeMfaLogic, authChallengeMfaInitalState, authChallengeMfaReducer);\n\nexport function AuthChallengeSoftwareTokenMfa({ authState }: AuthChallengeSoftwareTokenMfaProps) {\n const [api, state] = useQpqRuntime(atom);\n const isCodeValid = /^\\d{6}$/.test(state.mfaCode);\n\n if (!authState.authenticateUserResponse || !authState.authenticateUserResponse.challenge || !authState.authenticateUserResponse.session) {\n return <div>Error, missing challenge / session</div>;\n }\n\n return (\n <Box\n sx={{\n height: '100vh',\n width: '100%',\n p: 2,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Box component=\"form\" sx={{ width: '100%', maxWidth: 360 }}>\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography gutterBottom sx={{ display: 'flex', alignItems: 'center' }} variant=\"h5\">\n <LockIcon sx={{ marginRight: 1 }} />\n Verification Code\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography color=\"text.secondary\" variant=\"body2\">\n Enter the 6-digit code from your authenticator app.\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <TextField\n autoFocus\n fullWidth\n id=\"mfaCode\"\n inputProps={{ inputMode: 'numeric', pattern: '[0-9]*', maxLength: 6 }}\n label=\"Authentication Code\"\n onChange={(event) => api.authChallengeSetMfaCode(event.target.value.replace(/\\D/g, ''))}\n required\n value={state.mfaCode}\n />\n </Grid>\n <Grid item xs={12}>\n <AsyncButton\n disabled={!isCodeValid}\n onClick={() =>\n api.authChallengeSendMfaCode(\n authState.authenticateUserResponse?.challenge!,\n authState.authenticateUserResponse?.session!,\n authState.username,\n )\n }\n >\n Verify\n </AsyncButton>\n </Grid>\n </Grid>\n </Box>\n </Box>\n );\n}\n"]}
1
+ {"version":3,"file":"AuthChallengeSoftware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slint/no-non-null-asserted-optional-chain */\nimport { createQpqRuntimeDefinition, useQpqRuntime } from 'quidproquo-web-react';\n\nimport LockIcon from '@mui/icons-material/Lock';\nimport Box from '@mui/material/Box';\nimport Grid from '@mui/material/Grid';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { AsyncButton } from '../../components';\nimport { AuthState } from '../logic';\nimport { authChallengeMfaInitalState, authChallengeMfaLogic, authChallengeMfaReducer } from './logic';\n\ninterface AuthChallengeSoftwareTokenMfaProps {\n authState: AuthState;\n}\n\nconst challengeRuntime = createQpqRuntimeDefinition({\n uniqueName: 'qpq/admin/authChallengeSoftwareTokenMfa',\n api: authChallengeMfaLogic,\n initialState: authChallengeMfaInitalState,\n reducer: authChallengeMfaReducer,\n});\n\nexport function AuthChallengeSoftwareTokenMfa({ authState }: AuthChallengeSoftwareTokenMfaProps) {\n const [api, state] = useQpqRuntime(challengeRuntime);\n const isCodeValid = /^\\d{6}$/.test(state.mfaCode);\n\n if (!authState.authenticateUserResponse || !authState.authenticateUserResponse.challenge || !authState.authenticateUserResponse.session) {\n return <div>Error, missing challenge / session</div>;\n }\n\n return (\n <Box\n sx={{\n height: '100vh',\n width: '100%',\n p: 2,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Box component=\"form\" sx={{ width: '100%', maxWidth: 360 }}>\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography gutterBottom sx={{ display: 'flex', alignItems: 'center' }} variant=\"h5\">\n <LockIcon sx={{ marginRight: 1 }} />\n Verification Code\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography color=\"text.secondary\" variant=\"body2\">\n Enter the 6-digit code from your authenticator app.\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <TextField\n autoFocus\n fullWidth\n id=\"mfaCode\"\n inputProps={{ inputMode: 'numeric', pattern: '[0-9]*', maxLength: 6 }}\n label=\"Authentication Code\"\n onChange={(event) => api.authChallengeSetMfaCode(event.target.value.replace(/\\D/g, ''))}\n required\n value={state.mfaCode}\n />\n </Grid>\n <Grid item xs={12}>\n <AsyncButton\n disabled={!isCodeValid}\n onClick={() =>\n api.authChallengeSendMfaCode(\n authState.authenticateUserResponse?.challenge!,\n authState.authenticateUserResponse?.session!,\n authState.username,\n )\n }\n >\n Verify\n </AsyncButton>\n </Grid>\n </Grid>\n </Box>\n </Box>\n );\n}\n"]}
@@ -1,7 +1,8 @@
1
+ import { askAuthMain } from './runtime/askAuthMain';
1
2
  export declare const authRuntime: import("quidproquo-web-react").QpqRuntimeDefinition<import("./authTypes").AuthState, import("./authTypes").AuthEffects, {
2
3
  askAuthLogin: typeof import("./runtime/askAuthLogin").askAuthLogin;
3
4
  askAuthLogout: typeof import("./runtime/askAuthLogout").askAuthLogout;
4
- askAuthMain: typeof import("./runtime/askAuthMain").askAuthMain;
5
+ askAuthMain: typeof askAuthMain;
5
6
  askAuthUISetUsername: typeof import("./authActionCreator").askAuthUISetUsername;
6
7
  askAuthUISetPassword: typeof import("./authActionCreator").askAuthUISetPassword;
7
8
  }>;
@@ -2,7 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.authRuntime = void 0;
4
4
  const quidproquo_web_react_1 = require("quidproquo-web-react");
5
+ const askAuthMain_1 = require("./runtime/askAuthMain");
5
6
  const authLogic_1 = require("./runtime/authLogic");
6
7
  const authReducer_1 = require("./authReducer");
7
- exports.authRuntime = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)(authLogic_1.authLogic, authReducer_1.authInitalState, authReducer_1.authReducer);
8
+ exports.authRuntime = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)({
9
+ uniqueName: 'qpq/admin/auth',
10
+ api: authLogic_1.authLogic,
11
+ initialState: authReducer_1.authInitalState,
12
+ reducer: authReducer_1.authReducer,
13
+ onInit: askAuthMain_1.askAuthMain,
14
+ });
8
15
  //# sourceMappingURL=authRuntime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authRuntime.js","sourceRoot":"","sources":["../../../../src/Auth/logic/authRuntime.ts"],"names":[],"mappings":";;;AAAA,+DAAkE;AAElE,mDAAgD;AAChD,+CAA6D;AAEhD,QAAA,WAAW,GAAG,IAAA,iDAA0B,EAAC,qBAAS,EAAE,6BAAe,EAAE,yBAAW,CAAC,CAAC","sourcesContent":["import { createQpqRuntimeDefinition } from 'quidproquo-web-react';\n\nimport { authLogic } from './runtime/authLogic';\nimport { authInitalState, authReducer } from './authReducer';\n\nexport const authRuntime = createQpqRuntimeDefinition(authLogic, authInitalState, authReducer);\n"]}
1
+ {"version":3,"file":"authRuntime.js","sourceRoot":"","sources":["../../../../src/Auth/logic/authRuntime.ts"],"names":[],"mappings":";;;AAAA,+DAAkE;AAElE,uDAAoD;AACpD,mDAAgD;AAChD,+CAA6D;AAEhD,QAAA,WAAW,GAAG,IAAA,iDAA0B,EAAC;IACpD,UAAU,EAAE,gBAAgB;IAC5B,GAAG,EAAE,qBAAS;IACd,YAAY,EAAE,6BAAe;IAC7B,OAAO,EAAE,yBAAW;IACpB,MAAM,EAAE,yBAAW;CACpB,CAAC,CAAC","sourcesContent":["import { createQpqRuntimeDefinition } from 'quidproquo-web-react';\n\nimport { askAuthMain } from './runtime/askAuthMain';\nimport { authLogic } from './runtime/authLogic';\nimport { authInitalState, authReducer } from './authReducer';\n\nexport const authRuntime = createQpqRuntimeDefinition({\n uniqueName: 'qpq/admin/auth',\n api: authLogic,\n initialState: authInitalState,\n reducer: authReducer,\n onInit: askAuthMain,\n});\n"]}
@@ -9,13 +9,12 @@ const react_1 = require("react");
9
9
  const icons_material_1 = require("@mui/icons-material");
10
10
  const material_1 = require("@mui/material");
11
11
  const adminApp_1 = require("../../adminApp");
12
- const askEventDocAiLogChatBoot_1 = require("./logic/askEventDocAiLogChatBoot");
13
12
  const eventDocAiLogChatRuntime_1 = require("./eventDocAiLogChatRuntime");
14
13
  const EventDocAiSegments_1 = require("./EventDocAiSegments");
15
14
  const LogChatConversation = ({ logCorrelation }) => {
16
15
  const [inputMessage, setInputMessage] = (0, react_1.useState)('');
17
16
  const chatContainerRef = (0, react_1.useRef)(null);
18
- const [api, state] = (0, quidproquo_web_react_2.useQpqWebsocketQueueRuntime)(eventDocAiLogChatRuntime_1.eventDocAiLogChatRuntime, askEventDocAiLogChatBoot_1.askEventDocAiLogChatBoot, logCorrelation);
17
+ const [api, state] = (0, quidproquo_web_react_2.useQpqWebsocketQueueRuntime)(eventDocAiLogChatRuntime_1.eventDocAiLogChatRuntime, logCorrelation);
19
18
  const [adminApi] = (0, adminApp_1.useAdminApp)();
20
19
  const streamSegments = (0, quidproquo_features_1.mergeStreamParts)(state.streamParts);
21
20
  const isThinking = state.isSending && streamSegments.length === 0;
@@ -1 +1 @@
1
- {"version":3,"file":"LogChat.js","sourceRoot":"","sources":["../../../../src/LogViewer/LogChat/LogChat.tsx"],"names":[],"mappings":";;;;AAAA,6DAA0E;AAC1E,+DAAyD;AACzD,+DAAuF;AAEvF,iCAA2D;AAC3D,wDAAmF;AACnF,4CAAoG;AAEpG,6CAA6C;AAC7C,+EAA4E;AAC5E,yEAAsE;AACtE,6DAA0D;AAO1D,MAAM,mBAAmB,GAAyC,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE;IACvF,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACrD,MAAM,gBAAgB,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAEtD,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAAA,kDAA2B,EAAC,mDAAwB,EAAE,mDAAwB,EAAE,cAAc,CAAC,CAAC;IACrH,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAA,sBAAW,GAAE,CAAC;IAEjC,MAAM,cAAc,GAAG,IAAA,sCAAgB,EAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,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AAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAC1F,uBAAC,2BAAgB,IAAC,IAAI,EAAE,EAAE,GAAI,GAC1B,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,uBAAC,yCAAkB,IAAC,iBAAiB,EAAE,uCAAiB,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,YAClI,uBAAC,mBAAmB,IAAC,cAAc,EAAE,cAAc,GAAI,GACpC,CACtB,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,OAAO,WAclB","sourcesContent":["import { eventDocAiContext, mergeStreamParts } from 'quidproquo-features';\nimport { useEffectCallback } from 'quidproquo-web-react';\nimport { QpqContextProvider, useQpqWebsocketQueueRuntime } from 'quidproquo-web-react';\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Android as AndroidIcon, Person as PersonIcon } from '@mui/icons-material';\nimport { Avatar, Box, Button, CircularProgress, Paper, TextField, Typography } from '@mui/material';\n\nimport { useAdminApp } from '../../adminApp';\nimport { askEventDocAiLogChatBoot } from './logic/askEventDocAiLogChatBoot';\nimport { eventDocAiLogChatRuntime } from './eventDocAiLogChatRuntime';\nimport { EventDocAiSegments } from './EventDocAiSegments';\n\ninterface LogChatProps {\n logServiceName: string;\n logCorrelation: string;\n}\n\nconst LogChatConversation: React.FC<{ logCorrelation: string }> = ({ logCorrelation }) => {\n const [inputMessage, setInputMessage] = useState('');\n const chatContainerRef = useRef<HTMLDivElement>(null);\n\n const [api, state] = useQpqWebsocketQueueRuntime(eventDocAiLogChatRuntime, askEventDocAiLogChatBoot, logCorrelation);\n const [adminApi] = useAdminApp();\n\n const streamSegments = mergeStreamParts(state.streamParts);\n const isThinking = state.isSending && streamSegments.length === 0;\n\n const handleSendMessage = useEffectCallback(() => {\n if (inputMessage.trim() !== '') {\n // Audit trail (session event) and actual chat transport are separate concerns.\n adminApi.sendChatMessage(logCorrelation, inputMessage);\n api.eventDocAiSendMessage(inputMessage);\n setInputMessage('');\n }\n });\n\n const handleKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n handleSendMessage();\n }\n };\n\n useEffect(() => {\n if (chatContainerRef.current) {\n chatContainerRef.current.scrollTop = chatContainerRef.current.scrollHeight;\n }\n }, [state.chatMessages, streamSegments]);\n\n return (\n <Box sx={{ display: 'flex', flexDirection: 'column', height: '100%' }}>\n <Box ref={chatContainerRef} sx={{ flexGrow: 1, overflowY: 'auto', p: 2 }}>\n {state.isLoadingHistory && (\n <Box sx={{ display: 'flex', justifyContent: 'center', p: 2 }}>\n <CircularProgress size={20} />\n </Box>\n )}\n {state.chatMessages.map((message, index) => (\n <Box\n key={index}\n sx={{\n display: 'flex',\n alignItems: 'flex-start',\n mb: 2,\n justifyContent: message.role === 'assistant' ? 'flex-start' : 'flex-end',\n }}\n >\n <Paper\n sx={{\n p: 2,\n borderRadius: message.role === 'assistant' ? '20px 20px 20px 0' : '20px 20px 0 20px',\n backgroundColor: message.role === 'assistant' ? 'grey.300' : 'primary.main',\n color: message.role === 'assistant' ? 'black' : 'white',\n maxWidth: '70%',\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}>\n <Avatar sx={{ mr: 1, bgcolor: message.role === 'assistant' ? 'grey.500' : 'primary.dark' }}>\n {message.role === 'assistant' ? <AndroidIcon /> : <PersonIcon />}\n </Avatar>\n <Typography variant=\"subtitle2\">{message.role === 'assistant' ? 'AI Assistant' : 'You'}</Typography>\n </Box>\n <EventDocAiSegments segments={message.segments} />\n </Paper>\n </Box>\n ))}\n {streamSegments.length > 0 && (\n <Box sx={{ display: 'flex', alignItems: 'flex-start', mb: 2, justifyContent: 'flex-start' }}>\n <Paper sx={{ p: 2, borderRadius: '20px 20px 20px 0', backgroundColor: 'grey.300', color: 'black', maxWidth: '70%' }}>\n <Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}>\n <Avatar sx={{ mr: 1, bgcolor: 'grey.500' }}>\n <AndroidIcon />\n </Avatar>\n <Typography variant=\"subtitle2\">AI Assistant</Typography>\n </Box>\n <EventDocAiSegments segments={streamSegments} />\n </Paper>\n </Box>\n )}\n {isThinking && (\n <Box sx={{ display: 'flex', alignItems: 'flex-start', mb: 2, justifyContent: 'flex-start' }}>\n <Paper sx={{ p: 2, borderRadius: '20px 20px 20px 0', backgroundColor: 'grey.300', color: 'black', maxWidth: '70%' }}>\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n <CircularProgress size={20} sx={{ mr: 1 }} />\n <Typography variant=\"body1\">Thinking...</Typography>\n </Box>\n </Paper>\n </Box>\n )}\n {state.error && (\n <Typography color=\"error\" sx={{ mt: 1 }} variant=\"body2\">\n {state.error}\n </Typography>\n )}\n </Box>\n <Box sx={{ p: 2, borderTop: '1px solid #ccc' }}>\n <Box sx={{ display: 'flex' }}>\n <TextField\n fullWidth\n onChange={(e) => setInputMessage(e.target.value)}\n onKeyDown={handleKeyPress}\n placeholder=\"Ask about this log...\"\n sx={{ mr: 2 }}\n value={inputMessage}\n variant=\"outlined\"\n />\n <Button onClick={handleSendMessage} variant=\"contained\">\n Send\n </Button>\n </Box>\n </Box>\n </Box>\n );\n};\n\n// The generic EventDocAi chat, scoped to this one log (docId = correlation id).\n// See eventdoc-chat-plan.md — replaces the old one-off Claude chat.\nexport const LogChat: React.FC<LogChatProps> = ({ logServiceName, logCorrelation }) => {\n if (!logServiceName) {\n return (\n <Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100%' }}>\n <CircularProgress size={20} />\n </Box>\n );\n }\n\n return (\n <QpqContextProvider contextIdentifier={eventDocAiContext} value={{ serviceName: logServiceName, type: 'log', docId: logCorrelation }}>\n <LogChatConversation logCorrelation={logCorrelation} />\n </QpqContextProvider>\n );\n};\n"]}
1
+ {"version":3,"file":"LogChat.js","sourceRoot":"","sources":["../../../../src/LogViewer/LogChat/LogChat.ts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AAM,EAAE,aAC1B,uBAAC,oBAAS,IACR,SAAS,QACT,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAChD,SAAS,EAAE,cAAc,EACzB,WAAW,EAAC,uBAAuB,EACnC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EACb,KAAK,EAAE,YAAY,EACnB,OAAO,EAAC,UAAU,GAClB,EACF,uBAAC,iBAAM,IAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAC,WAAW,qBAE9C,IACL,GACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,gFAAgF;AAChF,oEAAoE;AAC7D,MAAM,OAAO,GAA2B,CAAC,EAAE,cAAc,EAAE,cAAc,EAAE,EAAE,EAAE;IACpF,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,CACL,uBAAC,cAAG,IAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAC1F,uBAAC,2BAAgB,IAAC,IAAI,EAAE,EAAE,GAAI,GAC1B,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,uBAAC,yCAAkB,IAAC,iBAAiB,EAAE,uCAAiB,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,YAClI,uBAAC,mBAAmB,IAAC,cAAc,EAAE,cAAc,GAAI,GACpC,CACtB,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,OAAO,WAclB","sourcesContent":["import { eventDocAiContext, mergeStreamParts } from 'quidproquo-features';\nimport { useEffectCallback } from 'quidproquo-web-react';\nimport { QpqContextProvider, useQpqWebsocketQueueRuntime } from 'quidproquo-web-react';\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Android as AndroidIcon, Person as PersonIcon } from '@mui/icons-material';\nimport { Avatar, Box, Button, CircularProgress, Paper, TextField, Typography } from '@mui/material';\n\nimport { useAdminApp } from '../../adminApp';\nimport { eventDocAiLogChatRuntime } from './eventDocAiLogChatRuntime';\nimport { EventDocAiSegments } from './EventDocAiSegments';\n\ninterface LogChatProps {\n logServiceName: string;\n logCorrelation: string;\n}\n\nconst LogChatConversation: React.FC<{ logCorrelation: string }> = ({ logCorrelation }) => {\n const [inputMessage, setInputMessage] = useState('');\n const chatContainerRef = useRef<HTMLDivElement>(null);\n\n const [api, state] = useQpqWebsocketQueueRuntime(eventDocAiLogChatRuntime, logCorrelation);\n const [adminApi] = useAdminApp();\n\n const streamSegments = mergeStreamParts(state.streamParts);\n const isThinking = state.isSending && streamSegments.length === 0;\n\n const handleSendMessage = useEffectCallback(() => {\n if (inputMessage.trim() !== '') {\n // Audit trail (session event) and actual chat transport are separate concerns.\n adminApi.sendChatMessage(logCorrelation, inputMessage);\n api.eventDocAiSendMessage(inputMessage);\n setInputMessage('');\n }\n });\n\n const handleKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n handleSendMessage();\n }\n };\n\n useEffect(() => {\n if (chatContainerRef.current) {\n chatContainerRef.current.scrollTop = chatContainerRef.current.scrollHeight;\n }\n }, [state.chatMessages, streamSegments]);\n\n return (\n <Box sx={{ display: 'flex', flexDirection: 'column', height: '100%' }}>\n <Box ref={chatContainerRef} sx={{ flexGrow: 1, overflowY: 'auto', p: 2 }}>\n {state.isLoadingHistory && (\n <Box sx={{ display: 'flex', justifyContent: 'center', p: 2 }}>\n <CircularProgress size={20} />\n </Box>\n )}\n {state.chatMessages.map((message, index) => (\n <Box\n key={index}\n sx={{\n display: 'flex',\n alignItems: 'flex-start',\n mb: 2,\n justifyContent: message.role === 'assistant' ? 'flex-start' : 'flex-end',\n }}\n >\n <Paper\n sx={{\n p: 2,\n borderRadius: message.role === 'assistant' ? '20px 20px 20px 0' : '20px 20px 0 20px',\n backgroundColor: message.role === 'assistant' ? 'grey.300' : 'primary.main',\n color: message.role === 'assistant' ? 'black' : 'white',\n maxWidth: '70%',\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}>\n <Avatar sx={{ mr: 1, bgcolor: message.role === 'assistant' ? 'grey.500' : 'primary.dark' }}>\n {message.role === 'assistant' ? <AndroidIcon /> : <PersonIcon />}\n </Avatar>\n <Typography variant=\"subtitle2\">{message.role === 'assistant' ? 'AI Assistant' : 'You'}</Typography>\n </Box>\n <EventDocAiSegments segments={message.segments} />\n </Paper>\n </Box>\n ))}\n {streamSegments.length > 0 && (\n <Box sx={{ display: 'flex', alignItems: 'flex-start', mb: 2, justifyContent: 'flex-start' }}>\n <Paper sx={{ p: 2, borderRadius: '20px 20px 20px 0', backgroundColor: 'grey.300', color: 'black', maxWidth: '70%' }}>\n <Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}>\n <Avatar sx={{ mr: 1, bgcolor: 'grey.500' }}>\n <AndroidIcon />\n </Avatar>\n <Typography variant=\"subtitle2\">AI Assistant</Typography>\n </Box>\n <EventDocAiSegments segments={streamSegments} />\n </Paper>\n </Box>\n )}\n {isThinking && (\n <Box sx={{ display: 'flex', alignItems: 'flex-start', mb: 2, justifyContent: 'flex-start' }}>\n <Paper sx={{ p: 2, borderRadius: '20px 20px 20px 0', backgroundColor: 'grey.300', color: 'black', maxWidth: '70%' }}>\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n <CircularProgress size={20} sx={{ mr: 1 }} />\n <Typography variant=\"body1\">Thinking...</Typography>\n </Box>\n </Paper>\n </Box>\n )}\n {state.error && (\n <Typography color=\"error\" sx={{ mt: 1 }} variant=\"body2\">\n {state.error}\n </Typography>\n )}\n </Box>\n <Box sx={{ p: 2, borderTop: '1px solid #ccc' }}>\n <Box sx={{ display: 'flex' }}>\n <TextField\n fullWidth\n onChange={(e) => setInputMessage(e.target.value)}\n onKeyDown={handleKeyPress}\n placeholder=\"Ask about this log...\"\n sx={{ mr: 2 }}\n value={inputMessage}\n variant=\"outlined\"\n />\n <Button onClick={handleSendMessage} variant=\"contained\">\n Send\n </Button>\n </Box>\n </Box>\n </Box>\n );\n};\n\n// The generic EventDocAi chat, scoped to this one log (docId = correlation id).\n// See eventdoc-chat-plan.md — replaces the old one-off Claude chat.\nexport const LogChat: React.FC<LogChatProps> = ({ logServiceName, logCorrelation }) => {\n if (!logServiceName) {\n return (\n <Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100%' }}>\n <CircularProgress size={20} />\n </Box>\n );\n }\n\n return (\n <QpqContextProvider contextIdentifier={eventDocAiContext} value={{ serviceName: logServiceName, type: 'log', docId: logCorrelation }}>\n <LogChatConversation logCorrelation={logCorrelation} />\n </QpqContextProvider>\n );\n};\n"]}
@@ -3,7 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.eventDocAiLogChatRuntime = void 0;
4
4
  const quidproquo_features_1 = require("quidproquo-features");
5
5
  const quidproquo_web_react_1 = require("quidproquo-web-react");
6
- // Named per log correlation (see LogChat.tsx) so each open log dialog gets its
7
- // own isolated chat state instead of sharing one across every log.
8
- exports.eventDocAiLogChatRuntime = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)(quidproquo_features_1.sharedEventDocAiApi, (0, quidproquo_features_1.createInitialEventDocAiState)(), quidproquo_features_1.eventDocAiReducer);
6
+ const askEventDocAiLogChatBoot_1 = require("./logic/askEventDocAiLogChatBoot");
7
+ // Bound per log correlation (see LogChat.tsx) so each open log dialog gets its
8
+ // own isolated chat state instead of sharing one across every log. Closing the
9
+ // dialog releases the area; reopening re-runs the boot story.
10
+ exports.eventDocAiLogChatRuntime = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)({
11
+ uniqueName: 'qpq/admin/eventDocAiLogChat',
12
+ api: quidproquo_features_1.sharedEventDocAiApi,
13
+ initialState: (0, quidproquo_features_1.createInitialEventDocAiState)(),
14
+ reducer: quidproquo_features_1.eventDocAiReducer,
15
+ onInit: askEventDocAiLogChatBoot_1.askEventDocAiLogChatBoot,
16
+ });
9
17
  //# sourceMappingURL=eventDocAiLogChatRuntime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eventDocAiLogChatRuntime.js","sourceRoot":"","sources":["../../../../src/LogViewer/LogChat/eventDocAiLogChatRuntime.ts"],"names":[],"mappings":";;;AAAA,6DAA2G;AAC3G,+DAAkE;AAElE,+EAA+E;AAC/E,mEAAmE;AACtD,QAAA,wBAAwB,GAAG,IAAA,iDAA0B,EAAC,yCAAmB,EAAE,IAAA,kDAA4B,GAAE,EAAE,uCAAiB,CAAC,CAAC","sourcesContent":["import { createInitialEventDocAiState, eventDocAiReducer, sharedEventDocAiApi } from 'quidproquo-features';\nimport { createQpqRuntimeDefinition } from 'quidproquo-web-react';\n\n// Named per log correlation (see LogChat.tsx) so each open log dialog gets its\n// own isolated chat state instead of sharing one across every log.\nexport const eventDocAiLogChatRuntime = createQpqRuntimeDefinition(sharedEventDocAiApi, createInitialEventDocAiState(), eventDocAiReducer);\n"]}
1
+ {"version":3,"file":"eventDocAiLogChatRuntime.js","sourceRoot":"","sources":["../../../../src/LogViewer/LogChat/eventDocAiLogChatRuntime.ts"],"names":[],"mappings":";;;AAAA,6DAA2G;AAC3G,+DAAkE;AAElE,+EAA4E;AAE5E,+EAA+E;AAC/E,+EAA+E;AAC/E,8DAA8D;AACjD,QAAA,wBAAwB,GAAG,IAAA,iDAA0B,EAAC;IACjE,UAAU,EAAE,6BAA6B;IACzC,GAAG,EAAE,yCAAmB;IACxB,YAAY,EAAE,IAAA,kDAA4B,GAAE;IAC5C,OAAO,EAAE,uCAAiB;IAC1B,MAAM,EAAE,mDAAwB;CACjC,CAAC,CAAC","sourcesContent":["import { createInitialEventDocAiState, eventDocAiReducer, sharedEventDocAiApi } from 'quidproquo-features';\nimport { createQpqRuntimeDefinition } from 'quidproquo-web-react';\n\nimport { askEventDocAiLogChatBoot } from './logic/askEventDocAiLogChatBoot';\n\n// Bound per log correlation (see LogChat.tsx) so each open log dialog gets its\n// own isolated chat state instead of sharing one across every log. Closing the\n// dialog releases the area; reopening re-runs the boot story.\nexport const eventDocAiLogChatRuntime = createQpqRuntimeDefinition({\n uniqueName: 'qpq/admin/eventDocAiLogChat',\n api: sharedEventDocAiApi,\n initialState: createInitialEventDocAiState(),\n reducer: eventDocAiReducer,\n onInit: askEventDocAiLogChatBoot,\n});\n"]}
@@ -11,6 +11,8 @@ const localSessionEventActor_1 = require("../constants/localSessionEventActor");
11
11
  // processors with the action's PAYLOAD, so that is what this story receives.
12
12
  function* askApplySessionEventToLog(payload) {
13
13
  const clientMessageId = yield* (0, quidproquo_core_1.askNewGuid)();
14
+ // Sortable ids need no allocator, so the id is minted here rather than positioned later.
15
+ const eventId = yield* (0, quidproquo_core_1.askNewSortableGuid)();
14
16
  const createdAt = yield* (0, quidproquo_core_1.askDateNow)();
15
17
  const event = {
16
18
  type: payload.type,
@@ -21,7 +23,7 @@ function* askApplySessionEventToLog(payload) {
21
23
  clientMessageId,
22
24
  createdBy: localSessionEventActor_1.localSessionEventActor,
23
25
  createdAt,
24
- index: 0,
26
+ eventId,
25
27
  },
26
28
  },
27
29
  };
@@ -1 +1 @@
1
- {"version":3,"file":"askApplySessionEventToLog.js","sourceRoot":"","sources":["../../../../src/adminApp/actions/askApplySessionEventToLog.ts"],"names":[],"mappings":";;AAYA,8DAmBC;AA/BD,qDAAsE;AAGtE,4GAAyG;AACzG,sFAAmF;AACnF,gFAA6E;AAG7E,2EAA2E;AAC3E,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,QAAe,CAAC,CAAC,yBAAyB,CAAC,OAAuC;IAChF,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,IAAA,4BAAU,GAAE,CAAC;IAC5C,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,IAAA,4BAAU,GAAE,CAAC;IAEtC,MAAM,KAAK,GAAkB;QAC3B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE;YACP,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,QAAQ,EAAE;gBACR,OAAO,EAAE,qDAAyB;gBAClC,eAAe;gBACf,SAAS,EAAE,+CAAsB;gBACjC,SAAS;gBACT,KAAK,EAAE,CAAC;aACT;SACF;KACF,CAAC;IAEF,KAAK,CAAC,CAAC,IAAA,2DAA4B,EAAC,KAAK,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import { askDateNow, askNewGuid, AskResponse } from 'quidproquo-core';\nimport { EventDocEvent } from 'quidproquo-features';\n\nimport { askUISessionLogEventAppended } from '../actionCreators/sessionLog/askUISessionLogEventAppended';\nimport { adminSessionSchemaVersion } from '../constants/adminSessionSchemaVersion';\nimport { localSessionEventActor } from '../constants/localSessionEventActor';\nimport { ApplySessionEventActionPayload } from './ApplySessionEventActionTypes';\n\n// The seam between pure yield and the event log: stamps local metadata and\n// appends optimistically (index assignment + coalescing live in the reducer);\n// the flush loop drains it to the backend. NOTE: the runtime invokes action\n// processors with the action's PAYLOAD, so that is what this story receives.\nexport function* askApplySessionEventToLog(payload: ApplySessionEventActionPayload): AskResponse<void> {\n const clientMessageId = yield* askNewGuid();\n const createdAt = yield* askDateNow();\n\n const event: EventDocEvent = {\n type: payload.type,\n payload: {\n data: payload.data,\n metadata: {\n version: adminSessionSchemaVersion,\n clientMessageId,\n createdBy: localSessionEventActor,\n createdAt,\n index: 0,\n },\n },\n };\n\n yield* askUISessionLogEventAppended(event);\n}\n"]}
1
+ {"version":3,"file":"askApplySessionEventToLog.js","sourceRoot":"","sources":["../../../../src/adminApp/actions/askApplySessionEventToLog.ts"],"names":[],"mappings":";;AAYA,8DAqBC;AAjCD,qDAA0F;AAG1F,4GAAyG;AACzG,sFAAmF;AACnF,gFAA6E;AAG7E,2EAA2E;AAC3E,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,QAAe,CAAC,CAAC,yBAAyB,CAAC,OAAuC;IAChF,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,IAAA,4BAAU,GAAE,CAAC;IAC5C,yFAAyF;IACzF,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,IAAA,oCAAkB,GAAE,CAAC;IAC5C,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,IAAA,4BAAU,GAAE,CAAC;IAEtC,MAAM,KAAK,GAAkB;QAC3B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE;YACP,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,QAAQ,EAAE;gBACR,OAAO,EAAE,qDAAyB;gBAClC,eAAe;gBACf,SAAS,EAAE,+CAAsB;gBACjC,SAAS;gBACT,OAAO;aACR;SACF;KACF,CAAC;IAEF,KAAK,CAAC,CAAC,IAAA,2DAA4B,EAAC,KAAK,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import { askDateNow, askNewGuid, askNewSortableGuid, AskResponse } from 'quidproquo-core';\nimport { EventDocEvent } from 'quidproquo-features';\n\nimport { askUISessionLogEventAppended } from '../actionCreators/sessionLog/askUISessionLogEventAppended';\nimport { adminSessionSchemaVersion } from '../constants/adminSessionSchemaVersion';\nimport { localSessionEventActor } from '../constants/localSessionEventActor';\nimport { ApplySessionEventActionPayload } from './ApplySessionEventActionTypes';\n\n// The seam between pure yield and the event log: stamps local metadata and\n// appends optimistically (index assignment + coalescing live in the reducer);\n// the flush loop drains it to the backend. NOTE: the runtime invokes action\n// processors with the action's PAYLOAD, so that is what this story receives.\nexport function* askApplySessionEventToLog(payload: ApplySessionEventActionPayload): AskResponse<void> {\n const clientMessageId = yield* askNewGuid();\n // Sortable ids need no allocator, so the id is minted here rather than positioned later.\n const eventId = yield* askNewSortableGuid();\n const createdAt = yield* askDateNow();\n\n const event: EventDocEvent = {\n type: payload.type,\n payload: {\n data: payload.data,\n metadata: {\n version: adminSessionSchemaVersion,\n clientMessageId,\n createdBy: localSessionEventActor,\n createdAt,\n eventId,\n },\n },\n };\n\n yield* askUISessionLogEventAppended(event);\n}\n"]}
@@ -2,8 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.adminAppRuntime = void 0;
4
4
  const quidproquo_web_react_1 = require("quidproquo-web-react");
5
+ const getApplySessionEventActionProcessor_1 = require("./actions/getApplySessionEventActionProcessor");
6
+ const askAdminAppMain_1 = require("./logic/askAdminAppMain");
5
7
  const adminAppReducer_1 = require("./adminAppReducer");
6
8
  const AdminAppState_1 = require("./AdminAppState");
7
9
  const sharedAdminAppApi_1 = require("./sharedAdminAppApi");
8
- exports.adminAppRuntime = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)(sharedAdminAppApi_1.sharedAdminAppApi, (0, AdminAppState_1.createInitialAdminAppState)(), adminAppReducer_1.adminAppReducer);
10
+ exports.adminAppRuntime = (0, quidproquo_web_react_1.createQpqRuntimeDefinition)({
11
+ uniqueName: 'qpq/admin/adminApp',
12
+ api: sharedAdminAppApi_1.sharedAdminAppApi,
13
+ initialState: (0, AdminAppState_1.createInitialAdminAppState)(),
14
+ reducer: adminAppReducer_1.adminAppReducer,
15
+ // Boot story: session start is the first bind of the area (after login).
16
+ onInit: askAdminAppMain_1.askAdminAppMain,
17
+ // On the definition so every binder (and the boot story, whichever
18
+ // component's bind runs it) gets the ApplyEvent processor.
19
+ getActionProcessors: getApplySessionEventActionProcessor_1.getApplySessionEventActionProcessor,
20
+ });
9
21
  //# sourceMappingURL=adminAppRuntime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"adminAppRuntime.js","sourceRoot":"","sources":["../../../src/adminApp/adminAppRuntime.ts"],"names":[],"mappings":";;;AAAA,+DAAkE;AAElE,uDAAoD;AACpD,mDAA6D;AAC7D,2DAAwD;AAE3C,QAAA,eAAe,GAAG,IAAA,iDAA0B,EAAC,qCAAiB,EAAE,IAAA,0CAA0B,GAAE,EAAE,iCAAe,CAAC,CAAC","sourcesContent":["import { createQpqRuntimeDefinition } from 'quidproquo-web-react';\n\nimport { adminAppReducer } from './adminAppReducer';\nimport { createInitialAdminAppState } from './AdminAppState';\nimport { sharedAdminAppApi } from './sharedAdminAppApi';\n\nexport const adminAppRuntime = createQpqRuntimeDefinition(sharedAdminAppApi, createInitialAdminAppState(), adminAppReducer);\n"]}
1
+ {"version":3,"file":"adminAppRuntime.js","sourceRoot":"","sources":["../../../src/adminApp/adminAppRuntime.ts"],"names":[],"mappings":";;;AAAA,+DAAkE;AAElE,uGAAoG;AACpG,6DAA0D;AAC1D,uDAAoD;AACpD,mDAA6D;AAC7D,2DAAwD;AAE3C,QAAA,eAAe,GAAG,IAAA,iDAA0B,EAAC;IACxD,UAAU,EAAE,oBAAoB;IAChC,GAAG,EAAE,qCAAiB;IACtB,YAAY,EAAE,IAAA,0CAA0B,GAAE;IAC1C,OAAO,EAAE,iCAAe;IACxB,yEAAyE;IACzE,MAAM,EAAE,iCAAe;IACvB,mEAAmE;IACnE,2DAA2D;IAC3D,mBAAmB,EAAE,yEAAmC;CACzD,CAAC,CAAC","sourcesContent":["import { createQpqRuntimeDefinition } from 'quidproquo-web-react';\n\nimport { getApplySessionEventActionProcessor } from './actions/getApplySessionEventActionProcessor';\nimport { askAdminAppMain } from './logic/askAdminAppMain';\nimport { adminAppReducer } from './adminAppReducer';\nimport { createInitialAdminAppState } from './AdminAppState';\nimport { sharedAdminAppApi } from './sharedAdminAppApi';\n\nexport const adminAppRuntime = createQpqRuntimeDefinition({\n uniqueName: 'qpq/admin/adminApp',\n api: sharedAdminAppApi,\n initialState: createInitialAdminAppState(),\n reducer: adminAppReducer,\n // Boot story: session start is the first bind of the area (after login).\n onInit: askAdminAppMain,\n // On the definition so every binder (and the boot story, whichever\n // component's bind runs it) gets the ApplyEvent processor.\n getActionProcessors: getApplySessionEventActionProcessor,\n});\n"]}
@@ -4,24 +4,19 @@ exports.AdminAppProvider = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const quidproquo_web_react_1 = require("quidproquo-web-react");
6
6
  const react_1 = require("react");
7
- const getApplySessionEventActionProcessor_1 = require("../../actions/getApplySessionEventActionProcessor");
8
7
  const adminAppRuntime_1 = require("../../adminAppRuntime");
9
8
  const adminUserContext_1 = require("../../contexts/adminUserContext");
10
- const askAdminAppMain_1 = require("../../logic/askAdminAppMain");
11
- // Mounts only once authenticated (inside Auth), so mounting IS session start:
12
- // the boot story creates the session doc, seeds it from the URL, and runs the
13
- // flush loop for the life of the page.
14
- const AdminAppRuntimeMount = ({ children }) => {
15
- (0, quidproquo_web_react_1.useQpqRuntime)(adminAppRuntime_1.adminAppRuntime, askAdminAppMain_1.askAdminAppMain, undefined, getApplySessionEventActionProcessor_1.getApplySessionEventActionProcessor);
16
- return (0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqRuntimeEffectCatcher, { runtime: adminAppRuntime_1.adminAppRuntime, children: children });
17
- };
9
+ // Mounts only once authenticated (inside Auth), so the first bind of the
10
+ // adminApp area IS session start: the definition's onInit creates the session
11
+ // doc, seeds it from the URL, and runs the flush loop until logout unmounts
12
+ // the subtree and the area is released.
18
13
  const AdminAppProvider = ({ children }) => {
19
14
  var _a;
20
15
  const authState = (0, react_1.useContext)(quidproquo_web_react_1.authContext);
21
16
  const adminUser = {
22
17
  username: (_a = authState === null || authState === void 0 ? void 0 : authState.username) !== null && _a !== void 0 ? _a : '',
23
18
  };
24
- return ((0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqContextProvider, { contextIdentifier: adminUserContext_1.adminUserContext, value: adminUser, children: (0, jsx_runtime_1.jsx)(AdminAppRuntimeMount, { children: children }) }));
19
+ return ((0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqContextProvider, { contextIdentifier: adminUserContext_1.adminUserContext, value: adminUser, children: (0, jsx_runtime_1.jsx)(quidproquo_web_react_1.QpqRuntimeEffectCatcher, { runtime: adminAppRuntime_1.adminAppRuntime, children: children }) }));
25
20
  };
26
21
  exports.AdminAppProvider = AdminAppProvider;
27
22
  //# sourceMappingURL=AdminAppProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminAppProvider.js","sourceRoot":"","sources":["../../../../../src/adminApp/components/AdminAppProvider/AdminAppProvider.tsx"],"names":[],"mappings":";;;;AAAA,+DAA+G;AAE/G,iCAA8C;AAE9C,2GAAwG;AACxG,2DAAwD;AACxD,sEAAqF;AACrF,iEAA8D;AAM9D,8EAA8E;AAC9E,8EAA8E;AAC9E,uCAAuC;AACvC,MAAM,oBAAoB,GAAoC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC7E,IAAA,oCAAa,EAAC,iCAAe,EAAE,iCAAe,EAAE,SAAS,EAAE,yEAAmC,CAAC,CAAC;IAEhG,OAAO,uBAAC,8CAAuB,IAAC,OAAO,EAAE,iCAAe,YAAG,QAAQ,GAA2B,CAAC;AACjG,CAAC,CAAC;AAEK,MAAM,gBAAgB,GAAoC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;;IAChF,MAAM,SAAS,GAAG,IAAA,kBAAU,EAAC,kCAAW,CAAC,CAAC;IAE1C,MAAM,SAAS,GAAqB;QAClC,QAAQ,EAAE,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,mCAAI,EAAE;KACpC,CAAC;IAEF,OAAO,CACL,uBAAC,yCAAkB,IAAC,iBAAiB,EAAE,mCAAgB,EAAE,KAAK,EAAE,SAAS,YACvE,uBAAC,oBAAoB,cAAE,QAAQ,GAAwB,GACpC,CACtB,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,gBAAgB,oBAY3B","sourcesContent":["import { authContext, QpqContextProvider, QpqRuntimeEffectCatcher, useQpqRuntime } from 'quidproquo-web-react';\n\nimport { ReactNode, useContext } from 'react';\n\nimport { getApplySessionEventActionProcessor } from '../../actions/getApplySessionEventActionProcessor';\nimport { adminAppRuntime } from '../../adminAppRuntime';\nimport { AdminUserContext, adminUserContext } from '../../contexts/adminUserContext';\nimport { askAdminAppMain } from '../../logic/askAdminAppMain';\n\ntype AdminAppProviderProps = {\n children?: ReactNode;\n};\n\n// Mounts only once authenticated (inside Auth), so mounting IS session start:\n// the boot story creates the session doc, seeds it from the URL, and runs the\n// flush loop for the life of the page.\nconst AdminAppRuntimeMount: React.FC<AdminAppProviderProps> = ({ children }) => {\n useQpqRuntime(adminAppRuntime, askAdminAppMain, undefined, getApplySessionEventActionProcessor);\n\n return <QpqRuntimeEffectCatcher runtime={adminAppRuntime}>{children}</QpqRuntimeEffectCatcher>;\n};\n\nexport const AdminAppProvider: React.FC<AdminAppProviderProps> = ({ children }) => {\n const authState = useContext(authContext);\n\n const adminUser: AdminUserContext = {\n username: authState?.username ?? '',\n };\n\n return (\n <QpqContextProvider contextIdentifier={adminUserContext} value={adminUser}>\n <AdminAppRuntimeMount>{children}</AdminAppRuntimeMount>\n </QpqContextProvider>\n );\n};\n"]}
1
+ {"version":3,"file":"AdminAppProvider.js","sourceRoot":"","sources":["../../../../../src/adminApp/components/AdminAppProvider/AdminAppProvider.tsx"],"names":[],"mappings":";;;;AAAA,+DAAgG;AAEhG,iCAA8C;AAE9C,2DAAwD;AACxD,sEAAqF;AAMrF,yEAAyE;AACzE,8EAA8E;AAC9E,4EAA4E;AAC5E,wCAAwC;AACjC,MAAM,gBAAgB,GAAoC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;;IAChF,MAAM,SAAS,GAAG,IAAA,kBAAU,EAAC,kCAAW,CAAC,CAAC;IAE1C,MAAM,SAAS,GAAqB;QAClC,QAAQ,EAAE,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,mCAAI,EAAE;KACpC,CAAC;IAEF,OAAO,CACL,uBAAC,yCAAkB,IAAC,iBAAiB,EAAE,mCAAgB,EAAE,KAAK,EAAE,SAAS,YACvE,uBAAC,8CAAuB,IAAC,OAAO,EAAE,iCAAe,YAAG,QAAQ,GAA2B,GACpE,CACtB,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,gBAAgB,oBAY3B","sourcesContent":["import { authContext, QpqContextProvider, QpqRuntimeEffectCatcher } from 'quidproquo-web-react';\n\nimport { ReactNode, useContext } from 'react';\n\nimport { adminAppRuntime } from '../../adminAppRuntime';\nimport { AdminUserContext, adminUserContext } from '../../contexts/adminUserContext';\n\ntype AdminAppProviderProps = {\n children?: ReactNode;\n};\n\n// Mounts only once authenticated (inside Auth), so the first bind of the\n// adminApp area IS session start: the definition's onInit creates the session\n// doc, seeds it from the URL, and runs the flush loop until logout unmounts\n// the subtree and the area is released.\nexport const AdminAppProvider: React.FC<AdminAppProviderProps> = ({ children }) => {\n const authState = useContext(authContext);\n\n const adminUser: AdminUserContext = {\n username: authState?.username ?? '',\n };\n\n return (\n <QpqContextProvider contextIdentifier={adminUserContext} value={adminUser}>\n <QpqRuntimeEffectCatcher runtime={adminAppRuntime}>{children}</QpqRuntimeEffectCatcher>\n </QpqContextProvider>\n );\n};\n"]}
@@ -14,4 +14,4 @@ export declare const useAdminApp: () => [import("quidproquo-web-react").QpqMappe
14
14
  askRunLogLogSearch: typeof import("..").askRunLogLogSearch;
15
15
  askRunLogSearch: typeof import("..").askRunLogSearch;
16
16
  askSendChatMessage: typeof import("..").askSendChatMessage;
17
- }>, import("..").AdminAppState, (action: any) => void];
17
+ }>, import("..").AdminAppState, (action: import("..").SessionLogEffects | import("..").VolatileEffects) => void];
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useAdminApp = void 0;
4
4
  const quidproquo_web_react_1 = require("quidproquo-web-react");
5
- const getApplySessionEventActionProcessor_1 = require("../actions/getApplySessionEventActionProcessor");
6
5
  const adminAppRuntime_1 = require("../adminAppRuntime");
7
- // The admin runtime + its ApplyEvent processor. The boot story runs once in
8
- // AdminAppProvider; every other consumer mounts without a main story.
9
- const useAdminApp = () => (0, quidproquo_web_react_1.useQpqRuntime)(adminAppRuntime_1.adminAppRuntime, undefined, undefined, getApplySessionEventActionProcessor_1.getApplySessionEventActionProcessor);
6
+ // The ApplyEvent processor and the boot story both live on the definition, so
7
+ // every consumer binds the same way; the first bind starts the session.
8
+ const useAdminApp = () => (0, quidproquo_web_react_1.useQpqRuntime)(adminAppRuntime_1.adminAppRuntime);
10
9
  exports.useAdminApp = useAdminApp;
11
10
  //# sourceMappingURL=useAdminApp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAdminApp.js","sourceRoot":"","sources":["../../../../src/adminApp/hooks/useAdminApp.ts"],"names":[],"mappings":";;;AAAA,+DAAqD;AAErD,wGAAqG;AACrG,wDAAqD;AAErD,4EAA4E;AAC5E,sEAAsE;AAC/D,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,IAAA,oCAAa,EAAC,iCAAe,EAAE,SAAS,EAAE,SAAS,EAAE,yEAAmC,CAAC,CAAC;AAA9G,QAAA,WAAW,eAAmG","sourcesContent":["import { useQpqRuntime } from 'quidproquo-web-react';\n\nimport { getApplySessionEventActionProcessor } from '../actions/getApplySessionEventActionProcessor';\nimport { adminAppRuntime } from '../adminAppRuntime';\n\n// The admin runtime + its ApplyEvent processor. The boot story runs once in\n// AdminAppProvider; every other consumer mounts without a main story.\nexport const useAdminApp = () => useQpqRuntime(adminAppRuntime, undefined, undefined, getApplySessionEventActionProcessor);\n"]}
1
+ {"version":3,"file":"useAdminApp.js","sourceRoot":"","sources":["../../../../src/adminApp/hooks/useAdminApp.ts"],"names":[],"mappings":";;;AAAA,+DAAqD;AAErD,wDAAqD;AAErD,8EAA8E;AAC9E,wEAAwE;AACjE,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,IAAA,oCAAa,EAAC,iCAAe,CAAC,CAAC;AAAnD,QAAA,WAAW,eAAwC","sourcesContent":["import { useQpqRuntime } from 'quidproquo-web-react';\n\nimport { adminAppRuntime } from '../adminAppRuntime';\n\n// The ApplyEvent processor and the boot story both live on the definition, so\n// every consumer binds the same way; the first bind starts the session.\nexport const useAdminApp = () => useQpqRuntime(adminAppRuntime);\n"]}
@@ -2,11 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.eventAppended = void 0;
4
4
  const coalesceEventTypes_1 = require("../../constants/coalesceEventTypes");
5
- const nextLocalIndex = (state) => {
6
- var _a;
7
- const tail = (_a = state.pendingEvents[state.pendingEvents.length - 1]) !== null && _a !== void 0 ? _a : state.events[state.events.length - 1];
8
- return tail ? tail.payload.metadata.index + 1 : 0;
9
- };
10
5
  // Optimistic append with coalescing: while the previous event of the same
11
6
  // coalescable type is still pending, the new one replaces it (latest value
12
7
  // wins). The head is never coalesced while the flush has it in flight — the
@@ -16,11 +11,15 @@ const eventAppended = (state, event) => {
16
11
  const lastIsInFlightHead = state.pendingEvents.length === 1 && state.flush.inFlight;
17
12
  const shouldCoalesce = !!last && !lastIsInFlightHead && last.type === event.type && coalesceEventTypes_1.coalesceEventTypes.includes(event.type);
18
13
  if (shouldCoalesce) {
19
- const coalesced = Object.assign(Object.assign({}, event), { payload: Object.assign(Object.assign({}, event.payload), { metadata: Object.assign(Object.assign({}, event.payload.metadata), { index: last.payload.metadata.index }) }) });
14
+ const coalesced = Object.assign(Object.assign({}, event), { payload: Object.assign(Object.assign({}, event.payload), {
15
+ // Keeps the replaced event's id, so the coalesced event holds its place in the log
16
+ // rather than jumping to the end.
17
+ metadata: Object.assign(Object.assign({}, event.payload.metadata), { eventId: last.payload.metadata.eventId }) }) });
20
18
  return Object.assign(Object.assign({}, state), { pendingEvents: [...state.pendingEvents.slice(0, -1), coalesced] });
21
19
  }
22
- const appended = Object.assign(Object.assign({}, event), { payload: Object.assign(Object.assign({}, event.payload), { metadata: Object.assign(Object.assign({}, event.payload.metadata), { index: nextLocalIndex(state) }) }) });
23
- return Object.assign(Object.assign({}, state), { pendingEvents: [...state.pendingEvents, appended] });
20
+ // The event already carries the id minted when it was created, and sortable ids order
21
+ // themselves, so there is nothing to assign here.
22
+ return Object.assign(Object.assign({}, state), { pendingEvents: [...state.pendingEvents, event] });
24
23
  };
25
24
  exports.eventAppended = eventAppended;
26
25
  //# sourceMappingURL=eventAppended.js.map