@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/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2018-2024 ArcBlock
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # DID Domain React Components
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ presets: [
3
+ ['@babel/preset-env', { modules: false, targets: 'chrome 114' }],
4
+ ['@babel/preset-react', { useBuiltIns: true, runtime: 'automatic' }],
5
+ ],
6
+ plugins: ['babel-plugin-inline-react-svg'],
7
+ ignore: ['src/**/*.stories.js', 'src/**/demo'],
8
+ };
@@ -0,0 +1,29 @@
1
+ import { defineBuildConfig, BuildEntry } from 'unbuild';
2
+
3
+ const pattern = ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '**/*.png', '!**/*.stories.js', '!**/demo'];
4
+
5
+ const shared: BuildEntry = {
6
+ builder: 'mkdist',
7
+ input: './src',
8
+ pattern,
9
+ ext: 'js',
10
+ esbuild: {
11
+ jsx: 'automatic',
12
+ },
13
+ declaration: true,
14
+ };
15
+ export default defineBuildConfig({
16
+ failOnWarn: false,
17
+ entries: [
18
+ {
19
+ ...shared,
20
+ outDir: './es',
21
+ format: 'esm',
22
+ },
23
+ {
24
+ ...shared,
25
+ outDir: './lib',
26
+ format: 'cjs',
27
+ },
28
+ ],
29
+ });
package/env.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ declare var blocklet: { appName: string; prefix: string; preferences: any; componentMountPoints: any[] };
2
+
3
+ declare module '*.svg';
4
+
5
+ declare module 'flat';
6
+
7
+ declare module '@arcblock/*';
8
+
9
+ declare module '@did-services/util/*';
10
+
11
+ declare module 'pretty-ms-i18n';
12
+
13
+ declare module '@abtnode/util/*';
14
+
15
+ declare module '@abtnode/cron';
16
+
17
+ declare module 'tlds2';
package/es/buy.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import type { Locale } from '@arcblock/ux/lib/type';
2
+ interface Props {
3
+ delegatee: string;
4
+ delegateePk: string;
5
+ didDomainURL: string;
6
+ locale: Locale;
7
+ onSuccess?: (data: {
8
+ nftDid: string;
9
+ domain: string;
10
+ chainHost: string;
11
+ }) => void;
12
+ }
13
+ declare function Buy(props: Props): import("react").JSX.Element;
14
+ declare namespace Buy {
15
+ var defaultProps: {
16
+ onSuccess: () => void;
17
+ };
18
+ }
19
+ export default Buy;
package/es/buy.js ADDED
@@ -0,0 +1,124 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import Button from "@arcblock/ux/lib/Button";
3
+ import Dialog from "@arcblock/ux/lib/Dialog";
4
+ import { LocaleProvider, useLocaleContext } from "@arcblock/ux/lib/Locale/context";
5
+ import CheckCircle from "@mui/icons-material/CheckCircle";
6
+ import ShoppingCart from "@mui/icons-material/ShoppingCart";
7
+ import Alert from "@mui/material/Alert";
8
+ import Box from "@mui/material/Box";
9
+ import CircularProgress from "@mui/material/CircularProgress";
10
+ import Typography from "@mui/material/Typography";
11
+ import { useRequest as useAHooksRequest, useMemoizedFn, useSetState, useUnmount } from "ahooks";
12
+ import { useRef } from "react";
13
+ import { joinURL } from "ufo";
14
+ import { create } from "./libs/api.js";
15
+ import { openPopup } from "./libs/util.js";
16
+ import { translations } from "./locales/index.js";
17
+ var BuyState = /* @__PURE__ */ ((BuyState2) => {
18
+ BuyState2[BuyState2["Prepare"] = 1] = "Prepare";
19
+ BuyState2[BuyState2["InProgress"] = 2] = "InProgress";
20
+ BuyState2[BuyState2["Success"] = 4] = "Success";
21
+ BuyState2[BuyState2["Completed"] = 8] = "Completed";
22
+ return BuyState2;
23
+ })(BuyState || {});
24
+ function Component({ delegatee, delegateePk, didDomainURL, locale, onSuccess, ...props }) {
25
+ const { t } = useLocaleContext();
26
+ const [state, setState] = useSetState({
27
+ currentState: 1 /* Prepare */
28
+ });
29
+ const popup = useRef(null);
30
+ const domainURLObj = new URL(didDomainURL);
31
+ domainURLObj.searchParams.set("locale", locale);
32
+ const api = useMemoizedFn(() => create({ baseURL: joinURL(domainURLObj.origin, domainURLObj.pathname, "api") }))();
33
+ const onMessage = useMemoizedFn((event) => {
34
+ if (event.data.type === "didDomain.success") {
35
+ onSuccess?.({ nftDid: event.data?.nftDid, domain: event.data?.domain, chainHost: event.data?.chainHost });
36
+ popup.current?.close();
37
+ popup.current = null;
38
+ setState({ currentState: 4 /* Success */ });
39
+ setTimeout(() => {
40
+ setState({ currentState: 8 /* Completed */ });
41
+ }, 2e3);
42
+ }
43
+ });
44
+ useUnmount(() => {
45
+ try {
46
+ window.removeEventListener("message", onMessage);
47
+ popup.current?.close();
48
+ popup.current = null;
49
+ } catch (error) {
50
+ console.warn("Failed to close popup", error);
51
+ }
52
+ });
53
+ const handleCloseDialog = useMemoizedFn(() => {
54
+ setState({ currentState: 1 /* Prepare */ });
55
+ });
56
+ const handleOpenDialog = useMemoizedFn(() => {
57
+ setState({ currentState: 2 /* InProgress */ });
58
+ sessionRequest.run();
59
+ });
60
+ const handleCreatedSession = useMemoizedFn(({ sessionId }) => {
61
+ window.addEventListener("message", onMessage);
62
+ domainURLObj.searchParams.set("sessionId", sessionId);
63
+ popup.current = openPopup(domainURLObj.toString());
64
+ const timer = setInterval(() => {
65
+ if (popup.current?.closed) {
66
+ clearInterval(timer);
67
+ handleCloseDialog();
68
+ }
69
+ }, 1e3);
70
+ return () => clearInterval(timer);
71
+ });
72
+ const sessionRequest = useAHooksRequest(
73
+ async () => {
74
+ const { data } = await api.post("/payment/session", {
75
+ delegatee,
76
+ delegateePk
77
+ });
78
+ return handleCreatedSession({ sessionId: data.sessionId });
79
+ },
80
+ {
81
+ manual: true,
82
+ debounceWait: 500,
83
+ debounceLeading: true,
84
+ debounceTrailing: false,
85
+ debounceMaxWait: 3e3,
86
+ refreshDeps: [],
87
+ onError(error) {
88
+ console.error(error);
89
+ }
90
+ }
91
+ );
92
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
93
+ /* @__PURE__ */ jsx(Button, { onClick: handleOpenDialog, variant: "contained", startIcon: /* @__PURE__ */ jsx(ShoppingCart, {}), ...props, children: t("buy.button.title") }),
94
+ /* @__PURE__ */ jsxs(
95
+ Dialog,
96
+ {
97
+ fullWidth: true,
98
+ maxWidth: "xs",
99
+ open: state.currentState > 1 /* Prepare */ && state.currentState < 8 /* Completed */,
100
+ onClose: handleCloseDialog,
101
+ children: [
102
+ !sessionRequest.error && /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", flexDirection: "column", gap: 2 }, children: [
103
+ state.currentState === 2 /* InProgress */ && /* @__PURE__ */ jsx(CircularProgress, { size: 50 }),
104
+ state.currentState === 4 /* Success */ && /* @__PURE__ */ jsx(CheckCircle, { sx: { color: "primary.main", fontSize: "5rem" } }),
105
+ state.currentState === 2 /* InProgress */ && /* @__PURE__ */ jsx(Typography, { children: t("buy.status.inProgress") }),
106
+ state.currentState === 4 /* Success */ && /* @__PURE__ */ jsx(Typography, { children: t("buy.status.success") })
107
+ ] }),
108
+ sessionRequest.error && /* @__PURE__ */ jsx(Alert, { severity: "error", children: t("buy.error.failedToCreateSession") })
109
+ ]
110
+ }
111
+ )
112
+ ] });
113
+ }
114
+ Component.defaultProps = {
115
+ onSuccess: () => {
116
+ }
117
+ };
118
+ export default function Buy(props) {
119
+ return /* @__PURE__ */ jsx(LocaleProvider, { locale: props.locale, translations, children: /* @__PURE__ */ jsx(Component, { ...props }) });
120
+ }
121
+ Buy.defaultProps = {
122
+ onSuccess: () => {
123
+ }
124
+ };
package/es/domain.d.ts ADDED
@@ -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/es/domain.js ADDED
@@ -0,0 +1,73 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
3
+ import Box from "@mui/material/Box";
4
+ import Popover from "@mui/material/Popover";
5
+ import { useTheme } from "@mui/material/styles";
6
+ import useMediaQuery from "@mui/material/useMediaQuery";
7
+ import { useRef } from "react";
8
+ import useSetState from "react-use/lib/useSetState";
9
+ import { joinURL } from "ufo";
10
+ import { mergeSx } from "./libs/util.js";
11
+ export function Domain({
12
+ nftDid,
13
+ didDomainURL,
14
+ locale,
15
+ sx
16
+ }) {
17
+ const { t } = useLocaleContext();
18
+ const [state, setState] = useSetState({
19
+ safeIframeRef: null,
20
+ popoverAnchorEl: null
21
+ });
22
+ const iframeRef = useRef(null);
23
+ const theme = useTheme();
24
+ const isMobile = useMediaQuery(theme.breakpoints.down("md"));
25
+ const handlePopoverClick = (event) => {
26
+ setState({ popoverAnchorEl: event.currentTarget });
27
+ };
28
+ const handlePopoverClose = () => {
29
+ setState({ popoverAnchorEl: null });
30
+ };
31
+ const iframeSrc = joinURL(didDomainURL, `/app/embed/domain?nft-did=${nftDid}&locale=${locale}`);
32
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
33
+ /* @__PURE__ */ jsx(
34
+ Box,
35
+ {
36
+ component: "img",
37
+ src: joinURL(didDomainURL, "/.well-known/service/blocklet/logo"),
38
+ alt: "logo",
39
+ width: 16,
40
+ height: 16,
41
+ onClick: handlePopoverClick,
42
+ sx: mergeSx({ cursor: "pointer" }, sx)
43
+ }
44
+ ),
45
+ /* @__PURE__ */ jsx(
46
+ Popover,
47
+ {
48
+ id: "popover-info",
49
+ open: Boolean(state.popoverAnchorEl),
50
+ anchorEl: state.popoverAnchorEl,
51
+ onClose: handlePopoverClose,
52
+ anchorOrigin: {
53
+ vertical: "bottom",
54
+ horizontal: "right"
55
+ },
56
+ children: /* @__PURE__ */ jsx(
57
+ "iframe",
58
+ {
59
+ ref: iframeRef,
60
+ title: t("common.subscription"),
61
+ width: isMobile ? "320px" : "400px",
62
+ height: isMobile ? "600px" : "680px",
63
+ style: { border: 0 },
64
+ src: iframeSrc
65
+ }
66
+ )
67
+ }
68
+ )
69
+ ] });
70
+ }
71
+ Domain.defaultProps = {
72
+ sx: {}
73
+ };
package/es/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/es/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import Buy from "./buy.js";
2
+ import { Domain } from "./domain.js";
3
+ export { translations } from "./locales/index.js";
4
+ export { Buy, Domain };
@@ -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;
package/es/libs/api.js ADDED
@@ -0,0 +1,21 @@
1
+ import { getLocale } from "@arcblock/ux/lib/Locale/context";
2
+ import { createAxios } from "@blocklet/js-sdk";
3
+ import { joinURL } from "ufo";
4
+ const axios = createAxios({});
5
+ axios.interceptors.request.use(
6
+ (config) => {
7
+ const prefix = window.blocklet ? window.blocklet.prefix : "/";
8
+ config.baseURL = prefix || "";
9
+ config.url = joinURL("/api", String(config.url));
10
+ config.timeout = 2e5;
11
+ config.params = config.params || {};
12
+ const searchParams = new URLSearchParams(config.url.split("?")[1]);
13
+ if (!searchParams.has("locale")) {
14
+ config.params.locale = getLocale();
15
+ }
16
+ return config;
17
+ },
18
+ (error) => Promise.reject(error)
19
+ );
20
+ export const create = (...args) => createAxios(...args);
21
+ export default 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,73 @@
1
+ import { withQuery } from "ufo";
2
+ export const SEARCH_BUTTON_WIDTH = 120;
3
+ export const COMMON_REQUEST_OPTIONS = {
4
+ debounceWait: 500,
5
+ debounceLeading: true,
6
+ debounceTrailing: false,
7
+ debounceMaxWait: 3e3
8
+ };
9
+ export const formatLocale = (locale = "en") => {
10
+ if (locale === "tw") {
11
+ return "zh";
12
+ }
13
+ return locale;
14
+ };
15
+ export const formatError = (err, t) => {
16
+ const { errors, response } = err;
17
+ if (Array.isArray(errors)) {
18
+ return errors.map((x) => x.message).join("\n");
19
+ }
20
+ const joiError = err.response?.data?.error;
21
+ if (Array.isArray(joiError?.details)) {
22
+ const formatted = joiError?.details.map((e) => {
23
+ const errorMessage = e.message.replace(/["]/g, "'");
24
+ const errorPath = e.path.join(".");
25
+ return `${errorPath}: ${errorMessage}`;
26
+ });
27
+ return `Validate failed: ${formatted.join(";")}`;
28
+ }
29
+ if (response?.data?.code) {
30
+ return t(`error.${response?.data?.code}`);
31
+ }
32
+ if (response?.data?.message) {
33
+ return response.data.message;
34
+ }
35
+ if (response) {
36
+ return `Request failed: ${response.status} ${response.statusText}: ${JSON.stringify(response.data)}`;
37
+ }
38
+ return err.message;
39
+ };
40
+ export const mergeSx = (initial, sx) => {
41
+ if (!sx) {
42
+ return initial;
43
+ }
44
+ if (!initial) {
45
+ return sx;
46
+ }
47
+ return [initial, ...Array.isArray(sx) ? sx : [sx]];
48
+ };
49
+ export const getChainHost = () => window.blocklet?.preferences?.chainHost || "";
50
+ export const openPopup = (url, { width = 600, height = 700, name = "did-domain:popup" } = {}) => {
51
+ const left = window.screenX + (window.innerWidth - width) / 2;
52
+ const top = window.screenY + (window.innerHeight - height) / 2;
53
+ const windowFeatures = [
54
+ `left=${left}`,
55
+ `top=${top}`,
56
+ `width=${width}`,
57
+ `height=${height}`,
58
+ "resizable=no",
59
+ // not working
60
+ "scrollbars=yes",
61
+ "status=yes",
62
+ "popup=yes"
63
+ ];
64
+ const popup = window.open("", name, windowFeatures.join(","));
65
+ if (popup === null) {
66
+ throw new Error("Failed to open popup");
67
+ }
68
+ popup.location.href = withQuery(url, {
69
+ // NOTICE: 携带当前页面的 origin,用于在 popup 中通过该参数判断是否可以发送 postMessage,即使该参数被伪造,最终也只有该域名能接收到消息,所以没有关系
70
+ opener: window.location.origin
71
+ });
72
+ return popup;
73
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import flat from "flat";
2
+ export default flat({
3
+ buy: {
4
+ button: {
5
+ title: "Buy DID Domain"
6
+ },
7
+ status: {
8
+ inProgress: "Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",
9
+ success: "Purchase completed!"
10
+ },
11
+ error: {
12
+ failedToCreateSession: "Failed to create session"
13
+ }
14
+ }
15
+ });
@@ -0,0 +1,4 @@
1
+ export declare const translations: {
2
+ zh: any;
3
+ en: any;
4
+ };
@@ -0,0 +1,6 @@
1
+ import en from "./en.js";
2
+ import zh from "./zh.js";
3
+ export const translations = {
4
+ zh,
5
+ en
6
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import flat from "flat";
2
+ export default flat({
3
+ buy: {
4
+ button: {
5
+ title: "\u8D2D\u4E70 DID \u57DF\u540D"
6
+ },
7
+ status: {
8
+ 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...",
9
+ success: "\u8D2D\u4E70\u5B8C\u6210\uFF01"
10
+ },
11
+ error: {
12
+ failedToCreateSession: "\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25"
13
+ }
14
+ }
15
+ });
File without changes
File without changes
@@ -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/global.d.ts ADDED
@@ -0,0 +1,54 @@
1
+ declare type TDPriceRecurring = {
2
+ interval: string;
3
+ interval_count: string;
4
+ };
5
+
6
+ declare type TDProduct = {
7
+ id: string;
8
+ domainSuffix: string;
9
+ };
10
+
11
+ declare type TDPrice = {
12
+ id: string;
13
+ value: string;
14
+ symbol: string;
15
+ recurring: TPriceRecurring;
16
+ currency?: TCurrency;
17
+ };
18
+
19
+ declare type TFreeTrial = {
20
+ id: string;
21
+ trialEnd: number;
22
+ duration: number;
23
+ maxPerUser: number | Infinity;
24
+ };
25
+
26
+ declare type TDSearchedProduct = {
27
+ id: string;
28
+ type: string;
29
+ domain: string;
30
+ domainPrefix: string;
31
+ domainSuffix: string;
32
+ takenBy: string;
33
+ price: TDPrice;
34
+ originalKeyword: string;
35
+ freeTrail?: TFreeTrial;
36
+ nftDid?: string;
37
+ };
38
+
39
+ declare type TDProducts = TDProduct[];
40
+
41
+ declare type TDSearchedProducts = TDSearchedProduct[];
42
+
43
+ declare type TDExplorerAssetType = 'accounts' | 'assets' | 'txs';
44
+
45
+ declare type TUserDid = string | undefined;
46
+
47
+ declare type TRecord = {
48
+ id: string;
49
+ name: string;
50
+ type: string;
51
+ value: string;
52
+ ttl: number;
53
+ category: string;
54
+ };
package/lib/buy.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import type { Locale } from '@arcblock/ux/lib/type';
2
+ interface Props {
3
+ delegatee: string;
4
+ delegateePk: string;
5
+ didDomainURL: string;
6
+ locale: Locale;
7
+ onSuccess?: (data: {
8
+ nftDid: string;
9
+ domain: string;
10
+ chainHost: string;
11
+ }) => void;
12
+ }
13
+ declare function Buy(props: Props): import("react").JSX.Element;
14
+ declare namespace Buy {
15
+ var defaultProps: {
16
+ onSuccess: () => void;
17
+ };
18
+ }
19
+ export default Buy;