@prosopo/procaptcha-react 0.2.38 → 0.2.40
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/CaptchaWidget.cjs +3 -1
- package/dist/cjs/components/Modal.cjs +6 -24
- package/dist/cjs/style/Modal.css +41 -0
- package/dist/components/Button.js +65 -55
- package/dist/components/CaptchaComponent.js +156 -59
- package/dist/components/CaptchaPlaceholder.js +97 -42
- package/dist/components/CaptchaWidget.js +144 -65
- package/dist/components/Checkbox.js +45 -31
- package/dist/components/ExtensionAccountSelect.js +47 -30
- package/dist/components/LoadingSpinner.js +12 -10
- package/dist/components/Modal.js +16 -33
- package/dist/components/Procaptcha.js +8 -7
- package/dist/components/ProcaptchaWidget.js +221 -130
- package/dist/components/collector.js +24 -23
- package/dist/components/index.js +11 -7
- package/dist/components/theme.js +38 -35
- package/dist/index.d.ts +42 -3
- package/dist/index.js +12 -3
- package/dist/style/Modal.css +41 -0
- package/dist/util/index.js +12 -7
- package/package.json +9 -8
- package/public/style/Modal.css +41 -0
- package/vite.config.ts +22 -0
- package/dist/components/Button.d.ts +0 -10
- package/dist/components/Button.d.ts.map +0 -1
- package/dist/components/Button.js.map +0 -1
- package/dist/components/CaptchaComponent.d.ts +0 -14
- package/dist/components/CaptchaComponent.d.ts.map +0 -1
- package/dist/components/CaptchaComponent.js.map +0 -1
- package/dist/components/CaptchaPlaceholder.d.ts +0 -6
- package/dist/components/CaptchaPlaceholder.d.ts.map +0 -1
- package/dist/components/CaptchaPlaceholder.js.map +0 -1
- package/dist/components/CaptchaWidget.d.ts +0 -9
- package/dist/components/CaptchaWidget.d.ts.map +0 -1
- package/dist/components/CaptchaWidget.js.map +0 -1
- package/dist/components/Checkbox.d.ts +0 -9
- package/dist/components/Checkbox.d.ts.map +0 -1
- package/dist/components/Checkbox.js.map +0 -1
- package/dist/components/ExtensionAccountSelect.d.ts +0 -7
- package/dist/components/ExtensionAccountSelect.d.ts.map +0 -1
- package/dist/components/ExtensionAccountSelect.js.map +0 -1
- package/dist/components/LoadingSpinner.d.ts +0 -6
- package/dist/components/LoadingSpinner.d.ts.map +0 -1
- package/dist/components/LoadingSpinner.js.map +0 -1
- package/dist/components/Modal.d.ts +0 -8
- package/dist/components/Modal.d.ts.map +0 -1
- package/dist/components/Modal.js.map +0 -1
- package/dist/components/Procaptcha.d.ts +0 -6
- package/dist/components/Procaptcha.d.ts.map +0 -1
- package/dist/components/Procaptcha.js.map +0 -1
- package/dist/components/ProcaptchaWidget.d.ts +0 -8
- package/dist/components/ProcaptchaWidget.d.ts.map +0 -1
- package/dist/components/ProcaptchaWidget.js.map +0 -1
- package/dist/components/collector.d.ts +0 -8
- package/dist/components/collector.d.ts.map +0 -1
- package/dist/components/collector.js.map +0 -1
- package/dist/components/index.d.ts +0 -7
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/theme.d.ts +0 -51
- package/dist/components/theme.d.ts.map +0 -1
- package/dist/components/theme.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/util/index.d.ts +0 -9
- package/dist/util/index.d.ts.map +0 -1
- package/dist/util/index.js.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Manager
|
|
3
|
-
import { LoadingSpinner } from
|
|
4
|
-
import { css } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import CaptchaComponent from
|
|
8
|
-
import Checkbox from
|
|
9
|
-
import Collector from
|
|
10
|
-
import
|
|
11
|
-
const logoStyle = css
|
|
1
|
+
import { jsxs, jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Manager } from "@prosopo/procaptcha";
|
|
3
|
+
import { LoadingSpinner } from "./LoadingSpinner.js";
|
|
4
|
+
import { css } from "@emotion/react";
|
|
5
|
+
import { lightTheme, darkTheme } from "./theme.js";
|
|
6
|
+
import { useRef, useState, useMemo } from "react";
|
|
7
|
+
import CaptchaComponent from "./CaptchaComponent.js";
|
|
8
|
+
import Checkbox from "./Checkbox.js";
|
|
9
|
+
import Collector from "./collector.js";
|
|
10
|
+
import ModalComponent from "./Modal.js";
|
|
11
|
+
const logoStyle = css`
|
|
12
12
|
align-items: center;
|
|
13
13
|
justify-content: flex-end;
|
|
14
14
|
display: flex;
|
|
@@ -40,131 +40,222 @@ const logoStyle = css `
|
|
|
40
40
|
}
|
|
41
41
|
`;
|
|
42
42
|
const useRefAsState = (defaultValue) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
const ref = useRef(defaultValue);
|
|
44
|
+
const setter = (value2) => {
|
|
45
|
+
ref.current = value2;
|
|
46
|
+
};
|
|
47
|
+
const value = ref.current;
|
|
48
|
+
return [value, setter];
|
|
49
49
|
};
|
|
50
50
|
const useProcaptcha = () => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
51
|
+
const [isHuman, setIsHuman] = useState(false);
|
|
52
|
+
const [index, setIndex] = useState(0);
|
|
53
|
+
const [solutions, setSolutions] = useState([]);
|
|
54
|
+
const [captchaApi, setCaptchaApi] = useRefAsState(void 0);
|
|
55
|
+
const [showModal, setShowModal] = useState(false);
|
|
56
|
+
const [challenge, setChallenge] = useState(void 0);
|
|
57
|
+
const [loading, setLoading] = useState(false);
|
|
58
|
+
const [account, setAccount] = useState(void 0);
|
|
59
|
+
const [dappAccount, setDappAccount] = useState(void 0);
|
|
60
|
+
const [submission, setSubmission] = useRefAsState(void 0);
|
|
61
|
+
const [timeout, setTimeout] = useRefAsState(void 0);
|
|
62
|
+
const [blockNumber, setBlockNumber] = useRefAsState(void 0);
|
|
63
|
+
const [successfullChallengeTimeout, setSuccessfullChallengeTimeout] = useRefAsState(
|
|
64
|
+
void 0
|
|
65
|
+
);
|
|
66
|
+
const [sendData, setSendData] = useState(false);
|
|
67
|
+
return [
|
|
68
|
+
// the state
|
|
69
|
+
{
|
|
70
|
+
isHuman,
|
|
71
|
+
index,
|
|
72
|
+
solutions,
|
|
73
|
+
captchaApi,
|
|
74
|
+
showModal,
|
|
75
|
+
challenge,
|
|
76
|
+
loading,
|
|
77
|
+
account,
|
|
78
|
+
dappAccount,
|
|
79
|
+
submission,
|
|
80
|
+
timeout,
|
|
81
|
+
blockNumber,
|
|
82
|
+
successfullChallengeTimeout,
|
|
83
|
+
sendData
|
|
84
|
+
},
|
|
85
|
+
// and method to update the state
|
|
86
|
+
(nextState) => {
|
|
87
|
+
if (nextState.account !== void 0)
|
|
88
|
+
setAccount(nextState.account);
|
|
89
|
+
if (nextState.isHuman !== void 0)
|
|
90
|
+
setIsHuman(nextState.isHuman);
|
|
91
|
+
if (nextState.index !== void 0)
|
|
92
|
+
setIndex(nextState.index);
|
|
93
|
+
if (nextState.solutions !== void 0)
|
|
94
|
+
setSolutions(nextState.solutions.slice());
|
|
95
|
+
if (nextState.captchaApi !== void 0)
|
|
96
|
+
setCaptchaApi(nextState.captchaApi);
|
|
97
|
+
if (nextState.showModal !== void 0)
|
|
98
|
+
setShowModal(nextState.showModal);
|
|
99
|
+
if (nextState.challenge !== void 0)
|
|
100
|
+
setChallenge(nextState.challenge);
|
|
101
|
+
if (nextState.loading !== void 0)
|
|
102
|
+
setLoading(nextState.loading);
|
|
103
|
+
if (nextState.showModal !== void 0)
|
|
104
|
+
setShowModal(nextState.showModal);
|
|
105
|
+
if (nextState.dappAccount !== void 0)
|
|
106
|
+
setDappAccount(nextState.dappAccount);
|
|
107
|
+
if (nextState.submission !== void 0)
|
|
108
|
+
setSubmission(nextState.submission);
|
|
109
|
+
if (nextState.timeout !== void 0)
|
|
110
|
+
setTimeout(nextState.timeout);
|
|
111
|
+
if (nextState.successfullChallengeTimeout !== void 0)
|
|
112
|
+
setSuccessfullChallengeTimeout(nextState.timeout);
|
|
113
|
+
if (nextState.blockNumber !== void 0)
|
|
114
|
+
setBlockNumber(nextState.blockNumber);
|
|
115
|
+
if (nextState.sendData !== void 0)
|
|
116
|
+
setSendData(nextState.sendData);
|
|
117
|
+
}
|
|
118
|
+
];
|
|
115
119
|
};
|
|
116
120
|
const ProcaptchaWidget = (props) => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
121
|
+
console.log("config", props.config);
|
|
122
|
+
const config = props.config;
|
|
123
|
+
const callbacks = props.callbacks || {};
|
|
124
|
+
const [state, updateState] = useProcaptcha();
|
|
125
|
+
console.log("state", state);
|
|
126
|
+
const manager = Manager(config, state, updateState, callbacks);
|
|
127
|
+
const styleWidth = { maxWidth: "400px", minWidth: "200px", margin: "8px" };
|
|
128
|
+
const themeColor = props.config.theme === "light" ? "light" : "dark";
|
|
129
|
+
const theme = useMemo(() => props.config.theme === "light" ? lightTheme : darkTheme, [props.config.theme]);
|
|
130
|
+
console.log("theme", theme);
|
|
131
|
+
console.log("showModal", state.showModal);
|
|
132
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
133
|
+
/* @__PURE__ */ jsxs("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: [
|
|
134
|
+
/* @__PURE__ */ jsx(ModalComponent, { show: state.showModal, children: state.challenge ? /* @__PURE__ */ jsx(
|
|
135
|
+
CaptchaComponent,
|
|
136
|
+
{
|
|
137
|
+
challenge: state.challenge,
|
|
138
|
+
index: state.index,
|
|
139
|
+
solutions: state.solutions,
|
|
140
|
+
onSubmit: manager.submit,
|
|
141
|
+
onCancel: manager.cancel,
|
|
142
|
+
onClick: manager.select,
|
|
143
|
+
onNext: manager.nextRound,
|
|
144
|
+
themeColor: config.theme ?? "light"
|
|
145
|
+
}
|
|
146
|
+
) : /* @__PURE__ */ jsx("div", { children: "No challenge set." }) }),
|
|
147
|
+
/* @__PURE__ */ jsxs("div", { style: styleWidth, "data-cy": "button-human", children: [
|
|
148
|
+
" ",
|
|
149
|
+
/* @__PURE__ */ jsxs(
|
|
150
|
+
"div",
|
|
151
|
+
{
|
|
152
|
+
style: {
|
|
153
|
+
padding: "8px",
|
|
154
|
+
border: "1px solid",
|
|
155
|
+
backgroundColor: theme.palette.background.default,
|
|
156
|
+
borderColor: theme.palette.grey[300],
|
|
157
|
+
borderRadius: "8px",
|
|
158
|
+
display: "flex",
|
|
159
|
+
justifyContent: "space-between",
|
|
160
|
+
alignItems: "center",
|
|
161
|
+
flexWrap: "wrap"
|
|
162
|
+
},
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsxs(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
style: {
|
|
168
|
+
display: "flex",
|
|
169
|
+
justifyContent: "flex-start",
|
|
170
|
+
alignItems: "center",
|
|
171
|
+
flexWrap: "wrap"
|
|
172
|
+
},
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ jsxs(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
style: {
|
|
178
|
+
height: "50px",
|
|
179
|
+
width: "50px",
|
|
180
|
+
display: "flex",
|
|
181
|
+
alignItems: "center",
|
|
182
|
+
justifyContent: "center",
|
|
183
|
+
flexDirection: "column",
|
|
184
|
+
verticalAlign: "middle"
|
|
185
|
+
},
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsx(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
style: {
|
|
191
|
+
display: !state.loading ? "flex" : "none"
|
|
192
|
+
},
|
|
193
|
+
children: /* @__PURE__ */ jsx(
|
|
194
|
+
Checkbox,
|
|
195
|
+
{
|
|
196
|
+
themeColor,
|
|
197
|
+
onChange: manager.start,
|
|
198
|
+
checked: state.isHuman
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
/* @__PURE__ */ jsx(
|
|
204
|
+
"div",
|
|
205
|
+
{
|
|
206
|
+
style: {
|
|
207
|
+
display: state.loading ? "flex" : "none"
|
|
208
|
+
},
|
|
209
|
+
children: /* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: /* @__PURE__ */ jsx(LoadingSpinner, { themeColor }) })
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
/* @__PURE__ */ jsx("div", { style: { padding: 1 }, children: /* @__PURE__ */ jsx("span", { style: { color: theme.palette.background.contrastText, paddingLeft: "4px" }, children: "I am a human" }) })
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
) }),
|
|
219
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
220
|
+
"a",
|
|
221
|
+
{
|
|
222
|
+
href: "https://www.prosopo.io/#features?ref=accounts.prosopo.io&utm_campaign=widget&utm_medium=checkbox",
|
|
223
|
+
target: "_blank",
|
|
224
|
+
"aria-label": "Visit prosopo.io to learn more about the service and its accessibility options.",
|
|
225
|
+
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { children: [
|
|
226
|
+
/* @__PURE__ */ jsx(
|
|
227
|
+
"div",
|
|
228
|
+
{
|
|
229
|
+
css: logoStyle,
|
|
230
|
+
dangerouslySetInnerHTML: {
|
|
231
|
+
__html: props.config.theme === "light" ? logoWithoutTextBlack : logoWithoutTextWhite
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
css: logoStyle,
|
|
239
|
+
dangerouslySetInnerHTML: {
|
|
240
|
+
__html: props.config.theme === "light" ? logoWithTextBlack : logoWithTextWhite
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] }) })
|
|
245
|
+
}
|
|
246
|
+
) })
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
] })
|
|
251
|
+
] }),
|
|
252
|
+
config.devOnlyWatchEvents && /* @__PURE__ */ jsx(Collector, { onProcessData: manager.exportData, sendData: state.showModal })
|
|
253
|
+
] });
|
|
164
254
|
};
|
|
165
255
|
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>';
|
|
166
256
|
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>';
|
|
167
257
|
const logoWithoutTextWhite = '<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="#fff"/><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="#fff"/><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="#fff"/><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="#fff"/></g><defs><clipPath id="clip0_1_2"><rect width="254" height="345" fill="white"/></clipPath></defs></svg>';
|
|
168
258
|
const logoWithoutTextBlack = '<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>';
|
|
169
|
-
export
|
|
170
|
-
|
|
259
|
+
export {
|
|
260
|
+
ProcaptchaWidget as default
|
|
261
|
+
};
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import {
|
|
3
|
-
import { startCollector } from
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useEffect } from "react";
|
|
3
|
+
import { startCollector } from "@prosopo/procaptcha";
|
|
4
4
|
const Collector = ({ onProcessData, sendData }) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
const [mouseEvents, setStoredMouseEvents] = useState([]);
|
|
6
|
+
const [touchEvents, setStoredTouchEvents] = useState([]);
|
|
7
|
+
const [keyboardEvents, setStoredKeyboardEvents] = useState([]);
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (ref && ref.current) {
|
|
11
|
+
startCollector(setStoredMouseEvents, setStoredTouchEvents, setStoredKeyboardEvents, ref.current);
|
|
12
|
+
}
|
|
13
|
+
}, []);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const userEvents = {
|
|
16
|
+
mouseEvents,
|
|
17
|
+
touchEvents,
|
|
18
|
+
keyboardEvents
|
|
19
|
+
};
|
|
20
|
+
onProcessData(userEvents);
|
|
21
|
+
}, [sendData]);
|
|
22
|
+
return /* @__PURE__ */ jsx("div", { ref });
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
Collector as default
|
|
23
26
|
};
|
|
24
|
-
export default Collector;
|
|
25
|
-
//# sourceMappingURL=collector.js.map
|
package/dist/components/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
1
|
+
import { CaptchaWidget } from "./CaptchaWidget.js";
|
|
2
|
+
import "./CaptchaComponent.js";
|
|
3
|
+
import { ExtensionAccountSelect } from "./ExtensionAccountSelect.js";
|
|
4
|
+
import { default as default2 } from "./ProcaptchaWidget.js";
|
|
5
|
+
import { default as default3 } from "./Procaptcha.js";
|
|
6
|
+
export {
|
|
7
|
+
CaptchaWidget,
|
|
8
|
+
ExtensionAccountSelect,
|
|
9
|
+
default3 as Procaptcha,
|
|
10
|
+
default2 as ProcaptchaWidget
|
|
11
|
+
};
|
package/dist/components/theme.js
CHANGED
|
@@ -1,41 +1,44 @@
|
|
|
1
1
|
const grey = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
0: "#fff",
|
|
3
|
+
100: "#f5f5f5",
|
|
4
|
+
200: "#eeeeee",
|
|
5
|
+
300: "#e0e0e0",
|
|
6
|
+
400: "#bdbdbd",
|
|
7
|
+
500: "#9e9e9e",
|
|
8
|
+
600: "#757575",
|
|
9
|
+
700: "#616161",
|
|
10
|
+
800: "#424242",
|
|
11
|
+
900: "#212121"
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
background: {
|
|
21
|
-
default: '#fff',
|
|
22
|
-
contrastText: '#000',
|
|
23
|
-
},
|
|
24
|
-
grey,
|
|
13
|
+
const lightTheme = {
|
|
14
|
+
palette: {
|
|
15
|
+
mode: "light",
|
|
16
|
+
primary: {
|
|
17
|
+
main: "#487DFA",
|
|
18
|
+
contrastText: "#fff"
|
|
25
19
|
},
|
|
20
|
+
background: {
|
|
21
|
+
default: "#fff",
|
|
22
|
+
contrastText: "#000"
|
|
23
|
+
},
|
|
24
|
+
grey
|
|
25
|
+
}
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
grey,
|
|
27
|
+
const darkTheme = {
|
|
28
|
+
palette: {
|
|
29
|
+
mode: "dark",
|
|
30
|
+
primary: {
|
|
31
|
+
main: "#487DFA",
|
|
32
|
+
contrastText: "#fff"
|
|
33
|
+
},
|
|
34
|
+
background: {
|
|
35
|
+
default: "#303030",
|
|
36
|
+
contrastText: "#fff"
|
|
39
37
|
},
|
|
38
|
+
grey
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
darkTheme,
|
|
43
|
+
lightTheme
|
|
40
44
|
};
|
|
41
|
-
//# sourceMappingURL=theme.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { CaptchaResponseCaptcha } from '@prosopo/procaptcha';
|
|
2
|
+
import { GetCaptchaResponse } from '@prosopo/api';
|
|
3
|
+
import { JSX as JSX_2 } from '@emotion/react/jsx-runtime';
|
|
4
|
+
import { ProcaptchaCallbacks } from '@prosopo/procaptcha';
|
|
5
|
+
import { ProcaptchaConfigOptional } from '@prosopo/procaptcha';
|
|
6
|
+
|
|
7
|
+
export declare interface CaptchaComponentProps {
|
|
8
|
+
challenge: GetCaptchaResponse;
|
|
9
|
+
index: number;
|
|
10
|
+
solutions: string[][];
|
|
11
|
+
onSubmit: () => void;
|
|
12
|
+
onCancel: () => void;
|
|
13
|
+
onClick: (hash: string) => void;
|
|
14
|
+
onNext: () => void;
|
|
15
|
+
themeColor: 'light' | 'dark';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export declare const CaptchaWidget: ({ challenge, solution, onClick, themeColor }: CaptchaWidgetProps) => JSX_2.Element;
|
|
19
|
+
|
|
20
|
+
export declare interface CaptchaWidgetProps {
|
|
21
|
+
challenge: CaptchaResponseCaptcha;
|
|
22
|
+
solution: string[];
|
|
23
|
+
onClick: (hash: string) => void;
|
|
24
|
+
themeColor: 'light' | 'dark';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare const ExtensionAccountSelect: ({ value, dappName, onChange, }: {
|
|
28
|
+
value?: string | undefined;
|
|
29
|
+
dappName: string;
|
|
30
|
+
onChange: (value: string) => void;
|
|
31
|
+
}) => JSX_2.Element;
|
|
32
|
+
|
|
33
|
+
export declare const Procaptcha: (props: ProcaptchaProps) => JSX_2.Element;
|
|
34
|
+
|
|
35
|
+
declare interface ProcaptchaProps {
|
|
36
|
+
config: ProcaptchaConfigOptional;
|
|
37
|
+
callbacks?: Partial<ProcaptchaCallbacks>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export declare const ProcaptchaWidget: (props: ProcaptchaProps) => JSX_2.Element;
|
|
41
|
+
|
|
42
|
+
export { }
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import "./components/index.js";
|
|
2
|
+
import "./util/index.js";
|
|
3
|
+
import { ExtensionAccountSelect } from "./components/ExtensionAccountSelect.js";
|
|
4
|
+
import { default as default2 } from "./components/ProcaptchaWidget.js";
|
|
5
|
+
import { default as default3 } from "./components/Procaptcha.js";
|
|
6
|
+
import { CaptchaWidget } from "./components/CaptchaWidget.js";
|
|
7
|
+
export {
|
|
8
|
+
CaptchaWidget,
|
|
9
|
+
ExtensionAccountSelect,
|
|
10
|
+
default3 as Procaptcha,
|
|
11
|
+
default2 as ProcaptchaWidget
|
|
12
|
+
};
|