@dev.smartpricing/message-composer-layer 1.0.12 → 1.0.13
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/app/components/CreateTemplateButton.vue +1 -1
- package/app/components/Layout/BasePage.vue +34 -34
- package/app/composables/useGoBack.ts +1 -1
- package/app/layouts/default.vue +3 -3
- package/app/middleware/channel-guard.ts +3 -6
- package/app/pages/images.vue +5 -4
- package/app/pages/index.vue +1 -1
- package/app/pages/preview/[id].vue +1 -0
- package/app/pages/template/email/[id].vue +1 -0
- package/app/pages/template/email/create.vue +2 -0
- package/app/pages/template/whatsapp/[id].vue +2 -1
- package/app/pages/template/whatsapp/create.vue +2 -0
- package/app/types/page-meta.d.ts +7 -0
- package/package.json +2 -2
|
@@ -9,7 +9,7 @@ const { trackEvent } = useTracking()
|
|
|
9
9
|
|
|
10
10
|
function createTemplate(type: 'whatsapp' | 'email') {
|
|
11
11
|
trackEvent('message_create', { message_kind: type })
|
|
12
|
-
router.push(
|
|
12
|
+
router.push({ name: `${type}-message-create` })
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const templateOptions = computed(() => {
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
2
|
+
import type { ButtonProps, TabsItem } from '#ui/types'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
title: string
|
|
6
|
+
tabs?: TabsItem[]
|
|
7
|
+
activeTab?: string | number
|
|
8
|
+
back?: ButtonProps
|
|
9
|
+
testId?: string
|
|
10
|
+
}>()
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const emit = defineEmits<{
|
|
13
|
+
tabChange: [value: string | number]
|
|
14
|
+
}>()
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
watchEffect(() => {
|
|
17
|
+
useHead({ title: props.title })
|
|
18
|
+
})
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<template>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
<div class="flex flex-col min-h-0">
|
|
23
|
+
<SNavigationBarHeader
|
|
24
|
+
:title="title"
|
|
25
|
+
:back="back"
|
|
26
|
+
:tabs="tabs"
|
|
27
|
+
:active-tab="activeTab"
|
|
28
|
+
:data-testid="testId"
|
|
29
|
+
class="bg-white sticky top-0 z-10"
|
|
30
|
+
@tab-change="emit('tabChange', $event)"
|
|
31
|
+
>
|
|
32
|
+
<template #actions>
|
|
33
|
+
<div class="flex items-center gap-1.5">
|
|
34
|
+
<slot name="actions" />
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
</SNavigationBarHeader>
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
<div class="flex flex-col gap-4 sm:gap-6 flex-1 overflow-y-auto sm:p-4 p-4">
|
|
40
|
+
<slot />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
43
|
</template>
|
|
@@ -3,7 +3,7 @@ import type { RouteLocationRaw } from 'vue-router'
|
|
|
3
3
|
export function useGoBack() {
|
|
4
4
|
const router = useRouter()
|
|
5
5
|
|
|
6
|
-
function goBackOrFallback(fallback: RouteLocationRaw = '
|
|
6
|
+
function goBackOrFallback(fallback: RouteLocationRaw = { name: 'message-library' }) {
|
|
7
7
|
if (router.options.history.state.back) {
|
|
8
8
|
router.back()
|
|
9
9
|
} else {
|
package/app/layouts/default.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<SNavigationPage :panel-props="{ ui: { body: 'p-0 sm:p-0 gap-0 sm:gap-0 overflow-hidden' } }">
|
|
3
|
+
<slot />
|
|
4
|
+
</SNavigationPage>
|
|
5
5
|
</template>
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
export default defineNuxtRouteMiddleware((to) => {
|
|
2
2
|
const { isChannelAllowed } = useChannels()
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (!pathMatch) return
|
|
7
|
-
|
|
8
|
-
const channel = pathMatch[1] as 'whatsapp' | 'email'
|
|
4
|
+
const channel = to.meta.channel as 'whatsapp' | 'email' | undefined
|
|
5
|
+
if (!channel) return
|
|
9
6
|
|
|
10
7
|
if (!isChannelAllowed(channel)) {
|
|
11
|
-
return navigateTo('
|
|
8
|
+
return navigateTo({ name: 'message-library' }, { replace: true })
|
|
12
9
|
}
|
|
13
10
|
})
|
package/app/pages/images.vue
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
definePageMeta({
|
|
3
|
+
name: 'images',
|
|
4
|
+
})
|
|
5
|
+
|
|
2
6
|
import type { MediaFromDb } from '@dev.smartpricing/message-composer-utils/types'
|
|
3
7
|
import { useMediaQuery, useUploadToSmartchatMutation, useDeleteMediaMutation } from '~/queries'
|
|
4
8
|
import { formatDate } from '@dev.smartpricing/message-composer-utils/utils'
|
|
@@ -46,10 +50,7 @@ async function handleDelete(item: MediaFromDb) {
|
|
|
46
50
|
</script>
|
|
47
51
|
|
|
48
52
|
<template>
|
|
49
|
-
<LayoutBasePage
|
|
50
|
-
:title="t('pages.images.title')"
|
|
51
|
-
:test-id="imagesPageTestIds.navbar"
|
|
52
|
-
>
|
|
53
|
+
<LayoutBasePage :title="t('pages.images.title')" :test-id="imagesPageTestIds.navbar">
|
|
53
54
|
<div v-if="isPending" class="flex justify-center py-12">
|
|
54
55
|
<UIcon
|
|
55
56
|
name="i-heroicons-arrow-path"
|
package/app/pages/index.vue
CHANGED
|
@@ -143,7 +143,7 @@ const router = useRouter()
|
|
|
143
143
|
function navigate(row: MessageGroupWithMessageSummary) {
|
|
144
144
|
trackEvent('message_edit', getMessageTrackingProps(row))
|
|
145
145
|
const type = row.messages[0]?.render_type === 'email_v1' ? 'email' : 'whatsapp'
|
|
146
|
-
router.push(
|
|
146
|
+
router.push({ name: `${type}-message-edit`, params: { id: row.id } })
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
const { t } = useI18n()
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
definePageMeta({
|
|
3
3
|
name: 'whatsapp-message-edit',
|
|
4
4
|
middleware: ['channel-guard'],
|
|
5
|
+
channel: 'whatsapp',
|
|
5
6
|
})
|
|
6
7
|
|
|
7
8
|
import WhatsappEditorSyncWrapper from '@/components/Whatsapp/Editor/SyncWrapper.vue'
|
|
@@ -239,7 +240,7 @@ async function saveAsNew() {
|
|
|
239
240
|
const result = await createTemplate(templateData, 'draft')
|
|
240
241
|
if (result) {
|
|
241
242
|
notifyParent('TEMPLATE_SAVED_AS_NEW', { id: result.id, name: result.name })
|
|
242
|
-
navigateTo(
|
|
243
|
+
navigateTo({ name: 'whatsapp-message-edit', params: { id: result.id } }, { replace: true })
|
|
243
244
|
}
|
|
244
245
|
}
|
|
245
246
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev.smartpricing/message-composer-layer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
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.
|
|
42
|
+
"@dev.smartpricing/message-composer-utils": "3.1.13"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@nuxt/eslint": "^1.15.2",
|