@blocklet/payment-react 1.16.5 → 1.16.7

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.
@@ -80,7 +80,7 @@ function OverdueInvoicePayment({
80
80
  containerEl: void 0,
81
81
  saveConnect: false,
82
82
  action: "collect-batch",
83
- prefix: joinURL("/api/did"),
83
+ prefix: joinURL(getPrefix(), "/api/did"),
84
84
  extraParams: { currencyId: currency.id, subscriptionId },
85
85
  onSuccess: () => {
86
86
  connect.close();
@@ -96,6 +96,10 @@ function OverdueInvoicePayment({
96
96
  });
97
97
  }
98
98
  };
99
+ const handleClose = () => {
100
+ setDialogOpen(false);
101
+ dialogProps.onClose?.();
102
+ };
99
103
  if (loading) {
100
104
  return /* @__PURE__ */ jsx(CircularProgress, {});
101
105
  }
@@ -120,28 +124,20 @@ function OverdueInvoicePayment({
120
124
  return /* @__PURE__ */ jsx(
121
125
  Dialog,
122
126
  {
123
- open: dialogOpen,
124
- onClose: () => setDialogOpen(false),
125
- title: dialogProps.title || t("payment.subscription.overdue.pastDue"),
126
127
  PaperProps: {
127
128
  style: { minHeight: "auto" }
128
129
  },
130
+ ...dialogProps || {},
131
+ open: dialogOpen,
132
+ title: dialogProps?.title || t("payment.subscription.overdue.pastDue"),
133
+ onClose: handleClose,
129
134
  children: error ? /* @__PURE__ */ jsx(Alert, { severity: "error", children: error.message }) : /* @__PURE__ */ jsxs(Stack, { gap: 1, children: [
130
135
  summaryList.length === 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
131
136
  /* @__PURE__ */ jsx(Alert, { severity: "success", children: t("payment.subscription.overdue.empty", {
132
137
  // @ts-ignore
133
138
  name: data?.subscription?.description
134
139
  }) }),
135
- /* @__PURE__ */ jsx(Stack, { direction: "row", justifyContent: "flex-end", mt: 2, children: /* @__PURE__ */ jsx(
136
- Button,
137
- {
138
- variant: "outlined",
139
- color: "primary",
140
- onClick: () => setDialogOpen(false),
141
- sx: { width: "fit-content" },
142
- children: t("common.know")
143
- }
144
- ) })
140
+ /* @__PURE__ */ jsx(Stack, { direction: "row", justifyContent: "flex-end", mt: 2, children: /* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: handleClose, sx: { width: "fit-content" }, children: t("common.know") }) })
145
141
  ] }),
146
142
  summaryList.length === 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
147
143
  /* @__PURE__ */ jsxs(Typography, { color: "text.secondary", variant: "body1", children: [
@@ -166,7 +162,7 @@ function OverdueInvoicePayment({
166
162
  )
167
163
  ] }),
168
164
  /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "flex-end", gap: 2, mt: 2, children: [
169
- /* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: () => setDialogOpen(false), children: t("common.cancel") }),
165
+ /* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: handleClose, children: t("common.cancel") }),
170
166
  renderPayButton(summaryList[0])
171
167
  ] })
172
168
  ] }),
@@ -98,7 +98,7 @@ function OverdueInvoicePayment({
98
98
  containerEl: void 0,
99
99
  saveConnect: false,
100
100
  action: "collect-batch",
101
- prefix: (0, _ufo.joinURL)("/api/did"),
101
+ prefix: (0, _ufo.joinURL)((0, _util.getPrefix)(), "/api/did"),
102
102
  extraParams: {
103
103
  currencyId: currency.id,
104
104
  subscriptionId
@@ -117,6 +117,10 @@ function OverdueInvoicePayment({
117
117
  });
118
118
  }
119
119
  };
120
+ const handleClose = () => {
121
+ setDialogOpen(false);
122
+ dialogProps.onClose?.();
123
+ };
120
124
  if (loading) {
121
125
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.CircularProgress, {});
122
126
  }
@@ -157,14 +161,15 @@ function OverdueInvoicePayment({
157
161
  });
158
162
  }
159
163
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_ux.Dialog, {
160
- open: dialogOpen,
161
- onClose: () => setDialogOpen(false),
162
- title: dialogProps.title || t("payment.subscription.overdue.pastDue"),
163
164
  PaperProps: {
164
165
  style: {
165
166
  minHeight: "auto"
166
167
  }
167
168
  },
169
+ ...(dialogProps || {}),
170
+ open: dialogOpen,
171
+ title: dialogProps?.title || t("payment.subscription.overdue.pastDue"),
172
+ onClose: handleClose,
168
173
  children: error ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Alert, {
169
174
  severity: "error",
170
175
  children: error.message
@@ -184,7 +189,7 @@ function OverdueInvoicePayment({
184
189
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
185
190
  variant: "outlined",
186
191
  color: "primary",
187
- onClick: () => setDialogOpen(false),
192
+ onClick: handleClose,
188
193
  sx: {
189
194
  width: "fit-content"
190
195
  },
@@ -218,7 +223,7 @@ function OverdueInvoicePayment({
218
223
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
219
224
  variant: "outlined",
220
225
  color: "primary",
221
- onClick: () => setDialogOpen(false),
226
+ onClick: handleClose,
222
227
  children: t("common.cancel")
223
228
  }), renderPayButton(summaryList[0])]
224
229
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.16.5",
3
+ "version": "1.16.7",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -92,7 +92,7 @@
92
92
  "@babel/core": "^7.25.2",
93
93
  "@babel/preset-env": "^7.25.2",
94
94
  "@babel/preset-react": "^7.24.7",
95
- "@blocklet/payment-types": "1.16.5",
95
+ "@blocklet/payment-types": "1.16.7",
96
96
  "@storybook/addon-essentials": "^7.6.20",
97
97
  "@storybook/addon-interactions": "^7.6.20",
98
98
  "@storybook/addon-links": "^7.6.20",
@@ -122,5 +122,5 @@
122
122
  "vite-plugin-babel": "^1.2.0",
123
123
  "vite-plugin-node-polyfills": "^0.21.0"
124
124
  },
125
- "gitHead": "74e38987168230f01af52d1aff14bfa6a18c0578"
125
+ "gitHead": "ebd2f35810953ca0a6c0c008a4c95f2296cccb38"
126
126
  }
@@ -119,7 +119,7 @@ function OverdueInvoicePayment({
119
119
  containerEl: undefined as unknown as Element,
120
120
  saveConnect: false,
121
121
  action: 'collect-batch',
122
- prefix: joinURL('/api/did'),
122
+ prefix: joinURL(getPrefix(), '/api/did'),
123
123
  extraParams: { currencyId: currency.id, subscriptionId },
124
124
  onSuccess: () => {
125
125
  connect.close();
@@ -136,6 +136,11 @@ function OverdueInvoicePayment({
136
136
  }
137
137
  };
138
138
 
139
+ const handleClose = () => {
140
+ setDialogOpen(false);
141
+ dialogProps.onClose?.();
142
+ };
143
+
139
144
  if (loading) {
140
145
  return <CircularProgress />;
141
146
  }
@@ -173,12 +178,13 @@ function OverdueInvoicePayment({
173
178
  // Default mode
174
179
  return (
175
180
  <Dialog
176
- open={dialogOpen}
177
- onClose={() => setDialogOpen(false)}
178
- title={dialogProps.title || t('payment.subscription.overdue.pastDue')}
179
181
  PaperProps={{
180
182
  style: { minHeight: 'auto' },
181
- }}>
183
+ }}
184
+ {...(dialogProps || {})}
185
+ open={dialogOpen}
186
+ title={dialogProps?.title || t('payment.subscription.overdue.pastDue')}
187
+ onClose={handleClose}>
182
188
  {error ? (
183
189
  <Alert severity="error">{error.message}</Alert>
184
190
  ) : (
@@ -192,11 +198,7 @@ function OverdueInvoicePayment({
192
198
  })}
193
199
  </Alert>
194
200
  <Stack direction="row" justifyContent="flex-end" mt={2}>
195
- <Button
196
- variant="outlined"
197
- color="primary"
198
- onClick={() => setDialogOpen(false)}
199
- sx={{ width: 'fit-content' }}>
201
+ <Button variant="outlined" color="primary" onClick={handleClose} sx={{ width: 'fit-content' }}>
200
202
  {/* @ts-ignore */}
201
203
  {t('common.know')}
202
204
  </Button>
@@ -224,7 +226,7 @@ function OverdueInvoicePayment({
224
226
  </a>
225
227
  </Typography>
226
228
  <Stack direction="row" justifyContent="flex-end" gap={2} mt={2}>
227
- <Button variant="outlined" color="primary" onClick={() => setDialogOpen(false)}>
229
+ <Button variant="outlined" color="primary" onClick={handleClose}>
228
230
  {/* @ts-ignore */}
229
231
  {t('common.cancel')}
230
232
  </Button>