@7365admin1/layer-common 4.13.2-staging.322 → 4.13.2-staging.323

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.
@@ -98,6 +98,31 @@
98
98
  </v-row>
99
99
  </div>
100
100
 
101
+ <!--
102
+ THE SERVICE365 RESIDENT APP (owner, 2026-09-12 / 2026-09-15): a
103
+ Property Management client gets its own modules AND these. Same
104
+ switches the Client details card saves.
105
+ -->
106
+ <div v-if="inviteIncludesResidentApp(app)" class="mt-4" data-test="invite-resident-app">
107
+ <InputLabel title="Modules for Service365 (resident app)" required />
108
+ <p class="text-caption text-medium-emphasis mb-2">
109
+ Only the modules ticked here appear in this client's Service365
110
+ resident app. Each site can then turn off what it does not use.
111
+ </p>
112
+ <v-row no-gutters>
113
+ <v-col v-for="module in RESIDENT_APP_MODULES" :key="`${app}-resident-${module.value}`" cols="12" sm="6">
114
+ <v-checkbox
115
+ v-model="residentAppOn"
116
+ :value="module.value"
117
+ :label="module.label"
118
+ density="compact"
119
+ hide-details
120
+ color="primary"
121
+ />
122
+ </v-col>
123
+ </v-row>
124
+ </div>
125
+
101
126
  <!--
102
127
  THE OWNER ROLE (owner, 2026-09-15): Seven365 chooses the
103
128
  client owner's permissions with the modules. Only permissions
@@ -110,6 +135,11 @@
110
135
  {{ appTitle(app) }}. They can only give their own staff roles
111
136
  within these. Unticking a module above removes its permissions.
112
137
  </p>
138
+ <p v-if="inviteIncludesResidentApp(app)" class="text-caption text-medium-emphasis mb-2">
139
+ Service365 residents do not hold roles: the resident app shows
140
+ them only the Service365 modules ticked above. Managing those
141
+ features for residents in Property Management follows this owner role.
142
+ </p>
113
143
  <v-expansion-panels multiple variant="accordion">
114
144
  <v-expansion-panel
115
145
  v-for="(actions, resource) in roleCatalogue(app)"
@@ -222,7 +252,15 @@ import useUser from '../composables/useUser'
222
252
  import useUtils from '../composables/useUtils'
223
253
  import useOrg from '../composables/useOrg'
224
254
  import useMember from '../composables/useMember'
225
- import { catalogueStrings, inviteModuleGroups, inviteModuleKeys, inviteRoleCatalogue } from '../utils/client-invite-modules'
255
+ import {
256
+ RESIDENT_APP_MODULES,
257
+ catalogueStrings,
258
+ inviteIncludesResidentApp,
259
+ inviteModuleGroups,
260
+ inviteModuleKeys,
261
+ inviteResidentAppModules,
262
+ inviteRoleCatalogue,
263
+ } from '../utils/client-invite-modules'
226
264
  import { ALWAYS_ALLOWED_MODULES } from '../utils/org-modules'
227
265
  import { formatResourceLabel } from '../utils/permission-labels'
228
266
 
@@ -420,6 +458,10 @@ function syncModules(chosen: string[]) {
420
458
 
421
459
  syncModules(invite.value.app)
422
460
 
461
+ /** Service365 switches ticked ON; every one starts ticked. */
462
+ const allResidentAppModules = () => RESIDENT_APP_MODULES.map(module => module.value)
463
+ const residentAppOn = ref<string[]>(allResidentAppModules())
464
+
423
465
  /* ================= NEW CLIENT: OWNER ROLE ================= */
424
466
  /*
425
467
  * What Seven365 UNTICKED, per application. The owner's permissions are every
@@ -484,6 +526,7 @@ async function handleUpdateApp(value: string | null) {
484
526
  // A different application starts again: all its modules and permissions ticked.
485
527
  modulesByApp.value = {}
486
528
  uncheckedByApp.value = {}
529
+ residentAppOn.value = allResidentAppModules()
487
530
  syncModules(chosen)
488
531
  await refreshRoles()
489
532
  }
@@ -576,6 +619,9 @@ async function submit() {
576
619
  ]),
577
620
  ],
578
621
  permissions: ownerPermissions(app),
622
+ ...(inviteIncludesResidentApp(app)
623
+ ? { residentAppModules: inviteResidentAppModules(residentAppOn.value) }
624
+ : {}),
579
625
  }
580
626
  : { role: invite.value.role }),
581
627
 
@@ -23,7 +23,8 @@ export default function useUser() {
23
23
  site = '',
24
24
  siteName = '',
25
25
  modules,
26
- permissions
26
+ permissions,
27
+ residentAppModules
27
28
  }: {
28
29
  email?: string
29
30
  app?: string[]
@@ -36,6 +37,8 @@ export default function useUser() {
36
37
  modules?: string[]
37
38
  /** That client owner's permissions in the application (with modules only). */
38
39
  permissions?: string[]
40
+ /** A Property Management client's Service365 resident app switches (with modules only). */
41
+ residentAppModules?: Record<string, boolean>
39
42
  } = {}) {
40
43
  return useNuxtApp().$api<Record<string, any>>('/api/auth/invite/user', {
41
44
  method: 'POST',
@@ -48,7 +51,8 @@ export default function useUser() {
48
51
  ...(site && { siteId: site }),
49
52
  ...(siteName && { siteName }),
50
53
  ...(modules && { modules }),
51
- ...(permissions && { permissions })
54
+ ...(permissions && { permissions }),
55
+ ...(residentAppModules && { residentAppModules })
52
56
  }
53
57
  })
54
58
  }
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.13.2-staging.322",
5
+ "version": "4.13.2-staging.323",
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.",
@@ -34,6 +34,43 @@ export const NATURE_APPLICATIONS: Readonly<Record<string, readonly string[]>> =
34
34
  real_estate_developer: ["property-management"],
35
35
  });
36
36
 
37
+ /**
38
+ * THE SERVICE365 RESIDENT APP'S MODULES (owner, 2026-09-12: *"for the property
39
+ * management they must have their modules and the Service365 modules"*;
40
+ * 2026-09-15: *"once I choose the Property Management during the invitation of
41
+ * Client the Roles and Modules for Service365 Mobile app is not included"*).
42
+ *
43
+ * The switches `organizations.residentAppModules` stores (core `site.model.ts
44
+ * residentAppModuleKeys`), labelled as the resident sees the tiles. The Client
45
+ * details card (`web-app-org pages/super-admin/client-details.vue`) saves the
46
+ * same object; both read this list.
47
+ */
48
+ export const RESIDENT_APP_MODULES: readonly { value: string; label: string }[] = Object.freeze([
49
+ { value: "feedback", label: "Feedback" },
50
+ { value: "bulletin", label: "Bulletin" },
51
+ { value: "bulletinVideos", label: "Bulletin videos" },
52
+ { value: "inviteVisitors", label: "Invite visitors" },
53
+ { value: "myVisitors", label: "My visitors" },
54
+ { value: "billingAndSoa", label: "Billing and SOA" },
55
+ { value: "access", label: "Access" },
56
+ { value: "facilityBooking", label: "Facility booking" },
57
+ { value: "onlineForm", label: "Online form" },
58
+ { value: "emergencyContact", label: "Emergency contact" },
59
+ ]);
60
+
61
+ /** Does a new client of this nature get the Service365 resident app? */
62
+ export function inviteIncludesResidentApp(nature: string): boolean {
63
+ return Object.hasOwn(NATURE_APPLICATIONS, nature) && NATURE_APPLICATIONS[nature].includes("property-management");
64
+ }
65
+
66
+ /**
67
+ * The object to send: every switch explicit, `true` when ticked. Absent means
68
+ * on to the server, so a partial object could never turn a switch off again.
69
+ */
70
+ export function inviteResidentAppModules(ticked: readonly string[]): Record<string, boolean> {
71
+ return Object.fromEntries(RESIDENT_APP_MODULES.map(({ value }) => [value, ticked.includes(value)]));
72
+ }
73
+
37
74
  export type ModuleGroup = { key: string; label: string; modules: string[] };
38
75
 
39
76
  /**