payment-kit 1.18.24 → 1.18.26
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/api/src/libs/event.ts +22 -2
- package/api/src/libs/invoice.ts +142 -0
- package/api/src/libs/notification/template/aggregated-subscription-renewed.ts +165 -0
- package/api/src/libs/notification/template/one-time-payment-succeeded.ts +2 -5
- package/api/src/libs/notification/template/subscription-canceled.ts +2 -3
- package/api/src/libs/notification/template/subscription-refund-succeeded.ts +7 -4
- package/api/src/libs/notification/template/subscription-renew-failed.ts +3 -5
- package/api/src/libs/notification/template/subscription-renewed.ts +2 -2
- package/api/src/libs/notification/template/subscription-stake-slash-succeeded.ts +2 -3
- package/api/src/libs/notification/template/subscription-succeeded.ts +2 -2
- package/api/src/libs/notification/template/subscription-upgraded.ts +5 -5
- package/api/src/libs/notification/template/subscription-will-renew.ts +2 -2
- package/api/src/libs/queue/index.ts +6 -0
- package/api/src/libs/queue/store.ts +13 -1
- package/api/src/libs/util.ts +22 -1
- package/api/src/locales/en.ts +5 -0
- package/api/src/locales/zh.ts +5 -0
- package/api/src/queues/invoice.ts +21 -7
- package/api/src/queues/notification.ts +353 -11
- package/api/src/queues/payment.ts +26 -10
- package/api/src/queues/payout.ts +21 -7
- package/api/src/routes/checkout-sessions.ts +26 -12
- package/api/src/routes/connect/recharge-account.ts +13 -1
- package/api/src/routes/connect/recharge.ts +13 -1
- package/api/src/routes/connect/shared.ts +54 -36
- package/api/src/routes/customers.ts +61 -0
- package/api/src/routes/invoices.ts +51 -1
- package/api/src/routes/subscriptions.ts +1 -1
- package/api/src/store/migrations/20250328-notification-preference.ts +29 -0
- package/api/src/store/models/customer.ts +42 -1
- package/api/src/store/models/types.ts +17 -1
- package/blocklet.yml +1 -1
- package/package.json +24 -24
- package/src/components/customer/form.tsx +21 -2
- package/src/components/customer/notification-preference.tsx +428 -0
- package/src/components/layout/user.tsx +1 -1
- package/src/locales/en.tsx +30 -0
- package/src/locales/zh.tsx +30 -0
- package/src/pages/customer/index.tsx +27 -23
- package/src/pages/customer/recharge/account.tsx +19 -17
- package/src/pages/customer/subscription/embed.tsx +25 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import
|
|
3
|
+
import DID from '@arcblock/ux/lib/DID';
|
|
4
4
|
import {
|
|
5
5
|
Status,
|
|
6
6
|
api,
|
|
@@ -63,9 +63,9 @@ const fetchSubscriptionData = (id: string, authToken: string): Promise<TSubscrip
|
|
|
63
63
|
return api.get(`/api/subscriptions/${id}?authToken=${authToken}`).then((res) => res.data);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
const checkHasPastDue = async (subscriptionId: string): Promise<boolean> => {
|
|
66
|
+
const checkHasPastDue = async (subscriptionId: string, authToken: string): Promise<boolean> => {
|
|
67
67
|
try {
|
|
68
|
-
const res = await api.get(`/api/subscriptions/${subscriptionId}/summary`);
|
|
68
|
+
const res = await api.get(`/api/subscriptions/${subscriptionId}/summary?authToken=${authToken}`);
|
|
69
69
|
if (!isEmpty(res.data) && Object.keys(res.data).length >= 1) {
|
|
70
70
|
return true;
|
|
71
71
|
}
|
|
@@ -126,9 +126,12 @@ export default function SubscriptionEmbed() {
|
|
|
126
126
|
});
|
|
127
127
|
}, [subscription]);
|
|
128
128
|
|
|
129
|
-
const { data: hasPastDue, runAsync: runCheckHasPastDue } = useRequest(
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
const { data: hasPastDue, runAsync: runCheckHasPastDue } = useRequest(
|
|
130
|
+
() => checkHasPastDue(subscriptionId, authToken),
|
|
131
|
+
{
|
|
132
|
+
refreshDeps: [subscriptionId, authToken],
|
|
133
|
+
}
|
|
134
|
+
);
|
|
132
135
|
|
|
133
136
|
if (error) {
|
|
134
137
|
return (
|
|
@@ -212,11 +215,20 @@ export default function SubscriptionEmbed() {
|
|
|
212
215
|
logo={getCustomerAvatar(
|
|
213
216
|
subscription.customer.did,
|
|
214
217
|
subscription.customer.updated_at ? new Date(subscription.customer.updated_at).toISOString() : '',
|
|
215
|
-
|
|
218
|
+
24
|
|
216
219
|
)}
|
|
217
|
-
|
|
218
|
-
description={<DidAddress did={subscription.customer.did} responsive={false} compact />}
|
|
220
|
+
description=""
|
|
219
221
|
className="owner-info-card"
|
|
222
|
+
name={subscription.customer.name || subscription.customer.email}
|
|
223
|
+
tooltip={
|
|
224
|
+
<Stack>
|
|
225
|
+
<Typography>
|
|
226
|
+
{subscription.customer.name} ({subscription.customer.email})
|
|
227
|
+
</Typography>
|
|
228
|
+
<DID did={subscription.customer.did} />
|
|
229
|
+
</Stack>
|
|
230
|
+
}
|
|
231
|
+
size={24}
|
|
220
232
|
/>
|
|
221
233
|
),
|
|
222
234
|
});
|
|
@@ -254,6 +266,9 @@ export default function SubscriptionEmbed() {
|
|
|
254
266
|
'.info-row-value': {
|
|
255
267
|
flex: 'none',
|
|
256
268
|
},
|
|
269
|
+
'.owner-info-card .info-card': {
|
|
270
|
+
minWidth: 0,
|
|
271
|
+
},
|
|
257
272
|
}}
|
|
258
273
|
/>
|
|
259
274
|
);
|
|
@@ -342,6 +357,7 @@ export default function SubscriptionEmbed() {
|
|
|
342
357
|
open: state.batchPay,
|
|
343
358
|
onClose: () => setState({ batchPay: false }),
|
|
344
359
|
}}
|
|
360
|
+
authToken={authToken}
|
|
345
361
|
/>
|
|
346
362
|
)}
|
|
347
363
|
</PaymentProvider>
|