test-react-defi-widget
Version:
Ethereum Defi widget for React apps
115 lines (99 loc) • 2.86 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
var slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
var AuthenticationContext = React.createContext();
var AuthenticationContextProvider = function AuthenticationContextProvider(props) {
var _React$useState = React.useState("hello"),
_React$useState2 = slicedToArray(_React$useState, 2),
test = _React$useState2[0],
setTest = _React$useState2[1];
return React.createElement(
AuthenticationContext.Provider,
null,
props.children
);
};
var ContextProviders = function ContextProviders(_ref) {
var children = _ref.children;
return React.createElement(
AuthenticationContextProvider,
null,
children
);
};
var ConnectedWidget = function ConnectedWidget(props) {
var cognitoRegion = props.cognitoRegion,
cognitoUserPoolId = props.cognitoUserPoolId,
cognitoIdentityPoolId = props.cognitoIdentityPoolId,
cognitoAppClientId = props.cognitoAppClientId,
apiBaseUrl = props.apiBaseUrl;
/*
Amplify.configure({
Auth: {
mandatorySignIn: true,
region: cognitoRegion,
userPoolId: cognitoUserPoolId,
userPoolWebClientId: cognitoAppClientId,
identityPoolId: cognitoIdentityPoolId,
},
API: {
endpoints: [
{
name: "API",
endpoint: `${apiBaseUrl}`
}
]
}
})
*/
return React.createElement(
ContextProviders,
null,
React.createElement(
'h1',
null,
'WIDGET'
)
);
};
ConnectedWidget.propTypes = {
cognitoRegion: PropTypes.string.isRequired,
cognitoUserPoolId: PropTypes.string.isRequired,
cognitoIdentityPoolId: PropTypes.string.isRequired,
cognitoAppClientId: PropTypes.string.isRequired,
apiBaseUrl: PropTypes.string.isRequired
};
export { ConnectedWidget as Widget };
//# sourceMappingURL=index.es.js.map