@prosopo/procaptcha-bundle 3.1.6 → 3.2.3
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 +114 -0
- package/dist/cjs/index.cjs +10 -1
- package/dist/cjs/util/configCreator.cjs +0 -1
- package/dist/index.js +10 -1
- package/dist/util/configCreator.js +0 -1
- package/package.json +16 -16
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts +0 -5
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.js +0 -5
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts +0 -16
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js +0 -135
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts +0 -2
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js +0 -36
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts +0 -2
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js +0 -69
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts +0 -2
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +0 -136
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts +0 -8
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +0 -15
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts +0 -6
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js +0 -11
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts +0 -10
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js +0 -2
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +0 -24
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +0 -49
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts +0 -3
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js +0 -8
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js +0 -14
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts +0 -4
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js +0 -9
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts +0 -4
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js +0 -9
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts +0 -6
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js +0 -13
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts +0 -5
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js +0 -24
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts +0 -3
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js +0 -17
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts +0 -3
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js +0 -9
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts +0 -18
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +0 -66
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts +0 -9
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js +0 -19
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js.map +0 -1
- package/dist/bundle/ProcaptchaWidget-CJ-4hVS1.js +0 -187
- package/dist/bundle/ProcaptchaWidget-Cw3s7cGX.js +0 -1014
- package/dist/bundle/Signer-DP9drQ55.js +0 -23
- package/dist/bundle/bnChunk-DRlDxTFg.js +0 -1137
- package/dist/bundle/browser-ponyfill-CvzSbL_o.js +0 -339
- package/dist/bundle/builder-ByZ5z580.js +0 -46
- package/dist/bundle/captchaComponentProvider-Cn75EmSH.js +0 -1002
- package/dist/bundle/captchaRenderer-s4QuLEen.js +0 -71
- package/dist/bundle/commonChunk-BjvuHlB1.js +0 -180
- package/dist/bundle/components.d.ts +0 -5
- package/dist/bundle/components.d.ts.map +0 -1
- package/dist/bundle/emotion-element-c39617d8.browser.esm-BNNnmykm.js +0 -916
- package/dist/bundle/fp.esm-DYWeNGcH.js +0 -1654
- package/dist/bundle/index-BuQg3Zno.js +0 -1884
- package/dist/bundle/index-DIdd2cUz.js +0 -5416
- package/dist/bundle/index-IgqrmVIs.js +0 -601
- package/dist/bundle/index.d.ts +0 -16
- package/dist/bundle/index.d.ts.map +0 -1
- package/dist/bundle/locales/ar/translation.json +0 -57
- package/dist/bundle/locales/az/translation.json +0 -57
- package/dist/bundle/locales/cs/translation.json +0 -57
- package/dist/bundle/locales/de/translation.json +0 -57
- package/dist/bundle/locales/el/translation.json +0 -57
- package/dist/bundle/locales/en/translation.json +0 -57
- package/dist/bundle/locales/es/translation.json +0 -57
- package/dist/bundle/locales/fi/translation.json +0 -57
- package/dist/bundle/locales/fr/translation.json +0 -57
- package/dist/bundle/locales/hi/translation.json +0 -57
- package/dist/bundle/locales/hu/translation.json +0 -57
- package/dist/bundle/locales/id/translation.json +0 -57
- package/dist/bundle/locales/it/translation.json +0 -57
- package/dist/bundle/locales/ja/translation.json +0 -57
- package/dist/bundle/locales/jv/translation.json +0 -57
- package/dist/bundle/locales/ko/translation.json +0 -57
- package/dist/bundle/locales/ml/translation.json +0 -57
- package/dist/bundle/locales/ms/translation.json +0 -57
- package/dist/bundle/locales/nl/translation.json +0 -57
- package/dist/bundle/locales/no/translation.json +0 -57
- package/dist/bundle/locales/pl/translation.json +0 -57
- package/dist/bundle/locales/pt/translation.json +0 -57
- package/dist/bundle/locales/pt-BR/translation.json +0 -57
- package/dist/bundle/locales/ro/translation.json +0 -57
- package/dist/bundle/locales/ru/translation.json +0 -57
- package/dist/bundle/locales/sr/translation.json +0 -57
- package/dist/bundle/locales/sv/translation.json +0 -57
- package/dist/bundle/locales/th/translation.json +0 -57
- package/dist/bundle/locales/tr/translation.json +0 -57
- package/dist/bundle/locales/uk/translation.json +0 -57
- package/dist/bundle/locales/vi/translation.json +0 -57
- package/dist/bundle/locales/zh-CN/translation.json +0 -57
- package/dist/bundle/nobleChunk-Bbltwf44.js +0 -2728
- package/dist/bundle/procaptcha.bundle.js +0 -8
- package/dist/bundle/tests/util/captchaType.test.d.ts +0 -2
- package/dist/bundle/tests/util/captchaType.test.d.ts.map +0 -1
- package/dist/bundle/tests/util/config.test.d.ts +0 -2
- package/dist/bundle/tests/util/config.test.d.ts.map +0 -1
- package/dist/bundle/tests/util/renderLogic.test.d.ts +0 -2
- package/dist/bundle/tests/util/renderLogic.test.d.ts.map +0 -1
- package/dist/bundle/util/captcha/captchaComponentProvider.d.ts +0 -8
- package/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +0 -1
- package/dist/bundle/util/captcha/captchaComponentsList.d.ts +0 -6
- package/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +0 -1
- package/dist/bundle/util/captcha/captchaProps.d.ts +0 -10
- package/dist/bundle/util/captcha/captchaProps.d.ts.map +0 -1
- package/dist/bundle/util/captcha/captchaRenderer.d.ts +0 -24
- package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +0 -1
- package/dist/bundle/util/captcha/captchaType.d.ts +0 -3
- package/dist/bundle/util/captcha/captchaType.d.ts.map +0 -1
- package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
- package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
- package/dist/bundle/util/captcha/components/imageCaptcha.d.ts +0 -4
- package/dist/bundle/util/captcha/components/imageCaptcha.d.ts.map +0 -1
- package/dist/bundle/util/captcha/components/powCaptcha.d.ts +0 -4
- package/dist/bundle/util/captcha/components/powCaptcha.d.ts.map +0 -1
- package/dist/bundle/util/config.d.ts +0 -6
- package/dist/bundle/util/config.d.ts.map +0 -1
- package/dist/bundle/util/configCreator.d.ts +0 -5
- package/dist/bundle/util/configCreator.d.ts.map +0 -1
- package/dist/bundle/util/language.d.ts +0 -3
- package/dist/bundle/util/language.d.ts.map +0 -1
- package/dist/bundle/util/timeout.d.ts +0 -3
- package/dist/bundle/util/timeout.d.ts.map +0 -1
- package/dist/bundle/util/widgetFactory.d.ts +0 -18
- package/dist/bundle/util/widgetFactory.d.ts.map +0 -1
- package/dist/bundle/util/widgetThemeResolver.d.ts +0 -9
- package/dist/bundle/util/widgetThemeResolver.d.ts.map +0 -1
- package/dist/bundle/utilChunk-DPr6oTOj.js +0 -317
- package/dist/bundle/utilCryptoChunk-D6ZLkbFV.js +0 -1236
- package/dist/bundle/web2Chunk-CNoojUDK.js +0 -3967
- package/dist/bundle/web3Chunk-BlYvY4Ea.js +0 -525
- package/dist/bundle/zodChunk-aEfPZzrp.js +0 -2882
- package/stats.html +0 -4842
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { loadI18next } from "@prosopo/locale";
|
|
2
|
-
import { getDefaultCallbacks, setUserCallbacks, } from "@prosopo/procaptcha-common";
|
|
3
|
-
import { CaptchaType, } from "@prosopo/types";
|
|
4
|
-
import { createWidgetSkeleton, darkTheme, lightTheme, } from "@prosopo/widget-skeleton";
|
|
5
|
-
class WidgetFactory {
|
|
6
|
-
constructor(widgetThemeResolver) {
|
|
7
|
-
this.widgetThemeResolver = widgetThemeResolver;
|
|
8
|
-
this.captchaRenderer = null;
|
|
9
|
-
this._i18n = null;
|
|
10
|
-
}
|
|
11
|
-
get i18n() {
|
|
12
|
-
if (this._i18n === null) {
|
|
13
|
-
throw new Error("I18n is not initialized");
|
|
14
|
-
}
|
|
15
|
-
return this._i18n;
|
|
16
|
-
}
|
|
17
|
-
async createWidgets(containers, renderOptions, isWeb2 = true, invisible = false) {
|
|
18
|
-
return Promise.all(containers.map((container) => {
|
|
19
|
-
const callbacks = getDefaultCallbacks(container);
|
|
20
|
-
setUserCallbacks(renderOptions, callbacks, container);
|
|
21
|
-
return this.createWidget(container, renderOptions, callbacks, isWeb2, invisible);
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
async createWidget(container, renderOptions, callbacks, isWeb2 = true, invisible = false) {
|
|
25
|
-
renderOptions.theme = this.widgetThemeResolver.resolveWidgetTheme(container, renderOptions);
|
|
26
|
-
const widgetTheme = "light" === renderOptions.theme ? lightTheme : darkTheme;
|
|
27
|
-
let widgetInteractiveArea;
|
|
28
|
-
let widgetContainer;
|
|
29
|
-
if (invisible) {
|
|
30
|
-
const newDiv = document.createElement("div");
|
|
31
|
-
container.appendChild(newDiv);
|
|
32
|
-
widgetInteractiveArea = newDiv;
|
|
33
|
-
widgetContainer = newDiv;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
const widgetResult = createWidgetSkeleton(container, widgetTheme, "prosopo-procaptcha");
|
|
37
|
-
widgetInteractiveArea = widgetResult.widgetInteractiveArea;
|
|
38
|
-
widgetContainer = widgetResult.webComponent;
|
|
39
|
-
}
|
|
40
|
-
const captchaRenderer = await this.getCaptchaRenderer();
|
|
41
|
-
const captchaRoot = captchaRenderer.renderCaptcha({
|
|
42
|
-
identifierPrefix: "procaptcha-",
|
|
43
|
-
emotionCacheKey: "procaptcha",
|
|
44
|
-
webComponentTag: "prosopo-procaptcha",
|
|
45
|
-
defaultCaptchaType: CaptchaType.frictionless,
|
|
46
|
-
}, widgetInteractiveArea, renderOptions, callbacks, isWeb2, this.i18n, invisible, widgetContainer);
|
|
47
|
-
return captchaRoot;
|
|
48
|
-
}
|
|
49
|
-
async getCaptchaRenderer() {
|
|
50
|
-
if (this._i18n === null) {
|
|
51
|
-
this._i18n = await loadI18next(false);
|
|
52
|
-
}
|
|
53
|
-
if (this.captchaRenderer === null) {
|
|
54
|
-
this.captchaRenderer = await this.createCaptchaRenderer();
|
|
55
|
-
}
|
|
56
|
-
return this.captchaRenderer;
|
|
57
|
-
}
|
|
58
|
-
async createCaptchaRenderer() {
|
|
59
|
-
const CaptchaRenderer = (await import("./captcha/captchaRenderer.js"))
|
|
60
|
-
.CaptchaRenderer;
|
|
61
|
-
const CaptchaComponentProvider = (await import("./captcha/captchaComponentProvider.js")).CaptchaComponentProvider;
|
|
62
|
-
return new CaptchaRenderer(new CaptchaComponentProvider());
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export { WidgetFactory };
|
|
66
|
-
//# sourceMappingURL=widgetFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widgetFactory.js","sourceRoot":"","sources":["../../../src/util/widgetFactory.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACN,mBAAmB,EACnB,gBAAgB,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEN,WAAW,GAGX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,oBAAoB,EACpB,SAAS,EACT,UAAU,GACV,MAAM,0BAA0B,CAAC;AAKlC,MAAM,aAAa;IAIlB,YACkB,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;QAJlD,oBAAe,GAA2B,IAAI,CAAC;QAC/C,UAAK,GAAiB,IAAI,CAAC;IAIhC,CAAC;IAEJ,IAAI,IAAI;QACP,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAA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are class WidgetThemeResolver {
|
|
3
|
-
private readonly themesSet;
|
|
4
|
-
private readonly defaultTheme;
|
|
5
|
-
resolveWidgetTheme(element: Element, renderOptions: ProcaptchaRenderOptions): "light" | "dark";
|
|
6
|
-
protected validateTheme(themeAttribute: string): "light" | "dark";
|
|
7
|
-
}
|
|
8
|
-
export { WidgetThemeResolver };
|
|
9
|
-
//# sourceMappingURL=widgetThemeResolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widgetThemeResolver.d.ts","sourceRoot":"","sources":["../../../src/util/widgetThemeResolver.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAE9D,cAAM,mBAAmB;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA8B;IACxD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAW;IAEjC,kBAAkB,CACxB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,uBAAuB,GACpC,OAAO,GAAG,MAAM;IASnB,SAAS,CAAC,aAAa,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM;CAKjE;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
class WidgetThemeResolver {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.themesSet = new Set(["light", "dark"]);
|
|
4
|
-
this.defaultTheme = "light";
|
|
5
|
-
}
|
|
6
|
-
resolveWidgetTheme(element, renderOptions) {
|
|
7
|
-
const themeAttribute = renderOptions.theme ||
|
|
8
|
-
element.getAttribute("data-theme") ||
|
|
9
|
-
this.defaultTheme;
|
|
10
|
-
return this.validateTheme(themeAttribute);
|
|
11
|
-
}
|
|
12
|
-
validateTheme(themeAttribute) {
|
|
13
|
-
return this.themesSet.has(themeAttribute)
|
|
14
|
-
? themeAttribute
|
|
15
|
-
: this.defaultTheme;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export { WidgetThemeResolver };
|
|
19
|
-
//# sourceMappingURL=widgetThemeResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widgetThemeResolver.js","sourceRoot":"","sources":["../../../src/util/widgetThemeResolver.ts"],"names":[],"mappings":"AAgBA,MAAM,mBAAmB;IAAzB;QACkB,cAAS,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QACvC,iBAAY,GAAG,OAAO,CAAC;IAmBzC,CAAC;IAjBO,kBAAkB,CACxB,OAAgB,EAChB,aAAsC;QAEtC,MAAM,cAAc,GACnB,aAAa,CAAC,KAAK;YACnB,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC;YAClC,IAAI,CAAC,YAAY,CAAC;QAEnB,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IAES,aAAa,CAAC,cAAsB;QAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;YACxC,CAAC,CAAE,cAAmC;YACtC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;IACtB,CAAC;CACD;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { g as L, p as M, b as D, P as G, E as F, j as S, C as W } from "./captchaComponentProvider-Cn75EmSH.js";
|
|
2
|
-
import { s as K, k as j, A as r, h as V, P as Y, u as X, r as l, l as q, M as H } from "./web2Chunk-CNoojUDK.js";
|
|
3
|
-
import { b as k, u as z } from "./builder-ByZ5z580.js";
|
|
4
|
-
import { l as B, d as J } from "./index-IgqrmVIs.js";
|
|
5
|
-
import { a as v } from "./commonChunk-BjvuHlB1.js";
|
|
6
|
-
import { w as Q } from "./utilChunk-DPr6oTOj.js";
|
|
7
|
-
const Z = (d, n, E, t, e) => {
|
|
8
|
-
const g = L(t), m = () => ({
|
|
9
|
-
// note order matters! see buildUpdateState. These fields are set in order, so disable modal first, then set loading to false, etc.
|
|
10
|
-
showModal: !1,
|
|
11
|
-
loading: !1,
|
|
12
|
-
index: 0,
|
|
13
|
-
challenge: void 0,
|
|
14
|
-
solutions: void 0,
|
|
15
|
-
isHuman: !1,
|
|
16
|
-
captchaApi: void 0,
|
|
17
|
-
account: void 0
|
|
18
|
-
// don't handle timeout here, this should be handled by the state management
|
|
19
|
-
}), w = () => {
|
|
20
|
-
window.clearTimeout(Number(n.timeout)), a({ timeout: void 0 });
|
|
21
|
-
}, s = () => {
|
|
22
|
-
a({
|
|
23
|
-
isHuman: !1,
|
|
24
|
-
loading: !1
|
|
25
|
-
}), g.onFailed(), i(e == null ? void 0 : e.restart);
|
|
26
|
-
}, T = () => {
|
|
27
|
-
window.clearTimeout(Number(n.successfullChallengeTimeout)), a({ successfullChallengeTimeout: void 0 });
|
|
28
|
-
}, p = () => {
|
|
29
|
-
const o = {
|
|
30
|
-
userAccountAddress: d.userAccountAddress || "",
|
|
31
|
-
...d
|
|
32
|
-
};
|
|
33
|
-
return n.account && (o.userAccountAddress = n.account.account.address), Y.parse(o);
|
|
34
|
-
}, h = () => {
|
|
35
|
-
if (!n.account)
|
|
36
|
-
throw new v("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
37
|
-
context: { error: "Account not loaded" }
|
|
38
|
-
});
|
|
39
|
-
return { account: n.account };
|
|
40
|
-
}, f = () => {
|
|
41
|
-
if (!n.dappAccount)
|
|
42
|
-
throw new v("GENERAL.SITE_KEY_MISSING");
|
|
43
|
-
return n.dappAccount;
|
|
44
|
-
}, a = k(n, E), i = (o) => {
|
|
45
|
-
w(), T(), a(m()), g.onReset(), o && o();
|
|
46
|
-
}, u = () => {
|
|
47
|
-
const o = p().captchas.pow.solutionTimeout, R = setTimeout(() => {
|
|
48
|
-
a({ isHuman: !1 }), g.onExpired(), i(e == null ? void 0 : e.restart);
|
|
49
|
-
}, o);
|
|
50
|
-
a({ successfullChallengeTimeout: R });
|
|
51
|
-
}, A = async () => {
|
|
52
|
-
await M(
|
|
53
|
-
async () => {
|
|
54
|
-
var O;
|
|
55
|
-
if (n.loading || n.isHuman)
|
|
56
|
-
return;
|
|
57
|
-
i(), a({
|
|
58
|
-
loading: !0
|
|
59
|
-
}), a({ attemptCount: n.attemptCount + 1 });
|
|
60
|
-
const o = p(), C = await (async () => e ? e.userAccount : new (await F(o.web2))().getAccount(o))(), N = C.account.address;
|
|
61
|
-
if (a({
|
|
62
|
-
account: { account: { address: N } }
|
|
63
|
-
}), a({ dappAccount: o.account.address }), await K(100), !o.web2 && !o.userAccountAddress)
|
|
64
|
-
throw new v("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
65
|
-
context: {
|
|
66
|
-
error: "Account address has not been set for web3 mode"
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
let P;
|
|
70
|
-
e != null && e.provider ? P = e.provider : P = await D(
|
|
71
|
-
p().defaultEnvironment
|
|
72
|
-
);
|
|
73
|
-
const _ = P.provider.url, y = new G(_, f()), c = await y.getPowCaptchaChallenge(
|
|
74
|
-
N,
|
|
75
|
-
f(),
|
|
76
|
-
e == null ? void 0 : e.sessionId
|
|
77
|
-
);
|
|
78
|
-
if (c.error)
|
|
79
|
-
a({
|
|
80
|
-
loading: !1,
|
|
81
|
-
error: {
|
|
82
|
-
message: c.error.message,
|
|
83
|
-
key: c.error.key || "API.UNKNOWN_ERROR"
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
else {
|
|
87
|
-
const b = j(c.challenge, c.difficulty), x = (O = C.extension) == null ? void 0 : O.signer;
|
|
88
|
-
if (!x || !x.signRaw)
|
|
89
|
-
throw new v("GENERAL.CANT_FIND_KEYRINGPAIR", {
|
|
90
|
-
context: {
|
|
91
|
-
error: "Signer is not defined, cannot sign message to prove account ownership"
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
const U = await x.signRaw({
|
|
95
|
-
address: N,
|
|
96
|
-
data: Q(c[r.timestamp].toString()),
|
|
97
|
-
type: "bytes"
|
|
98
|
-
});
|
|
99
|
-
(await y.submitPowCaptchaSolution(
|
|
100
|
-
c,
|
|
101
|
-
h().account.account.address,
|
|
102
|
-
f(),
|
|
103
|
-
b,
|
|
104
|
-
U.signature.toString(),
|
|
105
|
-
o.captchas.pow.verifiedTimeout
|
|
106
|
-
))[r.verified] ? (a({
|
|
107
|
-
isHuman: !0,
|
|
108
|
-
loading: !1
|
|
109
|
-
}), g.onHuman(
|
|
110
|
-
V({
|
|
111
|
-
[r.providerUrl]: _,
|
|
112
|
-
[r.user]: h().account.account.address,
|
|
113
|
-
[r.dapp]: f(),
|
|
114
|
-
[r.challenge]: c.challenge,
|
|
115
|
-
[r.nonce]: b,
|
|
116
|
-
[r.timestamp]: c.timestamp,
|
|
117
|
-
[r.signature]: {
|
|
118
|
-
[r.provider]: c.signature.provider,
|
|
119
|
-
[r.user]: {
|
|
120
|
-
[r.timestamp]: U.signature.toString()
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
})
|
|
124
|
-
), u()) : s();
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
A,
|
|
128
|
-
() => {
|
|
129
|
-
i();
|
|
130
|
-
},
|
|
131
|
-
n.attemptCount,
|
|
132
|
-
3
|
|
133
|
-
);
|
|
134
|
-
};
|
|
135
|
-
return {
|
|
136
|
-
start: A,
|
|
137
|
-
resetState: i
|
|
138
|
-
};
|
|
139
|
-
}, I = "procaptcha:execute", ce = (d) => {
|
|
140
|
-
var i;
|
|
141
|
-
const { t: n, ready: E } = X(), t = d.config, e = d.i18n, g = t.theme === "light" ? B : J, m = d.frictionlessState, w = d.callbacks || {}, [s, T] = z(l.useState, l.useRef), [p, h] = l.useState(!1), f = k(s, T), a = l.useRef(
|
|
142
|
-
Z(t, s, f, w, m)
|
|
143
|
-
);
|
|
144
|
-
return l.useEffect(() => {
|
|
145
|
-
t.language && (e ? e.language !== t.language && e.changeLanguage(t.language).then((u) => u) : q().then((u) => {
|
|
146
|
-
u.language !== t.language && u.changeLanguage(t.language).then((A) => A);
|
|
147
|
-
}));
|
|
148
|
-
}, [e, t.language]), l.useEffect(() => {
|
|
149
|
-
s.error && (h(!1), s.error.key === "CAPTCHA.NO_SESSION_FOUND" && m && setTimeout(() => {
|
|
150
|
-
m.restart();
|
|
151
|
-
}, 3e3));
|
|
152
|
-
}, [s.error, m]), l.useEffect(() => {
|
|
153
|
-
if (t.mode === H.invisible) {
|
|
154
|
-
const u = (A) => {
|
|
155
|
-
try {
|
|
156
|
-
a.current.start();
|
|
157
|
-
} catch (o) {
|
|
158
|
-
console.error("Error starting PoW verification:", o);
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
return document.addEventListener(I, u), () => {
|
|
162
|
-
document.removeEventListener(
|
|
163
|
-
I,
|
|
164
|
-
u
|
|
165
|
-
);
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
return () => {
|
|
169
|
-
};
|
|
170
|
-
}, [t.mode]), t.mode === H.invisible ? null : /* @__PURE__ */ S(
|
|
171
|
-
W,
|
|
172
|
-
{
|
|
173
|
-
checked: s.isHuman,
|
|
174
|
-
onChange: async () => {
|
|
175
|
-
p || (h(!0), await a.current.start(), h(!1));
|
|
176
|
-
},
|
|
177
|
-
theme: g,
|
|
178
|
-
labelText: E ? n("WIDGET.I_AM_HUMAN") : "",
|
|
179
|
-
error: (i = s.error) == null ? void 0 : i.message,
|
|
180
|
-
"aria-label": "human checkbox",
|
|
181
|
-
loading: p
|
|
182
|
-
}
|
|
183
|
-
);
|
|
184
|
-
};
|
|
185
|
-
export {
|
|
186
|
-
ce as default
|
|
187
|
-
};
|