@pisell/pisellos 0.10.53 → 0.10.55

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 (68) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +3 -1
  3. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  4. package/dist/modules/BusinessAvailability/index.d.ts +30 -0
  5. package/dist/modules/BusinessAvailability/index.js +204 -0
  6. package/dist/modules/OpenData/index.js +1 -1
  7. package/dist/modules/OpenData/types.d.ts +2 -0
  8. package/dist/modules/Order/index.d.ts +5 -2
  9. package/dist/modules/Order/index.js +320 -247
  10. package/dist/modules/Order/types.d.ts +8 -0
  11. package/dist/modules/Payment/index.js +9 -10
  12. package/dist/plugins/request.d.ts +3 -0
  13. package/dist/server/utils/small-ticket.d.ts +1 -85
  14. package/dist/server/utils/small-ticket.js +2 -2576
  15. package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
  16. package/dist/shared/payment/loadPaymentMethods.js +66 -0
  17. package/dist/shared/receipt/small-ticket.d.ts +85 -0
  18. package/dist/shared/receipt/small-ticket.js +2576 -0
  19. package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  20. package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
  21. package/dist/solution/BaseSales/index.d.ts +4 -15
  22. package/dist/solution/BaseSales/index.js +131 -86
  23. package/dist/solution/BaseSales/types.d.ts +11 -0
  24. package/dist/solution/BookingByStep/index.d.ts +1 -1
  25. package/dist/solution/BookingTicket/index.js +41 -13
  26. package/dist/solution/OrderInvoicePreview/index.d.ts +56 -0
  27. package/dist/solution/OrderInvoicePreview/index.js +269 -0
  28. package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
  29. package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
  30. package/dist/solution/UnifiedBookingSales/index.d.ts +11 -0
  31. package/dist/solution/UnifiedBookingSales/index.js +154 -75
  32. package/dist/solution/UnifiedBookingSales/types.d.ts +2 -0
  33. package/dist/solution/index.d.ts +1 -0
  34. package/dist/solution/index.js +2 -1
  35. package/lib/index.d.ts +2 -0
  36. package/lib/index.js +21 -1
  37. package/lib/modules/BusinessAvailability/index.d.ts +30 -0
  38. package/lib/modules/BusinessAvailability/index.js +146 -0
  39. package/lib/modules/OpenData/index.js +1 -1
  40. package/lib/modules/OpenData/types.d.ts +2 -0
  41. package/lib/modules/Order/index.d.ts +5 -2
  42. package/lib/modules/Order/index.js +67 -13
  43. package/lib/modules/Order/types.d.ts +8 -0
  44. package/lib/modules/Payment/index.js +3 -4
  45. package/lib/plugins/request.d.ts +3 -0
  46. package/lib/server/utils/small-ticket.d.ts +1 -85
  47. package/lib/server/utils/small-ticket.js +9 -2335
  48. package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
  49. package/lib/shared/payment/loadPaymentMethods.js +40 -0
  50. package/lib/shared/receipt/small-ticket.d.ts +85 -0
  51. package/lib/shared/receipt/small-ticket.js +2342 -0
  52. package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  53. package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
  54. package/lib/solution/BaseSales/index.d.ts +4 -15
  55. package/lib/solution/BaseSales/index.js +45 -24
  56. package/lib/solution/BaseSales/types.d.ts +11 -0
  57. package/lib/solution/BookingByStep/index.d.ts +1 -1
  58. package/lib/solution/BookingTicket/index.js +37 -4
  59. package/lib/solution/OrderInvoicePreview/index.d.ts +56 -0
  60. package/lib/solution/OrderInvoicePreview/index.js +194 -0
  61. package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
  62. package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
  63. package/lib/solution/UnifiedBookingSales/index.d.ts +11 -0
  64. package/lib/solution/UnifiedBookingSales/index.js +54 -0
  65. package/lib/solution/UnifiedBookingSales/types.d.ts +2 -0
  66. package/lib/solution/index.d.ts +1 -0
  67. package/lib/solution/index.js +11 -0
  68. package/package.json +1 -1
@@ -517,7 +517,15 @@ export type OrderProductMergeDecisionResult = boolean | {
517
517
  reason?: string;
518
518
  [key: string]: any;
519
519
  };
520
+ export interface OrderCartIntentCommitContext {
521
+ action: 'add_product' | 'update_product' | 'increase_quantity' | 'scan_promotion';
522
+ tempOrder: OrderTempOrder | null;
523
+ }
520
524
  export interface OrderHooksConfig {
525
+ /** Optional customer-order guard; called synchronously before the first cart write. */
526
+ beforeCartIntentCommit?: (context: OrderCartIntentCommitContext) => void;
527
+ /** Captures tenant/business runtime identity for asynchronous cart intents. */
528
+ getCartIntentScope?: () => unknown;
521
529
  onBeforeMergeProductToOrder?: (context: OrderProductMergeDecisionContext) => OrderProductMergeDecisionResult | Promise<OrderProductMergeDecisionResult>;
522
530
  }
523
531
  /**
@@ -20,6 +20,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
20
20
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
21
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
22
22
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
+ import { loadPaymentMethods } from "../../shared/payment/loadPaymentMethods";
23
24
  import { BaseModule } from "../BaseModule";
24
25
  import { PaymentStatus, PaymentMethodType, RoundingRule } from "./types";
25
26
  import { getUniqueId } from "../Cart/utils";
@@ -367,37 +368,35 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
367
368
  key: "getPayMethodListAsync",
368
369
  value: (function () {
369
370
  var _getPayMethodListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
370
- var response, payMethods;
371
+ var payMethods;
371
372
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
372
373
  while (1) switch (_context3.prev = _context3.next) {
373
374
  case 0:
374
375
  this.logInfo('Starting getPayMethodListAsync');
375
376
  _context3.prev = 1;
376
377
  _context3.next = 4;
377
- return this.request.get('/pay/custom-payment/all', {
378
+ return loadPaymentMethods(this.request, {
379
+ transport: 'os-server',
378
380
  filterPaymentMethods: true
379
- }, {
380
- osServer: true
381
381
  });
382
382
  case 4:
383
- response = _context3.sent;
384
- payMethods = (response === null || response === void 0 ? void 0 : response.data) || response || [];
383
+ payMethods = _context3.sent;
385
384
  this.logInfo('getPayMethodListAsync completed successfully', {
386
385
  payMethods: payMethods
387
386
  });
388
387
  return _context3.abrupt("return", payMethods);
389
- case 10:
390
- _context3.prev = 10;
388
+ case 9:
389
+ _context3.prev = 9;
391
390
  _context3.t0 = _context3["catch"](1);
392
391
  console.error('[PaymentModule] 获取支付方式列表失败', _context3.t0);
393
392
  this.logError('getPayMethodListAsync failed', _context3.t0);
394
393
  // 如果所有操作都失败,返回空数组
395
394
  return _context3.abrupt("return", []);
396
- case 15:
395
+ case 14:
397
396
  case "end":
398
397
  return _context3.stop();
399
398
  }
400
- }, _callee3, this, [[1, 10]]);
399
+ }, _callee3, this, [[1, 9]]);
401
400
  }));
402
401
  function getPayMethodListAsync() {
403
402
  return _getPayMethodListAsync.apply(this, arguments);
@@ -56,6 +56,9 @@ export interface CacheProps {
56
56
  * 请求配置
57
57
  */
58
58
  export interface RequestOptions {
59
+ /** Let the caller handle read-only preview failures without host navigation/toasts. */
60
+ manualErrorHandling?: boolean;
61
+ skipErrorHandler?: boolean;
59
62
  url?: string;
60
63
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
61
64
  headers?: Record<string, string>;
@@ -1,85 +1 @@
1
- export interface SmallTicketShopInfo {
2
- name?: string;
3
- phone?: string;
4
- address?: string;
5
- address_street?: string;
6
- address_detail?: string;
7
- city?: string;
8
- province?: string;
9
- country?: string;
10
- zip?: string;
11
- tax_number?: string;
12
- tax_title?: string;
13
- is_price_include_tax?: 0 | 1 | boolean;
14
- currency_symbol?: string;
15
- currency_code?: string;
16
- primary_locale?: string;
17
- timezone?: string;
18
- [key: string]: any;
19
- }
20
- export interface BuildSmallTicketDataParams {
21
- order: Record<string, any>;
22
- shopInfo?: SmallTicketShopInfo | null;
23
- locales?: string[];
24
- productMap?: Record<string | number, Record<string, any>>;
25
- }
26
- export interface SmallTicketItem {
27
- item: string;
28
- value: string;
29
- size?: number;
30
- align?: string;
31
- product_uid?: string | number;
32
- booking_uid?: string | number;
33
- }
34
- export interface SmallTicketProduct {
35
- product_title: string;
36
- product_quantity: number;
37
- selling_price: string;
38
- total_selling_price: string;
39
- original_price: string;
40
- base_price?: string;
41
- total_original_price: string;
42
- options_total_price?: string;
43
- package_items_total_price?: string;
44
- extension_list: any[];
45
- product_uid?: string | number;
46
- booking_uid?: string | number;
47
- product_note?: string;
48
- allergy?: string;
49
- options?: Array<{
50
- name: string;
51
- num?: number;
52
- price?: string;
53
- total_price: string;
54
- value?: string;
55
- }>;
56
- variant?: string;
57
- combinations?: any[];
58
- }
59
- export type SmallTicketAppointment = SmallTicketItem[];
60
- export interface SmallTicketLocaleData {
61
- base_data: Record<string, any>;
62
- products: SmallTicketProduct[];
63
- fees: {
64
- fees: SmallTicketItem[];
65
- countFee: Record<string, any>;
66
- };
67
- customer: SmallTicketItem[];
68
- appointment: SmallTicketAppointment;
69
- delivery?: SmallTicketItem[];
70
- resources: Array<{
71
- id: string | number;
72
- code: string;
73
- title: string;
74
- form_title: string;
75
- }>;
76
- payment_data: SmallTicketItem[][];
77
- wallets: SmallTicketItem[][];
78
- tickets: any[];
79
- source_shop: any[];
80
- refund_data: SmallTicketItem[][];
81
- expend_data: any[];
82
- }
83
- export type SmallTicketData = Record<string, SmallTicketLocaleData>;
84
- export declare function buildSmallTicketData(params: BuildSmallTicketDataParams): SmallTicketData;
85
- export declare function hasSmallTicketData(value: any): boolean;
1
+ export * from '../../shared/receipt/small-ticket';