@pisell/pisellos 2.2.323 → 2.2.325

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 (199) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/inventory/index.d.ts +92 -0
  4. package/dist/inventory/index.js +509 -0
  5. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  6. package/dist/modules/BookingContext/index.d.ts +2 -2
  7. package/dist/modules/BookingContext/index.js +55 -25
  8. package/dist/modules/BookingContext/types.d.ts +2 -0
  9. package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  10. package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
  11. package/dist/modules/BookingContext/utils/index.d.ts +1 -0
  12. package/dist/modules/BookingContext/utils/index.js +1 -0
  13. package/dist/modules/BookingContext/utils/productExtend.d.ts +20 -1
  14. package/dist/modules/BookingContext/utils/productExtend.js +122 -29
  15. package/dist/modules/Date/index.d.ts +1 -1
  16. package/dist/modules/Date/index.js +60 -14
  17. package/dist/modules/Date/types.d.ts +5 -0
  18. package/dist/modules/Discount/index.js +1 -0
  19. package/dist/modules/OpenData/index.d.ts +1 -0
  20. package/dist/modules/OpenData/index.js +1 -0
  21. package/dist/modules/OpenData/salesSettings.d.ts +32 -0
  22. package/dist/modules/OpenData/salesSettings.js +80 -0
  23. package/dist/modules/OpenData/types.d.ts +16 -0
  24. package/dist/modules/OpenData/utils.d.ts +1 -1
  25. package/dist/modules/OpenData/utils.js +3 -2
  26. package/dist/modules/Order/index.d.ts +55 -12
  27. package/dist/modules/Order/index.js +2699 -1411
  28. package/dist/modules/Order/types.d.ts +43 -5
  29. package/dist/modules/Order/types.js +4 -0
  30. package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
  31. package/dist/modules/Order/unpaidAmountGap.js +72 -0
  32. package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
  33. package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  34. package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
  35. package/dist/modules/Order/utils.d.ts +3 -1
  36. package/dist/modules/Order/utils.js +6 -2
  37. package/dist/modules/Product/index.d.ts +1 -1
  38. package/dist/modules/ProductList/clientDataVariants.js +6 -2
  39. package/dist/modules/ProductList/index.d.ts +2 -0
  40. package/dist/modules/ProductList/index.js +161 -51
  41. package/dist/modules/ResourcePlanner/planner.js +58 -2
  42. package/dist/modules/ResourcePlanner/types.d.ts +13 -0
  43. package/dist/modules/Rules/index.d.ts +2 -0
  44. package/dist/modules/Rules/index.js +58 -39
  45. package/dist/modules/Schedule/index.d.ts +7 -1
  46. package/dist/modules/Schedule/index.js +155 -39
  47. package/dist/modules/Schedule/types.d.ts +2 -0
  48. package/dist/modules/bookingReadValidation.d.ts +6 -0
  49. package/dist/modules/bookingReadValidation.js +72 -0
  50. package/dist/plugins/request.d.ts +2 -0
  51. package/dist/server/index.d.ts +8 -0
  52. package/dist/server/index.js +1458 -1166
  53. package/dist/server/modules/order/index.js +2 -1
  54. package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
  55. package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
  56. package/dist/shared/receipt/small-ticket.d.ts +4 -0
  57. package/dist/shared/receipt/small-ticket.js +70 -12
  58. package/dist/solution/BaseSales/index.d.ts +39 -5
  59. package/dist/solution/BaseSales/index.js +1828 -1462
  60. package/dist/solution/BaseSales/types.d.ts +1 -0
  61. package/dist/solution/BaseSales/types.js +1 -0
  62. package/dist/solution/BookingByStep/index.d.ts +16 -2
  63. package/dist/solution/BookingByStep/index.js +676 -361
  64. package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
  65. package/dist/solution/BookingByStep/utils/resources.js +117 -76
  66. package/dist/solution/BookingTicket/index.d.ts +15 -3
  67. package/dist/solution/BookingTicket/index.js +249 -135
  68. package/dist/solution/BookingTicket/types.d.ts +14 -2
  69. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
  70. package/dist/solution/BookingTicket/utils/addProductDecision.js +39 -11
  71. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  72. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
  73. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
  74. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
  75. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  76. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  77. package/dist/solution/OrderInvoicePreview/index.js +14 -8
  78. package/dist/solution/ScanOrder/index.d.ts +2 -0
  79. package/dist/solution/ScanOrder/index.js +166 -67
  80. package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
  81. package/dist/solution/ScanOrder/menuAvailability.js +363 -0
  82. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  83. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
  84. package/dist/solution/UnifiedBookingSales/index.d.ts +96 -4
  85. package/dist/solution/UnifiedBookingSales/index.js +3374 -1177
  86. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  87. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
  88. package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  89. package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
  90. package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  91. package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
  92. package/dist/solution/UnifiedBookingSales/types.d.ts +71 -2
  93. package/dist/solution/UnifiedBookingSales/types.js +7 -1
  94. package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  95. package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +283 -0
  96. package/dist/utils/platform.d.ts +2 -0
  97. package/dist/utils/platform.js +6 -0
  98. package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
  99. package/dist/utils/pos-receipt-auto-print.js +14 -0
  100. package/lib/index.d.ts +1 -0
  101. package/lib/index.js +12 -0
  102. package/lib/inventory/index.d.ts +92 -0
  103. package/lib/inventory/index.js +287 -0
  104. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  105. package/lib/modules/BookingContext/index.d.ts +2 -2
  106. package/lib/modules/BookingContext/index.js +42 -10
  107. package/lib/modules/BookingContext/types.d.ts +2 -0
  108. package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  109. package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
  110. package/lib/modules/BookingContext/utils/index.d.ts +1 -0
  111. package/lib/modules/BookingContext/utils/index.js +11 -0
  112. package/lib/modules/BookingContext/utils/productExtend.d.ts +20 -1
  113. package/lib/modules/BookingContext/utils/productExtend.js +96 -7
  114. package/lib/modules/Date/index.d.ts +1 -1
  115. package/lib/modules/Date/index.js +28 -5
  116. package/lib/modules/Date/types.d.ts +5 -0
  117. package/lib/modules/Discount/index.js +1 -0
  118. package/lib/modules/OpenData/index.d.ts +1 -0
  119. package/lib/modules/OpenData/index.js +12 -0
  120. package/lib/modules/OpenData/salesSettings.d.ts +32 -0
  121. package/lib/modules/OpenData/salesSettings.js +70 -0
  122. package/lib/modules/OpenData/types.d.ts +16 -0
  123. package/lib/modules/OpenData/utils.d.ts +1 -1
  124. package/lib/modules/OpenData/utils.js +3 -2
  125. package/lib/modules/Order/index.d.ts +55 -12
  126. package/lib/modules/Order/index.js +659 -80
  127. package/lib/modules/Order/types.d.ts +43 -5
  128. package/lib/modules/Order/types.js +2 -0
  129. package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
  130. package/lib/modules/Order/unpaidAmountGap.js +60 -0
  131. package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
  132. package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  133. package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
  134. package/lib/modules/Order/utils.d.ts +3 -1
  135. package/lib/modules/Order/utils.js +6 -2
  136. package/lib/modules/Product/index.d.ts +1 -1
  137. package/lib/modules/ProductList/clientDataVariants.js +6 -2
  138. package/lib/modules/ProductList/index.d.ts +2 -0
  139. package/lib/modules/ProductList/index.js +74 -0
  140. package/lib/modules/ResourcePlanner/planner.js +52 -1
  141. package/lib/modules/ResourcePlanner/types.d.ts +13 -0
  142. package/lib/modules/Rules/index.d.ts +2 -0
  143. package/lib/modules/Rules/index.js +25 -9
  144. package/lib/modules/Schedule/index.d.ts +7 -1
  145. package/lib/modules/Schedule/index.js +68 -4
  146. package/lib/modules/Schedule/types.d.ts +2 -0
  147. package/lib/modules/bookingReadValidation.d.ts +6 -0
  148. package/lib/modules/bookingReadValidation.js +56 -0
  149. package/lib/plugins/request.d.ts +2 -0
  150. package/lib/server/index.d.ts +8 -0
  151. package/lib/server/index.js +194 -19
  152. package/lib/server/modules/order/index.js +2 -1
  153. package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
  154. package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
  155. package/lib/shared/receipt/small-ticket.d.ts +4 -0
  156. package/lib/shared/receipt/small-ticket.js +63 -8
  157. package/lib/solution/BaseSales/index.d.ts +39 -5
  158. package/lib/solution/BaseSales/index.js +212 -18
  159. package/lib/solution/BaseSales/types.d.ts +1 -0
  160. package/lib/solution/BaseSales/types.js +1 -0
  161. package/lib/solution/BookingByStep/index.d.ts +16 -2
  162. package/lib/solution/BookingByStep/index.js +222 -14
  163. package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
  164. package/lib/solution/BookingByStep/utils/resources.js +25 -15
  165. package/lib/solution/BookingTicket/index.d.ts +15 -3
  166. package/lib/solution/BookingTicket/index.js +47 -4
  167. package/lib/solution/BookingTicket/types.d.ts +14 -2
  168. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
  169. package/lib/solution/BookingTicket/utils/addProductDecision.js +37 -6
  170. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  171. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
  172. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
  173. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
  174. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  175. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  176. package/lib/solution/OrderInvoicePreview/index.js +7 -1
  177. package/lib/solution/ScanOrder/index.d.ts +2 -0
  178. package/lib/solution/ScanOrder/index.js +72 -2
  179. package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
  180. package/lib/solution/ScanOrder/menuAvailability.js +203 -0
  181. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  182. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
  183. package/lib/solution/UnifiedBookingSales/index.d.ts +96 -4
  184. package/lib/solution/UnifiedBookingSales/index.js +1316 -73
  185. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  186. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
  187. package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  188. package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
  189. package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  190. package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
  191. package/lib/solution/UnifiedBookingSales/types.d.ts +71 -2
  192. package/lib/solution/UnifiedBookingSales/types.js +4 -1
  193. package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  194. package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +155 -0
  195. package/lib/utils/platform.d.ts +2 -0
  196. package/lib/utils/platform.js +7 -0
  197. package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
  198. package/lib/utils/pos-receipt-auto-print.js +13 -0
  199. package/package.json +1 -1
@@ -34,6 +34,7 @@ import { cloneDeep, isEqual } from 'lodash-es';
34
34
  import { isLocalFinalizedPayment, LOCAL_EFTPOS_FINALIZED, LOCAL_EFTPOS_REFRESH_REQUIRED, requiresLocalPaymentRefresh } from "../../../modules/Order/localEftposState";
35
35
  import dayjs from 'dayjs';
36
36
  import { BaseModule } from "../../../modules/BaseModule";
37
+ import { normalizeUnpaidOrderAmountGap } from "../../../modules/Order/unpaidAmountGap";
37
38
  import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrderCollectionReferenceUid, getOrderCollectionUid, isSameOrderCollectionItem, mergeOrderCollectionItems, normalizeOrderCollections } from "../../../modules/Order/utils/orderCollectionIdentity";
38
39
  import { OrderHooks } from "./types";
39
40
  import { getOrderPaymentIdentityKeys, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity, mergeOrderPaymentRecord, resolveOrderPaymentIdentity } from "../../../modules/Order/payment-utils";
@@ -375,7 +376,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
375
376
  this.logInfo('订单子项身份已规范化', context);
376
377
  }
377
378
  }
378
- return result.order;
379
+ return normalizeUnpaidOrderAmountGap(result.order);
379
380
  }
380
381
 
381
382
  /**
@@ -1,4 +1,4 @@
1
- export type CustomerInvoiceLanguageCode = 'en' | 'zh_CN' | 'zh_HK' | 'ja' | 'pt' | 'cn_en';
1
+ export type CustomerInvoiceLanguageCode = 'en' | 'zh_CN' | 'zh_HK' | 'ja' | 'pt' | 'cn_en' | 'ja_en';
2
2
  export interface CustomerInvoiceLanguageOption {
3
3
  code: CustomerInvoiceLanguageCode;
4
4
  locales: string[];
@@ -25,15 +25,17 @@ var aliases = {
25
25
  pt_br: 'pt',
26
26
  pt_pt: 'pt',
27
27
  cn_en: 'cn_en',
28
- en_cn: 'cn_en'
28
+ en_cn: 'cn_en',
29
+ ja_en: 'ja_en'
29
30
  };
30
31
  export function normalizeCustomerInvoiceLanguage(value) {
31
32
  return aliases[value.trim().toLowerCase().replace(/-/g, '_')];
32
33
  }
33
34
  function option(code) {
35
+ var locales = code === 'cn_en' ? ['en', 'zh_CN'] : code === 'ja_en' ? ['ja', 'en'] : [code];
34
36
  return {
35
37
  code: code,
36
- locales: code === 'cn_en' ? ['en', 'zh_CN'] : [code]
38
+ locales: locales
37
39
  };
38
40
  }
39
41
 
@@ -55,6 +57,6 @@ export function resolveCustomerInvoiceLanguages(language, pageLocale) {
55
57
  var normalized = normalizeCustomerInvoiceLanguage(pageLocale);
56
58
  // A page locale is a single language, never a bilingual printer mode.
57
59
  var requested = pageLocale.toLowerCase().replace(/_/g, '-');
58
- var fallback = normalized && normalized !== 'cn_en' ? normalized : requested.startsWith('zh-tw') || requested.startsWith('zh-hk') ? 'zh_HK' : requested.startsWith('zh') ? 'zh_CN' : requested.startsWith('ja') ? 'ja' : requested.startsWith('pt') ? 'pt' : 'en';
60
+ var fallback = normalized && normalized !== 'cn_en' && normalized !== 'ja_en' ? normalized : requested.startsWith('zh-tw') || requested.startsWith('zh-hk') ? 'zh_HK' : requested.startsWith('zh') ? 'zh_CN' : requested.startsWith('ja') ? 'ja' : requested.startsWith('pt') ? 'pt' : 'en';
59
61
  return [option(fallback)];
60
62
  }
@@ -15,6 +15,10 @@ export interface SmallTicketShopInfo {
15
15
  currency_code?: string;
16
16
  primary_locale?: string;
17
17
  timezone?: string;
18
+ /** Customer-facing shop domain, supplied by the host shop context. */
19
+ default_domain?: string;
20
+ private_domain?: string;
21
+ private_domain_protocol?: string;
18
22
  [key: string]: any;
19
23
  }
20
24
  export interface BuildSmallTicketDataParams {
@@ -20,10 +20,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
21
21
  import dayjs from 'dayjs';
22
22
  import Decimal from 'decimal.js';
23
+ import { normalizeUnpaidOrderAmountGap } from "../../modules/Order/unpaidAmountGap";
23
24
  import { getProductHolderRelations, hasProductBooking } from "../../modules/Order/holderRelations";
24
25
  import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
25
26
  import { resolveInvoiceDataVisibility } from "./templateVisibility";
26
27
  var DEFAULT_LOCALES = ['en', 'zh_CN'];
28
+ var BOOKING_ID_UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
27
29
 
28
30
  // Attach provenance to a private copy BEFORE any locale-dependent filtering.
29
31
  // Symbols survive the existing spread-based normalization, never enter JSON,
@@ -102,6 +104,7 @@ var LABELS = {
102
104
  cashReceived: 'Cash received',
103
105
  changeDue: 'Change due',
104
106
  eftpos: 'Eftpos',
107
+ creditCard: 'Credit card',
105
108
  wallet: 'Wallet',
106
109
  giftCard: 'Gift card',
107
110
  pointCard: 'Point card',
@@ -148,6 +151,7 @@ var LABELS = {
148
151
  cashReceived: '收取现金',
149
152
  changeDue: '找零',
150
153
  eftpos: '刷卡支付',
154
+ creditCard: '信用卡',
151
155
  wallet: '钱包支付',
152
156
  giftCard: '礼品卡',
153
157
  pointCard: '积分卡',
@@ -194,6 +198,7 @@ var LABELS = {
194
198
  cashReceived: '收取現金',
195
199
  changeDue: '找零',
196
200
  eftpos: '刷卡支付',
201
+ creditCard: '信用卡',
197
202
  wallet: '錢包支付',
198
203
  giftCard: '禮品卡',
199
204
  pointCard: '積分卡',
@@ -238,6 +243,7 @@ var LABELS = {
238
243
  asap: 'できるだけ早く',
239
244
  cash: '現金',
240
245
  eftpos: 'カード',
246
+ creditCard: 'クレジットカード',
241
247
  wallet: 'ウォレット',
242
248
  giftCard: 'ギフトカード',
243
249
  pointCard: 'ポイントカード',
@@ -283,6 +289,7 @@ var LABELS = {
283
289
  asap: 'Assim que possível',
284
290
  cash: 'Dinheiro',
285
291
  eftpos: 'Cartão',
292
+ creditCard: 'Cartão de crédito',
286
293
  wallet: 'Carteira',
287
294
  giftCard: 'Cartão-presente',
288
295
  pointCard: 'Cartão de pontos',
@@ -312,7 +319,8 @@ var LABELS = {
312
319
  }
313
320
  };
314
321
  export function buildSmallTicketData(params) {
315
- var order = params.includeReceiptKeys ? copyReceiptSource(params.order || {}) : params.order || {};
322
+ var normalizedOrder = normalizeUnpaidOrderAmountGap(params.order || {});
323
+ var order = params.includeReceiptKeys ? copyReceiptSource(normalizedOrder) : normalizedOrder;
316
324
  var shopInfo = params.shopInfo || {};
317
325
  var locales = resolveLocales(shopInfo, params.locales);
318
326
  var productMap = params.productMap || {};
@@ -403,10 +411,14 @@ function buildBaseData(params) {
403
411
  currencySymbol = params.currencySymbol,
404
412
  financials = params.financials;
405
413
  var orderNumber = stringify(order.buzzer || order.shop_full_order_number);
406
- return _objectSpread({
414
+ var rewardClaim = buildRewardClaimUrl(shopInfo, order.shop_order_number);
415
+ return _objectSpread(_objectSpread({
407
416
  shop_name: stringify(shopInfo.name || order.shop_name),
408
417
  note: stringify(order.note),
409
- shop_order_number: stringify(order.shop_order_number),
418
+ shop_order_number: stringify(order.shop_order_number)
419
+ }, rewardClaim ? {
420
+ reward_claim: rewardClaim
421
+ } : {}), {}, {
410
422
  order_number: orderNumber,
411
423
  shop_tax_number: stringify(shopInfo.tax_number || order.shop_tax_number),
412
424
  shop_phone: stringify(shopInfo.phone || order.shop_phone),
@@ -424,6 +436,26 @@ function buildBaseData(params) {
424
436
  updated_at: formatDateTime(order.updated_at, locale)
425
437
  } : {});
426
438
  }
439
+ function buildRewardClaimUrl(shopInfo, shopOrderNumber) {
440
+ var default_domain = typeof shopInfo.default_domain === 'string' ? shopInfo.default_domain.trim() : '';
441
+ var private_domain = typeof shopInfo.private_domain === 'string' ? shopInfo.private_domain.trim() : '';
442
+ // 私有域名优先于默认域名
443
+ var domain = default_domain;
444
+ var orderNumber = typeof shopOrderNumber === 'string' ? shopOrderNumber.trim() : typeof shopOrderNumber === 'number' && Number.isFinite(shopOrderNumber) ? String(shopOrderNumber) : '';
445
+ if (!domain || !orderNumber) return undefined;
446
+ try {
447
+ var protocol = shopInfo.private_domain_protocol === 'http' ? 'http' : 'https';
448
+ var base = new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(domain) ? domain : "".concat(protocol, "://").concat(domain));
449
+ if (!['http:', 'https:'].includes(base.protocol) || base.username || base.password) {
450
+ return undefined;
451
+ }
452
+ var url = new URL('/claim-purchase-rewards', base);
453
+ url.searchParams.set('shop_order_number', orderNumber);
454
+ return url.toString();
455
+ } catch (_unused) {
456
+ return undefined;
457
+ }
458
+ }
427
459
  function buildProducts(order, locale, productMap) {
428
460
  var products = Array.isArray(order.products) ? order.products : [];
429
461
  var allergyByProductUid = buildProductAllergyMap(order, locale);
@@ -1245,11 +1277,13 @@ function buildFees(params) {
1245
1277
  var itemDiscountAmount = new Decimal(toMoneyNumber(productExpectAmount !== null && productExpectAmount !== void 0 ? productExpectAmount : 0)).minus(toMoneyNumber(productOriginalAmount));
1246
1278
  return {
1247
1279
  fees: fees,
1248
- countFee: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
1280
+ countFee: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
1249
1281
  total_amount: formatMoney((_firstPresentValue3 = firstPresentValue(summary.total_amount, order.total_amount)) !== null && _firstPresentValue3 !== void 0 ? _firstPresentValue3 : 0, currencySymbol),
1250
1282
  original_item_amount: formatMoney(productOriginalAmount, currencySymbol),
1251
- product_expect_amount: formatMoney(productExpectAmount !== null && productExpectAmount !== void 0 ? productExpectAmount : 0, currencySymbol),
1252
- item_discount_amount: formatCalculatedMoney(itemDiscountAmount, currencySymbol),
1283
+ product_expect_amount: formatMoney(productExpectAmount !== null && productExpectAmount !== void 0 ? productExpectAmount : 0, currencySymbol)
1284
+ }, isNonZero(itemDiscountAmount) ? {
1285
+ item_discount_amount: formatCalculatedMoney(itemDiscountAmount, currencySymbol)
1286
+ } : {}), {}, {
1253
1287
  expect_amount: formatMoney(financials.totalAmount, currencySymbol),
1254
1288
  product_quantity: toNumber(firstPresentValue(summary.product_quantity, products.reduce(function (sum, product) {
1255
1289
  return sum + product.product_quantity;
@@ -1450,7 +1484,8 @@ function buildAppointmentRows(params) {
1450
1484
  var holder = getLocalizedValue((_booking$holder$name = (_booking$holder = booking.holder) === null || _booking$holder === void 0 ? void 0 : _booking$holder.name) !== null && _booking$holder$name !== void 0 ? _booking$holder$name : (_booking$metadata3 = booking.metadata) === null || _booking$metadata3 === void 0 || (_booking$metadata3 = _booking$metadata3.holder) === null || _booking$metadata3 === void 0 ? void 0 : _booking$metadata3.name, locale).trim();
1451
1485
  return [_objectSpread(_objectSpread({}, receiptKey(booking, 'booking-id')), {}, {
1452
1486
  item: label(locale, 'bookingId'),
1453
- value: bookingId
1487
+ // 异步落单时可能只有内部关联 UUID;留空后由下方过滤移除整行。
1488
+ value: BOOKING_ID_UUID_PATTERN.test(bookingId) ? '' : bookingId
1454
1489
  }, association), _objectSpread(_objectSpread({}, receiptKey(booking, 'booking-time', 'shared')), {}, {
1455
1490
  item: label(locale, 'bookingDateTime'),
1456
1491
  value: bookingTime
@@ -2635,12 +2670,33 @@ function appendMaskedCardCode(name, code) {
2635
2670
  function trimDecimal(value) {
2636
2671
  return value.toDecimalPlaces(2).toFixed(2).replace(/\.?0+$/, '');
2637
2672
  }
2673
+ function getLocalizedPaymentName(value, locale) {
2674
+ if (typeof value === 'string') return value.trim();
2675
+ if (!value || _typeof(value) !== 'object' || Array.isArray(value)) return '';
2676
+ var candidates = [value[locale], value[locale.replace('_', '-')], value[locale.replace('-', '_')], value.original, value.auto, value.default, value.en];
2677
+ for (var _i24 = 0, _candidates2 = candidates; _i24 < _candidates2.length; _i24++) {
2678
+ var candidate = _candidates2[_i24];
2679
+ if (typeof candidate === 'string' && candidate.trim()) return candidate.trim();
2680
+ }
2681
+ return '';
2682
+ }
2683
+ function getExplicitPaymentName(payment, locale) {
2684
+ var _payment$metadata4;
2685
+ // Cloud order snapshots retain the localized name in metadata after reload.
2686
+ var candidates = [payment.name, payment.title, payment.payment_method_name, payment.method_name, (_payment$metadata4 = payment.metadata) === null || _payment$metadata4 === void 0 ? void 0 : _payment$metadata4.custom_payment_name];
2687
+ for (var _i25 = 0, _candidates3 = candidates; _i25 < _candidates3.length; _i25++) {
2688
+ var candidate = _candidates3[_i25];
2689
+ var name = getLocalizedPaymentName(candidate, locale);
2690
+ if (name) return name;
2691
+ }
2692
+ return '';
2693
+ }
2638
2694
  function getFundRecordPaymentName(payment, locale) {
2639
2695
  var fundRecord = getFundRecord(payment);
2640
2696
  if (!fundRecord) return '';
2641
- var name = getLocalizedValue(fundRecord.wallet_pass_name, locale);
2697
+ var name = getLocalizedPaymentName(fundRecord.wallet_pass_name, locale);
2642
2698
  if (!name && !maskMachineCode(fundRecord.code)) return '';
2643
- var fallbackName = getLocalizedValue(payment.name || payment.title || payment.payment_method_name || payment.method_name || payment.code, locale);
2699
+ var fallbackName = getExplicitPaymentName(payment, locale) || getLocalizedPaymentName(payment.code, locale);
2644
2700
  return appendMaskedCardCode(name || fallbackName, fundRecord.code);
2645
2701
  }
2646
2702
  function appendMachineCodeToName(name, payment) {
@@ -2650,13 +2706,15 @@ function appendMachineCodeToName(name, payment) {
2650
2706
  function paymentMethodName(payment, locale) {
2651
2707
  var fundRecordName = getFundRecordPaymentName(payment, locale);
2652
2708
  if (fundRecordName) return fundRecordName;
2653
- var raw = payment.name || payment.title || payment.payment_method_name || payment.method_name;
2654
- if (raw) return appendMachineCodeToName(getLocalizedValue(raw, locale), payment);
2709
+ var name = getExplicitPaymentName(payment, locale);
2710
+ if (name) return appendMachineCodeToName(name, payment);
2655
2711
  var code = stringify(payment.code || payment.type || payment.payment_method || payment.method).toLowerCase();
2656
2712
  if (code.includes('cash')) return label(locale, 'cash');
2657
- if (code.includes('eftpos') || code.includes('card')) return label(locale, 'eftpos');
2713
+ if (code.includes('eftpos')) return label(locale, 'eftpos');
2658
2714
  if (code.includes('wallet')) return label(locale, 'wallet');
2659
2715
  if (code.includes('gift')) return label(locale, 'giftCard');
2716
+ if (code === 'credit_card' || code.startsWith('credit_card_')) return label(locale, 'creditCard');
2717
+ if (code.includes('card')) return label(locale, 'eftpos');
2660
2718
  return stringify(payment.code || payment.type || payment.payment_method || payment.method);
2661
2719
  }
2662
2720
  function getSummary(order) {
@@ -1,3 +1,4 @@
1
+ import { InventoryController, type CheckoutRuntimeSnapshot } from '../../inventory';
1
2
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
3
  import { BaseModule } from '../../modules/BaseModule';
3
4
  import { type LocalEftposFinalization } from '../../modules/Order/localEftposState';
@@ -6,12 +7,13 @@ import { OrderModule } from '../../modules/Order';
6
7
  import { type PickupTimingBookingInput } from '../../modules/Order/pickupTiming';
7
8
  import type { PickupTimingAvailability, PickupTimingSelection, PickupTimingValidationResult } from '../../modules/FulfillmentTiming';
8
9
  import { type ContactInfoConfig } from '../../modules/OpenData/contactInfo';
9
- import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from '../../modules/Order/types';
10
+ import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductsOptions, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from '../../modules/Order/types';
10
11
  import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
11
12
  import type { Discount, VirtualCurrencyAsset } from '../../modules/Discount/types';
12
13
  import { RequestPlugin, WindowPlugin } from '../../plugins';
13
14
  export * from './types';
14
15
  import { ProductList } from '../../modules/ProductList';
16
+ import { type PosReceiptAutoPrintPaymentStatus } from '../../utils/pos-receipt-auto-print';
15
17
  import { PaymentModule } from '../../modules/Payment';
16
18
  import type { PaymentMethod, RoundingResult, WalletAssetId, WalletAssetsBehaviorOptions, WalletAssetsSnapshot, WalletAssetsState, WalletAssetSelectionSource, ScanWalletAssetResult } from '../../modules/Payment/types';
17
19
  import type { SalesSummaryModule } from '../../modules/SalesSummary';
@@ -52,6 +54,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
52
54
  protected appPlugin: AppPlugin;
53
55
  protected store: BaseSalesState;
54
56
  protected otherParams: Record<string, any>;
57
+ getInventory(): InventoryController | undefined;
58
+ prepareCheckout(signal?: AbortSignal): Promise<CheckoutRuntimeSnapshot | undefined>;
55
59
  protected cacheId: string | undefined;
56
60
  /**
57
61
  * 由已在初始化阶段解析过设备短号的业务解决方案写入。
@@ -66,6 +70,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
66
70
  request: RequestPlugin;
67
71
  protected currentSalesDetail: ISalesDetail | null;
68
72
  protected discountConfigCacheKey: string | null;
73
+ private discountConfigPrepareInFlight;
69
74
  protected hasManualDiscountSelection: boolean;
70
75
  private readonly reusedSharedSubModuleNames;
71
76
  private paymentMethodsCache;
@@ -78,6 +83,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
78
83
  private salesDetailHydrateQueue;
79
84
  private serverOrderChangeUnsubscribe;
80
85
  private paymentMethodsChangedUnsubscribe;
86
+ private orderSessionChangedUnsubscribe;
81
87
  private serverOrderChangeHydrateInFlight;
82
88
  private queuedServerOrderChanges;
83
89
  private serverOrderChangeSyncEnabled;
@@ -112,6 +118,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
112
118
  private syncCurrentSalesDetailFromServerOrderChange;
113
119
  private registerServerOrderChangeSync;
114
120
  private registerPaymentMethodsChangeSync;
121
+ private registerOrderSessionChangeSync;
115
122
  private hydrateLatestLoadedSalesDetail;
116
123
  private hydrateOrderPaymentNames;
117
124
  get payment(): PaymentModule | undefined;
@@ -129,7 +136,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
129
136
  * /product/query 的智能定价评估只读取 strategy_context;
130
137
  * application_code 仅作为接口兼容字段,不能替代 channel / business_code。
131
138
  */
132
- private getPriceQueryStrategyContext;
139
+ protected getPriceQueryStrategyContext(channel?: string): Record<string, any>;
133
140
  /**
134
141
  * 子类可在商品重报价前准备客户维度的策略上下文,例如等待 Wallet/优惠资产加载。
135
142
  */
@@ -156,6 +163,12 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
156
163
  private prepareRawProductForPriceQuery;
157
164
  private resolveLocalProductForPriceQuery;
158
165
  private loadProductsForPriceQuery;
166
+ /** Opt-in subclasses may supply page-owned raw pools; ordinary sales keep remote fallback. */
167
+ protected isVenueCatalogLocalPricingActive(): boolean;
168
+ protected getVenueCatalogLocalPriceSource(_productId: number, _selectedProduct?: Record<string, any>): {
169
+ product: Record<string, any>;
170
+ menuList: Record<string, any>[];
171
+ } | undefined;
159
172
  private resolveProductsForPriceQuery;
160
173
  private getAuthoritativeBundleItems;
161
174
  private findAuthoritativeBundleItem;
@@ -187,6 +200,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
187
200
  private getFulfillmentRefMode;
188
201
  private getCachedInvoiceLayoutConfig;
189
202
  private getCachedInvoiceTemplateSettings;
203
+ /** Only solutions with a current POS business configuration opt into this receipt policy. */
204
+ protected getPosReceiptAutoPrintPaymentStatuses(): PosReceiptAutoPrintPaymentStatus[] | undefined;
190
205
  private buildSubmitPayloadEnhancerWithOpenDataConfig;
191
206
  /**
192
207
  * 工厂入口:根据子模块名实例化对应模块。
@@ -194,6 +209,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
194
209
  * 可覆盖此方法并把未识别的 name 委托给 `super.createSubModule(name)`。
195
210
  */
196
211
  protected createSubModule(moduleName: string): Module | null;
212
+ private inventoryOrderHooks?;
197
213
  protected getSubModuleHooks(moduleName: string): any;
198
214
  /**
199
215
  * 构造传给 BaseSales 子模块的完整运行态参数,保证初始化和后续同步语义一致。
@@ -231,7 +247,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
231
247
  private isActiveVirtualSettlementOrder;
232
248
  private isHistoricalVirtualSettlementOrder;
233
249
  private syncAppDataToTempOrder;
250
+ private initialization?;
251
+ /** Hosts can await readiness without changing Core's synchronous registration API. */
252
+ whenInitialized(): Promise<void>;
234
253
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
254
+ private initializeSalesRuntime;
235
255
  destroy(): Promise<void>;
236
256
  /**
237
257
  * 加载销售订单到统一 tempOrder 工作区。
@@ -256,6 +276,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
256
276
  /** 获取附加费用(运费/服务费/税费等)。 */
257
277
  getSurcharges(): ISalesSurcharge[];
258
278
  getTempOrder(): OrderTempOrder | null;
279
+ getOrderSessionId(): string | null;
280
+ isOrderSessionCurrent(sessionId: string): boolean;
259
281
  replaceTempOrder(tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions): Promise<OrderTempOrder>;
260
282
  getOrderIdentity(): import("../../modules/Order/types").OrderIdentitySnapshot | null;
261
283
  getOrderSnapshot(): import("../../modules/Order/types").OrderSnapshot | null;
@@ -294,7 +316,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
294
316
  saveDraft(): Promise<void>;
295
317
  restoreOrder(): Promise<OrderTempOrder>;
296
318
  /**
297
- * 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
319
+ * 清空 tempOrder 购物车行(products / bookings / discount_list)及整单折扣。
298
320
  * 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
299
321
  */
300
322
  clearOrderCartLines(): Promise<OrderTempOrder>;
@@ -340,7 +362,9 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
340
362
  discountList: Discount[];
341
363
  originalDiscountList?: Discount[];
342
364
  }): Promise<void>;
343
- scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
365
+ scanPromotionCode(code: string, customerId?: number, options?: {
366
+ productVouchersOnly?: boolean;
367
+ }): Promise<BaseSalesScanCodeResult>;
344
368
  setDiscountSelected(params: {
345
369
  discountId: number;
346
370
  isSelected: boolean;
@@ -520,15 +544,25 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
520
544
  submitBeforeSend?: boolean;
521
545
  }): Promise<T>;
522
546
  transformBaseProductToOrderProduct(params: TransformBaseProductToOrderProductParams): import("./utils/transformBaseProductToOrderProduct").BaseProductOrderProductInput | null;
547
+ /** Explicit pool source avoids races between two simultaneous Venue pricing contexts. */
548
+ protected calculateVenueCatalogProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams, source: {
549
+ product: Record<string, any>;
550
+ menuList: Record<string, any>[];
551
+ }): Promise<BaseSalesProductBookingPriceResult>;
523
552
  calculateProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
524
553
  getQuotationCustomerScopeInfo(): BaseSalesQuotationCustomerScopeInfo;
525
554
  private hasSmartPricingStrategies;
526
555
  shouldRecalculateProductBookingPricesForContextChange(params: BaseSalesPriceRecalculationContextChange): boolean;
527
556
  private resolveProductBookingPriceGroups;
528
557
  calculateProductBookingPrices(paramsList: BaseSalesCalculateProductBookingPriceParams[]): Promise<BaseSalesProductBookingPriceResult[]>;
558
+ setProductVoucherGroups(groups: Array<{
559
+ key: string;
560
+ discountIds: Array<number | string>;
561
+ }>): void;
562
+ validateProductVoucherSelection(): void;
529
563
  addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
530
564
  updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
531
- updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
565
+ updateOrderProducts(paramsList: UpdateOrderProductParams[], options?: UpdateOrderProductsOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
532
566
  updateOrderProductQuantity(params: BaseSalesUpdateOrderProductQuantityParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
533
567
  updateOrderBooking(params: UpdateOrderBookingParams): any[];
534
568
  /**