@prosopo/procaptcha-frictionless 0.3.3 → 0.3.4

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.
@@ -58,7 +58,7 @@ class ExtensionWeb2 extends Extension.Extension {
58
58
  }
59
59
  },
60
60
  name: "procaptcha-web2",
61
- version: "0.1.11",
61
+ version: "0.3.x",
62
62
  signer
63
63
  };
64
64
  }
@@ -87,8 +87,12 @@ const Manager = (configInput, state, onStateUpdate, callbacks) => {
87
87
  return;
88
88
  }
89
89
  resetState();
90
- updateState({ loading: true });
91
90
  const config = getConfig();
91
+ const userAccount = config.userAccountAddress || "5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM";
92
+ updateState({
93
+ loading: true,
94
+ account: { account: { address: userAccount } }
95
+ });
92
96
  updateState({ dappAccount: config.account.address });
93
97
  await procaptcha.sleep(100);
94
98
  if (!config.web2 && !config.userAccountAddress) {
@@ -105,14 +109,18 @@ const Manager = (configInput, state, onStateUpdate, callbacks) => {
105
109
  const providerApi = new api.ProviderApi(getNetwork(getConfig()), providerUrl, getDappAccount());
106
110
  const challenge = await providerApi.getPowCaptchaChallenge(account.account.address, getDappAccount());
107
111
  const solution = SolverService.solvePoW(challenge.challenge, challenge.difficulty);
108
- await providerApi.submitPowCaptchaSolution(challenge, getAccount().account.address, getDappAccount(), getRandomProviderResponse, solution);
109
- if (state.isHuman) {
112
+ const verifiedSolution = await providerApi.submitPowCaptchaSolution(challenge, getAccount().account.address, getDappAccount(), getRandomProviderResponse, solution);
113
+ if (verifiedSolution[types.ApiParams.verified]) {
114
+ updateState({
115
+ isHuman: true,
116
+ loading: false
117
+ });
110
118
  events.onHuman({
111
119
  providerUrl,
112
120
  [types.ApiParams.user]: getAccount().account.address,
113
121
  [types.ApiParams.dapp]: getDappAccount(),
114
- [types.ApiParams.challengeId]: challenge.challenge,
115
- [types.ApiParams.blockNumber]: getBlockNumber()
122
+ [types.ApiParams.challenge]: challenge.challenge,
123
+ [types.ApiParams.blockNumber]: getRandomProviderResponse.blockNumber
116
124
  });
117
125
  }
118
126
  };
@@ -19,11 +19,11 @@ const Procaptcha = (props) => {
19
19
  const updateState = procaptchaCommon.buildUpdateState(state, _updateState);
20
20
  const manager = Manager.Manager(config, state, updateState, callbacks);
21
21
  return jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: jsxRuntime.jsx(Containers.ContainerDiv, { children: jsxRuntime.jsx(Containers.WidthBasedStylesDiv, { children: jsxRuntime.jsxs("div", { style: WidgetConstants.WIDGET_DIMENSIONS, "data-cy": "button-human", children: [" ", jsxRuntime.jsxs("div", { style: {
22
- padding: "2px",
23
- border: "1px solid",
22
+ padding: WidgetConstants.WIDGET_PADDING,
23
+ border: WidgetConstants.WIDGET_BORDER,
24
24
  backgroundColor: theme$1.palette.background.default,
25
25
  borderColor: theme$1.palette.grey[300],
26
- borderRadius: "4px",
26
+ borderRadius: WidgetConstants.WIDGET_BORDER_RADIUS,
27
27
  display: "flex",
28
28
  alignItems: "center",
29
29
  flexWrap: "wrap",
@@ -10,11 +10,11 @@ const ProcaptchaPlaceholder = (props) => {
10
10
  const themeColor = props.darkMode === "light" ? "light" : "dark";
11
11
  const theme$1 = props.darkMode === "light" ? theme.lightTheme : theme.darkTheme;
12
12
  return jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: jsxRuntime.jsx(Containers.ContainerDiv, { children: jsxRuntime.jsx(Containers.WidthBasedStylesDiv, { children: jsxRuntime.jsxs("div", { style: WidgetConstants.WIDGET_DIMENSIONS, "data-cy": "button-human", children: [" ", jsxRuntime.jsxs("div", { style: {
13
- padding: "2px",
14
- border: "1px solid",
13
+ padding: WidgetConstants.WIDGET_PADDING,
14
+ border: WidgetConstants.WIDGET_BORDER,
15
15
  backgroundColor: theme$1.palette.background.default,
16
16
  borderColor: theme$1.palette.grey[300],
17
- borderRadius: "8px",
17
+ borderRadius: WidgetConstants.WIDGET_BORDER_RADIUS,
18
18
  display: "flex",
19
19
  alignItems: "center",
20
20
  flexWrap: "wrap",
@@ -5,8 +5,14 @@ const WIDGET_URL_TEXT = "Visit prosopo.io to learn more about the service and it
5
5
  const WIDGET_INNER_HEIGHT = 74;
6
6
  const WIDGET_OUTER_HEIGHT = 80;
7
7
  const WIDGET_DIMENSIONS = { maxWidth: "400px", minWidth: "200px", minHeight: `${WIDGET_OUTER_HEIGHT}px` };
8
+ const WIDGET_BORDER_RADIUS = "8px";
9
+ const WIDGET_PADDING = "2px";
10
+ const WIDGET_BORDER = "1px solid";
11
+ exports.WIDGET_BORDER = WIDGET_BORDER;
12
+ exports.WIDGET_BORDER_RADIUS = WIDGET_BORDER_RADIUS;
8
13
  exports.WIDGET_DIMENSIONS = WIDGET_DIMENSIONS;
9
14
  exports.WIDGET_INNER_HEIGHT = WIDGET_INNER_HEIGHT;
10
15
  exports.WIDGET_OUTER_HEIGHT = WIDGET_OUTER_HEIGHT;
16
+ exports.WIDGET_PADDING = WIDGET_PADDING;
11
17
  exports.WIDGET_URL = WIDGET_URL;
12
18
  exports.WIDGET_URL_TEXT = WIDGET_URL_TEXT;
@@ -15,8 +15,11 @@ exports.Checkbox = Checkbox.Checkbox;
15
15
  exports.Logo = Logo;
16
16
  exports.ContainerDiv = Containers.ContainerDiv;
17
17
  exports.WidthBasedStylesDiv = Containers.WidthBasedStylesDiv;
18
+ exports.WIDGET_BORDER = WidgetConstants.WIDGET_BORDER;
19
+ exports.WIDGET_BORDER_RADIUS = WidgetConstants.WIDGET_BORDER_RADIUS;
18
20
  exports.WIDGET_DIMENSIONS = WidgetConstants.WIDGET_DIMENSIONS;
19
21
  exports.WIDGET_INNER_HEIGHT = WidgetConstants.WIDGET_INNER_HEIGHT;
20
22
  exports.WIDGET_OUTER_HEIGHT = WidgetConstants.WIDGET_OUTER_HEIGHT;
23
+ exports.WIDGET_PADDING = WidgetConstants.WIDGET_PADDING;
21
24
  exports.WIDGET_URL = WidgetConstants.WIDGET_URL;
22
25
  exports.WIDGET_URL_TEXT = WidgetConstants.WIDGET_URL_TEXT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/procaptcha-frictionless",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "author": "PROSOPO LIMITED <info@prosopo.io>",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -34,9 +34,9 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@fingerprintjs/botd": "^1.9.0",
37
- "@prosopo/procaptcha-pow": "0.3.3",
38
- "@prosopo/procaptcha-react": "0.3.3",
39
- "@prosopo/web-components": "0.3.3",
37
+ "@prosopo/procaptcha-pow": "0.3.4",
38
+ "@prosopo/procaptcha-react": "0.3.4",
39
+ "@prosopo/web-components": "0.3.4",
40
40
  "react": "^18.2.0"
41
41
  },
42
42
  "devDependencies": {