@turtleclub/hooks 0.5.0-beta.2 → 0.5.0-beta.3
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 +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/v2/incentives/api.ts +2 -2
- package/src/v2/index.ts +2 -2
- package/src/v2/lib/turtle-provider.tsx +3 -3
- package/src/v2/products/api.ts +7 -13
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turtleclub/hooks",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.0-beta.
|
|
4
|
+
"version": "0.5.0-beta.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "2e5a612fb4c0a59aa663449262e804cd6aeab352"
|
|
58
58
|
}
|
package/src/v2/incentives/api.ts
CHANGED
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
uploadIncentiveIconResponseSchema,
|
|
12
12
|
} from "./schema";
|
|
13
13
|
|
|
14
|
-
// GET /
|
|
14
|
+
// GET /turtle/incentives
|
|
15
15
|
export async function getIncentives(): Promise<IncentivesResponse> {
|
|
16
16
|
const params = new URLSearchParams();
|
|
17
17
|
|
|
18
18
|
const queryString = params.toString();
|
|
19
|
-
const endpoint = `/
|
|
19
|
+
const endpoint = `/turtle/incentives${queryString ? `?${queryString}` : ""}`;
|
|
20
20
|
|
|
21
21
|
const data = await apiClient.fetch(endpoint, {
|
|
22
22
|
method: "GET",
|
package/src/v2/index.ts
CHANGED
|
@@ -45,7 +45,7 @@ export * from "./swap";
|
|
|
45
45
|
export * from "./schemas/shared";
|
|
46
46
|
|
|
47
47
|
// Provider & Client
|
|
48
|
-
export {
|
|
49
|
-
export type {
|
|
48
|
+
export { TurtleHooksProvider } from "./lib/turtle-provider";
|
|
49
|
+
export type { TurtleHooksProviderProps } from "./lib/turtle-provider";
|
|
50
50
|
export { apiClient, ApiError } from "./lib/api-client";
|
|
51
51
|
export type { ApiClientConfig, ApiClientOptions, ApiDomain } from "./lib/api-client";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useEffect, useMemo } from "react";
|
|
4
4
|
import { apiClient, type ApiClientConfig } from "./api-client";
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface TurtleHooksProviderProps extends ApiClientConfig {
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -28,13 +28,13 @@ export interface TurtleProviderProps extends ApiClientConfig {
|
|
|
28
28
|
* }
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export function
|
|
31
|
+
export function TurtleHooksProvider({
|
|
32
32
|
children,
|
|
33
33
|
apiUrl,
|
|
34
34
|
earnUrl,
|
|
35
35
|
getToken,
|
|
36
36
|
debug,
|
|
37
|
-
}:
|
|
37
|
+
}: TurtleHooksProviderProps) {
|
|
38
38
|
const config = useMemo(
|
|
39
39
|
() => ({ apiUrl, earnUrl, getToken, debug }),
|
|
40
40
|
[apiUrl, earnUrl, getToken, debug]
|
package/src/v2/products/api.ts
CHANGED
|
@@ -16,16 +16,14 @@ import {
|
|
|
16
16
|
UploadProductLogoResponseSchema,
|
|
17
17
|
} from "./schema";
|
|
18
18
|
|
|
19
|
-
// GET /
|
|
20
|
-
export async function getProducts(
|
|
21
|
-
filters?: ProductFilters
|
|
22
|
-
): Promise<ProductsResponse> {
|
|
19
|
+
// GET /turtle/products
|
|
20
|
+
export async function getProducts(filters?: ProductFilters): Promise<ProductsResponse> {
|
|
23
21
|
const params = new URLSearchParams();
|
|
24
22
|
|
|
25
23
|
if (filters?.organizationId) params.append("organizationId", filters.organizationId);
|
|
26
24
|
|
|
27
25
|
const queryString = params.toString();
|
|
28
|
-
const endpoint = `/
|
|
26
|
+
const endpoint = `/turtle/products${queryString ? `?${queryString}` : ""}`;
|
|
29
27
|
|
|
30
28
|
const data = await apiClient.fetch(endpoint, {
|
|
31
29
|
method: "GET",
|
|
@@ -41,9 +39,9 @@ export async function getProducts(
|
|
|
41
39
|
return result.data;
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
// GET /
|
|
42
|
+
// GET /turtle/products/:id
|
|
45
43
|
export async function getProduct(id: string): Promise<ProductResponse> {
|
|
46
|
-
const endpoint = `/
|
|
44
|
+
const endpoint = `/turtle/products/${id}`;
|
|
47
45
|
|
|
48
46
|
const data = await apiClient.fetch(endpoint, {
|
|
49
47
|
method: "GET",
|
|
@@ -60,9 +58,7 @@ export async function getProduct(id: string): Promise<ProductResponse> {
|
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
// POST /admin/products
|
|
63
|
-
export async function createProduct(
|
|
64
|
-
input: CreateProductInput
|
|
65
|
-
): Promise<CreateProductResponse> {
|
|
61
|
+
export async function createProduct(input: CreateProductInput): Promise<CreateProductResponse> {
|
|
66
62
|
const endpoint = `/admin/products`;
|
|
67
63
|
|
|
68
64
|
const data = await apiClient.fetch(endpoint, {
|
|
@@ -81,9 +77,7 @@ export async function createProduct(
|
|
|
81
77
|
}
|
|
82
78
|
|
|
83
79
|
// PUT /admin/products/:id
|
|
84
|
-
export async function updateProduct(
|
|
85
|
-
input: UpdateProductInput
|
|
86
|
-
): Promise<UpdateProductResponse> {
|
|
80
|
+
export async function updateProduct(input: UpdateProductInput): Promise<UpdateProductResponse> {
|
|
87
81
|
const endpoint = `/admin/products/${input.product.id}`;
|
|
88
82
|
|
|
89
83
|
const data = await apiClient.fetch(endpoint, {
|