New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mcaptcha-glue

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mcaptcha-glue - npm Package Compare versions

Comparing version

to
0.1.0-alpha-2

2

dist/index.d.ts
export declare const handle: (e: MessageEvent) => void;
declare const init: () => void;
export default init;

2

dist/index.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["mcaptcha-glue"]=t():e["mcaptcha-glue"]=t()}(self,(function(){return(()=>{"use strict";var e={607:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.handle=void 0;var o=new(i(n(891)).default);t.handle=function(e){if(e.origin===o.getHost()){var t=e.data.token;o.setToken(t)}else console.error("expected message from "+o.getHost()+" but received message from "+e.origin+". Aborting.")},t.default=function(){return window.addEventListener("message",(function(e){return t.handle(e)}))}},891:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ID=t.INPUT_NAME=void 0,t.INPUT_NAME="mcaptcha__token",t.ID="mcaptcha-widget__iframe";var n=function(){function e(){this.element=null,this.parentElement=null,this.hostUrl=null,this.inputElement=null}return e.prototype.get=function(){if(null===this.element||void 0===this.element){var e=document.getElementById(t.ID);if(null==e)throw new Error("Element "+t.ID+" is undefined");this.element=e}return this.element},e.prototype.getParent=function(){return null!==this.parentElement&&void 0!==this.parentElement||(this.parentElement=this.get().parentElement),this.parentElement},e.prototype.getHost=function(){return null!==this.hostUrl&&void 0!==this.hostUrl||(this.hostUrl=this.get().dataset.mcaptcha_host),this.hostUrl},e.prototype.setToken=function(e){null!==this.inputElement&&void 0!==this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.id=t.INPUT_NAME,this.inputElement.name=t.INPUT_NAME,this.inputElement.hidden=!0,this.getParent().appendChild(this.inputElement)),this.inputElement.value=e},e}();t.default=n}},t={};return function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}(607)})()}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["mcaptcha-glue"]=t():e["mcaptcha-glue"]=t()}(self,(function(){return(()=>{"use strict";var e={607:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.handle=void 0;var r=new(i(n(891)).default);t.handle=function(e){if(new URL(e.origin).host===r.getHost()){var t=e.data.token;r.setToken(t)}else console.error("expected message from "+r.getHost()+" but received message from "+e.origin+". Aborting.")},window.addEventListener("message",(function(e){return t.handle(e)}))},891:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ID=t.INPUT_NAME=void 0,t.INPUT_NAME="mcaptcha__token",t.ID="mcaptcha-widget__iframe";var n=function(){function e(){this.iframeElement=null,this.parentElement=null,this.hostUrl=null,this.inputElement=null}return e.prototype.get=function(){if(null===this.iframeElement||void 0===this.iframeElement){var e=document.getElementById(t.ID);if(null==e)throw new Error("Element "+t.ID+" is undefined");this.iframeElement=e}return this.iframeElement},e.prototype.getParent=function(){return null!==this.parentElement&&void 0!==this.parentElement||(this.parentElement=this.get().parentElement),this.parentElement},e.prototype.getHost=function(){if(null===this.hostUrl||void 0===this.hostUrl){var e=this.get().src,t=new URL(e);this.hostUrl=t.host}return this.hostUrl},e.prototype.setToken=function(e){null!==this.inputElement&&void 0!==this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.id=t.INPUT_NAME,this.inputElement.name=t.INPUT_NAME,this.inputElement.hidden=!0,this.getParent().appendChild(this.inputElement)),this.inputElement.value=e},e}();t.default=n}},t={};return function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}(607)})()}));
//# sourceMappingURL=index.js.map
export declare const INPUT_NAME = "mcaptcha__token";
export declare const ID = "mcaptcha-widget__iframe";
declare class Widget {
element: HTMLElement | null;
iframeElement: HTMLIFrameElement | null;
parentElement: HTMLElement | null;
hostUrl: string | null;
inputElement: HTMLInputElement | null;
get(): HTMLElement;
get(): HTMLIFrameElement;
getParent(): HTMLElement;

@@ -10,0 +10,0 @@ getHost(): string;

@@ -5,2 +5,3 @@ {

"description": "glue code to setup mCaptcha on your website",
"version": "0.1.0-alpha-2",
"license": "(MIT OR Apache-2.0)",

@@ -40,3 +41,2 @@ "keywords": ["mCaptcha", "CAPTCHA", "proof of work"],

},
"version": "0.1.0-alpha-1",
"scripts": {

@@ -43,0 +43,0 @@ "build": "webpack --mode production",

@@ -7,5 +7,5 @@ <div align="center">

[![0.1.0](https://img.shields.io/badge/TypeScript_docs-master-2b7489)](https://mcaptcha.github.io/browser/)
![Build)](<https://github.com/mCaptcha/browser/workflows/CI%20(Linux)/badge.svg>)
[![codecov](https://codecov.io/gh/mCaptcha/browser/branch/master/graph/badge.svg)](https://codecov.io/gh/mCaptcha/browser)
[![0.1.0](https://img.shields.io/badge/TypeScript_docs-master-2b7489)](https://mcaptcha.github.io/glue/)
![Build)](<https://github.com/mCaptcha/glue/workflows/CI%20(Linux)/badge.svg>)
[![codecov](https://codecov.io/gh/mCaptcha/glue/branch/master/graph/badge.svg)](https://codecov.io/gh/mCaptcha/glue)

@@ -21,3 +21,4 @@ </div>

<div style="width: 304px; height: 78px;">
<iframe title="mCaptcha"
<iframe
title="mCaptcha"
src="<LINK TO WIDGET>"

@@ -24,0 +25,0 @@ role="presentation"

Sorry, the diff of this file is not supported yet