@hiver/connector-agent 4.11.3 → 4.12.0-beta.1

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.
Files changed (37) hide show
  1. package/app/connector-cards.d.ts.map +1 -1
  2. package/app/provider.d.ts.map +1 -1
  3. package/features/connector-cards/api/userAuth.d.ts +25 -0
  4. package/features/connector-cards/api/userAuth.d.ts.map +1 -0
  5. package/features/connector-cards/components/card-list/CardWithUserAuth.d.ts +32 -0
  6. package/features/connector-cards/components/card-list/CardWithUserAuth.d.ts.map +1 -0
  7. package/features/connector-cards/components/connection-in-progress-modal/index.d.ts +19 -0
  8. package/features/connector-cards/components/connection-in-progress-modal/index.d.ts.map +1 -0
  9. package/features/connector-cards/components/user-auth-card/__tests__/UserAuthCard.test.d.ts +2 -0
  10. package/features/connector-cards/components/user-auth-card/__tests__/UserAuthCard.test.d.ts.map +1 -0
  11. package/features/connector-cards/components/user-auth-card/index.d.ts +33 -0
  12. package/features/connector-cards/components/user-auth-card/index.d.ts.map +1 -0
  13. package/features/connector-cards/components/user-auth-card/style.d.ts +29 -0
  14. package/features/connector-cards/components/user-auth-card/style.d.ts.map +1 -0
  15. package/features/connector-cards/constants/api.d.ts +2 -0
  16. package/features/connector-cards/constants/api.d.ts.map +1 -1
  17. package/features/connector-cards/hooks/useUserAuthFlow.d.ts +42 -0
  18. package/features/connector-cards/hooks/useUserAuthFlow.d.ts.map +1 -0
  19. package/features/connector-cards/store/userAuth.d.ts +85 -0
  20. package/features/connector-cards/store/userAuth.d.ts.map +1 -0
  21. package/features/connector-cards/store/userAuth.test.d.ts +2 -0
  22. package/features/connector-cards/store/userAuth.test.d.ts.map +1 -0
  23. package/features/connector-cards/utils/registerUserAuthCallback.d.ts +13 -0
  24. package/features/connector-cards/utils/registerUserAuthCallback.d.ts.map +1 -0
  25. package/index.es.js +6292 -5842
  26. package/index.umd.js +335 -277
  27. package/package.json +5 -2
  28. package/store/hooks.d.ts +2 -0
  29. package/store/hooks.d.ts.map +1 -1
  30. package/store/index.d.ts +6 -0
  31. package/store/index.d.ts.map +1 -1
  32. package/testing/mocks/handlers/fetch-cards.d.ts.map +1 -1
  33. package/testing/mocks/handlers/user-auth.d.ts +31 -0
  34. package/testing/mocks/handlers/user-auth.d.ts.map +1 -0
  35. package/testing/mocks/handlers.d.ts.map +1 -1
  36. package/types/cards.d.ts +1 -0
  37. package/types/cards.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"connector-cards.d.ts","sourceRoot":"","sources":["../../src/app/connector-cards.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAkF,MAAM,OAAO,CAAC;AAmG3G,UAAU,SAAS;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,SAAS,CAmmBxC,CAAC"}
1
+ {"version":3,"file":"connector-cards.d.ts","sourceRoot":"","sources":["../../src/app/connector-cards.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAkF,MAAM,OAAO,CAAC;AAoG3G,UAAU,SAAS;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,SAAS,CAwmBxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/app/provider.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,KAAK,gBAAgB,GAAG;IACtB,QAAQ,E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,CAAC,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,oKAYrB,gBAAgB,4CAqClB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { UserAuthState } from '../store/userAuth';
2
+ export interface UserAuthStatusResponse {
3
+ state: UserAuthState;
4
+ reason?: string;
5
+ external_user_id?: string;
6
+ }
7
+ export interface UserAuthStartResponse {
8
+ auth_url: string;
9
+ tier: 'user';
10
+ }
11
+ /**
12
+ * Reads the signed-in agent's user-tier connection state for a
13
+ * connector. Called on card mount when `connector.userAuthEnabled`
14
+ * is true; not called for legacy connectors so legacy mount paths
15
+ * stay byte-for-byte unchanged.
16
+ */
17
+ export declare const getUserAuthStatus: (connectorId: string) => Promise<import('axios').AxiosResponse<any, any> | undefined>;
18
+ /**
19
+ * Builds the OAuth authorization URL the agent visits in a popup to
20
+ * connect their personal account. The BE encodes `state.tier=user`
21
+ * + `state.user_id` so the callback knows to land in
22
+ * /process_user_callback rather than the workspace flow.
23
+ */
24
+ export declare const startUserAuth: (connectorId: string) => Promise<import('axios').AxiosResponse<any, any> | undefined>;
25
+ //# sourceMappingURL=userAuth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userAuth.d.ts","sourceRoot":"","sources":["../../../../src/features/connector-cards/api/userAuth.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE/E,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,gBAAiB,MAAM,iEAKpD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,gBAAiB,MAAM,iEAKhD,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { FC } from 'react';
2
+ import { ICard, ISpecificCard } from '../../../../types/cards';
3
+ import { ApiStatus } from '../../../../types/api';
4
+ interface IProps {
5
+ card: ICard;
6
+ email: string;
7
+ specificCardData: Record<string, ISpecificCard> | null;
8
+ specificConnectorApiStatus: Record<string, ApiStatus> | null;
9
+ defaultOpenState: boolean;
10
+ onCardUnlinking: () => void;
11
+ }
12
+ /**
13
+ * Wraps the regular Card render with the user-tier auth gate.
14
+ *
15
+ * - When the install has not opted into user-tier auth
16
+ * (`card.userAuthEnabled !== true`) → renders the regular Card.
17
+ * Zero behavior change for legacy connectors.
18
+ *
19
+ * - When opted in:
20
+ * * On mount, fetches /user-auth/status once via tanstack-query
21
+ * (30s staleTime → batches across cards sharing the connector).
22
+ * * If the resolved state is `connected` (or `unknown` while the
23
+ * fetch is in-flight) → renders the regular Card.
24
+ * * Otherwise renders <UserAuthCard /> with the right variant.
25
+ *
26
+ * The `onConnected` callback invalidates the card data query so
27
+ * the regular Card mounts immediately after the popup completes,
28
+ * without forcing the user to refresh or remount.
29
+ */
30
+ export declare const CardWithUserAuth: FC<IProps>;
31
+ export {};
32
+ //# sourceMappingURL=CardWithUserAuth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CardWithUserAuth.d.ts","sourceRoot":"","sources":["../../../../../src/features/connector-cards/components/card-list/CardWithUserAuth.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAS3B,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,UAAU,MAAM;IACd,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC;IACvD,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;IAC7D,gBAAgB,EAAE,OAAO,CAAC;IAC1B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,MAAM,CAiEvC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { FC } from 'react';
2
+ /**
3
+ * Renders Figma frame 2 — the centered "Connection in progress"
4
+ * overlay shown while a user-tier OAuth popup is open.
5
+ *
6
+ * Mounted once at the app/connector-cards.tsx level rather than
7
+ * per-card. The slice's selectAnyInProgressConnectorId selector
8
+ * naturally dedupes across concurrent connect attempts (which
9
+ * shouldn't happen — the bifrost interceptor only kicks in for
10
+ * one connector at a time — but the design is defensive).
11
+ *
12
+ * Per the spec the modal has no close button. The user must
13
+ * complete the OAuth flow (or close the popup themselves, at
14
+ * which point the 5-min in-progress timeout in useUserAuthFlow
15
+ * fires and the modal disappears with the state transition).
16
+ */
17
+ declare const ConnectionInProgressModal: FC;
18
+ export default ConnectionInProgressModal;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/connector-cards/components/connection-in-progress-modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAiBpC;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,yBAAyB,EAAE,EA0DhC,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=UserAuthCard.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserAuthCard.test.d.ts","sourceRoot":"","sources":["../../../../../../src/features/connector-cards/components/user-auth-card/__tests__/UserAuthCard.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ import { FC } from 'react';
2
+ import { UserAuthState } from '../../store/userAuth';
3
+ interface UserAuthCardProps {
4
+ connectorId: string;
5
+ connectorName: string;
6
+ connectorLogo: string;
7
+ variant: UserAuthState;
8
+ /** Optional reason from the backend (e.g. `workspace_mismatch`,
9
+ * `site_access_denied`, `refresh_failed`). Used to pick
10
+ * variant-specific copy below. */
11
+ reason?: string;
12
+ /** Called once the connect popup flow lands at `connected`.
13
+ * Typically retries the original API call that surfaced the
14
+ * 412. Pass-through to useUserAuthFlow. */
15
+ onConnected?: () => void;
16
+ }
17
+ /**
18
+ * Renders Figma frames 1 and 4 (and their variants). Same component
19
+ * for both — the only difference is the badge + copy.
20
+ *
21
+ * - `disconnected` / `unknown` → frame 1: "Sign in to use X"
22
+ * - `reauth_required` → frame 4: "Authentication failed"
23
+ * - `workspace_mismatch` → frame 4 with workspace-specific copy
24
+ * - `in_progress` → button disabled + spinner; the
25
+ * centered modal owns the user's attention but the card body
26
+ * stays mounted so layout doesn't shift when the modal closes.
27
+ * - `connected` → this component shouldn't render
28
+ * when state === connected; the parent routes to the normal card.
29
+ * Defensive fall-through renders nothing.
30
+ */
31
+ declare const UserAuthCard: FC<UserAuthCardProps>;
32
+ export default UserAuthCard;
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/connector-cards/components/user-auth-card/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAe,MAAM,OAAO,CAAC;AAKxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAiB/E,UAAU,iBAAiB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,aAAa,CAAC;IACvB;;uCAEmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;gDAE4C;IAC5C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAiGvC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { HTMLAttributes, ImgHTMLAttributes } from 'react';
2
+ import { StackProps, BoxProps, ButtonProps } from '@hiver/hiver-ui-kit';
3
+ import { StyledComponent } from '@emotion/styled';
4
+ /**
5
+ * Outer card — pale purple wash matching the no-connectors empty
6
+ * state. Two visually-distinct sections inside: the logo block on
7
+ * top, the title/body/CTA below. No outer border — the pale
8
+ * background carries enough separation from the page.
9
+ */
10
+ export declare const CardWrapper: StyledComponent<BoxProps>;
11
+ /**
12
+ * The two-logo block sits in its own slightly-inset panel at the
13
+ * top of the card, matching the Figma's two-section composition.
14
+ */
15
+ export declare const LogoPanel: StyledComponent<BoxProps>;
16
+ export declare const LogoRow: StyledComponent<StackProps>;
17
+ export declare const LogoImage: StyledComponent<ImgHTMLAttributes<HTMLImageElement>>;
18
+ /**
19
+ * Red exclamation badge overlaid on the app logo for the
20
+ * reauth_required / workspace_mismatch variants.
21
+ */
22
+ export declare const ErrorBadge: StyledComponent<HTMLAttributes<HTMLSpanElement>>;
23
+ /**
24
+ * Bold indigo CTA matching Figma. theme.palette.purple.primary is
25
+ * the same token the no-connectors card uses for its accent border
26
+ * and text, so the button locks into the existing design system.
27
+ */
28
+ export declare const AuthenticateButton: StyledComponent<ButtonProps>;
29
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../../src/features/connector-cards/components/user-auth-card/style.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,QAAQ,CAQjD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,eAAe,CAAC,QAAQ,CAO/C,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,eAAe,CAAC,UAAU,CAM/C,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,eAAe,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAK1E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,cAAc,CAAC,eAAe,CAAC,CAevE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,WAAW,CAiB3D,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export declare const BASE_URL = "/v1/api";
2
2
  export declare const FETCH_ALL_CARDS_API: string;
3
3
  export declare const FETCH_SPECIFIC_CARD_API: string;
4
+ export declare const USER_AUTH_STATUS_API: string;
5
+ export declare const USER_AUTH_START_API: string;
4
6
  //# sourceMappingURL=api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/features/connector-cards/constants/api.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,YAAY,CAAC;AAClC,eAAO,MAAM,mBAAmB,EAAE,MAAuC,CAAC;AAC1E,eAAO,MAAM,uBAAuB,EAAE,MAAgD,CAAC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/features/connector-cards/constants/api.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,YAAY,CAAC;AAClC,eAAO,MAAM,mBAAmB,EAAE,MAAuC,CAAC;AAC1E,eAAO,MAAM,uBAAuB,EAAE,MAAgD,CAAC;AAIvF,eAAO,MAAM,oBAAoB,EAAE,MAA+D,CAAC;AACnG,eAAO,MAAM,mBAAmB,EAAE,MAA8D,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { UserAuthEntry, UserAuthState } from '../store/userAuth';
2
+ interface UseUserAuthFlowOptions {
3
+ /**
4
+ * Called when the polling loop transitions to `connected`.
5
+ * Typically used to retry the original failed API call.
6
+ */
7
+ onConnected?: () => void;
8
+ }
9
+ interface UseUserAuthFlowReturn {
10
+ entry: UserAuthEntry;
11
+ state: UserAuthState;
12
+ connect: () => Promise<void>;
13
+ isStarting: boolean;
14
+ }
15
+ /**
16
+ * Orchestrates a user-tier connect flow:
17
+ * 1. `connect()` calls POST /user-auth/start and opens the
18
+ * authorization URL in a popup.
19
+ * 2. Marks the connector in_progress in redux.
20
+ * 3. Polls GET /user-auth/status every 2s via tanstack-query;
21
+ * stops polling on a terminal state.
22
+ * 4. On `connected`, calls onConnected so the caller can retry
23
+ * the original failed API call without forcing a remount.
24
+ *
25
+ * Polling cadence + tanstack-query usage mirrors the admin app's
26
+ * authSuccessQuery — same pattern, scoped per-connector here.
27
+ */
28
+ export declare function useUserAuthFlow(connectorId: string, options?: UseUserAuthFlowOptions): UseUserAuthFlowReturn;
29
+ /**
30
+ * One-shot fetcher used at card-mount time. Doesn't poll — drops
31
+ * the result into the slice and exits. The polling-on-in_progress
32
+ * behavior is handled separately by useUserAuthFlow above.
33
+ */
34
+ export declare function useFetchUserAuthStatus(connectorId: string, enabled: boolean): void;
35
+ /**
36
+ * Exposed for tests + the rare "user clicked Disconnect from the
37
+ * customer-identity-mapping menu" path — wipes the slice entry so
38
+ * the next card mount triggers a fresh status fetch.
39
+ */
40
+ export declare function useResetUserAuth(): (connectorId: string) => void;
41
+ export {};
42
+ //# sourceMappingURL=useUserAuthFlow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUserAuthFlow.d.ts","sourceRoot":"","sources":["../../../../src/features/connector-cards/hooks/useUserAuthFlow.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAkB9F,UAAU,sBAAsB;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,UAAU,qBAAqB;IAC7B,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,sBAA2B,GACnC,qBAAqB,CAmJvB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,QAqB3E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,kBAEG,MAAM,UAGxC"}
@@ -0,0 +1,85 @@
1
+ import { PayloadAction } from '@reduxjs/toolkit';
2
+ import { RootState } from '../../../store';
3
+ /**
4
+ * Per-connector user-tier authentication state.
5
+ *
6
+ * The resolver on the backend reads three gates: an LD flag,
7
+ * `connector.user_auth_enabled`, and the API's `auth_tier`. When all
8
+ * three open the flow lands at `user_connectors` lookup. This slice
9
+ * mirrors that lookup's result on the client so the right-panel can
10
+ * render the appropriate state without re-hitting the BE on every
11
+ * card mount.
12
+ */
13
+ export type UserAuthState = 'unknown' | 'disconnected' | 'in_progress' | 'connected' | 'reauth_required' | 'workspace_mismatch';
14
+ export interface UserAuthEntry {
15
+ state: UserAuthState;
16
+ reason?: string;
17
+ externalUserId?: string;
18
+ connectUrl?: string;
19
+ lastChecked?: number;
20
+ }
21
+ export interface UserAuthSlice {
22
+ byConnectorId: {
23
+ [connectorId: string]: UserAuthEntry;
24
+ };
25
+ }
26
+ interface StatusReceivedPayload {
27
+ connectorId: string;
28
+ state: UserAuthState;
29
+ reason?: string;
30
+ externalUserId?: string;
31
+ }
32
+ interface AuthRequiredPayload {
33
+ connectorId: string;
34
+ connectUrl: string;
35
+ reason?: string;
36
+ }
37
+ interface InProgressPayload {
38
+ connectorId: string;
39
+ }
40
+ interface CompletedPayload {
41
+ connectorId: string;
42
+ externalUserId?: string;
43
+ }
44
+ interface FailedPayload {
45
+ connectorId: string;
46
+ reason: string;
47
+ }
48
+ interface ResetPayload {
49
+ connectorId: string;
50
+ }
51
+ export declare const userAuthSlice: import('@reduxjs/toolkit').Slice<UserAuthSlice, {
52
+ /**
53
+ * Result of GET /user-auth/status — full picture from the server.
54
+ * Replaces any local in-progress state too: if a poll comes back
55
+ * with `connected` while we thought we were `in_progress`, we
56
+ * adopt the server's view.
57
+ */
58
+ userAuthStatusReceived(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<StatusReceivedPayload>): void;
59
+ /**
60
+ * Fired from the bifrost 412 interceptor. Carries the connect URL
61
+ * so the UI can launch the popup without a separate
62
+ * /user-auth/start round-trip when the user opts to connect.
63
+ * Multiple concurrent 412s for the same connector are naturally
64
+ * deduped because we key on connectorId.
65
+ */
66
+ userAuthRequired(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<AuthRequiredPayload>): void;
67
+ userAuthInProgress(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<InProgressPayload>): void;
68
+ userAuthCompleted(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<CompletedPayload>): void;
69
+ userAuthFailed(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<FailedPayload>): void;
70
+ userAuthReset(state: import('immer').WritableDraft<UserAuthSlice>, action: PayloadAction<ResetPayload>): void;
71
+ }, "userAuth", "userAuth", import('@reduxjs/toolkit').SliceSelectors<UserAuthSlice>>;
72
+ export declare const userAuthStatusReceived: import('@reduxjs/toolkit').ActionCreatorWithPayload<StatusReceivedPayload, "userAuth/userAuthStatusReceived">, userAuthRequired: import('@reduxjs/toolkit').ActionCreatorWithPayload<AuthRequiredPayload, "userAuth/userAuthRequired">, userAuthInProgress: import('@reduxjs/toolkit').ActionCreatorWithPayload<InProgressPayload, "userAuth/userAuthInProgress">, userAuthCompleted: import('@reduxjs/toolkit').ActionCreatorWithPayload<CompletedPayload, "userAuth/userAuthCompleted">, userAuthFailed: import('@reduxjs/toolkit').ActionCreatorWithPayload<FailedPayload, "userAuth/userAuthFailed">, userAuthReset: import('@reduxjs/toolkit').ActionCreatorWithPayload<ResetPayload, "userAuth/userAuthReset">;
73
+ declare const _default: import('redux').Reducer<UserAuthSlice>;
74
+ export default _default;
75
+ export declare const selectUserAuthEntry: (state: RootState, connectorId: string) => UserAuthEntry;
76
+ export declare const selectUserAuthState: (state: RootState, connectorId: string) => UserAuthState;
77
+ export declare const selectIsUserConnected: (state: RootState, connectorId: string) => boolean;
78
+ export declare const selectConnectUrl: (state: RootState, connectorId: string) => string | undefined;
79
+ /**
80
+ * Any connector currently in the in_progress state. The modal mounts
81
+ * once at the app level rather than per-card; this selector tells it
82
+ * whether to render.
83
+ */
84
+ export declare const selectAnyInProgressConnectorId: (state: RootState) => string | undefined;
85
+ //# sourceMappingURL=userAuth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userAuth.d.ts","sourceRoot":"","sources":["../../../../src/features/connector-cards/store/userAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;GASG;AAEH,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,cAAc,GACd,aAAa,GACb,WAAW,GACX,iBAAiB,GACjB,oBAAoB,CAAC;AAEzB,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA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,qBAAqB,UAAW,SAAS,eAAe,MAAM,KAAG,OACf,CAAC;AAEhE,eAAO,MAAM,gBAAgB,UAAW,SAAS,eAAe,MAAM,KAAG,MAAM,GAAG,SAC9B,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,UAAW,SAAS,KAAG,MAAM,GAAG,SAK1E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=userAuth.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userAuth.test.d.ts","sourceRoot":"","sources":["../../../../src/features/connector-cards/store/userAuth.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Wires the bifrost transport's 412 USER_AUTH_REQUIRED hook to the
3
+ * agent app's redux store. Bifrost is host-agnostic by design — it
4
+ * holds a callback reference rather than importing redux directly,
5
+ * so we attach the dispatcher here on the agent side.
6
+ *
7
+ * Idempotent: hosts that initialize the agent multiple times in
8
+ * one page session (rare but possible in single-page consumers)
9
+ * won't double-fire the dispatch because the callback assignment
10
+ * just overwrites the previous reference.
11
+ */
12
+ export declare const registerUserAuthCallback: () => void;
13
+ //# sourceMappingURL=registerUserAuthCallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerUserAuthCallback.d.ts","sourceRoot":"","sources":["../../../../src/features/connector-cards/utils/registerUserAuthCallback.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,QAAO,IAsB3C,CAAC"}