@pisell/pisellos 0.0.359 → 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.
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.js +38 -9
- package/dist/solution/RegisterAndLogin/config.js +6 -4
- package/dist/solution/RegisterAndLogin/index.js +78 -28
- package/dist/solution/RegisterAndLogin/types.d.ts +1 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.js +18 -7
- package/lib/solution/BookingTicket/index.js +6 -0
- package/lib/solution/RegisterAndLogin/config.js +6 -4
- package/lib/solution/RegisterAndLogin/index.js +47 -1
- package/lib/solution/RegisterAndLogin/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -1031,9 +1031,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1031
1031
|
return !(item !== null && item !== void 0 && (_item$metadata = item.metadata) !== null && _item$metadata !== void 0 && _item$metadata.custom_product_bundle_map_id);
|
|
1032
1032
|
});
|
|
1033
1033
|
if (mainDiscountList && mainDiscountList.length > 0) {
|
|
1034
|
+
var _Decimal$minus$toNumb, _mainProductData$orig;
|
|
1034
1035
|
var allDiscountAmount = getDiscountListAmountTotal(mainDiscountList);
|
|
1035
|
-
newTotalWithDiscount = new Decimal(mainProductData.price || 0).minus(allDiscountAmount).toNumber()
|
|
1036
|
-
newOriginTotalWithDiscount = mainProductData.origin_total
|
|
1036
|
+
newTotalWithDiscount = (_Decimal$minus$toNumb = new Decimal(mainProductData.price || 0).minus(allDiscountAmount).toNumber()) !== null && _Decimal$minus$toNumb !== void 0 ? _Decimal$minus$toNumb : newTotalWithDiscount;
|
|
1037
|
+
newOriginTotalWithDiscount = (_mainProductData$orig = mainProductData.origin_total) !== null && _mainProductData$orig !== void 0 ? _mainProductData$orig : newOriginTotalWithDiscount;
|
|
1037
1038
|
}
|
|
1038
1039
|
|
|
1039
1040
|
// 累加bundle的价格(只累加一次)
|
|
@@ -1091,9 +1092,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1091
1092
|
return !(item !== null && item !== void 0 && (_item$metadata2 = item.metadata) !== null && _item$metadata2 !== void 0 && _item$metadata2.custom_product_bundle_map_id);
|
|
1092
1093
|
});
|
|
1093
1094
|
if (mainDiscountListOriginal && mainDiscountListOriginal.length > 0) {
|
|
1095
|
+
var _Decimal$minus$toNumb2, _mainProductData$orig2;
|
|
1094
1096
|
var _allDiscountAmount = getDiscountListAmount(mainDiscountListOriginal);
|
|
1095
|
-
newTotalOriginal = new Decimal(mainProductData.price || 0).minus(_allDiscountAmount).toNumber()
|
|
1096
|
-
newOriginTotalOriginal = mainProductData.origin_total
|
|
1097
|
+
newTotalOriginal = (_Decimal$minus$toNumb2 = new Decimal(mainProductData.price || 0).minus(_allDiscountAmount).toNumber()) !== null && _Decimal$minus$toNumb2 !== void 0 ? _Decimal$minus$toNumb2 : newTotalOriginal;
|
|
1098
|
+
newOriginTotalOriginal = (_mainProductData$orig2 = mainProductData.origin_total) !== null && _mainProductData$orig2 !== void 0 ? _mainProductData$orig2 : newOriginTotalOriginal;
|
|
1097
1099
|
}
|
|
1098
1100
|
|
|
1099
1101
|
// 累加bundle的价格(只累加一次)
|
|
@@ -1161,9 +1163,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1161
1163
|
|
|
1162
1164
|
// 如果是手动折扣,使用原有的total和origin_total,不重新计算
|
|
1163
1165
|
if (isManualDiscount) {
|
|
1164
|
-
var _mainProductData$tota, _mainProductData$
|
|
1166
|
+
var _mainProductData$tota, _mainProductData$orig3;
|
|
1165
1167
|
newTotal = (_mainProductData$tota = mainProductData.total) !== null && _mainProductData$tota !== void 0 ? _mainProductData$tota : newTotal;
|
|
1166
|
-
newOriginTotal = (_mainProductData$
|
|
1168
|
+
newOriginTotal = (_mainProductData$orig3 = mainProductData.origin_total) !== null && _mainProductData$orig3 !== void 0 ? _mainProductData$orig3 : newOriginTotal;
|
|
1167
1169
|
} else {
|
|
1168
1170
|
// 不是手动折扣时,才重新计算
|
|
1169
1171
|
var _mainDiscountList = mainProductData.discount_list.filter(function (item) {
|
|
@@ -1173,9 +1175,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1173
1175
|
|
|
1174
1176
|
// 如果主商品本身有折扣,需要重新计算主商品价格
|
|
1175
1177
|
if (_mainDiscountList && _mainDiscountList.length > 0) {
|
|
1178
|
+
var _Decimal$minus$toNumb3, _mainProductData$orig4;
|
|
1176
1179
|
var _allDiscountAmount2 = getDiscountListAmount(_mainDiscountList);
|
|
1177
|
-
newTotal = new Decimal(mainProductData.price || 0).minus(_allDiscountAmount2).toNumber()
|
|
1178
|
-
newOriginTotal = mainProductData.origin_total
|
|
1180
|
+
newTotal = (_Decimal$minus$toNumb3 = new Decimal(mainProductData.price || 0).minus(_allDiscountAmount2).toNumber()) !== null && _Decimal$minus$toNumb3 !== void 0 ? _Decimal$minus$toNumb3 : newTotal;
|
|
1181
|
+
newOriginTotal = (_mainProductData$orig4 = mainProductData.origin_total) !== null && _mainProductData$orig4 !== void 0 ? _mainProductData$orig4 : newOriginTotal;
|
|
1179
1182
|
}
|
|
1180
1183
|
|
|
1181
1184
|
// 累加bundle的价格(只累加一次)
|
|
@@ -1356,8 +1359,34 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1356
1359
|
// 套餐中购买时,判断是否为原价
|
|
1357
1360
|
var _priceType = (_flatItem$bundleItem7 = flatItem.bundleItem) === null || _flatItem$bundleItem7 === void 0 ? void 0 : _flatItem$bundleItem7.price_type;
|
|
1358
1361
|
var _priceTypeExt = (_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.price_type_ext;
|
|
1362
|
+
|
|
1363
|
+
// original_price 对应:
|
|
1364
|
+
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
1365
|
+
// markup_price 对应:
|
|
1366
|
+
// price_type: "markup" && price_type_ext: ""
|
|
1367
|
+
/** 原价 */
|
|
1368
|
+
var _isOriginalPrice = _priceType === 'markup' && _priceTypeExt === 'product_price';
|
|
1369
|
+
/** 加价 */
|
|
1370
|
+
var _isMarkupPrice = _priceType === 'markup' && (_priceTypeExt === '' || !_priceTypeExt);
|
|
1371
|
+
|
|
1372
|
+
// 检查 rules
|
|
1373
|
+
if (rules.length > 0) {
|
|
1374
|
+
// 检查原价
|
|
1375
|
+
if (_isOriginalPrice && rules.includes('original_price')) {
|
|
1376
|
+
return true;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
// 检查加价
|
|
1380
|
+
if (_isMarkupPrice && rules.includes('markup_price')) {
|
|
1381
|
+
return true;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
// 如果都不匹配,则不可用
|
|
1385
|
+
return false;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1359
1388
|
// 原价包括:price_type: "markup" && price_type_ext: "product_price"
|
|
1360
|
-
return
|
|
1389
|
+
return _isOriginalPrice;
|
|
1361
1390
|
}
|
|
1362
1391
|
return false;
|
|
1363
1392
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 =
|
|
2276
|
+
_context34.next = 17;
|
|
2265
2277
|
break;
|
|
2266
2278
|
}
|
|
2267
|
-
_context34.prev =
|
|
2268
|
-
|
|
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
|
|
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 =
|
|
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.
|
|
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
|
|
2302
|
+
case 17:
|
|
2303
|
+
console.warn('[RegisterAndLogin] FB.login 用户取消授权或无 authResponse', response);
|
|
2285
2304
|
reject(new Error('facebook_login_cancel'));
|
|
2286
|
-
case
|
|
2305
|
+
case 19:
|
|
2287
2306
|
case "end":
|
|
2288
2307
|
return _context34.stop();
|
|
2289
2308
|
}
|
|
2290
|
-
}, _callee34, null, [[
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
2419
|
+
code: identityToken || authorizationCode,
|
|
2420
|
+
login_channel: _this3.channel
|
|
2378
2421
|
});
|
|
2379
|
-
case
|
|
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 =
|
|
2428
|
+
_context36.next = 18;
|
|
2383
2429
|
break;
|
|
2384
|
-
case
|
|
2385
|
-
_context36.prev =
|
|
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
|
|
2435
|
+
case 18:
|
|
2389
2436
|
case "end":
|
|
2390
2437
|
return _context36.stop();
|
|
2391
2438
|
}
|
|
2392
|
-
}, _callee36, null, [[0,
|
|
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
|
|
2461
|
+
case 5:
|
|
2412
2462
|
case "end":
|
|
2413
2463
|
return _context37.stop();
|
|
2414
2464
|
}
|
|
@@ -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(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -780,8 +780,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
780
780
|
});
|
|
781
781
|
if (mainDiscountList && mainDiscountList.length > 0) {
|
|
782
782
|
const allDiscountAmount = (0, import_utils.getDiscountListAmountTotal)(mainDiscountList);
|
|
783
|
-
newTotalWithDiscount = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber()
|
|
784
|
-
newOriginTotalWithDiscount = mainProductData.origin_total
|
|
783
|
+
newTotalWithDiscount = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber() ?? newTotalWithDiscount;
|
|
784
|
+
newOriginTotalWithDiscount = mainProductData.origin_total ?? newOriginTotalWithDiscount;
|
|
785
785
|
}
|
|
786
786
|
if (newBundleWithDiscount.length > 0) {
|
|
787
787
|
newBundleWithDiscount.forEach((item) => {
|
|
@@ -830,8 +830,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
830
830
|
});
|
|
831
831
|
if (mainDiscountListOriginal && mainDiscountListOriginal.length > 0) {
|
|
832
832
|
const allDiscountAmount = (0, import_utils.getDiscountListAmount)(mainDiscountListOriginal);
|
|
833
|
-
newTotalOriginal = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber()
|
|
834
|
-
newOriginTotalOriginal = mainProductData.origin_total
|
|
833
|
+
newTotalOriginal = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber() ?? newTotalOriginal;
|
|
834
|
+
newOriginTotalOriginal = mainProductData.origin_total ?? newOriginTotalOriginal;
|
|
835
835
|
}
|
|
836
836
|
if (newBundleOriginal.length > 0) {
|
|
837
837
|
newBundleOriginal.forEach((item) => {
|
|
@@ -894,8 +894,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
894
894
|
});
|
|
895
895
|
if (mainDiscountList && mainDiscountList.length > 0) {
|
|
896
896
|
const allDiscountAmount = (0, import_utils.getDiscountListAmount)(mainDiscountList);
|
|
897
|
-
newTotal = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber()
|
|
898
|
-
newOriginTotal = mainProductData.origin_total
|
|
897
|
+
newTotal = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber() ?? newTotal;
|
|
898
|
+
newOriginTotal = mainProductData.origin_total ?? newOriginTotal;
|
|
899
899
|
}
|
|
900
900
|
if (newBundle.length > 0) {
|
|
901
901
|
newBundle.forEach((item) => {
|
|
@@ -1036,7 +1036,18 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1036
1036
|
if (isBundleItem) {
|
|
1037
1037
|
const priceType = (_c = flatItem.bundleItem) == null ? void 0 : _c.price_type;
|
|
1038
1038
|
const priceTypeExt = (_d = flatItem.bundleItem) == null ? void 0 : _d.price_type_ext;
|
|
1039
|
-
|
|
1039
|
+
const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
|
|
1040
|
+
const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
|
|
1041
|
+
if (rules.length > 0) {
|
|
1042
|
+
if (isOriginalPrice && rules.includes("original_price")) {
|
|
1043
|
+
return true;
|
|
1044
|
+
}
|
|
1045
|
+
if (isMarkupPrice && rules.includes("markup_price")) {
|
|
1046
|
+
return true;
|
|
1047
|
+
}
|
|
1048
|
+
return false;
|
|
1049
|
+
}
|
|
1050
|
+
return isOriginalPrice;
|
|
1040
1051
|
}
|
|
1041
1052
|
return false;
|
|
1042
1053
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
});
|