1.2.11 • Published 3 years ago
oneshop.web v1.2.11
ONESHOP WEB SDK
Web framework for accessing Oneshop API conveniently.
The Oneshop Web library provides convenient access to Oneshop Web APIs.
Documentation
See the Oneshop-web
API docs for JS/ReactJS.
Guildlines
Create shop
Setup custom theme
Develop your own theme
Installation
Option 1. For framworks like React JS, Vue Js or Angular JS.
Install with yarn
:
yarn add oneshop.web
OR with npm
:
npm install --save oneshop.web
Option 2. Develop without using frameworks
See the demo folder in this repository. Start an Express server and set the proxy target to your web shop's domain.
- install node modules before you start the server.
cd ~/demo/non-framework
npm i
- Replace the Oneshop's default theme domain with yours.
- Edit your source files at
src
folder, you are ready to develop your website now!🎉
Usage
ReactJS
import React from 'react';
import Oneshop from 'oneshop.web';
const OS = new Oneshop();
function App(){
// get article hooks and init articles = [];
const {articles, setArticles} = useState([]);
// get articles
OS.article.get().then(setArticles).catch(alert);
return (
<div className="articles">
{articles.map(a => (
<div id={a.id}>
{a.sections.map((s, section_idx) => (
<div id={`section-${a.id}-${section_idx}`} className="section">
<img src={`${s.media[0].url}`}>
<h3>{s.title}</h3>
<p>{s.description}<p>
</div>
))}
</div>
))}
</div>
);
}
Without frameworks
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script id="oneshop-web" src="https://cdn.oneshop.cloud/oneshop-sdk-min.js"></script>
</head>
<body>
<div id="articles"></div>
<script>
// create OS instance
let OS = new Oneshop.default();
// IIFE to get article
(async () => {
// get articles
let articles = await OS.article.get();
// get element
let articleDiv = document.getElementById('articles');
// get view
articleDiv.innerHTML = articles.map(a => `
<div>
${a.sections[0].media.length > 0 ? `<img src="${a.sections[0].media[0].url}" width="300" height="auto" />` : ""}
<h5>${a.sections[0].title}</h5>
<p>${a.sections[0].description}</p>
</div>
`);
})();
</script>
</body>
</html>
Equiry?
Developers are eligible to request a referral code from us to use the service for free!
Please email to: support@oneshop.team
for details 🎉
1.2.11
3 years ago
1.2.1
3 years ago
1.2.0
3 years ago
1.1.9
3 years ago
1.1.8
3 years ago
1.1.7
4 years ago
1.1.6
4 years ago
1.1.5
4 years ago
1.1.4
4 years ago
1.1.3
4 years ago
1.1.2
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
0.0.0
4 years ago