@apptegy/nuxt-navigation 0.1.112 → 0.1.113
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.
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Nav/Sidebar.vue +5 -3
- package/dist/runtime/components/Nav/SidebarSection.vue +8 -9
- package/dist/runtime/utils/application.d.ts +5 -0
- package/dist/runtime/utils/application.js +21 -0
- package/package.json +15 -15
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
2
|
|
|
3
|
-
const module = defineNuxtModule({
|
|
3
|
+
const module$1 = defineNuxtModule({
|
|
4
4
|
meta: {
|
|
5
5
|
name: "@apptegy/nuxt-navigation",
|
|
6
6
|
compatibility: {
|
|
@@ -22,4 +22,4 @@ const module = defineNuxtModule({
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
export { module as default };
|
|
25
|
+
export { module$1 as default };
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
<ul class="navbar-applications">
|
|
56
56
|
<li v-for="application of applications" :key="application.id">
|
|
57
57
|
<NavSidebarSection
|
|
58
|
-
v-if="expanded ||
|
|
58
|
+
v-if="expanded || isCurrentApplication(application) || isMobile"
|
|
59
59
|
:application="application"
|
|
60
|
-
:active="
|
|
60
|
+
:active="isCurrentApplication(application)"
|
|
61
61
|
:collapsed="!expanded && !isMobile"
|
|
62
62
|
>
|
|
63
|
-
<slot v-if="
|
|
63
|
+
<slot v-if="isCurrentApplication(application)" />
|
|
64
64
|
</NavSidebarSection>
|
|
65
65
|
</li>
|
|
66
66
|
</ul>
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
|
|
95
95
|
<script setup>
|
|
96
96
|
import { useSidebar, useBranding, useNuxtApp, ref, watch, computed, onMounted, onBeforeUnmount, nextTick } from "#imports";
|
|
97
|
+
import { isSameApplication } from "../../utils/application";
|
|
97
98
|
import ApptegyLogo from "./Icons/ApptegyLogo.vue";
|
|
98
99
|
import { useWindowSize } from "@vueuse/core";
|
|
99
100
|
import Unpinned from "./Icons/Unpinned.vue";
|
|
@@ -127,6 +128,7 @@ const props = defineProps({
|
|
|
127
128
|
showCollapseButton: { type: Boolean, required: false, default: false }
|
|
128
129
|
});
|
|
129
130
|
const emit = defineEmits(["toggle-expand"]);
|
|
131
|
+
const isCurrentApplication = (application) => isSameApplication(props.currentApplication, application.text);
|
|
130
132
|
const { state: expanded } = useSidebar();
|
|
131
133
|
const { brand, getBrandingStyles } = await useBranding(props.clientId);
|
|
132
134
|
const brandLogo = ref(brand.value?.logo_light);
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
<script setup>
|
|
33
33
|
import { useSidebar, computed, ref } from "#imports";
|
|
34
|
-
|
|
34
|
+
import { isEngageApplication, rewriteEngageUrl } from "../../utils/application";
|
|
35
35
|
const NEWSLETTERS_APP_TEXT = "Newsletters";
|
|
36
36
|
const props = defineProps({
|
|
37
37
|
application: { type: Object, required: true },
|
|
@@ -40,22 +40,21 @@ const props = defineProps({
|
|
|
40
40
|
});
|
|
41
41
|
const { state: expanded } = useSidebar();
|
|
42
42
|
const isOpen = ref(true);
|
|
43
|
-
const
|
|
44
|
-
const { text } = props.application || {};
|
|
45
|
-
return text.toLowerCase() === ENGAGE_APP_TEXT;
|
|
46
|
-
});
|
|
43
|
+
const isEngageApp = computed(() => isEngageApplication(props.application?.text, props.application?.id));
|
|
47
44
|
const appText = computed(() => {
|
|
48
45
|
const { text } = props.application || {};
|
|
49
|
-
if (
|
|
46
|
+
if (isEngageApp.value) {
|
|
50
47
|
return NEWSLETTERS_APP_TEXT;
|
|
51
48
|
}
|
|
52
49
|
return text.replace("_", " ");
|
|
53
50
|
});
|
|
54
51
|
const applicationUrl = computed(() => {
|
|
55
52
|
const { url } = props.application || {};
|
|
56
|
-
if (props.active)
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
if (props.active || !url) {
|
|
54
|
+
return "";
|
|
55
|
+
}
|
|
56
|
+
if (isEngageApp.value) {
|
|
57
|
+
return rewriteEngageUrl(url);
|
|
59
58
|
}
|
|
60
59
|
return url;
|
|
61
60
|
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const ENGAGE_APP_ID = 12;
|
|
2
|
+
export declare function normalizeApplicationKey(text?: string | null): string;
|
|
3
|
+
export declare function isSameApplication(currentApplication?: string | null, applicationText?: string | null): boolean;
|
|
4
|
+
export declare function isEngageApplication(text?: string | null, id?: number | null): boolean;
|
|
5
|
+
export declare function rewriteEngageUrl(url: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const ENGAGE_ALIASES = /* @__PURE__ */ new Set(["engage", "newsletters"]);
|
|
2
|
+
export const ENGAGE_APP_ID = 12;
|
|
3
|
+
export function normalizeApplicationKey(text) {
|
|
4
|
+
const normalized = text?.toLowerCase() ?? "";
|
|
5
|
+
if (ENGAGE_ALIASES.has(normalized)) {
|
|
6
|
+
return "engage";
|
|
7
|
+
}
|
|
8
|
+
return normalized;
|
|
9
|
+
}
|
|
10
|
+
export function isSameApplication(currentApplication, applicationText) {
|
|
11
|
+
return normalizeApplicationKey(currentApplication) === normalizeApplicationKey(applicationText);
|
|
12
|
+
}
|
|
13
|
+
export function isEngageApplication(text, id) {
|
|
14
|
+
if (id === ENGAGE_APP_ID) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return ENGAGE_ALIASES.has(text?.toLowerCase() ?? "");
|
|
18
|
+
}
|
|
19
|
+
export function rewriteEngageUrl(url) {
|
|
20
|
+
return url.replace(/\/engage(?=[/?#]|$)/i, "/newsletters");
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apptegy/nuxt-navigation",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.113",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
"primevue": "^4.2.5"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@nuxt/devtools": "
|
|
40
|
-
"@nuxt/eslint-config": "
|
|
41
|
-
"@nuxt/module-builder": "
|
|
42
|
-
"@nuxt/schema": "
|
|
43
|
-
"@nuxt/test-utils": "
|
|
44
|
-
"@types/node": "
|
|
45
|
-
"eslint": "
|
|
46
|
-
"nuxt": "
|
|
39
|
+
"@nuxt/devtools": "catalog:",
|
|
40
|
+
"@nuxt/eslint-config": "catalog:",
|
|
41
|
+
"@nuxt/module-builder": "catalog:",
|
|
42
|
+
"@nuxt/schema": "catalog:",
|
|
43
|
+
"@nuxt/test-utils": "catalog:",
|
|
44
|
+
"@types/node": "catalog:",
|
|
45
|
+
"eslint": "catalog:",
|
|
46
|
+
"nuxt": "catalog:",
|
|
47
47
|
"primevue": "^4.5.4",
|
|
48
|
-
"sass": "
|
|
49
|
-
"typescript": "
|
|
50
|
-
"vitest": "
|
|
51
|
-
"vue": "
|
|
52
|
-
"vue-tsc": "
|
|
48
|
+
"sass": "catalog:",
|
|
49
|
+
"typescript": "catalog:",
|
|
50
|
+
"vitest": "catalog:",
|
|
51
|
+
"vue": "catalog:",
|
|
52
|
+
"vue-tsc": "catalog:"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "2bd06216ff7becd2e823ce76e324354b3c16b1bd"
|
|
55
55
|
}
|