@pisell/private-materials 3.2.7 → 3.2.8
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +3 -3
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +3 -3
- package/es/components/wallet/Detail/index.js +57 -62
- package/es/components/wallet/Detail/locales.d.ts +24 -0
- package/es/components/wallet/Detail/locales.js +27 -3
- package/es/components/wallet/components/FooterButtons/index.d.ts +1 -0
- package/es/components/wallet/components/FooterButtons/index.js +4 -1
- package/es/components/wallet/components/FooterButtons/index.less +16 -2
- package/es/components/wallet/locales.d.ts +3 -0
- package/es/components/wallet/locales.js +6 -3
- package/es/components/walletList/index.js +0 -1
- package/lib/components/wallet/Detail/index.js +35 -58
- package/lib/components/wallet/Detail/locales.d.ts +24 -0
- package/lib/components/wallet/Detail/locales.js +27 -3
- package/lib/components/wallet/components/FooterButtons/index.d.ts +1 -0
- package/lib/components/wallet/components/FooterButtons/index.js +3 -1
- package/lib/components/wallet/components/FooterButtons/index.less +16 -2
- package/lib/components/wallet/locales.d.ts +3 -0
- package/lib/components/wallet/locales.js +6 -3
- package/lib/components/walletList/index.js +0 -1
- package/package.json +4 -4
|
@@ -114,6 +114,14 @@ var Detail = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
114
114
|
setIsScrolling = _useState24[1];
|
|
115
115
|
var isUserClickRef = useRef(false);
|
|
116
116
|
var scrollTimeoutRef = useRef(null);
|
|
117
|
+
var _useState25 = useState(false),
|
|
118
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
119
|
+
addWalletLoading = _useState26[0],
|
|
120
|
+
setAddWalletLoading = _useState26[1];
|
|
121
|
+
var _useState27 = useState(false),
|
|
122
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
123
|
+
isAddingToWallet = _useState28[0],
|
|
124
|
+
setIsAddingToWallet = _useState28[1];
|
|
117
125
|
var anchorOptions = useMemo(function () {
|
|
118
126
|
// 始终包含detail选项
|
|
119
127
|
var options = [{
|
|
@@ -344,99 +352,85 @@ var Detail = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
344
352
|
* 添加钱包卡片的公共函数
|
|
345
353
|
* @param url 钱包卡片URL
|
|
346
354
|
* @param type 钱包类型('apple'或'google')
|
|
347
|
-
* @returns Promise<
|
|
355
|
+
* @returns Promise<boolean> 是否添加成功
|
|
348
356
|
*/
|
|
349
357
|
var addWalletPass = /*#__PURE__*/function () {
|
|
350
358
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(url, type) {
|
|
351
|
-
var response, passData,
|
|
359
|
+
var response, passData, blob, downloadUrl, a;
|
|
352
360
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
353
361
|
while (1) switch (_context3.prev = _context3.next) {
|
|
354
362
|
case 0:
|
|
355
363
|
if (url) {
|
|
356
|
-
_context3.next =
|
|
364
|
+
_context3.next = 3;
|
|
357
365
|
break;
|
|
358
366
|
}
|
|
359
|
-
|
|
360
|
-
|
|
367
|
+
PisellToast({
|
|
368
|
+
content: locales.getText('page.wallet.urlEmpty') || '钱包链接为空',
|
|
369
|
+
duration: 2
|
|
370
|
+
});
|
|
371
|
+
return _context3.abrupt("return", false);
|
|
372
|
+
case 3:
|
|
361
373
|
if (!isWechat()) {
|
|
362
|
-
_context3.next =
|
|
374
|
+
_context3.next = 7;
|
|
363
375
|
break;
|
|
364
376
|
}
|
|
365
377
|
setWechatModalOpen(true);
|
|
366
378
|
setCopyUrl(url);
|
|
367
|
-
return _context3.abrupt("return");
|
|
368
|
-
case
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
// 根据不同类型处理不同API
|
|
379
|
+
return _context3.abrupt("return", false);
|
|
380
|
+
case 7:
|
|
381
|
+
setAddWalletLoading(true);
|
|
382
|
+
_context3.prev = 8;
|
|
372
383
|
if (!(type === 'apple')) {
|
|
373
|
-
_context3.next =
|
|
384
|
+
_context3.next = 27;
|
|
374
385
|
break;
|
|
375
386
|
}
|
|
376
|
-
_context3.prev = 9;
|
|
377
387
|
_context3.next = 12;
|
|
378
|
-
return fetch(
|
|
388
|
+
return fetch(url);
|
|
379
389
|
case 12:
|
|
380
390
|
response = _context3.sent;
|
|
381
|
-
|
|
382
|
-
|
|
391
|
+
if (response.ok) {
|
|
392
|
+
_context3.next = 15;
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
396
|
+
case 15:
|
|
383
397
|
_context3.next = 17;
|
|
384
398
|
return response.arrayBuffer();
|
|
385
399
|
case 17:
|
|
386
400
|
passData = _context3.sent;
|
|
387
|
-
console.log('%c [ passData ]-402', 'font-size:13px; color:#bf2c9f;', passData);
|
|
388
|
-
console.log('%c [ window.PKPass ]-404', 'font-size:13px; color:#bf2c9f;', window.PKPass);
|
|
389
|
-
// 2. 调用 Web PKI API
|
|
390
|
-
|
|
391
|
-
alert(window.PKPass + 'window.PKPass');
|
|
392
|
-
alert(navigator.pkpass + 'navigator.pkpass');
|
|
393
|
-
if (!(window.PKPass && navigator.pkpass)) {
|
|
394
|
-
_context3.next = 30;
|
|
395
|
-
break;
|
|
396
|
-
}
|
|
397
|
-
_pass = new window.PKPass(passData);
|
|
398
|
-
_context3.next = 26;
|
|
399
|
-
return navigator.pkpass.addPass(_pass);
|
|
400
|
-
case 26:
|
|
401
|
-
result = _context3.sent;
|
|
402
|
-
// 3. 根据结果触发自定义事件
|
|
403
|
-
if (result === 'added') {
|
|
404
|
-
console.log('Pass 添加成功!');
|
|
405
|
-
// 触发自定义事件,例如发送分析、更新UI等
|
|
406
|
-
window.dispatchEvent(new CustomEvent('passAdded'));
|
|
407
|
-
} else {
|
|
408
|
-
console.log('用户取消了操作');
|
|
409
|
-
}
|
|
410
|
-
_context3.next = 39;
|
|
411
|
-
break;
|
|
412
|
-
case 30:
|
|
413
|
-
alert('浏览器不支持 Web PKI');
|
|
414
|
-
// 浏览器不支持 Web PKI,回退到直接下载
|
|
415
401
|
blob = new Blob([passData], {
|
|
416
402
|
type: 'application/vnd.apple.pkpass'
|
|
417
403
|
});
|
|
418
|
-
|
|
404
|
+
downloadUrl = URL.createObjectURL(blob);
|
|
419
405
|
a = document.createElement('a');
|
|
420
|
-
|
|
421
|
-
a.href = _url;
|
|
406
|
+
a.href = downloadUrl;
|
|
422
407
|
a.download = 'pass.pkpass';
|
|
423
408
|
a.click();
|
|
424
|
-
URL.revokeObjectURL(
|
|
425
|
-
|
|
426
|
-
_context3.next = 44;
|
|
409
|
+
URL.revokeObjectURL(downloadUrl); // 清理创建的URL
|
|
410
|
+
_context3.next = 28;
|
|
427
411
|
break;
|
|
428
|
-
case
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
case 44:
|
|
433
|
-
_context3.next = 46;
|
|
412
|
+
case 27:
|
|
413
|
+
window.open(url);
|
|
414
|
+
case 28:
|
|
415
|
+
_context3.next = 34;
|
|
434
416
|
break;
|
|
435
|
-
case
|
|
417
|
+
case 30:
|
|
418
|
+
_context3.prev = 30;
|
|
419
|
+
_context3.t0 = _context3["catch"](8);
|
|
420
|
+
console.error('Failed to add wallet:', _context3.t0);
|
|
421
|
+
PisellToast({
|
|
422
|
+
content: locales.getText('page.wallet.error.addFailed'),
|
|
423
|
+
duration: 3
|
|
424
|
+
});
|
|
425
|
+
case 34:
|
|
426
|
+
_context3.prev = 34;
|
|
427
|
+
setAddWalletLoading(false);
|
|
428
|
+
return _context3.finish(34);
|
|
429
|
+
case 37:
|
|
436
430
|
case "end":
|
|
437
431
|
return _context3.stop();
|
|
438
432
|
}
|
|
439
|
-
}, _callee3, null, [[
|
|
433
|
+
}, _callee3, null, [[8, 30, 34, 37]]);
|
|
440
434
|
}));
|
|
441
435
|
return function addWalletPass(_x, _x2) {
|
|
442
436
|
return _ref4.apply(this, arguments);
|
|
@@ -718,10 +712,10 @@ var Detail = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
718
712
|
|
|
719
713
|
// 添加ref用于获取容器元素
|
|
720
714
|
var detailWrapperRef = useRef(null);
|
|
721
|
-
var
|
|
722
|
-
|
|
723
|
-
contentHeight =
|
|
724
|
-
setContentHeight =
|
|
715
|
+
var _useState29 = useState(undefined),
|
|
716
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
|
717
|
+
contentHeight = _useState30[0],
|
|
718
|
+
setContentHeight = _useState30[1];
|
|
725
719
|
|
|
726
720
|
// 添加锚点导航ref
|
|
727
721
|
var anchorWrapperRef = useRef(null);
|
|
@@ -889,6 +883,7 @@ var Detail = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
889
883
|
className: "wallet-detail-card-content-section-empty"
|
|
890
884
|
}, /*#__PURE__*/React.createElement(PisellEmpty, null))))))), platform === 'h5' && /*#__PURE__*/React.createElement(FooterButtons, {
|
|
891
885
|
step: "detail",
|
|
886
|
+
addWalletLoading: addWalletLoading,
|
|
892
887
|
onAppleWalletClick: tag === 'gift_card' ? addWalletCard : undefined,
|
|
893
888
|
onRechargeClick: tag === 'gift_card' && (detail === null || detail === void 0 || (_detail$machinecode_c = detail.machinecode_config) === null || _detail$machinecode_c === void 0 ? void 0 : _detail$machinecode_c.hide_recharge) === 0 ? handleRecharge : undefined,
|
|
894
889
|
platform: platform,
|
|
@@ -21,6 +21,14 @@ declare const _default: {
|
|
|
21
21
|
'page.wallet.addGoogle': string;
|
|
22
22
|
'page.wallet.viewDetails': string;
|
|
23
23
|
'page.wallet.expireDate': string;
|
|
24
|
+
'page.wallet.urlEmpty': string;
|
|
25
|
+
'page.wallet.notIOS': string;
|
|
26
|
+
'page.wallet.addSuccess': string;
|
|
27
|
+
'page.wallet.addFailed': string;
|
|
28
|
+
'page.wallet.useAppleInstead': string;
|
|
29
|
+
'page.wallet.openedInBrowser': string;
|
|
30
|
+
'page.wallet.openFailed': string;
|
|
31
|
+
'page.wallet.loading': string;
|
|
24
32
|
};
|
|
25
33
|
'zh-CN': {
|
|
26
34
|
'page.wallet.copyTitle': string;
|
|
@@ -44,6 +52,14 @@ declare const _default: {
|
|
|
44
52
|
'page.wallet.addGoogle': string;
|
|
45
53
|
'page.wallet.viewDetails': string;
|
|
46
54
|
'page.wallet.expireDate': string;
|
|
55
|
+
'page.wallet.urlEmpty': string;
|
|
56
|
+
'page.wallet.notIOS': string;
|
|
57
|
+
'page.wallet.addSuccess': string;
|
|
58
|
+
'page.wallet.addFailed': string;
|
|
59
|
+
'page.wallet.useAppleInstead': string;
|
|
60
|
+
'page.wallet.openedInBrowser': string;
|
|
61
|
+
'page.wallet.openFailed': string;
|
|
62
|
+
'page.wallet.loading': string;
|
|
47
63
|
};
|
|
48
64
|
'zh-HK': {
|
|
49
65
|
'page.wallet.copyTitle': string;
|
|
@@ -67,6 +83,14 @@ declare const _default: {
|
|
|
67
83
|
'page.wallet.addGoogle': string;
|
|
68
84
|
'page.wallet.viewDetails': string;
|
|
69
85
|
'page.wallet.expireDate': string;
|
|
86
|
+
'page.wallet.urlEmpty': string;
|
|
87
|
+
'page.wallet.notIOS': string;
|
|
88
|
+
'page.wallet.addSuccess': string;
|
|
89
|
+
'page.wallet.addFailed': string;
|
|
90
|
+
'page.wallet.useAppleInstead': string;
|
|
91
|
+
'page.wallet.openedInBrowser': string;
|
|
92
|
+
'page.wallet.openFailed': string;
|
|
93
|
+
'page.wallet.loading': string;
|
|
70
94
|
};
|
|
71
95
|
};
|
|
72
96
|
export default _default;
|
|
@@ -23,7 +23,15 @@ export default {
|
|
|
23
23
|
'page.wallet.addIos': 'Add to Apple Wallet',
|
|
24
24
|
'page.wallet.addGoogle': 'Add to Google Wallet',
|
|
25
25
|
'page.wallet.viewDetails': 'See details',
|
|
26
|
-
'page.wallet.expireDate': 'Long term'
|
|
26
|
+
'page.wallet.expireDate': 'Long term',
|
|
27
|
+
'page.wallet.urlEmpty': 'Wallet link is empty',
|
|
28
|
+
'page.wallet.notIOS': 'Apple Wallet is not supported on non-iOS devices',
|
|
29
|
+
'page.wallet.addSuccess': 'Successfully added to wallet',
|
|
30
|
+
'page.wallet.addFailed': 'Failed to add to wallet',
|
|
31
|
+
'page.wallet.useAppleInstead': 'You are using an iOS device, would you like to use Apple Wallet instead of Google Wallet?',
|
|
32
|
+
'page.wallet.openedInBrowser': 'Opened in browser',
|
|
33
|
+
'page.wallet.openFailed': 'Failed to open wallet link',
|
|
34
|
+
'page.wallet.loading': 'Loading wallet...'
|
|
27
35
|
},
|
|
28
36
|
'zh-CN': {
|
|
29
37
|
// 简体中文翻译
|
|
@@ -49,7 +57,15 @@ export default {
|
|
|
49
57
|
'page.wallet.addIos': '添加到苹果钱包',
|
|
50
58
|
'page.wallet.addGoogle': '添加到谷歌钱包',
|
|
51
59
|
'page.wallet.viewDetails': '查看详情',
|
|
52
|
-
'page.wallet.expireDate': '长期'
|
|
60
|
+
'page.wallet.expireDate': '长期',
|
|
61
|
+
'page.wallet.urlEmpty': '钱包链接为空',
|
|
62
|
+
'page.wallet.notIOS': '非iOS设备不支持Apple Wallet',
|
|
63
|
+
'page.wallet.addSuccess': '已成功添加到钱包',
|
|
64
|
+
'page.wallet.addFailed': '添加钱包失败',
|
|
65
|
+
'page.wallet.useAppleInstead': '您正在使用iOS设备,是否使用Apple Wallet代替Google Wallet?',
|
|
66
|
+
'page.wallet.openedInBrowser': '已在浏览器中打开',
|
|
67
|
+
'page.wallet.openFailed': '打开钱包链接失败',
|
|
68
|
+
'page.wallet.loading': '正在加载钱包...'
|
|
53
69
|
},
|
|
54
70
|
'zh-HK': {
|
|
55
71
|
// 繁体中文翻译
|
|
@@ -75,6 +91,14 @@ export default {
|
|
|
75
91
|
'page.wallet.addIos': '添加到蘋果錢包',
|
|
76
92
|
'page.wallet.addGoogle': '添加到谷歌錢包',
|
|
77
93
|
'page.wallet.viewDetails': '查看詳情',
|
|
78
|
-
'page.wallet.expireDate': '長期'
|
|
94
|
+
'page.wallet.expireDate': '長期',
|
|
95
|
+
'page.wallet.urlEmpty': '錢包連結為空',
|
|
96
|
+
'page.wallet.notIOS': '非iOS設備不支持Apple Wallet',
|
|
97
|
+
'page.wallet.addSuccess': '已成功添加到錢包',
|
|
98
|
+
'page.wallet.addFailed': '添加錢包失敗',
|
|
99
|
+
'page.wallet.useAppleInstead': '您正在使用iOS設備,是否使用Apple Wallet代替Google Wallet?',
|
|
100
|
+
'page.wallet.openedInBrowser': '已在瀏覽器中打開',
|
|
101
|
+
'page.wallet.openFailed': '打開錢包連結失敗',
|
|
102
|
+
'page.wallet.loading': '正在加載錢包...'
|
|
79
103
|
}
|
|
80
104
|
};
|
|
@@ -16,7 +16,9 @@ var FooterButtons = function FooterButtons(_ref) {
|
|
|
16
16
|
_ref$platform = _ref.platform,
|
|
17
17
|
platform = _ref$platform === void 0 ? 'h5' : _ref$platform,
|
|
18
18
|
_ref$isIOS = _ref.isIOS,
|
|
19
|
-
isIOS = _ref$isIOS === void 0 ? false : _ref$isIOS
|
|
19
|
+
isIOS = _ref$isIOS === void 0 ? false : _ref$isIOS,
|
|
20
|
+
_ref$addWalletLoading = _ref.addWalletLoading,
|
|
21
|
+
addWalletLoading = _ref$addWalletLoading === void 0 ? false : _ref$addWalletLoading;
|
|
20
22
|
// 如果是PC端,部分页面可能不需要底部按钮
|
|
21
23
|
if (platform === 'pc') {
|
|
22
24
|
return null; // PC端不显示底部固定按钮
|
|
@@ -41,6 +43,7 @@ var FooterButtons = function FooterButtons(_ref) {
|
|
|
41
43
|
// 添加到钱包按钮
|
|
42
44
|
if (onAppleWalletClick) {
|
|
43
45
|
buttons.push( /*#__PURE__*/React.createElement(Button, {
|
|
46
|
+
loading: addWalletLoading,
|
|
44
47
|
key: "apple-wallet",
|
|
45
48
|
onClick: onAppleWalletClick,
|
|
46
49
|
disabled: disabled,
|
|
@@ -11,9 +11,23 @@
|
|
|
11
11
|
display: flex;
|
|
12
12
|
gap: 12px;
|
|
13
13
|
width: 100%;
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
.wallet-footer-buttons-item-secondary{
|
|
15
17
|
overflow: hidden;
|
|
16
|
-
|
|
18
|
+
display: flex;
|
|
19
|
+
>span{
|
|
20
|
+
display: block;
|
|
21
|
+
// width: 100%;
|
|
22
|
+
flex:1;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
text-overflow: ellipsis;
|
|
26
|
+
text-wrap: nowrap;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
17
31
|
// 按钮数量样式
|
|
18
32
|
// 单个按钮占满宽度
|
|
19
33
|
&-count-1 {
|
|
@@ -39,6 +39,7 @@ declare const _default: {
|
|
|
39
39
|
'page.wallet.button.addToAppleWallet': string;
|
|
40
40
|
'page.wallet.button.addToGoogleWallet': string;
|
|
41
41
|
'page.wallet.button.recharge': string;
|
|
42
|
+
'page.wallet.error.addFailed': string;
|
|
42
43
|
};
|
|
43
44
|
'zh-CN': {
|
|
44
45
|
'page.wallet.rechargeableCard': string;
|
|
@@ -80,6 +81,7 @@ declare const _default: {
|
|
|
80
81
|
'page.wallet.button.addToAppleWallet': string;
|
|
81
82
|
'page.wallet.button.addToGoogleWallet': string;
|
|
82
83
|
'page.wallet.button.recharge': string;
|
|
84
|
+
'page.wallet.error.addFailed': string;
|
|
83
85
|
};
|
|
84
86
|
'zh-HK': {
|
|
85
87
|
'page.wallet.rechargeableCard': string;
|
|
@@ -121,6 +123,7 @@ declare const _default: {
|
|
|
121
123
|
'page.wallet.button.addToAppleWallet': string;
|
|
122
124
|
'page.wallet.button.addToGoogleWallet': string;
|
|
123
125
|
'page.wallet.button.recharge': string;
|
|
126
|
+
'page.wallet.error.addFailed': string;
|
|
124
127
|
};
|
|
125
128
|
};
|
|
126
129
|
export default _default;
|
|
@@ -41,7 +41,8 @@ export default {
|
|
|
41
41
|
'page.wallet.button.add': 'Add',
|
|
42
42
|
'page.wallet.button.addToAppleWallet': 'Add to Apple Wallet',
|
|
43
43
|
'page.wallet.button.addToGoogleWallet': 'Add to Google Wallet',
|
|
44
|
-
'page.wallet.button.recharge': 'Recharge'
|
|
44
|
+
'page.wallet.button.recharge': 'Recharge',
|
|
45
|
+
'page.wallet.error.addFailed': 'Add failed, please try again.'
|
|
45
46
|
},
|
|
46
47
|
'zh-CN': {
|
|
47
48
|
// Simplified Chinese translations
|
|
@@ -85,7 +86,8 @@ export default {
|
|
|
85
86
|
'page.wallet.button.add': '添加',
|
|
86
87
|
'page.wallet.button.addToAppleWallet': '添加到苹果钱包',
|
|
87
88
|
'page.wallet.button.addToGoogleWallet': '添加到Google钱包',
|
|
88
|
-
'page.wallet.button.recharge': '充值'
|
|
89
|
+
'page.wallet.button.recharge': '充值',
|
|
90
|
+
'page.wallet.error.addFailed': '添加钱包失败,请重试。'
|
|
89
91
|
},
|
|
90
92
|
'zh-HK': {
|
|
91
93
|
'page.wallet.rechargeableCard': '充值卡',
|
|
@@ -128,6 +130,7 @@ export default {
|
|
|
128
130
|
'page.wallet.button.add': '添加',
|
|
129
131
|
'page.wallet.button.addToAppleWallet': '添加到蘋果錢包',
|
|
130
132
|
'page.wallet.button.addToGoogleWallet': '添加到Google錢包',
|
|
131
|
-
'page.wallet.button.recharge': '充值'
|
|
133
|
+
'page.wallet.button.recharge': '充值',
|
|
134
|
+
'page.wallet.error.addFailed': '添加錢包失敗,請重試。'
|
|
132
135
|
}
|
|
133
136
|
};
|
|
@@ -88,6 +88,8 @@ var Detail = (0, import_react.forwardRef)((props, ref) => {
|
|
|
88
88
|
const [isScrolling, setIsScrolling] = (0, import_react.useState)(false);
|
|
89
89
|
const isUserClickRef = (0, import_react.useRef)(false);
|
|
90
90
|
const scrollTimeoutRef = (0, import_react.useRef)(null);
|
|
91
|
+
const [addWalletLoading, setAddWalletLoading] = (0, import_react.useState)(false);
|
|
92
|
+
const [isAddingToWallet, setIsAddingToWallet] = (0, import_react.useState)(false);
|
|
91
93
|
const anchorOptions = (0, import_react.useMemo)(
|
|
92
94
|
() => {
|
|
93
95
|
const options = [
|
|
@@ -247,70 +249,44 @@ var Detail = (0, import_react.forwardRef)((props, ref) => {
|
|
|
247
249
|
}
|
|
248
250
|
}, [code]);
|
|
249
251
|
const addWalletPass = async (url, type) => {
|
|
250
|
-
if (!url)
|
|
252
|
+
if (!url) {
|
|
253
|
+
(0, import_materials2.PisellToast)({
|
|
254
|
+
content: import_utils.locales.getText("page.wallet.urlEmpty") || "钱包链接为空",
|
|
255
|
+
duration: 2
|
|
256
|
+
});
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
251
259
|
if (isWechat()) {
|
|
252
260
|
setWechatModalOpen(true);
|
|
253
261
|
setCopyUrl(url);
|
|
254
|
-
return;
|
|
262
|
+
return false;
|
|
255
263
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
"
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
"%c [ navigator.pkpass ]-396",
|
|
263
|
-
"font-size:13px; color:#bf2c9f;",
|
|
264
|
-
navigator.pkpass
|
|
265
|
-
);
|
|
266
|
-
if (type === "apple") {
|
|
267
|
-
try {
|
|
268
|
-
const response = await fetch("/generate-pass");
|
|
269
|
-
alert(response);
|
|
270
|
-
console.log(
|
|
271
|
-
"%c [ response ]-400",
|
|
272
|
-
"font-size:13px; color:#bf2c9f;",
|
|
273
|
-
response
|
|
274
|
-
);
|
|
275
|
-
const passData = await response.arrayBuffer();
|
|
276
|
-
console.log(
|
|
277
|
-
"%c [ passData ]-402",
|
|
278
|
-
"font-size:13px; color:#bf2c9f;",
|
|
279
|
-
passData
|
|
280
|
-
);
|
|
281
|
-
console.log(
|
|
282
|
-
"%c [ window.PKPass ]-404",
|
|
283
|
-
"font-size:13px; color:#bf2c9f;",
|
|
284
|
-
window.PKPass
|
|
285
|
-
);
|
|
286
|
-
alert(window.PKPass + "window.PKPass");
|
|
287
|
-
alert(navigator.pkpass + "navigator.pkpass");
|
|
288
|
-
if (window.PKPass && navigator.pkpass) {
|
|
289
|
-
const pass = new window.PKPass(passData);
|
|
290
|
-
const result = await navigator.pkpass.addPass(pass);
|
|
291
|
-
if (result === "added") {
|
|
292
|
-
console.log("Pass 添加成功!");
|
|
293
|
-
window.dispatchEvent(new CustomEvent("passAdded"));
|
|
294
|
-
} else {
|
|
295
|
-
console.log("用户取消了操作");
|
|
296
|
-
}
|
|
297
|
-
} else {
|
|
298
|
-
alert("浏览器不支持 Web PKI");
|
|
299
|
-
const blob = new Blob([passData], {
|
|
300
|
-
type: "application/vnd.apple.pkpass"
|
|
301
|
-
});
|
|
302
|
-
const url2 = URL.createObjectURL(blob);
|
|
303
|
-
const a = document.createElement("a");
|
|
304
|
-
alert(url2 + "url");
|
|
305
|
-
a.href = url2;
|
|
306
|
-
a.download = "pass.pkpass";
|
|
307
|
-
a.click();
|
|
308
|
-
URL.revokeObjectURL(url2);
|
|
264
|
+
setAddWalletLoading(true);
|
|
265
|
+
try {
|
|
266
|
+
if (type === "apple") {
|
|
267
|
+
const response = await fetch(url);
|
|
268
|
+
if (!response.ok) {
|
|
269
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
309
270
|
}
|
|
310
|
-
|
|
311
|
-
|
|
271
|
+
const passData = await response.arrayBuffer();
|
|
272
|
+
const blob = new Blob([passData], { type: "application/vnd.apple.pkpass" });
|
|
273
|
+
const downloadUrl = URL.createObjectURL(blob);
|
|
274
|
+
const a = document.createElement("a");
|
|
275
|
+
a.href = downloadUrl;
|
|
276
|
+
a.download = "pass.pkpass";
|
|
277
|
+
a.click();
|
|
278
|
+
URL.revokeObjectURL(downloadUrl);
|
|
279
|
+
} else {
|
|
280
|
+
window.open(url);
|
|
312
281
|
}
|
|
313
|
-
}
|
|
282
|
+
} catch (error) {
|
|
283
|
+
console.error("Failed to add wallet:", error);
|
|
284
|
+
(0, import_materials2.PisellToast)({
|
|
285
|
+
content: import_utils.locales.getText("page.wallet.error.addFailed"),
|
|
286
|
+
duration: 3
|
|
287
|
+
});
|
|
288
|
+
} finally {
|
|
289
|
+
setAddWalletLoading(false);
|
|
314
290
|
}
|
|
315
291
|
};
|
|
316
292
|
const onAppleClick = async () => {
|
|
@@ -649,6 +625,7 @@ var Detail = (0, import_react.forwardRef)((props, ref) => {
|
|
|
649
625
|
import_components.FooterButtons,
|
|
650
626
|
{
|
|
651
627
|
step: "detail",
|
|
628
|
+
addWalletLoading,
|
|
652
629
|
onAppleWalletClick: tag === "gift_card" ? addWalletCard : void 0,
|
|
653
630
|
onRechargeClick: tag === "gift_card" && ((_j = detail == null ? void 0 : detail.machinecode_config) == null ? void 0 : _j.hide_recharge) === 0 ? handleRecharge : void 0,
|
|
654
631
|
platform,
|
|
@@ -21,6 +21,14 @@ declare const _default: {
|
|
|
21
21
|
'page.wallet.addGoogle': string;
|
|
22
22
|
'page.wallet.viewDetails': string;
|
|
23
23
|
'page.wallet.expireDate': string;
|
|
24
|
+
'page.wallet.urlEmpty': string;
|
|
25
|
+
'page.wallet.notIOS': string;
|
|
26
|
+
'page.wallet.addSuccess': string;
|
|
27
|
+
'page.wallet.addFailed': string;
|
|
28
|
+
'page.wallet.useAppleInstead': string;
|
|
29
|
+
'page.wallet.openedInBrowser': string;
|
|
30
|
+
'page.wallet.openFailed': string;
|
|
31
|
+
'page.wallet.loading': string;
|
|
24
32
|
};
|
|
25
33
|
'zh-CN': {
|
|
26
34
|
'page.wallet.copyTitle': string;
|
|
@@ -44,6 +52,14 @@ declare const _default: {
|
|
|
44
52
|
'page.wallet.addGoogle': string;
|
|
45
53
|
'page.wallet.viewDetails': string;
|
|
46
54
|
'page.wallet.expireDate': string;
|
|
55
|
+
'page.wallet.urlEmpty': string;
|
|
56
|
+
'page.wallet.notIOS': string;
|
|
57
|
+
'page.wallet.addSuccess': string;
|
|
58
|
+
'page.wallet.addFailed': string;
|
|
59
|
+
'page.wallet.useAppleInstead': string;
|
|
60
|
+
'page.wallet.openedInBrowser': string;
|
|
61
|
+
'page.wallet.openFailed': string;
|
|
62
|
+
'page.wallet.loading': string;
|
|
47
63
|
};
|
|
48
64
|
'zh-HK': {
|
|
49
65
|
'page.wallet.copyTitle': string;
|
|
@@ -67,6 +83,14 @@ declare const _default: {
|
|
|
67
83
|
'page.wallet.addGoogle': string;
|
|
68
84
|
'page.wallet.viewDetails': string;
|
|
69
85
|
'page.wallet.expireDate': string;
|
|
86
|
+
'page.wallet.urlEmpty': string;
|
|
87
|
+
'page.wallet.notIOS': string;
|
|
88
|
+
'page.wallet.addSuccess': string;
|
|
89
|
+
'page.wallet.addFailed': string;
|
|
90
|
+
'page.wallet.useAppleInstead': string;
|
|
91
|
+
'page.wallet.openedInBrowser': string;
|
|
92
|
+
'page.wallet.openFailed': string;
|
|
93
|
+
'page.wallet.loading': string;
|
|
70
94
|
};
|
|
71
95
|
};
|
|
72
96
|
export default _default;
|
|
@@ -47,7 +47,15 @@ var locales_default = {
|
|
|
47
47
|
"page.wallet.addIos": "Add to Apple Wallet",
|
|
48
48
|
"page.wallet.addGoogle": "Add to Google Wallet",
|
|
49
49
|
"page.wallet.viewDetails": "See details",
|
|
50
|
-
"page.wallet.expireDate": "Long term"
|
|
50
|
+
"page.wallet.expireDate": "Long term",
|
|
51
|
+
"page.wallet.urlEmpty": "Wallet link is empty",
|
|
52
|
+
"page.wallet.notIOS": "Apple Wallet is not supported on non-iOS devices",
|
|
53
|
+
"page.wallet.addSuccess": "Successfully added to wallet",
|
|
54
|
+
"page.wallet.addFailed": "Failed to add to wallet",
|
|
55
|
+
"page.wallet.useAppleInstead": "You are using an iOS device, would you like to use Apple Wallet instead of Google Wallet?",
|
|
56
|
+
"page.wallet.openedInBrowser": "Opened in browser",
|
|
57
|
+
"page.wallet.openFailed": "Failed to open wallet link",
|
|
58
|
+
"page.wallet.loading": "Loading wallet..."
|
|
51
59
|
},
|
|
52
60
|
"zh-CN": {
|
|
53
61
|
// 简体中文翻译
|
|
@@ -73,7 +81,15 @@ var locales_default = {
|
|
|
73
81
|
"page.wallet.addIos": "添加到苹果钱包",
|
|
74
82
|
"page.wallet.addGoogle": "添加到谷歌钱包",
|
|
75
83
|
"page.wallet.viewDetails": "查看详情",
|
|
76
|
-
"page.wallet.expireDate": "长期"
|
|
84
|
+
"page.wallet.expireDate": "长期",
|
|
85
|
+
"page.wallet.urlEmpty": "钱包链接为空",
|
|
86
|
+
"page.wallet.notIOS": "非iOS设备不支持Apple Wallet",
|
|
87
|
+
"page.wallet.addSuccess": "已成功添加到钱包",
|
|
88
|
+
"page.wallet.addFailed": "添加钱包失败",
|
|
89
|
+
"page.wallet.useAppleInstead": "您正在使用iOS设备,是否使用Apple Wallet代替Google Wallet?",
|
|
90
|
+
"page.wallet.openedInBrowser": "已在浏览器中打开",
|
|
91
|
+
"page.wallet.openFailed": "打开钱包链接失败",
|
|
92
|
+
"page.wallet.loading": "正在加载钱包..."
|
|
77
93
|
},
|
|
78
94
|
"zh-HK": {
|
|
79
95
|
// 繁体中文翻译
|
|
@@ -99,6 +115,14 @@ var locales_default = {
|
|
|
99
115
|
"page.wallet.addIos": "添加到蘋果錢包",
|
|
100
116
|
"page.wallet.addGoogle": "添加到谷歌錢包",
|
|
101
117
|
"page.wallet.viewDetails": "查看詳情",
|
|
102
|
-
"page.wallet.expireDate": "長期"
|
|
118
|
+
"page.wallet.expireDate": "長期",
|
|
119
|
+
"page.wallet.urlEmpty": "錢包連結為空",
|
|
120
|
+
"page.wallet.notIOS": "非iOS設備不支持Apple Wallet",
|
|
121
|
+
"page.wallet.addSuccess": "已成功添加到錢包",
|
|
122
|
+
"page.wallet.addFailed": "添加錢包失敗",
|
|
123
|
+
"page.wallet.useAppleInstead": "您正在使用iOS設備,是否使用Apple Wallet代替Google Wallet?",
|
|
124
|
+
"page.wallet.openedInBrowser": "已在瀏覽器中打開",
|
|
125
|
+
"page.wallet.openFailed": "打開錢包連結失敗",
|
|
126
|
+
"page.wallet.loading": "正在加載錢包..."
|
|
103
127
|
}
|
|
104
128
|
};
|
|
@@ -43,7 +43,8 @@ var FooterButtons = ({
|
|
|
43
43
|
onAddClick,
|
|
44
44
|
disabled = false,
|
|
45
45
|
platform = "h5",
|
|
46
|
-
isIOS = false
|
|
46
|
+
isIOS = false,
|
|
47
|
+
addWalletLoading = false
|
|
47
48
|
}) => {
|
|
48
49
|
if (platform === "pc") {
|
|
49
50
|
return null;
|
|
@@ -69,6 +70,7 @@ var FooterButtons = ({
|
|
|
69
70
|
/* @__PURE__ */ import_react.default.createElement(
|
|
70
71
|
import_antd.Button,
|
|
71
72
|
{
|
|
73
|
+
loading: addWalletLoading,
|
|
72
74
|
key: "apple-wallet",
|
|
73
75
|
onClick: onAppleWalletClick,
|
|
74
76
|
disabled,
|
|
@@ -11,9 +11,23 @@
|
|
|
11
11
|
display: flex;
|
|
12
12
|
gap: 12px;
|
|
13
13
|
width: 100%;
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
.wallet-footer-buttons-item-secondary{
|
|
15
17
|
overflow: hidden;
|
|
16
|
-
|
|
18
|
+
display: flex;
|
|
19
|
+
>span{
|
|
20
|
+
display: block;
|
|
21
|
+
// width: 100%;
|
|
22
|
+
flex:1;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
text-overflow: ellipsis;
|
|
26
|
+
text-wrap: nowrap;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
17
31
|
// 按钮数量样式
|
|
18
32
|
// 单个按钮占满宽度
|
|
19
33
|
&-count-1 {
|