@dev.smartpricing/message-composer-layer 1.0.21 → 1.0.23

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.
@@ -447,6 +447,8 @@ defineExpose({
447
447
  </script>
448
448
 
449
449
  <template>
450
+
451
+ <UButton @click="navigateTo('/brands')" label="brand"/>
450
452
  <UForm
451
453
  ref="templateForm"
452
454
  :schema="draftSchema"
@@ -1,39 +1,19 @@
1
- import { ref, unref, type ComputedRef } from 'vue'
2
- import { type RouteLocationRaw } from 'vue-router'
1
+ import { type ComputedRef } from 'vue'
3
2
 
4
3
  export function useExitConfirmation(shouldBlockNavigation: ComputedRef<boolean>) {
5
- const isForcingNavigation = ref(false)
6
- const isNavigatingTo = ref<RouteLocationRaw | null>(null)
7
-
8
4
  const { confirm } = useConfirm()
9
5
  const { t } = useI18n()
10
6
 
11
- // Setup route guard
12
- onBeforeRouteLeave((_to, _from, next) => {
13
- const _isForcedNavigation = unref(isForcingNavigation)
14
- isForcingNavigation.value = false
7
+ onBeforeRouteLeave(async () => {
8
+ if (!shouldBlockNavigation.value) return
15
9
 
16
- if (shouldBlockNavigation.value && !_isForcedNavigation) {
17
- isNavigatingTo.value = _to
18
- next(false)
10
+ const confirmed = await confirm({
11
+ title: t('dialogs.unsaved_changes.title'),
12
+ message: t('dialogs.unsaved_changes.message'),
13
+ confirmProps: { label: t('dialogs.unsaved_changes.leave') },
14
+ cancelProps: { label: t('dialogs.unsaved_changes.cancel') },
15
+ })
19
16
 
20
- confirm({
21
- title: t('dialogs.unsaved_changes.title'),
22
- message: t('dialogs.unsaved_changes.message'),
23
- confirmProps: { label: t('dialogs.unsaved_changes.leave') },
24
- cancelProps: { label: t('dialogs.unsaved_changes.cancel') },
25
- action: () => {
26
- const target = isNavigatingTo.value
27
- if (target) {
28
- isForcingNavigation.value = true
29
- navigateTo(target)
30
- isNavigatingTo.value = null
31
- }
32
- },
33
- })
34
- } else {
35
- isNavigatingTo.value = null
36
- next()
37
- }
17
+ if (!confirmed) return false
38
18
  })
39
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev.smartpricing/message-composer-layer",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -39,7 +39,7 @@
39
39
  "vue-router": "^5.0.6",
40
40
  "vue3-emoji-picker": "^1.1.8",
41
41
  "zod": "^4.4.1",
42
- "@dev.smartpricing/message-composer-utils": "3.1.21"
42
+ "@dev.smartpricing/message-composer-utils": "3.1.23"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@nuxt/eslint": "^1.15.2",