var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import { MenuItem, Select, TextField } from '@material-ui/core';
import { Consent, ConsentActionType } from '@signatu/consent';
import React from 'react';
import Highlight from 'react-highlight';
import { PolicyConsentDashboard } from '..';
import { DemoCard } from './common';
var PolicyDashboardDemo = /** @class */ (function (_super) {
    __extends(PolicyDashboardDemo, _super);
    function PolicyDashboardDemo() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.name = "PolicyDashboard";
        _this.doc = React.createElement(Highlight, { className: 'hljs' }, "\nimport {PolicyConsentDashboard} from '@signatu/consent-react';\n\nconst config = {\n    apiKey: \"YOUR_API_KEY\", \n    accessToken: \"YOUR_ACCESS_TOKEN\"\n}\n\nrender() {\n    return <PolicyConsentDashboard\n        config={config} \n        title=\"Policy Dashboard\"\n        subtitle={<span>You can withdraw your consent at any time in your <a href=\"https://signatu.com/app/account\">Account Page</a>.</span>}\n        elementIds={['4.1, 4.2']}\n        type=\"checkbox\"\n        subject={Consent.anonUserId()}\n        policyId=\"YOUR_POLICY_ID\"\n        language=\"en\"\n    />\n}\n");
        _this.state = {
            policyId: "119",
            type: ConsentActionType.CHECKBOX,
            filterPolicy: ""
        };
        _this.filterPolicy = function (event) {
            var filterPolicy = event.target.value;
            _this.setState({
                filterPolicy: filterPolicy,
                elementIds: filterPolicy && event.target.value.split(',')
            });
        };
        _this.handlePolicyId = function (event) {
            _this.setState({ policyId: event.target.value });
        };
        return _this;
    }
    PolicyDashboardDemo.prototype.render = function () {
        var _this = this;
        var demo = React.createElement("div", null,
            React.createElement("h1", null, "Policy Consent  Dashboard"),
            React.createElement(TextField, { id: "policyid", label: "Policy ID", value: this.state.policyId, onChange: this.handlePolicyId, margin: "normal" }),
            React.createElement(TextField, { id: "filterpolicy", label: "Filter policy", value: this.state.filterPolicy, onChange: this.filterPolicy, margin: "normal" }),
            React.createElement(Select
            // floatingLabelText="Control type"
            , { 
                // floatingLabelText="Control type"
                onChange: function (event) { return _this.setState({ type: event.target.value }); }, value: this.state.type },
                React.createElement(MenuItem, { value: ConsentActionType.CHECKBOX }, "Checkbox"),
                React.createElement(MenuItem, { value: ConsentActionType.BUTTONS }, "Buttons ")),
            React.createElement(PolicyConsentDashboard, { config: this.props.config, title: "Policy Dashboard", subtitle: React.createElement("span", null,
                    "You can withdraw your consent at any time in your ",
                    React.createElement("a", { href: "javascript:void(0)" }, "Account Page"),
                    "."), elementIds: this.state.elementIds, subject: Consent.anonUserId(), policyId: this.state.policyId, language: this.props.language, type: this.state.type }));
        return React.createElement(DemoCard, { element: demo, doc: this.doc });
    };
    return PolicyDashboardDemo;
}(React.Component));
export { PolicyDashboardDemo };
//# sourceMappingURL=policyDashboard.js.map