@trustcaptcha/trustcaptcha-frontend
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -22,3 +22,3 @@ 'use strict'; | ||
await appGlobals.globalScripts(); | ||
return index.bootstrapLazy([["trustcaptcha-component.cjs",[[1,"trustcaptcha-component",{"sitekey":[1],"companyWebsite":[1,"company-website"],"trustcaptchaWebsite":[1,"trustcaptcha-website"],"trustcaptchaApi":[1,"trustcaptcha-api"],"language":[1],"theme":[1],"autostart":[1],"tokenFieldName":[1,"token-field-name"],"captchaStatus":[32],"translation":[32],"currentTheme":[32],"reset":[64]},null,{"language":["watchLanguageUpdate"],"theme":["watchThemeUpdate"]}]]]], options); | ||
return index.bootstrapLazy([["trustcaptcha-component.cjs",[[1,"trustcaptcha-component",{"sitekey":[1],"companyWebsite":[1,"company-website"],"trustcaptchaWebsite":[1,"trustcaptcha-website"],"trustcaptchaApi":[1,"trustcaptcha-api"],"language":[1],"theme":[1],"autostart":[1],"tokenFieldName":[1,"token-field-name"],"bypassToken":[1,"bypass-token"],"mode":[1],"captchaStatus":[32],"translation":[32],"currentTheme":[32],"reset":[64]},null,{"language":["watchLanguageUpdate"],"theme":["watchThemeUpdate"]}]]]], options); | ||
}); | ||
@@ -25,0 +25,0 @@ |
@@ -11,3 +11,3 @@ 'use strict'; | ||
await appGlobals.globalScripts(); | ||
return index.bootstrapLazy([["trustcaptcha-component.cjs",[[1,"trustcaptcha-component",{"sitekey":[1],"companyWebsite":[1,"company-website"],"trustcaptchaWebsite":[1,"trustcaptcha-website"],"trustcaptchaApi":[1,"trustcaptcha-api"],"language":[1],"theme":[1],"autostart":[1],"tokenFieldName":[1,"token-field-name"],"captchaStatus":[32],"translation":[32],"currentTheme":[32],"reset":[64]},null,{"language":["watchLanguageUpdate"],"theme":["watchThemeUpdate"]}]]]], options); | ||
return index.bootstrapLazy([["trustcaptcha-component.cjs",[[1,"trustcaptcha-component",{"sitekey":[1],"companyWebsite":[1,"company-website"],"trustcaptchaWebsite":[1,"trustcaptcha-website"],"trustcaptchaApi":[1,"trustcaptcha-api"],"language":[1],"theme":[1],"autostart":[1],"tokenFieldName":[1,"token-field-name"],"bypassToken":[1,"bypass-token"],"mode":[1],"captchaStatus":[32],"translation":[32],"currentTheme":[32],"reset":[64]},null,{"language":["watchLanguageUpdate"],"theme":["watchThemeUpdate"]}]]]], options); | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -1,3 +0,14 @@ | ||
export function getTranslation(language = 'en') { | ||
return translations[language]; | ||
export function getTranslation(language = 'auto') { | ||
if (language != 'auto') { | ||
return translations[language]; | ||
} | ||
const foundLanguage = document.documentElement.lang; | ||
if (!foundLanguage) { | ||
return translations['en']; | ||
} | ||
const foundTranslation = translations[foundLanguage]; | ||
if (!foundTranslation) { | ||
return translations['en']; | ||
} | ||
return foundTranslation; | ||
} | ||
@@ -4,0 +15,0 @@ const translations = { |
@@ -8,3 +8,3 @@ import { ApiService } from "./api-service"; | ||
static verify(captchaBox, successCallback, failureCallback) { | ||
const data = InformationCollector.collectInformation(captchaBox); | ||
const data = new InformationCollector(captchaBox).collectInformation(); | ||
ApiService.verifyUser(captchaBox, data).then(verificationResponse => { | ||
@@ -26,2 +26,5 @@ switch (verificationResponse.status) { | ||
break; | ||
case 422: | ||
failureCallback(new ErrorModel(ErrorCode.MODES_NOT_MATCHING, `Captcha mode '${captchaBox.mode}' not compatible with the captcha mode set in the settings.`)); | ||
break; | ||
default: | ||
@@ -28,0 +31,0 @@ failureCallback(new ErrorModel(ErrorCode.UNKNOWN_ERROR, `Unknown error.`)); |
@@ -7,5 +7,6 @@ export var ErrorCode; | ||
ErrorCode[ErrorCode["SITE_KEY_NOT_VALID"] = 3] = "SITE_KEY_NOT_VALID"; | ||
ErrorCode[ErrorCode["CAPTCHA_NOT_ACCESSIBLE"] = 4] = "CAPTCHA_NOT_ACCESSIBLE"; | ||
ErrorCode[ErrorCode["POW_FAILURE"] = 5] = "POW_FAILURE"; | ||
ErrorCode[ErrorCode["MODES_NOT_MATCHING"] = 4] = "MODES_NOT_MATCHING"; | ||
ErrorCode[ErrorCode["CAPTCHA_NOT_ACCESSIBLE"] = 5] = "CAPTCHA_NOT_ACCESSIBLE"; | ||
ErrorCode[ErrorCode["POW_FAILURE"] = 6] = "POW_FAILURE"; | ||
})(ErrorCode || (ErrorCode = {})); | ||
//# sourceMappingURL=error-code.js.map |
@@ -8,3 +8,3 @@ import { ApiManager } from "./api/api-manager"; | ||
export class CaptchaBox { | ||
constructor(sitekey, trustcaptchaApi, htmlElement, autostart, tokenFieldName) { | ||
constructor(sitekey, trustcaptchaApi, htmlElement, autostart, tokenFieldName, bypassToken, mode) { | ||
this.statusChangedEvent = new EventEmitter(); | ||
@@ -15,2 +15,4 @@ this.captchaFinishEvent = new EventEmitter(); | ||
this.tokenFieldName = 'tc-verification-token'; | ||
this.bypassToken = ''; | ||
this.mode = 'standard'; | ||
this.boxCreationTimestamp = new Date(); | ||
@@ -23,2 +25,4 @@ this.eventTracker = new EventTracker(); | ||
this.tokenFieldName = tokenFieldName; | ||
this.bypassToken = bypassToken; | ||
this.mode = mode; | ||
} | ||
@@ -25,0 +29,0 @@ setup() { |
import getTimezone from "./sources/timezone"; | ||
import { VERSION } from "../../../../version"; | ||
export class InformationCollector { | ||
static collectInformation(box) { | ||
const browserInformation = { | ||
constructor(box) { | ||
this.box = box; | ||
} | ||
collectInformation() { | ||
let browserInformation = this.getAllKeysAndValues(this.getBrowserInformation()); | ||
let userEvents = []; | ||
if (this.box.mode === 'standard') { | ||
userEvents = this.box.eventTracker.getEventsAndResetArray(); | ||
} | ||
return { | ||
custom: { | ||
boxCreationTimestamp: this.box.boxCreationTimestamp, | ||
startSolvingTimestamp: new Date(), | ||
timezone: getTimezone(), | ||
honeypotField: this.box.honeypotField.value, | ||
framework: this.safeGet(() => this.detectFrontendFramework()), | ||
version: VERSION, | ||
bypassToken: this.box.bypassToken, | ||
mode: this.getMode(), | ||
}, | ||
browserInformation: browserInformation, | ||
userEvents: userEvents, | ||
}; | ||
} | ||
getBrowserInformation() { | ||
if (this.box.mode === 'minimal') { | ||
return this.getMinimalBrowserInformation(); | ||
} | ||
return this.getStandardBrowserInformation(); | ||
} | ||
getMode() { | ||
if (this.box.mode === 'minimal') { | ||
return 'MINIMAL_DATA'; | ||
} | ||
return 'STANDARD'; | ||
} | ||
getMinimalBrowserInformation() { | ||
return { | ||
cookies: document.cookie.split("; ").map(cookie => cookie.split("=")[0]), | ||
window: { | ||
connection: { | ||
// @ts-ignore | ||
downlink: this.safeGet(() => window.navigator.connection.downlink), | ||
// @ts-ignore | ||
effectiveType: this.safeGet(() => window.navigator.connection.effectiveType), | ||
// @ts-ignore | ||
rtt: this.safeGet(() => window.navigator.connection.rtt), | ||
// @ts-ignore | ||
saveData: this.safeGet(() => window.navigator.connection.saveData) | ||
}, | ||
location: { | ||
href: this.safeGet(() => window.location.href), | ||
}, | ||
navigator: { | ||
cookieEnabled: this.safeGet(() => window.navigator.cookieEnabled), | ||
// @ts-ignore | ||
deviceMemory: this.safeGet(() => window.navigator.deviceMemory), | ||
doNotTrack: this.safeGet(() => window.navigator.doNotTrack), | ||
hardwareConcurrency: this.safeGet(() => window.navigator.hardwareConcurrency), | ||
language: this.safeGet(() => window.navigator.language), | ||
languages: this.safeGet(() => window.navigator.languages), | ||
userAgent: this.safeGet(() => window.navigator.userAgent), | ||
}, | ||
origin: this.safeGet(() => window.origin), | ||
}, | ||
}; | ||
} | ||
getStandardBrowserInformation() { | ||
return { | ||
dom: { | ||
@@ -133,17 +200,4 @@ automationNote: this.safeGet(() => this.getAutomationNote()) | ||
}; | ||
let keyValues = InformationCollector.getAllKeysAndValues(browserInformation); | ||
return { | ||
custom: { | ||
boxCreationTimestamp: box.boxCreationTimestamp, | ||
startSolvingTimestamp: new Date(), | ||
timezone: getTimezone(), | ||
honeypotField: box.honeypotField.value, | ||
framework: this.safeGet(() => this.detectFrontendFramework()), | ||
version: VERSION, | ||
}, | ||
browserInformation: keyValues, | ||
userEvents: box.eventTracker.getEventsAndResetArray(), | ||
}; | ||
} | ||
static getAllKeysAndValues(obj, parentKey = '') { | ||
getAllKeysAndValues(obj, parentKey = '') { | ||
let result = {}; | ||
@@ -153,3 +207,3 @@ for (let key in obj) { | ||
if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) { | ||
let nestedKeysAndValues = InformationCollector.getAllKeysAndValues(obj[key], currentKey); | ||
let nestedKeysAndValues = this.getAllKeysAndValues(obj[key], currentKey); | ||
result = Object.assign(Object.assign({}, result), nestedKeysAndValues); | ||
@@ -170,3 +224,3 @@ } | ||
} | ||
static safeGet(fn) { | ||
safeGet(fn) { | ||
try { | ||
@@ -179,3 +233,3 @@ return fn(); | ||
} | ||
static getAutomationNote() { | ||
getAutomationNote() { | ||
var documentDetectionKeys = [ | ||
@@ -231,3 +285,3 @@ "__webdriver_evaluate", | ||
} | ||
static detectFrontendFramework() { | ||
detectFrontendFramework() { | ||
try { | ||
@@ -234,0 +288,0 @@ // Überprüfen auf React |
@@ -12,6 +12,8 @@ import { h, Host } from "@stencil/core"; | ||
this.trustcaptchaApi = 'https://api.captcha.trustcaptcha.com'; | ||
this.language = 'en'; | ||
this.language = 'auto'; | ||
this.theme = 'light'; | ||
this.autostart = 'active'; | ||
this.tokenFieldName = 'tc-verification-token'; | ||
this.bypassToken = ''; | ||
this.mode = 'standard'; | ||
this.captchaStatus = Status.START; | ||
@@ -22,3 +24,3 @@ this.translation = undefined; | ||
componentWillLoad() { | ||
this.captchaBox = new CaptchaBox(this.sitekey, this.trustcaptchaApi, this.hostElement, this.isAutostartActive(), this.tokenFieldName); | ||
this.captchaBox = new CaptchaBox(this.sitekey, this.trustcaptchaApi, this.hostElement, this.isAutostartActive(), this.tokenFieldName, this.bypassToken, this.mode); | ||
this.captchaBox.statusChangedEvent.on('statusChanged', value => { this.captchaStatus = value; }); | ||
@@ -36,2 +38,3 @@ this.captchaBox.captchaFinishEvent.on("captchaSolved", verificationToken => { | ||
this.watchThemeUpdate(); | ||
this.watchHtmlLangUpdate(); | ||
} | ||
@@ -62,2 +65,13 @@ isAutostartActive() { | ||
} | ||
watchHtmlLangUpdate() { | ||
const observer = new MutationObserver(mutations => { | ||
for (let mutation of mutations) { | ||
if (mutation.type === 'attributes' && mutation.attributeName === 'lang' && this.language == 'auto') { | ||
this.translation = getTranslation('auto'); | ||
} | ||
} | ||
}); | ||
const config = { attributes: true, attributeFilter: ['lang'] }; | ||
observer.observe(document.documentElement, config); | ||
} | ||
async reset() { | ||
@@ -67,3 +81,3 @@ this.captchaBox.reset(); | ||
render() { | ||
return (h(Host, { key: '488aaa403c878591613e0a30854630df1b705299' }, h("div", { key: '41386c1197a7872b89beb34da7f4399fa6f09dd4', class: { | ||
return (h(Host, { key: 'c0843057cfc99f7887bb61e20acf415b578b10ff' }, h("div", { key: '1b7a211d758fe2817e8cb5c510a5d69322efd59f', class: { | ||
'px-2 py-2 border-2 rounded-md': true, | ||
@@ -76,3 +90,3 @@ 'bg-gray-50 border-gray-100': this.currentTheme == 'light' && (this.captchaBox.status === Status.START || this.captchaBox.status === Status.RUNNING), | ||
'bg-red-800 border-red-700': this.currentTheme == 'dark' && this.captchaBox.status === Status.FAILED | ||
} }, h("div", { key: 'cd53f870f3d9038ddab53eac9ce5c5d9cfdb786e', class: 'flex space-x-2' }, h("div", { key: 'b20829619f2aab0bc5c5b6956a8e92a8689417a5', class: "flex justify-center items-center w-14 h-14" }, h("div", { key: 'cc9b48c0f6615de019c6db56b77868a586837edb', class: 'justify-center' }, this.captchaStatus == Status.START && | ||
} }, h("div", { key: '0c72970225d077dc530643ffcd18ee28169f0696', class: 'flex space-x-2' }, h("div", { key: '1b581746a4244b6d75d4a0cf889f119797619a0b', class: "flex justify-center items-center w-14 h-14" }, h("div", { key: '001d7550bcc4bc1c0dddfc85a6a5d34bc63d0081', class: 'justify-center' }, this.captchaStatus == Status.START && | ||
h("div", null, this.currentTheme == 'light' && | ||
@@ -83,7 +97,7 @@ h("div", null, h("svg", { version: "1.1", id: "Capa_1", xmlns: "http://www.w3.org/2000/svg", width: "48", height: "48", viewBox: "0 0 428.2 428.2" }, h("path", { class: "iconLight", d: "M393.8,110.2c-0.5-11.3-0.5-22-0.5-32.7c0-8.5-6.9-15.4-15.4-15.4c-64,0-112.6-18.4-153.1-57.9\n c-6.1-5.6-15.4-5.6-21.5,0c-40.4,39.4-89.1,57.8-153.1,57.9c-8.5,0-15.4,6.9-15.4,15.4c0,10.7,0,21.5-0.5,32.7\n c-2,107.5-5.1,255,174.6,316.9l5.1,1l5.1-1C398.4,365.2,395.8,218.2,393.8,110.2z M202.2,258.9c-0.2,0.2-0.5,0.4-0.7,0.7\n c-3,2.4-6.4,3.8-10.4,3.8h-0.5c-4.1,0-8.2-2-10.8-5.1l-39.5-43.8c-4.4-4.9-4-12.5,0.9-16.9l5.2-4.6c4.9-4.4,12.4-3.9,16.8,0.9\n l21.2,23.5c4.5,5,12.2,5.3,17.1,0.7l65.3-62.1c4.8-4.6,12.4-4.3,17,0.5l4.7,5c4.5,4.8,4.2,12.3-0.6,16.9L202.2,258.9z" }))), this.currentTheme == 'dark' && | ||
h("div", { class: 'text-green-500' }, h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", width: "48", height: "48" }, h("path", { "fill-rule": "evenodd", d: "M19.916 4.626a.75.75 0 01.208 1.04l-9 13.5a.75.75 0 01-1.154.114l-6-6a.75.75 0 011.06-1.06l5.353 5.353 8.493-12.739a.75.75 0 011.04-.208z", "clip-rule": "evenodd" }))), this.captchaStatus == Status.FAILED && | ||
h("div", null, h("svg", { height: "48", version: "1.1", width: "48", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("g", { transform: "translate(0 -1028.4)" }, h("path", { d: "m22 12c0 5.523-4.477 10-10 10-5.5228 0-10-4.477-10-10 0-5.5228 4.4772-10 10-10 5.523 0 10 4.4772 10 10z", fill: "#c0392b", transform: "translate(0 1029.4)" }), h("path", { d: "m22 12c0 5.523-4.477 10-10 10-5.5228 0-10-4.477-10-10 0-5.5228 4.4772-10 10-10 5.523 0 10 4.4772 10 10z", fill: "#e74c3c", transform: "translate(0 1028.4)" }), h("path", { d: "m7.0503 1037.8 3.5357 3.6-3.5357 3.5 1.4142 1.4 3.5355-3.5 3.536 3.5 1.414-1.4-3.536-3.5 3.536-3.6-1.414-1.4-3.536 3.5-3.5355-3.5-1.4142 1.4z", fill: "#c0392b" }), h("path", { d: "m7.0503 1036.8 3.5357 3.6-3.5357 3.5 1.4142 1.4 3.5355-3.5 3.536 3.5 1.414-1.4-3.536-3.5 3.536-3.6-1.414-1.4-3.536 3.5-3.5355-3.5-1.4142 1.4z", fill: "#ecf0f1" })))))), h("div", { key: 'f38a653e37c2747e9e216efd7da0ad379a76c8bf', class: "grow" }, this.captchaStatus == Status.START && | ||
h("div", null, h("svg", { height: "48", version: "1.1", width: "48", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("g", { transform: "translate(0 -1028.4)" }, h("path", { d: "m22 12c0 5.523-4.477 10-10 10-5.5228 0-10-4.477-10-10 0-5.5228 4.4772-10 10-10 5.523 0 10 4.4772 10 10z", fill: "#c0392b", transform: "translate(0 1029.4)" }), h("path", { d: "m22 12c0 5.523-4.477 10-10 10-5.5228 0-10-4.477-10-10 0-5.5228 4.4772-10 10-10 5.523 0 10 4.4772 10 10z", fill: "#e74c3c", transform: "translate(0 1028.4)" }), h("path", { d: "m7.0503 1037.8 3.5357 3.6-3.5357 3.5 1.4142 1.4 3.5355-3.5 3.536 3.5 1.414-1.4-3.536-3.5 3.536-3.6-1.414-1.4-3.536 3.5-3.5355-3.5-1.4142 1.4z", fill: "#c0392b" }), h("path", { d: "m7.0503 1036.8 3.5357 3.6-3.5357 3.5 1.4142 1.4 3.5355-3.5 3.536 3.5 1.414-1.4-3.536-3.5 3.536-3.6-1.414-1.4-3.536 3.5-3.5355-3.5-1.4142 1.4z", fill: "#ecf0f1" })))))), h("div", { key: '23d86caf1596794472cd6181e91f24c8c6b7f7a9', class: "grow" }, this.captchaStatus == Status.START && | ||
h("div", null, h("button", { type: "button", class: "w-full justify-center inline-flex items-center gap-x-1.5 rounded-md px-3 py-2 text-sm font-semibold bg-blue-500 text-white shadow-sm hover:bg-blue-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500 transition duration-150 ease-in-out hover:scale-y-110", onClick: () => this.startVerification() }, h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "-ml-0.5 h-5 w-5" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59" })), this.translation.button.startVerification)), this.captchaStatus == Status.RUNNING && | ||
h("div", null, h("button", { type: "button", class: { 'w-full justify-center inline-flex items-center gap-x-1.5 rounded-md px-3 py-2 text-sm font-semibold shadow-sm ring-1 ring-inset cursor-default': true, 'bg-gray-200 text-gray-900 ring-gray-200': this.currentTheme == 'light', 'bg-gray-700 text-gray-100 ring-gray-700': this.currentTheme == 'dark' }, disabled: true }, h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "-ml-0.5 h-5 w-5" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z" })), this.translation.button.verificationInProgress)), this.captchaStatus == Status.DONE && | ||
h("div", null, h("button", { type: "button", class: { 'w-full justify-center inline-flex items-center gap-x-1.5 rounded-md px-3 py-2 text-sm font-semibold shadow-sm ring-1 ring-inset cursor-default': true, 'bg-gray-200 text-gray-900 ring-gray-200': this.currentTheme == 'light', 'bg-gray-700 text-gray-100 ring-gray-700': this.currentTheme == 'dark' }, disabled: true }, h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", class: "-ml-0.5 h-5 w-5" }, h("path", { "fill-rule": "evenodd", d: "M7.5 6a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0zM3.751 20.105a8.25 8.25 0 0116.498 0 .75.75 0 01-.437.695A18.683 18.683 0 0112 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 01-.437-.695z", "clip-rule": "evenodd" })), this.translation.button.verificationCompleted)), this.captchaStatus == Status.FAILED && | ||
h("div", null, h("span", { class: "text-red-500 text-sm" }, this.failureText)), h("div", { key: 'ba6a92f88c8165cb465d0d7c431f245d4c885fb6', class: 'flex flex-wrap justify-end space-x-2' }, h("div", { key: '25f0f3a5236f3fde7b7dd4577ccb7d2356dce8cd' }, h("a", { key: '6398f82d61051b1b53cdd18315615258c524df8f', class: { 'text-xs leading-6 hover:text-blue-500 hover:underline': true, 'text-gray-600': this.currentTheme == 'light', 'text-gray-400': this.currentTheme == 'dark' }, href: `${this.companyWebsite}/en/legal/end-privacy-policy`, target: '_blank' }, this.translation.footer.endPrivacyPolicy)), h("div", { key: 'e2eac6e5feea91130ddf70bd741b27b3052cdef4' }, h("a", { key: 'ab58e4888653637fb3579c4b2f5cd90fc6fcc9f7', class: 'text-xs leading-6 text-blue-500 hover:text-blue-500 hover:underline font-bold', href: this.trustcaptchaWebsite, target: '_blank' }, "Trustcaptcha")))))))); | ||
h("div", null, h("span", { class: "text-red-500 text-sm" }, this.failureText)), h("div", { key: 'b60f2099aef64df04248c2fda2103cd51ad6fc24', class: 'flex flex-wrap justify-end space-x-2' }, h("div", { key: '10f08350304bff84040e4c7ad9c4da4b79b8d90a' }, h("a", { key: 'b9e056c4276e5710ee6fe1934949cb6050b8d4e6', class: { 'text-xs leading-6 hover:text-blue-500 hover:underline': true, 'text-gray-600': this.currentTheme == 'light', 'text-gray-400': this.currentTheme == 'dark' }, href: `${this.companyWebsite}/en/legal/end-privacy-policy`, target: '_blank' }, this.translation.footer.endPrivacyPolicy)), h("div", { key: '193815e8ae276fe820e7ad2f6d5c753b9a8065de' }, h("a", { key: '3d0800428ba2d64868f8a4a666e63deeaa0c7cb5', class: 'text-xs leading-6 text-blue-500 hover:text-blue-500 hover:underline font-bold', href: this.trustcaptchaWebsite, target: '_blank' }, "Trustcaptcha")))))))); | ||
} | ||
@@ -182,4 +196,4 @@ startVerification() { | ||
"complexType": { | ||
"original": "'be' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'lb' | 'lt' | 'lv' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sv' | 'tr'", | ||
"resolved": "\"hr\" | \"tr\" | \"no\" | \"es\" | \"be\" | \"cs\" | \"da\" | \"de\" | \"el\" | \"en\" | \"fi\" | \"fr\" | \"hu\" | \"it\" | \"lb\" | \"lt\" | \"lv\" | \"nl\" | \"pl\" | \"pt\" | \"ro\" | \"ru\" | \"sk\" | \"sv\"", | ||
"original": "'auto' | 'be' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'lb' | 'lt' | 'lv' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sv' | 'tr'", | ||
"resolved": "\"hr\" | \"tr\" | \"auto\" | \"no\" | \"es\" | \"be\" | \"cs\" | \"da\" | \"de\" | \"el\" | \"en\" | \"fi\" | \"fr\" | \"hu\" | \"it\" | \"lb\" | \"lt\" | \"lv\" | \"nl\" | \"pl\" | \"pt\" | \"ro\" | \"ru\" | \"sk\" | \"sv\"", | ||
"references": {} | ||
@@ -195,3 +209,3 @@ }, | ||
"reflect": false, | ||
"defaultValue": "'en'" | ||
"defaultValue": "'auto'" | ||
}, | ||
@@ -251,2 +265,38 @@ "theme": { | ||
"defaultValue": "'tc-verification-token'" | ||
}, | ||
"bypassToken": { | ||
"type": "string", | ||
"mutable": false, | ||
"complexType": { | ||
"original": "string | null", | ||
"resolved": "string", | ||
"references": {} | ||
}, | ||
"required": false, | ||
"optional": false, | ||
"docs": { | ||
"tags": [], | ||
"text": "" | ||
}, | ||
"attribute": "bypass-token", | ||
"reflect": false, | ||
"defaultValue": "''" | ||
}, | ||
"mode": { | ||
"type": "string", | ||
"mutable": false, | ||
"complexType": { | ||
"original": "'standard' | 'minimal'", | ||
"resolved": "\"minimal\" | \"standard\"", | ||
"references": {} | ||
}, | ||
"required": false, | ||
"optional": false, | ||
"docs": { | ||
"tags": [], | ||
"text": "" | ||
}, | ||
"attribute": "mode", | ||
"reflect": false, | ||
"defaultValue": "'standard'" | ||
} | ||
@@ -253,0 +303,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
export const VERSION = '1.2.0'; | ||
export const VERSION = '1.3.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -19,5 +19,5 @@ import { p as promiseResolve, b as bootstrapLazy } from './index-781dbb2d.js'; | ||
await globalScripts(); | ||
return bootstrapLazy([["trustcaptcha-component",[[1,"trustcaptcha-component",{"sitekey":[1],"companyWebsite":[1,"company-website"],"trustcaptchaWebsite":[1,"trustcaptcha-website"],"trustcaptchaApi":[1,"trustcaptcha-api"],"language":[1],"theme":[1],"autostart":[1],"tokenFieldName":[1,"token-field-name"],"captchaStatus":[32],"translation":[32],"currentTheme":[32],"reset":[64]},null,{"language":["watchLanguageUpdate"],"theme":["watchThemeUpdate"]}]]]], options); | ||
return bootstrapLazy([["trustcaptcha-component",[[1,"trustcaptcha-component",{"sitekey":[1],"companyWebsite":[1,"company-website"],"trustcaptchaWebsite":[1,"trustcaptcha-website"],"trustcaptchaApi":[1,"trustcaptcha-api"],"language":[1],"theme":[1],"autostart":[1],"tokenFieldName":[1,"token-field-name"],"bypassToken":[1,"bypass-token"],"mode":[1],"captchaStatus":[32],"translation":[32],"currentTheme":[32],"reset":[64]},null,{"language":["watchLanguageUpdate"],"theme":["watchThemeUpdate"]}]]]], options); | ||
}); | ||
//# sourceMappingURL=frontendlibrary.js.map |
@@ -8,3 +8,3 @@ import { b as bootstrapLazy } from './index-781dbb2d.js'; | ||
await globalScripts(); | ||
return bootstrapLazy([["trustcaptcha-component",[[1,"trustcaptcha-component",{"sitekey":[1],"companyWebsite":[1,"company-website"],"trustcaptchaWebsite":[1,"trustcaptcha-website"],"trustcaptchaApi":[1,"trustcaptcha-api"],"language":[1],"theme":[1],"autostart":[1],"tokenFieldName":[1,"token-field-name"],"captchaStatus":[32],"translation":[32],"currentTheme":[32],"reset":[64]},null,{"language":["watchLanguageUpdate"],"theme":["watchThemeUpdate"]}]]]], options); | ||
return bootstrapLazy([["trustcaptcha-component",[[1,"trustcaptcha-component",{"sitekey":[1],"companyWebsite":[1,"company-website"],"trustcaptchaWebsite":[1,"trustcaptcha-website"],"trustcaptchaApi":[1,"trustcaptcha-api"],"language":[1],"theme":[1],"autostart":[1],"tokenFieldName":[1,"token-field-name"],"bypassToken":[1,"bypass-token"],"mode":[1],"captchaStatus":[32],"translation":[32],"currentTheme":[32],"reset":[64]},null,{"language":["watchLanguageUpdate"],"theme":["watchThemeUpdate"]}]]]], options); | ||
}; | ||
@@ -11,0 +11,0 @@ |
@@ -1,2 +0,2 @@ | ||
import{p as t,b as a}from"./p-8eb7a7fc.js";export{s as setNonce}from"./p-8eb7a7fc.js";import{g as e}from"./p-e1255160.js";const c=()=>{const a=import.meta.url;const e={};if(a!==""){e.resourcesUrl=new URL(".",a).href}return t(e)};c().then((async t=>{await e();return a([["p-0dbd86ba",[[1,"trustcaptcha-component",{sitekey:[1],companyWebsite:[1,"company-website"],trustcaptchaWebsite:[1,"trustcaptcha-website"],trustcaptchaApi:[1,"trustcaptcha-api"],language:[1],theme:[1],autostart:[1],tokenFieldName:[1,"token-field-name"],captchaStatus:[32],translation:[32],currentTheme:[32],reset:[64]},null,{language:["watchLanguageUpdate"],theme:["watchThemeUpdate"]}]]]],t)})); | ||
import{p as t,b as e}from"./p-8eb7a7fc.js";export{s as setNonce}from"./p-8eb7a7fc.js";import{g as a}from"./p-e1255160.js";const c=()=>{const e=import.meta.url;const a={};if(e!==""){a.resourcesUrl=new URL(".",e).href}return t(a)};c().then((async t=>{await a();return e([["p-ee069afb",[[1,"trustcaptcha-component",{sitekey:[1],companyWebsite:[1,"company-website"],trustcaptchaWebsite:[1,"trustcaptcha-website"],trustcaptchaApi:[1,"trustcaptcha-api"],language:[1],theme:[1],autostart:[1],tokenFieldName:[1,"token-field-name"],bypassToken:[1,"bypass-token"],mode:[1],captchaStatus:[32],translation:[32],currentTheme:[32],reset:[64]},null,{language:["watchLanguageUpdate"],theme:["watchThemeUpdate"]}]]]],t)})); | ||
//# sourceMappingURL=frontendlibrary.esm.js.map |
@@ -11,4 +11,6 @@ /* eslint-disable */ | ||
"autostart": 'active' | 'disabled'; | ||
"bypassToken": string | null; | ||
"companyWebsite": string; | ||
"language": 'be' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'lb' | 'lt' | 'lv' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sv' | 'tr'; | ||
"language": 'auto' | 'be' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'lb' | 'lt' | 'lv' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sv' | 'tr'; | ||
"mode": 'standard' | 'minimal'; | ||
"reset": () => Promise<void>; | ||
@@ -52,4 +54,6 @@ "sitekey": string; | ||
"autostart"?: 'active' | 'disabled'; | ||
"bypassToken"?: string | null; | ||
"companyWebsite"?: string; | ||
"language"?: 'be' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'lb' | 'lt' | 'lv' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sv' | 'tr'; | ||
"language"?: 'auto' | 'be' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'lb' | 'lt' | 'lv' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sv' | 'tr'; | ||
"mode"?: 'standard' | 'minimal'; | ||
"onCaptchaFailed"?: (event: TrustcaptchaComponentCustomEvent<string>) => void; | ||
@@ -56,0 +60,0 @@ "onCaptchaSolved"?: (event: TrustcaptchaComponentCustomEvent<string>) => void; |
@@ -1,2 +0,2 @@ | ||
export declare function getTranslation(language?: 'be' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'lb' | 'lt' | 'lv' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sv' | 'tr'): {}; | ||
export declare function getTranslation(language?: 'auto' | 'be' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'lb' | 'lt' | 'lv' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sv' | 'tr'): {}; | ||
export interface Translations { | ||
@@ -3,0 +3,0 @@ be: Translation; |
@@ -6,4 +6,5 @@ export declare enum ErrorCode { | ||
SITE_KEY_NOT_VALID = 3, | ||
CAPTCHA_NOT_ACCESSIBLE = 4, | ||
POW_FAILURE = 5 | ||
MODES_NOT_MATCHING = 4, | ||
CAPTCHA_NOT_ACCESSIBLE = 5, | ||
POW_FAILURE = 6 | ||
} |
@@ -13,2 +13,4 @@ export interface UserVerify { | ||
version: string; | ||
bypassToken: string | null; | ||
mode: string; | ||
} |
@@ -14,2 +14,4 @@ /// <reference types="node" /> | ||
readonly tokenFieldName: string; | ||
readonly bypassToken: string | null; | ||
readonly mode: string; | ||
readonly boxCreationTimestamp: Date; | ||
@@ -20,3 +22,3 @@ readonly eventTracker: EventTracker; | ||
verificationTokenField: HTMLInputElement; | ||
constructor(sitekey: string, trustcaptchaApi: string, htmlElement: HTMLElement, autostart: boolean, tokenFieldName: string); | ||
constructor(sitekey: string, trustcaptchaApi: string, htmlElement: HTMLElement, autostart: boolean, tokenFieldName: string, bypassToken: string | null, mode: string); | ||
setup(): void; | ||
@@ -23,0 +25,0 @@ private createHoneypotField; |
@@ -113,3 +113,2 @@ export interface CustomEvent { | ||
composed: boolean; | ||
currentTarget: any; | ||
eventPhase: number; | ||
@@ -116,0 +115,0 @@ returnValue: boolean; |
import { UserVerify } from "../api/model/user-verify"; | ||
import { CaptchaBox } from "../captcha_box"; | ||
export declare class InformationCollector { | ||
static collectInformation(box: CaptchaBox): UserVerify; | ||
static getAllKeysAndValues(obj: any, parentKey?: string): {}; | ||
static safeGet(fn: any): any; | ||
private static getAutomationNote; | ||
private static detectFrontendFramework; | ||
readonly box: CaptchaBox; | ||
constructor(box: CaptchaBox); | ||
collectInformation(): UserVerify; | ||
private getBrowserInformation; | ||
private getMode; | ||
private getMinimalBrowserInformation; | ||
private getStandardBrowserInformation; | ||
private getAllKeysAndValues; | ||
private safeGet; | ||
private getAutomationNote; | ||
private detectFrontendFramework; | ||
} |
@@ -10,6 +10,8 @@ import { EventEmitter } from '../../stencil-public-runtime'; | ||
trustcaptchaApi: string; | ||
language: 'be' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'lb' | 'lt' | 'lv' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sv' | 'tr'; | ||
language: 'auto' | 'be' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'lb' | 'lt' | 'lv' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sv' | 'tr'; | ||
theme: 'light' | 'dark' | 'media'; | ||
autostart: 'active' | 'disabled'; | ||
tokenFieldName: string; | ||
bypassToken: string | null; | ||
mode: 'standard' | 'minimal'; | ||
captchaSolved: EventEmitter<string>; | ||
@@ -26,2 +28,3 @@ captchaFailed: EventEmitter<string>; | ||
watchThemeUpdate(): void; | ||
watchHtmlLangUpdate(): void; | ||
reset(): Promise<void>; | ||
@@ -28,0 +31,0 @@ render(): any; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "1.2.0"; | ||
export declare const VERSION = "1.3.0"; |
{ | ||
"name": "@trustcaptcha/trustcaptcha-frontend", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Frondend library for trustcaptcha", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2228463
14445