@final-commerce/command-frame 0.7.0-staging.4 → 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.
- package/dist/CommonTypes.d.ts +1 -11
- package/dist/actions/start-checkout/action.d.ts +6 -0
- package/dist/actions/start-checkout/action.js +8 -0
- package/dist/actions/start-checkout/mock.d.ts +16 -0
- package/dist/actions/start-checkout/mock.js +80 -0
- package/dist/actions/start-checkout/types.d.ts +81 -0
- package/dist/actions/start-checkout/types.js +10 -0
- package/dist/demo/database.d.ts +1 -12
- package/dist/demo/database.js +0 -127
- package/dist/index.d.ts +4 -16
- package/dist/index.js +3 -15
- package/dist/projects/render/mocks.js +2 -14
- package/dist/projects/render/types.d.ts +7 -8
- package/dist/pubsub/topics/checkout/checkout-started/types.d.ts +26 -0
- package/dist/pubsub/topics/checkout/index.d.ts +7 -0
- package/dist/pubsub/topics/checkout/index.js +28 -0
- package/dist/pubsub/topics/checkout/payment-completed/types.d.ts +19 -0
- package/dist/pubsub/topics/checkout/payment-failed/types.d.ts +20 -0
- package/dist/pubsub/topics/checkout/types.d.ts +12 -0
- package/dist/pubsub/topics/checkout/types.js +8 -0
- package/dist/pubsub/topics/index.d.ts +17 -17
- package/dist/pubsub/topics/index.js +17 -17
- package/dist/pubsub/topics/types.d.ts +8 -2
- package/package.json +2 -2
- package/dist/actions/add-booking-to-cart/action.d.ts +0 -6
- package/dist/actions/add-booking-to-cart/action.js +0 -8
- package/dist/actions/add-booking-to-cart/mock.d.ts +0 -2
- package/dist/actions/add-booking-to-cart/mock.js +0 -44
- package/dist/actions/add-booking-to-cart/types.d.ts +0 -23
- package/dist/actions/cancel-booking/action.d.ts +0 -6
- package/dist/actions/cancel-booking/action.js +0 -8
- package/dist/actions/cancel-booking/mock.d.ts +0 -2
- package/dist/actions/cancel-booking/mock.js +0 -10
- package/dist/actions/cancel-booking/types.d.ts +0 -10
- package/dist/actions/get-booking-availability/action.d.ts +0 -6
- package/dist/actions/get-booking-availability/action.js +0 -8
- package/dist/actions/get-booking-availability/mock.d.ts +0 -2
- package/dist/actions/get-booking-availability/mock.js +0 -6
- package/dist/actions/get-booking-availability/types.d.ts +0 -18
- package/dist/actions/get-booking-resources/action.d.ts +0 -6
- package/dist/actions/get-booking-resources/action.js +0 -8
- package/dist/actions/get-booking-resources/mock.d.ts +0 -2
- package/dist/actions/get-booking-resources/mock.js +0 -7
- package/dist/actions/get-booking-resources/types.d.ts +0 -12
- package/dist/actions/get-booking-resources/types.js +0 -1
- package/dist/actions/get-bookings/action.d.ts +0 -6
- package/dist/actions/get-bookings/action.js +0 -8
- package/dist/actions/get-bookings/mock.d.ts +0 -2
- package/dist/actions/get-bookings/mock.js +0 -20
- package/dist/actions/get-bookings/types.d.ts +0 -18
- package/dist/actions/get-bookings/types.js +0 -1
- package/dist/actions/hold-booking/action.d.ts +0 -6
- package/dist/actions/hold-booking/action.js +0 -8
- package/dist/actions/hold-booking/mock.d.ts +0 -2
- package/dist/actions/hold-booking/mock.js +0 -33
- package/dist/actions/hold-booking/types.d.ts +0 -24
- package/dist/actions/hold-booking/types.js +0 -1
- package/dist/actions/remove-booking-from-cart/action.d.ts +0 -6
- package/dist/actions/remove-booking-from-cart/action.js +0 -8
- package/dist/actions/remove-booking-from-cart/mock.d.ts +0 -2
- package/dist/actions/remove-booking-from-cart/mock.js +0 -26
- package/dist/actions/remove-booking-from-cart/types.d.ts +0 -12
- package/dist/actions/remove-booking-from-cart/types.js +0 -1
- package/dist/pubsub/topics/bookings/booking-created/types.d.ts +0 -6
- package/dist/pubsub/topics/bookings/booking-created/types.js +0 -1
- package/dist/pubsub/topics/bookings/booking-setup-changed/types.d.ts +0 -15
- package/dist/pubsub/topics/bookings/booking-setup-changed/types.js +0 -1
- package/dist/pubsub/topics/bookings/booking-updated/types.d.ts +0 -6
- package/dist/pubsub/topics/bookings/booking-updated/types.js +0 -1
- package/dist/pubsub/topics/bookings/index.d.ts +0 -3
- package/dist/pubsub/topics/bookings/index.js +0 -27
- package/dist/pubsub/topics/bookings/types.d.ts +0 -8
- package/dist/pubsub/topics/bookings/types.js +0 -3
- /package/dist/{actions/add-booking-to-cart → pubsub/topics/checkout/checkout-started}/types.js +0 -0
- /package/dist/{actions/cancel-booking → pubsub/topics/checkout/payment-completed}/types.js +0 -0
- /package/dist/{actions/get-booking-availability → pubsub/topics/checkout/payment-failed}/types.js +0 -0
package/dist/CommonTypes.d.ts
CHANGED
|
@@ -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
|
|
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,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 {};
|
package/dist/demo/database.d.ts
CHANGED
|
@@ -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
|
|
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 {
|
|
@@ -15,10 +15,6 @@ export interface MockDatabaseConfig {
|
|
|
15
15
|
products?: CFProduct[];
|
|
16
16
|
orders?: CFActiveOrder[];
|
|
17
17
|
parkedOrders?: CFActiveOrder[];
|
|
18
|
-
/** Who is scarce: the staff, rooms or machines the dataset's services are booked against. */
|
|
19
|
-
bookingResources?: CFBookingResource[];
|
|
20
|
-
/** Windows already taken when the dataset loads, so a calendar does not open empty. */
|
|
21
|
-
bookings?: CFBooking[];
|
|
22
18
|
}
|
|
23
19
|
export declare const MOCK_COMPANY: CFActiveCompany;
|
|
24
20
|
export declare const MOCK_OUTLET_MAIN: CFActiveOutlet;
|
|
@@ -63,7 +59,6 @@ export declare const MOCK_STATIONS: import("@final-commerce/common/pos-types").A
|
|
|
63
59
|
export declare const MOCK_OUTLETS: import("@final-commerce/common/pos-types").ActiveOutlet[];
|
|
64
60
|
export declare const MOCK_CUSTOMERS: import("@final-commerce/common/pos-types").ActiveCustomer[];
|
|
65
61
|
export declare const MOCK_CATEGORIES: import("@final-commerce/common/pos-types").Category[];
|
|
66
|
-
export declare const MOCK_PRODUCT_HAIRCUT: CFProduct;
|
|
67
62
|
export declare const MOCK_PRODUCTS: import("@final-commerce/common/pos-types").FullProduct[];
|
|
68
63
|
export declare const MOCK_ORDERS: import("@final-commerce/common/pos-types").ActiveOrder[];
|
|
69
64
|
export declare const MOCK_PARKED_ORDERS: CFActiveOrder[];
|
|
@@ -92,9 +87,3 @@ export declare const createOrderFromCart: (paymentType: string, amount: number,
|
|
|
92
87
|
* open with `amountToBeCharged` reset to what's left, and returns null.
|
|
93
88
|
*/
|
|
94
89
|
export declare const applyMockPayment: (amount: number, paymentType: string, processor?: string) => CFActiveOrder | null;
|
|
95
|
-
export declare const MOCK_BOOKING_RULES_ID = "rule_salon_30";
|
|
96
|
-
export declare const MOCK_BOOKING_RESOURCES: CFBookingResource[];
|
|
97
|
-
export declare const MOCK_BOOKINGS: CFBooking[];
|
|
98
|
-
/** Live = confirmed, or held and not yet expired. An expired hold occupies nothing. */
|
|
99
|
-
export declare const mockLiveBookings: () => CFBooking[];
|
|
100
|
-
export declare const mockBookingAvailability: (productId: string, from: Date, to: Date, resourceId?: string) => CFBookingAvailability;
|
package/dist/demo/database.js
CHANGED
|
@@ -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];
|
|
@@ -688,7 +678,6 @@ export let MOCK_CART = {
|
|
|
688
678
|
remainingBalance: 0,
|
|
689
679
|
products: [],
|
|
690
680
|
customSales: [],
|
|
691
|
-
reservations: [],
|
|
692
681
|
nonRevenueItems: [],
|
|
693
682
|
customer: null,
|
|
694
683
|
};
|
|
@@ -709,7 +698,6 @@ export const resetMockCart = () => {
|
|
|
709
698
|
remainingBalance: 0,
|
|
710
699
|
products: [],
|
|
711
700
|
customSales: [],
|
|
712
|
-
reservations: [],
|
|
713
701
|
nonRevenueItems: [],
|
|
714
702
|
customer: null,
|
|
715
703
|
};
|
|
@@ -754,12 +742,6 @@ export function setMockDatabase(config) {
|
|
|
754
742
|
if (config.parkedOrders !== undefined) {
|
|
755
743
|
MOCK_PARKED_ORDERS.splice(0, MOCK_PARKED_ORDERS.length, ...config.parkedOrders);
|
|
756
744
|
}
|
|
757
|
-
if (config.bookingResources !== undefined) {
|
|
758
|
-
MOCK_BOOKING_RESOURCES.splice(0, MOCK_BOOKING_RESOURCES.length, ...config.bookingResources);
|
|
759
|
-
}
|
|
760
|
-
if (config.bookings !== undefined) {
|
|
761
|
-
MOCK_BOOKINGS.splice(0, MOCK_BOOKINGS.length, ...config.bookings);
|
|
762
|
-
}
|
|
763
745
|
if (MOCK_OUTLETS.length > 0) {
|
|
764
746
|
Object.assign(MOCK_OUTLET_MAIN, MOCK_OUTLETS[0]);
|
|
765
747
|
if (MOCK_OUTLET_MAIN.id === undefined && MOCK_OUTLET_MAIN._id !== undefined) {
|
|
@@ -896,30 +878,6 @@ export const createOrderFromCart = (paymentType, amount, processor = 'cash') =>
|
|
|
896
878
|
billing: MOCK_CART.customer?.billing || null,
|
|
897
879
|
shipping: MOCK_CART.customer?.shipping || null,
|
|
898
880
|
lineItems,
|
|
899
|
-
// A paid booking is a sale: it belongs on the order (and thus the receipt),
|
|
900
|
-
// in its own array rather than among the line items, and CONFIRMED — payment
|
|
901
|
-
// is what turns a held window into a kept appointment.
|
|
902
|
-
reservations: (MOCK_CART.reservations ?? []).map((reservation) => ({
|
|
903
|
-
internalId: reservation.internalId,
|
|
904
|
-
bookingId: reservation.bookingId,
|
|
905
|
-
productId: reservation.productId,
|
|
906
|
-
variantId: reservation.variantId,
|
|
907
|
-
resourceId: reservation.resourceId,
|
|
908
|
-
name: reservation.name,
|
|
909
|
-
resourceName: reservation.resourceName,
|
|
910
|
-
price: reservation.price,
|
|
911
|
-
quantity: reservation.quantity,
|
|
912
|
-
total: reservation.total,
|
|
913
|
-
taxTableId: reservation.taxTableId,
|
|
914
|
-
startAt: reservation.startAt,
|
|
915
|
-
endAt: reservation.endAt,
|
|
916
|
-
bufferEndAt: reservation.bufferEndAt,
|
|
917
|
-
// The mock computes no tax anywhere — line items ship `taxes: []` too.
|
|
918
|
-
taxes: [],
|
|
919
|
-
// `expiresAt` deliberately does not come along: a paid booking has no
|
|
920
|
-
// clock left to run out, which is what CONFIRMED means.
|
|
921
|
-
status: ReservationStatus.CONFIRMED,
|
|
922
|
-
})),
|
|
923
881
|
customSales: [],
|
|
924
882
|
balance: 0,
|
|
925
883
|
user: employeeUser,
|
|
@@ -956,88 +914,3 @@ export const applyMockPayment = (amount, paymentType, processor = 'cash') => {
|
|
|
956
914
|
mockPublishEvent('payments', 'payment-done', { order });
|
|
957
915
|
return order;
|
|
958
916
|
};
|
|
959
|
-
// ── Booking (FT-0064) ────────────────────────────────────────────────────────────
|
|
960
|
-
// A salon: one service, two people who can perform it, a 30-minute slot with a
|
|
961
|
-
// 5-minute turnaround, open 9–18. Enough to click through a booking screen with no
|
|
962
|
-
// server. Availability here is COMPUTED, exactly as the host computes it — a mock
|
|
963
|
-
// that returned a fixed list of slots would hide the one behaviour that matters:
|
|
964
|
-
// a slot disappears once somebody takes it.
|
|
965
|
-
export const MOCK_BOOKING_RULES_ID = 'rule_salon_30';
|
|
966
|
-
const SLOT_MINUTES = 30;
|
|
967
|
-
const BUFFER_MINUTES = 5;
|
|
968
|
-
const OPEN_HOUR = 9;
|
|
969
|
-
const CLOSE_HOUR = 18;
|
|
970
|
-
// Rooms, not people: a resource is whatever is scarce, and a room is the case that
|
|
971
|
-
// reads the same in every vertical a dataset might describe.
|
|
972
|
-
export const MOCK_BOOKING_RESOURCES = [
|
|
973
|
-
{ id: 'res_room_1', name: 'Room 1', kind: BookingResourceKind.ROOM },
|
|
974
|
-
{ id: 'res_room_2', name: 'Room 2', kind: BookingResourceKind.ROOM },
|
|
975
|
-
];
|
|
976
|
-
const at = (dayOffset, hour, minute = 0) => {
|
|
977
|
-
const date = new Date();
|
|
978
|
-
date.setDate(date.getDate() + dayOffset);
|
|
979
|
-
date.setHours(hour, minute, 0, 0);
|
|
980
|
-
return date;
|
|
981
|
-
};
|
|
982
|
-
const booking = (id, resourceId, start, status, customerName) => ({
|
|
983
|
-
id,
|
|
984
|
-
productId: MOCK_PRODUCT_HAIRCUT._id,
|
|
985
|
-
resourceId,
|
|
986
|
-
startAt: start.toISOString(),
|
|
987
|
-
endAt: new Date(start.getTime() + SLOT_MINUTES * 60000).toISOString(),
|
|
988
|
-
bufferEndAt: new Date(start.getTime() + (SLOT_MINUTES + BUFFER_MINUTES) * 60000).toISOString(),
|
|
989
|
-
status,
|
|
990
|
-
productName: MOCK_PRODUCT_HAIRCUT.name,
|
|
991
|
-
resourceName: MOCK_BOOKING_RESOURCES.find((resource) => resource.id === resourceId)?.name,
|
|
992
|
-
customerName,
|
|
993
|
-
});
|
|
994
|
-
export const MOCK_BOOKINGS = [
|
|
995
|
-
booking('bk_1', 'res_room_1', at(0, 10), ReservationStatus.CONFIRMED, 'Alex Green'),
|
|
996
|
-
booking('bk_2', 'res_room_2', at(0, 11, 30), ReservationStatus.CONFIRMED, 'Dana White'),
|
|
997
|
-
booking('bk_3', 'res_room_1', at(1, 9, 30), ReservationStatus.CONFIRMED, 'Sam Blue'),
|
|
998
|
-
];
|
|
999
|
-
/** Live = confirmed, or held and not yet expired. An expired hold occupies nothing. */
|
|
1000
|
-
export const mockLiveBookings = () => MOCK_BOOKINGS.filter(({ status, expiresAt }) => status === ReservationStatus.CONFIRMED ||
|
|
1001
|
-
(status === ReservationStatus.HELD && (!expiresAt || new Date(expiresAt) > new Date())));
|
|
1002
|
-
const takenBy = (resourceId, startAt, bufferEndAt) => mockLiveBookings().some((entry) => entry.resourceId === resourceId && new Date(entry.startAt) < bufferEndAt && new Date(entry.bufferEndAt) > startAt);
|
|
1003
|
-
export const mockBookingAvailability = (productId, from, to, resourceId) => {
|
|
1004
|
-
const serving = resourceId
|
|
1005
|
-
? MOCK_BOOKING_RESOURCES.filter((resource) => resource.id === resourceId)
|
|
1006
|
-
: MOCK_BOOKING_RESOURCES;
|
|
1007
|
-
const slots = [];
|
|
1008
|
-
const step = (SLOT_MINUTES + BUFFER_MINUTES) * 60000;
|
|
1009
|
-
for (let day = 0; day < 14; day += 1) {
|
|
1010
|
-
const open = at(day, OPEN_HOUR);
|
|
1011
|
-
if (open < from || open > to)
|
|
1012
|
-
continue;
|
|
1013
|
-
const close = at(day, CLOSE_HOUR);
|
|
1014
|
-
for (let start = open.getTime(); start + SLOT_MINUTES * 60000 <= close.getTime(); start += step) {
|
|
1015
|
-
const startAt = new Date(start);
|
|
1016
|
-
const endAt = new Date(start + SLOT_MINUTES * 60000);
|
|
1017
|
-
const bufferEndAt = new Date(start + (SLOT_MINUTES + BUFFER_MINUTES) * 60000);
|
|
1018
|
-
if (bufferEndAt < new Date())
|
|
1019
|
-
continue;
|
|
1020
|
-
const resources = serving.map((resource) => {
|
|
1021
|
-
const free = takenBy(resource.id, startAt, bufferEndAt) ? 0 : 1;
|
|
1022
|
-
return { resourceId: resource.id, name: resource.name, capacity: 1, booked: 1 - free, free };
|
|
1023
|
-
});
|
|
1024
|
-
slots.push({
|
|
1025
|
-
startAt: startAt.toISOString(),
|
|
1026
|
-
endAt: endAt.toISOString(),
|
|
1027
|
-
bufferEndAt: bufferEndAt.toISOString(),
|
|
1028
|
-
canStart: true,
|
|
1029
|
-
capacity: resources.length,
|
|
1030
|
-
booked: resources.reduce((sum, entry) => sum + entry.booked, 0),
|
|
1031
|
-
free: resources.reduce((sum, entry) => sum + entry.free, 0),
|
|
1032
|
-
resources,
|
|
1033
|
-
});
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
return {
|
|
1037
|
-
productId,
|
|
1038
|
-
bookingRulesId: MOCK_BOOKING_RULES_ID,
|
|
1039
|
-
bookingType: BookingType.APPOINTMENT,
|
|
1040
|
-
ratePeriod: BookingRatePeriod.SLOT,
|
|
1041
|
-
slots,
|
|
1042
|
-
};
|
|
1043
|
-
};
|
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,
|