@3cr/viewer-browser 0.0.86 → 0.0.92

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 (46) hide show
  1. package/coverage/3cr-viewer-browser/index.html +1 -1
  2. package/coverage/3cr-viewer-browser/index.ts.html +1 -1
  3. package/coverage/3cr-viewer-browser/src/App.vue.html +1 -1
  4. package/coverage/3cr-viewer-browser/src/components/WebGL3DR.vue.html +1 -1
  5. package/coverage/3cr-viewer-browser/src/components/icons/index.html +1 -1
  6. package/coverage/3cr-viewer-browser/src/components/icons/liver.vue.html +1 -1
  7. package/coverage/3cr-viewer-browser/src/components/index.html +1 -1
  8. package/coverage/3cr-viewer-browser/src/components/loading/LoadingSpinner.vue.html +1 -1
  9. package/coverage/3cr-viewer-browser/src/components/loading/index.html +1 -1
  10. package/coverage/3cr-viewer-browser/src/components/modal/MftpWebGL3DRModal.vue.html +77 -200
  11. package/coverage/3cr-viewer-browser/src/components/modal/index.html +17 -17
  12. package/coverage/3cr-viewer-browser/src/components/selectors/ValueSelector.vue.html +1 -1
  13. package/coverage/3cr-viewer-browser/src/components/selectors/index.html +1 -1
  14. package/coverage/3cr-viewer-browser/src/components/sliders/DoubleSliderSelector.vue.html +1 -1
  15. package/coverage/3cr-viewer-browser/src/components/sliders/VerticalSliderSelector.vue.html +1 -1
  16. package/coverage/3cr-viewer-browser/src/components/sliders/index.html +1 -1
  17. package/coverage/3cr-viewer-browser/src/dataLayer/iconData.ts.html +1 -1
  18. package/coverage/3cr-viewer-browser/src/dataLayer/index.html +27 -27
  19. package/coverage/3cr-viewer-browser/src/dataLayer/payloadHandler.ts.html +185 -74
  20. package/coverage/3cr-viewer-browser/src/dataLayer/scanState.ts.html +11 -41
  21. package/coverage/3cr-viewer-browser/src/helpers/index.html +1 -1
  22. package/coverage/3cr-viewer-browser/src/helpers/layoutOverlayStyle.ts.html +1 -1
  23. package/coverage/3cr-viewer-browser/src/helpers/modelHelper.ts.html +1 -1
  24. package/coverage/3cr-viewer-browser/src/helpers/utils.ts.html +3 -3
  25. package/coverage/3cr-viewer-browser/src/index.html +1 -1
  26. package/coverage/3cr-viewer-browser/src/main.ts.html +1 -1
  27. package/coverage/3cr-viewer-browser/src/models/LoadViewerOptions.ts.html +10 -10
  28. package/coverage/3cr-viewer-browser/src/models/index.html +7 -7
  29. package/coverage/3cr-viewer-browser/src/notifications/index.html +17 -17
  30. package/coverage/3cr-viewer-browser/src/notifications/notification.ts.html +79 -70
  31. package/coverage/3cr-viewer-browser/src/plugins/index.html +1 -1
  32. package/coverage/3cr-viewer-browser/src/plugins/index.ts.html +1 -1
  33. package/coverage/3cr-viewer-browser/src/plugins/vuetify.ts.html +1 -1
  34. package/coverage/index.html +41 -41
  35. package/dist/Viewer3CR.js +11 -11
  36. package/dist/Viewer3CR.mjs +5371 -5375
  37. package/dist/Viewer3CR.umd.js +11 -11
  38. package/package.json +1 -1
  39. package/src/components/modal/MftpWebGL3DRModal.vue +33 -74
  40. package/src/components/modal/__tests__/mftp-webgl-3dr-modal.spec.ts +100 -148
  41. package/src/dataLayer/__tests__/payload-handler.spec.ts +119 -3
  42. package/src/dataLayer/payloadHandler.ts +39 -2
  43. package/src/dataLayer/scanState.ts +3 -13
  44. package/src/models/__tests__/load-viewer-options.spec.ts +22 -0
  45. package/src/notifications/__tests__/notification.spec.ts +120 -0
  46. package/src/notifications/notification.ts +4 -1
@@ -0,0 +1,22 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import {
4
+ defaultLoadViewerOptions,
5
+ LoadViewerOptions,
6
+ } from "@/models/LoadViewerOptions";
7
+
8
+ describe("LoadViewerOptions.ts", () => {
9
+ for (const option of Object.keys(defaultLoadViewerOptions)) {
10
+ it(`should call default ${option}`, () => {
11
+ expect(
12
+ callDefaultLoadViewerOptions(option as keyof LoadViewerOptions)
13
+ ).toStrictEqual(Promise.resolve());
14
+ });
15
+ }
16
+ });
17
+
18
+ function callDefaultLoadViewerOptions(key: keyof LoadViewerOptions) {
19
+ const foundDeclaration = defaultLoadViewerOptions[key];
20
+ if (foundDeclaration) return foundDeclaration();
21
+ return undefined;
22
+ }
@@ -0,0 +1,120 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import { useNotification } from "@kyvg/vue3-notification";
3
+ import { handleNotification } from "@/notifications/notification";
4
+ import {
5
+ FileManagementActions,
6
+ InteractivityActions,
7
+ NotificationPayload,
8
+ NotificationsActions,
9
+ SlidersActions,
10
+ } from "@3cr/types-ts";
11
+ const { notify } = useNotification();
12
+
13
+ vi.mock("@kyvg/vue3-notification", async (importOriginal) => {
14
+ const mod = (await importOriginal()) as object;
15
+ return {
16
+ ...mod,
17
+ useNotification: vi.fn().mockReturnValue({
18
+ notify: vi.fn(),
19
+ }),
20
+ };
21
+ });
22
+
23
+ describe("notification.ts", () => {
24
+ it(`should handleNotification InteractivityActions.in01`, () => {
25
+ const notification: NotificationPayload = {
26
+ Action: InteractivityActions.in01,
27
+ Code: "S00001",
28
+ } as NotificationPayload;
29
+ handleNotification(NotificationsActions.no01, JSON.stringify(notification));
30
+ expect(notify).not.toHaveBeenCalled();
31
+ });
32
+
33
+ it(`should handleNotification InteractivityActions.in02`, () => {
34
+ const notification: NotificationPayload = {
35
+ Action: InteractivityActions.in02,
36
+ Code: "S00001",
37
+ } as NotificationPayload;
38
+ handleNotification(NotificationsActions.no01, JSON.stringify(notification));
39
+ expect(notify).not.toHaveBeenCalled();
40
+ });
41
+
42
+ it(`should handleNotification InteractivityActions.in03`, () => {
43
+ const notification: NotificationPayload = {
44
+ Action: InteractivityActions.in03,
45
+ Code: "S00001",
46
+ } as NotificationPayload;
47
+ handleNotification(NotificationsActions.no01, JSON.stringify(notification));
48
+ expect(notify).not.toHaveBeenCalled();
49
+ });
50
+
51
+ it(`should handleNotification InteractivityActions.in04`, () => {
52
+ const notification: NotificationPayload = {
53
+ Action: InteractivityActions.in04,
54
+ Code: "S00001",
55
+ } as NotificationPayload;
56
+ handleNotification(NotificationsActions.no01, JSON.stringify(notification));
57
+ expect(notify).not.toHaveBeenCalled();
58
+ });
59
+
60
+ it(`should handleNotification SlidersActions.sl01`, () => {
61
+ const notification: NotificationPayload = {
62
+ Action: SlidersActions.sl01,
63
+ Code: "S00001",
64
+ } as NotificationPayload;
65
+ handleNotification(NotificationsActions.no01, JSON.stringify(notification));
66
+ expect(notify).not.toHaveBeenCalled();
67
+ });
68
+
69
+ it(`should handleNotification success [MUTED] FileManagementActions.fm01`, () => {
70
+ const notification: NotificationPayload = {
71
+ Action: FileManagementActions.fm01,
72
+ Code: "S00001",
73
+ } as NotificationPayload;
74
+ handleNotification(NotificationsActions.no01, JSON.stringify(notification));
75
+ expect(notify).not.toHaveBeenCalledWith({
76
+ title: notification.Code,
77
+ text: notification.Action,
78
+ type: "success",
79
+ });
80
+ });
81
+
82
+ it(`should handleNotification info [MUTED] FileManagementActions.fm01`, () => {
83
+ const notification: NotificationPayload = {
84
+ Action: FileManagementActions.fm01,
85
+ Code: "I00001",
86
+ } as NotificationPayload;
87
+ handleNotification(NotificationsActions.no04, JSON.stringify(notification));
88
+ expect(notify).not.toHaveBeenCalledWith({
89
+ title: notification.Code,
90
+ text: notification.Action,
91
+ type: "info",
92
+ });
93
+ });
94
+
95
+ it(`should handleNotification failure FileManagementActions.fm01`, () => {
96
+ const notification: NotificationPayload = {
97
+ Action: FileManagementActions.fm01,
98
+ Code: "F00001",
99
+ } as NotificationPayload;
100
+ handleNotification(NotificationsActions.no03, JSON.stringify(notification));
101
+ expect(notify).toHaveBeenCalledWith({
102
+ title: notification.Code,
103
+ text: notification.Action,
104
+ type: "error",
105
+ });
106
+ });
107
+
108
+ it(`should handleNotification warning FileManagementActions.fm01`, () => {
109
+ const notification: NotificationPayload = {
110
+ Action: FileManagementActions.fm01,
111
+ Code: "A00001",
112
+ } as NotificationPayload;
113
+ handleNotification(NotificationsActions.no02, JSON.stringify(notification));
114
+ expect(notify).toHaveBeenCalledWith({
115
+ title: notification.Code,
116
+ text: notification.Action,
117
+ type: "warn",
118
+ });
119
+ });
120
+ });
@@ -6,7 +6,10 @@ import {
6
6
  import { useNotification } from "@kyvg/vue3-notification";
7
7
  const { notify } = useNotification();
8
8
 
9
- export async function handleNotification(action: string, message: string) {
9
+ export async function handleNotification(
10
+ action: NotificationsActions,
11
+ message: string
12
+ ) {
10
13
  const notification = JSON.parse(message) as NotificationPayload;
11
14
 
12
15
  switch (notification.Action) {