@7365admin1/layer-common 4.97.1-staging.608 → 4.97.1-staging.609

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.
@@ -266,8 +266,10 @@ const props = withDefaults(
266
266
  siteId: string;
267
267
  orgId?: string;
268
268
  canEdit?: boolean;
269
+ /** Member type of `orgId`'s staff (the app hosting this card). */
270
+ memberType?: string;
269
271
  }>(),
270
- { orgId: "", canEdit: false },
272
+ { orgId: "", canEdit: false, memberType: "property_management_agency" },
271
273
  );
272
274
 
273
275
  const emit = defineEmits<{ saved: [] }>();
@@ -312,6 +314,22 @@ function notify(text: string, color: string) {
312
314
  snackbar.value = true;
313
315
  }
314
316
 
317
+ /**
318
+ * Everyone on `orgId`'s staff, page by page. The server needs `type` and caps
319
+ * `limit` at 50 (without them the list came back 400 and stayed empty). Staff
320
+ * are org-wide, so no `siteId`: that only matches members pinned to the site.
321
+ */
322
+ async function orgMembers() {
323
+ const items: any[] = [];
324
+ // ponytail: 10 pages = 500 staff; raise if an org ever has more.
325
+ for (let page = 1; page <= 10; page++) {
326
+ const res: any = await getMembers({ org: props.orgId, type: props.memberType, status: "active", page, limit: 50 });
327
+ items.push(...(res?.items ?? []));
328
+ if (!res?.pages || page >= res.pages) break;
329
+ }
330
+ return { items };
331
+ }
332
+
315
333
  async function load() {
316
334
  loading.value = true;
317
335
  try {
@@ -320,7 +338,7 @@ async function load() {
320
338
  loaded.value = !!site;
321
339
  const [p, m] = await Promise.allSettled([
322
340
  getProviders({ siteId: props.siteId, limit: 100, status: "active" }),
323
- getMembers({ siteId: props.siteId, org: props.orgId, limit: 100 }),
341
+ orgMembers(),
324
342
  ]);
325
343
  if (p.status === "fulfilled") {
326
344
  providers.value = (p.value?.items ?? []).map((i: any) => ({
@@ -48,6 +48,7 @@
48
48
  <div class="sdr-label mt-6">Data removal records</div>
49
49
  <div class="sdr-sub">Each removal, with a certificate you can give your DPO (data protection lead).</div>
50
50
  <div v-if="recordsLoading" class="sdr-sub">Loading...</div>
51
+ <div v-else-if="recordsDenied" class="sdr-sub" data-test="sdr-records-denied">Only the client that owns this site can see the removal records.</div>
51
52
  <div v-else-if="!records.length" class="sdr-sub" data-test="sdr-no-records">No records have been removed at this site.</div>
52
53
  <div v-for="r in records" :key="r._id" class="sdr-record" data-test="sdr-record">
53
54
  <div>
@@ -86,6 +87,8 @@ const { listDataPurgeRecords, downloadDataPurgeCertificate } = useDataRetention(
86
87
 
87
88
  const records = ref<Record<string, any>[]>([]);
88
89
  const recordsLoading = ref(false);
90
+ /** 403: records are for the site's owner (and Seven365) only - not "nothing removed". */
91
+ const recordsDenied = ref(false);
89
92
  const downloading = ref("");
90
93
  const error = ref("");
91
94
 
@@ -121,8 +124,9 @@ async function loadRecords() {
121
124
  recordsLoading.value = true;
122
125
  try {
123
126
  records.value = (await listDataPurgeRecords(props.siteId))?.items ?? [];
124
- } catch {
127
+ } catch (e: any) {
125
128
  records.value = [];
129
+ recordsDenied.value = (e?.statusCode ?? e?.status ?? e?.response?.status) === 403;
126
130
  } finally {
127
131
  recordsLoading.value = false;
128
132
  }
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.97.1-staging.608",
5
+ "version": "4.97.1-staging.609",
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.",