@pisell/private-materials 6.3.175 → 6.3.177

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 (29) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +9 -9
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +1 -1
  9. package/es/components/appointmentBooking/components/Voucher/index.js +1 -1
  10. package/es/components/scanOrder/components/Check/index.js +187 -46
  11. package/es/components/scanOrder/components/Check/index.less +39 -0
  12. package/es/components/scanOrder/components/Content/index.js +189 -72
  13. package/es/components/scanOrder/components/Menu/index.js +11 -5
  14. package/es/components/scanOrder/hooks.js +7 -0
  15. package/es/components/scanOrder/locales.d.ts +75 -0
  16. package/es/components/scanOrder/locales.js +75 -0
  17. package/es/components/venueBooking/components/Voucher/index.js +6 -1
  18. package/es/pro/Login2.0/locales.js +1 -1
  19. package/lib/components/appointmentBooking/components/Voucher/index.js +1 -1
  20. package/lib/components/scanOrder/components/Check/index.js +116 -3
  21. package/lib/components/scanOrder/components/Check/index.less +39 -0
  22. package/lib/components/scanOrder/components/Content/index.js +106 -25
  23. package/lib/components/scanOrder/components/Menu/index.js +2 -0
  24. package/lib/components/scanOrder/hooks.js +7 -0
  25. package/lib/components/scanOrder/locales.d.ts +75 -0
  26. package/lib/components/scanOrder/locales.js +75 -0
  27. package/lib/components/venueBooking/components/Voucher/index.js +5 -1
  28. package/lib/pro/Login2.0/locales.js +1 -1
  29. package/package.json +1 -1
@@ -30,6 +30,21 @@ export default {
30
30
  'pisell2.scan.order.products.empty.tip': 'Please select products',
31
31
  'pisell2.scan.order.check.cart.empty.tip': 'Please go back to add products',
32
32
  'pisell2.scan.order.submit.disabled.default': 'Order submission is currently disabled.',
33
+ 'pisell2.scan.order.multiple.orders.tip': 'There are multiple active orders for this table. Please contact staff for add-on orders.',
34
+ 'pisell2.scan.order.multiple.orders.confirm': 'I Got It',
35
+ 'pisell2.scan.order.settled.cannot.add.tip': 'This order has already been settled and you cannot add more items. Please scan again to create a new order or contact staff.',
36
+ 'pisell2.scan.order.inventory.insufficient.title': 'Insufficient inventory',
37
+ 'pisell2.scan.order.inventory.insufficient.description': 'The following items are out of stock or do not have enough inventory. Please adjust your cart and try again.',
38
+ 'pisell2.scan.order.inventory.insufficient.products.label': 'Unavailable products:',
39
+ 'pisell2.scan.order.add.on.confirm.title': 'This table has already started ordering',
40
+ 'pisell2.scan.order.add.on.confirm.description': 'Someone at your table has placed the order. This will be submitted as an add-on order.',
41
+ 'pisell2.scan.order.add.on.confirm.button': 'Confirm Add-on Order',
42
+ 'pisell2.scan.order.add.on.return.button': 'Return to Cart',
43
+ 'pisell2.scan.order.add.on.unavailable.title': 'Add-on ordering is not available',
44
+ 'pisell2.scan.order.add.on.unavailable.description': 'You can’t add items to this order from your phone right now.\nPlease ask a staff member for help.',
45
+ 'pisell2.scan.order.add.on.unavailable.confirm': 'Got it',
46
+ 'pisell2.scan.order.add.on.login.required.title': 'Notice',
47
+ 'pisell2.scan.order.add.on.login.required': 'Please login before placing an add-on order.',
33
48
  'pisell2.text.goodpass': 'Promotion',
34
49
  'pisell2.text.goodpass.product-vouchers': 'Product Vouchers',
35
50
  'pisell2.text.goodpass.view-more': 'View More',
@@ -79,6 +94,21 @@ export default {
79
94
  'pisell2.scan.order.products.empty.tip': '请选择商品',
80
95
  'pisell2.scan.order.check.cart.empty.tip': '请返回添加商品',
81
96
  'pisell2.scan.order.submit.disabled.default': '当前暂不可下单',
97
+ 'pisell2.scan.order.multiple.orders.tip': '当前桌台存在多个进行中的订单,请联系店员处理加餐。',
98
+ 'pisell2.scan.order.multiple.orders.confirm': '我知道了',
99
+ 'pisell2.scan.order.settled.cannot.add.tip': '当前订单已结账,无法继续加餐。请重新扫码创建新订单或联系店员。',
100
+ 'pisell2.scan.order.inventory.insufficient.title': '库存不足',
101
+ 'pisell2.scan.order.inventory.insufficient.description': '以下商品库存不足或已售罄,请调整购物车后重新提交。',
102
+ 'pisell2.scan.order.inventory.insufficient.products.label': '异常商品:',
103
+ 'pisell2.scan.order.add.on.confirm.title': '本桌已开始点餐',
104
+ 'pisell2.scan.order.add.on.confirm.description': '同行顾客已提交订单。本次将作为加餐提交,请确认后继续。',
105
+ 'pisell2.scan.order.add.on.confirm.button': '确认加餐',
106
+ 'pisell2.scan.order.add.on.return.button': '返回购物车',
107
+ 'pisell2.scan.order.add.on.unavailable.title': '暂不支持加餐',
108
+ 'pisell2.scan.order.add.on.unavailable.description': '当前无法通过手机为此订单加餐。\n如需加餐,请联系工作人员。',
109
+ 'pisell2.scan.order.add.on.unavailable.confirm': '我知道了',
110
+ 'pisell2.scan.order.add.on.login.required.title': '提示',
111
+ 'pisell2.scan.order.add.on.login.required': '需要登录后才能加餐',
82
112
  'pisell2.text.goodpass': '促销',
83
113
  'pisell2.text.goodpass.product-vouchers': '商品兑换券',
84
114
  'pisell2.text.goodpass.view-more': '查看更多',
@@ -128,6 +158,21 @@ export default {
128
158
  'pisell2.scan.order.products.empty.tip': '請選擇商品',
129
159
  'pisell2.scan.order.check.cart.empty.tip': '請返回添加商品',
130
160
  'pisell2.scan.order.submit.disabled.default': '當前暫不可下單',
161
+ 'pisell2.scan.order.multiple.orders.tip': '當前桌台存在多個進行中的訂單,請聯繫店員處理加餐。',
162
+ 'pisell2.scan.order.multiple.orders.confirm': '我知道了',
163
+ 'pisell2.scan.order.settled.cannot.add.tip': '當前訂單已結賬,無法繼續加餐。請重新掃碼創建新訂單或聯繫店員。',
164
+ 'pisell2.scan.order.inventory.insufficient.title': '庫存不足',
165
+ 'pisell2.scan.order.inventory.insufficient.description': '以下商品庫存不足或已售罄,請調整購物車後重新提交。',
166
+ 'pisell2.scan.order.inventory.insufficient.products.label': '異常商品:',
167
+ 'pisell2.scan.order.add.on.confirm.title': '本桌已開始點餐',
168
+ 'pisell2.scan.order.add.on.confirm.description': '同行顧客已提交訂單。本次將作為加餐提交,請確認後繼續。',
169
+ 'pisell2.scan.order.add.on.confirm.button': '確認加餐',
170
+ 'pisell2.scan.order.add.on.return.button': '返回購物車',
171
+ 'pisell2.scan.order.add.on.unavailable.title': '暫不支援加餐',
172
+ 'pisell2.scan.order.add.on.unavailable.description': '目前無法透過手機為此訂單加餐。\n如需加餐,請聯絡工作人員。',
173
+ 'pisell2.scan.order.add.on.unavailable.confirm': '我知道了',
174
+ 'pisell2.scan.order.add.on.login.required.title': '提示',
175
+ 'pisell2.scan.order.add.on.login.required': '需要登錄後才能加餐',
131
176
  'pisell2.text.goodpass': '促銷',
132
177
  'pisell2.text.goodpass.product-vouchers': '商品兌換券',
133
178
  'pisell2.text.goodpass.view-more': '查看更多',
@@ -177,6 +222,21 @@ export default {
177
222
  'pisell2.scan.order.products.empty.tip': '商品を選択してください',
178
223
  'pisell2.scan.order.check.cart.empty.tip': '商品を追加するには、前の画面に戻ってください',
179
224
  'pisell2.scan.order.submit.disabled.default': '現在、注文を送信できません。',
225
+ 'pisell2.scan.order.multiple.orders.tip': '現在のテーブルには進行中の注文が複数あります。追加注文についてはスタッフにお問い合わせください。',
226
+ 'pisell2.scan.order.multiple.orders.confirm': '了解しました',
227
+ 'pisell2.scan.order.settled.cannot.add.tip': '現在の注文はすでに会計済みのため、追加注文できません。再度QRコードをスキャンして新しい注文を作成するか、スタッフにお問い合わせください。',
228
+ 'pisell2.scan.order.inventory.insufficient.title': '在庫が不足しています',
229
+ 'pisell2.scan.order.inventory.insufficient.description': '以下の商品は在庫切れ、または在庫が不足しています。カートを調整してからもう一度送信してください。',
230
+ 'pisell2.scan.order.inventory.insufficient.products.label': '対象商品:',
231
+ 'pisell2.scan.order.add.on.confirm.title': 'このテーブルではすでに注文が開始されています',
232
+ 'pisell2.scan.order.add.on.confirm.description': '同席のお客様がすでに注文を送信しました。今回は追加注文として送信されます。確認して続行してください。',
233
+ 'pisell2.scan.order.add.on.confirm.button': '追加注文を確認',
234
+ 'pisell2.scan.order.add.on.return.button': 'カートに戻る',
235
+ 'pisell2.scan.order.add.on.unavailable.title': '追加注文は現在ご利用いただけません',
236
+ 'pisell2.scan.order.add.on.unavailable.description': '現在、スマートフォンからこの注文に商品を追加することはできません。\n追加注文をご希望の場合は、スタッフにお声がけください。',
237
+ 'pisell2.scan.order.add.on.unavailable.confirm': '了解しました',
238
+ 'pisell2.scan.order.add.on.login.required.title': 'お知らせ',
239
+ 'pisell2.scan.order.add.on.login.required': '追加注文を行うにはログインが必要です。',
180
240
  'pisell2.text.goodpass': 'プロモーション',
181
241
  'pisell2.text.goodpass.product-vouchers': '商品バウチャー',
182
242
  'pisell2.text.goodpass.view-more': 'もっと見る',
@@ -226,6 +286,21 @@ export default {
226
286
  'pisell2.scan.order.products.empty.tip': 'Selecione produtos',
227
287
  'pisell2.scan.order.check.cart.empty.tip': 'Volte para adicionar produtos',
228
288
  'pisell2.scan.order.submit.disabled.default': 'No momento, não é possível enviar pedidos.',
289
+ 'pisell2.scan.order.multiple.orders.tip': 'Há vários pedidos ativos nesta mesa. Entre em contato com a equipe para adicionar itens.',
290
+ 'pisell2.scan.order.multiple.orders.confirm': 'Entendi',
291
+ 'pisell2.scan.order.settled.cannot.add.tip': 'Este pedido já foi finalizado e não é possível adicionar mais itens. Escaneie novamente para criar um novo pedido ou entre em contato com a equipe.',
292
+ 'pisell2.scan.order.inventory.insufficient.title': 'Estoque insuficiente',
293
+ 'pisell2.scan.order.inventory.insufficient.description': 'Os seguintes itens estão sem estoque ou não têm estoque suficiente. Ajuste o carrinho e tente novamente.',
294
+ 'pisell2.scan.order.inventory.insufficient.products.label': 'Produtos indisponíveis:',
295
+ 'pisell2.scan.order.add.on.confirm.title': 'Esta mesa já começou a fazer o pedido',
296
+ 'pisell2.scan.order.add.on.confirm.description': 'Alguém na sua mesa já enviou o pedido. Este será enviado como um pedido adicional.',
297
+ 'pisell2.scan.order.add.on.confirm.button': 'Confirmar pedido adicional',
298
+ 'pisell2.scan.order.add.on.return.button': 'Voltar ao carrinho',
299
+ 'pisell2.scan.order.add.on.unavailable.title': 'Pedidos adicionais não estão disponíveis',
300
+ 'pisell2.scan.order.add.on.unavailable.description': 'No momento, você não pode adicionar itens a este pedido pelo celular.\nPeça ajuda a um membro da equipe.',
301
+ 'pisell2.scan.order.add.on.unavailable.confirm': 'Entendi',
302
+ 'pisell2.scan.order.add.on.login.required.title': 'Aviso',
303
+ 'pisell2.scan.order.add.on.login.required': 'Faça login antes de fazer um pedido adicional.',
229
304
  'pisell2.text.goodpass': 'Promoção',
230
305
  'pisell2.text.goodpass.product-vouchers': 'Vales de Produto',
231
306
  'pisell2.text.goodpass.view-more': 'Ver Mais',
@@ -189,7 +189,12 @@ export default function VoucherCard() {
189
189
  className: "login-btn",
190
190
  onClick: function onClick() {
191
191
  openLoginModal({
192
- callback: function callback() {}
192
+ callback: function callback(status) {
193
+ if (status !== 'success') return;
194
+ handleLoginSuccess().then(function () {
195
+ void syncAfterDiscountChange();
196
+ });
197
+ }
193
198
  });
194
199
  }
195
200
  }, locales.getText('pisell2.text.goodpass.login')), ' ', /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.text.goodpass.login-tip'))));
@@ -259,7 +259,7 @@ export default {
259
259
  'pisell-register2-complete-title': '注册完成!',
260
260
  'pisell-register2-redirecting': '正在重定向到您的帐户...',
261
261
  'pisell-login2-continue-with-email': '使用邮箱',
262
- 'pisell-login2-continue-with-phone': '使用手机',
262
+ 'pisell-login2-continue-with-phone': '使用手机号继续',
263
263
  'pisell-login2-email-not-registered': '该邮箱未注册,请先注册',
264
264
  'pisell-login2-check-email-failed': '检查邮箱失败,请重试',
265
265
  'pisell-login2-continue-failed': '继续失败,请重试',
@@ -147,7 +147,7 @@ var VoucherCard = (props) => {
147
147
  var _a2, _b2, _c;
148
148
  const originBundleProductId = (originBundle == null ? void 0 : originBundle.bundle_product_id) || (originBundle == null ? void 0 : originBundle.bundle_id);
149
149
  const bundleProductId = (bundleItem == null ? void 0 : bundleItem._bundle_product_id) || (bundleItem == null ? void 0 : bundleItem.product_id) || ((_a2 = bundleItem == null ? void 0 : bundleItem.originBundleItem) == null ? void 0 : _a2._bundle_product_id) || ((_b2 = bundleItem == null ? void 0 : bundleItem.originBundleItem) == null ? void 0 : _b2.product_id);
150
- return String(originBundleProductId || "") === String(bundleProductId || "") || String(((_c = originBundle == null ? void 0 : originBundle.metadata) == null ? void 0 : _c.custom_product_bundle_map_id) || "") === String((bundleItem == null ? void 0 : bundleItem._id) || "");
150
+ return (String(originBundleProductId || "") === String(bundleProductId || "") || String(((_c = originBundle == null ? void 0 : originBundle.metadata) == null ? void 0 : _c.custom_product_bundle_map_id) || "") === String((bundleItem == null ? void 0 : bundleItem._id) || "")) && (originBundle == null ? void 0 : originBundle.bundle_id) === (bundleItem == null ? void 0 : bundleItem.bundle_id);
151
151
  };
152
152
  const syncOriginProductBundles = (item) => {
153
153
  var _a2, _b2;
@@ -43,11 +43,12 @@ var import_context = require("../../context");
43
43
  var import_hooks = require("../../hooks");
44
44
  var import_index = require("./index.less");
45
45
  function Check() {
46
- const { viewModel, runModuleAction, refreshViewModel, tableName, entryMode, clearStepCache } = (0, import_context.useScanOrderContext)();
46
+ const { viewModel, runModuleAction, refreshViewModel, tableName, entryMode, clearStepCache, entryContext } = (0, import_context.useScanOrderContext)();
47
47
  const isAdditionalOrder = entryMode === "additional_order";
48
48
  const [submitting, setSubmitting] = (0, import_react.useState)(false);
49
49
  const [note, setNote] = (0, import_react.useState)((viewModel == null ? void 0 : viewModel.note) || "");
50
50
  const [pickupRefOpen, setPickupRefOpen] = (0, import_react.useState)(false);
51
+ const [addOnConfirmOpen, setAddOnConfirmOpen] = (0, import_react.useState)(false);
51
52
  const utils = (0, import_hooks.contextUtils)();
52
53
  const [dineInConfig, setDineInConfig] = (0, import_react.useState)(null);
53
54
  const [channel, setChannel] = (0, import_react.useState)("");
@@ -84,6 +85,30 @@ function Check() {
84
85
  () => String(import_utils.locales.getText("pisell2.scan.order.products.title") || "Products"),
85
86
  []
86
87
  );
88
+ const addOnConfirmTitle = (0, import_react.useMemo)(
89
+ () => String(
90
+ import_utils.locales.getText("pisell2.scan.order.add.on.confirm.title") || "This table has already started ordering"
91
+ ),
92
+ []
93
+ );
94
+ const addOnConfirmDescription = (0, import_react.useMemo)(
95
+ () => String(
96
+ import_utils.locales.getText("pisell2.scan.order.add.on.confirm.description") || "Someone at your table has placed the order. This will be submitted as an add-on order."
97
+ ),
98
+ []
99
+ );
100
+ const addOnConfirmButtonText = (0, import_react.useMemo)(
101
+ () => String(
102
+ import_utils.locales.getText("pisell2.scan.order.add.on.confirm.button") || "Confirm Add-on Order"
103
+ ),
104
+ []
105
+ );
106
+ const addOnReturnButtonText = (0, import_react.useMemo)(
107
+ () => String(
108
+ import_utils.locales.getText("pisell2.scan.order.add.on.return.button") || "Return to Cart"
109
+ ),
110
+ []
111
+ );
87
112
  const showCheckStepEmptyCartTip = () => {
88
113
  import_antd.message.error(import_utils.locales.getText("pisell2.scan.order.check.cart.empty.tip") || "Please go back to add products");
89
114
  };
@@ -91,6 +116,28 @@ function Check() {
91
116
  const content = String(tip || import_utils.locales.getText("pisell2.scan.order.submit.failed") || "Submit order failed");
92
117
  (0, import_materials.PisellToast)({ content });
93
118
  }, []);
119
+ const showInventoryInsufficientModal = (0, import_react.useCallback)((error) => {
120
+ var _a;
121
+ setSubmitting(false);
122
+ const unavailableProducts = Array.isArray((_a = error == null ? void 0 : error.data) == null ? void 0 : _a.unavailable_products) ? error.data.unavailable_products : [];
123
+ const productNames = unavailableProducts.map((product) => String((product == null ? void 0 : product.title) || (product == null ? void 0 : product.product_id) || "").trim()).filter(Boolean);
124
+ const title = String(
125
+ import_utils.locales.getText("pisell2.scan.order.inventory.insufficient.title") || "Insufficient inventory"
126
+ );
127
+ const description = String(
128
+ import_utils.locales.getText("pisell2.scan.order.inventory.insufficient.description") || "The following items are out of stock or do not have enough inventory. Please adjust your cart and try again."
129
+ );
130
+ const productsLabel = String(
131
+ import_utils.locales.getText("pisell2.scan.order.inventory.insufficient.products.label") || "Unavailable products:"
132
+ );
133
+ const fallbackMessage = String((error == null ? void 0 : error.message) || description);
134
+ import_antd.Modal.info({
135
+ title,
136
+ content: /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement("div", null, description), /* @__PURE__ */ import_react.default.createElement("div", null, productsLabel), productNames.length > 0 ? /* @__PURE__ */ import_react.default.createElement("ul", null, productNames.map((name, index) => /* @__PURE__ */ import_react.default.createElement("li", { key: `${name}-${index}` }, name))) : /* @__PURE__ */ import_react.default.createElement("div", null, fallbackMessage)),
137
+ okText: String(import_utils.locales.getText("pisell2.event.confirm") || "OK"),
138
+ maskClosable: false
139
+ });
140
+ }, []);
94
141
  const doSubmit = async () => {
95
142
  var _a, _b, _c, _d, _e;
96
143
  const items = (viewModel == null ? void 0 : viewModel.cartItems) || [];
@@ -105,6 +152,10 @@ function Check() {
105
152
  const res = await runModuleAction("submitScanOrder");
106
153
  console.log("submitScanOrder >>>>> ", res);
107
154
  if ((res == null ? void 0 : res.status) === false) {
155
+ if ((res == null ? void 0 : res.code) === 6008) {
156
+ showInventoryInsufficientModal(res);
157
+ return;
158
+ }
108
159
  setSubmitting(false);
109
160
  showSubmitFailedTip(res == null ? void 0 : res.message);
110
161
  return;
@@ -118,7 +169,8 @@ function Check() {
118
169
  clearStepCache();
119
170
  const channelMap = {
120
171
  "scan_to_order": "table-order",
121
- "scan_to_order_2": "mobile_order"
172
+ "scan_to_order_2": "mobile_order",
173
+ "scan_to_order_3": "scantoorder3"
122
174
  };
123
175
  const saleChannel = channelMap[channel] || channel;
124
176
  if (shouldPayOnSubmit) {
@@ -161,7 +213,28 @@ function Check() {
161
213
  await refreshViewModel();
162
214
  } catch (error) {
163
215
  console.error("[scanOrder] submitScanOrder failed", error);
164
- showSubmitFailedTip(error == null ? void 0 : error.message);
216
+ if ((error == null ? void 0 : error.code) === 670005) {
217
+ setSubmitting(false);
218
+ showSubmitFailedTip(
219
+ String(import_utils.locales.getText("pisell2.scan.order.settled.cannot.add.tip") || "")
220
+ );
221
+ } else if ((error == null ? void 0 : error.code) === 670007 && (entryContext == null ? void 0 : entryContext.resource_id)) {
222
+ const reservationResourceSelectType = await runModuleAction("getReservationResourceSelectType");
223
+ const allowAddItems = await runModuleAction("checkAllowAddItems");
224
+ const res = await runModuleAction("syncAdditionalOrderFromResource", entryContext == null ? void 0 : entryContext.resource_id);
225
+ if (reservationResourceSelectType.resourceSelectType === "single" && (allowAddItems == null ? void 0 : allowAddItems.enabled) && (res == null ? void 0 : res.matched)) {
226
+ setSubmitting(false);
227
+ setAddOnConfirmOpen(true);
228
+ } else {
229
+ setSubmitting(false);
230
+ showSubmitFailedTip(error == null ? void 0 : error.message);
231
+ }
232
+ } else if ((error == null ? void 0 : error.code) === 6008) {
233
+ showInventoryInsufficientModal(error);
234
+ } else {
235
+ setSubmitting(false);
236
+ showSubmitFailedTip(error == null ? void 0 : error.message);
237
+ }
165
238
  } finally {
166
239
  }
167
240
  };
@@ -209,6 +282,15 @@ function Check() {
209
282
  if (submitting) return;
210
283
  setPickupRefOpen(false);
211
284
  };
285
+ const handleAddOnConfirm = async () => {
286
+ if (submitting) return;
287
+ setAddOnConfirmOpen(false);
288
+ await doSubmit();
289
+ };
290
+ const handleAddOnReturn = () => {
291
+ if (submitting) return;
292
+ setAddOnConfirmOpen(false);
293
+ };
212
294
  const noteContent = /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-check-note" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-check-note-title" }, noteTitle), /* @__PURE__ */ import_react.default.createElement(
213
295
  import_antd.Input.TextArea,
214
296
  {
@@ -243,5 +325,36 @@ function Check() {
243
325
  onCancel: handlePickupRefCancel,
244
326
  onConfirm: handlePickupRefConfirm
245
327
  }
328
+ ), /* @__PURE__ */ import_react.default.createElement(
329
+ import_antd.Modal,
330
+ {
331
+ open: addOnConfirmOpen,
332
+ footer: null,
333
+ onCancel: handleAddOnReturn,
334
+ maskClosable: false,
335
+ destroyOnClose: true,
336
+ centered: true,
337
+ className: "pisell-scan-order-add-on-confirm-modal"
338
+ },
339
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-add-on-confirm-body" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-add-on-confirm-title" }, addOnConfirmTitle), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-add-on-confirm-desc" }, addOnConfirmDescription), /* @__PURE__ */ import_react.default.createElement(
340
+ import_materials.Button,
341
+ {
342
+ type: "primary",
343
+ block: true,
344
+ size: "large",
345
+ loading: submitting,
346
+ onClick: handleAddOnConfirm
347
+ },
348
+ addOnConfirmButtonText
349
+ ), /* @__PURE__ */ import_react.default.createElement(
350
+ import_materials.Button,
351
+ {
352
+ block: true,
353
+ size: "large",
354
+ disabled: submitting,
355
+ onClick: handleAddOnReturn
356
+ },
357
+ addOnReturnButtonText
358
+ ))
246
359
  ), submitting ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-check-loading-mask" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-check-loading-panel" }, /* @__PURE__ */ import_react.default.createElement(import_materials.PisellLoading, { loading: true, mask: { backgroundColor: "transparent", width: 64, height: 64 } }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-check-loading-placeholder" })))) : null);
247
360
  }
@@ -80,3 +80,42 @@
80
80
  width: 64px;
81
81
  height: 64px;
82
82
  }
83
+
84
+ .pisell-scan-order-add-on-confirm-modal {
85
+ .pisell-lowcode-modal-content {
86
+ border-radius: 28px;
87
+ }
88
+
89
+ .pisell-lowcode-modal-body {
90
+ padding: 42px 32px 32px;
91
+ }
92
+ }
93
+
94
+ .pisell-scan-order-add-on-confirm-body {
95
+ display: flex;
96
+ flex-direction: column;
97
+ gap: 16px;
98
+ text-align: center;
99
+
100
+ .pisell-lowcode-btn {
101
+ height: 56px;
102
+ border-radius: 18px;
103
+ font-size: 18px;
104
+ font-weight: 700;
105
+ }
106
+ }
107
+
108
+ .pisell-scan-order-add-on-confirm-title {
109
+ color: #1f2937;
110
+ font-size: 28px;
111
+ font-weight: 800;
112
+ line-height: 1.25;
113
+ }
114
+
115
+ .pisell-scan-order-add-on-confirm-desc {
116
+ margin-bottom: 18px;
117
+ color: #667085;
118
+ font-size: 20px;
119
+ font-weight: 400;
120
+ line-height: 1.35;
121
+ }
@@ -95,7 +95,7 @@ function ReadyState() {
95
95
  resumeStep,
96
96
  consumeResumeStep
97
97
  } = (0, import_context.useScanOrderContext)();
98
- const { isLogin, openLoginModal } = (0, import_hooks.useScanOrderLogin)();
98
+ const { openLoginModal } = (0, import_hooks.useScanOrderLogin)();
99
99
  const utils = (0, import_hooks.contextUtils)();
100
100
  const [FormCard] = (0, import_useComponents.default)({
101
101
  components: ["FormCard"]
@@ -154,6 +154,7 @@ function ReadyState() {
154
154
  const requestPaxMinRef = (0, import_react.useRef)(1);
155
155
  const requestPaxMaxRef = (0, import_react.useRef)(1);
156
156
  const tableFormRecordRef = (0, import_react.useRef)(null);
157
+ const entryLoginPromptedRef = (0, import_react.useRef)(false);
157
158
  const entryPaxModalWasPresentedRef = (0, import_react.useRef)(false);
158
159
  const getLocalizedName = (nameMap) => {
159
160
  if (!nameMap) return "";
@@ -186,6 +187,10 @@ function ReadyState() {
186
187
  };
187
188
  };
188
189
  const app = (_a = utils == null ? void 0 : utils.getApp) == null ? void 0 : _a.call(utils);
190
+ const getCurrentIsLogin = () => {
191
+ var _a2, _b2;
192
+ return Boolean((_b2 = (_a2 = utils == null ? void 0 : utils.token) == null ? void 0 : _a2.get) == null ? void 0 : _b2.call(_a2));
193
+ };
189
194
  const navigateToHome = () => {
190
195
  var _a2, _b2;
191
196
  if ((_a2 = app == null ? void 0 : app.history) == null ? void 0 : _a2.replace) {
@@ -349,8 +354,7 @@ function ReadyState() {
349
354
  return (_b2 = (_a2 = utils == null ? void 0 : utils.request) == null ? void 0 : _a2.get) == null ? void 0 : _b2.call(_a2, `/h5/shop-policy/${id}`, {});
350
355
  };
351
356
  (0, import_react.useEffect)(() => {
352
- const checkResourceAvailable = async () => {
353
- var _a2;
357
+ const runResourceCheck = async () => {
354
358
  const hasOrderId = !!(entryContext == null ? void 0 : entryContext.order_id);
355
359
  const {
356
360
  mode,
@@ -392,39 +396,116 @@ function ReadyState() {
392
396
  }
393
397
  await runEntryPaxGateThenEnterProduct();
394
398
  } else if (isAdditionalOrder) {
395
- await enterProductStep();
396
- } else if (mode === "submit_disabled") {
397
- const tips = resolveLocalizedText(errorTips) || String(import_utils.locales.getText("pisell2.scan.order.submit.disabled.default") || "");
398
- setSubmitDisabledTips(tips);
399
- await enterProductStep();
400
- } else if (mode === "resource_busy") {
401
- if (Number(order_id) !== 0) {
402
- if (!isLogin) {
399
+ const allowAddItems = await runModuleAction("checkAllowAddItems");
400
+ if (!getCurrentIsLogin()) {
401
+ const openLoginForOrderDetail = () => {
402
+ var _a2;
403
403
  (_a2 = scanOrderModule == null ? void 0 : scanOrderModule.setUIState) == null ? void 0 : _a2.call(scanOrderModule, "pendingStep", currentStep);
404
404
  openLoginModal({
405
- callback: (status) => {
406
- var _a3, _b2;
405
+ callback: async (status) => {
407
406
  if (status === "success") {
408
- (_a3 = scanOrderModule == null ? void 0 : scanOrderModule.deleteUIState) == null ? void 0 : _a3.call(scanOrderModule, "pendingStep");
409
- handleOrderDetail(order_id);
407
+ if (!(entryContext == null ? void 0 : entryContext.order_id) || !allowAddItems.enabled) {
408
+ handleOrderDetail(order_id);
409
+ return;
410
+ }
411
+ await runModuleAction("restorePreviousOrderData");
412
+ await enterProductStep();
410
413
  return;
411
414
  }
412
- (_b2 = scanOrderModule == null ? void 0 : scanOrderModule.deleteUIState) == null ? void 0 : _b2.call(scanOrderModule, "pendingStep");
413
- location.replace("/");
415
+ console.log("status>>>>>>>", status);
416
+ const loginRequiredModal = import_antd.Modal.info({
417
+ title: import_utils.locales.getText(
418
+ "pisell2.scan.order.add.on.login.required.title"
419
+ ),
420
+ content: String(
421
+ import_utils.locales.getText(
422
+ "pisell2.scan.order.add.on.login.required"
423
+ ) || ""
424
+ ).trim(),
425
+ okText: String(import_utils.locales.getText("pisell2.event.confirm") || "OK"),
426
+ maskClosable: false,
427
+ onOk: () => {
428
+ loginRequiredModal.destroy();
429
+ openLoginForOrderDetail();
430
+ }
431
+ });
414
432
  }
415
433
  });
434
+ };
435
+ openLoginForOrderDetail();
436
+ return;
437
+ } else {
438
+ if (!(entryContext == null ? void 0 : entryContext.order_id) || !allowAddItems.enabled) {
439
+ handleOrderDetail(order_id);
440
+ return;
441
+ }
442
+ await runModuleAction("restorePreviousOrderData");
443
+ await enterProductStep();
444
+ }
445
+ } else if (mode === "submit_disabled") {
446
+ const tips = resolveLocalizedText(errorTips) || String(import_utils.locales.getText("pisell2.scan.order.submit.disabled.default") || "");
447
+ setSubmitDisabledTips(tips);
448
+ await enterProductStep();
449
+ } else if (mode === "multiple_orders") {
450
+ import_antd.Modal.info({
451
+ title: import_utils.locales.getText("pisell2.scan.order.step.error"),
452
+ content: String(
453
+ import_utils.locales.getText("pisell2.scan.order.multiple.orders.tip") || ""
454
+ ).trim(),
455
+ okText: String(
456
+ import_utils.locales.getText("pisell2.scan.order.multiple.orders.confirm") || "I Got It"
457
+ ),
458
+ maskClosable: false,
459
+ onOk: () => {
460
+ navigateToHome();
461
+ }
462
+ });
463
+ } else if (mode === "resource_busy") {
464
+ if (Number(order_id) !== 0) {
465
+ if (!getCurrentIsLogin()) {
466
+ const openLoginForOrderDetail = () => {
467
+ var _a2;
468
+ (_a2 = scanOrderModule == null ? void 0 : scanOrderModule.setUIState) == null ? void 0 : _a2.call(scanOrderModule, "pendingStep", currentStep);
469
+ openLoginModal({
470
+ callback: (status) => {
471
+ var _a3;
472
+ if (status === "success") {
473
+ (_a3 = scanOrderModule == null ? void 0 : scanOrderModule.deleteUIState) == null ? void 0 : _a3.call(scanOrderModule, "pendingStep");
474
+ handleOrderDetail(order_id);
475
+ return;
476
+ }
477
+ import_antd.Modal.info({
478
+ title: import_utils.locales.getText(
479
+ "pisell2.scan.order.add.on.login.required.title"
480
+ ),
481
+ content: String(
482
+ import_utils.locales.getText(
483
+ "pisell2.scan.order.add.on.login.required"
484
+ ) || ""
485
+ ).trim(),
486
+ okText: String(import_utils.locales.getText("pisell2.event.confirm") || "OK"),
487
+ maskClosable: false,
488
+ onOk: () => {
489
+ openLoginForOrderDetail();
490
+ }
491
+ });
492
+ }
493
+ });
494
+ };
495
+ openLoginForOrderDetail();
416
496
  } else {
417
497
  handleOrderDetail(order_id);
418
498
  }
419
499
  } else {
420
- let content = resolveLocalizedText(errorTips);
421
- content = String(
422
- import_utils.locales.getText("pisell2.scan.order.resource.status.exception") || ""
500
+ const content = String(
501
+ import_utils.locales.getText("pisell2.scan.order.add.on.unavailable.description") || ""
423
502
  );
424
503
  import_antd.Modal.info({
425
- title: import_utils.locales.getText("pisell2.scan.order.step.error"),
426
- content: content.trim(),
427
- okText: String(import_utils.locales.getText("pisell2.event.confirm") || "OK"),
504
+ title: import_utils.locales.getText("pisell2.scan.order.add.on.unavailable.title"),
505
+ content: /* @__PURE__ */ import_react.default.createElement("div", { style: { whiteSpace: "pre-line" } }, content.trim()),
506
+ okText: String(
507
+ import_utils.locales.getText("pisell2.scan.order.add.on.unavailable.confirm") || "Got it"
508
+ ),
428
509
  maskClosable: false,
429
510
  onOk: () => {
430
511
  location.replace("/");
@@ -456,7 +537,7 @@ function ReadyState() {
456
537
  }
457
538
  };
458
539
  if (!isCacheHydrated) return;
459
- checkResourceAvailable();
540
+ runResourceCheck();
460
541
  }, [isCacheHydrated]);
461
542
  (0, import_react.useEffect)(() => {
462
543
  window.scrollTo({
@@ -562,7 +643,7 @@ function ReadyState() {
562
643
  });
563
644
  return;
564
645
  }
565
- if (!isLogin) {
646
+ if (!getCurrentIsLogin()) {
566
647
  (_a2 = scanOrderModule == null ? void 0 : scanOrderModule.setUIState) == null ? void 0 : _a2.call(scanOrderModule, "pendingStep", "check");
567
648
  openLoginModal({
568
649
  callback: (status) => {
@@ -191,7 +191,9 @@ function Menu(props) {
191
191
  setting: { can_input: true, item_max_length: 1, is_detail_open: false }
192
192
  },
193
193
  callback: async (data) => {
194
+ var _a2, _b, _c;
194
195
  if (data == null ? void 0 : data.isCancel) return;
196
+ if (((_a2 = data == null ? void 0 : data.origin) == null ? void 0 : _a2.is_track) && !((_b = data == null ? void 0 : data.origin) == null ? void 0 : _b.over_sold) && ((_c = data == null ? void 0 : data.origin) == null ? void 0 : _c.stock_quantity) <= 0) return;
195
197
  const orderProduct = (0, import_transformProductDetail.transformProductDetailToOrderProduct)({
196
198
  payload: data,
197
199
  fallbackProductId: (item == null ? void 0 : item.product_id) ?? (item == null ? void 0 : item.id),
@@ -101,6 +101,13 @@ var useScanOrderLogin = () => {
101
101
  const isLogin = !!((_b = (_a = utils == null ? void 0 : utils.token) == null ? void 0 : _a.get) == null ? void 0 : _b.call(_a));
102
102
  const openLoginModal = (params) => {
103
103
  const { callback } = params || {};
104
+ const { pubsub } = utils;
105
+ pubsub.once("pisell1.login.success", (res) => {
106
+ if (res === "success") {
107
+ callback(res);
108
+ }
109
+ callback("close");
110
+ });
104
111
  utils.action({
105
112
  type: "pisell1.login",
106
113
  data: {