@quiltt/vue 5.1.2

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.
@@ -0,0 +1,191 @@
1
+ import * as vue from 'vue';
2
+ import { MaybeRefOrGetter, ComputedRef } from 'vue';
3
+ import { ConnectorSDKCallbacks, PasscodePayload, UnprocessableData, UsernamePayload, Maybe, QuilttJWT } from '@quiltt/core';
4
+
5
+ /**
6
+ * Quiltt Connector Composable
7
+ *
8
+ * Provides connector management functionality for Vue 3 applications.
9
+ * Loads the Quiltt Connector SDK and manages connector state.
10
+ *
11
+ * @example
12
+ * ```vue
13
+ * <script setup>
14
+ * import { useQuilttConnector } from '@quiltt/vue'
15
+ *
16
+ * const { open } = useQuilttConnector('conn_xxx', {
17
+ * onExitSuccess: (metadata) => {
18
+ * console.log('Connected:', metadata.connectionId)
19
+ * }
20
+ * })
21
+ * </script>
22
+ *
23
+ * <template>
24
+ * <button @click="open">Connect Bank Account</button>
25
+ * </template>
26
+ * ```
27
+ */
28
+
29
+ interface UseQuilttConnectorOptions extends ConnectorSDKCallbacks {
30
+ connectionId?: MaybeRefOrGetter<string | undefined>;
31
+ institution?: MaybeRefOrGetter<string | undefined>;
32
+ appLauncherUrl?: MaybeRefOrGetter<string | undefined>;
33
+ /**
34
+ * @deprecated Use `appLauncherUrl` instead. This property will be removed in a future version.
35
+ * The OAuth redirect URL for mobile or embedded webview flows.
36
+ */
37
+ oauthRedirectUrl?: MaybeRefOrGetter<string | undefined>;
38
+ nonce?: string;
39
+ }
40
+ interface UseQuilttConnectorReturn {
41
+ /** Open the connector modal */
42
+ open: () => void;
43
+ }
44
+ /**
45
+ * Composable for managing Quiltt Connector
46
+ *
47
+ * Loads the Quiltt SDK script and provides methods to open/manage connectors.
48
+ * This composable can run without QuilttPlugin session context; when unavailable,
49
+ * it logs a warning and continues without authenticated session state.
50
+ */
51
+ declare const useQuilttConnector: (connectorId?: MaybeRefOrGetter<string | undefined>, options?: UseQuilttConnectorOptions) => UseQuilttConnectorReturn;
52
+
53
+ /**
54
+ * Search institutions for a connector.
55
+ * Requires QuilttPlugin session context and throws when used without it.
56
+ */
57
+ declare const useQuilttInstitutions: (connectorId: string, onErrorCallback?: (msg: string) => void) => {
58
+ searchTerm: vue.ComputedRef<string>;
59
+ searchResults: vue.ComputedRef<{
60
+ name: string;
61
+ logoUrl: string;
62
+ }[]>;
63
+ isSearching: vue.ComputedRef<boolean>;
64
+ setSearchTerm: (term: string) => void;
65
+ };
66
+
67
+ type ProviderId = {
68
+ plaid?: string;
69
+ mock?: string;
70
+ mx?: string;
71
+ finicity?: string;
72
+ akoya?: string;
73
+ };
74
+ /**
75
+ * Check whether a provider link is resolvable for a connector.
76
+ * Requires QuilttPlugin session context and throws when used without it.
77
+ */
78
+ declare const useQuilttResolvable: (connectorId: string, onErrorCallback?: (msg: string) => void) => {
79
+ checkResolvable: (providerId: ProviderId) => Promise<boolean | null>;
80
+ isLoading: vue.ComputedRef<boolean>;
81
+ isResolvable: vue.ComputedRef<boolean | null>;
82
+ error: vue.ComputedRef<string | null>;
83
+ };
84
+
85
+ /**
86
+ * Quiltt Session Composable
87
+ *
88
+ * Provides session management functionality for Vue 3 applications.
89
+ * Must be used within a component tree where QuilttPlugin is installed.
90
+ *
91
+ * @example
92
+ * ```vue
93
+ * <script setup>
94
+ * import { useQuilttSession } from '@quiltt/vue'
95
+ *
96
+ * const { session, importSession, revokeSession } = useQuilttSession()
97
+ *
98
+ * // Import a session token
99
+ * await importSession('<SESSION_TOKEN>')
100
+ *
101
+ * // Access session data
102
+ * console.log(session.value?.token)
103
+ *
104
+ * // Revoke the session
105
+ * await revokeSession()
106
+ * </script>
107
+ * ```
108
+ */
109
+
110
+ /**
111
+ * Callbacks for identify session operation
112
+ */
113
+ interface IdentifySessionCallbacks {
114
+ onSuccess?: () => unknown;
115
+ onChallenged?: () => unknown;
116
+ onError?: (errors: UnprocessableData) => unknown;
117
+ onForbidden?: () => unknown;
118
+ }
119
+ /**
120
+ * Callbacks for authenticate session operation
121
+ */
122
+ interface AuthenticateSessionCallbacks {
123
+ onSuccess?: () => unknown;
124
+ onFailure?: () => unknown;
125
+ onError?: (errors: UnprocessableData) => unknown;
126
+ }
127
+ type ImportSession = (token: string, environmentId?: string) => Promise<boolean>;
128
+ type IdentifySession = (payload: UsernamePayload, callbacks: IdentifySessionCallbacks) => Promise<unknown>;
129
+ type AuthenticateSession = (payload: PasscodePayload, callbacks: AuthenticateSessionCallbacks) => Promise<unknown>;
130
+ type RevokeSession = () => Promise<void>;
131
+ type ForgetSession = (token?: string) => void;
132
+ interface UseQuilttSessionReturn {
133
+ /** Current session (reactive) */
134
+ session: ComputedRef<Maybe<QuilttJWT> | undefined>;
135
+ /** Import an existing session token */
136
+ importSession: ImportSession;
137
+ /** Start authentication flow with username/email/phone */
138
+ identifySession: IdentifySession;
139
+ /** Complete authentication with passcode */
140
+ authenticateSession: AuthenticateSession;
141
+ /** Revoke the current session (invalidates token on server) */
142
+ revokeSession: RevokeSession;
143
+ /** Forget the current session locally (without server call) */
144
+ forgetSession: ForgetSession;
145
+ }
146
+ /**
147
+ * Composable for managing Quiltt session state
148
+ *
149
+ * Provides methods for importing, creating, and revoking sessions.
150
+ * Session state is automatically synchronized across components.
151
+ * Requires QuilttPlugin provider context and throws when used without it.
152
+ */
153
+ declare const useQuilttSession: () => UseQuilttSessionReturn;
154
+
155
+ /**
156
+ * Read plugin-provided Quiltt settings.
157
+ * When used without QuilttPlugin context, values are undefined.
158
+ */
159
+ declare const useQuilttSettings: () => {
160
+ clientId: vue.ComputedRef<string | undefined>;
161
+ };
162
+
163
+ declare const useSession: (storageKey?: string) => {
164
+ session: vue.ComputedRef<{
165
+ token: string;
166
+ claims: {
167
+ iss: string;
168
+ sub: string;
169
+ aud: string;
170
+ exp: number;
171
+ nbf: number;
172
+ iat: number;
173
+ jti: string;
174
+ oid: string;
175
+ eid: string;
176
+ cid: string;
177
+ aid: string;
178
+ ver: number;
179
+ rol: "basic" | "core" | "manager" | "super-admin";
180
+ };
181
+ } | null | undefined>;
182
+ setSession: (nextState: Maybe<string> | undefined | ((prev: Maybe<string> | undefined) => Maybe<string> | undefined)) => void;
183
+ };
184
+
185
+ declare const useStorage: <T>(key: string, initialState?: Maybe<T>) => {
186
+ storage: vue.ComputedRef<any>;
187
+ setStorage: (nextState: Maybe<T> | undefined | ((prev: Maybe<T> | undefined) => Maybe<T> | undefined)) => void;
188
+ };
189
+
190
+ export { useQuilttConnector, useQuilttInstitutions, useQuilttResolvable, useQuilttSession, useQuilttSettings, useSession, useStorage };
191
+ export type { AuthenticateSession, AuthenticateSessionCallbacks, ForgetSession, IdentifySession, IdentifySessionCallbacks, ImportSession, RevokeSession, UseQuilttConnectorOptions, UseQuilttConnectorReturn, UseQuilttSessionReturn };