@pisell/pisellos 0.0.360 → 0.0.361

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.
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -189,7 +189,8 @@ var onlineStoreConfig = {
189
189
  return {
190
190
  phone: String(params.phone),
191
191
  code: params.code,
192
- country_calling_code: String(params.country_calling_code)
192
+ country_calling_code: String(params.country_calling_code),
193
+ action: params.action
193
194
  };
194
195
  }
195
196
  },
@@ -344,7 +345,7 @@ var onlineStoreConfig = {
344
345
  method: 'POST',
345
346
  transformParams: function transformParams(params) {
346
347
  return {
347
- token: params.token
348
+ code: params.code
348
349
  };
349
350
  }
350
351
  }
@@ -511,7 +512,8 @@ var defaultConfig = {
511
512
  return {
512
513
  phone: String(params.phone),
513
514
  code: params.code,
514
- country_calling_code: String(params.country_calling_code)
515
+ country_calling_code: String(params.country_calling_code),
516
+ action: params.action
515
517
  };
516
518
  }
517
519
  },
@@ -666,7 +668,7 @@ var defaultConfig = {
666
668
  method: 'POST',
667
669
  transformParams: function transformParams(params) {
668
670
  return {
669
- token: params.token
671
+ code: params.code
670
672
  };
671
673
  }
672
674
  }
@@ -2250,44 +2250,63 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
2250
2250
  return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2251
2251
  while (1) switch (_context35.prev = _context35.next) {
2252
2252
  case 0:
2253
- _context35.next = 2;
2253
+ console.log('[RegisterAndLogin] Facebook 登录开始', {
2254
+ tokenLength: (token === null || token === void 0 ? void 0 : token.length) || 0,
2255
+ timestamp: Date.now()
2256
+ });
2257
+ _context35.next = 3;
2254
2258
  return this.initFacebookSDK(token);
2255
- case 2:
2259
+ case 3:
2260
+ console.log('[RegisterAndLogin] Facebook SDK 初始化完成,准备调用 FB.login');
2256
2261
  return _context35.abrupt("return", new Promise(function (resolve, reject) {
2262
+ console.log('[RegisterAndLogin] 调用 FB.login', {
2263
+ scope: 'email,public_profile'
2264
+ });
2257
2265
  window.FB.login( /*#__PURE__*/function () {
2258
2266
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(response) {
2259
2267
  var result;
2260
2268
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2261
2269
  while (1) switch (_context34.prev = _context34.next) {
2262
2270
  case 0:
2271
+ console.log('[RegisterAndLogin] FB.login 回调触发', {
2272
+ hasAuthResponse: Boolean(response === null || response === void 0 ? void 0 : response.authResponse),
2273
+ status: response === null || response === void 0 ? void 0 : response.status
2274
+ });
2263
2275
  if (!response.authResponse) {
2264
- _context34.next = 13;
2276
+ _context34.next = 17;
2265
2277
  break;
2266
2278
  }
2267
- _context34.prev = 1;
2268
- _context34.next = 4;
2279
+ _context34.prev = 2;
2280
+ // 直接调用 /auth/facebook/login 接口
2281
+ console.log('[RegisterAndLogin] 调用后端 facebookLogin 接口');
2282
+ _context34.next = 6;
2269
2283
  return _this2.apiCaller.call('facebookLogin', {
2270
2284
  token: response.authResponse.accessToken
2271
2285
  });
2272
- case 4:
2286
+ case 6:
2273
2287
  result = _context34.sent;
2288
+ console.log('[RegisterAndLogin] facebookLogin 接口返回成功', {
2289
+ hasResult: Boolean(result)
2290
+ });
2274
2291
  resolve(result);
2275
- _context34.next = 11;
2292
+ _context34.next = 15;
2276
2293
  break;
2277
- case 8:
2278
- _context34.prev = 8;
2279
- _context34.t0 = _context34["catch"](1);
2280
- reject(_context34.t0);
2281
2294
  case 11:
2282
- _context34.next = 14;
2295
+ _context34.prev = 11;
2296
+ _context34.t0 = _context34["catch"](2);
2297
+ console.error('[RegisterAndLogin] facebookLogin 接口调用失败', _context34.t0);
2298
+ reject(_context34.t0);
2299
+ case 15:
2300
+ _context34.next = 19;
2283
2301
  break;
2284
- case 13:
2302
+ case 17:
2303
+ console.warn('[RegisterAndLogin] FB.login 用户取消授权或无 authResponse', response);
2285
2304
  reject(new Error('facebook_login_cancel'));
2286
- case 14:
2305
+ case 19:
2287
2306
  case "end":
2288
2307
  return _context34.stop();
2289
2308
  }
2290
- }, _callee34, null, [[1, 8]]);
2309
+ }, _callee34, null, [[2, 11]]);
2291
2310
  }));
2292
2311
  return function (_x31) {
2293
2312
  return _ref.apply(this, arguments);
@@ -2296,7 +2315,7 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
2296
2315
  scope: 'email,public_profile'
2297
2316
  });
2298
2317
  }));
2299
- case 3:
2318
+ case 5:
2300
2319
  case "end":
2301
2320
  return _context35.stop();
2302
2321
  }
@@ -2319,13 +2338,20 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
2319
2338
  return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2320
2339
  while (1) switch (_context37.prev = _context37.next) {
2321
2340
  case 0:
2322
- _context37.next = 2;
2341
+ // 先加载 Apple SDK
2342
+ console.log('[RegisterAndLogin] Apple 登录开始', {
2343
+ tokenLength: (token === null || token === void 0 ? void 0 : token.length) || 0,
2344
+ timestamp: Date.now()
2345
+ });
2346
+ _context37.next = 3;
2323
2347
  return this.initAppleSDK();
2324
- case 2:
2348
+ case 3:
2349
+ console.log('[RegisterAndLogin] Apple SDK 初始化完成');
2325
2350
  return _context37.abrupt("return", new Promise(function (resolve, reject) {
2326
2351
  try {
2327
2352
  var _AppleID, _AppleID2;
2328
2353
  // 动态创建 Apple 登录按钮元素
2354
+ console.log('[RegisterAndLogin] 创建临时 Apple SignIn 按钮节点');
2329
2355
  var appleSignInDiv = document.createElement('div');
2330
2356
  appleSignInDiv.id = 'appleid-signin-temp';
2331
2357
  appleSignInDiv.setAttribute('data-color', 'black');
@@ -2342,9 +2368,11 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
2342
2368
 
2343
2369
  // 将元素添加到 body 中
2344
2370
  document.body.appendChild(appleSignInDiv);
2371
+ console.log('[RegisterAndLogin] Apple SignIn 按钮已添加到文档');
2345
2372
 
2346
2373
  // 初始化 Apple ID 按钮
2347
2374
  if ((_AppleID = window.AppleID) !== null && _AppleID !== void 0 && (_AppleID = _AppleID.auth) !== null && _AppleID !== void 0 && _AppleID.init) {
2375
+ console.log('[RegisterAndLogin] 调用 AppleID.auth.init');
2348
2376
  window.AppleID.auth.init({
2349
2377
  clientId: token,
2350
2378
  // 使用传入的 token 作为 clientId
@@ -2353,10 +2381,13 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
2353
2381
  state: 'signin',
2354
2382
  usePopup: true
2355
2383
  });
2384
+ } else {
2385
+ console.warn('[RegisterAndLogin] AppleID.auth.init 方法不可用');
2356
2386
  }
2357
2387
 
2358
2388
  // 直接调用 Apple ID 登录,并处理 Promise
2359
2389
  if ((_AppleID2 = window.AppleID) !== null && _AppleID2 !== void 0 && (_AppleID2 = _AppleID2.auth) !== null && _AppleID2 !== void 0 && _AppleID2.signIn) {
2390
+ console.log('[RegisterAndLogin] 调用 AppleID.auth.signIn');
2360
2391
  window.AppleID.auth.signIn().then( /*#__PURE__*/function () {
2361
2392
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(authResult) {
2362
2393
  var _authResult$authoriza, _authResult$authoriza2, authorizationCode, identityToken, result;
@@ -2368,28 +2399,44 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
2368
2399
  if (document.body.contains(appleSignInDiv)) {
2369
2400
  document.body.removeChild(appleSignInDiv);
2370
2401
  }
2402
+ console.log('[RegisterAndLogin] Apple SignIn 成功,临时节点已移除', {
2403
+ hasAuthorization: Boolean(authResult === null || authResult === void 0 ? void 0 : authResult.authorization),
2404
+ hasUser: Boolean(authResult === null || authResult === void 0 ? void 0 : authResult.user)
2405
+ });
2371
2406
 
2372
2407
  // 获取授权码或令牌
2373
2408
  authorizationCode = (_authResult$authoriza = authResult.authorization) === null || _authResult$authoriza === void 0 ? void 0 : _authResult$authoriza.code;
2374
- identityToken = (_authResult$authoriza2 = authResult.authorization) === null || _authResult$authoriza2 === void 0 ? void 0 : _authResult$authoriza2.id_token; // 使用授权码或身份令牌调用后端接口
2375
- _context36.next = 6;
2409
+ identityToken = (_authResult$authoriza2 = authResult.authorization) === null || _authResult$authoriza2 === void 0 ? void 0 : _authResult$authoriza2.id_token;
2410
+ console.log('[RegisterAndLogin] Apple 授权结果解析', {
2411
+ hasAuthorizationCode: Boolean(authorizationCode),
2412
+ hasIdentityToken: Boolean(identityToken)
2413
+ });
2414
+
2415
+ // 使用授权码或身份令牌调用后端接口
2416
+ console.log('[RegisterAndLogin] 调用后端 appleLogin 接口');
2417
+ _context36.next = 9;
2376
2418
  return _this3.apiCaller.call('appleLogin', {
2377
- token: authorizationCode || identityToken
2419
+ code: identityToken || authorizationCode,
2420
+ login_channel: _this3.channel
2378
2421
  });
2379
- case 6:
2422
+ case 9:
2380
2423
  result = _context36.sent;
2424
+ console.log('[RegisterAndLogin] appleLogin 接口返回成功', {
2425
+ hasResult: Boolean(result)
2426
+ });
2381
2427
  resolve(result);
2382
- _context36.next = 13;
2428
+ _context36.next = 18;
2383
2429
  break;
2384
- case 10:
2385
- _context36.prev = 10;
2430
+ case 14:
2431
+ _context36.prev = 14;
2386
2432
  _context36.t0 = _context36["catch"](0);
2433
+ console.error('[RegisterAndLogin] 处理 Apple 登录结果失败', _context36.t0);
2387
2434
  reject(_context36.t0);
2388
- case 13:
2435
+ case 18:
2389
2436
  case "end":
2390
2437
  return _context36.stop();
2391
2438
  }
2392
- }, _callee36, null, [[0, 10]]);
2439
+ }, _callee36, null, [[0, 14]]);
2393
2440
  }));
2394
2441
  return function (_x33) {
2395
2442
  return _ref2.apply(this, arguments);
@@ -2399,16 +2446,19 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
2399
2446
  if (document.body.contains(appleSignInDiv)) {
2400
2447
  document.body.removeChild(appleSignInDiv);
2401
2448
  }
2449
+ console.error('[RegisterAndLogin] Apple SignIn Promise 拒绝', error);
2402
2450
  reject(new Error('Apple 登录失败: ' + ((error === null || error === void 0 ? void 0 : error.error) || (error === null || error === void 0 ? void 0 : error.message) || '未知错误')));
2403
2451
  });
2404
2452
  } else {
2453
+ console.error('[RegisterAndLogin] AppleID.auth.signIn 方法不可用');
2405
2454
  reject(new Error('Apple SDK 未正确加载'));
2406
2455
  }
2407
2456
  } catch (error) {
2457
+ console.error('[RegisterAndLogin] Apple 登录流程异常', error);
2408
2458
  reject(error);
2409
2459
  }
2410
2460
  }));
2411
- case 3:
2461
+ case 5:
2412
2462
  case "end":
2413
2463
  return _context37.stop();
2414
2464
  }
@@ -328,6 +328,7 @@ export interface CheckMobileCodeParams {
328
328
  shop_id: number;
329
329
  code: string;
330
330
  country_calling_code: string;
331
+ action: string;
331
332
  }
332
333
  /**
333
334
  * 验证码有效性检查响应接口
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -122,6 +122,12 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
122
122
  throw error;
123
123
  }
124
124
  }
125
+ /**
126
+ * 初始化外设扫码结果监听
127
+ */
128
+ initPeripheralsListener() {
129
+ this.scan.initPeripheralsListener();
130
+ }
125
131
  /**
126
132
  * 获取商品列表(不加载到模块中)
127
133
  * @returns 商品列表
@@ -157,7 +157,8 @@ var onlineStoreConfig = {
157
157
  transformParams: (params) => ({
158
158
  phone: String(params.phone),
159
159
  code: params.code,
160
- country_calling_code: String(params.country_calling_code)
160
+ country_calling_code: String(params.country_calling_code),
161
+ action: params.action
161
162
  })
162
163
  },
163
164
  phonePasswordLogin: {
@@ -276,7 +277,7 @@ var onlineStoreConfig = {
276
277
  url: "/auth/apple/login",
277
278
  method: "POST",
278
279
  transformParams: (params) => ({
279
- token: params.token
280
+ code: params.code
280
281
  })
281
282
  }
282
283
  };
@@ -407,7 +408,8 @@ var defaultConfig = {
407
408
  transformParams: (params) => ({
408
409
  phone: String(params.phone),
409
410
  code: params.code,
410
- country_calling_code: String(params.country_calling_code)
411
+ country_calling_code: String(params.country_calling_code),
412
+ action: params.action
411
413
  })
412
414
  },
413
415
  phonePasswordLogin: {
@@ -526,7 +528,7 @@ var defaultConfig = {
526
528
  url: "/auth/apple/login",
527
529
  method: "POST",
528
530
  transformParams: (params) => ({
529
- token: params.token
531
+ code: params.code
530
532
  })
531
533
  }
532
534
  };
@@ -1358,20 +1358,38 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
1358
1358
  * Facebook 登录
1359
1359
  */
1360
1360
  async loginWithFacebook(token) {
1361
+ console.log("[RegisterAndLogin] Facebook 登录开始", {
1362
+ tokenLength: (token == null ? void 0 : token.length) || 0,
1363
+ timestamp: Date.now()
1364
+ });
1361
1365
  await this.initFacebookSDK(token);
1366
+ console.log("[RegisterAndLogin] Facebook SDK 初始化完成,准备调用 FB.login");
1362
1367
  return new Promise((resolve, reject) => {
1368
+ console.log("[RegisterAndLogin] 调用 FB.login", {
1369
+ scope: "email,public_profile"
1370
+ });
1363
1371
  window.FB.login(
1364
1372
  async (response) => {
1373
+ console.log("[RegisterAndLogin] FB.login 回调触发", {
1374
+ hasAuthResponse: Boolean(response == null ? void 0 : response.authResponse),
1375
+ status: response == null ? void 0 : response.status
1376
+ });
1365
1377
  if (response.authResponse) {
1366
1378
  try {
1379
+ console.log("[RegisterAndLogin] 调用后端 facebookLogin 接口");
1367
1380
  const result = await this.apiCaller.call("facebookLogin", {
1368
1381
  token: response.authResponse.accessToken
1369
1382
  });
1383
+ console.log("[RegisterAndLogin] facebookLogin 接口返回成功", {
1384
+ hasResult: Boolean(result)
1385
+ });
1370
1386
  resolve(result);
1371
1387
  } catch (error) {
1388
+ console.error("[RegisterAndLogin] facebookLogin 接口调用失败", error);
1372
1389
  reject(error);
1373
1390
  }
1374
1391
  } else {
1392
+ console.warn("[RegisterAndLogin] FB.login 用户取消授权或无 authResponse", response);
1375
1393
  reject(new Error("facebook_login_cancel"));
1376
1394
  }
1377
1395
  },
@@ -1383,10 +1401,16 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
1383
1401
  * Apple 登录(需要在支持的环境中使用)
1384
1402
  */
1385
1403
  async loginWithApple(token) {
1404
+ console.log("[RegisterAndLogin] Apple 登录开始", {
1405
+ tokenLength: (token == null ? void 0 : token.length) || 0,
1406
+ timestamp: Date.now()
1407
+ });
1386
1408
  await this.initAppleSDK();
1409
+ console.log("[RegisterAndLogin] Apple SDK 初始化完成");
1387
1410
  return new Promise((resolve, reject) => {
1388
1411
  var _a, _b, _c, _d;
1389
1412
  try {
1413
+ console.log("[RegisterAndLogin] 创建临时 Apple SignIn 按钮节点");
1390
1414
  const appleSignInDiv = document.createElement("div");
1391
1415
  appleSignInDiv.id = "appleid-signin-temp";
1392
1416
  appleSignInDiv.setAttribute("data-color", "black");
@@ -1401,7 +1425,9 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
1401
1425
  appleSignInDiv.style.width = "1px";
1402
1426
  appleSignInDiv.style.height = "1px";
1403
1427
  document.body.appendChild(appleSignInDiv);
1428
+ console.log("[RegisterAndLogin] Apple SignIn 按钮已添加到文档");
1404
1429
  if ((_b = (_a = window.AppleID) == null ? void 0 : _a.auth) == null ? void 0 : _b.init) {
1430
+ console.log("[RegisterAndLogin] 调用 AppleID.auth.init");
1405
1431
  window.AppleID.auth.init({
1406
1432
  clientId: token,
1407
1433
  // 使用传入的 token 作为 clientId
@@ -1410,33 +1436,53 @@ var RegisterAndLoginImpl = class extends import_BaseModule.BaseModule {
1410
1436
  state: "signin",
1411
1437
  usePopup: true
1412
1438
  });
1439
+ } else {
1440
+ console.warn("[RegisterAndLogin] AppleID.auth.init 方法不可用");
1413
1441
  }
1414
1442
  if ((_d = (_c = window.AppleID) == null ? void 0 : _c.auth) == null ? void 0 : _d.signIn) {
1443
+ console.log("[RegisterAndLogin] 调用 AppleID.auth.signIn");
1415
1444
  window.AppleID.auth.signIn().then(async (authResult) => {
1416
1445
  var _a2, _b2;
1417
1446
  try {
1418
1447
  if (document.body.contains(appleSignInDiv)) {
1419
1448
  document.body.removeChild(appleSignInDiv);
1420
1449
  }
1450
+ console.log("[RegisterAndLogin] Apple SignIn 成功,临时节点已移除", {
1451
+ hasAuthorization: Boolean(authResult == null ? void 0 : authResult.authorization),
1452
+ hasUser: Boolean(authResult == null ? void 0 : authResult.user)
1453
+ });
1421
1454
  const authorizationCode = (_a2 = authResult.authorization) == null ? void 0 : _a2.code;
1422
1455
  const identityToken = (_b2 = authResult.authorization) == null ? void 0 : _b2.id_token;
1456
+ console.log("[RegisterAndLogin] Apple 授权结果解析", {
1457
+ hasAuthorizationCode: Boolean(authorizationCode),
1458
+ hasIdentityToken: Boolean(identityToken)
1459
+ });
1460
+ console.log("[RegisterAndLogin] 调用后端 appleLogin 接口");
1423
1461
  const result = await this.apiCaller.call("appleLogin", {
1424
- token: authorizationCode || identityToken
1462
+ code: identityToken || authorizationCode,
1463
+ login_channel: this.channel
1464
+ });
1465
+ console.log("[RegisterAndLogin] appleLogin 接口返回成功", {
1466
+ hasResult: Boolean(result)
1425
1467
  });
1426
1468
  resolve(result);
1427
1469
  } catch (error) {
1470
+ console.error("[RegisterAndLogin] 处理 Apple 登录结果失败", error);
1428
1471
  reject(error);
1429
1472
  }
1430
1473
  }).catch((error) => {
1431
1474
  if (document.body.contains(appleSignInDiv)) {
1432
1475
  document.body.removeChild(appleSignInDiv);
1433
1476
  }
1477
+ console.error("[RegisterAndLogin] Apple SignIn Promise 拒绝", error);
1434
1478
  reject(new Error("Apple 登录失败: " + ((error == null ? void 0 : error.error) || (error == null ? void 0 : error.message) || "未知错误")));
1435
1479
  });
1436
1480
  } else {
1481
+ console.error("[RegisterAndLogin] AppleID.auth.signIn 方法不可用");
1437
1482
  reject(new Error("Apple SDK 未正确加载"));
1438
1483
  }
1439
1484
  } catch (error) {
1485
+ console.error("[RegisterAndLogin] Apple 登录流程异常", error);
1440
1486
  reject(error);
1441
1487
  }
1442
1488
  });
@@ -328,6 +328,7 @@ export interface CheckMobileCodeParams {
328
328
  shop_id: number;
329
329
  code: string;
330
330
  country_calling_code: string;
331
+ action: string;
331
332
  }
332
333
  /**
333
334
  * 验证码有效性检查响应接口
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.360",
4
+ "version": "0.0.361",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",