@7365admin1/layer-common 4.11.1-staging.313 → 4.11.1-staging.314

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.
@@ -16,7 +16,7 @@
16
16
  :rules="[requiredRule, emailRule]"
17
17
  :loading="loading.verifyingEmail"
18
18
  />
19
- <div v-if="existingUserMessage" class="text-subtitle-2 text-error mt-n3 mb-2">
19
+ <div v-if="existingUserMessage" class="text-subtitle-2 text-medium-emphasis mt-n3 mb-2">
20
20
  {{ existingUserMessage }}
21
21
  </div>
22
22
  </v-col>
@@ -60,7 +60,7 @@
60
60
 
61
61
  <template #subtitle>
62
62
  <span v-if="item.raw.disabled" class="text-error text-caption">
63
- Already a member
63
+ {{ APP_TAKEN_NOTE }}
64
64
  </span>
65
65
  </template>
66
66
  </v-list-item>
@@ -70,7 +70,7 @@
70
70
 
71
71
  <!-- ROLE -->
72
72
  <v-col cols="12">
73
- <InputLabel title="Role" />
73
+ <InputLabel title="Role" required />
74
74
  <v-autocomplete
75
75
  v-model="invite.role"
76
76
  :items="roles"
@@ -84,7 +84,7 @@
84
84
 
85
85
  <!-- SITE -->
86
86
  <v-col v-if="hasSite" cols="12">
87
- <InputLabel title="Site" />
87
+ <InputLabel title="Site" required />
88
88
  <v-autocomplete
89
89
  v-model="invite.site"
90
90
  :items="sites"
@@ -206,6 +206,13 @@ watch(
206
206
  { immediate: true }
207
207
  )
208
208
 
209
+ /*
210
+ * Why an app cannot be ticked. It used to say the person was already a member,
211
+ * which is not what is checked: the option is disabled when this e-mail holds a membership
212
+ * of that app type in ANY client (`getAllByUserId` below), not in this one.
213
+ */
214
+ const APP_TAKEN_NOTE = "Already uses this app in another client"
215
+
209
216
  const apps = computed(() => {
210
217
  return APP_LIST.map(app => {
211
218
  const disabled = userAccess.value.some(
@@ -218,8 +225,16 @@ const apps = computed(() => {
218
225
  /* ================= SITE ================= */
219
226
  const { natureOfBusiness } = useLocal()
220
227
 
228
+ /*
229
+ * A site can only be chosen for an organisation that exists. `invite.app` is an
230
+ * ARRAY, and this compared it to each nature's string, so the field could never
231
+ * show; and the site list was requested with no organisation at all. Inviting a
232
+ * brand-new client (the console's Invite Client) has no organisation and so no
233
+ * sites - the field stays hidden and nothing is requested.
234
+ */
221
235
  const hasSite = computed(() =>
222
- natureOfBusiness.some(i => i.value === invite.value.app)
236
+ !!org.value?._id &&
237
+ invite.value.app.some(app => natureOfBusiness.some(i => i.value === app))
223
238
  )
224
239
 
225
240
  const sites = ref<any[]>([])
@@ -227,7 +242,10 @@ const { getAll: getAllCustomerSite } = useCustomerSite()
227
242
 
228
243
  const { data: siteData, refresh: refreshSiteData } = await useLazyAsyncData(
229
244
  "sites",
230
- () => getAllCustomerSite({ org: org.value?._id, limit: 50 })
245
+ () =>
246
+ org.value?._id
247
+ ? getAllCustomerSite({ org: org.value._id, limit: 50 })
248
+ : Promise.resolve({ items: [] })
231
249
  )
232
250
 
233
251
  watchEffect(() => {
@@ -351,7 +369,10 @@ async function checkEmail(email: string) {
351
369
 
352
370
  if (user?._id) {
353
371
  existingUser.value = user
354
- existingUserMessage.value = `User already exists: ${email}`
372
+ // Not an error: an existing account can be invited, and accepting adds
373
+ // the new client to it. The old wording read as a refusal.
374
+ existingUserMessage.value =
375
+ "This e-mail already has an iService365 account. Accepting the invitation adds this client to it."
355
376
 
356
377
  const memberRes = await getAllByUserId(user._id)
357
378
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.11.1-staging.313",
5
+ "version": "4.11.1-staging.314",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",