@codingfactory/messenger-client 0.1.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/README.md +38 -0
- package/dist/composables/useConversationChannel.d.ts +13 -0
- package/dist/composables/useGlobalMessaging.d.ts +12 -0
- package/dist/composables/useNotificationSound.d.ts +4 -0
- package/dist/configure.d.ts +16 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1440 -0
- package/dist/services/api/messaging.d.ts +17 -0
- package/dist/services/auth.d.ts +17 -0
- package/dist/services/echo.d.ts +84 -0
- package/dist/services/mediaApi.d.ts +11 -0
- package/dist/stores/auth.d.ts +13 -0
- package/dist/stores/messaging.d.ts +3760 -0
- package/dist/types/messaging.d.ts +81 -0
- package/dist/utils/errorUtils.d.ts +23 -0
- package/dist/utils/logger.d.ts +10 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# messenger-client
|
|
2
|
+
|
|
3
|
+
Shared frontend messaging state, API helpers, and realtime composables extracted
|
|
4
|
+
from `blowglass`.
|
|
5
|
+
|
|
6
|
+
## Status
|
|
7
|
+
|
|
8
|
+
This package is in copy-first extraction mode. The goal is to preserve proven
|
|
9
|
+
behavior while moving generic messaging code into a standalone package.
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
Consumer apps should configure the package runtime once during app bootstrap:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { configureMessengerClient } from '@codingfactory/messenger-client'
|
|
17
|
+
|
|
18
|
+
configureMessengerClient({
|
|
19
|
+
apiClient,
|
|
20
|
+
authStore: useAuthStore,
|
|
21
|
+
mediaApi,
|
|
22
|
+
createLogger,
|
|
23
|
+
playMessageNotification,
|
|
24
|
+
echo: {
|
|
25
|
+
initializedEvent: 'blowglass:echo-initialized',
|
|
26
|
+
getEcho,
|
|
27
|
+
onConnectionStatusChange,
|
|
28
|
+
subscribeToPresenceStatus,
|
|
29
|
+
unsubscribeFromPresenceStatus,
|
|
30
|
+
subscribeToConversation,
|
|
31
|
+
unsubscribeFromConversation,
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The extracted store and composables can then be imported from the package
|
|
37
|
+
instead of staying embedded inside the consumer app.
|
|
38
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
|
|
2
|
+
type UseConversationChannel = {
|
|
3
|
+
isSubscribed: ComputedRef<boolean>;
|
|
4
|
+
error: ComputedRef<string | null>;
|
|
5
|
+
subscribe: () => void;
|
|
6
|
+
unsubscribe: () => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Composable for managing WebSocket subscription to a specific conversation
|
|
10
|
+
* Handles real-time message events and updates the messaging store
|
|
11
|
+
*/
|
|
12
|
+
export declare function useConversationChannel(conversationIdSource: MaybeRefOrGetter<string | null | undefined>): UseConversationChannel;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subscribes to a bounded set of the current user's most recent conversation
|
|
3
|
+
* channels so incoming messages can update unread counts without auth-bursting
|
|
4
|
+
* the entire inbox.
|
|
5
|
+
*
|
|
6
|
+
* When a conversation also has an active useConversationChannel (detail view),
|
|
7
|
+
* the global handler skips the unread increment to avoid double counting.
|
|
8
|
+
* The detail handler already handles addMessage + unread for that conversation.
|
|
9
|
+
*
|
|
10
|
+
* Usage: call once in TabsLayout (the root authenticated layout).
|
|
11
|
+
*/
|
|
12
|
+
export declare function useGlobalMessaging(): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type PlayMessageNotification = (isMuted: boolean) => void;
|
|
2
|
+
export declare let playMessageNotification: PlayMessageNotification;
|
|
3
|
+
export declare function setMessageNotificationPlayer(player: PlayMessageNotification): void;
|
|
4
|
+
export declare function resetMessageNotificationPlayer(): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type MessagingHttpClient } from './services/auth';
|
|
2
|
+
import { type EchoRuntimeConfig } from './services/echo';
|
|
3
|
+
import { type MessagingMediaApi } from './services/mediaApi';
|
|
4
|
+
import { type UseMessagingAuthStore } from './stores/auth';
|
|
5
|
+
import { type PlayMessageNotification } from './composables/useNotificationSound';
|
|
6
|
+
import { type CreateLogger } from './utils/logger';
|
|
7
|
+
export interface MessengerClientConfig {
|
|
8
|
+
apiClient?: MessagingHttpClient;
|
|
9
|
+
authStore?: UseMessagingAuthStore;
|
|
10
|
+
mediaApi?: MessagingMediaApi;
|
|
11
|
+
createLogger?: CreateLogger;
|
|
12
|
+
playMessageNotification?: PlayMessageNotification;
|
|
13
|
+
echo?: EchoRuntimeConfig;
|
|
14
|
+
}
|
|
15
|
+
export declare function configureMessengerClient(config: MessengerClientConfig): void;
|
|
16
|
+
export declare function resetMessengerClientConfig(): void;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './composables/useConversationChannel';
|
|
2
|
+
export * from './composables/useGlobalMessaging';
|
|
3
|
+
export * from './configure';
|
|
4
|
+
export * from './services/api/messaging';
|
|
5
|
+
export * from './services/auth';
|
|
6
|
+
export * from './services/echo';
|
|
7
|
+
export * from './services/mediaApi';
|
|
8
|
+
export * from './stores/auth';
|
|
9
|
+
export * from './stores/messaging';
|
|
10
|
+
export * from './utils/errorUtils';
|
|
11
|
+
export * from './utils/logger';
|