@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.
- package/LICENSE.md +9 -0
- package/README.md +212 -0
- package/dist/components/index.cjs +707 -0
- package/dist/components/index.d.ts +278 -0
- package/dist/components/index.js +703 -0
- package/dist/composables/index.cjs +617 -0
- package/dist/composables/index.d.ts +191 -0
- package/dist/composables/index.js +609 -0
- package/dist/index.cjs +75 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/plugin/index.cjs +176 -0
- package/dist/plugin/index.d.ts +48 -0
- package/dist/plugin/index.js +171 -0
- package/package.json +81 -0
- package/src/components/QuilttButton.ts +121 -0
- package/src/components/QuilttConnector.ts +215 -0
- package/src/components/QuilttContainer.ts +130 -0
- package/src/components/index.ts +3 -0
- package/src/composables/index.ts +7 -0
- package/src/composables/useQuilttConnector.ts +312 -0
- package/src/composables/useQuilttInstitutions.ts +114 -0
- package/src/composables/useQuilttResolvable.ts +94 -0
- package/src/composables/useQuilttSession.ts +239 -0
- package/src/composables/useQuilttSettings.ts +15 -0
- package/src/composables/useSession.ts +74 -0
- package/src/composables/useStorage.ts +47 -0
- package/src/constants/deprecation-warnings.ts +2 -0
- package/src/index.ts +34 -0
- package/src/plugin/QuilttPlugin.ts +204 -0
- package/src/plugin/index.ts +23 -0
- package/src/plugin/keys.ts +26 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/telemetry.ts +73 -0
- package/src/version.ts +1 -0
|
@@ -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 };
|