@final-commerce/command-frame 0.5.1 → 0.6.0-preprod.2

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 (88) hide show
  1. package/dist/CommonTypes.d.ts +6 -6
  2. package/dist/CommonTypes.js +2 -2
  3. package/dist/actions/add-cart-discount/mock.d.ts +1 -1
  4. package/dist/actions/add-cart-discount/mock.js +8 -8
  5. package/dist/actions/add-cart-fee/mock.d.ts +1 -1
  6. package/dist/actions/add-cart-fee/mock.js +8 -8
  7. package/dist/actions/add-product-to-cart/mock.d.ts +1 -1
  8. package/dist/actions/add-product-to-cart/mock.js +24 -10
  9. package/dist/actions/add-product-to-cart/types.d.ts +15 -3
  10. package/dist/actions/adjust-inventory/mock.d.ts +1 -1
  11. package/dist/actions/adjust-inventory/mock.js +6 -6
  12. package/dist/actions/apply-transition/mock.d.ts +1 -1
  13. package/dist/actions/apply-transition/mock.js +8 -8
  14. package/dist/actions/apply-transition/types.d.ts +1 -1
  15. package/dist/actions/authenticate-user/mock.d.ts +1 -1
  16. package/dist/actions/authenticate-user/mock.js +3 -3
  17. package/dist/actions/calculate-refund-total/action.d.ts +1 -1
  18. package/dist/actions/calculate-refund-total/action.js +2 -2
  19. package/dist/actions/can-transition/types.d.ts +1 -1
  20. package/dist/actions/cash-payment/mock.d.ts +1 -1
  21. package/dist/actions/cash-payment/mock.js +10 -10
  22. package/dist/actions/cash-payment/types.d.ts +1 -1
  23. package/dist/actions/charge-moto/action.d.ts +6 -0
  24. package/dist/actions/charge-moto/action.js +8 -0
  25. package/dist/actions/charge-moto/mock.d.ts +2 -0
  26. package/dist/actions/charge-moto/mock.js +47 -0
  27. package/dist/actions/charge-moto/types.d.ts +53 -0
  28. package/dist/actions/charge-moto/types.js +1 -0
  29. package/dist/actions/create-payment-link/action.d.ts +6 -0
  30. package/dist/actions/create-payment-link/action.js +8 -0
  31. package/dist/actions/create-payment-link/mock.d.ts +2 -0
  32. package/dist/actions/create-payment-link/mock.js +35 -0
  33. package/dist/actions/create-payment-link/types.d.ts +27 -0
  34. package/dist/actions/create-payment-link/types.js +12 -0
  35. package/dist/actions/extension-payment/mock.d.ts +1 -1
  36. package/dist/actions/extension-payment/mock.js +3 -3
  37. package/dist/actions/extension-payment/types.d.ts +1 -1
  38. package/dist/actions/get-final-context/mock.d.ts +1 -1
  39. package/dist/actions/get-final-context/mock.js +2 -2
  40. package/dist/actions/get-products/mock.d.ts +1 -1
  41. package/dist/actions/get-products/mock.js +26 -9
  42. package/dist/actions/get-refunds/types.d.ts +1 -1
  43. package/dist/actions/get-remaining-refundable-quantities/action.d.ts +1 -1
  44. package/dist/actions/get-remaining-refundable-quantities/action.js +2 -2
  45. package/dist/actions/get-remaining-refundable-quantities/mock.d.ts +1 -1
  46. package/dist/actions/get-remaining-refundable-quantities/mock.js +2 -2
  47. package/dist/actions/get-time-clock-status/action.d.ts +6 -0
  48. package/dist/actions/get-time-clock-status/action.js +8 -0
  49. package/dist/actions/get-time-clock-status/mock.d.ts +2 -0
  50. package/dist/actions/get-time-clock-status/mock.js +17 -0
  51. package/dist/actions/get-time-clock-status/types.d.ts +18 -0
  52. package/dist/actions/get-time-clock-status/types.js +7 -0
  53. package/dist/actions/integration-payment/types.d.ts +1 -1
  54. package/dist/actions/park-order/types.d.ts +1 -1
  55. package/dist/actions/partial-payment/mock.d.ts +1 -1
  56. package/dist/actions/partial-payment/mock.js +8 -8
  57. package/dist/actions/partial-payment/types.d.ts +1 -1
  58. package/dist/actions/print/mock.d.ts +1 -1
  59. package/dist/actions/print/mock.js +9 -9
  60. package/dist/actions/print/types.d.ts +6 -6
  61. package/dist/actions/redeem-payment/types.d.ts +1 -1
  62. package/dist/actions/remove-cart-fee/mock.d.ts +1 -1
  63. package/dist/actions/remove-cart-fee/mock.js +7 -7
  64. package/dist/actions/remove-product-from-cart/mock.d.ts +1 -1
  65. package/dist/actions/remove-product-from-cart/mock.js +11 -8
  66. package/dist/actions/resume-parked-order/types.d.ts +1 -1
  67. package/dist/actions/select-all-refund-items/action.d.ts +1 -1
  68. package/dist/actions/select-all-refund-items/action.js +2 -2
  69. package/dist/actions/set-active-product/mock.d.ts +1 -1
  70. package/dist/actions/set-active-product/mock.js +19 -14
  71. package/dist/actions/set-active-refund/types.d.ts +1 -1
  72. package/dist/actions/tap-to-pay-payment/mock.d.ts +1 -1
  73. package/dist/actions/tap-to-pay-payment/mock.js +6 -6
  74. package/dist/actions/tap-to-pay-payment/types.d.ts +1 -1
  75. package/dist/actions/terminal-payment/mock.d.ts +1 -1
  76. package/dist/actions/terminal-payment/mock.js +6 -6
  77. package/dist/actions/terminal-payment/types.d.ts +2 -2
  78. package/dist/actions/update-cart-item-quantity/mock.d.ts +1 -1
  79. package/dist/actions/update-cart-item-quantity/mock.js +23 -15
  80. package/dist/actions/update-cart-item-quantity/types.d.ts +8 -1
  81. package/dist/actions/upsert-custom-table-data/mock.d.ts +1 -1
  82. package/dist/actions/upsert-custom-table-data/mock.js +3 -3
  83. package/dist/demo/database.js +30 -4
  84. package/dist/index.d.ts +6 -0
  85. package/dist/index.js +8 -0
  86. package/dist/projects/render/mocks.js +6 -0
  87. package/dist/projects/render/types.d.ts +4 -1
  88. package/package.json +2 -2
@@ -1,47 +1,52 @@
1
- import { MOCK_PRODUCTS, setMockActiveProduct } from "../../demo/database";
1
+ import { MOCK_PRODUCTS, setMockActiveProduct } from '../../demo/database';
2
+ import { resolveUnit } from '@final-commerce/common';
2
3
  export const mockSetActiveProduct = async (params) => {
3
- console.log("[Mock] setActiveProduct called", params);
4
+ console.log('[Mock] setActiveProduct called', params);
4
5
  if (!params?.variantId) {
5
- throw new Error("Variant ID is required");
6
+ throw new Error('Variant ID is required');
6
7
  }
7
8
  const { variantId } = params;
8
9
  let matchedProduct;
9
10
  let matchedVariant;
10
11
  for (const product of MOCK_PRODUCTS) {
11
- const variant = product.variants.find(v => v._id === variantId);
12
+ const variant = product.variants.find((v) => v._id === variantId);
12
13
  if (variant) {
13
14
  matchedProduct = product;
14
15
  matchedVariant = variant;
15
16
  break;
16
17
  }
17
18
  }
19
+ // The unit the variant sells in, resolved exactly as the add-to-cart mock does — the
20
+ // product card reads the ACTIVE product, and without this it cannot label "100" as kg.
21
+ const unit = matchedVariant?.unitId ? resolveUnit(matchedVariant.unitId) : undefined;
18
22
  const activeProduct = {
19
- id: matchedProduct?._id || "mock_product",
23
+ id: matchedProduct?._id || 'mock_product',
20
24
  internalId: `internal_${Date.now()}`,
21
- externalId: matchedVariant?.externalId || "mock_external_id",
22
- productExternalId: matchedProduct?.externalId || "mock_product_external_id",
25
+ externalId: matchedVariant?.externalId || 'mock_external_id',
26
+ productExternalId: matchedProduct?.externalId || 'mock_product_external_id',
23
27
  variantId: matchedVariant?._id || variantId,
24
- name: matchedProduct?.name || "Mock Product",
25
- sku: matchedVariant?.sku || "mock_sku",
28
+ name: matchedProduct?.name || 'Mock Product',
29
+ sku: matchedVariant?.sku || 'mock_sku',
26
30
  price: matchedVariant?.price || 100,
27
31
  images: matchedVariant?.images || matchedProduct?.images || [],
28
- taxTableId: matchedProduct?.taxTable || "mock_tax_table_id",
32
+ taxTableId: matchedProduct?.taxTable || 'mock_tax_table_id',
29
33
  quantity: 1,
30
34
  note: undefined,
31
35
  discount: undefined,
32
- description: matchedProduct?.description || "Mock Description",
33
- barcodeId: matchedVariant?.barcode || "mock_barcode_id",
36
+ description: matchedProduct?.description || 'Mock Description',
37
+ barcodeId: matchedVariant?.barcode || 'mock_barcode_id',
34
38
  stock: matchedVariant?.inventory?.[0]?.stock ?? 100,
39
+ ...(unit ? { unit } : {}),
35
40
  allowBackOrder: matchedVariant?.allowBackorder || false,
36
41
  fee: undefined,
37
42
  isUnlimited: !matchedVariant?.manageStock,
38
- attributes: matchedVariant?.attributes?.map(a => a.value).join(", ") || "",
43
+ attributes: matchedVariant?.attributes?.map((a) => a.value).join(', ') || '',
39
44
  localQuantity: 1,
40
45
  };
41
46
  setMockActiveProduct(activeProduct);
42
47
  return {
43
48
  success: true,
44
49
  product: activeProduct,
45
- timestamp: new Date().toISOString()
50
+ timestamp: new Date().toISOString(),
46
51
  };
47
52
  };
@@ -1,4 +1,4 @@
1
- import { CFActiveRefundDetails } from "../../CommonTypes";
1
+ import { CFActiveRefundDetails } from '../../CommonTypes';
2
2
  export interface SetActiveRefundParams {
3
3
  orderId: string;
4
4
  }
@@ -1,2 +1,2 @@
1
- import { TapToPayPayment } from "./types";
1
+ import { TapToPayPayment } from './types';
2
2
  export declare const mockTapToPayPayment: TapToPayPayment;
@@ -1,19 +1,19 @@
1
- import { applyMockPayment, MOCK_CART } from "../../demo/database";
1
+ import { applyMockPayment, MOCK_CART } from '../../demo/database';
2
2
  export const mockTapToPayPayment = async (params) => {
3
- console.log("[Mock] tapToPayPayment called", params);
3
+ console.log('[Mock] tapToPayPayment called', params);
4
4
  // Simulate Tap to Pay interaction
5
- window.alert("Demo: Processing Tap to Pay...\n(Please tap card or device on screen)");
5
+ window.alert('Demo: Processing Tap to Pay...\n(Please tap card or device on screen)');
6
6
  const due = params?.amount ?? MOCK_CART.amountToBeCharged ?? MOCK_CART.total;
7
- const order = applyMockPayment(due, "card", "tapToPay");
7
+ const order = applyMockPayment(due, 'card', 'tapToPay');
8
8
  return {
9
9
  success: true,
10
10
  amount: due,
11
- paymentType: "tapToPay",
11
+ paymentType: 'tapToPay',
12
12
  order,
13
13
  timestamp: new Date().toISOString(),
14
14
  change: 0,
15
15
  cashRounding: 0,
16
16
  saleFinalized: true,
17
- remainingBalance: 0
17
+ remainingBalance: 0,
18
18
  };
19
19
  };
@@ -1,4 +1,4 @@
1
- import { CFOrder } from "../../CommonTypes";
1
+ import { CFOrder } from '../../CommonTypes';
2
2
  export interface TapToPayPaymentParams {
3
3
  /**
4
4
  * The amount to pay with this tender, in integer MINOR currency units
@@ -1,2 +1,2 @@
1
- import { TerminalPayment } from "./types";
1
+ import { TerminalPayment } from './types';
2
2
  export declare const mockTerminalPayment: TerminalPayment;
@@ -1,20 +1,20 @@
1
- import { applyMockPayment, MOCK_CART } from "../../demo/database";
1
+ import { applyMockPayment, MOCK_CART } from '../../demo/database';
2
2
  export const mockTerminalPayment = async (params) => {
3
- console.log("[Mock] terminalPayment called", params);
4
- const connectionType = params?.paymentType || "Cloud";
3
+ console.log('[Mock] terminalPayment called', params);
4
+ const connectionType = params?.paymentType || 'Cloud';
5
5
  // Simulate terminal interaction
6
6
  window.alert(`Demo: Processing ${connectionType} Terminal Payment...\n(Please tap, insert, or swipe card on terminal)`);
7
7
  const due = params?.amount ?? MOCK_CART.amountToBeCharged ?? MOCK_CART.total;
8
- const order = applyMockPayment(due, "card", "stripe_terminal");
8
+ const order = applyMockPayment(due, 'card', 'stripe_terminal');
9
9
  return {
10
10
  success: true,
11
11
  amount: due,
12
- paymentType: "terminal",
12
+ paymentType: 'terminal',
13
13
  order,
14
14
  timestamp: new Date().toISOString(),
15
15
  change: 0,
16
16
  cashRounding: 0,
17
17
  saleFinalized: true,
18
- remainingBalance: 0
18
+ remainingBalance: 0,
19
19
  };
20
20
  };
@@ -1,4 +1,4 @@
1
- import { CFOrder } from "../../CommonTypes";
1
+ import { CFOrder } from '../../CommonTypes';
2
2
  export interface TerminalPaymentParams {
3
3
  /**
4
4
  * The amount to pay with this tender, in integer MINOR currency units
@@ -11,7 +11,7 @@ export interface TerminalPaymentParams {
11
11
  */
12
12
  amount: number;
13
13
  /** "Bluetooth" or "Cloud". Only "Cloud" routes to the cloud processor; omitted or "Bluetooth" uses the native card reader. */
14
- paymentType?: "Bluetooth" | "Cloud";
14
+ paymentType?: 'Bluetooth' | 'Cloud';
15
15
  /** Override the fulfillment state the order lands in on full payment (validated against the fulfillment state machine; invalid values throw). Omitted: preserve advanced fulfillment, auto-fulfill from draft/pending/on_hold. */
16
16
  checkoutFulfillmentTarget?: string;
17
17
  }
@@ -1,2 +1,2 @@
1
- import { UpdateCartItemQuantity } from "./types";
1
+ import { UpdateCartItemQuantity } from './types';
2
2
  export declare const mockUpdateCartItemQuantity: UpdateCartItemQuantity;
@@ -1,60 +1,68 @@
1
- import { MOCK_CART, mockPublishEvent } from "../../demo/database";
1
+ import { MOCK_CART, mockPublishEvent } from '../../demo/database';
2
+ import { extendPrice, isValidQuantity } from '@final-commerce/common';
2
3
  export const mockUpdateCartItemQuantity = (params) => {
3
- console.log("[Mock] updateCartItemQuantity called", params);
4
+ console.log('[Mock] updateCartItemQuantity called', params);
4
5
  if (!params?.internalId) {
5
- throw new Error("internalId is required");
6
+ throw new Error('internalId is required');
6
7
  }
7
8
  if (params.quantity === undefined || params.quantity === null) {
8
- throw new Error("quantity is required");
9
+ throw new Error('quantity is required');
9
10
  }
10
11
  const { internalId, quantity } = params;
11
12
  // Find the product in the cart
12
- const productIndex = MOCK_CART.products.findIndex(p => p.internalId === internalId);
13
+ const productIndex = MOCK_CART.products.findIndex((p) => p.internalId === internalId);
13
14
  if (productIndex === -1) {
14
15
  throw new Error(`Cart item with internalId ${internalId} not found`);
15
16
  }
16
17
  const product = MOCK_CART.products[productIndex];
17
18
  const previousQuantity = product.quantity;
19
+ // The line resolved its unit when it was added; a piece-sold line has none and stays whole.
20
+ if (quantity !== 0 &&
21
+ !isValidQuantity(quantity, (product.unit ?? { unitId: 'piece', ratioToBase: 1, precision: 0 }))) {
22
+ throw new Error(product.unit
23
+ ? `${quantity} is finer than ${product.unit.abbreviation} can express (${product.unit.precision} decimals)`
24
+ : `${product.name} is sold by the piece, so ${quantity} is not a quantity it can sell in`);
25
+ }
18
26
  // If quantity is 0, remove the item
19
27
  if (quantity === 0) {
20
28
  MOCK_CART.products.splice(productIndex, 1);
21
29
  // Recalculate totals
22
- const lineTotal = product.price * previousQuantity;
30
+ const lineTotal = extendPrice(product.price, previousQuantity);
23
31
  MOCK_CART.subtotal -= lineTotal;
24
32
  MOCK_CART.total -= lineTotal;
25
33
  MOCK_CART.amountToBeCharged = MOCK_CART.total;
26
34
  MOCK_CART.remainingBalance = MOCK_CART.total;
27
35
  // Publish product-deleted event
28
- mockPublishEvent("cart", "product-deleted", {
36
+ mockPublishEvent('cart', 'product-deleted', {
29
37
  product: product,
30
- internalId: internalId
38
+ internalId: internalId,
31
39
  });
32
40
  return Promise.resolve({
33
41
  success: true,
34
42
  internalId: internalId,
35
43
  quantity: 0,
36
- timestamp: new Date().toISOString()
44
+ timestamp: new Date().toISOString(),
37
45
  });
38
46
  }
39
47
  // Update quantity
40
- const quantityDelta = quantity - previousQuantity;
41
48
  product.quantity = quantity;
42
- // Recalculate totals
43
- const lineTotalDelta = product.price * quantityDelta;
49
+ // Difference of the two ROUNDED extensions — rounding the delta itself would let the
50
+ // line's running total drift from what extendPrice(price, quantity) says it is.
51
+ const lineTotalDelta = extendPrice(product.price, quantity) - extendPrice(product.price, previousQuantity);
44
52
  MOCK_CART.subtotal += lineTotalDelta;
45
53
  MOCK_CART.total += lineTotalDelta;
46
54
  MOCK_CART.amountToBeCharged = MOCK_CART.total;
47
55
  MOCK_CART.remainingBalance = MOCK_CART.total;
48
56
  // Publish product-updated event
49
- mockPublishEvent("cart", "product-updated", {
57
+ mockPublishEvent('cart', 'product-updated', {
50
58
  product: product,
51
59
  previousQuantity: previousQuantity,
52
- newQuantity: quantity
60
+ newQuantity: quantity,
53
61
  });
54
62
  return Promise.resolve({
55
63
  success: true,
56
64
  internalId: internalId,
57
65
  quantity: quantity,
58
- timestamp: new Date().toISOString()
66
+ timestamp: new Date().toISOString(),
59
67
  });
60
68
  };
@@ -1,7 +1,14 @@
1
1
  export interface UpdateCartItemQuantityParams {
2
2
  /** The unique identifier for the specific cart item to update. */
3
3
  internalId: string;
4
- /** The new quantity. If set to 0, the item will be removed from the cart. */
4
+ /**
5
+ * The new quantity. If set to 0, the item will be removed from the cart.
6
+ *
7
+ * **May be fractional** for a variant sold by measure; the number of decimals allowed comes
8
+ * from `variant.unit.precision`. The engine refuses anything finer and names the unit in the
9
+ * error. Do not round or clamp before sending — a silently altered quantity is charged and
10
+ * deducted differently than the one the cashier typed.
11
+ */
5
12
  quantity: number;
6
13
  }
7
14
  export interface UpdateCartItemQuantityResponse {
@@ -1,2 +1,2 @@
1
- import { UpsertCustomTableData } from "./types";
1
+ import { UpsertCustomTableData } from './types';
2
2
  export declare const mockUpsertCustomTableData: UpsertCustomTableData;
@@ -1,5 +1,5 @@
1
1
  export const mockUpsertCustomTableData = async (params) => {
2
- console.log("[Mock] upsertCustomTableData called", params);
2
+ console.log('[Mock] upsertCustomTableData called', params);
3
3
  const data = params?.data;
4
4
  const now = new Date().toISOString();
5
5
  // Return the data with _id and timestamps added
@@ -7,11 +7,11 @@ export const mockUpsertCustomTableData = async (params) => {
7
7
  ...data,
8
8
  _id: data?._id || `mock_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
9
9
  createdAt: data?.createdAt || now,
10
- updatedAt: now
10
+ updatedAt: now,
11
11
  };
12
12
  return {
13
13
  success: true,
14
14
  data: resultData,
15
- timestamp: now
15
+ timestamp: now,
16
16
  };
17
17
  };
@@ -3,6 +3,7 @@
3
3
  * Stores mock data that mimics the Render environment
4
4
  */
5
5
  import { CFProductType, CFUserTypes, CurrencyCode, } from '../CommonTypes';
6
+ import { extendPrice, resolveUnit, toBase } from '@final-commerce/common';
6
7
  export * from './mocks';
7
8
  // Asset Imports - Using Remote URLs to avoid build complexity with asset copying
8
9
  const ASSETS_BASE_URL = 'https://raw.githubusercontent.com/Final-Commerce/command-frame/refs/heads/main/src/demo/assets';
@@ -314,12 +315,25 @@ export const MOCK_PRODUCT_BLACK_GARLIC = createSimpleProduct('prod_black_garlic'
314
315
  // Helper to create line item
315
316
  const createLineItem = (product, variantIndex = 0, quantity = 1) => {
316
317
  const variant = product.variants[variantIndex];
318
+ // Same contract as a real order line: the unit is FROZEN on the line (a re-rated unit must
319
+ // not restate old orders), and the money is extendPrice — price × quantity may carry a
320
+ // fractional quantity, and the raw multiply would put fractional cents on the order.
321
+ const unit = variant.unitId ? resolveUnit(variant.unitId) : undefined;
322
+ const total = extendPrice(variant.price, quantity);
317
323
  return {
318
324
  productId: product._id,
319
325
  variantId: variant._id,
320
326
  name: product.name,
321
327
  quantity,
322
328
  price: variant.price,
329
+ ...(unit
330
+ ? {
331
+ unitId: unit.unitId,
332
+ unitAbbreviation: unit.abbreviation,
333
+ unitRatioToBase: unit.ratioToBase,
334
+ stockQuantity: toBase(quantity, unit),
335
+ }
336
+ : {}),
323
337
  taxes: [],
324
338
  discount: {
325
339
  itemDiscounts: [],
@@ -327,8 +341,8 @@ const createLineItem = (product, variantIndex = 0, quantity = 1) => {
327
341
  },
328
342
  fee: { itemFees: [] },
329
343
  totalTax: 0,
330
- total: variant.price * quantity,
331
- lineNetWithFees: variant.price * quantity,
344
+ total,
345
+ lineNetWithFees: total,
332
346
  metadata: [],
333
347
  image: product.images?.[0] || '',
334
348
  sku: variant.sku,
@@ -784,12 +798,24 @@ export const createOrderFromCart = (paymentType, amount, processor = 'cash') =>
784
798
  const receiptId = `receipt_${Date.now()}`;
785
799
  // Map cart products to line items
786
800
  const lineItems = MOCK_CART.products.map((p) => {
801
+ // The cart line resolved its unit when it was added; the ORDER line freezes it, exactly
802
+ // as production does. extendPrice for the same reason as everywhere: fractional
803
+ // quantities must not leave fractional cents on an order.
804
+ const lineTotal = extendPrice(p.price, p.quantity);
787
805
  return {
788
806
  productId: p.id,
789
807
  variantId: p.variantId,
790
808
  name: p.name,
791
809
  quantity: p.quantity,
792
810
  price: p.price,
811
+ ...(p.unit
812
+ ? {
813
+ unitId: p.unit.unitId,
814
+ unitAbbreviation: p.unit.abbreviation,
815
+ unitRatioToBase: p.unit.ratioToBase,
816
+ stockQuantity: toBase(p.quantity, p.unit),
817
+ }
818
+ : {}),
793
819
  taxes: [],
794
820
  discount: {
795
821
  itemDiscounts: [],
@@ -797,8 +823,8 @@ export const createOrderFromCart = (paymentType, amount, processor = 'cash') =>
797
823
  },
798
824
  fee: { itemFees: [] },
799
825
  totalTax: 0,
800
- total: p.price * p.quantity,
801
- lineNetWithFees: p.price * p.quantity,
826
+ total: lineTotal,
827
+ lineNetWithFees: lineTotal,
802
828
  metadata: [],
803
829
  image: p.images?.[0] || '',
804
830
  sku: p.sku || '',
package/dist/index.d.ts CHANGED
@@ -41,6 +41,8 @@ export declare const command: {
41
41
  readonly extensionPayment: import(".").ExtensionPayment;
42
42
  readonly redeemPayment: import(".").RedeemPayment;
43
43
  readonly integrationPayment: import(".").IntegrationPayment;
44
+ readonly createPaymentLink: import(".").CreatePaymentLink;
45
+ readonly chargeMoto: import(".").ChargeMoto;
44
46
  readonly addCustomerNote: import(".").AddCustomerNote;
45
47
  readonly removeCustomerNote: import(".").RemoveCustomerNote;
46
48
  readonly removeCustomerFromCart: import(".").RemoveCustomerFromCart;
@@ -109,6 +111,7 @@ export declare const command: {
109
111
  readonly uploadMedia: import(".").UploadMedia;
110
112
  readonly getTaxTables: import(".").GetTaxTables;
111
113
  readonly getBranding: import(".").GetBranding;
114
+ readonly getTimeClockStatus: import(".").GetTimeClockStatus;
112
115
  readonly canTransition: import(".").CanTransition;
113
116
  readonly getAvailableTransitions: import(".").GetAvailableTransitions;
114
117
  readonly applyTransition: import(".").ApplyTransition;
@@ -173,6 +176,8 @@ export type { TerminalPayment, TerminalPaymentParams, TerminalPaymentResponse }
173
176
  export type { ExtensionPayment, ExtensionPaymentParams, ExtensionPaymentResponse, } from './actions/extension-payment/types';
174
177
  export type { RedeemPayment, RedeemPaymentParams, RedeemPaymentResponse } from './actions/redeem-payment/types';
175
178
  export type { IntegrationPayment, IntegrationPaymentParams, IntegrationPaymentResponse, IntegrationEmvData, } from './actions/integration-payment/types';
179
+ export type { CreatePaymentLink, CreatePaymentLinkParams, CreatePaymentLinkResponse, } from './actions/create-payment-link/types';
180
+ export type { ChargeMoto, ChargeMotoParams, ChargeMotoResponse, ChargeMotoCardFields, } from './actions/charge-moto/types';
176
181
  export type { AddCustomerNote, AddCustomerNoteParams, AddCustomerNoteResponse, } from './actions/add-customer-note/types';
177
182
  export type { RemoveCustomerNote, RemoveCustomerNoteParams, RemoveCustomerNoteResponse, } from './actions/remove-customer-note/types';
178
183
  export type { RemoveCustomerFromCart, RemoveCustomerFromCartResponse } from './actions/remove-customer-from-cart/types';
@@ -186,6 +191,7 @@ export type { GetMedia, GetMediaParams, GetMediaResponse, MediaItemPayload } fro
186
191
  export type { UploadMedia, UploadMediaParams, UploadMediaResponse } from './actions/upload-media/types';
187
192
  export type { GetTaxTables, GetTaxTablesResponse, TaxRatePayload, TaxTablePayload, } from './actions/get-tax-tables/types';
188
193
  export type { BorderRadiusPreset, GetBranding, GetBrandingResponse } from './actions/get-branding/types';
194
+ export type { GetTimeClockStatus, GetTimeClockStatusResponse, TimeClockEntry, } from './actions/get-time-clock-status/types';
189
195
  export type { ShowConfirmation, ShowConfirmationParams, ShowConfirmationResponse, } from './actions/show-confirmation/types';
190
196
  export type { AuthenticateUser, AuthenticateUserParams, AuthenticateUserResponse, } from './actions/authenticate-user/types';
191
197
  export type { PartialPayment, PartialPaymentParams, PartialPaymentResponse } from './actions/partial-payment/types';
package/dist/index.js CHANGED
@@ -41,6 +41,8 @@ import { terminalPayment } from './actions/terminal-payment/action';
41
41
  import { extensionPayment } from './actions/extension-payment/action';
42
42
  import { redeemPayment } from './actions/redeem-payment/action';
43
43
  import { integrationPayment } from './actions/integration-payment/action';
44
+ import { createPaymentLink } from './actions/create-payment-link/action';
45
+ import { chargeMoto } from './actions/charge-moto/action';
44
46
  // Customer Actions
45
47
  import { addCustomerNote } from './actions/add-customer-note/action';
46
48
  import { removeCustomerNote } from './actions/remove-customer-note/action';
@@ -128,6 +130,8 @@ import { getMedia } from './actions/get-media/action';
128
130
  import { uploadMedia } from './actions/upload-media/action';
129
131
  import { getTaxTables } from './actions/get-tax-tables/action';
130
132
  import { getBranding } from './actions/get-branding/action';
133
+ // Time Clock Actions
134
+ import { getTimeClockStatus } from './actions/get-time-clock-status/action';
131
135
  // Export actions as command object
132
136
  export const command = {
133
137
  exampleFunction,
@@ -174,6 +178,8 @@ export const command = {
174
178
  extensionPayment,
175
179
  redeemPayment,
176
180
  integrationPayment,
181
+ createPaymentLink,
182
+ chargeMoto,
177
183
  // Customer Actions
178
184
  addCustomerNote,
179
185
  removeCustomerNote,
@@ -256,6 +262,8 @@ export const command = {
256
262
  uploadMedia,
257
263
  getTaxTables,
258
264
  getBranding,
265
+ // Time Clock Actions
266
+ getTimeClockStatus,
259
267
  // State Machine Queries
260
268
  canTransition,
261
269
  getAvailableTransitions,
@@ -29,6 +29,9 @@ import { mockAuthenticateUser } from '../../actions/authenticate-user/mock';
29
29
  import { mockCalculateRefundTotal } from '../../actions/calculate-refund-total/mock';
30
30
  import { mockCashPayment } from '../../actions/cash-payment/mock';
31
31
  import { mockGetCashRoundingAmount } from '../../actions/get-cash-rounding-amount/mock';
32
+ import { mockCreatePaymentLink } from '../../actions/create-payment-link/mock';
33
+ import { mockChargeMoto } from '../../actions/charge-moto/mock';
34
+ import { mockGetTimeClockStatus } from '../../actions/get-time-clock-status/mock';
32
35
  import { mockClearCart } from '../../actions/clear-cart/mock';
33
36
  import { mockDeleteParkedOrder } from '../../actions/delete-parked-order/mock';
34
37
  import { mockVoidOrder } from '../../actions/void-order/mock';
@@ -123,6 +126,8 @@ export const RENDER_MOCKS = {
123
126
  calculateRefundTotal: mockCalculateRefundTotal,
124
127
  cashPayment: mockCashPayment,
125
128
  getCashRoundingAmount: mockGetCashRoundingAmount,
129
+ createPaymentLink: mockCreatePaymentLink,
130
+ chargeMoto: mockChargeMoto,
126
131
  clearCart: mockClearCart,
127
132
  deleteParkedOrder: mockDeleteParkedOrder,
128
133
  voidOrder: mockVoidOrder,
@@ -199,4 +204,5 @@ export const RENDER_MOCKS = {
199
204
  saveSmartGridLayout: mockSaveSmartGridLayout,
200
205
  sendEmail: mockSendEmail,
201
206
  sendSms: mockSendSms,
207
+ getTimeClockStatus: mockGetTimeClockStatus,
202
208
  };
@@ -1,4 +1,4 @@
1
- import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, VoidOrder, InitiateRefund, CashPayment, GetCashRoundingAmount, TapToPayPayment, TerminalPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, RedeemRefund, GetRefundPlan, CheckPermission, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal, GetUsers, GetRoles, RemoveCartDiscount, GetActiveOrder, GetActiveCustomer, SetActiveCustomer, GetActiveOutlet, GetActiveStation, GetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, CanTransition, GetAvailableTransitions, ApplyTransition, IntegrationPayment, GetSmartGridLayout, SaveSmartGridLayout, SendEmail, SendSms } from '../../index';
1
+ import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, VoidOrder, InitiateRefund, CashPayment, GetCashRoundingAmount, TapToPayPayment, TerminalPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, RedeemRefund, GetRefundPlan, CheckPermission, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal, GetUsers, GetRoles, RemoveCartDiscount, GetActiveOrder, GetActiveCustomer, SetActiveCustomer, GetActiveOutlet, GetActiveStation, GetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, CanTransition, GetAvailableTransitions, ApplyTransition, IntegrationPayment, GetSmartGridLayout, SaveSmartGridLayout, SendEmail, SendSms, CreatePaymentLink, ChargeMoto, GetTimeClockStatus } from '../../index';
2
2
  export interface RenderProviderActions {
3
3
  exampleFunction: ExampleFunction;
4
4
  getProducts: GetProducts;
@@ -41,6 +41,8 @@ export interface RenderProviderActions {
41
41
  extensionPayment: ExtensionPayment;
42
42
  redeemPayment: RedeemPayment;
43
43
  integrationPayment: IntegrationPayment;
44
+ createPaymentLink: CreatePaymentLink;
45
+ chargeMoto: ChargeMoto;
44
46
  addNonRevenueItem: AddNonRevenueItem;
45
47
  addCustomerNote: AddCustomerNote;
46
48
  removeCustomerNote: RemoveCustomerNote;
@@ -101,4 +103,5 @@ export interface RenderProviderActions {
101
103
  saveSmartGridLayout: SaveSmartGridLayout;
102
104
  sendEmail: SendEmail;
103
105
  sendSms: SendSms;
106
+ getTimeClockStatus: GetTimeClockStatus;
104
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.5.1",
3
+ "version": "0.6.0-preprod.2",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -57,7 +57,7 @@
57
57
  "ignoreBranchesMissingTickets": true
58
58
  },
59
59
  "dependencies": {
60
- "@final-commerce/common": "^2.0.2"
60
+ "@final-commerce/common": "2.2.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@commitlint/cli": "^19.0.0",