@prosopo/procaptcha-react 2.1.6 → 2.1.7
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/package.json +9 -9
- package/dist/cjs/components/Button.cjs +0 -76
- package/dist/cjs/components/CaptchaComponent.cjs +0 -198
- package/dist/cjs/components/CaptchaWidget.cjs +0 -186
- package/dist/cjs/components/Modal.cjs +0 -42
- package/dist/cjs/components/Procaptcha.cjs +0 -20
- package/dist/cjs/components/ProcaptchaWidget.cjs +0 -142
- package/dist/cjs/components/index.cjs +0 -9
- package/dist/cjs/index.cjs +0 -10
- package/dist/cjs/util/index.cjs +0 -18
- package/dist/components/Button.d.ts +0 -11
- package/dist/components/Button.d.ts.map +0 -1
- package/dist/components/Button.js +0 -61
- package/dist/components/Button.js.map +0 -1
- package/dist/components/CaptchaComponent.d.ts +0 -15
- package/dist/components/CaptchaComponent.d.ts.map +0 -1
- package/dist/components/CaptchaComponent.js +0 -78
- package/dist/components/CaptchaComponent.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 +0 -106
- package/dist/components/CaptchaWidget.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 +0 -37
- package/dist/components/Modal.js.map +0 -1
- package/dist/components/Procaptcha.d.ts +0 -8
- package/dist/components/Procaptcha.d.ts.map +0 -1
- package/dist/components/Procaptcha.js +0 -7
- package/dist/components/Procaptcha.js.map +0 -1
- package/dist/components/ProcaptchaWidget.d.ts +0 -4
- package/dist/components/ProcaptchaWidget.d.ts.map +0 -1
- package/dist/components/ProcaptchaWidget.js +0 -54
- package/dist/components/ProcaptchaWidget.js.map +0 -1
- package/dist/components/collector.d.ts +0 -9
- package/dist/components/collector.d.ts.map +0 -1
- package/dist/components/collector.js +0 -26
- package/dist/components/collector.js.map +0 -1
- package/dist/components/index.d.ts +0 -6
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -6
- package/dist/components/index.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3
- 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 +0 -12
- package/dist/util/index.js.map +0 -1
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { i18n, useTranslation } from "@prosopo/locale-browser";
|
|
3
|
-
import { Manager } from "@prosopo/procaptcha";
|
|
4
|
-
import { useProcaptcha } from "@prosopo/procaptcha-common";
|
|
5
|
-
import { ProcaptchaConfigSchema } from "@prosopo/types";
|
|
6
|
-
import { Checkbox, ContainerDiv, LoadingSpinner, WIDGET_BORDER, WIDGET_BORDER_RADIUS, WIDGET_DIMENSIONS, WIDGET_INNER_HEIGHT, WIDGET_MAX_WIDTH, WIDGET_PADDING, WIDGET_URL, WIDGET_URL_TEXT, WidthBasedStylesDiv, darkTheme, lightTheme, } from "@prosopo/web-components";
|
|
7
|
-
import { Logo } from "@prosopo/web-components";
|
|
8
|
-
import { useEffect, useRef, useState } from "react";
|
|
9
|
-
import CaptchaComponent from "./CaptchaComponent.js";
|
|
10
|
-
import Modal from "./Modal.js";
|
|
11
|
-
const ProcaptchaWidget = (props) => {
|
|
12
|
-
const { t } = useTranslation();
|
|
13
|
-
const config = ProcaptchaConfigSchema.parse(props.config);
|
|
14
|
-
const callbacks = props.callbacks || {};
|
|
15
|
-
const [state, updateState] = useProcaptcha(useState, useRef);
|
|
16
|
-
const manager = Manager(config, state, updateState, callbacks);
|
|
17
|
-
const themeColor = props.config.theme === "light" ? "light" : "dark";
|
|
18
|
-
const theme = props.config.theme === "light" ? lightTheme : darkTheme;
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (config.language) {
|
|
21
|
-
i18n.changeLanguage(config.language);
|
|
22
|
-
}
|
|
23
|
-
}, [config.language]);
|
|
24
|
-
return (_jsx("div", { children: _jsxs("div", { style: {
|
|
25
|
-
maxWidth: WIDGET_MAX_WIDTH,
|
|
26
|
-
maxHeight: "100%",
|
|
27
|
-
overflowX: "auto",
|
|
28
|
-
}, children: [_jsx(Modal, { show: state.showModal, 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, onReload: manager.reload, themeColor: config.theme ?? "light" })) : (_jsx("div", { children: "No challenge set." })) }), _jsx(ContainerDiv, { children: _jsx(WidthBasedStylesDiv, { children: _jsxs("div", { style: WIDGET_DIMENSIONS, "data-cy": "button-human", children: [" ", _jsxs("div", { style: {
|
|
29
|
-
padding: WIDGET_PADDING,
|
|
30
|
-
border: WIDGET_BORDER,
|
|
31
|
-
backgroundColor: theme.palette.background.default,
|
|
32
|
-
borderColor: theme.palette.grey[300],
|
|
33
|
-
borderRadius: WIDGET_BORDER_RADIUS,
|
|
34
|
-
display: "flex",
|
|
35
|
-
alignItems: "center",
|
|
36
|
-
flexWrap: "wrap",
|
|
37
|
-
justifyContent: "space-between",
|
|
38
|
-
minHeight: `${WIDGET_INNER_HEIGHT}px`,
|
|
39
|
-
overflow: "hidden",
|
|
40
|
-
}, children: [_jsx("div", { style: { display: "inline-flex", flexDirection: "column" }, children: _jsx("div", { style: {
|
|
41
|
-
alignItems: "center",
|
|
42
|
-
flex: 1,
|
|
43
|
-
}, children: _jsx("div", { style: {
|
|
44
|
-
display: "flex",
|
|
45
|
-
alignItems: "center",
|
|
46
|
-
justifyContent: "center",
|
|
47
|
-
flexDirection: "column",
|
|
48
|
-
verticalAlign: "middle",
|
|
49
|
-
}, children: _jsx("div", { style: {
|
|
50
|
-
display: "flex",
|
|
51
|
-
}, children: state.loading ? (_jsx(LoadingSpinner, { themeColor: themeColor, "aria-label": "Loading spinner" })) : (_jsx(Checkbox, { themeColor: themeColor, onChange: manager.start, checked: state.isHuman, labelText: t("WIDGET.I_AM_HUMAN"), error: state.error, "aria-label": "human checkbox" })) }) }) }) }), _jsx("div", { style: { display: "inline-flex", flexDirection: "column" }, children: _jsx("a", { href: WIDGET_URL, target: "_blank", "aria-label": WIDGET_URL_TEXT, rel: "noreferrer", children: _jsx("div", { style: { flex: 1 }, children: _jsx(Logo, { themeColor: themeColor, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) })] }) }));
|
|
52
|
-
};
|
|
53
|
-
export default ProcaptchaWidget;
|
|
54
|
-
//# sourceMappingURL=ProcaptchaWidget.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProcaptchaWidget.js","sourceRoot":"","sources":["../../src/components/ProcaptchaWidget.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAwB,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EACN,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,SAAS,EACT,UAAU,GACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,MAAM,gBAAgB,GAAG,CAAC,KAAsB,EAAE,EAAE;IAC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H,KAAC,QAAQ,IACR,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,OAAO,CAAC,KAAK,EACvB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,CAAC,CAAC,mBAAmB,CAAC,EACjC,KAAK,EAAE,KAAK,CAAC,KAAK,gBACP,gBAAgB,GAC1B,CACF,GACI,GACD,GACD,GACD,EACN,cACC,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,YAE1D,YACC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAC,QAAQ,gBACH,eAAe,EAC3B,GAAG,EAAC,YAAY,YAEhB,cAAK,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,YACtB,KAAC,IAAI,IAAC,UAAU,EAAE,UAAU,gBAAa,cAAc,GAAG,GACrD,GACH,GACC,IACD,IACD,GACe,GACR,IACV,GACD,CACN,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Account, StoredEvents } from "@prosopo/types";
|
|
2
|
-
type CollectorProps = {
|
|
3
|
-
onProcessData: (data: StoredEvents) => void;
|
|
4
|
-
sendData: boolean;
|
|
5
|
-
account: Account | undefined;
|
|
6
|
-
};
|
|
7
|
-
declare const Collector: ({ onProcessData, sendData, account }: CollectorProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
-
export default Collector;
|
|
9
|
-
//# sourceMappingURL=collector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/components/collector.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACX,OAAO,EAIP,YAAY,EACZ,MAAM,gBAAgB,CAAC;AAGxB,KAAK,cAAc,GAAG;IACrB,aAAa,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF,QAAA,MAAM,SAAS,yCAA0C,cAAc,qDAgCtE,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { startCollector } from "@prosopo/procaptcha";
|
|
3
|
-
import { useEffect, useRef, useState } from "react";
|
|
4
|
-
const Collector = ({ onProcessData, sendData, account }) => {
|
|
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?.current) {
|
|
11
|
-
startCollector(setStoredMouseEvents, setStoredTouchEvents, setStoredKeyboardEvents, ref.current);
|
|
12
|
-
}
|
|
13
|
-
}, []);
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
const userEvents = {
|
|
16
|
-
mouseEvents,
|
|
17
|
-
touchEvents,
|
|
18
|
-
keyboardEvents,
|
|
19
|
-
};
|
|
20
|
-
if (account)
|
|
21
|
-
onProcessData(userEvents);
|
|
22
|
-
}, [onProcessData, account]);
|
|
23
|
-
return _jsx("div", { ref: ref });
|
|
24
|
-
};
|
|
25
|
-
export default Collector;
|
|
26
|
-
//# sourceMappingURL=collector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../../src/components/collector.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQrD,OAAO,EAAyB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQ3E,MAAM,SAAS,GAAG,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAkB,EAAE,EAAE;IAC1E,MAAM,CAAC,WAAW,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAsB,EAAE,CAAC,CAAC;IAC9E,MAAM,CAAC,WAAW,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAsB,EAAE,CAAC,CAAC;IAC9E,MAAM,CAAC,cAAc,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAExD,EAAE,CAAC,CAAC;IAEN,MAAM,GAAG,GACR,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE9B,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,GAAG,EAAE,OAAO,EAAE,CAAC;YAClB,cAAc,CACb,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,GAAG,CAAC,OAAO,CACX,CAAC;QACH,CAAC;IACF,CAAC,EAAE,EAAE,CAAC,CAAC;IAGP,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,UAAU,GAAG;YAClB,WAAW;YACX,WAAW;YACX,cAAc;SACd,CAAC;QACF,IAAI,OAAO;YAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE7B,OAAO,cAAK,GAAG,EAAE,GAAG,GAAI,CAAC;AAC1B,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from "./CaptchaWidget.js";
|
|
2
|
-
export * from "./CaptchaComponent.js";
|
|
3
|
-
export { default as ProcaptchaWidget } from "./ProcaptchaWidget.js";
|
|
4
|
-
export { default as Procaptcha } from "./Procaptcha.js";
|
|
5
|
-
export * from "./Procaptcha.js";
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,cAAc,iBAAiB,CAAC"}
|
package/dist/components/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from "./CaptchaWidget.js";
|
|
2
|
-
export * from "./CaptchaComponent.js";
|
|
3
|
-
export { default as ProcaptchaWidget } from "./ProcaptchaWidget.js";
|
|
4
|
-
export { default as Procaptcha } from "./Procaptcha.js";
|
|
5
|
-
export * from "./Procaptcha.js";
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,cAAc,iBAAiB,CAAC"}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
DELETED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC"}
|
package/dist/util/index.d.ts
DELETED
package/dist/util/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AA0BA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EACnC,OAAO,EACP,GAAG,GACH,EAAE;IACF,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACpC,GAAG,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAChC,MAOA"}
|
package/dist/util/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
function renameKeysForDataAttr(data = {}) {
|
|
2
|
-
return Object.keys(data).reduce((prev, curr) => ({ ...prev, [`data-${curr}`]: data[curr] }), {});
|
|
3
|
-
}
|
|
4
|
-
export default function addDataAttr({ general, dev, }) {
|
|
5
|
-
return {
|
|
6
|
-
...renameKeysForDataAttr(general),
|
|
7
|
-
...(process.env.NODE_ENV !== "production"
|
|
8
|
-
? renameKeysForDataAttr(dev)
|
|
9
|
-
: {}),
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
package/dist/util/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAaA,SAAS,qBAAqB,CAAC,OAAkC,EAAE;IAClE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAE9B,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAC3D,EAAE,CACF,CAAC;AACH,CAAC;AAOD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EACnC,OAAO,EACP,GAAG,GAIH;IACA,OAAO;QACN,GAAG,qBAAqB,CAAC,OAAO,CAAC;QACjC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;YACxC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC;YAC5B,CAAC,CAAC,EAAE,CAAC;KACN,CAAC;AACH,CAAC"}
|