├── .editorconfig ├── .gitignore ├── LICENSE ├── README.md ├── Shoppable_Campaign.png ├── babel.config.js ├── example.env ├── package.json ├── public ├── favicon.png └── index.html ├── src ├── App.vue ├── Info.vue ├── assets │ ├── Boilerplatedemo.png │ ├── Shoppable_Campaign.png │ ├── boilerplate.jpg │ ├── logo.png │ └── slackButton.png ├── main.js ├── router │ └── index.js ├── styles │ └── index.scss └── views │ ├── Cart.vue │ ├── CartItem.vue │ ├── CategoryFilter.vue │ ├── Checkout.vue │ ├── Confirmation.vue │ ├── PageNotFound.vue │ ├── ProductItem.vue │ └── ProductLanding.vue ├── vue.config.js └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | end_of_line = lf 5 | trim_trailing_whitespace = true 6 | insert_final_newline = true 7 | max_line_length = 200 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | 15 | # Editor directories and files 16 | .idea 17 | .vscode 18 | *.suo 19 | *.ntvs* 20 | *.njsproj 21 | *.sln 22 | *.sw? 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2020, Chec|Commerce.js 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Commerce.js Vue Boilerplate Header](https://github.com/chec/commercejs-vuejs-boilerplate/blob/master/src/assets/boilerplate.jpg) 2 | 3 | ## Introduction 4 | 5 | This boilerplate was developed to help developers build quick eCommerce sites in the Commerce.js ecosystem. Included is a complete, unstyled, product listing, cart, and checkout workflow to aid in fast and easy development using the Vue.js framework. 6 | 7 | ![](https://github.com/chec/commercejs-vuejs-boilerplate/blob/master/src/assets/Boilerplatedemo.png) 8 | 9 | ## Features 10 | 11 | - Listing page view for your products. 12 | - A complete cart that calculates totals and allows for editing and removing products. 13 | - Fully featured checkout with Shipping and Tax calculations. 14 | - Thank you page template. 15 | - 404 page template 16 | 17 | ## Installation 18 | 19 | ### Download 20 | 21 | Clone the git repo into the folder of your choice - `git clone https://github.com/chec/commercejs-vuejs-boilerplate.git` 22 | 23 | Alternatively, you can [download](https://github.com//chec/commercejs-vuejs-boilerplate/archive/master.zip) the project as a zip file to your computer. 24 | 25 | ### Project setup 26 | 27 | Simply run `npm install` or `yarn install` if you use [Yarn Package Manager](https://yarnpkg.com/) from the root of your project folder. This will install all the necessary packages required to run the boilerplate. 28 | 29 | ### Copy example env and add Chec credentials 30 | 31 | This boilerplate ships with an example.env file that you will need to copy and fill with your Commerce.js credentials. 32 | 33 | First create a copy of the example.env file named .env in the root of your project. You can do this by running cp example.env .env in the root folder. The .env will look something like this: 34 | 35 | ``` 36 | NODE_ENV=local 37 | VUE_APP_CHEC_PUBLIC_KEY={YOUR_API_KEY} 38 | VUE_APP_CHEC_API_URL=https://api.chec.io` 39 | ``` 40 | 41 | Add in your Commerce.js public API key which can be found in the developer's settings of the [dashboard](https://dashboard.chec.io/settings/developer). 42 | 43 | ## Working with the boilerplate 44 | 45 | ### Compile and hot-reload for development 46 | 47 | To aid in building your site, this boilerplate ships with a development environment which supports hot-reload on save. Run `npm run serve` or `yarn serve` from the root of the project. After it has compiled, you will be able to view the boilerplate in your browser by visiting `http://localhost:8080/#/`. 48 | 49 | 50 | ### Compiles and minifies for production 51 | 52 | When you are ready to ship your project, simply run `npm run build` or `yarn build` from the root of your project. This will create a production ready version of your project. 53 | 54 | 55 | ### Lints and fixes files 56 | 57 | `npm run lint` or `yarn lint` to run the linter. You can configure the linting rules via the `eslintConfig` field in the `package.json` file. 58 | 59 | See the [ESLint documentation](https://eslint.org/docs/user-guide/configuring) for further detail. 60 | 61 | 62 | ### Customize configuration 63 | See [Configuration Reference](https://cli.vuejs.org/config/). 64 | 65 | 66 | ### Whats next? 67 | 68 | At this point you should have the project fully up and running ready for you to add your theme or custom integrations. We look forward to seeing what you come up with! 69 | 70 | ## Additional Resources 71 | 72 | ### Join us on Slack 73 | 74 | Join us on Slack with other eCommerce developers and designers. 75 | 76 | [![Join Us on Slack](https://github.com/chec/commercejs-vuejs-boilerplate/blob/master/src/assets/slackButton.png)](http://slack.commercejs.com) 77 | 78 | 79 | ### Documentation 80 | [Commerce.js SDK Docs](https://commercejs.com/docs/). 81 | [Commerce.js API Docs](https://commercejs.com/docs/api/#introduction). 82 | 83 | ### Examples 84 | [Styled boilerplate demo](https://shoppable-campaign-demo.netlify.app/#/) 85 | 86 | ## ⚠️ Note 87 | 88 | ### This repository is no longer maintained 89 | However, we will accept issue reports and contributions for this repository. See the [contribute to the commerce community](https://commercejs.com/docs/community/contribute) page for more information on how to contribute to our open source projects. For update-to-date APIs, please check the latest version of the [API documentation](https://commercejs.com/docs/api/). 90 | -------------------------------------------------------------------------------- /Shoppable_Campaign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chec/commercejs-vuejs-boilerplate/cd3b8f630f48291252ba85015b8cad1b17a47ffe/Shoppable_Campaign.png -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset', 4 | ], 5 | }; 6 | -------------------------------------------------------------------------------- /example.env: -------------------------------------------------------------------------------- 1 | NODE_ENV=local 2 | VUE_APP_CHEC_PUBLIC_KEY= 3 | VUE_APP_CHEC_API_URL=https://api.chec.io -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "commerce-js-boilerplate", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "@chec/commerce.js": "^2.0.1", 12 | "core-js": "^3.6.4", 13 | "jquery": "^3.5.1", 14 | "popper.js": "^1.16.1", 15 | "vue": "^2.6.11", 16 | "vue-router": "^3.1.6" 17 | }, 18 | "devDependencies": { 19 | "@vue/cli-plugin-babel": "~4.3.0", 20 | "@vue/cli-plugin-eslint": "~4.3.0", 21 | "@vue/cli-plugin-router": "~4.3.0", 22 | "@vue/cli-service": "~4.3.0", 23 | "@vue/eslint-config-airbnb": "^5.0.2", 24 | "babel-eslint": "^10.1.0", 25 | "eslint": "^6.7.2", 26 | "eslint-plugin-import": "^2.20.2", 27 | "eslint-plugin-vue": "^6.2.2", 28 | "node-sass": "^4.14.1", 29 | "sass-loader": "^8.0.2", 30 | "vue-template-compiler": "^2.6.11" 31 | }, 32 | "eslintConfig": { 33 | "root": true, 34 | "env": { 35 | "node": true 36 | }, 37 | "extends": [ 38 | "plugin:vue/essential", 39 | "@vue/airbnb" 40 | ], 41 | "parserOptions": { 42 | "parser": "babel-eslint" 43 | }, 44 | "rules": {} 45 | }, 46 | "browserslist": [ 47 | "> 1%", 48 | "last 2 versions", 49 | "not dead" 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chec/commercejs-vuejs-boilerplate/cd3b8f630f48291252ba85015b8cad1b17a47ffe/public/favicon.png -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | CommerceJs Boilerplate 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 21 | 169 | 172 | -------------------------------------------------------------------------------- /src/Info.vue: -------------------------------------------------------------------------------- 1 | 13 | 18 | 21 | -------------------------------------------------------------------------------- /src/assets/Boilerplatedemo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chec/commercejs-vuejs-boilerplate/cd3b8f630f48291252ba85015b8cad1b17a47ffe/src/assets/Boilerplatedemo.png -------------------------------------------------------------------------------- /src/assets/Shoppable_Campaign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chec/commercejs-vuejs-boilerplate/cd3b8f630f48291252ba85015b8cad1b17a47ffe/src/assets/Shoppable_Campaign.png -------------------------------------------------------------------------------- /src/assets/boilerplate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chec/commercejs-vuejs-boilerplate/cd3b8f630f48291252ba85015b8cad1b17a47ffe/src/assets/boilerplate.jpg -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chec/commercejs-vuejs-boilerplate/cd3b8f630f48291252ba85015b8cad1b17a47ffe/src/assets/logo.png -------------------------------------------------------------------------------- /src/assets/slackButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chec/commercejs-vuejs-boilerplate/cd3b8f630f48291252ba85015b8cad1b17a47ffe/src/assets/slackButton.png -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Commerce from '@chec/commerce.js'; 2 | 3 | import Vue from 'vue'; 4 | import App from './App.vue'; 5 | import Info from './Info.vue'; 6 | import router from './router'; 7 | 8 | Vue.config.productionTip = false; 9 | 10 | /** 11 | * Instantiates the Commercejs SDK. 12 | */ 13 | const commerce = (typeof process.env.VUE_APP_CHEC_PUBLIC_KEY !== 'undefined') 14 | ? new Commerce(process.env.VUE_APP_CHEC_PUBLIC_KEY, true) 15 | : null; 16 | 17 | Vue.mixin({ 18 | beforeCreate() { 19 | this.$commerce = commerce; 20 | }, 21 | }); 22 | 23 | new Vue({ 24 | router, 25 | render: (h) => h((commerce !== null) ? App : Info), 26 | }).$mount('#app'); 27 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import VueRouter from 'vue-router'; 3 | 4 | Vue.use(VueRouter); 5 | 6 | const routes = [ 7 | { 8 | path: '/', 9 | name: 'Products', 10 | component: () => import('../views/ProductLanding.vue'), 11 | }, 12 | { 13 | path: '/checkout', 14 | name: 'Checkout', 15 | component: () => import('../views/Checkout.vue'), 16 | }, 17 | { 18 | path: '/order-confirmation', 19 | name: 'Order Confirmation', 20 | component: () => import('../views/Confirmation.vue'), 21 | }, 22 | { 23 | path: '*', 24 | name: 'Page Not Found', 25 | component: () => import('../views/PageNotFound.vue'), 26 | }, 27 | ]; 28 | const router = new VueRouter({ 29 | routes, 30 | scrollBehavior() { 31 | return { x: 0, y: 0 }; 32 | }, 33 | }); 34 | 35 | export default router; 36 | -------------------------------------------------------------------------------- /src/styles/index.scss: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Muli:wght@400;600;700;900&display=swap'); 2 | 3 | body{ 4 | font-family: 'Muli'; 5 | } -------------------------------------------------------------------------------- /src/views/Cart.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 51 | 52 | 61 | -------------------------------------------------------------------------------- /src/views/CartItem.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 28 | 29 | 37 | -------------------------------------------------------------------------------- /src/views/CategoryFilter.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 37 | -------------------------------------------------------------------------------- /src/views/Checkout.vue: -------------------------------------------------------------------------------- 1 | 91 | 92 | 321 | -------------------------------------------------------------------------------- /src/views/Confirmation.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 22 | -------------------------------------------------------------------------------- /src/views/PageNotFound.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | -------------------------------------------------------------------------------- /src/views/ProductItem.vue: -------------------------------------------------------------------------------- 1 | 47 | 48 | 96 | 97 | 105 | -------------------------------------------------------------------------------- /src/views/ProductLanding.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 83 | 84 | 90 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | // module.exports = { 2 | 3 | // publicPath: '/', 4 | 5 | // css: { 6 | // loaderOptions: { 7 | // sass: { 8 | // prependData: 9 | // `@import "@/styles/_variables.scss"; 10 | // @import "@/styles/_styles.scss";`, 11 | // }, 12 | // }, 13 | // }, 14 | // }; 15 | --------------------------------------------------------------------------------