@pisell/private-materials 3.2.6 → 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 +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +3 -3
- 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 +139 -23
- 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 +17 -1
- package/es/components/wallet/locales.d.ts +3 -0
- package/es/components/wallet/locales.js +6 -3
- package/es/components/walletList/index.js +69 -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 +44 -12
- 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 +17 -1
- package/lib/components/wallet/locales.d.ts +3 -0
- package/lib/components/wallet/locales.js +6 -3
- package/lib/components/walletList/index.js +49 -16
- package/package.json +3 -3
|
@@ -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,
|
|
@@ -141,7 +159,6 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
141
159
|
setState({
|
|
142
160
|
list: [DEFAULT_WALLET_CARD],
|
|
143
161
|
balance: DEFAULT_BALANCE,
|
|
144
|
-
loading: false,
|
|
145
162
|
hasAttempted: true,
|
|
146
163
|
isLoggedIn: false
|
|
147
164
|
});
|
|
@@ -240,20 +257,24 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
240
257
|
setState({
|
|
241
258
|
list: [DEFAULT_WALLET_CARD],
|
|
242
259
|
balance: DEFAULT_BALANCE,
|
|
243
|
-
loading: false,
|
|
244
260
|
hasAttempted: true,
|
|
245
261
|
isLoggedIn: false
|
|
246
262
|
});
|
|
247
263
|
return;
|
|
248
264
|
}
|
|
249
265
|
if (hasAttempted) return;
|
|
250
|
-
|
|
251
|
-
|
|
266
|
+
let cachedList = null;
|
|
267
|
+
let cachedBalance = null;
|
|
268
|
+
try {
|
|
269
|
+
cachedList = getFromLocalStorage(STORAGE_KEY);
|
|
270
|
+
cachedBalance = getFromLocalStorage(STORAGE_KEY_BALANCE);
|
|
271
|
+
} catch (e) {
|
|
272
|
+
console.error("Error fetching from localStorage:", e);
|
|
273
|
+
}
|
|
252
274
|
if (cachedList && cachedBalance) {
|
|
253
275
|
setState({
|
|
254
276
|
list: cachedList,
|
|
255
277
|
balance: cachedBalance,
|
|
256
|
-
loading: false,
|
|
257
278
|
hasAttempted: false
|
|
258
279
|
});
|
|
259
280
|
}
|
|
@@ -265,10 +286,18 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
265
286
|
]);
|
|
266
287
|
if (!isMountedRef.current || requestIdRef.current !== requestId) return;
|
|
267
288
|
if (walletListData && walletListData.length > 0) {
|
|
268
|
-
|
|
289
|
+
try {
|
|
290
|
+
saveToLocalStorage(STORAGE_KEY, walletListData);
|
|
291
|
+
} catch (e) {
|
|
292
|
+
console.error("Error saving wallet list to localStorage:", e);
|
|
293
|
+
}
|
|
269
294
|
}
|
|
270
295
|
if (walletBalanceData) {
|
|
271
|
-
|
|
296
|
+
try {
|
|
297
|
+
saveToLocalStorage(STORAGE_KEY_BALANCE, walletBalanceData);
|
|
298
|
+
} catch (e) {
|
|
299
|
+
console.error("Error saving wallet balance to localStorage:", e);
|
|
300
|
+
}
|
|
272
301
|
}
|
|
273
302
|
if (!walletBalanceData || Array.isArray(walletListData) && walletListData.length === 0) {
|
|
274
303
|
setTimeout(async () => {
|
|
@@ -279,26 +308,32 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
279
308
|
if (!walletBalanceData) {
|
|
280
309
|
retryBalanceData = await (0, import_serve.getWalletBalance)();
|
|
281
310
|
if (retryBalanceData) {
|
|
282
|
-
|
|
311
|
+
try {
|
|
312
|
+
saveToLocalStorage(STORAGE_KEY_BALANCE, retryBalanceData);
|
|
313
|
+
} catch (e) {
|
|
314
|
+
console.error("Error saving retry balance to localStorage:", e);
|
|
315
|
+
}
|
|
283
316
|
}
|
|
284
317
|
}
|
|
285
318
|
if (Array.isArray(walletListData) && walletListData.length === 0) {
|
|
286
319
|
retryListData = await (0, import_serve.getWalletList)({});
|
|
287
320
|
if (retryListData && retryListData.length > 0) {
|
|
288
|
-
|
|
321
|
+
try {
|
|
322
|
+
saveToLocalStorage(STORAGE_KEY, retryListData);
|
|
323
|
+
} catch (e) {
|
|
324
|
+
console.error("Error saving retry list to localStorage:", e);
|
|
325
|
+
}
|
|
289
326
|
}
|
|
290
327
|
}
|
|
291
328
|
setState({
|
|
292
329
|
list: retryListData || [],
|
|
293
330
|
balance: retryBalanceData,
|
|
294
|
-
loading: false,
|
|
295
331
|
hasAttempted: true
|
|
296
332
|
});
|
|
297
333
|
} catch (retryErr) {
|
|
298
334
|
setState({
|
|
299
335
|
list: walletListData || [],
|
|
300
336
|
balance: walletBalanceData,
|
|
301
|
-
loading: false,
|
|
302
337
|
hasAttempted: true
|
|
303
338
|
});
|
|
304
339
|
}
|
|
@@ -307,7 +342,6 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
307
342
|
setState({
|
|
308
343
|
list: walletListData || [],
|
|
309
344
|
balance: walletBalanceData,
|
|
310
|
-
loading: false,
|
|
311
345
|
hasAttempted: true
|
|
312
346
|
});
|
|
313
347
|
}
|
|
@@ -315,7 +349,6 @@ var WalletList = (0, import_model.Provider)((props) => {
|
|
|
315
349
|
if (!isMountedRef.current || requestIdRef.current !== requestId) return;
|
|
316
350
|
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
351
|
setState({
|
|
318
|
-
loading: false,
|
|
319
352
|
error: err instanceof Error ? err : new Error("加载失败"),
|
|
320
353
|
authError: isAuthError,
|
|
321
354
|
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.8",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -59,9 +59,9 @@
|
|
|
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/materials": "3.2.
|
|
63
|
-
"@pisell/icon": "0.0.11",
|
|
62
|
+
"@pisell/materials": "3.2.8",
|
|
64
63
|
"@pisell/date-picker": "1.0.100",
|
|
64
|
+
"@pisell/icon": "0.0.11",
|
|
65
65
|
"@pisell/utils": "1.0.42"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|