@pisell/private-materials 6.4.18 → 6.4.20

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.
@@ -744,6 +744,11 @@ var PaymentContent = (0, import_react.forwardRef)(
744
744
  };
745
745
  };
746
746
  const handleSendCustomerPaymentLink = async (data) => {
747
+ const order = checkoutModule.getCurrentOrderInfo();
748
+ if (order.isDeposit) {
749
+ const stateAmount = checkoutModule.getStateAmount();
750
+ await checkoutModule.setDepositAmountAsync(stateAmount);
751
+ }
747
752
  const isCurrentOrderSynced = checkoutModule.isCurrentOrderSynced();
748
753
  if (!isCurrentOrderSynced) {
749
754
  await checkoutModule.manualSyncOrderAsync();
@@ -1234,98 +1239,6 @@ var PaymentModal = ({
1234
1239
  unsubscribeRef.current();
1235
1240
  unsubscribeRef.current = void 0;
1236
1241
  }
1237
- unsubscribeRef.current = checkout.core.effects.on("checkout:onOrderSynced", (data2) => {
1238
- var _a3, _b3, _c2;
1239
- const responseData = (_a3 = data2.response) == null ? void 0 : _a3.data;
1240
- const paymentStatus = responseData == null ? void 0 : responseData.payment_status;
1241
- if (data2.isManual) return;
1242
- handlePaymentComplete(data2);
1243
- if (showingCashToastRef.current) {
1244
- return;
1245
- }
1246
- const orderTotalAmount = Number((responseData == null ? void 0 : responseData.total_amount) || 0);
1247
- const gapAmount = Number((responseData == null ? void 0 : responseData.amount_gap) || 0);
1248
- const currentChangeGivenAmount = Number(
1249
- ((_b3 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _b3.current_change_given_amount) || 0
1250
- );
1251
- const failureReason = responseData == null ? void 0 : responseData.failure_reason;
1252
- if (paymentStatus) {
1253
- console.log("print_order_onOrderSynced>>>>", responseData);
1254
- logger == null ? void 0 : logger.addLog({
1255
- type: "info",
1256
- title: "print_order_onOrderSynced",
1257
- metadata: {
1258
- responseData
1259
- }
1260
- });
1261
- try {
1262
- const params = {
1263
- type: "99",
1264
- // 打印订单全部信息
1265
- data: {
1266
- order_id: responseData.order_id,
1267
- machine_code_print_info: responseData == null ? void 0 : responseData.machine_code_print_info,
1268
- small_ticket_data: (_c2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _c2.small_ticket_data
1269
- }
1270
- };
1271
- console.log("print_order_onOrderSynced_params>>>>", params);
1272
- logger == null ? void 0 : logger.addLog({
1273
- type: "info",
1274
- title: "print_order_onOrderSynced_params",
1275
- metadata: {
1276
- params
1277
- }
1278
- });
1279
- (0, import_utils.webPrint)(params, (res) => {
1280
- console.log("print_order_onOrderSynced_res>>>>", res);
1281
- logger == null ? void 0 : logger.addLog({
1282
- type: "info",
1283
- title: "print_order_onOrderSynced_res",
1284
- metadata: {
1285
- res
1286
- }
1287
- });
1288
- });
1289
- } catch (error) {
1290
- console.error("print_order_onOrderSynced_error>>>>", error);
1291
- logger == null ? void 0 : logger.addLog({
1292
- type: "info",
1293
- title: "print_order_onOrderSynced_error",
1294
- metadata: {
1295
- error
1296
- }
1297
- });
1298
- }
1299
- const statusClassName = (0, import_PaymentResultToastUtils.calculateStatusClassName)(paymentStatus);
1300
- const autoCloseConfig = (0, import_PaymentResultToastUtils.calculateAutoCloseConfig)(
1301
- paymentStatus,
1302
- !!currentChangeGivenAmount
1303
- );
1304
- (0, import_PaymentResultToastUtils.displayPaymentResultToast)(
1305
- {
1306
- paymentStatus,
1307
- orderTotalAmount,
1308
- gapAmount: paymentStatus === "partially_paid" ? gapAmount : currentChangeGivenAmount,
1309
- failureReason,
1310
- autoCloseConfig,
1311
- actionButtons: generateActionButtons(paymentStatus)
1312
- },
1313
- paymentResultToastConfig
1314
- );
1315
- const paymentResult = {
1316
- ...data2,
1317
- toastInfo: {
1318
- status: paymentStatus,
1319
- amount: orderTotalAmount,
1320
- gapAmount: currentChangeGivenAmount,
1321
- failureReason
1322
- }
1323
- };
1324
- handlePaymentComplete(paymentResult);
1325
- } else {
1326
- handlePaymentComplete(data2);
1327
- }
1328
- });
1329
1242
  } else if (isLocalOrderCreated.current) {
1330
1243
  console.log(
1331
1244
  "🔄 PaymentModal: data changed, updating checkout data..."
@@ -1361,6 +1274,102 @@ var PaymentModal = ({
1361
1274
  }
1362
1275
  }, [data]);
1363
1276
  (0, import_react.useEffect)(() => {
1277
+ const checkout = pisellos == null ? void 0 : pisellos.getModule("checkout");
1278
+ unsubscribeRef.current = checkout.core.effects.on(
1279
+ "checkout:onOrderSynced",
1280
+ (data2) => {
1281
+ var _a2, _b2, _c2;
1282
+ const responseData = (_a2 = data2.response) == null ? void 0 : _a2.data;
1283
+ const paymentStatus = responseData == null ? void 0 : responseData.payment_status;
1284
+ if (data2.isManual) return;
1285
+ handlePaymentComplete(data2);
1286
+ if (showingCashToastRef.current) {
1287
+ return;
1288
+ }
1289
+ const orderTotalAmount = Number((responseData == null ? void 0 : responseData.total_amount) || 0);
1290
+ const gapAmount = Number((responseData == null ? void 0 : responseData.amount_gap) || 0);
1291
+ const currentChangeGivenAmount = Number(
1292
+ ((_b2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _b2.current_change_given_amount) || 0
1293
+ );
1294
+ const failureReason = responseData == null ? void 0 : responseData.failure_reason;
1295
+ if (paymentStatus) {
1296
+ console.log("print_order_onOrderSynced>>>>", responseData);
1297
+ logger == null ? void 0 : logger.addLog({
1298
+ type: "info",
1299
+ title: "print_order_onOrderSynced",
1300
+ metadata: {
1301
+ responseData
1302
+ }
1303
+ });
1304
+ try {
1305
+ const params = {
1306
+ type: "99",
1307
+ // 打印订单全部信息
1308
+ data: {
1309
+ order_id: responseData.order_id,
1310
+ machine_code_print_info: responseData == null ? void 0 : responseData.machine_code_print_info,
1311
+ small_ticket_data: (_c2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _c2.small_ticket_data
1312
+ }
1313
+ };
1314
+ console.log("print_order_onOrderSynced_params>>>>", params);
1315
+ logger == null ? void 0 : logger.addLog({
1316
+ type: "info",
1317
+ title: "print_order_onOrderSynced_params",
1318
+ metadata: {
1319
+ params
1320
+ }
1321
+ });
1322
+ (0, import_utils.webPrint)(params, (res) => {
1323
+ console.log("print_order_onOrderSynced_res>>>>", res);
1324
+ logger == null ? void 0 : logger.addLog({
1325
+ type: "info",
1326
+ title: "print_order_onOrderSynced_res",
1327
+ metadata: {
1328
+ res
1329
+ }
1330
+ });
1331
+ });
1332
+ } catch (error) {
1333
+ console.error("print_order_onOrderSynced_error>>>>", error);
1334
+ logger == null ? void 0 : logger.addLog({
1335
+ type: "info",
1336
+ title: "print_order_onOrderSynced_error",
1337
+ metadata: {
1338
+ error
1339
+ }
1340
+ });
1341
+ }
1342
+ const statusClassName = (0, import_PaymentResultToastUtils.calculateStatusClassName)(paymentStatus);
1343
+ const autoCloseConfig = (0, import_PaymentResultToastUtils.calculateAutoCloseConfig)(
1344
+ paymentStatus,
1345
+ !!currentChangeGivenAmount
1346
+ );
1347
+ (0, import_PaymentResultToastUtils.displayPaymentResultToast)(
1348
+ {
1349
+ paymentStatus,
1350
+ orderTotalAmount,
1351
+ gapAmount: paymentStatus === "partially_paid" ? gapAmount : currentChangeGivenAmount,
1352
+ failureReason,
1353
+ autoCloseConfig,
1354
+ actionButtons: generateActionButtons(paymentStatus)
1355
+ },
1356
+ paymentResultToastConfig
1357
+ );
1358
+ const paymentResult = {
1359
+ ...data2,
1360
+ toastInfo: {
1361
+ status: paymentStatus,
1362
+ amount: orderTotalAmount,
1363
+ gapAmount: currentChangeGivenAmount,
1364
+ failureReason
1365
+ }
1366
+ };
1367
+ handlePaymentComplete(paymentResult);
1368
+ } else {
1369
+ handlePaymentComplete(data2);
1370
+ }
1371
+ }
1372
+ );
1364
1373
  return () => {
1365
1374
  var _a2;
1366
1375
  if (typeof unsubscribeRef.current === "function") {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  interface DiscountWalletProps {
4
3
  isCardMode: boolean;
@@ -15,11 +15,11 @@ export declare const useStoreRef: <T extends {
15
15
  readonly numRef: React.MutableRefObject<string | number | undefined>;
16
16
  readonly orderIdRef: React.MutableRefObject<string | number>;
17
17
  readonly modeRef: React.MutableRefObject<ModeEnum>;
18
- readonly statusRef: React.MutableRefObject<"loading" | "warn" | "success" | "fail" | "pedding" | "resove" | "reject" | "question">;
18
+ readonly statusRef: React.MutableRefObject<"loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question">;
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
- readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly">;
22
+ readonly eftposRef: React.MutableRefObject<"stripe" | "tyro" | "windcave" | "payo" | "linkly">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -174,7 +174,7 @@ export declare const updateCustom: (payload: {
174
174
  export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
175
175
  type: EActionTypes;
176
176
  payload: {
177
- status: "loading" | "warn" | "success" | "fail" | "question";
177
+ status: "loading" | "success" | "warn" | "fail" | "question";
178
178
  };
179
179
  };
180
180
  /**
@@ -295,9 +295,9 @@ export declare const backUpFree: (payload: Partial<State>) => {
295
295
  name?: string | undefined;
296
296
  symbol?: string | undefined;
297
297
  amount?: string | number | undefined;
298
- mode?: "refund" | "fullPay" | "pay" | "query" | undefined;
298
+ mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
300
+ eftpos?: "stripe" | "tyro" | "windcave" | "payo" | "linkly" | undefined;
301
301
  action?: "amount" | "pay" | "deviceList" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
@@ -308,7 +308,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
308
308
  net?: boolean | undefined;
309
309
  component?: string | undefined;
310
310
  form?: string | undefined;
311
- status?: "loading" | "warn" | "success" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
311
+ status?: "loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
312
312
  warn?: string | undefined;
313
313
  steps?: {
314
314
  /** 用于重置当前步骤 */
@@ -41,7 +41,7 @@ declare type ScanData = {
41
41
  };
42
42
  };
43
43
  export declare const formatScanCustomer: (data: ScanData) => {
44
- searchType: "product" | "customer" | "wallet" | "walletPass" | "local_product";
44
+ searchType: "customer" | "product" | "wallet" | "walletPass" | "local_product";
45
45
  data: any;
46
46
  scanCode: string;
47
47
  } | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.4.18",
3
+ "version": "6.4.20",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -60,9 +60,9 @@
60
60
  "react-resizable": "^3.0.5",
61
61
  "styled-components": "^6.0.0-rc.3",
62
62
  "@pisell/date-picker": "3.0.7",
63
- "@pisell/icon": "0.0.11",
63
+ "@pisell/materials": "6.4.3",
64
64
  "@pisell/utils": "3.0.2",
65
- "@pisell/materials": "6.4.3"
65
+ "@pisell/icon": "0.0.11"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",