squarefi-bff-api-module 1.25.0 → 1.25.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/CHANGELOG.md +200 -7
- package/dist/hooks/useSupabaseSubscription/specialized.d.ts +1 -1
- package/dist/hooks/useSupabaseSubscription/specialized.js +15 -5
- package/dist/hooks/useSupabaseSubscription/types.d.ts +2 -3
- package/dist/hooks/useSupabaseSubscription/useSupabaseSubscription.d.ts +1 -1
- package/dist/hooks/useSupabaseSubscription/useSupabaseSubscription.js +5 -7
- package/dist/utils/supabase.js +1 -0
- package/package.json +1 -1
- package/src/hooks/useSupabaseSubscription/specialized.ts +2 -7
- package/src/hooks/useSupabaseSubscription/types.ts +2 -3
- package/src/hooks/useSupabaseSubscription/useSupabaseSubscription.ts +6 -8
- package/src/utils/supabase.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,35 +4,228 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
ƒ
|
|
7
8
|
|
|
8
|
-
## [1.25.
|
|
9
|
+
## [1.25.0] - 2025-08-19
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Real-time functionality with Supabase integration
|
|
14
|
+
|
|
15
|
+
## [1.24.35] - 2025-08-19
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Updated CSV export functionality for wallet transactions to use apiClientV2 and enhanced request type
|
|
20
|
+
|
|
21
|
+
## [1.24.34] - 2025-08-14
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Enhanced TransactionList request type by adding pagination and filtering options
|
|
26
|
+
|
|
27
|
+
## [1.24.33] - 2025-08-14
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- Updated response type for WalletsTransactionsController to include total and data fields
|
|
32
|
+
|
|
33
|
+
## [1.24.32] - 2025-08-14
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- Updated response type for WalletsTransactionsController to include JSON content structure
|
|
38
|
+
|
|
39
|
+
## [1.24.31] - 2025-08-14
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- Streamlined TransactionList request type by integrating existing operations and removing redundant fields
|
|
44
|
+
|
|
45
|
+
## [1.24.30] - 2025-08-14
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- Removed unused UserData types and enforced required fields for transaction list request
|
|
50
|
+
|
|
51
|
+
## [1.24.29] - 2025-08-11
|
|
52
|
+
|
|
53
|
+
### Added
|
|
54
|
+
|
|
55
|
+
- PURCHASE type to CardTransactionType enum
|
|
56
|
+
|
|
57
|
+
## [1.24.28] - 2025-08-11
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
|
|
61
|
+
- Enforced required fields for transaction list request parameters
|
|
62
|
+
|
|
63
|
+
## [1.24.27] - 2025-08-11
|
|
64
|
+
|
|
65
|
+
### Changed
|
|
66
|
+
|
|
67
|
+
- Updated transaction list API types and simplified transaction retrieval parameters
|
|
68
|
+
|
|
69
|
+
## [1.24.26] - 2025-08-08
|
|
70
|
+
|
|
71
|
+
### Added
|
|
72
|
+
|
|
73
|
+
- Terms confirmation endpoint and types for KYC process
|
|
74
|
+
|
|
75
|
+
## [1.24.25] - 2025-08-08
|
|
76
|
+
|
|
77
|
+
### Added
|
|
78
|
+
|
|
79
|
+
- PAYMENT type to CardTransactionType enum
|
|
80
|
+
|
|
81
|
+
## [1.24.24] - 2025-08-08
|
|
82
|
+
|
|
83
|
+
### Added
|
|
84
|
+
|
|
85
|
+
- DECLINED status to CardTransactionStatus enum
|
|
86
|
+
|
|
87
|
+
## [1.24.23] - 2025-08-08
|
|
88
|
+
|
|
89
|
+
### Added
|
|
90
|
+
|
|
91
|
+
- COMPLETED status to CardTransactionStatus enum
|
|
92
|
+
|
|
93
|
+
## [1.24.22] - 2025-08-06
|
|
94
|
+
|
|
95
|
+
### Fixed
|
|
96
|
+
|
|
97
|
+
- Updated tenant config endpoint and added optional limits property to API types
|
|
98
|
+
|
|
99
|
+
## [1.24.21] - 2025-08-01
|
|
100
|
+
|
|
101
|
+
### Changed
|
|
102
|
+
|
|
103
|
+
- Introduced ExtendedKey interface to enhance key management types in API
|
|
104
|
+
|
|
105
|
+
## [1.24.20] - 2025-08-01
|
|
106
|
+
|
|
107
|
+
### Added
|
|
108
|
+
|
|
109
|
+
- Integrated frontend module into API structure for enhanced functionality
|
|
110
|
+
|
|
111
|
+
## [1.24.19] - 2025-08-01
|
|
112
|
+
|
|
113
|
+
### Added
|
|
114
|
+
|
|
115
|
+
- Frontend access key management types for creating, listing, regenerating, and revoking API keys
|
|
116
|
+
|
|
117
|
+
## [1.24.18] - 2025-08-01
|
|
118
|
+
|
|
119
|
+
### Changed
|
|
120
|
+
|
|
121
|
+
- Made is_subtract and is_reverse fields mandatory in API types for consistency
|
|
122
|
+
|
|
123
|
+
## [1.24.17] - 2025-08-01
|
|
124
|
+
|
|
125
|
+
### Fixed
|
|
126
|
+
|
|
127
|
+
- Corrected spelling of is_subsctract to is_subtract in API types and updated related calculations in useCalc hook
|
|
128
|
+
|
|
129
|
+
## [1.24.16] - 2025-08-01
|
|
130
|
+
|
|
131
|
+
### Added
|
|
132
|
+
|
|
133
|
+
- Optional is_subsctract and is_reverse fields to various transaction types for improved flexibility
|
|
134
|
+
|
|
135
|
+
## [1.24.15] - 2025-07-31
|
|
136
|
+
|
|
137
|
+
### Added
|
|
138
|
+
|
|
139
|
+
- Extended account details with optional ACH, RTP, wire, and SWIFT structures for enhanced payment processing
|
|
140
|
+
|
|
141
|
+
## [1.24.14] - 2025-07-31
|
|
142
|
+
|
|
143
|
+
### Changed
|
|
144
|
+
|
|
145
|
+
- Enhanced issuing API methods to return ExtendedSubAccountResponse with sub_account_id
|
|
146
|
+
|
|
147
|
+
## [1.24.13] - 2025-07-30
|
|
148
|
+
|
|
149
|
+
### Changed
|
|
150
|
+
|
|
151
|
+
- Updated SubAccountResponse type and enhanced balance method to return sub_account_id
|
|
152
|
+
|
|
153
|
+
## [1.24.12] - 2025-07-29
|
|
154
|
+
|
|
155
|
+
### Added
|
|
156
|
+
|
|
157
|
+
- consent_text field to card details type for enhanced data handling
|
|
158
|
+
|
|
159
|
+
## [1.24.11] - 2025-07-28
|
|
9
160
|
|
|
10
161
|
### Added
|
|
11
162
|
|
|
12
163
|
- New wallet transaction record types for card transfers
|
|
13
164
|
|
|
14
|
-
## [1.
|
|
165
|
+
## [1.24.10] - 2025-07-28
|
|
15
166
|
|
|
16
167
|
### Added
|
|
17
168
|
|
|
18
169
|
- RN_CARDS_OFFRAMP order type and corresponding API request/response structures
|
|
19
170
|
|
|
20
|
-
## [1.
|
|
171
|
+
## [1.24.9] - 2025-07-23
|
|
21
172
|
|
|
22
173
|
### Changed
|
|
23
174
|
|
|
24
|
-
-
|
|
25
|
-
|
|
175
|
+
- Removed unnecessary console logs from apiClientFactory and tokensFactory for cleaner code
|
|
176
|
+
|
|
177
|
+
## [1.24.8] - 2025-07-23
|
|
178
|
+
|
|
179
|
+
### Changed
|
|
180
|
+
|
|
181
|
+
- Streamlined refreshTokens by removing miniApp logs and integrating initData restoration
|
|
182
|
+
|
|
183
|
+
## [1.24.7] - 2025-07-23
|
|
184
|
+
|
|
185
|
+
### Fixed
|
|
186
|
+
|
|
187
|
+
- Awaited miniApp.mount() in refreshTokens to ensure proper initialization of the SDK
|
|
188
|
+
|
|
189
|
+
## [1.24.6] - 2025-07-23
|
|
26
190
|
|
|
27
191
|
### Added
|
|
28
192
|
|
|
29
|
-
-
|
|
193
|
+
- Telegram SDK initialization in tokensFactory
|
|
194
|
+
|
|
195
|
+
## [1.24.4] - 2025-07-23
|
|
196
|
+
|
|
197
|
+
### Added
|
|
198
|
+
|
|
199
|
+
- Console logs in tokensFactory for enhanced debugging of initData and miniApp
|
|
200
|
+
|
|
201
|
+
## [1.24.3] - 2025-07-23
|
|
202
|
+
|
|
203
|
+
### Added
|
|
204
|
+
|
|
205
|
+
- Additional console logs in refreshTokens for improved debugging of token handling
|
|
206
|
+
|
|
207
|
+
## [1.24.2] - 2025-07-23
|
|
208
|
+
|
|
209
|
+
### Changed
|
|
210
|
+
|
|
211
|
+
- Improved error handling in refreshTokens function and added debug logs for better traceability
|
|
212
|
+
|
|
213
|
+
## [1.24.1] - 2025-07-23
|
|
214
|
+
|
|
215
|
+
### Added
|
|
216
|
+
|
|
217
|
+
- Console logs for token refresh handling and authentication flow insights
|
|
30
218
|
|
|
31
219
|
## [1.24.0] - 2025-07-23
|
|
32
220
|
|
|
33
221
|
### Changed
|
|
34
222
|
|
|
35
|
-
-
|
|
223
|
+
- Enhanced refresh token handling for Telegram sign-in methods in TMA
|
|
224
|
+
- Updated Telegram auth types to use request/response structures for improved type safety with optional refresh_token
|
|
225
|
+
|
|
226
|
+
### Added
|
|
227
|
+
|
|
228
|
+
- Improved Telegram authentication workflow with better token management
|
|
36
229
|
|
|
37
230
|
## [1.23.5] - 2025-07-22
|
|
38
231
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseWalletTransactionsSubscriptionProps } from './types';
|
|
2
|
-
export declare const useWalletTransactionsSubscription: ({ walletId,
|
|
2
|
+
export declare const useWalletTransactionsSubscription: ({ walletId, ...props }: UseWalletTransactionsSubscriptionProps) => {
|
|
3
3
|
isConnected: boolean;
|
|
4
4
|
isClientAvailable: boolean;
|
|
5
5
|
};
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.useWalletTransactionsSubscription = void 0;
|
|
4
15
|
const config_1 = require("./config");
|
|
5
16
|
const useSupabaseSubscription_1 = require("./useSupabaseSubscription");
|
|
6
|
-
const useWalletTransactionsSubscription = (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
17
|
+
const useWalletTransactionsSubscription = (_a) => {
|
|
18
|
+
var { walletId } = _a, props = __rest(_a, ["walletId"]);
|
|
19
|
+
return (0, useSupabaseSubscription_1.useSupabaseSubscription)(Object.assign(Object.assign({}, props), { config: (0, config_1.createWalletTransactionsConfig)(walletId || '') }));
|
|
20
|
+
};
|
|
11
21
|
exports.useWalletTransactionsSubscription = useWalletTransactionsSubscription;
|
|
@@ -9,9 +9,8 @@ export interface UseSupabaseSubscriptionProps {
|
|
|
9
9
|
config: SubscriptionConfig;
|
|
10
10
|
callback: (payload?: unknown) => void;
|
|
11
11
|
enabled?: boolean;
|
|
12
|
+
key?: string;
|
|
12
13
|
}
|
|
13
|
-
export interface UseWalletTransactionsSubscriptionProps {
|
|
14
|
+
export interface UseWalletTransactionsSubscriptionProps extends Omit<UseSupabaseSubscriptionProps, 'config'> {
|
|
14
15
|
walletId: string | undefined;
|
|
15
|
-
callback: () => void;
|
|
16
|
-
enabled?: boolean;
|
|
17
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseSupabaseSubscriptionProps } from './types';
|
|
2
|
-
export declare const useSupabaseSubscription: ({ config, callback, enabled }: UseSupabaseSubscriptionProps) => {
|
|
2
|
+
export declare const useSupabaseSubscription: ({ config, callback, enabled, key }: UseSupabaseSubscriptionProps) => {
|
|
3
3
|
isConnected: boolean;
|
|
4
4
|
isClientAvailable: boolean;
|
|
5
5
|
};
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
'use client';
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.useSupabaseSubscription = void 0;
|
|
4
5
|
const react_1 = require("react");
|
|
5
6
|
const supabase_1 = require("../../utils/supabase");
|
|
6
|
-
const useSupabaseSubscription = ({ config, callback, enabled = true }) => {
|
|
7
|
+
const useSupabaseSubscription = ({ config, callback, enabled = true, key }) => {
|
|
7
8
|
const subscriptionRef = (0, react_1.useRef)(null);
|
|
8
9
|
const callbackRef = (0, react_1.useRef)(callback);
|
|
9
10
|
callbackRef.current = callback;
|
|
10
11
|
(0, react_1.useEffect)(() => {
|
|
11
|
-
if (!enabled) {
|
|
12
|
+
if (!enabled || !supabase_1.supabaseClient) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
|
-
if (!supabase_1.supabaseClient) {
|
|
15
|
-
throw new Error('Supabase client is not available');
|
|
16
|
-
}
|
|
17
15
|
if (subscriptionRef.current) {
|
|
18
16
|
supabase_1.supabaseClient.removeChannel(subscriptionRef.current);
|
|
19
17
|
subscriptionRef.current = null;
|
|
20
18
|
}
|
|
21
19
|
const subscription = supabase_1.supabaseClient
|
|
22
|
-
.channel(config.channelName)
|
|
20
|
+
.channel(key || config.channelName)
|
|
23
21
|
.on('postgres_changes', Object.assign({ event: config.event || '*', schema: config.schema || 'public', table: config.table }, (config.filter && { filter: config.filter })), (payload) => callbackRef.current(payload))
|
|
24
22
|
.subscribe();
|
|
25
23
|
subscriptionRef.current = subscription;
|
|
@@ -29,7 +27,7 @@ const useSupabaseSubscription = ({ config, callback, enabled = true }) => {
|
|
|
29
27
|
subscriptionRef.current = null;
|
|
30
28
|
}
|
|
31
29
|
};
|
|
32
|
-
}, [enabled, config.channelName, config.table, config.schema, config.event, config.filter]);
|
|
30
|
+
}, [enabled, config.channelName, config.table, config.schema, config.event, config.filter, supabase_1.supabaseClient, key]);
|
|
33
31
|
return {
|
|
34
32
|
isConnected: !!subscriptionRef.current,
|
|
35
33
|
isClientAvailable: !!supabase_1.supabaseClient,
|
package/dist/utils/supabase.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.supabaseClient = void 0;
|
|
4
4
|
const supabase_js_1 = require("@supabase/supabase-js");
|
|
5
|
+
// Создаем клиент только если есть необходимые environment переменные
|
|
5
6
|
const createSupabaseClient = () => {
|
|
6
7
|
const supabaseUrl = process.env.SUPABASE_URL;
|
|
7
8
|
const supabasePublicKey = process.env.SUPABASE_PUBLIC_KEY;
|
package/package.json
CHANGED
|
@@ -2,13 +2,8 @@ import { createWalletTransactionsConfig } from './config';
|
|
|
2
2
|
import { UseWalletTransactionsSubscriptionProps } from './types';
|
|
3
3
|
import { useSupabaseSubscription } from './useSupabaseSubscription';
|
|
4
4
|
|
|
5
|
-
export const useWalletTransactionsSubscription = ({
|
|
6
|
-
walletId,
|
|
7
|
-
callback,
|
|
8
|
-
enabled = true,
|
|
9
|
-
}: UseWalletTransactionsSubscriptionProps) =>
|
|
5
|
+
export const useWalletTransactionsSubscription = ({ walletId, ...props }: UseWalletTransactionsSubscriptionProps) =>
|
|
10
6
|
useSupabaseSubscription({
|
|
7
|
+
...props,
|
|
11
8
|
config: createWalletTransactionsConfig(walletId || ''),
|
|
12
|
-
callback,
|
|
13
|
-
enabled: enabled && !!walletId,
|
|
14
9
|
});
|
|
@@ -10,10 +10,9 @@ export interface UseSupabaseSubscriptionProps {
|
|
|
10
10
|
config: SubscriptionConfig;
|
|
11
11
|
callback: (payload?: unknown) => void;
|
|
12
12
|
enabled?: boolean;
|
|
13
|
+
key?: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export interface UseWalletTransactionsSubscriptionProps {
|
|
16
|
+
export interface UseWalletTransactionsSubscriptionProps extends Omit<UseSupabaseSubscriptionProps, 'config'> {
|
|
16
17
|
walletId: string | undefined;
|
|
17
|
-
callback: () => void;
|
|
18
|
-
enabled?: boolean;
|
|
19
18
|
}
|
|
@@ -1,31 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import { useEffect, useRef } from 'react';
|
|
2
4
|
|
|
3
5
|
import { UseSupabaseSubscriptionProps } from './types';
|
|
4
6
|
|
|
5
7
|
import { supabaseClient } from '../../utils/supabase';
|
|
6
8
|
|
|
7
|
-
export const useSupabaseSubscription = ({ config, callback, enabled = true }: UseSupabaseSubscriptionProps) => {
|
|
9
|
+
export const useSupabaseSubscription = ({ config, callback, enabled = true, key }: UseSupabaseSubscriptionProps) => {
|
|
8
10
|
const subscriptionRef = useRef<any>(null);
|
|
9
11
|
const callbackRef = useRef(callback);
|
|
10
12
|
|
|
11
13
|
callbackRef.current = callback;
|
|
12
14
|
|
|
13
15
|
useEffect(() => {
|
|
14
|
-
if (!enabled) {
|
|
16
|
+
if (!enabled || !supabaseClient) {
|
|
15
17
|
return;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
if (!supabaseClient) {
|
|
19
|
-
throw new Error('Supabase client is not available');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
20
|
if (subscriptionRef.current) {
|
|
23
21
|
supabaseClient.removeChannel(subscriptionRef.current);
|
|
24
22
|
subscriptionRef.current = null;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
const subscription = supabaseClient
|
|
28
|
-
.channel(config.channelName)
|
|
26
|
+
.channel(key || config.channelName)
|
|
29
27
|
.on(
|
|
30
28
|
'postgres_changes' as any,
|
|
31
29
|
{
|
|
@@ -46,7 +44,7 @@ export const useSupabaseSubscription = ({ config, callback, enabled = true }: Us
|
|
|
46
44
|
subscriptionRef.current = null;
|
|
47
45
|
}
|
|
48
46
|
};
|
|
49
|
-
}, [enabled, config.channelName, config.table, config.schema, config.event, config.filter]);
|
|
47
|
+
}, [enabled, config.channelName, config.table, config.schema, config.event, config.filter, supabaseClient, key]);
|
|
50
48
|
|
|
51
49
|
return {
|
|
52
50
|
isConnected: !!subscriptionRef.current,
|
package/src/utils/supabase.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createClient } from '@supabase/supabase-js';
|
|
2
2
|
|
|
3
|
+
// Создаем клиент только если есть необходимые environment переменные
|
|
3
4
|
const createSupabaseClient = () => {
|
|
4
5
|
const supabaseUrl = process.env.SUPABASE_URL;
|
|
5
6
|
const supabasePublicKey = process.env.SUPABASE_PUBLIC_KEY;
|