@7365admin1/layer-common 4.14.0 → 4.15.0

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,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bfc654d: Invite Client: a Property Management client also gets the Service365 resident app modules, all ticked to start
8
+
3
9
  ## 4.14.0
4
10
 
5
11
  ### Minor Changes
@@ -1125,11 +1131,11 @@
1125
1131
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
1126
1132
  own rule from two endpoints the console already calls, unprojected:
1127
1133
 
1128
- GET /api/members/user/:user/app/admin the Seven365 staff membership
1129
- GET /api/roles/id/:role that membership's role document
1134
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
1135
+ GET /api/roles/id/:role that membership's role document
1130
1136
 
1131
- owner = member.type === "admin" && role.type === "admin" && role.default === true
1132
- staff = member.type === "admin" && role.type === "admin"
1137
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
1138
+ staff = member.type === "admin" && role.type === "admin"
1133
1139
 
1134
1140
  `role.default` is the marker because it is the only property of a platform
1135
1141
  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
 
@@ -402,6 +440,10 @@ function syncModules(chosen: string[]) {
402
440
 
403
441
  syncModules(invite.value.app)
404
442
 
443
+ /** Service365 switches ticked ON; every one starts ticked. */
444
+ const allResidentAppModules = () => RESIDENT_APP_MODULES.map(module => module.value)
445
+ const residentAppOn = ref<string[]>(allResidentAppModules())
446
+
405
447
  /* ================= NEW CLIENT: OWNER ROLE ================= */
406
448
  /*
407
449
  * What Seven365 UNTICKED, per application. The owner's permissions are every
@@ -466,6 +508,7 @@ async function handleUpdateApp(value: string | null) {
466
508
  // A different application starts again: all its modules and permissions ticked.
467
509
  modulesByApp.value = {}
468
510
  uncheckedByApp.value = {}
511
+ residentAppOn.value = allResidentAppModules()
469
512
  syncModules(chosen)
470
513
  await refreshRoles()
471
514
  }
@@ -558,6 +601,9 @@ async function submit() {
558
601
  ]),
559
602
  ],
560
603
  permissions: ownerPermissions(app),
604
+ ...(inviteIncludesResidentApp(app)
605
+ ? { residentAppModules: inviteResidentAppModules(residentAppOn.value) }
606
+ : {}),
561
607
  }
562
608
  : { role: invite.value.role }),
563
609
 
@@ -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.0",
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
  /**