@b3dotfun/sdk 0.1.70-alpha.15 → 0.1.70-alpha.17
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/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +81 -16
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +4 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +16 -2
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +9 -1
- package/dist/cjs/anyspend/react/components/QRDeposit.js +3 -3
- package/dist/cjs/anyspend/react/components/common/PureTransferView.d.ts +30 -0
- package/dist/cjs/anyspend/react/components/common/PureTransferView.js +64 -0
- package/dist/cjs/global-account/client-manager.js +32 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +81 -16
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +4 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +16 -2
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +9 -1
- package/dist/esm/anyspend/react/components/QRDeposit.js +4 -4
- package/dist/esm/anyspend/react/components/common/PureTransferView.d.ts +30 -0
- package/dist/esm/anyspend/react/components/common/PureTransferView.js +61 -0
- package/dist/esm/global-account/client-manager.js +32 -0
- package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +9 -1
- package/dist/types/anyspend/react/components/common/PureTransferView.d.ts +30 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +108 -18
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +5 -1
- package/src/anyspend/react/components/AnySpendDeposit.tsx +18 -1
- package/src/anyspend/react/components/QRDeposit.tsx +55 -4
- package/src/anyspend/react/components/__tests__/QRDeposit.test.tsx +39 -1
- package/src/anyspend/react/components/common/PureTransferView.tsx +212 -0
- package/src/global-account/client-manager.ts +33 -0
|
@@ -19,6 +19,37 @@ let socketClientUrl: string | null = null;
|
|
|
19
19
|
let restClient: ClientApplication | null = null;
|
|
20
20
|
let restClientUrl: string | null = null;
|
|
21
21
|
|
|
22
|
+
// The pinned @b3dotfun/b3-api client's generated usersMethods predates `setBio`,
|
|
23
|
+
// so `users.setBio(...)` throws "setBio is not a function". Re-register the users
|
|
24
|
+
// service with the full list (mirrors users.shared.ts). Remove once the
|
|
25
|
+
// @b3dotfun/b3-api pin includes setBio.
|
|
26
|
+
const USERS_METHODS = [
|
|
27
|
+
"find",
|
|
28
|
+
"get",
|
|
29
|
+
"create",
|
|
30
|
+
"patch",
|
|
31
|
+
"remove",
|
|
32
|
+
"setReferralCode",
|
|
33
|
+
"syncTwProfiles",
|
|
34
|
+
"setAvatar",
|
|
35
|
+
"setBio",
|
|
36
|
+
"registerUsername",
|
|
37
|
+
"getMe",
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
// Re-register on every client the manager builds — the active transport
|
|
41
|
+
// (REST/socket) switches at runtime.
|
|
42
|
+
function ensureUsersCustomMethods(client: ClientApplication): void {
|
|
43
|
+
try {
|
|
44
|
+
const connection = (client as any).get("connection");
|
|
45
|
+
if (connection?.service) {
|
|
46
|
+
(client as any).use("users", connection.service("users"), { methods: USERS_METHODS });
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
// Non-fatal: keep whatever methods the generated client already exposes.
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
22
53
|
/**
|
|
23
54
|
* Creates a socket client
|
|
24
55
|
*/
|
|
@@ -27,6 +58,7 @@ function createSocketClient(): ClientApplication {
|
|
|
27
58
|
if (!socketClient || socketClientUrl !== url) {
|
|
28
59
|
socketInstance = io(url, { transports: ["websocket"] });
|
|
29
60
|
socketClient = createClient(socketio(socketInstance), clientOptions);
|
|
61
|
+
ensureUsersCustomMethods(socketClient);
|
|
30
62
|
socketClientUrl = url;
|
|
31
63
|
}
|
|
32
64
|
return socketClient;
|
|
@@ -48,6 +80,7 @@ function createRestClient(): ClientApplication {
|
|
|
48
80
|
if (!restClient || restClientUrl !== url) {
|
|
49
81
|
const connection = rest(url).fetch(resolveFetch());
|
|
50
82
|
restClient = createClient(connection, clientOptions);
|
|
83
|
+
ensureUsersCustomMethods(restClient);
|
|
51
84
|
restClientUrl = url;
|
|
52
85
|
}
|
|
53
86
|
return restClient;
|