@fias/arche-sdk 2.31.0 → 2.33.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/dist/bridge.d.ts.map +1 -1
- package/dist/bridge.js +10 -2
- package/dist/bridge.js.map +1 -1
- package/dist/bridge.test.js +34 -0
- package/dist/bridge.test.js.map +1 -1
- package/dist/entity-ops.d.ts +6 -0
- package/dist/entity-ops.d.ts.map +1 -1
- package/dist/entity-ops.js +7 -1
- package/dist/entity-ops.js.map +1 -1
- package/dist/fias.d.ts.map +1 -1
- package/dist/fias.js +5 -1
- package/dist/fias.js.map +1 -1
- package/dist/generated/permissions.d.ts +1 -1
- package/dist/generated/permissions.d.ts.map +1 -1
- package/dist/generated/permissions.js +6 -0
- package/dist/generated/permissions.js.map +1 -1
- package/dist/hooks.d.ts +43 -4
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +134 -20
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.test.js +110 -0
- package/dist/hooks.test.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +150 -30
- package/dist/theme-brand.test.d.ts +2 -0
- package/dist/theme-brand.test.d.ts.map +1 -0
- package/dist/theme-brand.test.js +47 -0
- package/dist/theme-brand.test.js.map +1 -0
- package/dist/theme.d.ts +9 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +34 -0
- package/dist/theme.js.map +1 -1
- package/dist/types.d.ts +318 -14
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/templates/default/AGENTS.md +127 -9
- package/templates/default/CLAUDE.md +127 -9
package/dist/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArcheHandoffPayload, FiasUser, FiasTheme, FiasStorageApi, DataSubscriptionState, EntitySubscriptionState, EntityInvocationApi, FiasTextModel, FiasHolder, ClientEntityApi, ImageGenerationApi, ImageEntityFilter, ImageEntitySummary, NllbLanguageOption, AudioGenerationApi, FiasNavigationApi, StepNavigationApi, StepNavigationOptions, FiasDataStoreApi, FiasWorkspacesApi, FiasAccessState, FiasStoreApi, VaultDocumentsApi, VaultDocumentDownloadUrl, VaultUserDocumentSaveContentResult, ArcheAssetsApi, FiasConnectionsApi, FiasCreativeLibraryApi, FiasXApi, FiasLinkedInApi, FiasSchedulesApi, ArcheAssetBytesApi, ArcheAssetErrorCode, FiasContentApi, FiasContentErrorCode, FiasLocalStoreApi, FiasLocalStoreErrorCode, CommunityAssetsApi, CompanyEmailApi, FiasAIActionsDeclaration, FiasChromeApi, FiasOpenerApi } from './types';
|
|
1
|
+
import type { ArcheHandoffPayload, FiasUser, FiasTheme, FiasStorageApi, DataSubscriptionState, EntitySubscriptionState, EntityInvocationApi, FiasTextModel, FiasHolder, ClientEntityApi, ImageGenerationApi, ImageEntityFilter, ImageEntitySummary, NllbLanguageOption, AudioGenerationApi, FiasNavigationApi, StepNavigationApi, StepNavigationOptions, FiasDataStoreApi, FiasWorkspacesApi, FiasAccessState, FiasStoreApi, VaultDocumentsApi, VaultDocumentDownloadUrl, VaultUserDocumentSaveContentResult, ArcheAssetsApi, FiasConnectionsApi, FiasWebSourcesApi, FiasCreativeLibraryApi, FiasXApi, FiasLinkedInApi, FiasSchedulesApi, ArcheAssetBytesApi, ArcheAssetErrorCode, FiasContentApi, FiasContentErrorCode, FiasLocalStoreApi, FiasLocalStoreErrorCode, CommunityAssetsApi, CompanyEmailApi, FiasAIActionsDeclaration, FiasChromeApi, FiasOpenerApi } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Access the current user's profile information.
|
|
4
4
|
* Requires the `user:profile:read` permission in fias-plugin.json.
|
|
@@ -353,7 +353,8 @@ export declare function useFiasDataStore(): FiasDataStoreApi;
|
|
|
353
353
|
* @example
|
|
354
354
|
* const workspaces = useFiasWorkspaces();
|
|
355
355
|
* const ws = await workspaces.create('Acme Corp');
|
|
356
|
-
*
|
|
356
|
+
* // a person picks who to add, in a sheet Fias draws (ADR-040):
|
|
357
|
+
* const { added } = await workspaces.addPeople(ws.workspaceId);
|
|
357
358
|
* // or, inside a Fias org workspace, its members' shared space:
|
|
358
359
|
* const shared = await workspaces.openForWorkspace();
|
|
359
360
|
* // then, with useFiasDataStore():
|
|
@@ -947,6 +948,43 @@ export declare function useCreativeLibrary(): FiasCreativeLibraryApi;
|
|
|
947
948
|
* const x = accounts.find((a) => a.provider === 'x') ?? (await connections.connect('x'));
|
|
948
949
|
*/
|
|
949
950
|
export declare function useFiasConnections(): FiasConnectionsApi;
|
|
951
|
+
/**
|
|
952
|
+
* Pages on websites Fias approved, read as DATA (ADR-038). Requires
|
|
953
|
+
* `web:sources:read`.
|
|
954
|
+
*
|
|
955
|
+
* The app names a page on an approved site and a form — the fields it wants —
|
|
956
|
+
* and gets back values of those kinds (numbers, dates, yes/no, the app's own
|
|
957
|
+
* choices, lists of them), each `null` when the page does not say. It never
|
|
958
|
+
* receives the page's text, not even a short label. One copy of each page serves every app, fetched at most
|
|
959
|
+
* once an hour; a fresh fetch and its reading are charged to the user (well
|
|
960
|
+
* under a cent for a typical page), and a cached result is free. Where a
|
|
961
|
+
* wrong number matters, ask for `reads: 2`: the page is read twice and only
|
|
962
|
+
* what both readings agree on comes back; the rest is null and named in
|
|
963
|
+
* `disagreed`.
|
|
964
|
+
*
|
|
965
|
+
* @example
|
|
966
|
+
* const web = useFiasWebSources();
|
|
967
|
+
* const result = await web.extract<{
|
|
968
|
+
* rates: Array<{ termMonths: number | null; ira: boolean | null; apy: number | null }>;
|
|
969
|
+
* }>({
|
|
970
|
+
* url: 'https://www.becu.org/everyday-banking/certificates',
|
|
971
|
+
* form: {
|
|
972
|
+
* description: 'Share certificate rates',
|
|
973
|
+
* fields: {
|
|
974
|
+
* rates: {
|
|
975
|
+
* kind: 'list',
|
|
976
|
+
* item: {
|
|
977
|
+
* termMonths: { kind: 'integer', min: 1, max: 120, description: 'Term in months' },
|
|
978
|
+
* ira: { kind: 'boolean', description: 'An IRA certificate' },
|
|
979
|
+
* apy: { kind: 'number', min: 0, max: 25, description: 'APY in percent' },
|
|
980
|
+
* },
|
|
981
|
+
* },
|
|
982
|
+
* },
|
|
983
|
+
* },
|
|
984
|
+
* });
|
|
985
|
+
* // Show result.site.name and result.fetchedAt beside the figures.
|
|
986
|
+
*/
|
|
987
|
+
export declare function useFiasWebSources(): FiasWebSourcesApi;
|
|
950
988
|
/**
|
|
951
989
|
* X, as an account the workspace this app is open in let it use (ADR-029 §3).
|
|
952
990
|
*
|
|
@@ -1010,7 +1048,8 @@ export declare function useFiasLinkedIn(): FiasLinkedInApi;
|
|
|
1010
1048
|
* The From address is always the Company's — you only choose recipients and
|
|
1011
1049
|
* content.
|
|
1012
1050
|
*
|
|
1013
|
-
* Name members by
|
|
1051
|
+
* Name members by their ref (`useFiasUser().ref`, or refs you stored); you
|
|
1052
|
+
* never see their addresses. Every email carries
|
|
1014
1053
|
* a one-click unsubscribe, and people who used it are skipped (`muted`).
|
|
1015
1054
|
*
|
|
1016
1055
|
* @example
|
|
@@ -1018,7 +1057,7 @@ export declare function useFiasLinkedIn(): FiasLinkedInApi;
|
|
|
1018
1057
|
* const email = useCompanyEmail();
|
|
1019
1058
|
* const result = await email.send({
|
|
1020
1059
|
* requestKey: `digest-${weekId}`,
|
|
1021
|
-
* to:
|
|
1060
|
+
* to: assigneeRefs.map((ref) => ({ ref })),
|
|
1022
1061
|
* subject: 'Your weekly digest',
|
|
1023
1062
|
* text: digestText,
|
|
1024
1063
|
* html: digestHtml,
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EAInB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MAAM,EAClB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5C,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,IAAI,eAAe,CAgCjD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG;IACpE,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B,CA0DA"}
|
package/dist/hooks.js
CHANGED
|
@@ -35,6 +35,7 @@ exports.useDataSubscription = useDataSubscription;
|
|
|
35
35
|
exports.useVaultUserDocuments = useVaultUserDocuments;
|
|
36
36
|
exports.useCreativeLibrary = useCreativeLibrary;
|
|
37
37
|
exports.useFiasConnections = useFiasConnections;
|
|
38
|
+
exports.useFiasWebSources = useFiasWebSources;
|
|
38
39
|
exports.useFiasX = useFiasX;
|
|
39
40
|
exports.useFiasSchedules = useFiasSchedules;
|
|
40
41
|
exports.useFiasLinkedIn = useFiasLinkedIn;
|
|
@@ -108,6 +109,8 @@ function createDebouncedWriter(bridge) {
|
|
|
108
109
|
}
|
|
109
110
|
return { schedule, flush };
|
|
110
111
|
}
|
|
112
|
+
/** The platform's `resolve_people` limit per call; `resolvePeople` pages above it. */
|
|
113
|
+
const RESOLVE_PEOPLE_PAGE = 100;
|
|
111
114
|
/**
|
|
112
115
|
* Access the current user's profile information.
|
|
113
116
|
* Requires the `user:profile:read` permission in fias-plugin.json.
|
|
@@ -439,6 +442,20 @@ function useImageEntities(filter) {
|
|
|
439
442
|
* run, so we use the same 2-minute ceiling as the image/audio surfaces.
|
|
440
443
|
*/
|
|
441
444
|
const CLIENT_ENTITY_INVOKE_TIMEOUT_MS = 120000;
|
|
445
|
+
/**
|
|
446
|
+
* Whether a `client_entity_invoke` failed because the host has no executor
|
|
447
|
+
* for the entity (an older Fias, or the dev harness): the capability is simply
|
|
448
|
+
* not available there. Hosts answer `CLIENT_ENTITY_UNAVAILABLE`; older ones
|
|
449
|
+
* only said so in the message ("no client-side executor …"), which is still
|
|
450
|
+
* recognised. Any other bridge error is the app's to fix.
|
|
451
|
+
*/
|
|
452
|
+
function isClientEntityUnavailable(err) {
|
|
453
|
+
if (!(err instanceof bridge_1.FiasBridgeError))
|
|
454
|
+
return false;
|
|
455
|
+
if (err.code === 'CLIENT_ENTITY_UNAVAILABLE')
|
|
456
|
+
return true;
|
|
457
|
+
return err.code === 'BRIDGE_ERROR' && err.message.includes('no client-side executor');
|
|
458
|
+
}
|
|
442
459
|
/**
|
|
443
460
|
* Invoke a client-side ("on-device") entity through the bridge's generic
|
|
444
461
|
* `client_entity_invoke` op. Client-side entities execute entirely in the
|
|
@@ -894,9 +911,7 @@ function useOpener() {
|
|
|
894
911
|
}
|
|
895
912
|
catch (err) {
|
|
896
913
|
// A host without it (an older Fias, the dev harness).
|
|
897
|
-
if (err
|
|
898
|
-
err.code === 'BRIDGE_ERROR' &&
|
|
899
|
-
err.message.includes('no client-side executor')) {
|
|
914
|
+
if (isClientEntityUnavailable(err)) {
|
|
900
915
|
throw new bridge_1.FiasBridgeError('Sending to another arche is not available here', 'SEND_UNAVAILABLE');
|
|
901
916
|
}
|
|
902
917
|
throw err;
|
|
@@ -1040,6 +1055,7 @@ function useFiasDataStore() {
|
|
|
1040
1055
|
version: res?.version,
|
|
1041
1056
|
...(res?.key !== undefined ? { key: res.key } : {}),
|
|
1042
1057
|
...(res?.audience !== undefined ? { audience: res.audience } : {}),
|
|
1058
|
+
...(res?.attestation !== undefined ? { attestation: res.attestation } : {}),
|
|
1043
1059
|
};
|
|
1044
1060
|
}, [bridge]);
|
|
1045
1061
|
const create = (0, react_1.useCallback)(async (collection, data, options) => {
|
|
@@ -1077,6 +1093,7 @@ function useFiasDataStore() {
|
|
|
1077
1093
|
? { authoredByCollaborator: res.authoredByCollaborator }
|
|
1078
1094
|
: {}),
|
|
1079
1095
|
...(res.audience !== undefined ? { audience: res.audience } : {}),
|
|
1096
|
+
...(res.attestation !== undefined ? { attestation: res.attestation } : {}),
|
|
1080
1097
|
};
|
|
1081
1098
|
}, [bridge]);
|
|
1082
1099
|
const query = (0, react_1.useCallback)(async (collection, options, scope) => {
|
|
@@ -1145,6 +1162,17 @@ function useFiasDataStore() {
|
|
|
1145
1162
|
batch,
|
|
1146
1163
|
]);
|
|
1147
1164
|
}
|
|
1165
|
+
/** A member target on the wire: a typed username, or the app's ref (ADR-040 §4). */
|
|
1166
|
+
function memberTargetPayload(member) {
|
|
1167
|
+
if (typeof member === 'string')
|
|
1168
|
+
return { username: member };
|
|
1169
|
+
if (member && typeof member === 'object' && typeof member.ref === 'string') {
|
|
1170
|
+
return { ref: member.ref };
|
|
1171
|
+
}
|
|
1172
|
+
// Most often `m.username` from a roster: apps created after app user refs
|
|
1173
|
+
// get `ref` there instead (ADR-040 §4).
|
|
1174
|
+
throw new Error('useFiasWorkspaces: name the member by { ref } from listMembers() (or a username a person typed)');
|
|
1175
|
+
}
|
|
1148
1176
|
/**
|
|
1149
1177
|
* Access workspace tenancy — team/org workspaces with role-gated membership
|
|
1150
1178
|
* (owner/admin/member/viewer) over `workspace`-scoped Data Store collections
|
|
@@ -1158,7 +1186,8 @@ function useFiasDataStore() {
|
|
|
1158
1186
|
* @example
|
|
1159
1187
|
* const workspaces = useFiasWorkspaces();
|
|
1160
1188
|
* const ws = await workspaces.create('Acme Corp');
|
|
1161
|
-
*
|
|
1189
|
+
* // a person picks who to add, in a sheet Fias draws (ADR-040):
|
|
1190
|
+
* const { added } = await workspaces.addPeople(ws.workspaceId);
|
|
1162
1191
|
* // or, inside a Fias org workspace, its members' shared space:
|
|
1163
1192
|
* const shared = await workspaces.openForWorkspace();
|
|
1164
1193
|
* // then, with useFiasDataStore():
|
|
@@ -1189,10 +1218,41 @@ function useFiasWorkspaces() {
|
|
|
1189
1218
|
const archive = (0, react_1.useCallback)(async (workspaceId) => {
|
|
1190
1219
|
await (0, entity_ops_1.invokeEntityOp)(bridge, entity_ops_1.PLUGIN_WORKSPACES_ENTITY_ID, 'archive', { workspaceId });
|
|
1191
1220
|
}, [bridge]);
|
|
1221
|
+
const resolvePeople = (0, react_1.useCallback)(async (refs, workspaceId) => {
|
|
1222
|
+
// Any length, in order: nothing to ask for an empty list, and the
|
|
1223
|
+
// platform's 100-per-call limit is the SDK's to page, not the app's.
|
|
1224
|
+
const people = [];
|
|
1225
|
+
for (let i = 0; i < refs.length; i += RESOLVE_PEOPLE_PAGE) {
|
|
1226
|
+
const page = refs.slice(i, i + RESOLVE_PEOPLE_PAGE);
|
|
1227
|
+
const res = await (0, entity_ops_1.invokeEntityOp)(bridge, entity_ops_1.PLUGIN_WORKSPACES_ENTITY_ID, 'resolve_people', workspaceId === undefined ? { refs: page } : { refs: page, workspaceId });
|
|
1228
|
+
people.push(...res.people);
|
|
1229
|
+
}
|
|
1230
|
+
return people;
|
|
1231
|
+
}, [bridge]);
|
|
1192
1232
|
const listMembers = (0, react_1.useCallback)(async (workspaceId) => {
|
|
1193
1233
|
const res = await (0, entity_ops_1.invokeEntityOp)(bridge, entity_ops_1.PLUGIN_WORKSPACES_ENTITY_ID, 'list_members', { workspaceId });
|
|
1194
1234
|
return res.members;
|
|
1195
1235
|
}, [bridge]);
|
|
1236
|
+
const addPeople = (0, react_1.useCallback)(async (workspaceId, options) => {
|
|
1237
|
+
let answer;
|
|
1238
|
+
try {
|
|
1239
|
+
answer = await bridge.request('client_entity_invoke', {
|
|
1240
|
+
entityId: entity_ops_1.WORKSPACE_ADD_PEOPLE_ENTITY_ID,
|
|
1241
|
+
input: options?.role ? { workspaceId, role: options.role } : { workspaceId },
|
|
1242
|
+
}, ADD_PEOPLE_SHEET_TIMEOUT_MS);
|
|
1243
|
+
}
|
|
1244
|
+
catch (err) {
|
|
1245
|
+
// A host without the sheet (an older Fias or dev harness) has no
|
|
1246
|
+
// executor for it: the sheet is simply not available there.
|
|
1247
|
+
if (isClientEntityUnavailable(err)) {
|
|
1248
|
+
throw new bridge_1.FiasBridgeError('Adding people is not available here', 'ADD_PEOPLE_UNAVAILABLE');
|
|
1249
|
+
}
|
|
1250
|
+
throw err;
|
|
1251
|
+
}
|
|
1252
|
+
if ('error' in answer)
|
|
1253
|
+
throw new bridge_1.FiasBridgeError(answer.error.message, answer.error.code);
|
|
1254
|
+
return { added: answer.added };
|
|
1255
|
+
}, [bridge]);
|
|
1196
1256
|
const addMember = (0, react_1.useCallback)(async (workspaceId, username, role, expiresAt) => {
|
|
1197
1257
|
const res = await (0, entity_ops_1.invokeEntityOp)(bridge, entity_ops_1.PLUGIN_WORKSPACES_ENTITY_ID, 'add_member', {
|
|
1198
1258
|
workspaceId,
|
|
@@ -1202,14 +1262,14 @@ function useFiasWorkspaces() {
|
|
|
1202
1262
|
});
|
|
1203
1263
|
return res.member;
|
|
1204
1264
|
}, [bridge]);
|
|
1205
|
-
const updateMember = (0, react_1.useCallback)(async (workspaceId,
|
|
1206
|
-
const res = await (0, entity_ops_1.invokeEntityOp)(bridge, entity_ops_1.PLUGIN_WORKSPACES_ENTITY_ID, 'update_member', { workspaceId,
|
|
1265
|
+
const updateMember = (0, react_1.useCallback)(async (workspaceId, member, role) => {
|
|
1266
|
+
const res = await (0, entity_ops_1.invokeEntityOp)(bridge, entity_ops_1.PLUGIN_WORKSPACES_ENTITY_ID, 'update_member', { workspaceId, ...memberTargetPayload(member), role });
|
|
1207
1267
|
return res.member;
|
|
1208
1268
|
}, [bridge]);
|
|
1209
|
-
const removeMember = (0, react_1.useCallback)(async (workspaceId,
|
|
1269
|
+
const removeMember = (0, react_1.useCallback)(async (workspaceId, member) => {
|
|
1210
1270
|
await (0, entity_ops_1.invokeEntityOp)(bridge, entity_ops_1.PLUGIN_WORKSPACES_ENTITY_ID, 'remove_member', {
|
|
1211
1271
|
workspaceId,
|
|
1212
|
-
|
|
1272
|
+
...memberTargetPayload(member),
|
|
1213
1273
|
});
|
|
1214
1274
|
}, [bridge]);
|
|
1215
1275
|
return (0, react_1.useMemo)(() => ({
|
|
@@ -1219,9 +1279,11 @@ function useFiasWorkspaces() {
|
|
|
1219
1279
|
get,
|
|
1220
1280
|
archive,
|
|
1221
1281
|
listMembers,
|
|
1282
|
+
addPeople,
|
|
1222
1283
|
addMember,
|
|
1223
1284
|
updateMember,
|
|
1224
1285
|
removeMember,
|
|
1286
|
+
resolvePeople,
|
|
1225
1287
|
}), [
|
|
1226
1288
|
create,
|
|
1227
1289
|
openForWorkspace,
|
|
@@ -1229,9 +1291,11 @@ function useFiasWorkspaces() {
|
|
|
1229
1291
|
get,
|
|
1230
1292
|
archive,
|
|
1231
1293
|
listMembers,
|
|
1294
|
+
addPeople,
|
|
1232
1295
|
addMember,
|
|
1233
1296
|
updateMember,
|
|
1234
1297
|
removeMember,
|
|
1298
|
+
resolvePeople,
|
|
1235
1299
|
]);
|
|
1236
1300
|
}
|
|
1237
1301
|
/** The refusals that mean "no access here" — the workspaces `get` verb's two answers. */
|
|
@@ -1316,13 +1380,10 @@ function useFiasAccess(workspaceId) {
|
|
|
1316
1380
|
}
|
|
1317
1381
|
catch (err) {
|
|
1318
1382
|
// A host without the sheet (an older Fias, or an older dev harness) has
|
|
1319
|
-
// no executor for it
|
|
1320
|
-
//
|
|
1321
|
-
//
|
|
1322
|
-
|
|
1323
|
-
if (err instanceof bridge_1.FiasBridgeError &&
|
|
1324
|
-
err.code === 'BRIDGE_ERROR' &&
|
|
1325
|
-
err.message.includes('no client-side executor')) {
|
|
1383
|
+
// no executor for it: the sheet is simply not available. Any other
|
|
1384
|
+
// bridge error (a missing permission, a call loop) is the app's to fix,
|
|
1385
|
+
// so it passes through unchanged.
|
|
1386
|
+
if (isClientEntityUnavailable(err)) {
|
|
1326
1387
|
throw new bridge_1.FiasBridgeError('Managing access is not available here', 'ACCESS_UNAVAILABLE');
|
|
1327
1388
|
}
|
|
1328
1389
|
throw err;
|
|
@@ -1366,6 +1427,8 @@ const lastAccessAnswers = new Map();
|
|
|
1366
1427
|
const FOCUS_REFETCH_MIN_MS = 30000;
|
|
1367
1428
|
/** How long a person may keep the access sheet open before the call gives up. */
|
|
1368
1429
|
const ACCESS_SHEET_TIMEOUT_MS = 30 * 60 * 1000;
|
|
1430
|
+
/** The Add people sheet waits on a person, like the access sheet. */
|
|
1431
|
+
const ADD_PEOPLE_SHEET_TIMEOUT_MS = ACCESS_SHEET_TIMEOUT_MS;
|
|
1369
1432
|
const sharedAccessByBridge = new WeakMap();
|
|
1370
1433
|
function peekSharedAccess(bridge, workspaceId) {
|
|
1371
1434
|
return sharedAccessByBridge.get(bridge)?.get(workspaceId);
|
|
@@ -3069,9 +3132,7 @@ function useCreativeLibrary() {
|
|
|
3069
3132
|
catch (err) {
|
|
3070
3133
|
// A host without the picker (an older Fias, the dev harness) has no
|
|
3071
3134
|
// executor for it: the picker is simply not available there.
|
|
3072
|
-
if (err
|
|
3073
|
-
err.code === 'BRIDGE_ERROR' &&
|
|
3074
|
-
err.message.includes('no client-side executor')) {
|
|
3135
|
+
if (isClientEntityUnavailable(err)) {
|
|
3075
3136
|
throw new bridge_1.FiasBridgeError('The Creative Library picker is not available here', 'PICKER_UNAVAILABLE');
|
|
3076
3137
|
}
|
|
3077
3138
|
throw err;
|
|
@@ -3118,6 +3179,58 @@ function useFiasConnections() {
|
|
|
3118
3179
|
}, [bridge]);
|
|
3119
3180
|
return (0, react_1.useMemo)(() => ({ list, connect, release }), [list, connect, release]);
|
|
3120
3181
|
}
|
|
3182
|
+
/**
|
|
3183
|
+
* Pages on websites Fias approved, read as DATA (ADR-038). Requires
|
|
3184
|
+
* `web:sources:read`.
|
|
3185
|
+
*
|
|
3186
|
+
* The app names a page on an approved site and a form — the fields it wants —
|
|
3187
|
+
* and gets back values of those kinds (numbers, dates, yes/no, the app's own
|
|
3188
|
+
* choices, lists of them), each `null` when the page does not say. It never
|
|
3189
|
+
* receives the page's text, not even a short label. One copy of each page serves every app, fetched at most
|
|
3190
|
+
* once an hour; a fresh fetch and its reading are charged to the user (well
|
|
3191
|
+
* under a cent for a typical page), and a cached result is free. Where a
|
|
3192
|
+
* wrong number matters, ask for `reads: 2`: the page is read twice and only
|
|
3193
|
+
* what both readings agree on comes back; the rest is null and named in
|
|
3194
|
+
* `disagreed`.
|
|
3195
|
+
*
|
|
3196
|
+
* @example
|
|
3197
|
+
* const web = useFiasWebSources();
|
|
3198
|
+
* const result = await web.extract<{
|
|
3199
|
+
* rates: Array<{ termMonths: number | null; ira: boolean | null; apy: number | null }>;
|
|
3200
|
+
* }>({
|
|
3201
|
+
* url: 'https://www.becu.org/everyday-banking/certificates',
|
|
3202
|
+
* form: {
|
|
3203
|
+
* description: 'Share certificate rates',
|
|
3204
|
+
* fields: {
|
|
3205
|
+
* rates: {
|
|
3206
|
+
* kind: 'list',
|
|
3207
|
+
* item: {
|
|
3208
|
+
* termMonths: { kind: 'integer', min: 1, max: 120, description: 'Term in months' },
|
|
3209
|
+
* ira: { kind: 'boolean', description: 'An IRA certificate' },
|
|
3210
|
+
* apy: { kind: 'number', min: 0, max: 25, description: 'APY in percent' },
|
|
3211
|
+
* },
|
|
3212
|
+
* },
|
|
3213
|
+
* },
|
|
3214
|
+
* },
|
|
3215
|
+
* });
|
|
3216
|
+
* // Show result.site.name and result.fetchedAt beside the figures.
|
|
3217
|
+
*/
|
|
3218
|
+
function useFiasWebSources() {
|
|
3219
|
+
const bridge = useBridge();
|
|
3220
|
+
const listSites = (0, react_1.useCallback)(async (options) => (0, entity_ops_1.invokeEntityOp)(bridge, entity_ops_1.WEB_SOURCES_ENTITY_ID, 'list_sites', {
|
|
3221
|
+
...(options?.category !== undefined ? { category: options.category } : {}),
|
|
3222
|
+
...(options?.search !== undefined ? { search: options.search } : {}),
|
|
3223
|
+
...(options?.limit !== undefined ? { limit: options.limit } : {}),
|
|
3224
|
+
...(options?.offset !== undefined ? { offset: options.offset } : {}),
|
|
3225
|
+
}), [bridge]);
|
|
3226
|
+
const extract = (0, react_1.useCallback)(async (request) => (0, entity_ops_1.invokeEntityOp)(bridge, entity_ops_1.WEB_SOURCES_ENTITY_ID, 'extract', {
|
|
3227
|
+
url: request.url,
|
|
3228
|
+
form: request.form,
|
|
3229
|
+
...(request.maxAgeSeconds !== undefined ? { maxAgeSeconds: request.maxAgeSeconds } : {}),
|
|
3230
|
+
...(request.reads !== undefined ? { reads: request.reads } : {}),
|
|
3231
|
+
}), [bridge]);
|
|
3232
|
+
return (0, react_1.useMemo)(() => ({ listSites, extract }), [listSites, extract]);
|
|
3233
|
+
}
|
|
3121
3234
|
/**
|
|
3122
3235
|
* X, as an account the workspace this app is open in let it use (ADR-029 §3).
|
|
3123
3236
|
*
|
|
@@ -3222,7 +3335,8 @@ function useFiasLinkedIn() {
|
|
|
3222
3335
|
* The From address is always the Company's — you only choose recipients and
|
|
3223
3336
|
* content.
|
|
3224
3337
|
*
|
|
3225
|
-
* Name members by
|
|
3338
|
+
* Name members by their ref (`useFiasUser().ref`, or refs you stored); you
|
|
3339
|
+
* never see their addresses. Every email carries
|
|
3226
3340
|
* a one-click unsubscribe, and people who used it are skipped (`muted`).
|
|
3227
3341
|
*
|
|
3228
3342
|
* @example
|
|
@@ -3230,7 +3344,7 @@ function useFiasLinkedIn() {
|
|
|
3230
3344
|
* const email = useCompanyEmail();
|
|
3231
3345
|
* const result = await email.send({
|
|
3232
3346
|
* requestKey: `digest-${weekId}`,
|
|
3233
|
-
* to:
|
|
3347
|
+
* to: assigneeRefs.map((ref) => ({ ref })),
|
|
3234
3348
|
* subject: 'Your weekly digest',
|
|
3235
3349
|
* text: digestText,
|
|
3236
3350
|
* html: digestHtml,
|