@prosopo/procaptcha-react 0.2.29 → 0.2.32
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/cjs/components/CaptchaComponent.cjs +41 -64
- package/dist/cjs/components/CaptchaWidget.cjs +37 -43
- package/dist/cjs/components/ExtensionAccountSelect.cjs +26 -26
- package/dist/cjs/components/Procaptcha.cjs +134 -140
- package/dist/cjs/components/theme.cjs +12 -27
- package/dist/components/CaptchaComponent.d.ts.map +1 -1
- package/dist/components/CaptchaComponent.js +43 -43
- package/dist/components/CaptchaComponent.js.map +1 -1
- package/dist/components/CaptchaPlaceholder.d.ts +6 -0
- package/dist/components/CaptchaPlaceholder.d.ts.map +1 -0
- package/dist/components/CaptchaPlaceholder.js +77 -0
- package/dist/components/CaptchaPlaceholder.js.map +1 -0
- package/dist/components/Procaptcha.d.ts +5 -6
- package/dist/components/Procaptcha.d.ts.map +1 -1
- package/dist/components/Procaptcha.js +6 -168
- package/dist/components/Procaptcha.js.map +1 -1
- package/dist/components/ProcaptchaWidget.d.ts +8 -0
- package/dist/components/ProcaptchaWidget.d.ts.map +1 -0
- package/dist/components/ProcaptchaWidget.js +170 -0
- package/dist/components/ProcaptchaWidget.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/package.json +7 -9
- package/dist/cjs/components/Button.cjs +0 -68
- package/dist/cjs/components/Checkbox.cjs +0 -56
- package/dist/cjs/components/LoadingSpinner.cjs +0 -30
- package/dist/cjs/components/Modal.cjs +0 -35
- package/dist/cjs/components/collector.cjs +0 -25
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
4
|
const procaptcha = require("@prosopo/procaptcha");
|
|
5
|
-
const
|
|
5
|
+
const material = require("@mui/material");
|
|
6
6
|
const react = require("@emotion/react");
|
|
7
7
|
const theme = require("./theme.cjs");
|
|
8
|
-
const
|
|
8
|
+
const react$1 = require("react");
|
|
9
9
|
const CaptchaComponent = require("./CaptchaComponent.cjs");
|
|
10
|
-
const Checkbox = require("./Checkbox.cjs");
|
|
11
|
-
const collector = require("./collector.cjs");
|
|
12
|
-
const Modal = require("./Modal.cjs");
|
|
13
10
|
const logoStyle = react.css`
|
|
14
11
|
align-items: center;
|
|
15
12
|
justify-content: flex-end;
|
|
@@ -42,7 +39,7 @@ const logoStyle = react.css`
|
|
|
42
39
|
}
|
|
43
40
|
`;
|
|
44
41
|
const useRefAsState = (defaultValue) => {
|
|
45
|
-
const ref =
|
|
42
|
+
const ref = react$1.useRef(defaultValue);
|
|
46
43
|
const setter = (value2) => {
|
|
47
44
|
ref.current = value2;
|
|
48
45
|
};
|
|
@@ -50,22 +47,21 @@ const useRefAsState = (defaultValue) => {
|
|
|
50
47
|
return [value, setter];
|
|
51
48
|
};
|
|
52
49
|
const useProcaptcha = () => {
|
|
53
|
-
const [isHuman, setIsHuman] =
|
|
54
|
-
const [index, setIndex] =
|
|
55
|
-
const [solutions, setSolutions] =
|
|
50
|
+
const [isHuman, setIsHuman] = react$1.useState(false);
|
|
51
|
+
const [index, setIndex] = react$1.useState(0);
|
|
52
|
+
const [solutions, setSolutions] = react$1.useState([]);
|
|
56
53
|
const [captchaApi, setCaptchaApi] = useRefAsState(void 0);
|
|
57
|
-
const [showModal, setShowModal] =
|
|
58
|
-
const [challenge, setChallenge] =
|
|
59
|
-
const [loading, setLoading] =
|
|
60
|
-
const [account, setAccount] =
|
|
61
|
-
const [dappAccount, setDappAccount] =
|
|
54
|
+
const [showModal, setShowModal] = react$1.useState(false);
|
|
55
|
+
const [challenge, setChallenge] = react$1.useState(void 0);
|
|
56
|
+
const [loading, setLoading] = react$1.useState(false);
|
|
57
|
+
const [account, setAccount] = react$1.useState(void 0);
|
|
58
|
+
const [dappAccount, setDappAccount] = react$1.useState(void 0);
|
|
62
59
|
const [submission, setSubmission] = useRefAsState(void 0);
|
|
63
60
|
const [timeout, setTimeout] = useRefAsState(void 0);
|
|
64
61
|
const [blockNumber, setBlockNumber] = useRefAsState(void 0);
|
|
65
62
|
const [successfullChallengeTimeout, setSuccessfullChallengeTimeout] = useRefAsState(
|
|
66
63
|
void 0
|
|
67
64
|
);
|
|
68
|
-
const [sendData, setSendData] = React.useState(false);
|
|
69
65
|
return [
|
|
70
66
|
// the state
|
|
71
67
|
{
|
|
@@ -81,8 +77,7 @@ const useProcaptcha = () => {
|
|
|
81
77
|
submission,
|
|
82
78
|
timeout,
|
|
83
79
|
blockNumber,
|
|
84
|
-
successfullChallengeTimeout
|
|
85
|
-
sendData
|
|
80
|
+
successfullChallengeTimeout
|
|
86
81
|
},
|
|
87
82
|
// and method to update the state
|
|
88
83
|
(nextState) => {
|
|
@@ -114,8 +109,6 @@ const useProcaptcha = () => {
|
|
|
114
109
|
setSuccessfullChallengeTimeout(nextState.timeout);
|
|
115
110
|
if (nextState.blockNumber !== void 0)
|
|
116
111
|
setBlockNumber(nextState.blockNumber);
|
|
117
|
-
if (nextState.sendData !== void 0)
|
|
118
|
-
setSendData(nextState.sendData);
|
|
119
112
|
}
|
|
120
113
|
];
|
|
121
114
|
};
|
|
@@ -126,133 +119,134 @@ const Procaptcha = (props) => {
|
|
|
126
119
|
const [state, updateState] = useProcaptcha();
|
|
127
120
|
console.log("state", state);
|
|
128
121
|
const manager = procaptcha.Manager(config, state, updateState, callbacks);
|
|
129
|
-
const
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
122
|
+
const configSx = { maxWidth: "400px", minWidth: "200px" };
|
|
123
|
+
const theme$1 = react$1.useMemo(() => props.config.theme === "light" ? theme.lightTheme : theme.darkTheme, [props.config.theme]);
|
|
124
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.ThemeProvider, { theme: theme$1, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: [
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Backdrop, { open: state.showModal, sx: { zIndex: 2147483647 }, children: state.challenge ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
126
|
+
CaptchaComponent,
|
|
127
|
+
{
|
|
128
|
+
challenge: state.challenge,
|
|
129
|
+
index: state.index,
|
|
130
|
+
solutions: state.solutions,
|
|
131
|
+
onSubmit: manager.submit,
|
|
132
|
+
onCancel: manager.cancel,
|
|
133
|
+
onClick: manager.select,
|
|
134
|
+
onNext: manager.nextRound,
|
|
135
|
+
themeColor: config.theme ?? "light"
|
|
136
|
+
}
|
|
137
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(material.Alert, { children: "No challenge set." }) }),
|
|
138
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { p: 0, sx: [...Array.isArray(configSx) ? configSx : [configSx]], "data-cy": "button-human", children: [
|
|
139
|
+
" ",
|
|
140
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
141
|
+
material.Box,
|
|
138
142
|
{
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
143
|
+
p: 1,
|
|
144
|
+
border: 1,
|
|
145
|
+
bgcolor: theme$1.palette.background.default,
|
|
146
|
+
borderColor: theme$1.palette.grey[300],
|
|
147
|
+
borderRadius: 2,
|
|
148
|
+
sx: {
|
|
149
|
+
display: "flex",
|
|
150
|
+
justifyContent: "space-between",
|
|
151
|
+
alignItems: "center",
|
|
152
|
+
flexWrap: "wrap"
|
|
153
|
+
},
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
156
|
+
material.Box,
|
|
157
|
+
{
|
|
158
|
+
sx: {
|
|
159
|
+
display: "flex",
|
|
160
|
+
justifyContent: "flex-start",
|
|
161
|
+
alignItems: "center",
|
|
162
|
+
flexWrap: "wrap"
|
|
163
|
+
},
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
166
|
+
material.Box,
|
|
167
|
+
{
|
|
168
|
+
sx: {
|
|
169
|
+
height: "50px",
|
|
170
|
+
width: "50px",
|
|
171
|
+
display: "flex",
|
|
172
|
+
alignItems: "center",
|
|
173
|
+
justifyContent: "center",
|
|
174
|
+
flexDirection: "column"
|
|
175
|
+
},
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
178
|
+
material.Box,
|
|
179
|
+
{
|
|
180
|
+
sx: {
|
|
181
|
+
display: !state.loading ? "block" : "none"
|
|
182
|
+
},
|
|
183
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
184
|
+
material.Checkbox,
|
|
185
|
+
{
|
|
186
|
+
onChange: manager.start,
|
|
187
|
+
checked: state.isHuman,
|
|
188
|
+
inputProps: { "aria-label": "controlled" },
|
|
189
|
+
sx: {
|
|
190
|
+
"& .MuiSvgIcon-root": { fontSize: 32, position: "relative" },
|
|
191
|
+
"& .PrivateSwitchBase-input": {
|
|
192
|
+
width: "1.4em",
|
|
193
|
+
height: "1.4em",
|
|
194
|
+
top: "auto",
|
|
195
|
+
left: "auto",
|
|
196
|
+
opacity: "1",
|
|
197
|
+
"&::before": {
|
|
198
|
+
content: '""',
|
|
199
|
+
position: "absolute",
|
|
200
|
+
height: "100%",
|
|
201
|
+
width: "100%"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
210
|
+
material.Box,
|
|
211
|
+
{
|
|
212
|
+
sx: {
|
|
213
|
+
display: state.loading ? "block" : "none"
|
|
214
|
+
},
|
|
215
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { pt: "5px", children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: "24px", disableShrink: true }) })
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { p: 1, children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { color: theme$1.palette.primary.contrastText, children: "I am a human" }) })
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
) }),
|
|
225
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(material.Link, { href: "https://prosopo.io", target: "_blank", children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
226
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
167
227
|
"div",
|
|
168
228
|
{
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
flexWrap: "wrap"
|
|
174
|
-
},
|
|
175
|
-
children: [
|
|
176
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
177
|
-
"div",
|
|
178
|
-
{
|
|
179
|
-
style: {
|
|
180
|
-
height: "50px",
|
|
181
|
-
width: "50px",
|
|
182
|
-
display: "flex",
|
|
183
|
-
alignItems: "center",
|
|
184
|
-
justifyContent: "center",
|
|
185
|
-
flexDirection: "column",
|
|
186
|
-
verticalAlign: "middle"
|
|
187
|
-
},
|
|
188
|
-
children: [
|
|
189
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
190
|
-
"div",
|
|
191
|
-
{
|
|
192
|
-
style: {
|
|
193
|
-
display: !state.loading ? "flex" : "none"
|
|
194
|
-
},
|
|
195
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
196
|
-
Checkbox,
|
|
197
|
-
{
|
|
198
|
-
themeColor,
|
|
199
|
-
onChange: manager.start,
|
|
200
|
-
checked: state.isHuman
|
|
201
|
-
}
|
|
202
|
-
)
|
|
203
|
-
}
|
|
204
|
-
),
|
|
205
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
206
|
-
"div",
|
|
207
|
-
{
|
|
208
|
-
style: {
|
|
209
|
-
display: state.loading ? "flex" : "none"
|
|
210
|
-
},
|
|
211
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner.LoadingSpinner, { themeColor }) })
|
|
212
|
-
}
|
|
213
|
-
)
|
|
214
|
-
]
|
|
215
|
-
}
|
|
216
|
-
),
|
|
217
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: theme$1.palette.background.contrastText, paddingLeft: "4px" }, children: "I am a human" }) })
|
|
218
|
-
]
|
|
229
|
+
css: logoStyle,
|
|
230
|
+
dangerouslySetInnerHTML: {
|
|
231
|
+
__html: props.config.theme === "light" ? logoWithoutTextBlack : logoWithoutTextWhite
|
|
232
|
+
}
|
|
219
233
|
}
|
|
220
|
-
)
|
|
221
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
222
|
-
"
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
236
|
+
"div",
|
|
223
237
|
{
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
229
|
-
"div",
|
|
230
|
-
{
|
|
231
|
-
css: logoStyle,
|
|
232
|
-
dangerouslySetInnerHTML: {
|
|
233
|
-
__html: props.config.theme === "light" ? logoWithoutTextBlack : logoWithoutTextWhite
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
),
|
|
237
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
238
|
-
"div",
|
|
239
|
-
{
|
|
240
|
-
css: logoStyle,
|
|
241
|
-
dangerouslySetInnerHTML: {
|
|
242
|
-
__html: props.config.theme === "light" ? logoWithTextBlack : logoWithTextWhite
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
)
|
|
246
|
-
] }) })
|
|
238
|
+
css: logoStyle,
|
|
239
|
+
dangerouslySetInnerHTML: {
|
|
240
|
+
__html: props.config.theme === "light" ? logoWithTextBlack : logoWithTextWhite
|
|
241
|
+
}
|
|
247
242
|
}
|
|
248
|
-
)
|
|
249
|
-
]
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
] })
|
|
254
|
-
|
|
255
|
-
] });
|
|
243
|
+
)
|
|
244
|
+
] }) }) }) })
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
] })
|
|
249
|
+
] }) });
|
|
256
250
|
};
|
|
257
251
|
const logoWithTextBlack = '<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>';
|
|
258
252
|
const logoWithTextWhite = '<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:#fff;}</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>';
|
|
@@ -1,44 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
100: "#f5f5f5",
|
|
6
|
-
200: "#eeeeee",
|
|
7
|
-
300: "#e0e0e0",
|
|
8
|
-
400: "#bdbdbd",
|
|
9
|
-
500: "#9e9e9e",
|
|
10
|
-
600: "#757575",
|
|
11
|
-
700: "#616161",
|
|
12
|
-
800: "#424242",
|
|
13
|
-
900: "#212121"
|
|
14
|
-
};
|
|
15
|
-
const lightTheme = {
|
|
3
|
+
const material = require("@mui/material");
|
|
4
|
+
const lightTheme = material.createTheme({
|
|
16
5
|
palette: {
|
|
17
6
|
mode: "light",
|
|
18
7
|
primary: {
|
|
19
|
-
main: "#
|
|
20
|
-
contrastText: "#fff"
|
|
21
|
-
},
|
|
22
|
-
background: {
|
|
23
|
-
default: "#fff",
|
|
8
|
+
main: "#1976d2",
|
|
24
9
|
contrastText: "#000"
|
|
25
10
|
},
|
|
26
|
-
|
|
11
|
+
background: {
|
|
12
|
+
default: "#fff"
|
|
13
|
+
}
|
|
27
14
|
}
|
|
28
|
-
};
|
|
29
|
-
const darkTheme = {
|
|
15
|
+
});
|
|
16
|
+
const darkTheme = material.createTheme({
|
|
30
17
|
palette: {
|
|
31
18
|
mode: "dark",
|
|
32
19
|
primary: {
|
|
33
|
-
main: "#
|
|
20
|
+
main: "#1976d2",
|
|
34
21
|
contrastText: "#fff"
|
|
35
22
|
},
|
|
36
23
|
background: {
|
|
37
|
-
default: "#303030"
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
grey
|
|
24
|
+
default: "#303030"
|
|
25
|
+
}
|
|
41
26
|
}
|
|
42
|
-
};
|
|
27
|
+
});
|
|
43
28
|
exports.darkTheme = darkTheme;
|
|
44
29
|
exports.lightTheme = lightTheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaptchaComponent.d.ts","sourceRoot":"","sources":["../../src/components/CaptchaComponent.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAQjD,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;IAClB,UAAU,EAAE,OAAO,GAAG,MAAM,CAAA;CAC/B;AAED,QAAA,MAAM,gBAAgB,sFASnB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"CaptchaComponent.d.ts","sourceRoot":"","sources":["../../src/components/CaptchaComponent.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAQjD,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;IAClB,UAAU,EAAE,OAAO,GAAG,MAAM,CAAA;CAC/B;AAED,QAAA,MAAM,gBAAgB,sFASnB,qBAAqB,qDA8GvB,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { CaptchaWidget } from './CaptchaWidget.js';
|
|
3
|
+
import { Suspense, useMemo } from 'react';
|
|
3
4
|
import { at } from '@prosopo/util';
|
|
4
5
|
import { darkTheme, lightTheme } from './theme.js';
|
|
5
|
-
import { useMemo } from 'react';
|
|
6
6
|
import { useTranslation } from '@prosopo/common';
|
|
7
7
|
import Button from './Button.js';
|
|
8
8
|
import addDataAttr from '../util/index.js';
|
|
@@ -11,50 +11,50 @@ const CaptchaComponent = ({ challenge, index, solutions, onSubmit, onCancel, onC
|
|
|
11
11
|
const captcha = challenge.captchas ? at(challenge.captchas, index) : null;
|
|
12
12
|
const solution = solutions ? at(solutions, index) : [];
|
|
13
13
|
const theme = useMemo(() => (themeColor === 'light' ? lightTheme : darkTheme), [themeColor]);
|
|
14
|
-
return (_jsx("div", { style: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
display: 'flex',
|
|
21
|
-
flexDirection: 'column',
|
|
22
|
-
}, children: _jsxs("div", { style: {
|
|
23
|
-
backgroundColor: theme.palette.background.default,
|
|
14
|
+
return (_jsx(Suspense, { fallback: _jsx("div", { children: "Loading..." }), children: _jsx("div", { style: {
|
|
15
|
+
overflowX: 'auto',
|
|
16
|
+
overflowY: 'auto',
|
|
17
|
+
width: '100%',
|
|
18
|
+
maxWidth: '500px',
|
|
19
|
+
maxHeight: '100%',
|
|
24
20
|
display: 'flex',
|
|
25
21
|
flexDirection: 'column',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
22
|
+
}, children: _jsxs("div", { style: {
|
|
23
|
+
backgroundColor: theme.palette.background.default,
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
minWidth: '300px',
|
|
27
|
+
}, children: [_jsxs("div", { style: {
|
|
28
|
+
display: 'flex',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
width: '100%',
|
|
31
|
+
backgroundColor: theme.palette.primary.main,
|
|
32
|
+
padding: '24px 16px',
|
|
33
|
+
}, children: [_jsxs("p", { style: {
|
|
34
|
+
color: '#ffffff',
|
|
35
|
+
fontWeight: 700,
|
|
36
|
+
lineHeight: 1.5,
|
|
37
|
+
}, children: [t('WIDGET.SELECT_ALL'), ': '] }), _jsx("p", { style: {
|
|
38
|
+
color: '#ffffff',
|
|
39
|
+
fontWeight: 700,
|
|
40
|
+
textTransform: 'capitalize',
|
|
41
|
+
lineHeight: 1.5,
|
|
42
|
+
}, children: `${at(challenge.captchas, index).captcha.target}` })] }), _jsx("div", { ...addDataAttr({ dev: { cy: 'captcha-' + index } }), children: captcha && (_jsx(CaptchaWidget, { challenge: captcha, solution: solution, onClick: onClick, themeColor: themeColor })) }), _jsx("div", { style: {
|
|
43
|
+
display: 'flex',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
justifyContent: 'center',
|
|
46
|
+
width: '100%',
|
|
47
|
+
}, ...addDataAttr({ dev: { cy: 'dots-captcha' } }) }), _jsx("div", { style: {
|
|
48
|
+
padding: '8px 16px',
|
|
49
|
+
display: 'flex',
|
|
50
|
+
width: '100%',
|
|
51
|
+
} }), _jsxs("div", { style: {
|
|
52
|
+
padding: '0 16px 16px',
|
|
53
|
+
display: 'flex',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
justifyContent: 'space-between',
|
|
56
|
+
lineHeight: 1.75,
|
|
57
|
+
}, children: [_jsx(Button, { themeColor: themeColor, buttonType: "cancel", onClick: onCancel, text: t('WIDGET.CANCEL') }), _jsx(Button, { themeColor: themeColor, buttonType: "next", text: index < challenge.captchas.length - 1 ? t('WIDGET.NEXT') : t('WIDGET.SUBMIT'), onClick: index < challenge.captchas.length - 1 ? onNext : onSubmit })] })] }) }) }));
|
|
58
58
|
};
|
|
59
59
|
export default CaptchaComponent;
|
|
60
60
|
//# sourceMappingURL=CaptchaComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaptchaComponent.js","sourceRoot":"","sources":["../../src/components/CaptchaComponent.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,EAAE,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CaptchaComponent.js","sourceRoot":"","sources":["../../src/components/CaptchaComponent.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,WAAW,M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