diff --git a/.github/workflows/conventional-pr-name.yml b/.github/workflows/conventional-pr-name.yml index 465216619..a52e7a2fd 100644 --- a/.github/workflows/conventional-pr-name.yml +++ b/.github/workflows/conventional-pr-name.yml @@ -12,14 +12,13 @@ jobs: name: Validate PR Title (conventional-commit) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - + - uses: actions/checkout@v3 - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: "16" - name: Install Dependencies - run: yarn + run: rm package.json && npm i @commitlint/config-conventional - - uses: JulienKode/pull-request-name-linter-action@v0.2.0 + - uses: JulienKode/pull-request-name-linter-action@v0.5.0 diff --git a/.github/workflows/deploy-vue-storefront-cloud.yml b/.github/workflows/deploy-vue-storefront-cloud.yml index d98374dbf..014cedd41 100644 --- a/.github/workflows/deploy-vue-storefront-cloud.yml +++ b/.github/workflows/deploy-vue-storefront-cloud.yml @@ -8,15 +8,62 @@ on: - release/* jobs: + create-deployment: + runs-on: ubuntu-latest + outputs: + environment-name: ${{ steps.determine-environment.outputs.name }} + environment-code: ${{ steps.determine-environment.outputs.code }} + deployment_id: ${{ steps.deployment.outputs.deployment_id }} + steps: + - name: Determine environment name + id: determine-environment + shell: bash + run: | + REF=${{ github.ref }} + + if [ $REF = 'refs/heads/main' ]; then + ENVNAME='production' + ENVCODE='demo-magento2' + + elif [ $REF = 'refs/heads/develop' ]; then + ENVNAME='dev' + ENVCODE='demo-magento2-dev' + + elif [[ $REF = refs/heads/release* ]]; then + ENVNAME='canary' + ENVCODE='demo-magento2-canary' + + elif [ $REF = 'refs/heads/enterprise' ]; then + ENVNAME='enterprise' + ENVCODE='demo-magento2-enterprise' + + else + echo 'unrecognized branch name' + exit 1 + fi + + echo ::set-output name=name::$ENVNAME + echo ::set-output name=code::$ENVCODE + + - name: Create GitHub deployment + id: deployment + uses: chrnorm/deployment-action@v2 + with: + token: ${{ secrets.DEPLOYMENT_PERSONAL_ACCESS_TOKEN }} + environment: ${{ steps.determine-environment.outputs.name }} + initial-status: in_progress build: + needs: create-deployment runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v1 + - name: Setup node uses: actions/setup-node@v1 with: node-version: 16.x + - name: Build and publish docker image uses: elgohr/Publish-Docker-Github-Action@master with: @@ -53,11 +100,10 @@ jobs: VSF_REDIS_CACHE_INVALIDATE_KEY: magento2vsf2 VSF_REDIS_CACHE_INVALIDATE_URL: /cache-invalidate - VSF_RECAPTCHA_ENABLED: false - VSF_RECAPTCHA_HIDE_BADGE: false + VSF_RECAPTCHA_ENABLED: true VSF_RECAPTCHA_VERSION: 3 VSF_RECAPTCHA_SIZE: invisible - VSF_RECAPTCHA_MIN_SCORE: 0.5 + VSF_RECAPTCHA_MIN_SCORE: 1.0 VSF_RECAPTCHA_SITE_KEY: 6Ldce0EeAAAAAAGGtGWG-e-SygXiFub6PXHT5fKd VSF_RECAPTCHA_SECRET_KEY: ${{ secrets.RECAPTCHA_SECRET_KEY }} @@ -65,54 +111,33 @@ jobs: LAST_COMMIT: ${{ github.sha }} - deploy-main: + deploy: + needs: [create-deployment, build] uses: ./.github/workflows/deployment-template.yml - needs: build - if: github.ref == 'refs/heads/main' with: - github_environment_name: production - environment_code: demo-magento2 - target_url: https://demo-magento2.europe-west1.gcp.storefrontcloud.io + environment-code: ${{ needs.create-deployment.outputs.environment-code }} secrets: - cloud_username: ${{ secrets.CLOUD_USERNAME }} - cloud_password: ${{ secrets.CLOUD_PASSWORD }} - deployment_status_token: ${{ secrets.DEPLOYMENT_PERSONAL_ACCESS_TOKEN }} + cloud-username: ${{ secrets.CLOUD_USERNAME }} + cloud-password: ${{ secrets.CLOUD_PASSWORD }} - deploy-develop: - uses: ./.github/workflows/deployment-template.yml - needs: build - if: github.ref == 'refs/heads/develop' - with: - github_environment_name: dev - environment_code: demo-magento2-dev - target_url: https://demo-magento2-dev.europe-west1.gcp.storefrontcloud.io - secrets: - cloud_username: ${{ secrets.CLOUD_USERNAME }} - cloud_password: ${{ secrets.CLOUD_PASSWORD }} - deployment_status_token: ${{ secrets.DEPLOYMENT_PERSONAL_ACCESS_TOKEN }} - deploy-release: - uses: ./.github/workflows/deployment-template.yml - needs: build - if: startsWith(github.ref, 'refs/heads/release') - with: - github_environment_name: canary - environment_code: demo-magento2-canary - target_url: https://demo-magento2-canary.europe-west1.gcp.storefrontcloud.io - secrets: - cloud_username: ${{ secrets.CLOUD_USERNAME }} - cloud_password: ${{ secrets.CLOUD_PASSWORD }} - deployment_status_token: ${{ secrets.DEPLOYMENT_PERSONAL_ACCESS_TOKEN }} + finalize-deployment: + runs-on: ubuntu-latest + needs: [create-deployment, build, deploy] + if: always() + steps: + - name: Update deployment status (success) + if: ${{ !(contains(join(needs.*.result, ','), 'failure') || contains(join(needs.*.result, ','), 'cancelled')) }} + uses: chrnorm/deployment-status@v2 + with: + token: ${{ secrets.DEPLOYMENT_PERSONAL_ACCESS_TOKEN }} + deployment-id: ${{ needs.create-deployment.outputs.deployment_id }} + state: success - deploy-enterprise: - uses: ./.github/workflows/deployment-template.yml - needs: build - if: github.ref == 'refs/heads/enterprise' - with: - github_environment_name: enterprise - environment_code: demo-magento2-enterprise - target_url: https://demo-magento2-enterprise.europe-west1.gcp.storefrontcloud.io - secrets: - cloud_username: ${{ secrets.CLOUD_USERNAME }} - cloud_password: ${{ secrets.CLOUD_PASSWORD }} - deployment_status_token: ${{ secrets.DEPLOYMENT_PERSONAL_ACCESS_TOKEN }} + - name: Update deployment status (failure) + if: ${{ contains(join(needs.*.result, ','), 'failure') || contains(join(needs.*.result, ','), 'cancelled') }} + uses: chrnorm/deployment-status@v2 + with: + token: ${{ secrets.DEPLOYMENT_PERSONAL_ACCESS_TOKEN }} + deployment-id: ${{ needs.create-deployment.outputs.deployment_id }} + state: failure diff --git a/.github/workflows/deployment-template.yml b/.github/workflows/deployment-template.yml index 73bb98996..ded9778b4 100644 --- a/.github/workflows/deployment-template.yml +++ b/.github/workflows/deployment-template.yml @@ -2,42 +2,23 @@ on: workflow_call: inputs: - github_environment_name: + environment-code: required: true type: string - environment_code: - required: true - type: string - - target_url: - required: true - type: string secrets: - cloud_username: + cloud-username: required: true - cloud_password: + cloud-password: required: true - deployment_status_token: # can be ${{ github.token }} - required: true - jobs: deploy: runs-on: ubuntu-latest steps: - - uses: chrnorm/deployment-action@releases/v1 - name: Create GitHub deployment - id: deployment - with: - token: ${{ secrets.deployment_status_token }} - environment: ${{ inputs.github_environment_name }} - initial_status: in_progress - target_url: ${{ inputs.target_url }} - - name: Deploy on ${{ inputs.target_url }} - run: | - if curl -s -H 'X-User-Id: ${{ secrets.cloud_username }}' -H 'X-Api-Key: ${{ secrets.cloud_password }}' -H 'Content-Type: application/json' -X POST -d '{ - "code":"${{ inputs.environment_code }}", + - run: | + if curl -s -H 'X-User-Id: ${{ secrets.cloud-username }}' -H 'X-Api-Key: ${{ secrets.cloud-password }}' -H 'Content-Type: application/json' -X POST -d '{ + "code":"${{ inputs.environment-code }}", "region":"europe-west1.gcp", "frontContainerVersion":"${{ github.sha }}" }' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then @@ -47,23 +28,9 @@ jobs: exit 1 fi - - name: Update deployment status (success) - if: success() - uses: chrnorm/deployment-status@releases/v1 - with: - token: ${{ secrets.deployment_status_token }} - target_url: ${{ inputs.target_url }} - state: success - description: Congratulations! The deploy is done. - deployment_id: ${{ steps.deployment.outputs.deployment_id }} - - - name: Update deployment status (failure) - if: failure() - uses: chrnorm/deployment-status@releases/v1 - with: - token: ${{ secrets.deployment_status_token }} - target_url: ${{ inputs.target_url }} - description: Unfortunately, the instance hasn't been updated. - state: failure - deployment_id: ${{ steps.deployment.outputs.deployment_id }} - + # the above curl only *asks* for the container to be deployed + # we don't know when the newly built Docker image replaces the old one + # but it takes less than 5 minutes + - name: 'Wait for container deployed on VSF Cloud to come online' + run: 'sleep 300' + shell: 'bash' diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 15e5cefa1..02f658c81 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@v2 - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: "16" registry-url: "https://registry.npmjs.org/" diff --git a/.github/workflows/speedcurve.yml b/.github/workflows/speedcurve.yml index eaec33634..817edd7ca 100644 --- a/.github/workflows/speedcurve.yml +++ b/.github/workflows/speedcurve.yml @@ -8,10 +8,6 @@ jobs: if: github.event.deployment_status.state == 'success' && github.event.deployment.ref == 'refs/heads/develop' runs-on: ubuntu-latest steps: - - name: 'Wait for container deployed on VSF Cloud to come online' - run: 'sleep 300' - shell: 'bash' - - name: Shorten deployment commit SHA id: vars shell: bash diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1ed60d80..71f1323d2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,10 +25,9 @@ jobs: uses: actions/checkout@v2 - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: '16.13.0' - cache: 'yarn' - name: Install dependencies run: yarn install diff --git a/.vuestorefrontcloud/docker/Dockerfile b/.vuestorefrontcloud/docker/Dockerfile index 918540d3d..3d964fc86 100644 --- a/.vuestorefrontcloud/docker/Dockerfile +++ b/.vuestorefrontcloud/docker/Dockerfile @@ -62,7 +62,7 @@ ENV VSF_RECAPTCHA_VERSION=${VSF_RECAPTCHA_VERSION} ENV VSF_RECAPTCHA_SIZE=${VSF_RECAPTCHA_SIZE} ENV VSF_RECAPTCHA_MIN_SCORE=${VSF_RECAPTCHA_MIN_SCORE} ENV VSF_RECAPTCHA_SITE_KEY=${VSF_RECAPTCHA_SITE_KEY} -ENV VSF_RECAPTCHA_SECRET_KEY=${VSF_RECAPTCHA_SITE_KEY} +ENV VSF_RECAPTCHA_SECRET_KEY=${VSF_RECAPTCHA_SECRET_KEY} RUN npm config set @vsf-enterprise:registry=https://registrynpm.storefrontcloud.io diff --git a/.vuestorefrontcloud/docker/nuxt.config.additional.js b/.vuestorefrontcloud/docker/nuxt.config.additional.js index b5e52cd90..6fe2b8d3f 100755 --- a/.vuestorefrontcloud/docker/nuxt.config.additional.js +++ b/.vuestorefrontcloud/docker/nuxt.config.additional.js @@ -7,7 +7,7 @@ export default () => { ...baseDefaults, modules: [ ...baseDefaults.modules, - '@nuxtjs/sentry' + '@nuxtjs/sentry', ], sentry: { dsn: process.env.VSF_SENTRY_DSN, diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 8d0efcddc..dde7c0a95 100755 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -63,6 +63,18 @@ module.exports = { '@vuepress/active-header-links', '@vuepress/search', ], + + /** + * Ref: https://v1.vuepress.vuejs.org/config/#markdown + */ + markdown: { + extendMarkdown: md => { + md.use(require('markdown-it-video'), { + youtube: { width: 740, height: 416.25 }, // 16:9 ratio, where 740px is the width of the page content + }); + } + }, + themeConfig: { GTM_TAG, sidebarDepth: 0, @@ -91,14 +103,26 @@ module.exports = { ], }, { - title: 'Getting started', + title: 'Installation & Setup', collapsable: false, children: [ - ['/getting-started/installation', 'Installation'], - ['/getting-started/configure-magento', 'Configuring Magento'], - ['/getting-started/configure-integration', 'Configuring Vue Storefront'], + ['/installation-setup/installation', 'Installation'], + ['/installation-setup/configure-magento', 'Configuring Magento'], + ['/installation-setup/configure-integration', 'Configuring Vue Storefront'], ], }, + { + title: 'Getting started', + collapsable: false, + children: [ + ['/getting-started/introduction', 'Introduction'], + ['/getting-started/project-structure', 'Project structure'], + ['/getting-started/configuration', 'Configuration'], + ['/getting-started/layouts-and-routing', 'Layouts and Routing'], + ['/getting-started/theme', 'Theme'], + ['/getting-started/internationalization', 'Internationalization'] + ] + }, { title: 'Composition', collapsable: false, diff --git a/docs/.vuepress/styles/index.styl b/docs/.vuepress/styles/index.styl index 9cf26251a..99ab9ae94 100644 --- a/docs/.vuepress/styles/index.styl +++ b/docs/.vuepress/styles/index.styl @@ -26,7 +26,46 @@ a code { font-weight: bold; } -div.theme-default-content:not(.custom) { - max-width: 1024px; +q { + position: relative; + display: block; + margin: 30px 0; + padding: 40px 20px; + border-radius: 8px; } +@media (max-width: 959px) { + q { + margin: 20px 0; + padding: 40px 0; + } +} + +q::before, +q::after { + position: absolute; + font-size: 40px; + line-height: 1; + color: #9CA3AF; +} + + +q::before { + content: '❝'; + top: 5px; + left: 0; +} + +q::after { + content: '❞'; + bottom: -5px; + right: 0; +} + +q p { + margin: 0px; + font-size: 1.1rem; + font-weight: 500; + font-style: italic; + text-align: center; +} diff --git a/docs/assets/images/storefront-ui.webp b/docs/assets/images/storefront-ui.webp new file mode 100644 index 000000000..30e78c1f0 Binary files /dev/null and b/docs/assets/images/storefront-ui.webp differ diff --git a/docs/getting-started/configuration.md b/docs/getting-started/configuration.md new file mode 100644 index 000000000..f12b1f114 --- /dev/null +++ b/docs/getting-started/configuration.md @@ -0,0 +1,37 @@ +# Configuration + +Whenever starting a new project or jumping into an existing one, you should look into the configuration files first. They control almost every aspect of the application, including installed integrations. + +## Mandatory configuration files + +Every Vue Storefront project must contain two configuration files described below. They control both client and server parts of the application. + +### `nuxt.config.js` + +**The `nuxt.config.js` file is the starting point of every project.** It contains general configuration, including routes, global middlewares, internationalization, or build information. This file also registers modules and plugins to add or extend framework features. Because almost every Vue Storefront integration has a module or plugin, you can identify which integrations are used by looking at this file. + +You can learn more about this file and available configuration options on the [Nuxt configuration file](https://nuxtjs.org/docs/directory-structure/nuxt-config/) page. + +### `middleware.config.js` + +The `middleware.config.js` file is as essential as `nuxt.config.js`, but much simpler and likely smaller. It configures the Server Middleware used for communication with e-commerce platforms and contains sensitive credentials, custom endpoints, queries, etc. + +### `.env` + +The `.env` file contains environmental variables used in both `nuxt.config.js` and `middleware.config.js` files for configuration that differs per environment. New projects come with a `.env.example` that you can rename (or clone) to the `.env` file and configure. + +## Optional configuration files + +Your project might include some additional configuration files not described above. Let's walk through the most common ones. + +- [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) configures compiler used to strongly type the project using TypeScript language. It defines a list of files and directories to be included and excluded from analysis and compiling. + +- [`babel.config.js`](https://babeljs.io/docs/en/config-files) configures Babel compiler used to make the code backward compatible with older browsers and environments. + +- [`ecosystem.config.js`](https://pm2.keymetrics.io/docs/usage/application-declaration/) configures PM2 Process Management that runs and manages Node application. + +- [`jest.config.js`](https://jestjs.io/docs/configuration) configures Jest testing framework, used for writing and running unit tests. + +## What's next + +As the next step, we will learn about [Layouts and Routing](./layouts-and-routing.html) and show what routes come predefined in every Vue Storefront project and how to register custom ones. diff --git a/docs/getting-started/internationalization.md b/docs/getting-started/internationalization.md new file mode 100644 index 000000000..97a6638d5 --- /dev/null +++ b/docs/getting-started/internationalization.md @@ -0,0 +1,158 @@ +# Internationalization + +If you're building a shop for an international brand, you likely want it translated to different languages and using different currencies. In this document, you will learn how we're approaching internationalization in Vue Storefront and how to configure your application to use it. + +::: warning i18n is not multi-tenancy! +This document only explains how to make a single shop instance available for multiple countries. If you need to build a system for multiple tenants, we suggest creating an instance of Vue Storefront for each tenant and sharing common resources through an NPM package. +::: + +## How it works by default? + +By default, we are using the [`nuxt-i18n`](https://i18n.nuxtjs.org/) module for handling both translations and currencies. It's preinstalled in the [default theme](/getting-started/theme.html#what-s-makes-a-default-theme) and is configured for English and German translations out of the box. + +The `nuxt-i18n` module adds the `$t('key')` and `$n(number)` helpers to translate strings and format the currencies. + +You can find the translation keys in the `lang` directory of your project and configuration for currencies in `nuxt.config.js`. + +::: tip +Even though the module is included in the default theme, it's not required. You can [disable it](#configuring-modules-separately) and handle internationalization yourself. +::: + +To provide a unified way to configure internationalization across the application for different modules and integrations, we have introduced the `i18n` field in each module's configuration. It has the same format as the `nuxt-i18n` options. You can add any configuration there, and it will be propagated to all other Vue Storefront modules. + +All Vue Storefront integrations have the `useNuxtI18nConfig` property set to `true`. It means that they will use the same configuration as you provided for `nuxt-i18n` in the `i18n` field of your `nuxt.config.js`. + +```js +// nuxt.config.js + +export default { + buildModules: [ + [ + '@vue-storefront/{INTEGRATION}/nuxt', + { + // other comfiguration options + i18n: { + useNuxtI18nConfig: true, + }, + }, + ], + ], + i18n: { + locales: [ + { + code: 'en', + label: 'English', + file: 'en.js', + iso: 'en', + }, + { + code: 'de', + label: 'German', + file: 'de.js', + iso: 'de', + }, + ], + defaultLocale: 'en', + }, +}; +``` + +## Configuring modules separately + +You can provide your own i18n configuration for a specific module by setting `useNuxtI18nConfig` to `false`. + +```js +// nuxt.config.js + +export default { + [ + '@vue-storefront/{INTEGRATION}/nuxt', + { + i18n: { + useNuxtI18nConfig: false, + locales: [ + { + code: 'en', + label: 'English', + file: 'en.js', + iso: 'en', + }, + { + code: 'de', + label: 'German', + file: 'de.js', + iso: 'de', + }, + ], + defaultLocale: 'en' + } + } + ]; +} +``` + +## CDN and cookies + +The server's response cannot contain the `Set-Cookie` header to make CDNs cache the website correctly. + +To achieve that, we've made our own mechanism for handling cookies responsible for storing `locale`, `currency`, and `country`. This mechanism also handles language detection and redirecting to the proper locale. For this reason, `@nuxtjs/i18n` language detection is disabled by default. + +```js +// nuxt.config.js +export default { + i18n: { + detectBrowserLanguage: false, + }, +}; +``` + +If you don't want to redirect users, you can disable this mechanism, as described in the section below. + +## Disabling the auto-redirect mechanism + +The `@vue-storefront/nuxt` module includes an auto-redirect mechanism that performs a server-side redirect to different URLs based on the target locale. + +You can disable this by setting `autoRedirectByLocale` to `false` in the `i18n` configuration object. + +```js +// nuxt.config.js + +export default { + i18n: { + autoRedirectByLocale: false, + }, +}; +``` + +## Currency detection + +In addition to language detection, we also set currency based on locale. You can configure it in `nuxt.config.js` with the `vueI18n.numberFormats` property. + +For more configuration options of `numberFormats` entries, check the [Intl.NumberFormat()](https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/intl/numberformat) documentation. + +```js +// nuxt.config.js + +export default { + i18n: { + vueI18n: { + numberFormats: { + en: { + currency: { + style: 'currency', + currency: 'USD', + currencyDisplay: 'symbol', + }, + }, + // ...other locales + }, + }, + }, +}; +``` + +**Please note that only one currency can be set for each locale.** + +If this is a limitation for you, or if you don't want to have currencies tied to locales, you can disable this mechanism and provide your own. + +To disable it, set `autoChangeCookie.currency` to `false` as described in the section below. diff --git a/docs/getting-started/introduction.md b/docs/getting-started/introduction.md new file mode 100644 index 000000000..55386a17e --- /dev/null +++ b/docs/getting-started/introduction.md @@ -0,0 +1,49 @@ +# Introduction to Vue Storefront + +Without a proper understanding of the framework you're using, you might spend weeks or even months doing something that someone else has already done. That's why before we can dive deep into the project itself, we need to understand what powers it all under the hood. + +@[youtube](MCN1rRwuIGs) + +## It's all Nuxt.js + +We didn't want to reinvent the wheel and introduce yet another framework that solves the same issues as its predecessors, which took them years to mature. That's why... + + + +Vue Storefront is essentially a [Nuxt.js](https://nuxtjs.org/) project with some plugins and modules preinstalled, as well as a ready-to-use e-commerce theme. Nuxt.js handles most of the front-end work and [Server Side Rendering](https://nuxtjs.org/docs/concepts/server-side-rendering/), while Vue Storefront adds the e-commerce specific bits and integrations to various platforms. + + + +Some of the plugins and modules that come with the fresh installation were created by the Nuxt.js community, and others come from our core team specifically for Vue Storefront projects. + +The default theme mainly consists of components from the [Storefront UI](http://storefrontui.io/) — an e-commerce focused UI library maintained by the Vue Storefront team. + +We described plugins, modules, and the theme in more detail on the following pages. + +### But why? + +You might be wondering why we choose Nuxt.js as our foundation. After all, it wasn't created with e-commerce in mind. + +When you start using any new framework, you expect it to: + +* have **plugins that solve common issues**, such as analytics, SEO, internationalization, etc., +* be **versatile and flexible** enough to allow extending it and creating custom integrations, +* have **active and diverse community**, which answers questions, writes articles, and promotes the framework. + +Creating such an ecosystem from scratch takes years. But because we based Vue Storefront on Nuxt.js — the biggest Vue.js framework — it ticks all the boxes. Nuxt.js has a vast library of [ready-to-use modules](https://modules.nuxtjs.org/) and an active community of thousands of developers on the [Nuxt.js Discord server](https://discord.com/invite/ps2h6QT). It's also flexible enough to make it e-commerce ready with just a few plugins and modules. + + + +Combining general-purpose modules from Nuxt.js and e-commerce specific modules from Vue Storefront significantly shortens the time-to-market. It allows you to focus on what's specific to your project. + + + +## Start with Vue.js + +If you are new to the Vue.js ecosystem, the best place to start learning is the [Vue.js 2 documentation](https://v2.vuejs.org/). **In our documentation, we assume prior knowledge of Vue.js (with some exceptions)**. While we do our best to explain each topic in detail, a lack of this knowledge might cause you to get lost. + +We also encourage reading [Nuxt.js 2 documentation](https://nuxtjs.org/docs/). In most places, we don't assume this knowledge and add links to related documents, but having it will make you more confident and let you work faster and more efficiently. + +## What's next + +Now that you understand what Vue Storefront is, it's time to understand the [Project structure](./project-structure.html) and learn how to navigate it and which files do what. diff --git a/docs/getting-started/layouts-and-routing.md b/docs/getting-started/layouts-and-routing.md new file mode 100644 index 000000000..a4515ba4e --- /dev/null +++ b/docs/getting-started/layouts-and-routing.md @@ -0,0 +1,145 @@ +# Layouts and Routing + +Layouts and Routing in Vue Storefront are entirely powered by Nuxt.js. We will only give a brief overview of these features on this page, but you can learn more on the [Views](https://nuxtjs.org/docs/concepts/views/) page in the Nuxt.js documentation. + +## View hierarchy + +Every page consists of layers — some layers are shared between many routes, others are used in one specific route. We described each layer in detail in the sections below. + +### HTML document + +At the root of the hierarchy is the HTML document. By default, the framework provides one, but you can customize it by creating an `app.html` file in the root directory of your project. It has special tags used to insert parts of the documents, and by default, looks like this: + +```html + + + + {{ HEAD }} + + + {{ APP }} + + +``` + +### Layouts + +Nuxt.js automatically registers all `.vue` files inside of the `layouts` directory as layouts. Unless configured otherwise, pages use the `default.vue` component as their layout. Open the `layouts/default.vue` component to get the general idea of how the page looks like, what components it imports and what data it loads within the `setup` function. + +Layout components include a special `` component that displays the page's content based on the current URL. Those pages are Vue.js components, too, explained in the next section. + +There is also an `error.vue` layout — used when an error occurs. It doesn't use the `` component but receives the `error` prop, which you can use to get an error code or message. + +The convention is to use `lowercase` when naming components inside of the `layouts` directory, e.g., `blog.vue`. + +### Pages + +Nuxt.js automatically registers all `.vue` files inside the `pages` directory as application routes. For example, creating an `AboutUs.vue` component will create an `/aboutus` route. In the same way, creating this component inside a nested directory called `company` will create the `/company/aboutus` route. It's all thanks to the [File System Routing](https://nuxtjs.org/docs/2.x/features/file-system-routing/) feature available in Nuxt.js. In the sections below, we describe how to modify routes manually. + +Pages can define a custom [layout](https://nuxtjs.org/docs/directory-structure/pages#layout) property to change the default used for this view. + +The convention is to use `PascalCase` when naming components inside of the `pages` directory, e.g., `MyAccount.vue`. + +## Manually adding and modifying routes + +If you want to manually add your custom routes or modify some already provided, use the `extendRoutes` function in the `nuxt.config.js`. This function has two properties: + +* `routes` — an array of already registered routes. You can `push` or delete entries from it. +* `resolve` — helper function for resolving Vue.js components based on their paths in the project. + +For the sake of example, let's assume that we created a `pages/AboutUs.vue` component, but we want to use the `/company/about-us` route instead of auto-registered `/aboutus`. There are two approaches we could take. + +The first approach is to **delete existing route** and **register new route** with a different path. + +```javascript +// nuxt.config.js + +export default { + router: { + extendRoutes(routes, resolve) { + // Delete automatically registered route + routes.splice( + routes.findIndex(route => route.path === '/AboutUs'), + 1 + ); + + // Re-register the same component but with different path + routes.push({ + name: 'AboutUs', + path: '/company/about-us', + component: resolve(__dirname, 'pages/AboutUs.vue') + }); + } + } +}; +``` + +Alternatively, we can **modify the `path` property of the existing entry** like so: + +```javascript +// nuxt.config.js + +export default { + router: { + extendRoutes(routes, resolve) { + // Find route index + const index = routes.findIndex(route => route.path === '/AboutUs'); + + // Modify route path + routes[index].path = '/company/about-us'; + } + } +}; +``` + +## Changing base path + +There are cases when your store is served under a specific path, eg. `example.com/shop/`. To make Vue.js router aware of this, you need to update the configuration in the `nuxt.config.js`: + +```javascript +// nuxt.config.js + +export default { + router: { + base: "/shop/" + } +}; +``` + +Unfortunately not all links in your application will detect this. You can fix it, by wrap all relative links and paths to assets in `addBasePath` helper. + +```vue + + + +``` + +## Navigating between pages + +To navigate between pages within your application, use the [NuxtLink](https://nuxtjs.org/docs/features/nuxt-components/#the-nuxtlink-component) component, instead of the traditional `` tag. While you can use the `` tag for external links, using the `` for internal links will ensure that you make use of the Single-Page Navigation capabilities that Nuxt.js provides. + +Single-Page Navigation (SPA) provides many benefits, such as: + +* much faster and more responsive navigation compared to the traditional server navigation, +* framework is initialized only once, +* components shared between the pages are rendered only once (if they use the same layout), +* fewer requests and data sent over the network. + +## What's next + +Layouts and pages are one thing, but in the end, they must display components and styles. Otherwise, we would only serve blank pages. + +New projects come with a default [Theme](./theme.html), so the next step is to understand what makes it look like this. diff --git a/docs/getting-started/project-structure.md b/docs/getting-started/project-structure.md new file mode 100644 index 000000000..c9a109ca4 --- /dev/null +++ b/docs/getting-started/project-structure.md @@ -0,0 +1,45 @@ +# Project structure + +If you followed our [Installation](/installation-setup/installation.html) guide, you should have a Vue Storefront project with some Magento already integrated. This project has a bunch of directories, Vue components, and files, but what does what? + +In this section, you will learn how to navigate the Vue Storefront project and where to start developing. + +## Structure basics + +As described on the [Introduction to Vue Storefront](./introduction.html) page, Vue Storefront is just a Nuxt.js project under the hood. For this reason, our project structure inherits from Nuxt.js but has some additional files. + +To learn about it in-depth, you can refer to the [Directory Structure in Nuxt.js project](https://nuxtjs.org/docs/get-started/directory-structure/) document, but the gist of it is: + +* [**.nuxt**](https://nuxtjs.org/docs/2.x/directory-structure/nuxt) is a dynamically generated build directory. You should **not** manually modify it, nor synchronize it using version control like GIT. + +* [**assets**](https://nuxtjs.org/docs/2.x/directory-structure/assets) contains uncompiled assets such as your styles, images, or fonts. + +* [**components**](https://nuxtjs.org/docs/2.x/directory-structure/components) contains Vue.js components used on different pages or parts of your application. You can import these components from pages, layouts, and other components. + +* **composables** provides business logic that can be used in any place in the app. + +* **getters** are functions that help to get commonly used data. + +* **helpers** are utility functions that help resolve some common tasks like for example format currency + +* [**lang**](https://docs.vuestorefront.io/v2/getting-started/internationalization.html) contains translations for your application. Available locales are configured in the `nuxt.config.js` file. + +* [**layouts**](https://nuxtjs.org/docs/2.x/directory-structure/layouts) contains Vue.js components that act as a UI base for the whole application or specific pages. + +* [**middleware**](https://nuxtjs.org/docs/2.x/directory-structure/middleware) contains JavaScript files that contain custom functions run before rendering a whole application or just a specific layout or page. These can be used, for example, to protect pages from unauthorized access or redirect if some conditions are not met. + +* **modules** contains code related to specific area of the app like customer, checkout and so on. Each module can have components, helpers, composables and other files and services + +* [**pages**](https://nuxtjs.org/docs/2.x/directory-structure/pages) contains Vue.js components that Nuxt.js automatically registers as routes. + +* [**static**](https://nuxtjs.org/docs/2.x/directory-structure/static) contains files that likely won't change, such as favicon, `robots.txt`, sitemap, or company logos. + +* **test-utils** contains utilities and helpers for unit testing. + +* **types** provides global TypeScript types + +* **middleware.config.js** and **nuxt.config.js** configurations file are described in detail in the [Configuration](./configuration.html) document. + +## What's next + +With a basic understanding of the project structure, it's time to learn about the [Configuration](./configuration.html) files that control the application and installed integrations. They are a crucial part of every Vue Storefront application. diff --git a/docs/getting-started/theme.md b/docs/getting-started/theme.md new file mode 100644 index 000000000..bb108c12f --- /dev/null +++ b/docs/getting-started/theme.md @@ -0,0 +1,109 @@ +# Theme + +A project without any theme would just show a blank page, but if you have seen any of Vue Storefront demos or created a project using our CLI, you know that's not the case. So what makes it look like it does? + +This page will describe what makes the default theme, how to customize it, and what tricks we use to improve the performance. + +## What's makes a default theme + +### Preinstalled modules and libraries + +Every new Vue Storefront project comes with a set of preinstalled Nuxt.js modules and plugins, as well as Vue.js libraries. These packages offer a variety of features from cookie handling to form validation and are used by the base theme. You can remove some of them, but only if you decide to create a custom theme from scratch. + +#### Nuxt.js modules and plugins + +- [`@nuxt/typescript-build`](https://typescript.nuxtjs.org/) - for TypeScript support, + +- [`@nuxtjs/pwa`](https://pwa.nuxtjs.org/) - for PWA functionalities, + +- [`@nuxtjs/composition-api`](https://composition-api.nuxtjs.org/) - for Composition API support, + +- [`@nuxtjs/style-resources`](https://www.npmjs.com/package/@nuxtjs/style-resources) - for importing SASS variables globally, + +- [`nuxt-i18n`](https://i18n-legacy.nuxtjs.org/) - for internationalization (translations and price formatting), + +- [`nuxt-purgecss`](https://purgecss.com/guides/nuxt.html) - for removing unused CSS from the final build, + +- [`cookie-universal-nuxt`](https://www.npmjs.com/package/cookie-universal-nuxt) - for handling cookies on the server (SSR) and client (browser). + +#### Vue.js libraries + +- [`vee-validate`](https://vee-validate.logaretm.com/v3) - for frontend form validation, + +- [`vue-scrollto/nuxt`](https://www.npmjs.com/package/vue-scrollto) - for smooth scrolling to HTML elements, + +- [`vue-lazy-hydration`](https://www.npmjs.com/package/vue-lazy-hydration) - for delaying hydration and improving performance. + +### Storefront UI + +
+ StorefrontUI logo and default theme +
(Click to zoom)
+
+ +Almost every page in our default theme uses components whose names start with `Sf`. These come from the [Storefront UI](http://storefrontui.io/) — a design system and library of Vue.js components dedicated to e-commerce, maintained by the Vue Storefront team. Every component can be heavily customized using [props](https://v2.vuejs.org/v2/guide/components-props.html) and [slots](https://v2.vuejs.org/v2/guide/components-slots.html). + +Please check [Storefront UI documentation](https://docs.storefrontui.io/) to learn more and interactively customize and test the components. + +::: tip Want to use another UI library? No problem! +If you don't want to use Storefront UI, feel free to remove it from your project. It's just a UI layer, and the project can work with any other UI library or a custom code. +::: + +## How to customize the theme + +Every default theme will need customization at some point. Regardless of how complex the changes are, we recommend reusing as much from the default theme as possible. This will not only save you time but will likely reduce the number of bugs, thanks to the time we spend on stabilization and testing. + +### Updating layouts, pages, and components + +To update the existing component, you need to identify it first, and Vue.js Devtools is invaluable in this. Open the Vue.js Devtools, right-click the DOM element you want to update, and select `Inspect Vue component`. One of the components in the tree in Vue.js Devtools should get highlighted. You can look for the component with the same name in the `layout`, `pages`, or `components` directories and update it to your needs. However, there are a few exceptions to this rule described below. + +#### `Sf` components + +If the component's name starts with `Sf`, it means that it comes from [StorefrontUI](https://storefrontui.io/) library. The look and behavior of such components are controlled using props and slots passed from the direct **parent** component. + +#### `LazyHydrate` and `Anonymous Component` components + +These two components come from the [vue-lazy-hydration](https://github.com/maoberlehner/vue-lazy-hydration) library and are wrappers around other components. They are used to improve the performance by deferring the hydration process (making components interactive) and don't affect the look of other components. The behavior of such components is controlled using props passed from the direct **parent** component. + +### Updating styles + +There are a few ways of updating the default styles. Below we describe the most optimal methods for the most common cases. + +#### Adding global styleheet + +To add global styles applied to all pages, use the [css property](https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-css/) in `nuxt.config.js`. + +#### Adding stylesheet to specific layout, page, or component + +To add a stylesheet to a specific component, use `@import` regardless of whether you are using CSS, SCSS, or LESS. + +```vue + +``` + +#### Using variables, mixins, and function in components + +Usually, to access style variables, mixins, and functions, we import them in every component separately. Thanks to the [@nuxtjs/style-resources](https://github.com/nuxt-community/style-resources-module#readme) module, we can register them in `nuxt.config.js` and access them without extra `@import` statements. + +:::danger Be careful +Stylesheets in `styleResources` should **only** contain variables, mixins, and functions. During the build process, the components import these stylesheets. Any **styles** declared in them are added to every component, significantly impacting the performance and application size. +::: + +We use this approach to have access to StorefrontUI helpers in all components: + +```javascript +// nuxt.config.js + +export default { + styleResources: { + scss: [ + require.resolve('@storefront-ui/shared/styles/_helpers.scss', { paths: [process.cwd()] }) + ] + }, +}; +``` diff --git a/docs/index.md b/docs/index.md index 13dd1e2ce..3ca31ebe8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,13 +9,13 @@ Welcome to the documentation of Vue Storefront 2 integration for Magento 2. It's part of our ecosystem of integrations and extensions, which you can learn more about in our [core documentation](https://docs.vuestorefront.io/v2/). -## Demo - -If you want to see the integration in action, check out our [demo environments](/guide/environments.html). - ## Where to start? To get started, see the following guides: -- [Configuring Magento](/getting-started/configure-magento.html) to install the Magento server and configure it for Vue Storefront. -- [Configuring Vue Storefront](/getting-started/configure-integration.html) to install Vue Storefront and configure it. +- [Introduction](/getting-started/introduction.html) to learn what is Vue Storefront, +- [Installation](/installation-setup/installation.html) to install and setup new Vue Storefront project. + +## Demo + +If you want to see the integration in action, check out our [demo environments](/guide/environments.html). \ No newline at end of file diff --git a/docs/getting-started/configure-integration.md b/docs/installation-setup/configure-integration.md similarity index 94% rename from docs/getting-started/configure-integration.md rename to docs/installation-setup/configure-integration.md index 89a911fc5..c2b93f003 100644 --- a/docs/getting-started/configure-integration.md +++ b/docs/installation-setup/configure-integration.md @@ -6,8 +6,8 @@ This guide explains the steps needed to set up Vue Storefront for Magento 2. Before you can get started, you need: -- Vue Storefront project created following the [Installation](/getting-started/installation.html) guide. -- Magento 2 server configured following the [Configuring Magento](/getting-started/configure-magento.html) guide. +- Vue Storefront project created following the [Installation](./installation.html) guide. +- Magento 2 server configured following the [Configuring Magento](./configure-magento.html) guide. ## Creating the Vue Storefront for Magento 2 diff --git a/docs/getting-started/configure-magento.md b/docs/installation-setup/configure-magento.md similarity index 100% rename from docs/getting-started/configure-magento.md rename to docs/installation-setup/configure-magento.md diff --git a/docs/getting-started/installation.md b/docs/installation-setup/installation.md similarity index 93% rename from docs/getting-started/installation.md rename to docs/installation-setup/installation.md index e39aff446..d1cbe36ec 100644 --- a/docs/getting-started/installation.md +++ b/docs/installation-setup/installation.md @@ -38,11 +38,11 @@ npm install ### Step 2. Setup and configure Magento -Before you can configure the project, you need to set up and configure a new Magento instance that Vue Storefront will connect to. To do so, follow the [Configuring Magento](/getting-started/configure-magento.html) guide. +Before you can configure the project, you need to set up and configure a new Magento instance that Vue Storefront will connect to. To do so, follow the [Configuring Magento](./configure-magento.html) guide. ### Step 3. Configure Vue Storefront -With the Magento instance setup and configured, you can connect your project to it. To do so, follow the [Configuring Vue Storefront](/getting-started/configure-integration.html) guide. +With the Magento instance setup and configured, you can connect your project to it. To do so, follow the [Configuring Vue Storefront](./configure-integration.html) guide. ### Step 4. Start the project diff --git a/docs/package.json b/docs/package.json index 28242229e..776ac02e6 100755 --- a/docs/package.json +++ b/docs/package.json @@ -21,6 +21,7 @@ "@vuepress/plugin-medium-zoom": "^1.9.7", "@vuepress/plugin-search": "^1.9.7", "handlebars": "^4.7.7", + "markdown-it-video": "^0.6.3", "rimraf": "^3.0.2", "typescript": "^4.5.4", "vuepress": "^1.9.7" diff --git a/docs/yarn.lock b/docs/yarn.lock index 07f6037fc..23a06de7c 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -5452,6 +5452,11 @@ markdown-it-table-of-contents@^0.4.0: resolved "https://registry.yarnpkg.com/markdown-it-table-of-contents/-/markdown-it-table-of-contents-0.4.4.tgz#3dc7ce8b8fc17e5981c77cc398d1782319f37fbc" integrity sha512-TAIHTHPwa9+ltKvKPWulm/beozQU41Ab+FIefRaQV1NRnpzwcV9QOe6wXQS5WLivm5Q/nlo0rl6laGkMDZE7Gw== +markdown-it-video@^0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/markdown-it-video/-/markdown-it-video-0.6.3.tgz#ee96a8fce4a262872f8aaf9706c31540d40104c2" + integrity sha512-T4th1kwy0OcvyWSN4u3rqPGxvbDclpucnVSSaH3ZacbGsAts964dxokx9s/I3GYsrDCJs4ogtEeEeVP18DQj0Q== + markdown-it@^8.4.1: version "8.4.2" resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-8.4.2.tgz#386f98998dc15a37722aa7722084f4020bdd9b54" diff --git a/internals/eslint-import/package.json b/internals/eslint-import/package.json index 55c9a4997..d6b7ee740 100644 --- a/internals/eslint-import/package.json +++ b/internals/eslint-import/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/eslint-config-import", - "version": "1.0.0-rc.9", + "version": "1.0.0-rc.10", "author": "Heitor Ramon Ribeiro ", "license": "MIT", "scripts": { diff --git a/internals/eslint-jest/package.json b/internals/eslint-jest/package.json index 347a386f7..0a35792ae 100644 --- a/internals/eslint-jest/package.json +++ b/internals/eslint-jest/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/eslint-config-jest", - "version": "1.0.0-rc.9", + "version": "1.0.0-rc.10", "author": "Heitor Ramon Ribeiro ", "license": "MIT", "scripts": { diff --git a/internals/eslint-typescript/package.json b/internals/eslint-typescript/package.json index 017e17fb7..ae51967da 100644 --- a/internals/eslint-typescript/package.json +++ b/internals/eslint-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/eslint-config-typescript", - "version": "1.0.0-rc.9", + "version": "1.0.0-rc.10", "author": "Heitor Ramon Ribeiro ", "license": "MIT", "scripts": { diff --git a/internals/eslint-vue/package.json b/internals/eslint-vue/package.json index 3c6f321f7..2a78fc560 100644 --- a/internals/eslint-vue/package.json +++ b/internals/eslint-vue/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/eslint-config-vue", - "version": "1.0.0-rc.9", + "version": "1.0.0-rc.10", "author": "Heitor Ramon Ribeiro ", "license": "MIT", "scripts": { diff --git a/internals/eslint/package.json b/internals/eslint/package.json index 8f8a3f2b2..b90f94e87 100644 --- a/internals/eslint/package.json +++ b/internals/eslint/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/eslint-config-base", - "version": "1.0.0-rc.9", + "version": "1.0.0-rc.10", "author": "Heitor Ramon Ribeiro ", "license": "MIT", "scripts": { diff --git a/packages/api-client/package.json b/packages/api-client/package.json index 1a071eed6..767787771 100644 --- a/packages/api-client/package.json +++ b/packages/api-client/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/magento-api", - "version": "1.0.0-rc.9", + "version": "1.0.0-rc.10", "sideEffects": false, "homepage": "https://github.com/vuestorefront/magento2", "bugs": { diff --git a/packages/api-client/src/api/addProductsToCart/addProductsToCart.ts b/packages/api-client/src/api/addProductsToCart/addProductsToCart.ts index 00b4f46ba..60e2d1c24 100644 --- a/packages/api-client/src/api/addProductsToCart/addProductsToCart.ts +++ b/packages/api-client/src/api/addProductsToCart/addProductsToCart.ts @@ -185,6 +185,10 @@ export default gql` } } } + user_errors { + code + message + } } } `; diff --git a/packages/api-client/src/api/productDetail/productDetailsQuery.ts b/packages/api-client/src/api/productDetail/productDetailsQuery.ts index f4e0b60bb..64c837a58 100644 --- a/packages/api-client/src/api/productDetail/productDetailsQuery.ts +++ b/packages/api-client/src/api/productDetail/productDetailsQuery.ts @@ -11,7 +11,6 @@ export default gql` $pageSize: Int = 10, $currentPage: Int = 1, $sort: ProductAttributeSortInput - $configurations: [ID!] ) { products(search: $search, filter: $filter, sort: $sort, pageSize: $pageSize, currentPage: $currentPage) { items { @@ -30,28 +29,6 @@ export default gql` url_rewrites { url } - price_range { - maximum_price { - final_price { - currency - value - } - regular_price { - currency - value - } - } - minimum_price { - final_price { - currency - value - } - regular_price { - currency - value - } - } - } categories { uid name @@ -73,28 +50,6 @@ export default gql` } } } - price_range { - maximum_price { - final_price { - currency - value - } - regular_price { - currency - value - } - } - minimum_price { - final_price { - currency - value - } - regular_price { - currency - value - } - } - } small_image { url position @@ -134,50 +89,6 @@ export default gql` } options_container special_to_date - ... on BundleProduct { - items { - position - required - sku - title - type - uid - options { - can_change_quantity - is_default - position - uid - quantity - product { - uid - sku - name - price_range { - maximum_price { - final_price { - currency - value - } - regular_price { - currency - value - } - } - minimum_price { - final_price { - currency - value - } - regular_price { - currency - value - } - } - } - } - } - } - } ... on ConfigurableProduct { configurable_options { attribute_code @@ -194,87 +105,8 @@ export default gql` uid } } - configurable_product_options_selection(configurableOptionValueUids: $configurations) { - options_available_for_selection { - attribute_code - option_value_uids - } - media_gallery { - disabled - label - position - url - } - variant { - uid - sku - name - price_range { - maximum_price { - final_price { - currency - value - } - regular_price { - currency - value - } - } - minimum_price { - final_price { - currency - value - } - regular_price { - currency - value - } - } - } - } - } - } - ... on GroupedProduct { - items { - position - qty - product { - uid - sku - name - stock_status - only_x_left_in_stock - price_range { - maximum_price { - final_price { - currency - value - } - regular_price { - currency - value - } - } - minimum_price { - final_price { - currency - value - } - regular_price { - currency - value - } - } - } - thumbnail { - url - position - disabled - label - } - } - } } + ... on DownloadableProduct { downloadable_product_samples { sample_url diff --git a/packages/api-client/src/types/API.ts b/packages/api-client/src/types/API.ts index debc3e52d..0149170bf 100644 --- a/packages/api-client/src/types/API.ts +++ b/packages/api-client/src/types/API.ts @@ -3,13 +3,9 @@ import { ExecutionResult } from 'graphql'; import { CustomQuery } from '@vue-storefront/core'; import { AddConfigurableProductsToCartInput, - AddConfigurableProductsToCartMutation, AddSimpleProductsToCartInput, - AddSimpleProductsToCartMutation, AddDownloadableProductsToCartInput, - AddDownloadableProductsToCartMutation, AddVirtualProductsToCartInput, - AddVirtualProductsToCartMutation, AppliedCoupon, ApplyCouponToCartInput, ApplyCouponToCartMutation, @@ -95,11 +91,9 @@ import { RemoveProductsFromWishlistMutationVariables, RemoveProductsFromWishlistMutation, GetCustomerAddressesQuery, - AddProductsToCartMutation, CmsBlockQuery, GroupedProduct, AddBundleProductsToCartInput, - AddBundleProductsToCartMutation, RequestPasswordResetEmailMutation, RequestPasswordResetEmailMutationVariables, ResetPasswordMutationVariables, @@ -107,7 +101,12 @@ import { ChangeCustomerPasswordMutation, CreateCustomerAddressMutation, DownloadableProduct, - VirtualProduct, CustomerOrdersFilterInput, RoutableInterface, + VirtualProduct, + CustomerOrdersFilterInput, + RoutableInterface, + AddProductsToCartOutput, + AddConfigurableProductsToCartMutation, + AddBundleProductsToCartMutation, AddSimpleProductsToCartMutation, AddDownloadableProductsToCartMutation, AddVirtualProductsToCartMutation, } from './GraphQL'; import { SetPaymentMethodOnCartInputs } from '../api/setPaymentMethodOnCart'; import { CustomerProductReviewParams } from '../api/customerProductReview'; @@ -179,7 +178,7 @@ export interface MagentoApiMethods { addProductsToCart( input: AddProductsToCartInput, customQuery?: CustomQuery - ): Promise>; + ): Promise>; addProductToWishList( input: AddProductsToWishlistMutationVariables, diff --git a/packages/composables/package.json b/packages/composables/package.json index 1939ac0ad..76c6a8d42 100644 --- a/packages/composables/package.json +++ b/packages/composables/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/magento", - "version": "1.0.0-rc.9", + "version": "1.0.0-rc.10", "license": "MIT", "homepage": "https://github.com/vuestorefront/magento2", "bugs": { @@ -29,7 +29,7 @@ }, "dependencies": { "@vue-storefront/core": "~2.5.6", - "@vue-storefront/magento-api": "^1.0.0-rc.9", + "@vue-storefront/magento-api": "^1.0.0-rc.10", "@vue/composition-api": "^1.4.1", "cookie-universal": "^2.1.5", "vue": "^2.6.14", diff --git a/packages/theme/components/AppHeader.vue b/packages/theme/components/AppHeader.vue index 046bec65e..ce5ac04ea 100644 --- a/packages/theme/components/AppHeader.vue +++ b/packages/theme/components/AppHeader.vue @@ -12,8 +12,14 @@