payment-kit 1.18.5 → 1.18.6

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.
@@ -27,10 +27,10 @@ export default {
27
27
 
28
28
  onConnect: async (args: CallbackArgs) => {
29
29
  const { userDid, userPk, extraParams } = args;
30
- const { checkoutSessionId, connectedDid } = extraParams;
30
+ const { checkoutSessionId, connectedDid, sessionUserDid } = extraParams;
31
31
  const { paymentIntent, paymentCurrency, paymentMethod } = await ensurePaymentIntent(
32
32
  checkoutSessionId,
33
- connectedDid || userDid
33
+ connectedDid || sessionUserDid || userDid
34
34
  );
35
35
  if (!paymentIntent) {
36
36
  throw new Error('Payment intent not found');
@@ -87,10 +87,10 @@ export default {
87
87
 
88
88
  onAuth: async (args: CallbackArgs) => {
89
89
  const { request, userDid, claims, extraParams } = args;
90
- const { checkoutSessionId, connectedDid } = extraParams;
90
+ const { checkoutSessionId, connectedDid, sessionUserDid } = extraParams;
91
91
  const { checkoutSession, customer, paymentIntent, paymentMethod } = await ensurePaymentIntent(
92
92
  checkoutSessionId,
93
- connectedDid || userDid
93
+ connectedDid || sessionUserDid || userDid
94
94
  );
95
95
  if (!paymentIntent) {
96
96
  throw new Error('Payment intent not found');
@@ -30,10 +30,10 @@ export default {
30
30
  },
31
31
  onConnect: async (args: CallbackArgs) => {
32
32
  const { userDid, userPk, extraParams } = args;
33
- const { checkoutSessionId, connectedDid } = extraParams;
33
+ const { checkoutSessionId, connectedDid, sessionUserDid } = extraParams;
34
34
  const { paymentMethod, paymentCurrency, checkoutSession, subscription, customer } = await ensureSetupIntent(
35
35
  checkoutSessionId,
36
- connectedDid || userDid
36
+ connectedDid || sessionUserDid || userDid
37
37
  );
38
38
  if (!subscription) {
39
39
  throw new Error('Subscription for checkoutSession not found');
@@ -123,9 +123,9 @@ export default {
123
123
  },
124
124
  onAuth: async (args: CallbackArgs) => {
125
125
  const { request, userDid, userPk, claims, extraParams } = args;
126
- const { checkoutSessionId, connectedDid } = extraParams;
126
+ const { checkoutSessionId, connectedDid, sessionUserDid } = extraParams;
127
127
  const { setupIntent, checkoutSession, paymentMethod, subscription, invoice, paymentCurrency, customer } =
128
- await ensureSetupIntent(checkoutSessionId, connectedDid || userDid);
128
+ await ensureSetupIntent(checkoutSessionId, connectedDid || sessionUserDid || userDid);
129
129
 
130
130
  if (!subscription) {
131
131
  throw new Error('Subscription for checkoutSession not found');
@@ -31,10 +31,10 @@ export default {
31
31
  },
32
32
  onConnect: async (args: CallbackArgs) => {
33
33
  const { userDid, userPk, extraParams } = args;
34
- const { checkoutSessionId, connectedDid } = extraParams;
34
+ const { checkoutSessionId, connectedDid, sessionUserDid } = extraParams;
35
35
  const { checkoutSession, paymentMethod, paymentCurrency, subscription, customer } = await ensurePaymentIntent(
36
36
  checkoutSessionId,
37
- connectedDid || userDid
37
+ connectedDid || sessionUserDid || userDid
38
38
  );
39
39
  if (!subscription) {
40
40
  throw new Error('Subscription for checkoutSession not found');
@@ -123,10 +123,10 @@ export default {
123
123
  },
124
124
  onAuth: async (args: CallbackArgs) => {
125
125
  const { request, userDid, userPk, claims, extraParams } = args;
126
- const { checkoutSessionId, connectedDid } = extraParams;
126
+ const { checkoutSessionId, connectedDid, sessionUserDid } = extraParams;
127
127
  const { checkoutSession, customer, paymentMethod, subscription, paymentCurrency } = await ensurePaymentIntent(
128
128
  checkoutSessionId,
129
- connectedDid || userDid
129
+ connectedDid || sessionUserDid || userDid
130
130
  );
131
131
 
132
132
  if (!subscription) {
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.5
17
+ version: 1.18.6
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.18.5",
3
+ "version": "1.18.6",
4
4
  "scripts": {
5
5
  "dev": "blocklet dev --open",
6
6
  "eject": "vite eject",
@@ -53,11 +53,11 @@
53
53
  "@arcblock/validator": "^1.19.9",
54
54
  "@blocklet/js-sdk": "^1.16.38",
55
55
  "@blocklet/logger": "^1.16.38",
56
- "@blocklet/payment-react": "1.18.5",
56
+ "@blocklet/payment-react": "1.18.6",
57
57
  "@blocklet/sdk": "^1.16.38",
58
58
  "@blocklet/ui-react": "^2.11.34",
59
- "@blocklet/uploader": "^0.1.66",
60
- "@blocklet/xss": "^0.1.22",
59
+ "@blocklet/uploader": "^0.1.67",
60
+ "@blocklet/xss": "^0.1.23",
61
61
  "@mui/icons-material": "^5.16.6",
62
62
  "@mui/lab": "^5.0.0-alpha.173",
63
63
  "@mui/material": "^5.16.6",
@@ -121,7 +121,7 @@
121
121
  "devDependencies": {
122
122
  "@abtnode/types": "^1.16.38",
123
123
  "@arcblock/eslint-config-ts": "^0.3.3",
124
- "@blocklet/payment-types": "1.18.5",
124
+ "@blocklet/payment-types": "1.18.6",
125
125
  "@types/cookie-parser": "^1.4.7",
126
126
  "@types/cors": "^2.8.17",
127
127
  "@types/debug": "^4.1.12",
@@ -167,5 +167,5 @@
167
167
  "parser": "typescript"
168
168
  }
169
169
  },
170
- "gitHead": "83cca0f1ac5814964c8bedd04f34a3a2a986f554"
170
+ "gitHead": "784ba57910d780a44d0792ef503b666ee8f8d9c3"
171
171
  }
@@ -140,7 +140,7 @@ export function SubscriptionActionsInner({
140
140
  const { t, locale } = useLocaleContext();
141
141
  const { reset, getValues } = useFormContext();
142
142
  const navigate = useNavigate();
143
- const { connect } = usePaymentContext();
143
+ const { connect, session } = usePaymentContext();
144
144
  const [subs, setSubscription] = useState(subscription);
145
145
  const { checkUnpaidInvoices } = useUnpaidInvoicesCheckForSubscription(subscription.id, true);
146
146
  const action = getSubscriptionAction(subs, actionProps ?? {});
@@ -239,7 +239,7 @@ export function SubscriptionActionsInner({
239
239
  saveConnect: false,
240
240
  action: 'delegation',
241
241
  prefix: joinURL(getPrefix(), '/api/did'),
242
- extraParams: { subscriptionId: subscription.id },
242
+ extraParams: { subscriptionId: subscription.id, sessionUserDid: session.user.did },
243
243
  onSuccess: () => {
244
244
  connect.close();
245
245
  Toast.success(t('customer.delegation.success'));
@@ -286,7 +286,7 @@ export function SubscriptionActionsInner({
286
286
  saveConnect: false,
287
287
  action: 'overdraft-protection',
288
288
  prefix: joinURL(getPrefix(), '/api/did'),
289
- extraParams: { subscriptionId: subscription.id, amount },
289
+ extraParams: { subscriptionId: subscription.id, amount, sessionUserDid: session.user.did },
290
290
  onSuccess: () => {
291
291
  connect.close();
292
292
  Toast.success(t('customer.overdraftProtection.settingSuccess'));
@@ -53,7 +53,7 @@ export default function CustomerSubscriptionChangePlan() {
53
53
  const navigate = useNavigate();
54
54
  const { id } = useParams() as { id: string };
55
55
  const { t, locale } = useLocaleContext();
56
- const { connect } = usePaymentContext();
56
+ const { connect, session } = usePaymentContext();
57
57
  const [searchParams] = useSearchParams();
58
58
  const redirectUrl = searchParams.get('redirectUrl');
59
59
  const confirmRef = useRef<HTMLButtonElement>(null);
@@ -164,6 +164,7 @@ export default function CustomerSubscriptionChangePlan() {
164
164
  extraParams: {
165
165
  invoiceId: result.data.pending_update?.updates?.latest_invoice_id,
166
166
  subscriptionId: result.data.id,
167
+ sessionUserDid: session?.user?.did,
167
168
  },
168
169
  onSuccess: () => {
169
170
  setState({ paid: true, paying: false });