@apptegy/nuxt-navigation 0.1.105 → 0.1.107

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.105",
7
+ "version": "0.1.107",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.1",
10
10
  "unbuild": "unknown"
@@ -74,7 +74,7 @@
74
74
  @update:active-filter-id="handleFilterChange"
75
75
  @clear-all="(payload) => $emit('notifications-clear-all', payload)"
76
76
  @dismiss="(payload) => $emit('notifications-dismiss', payload)"
77
- @select="(payload) => $emit('notifications-select', payload)"
77
+ @select="handleNotificationSelect"
78
78
  />
79
79
  </Popover>
80
80
 
@@ -94,7 +94,7 @@
94
94
  @update:active-filter-id="handleFilterChange"
95
95
  @clear-all="(payload) => $emit('notifications-clear-all', payload)"
96
96
  @dismiss="(payload) => $emit('notifications-dismiss', payload)"
97
- @select="(payload) => $emit('notifications-select', payload)"
97
+ @select="handleNotificationSelect"
98
98
  @close="closeNotificationsPanel"
99
99
  />
100
100
  </Teleport>
@@ -230,6 +230,9 @@ watch(
230
230
  );
231
231
  watch(panelOpen, (value) => {
232
232
  emit("update:notificationPanelOpen", value);
233
+ if (!value && !isMobilePanel.value) {
234
+ popoverRef.value?.hide();
235
+ }
233
236
  });
234
237
  watch(
235
238
  () => props.activeTabId,
@@ -270,6 +273,10 @@ function onPanelHide() {
270
273
  function closeNotificationsPanel() {
271
274
  panelOpen.value = false;
272
275
  }
276
+ function handleNotificationSelect(payload) {
277
+ closeNotificationsPanel();
278
+ emit("notifications-select", payload);
279
+ }
273
280
  function handleTabChange(id) {
274
281
  activeTabId.value = id;
275
282
  emit("update:activeTabId", id);
@@ -10,8 +10,8 @@ export interface INotificationApiRecord {
10
10
  source_record_type: string;
11
11
  title: string;
12
12
  summary?: string;
13
- actors: INotificationApiActor[];
14
- detail_link?: string;
13
+ actors?: INotificationApiActor[] | null;
14
+ detail_link?: string | null;
15
15
  notification_state: NotificationApiState | string;
16
16
  created_at: string;
17
17
  }
@@ -20,7 +20,8 @@ export const DEFAULT_NOTIFICATION_TABS = [
20
20
  { id: "all", label: "All" }
21
21
  ];
22
22
  export function mapSourceRecordType(sourceRecordType) {
23
- return SOURCE_RECORD_TYPE_MAP[sourceRecordType] ?? "unknown";
23
+ const normalizedSourceRecordType = sourceRecordType.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
24
+ return SOURCE_RECORD_TYPE_MAP[normalizedSourceRecordType] ?? "unknown";
24
25
  }
25
26
  export function mapNotificationApiActor(actor) {
26
27
  const name = [actor.first_name, actor.last_name].filter(Boolean).join(" ").trim();
@@ -34,14 +35,14 @@ export function mapNotificationApiRecord(record, options) {
34
35
  return {
35
36
  id: String(record.id),
36
37
  type: mapSourceRecordType(record.source_record_type),
37
- actors: record.actors.map(mapNotificationApiActor),
38
+ actors: (record.actors ?? []).map(mapNotificationApiActor),
38
39
  actionText: record.title,
39
40
  timestampLabel: formatNotificationTimeAgo(record.created_at, {
40
41
  locale: options.locale,
41
42
  now: options.now,
42
43
  labels: {
43
44
  justNow: options.dateLabels.justNow,
44
- yesterday: options.dateLabels.yesterdayTimeAgo
45
+ yesterdayTimeAgo: options.dateLabels.yesterdayTimeAgo
45
46
  }
46
47
  }),
47
48
  createdAt: record.created_at,
@@ -49,7 +50,7 @@ export function mapNotificationApiRecord(record, options) {
49
50
  dismissed: state === "dismissed",
50
51
  read: state === "read",
51
52
  unread: state === "unread",
52
- href: record.detail_link
53
+ href: record.detail_link ?? void 0
53
54
  };
54
55
  }
55
56
  export function groupNotificationItems(items, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apptegy/nuxt-navigation",
3
- "version": "0.1.105",
3
+ "version": "0.1.107",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {