@prosopo/client-bundle-example 2.7.0 → 2.8.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.
- package/CHANGELOG.md +10 -0
- package/dist/assets/{ProcaptchaWidget-3gKvjeiH.js → ProcaptchaWidget-DrBDhP6X.js} +7 -7
- package/dist/assets/{ProcaptchaWidget-D6-M7iAv.js → ProcaptchaWidget-rAM-9Rap.js} +4 -4
- package/dist/assets/{asU8a-DCECA0Qe.js → asU8a-CJdNkNEq.js} +1 -1
- package/dist/assets/{bip39-BQoZog_M.js → bip39-Du2cANEV.js} +2 -2
- package/dist/assets/captcha-BhkVCEXM.css +1 -0
- package/dist/assets/{captchaComponentProvider-BW2eXmc3.js → captchaComponentProvider-DmV1WTrT.js} +4 -4
- package/dist/assets/{captchaRenderer-B_MgGzr9.js → captchaRenderer-RIsSZXCC.js} +2 -2
- package/dist/assets/{emotion-element-5486c51c.browser.esm-CCAJ8JId.js → emotion-element-5486c51c.browser.esm-C3u8NMUC.js} +127 -125
- package/dist/assets/frictionless-explicit-Dq_sNGRK.js +1 -0
- package/dist/assets/frictionless-implicit-Dq_sNGRK.js +1 -0
- package/dist/assets/{hash-BR0YLxPF.js → hash-_rWungeW.js} +1 -1
- package/dist/assets/image-explicit-DQvfVB7-.js +4 -0
- package/dist/assets/image-implicit-Bwa9QJO5.js +1 -0
- package/dist/assets/{index-WqEmiYQ_.js → index-BVr9fC_3.js} +4 -4
- package/dist/assets/{index-BYUYvvuq.js → index-Cu5oL_7b.js} +4 -4
- package/dist/assets/index-Dpt_5E72.js +1 -0
- package/dist/assets/{index-BCjHZ8o6.js → index-DxIFpl6U.js} +1 -1
- package/dist/assets/{index-2or4-1WF.js → index-Wgw2GQWq.js} +2 -2
- package/dist/assets/invisible-frictionless-explicit-DugBtRe4.js +4 -0
- package/dist/assets/invisible-frictionless-implicit-DYYos8W9.js +1 -0
- package/dist/assets/invisible-image-explicit-C5Z4gSb1.js +4 -0
- package/dist/assets/invisible-image-implicit-DfNFNlFj.js +1 -0
- package/dist/assets/invisible-pow-explicit-DjqGWFUb.js +4 -0
- package/dist/assets/invisible-pow-implicit-BRXL14FH.js +4 -0
- package/dist/assets/pow-explicit-BexxbnHM.js +4 -0
- package/dist/assets/pow-implicit-Dpt_5E72.js +1 -0
- package/dist/assets/procaptcha.bundle.js +1 -1
- package/dist/assets/{useTranslation-BPbGzrhj.js → useTranslation-CJplXtqb.js} +1 -1
- package/dist/frictionless-explicit.html +881 -0
- package/dist/frictionless-implicit.html +874 -0
- package/dist/image-explicit.html +877 -0
- package/dist/index.html +575 -74
- package/dist/invisible-frictionless-explicit.html +626 -283
- package/dist/invisible-frictionless-implicit.html +631 -173
- package/dist/invisible-image-explicit.html +627 -284
- package/dist/invisible-image-implicit.html +631 -173
- package/dist/invisible-pow-explicit.html +627 -284
- package/dist/invisible-pow-implicit.html +629 -177
- package/dist/plugins/explanation-injector.ts +250 -0
- package/dist/plugins/form-filler-injector.ts +233 -0
- package/dist/plugins/navigation-injector.ts +237 -89
- package/dist/plugins/status-log-injector.ts +199 -0
- package/dist/pow-explicit.html +877 -0
- package/dist/pow-implicit.html +881 -0
- package/package.json +1 -1
- package/vite.config.ts +32 -3
- package/dist/assets/frictionless-ZgzyuneX.js +0 -1
- package/dist/assets/index-BWsu-rGU.js +0 -1
- package/dist/assets/invisible-frictionless-explicit-DgCaJtPg.js +0 -1
- package/dist/assets/invisible-image-explicit-DgCaJtPg.js +0 -1
- package/dist/assets/invisible-pow-explicit-DgCaJtPg.js +0 -1
- package/dist/assets/pow-BW3QYcgP.js +0 -1
- package/dist/frictionless.html +0 -343
- package/dist/pow.html +0 -323
- /package/dist/assets/{modulepreload-polyfill-B5Qt9EMX.js → captcha-ByKnSsbG.js} +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// Copyright 2021-2025 Prosopo (UK) Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
// Vite plugin to inject CAPTCHA status log into HTML files
|
|
15
|
+
import type { IndexHtmlTransformContext, Plugin } from "vite";
|
|
16
|
+
|
|
17
|
+
export default function statusLogInjector(): Plugin {
|
|
18
|
+
// CSS for status log styling
|
|
19
|
+
const statusLogCss = `
|
|
20
|
+
<style>
|
|
21
|
+
.captcha-status {
|
|
22
|
+
margin-top: 20px;
|
|
23
|
+
padding: 15px;
|
|
24
|
+
background-color: #f0f8ff;
|
|
25
|
+
border: 2px solid #2196F3;
|
|
26
|
+
border-radius: 5px;
|
|
27
|
+
font-family: monospace;
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
}
|
|
30
|
+
.status-item {
|
|
31
|
+
margin: 5px 0;
|
|
32
|
+
padding: 5px;
|
|
33
|
+
}
|
|
34
|
+
.status-success {
|
|
35
|
+
color: #4CAF50;
|
|
36
|
+
font-weight: bold;
|
|
37
|
+
}
|
|
38
|
+
.status-error {
|
|
39
|
+
color: #F44336;
|
|
40
|
+
font-weight: bold;
|
|
41
|
+
}
|
|
42
|
+
.status-info {
|
|
43
|
+
color: #2196F3;
|
|
44
|
+
}
|
|
45
|
+
.status-warning {
|
|
46
|
+
color: #FF9800;
|
|
47
|
+
}
|
|
48
|
+
.status-title {
|
|
49
|
+
font-weight: bold;
|
|
50
|
+
margin-bottom: 10px;
|
|
51
|
+
border-bottom: 1px solid #2196F3;
|
|
52
|
+
padding-bottom: 5px;
|
|
53
|
+
}
|
|
54
|
+
.console-output {
|
|
55
|
+
margin-top: 20px;
|
|
56
|
+
padding: 10px;
|
|
57
|
+
background-color: #f5f5f5;
|
|
58
|
+
border: 1px solid #ddd;
|
|
59
|
+
border-radius: 4px;
|
|
60
|
+
font-family: monospace;
|
|
61
|
+
white-space: pre-wrap;
|
|
62
|
+
max-height: 200px;
|
|
63
|
+
overflow-y: auto;
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
// JavaScript for status log functionality
|
|
69
|
+
const statusLogJs = `
|
|
70
|
+
<script type="module">
|
|
71
|
+
// Function to update CAPTCHA status display
|
|
72
|
+
function updateCaptchaStatus(message, type = 'info') {
|
|
73
|
+
const statusContainer = document.getElementById('captcha-status');
|
|
74
|
+
if (!statusContainer) return;
|
|
75
|
+
|
|
76
|
+
const timestamp = new Date().toLocaleTimeString();
|
|
77
|
+
const statusItem = document.createElement('div');
|
|
78
|
+
statusItem.className = \`status-item status-\${type}\`;
|
|
79
|
+
statusItem.innerHTML = \`[\${timestamp}] \${message}\`;
|
|
80
|
+
statusContainer.appendChild(statusItem);
|
|
81
|
+
|
|
82
|
+
// Also log to console
|
|
83
|
+
console.log(\`CAPTCHA Status: \${message}\`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Make updateCaptchaStatus available globally
|
|
87
|
+
window.updateCaptchaStatus = updateCaptchaStatus;
|
|
88
|
+
|
|
89
|
+
// Override the original callbacks with enhanced versions that use status logging
|
|
90
|
+
const originalOnCaptchaFailed = window.onCaptchaFailed;
|
|
91
|
+
window.onCaptchaFailed = function() {
|
|
92
|
+
updateCaptchaStatus('Challenge failed - CAPTCHA verification could not be completed', 'error');
|
|
93
|
+
if (originalOnCaptchaFailed) originalOnCaptchaFailed();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const originalOnCaptchaVerified = window.onCaptchaVerified;
|
|
97
|
+
window.onCaptchaVerified = function(output) {
|
|
98
|
+
updateCaptchaStatus('Challenge passed successfully!', 'success');
|
|
99
|
+
updateCaptchaStatus(\`Token generated: \${output.substring(0, 15)}...\`, 'success');
|
|
100
|
+
if (originalOnCaptchaVerified) originalOnCaptchaVerified(output);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const originalOnActionHandler = window.onActionHandler;
|
|
104
|
+
window.onActionHandler = function() {
|
|
105
|
+
const procaptchaElements = document.getElementsByName('procaptcha-response');
|
|
106
|
+
|
|
107
|
+
if (!procaptchaElements.length) {
|
|
108
|
+
updateCaptchaStatus('Error: No CAPTCHA response token found', 'error');
|
|
109
|
+
alert("Must complete captcha");
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
updateCaptchaStatus('Form submission initiated with valid CAPTCHA token', 'info');
|
|
114
|
+
if (originalOnActionHandler) originalOnActionHandler();
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
118
|
+
updateCaptchaStatus('Page loaded - Initializing CAPTCHA system', 'info');
|
|
119
|
+
|
|
120
|
+
// Monitor DOM for CAPTCHA initialization
|
|
121
|
+
const observer = new MutationObserver((mutations) => {
|
|
122
|
+
mutations.forEach((mutation) => {
|
|
123
|
+
if (mutation.addedNodes.length) {
|
|
124
|
+
for (let i = 0; i < mutation.addedNodes.length; i++) {
|
|
125
|
+
const node = mutation.addedNodes[i];
|
|
126
|
+
if (node.classList && (node.classList.contains('procaptcha') ||
|
|
127
|
+
node.querySelector && node.querySelector('.procaptcha'))) {
|
|
128
|
+
updateCaptchaStatus('CAPTCHA DOM elements initialized', 'info');
|
|
129
|
+
observer.disconnect();
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// Create a method to show CAPTCHA execution events
|
|
141
|
+
document.addEventListener('procaptcha:execute', function(e) {
|
|
142
|
+
// Determine captcha type from the page URL
|
|
143
|
+
const url = window.location.pathname;
|
|
144
|
+
const isFrictionless = url.includes('frictionless');
|
|
145
|
+
const isImage = url.includes('image');
|
|
146
|
+
const isPow = url.includes('pow');
|
|
147
|
+
|
|
148
|
+
let captchaType = 'unknown';
|
|
149
|
+
if (isFrictionless) captchaType = 'frictionless';
|
|
150
|
+
else if (isImage) captchaType = 'image';
|
|
151
|
+
else if (isPow) captchaType = 'pow';
|
|
152
|
+
|
|
153
|
+
updateCaptchaStatus(\`CAPTCHA execution started: type=\${captchaType}\`, 'info');
|
|
154
|
+
updateCaptchaStatus(\`Container: \${e.detail.containerId}, timestamp: \${new Date(e.detail.timestamp).toLocaleTimeString()}\`, 'info');
|
|
155
|
+
});
|
|
156
|
+
</script>
|
|
157
|
+
`;
|
|
158
|
+
|
|
159
|
+
// HTML for status log container
|
|
160
|
+
const statusLogHtml = `
|
|
161
|
+
<!-- CAPTCHA Status Display -->
|
|
162
|
+
<div id="captcha-status" class="captcha-status">
|
|
163
|
+
<div class="status-title">CAPTCHA Status Log</div>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<!-- Console output display area -->
|
|
167
|
+
<div id="console-output" class="console-output" style="display: none;"></div>
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
name: "status-log-injector",
|
|
172
|
+
transformIndexHtml: {
|
|
173
|
+
enforce: "post", // Run after other HTML transforms
|
|
174
|
+
transform(html: string, ctx: IndexHtmlTransformContext): string {
|
|
175
|
+
// Skip if no HTML body is found
|
|
176
|
+
if (!html.includes("<body") || !html.includes("</body>")) {
|
|
177
|
+
return html;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Skip if status log already exists
|
|
181
|
+
if (html.includes('id="captcha-status"')) {
|
|
182
|
+
return html;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Add CSS to head
|
|
186
|
+
let updatedHtml = html.replace("</head>", `${statusLogCss}</head>`);
|
|
187
|
+
|
|
188
|
+
// Add JavaScript to head
|
|
189
|
+
updatedHtml = updatedHtml.replace("</head>", `${statusLogJs}</head>`);
|
|
190
|
+
|
|
191
|
+
// Add status log container after the form or before the closing body if no form
|
|
192
|
+
if (updatedHtml.includes("</form>")) {
|
|
193
|
+
return updatedHtml.replace("</form>", `</form>${statusLogHtml}`);
|
|
194
|
+
}
|
|
195
|
+
return updatedHtml.replace("</body>", `${statusLogHtml}</body>`);
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
}
|