@owlmeans/web-panel 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.
- package/LICENSE +21 -0
- package/README.md +1195 -0
- package/build/.gitkeep +0 -0
- package/build/auth/context.d.ts +5 -0
- package/build/auth/context.d.ts.map +1 -0
- package/build/auth/context.js +17 -0
- package/build/auth/context.js.map +1 -0
- package/build/auth/exports.d.ts +25 -0
- package/build/auth/exports.d.ts.map +1 -0
- package/build/auth/exports.js +19 -0
- package/build/auth/exports.js.map +1 -0
- package/build/auth/index.d.ts +5 -0
- package/build/auth/index.d.ts.map +1 -0
- package/build/auth/index.js +4 -0
- package/build/auth/index.js.map +1 -0
- package/build/auth/modules.d.ts +2 -0
- package/build/auth/modules.d.ts.map +1 -0
- package/build/auth/modules.js +4 -0
- package/build/auth/modules.js.map +1 -0
- package/build/auth/plugins/basic-ed25519.d.ts +3 -0
- package/build/auth/plugins/basic-ed25519.d.ts.map +1 -0
- package/build/auth/plugins/basic-ed25519.js +40 -0
- package/build/auth/plugins/basic-ed25519.js.map +1 -0
- package/build/auth/plugins/exports.d.ts +4 -0
- package/build/auth/plugins/exports.d.ts.map +1 -0
- package/build/auth/plugins/exports.js +4 -0
- package/build/auth/plugins/exports.js.map +1 -0
- package/build/auth/plugins/index.d.ts +6 -0
- package/build/auth/plugins/index.d.ts.map +1 -0
- package/build/auth/plugins/index.js +10 -0
- package/build/auth/plugins/index.js.map +1 -0
- package/build/auth/plugins/re-captcha.d.ts +3 -0
- package/build/auth/plugins/re-captcha.d.ts.map +1 -0
- package/build/auth/plugins/re-captcha.js +51 -0
- package/build/auth/plugins/re-captcha.js.map +1 -0
- package/build/auth/plugins/tunnel-consumer.d.ts +3 -0
- package/build/auth/plugins/tunnel-consumer.d.ts.map +1 -0
- package/build/auth/plugins/tunnel-consumer.js +40 -0
- package/build/auth/plugins/tunnel-consumer.js.map +1 -0
- package/build/auth/types.d.ts +10 -0
- package/build/auth/types.d.ts.map +1 -0
- package/build/auth/types.js +2 -0
- package/build/auth/types.js.map +1 -0
- package/build/components/block.d.ts +4 -0
- package/build/components/block.d.ts.map +1 -0
- package/build/components/block.js +15 -0
- package/build/components/block.js.map +1 -0
- package/build/components/button/index.d.ts +3 -0
- package/build/components/button/index.d.ts.map +1 -0
- package/build/components/button/index.js +2 -0
- package/build/components/button/index.js.map +1 -0
- package/build/components/button/selector.d.ts +4 -0
- package/build/components/button/selector.d.ts.map +1 -0
- package/build/components/button/selector.js +8 -0
- package/build/components/button/selector.js.map +1 -0
- package/build/components/button/types.d.ts +7 -0
- package/build/components/button/types.d.ts.map +1 -0
- package/build/components/button/types.js +2 -0
- package/build/components/button/types.js.map +1 -0
- package/build/components/form/button/component.d.ts +5 -0
- package/build/components/form/button/component.d.ts.map +1 -0
- package/build/components/form/button/component.js +34 -0
- package/build/components/form/button/component.js.map +1 -0
- package/build/components/form/button/index.d.ts +3 -0
- package/build/components/form/button/index.d.ts.map +1 -0
- package/build/components/form/button/index.js +3 -0
- package/build/components/form/button/index.js.map +1 -0
- package/build/components/form/button/types.d.ts +15 -0
- package/build/components/form/button/types.d.ts.map +1 -0
- package/build/components/form/button/types.js +2 -0
- package/build/components/form/button/types.js.map +1 -0
- package/build/components/form/component.d.ts +4 -0
- package/build/components/form/component.d.ts.map +1 -0
- package/build/components/form/component.js +59 -0
- package/build/components/form/component.js.map +1 -0
- package/build/components/form/index.d.ts +3 -0
- package/build/components/form/index.d.ts.map +1 -0
- package/build/components/form/index.js +2 -0
- package/build/components/form/index.js.map +1 -0
- package/build/components/form/text/component.d.ts +4 -0
- package/build/components/form/text/component.d.ts.map +1 -0
- package/build/components/form/text/component.js +34 -0
- package/build/components/form/text/component.js.map +1 -0
- package/build/components/form/text/index.d.ts +3 -0
- package/build/components/form/text/index.d.ts.map +1 -0
- package/build/components/form/text/index.js +3 -0
- package/build/components/form/text/index.js.map +1 -0
- package/build/components/form/text/types.d.ts +11 -0
- package/build/components/form/text/types.d.ts.map +1 -0
- package/build/components/form/text/types.js +2 -0
- package/build/components/form/text/types.js.map +1 -0
- package/build/components/form/types.d.ts +6 -0
- package/build/components/form/types.d.ts.map +1 -0
- package/build/components/form/types.js +2 -0
- package/build/components/form/types.js.map +1 -0
- package/build/components/helper.d.ts +6 -0
- package/build/components/helper.d.ts.map +1 -0
- package/build/components/helper.js +70 -0
- package/build/components/helper.js.map +1 -0
- package/build/components/index.d.ts +14 -0
- package/build/components/index.d.ts.map +1 -0
- package/build/components/index.js +13 -0
- package/build/components/index.js.map +1 -0
- package/build/components/layout/component.d.ts +4 -0
- package/build/components/layout/component.d.ts.map +1 -0
- package/build/components/layout/component.js +6 -0
- package/build/components/layout/component.js.map +1 -0
- package/build/components/layout/index.d.ts +3 -0
- package/build/components/layout/index.d.ts.map +1 -0
- package/build/components/layout/index.js +3 -0
- package/build/components/layout/index.js.map +1 -0
- package/build/components/layout/types.d.ts +4 -0
- package/build/components/layout/types.d.ts.map +1 -0
- package/build/components/layout/types.js +2 -0
- package/build/components/layout/types.js.map +1 -0
- package/build/components/link.d.ts +4 -0
- package/build/components/link.d.ts.map +1 -0
- package/build/components/link.js +27 -0
- package/build/components/link.js.map +1 -0
- package/build/components/panel-app/component.d.ts +4 -0
- package/build/components/panel-app/component.d.ts.map +1 -0
- package/build/components/panel-app/component.js +12 -0
- package/build/components/panel-app/component.js.map +1 -0
- package/build/components/panel-app/index.d.ts +3 -0
- package/build/components/panel-app/index.d.ts.map +1 -0
- package/build/components/panel-app/index.js +3 -0
- package/build/components/panel-app/index.js.map +1 -0
- package/build/components/panel-app/types.d.ts +6 -0
- package/build/components/panel-app/types.d.ts.map +1 -0
- package/build/components/panel-app/types.js +2 -0
- package/build/components/panel-app/types.js.map +1 -0
- package/build/components/status.d.ts +4 -0
- package/build/components/status.d.ts.map +1 -0
- package/build/components/status.js +19 -0
- package/build/components/status.js.map +1 -0
- package/build/components/text.d.ts +4 -0
- package/build/components/text.d.ts.map +1 -0
- package/build/components/text.js +9 -0
- package/build/components/text.js.map +1 -0
- package/build/components/types.d.ts +32 -0
- package/build/components/types.d.ts.map +1 -0
- package/build/components/types.js +2 -0
- package/build/components/types.js.map +1 -0
- package/build/components/uploader/image.d.ts +4 -0
- package/build/components/uploader/image.d.ts.map +1 -0
- package/build/components/uploader/image.js +24 -0
- package/build/components/uploader/image.js.map +1 -0
- package/build/components/uploader/index.d.ts +2 -0
- package/build/components/uploader/index.d.ts.map +1 -0
- package/build/components/uploader/index.js +2 -0
- package/build/components/uploader/index.js.map +1 -0
- package/build/components/uploader/types.d.ts +5 -0
- package/build/components/uploader/types.d.ts.map +1 -0
- package/build/components/uploader/types.js +2 -0
- package/build/components/uploader/types.js.map +1 -0
- package/build/context.d.ts +4 -0
- package/build/context.d.ts.map +1 -0
- package/build/context.js +12 -0
- package/build/context.js.map +1 -0
- package/build/exports.d.ts +19 -0
- package/build/exports.d.ts.map +1 -0
- package/build/exports.js +17 -0
- package/build/exports.js.map +1 -0
- package/build/index.d.ts +8 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -0
- package/build/main.d.ts +5 -0
- package/build/main.d.ts.map +1 -0
- package/build/main.js +14 -0
- package/build/main.js.map +1 -0
- package/build/modules.d.ts +2 -0
- package/build/modules.d.ts.map +1 -0
- package/build/modules.js +4 -0
- package/build/modules.js.map +1 -0
- package/build/types.d.ts +9 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/package.json +89 -0
- package/src/auth/context.ts +25 -0
- package/src/auth/exports.ts +29 -0
- package/src/auth/index.ts +5 -0
- package/src/auth/modules.ts +5 -0
- package/src/auth/plugins/basic-ed25519.tsx +57 -0
- package/src/auth/plugins/exports.ts +4 -0
- package/src/auth/plugins/index.ts +15 -0
- package/src/auth/plugins/re-captcha.tsx +73 -0
- package/src/auth/plugins/tunnel-consumer.tsx +65 -0
- package/src/auth/types.ts +11 -0
- package/src/components/block.tsx +27 -0
- package/src/components/button/index.ts +3 -0
- package/src/components/button/selector.tsx +16 -0
- package/src/components/button/types.ts +7 -0
- package/src/components/form/button/component.tsx +53 -0
- package/src/components/form/button/index.ts +3 -0
- package/src/components/form/button/types.ts +16 -0
- package/src/components/form/component.tsx +101 -0
- package/src/components/form/index.ts +3 -0
- package/src/components/form/text/component.tsx +45 -0
- package/src/components/form/text/index.ts +3 -0
- package/src/components/form/text/types.ts +11 -0
- package/src/components/form/types.ts +6 -0
- package/src/components/helper.ts +79 -0
- package/src/components/index.ts +17 -0
- package/src/components/layout/component.tsx +7 -0
- package/src/components/layout/index.ts +3 -0
- package/src/components/layout/types.ts +4 -0
- package/src/components/link.tsx +34 -0
- package/src/components/panel-app/component.tsx +21 -0
- package/src/components/panel-app/index.ts +3 -0
- package/src/components/panel-app/types.ts +6 -0
- package/src/components/status.tsx +23 -0
- package/src/components/text.tsx +14 -0
- package/src/components/types.ts +35 -0
- package/src/components/uploader/image.tsx +31 -0
- package/src/components/uploader/index.ts +2 -0
- package/src/components/uploader/types.ts +6 -0
- package/src/context.ts +18 -0
- package/src/exports.ts +22 -0
- package/src/index.ts +9 -0
- package/src/main.tsx +19 -0
- package/src/modules.ts +5 -0
- package/src/types.ts +11 -0
- package/tsconfig.json +16 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/components/uploader/image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAG/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAIpD,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAoBhD,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ImageUploader as Uploader } from '@owlmeans/web-client';
|
|
3
|
+
import Paper from '@mui/material/Paper';
|
|
4
|
+
import AddPhotoAlternateOutlinedIcon from '@mui/icons-material/AddPhotoAlternateOutlined';
|
|
5
|
+
import Box from '@mui/material/Box';
|
|
6
|
+
export const ImageUploader = ({ Root, rootProps, previewUrl, ...others }) => {
|
|
7
|
+
return _jsx(Uploader, { Root: Root ?? Paper, rootProps: {
|
|
8
|
+
elevation: 2,
|
|
9
|
+
sx: {
|
|
10
|
+
width: wrapperSize,
|
|
11
|
+
height: wrapperSize,
|
|
12
|
+
display: "flex",
|
|
13
|
+
justifyContent: "center",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
cursor: 'pointer',
|
|
16
|
+
},
|
|
17
|
+
...rootProps
|
|
18
|
+
}, ...others, children: previewUrl != null
|
|
19
|
+
? _jsx(Box, { component: "img", src: previewUrl, sx: { maxWidth: previewSize, maxHeight: previewSize } })
|
|
20
|
+
: _jsx(AddPhotoAlternateOutlinedIcon, { sx: { fontSize: previewSize }, color: "primary" }) });
|
|
21
|
+
};
|
|
22
|
+
const previewSize = { xs: 60, md: 120, lg: 200 };
|
|
23
|
+
const wrapperSize = { xs: 65, md: 125, lg: 205 };
|
|
24
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/components/uploader/image.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,KAAK,MAAM,qBAAqB,CAAA;AAEvC,OAAO,6BAA6B,MAAM,+CAA+C,CAAC;AAC1F,OAAO,GAAG,MAAM,mBAAmB,CAAA;AAEnC,MAAM,CAAC,MAAM,aAAa,GAA2B,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE;IAClG,OAAO,KAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,IAAI,KAAK,EAAE,SAAS,EAAE;YAC/C,SAAS,EAAE,CAAC;YACZ,EAAE,EAAE;gBACF,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,WAAW;gBACnB,OAAO,EAAE,MAAM;gBACf,cAAc,EAAE,QAAQ;gBACxB,UAAU,EAAE,QAAQ;gBACpB,MAAM,EAAE,SAAS;aAClB;YACD,GAAG,SAAS;SACb,KAAM,MAAM,YAET,UAAU,IAAI,IAAI;YAChB,CAAC,CAAC,KAAC,GAAG,IAAC,SAAS,EAAC,KAAK,EAAC,GAAG,EAAE,UAAU,EACpC,EAAE,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,GAAI;YAC3D,CAAC,CAAC,KAAC,6BAA6B,IAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,KAAK,EAAC,SAAS,GAAG,GAE7E,CAAA;AACb,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAA;AAChD,MAAM,WAAW,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/uploader/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/uploader/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/uploader/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAE/E,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/uploader/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AppConfig, AppContext } from './types.js';
|
|
2
|
+
export declare const makeContext: <C extends AppConfig, T extends AppContext<C>>(cfg: C) => T;
|
|
3
|
+
export declare const useContext: <C extends AppConfig = AppConfig, T extends AppContext<C> = AppContext<C>>() => T;
|
|
4
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAG,UAAU,EAAE,MAAM,YAAY,CAAA;AAIxD,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAG,CASlF,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,SAAS,cAAa,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,wBACnE,CAAA"}
|
package/build/context.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { appendFlowService } from '@owlmeans/web-flow';
|
|
2
|
+
import { makeContext as makeClientContext, useContext as useCtx } from '@owlmeans/web-client';
|
|
3
|
+
import { apiConfigMiddleware } from '@owlmeans/api-config-client';
|
|
4
|
+
export const makeContext = (cfg) => {
|
|
5
|
+
const context = makeClientContext(cfg);
|
|
6
|
+
context.registerMiddleware(apiConfigMiddleware);
|
|
7
|
+
appendFlowService(context);
|
|
8
|
+
context.flow = () => context.service('flow');
|
|
9
|
+
return context;
|
|
10
|
+
};
|
|
11
|
+
export const useContext = () => useCtx();
|
|
12
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,MAAM,CAAC,MAAM,WAAW,GAAG,CAA+C,GAAM,EAAK,EAAE;IACrF,MAAM,OAAO,GAAG,iBAAiB,CAAC,GAAG,CAAM,CAAA;IAE3C,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAE/C,iBAAiB,CAAO,OAAO,CAAC,CAAA;IAChC,OAAO,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IAE5C,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,GAA4E,EAAE,CACtG,MAAM,EAAO,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { handler, useNavigate, useValue, useModule } from '@owlmeans/client';
|
|
2
|
+
export { config } from '@owlmeans/client-context';
|
|
3
|
+
export { service } from '@owlmeans/config';
|
|
4
|
+
export { guard, parent } from '@owlmeans/module';
|
|
5
|
+
export { addWebService } from '@owlmeans/client-config';
|
|
6
|
+
export { module, elevate, provideRequest, stab } from '@owlmeans/client-module';
|
|
7
|
+
export type { ClientModule as Module } from '@owlmeans/client-module';
|
|
8
|
+
export { route as croute } from '@owlmeans/client-route';
|
|
9
|
+
export { route, frontend } from '@owlmeans/route';
|
|
10
|
+
export { DEFAULT_ALIAS as DAUTH_GUARD, setupExternalAuthentication } from '@owlmeans/client-auth';
|
|
11
|
+
export { AppType, HOME, ROOT, BASE, GUEST } from '@owlmeans/context';
|
|
12
|
+
export { DISPATCHER, CAUTHEN_FLOW_ENTER } from '@owlmeans/auth';
|
|
13
|
+
export type { AuthToken } from '@owlmeans/auth';
|
|
14
|
+
export { useCommonI18n, useI18nApp, useI18nLib } from '@owlmeans/client-i18n';
|
|
15
|
+
export { addCommonI18n, addI18nApp } from '@owlmeans/i18n';
|
|
16
|
+
export { flow, configureFlows } from '@owlmeans/flow';
|
|
17
|
+
export { QUERY_PARAM as FLOW_PARAM, SERVICE_PARAM, useFlow } from '@owlmeans/web-flow';
|
|
18
|
+
export { Dispatcher, appendWebAuthService } from '@owlmeans/web-client';
|
|
19
|
+
//# sourceMappingURL=exports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAC/E,YAAY,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,aAAa,IAAI,WAAW,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAEjG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEpE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC/D,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACtF,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA"}
|
package/build/exports.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { handler, useNavigate, useValue, useModule } from '@owlmeans/client';
|
|
2
|
+
export { config } from '@owlmeans/client-context';
|
|
3
|
+
export { service } from '@owlmeans/config';
|
|
4
|
+
export { guard, parent } from '@owlmeans/module';
|
|
5
|
+
export { addWebService } from '@owlmeans/client-config';
|
|
6
|
+
export { module, elevate, provideRequest, stab } from '@owlmeans/client-module';
|
|
7
|
+
export { route as croute } from '@owlmeans/client-route';
|
|
8
|
+
export { route, frontend } from '@owlmeans/route';
|
|
9
|
+
export { DEFAULT_ALIAS as DAUTH_GUARD, setupExternalAuthentication } from '@owlmeans/client-auth';
|
|
10
|
+
export { AppType, HOME, ROOT, BASE, GUEST } from '@owlmeans/context';
|
|
11
|
+
export { DISPATCHER, CAUTHEN_FLOW_ENTER } from '@owlmeans/auth';
|
|
12
|
+
export { useCommonI18n, useI18nApp, useI18nLib } from '@owlmeans/client-i18n';
|
|
13
|
+
export { addCommonI18n, addI18nApp } from '@owlmeans/i18n';
|
|
14
|
+
export { flow, configureFlows } from '@owlmeans/flow';
|
|
15
|
+
export { QUERY_PARAM as FLOW_PARAM, SERVICE_PARAM, useFlow } from '@owlmeans/web-flow';
|
|
16
|
+
export { Dispatcher, appendWebAuthService } from '@owlmeans/web-client';
|
|
17
|
+
//# sourceMappingURL=exports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAE/E,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,aAAa,IAAI,WAAW,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAEjG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEpE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAG/D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACtF,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA"}
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type * from './types.js';
|
|
2
|
+
export * from './main.js';
|
|
3
|
+
export * from './exports.js';
|
|
4
|
+
export * from './context.js';
|
|
5
|
+
export * from './modules.js';
|
|
6
|
+
export * from './components/index.js';
|
|
7
|
+
export * from '@owlmeans/client-panel';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AAErC,cAAc,wBAAwB,CAAA"}
|
package/build/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AAErC,cAAc,wBAAwB,CAAA"}
|
package/build/main.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RenderOptions } from '@owlmeans/web-client';
|
|
2
|
+
import type { ClientConfig, ClientContext } from '@owlmeans/client-context';
|
|
3
|
+
import type { Theme } from '@mui/material/styles';
|
|
4
|
+
export declare const render: <C extends ClientConfig, T extends ClientContext<C>>(context: T, theme?: Theme, opts?: RenderOptions) => void;
|
|
5
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,sBAAsB,CAAA;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAM3E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAEjD,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,KAAK,SAAS,aAAa,SAEzH,CAAA"}
|
package/build/main.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render as basicRender, provide } from '@owlmeans/web-client';
|
|
3
|
+
import { useI18nInstance } from '@owlmeans/client-i18n/utils';
|
|
4
|
+
import detector from 'i18next-browser-languagedetector';
|
|
5
|
+
import { PanelApp } from './components/panel-app/component.js';
|
|
6
|
+
export const render = (context, theme, opts) => {
|
|
7
|
+
basicRender(_jsx(App, { context: context, theme: theme }), opts);
|
|
8
|
+
};
|
|
9
|
+
const App = ({ context, theme }) => {
|
|
10
|
+
const i18nInstance = useI18nInstance(context.cfg);
|
|
11
|
+
i18nInstance.use(detector);
|
|
12
|
+
return _jsx(PanelApp, { context: context, provide: provide, theme: theme });
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,QAAQ,MAAM,kCAAkC,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAA;AAG9D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAqD,OAAU,EAAE,KAAa,EAAE,IAAoB,EAAE,EAAE;IAC5H,WAAW,CAAC,KAAC,GAAG,IAAC,OAAO,EAAE,OAAgC,EAAE,KAAK,EAAE,KAAK,GAAG,EAAE,IAAI,CAAC,CAAA;AACpF,CAAC,CAAA;AAED,MAAM,GAAG,GAAoD,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAClF,MAAM,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACjD,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAE1B,OAAO,KAAC,QAAQ,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAI,CAAA;AACvE,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,uJAAuB,CAAA"}
|
package/build/modules.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAE/D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC,CAAA"}
|
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WithFlowConfig } from '@owlmeans/flow';
|
|
2
|
+
import type { AppConfig as Config, AppContext as Context } from '@owlmeans/web-client';
|
|
3
|
+
import type { FlowService } from '@owlmeans/web-flow';
|
|
4
|
+
export interface AppConfig extends Config, WithFlowConfig {
|
|
5
|
+
}
|
|
6
|
+
export interface AppContext<C extends AppConfig = AppConfig> extends Context<C> {
|
|
7
|
+
flow: () => FlowService;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,SAAS,IAAI,MAAM,EAAE,UAAU,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAA;AACtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,WAAW,SAAU,SAAQ,MAAM,EAAE,cAAc;CACxD;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IAC7E,IAAI,EAAE,MAAM,WAAW,CAAA;CACxB"}
|
package/build/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@owlmeans/web-panel",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsc -b",
|
|
7
|
+
"dev": "sleep 384 && nodemon -e ts,tsx,json --watch src --exec \"tsc -p ./tsconfig.json\"",
|
|
8
|
+
"watch": "tsc -b -w --preserveWatchOutput --pretty"
|
|
9
|
+
},
|
|
10
|
+
"main": "build/index.js",
|
|
11
|
+
"module": "build/index.js",
|
|
12
|
+
"types": "build/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./build/index.js",
|
|
16
|
+
"require": "./build/index.js",
|
|
17
|
+
"default": "./build/index.js",
|
|
18
|
+
"module": "./build/index.js",
|
|
19
|
+
"types": "./build/index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./auth": {
|
|
22
|
+
"import": "./build/auth/index.js",
|
|
23
|
+
"require": "./build/auth/index.js",
|
|
24
|
+
"default": "./build/auth/index.js",
|
|
25
|
+
"module": "./build/auth/index.js",
|
|
26
|
+
"types": "./build/auth/index.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./auth/modules": {
|
|
29
|
+
"import": "./build/auth/modules.js",
|
|
30
|
+
"require": "./build/auth/modules.js",
|
|
31
|
+
"default": "./build/auth/modules.js",
|
|
32
|
+
"module": "./build/auth/modules.js",
|
|
33
|
+
"types": "./build/auth/modules.d.ts"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@hookform/resolvers": "^3.9.0",
|
|
38
|
+
"@owlmeans/api-config-client": "^0.1.0",
|
|
39
|
+
"@owlmeans/auth": "^0.1.0",
|
|
40
|
+
"@owlmeans/auth-common": "^0.1.0",
|
|
41
|
+
"@owlmeans/basic-envelope": "^0.1.0",
|
|
42
|
+
"@owlmeans/client": "^0.1.0",
|
|
43
|
+
"@owlmeans/client-auth": "^0.1.0",
|
|
44
|
+
"@owlmeans/client-config": "^0.1.0",
|
|
45
|
+
"@owlmeans/client-context": "^0.1.0",
|
|
46
|
+
"@owlmeans/client-flow": "^0.1.0",
|
|
47
|
+
"@owlmeans/client-i18n": "^0.1.0",
|
|
48
|
+
"@owlmeans/client-module": "^0.1.0",
|
|
49
|
+
"@owlmeans/client-panel": "^0.1.0",
|
|
50
|
+
"@owlmeans/client-route": "^0.1.0",
|
|
51
|
+
"@owlmeans/config": "^0.1.0",
|
|
52
|
+
"@owlmeans/context": "^0.1.0",
|
|
53
|
+
"@owlmeans/error": "^0.1.0",
|
|
54
|
+
"@owlmeans/flow": "^0.1.0",
|
|
55
|
+
"@owlmeans/i18n": "^0.1.0",
|
|
56
|
+
"@owlmeans/module": "^0.1.0",
|
|
57
|
+
"@owlmeans/route": "^0.1.0",
|
|
58
|
+
"@owlmeans/web-client": "^0.1.0",
|
|
59
|
+
"@owlmeans/web-db": "^0.1.0",
|
|
60
|
+
"@owlmeans/web-flow": "^0.1.0",
|
|
61
|
+
"i18next-browser-languagedetector": "^8.0.0",
|
|
62
|
+
"qrcode.react": "^4.2.0",
|
|
63
|
+
"react-google-recaptcha": "^3.1.0"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@emotion/react": "*",
|
|
67
|
+
"@emotion/styled": "*",
|
|
68
|
+
"@mui/material": "*",
|
|
69
|
+
"ajv": "*",
|
|
70
|
+
"react": "*",
|
|
71
|
+
"react-dom": "*",
|
|
72
|
+
"react-hook-form": "*"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@emotion/react": "^11.14.0",
|
|
76
|
+
"@emotion/styled": "^11.14.0",
|
|
77
|
+
"@mui/material": "^6.3.1",
|
|
78
|
+
"@types/react": "^18.3.11",
|
|
79
|
+
"@types/react-dom": "^18.3.0",
|
|
80
|
+
"@types/react-google-recaptcha": "^2.1.9",
|
|
81
|
+
"nodemon": "^3.1.7",
|
|
82
|
+
"npm-check": "^6.0.1",
|
|
83
|
+
"typescript": "^5.6.3"
|
|
84
|
+
},
|
|
85
|
+
"private": false,
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"access": "public"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { makeClientContext } from '@owlmeans/client'
|
|
2
|
+
import { appendWebDbService } from '@owlmeans/web-db'
|
|
3
|
+
import { apiConfigMiddleware } from '@owlmeans/api-config-client'
|
|
4
|
+
import { extractPrimaryHost, useContext as useCtx } from '@owlmeans/web-client'
|
|
5
|
+
import type { AppConfig as Config, AppContext as Context } from '@owlmeans/web-client'
|
|
6
|
+
import { AppConfig, AppContext } from './types.js'
|
|
7
|
+
import { appendFlowService } from '@owlmeans/web-flow'
|
|
8
|
+
|
|
9
|
+
export const makeContext = <C extends Config, T extends Context<C>>(cfg: C): T => {
|
|
10
|
+
const context = makeClientContext(cfg) as T
|
|
11
|
+
extractPrimaryHost<C, T>(context)
|
|
12
|
+
|
|
13
|
+
appendWebDbService<C, T>(context)
|
|
14
|
+
context.registerMiddleware(apiConfigMiddleware)
|
|
15
|
+
|
|
16
|
+
appendFlowService<C, T>(context);
|
|
17
|
+
(context as unknown as AppContext<AppConfig>).flow = () => context.service('flow')
|
|
18
|
+
|
|
19
|
+
context.makeContext = makeContext as typeof context.makeContext
|
|
20
|
+
|
|
21
|
+
return context
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const useContext = <C extends AppConfig = AppConfig,T extends AppContext<C> = AppContext<C>>(): T =>
|
|
25
|
+
useCtx() as unknown as T
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
export { handler, useModule, useValue, useNavigate } from '@owlmeans/client'
|
|
3
|
+
export type { Navigator } from '@owlmeans/client'
|
|
4
|
+
export { config } from '@owlmeans/client-context'
|
|
5
|
+
export { service } from '@owlmeans/config'
|
|
6
|
+
export { guard, parent, ModuleOutcome, clone } from '@owlmeans/module'
|
|
7
|
+
export type { AbstractRequest } from '@owlmeans/module'
|
|
8
|
+
export { addWebService } from '@owlmeans/client-config'
|
|
9
|
+
export { module, elevate, provideRequest, stab } from '@owlmeans/client-module'
|
|
10
|
+
export type { ClientModule as Module, ClientRequest as Request } from '@owlmeans/client-module'
|
|
11
|
+
export { route as croute } from '@owlmeans/client-route'
|
|
12
|
+
export { route, frontend, RouteMethod } from '@owlmeans/route'
|
|
13
|
+
export type { ResolvedServiceRoute as ServiceRoute } from '@owlmeans/route'
|
|
14
|
+
export { DEFAULT_ALIAS as DAUTH_GUARD } from '@owlmeans/client-auth'
|
|
15
|
+
export { CAUTHEN } from '@owlmeans/auth'
|
|
16
|
+
|
|
17
|
+
export { AppType, HOME, ROOT, BASE, GUEST } from '@owlmeans/context'
|
|
18
|
+
|
|
19
|
+
export * from '@owlmeans/client-panel/auth'
|
|
20
|
+
export { AuthenticationHOC } from '@owlmeans/client-auth/manager'
|
|
21
|
+
export { render } from '../main.js'
|
|
22
|
+
|
|
23
|
+
export { DISPATCHER, AuthenticationType } from '@owlmeans/auth'
|
|
24
|
+
export type { AuthToken } from '@owlmeans/auth'
|
|
25
|
+
|
|
26
|
+
export { DEFAULT_ALIAS as FLOW_ALIAS } from '@owlmeans/client-flow'
|
|
27
|
+
export type { FlowService } from '@owlmeans/web-flow'
|
|
28
|
+
export { QUERY_PARAM as FLOW_PARAM, SERVICE_PARAM } from '@owlmeans/web-flow'
|
|
29
|
+
export { flow, configureFlows } from '@owlmeans/flow'
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Ed22519BasicAuthUIPluginForm as FormData } from '@owlmeans/client-panel/auth/plugins'
|
|
2
|
+
import type { AuthenticationControl, AuthenticationRenderer } from '@owlmeans/client-auth/manager'
|
|
3
|
+
import type { AppContext } from '../types.js'
|
|
4
|
+
import type { ClientModule } from '@owlmeans/client-module'
|
|
5
|
+
import type { AuthRequest } from '@owlmeans/auth-common'
|
|
6
|
+
|
|
7
|
+
import { Ed22519BasicAuthUIPluginFormSchema as Schema } from '@owlmeans/client-panel/auth/plugins'
|
|
8
|
+
import { AuthenticationStage, DISPATCHER } from '@owlmeans/auth'
|
|
9
|
+
import { Form } from '../../components/form/index.js'
|
|
10
|
+
import { TextInput } from '../../components/form/text/index.js'
|
|
11
|
+
import { useCallback } from 'react'
|
|
12
|
+
import LinearProgress from '@mui/material/LinearProgress'
|
|
13
|
+
import { BlockScaling } from '@owlmeans/client-panel'
|
|
14
|
+
import { useContext } from '@owlmeans/web-client'
|
|
15
|
+
|
|
16
|
+
export const Ed22519BasicAuthUIPlugin: AuthenticationRenderer = ({ type, stage, control }) => {
|
|
17
|
+
const context = useContext()
|
|
18
|
+
const submit = useCallback(createSubmit(context as unknown as AppContext, control), [type])
|
|
19
|
+
|
|
20
|
+
const Content = useCallback(() => {
|
|
21
|
+
switch (stage) {
|
|
22
|
+
case AuthenticationStage.Authenticate:
|
|
23
|
+
return ['entityId', 'address', 'privateKey'].map(
|
|
24
|
+
name => <TextInput key={name} name={name} label />
|
|
25
|
+
)
|
|
26
|
+
default:
|
|
27
|
+
return <LinearProgress />
|
|
28
|
+
}
|
|
29
|
+
}, [stage])
|
|
30
|
+
|
|
31
|
+
return <Form decorate name="basic-ed25519" horizontal={BlockScaling.Wide}
|
|
32
|
+
i18n={{ ns: 'lib', resource: 'client-panel-auth' }}
|
|
33
|
+
validation={Schema} onSubmit={submit}>
|
|
34
|
+
<Content />
|
|
35
|
+
</Form>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const createSubmit = (context: AppContext, control: AuthenticationControl) => async (data: FormData) => {
|
|
39
|
+
const token = await control.authenticate({
|
|
40
|
+
entityId: data.entityId,
|
|
41
|
+
userId: data.address,
|
|
42
|
+
credential: data.privateKey
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
if (token.token === '') {
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const [url] = await context.module<ClientModule<string, AuthRequest>>(DISPATCHER)
|
|
50
|
+
.call({ query: token })
|
|
51
|
+
|
|
52
|
+
control.setStage?.(control.stage = AuthenticationStage.Authenticated)
|
|
53
|
+
// Give some time - that is really not cenessary - actually we need
|
|
54
|
+
// to do it on the layout finished its stuff.
|
|
55
|
+
// @TODO fix it for react native (we need some other solution for redirects context indepedent)
|
|
56
|
+
setTimeout(() => window.location.href = url, 100)
|
|
57
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import type { AuthenticationRenderer, ClientAuthType } from '@owlmeans/client-auth/manager'
|
|
3
|
+
import type { AuthenticationPlugin } from '@owlmeans/client-auth/manager/plugins'
|
|
4
|
+
import { AuthenticationType } from '@owlmeans/auth'
|
|
5
|
+
import { Ed22519BasicAuthUIPlugin } from './basic-ed25519.js'
|
|
6
|
+
import { ReCaptchaAuthUIPlugin } from './re-captcha.js'
|
|
7
|
+
import { TunnelConsumerUIPlugin } from './tunnel-consumer.js'
|
|
8
|
+
|
|
9
|
+
import { plugins as basicPlugins } from '@owlmeans/client-auth/manager'
|
|
10
|
+
|
|
11
|
+
basicPlugins[AuthenticationType.BasicEd25519].Renderer = Ed22519BasicAuthUIPlugin
|
|
12
|
+
basicPlugins[AuthenticationType.ReCaptcha].Renderer = ReCaptchaAuthUIPlugin
|
|
13
|
+
basicPlugins[AuthenticationType.WalletConsumer].Renderer = TunnelConsumerUIPlugin as AuthenticationRenderer
|
|
14
|
+
|
|
15
|
+
export const plugins: { [type: ClientAuthType]: AuthenticationPlugin } = basicPlugins
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { AuthenticationControl, AuthenticationRenderer } from '@owlmeans/client-auth/manager'
|
|
2
|
+
|
|
3
|
+
import LinearProgress from '@mui/material/LinearProgress'
|
|
4
|
+
import { AuthenticationStage, AuthorizationError, CMOD_RECAPTCHA, DISPATCHER, GUEST_ID } from '@owlmeans/auth'
|
|
5
|
+
import { useValue } from '@owlmeans/client'
|
|
6
|
+
import { PLUGINS } from '@owlmeans/client-context'
|
|
7
|
+
import ReCAPTCHA from 'react-google-recaptcha'
|
|
8
|
+
import { useCallback, useState } from 'react'
|
|
9
|
+
import { PanelContext } from '@owlmeans/client-panel'
|
|
10
|
+
import { Text } from '../../components/text.js'
|
|
11
|
+
import Stack from '@mui/material/Stack'
|
|
12
|
+
import Box from '@mui/material/Box'
|
|
13
|
+
import type { SxProps } from '@mui/material/styles'
|
|
14
|
+
import type { AppContext, Module } from '@owlmeans/web-client'
|
|
15
|
+
import { useContext } from '@owlmeans/web-client'
|
|
16
|
+
import type { AuthRequest } from '@owlmeans/auth-common'
|
|
17
|
+
|
|
18
|
+
export const ReCaptchaAuthUIPlugin: AuthenticationRenderer = ({ stage, control }) => {
|
|
19
|
+
const context = useContext()
|
|
20
|
+
const [loading, setLoading] = useState(true)
|
|
21
|
+
const config = useValue(() => context.getConfigResource(PLUGINS).get(CMOD_RECAPTCHA), [])
|
|
22
|
+
const finish = useCallback(createFinish(context, control), [])
|
|
23
|
+
|
|
24
|
+
const style: SxProps = {
|
|
25
|
+
maxWidth: { xs: '100%', sm: '100%', md: '50%' }
|
|
26
|
+
}
|
|
27
|
+
const loadingStyle: SxProps = {
|
|
28
|
+
width: { xs: '100%', sm: '100%', md: '50%' }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const content = () => {
|
|
32
|
+
switch (config?.value != null ? stage : null) {
|
|
33
|
+
case AuthenticationStage.Authenticate:
|
|
34
|
+
return <Stack direction="column" sx={style} justifyContent="center" alignItems="center">
|
|
35
|
+
<Text name="guideline" center />
|
|
36
|
+
<Box sx={{ pt: 2 }}>
|
|
37
|
+
<ReCAPTCHA sitekey={config?.value as string ?? ''} onChange={finish}
|
|
38
|
+
asyncScriptOnLoad={() => setLoading(false)} />
|
|
39
|
+
</Box>
|
|
40
|
+
</Stack>
|
|
41
|
+
default:
|
|
42
|
+
return <LinearProgress sx={loadingStyle} />
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return <PanelContext ns="lib" prefix="re-captcha" resource="client-panel-auth">
|
|
47
|
+
<Stack direction="column" justifyContent="center" alignItems="center">
|
|
48
|
+
{content()}
|
|
49
|
+
{loading && <LinearProgress sx={loadingStyle} />}
|
|
50
|
+
</Stack>
|
|
51
|
+
</PanelContext>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const createFinish = (context: AppContext, control: AuthenticationControl) => async (token: string | null) => {
|
|
55
|
+
if (token == null) {
|
|
56
|
+
throw new AuthorizationError('re-captcha-token')
|
|
57
|
+
}
|
|
58
|
+
const authToken = await control.authenticate({ credential: token, userId: GUEST_ID })
|
|
59
|
+
|
|
60
|
+
if (authToken.token === '') {
|
|
61
|
+
console.timeLog('empty token')
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
const [url] = await context.module<Module<string, AuthRequest>>(DISPATCHER)
|
|
65
|
+
.call({ query: authToken })
|
|
66
|
+
|
|
67
|
+
control.setStage?.(control.stage = AuthenticationStage.Authenticated)
|
|
68
|
+
|
|
69
|
+
// Give some time - that is really not cenessary - actually we need
|
|
70
|
+
// to do it on the layout finished its stuff.
|
|
71
|
+
// @TODO fix it for react native (we need some other solution for redirects context indepedent)
|
|
72
|
+
setTimeout(() => window.location.href = url, 100)
|
|
73
|
+
}
|