@turtleclub/hooks 0.5.0-beta.40 → 0.5.0-beta.41
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/index.cjs +48 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/v2/index.ts +1 -0
- package/src/v2/organizations/api.ts +27 -0
- package/src/v2/organizations/hooks.ts +43 -0
- package/src/v2/organizations/index.ts +4 -0
- package/src/v2/organizations/queries.ts +6 -0
- package/src/v2/organizations/schema.ts +16 -0
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,8 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ApiError: () => ApiError,
|
|
24
24
|
BalanceSourcePriority: () => BalanceSourcePriority,
|
|
25
|
+
LeaveOrganizationInputSchema: () => LeaveOrganizationInputSchema,
|
|
26
|
+
LeaveOrganizationOutputSchema: () => LeaveOrganizationOutputSchema,
|
|
25
27
|
TurtleHooksProvider: () => TurtleHooksProvider,
|
|
26
28
|
actionResponseSchema: () => actionResponseSchema,
|
|
27
29
|
apiClient: () => apiClient,
|
|
@@ -116,6 +118,7 @@ __export(index_exports, {
|
|
|
116
118
|
getWidgetOpportunities: () => getWidgetOpportunities,
|
|
117
119
|
holdingsDataSchema: () => holdingsDataSchema,
|
|
118
120
|
incentiveSchema: () => incentiveSchema,
|
|
121
|
+
leaveOrganization: () => leaveOrganization,
|
|
119
122
|
lendingConfigSchema: () => lendingConfigSchema,
|
|
120
123
|
mergeBalancesByPriority: () => mergeBalancesByPriority,
|
|
121
124
|
nftsQueries: () => nftsQueries,
|
|
@@ -124,6 +127,7 @@ __export(index_exports, {
|
|
|
124
127
|
opportunityFiltersSchema: () => opportunityFiltersSchema,
|
|
125
128
|
opportunitySchema: () => opportunitySchema,
|
|
126
129
|
organizationSchema: () => organizationSchema,
|
|
130
|
+
organizationsMutations: () => organizationsMutations,
|
|
127
131
|
paginationMetadataSchema: () => paginationMetadataSchema,
|
|
128
132
|
paginationSchema: () => paginationSchema,
|
|
129
133
|
portfolioBalanceResponseSchema: () => portfolioBalanceResponseSchema,
|
|
@@ -181,6 +185,7 @@ __export(index_exports, {
|
|
|
181
185
|
useEnsoBalances: () => useEnsoBalances,
|
|
182
186
|
useGeocheck: () => useGeocheck,
|
|
183
187
|
useGetOnChainBalance: () => useGetOnChainBalance,
|
|
188
|
+
useLeaveOrganization: () => useLeaveOrganization,
|
|
184
189
|
useMultiChainBalances: () => useMultiChainBalances,
|
|
185
190
|
useOpportunities: () => useOpportunities,
|
|
186
191
|
useOpportunitiesFilterOptions: () => useOpportunitiesFilterOptions,
|
|
@@ -2882,6 +2887,44 @@ function useSubmitCoverRequest(options) {
|
|
|
2882
2887
|
});
|
|
2883
2888
|
}
|
|
2884
2889
|
|
|
2890
|
+
// src/v2/organizations/schema.ts
|
|
2891
|
+
var import_zod17 = require("zod");
|
|
2892
|
+
var LeaveOrganizationInputSchema = import_zod17.z.object({
|
|
2893
|
+
organizationId: import_zod17.z.string().uuid()
|
|
2894
|
+
});
|
|
2895
|
+
var LeaveOrganizationOutputSchema = import_zod17.z.object({
|
|
2896
|
+
success: import_zod17.z.boolean(),
|
|
2897
|
+
error: import_zod17.z.string().optional()
|
|
2898
|
+
});
|
|
2899
|
+
|
|
2900
|
+
// src/v2/organizations/api.ts
|
|
2901
|
+
async function leaveOrganization(input) {
|
|
2902
|
+
const endpoint = `/organization/${input.organizationId}/leave`;
|
|
2903
|
+
const data = await apiClient.fetch(endpoint, {
|
|
2904
|
+
method: "POST"
|
|
2905
|
+
});
|
|
2906
|
+
const result = LeaveOrganizationOutputSchema.safeParse(data);
|
|
2907
|
+
if (result.success === false) {
|
|
2908
|
+
console.log("[ZOD ERROR]", result.error);
|
|
2909
|
+
throw new Error(`Failed to parse leave organization response: ${result.error.message}`);
|
|
2910
|
+
}
|
|
2911
|
+
return result.data;
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
// src/v2/organizations/hooks.ts
|
|
2915
|
+
var import_react_query18 = require("@tanstack/react-query");
|
|
2916
|
+
function useLeaveOrganization(options) {
|
|
2917
|
+
return (0, import_react_query18.useMutation)({
|
|
2918
|
+
mutationFn: leaveOrganization,
|
|
2919
|
+
...options
|
|
2920
|
+
});
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
// src/v2/organizations/queries.ts
|
|
2924
|
+
var organizationsMutations = {
|
|
2925
|
+
leave: (input) => leaveOrganization(input)
|
|
2926
|
+
};
|
|
2927
|
+
|
|
2885
2928
|
// src/v2/lib/turtle-provider.tsx
|
|
2886
2929
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
2887
2930
|
function TurtleHooksProvider({
|
|
@@ -2916,6 +2959,8 @@ var queries = (0, import_query_key_factory16.mergeQueryKeys)(
|
|
|
2916
2959
|
0 && (module.exports = {
|
|
2917
2960
|
ApiError,
|
|
2918
2961
|
BalanceSourcePriority,
|
|
2962
|
+
LeaveOrganizationInputSchema,
|
|
2963
|
+
LeaveOrganizationOutputSchema,
|
|
2919
2964
|
TurtleHooksProvider,
|
|
2920
2965
|
actionResponseSchema,
|
|
2921
2966
|
apiClient,
|
|
@@ -3010,6 +3055,7 @@ var queries = (0, import_query_key_factory16.mergeQueryKeys)(
|
|
|
3010
3055
|
getWidgetOpportunities,
|
|
3011
3056
|
holdingsDataSchema,
|
|
3012
3057
|
incentiveSchema,
|
|
3058
|
+
leaveOrganization,
|
|
3013
3059
|
lendingConfigSchema,
|
|
3014
3060
|
mergeBalancesByPriority,
|
|
3015
3061
|
nftsQueries,
|
|
@@ -3018,6 +3064,7 @@ var queries = (0, import_query_key_factory16.mergeQueryKeys)(
|
|
|
3018
3064
|
opportunityFiltersSchema,
|
|
3019
3065
|
opportunitySchema,
|
|
3020
3066
|
organizationSchema,
|
|
3067
|
+
organizationsMutations,
|
|
3021
3068
|
paginationMetadataSchema,
|
|
3022
3069
|
paginationSchema,
|
|
3023
3070
|
portfolioBalanceResponseSchema,
|
|
@@ -3075,6 +3122,7 @@ var queries = (0, import_query_key_factory16.mergeQueryKeys)(
|
|
|
3075
3122
|
useEnsoBalances,
|
|
3076
3123
|
useGeocheck,
|
|
3077
3124
|
useGetOnChainBalance,
|
|
3125
|
+
useLeaveOrganization,
|
|
3078
3126
|
useMultiChainBalances,
|
|
3079
3127
|
useOpportunities,
|
|
3080
3128
|
useOpportunitiesFilterOptions,
|