@pisell/private-materials 6.8.83 → 6.8.84

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.
Files changed (134) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/booking/components/footer/index.d.ts +1 -0
  12. package/es/components/booking/info/index.d.ts +1 -0
  13. package/es/components/checkout/PaymentModal.js +4 -2
  14. package/es/components/checkout/components/PaymentOptionsModule/index.js +1 -1
  15. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +7 -0
  16. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.js +120 -0
  17. package/es/components/eftposPay/aggregatePayment/index.d.ts +3 -0
  18. package/es/components/eftposPay/aggregatePayment/index.js +3 -0
  19. package/es/components/eftposPay/aggregatePayment/service.d.ts +24 -0
  20. package/es/components/eftposPay/aggregatePayment/service.js +69 -0
  21. package/es/components/eftposPay/aggregatePayment/types.d.ts +106 -0
  22. package/es/components/eftposPay/aggregatePayment/types.js +65 -0
  23. package/es/components/eftposPay/aggregatePayment/utils/logs.d.ts +110 -0
  24. package/es/components/eftposPay/aggregatePayment/utils/logs.js +371 -0
  25. package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +139 -0
  26. package/es/components/eftposPay/aggregatePayment/utils/payment.js +1138 -0
  27. package/es/components/eftposPay/amount.d.ts +1 -1
  28. package/es/components/eftposPay/app.d.ts +1 -1
  29. package/es/components/eftposPay/app.js +5 -0
  30. package/es/components/eftposPay/component/fail/failCustom.js +16 -12
  31. package/es/components/eftposPay/component/fail/index.js +12 -5
  32. package/es/components/eftposPay/const.d.ts +6 -1
  33. package/es/components/eftposPay/const.js +3 -0
  34. package/es/components/eftposPay/device.d.ts +1 -1
  35. package/es/components/eftposPay/hooks.d.ts +3 -2
  36. package/es/components/eftposPay/hooks.js +12 -0
  37. package/es/components/eftposPay/huifu/Action.d.ts +8 -0
  38. package/es/components/eftposPay/huifu/Action.js +146 -0
  39. package/es/components/eftposPay/huifu/const.d.ts +5 -0
  40. package/es/components/eftposPay/huifu/const.js +70 -0
  41. package/es/components/eftposPay/huifu/hooks.d.ts +25 -0
  42. package/es/components/eftposPay/huifu/hooks.js +184 -0
  43. package/es/components/eftposPay/huifu/index.d.ts +5 -0
  44. package/es/components/eftposPay/huifu/index.js +196 -0
  45. package/es/components/eftposPay/huifu/index.less +180 -0
  46. package/es/components/eftposPay/huifu/types.d.ts +14 -0
  47. package/es/components/eftposPay/huifu/types.js +1 -0
  48. package/es/components/eftposPay/index.js +5 -1
  49. package/es/components/eftposPay/locales.d.ts +36 -0
  50. package/es/components/eftposPay/locales.js +42 -3
  51. package/es/components/eftposPay/manufacturer.d.ts +1 -0
  52. package/es/components/eftposPay/manufacturer.js +5 -0
  53. package/es/components/eftposPay/pay.js +6 -2
  54. package/es/components/eftposPay/store/index.d.ts +11 -4
  55. package/es/components/kioskSkuDetail/index.d.ts +3 -0
  56. package/es/components/kioskSkuDetail/index.js +266 -173
  57. package/es/components/kioskSkuDetail/index.less +49 -7
  58. package/es/components/kioskSkuDetail/locales.d.ts +6 -0
  59. package/es/components/kioskSkuDetail/locales.js +9 -3
  60. package/es/components/pay/toB/components/Cache/index.d.ts +1 -0
  61. package/es/components/pay/toB/components/EFTPOS/index.js +8 -1
  62. package/es/components/pay/toB/types/index.d.ts +1 -0
  63. package/es/components/pay/toC/PaymentList/serve.js +14 -0
  64. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +7 -6
  65. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  66. package/es/components/ticketBooking/index.d.ts +16 -0
  67. package/es/plus/skuOptionsSelection/components/VariantCard/index.js +1 -1
  68. package/es/plus/skuOptionsSelection/locales.d.ts +3 -0
  69. package/es/plus/skuOptionsSelection/locales.js +3 -0
  70. package/es/pro/Login2.0/components/LoginCodeInput.js +36 -3
  71. package/es/pro/Login2.0/steps/CodeInput.js +37 -7
  72. package/lib/components/booking/components/footer/index.d.ts +1 -0
  73. package/lib/components/booking/info/index.d.ts +1 -0
  74. package/lib/components/checkout/PaymentModal.js +5 -2
  75. package/lib/components/checkout/components/PaymentOptionsModule/index.js +2 -1
  76. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +7 -0
  77. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.js +133 -0
  78. package/lib/components/eftposPay/aggregatePayment/index.d.ts +3 -0
  79. package/lib/components/eftposPay/aggregatePayment/index.js +42 -0
  80. package/lib/components/eftposPay/aggregatePayment/service.d.ts +24 -0
  81. package/lib/components/eftposPay/aggregatePayment/service.js +81 -0
  82. package/lib/components/eftposPay/aggregatePayment/types.d.ts +106 -0
  83. package/lib/components/eftposPay/aggregatePayment/types.js +74 -0
  84. package/lib/components/eftposPay/aggregatePayment/utils/logs.d.ts +110 -0
  85. package/lib/components/eftposPay/aggregatePayment/utils/logs.js +294 -0
  86. package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +139 -0
  87. package/lib/components/eftposPay/aggregatePayment/utils/payment.js +752 -0
  88. package/lib/components/eftposPay/amount.d.ts +1 -1
  89. package/lib/components/eftposPay/app.d.ts +1 -1
  90. package/lib/components/eftposPay/app.js +5 -0
  91. package/lib/components/eftposPay/component/fail/failCustom.js +15 -9
  92. package/lib/components/eftposPay/component/fail/index.js +4 -1
  93. package/lib/components/eftposPay/const.d.ts +6 -1
  94. package/lib/components/eftposPay/const.js +3 -0
  95. package/lib/components/eftposPay/device.d.ts +1 -1
  96. package/lib/components/eftposPay/hooks.d.ts +3 -2
  97. package/lib/components/eftposPay/hooks.js +16 -0
  98. package/lib/components/eftposPay/huifu/Action.d.ts +8 -0
  99. package/lib/components/eftposPay/huifu/Action.js +174 -0
  100. package/lib/components/eftposPay/huifu/const.d.ts +5 -0
  101. package/lib/components/eftposPay/huifu/const.js +86 -0
  102. package/lib/components/eftposPay/huifu/hooks.d.ts +25 -0
  103. package/lib/components/eftposPay/huifu/hooks.js +186 -0
  104. package/lib/components/eftposPay/huifu/index.d.ts +5 -0
  105. package/lib/components/eftposPay/huifu/index.js +200 -0
  106. package/lib/components/eftposPay/huifu/index.less +180 -0
  107. package/lib/components/eftposPay/huifu/types.d.ts +14 -0
  108. package/lib/components/eftposPay/huifu/types.js +17 -0
  109. package/lib/components/eftposPay/index.js +5 -1
  110. package/lib/components/eftposPay/locales.d.ts +36 -0
  111. package/lib/components/eftposPay/locales.js +42 -3
  112. package/lib/components/eftposPay/manufacturer.d.ts +1 -0
  113. package/lib/components/eftposPay/manufacturer.js +7 -0
  114. package/lib/components/eftposPay/pay.js +3 -2
  115. package/lib/components/eftposPay/store/index.d.ts +11 -4
  116. package/lib/components/kioskSkuDetail/index.d.ts +3 -0
  117. package/lib/components/kioskSkuDetail/index.js +180 -113
  118. package/lib/components/kioskSkuDetail/index.less +49 -7
  119. package/lib/components/kioskSkuDetail/locales.d.ts +6 -0
  120. package/lib/components/kioskSkuDetail/locales.js +9 -3
  121. package/lib/components/pay/toB/components/Cache/index.d.ts +1 -0
  122. package/lib/components/pay/toB/components/EFTPOS/index.js +8 -1
  123. package/lib/components/pay/toB/types/index.d.ts +1 -0
  124. package/lib/components/pay/toC/PaymentList/serve.js +15 -0
  125. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +7 -6
  126. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  127. package/lib/components/ticketBooking/index.d.ts +16 -0
  128. package/lib/plus/skuOptionsSelection/components/VariantCard/index.js +2 -0
  129. package/lib/plus/skuOptionsSelection/locales.d.ts +3 -0
  130. package/lib/plus/skuOptionsSelection/locales.js +3 -0
  131. package/lib/pro/Login2.0/components/LoginCodeInput.js +26 -4
  132. package/lib/pro/Login2.0/steps/CodeInput.js +27 -5
  133. package/lowcode/kiosk-sku-detail/meta.ts +229 -94
  134. package/package.json +1 -1
@@ -135,7 +135,20 @@ var locales_default = {
135
135
  },
136
136
  "page.eftpos-pay.text.tyro": (key) => {
137
137
  return key;
138
- }
138
+ },
139
+ // 汇付天下定制文案
140
+ "page.eftpos-pay.text.huifu.scan.title": "Scan to Pay (Alipay · WeChat Pay · UnionPay)",
141
+ "page.eftpos-pay.text.huifu.scan.gun.connected": "Scanner Connected",
142
+ "page.eftpos-pay.text.huifu.scan.gun.connected-desc": "Scan the customer’s payment code to collect payment",
143
+ "page.eftpos-pay.text.huifu.scan.gun.not-connected": "Scanner Not Connected",
144
+ "page.eftpos-pay.text.huifu.scan.gun.not-connected-desc": "Connect the scanner to scan the customer’s payment code",
145
+ "page.eftpos-pay.text.huifu.scan.camera-title": "Click to use the camera",
146
+ "page.eftpos-pay.text.huifu.scan.camera-desc": "Align the customer’s payment code within the frame",
147
+ "page.eftpos-pay.text.huifu.scan.input-title": "Or enter the payment code manually",
148
+ "page.eftpos-pay.text.huifu.scan.input-placeholder": "Enter payment code",
149
+ "page.eftpos-pay.text.huifu.scan.input-tip": "Tip: The payment code is 18 digits",
150
+ "page.eftpos-pay.text.huifu.scan.cancel": "Cancel",
151
+ "page.eftpos-pay.text.huifu.scan.confirm": "Confirm Payment"
139
152
  },
140
153
  "zh-CN": {
141
154
  "page.eftpos-pay.text.loading": (mode) => `${mode === "pay" || mode === "fullPay" ? "支付" : "退款"}进行中...`,
@@ -402,7 +415,20 @@ var locales_default = {
402
415
  return "请使用以下选项之一回答此问题";
403
416
  }
404
417
  return key;
405
- }
418
+ },
419
+ // 汇付天下定制文案
420
+ "page.eftpos-pay.text.huifu.scan.title": "扫码支付(支付宝 · 微信支付 · 银联)",
421
+ "page.eftpos-pay.text.huifu.scan.gun.connected": "扫码枪已连接",
422
+ "page.eftpos-pay.text.huifu.scan.gun.connected-desc": "直接扫描消费者付款码即可",
423
+ "page.eftpos-pay.text.huifu.scan.gun.not-connected": "未连接扫码枪",
424
+ "page.eftpos-pay.text.huifu.scan.gun.not-connected-desc": "连接扫码枪后可直接扫码消费者付款码",
425
+ "page.eftpos-pay.text.huifu.scan.camera-title": "点击可使用设备摄像头",
426
+ "page.eftpos-pay.text.huifu.scan.camera-desc": "将消费者付款码对准扫描框",
427
+ "page.eftpos-pay.text.huifu.scan.input-title": "或手动输入付款码",
428
+ "page.eftpos-pay.text.huifu.scan.input-placeholder": "请输入",
429
+ "page.eftpos-pay.text.huifu.scan.input-tip": "提示:付款码为18位数字",
430
+ "page.eftpos-pay.text.huifu.scan.cancel": "取消",
431
+ "page.eftpos-pay.text.huifu.scan.confirm": "确认支付"
406
432
  },
407
433
  "zh-HK": {
408
434
  "page.eftpos-pay.text.loading": (mode) => `${mode === "pay" || mode === "fullPay" ? "支付" : "退款"}進行中...`,
@@ -669,6 +695,19 @@ var locales_default = {
669
695
  return "請使用以下選項之一回答此問題";
670
696
  }
671
697
  return key;
672
- }
698
+ },
699
+ // 汇付天下定制文案
700
+ "page.eftpos-pay.text.huifu.scan.title": "掃碼支付(支付寶 · 微信支付 · 銀聯)",
701
+ "page.eftpos-pay.text.huifu.scan.gun.connected": "掃碼槍已連接",
702
+ "page.eftpos-pay.text.huifu.scan.gun.connected-desc": "直接掃描消費者付款碼即可",
703
+ "page.eftpos-pay.text.huifu.scan.gun.not-connected": "未連接掃碼槍",
704
+ "page.eftpos-pay.text.huifu.scan.gun.not-connected-desc": "連接掃碼槍後可直接掃碼消費者付款碼",
705
+ "page.eftpos-pay.text.huifu.scan.camera-title": "點擊可使用設備攝像頭",
706
+ "page.eftpos-pay.text.huifu.scan.camera-desc": "將消費者付款碼對準掃描框",
707
+ "page.eftpos-pay.text.huifu.scan.input-title": "或手動輸入付款碼",
708
+ "page.eftpos-pay.text.huifu.scan.input-placeholder": "請輸入",
709
+ "page.eftpos-pay.text.huifu.scan.input-tip": "提示:付款碼為18位數字",
710
+ "page.eftpos-pay.text.huifu.scan.cancel": "取消",
711
+ "page.eftpos-pay.text.huifu.scan.confirm": "確認支付"
673
712
  }
674
713
  };
@@ -4,4 +4,5 @@ export { default as Payo } from './payo';
4
4
  export { default as Windcave } from './windcave/windcave';
5
5
  export { default as Tyro } from './tyro';
6
6
  export { default as Linkly } from './linkly';
7
+ export { default as Huifu } from './huifu';
7
8
  export declare const getInitState: (type: string, params?: any) => State;
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/components/eftposPay/manufacturer.tsx
30
30
  var manufacturer_exports = {};
31
31
  __export(manufacturer_exports, {
32
+ Huifu: () => import_huifu.default,
32
33
  Linkly: () => import_linkly.default,
33
34
  Payo: () => import_payo.default,
34
35
  Tyro: () => import_tyro.default,
@@ -42,12 +43,15 @@ var import_const2 = __toESM(require("./payo/const"));
42
43
  var import_const3 = __toESM(require("./tyro/const"));
43
44
  var import_const4 = __toESM(require("./windcave/const"));
44
45
  var import_const5 = __toESM(require("./linkly/const"));
46
+ var import_const6 = __toESM(require("./huifu/const"));
45
47
  var import_helper = require("./helper");
46
48
  var import_payo = __toESM(require("./payo"));
47
49
  var import_windcave = __toESM(require("./windcave/windcave"));
48
50
  var import_tyro = __toESM(require("./tyro"));
49
51
  var import_linkly = __toESM(require("./linkly"));
52
+ var import_huifu = __toESM(require("./huifu"));
50
53
  var getInitState = (type, params) => {
54
+ console.log("type = ", type);
51
55
  switch (type) {
52
56
  case import_const.EftposEnum.Payo:
53
57
  return (0, import_const2.default)(params);
@@ -57,12 +61,15 @@ var getInitState = (type, params) => {
57
61
  return (0, import_const3.default)(params);
58
62
  case import_const.EftposEnum.Linkly:
59
63
  return (0, import_const5.default)(params);
64
+ case import_const.EftposEnum.Huifu:
65
+ return (0, import_const6.default)(params);
60
66
  default:
61
67
  throw new Error("未知的厂商类型");
62
68
  }
63
69
  };
64
70
  // Annotate the CommonJS export names for ESM import in node:
65
71
  0 && (module.exports = {
72
+ Huifu,
66
73
  Linkly,
67
74
  Payo,
68
75
  Tyro,
@@ -152,7 +152,7 @@ var Pay = ({
152
152
  className: `pisell-lowcode__eft-pay-box ${className}`,
153
153
  style: data.type === "step" ? {} : { display: "none" }
154
154
  },
155
- /* @__PURE__ */ import_react.default.createElement(
155
+ data.status !== import_const.StatusEnum.Init && /* @__PURE__ */ import_react.default.createElement(
156
156
  import_header.default,
157
157
  {
158
158
  status: data.status,
@@ -180,7 +180,8 @@ var Pay = ({
180
180
  formatAmount
181
181
  }
182
182
  ) : null,
183
- data.eftpos === "linkly" ? /* @__PURE__ */ import_react.default.createElement(import_manufacturer.Linkly, { key: data.key, api, onChange }) : null
183
+ data.eftpos === "linkly" ? /* @__PURE__ */ import_react.default.createElement(import_manufacturer.Linkly, { key: data.key, api, onChange }) : null,
184
+ data.eftpos === "huifu" ? /* @__PURE__ */ import_react.default.createElement(import_manufacturer.Huifu, { key: data.key, onChange, isNativeApp: isMobile }) : null
184
185
  ) : null, data.type === import_const.PayRouteEnum.Unset && Comm ? /* @__PURE__ */ import_react.default.createElement(
185
186
  Comm,
186
187
  {
@@ -91,6 +91,10 @@ export declare type State = {
91
91
  };
92
92
  backup?: Omit<State, 'backup'>;
93
93
  client: ClientEnum;
94
+ /** 原始参数 - 用于 retry 时完整恢复 */
95
+ originalParams?: {
96
+ [key: string]: unknown;
97
+ };
94
98
  };
95
99
  export declare type Action = {
96
100
  type: EActionTypes;
@@ -174,7 +178,7 @@ export declare const updateCustom: (payload: {
174
178
  export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
175
179
  type: EActionTypes;
176
180
  payload: {
177
- status: "success" | "warn" | "loading" | "fail" | "question";
181
+ status: "loading" | "warn" | "fail" | "success" | "question";
178
182
  };
179
183
  };
180
184
  /**
@@ -297,8 +301,8 @@ export declare const backUpFree: (payload: Partial<State>) => {
297
301
  amount?: string | number | undefined;
298
302
  mode?: "pay" | "fullPay" | "refund" | "query" | undefined;
299
303
  order_id?: string | number | undefined;
300
- eftpos?: "payo" | "tyro" | "windcave" | "stripe" | "linkly" | undefined;
301
- action?: "amount" | "pay" | "deviceList" | undefined;
304
+ eftpos?: "payo" | "tyro" | "windcave" | "stripe" | "linkly" | "huifu" | undefined;
305
+ action?: "pay" | "amount" | "deviceList" | undefined;
302
306
  key?: number | undefined;
303
307
  step?: number | undefined;
304
308
  title?: string | undefined;
@@ -308,7 +312,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
308
312
  net?: boolean | undefined;
309
313
  component?: string | undefined;
310
314
  form?: string | undefined;
311
- status?: "success" | "warn" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
315
+ status?: "init" | "loading" | "warn" | "fail" | "success" | "pedding" | "resove" | "reject" | "question" | undefined;
312
316
  warn?: string | undefined;
313
317
  steps?: {
314
318
  /** 用于重置当前步骤 */
@@ -344,6 +348,9 @@ export declare const backUpFree: (payload: Partial<State>) => {
344
348
  } | undefined;
345
349
  backup?: Omit<State, "backup"> | undefined;
346
350
  client?: ClientEnum | undefined;
351
+ originalParams?: {
352
+ [key: string]: unknown;
353
+ } | undefined;
347
354
  };
348
355
  };
349
356
  export declare function reducers(state: State, action: Action): State;
@@ -9,6 +9,9 @@ import './index.less';
9
9
  */
10
10
  declare function KioskSkuDetail(props: KioskSkuDetailProps): JSX.Element;
11
11
  export default KioskSkuDetail;
12
+ /**
13
+ * @description 从原生回调 payload 中提取 productId
14
+ */
12
15
  export interface KioskSkuDetailProps {
13
16
  /** 商品 id(可选:目前默认从 URL 读取,props 仅作为兜底以兼容老用法) */
14
17
  productId?: number | string;
@@ -39,7 +39,6 @@ var import_materials = require("@pisell/materials");
39
39
  var import_dayjs = __toESM(require("dayjs"));
40
40
  var import_utils = require("@pisell/utils");
41
41
  var import_skuOptionsSelection = __toESM(require("../../plus/skuOptionsSelection"));
42
- var import_pisellNumberSelector = __toESM(require("../../pro/pisellNumberSelector"));
43
42
  var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
44
43
  var import_serve = require("../booking/info/service/serve");
45
44
  var import_locales = __toESM(require("./locales"));
@@ -47,41 +46,21 @@ var import_index = require("./index.less");
47
46
  var import_utils2 = require("../booking/utils");
48
47
  function KioskSkuDetail(props) {
49
48
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
50
- const { className, style, onBack, onAddToCart } = props;
49
+ const { className, style, onAddToCart } = props;
51
50
  const productIdFromUrl = (0, import_react.useMemo)(() => {
52
51
  return getQueryFirstMatch({ keys: ["productId", "product_id", "id"] });
53
52
  }, []);
54
- const resolvedProductId = productIdFromUrl ?? props.productId;
53
+ const initialProductId = productIdFromUrl ?? props.productId ?? null;
55
54
  const scheduleDate = (0, import_react.useMemo)(() => (0, import_dayjs.default)().format("YYYY-MM-DD"), []);
55
+ const stageScale = useDesignStageScale({ designWidth: 1080, designHeight: 1800 });
56
56
  const context = (0, import_useEngineContext.default)();
57
57
  const { interaction } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
58
58
  import_utils.locales.init(import_locales.default, ((_c = (_b = context == null ? void 0 : context.engine) == null ? void 0 : _b.props) == null ? void 0 : _c.locale) || "en");
59
59
  import_utils2.request.setRequest(context.appHelper.utils.request);
60
- const { store, getData } = ((_d = context.appHelper) == null ? void 0 : _d.utils) || {};
60
+ const { store, getData, Toast } = ((_d = context.appHelper) == null ? void 0 : _d.utils) || {};
61
61
  const state = (_e = store == null ? void 0 : store.getState) == null ? void 0 : _e.call(store);
62
62
  const symbol = ((_h = (_g = (_f = store == null ? void 0 : store.getState) == null ? void 0 : _f.call(store)) == null ? void 0 : _g.global) == null ? void 0 : _h.symbol) || "$";
63
63
  const currency_code = ((_k = (_j = (_i = store == null ? void 0 : store.getState) == null ? void 0 : _i.call(store)) == null ? void 0 : _j.global) == null ? void 0 : _k.currency_code) || "AUD";
64
- (0, import_react.useEffect)(() => {
65
- var _a2, _b2;
66
- (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
67
- module: "tickets",
68
- key: "page_load"
69
- });
70
- interaction.utils.mountFunction(
71
- "tickets",
72
- "restore_buy_wallet_pass",
73
- (data) => {
74
- console.log("重置状态", data);
75
- }
76
- );
77
- interaction.utils.mountFunction(
78
- "tickets",
79
- "edit_buy_wallet_pass",
80
- (data) => {
81
- console.log("编辑状态", data);
82
- }
83
- );
84
- }, []);
85
64
  const [isLoading, setIsLoading] = (0, import_react.useState)(false);
86
65
  const [errorText, setErrorText] = (0, import_react.useState)(null);
87
66
  const [productData, setProductData] = (0, import_react.useState)(null);
@@ -98,47 +77,130 @@ function KioskSkuDetail(props) {
98
77
  bundle: [],
99
78
  option: []
100
79
  });
101
- (0, import_react.useEffect)(() => {
102
- let isCancelled = false;
103
- async function load() {
104
- if (!resolvedProductId) return;
105
- setIsLoading(true);
106
- setErrorText(null);
107
- try {
108
- const open_deposit = (getData == null ? void 0 : getData("bookingv2_deposit")) || 0;
109
- const params = { open_deposit };
110
- params.schedule_date = scheduleDate;
111
- const res = await (0, import_serve.getProductDetail)(String(resolvedProductId), params);
112
- const apiData = (res == null ? void 0 : res.data) || {};
113
- if (isCancelled) return;
114
- setProductData(apiData);
115
- const normalizedProductId = Number(
116
- (apiData == null ? void 0 : apiData.product_id) || (apiData == null ? void 0 : apiData.id) || resolvedProductId || 0
117
- );
118
- const minNumUnit = Number((apiData == null ? void 0 : apiData.min_num_unit) || 1);
80
+ const [isEdit, setIsEdit] = (0, import_react.useState)(false);
81
+ const skuOptionsSelectionRef = (0, import_react.useRef)(null);
82
+ const requestSeqRef = (0, import_react.useRef)(0);
83
+ const resetForInit = (0, import_react.useCallback)(() => {
84
+ setProductData(null);
85
+ setErrorText(null);
86
+ setQuantity(1);
87
+ setSkuValue({
88
+ product_id: 0,
89
+ product_variant_id: 0,
90
+ bundle: [],
91
+ option: []
92
+ });
93
+ setSkuDefaultValue({
94
+ product_id: 0,
95
+ product_variant_id: 0,
96
+ bundle: [],
97
+ option: []
98
+ });
99
+ }, []);
100
+ const loadByProductId = (0, import_react.useCallback)(async (productId, options = {}) => {
101
+ console.log("准备 load", productId);
102
+ if (productId === null || typeof productId === "undefined" || productId === "") return;
103
+ const reqId = ++requestSeqRef.current;
104
+ setIsLoading(true);
105
+ setErrorText(null);
106
+ try {
107
+ const open_deposit = (getData == null ? void 0 : getData("bookingv2_deposit")) || 0;
108
+ const params = { open_deposit };
109
+ params.schedule_date = scheduleDate;
110
+ const res = await (0, import_serve.getProductDetail)(String(productId), params);
111
+ console.log("详情接口");
112
+ console.log(JSON.stringify(res));
113
+ const apiData = ((res == null ? void 0 : res.id) ? res : res == null ? void 0 : res.data) || {};
114
+ if (reqId !== requestSeqRef.current) return;
115
+ setProductData(apiData);
116
+ console.log("已设置 productData");
117
+ const normalizedProductId = Number(
118
+ (apiData == null ? void 0 : apiData.product_id) || (apiData == null ? void 0 : apiData.id) || productId || 0
119
+ );
120
+ const minNumUnit = Number((apiData == null ? void 0 : apiData.min_num_unit) || 1);
121
+ if (options.shouldInitQuantity !== false) {
119
122
  setQuantity(minNumUnit > 0 ? minNumUnit : 1);
120
- const initialSkuValue = {
121
- product_id: normalizedProductId,
122
- product_variant_id: 0,
123
- bundle: [],
124
- option: []
125
- };
123
+ }
124
+ const defaultVariantId = (() => {
125
+ var _a2, _b2;
126
+ const firstVariantId = Array.isArray(apiData == null ? void 0 : apiData.variant) ? Number(((_b2 = (_a2 = apiData == null ? void 0 : apiData.variant) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.id) || 0) : 0;
127
+ return Number.isFinite(firstVariantId) ? firstVariantId : 0;
128
+ })();
129
+ const initialSkuValue = {
130
+ product_id: normalizedProductId,
131
+ product_variant_id: defaultVariantId,
132
+ bundle: [],
133
+ option: []
134
+ };
135
+ if (options.shouldInitSku !== false) {
126
136
  setSkuValue(initialSkuValue);
127
137
  setSkuDefaultValue(initialSkuValue);
128
- } catch (error) {
129
- console.error(error);
130
- if (isCancelled) return;
131
- setErrorText("Failed to load product detail");
132
- } finally {
133
- if (isCancelled) return;
134
- setIsLoading(false);
138
+ setTimeout(() => {
139
+ var _a2;
140
+ if (initialSkuValue.product_variant_id) {
141
+ (_a2 = skuOptionsSelectionRef.current) == null ? void 0 : _a2.validate();
142
+ }
143
+ }, 0);
135
144
  }
145
+ } catch (error) {
146
+ console.error(error);
147
+ setErrorText("Failed to load product detail");
148
+ } finally {
149
+ if (reqId !== requestSeqRef.current) return;
150
+ setIsLoading(false);
136
151
  }
137
- load();
138
- return () => {
139
- isCancelled = true;
140
- };
141
- }, [getData, resolvedProductId, scheduleDate]);
152
+ }, [getData, scheduleDate]);
153
+ const loadRef = (0, import_react.useRef)(loadByProductId);
154
+ loadRef.current = loadByProductId;
155
+ (0, import_react.useEffect)(() => {
156
+ var _a2, _b2, _c2, _d2, _e2, _f2;
157
+ (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
158
+ module: "wallet_pass",
159
+ key: "page_load"
160
+ });
161
+ (_d2 = (_c2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _c2.mountFunction) == null ? void 0 : _d2.call(
162
+ _c2,
163
+ "wallet_pass",
164
+ "restore_buy_wallet_pass",
165
+ (id) => {
166
+ console.log("重置状态", id);
167
+ console.log("宽", window.innerWidth);
168
+ console.log("高", window.innerHeight);
169
+ console.log("设备像素比", window.devicePixelRatio);
170
+ resetForInit();
171
+ if (id || id === 0) loadRef.current(id);
172
+ setIsEdit(false);
173
+ }
174
+ );
175
+ (_f2 = (_e2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _e2.mountFunction) == null ? void 0 : _f2.call(
176
+ _e2,
177
+ "wallet_pass",
178
+ "edit_buy_wallet_pass",
179
+ (data) => {
180
+ console.log("编辑状态", data);
181
+ const productData2 = JSON.parse(data);
182
+ setProductData(productData2.productDetail);
183
+ loadRef.current(productData2.productDetail.id, {
184
+ shouldInitSku: false,
185
+ shouldInitQuantity: false
186
+ });
187
+ setSkuValue({
188
+ product_id: productData2.productDetail.id,
189
+ product_variant_id: Number(productData2.variantId),
190
+ bundle: [],
191
+ option: []
192
+ });
193
+ setSkuDefaultValue({
194
+ product_id: productData2.productDetail.id,
195
+ product_variant_id: Number(productData2.variantId),
196
+ bundle: [],
197
+ option: []
198
+ });
199
+ setIsEdit(true);
200
+ }
201
+ );
202
+ if (initialProductId || initialProductId === 0) loadRef.current(initialProductId);
203
+ }, []);
142
204
  const coverUrl = (0, import_react.useMemo)(() => {
143
205
  return (productData == null ? void 0 : productData.cover) || (productData == null ? void 0 : productData.image) || "";
144
206
  }, [productData]);
@@ -182,55 +244,51 @@ function KioskSkuDetail(props) {
182
244
  return `${priceSign}${symbol}${deTotal.abs().toNumber().toFixed(2)}`;
183
245
  }, [itemTotal, symbol]);
184
246
  const handleAddToCart = () => {
247
+ var _a2;
185
248
  if (!productData) return;
186
- const productBundle = [];
187
- skuValue.bundle.forEach((item) => {
188
- if (!item.num || item.num < 1) return;
189
- let targetBundleData;
190
- let bundle_group_id;
191
- for (let i = 0; i < productData.bundle_group.length; i++) {
192
- const { id, bundle_item = [] } = productData.bundle_group[i];
193
- for (let j = 0; j < bundle_item.length; j++) {
194
- if (item.id === bundle_item[j].bundle_product_id) {
195
- bundle_group_id = id;
196
- targetBundleData = bundle_item[j];
197
- break;
198
- }
199
- }
200
- }
201
- productBundle.push({
202
- bundle_group_id,
203
- bundle_id: targetBundleData.id,
204
- bundle_product_id: item.id,
205
- bundle_variant_id: targetBundleData.bundle_variant_id,
206
- num: item.num,
207
- extension_id: targetBundleData.extension_id,
208
- extension_type: targetBundleData.extension_type
209
- });
210
- });
211
- productData.option_group = [];
212
- productData.variant_group = [];
249
+ (_a2 = skuOptionsSelectionRef.current) == null ? void 0 : _a2.validate();
250
+ if (!skuValue.product_variant_id) {
251
+ Toast.info(import_utils.locales.getText("pisell2.text.kiosk.sku.detail.toast.select.variant"));
252
+ return;
253
+ }
254
+ ;
213
255
  const obj = {
214
256
  productDetail: productData,
215
257
  quantity,
258
+ variantId: skuValue.product_variant_id,
216
259
  pricePerUnit: unitPrice,
217
- bundlePrice: productData.price,
218
- productBundle
260
+ isWebBuyWalletPass: true
219
261
  };
220
262
  interaction.utils.postMessageToApp({
221
- module: "tickets",
263
+ module: "wallet_pass",
222
264
  key: "buy_wallet_pass",
223
265
  data: {
224
266
  // 把洗好的数据放这里
225
- productData: [obj]
267
+ productData: obj,
268
+ isEdit
226
269
  }
227
270
  });
228
271
  };
229
- return /* @__PURE__ */ import_react.default.createElement(
272
+ const onBack = () => {
273
+ interaction.utils.postMessageToApp({
274
+ module: "wallet_pass",
275
+ key: "back"
276
+ });
277
+ };
278
+ const stageStyle = (0, import_react.useMemo)(() => {
279
+ return {
280
+ ...style || {},
281
+ width: 1080,
282
+ height: 1800,
283
+ transform: `translateX(-50%) scale(${stageScale})`,
284
+ transformOrigin: "top center"
285
+ };
286
+ }, [stageScale, style]);
287
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail-viewport" }, /* @__PURE__ */ import_react.default.createElement(
230
288
  "div",
231
289
  {
232
290
  className: (0, import_classnames.default)("pisell-kiosk-sku-detail", className),
233
- style
291
+ style: stageStyle
234
292
  },
235
293
  /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__hero" }, coverUrl ? /* @__PURE__ */ import_react.default.createElement(
236
294
  "img",
@@ -246,9 +304,10 @@ function KioskSkuDetail(props) {
246
304
  __html: descriptionText
247
305
  }
248
306
  }
249
- )), !!priceRangeText && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__price-range" }, priceRangeText, " ", currency_code), !!errorText && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__error" }, errorText)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__options-card" }, productData ? /* @__PURE__ */ import_react.default.createElement(
307
+ )), !!priceRangeText && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__price-range" }, priceRangeText, " ", currency_code), !!errorText && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__error" }, errorText)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__options-card" }, productData && Array.isArray(productData == null ? void 0 : productData.variant) && productData.variant.length > 0 ? /* @__PURE__ */ import_react.default.createElement(
250
308
  import_skuOptionsSelection.default,
251
309
  {
310
+ ref: skuOptionsSelectionRef,
252
311
  dataSource: productData,
253
312
  value: skuDefaultValue,
254
313
  skuCardConfig: {
@@ -273,22 +332,7 @@ function KioskSkuDetail(props) {
273
332
  onClick: onBack
274
333
  },
275
334
  import_utils.locales.getText("pisell2.text.kiosk.sku.detail.btn.back")
276
- ), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__footer-center" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__item-total" }, import_utils.locales.getText("pisell2.text.kiosk.sku.detail.item.total"), ":", " ", itemTotalText), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__qty" }, /* @__PURE__ */ import_react.default.createElement(
277
- import_pisellNumberSelector.default,
278
- {
279
- value: quantity,
280
- width: "140px",
281
- onChange: (v) => {
282
- if (!v) return;
283
- setQuantity(v);
284
- },
285
- min: 1,
286
- max: 99999,
287
- step: 1,
288
- size: "large",
289
- enablePriceAdjust: false
290
- }
291
- ))), /* @__PURE__ */ import_react.default.createElement(
335
+ ), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__footer-center" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-kiosk-sku-detail__item-total" }, import_utils.locales.getText("pisell2.text.kiosk.sku.detail.item.total"), ":", " ", itemTotalText)), /* @__PURE__ */ import_react.default.createElement(
292
336
  import_materials.Button,
293
337
  {
294
338
  type: "primary",
@@ -297,9 +341,11 @@ function KioskSkuDetail(props) {
297
341
  onClick: handleAddToCart,
298
342
  disabled: !productData || isLoading
299
343
  },
300
- import_utils.locales.getText("pisell2.text.kiosk.sku.detail.btn.add.to.cart")
344
+ import_utils.locales.getText(
345
+ isEdit ? "pisell2.text.kiosk.sku.detail.btn.update" : "pisell2.text.kiosk.sku.detail.btn.add.to.cart"
346
+ )
301
347
  ))
302
- );
348
+ ));
303
349
  }
304
350
  var kioskSkuDetail_default = KioskSkuDetail;
305
351
  function getQueryFirstMatch(params) {
@@ -324,3 +370,24 @@ function getQueryFirstMatch(params) {
324
370
  if (queryIndex === -1) return null;
325
371
  return tryRead(hash.slice(queryIndex + 1));
326
372
  }
373
+ function useDesignStageScale(params) {
374
+ const designWidth = params.designWidth;
375
+ const designHeight = params.designHeight;
376
+ const [scale, setScale] = (0, import_react.useState)(1);
377
+ (0, import_react.useEffect)(() => {
378
+ const update = () => {
379
+ const viewportWidth = window.innerWidth || designWidth;
380
+ const viewportHeight = window.innerHeight || designHeight;
381
+ const nextScale = Math.min(
382
+ viewportWidth / designWidth,
383
+ viewportHeight / designHeight,
384
+ 1
385
+ );
386
+ setScale(nextScale);
387
+ };
388
+ update();
389
+ window.addEventListener("resize", update);
390
+ return () => window.removeEventListener("resize", update);
391
+ }, [designHeight, designWidth]);
392
+ return scale;
393
+ }
@@ -1,7 +1,17 @@
1
- .pisell-kiosk-sku-detail {
1
+ .pisell-kiosk-sku-detail-viewport {
2
2
  position: relative;
3
- width: 100%;
3
+ width: 100vw;
4
4
  height: 100vh;
5
+ overflow: hidden;
6
+ background: #f2f4f7;
7
+ }
8
+
9
+ .pisell-kiosk-sku-detail {
10
+ position: absolute;
11
+ top: 0;
12
+ left: 50%;
13
+ width: 1080px;
14
+ height: 1800px;
5
15
  overflow-y: auto;
6
16
  background: #f2f4f7;
7
17
  background-size: cover;
@@ -11,12 +21,40 @@
11
21
  }
12
22
 
13
23
  .pisell-kiosk-sku-detail__content {
14
- max-width: 1000px;
24
+ width: 100%;
15
25
  margin: 0 auto;
16
26
  display: flex;
17
27
  flex-direction: column;
18
28
  gap: 40px;
19
29
  padding-bottom: 220px; // avoid overlap with footer
30
+ .pisell-pro-selector_header-content {
31
+ .pisell-pro-selector_header-content-title {
32
+ color: #101828;
33
+ font-size: 36px !important;
34
+ }
35
+ .pisell-lowcode-tag {
36
+ font-size: 22px !important;
37
+ margin-left: 20px !important;
38
+ padding-top: 5px !important;
39
+ padding-bottom: 5px !important;
40
+ }
41
+ }
42
+ .pisell-pro-selector_tip {
43
+ font-size: 36px !important;
44
+ color: #667085;
45
+ }
46
+ .pisell-sku-options-selection-variant-card__title {
47
+ font-size: 36px !important;
48
+ font-weight: 600 !important;
49
+ color: #101828;
50
+ }
51
+ .pisell-sku-options-selection-variant-card__price {
52
+ font-size: 30px !important;
53
+ }
54
+ .pisell-sku-options-selection-variant-card {
55
+ padding-top: 30px !important;
56
+ padding-bottom: 30px !important;
57
+ }
20
58
  }
21
59
 
22
60
  .pisell-kiosk-sku-detail__hero {
@@ -55,7 +93,6 @@
55
93
  }
56
94
 
57
95
  .pisell-kiosk-sku-detail__desc {
58
- max-width: 860px;
59
96
  font-size: 36px;
60
97
  line-height: 44px;
61
98
  font-weight: 400;
@@ -91,11 +128,13 @@
91
128
  }
92
129
 
93
130
  .pisell-kiosk-sku-detail__footer {
131
+ // 注意:父容器有 transform(scale),fixed 会相对该容器定位(适配小分辨率缩放舞台)
94
132
  position: fixed;
95
- left: 50%;
133
+ left: 30px;
134
+ right: 30px;
96
135
  bottom: 30px;
97
- transform: translateX(-50%);
98
- width: min(1020px, calc(100% - 60px));
136
+ transform: none;
137
+ width: auto;
99
138
  display: flex;
100
139
  align-items: center;
101
140
  justify-content: space-between;
@@ -125,6 +164,9 @@
125
164
  display: flex;
126
165
  align-items: center;
127
166
  gap: 20px;
167
+ // 靠右,并与右侧主按钮保持 20px 间距
168
+ margin-left: auto;
169
+ margin-right: 20px;
128
170
  }
129
171
 
130
172
  .pisell-kiosk-sku-detail__item-total {