@pisell/private-materials 3.2.6 → 3.2.7
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 +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/booking/components/footer/index.d.ts +0 -1
- package/es/components/booking/info/addServiceVariant/index.d.ts +0 -1
- package/es/components/booking/info/index.d.ts +0 -1
- package/es/components/booking/info/service/addService/index.d.ts +0 -1
- package/es/components/booking/info/service/addTimeModal/index.d.ts +0 -1
- package/es/components/booking/materiels/contacts/index.d.ts +0 -1
- package/es/components/eftpos/index.d.ts +0 -1
- package/es/components/eftposPay/component/fail/failCustom.d.ts +0 -1
- package/es/components/eftposPay/component/fail/index.d.ts +0 -1
- package/es/components/eftposPay/component/fail/unknow.d.ts +0 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/index.d.ts +0 -1
- package/es/components/eftposPay/pay.d.ts +0 -1
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/es/components/login/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/index.d.ts +0 -1
- package/es/components/productExtension/index.d.ts +0 -1
- package/es/components/ruleSetting/index.d.ts +0 -1
- package/es/components/taxSelect/index.d.ts +0 -1
- package/es/components/wallet/Detail/index.d.ts +14 -0
- package/es/components/wallet/Detail/index.js +140 -19
- package/es/components/wallet/components/FooterButtons/index.less +3 -1
- package/es/components/walletList/index.js +70 -32
- package/lib/components/booking/components/footer/index.d.ts +0 -1
- package/lib/components/booking/info/addServiceVariant/index.d.ts +0 -1
- package/lib/components/booking/info/index.d.ts +0 -1
- package/lib/components/booking/info/service/addService/index.d.ts +0 -1
- package/lib/components/booking/info/service/addTimeModal/index.d.ts +0 -1
- package/lib/components/booking/materiels/contacts/index.d.ts +0 -1
- package/lib/components/eftpos/index.d.ts +0 -1
- package/lib/components/eftposPay/component/fail/failCustom.d.ts +0 -1
- package/lib/components/eftposPay/component/fail/index.d.ts +0 -1
- package/lib/components/eftposPay/component/fail/unknow.d.ts +0 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/index.d.ts +0 -1
- package/lib/components/eftposPay/pay.d.ts +0 -1
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/login/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/index.d.ts +0 -1
- package/lib/components/productExtension/index.d.ts +0 -1
- package/lib/components/ruleSetting/index.d.ts +0 -1
- package/lib/components/taxSelect/index.d.ts +0 -1
- package/lib/components/wallet/Detail/index.d.ts +14 -0
- package/lib/components/wallet/Detail/index.js +67 -12
- package/lib/components/wallet/components/FooterButtons/index.less +3 -1
- package/lib/components/walletList/index.js +50 -16
- package/package.json +3 -3
|
@@ -297,8 +297,8 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
297
297
|
amount?: string | number | undefined;
|
|
298
298
|
mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
|
|
299
299
|
order_id?: string | number | undefined;
|
|
300
|
-
eftpos?: "tyro" | "
|
|
301
|
-
action?: "amount" | "
|
|
300
|
+
eftpos?: "tyro" | "payo" | "windcave" | "stripe" | undefined;
|
|
301
|
+
action?: "amount" | "pay" | "deviceList" | undefined;
|
|
302
302
|
key?: number | undefined;
|
|
303
303
|
step?: number | undefined;
|
|
304
304
|
title?: string | undefined;
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.less';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
PKPass?: any;
|
|
6
|
+
GoogleWalletPass?: any;
|
|
7
|
+
}
|
|
8
|
+
interface Navigator {
|
|
9
|
+
pkpass?: {
|
|
10
|
+
addPass(pass: any): Promise<string>;
|
|
11
|
+
};
|
|
12
|
+
googlewallet?: {
|
|
13
|
+
addPass(pass: any): Promise<string>;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
3
17
|
interface DetailProps {
|
|
4
18
|
detail: {
|
|
5
19
|
id?: string;
|
|
@@ -246,24 +246,79 @@ var Detail = (0, import_react.forwardRef)((props, ref) => {
|
|
|
246
246
|
getTimeTreeList();
|
|
247
247
|
}
|
|
248
248
|
}, [code]);
|
|
249
|
-
const
|
|
249
|
+
const addWalletPass = async (url, type) => {
|
|
250
|
+
if (!url) return;
|
|
250
251
|
if (isWechat()) {
|
|
251
252
|
setWechatModalOpen(true);
|
|
252
|
-
setCopyUrl(
|
|
253
|
+
setCopyUrl(url);
|
|
253
254
|
return;
|
|
254
255
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
256
|
+
console.log(
|
|
257
|
+
"%c [ window.PKPass ]-395",
|
|
258
|
+
"font-size:13px; color:#bf2c9f;",
|
|
259
|
+
window.PKPass
|
|
260
|
+
);
|
|
261
|
+
console.log(
|
|
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);
|
|
309
|
+
}
|
|
310
|
+
} catch (error) {
|
|
311
|
+
console.error("添加失败:", error);
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
265
314
|
}
|
|
266
315
|
};
|
|
316
|
+
const onAppleClick = async () => {
|
|
317
|
+
await addWalletPass(apple_wallet_url, "apple");
|
|
318
|
+
};
|
|
319
|
+
const onGoogleClick = async () => {
|
|
320
|
+
await addWalletPass(google_wallet_url, "google");
|
|
321
|
+
};
|
|
267
322
|
const isWechat = () => {
|
|
268
323
|
return /MicroMessenger/i.test(window.navigator.userAgent);
|
|
269
324
|
};
|
|
@@ -45,16 +45,35 @@ var import_classnames = __toESM(require("classnames"));
|
|
|
45
45
|
var import_types = require("./types");
|
|
46
46
|
var STORAGE_KEY = "pisell_wallet_list_data";
|
|
47
47
|
var STORAGE_KEY_BALANCE = "pisell_wallet_balance_data";
|
|
48
|
+
var safeLocalStorage = {
|
|
49
|
+
getItem: (key) => {
|
|
50
|
+
try {
|
|
51
|
+
return typeof localStorage !== "undefined" ? localStorage.getItem(key) : null;
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error("Error accessing localStorage:", error);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
setItem: (key, value) => {
|
|
58
|
+
try {
|
|
59
|
+
if (typeof localStorage !== "undefined") {
|
|
60
|
+
localStorage.setItem(key, value);
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error("Error writing to localStorage:", error);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
48
67
|
var saveToLocalStorage = (key, data) => {
|
|
49
68
|
try {
|
|
50
|
-
|
|
69
|
+
safeLocalStorage.setItem(key, JSON.stringify(data));
|
|
51
70
|
} catch (error) {
|
|
52
71
|
console.error("Error saving to localStorage:", error);
|
|
53
72
|
}
|
|
54
73
|
};
|
|
55
74
|
var getFromLocalStorage = (key) => {
|
|
56
75
|
try {
|
|
57
|
-
const data =
|
|
76
|
+
const data = safeLocalStorage.getItem(key);
|
|
58
77
|
return data ? JSON.parse(data) : null;
|
|
59
78
|
} catch (error) {
|
|
60
79
|
console.error("Error reading from localStorage:", error);
|
|
@@ -117,7 +136,6 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
117
136
|
}, [store]);
|
|
118
137
|
const {
|
|
119
138
|
list = [],
|
|
120
|
-
loading,
|
|
121
139
|
error,
|
|
122
140
|
authError,
|
|
123
141
|
hasAttempted,
|
|
@@ -129,6 +147,7 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
129
147
|
}
|
|
130
148
|
}, [utils == null ? void 0 : utils.request]);
|
|
131
149
|
(0, import_react.useEffect)(() => {
|
|
150
|
+
console.log("%c [ ]-221", "font-size:13px; color:#bf2c9f;", 22121212);
|
|
132
151
|
return () => {
|
|
133
152
|
isMountedRef.current = false;
|
|
134
153
|
requestIdRef.current = "";
|
|
@@ -141,7 +160,6 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
141
160
|
setState({
|
|
142
161
|
list: [DEFAULT_WALLET_CARD],
|
|
143
162
|
balance: DEFAULT_BALANCE,
|
|
144
|
-
loading: false,
|
|
145
163
|
hasAttempted: true,
|
|
146
164
|
isLoggedIn: false
|
|
147
165
|
});
|
|
@@ -240,20 +258,24 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
240
258
|
setState({
|
|
241
259
|
list: [DEFAULT_WALLET_CARD],
|
|
242
260
|
balance: DEFAULT_BALANCE,
|
|
243
|
-
loading: false,
|
|
244
261
|
hasAttempted: true,
|
|
245
262
|
isLoggedIn: false
|
|
246
263
|
});
|
|
247
264
|
return;
|
|
248
265
|
}
|
|
249
266
|
if (hasAttempted) return;
|
|
250
|
-
|
|
251
|
-
|
|
267
|
+
let cachedList = null;
|
|
268
|
+
let cachedBalance = null;
|
|
269
|
+
try {
|
|
270
|
+
cachedList = getFromLocalStorage(STORAGE_KEY);
|
|
271
|
+
cachedBalance = getFromLocalStorage(STORAGE_KEY_BALANCE);
|
|
272
|
+
} catch (e) {
|
|
273
|
+
console.error("Error fetching from localStorage:", e);
|
|
274
|
+
}
|
|
252
275
|
if (cachedList && cachedBalance) {
|
|
253
276
|
setState({
|
|
254
277
|
list: cachedList,
|
|
255
278
|
balance: cachedBalance,
|
|
256
|
-
loading: false,
|
|
257
279
|
hasAttempted: false
|
|
258
280
|
});
|
|
259
281
|
}
|
|
@@ -265,10 +287,18 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
265
287
|
]);
|
|
266
288
|
if (!isMountedRef.current || requestIdRef.current !== requestId) return;
|
|
267
289
|
if (walletListData && walletListData.length > 0) {
|
|
268
|
-
|
|
290
|
+
try {
|
|
291
|
+
saveToLocalStorage(STORAGE_KEY, walletListData);
|
|
292
|
+
} catch (e) {
|
|
293
|
+
console.error("Error saving wallet list to localStorage:", e);
|
|
294
|
+
}
|
|
269
295
|
}
|
|
270
296
|
if (walletBalanceData) {
|
|
271
|
-
|
|
297
|
+
try {
|
|
298
|
+
saveToLocalStorage(STORAGE_KEY_BALANCE, walletBalanceData);
|
|
299
|
+
} catch (e) {
|
|
300
|
+
console.error("Error saving wallet balance to localStorage:", e);
|
|
301
|
+
}
|
|
272
302
|
}
|
|
273
303
|
if (!walletBalanceData || Array.isArray(walletListData) && walletListData.length === 0) {
|
|
274
304
|
setTimeout(async () => {
|
|
@@ -279,26 +309,32 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
279
309
|
if (!walletBalanceData) {
|
|
280
310
|
retryBalanceData = await (0, import_serve.getWalletBalance)();
|
|
281
311
|
if (retryBalanceData) {
|
|
282
|
-
|
|
312
|
+
try {
|
|
313
|
+
saveToLocalStorage(STORAGE_KEY_BALANCE, retryBalanceData);
|
|
314
|
+
} catch (e) {
|
|
315
|
+
console.error("Error saving retry balance to localStorage:", e);
|
|
316
|
+
}
|
|
283
317
|
}
|
|
284
318
|
}
|
|
285
319
|
if (Array.isArray(walletListData) && walletListData.length === 0) {
|
|
286
320
|
retryListData = await (0, import_serve.getWalletList)({});
|
|
287
321
|
if (retryListData && retryListData.length > 0) {
|
|
288
|
-
|
|
322
|
+
try {
|
|
323
|
+
saveToLocalStorage(STORAGE_KEY, retryListData);
|
|
324
|
+
} catch (e) {
|
|
325
|
+
console.error("Error saving retry list to localStorage:", e);
|
|
326
|
+
}
|
|
289
327
|
}
|
|
290
328
|
}
|
|
291
329
|
setState({
|
|
292
330
|
list: retryListData || [],
|
|
293
331
|
balance: retryBalanceData,
|
|
294
|
-
loading: false,
|
|
295
332
|
hasAttempted: true
|
|
296
333
|
});
|
|
297
334
|
} catch (retryErr) {
|
|
298
335
|
setState({
|
|
299
336
|
list: walletListData || [],
|
|
300
337
|
balance: walletBalanceData,
|
|
301
|
-
loading: false,
|
|
302
338
|
hasAttempted: true
|
|
303
339
|
});
|
|
304
340
|
}
|
|
@@ -307,7 +343,6 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
307
343
|
setState({
|
|
308
344
|
list: walletListData || [],
|
|
309
345
|
balance: walletBalanceData,
|
|
310
|
-
loading: false,
|
|
311
346
|
hasAttempted: true
|
|
312
347
|
});
|
|
313
348
|
}
|
|
@@ -315,7 +350,6 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
315
350
|
if (!isMountedRef.current || requestIdRef.current !== requestId) return;
|
|
316
351
|
const isAuthError = (err == null ? void 0 : err.code) === 4001 || ((_a2 = err == null ? void 0 : err.message) == null ? void 0 : _a2.includes("login time out")) || ((_b2 = err == null ? void 0 : err.data) == null ? void 0 : _b2.code) === 4001;
|
|
317
352
|
setState({
|
|
318
|
-
loading: false,
|
|
319
353
|
error: err instanceof Error ? err : new Error("加载失败"),
|
|
320
354
|
authError: isAuthError,
|
|
321
355
|
hasAttempted: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.7",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"react-infinite-scroll-component": "^6.1.0",
|
|
60
60
|
"rc-virtual-list": "^3.11.3",
|
|
61
61
|
"decimal.js": "^10.4.3",
|
|
62
|
-
"@pisell/
|
|
62
|
+
"@pisell/utils": "1.0.42",
|
|
63
63
|
"@pisell/icon": "0.0.11",
|
|
64
64
|
"@pisell/date-picker": "1.0.100",
|
|
65
|
-
"@pisell/
|
|
65
|
+
"@pisell/materials": "3.2.7"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"react": "^18.0.0",
|