@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 +9 -0
- package/QuilttConnector.podspec +17 -0
- package/README.md +214 -0
- package/android/build.gradle +59 -0
- package/android/proguard-rules.pro +11 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/kotlin/app/quiltt/capacitor/QuilttConnectorPlugin.kt +83 -0
- package/dist/index.cjs +12 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +10 -0
- package/dist/react.cjs +296 -0
- package/dist/react.d.ts +109 -0
- package/dist/react.js +288 -0
- package/dist/vue.cjs +19 -0
- package/dist/vue.d.ts +87 -0
- package/dist/vue.js +11 -0
- package/dist/web-BgcuNl8a.cjs +42 -0
- package/dist/web-CUWsqcUV.js +42 -0
- package/ios/Sources/QuilttConnectorPlugin/QuilttConnectorPlugin.swift +98 -0
- package/package.json +121 -0
- package/src/components/QuilttConnector.tsx +349 -0
- package/src/components/index.ts +1 -0
- package/src/definitions.ts +81 -0
- package/src/index.ts +31 -0
- package/src/plugin.ts +11 -0
- package/src/react.ts +33 -0
- package/src/vue.ts +42 -0
- package/src/web.ts +44 -0
package/dist/vue.cjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
|
|
3
|
+
var vue = require('@quiltt/vue');
|
|
4
|
+
var core = require('@capacitor/core');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Native Capacitor plugin for deep link handling and URL opening
|
|
8
|
+
* Used internally by QuilttConnector component for OAuth flows
|
|
9
|
+
*/ const QuilttConnector = core.registerPlugin('QuilttConnector', {
|
|
10
|
+
web: ()=>Promise.resolve().then(function () { return require('./web-BgcuNl8a.cjs'); }).then((m)=>new m.QuilttConnectorWeb())
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
exports.QuilttConnectorPlugin = QuilttConnector;
|
|
14
|
+
Object.keys(vue).forEach(function (k) {
|
|
15
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return vue[k]; }
|
|
18
|
+
});
|
|
19
|
+
});
|
package/dist/vue.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export * from '@quiltt/vue';
|
|
2
|
+
import { PluginListenerHandle } from '@capacitor/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for opening a URL in the system browser
|
|
6
|
+
*/
|
|
7
|
+
interface OpenUrlOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The URL to open in the system browser
|
|
10
|
+
*/
|
|
11
|
+
url: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Event data when a deep link is received
|
|
15
|
+
*/
|
|
16
|
+
interface DeepLinkEvent {
|
|
17
|
+
/**
|
|
18
|
+
* The full URL that was used to open the app, or null if no URL was present
|
|
19
|
+
*/
|
|
20
|
+
url: string | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Listener function for deep link events
|
|
24
|
+
*/
|
|
25
|
+
type DeepLinkListener = (event: DeepLinkEvent) => void;
|
|
26
|
+
/**
|
|
27
|
+
* The Quiltt Connector Capacitor plugin interface.
|
|
28
|
+
*
|
|
29
|
+
* This plugin handles native functionality required for the Quiltt Connector:
|
|
30
|
+
* - Opening OAuth URLs in the system browser
|
|
31
|
+
* - Handling deep links / App Links / Universal Links for OAuth callbacks
|
|
32
|
+
*/
|
|
33
|
+
interface QuilttConnectorPlugin {
|
|
34
|
+
/**
|
|
35
|
+
* Open a URL in the system browser.
|
|
36
|
+
*
|
|
37
|
+
* This is used for OAuth flows where the user needs to authenticate
|
|
38
|
+
* with their financial institution in an external browser.
|
|
39
|
+
*
|
|
40
|
+
* @param options - The options containing the URL to open
|
|
41
|
+
* @returns A promise that resolves when the browser is opened
|
|
42
|
+
*
|
|
43
|
+
* @since 5.0.3
|
|
44
|
+
*/
|
|
45
|
+
openUrl(options: OpenUrlOptions): Promise<{
|
|
46
|
+
completed: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Get the URL that was used to launch the app, if any.
|
|
50
|
+
*
|
|
51
|
+
* This is useful for handling OAuth callbacks when the app is opened
|
|
52
|
+
* from a Universal Link (iOS) or App Link (Android).
|
|
53
|
+
*
|
|
54
|
+
* @returns A promise that resolves with the launch URL, or undefined if none
|
|
55
|
+
*
|
|
56
|
+
* @since 5.0.3
|
|
57
|
+
*/
|
|
58
|
+
getLaunchUrl(): Promise<DeepLinkEvent>;
|
|
59
|
+
/**
|
|
60
|
+
* Listen for deep link events.
|
|
61
|
+
*
|
|
62
|
+
* This is called when the app is opened via a Universal Link (iOS)
|
|
63
|
+
* or App Link (Android), typically during OAuth callback flows.
|
|
64
|
+
*
|
|
65
|
+
* @param eventName - The event name ('deepLink')
|
|
66
|
+
* @param listenerFunc - The callback function to handle the event
|
|
67
|
+
* @returns A promise that resolves with a handle to remove the listener
|
|
68
|
+
*
|
|
69
|
+
* @since 5.0.3
|
|
70
|
+
*/
|
|
71
|
+
addListener(eventName: 'deepLink', listenerFunc: DeepLinkListener): Promise<PluginListenerHandle>;
|
|
72
|
+
/**
|
|
73
|
+
* Remove all listeners for this plugin.
|
|
74
|
+
*
|
|
75
|
+
* @since 5.0.3
|
|
76
|
+
*/
|
|
77
|
+
removeAllListeners(): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Native Capacitor plugin for deep link handling and URL opening
|
|
82
|
+
* Used internally by QuilttConnector component for OAuth flows
|
|
83
|
+
*/
|
|
84
|
+
declare const QuilttConnector: QuilttConnectorPlugin;
|
|
85
|
+
|
|
86
|
+
export { QuilttConnector as QuilttConnectorPlugin };
|
|
87
|
+
export type { DeepLinkEvent, DeepLinkListener, OpenUrlOptions };
|
package/dist/vue.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from '@quiltt/vue';
|
|
2
|
+
import { registerPlugin } from '@capacitor/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Native Capacitor plugin for deep link handling and URL opening
|
|
6
|
+
* Used internally by QuilttConnector component for OAuth flows
|
|
7
|
+
*/ const QuilttConnector = registerPlugin('QuilttConnector', {
|
|
8
|
+
web: ()=>import('./web-CUWsqcUV.js').then((m)=>new m.QuilttConnectorWeb())
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export { QuilttConnector as QuilttConnectorPlugin };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var core = require('@capacitor/core');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Web implementation of the Quiltt Connector plugin.
|
|
5
|
+
*
|
|
6
|
+
* On web, OAuth flows typically work without special handling since
|
|
7
|
+
* the browser handles redirects automatically. This implementation
|
|
8
|
+
* provides basic functionality for web compatibility.
|
|
9
|
+
*/ class QuilttConnectorWeb extends core.WebPlugin {
|
|
10
|
+
/**
|
|
11
|
+
* Open a URL in a new browser tab/window.
|
|
12
|
+
*
|
|
13
|
+
* On web, this simply opens the URL in a new tab using window.open.
|
|
14
|
+
*/ async openUrl(options) {
|
|
15
|
+
window.open(options.url, '_blank', 'noopener,noreferrer');
|
|
16
|
+
return {
|
|
17
|
+
completed: true
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the launch URL on web.
|
|
22
|
+
*
|
|
23
|
+
* On web, we check the current URL for any OAuth callback parameters.
|
|
24
|
+
* This is useful when the user is redirected back to the app after OAuth.
|
|
25
|
+
*/ async getLaunchUrl() {
|
|
26
|
+
const currentUrl = window.location.href;
|
|
27
|
+
// Check if the current URL contains OAuth callback parameters
|
|
28
|
+
// Common patterns include: code=, state=, error=
|
|
29
|
+
const url = new URL(currentUrl);
|
|
30
|
+
const hasOAuthParams = url.searchParams.has('code') || url.searchParams.has('state') || url.searchParams.has('error');
|
|
31
|
+
if (hasOAuthParams) {
|
|
32
|
+
return {
|
|
33
|
+
url: currentUrl
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
url: null
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.QuilttConnectorWeb = QuilttConnectorWeb;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Web implementation of the Quiltt Connector plugin.
|
|
5
|
+
*
|
|
6
|
+
* On web, OAuth flows typically work without special handling since
|
|
7
|
+
* the browser handles redirects automatically. This implementation
|
|
8
|
+
* provides basic functionality for web compatibility.
|
|
9
|
+
*/ class QuilttConnectorWeb extends WebPlugin {
|
|
10
|
+
/**
|
|
11
|
+
* Open a URL in a new browser tab/window.
|
|
12
|
+
*
|
|
13
|
+
* On web, this simply opens the URL in a new tab using window.open.
|
|
14
|
+
*/ async openUrl(options) {
|
|
15
|
+
window.open(options.url, '_blank', 'noopener,noreferrer');
|
|
16
|
+
return {
|
|
17
|
+
completed: true
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the launch URL on web.
|
|
22
|
+
*
|
|
23
|
+
* On web, we check the current URL for any OAuth callback parameters.
|
|
24
|
+
* This is useful when the user is redirected back to the app after OAuth.
|
|
25
|
+
*/ async getLaunchUrl() {
|
|
26
|
+
const currentUrl = window.location.href;
|
|
27
|
+
// Check if the current URL contains OAuth callback parameters
|
|
28
|
+
// Common patterns include: code=, state=, error=
|
|
29
|
+
const url = new URL(currentUrl);
|
|
30
|
+
const hasOAuthParams = url.searchParams.has('code') || url.searchParams.has('state') || url.searchParams.has('error');
|
|
31
|
+
if (hasOAuthParams) {
|
|
32
|
+
return {
|
|
33
|
+
url: currentUrl
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
url: null
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { QuilttConnectorWeb };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
/// QuilttConnector Capacitor Plugin for iOS
|
|
5
|
+
/// Handles deep linking, URL opening, and OAuth redirect flows for Quiltt Connector integration
|
|
6
|
+
@objc(QuilttConnectorPlugin)
|
|
7
|
+
public class QuilttConnectorPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
8
|
+
public let identifier = "QuilttConnectorPlugin"
|
|
9
|
+
public let jsName = "QuilttConnector"
|
|
10
|
+
public let pluginMethods: [CAPPluginMethod] = [
|
|
11
|
+
CAPPluginMethod(name: "openUrl", returnType: CAPPluginReturnPromise),
|
|
12
|
+
CAPPluginMethod(name: "getLaunchUrl", returnType: CAPPluginReturnPromise)
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
private var launchUrl: URL?
|
|
16
|
+
|
|
17
|
+
public override func load() {
|
|
18
|
+
NotificationCenter.default.addObserver(
|
|
19
|
+
self,
|
|
20
|
+
selector: #selector(handleOpenUrl(_:)),
|
|
21
|
+
name: Notification.Name.capacitorOpenURL,
|
|
22
|
+
object: nil
|
|
23
|
+
)
|
|
24
|
+
NotificationCenter.default.addObserver(
|
|
25
|
+
self,
|
|
26
|
+
selector: #selector(handleOpenUrl(_:)),
|
|
27
|
+
name: Notification.Name.capacitorOpenUniversalLink,
|
|
28
|
+
object: nil
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
deinit {
|
|
33
|
+
NotificationCenter.default.removeObserver(self)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// Handle incoming URLs from deep links or universal links
|
|
37
|
+
@objc private func handleOpenUrl(_ notification: Notification) {
|
|
38
|
+
guard let object = notification.object as? [String: Any],
|
|
39
|
+
let url = object["url"] as? URL else {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Store as launch URL
|
|
44
|
+
launchUrl = url
|
|
45
|
+
|
|
46
|
+
// Notify JavaScript listeners
|
|
47
|
+
notifyListeners("deepLink", data: [
|
|
48
|
+
"url": url.absoluteString
|
|
49
|
+
])
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// Opens a URL in the system browser
|
|
53
|
+
/// Used for OAuth flows and external authentication
|
|
54
|
+
@objc func openUrl(_ call: CAPPluginCall) {
|
|
55
|
+
guard let urlString = call.getString("url"),
|
|
56
|
+
let url = URL(string: urlString) else {
|
|
57
|
+
call.reject("Invalid URL")
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
DispatchQueue.main.async {
|
|
62
|
+
if #available(iOS 10.0, *) {
|
|
63
|
+
UIApplication.shared.open(url, options: [:]) { success in
|
|
64
|
+
if success {
|
|
65
|
+
call.resolve([
|
|
66
|
+
"completed": true
|
|
67
|
+
])
|
|
68
|
+
} else {
|
|
69
|
+
call.reject("Failed to open URL")
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
let success = UIApplication.shared.openURL(url)
|
|
74
|
+
if success {
|
|
75
|
+
call.resolve([
|
|
76
|
+
"completed": true
|
|
77
|
+
])
|
|
78
|
+
} else {
|
|
79
|
+
call.reject("Failed to open URL")
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/// Returns the URL that launched the app (if any)
|
|
86
|
+
/// Used to handle OAuth callbacks and deep link navigation
|
|
87
|
+
@objc func getLaunchUrl(_ call: CAPPluginCall) {
|
|
88
|
+
if let url = launchUrl {
|
|
89
|
+
call.resolve([
|
|
90
|
+
"url": url.absoluteString
|
|
91
|
+
])
|
|
92
|
+
} else {
|
|
93
|
+
call.resolve([
|
|
94
|
+
"url": NSNull()
|
|
95
|
+
])
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quiltt/capacitor",
|
|
3
|
+
"version": "5.1.2",
|
|
4
|
+
"description": "Capacitor plugin for Quiltt Connector",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"quiltt",
|
|
7
|
+
"quiltt-connector",
|
|
8
|
+
"capacitor",
|
|
9
|
+
"capacitor-plugin",
|
|
10
|
+
"ionic",
|
|
11
|
+
"typescript"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/quiltt/quiltt-js/tree/main/packages/capacitor#readme",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/quiltt/quiltt-js.git",
|
|
17
|
+
"directory": "packages/capacitor"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/quiltt/quiltt-js/issues"
|
|
22
|
+
},
|
|
23
|
+
"author": "Quiltt <support@quiltt.io>",
|
|
24
|
+
"sideEffects": [],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"require": "./dist/index.cjs",
|
|
30
|
+
"import": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./react": {
|
|
33
|
+
"types": "./dist/react.d.ts",
|
|
34
|
+
"require": "./dist/react.cjs",
|
|
35
|
+
"import": "./dist/react.js"
|
|
36
|
+
},
|
|
37
|
+
"./vue": {
|
|
38
|
+
"types": "./dist/vue.d.ts",
|
|
39
|
+
"require": "./dist/vue.cjs",
|
|
40
|
+
"import": "./dist/vue.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"module": "./dist/index.js",
|
|
44
|
+
"main": "dist/index.js",
|
|
45
|
+
"types": "dist/index.d.ts",
|
|
46
|
+
"files": [
|
|
47
|
+
"android/src/main/",
|
|
48
|
+
"android/build.gradle",
|
|
49
|
+
"android/proguard-rules.pro",
|
|
50
|
+
"dist/**",
|
|
51
|
+
"src/**",
|
|
52
|
+
"ios/Sources",
|
|
53
|
+
"QuilttConnector.podspec",
|
|
54
|
+
"CHANGELOG.md"
|
|
55
|
+
],
|
|
56
|
+
"dependencies": {},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@biomejs/biome": "2.4.3",
|
|
59
|
+
"@capacitor/android": "8.1.0",
|
|
60
|
+
"@capacitor/core": "8.1.0",
|
|
61
|
+
"@capacitor/ios": "8.1.0",
|
|
62
|
+
"@types/node": "24.11.0",
|
|
63
|
+
"@types/react": "19.2.14",
|
|
64
|
+
"@types/react-dom": "19.2.3",
|
|
65
|
+
"bunchee": "6.9.4",
|
|
66
|
+
"react": "19.2.4",
|
|
67
|
+
"react-dom": "19.2.4",
|
|
68
|
+
"rimraf": "6.1.3",
|
|
69
|
+
"typescript": "5.9.3",
|
|
70
|
+
"vue": "3.5.28",
|
|
71
|
+
"@quiltt/react": "5.1.2",
|
|
72
|
+
"@quiltt/vue": "5.1.2"
|
|
73
|
+
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"@capacitor/core": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
76
|
+
"@quiltt/react": "^5.0.0",
|
|
77
|
+
"@quiltt/vue": "^5.0.0",
|
|
78
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
79
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
80
|
+
"vue": "^3.3.0"
|
|
81
|
+
},
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"@quiltt/react": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"@quiltt/vue": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"react": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"react-dom": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"vue": {
|
|
96
|
+
"optional": true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"capacitor": {
|
|
100
|
+
"ios": {
|
|
101
|
+
"src": "ios"
|
|
102
|
+
},
|
|
103
|
+
"android": {
|
|
104
|
+
"src": "android"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"publishConfig": {
|
|
108
|
+
"access": "public"
|
|
109
|
+
},
|
|
110
|
+
"scripts": {
|
|
111
|
+
"build": "bunchee",
|
|
112
|
+
"clean": "rimraf .turbo dist",
|
|
113
|
+
"dev": "bunchee --watch",
|
|
114
|
+
"lint": "TIMING=1 biome check src/ tests/ --fix",
|
|
115
|
+
"typecheck": "tsc --project tsconfig.json --noEmit",
|
|
116
|
+
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
117
|
+
"verify:ios": "xcodebuild build -scheme QuilttConnector -destination generic/platform=iOS",
|
|
118
|
+
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
119
|
+
"verify:web": "npm run build"
|
|
120
|
+
}
|
|
121
|
+
}
|