@pisell/pisellos 0.0.360 → 0.0.362

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.
@@ -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.362",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",