@quiltt/react 4.2.0 → 4.2.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @quiltt/react
|
|
2
2
|
|
|
3
|
+
## 4.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#350](https://github.com/quiltt/quiltt-js/pull/350) [`0233592`](https://github.com/quiltt/quiltt-js/commit/02335928bb872a6588c2ca81a1bd9a081053bd29) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Bugfix: early return in effect prevents reconnect from being called
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`0233592`](https://github.com/quiltt/quiltt-js/commit/02335928bb872a6588c2ca81a1bd9a081053bd29)]:
|
|
10
|
+
- @quiltt/core@4.2.1
|
|
11
|
+
|
|
3
12
|
## 4.2.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export { u as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect-clie
|
|
|
4
4
|
import { Q as QuilttAuthProvider, i as isDeepEqual } from './QuilttAuthProvider-client-DLARZukU.js';
|
|
5
5
|
export { b as useAuthenticateSession, a as useIdentifySession, u as useImportSession, c as useRevokeSession } from './QuilttAuthProvider-client-DLARZukU.js';
|
|
6
6
|
export { u as useQuilttClient } from './useQuilttClient-client-CAAUait1.js';
|
|
7
|
-
import { u as useQuilttConnector } from './useQuilttConnector-client-
|
|
7
|
+
import { u as useQuilttConnector } from './useQuilttConnector-client-CacEgWJN.js';
|
|
8
8
|
export { u as useQuilttSession } from './useQuilttSession-client-Ddb55W0n.js';
|
|
9
9
|
export { u as useQuilttSettings } from './useQuilttSettings-client-BOCBjFXe.js';
|
|
10
10
|
export { u as useSession } from './useSession-client-CCAvnROP.js';
|
package/dist/{useQuilttConnector-client-BK7ybRZe.js → useQuilttConnector-client-CacEgWJN.js}
RENAMED
|
@@ -4,7 +4,7 @@ import { cdnBase } from '@quiltt/core';
|
|
|
4
4
|
import { u as useQuilttSession } from './useQuilttSession-client-Ddb55W0n.js';
|
|
5
5
|
import { u as useScript } from './useScript-client-JCgaTW9n.js';
|
|
6
6
|
|
|
7
|
-
var version = "4.2.
|
|
7
|
+
var version = "4.2.1";
|
|
8
8
|
|
|
9
9
|
const useQuilttConnector = (connectorId, options)=>{
|
|
10
10
|
const status = useScript(`${cdnBase}/v1/connector.js?agent=react-${version}`, {
|
|
@@ -20,50 +20,42 @@ const useQuilttConnector = (connectorId, options)=>{
|
|
|
20
20
|
const prevConnectorIdRef = useRef(connectorId);
|
|
21
21
|
const connectorCreatedRef = useRef(false);
|
|
22
22
|
// Set Session
|
|
23
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: trigger effects when script status changes too
|
|
23
24
|
useEffect(()=>{
|
|
24
25
|
if (typeof Quiltt === 'undefined') return;
|
|
25
|
-
console.debug('[Quiltt] script status: ', status);
|
|
26
26
|
Quiltt.authenticate(session?.token);
|
|
27
27
|
}, [
|
|
28
28
|
status,
|
|
29
29
|
session?.token
|
|
30
30
|
]);
|
|
31
31
|
// Set Connector
|
|
32
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: trigger effects when script status changes too
|
|
32
33
|
useEffect(()=>{
|
|
33
34
|
if (typeof Quiltt === 'undefined' || !connectorId) return;
|
|
34
|
-
console.debug('[Quiltt] script status: ', status);
|
|
35
35
|
const currentConnectionId = options?.connectionId;
|
|
36
36
|
const currentInstitution = options?.institution;
|
|
37
|
-
// Check
|
|
37
|
+
// Check for changes
|
|
38
38
|
const connectionIdChanged = prevConnectionIdRef.current !== currentConnectionId;
|
|
39
39
|
const connectorIdChanged = prevConnectorIdRef.current !== connectorId;
|
|
40
|
-
|
|
41
|
-
//
|
|
42
|
-
if (
|
|
43
|
-
// The SDK will automatically update the existing handler with new connectionId
|
|
44
|
-
// via the DocumentObserver -> Engine.onChange -> Handler.updateOptions flow
|
|
45
|
-
console.debug('[Quiltt] connectionId changed, SDK will handle update automatically');
|
|
46
|
-
// Update our refs
|
|
47
|
-
prevConnectionIdRef.current = currentConnectionId;
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
// Only create new connector if we haven't created one yet or if connectorId changed
|
|
51
|
-
if (!connectorCreatedRef.current || connectorIdChanged) {
|
|
52
|
-
// Create new connector (initial mount or connectorId changed)
|
|
40
|
+
const hasChanges = connectionIdChanged || connectorIdChanged || !connectorCreatedRef.current;
|
|
41
|
+
// Update if there are changes, regardless of what the changes are
|
|
42
|
+
if (hasChanges) {
|
|
53
43
|
if (currentConnectionId) {
|
|
44
|
+
// Always use reconnect when connectionId is available
|
|
54
45
|
setConnector(Quiltt.reconnect(connectorId, {
|
|
55
46
|
connectionId: currentConnectionId
|
|
56
47
|
}));
|
|
57
48
|
} else {
|
|
49
|
+
// Use connect for new connections without connectionId
|
|
58
50
|
setConnector(Quiltt.connect(connectorId, {
|
|
59
51
|
institution: currentInstitution
|
|
60
52
|
}));
|
|
61
53
|
}
|
|
54
|
+
// Update refs
|
|
62
55
|
connectorCreatedRef.current = true;
|
|
56
|
+
prevConnectionIdRef.current = currentConnectionId;
|
|
57
|
+
prevConnectorIdRef.current = connectorId;
|
|
63
58
|
}
|
|
64
|
-
// Update refs
|
|
65
|
-
prevConnectionIdRef.current = currentConnectionId;
|
|
66
|
-
prevConnectorIdRef.current = connectorId;
|
|
67
59
|
}, [
|
|
68
60
|
connectorId,
|
|
69
61
|
options?.connectionId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quiltt/react",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "React Components and Hooks for Quiltt Connector",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"quiltt",
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@apollo/client": "^3.12.4",
|
|
38
38
|
"use-debounce": "^10.0.4",
|
|
39
|
-
"@quiltt/core": "4.2.
|
|
39
|
+
"@quiltt/core": "4.2.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@biomejs/biome": "1.9.4",
|
|
43
|
-
"@types/node": "22.
|
|
43
|
+
"@types/node": "22.15.31",
|
|
44
44
|
"@types/react": "18.3.20",
|
|
45
45
|
"@types/react-dom": "18.3.5",
|
|
46
46
|
"bunchee": "6.3.4",
|
|
47
47
|
"react": "18.3.1",
|
|
48
48
|
"react-dom": "18.3.1",
|
|
49
49
|
"rimraf": "6.0.1",
|
|
50
|
-
"typescript": "5.8.
|
|
50
|
+
"typescript": "5.8.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
@@ -36,52 +36,41 @@ export const useQuilttConnector = (
|
|
|
36
36
|
const connectorCreatedRef = useRef<boolean>(false)
|
|
37
37
|
|
|
38
38
|
// Set Session
|
|
39
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: trigger effects when script status changes too
|
|
39
40
|
useEffect(() => {
|
|
40
41
|
if (typeof Quiltt === 'undefined') return
|
|
41
|
-
console.debug('[Quiltt] script status: ', status)
|
|
42
42
|
|
|
43
43
|
Quiltt.authenticate(session?.token)
|
|
44
44
|
}, [status, session?.token])
|
|
45
45
|
|
|
46
46
|
// Set Connector
|
|
47
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: trigger effects when script status changes too
|
|
47
48
|
useEffect(() => {
|
|
48
49
|
if (typeof Quiltt === 'undefined' || !connectorId) return
|
|
49
|
-
console.debug('[Quiltt] script status: ', status)
|
|
50
50
|
|
|
51
51
|
const currentConnectionId = options?.connectionId
|
|
52
52
|
const currentInstitution = options?.institution
|
|
53
53
|
|
|
54
|
-
// Check
|
|
54
|
+
// Check for changes
|
|
55
55
|
const connectionIdChanged = prevConnectionIdRef.current !== currentConnectionId
|
|
56
56
|
const connectorIdChanged = prevConnectorIdRef.current !== connectorId
|
|
57
|
+
const hasChanges = connectionIdChanged || connectorIdChanged || !connectorCreatedRef.current
|
|
57
58
|
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
if (connectionIdChanged && !connectorIdChanged && connectorCreatedRef.current) {
|
|
61
|
-
// The SDK will automatically update the existing handler with new connectionId
|
|
62
|
-
// via the DocumentObserver -> Engine.onChange -> Handler.updateOptions flow
|
|
63
|
-
console.debug('[Quiltt] connectionId changed, SDK will handle update automatically')
|
|
64
|
-
|
|
65
|
-
// Update our refs
|
|
66
|
-
prevConnectionIdRef.current = currentConnectionId
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Only create new connector if we haven't created one yet or if connectorId changed
|
|
71
|
-
if (!connectorCreatedRef.current || connectorIdChanged) {
|
|
72
|
-
// Create new connector (initial mount or connectorId changed)
|
|
59
|
+
// Update if there are changes, regardless of what the changes are
|
|
60
|
+
if (hasChanges) {
|
|
73
61
|
if (currentConnectionId) {
|
|
62
|
+
// Always use reconnect when connectionId is available
|
|
74
63
|
setConnector(Quiltt.reconnect(connectorId, { connectionId: currentConnectionId }))
|
|
75
64
|
} else {
|
|
65
|
+
// Use connect for new connections without connectionId
|
|
76
66
|
setConnector(Quiltt.connect(connectorId, { institution: currentInstitution }))
|
|
77
67
|
}
|
|
78
68
|
|
|
69
|
+
// Update refs
|
|
79
70
|
connectorCreatedRef.current = true
|
|
71
|
+
prevConnectionIdRef.current = currentConnectionId
|
|
72
|
+
prevConnectorIdRef.current = connectorId
|
|
80
73
|
}
|
|
81
|
-
|
|
82
|
-
// Update refs
|
|
83
|
-
prevConnectionIdRef.current = currentConnectionId
|
|
84
|
-
prevConnectorIdRef.current = connectorId
|
|
85
74
|
}, [connectorId, options?.connectionId, options?.institution, status])
|
|
86
75
|
|
|
87
76
|
// onEvent
|