best-unit 1.0.7 → 1.0.8
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.
- package/package.json +2 -2
- package/src/api/axiosInstance.ts +2 -2
- package/src/components/business/recharge-sdk/components/Button.tsx +1 -1
- package/src/components/business/recharge-sdk/components/OfflineTransferForm.tsx +6 -6
- package/src/components/business/recharge-sdk/components/OnlineRechargeForm.tsx +4 -4
- package/src/components/business/recharge-sdk/components/Recharge.tsx +2 -2
- package/src/components/business/recharge-sdk/index.tsx +2 -2
- package/src/components/business/statistical-balance/index.tsx +4 -4
- package/src/components/common/HoverPopover.tsx +1 -1
- package/src/components/common/Select.tsx +2 -2
- package/src/components/common/Upload.tsx +4 -4
- package/src/demo/App.tsx +6 -6
- package/src/local/index.ts +1 -1
- package/src/main.ts +5 -5
- package/src/utils/business/index.ts +3 -3
- package/src/vite-env.d.ts +7 -0
- package/tsconfig.app.json +2 -0
- package/vite.config.ts +6 -0
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "best-unit",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/best-unit.cjs",
|
|
7
7
|
"module": "dist/best-unit.js",
|
|
8
8
|
"types": "dist/types/global.d.ts",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"dev": "vite",
|
|
11
|
-
"build": "tsc
|
|
11
|
+
"build": "tsc --noEmit && vite build && cp -r src/types dist/types",
|
|
12
12
|
"prepublishOnly": "npm version patch --no-git-tag-version",
|
|
13
13
|
"preview": "vite preview"
|
|
14
14
|
},
|
package/src/api/axiosInstance.ts
CHANGED
|
@@ -4,8 +4,8 @@ import type {
|
|
|
4
4
|
AxiosResponse,
|
|
5
5
|
InternalAxiosRequestConfig,
|
|
6
6
|
} from "axios";
|
|
7
|
-
import { message } from "
|
|
8
|
-
import { Env, Locale } from "
|
|
7
|
+
import { message } from "@/components/common/Message";
|
|
8
|
+
import { Env, Locale } from "@/types";
|
|
9
9
|
|
|
10
10
|
export interface CreateAxiosOptions {
|
|
11
11
|
baseURL?: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FunctionalComponent } from "preact";
|
|
2
|
-
import { Upload } from "
|
|
3
|
-
import { createOfflineRecharge } from "
|
|
4
|
-
import { message } from "
|
|
5
|
-
import { t } from "
|
|
6
|
-
import { Theme } from "
|
|
7
|
-
import { Select } from "
|
|
2
|
+
import { Upload } from "@/components/common/Upload";
|
|
3
|
+
import { createOfflineRecharge } from "@/api";
|
|
4
|
+
import { message } from "@/components/common/Message";
|
|
5
|
+
import { t } from "@/local";
|
|
6
|
+
import { Theme } from "@/types";
|
|
7
|
+
import { Select } from "@/components/common/Select";
|
|
8
8
|
|
|
9
9
|
interface OfflineTransferFormProps {
|
|
10
10
|
formState: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { FunctionalComponent } from "preact";
|
|
2
2
|
import { useState, useEffect } from "preact/hooks";
|
|
3
|
-
import { t } from "
|
|
4
|
-
import { Theme } from "
|
|
5
|
-
import { Select } from "
|
|
6
|
-
import { calcPaymentAmount } from "
|
|
3
|
+
import { t } from "@/local";
|
|
4
|
+
import { Theme } from "@/types";
|
|
5
|
+
import { Select } from "@/components/common/Select";
|
|
6
|
+
import { calcPaymentAmount } from "@/api";
|
|
7
7
|
|
|
8
8
|
interface OnlineRechargeFormProps {
|
|
9
9
|
formState: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useState, useEffect } from "preact/hooks";
|
|
2
2
|
import { OnlineRechargeForm } from "./OnlineRechargeForm";
|
|
3
3
|
import { OfflineTransferForm } from "./OfflineTransferForm";
|
|
4
|
-
import { t } from "
|
|
5
|
-
import { Theme } from "
|
|
4
|
+
import { t } from "@/local";
|
|
5
|
+
import { Theme } from "@/types";
|
|
6
6
|
|
|
7
7
|
interface ModalFormProps {
|
|
8
8
|
visible: boolean;
|
|
@@ -2,8 +2,8 @@ import { useState } from "preact/hooks";
|
|
|
2
2
|
import { ThemedButton } from "./components/Button";
|
|
3
3
|
import { Recharge } from "./components/Recharge";
|
|
4
4
|
import register from "preact-custom-element";
|
|
5
|
-
import { createOnlineRecharge } from "
|
|
6
|
-
import { t } from "
|
|
5
|
+
import { createOnlineRecharge } from "@/api";
|
|
6
|
+
import { t } from "@/local";
|
|
7
7
|
|
|
8
8
|
export function BestUnit() {
|
|
9
9
|
const [visible, setVisible] = useState(false);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useState, useEffect } from "preact/hooks";
|
|
2
|
-
import HoverPopover, { type PopoverPosition } from "
|
|
3
|
-
import { getBalance } from "
|
|
4
|
-
import { t } from "
|
|
2
|
+
import HoverPopover, { type PopoverPosition } from "@/components/common/HoverPopover";
|
|
3
|
+
import { getBalance } from "@/api";
|
|
4
|
+
import { t } from "@/local";
|
|
5
5
|
import register from "preact-custom-element";
|
|
6
|
-
import { Theme } from "
|
|
6
|
+
import { Theme } from "@/types";
|
|
7
7
|
|
|
8
8
|
function formatNumber(num: number) {
|
|
9
9
|
return num.toLocaleString("en-US", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useRef } from "preact/hooks";
|
|
2
2
|
import type { FunctionalComponent, JSX } from "preact";
|
|
3
|
-
import { Theme } from "
|
|
3
|
+
import { Theme } from "@/types";
|
|
4
4
|
|
|
5
5
|
export type PopoverPosition = "top" | "bottom" | "leftTop" | "rightTop";
|
|
6
6
|
interface HoverPopoverProps {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FunctionalComponent, JSX } from "preact";
|
|
2
2
|
import { useState, useRef, useEffect } from "preact/hooks";
|
|
3
|
-
import { Theme } from "
|
|
4
|
-
import { t } from "
|
|
3
|
+
import { Theme } from "@/types";
|
|
4
|
+
import { t } from "@/local";
|
|
5
5
|
|
|
6
6
|
interface Option {
|
|
7
7
|
value: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FunctionalComponent } from "preact";
|
|
2
|
-
import {
|
|
3
|
-
import { uploadFile } from "
|
|
4
|
-
import { t } from "
|
|
5
|
-
import { Theme } from "
|
|
2
|
+
import { useState, useRef } from "preact/hooks";
|
|
3
|
+
import { uploadFile } from "@/api";
|
|
4
|
+
import { t } from "@/local";
|
|
5
|
+
import { Theme } from "@/types";
|
|
6
6
|
|
|
7
7
|
interface UploadProps {
|
|
8
8
|
value?: string[];
|
package/src/demo/App.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useState } from "preact/hooks";
|
|
2
|
-
import { npmTest, printCurrentTime } from "
|
|
3
|
-
import { BestUnit } from "
|
|
4
|
-
import { initFundUnit } from "
|
|
5
|
-
import StatisticalBalance from "
|
|
6
|
-
import { t } from "
|
|
7
|
-
import { Env, Locale, Theme } from "
|
|
2
|
+
import { npmTest, printCurrentTime } from "@/main";
|
|
3
|
+
import { BestUnit } from "@/components/business/recharge-sdk";
|
|
4
|
+
import { initFundUnit } from "@/main";
|
|
5
|
+
import StatisticalBalance from "@/components/business/statistical-balance";
|
|
6
|
+
import { t } from "@/local";
|
|
7
|
+
import { Env, Locale, Theme } from "@/types";
|
|
8
8
|
|
|
9
9
|
export default function DemoApp() {
|
|
10
10
|
const [currentLocale, setCurrentLocale] = useState<Locale>(Locale.ZH);
|
package/src/local/index.ts
CHANGED
package/src/main.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { npmTest, printCurrentTime } from "
|
|
2
|
-
import { initFundUnit } from "
|
|
3
|
-
import { viteProxy } from "
|
|
1
|
+
import { npmTest, printCurrentTime } from "@/utils/common/index";
|
|
2
|
+
import { initFundUnit } from "@/utils/business/index";
|
|
3
|
+
import { viteProxy } from "@/api/proxy";
|
|
4
4
|
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
5
|
+
import "@/components/business/recharge-sdk";
|
|
6
|
+
import "@/components/business/statistical-balance";
|
|
7
7
|
|
|
8
8
|
// 可选:导出组件列表或版本信息
|
|
9
9
|
export const components = ["best-recharge", "best-statistical-balance"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getAllDicts } from "
|
|
2
|
-
import { resetHttpInstance } from "
|
|
3
|
-
import { Locale, Theme, type Env } from "
|
|
1
|
+
import { getAllDicts } from "@/api";
|
|
2
|
+
import { resetHttpInstance } from "@/api/axiosInstance";
|
|
3
|
+
import { Locale, Theme, type Env } from "@/types";
|
|
4
4
|
|
|
5
5
|
export function initFundUnit(params: {
|
|
6
6
|
token: string;
|
package/src/vite-env.d.ts
CHANGED
package/tsconfig.app.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { defineConfig } from "vite";
|
|
2
2
|
import preact from "@preact/preset-vite";
|
|
3
3
|
import { viteProxy } from "./src/api/proxy";
|
|
4
|
+
import path from "path";
|
|
4
5
|
|
|
5
6
|
// https://vite.dev/config/
|
|
6
7
|
export default defineConfig({
|
|
7
8
|
plugins: [preact()],
|
|
9
|
+
resolve: {
|
|
10
|
+
alias: {
|
|
11
|
+
"@": path.resolve(__dirname, "src"),
|
|
12
|
+
},
|
|
13
|
+
},
|
|
8
14
|
server: {
|
|
9
15
|
proxy: viteProxy,
|
|
10
16
|
},
|