@dev.smartpricing/message-composer-layer 4.2.11 → 4.2.12

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.
@@ -87,9 +87,7 @@ const emailEditorStore = useEmailEditorStore()
87
87
  const composerContext = useComposerContext()
88
88
  const { mutate: sendTest, isLoading: isSending, status } = useSendTestEmailMutation()
89
89
 
90
- const defaultSenderEmail = computed(
91
- () => composerContext.organizationData?.value?.senderEmail ?? '',
92
- )
90
+ const senderEmails = computed(() => composerContext.organizationData?.value?.senderEmails ?? [])
93
91
 
94
92
  const accommodationName = computed(
95
93
  () => composerContext.organizationData?.value?.accommodationName ?? '',
@@ -102,10 +100,11 @@ const state = ref<Schema>({
102
100
  })
103
101
 
104
102
  watch(
105
- defaultSenderEmail,
106
- (email) => {
107
- if (!state.value.from) {
108
- state.value.from = email
103
+ senderEmails,
104
+ (emails) => {
105
+ const [firstEmail] = emails
106
+ if (!state.value.from && firstEmail) {
107
+ state.value.from = firstEmail
109
108
  }
110
109
  },
111
110
  { immediate: true },
@@ -136,9 +135,7 @@ const schema = z.object({
136
135
  { message: t('editor.validation.error.emailInvalid') },
137
136
  ),
138
137
  sender_name: z.string().optional(),
139
- from: z.string().refine((value) => !value || isEmail(value), {
140
- message: t('editor.validation.error.emailInvalid'),
141
- }),
138
+ from: z.string().min(1, t('editor.validation.error.emailRequired')),
142
139
  })
143
140
 
144
141
  type Schema = z.output<typeof schema>
@@ -217,11 +214,16 @@ watch(status, (newStatus) => {
217
214
  :data-testid="sendTestEmailModalTestIds.toInput"
218
215
  />
219
216
  </UFormField>
220
- <UFormField name="from" :label="$t('pages.email.test_email_from')">
221
- <UInput
217
+ <UFormField
218
+ name="from"
219
+ :label="$t('pages.email.test_email_from')"
220
+ :data-testid="sendTestEmailModalTestIds.fromFormField"
221
+ >
222
+ <USelectMenu
222
223
  v-model="state.from"
223
- type="email"
224
+ :items="senderEmails"
224
225
  :placeholder="$t('pages.email.test_email_from_placeholder')"
226
+ :data-testid="sendTestEmailModalTestIds.fromSelect"
225
227
  />
226
228
  </UFormField>
227
229
  <UFormField
@@ -2,7 +2,8 @@ import type { InjectionKey, Ref } from 'vue'
2
2
  import type { AppContextConfig } from '@dev.smartpricing/message-composer-utils/types'
3
3
 
4
4
  export interface OrganizationData {
5
- senderEmail: string
5
+ /** Verified sender addresses available for the test-email "from" field, default first. */
6
+ senderEmails: string[]
6
7
  /** Tenant accommodation/property name — defaults the test-email sender name */
7
8
  accommodationName?: string
8
9
  }
@@ -331,6 +331,8 @@ export const sendTestEmailModalTestIds = {
331
331
  triggerButton: 'send-test-email-modal-trigger-button',
332
332
  toFormField: 'send-test-email-modal-to-form-field',
333
333
  toInput: 'send-test-email-modal-to-input',
334
+ fromFormField: 'send-test-email-modal-from-form-field',
335
+ fromSelect: 'send-test-email-modal-from-select',
334
336
  senderNameFormField: 'send-test-email-modal-sender-name-form-field',
335
337
  senderNameInput: 'send-test-email-modal-sender-name-input',
336
338
  cancelButton: 'send-test-email-modal-cancel-button',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev.smartpricing/message-composer-layer",
3
- "version": "4.2.11",
3
+ "version": "4.2.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -36,7 +36,7 @@
36
36
  "vue-router": "^5.0.7",
37
37
  "vue3-emoji-picker": "^1.1.8",
38
38
  "zod": "^4.4.3",
39
- "@dev.smartpricing/message-composer-utils": "4.2.11"
39
+ "@dev.smartpricing/message-composer-utils": "4.2.12"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@nuxt/eslint": "^1.15.2",