@quiltt/capacitor 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 ADDED
@@ -0,0 +1,9 @@
1
+ # MIT License
2
+
3
+ Copyright (c) Quiltt, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'QuilttConnector'
7
+ s.version = package['version']
8
+ s.summary = 'Quiltt Connector Capacitor Plugin'
9
+ s.license = package['license']
10
+ s.homepage = package['repository']['url'].gsub(/^git\+/, '').gsub(/\.git$/, '')
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'].gsub(/^git\+/, ''), :tag => s.version.to_s }
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '14.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.1'
17
+ end
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ # @quiltt/capacitor
2
+
3
+ [![npm version](https://badge.fury.io/js/@quiltt%2Fcapacitor.svg)](https://badge.fury.io/js/@quiltt%2Fcapacitor)
4
+ [![CI](https://github.com/quiltt/quiltt-js/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/quiltt/quiltt-js/actions/workflows/ci.yml)
5
+
6
+ Quiltt Connector SDK for Capacitor and Ionic apps on iOS, Android, and web.
7
+
8
+ | Import | Use Case |
9
+ | ------------------------- | ------------------------------------------------ |
10
+ | `@quiltt/capacitor` | Any framework (Vue, Angular, Svelte, vanilla JS) |
11
+ | `@quiltt/capacitor/vue` | Vue 3 components and composables |
12
+ | `@quiltt/capacitor/react` | React components and hooks |
13
+
14
+ ## Installation
15
+
16
+ ```shell
17
+ npm install @quiltt/capacitor
18
+ npx cap sync
19
+ ```
20
+
21
+ ## Deep Link Configuration
22
+
23
+ Configure URL schemes for OAuth callbacks from bank authentication.
24
+
25
+ **iOS** — `ios/App/Info.plist`:
26
+
27
+ ```xml
28
+ <key>CFBundleURLTypes</key>
29
+ <array>
30
+ <dict>
31
+ <key>CFBundleURLSchemes</key>
32
+ <array>
33
+ <string>myapp</string>
34
+ </array>
35
+ </dict>
36
+ </array>
37
+ ```
38
+
39
+ **Android** — `android/app/src/main/AndroidManifest.xml`:
40
+
41
+ ```xml
42
+ <intent-filter>
43
+ <action android:name="android.intent.action.VIEW" />
44
+ <category android:name="android.intent.category.DEFAULT" />
45
+ <category android:name="android.intent.category.BROWSABLE" />
46
+ <data android:scheme="myapp" />
47
+ </intent-filter>
48
+ ```
49
+
50
+ ## Vue 3
51
+
52
+ ```shell
53
+ npm install @quiltt/capacitor @quiltt/vue vue
54
+ ```
55
+
56
+ ```typescript
57
+ // main.ts
58
+ import { createApp } from 'vue'
59
+ import { QuilttPlugin } from '@quiltt/capacitor/vue'
60
+
61
+ createApp(App).use(QuilttPlugin).mount('#app')
62
+ ```
63
+
64
+ ```vue
65
+ <script setup lang="ts">
66
+ import { QuilttConnector, QuilttConnectorPlugin } from '@quiltt/capacitor/vue'
67
+ import { onMounted, onUnmounted, ref } from 'vue'
68
+
69
+ const connectorRef = ref()
70
+
71
+ onMounted(() => {
72
+ QuilttConnectorPlugin.addListener('deepLink', ({ url }) => {
73
+ connectorRef.value?.handleOAuthCallback(url)
74
+ })
75
+ })
76
+ onUnmounted(() => QuilttConnectorPlugin.removeAllListeners())
77
+ </script>
78
+
79
+ <template>
80
+ <QuilttConnector
81
+ ref="connectorRef"
82
+ connector-id="YOUR_CONNECTOR_ID"
83
+ app-launcher-url="https://app.example.com/quiltt/callback"
84
+ @exit-success="(m) => console.log('Connected:', m.connectionId)"
85
+ @navigate="(url) => QuilttConnectorPlugin.openUrl({ url })"
86
+ style="width: 100%; height: 100vh"
87
+ />
88
+ </template>
89
+ ```
90
+
91
+ For modal-based connection:
92
+
93
+ ```vue
94
+ <QuilttButton connector-id="YOUR_CONNECTOR_ID" @exit-success="handleSuccess">
95
+ Add Bank Account
96
+ </QuilttButton>
97
+ ```
98
+
99
+ ## React
100
+
101
+ ```shell
102
+ npm install @quiltt/capacitor @quiltt/react react react-dom
103
+ ```
104
+
105
+ ```tsx
106
+ import { QuilttProvider, QuilttConnector } from '@quiltt/capacitor/react'
107
+
108
+ export const App = () => (
109
+ <QuilttProvider token="YOUR_SESSION_TOKEN">
110
+ <QuilttConnector
111
+ connectorId="YOUR_CONNECTOR_ID"
112
+ appLauncherUrl="https://app.example.com/quiltt/callback"
113
+ onExitSuccess={(m) => console.log('Connected:', m.connectionId)}
114
+ style={{ flex: 1 }}
115
+ />
116
+ </QuilttProvider>
117
+ )
118
+ ```
119
+
120
+ OAuth is handled automatically—bank auth opens in the system browser and deep link callbacks are captured on return.
121
+
122
+ For modal-based connection:
123
+
124
+ ```tsx
125
+ <QuilttButton connectorId="YOUR_CONNECTOR_ID" onExitSuccess={handleSuccess}>
126
+ Add Account
127
+ </QuilttButton>
128
+ ```
129
+
130
+ ## Other Frameworks
131
+
132
+ Use the native plugin directly with Angular, Svelte, or vanilla JS:
133
+
134
+ ```typescript
135
+ import { QuilttConnector } from '@quiltt/capacitor'
136
+
137
+ // Open OAuth URL in system browser
138
+ await QuilttConnector.openUrl({ url: 'https://...' })
139
+
140
+ // Listen for deep link callbacks
141
+ await QuilttConnector.addListener('deepLink', ({ url }) => {
142
+ console.log('OAuth callback:', url)
143
+ })
144
+ ```
145
+
146
+ ## Reconnection
147
+
148
+ Pass a `connectionId` / `connection-id` to reconnect an existing connection:
149
+
150
+ ```tsx
151
+ <QuilttConnector connectionId="YOUR_EXISTING_CONNECTION_ID" ... />
152
+ ```
153
+
154
+ ## API Reference
155
+
156
+ ### Native Plugin
157
+
158
+ ```typescript
159
+ import { QuilttConnector } from '@quiltt/capacitor'
160
+ ```
161
+
162
+ | Method | Description |
163
+ | ----------------------------------- | ------------------------------------- |
164
+ | `openUrl({ url })` | Opens URL in system browser |
165
+ | `getLaunchUrl()` | Returns the URL that launched the app |
166
+ | `addListener('deepLink', callback)` | Listens for deep link callbacks |
167
+ | `removeAllListeners()` | Removes all event listeners |
168
+
169
+ ### Component Props
170
+
171
+ | Prop | Type | Description |
172
+ | ---------------- | -------------------- | --------------------------------------- |
173
+ | `connectorId` | `string` | **Required.** Quiltt Connector ID |
174
+ | `connectionId` | `string` | Existing connection ID for reconnection |
175
+ | `institution` | `string` | Pre-select an institution |
176
+ | `appLauncherUrl` | `string` | Deep link URL for OAuth callbacks |
177
+ | `onLoad` | `(metadata) => void` | Connector loaded |
178
+ | `onExitSuccess` | `(metadata) => void` | Connection successful |
179
+ | `onExitAbort` | `(metadata) => void` | User cancelled |
180
+ | `onExitError` | `(metadata) => void` | Error occurred |
181
+
182
+ ### Re-exports
183
+
184
+ `@quiltt/capacitor/react` re-exports everything from `@quiltt/react`:
185
+
186
+ - Components: `QuilttProvider`, `QuilttButton`, `QuilttContainer`
187
+ - Hooks: `useQuilttSession`, `useQuilttConnector`, `useQuilttClient`
188
+ - Apollo Client: `useQuery`, `useMutation`, `gql`
189
+
190
+ `@quiltt/capacitor/vue` re-exports everything from `@quiltt/vue`.
191
+
192
+ ## Troubleshooting
193
+
194
+ ### OAuth redirects not working
195
+
196
+ - Verify `appLauncherUrl` matches your URL scheme
197
+ - Run `npx cap sync` after configuration changes
198
+
199
+ ### Blank screen after bank auth
200
+
201
+ - Check browser console for errors
202
+ - Verify your Connector ID
203
+
204
+ ## Resources
205
+
206
+ - [Capacitor SDK Guide](https://www.quiltt.dev/connector/sdk/capacitor)
207
+ - [Issuing Session Tokens](https://www.quiltt.dev/authentication/issuing-session-tokens)
208
+ - [Connector Configuration](https://www.quiltt.dev/connector)
209
+ - [Capacitor React Example](../../examples/capacitor-react/README.md)
210
+ - [Capacitor Vue Example](../../examples/capacitor-vue/README.md)
211
+
212
+ ## License
213
+
214
+ MIT
@@ -0,0 +1,59 @@
1
+ ext {
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
6
+ }
7
+
8
+ buildscript {
9
+ ext.kotlin_version = project.hasProperty('kotlinVersion') ? rootProject.ext.kotlinVersion : '1.9.22'
10
+ repositories {
11
+ google()
12
+ mavenCentral()
13
+ }
14
+ dependencies {
15
+ classpath 'com.android.tools.build:gradle:8.2.1'
16
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
17
+ }
18
+ }
19
+
20
+ apply plugin: 'com.android.library'
21
+ apply plugin: 'kotlin-android'
22
+
23
+ android {
24
+ namespace "app.quiltt.capacitor"
25
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
26
+ defaultConfig {
27
+ minSdk project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
28
+ targetSdk project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
29
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
30
+ }
31
+ buildTypes {
32
+ release {
33
+ minifyEnabled false
34
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
35
+ }
36
+ }
37
+ compileOptions {
38
+ sourceCompatibility JavaVersion.VERSION_17
39
+ targetCompatibility JavaVersion.VERSION_17
40
+ }
41
+ kotlinOptions {
42
+ jvmTarget = '17'
43
+ }
44
+ }
45
+
46
+ repositories {
47
+ google()
48
+ mavenCentral()
49
+ }
50
+
51
+ dependencies {
52
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
53
+ implementation project(':capacitor-android')
54
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
55
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
56
+ testImplementation "junit:junit:$junitVersion"
57
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
58
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
59
+ }
@@ -0,0 +1,11 @@
1
+ # Add project specific ProGuard rules here.
2
+ # By default, the flags in this file are appended to flags specified
3
+ # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
+ # You can edit the include path and order by changing the proguardFiles
5
+ # directive in build.gradle.
6
+ #
7
+ # For more details, see
8
+ # http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+ # Keep Quiltt Connector plugin classes
11
+ -keep class app.quiltt.capacitor.** { *; }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,83 @@
1
+ package app.quiltt.capacitor
2
+
3
+ import android.content.Intent
4
+ import android.net.Uri
5
+ import com.getcapacitor.JSObject
6
+ import com.getcapacitor.Plugin
7
+ import com.getcapacitor.PluginCall
8
+ import com.getcapacitor.PluginMethod
9
+ import com.getcapacitor.annotation.CapacitorPlugin
10
+
11
+ /**
12
+ * QuilttConnector Capacitor Plugin for Android
13
+ * Handles deep linking, URL opening, and OAuth redirect flows for Quiltt Connector integration
14
+ */
15
+ @CapacitorPlugin(name = "QuilttConnector")
16
+ class QuilttConnectorPlugin : Plugin() {
17
+ private var launchUrl: String? = null
18
+
19
+ override fun load() {
20
+ // Check if the app was launched via an intent with a URL
21
+ val intent = activity?.intent
22
+ handleIntent(intent)
23
+ }
24
+
25
+ override fun handleOnNewIntent(intent: Intent) {
26
+ super.handleOnNewIntent(intent)
27
+ handleIntent(intent)
28
+ }
29
+
30
+ private fun handleIntent(intent: Intent?) {
31
+ val data = intent?.data
32
+ if (data != null) {
33
+ val url = data.toString()
34
+ launchUrl = url
35
+
36
+ // Notify JavaScript listeners
37
+ val ret = JSObject()
38
+ ret.put("url", url)
39
+ notifyListeners("deepLink", ret)
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Opens a URL in the system browser
45
+ * Used for OAuth flows and external authentication
46
+ */
47
+ @PluginMethod
48
+ fun openUrl(call: PluginCall) {
49
+ val urlString = call.getString("url")
50
+ if (urlString.isNullOrEmpty()) {
51
+ call.reject("Invalid URL")
52
+ return
53
+ }
54
+
55
+ try {
56
+ val uri = Uri.parse(urlString)
57
+ val intent = Intent(Intent.ACTION_VIEW, uri)
58
+ intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
59
+ context.startActivity(intent)
60
+
61
+ val ret = JSObject()
62
+ ret.put("completed", true)
63
+ call.resolve(ret)
64
+ } catch (e: Exception) {
65
+ call.reject("Failed to open URL: ${e.message}")
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Returns the URL that launched the app (if any)
71
+ * Used to handle OAuth callbacks and deep link navigation
72
+ */
73
+ @PluginMethod
74
+ fun getLaunchUrl(call: PluginCall) {
75
+ val ret = JSObject()
76
+ if (launchUrl != null) {
77
+ ret.put("url", launchUrl)
78
+ } else {
79
+ ret.put("url", JSObject.NULL)
80
+ }
81
+ call.resolve(ret)
82
+ }
83
+ }
package/dist/index.cjs ADDED
@@ -0,0 +1,12 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ /**
6
+ * Native Capacitor plugin for deep link handling and URL opening
7
+ * Used internally by QuilttConnector component for OAuth flows
8
+ */ const QuilttConnector = core.registerPlugin('QuilttConnector', {
9
+ web: ()=>Promise.resolve().then(function () { return require('./web-BgcuNl8a.cjs'); }).then((m)=>new m.QuilttConnectorWeb())
10
+ });
11
+
12
+ exports.QuilttConnector = QuilttConnector;
@@ -0,0 +1,86 @@
1
+ import { PluginListenerHandle } from '@capacitor/core';
2
+
3
+ /**
4
+ * Options for opening a URL in the system browser
5
+ */
6
+ interface OpenUrlOptions {
7
+ /**
8
+ * The URL to open in the system browser
9
+ */
10
+ url: string;
11
+ }
12
+ /**
13
+ * Event data when a deep link is received
14
+ */
15
+ interface DeepLinkEvent {
16
+ /**
17
+ * The full URL that was used to open the app, or null if no URL was present
18
+ */
19
+ url: string | null;
20
+ }
21
+ /**
22
+ * Listener function for deep link events
23
+ */
24
+ type DeepLinkListener = (event: DeepLinkEvent) => void;
25
+ /**
26
+ * The Quiltt Connector Capacitor plugin interface.
27
+ *
28
+ * This plugin handles native functionality required for the Quiltt Connector:
29
+ * - Opening OAuth URLs in the system browser
30
+ * - Handling deep links / App Links / Universal Links for OAuth callbacks
31
+ */
32
+ interface QuilttConnectorPlugin {
33
+ /**
34
+ * Open a URL in the system browser.
35
+ *
36
+ * This is used for OAuth flows where the user needs to authenticate
37
+ * with their financial institution in an external browser.
38
+ *
39
+ * @param options - The options containing the URL to open
40
+ * @returns A promise that resolves when the browser is opened
41
+ *
42
+ * @since 5.0.3
43
+ */
44
+ openUrl(options: OpenUrlOptions): Promise<{
45
+ completed: boolean;
46
+ }>;
47
+ /**
48
+ * Get the URL that was used to launch the app, if any.
49
+ *
50
+ * This is useful for handling OAuth callbacks when the app is opened
51
+ * from a Universal Link (iOS) or App Link (Android).
52
+ *
53
+ * @returns A promise that resolves with the launch URL, or undefined if none
54
+ *
55
+ * @since 5.0.3
56
+ */
57
+ getLaunchUrl(): Promise<DeepLinkEvent>;
58
+ /**
59
+ * Listen for deep link events.
60
+ *
61
+ * This is called when the app is opened via a Universal Link (iOS)
62
+ * or App Link (Android), typically during OAuth callback flows.
63
+ *
64
+ * @param eventName - The event name ('deepLink')
65
+ * @param listenerFunc - The callback function to handle the event
66
+ * @returns A promise that resolves with a handle to remove the listener
67
+ *
68
+ * @since 5.0.3
69
+ */
70
+ addListener(eventName: 'deepLink', listenerFunc: DeepLinkListener): Promise<PluginListenerHandle>;
71
+ /**
72
+ * Remove all listeners for this plugin.
73
+ *
74
+ * @since 5.0.3
75
+ */
76
+ removeAllListeners(): Promise<void>;
77
+ }
78
+
79
+ /**
80
+ * Native Capacitor plugin for deep link handling and URL opening
81
+ * Used internally by QuilttConnector component for OAuth flows
82
+ */
83
+ declare const QuilttConnector: QuilttConnectorPlugin;
84
+
85
+ export { QuilttConnector };
86
+ export type { DeepLinkEvent, DeepLinkListener, OpenUrlOptions, QuilttConnectorPlugin };
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+
3
+ /**
4
+ * Native Capacitor plugin for deep link handling and URL opening
5
+ * Used internally by QuilttConnector component for OAuth flows
6
+ */ const QuilttConnector = registerPlugin('QuilttConnector', {
7
+ web: ()=>import('./web-CUWsqcUV.js').then((m)=>new m.QuilttConnectorWeb())
8
+ });
9
+
10
+ export { QuilttConnector };