@prosopo/procaptcha-bundle 2.6.11 → 3.0.5

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/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +1 -1
  2. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js +3 -2
  3. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -1
  4. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
  5. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +4 -0
  6. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +1 -1
  7. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts +1 -1
  8. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +1 -1
  9. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  10. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +1 -1
  11. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +1 -1
  12. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts +1 -1
  13. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts.map +1 -1
  14. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js +2 -2
  15. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js.map +1 -1
  16. package/CHANGELOG.md +142 -0
  17. package/dist/bundle/ProcaptchaWidget-BpzncYOb.js +612 -0
  18. package/dist/bundle/ProcaptchaWidget-D961oZ27.js +148 -0
  19. package/dist/bundle/bnChunk-DRlDxTFg.js +1137 -0
  20. package/dist/bundle/{browser-ponyfill-Bctlk3uB.js → browser-ponyfill-CvzSbL_o.js} +31 -30
  21. package/dist/bundle/builder-CQlqPNRd.js +37 -0
  22. package/dist/bundle/captchaComponentProvider-Dw6ydLe3.js +802 -0
  23. package/dist/bundle/{captchaRenderer-BAMErqQN.js → captchaRenderer-CY8KuZK-.js} +22 -22
  24. package/dist/bundle/commonChunk-24zMb_mF.js +189 -0
  25. package/dist/bundle/emotion-element-5486c51c.browser.esm-PRDDgd_k.js +918 -0
  26. package/dist/bundle/{fp.esm-DYWeNGcH.js → fp.esm-BADUiinQ.js} +548 -648
  27. package/dist/bundle/index-BRg_gWPo.js +1328 -0
  28. package/dist/bundle/{index-ByKGlSkE.js → index-BzOMq-ud.js} +2 -2
  29. package/dist/bundle/{index-1qH2dz7u.js → index-DqwVRCwA.js} +166 -199
  30. package/dist/bundle/index.d.ts.map +1 -1
  31. package/dist/bundle/locales/ar/translation.json +4 -3
  32. package/dist/bundle/locales/az/translation.json +4 -3
  33. package/dist/bundle/locales/cs/translation.json +4 -3
  34. package/dist/bundle/locales/de/translation.json +4 -3
  35. package/dist/bundle/locales/el/translation.json +4 -3
  36. package/dist/bundle/locales/en/translation.json +4 -3
  37. package/dist/bundle/locales/es/translation.json +4 -3
  38. package/dist/bundle/locales/fi/translation.json +4 -3
  39. package/dist/bundle/locales/fr/translation.json +4 -3
  40. package/dist/bundle/locales/hi/translation.json +4 -3
  41. package/dist/bundle/locales/hu/translation.json +4 -3
  42. package/dist/bundle/locales/id/translation.json +4 -3
  43. package/dist/bundle/locales/it/translation.json +4 -3
  44. package/dist/bundle/locales/ja/translation.json +4 -3
  45. package/dist/bundle/locales/jv/translation.json +4 -3
  46. package/dist/bundle/locales/ko/translation.json +4 -3
  47. package/dist/bundle/locales/ml/translation.json +4 -3
  48. package/dist/bundle/locales/ms/translation.json +4 -3
  49. package/dist/bundle/locales/nl/translation.json +4 -3
  50. package/dist/bundle/locales/no/translation.json +4 -3
  51. package/dist/bundle/locales/pl/translation.json +4 -3
  52. package/dist/bundle/locales/pt/translation.json +4 -3
  53. package/dist/bundle/locales/{pt-br → pt-BR}/translation.json +4 -3
  54. package/dist/bundle/locales/ro/translation.json +4 -3
  55. package/dist/bundle/locales/ru/translation.json +4 -3
  56. package/dist/bundle/locales/sr/translation.json +4 -3
  57. package/dist/bundle/locales/sv/translation.json +4 -3
  58. package/dist/bundle/locales/th/translation.json +4 -3
  59. package/dist/bundle/locales/tr/translation.json +4 -3
  60. package/dist/bundle/locales/uk/translation.json +4 -3
  61. package/dist/bundle/locales/vi/translation.json +4 -3
  62. package/dist/bundle/locales/{zh-cn → zh-CN}/translation.json +4 -3
  63. package/dist/bundle/nobleChunk-Xl5XLrx3.js +3635 -0
  64. package/dist/bundle/procaptcha.bundle.js +6 -5
  65. package/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
  66. package/dist/bundle/util/captcha/captchaComponentsList.d.ts +1 -1
  67. package/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +1 -1
  68. package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  69. package/dist/bundle/util/configCreator.d.ts +1 -1
  70. package/dist/bundle/util/configCreator.d.ts.map +1 -1
  71. package/dist/bundle/utilChunk-sqstc6C5.js +317 -0
  72. package/dist/bundle/utilCryptoChunk-CIPUtfoO.js +1256 -0
  73. package/dist/bundle/web2Chunk-7Vd8yt2r.js +3711 -0
  74. package/dist/bundle/{hash-CrwduMDb.js → web3Chunk-DrUvbVNW.js} +257 -695
  75. package/dist/bundle/{translations-DEL070wJ.js → zodChunk-wTu9ZHzV.js} +46 -82
  76. package/dist/cjs/index.cjs +8 -2
  77. package/dist/cjs/util/captcha/captchaComponentProvider.cjs +4 -0
  78. package/dist/cjs/util/captcha/captchaRenderer.cjs +2 -1
  79. package/dist/cjs/util/configCreator.cjs +2 -2
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +3 -2
  82. package/dist/index.js.map +1 -1
  83. package/dist/util/captcha/captchaComponentProvider.d.ts +1 -1
  84. package/dist/util/captcha/captchaComponentProvider.d.ts.map +1 -1
  85. package/dist/util/captcha/captchaComponentProvider.js +4 -0
  86. package/dist/util/captcha/captchaComponentProvider.js.map +1 -1
  87. package/dist/util/captcha/captchaComponentsList.d.ts +1 -1
  88. package/dist/util/captcha/captchaComponentsList.d.ts.map +1 -1
  89. package/dist/util/captcha/captchaRenderer.d.ts.map +1 -1
  90. package/dist/util/captcha/captchaRenderer.js +1 -1
  91. package/dist/util/captcha/captchaRenderer.js.map +1 -1
  92. package/dist/util/configCreator.d.ts +1 -1
  93. package/dist/util/configCreator.d.ts.map +1 -1
  94. package/dist/util/configCreator.js +2 -2
  95. package/dist/util/configCreator.js.map +1 -1
  96. package/package.json +21 -14
  97. package/stats.html +1 -1
  98. package/vite.config.ts +47 -4
  99. package/vite.serve.config.ts +2 -0
  100. package/vite.test.config.ts +1 -1
  101. package/webpack.config.cjs +5 -0
  102. package/dist/bundle/ProcaptchaWidget-DPyDGPiI.js +0 -156
  103. package/dist/bundle/ProcaptchaWidget-DoqUlwHS.js +0 -636
  104. package/dist/bundle/_commonjsHelpers-DaMA6jEr.js +0 -8
  105. package/dist/bundle/asU8a-BixKX-w0.js +0 -9
  106. package/dist/bundle/bip39-D7YSihxf.js +0 -260
  107. package/dist/bundle/captchaComponentProvider-BL18T1UE.js +0 -1242
  108. package/dist/bundle/emotion-element-5486c51c.browser.esm-Bjt1gs1F.js +0 -1807
  109. package/dist/bundle/i18nFrontend-DCv3P9jv.js +0 -2273
  110. package/dist/bundle/index-BeN3et18.js +0 -4844
  111. package/dist/bundle/index-BjRdPnnE.js +0 -1198
  112. package/dist/bundle/index-CBquknc2.js +0 -81
  113. package/dist/bundle/index-QVME9Prx.js +0 -32
  114. package/dist/bundle/sha256-CGE_4eEY.js +0 -171
  115. package/dist/bundle/spread-DEmVz7RJ.js +0 -15
  116. package/dist/bundle/toU8a-CPMbkkSw.js +0 -109
  117. package/dist/bundle/useTranslation-BJsfZyOx.js +0 -158
@@ -0,0 +1,148 @@
1
+ import { g as k, p as M, b as D, P as G, E as F, j as S, C as W } from "./captchaComponentProvider-Dw6ydLe3.js";
2
+ import { s as K, i as j, A as r, f as V, P as Y, u as X, r as l, l as q, M as H } from "./web2Chunk-7Vd8yt2r.js";
3
+ import { b as L, u as z } from "./builder-CQlqPNRd.js";
4
+ import { w as B } from "./utilChunk-sqstc6C5.js";
5
+ import { a as w } from "./commonChunk-24zMb_mF.js";
6
+ import { l as J, d as Q } from "./index-DqwVRCwA.js";
7
+ const Z = (d, o, E, t, e) => {
8
+ const g = k(t), m = () => ({
9
+ showModal: !1,
10
+ loading: !1,
11
+ index: 0,
12
+ challenge: void 0,
13
+ solutions: void 0,
14
+ isHuman: !1,
15
+ captchaApi: void 0,
16
+ account: void 0
17
+ }), v = () => {
18
+ window.clearTimeout(Number(o.timeout)), a({ timeout: void 0 });
19
+ }, s = () => {
20
+ a({
21
+ isHuman: !1,
22
+ loading: !1
23
+ }), g.onFailed(), i(e == null ? void 0 : e.restart);
24
+ }, T = () => {
25
+ window.clearTimeout(Number(o.successfullChallengeTimeout)), a({ successfullChallengeTimeout: void 0 });
26
+ }, p = () => {
27
+ const n = {
28
+ userAccountAddress: d.userAccountAddress || "",
29
+ ...d
30
+ };
31
+ return o.account && (n.userAccountAddress = o.account.account.address), Y.parse(n);
32
+ }, f = () => {
33
+ if (!o.account)
34
+ throw new w("GENERAL.ACCOUNT_NOT_FOUND", {
35
+ context: { error: "Account not loaded" }
36
+ });
37
+ return { account: o.account };
38
+ }, h = () => {
39
+ if (!o.dappAccount)
40
+ throw new w("GENERAL.SITE_KEY_MISSING");
41
+ return o.dappAccount;
42
+ }, a = L(o, E), i = (n) => {
43
+ v(), T(), a(m()), g.onReset(), n && n();
44
+ }, u = () => {
45
+ const n = p().captchas.pow.solutionTimeout, R = setTimeout(() => {
46
+ a({ isHuman: !1 }), g.onExpired(), i(e == null ? void 0 : e.restart);
47
+ }, n);
48
+ a({ successfullChallengeTimeout: R });
49
+ }, A = async () => {
50
+ await M(async () => {
51
+ var O;
52
+ if (o.loading || o.isHuman)
53
+ return;
54
+ i(), a({
55
+ loading: !0
56
+ }), a({ attemptCount: o.attemptCount + 1 });
57
+ const n = p(), C = await (async () => e ? e.userAccount : new (await F(n.web2))().getAccount(n))(), N = C.account.address;
58
+ if (a({
59
+ account: { account: { address: N } }
60
+ }), a({ dappAccount: n.account.address }), await K(100), !n.web2 && !n.userAccountAddress)
61
+ throw new w("GENERAL.ACCOUNT_NOT_FOUND", {
62
+ context: {
63
+ error: "Account address has not been set for web3 mode"
64
+ }
65
+ });
66
+ let P;
67
+ e != null && e.provider ? P = e.provider : P = await D(p());
68
+ const _ = P.provider.url, y = new G(_, h()), c = await y.getPowCaptchaChallenge(N, h(), e == null ? void 0 : e.sessionId);
69
+ if (c.error)
70
+ a({
71
+ loading: !1,
72
+ error: {
73
+ message: c.error.message,
74
+ key: c.error.key || "API.UNKNOWN_ERROR"
75
+ }
76
+ });
77
+ else {
78
+ const b = j(c.challenge, c.difficulty), x = (O = C.extension) == null ? void 0 : O.signer;
79
+ if (!x || !x.signRaw)
80
+ throw new w("GENERAL.CANT_FIND_KEYRINGPAIR", {
81
+ context: {
82
+ error: "Signer is not defined, cannot sign message to prove account ownership"
83
+ }
84
+ });
85
+ const U = await x.signRaw({
86
+ address: N,
87
+ data: B(c[r.timestamp].toString()),
88
+ type: "bytes"
89
+ });
90
+ (await y.submitPowCaptchaSolution(c, f().account.account.address, h(), b, U.signature.toString(), n.captchas.pow.verifiedTimeout))[r.verified] ? (a({
91
+ isHuman: !0,
92
+ loading: !1
93
+ }), g.onHuman(V({
94
+ [r.providerUrl]: _,
95
+ [r.user]: f().account.account.address,
96
+ [r.dapp]: h(),
97
+ [r.challenge]: c.challenge,
98
+ [r.nonce]: b,
99
+ [r.timestamp]: c.timestamp,
100
+ [r.signature]: {
101
+ [r.provider]: c.signature.provider,
102
+ [r.user]: {
103
+ [r.timestamp]: U.signature.toString()
104
+ }
105
+ }
106
+ })), u()) : s();
107
+ }
108
+ }, A, () => {
109
+ i();
110
+ }, o.attemptCount, 3);
111
+ };
112
+ return {
113
+ start: A,
114
+ resetState: i
115
+ };
116
+ }, I = "procaptcha:execute", ce = (d) => {
117
+ var i;
118
+ const { t: o, ready: E } = X(), t = d.config, e = d.i18n, g = t.theme === "light" ? J : Q, m = d.frictionlessState, v = d.callbacks || {}, [s, T] = z(l.useState, l.useRef), [p, f] = l.useState(!1), h = L(s, T), a = l.useRef(Z(t, s, h, v, m));
119
+ return l.useEffect(() => {
120
+ t.language && (e ? e.language !== t.language && e.changeLanguage(t.language).then((u) => u) : q().then((u) => {
121
+ u.language !== t.language && u.changeLanguage(t.language).then((A) => A);
122
+ }));
123
+ }, [e, t.language]), l.useEffect(() => {
124
+ s.error && (f(!1), s.error.key === "CAPTCHA.NO_SESSION_FOUND" && m && setTimeout(() => {
125
+ m.restart();
126
+ }, 3e3));
127
+ }, [s.error, m]), l.useEffect(() => {
128
+ if (t.mode === H.invisible) {
129
+ const u = (A) => {
130
+ try {
131
+ a.current.start();
132
+ } catch (n) {
133
+ console.error("Error starting PoW verification:", n);
134
+ }
135
+ };
136
+ return document.addEventListener(I, u), () => {
137
+ document.removeEventListener(I, u);
138
+ };
139
+ }
140
+ return () => {
141
+ };
142
+ }, [t.mode]), t.mode === H.invisible ? null : S(W, { checked: s.isHuman, onChange: async () => {
143
+ p || (f(!0), await a.current.start(), f(!1));
144
+ }, theme: g, labelText: E ? o("WIDGET.I_AM_HUMAN") : "", error: (i = s.error) == null ? void 0 : i.message, "aria-label": "human checkbox", loading: p });
145
+ };
146
+ export {
147
+ ce as default
148
+ };