@hiver/connector-agent 4.19.5 → 4.19.6

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": "@hiver/connector-agent",
3
- "version": "4.19.5",
3
+ "version": "4.19.6",
4
4
  "main": "index.es.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"appStore.d.ts","sourceRoot":"","sources":["../../src/store/appStore.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAiB,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAuChD,eAAO,MAAM,cAAc,QAAO,KAAK,CAAC,UAAU,CAoGjD,CAAC"}
1
+ {"version":3,"file":"appStore.d.ts","sourceRoot":"","sources":["../../src/store/appStore.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAiB,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAuChD,eAAO,MAAM,cAAc,QAAO,KAAK,CAAC,UAAU,CAqGjD,CAAC"}
@@ -1,36 +1,84 @@
1
1
  export declare const ACTIONS: {
2
2
  readonly OPEN_CREATE_FORM: "OPEN_CREATE_FORM";
3
3
  };
4
+ type ActionType = (typeof ACTIONS)[keyof typeof ACTIONS];
4
5
  type ActionQueuePayload = {
5
6
  [ACTIONS.OPEN_CREATE_FORM]: {
6
7
  formId?: string;
7
8
  conversationId: number;
9
+ /**
10
+ * Open the addressed connector's create form specifically, instead of letting the panel
11
+ * pick one. Requires the item's `connectorId`. Used by the Gmail attachment icons, whose
12
+ * whole point is a particular connector's (expanded) form; hosts that just want "the
13
+ * create form of this panel" leave it off and keep the panel's own selection logic.
14
+ */
15
+ selectConnectorForm?: boolean;
8
16
  };
9
17
  };
10
- type ActionQueueItem = {
11
- type: (typeof ACTIONS)[keyof typeof ACTIONS];
12
- payload: ActionQueuePayload[(typeof ACTIONS)[keyof typeof ACTIONS]];
18
+ export type ActionQueueItem = {
19
+ type: ActionType;
20
+ /**
21
+ * Connector the action is addressed to. Optional: hosts that mean "open the create form of
22
+ * whatever this panel is showing" (e.g. the quick-access button in a single-panel setup)
23
+ * omit it. When present it is routing information — a listener whose own connectorId differs
24
+ * drops the action instead of consuming it. Split apps mount one panel per connector against
25
+ * the *same* queue instance, so without this every panel would react to every action.
26
+ */
27
+ connectorId?: string;
28
+ payload: ActionQueuePayload[ActionType];
29
+ };
30
+ export type OpenCreateFormPayload = ActionQueuePayload[typeof ACTIONS.OPEN_CREATE_FORM] & {
31
+ /** Copied off the item, so the panel can resolve the connector's own create form. */
32
+ connectorId?: string;
13
33
  };
14
34
  export type QueueProps = {
15
35
  conversationId?: number;
16
- openCreateForm: () => void;
36
+ /** Connector this listener's panel is rendering (undefined when it renders all of them). */
37
+ connectorId?: string;
38
+ openCreateForm: (payload?: OpenCreateFormPayload) => void;
17
39
  };
40
+ /**
41
+ * Props are read through a getter at delivery time, so a listener stays registered across
42
+ * re-renders while still seeing the panel's latest callbacks and ids.
43
+ */
44
+ export type GetQueueProps = () => QueueProps;
18
45
  export type ActionQueueConstructorProps = {
19
46
  processDelay?: number;
20
47
  };
21
48
  export declare class ActionQueue {
22
49
  private _processDelay;
23
- initialized: boolean;
24
50
  private _queue;
25
- private _queueProps;
51
+ private _listeners;
52
+ private _listenerCount;
53
+ private _processing;
26
54
  ACTIONS: {
27
55
  readonly OPEN_CREATE_FORM: "OPEN_CREATE_FORM";
28
56
  };
29
57
  constructor({ processDelay }: ActionQueueConstructorProps);
30
- register(props: QueueProps): void;
58
+ /** True while at least one panel is listening. */
59
+ get initialized(): boolean;
60
+ /**
61
+ * Adds a listener instance for one panel. Every queued action is offered to every listener,
62
+ * which is what makes a single queue safe to share across the split-apps panels.
63
+ *
64
+ * @returns the listener id to hand back to {@link unregister}.
65
+ */
66
+ register(getProps: GetQueueProps): string;
67
+ /**
68
+ * Drops a listener — call it when the panel unmounts or switches connector, so a stale
69
+ * instance can no longer consume actions meant for its replacement.
70
+ */
71
+ unregister(listenerId: string): void;
31
72
  add(item: ActionQueueItem): void;
32
73
  private _delay;
74
+ /**
75
+ * Offers each queued action to each listener. An action nobody consumed goes back into the
76
+ * queue: the common case is a panel that is still mounting (or still on another connector)
77
+ * when the host queues the action, and it gets picked up by the next register/add.
78
+ */
33
79
  private _process;
80
+ /** @returns whether at least one listener consumed the action. */
81
+ private _deliver;
34
82
  destroy(): void;
35
83
  }
36
84
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"action-queue.d.ts","sourceRoot":"","sources":["../../src/utils/action-queue.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;CAEV,CAAC;AAEX,KAAK,kBAAkB,GAAG;IACxB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE;QAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IAC7C,OAAO,EAAE,kBAAkB,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC,CAAC;CACrE,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAWF,qBAAa,WAAW;IACtB,OAAO,CAAC,aAAa,CAAS;IACvB,WAAW,EAAE,OAAO,CAAS;IACpC,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,WA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