Repository navigation
Storefront vs Backoffice
Storefront (S*) and backoffice (B*) components look alike in code, but they run in different contexts and call
different Selldone APIs. This page explains what each family expects from the host app so components work the first
time.
Storefront (S*) |
Backoffice (B*) |
|
|---|---|---|
| Audience | Shop customers | Merchants, staff, vendors |
| Typical host | A Selldone Layout such as the Storefront | The Selldone dashboard or your own admin tool |
| SDK |
Storefront SDK: StorefrontSDK.Setup()
|
Backoffice SDK: BackofficeSDK.Setup()
|
| Globals used |
window.$storefront, window.XAPI
|
window.$backoffice, window.API
|
| Authentication | Customer token (cookie access_token by default) |
Merchant access token |
| Injected |
$shop (current shop), sometimes $product
|
$shop (the admin shop) in many components |
| Store getters (examples) |
getUser, getProductsComparison, getCoupons
|
getCurrentAdminShop, getCountries, getOrderSendingQue
|
Generic U* components work in both contexts. C* community components need the
Community SDK (window.$community).
-
Set up the Storefront SDK once at startup:
import { StorefrontSDK } from "@selldone/sdk-storefront"; StorefrontSDK.Setup(); // reads the shop name and API URLs from meta tags
-
Provide the current shop from your root component:
provide() { return { $shop: computed(() => this.shop) }; }
-
Use a Vuex store with the getters your components read (for example
getUser). The Storefront store is the reference implementation. -
Import and render components:
<s-shop-basket-items-list v-if="basket" :basket="basket" :items="basket.items" />
The Storefront already does all of this. If you start a new Layout, fork it or follow the Storefront wiki.
-
Set up the Backoffice SDK. Calls need a valid access token from the developer panel; see Access Token for the options:
import { BackofficeSDK } from "@selldone/sdk-backoffice"; BackofficeSDK.Setup(); // creates window.API and window.$backoffice
-
Provide
$shopwith the shop you manage, and a Vuex store if the component reads one. -
Import components by path, for example:
import BInventoryList from "@selldone/components-vue/backoffice/inventory/list/BInventoryList.vue";
Backoffice components call dashboard endpoints through window.API (more than 200 files do), so they only work
against a Selldone account with the right permissions. The dashboard API is rate limited; see the
Backoffice SDK README and
wiki.
- Building a shop experience for customers? Use
S*andU*components with the Storefront SDK. - Building a custom dashboard, an integration screen or an internal tool? Use
B*andU*components with the Backoffice SDK. - Need only generic widgets (prices, date pickers, maps, charts)? Use
U*components; they have the fewest dependencies.
Guides
- Getting Started
- Installation and Registration
- Component Families
- Storefront vs Backoffice
- Theming and Styles
- Directives and Services
- FAQ
Community
Ecosystem
Links