@prosopo/procaptcha-pow 0.3.39 → 0.3.41

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Manager.d.ts","sourceRoot":"","sources":["../../src/Services/Manager.ts"],"names":[],"mappings":"AAaA,OAAO,EAGH,mBAAmB,EACnB,2BAA2B,EAG3B,eAAe,EACf,uBAAuB,EAC1B,MAAM,gBAAgB,CAAA;AAcvB,eAAO,MAAM,OAAO,gBACH,2BAA2B,SACjC,eAAe,iBACP,uBAAuB,aAC3B,mBAAmB;;CAsLjC,CAAA"}
1
+ {"version":3,"file":"Manager.d.ts","sourceRoot":"","sources":["../../src/Services/Manager.ts"],"names":[],"mappings":"AAaA,OAAO,EAGH,mBAAmB,EACnB,2BAA2B,EAG3B,eAAe,EACf,uBAAuB,EAC1B,MAAM,gBAAgB,CAAA;AAcvB,eAAO,MAAM,OAAO,gBACH,2BAA2B,SACjC,eAAe,iBACP,uBAAuB,aAC3B,mBAAmB;;CA8LjC,CAAA"}
@@ -3,14 +3,15 @@ import { ApiPromise } from '@polkadot/api/promise/Api';
3
3
  import { ExtensionWeb2 } from '@prosopo/account';
4
4
  import { Keyring } from '@polkadot/keyring';
5
5
  import { ProsopoCaptchaContract, wrapQuery } from '@prosopo/contract';
6
- import { ProsopoContractError, ProsopoEnvError, trimProviderUrl } from '@prosopo/common';
6
+ import { ProsopoEnvError, trimProviderUrl } from '@prosopo/common';
7
7
  import { ProviderApi } from '@prosopo/api';
8
8
  import { WsProvider } from '@polkadot/rpc-provider/ws';
9
9
  import { ContractAbi as abiJson } from '@prosopo/captcha-contract/contract-info';
10
10
  import { buildUpdateState, getDefaultEvents } from '@prosopo/procaptcha-common';
11
11
  import { sleep } from '@prosopo/procaptcha';
12
- import { solvePoW } from './SolverService.js';
12
+ import { solvePoW } from '@prosopo/util';
13
13
  export const Manager = (configInput, state, onStateUpdate, callbacks) => {
14
+ const events = getDefaultEvents(onStateUpdate, state, callbacks);
14
15
  const defaultState = () => {
15
16
  return {
16
17
  showModal: false,
@@ -68,18 +69,19 @@ export const Manager = (configInput, state, onStateUpdate, callbacks) => {
68
69
  const dappAccount = state.dappAccount;
69
70
  return dappAccount;
70
71
  };
71
- const getBlockNumber = () => {
72
- if (!state.blockNumber) {
73
- throw new ProsopoContractError('CAPTCHA.INVALID_BLOCK_NO', { context: { error: 'Block number not found' } });
74
- }
75
- const blockNumber = state.blockNumber;
76
- return blockNumber;
77
- };
78
72
  const updateState = buildUpdateState(state, onStateUpdate);
79
73
  const resetState = () => {
80
74
  clearTimeout();
81
75
  updateState(defaultState());
82
76
  };
77
+ const setValidChallengeTimeout = () => {
78
+ const timeMillis = getConfig().captchas.pow.solutionTimeout;
79
+ const successfullChallengeTimeout = setTimeout(() => {
80
+ updateState({ isHuman: false });
81
+ events.onExpired();
82
+ }, timeMillis);
83
+ updateState({ successfullChallengeTimeout });
84
+ };
83
85
  const start = async () => {
84
86
  if (state.loading) {
85
87
  return;
@@ -111,7 +113,7 @@ export const Manager = (configInput, state, onStateUpdate, callbacks) => {
111
113
  const providerApi = new ProviderApi(getNetwork(getConfig()), providerUrl, getDappAccount());
112
114
  const challenge = await providerApi.getPowCaptchaChallenge(userAccount, getDappAccount());
113
115
  const solution = solvePoW(challenge.challenge, challenge.difficulty);
114
- const verifiedSolution = await providerApi.submitPowCaptchaSolution(challenge, getAccount().account.address, getDappAccount(), getRandomProviderResponse, solution);
116
+ const verifiedSolution = await providerApi.submitPowCaptchaSolution(challenge, getAccount().account.address, getDappAccount(), getRandomProviderResponse, solution, config.captchas.pow.verifiedTimeout);
115
117
  if (verifiedSolution[ApiParams.verified]) {
116
118
  updateState({
117
119
  isHuman: true,
@@ -124,6 +126,7 @@ export const Manager = (configInput, state, onStateUpdate, callbacks) => {
124
126
  [ApiParams.challenge]: challenge.challenge,
125
127
  [ApiParams.blockNumber]: getRandomProviderResponse.blockNumber,
126
128
  });
129
+ setValidChallengeTimeout();
127
130
  }
128
131
  };
129
132
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"Manager.js","sourceRoot":"","sources":["../../src/Services/Manager.ts"],"names":[],"mappings":"AAaA,OAAO,EAEH,SAAS,EAIT,sBAAsB,GAGzB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,WAAW,IAAI,OAAO,EAAE,MAAM,yCAAyC,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,MAAM,CAAC,MAAM,OAAO,GAAG,CACnB,WAAwC,EACxC,KAAsB,EACtB,aAAsC,EACtC,SAA8B,EAChC,EAAE;IACA,MAAM,YAAY,GAAG,GAA6B,EAAE;QAChD,OAAO;YAEH,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,CAAC;YACR,SAAS,EAAE,SAAS;YACpB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,SAAS;YACrB,OAAO,EAAE,SAAS;SAErB,CAAA;IACL,CAAC,CAAA;IAED,MAAM,YAAY,GAAG,GAAG,EAAE;QAEtB,MAAM,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,UAAU,CAAC,CAAA;QACpE,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,wBAAwB,CAC/D,SAAS,EACT,UAAU,EAAE,CAAC,OAAO,CAAC,OAAO,EAC5B,cAAc,EAAE,EAChB,yBAAyB,EACzB,QAAQ,EACR,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,eAAe,CACtC,CAAA;QACD,IAAI,gBAAgB,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE;YACtC,WAAW,CAAC;gBACR,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,KAAK;aACjB,CAAC,CAAA;YACF,MAAM,CAAC,OAAO,CAAC;gBACX,WAAW;gBACX,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC,OAAO,CAAC,OAAO;gBAC9C,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE;gBAClC,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS;gBAC1C,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,yBAAyB,CAAC,WAAW;aACjE,CAAC,CAAA;YACF,wBAAwB,EAAE,CAAA;SAC7B;IACL,CAAC,CAAA;IAED,OAAO;QACH,KAAK;KACR,CAAA;AACL,CAAC,CAAA"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const types = require("@prosopo/types");
4
4
  const Api = require("@polkadot/api/promise/Api");
5
- require("../account/dist/index.cjs");
5
+ const account = require("@prosopo/account");
6
6
  const keyring = require("@polkadot/keyring");
7
7
  const contract = require("@prosopo/contract");
8
8
  const common = require("@prosopo/common");
@@ -11,9 +11,9 @@ const ws = require("@polkadot/rpc-provider/ws");
11
11
  const contractInfo = require("@prosopo/captcha-contract/contract-info");
12
12
  const procaptchaCommon = require("@prosopo/procaptcha-common");
13
13
  const procaptcha = require("@prosopo/procaptcha");
14
- const SolverService = require("./SolverService.cjs");
15
- const ExtensionWeb2 = require("../account/dist/extension/ExtensionWeb2.cjs");
14
+ const util = require("@prosopo/util");
16
15
  const Manager = (configInput, state, onStateUpdate, callbacks) => {
16
+ const events = procaptchaCommon.getDefaultEvents(onStateUpdate, state, callbacks);
17
17
  const defaultState = () => {
18
18
  return {
19
19
  // note order matters! see buildUpdateState. These fields are set in order, so disable modal first, then set loading to false, etc.
@@ -70,8 +70,8 @@ const Manager = (configInput, state, onStateUpdate, callbacks) => {
70
70
  if (!state.account) {
71
71
  throw new common.ProsopoEnvError("GENERAL.ACCOUNT_NOT_FOUND", { context: { error: "Account not loaded" } });
72
72
  }
73
- const account = state.account;
74
- return account;
73
+ const account2 = state.account;
74
+ return account2;
75
75
  };
76
76
  const getDappAccount = () => {
77
77
  if (!state.dappAccount) {
@@ -80,18 +80,19 @@ const Manager = (configInput, state, onStateUpdate, callbacks) => {
80
80
  const dappAccount = state.dappAccount;
81
81
  return dappAccount;
82
82
  };
83
- const getBlockNumber = () => {
84
- if (!state.blockNumber) {
85
- throw new common.ProsopoContractError("CAPTCHA.INVALID_BLOCK_NO", { context: { error: "Block number not found" } });
86
- }
87
- const blockNumber = state.blockNumber;
88
- return blockNumber;
89
- };
90
83
  const updateState = procaptchaCommon.buildUpdateState(state, onStateUpdate);
91
84
  const resetState = () => {
92
85
  clearTimeout();
93
86
  updateState(defaultState());
94
87
  };
88
+ const setValidChallengeTimeout = () => {
89
+ const timeMillis = getConfig().captchas.pow.solutionTimeout;
90
+ const successfullChallengeTimeout = setTimeout(() => {
91
+ updateState({ isHuman: false });
92
+ events.onExpired();
93
+ }, timeMillis);
94
+ updateState({ successfullChallengeTimeout });
95
+ };
95
96
  const start = async () => {
96
97
  if (state.loading) {
97
98
  return;
@@ -104,7 +105,7 @@ const Manager = (configInput, state, onStateUpdate, callbacks) => {
104
105
  loading: true
105
106
  });
106
107
  const config = getConfig();
107
- const ext = new ExtensionWeb2.ExtensionWeb2();
108
+ const ext = new account.ExtensionWeb2();
108
109
  const userAccount = config.userAccountAddress || (await ext.getAccount(config)).account.address;
109
110
  updateState({
110
111
  account: { account: { address: userAccount } }
@@ -117,7 +118,7 @@ const Manager = (configInput, state, onStateUpdate, callbacks) => {
117
118
  });
118
119
  }
119
120
  const contract$1 = await loadContract();
120
- const events = procaptchaCommon.getDefaultEvents(onStateUpdate, state, callbacks);
121
+ const events2 = procaptchaCommon.getDefaultEvents(onStateUpdate, state, callbacks);
121
122
  const getRandomProviderResponse = await contract.wrapQuery(
122
123
  contract$1.query.getRandomActiveProvider,
123
124
  contract$1.query
@@ -125,26 +126,28 @@ const Manager = (configInput, state, onStateUpdate, callbacks) => {
125
126
  const providerUrl = common.trimProviderUrl(getRandomProviderResponse.provider.url.toString());
126
127
  const providerApi = new api.ProviderApi(getNetwork(getConfig()), providerUrl, getDappAccount());
127
128
  const challenge = await providerApi.getPowCaptchaChallenge(userAccount, getDappAccount());
128
- const solution = SolverService.solvePoW(challenge.challenge, challenge.difficulty);
129
+ const solution = util.solvePoW(challenge.challenge, challenge.difficulty);
129
130
  const verifiedSolution = await providerApi.submitPowCaptchaSolution(
130
131
  challenge,
131
132
  getAccount().account.address,
132
133
  getDappAccount(),
133
134
  getRandomProviderResponse,
134
- solution
135
+ solution,
136
+ config.captchas.pow.verifiedTimeout
135
137
  );
136
138
  if (verifiedSolution[types.ApiParams.verified]) {
137
139
  updateState({
138
140
  isHuman: true,
139
141
  loading: false
140
142
  });
141
- events.onHuman({
143
+ events2.onHuman({
142
144
  providerUrl,
143
145
  [types.ApiParams.user]: getAccount().account.address,
144
146
  [types.ApiParams.dapp]: getDappAccount(),
145
147
  [types.ApiParams.challenge]: challenge.challenge,
146
148
  [types.ApiParams.blockNumber]: getRandomProviderResponse.blockNumber
147
149
  });
150
+ setValidChallengeTimeout();
148
151
  }
149
152
  };
150
153
  return {
@@ -1,39 +1,33 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("@emotion/react/jsx-runtime");
3
- require("../web-components/dist/index.cjs");
3
+ const webComponents = require("@prosopo/web-components");
4
4
  const Manager = require("../Services/Manager.cjs");
5
5
  const procaptchaCommon = require("@prosopo/procaptcha-common");
6
6
  const react = require("react");
7
- const theme = require("../web-components/dist/theme.cjs");
8
- const Containers = require("../web-components/dist/Containers.cjs");
9
- const WidgetConstants = require("../web-components/dist/WidgetConstants.cjs");
10
- const LoadingSpinner = require("../web-components/dist/LoadingSpinner.cjs");
11
- const Checkbox = require("../web-components/dist/Checkbox.cjs");
12
- const Logo = require("../web-components/dist/Logo.cjs");
13
7
  const Procaptcha = (props) => {
14
8
  const config = props.config;
15
9
  const themeColor = config.theme === "light" ? "light" : "dark";
16
- const theme$1 = props.config.theme === "light" ? theme.lightTheme : theme.darkTheme;
10
+ const theme = props.config.theme === "light" ? webComponents.lightTheme : webComponents.darkTheme;
17
11
  const callbacks = props.callbacks || {};
18
12
  const [state, _updateState] = procaptchaCommon.useProcaptcha(react.useState, react.useRef);
19
13
  const updateState = procaptchaCommon.buildUpdateState(state, _updateState);
20
14
  const manager = Manager.Manager(config, state, updateState, callbacks);
21
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(Containers.ContainerDiv, { children: /* @__PURE__ */ jsxRuntime.jsx(Containers.WidthBasedStylesDiv, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: WidgetConstants.WIDGET_DIMENSIONS, "data-cy": "button-human", children: [
15
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(webComponents.ContainerDiv, { children: /* @__PURE__ */ jsxRuntime.jsx(webComponents.WidthBasedStylesDiv, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: webComponents.WIDGET_DIMENSIONS, "data-cy": "button-human", children: [
22
16
  " ",
23
17
  /* @__PURE__ */ jsxRuntime.jsxs(
24
18
  "div",
25
19
  {
26
20
  style: {
27
- padding: WidgetConstants.WIDGET_PADDING,
28
- border: WidgetConstants.WIDGET_BORDER,
29
- backgroundColor: theme$1.palette.background.default,
30
- borderColor: theme$1.palette.grey[300],
31
- borderRadius: WidgetConstants.WIDGET_BORDER_RADIUS,
21
+ padding: webComponents.WIDGET_PADDING,
22
+ border: webComponents.WIDGET_BORDER,
23
+ backgroundColor: theme.palette.background.default,
24
+ borderColor: theme.palette.grey[300],
25
+ borderRadius: webComponents.WIDGET_BORDER_RADIUS,
32
26
  display: "flex",
33
27
  alignItems: "center",
34
28
  flexWrap: "wrap",
35
29
  justifyContent: "space-between",
36
- minHeight: `${WidgetConstants.WIDGET_INNER_HEIGHT}px`,
30
+ minHeight: `${webComponents.WIDGET_INNER_HEIGHT}px`,
37
31
  overflow: "hidden"
38
32
  },
39
33
  children: [
@@ -62,8 +56,8 @@ const Procaptcha = (props) => {
62
56
  style: {
63
57
  display: "flex"
64
58
  },
65
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1 }, children: state.loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner.LoadingSpinner, { themeColor }) : /* @__PURE__ */ jsxRuntime.jsx(
66
- Checkbox.Checkbox,
59
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1 }, children: state.loading ? /* @__PURE__ */ jsxRuntime.jsx(webComponents.LoadingSpinner, { themeColor }) : /* @__PURE__ */ jsxRuntime.jsx(
60
+ webComponents.Checkbox,
67
61
  {
68
62
  checked: state.isHuman,
69
63
  onChange: manager.start,
@@ -77,7 +71,7 @@ const Procaptcha = (props) => {
77
71
  )
78
72
  }
79
73
  ) }),
80
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "inline-flex", flexDirection: "column" }, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: WidgetConstants.WIDGET_URL, target: "_blank", "aria-label": WidgetConstants.WIDGET_URL_TEXT, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Logo, { themeColor }) }) }) })
74
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "inline-flex", flexDirection: "column" }, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: webComponents.WIDGET_URL, target: "_blank", "aria-label": webComponents.WIDGET_URL_TEXT, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(webComponents.Logo, { themeColor }) }) }) })
81
75
  ]
82
76
  }
83
77
  )
@@ -2,11 +2,10 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@emotion/react/jsx-runtime");
4
4
  const react = require("react");
5
- require("../web-components/dist/index.cjs");
6
- const CaptchaPlaceholder = require("../web-components/dist/CaptchaPlaceholder.cjs");
5
+ const webComponents = require("@prosopo/web-components");
7
6
  const _interopNamespaceDefaultOnly = (e) => Object.freeze(Object.defineProperty({ __proto__: null, default: e }, Symbol.toStringTag, { value: "Module" }));
8
7
  const ProcaptchaWidget = react.lazy(
9
8
  async () => Promise.resolve().then(() => /* @__PURE__ */ _interopNamespaceDefaultOnly(require("./Captcha.cjs")))
10
9
  );
11
- const ProcaptchaPow = (props) => /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(CaptchaPlaceholder.ProcaptchaPlaceholder, { darkMode: props.config.theme }), children: /* @__PURE__ */ jsxRuntime.jsx(ProcaptchaWidget, { config: props.config, callbacks: props.callbacks }) });
10
+ const ProcaptchaPow = (props) => /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(webComponents.ProcaptchaPlaceholder, { darkMode: props.config.theme }), children: /* @__PURE__ */ jsxRuntime.jsx(ProcaptchaWidget, { config: props.config, callbacks: props.callbacks }) });
12
11
  exports.ProcaptchaPow = ProcaptchaPow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/procaptcha-pow",
3
- "version": "0.3.39",
3
+ "version": "0.3.41",
4
4
  "author": "PROSOPO LIMITED <info@prosopo.io>",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "clean": "tsc --build --clean",
24
24
  "build": "tsc --build --verbose tsconfig.json",
25
25
  "build:cjs": "npx vite --config vite.cjs.config.ts build",
26
- "eslint": "npx eslint . --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
26
+ "eslint": "npx eslint . --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
27
27
  "eslint:fix": "npm run eslint -- --fix",
28
28
  "prettier": "npx prettier . --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
29
29
  "prettier:fix": "npm run prettier -- --write",
@@ -35,17 +35,20 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@emotion/react": "^11.11.1",
38
- "@emotion/styled": "^11.11.0",
39
- "@noble/hashes": "^1.3.3",
40
- "@polkadot/extension-inject": "0.46.9",
41
- "@prosopo/account": "0.3.39",
42
- "@prosopo/api": "0.3.39",
43
- "@prosopo/common": "0.3.39",
44
- "@prosopo/procaptcha": "0.3.39",
45
- "@prosopo/types": "0.3.39",
46
- "@prosopo/util": "0.3.39",
47
- "@prosopo/web-components": "0.3.39",
48
- "react": "^18.2.0"
38
+ "@prosopo/account": "0.3.41",
39
+ "@polkadot/api": "10.13.1",
40
+ "@polkadot/keyring": "12.6.2",
41
+ "@polkadot/rpc-provider": "10.13.1",
42
+ "@prosopo/api": "0.3.41",
43
+ "@prosopo/captcha-contract": "0.3.41",
44
+ "@prosopo/common": "0.3.41",
45
+ "@prosopo/contract": "0.3.41",
46
+ "@prosopo/procaptcha": "0.3.41",
47
+ "@prosopo/procaptcha-common": "0.3.41",
48
+ "@prosopo/types": "0.3.41",
49
+ "@prosopo/util": "0.3.41",
50
+ "@prosopo/web-components": "0.3.41",
51
+ "react": "^18.3.1"
49
52
  },
50
53
  "overrides": {
51
54
  "@polkadot/extension-inject": {
@@ -1,2 +0,0 @@
1
- export declare const solvePoW: (data: string, difficulty: number) => number;
2
- //# sourceMappingURL=SolverService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SolverService.d.ts","sourceRoot":"","sources":["../../src/Services/SolverService.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,SAAU,MAAM,cAAc,MAAM,KAAG,MAe3D,CAAA"}
@@ -1,17 +0,0 @@
1
- import { sha256 } from '@noble/hashes/sha256';
2
- export const solvePoW = (data, difficulty) => {
3
- let nonce = 0;
4
- const prefix = '0'.repeat(difficulty);
5
- while (true) {
6
- const message = new TextEncoder().encode(nonce + data);
7
- const hashHex = bufferToHex(sha256(message));
8
- if (hashHex.startsWith(prefix)) {
9
- return nonce;
10
- }
11
- nonce += 1;
12
- }
13
- };
14
- const bufferToHex = (buffer) => Array.from(buffer)
15
- .map((byte) => byte.toString(16).padStart(2, '0'))
16
- .join('');
17
- //# sourceMappingURL=SolverService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SolverService.js","sourceRoot":"","sources":["../../src/Services/SolverService.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAE7C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,UAAkB,EAAU,EAAE;IACjE,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IAGrC,OAAO,IAAI,EAAE;QACT,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,CAAA;QACtD,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;QAE5C,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YAC5B,OAAO,KAAK,CAAA;SACf;QAED,KAAK,IAAI,CAAC,CAAA;KACb;AACL,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAU,EAAE,CAC/C,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;KACb,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;KACjD,IAAI,CAAC,EAAE,CAAC,CAAA"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sha256 = require("@noble/hashes/sha256");
4
- const solvePoW = (data, difficulty) => {
5
- let nonce = 0;
6
- const prefix = "0".repeat(difficulty);
7
- while (true) {
8
- const message = new TextEncoder().encode(nonce + data);
9
- const hashHex = bufferToHex(sha256.sha256(message));
10
- if (hashHex.startsWith(prefix)) {
11
- return nonce;
12
- }
13
- nonce += 1;
14
- }
15
- };
16
- const bufferToHex = (buffer) => Array.from(buffer).map((byte) => byte.toString(16).padStart(2, "0")).join("");
17
- exports.solvePoW = solvePoW;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- class Extension {
4
- }
5
- exports.Extension = Extension;
@@ -1,100 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Api = require("@polkadot/api/promise/Api");
4
- const Extension = require("./Extension.cjs");
5
- const keyring = require("@polkadot/keyring");
6
- const common = require("@prosopo/common");
7
- const ws = require("@polkadot/rpc-provider/ws");
8
- const address = require("@polkadot/util-crypto/address");
9
- const bip39 = require("@polkadot/util-crypto/mnemonic/bip39");
10
- const fingerprintjs = require("@fingerprintjs/fingerprintjs");
11
- const util = require("@prosopo/util");
12
- const string = require("@polkadot/util/string");
13
- const u8a = require("@polkadot/util/u8a");
14
- const Signer = require("@polkadot/extension-base/page/Signer");
15
- class ExtensionWeb2 extends Extension.Extension {
16
- constructor() {
17
- super(...arguments);
18
- this.getNetwork = (config) => {
19
- const network = config.networks[config.defaultNetwork];
20
- if (!network) {
21
- throw new common.ProsopoEnvError("DEVELOPER.NETWORK_NOT_FOUND", {
22
- context: { error: `No network found for environment ${config.defaultEnvironment}` }
23
- });
24
- }
25
- return network;
26
- };
27
- }
28
- async getAccount(config) {
29
- const network = this.getNetwork(config);
30
- const wsProvider = new ws.WsProvider(network.endpoint);
31
- const account = await this.createAccount(wsProvider);
32
- const extension = await this.createExtension(account);
33
- return {
34
- account,
35
- extension
36
- };
37
- }
38
- async createExtension(account) {
39
- const signer = new Signer(async () => {
40
- return;
41
- });
42
- signer.signRaw = async (payload) => {
43
- const signature = account.keypair.sign(payload.data);
44
- return {
45
- id: 1,
46
- signature: u8a.u8aToHex(signature)
47
- };
48
- };
49
- return {
50
- accounts: {
51
- get: async () => {
52
- return [account];
53
- },
54
- subscribe: () => {
55
- return () => {
56
- return;
57
- };
58
- }
59
- },
60
- name: "procaptcha-web2",
61
- version: util.version,
62
- signer
63
- };
64
- }
65
- async createAccount(wsProvider) {
66
- const params = {
67
- area: { width: 300, height: 300 },
68
- offsetParameter: 2001000001,
69
- multiplier: 15e3,
70
- fontSizeFactor: 1.5,
71
- maxShadowBlur: 50,
72
- numberOfRounds: 5,
73
- seed: 42
74
- };
75
- const browserEntropy = await this.getFingerprint();
76
- const canvasEntropy = util.picassoCanvas(params.numberOfRounds, params.seed, params);
77
- const entropy = common.hexHash([canvasEntropy, browserEntropy].join(""), 128).slice(2);
78
- const u8Entropy = string.stringToU8a(entropy);
79
- const mnemonic = bip39.entropyToMnemonic(u8Entropy);
80
- const api = await Api.ApiPromise.create({ provider: wsProvider, initWasm: false, noInitWarn: true });
81
- const type = "ed25519";
82
- const keyring$1 = new keyring.Keyring({ type, ss58Format: api.registry.chainSS58 });
83
- const keypair = keyring$1.addFromMnemonic(mnemonic);
84
- const address$1 = keypair.address.length === 42 ? keypair.address : address.encodeAddress(address.decodeAddress(keypair.address), api.registry.chainSS58);
85
- return {
86
- address: address$1,
87
- type,
88
- name: address$1,
89
- keypair
90
- };
91
- }
92
- async getFingerprint() {
93
- const fpPromise = fingerprintjs.load();
94
- const fp = await fpPromise;
95
- const result = await fp.get();
96
- const { screenFrame, ...componentsReduced } = result.components;
97
- return fingerprintjs.hashComponents(componentsReduced);
98
- }
99
- }
100
- exports.ExtensionWeb2 = ExtensionWeb2;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Extension = require("./Extension.cjs");
4
- const common = require("@prosopo/common");
5
- const extensionDapp = require("@polkadot/extension-dapp");
6
- class ExtensionWeb3 extends Extension.Extension {
7
- async getAccount(config) {
8
- const { dappName, userAccountAddress: address } = config;
9
- if (!address) {
10
- throw new common.ProsopoError("WIDGET.NO_ACCOUNTS_FOUND", { context: { error: "No account address provided" } });
11
- }
12
- const extensions = await extensionDapp.web3Enable(dappName);
13
- if (extensions.length === 0) {
14
- throw new common.ProsopoError("WIDGET.NO_EXTENSION_FOUND");
15
- }
16
- for (const extension of extensions) {
17
- const accounts = await extension.accounts.get();
18
- const account = accounts.find((account2) => account2.address === address);
19
- if (account) {
20
- return { account, extension };
21
- }
22
- }
23
- throw new common.ProsopoError("WIDGET.ACCOUNT_NOT_FOUND", {
24
- context: { error: `No account found matching ${address}` }
25
- });
26
- }
27
- }
28
- exports.ExtensionWeb3 = ExtensionWeb3;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Extension = require("./extension/Extension.cjs");
4
- const ExtensionWeb2 = require("./extension/ExtensionWeb2.cjs");
5
- const ExtensionWeb3 = require("./extension/ExtensionWeb3.cjs");
6
- exports.Extension = Extension.Extension;
7
- exports.ExtensionWeb2 = ExtensionWeb2.ExtensionWeb2;
8
- exports.ExtensionWeb3 = ExtensionWeb3.ExtensionWeb3;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const Containers = require("./Containers.cjs");
5
- const LoadingSpinner = require("./LoadingSpinner.cjs");
6
- const WidgetConstants = require("./WidgetConstants.cjs");
7
- const theme = require("./theme.cjs");
8
- const Logo = require("./Logo.cjs");
9
- const ProcaptchaPlaceholder = (props) => {
10
- const themeColor = props.darkMode === "light" ? "light" : "dark";
11
- const theme$1 = props.darkMode === "light" ? theme.lightTheme : theme.darkTheme;
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: WidgetConstants.WIDGET_PADDING,
14
- border: WidgetConstants.WIDGET_BORDER,
15
- backgroundColor: theme$1.palette.background.default,
16
- borderColor: theme$1.palette.grey[300],
17
- borderRadius: WidgetConstants.WIDGET_BORDER_RADIUS,
18
- display: "flex",
19
- alignItems: "center",
20
- flexWrap: "wrap",
21
- justifyContent: "space-between",
22
- minHeight: `${WidgetConstants.WIDGET_INNER_HEIGHT}px`,
23
- overflow: "hidden"
24
- }, children: [jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, children: jsxRuntime.jsx("div", { style: {
25
- alignItems: "center",
26
- flex: 1
27
- }, children: jsxRuntime.jsx("div", { style: {
28
- display: "flex",
29
- alignItems: "center",
30
- justifyContent: "center",
31
- flexDirection: "column",
32
- verticalAlign: "middle"
33
- }, children: jsxRuntime.jsx("div", { style: {
34
- display: "flex"
35
- }, children: jsxRuntime.jsx("div", { style: { display: "inline-flex" }, children: jsxRuntime.jsx(LoadingSpinner.LoadingSpinner, { themeColor }) }) }) }) }) }), jsxRuntime.jsx("div", { style: { display: "inline-flex", flexDirection: "column" }, children: jsxRuntime.jsx("a", { href: WidgetConstants.WIDGET_URL, target: "_blank", "aria-label": WidgetConstants.WIDGET_URL_TEXT, children: jsxRuntime.jsx("div", { style: { flex: 1 }, children: jsxRuntime.jsx(Logo, { themeColor }) }) }) })] })] }) }) }) }) });
36
- };
37
- exports.ProcaptchaPlaceholder = ProcaptchaPlaceholder;
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const react = require("@emotion/react");
5
- const theme = require("./theme.cjs");
6
- const react$1 = require("react");
7
- const checkboxBefore = react.css`{
8
- &:before {
9
- content: '""';
10
- position: absolute;
11
- height: 100%;
12
- width: 100%;
13
- }
14
- }`;
15
- const baseStyle = {
16
- width: "28px",
17
- height: "28px",
18
- top: "auto",
19
- left: "auto",
20
- opacity: "1",
21
- borderRadius: "12.5%",
22
- appearance: "none",
23
- cursor: "pointer",
24
- margin: "0",
25
- borderStyle: "solid",
26
- borderWidth: "1px"
27
- };
28
- const ID_LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
29
- const generateRandomId = () => {
30
- return Array.from({ length: 8 }, () => ID_LETTERS[Math.floor(Math.random() * ID_LETTERS.length)]).join("");
31
- };
32
- const Checkbox = ({ themeColor, onChange, checked, labelText }) => {
33
- const theme$1 = react$1.useMemo(() => themeColor === "light" ? theme.lightTheme : theme.darkTheme, [themeColor]);
34
- const checkboxStyleBase = {
35
- ...baseStyle,
36
- border: `1px solid ${theme$1.palette.background.contrastText}`
37
- };
38
- const [hover, setHover] = react$1.useState(false);
39
- const checkboxStyle = react$1.useMemo(() => {
40
- return {
41
- ...checkboxStyleBase,
42
- borderColor: hover ? theme$1.palette.background.contrastText : theme$1.palette.grey[400],
43
- appearance: checked ? "auto" : "none",
44
- flex: 1,
45
- margin: "15px"
46
- };
47
- }, [hover, theme$1, checked]);
48
- const id = generateRandomId();
49
- return jsxRuntime.jsxs("span", { style: { display: "inline-flex" }, children: [jsxRuntime.jsx("input", { name: id, id, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), css: checkboxBefore, type: "checkbox", "aria-live": "assertive", "aria-haspopup": "true", onChange, checked, style: checkboxStyle }), jsxRuntime.jsx("label", { css: {
50
- color: theme$1.palette.background.contrastText,
51
- position: "relative",
52
- display: "flex",
53
- cursor: "pointer",
54
- userSelect: "none",
55
- top: "18px"
56
- }, htmlFor: id, children: labelText })] });
57
- };
58
- exports.Checkbox = Checkbox;
59
- exports.default = Checkbox;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const WidgetConstants = require("./WidgetConstants.cjs");
4
- const styled = require("@emotion/styled");
5
- const ContainerDiv = styled.div`
6
- container-type: inline-size;
7
- `;
8
- const WidthBasedStylesDiv = styled.div`
9
- max-width: 100%;
10
- max-height: 100%;
11
- overflow: hidden;
12
- height: ${WidgetConstants.WIDGET_OUTER_HEIGHT}px;
13
- @container (max-width: 243px) {
14
- #logo-without-text {
15
- display: none;
16
- }
17
-
18
- #logo-with-text {
19
- display: none;
20
- }
21
- }
22
- @container (min-width: 244px) and (max-width: 339px) {
23
- #logo-without-text {
24
- display: inherit;
25
- }
26
-
27
- #logo-with-text {
28
- display: none;
29
- }
30
- }
31
- @container (min-width: 340px) {
32
- #logo-without-text {
33
- display: none;
34
- }
35
-
36
- #logo-with-text {
37
- display: inherit;
38
- }
39
- }
40
- `;
41
- exports.ContainerDiv = ContainerDiv;
42
- exports.WidthBasedStylesDiv = WidthBasedStylesDiv;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const theme = require("./theme.cjs");
5
- const react = require("react");
6
- const styled = require("@emotion/styled");
7
- const LoadingSpinner = ({ themeColor }) => {
8
- const theme$1 = react.useMemo(() => themeColor === "light" ? theme.lightTheme : theme.darkTheme, [themeColor]);
9
- const StyledDiv = styled.div`
10
- margin-top: 0;
11
- margin-left: 15px;
12
- margin-right: 15px;
13
- width: 2em;
14
- height: 2em;
15
- border: 4px solid ${theme$1.palette.background.contrastText};
16
- border-bottom-color: transparent;
17
- border-radius: 50%;
18
- display: inherit;
19
- box-sizing: border-box;
20
- animation: rotation 1s linear infinite;
21
-
22
- @keyframes rotation {
23
- 0% {
24
- transform: rotate(0deg);
25
- }
26
- 100% {
27
- transform: rotate(360deg);
28
- }
29
- }
30
- `;
31
- return jsxRuntime.jsx(StyledDiv, {});
32
- };
33
- exports.LoadingSpinner = LoadingSpinner;
34
- exports.default = LoadingSpinner;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- const jsxRuntime = require("@emotion/react/jsx-runtime");
3
- const LogoWithText = require("./LogoWithText.cjs");
4
- const LogoWithoutText = require("./LogoWithoutText.cjs");
5
- const styled = require("@emotion/styled");
6
- const LogoContainer = styled.div`
7
- padding: 8px;
8
- flex: 1 1 0;
9
- `;
10
- const LogoInnerContainer = styled.div`
11
- padding: 8px;
12
- `;
13
- const Logo = ({ themeColor }) => {
14
- return jsxRuntime.jsx(LogoContainer, { children: jsxRuntime.jsxs(LogoInnerContainer, { children: [jsxRuntime.jsx(LogoWithoutText.LogoWithoutText, { themeColor }), jsxRuntime.jsx(LogoWithText.LogoWithText, { themeColor })] }) });
15
- };
16
- module.exports = Logo;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const react = require("react");
5
- const LogoWithText = ({ themeColor }) => {
6
- const fill = react.useMemo(() => themeColor === "light" ? "#1d1d1b" : "#fff", [themeColor]);
7
- return jsxRuntime.jsxs("svg", { className: "logo", id: "logo-with-text", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 2062.63 468.67", height: "35px", width: "140px", style: { fill }, children: [jsxRuntime.jsx("title", { children: "Prosopo Logo With Text" }), jsxRuntime.jsx("path", { 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)" }), jsxRuntime.jsx("path", { 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)" }), jsxRuntime.jsx("path", { 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)" }), jsxRuntime.jsx("path", { 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)" }), jsxRuntime.jsx("path", { 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)" }), jsxRuntime.jsx("path", { 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)" }), jsxRuntime.jsx("path", { 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)" }), jsxRuntime.jsx("path", { 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)" }), jsxRuntime.jsx("path", { 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)" }), jsxRuntime.jsx("path", { 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)" }), jsxRuntime.jsx("path", { 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)" })] });
8
- };
9
- exports.LogoWithText = LogoWithText;
10
- exports.default = LogoWithText;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const react = require("react");
5
- const LogoWithoutText = ({ themeColor }) => {
6
- const fill = react.useMemo(() => themeColor === "light" ? "#1d1d1b" : "#fff", [themeColor]);
7
- return jsxRuntime.jsxs("svg", { className: "logo", id: "logo-without-text", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 260 348", height: "35px", style: { fill }, children: [jsxRuntime.jsx("title", { children: "Prosopo Logo Without Text" }), jsxRuntime.jsx("path", { 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" }), jsxRuntime.jsx("path", { 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" }), jsxRuntime.jsx("path", { 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" }), jsxRuntime.jsx("path", { 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" })] });
8
- };
9
- exports.LogoWithoutText = LogoWithoutText;
10
- exports.default = LogoWithoutText;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const WIDGET_URL = "https://prosopo.io/?ref=accounts.prosopo.io&amp;utm_campaign=widget&amp;utm_medium=checkbox#features";
4
- const WIDGET_URL_TEXT = "Visit prosopo.io to learn more about the service and its accessibility options.";
5
- const WIDGET_INNER_HEIGHT = 74;
6
- const WIDGET_OUTER_HEIGHT = 80;
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;
13
- exports.WIDGET_DIMENSIONS = WIDGET_DIMENSIONS;
14
- exports.WIDGET_INNER_HEIGHT = WIDGET_INNER_HEIGHT;
15
- exports.WIDGET_OUTER_HEIGHT = WIDGET_OUTER_HEIGHT;
16
- exports.WIDGET_PADDING = WIDGET_PADDING;
17
- exports.WIDGET_URL = WIDGET_URL;
18
- exports.WIDGET_URL_TEXT = WIDGET_URL_TEXT;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const CaptchaPlaceholder = require("./CaptchaPlaceholder.cjs");
4
- const LoadingSpinner = require("./LoadingSpinner.cjs");
5
- const theme = require("./theme.cjs");
6
- const Checkbox = require("./Checkbox.cjs");
7
- const Logo = require("./Logo.cjs");
8
- const Containers = require("./Containers.cjs");
9
- const WidgetConstants = require("./WidgetConstants.cjs");
10
- exports.ProcaptchaPlaceholder = CaptchaPlaceholder.ProcaptchaPlaceholder;
11
- exports.LoadingSpinner = LoadingSpinner.LoadingSpinner;
12
- exports.darkTheme = theme.darkTheme;
13
- exports.lightTheme = theme.lightTheme;
14
- exports.Checkbox = Checkbox.Checkbox;
15
- exports.Logo = Logo;
16
- exports.ContainerDiv = Containers.ContainerDiv;
17
- exports.WidthBasedStylesDiv = Containers.WidthBasedStylesDiv;
18
- exports.WIDGET_BORDER = WidgetConstants.WIDGET_BORDER;
19
- exports.WIDGET_BORDER_RADIUS = WidgetConstants.WIDGET_BORDER_RADIUS;
20
- exports.WIDGET_DIMENSIONS = WidgetConstants.WIDGET_DIMENSIONS;
21
- exports.WIDGET_INNER_HEIGHT = WidgetConstants.WIDGET_INNER_HEIGHT;
22
- exports.WIDGET_OUTER_HEIGHT = WidgetConstants.WIDGET_OUTER_HEIGHT;
23
- exports.WIDGET_PADDING = WidgetConstants.WIDGET_PADDING;
24
- exports.WIDGET_URL = WidgetConstants.WIDGET_URL;
25
- exports.WIDGET_URL_TEXT = WidgetConstants.WIDGET_URL_TEXT;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const grey = {
4
- 0: "#fff",
5
- 100: "#f5f5f5",
6
- 200: "#eeeeee",
7
- 300: "#e0e0e0",
8
- 400: "#bdbdbd",
9
- 500: "#9e9e9e",
10
- 600: "#757575",
11
- 700: "#616161",
12
- 800: "#424242",
13
- 900: "#212121"
14
- };
15
- const lightTheme = {
16
- palette: {
17
- mode: "light",
18
- primary: {
19
- main: "#487DFA",
20
- contrastText: "#fff"
21
- },
22
- background: {
23
- default: "#fff",
24
- contrastText: "#000"
25
- },
26
- grey
27
- }
28
- };
29
- const darkTheme = {
30
- palette: {
31
- mode: "dark",
32
- primary: {
33
- main: "#487DFA",
34
- contrastText: "#fff"
35
- },
36
- background: {
37
- default: "#303030",
38
- contrastText: "#fff"
39
- },
40
- grey
41
- }
42
- };
43
- exports.darkTheme = darkTheme;
44
- exports.lightTheme = lightTheme;