@aglyn/tenant-feature-instance 1.11.0 → 1.12.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/tenant-feature-instance",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/aglyn": "1.
|
|
29
|
-
"@aglyn/shared-data-enums": "1.
|
|
30
|
-
"@aglyn/shared-ui-jsx": "1.
|
|
31
|
-
"@aglyn/shared-util-email": "1.
|
|
32
|
-
"@aglyn/shared-util-http": "1.
|
|
33
|
-
"@aglyn/shared-util-timestamp": "1.
|
|
28
|
+
"@aglyn/aglyn": "1.12.0",
|
|
29
|
+
"@aglyn/shared-data-enums": "1.12.0",
|
|
30
|
+
"@aglyn/shared-ui-jsx": "1.12.0",
|
|
31
|
+
"@aglyn/shared-util-email": "1.12.0",
|
|
32
|
+
"@aglyn/shared-util-http": "1.12.0",
|
|
33
|
+
"@aglyn/shared-util-timestamp": "1.12.0",
|
|
34
34
|
"@swc/helpers": "0.5.23",
|
|
35
35
|
"lodash-es": "^4.18.1",
|
|
36
36
|
"mobx": "^7.0.5"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { User } from 'firebase/auth';
|
|
18
|
+
/** What a person erasure's confirmation prints from the plugins' notes. */
|
|
19
|
+
export interface PersonErasureNotes {
|
|
20
|
+
/** Each sentence a plugin answered. */
|
|
21
|
+
lines: string[];
|
|
22
|
+
/** A plugin's note could not be read, so the screen says details are missing. */
|
|
23
|
+
unavailable: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* What the plugins say a person erasure keeps in a workspace (AGL-4042), from
|
|
27
|
+
* `/api/person-erasure-notes`. Nothing until it answers, and nothing for a
|
|
28
|
+
* member the route refuses, who cannot file an erasure either. Any other
|
|
29
|
+
* failure reads as `unavailable`, so a missing note never reads as nothing
|
|
30
|
+
* being kept. Never holds a confirm back.
|
|
31
|
+
*/
|
|
32
|
+
export declare function usePersonErasureNotes(user: User | null | undefined, orgId: string | null | undefined): PersonErasureNotes;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ 'use client';
|
|
17
|
+
import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
|
|
18
|
+
import { useEffect, useState } from "react";
|
|
19
|
+
const NONE = {
|
|
20
|
+
lines: [],
|
|
21
|
+
unavailable: false
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* What the plugins say a person erasure keeps in a workspace (AGL-4042), from
|
|
25
|
+
* `/api/person-erasure-notes`. Nothing until it answers, and nothing for a
|
|
26
|
+
* member the route refuses, who cannot file an erasure either. Any other
|
|
27
|
+
* failure reads as `unavailable`, so a missing note never reads as nothing
|
|
28
|
+
* being kept. Never holds a confirm back.
|
|
29
|
+
*/ export function usePersonErasureNotes(user, orgId) {
|
|
30
|
+
var _ref;
|
|
31
|
+
const [notes, setNotes] = useState(NONE);
|
|
32
|
+
const uid = (_ref = user == null ? void 0 : user.uid) != null ? _ref : '';
|
|
33
|
+
useEffect(()=>{
|
|
34
|
+
setNotes(NONE);
|
|
35
|
+
if (!user || !orgId) return;
|
|
36
|
+
let active = true;
|
|
37
|
+
void (async ()=>{
|
|
38
|
+
let answer;
|
|
39
|
+
try {
|
|
40
|
+
const response = await authorizedFetch(user, `/api/person-erasure-notes?orgId=${encodeURIComponent(orgId)}`);
|
|
41
|
+
const body = await response.json().catch(()=>null);
|
|
42
|
+
answer = response.status === 403 ? NONE : response.ok && Array.isArray(body == null ? void 0 : body.notes) ? {
|
|
43
|
+
lines: body.notes.map((note)=>note.text),
|
|
44
|
+
unavailable: Array.isArray(body.unavailable) && body.unavailable.length > 0
|
|
45
|
+
} : {
|
|
46
|
+
lines: [],
|
|
47
|
+
unavailable: true
|
|
48
|
+
};
|
|
49
|
+
} catch (unused) {
|
|
50
|
+
answer = {
|
|
51
|
+
lines: [],
|
|
52
|
+
unavailable: true
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (active) setNotes(answer);
|
|
56
|
+
})();
|
|
57
|
+
return ()=>{
|
|
58
|
+
active = false;
|
|
59
|
+
};
|
|
60
|
+
// The user object changes identity on every token refresh; its uid does not.
|
|
61
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62
|
+
}, [
|
|
63
|
+
uid,
|
|
64
|
+
orgId
|
|
65
|
+
]);
|
|
66
|
+
return notes;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=use-person-erasure-notes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/tenant/feature/instance/src/lib/hooks/use-person-erasure-notes.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n'use client'\n\nimport type { PersonErasureNotesRead } from '@aglyn/aglyn/plugin-manager/plugin-person-erasure-notes'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport type { User } from 'firebase/auth'\nimport { useEffect, useState } from 'react'\n\n/** What a person erasure's confirmation prints from the plugins' notes. */\nexport interface PersonErasureNotes {\n /** Each sentence a plugin answered. */\n lines: string[]\n /** A plugin's note could not be read, so the screen says details are missing. */\n unavailable: boolean\n}\n\nconst NONE: PersonErasureNotes = { lines: [], unavailable: false }\n\n/**\n * What the plugins say a person erasure keeps in a workspace (AGL-4042), from\n * `/api/person-erasure-notes`. Nothing until it answers, and nothing for a\n * member the route refuses, who cannot file an erasure either. Any other\n * failure reads as `unavailable`, so a missing note never reads as nothing\n * being kept. Never holds a confirm back.\n */\nexport function usePersonErasureNotes(\n user: User | null | undefined,\n orgId: string | null | undefined,\n): PersonErasureNotes {\n const [notes, setNotes] = useState<PersonErasureNotes>(NONE)\n const uid = user?.uid ?? ''\n useEffect(() => {\n setNotes(NONE)\n if (!user || !orgId) return\n let active = true\n void (async () => {\n let answer: PersonErasureNotes\n try {\n const response = await authorizedFetch(\n user,\n `/api/person-erasure-notes?orgId=${encodeURIComponent(orgId)}`,\n )\n const body = (await response.json().catch(() => null)) as PersonErasureNotesRead | null\n answer =\n response.status === 403\n ? NONE\n : response.ok && Array.isArray(body?.notes)\n ? {\n lines: body.notes.map((note) => note.text),\n unavailable: Array.isArray(body.unavailable) && body.unavailable.length > 0,\n }\n : { lines: [], unavailable: true }\n } catch {\n answer = { lines: [], unavailable: true }\n }\n if (active) setNotes(answer)\n })()\n return () => {\n active = false\n }\n // The user object changes identity on every token refresh; its uid does not.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [uid, orgId])\n return notes\n}\n"],"names":["authorizedFetch","useEffect","useState","NONE","lines","unavailable","usePersonErasureNotes","user","orgId","notes","setNotes","uid","active","answer","response","encodeURIComponent","body","json","catch","status","ok","Array","isArray","map","note","text","length"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;AAGA,SAASA,eAAe,QAAQ,2CAA0C;AAE1E,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAU3C,MAAMC,OAA2B;IAAEC,OAAO,EAAE;IAAEC,aAAa;AAAM;AAEjE;;;;;;CAMC,GACD,OAAO,SAASC,sBACdC,IAA6B,EAC7BC,KAAgC;;IAEhC,MAAM,CAACC,OAAOC,SAAS,GAAGR,SAA6BC;IACvD,MAAMQ,cAAMJ,wBAAAA,KAAMI,GAAG,mBAAI;IACzBV,UAAU;QACRS,SAASP;QACT,IAAI,CAACI,QAAQ,CAACC,OAAO;QACrB,IAAII,SAAS;QACb,KAAK,AAAC,CAAA;YACJ,IAAIC;YACJ,IAAI;gBACF,MAAMC,WAAW,MAAMd,gBACrBO,MACA,CAAC,gCAAgC,EAAEQ,mBAAmBP,QAAQ;gBAEhE,MAAMQ,OAAQ,MAAMF,SAASG,IAAI,GAAGC,KAAK,CAAC,IAAM;gBAChDL,SACEC,SAASK,MAAM,KAAK,MAChBhB,OACAW,SAASM,EAAE,IAAIC,MAAMC,OAAO,CAACN,wBAAAA,KAAMP,KAAK,IACtC;oBACEL,OAAOY,KAAKP,KAAK,CAACc,GAAG,CAAC,CAACC,OAASA,KAAKC,IAAI;oBACzCpB,aAAagB,MAAMC,OAAO,CAACN,KAAKX,WAAW,KAAKW,KAAKX,WAAW,CAACqB,MAAM,GAAG;gBAC5E,IACA;oBAAEtB,OAAO,EAAE;oBAAEC,aAAa;gBAAK;YACzC,EAAE,eAAM;gBACNQ,SAAS;oBAAET,OAAO,EAAE;oBAAEC,aAAa;gBAAK;YAC1C;YACA,IAAIO,QAAQF,SAASG;QACvB,CAAA;QACA,OAAO;YACLD,SAAS;QACX;IACA,6EAA6E;IAC7E,uDAAuD;IACzD,GAAG;QAACD;QAAKH;KAAM;IACf,OAAOC;AACT"}
|