@prosopo/procaptcha-react 0.1.18 → 0.2.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/dist/components/CaptchaComponent.d.ts +13 -0
- package/dist/components/CaptchaComponent.d.ts.map +1 -0
- package/dist/components/CaptchaComponent.js +78 -0
- package/dist/components/CaptchaComponent.js.map +1 -0
- package/dist/components/CaptchaWidget.d.ts +8 -0
- package/dist/components/CaptchaWidget.d.ts.map +1 -0
- package/dist/components/CaptchaWidget.js +96 -0
- package/dist/components/CaptchaWidget.js.map +1 -0
- package/dist/components/ExtensionAccountSelect.d.ts +7 -0
- package/dist/components/ExtensionAccountSelect.d.ts.map +1 -0
- package/dist/components/ExtensionAccountSelect.js +45 -0
- package/dist/components/ExtensionAccountSelect.js.map +1 -0
- package/dist/components/Procaptcha.d.ts +11 -0
- package/dist/components/Procaptcha.d.ts.map +1 -0
- package/dist/components/Procaptcha.js +171 -0
- package/dist/components/Procaptcha.js.map +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +18 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/theme.d.ts +3 -0
- package/dist/components/theme.d.ts.map +1 -0
- package/dist/components/theme.js +23 -0
- package/dist/components/theme.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/util/index.d.ts +14 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +28 -0
- package/dist/util/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GetCaptchaResponse } from '@prosopo/api';
|
|
2
|
+
export interface CaptchaComponentProps {
|
|
3
|
+
challenge: GetCaptchaResponse;
|
|
4
|
+
index: number;
|
|
5
|
+
solutions: string[][];
|
|
6
|
+
onSubmit: () => void;
|
|
7
|
+
onCancel: () => void;
|
|
8
|
+
onClick: (hash: string) => void;
|
|
9
|
+
onNext: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare const CaptchaComponent: (props: CaptchaComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default CaptchaComponent;
|
|
13
|
+
//# sourceMappingURL=CaptchaComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CaptchaComponent.d.ts","sourceRoot":"","sources":["../../src/components/CaptchaComponent.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAOjD,MAAM,WAAW,qBAAqB;IAClC,SAAS,EAAE,kBAAkB,CAAA;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,EAAE,EAAE,CAAA;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,QAAA,MAAM,gBAAgB,UAAW,qBAAqB,4CAgIrD,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
import { Box, Button, ThemeProvider, Typography } from '@mui/material';
|
|
16
|
+
import { CaptchaWidget } from './CaptchaWidget.js';
|
|
17
|
+
import { at } from '@prosopo/util';
|
|
18
|
+
import { useTranslation } from '@prosopo/common';
|
|
19
|
+
import addDataAttr from '../util/index.js';
|
|
20
|
+
import theme from './theme.js';
|
|
21
|
+
const CaptchaComponent = (props) => {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const { challenge, index, solutions, onSubmit, onCancel, onClick, onNext } = props;
|
|
24
|
+
const captcha = at(challenge.captchas, index);
|
|
25
|
+
const solution = at(solutions, index);
|
|
26
|
+
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(Box, { sx: {
|
|
27
|
+
// center the popup horizontally and vertically
|
|
28
|
+
display: 'flex',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
// fill entire screen
|
|
32
|
+
width: '100%',
|
|
33
|
+
height: '100%',
|
|
34
|
+
}, children: _jsx(Box, { sx: {
|
|
35
|
+
// introduce scroll bars when screen < minWidth of children
|
|
36
|
+
overflowX: 'auto',
|
|
37
|
+
overflowY: 'auto',
|
|
38
|
+
width: '100%',
|
|
39
|
+
// limit the popup width
|
|
40
|
+
maxWidth: '450px',
|
|
41
|
+
// maxHeight introduces vertical scroll bars if children content longer than window
|
|
42
|
+
maxHeight: '100%',
|
|
43
|
+
}, children: _jsxs(Box, { bgcolor: theme.palette.background.default, sx: {
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'column',
|
|
46
|
+
// the min width of the popup before scroll bars appear
|
|
47
|
+
minWidth: '300px',
|
|
48
|
+
}, children: [_jsxs(Box, { px: 2, py: 3, sx: {
|
|
49
|
+
// center the header
|
|
50
|
+
display: 'flex',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
width: '100%',
|
|
53
|
+
}, bgcolor: theme.palette.primary.main, children: [_jsxs(Typography, { sx: {
|
|
54
|
+
color: '#ffffff',
|
|
55
|
+
fontWeight: 700,
|
|
56
|
+
}, children: [t('WIDGET.SELECT_ALL'), ': '] }), _jsx(Typography, { px: 1, sx: {
|
|
57
|
+
color: '#ffffff',
|
|
58
|
+
fontWeight: 700,
|
|
59
|
+
textTransform: 'uppercase',
|
|
60
|
+
fontSize: theme.typography.h6.fontSize,
|
|
61
|
+
}, children: `${at(props.challenge.captchas, props.index).captcha.target}` })] }), _jsx(Box, { ...addDataAttr({ dev: { cy: 'captcha-' + props.index } }), children: _jsx(CaptchaWidget, { challenge: captcha, solution: solution, onClick: onClick }) }), _jsx(Box, { px: 2, py: 1, sx: {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
justifyContent: 'center',
|
|
65
|
+
width: '100%',
|
|
66
|
+
}, ...addDataAttr({ dev: { cy: 'dots-captcha' } }), children: challenge.captchas.map((_, i) => (_jsx(Box, { sx: {
|
|
67
|
+
width: 7,
|
|
68
|
+
height: 7,
|
|
69
|
+
borderRadius: '50%',
|
|
70
|
+
border: '1px solid #CFCFCF',
|
|
71
|
+
}, mx: 0.5, bgcolor: index === i ? theme.palette.background.default : '#CFCFCF' }, i))) }), _jsxs(Box, { px: 2, pt: 0, pb: 2, sx: {
|
|
72
|
+
display: 'flex',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
justifyContent: 'space-between',
|
|
75
|
+
}, children: [_jsx(Button, { onClick: onCancel, variant: "text", children: t('WIDGET.CANCEL') }), _jsx(Button, { color: "primary", onClick: index < challenge.captchas.length - 1 ? onNext : onSubmit, variant: "contained", ...addDataAttr({ dev: { cy: 'button-next' } }), children: index < challenge.captchas.length - 1 ? t('WIDGET.NEXT') : t('WIDGET.SUBMIT') })] })] }) }) }) }));
|
|
76
|
+
};
|
|
77
|
+
export default CaptchaComponent;
|
|
78
|
+
//# sourceMappingURL=CaptchaComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,CAAC,YAE9C,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,GACzE,IACP,IACJ,GACJ,GACJ,GACM,CACnB,CAAA;AACL,CAAC,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CaptchaResponseCaptcha } from '@prosopo/procaptcha';
|
|
2
|
+
export interface CaptchaWidgetProps {
|
|
3
|
+
challenge: CaptchaResponseCaptcha;
|
|
4
|
+
solution: string[];
|
|
5
|
+
onClick: (hash: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function CaptchaWidget(props: CaptchaWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=CaptchaWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CaptchaWidget.d.ts","sourceRoot":"","sources":["../../src/components/CaptchaWidget.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAK5D,MAAM,WAAW,kBAAkB;IAC/B,SAAS,EAAE,sBAAsB,CAAA;IACjC,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC;AAkBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAgHtD"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
import { Box, Fade, useTheme } from '@mui/material';
|
|
16
|
+
import { default as CheckIcon } from '@mui/icons-material/Check.js';
|
|
17
|
+
const normalizeIcon = (Icon) => {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
19
|
+
return (Icon.default ? Icon.default : Icon);
|
|
20
|
+
};
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
+
// @ts-ignore https://github.com/mui/material-ui/issues/35535
|
|
23
|
+
const CheckIconNormalized = normalizeIcon(CheckIcon);
|
|
24
|
+
const getHash = (item) => {
|
|
25
|
+
if (!item.hash) {
|
|
26
|
+
throw new Error('item.hash is undefined');
|
|
27
|
+
}
|
|
28
|
+
return item.hash;
|
|
29
|
+
};
|
|
30
|
+
export function CaptchaWidget(props) {
|
|
31
|
+
// env
|
|
32
|
+
const { challenge, solution, onClick } = props;
|
|
33
|
+
const items = challenge.captcha.items;
|
|
34
|
+
const theme = useTheme();
|
|
35
|
+
const isTouchDevice = 'ontouchstart' in window;
|
|
36
|
+
return (_jsx(_Fragment, { children: _jsx(Box, { component: "div", pr: 0.5, pb: 0.5, sx: {
|
|
37
|
+
// expand to full height / width of parent
|
|
38
|
+
width: '100%',
|
|
39
|
+
height: '100%',
|
|
40
|
+
// display children in flex, spreading them evenly and wrapping when row length exceeded
|
|
41
|
+
display: 'flex',
|
|
42
|
+
flexDirection: 'row',
|
|
43
|
+
flexWrap: 'wrap',
|
|
44
|
+
}, children: items.map((item, index) => {
|
|
45
|
+
const hash = getHash(item);
|
|
46
|
+
return (_jsx(Box, { pt: 0.5, pl: 0.5, sx: {
|
|
47
|
+
// enable the items in the grid to grow in width to use up excess space
|
|
48
|
+
flexGrow: 1,
|
|
49
|
+
// make the width of each item 1/3rd of the width overall, i.e. 3 columns
|
|
50
|
+
flexBasis: '33.3333%',
|
|
51
|
+
// include the padding / margin / border in the width
|
|
52
|
+
boxSizing: 'border-box',
|
|
53
|
+
}, children: _jsxs(Box, { sx: { cursor: 'pointer', height: '100%', width: '100%' }, onClick: isTouchDevice ? undefined : () => onClick(hash), onTouchStart: isTouchDevice ? () => onClick(hash) : undefined, children: [_jsx(Box, { sx: { border: 1, borderColor: 'lightgray' }, children: _jsx("img", { style: {
|
|
54
|
+
width: '100%',
|
|
55
|
+
backgroundColor: 'lightgray',
|
|
56
|
+
opacity: solution.includes(hash) && isTouchDevice ? '50%' : '100%',
|
|
57
|
+
display: 'block',
|
|
58
|
+
objectFit: 'contain',
|
|
59
|
+
aspectRatio: '1/1', // force AR to be 1, letterboxing images with different aspect ratios
|
|
60
|
+
}, src: item.data, alt: `Captcha image ${index + 1}` }) }), _jsx(Fade, { in: solution.includes(hash), children: _jsx(Box, { sx: {
|
|
61
|
+
// relative to where the element _should_ be positioned
|
|
62
|
+
position: 'relative',
|
|
63
|
+
// make the overlay the full height/width of an item
|
|
64
|
+
width: '100%',
|
|
65
|
+
height: '100%',
|
|
66
|
+
// shift it up 100% to overlay the item element
|
|
67
|
+
top: '-100%',
|
|
68
|
+
// transition on opacity upon (de)selection
|
|
69
|
+
transitionDuration: '300ms',
|
|
70
|
+
transitionProperty: 'opacity',
|
|
71
|
+
}, children: _jsx(Box, { sx: {
|
|
72
|
+
// make the overlay absolute positioned compare to its container
|
|
73
|
+
position: 'absolute',
|
|
74
|
+
// spread across 100% width/height of the item box
|
|
75
|
+
top: 0,
|
|
76
|
+
left: 0,
|
|
77
|
+
bottom: 0,
|
|
78
|
+
right: 0,
|
|
79
|
+
height: '100%',
|
|
80
|
+
width: '100%',
|
|
81
|
+
// display overlays in center
|
|
82
|
+
display: 'flex',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
// make bg half opacity, i.e. shadowing the item's img
|
|
86
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
87
|
+
}, children: _jsx(CheckIconNormalized, { htmlColor: theme.palette.background.default, sx: {
|
|
88
|
+
// img must be displayed as block otherwise get's a bottom whitespace border
|
|
89
|
+
display: 'block',
|
|
90
|
+
// how big the overlay icon is
|
|
91
|
+
width: '35%',
|
|
92
|
+
height: '35%',
|
|
93
|
+
} }) }) }) })] }) }, index));
|
|
94
|
+
}) }) }));
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=CaptchaWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CaptchaWidget.js","sourceRoot":"","sources":["../../src/components/CaptchaWidget.tsx"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAUnE,MAAM,aAAa,GAAG,CAAC,IAAoB,EAAE,EAAE;IAC3C,sEAAsE;IACtE,OAAO,CAAE,IAAY,CAAC,OAAO,CAAC,CAAC,CAAE,IAAY,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAmB,CAAA;AACnF,CAAC,CAAA;AAED,6DAA6D;AAC7D,6DAA6D;AAC7D,MAAM,mBAAmB,GAAG,aAAa,CAAC,SAAS,CAAC,CAAA;AAEpD,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,EAAE,MAAM;4CACb,6BAA6B;4CAC7B,OAAO,EAAE,MAAM;4CACf,UAAU,EAAE,QAAQ;4CACpB,cAAc,EAAE,QAAQ;4CACxB,sDAAsD;4CACtD,eAAe,EAAE,iBAAiB;yCACrC,YAED,KAAC,mBAAmB,IAChB,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAC3C,EAAE,EAAE;gDACA,4EAA4E;gDAC5E,OAAO,EAAE,OAAO;gDAChB,8BAA8B;gDAC9B,KAAK,EAAE,KAAK;gDACZ,MAAM,EAAE,KAAK;6CAChB,GACH,GACA,GACJ,GACH,IACL,IApED,KAAK,CAqER,CACT,CAAA;YACL,CAAC,CAAC,GACA,GACP,CACN,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const ExtensionAccountSelect: ({ value, dappName, onChange, }: {
|
|
2
|
+
value?: string | undefined;
|
|
3
|
+
dappName: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default ExtensionAccountSelect;
|
|
7
|
+
//# sourceMappingURL=ExtensionAccountSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionAccountSelect.d.ts","sourceRoot":"","sources":["../../src/components/ExtensionAccountSelect.tsx"],"names":[],"mappings":"AAuBA,eAAO,MAAM,sBAAsB;;cAMrB,MAAM;sBACE,MAAM,KAAK,IAAI;6CAqCpC,CAAA;AAED,eAAe,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
import { Autocomplete, TextField } from '@mui/material';
|
|
16
|
+
import { useEffect, useState } from 'react';
|
|
17
|
+
import { useTranslation } from '@prosopo/common';
|
|
18
|
+
import { web3AccountsSubscribe, web3Enable } from '@polkadot/extension-dapp';
|
|
19
|
+
// import Autocomplete from '@mui/material/Autocomplete/Autocomplete.js'
|
|
20
|
+
// import TextField from '@mui/material/TextField/TextField.js'
|
|
21
|
+
export const ExtensionAccountSelect = ({ value, dappName, onChange, }) => {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const [accounts, setAccounts] = useState([]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const prom = web3Enable(dappName).then(() => {
|
|
26
|
+
return web3AccountsSubscribe(setAccounts);
|
|
27
|
+
});
|
|
28
|
+
return () => {
|
|
29
|
+
prom.then((unsub) => unsub());
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
const account = accounts.find((a) => a.address === value) || null;
|
|
33
|
+
return (_jsx(Autocomplete, { disablePortal: true, id: "select-account", options: accounts, value: account, isOptionEqualToValue: (option, value) => option.address === value.address, onChange: (event, value) => {
|
|
34
|
+
if (value) {
|
|
35
|
+
console.log('Selected account:', value);
|
|
36
|
+
onChange(value.address);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
console.log('Deselected account');
|
|
40
|
+
onChange('');
|
|
41
|
+
}
|
|
42
|
+
}, sx: { width: 550 }, getOptionLabel: (option) => `${option.meta.name}: ${option.address}`, renderInput: (props) => _jsx(TextField, { ...props, label: t('WIDGET.SELECT_ACCOUNT') }) }));
|
|
43
|
+
};
|
|
44
|
+
export default ExtensionAccountSelect;
|
|
45
|
+
//# sourceMappingURL=ExtensionAccountSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionAccountSelect.js","sourceRoot":"","sources":["../../src/components/ExtensionAccountSelect.tsx"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEvD,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE5E,wEAAwE;AACxE,+DAA+D;AAE/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACnC,KAAK,EACL,QAAQ,EACR,QAAQ,GAKX,EAAE,EAAE;IACD,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAA4B,EAAE,CAAC,CAAA;IAEvE,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACxC,OAAO,qBAAqB,CAAC,WAAW,CAAC,CAAA;QAC7C,CAAC,CAAC,CAAA;QACF,OAAO,GAAG,EAAE;YACR,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAA;QACjC,CAAC,CAAA;IACL,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,OAAO,GAAmC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,CAAC,IAAI,IAAI,CAAA;IAEjG,OAAO,CACH,KAAC,YAAY,IACT,aAAa,QACb,EAAE,EAAC,gBAAgB,EACnB,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,OAAO,EACd,oBAAoB,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,EACzE,QAAQ,EAAE,CAAC,KAAqC,EAAE,KAAqC,EAAE,EAAE;YACvF,IAAI,KAAK,EAAE;gBACP,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAA;gBACvC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;aAC1B;iBAAM;gBACH,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;gBACjC,QAAQ,CAAC,EAAE,CAAC,CAAA;aACf;QACL,CAAC,EACD,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,EAClB,cAAc,EAAE,CAAC,MAA+B,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,EAAE,EAC7F,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,SAAS,OAAK,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAC,GAAI,GACrF,CACL,CAAA;AACL,CAAC,CAAA;AAED,eAAe,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @jsxImportSource @emotion/react */
|
|
2
|
+
import { ProcaptchaCallbacks, ProcaptchaConfigOptional } from '@prosopo/procaptcha';
|
|
3
|
+
/**
|
|
4
|
+
* The props for the Procaptcha component.
|
|
5
|
+
*/
|
|
6
|
+
export interface ProcaptchaProps {
|
|
7
|
+
config: ProcaptchaConfigOptional;
|
|
8
|
+
callbacks?: Partial<ProcaptchaCallbacks>;
|
|
9
|
+
}
|
|
10
|
+
export declare const Procaptcha: (props: ProcaptchaProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=Procaptcha.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Procaptcha.d.ts","sourceRoot":"","sources":["../../src/components/Procaptcha.tsx"],"names":[],"mappings":"AAaA,sCAAsC;AACtC,OAAO,EAIH,mBAAmB,EACnB,wBAAwB,EAK3B,MAAM,qBAAqB,CAAA;AA2C5B;;GAEG;AACH,MAAM,WAAW,eAAe;IAE5B,MAAM,EAAE,wBAAwB,CAAA;IAEhC,SAAS,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;CAC3C;AAuED,eAAO,MAAM,UAAU,UAAW,eAAe,qDAwGhD,CAAA"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
/** @jsxImportSource @emotion/react */
|
|
16
|
+
import { Manager, } from '@prosopo/procaptcha';
|
|
17
|
+
import { Alert, Backdrop, CircularProgress } from '@mui/material';
|
|
18
|
+
import { Box, Checkbox, Link, Typography } from '@mui/material';
|
|
19
|
+
import { css } from '@emotion/react';
|
|
20
|
+
import { useRef, useState } from 'react';
|
|
21
|
+
import CaptchaComponent from './CaptchaComponent.js';
|
|
22
|
+
// import Box from '@mui/material/Box/Box.js'
|
|
23
|
+
// import Checkbox from '@mui/material/Checkbox/Checkbox.js'
|
|
24
|
+
// import Link from '@mui/material/Link/Link.js'
|
|
25
|
+
// import Typography from '@mui/material/Typography/Typography.js'
|
|
26
|
+
const logoStyle = css `
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: flex-end;
|
|
29
|
+
display: flex;
|
|
30
|
+
padding: 8px;
|
|
31
|
+
|
|
32
|
+
@media (max-width: 245px) {
|
|
33
|
+
&:nth-of-type(1),
|
|
34
|
+
&:nth-of-type(2) {
|
|
35
|
+
display: none;
|
|
36
|
+
} /* Both logos hidden */
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@media (min-width: 245px) and (max-width: 400px) {
|
|
40
|
+
&:nth-of-type(1) {
|
|
41
|
+
display: flex;
|
|
42
|
+
} /* logoWithText */
|
|
43
|
+
&:nth-of-type(2) {
|
|
44
|
+
display: none;
|
|
45
|
+
} /* logoWithoutText */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@media (min-width: 401px) {
|
|
49
|
+
&:nth-of-type(1) {
|
|
50
|
+
display: none;
|
|
51
|
+
} /* logoWithText */
|
|
52
|
+
&:nth-of-type(2) {
|
|
53
|
+
display: flex;
|
|
54
|
+
} /* logoWithoutText */
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
/**
|
|
58
|
+
* Wrap a ref to be the same format as useState.
|
|
59
|
+
* @param defaultValue the default value if the state is not already initialised
|
|
60
|
+
* @returns a ref in the same format as a state, e.g. [value, setValue]
|
|
61
|
+
*/
|
|
62
|
+
const useRefAsState = (defaultValue) => {
|
|
63
|
+
const ref = useRef(defaultValue);
|
|
64
|
+
const setter = (value) => {
|
|
65
|
+
ref.current = value;
|
|
66
|
+
};
|
|
67
|
+
const value = ref.current;
|
|
68
|
+
return [value, setter];
|
|
69
|
+
};
|
|
70
|
+
const useProcaptcha = () => {
|
|
71
|
+
// useRef == do not render on variable change
|
|
72
|
+
// useState == do render on variable change
|
|
73
|
+
// only need to render on visible variables changing
|
|
74
|
+
const [isHuman, setIsHuman] = useState(false);
|
|
75
|
+
const [index, setIndex] = useState(-1);
|
|
76
|
+
const [solutions, setSolutions] = useState([]);
|
|
77
|
+
const [captchaApi, setCaptchaApi] = useRefAsState(undefined);
|
|
78
|
+
const [showModal, setShowModal] = useState(false);
|
|
79
|
+
const [challenge, setChallenge] = useState(undefined);
|
|
80
|
+
const [loading, setLoading] = useState(false);
|
|
81
|
+
const [account, setAccount] = useState(undefined);
|
|
82
|
+
const [dappAccount, setDappAccount] = useState(undefined);
|
|
83
|
+
const [submission, setSubmission] = useRefAsState(undefined);
|
|
84
|
+
const [timeout, setTimeout] = useRefAsState(undefined);
|
|
85
|
+
const [blockNumber, setBlockNumber] = useRefAsState(undefined);
|
|
86
|
+
return [
|
|
87
|
+
// the state
|
|
88
|
+
{
|
|
89
|
+
isHuman,
|
|
90
|
+
index,
|
|
91
|
+
solutions,
|
|
92
|
+
captchaApi,
|
|
93
|
+
showModal,
|
|
94
|
+
challenge,
|
|
95
|
+
loading,
|
|
96
|
+
account,
|
|
97
|
+
dappAccount,
|
|
98
|
+
submission,
|
|
99
|
+
timeout,
|
|
100
|
+
blockNumber,
|
|
101
|
+
},
|
|
102
|
+
// and method to update the state
|
|
103
|
+
(nextState) => {
|
|
104
|
+
if (nextState.account !== undefined)
|
|
105
|
+
setAccount(nextState.account);
|
|
106
|
+
if (nextState.isHuman !== undefined)
|
|
107
|
+
setIsHuman(nextState.isHuman);
|
|
108
|
+
if (nextState.index !== undefined)
|
|
109
|
+
setIndex(nextState.index);
|
|
110
|
+
// force a copy of the array to ensure a re-render
|
|
111
|
+
// nutshell: react doesn't look inside an array for changes, hence changes to the array need to result in a fresh array
|
|
112
|
+
if (nextState.solutions !== undefined)
|
|
113
|
+
setSolutions(nextState.solutions.slice());
|
|
114
|
+
if (nextState.captchaApi !== undefined)
|
|
115
|
+
setCaptchaApi(nextState.captchaApi);
|
|
116
|
+
if (nextState.showModal !== undefined)
|
|
117
|
+
setShowModal(nextState.showModal);
|
|
118
|
+
if (nextState.challenge !== undefined)
|
|
119
|
+
setChallenge(nextState.challenge);
|
|
120
|
+
if (nextState.loading !== undefined)
|
|
121
|
+
setLoading(nextState.loading);
|
|
122
|
+
if (nextState.showModal !== undefined)
|
|
123
|
+
setShowModal(nextState.showModal);
|
|
124
|
+
if (nextState.dappAccount !== undefined)
|
|
125
|
+
setDappAccount(nextState.dappAccount);
|
|
126
|
+
if (nextState.submission !== undefined)
|
|
127
|
+
setSubmission(nextState.submission);
|
|
128
|
+
if (nextState.timeout !== undefined)
|
|
129
|
+
setTimeout(nextState.timeout);
|
|
130
|
+
if (nextState.blockNumber !== undefined)
|
|
131
|
+
setBlockNumber(nextState.blockNumber);
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
};
|
|
135
|
+
export const Procaptcha = (props) => {
|
|
136
|
+
console.log('config', props.config);
|
|
137
|
+
const config = props.config;
|
|
138
|
+
const callbacks = props.callbacks || {};
|
|
139
|
+
const [state, updateState] = useProcaptcha();
|
|
140
|
+
console.log('state', state);
|
|
141
|
+
const manager = Manager(config, state, updateState, callbacks);
|
|
142
|
+
const configSx = config.sx || { maxWidth: '400px', minWidth: '200px' };
|
|
143
|
+
return (_jsxs(Box, { sx: { maxWidth: '100%', maxHeight: '100%', overflowX: 'auto' }, children: [_jsx(Backdrop, { open: state.showModal, sx: { zIndex: (theme) => theme.zIndex.drawer + 1 }, children: state.challenge ? (_jsx(CaptchaComponent, { challenge: state.challenge, index: state.index, solutions: state.solutions, onSubmit: manager.submit, onCancel: manager.cancel, onClick: manager.select, onNext: manager.nextRound })) : (_jsx(Alert, { children: "No challenge set." })) }), _jsxs(Box, { p: 1, sx: [...(Array.isArray(configSx) ? configSx : [configSx])], "data-cy": 'button-human', children: [' ', _jsxs(Box, { p: 1, border: 1, borderColor: "grey.300", borderRadius: 2, sx: {
|
|
144
|
+
display: 'flex',
|
|
145
|
+
justifyContent: 'space-between',
|
|
146
|
+
alignItems: 'center',
|
|
147
|
+
flexWrap: 'wrap',
|
|
148
|
+
backgroundColor: 'white',
|
|
149
|
+
}, children: [_jsx(Box, { sx: { display: 'flex', flexDirection: 'column' }, children: _jsxs(Box, { sx: {
|
|
150
|
+
display: 'flex',
|
|
151
|
+
justifyContent: 'flex-start',
|
|
152
|
+
alignItems: 'center',
|
|
153
|
+
flexWrap: 'wrap',
|
|
154
|
+
}, children: [_jsxs(Box, { sx: {
|
|
155
|
+
height: '50px',
|
|
156
|
+
width: '50px',
|
|
157
|
+
display: 'flex',
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
justifyContent: 'center',
|
|
160
|
+
flexDirection: 'column',
|
|
161
|
+
}, children: [_jsx(Box, { sx: {
|
|
162
|
+
display: !state.loading ? 'block' : 'none',
|
|
163
|
+
}, children: _jsx(Checkbox, { onChange: manager.start, checked: state.isHuman, inputProps: { 'aria-label': 'controlled' }, sx: {
|
|
164
|
+
'& .MuiSvgIcon-root': { fontSize: 32 },
|
|
165
|
+
} }) }), _jsx(Box, { sx: {
|
|
166
|
+
display: state.loading ? 'block' : 'none',
|
|
167
|
+
}, children: _jsx(Box, { pt: '5px', children: _jsx(CircularProgress, { size: '24px', disableShrink: true }) }) })] }), _jsx(Box, { p: 1, children: _jsx(Typography, { color: "common.black", children: "I am a human" }) })] }) }), _jsx(Box, { children: _jsx(Link, { href: "https://prosopo.io", target: "_blank", children: _jsx(Box, { children: _jsxs("div", { children: [_jsx("div", { css: logoStyle, dangerouslySetInnerHTML: { __html: logoWithoutText } }), _jsx("div", { css: logoStyle, dangerouslySetInnerHTML: { __html: logoWithText } })] }) }) }) })] })] })] }));
|
|
168
|
+
};
|
|
169
|
+
const logoWithText = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2062.63 468.67" height="35px" width="140px"><defs><style>.cls-1{fill:#1d1d1b;}</style></defs><title>Prosopo Logo Black</title><path class="cls-1" d="M335.55,1825.19A147.75,147.75,0,0,1,483.3,1972.94h50.5c0-109.49-88.76-198.25-198.25-198.25v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M269.36,1891.39A147.74,147.74,0,0,1,417.1,2039.13h50.5c0-109.49-88.75-198.24-198.24-198.24v50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M414,2157.17a147.75,147.75,0,0,1-147.74-147.74h-50.5c0,109.49,88.75,198.24,198.24,198.24v-50.5Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M480.17,2091a147.74,147.74,0,0,1-147.74-147.75H281.92c0,109.49,88.76,198.25,198.25,198.25V2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M862.8,2017.5q-27.39,22.86-78.25,22.86h-65v112.19H654.82v-312h134q46.32,0,73.86,24.13t27.55,74.72Q890.2,1994.64,862.8,2017.5ZM813,1905.1q-12.37-10.36-34.7-10.38H719.59v91.87h58.75q22.32,0,34.7-11.22t12.39-35.56Q825.43,1915.48,813,1905.1Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1045.69,1916.42c.78.08,2.51.19,5.19.32v61.81c-3.81-.42-7.2-.71-10.16-.85s-5.36-.21-7.2-.21q-36.4,0-48.89,23.71-7,13.33-7,41.06v110.29H916.89V1921.82h57.58V1962q14-23.07,24.34-31.54,16.94-14.18,44-14.18C1044,1916.32,1044.92,1916.35,1045.69,1916.42Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1265.64,2124.32q-29.21,36.06-88.69,36.06t-88.69-36.06Q1059,2088.26,1059,2037.5q0-49.9,29.22-86.5t88.69-36.59q59.47,0,88.69,36.59t29.21,86.5Q1294.85,2088.26,1265.64,2124.32ZM1217.38,2091q14.17-18.81,14.18-53.48t-14.18-53.37q-14.19-18.7-40.64-18.71T1136,1984.13q-14.29,18.72-14.29,53.37T1136,2091q14.28,18.81,40.75,18.81T1217.38,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1371.81,2078.88q1.92,16.1,8.29,22.87,11.28,12.06,41.7,12.06,17.85,0,28.39-5.29t10.53-15.88a17.12,17.12,0,0,0-8.48-15.45q-8.49-5.28-63.12-18.2-39.33-9.73-55.41-24.35-16.08-14.39-16.09-41.49,0-32,25.14-54.93t70.75-23q43.26,0,70.53,17.25t31.29,59.59H1455q-1.27-11.64-6.58-18.42-10-12.27-34-12.28-19.74,0-28.13,6.14t-8.38,14.4c0,6.91,3,11.93,8.92,15q8.89,4.89,63,16.73,36,8.46,54.05,25.61,17.77,17.35,17.78,43.39,0,34.3-25.56,56t-79,21.7q-54.51,0-80.49-23t-26-58.53Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1745.54,2124.32q-29.22,36.06-88.7,36.06t-88.69-36.06q-29.2-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.7,36.59t29.21,86.5Q1774.75,2088.26,1745.54,2124.32ZM1697.27,2091q14.19-18.81,14.19-53.48t-14.19-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.28,53.37t14.28,53.48q14.3,18.81,40.75,18.81T1697.27,2091Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M1992.75,1946.59q28.24,29.84,28.23,87.63,0,61-27.58,92.93t-71.06,32q-27.69,0-46-13.76-10-7.62-19.6-22.23v120.24H1797V1921.82h57.79v34.08q9.79-15,20.88-23.71,20.23-15.43,48.15-15.45Q1964.53,1916.74,1992.75,1946.59Zm-46.3,43.39q-12.3-20.52-39.88-20.53-33.15,0-45.54,31.11-6.43,16.51-6.42,41.92,0,40.21,21.58,56.51,12.82,9.53,30.37,9.53,25.45,0,38.83-19.48t13.36-51.86Q1958.75,2010.51,1946.45,1990Z" transform="translate(-215.73 -1774.69)"/><path class="cls-1" d="M2249.14,2124.32q-29.2,36.06-88.69,36.06t-88.69-36.06q-29.22-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.69,36.59t29.22,86.5Q2278.36,2088.26,2249.14,2124.32ZM2200.88,2091q14.19-18.81,14.18-53.48t-14.18-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.29,53.37t14.29,53.48q14.3,18.81,40.75,18.81T2200.88,2091Z" transform="translate(-215.73 -1774.69)"/></svg>';
|
|
170
|
+
const logoWithoutText = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 260 348" height="35px"><path id="Vector" d="M95.7053 40.2707C127.005 40.2707 157.022 52.6841 179.154 74.78C201.286 96.8759 213.719 126.844 213.719 158.093H254.056C254.056 70.7808 183.16 -4.57764e-05 95.7053 -4.57764e-05V40.2707Z" fill="#000000"/><path id="Vector_2" d="M42.8365 93.0614C58.3333 93.0614 73.6784 96.1087 87.9955 102.029C102.313 107.95 115.322 116.628 126.279 127.568C137.237 138.508 145.93 151.496 151.86 165.79C157.79 180.084 160.843 195.404 160.843 210.875H201.179C201.179 123.564 130.291 52.7906 42.8365 52.7906V93.0614Z" fill="#000000"/><path id="Vector_3" d="M158.367 305.005C127.07 305.003 97.056 292.59 74.926 270.496C52.796 248.402 40.3626 218.437 40.3604 187.191H0.0239563C0.0239563 274.503 70.9123 345.276 158.367 345.276V305.005Z" fill="#000000"/><path id="Vector_4" d="M211.219 252.239C195.722 252.239 180.376 249.191 166.059 243.27C151.741 237.349 138.732 228.67 127.774 217.729C116.816 206.788 108.123 193.799 102.194 179.505C96.2637 165.21 93.2121 149.889 93.2132 134.417H52.8687C52.8687 221.729 123.765 292.509 211.219 292.509V252.239Z" fill="#000000"/></g><defs><clipPath id="clip0_1_2"><rect width="254" height="345" fill="white"/></clipPath></defs></svg>';
|
|
171
|
+
//# sourceMappingURL=Procaptcha.js.map
|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A,oBAAoB,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;yDACzC,GACH,GACA,EACN,KAAC,GAAG,IACA,EAAE,EAAE;wDACA,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;qDAC5C,YAED,KAAC,GAAG,IAAC,EAAE,EAAE,KAAK,YACV,KAAC,gBAAgB,IAAC,IAAI,EAAE,MAAM,EAAE,aAAa,SAAG,GAC9C,GACJ,IACJ,EACN,KAAC,GAAG,IAAC,CAAC,EAAE,CAAC,YACL,KAAC,UAAU,IAAC,KAAK,EAAC,cAAc,6BAA0B,GACxD,IACJ,GACJ,EACN,KAAC,GAAG,cACA,KAAC,IAAI,IAAC,IAAI,EAAC,oBAAoB,EAAC,MAAM,EAAC,QAAQ,YAC3C,KAAC,GAAG,cACA,0BACI,cAAK,GAAG,EAAE,SAAS,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,GAAI,EAC7E,cAAK,GAAG,EAAE,SAAS,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,GAAI,IACxE,GACJ,GACH,GACL,IACJ,IACJ,IACJ,CACT,CAAA;AACL,CAAC,CAAA;AAED,MAAM,YAAY,GACd,olHAAolH,CAAA;AAExlH,MAAM,eAAe,GACjB,2vCAA2vC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAC/E,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
export * from './CaptchaWidget.js';
|
|
15
|
+
export * from './CaptchaComponent.js';
|
|
16
|
+
export { default as ExtensionAccountSelect } from './ExtensionAccountSelect.js';
|
|
17
|
+
export * from './Procaptcha.js';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAC/E,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/components/theme.ts"],"names":[],"mappings":";AAeA,wBAOE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import { createTheme } from '@mui/material';
|
|
15
|
+
export default createTheme({
|
|
16
|
+
palette: {
|
|
17
|
+
primary: {
|
|
18
|
+
main: '#1976d2',
|
|
19
|
+
contrastText: '#fff',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/components/theme.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,eAAe,WAAW,CAAC;IACvB,OAAO,EAAE;QACL,OAAO,EAAE;YACL,IAAI,EAAE,SAAS;YACf,YAAY,EAAE,MAAM;SACvB;KACJ;CACJ,CAAC,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
export * from './components/index.js';
|
|
15
|
+
export * from './util/index.js';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* maps any data to data attributes (mapped to { data-[key]: value })
|
|
3
|
+
*
|
|
4
|
+
* dev - only in development mode
|
|
5
|
+
*/
|
|
6
|
+
export default function addDataAttr({ general, dev, }: {
|
|
7
|
+
general?: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
10
|
+
dev?: {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
};
|
|
13
|
+
}): {};
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAChC,OAAO,EACP,GAAG,GACN,EAAE;IACC,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACnC,GAAG,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAClC,MAKA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
function renameKeysForDataAttr(data = {}) {
|
|
15
|
+
return Object.keys(data).reduce((prev, curr) => ({ ...prev, [`data-${curr}`]: data[curr] }), {});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* maps any data to data attributes (mapped to { data-[key]: value })
|
|
19
|
+
*
|
|
20
|
+
* dev - only in development mode
|
|
21
|
+
*/
|
|
22
|
+
export default function addDataAttr({ general, dev, }) {
|
|
23
|
+
return {
|
|
24
|
+
...renameKeysForDataAttr(general),
|
|
25
|
+
...(process.env.NODE_ENV === 'development' ? renameKeysForDataAttr(dev) : {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,SAAS,qBAAqB,CAAC,OAAkC,EAAE;IAC/D,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AACpG,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAChC,OAAO,EACP,GAAG,GAIN;IACG,OAAO;QACH,GAAG,qBAAqB,CAAC,OAAO,CAAC;QACjC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAChF,CAAA;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/procaptcha-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"author": "PROSOPO LIMITED <info@prosopo.io>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"@polkadot/extension-dapp": "0.46.5",
|
|
25
25
|
"@polkadot/extension-inject": "0.46.5",
|
|
26
26
|
"@polkadot/types": "10.9.1",
|
|
27
|
-
"@prosopo/common": "
|
|
28
|
-
"@prosopo/procaptcha": "
|
|
27
|
+
"@prosopo/common": "0.2.0",
|
|
28
|
+
"@prosopo/procaptcha": "0.2.0",
|
|
29
29
|
"i18next": "^21.9.2",
|
|
30
30
|
"react": "^18.2.0",
|
|
31
31
|
"react-dom": "^18.2.0",
|