@dev.smartpricing/message-composer-layer 4.1.1-smartness.1 → 4.1.3

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/api/client.ts CHANGED
@@ -20,11 +20,8 @@ export const apiClient = ofetch.create({
20
20
  if (store.authenticationToken) {
21
21
  options.headers.set('Authorization', `Bearer ${store.authenticationToken}`)
22
22
  }
23
- if (store.organization_id) {
24
- options.headers.set('sm-organization-id', store.organization_id)
25
- }
26
23
  if (store.owner_id) {
27
- options.headers.set('sm-owner', store.owner_id) // deprecated: remove after full migration
24
+ options.headers.set('sm-owner', store.owner_id)
28
25
  }
29
26
  if (store.metaWabaId) {
30
27
  options.headers.set('x-meta-waba-id', store.metaWabaId)
@@ -8,7 +8,11 @@ import type {
8
8
  GenerateTextWidgetType,
9
9
  RefineTextResponse,
10
10
  } from '@dev.smartpricing/message-composer-utils/types'
11
- import { convertToWhatsappMarkdown } from '@dev.smartpricing/message-composer-utils/utils'
11
+ import {
12
+ convertToWhatsappMarkdown,
13
+ getTipTapExtensions,
14
+ sanitizeContent,
15
+ } from '@dev.smartpricing/message-composer-utils/utils'
12
16
  import EmojiPickerButton from '../Common/EmojiPickerButton.vue'
13
17
  import DynamicDataSlideover from '../DynamicDataSlideover.vue'
14
18
  import EditorLinkPopover from './EditorLinkPopover.vue'
@@ -350,6 +354,16 @@ function isEmpty() {
350
354
  return getHtml() === '' || editor.value?.isEmpty
351
355
  }
352
356
 
357
+ function sanitizeEditor() {
358
+ const val = toValue(text)
359
+ if (!val) return
360
+ const clean = sanitizeContent(val, getTipTapExtensions({ preset: props.preset }))
361
+
362
+ if (clean !== val) {
363
+ text.value = clean
364
+ }
365
+ }
366
+
353
367
  defineExpose({
354
368
  editor,
355
369
  setFocus,
@@ -372,6 +386,8 @@ defineExpose({
372
386
  :on-update="handleUpdate as any"
373
387
  :mention="false"
374
388
  :on-blur="handleBlur"
389
+ enable-content-check
390
+ :onContentError="sanitizeEditor"
375
391
  :placeholder="$t('editor.placeholder.insert_text')"
376
392
  :data-testid="richTextEditorTestIds.editor"
377
393
  >
@@ -6,7 +6,10 @@ import type {
6
6
  } from '@dev.smartpricing/message-composer-utils/types'
7
7
  import { generateHTML } from '@tiptap/vue-3'
8
8
  import { computed } from 'vue'
9
- import { getTipTapExtensions } from '@dev.smartpricing/message-composer-utils/utils'
9
+ import {
10
+ generateWhatsappHtml,
11
+ getTipTapExtensions,
12
+ } from '@dev.smartpricing/message-composer-utils/utils'
10
13
  import { useResolvedParametersQuery } from '~/queries/compilation'
11
14
 
12
15
  defineOptions({
@@ -38,10 +41,10 @@ function replaceMentionsWithValues(html: string): string {
38
41
 
39
42
  const bodyHtml = computed(() => {
40
43
  if (!props.message.body.body.content) return ''
41
- const html = generateHTML(
42
- props.message.body.body.content,
43
- getTipTapExtensions({ preset: 'whatsapp' }),
44
- ).replaceAll('<p></p>', '<p>&nbsp;</p>')
44
+ const html = generateWhatsappHtml(props.message.body.body.content).replaceAll(
45
+ '<p></p>',
46
+ '<p>&nbsp;</p>',
47
+ )
45
48
  return replaceMentionsWithValues(html)
46
49
  })
47
50
 
@@ -7,8 +7,6 @@ export interface OrganizationData {
7
7
 
8
8
  export interface ComposerContext {
9
9
  authenticationToken: Ref<string>
10
- organization_id?: Ref<string>
11
- /** @deprecated use organization_id */
12
10
  owner_id?: Ref<string>
13
11
  product?: Ref<AppContextConfig['product']>
14
12
  strategy?: Ref<AppContextConfig['strategy']>
@@ -11,9 +11,7 @@ export const useAppContextStore = defineStore('appContext', () => {
11
11
 
12
12
  // Proxy from injection with defaults (same interface as before)
13
13
  const authenticationToken = computed(() => ctx.authenticationToken.value)
14
- const organization_id = computed(() => ctx.organization_id?.value ?? ctx.owner_id?.value ?? '')
15
- /** @deprecated use organization_id */
16
- const owner_id = computed(() => ctx.owner_id?.value ?? ctx.organization_id?.value ?? '')
14
+ const owner_id = computed(() => ctx.owner_id?.value ?? '')
17
15
  const product = computed<NonNullable<AppContextConfig['product']>>(
18
16
  () => ctx.product?.value ?? 'browser',
19
17
  )
@@ -54,7 +52,7 @@ export const useAppContextStore = defineStore('appContext', () => {
54
52
  mainLanguage: mainLanguage.value,
55
53
  metaWabaId: metaWabaId.value,
56
54
  metaAccessToken: metaAccessToken.value,
57
- organization_id: organization_id.value,
55
+ owner_id: owner_id.value,
58
56
  default_tags: default_tags.value,
59
57
  initializationSource: 'injection',
60
58
  }))
@@ -89,7 +87,6 @@ export const useAppContextStore = defineStore('appContext', () => {
89
87
  dinamicValues,
90
88
  metaWabaId,
91
89
  metaAccessToken,
92
- organization_id,
93
90
  owner_id,
94
91
  default_tags,
95
92
  isAdmin,
@@ -34,6 +34,7 @@ export const useEmailComposerStore = defineStore('emailComposer', () => {
34
34
 
35
35
  // ── Computed ──────────────────────────────────────────────────────
36
36
  const messageGroupData = computed(() => ({
37
+ user_id: '',
37
38
  name: name.value,
38
39
  category: category.value,
39
40
  visibility: isInternal.value ? 'internal' : 'public',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev.smartpricing/message-composer-layer",
3
- "version": "4.1.1-smartness.1",
3
+ "version": "4.1.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -38,7 +38,7 @@
38
38
  "vue-router": "^5.0.7",
39
39
  "vue3-emoji-picker": "^1.1.8",
40
40
  "zod": "^4.4.3",
41
- "@dev.smartpricing/message-composer-utils": "4.1.1-smartness.1"
41
+ "@dev.smartpricing/message-composer-utils": "4.1.3"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@nuxt/eslint": "^1.15.2",
@@ -53,7 +53,6 @@
53
53
  },
54
54
  "scripts": {
55
55
  "build": "nuxt build",
56
- "dev": "nuxt dev",
57
56
  "lint": "eslint app/ --fix",
58
57
  "format": "prettier --write app/",
59
58
  "typecheck": "nuxt typecheck",