squarefi-bff-api-module 1.36.13 → 1.36.15

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.
@@ -17,6 +17,7 @@ export declare const orders: {
17
17
  WITHDRAW_CARD_SUBACCOUNT: (data: API.Orders.Create.ByOrderType.WITHDRAW_CARD_SUBACCOUNT.Request) => Promise<API.Orders.Create.ByOrderType.WITHDRAW_CARD_SUBACCOUNT.Response>;
18
18
  };
19
19
  };
20
+ setComment: ({ order_id, ...data }: API.Orders.Comment.Request) => Promise<API.Orders.Comment.Response>;
20
21
  v2: {
21
22
  calc: ({ signal, ...params }: API.Orders.V2.Calc.Request) => Promise<API.Orders.V2.Calc.Response>;
22
23
  orderTypes: {
@@ -1,4 +1,4 @@
1
- import { apiClientV1 } from '../utils/apiClientFactory';
1
+ import { apiClientV1, apiClientV1Frontend } from '../utils/apiClientFactory';
2
2
  import { OrderType } from '../constants';
3
3
  export const orders = {
4
4
  calc: ({ signal, ...params }) => apiClientV1.getRequest('/orders/calc', {
@@ -33,6 +33,9 @@ export const orders = {
33
33
  [OrderType.WITHDRAW_CARD_SUBACCOUNT]: (data) => apiClientV1.postRequest('/orders/WITHDRAW_CARD_SUBACCOUNT', { data }),
34
34
  },
35
35
  },
36
+ setComment: ({ order_id, ...data }) => apiClientV1Frontend.putRequest(`/frontend/orders/${order_id}/comment`, {
37
+ data,
38
+ }),
36
39
  v2: {
37
40
  calc: ({ signal, ...params }) => apiClientV1.getRequest('/v2/orders/calc', {
38
41
  params,
@@ -913,6 +913,17 @@ export declare namespace API {
913
913
  }
914
914
  }
915
915
  namespace Orders {
916
+ namespace Comment {
917
+ type Request = {
918
+ order_id: string;
919
+ wallet_id: string;
920
+ comment?: string | null;
921
+ };
922
+ type Response = {
923
+ success: boolean;
924
+ data: API.Orders.V2.List.ByWallet.OrderItem;
925
+ };
926
+ }
916
927
  namespace Create {
917
928
  namespace ByOrderType {
918
929
  namespace INTERNAL_TRANSFER {
@@ -1633,6 +1644,7 @@ export declare namespace API {
1633
1644
  sub_account_id?: string | null;
1634
1645
  meta: OrderMeta;
1635
1646
  info?: string | null;
1647
+ comment?: string | null;
1636
1648
  }
1637
1649
  type Response = {
1638
1650
  data: OrderItem[];
@@ -1,5 +1,4 @@
1
1
  export const createWalletTransactionsConfig = (walletId) => ({
2
2
  channelName: `wallet-transactions-${walletId}`,
3
- table: 'transactions',
4
- filter: `wallet_id=eq.${walletId}`,
3
+ event: 'tx',
5
4
  });
@@ -1,9 +1,7 @@
1
1
  export interface SubscriptionConfig {
2
2
  channelName: string;
3
- table: string;
4
- schema?: string;
5
- event?: 'INSERT' | 'UPDATE' | 'DELETE' | '*';
6
- filter?: string;
3
+ /** Broadcast event name emitted by the database trigger (realtime.send). */
4
+ event: string;
7
5
  }
8
6
  export interface UseSupabaseSubscriptionProps {
9
7
  config: SubscriptionConfig;
@@ -14,13 +14,8 @@ export const useSupabaseSubscription = ({ config, callback, enabled = true, key
14
14
  subscriptionRef.current = null;
15
15
  }
16
16
  const subscription = supabaseClient
17
- .channel(key || config.channelName)
18
- .on('postgres_changes', {
19
- event: config.event || '*',
20
- schema: config.schema || 'public',
21
- table: config.table,
22
- ...(config.filter && { filter: config.filter }),
23
- }, (payload) => callbackRef.current(payload))
17
+ .channel(key || config.channelName, { config: { private: true } })
18
+ .on('broadcast', { event: config.event }, (payload) => callbackRef.current(payload))
24
19
  .subscribe();
25
20
  subscriptionRef.current = subscription;
26
21
  return () => {
@@ -29,7 +24,7 @@ export const useSupabaseSubscription = ({ config, callback, enabled = true, key
29
24
  subscriptionRef.current = null;
30
25
  }
31
26
  };
32
- }, [enabled, config.channelName, config.table, config.schema, config.event, config.filter, supabaseClient, key]);
27
+ }, [enabled, config.channelName, config.event, supabaseClient, key]);
33
28
  return {
34
29
  isConnected: !!subscriptionRef.current,
35
30
  isClientAvailable: !!supabaseClient,
@@ -7,6 +7,7 @@ type CreateApiClientOptions = {
7
7
  export declare const createApiClient: ({ baseURL, isBearerToken, tenantId }: CreateApiClientOptions) => {
8
8
  patchRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
9
9
  postRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
10
+ putRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
10
11
  deleteRequest: (url: string, config?: AxiosRequestConfig) => Promise<any>;
11
12
  getRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
12
13
  };
@@ -30,6 +31,7 @@ export declare const createFetchApiClient: ({ baseURL, isBearerToken, tenantId }
30
31
  export declare const apiClientV1: {
31
32
  patchRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
32
33
  postRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
34
+ putRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
33
35
  deleteRequest: (url: string, config?: AxiosRequestConfig) => Promise<any>;
34
36
  getRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
35
37
  };
@@ -42,18 +44,21 @@ export declare const apiClientV1Native: {
42
44
  export declare const apiClientV2: {
43
45
  patchRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
44
46
  postRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
47
+ putRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
45
48
  deleteRequest: (url: string, config?: AxiosRequestConfig) => Promise<any>;
46
49
  getRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
47
50
  };
48
51
  export declare const apiClientV1Frontend: {
49
52
  patchRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
50
53
  postRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
54
+ putRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
51
55
  deleteRequest: (url: string, config?: AxiosRequestConfig) => Promise<any>;
52
56
  getRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
53
57
  };
54
58
  export declare const apiClientTOTP: {
55
59
  patchRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
56
60
  postRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
61
+ putRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
57
62
  deleteRequest: (url: string, config?: AxiosRequestConfig) => Promise<any>;
58
63
  getRequest: <T>(url: string, config?: AxiosRequestConfig) => Promise<T>;
59
64
  };
@@ -110,6 +110,11 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }) => {
110
110
  const res = await instance.post(url, data, restConfig);
111
111
  return res.data;
112
112
  };
113
+ const putRequest = async (url, config) => {
114
+ const { data = {}, ...restConfig } = config ?? {};
115
+ const res = await instance.put(url, data, restConfig);
116
+ return res.data;
117
+ };
113
118
  const deleteRequest = async (url, config) => {
114
119
  const { data = {}, ...restConfig } = config ?? {};
115
120
  const res = await instance.delete(url, { data, ...restConfig });
@@ -120,7 +125,7 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }) => {
120
125
  const res = await instance.get(url, { params, ...restConfig });
121
126
  return res.data;
122
127
  };
123
- return { patchRequest, postRequest, deleteRequest, getRequest };
128
+ return { patchRequest, postRequest, putRequest, deleteRequest, getRequest };
124
129
  };
125
130
  /**
126
131
  * Native fetch-based API client.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarefi-bff-api-module",
3
- "version": "1.36.13",
3
+ "version": "1.36.15",
4
4
  "description": "Squarefi BFF API client module",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",