@prosopo/procaptcha-react 2.9.96 → 2.9.97
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/.turbo/turbo-build$colon$cjs.log +18 -33
- package/.turbo/turbo-build$colon$tsc.log +21 -21
- package/.turbo/turbo-build.log +19 -34
- package/CHANGELOG.md +17 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -0
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cjs/components/Button.cjs +68 -78
- package/dist/cjs/components/CaptchaComponent.cjs +165 -228
- package/dist/cjs/components/CaptchaWidget.cjs +112 -158
- package/dist/cjs/components/Modal.cjs +30 -23
- package/dist/cjs/components/Procaptcha.cjs +7 -7
- package/dist/cjs/components/ProcaptchaWidget.cjs +145 -163
- package/dist/cjs/components/index.cjs +6 -9
- package/dist/cjs/index.cjs +6 -9
- package/dist/cjs/util/index.cjs +17 -15
- package/dist/components/Button.js +67 -78
- package/dist/components/CaptchaComponent.js +161 -225
- package/dist/components/CaptchaWidget.js +111 -157
- package/dist/components/Modal.js +24 -21
- package/dist/components/Procaptcha.js +6 -6
- package/dist/components/ProcaptchaWidget.js +144 -162
- package/dist/components/index.js +3 -8
- package/dist/index.js +4 -9
- package/dist/util/index.js +17 -16
- package/package.json +11 -11
|
@@ -1,229 +1,166 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
|
|
164
|
-
"div",
|
|
165
|
-
{
|
|
166
|
-
style: {
|
|
167
|
-
position: "relative",
|
|
168
|
-
flexGrow: 1,
|
|
169
|
-
// make the width of each item 1/3rd of the width overall, i.e. 3 columns
|
|
170
|
-
flexBasis: "calc(33.333% - 10px)"
|
|
171
|
-
},
|
|
172
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
173
|
-
Button,
|
|
174
|
-
{
|
|
175
|
-
themeColor,
|
|
176
|
-
buttonType: "cancel",
|
|
177
|
-
onClick: onCancel,
|
|
178
|
-
text: t("WIDGET.CANCEL"),
|
|
179
|
-
"aria-label": t("WIDGET.CANCEL")
|
|
180
|
-
}
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
),
|
|
184
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
185
|
-
"div",
|
|
186
|
-
{
|
|
187
|
-
style: {
|
|
188
|
-
position: "relative",
|
|
189
|
-
flexGrow: 1,
|
|
190
|
-
// make the width of each item 1/3rd of the width overall, i.e. 3 columns
|
|
191
|
-
flexBasis: "calc(33.333% - 10px)"
|
|
192
|
-
},
|
|
193
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(procaptchaCommon.ReloadButton, { themeColor, onReload })
|
|
194
|
-
}
|
|
195
|
-
),
|
|
196
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
197
|
-
"div",
|
|
198
|
-
{
|
|
199
|
-
style: {
|
|
200
|
-
position: "relative",
|
|
201
|
-
flexGrow: 1,
|
|
202
|
-
// make the width of each item 1/3rd of the width overall, i.e. 3 columns
|
|
203
|
-
flexBasis: "calc(33.333% - 10px)"
|
|
204
|
-
},
|
|
205
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
206
|
-
Button,
|
|
207
|
-
{
|
|
208
|
-
themeColor,
|
|
209
|
-
buttonType: "next",
|
|
210
|
-
text: index$1 < challenge.captchas.length - 1 ? t("WIDGET.NEXT") : t("WIDGET.SUBMIT"),
|
|
211
|
-
onClick: index$1 < challenge.captchas.length - 1 ? onNext : onSubmit,
|
|
212
|
-
"aria-label": index$1 < challenge.captchas.length - 1 ? t("WIDGET.NEXT") : t("WIDGET.SUBMIT"),
|
|
213
|
-
"data-cy": "button-next"
|
|
214
|
-
}
|
|
215
|
-
)
|
|
216
|
-
}
|
|
217
|
-
)
|
|
218
|
-
]
|
|
219
|
-
}
|
|
220
|
-
)
|
|
221
|
-
}
|
|
222
|
-
)
|
|
223
|
-
]
|
|
224
|
-
}
|
|
225
|
-
)
|
|
226
|
-
}
|
|
227
|
-
) });
|
|
1
|
+
const require_CaptchaWidget = require("./CaptchaWidget.cjs");
|
|
2
|
+
const require_index = require("../util/index.cjs");
|
|
3
|
+
const require_Button = require("./Button.cjs");
|
|
4
|
+
let _prosopo_widget_skeleton = require("@prosopo/widget-skeleton");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
7
|
+
let _prosopo_locale = require("@prosopo/locale");
|
|
8
|
+
let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
|
|
9
|
+
let _prosopo_util = require("@prosopo/util");
|
|
10
|
+
//#region src/components/CaptchaComponent.tsx
|
|
11
|
+
var CaptchaComponent = ({ challenge, index, solutions, onSubmit, onCancel, onClick, onNext, onReload, themeColor }) => {
|
|
12
|
+
const { t } = (0, _prosopo_locale.useTranslation)();
|
|
13
|
+
const captcha = challenge.captchas ? (0, _prosopo_util.at)(challenge.captchas, index) : null;
|
|
14
|
+
const solution = solutions ? (0, _prosopo_util.at)(solutions, index) : [];
|
|
15
|
+
const theme = (0, react.useMemo)(() => themeColor === "light" ? _prosopo_widget_skeleton.lightTheme : _prosopo_widget_skeleton.darkTheme, [themeColor]);
|
|
16
|
+
const doubleSpacing = `${theme.spacing.unit * 2}px`;
|
|
17
|
+
const fullSpacing = `${theme.spacing.unit}px`;
|
|
18
|
+
`${theme.spacing.half}`;
|
|
19
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react.Suspense, {
|
|
20
|
+
fallback: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", { children: "Loading..." }),
|
|
21
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
22
|
+
style: {
|
|
23
|
+
overflowX: "auto",
|
|
24
|
+
overflowY: "auto",
|
|
25
|
+
maxWidth: "500px",
|
|
26
|
+
maxHeight: "100%",
|
|
27
|
+
display: "flex",
|
|
28
|
+
flexDirection: "column",
|
|
29
|
+
border: "1px solid #dddddd",
|
|
30
|
+
boxShadow: "rgba(255, 255, 255, 0.2) 0px 0px 4px",
|
|
31
|
+
borderRadius: "4px",
|
|
32
|
+
backgroundColor: theme.palette.background.default,
|
|
33
|
+
userSelect: "none",
|
|
34
|
+
touchAction: "none",
|
|
35
|
+
overscrollBehavior: "none"
|
|
36
|
+
},
|
|
37
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
|
|
38
|
+
style: {
|
|
39
|
+
backgroundColor: theme.palette.background.default,
|
|
40
|
+
display: "flex",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
minWidth: "300px",
|
|
43
|
+
marginLeft: fullSpacing,
|
|
44
|
+
marginRight: fullSpacing,
|
|
45
|
+
justifyContent: "center"
|
|
46
|
+
},
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
49
|
+
style: {
|
|
50
|
+
display: "flex",
|
|
51
|
+
alignItems: "center",
|
|
52
|
+
width: "100%"
|
|
53
|
+
},
|
|
54
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
55
|
+
style: {
|
|
56
|
+
backgroundColor: theme.palette.primary.main,
|
|
57
|
+
width: "100%",
|
|
58
|
+
marginTop: fullSpacing
|
|
59
|
+
},
|
|
60
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
|
|
61
|
+
style: {
|
|
62
|
+
padding: `${theme.spacing.half}px`,
|
|
63
|
+
fontFamily: theme.font.fontFamily
|
|
64
|
+
},
|
|
65
|
+
children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("p", {
|
|
66
|
+
style: {
|
|
67
|
+
color: "#ffffff",
|
|
68
|
+
fontWeight: 700,
|
|
69
|
+
lineHeight: 1.5
|
|
70
|
+
},
|
|
71
|
+
children: [
|
|
72
|
+
t("WIDGET.SELECT_ALL"),
|
|
73
|
+
":",
|
|
74
|
+
"\xA0",
|
|
75
|
+
/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", { children: `${(0, _prosopo_util.at)(challenge.captchas, index).target} ` })
|
|
76
|
+
]
|
|
77
|
+
}), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("p", {
|
|
78
|
+
style: {
|
|
79
|
+
color: "#ffffff",
|
|
80
|
+
fontWeight: 500,
|
|
81
|
+
lineHeight: .8,
|
|
82
|
+
fontSize: "0.8rem"
|
|
83
|
+
},
|
|
84
|
+
children: t("WIDGET.IF_NONE_CLICK_NEXT")
|
|
85
|
+
})]
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
90
|
+
...require_index.default({ dev: { cy: `captcha-${index}` } }),
|
|
91
|
+
style: { overflow: "hidden" },
|
|
92
|
+
children: captcha && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_CaptchaWidget.CaptchaWidget, {
|
|
93
|
+
challenge: captcha,
|
|
94
|
+
solution,
|
|
95
|
+
onClick,
|
|
96
|
+
themeColor
|
|
97
|
+
})
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
100
|
+
style: {
|
|
101
|
+
display: "flex",
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
justifyContent: "space-between",
|
|
104
|
+
lineHeight: 1.75,
|
|
105
|
+
padding: `${fullSpacing} 0 ${doubleSpacing} 0`
|
|
106
|
+
},
|
|
107
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
|
|
108
|
+
style: {
|
|
109
|
+
width: "100%",
|
|
110
|
+
height: "100%",
|
|
111
|
+
display: "flex",
|
|
112
|
+
flexDirection: "row",
|
|
113
|
+
justifyContent: "space-between",
|
|
114
|
+
gap: "10px"
|
|
115
|
+
},
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
118
|
+
style: {
|
|
119
|
+
position: "relative",
|
|
120
|
+
flexGrow: 1,
|
|
121
|
+
flexBasis: "calc(33.333% - 10px)"
|
|
122
|
+
},
|
|
123
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Button.default, {
|
|
124
|
+
themeColor,
|
|
125
|
+
buttonType: "cancel",
|
|
126
|
+
onClick: onCancel,
|
|
127
|
+
text: t("WIDGET.CANCEL"),
|
|
128
|
+
"aria-label": t("WIDGET.CANCEL")
|
|
129
|
+
})
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
132
|
+
style: {
|
|
133
|
+
position: "relative",
|
|
134
|
+
flexGrow: 1,
|
|
135
|
+
flexBasis: "calc(33.333% - 10px)"
|
|
136
|
+
},
|
|
137
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(_prosopo_procaptcha_common.ReloadButton, {
|
|
138
|
+
themeColor,
|
|
139
|
+
onReload
|
|
140
|
+
})
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
143
|
+
style: {
|
|
144
|
+
position: "relative",
|
|
145
|
+
flexGrow: 1,
|
|
146
|
+
flexBasis: "calc(33.333% - 10px)"
|
|
147
|
+
},
|
|
148
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Button.default, {
|
|
149
|
+
themeColor,
|
|
150
|
+
buttonType: "next",
|
|
151
|
+
text: index < challenge.captchas.length - 1 ? t("WIDGET.NEXT") : t("WIDGET.SUBMIT"),
|
|
152
|
+
onClick: index < challenge.captchas.length - 1 ? onNext : onSubmit,
|
|
153
|
+
"aria-label": index < challenge.captchas.length - 1 ? t("WIDGET.NEXT") : t("WIDGET.SUBMIT"),
|
|
154
|
+
"data-cy": "button-next"
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
});
|
|
228
164
|
};
|
|
229
|
-
|
|
165
|
+
//#endregion
|
|
166
|
+
exports.default = CaptchaComponent;
|