@7365admin1/layer-common 4.14.0 → 4.15.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.15.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 182e513: Invite Client offers Real Estate Developer, which gets the Property Management modules and the Service365 resident app modules like a Property Management client.
8
+
9
+ ## 4.15.0
10
+
11
+ ### Minor Changes
12
+
13
+ - bfc654d: Invite Client: a Property Management client also gets the Service365 resident app modules, all ticked to start
14
+
3
15
  ## 4.14.0
4
16
 
5
17
  ### Minor Changes
@@ -1125,11 +1137,11 @@
1125
1137
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
1126
1138
  own rule from two endpoints the console already calls, unprojected:
1127
1139
 
1128
- GET /api/members/user/:user/app/admin the Seven365 staff membership
1129
- GET /api/roles/id/:role that membership's role document
1140
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
1141
+ GET /api/roles/id/:role that membership's role document
1130
1142
 
1131
- owner = member.type === "admin" && role.type === "admin" && role.default === true
1132
- staff = member.type === "admin" && role.type === "admin"
1143
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
1144
+ staff = member.type === "admin" && role.type === "admin"
1133
1145
 
1134
1146
  `role.default` is the marker because it is the only property of a platform
1135
1147
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -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
 
@@ -264,6 +302,9 @@ if (props.mode === "create") {
264
302
  /* ================= APP LIST ================= */
265
303
  const APP_LIST = [
266
304
  { title: "Property Management Agency", value: "property_management_agency" },
305
+ // Owner, 2026-09-12: a developer gets the Property Management set - its
306
+ // modules and the Service365 resident app (NATURE_APPLICATIONS).
307
+ { title: "Real Estate Developer", value: "real_estate_developer" },
267
308
  { title: "Security Agency", value: "security_agency" },
268
309
  { title: "Cleaning Services", value: "cleaning_services" },
269
310
  { title: "Mechanical & Electrical Services", value: "mechanical_electrical_services" },
@@ -402,6 +443,10 @@ function syncModules(chosen: string[]) {
402
443
 
403
444
  syncModules(invite.value.app)
404
445
 
446
+ /** Service365 switches ticked ON; every one starts ticked. */
447
+ const allResidentAppModules = () => RESIDENT_APP_MODULES.map(module => module.value)
448
+ const residentAppOn = ref<string[]>(allResidentAppModules())
449
+
405
450
  /* ================= NEW CLIENT: OWNER ROLE ================= */
406
451
  /*
407
452
  * What Seven365 UNTICKED, per application. The owner's permissions are every
@@ -466,6 +511,7 @@ async function handleUpdateApp(value: string | null) {
466
511
  // A different application starts again: all its modules and permissions ticked.
467
512
  modulesByApp.value = {}
468
513
  uncheckedByApp.value = {}
514
+ residentAppOn.value = allResidentAppModules()
469
515
  syncModules(chosen)
470
516
  await refreshRoles()
471
517
  }
@@ -558,6 +604,9 @@ async function submit() {
558
604
  ]),
559
605
  ],
560
606
  permissions: ownerPermissions(app),
607
+ ...(inviteIncludesResidentApp(app)
608
+ ? { residentAppModules: inviteResidentAppModules(residentAppOn.value) }
609
+ : {}),
561
610
  }
562
611
  : { role: invite.value.role }),
563
612
 
@@ -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.14.0",
5
+ "version": "4.15.1",
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
  /**