@7365admin1/layer-common 4.2.1-staging.258 → 4.2.1-staging.259

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.
@@ -160,6 +160,15 @@ const props = defineProps({
160
160
  type: String,
161
161
  default: "",
162
162
  },
163
+ /*
164
+ * Pre-bind the invitation to one site.
165
+ *
166
+ * This prop has been declared since the component was written and was never
167
+ * read anywhere - `invite.site` was only ever filled by the Site picker. A
168
+ * caller that already knows the site (onboarding step 6, "Invite Site Admin",
169
+ * which is about the site created in step 4) had no way to say so. It is
170
+ * wired to `invite` below.
171
+ */
163
172
  site: {
164
173
  type: Object as PropType<TCustomerSite>,
165
174
  default: () => ({
@@ -225,17 +234,34 @@ watch(
225
234
  () => {
226
235
  invite.value.org = props.org || ""
227
236
 
228
- if (props.hideApp) {
229
- invite.value.app = "property_management_agency"
230
- return
231
- }
232
-
237
+ /*
238
+ * `hideApp` HIDES the App field (see the `v-if` in the template). It also
239
+ * used to overwrite the value with a literal "property_management_agency",
240
+ * so a caller that hid the field could not choose what it was hiding, and
241
+ * every organisation - security, cleaning, landscaping - was invited into
242
+ * property management. Hiding a field is not the same as deciding it.
243
+ *
244
+ * `adminState: false` keeps its existing fallback: that flag is about the
245
+ * ORGANISATION-admin invitation, which is a separate flow, and changing it
246
+ * here would move where those members land.
247
+ */
233
248
  invite.value.app = props.adminState
234
249
  ? (props.app || "")
235
250
  : "property_management_agency"
236
251
  },
237
252
  { immediate: true }
238
253
  )
254
+
255
+ /* A caller-supplied site wins; the picker still works when there is none. */
256
+ watch(
257
+ () => props.site,
258
+ (site) => {
259
+ if (!site?.site) return
260
+ invite.value.site = site.site
261
+ invite.value.siteName = site.name || ""
262
+ },
263
+ { immediate: true, deep: true }
264
+ )
239
265
  // invite.value.app = props.app;
240
266
  // invite.value.org = props.org ?? "";
241
267
 
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.2.1-staging.258",
5
+ "version": "4.2.1-staging.259",
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.",