@vc-shell/framework 1.0.245 → 1.0.246

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/core/composables/index.ts +1 -0
  3. package/core/composables/useAppInsights/index.ts +42 -0
  4. package/core/composables/useErrorHandler/index.ts +9 -7
  5. package/dist/core/composables/index.d.ts +1 -0
  6. package/dist/core/composables/index.d.ts.map +1 -1
  7. package/dist/core/composables/useAppInsights/index.d.ts +12 -0
  8. package/dist/core/composables/useAppInsights/index.d.ts.map +1 -0
  9. package/dist/core/composables/useErrorHandler/index.d.ts.map +1 -1
  10. package/dist/framework.js +11359 -11336
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts +0 -1
  15. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts.map +1 -1
  16. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts +0 -1
  17. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts.map +1 -1
  18. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue.d.ts.map +1 -1
  19. package/package.json +4 -4
  20. package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +17 -21
  21. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +0 -1
  22. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +0 -3
  23. package/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +0 -8
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [1.0.246](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.245...v1.0.246) (2024-06-28)
2
+
3
+
4
+ ### Features
5
+
6
+ * add useAppInsights composable for application insights pageview logging ([7c030d6](https://github.com/VirtoCommerce/vc-shell/commit/7c030d6947529a93f0476adc9d59b94336c3580b))
7
+
8
+
9
+
1
10
  ## [1.0.245](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.244...v1.0.245) (2024-06-28)
2
11
 
3
12
 
@@ -12,3 +12,4 @@ export { useMenuService } from "./useMenuService";
12
12
  export { useBeforeUnload } from "./useBeforeUnload";
13
13
  export { useLanguages } from "./useLanguages";
14
14
  export { useBreadcrumbs } from "./useBreadcrumbs";
15
+ export { useAppInsights } from "./useAppInsights";
@@ -0,0 +1,42 @@
1
+ import { inject } from "vue";
2
+ import { AppInsightsPluginOptions, useAppInsights as useInsights } from "vue3-application-insights";
3
+ import { generateW3CId } from "@microsoft/applicationinsights-core-js";
4
+ import { useUser } from "..";
5
+
6
+ export const useAppInsights = () => {
7
+ const appInsights = useInsights();
8
+ const { user } = useUser();
9
+ const appInsightsOptions = inject<AppInsightsPluginOptions>("appInsightsOptions");
10
+
11
+ function setupPageTracking() {
12
+ const appName = appInsightsOptions?.appName ? `[${appInsightsOptions.appName}] ` : "";
13
+
14
+ const pageName = (route: { name: string }) => `${appName}${route.name as string}`;
15
+
16
+ function beforeEach(route: { name: string }) {
17
+ const name = pageName(route);
18
+ appInsights.context.telemetryTrace.traceID = generateW3CId();
19
+ appInsights.context.telemetryTrace.name = route.name as string;
20
+
21
+ appInsights.startTrackPage(name);
22
+ }
23
+
24
+ function afterEach(route: { name: string; fullPath: string }) {
25
+ const name = pageName(route);
26
+ const url = location.protocol + "//" + location.host + route.fullPath;
27
+ appInsights.stopTrackPage(name, url, {
28
+ userId: user.value?.id ?? "",
29
+ userName: user.value?.userName ?? "",
30
+ });
31
+ }
32
+
33
+ return {
34
+ beforeEach,
35
+ afterEach,
36
+ };
37
+ }
38
+
39
+ return {
40
+ setupPageTracking: setupPageTracking(),
41
+ };
42
+ };
@@ -30,13 +30,15 @@ export function useErrorHandler(capture?: boolean): IUseErrorHandler {
30
30
  error.value = err.toString();
31
31
  }
32
32
 
33
- appInsights.trackException({
34
- exception: err,
35
- properties: {
36
- userId: user.value?.id ?? "",
37
- userName: user.value?.userName ?? "",
38
- },
39
- });
33
+ if (appInsights) {
34
+ appInsights.trackException({
35
+ exception: err,
36
+ properties: {
37
+ userId: user.value?.id ?? "",
38
+ userName: user.value?.userName ?? "",
39
+ },
40
+ });
41
+ }
40
42
 
41
43
  console.error(err);
42
44
  }
@@ -12,4 +12,5 @@ export { useMenuService } from "./useMenuService";
12
12
  export { useBeforeUnload } from "./useBeforeUnload";
13
13
  export { useLanguages } from "./useLanguages";
14
14
  export { useBreadcrumbs } from "./useBreadcrumbs";
15
+ export { useAppInsights } from "./useAppInsights";
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const useAppInsights: () => {
2
+ setupPageTracking: {
3
+ beforeEach: (route: {
4
+ name: string;
5
+ }) => void;
6
+ afterEach: (route: {
7
+ name: string;
8
+ fullPath: string;
9
+ }) => void;
10
+ };
11
+ };
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useAppInsights/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;4BAUI;YAAE,MAAM,MAAM,CAAA;SAAE;2BAQjB;YAAE,MAAM,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE;;CAkB/D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useErrorHandler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,GAAG,EAAE,MAAM,KAAK,CAAC;AAIpE,UAAU,gBAAgB;IACxB,KAAK,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1B,KAAK,IAAI,IAAI,CAAC;CACf;AAED,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,gBAAgB,CA+CnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useErrorHandler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,GAAG,EAAE,MAAM,KAAK,CAAC;AAIpE,UAAU,gBAAgB;IACxB,KAAK,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1B,KAAK,IAAI,IAAI,CAAC;CACf;AAED,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAiDnE"}