@blocklet/did-domain-react 0.3.39

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 (56) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +1 -0
  3. package/babel.config.es.js +8 -0
  4. package/build.config.ts +29 -0
  5. package/env.d.ts +17 -0
  6. package/es/buy.d.ts +19 -0
  7. package/es/buy.js +124 -0
  8. package/es/domain.d.ts +11 -0
  9. package/es/domain.js +73 -0
  10. package/es/index.d.ts +4 -0
  11. package/es/index.js +4 -0
  12. package/es/libs/api.d.ts +3 -0
  13. package/es/libs/api.js +21 -0
  14. package/es/libs/util.d.ts +21 -0
  15. package/es/libs/util.js +73 -0
  16. package/es/locales/en.d.ts +2 -0
  17. package/es/locales/en.js +15 -0
  18. package/es/locales/index.d.ts +4 -0
  19. package/es/locales/index.js +6 -0
  20. package/es/locales/zh.d.ts +2 -0
  21. package/es/locales/zh.js +15 -0
  22. package/es/types/index.d.ts +0 -0
  23. package/es/types/index.js +0 -0
  24. package/es/types/shims.d.ts +15 -0
  25. package/global.d.ts +54 -0
  26. package/lib/buy.d.ts +19 -0
  27. package/lib/buy.js +177 -0
  28. package/lib/domain.d.ts +11 -0
  29. package/lib/domain.js +80 -0
  30. package/lib/index.d.ts +4 -0
  31. package/lib/index.js +27 -0
  32. package/lib/libs/api.d.ts +3 -0
  33. package/lib/libs/api.js +25 -0
  34. package/lib/libs/util.d.ts +21 -0
  35. package/lib/libs/util.js +83 -0
  36. package/lib/locales/en.d.ts +2 -0
  37. package/lib/locales/en.js +22 -0
  38. package/lib/locales/index.d.ts +4 -0
  39. package/lib/locales/index.js +13 -0
  40. package/lib/locales/zh.d.ts +2 -0
  41. package/lib/locales/zh.js +22 -0
  42. package/lib/types/index.d.ts +0 -0
  43. package/lib/types/index.js +1 -0
  44. package/lib/types/shims.d.ts +15 -0
  45. package/package.json +106 -0
  46. package/src/buy.tsx +154 -0
  47. package/src/domain.tsx +77 -0
  48. package/src/index.ts +6 -0
  49. package/src/libs/api.ts +28 -0
  50. package/src/libs/util.ts +100 -0
  51. package/src/locales/en.ts +17 -0
  52. package/src/locales/index.ts +7 -0
  53. package/src/locales/zh.ts +16 -0
  54. package/src/types/index.ts +0 -0
  55. package/src/types/shims.d.ts +15 -0
  56. package/vite.config.ts +6 -0
package/lib/buy.js ADDED
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = Buy;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
9
+ var _Dialog = _interopRequireDefault(require("@arcblock/ux/lib/Dialog"));
10
+ var _context = require("@arcblock/ux/lib/Locale/context");
11
+ var _CheckCircle = _interopRequireDefault(require("@mui/icons-material/CheckCircle"));
12
+ var _ShoppingCart = _interopRequireDefault(require("@mui/icons-material/ShoppingCart"));
13
+ var _Alert = _interopRequireDefault(require("@mui/material/Alert"));
14
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
15
+ var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
16
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
17
+ var _ahooks = require("ahooks");
18
+ var _react = require("react");
19
+ var _ufo = require("ufo");
20
+ var _api = require("./libs/api");
21
+ var _util = require("./libs/util");
22
+ var _locales = require("./locales");
23
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
24
+ var BuyState = /* @__PURE__ */(BuyState2 => {
25
+ BuyState2[BuyState2["Prepare"] = 1] = "Prepare";
26
+ BuyState2[BuyState2["InProgress"] = 2] = "InProgress";
27
+ BuyState2[BuyState2["Success"] = 4] = "Success";
28
+ BuyState2[BuyState2["Completed"] = 8] = "Completed";
29
+ return BuyState2;
30
+ })(BuyState || {});
31
+ function Component({
32
+ delegatee,
33
+ delegateePk,
34
+ didDomainURL,
35
+ locale,
36
+ onSuccess,
37
+ ...props
38
+ }) {
39
+ const {
40
+ t
41
+ } = (0, _context.useLocaleContext)();
42
+ const [state, setState] = (0, _ahooks.useSetState)({
43
+ currentState: 1 /* Prepare */
44
+ });
45
+ const popup = (0, _react.useRef)(null);
46
+ const domainURLObj = new URL(didDomainURL);
47
+ domainURLObj.searchParams.set("locale", locale);
48
+ const api = (0, _ahooks.useMemoizedFn)(() => (0, _api.create)({
49
+ baseURL: (0, _ufo.joinURL)(domainURLObj.origin, domainURLObj.pathname, "api")
50
+ }))();
51
+ const onMessage = (0, _ahooks.useMemoizedFn)(event => {
52
+ if (event.data.type === "didDomain.success") {
53
+ onSuccess?.({
54
+ nftDid: event.data?.nftDid,
55
+ domain: event.data?.domain,
56
+ chainHost: event.data?.chainHost
57
+ });
58
+ popup.current?.close();
59
+ popup.current = null;
60
+ setState({
61
+ currentState: 4 /* Success */
62
+ });
63
+ setTimeout(() => {
64
+ setState({
65
+ currentState: 8 /* Completed */
66
+ });
67
+ }, 2e3);
68
+ }
69
+ });
70
+ (0, _ahooks.useUnmount)(() => {
71
+ try {
72
+ window.removeEventListener("message", onMessage);
73
+ popup.current?.close();
74
+ popup.current = null;
75
+ } catch (error) {
76
+ console.warn("Failed to close popup", error);
77
+ }
78
+ });
79
+ const handleCloseDialog = (0, _ahooks.useMemoizedFn)(() => {
80
+ setState({
81
+ currentState: 1 /* Prepare */
82
+ });
83
+ });
84
+ const handleOpenDialog = (0, _ahooks.useMemoizedFn)(() => {
85
+ setState({
86
+ currentState: 2 /* InProgress */
87
+ });
88
+ sessionRequest.run();
89
+ });
90
+ const handleCreatedSession = (0, _ahooks.useMemoizedFn)(({
91
+ sessionId
92
+ }) => {
93
+ window.addEventListener("message", onMessage);
94
+ domainURLObj.searchParams.set("sessionId", sessionId);
95
+ popup.current = (0, _util.openPopup)(domainURLObj.toString());
96
+ const timer = setInterval(() => {
97
+ if (popup.current?.closed) {
98
+ clearInterval(timer);
99
+ handleCloseDialog();
100
+ }
101
+ }, 1e3);
102
+ return () => clearInterval(timer);
103
+ });
104
+ const sessionRequest = (0, _ahooks.useRequest)(async () => {
105
+ const {
106
+ data
107
+ } = await api.post("/payment/session", {
108
+ delegatee,
109
+ delegateePk
110
+ });
111
+ return handleCreatedSession({
112
+ sessionId: data.sessionId
113
+ });
114
+ }, {
115
+ manual: true,
116
+ debounceWait: 500,
117
+ debounceLeading: true,
118
+ debounceTrailing: false,
119
+ debounceMaxWait: 3e3,
120
+ refreshDeps: [],
121
+ onError(error) {
122
+ console.error(error);
123
+ }
124
+ });
125
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
126
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_Button.default, {
127
+ onClick: handleOpenDialog,
128
+ variant: "contained",
129
+ startIcon: /* @__PURE__ */(0, _jsxRuntime.jsx)(_ShoppingCart.default, {}),
130
+ ...props,
131
+ children: t("buy.button.title")
132
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_Dialog.default, {
133
+ fullWidth: true,
134
+ maxWidth: "xs",
135
+ open: state.currentState > 1 /* Prepare */ && state.currentState < 8 /* Completed */,
136
+ onClose: handleCloseDialog,
137
+ children: [!sessionRequest.error && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_Box.default, {
138
+ sx: {
139
+ display: "flex",
140
+ alignItems: "center",
141
+ flexDirection: "column",
142
+ gap: 2
143
+ },
144
+ children: [state.currentState === 2 /* InProgress */ && /* @__PURE__ */(0, _jsxRuntime.jsx)(_CircularProgress.default, {
145
+ size: 50
146
+ }), state.currentState === 4 /* Success */ && /* @__PURE__ */(0, _jsxRuntime.jsx)(_CheckCircle.default, {
147
+ sx: {
148
+ color: "primary.main",
149
+ fontSize: "5rem"
150
+ }
151
+ }), state.currentState === 2 /* InProgress */ && /* @__PURE__ */(0, _jsxRuntime.jsx)(_Typography.default, {
152
+ children: t("buy.status.inProgress")
153
+ }), state.currentState === 4 /* Success */ && /* @__PURE__ */(0, _jsxRuntime.jsx)(_Typography.default, {
154
+ children: t("buy.status.success")
155
+ })]
156
+ }), sessionRequest.error && /* @__PURE__ */(0, _jsxRuntime.jsx)(_Alert.default, {
157
+ severity: "error",
158
+ children: t("buy.error.failedToCreateSession")
159
+ })]
160
+ })]
161
+ });
162
+ }
163
+ Component.defaultProps = {
164
+ onSuccess: () => {}
165
+ };
166
+ function Buy(props) {
167
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_context.LocaleProvider, {
168
+ locale: props.locale,
169
+ translations: _locales.translations,
170
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(Component, {
171
+ ...props
172
+ })
173
+ });
174
+ }
175
+ Buy.defaultProps = {
176
+ onSuccess: () => {}
177
+ };
@@ -0,0 +1,11 @@
1
+ export declare function Domain({ nftDid, didDomainURL, locale, sx, }: {
2
+ nftDid: string;
3
+ didDomainURL: string;
4
+ locale: string;
5
+ sx?: any;
6
+ }): import("react").JSX.Element;
7
+ export declare namespace Domain {
8
+ var defaultProps: {
9
+ sx: {};
10
+ };
11
+ }
package/lib/domain.js ADDED
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Domain = Domain;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _context = require("@arcblock/ux/lib/Locale/context");
9
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
10
+ var _Popover = _interopRequireDefault(require("@mui/material/Popover"));
11
+ var _styles = require("@mui/material/styles");
12
+ var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
13
+ var _react = require("react");
14
+ var _useSetState = _interopRequireDefault(require("react-use/lib/useSetState"));
15
+ var _ufo = require("ufo");
16
+ var _util = require("./libs/util");
17
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
+ function Domain({
19
+ nftDid,
20
+ didDomainURL,
21
+ locale,
22
+ sx
23
+ }) {
24
+ const {
25
+ t
26
+ } = (0, _context.useLocaleContext)();
27
+ const [state, setState] = (0, _useSetState.default)({
28
+ safeIframeRef: null,
29
+ popoverAnchorEl: null
30
+ });
31
+ const iframeRef = (0, _react.useRef)(null);
32
+ const theme = (0, _styles.useTheme)();
33
+ const isMobile = (0, _useMediaQuery.default)(theme.breakpoints.down("md"));
34
+ const handlePopoverClick = event => {
35
+ setState({
36
+ popoverAnchorEl: event.currentTarget
37
+ });
38
+ };
39
+ const handlePopoverClose = () => {
40
+ setState({
41
+ popoverAnchorEl: null
42
+ });
43
+ };
44
+ const iframeSrc = (0, _ufo.joinURL)(didDomainURL, `/app/embed/domain?nft-did=${nftDid}&locale=${locale}`);
45
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
46
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_Box.default, {
47
+ component: "img",
48
+ src: (0, _ufo.joinURL)(didDomainURL, "/.well-known/service/blocklet/logo"),
49
+ alt: "logo",
50
+ width: 16,
51
+ height: 16,
52
+ onClick: handlePopoverClick,
53
+ sx: (0, _util.mergeSx)({
54
+ cursor: "pointer"
55
+ }, sx)
56
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_Popover.default, {
57
+ id: "popover-info",
58
+ open: Boolean(state.popoverAnchorEl),
59
+ anchorEl: state.popoverAnchorEl,
60
+ onClose: handlePopoverClose,
61
+ anchorOrigin: {
62
+ vertical: "bottom",
63
+ horizontal: "right"
64
+ },
65
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)("iframe", {
66
+ ref: iframeRef,
67
+ title: t("common.subscription"),
68
+ width: isMobile ? "320px" : "400px",
69
+ height: isMobile ? "600px" : "680px",
70
+ style: {
71
+ border: 0
72
+ },
73
+ src: iframeSrc
74
+ })
75
+ })]
76
+ });
77
+ }
78
+ Domain.defaultProps = {
79
+ sx: {}
80
+ };
package/lib/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import Buy from './buy';
2
+ import { Domain } from './domain';
3
+ export { translations } from './locales';
4
+ export { Buy, Domain };
package/lib/index.js ADDED
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Buy", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _buy.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "Domain", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _domain.Domain;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "translations", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _locales.translations;
22
+ }
23
+ });
24
+ var _buy = _interopRequireDefault(require("./buy"));
25
+ var _domain = require("./domain");
26
+ var _locales = require("./locales");
27
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -0,0 +1,3 @@
1
+ declare const axios: import("axios").AxiosInstance;
2
+ export declare const create: (...args: any) => import("axios").AxiosInstance;
3
+ export default axios;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = exports.create = void 0;
7
+ var _context = require("@arcblock/ux/lib/Locale/context");
8
+ var _jsSdk = require("@blocklet/js-sdk");
9
+ var _ufo = require("ufo");
10
+ const axios = (0, _jsSdk.createAxios)({});
11
+ axios.interceptors.request.use(config => {
12
+ const prefix = window.blocklet ? window.blocklet.prefix : "/";
13
+ config.baseURL = prefix || "";
14
+ config.url = (0, _ufo.joinURL)("/api", String(config.url));
15
+ config.timeout = 2e5;
16
+ config.params = config.params || {};
17
+ const searchParams = new URLSearchParams(config.url.split("?")[1]);
18
+ if (!searchParams.has("locale")) {
19
+ config.params.locale = (0, _context.getLocale)();
20
+ }
21
+ return config;
22
+ }, error => Promise.reject(error));
23
+ const create = (...args) => (0, _jsSdk.createAxios)(...args);
24
+ exports.create = create;
25
+ module.exports = axios;
@@ -0,0 +1,21 @@
1
+ export declare const SEARCH_BUTTON_WIDTH = 120;
2
+ export declare const COMMON_REQUEST_OPTIONS: {
3
+ debounceWait: number;
4
+ debounceLeading: boolean;
5
+ debounceTrailing: boolean;
6
+ debounceMaxWait: number;
7
+ };
8
+ export declare const formatLocale: (locale?: string) => string;
9
+ export declare const formatError: (err: any, t: any) => any;
10
+ export declare const mergeSx: (initial: any, sx: any) => any;
11
+ export declare const getChainHost: () => any;
12
+ /**
13
+ *
14
+ * @param {string} url - 打开一个弹窗
15
+ * @returns
16
+ */
17
+ export declare const openPopup: (url: string, { width, height, name }?: {
18
+ width?: number | undefined;
19
+ height?: number | undefined;
20
+ name?: string | undefined;
21
+ }) => Window;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.openPopup = exports.mergeSx = exports.getChainHost = exports.formatLocale = exports.formatError = exports.SEARCH_BUTTON_WIDTH = exports.COMMON_REQUEST_OPTIONS = void 0;
7
+ var _ufo = require("ufo");
8
+ const SEARCH_BUTTON_WIDTH = exports.SEARCH_BUTTON_WIDTH = 120;
9
+ const COMMON_REQUEST_OPTIONS = exports.COMMON_REQUEST_OPTIONS = {
10
+ debounceWait: 500,
11
+ debounceLeading: true,
12
+ debounceTrailing: false,
13
+ debounceMaxWait: 3e3
14
+ };
15
+ const formatLocale = (locale = "en") => {
16
+ if (locale === "tw") {
17
+ return "zh";
18
+ }
19
+ return locale;
20
+ };
21
+ exports.formatLocale = formatLocale;
22
+ const formatError = (err, t) => {
23
+ const {
24
+ errors,
25
+ response
26
+ } = err;
27
+ if (Array.isArray(errors)) {
28
+ return errors.map(x => x.message).join("\n");
29
+ }
30
+ const joiError = err.response?.data?.error;
31
+ if (Array.isArray(joiError?.details)) {
32
+ const formatted = joiError?.details.map(e => {
33
+ const errorMessage = e.message.replace(/["]/g, "'");
34
+ const errorPath = e.path.join(".");
35
+ return `${errorPath}: ${errorMessage}`;
36
+ });
37
+ return `Validate failed: ${formatted.join(";")}`;
38
+ }
39
+ if (response?.data?.code) {
40
+ return t(`error.${response?.data?.code}`);
41
+ }
42
+ if (response?.data?.message) {
43
+ return response.data.message;
44
+ }
45
+ if (response) {
46
+ return `Request failed: ${response.status} ${response.statusText}: ${JSON.stringify(response.data)}`;
47
+ }
48
+ return err.message;
49
+ };
50
+ exports.formatError = formatError;
51
+ const mergeSx = (initial, sx) => {
52
+ if (!sx) {
53
+ return initial;
54
+ }
55
+ if (!initial) {
56
+ return sx;
57
+ }
58
+ return [initial, ...(Array.isArray(sx) ? sx : [sx])];
59
+ };
60
+ exports.mergeSx = mergeSx;
61
+ const getChainHost = () => window.blocklet?.preferences?.chainHost || "";
62
+ exports.getChainHost = getChainHost;
63
+ const openPopup = (url, {
64
+ width = 600,
65
+ height = 700,
66
+ name = "did-domain:popup"
67
+ } = {}) => {
68
+ const left = window.screenX + (window.innerWidth - width) / 2;
69
+ const top = window.screenY + (window.innerHeight - height) / 2;
70
+ const windowFeatures = [`left=${left}`, `top=${top}`, `width=${width}`, `height=${height}`, "resizable=no",
71
+ // not working
72
+ "scrollbars=yes", "status=yes", "popup=yes"];
73
+ const popup = window.open("", name, windowFeatures.join(","));
74
+ if (popup === null) {
75
+ throw new Error("Failed to open popup");
76
+ }
77
+ popup.location.href = (0, _ufo.withQuery)(url, {
78
+ // NOTICE: 携带当前页面的 origin,用于在 popup 中通过该参数判断是否可以发送 postMessage,即使该参数被伪造,最终也只有该域名能接收到消息,所以没有关系
79
+ opener: window.location.origin
80
+ });
81
+ return popup;
82
+ };
83
+ exports.openPopup = openPopup;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _flat = _interopRequireDefault(require("flat"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ module.exports = (0, _flat.default)({
10
+ buy: {
11
+ button: {
12
+ title: "Buy DID Domain"
13
+ },
14
+ status: {
15
+ inProgress: "Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",
16
+ success: "Purchase completed!"
17
+ },
18
+ error: {
19
+ failedToCreateSession: "Failed to create session"
20
+ }
21
+ }
22
+ });
@@ -0,0 +1,4 @@
1
+ export declare const translations: {
2
+ zh: any;
3
+ en: any;
4
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.translations = void 0;
7
+ var _en = _interopRequireDefault(require("./en"));
8
+ var _zh = _interopRequireDefault(require("./zh"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ const translations = exports.translations = {
11
+ zh: _zh.default,
12
+ en: _en.default
13
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _flat = _interopRequireDefault(require("flat"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ module.exports = (0, _flat.default)({
10
+ buy: {
11
+ button: {
12
+ title: "\u8D2D\u4E70 DID \u57DF\u540D"
13
+ },
14
+ status: {
15
+ inProgress: "\u8BF7\u7A0D\u7B49\uFF0C\u6211\u4EEC\u6B63\u5728\u5904\u7406\u60A8\u7684\u8BF7\u6C42\uFF0C\u8D2D\u4E70\u57DF\u540D\u540E\u4F1A\u81EA\u52A8\u89E3\u6790\u5230\u5F53\u524D\u7684\u5E94\u7528...",
16
+ success: "\u8D2D\u4E70\u5B8C\u6210\uFF01"
17
+ },
18
+ error: {
19
+ failedToCreateSession: "\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25"
20
+ }
21
+ }
22
+ });
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,15 @@
1
+ declare module '@arcblock/ux/*';
2
+
3
+ declare module '@arcblock/did-connect/*';
4
+
5
+ declare module '*.png';
6
+
7
+ declare module 'flat';
8
+
9
+ declare module '@arcblock/*';
10
+
11
+ declare module '@blocklet/*';
12
+
13
+ declare module 'pretty-ms-i18n';
14
+
15
+ declare var blocklet: import('@blocklet/sdk').WindowBlocklet;
package/package.json ADDED
@@ -0,0 +1,106 @@
1
+ {
2
+ "name": "@blocklet/did-domain-react",
3
+ "version": "0.3.39",
4
+ "description": "Reusable react components for DID Domain",
5
+ "keywords": [
6
+ "react",
7
+ "domain"
8
+ ],
9
+ "author": "zhenqiang<zhenqiang@arcblock.io>",
10
+ "homepage": "https://github.com/blocklet/did-services#readme",
11
+ "license": "Apache-2.0",
12
+ "main": "lib/index.js",
13
+ "module": "es/index.js",
14
+ "private": false,
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/blocklet/did-services.git"
18
+ },
19
+ "scripts": {
20
+ "lint": "tsc --noEmit && eslint src --ext js --ext jsx --ext ts --ext tsx",
21
+ "lint:fix": "npm run lint -- --fix",
22
+ "build": "tsc --noEmit && unbuild && node tools/auto-exports.js && npm run cpfiles",
23
+ "watch": "CONSOLA_LEVEL=1 nodemon -e .jsx,.js,.ts,.tsx -w src -x 'yalc publish --push'",
24
+ "precommit": "CI=1 npm run lint",
25
+ "prepush": "CI=1 npm run lint",
26
+ "prepublish": "npm run build",
27
+ "test": "node tools/jest.js",
28
+ "coverage": "npm run test -- --coverage",
29
+ "storybook": "storybook dev -p 6006",
30
+ "build-storybook": "storybook build",
31
+ "cpfiles": "copyfiles -u 1 './src/**/*.css' lib/ && copyfiles -u 1 './src/**/*.css' es/"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/blocklet/did-services/issues"
35
+ },
36
+ "exports": {
37
+ ".": {
38
+ "import": "./es/index.js",
39
+ "require": "./lib/index.js"
40
+ },
41
+ "./lib/": {
42
+ "import": "./es/",
43
+ "require": "./lib/"
44
+ }
45
+ },
46
+ "importSort": {
47
+ ".js, .jsx, .mjs": {
48
+ "parser": "babylon",
49
+ "style": "module"
50
+ },
51
+ ".ts, .tsx": {
52
+ "style": "module",
53
+ "parser": "typescript"
54
+ }
55
+ },
56
+ "dependencies": {
57
+ "@arcblock/did-connect": "^2.10.69",
58
+ "@arcblock/ux": "^2.10.68",
59
+ "@blocklet/js-sdk": "^1.16.33",
60
+ "@mui/icons-material": "^5.16.7",
61
+ "@mui/lab": "^5.0.0-alpha.173",
62
+ "@mui/material": "^5.16.7",
63
+ "@mui/system": "^5.16.7",
64
+ "ahooks": "^3.8.1",
65
+ "axios": "^1.7.8",
66
+ "flat": "^5.0.2",
67
+ "lodash": "^4.17.21",
68
+ "react-error-boundary": "^4.1.2",
69
+ "react-use": "^17.5.1",
70
+ "ufo": "^1.5.4"
71
+ },
72
+ "peerDependencies": {
73
+ "react": ">=18.1.0"
74
+ },
75
+ "publishConfig": {
76
+ "access": "public"
77
+ },
78
+ "devDependencies": {
79
+ "@arcblock/eslint-config-ts": "^0.3.3",
80
+ "@babel/cli": "^7.25.9",
81
+ "@babel/core": "^7.26.0",
82
+ "@babel/preset-env": "^7.26.0",
83
+ "@babel/preset-react": "^7.25.9",
84
+ "@types/react": "^18.3.12",
85
+ "@types/react-dom": "^18.3.1",
86
+ "@vitejs/plugin-legacy": "^5.4.3",
87
+ "copyfiles": "^2.4.1",
88
+ "eslint": "^8.57.1",
89
+ "glob": "^10.4.5",
90
+ "import-sort-style-module": "^6.0.0",
91
+ "jest": "^29.7.0",
92
+ "prettier": "^3.3.3",
93
+ "prettier-plugin-import-sort": "^0.0.7",
94
+ "react": "18.2.0",
95
+ "react-dom": "18.2.0",
96
+ "rollup-plugin-node-builtins": "^2.1.2",
97
+ "storybook": "^7.6.20",
98
+ "ts-jest": "^29.2.5",
99
+ "type-fest": "^4.28.0",
100
+ "typescript": "^4.9.5",
101
+ "unbuild": "^2.0.0",
102
+ "vite-plugin-babel": "^1.2.0",
103
+ "vite-plugin-node-polyfills": "^0.21.0"
104
+ },
105
+ "gitHead": "55d08a148486bcc6edac3080778b0654cba171d9"
106
+ }