@final-commerce/command-frame 0.7.0-staging.3 → 0.8.0-online.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 (76) hide show
  1. package/dist/CommonTypes.d.ts +1 -11
  2. package/dist/actions/start-checkout/action.d.ts +6 -0
  3. package/dist/actions/start-checkout/action.js +8 -0
  4. package/dist/actions/start-checkout/mock.d.ts +16 -0
  5. package/dist/actions/start-checkout/mock.js +80 -0
  6. package/dist/actions/start-checkout/types.d.ts +81 -0
  7. package/dist/actions/start-checkout/types.js +10 -0
  8. package/dist/demo/database.d.ts +1 -8
  9. package/dist/demo/database.js +0 -93
  10. package/dist/index.d.ts +4 -16
  11. package/dist/index.js +3 -15
  12. package/dist/projects/render/mocks.js +2 -14
  13. package/dist/projects/render/types.d.ts +7 -8
  14. package/dist/pubsub/topics/checkout/checkout-started/types.d.ts +26 -0
  15. package/dist/pubsub/topics/checkout/index.d.ts +7 -0
  16. package/dist/pubsub/topics/checkout/index.js +28 -0
  17. package/dist/pubsub/topics/checkout/payment-completed/types.d.ts +19 -0
  18. package/dist/pubsub/topics/checkout/payment-failed/types.d.ts +20 -0
  19. package/dist/pubsub/topics/checkout/types.d.ts +12 -0
  20. package/dist/pubsub/topics/checkout/types.js +8 -0
  21. package/dist/pubsub/topics/index.d.ts +17 -17
  22. package/dist/pubsub/topics/index.js +17 -17
  23. package/dist/pubsub/topics/types.d.ts +8 -2
  24. package/package.json +2 -2
  25. package/dist/actions/add-booking-to-cart/action.d.ts +0 -6
  26. package/dist/actions/add-booking-to-cart/action.js +0 -8
  27. package/dist/actions/add-booking-to-cart/mock.d.ts +0 -2
  28. package/dist/actions/add-booking-to-cart/mock.js +0 -8
  29. package/dist/actions/add-booking-to-cart/types.d.ts +0 -23
  30. package/dist/actions/cancel-booking/action.d.ts +0 -6
  31. package/dist/actions/cancel-booking/action.js +0 -8
  32. package/dist/actions/cancel-booking/mock.d.ts +0 -2
  33. package/dist/actions/cancel-booking/mock.js +0 -10
  34. package/dist/actions/cancel-booking/types.d.ts +0 -10
  35. package/dist/actions/get-booking-availability/action.d.ts +0 -6
  36. package/dist/actions/get-booking-availability/action.js +0 -8
  37. package/dist/actions/get-booking-availability/mock.d.ts +0 -2
  38. package/dist/actions/get-booking-availability/mock.js +0 -6
  39. package/dist/actions/get-booking-availability/types.d.ts +0 -18
  40. package/dist/actions/get-booking-resources/action.d.ts +0 -6
  41. package/dist/actions/get-booking-resources/action.js +0 -8
  42. package/dist/actions/get-booking-resources/mock.d.ts +0 -2
  43. package/dist/actions/get-booking-resources/mock.js +0 -7
  44. package/dist/actions/get-booking-resources/types.d.ts +0 -12
  45. package/dist/actions/get-booking-resources/types.js +0 -1
  46. package/dist/actions/get-bookings/action.d.ts +0 -6
  47. package/dist/actions/get-bookings/action.js +0 -8
  48. package/dist/actions/get-bookings/mock.d.ts +0 -2
  49. package/dist/actions/get-bookings/mock.js +0 -20
  50. package/dist/actions/get-bookings/types.d.ts +0 -18
  51. package/dist/actions/get-bookings/types.js +0 -1
  52. package/dist/actions/hold-booking/action.d.ts +0 -6
  53. package/dist/actions/hold-booking/action.js +0 -8
  54. package/dist/actions/hold-booking/mock.d.ts +0 -2
  55. package/dist/actions/hold-booking/mock.js +0 -33
  56. package/dist/actions/hold-booking/types.d.ts +0 -24
  57. package/dist/actions/hold-booking/types.js +0 -1
  58. package/dist/actions/remove-booking-from-cart/action.d.ts +0 -6
  59. package/dist/actions/remove-booking-from-cart/action.js +0 -8
  60. package/dist/actions/remove-booking-from-cart/mock.d.ts +0 -2
  61. package/dist/actions/remove-booking-from-cart/mock.js +0 -16
  62. package/dist/actions/remove-booking-from-cart/types.d.ts +0 -12
  63. package/dist/actions/remove-booking-from-cart/types.js +0 -1
  64. package/dist/pubsub/topics/bookings/booking-created/types.d.ts +0 -6
  65. package/dist/pubsub/topics/bookings/booking-created/types.js +0 -1
  66. package/dist/pubsub/topics/bookings/booking-setup-changed/types.d.ts +0 -15
  67. package/dist/pubsub/topics/bookings/booking-setup-changed/types.js +0 -1
  68. package/dist/pubsub/topics/bookings/booking-updated/types.d.ts +0 -6
  69. package/dist/pubsub/topics/bookings/booking-updated/types.js +0 -1
  70. package/dist/pubsub/topics/bookings/index.d.ts +0 -3
  71. package/dist/pubsub/topics/bookings/index.js +0 -27
  72. package/dist/pubsub/topics/bookings/types.d.ts +0 -8
  73. package/dist/pubsub/topics/bookings/types.js +0 -3
  74. /package/dist/{actions/add-booking-to-cart → pubsub/topics/checkout/checkout-started}/types.js +0 -0
  75. /package/dist/{actions/cancel-booking → pubsub/topics/checkout/payment-completed}/types.js +0 -0
  76. /package/dist/{actions/get-booking-availability → pubsub/topics/checkout/payment-failed}/types.js +0 -0
@@ -1,5 +1,5 @@
1
1
  export * from './common-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, CustomerNote, Attribute, AttributeOption, Category, Transaction, ActiveSplitPayment, BookingAvailability, BookingSlot, BookingSlotResource, BookingResource, Booking, CartReservation, OrderReservation } 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, CustomerNote, Attribute, AttributeOption, Category, Transaction, ActiveSplitPayment } 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>;
@@ -18,16 +18,6 @@ export type CFTransaction = Transaction;
18
18
  export type CFCategory = Category;
19
19
  export type CFProductVariant = ProductVariant;
20
20
  export type CFProduct = FullProduct;
21
- export type CFBookingAvailability = BookingAvailability;
22
- export type CFBookingSlot = BookingSlot;
23
- export type CFBookingSlotResource = BookingSlotResource;
24
- export type CFBookingResource = BookingResource;
25
- export type CFBooking = Booking;
26
- /** A service sitting in the cart, and the same sale once it is on an order. A flow that draws a
27
- * cart or a receipt needs both by name — reaching into the package's dist for them is not an
28
- * interface. */
29
- export type CFCartReservation = CartReservation;
30
- export type CFOrderReservation = OrderReservation;
31
21
  export type CFActiveProduct = ActiveProduct;
32
22
  export type CFCustomer = ActiveCustomer;
33
23
  export type CFActiveCustomer = ActiveCustomer;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Start Checkout action
3
+ * Calls the startCheckout action on the parent window
4
+ */
5
+ import type { StartCheckout } from './types';
6
+ export declare const startCheckout: StartCheckout;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Start Checkout action
3
+ * Calls the startCheckout action on the parent window
4
+ */
5
+ import { commandFrameClient } from '../../client';
6
+ export const startCheckout = async (params) => {
7
+ return await commandFrameClient.call('startCheckout', params);
8
+ };
@@ -0,0 +1,16 @@
1
+ import { StartCheckout } from './types';
2
+ /**
3
+ * Standalone mock of the storefront checkout.
4
+ *
5
+ * It mirrors the REFUSALS of the real command (empty cart, missing email,
6
+ * container not on the page) in the same order, because those are what a
7
+ * builder actually hits first — a mock that accepted anything would let a
8
+ * checkout screen look finished and fail on the published site.
9
+ *
10
+ * The mounted box is deliberately labelled as a mock. The real command mounts
11
+ * the provider's hosted card fields (iframes owned by the payment provider);
12
+ * nothing here takes a card number, and the placeholder must never look like
13
+ * it does. Its button publishes `payment-completed` so a flow's subscriber —
14
+ * the only way the outcome ever arrives — can be exercised in preview.
15
+ */
16
+ export declare const mockStartCheckout: StartCheckout;
@@ -0,0 +1,80 @@
1
+ import { MOCK_CART, MOCK_COMPANY, mockPublishEvent } from '../../demo/database';
2
+ /**
3
+ * Standalone mock of the storefront checkout.
4
+ *
5
+ * It mirrors the REFUSALS of the real command (empty cart, missing email,
6
+ * container not on the page) in the same order, because those are what a
7
+ * builder actually hits first — a mock that accepted anything would let a
8
+ * checkout screen look finished and fail on the published site.
9
+ *
10
+ * The mounted box is deliberately labelled as a mock. The real command mounts
11
+ * the provider's hosted card fields (iframes owned by the payment provider);
12
+ * nothing here takes a card number, and the placeholder must never look like
13
+ * it does. Its button publishes `payment-completed` so a flow's subscriber —
14
+ * the only way the outcome ever arrives — can be exercised in preview.
15
+ */
16
+ export const mockStartCheckout = async (params) => {
17
+ console.log('[Mock] startCheckout called', params);
18
+ if (!params)
19
+ throw new Error('Params required');
20
+ if (!params.contact?.email || !params.contact.email.trim()) {
21
+ throw new Error('startCheckout: contact.email is required — it is where the receipt goes');
22
+ }
23
+ if (!params.container || typeof params.container !== 'string') {
24
+ throw new Error('startCheckout: container must be a CSS selector string (e.g. "#card-fields") — a DOM element cannot cross the command boundary');
25
+ }
26
+ const lineCount = (MOCK_CART.products?.length ?? 0) + (MOCK_CART.customSales?.length ?? 0);
27
+ if (!lineCount) {
28
+ throw new Error('startCheckout: cannot check out an empty cart');
29
+ }
30
+ // Resolved BEFORE the order is "created", exactly as the real command does:
31
+ // finding out the selector is wrong after an order exists would leave an
32
+ // unpaid order behind for a typo that cost nothing to catch first.
33
+ const container = typeof document === 'undefined' ? null : document.querySelector(params.container);
34
+ if (!container) {
35
+ throw new Error(`startCheckout: checkout container "${params.container}" was not found on the page`);
36
+ }
37
+ const serverTotal = Math.round(MOCK_CART.amountToBeCharged || MOCK_CART.total);
38
+ const currency = MOCK_COMPANY.settings?.currency ?? 'USD';
39
+ const suffix = String(Date.now()).slice(-6);
40
+ const order = {
41
+ orderId: `mock-order-${suffix}`,
42
+ receiptId: `ON-001-${suffix}`,
43
+ serverTotal,
44
+ currency,
45
+ paymentStatus: 'ready',
46
+ orderPassword: `mock-pw-${suffix}`,
47
+ };
48
+ mockPublishEvent('checkout', 'checkout-started', { ...order });
49
+ container.replaceChildren();
50
+ const box = document.createElement('div');
51
+ box.setAttribute('data-mock-checkout', 'true');
52
+ box.style.cssText =
53
+ 'border:1px dashed #9aa;border-radius:8px;padding:16px;font:14px system-ui,sans-serif;text-align:center;color:#334';
54
+ const label = document.createElement('div');
55
+ label.textContent = 'Mock payment fields — the published site shows the real hosted card fields here.';
56
+ label.style.cssText = 'margin-bottom:12px;opacity:.75';
57
+ const button = document.createElement('button');
58
+ button.type = 'button';
59
+ button.textContent = `Simulate paying ${(serverTotal / 100).toFixed(2)} ${currency}`;
60
+ button.style.cssText =
61
+ 'padding:10px 16px;border:0;border-radius:6px;background:#111;color:#fff;font-size:14px;cursor:pointer';
62
+ button.addEventListener('click', () => {
63
+ button.disabled = true;
64
+ // `Authorised` is what the real provider reports for a successful card
65
+ // entry. It is NOT settlement — see the checkout topic docs.
66
+ mockPublishEvent('checkout', 'payment-completed', {
67
+ orderId: order.orderId,
68
+ receiptId: order.receiptId,
69
+ resultCode: 'Authorised',
70
+ });
71
+ });
72
+ box.appendChild(label);
73
+ box.appendChild(button);
74
+ container.appendChild(box);
75
+ return {
76
+ success: true,
77
+ timestamp: new Date().toISOString(),
78
+ order,
79
+ };
80
+ };
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Guest contact for the order. There is no shopper account, so this is the only
3
+ * way to reach them — `email` is where the receipt goes and is required.
4
+ */
5
+ export interface StartCheckoutContact {
6
+ email: string;
7
+ name?: string;
8
+ phone?: string;
9
+ }
10
+ export interface StartCheckoutParams {
11
+ contact: StartCheckoutContact;
12
+ /**
13
+ * CSS SELECTOR for the element the payment fields mount into, e.g.
14
+ * `'#card-fields'`. The element must already be in the DOM when this is
15
+ * called.
16
+ *
17
+ * A SELECTOR, NOT AN ELEMENT — and this is not a style preference. Command
18
+ * params cross a `postMessage` boundary, which serializes them with the
19
+ * structured clone algorithm; a DOM node is not cloneable, so passing
20
+ * `ref.current` throws `DataCloneError: HTMLDivElement object could not be
21
+ * cloned` before the command is ever sent. The string is resolved on the
22
+ * runtime's side against the same document the page rendered.
23
+ */
24
+ container: string;
25
+ /**
26
+ * Where the provider returns the shopper after a redirect payment method
27
+ * (bank apps, wallets). Defaults to the current URL.
28
+ *
29
+ * Must be HTTPS and on the SAME ORIGIN the storefront token was minted for;
30
+ * the server rejects anything else, since this URL is handed to a payment
31
+ * provider and an open redirect on a checkout is a phishing primitive.
32
+ */
33
+ returnUrl?: string;
34
+ /**
35
+ * Overrides the cart-derived idempotency key. Leave unset: the default is
36
+ * derived from the cart, which is what makes a shopper's double-tap on "Pay"
37
+ * return the SAME order instead of creating a second, abandoned one.
38
+ */
39
+ idempotencyKey?: string;
40
+ /** Defaults to the outlet the storefront booted against. */
41
+ outletId?: string;
42
+ /** Forwarded verbatim to the provider's Drop-in (`showPayButton`, `locale`, field styling, …). */
43
+ dropinConfiguration?: Record<string, unknown>;
44
+ }
45
+ /**
46
+ * The created order. Deliberately says nothing about money having moved — see
47
+ * `paymentStatus` and the `checkout` topic.
48
+ */
49
+ export interface StartCheckoutOrder {
50
+ orderId: string;
51
+ receiptId: string;
52
+ /** The SERVER-computed total in integer minor units — the only total that matters. */
53
+ serverTotal: number;
54
+ currency: string;
55
+ /**
56
+ * `ready` — the payment fields are mounted and the shopper can pay.
57
+ * `unavailable` — THE ORDER EXISTS but no payment could be started, so the
58
+ * shopper has NOT been charged. Never report this as a failed order.
59
+ */
60
+ paymentStatus: 'ready' | 'unavailable';
61
+ /**
62
+ * One-time password for reading this order back, returned only on the first
63
+ * create. It is the ONLY route to this order's status — the guest token
64
+ * grants order creation and deliberately not order reads — so a caller that
65
+ * drops it cannot check whether the payment settled.
66
+ */
67
+ orderPassword?: string;
68
+ }
69
+ export interface StartCheckoutResponse {
70
+ success: boolean;
71
+ timestamp: string;
72
+ order: StartCheckoutOrder;
73
+ }
74
+ /**
75
+ * Creates the server-priced order and mounts the provider's hosted card fields.
76
+ *
77
+ * RESOLVES WHEN THE SHOPPER *CAN* PAY, NOT WHEN THEY HAVE. The shopper has not
78
+ * typed a card yet when this returns. The outcome arrives on the `checkout`
79
+ * topic instead.
80
+ */
81
+ export type StartCheckout = (params: StartCheckoutParams) => Promise<StartCheckoutResponse>;
@@ -0,0 +1,10 @@
1
+ // Start Checkout Types
2
+ //
3
+ // The ONLINE counterpart of the POS tenders: a shopper on a published website
4
+ // pays for the current cart with their own card. Mirrors kaching's storefront
5
+ // `startCheckout` input and result. All money is integer MINOR currency units.
6
+ //
7
+ // This command is served ONLY by the storefront runtime (a published website).
8
+ // On a register it does not exist, exactly as the till tenders (`cashPayment`,
9
+ // `terminalPayment`, `tapToPayPayment`, `chargeMoto`) do not exist online.
10
+ export {};
@@ -2,7 +2,7 @@
2
2
  * Mock Database for Standalone/Demo Mode
3
3
  * Stores mock data that mimics the Render environment
4
4
  */
5
- import { CFActiveCompany, CFActiveUser, CFActiveStation, CFActiveOutlet, CFActiveOrder, CFCustomer, CFProduct, CFActiveCart, CFCategory, CFActiveProduct, CFSession, CFActiveRefundDetails, CFSmartGridLayout, CFBooking, CFBookingAvailability, CFBookingResource } from '../CommonTypes';
5
+ import { CFActiveCompany, CFActiveUser, CFActiveStation, CFActiveOutlet, CFActiveOrder, CFCustomer, CFProduct, CFActiveCart, CFCategory, CFActiveProduct, CFSession, CFActiveRefundDetails, CFSmartGridLayout } from '../CommonTypes';
6
6
  export * from './mocks';
7
7
  /** Replace mock catalog / context data in place (same array references mock handlers use). */
8
8
  export interface MockDatabaseConfig {
@@ -59,7 +59,6 @@ export declare const MOCK_STATIONS: import("@final-commerce/common/pos-types").A
59
59
  export declare const MOCK_OUTLETS: import("@final-commerce/common/pos-types").ActiveOutlet[];
60
60
  export declare const MOCK_CUSTOMERS: import("@final-commerce/common/pos-types").ActiveCustomer[];
61
61
  export declare const MOCK_CATEGORIES: import("@final-commerce/common/pos-types").Category[];
62
- export declare const MOCK_PRODUCT_HAIRCUT: CFProduct;
63
62
  export declare const MOCK_PRODUCTS: import("@final-commerce/common/pos-types").FullProduct[];
64
63
  export declare const MOCK_ORDERS: import("@final-commerce/common/pos-types").ActiveOrder[];
65
64
  export declare const MOCK_PARKED_ORDERS: CFActiveOrder[];
@@ -88,9 +87,3 @@ export declare const createOrderFromCart: (paymentType: string, amount: number,
88
87
  * open with `amountToBeCharged` reset to what's left, and returns null.
89
88
  */
90
89
  export declare const applyMockPayment: (amount: number, paymentType: string, processor?: string) => CFActiveOrder | null;
91
- export declare const MOCK_BOOKING_RULES_ID = "rule_salon_30";
92
- export declare const MOCK_BOOKING_RESOURCES: CFBookingResource[];
93
- export declare const MOCK_BOOKINGS: CFBooking[];
94
- /** Live = confirmed, or held and not yet expired. An expired hold occupies nothing. */
95
- export declare const mockLiveBookings: () => CFBooking[];
96
- export declare const mockBookingAvailability: (productId: string, from: Date, to: Date, resourceId?: string) => CFBookingAvailability;
@@ -4,7 +4,6 @@
4
4
  */
5
5
  import { CFProductType, CFUserTypes, CurrencyCode, } from '../CommonTypes';
6
6
  import { extendPrice, resolveUnit, toBase } from '@final-commerce/common';
7
- import { BookingRatePeriod, BookingResourceKind, BookingType, ReservationStatus } from '@final-commerce/common';
8
7
  export * from './mocks';
9
8
  // Asset Imports - Using Remote URLs to avoid build complexity with asset copying
10
9
  const ASSETS_BASE_URL = 'https://raw.githubusercontent.com/Final-Commerce/command-frame/refs/heads/main/src/demo/assets';
@@ -650,14 +649,6 @@ export const MOCK_CATEGORIES = [
650
649
  MOCK_CATEGORY_VEGAN,
651
650
  MOCK_CATEGORY_SPICY,
652
651
  ];
653
- // A service, not a thing on a shelf: no stock, sold as a slot of somebody's time.
654
- // `bookingRulesId` is what tells a catalogue screen to ask for slots instead of stock.
655
- export const MOCK_PRODUCT_HAIRCUT = {
656
- ...createSimpleProduct('prod_haircut', 'Haircut', 4500, '', [MOCK_CATEGORY_SPECIALTY], 'Cut and finish, 30 minutes.'),
657
- images: [],
658
- productType: CFProductType.BOOKING,
659
- bookingRulesId: 'rule_salon_30',
660
- };
661
652
  export const MOCK_PRODUCTS = [
662
653
  MOCK_PRODUCT_BASIL_ALMOND,
663
654
  MOCK_PRODUCT_BEER,
@@ -673,7 +664,6 @@ export const MOCK_PRODUCTS = [
673
664
  MOCK_PRODUCT_CHILI_GARLIC,
674
665
  MOCK_PRODUCT_HABANERO,
675
666
  MOCK_PRODUCT_BLACK_GARLIC,
676
- MOCK_PRODUCT_HAIRCUT,
677
667
  ];
678
668
  export const MOCK_ORDERS = [MOCK_ORDER_1, MOCK_ORDER_2, MOCK_ORDER_3, MOCK_ORDER_4];
679
669
  export const MOCK_PARKED_ORDERS = [MOCK_PARKED_ORDER_1, MOCK_PARKED_ORDER_2];
@@ -924,86 +914,3 @@ export const applyMockPayment = (amount, paymentType, processor = 'cash') => {
924
914
  mockPublishEvent('payments', 'payment-done', { order });
925
915
  return order;
926
916
  };
927
- // ── Booking (FT-0064) ────────────────────────────────────────────────────────────
928
- // A salon: one service, two people who can perform it, a 30-minute slot with a
929
- // 5-minute turnaround, open 9–18. Enough to click through a booking screen with no
930
- // server. Availability here is COMPUTED, exactly as the host computes it — a mock
931
- // that returned a fixed list of slots would hide the one behaviour that matters:
932
- // a slot disappears once somebody takes it.
933
- export const MOCK_BOOKING_RULES_ID = 'rule_salon_30';
934
- const SLOT_MINUTES = 30;
935
- const BUFFER_MINUTES = 5;
936
- const OPEN_HOUR = 9;
937
- const CLOSE_HOUR = 18;
938
- export const MOCK_BOOKING_RESOURCES = [
939
- { id: 'res_marco', name: 'Marco', kind: BookingResourceKind.STAFF },
940
- { id: 'res_jessica', name: 'Jessica', kind: BookingResourceKind.STAFF },
941
- ];
942
- const at = (dayOffset, hour, minute = 0) => {
943
- const date = new Date();
944
- date.setDate(date.getDate() + dayOffset);
945
- date.setHours(hour, minute, 0, 0);
946
- return date;
947
- };
948
- const booking = (id, resourceId, start, status, customerName) => ({
949
- id,
950
- productId: MOCK_PRODUCT_HAIRCUT._id,
951
- resourceId,
952
- startAt: start.toISOString(),
953
- endAt: new Date(start.getTime() + SLOT_MINUTES * 60000).toISOString(),
954
- bufferEndAt: new Date(start.getTime() + (SLOT_MINUTES + BUFFER_MINUTES) * 60000).toISOString(),
955
- status,
956
- productName: MOCK_PRODUCT_HAIRCUT.name,
957
- resourceName: MOCK_BOOKING_RESOURCES.find((resource) => resource.id === resourceId)?.name,
958
- customerName,
959
- });
960
- export const MOCK_BOOKINGS = [
961
- booking('bk_1', 'res_marco', at(0, 10), ReservationStatus.CONFIRMED, 'Alex Green'),
962
- booking('bk_2', 'res_jessica', at(0, 11, 30), ReservationStatus.CONFIRMED, 'Dana White'),
963
- booking('bk_3', 'res_marco', at(1, 9, 30), ReservationStatus.CONFIRMED, 'Sam Blue'),
964
- ];
965
- /** Live = confirmed, or held and not yet expired. An expired hold occupies nothing. */
966
- export const mockLiveBookings = () => MOCK_BOOKINGS.filter(({ status, expiresAt }) => status === ReservationStatus.CONFIRMED ||
967
- (status === ReservationStatus.HELD && (!expiresAt || new Date(expiresAt) > new Date())));
968
- const takenBy = (resourceId, startAt, bufferEndAt) => mockLiveBookings().some((entry) => entry.resourceId === resourceId && new Date(entry.startAt) < bufferEndAt && new Date(entry.bufferEndAt) > startAt);
969
- export const mockBookingAvailability = (productId, from, to, resourceId) => {
970
- const serving = resourceId
971
- ? MOCK_BOOKING_RESOURCES.filter((resource) => resource.id === resourceId)
972
- : MOCK_BOOKING_RESOURCES;
973
- const slots = [];
974
- const step = (SLOT_MINUTES + BUFFER_MINUTES) * 60000;
975
- for (let day = 0; day < 14; day += 1) {
976
- const open = at(day, OPEN_HOUR);
977
- if (open < from || open > to)
978
- continue;
979
- const close = at(day, CLOSE_HOUR);
980
- for (let start = open.getTime(); start + SLOT_MINUTES * 60000 <= close.getTime(); start += step) {
981
- const startAt = new Date(start);
982
- const endAt = new Date(start + SLOT_MINUTES * 60000);
983
- const bufferEndAt = new Date(start + (SLOT_MINUTES + BUFFER_MINUTES) * 60000);
984
- if (bufferEndAt < new Date())
985
- continue;
986
- const resources = serving.map((resource) => {
987
- const free = takenBy(resource.id, startAt, bufferEndAt) ? 0 : 1;
988
- return { resourceId: resource.id, name: resource.name, capacity: 1, booked: 1 - free, free };
989
- });
990
- slots.push({
991
- startAt: startAt.toISOString(),
992
- endAt: endAt.toISOString(),
993
- bufferEndAt: bufferEndAt.toISOString(),
994
- canStart: true,
995
- capacity: resources.length,
996
- booked: resources.reduce((sum, entry) => sum + entry.booked, 0),
997
- free: resources.reduce((sum, entry) => sum + entry.free, 0),
998
- resources,
999
- });
1000
- }
1001
- }
1002
- return {
1003
- productId,
1004
- bookingRulesId: MOCK_BOOKING_RULES_ID,
1005
- bookingType: BookingType.APPOINTMENT,
1006
- ratePeriod: BookingRatePeriod.SLOT,
1007
- slots,
1008
- };
1009
- };
package/dist/index.d.ts CHANGED
@@ -2,13 +2,6 @@ export declare const command: {
2
2
  readonly exampleFunction: import(".").ExampleFunction;
3
3
  readonly generateAPIKey: import(".").GenerateAPIKey;
4
4
  readonly getProducts: import(".").GetProducts;
5
- readonly getBookingResources: import(".").GetBookingResources;
6
- readonly getBookingAvailability: import(".").GetBookingAvailability;
7
- readonly getBookings: import(".").GetBookings;
8
- readonly holdBooking: import(".").HoldBooking;
9
- readonly addBookingToCart: import(".").AddBookingToCart;
10
- readonly removeBookingFromCart: import(".").RemoveBookingFromCart;
11
- readonly cancelBooking: import(".").CancelBooking;
12
5
  readonly addCustomSale: import(".").AddCustomSale;
13
6
  readonly editCustomSale: import(".").EditCustomSale;
14
7
  readonly addNonRevenueItem: import(".").AddNonRevenueItem;
@@ -50,6 +43,7 @@ export declare const command: {
50
43
  readonly integrationPayment: import(".").IntegrationPayment;
51
44
  readonly createPaymentLink: import(".").CreatePaymentLink;
52
45
  readonly chargeMoto: import(".").ChargeMoto;
46
+ readonly startCheckout: import(".").StartCheckout;
53
47
  readonly addCustomerNote: import(".").AddCustomerNote;
54
48
  readonly removeCustomerNote: import(".").RemoveCustomerNote;
55
49
  readonly removeCustomerFromCart: import(".").RemoveCustomerFromCart;
@@ -126,13 +120,6 @@ export declare const command: {
126
120
  export type { ExampleFunction, ExampleFunctionParams, ExampleFunctionResponse } from './actions/example-function/types';
127
121
  export type { GenerateAPIKey, GenerateAPIKeyParams, GenerateAPIKeyResponse } from './actions/generate-api-key/types';
128
122
  export type { GetProducts, GetProductsParams, GetProductsResponse } from './actions/get-products/types';
129
- export type { GetBookingResources, GetBookingResourcesParams, GetBookingResourcesResponse, } from './actions/get-booking-resources/types';
130
- export type { GetBookingAvailability, GetBookingAvailabilityParams, GetBookingAvailabilityResponse, } from './actions/get-booking-availability/types';
131
- export type { GetBookings, GetBookingsParams, GetBookingsResponse } from './actions/get-bookings/types';
132
- export type { HoldBooking, HoldBookingParams, HoldBookingResponse } from './actions/hold-booking/types';
133
- export type { AddBookingToCart, AddBookingToCartParams, AddBookingToCartResponse, } from './actions/add-booking-to-cart/types';
134
- export type { RemoveBookingFromCart, RemoveBookingFromCartParams, RemoveBookingFromCartResponse, } from './actions/remove-booking-from-cart/types';
135
- export type { CancelBooking, CancelBookingParams, CancelBookingResponse } from './actions/cancel-booking/types';
136
123
  export type { AddCustomSale, AddCustomSaleParams, AddCustomSaleResponse } from './actions/add-custom-sale/types';
137
124
  export type { EditCustomSale, EditCustomSaleParams, EditCustomSaleResponse } from './actions/edit-custom-sale/types';
138
125
  export type { AddNonRevenueItem, AddNonRevenueItemParams, AddNonRevenueItemResponse, } from './actions/add-non-revenue-item/types';
@@ -192,6 +179,7 @@ export type { RedeemPayment, RedeemPaymentParams, RedeemPaymentResponse } from '
192
179
  export type { IntegrationPayment, IntegrationPaymentParams, IntegrationPaymentResponse, IntegrationEmvData, } from './actions/integration-payment/types';
193
180
  export type { CreatePaymentLink, CreatePaymentLinkParams, CreatePaymentLinkResponse, } from './actions/create-payment-link/types';
194
181
  export type { ChargeMoto, ChargeMotoParams, ChargeMotoResponse, ChargeMotoCardFields, } from './actions/charge-moto/types';
182
+ export type { StartCheckout, StartCheckoutParams, StartCheckoutResponse, StartCheckoutContact, StartCheckoutOrder, } from './actions/start-checkout/types';
195
183
  export type { AddCustomerNote, AddCustomerNoteParams, AddCustomerNoteResponse, } from './actions/add-customer-note/types';
196
184
  export type { RemoveCustomerNote, RemoveCustomerNoteParams, RemoveCustomerNoteResponse, } from './actions/remove-customer-note/types';
197
185
  export type { RemoveCustomerFromCart, RemoveCustomerFromCartResponse } from './actions/remove-customer-from-cart/types';
@@ -248,6 +236,7 @@ export { refundsTopic } from './pubsub/topics/refunds';
248
236
  export { productsTopic } from './pubsub/topics/products';
249
237
  export { cartTopic } from './pubsub/topics/cart';
250
238
  export { paymentsTopic } from './pubsub/topics/payments';
239
+ export { checkoutTopic } from './pubsub/topics/checkout';
251
240
  export { splitPaymentsTopic } from './pubsub/topics/split-payments';
252
241
  export { customTablesTopic } from './pubsub/topics/custom-tables';
253
242
  export { printTopic } from './pubsub/topics/print';
@@ -259,7 +248,6 @@ export { variantsTopic } from './pubsub/topics/variants';
259
248
  export { transactionsTopic } from './pubsub/topics/transactions';
260
249
  export { categoriesTopic } from './pubsub/topics/categories';
261
250
  export { attributesTopic } from './pubsub/topics/attributes';
262
- export { bookingsTopic } from './pubsub/topics/bookings';
263
251
  export type { CustomerCreatedPayload, CustomerUpdatedPayload, CustomerNoteAddedPayload, CustomerNoteDeletedPayload, CustomerAssignedPayload, CustomerUnassignedPayload, CustomerActiveSetPayload, CustomerActiveGetPayload, CustomerCreatedEvent, CustomerUpdatedEvent, CustomerNoteAddedEvent, CustomerNoteDeletedEvent, CustomerAssignedEvent, CustomerUnassignedEvent, CustomerActiveSetEvent, CustomerActiveGetEvent, CustomersEventType, CustomersEventPayload, } from './pubsub/topics/customers/types';
264
252
  export type { OrderCreatedPayload, OrderUpdatedPayload, OrderVoidedPayload, OrderActiveSetPayload, OrderActiveGetPayload, OrderCreatedEvent, OrderUpdatedEvent, OrderVoidedEvent, OrderActiveSetEvent, OrderActiveGetEvent, OrderStateTransitionCompletedPayload, OrderStateTransitionBlockedPayload, OrderStateTransitionCompletedEvent, OrderStateTransitionBlockedEvent, OrdersEventType, OrdersEventPayload, } from './pubsub/topics/orders/types';
265
253
  export type { RefundCreatedPayload, RefundUpdatedPayload, RefundActiveSetPayload, RefundActiveGetPayload, RefundCreatedEvent, RefundUpdatedEvent, RefundActiveSetEvent, RefundActiveGetEvent, RefundsEventType, RefundsEventPayload, } from './pubsub/topics/refunds/types';
@@ -270,11 +258,11 @@ export type { SessionActiveSetPayload, SessionActiveGetPayload, SessionActiveSet
270
258
  export type { UserActiveSetPayload, UserActiveGetPayload, UserActiveSetEvent, UserActiveGetEvent, UserCreatedPayload, UserCreatedEvent, UserUpdatedPayload, UserUpdatedEvent, UsersEventType, UsersEventPayload, } from './pubsub/topics/users/types';
271
259
  export type { VariantCreatedPayload, VariantCreatedEvent, VariantUpdatedPayload, VariantUpdatedEvent, VariantsEventType, VariantsEventPayload, } from './pubsub/topics/variants/types';
272
260
  export type { TransactionCreatedPayload, TransactionCreatedEvent, TransactionUpdatedPayload, TransactionUpdatedEvent, TransactionsEventType, TransactionsEventPayload, } from './pubsub/topics/transactions/types';
273
- export type { BookingCreatedPayload, BookingCreatedEvent, BookingUpdatedPayload, BookingUpdatedEvent, BookingSetupChangedPayload, BookingSetupChangedEvent, BookingsEventType, BookingsEventPayload, } from './pubsub/topics/bookings/types';
274
261
  export type { CategoryCreatedPayload, CategoryCreatedEvent, CategoryUpdatedPayload, CategoryUpdatedEvent, CategoriesEventType, CategoriesEventPayload, } from './pubsub/topics/categories/types';
275
262
  export type { AttributeCreatedPayload, AttributeCreatedEvent, AttributeUpdatedPayload, AttributeUpdatedEvent, AttributesEventType, AttributesEventPayload, } from './pubsub/topics/attributes/types';
276
263
  export type { CartCreatedPayload, CartCustomerAssignedPayload, ProductAddedPayload, ProductDeletedPayload, CartDiscountAddedPayload, CartDiscountRemovedPayload, CartFeeAddedPayload, CartFeeRemovedPayload, ProductDiscountAddedPayload, ProductDiscountRemovedPayload, ProductFeeAddedPayload, ProductFeeRemovedPayload, ProductNoteAddedPayload, ProductNoteRemovedPayload, CartCreatedEvent, CartCustomerAssignedEvent, ProductAddedEvent, ProductDeletedEvent, CartDiscountAddedEvent, CartDiscountRemovedEvent, CartFeeAddedEvent, CartFeeRemovedEvent, ProductDiscountAddedEvent, ProductDiscountRemovedEvent, ProductFeeAddedEvent, ProductFeeRemovedEvent, ProductNoteAddedEvent, ProductNoteRemovedEvent, CartEventType, CartEventPayload, } from './pubsub/topics/cart/types';
277
264
  export type { PaymentDonePayload, PaymentErrPayload, PaymentDoneEvent, PaymentErrEvent, PaymentsEventType, PaymentsEventPayload, } from './pubsub/topics/payments/types';
265
+ export type { CheckoutStartedPayload, PaymentCompletedPayload, PaymentFailedPayload, CheckoutStartedEvent, PaymentCompletedEvent, PaymentFailedEvent, CheckoutEventType, CheckoutEventPayload, } from './pubsub/topics/checkout/types';
278
266
  export type { SplitPaymentUpdatedPayload, SplitPaymentUpdatedEvent, SplitPaymentsEventType, SplitPaymentsEventPayload, } from './pubsub/topics/split-payments/types';
279
267
  export type { RowCreatedPayload, RowUpdatedPayload, RowDeletedPayload, RowCreatedEvent, RowUpdatedEvent, RowDeletedEvent, CustomTablesEventType, CustomTablesEventPayload, } from './pubsub/topics/custom-tables/types';
280
268
  export type { PrintStartedPayload, PrintCompletedPayload, PrintErrorPayload, PrintStartedEvent, PrintCompletedEvent, PrintErrorEvent, PrintEventType, PrintEventPayload, } from './pubsub/topics/print/types';
package/dist/index.js CHANGED
@@ -1,13 +1,6 @@
1
1
  // Import actions from new folder structure
2
2
  import { exampleFunction } from './actions/example-function/action';
3
3
  import { getProducts } from './actions/get-products/action';
4
- import { getBookingResources } from './actions/get-booking-resources/action';
5
- import { getBookingAvailability } from './actions/get-booking-availability/action';
6
- import { getBookings } from './actions/get-bookings/action';
7
- import { holdBooking } from './actions/hold-booking/action';
8
- import { addBookingToCart } from './actions/add-booking-to-cart/action';
9
- import { removeBookingFromCart } from './actions/remove-booking-from-cart/action';
10
- import { cancelBooking } from './actions/cancel-booking/action';
11
4
  import { addCustomSale } from './actions/add-custom-sale/action';
12
5
  import { editCustomSale } from './actions/edit-custom-sale/action';
13
6
  import { addNonRevenueItem } from './actions/add-non-revenue-item/action';
@@ -50,6 +43,7 @@ import { redeemPayment } from './actions/redeem-payment/action';
50
43
  import { integrationPayment } from './actions/integration-payment/action';
51
44
  import { createPaymentLink } from './actions/create-payment-link/action';
52
45
  import { chargeMoto } from './actions/charge-moto/action';
46
+ import { startCheckout } from './actions/start-checkout/action';
53
47
  // Customer Actions
54
48
  import { addCustomerNote } from './actions/add-customer-note/action';
55
49
  import { removeCustomerNote } from './actions/remove-customer-note/action';
@@ -144,13 +138,6 @@ export const command = {
144
138
  exampleFunction,
145
139
  generateAPIKey,
146
140
  getProducts,
147
- getBookingResources,
148
- getBookingAvailability,
149
- getBookings,
150
- holdBooking,
151
- addBookingToCart,
152
- removeBookingFromCart,
153
- cancelBooking,
154
141
  addCustomSale,
155
142
  editCustomSale,
156
143
  addNonRevenueItem,
@@ -194,6 +181,7 @@ export const command = {
194
181
  integrationPayment,
195
182
  createPaymentLink,
196
183
  chargeMoto,
184
+ startCheckout,
197
185
  // Customer Actions
198
186
  addCustomerNote,
199
187
  removeCustomerNote,
@@ -304,6 +292,7 @@ export { refundsTopic } from './pubsub/topics/refunds';
304
292
  export { productsTopic } from './pubsub/topics/products';
305
293
  export { cartTopic } from './pubsub/topics/cart';
306
294
  export { paymentsTopic } from './pubsub/topics/payments';
295
+ export { checkoutTopic } from './pubsub/topics/checkout';
307
296
  export { splitPaymentsTopic } from './pubsub/topics/split-payments';
308
297
  export { customTablesTopic } from './pubsub/topics/custom-tables';
309
298
  export { printTopic } from './pubsub/topics/print';
@@ -315,7 +304,6 @@ export { variantsTopic } from './pubsub/topics/variants';
315
304
  export { transactionsTopic } from './pubsub/topics/transactions';
316
305
  export { categoriesTopic } from './pubsub/topics/categories';
317
306
  export { attributesTopic } from './pubsub/topics/attributes';
318
- export { bookingsTopic } from './pubsub/topics/bookings';
319
307
  // Export Custom Tables Types
320
308
  export { AttributeType } from './common-types/attribute-type';
321
309
  // State Machine Fragments
@@ -31,6 +31,7 @@ import { mockCashPayment } from '../../actions/cash-payment/mock';
31
31
  import { mockGetCashRoundingAmount } from '../../actions/get-cash-rounding-amount/mock';
32
32
  import { mockCreatePaymentLink } from '../../actions/create-payment-link/mock';
33
33
  import { mockChargeMoto } from '../../actions/charge-moto/mock';
34
+ import { mockStartCheckout } from '../../actions/start-checkout/mock';
34
35
  import { mockGetTimeClockStatus } from '../../actions/get-time-clock-status/mock';
35
36
  import { mockClearCart } from '../../actions/clear-cart/mock';
36
37
  import { mockDeleteParkedOrder } from '../../actions/delete-parked-order/mock';
@@ -42,13 +43,6 @@ import { mockGetCurrentCart } from '../../actions/get-current-cart/mock';
42
43
  import { mockGetCustomers } from '../../actions/get-customers/mock';
43
44
  import { mockGetOrders } from '../../actions/get-orders/mock';
44
45
  import { mockGetProducts } from '../../actions/get-products/mock';
45
- import { mockGetBookingResources } from '../../actions/get-booking-resources/mock';
46
- import { mockGetBookingAvailability } from '../../actions/get-booking-availability/mock';
47
- import { mockGetBookings } from '../../actions/get-bookings/mock';
48
- import { mockHoldBooking } from '../../actions/hold-booking/mock';
49
- import { mockAddBookingToCart } from '../../actions/add-booking-to-cart/mock';
50
- import { mockRemoveBookingFromCart } from '../../actions/remove-booking-from-cart/mock';
51
- import { mockCancelBooking } from '../../actions/cancel-booking/mock';
52
46
  import { mockGetRefunds } from '../../actions/get-refunds/mock';
53
47
  import { mockGetTaxTables } from '../../actions/get-tax-tables/mock';
54
48
  import { mockGetRemainingRefundableQuantities } from '../../actions/get-remaining-refundable-quantities/mock';
@@ -135,6 +129,7 @@ export const RENDER_MOCKS = {
135
129
  getCashRoundingAmount: mockGetCashRoundingAmount,
136
130
  createPaymentLink: mockCreatePaymentLink,
137
131
  chargeMoto: mockChargeMoto,
132
+ startCheckout: mockStartCheckout,
138
133
  clearCart: mockClearCart,
139
134
  deleteParkedOrder: mockDeleteParkedOrder,
140
135
  voidOrder: mockVoidOrder,
@@ -145,13 +140,6 @@ export const RENDER_MOCKS = {
145
140
  getCustomers: mockGetCustomers,
146
141
  getOrders: mockGetOrders,
147
142
  getProducts: mockGetProducts,
148
- getBookingResources: mockGetBookingResources,
149
- getBookingAvailability: mockGetBookingAvailability,
150
- getBookings: mockGetBookings,
151
- holdBooking: mockHoldBooking,
152
- addBookingToCart: mockAddBookingToCart,
153
- removeBookingFromCart: mockRemoveBookingFromCart,
154
- cancelBooking: mockCancelBooking,
155
143
  getRefunds: mockGetRefunds,
156
144
  getTaxTables: mockGetTaxTables,
157
145
  getRemainingRefundableQuantities: mockGetRemainingRefundableQuantities,
@@ -1,14 +1,7 @@
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, GetBookingResources, GetBookingAvailability, GetBookings, HoldBooking, AddBookingToCart, RemoveBookingFromCart, CancelBooking, CreatePaymentLink, ChargeMoto, GetTimeClockStatus } 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, StartCheckout, GetTimeClockStatus } from '../../index';
2
2
  export interface RenderProviderActions {
3
3
  exampleFunction: ExampleFunction;
4
4
  getProducts: GetProducts;
5
- getBookingResources: GetBookingResources;
6
- getBookingAvailability: GetBookingAvailability;
7
- getBookings: GetBookings;
8
- holdBooking: HoldBooking;
9
- addBookingToCart: AddBookingToCart;
10
- removeBookingFromCart: RemoveBookingFromCart;
11
- cancelBooking: CancelBooking;
12
5
  addCustomSale: AddCustomSale;
13
6
  editCustomSale: EditCustomSale;
14
7
  getCustomers: GetCustomers;
@@ -50,6 +43,12 @@ export interface RenderProviderActions {
50
43
  integrationPayment: IntegrationPayment;
51
44
  createPaymentLink: CreatePaymentLink;
52
45
  chargeMoto: ChargeMoto;
46
+ /**
47
+ * ONLINE checkout — served only by the storefront runtime (a published
48
+ * website). The till tenders above are refused there, and this is refused on
49
+ * a register, because the two declare different things to the card networks.
50
+ */
51
+ startCheckout: StartCheckout;
53
52
  addNonRevenueItem: AddNonRevenueItem;
54
53
  addCustomerNote: AddCustomerNote;
55
54
  removeCustomerNote: RemoveCustomerNote;
@@ -0,0 +1,26 @@
1
+ import type { TopicEvent } from "../../../types";
2
+ /**
3
+ * Payload for checkout-started event
4
+ *
5
+ * The order EXISTS and is unpaid. `serverTotal` is the server's own price for
6
+ * the cart, in integer minor units — the browser never sends a price, so this
7
+ * is the first and only authoritative total.
8
+ */
9
+ export interface CheckoutStartedPayload {
10
+ orderId: string;
11
+ receiptId: string;
12
+ serverTotal: number;
13
+ currency: string;
14
+ /**
15
+ * `ready` — the payment fields are mounted and the shopper can pay.
16
+ * `unavailable` — the order exists but no payment could be started, so the
17
+ * shopper has NOT been charged.
18
+ */
19
+ paymentStatus: "ready" | "unavailable";
20
+ /** One-time password for reading this order back. Returned only on the first create. */
21
+ orderPassword?: string;
22
+ }
23
+ /**
24
+ * Typed event for checkout-started
25
+ */
26
+ export type CheckoutStartedEvent = TopicEvent<CheckoutStartedPayload>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Checkout Topic Definition
3
+ * Defines the checkout topic and its available event types
4
+ */
5
+ import type { TopicDefinition } from "../../types";
6
+ export declare const checkoutTopic: TopicDefinition;
7
+ export * from "./types";