@ateam-ai-mobile/core 0.1.16 → 0.1.17
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/index.d.mts +68 -1
- package/dist/index.d.ts +68 -1
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +21 -0
- package/src/notifications/api.ts +161 -0
package/dist/index.d.mts
CHANGED
|
@@ -216,6 +216,73 @@ declare function readDevMode(): Promise<DevModeState | null>;
|
|
|
216
216
|
/** Turn dev mode on (for the longest time Core allows) or off; answers the new state. */
|
|
217
217
|
declare function setDevMode(on: boolean): Promise<DevModeState | null>;
|
|
218
218
|
|
|
219
|
+
type NotifChannel = 'chat' | 'push' | 'telegram' | 'whatsapp' | 'email';
|
|
220
|
+
interface ChannelPrefs {
|
|
221
|
+
enabled: boolean;
|
|
222
|
+
/** Telegram chat id (string or number per backend contract; we keep string here). */
|
|
223
|
+
chatId?: string | number;
|
|
224
|
+
/** Push tokens — populated server-side, app reads but doesn't write. */
|
|
225
|
+
deviceTokens?: string[];
|
|
226
|
+
}
|
|
227
|
+
interface QuietHoursPrefs {
|
|
228
|
+
enabled: boolean;
|
|
229
|
+
/** "HH:mm" 24h, local time of `tz`. */
|
|
230
|
+
start?: string;
|
|
231
|
+
/** "HH:mm" 24h. */
|
|
232
|
+
end?: string;
|
|
233
|
+
/** IANA tz, e.g. "Asia/Jerusalem". */
|
|
234
|
+
tz?: string;
|
|
235
|
+
}
|
|
236
|
+
interface NotifPrefs {
|
|
237
|
+
channels: Record<NotifChannel, ChannelPrefs>;
|
|
238
|
+
quietHours: QuietHoursPrefs;
|
|
239
|
+
}
|
|
240
|
+
interface DispatchRow {
|
|
241
|
+
_id: string;
|
|
242
|
+
timestamp: string;
|
|
243
|
+
tenant: string;
|
|
244
|
+
actorId: string;
|
|
245
|
+
action: 'notification.dispatched' | 'notification.failed' | 'notification.chat_only' | 'notification.quiet_hours_skipped';
|
|
246
|
+
requestId: string;
|
|
247
|
+
details: {
|
|
248
|
+
channel?: NotifChannel | null;
|
|
249
|
+
urgency?: string;
|
|
250
|
+
jobId?: string;
|
|
251
|
+
skillSlug?: string;
|
|
252
|
+
error?: string;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
declare function getPrefs(): Promise<NotifPrefs>;
|
|
256
|
+
/** Replaces the prefs document. Read first, mutate, then call this. */
|
|
257
|
+
declare function setPrefs(prefs: NotifPrefs): Promise<NotifPrefs>;
|
|
258
|
+
declare function linkTelegram(chatId: string): Promise<NotifPrefs>;
|
|
259
|
+
declare function unlinkChannel(channel: Exclude<NotifChannel, 'chat'>): Promise<NotifPrefs>;
|
|
260
|
+
declare function recentDispatches(limit?: number): Promise<DispatchRow[]>;
|
|
261
|
+
interface TelegramBotInfo {
|
|
262
|
+
ok: boolean;
|
|
263
|
+
botName: string | null;
|
|
264
|
+
source: 'global' | 'tenant' | 'none';
|
|
265
|
+
error?: string;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Returns the configured Telegram bot for this tenant. Used by the connect
|
|
269
|
+
* flow to build the deep-link and modal copy. Server never returns the bot
|
|
270
|
+
* token — only the public username.
|
|
271
|
+
*/
|
|
272
|
+
declare function getTelegramBotInfo(): Promise<TelegramBotInfo>;
|
|
273
|
+
type DevicePlatform = 'ios' | 'android';
|
|
274
|
+
interface RegisterDeviceResponse {
|
|
275
|
+
ok: boolean;
|
|
276
|
+
device?: {
|
|
277
|
+
token: string;
|
|
278
|
+
platform: DevicePlatform;
|
|
279
|
+
lastSeen?: string;
|
|
280
|
+
};
|
|
281
|
+
error?: string;
|
|
282
|
+
}
|
|
283
|
+
declare function registerDevice(token: string, platform: DevicePlatform): Promise<RegisterDeviceResponse>;
|
|
284
|
+
declare function unregisterDevice(token: string): Promise<void>;
|
|
285
|
+
|
|
219
286
|
type SessionEnv = 'dev' | 'prod';
|
|
220
287
|
interface Session {
|
|
221
288
|
/** Tenant slug the app is actually scoped to (getTenant = signed-in tenant,
|
|
@@ -1189,4 +1256,4 @@ interface AcsKvStorage {
|
|
|
1189
1256
|
}
|
|
1190
1257
|
declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
|
|
1191
1258
|
|
|
1192
|
-
export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BufferedCommand, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type DeleteResult, type DevModeState, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type Message, type MessageAttachment, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type RefreshOutcome, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, type TenantMembership, type TokenProvider, type ToolCall, type UIAction, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, closeChatStream, colors, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, previewInvite, readDevMode, recordEvent, refreshToken, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setOrder, signInWithApple, signInWithGoogle, spacing, switchTenant, tenantFromToken, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
|
|
1259
|
+
export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BufferedCommand, type ChannelPrefs, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type DeleteResult, type DevModeState, type DevicePlatform, type DispatchRow, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type Message, type MessageAttachment, type NotifChannel, type NotifPrefs, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type QuietHoursPrefs, type RefreshOutcome, type RegisterDeviceResponse, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, type TelegramBotInfo, type TenantMembership, type TokenProvider, type ToolCall, type UIAction, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, closeChatStream, colors, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getPrefs as getNotifPrefs, getTelegramBotInfo as getNotifTelegramBotInfo, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, linkTelegram as linkNotifTelegram, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, refreshToken, registerDevice as registerPushDevice, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setPrefs as setNotifPrefs, setOrder, signInWithApple, signInWithGoogle, spacing, switchTenant, tenantFromToken, unlinkChannel as unlinkNotifChannel, unregisterDevice as unregisterPushDevice, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
|
package/dist/index.d.ts
CHANGED
|
@@ -216,6 +216,73 @@ declare function readDevMode(): Promise<DevModeState | null>;
|
|
|
216
216
|
/** Turn dev mode on (for the longest time Core allows) or off; answers the new state. */
|
|
217
217
|
declare function setDevMode(on: boolean): Promise<DevModeState | null>;
|
|
218
218
|
|
|
219
|
+
type NotifChannel = 'chat' | 'push' | 'telegram' | 'whatsapp' | 'email';
|
|
220
|
+
interface ChannelPrefs {
|
|
221
|
+
enabled: boolean;
|
|
222
|
+
/** Telegram chat id (string or number per backend contract; we keep string here). */
|
|
223
|
+
chatId?: string | number;
|
|
224
|
+
/** Push tokens — populated server-side, app reads but doesn't write. */
|
|
225
|
+
deviceTokens?: string[];
|
|
226
|
+
}
|
|
227
|
+
interface QuietHoursPrefs {
|
|
228
|
+
enabled: boolean;
|
|
229
|
+
/** "HH:mm" 24h, local time of `tz`. */
|
|
230
|
+
start?: string;
|
|
231
|
+
/** "HH:mm" 24h. */
|
|
232
|
+
end?: string;
|
|
233
|
+
/** IANA tz, e.g. "Asia/Jerusalem". */
|
|
234
|
+
tz?: string;
|
|
235
|
+
}
|
|
236
|
+
interface NotifPrefs {
|
|
237
|
+
channels: Record<NotifChannel, ChannelPrefs>;
|
|
238
|
+
quietHours: QuietHoursPrefs;
|
|
239
|
+
}
|
|
240
|
+
interface DispatchRow {
|
|
241
|
+
_id: string;
|
|
242
|
+
timestamp: string;
|
|
243
|
+
tenant: string;
|
|
244
|
+
actorId: string;
|
|
245
|
+
action: 'notification.dispatched' | 'notification.failed' | 'notification.chat_only' | 'notification.quiet_hours_skipped';
|
|
246
|
+
requestId: string;
|
|
247
|
+
details: {
|
|
248
|
+
channel?: NotifChannel | null;
|
|
249
|
+
urgency?: string;
|
|
250
|
+
jobId?: string;
|
|
251
|
+
skillSlug?: string;
|
|
252
|
+
error?: string;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
declare function getPrefs(): Promise<NotifPrefs>;
|
|
256
|
+
/** Replaces the prefs document. Read first, mutate, then call this. */
|
|
257
|
+
declare function setPrefs(prefs: NotifPrefs): Promise<NotifPrefs>;
|
|
258
|
+
declare function linkTelegram(chatId: string): Promise<NotifPrefs>;
|
|
259
|
+
declare function unlinkChannel(channel: Exclude<NotifChannel, 'chat'>): Promise<NotifPrefs>;
|
|
260
|
+
declare function recentDispatches(limit?: number): Promise<DispatchRow[]>;
|
|
261
|
+
interface TelegramBotInfo {
|
|
262
|
+
ok: boolean;
|
|
263
|
+
botName: string | null;
|
|
264
|
+
source: 'global' | 'tenant' | 'none';
|
|
265
|
+
error?: string;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Returns the configured Telegram bot for this tenant. Used by the connect
|
|
269
|
+
* flow to build the deep-link and modal copy. Server never returns the bot
|
|
270
|
+
* token — only the public username.
|
|
271
|
+
*/
|
|
272
|
+
declare function getTelegramBotInfo(): Promise<TelegramBotInfo>;
|
|
273
|
+
type DevicePlatform = 'ios' | 'android';
|
|
274
|
+
interface RegisterDeviceResponse {
|
|
275
|
+
ok: boolean;
|
|
276
|
+
device?: {
|
|
277
|
+
token: string;
|
|
278
|
+
platform: DevicePlatform;
|
|
279
|
+
lastSeen?: string;
|
|
280
|
+
};
|
|
281
|
+
error?: string;
|
|
282
|
+
}
|
|
283
|
+
declare function registerDevice(token: string, platform: DevicePlatform): Promise<RegisterDeviceResponse>;
|
|
284
|
+
declare function unregisterDevice(token: string): Promise<void>;
|
|
285
|
+
|
|
219
286
|
type SessionEnv = 'dev' | 'prod';
|
|
220
287
|
interface Session {
|
|
221
288
|
/** Tenant slug the app is actually scoped to (getTenant = signed-in tenant,
|
|
@@ -1189,4 +1256,4 @@ interface AcsKvStorage {
|
|
|
1189
1256
|
}
|
|
1190
1257
|
declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
|
|
1191
1258
|
|
|
1192
|
-
export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BufferedCommand, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type DeleteResult, type DevModeState, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type Message, type MessageAttachment, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type RefreshOutcome, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, type TenantMembership, type TokenProvider, type ToolCall, type UIAction, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, closeChatStream, colors, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, previewInvite, readDevMode, recordEvent, refreshToken, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setOrder, signInWithApple, signInWithGoogle, spacing, switchTenant, tenantFromToken, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
|
|
1259
|
+
export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BufferedCommand, type ChannelPrefs, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type DeleteResult, type DevModeState, type DevicePlatform, type DispatchRow, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type Message, type MessageAttachment, type NotifChannel, type NotifPrefs, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type QuietHoursPrefs, type RefreshOutcome, type RegisterDeviceResponse, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, type TelegramBotInfo, type TenantMembership, type TokenProvider, type ToolCall, type UIAction, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, closeChatStream, colors, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getPrefs as getNotifPrefs, getTelegramBotInfo as getNotifTelegramBotInfo, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, linkTelegram as linkNotifTelegram, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, refreshToken, registerDevice as registerPushDevice, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setPrefs as setNotifPrefs, setOrder, signInWithApple, signInWithGoogle, spacing, switchTenant, tenantFromToken, unlinkChannel as unlinkNotifChannel, unregisterDevice as unregisterPushDevice, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,8 @@ __export(index_exports, {
|
|
|
45
45
|
getConsumerAuthApiUrl: () => getConsumerAuthApiUrl,
|
|
46
46
|
getCoreApiUrl: () => getCoreApiUrl,
|
|
47
47
|
getCoreWsUrl: () => getCoreWsUrl,
|
|
48
|
+
getNotifPrefs: () => getPrefs,
|
|
49
|
+
getNotifTelegramBotInfo: () => getTelegramBotInfo,
|
|
48
50
|
getSession: () => getSession,
|
|
49
51
|
getTenant: () => getTenant,
|
|
50
52
|
getToken: () => getToken,
|
|
@@ -57,6 +59,7 @@ __export(index_exports, {
|
|
|
57
59
|
joinWithGoogle: () => joinWithGoogle,
|
|
58
60
|
linkChannelStart: () => linkChannelStart,
|
|
59
61
|
linkChannelVerify: () => linkChannelVerify,
|
|
62
|
+
linkNotifTelegram: () => linkTelegram,
|
|
60
63
|
listHomeActions: () => listHomeActions,
|
|
61
64
|
listMadeForYou: () => listMadeForYou,
|
|
62
65
|
listMyTenants: () => listMyTenants,
|
|
@@ -77,20 +80,25 @@ __export(index_exports, {
|
|
|
77
80
|
postCommandResult: () => postCommandResult,
|
|
78
81
|
previewInvite: () => previewInvite,
|
|
79
82
|
readDevMode: () => readDevMode,
|
|
83
|
+
recentNotifDispatches: () => recentDispatches,
|
|
80
84
|
recordEvent: () => recordEvent,
|
|
81
85
|
refreshToken: () => refreshToken,
|
|
86
|
+
registerPushDevice: () => registerDevice,
|
|
82
87
|
resolveAdasPhase: () => resolveAdasPhase,
|
|
83
88
|
setAcsCacheStorage: () => setAcsCacheStorage,
|
|
84
89
|
setAcsReachabilityReporter: () => setAcsReachabilityReporter,
|
|
85
90
|
setClientDeclarationProvider: () => setClientDeclarationProvider,
|
|
86
91
|
setDevMode: () => setDevMode,
|
|
87
92
|
setHomeActionOrder: () => setHomeActionOrder,
|
|
93
|
+
setNotifPrefs: () => setPrefs,
|
|
88
94
|
setOrder: () => setOrder,
|
|
89
95
|
signInWithApple: () => signInWithApple,
|
|
90
96
|
signInWithGoogle: () => signInWithGoogle,
|
|
91
97
|
spacing: () => spacing,
|
|
92
98
|
switchTenant: () => switchTenant,
|
|
93
99
|
tenantFromToken: () => tenantFromToken,
|
|
100
|
+
unlinkNotifChannel: () => unlinkChannel,
|
|
101
|
+
unregisterPushDevice: () => unregisterDevice,
|
|
94
102
|
unwrapMcpResult: () => unwrapMcpResult,
|
|
95
103
|
useCapability: () => useCapability,
|
|
96
104
|
useChatStore: () => useChatStore,
|
|
@@ -332,6 +340,55 @@ async function setDevMode(on) {
|
|
|
332
340
|
return devModeFromCatalog(out);
|
|
333
341
|
}
|
|
334
342
|
|
|
343
|
+
// src/notifications/api.ts
|
|
344
|
+
async function callNotifApi(method, params = {}) {
|
|
345
|
+
if (!getToken()) throw new Error("Not authenticated");
|
|
346
|
+
const data = await mcpToolCall("cp.notif_api", { method, params });
|
|
347
|
+
if (data?.error) throw new Error(data.error.message || "Notif API error");
|
|
348
|
+
const r = data?.result;
|
|
349
|
+
if (r?.structuredContent) return r.structuredContent;
|
|
350
|
+
const out = unwrapMcpResult(r);
|
|
351
|
+
if (out && typeof out === "object" && !Array.isArray(out) && "ok" in out) return out;
|
|
352
|
+
if (typeof out === "string") throw new Error(`Notif API returned unparseable text: ${out.slice(0, 80)}`);
|
|
353
|
+
throw new Error("Notif API returned no result payload");
|
|
354
|
+
}
|
|
355
|
+
async function getPrefs() {
|
|
356
|
+
const res = await callNotifApi("getPrefs");
|
|
357
|
+
if (!res.ok || !res.prefs) throw new Error(res.error || "Failed to load prefs");
|
|
358
|
+
return res.prefs;
|
|
359
|
+
}
|
|
360
|
+
async function setPrefs(prefs) {
|
|
361
|
+
const res = await callNotifApi("setPrefs", { prefs });
|
|
362
|
+
if (!res.ok || !res.prefs) throw new Error(res.error || "Failed to save prefs");
|
|
363
|
+
return res.prefs;
|
|
364
|
+
}
|
|
365
|
+
async function linkTelegram(chatId) {
|
|
366
|
+
const res = await callNotifApi("linkTelegram", { chatId });
|
|
367
|
+
if (!res.ok || !res.prefs) throw new Error(res.error || "Failed to link Telegram");
|
|
368
|
+
return res.prefs;
|
|
369
|
+
}
|
|
370
|
+
async function unlinkChannel(channel) {
|
|
371
|
+
const res = await callNotifApi("unlinkChannel", { channel });
|
|
372
|
+
if (!res.ok || !res.prefs) throw new Error(res.error || "Failed to unlink channel");
|
|
373
|
+
return res.prefs;
|
|
374
|
+
}
|
|
375
|
+
async function recentDispatches(limit = 50) {
|
|
376
|
+
const res = await callNotifApi("recentDispatches", { limit });
|
|
377
|
+
return res.rows || [];
|
|
378
|
+
}
|
|
379
|
+
async function getTelegramBotInfo() {
|
|
380
|
+
const res = await callNotifApi("getTelegramBotInfo");
|
|
381
|
+
return res;
|
|
382
|
+
}
|
|
383
|
+
async function registerDevice(token, platform) {
|
|
384
|
+
const res = await callNotifApi("registerDevice", { token, platform });
|
|
385
|
+
return res;
|
|
386
|
+
}
|
|
387
|
+
async function unregisterDevice(token) {
|
|
388
|
+
const res = await callNotifApi("unregisterDevice", { token });
|
|
389
|
+
if (!res.ok) throw new Error(res.error || "Failed to unregister device");
|
|
390
|
+
}
|
|
391
|
+
|
|
335
392
|
// src/session.ts
|
|
336
393
|
function hostOf(u) {
|
|
337
394
|
if (!u) return "";
|
|
@@ -2251,6 +2308,8 @@ var borderRadius = {
|
|
|
2251
2308
|
getConsumerAuthApiUrl,
|
|
2252
2309
|
getCoreApiUrl,
|
|
2253
2310
|
getCoreWsUrl,
|
|
2311
|
+
getNotifPrefs,
|
|
2312
|
+
getNotifTelegramBotInfo,
|
|
2254
2313
|
getSession,
|
|
2255
2314
|
getTenant,
|
|
2256
2315
|
getToken,
|
|
@@ -2263,6 +2322,7 @@ var borderRadius = {
|
|
|
2263
2322
|
joinWithGoogle,
|
|
2264
2323
|
linkChannelStart,
|
|
2265
2324
|
linkChannelVerify,
|
|
2325
|
+
linkNotifTelegram,
|
|
2266
2326
|
listHomeActions,
|
|
2267
2327
|
listMadeForYou,
|
|
2268
2328
|
listMyTenants,
|
|
@@ -2283,20 +2343,25 @@ var borderRadius = {
|
|
|
2283
2343
|
postCommandResult,
|
|
2284
2344
|
previewInvite,
|
|
2285
2345
|
readDevMode,
|
|
2346
|
+
recentNotifDispatches,
|
|
2286
2347
|
recordEvent,
|
|
2287
2348
|
refreshToken,
|
|
2349
|
+
registerPushDevice,
|
|
2288
2350
|
resolveAdasPhase,
|
|
2289
2351
|
setAcsCacheStorage,
|
|
2290
2352
|
setAcsReachabilityReporter,
|
|
2291
2353
|
setClientDeclarationProvider,
|
|
2292
2354
|
setDevMode,
|
|
2293
2355
|
setHomeActionOrder,
|
|
2356
|
+
setNotifPrefs,
|
|
2294
2357
|
setOrder,
|
|
2295
2358
|
signInWithApple,
|
|
2296
2359
|
signInWithGoogle,
|
|
2297
2360
|
spacing,
|
|
2298
2361
|
switchTenant,
|
|
2299
2362
|
tenantFromToken,
|
|
2363
|
+
unlinkNotifChannel,
|
|
2364
|
+
unregisterPushDevice,
|
|
2300
2365
|
unwrapMcpResult,
|
|
2301
2366
|
useCapability,
|
|
2302
2367
|
useChatStore,
|