UNPKG

@dorgtech/daocomponents

Version:

Componentizing [DAOstack's client library](https://github.com/daostack/client), enabling easier React application integration. The hope is to be able to turn any app into a DAO enabled dApp by adding ~2 components.

121 lines 4.81 kB
"use strict"; 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 __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var runtime_1 = require("../runtime"); exports.ComponentLogs = runtime_1.ComponentLogs; var ContextFeed_1 = require("../runtime/ContextFeed"); var protocol_1 = require("../protocol"); var client_1 = require("@daostack/client"); exports.ReputationEntity = client_1.Reputation; var DAO_1 = require("./DAO"); var ArcReputation = /** @class */ (function (_super) { __extends(ArcReputation, _super); function ArcReputation() { return _super !== null && _super.apply(this, arguments) || this; } ArcReputation.prototype.createEntity = function () { var _a = this.props, arcConfig = _a.arcConfig, address = _a.address; if (!arcConfig) { throw Error("Arc Config Missing: Please provide this field as a prop, or use the inference component."); } if (!address) { throw Error("Address Missing: Please provide this field as a prop, or use the inference component."); } return new client_1.Reputation(address, arcConfig.connection); }; Object.defineProperty(ArcReputation, "Entity", { get: function () { return ContextFeed_1.CreateContextFeed(this._EntityContext.Consumer, this._LogsContext.Consumer); }, enumerable: true, configurable: true }); Object.defineProperty(ArcReputation, "Data", { get: function () { return ContextFeed_1.CreateContextFeed(this._DataContext.Consumer, this._LogsContext.Consumer); }, enumerable: true, configurable: true }); Object.defineProperty(ArcReputation, "Code", { get: function () { return ContextFeed_1.CreateContextFeed(this._CodeContext.Consumer, this._LogsContext.Consumer); }, enumerable: true, configurable: true }); Object.defineProperty(ArcReputation, "Logs", { get: function () { return ContextFeed_1.CreateContextFeed(this._LogsContext.Consumer, this._LogsContext.Consumer); }, enumerable: true, configurable: true }); ArcReputation._EntityContext = React.createContext({}); ArcReputation._DataContext = React.createContext({}); ArcReputation._CodeContext = React.createContext({}); ArcReputation._LogsContext = React.createContext({}); return ArcReputation; }(runtime_1.Component)); exports.ArcReputation = ArcReputation; var Reputation = /** @class */ (function (_super) { __extends(Reputation, _super); function Reputation() { return _super !== null && _super.apply(this, arguments) || this; } Reputation.prototype.render = function () { var _a = this.props, address = _a.address, children = _a.children; if (address !== undefined) { return (React.createElement(protocol_1.Arc.Config, null, function (arc) { return (React.createElement(ArcReputation, { address: address, arcConfig: arc }, children)); })); } else { return (React.createElement(protocol_1.Arc.Config, null, React.createElement(DAO_1.DAO.Data, null, function (arc, dao) { return (React.createElement(ArcReputation, { address: dao.reputation.address, arcConfig: arc }, children)); }))); } }; Object.defineProperty(Reputation, "Entity", { get: function () { return ArcReputation.Entity; }, enumerable: true, configurable: true }); Object.defineProperty(Reputation, "Data", { get: function () { return ArcReputation.Data; }, enumerable: true, configurable: true }); Object.defineProperty(Reputation, "Code", { get: function () { return ArcReputation.Code; }, enumerable: true, configurable: true }); Object.defineProperty(Reputation, "Logs", { get: function () { return ArcReputation.Logs; }, enumerable: true, configurable: true }); return Reputation; }(React.Component)); exports.Reputation = Reputation; exports.default = Reputation; //# sourceMappingURL=Reputation.js.map