@blocklet/did-space-react 0.5.61 → 0.5.62

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.
Files changed (134) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/components/base-connect-to/stories/basic.d.ts +2 -0
  3. package/dist/cjs/components/space-card/stories/basic.d.ts +2 -0
  4. package/dist/es/components/base-connect-to/stories/basic.d.ts +2 -0
  5. package/dist/es/components/space-card/stories/basic.d.ts +2 -0
  6. package/package.json +41 -37
  7. package/.turbo/turbo-build.log +0 -69
  8. package/.turbo/turbo-lint$colon$fix.log +0 -8
  9. package/build.config.ts +0 -47
  10. package/src/components/auth-connect-to/base-auth.tsx +0 -64
  11. package/src/components/auth-connect-to/gateway-auth.tsx +0 -53
  12. package/src/components/auth-connect-to/index.tsx +0 -71
  13. package/src/components/base-connect-to/base-connect-to.stories.tsx +0 -11
  14. package/src/components/base-connect-to/index.tsx +0 -160
  15. package/src/components/preview-space-nft/index.tsx +0 -78
  16. package/src/components/session-connect-to/index.tsx +0 -39
  17. package/src/components/session-connect-to/re-connect.tsx +0 -57
  18. package/src/components/space-card/index.tsx +0 -288
  19. package/src/components/space-card/space-card.stories.tsx +0 -13
  20. package/src/hooks/use-locale.ts +0 -15
  21. package/src/hooks/use-mobile.ts +0 -8
  22. package/src/hooks/use-space-info.ts +0 -32
  23. package/src/icons/empty-space-nft.svg +0 -59
  24. package/src/icons/index.tsx +0 -12
  25. package/src/icons/space-connect-error.svg +0 -4
  26. package/src/icons/space-connected.svg +0 -4
  27. package/src/icons/space-disconnect.svg +0 -4
  28. package/src/index.ts +0 -21
  29. package/src/libs/api.ts +0 -5
  30. package/src/libs/constants.ts +0 -4
  31. package/src/libs/gateway.ts +0 -55
  32. package/src/libs/util.ts +0 -103
  33. package/src/locales/en.tsx +0 -54
  34. package/src/locales/index.tsx +0 -7
  35. package/src/locales/zh.tsx +0 -53
  36. package/src/types/index.ts +0 -51
  37. package/src/types/shims.d.ts +0 -15
  38. package/vite.config.ts +0 -32
  39. /package/{es → dist/cjs}/components/auth-connect-to/base-auth.d.ts +0 -0
  40. /package/{lib → dist/cjs}/components/auth-connect-to/base-auth.js +0 -0
  41. /package/{es → dist/cjs}/components/auth-connect-to/gateway-auth.d.ts +0 -0
  42. /package/{lib → dist/cjs}/components/auth-connect-to/gateway-auth.js +0 -0
  43. /package/{es → dist/cjs}/components/auth-connect-to/index.d.ts +0 -0
  44. /package/{lib → dist/cjs}/components/auth-connect-to/index.js +0 -0
  45. /package/{es → dist/cjs}/components/base-connect-to/base-connect-to.stories.d.ts +0 -0
  46. /package/{es → dist/cjs}/components/base-connect-to/index.d.ts +0 -0
  47. /package/{lib → dist/cjs}/components/base-connect-to/index.js +0 -0
  48. /package/{es → dist/cjs}/components/preview-space-nft/index.d.ts +0 -0
  49. /package/{lib → dist/cjs}/components/preview-space-nft/index.js +0 -0
  50. /package/{es → dist/cjs}/components/session-connect-to/index.d.ts +0 -0
  51. /package/{lib → dist/cjs}/components/session-connect-to/index.js +0 -0
  52. /package/{es → dist/cjs}/components/session-connect-to/re-connect.d.ts +0 -0
  53. /package/{lib → dist/cjs}/components/session-connect-to/re-connect.js +0 -0
  54. /package/{es → dist/cjs}/components/space-card/index.d.ts +0 -0
  55. /package/{lib → dist/cjs}/components/space-card/index.js +0 -0
  56. /package/{es → dist/cjs}/components/space-card/space-card.stories.d.ts +0 -0
  57. /package/{es → dist/cjs}/hooks/use-locale.d.ts +0 -0
  58. /package/{lib → dist/cjs}/hooks/use-locale.js +0 -0
  59. /package/{es → dist/cjs}/hooks/use-mobile.d.ts +0 -0
  60. /package/{lib → dist/cjs}/hooks/use-mobile.js +0 -0
  61. /package/{es → dist/cjs}/hooks/use-space-info.d.ts +0 -0
  62. /package/{lib → dist/cjs}/hooks/use-space-info.js +0 -0
  63. /package/{lib → dist/cjs}/icons/empty-space-nft.svg.js +0 -0
  64. /package/{es → dist/cjs}/icons/index.d.ts +0 -0
  65. /package/{lib → dist/cjs}/icons/index.js +0 -0
  66. /package/{lib → dist/cjs}/icons/space-connect-error.svg.js +0 -0
  67. /package/{lib → dist/cjs}/icons/space-connected.svg.js +0 -0
  68. /package/{lib → dist/cjs}/icons/space-disconnect.svg.js +0 -0
  69. /package/{es → dist/cjs}/index.d.ts +0 -0
  70. /package/{lib → dist/cjs}/index.js +0 -0
  71. /package/{es → dist/cjs}/libs/api.d.ts +0 -0
  72. /package/{lib → dist/cjs}/libs/api.js +0 -0
  73. /package/{es → dist/cjs}/libs/constants.d.ts +0 -0
  74. /package/{lib → dist/cjs}/libs/constants.js +0 -0
  75. /package/{es → dist/cjs}/libs/gateway.d.ts +0 -0
  76. /package/{lib → dist/cjs}/libs/gateway.js +0 -0
  77. /package/{es → dist/cjs}/libs/util.d.ts +0 -0
  78. /package/{lib → dist/cjs}/libs/util.js +0 -0
  79. /package/{es → dist/cjs}/locales/en.d.ts +0 -0
  80. /package/{lib → dist/cjs}/locales/en.js +0 -0
  81. /package/{es → dist/cjs}/locales/index.d.ts +0 -0
  82. /package/{lib → dist/cjs}/locales/index.js +0 -0
  83. /package/{es → dist/cjs}/locales/zh.d.ts +0 -0
  84. /package/{lib → dist/cjs}/locales/zh.js +0 -0
  85. /package/{es → dist/cjs}/types/index.d.ts +0 -0
  86. /package/{lib → dist/cjs}/types/index.js +0 -0
  87. /package/{lib → dist/es}/components/auth-connect-to/base-auth.d.ts +0 -0
  88. /package/{es → dist/es}/components/auth-connect-to/base-auth.js +0 -0
  89. /package/{lib → dist/es}/components/auth-connect-to/gateway-auth.d.ts +0 -0
  90. /package/{es → dist/es}/components/auth-connect-to/gateway-auth.js +0 -0
  91. /package/{lib → dist/es}/components/auth-connect-to/index.d.ts +0 -0
  92. /package/{es → dist/es}/components/auth-connect-to/index.js +0 -0
  93. /package/{lib → dist/es}/components/base-connect-to/base-connect-to.stories.d.ts +0 -0
  94. /package/{lib → dist/es}/components/base-connect-to/index.d.ts +0 -0
  95. /package/{es → dist/es}/components/base-connect-to/index.js +0 -0
  96. /package/{lib → dist/es}/components/preview-space-nft/index.d.ts +0 -0
  97. /package/{es → dist/es}/components/preview-space-nft/index.js +0 -0
  98. /package/{lib → dist/es}/components/session-connect-to/index.d.ts +0 -0
  99. /package/{es → dist/es}/components/session-connect-to/index.js +0 -0
  100. /package/{lib → dist/es}/components/session-connect-to/re-connect.d.ts +0 -0
  101. /package/{es → dist/es}/components/session-connect-to/re-connect.js +0 -0
  102. /package/{lib → dist/es}/components/space-card/index.d.ts +0 -0
  103. /package/{es → dist/es}/components/space-card/index.js +0 -0
  104. /package/{lib → dist/es}/components/space-card/space-card.stories.d.ts +0 -0
  105. /package/{lib → dist/es}/hooks/use-locale.d.ts +0 -0
  106. /package/{es → dist/es}/hooks/use-locale.js +0 -0
  107. /package/{lib → dist/es}/hooks/use-mobile.d.ts +0 -0
  108. /package/{es → dist/es}/hooks/use-mobile.js +0 -0
  109. /package/{lib → dist/es}/hooks/use-space-info.d.ts +0 -0
  110. /package/{es → dist/es}/hooks/use-space-info.js +0 -0
  111. /package/{es → dist/es}/icons/empty-space-nft.svg.js +0 -0
  112. /package/{lib → dist/es}/icons/index.d.ts +0 -0
  113. /package/{es → dist/es}/icons/index.js +0 -0
  114. /package/{es → dist/es}/icons/space-connect-error.svg.js +0 -0
  115. /package/{es → dist/es}/icons/space-connected.svg.js +0 -0
  116. /package/{es → dist/es}/icons/space-disconnect.svg.js +0 -0
  117. /package/{lib → dist/es}/index.d.ts +0 -0
  118. /package/{es → dist/es}/index.js +0 -0
  119. /package/{lib → dist/es}/libs/api.d.ts +0 -0
  120. /package/{es → dist/es}/libs/api.js +0 -0
  121. /package/{lib → dist/es}/libs/constants.d.ts +0 -0
  122. /package/{es → dist/es}/libs/constants.js +0 -0
  123. /package/{lib → dist/es}/libs/gateway.d.ts +0 -0
  124. /package/{es → dist/es}/libs/gateway.js +0 -0
  125. /package/{lib → dist/es}/libs/util.d.ts +0 -0
  126. /package/{es → dist/es}/libs/util.js +0 -0
  127. /package/{lib → dist/es}/locales/en.d.ts +0 -0
  128. /package/{es → dist/es}/locales/en.js +0 -0
  129. /package/{lib → dist/es}/locales/index.d.ts +0 -0
  130. /package/{es → dist/es}/locales/index.js +0 -0
  131. /package/{lib → dist/es}/locales/zh.d.ts +0 -0
  132. /package/{es → dist/es}/locales/zh.js +0 -0
  133. /package/{lib → dist/es}/types/index.d.ts +0 -0
  134. /package/{es → dist/es}/types/index.js +0 -0
@@ -1,4 +0,0 @@
1
- <svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <circle cx="5" cy="5" r="5" fill="#d1fae5" />
3
- <circle cx="5" cy="5" r="2.5" fill="#25C99B" />
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg width="10" height="11" viewBox="0 0 10 11" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <circle cx="5" cy="5" r="5" fill="#f3f4f6" />
3
- <circle cx="5" cy="5" r="2.5" fill="#6b7280" />
4
- </svg>
package/src/index.ts DELETED
@@ -1,21 +0,0 @@
1
- import api from './libs/api';
2
- import useMobile from './hooks/use-mobile';
3
- import useSpaceInfo from './hooks/use-space-info';
4
- import useLocale from './hooks/use-locale';
5
-
6
- // components
7
- export * from './components/space-card';
8
- export * from './components/preview-space-nft';
9
- export * from './components/base-connect-to';
10
- export * from './components/auth-connect-to';
11
- export * from './components/session-connect-to';
12
-
13
- // utils
14
- export * from './libs/util';
15
- export * from './libs/gateway';
16
- export * from './locales';
17
- export * from './types';
18
- export { api, useMobile, useSpaceInfo, useLocale };
19
-
20
- // icons
21
- export * from './icons';
package/src/libs/api.ts DELETED
@@ -1,5 +0,0 @@
1
- import { createAxios } from '@blocklet/js-sdk';
2
-
3
- const api = createAxios({});
4
-
5
- export default api;
@@ -1,4 +0,0 @@
1
- export const AUTHORIZE = {
2
- DEFAULT_SCOPE: 'list:object read:object write:object',
3
- };
4
- export const copyGatewayPageUrl = 'https://www.arcblock.io/content/docs/did-spaces/how-to-obtain-space-gateway-url';
@@ -1,55 +0,0 @@
1
- import { joinURL, withQuery } from 'ufo';
2
- import isUrl from 'is-url';
3
- import isString from 'lodash/isString';
4
- import isObject from 'lodash/isObject';
5
- import api from './api';
6
- import { extraDIDSpacesCoreUrl } from './util';
7
-
8
- export async function getSpaceGatewayUrl(anyUrl: string, options = { timeout: 30000, withSearchParams: true }) {
9
- if (!isString(anyUrl)) {
10
- throw new Error(`url(${anyUrl}) must be a string`);
11
- }
12
-
13
- const url = anyUrl.startsWith('http') ? anyUrl : `https://${anyUrl}`;
14
- const u = new URL(url);
15
-
16
- const { data: blockletMeta } = await api.get(joinURL(u.origin, '/__blocklet__.js?type=json'), {
17
- timeout: options.timeout,
18
- });
19
-
20
- const mountPoint = blockletMeta.componentMountPoints.findLast(
21
- (x: { did: string }) => x.did === 'z8iZnaYxnkMD5AKRjTKiCb8pQr1ut8UantAcf'
22
- )?.mountPoint;
23
-
24
- if (!mountPoint) {
25
- throw new Error(`MountPoint(${mountPoint}) not found`);
26
- }
27
-
28
- const didSpacesCoreUrl = joinURL(u.origin, mountPoint);
29
- const spaceGatewayUrl =
30
- options.withSearchParams && u.searchParams.get('spaceDid')
31
- ? withQuery(didSpacesCoreUrl, { spaceDid: u.searchParams.get('spaceDid') })
32
- : didSpacesCoreUrl;
33
-
34
- return spaceGatewayUrl;
35
- }
36
-
37
- export async function isValidSpaceGatewayUrl(spaceGatewayUrl: string) {
38
- try {
39
- if (!isUrl(spaceGatewayUrl)) {
40
- return false;
41
- }
42
-
43
- const didSpacesCoreUrl = extraDIDSpacesCoreUrl(spaceGatewayUrl);
44
- const didConnectTokenUrl = joinURL(didSpacesCoreUrl, 'space/api/did/one-click-authorization/token');
45
-
46
- const { status, data } = await api.get(didConnectTokenUrl, {
47
- timeout: 5000,
48
- });
49
- // note: data 必定返回一个对象才行,如果 data 返回了一个非对象,说明失败了,此时可能返回了前端的 404 页面的 html
50
- return status === 200 && isObject(data);
51
- } catch (error) {
52
- console.error(error);
53
- return false;
54
- }
55
- }
package/src/libs/util.ts DELETED
@@ -1,103 +0,0 @@
1
- import { joinURL } from 'ufo';
2
- import isEmpty from 'lodash/isEmpty';
3
-
4
- type ClassStr = string | undefined | null;
5
- /** classObj -> className
6
- * examples:
7
- * classNames('foo', 'bar'); // => 'foo bar'
8
- * classNames('foo', { bar: true }); // => 'foo bar'
9
- * classNames({ 'foo-bar': true }); // => 'foo-bar'
10
- * classNames({ 'foo-bar': false }); // => ''
11
- * classNames({ foo: true }, { bar: true }); // => 'foo bar'
12
- * classNames({ foo: true, bar: true }); // => 'foo bar'
13
- * classNames(['foo', 'bar']); // => 'foo bar'
14
- */
15
- export function classNames(
16
- ...classes: (ClassStr | Record<string, boolean> | Array<ClassStr | Record<string, boolean>>)[]
17
- ): string {
18
- const result: string[] = [];
19
-
20
- classes.forEach((item) => {
21
- if (!item) return;
22
- if (typeof item === 'string') {
23
- result.push(item);
24
- } else if (Array.isArray(item)) {
25
- result.push(classNames(...item));
26
- } else if (typeof item === 'object' && item !== null) {
27
- Object.keys(item).forEach((key) => {
28
- if (item[key]) {
29
- result.push(key);
30
- }
31
- });
32
- }
33
- });
34
-
35
- return result.join(' ');
36
- }
37
-
38
- export function getDIDSpaceDidFromEndpoint(endpoint: string) {
39
- const strArray = endpoint.replace(/\/$/, '').split('/');
40
- const spaceDid = strArray.at(-4);
41
-
42
- return spaceDid;
43
- }
44
-
45
- export function getDIDSpaceUrlFromEndpoint(endpoint: string) {
46
- const prefix = endpoint.replace(/\/api\/space\/.+/, '');
47
-
48
- const strArray = endpoint.replace(/\/$/, '').split('/');
49
- const spaceDid = strArray.at(-4);
50
-
51
- return joinURL(prefix, 'space', spaceDid!);
52
- }
53
-
54
- export function getSpaceNftDisplayUrlFromEndpoint(endpoint: string) {
55
- const prefix = endpoint.replace(/\/api\/space\/.+/, '');
56
-
57
- const strArray = endpoint.replace(/\/$/, '').split('/');
58
- const spaceDid = strArray.at(-4);
59
-
60
- return joinURL(prefix, `/api/space/nft/display?spaceDid=${spaceDid}`);
61
- }
62
-
63
- export function getSpaceDidFromEndpoint(endpoint: string) {
64
- const strArray = endpoint.replace(/\/$/, '').split('/');
65
- const spaceDid = strArray.at(-4);
66
-
67
- return spaceDid;
68
- }
69
-
70
- export function getSpaceGatewayUrlFromEndpoint(endpoint: string) {
71
- const spaceUrl = getDIDSpaceUrlFromEndpoint(endpoint);
72
-
73
- return spaceUrl.split('/space/')[0];
74
- }
75
-
76
- export function extraDIDSpacesCoreUrl(url: string) {
77
- const Url = new URL(url);
78
- // @note: 去除查询参数的那部分字符串
79
- const didSpacesCoreUrl = joinURL(Url.origin, Url.pathname);
80
-
81
- return didSpacesCoreUrl;
82
- }
83
-
84
- const spaceDidRegex = /\/space\/([^/]+)/;
85
- export function getSpaceDidFromGatewayUrl(url: string) {
86
- return new URL(url).pathname.match(spaceDidRegex)?.[1];
87
- }
88
-
89
- export function decryptSpaceGateway(response: Record<string, string>, decrypt: Function) {
90
- if (!isEmpty(response.spaceGateway)) {
91
- return decrypt(response.spaceGateway);
92
- }
93
-
94
- const endpoint = decrypt(response.endpoint);
95
- const space = response.space ? decrypt(response.space) : {};
96
-
97
- return {
98
- endpoint,
99
- // name 默认为 DID Space,兼容旧版本的 DID Spaces
100
- ...{ name: 'DID Space' },
101
- ...space,
102
- };
103
- }
@@ -1,54 +0,0 @@
1
- import { flatten } from 'flat';
2
-
3
- export default flatten({
4
- common: {
5
- cancel: 'Cancel',
6
- confirm: 'Confirm',
7
- delete: 'Delete',
8
- error: 'Error',
9
- open: 'Open',
10
- unknown: 'Unknown',
11
- },
12
- storage: {
13
- spaces: {
14
- authorize: {
15
- title: 'Connect {appName} to DID Spaces',
16
- scan: 'Use your DID Wallet to scan the QR code below to allow the app {appName} to connect to DID Spaces',
17
- success: 'Connected successfully',
18
- },
19
- connect: {
20
- reconnect: 'Reconnect Now',
21
- useSpaceGateway: 'Connect using the DID Spaces gateway',
22
- useWallet: 'Connect with DID Wallet',
23
- howToGetGatewayUrl: 'How to get the url of did spaces',
24
- providerForStorage: 'Please connect your DID Spaces',
25
- },
26
- connected: {
27
- title: 'Connected DID Spaces',
28
- tag: 'Connected',
29
- },
30
- disconnected: {
31
- tag: 'Disconnected',
32
- },
33
- error: {
34
- tag: 'Need Attention',
35
- expired: 'This DID spaces has expired, you can re-subscribe by opening this link',
36
- corsBlocked:
37
- 'Connection requests may be blocked by CORS. Please check security settings in the DID Space dashboard.',
38
- networkError: 'Network error',
39
- },
40
- gateway: {
41
- add: {
42
- invalidUrl: 'Invalid DID Spaces gateway url',
43
- label: 'Enter the url of the DID Spaces',
44
- title: 'Add DID Spaces',
45
- },
46
- },
47
- provideNFT: {
48
- title: 'Please show the DID Spaces NFT for {appName}',
49
- scan: 'Use your DID Wallet to scan the QR code below to allow the app {appName} show DID space NFT',
50
- success: 'Connected successfully',
51
- },
52
- },
53
- },
54
- });
@@ -1,7 +0,0 @@
1
- import en from './en';
2
- import zh from './zh';
3
-
4
- export const translations = {
5
- zh,
6
- en,
7
- };
@@ -1,53 +0,0 @@
1
- import { flatten } from 'flat';
2
-
3
- export default flatten({
4
- common: {
5
- cancel: '取消',
6
- confirm: '确认',
7
- delete: '删除',
8
- error: '错误',
9
- open: '打开',
10
- unknown: '未知',
11
- },
12
- storage: {
13
- spaces: {
14
- authorize: {
15
- title: '连接 {appName} 至 DID Spaces',
16
- scan: '使用你的 DID Wallet 扫描下面的二维码以允许应用 {appName} 连接至 DID Spaces',
17
- success: '连接成功',
18
- },
19
- connect: {
20
- reconnect: '立即重连',
21
- useSpaceGateway: '使用 DID Spaces 网关连接',
22
- useWallet: '使用 DID Wallet 连接',
23
- howToGetGatewayUrl: '如何获取 DID Spaces 的网关地址',
24
- providerForStorage: '请连接您的 DID Spaces',
25
- },
26
- connected: {
27
- title: '已连接的 DID Spaces',
28
- tag: '已连接',
29
- },
30
- disconnected: {
31
- tag: '连接已断开',
32
- },
33
- error: {
34
- tag: '需要关注',
35
- expired: '此 DID Spaces 已过期,您可以打开此链接重新订阅',
36
- corsBlocked: '连接请求可能被 CORS 阻止。请检查 DID Space 控制面板中的安全设置。',
37
- networkError: '网络错误',
38
- },
39
- gateway: {
40
- add: {
41
- invalidUrl: '无效的 DID Spaces 网关地址',
42
- label: '输入 DID Spaces 的地址',
43
- title: '添加 DID Spaces',
44
- },
45
- },
46
- provideNFT: {
47
- title: '请为 {appName} 出示 DID Spaces NFT',
48
- scan: '使用你的 DID Wallet 扫描下面的二维码为应用 {appName} 出示 DID Spaces NFT',
49
- success: '连接成功',
50
- },
51
- },
52
- },
53
- });
@@ -1,51 +0,0 @@
1
- export type $TSFixMe = any;
2
-
3
- export interface AuthorizeConnect {
4
- open: boolean;
5
- action: string;
6
- checkFn: Function;
7
- messages: {
8
- title: string;
9
- scan: string;
10
- confirm: string;
11
- success: React.ReactNode;
12
- };
13
- prefix?: string;
14
- baseUrl?: string;
15
- webWalletUrl?: string;
16
- maxIdleTime?: number;
17
- checkTimeout?: number;
18
- extraParams?: Record<string, any>;
19
- }
20
-
21
- export enum SpaceStatus {
22
- LOADING = 'loading',
23
- CONNECTED = 'connected',
24
- DISCONNECTED = 'disconnected',
25
- EXPIRED = 'expired',
26
- CORS_BLOCKED = 'corsBlocked',
27
- UNKNOWN = 'unknown',
28
- }
29
-
30
- export interface SpaceGateway {
31
- did: string;
32
- name: string;
33
- url: string;
34
- endpoint: string;
35
- protected?: boolean;
36
- loading?: boolean;
37
- }
38
-
39
- export interface BaseAuthOptions {
40
- action?: string;
41
- checkFn?: Function;
42
- extraParams?: Record<string, string>;
43
- checkTimeout?: number;
44
- onSuccess?: (response: Record<string, string>, decrypt: Function) => Promise<void>;
45
- onClose?: () => void;
46
- }
47
-
48
- export interface GatewayAuthOptions extends BaseAuthOptions {
49
- spaceDid?: string;
50
- spaceGatewayUrl?: string;
51
- }
@@ -1,15 +0,0 @@
1
- declare module '@arcblock/*';
2
- declare module '@arcblock/ux/*';
3
- declare module '@abtnode/ux/*';
4
- declare module '@abtnode/util/*';
5
- declare module '@blocklet/*';
6
-
7
- declare module '*.svg' {
8
- import React from 'react';
9
- const SVG: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
10
- export default SVG;
11
- }
12
-
13
- declare interface Window {
14
- blocklet: import('@blocklet/sdk').WindowBlocklet;
15
- }
package/vite.config.ts DELETED
@@ -1,32 +0,0 @@
1
- /// <reference types="vitest" />
2
-
3
- import { defineConfig } from 'vite';
4
- import { nodePolyfills } from 'vite-plugin-node-polyfills';
5
- import babel from 'vite-plugin-babel';
6
-
7
- export default defineConfig({
8
- plugins: [
9
- nodePolyfills({ protocolImports: true }),
10
- babel({
11
- filter: /\.(jsx?|tsx?)$/,
12
- exclude: /node_modules/,
13
- }),
14
- ],
15
- resolve: {
16
- alias: {
17
- '@src': '/src',
18
- },
19
- },
20
- // vitest config
21
- test: {
22
- globals: true,
23
- environment: 'node',
24
- setupFiles: ['./tests/setup.ts'],
25
- include: ['./tests/**/*.spec.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
26
- exclude: ['**/node_modules/**', '**/dist/**'],
27
- coverage: {
28
- provider: 'v8',
29
- reporter: ['text', 'json', 'html'],
30
- },
31
- },
32
- });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes