@dev.smartpricing/message-composer-layer 4.5.1-next.1 → 4.5.1-next.2
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/README.md +1 -1
- package/app/components/TemplateList/BaseTable.vue +11 -0
- package/app/composables/composerContext.ts +6 -0
- package/app/composables/useMessageGroupWaba.ts +7 -4
- package/app/queries/messageGroups.ts +3 -1
- package/app/stores/appContext.ts +3 -0
- package/app/utils/testIds.const.ts +1 -0
- package/i18n/locales/de.ts +1 -0
- package/i18n/locales/en.ts +1 -0
- package/i18n/locales/es.ts +1 -0
- package/i18n/locales/fr.ts +1 -0
- package/i18n/locales/it.ts +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ watch(
|
|
|
85
85
|
)
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
**WABA.** The Host does not supply the WABA: the WABAs follow the Organization and the backend resolves them (ADR [0015](../../docs/adr/0015-message-group-waba-fixed-at-first-submission.md)). WhatsApp is configured when the Host's `channels` include `whatsapp` and the Organization has at least one WABA. A Message Group is submitted to one WABA, chosen at its first submission and fixed from then on; with several WABAs the user picks one when requesting approval. `metaWabaId` in the context is optional and is only the preselection in that picker.
|
|
88
|
+
**WABA.** The Host does not supply the WABA: the WABAs follow the Organization and the backend resolves them (ADR [0015](../../docs/adr/0015-message-group-waba-fixed-at-first-submission.md)). WhatsApp is configured when the Host's `channels` include `whatsapp` and the Organization has at least one WABA. A Message Group is submitted to one WABA, chosen at its first submission and fixed from then on; with several WABAs the user picks one when requesting approval. `metaWabaId` in the context is optional and is only the preselection in that picker. A Host that sends from one WABA only also sets `metaWabaLocked: ref(true)`: a new Message Group is then submitted to `metaWabaId` without asking, as long as it is one of the Organization's WABAs.
|
|
89
89
|
|
|
90
90
|
### Upgrading to 4.5.0
|
|
91
91
|
|
|
@@ -322,6 +322,17 @@ const paginationSummary = computed(() => {
|
|
|
322
322
|
v-model:sorting="sorting"
|
|
323
323
|
:data-testid="templateListTableTestIds.table"
|
|
324
324
|
>
|
|
325
|
+
<!-- Shown instead of the "no data" row while a list with no rows is loading. -->
|
|
326
|
+
<template #loading>
|
|
327
|
+
<div
|
|
328
|
+
class="flex items-center justify-center gap-2 text-muted"
|
|
329
|
+
:data-testid="templateListTableTestIds.loading"
|
|
330
|
+
>
|
|
331
|
+
<UIcon name="ph:circle-notch-bold" class="size-4 animate-spin" />
|
|
332
|
+
<span>{{ t('pages.message_library.loading') }}</span>
|
|
333
|
+
</div>
|
|
334
|
+
</template>
|
|
335
|
+
|
|
325
336
|
<template #name-cell="{ row }">
|
|
326
337
|
<div
|
|
327
338
|
class="flex items-center gap-2"
|
|
@@ -22,6 +22,12 @@ export interface ComposerContext {
|
|
|
22
22
|
* the Organization's (ADR 0015).
|
|
23
23
|
*/
|
|
24
24
|
metaWabaId?: Ref<string>
|
|
25
|
+
/**
|
|
26
|
+
* The Host works on `metaWabaId` only (Smartconnect): a new Message Group
|
|
27
|
+
* is submitted to it and the user is not asked. Applies while `metaWabaId`
|
|
28
|
+
* is one of the Organization's WABAs; otherwise the choice stays the user's.
|
|
29
|
+
*/
|
|
30
|
+
metaWabaLocked?: Ref<boolean>
|
|
25
31
|
isAdmin?: Ref<boolean>
|
|
26
32
|
organizationData?: Ref<OrganizationData>
|
|
27
33
|
}
|
|
@@ -9,7 +9,7 @@ import WabaSelectModal from '~/components/Composer/WabaSelectModal.vue'
|
|
|
9
9
|
*/
|
|
10
10
|
export function useMessageGroupWaba(storedWabaId: MaybeRefOrGetter<string | null | undefined>) {
|
|
11
11
|
const { data: wabas, refresh } = useOrganizationWabasQuery()
|
|
12
|
-
const { metaWabaId } = storeToRefs(useAppContextStore())
|
|
12
|
+
const { metaWabaId, metaWabaLocked } = storeToRefs(useAppContextStore())
|
|
13
13
|
const modal = useOverlay().create(WabaSelectModal)
|
|
14
14
|
|
|
15
15
|
// A submission of one language does not read the Message Group again: its
|
|
@@ -45,9 +45,10 @@ export function useMessageGroupWaba(storedWabaId: MaybeRefOrGetter<string | null
|
|
|
45
45
|
/**
|
|
46
46
|
* The WABA to name in a submission. Asks the user only at the first
|
|
47
47
|
* submission of a Message Group whose Organization has several WABAs;
|
|
48
|
-
* otherwise names none and the backend resolves it. A
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* otherwise names none and the backend resolves it. A Host that works on
|
|
49
|
+
* its own WABA only (`metaWabaLocked`) is not asked: that WABA is named.
|
|
50
|
+
* A lookup that has not answered yet is waited for; one that failed leaves
|
|
51
|
+
* it to the backend. Returns null when the user gives up.
|
|
51
52
|
*/
|
|
52
53
|
async function chooseWaba(): Promise<{ wabaId?: string } | null> {
|
|
53
54
|
if (wabaId.value) return {}
|
|
@@ -58,6 +59,8 @@ export function useMessageGroupWaba(storedWabaId: MaybeRefOrGetter<string | null
|
|
|
58
59
|
const preselected = candidates.some((candidate) => candidate.id === metaWabaId.value)
|
|
59
60
|
? metaWabaId.value
|
|
60
61
|
: undefined
|
|
62
|
+
if (preselected && metaWabaLocked.value) return { wabaId: preselected }
|
|
63
|
+
|
|
61
64
|
const chosen = await modal.open({ wabas: candidates, preselected }).result
|
|
62
65
|
|
|
63
66
|
return chosen ? { wabaId: chosen } : null
|
|
@@ -56,7 +56,9 @@ export function useMessageGroupListQuery(
|
|
|
56
56
|
// Never across Organizations: a switch must not show the previous one's rows.
|
|
57
57
|
placeholderData: (previousData, previousEntry) =>
|
|
58
58
|
previousEntry?.key.at(-1) === listOrganizationId() ? previousData : undefined,
|
|
59
|
-
|
|
59
|
+
// Until an Organization is resolved the list waits (pending, so callers
|
|
60
|
+
// show it as loading) instead of failing into an empty table.
|
|
61
|
+
enabled: () => toValue(queryOptions.enabled ?? true) && !!listOrganizationId(),
|
|
60
62
|
})
|
|
61
63
|
}
|
|
62
64
|
|
package/app/stores/appContext.ts
CHANGED
|
@@ -25,6 +25,8 @@ export const useAppContextStore = defineStore('appContext', () => {
|
|
|
25
25
|
const isAdmin = computed(() => ctx.isAdmin?.value ?? false)
|
|
26
26
|
// The Host's preselection among the Organization's WABAs (ADR 0015).
|
|
27
27
|
const metaWabaId = computed(() => ctx.metaWabaId?.value || undefined)
|
|
28
|
+
// The Host's WABA is the only one it works on: no choice is offered.
|
|
29
|
+
const metaWabaLocked = computed(() => ctx.metaWabaLocked?.value ?? false)
|
|
28
30
|
|
|
29
31
|
// Sync i18n locale when mainLanguage changes
|
|
30
32
|
watch(
|
|
@@ -58,6 +60,7 @@ export const useAppContextStore = defineStore('appContext', () => {
|
|
|
58
60
|
default_tags,
|
|
59
61
|
isAdmin,
|
|
60
62
|
metaWabaId,
|
|
63
|
+
metaWabaLocked,
|
|
61
64
|
|
|
62
65
|
validationErrors,
|
|
63
66
|
}
|
|
@@ -519,6 +519,7 @@ export const templateListTableTestIds = {
|
|
|
519
519
|
paginationSummary: 'template-list-table-pagination-summary',
|
|
520
520
|
card: 'template-list-table-card',
|
|
521
521
|
table: 'template-list-table-table',
|
|
522
|
+
loading: 'template-list-table-loading',
|
|
522
523
|
rowName: 'template-list-table-row-name',
|
|
523
524
|
rowInternalBadge: 'template-list-table-row-internal-badge',
|
|
524
525
|
rowCategoryBadge: 'template-list-table-row-category-badge',
|
package/i18n/locales/de.ts
CHANGED
|
@@ -825,6 +825,7 @@ export default {
|
|
|
825
825
|
status: 'Status',
|
|
826
826
|
updated_at: 'Aktualisiert am',
|
|
827
827
|
},
|
|
828
|
+
loading: 'Nachrichten werden geladen...',
|
|
828
829
|
pagination_summary: '{from}–{to} von {total}',
|
|
829
830
|
product_placeholder: 'Produkt auswählen',
|
|
830
831
|
render_type_placeholder: 'Render-Typ auswählen',
|
package/i18n/locales/en.ts
CHANGED
|
@@ -814,6 +814,7 @@ export default {
|
|
|
814
814
|
status: 'Status',
|
|
815
815
|
updated_at: 'Updated at',
|
|
816
816
|
},
|
|
817
|
+
loading: 'Loading messages...',
|
|
817
818
|
pagination_summary: '{from}–{to} of {total}',
|
|
818
819
|
product_placeholder: 'Select product',
|
|
819
820
|
render_type_placeholder: 'Select render type',
|
package/i18n/locales/es.ts
CHANGED
|
@@ -823,6 +823,7 @@ export default {
|
|
|
823
823
|
status: 'Estado',
|
|
824
824
|
updated_at: 'Actualizado el',
|
|
825
825
|
},
|
|
826
|
+
loading: 'Cargando mensajes...',
|
|
826
827
|
pagination_summary: '{from}–{to} de {total}',
|
|
827
828
|
product_placeholder: 'Seleccionar producto',
|
|
828
829
|
render_type_placeholder: 'Seleccionar tipo de renderizado',
|
package/i18n/locales/fr.ts
CHANGED
|
@@ -827,6 +827,7 @@ export default {
|
|
|
827
827
|
status: 'Statut',
|
|
828
828
|
updated_at: 'Mis à jour le',
|
|
829
829
|
},
|
|
830
|
+
loading: 'Chargement des messages...',
|
|
830
831
|
pagination_summary: '{from}–{to} sur {total}',
|
|
831
832
|
product_placeholder: 'Sélectionner un produit',
|
|
832
833
|
render_type_placeholder: 'Sélectionner le type de rendu',
|
package/i18n/locales/it.ts
CHANGED
|
@@ -820,6 +820,7 @@ export default {
|
|
|
820
820
|
status: 'Stato',
|
|
821
821
|
updated_at: 'Aggiornato il',
|
|
822
822
|
},
|
|
823
|
+
loading: 'Caricamento dei messaggi...',
|
|
823
824
|
pagination_summary: '{from}–{to} di {total}',
|
|
824
825
|
product_placeholder: 'Seleziona prodotto',
|
|
825
826
|
render_type_placeholder: 'Seleziona tipo di rendering',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev.smartpricing/message-composer-layer",
|
|
3
|
-
"version": "4.5.1-next.
|
|
3
|
+
"version": "4.5.1-next.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./nuxt.config.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"vue-router": "^5.0.7",
|
|
36
36
|
"vue3-emoji-picker": "^1.1.8",
|
|
37
37
|
"zod": "^4.4.3",
|
|
38
|
-
"@dev.smartpricing/message-composer-utils": "4.5.1-next.
|
|
38
|
+
"@dev.smartpricing/message-composer-utils": "4.5.1-next.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@dev.smartpricing/platform-layer": "^0.0.23",
|