Skip to content

Commit 4c469bc

Browse files
committed
move useAction and useActionRegistryInterval hooks to blinks-core
1 parent e3e2acb commit 4c469bc

File tree

6 files changed

+10
-15
lines changed

6 files changed

+10
-15
lines changed

packages/blinks/src/hooks/useAction.ts renamed to packages/blinks-core/src/hooks/useAction.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
'use client';
1+
import { useEffect, useState } from 'react';
22
import {
33
Action,
44
type ActionAdapter,
55
type ActionSupportStrategy,
66
defaultActionSupportStrategy,
7-
unfurlUrlToActionApiUrl,
8-
} from '@dialectlabs/blinks-core';
9-
import { useEffect, useState } from 'react';
7+
} from '../api';
8+
import { unfurlUrlToActionApiUrl } from '../utils';
109
import { useActionsRegistryInterval } from './useActionRegistryInterval.ts';
1110

1211
interface UseActionOptions {
@@ -30,7 +29,10 @@ function useActionApiUrl(url: string | URL) {
3029
setApiUrl(apiUrl);
3130
})
3231
.catch((e) => {
33-
console.error('[@dialectlabs/blinks] Failed to unfurl action URL', e);
32+
console.error(
33+
'[@dialectlabs/blinks-core] Failed to unfurl action URL',
34+
e,
35+
);
3436
setApiUrl(null);
3537
});
3638

@@ -67,7 +69,7 @@ export function useAction({
6769
setAction(action);
6870
})
6971
.catch((e) => {
70-
console.error('[@dialectlabs/blinks] Failed to fetch action', e);
72+
console.error('[@dialectlabs/blinks-core] Failed to fetch action', e);
7173
setAction(null);
7274
})
7375
.finally(() => {

packages/blinks/src/hooks/useActionRegistryInterval.ts renamed to packages/blinks-core/src/hooks/useActionRegistryInterval.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
'use client';
2-
import { ActionsRegistry } from '@dialectlabs/blinks-core';
31
import { useEffect, useState } from 'react';
2+
import { ActionsRegistry } from '../api';
43

54
export function useActionsRegistryInterval() {
65
const [isRegistryLoaded, setRegistryLoaded] = useState(false);

packages/blinks-core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from './api';
22
export * from './BlinkContainer';
3+
export * from './hooks';
34
export * from './utils';

packages/blinks/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222
"require": "./dist/ext/twitter.cjs",
2323
"types": "./dist/ext/twitter.d.ts"
2424
},
25-
"./hooks": {
26-
"import": "./dist/hooks/index.js",
27-
"require": "./dist/hooks/index.cjs",
28-
"types": "./dist/hooks/index.d.ts"
29-
},
3025
"./hooks/solana": {
3126
"import": "./dist/hooks/solana/index.js",
3227
"require": "./dist/hooks/solana/index.cjs",

packages/blinks/tsup.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ export default defineConfig([
1515
'src/index.ts',
1616
'src/index.css',
1717
'src/ext/twitter.tsx',
18-
'src/hooks/index.ts',
1918
'src/hooks/solana/index.ts',
2019
],
2120
dts: {
2221
entry: [
2322
'src/index.ts',
2423
'src/ext/twitter.tsx',
25-
'src/hooks/index.ts',
2624
'src/hooks/solana/index.ts',
2725
],
2826
},

0 commit comments

Comments
 (0)