diff --git a/README.md b/README.md index b87cb00..a6c0729 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,20 @@ -# Getting Started with Create React App +[![banner](docs/assets/banner.png)](https://bosonprotocol.io) -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +

Boson Protocol Widgets

-## Available Scripts +## Getting started -In the project directory, you can run: +- How tos & guides: + - [Redemption Widget](./docs/redemption-widget.md) + - Finance Widget +- [Local development](docs/local-development.md) -### `npm start` +## Contributing -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. +We welcome contributions! Until now, Boson Protocol has been largely worked on by a small dedicated team. However, the ultimate goal is for all of the Boson Protocol repositories to be fully owned by the community and contributors. Issues, pull requests, suggestions, and any sort of involvement are more than welcome. -The page will reload if you make edits.\ -You will also see any lint errors in the console. +Questions and feedback are always welcome, we will use them to improve our offering. -### `npm test` +All PRs must pass all tests before being merged. -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. - -### `npm run build` - -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `npm run eject` - -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** - -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). +By being in this community, you agree to the [Code of Conduct](/docs/code-of-conduct.md). Take a look at it, if you haven't already. diff --git a/docs/assets/banner.png b/docs/assets/banner.png new file mode 100644 index 0000000..2a3ef41 Binary files /dev/null and b/docs/assets/banner.png differ diff --git a/docs/assets/redemption-widget/1-wallet-connection.png b/docs/assets/redemption-widget/1-wallet-connection.png new file mode 100644 index 0000000..a703b99 Binary files /dev/null and b/docs/assets/redemption-widget/1-wallet-connection.png differ diff --git a/docs/assets/redemption-widget/2-redemption-overview.png b/docs/assets/redemption-widget/2-redemption-overview.png new file mode 100644 index 0000000..88a5e8a Binary files /dev/null and b/docs/assets/redemption-widget/2-redemption-overview.png differ diff --git a/docs/assets/redemption-widget/3-select-exchange-filtered.png b/docs/assets/redemption-widget/3-select-exchange-filtered.png new file mode 100644 index 0000000..663192e Binary files /dev/null and b/docs/assets/redemption-widget/3-select-exchange-filtered.png differ diff --git a/docs/assets/redemption-widget/3-select-exchange-redeemed.png b/docs/assets/redemption-widget/3-select-exchange-redeemed.png new file mode 100644 index 0000000..f55726c Binary files /dev/null and b/docs/assets/redemption-widget/3-select-exchange-redeemed.png differ diff --git a/docs/assets/redemption-widget/3-select-exchange.png b/docs/assets/redemption-widget/3-select-exchange.png new file mode 100644 index 0000000..2d63bff Binary files /dev/null and b/docs/assets/redemption-widget/3-select-exchange.png differ diff --git a/docs/assets/redemption-widget/4-exchange-card-2.png b/docs/assets/redemption-widget/4-exchange-card-2.png new file mode 100644 index 0000000..49df531 Binary files /dev/null and b/docs/assets/redemption-widget/4-exchange-card-2.png differ diff --git a/docs/assets/redemption-widget/4-exchange-card-redeemed.png b/docs/assets/redemption-widget/4-exchange-card-redeemed.png new file mode 100644 index 0000000..e07e9f9 Binary files /dev/null and b/docs/assets/redemption-widget/4-exchange-card-redeemed.png differ diff --git a/docs/assets/redemption-widget/4-exchange-card.png b/docs/assets/redemption-widget/4-exchange-card.png new file mode 100644 index 0000000..49c291f Binary files /dev/null and b/docs/assets/redemption-widget/4-exchange-card.png differ diff --git a/docs/assets/redemption-widget/5-cancel-form.png b/docs/assets/redemption-widget/5-cancel-form.png new file mode 100644 index 0000000..6457b89 Binary files /dev/null and b/docs/assets/redemption-widget/5-cancel-form.png differ diff --git a/docs/assets/redemption-widget/5-redeem-form.png b/docs/assets/redemption-widget/5-redeem-form.png new file mode 100644 index 0000000..16c797d Binary files /dev/null and b/docs/assets/redemption-widget/5-redeem-form.png differ diff --git a/docs/assets/redemption-widget/6-redeem-confirmation-backend-interrupted.jpg b/docs/assets/redemption-widget/6-redeem-confirmation-backend-interrupted.jpg new file mode 100644 index 0000000..93d73c7 Binary files /dev/null and b/docs/assets/redemption-widget/6-redeem-confirmation-backend-interrupted.jpg differ diff --git a/docs/assets/redemption-widget/6-redeem-confirmation-backend-resume.jpg b/docs/assets/redemption-widget/6-redeem-confirmation-backend-resume.jpg new file mode 100644 index 0000000..445f2b1 Binary files /dev/null and b/docs/assets/redemption-widget/6-redeem-confirmation-backend-resume.jpg differ diff --git a/docs/assets/redemption-widget/6-redeem-confirmation-backend.jpg b/docs/assets/redemption-widget/6-redeem-confirmation-backend.jpg new file mode 100644 index 0000000..466615c Binary files /dev/null and b/docs/assets/redemption-widget/6-redeem-confirmation-backend.jpg differ diff --git a/docs/assets/redemption-widget/6-redeem-confirmation.png b/docs/assets/redemption-widget/6-redeem-confirmation.png new file mode 100644 index 0000000..bbbe5e8 Binary files /dev/null and b/docs/assets/redemption-widget/6-redeem-confirmation.png differ diff --git a/docs/assets/redemption-widget/7-congratulations-2.jpg b/docs/assets/redemption-widget/7-congratulations-2.jpg new file mode 100644 index 0000000..5e6ca41 Binary files /dev/null and b/docs/assets/redemption-widget/7-congratulations-2.jpg differ diff --git a/docs/assets/redemption-widget/7-congratulations.png b/docs/assets/redemption-widget/7-congratulations.png new file mode 100644 index 0000000..0208b28 Binary files /dev/null and b/docs/assets/redemption-widget/7-congratulations.png differ diff --git a/docs/assets/redemption-widget/Redemption Widget - Marketplace Cancellation Flow.jpg b/docs/assets/redemption-widget/Redemption Widget - Marketplace Cancellation Flow.jpg new file mode 100644 index 0000000..14c8dcb Binary files /dev/null and b/docs/assets/redemption-widget/Redemption Widget - Marketplace Cancellation Flow.jpg differ diff --git a/docs/assets/redemption-widget/Redemption Widget - Marketplace Redemption Flow.jpg b/docs/assets/redemption-widget/Redemption Widget - Marketplace Redemption Flow.jpg new file mode 100644 index 0000000..e198f9f Binary files /dev/null and b/docs/assets/redemption-widget/Redemption Widget - Marketplace Redemption Flow.jpg differ diff --git a/docs/assets/redemption-widget/Redemption Widget - Raise a Dispute.jpg b/docs/assets/redemption-widget/Redemption Widget - Raise a Dispute.jpg new file mode 100644 index 0000000..9a5b7c3 Binary files /dev/null and b/docs/assets/redemption-widget/Redemption Widget - Raise a Dispute.jpg differ diff --git a/docs/assets/redemption-widget/Redemption Widget - Redemption Widget Flow with Callbacks (interrupted).jpg b/docs/assets/redemption-widget/Redemption Widget - Redemption Widget Flow with Callbacks (interrupted).jpg new file mode 100644 index 0000000..ff63ddf Binary files /dev/null and b/docs/assets/redemption-widget/Redemption Widget - Redemption Widget Flow with Callbacks (interrupted).jpg differ diff --git a/docs/assets/redemption-widget/Redemption Widget - Redemption Widget Flow with callbacks (continuous).jpg b/docs/assets/redemption-widget/Redemption Widget - Redemption Widget Flow with callbacks (continuous).jpg new file mode 100644 index 0000000..fea9bc4 Binary files /dev/null and b/docs/assets/redemption-widget/Redemption Widget - Redemption Widget Flow with callbacks (continuous).jpg differ diff --git a/docs/assets/redemption-widget/default-redemption-flow.png b/docs/assets/redemption-widget/default-redemption-flow.png new file mode 100644 index 0000000..0fb1c48 Binary files /dev/null and b/docs/assets/redemption-widget/default-redemption-flow.png differ diff --git a/docs/assets/redemption-widget/redeem.png b/docs/assets/redemption-widget/redeem.png new file mode 100644 index 0000000..c2c1b8f Binary files /dev/null and b/docs/assets/redemption-widget/redeem.png differ diff --git a/docs/assets/redemption-widget/redemption_widget_1.png b/docs/assets/redemption-widget/redemption_widget_1.png new file mode 100644 index 0000000..d092a6c Binary files /dev/null and b/docs/assets/redemption-widget/redemption_widget_1.png differ diff --git a/docs/assets/redemption-widget/redemption_widget_2.png b/docs/assets/redemption-widget/redemption_widget_2.png new file mode 100644 index 0000000..738b342 Binary files /dev/null and b/docs/assets/redemption-widget/redemption_widget_2.png differ diff --git a/docs/assets/redemption-widget/show-widget.png b/docs/assets/redemption-widget/show-widget.png new file mode 100644 index 0000000..0977745 Binary files /dev/null and b/docs/assets/redemption-widget/show-widget.png differ diff --git a/docs/boson-environments.md b/docs/boson-environments.md new file mode 100644 index 0000000..c54aa27 --- /dev/null +++ b/docs/boson-environments.md @@ -0,0 +1,87 @@ +[![banner](./assets/banner.png)](https://bosonprotocol.io) + +< [Boson Protocol Widgets](../README.md) + +## Boson Protocol Environment + +Boson Protocol is deployed onto 3 public **environments**, to be used in different contexts, for different reasons and probably by different users: + - ***testing*** is a development environment, very unstable by nature. Unless you're developing on Boson Protocol Components, you shouldn't use this environment. + - ***staging*** is a validation environment, on testnet blockchain, specifically designed to test and discover the Boson Protocol Components without being on a real blockchain. + - ***production*** is the production environment. Everything processed on this environment is **FOR REAL**. + +In addition, it's possible to deploy your own environment on your local machine. We call it the ***local*** environment. + +## Boson Protocol Configurations + +Each environment (except ***local***) is currently deployed on several configurations, corresponding to different blockchains. + +The dApps (Marketplace and Dispute Resolution Center) and widgets are able to switch between configurations of the same environment. + +The following table recaps all configurations, per environment + + + + + + + +
Environment
production + + + + +
ConfigurationBlockchainSubgraph
production-137-0 Polygonhttps://api.thegraph.com/subgraphs/name/bosonprotocol/polygon
production-1-0 Ethereum Mainnethttps://api.thegraph.com/subgraphs/name/bosonprotocol/ethereum
+ + + + +
dApps
Marketplacehttps://bosonapp.io
Dispute Resolution Centerhttps://disputes.bosonprotocol.io
+ + + +
Widgets
Redemptionhttps://widgets.bosonprotocol.io/#/redeem
Financehttps://widgets.bosonprotocol.io/#/finance
+
staging + + + + +
ConfigurationBlockchainSubgraph
staging-80001-0 Polygon Mumbai (testnet)https://api.thegraph.com/subgraphs/name/bosonprotocol/mumbai-staging
staging-5-0 Ethereum Goerli (testnet)https://api.thegraph.com/subgraphs/name/bosonprotocol/goerli-staging
+ + + + +
dApps
Marketplacehttps://interface-staging.on.fleek.co
Dispute Resolution Centerhttps://drcenter-staging.on.fleek.co/
+ + + +
Widgets
Redemptionhttps://widgets-staging.on.fleek.co/#/redeem
Financehttps://widgets-staging.on.fleek.co/#/finance
+
testing + + + + +
ConfigurationBlockchainSubgraph
testing-80001-0Polygon Mumbai (testnet)https://api.thegraph.com/subgraphs/name/bosonprotocol/mumbai-testing
testing-5-0 Ethereum Goerli (testnet)https://api.thegraph.com/subgraphs/name/bosonprotocol/goerli-testing
+ + + + +
dApps
Marketplacehttps://interface-test.on.fleek.co
Dispute Resolution Centerhttps://drcenter-test.on.fleek.co/
+ + + +
Widgets
Redemptionhttps://widgets-test.on.fleek.co/#/redeem
Financehttps://widgets-test.on.fleek.co/#/finance
+
local + + + +
ConfigurationBlockchainSubgraph
local-31337-0 local (testnet)http://localhost:8000/subgraphs/name/boson/corecomponents/graphql
+ + + + +
dApps
Marketplacehttp://localhost:3333
Dispute Resolution Centerhttp://localhost:3333
+ + + +
Widgets
Redemptionhttp://localhost:3000/#/redeem
Financehttp://localhost:3000/#/finance
+
diff --git a/docs/code-of-conduct.md b/docs/code-of-conduct.md new file mode 100644 index 0000000..797c412 --- /dev/null +++ b/docs/code-of-conduct.md @@ -0,0 +1,133 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +reports@bosonprotocol.io. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available +at [https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations + diff --git a/docs/local-development.md b/docs/local-development.md new file mode 100644 index 0000000..61f8e72 --- /dev/null +++ b/docs/local-development.md @@ -0,0 +1,43 @@ +[Boson Widgets docs](../README.md) + +# Local development + +> The following is targeting developers who want to set up this repository locally to contribute, test or just play around. + +## Contents + +- [Local development](#local-development) + - [Contents](#contents) + - [Prerequisites](#prerequisites) + - [Local setup](#local-setup) + - [Building](#building) + - [Running locally](#running-locally) + +## Prerequisites + +- Node.js 16.X +- npm 8.X + +## Local setup + +```bash +# checkout repo +git clone https://github.com/bosonprotocol/widgets.git + +# install deps +cd widgets +npm ci +``` + +## Building + +```bash +npm run build +``` + +## Running locally + +```bash +npm run dev +``` + diff --git a/docs/redemption-widget.md b/docs/redemption-widget.md new file mode 100644 index 0000000..65cba32 --- /dev/null +++ b/docs/redemption-widget.md @@ -0,0 +1,135 @@ +[![banner](./assets/banner.png)](https://bosonprotocol.io) + +< [Boson Protocol Widgets](../README.md) + +# The Redemption Widget + +## Redeeming rNFTs using the Boson Widget + +With the release of the Boson Redemption Widget, Sellers can now offer redemption of their rNFTs on their own domains. + +Sellers can chose to sell their rNFTs everywhere in the metaverse, in game, on NFT marketplaces, or from the Boson dApp whilst bringing users back to their own domain to redeem their NFTs. + +The Boson Redemption Widget allows Sellers to simply embed, via a few lines of code, redemption functionality of their rNFTs into an existing website. + +![Redemption Widget steps](./assets/redemption-widget/redemption_widget_1.png) + + +To integrate the Boson Redemption Widget, all a seller needs to do is: + + 1. Add the following ` +``` + + 2. The Seller then needs to create a button with the fragment identifier *id="boson-redeem"*. When clicked, the redeem modal will popup on the Seller's website. +``` + +``` + +The ```data-config-id``` parameter specifies the Boson Configuration addressed by the widget (here ***production-137-0*** is the production configuration deployed on the Polygon blockchain). See [Boson Environment](./boson-environments.md) to get more details. + +![Redemption Widget Items View](./assets/redemption-widget/redemption_widget_2.png) + +## Using the Boson Redemption Button + +As a seller you can also choose to use the Boson branded "Redeem" Button on your website, if you would like to do this, all you need to do is: + + 1. Add the below 2 lines of code in HTML `` section: +``` + + ... + + + +``` + +2. Add the below class name to the "boson-redeem" button: +``` + +``` + +![Boson Redeem Button](./assets/redemption-widget/redeem.png) + + + +### Redeeming specific rNFTs + +#### A specific rNFT + +The Boson Widget's default behaviour is to show a buyer all of their redeemable vouchers. However, the widget can be configured to direct a buyer to a given rNFT for redemption, this enables different user flows. This the way that the Widget is used on [the Boson dApp](https://bosonapp.io/). + +A Seller can specify which exchange is going to be redeemed by the widget, by adding a *data-exchange-id* tag to the "boson-redeem" button, specifying the exchangeId of a given exchange: +``` + +``` + +You can find an example HTML file which embeds the widgets on the the widgets subdomain : https://widgets.bosonprotocol.io/example.html + +#### rNFTs for a/some specific seller(s) + +The widget can also be configured to show only the rNFTs emitted by some specific Boson Seller Accounts (typically the seller account the redemption site is referring to). + +To add a Seller filter to the redemption widget, add a *data-seller-ids* tag to the "boson-redeem" button, specifying the list of Boson Seller accounts you're addressing to: +``` + +``` + +### Integrating the Redemption Widget as an iFrame + +Instead of using the Redeem Button as shown above, the redemption widget can be embedded in any web page using an iFrame HTML tag. + +For instance: +``` + +``` + +In which case the page: +- does not need to include any specific line (like the ```