0.5.6 • Published 6 days ago

@shopware-pwa/nuxt3-module v0.5.6

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

shopware/frontends - nuxt3-module

npm.io npm.io npm.io npm.io

Nuxt module that allows you to set up a Nuxt 3 project with Shopware Frontends. It provides the composables and api-client packages.

If you want to use these packages with a different Vue.js framework, see the guide for using Shopware Frontends in a custom project or use the vue3-plugin.

Features

Setup

Install npm package:

# Using pnpm
pnpm add -D @shopware-pwa/nuxt3-module

# Using yarn
yarn add --dev @shopware-pwa/nuxt3-module

# Using npm
npm i @shopware-pwa/nuxt3-module --save-dev

Then, register the module by editing nuxt.config.js or (.ts) file (by extending modules array):

/* nuxt.config.ts */

export default defineNuxtConfig({
  /* ... */
  modules: [, /* ... */ "@shopware-pwa/nuxt3-module"],

  runtimeConfig: {
    public: {
      shopware: {
        // connect to your Shopware 6 API instance
        shopwareEndpoint: "https://demo-frontends.shopware.store",
        shopwareAccessToken: "SWSCBHFSNTVMAWNZDNFKSHLAYW",
      },
    },
  },
});

Set up your own API instance by adding public runtimeConfiguration in the same file. The nuxt module (and vue plugin) will use this values.

Basic usage

Now you can use any composable function you need without extra import:

<script setup>
  const { login } = useUser();
  const { refreshSessionContext } = useSessionContext();
  refreshSessionContext();
</script>

The information about the session is kept in a cookie (sw-context-token) and used in every request made by any composable or directly, invoked by api instance:

<script>
  const { apiInstance } = useShopwareContext();
  const rawApiResponse = await apiInstance.invokePost(/** params omitted */);
</script>

TypeScript support

All composable functions are fully typed with TypeScript and they are registed globally in Nuxt.js application, so the type hinting will help you to work with all of them.

📦 Advanced packaging

Internally, the module uses API Client and Composables packages, configured together to make everything working well. If you need to check how it's working on a different version of one of them, install a package locally in your project (to be installed and available in project's package.json file), then the Nuxt module will use yours. Keep in mind that the different configuration may lead to unexpected behavior.

Links

Changelog

Full changelog for stable version is available here

Latest changes: 0.3.6

Patch Changes

  • Updated dependencies [558c9d0]:
    • @shopware-pwa/composables-next@0.10.0
0.5.4

8 months ago

0.5.3

9 months ago

0.5.6

6 months ago

0.5.5

6 months ago

0.5.0

10 months ago

0.5.2

9 months ago

0.5.1

9 months ago

0.3.7

10 months ago

0.4.0

10 months ago

0.3.6

11 months ago

0.3.5

11 months ago

0.3.2

12 months ago

0.3.4

12 months ago

0.3.3

12 months ago

0.3.0

1 year ago

0.3.1

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.20

1 year ago

0.1.21

1 year ago

0.1.22

1 year ago

0.1.23

1 year ago

0.1.24

1 year ago

0.1.16

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago