payment-kit 1.18.2 → 1.18.4

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 (44) hide show
  1. package/api/src/index.ts +4 -21
  2. package/api/src/libs/logger.ts +2 -1
  3. package/api/src/routes/checkout-sessions.ts +7 -7
  4. package/api/src/routes/customers.ts +6 -5
  5. package/api/src/routes/events.ts +3 -2
  6. package/api/src/routes/invoices.ts +4 -3
  7. package/api/src/routes/payment-currencies.ts +2 -2
  8. package/api/src/routes/payment-intents.ts +6 -6
  9. package/api/src/routes/payment-links.ts +1 -1
  10. package/api/src/routes/payment-stats.ts +3 -2
  11. package/api/src/routes/payouts.ts +6 -5
  12. package/api/src/routes/pricing-table.ts +2 -2
  13. package/api/src/routes/settings.ts +251 -2
  14. package/api/src/routes/subscription-items.ts +3 -3
  15. package/api/src/routes/subscriptions.ts +15 -15
  16. package/api/src/routes/usage-records.ts +2 -2
  17. package/api/src/routes/webhook-attempts.ts +2 -1
  18. package/api/src/routes/webhook-endpoints.ts +3 -2
  19. package/api/src/store/migrations/20250211-setting.ts +10 -0
  20. package/api/src/store/migrations/20250214-setting-component.ts +22 -0
  21. package/api/src/store/models/index.ts +6 -1
  22. package/api/src/store/models/setting.ts +84 -0
  23. package/api/src/store/models/types.ts +2 -0
  24. package/blocklet.yml +13 -1
  25. package/package.json +24 -24
  26. package/src/app.tsx +6 -1
  27. package/src/components/invoice/list.tsx +1 -3
  28. package/src/components/payment-intent/list.tsx +5 -6
  29. package/src/components/payouts/list.tsx +3 -3
  30. package/src/components/refund/list.tsx +3 -6
  31. package/src/components/subscription/list.tsx +1 -2
  32. package/src/locales/en.tsx +100 -1
  33. package/src/locales/zh.tsx +96 -0
  34. package/src/pages/admin/customers/customers/index.tsx +27 -16
  35. package/src/pages/admin/developers/webhooks/index.tsx +14 -12
  36. package/src/pages/admin/products/links/index.tsx +22 -15
  37. package/src/pages/admin/products/pricing-tables/index.tsx +16 -14
  38. package/src/pages/admin/products/products/index.tsx +19 -15
  39. package/src/pages/home.tsx +1 -1
  40. package/src/pages/integrations/donations/edit-form.tsx +349 -0
  41. package/src/pages/integrations/donations/index.tsx +360 -0
  42. package/src/pages/integrations/donations/preview.tsx +229 -0
  43. package/src/pages/integrations/index.tsx +80 -0
  44. package/src/pages/integrations/overview.tsx +121 -0
@@ -94,7 +94,7 @@ router.get('/', auth, async (req, res) => {
94
94
  }
95
95
  res.json({ count, list, paging: { page, pageSize } });
96
96
  } catch (err) {
97
- console.error(err);
97
+ logger.error(err);
98
98
  res.json({ count: 0, list: [], paging: { page, pageSize } });
99
99
  }
100
100
  });
@@ -112,7 +112,7 @@ router.get('/:id', auth, async (req, res) => {
112
112
  res.status(404).json(null);
113
113
  }
114
114
  } catch (err) {
115
- console.error(err);
115
+ logger.error(err);
116
116
  res.status(500).json({ error: `Failed to get subscription item: ${err.message}` });
117
117
  }
118
118
  });
@@ -249,7 +249,7 @@ router.post('/:id/add-usage-quantity', auth, async (req, res) => {
249
249
 
250
250
  return res.json(usageRecord);
251
251
  } catch (err) {
252
- console.error(err);
252
+ logger.error(err);
253
253
  return res.status(400).json({ error: `Failed to add usage quantity: ${err.message}` });
254
254
  }
255
255
  });
@@ -197,7 +197,7 @@ router.get('/', authMine, async (req, res) => {
197
197
 
198
198
  res.json({ count, list: docs, paging: { page, pageSize } });
199
199
  } catch (err) {
200
- console.error(err);
200
+ logger.error(err);
201
201
  res.json({ count: 0, list: [], paging: { page, pageSize } });
202
202
  }
203
203
  });
@@ -264,7 +264,7 @@ router.get('/:id', authPortal, async (req, res) => {
264
264
  res.status(404).json(null);
265
265
  }
266
266
  } catch (err) {
267
- console.error(err);
267
+ logger.error(err);
268
268
  res.status(500).json({ error: `Failed to get subscription: ${err.message}` });
269
269
  }
270
270
  });
@@ -1139,7 +1139,7 @@ router.put('/:id', authPortal, async (req, res) => {
1139
1139
  });
1140
1140
  return res.json({ ...subscription.toJSON(), connectAction });
1141
1141
  } catch (err) {
1142
- console.error(err);
1142
+ logger.error(err);
1143
1143
  return res.status(500).json({ code: err.code, error: err.message });
1144
1144
  }
1145
1145
  });
@@ -1216,7 +1216,7 @@ router.get('/:id/change-plan', authPortal, async (req, res) => {
1216
1216
  const table = await getUpdateTable(subscription);
1217
1217
  return res.json(table);
1218
1218
  } catch (err) {
1219
- console.error(err);
1219
+ logger.error(err);
1220
1220
  return res.json(null);
1221
1221
  }
1222
1222
  });
@@ -1267,7 +1267,7 @@ router.post('/:id/change-plan', authPortal, async (req, res) => {
1267
1267
  items: newItems,
1268
1268
  });
1269
1269
  } catch (err) {
1270
- console.error(err);
1270
+ logger.error(err);
1271
1271
  return res.status(400).json({ error: err.message });
1272
1272
  }
1273
1273
  });
@@ -1312,7 +1312,7 @@ router.get('/:id/proration', authPortal, async (req, res) => {
1312
1312
  paymentCurrency,
1313
1313
  });
1314
1314
  } catch (err) {
1315
- console.error(err);
1315
+ logger.error(err);
1316
1316
  return res.status(400).json({ error: err.message });
1317
1317
  }
1318
1318
  });
@@ -1344,7 +1344,7 @@ router.get('/:id/staking', authPortal, async (req, res) => {
1344
1344
  });
1345
1345
  } catch (err) {
1346
1346
  logger.error('subscription staking simulation failed', { error: err });
1347
- console.error(err);
1347
+ logger.error(err);
1348
1348
  return res.status(400).json({ error: err.message });
1349
1349
  }
1350
1350
  });
@@ -1628,7 +1628,7 @@ router.post('/:id/change-payment', authPortal, async (req, res) => {
1628
1628
  delegation,
1629
1629
  });
1630
1630
  } catch (err) {
1631
- console.error(err);
1631
+ logger.error(err);
1632
1632
  return res.status(500).json({ code: err.code, error: err.message });
1633
1633
  }
1634
1634
  });
@@ -1730,7 +1730,7 @@ router.get('/:id/summary', authPortal, async (req, res) => {
1730
1730
  });
1731
1731
  return res.json(summary);
1732
1732
  } catch (err) {
1733
- console.error(err);
1733
+ logger.error(err);
1734
1734
  return res.status(400).json({ error: err.message });
1735
1735
  }
1736
1736
  });
@@ -1741,7 +1741,7 @@ router.get('/:id/upcoming', authPortal, async (req, res) => {
1741
1741
  const result = await getUpcomingInvoiceAmount(req.params.id as string);
1742
1742
  return res.json(result);
1743
1743
  } catch (err) {
1744
- console.error(err);
1744
+ logger.error(err);
1745
1745
  return res.json({ error: err.message });
1746
1746
  }
1747
1747
  });
@@ -1904,7 +1904,7 @@ router.get('/:id/recharge', authMine, async (req, res) => {
1904
1904
 
1905
1905
  return res.json({ count, list: invoices, subscription, paging: { page, pageSize } });
1906
1906
  } catch (err) {
1907
- console.error(err);
1907
+ logger.error(err);
1908
1908
  return res.status(400).json({ error: err.message });
1909
1909
  }
1910
1910
  });
@@ -1960,7 +1960,7 @@ router.get('/:id/overdue/invoices', authPortal, async (req, res) => {
1960
1960
  invoices,
1961
1961
  });
1962
1962
  } catch (err) {
1963
- console.error(err);
1963
+ logger.error(err);
1964
1964
  return res.status(400).json({ error: err.message });
1965
1965
  }
1966
1966
  });
@@ -2001,7 +2001,7 @@ router.get('/:id/delegation', authPortal, async (req, res) => {
2001
2001
  }
2002
2002
  return res.json(null);
2003
2003
  } catch (err) {
2004
- console.error(err);
2004
+ logger.error(err);
2005
2005
  return res.json(null);
2006
2006
  }
2007
2007
  });
@@ -2028,7 +2028,7 @@ router.get('/:id/overdraft-protection', authPortal, async (req, res) => {
2028
2028
  shouldPay,
2029
2029
  });
2030
2030
  } catch (err) {
2031
- console.error(err);
2031
+ logger.error(err);
2032
2032
  return res.status(400).json({ error: err.message });
2033
2033
  }
2034
2034
  });
@@ -2117,7 +2117,7 @@ router.post('/:id/overdraft-protection', authPortal, async (req, res) => {
2117
2117
  overdraft_protection: subscription.overdraft_protection,
2118
2118
  });
2119
2119
  } catch (err) {
2120
- console.error(err);
2120
+ logger.error(err);
2121
2121
  return res.status(400).json({ error: err.message });
2122
2122
  }
2123
2123
  });
@@ -192,7 +192,7 @@ router.get('/summary', auth, async (req, res) => {
192
192
 
193
193
  res.json({ count, list, paging: { page, pageSize } });
194
194
  } catch (err) {
195
- console.error(err);
195
+ logger.error(err);
196
196
  res.json({ count: 0, list: [], paging: { page, pageSize } });
197
197
  }
198
198
  });
@@ -235,7 +235,7 @@ export function createUsageRecordQueryFn(doc?: Subscription) {
235
235
 
236
236
  res.json({ count, list });
237
237
  } catch (err) {
238
- console.error(err);
238
+ logger.error(err);
239
239
  res.json({ count: 0, list: [] });
240
240
  }
241
241
  };
@@ -6,6 +6,7 @@ import { createListParamSchema } from '../libs/api';
6
6
  import { authenticate } from '../libs/security';
7
7
  import { Event, WebhookAttempt, WebhookEndpoint } from '../store/models';
8
8
  import { blocklet } from '../libs/auth';
9
+ import logger from '../libs/logger';
9
10
 
10
11
  const router = Router();
11
12
  const auth = authenticate<WebhookAttempt>({ component: true, roles: ['owner', 'admin'] });
@@ -57,7 +58,7 @@ router.get('/', auth, async (req, res) => {
57
58
  );
58
59
  res.json({ count, list: updatedList, paging: { page, pageSize } });
59
60
  } catch (err) {
60
- console.error(err);
61
+ logger.error(err);
61
62
  res.json({ count: 0, list: [], paging: { page, pageSize } });
62
63
  }
63
64
  });
@@ -7,6 +7,7 @@ import { createListParamSchema, MetadataSchema } from '../libs/api';
7
7
  import { authenticate } from '../libs/security';
8
8
  import { formatMetadata } from '../libs/util';
9
9
  import { WebhookEndpoint } from '../store/models';
10
+ import logger from '../libs/logger';
10
11
 
11
12
  const router = Router();
12
13
  const auth = authenticate<WebhookEndpoint>({ component: true, roles: ['owner', 'admin'] });
@@ -69,7 +70,7 @@ router.get('/', auth, async (req, res) => {
69
70
 
70
71
  res.json({ count, list, paging: { page, pageSize } });
71
72
  } catch (err) {
72
- console.error(err);
73
+ logger.error(err);
73
74
  res.json({ count: 0, list: [], paging: { page, pageSize } });
74
75
  }
75
76
  });
@@ -82,7 +83,7 @@ router.get('/:id', auth, async (req, res) => {
82
83
  });
83
84
  res.json(doc);
84
85
  } catch (err) {
85
- console.error(err);
86
+ logger.error(err);
86
87
  res.json(null);
87
88
  }
88
89
  });
@@ -0,0 +1,10 @@
1
+ import type { Migration } from '../migrate';
2
+ import models from '../models';
3
+
4
+ export const up: Migration = async ({ context }) => {
5
+ await context.createTable('settings', models.Setting.GENESIS_ATTRIBUTES);
6
+ };
7
+
8
+ export const down: Migration = async ({ context }) => {
9
+ await context.dropTable('settings');
10
+ };
@@ -0,0 +1,22 @@
1
+ import { DataTypes } from 'sequelize';
2
+ import { safeApplyColumnChanges, type Migration } from '../migrate';
3
+
4
+ export const up: Migration = async ({ context }) => {
5
+ await safeApplyColumnChanges(context, {
6
+ settings: [
7
+ {
8
+ name: 'component_did',
9
+ field: { type: DataTypes.STRING, allowNull: true },
10
+ },
11
+ ],
12
+ });
13
+ const columns = await context.describeTable('settings');
14
+ if (columns.mountLocation) {
15
+ await context.renameColumn('settings', 'mountLocation', 'mount_location');
16
+ }
17
+ };
18
+
19
+ export const down: Migration = async ({ context }) => {
20
+ await context.removeColumn('settings', 'component_did');
21
+ await context.renameColumn('settings', 'mount_location', 'mountLocation');
22
+ };
@@ -26,6 +26,7 @@ import type { LineItem, PricingTableItem } from './types';
26
26
  import { TUsageRecord, UsageRecord } from './usage-record';
27
27
  import { TWebhookAttempt, WebhookAttempt } from './webhook-attempt';
28
28
  import { TWebhookEndpoint, WebhookEndpoint } from './webhook-endpoint';
29
+ import { Setting } from './setting';
29
30
 
30
31
  const models = {
31
32
  CheckoutSession,
@@ -55,6 +56,7 @@ const models = {
55
56
  WebhookAttempt,
56
57
  Job,
57
58
  Lock,
59
+ Setting,
58
60
  };
59
61
 
60
62
  export function initialize(sequelize: any) {
@@ -62,7 +64,9 @@ export function initialize(sequelize: any) {
62
64
  model.initialize(sequelize);
63
65
  });
64
66
  Object.values(models).forEach((model) => {
65
- model.associate(models);
67
+ if ('associate' in model) {
68
+ (model as any).associate(models);
69
+ }
66
70
  });
67
71
  }
68
72
 
@@ -96,6 +100,7 @@ export * from './usage-record';
96
100
  export * from './webhook-attempt';
97
101
  export * from './webhook-endpoint';
98
102
  export * from './types';
103
+ export * from './setting';
99
104
 
100
105
  export type TPriceExpanded = TPrice & {
101
106
  object: 'price';
@@ -0,0 +1,84 @@
1
+ /* eslint-disable @typescript-eslint/lines-between-class-members */
2
+ import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes, Model } from 'sequelize';
3
+
4
+ import { createIdGenerator } from '../../libs/util';
5
+ import type { SettingType } from './types';
6
+
7
+ const nextId = createIdGenerator('set', 24);
8
+
9
+ // eslint-disable-next-line prettier/prettier
10
+ export class Setting extends Model<InferAttributes<Setting>, InferCreationAttributes<Setting>> {
11
+ declare id: CreationOptional<string>;
12
+
13
+ declare livemode: boolean;
14
+
15
+ declare type: SettingType;
16
+ declare mount_location: string;
17
+ declare active: boolean;
18
+ declare component_did?: string;
19
+
20
+ declare settings: Record<string, any>;
21
+
22
+ declare created_at: CreationOptional<Date>;
23
+ declare updated_at: CreationOptional<Date>;
24
+
25
+ public static readonly GENESIS_ATTRIBUTES = {
26
+ id: {
27
+ type: DataTypes.STRING(30),
28
+ primaryKey: true,
29
+ allowNull: false,
30
+ defaultValue: nextId,
31
+ },
32
+ livemode: {
33
+ type: DataTypes.BOOLEAN,
34
+ allowNull: false,
35
+ },
36
+ active: {
37
+ type: DataTypes.BOOLEAN,
38
+ allowNull: false,
39
+ defaultValue: true,
40
+ },
41
+ type: {
42
+ type: DataTypes.STRING(64),
43
+ allowNull: false,
44
+ },
45
+ mount_location: {
46
+ type: DataTypes.STRING(255),
47
+ allowNull: false,
48
+ },
49
+ component_did: {
50
+ type: DataTypes.STRING(255),
51
+ allowNull: true,
52
+ },
53
+ description: {
54
+ type: DataTypes.STRING(255),
55
+ allowNull: false,
56
+ },
57
+ settings: {
58
+ type: DataTypes.JSON,
59
+ allowNull: true,
60
+ },
61
+ created_at: {
62
+ type: DataTypes.DATE,
63
+ defaultValue: DataTypes.NOW,
64
+ allowNull: false,
65
+ },
66
+ updated_at: {
67
+ type: DataTypes.DATE,
68
+ defaultValue: DataTypes.NOW,
69
+ allowNull: false,
70
+ },
71
+ };
72
+
73
+ public static initialize(sequelize: any) {
74
+ this.init(Setting.GENESIS_ATTRIBUTES, {
75
+ sequelize,
76
+ modelName: 'Setting',
77
+ tableName: 'settings',
78
+ createdAt: 'created_at',
79
+ updatedAt: 'updated_at',
80
+ });
81
+ }
82
+ }
83
+
84
+ export type TSetting = InferAttributes<Setting>;
@@ -691,3 +691,5 @@ export type EventType = LiteralUnion<
691
691
  >;
692
692
 
693
693
  export type StripeRefundReason = 'duplicate' | 'fraudulent' | 'requested_by_customer';
694
+
695
+ export type SettingType = LiteralUnion<'donate', string>;
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.18.2
17
+ version: 1.18.4
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
@@ -94,6 +94,18 @@ navigation:
94
94
  role:
95
95
  - admin
96
96
  - owner
97
+ - id: integrations
98
+ title:
99
+ en: Integrations
100
+ zh: 快速集成
101
+ icon: ion:flash-outline
102
+ link: /integrations
103
+ section:
104
+ - dashboard
105
+ - sessionManager
106
+ role:
107
+ - admin
108
+ - owner
97
109
  - id: billing
98
110
  title:
99
111
  en: Billing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.18.2",
3
+ "version": "1.18.4",
4
4
  "scripts": {
5
5
  "dev": "blocklet dev --open",
6
6
  "eject": "vite eject",
@@ -43,30 +43,30 @@
43
43
  ]
44
44
  },
45
45
  "dependencies": {
46
- "@abtnode/cron": "^1.16.37",
47
- "@arcblock/did": "^1.19.3",
46
+ "@abtnode/cron": "^1.16.38",
47
+ "@arcblock/did": "^1.19.9",
48
48
  "@arcblock/did-auth-storage-nedb": "^1.7.1",
49
- "@arcblock/did-connect": "^2.11.27",
50
- "@arcblock/did-util": "^1.19.3",
51
- "@arcblock/jwt": "^1.19.3",
52
- "@arcblock/ux": "^2.11.27",
53
- "@arcblock/validator": "^1.19.3",
54
- "@blocklet/js-sdk": "^1.16.37",
55
- "@blocklet/logger": "^1.16.37",
56
- "@blocklet/payment-react": "1.18.2",
57
- "@blocklet/sdk": "^1.16.37",
58
- "@blocklet/ui-react": "^2.11.27",
59
- "@blocklet/uploader": "^0.1.64",
60
- "@blocklet/xss": "^0.1.21",
49
+ "@arcblock/did-connect": "^2.11.34",
50
+ "@arcblock/did-util": "^1.19.9",
51
+ "@arcblock/jwt": "^1.19.9",
52
+ "@arcblock/ux": "^2.11.34",
53
+ "@arcblock/validator": "^1.19.9",
54
+ "@blocklet/js-sdk": "^1.16.38",
55
+ "@blocklet/logger": "^1.16.38",
56
+ "@blocklet/payment-react": "1.18.4",
57
+ "@blocklet/sdk": "^1.16.38",
58
+ "@blocklet/ui-react": "^2.11.34",
59
+ "@blocklet/uploader": "^0.1.66",
60
+ "@blocklet/xss": "^0.1.22",
61
61
  "@mui/icons-material": "^5.16.6",
62
62
  "@mui/lab": "^5.0.0-alpha.173",
63
63
  "@mui/material": "^5.16.6",
64
64
  "@mui/system": "^5.16.6",
65
- "@ocap/asset": "^1.19.3",
66
- "@ocap/client": "^1.19.3",
67
- "@ocap/mcrypto": "^1.19.3",
68
- "@ocap/util": "^1.19.3",
69
- "@ocap/wallet": "^1.19.3",
65
+ "@ocap/asset": "^1.19.9",
66
+ "@ocap/client": "^1.19.9",
67
+ "@ocap/mcrypto": "^1.19.9",
68
+ "@ocap/util": "^1.19.9",
69
+ "@ocap/wallet": "^1.19.9",
70
70
  "@stripe/react-stripe-js": "^2.7.3",
71
71
  "@stripe/stripe-js": "^2.4.0",
72
72
  "ahooks": "^3.8.0",
@@ -119,9 +119,9 @@
119
119
  "web3": "^4.16.0"
120
120
  },
121
121
  "devDependencies": {
122
- "@abtnode/types": "^1.16.37",
122
+ "@abtnode/types": "^1.16.38",
123
123
  "@arcblock/eslint-config-ts": "^0.3.3",
124
- "@blocklet/payment-types": "1.18.2",
124
+ "@blocklet/payment-types": "1.18.4",
125
125
  "@types/cookie-parser": "^1.4.7",
126
126
  "@types/cors": "^2.8.17",
127
127
  "@types/debug": "^4.1.12",
@@ -151,7 +151,7 @@
151
151
  "vite": "^5.3.5",
152
152
  "vite-node": "^2.0.4",
153
153
  "vite-plugin-babel-import": "^2.0.5",
154
- "vite-plugin-blocklet": "^0.9.16",
154
+ "vite-plugin-blocklet": "^0.9.20",
155
155
  "vite-plugin-node-polyfills": "^0.21.0",
156
156
  "vite-plugin-svgr": "^4.2.0",
157
157
  "vite-tsconfig-paths": "^4.3.2",
@@ -167,5 +167,5 @@
167
167
  "parser": "typescript"
168
168
  }
169
169
  },
170
- "gitHead": "577491d13f4b2e53e9a71be3b90298b5685f5e8a"
170
+ "gitHead": "003d3b762bc9e3e224e4814dea95ff02d014868d"
171
171
  }
package/src/app.tsx CHANGED
@@ -30,6 +30,7 @@ const CustomerSubscriptionChangePlan = React.lazy(() => import('./pages/customer
30
30
  const CustomerSubscriptionChangePayment = React.lazy(() => import('./pages/customer/subscription/change-payment'));
31
31
  const CustomerRecharge = React.lazy(() => import('./pages/customer/recharge'));
32
32
  const CustomerPayoutDetail = React.lazy(() => import('./pages/customer/payout/detail'));
33
+ const IntegrationsPage = React.lazy(() => import('./pages/integrations'));
33
34
 
34
35
  // const theme = createTheme({
35
36
  // typography: {
@@ -59,6 +60,10 @@ function App() {
59
60
  <Route key="admin-tabs" path="/admin/:group" element={<AdminPage />} />,
60
61
  <Route key="admin-sub" path="/admin/:group/:page" element={<AdminPage />} />,
61
62
  <Route key="admin-fallback" path="/admin/*" element={<AdminPage />} />,
63
+ <Route key="integrations-index" path="/integrations" element={<IntegrationsPage />} />
64
+ <Route key="integrations-tabs" path="/integrations/:group" element={<IntegrationsPage />} />
65
+ <Route key="integrations-sub" path="/integrations/:group/:page" element={<IntegrationsPage />} />
66
+ <Route key="integrations-fallback" path="/integrations/*" element={<IntegrationsPage />} />
62
67
  <Route
63
68
  key="customer-home"
64
69
  path="/customer"
@@ -166,7 +171,7 @@ export default function WrappedApp() {
166
171
  <ToastProvider>
167
172
  <SessionProvider
168
173
  serviceHost={prefix}
169
- protectedRoutes={['/admin/*', '/customer/*'].map((item) => joinURL(prefix, item))}>
174
+ protectedRoutes={['/admin/*', '/customer/*', '/integrations/*'].map((item) => joinURL(prefix, item))}>
170
175
  <Router basename={prefix}>
171
176
  <AppWithTracker />
172
177
  </Router>
@@ -332,11 +332,9 @@ export default function InvoiceList({
332
332
  } else {
333
333
  setSearch({
334
334
  ...search!,
335
- status: '',
336
- customer_id,
337
- subscription_id,
338
335
  pageSize: 100,
339
336
  page: 1,
337
+ q: {},
340
338
  });
341
339
  }
342
340
  },
@@ -210,10 +210,9 @@ export default function PaymentList({ customer_id, invoice_id, features }: ListP
210
210
 
211
211
  const onTableChange = ({ page, rowsPerPage }: any) => {
212
212
  if (search!.pageSize !== rowsPerPage) {
213
- setSearch((x) => ({ ...x, pageSize: rowsPerPage, page: 1 }));
213
+ setSearch((x: any) => ({ ...x, pageSize: rowsPerPage, page: 1 }));
214
214
  } else if (search!.page !== page + 1) {
215
- // @ts-ignore
216
- setSearch((x) => ({ ...x, page: page + 1 }));
215
+ setSearch((x: any) => ({ ...x, page: page + 1 }));
217
216
  }
218
217
  };
219
218
 
@@ -233,6 +232,7 @@ export default function PaymentList({ customer_id, invoice_id, features }: ListP
233
232
  onSearchChange: (text: string) => {
234
233
  if (text) {
235
234
  setSearch({
235
+ ...search!,
236
236
  q: {
237
237
  'like-description': text,
238
238
  'like-metadata': text,
@@ -242,11 +242,10 @@ export default function PaymentList({ customer_id, invoice_id, features }: ListP
242
242
  });
243
243
  } else {
244
244
  setSearch({
245
- status: '',
246
- customer_id,
247
- invoice_id,
245
+ ...search!,
248
246
  pageSize: 100,
249
247
  page: 1,
248
+ q: {},
250
249
  });
251
250
  }
252
251
  },
@@ -239,6 +239,7 @@ export default function PayoutList({ customer_id, payment_intent_id, status, fea
239
239
  onSearchChange: (text: string) => {
240
240
  if (text) {
241
241
  setSearch({
242
+ ...search!,
242
243
  q: {
243
244
  'like-description': text,
244
245
  'like-metadata': text,
@@ -248,11 +249,10 @@ export default function PayoutList({ customer_id, payment_intent_id, status, fea
248
249
  });
249
250
  } else {
250
251
  setSearch({
251
- status: '',
252
- customer_id,
253
- payment_intent_id,
252
+ ...search!,
254
253
  pageSize: 100,
255
254
  page: 1,
255
+ q: {},
256
256
  });
257
257
  }
258
258
  },
@@ -273,23 +273,20 @@ export default function RefundList({
273
273
  onSearchChange: (text: string) => {
274
274
  if (text) {
275
275
  setSearch({
276
+ ...search!,
276
277
  q: {
277
278
  'like-description': text,
278
279
  'like-metadata': text,
279
280
  },
280
- status: '',
281
281
  pageSize: 100,
282
282
  page: 1,
283
283
  });
284
284
  } else {
285
285
  setSearch({
286
- status: '',
287
- customer_id,
288
- invoice_id,
289
- payment_intent_id,
290
- subscription_id,
286
+ ...search!,
291
287
  pageSize: 100,
292
288
  page: 1,
289
+ q: {},
293
290
  });
294
291
  }
295
292
  },
@@ -226,10 +226,9 @@ export default function SubscriptionList({ customer_id, features, status }: List
226
226
  } else {
227
227
  setSearch({
228
228
  ...search!,
229
- status: '',
230
- customer_id,
231
229
  pageSize: 100,
232
230
  page: 1,
231
+ q: {},
233
232
  });
234
233
  }
235
234
  },