@prosopo/procaptcha-react 2.11.2 → 2.12.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.
Files changed (117) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +13 -13
  2. package/.turbo/turbo-build$colon$tsc.log +21 -21
  3. package/.turbo/turbo-build.log +14 -13
  4. package/CHANGELOG.md +50 -0
  5. package/dist/cjs/components/button.cjs +100 -0
  6. package/dist/cjs/components/captchaComponent.cjs +210 -0
  7. package/dist/cjs/components/captchaWidget.cjs +203 -0
  8. package/dist/cjs/components/collector.cjs +49 -0
  9. package/dist/cjs/components/index.cjs +15 -6
  10. package/dist/cjs/components/modal.cjs +35 -0
  11. package/dist/cjs/components/procaptcha.cjs +23 -0
  12. package/dist/cjs/components/procaptchaWidget.cjs +166 -0
  13. package/dist/cjs/index.cjs +15 -6
  14. package/dist/cjs/util/index.cjs +6 -4
  15. package/dist/components/button.d.ts +9 -0
  16. package/dist/components/button.d.ts.map +1 -0
  17. package/dist/components/button.js +100 -0
  18. package/dist/components/button.js.map +1 -0
  19. package/dist/components/{CaptchaComponent.d.ts → captchaComponent.d.ts} +5 -3
  20. package/dist/components/captchaComponent.d.ts.map +1 -0
  21. package/dist/components/captchaComponent.js +210 -0
  22. package/dist/components/captchaComponent.js.map +1 -0
  23. package/dist/components/{CaptchaWidget.d.ts → captchaWidget.d.ts} +3 -2
  24. package/dist/components/captchaWidget.d.ts.map +1 -0
  25. package/dist/components/captchaWidget.js +203 -0
  26. package/dist/components/captchaWidget.js.map +1 -0
  27. package/dist/components/collector.d.ts +5 -4
  28. package/dist/components/collector.d.ts.map +1 -1
  29. package/dist/components/collector.js +46 -24
  30. package/dist/components/collector.js.map +1 -1
  31. package/dist/components/index.d.ts +7 -5
  32. package/dist/components/index.d.ts.map +1 -1
  33. package/dist/components/index.js +8 -4
  34. package/dist/components/index.js.map +1 -1
  35. package/dist/components/modal.d.ts +14 -0
  36. package/dist/components/modal.d.ts.map +1 -0
  37. package/dist/components/modal.js +35 -0
  38. package/dist/components/modal.js.map +1 -0
  39. package/dist/components/procaptcha.d.ts +7 -0
  40. package/dist/components/procaptcha.d.ts.map +1 -0
  41. package/dist/components/procaptcha.js +22 -0
  42. package/dist/components/procaptcha.js.map +1 -0
  43. package/dist/components/procaptchaWidget.d.ts +7 -0
  44. package/dist/components/procaptchaWidget.d.ts.map +1 -0
  45. package/dist/components/procaptchaWidget.js +166 -0
  46. package/dist/components/procaptchaWidget.js.map +1 -0
  47. package/dist/index.js +8 -4
  48. package/dist/tests/button.unit.test.d.ts.map +1 -1
  49. package/dist/tests/button.unit.test.js +69 -49
  50. package/dist/tests/button.unit.test.js.map +1 -1
  51. package/dist/tests/captchaComponent.unit.test.d.ts.map +1 -1
  52. package/dist/tests/captchaComponent.unit.test.js +31 -9
  53. package/dist/tests/captchaComponent.unit.test.js.map +1 -1
  54. package/dist/tests/captchaWidget.unit.test.d.ts.map +1 -1
  55. package/dist/tests/captchaWidget.unit.test.js +55 -9
  56. package/dist/tests/captchaWidget.unit.test.js.map +1 -1
  57. package/dist/tests/collector.unit.test.d.ts.map +1 -1
  58. package/dist/tests/collector.unit.test.js +43 -10
  59. package/dist/tests/collector.unit.test.js.map +1 -1
  60. package/dist/tests/harness.d.ts +2 -0
  61. package/dist/tests/harness.d.ts.map +1 -1
  62. package/dist/tests/harness.js +7 -0
  63. package/dist/tests/harness.js.map +1 -1
  64. package/dist/tests/modal.unit.test.d.ts.map +1 -1
  65. package/dist/tests/modal.unit.test.js +20 -7
  66. package/dist/tests/modal.unit.test.js.map +1 -1
  67. package/dist/tests/procaptcha.unit.test.d.ts.map +1 -1
  68. package/dist/tests/procaptcha.unit.test.js +37 -15
  69. package/dist/tests/procaptcha.unit.test.js.map +1 -1
  70. package/dist/tests/procaptchaReact.test-d.js +8 -6
  71. package/dist/tests/procaptchaReact.test-d.js.map +1 -1
  72. package/dist/tests/procaptchaWidget.unit.test.d.ts.map +1 -1
  73. package/dist/tests/procaptchaWidget.unit.test.js +112 -89
  74. package/dist/tests/procaptchaWidget.unit.test.js.map +1 -1
  75. package/dist/tests/render.d.ts +6 -7
  76. package/dist/tests/render.d.ts.map +1 -1
  77. package/dist/tests/render.js +23 -30
  78. package/dist/tests/render.js.map +1 -1
  79. package/dist/util/index.d.ts +8 -7
  80. package/dist/util/index.d.ts.map +1 -1
  81. package/dist/util/index.js +6 -4
  82. package/dist/util/index.js.map +1 -1
  83. package/package.json +8 -13
  84. package/vite.test.config.ts +1 -2
  85. package/dist/cjs/_virtual/_rolldown/runtime.cjs +0 -23
  86. package/dist/cjs/components/Button.cjs +0 -81
  87. package/dist/cjs/components/CaptchaComponent.cjs +0 -171
  88. package/dist/cjs/components/CaptchaWidget.cjs +0 -129
  89. package/dist/cjs/components/Modal.cjs +0 -35
  90. package/dist/cjs/components/Procaptcha.cjs +0 -7
  91. package/dist/cjs/components/ProcaptchaWidget.cjs +0 -168
  92. package/dist/components/Button.d.ts +0 -11
  93. package/dist/components/Button.d.ts.map +0 -1
  94. package/dist/components/Button.js +0 -81
  95. package/dist/components/Button.js.map +0 -1
  96. package/dist/components/CaptchaComponent.d.ts.map +0 -1
  97. package/dist/components/CaptchaComponent.js +0 -171
  98. package/dist/components/CaptchaComponent.js.map +0 -1
  99. package/dist/components/CaptchaWidget.d.ts.map +0 -1
  100. package/dist/components/CaptchaWidget.js +0 -129
  101. package/dist/components/CaptchaWidget.js.map +0 -1
  102. package/dist/components/Modal.d.ts +0 -13
  103. package/dist/components/Modal.d.ts.map +0 -1
  104. package/dist/components/Modal.js +0 -33
  105. package/dist/components/Modal.js.map +0 -1
  106. package/dist/components/Procaptcha.d.ts +0 -4
  107. package/dist/components/Procaptcha.d.ts.map +0 -1
  108. package/dist/components/Procaptcha.js +0 -7
  109. package/dist/components/Procaptcha.js.map +0 -1
  110. package/dist/components/ProcaptchaWidget.d.ts +0 -4
  111. package/dist/components/ProcaptchaWidget.d.ts.map +0 -1
  112. package/dist/components/ProcaptchaWidget.js +0 -168
  113. package/dist/components/ProcaptchaWidget.js.map +0 -1
  114. package/dist/tests/setup.d.ts +0 -5
  115. package/dist/tests/setup.d.ts.map +0 -1
  116. package/dist/tests/setup.js +0 -3
  117. package/dist/tests/setup.js.map +0 -1
@@ -1,3 +1,5 @@
1
+ import type { Translator } from "@prosopo/locale";
2
+ import { type Component } from "@prosopo/procaptcha-common";
1
3
  import type { CaptchaResponseBody } from "@prosopo/types";
2
4
  export interface CaptchaComponentProps {
3
5
  challenge: CaptchaResponseBody;
@@ -9,7 +11,7 @@ export interface CaptchaComponentProps {
9
11
  onNext: () => void;
10
12
  onReload: () => void;
11
13
  themeColor: "light" | "dark";
14
+ translator: Translator;
12
15
  }
13
- declare const CaptchaComponent: ({ challenge, index, solutions, onSubmit, onCancel, onClick, onNext, onReload, themeColor, }: CaptchaComponentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
14
- export default CaptchaComponent;
15
- //# sourceMappingURL=CaptchaComponent.d.ts.map
16
+ export declare const mountCaptchaComponent: (container: HTMLElement, initialProps: CaptchaComponentProps) => Component<CaptchaComponentProps>;
17
+ //# sourceMappingURL=captchaComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captchaComponent.d.ts","sourceRoot":"","sources":["../../src/components/captchaComponent.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACN,KAAK,SAAS,EAMd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAO1D,MAAM,WAAW,qBAAqB;IACrC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;IACxC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,UAAU,EAAE,UAAU,CAAC;CACvB;AA8CD,eAAO,MAAM,qBAAqB,cACtB,WAAW,gBACR,qBAAqB,KACjC,SAAS,CAAC,qBAAqB,CAuMjC,CAAC"}
@@ -0,0 +1,210 @@
1
+ import addDataAttr from "../util/index.js";
2
+ import { mountButton } from "./button.js";
3
+ import { mountCaptchaWidget } from "./captchaWidget.js";
4
+ import { applyAttributes, applyStyles, createElement, mountReloadButton } from "@prosopo/procaptcha-common";
5
+ import { darkTheme, lightTheme } from "@prosopo/widget-skeleton";
6
+ import { at } from "@prosopo/util";
7
+ //#region src/components/captchaComponent.ts
8
+ var outerStyle = (theme) => ({
9
+ overflowX: "auto",
10
+ overflowY: "auto",
11
+ maxWidth: "500px",
12
+ maxHeight: "100%",
13
+ display: "flex",
14
+ flexDirection: "column",
15
+ border: `1px solid ${theme.palette.border}`,
16
+ boxShadow: theme.elevation.card,
17
+ borderRadius: theme.shape.card,
18
+ backgroundColor: theme.palette.background.default,
19
+ userSelect: "none",
20
+ touchAction: "none",
21
+ overscrollBehavior: "none"
22
+ });
23
+ var promptStyle = (theme) => ({
24
+ ...theme.typography.titleMedium,
25
+ color: theme.palette.primaryContainer.contrastText,
26
+ margin: 0
27
+ });
28
+ var hintStyle = (theme) => ({
29
+ ...theme.typography.bodyMedium,
30
+ color: theme.palette.onSurfaceVariant,
31
+ margin: "4px 0 0 0"
32
+ });
33
+ var targetStyle = (theme) => ({
34
+ color: theme.palette.titleAccent,
35
+ fontWeight: 700
36
+ });
37
+ var columnStyle = {
38
+ position: "relative",
39
+ flexGrow: 1,
40
+ flexBasis: "calc(33.333% - 10px)"
41
+ };
42
+ var mountCaptchaComponent = (container, initialProps) => {
43
+ let props = initialProps;
44
+ const themeOf = (themeColor) => "light" === themeColor ? lightTheme : darkTheme;
45
+ const currentCaptcha = () => at(props.challenge.captchas, props.index, { noWrap: true });
46
+ const currentSolution = () => at(props.solutions, props.index, { noWrap: true });
47
+ const isLastRound = () => props.index >= props.challenge.captchas.length - 1;
48
+ const theme = themeOf(props.themeColor);
49
+ const doubleSpacing = `${theme.spacing.unit * 2}px`;
50
+ const fullSpacing = `${theme.spacing.unit}px`;
51
+ const targetLabel = createElement("span", { style: targetStyle(theme) });
52
+ const promptText = createElement("p", { style: promptStyle(theme) });
53
+ const hintText = createElement("p", { style: hintStyle(theme) });
54
+ const header = createElement("div", {
55
+ style: {
56
+ padding: "12px 14px",
57
+ fontFamily: theme.font.fontFamily
58
+ },
59
+ children: [promptText, hintText]
60
+ });
61
+ const headerBar = createElement("div", {
62
+ style: {
63
+ backgroundColor: theme.palette.primaryContainer.main,
64
+ borderRadius: theme.shape.header,
65
+ width: "100%",
66
+ marginTop: fullSpacing
67
+ },
68
+ children: [header]
69
+ });
70
+ const headerRow = createElement("div", {
71
+ style: {
72
+ display: "flex",
73
+ alignItems: "center",
74
+ width: "100%"
75
+ },
76
+ children: [headerBar]
77
+ });
78
+ const gridHost = createElement("div", {
79
+ style: { overflow: "hidden" },
80
+ attributes: addDataAttr({ dev: { cy: `captcha-${props.index}` } })
81
+ });
82
+ const cancelHost = createElement("div", { style: columnStyle });
83
+ const reloadHost = createElement("div", { style: columnStyle });
84
+ const nextHost = createElement("div", { style: columnStyle });
85
+ const controls = createElement("div", {
86
+ style: {
87
+ width: "100%",
88
+ height: "100%",
89
+ display: "flex",
90
+ flexDirection: "row",
91
+ justifyContent: "space-between",
92
+ gap: "10px"
93
+ },
94
+ children: [
95
+ cancelHost,
96
+ reloadHost,
97
+ nextHost
98
+ ]
99
+ });
100
+ const controlsRow = createElement("div", {
101
+ style: {
102
+ display: "flex",
103
+ alignItems: "center",
104
+ justifyContent: "space-between",
105
+ lineHeight: 1.75,
106
+ padding: `${fullSpacing} 0 ${doubleSpacing} 0`
107
+ },
108
+ children: [controls]
109
+ });
110
+ const inner = createElement("div", {
111
+ style: {
112
+ backgroundColor: theme.palette.background.default,
113
+ display: "flex",
114
+ flexDirection: "column",
115
+ minWidth: "300px",
116
+ marginLeft: fullSpacing,
117
+ marginRight: fullSpacing,
118
+ justifyContent: "center"
119
+ },
120
+ children: [
121
+ headerRow,
122
+ gridHost,
123
+ controlsRow
124
+ ]
125
+ });
126
+ const root = createElement("div", {
127
+ style: outerStyle(theme),
128
+ children: [inner]
129
+ });
130
+ const grid = mountCaptchaWidget(gridHost, {
131
+ challenge: currentCaptcha(),
132
+ solution: currentSolution(),
133
+ onClick: props.onClick,
134
+ themeColor: props.themeColor
135
+ });
136
+ const cancelButton = mountButton(cancelHost, {
137
+ themeColor: props.themeColor,
138
+ buttonType: "cancel",
139
+ onClick: () => props.onCancel(),
140
+ text: props.translator.t("WIDGET.CANCEL")
141
+ });
142
+ const reloadButton = mountReloadButton(reloadHost, {
143
+ themeColor: props.themeColor,
144
+ onReload: () => props.onReload()
145
+ });
146
+ const nextButton = mountButton(nextHost, {
147
+ themeColor: props.themeColor,
148
+ buttonType: "next",
149
+ onClick: () => isLastRound() ? props.onSubmit() : props.onNext(),
150
+ text: props.translator.t("WIDGET.SUBMIT")
151
+ });
152
+ const render = () => {
153
+ const activeTheme = themeOf(props.themeColor);
154
+ applyStyles(root, outerStyle(activeTheme));
155
+ applyStyles(inner, { backgroundColor: activeTheme.palette.background.default });
156
+ applyStyles(headerBar, {
157
+ backgroundColor: activeTheme.palette.primaryContainer.main,
158
+ borderRadius: activeTheme.shape.header
159
+ });
160
+ applyStyles(header, { fontFamily: activeTheme.font.fontFamily });
161
+ applyStyles(promptText, promptStyle(activeTheme));
162
+ applyStyles(hintText, hintStyle(activeTheme));
163
+ applyStyles(targetLabel, targetStyle(activeTheme));
164
+ const t = props.translator.t;
165
+ targetLabel.textContent = `${currentCaptcha().target} `;
166
+ promptText.textContent = `${t("WIDGET.SELECT_ALL")}:\u00a0`;
167
+ promptText.appendChild(targetLabel);
168
+ hintText.textContent = t("WIDGET.IF_NONE_CLICK_NEXT");
169
+ applyAttributes(gridHost, addDataAttr({ dev: { cy: `captcha-${props.index}` } }));
170
+ grid.update({
171
+ challenge: currentCaptcha(),
172
+ solution: currentSolution(),
173
+ onClick: props.onClick,
174
+ themeColor: props.themeColor
175
+ });
176
+ cancelButton.update({
177
+ themeColor: props.themeColor,
178
+ buttonType: "cancel",
179
+ onClick: () => props.onCancel(),
180
+ text: t("WIDGET.CANCEL")
181
+ });
182
+ reloadButton.update({
183
+ themeColor: props.themeColor,
184
+ onReload: () => props.onReload()
185
+ });
186
+ nextButton.update({
187
+ themeColor: props.themeColor,
188
+ buttonType: "next",
189
+ onClick: () => isLastRound() ? props.onSubmit() : props.onNext(),
190
+ text: isLastRound() ? t("WIDGET.SUBMIT") : t("WIDGET.NEXT")
191
+ });
192
+ };
193
+ render();
194
+ container.appendChild(root);
195
+ return {
196
+ update: (nextProps) => {
197
+ props = nextProps;
198
+ render();
199
+ },
200
+ destroy: () => {
201
+ grid.destroy();
202
+ cancelButton.destroy();
203
+ reloadButton.destroy();
204
+ nextButton.destroy();
205
+ root.parentNode?.removeChild(root);
206
+ }
207
+ };
208
+ };
209
+ //#endregion
210
+ export { mountCaptchaComponent };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captchaComponent.js","sourceRoot":"","sources":["../../src/components/captchaComponent.ts"],"names":[],"mappings":"AAcA,OAAO,EAGN,eAAe,EACf,WAAW,EACX,aAAa,EACb,iBAAiB,GACjB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAc,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,WAAW,MAAM,kBAAkB,CAAC;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AAC;YACnB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE;SAChC,CAAC,CAAC;QAEH,UAAU,CAAC,MAAM,CAAC;YACjB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,UAAU,EAAE,MAAM;YAClB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAClE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;SAC3D,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,EAAE,CAAC;IACT,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAE5B,OAAO;QACN,MAAM,EAAE,CAAC,SAAgC,EAAE,EAAE;YAC5C,KAAK,GAAG,SAAS,CAAC;YAClB,MAAM,EAAE,CAAC;QACV,CAAC;QACD,OAAO,EAAE,GAAG,EAAE;YACb,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,YAAY,CAAC,OAAO,EAAE,CAAC;YACvB,YAAY,CAAC,OAAO,EAAE,CAAC;YACvB,UAAU,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;KACD,CAAC;AACH,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type Component } from "@prosopo/procaptcha-common";
1
2
  import type { Captcha } from "@prosopo/types";
2
3
  export interface CaptchaWidgetProps {
3
4
  challenge: Captcha;
@@ -5,5 +6,5 @@ export interface CaptchaWidgetProps {
5
6
  onClick: (hash: string, x: number, y: number) => void;
6
7
  themeColor: "light" | "dark";
7
8
  }
8
- export declare const CaptchaWidget: ({ challenge, solution, onClick, themeColor, }: CaptchaWidgetProps) => import("@emotion/react/jsx-runtime").JSX.Element;
9
- //# sourceMappingURL=CaptchaWidget.d.ts.map
9
+ export declare const mountCaptchaWidget: (container: HTMLElement, initialProps: CaptchaWidgetProps) => Component<CaptchaWidgetProps>;
10
+ //# sourceMappingURL=captchaWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captchaWidget.d.ts","sourceRoot":"","sources":["../../src/components/captchaWidget.ts"],"names":[],"mappings":"AAcA,OAAO,EACN,KAAK,SAAS,EAQd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,gBAAgB,CAAC;AAG1D,MAAM,WAAW,kBAAkB;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACrC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC;CAC7B;AAkED,eAAO,MAAM,kBAAkB,cACnB,WAAW,gBACR,kBAAkB,KAC9B,SAAS,CAAC,kBAAkB,CAsN9B,CAAC"}
@@ -0,0 +1,203 @@
1
+ import { Teardown, applyStyles, clearElement, createElement, createSvgElement, isEventTrusted } from "@prosopo/procaptcha-common";
2
+ import { darkTheme, lightTheme } from "@prosopo/widget-skeleton";
3
+ import { ProsopoDatasetError } from "@prosopo/common";
4
+ //#region src/components/captchaWidget.ts
5
+ var getHash = (item) => {
6
+ if (!item.hash) throw new ProsopoDatasetError("CAPTCHA.MISSING_ITEM_HASH", { context: { item } });
7
+ return item.hash;
8
+ };
9
+ var imageStyle = {
10
+ flexGrow: 1,
11
+ flexBasis: "calc(33.333% - 10px)",
12
+ boxSizing: "border-box"
13
+ };
14
+ var CHECK_ICON_PATH = "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z";
15
+ var themeOf = (themeColor) => "light" === themeColor ? lightTheme : darkTheme;
16
+ var gridStyle = (theme) => ({
17
+ width: "100%",
18
+ height: "100%",
19
+ display: "flex",
20
+ flexDirection: "row",
21
+ flexWrap: "wrap",
22
+ justifyContent: "space-between",
23
+ paddingTop: `${theme.spacing.unit}px`,
24
+ paddingBottom: `${theme.spacing.unit}px`,
25
+ gap: "10px"
26
+ });
27
+ var selectionStyle = (theme, selected) => ({
28
+ borderRadius: selected ? theme.shape.tileSelected : theme.shape.tile,
29
+ transform: selected ? "scale(0.9)" : "none"
30
+ });
31
+ /**
32
+ * The selectable image grid.
33
+ *
34
+ * Tiles are rebuilt only when the round's `Captcha` changes identity. Every
35
+ * other update just flips overlay visibility — re-creating `<img>` elements on
36
+ * each selection would restart the image loads and flash the grid, which is the
37
+ * one place the old React reconciler was earning its keep.
38
+ */
39
+ var mountCaptchaWidget = (container, initialProps) => {
40
+ let teardown = new Teardown();
41
+ let props = initialProps;
42
+ let renderedChallenge;
43
+ let tiles = [];
44
+ let focusedHash = null;
45
+ const grid = createElement("div", { style: gridStyle(themeOf(initialProps.themeColor)) });
46
+ const buildTile = (item, index) => {
47
+ const hash = getHash(item);
48
+ const theme = themeOf(props.themeColor);
49
+ const image = createElement("img", {
50
+ style: {
51
+ width: "100%",
52
+ display: "block",
53
+ objectFit: "cover",
54
+ aspectRatio: "1/1",
55
+ height: "auto",
56
+ overflow: "hidden",
57
+ borderStyle: "solid",
58
+ borderWidth: "1px",
59
+ borderColor: theme.palette.tile.border,
60
+ transition: "transform 200ms cubic-bezier(0.2, 0, 0, 1), border-radius 200ms"
61
+ },
62
+ attributes: {
63
+ src: item.data,
64
+ alt: `Captcha image ${index + 1}`
65
+ }
66
+ });
67
+ teardown.addEventListener(image, "error", () => {
68
+ const retryCount = Number(image.dataset.retryCount ?? "0") + 1;
69
+ image.dataset.retryCount = String(retryCount);
70
+ if (retryCount <= 3) image.src = `${item.data}?retry=${Date.now()}`;
71
+ });
72
+ const icon = createSvgElement("svg", {
73
+ style: {
74
+ backgroundColor: theme.palette.checkbox.fill,
75
+ display: "block",
76
+ width: "34px",
77
+ height: "34px",
78
+ padding: "7px",
79
+ borderRadius: "50%",
80
+ boxSizing: "border-box",
81
+ transition: "fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
82
+ userSelect: "none",
83
+ fill: theme.palette.checkbox.tick
84
+ },
85
+ attributes: {
86
+ focusable: "false",
87
+ color: "#fff",
88
+ "aria-hidden": "true",
89
+ viewBox: "0 0 24 24",
90
+ "data-testid": "CheckIcon",
91
+ "aria-label": "Check icon"
92
+ },
93
+ children: [createSvgElement("path", { attributes: { d: CHECK_ICON_PATH } })]
94
+ });
95
+ const overlay = createElement("div", {
96
+ style: {
97
+ position: "absolute",
98
+ top: 0,
99
+ left: 0,
100
+ bottom: 0,
101
+ right: 0,
102
+ height: "100%",
103
+ width: "100%",
104
+ display: "flex",
105
+ alignItems: "center",
106
+ justifyContent: "center",
107
+ backgroundColor: theme.palette.overlay,
108
+ borderRadius: theme.shape.tileSelected,
109
+ visibility: "hidden"
110
+ },
111
+ children: [icon]
112
+ });
113
+ const clickable = createElement("button", {
114
+ style: {
115
+ position: "relative",
116
+ cursor: "pointer",
117
+ height: "100%",
118
+ width: "100%",
119
+ padding: 0,
120
+ margin: 0,
121
+ border: "none",
122
+ background: "none",
123
+ appearance: "none",
124
+ display: "block"
125
+ },
126
+ attributes: { type: "button" },
127
+ children: [image, overlay]
128
+ });
129
+ teardown.addEventListener(clickable, "click", (event) => {
130
+ if (!isEventTrusted(event)) return;
131
+ const mouseEvent = event;
132
+ props.onClick(hash, mouseEvent.clientX, mouseEvent.clientY);
133
+ });
134
+ teardown.addEventListener(clickable, "focus", () => {
135
+ focusedHash = clickable.matches(":focus-visible") ? hash : null;
136
+ applyFocusRing();
137
+ });
138
+ teardown.addEventListener(clickable, "blur", () => {
139
+ focusedHash = null;
140
+ applyFocusRing();
141
+ });
142
+ const cell = createElement("div", {
143
+ style: imageStyle,
144
+ children: [clickable]
145
+ });
146
+ grid.appendChild(cell);
147
+ return {
148
+ hash,
149
+ image,
150
+ overlay,
151
+ clickable
152
+ };
153
+ };
154
+ const applyFocusRing = () => {
155
+ const theme = themeOf(props.themeColor);
156
+ for (const tile of tiles) applyStyles(tile.clickable, focusedHash === tile.hash ? {
157
+ outline: `3px solid ${theme.palette.primary.main}`,
158
+ outlineOffset: "2px"
159
+ } : {
160
+ outline: "none",
161
+ outlineOffset: void 0
162
+ });
163
+ };
164
+ const rebuild = () => {
165
+ teardown.run();
166
+ teardown = new Teardown();
167
+ clearElement(grid);
168
+ applyStyles(grid, gridStyle(themeOf(props.themeColor)));
169
+ tiles = props.challenge.items.map(buildTile);
170
+ renderedChallenge = props.challenge;
171
+ };
172
+ const applySelection = () => {
173
+ const theme = themeOf(props.themeColor);
174
+ for (const tile of tiles) {
175
+ const selected = props.solution.some((entry) => entry[0] === tile.hash);
176
+ applyStyles(tile.image, selectionStyle(theme, selected));
177
+ applyStyles(tile.overlay, { visibility: selected ? "visible" : "hidden" });
178
+ tile.clickable.setAttribute("aria-pressed", String(selected));
179
+ }
180
+ };
181
+ rebuild();
182
+ applySelection();
183
+ applyFocusRing();
184
+ container.appendChild(grid);
185
+ return {
186
+ update: (nextProps) => {
187
+ const needsRebuild = nextProps.challenge !== renderedChallenge || nextProps.themeColor !== props.themeColor;
188
+ props = nextProps;
189
+ if (needsRebuild) {
190
+ focusedHash = null;
191
+ rebuild();
192
+ }
193
+ applySelection();
194
+ applyFocusRing();
195
+ },
196
+ destroy: () => {
197
+ teardown.run();
198
+ grid.parentNode?.removeChild(grid);
199
+ }
200
+ };
201
+ };
202
+ //#endregion
203
+ export { mountCaptchaWidget };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captchaWidget.js","sourceRoot":"","sources":["../../src/components/captchaWidget.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB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ACnB,OAAO,EAAE,CAAC;YACX,CAAC;YACD,cAAc,EAAE,CAAC;YACjB,cAAc,EAAE,CAAC;QAClB,CAAC;QACD,OAAO,EAAE,GAAG,EAAE;YACb,QAAQ,CAAC,GAAG,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;KACD,CAAC;AACH,CAAC,CAAC"}
@@ -1,9 +1,10 @@
1
+ import { type Component } from "@prosopo/procaptcha-common";
1
2
  import type { Account, StoredEvents } from "@prosopo/types";
2
- type CollectorProps = {
3
+ export interface CollectorProps {
3
4
  onProcessData: (data: StoredEvents) => void;
4
5
  sendData: boolean;
5
6
  account: Account | undefined;
6
- };
7
- declare const Collector: ({ onProcessData, sendData, account }: CollectorProps) => import("@emotion/react/jsx-runtime").JSX.Element;
8
- export default Collector;
7
+ }
8
+ export declare const mountCollector: (container: HTMLElement, initialProps: CollectorProps) => Component<CollectorProps>;
9
+ export default mountCollector;
9
10
  //# sourceMappingURL=collector.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/components/collector.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,4BAA4B,CAAC;AAC3E,OAAO,KAAK,EACX,OAAO,EAIP,YAAY,EACZ,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,cAAc;IAC9B,aAAa,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B;AAkBD,eAAO,MAAM,cAAc,cACf,WAAW,gBACR,cAAc,KAC1B,SAAS,CAAC,cAAc,CAoD1B,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,26 +1,48 @@
1
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
1
+ import { createElement } from "@prosopo/procaptcha-common";
2
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 });
3
+ //#region src/components/collector.ts
4
+ /**
5
+ * `startCollector` speaks the React setState shape (value or updater fn), so
6
+ * this adapts a plain array to it rather than changing the collector's
7
+ * signature — it is shared with the direct-consumer entry points.
8
+ */
9
+ var arrayUpdater = (target) => {
10
+ return (update) => {
11
+ const next = "function" === typeof update ? update([...target]) : [...update];
12
+ target.length = 0;
13
+ target.push(...next);
14
+ };
24
15
  };
25
- export default Collector;
26
- //# sourceMappingURL=collector.js.map
16
+ var mountCollector = (container, initialProps) => {
17
+ let props = initialProps;
18
+ const mouseEvents = [];
19
+ const touchEvents = [];
20
+ const keyboardEvents = [];
21
+ const root = createElement("div");
22
+ container.appendChild(root);
23
+ startCollector(arrayUpdater(mouseEvents), arrayUpdater(touchEvents), arrayUpdater(keyboardEvents), root);
24
+ let lastAccount;
25
+ let lastOnProcessData;
26
+ const emit = () => {
27
+ if (props.account === lastAccount && props.onProcessData === lastOnProcessData) return;
28
+ lastAccount = props.account;
29
+ lastOnProcessData = props.onProcessData;
30
+ if (props.account) props.onProcessData({
31
+ mouseEvents,
32
+ touchEvents,
33
+ keyboardEvents
34
+ });
35
+ };
36
+ emit();
37
+ return {
38
+ update: (nextProps) => {
39
+ props = nextProps;
40
+ emit();
41
+ },
42
+ destroy: () => {
43
+ root.parentNode?.removeChild(root);
44
+ }
45
+ };
46
+ };
47
+ //#endregion
48
+ export { mountCollector as default, mountCollector };
@@ -1 +1 @@
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,CAA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CAAC,CAAC;IAE5B,cAAc,CACb,YAAY,CAAC,WAAW,CAAC,EACzB,YAAY,CAAC,WAAW,CAAC,EACzB,YAAY,CAAC,cAAc,CAAC,EAC5B,IAAI,CACJ,CAAC;IAKF,IAAI,WAAgC,CAAC;IACrC,IAAI,iBAA8D,CAAC;IAEnE,MAAM,IAAI,GAAG,GAAG,EAAE;QACjB,IACC,KAAK,CAAC,OAAO,KAAK,WAAW;YAC7B,KAAK,CAAC,aAAa,KAAK,iBAAiB,EACxC,CAAC;YACF,OAAO;QACR,CAAC;QACD,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC;QAC5B,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC;QACxC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,KAAK,CAAC,aAAa,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;QACnE,CAAC;IACF,CAAC,CAAC;IAEF,IAAI,EAAE,CAAC;IAEP,OAAO;QACN,MAAM,EAAE,CAAC,SAAyB,EAAE,EAAE;YACrC,KAAK,GAAG,SAAS,CAAC;YAClB,IAAI,EAAE,CAAC;QACR,CAAC;QACD,OAAO,EAAE,GAAG,EAAE;YAMb,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;KACD,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,6 +1,8 @@
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";
1
+ export * from "./button.js";
2
+ export * from "./modal.js";
3
+ export * from "./captchaWidget.js";
4
+ export * from "./captchaComponent.js";
5
+ export * from "./collector.js";
6
+ export * from "./procaptchaWidget.js";
7
+ export * from "./procaptcha.js";
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC"}
@@ -1,4 +1,8 @@
1
- import { CaptchaWidget } from "./CaptchaWidget.js";
2
- import ProcaptchaWidget from "./ProcaptchaWidget.js";
3
- import Procaptcha from "./Procaptcha.js";
4
- export { CaptchaWidget, Procaptcha, ProcaptchaWidget };
1
+ import { mountButton } from "./button.js";
2
+ import { mountModal } from "./modal.js";
3
+ import { mountCaptchaWidget } from "./captchaWidget.js";
4
+ import { mountCaptchaComponent } from "./captchaComponent.js";
5
+ import mountCollector from "./collector.js";
6
+ import mountProcaptchaImageWidget from "./procaptchaWidget.js";
7
+ import { loadProcaptcha, mountProcaptcha } from "./procaptcha.js";
8
+ export { loadProcaptcha, mountButton, mountCaptchaComponent, mountCaptchaWidget, mountCollector, mountModal, mountProcaptcha, mountProcaptchaImageWidget };
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Component } from "@prosopo/procaptcha-common";
2
+ import type { PlacementType } from "@prosopo/types";
3
+ export interface ModalProps {
4
+ show: boolean;
5
+ placement?: PlacementType;
6
+ anchor?: HTMLElement | null;
7
+ onDismiss?: () => void;
8
+ dialogLabel?: string;
9
+ }
10
+ export interface ModalComponent extends Component<ModalProps> {
11
+ readonly content: HTMLElement;
12
+ }
13
+ export declare const mountModal: (initialProps: ModalProps) => ModalComponent;
14
+ //# sourceMappingURL=modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/components/modal.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAe,SAAQ,SAAS,CAAC,UAAU,CAAC;IAE5D,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;CAC9B;AAKD,eAAO,MAAM,UAAU,iBAAkB,UAAU,KAAG,cAiCrD,CAAC"}