@apptegy/nuxt-navigation 0.1.111 → 0.1.113-test.0

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 CHANGED
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=3.0.0"
5
5
  },
6
6
  "configKey": "@apptegy/nuxt-navigation",
7
- "version": "0.1.111",
7
+ "version": "0.1.113-test.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.1",
10
10
  "unbuild": "unknown"
@@ -29,27 +29,7 @@ type __VLS_Slots = {} & {
29
29
  } & {
30
30
  notifications?: (props: typeof __VLS_15) => any;
31
31
  };
32
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
- "selected-option": (...args: any[]) => void;
34
- "user-logout": (...args: any[]) => void;
35
- "update:notificationPanelOpen": (...args: any[]) => void;
36
- "update:activeTabId": (...args: any[]) => void;
37
- "update:activeFilterId": (...args: any[]) => void;
38
- "notifications-clear-all": (...args: any[]) => void;
39
- "notifications-dismiss": (...args: any[]) => void;
40
- "notifications-select": (...args: any[]) => void;
41
- "notification-click": (...args: any[]) => void;
42
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
43
- "onSelected-option"?: ((...args: any[]) => any) | undefined;
44
- "onUser-logout"?: ((...args: any[]) => any) | undefined;
45
- "onUpdate:notificationPanelOpen"?: ((...args: any[]) => any) | undefined;
46
- "onUpdate:activeTabId"?: ((...args: any[]) => any) | undefined;
47
- "onUpdate:activeFilterId"?: ((...args: any[]) => any) | undefined;
48
- "onNotifications-clear-all"?: ((...args: any[]) => any) | undefined;
49
- "onNotifications-dismiss"?: ((...args: any[]) => any) | undefined;
50
- "onNotifications-select"?: ((...args: any[]) => any) | undefined;
51
- "onNotification-click"?: ((...args: any[]) => any) | undefined;
52
- }>, {
32
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
53
33
  showNotifications: boolean;
54
34
  notificationsResponse: INotificationsApiResponse | null;
55
35
  notificationsLoading: boolean;
@@ -3,10 +3,10 @@ type __VLS_Props = {
3
3
  item: INotificationItem;
4
4
  };
5
5
  declare const _default: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
- select: (item: INotificationItem) => any;
7
6
  dismiss: (id: string) => any;
7
+ select: (item: INotificationItem) => any;
8
8
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
- onSelect?: ((item: INotificationItem) => any) | undefined;
10
9
  onDismiss?: ((id: string) => any) | undefined;
10
+ onSelect?: ((item: INotificationItem) => any) | undefined;
11
11
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
12
  export default _default;
@@ -8,11 +8,6 @@ type __VLS_Props = {
8
8
  mobile?: boolean;
9
9
  };
10
10
  declare const _default: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
- select: (payload: {
12
- item: INotificationsPanelData["groups"][number]["notifications"][number];
13
- tabId: string;
14
- filterId: string;
15
- }) => any;
16
11
  "update:activeTabId": (id: string) => any;
17
12
  "update:activeFilterId": (id: string) => any;
18
13
  "clear-all": (payload: {
@@ -25,13 +20,13 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, void, {}, {},
25
20
  tabId: string;
26
21
  filterId: string;
27
22
  }) => any;
28
- close: () => any;
29
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
30
- onSelect?: ((payload: {
23
+ select: (payload: {
31
24
  item: INotificationsPanelData["groups"][number]["notifications"][number];
32
25
  tabId: string;
33
26
  filterId: string;
34
- }) => any) | undefined;
27
+ }) => any;
28
+ close: () => any;
29
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
35
30
  "onUpdate:activeTabId"?: ((id: string) => any) | undefined;
36
31
  "onUpdate:activeFilterId"?: ((id: string) => any) | undefined;
37
32
  "onClear-all"?: ((payload: {
@@ -44,6 +39,11 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, void, {}, {},
44
39
  tabId: string;
45
40
  filterId: string;
46
41
  }) => any) | undefined;
42
+ onSelect?: ((payload: {
43
+ item: INotificationsPanelData["groups"][number]["notifications"][number];
44
+ tabId: string;
45
+ filterId: string;
46
+ }) => any) | undefined;
47
47
  onClose?: (() => any) | undefined;
48
48
  }>, {
49
49
  loading: boolean;
@@ -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 || currentApplication === application.text || isMobile"
58
+ v-if="expanded || isCurrentApplication(application) || isMobile"
59
59
  :application="application"
60
- :active="currentApplication === application.text"
60
+ :active="isCurrentApplication(application)"
61
61
  :collapsed="!expanded && !isMobile"
62
62
  >
63
- <slot v-if="currentApplication === application.text" />
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);
@@ -30,34 +30,31 @@
30
30
  </template>
31
31
 
32
32
  <script setup>
33
- import { useSidebar, computed, ref, useNuxtApp } from "#imports";
34
- const ENGAGE_APP_TEXT = "engage";
33
+ import { useSidebar, computed, ref } from "#imports";
34
+ import { isEngageApplication, rewriteEngageUrl } from "../../utils/application";
35
+ const NEWSLETTERS_APP_TEXT = "Newsletters";
35
36
  const props = defineProps({
36
37
  application: { type: Object, required: true },
37
38
  active: { type: Boolean, required: true },
38
39
  collapsed: { type: Boolean, required: true }
39
40
  });
40
- const { $ld } = useNuxtApp();
41
41
  const { state: expanded } = useSidebar();
42
42
  const isOpen = ref(true);
43
- const isEngageRenameEnabled = computed(() => {
44
- return Boolean($ld?.flags?.engageToNewslettersNameChange);
45
- });
46
- const isNewslettersUrlEnabled = computed(() => {
47
- return Boolean($ld?.flags?.engageToNewslettersUrlChange);
48
- });
43
+ const isEngageApp = computed(() => isEngageApplication(props.application?.text, props.application?.id));
49
44
  const appText = computed(() => {
50
45
  const { text } = props.application || {};
51
- if (text.toLowerCase() === ENGAGE_APP_TEXT && isEngageRenameEnabled.value) {
52
- return "Newsletters";
46
+ if (isEngageApp.value) {
47
+ return NEWSLETTERS_APP_TEXT;
53
48
  }
54
49
  return text.replace("_", " ");
55
50
  });
56
51
  const applicationUrl = computed(() => {
57
- const { text, url } = props.application || {};
58
- if (props.active) return "";
59
- if (text.toLowerCase() === ENGAGE_APP_TEXT && isNewslettersUrlEnabled.value) {
60
- return url.replace(/\/engage(?=[/?#]|$)/i, "/newsletters");
52
+ const { url } = props.application || {};
53
+ if (props.active || !url) {
54
+ return "";
55
+ }
56
+ if (isEngageApp.value) {
57
+ return rewriteEngageUrl(url);
61
58
  }
62
59
  return url;
63
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.111",
3
+ "version": "0.1.113-test.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -50,5 +50,6 @@
50
50
  "vitest": "catalog:",
51
51
  "vue": "catalog:",
52
52
  "vue-tsc": "catalog:"
53
- }
53
+ },
54
+ "gitHead": "cbb3596d2eefade7ab3126e47dccbed676cdcc80"
54
55
  }