@final-commerce/command-frame 0.11.1-online.1 → 0.12.0-staging.1

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 (161) hide show
  1. package/dist/CommonTypes.d.ts +1 -21
  2. package/dist/actions/get-current-cart/mock.js +0 -3
  3. package/dist/actions/get-current-cart/types.d.ts +0 -6
  4. package/dist/actions/get-orders/action.d.ts +1 -1
  5. package/dist/actions/get-orders/action.js +2 -2
  6. package/dist/actions/get-orders/mock.d.ts +1 -1
  7. package/dist/actions/get-orders/mock.js +19 -74
  8. package/dist/actions/get-orders/types.d.ts +2 -33
  9. package/dist/actions/get-outlets/action.js +2 -2
  10. package/dist/actions/get-outlets/mock.d.ts +0 -12
  11. package/dist/actions/get-outlets/mock.js +4 -28
  12. package/dist/actions/get-outlets/types.d.ts +1 -19
  13. package/dist/actions/get-product-modifier-selections/mock.js +0 -7
  14. package/dist/actions/get-product-modifier-selections/types.d.ts +0 -4
  15. package/dist/actions/get-products/types.d.ts +8 -8
  16. package/dist/actions/get-refund-plan/mockRows.js +1 -1
  17. package/dist/actions/get-refund-plan/types.d.ts +6 -9
  18. package/dist/actions/get-remaining-refundable-quantities/mock.js +0 -1
  19. package/dist/actions/get-remaining-refundable-quantities/types.d.ts +0 -5
  20. package/dist/actions/process-partial-refund/types.d.ts +1 -1
  21. package/dist/actions/resume-parked-order/mock.d.ts +0 -5
  22. package/dist/actions/resume-parked-order/mock.js +24 -25
  23. package/dist/actions/void-order/mock.js +7 -17
  24. package/dist/actions/void-order/types.d.ts +2 -6
  25. package/dist/common-types/order-state.d.ts +1 -20
  26. package/dist/demo/database.d.ts +0 -4
  27. package/dist/demo/database.js +0 -29
  28. package/dist/index.d.ts +1 -41
  29. package/dist/index.js +0 -39
  30. package/dist/projects/render/mocks.js +0 -40
  31. package/dist/projects/render/types.d.ts +1 -33
  32. package/dist/pubsub/topics/index.d.ts +17 -18
  33. package/dist/pubsub/topics/index.js +17 -18
  34. package/dist/pubsub/topics/types.d.ts +0 -8
  35. package/package.json +2 -2
  36. package/dist/actions/assign-order-user/action.d.ts +0 -6
  37. package/dist/actions/assign-order-user/action.js +0 -8
  38. package/dist/actions/assign-order-user/mock.d.ts +0 -2
  39. package/dist/actions/assign-order-user/mock.js +0 -30
  40. package/dist/actions/assign-order-user/types.d.ts +0 -15
  41. package/dist/actions/assign-order-user/types.js +0 -1
  42. package/dist/actions/attach-checkout-contact/action.d.ts +0 -6
  43. package/dist/actions/attach-checkout-contact/action.js +0 -8
  44. package/dist/actions/attach-checkout-contact/mock.d.ts +0 -15
  45. package/dist/actions/attach-checkout-contact/mock.js +0 -22
  46. package/dist/actions/attach-checkout-contact/types.d.ts +0 -35
  47. package/dist/actions/attach-checkout-contact/types.js +0 -16
  48. package/dist/actions/get-address-options/action.d.ts +0 -6
  49. package/dist/actions/get-address-options/action.js +0 -8
  50. package/dist/actions/get-address-options/mock.d.ts +0 -3
  51. package/dist/actions/get-address-options/mock.js +0 -15
  52. package/dist/actions/get-address-options/types.d.ts +0 -25
  53. package/dist/actions/get-address-options/types.js +0 -8
  54. package/dist/actions/get-checkout-status/action.d.ts +0 -6
  55. package/dist/actions/get-checkout-status/action.js +0 -8
  56. package/dist/actions/get-checkout-status/mock.d.ts +0 -3
  57. package/dist/actions/get-checkout-status/mock.js +0 -11
  58. package/dist/actions/get-checkout-status/types.d.ts +0 -20
  59. package/dist/actions/get-checkout-status/types.js +0 -12
  60. package/dist/actions/get-moto-config/action.d.ts +0 -6
  61. package/dist/actions/get-moto-config/action.js +0 -8
  62. package/dist/actions/get-moto-config/mock.d.ts +0 -7
  63. package/dist/actions/get-moto-config/mock.js +0 -9
  64. package/dist/actions/get-moto-config/types.d.ts +0 -34
  65. package/dist/actions/get-moto-config/types.js +0 -5
  66. package/dist/actions/get-order-statuses/action.d.ts +0 -6
  67. package/dist/actions/get-order-statuses/action.js +0 -8
  68. package/dist/actions/get-order-statuses/mock.d.ts +0 -2
  69. package/dist/actions/get-order-statuses/mock.js +0 -5
  70. package/dist/actions/get-order-statuses/types.d.ts +0 -8
  71. package/dist/actions/get-order-statuses/types.js +0 -1
  72. package/dist/actions/get-shipping-options/action.d.ts +0 -6
  73. package/dist/actions/get-shipping-options/action.js +0 -8
  74. package/dist/actions/get-shipping-options/mock.d.ts +0 -3
  75. package/dist/actions/get-shipping-options/mock.js +0 -15
  76. package/dist/actions/get-shipping-options/types.d.ts +0 -43
  77. package/dist/actions/get-shipping-options/types.js +0 -1
  78. package/dist/actions/record-external-payment/action.d.ts +0 -6
  79. package/dist/actions/record-external-payment/action.js +0 -8
  80. package/dist/actions/record-external-payment/mock.d.ts +0 -2
  81. package/dist/actions/record-external-payment/mock.js +0 -36
  82. package/dist/actions/record-external-payment/types.d.ts +0 -37
  83. package/dist/actions/record-external-payment/types.js +0 -1
  84. package/dist/actions/release-from-cart/action.d.ts +0 -6
  85. package/dist/actions/release-from-cart/action.js +0 -8
  86. package/dist/actions/release-from-cart/mock.d.ts +0 -2
  87. package/dist/actions/release-from-cart/mock.js +0 -26
  88. package/dist/actions/release-from-cart/types.d.ts +0 -8
  89. package/dist/actions/release-from-cart/types.js +0 -1
  90. package/dist/actions/resume-checkout/action.d.ts +0 -6
  91. package/dist/actions/resume-checkout/action.js +0 -8
  92. package/dist/actions/resume-checkout/mock.d.ts +0 -16
  93. package/dist/actions/resume-checkout/mock.js +0 -51
  94. package/dist/actions/resume-checkout/types.d.ts +0 -59
  95. package/dist/actions/resume-checkout/types.js +0 -13
  96. package/dist/actions/resume-order/action.d.ts +0 -6
  97. package/dist/actions/resume-order/action.js +0 -8
  98. package/dist/actions/resume-order/mock.d.ts +0 -2
  99. package/dist/actions/resume-order/mock.js +0 -55
  100. package/dist/actions/resume-order/types.d.ts +0 -17
  101. package/dist/actions/resume-order/types.js +0 -1
  102. package/dist/actions/select-shipping-option/action.d.ts +0 -6
  103. package/dist/actions/select-shipping-option/action.js +0 -8
  104. package/dist/actions/select-shipping-option/mock.d.ts +0 -3
  105. package/dist/actions/select-shipping-option/mock.js +0 -31
  106. package/dist/actions/select-shipping-option/types.d.ts +0 -15
  107. package/dist/actions/select-shipping-option/types.js +0 -1
  108. package/dist/actions/set-order-address/action.d.ts +0 -6
  109. package/dist/actions/set-order-address/action.js +0 -8
  110. package/dist/actions/set-order-address/mock.d.ts +0 -7
  111. package/dist/actions/set-order-address/mock.js +0 -29
  112. package/dist/actions/set-order-address/types.d.ts +0 -19
  113. package/dist/actions/set-order-address/types.js +0 -1
  114. package/dist/actions/set-order-metadata/action.d.ts +0 -6
  115. package/dist/actions/set-order-metadata/action.js +0 -8
  116. package/dist/actions/set-order-metadata/mock.d.ts +0 -5
  117. package/dist/actions/set-order-metadata/mock.js +0 -38
  118. package/dist/actions/set-order-metadata/types.d.ts +0 -20
  119. package/dist/actions/set-order-metadata/types.js +0 -1
  120. package/dist/actions/set-order-status/action.d.ts +0 -6
  121. package/dist/actions/set-order-status/action.js +0 -8
  122. package/dist/actions/set-order-status/mock.d.ts +0 -3
  123. package/dist/actions/set-order-status/mock.js +0 -44
  124. package/dist/actions/set-order-status/types.d.ts +0 -25
  125. package/dist/actions/set-order-status/types.js +0 -1
  126. package/dist/actions/set-order-type/action.d.ts +0 -6
  127. package/dist/actions/set-order-type/action.js +0 -8
  128. package/dist/actions/set-order-type/mock.d.ts +0 -3
  129. package/dist/actions/set-order-type/mock.js +0 -27
  130. package/dist/actions/set-order-type/types.d.ts +0 -17
  131. package/dist/actions/set-order-type/types.js +0 -1
  132. package/dist/actions/set-outlet/action.d.ts +0 -6
  133. package/dist/actions/set-outlet/action.js +0 -8
  134. package/dist/actions/set-outlet/mock.d.ts +0 -13
  135. package/dist/actions/set-outlet/mock.js +0 -24
  136. package/dist/actions/set-outlet/types.d.ts +0 -31
  137. package/dist/actions/set-outlet/types.js +0 -21
  138. package/dist/actions/set-scheduled-for/action.d.ts +0 -6
  139. package/dist/actions/set-scheduled-for/action.js +0 -8
  140. package/dist/actions/set-scheduled-for/mock.d.ts +0 -4
  141. package/dist/actions/set-scheduled-for/mock.js +0 -45
  142. package/dist/actions/set-scheduled-for/types.d.ts +0 -22
  143. package/dist/actions/set-scheduled-for/types.js +0 -1
  144. package/dist/actions/start-checkout/action.d.ts +0 -6
  145. package/dist/actions/start-checkout/action.js +0 -8
  146. package/dist/actions/start-checkout/mock.d.ts +0 -16
  147. package/dist/actions/start-checkout/mock.js +0 -80
  148. package/dist/actions/start-checkout/types.d.ts +0 -90
  149. package/dist/actions/start-checkout/types.js +0 -10
  150. package/dist/demo/shipping.d.ts +0 -8
  151. package/dist/demo/shipping.js +0 -69
  152. package/dist/pubsub/topics/checkout/checkout-started/types.d.ts +0 -26
  153. package/dist/pubsub/topics/checkout/checkout-started/types.js +0 -1
  154. package/dist/pubsub/topics/checkout/index.d.ts +0 -7
  155. package/dist/pubsub/topics/checkout/index.js +0 -28
  156. package/dist/pubsub/topics/checkout/payment-completed/types.d.ts +0 -31
  157. package/dist/pubsub/topics/checkout/payment-completed/types.js +0 -1
  158. package/dist/pubsub/topics/checkout/payment-failed/types.d.ts +0 -20
  159. package/dist/pubsub/topics/checkout/payment-failed/types.js +0 -1
  160. package/dist/pubsub/topics/checkout/types.d.ts +0 -12
  161. package/dist/pubsub/topics/checkout/types.js +0 -8
@@ -1,5 +1,5 @@
1
1
  export * from './common-types';
2
- import type { Tax, Tip, Address, MetadataItem, OrderAssignedUser, OrderInCart, OrderCustomStatus, PosDataItem, CartFeeTaxEntry, CartFeeItem, CartDiscountItem, OrderNote, NonRevenueItem, DiscountDetail, FeeDetail, DiscountLineItem, FeeLineItem, LineItem, TipPayment, RefundedTipPayment, PaymentMethod, Discount, CustomFee, Summary, CustomSale, RefundedCustomSale, RefundItem, RefundedLineItem, ActiveStation, ActiveSession, ActiveOutlet, ActiveUser, ActiveUserRole, ActiveOrder, ActiveCart, ActivePark, ActiveCompany, ActiveCustomSales, ActiveProduct, ActiveCustomer, FullProduct, ProductVariant, Inventory, ResolvedModifier, ResolvedModifierChoice, ModifierSelectionType, ModifierSelection, ModifierChoiceSelection, CartLineModifier, ProdModifierBreakdown, OrderLineItemModifier, CustomerNote, Attribute, AttributeOption, Category, Transaction, ActiveSplitPayment, BookingAvailability, BookingSlot, BookingSlotResource, BookingResource, Booking, CartReservation, OrderReservation, CartAddress, CartShipping, Composite, CompositePart, CompositeItem, CompositeChoice, CompositeItemUnavailable, CompositePick, CartLineComponent, OrderLineItemComponent } from '@final-commerce/common/pos-types';
2
+ import type { Tax, Tip, Address, MetadataItem, PosDataItem, CartFeeTaxEntry, CartFeeItem, CartDiscountItem, OrderNote, NonRevenueItem, DiscountDetail, FeeDetail, DiscountLineItem, FeeLineItem, LineItem, TipPayment, RefundedTipPayment, PaymentMethod, Discount, CustomFee, Summary, CustomSale, RefundedCustomSale, RefundItem, RefundedLineItem, ActiveStation, ActiveSession, ActiveOutlet, ActiveUser, ActiveUserRole, ActiveOrder, ActiveCart, ActivePark, ActiveCompany, ActiveCustomSales, ActiveProduct, ActiveCustomer, FullProduct, ProductVariant, Inventory, ResolvedModifier, ResolvedModifierChoice, ModifierSelectionType, ModifierSelection, ModifierChoiceSelection, CartLineModifier, ProdModifierBreakdown, OrderLineItemModifier, CustomerNote, Attribute, AttributeOption, Category, Transaction, ActiveSplitPayment, BookingAvailability, BookingSlot, BookingSlotResource, BookingResource, Booking, CartReservation, OrderReservation, Composite, CompositePart, CompositeItem, CompositeChoice, CompositeItemUnavailable, CompositePick, CartLineComponent, OrderLineItemComponent } from '@final-commerce/common/pos-types';
3
3
  export { CurrencyCode, ProductType as CFProductType, UserTypes as CFUserTypes } from '@final-commerce/common';
4
4
  /** Open record used as a base for active entities. */
5
5
  export type CFActiveEntity = Record<string, unknown>;
@@ -7,9 +7,6 @@ export type CFDiscount = Discount;
7
7
  export type CFCustomFee = CustomFee;
8
8
  export type CFAddress = Address;
9
9
  export type CFMetadataItem = MetadataItem;
10
- export type CFOrderAssignedUser = OrderAssignedUser;
11
- export type CFOrderInCart = OrderInCart;
12
- export type CFOrderCustomStatus = OrderCustomStatus;
13
10
  export type CFTax = Tax;
14
11
  export type CFCartFeeTaxEntry = CartFeeTaxEntry;
15
12
  export type CFInventory = Inventory;
@@ -108,8 +105,6 @@ export type CFActiveOrder = ActiveOrder;
108
105
  export type CFActiveCustomSales = ActiveCustomSales;
109
106
  export type CFNonRevenueItem = NonRevenueItem;
110
107
  export type CFActiveCart = ActiveCart;
111
- export type CFCartAddress = CartAddress;
112
- export type CFCartShipping = CartShipping;
113
108
  export type CFActivePark = ActivePark;
114
109
  export type CFActiveCompany = ActiveCompany;
115
110
  /** Tile kinds a SmartGrid cell can represent. Mirrors common's `BaseTile['type']`. */
@@ -152,7 +147,6 @@ export interface CFActiveRefundDetails {
152
147
  buttonsDisabled?: Record<string, boolean>;
153
148
  isRefund?: boolean;
154
149
  customSalesQuantities?: Record<string, number>;
155
- /** Keyed by cart-fee id, plus the reserved key `'shipping'` for the order's shipping. 0/1 each. */
156
150
  cartFeesRefunds?: Record<string, number>;
157
151
  tipsRefunds?: Record<string, number>;
158
152
  refundProcessingStatus?: CFRefundProcessingStatus | null;
@@ -220,23 +214,9 @@ export interface CFOutletInfo {
220
214
  state?: string;
221
215
  postCode?: string;
222
216
  };
223
- address2?: string;
224
217
  city?: string;
225
218
  state?: string;
226
219
  country?: string;
227
- postCode?: string;
228
- phone?: string;
229
- /** Short display alias, when the merchant set one (e.g. `DTWN`). */
230
- alias?: string;
231
- /**
232
- * Whether this location can take an ONLINE payment. Storefront only — it is
233
- * absent on a register, where it has no meaning.
234
- *
235
- * `false` means the outlet has no completed payment connection, so starting a
236
- * checkout against it WILL fail. A pickup picker must not offer it as a
237
- * selectable location, or must show it as unavailable.
238
- */
239
- connected?: boolean;
240
220
  }
241
221
  export interface CFContextManage {
242
222
  user: unknown;
@@ -13,9 +13,6 @@ export const mockGetCurrentCart = async () => {
13
13
  return {
14
14
  success: true,
15
15
  cart: safeSerialize(MOCK_CART),
16
- // Every mock tender settles the whole sale and clears the cart, so the demo cart
17
- // never holds an order with money on it — nothing to lock.
18
- itemsLocked: false,
19
16
  lineTotals,
20
17
  timestamp: new Date().toISOString(),
21
18
  };
@@ -2,12 +2,6 @@ import { CFActiveCart } from '../../CommonTypes';
2
2
  export interface GetCurrentCartResponse {
3
3
  success: boolean;
4
4
  cart: CFActiveCart;
5
- /**
6
- * `true` while the order in this cart has any payment on it (a split leg, a part payment,
7
- * or paid in full): its items, amounts and customer can no longer be changed — the
8
- * value-changing cart commands and clearCart refuse. Absent on hosts that predate the lock.
9
- */
10
- itemsLocked?: boolean;
11
5
  /**
12
6
  * What each line adds to the cart, minor units, keyed by the line's `internalId` (products, bookings) or `id`
13
7
  * (custom sales): price × quantity − its own discounts + its own fees + its modifiers. Before the cart discount
@@ -2,5 +2,5 @@
2
2
  * Get orders action
3
3
  * Calls the getOrders action on the parent window
4
4
  */
5
- import type { GetOrders } from './types';
5
+ import type { GetOrders } from "./types";
6
6
  export declare const getOrders: GetOrders;
@@ -2,7 +2,7 @@
2
2
  * Get orders action
3
3
  * Calls the getOrders action on the parent window
4
4
  */
5
- import { commandFrameClient } from '../../client';
5
+ import { commandFrameClient } from "../../client";
6
6
  export const getOrders = async (params) => {
7
- return await commandFrameClient.call('getOrders', params);
7
+ return await commandFrameClient.call("getOrders", params);
8
8
  };
@@ -1,2 +1,2 @@
1
- import { GetOrders } from './types';
1
+ import { GetOrders } from "./types";
2
2
  export declare const mockGetOrders: GetOrders;
@@ -1,80 +1,26 @@
1
- import { MOCK_ORDERS, MOCK_PARKED_ORDERS, MOCK_USERS, MOCK_STATIONS, MOCK_OUTLETS, safeSerialize, } from '../../demo/database';
1
+ import { MOCK_ORDERS, MOCK_PARKED_ORDERS, MOCK_USERS, MOCK_STATIONS, MOCK_OUTLETS, safeSerialize } from "../../demo/database";
2
2
  export const mockGetOrders = async (params) => {
3
- console.log('[Mock] getOrders called', params);
3
+ console.log("[Mock] getOrders called", params);
4
4
  // Start with a safe copy of mock orders, including parked (status: "parked").
5
5
  let orders = safeSerialize([...MOCK_ORDERS, ...MOCK_PARKED_ORDERS]);
6
6
  // Filter simulation
7
7
  if (params) {
8
- const { customerId, status, sessionId, paymentState, fulfillmentState, outletId, assignedUserId, inCart, orderType, customStatusId, customStatusKey, scheduled, scheduledFrom, scheduledTo, searchValue, limit, offset, sortBy, sortDirection, } = params;
8
+ const { customerId, status, sessionId, searchValue, limit, offset, sortBy, sortDirection } = params;
9
9
  // 1. Filtering
10
10
  if (customerId) {
11
- orders = orders.filter((o) => o.customer && '_id' in o.customer && o.customer._id === customerId);
11
+ orders = orders.filter(o => o.customer &&
12
+ '_id' in o.customer &&
13
+ o.customer._id === customerId);
12
14
  }
13
15
  if (status) {
14
- orders = orders.filter((o) => o.status === status);
16
+ orders = orders.filter(o => o.status === status);
15
17
  }
16
18
  if (sessionId) {
17
- orders = orders.filter((o) => o.sessionId === sessionId);
18
- }
19
- const anyOf = (criteria, value) => criteria === undefined ||
20
- (Array.isArray(criteria) ? criteria.length === 0 || criteria.includes(value ?? '') : criteria === value);
21
- if (paymentState !== undefined) {
22
- orders = orders.filter((o) => anyOf(paymentState, o.paymentState));
23
- }
24
- if (fulfillmentState !== undefined) {
25
- orders = orders.filter((o) => anyOf(fulfillmentState, o.fulfillmentState));
26
- }
27
- if (outletId) {
28
- orders = orders.filter((o) => o.posData?.outlet === outletId);
29
- }
30
- if (assignedUserId) {
31
- orders = orders.filter((o) => o.assignedUser?.userId === assignedUserId);
32
- }
33
- else if (assignedUserId === null) {
34
- orders = orders.filter((o) => o.assignedUser == null);
35
- }
36
- if (orderType !== undefined) {
37
- const types = Array.isArray(orderType) ? orderType : [orderType];
38
- if (types.length)
39
- orders = orders.filter((o) => types.includes(o.orderType ?? ''));
40
- }
41
- if (customStatusKey !== undefined) {
42
- const keys = Array.isArray(customStatusKey) ? customStatusKey : [customStatusKey];
43
- if (keys.length)
44
- orders = orders.filter((o) => !!o.customStatus?.key && keys.includes(o.customStatus.key));
45
- }
46
- if (customStatusId !== undefined) {
47
- const ids = Array.isArray(customStatusId) ? customStatusId : [customStatusId];
48
- if (ids.length) {
49
- orders = orders.filter((o) => !!o.customStatus &&
50
- (ids.includes(o.customStatus.id) || (!!o.customStatus.key && ids.includes(o.customStatus.key))));
51
- }
52
- }
53
- // Requested time (setScheduledFor). ISO strings in UTC compare correctly as strings.
54
- const scheduledOf = (o) => o.scheduledFor ?? null;
55
- if (typeof scheduled === 'boolean') {
56
- orders = orders.filter((o) => (scheduledOf(o) !== null) === scheduled);
57
- }
58
- if (scheduledFrom) {
59
- const from = new Date(scheduledFrom).toISOString();
60
- orders = orders.filter((o) => (scheduledOf(o) ?? '') !== '' && scheduledOf(o) >= from);
61
- }
62
- if (scheduledTo) {
63
- const to = new Date(scheduledTo).toISOString();
64
- orders = orders.filter((o) => (scheduledOf(o) ?? '') !== '' && scheduledOf(o) <= to);
65
- }
66
- if (typeof inCart === 'boolean') {
67
- // Mirrors common's isInCart: the flag when present, else the legacy reading.
68
- const orderInCart = (o) => o.inCart != null
69
- ? o.inCart.active
70
- : o.fulfillmentState
71
- ? o.fulfillmentState === 'draft'
72
- : o.status === 'in-cart';
73
- orders = orders.filter((o) => orderInCart(o) === inCart);
19
+ orders = orders.filter(o => o.sessionId === sessionId);
74
20
  }
75
21
  if (searchValue) {
76
22
  const searchLower = String(searchValue).toLowerCase();
77
- orders = orders.filter((o) => {
23
+ orders = orders.filter(o => {
78
24
  const receiptMatch = o.receiptId?.toLowerCase().includes(searchLower);
79
25
  const customerNameMatch = o.customer && 'firstName' in o.customer
80
26
  ? `${o.customer.firstName} ${o.customer.lastName}`.toLowerCase().includes(searchLower)
@@ -90,21 +36,20 @@ export const mockGetOrders = async (params) => {
90
36
  orders.sort((a, b) => {
91
37
  let valA = a[sortBy];
92
38
  let valB = b[sortBy];
93
- // Like the host: a missing time sorts as '' (first when ascending).
94
- if (sortBy === 'scheduledFor') {
95
- valA = valA ?? '';
96
- valB = valB ?? '';
97
- }
98
39
  // Handle nested sort fields if necessary, basic support for now
99
40
  if (!valA && sortBy === 'createdAt')
100
41
  valA = a.createdAt || '';
101
42
  if (!valB && sortBy === 'createdAt')
102
43
  valB = b.createdAt || '';
103
44
  if (typeof valA === 'string' && typeof valB === 'string') {
104
- return sortDirection === 'descending' ? valB.localeCompare(valA) : valA.localeCompare(valB);
45
+ return sortDirection === 'descending'
46
+ ? valB.localeCompare(valA)
47
+ : valA.localeCompare(valB);
105
48
  }
106
49
  // Number comparison
107
- return sortDirection === 'descending' ? (valB || 0) - (valA || 0) : (valA || 0) - (valB || 0);
50
+ return sortDirection === 'descending'
51
+ ? (valB || 0) - (valA || 0)
52
+ : (valA || 0) - (valB || 0);
108
53
  });
109
54
  }
110
55
  else {
@@ -128,21 +73,21 @@ export const mockGetOrders = async (params) => {
128
73
  if (enrichedOrder.posData) {
129
74
  // Enrich Employee
130
75
  if (typeof enrichedOrder.posData.employee === 'string') {
131
- const employee = MOCK_USERS.find((u) => u.id === enrichedOrder.posData.employee);
76
+ const employee = MOCK_USERS.find(u => u.id === enrichedOrder.posData.employee);
132
77
  if (employee) {
133
78
  enrichedOrder.posData.employee = employee;
134
79
  }
135
80
  }
136
81
  // Enrich Station
137
82
  if (typeof enrichedOrder.posData.station === 'string') {
138
- const station = MOCK_STATIONS.find((s) => s._id === enrichedOrder.posData.station);
83
+ const station = MOCK_STATIONS.find(s => s._id === enrichedOrder.posData.station);
139
84
  if (station) {
140
85
  enrichedOrder.posData.station = station;
141
86
  }
142
87
  }
143
88
  // Enrich Outlet
144
89
  if (typeof enrichedOrder.posData.outlet === 'string') {
145
- const outlet = MOCK_OUTLETS.find((o) => o.id === enrichedOrder.posData.outlet);
90
+ const outlet = MOCK_OUTLETS.find(o => o.id === enrichedOrder.posData.outlet);
146
91
  if (outlet) {
147
92
  enrichedOrder.posData.outlet = outlet;
148
93
  }
@@ -154,6 +99,6 @@ export const mockGetOrders = async (params) => {
154
99
  success: true,
155
100
  orders: enrichedOrders,
156
101
  total: MOCK_ORDERS.length, // Total before pagination
157
- timestamp: new Date().toISOString(),
102
+ timestamp: new Date().toISOString()
158
103
  };
159
104
  };
@@ -1,46 +1,15 @@
1
- import { CFOrder } from '../../CommonTypes';
1
+ import { CFOrder } from "../../CommonTypes";
2
2
  export interface GetOrdersParams {
3
3
  /** e.g. 'completed', 'parked', 'refunded'. */
4
4
  status?: string;
5
5
  customerId?: string;
6
6
  sessionId?: string;
7
- /** Payment state(s), e.g. 'paid' or ['unpaid', 'partially_paid']. A list matches any of them. */
8
- paymentState?: string | string[];
9
- /** Fulfillment state(s), e.g. 'in_progress' or ['pending', 'in_progress']. A list matches any of them. */
10
- fulfillmentState?: string | string[];
11
- /** Only orders placed at this outlet (`posData.outlet`). Without it, orders from every outlet in the company are returned. */
12
- outletId?: string;
13
- /**
14
- * Only orders assigned to this user (`assignedUser.userId`), e.g. a driver's deliveries.
15
- * `null`: only orders nobody is assigned to yet (e.g. deliveries awaiting a driver).
16
- */
17
- assignedUserId?: string | null;
18
- /**
19
- * true: only orders loaded in a cart; false: only orders that aren't. Reads `order.inCart` when the order
20
- * carries it, otherwise the legacy reading (fulfillment 'draft' / status 'in-cart').
21
- */
22
- inCart?: boolean;
23
- /** Order type label(s) set with setOrderType, e.g. 'delivery' or ['pickup', 'takeout']. Exact match; a list matches any. */
24
- orderType?: string | string[];
25
- /** Custom status key(s) set with setOrderStatus, e.g. 'in-kitchen'. A list matches any of them. */
26
- customStatusKey?: string | string[];
27
- /**
28
- * Durable custom status id(s) (getOrderStatuses `id`). Also matches a status's key, for
29
- * flows written before keys — prefer `customStatusKey`. A list matches any of them.
30
- */
31
- customStatusId?: string | string[];
32
- /** true: only orders with a time (setScheduledFor); false: only "as soon as possible" orders (no time). */
33
- scheduled?: boolean;
34
- /** Only orders scheduled at or after this ISO 8601 date-time. Orders with no time never match. */
35
- scheduledFrom?: string;
36
- /** Only orders scheduled at or before this ISO 8601 date-time. Orders with no time never match. */
37
- scheduledTo?: string;
38
7
  /** Default: 50. */
39
8
  limit?: number;
40
9
  /** Default: 0. */
41
10
  offset?: number;
42
11
  searchValue?: string;
43
- /** Default: 'createdAt'. 'scheduledFor' sorts by the customer's requested time — orders with no time come first ascending. */
12
+ /** Default: 'createdAt'. */
44
13
  sortBy?: string;
45
14
  /** Default: 'descending'. */
46
15
  sortDirection?: 'ascending' | 'descending';
@@ -1,4 +1,4 @@
1
1
  import { commandFrameClient } from "../../client";
2
- export const getOutlets = async (params) => {
3
- return await commandFrameClient.call("getOutlets", params ?? {});
2
+ export const getOutlets = async () => {
3
+ return await commandFrameClient.call("getOutlets");
4
4
  };
@@ -1,14 +1,2 @@
1
1
  import { GetOutlets } from "./types";
2
- /**
3
- * A second location that CANNOT take an online payment.
4
- *
5
- * The shared demo data has exactly one outlet, so without this a pickup picker
6
- * built against mocks would never render the case that matters: an outlet a
7
- * shopper must not be allowed to check out against. `setOutlet` refuses this id,
8
- * so the two mocks tell the same story.
9
- *
10
- * Mock-only, and deliberately NOT added to `MOCK_OUTLETS` — that array is shared
11
- * with every other outlet mock and `MOCK_OUTLET`.
12
- */
13
- export declare const MOCK_UNCONNECTED_OUTLET_ID = "outlet-mock-unconnected";
14
2
  export declare const mockGetOutlets: GetOutlets;
@@ -1,40 +1,16 @@
1
1
  import { MOCK_OUTLETS, safeSerialize } from "../../demo/database";
2
- /**
3
- * A second location that CANNOT take an online payment.
4
- *
5
- * The shared demo data has exactly one outlet, so without this a pickup picker
6
- * built against mocks would never render the case that matters: an outlet a
7
- * shopper must not be allowed to check out against. `setOutlet` refuses this id,
8
- * so the two mocks tell the same story.
9
- *
10
- * Mock-only, and deliberately NOT added to `MOCK_OUTLETS` — that array is shared
11
- * with every other outlet mock and `MOCK_OUTLET`.
12
- */
13
- export const MOCK_UNCONNECTED_OUTLET_ID = "outlet-mock-unconnected";
14
- const UNCONNECTED_OUTLET = {
15
- _id: MOCK_UNCONNECTED_OUTLET_ID,
16
- name: "Airport (not connected)",
17
- address: "2 Terminal Road",
18
- city: "San Francisco",
19
- state: "CA",
20
- country: "US",
21
- postCode: "94128",
22
- connected: false
23
- };
24
- export const mockGetOutlets = async (params) => {
25
- console.log("[Mock] getOutlets called", params);
2
+ export const mockGetOutlets = async () => {
3
+ console.log("[Mock] getOutlets called");
26
4
  const outlets = safeSerialize(MOCK_OUTLETS).map((o) => ({
27
5
  _id: o._id || o.id,
28
6
  name: o.name || "",
29
7
  address: o.address,
30
8
  city: o.city,
31
9
  state: o.state,
32
- country: o.country,
33
- connected: true
10
+ country: o.country
34
11
  }));
35
- const all = [...outlets, UNCONNECTED_OUTLET];
36
12
  return {
37
- outlets: params?.connectedOnly ? all.filter((o) => o.connected) : all,
13
+ outlets,
38
14
  timestamp: new Date().toISOString()
39
15
  };
40
16
  };
@@ -1,24 +1,6 @@
1
1
  import { CFOutletInfo } from "../../CommonTypes";
2
- export interface GetOutletsParams {
3
- /**
4
- * Return only locations that can take an online payment. Storefront only.
5
- * Default `false`, so a flow sees every outlet and decides how to present
6
- * the ones it cannot sell from.
7
- */
8
- connectedOnly?: boolean;
9
- }
10
2
  export interface GetOutletsResponse {
11
3
  outlets: CFOutletInfo[];
12
4
  timestamp: string;
13
5
  }
14
- /**
15
- * List the company's outlets.
16
- *
17
- * ON A STOREFRONT this is the pickup picker's source. Each outlet carries
18
- * `connected`, and an outlet with `connected: false` cannot take a payment, so
19
- * `setOutlet` refuses it — filter those out rather than relying on the refusal.
20
- *
21
- * There are no coordinates on an outlet, so "closest branch" is not something
22
- * this can answer; sort on the address fields or let the shopper choose.
23
- */
24
- export type GetOutlets = (params?: GetOutletsParams) => Promise<GetOutletsResponse>;
6
+ export type GetOutlets = () => Promise<GetOutletsResponse>;
@@ -13,8 +13,6 @@ export const mockGetProductModifierSelections = async (params) => {
13
13
  selections: [],
14
14
  rows: [],
15
15
  modifiersTotal: 0,
16
- lineTotal: 0,
17
- unitTotal: 0,
18
16
  timestamp: new Date().toISOString(),
19
17
  };
20
18
  }
@@ -27,23 +25,18 @@ export const mockGetProductModifierSelections = async (params) => {
27
25
  selections: [],
28
26
  rows: [],
29
27
  modifiersTotal: 0,
30
- lineTotal: 0,
31
- unitTotal: 0,
32
28
  timestamp: new Date().toISOString(),
33
29
  };
34
30
  }
35
31
  // The priced rows already sit on the line; extending them by the line quantity is
36
32
  // the host's job, not the flow's.
37
33
  const { rows, modifiersTotal } = buildModifierRows(line.modifiers, line.quantity);
38
- const { modifiersTotal: unitModifiers } = buildModifierRows(line.modifiers, 1);
39
34
  return {
40
35
  success: true,
41
36
  internalId: line.internalId,
42
37
  selections: line.modifierSelections ?? [],
43
38
  rows,
44
39
  modifiersTotal,
45
- lineTotal: line.price * line.quantity + modifiersTotal,
46
- unitTotal: line.price + unitModifiers,
47
40
  timestamp: new Date().toISOString(),
48
41
  };
49
42
  };
@@ -18,10 +18,6 @@ export interface GetProductModifierSelectionsResponse {
18
18
  rows: CFProdModifierBreakdown[];
19
19
  /** Sum of `rows[].amount` for THIS line, in minor units. */
20
20
  modifiersTotal: number;
21
- /** The whole line as the cart prices it (item, its discounts, fees and modifiers), in minor units. */
22
- lineTotal: number;
23
- /** The same for ONE unit, for an "each" price. */
24
- unitTotal: number;
25
21
  timestamp: string;
26
22
  }
27
23
  export type GetProductModifierSelections = (params?: GetProductModifierSelectionsParams) => Promise<GetProductModifierSelectionsResponse>;
@@ -44,20 +44,20 @@ export interface GetProductsParams {
44
44
  externalId?: string;
45
45
  /**
46
46
  * Product-level flag filter. `true` = only products flagged `notSoldInPos`; `false` = only
47
- * products NOT flagged (a missing field counts as not flagged). On a till, naming it switches off
48
- * the default exclusion, so `true` works without `includeUnlisted`.
47
+ * products NOT flagged (a missing field counts as not flagged). Naming it switches off the
48
+ * default `notSoldInPos` exclusion, so `true` works without `includeUnlisted`.
49
49
  */
50
50
  notSoldInPos?: boolean;
51
- /** Product-level flag filter: `true` = flagged `notSoldOnline`; `false` = sold online (missing counts). On a storefront, naming it switches off the default exclusion. */
51
+ /** Product-level flag filter: `true` = flagged `notSoldOnline`; `false` = sold online (missing counts). */
52
52
  notSoldOnline?: boolean;
53
53
  [key: string]: any;
54
54
  };
55
55
  /**
56
- * The sales-channel flag follows the host channel: `notSoldInPos` on a till, `notSoldOnline` on a
57
- * storefront. Products with that flag are left out unless this is `true` (default `false`) or the
58
- * query names that flag. They still cannot be sold: `addProductToCart` / `addBookingToCart` refuse a
59
- * product or a variant with it. Without it, flagged variants are also stripped from `variants[]`
60
- * and a product whose every variant is flagged is left out — whatever the query says.
56
+ * Products flagged `notSoldInPos` are left out unless this is `true` (default `false`) or the
57
+ * query names `notSoldInPos`. They still cannot be sold: `addProductToCart` / `addBookingToCart`
58
+ * refuse a product or a variant flagged `notSoldInPos`. Without it, flagged variants are also
59
+ * stripped from `variants[]` and a product whose every variant is flagged is left out — whatever
60
+ * `query.notSoldInPos` says.
61
61
  */
62
62
  includeUnlisted?: boolean;
63
63
  /** Defaults to 0. */
@@ -96,7 +96,7 @@ export function mockRefundBreakdown(rows, items) {
96
96
  return { type: row.type, itemKey: row.itemKey, quantity, amounts: scale(row.amounts, quantity / row.quantity) };
97
97
  })
98
98
  .filter((r) => r.quantity > 0);
99
- const totals = { items: 0, discounts: 0, fees: 0, shipping: 0, tax: 0, tip: 0, total: 0 };
99
+ const totals = { items: 0, discounts: 0, fees: 0, tax: 0, tip: 0, total: 0 };
100
100
  for (const r of selected) {
101
101
  const a = r.amounts;
102
102
  if (r.type === 'fee')
@@ -20,13 +20,12 @@ export interface GetRefundPlanParams {
20
20
  items?: {
21
21
  /**
22
22
  * `internalId` / `variantId` for a product, `customSaleId`, cart-fee id, tip
23
- * `transactionId`, a booking's own `internalId` on `order.reservations[]`, or
24
- * `'shipping'` for the order's shipping (all or nothing, like a fee).
23
+ * `transactionId`, or a booking's own `internalId` on `order.reservations[]`.
25
24
  */
26
25
  itemKey: string;
27
26
  quantity: number;
28
27
  /** Optional hint; inferred from the order when omitted. */
29
- type?: 'product' | 'customSale' | 'fee' | 'tip' | 'reservation' | 'shipping';
28
+ type?: 'product' | 'customSale' | 'fee' | 'tip' | 'reservation';
30
29
  }[];
31
30
  }
32
31
  export interface RefundPlanSource {
@@ -80,7 +79,7 @@ export interface RefundPlanLeg {
80
79
  rounding: number;
81
80
  };
82
81
  }
83
- export type RefundPlanRowType = 'product' | 'customSale' | 'fee' | 'tip' | 'shipping';
82
+ export type RefundPlanRowType = 'product' | 'customSale' | 'fee' | 'tip';
84
83
  /** One tax rate's share of a row's refund (minor units). */
85
84
  export interface RefundPlanTaxLine {
86
85
  name: string;
@@ -108,7 +107,7 @@ export interface RefundPlanAmounts {
108
107
  total: number;
109
108
  }
110
109
  /**
111
- * One refundable row of the order — a line item, custom sale, cart fee, shipping or tip —
110
+ * One refundable row of the order — a line item, custom sale, cart fee or tip —
112
111
  * served ready to render. Rows with nothing left to refund are not listed.
113
112
  */
114
113
  export interface RefundPlanRow {
@@ -122,7 +121,7 @@ export interface RefundPlanRow {
122
121
  attributes?: string;
123
122
  /** Tip rows only: the tender that took the tip (`card`, `cash`, …). */
124
123
  paymentType?: string;
125
- /** Quantity originally sold. Fees, shipping and tips are `1` — all or nothing. */
124
+ /** Quantity originally sold. Fees and tips are `1` — all or nothing. */
126
125
  quantity: number;
127
126
  /** Quantity still refundable — the stepper's max. */
128
127
  refundableQuantity: number;
@@ -138,7 +137,7 @@ export interface RefundPlanSelectedRow {
138
137
  }
139
138
  /**
140
139
  * The selection's goods value broken down for display. Minor units;
141
- * `items − discounts + fees + shipping + tax + tip === total === allocation.itemTotal`.
140
+ * `items − discounts + fees + tax + tip === total === allocation.itemTotal`.
142
141
  */
143
142
  export interface RefundPlanTotals {
144
143
  /** Σ selected line subtotals (before discounts, tax excluded). */
@@ -147,8 +146,6 @@ export interface RefundPlanTotals {
147
146
  discounts: number;
148
147
  /** Σ selected cart fees, tax excluded. */
149
148
  fees: number;
150
- /** The order's shipping when selected, tax excluded; 0 otherwise. */
151
- shipping: number;
152
149
  tax: number;
153
150
  tip: number;
154
151
  total: number;
@@ -5,7 +5,6 @@ export const mockGetRemainingRefundableQuantities = async (_params) => {
5
5
  lineItems: {},
6
6
  customSales: {},
7
7
  cartFees: {},
8
- shipping: 0,
9
8
  tips: {},
10
9
  reservations: {},
11
10
  timestamp: new Date().toISOString(),
@@ -11,11 +11,6 @@ export interface GetRemainingRefundableQuantitiesResponse {
11
11
  * 0/1 semantics: `1` = still refundable, `0` = already refunded.
12
12
  */
13
13
  cartFees: Record<string, number>;
14
- /**
15
- * The order's shipping: `1` = still refundable, `0` = already refunded or the order has none.
16
- * Refunded with `itemKey: 'shipping'`, all or nothing.
17
- */
18
- shipping: number;
19
14
  /**
20
15
  * Remaining refundable tips, keyed by the paying method's
21
16
  * `transactionId` — the same key `processPartialRefund` takes for
@@ -134,7 +134,7 @@ export interface ProcessPartialRefundParams {
134
134
  /** internalId or variantId, customSaleId, or a booking's own internalId. */
135
135
  itemKey: string;
136
136
  quantity: number;
137
- type?: 'product' | 'customSale' | 'fee' | 'tip' | 'reservation' | 'shipping';
137
+ type?: 'product' | 'customSale' | 'fee' | 'tip' | 'reservation';
138
138
  /**
139
139
  * Per-item stock disposition for a refunded **product** line — the
140
140
  * headless equivalent of the old refund popup's per-row restock/damaged
@@ -1,7 +1,2 @@
1
1
  import { ResumeParkedOrder } from './types';
2
- import type { CFActiveOrder } from '../../CommonTypes';
3
- /**
4
- * Best-effort Order -> MOCK_CART mapping shared by the resume mocks.
5
- */
6
- export declare const restoreMockCartFromOrder: (orderToResume: CFActiveOrder) => void;
7
2
  export declare const mockResumeParkedOrder: ResumeParkedOrder;