@pisell/pisellos 0.0.342 → 0.0.343

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.
@@ -1692,7 +1692,7 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
1692
1692
  key: "guestLogin",
1693
1693
  value: (function () {
1694
1694
  var _guestLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1695
- var guestCode, param, response;
1695
+ var guestCode, param, response, _response$data7;
1696
1696
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1697
1697
  while (1) switch (_context25.prev = _context25.next) {
1698
1698
  case 0:
@@ -1727,6 +1727,11 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
1727
1727
  if (response.data.refreshToken) {
1728
1728
  this.store.refreshToken = response.data.refreshToken;
1729
1729
  }
1730
+
1731
+ // 设置匿名登录code
1732
+ if ((_response$data7 = response.data) !== null && _response$data7 !== void 0 && (_response$data7 = _response$data7.customer) !== null && _response$data7 !== void 0 && _response$data7.guest_code) {
1733
+ this.window.localStorage.setItem('guest_code', response.data.customer.guest_code);
1734
+ }
1730
1735
  this.core.effects.emit(RegisterAndLoginHooks.onLoginSuccess, {
1731
1736
  user: response.data.user,
1732
1737
  token: response.data.token,
@@ -296,6 +296,7 @@ export interface GuestLoginResponse {
296
296
  user: UserInfo;
297
297
  token: string;
298
298
  refreshToken?: string;
299
+ customer: any;
299
300
  }
300
301
  /**
301
302
  * 检查邮箱是否已注册参数接口
@@ -1026,6 +1026,7 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
1026
1026
  }
1027
1027
  /** Guest 登录 */
1028
1028
  async guestLogin() {
1029
+ var _a, _b;
1029
1030
  try {
1030
1031
  this.store.isLoading = true;
1031
1032
  this.store.error = null;
@@ -1048,6 +1049,9 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
1048
1049
  if (response.data.refreshToken) {
1049
1050
  this.store.refreshToken = response.data.refreshToken;
1050
1051
  }
1052
+ if ((_b = (_a = response.data) == null ? void 0 : _a.customer) == null ? void 0 : _b.guest_code) {
1053
+ this.window.localStorage.setItem("guest_code", response.data.customer.guest_code);
1054
+ }
1051
1055
  this.core.effects.emit(import_types.RegisterAndLoginHooks.onLoginSuccess, {
1052
1056
  user: response.data.user,
1053
1057
  token: response.data.token,
@@ -296,6 +296,7 @@ export interface GuestLoginResponse {
296
296
  user: UserInfo;
297
297
  token: string;
298
298
  refreshToken?: string;
299
+ customer: any;
299
300
  }
300
301
  /**
301
302
  * 检查邮箱是否已注册参数接口
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.342",
4
+ "version": "0.0.343",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",