@blocklet/launcher-ux 2.3.52 → 2.3.54

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.
@@ -25,6 +25,7 @@ export default function CheckoutOnDemand({
25
25
  api,
26
26
  connectApi,
27
27
  checkoutPath,
28
+ checkoutSession,
28
29
  session,
29
30
  t,
30
31
  locale,
@@ -45,6 +46,7 @@ export default function CheckoutOnDemand({
45
46
  launchSessionId: launchSessionId,
46
47
  handlePaid: handlePaid,
47
48
  checkoutPath: checkoutPath,
49
+ checkoutSession: checkoutSession,
48
50
  components: components,
49
51
  blockletStoreURL: blockletStoreURL,
50
52
  t: t,
@@ -64,7 +66,8 @@ const propTypes = {
64
66
  t: PropTypes.func.isRequired,
65
67
  locale: PropTypes.string.isRequired,
66
68
  api: PropTypes.object.isRequired,
67
- checkoutPath: PropTypes.string.isRequired,
69
+ checkoutPath: PropTypes.string,
70
+ checkoutSession: PropTypes.object,
68
71
  freeTrialProducts: PropTypes.array,
69
72
  minStakeAmount: PropTypes.number.isRequired,
70
73
  isResume: PropTypes.bool
@@ -87,6 +90,7 @@ function Component({
87
90
  blockletStoreURL,
88
91
  api,
89
92
  checkoutPath,
93
+ checkoutSession,
90
94
  t,
91
95
  locale,
92
96
  freeTrialProducts,
@@ -125,6 +129,12 @@ function Component({
125
129
  });
126
130
  const quantity = components?.length || 1;
127
131
  const checkoutState = useAsync(async () => {
132
+ if (checkoutSession) {
133
+ return {
134
+ checkoutSessionId: checkoutSession.checkoutSessionId,
135
+ price: checkoutSession.price
136
+ };
137
+ }
128
138
  const {
129
139
  data
130
140
  } = await api.post(checkoutPath, {
@@ -260,16 +270,26 @@ function Component({
260
270
  children: components.map(({
261
271
  did,
262
272
  title,
263
- logo
273
+ logo,
274
+ bundleSource
264
275
  }) => {
265
276
  let props = {};
266
- if (blockletStoreURL) {
267
- props = {
268
- component: 'a',
269
- href: getBlockletUrlOnStore({
277
+ if (blockletStoreURL || bundleSource) {
278
+ let blockletURL = '';
279
+ if (bundleSource?.store) {
280
+ blockletURL = getBlockletUrlOnStore({
281
+ did,
282
+ baseUrl: bundleSource?.store
283
+ });
284
+ } else {
285
+ blockletURL = getBlockletUrlOnStore({
270
286
  did,
271
287
  baseUrl: blockletStoreURL
272
- })
288
+ });
289
+ }
290
+ props = {
291
+ component: 'a',
292
+ href: blockletURL
273
293
  };
274
294
  }
275
295
  return /*#__PURE__*/_jsxs(ListItem, {
@@ -38,6 +38,7 @@ function CheckoutOnDemand(_ref) {
38
38
  api,
39
39
  connectApi,
40
40
  checkoutPath,
41
+ checkoutSession,
41
42
  session,
42
43
  t,
43
44
  locale,
@@ -58,6 +59,7 @@ function CheckoutOnDemand(_ref) {
58
59
  launchSessionId: launchSessionId,
59
60
  handlePaid: handlePaid,
60
61
  checkoutPath: checkoutPath,
62
+ checkoutSession: checkoutSession,
61
63
  components: components,
62
64
  blockletStoreURL: blockletStoreURL,
63
65
  t: t,
@@ -77,7 +79,8 @@ const propTypes = {
77
79
  t: _propTypes.default.func.isRequired,
78
80
  locale: _propTypes.default.string.isRequired,
79
81
  api: _propTypes.default.object.isRequired,
80
- checkoutPath: _propTypes.default.string.isRequired,
82
+ checkoutPath: _propTypes.default.string,
83
+ checkoutSession: _propTypes.default.object,
81
84
  freeTrialProducts: _propTypes.default.array,
82
85
  minStakeAmount: _propTypes.default.number.isRequired,
83
86
  isResume: _propTypes.default.bool
@@ -100,6 +103,7 @@ function Component(_ref2) {
100
103
  blockletStoreURL,
101
104
  api,
102
105
  checkoutPath,
106
+ checkoutSession,
103
107
  t,
104
108
  locale,
105
109
  freeTrialProducts,
@@ -138,6 +142,12 @@ function Component(_ref2) {
138
142
  });
139
143
  const quantity = (components === null || components === void 0 ? void 0 : components.length) || 1;
140
144
  const checkoutState = (0, _useAsync.default)(async () => {
145
+ if (checkoutSession) {
146
+ return {
147
+ checkoutSessionId: checkoutSession.checkoutSessionId,
148
+ price: checkoutSession.price
149
+ };
150
+ }
141
151
  const {
142
152
  data
143
153
  } = await api.post(checkoutPath, {
@@ -276,16 +286,26 @@ function Component(_ref2) {
276
286
  let {
277
287
  did,
278
288
  title,
279
- logo
289
+ logo,
290
+ bundleSource
280
291
  } = _ref3;
281
292
  let props = {};
282
- if (blockletStoreURL) {
283
- props = {
284
- component: 'a',
285
- href: (0, _util2.getBlockletUrlOnStore)({
293
+ if (blockletStoreURL || bundleSource) {
294
+ let blockletURL = '';
295
+ if (bundleSource !== null && bundleSource !== void 0 && bundleSource.store) {
296
+ blockletURL = (0, _util2.getBlockletUrlOnStore)({
297
+ did,
298
+ baseUrl: bundleSource === null || bundleSource === void 0 ? void 0 : bundleSource.store
299
+ });
300
+ } else {
301
+ blockletURL = (0, _util2.getBlockletUrlOnStore)({
286
302
  did,
287
303
  baseUrl: blockletStoreURL
288
- })
304
+ });
305
+ }
306
+ props = {
307
+ component: 'a',
308
+ href: blockletURL
289
309
  };
290
310
  }
291
311
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItem, _objectSpread(_objectSpread({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/launcher-ux",
3
- "version": "2.3.52",
3
+ "version": "2.3.54",
4
4
  "description": "Launcher UX lib",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -44,7 +44,7 @@
44
44
  "react": ">=18.1.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@babel/cli": "^7.24.8",
47
+ "@babel/cli": "^7.25.6",
48
48
  "@babel/core": "^7.25.2",
49
49
  "@babel/preset-env": "^7.25.4",
50
50
  "@babel/preset-react": "^7.24.7",
@@ -53,9 +53,9 @@
53
53
  "glob": "^10.4.5"
54
54
  },
55
55
  "dependencies": {
56
- "@arcblock/ux": "^2.10.23",
57
- "@blocklet/launcher-util": "2.3.52",
58
- "@blocklet/payment-react": "^1.14.34",
56
+ "@arcblock/ux": "^2.10.33",
57
+ "@blocklet/launcher-util": "2.3.54",
58
+ "@blocklet/payment-react": "^1.15.4",
59
59
  "@emotion/styled": "^11.13.0",
60
60
  "@mui/icons-material": "^5.16.7",
61
61
  "@mui/material": "^5.16.7",
@@ -93,5 +93,5 @@
93
93
  "require": "./lib/use-mobile/index.js"
94
94
  }
95
95
  },
96
- "gitHead": "3b510686ef692c377b8e1e837e420b2fefcfca9d"
96
+ "gitHead": "e1b9d6d3607e9b17a8b59c1f67df8e059a6d8c16"
97
97
  }