var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import { jsx as _jsx } from "react/jsx-runtime";
import Preview from 'preview';
import { initChainStyles } from 'config/stylebook';
var AppOptions = {
    version: 'widget/v1',
    kind: 'Application',
    metadata: {
        name: 'subscan widget',
    },
    spec: {
        components: [
            {
                id: 'api0',
                type: 'core/v1/dummy',
                properties: {},
                traits: [
                    {
                        type: 'core/v1/fetch',
                        properties: {
                            url: 'https://polkadot.webapi.subscan.io/api/v2/scan/transfers?',
                            body: "{{{row:10,page:pagination2.currentPage ,direction:'all',include_total:false}}}",
                            lazy: true,
                            method: 'post',
                            headers: {
                                'content-type': 'application/json',
                            },
                            onError: [],
                            bodyType: 'json',
                            disabled: false,
                            onComplete: [],
                        },
                    },
                ],
            },
            {
                id: 'title1',
                type: 'core/v1/title',
                properties: {
                    text: '{{JSON.stringify(api0.fetch.data)}}',
                },
                traits: [
                    {
                        type: 'core/v1/event',
                        properties: {
                            handlers: [
                                {
                                    type: '$onMount',
                                    componentId: 'api0',
                                    method: {
                                        name: 'triggerFetch',
                                        parameters: {},
                                    },
                                    wait: {
                                        type: 'debounce',
                                        time: 0,
                                    },
                                    disabled: false,
                                },
                            ],
                        },
                    },
                ],
            },
            {
                id: 'pagination2',
                type: 'core/v1/pagination',
                properties: {
                    pageSize: 10,
                    total: 300,
                    defaultCurrent: 3,
                    disabled: false,
                    hideOnSinglePage: true,
                    size: 'default',
                    sizeCanChange: false,
                    simple: false,
                    showJumper: false,
                    showTotal: false,
                    updateWhenDefaultValueChanges: false,
                },
                traits: [
                    {
                        type: 'core/v1/event',
                        properties: {
                            handlers: [
                                {
                                    type: 'onChange',
                                    componentId: 'api0',
                                    method: {
                                        name: 'triggerFetch',
                                        parameters: {},
                                    },
                                    wait: {
                                        type: 'debounce',
                                        time: 0,
                                    },
                                    disabled: false,
                                },
                            ],
                        },
                    },
                ],
            },
        ],
    },
};
export default {
    title: 'Subscan Lib/DataSource API',
    component: Preview,
    layout: 'fullscreen',
};
var Template = function (args) { return _jsx(Preview, __assign({}, args)); };
export var Index = Template.bind({});
Index.args = __assign({ options: AppOptions }, initChainStyles);
