@arcblock/ux 2.10.64 → 2.10.66

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 (121) hide show
  1. package/lib/ActionButton/index.d.ts +1 -1
  2. package/lib/Alert/index.d.ts +1 -1
  3. package/lib/AnimationWaiter/index.d.ts +27 -15
  4. package/lib/AnimationWaiter/index.js +15 -14
  5. package/lib/Async/index.d.ts +50 -17
  6. package/lib/Badge/index.d.ts +1 -1
  7. package/lib/Badge/index.js +7 -1
  8. package/lib/BlockletContext/index.d.ts +12 -28
  9. package/lib/BlockletContext/index.js +3 -21
  10. package/lib/Button/wrap.d.ts +5 -3
  11. package/lib/Button/wrap.js +2 -1
  12. package/lib/ButtonGroup/index.d.ts +12 -2
  13. package/lib/ButtonGroup/index.js +13 -3
  14. package/lib/CardSelector/index.d.ts +11 -33
  15. package/lib/CardSelector/index.js +16 -32
  16. package/lib/Center/index.d.ts +6 -21
  17. package/lib/Center/index.js +2 -17
  18. package/lib/ClickToCopy/copy-button.d.ts +9 -26
  19. package/lib/ClickToCopy/copy-button.js +5 -17
  20. package/lib/ClickToCopy/hook.d.ts +11 -5
  21. package/lib/ClickToCopy/hook.js +3 -3
  22. package/lib/ClickToCopy/index.d.ts +18 -29
  23. package/lib/ClickToCopy/index.js +0 -13
  24. package/lib/CodeBlock/LightBox.d.ts +1 -1
  25. package/lib/CodeBlock/index.d.ts +7 -26
  26. package/lib/CodeBlock/index.js +4 -17
  27. package/lib/Colors/index.d.ts +2 -2
  28. package/lib/Colors/themes/default.d.ts +54 -61
  29. package/lib/Colors/themes/temp.d.ts +35 -35
  30. package/lib/ContactForm/index.d.ts +26 -30
  31. package/lib/ContactForm/index.js +7 -17
  32. package/lib/Dialog/confirm.d.ts +3 -3
  33. package/lib/Dialog/confirm.js +2 -2
  34. package/lib/Earth/index.d.ts +10 -1
  35. package/lib/Header/auto-hidden.d.ts +6 -11
  36. package/lib/Header/auto-hidden.js +0 -5
  37. package/lib/Header/header.d.ts +20 -51
  38. package/lib/Header/header.js +10 -42
  39. package/lib/Header/index.d.ts +2 -2
  40. package/lib/Header/responsive-header.d.ts +10 -22
  41. package/lib/Header/responsive-header.js +1 -13
  42. package/lib/Icon/image.d.ts +8 -36
  43. package/lib/Icon/image.js +6 -24
  44. package/lib/Icon/index.d.ts +9 -1
  45. package/lib/Icon/index.js +6 -25
  46. package/lib/NavMenu/index.d.ts +1 -1
  47. package/lib/NavMenu/nav-menu.d.ts +37 -51
  48. package/lib/NavMenu/nav-menu.js +47 -102
  49. package/lib/NavMenu/style.d.ts +8 -2
  50. package/lib/NavMenu/style.js +3 -1
  51. package/lib/PageScroller/index.d.ts +13 -1
  52. package/lib/Passport/passport.js +1 -1
  53. package/lib/PricingTable/index.d.ts +3 -1
  54. package/lib/RelativeTime/index.d.ts +1 -1
  55. package/lib/Screenshot/BaseScreenshot/index.js +1 -1
  56. package/lib/SplitButton/index.d.ts +0 -19
  57. package/lib/SplitButton/index.js +7 -27
  58. package/lib/TextCollapse/index.d.ts +10 -1
  59. package/lib/Theme/index.d.ts +5 -13
  60. package/lib/Theme/index.js +4 -11
  61. package/lib/Theme/theme-provider.d.ts +16 -18
  62. package/lib/Theme/theme.d.ts +37 -11
  63. package/lib/Theme/theme.js +13 -22
  64. package/lib/Util/constant.d.ts +31 -31
  65. package/lib/Util/deprecate.d.ts +7 -5
  66. package/lib/Util/federated.d.ts +21 -21
  67. package/lib/Util/federated.js +1 -1
  68. package/lib/Util/index.d.ts +59 -60
  69. package/lib/Util/index.js +16 -43
  70. package/lib/Util/passport.d.ts +6 -6
  71. package/lib/Util/wallet.d.ts +15 -3
  72. package/lib/WebWalletSWKeeper/index.js +1 -1
  73. package/lib/global.d.ts +13 -0
  74. package/lib/index.d.ts +4 -2
  75. package/lib/index.js +2 -2
  76. package/lib/type.d.ts +31 -1
  77. package/package.json +5 -5
  78. package/src/AnimationWaiter/index.jsx +15 -14
  79. package/src/Async/{index.jsx → index.tsx} +13 -4
  80. package/src/Badge/index.jsx +8 -1
  81. package/src/BlockletContext/{index.jsx → index.tsx} +17 -22
  82. package/src/Button/wrap.jsx +2 -1
  83. package/src/ButtonGroup/index.js +13 -3
  84. package/src/CardSelector/{index.jsx → index.tsx} +32 -33
  85. package/src/Center/index.tsx +33 -0
  86. package/src/ClickToCopy/{copy-button.jsx → copy-button.tsx} +15 -16
  87. package/src/ClickToCopy/{hook.js → hook.ts} +5 -5
  88. package/src/ClickToCopy/{index.jsx → index.tsx} +12 -17
  89. package/src/CodeBlock/{index.jsx → index.tsx} +15 -17
  90. package/src/ContactForm/{index.jsx → index.tsx} +47 -29
  91. package/src/Dialog/confirm.jsx +2 -2
  92. package/src/Header/{auto-hidden.jsx → auto-hidden.tsx} +6 -7
  93. package/src/Header/{header.jsx → header.tsx} +32 -46
  94. package/src/Header/{responsive-header.jsx → responsive-header.tsx} +9 -15
  95. package/src/Icon/{image.jsx → image.tsx} +19 -22
  96. package/src/Icon/{index.jsx → index.tsx} +22 -24
  97. package/src/NavMenu/{nav-menu.jsx → nav-menu.tsx} +161 -144
  98. package/src/NavMenu/{style.js → style.ts} +9 -1
  99. package/src/Passport/passport.jsx +1 -1
  100. package/src/Screenshot/BaseScreenshot/index.jsx +1 -1
  101. package/src/SplitButton/index.tsx +10 -23
  102. package/src/Theme/{index.js → index.ts} +6 -12
  103. package/src/Theme/{theme-provider.jsx → theme-provider.tsx} +10 -2
  104. package/src/Theme/{theme.js → theme.ts} +54 -23
  105. package/src/Util/{deprecate.jsx → deprecate.tsx} +8 -4
  106. package/src/Util/{federated.js → federated.ts} +3 -3
  107. package/src/Util/{index.js → index.ts} +85 -59
  108. package/src/Util/{passport.js → passport.ts} +2 -2
  109. package/src/Util/{wallet.js → wallet.ts} +1 -1
  110. package/src/WebWalletSWKeeper/index.jsx +1 -1
  111. package/src/global.d.ts +13 -0
  112. package/src/{index.js → index.ts} +2 -2
  113. package/src/type.d.ts +31 -1
  114. package/src/Center/index.jsx +0 -41
  115. /package/src/CodeBlock/{LightBox.jsx → LightBox.tsx} +0 -0
  116. /package/src/Colors/{index.js → index.ts} +0 -0
  117. /package/src/Colors/themes/{default.js → default.ts} +0 -0
  118. /package/src/Colors/themes/{temp.js → temp.ts} +0 -0
  119. /package/src/Header/{index.js → index.ts} +0 -0
  120. /package/src/NavMenu/{index.js → index.ts} +0 -0
  121. /package/src/Util/{constant.js → constant.ts} +0 -0
@@ -1,33 +1,33 @@
1
- export const DEFAULT_TIMEOUT: number;
2
- export const DEFAULT_WINDOW_TIMEOUT: number;
3
- export const WELLKNOWN_SERVICE_PATH_PREFIX: "/.well-known/service";
4
- export const AUTH_SERVICE_PREFIX: "/.well-known/service";
5
- export const SESSION_TOKEN_STORAGE_KEY: "login_token";
6
- export const REFRESH_TOKEN_STORAGE_KEY: "refresh_token";
7
- export const RELAY_SOCKET_PREFIX: "/.well-known/service";
8
- export const API_DID_PREFIX: "/api/did";
9
- export const DASHBOARD_URL: "/.well-known/service/admin";
10
- export const PROFILE_URL: "/.well-known/service/user";
11
- export const NAVIGATION_URL: "/.well-known/service/admin/navigation";
12
- export const DID_PREFIX: "did:abt:";
13
- export namespace PASSPORT_STATUS {
14
- let VALID: string;
15
- let REVOKED: string;
16
- }
17
- export namespace LOGIN_PROVIDER {
18
- let AUTH0: string;
19
- let APPLE: string;
20
- let GITHUB: string;
21
- let GOOGLE: string;
22
- let WALLET: string;
23
- let NFT: string;
24
- }
25
- export const LOGIN_PROVIDER_NAME: {
1
+ export declare const DEFAULT_TIMEOUT: number;
2
+ export declare const DEFAULT_WINDOW_TIMEOUT: number;
3
+ export declare const WELLKNOWN_SERVICE_PATH_PREFIX = "/.well-known/service";
4
+ export declare const AUTH_SERVICE_PREFIX = "/.well-known/service";
5
+ export declare const SESSION_TOKEN_STORAGE_KEY = "login_token";
6
+ export declare const REFRESH_TOKEN_STORAGE_KEY = "refresh_token";
7
+ export declare const RELAY_SOCKET_PREFIX = "/.well-known/service";
8
+ export declare const API_DID_PREFIX = "/api/did";
9
+ export declare const DASHBOARD_URL = "/.well-known/service/admin";
10
+ export declare const PROFILE_URL = "/.well-known/service/user";
11
+ export declare const NAVIGATION_URL = "/.well-known/service/admin/navigation";
12
+ export declare const DID_PREFIX = "did:abt:";
13
+ export declare const PASSPORT_STATUS: {
14
+ VALID: string;
15
+ REVOKED: string;
16
+ };
17
+ export declare const LOGIN_PROVIDER: {
18
+ AUTH0: string;
19
+ APPLE: string;
20
+ GITHUB: string;
21
+ GOOGLE: string;
22
+ WALLET: string;
23
+ NFT: string;
24
+ };
25
+ export declare const LOGIN_PROVIDER_NAME: {
26
26
  [x: string]: string;
27
27
  };
28
- export namespace OAUTH_PROVIDER {
29
- let auth0: string;
30
- let apple: string;
31
- let github: string;
32
- let google: string;
33
- }
28
+ export declare const OAUTH_PROVIDER: {
29
+ auth0: string;
30
+ apple: string;
31
+ github: string;
32
+ google: string;
33
+ };
@@ -1,5 +1,7 @@
1
- export function warn(name: any, alternative: any): void;
2
- export function withDeprecated(Component: any, { name, alternative }: {
3
- name: any;
4
- alternative: any;
5
- }): (props: any) => import("react/jsx-runtime").JSX.Element;
1
+ import { ComponentType } from 'react';
2
+ declare const warn: (name: string, alternative?: string) => void;
3
+ declare const withDeprecated: <P extends object>(Component: ComponentType<P>, { name, alternative }: {
4
+ name: string;
5
+ alternative?: string;
6
+ }) => (props: P) => import("react/jsx-runtime").JSX.Element;
7
+ export { warn, withDeprecated };
@@ -1,8 +1,8 @@
1
- export function getMaster(blocklet?: any): any;
2
- export function getConfig(blocklet?: any): any;
3
- export function getFederatedEnabled(blocklet?: any): boolean;
4
- export function getSourceAppPid(blocklet?: any): any;
5
- export function getFederatedApp(blocklet?: any): {
1
+ export declare function getMaster(blocklet?: import("../type").Blocklet): any;
2
+ export declare function getConfig(blocklet?: import("../type").Blocklet): any;
3
+ export declare function getFederatedEnabled(blocklet?: import("../type").Blocklet): boolean;
4
+ export declare function getSourceAppPid(blocklet?: import("../type").Blocklet): any;
5
+ export declare function getFederatedApp(blocklet?: import("../type").Blocklet): {
6
6
  appId: any;
7
7
  appName: any;
8
8
  appDescription: any;
@@ -13,22 +13,22 @@ export function getFederatedApp(blocklet?: any): {
13
13
  sourceAppPid: any;
14
14
  provider: string;
15
15
  } | null;
16
- export function getCurrentApp(blocklet?: any): {
17
- appId: any;
18
- appName: any;
19
- appDescription: any;
20
- appLogo: any;
21
- appPid: any;
22
- appUrl: any;
16
+ export declare function getCurrentApp(blocklet?: import("../type").Blocklet): {
17
+ appId: string;
18
+ appName: string;
19
+ appDescription: string;
20
+ appLogo: string;
21
+ appPid: string;
22
+ appUrl: string;
23
23
  currentAppUrl: string | undefined;
24
- version: any;
24
+ version: string;
25
25
  sourceAppPid: null;
26
26
  provider: string;
27
27
  type?: undefined;
28
28
  } | {
29
- appId: any;
30
- appName: any;
31
- appDescription: any;
29
+ appId: string;
30
+ appName: string;
31
+ appDescription: string;
32
32
  appUrl: any;
33
33
  currentAppUrl: string;
34
34
  sourceAppPid: null;
@@ -38,7 +38,7 @@ export function getCurrentApp(blocklet?: any): {
38
38
  appPid?: undefined;
39
39
  version?: undefined;
40
40
  } | null;
41
- export function getApps(blocklet: any): ({
41
+ export declare function getApps(blocklet: Blocklet): ({
42
42
  appId: any;
43
43
  appName: any;
44
44
  appDescription: any;
@@ -49,9 +49,9 @@ export function getApps(blocklet: any): ({
49
49
  sourceAppPid: any;
50
50
  provider: string;
51
51
  } | {
52
- appId: any;
53
- appName: any;
54
- appDescription: any;
52
+ appId: string;
53
+ appName: string;
54
+ appDescription: string;
55
55
  appUrl: any;
56
56
  currentAppUrl: string;
57
57
  sourceAppPid: null;
@@ -61,4 +61,4 @@ export function getApps(blocklet: any): ({
61
61
  appPid?: undefined;
62
62
  version?: undefined;
63
63
  })[];
64
- export function getBlockletData(appUrl: any): Promise<any>;
64
+ export declare function getBlockletData(appUrl: string): Promise<any>;
@@ -50,7 +50,7 @@ export function getCurrentApp(blocklet = window.blocklet) {
50
50
  provider: 'wallet'
51
51
  };
52
52
  }
53
- // HACK: 适用于 blockelt-server
53
+ // HACK: 适用于 blocklet-server
54
54
  if (window.env) {
55
55
  // eslint-disable-next-line no-param-reassign
56
56
  blocklet = window.env;
@@ -1,81 +1,80 @@
1
- export function parseQuery(str: any): any;
2
- export function stringifyQuery(params?: {}): string;
3
- /**
4
- * @param {number} opts.expireInDays
5
- * @param {string} opts.path
6
- * @param {domain} opts.domain
7
- * @param {boolean} opts.returnDomain if === false, opts.domain will be skipped
8
- */
9
- export function getCookieOptions(expireInDays?: number): {
10
- expires: number;
11
- path: any;
12
- domain: any;
13
- sameSite: any;
14
- secure: boolean;
15
- };
16
- export function mergeProps(props: any, component: any, jsonAttrs?: any[]): any;
17
- export function getCopyright(startYear?: number): string;
1
+ import type { $TSFixMe } from '../type';
2
+ declare let dateTool: $TSFixMe | null;
3
+ export declare function parseQuery(str: string): Record<string, string | boolean>;
4
+ export declare function stringifyQuery(params?: {}): string;
5
+ export declare function getCookieOptions(expireInDays?: number | {
6
+ expireInDays: number;
7
+ path?: string;
8
+ domain?: string;
9
+ returnDomain?: boolean;
10
+ sameSite?: Cookies.CookieAttributes['sameSite'];
11
+ secure?: boolean;
12
+ }): import("js-cookie").CookieAttributes;
13
+ export declare const getColor: (props: $TSFixMe) => any;
14
+ export declare const getBackground: (props: $TSFixMe) => any;
15
+ export declare function mergeProps<P extends object>(props: Record<string, any>, component: React.ComponentType<P>, jsonAttrs?: string[]): Record<string, any>;
16
+ export declare function getCopyright(startYear?: number): string;
17
+ export declare const getTimezone: () => string;
18
+ export declare const str2color: (str: string) => string;
19
+ export declare const formatUptime: (uptime: number) => string;
18
20
  /**
19
21
  * Set the date tool library which support for format() and locale() functions,
20
22
  * moment and dayjs are recommended.
21
- * @param {object} the date tool library
22
23
  */
23
- export function setDateTool(tool: any): void;
24
- export function getDateTool(): any;
24
+ export declare function setDateTool(tool: typeof dateTool): void;
25
+ export declare function getDateTool(): any;
25
26
  /**
26
27
  * Format the time string as `ll` format: MMM D, YYYY
27
28
  * Ensure that the setDateTool() function is called first to set the time tool library.
28
- * @param {string} date date string
29
- * @param {object} option
30
- * @param {string} option.locale, default: en
31
- * @param {string} option.tz, default: timzone
32
29
  * @returns formatted date string
33
30
  */
34
- export function formatToDate(date: string, { locale, tz }?: {
35
- locale: string;
36
- tz: string;
31
+ export declare function formatToDate(date: string, { locale, tz }?: {
32
+ locale?: string;
33
+ tz?: string;
37
34
  }): any;
38
35
  /**
39
36
  * Format the time string as `lll` format: MMM D, YYYY h:mm A
40
37
  * Ensure that the setDateTool() function is called first to set the time tool library.
41
- * @param {string} date date string
42
- * @param {object} option
43
- * @param {string} option.locale, default: en
44
- * @param {string} option.tz, default: timzone
45
38
  * @returns formatted date string
46
39
  */
47
- export function formatToDatetime(date: string, { locale, tz }?: {
48
- locale: string;
49
- tz: string;
40
+ export declare function formatToDatetime(date: string, { locale, tz }?: {
41
+ locale?: string;
42
+ tz?: string;
50
43
  }): any;
51
- export function detectWalletExtension(): any;
52
- export function openWebWallet({ webWalletUrl, action, locale, url, windowFeatures }: {
53
- webWalletUrl: any;
54
- action?: string | undefined;
55
- locale?: string | undefined;
56
- url: any;
57
- windowFeatures: any;
44
+ export declare function detectWalletExtension(): any;
45
+ export declare function openWebWallet({ webWalletUrl, action, locale, url, windowFeatures, }: {
46
+ webWalletUrl: string;
47
+ action?: string;
48
+ locale?: string;
49
+ url: string;
50
+ windowFeatures: $TSFixMe;
58
51
  }): void;
59
- export function getColor(props: any): any;
60
- export function getBackground(props: any): any;
61
- export function getTimezone(): string;
62
- export function str2color(str: any): string;
63
- export function formatUptime(uptime: any): string;
64
- export function getFontSize(size: any): string;
65
- export function isEthereumDid(did: any): boolean;
66
- export function appendParams(url: string, params: {
52
+ export declare const getFontSize: (size: string) => string;
53
+ export declare const isEthereumDid: (did: string) => boolean;
54
+ export declare const appendParams: (url: string, params: {
67
55
  imageFilter: "crop" | "resize";
68
56
  w?: number;
69
57
  h?: number;
70
58
  r?: 0 | 90 | 180 | 270;
71
- }): string;
72
- export function getUserAvatar(avatar: any, size?: number): any;
73
- export function sleep(time?: number): Promise<any>;
74
- export function isUrl(str: any): boolean;
75
- export function getVisitorId(): string | null;
76
- export function setVisitorId(value: any): void;
77
- export function getDIDColor(did: any): any;
78
- export function getTranslation(translations: Object | string, locale: string, { fallbackLocale, defaultValue }?: {
79
- fallbackLocale?: string | undefined;
80
- defaultValue?: string | undefined;
81
- }): string;
59
+ }) => string;
60
+ export declare const getUserAvatar: (avatar: string, size?: number) => string;
61
+ export declare const sleep: (time?: number) => Promise<void>;
62
+ export declare const isUrl: (str: string) => boolean;
63
+ export declare const getVisitorId: () => string | null;
64
+ export declare const setVisitorId: (value: string | null) => void;
65
+ export declare const getDIDColor: (did: string) => any;
66
+ type NestedTranslation = {
67
+ [key: string]: string | NestedTranslation;
68
+ };
69
+ type TranslationsObject = {
70
+ [locale: string]: NestedTranslation;
71
+ };
72
+ /**
73
+ * Retrieves the appropriate translation based on the locale, with fallback options.
74
+ * @return {string} The translated string based on the locale, with fallback options if necessary.
75
+ */
76
+ export declare const getTranslation: (translations: string | TranslationsObject, locale: string, options?: {
77
+ fallbackLocale?: string;
78
+ defaultValue?: string;
79
+ }) => string;
80
+ export {};
package/lib/Util/index.js CHANGED
@@ -14,19 +14,12 @@ export function parseQuery(str) {
14
14
  export function stringifyQuery(params = {}) {
15
15
  return new URLSearchParams(params).toString();
16
16
  }
17
-
18
- /**
19
- * @param {number} opts.expireInDays
20
- * @param {string} opts.path
21
- * @param {domain} opts.domain
22
- * @param {boolean} opts.returnDomain if === false, opts.domain will be skipped
23
- */
24
17
  export function getCookieOptions(expireInDays = 1) {
25
- let opts = {
26
- expireInDays
27
- };
28
- if (typeof expireInDays === 'object') {
29
- opts = expireInDays;
18
+ let opts = expireInDays;
19
+ if (typeof opts === 'number') {
20
+ opts = {
21
+ expireInDays: opts
22
+ };
30
23
  }
31
24
  if (opts.path === undefined) {
32
25
  opts.path = '/';
@@ -120,13 +113,13 @@ export const formatUptime = uptime => {
120
113
  const hours = Math.floor(total / 3600);
121
114
  const minutes = Math.floor((total - hours * 3600) / 60);
122
115
  const seconds = total % 60;
116
+ // @ts-expect-error
123
117
  return `${padStart(hours, 2, '0')}:${padStart(minutes, 2, '0')}:${padStart(seconds, 2, '0')}`;
124
118
  };
125
119
 
126
120
  /**
127
121
  * Set the date tool library which support for format() and locale() functions,
128
122
  * moment and dayjs are recommended.
129
- * @param {object} the date tool library
130
123
  */
131
124
  export function setDateTool(tool) {
132
125
  dateTool = tool;
@@ -137,7 +130,7 @@ export function getDateTool() {
137
130
  const createDateFormatter = format => (date, {
138
131
  locale,
139
132
  tz
140
- }) => {
133
+ } = {}) => {
141
134
  if (dateTool === null) {
142
135
  throw new Error('call setDateTool to set the date tool library, such as: setDateTool(dayjs)');
143
136
  }
@@ -157,14 +150,10 @@ const createDateFormatter = format => (date, {
157
150
  /**
158
151
  * Format the time string as `ll` format: MMM D, YYYY
159
152
  * Ensure that the setDateTool() function is called first to set the time tool library.
160
- * @param {string} date date string
161
- * @param {object} option
162
- * @param {string} option.locale, default: en
163
- * @param {string} option.tz, default: timzone
164
153
  * @returns formatted date string
165
154
  */
166
155
  export function formatToDate(date, {
167
- locale,
156
+ locale = 'en',
168
157
  tz
169
158
  } = {}) {
170
159
  return createDateFormatter('ll')(date, {
@@ -176,14 +165,10 @@ export function formatToDate(date, {
176
165
  /**
177
166
  * Format the time string as `lll` format: MMM D, YYYY h:mm A
178
167
  * Ensure that the setDateTool() function is called first to set the time tool library.
179
- * @param {string} date date string
180
- * @param {object} option
181
- * @param {string} option.locale, default: en
182
- * @param {string} option.tz, default: timzone
183
168
  * @returns formatted date string
184
169
  */
185
170
  export function formatToDatetime(date, {
186
- locale,
171
+ locale = 'en',
187
172
  tz
188
173
  } = {}) {
189
174
  return createDateFormatter('lll')(date, {
@@ -192,6 +177,7 @@ export function formatToDatetime(date, {
192
177
  });
193
178
  }
194
179
  export function detectWalletExtension() {
180
+ // @ts-expect-error Property 'ABT_DEV' does not exist on type 'Window & typeof globalThis'.
195
181
  const extension = window?.ABT_DEV || window.ABT;
196
182
  if (extension && typeof extension.open === 'function') {
197
183
  return extension;
@@ -261,13 +247,6 @@ export const isEthereumDid = did => {
261
247
  }
262
248
  return true;
263
249
  };
264
-
265
- /**
266
- *
267
- * @param {string} url 需要处理的 url
268
- * @param {{imageFilter: 'crop'|'resize'; w?: number; h?: number; r?: 0|90|180|270}} params
269
- * @returns
270
- */
271
250
  export const appendParams = (url, params) => {
272
251
  if (!params) {
273
252
  return url;
@@ -276,7 +255,7 @@ export const appendParams = (url, params) => {
276
255
  // HACK: 如果 url 中带有域名,则 urlInstance.origin 为 url 中的域名;否则,借用当前页面的 location.origin 作为域名来拼接一个 url
277
256
  const urlInstance = new URL(url, window.location.origin);
278
257
  Object.keys(params).forEach(key => {
279
- urlInstance.searchParams.set(key, params[key]);
258
+ urlInstance.searchParams.set(key, String(params[key]));
280
259
  });
281
260
  // HACK: 如果前后域名一致,代表前面已经借用了 location.origin,这个时候只需要返回 urlInstance.pathname + urlInstance.search 即可
282
261
  if (urlInstance.origin === window.location.origin) {
@@ -333,21 +312,15 @@ export const getDIDColor = did => {
333
312
  return null;
334
313
  }
335
314
  };
336
-
337
315
  /**
338
316
  * Retrieves the appropriate translation based on the locale, with fallback options.
339
- *
340
- * @param {Object|string} translations - The translations object or string to retrieve translation from.
341
- * @param {string} locale - The locale to use for retrieving the translation.
342
- * @param {Object} options - Additional options for fallbackLocale and defaultValue.
343
- * @param {string} [options.fallbackLocale='en'] - The fallback locale to use if the translation for the specified locale is not found.
344
- * @param {string} [options.defaultValue='unknown'] - The default value to return if no translation is found.
345
317
  * @return {string} The translated string based on the locale, with fallback options if necessary.
346
318
  */
347
- export const getTranslation = (translations, locale, {
348
- fallbackLocale = 'en',
349
- defaultValue = 'unknown'
350
- } = {}) => {
319
+ export const getTranslation = (translations, locale, options = {}) => {
320
+ const {
321
+ fallbackLocale = 'en',
322
+ defaultValue = 'unknown'
323
+ } = options;
351
324
  if (typeof translations === 'string') {
352
325
  return translations;
353
326
  }
@@ -1,9 +1,9 @@
1
- export function getPassportColor(preferredColor: any, did: any): {
1
+ export declare const getPassportColor: (preferredColor: string, did: string) => {
2
2
  start: string;
3
3
  end: string;
4
4
  };
5
- export function getTextColor(background: any): "#111" | "#EEE";
6
- export function createPassportSvg({ issuer, title, issuerDid, issuerAvatarUrl, ownerDid, ownerAvatarUrl, preferredColor, revoked, isDataUrl, width, height, }: {
5
+ export declare const getTextColor: (background: string) => "#111" | "#EEE";
6
+ export declare const createPassportSvg: ({ issuer, title, issuerDid, issuerAvatarUrl, ownerDid, ownerAvatarUrl, preferredColor, revoked, isDataUrl, width, height, }: {
7
7
  issuer?: string | undefined;
8
8
  title?: string | undefined;
9
9
  issuerDid?: string | undefined;
@@ -15,8 +15,8 @@ export function createPassportSvg({ issuer, title, issuerDid, issuerAvatarUrl, o
15
15
  isDataUrl?: boolean | undefined;
16
16
  width?: string | undefined;
17
17
  height?: string | undefined;
18
- }): string;
19
- export function createKycSvg({ issuer, title, issuerDid, issuerAvatarUrl, ownerDid, ownerName, ownerAvatarUrl, preferredColor, type, revoked, isDataUrl, width, height, }: {
18
+ }) => string;
19
+ export declare const createKycSvg: ({ issuer, title, issuerDid, issuerAvatarUrl, ownerDid, ownerName, ownerAvatarUrl, preferredColor, type, revoked, isDataUrl, width, height, }: {
20
20
  issuer?: string | undefined;
21
21
  title?: string | undefined;
22
22
  issuerDid?: string | undefined;
@@ -30,4 +30,4 @@ export function createKycSvg({ issuer, title, issuerDid, issuerAvatarUrl, ownerD
30
30
  isDataUrl?: boolean | undefined;
31
31
  width?: string | undefined;
32
32
  height?: string | undefined;
33
- }): string;
33
+ }) => string;
@@ -1,3 +1,15 @@
1
- export const providerName: "wallet_url";
2
- export function getWebWalletUrl(): any;
3
- export function checkSameProtocol(webWalletUrl: any): boolean;
1
+ export declare const providerName = "wallet_url";
2
+ /**
3
+ * 获取 web wallet url, 常用于为 did connect 组件传递 webWalletUrl 参数,
4
+ * 更明确的说, 这里获取的应该是 **default web wallet url**,
5
+ * 如果用户使用自定义的 web wallet url, 不应该使用该方法, 应该显式的将自定义的 web wallet url 传递给 did connect 组件
6
+ * (参考: https://github.com/blocklet/ocap-playground/issues/98)
7
+ *
8
+ * 获取优先级:
9
+ * - localStorage 使用 provider 注册
10
+ * - window.env.webWalletUrl
11
+ * - window.blocklet.webWalletUrl
12
+ * - production web wallet url
13
+ */
14
+ export declare const getWebWalletUrl: () => any;
15
+ export declare const checkSameProtocol: (webWalletUrl: string) => boolean;
@@ -4,8 +4,8 @@ import PropTypes from 'prop-types';
4
4
  import useIdle from 'react-use/lib/useIdle';
5
5
  import { useLocalStorageState } from 'ahooks';
6
6
  import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
7
- import { detectWalletExtension } from '@arcblock/ux/lib/Util';
8
7
  import { getWebWalletUrl, checkSameProtocol } from '../Util/wallet';
8
+ import { detectWalletExtension } from '../Util';
9
9
 
10
10
  // 默认最大空闲时间: 30min
11
11
  const DEFAULT_MAX_IDLE_TIME = 1000 * 60 * 30;
@@ -0,0 +1,13 @@
1
+ declare module '@arcblock/did-motif';
2
+
3
+ type Blocklet = import('./type').Blocklet;
4
+
5
+ interface Window {
6
+ blocklet?: Blocklet;
7
+ env?: Blocklet;
8
+ }
9
+
10
+ declare module globalThis {
11
+ var blocklet: Blocklet;
12
+ var env: Blocklet;
13
+ }
package/lib/index.d.ts CHANGED
@@ -16,15 +16,17 @@ import Footer from './Footer';
16
16
  import Icon from './Icon';
17
17
  import LocaleSelector from './Locale/selector';
18
18
  import Logo from './Logo';
19
- import Tabs from './Tabs';
20
19
  import RelativeTime from './RelativeTime';
21
20
  import SessionManager from './SessionManager';
22
21
  import Datatable from './Datatable';
23
22
  import Dialog from './Dialog';
24
23
  import DidLogo from './DidLogo';
24
+ import Tabs from './Tabs';
25
25
  import Tag from './Tag';
26
26
  import TextCollapse from './TextCollapse';
27
+ import * as Theme from './Theme';
27
28
  import Toast from './Toast';
29
+ import * as Util from './Util';
28
30
  import Video from './Video';
29
31
  import WebWalletSWKeeper from './WebWalletSWKeeper';
30
32
  import WalletAction from './Wallet/Action';
@@ -33,4 +35,4 @@ import WechatPrompt from './WechatPrompt';
33
35
  import withTheme from './withTheme';
34
36
  import withTracker from './withTracker';
35
37
  import Img from './Img';
36
- export { ActionButton, ActivityIndicator, Address, Alert, AnimationWaiter, Async, Avatar, Badge, Button, ClickToCopy, CodeBlock, ContactForm, CountDown, Earth, Footer, Icon, LocaleSelector, Logo, Tabs, RelativeTime, SessionManager, Datatable, Dialog, DidLogo, Tag, TextCollapse, Theme, Toast, Util, Video, WebWalletSWKeeper, WalletAction, WalletDownload, WechatPrompt, withTheme, withTracker, Img };
38
+ export { ActionButton, ActivityIndicator, Address, Alert, AnimationWaiter, Async, Avatar, Badge, Button, ClickToCopy, CodeBlock, ContactForm, CountDown, Earth, Footer, Icon, LocaleSelector, Logo, Tabs, RelativeTime, SessionManager, Datatable, Dialog, DidLogo, Tag, TextCollapse, Theme, Toast, Util, Video, WebWalletSWKeeper, WalletAction, WalletDownload, WechatPrompt, withTheme, withTracker, Img, };
package/lib/index.js CHANGED
@@ -24,9 +24,9 @@ import DidLogo from './DidLogo';
24
24
  import Tabs from './Tabs';
25
25
  import Tag from './Tag';
26
26
  import TextCollapse from './TextCollapse';
27
- import Theme from './Theme';
27
+ import * as Theme from './Theme';
28
28
  import Toast from './Toast';
29
- import Util from './Util';
29
+ import * as Util from './Util';
30
30
  import Video from './Video';
31
31
  import WebWalletSWKeeper from './WebWalletSWKeeper';
32
32
  import WalletAction from './Wallet/Action';
package/lib/type.d.ts CHANGED
@@ -1 +1,31 @@
1
- declare module '@arcblock/did-motif';
1
+ export type $TSFixMe = any;
2
+
3
+ export type Blocklet = {
4
+ appId: string;
5
+ appIds: string[];
6
+ appPid: string;
7
+ appName: string;
8
+ appDescription: string;
9
+ appLogo: string;
10
+ appLogoRect: string;
11
+ appUrl: string;
12
+ isComponent: boolean;
13
+ prefix: string;
14
+ groupPrefix: string;
15
+ pageGroup: string;
16
+ version: string;
17
+ mode: string;
18
+ tenantMode: 'single' | 'multiple';
19
+ theme: TTheme;
20
+ navigation: TNavigation[];
21
+ preferences: Record<string, any>;
22
+ languages: {
23
+ code: string;
24
+ name: string;
25
+ }[];
26
+ passportColor: string;
27
+ componentMountPoints: TComponent[];
28
+ alsoKnownAs: string[];
29
+ trustedFactories: string[];
30
+ [x: string]: any;
31
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.10.64",
3
+ "version": "2.10.66",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -64,12 +64,12 @@
64
64
  "react": ">=18.2.0",
65
65
  "react-router-dom": ">=6.22.3"
66
66
  },
67
- "gitHead": "b5362da4f7e1caa78ed39a37f3844e193d9d289f",
67
+ "gitHead": "39618b5825c36e842a8c50af5967a95c19481341",
68
68
  "dependencies": {
69
69
  "@arcblock/did-motif": "^1.1.13",
70
- "@arcblock/icons": "^2.10.64",
71
- "@arcblock/nft-display": "^2.10.64",
72
- "@arcblock/react-hooks": "^2.10.64",
70
+ "@arcblock/icons": "^2.10.66",
71
+ "@arcblock/nft-display": "^2.10.66",
72
+ "@arcblock/react-hooks": "^2.10.66",
73
73
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
74
74
  "@fontsource/inter": "^5.0.16",
75
75
  "@fontsource/ubuntu-mono": "^5.0.18",