payment-kit 1.13.236 → 1.13.237

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/blocklet.yml CHANGED
@@ -14,7 +14,7 @@ repository:
14
14
  type: git
15
15
  url: git+https://github.com/blocklet/payment-kit.git
16
16
  specVersion: 1.2.8
17
- version: 1.13.236
17
+ version: 1.13.237
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.13.236",
3
+ "version": "1.13.237",
4
4
  "scripts": {
5
5
  "dev": "cross-env COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev --open",
6
6
  "eject": "vite eject",
@@ -42,18 +42,18 @@
42
42
  ]
43
43
  },
44
44
  "dependencies": {
45
- "@abtnode/cron": "1.16.25",
45
+ "@abtnode/cron": "1.16.26",
46
46
  "@arcblock/did": "^1.18.115",
47
47
  "@arcblock/did-auth-storage-nedb": "^1.7.1",
48
- "@arcblock/did-connect": "^2.9.71",
48
+ "@arcblock/did-connect": "^2.9.75",
49
49
  "@arcblock/did-util": "^1.18.115",
50
50
  "@arcblock/jwt": "^1.18.115",
51
- "@arcblock/ux": "^2.9.71",
51
+ "@arcblock/ux": "^2.9.75",
52
52
  "@arcblock/validator": "^1.18.115",
53
- "@blocklet/logger": "1.16.25",
54
- "@blocklet/payment-react": "1.13.236",
55
- "@blocklet/sdk": "1.16.25",
56
- "@blocklet/ui-react": "^2.9.71",
53
+ "@blocklet/logger": "1.16.26",
54
+ "@blocklet/payment-react": "1.13.237",
55
+ "@blocklet/sdk": "1.16.26",
56
+ "@blocklet/ui-react": "^2.9.75",
57
57
  "@blocklet/uploader": "^0.0.78",
58
58
  "@mui/icons-material": "^5.15.15",
59
59
  "@mui/lab": "^5.0.0-alpha.170",
@@ -114,9 +114,9 @@
114
114
  "validator": "^13.11.0"
115
115
  },
116
116
  "devDependencies": {
117
- "@abtnode/types": "1.16.25",
117
+ "@abtnode/types": "1.16.26",
118
118
  "@arcblock/eslint-config-ts": "^0.3.0",
119
- "@blocklet/payment-types": "1.13.236",
119
+ "@blocklet/payment-types": "1.13.237",
120
120
  "@types/cookie-parser": "^1.4.7",
121
121
  "@types/cors": "^2.8.17",
122
122
  "@types/dotenv-flow": "^3.3.3",
@@ -155,5 +155,5 @@
155
155
  "parser": "typescript"
156
156
  }
157
157
  },
158
- "gitHead": "458c748371a1dac07c0aa9039fb71f6fcbb68e14"
158
+ "gitHead": "895430a130d53b62707f4f78c5295b06ce55d4db"
159
159
  }
package/src/libs/util.ts CHANGED
@@ -197,9 +197,7 @@ export function canChangePaymentMethod(subscription: TSubscriptionExpanded) {
197
197
  }
198
198
 
199
199
  // Steal from https://d3js.org/d3-scale-chromatic/categorical
200
- export function getCategoricalColors(
201
- specifier: string = '4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab'
202
- ) {
200
+ export function getCategoricalColors(specifier: string = '4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755f') {
203
201
  const n = (specifier.length / 6) | 0;
204
202
  const colors = new Array(n);
205
203
  let i = 0;
@@ -67,9 +67,11 @@ export const groupData = (data: TPaymentStat[], currencies: { [key: string]: any
67
67
  grouped[x.timestamp] = { timestamp: formatToDate(x.timestamp * 1000, locale, 'YYYY-MM-DD') };
68
68
  }
69
69
 
70
- const { symbol } = currencies[x.currency_id];
71
- // @ts-ignore
72
- grouped[x.timestamp][symbol] = +x[key];
70
+ if (currencies[x.currency_id]) {
71
+ const { symbol } = currencies[x.currency_id];
72
+ // @ts-ignore
73
+ grouped[x.timestamp][symbol] = +x[key];
74
+ }
73
75
  });
74
76
 
75
77
  return Object.values(grouped);
@@ -1,7 +1,7 @@
1
1
  import DID from '@arcblock/ux/lib/DID';
2
2
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
3
3
  import Toast from '@arcblock/ux/lib/Toast';
4
- import { CustomerInvoiceList, formatError, getPrefix } from '@blocklet/payment-react';
4
+ import { CustomerInvoiceList, formatError, getPrefix, usePaymentContext } from '@blocklet/payment-react';
5
5
  import type { GroupedBN, TCustomerExpanded } from '@blocklet/payment-types';
6
6
  import { Edit } from '@mui/icons-material';
7
7
  import { Alert, Box, Button, CircularProgress, Grid, Stack, Tooltip } from '@mui/material';
@@ -32,6 +32,7 @@ const fetchData = (): Promise<Result> => {
32
32
  export default function CustomerHome() {
33
33
  const { t } = useLocaleContext();
34
34
  const { events } = useSessionContext();
35
+ const { livemode, setLivemode } = usePaymentContext();
35
36
  const [state, setState] = useSetState({ editing: false, loading: false });
36
37
  const navigate = useNavigate();
37
38
  const { isPending, startTransition } = useTransitionContext();
@@ -51,6 +52,12 @@ export default function CustomerHome() {
51
52
  });
52
53
  }, []);
53
54
 
55
+ useEffect(() => {
56
+ if (data && data.livemode !== livemode) {
57
+ setLivemode(data.livemode);
58
+ }
59
+ }, [data]);
60
+
54
61
  if (!data) {
55
62
  return <CircularProgress />;
56
63
  }