react-sip-kit 0.5.21 → 0.7.0-beta

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.
@@ -1,6 +1,6 @@
1
- import { SipAccountConfig } from '../../configs/types';
1
+ import { SipConfigs } from '../../configs/types';
2
2
  import { SipUserAgent } from '../../types';
3
- export declare function onTransportConnected(username: SipAccountConfig['username'], userAgent?: SipUserAgent | null): void;
4
- export declare function onTransportConnectError(error: Error, username: SipAccountConfig['username'], userAgent?: SipUserAgent | null): void;
5
- export declare function onTransportDisconnected(username: SipAccountConfig['username'], userAgent: SipUserAgent): void;
6
- export declare function reconnectTransport(username: SipAccountConfig['username'], userAgent?: SipUserAgent | null): void;
3
+ export declare function onTransportConnected(configKey: SipConfigs['key'], userAgent?: SipUserAgent | null): void;
4
+ export declare function onTransportConnectError(error: Error, configKey: SipConfigs['key'], userAgent?: SipUserAgent | null): void;
5
+ export declare function onTransportDisconnected(configKey: SipConfigs['key'], userAgent: SipUserAgent): void;
6
+ export declare function reconnectTransport(configKey: SipConfigs['key'], userAgent?: SipUserAgent | null, forceReconnect?: boolean): void;
@@ -1,7 +1,7 @@
1
- import { SipAccountConfig } from '../../configs/types';
1
+ import { SipConfigs } from '../../configs/types';
2
2
  import { LineType } from '../../store/types';
3
- export declare function useSipManager({ username }: {
4
- username: SipAccountConfig['username'];
3
+ export declare function useSipManager({ configKey }: {
4
+ configKey: SipConfigs['key'];
5
5
  }): () => {
6
6
  status: import("../../store/types").SipUserAgentStatus;
7
7
  lines: LineType[];
@@ -0,0 +1 @@
1
+ export declare const useWatchConfigs: () => import("../../configs/types").SipConfigs[];
@@ -1,21 +1,85 @@
1
- import { SipSessionDataType } from '../../store/types';
1
+ import { SipConfigs } from '../../configs/types';
2
+ import { LineType, SipSessionDataType } from '../../store/types';
2
3
  type Primitive = string | number | boolean | symbol | null | undefined;
3
4
  type Path<T> = {
4
5
  [K in keyof T & string]: T[K] extends Primitive | Array<any> ? K : K | `${K}.${Path<T[K]>}`;
5
6
  }[keyof T & string];
6
7
  /** Resolve the value type of a dot-path string. */
7
8
  type PathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rest extends string ? PathValue<T[K], Rest> : never : never : P extends keyof T ? T[P] : never;
8
- /** ---------- Hook overloads ---------- */
9
+ /**
10
+ * React hook to watch SIP session data for a specific line.
11
+ *
12
+ * Provide a single `key` object containing **either** `lineKey` or `remoteNumber`.
13
+ * You can also optionally specify `name` to access a specific property (supports dot-paths),
14
+ * or an array of names to get multiple properties at once.
15
+ *
16
+ * @param {Object} params
17
+ * @param {Object} params.key - Lookup key for the line/session.
18
+ * @param {number} [params.key.lineKey] - Numeric line identifier. Takes priority if both keys are somehow provided.
19
+ * @param {string} [params.key.remoteNumber] - Remote number of the SIP session. Used if `lineKey` is not provided.
20
+ * @param {string | string[]} [params.name] - Optional dot-path string (e.g., 'localMediaStreamStatus.videoEnabled')
21
+ * or array of dot-paths to select specific data from the session.
22
+ *
23
+ * @returns {SipSessionDataType | any | any[]}
24
+ * Returns the full session data if `name` is undefined,
25
+ * a single property if `name` is a string,
26
+ * or an array of properties if `name` is an array.
27
+ *
28
+ * @example
29
+ * // Watch full session data by lineKey
30
+ * const sessionData = useWatchSessionData({ key: { lineKey: 1 } });
31
+ *
32
+ * // Watch a specific property by lineKey
33
+ * const videoEnabled = useWatchSessionData({ key: { lineKey: 1 }, name: 'localMediaStreamStatus.videoEnabled' });
34
+ *
35
+ * // Watch full session data by remoteNumber
36
+ * const sessionData = useWatchSessionData({ key: { remoteNumber: '1001' } });
37
+ *
38
+ * // Watch multiple properties by remoteNumber
39
+ * const [videoEnabled, audioEnabled] = useWatchSessionData({
40
+ * key: { remoteNumber: '1001' },
41
+ * name: ['localMediaStreamStatus.videoEnabled', 'localMediaStreamStatus.audioEnabled']
42
+ * });
43
+ */
9
44
  export declare function useWatchSessionData(props: {
10
- lineNumber: number;
45
+ key: {
46
+ lineKey: LineType['lineKey'];
47
+ };
11
48
  name?: undefined;
12
49
  }): SipSessionDataType;
50
+ export declare function useWatchSessionData(props: {
51
+ key: {
52
+ remoteNumber: SipSessionDataType['remoteNumber'];
53
+ configKey: SipConfigs['key'];
54
+ };
55
+ name?: undefined;
56
+ }): SipSessionDataType;
57
+ export declare function useWatchSessionData<P extends Path<SipSessionDataType>>(props: {
58
+ key: {
59
+ lineKey: LineType['lineKey'];
60
+ };
61
+ name: P;
62
+ }): PathValue<SipSessionDataType, P>;
13
63
  export declare function useWatchSessionData<P extends Path<SipSessionDataType>>(props: {
14
- lineNumber: number;
64
+ key: {
65
+ remoteNumber: SipSessionDataType['remoteNumber'];
66
+ configKey: SipConfigs['key'];
67
+ };
15
68
  name: P;
16
69
  }): PathValue<SipSessionDataType, P>;
17
70
  export declare function useWatchSessionData<const P extends readonly Path<SipSessionDataType>[]>(props: {
18
- lineNumber: number;
71
+ key: {
72
+ lineKey: LineType['lineKey'];
73
+ };
74
+ name: P;
75
+ }): {
76
+ [K in keyof P]: PathValue<SipSessionDataType, P[K] & string>;
77
+ };
78
+ export declare function useWatchSessionData<const P extends readonly Path<SipSessionDataType>[]>(props: {
79
+ key: {
80
+ remoteNumber: SipSessionDataType['remoteNumber'];
81
+ configKey: SipConfigs['key'];
82
+ };
19
83
  name: P;
20
84
  }): {
21
85
  [K in keyof P]: PathValue<SipSessionDataType, P[K] & string>;