@blocklet/launcher-workflow 2.1.67 → 2.1.68

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/lib/checkout.js CHANGED
@@ -123,17 +123,20 @@ function CheckoutPage(_ref) {
123
123
  embed,
124
124
  isPurchaseOnly
125
125
  } = (0, _workflow.useWorkflowContext)();
126
+ const api = create({
127
+ baseURL: didPayPrefix
128
+ });
129
+ const launchSessionAPI = create({
130
+ baseURL: '/'
131
+ });
126
132
  (0, _react.useEffect)(() => {
127
133
  if (isPurchaseOnly) {
128
134
  return;
129
135
  }
130
136
  if (session.user) {
131
- _util2.launchSession.connect(api, routerPrefix, state.sessionId, session.user.did);
137
+ _util2.launchSession.connect(launchSessionAPI, routerPrefix, state.sessionId, session.user.did);
132
138
  }
133
139
  }, [session.user]);
134
- const api = create({
135
- baseURL: didPayPrefix
136
- });
137
140
  const enableBlockletAgreement = !!blocklet;
138
141
  const context = (0, _useAsync.default)(async () => {
139
142
  const [{
@@ -166,14 +169,14 @@ function CheckoutPage(_ref) {
166
169
  }
167
170
  events.on('logout', () => {
168
171
  const metaUrl = params.get('blocklet_meta_url');
169
- _util2.launchSession.create(api, routerPrefix, metaUrl, (err, launch) => {
172
+ _util2.launchSession.create(launchSessionAPI, routerPrefix, metaUrl, (err, launch) => {
170
173
  var _context$value;
171
174
  setState({
172
175
  sessionId: launch._id
173
176
  });
174
177
  params.set('sessionId', launch._id);
175
178
  const type = (0, _lodash.default)((_context$value = context.value) === null || _context$value === void 0 ? void 0 : _context$value.plan, 'extra.type') || 'serverless';
176
- _util2.launchSession.select(api, routerPrefix, launch._id, type, state.planId);
179
+ _util2.launchSession.select(launchSessionAPI, routerPrefix, launch._id, type, state.planId);
177
180
  });
178
181
  });
179
182
  }, []);
@@ -210,7 +213,7 @@ function CheckoutPage(_ref) {
210
213
  session.refresh();
211
214
  return;
212
215
  }
213
- _util2.launchSession.connect(api, routerPrefix, state.sessionId, result.did, () => {
216
+ _util2.launchSession.connect(launchSessionAPI, routerPrefix, state.sessionId, result.did, () => {
214
217
  session.refresh();
215
218
  });
216
219
  };
package/lib/purchase.js CHANGED
@@ -135,6 +135,9 @@ function PurchasePage(_ref) {
135
135
  const api = create({
136
136
  baseURL: didPayPrefix
137
137
  });
138
+ const launchSessionAPI = create({
139
+ baseURL: '/'
140
+ });
138
141
  const selectPlan = launch => {
139
142
  if (!state.plans.length) {
140
143
  return;
@@ -163,7 +166,7 @@ function PurchasePage(_ref) {
163
166
  }
164
167
  events.on('logout', () => {
165
168
  const metaUrl = params.get('blocklet_meta_url');
166
- _util.launchSession.create(api, routerPrefix, metaUrl, (err, launch) => {
169
+ _util.launchSession.create(launchSessionAPI, routerPrefix, metaUrl, (err, launch) => {
167
170
  setState({
168
171
  sessionId: launch._id
169
172
  });
@@ -223,11 +226,11 @@ function PurchasePage(_ref) {
223
226
  }
224
227
  const metaUrl = params.get('blocklet_meta_url');
225
228
  if (params.get('sessionId')) {
226
- _util.launchSession.load(api, routerPrefix, params.get('sessionId'), metaUrl, (err, launch) => {
229
+ _util.launchSession.load(launchSessionAPI, routerPrefix, params.get('sessionId'), metaUrl, (err, launch) => {
227
230
  selectPlan(launch);
228
231
  });
229
232
  } else if (metaUrl) {
230
- _util.launchSession.create(api, routerPrefix, metaUrl, (err, launch) => {
233
+ _util.launchSession.create(launchSessionAPI, routerPrefix, metaUrl, (err, launch) => {
231
234
  setState({
232
235
  sessionId: launch._id
233
236
  });
@@ -326,7 +329,7 @@ function PurchasePage(_ref) {
326
329
  }
327
330
  const plan = state.plans.find(x => x._id === state.planId);
328
331
  const type = (0, _lodash.default)(plan, 'extra.type') || 'serverless';
329
- _util.launchSession.select(api, routerPrefix, state.sessionId, type, state.planId);
332
+ _util.launchSession.select(launchSessionAPI, routerPrefix, state.sessionId, type, state.planId);
330
333
  }, [state.planId, state.sessionId]);
331
334
  const productFeatures = [];
332
335
  if (!state.loading && ((_state$plans3 = state.plans) === null || _state$plans3 === void 0 ? void 0 : _state$plans3.length) > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/launcher-workflow",
3
- "version": "2.1.67",
3
+ "version": "2.1.68",
4
4
  "description": "Purchase components for Launcher UI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -40,10 +40,10 @@
40
40
  "@arcblock/license": "^2.5.68",
41
41
  "@arcblock/react-hooks": "^2.5.68",
42
42
  "@arcblock/ux": "^2.5.68",
43
- "@blocklet/launcher-layout": "2.1.67",
44
- "@blocklet/launcher-util": "2.1.67",
45
- "@blocklet/launcher-ux": "2.1.67",
46
- "@blocklet/payment": "^1.12.30",
43
+ "@blocklet/launcher-layout": "2.1.68",
44
+ "@blocklet/launcher-util": "2.1.68",
45
+ "@blocklet/launcher-ux": "2.1.68",
46
+ "@blocklet/payment": "^1.12.31",
47
47
  "@emotion/react": "^11.11.1",
48
48
  "@emotion/styled": "^11.11.0",
49
49
  "@mui/icons-material": "^5.14.0",
@@ -64,7 +64,7 @@
64
64
  "lodash.throttle": "^4.1.1",
65
65
  "prop-types": "^15.8.1",
66
66
  "react-lottie-player": "^1.5.4",
67
- "react-router-dom": "^6.14.1",
67
+ "react-router-dom": "^6.14.2",
68
68
  "react-use": "^17.4.0",
69
69
  "url-join": "^4.0.1"
70
70
  },
@@ -76,5 +76,5 @@
76
76
  "babel-plugin-inline-react-svg": "^2.0.2",
77
77
  "jest": "^27.5.1"
78
78
  },
79
- "gitHead": "f69e1b1a19dda74a0402caf04e5d47602e2af10f"
79
+ "gitHead": "91823bd20469757d7bec8a22443040f0bb4e893f"
80
80
  }