From 08b7a6784d81fff1b85579ab33f6fc8cb9453c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Sys=C5=82o?= Date: Wed, 3 Jul 2024 14:43:25 +0200 Subject: [PATCH 1/2] Remove TIP tags from README_BASE.md --- README.md | 53 +++++++++++++++++++++++---------------------- docs/README_BASE.md | 53 +++++++++++++++++++++++---------------------- 2 files changed, 54 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index a48df14..e71b42c 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,7 @@ If you want your nonce to be passed to the script, pass it as the third argument Piwik PRO container will be initialized under the hood by `@piwikpro/nuxt-piwik-pro` module itself. Module also inject client-only plugin to Nuxt application instance which allow you to use all Piwik PRO services globally as a part of Nuxt context returned from `useNuxtApp()` composable as a `$piwikPRO`. -> [!IMPORTANT] -> Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side. +####### Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side. ```ts // In any component or other part of application code @@ -79,32 +78,34 @@ To use Piwik PRO services safety, you can import `usePiwikPro()` from `'@piwikpr // In any component or other part of application code import { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables"; // callback can be sync or async function -const userId = await usePiwikPro(({ PageViews, GoalConversions, UserManagement }) => { - PageViews.trackPageView(); - GoalConversions.trackGoal(1, 100); - return UserManagement.getUserId(); -}); +const userId = await usePiwikPro( + ({ PageViews, GoalConversions, UserManagement }) => { + PageViews.trackPageView(); + GoalConversions.trackGoal(1, 100); + return UserManagement.getUserId(); + } +); ``` -> [!TIP] -> -> ###### export `usePiwikPro()` as a Nuxt composable -> -> To make this composable globally available, create `.ts` file in `/composables` directory and export `usePiwikPro()` from `'@piwikpro/nuxt-piwik-pro/composables'`. -> -> ```ts -> // composables/usePiwikPro.ts -> export { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables"; -> ``` -> -> ```ts -> // In any component or other part of application code -> const userId = await usePiwikPro(({ PageViews, GoalConversions, UserManagement }) => { -> PageViews.trackPageView(); -> GoalConversions.trackGoal(1, 100); -> return UserManagement.getUserId(); -> }); -> ``` +####### export `usePiwikPro()` as a Nuxt composable + +To make this composable globally available, create `.ts` file in `/composables` directory and export `usePiwikPro()` from `'@piwikpro/nuxt-piwik-pro/composables'`. + +```ts +// composables/usePiwikPro.ts +export { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables"; +``` + +```ts +// In any component or other part of application code +const userId = await usePiwikPro( + ({ PageViews, GoalConversions, UserManagement }) => { + PageViews.trackPageView(); + GoalConversions.trackGoal(1, 100); + return UserManagement.getUserId(); + } +); +``` ##### Usage with `` Nuxt component diff --git a/docs/README_BASE.md b/docs/README_BASE.md index 966726b..f0145c0 100644 --- a/docs/README_BASE.md +++ b/docs/README_BASE.md @@ -54,8 +54,7 @@ If you want your nonce to be passed to the script, pass it as the third argument Piwik PRO container will be initialized under the hood by `@piwikpro/nuxt-piwik-pro` module itself. Module also inject client-only plugin to Nuxt application instance which allow you to use all Piwik PRO services globally as a part of Nuxt context returned from `useNuxtApp()` composable as a `$piwikPRO`. -> [!IMPORTANT] -> Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side. +###### Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side. ```ts // In any component or other part of application code @@ -75,32 +74,34 @@ To use Piwik PRO services safety, you can import `usePiwikPro()` from `'@piwikpr // In any component or other part of application code import { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables"; // callback can be sync or async function -const userId = await usePiwikPro(({ PageViews, GoalConversions, UserManagement }) => { - PageViews.trackPageView(); - GoalConversions.trackGoal(1, 100); - return UserManagement.getUserId(); -}); +const userId = await usePiwikPro( + ({ PageViews, GoalConversions, UserManagement }) => { + PageViews.trackPageView(); + GoalConversions.trackGoal(1, 100); + return UserManagement.getUserId(); + } +); ``` -> [!TIP] -> -> ###### export `usePiwikPro()` as a Nuxt composable -> -> To make this composable globally available, create `.ts` file in `/composables` directory and export `usePiwikPro()` from `'@piwikpro/nuxt-piwik-pro/composables'`. -> -> ```ts -> // composables/usePiwikPro.ts -> export { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables"; -> ``` -> -> ```ts -> // In any component or other part of application code -> const userId = await usePiwikPro(({ PageViews, GoalConversions, UserManagement }) => { -> PageViews.trackPageView(); -> GoalConversions.trackGoal(1, 100); -> return UserManagement.getUserId(); -> }); -> ``` +###### export `usePiwikPro()` as a Nuxt composable + +To make this composable globally available, create `.ts` file in `/composables` directory and export `usePiwikPro()` from `'@piwikpro/nuxt-piwik-pro/composables'`. + +```ts +// composables/usePiwikPro.ts +export { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables"; +``` + +```ts +// In any component or other part of application code +const userId = await usePiwikPro( + ({ PageViews, GoalConversions, UserManagement }) => { + PageViews.trackPageView(); + GoalConversions.trackGoal(1, 100); + return UserManagement.getUserId(); + } +); +``` #### Usage with `` Nuxt component From 8f1c65e8a861871a02ecd0b7f108192c84fe6829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Sys=C5=82o?= Date: Wed, 3 Jul 2024 15:13:23 +0200 Subject: [PATCH 2/2] Remove one # from REAMDE_BASE titles --- README.md | 4 ++-- docs/README_BASE.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e71b42c..e27db90 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ If you want your nonce to be passed to the script, pass it as the third argument Piwik PRO container will be initialized under the hood by `@piwikpro/nuxt-piwik-pro` module itself. Module also inject client-only plugin to Nuxt application instance which allow you to use all Piwik PRO services globally as a part of Nuxt context returned from `useNuxtApp()` composable as a `$piwikPRO`. -####### Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side. +###### Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side. ```ts // In any component or other part of application code @@ -87,7 +87,7 @@ const userId = await usePiwikPro( ); ``` -####### export `usePiwikPro()` as a Nuxt composable +###### export `usePiwikPro()` as a Nuxt composable To make this composable globally available, create `.ts` file in `/composables` directory and export `usePiwikPro()` from `'@piwikpro/nuxt-piwik-pro/composables'`. diff --git a/docs/README_BASE.md b/docs/README_BASE.md index f0145c0..7007013 100644 --- a/docs/README_BASE.md +++ b/docs/README_BASE.md @@ -54,7 +54,7 @@ If you want your nonce to be passed to the script, pass it as the third argument Piwik PRO container will be initialized under the hood by `@piwikpro/nuxt-piwik-pro` module itself. Module also inject client-only plugin to Nuxt application instance which allow you to use all Piwik PRO services globally as a part of Nuxt context returned from `useNuxtApp()` composable as a `$piwikPRO`. -###### Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side. +##### Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side. ```ts // In any component or other part of application code @@ -83,7 +83,7 @@ const userId = await usePiwikPro( ); ``` -###### export `usePiwikPro()` as a Nuxt composable +##### export `usePiwikPro()` as a Nuxt composable To make this composable globally available, create `.ts` file in `/composables` directory and export `usePiwikPro()` from `'@piwikpro/nuxt-piwik-pro/composables'`.